EventBuzz_Console/dist/assets/index-Cq3hylG7.js

2601 lines
2.9 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var _J=Object.defineProperty;var CJ=(e,t,r)=>t in e?_J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var yn=(e,t,r)=>CJ(e,typeof t!="symbol"?t+"":t,r);function EJ(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const o in n)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(n,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>n[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();var L0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r5={exports:{}},my={},n5={exports:{}},qr={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var vO;function AJ(){if(vO)return qr;vO=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function h(D){return D===null||typeof D!="object"?null:(D=f&&D[f]||D["@@iterator"],typeof D=="function"?D:null)}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,m={};function b(D,z,q){this.props=D,this.context=z,this.refs=m,this.updater=q||p}b.prototype.isReactComponent={},b.prototype.setState=function(D,z){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,z,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function x(){}x.prototype=b.prototype;function w(D,z,q){this.props=D,this.context=z,this.refs=m,this.updater=q||p}var k=w.prototype=new x;k.constructor=w,v(k,b.prototype),k.isPureReactComponent=!0;var j=Array.isArray,_=Object.prototype.hasOwnProperty,T={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function P(D,z,q){var G,U={},Q=null,K=null;if(z!=null)for(G in z.ref!==void 0&&(K=z.ref),z.key!==void 0&&(Q=""+z.key),z)_.call(z,G)&&!A.hasOwnProperty(G)&&(U[G]=z[G]);var re=arguments.length-2;if(re===1)U.children=q;else if(1<re){for(var H=Array(re),ie=0;ie<re;ie++)H[ie]=arguments[ie+2];U.children=H}if(D&&D.defaultProps)for(G in re=D.defaultProps,re)U[G]===void 0&&(U[G]=re[G]);return{$$typeof:e,type:D,key:Q,ref:K,props:U,_owner:T.current}}function N(D,z){return{$$typeof:e,type:D.type,key:z,ref:D.ref,props:D.props,_owner:D._owner}}function O(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function C(D){var z={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(q){return z[q]})}var I=/\/+/g;function R(D,z){return typeof D=="object"&&D!==null&&D.key!=null?C(""+D.key):z.toString(36)}function F(D,z,q,G,U){var Q=typeof D;(Q==="undefined"||Q==="boolean")&&(D=null);var K=!1;if(D===null)K=!0;else switch(Q){case"string":case"number":K=!0;break;case"object":switch(D.$$typeof){case e:case t:K=!0}}if(K)return K=D,U=U(K),D=G===""?"."+R(K,0):G,j(U)?(q="",D!=null&&(q=D.replace(I,"$&/")+"/"),F(U,z,q,"",function(ie){return ie})):U!=null&&(O(U)&&(U=N(U,q+(!U.key||K&&K.key===U.key?"":(""+U.key).replace(I,"$&/")+"/")+D)),z.push(U)),1;if(K=0,G=G===""?".":G+":",j(D))for(var re=0;re<D.length;re++){Q=D[re];var H=G+R(Q,re);K+=F(Q,z,q,H,U)}else if(H=h(D),typeof H=="function")for(D=H.call(D),re=0;!(Q=D.next()).done;)Q=Q.value,H=G+R(Q,re++),K+=F(Q,z,q,H,U);else if(Q==="object")throw z=String(D),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.");return K}function M(D,z,q){if(D==null)return D;var G=[],U=0;return F(D,G,"","",function(Q){return z.call(q,Q,U++)}),G}function Y(D){if(D._status===-1){var z=D._result;z=z(),z.then(function(q){(D._status===0||D._status===-1)&&(D._status=1,D._result=q)},function(q){(D._status===0||D._status===-1)&&(D._status=2,D._result=q)}),D._status===-1&&(D._status=0,D._result=z)}if(D._status===1)return D._result.default;throw D._result}var X={current:null},$={transition:null},ee={ReactCurrentDispatcher:X,ReactCurrentBatchConfig:$,ReactCurrentOwner:T};function V(){throw Error("act(...) is not supported in production builds of React.")}return qr.Children={map:M,forEach:function(D,z,q){M(D,function(){z.apply(this,arguments)},q)},count:function(D){var z=0;return M(D,function(){z++}),z},toArray:function(D){return M(D,function(z){return z})||[]},only:function(D){if(!O(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},qr.Component=b,qr.Fragment=r,qr.Profiler=o,qr.PureComponent=w,qr.StrictMode=n,qr.Suspense=c,qr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ee,qr.act=V,qr.cloneElement=function(D,z,q){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var G=v({},D.props),U=D.key,Q=D.ref,K=D._owner;if(z!=null){if(z.ref!==void 0&&(Q=z.ref,K=T.current),z.key!==void 0&&(U=""+z.key),D.type&&D.type.defaultProps)var re=D.type.defaultProps;for(H in z)_.call(z,H)&&!A.hasOwnProperty(H)&&(G[H]=z[H]===void 0&&re!==void 0?re[H]:z[H])}var H=arguments.length-2;if(H===1)G.children=q;else if(1<H){re=Array(H);for(var ie=0;ie<H;ie++)re[ie]=arguments[ie+2];G.children=re}return{$$typeof:e,type:D.type,key:U,ref:Q,props:G,_owner:K}},qr.createContext=function(D){return D={$$typeof:s,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:a,_context:D},D.Consumer=D},qr.createElement=P,qr.createFactory=function(D){var z=P.bind(null,D);return z.type=D,z},qr.createRef=function(){return{current:null}},qr.forwardRef=function(D){return{$$typeof:l,render:D}},qr.isValidElement=O,qr.lazy=function(D){return{$$typeof:d,_payload:{_status:-1,_result:D},_init:Y}},qr.memo=function(D,z){return{$$typeof:u,type:D,compare:z===void 0?null:z}},qr.startTransition=function(D){var z=$.transition;$.transition={};try{D()}finally{$.transition=z}},qr.unstable_act=V,qr.useCallback=function(D,z){return X.current.useCallback(D,z)},qr.useContext=function(D){return X.current.useContext(D)},qr.useDebugValue=function(){},qr.useDeferredValue=function(D){return X.current.useDeferredValue(D)},qr.useEffect=function(D,z){return X.current.useEffect(D,z)},qr.useId=function(){return X.current.useId()},qr.useImperativeHandle=function(D,z,q){return X.current.useImperativeHandle(D,z,q)},qr.useInsertionEffect=function(D,z){return X.current.useInsertionEffect(D,z)},qr.useLayoutEffect=function(D,z){return X.current.useLayoutEffect(D,z)},qr.useMemo=function(D,z){return X.current.useMemo(D,z)},qr.useReducer=function(D,z,q){return X.current.useReducer(D,z,q)},qr.useRef=function(D){return X.current.useRef(D)},qr.useState=function(D){return X.current.useState(D)},qr.useSyncExternalStore=function(D,z,q){return X.current.useSyncExternalStore(D,z,q)},qr.useTransition=function(){return X.current.useTransition()},qr.version="18.3.1",qr}var yO;function Qw(){return yO||(yO=1,n5.exports=AJ()),n5.exports}/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var xO;function TJ(){if(xO)return my;xO=1;var e=Qw(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(l,c,u){var d,f={},h=null,p=null;u!==void 0&&(h=""+u),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(p=c.ref);for(d in c)n.call(c,d)&&!a.hasOwnProperty(d)&&(f[d]=c[d]);if(l&&l.defaultProps)for(d in c=l.defaultProps,c)f[d]===void 0&&(f[d]=c[d]);return{$$typeof:t,type:l,key:h,ref:p,props:f,_owner:o.current}}return my.Fragment=r,my.jsx=s,my.jsxs=s,my}var bO;function PJ(){return bO||(bO=1,r5.exports=TJ()),r5.exports}var i=PJ(),F0={},i5={exports:{}},os={},o5={exports:{}},a5={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var wO;function IJ(){return wO||(wO=1,(function(e){function t($,ee){var V=$.length;$.push(ee);e:for(;0<V;){var D=V-1>>>1,z=$[D];if(0<o(z,ee))$[D]=ee,$[V]=z,V=D;else break e}}function r($){return $.length===0?null:$[0]}function n($){if($.length===0)return null;var ee=$[0],V=$.pop();if(V!==ee){$[0]=V;e:for(var D=0,z=$.length,q=z>>>1;D<q;){var G=2*(D+1)-1,U=$[G],Q=G+1,K=$[Q];if(0>o(U,V))Q<z&&0>o(K,U)?($[D]=K,$[Q]=V,D=Q):($[D]=U,$[G]=V,D=G);else if(Q<z&&0>o(K,V))$[D]=K,$[Q]=V,D=Q;else break e}}return ee}function o($,ee){var V=$.sortIndex-ee.sortIndex;return V!==0?V:$.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,v=!1,m=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k($){for(var ee=r(u);ee!==null;){if(ee.callback===null)n(u);else if(ee.startTime<=$)n(u),ee.sortIndex=ee.expirationTime,t(c,ee);else break;ee=r(u)}}function j($){if(m=!1,k($),!v)if(r(c)!==null)v=!0,Y(_);else{var ee=r(u);ee!==null&&X(j,ee.startTime-$)}}function _($,ee){v=!1,m&&(m=!1,x(P),P=-1),p=!0;var V=h;try{for(k(ee),f=r(c);f!==null&&(!(f.expirationTime>ee)||$&&!C());){var D=f.callback;if(typeof D=="function"){f.callback=null,h=f.priorityLevel;var z=D(f.expirationTime<=ee);ee=e.unstable_now(),typeof z=="function"?f.callback=z:f===r(c)&&n(c),k(ee)}else n(c);f=r(c)}if(f!==null)var q=!0;else{var G=r(u);G!==null&&X(j,G.startTime-ee),q=!1}return q}finally{f=null,h=V,p=!1}}var T=!1,A=null,P=-1,N=5,O=-1;function C(){return!(e.unstable_now()-O<N)}function I(){if(A!==null){var $=e.unstable_now();O=$;var ee=!0;try{ee=A(!0,$)}finally{ee?R():(T=!1,A=null)}}else T=!1}var R;if(typeof w=="function")R=function(){w(I)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,M=F.port2;F.port1.onmessage=I,R=function(){M.postMessage(null)}}else R=function(){b(I,0)};function Y($){A=$,T||(T=!0,R())}function X($,ee){P=b(function(){$(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_continueExecution=function(){v||p||(v=!0,Y(_))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var ee=3;break;default:ee=h}var V=h;h=ee;try{return $()}finally{h=V}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,ee){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var V=h;h=$;try{return ee()}finally{h=V}},e.unstable_scheduleCallback=function($,ee,V){var D=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?D+V:D):V=D,$){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=V+z,$={id:d++,callback:ee,priorityLevel:$,startTime:V,expirationTime:z,sortIndex:-1},V>D?($.sortIndex=V,t(u,$),r(c)===null&&$===r(u)&&(m?(x(P),P=-1):m=!0,X(j,V-D))):($.sortIndex=z,t(c,$),v||p||(v=!0,Y(_))),$},e.unstable_shouldYield=C,e.unstable_wrapCallback=function($){var ee=h;return function(){var V=h;h=ee;try{return $.apply(this,arguments)}finally{h=V}}}})(a5)),a5}var SO;function OJ(){return SO||(SO=1,o5.exports=IJ()),o5.exports}/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var jO;function NJ(){if(jO)return os;jO=1;var e=Qw(),t=OJ();function r(g){for(var y="https://reactjs.org/docs/error-decoder.html?invariant="+g,E=1;E<arguments.length;E++)y+="&args[]="+encodeURIComponent(arguments[E]);return"Minified React error #"+g+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,o={};function a(g,y){s(g,y),s(g+"Capture",y)}function s(g,y){for(o[g]=y,g=0;g<y.length;g++)n.add(y[g])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,u=/^[: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]*$/,d={},f={};function h(g){return c.call(f,g)?!0:c.call(d,g)?!1:u.test(g)?f[g]=!0:(d[g]=!0,!1)}function p(g,y,E,B){if(E!==null&&E.type===0)return!1;switch(typeof y){case"function":case"symbol":return!0;case"boolean":return B?!1:E!==null?!E.acceptsBooleans:(g=g.toLowerCase().slice(0,5),g!=="data-"&&g!=="aria-");default:return!1}}function v(g,y,E,B){if(y===null||typeof y>"u"||p(g,y,E,B))return!0;if(B)return!1;if(E!==null)switch(E.type){case 3:return!y;case 4:return y===!1;case 5:return isNaN(y);case 6:return isNaN(y)||1>y}return!1}function m(g,y,E,B,J,ne,ge){this.acceptsBooleans=y===2||y===3||y===4,this.attributeName=B,this.attributeNamespace=J,this.mustUseProperty=E,this.propertyName=g,this.type=y,this.sanitizeURL=ne,this.removeEmptyString=ge}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(g){b[g]=new m(g,0,!1,g,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(g){var y=g[0];b[y]=new m(y,1,!1,g[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(g){b[g]=new m(g,2,!1,g.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(g){b[g]=new m(g,2,!1,g,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(g){b[g]=new m(g,3,!1,g.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(g){b[g]=new m(g,3,!0,g,null,!1,!1)}),["capture","download"].forEach(function(g){b[g]=new m(g,4,!1,g,null,!1,!1)}),["cols","rows","size","span"].forEach(function(g){b[g]=new m(g,6,!1,g,null,!1,!1)}),["rowSpan","start"].forEach(function(g){b[g]=new m(g,5,!1,g.toLowerCase(),null,!1,!1)});var x=/[\-:]([a-z])/g;function w(g){return g[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(g){var y=g.replace(x,w);b[y]=new m(y,1,!1,g,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(g){var y=g.replace(x,w);b[y]=new m(y,1,!1,g,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(g){var y=g.replace(x,w);b[y]=new m(y,1,!1,g,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(g){b[g]=new m(g,1,!1,g.toLowerCase(),null,!1,!1)}),b.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(g){b[g]=new m(g,1,!1,g.toLowerCase(),null,!0,!0)});function k(g,y,E,B){var J=b.hasOwnProperty(y)?b[y]:null;(J!==null?J.type!==0:B||!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(v(y,E,J,B)&&(E=null),B||J===null?h(y)&&(E===null?g.removeAttribute(y):g.setAttribute(y,""+E)):J.mustUseProperty?g[J.propertyName]=E===null?J.type===3?!1:"":E:(y=J.attributeName,B=J.attributeNamespace,E===null?g.removeAttribute(y):(J=J.type,E=J===3||J===4&&E===!0?"":""+E,B?g.setAttributeNS(B,y,E):g.setAttribute(y,E))))}var j=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_=Symbol.for("react.element"),T=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),C=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),X=Symbol.for("react.offscreen"),$=Symbol.iterator;function ee(g){return g===null||typeof g!="object"?null:(g=$&&g[$]||g["@@iterator"],typeof g=="function"?g:null)}var V=Object.assign,D;function z(g){if(D===void 0)try{throw Error()}catch(E){var y=E.stack.trim().match(/\n( *(at )?)/);D=y&&y[1]||""}return`
`+D+g}var q=!1;function G(g,y){if(!g||q)return"";q=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(y)if(y=function(){throw Error()},Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(pt){var B=pt}Reflect.construct(g,[],y)}else{try{y.call()}catch(pt){B=pt}g.call(y.prototype)}else{try{throw Error()}catch(pt){B=pt}g()}}catch(pt){if(pt&&B&&typeof pt.stack=="string"){for(var J=pt.stack.split(`
`),ne=B.stack.split(`
`),ge=J.length-1,Fe=ne.length-1;1<=ge&&0<=Fe&&J[ge]!==ne[Fe];)Fe--;for(;1<=ge&&0<=Fe;ge--,Fe--)if(J[ge]!==ne[Fe]){if(ge!==1||Fe!==1)do if(ge--,Fe--,0>Fe||J[ge]!==ne[Fe]){var Ke=`
`+J[ge].replace(" at new "," at ");return g.displayName&&Ke.includes("<anonymous>")&&(Ke=Ke.replace("<anonymous>",g.displayName)),Ke}while(1<=ge&&0<=Fe);break}}}finally{q=!1,Error.prepareStackTrace=E}return(g=g?g.displayName||g.name:"")?z(g):""}function U(g){switch(g.tag){case 5:return z(g.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return g=G(g.type,!1),g;case 11:return g=G(g.type.render,!1),g;case 1:return g=G(g.type,!0),g;default:return""}}function Q(g){if(g==null)return null;if(typeof g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case A:return"Fragment";case T:return"Portal";case N:return"Profiler";case P:return"StrictMode";case R:return"Suspense";case F:return"SuspenseList"}if(typeof g=="object")switch(g.$$typeof){case C:return(g.displayName||"Context")+".Consumer";case O:return(g._context.displayName||"Context")+".Provider";case I:var y=g.render;return g=g.displayName,g||(g=y.displayName||y.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case M:return y=g.displayName||null,y!==null?y:Q(g.type)||"Memo";case Y:y=g._payload,g=g._init;try{return Q(g(y))}catch{}}return null}function K(g){var y=g.type;switch(g.tag){case 24:return"Cache";case 9:return(y.displayName||"Context")+".Consumer";case 10:return(y._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return g=y.render,g=g.displayName||g.name||"",y.displayName||(g!==""?"ForwardRef("+g+")":"ForwardRef");case 7:return"Fragment";case 5:return y;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(y);case 8:return y===P?"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 y=="function")return y.displayName||y.name||null;if(typeof y=="string")return y}return null}function re(g){switch(typeof g){case"boolean":case"number":case"string":case"undefined":return g;case"object":return g;default:return""}}function H(g){var y=g.type;return(g=g.nodeName)&&g.toLowerCase()==="input"&&(y==="checkbox"||y==="radio")}function ie(g){var y=H(g)?"checked":"value",E=Object.getOwnPropertyDescriptor(g.constructor.prototype,y),B=""+g[y];if(!g.hasOwnProperty(y)&&typeof E<"u"&&typeof E.get=="function"&&typeof E.set=="function"){var J=E.get,ne=E.set;return Object.defineProperty(g,y,{configurable:!0,get:function(){return J.call(this)},set:function(ge){B=""+ge,ne.call(this,ge)}}),Object.defineProperty(g,y,{enumerable:E.enumerable}),{getValue:function(){return B},setValue:function(ge){B=""+ge},stopTracking:function(){g._valueTracker=null,delete g[y]}}}}function de(g){g._valueTracker||(g._valueTracker=ie(g))}function le(g){if(!g)return!1;var y=g._valueTracker;if(!y)return!0;var E=y.getValue(),B="";return g&&(B=H(g)?g.checked?"true":"false":g.value),g=B,g!==E?(y.setValue(g),!0):!1}function ke(g){if(g=g||(typeof document<"u"?document:void 0),typeof g>"u")return null;try{return g.activeElement||g.body}catch{return g.body}}function ve(g,y){var E=y.checked;return V({},y,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:E??g._wrapperState.initialChecked})}function se(g,y){var E=y.defaultValue==null?"":y.defaultValue,B=y.checked!=null?y.checked:y.defaultChecked;E=re(y.value!=null?y.value:E),g._wrapperState={initialChecked:B,initialValue:E,controlled:y.type==="checkbox"||y.type==="radio"?y.checked!=null:y.value!=null}}function be(g,y){y=y.checked,y!=null&&k(g,"checked",y,!1)}function De(g,y){be(g,y);var E=re(y.value),B=y.type;if(E!=null)B==="number"?(E===0&&g.value===""||g.value!=E)&&(g.value=""+E):g.value!==""+E&&(g.value=""+E);else if(B==="submit"||B==="reset"){g.removeAttribute("value");return}y.hasOwnProperty("value")?ue(g,y.type,E):y.hasOwnProperty("defaultValue")&&ue(g,y.type,re(y.defaultValue)),y.checked==null&&y.defaultChecked!=null&&(g.defaultChecked=!!y.defaultChecked)}function ae(g,y,E){if(y.hasOwnProperty("value")||y.hasOwnProperty("defaultValue")){var B=y.type;if(!(B!=="submit"&&B!=="reset"||y.value!==void 0&&y.value!==null))return;y=""+g._wrapperState.initialValue,E||y===g.value||(g.value=y),g.defaultValue=y}E=g.name,E!==""&&(g.name=""),g.defaultChecked=!!g._wrapperState.initialChecked,E!==""&&(g.name=E)}function ue(g,y,E){(y!=="number"||ke(g.ownerDocument)!==g)&&(E==null?g.defaultValue=""+g._wrapperState.initialValue:g.defaultValue!==""+E&&(g.defaultValue=""+E))}var Me=Array.isArray;function Se(g,y,E,B){if(g=g.options,y){y={};for(var J=0;J<E.length;J++)y["$"+E[J]]=!0;for(E=0;E<g.length;E++)J=y.hasOwnProperty("$"+g[E].value),g[E].selected!==J&&(g[E].selected=J),J&&B&&(g[E].defaultSelected=!0)}else{for(E=""+re(E),y=null,J=0;J<g.length;J++){if(g[J].value===E){g[J].selected=!0,B&&(g[J].defaultSelected=!0);return}y!==null||g[J].disabled||(y=g[J])}y!==null&&(y.selected=!0)}}function Pe(g,y){if(y.dangerouslySetInnerHTML!=null)throw Error(r(91));return V({},y,{value:void 0,defaultValue:void 0,children:""+g._wrapperState.initialValue})}function Ee(g,y){var E=y.value;if(E==null){if(E=y.children,y=y.defaultValue,E!=null){if(y!=null)throw Error(r(92));if(Me(E)){if(1<E.length)throw Error(r(93));E=E[0]}y=E}y==null&&(y=""),E=y}g._wrapperState={initialValue:re(E)}}function Ae(g,y){var E=re(y.value),B=re(y.defaultValue);E!=null&&(E=""+E,E!==g.value&&(g.value=E),y.defaultValue==null&&g.defaultValue!==E&&(g.defaultValue=E)),B!=null&&(g.defaultValue=""+B)}function Ye(g){var y=g.textContent;y===g._wrapperState.initialValue&&y!==""&&y!==null&&(g.value=y)}function rt(g){switch(g){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function He(g,y){return g==null||g==="http://www.w3.org/1999/xhtml"?rt(y):g==="http://www.w3.org/2000/svg"&&y==="foreignObject"?"http://www.w3.org/1999/xhtml":g}var xt,st=(function(g){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(y,E,B,J){MSApp.execUnsafeLocalFunction(function(){return g(y,E,B,J)})}:g})(function(g,y){if(g.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in g)g.innerHTML=y;else{for(xt=xt||document.createElement("div"),xt.innerHTML="<svg>"+y.valueOf().toString()+"</svg>",y=xt.firstChild;g.firstChild;)g.removeChild(g.firstChild);for(;y.firstChild;)g.appendChild(y.firstChild)}});function Te(g,y){if(y){var E=g.firstChild;if(E&&E===g.lastChild&&E.nodeType===3){E.nodeValue=y;return}}g.textContent=y}var et={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},Pt=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(g){Pt.forEach(function(y){y=y+g.charAt(0).toUpperCase()+g.substring(1),et[y]=et[g]})});function qe(g,y,E){return y==null||typeof y=="boolean"||y===""?"":E||typeof y!="number"||y===0||et.hasOwnProperty(g)&&et[g]?(""+y).trim():y+"px"}function Et(g,y){g=g.style;for(var E in y)if(y.hasOwnProperty(E)){var B=E.indexOf("--")===0,J=qe(E,y[E],B);E==="float"&&(E="cssFloat"),B?g.setProperty(E,J):g[E]=J}}var vt=V({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 Ft(g,y){if(y){if(vt[g]&&(y.children!=null||y.dangerouslySetInnerHTML!=null))throw Error(r(137,g));if(y.dangerouslySetInnerHTML!=null){if(y.children!=null)throw Error(r(60));if(typeof y.dangerouslySetInnerHTML!="object"||!("__html"in y.dangerouslySetInnerHTML))throw Error(r(61))}if(y.style!=null&&typeof y.style!="object")throw Error(r(62))}}function Ce(g,y){if(g.indexOf("-")===-1)return typeof y.is=="string";switch(g){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 lt=null;function Xe(g){return g=g.target||g.srcElement||window,g.correspondingUseElement&&(g=g.correspondingUseElement),g.nodeType===3?g.parentNode:g}var Be=null,ct=null,Tt=null;function We(g){if(g=Jd(g)){if(typeof Be!="function")throw Error(r(280));var y=g.stateNode;y&&(y=wp(y),Be(g.stateNode,g.type,y))}}function ce(g){ct?Tt?Tt.push(g):Tt=[g]:ct=g}function he(){if(ct){var g=ct,y=Tt;if(Tt=ct=null,We(g),y)for(g=0;g<y.length;g++)We(y[g])}}function je(g,y){return g(y)}function xe(){}var Re=!1;function ze(g,y,E){if(Re)return g(y,E);Re=!0;try{return je(g,y,E)}finally{Re=!1,(ct!==null||Tt!==null)&&(xe(),he())}}function Le(g,y){var E=g.stateNode;if(E===null)return null;var B=wp(E);if(B===null)return null;E=B[y];e:switch(y){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(B=!B.disabled)||(g=g.type,B=!(g==="button"||g==="input"||g==="select"||g==="textarea")),g=!B;break e;default:g=!1}if(g)return null;if(E&&typeof E!="function")throw Error(r(231,y,typeof E));return E}var Qe=!1;if(l)try{var mt={};Object.defineProperty(mt,"passive",{get:function(){Qe=!0}}),window.addEventListener("test",mt,mt),window.removeEventListener("test",mt,mt)}catch{Qe=!1}function ft(g,y,E,B,J,ne,ge,Fe,Ke){var pt=Array.prototype.slice.call(arguments,3);try{y.apply(E,pt)}catch(Lt){this.onError(Lt)}}var It=!1,Bt=null,dr=!1,pr=null,an={onError:function(g){It=!0,Bt=g}};function Jn(g,y,E,B,J,ne,ge,Fe,Ke){It=!1,Bt=null,ft.apply(an,arguments)}function Fi(g,y,E,B,J,ne,ge,Fe,Ke){if(Jn.apply(this,arguments),It){if(It){var pt=Bt;It=!1,Bt=null}else throw Error(r(198));dr||(dr=!0,pr=pt)}}function Fn(g){var y=g,E=g;if(g.alternate)for(;y.return;)y=y.return;else{g=y;do y=g,(y.flags&4098)!==0&&(E=y.return),g=y.return;while(g)}return y.tag===3?E:null}function Bo(g){if(g.tag===13){var y=g.memoizedState;if(y===null&&(g=g.alternate,g!==null&&(y=g.memoizedState)),y!==null)return y.dehydrated}return null}function io(g){if(Fn(g)!==g)throw Error(r(188))}function Wo(g){var y=g.alternate;if(!y){if(y=Fn(g),y===null)throw Error(r(188));return y!==g?null:g}for(var E=g,B=y;;){var J=E.return;if(J===null)break;var ne=J.alternate;if(ne===null){if(B=J.return,B!==null){E=B;continue}break}if(J.child===ne.child){for(ne=J.child;ne;){if(ne===E)return io(J),g;if(ne===B)return io(J),y;ne=ne.sibling}throw Error(r(188))}if(E.return!==B.return)E=J,B=ne;else{for(var ge=!1,Fe=J.child;Fe;){if(Fe===E){ge=!0,E=J,B=ne;break}if(Fe===B){ge=!0,B=J,E=ne;break}Fe=Fe.sibling}if(!ge){for(Fe=ne.child;Fe;){if(Fe===E){ge=!0,E=ne,B=J;break}if(Fe===B){ge=!0,B=ne,E=J;break}Fe=Fe.sibling}if(!ge)throw Error(r(189))}}if(E.alternate!==B)throw Error(r(190))}if(E.tag!==3)throw Error(r(188));return E.stateNode.current===E?g:y}function Yi(g){return g=Wo(g),g!==null?qo(g):null}function qo(g){if(g.tag===5||g.tag===6)return g;for(g=g.child;g!==null;){var y=qo(g);if(y!==null)return y;g=g.sibling}return null}var Ca=t.unstable_scheduleCallback,xs=t.unstable_cancelCallback,el=t.unstable_shouldYield,op=t.unstable_requestPaint,jn=t.unstable_now,Ld=t.unstable_getCurrentPriorityLevel,tl=t.unstable_ImmediatePriority,Mt=t.unstable_UserBlockingPriority,xr=t.unstable_NormalPriority,$n=t.unstable_LowPriority,yo=t.unstable_IdlePriority,Wt=null,zn=null;function gu(g){if(zn&&typeof zn.onCommitFiberRoot=="function")try{zn.onCommitFiberRoot(Wt,g,void 0,(g.current.flags&128)===128)}catch{}}var Gr=Math.clz32?Math.clz32:ji,rl=Math.log,Bv=Math.LN2;function ji(g){return g>>>=0,g===0?32:31-(rl(g)/Bv|0)|0}var mu=64,Ea=4194304;function nl(g){switch(g&-g){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 g&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return g&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return g}}function _c(g,y){var E=g.pendingLanes;if(E===0)return 0;var B=0,J=g.suspendedLanes,ne=g.pingedLanes,ge=E&268435455;if(ge!==0){var Fe=ge&~J;Fe!==0?B=nl(Fe):(ne&=ge,ne!==0&&(B=nl(ne)))}else ge=E&~J,ge!==0?B=nl(ge):ne!==0&&(B=nl(ne));if(B===0)return 0;if(y!==0&&y!==B&&(y&J)===0&&(J=B&-B,ne=y&-y,J>=ne||J===16&&(ne&4194240)!==0))return y;if((B&4)!==0&&(B|=E&16),y=g.entangledLanes,y!==0)for(g=g.entanglements,y&=B;0<y;)E=31-Gr(y),J=1<<E,B|=g[E],y&=~J;return B}function Aa(g,y){switch(g){case 1:case 2:case 4:return y+250;case 8:case 16:case 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 y+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Fd(g,y){for(var E=g.suspendedLanes,B=g.pingedLanes,J=g.expirationTimes,ne=g.pendingLanes;0<ne;){var ge=31-Gr(ne),Fe=1<<ge,Ke=J[ge];Ke===-1?((Fe&E)===0||(Fe&B)!==0)&&(J[ge]=Aa(Fe,y)):Ke<=y&&(g.expiredLanes|=Fe),ne&=~Fe}}function bs(g){return g=g.pendingLanes&-1073741825,g!==0?g:g&1073741824?1073741824:0}function Gi(){var g=mu;return mu<<=1,(mu&4194240)===0&&(mu=64),g}function zd(g){for(var y=[],E=0;31>E;E++)y.push(g);return y}function vu(g,y,E){g.pendingLanes|=y,y!==536870912&&(g.suspendedLanes=0,g.pingedLanes=0),g=g.eventTimes,y=31-Gr(y),g[y]=E}function Wv(g,y){var E=g.pendingLanes&~y;g.pendingLanes=y,g.suspendedLanes=0,g.pingedLanes=0,g.expiredLanes&=y,g.mutableReadLanes&=y,g.entangledLanes&=y,y=g.entanglements;var B=g.eventTimes;for(g=g.expirationTimes;0<E;){var J=31-Gr(E),ne=1<<J;y[J]=0,B[J]=-1,g[J]=-1,E&=~ne}}function ap(g,y){var E=g.entangledLanes|=y;for(g=g.entanglements;E;){var B=31-Gr(E),J=1<<B;J&y|g[B]&y&&(g[B]|=y),E&=~J}}var zr=0;function sp(g){return g&=-g,1<g?4<g?(g&268435455)!==0?16:536870912:4:1}var yu,Cc,Md,ig,og,lp=!1,ws=[],Ss=null,$o=null,il=null,js=new Map,hr=new Map,ol=[],qv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ag(g,y){switch(g){case"focusin":case"focusout":Ss=null;break;case"dragenter":case"dragleave":$o=null;break;case"mouseover":case"mouseout":il=null;break;case"pointerover":case"pointerout":js.delete(y.pointerId);break;case"gotpointercapture":case"lostpointercapture":hr.delete(y.pointerId)}}function xu(g,y,E,B,J,ne){return g===null||g.nativeEvent!==ne?(g={blockedOn:y,domEventName:E,eventSystemFlags:B,nativeEvent:ne,targetContainers:[J]},y!==null&&(y=Jd(y),y!==null&&Cc(y)),g):(g.eventSystemFlags|=B,y=g.targetContainers,J!==null&&y.indexOf(J)===-1&&y.push(J),g)}function $v(g,y,E,B,J){switch(y){case"focusin":return Ss=xu(Ss,g,y,E,B,J),!0;case"dragenter":return $o=xu($o,g,y,E,B,J),!0;case"mouseover":return il=xu(il,g,y,E,B,J),!0;case"pointerover":var ne=J.pointerId;return js.set(ne,xu(js.get(ne)||null,g,y,E,B,J)),!0;case"gotpointercapture":return ne=J.pointerId,hr.set(ne,xu(hr.get(ne)||null,g,y,E,B,J)),!0}return!1}function al(g){var y=Fc(g.target);if(y!==null){var E=Fn(y);if(E!==null){if(y=E.tag,y===13){if(y=Bo(E),y!==null){g.blockedOn=y,og(g.priority,function(){Md(E)});return}}else if(y===3&&E.stateNode.current.memoizedState.isDehydrated){g.blockedOn=E.tag===3?E.stateNode.containerInfo:null;return}}}g.blockedOn=null}function Va(g){if(g.blockedOn!==null)return!1;for(var y=g.targetContainers;0<y.length;){var E=wu(g.domEventName,g.eventSystemFlags,y[0],g.nativeEvent);if(E===null){E=g.nativeEvent;var B=new E.constructor(E.type,E);lt=B,E.target.dispatchEvent(B),lt=null}else return y=Jd(E),y!==null&&Cc(y),g.blockedOn=E,!1;y.shift()}return!0}function sg(g,y,E){Va(g)&&E.delete(y)}function Uv(){lp=!1,Ss!==null&&Va(Ss)&&(Ss=null),$o!==null&&Va($o)&&($o=null),il!==null&&Va(il)&&(il=null),js.forEach(sg),hr.forEach(sg)}function sl(g,y){g.blockedOn===y&&(g.blockedOn=null,lp||(lp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Uv)))}function Dl(g){function y(J){return sl(J,g)}if(0<ws.length){sl(ws[0],g);for(var E=1;E<ws.length;E++){var B=ws[E];B.blockedOn===g&&(B.blockedOn=null)}}for(Ss!==null&&sl(Ss,g),$o!==null&&sl($o,g),il!==null&&sl(il,g),js.forEach(y),hr.forEach(y),E=0;E<ol.length;E++)B=ol[E],B.blockedOn===g&&(B.blockedOn=null);for(;0<ol.length&&(E=ol[0],E.blockedOn===null);)al(E),E.blockedOn===null&&ol.shift()}var Uo=j.ReactCurrentBatchConfig,Dd=!0;function Bd(g,y,E,B){var J=zr,ne=Uo.transition;Uo.transition=null;try{zr=1,bu(g,y,E,B)}finally{zr=J,Uo.transition=ne}}function Hv(g,y,E,B){var J=zr,ne=Uo.transition;Uo.transition=null;try{zr=4,bu(g,y,E,B)}finally{zr=J,Uo.transition=ne}}function bu(g,y,E,B){if(Dd){var J=wu(g,y,E,B);if(J===null)yp(g,y,B,ks,E),ag(g,B);else if($v(J,g,y,E,B))B.stopPropagation();else if(ag(g,B),y&4&&-1<qv.indexOf(g)){for(;J!==null;){var ne=Jd(J);if(ne!==null&&yu(ne),ne=wu(g,y,E,B),ne===null&&yp(g,y,B,ks,E),ne===J)break;J=ne}J!==null&&B.stopPropagation()}else yp(g,y,B,null,E)}}var ks=null;function wu(g,y,E,B){if(ks=null,g=Xe(B),g=Fc(g),g!==null)if(y=Fn(g),y===null)g=null;else if(E=y.tag,E===13){if(g=Bo(y),g!==null)return g;g=null}else if(E===3){if(y.stateNode.current.memoizedState.isDehydrated)return y.tag===3?y.stateNode.containerInfo:null;g=null}else y!==g&&(g=null);return ks=g,null}function Ec(g){switch(g){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ld()){case tl:return 1;case Mt:return 4;case xr:case $n:return 16;case yo:return 536870912;default:return 16}default:return 16}}var Ya=null,Ac=null,Tc=null;function Su(){if(Tc)return Tc;var g,y=Ac,E=y.length,B,J="value"in Ya?Ya.value:Ya.textContent,ne=J.length;for(g=0;g<E&&y[g]===J[g];g++);var ge=E-g;for(B=1;B<=ge&&y[E-B]===J[ne-B];B++);return Tc=J.slice(g,1<B?1-B:void 0)}function ju(g){var y=g.keyCode;return"charCode"in g?(g=g.charCode,g===0&&y===13&&(g=13)):g=y,g===10&&(g=13),32<=g||g===13?g:0}function Ga(){return!0}function ll(){return!1}function xo(g){function y(E,B,J,ne,ge){this._reactName=E,this._targetInst=J,this.type=B,this.nativeEvent=ne,this.target=ge,this.currentTarget=null;for(var Fe in g)g.hasOwnProperty(Fe)&&(E=g[Fe],this[Fe]=E?E(ne):ne[Fe]);return this.isDefaultPrevented=(ne.defaultPrevented!=null?ne.defaultPrevented:ne.returnValue===!1)?Ga:ll,this.isPropagationStopped=ll,this}return V(y.prototype,{preventDefault:function(){this.defaultPrevented=!0;var E=this.nativeEvent;E&&(E.preventDefault?E.preventDefault():typeof E.returnValue!="unknown"&&(E.returnValue=!1),this.isDefaultPrevented=Ga)},stopPropagation:function(){var E=this.nativeEvent;E&&(E.stopPropagation?E.stopPropagation():typeof E.cancelBubble!="unknown"&&(E.cancelBubble=!0),this.isPropagationStopped=Ga)},persist:function(){},isPersistent:Ga}),y}var Bl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(g){return g.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wd=xo(Bl),_s=V({},Bl,{view:0,detail:0}),lg=xo(_s),Z,fe,Ie,Ue=V({},_s,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cs,button:0,buttons:0,relatedTarget:function(g){return g.relatedTarget===void 0?g.fromElement===g.srcElement?g.toElement:g.fromElement:g.relatedTarget},movementX:function(g){return"movementX"in g?g.movementX:(g!==Ie&&(Ie&&g.type==="mousemove"?(Z=g.screenX-Ie.screenX,fe=g.screenY-Ie.screenY):fe=Z=0,Ie=g),Z)},movementY:function(g){return"movementY"in g?g.movementY:fe}}),tt=xo(Ue),wt=V({},Ue,{dataTransfer:0}),Ot=xo(wt),tr=V({},_s,{relatedTarget:0}),Xt=xo(tr),_r=V({},Bl,{animationName:0,elapsedTime:0,pseudoElement:0}),Pr=xo(_r),Kr=V({},Bl,{clipboardData:function(g){return"clipboardData"in g?g.clipboardData:window.clipboardData}}),ki=xo(Kr),kn=V({},Bl,{data:0}),fn=xo(kn),Mn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ei={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ti={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bo(g){var y=this.nativeEvent;return y.getModifierState?y.getModifierState(g):(g=ti[g])?!!y[g]:!1}function Cs(){return bo}var cp=V({},_s,{key:function(g){if(g.key){var y=Mn[g.key]||g.key;if(y!=="Unidentified")return y}return g.type==="keypress"?(g=ju(g),g===13?"Enter":String.fromCharCode(g)):g.type==="keydown"||g.type==="keyup"?ei[g.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cs,charCode:function(g){return g.type==="keypress"?ju(g):0},keyCode:function(g){return g.type==="keydown"||g.type==="keyup"?g.keyCode:0},which:function(g){return g.type==="keypress"?ju(g):g.type==="keydown"||g.type==="keyup"?g.keyCode:0}}),ku=xo(cp),_u=V({},Ue,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wl=xo(_u),Cu=V({},_s,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cs}),qd=xo(Cu),$d=V({},Bl,{propertyName:0,elapsedTime:0,pseudoElement:0}),wo=xo($d),Eu=V({},Ue,{deltaX:function(g){return"deltaX"in g?g.deltaX:"wheelDeltaX"in g?-g.wheelDeltaX:0},deltaY:function(g){return"deltaY"in g?g.deltaY:"wheelDeltaY"in g?-g.wheelDeltaY:"wheelDelta"in g?-g.wheelDelta:0},deltaZ:0,deltaMode:0}),Au=xo(Eu),up=[9,13,27,32],Ka=l&&"CompositionEvent"in window,zi=null;l&&"documentMode"in document&&(zi=document.documentMode);var cg=l&&"TextEvent"in window&&!zi,Tu=l&&(!Ka||zi&&8<zi&&11>=zi),dp=" ",Ta=!1;function Pc(g,y){switch(g){case"keyup":return up.indexOf(y.keyCode)!==-1;case"keydown":return y.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ud(g){return g=g.detail,typeof g=="object"&&"data"in g?g.data:null}var Es=!1;function Pu(g,y){switch(g){case"compositionend":return Ud(y);case"keypress":return y.which!==32?null:(Ta=!0,dp);case"textInput":return g=y.data,g===dp&&Ta?null:g;default:return null}}function fp(g,y){if(Es)return g==="compositionend"||!Ka&&Pc(g,y)?(g=Su(),Tc=Ac=Ya=null,Es=!1,g):null;switch(g){case"paste":return null;case"keypress":if(!(y.ctrlKey||y.altKey||y.metaKey)||y.ctrlKey&&y.altKey){if(y.char&&1<y.char.length)return y.char;if(y.which)return String.fromCharCode(y.which)}return null;case"compositionend":return Tu&&y.locale!=="ko"?null:y.data;default:return null}}var Ho={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Vo(g){var y=g&&g.nodeName&&g.nodeName.toLowerCase();return y==="input"?!!Ho[g.type]:y==="textarea"}function Iu(g,y,E,B){ce(B),y=hg(y,"onChange"),0<y.length&&(E=new Wd("onChange","change",null,E,B),g.push({event:E,listeners:y}))}var Qa=null,Xa=null;function Hd(g){mp(g,0)}function cl(g){var y=Du(g);if(le(y))return g}function _i(g,y){if(g==="change")return y}var ug=!1;if(l){var Za;if(l){var Pa="oninput"in document;if(!Pa){var Ic=document.createElement("div");Ic.setAttribute("oninput","return;"),Pa=typeof Ic.oninput=="function"}Za=Pa}else Za=!1;ug=Za&&(!document.documentMode||9<document.documentMode)}function Vd(){Qa&&(Qa.detachEvent("onpropertychange",Yd),Xa=Qa=null)}function Yd(g){if(g.propertyName==="value"&&cl(Xa)){var y=[];Iu(y,Xa,g,Xe(g)),ze(Hd,y)}}function Gd(g,y,E){g==="focusin"?(Vd(),Qa=y,Xa=E,Qa.attachEvent("onpropertychange",Yd)):g==="focusout"&&Vd()}function Ou(g){if(g==="selectionchange"||g==="keyup"||g==="keydown")return cl(Xa)}function Nu(g,y){if(g==="click")return cl(y)}function Oc(g,y){if(g==="input"||g==="change")return cl(y)}function ql(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var Ki=typeof Object.is=="function"?Object.is:ql;function ul(g,y){if(Ki(g,y))return!0;if(typeof g!="object"||g===null||typeof y!="object"||y===null)return!1;var E=Object.keys(g),B=Object.keys(y);if(E.length!==B.length)return!1;for(B=0;B<E.length;B++){var J=E[B];if(!c.call(y,J)||!Ki(g[J],y[J]))return!1}return!0}function oo(g){for(;g&&g.firstChild;)g=g.firstChild;return g}function As(g,y){var E=oo(g);g=0;for(var B;E;){if(E.nodeType===3){if(B=g+E.textContent.length,g<=y&&B>=y)return{node:E,offset:y-g};g=B}e:{for(;E;){if(E.nextSibling){E=E.nextSibling;break e}E=E.parentNode}E=void 0}E=oo(E)}}function _n(g,y){return g&&y?g===y?!0:g&&g.nodeType===3?!1:y&&y.nodeType===3?_n(g,y.parentNode):"contains"in g?g.contains(y):g.compareDocumentPosition?!!(g.compareDocumentPosition(y)&16):!1:!1}function Cn(){for(var g=window,y=ke();y instanceof g.HTMLIFrameElement;){try{var E=typeof y.contentWindow.location.href=="string"}catch{E=!1}if(E)g=y.contentWindow;else break;y=ke(g.document)}return y}function ri(g){var y=g&&g.nodeName&&g.nodeName.toLowerCase();return y&&(y==="input"&&(g.type==="text"||g.type==="search"||g.type==="tel"||g.type==="url"||g.type==="password")||y==="textarea"||g.contentEditable==="true")}function Mi(g){var y=Cn(),E=g.focusedElem,B=g.selectionRange;if(y!==E&&E&&E.ownerDocument&&_n(E.ownerDocument.documentElement,E)){if(B!==null&&ri(E)){if(y=B.start,g=B.end,g===void 0&&(g=y),"selectionStart"in E)E.selectionStart=y,E.selectionEnd=Math.min(g,E.value.length);else if(g=(y=E.ownerDocument||document)&&y.defaultView||window,g.getSelection){g=g.getSelection();var J=E.textContent.length,ne=Math.min(B.start,J);B=B.end===void 0?ne:Math.min(B.end,J),!g.extend&&ne>B&&(J=B,B=ne,ne=J),J=As(E,ne);var ge=As(E,B);J&&ge&&(g.rangeCount!==1||g.anchorNode!==J.node||g.anchorOffset!==J.offset||g.focusNode!==ge.node||g.focusOffset!==ge.offset)&&(y=y.createRange(),y.setStart(J.node,J.offset),g.removeAllRanges(),ne>B?(g.addRange(y),g.extend(ge.node,ge.offset)):(y.setEnd(ge.node,ge.offset),g.addRange(y)))}}for(y=[],g=E;g=g.parentNode;)g.nodeType===1&&y.push({element:g,left:g.scrollLeft,top:g.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<y.length;E++)g=y[E],g.element.scrollLeft=g.left,g.element.scrollTop=g.top}}var $l=l&&"documentMode"in document&&11>=document.documentMode,dl=null,Nc=null,Rc=null,dg=!1;function Vv(g,y,E){var B=E.window===E?E.document:E.nodeType===9?E:E.ownerDocument;dg||dl==null||dl!==ke(B)||(B=dl,"selectionStart"in B&&ri(B)?B={start:B.selectionStart,end:B.selectionEnd}:(B=(B.ownerDocument&&B.ownerDocument.defaultView||window).getSelection(),B={anchorNode:B.anchorNode,anchorOffset:B.anchorOffset,focusNode:B.focusNode,focusOffset:B.focusOffset}),Rc&&ul(Rc,B)||(Rc=B,B=hg(Nc,"onSelect"),0<B.length&&(y=new Wd("onSelect","select",null,y,E),g.push({event:y,listeners:B}),y.target=dl)))}function pp(g,y){var E={};return E[g.toLowerCase()]=y.toLowerCase(),E["Webkit"+g]="webkit"+y,E["Moz"+g]="moz"+y,E}var Ru={animationend:pp("Animation","AnimationEnd"),animationiteration:pp("Animation","AnimationIteration"),animationstart:pp("Animation","AnimationStart"),transitionend:pp("Transition","TransitionEnd")},Lu={},Yv={};l&&(Yv=document.createElement("div").style,"AnimationEvent"in window||(delete Ru.animationend.animation,delete Ru.animationiteration.animation,delete Ru.animationstart.animation),"TransitionEvent"in window||delete Ru.transitionend.transition);function hp(g){if(Lu[g])return Lu[g];if(!Ru[g])return g;var y=Ru[g],E;for(E in y)if(y.hasOwnProperty(E)&&E in Yv)return Lu[g]=y[E];return g}var Gv=hp("animationend"),Kv=hp("animationiteration"),Qv=hp("animationstart"),Xv=hp("transitionend"),Zv=new Map,Jv="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function fl(g,y){Zv.set(g,y),a(y,[g])}for(var Kd=0;Kd<Jv.length;Kd++){var Yo=Jv[Kd],Ja=Yo.toLowerCase(),fg=Yo[0].toUpperCase()+Yo.slice(1);fl(Ja,"on"+fg)}fl(Gv,"onAnimationEnd"),fl(Kv,"onAnimationIteration"),fl(Qv,"onAnimationStart"),fl("dblclick","onDoubleClick"),fl("focusin","onFocus"),fl("focusout","onBlur"),fl(Xv,"onTransitionEnd"),s("onMouseEnter",["mouseout","mouseover"]),s("onMouseLeave",["mouseout","mouseover"]),s("onPointerEnter",["pointerout","pointerover"]),s("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),t0=new Set("cancel close invalid load scroll toggle".split(" ").concat(Lc));function gp(g,y,E){var B=g.type||"unknown-event";g.currentTarget=E,Fi(B,y,void 0,g),g.currentTarget=null}function mp(g,y){y=(y&4)!==0;for(var E=0;E<g.length;E++){var B=g[E],J=B.event;B=B.listeners;e:{var ne=void 0;if(y)for(var ge=B.length-1;0<=ge;ge--){var Fe=B[ge],Ke=Fe.instance,pt=Fe.currentTarget;if(Fe=Fe.listener,Ke!==ne&&J.isPropagationStopped())break e;gp(J,Fe,pt),ne=Ke}else for(ge=0;ge<B.length;ge++){if(Fe=B[ge],Ke=Fe.instance,pt=Fe.currentTarget,Fe=Fe.listener,Ke!==ne&&J.isPropagationStopped())break e;gp(J,Fe,pt),ne=Ke}}}if(dr)throw g=pr,dr=!1,pr=null,g}function En(g,y){var E=y[ia];E===void 0&&(E=y[ia]=new Set);var B=g+"__bubble";E.has(B)||(vp(y,g,2,!1),E.add(B))}function pg(g,y,E){var B=0;y&&(B|=4),vp(E,g,B,y)}var Qd="_reactListening"+Math.random().toString(36).slice(2);function Fu(g){if(!g[Qd]){g[Qd]=!0,n.forEach(function(E){E!=="selectionchange"&&(t0.has(E)||pg(E,!1,g),pg(E,!0,g))});var y=g.nodeType===9?g:g.ownerDocument;y===null||y[Qd]||(y[Qd]=!0,pg("selectionchange",!1,y))}}function vp(g,y,E,B){switch(Ec(y)){case 1:var J=Bd;break;case 4:J=Hv;break;default:J=bu}E=J.bind(null,y,E,g),J=void 0,!Qe||y!=="touchstart"&&y!=="touchmove"&&y!=="wheel"||(J=!0),B?J!==void 0?g.addEventListener(y,E,{capture:!0,passive:J}):g.addEventListener(y,E,!0):J!==void 0?g.addEventListener(y,E,{passive:J}):g.addEventListener(y,E,!1)}function yp(g,y,E,B,J){var ne=B;if((y&1)===0&&(y&2)===0&&B!==null)e:for(;;){if(B===null)return;var ge=B.tag;if(ge===3||ge===4){var Fe=B.stateNode.containerInfo;if(Fe===J||Fe.nodeType===8&&Fe.parentNode===J)break;if(ge===4)for(ge=B.return;ge!==null;){var Ke=ge.tag;if((Ke===3||Ke===4)&&(Ke=ge.stateNode.containerInfo,Ke===J||Ke.nodeType===8&&Ke.parentNode===J))return;ge=ge.return}for(;Fe!==null;){if(ge=Fc(Fe),ge===null)return;if(Ke=ge.tag,Ke===5||Ke===6){B=ne=ge;continue e}Fe=Fe.parentNode}}B=B.return}ze(function(){var pt=ne,Lt=Xe(E),zt=[];e:{var Rt=Zv.get(g);if(Rt!==void 0){var Yt=Wd,rr=g;switch(g){case"keypress":if(ju(E)===0)break e;case"keydown":case"keyup":Yt=ku;break;case"focusin":rr="focus",Yt=Xt;break;case"focusout":rr="blur",Yt=Xt;break;case"beforeblur":case"afterblur":Yt=Xt;break;case"click":if(E.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Yt=tt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Yt=Ot;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Yt=qd;break;case Gv:case Kv:case Qv:Yt=Pr;break;case Xv:Yt=wo;break;case"scroll":Yt=lg;break;case"wheel":Yt=Au;break;case"copy":case"cut":case"paste":Yt=ki;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Yt=Wl}var ar=(y&4)!==0,Wi=!ar&&g==="scroll",ot=ar?Rt!==null?Rt+"Capture":null:Rt;ar=[];for(var Je=pt,ut;Je!==null;){ut=Je;var Dt=ut.stateNode;if(ut.tag===5&&Dt!==null&&(ut=Dt,ot!==null&&(Dt=Le(Je,ot),Dt!=null&&ar.push(xp(Je,Dt,ut)))),Wi)break;Je=Je.return}0<ar.length&&(Rt=new Yt(Rt,rr,null,E,Lt),zt.push({event:Rt,listeners:ar}))}}if((y&7)===0){e:{if(Rt=g==="mouseover"||g==="pointerover",Yt=g==="mouseout"||g==="pointerout",Rt&&E!==lt&&(rr=E.relatedTarget||E.fromElement)&&(Fc(rr)||rr[So]))break e;if((Yt||Rt)&&(Rt=Lt.window===Lt?Lt:(Rt=Lt.ownerDocument)?Rt.defaultView||Rt.parentWindow:window,Yt?(rr=E.relatedTarget||E.toElement,Yt=pt,rr=rr?Fc(rr):null,rr!==null&&(Wi=Fn(rr),rr!==Wi||rr.tag!==5&&rr.tag!==6)&&(rr=null)):(Yt=null,rr=pt),Yt!==rr)){if(ar=tt,Dt="onMouseLeave",ot="onMouseEnter",Je="mouse",(g==="pointerout"||g==="pointerover")&&(ar=Wl,Dt="onPointerLeave",ot="onPointerEnter",Je="pointer"),Wi=Yt==null?Rt:Du(Yt),ut=rr==null?Rt:Du(rr),Rt=new ar(Dt,Je+"leave",Yt,E,Lt),Rt.target=Wi,Rt.relatedTarget=ut,Dt=null,Fc(Lt)===pt&&(ar=new ar(ot,Je+"enter",rr,E,Lt),ar.target=ut,ar.relatedTarget=Wi,Dt=ar),Wi=Dt,Yt&&rr)t:{for(ar=Yt,ot=rr,Je=0,ut=ar;ut;ut=zu(ut))Je++;for(ut=0,Dt=ot;Dt;Dt=zu(Dt))ut++;for(;0<Je-ut;)ar=zu(ar),Je--;for(;0<ut-Je;)ot=zu(ot),ut--;for(;Je--;){if(ar===ot||ot!==null&&ar===ot.alternate)break t;ar=zu(ar),ot=zu(ot)}ar=null}else ar=null;Yt!==null&&r0(zt,Rt,Yt,ar,!1),rr!==null&&Wi!==null&&r0(zt,Wi,rr,ar,!0)}}e:{if(Rt=pt?Du(pt):window,Yt=Rt.nodeName&&Rt.nodeName.toLowerCase(),Yt==="select"||Yt==="input"&&Rt.type==="file")var cr=_i;else if(Vo(Rt))if(ug)cr=Oc;else{cr=Ou;var mr=Gd}else(Yt=Rt.nodeName)&&Yt.toLowerCase()==="input"&&(Rt.type==="checkbox"||Rt.type==="radio")&&(cr=Nu);if(cr&&(cr=cr(g,pt))){Iu(zt,cr,E,Lt);break e}mr&&mr(g,Rt,pt),g==="focusout"&&(mr=Rt._wrapperState)&&mr.controlled&&Rt.type==="number"&&ue(Rt,"number",Rt.value)}switch(mr=pt?Du(pt):window,g){case"focusin":(Vo(mr)||mr.contentEditable==="true")&&(dl=mr,Nc=pt,Rc=null);break;case"focusout":Rc=Nc=dl=null;break;case"mousedown":dg=!0;break;case"contextmenu":case"mouseup":case"dragend":dg=!1,Vv(zt,E,Lt);break;case"selectionchange":if($l)break;case"keydown":case"keyup":Vv(zt,E,Lt)}var vr;if(Ka)e:{switch(g){case"compositionstart":var Cr="onCompositionStart";break e;case"compositionend":Cr="onCompositionEnd";break e;case"compositionupdate":Cr="onCompositionUpdate";break e}Cr=void 0}else Es?Pc(g,E)&&(Cr="onCompositionEnd"):g==="keydown"&&E.keyCode===229&&(Cr="onCompositionStart");Cr&&(Tu&&E.locale!=="ko"&&(Es||Cr!=="onCompositionStart"?Cr==="onCompositionEnd"&&Es&&(vr=Su()):(Ya=Lt,Ac="value"in Ya?Ya.value:Ya.textContent,Es=!0)),mr=hg(pt,Cr),0<mr.length&&(Cr=new fn(Cr,g,null,E,Lt),zt.push({event:Cr,listeners:mr}),vr?Cr.data=vr:(vr=Ud(E),vr!==null&&(Cr.data=vr)))),(vr=cg?Pu(g,E):fp(g,E))&&(pt=hg(pt,"onBeforeInput"),0<pt.length&&(Lt=new fn("onBeforeInput","beforeinput",null,E,Lt),zt.push({event:Lt,listeners:pt}),Lt.data=vr))}mp(zt,y)})}function xp(g,y,E){return{instance:g,listener:y,currentTarget:E}}function hg(g,y){for(var E=y+"Capture",B=[];g!==null;){var J=g,ne=J.stateNode;J.tag===5&&ne!==null&&(J=ne,ne=Le(g,E),ne!=null&&B.unshift(xp(g,ne,J)),ne=Le(g,y),ne!=null&&B.push(xp(g,ne,J))),g=g.return}return B}function zu(g){if(g===null)return null;do g=g.return;while(g&&g.tag!==5);return g||null}function r0(g,y,E,B,J){for(var ne=y._reactName,ge=[];E!==null&&E!==B;){var Fe=E,Ke=Fe.alternate,pt=Fe.stateNode;if(Ke!==null&&Ke===B)break;Fe.tag===5&&pt!==null&&(Fe=pt,J?(Ke=Le(E,ne),Ke!=null&&ge.unshift(xp(E,Ke,Fe))):J||(Ke=Le(E,ne),Ke!=null&&ge.push(xp(E,Ke,Fe)))),E=E.return}ge.length!==0&&g.push({event:y,listeners:ge})}var mj=/\r\n?/g,vj=/\u0000|\uFFFD/g;function n0(g){return(typeof g=="string"?g:""+g).replace(mj,`
`).replace(vj,"")}function gg(g,y,E){if(y=n0(y),n0(g)!==y&&E)throw Error(r(425))}function Xd(){}var bp=null,Mu=null;function ey(g,y){return g==="textarea"||g==="noscript"||typeof y.children=="string"||typeof y.children=="number"||typeof y.dangerouslySetInnerHTML=="object"&&y.dangerouslySetInnerHTML!==null&&y.dangerouslySetInnerHTML.__html!=null}var ty=typeof setTimeout=="function"?setTimeout:void 0,i0=typeof clearTimeout=="function"?clearTimeout:void 0,o0=typeof Promise=="function"?Promise:void 0,yj=typeof queueMicrotask=="function"?queueMicrotask:typeof o0<"u"?function(g){return o0.resolve(null).then(g).catch(xj)}:ty;function xj(g){setTimeout(function(){throw g})}function ry(g,y){var E=y,B=0;do{var J=E.nextSibling;if(g.removeChild(E),J&&J.nodeType===8)if(E=J.data,E==="/$"){if(B===0){g.removeChild(J),Dl(y);return}B--}else E!=="$"&&E!=="$?"&&E!=="$!"||B++;E=J}while(E);Dl(y)}function Go(g){for(;g!=null;g=g.nextSibling){var y=g.nodeType;if(y===1||y===3)break;if(y===8){if(y=g.data,y==="$"||y==="$!"||y==="$?")break;if(y==="/$")return null}}return g}function es(g){g=g.previousSibling;for(var y=0;g;){if(g.nodeType===8){var E=g.data;if(E==="$"||E==="$!"||E==="$?"){if(y===0)return g;y--}else E==="/$"&&y++}g=g.previousSibling}return null}var na=Math.random().toString(36).slice(2),pl="__reactFiber$"+na,Zd="__reactProps$"+na,So="__reactContainer$"+na,ia="__reactEvents$"+na,bj="__reactListeners$"+na,wj="__reactHandles$"+na;function Fc(g){var y=g[pl];if(y)return y;for(var E=g.parentNode;E;){if(y=E[So]||E[pl]){if(E=y.alternate,y.child!==null||E!==null&&E.child!==null)for(g=es(g);g!==null;){if(E=g[pl])return E;g=es(g)}return y}g=E,E=g.parentNode}return null}function Jd(g){return g=g[pl]||g[So],!g||g.tag!==5&&g.tag!==6&&g.tag!==13&&g.tag!==3?null:g}function Du(g){if(g.tag===5||g.tag===6)return g.stateNode;throw Error(r(33))}function wp(g){return g[Zd]||null}var ny=[],Ul=-1;function Ts(g){return{current:g}}function pn(g){0>Ul||(g.current=ny[Ul],ny[Ul]=null,Ul--)}function mn(g,y){Ul++,ny[Ul]=g.current,g.current=y}var zc={},ao=Ts(zc),oa=Ts(!1),Bu=zc;function ef(g,y){var E=g.type.contextTypes;if(!E)return zc;var B=g.stateNode;if(B&&B.__reactInternalMemoizedUnmaskedChildContext===y)return B.__reactInternalMemoizedMaskedChildContext;var J={},ne;for(ne in E)J[ne]=y[ne];return B&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=y,g.__reactInternalMemoizedMaskedChildContext=J),J}function aa(g){return g=g.childContextTypes,g!=null}function mg(){pn(oa),pn(ao)}function a0(g,y,E){if(ao.current!==zc)throw Error(r(168));mn(ao,y),mn(oa,E)}function iy(g,y,E){var B=g.stateNode;if(y=y.childContextTypes,typeof B.getChildContext!="function")return E;B=B.getChildContext();for(var J in B)if(!(J in y))throw Error(r(108,K(g)||"Unknown",J));return V({},E,B)}function Wu(g){return g=(g=g.stateNode)&&g.__reactInternalMemoizedMergedChildContext||zc,Bu=ao.current,mn(ao,g),mn(oa,oa.current),!0}function s0(g,y,E){var B=g.stateNode;if(!B)throw Error(r(169));E?(g=iy(g,y,Bu),B.__reactInternalMemoizedMergedChildContext=g,pn(oa),pn(ao),mn(ao,g)):pn(oa),mn(oa,E)}var Hl=null,Sp=!1,L=!1;function W(g){Hl===null?Hl=[g]:Hl.push(g)}function te(g){Sp=!0,W(g)}function oe(){if(!L&&Hl!==null){L=!0;var g=0,y=zr;try{var E=Hl;for(zr=1;g<E.length;g++){var B=E[g];do B=B(!0);while(B!==null)}Hl=null,Sp=!1}catch(J){throw Hl!==null&&(Hl=Hl.slice(g+1)),Ca(tl,oe),J}finally{zr=y,L=!1}}return null}var pe=[],me=0,ye=null,we=0,_e=[],Oe=0,Ge=null,it=1,Ne="";function Ze(g,y){pe[me++]=we,pe[me++]=ye,ye=g,we=y}function nt(g,y,E){_e[Oe++]=it,_e[Oe++]=Ne,_e[Oe++]=Ge,Ge=g;var B=it;g=Ne;var J=32-Gr(B)-1;B&=~(1<<J),E+=1;var ne=32-Gr(y)+J;if(30<ne){var ge=J-J%5;ne=(B&(1<<ge)-1).toString(32),B>>=ge,J-=ge,it=1<<32-Gr(y)+J|E<<J|B,Ne=ne+g}else it=1<<ne|E<<J|B,Ne=g}function bt(g){g.return!==null&&(Ze(g,1),nt(g,1,0))}function at(g){for(;g===ye;)ye=pe[--me],pe[me]=null,we=pe[--me],pe[me]=null;for(;g===Ge;)Ge=_e[--Oe],_e[Oe]=null,Ne=_e[--Oe],_e[Oe]=null,it=_e[--Oe],_e[Oe]=null}var gt=null,yt=null,_t=!1,At=null;function sr(g,y){var E=yl(5,null,null,0);E.elementType="DELETED",E.stateNode=y,E.return=g,y=g.deletions,y===null?(g.deletions=[E],g.flags|=16):y.push(E)}function Kt(g,y){switch(g.tag){case 5:var E=g.type;return y=y.nodeType!==1||E.toLowerCase()!==y.nodeName.toLowerCase()?null:y,y!==null?(g.stateNode=y,gt=g,yt=Go(y.firstChild),!0):!1;case 6:return y=g.pendingProps===""||y.nodeType!==3?null:y,y!==null?(g.stateNode=y,gt=g,yt=null,!0):!1;case 13:return y=y.nodeType!==8?null:y,y!==null?(E=Ge!==null?{id:it,overflow:Ne}:null,g.memoizedState={dehydrated:y,treeContext:E,retryLane:1073741824},E=yl(18,null,null,0),E.stateNode=y,E.return=g,g.child=E,gt=g,yt=null,!0):!1;default:return!1}}function Ir(g){return(g.mode&1)!==0&&(g.flags&128)===0}function er(g){if(_t){var y=yt;if(y){var E=y;if(!Kt(g,y)){if(Ir(g))throw Error(r(418));y=Go(E.nextSibling);var B=gt;y&&Kt(g,y)?sr(B,E):(g.flags=g.flags&-4097|2,_t=!1,gt=g)}}else{if(Ir(g))throw Error(r(418));g.flags=g.flags&-4097|2,_t=!1,gt=g}}}function Wr(g){for(g=g.return;g!==null&&g.tag!==5&&g.tag!==3&&g.tag!==13;)g=g.return;gt=g}function li(g){if(g!==gt)return!1;if(!_t)return Wr(g),_t=!0,!1;var y;if((y=g.tag!==3)&&!(y=g.tag!==5)&&(y=g.type,y=y!=="head"&&y!=="body"&&!ey(g.type,g.memoizedProps)),y&&(y=yt)){if(Ir(g))throw Or(),Error(r(418));for(;y;)sr(g,y),y=Go(y.nextSibling)}if(Wr(g),g.tag===13){if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));e:{for(g=g.nextSibling,y=0;g;){if(g.nodeType===8){var E=g.data;if(E==="/$"){if(y===0){yt=Go(g.nextSibling);break e}y--}else E!=="$"&&E!=="$!"&&E!=="$?"||y++}g=g.nextSibling}yt=null}}else yt=gt?Go(g.stateNode.nextSibling):null;return!0}function Or(){for(var g=yt;g;)g=Go(g.nextSibling)}function Qt(){yt=gt=null,_t=!1}function Ut(g){At===null?At=[g]:At.push(g)}var hi=j.ReactCurrentBatchConfig;function wr(g,y,E){if(g=E.ref,g!==null&&typeof g!="function"&&typeof g!="object"){if(E._owner){if(E=E._owner,E){if(E.tag!==1)throw Error(r(309));var B=E.stateNode}if(!B)throw Error(r(147,g));var J=B,ne=""+g;return y!==null&&y.ref!==null&&typeof y.ref=="function"&&y.ref._stringRef===ne?y.ref:(y=function(ge){var Fe=J.refs;ge===null?delete Fe[ne]:Fe[ne]=ge},y._stringRef=ne,y)}if(typeof g!="string")throw Error(r(284));if(!E._owner)throw Error(r(290,g))}return g}function Dr(g,y){throw g=Object.prototype.toString.call(y),Error(r(31,g==="[object Object]"?"object with keys {"+Object.keys(y).join(", ")+"}":g))}function Rn(g){var y=g._init;return y(g._payload)}function Qi(g){function y(ot,Je){if(g){var ut=ot.deletions;ut===null?(ot.deletions=[Je],ot.flags|=16):ut.push(Je)}}function E(ot,Je){if(!g)return null;for(;Je!==null;)y(ot,Je),Je=Je.sibling;return null}function B(ot,Je){for(ot=new Map;Je!==null;)Je.key!==null?ot.set(Je.key,Je):ot.set(Je.index,Je),Je=Je.sibling;return ot}function J(ot,Je){return ot=df(ot,Je),ot.index=0,ot.sibling=null,ot}function ne(ot,Je,ut){return ot.index=ut,g?(ut=ot.alternate,ut!==null?(ut=ut.index,ut<Je?(ot.flags|=2,Je):ut):(ot.flags|=2,Je)):(ot.flags|=1048576,Je)}function ge(ot){return g&&ot.alternate===null&&(ot.flags|=2),ot}function Fe(ot,Je,ut,Dt){return Je===null||Je.tag!==6?(Je=Qj(ut,ot.mode,Dt),Je.return=ot,Je):(Je=J(Je,ut),Je.return=ot,Je)}function Ke(ot,Je,ut,Dt){var cr=ut.type;return cr===A?Lt(ot,Je,ut.props.children,Dt,ut.key):Je!==null&&(Je.elementType===cr||typeof cr=="object"&&cr!==null&&cr.$$typeof===Y&&Rn(cr)===Je.type)?(Dt=J(Je,ut.props),Dt.ref=wr(ot,Je,ut),Dt.return=ot,Dt):(Dt=E0(ut.type,ut.key,ut.props,null,ot.mode,Dt),Dt.ref=wr(ot,Je,ut),Dt.return=ot,Dt)}function pt(ot,Je,ut,Dt){return Je===null||Je.tag!==4||Je.stateNode.containerInfo!==ut.containerInfo||Je.stateNode.implementation!==ut.implementation?(Je=Xj(ut,ot.mode,Dt),Je.return=ot,Je):(Je=J(Je,ut.children||[]),Je.return=ot,Je)}function Lt(ot,Je,ut,Dt,cr){return Je===null||Je.tag!==7?(Je=Pp(ut,ot.mode,Dt,cr),Je.return=ot,Je):(Je=J(Je,ut),Je.return=ot,Je)}function zt(ot,Je,ut){if(typeof Je=="string"&&Je!==""||typeof Je=="number")return Je=Qj(""+Je,ot.mode,ut),Je.return=ot,Je;if(typeof Je=="object"&&Je!==null){switch(Je.$$typeof){case _:return ut=E0(Je.type,Je.key,Je.props,null,ot.mode,ut),ut.ref=wr(ot,null,Je),ut.return=ot,ut;case T:return Je=Xj(Je,ot.mode,ut),Je.return=ot,Je;case Y:var Dt=Je._init;return zt(ot,Dt(Je._payload),ut)}if(Me(Je)||ee(Je))return Je=Pp(Je,ot.mode,ut,null),Je.return=ot,Je;Dr(ot,Je)}return null}function Rt(ot,Je,ut,Dt){var cr=Je!==null?Je.key:null;if(typeof ut=="string"&&ut!==""||typeof ut=="number")return cr!==null?null:Fe(ot,Je,""+ut,Dt);if(typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case _:return ut.key===cr?Ke(ot,Je,ut,Dt):null;case T:return ut.key===cr?pt(ot,Je,ut,Dt):null;case Y:return cr=ut._init,Rt(ot,Je,cr(ut._payload),Dt)}if(Me(ut)||ee(ut))return cr!==null?null:Lt(ot,Je,ut,Dt,null);Dr(ot,ut)}return null}function Yt(ot,Je,ut,Dt,cr){if(typeof Dt=="string"&&Dt!==""||typeof Dt=="number")return ot=ot.get(ut)||null,Fe(Je,ot,""+Dt,cr);if(typeof Dt=="object"&&Dt!==null){switch(Dt.$$typeof){case _:return ot=ot.get(Dt.key===null?ut:Dt.key)||null,Ke(Je,ot,Dt,cr);case T:return ot=ot.get(Dt.key===null?ut:Dt.key)||null,pt(Je,ot,Dt,cr);case Y:var mr=Dt._init;return Yt(ot,Je,ut,mr(Dt._payload),cr)}if(Me(Dt)||ee(Dt))return ot=ot.get(ut)||null,Lt(Je,ot,Dt,cr,null);Dr(Je,Dt)}return null}function rr(ot,Je,ut,Dt){for(var cr=null,mr=null,vr=Je,Cr=Je=0,Eo=null;vr!==null&&Cr<ut.length;Cr++){vr.index>Cr?(Eo=vr,vr=null):Eo=vr.sibling;var sn=Rt(ot,vr,ut[Cr],Dt);if(sn===null){vr===null&&(vr=Eo);break}g&&vr&&sn.alternate===null&&y(ot,vr),Je=ne(sn,Je,Cr),mr===null?cr=sn:mr.sibling=sn,mr=sn,vr=Eo}if(Cr===ut.length)return E(ot,vr),_t&&Ze(ot,Cr),cr;if(vr===null){for(;Cr<ut.length;Cr++)vr=zt(ot,ut[Cr],Dt),vr!==null&&(Je=ne(vr,Je,Cr),mr===null?cr=vr:mr.sibling=vr,mr=vr);return _t&&Ze(ot,Cr),cr}for(vr=B(ot,vr);Cr<ut.length;Cr++)Eo=Yt(vr,ot,Cr,ut[Cr],Dt),Eo!==null&&(g&&Eo.alternate!==null&&vr.delete(Eo.key===null?Cr:Eo.key),Je=ne(Eo,Je,Cr),mr===null?cr=Eo:mr.sibling=Eo,mr=Eo);return g&&vr.forEach(function(ff){return y(ot,ff)}),_t&&Ze(ot,Cr),cr}function ar(ot,Je,ut,Dt){var cr=ee(ut);if(typeof cr!="function")throw Error(r(150));if(ut=cr.call(ut),ut==null)throw Error(r(151));for(var mr=cr=null,vr=Je,Cr=Je=0,Eo=null,sn=ut.next();vr!==null&&!sn.done;Cr++,sn=ut.next()){vr.index>Cr?(Eo=vr,vr=null):Eo=vr.sibling;var ff=Rt(ot,vr,sn.value,Dt);if(ff===null){vr===null&&(vr=Eo);break}g&&vr&&ff.alternate===null&&y(ot,vr),Je=ne(ff,Je,Cr),mr===null?cr=ff:mr.sibling=ff,mr=ff,vr=Eo}if(sn.done)return E(ot,vr),_t&&Ze(ot,Cr),cr;if(vr===null){for(;!sn.done;Cr++,sn=ut.next())sn=zt(ot,sn.value,Dt),sn!==null&&(Je=ne(sn,Je,Cr),mr===null?cr=sn:mr.sibling=sn,mr=sn);return _t&&Ze(ot,Cr),cr}for(vr=B(ot,vr);!sn.done;Cr++,sn=ut.next())sn=Yt(vr,ot,Cr,sn.value,Dt),sn!==null&&(g&&sn.alternate!==null&&vr.delete(sn.key===null?Cr:sn.key),Je=ne(sn,Je,Cr),mr===null?cr=sn:mr.sibling=sn,mr=sn);return g&&vr.forEach(function(kJ){return y(ot,kJ)}),_t&&Ze(ot,Cr),cr}function Wi(ot,Je,ut,Dt){if(typeof ut=="object"&&ut!==null&&ut.type===A&&ut.key===null&&(ut=ut.props.children),typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case _:e:{for(var cr=ut.key,mr=Je;mr!==null;){if(mr.key===cr){if(cr=ut.type,cr===A){if(mr.tag===7){E(ot,mr.sibling),Je=J(mr,ut.props.children),Je.return=ot,ot=Je;break e}}else if(mr.elementType===cr||typeof cr=="object"&&cr!==null&&cr.$$typeof===Y&&Rn(cr)===mr.type){E(ot,mr.sibling),Je=J(mr,ut.props),Je.ref=wr(ot,mr,ut),Je.return=ot,ot=Je;break e}E(ot,mr);break}else y(ot,mr);mr=mr.sibling}ut.type===A?(Je=Pp(ut.props.children,ot.mode,Dt,ut.key),Je.return=ot,ot=Je):(Dt=E0(ut.type,ut.key,ut.props,null,ot.mode,Dt),Dt.ref=wr(ot,Je,ut),Dt.return=ot,ot=Dt)}return ge(ot);case T:e:{for(mr=ut.key;Je!==null;){if(Je.key===mr)if(Je.tag===4&&Je.stateNode.containerInfo===ut.containerInfo&&Je.stateNode.implementation===ut.implementation){E(ot,Je.sibling),Je=J(Je,ut.children||[]),Je.return=ot,ot=Je;break e}else{E(ot,Je);break}else y(ot,Je);Je=Je.sibling}Je=Xj(ut,ot.mode,Dt),Je.return=ot,ot=Je}return ge(ot);case Y:return mr=ut._init,Wi(ot,Je,mr(ut._payload),Dt)}if(Me(ut))return rr(ot,Je,ut,Dt);if(ee(ut))return ar(ot,Je,ut,Dt);Dr(ot,ut)}return typeof ut=="string"&&ut!==""||typeof ut=="number"?(ut=""+ut,Je!==null&&Je.tag===6?(E(ot,Je.sibling),Je=J(Je,ut),Je.return=ot,ot=Je):(E(ot,Je),Je=Qj(ut,ot.mode,Dt),Je.return=ot,ot=Je),ge(ot)):E(ot,Je)}return Wi}var Ci=Qi(!0),ni=Qi(!1),Di=Ts(null),Xi=null,Un=null,Hr=null;function tn(){Hr=Un=Xi=null}function Hn(g){var y=Di.current;pn(Di),g._currentValue=y}function rn(g,y,E){for(;g!==null;){var B=g.alternate;if((g.childLanes&y)!==y?(g.childLanes|=y,B!==null&&(B.childLanes|=y)):B!==null&&(B.childLanes&y)!==y&&(B.childLanes|=y),g===E)break;g=g.return}}function ci(g,y){Xi=g,Hr=Un=null,g=g.dependencies,g!==null&&g.firstContext!==null&&((g.lanes&y)!==0&&(rs=!0),g.firstContext=null)}function ui(g){var y=g._currentValue;if(Hr!==g)if(g={context:g,memoizedValue:y,next:null},Un===null){if(Xi===null)throw Error(r(308));Un=g,Xi.dependencies={lanes:0,firstContext:g}}else Un=Un.next=g;return y}var An=null;function jo(g){An===null?An=[g]:An.push(g)}function vn(g,y,E,B){var J=y.interleaved;return J===null?(E.next=E,jo(y)):(E.next=J.next,J.next=E),y.interleaved=E,Tn(g,B)}function Tn(g,y){g.lanes|=y;var E=g.alternate;for(E!==null&&(E.lanes|=y),E=g,g=g.return;g!==null;)g.childLanes|=y,E=g.alternate,E!==null&&(E.childLanes|=y),E=g,g=g.return;return E.tag===3?E.stateNode:null}var Ei=!1;function so(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function sa(g,y){g=g.updateQueue,y.updateQueue===g&&(y.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,effects:g.effects})}function gi(g,y){return{eventTime:g,lane:y,tag:0,payload:null,callback:null,next:null}}function mi(g,y,E){var B=g.updateQueue;if(B===null)return null;if(B=B.shared,(nn&2)!==0){var J=B.pending;return J===null?y.next=y:(y.next=J.next,J.next=y),B.pending=y,Tn(g,E)}return J=B.interleaved,J===null?(y.next=y,jo(B)):(y.next=J.next,J.next=y),B.interleaved=y,Tn(g,E)}function ko(g,y,E){if(y=y.updateQueue,y!==null&&(y=y.shared,(E&4194240)!==0)){var B=y.lanes;B&=g.pendingLanes,E|=B,y.lanes=E,ap(g,E)}}function Pn(g,y){var E=g.updateQueue,B=g.alternate;if(B!==null&&(B=B.updateQueue,E===B)){var J=null,ne=null;if(E=E.firstBaseUpdate,E!==null){do{var ge={eventTime:E.eventTime,lane:E.lane,tag:E.tag,payload:E.payload,callback:E.callback,next:null};ne===null?J=ne=ge:ne=ne.next=ge,E=E.next}while(E!==null);ne===null?J=ne=y:ne=ne.next=y}else J=ne=y;E={baseState:B.baseState,firstBaseUpdate:J,lastBaseUpdate:ne,shared:B.shared,effects:B.effects},g.updateQueue=E;return}g=E.lastBaseUpdate,g===null?E.firstBaseUpdate=y:g.next=y,E.lastBaseUpdate=y}function _o(g,y,E,B){var J=g.updateQueue;Ei=!1;var ne=J.firstBaseUpdate,ge=J.lastBaseUpdate,Fe=J.shared.pending;if(Fe!==null){J.shared.pending=null;var Ke=Fe,pt=Ke.next;Ke.next=null,ge===null?ne=pt:ge.next=pt,ge=Ke;var Lt=g.alternate;Lt!==null&&(Lt=Lt.updateQueue,Fe=Lt.lastBaseUpdate,Fe!==ge&&(Fe===null?Lt.firstBaseUpdate=pt:Fe.next=pt,Lt.lastBaseUpdate=Ke))}if(ne!==null){var zt=J.baseState;ge=0,Lt=pt=Ke=null,Fe=ne;do{var Rt=Fe.lane,Yt=Fe.eventTime;if((B&Rt)===Rt){Lt!==null&&(Lt=Lt.next={eventTime:Yt,lane:0,tag:Fe.tag,payload:Fe.payload,callback:Fe.callback,next:null});e:{var rr=g,ar=Fe;switch(Rt=y,Yt=E,ar.tag){case 1:if(rr=ar.payload,typeof rr=="function"){zt=rr.call(Yt,zt,Rt);break e}zt=rr;break e;case 3:rr.flags=rr.flags&-65537|128;case 0:if(rr=ar.payload,Rt=typeof rr=="function"?rr.call(Yt,zt,Rt):rr,Rt==null)break e;zt=V({},zt,Rt);break e;case 2:Ei=!0}}Fe.callback!==null&&Fe.lane!==0&&(g.flags|=64,Rt=J.effects,Rt===null?J.effects=[Fe]:Rt.push(Fe))}else Yt={eventTime:Yt,lane:Rt,tag:Fe.tag,payload:Fe.payload,callback:Fe.callback,next:null},Lt===null?(pt=Lt=Yt,Ke=zt):Lt=Lt.next=Yt,ge|=Rt;if(Fe=Fe.next,Fe===null){if(Fe=J.shared.pending,Fe===null)break;Rt=Fe,Fe=Rt.next,Rt.next=null,J.lastBaseUpdate=Rt,J.shared.pending=null}}while(!0);if(Lt===null&&(Ke=zt),J.baseState=Ke,J.firstBaseUpdate=pt,J.lastBaseUpdate=Lt,y=J.shared.interleaved,y!==null){J=y;do ge|=J.lane,J=J.next;while(J!==y)}else ne===null&&(J.shared.lanes=0);Cp|=ge,g.lanes=ge,g.memoizedState=zt}}function ts(g,y,E){if(g=y.effects,y.effects=null,g!==null)for(y=0;y<g.length;y++){var B=g[y],J=B.callback;if(J!==null){if(B.callback=null,B=E,typeof J!="function")throw Error(r(191,J));J.call(B)}}}var Ps={},Zi=Ts(Ps),vi=Ts(Ps),Mc=Ts(Ps);function Vl(g){if(g===Ps)throw Error(r(174));return g}function tf(g,y){switch(mn(Mc,y),mn(vi,g),mn(Zi,Ps),g=y.nodeType,g){case 9:case 11:y=(y=y.documentElement)?y.namespaceURI:He(null,"");break;default:g=g===8?y.parentNode:y,y=g.namespaceURI||null,g=g.tagName,y=He(y,g)}pn(Zi),mn(Zi,y)}function hl(){pn(Zi),pn(vi),pn(Mc)}function l0(g){Vl(Mc.current);var y=Vl(Zi.current),E=He(y,g.type);y!==E&&(mn(vi,g),mn(Zi,E))}function oy(g){vi.current===g&&(pn(Zi),pn(vi))}var Dn=Ts(0);function Is(g){for(var y=g;y!==null;){if(y.tag===13){var E=y.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||E.data==="$?"||E.data==="$!"))return y}else if(y.tag===19&&y.memoizedProps.revealOrder!==void 0){if((y.flags&128)!==0)return y}else if(y.child!==null){y.child.return=y,y=y.child;continue}if(y===g)break;for(;y.sibling===null;){if(y.return===null||y.return===g)return null;y=y.return}y.sibling.return=y.return,y=y.sibling}return null}var ay=[];function sy(){for(var g=0;g<ay.length;g++)ay[g]._workInProgressVersionPrimary=null;ay.length=0}var vg=j.ReactCurrentDispatcher,yg=j.ReactCurrentBatchConfig,gl=0,Vn=null,Ai=null,yi=null,rf=!1,Yl=!1,nf=0,Sj=0;function Bi(){throw Error(r(321))}function xg(g,y){if(y===null)return!1;for(var E=0;E<y.length&&E<g.length;E++)if(!Ki(g[E],y[E]))return!1;return!0}function jp(g,y,E,B,J,ne){if(gl=ne,Vn=y,y.memoizedState=null,y.updateQueue=null,y.lanes=0,vg.current=g===null||g.memoizedState===null?QZ:XZ,g=E(B,J),Yl){ne=0;do{if(Yl=!1,nf=0,25<=ne)throw Error(r(301));ne+=1,yi=Ai=null,y.updateQueue=null,vg.current=ZZ,g=E(B,J)}while(Yl)}if(vg.current=p0,y=Ai!==null&&Ai.next!==null,gl=0,yi=Ai=Vn=null,rf=!1,y)throw Error(r(300));return g}function ml(){var g=nf!==0;return nf=0,g}function Os(){var g={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yi===null?Vn.memoizedState=yi=g:yi=yi.next=g,yi}function Ia(){if(Ai===null){var g=Vn.alternate;g=g!==null?g.memoizedState:null}else g=Ai.next;var y=yi===null?Vn.memoizedState:yi.next;if(y!==null)yi=y,Ai=g;else{if(g===null)throw Error(r(310));Ai=g,g={memoizedState:Ai.memoizedState,baseState:Ai.baseState,baseQueue:Ai.baseQueue,queue:Ai.queue,next:null},yi===null?Vn.memoizedState=yi=g:yi=yi.next=g}return yi}function kp(g,y){return typeof y=="function"?y(g):y}function bg(g){var y=Ia(),E=y.queue;if(E===null)throw Error(r(311));E.lastRenderedReducer=g;var B=Ai,J=B.baseQueue,ne=E.pending;if(ne!==null){if(J!==null){var ge=J.next;J.next=ne.next,ne.next=ge}B.baseQueue=J=ne,E.pending=null}if(J!==null){ne=J.next,B=B.baseState;var Fe=ge=null,Ke=null,pt=ne;do{var Lt=pt.lane;if((gl&Lt)===Lt)Ke!==null&&(Ke=Ke.next={lane:0,action:pt.action,hasEagerState:pt.hasEagerState,eagerState:pt.eagerState,next:null}),B=pt.hasEagerState?pt.eagerState:g(B,pt.action);else{var zt={lane:Lt,action:pt.action,hasEagerState:pt.hasEagerState,eagerState:pt.eagerState,next:null};Ke===null?(Fe=Ke=zt,ge=B):Ke=Ke.next=zt,Vn.lanes|=Lt,Cp|=Lt}pt=pt.next}while(pt!==null&&pt!==ne);Ke===null?ge=B:Ke.next=Fe,Ki(B,y.memoizedState)||(rs=!0),y.memoizedState=B,y.baseState=ge,y.baseQueue=Ke,E.lastRenderedState=B}if(g=E.interleaved,g!==null){J=g;do ne=J.lane,Vn.lanes|=ne,Cp|=ne,J=J.next;while(J!==g)}else J===null&&(E.lanes=0);return[y.memoizedState,E.dispatch]}function Dc(g){var y=Ia(),E=y.queue;if(E===null)throw Error(r(311));E.lastRenderedReducer=g;var B=E.dispatch,J=E.pending,ne=y.memoizedState;if(J!==null){E.pending=null;var ge=J=J.next;do ne=g(ne,ge.action),ge=ge.next;while(ge!==J);Ki(ne,y.memoizedState)||(rs=!0),y.memoizedState=ne,y.baseQueue===null&&(y.baseState=ne),E.lastRenderedState=ne}return[ne,B]}function c0(){}function ly(g,y){var E=Vn,B=Ia(),J=y(),ne=!Ki(B.memoizedState,J);if(ne&&(B.memoizedState=J,rs=!0),B=B.queue,jg(d0.bind(null,E,B,g),[g]),B.getSnapshot!==y||ne||yi!==null&&yi.memoizedState.tag&1){if(E.flags|=2048,Oa(9,cy.bind(null,E,B,J,y),void 0,null),Co===null)throw Error(r(349));(gl&30)!==0||u0(E,y,J)}return J}function u0(g,y,E){g.flags|=16384,g={getSnapshot:y,value:E},y=Vn.updateQueue,y===null?(y={lastEffect:null,stores:null},Vn.updateQueue=y,y.stores=[g]):(E=y.stores,E===null?y.stores=[g]:E.push(g))}function cy(g,y,E,B){y.value=E,y.getSnapshot=B,of(y)&&wg(g)}function d0(g,y,E){return E(function(){of(y)&&wg(g)})}function of(g){var y=g.getSnapshot;g=g.value;try{var E=y();return!Ki(g,E)}catch{return!0}}function wg(g){var y=Tn(g,1);y!==null&&Zl(y,g,1,-1)}function _p(g){var y=Os();return typeof g=="function"&&(g=g()),y.memoizedState=y.baseState=g,g={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:kp,lastRenderedState:g},y.queue=g,g=g.dispatch=KZ.bind(null,Vn,g),[y.memoizedState,g]}function Oa(g,y,E,B){return g={tag:g,create:y,destroy:E,deps:B,next:null},y=Vn.updateQueue,y===null?(y={lastEffect:null,stores:null},Vn.updateQueue=y,y.lastEffect=g.next=g):(E=y.lastEffect,E===null?y.lastEffect=g.next=g:(B=E.next,E.next=g,g.next=B,y.lastEffect=g)),g}function Gl(){return Ia().memoizedState}function Ns(g,y,E,B){var J=Os();Vn.flags|=g,J.memoizedState=Oa(1|y,E,void 0,B===void 0?null:B)}function qu(g,y,E,B){var J=Ia();B=B===void 0?null:B;var ne=void 0;if(Ai!==null){var ge=Ai.memoizedState;if(ne=ge.destroy,B!==null&&xg(B,ge.deps)){J.memoizedState=Oa(y,E,ne,B);return}}Vn.flags|=g,J.memoizedState=Oa(1|y,E,ne,B)}function Sg(g,y){return Ns(8390656,8,g,y)}function jg(g,y){return qu(2048,8,g,y)}function f0(g,y){return qu(4,2,g,y)}function kg(g,y){return qu(4,4,g,y)}function _g(g,y){if(typeof y=="function")return g=g(),y(g),function(){y(null)};if(y!=null)return g=g(),y.current=g,function(){y.current=null}}function gI(g,y,E){return E=E!=null?E.concat([g]):null,qu(4,4,_g.bind(null,y,g),E)}function jj(){}function mI(g,y){var E=Ia();y=y===void 0?null:y;var B=E.memoizedState;return B!==null&&y!==null&&xg(y,B[1])?B[0]:(E.memoizedState=[g,y],g)}function vI(g,y){var E=Ia();y=y===void 0?null:y;var B=E.memoizedState;return B!==null&&y!==null&&xg(y,B[1])?B[0]:(g=g(),E.memoizedState=[g,y],g)}function yI(g,y,E){return(gl&21)===0?(g.baseState&&(g.baseState=!1,rs=!0),g.memoizedState=E):(Ki(E,y)||(E=Gi(),Vn.lanes|=E,Cp|=E,g.baseState=!0),y)}function YZ(g,y){var E=zr;zr=E!==0&&4>E?E:4,g(!0);var B=yg.transition;yg.transition={};try{g(!1),y()}finally{zr=E,yg.transition=B}}function xI(){return Ia().memoizedState}function GZ(g,y,E){var B=cf(g);if(E={lane:B,action:E,hasEagerState:!1,eagerState:null,next:null},bI(g))wI(y,E);else if(E=vn(g,y,E,B),E!==null){var J=Ra();Zl(E,g,B,J),SI(E,y,B)}}function KZ(g,y,E){var B=cf(g),J={lane:B,action:E,hasEagerState:!1,eagerState:null,next:null};if(bI(g))wI(y,J);else{var ne=g.alternate;if(g.lanes===0&&(ne===null||ne.lanes===0)&&(ne=y.lastRenderedReducer,ne!==null))try{var ge=y.lastRenderedState,Fe=ne(ge,E);if(J.hasEagerState=!0,J.eagerState=Fe,Ki(Fe,ge)){var Ke=y.interleaved;Ke===null?(J.next=J,jo(y)):(J.next=Ke.next,Ke.next=J),y.interleaved=J;return}}catch{}finally{}E=vn(g,y,J,B),E!==null&&(J=Ra(),Zl(E,g,B,J),SI(E,y,B))}}function bI(g){var y=g.alternate;return g===Vn||y!==null&&y===Vn}function wI(g,y){Yl=rf=!0;var E=g.pending;E===null?y.next=y:(y.next=E.next,E.next=y),g.pending=y}function SI(g,y,E){if((E&4194240)!==0){var B=y.lanes;B&=g.pendingLanes,E|=B,y.lanes=E,ap(g,E)}}var p0={readContext:ui,useCallback:Bi,useContext:Bi,useEffect:Bi,useImperativeHandle:Bi,useInsertionEffect:Bi,useLayoutEffect:Bi,useMemo:Bi,useReducer:Bi,useRef:Bi,useState:Bi,useDebugValue:Bi,useDeferredValue:Bi,useTransition:Bi,useMutableSource:Bi,useSyncExternalStore:Bi,useId:Bi,unstable_isNewReconciler:!1},QZ={readContext:ui,useCallback:function(g,y){return Os().memoizedState=[g,y===void 0?null:y],g},useContext:ui,useEffect:Sg,useImperativeHandle:function(g,y,E){return E=E!=null?E.concat([g]):null,Ns(4194308,4,_g.bind(null,y,g),E)},useLayoutEffect:function(g,y){return Ns(4194308,4,g,y)},useInsertionEffect:function(g,y){return Ns(4,2,g,y)},useMemo:function(g,y){var E=Os();return y=y===void 0?null:y,g=g(),E.memoizedState=[g,y],g},useReducer:function(g,y,E){var B=Os();return y=E!==void 0?E(y):y,B.memoizedState=B.baseState=y,g={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:y},B.queue=g,g=g.dispatch=GZ.bind(null,Vn,g),[B.memoizedState,g]},useRef:function(g){var y=Os();return g={current:g},y.memoizedState=g},useState:_p,useDebugValue:jj,useDeferredValue:function(g){return Os().memoizedState=g},useTransition:function(){var g=_p(!1),y=g[0];return g=YZ.bind(null,g[1]),Os().memoizedState=g,[y,g]},useMutableSource:function(){},useSyncExternalStore:function(g,y,E){var B=Vn,J=Os();if(_t){if(E===void 0)throw Error(r(407));E=E()}else{if(E=y(),Co===null)throw Error(r(349));(gl&30)!==0||u0(B,y,E)}J.memoizedState=E;var ne={value:E,getSnapshot:y};return J.queue=ne,Sg(d0.bind(null,B,ne,g),[g]),B.flags|=2048,Oa(9,cy.bind(null,B,ne,E,y),void 0,null),E},useId:function(){var g=Os(),y=Co.identifierPrefix;if(_t){var E=Ne,B=it;E=(B&~(1<<32-Gr(B)-1)).toString(32)+E,y=":"+y+"R"+E,E=nf++,0<E&&(y+="H"+E.toString(32)),y+=":"}else E=Sj++,y=":"+y+"r"+E.toString(32)+":";return g.memoizedState=y},unstable_isNewReconciler:!1},XZ={readContext:ui,useCallback:mI,useContext:ui,useEffect:jg,useImperativeHandle:gI,useInsertionEffect:f0,useLayoutEffect:kg,useMemo:vI,useReducer:bg,useRef:Gl,useState:function(){return bg(kp)},useDebugValue:jj,useDeferredValue:function(g){var y=Ia();return yI(y,Ai.memoizedState,g)},useTransition:function(){var g=bg(kp)[0],y=Ia().memoizedState;return[g,y]},useMutableSource:c0,useSyncExternalStore:ly,useId:xI,unstable_isNewReconciler:!1},ZZ={readContext:ui,useCallback:mI,useContext:ui,useEffect:jg,useImperativeHandle:gI,useInsertionEffect:f0,useLayoutEffect:kg,useMemo:vI,useReducer:Dc,useRef:Gl,useState:function(){return Dc(kp)},useDebugValue:jj,useDeferredValue:function(g){var y=Ia();return Ai===null?y.memoizedState=g:yI(y,Ai.memoizedState,g)},useTransition:function(){var g=Dc(kp)[0],y=Ia().memoizedState;return[g,y]},useMutableSource:c0,useSyncExternalStore:ly,useId:xI,unstable_isNewReconciler:!1};function Kl(g,y){if(g&&g.defaultProps){y=V({},y),g=g.defaultProps;for(var E in g)y[E]===void 0&&(y[E]=g[E]);return y}return y}function kj(g,y,E,B){y=g.memoizedState,E=E(B,y),E=E==null?y:V({},y,E),g.memoizedState=E,g.lanes===0&&(g.updateQueue.baseState=E)}var h0={isMounted:function(g){return(g=g._reactInternals)?Fn(g)===g:!1},enqueueSetState:function(g,y,E){g=g._reactInternals;var B=Ra(),J=cf(g),ne=gi(B,J);ne.payload=y,E!=null&&(ne.callback=E),y=mi(g,ne,J),y!==null&&(Zl(y,g,J,B),ko(y,g,J))},enqueueReplaceState:function(g,y,E){g=g._reactInternals;var B=Ra(),J=cf(g),ne=gi(B,J);ne.tag=1,ne.payload=y,E!=null&&(ne.callback=E),y=mi(g,ne,J),y!==null&&(Zl(y,g,J,B),ko(y,g,J))},enqueueForceUpdate:function(g,y){g=g._reactInternals;var E=Ra(),B=cf(g),J=gi(E,B);J.tag=2,y!=null&&(J.callback=y),y=mi(g,J,B),y!==null&&(Zl(y,g,B,E),ko(y,g,B))}};function jI(g,y,E,B,J,ne,ge){return g=g.stateNode,typeof g.shouldComponentUpdate=="function"?g.shouldComponentUpdate(B,ne,ge):y.prototype&&y.prototype.isPureReactComponent?!ul(E,B)||!ul(J,ne):!0}function kI(g,y,E){var B=!1,J=zc,ne=y.contextType;return typeof ne=="object"&&ne!==null?ne=ui(ne):(J=aa(y)?Bu:ao.current,B=y.contextTypes,ne=(B=B!=null)?ef(g,J):zc),y=new y(E,ne),g.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=h0,g.stateNode=y,y._reactInternals=g,B&&(g=g.stateNode,g.__reactInternalMemoizedUnmaskedChildContext=J,g.__reactInternalMemoizedMaskedChildContext=ne),y}function _I(g,y,E,B){g=y.state,typeof y.componentWillReceiveProps=="function"&&y.componentWillReceiveProps(E,B),typeof y.UNSAFE_componentWillReceiveProps=="function"&&y.UNSAFE_componentWillReceiveProps(E,B),y.state!==g&&h0.enqueueReplaceState(y,y.state,null)}function _j(g,y,E,B){var J=g.stateNode;J.props=E,J.state=g.memoizedState,J.refs={},so(g);var ne=y.contextType;typeof ne=="object"&&ne!==null?J.context=ui(ne):(ne=aa(y)?Bu:ao.current,J.context=ef(g,ne)),J.state=g.memoizedState,ne=y.getDerivedStateFromProps,typeof ne=="function"&&(kj(g,y,ne,E),J.state=g.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof J.getSnapshotBeforeUpdate=="function"||typeof J.UNSAFE_componentWillMount!="function"&&typeof J.componentWillMount!="function"||(y=J.state,typeof J.componentWillMount=="function"&&J.componentWillMount(),typeof J.UNSAFE_componentWillMount=="function"&&J.UNSAFE_componentWillMount(),y!==J.state&&h0.enqueueReplaceState(J,J.state,null),_o(g,E,J,B),J.state=g.memoizedState),typeof J.componentDidMount=="function"&&(g.flags|=4194308)}function Cg(g,y){try{var E="",B=y;do E+=U(B),B=B.return;while(B);var J=E}catch(ne){J=`
Error generating stack: `+ne.message+`
`+ne.stack}return{value:g,source:y,stack:J,digest:null}}function Cj(g,y,E){return{value:g,source:null,stack:E??null,digest:y??null}}function Ej(g,y){try{console.error(y.value)}catch(E){setTimeout(function(){throw E})}}var JZ=typeof WeakMap=="function"?WeakMap:Map;function CI(g,y,E){E=gi(-1,E),E.tag=3,E.payload={element:null};var B=y.value;return E.callback=function(){w0||(w0=!0,qj=B),Ej(g,y)},E}function EI(g,y,E){E=gi(-1,E),E.tag=3;var B=g.type.getDerivedStateFromError;if(typeof B=="function"){var J=y.value;E.payload=function(){return B(J)},E.callback=function(){Ej(g,y)}}var ne=g.stateNode;return ne!==null&&typeof ne.componentDidCatch=="function"&&(E.callback=function(){Ej(g,y),typeof B!="function"&&(sf===null?sf=new Set([this]):sf.add(this));var ge=y.stack;this.componentDidCatch(y.value,{componentStack:ge!==null?ge:""})}),E}function AI(g,y,E){var B=g.pingCache;if(B===null){B=g.pingCache=new JZ;var J=new Set;B.set(y,J)}else J=B.get(y),J===void 0&&(J=new Set,B.set(y,J));J.has(E)||(J.add(E),g=pJ.bind(null,g,y,E),y.then(g,g))}function TI(g){do{var y;if((y=g.tag===13)&&(y=g.memoizedState,y=y!==null?y.dehydrated!==null:!0),y)return g;g=g.return}while(g!==null);return null}function PI(g,y,E,B,J){return(g.mode&1)===0?(g===y?g.flags|=65536:(g.flags|=128,E.flags|=131072,E.flags&=-52805,E.tag===1&&(E.alternate===null?E.tag=17:(y=gi(-1,1),y.tag=2,mi(E,y,1))),E.lanes|=1),g):(g.flags|=65536,g.lanes=J,g)}var eJ=j.ReactCurrentOwner,rs=!1;function Na(g,y,E,B){y.child=g===null?ni(y,null,E,B):Ci(y,g.child,E,B)}function II(g,y,E,B,J){E=E.render;var ne=y.ref;return ci(y,J),B=jp(g,y,E,B,ne,J),E=ml(),g!==null&&!rs?(y.updateQueue=g.updateQueue,y.flags&=-2053,g.lanes&=~J,$u(g,y,J)):(_t&&E&&bt(y),y.flags|=1,Na(g,y,B,J),y.child)}function OI(g,y,E,B,J){if(g===null){var ne=E.type;return typeof ne=="function"&&!Kj(ne)&&ne.defaultProps===void 0&&E.compare===null&&E.defaultProps===void 0?(y.tag=15,y.type=ne,NI(g,y,ne,B,J)):(g=E0(E.type,null,B,y,y.mode,J),g.ref=y.ref,g.return=y,y.child=g)}if(ne=g.child,(g.lanes&J)===0){var ge=ne.memoizedProps;if(E=E.compare,E=E!==null?E:ul,E(ge,B)&&g.ref===y.ref)return $u(g,y,J)}return y.flags|=1,g=df(ne,B),g.ref=y.ref,g.return=y,y.child=g}function NI(g,y,E,B,J){if(g!==null){var ne=g.memoizedProps;if(ul(ne,B)&&g.ref===y.ref)if(rs=!1,y.pendingProps=B=ne,(g.lanes&J)!==0)(g.flags&131072)!==0&&(rs=!0);else return y.lanes=g.lanes,$u(g,y,J)}return Aj(g,y,E,B,J)}function RI(g,y,E){var B=y.pendingProps,J=B.children,ne=g!==null?g.memoizedState:null;if(B.mode==="hidden")if((y.mode&1)===0)y.memoizedState={baseLanes:0,cachePool:null,transitions:null},mn(Ag,Rs),Rs|=E;else{if((E&1073741824)===0)return g=ne!==null?ne.baseLanes|E:E,y.lanes=y.childLanes=1073741824,y.memoizedState={baseLanes:g,cachePool:null,transitions:null},y.updateQueue=null,mn(Ag,Rs),Rs|=g,null;y.memoizedState={baseLanes:0,cachePool:null,transitions:null},B=ne!==null?ne.baseLanes:E,mn(Ag,Rs),Rs|=B}else ne!==null?(B=ne.baseLanes|E,y.memoizedState=null):B=E,mn(Ag,Rs),Rs|=B;return Na(g,y,J,E),y.child}function LI(g,y){var E=y.ref;(g===null&&E!==null||g!==null&&g.ref!==E)&&(y.flags|=512,y.flags|=2097152)}function Aj(g,y,E,B,J){var ne=aa(E)?Bu:ao.current;return ne=ef(y,ne),ci(y,J),E=jp(g,y,E,B,ne,J),B=ml(),g!==null&&!rs?(y.updateQueue=g.updateQueue,y.flags&=-2053,g.lanes&=~J,$u(g,y,J)):(_t&&B&&bt(y),y.flags|=1,Na(g,y,E,J),y.child)}function FI(g,y,E,B,J){if(aa(E)){var ne=!0;Wu(y)}else ne=!1;if(ci(y,J),y.stateNode===null)m0(g,y),kI(y,E,B),_j(y,E,B,J),B=!0;else if(g===null){var ge=y.stateNode,Fe=y.memoizedProps;ge.props=Fe;var Ke=ge.context,pt=E.contextType;typeof pt=="object"&&pt!==null?pt=ui(pt):(pt=aa(E)?Bu:ao.current,pt=ef(y,pt));var Lt=E.getDerivedStateFromProps,zt=typeof Lt=="function"||typeof ge.getSnapshotBeforeUpdate=="function";zt||typeof ge.UNSAFE_componentWillReceiveProps!="function"&&typeof ge.componentWillReceiveProps!="function"||(Fe!==B||Ke!==pt)&&_I(y,ge,B,pt),Ei=!1;var Rt=y.memoizedState;ge.state=Rt,_o(y,B,ge,J),Ke=y.memoizedState,Fe!==B||Rt!==Ke||oa.current||Ei?(typeof Lt=="function"&&(kj(y,E,Lt,B),Ke=y.memoizedState),(Fe=Ei||jI(y,E,Fe,B,Rt,Ke,pt))?(zt||typeof ge.UNSAFE_componentWillMount!="function"&&typeof ge.componentWillMount!="function"||(typeof ge.componentWillMount=="function"&&ge.componentWillMount(),typeof ge.UNSAFE_componentWillMount=="function"&&ge.UNSAFE_componentWillMount()),typeof ge.componentDidMount=="function"&&(y.flags|=4194308)):(typeof ge.componentDidMount=="function"&&(y.flags|=4194308),y.memoizedProps=B,y.memoizedState=Ke),ge.props=B,ge.state=Ke,ge.context=pt,B=Fe):(typeof ge.componentDidMount=="function"&&(y.flags|=4194308),B=!1)}else{ge=y.stateNode,sa(g,y),Fe=y.memoizedProps,pt=y.type===y.elementType?Fe:Kl(y.type,Fe),ge.props=pt,zt=y.pendingProps,Rt=ge.context,Ke=E.contextType,typeof Ke=="object"&&Ke!==null?Ke=ui(Ke):(Ke=aa(E)?Bu:ao.current,Ke=ef(y,Ke));var Yt=E.getDerivedStateFromProps;(Lt=typeof Yt=="function"||typeof ge.getSnapshotBeforeUpdate=="function")||typeof ge.UNSAFE_componentWillReceiveProps!="function"&&typeof ge.componentWillReceiveProps!="function"||(Fe!==zt||Rt!==Ke)&&_I(y,ge,B,Ke),Ei=!1,Rt=y.memoizedState,ge.state=Rt,_o(y,B,ge,J);var rr=y.memoizedState;Fe!==zt||Rt!==rr||oa.current||Ei?(typeof Yt=="function"&&(kj(y,E,Yt,B),rr=y.memoizedState),(pt=Ei||jI(y,E,pt,B,Rt,rr,Ke)||!1)?(Lt||typeof ge.UNSAFE_componentWillUpdate!="function"&&typeof ge.componentWillUpdate!="function"||(typeof ge.componentWillUpdate=="function"&&ge.componentWillUpdate(B,rr,Ke),typeof ge.UNSAFE_componentWillUpdate=="function"&&ge.UNSAFE_componentWillUpdate(B,rr,Ke)),typeof ge.componentDidUpdate=="function"&&(y.flags|=4),typeof ge.getSnapshotBeforeUpdate=="function"&&(y.flags|=1024)):(typeof ge.componentDidUpdate!="function"||Fe===g.memoizedProps&&Rt===g.memoizedState||(y.flags|=4),typeof ge.getSnapshotBeforeUpdate!="function"||Fe===g.memoizedProps&&Rt===g.memoizedState||(y.flags|=1024),y.memoizedProps=B,y.memoizedState=rr),ge.props=B,ge.state=rr,ge.context=Ke,B=pt):(typeof ge.componentDidUpdate!="function"||Fe===g.memoizedProps&&Rt===g.memoizedState||(y.flags|=4),typeof ge.getSnapshotBeforeUpdate!="function"||Fe===g.memoizedProps&&Rt===g.memoizedState||(y.flags|=1024),B=!1)}return Tj(g,y,E,B,ne,J)}function Tj(g,y,E,B,J,ne){LI(g,y);var ge=(y.flags&128)!==0;if(!B&&!ge)return J&&s0(y,E,!1),$u(g,y,ne);B=y.stateNode,eJ.current=y;var Fe=ge&&typeof E.getDerivedStateFromError!="function"?null:B.render();return y.flags|=1,g!==null&&ge?(y.child=Ci(y,g.child,null,ne),y.child=Ci(y,null,Fe,ne)):Na(g,y,Fe,ne),y.memoizedState=B.state,J&&s0(y,E,!0),y.child}function zI(g){var y=g.stateNode;y.pendingContext?a0(g,y.pendingContext,y.pendingContext!==y.context):y.context&&a0(g,y.context,!1),tf(g,y.containerInfo)}function MI(g,y,E,B,J){return Qt(),Ut(J),y.flags|=256,Na(g,y,E,B),y.child}var Pj={dehydrated:null,treeContext:null,retryLane:0};function Ij(g){return{baseLanes:g,cachePool:null,transitions:null}}function DI(g,y,E){var B=y.pendingProps,J=Dn.current,ne=!1,ge=(y.flags&128)!==0,Fe;if((Fe=ge)||(Fe=g!==null&&g.memoizedState===null?!1:(J&2)!==0),Fe?(ne=!0,y.flags&=-129):(g===null||g.memoizedState!==null)&&(J|=1),mn(Dn,J&1),g===null)return er(y),g=y.memoizedState,g!==null&&(g=g.dehydrated,g!==null)?((y.mode&1)===0?y.lanes=1:g.data==="$!"?y.lanes=8:y.lanes=1073741824,null):(ge=B.children,g=B.fallback,ne?(B=y.mode,ne=y.child,ge={mode:"hidden",children:ge},(B&1)===0&&ne!==null?(ne.childLanes=0,ne.pendingProps=ge):ne=A0(ge,B,0,null),g=Pp(g,B,E,null),ne.return=y,g.return=y,ne.sibling=g,y.child=ne,y.child.memoizedState=Ij(E),y.memoizedState=Pj,g):Oj(y,ge));if(J=g.memoizedState,J!==null&&(Fe=J.dehydrated,Fe!==null))return tJ(g,y,ge,B,Fe,J,E);if(ne){ne=B.fallback,ge=y.mode,J=g.child,Fe=J.sibling;var Ke={mode:"hidden",children:B.children};return(ge&1)===0&&y.child!==J?(B=y.child,B.childLanes=0,B.pendingProps=Ke,y.deletions=null):(B=df(J,Ke),B.subtreeFlags=J.subtreeFlags&14680064),Fe!==null?ne=df(Fe,ne):(ne=Pp(ne,ge,E,null),ne.flags|=2),ne.return=y,B.return=y,B.sibling=ne,y.child=B,B=ne,ne=y.child,ge=g.child.memoizedState,ge=ge===null?Ij(E):{baseLanes:ge.baseLanes|E,cachePool:null,transitions:ge.transitions},ne.memoizedState=ge,ne.childLanes=g.childLanes&~E,y.memoizedState=Pj,B}return ne=g.child,g=ne.sibling,B=df(ne,{mode:"visible",children:B.children}),(y.mode&1)===0&&(B.lanes=E),B.return=y,B.sibling=null,g!==null&&(E=y.deletions,E===null?(y.deletions=[g],y.flags|=16):E.push(g)),y.child=B,y.memoizedState=null,B}function Oj(g,y){return y=A0({mode:"visible",children:y},g.mode,0,null),y.return=g,g.child=y}function g0(g,y,E,B){return B!==null&&Ut(B),Ci(y,g.child,null,E),g=Oj(y,y.pendingProps.children),g.flags|=2,y.memoizedState=null,g}function tJ(g,y,E,B,J,ne,ge){if(E)return y.flags&256?(y.flags&=-257,B=Cj(Error(r(422))),g0(g,y,ge,B)):y.memoizedState!==null?(y.child=g.child,y.flags|=128,null):(ne=B.fallback,J=y.mode,B=A0({mode:"visible",children:B.children},J,0,null),ne=Pp(ne,J,ge,null),ne.flags|=2,B.return=y,ne.return=y,B.sibling=ne,y.child=B,(y.mode&1)!==0&&Ci(y,g.child,null,ge),y.child.memoizedState=Ij(ge),y.memoizedState=Pj,ne);if((y.mode&1)===0)return g0(g,y,ge,null);if(J.data==="$!"){if(B=J.nextSibling&&J.nextSibling.dataset,B)var Fe=B.dgst;return B=Fe,ne=Error(r(419)),B=Cj(ne,B,void 0),g0(g,y,ge,B)}if(Fe=(ge&g.childLanes)!==0,rs||Fe){if(B=Co,B!==null){switch(ge&-ge){case 4:J=2;break;case 16:J=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:J=32;break;case 536870912:J=268435456;break;default:J=0}J=(J&(B.suspendedLanes|ge))!==0?0:J,J!==0&&J!==ne.retryLane&&(ne.retryLane=J,Tn(g,J),Zl(B,g,J,-1))}return Gj(),B=Cj(Error(r(421))),g0(g,y,ge,B)}return J.data==="$?"?(y.flags|=128,y.child=g.child,y=hJ.bind(null,g),J._reactRetry=y,null):(g=ne.treeContext,yt=Go(J.nextSibling),gt=y,_t=!0,At=null,g!==null&&(_e[Oe++]=it,_e[Oe++]=Ne,_e[Oe++]=Ge,it=g.id,Ne=g.overflow,Ge=y),y=Oj(y,B.children),y.flags|=4096,y)}function BI(g,y,E){g.lanes|=y;var B=g.alternate;B!==null&&(B.lanes|=y),rn(g.return,y,E)}function Nj(g,y,E,B,J){var ne=g.memoizedState;ne===null?g.memoizedState={isBackwards:y,rendering:null,renderingStartTime:0,last:B,tail:E,tailMode:J}:(ne.isBackwards=y,ne.rendering=null,ne.renderingStartTime=0,ne.last=B,ne.tail=E,ne.tailMode=J)}function WI(g,y,E){var B=y.pendingProps,J=B.revealOrder,ne=B.tail;if(Na(g,y,B.children,E),B=Dn.current,(B&2)!==0)B=B&1|2,y.flags|=128;else{if(g!==null&&(g.flags&128)!==0)e:for(g=y.child;g!==null;){if(g.tag===13)g.memoizedState!==null&&BI(g,E,y);else if(g.tag===19)BI(g,E,y);else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===y)break e;for(;g.sibling===null;){if(g.return===null||g.return===y)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}B&=1}if(mn(Dn,B),(y.mode&1)===0)y.memoizedState=null;else switch(J){case"forwards":for(E=y.child,J=null;E!==null;)g=E.alternate,g!==null&&Is(g)===null&&(J=E),E=E.sibling;E=J,E===null?(J=y.child,y.child=null):(J=E.sibling,E.sibling=null),Nj(y,!1,J,E,ne);break;case"backwards":for(E=null,J=y.child,y.child=null;J!==null;){if(g=J.alternate,g!==null&&Is(g)===null){y.child=J;break}g=J.sibling,J.sibling=E,E=J,J=g}Nj(y,!0,E,null,ne);break;case"together":Nj(y,!1,null,null,void 0);break;default:y.memoizedState=null}return y.child}function m0(g,y){(y.mode&1)===0&&g!==null&&(g.alternate=null,y.alternate=null,y.flags|=2)}function $u(g,y,E){if(g!==null&&(y.dependencies=g.dependencies),Cp|=y.lanes,(E&y.childLanes)===0)return null;if(g!==null&&y.child!==g.child)throw Error(r(153));if(y.child!==null){for(g=y.child,E=df(g,g.pendingProps),y.child=E,E.return=y;g.sibling!==null;)g=g.sibling,E=E.sibling=df(g,g.pendingProps),E.return=y;E.sibling=null}return y.child}function rJ(g,y,E){switch(y.tag){case 3:zI(y),Qt();break;case 5:l0(y);break;case 1:aa(y.type)&&Wu(y);break;case 4:tf(y,y.stateNode.containerInfo);break;case 10:var B=y.type._context,J=y.memoizedProps.value;mn(Di,B._currentValue),B._currentValue=J;break;case 13:if(B=y.memoizedState,B!==null)return B.dehydrated!==null?(mn(Dn,Dn.current&1),y.flags|=128,null):(E&y.child.childLanes)!==0?DI(g,y,E):(mn(Dn,Dn.current&1),g=$u(g,y,E),g!==null?g.sibling:null);mn(Dn,Dn.current&1);break;case 19:if(B=(E&y.childLanes)!==0,(g.flags&128)!==0){if(B)return WI(g,y,E);y.flags|=128}if(J=y.memoizedState,J!==null&&(J.rendering=null,J.tail=null,J.lastEffect=null),mn(Dn,Dn.current),B)break;return null;case 22:case 23:return y.lanes=0,RI(g,y,E)}return $u(g,y,E)}var qI,Rj,$I,UI;qI=function(g,y){for(var E=y.child;E!==null;){if(E.tag===5||E.tag===6)g.appendChild(E.stateNode);else if(E.tag!==4&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===y)break;for(;E.sibling===null;){if(E.return===null||E.return===y)return;E=E.return}E.sibling.return=E.return,E=E.sibling}},Rj=function(){},$I=function(g,y,E,B){var J=g.memoizedProps;if(J!==B){g=y.stateNode,Vl(Zi.current);var ne=null;switch(E){case"input":J=ve(g,J),B=ve(g,B),ne=[];break;case"select":J=V({},J,{value:void 0}),B=V({},B,{value:void 0}),ne=[];break;case"textarea":J=Pe(g,J),B=Pe(g,B),ne=[];break;default:typeof J.onClick!="function"&&typeof B.onClick=="function"&&(g.onclick=Xd)}Ft(E,B);var ge;E=null;for(pt in J)if(!B.hasOwnProperty(pt)&&J.hasOwnProperty(pt)&&J[pt]!=null)if(pt==="style"){var Fe=J[pt];for(ge in Fe)Fe.hasOwnProperty(ge)&&(E||(E={}),E[ge]="")}else pt!=="dangerouslySetInnerHTML"&&pt!=="children"&&pt!=="suppressContentEditableWarning"&&pt!=="suppressHydrationWarning"&&pt!=="autoFocus"&&(o.hasOwnProperty(pt)?ne||(ne=[]):(ne=ne||[]).push(pt,null));for(pt in B){var Ke=B[pt];if(Fe=J!=null?J[pt]:void 0,B.hasOwnProperty(pt)&&Ke!==Fe&&(Ke!=null||Fe!=null))if(pt==="style")if(Fe){for(ge in Fe)!Fe.hasOwnProperty(ge)||Ke&&Ke.hasOwnProperty(ge)||(E||(E={}),E[ge]="");for(ge in Ke)Ke.hasOwnProperty(ge)&&Fe[ge]!==Ke[ge]&&(E||(E={}),E[ge]=Ke[ge])}else E||(ne||(ne=[]),ne.push(pt,E)),E=Ke;else pt==="dangerouslySetInnerHTML"?(Ke=Ke?Ke.__html:void 0,Fe=Fe?Fe.__html:void 0,Ke!=null&&Fe!==Ke&&(ne=ne||[]).push(pt,Ke)):pt==="children"?typeof Ke!="string"&&typeof Ke!="number"||(ne=ne||[]).push(pt,""+Ke):pt!=="suppressContentEditableWarning"&&pt!=="suppressHydrationWarning"&&(o.hasOwnProperty(pt)?(Ke!=null&&pt==="onScroll"&&En("scroll",g),ne||Fe===Ke||(ne=[])):(ne=ne||[]).push(pt,Ke))}E&&(ne=ne||[]).push("style",E);var pt=ne;(y.updateQueue=pt)&&(y.flags|=4)}},UI=function(g,y,E,B){E!==B&&(y.flags|=4)};function uy(g,y){if(!_t)switch(g.tailMode){case"hidden":y=g.tail;for(var E=null;y!==null;)y.alternate!==null&&(E=y),y=y.sibling;E===null?g.tail=null:E.sibling=null;break;case"collapsed":E=g.tail;for(var B=null;E!==null;)E.alternate!==null&&(B=E),E=E.sibling;B===null?y||g.tail===null?g.tail=null:g.tail.sibling=null:B.sibling=null}}function la(g){var y=g.alternate!==null&&g.alternate.child===g.child,E=0,B=0;if(y)for(var J=g.child;J!==null;)E|=J.lanes|J.childLanes,B|=J.subtreeFlags&14680064,B|=J.flags&14680064,J.return=g,J=J.sibling;else for(J=g.child;J!==null;)E|=J.lanes|J.childLanes,B|=J.subtreeFlags,B|=J.flags,J.return=g,J=J.sibling;return g.subtreeFlags|=B,g.childLanes=E,y}function nJ(g,y,E){var B=y.pendingProps;switch(at(y),y.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return la(y),null;case 1:return aa(y.type)&&mg(),la(y),null;case 3:return B=y.stateNode,hl(),pn(oa),pn(ao),sy(),B.pendingContext&&(B.context=B.pendingContext,B.pendingContext=null),(g===null||g.child===null)&&(li(y)?y.flags|=4:g===null||g.memoizedState.isDehydrated&&(y.flags&256)===0||(y.flags|=1024,At!==null&&(Hj(At),At=null))),Rj(g,y),la(y),null;case 5:oy(y);var J=Vl(Mc.current);if(E=y.type,g!==null&&y.stateNode!=null)$I(g,y,E,B,J),g.ref!==y.ref&&(y.flags|=512,y.flags|=2097152);else{if(!B){if(y.stateNode===null)throw Error(r(166));return la(y),null}if(g=Vl(Zi.current),li(y)){B=y.stateNode,E=y.type;var ne=y.memoizedProps;switch(B[pl]=y,B[Zd]=ne,g=(y.mode&1)!==0,E){case"dialog":En("cancel",B),En("close",B);break;case"iframe":case"object":case"embed":En("load",B);break;case"video":case"audio":for(J=0;J<Lc.length;J++)En(Lc[J],B);break;case"source":En("error",B);break;case"img":case"image":case"link":En("error",B),En("load",B);break;case"details":En("toggle",B);break;case"input":se(B,ne),En("invalid",B);break;case"select":B._wrapperState={wasMultiple:!!ne.multiple},En("invalid",B);break;case"textarea":Ee(B,ne),En("invalid",B)}Ft(E,ne),J=null;for(var ge in ne)if(ne.hasOwnProperty(ge)){var Fe=ne[ge];ge==="children"?typeof Fe=="string"?B.textContent!==Fe&&(ne.suppressHydrationWarning!==!0&&gg(B.textContent,Fe,g),J=["children",Fe]):typeof Fe=="number"&&B.textContent!==""+Fe&&(ne.suppressHydrationWarning!==!0&&gg(B.textContent,Fe,g),J=["children",""+Fe]):o.hasOwnProperty(ge)&&Fe!=null&&ge==="onScroll"&&En("scroll",B)}switch(E){case"input":de(B),ae(B,ne,!0);break;case"textarea":de(B),Ye(B);break;case"select":case"option":break;default:typeof ne.onClick=="function"&&(B.onclick=Xd)}B=J,y.updateQueue=B,B!==null&&(y.flags|=4)}else{ge=J.nodeType===9?J:J.ownerDocument,g==="http://www.w3.org/1999/xhtml"&&(g=rt(E)),g==="http://www.w3.org/1999/xhtml"?E==="script"?(g=ge.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild)):typeof B.is=="string"?g=ge.createElement(E,{is:B.is}):(g=ge.createElement(E),E==="select"&&(ge=g,B.multiple?ge.multiple=!0:B.size&&(ge.size=B.size))):g=ge.createElementNS(g,E),g[pl]=y,g[Zd]=B,qI(g,y,!1,!1),y.stateNode=g;e:{switch(ge=Ce(E,B),E){case"dialog":En("cancel",g),En("close",g),J=B;break;case"iframe":case"object":case"embed":En("load",g),J=B;break;case"video":case"audio":for(J=0;J<Lc.length;J++)En(Lc[J],g);J=B;break;case"source":En("error",g),J=B;break;case"img":case"image":case"link":En("error",g),En("load",g),J=B;break;case"details":En("toggle",g),J=B;break;case"input":se(g,B),J=ve(g,B),En("invalid",g);break;case"option":J=B;break;case"select":g._wrapperState={wasMultiple:!!B.multiple},J=V({},B,{value:void 0}),En("invalid",g);break;case"textarea":Ee(g,B),J=Pe(g,B),En("invalid",g);break;default:J=B}Ft(E,J),Fe=J;for(ne in Fe)if(Fe.hasOwnProperty(ne)){var Ke=Fe[ne];ne==="style"?Et(g,Ke):ne==="dangerouslySetInnerHTML"?(Ke=Ke?Ke.__html:void 0,Ke!=null&&st(g,Ke)):ne==="children"?typeof Ke=="string"?(E!=="textarea"||Ke!=="")&&Te(g,Ke):typeof Ke=="number"&&Te(g,""+Ke):ne!=="suppressContentEditableWarning"&&ne!=="suppressHydrationWarning"&&ne!=="autoFocus"&&(o.hasOwnProperty(ne)?Ke!=null&&ne==="onScroll"&&En("scroll",g):Ke!=null&&k(g,ne,Ke,ge))}switch(E){case"input":de(g),ae(g,B,!1);break;case"textarea":de(g),Ye(g);break;case"option":B.value!=null&&g.setAttribute("value",""+re(B.value));break;case"select":g.multiple=!!B.multiple,ne=B.value,ne!=null?Se(g,!!B.multiple,ne,!1):B.defaultValue!=null&&Se(g,!!B.multiple,B.defaultValue,!0);break;default:typeof J.onClick=="function"&&(g.onclick=Xd)}switch(E){case"button":case"input":case"select":case"textarea":B=!!B.autoFocus;break e;case"img":B=!0;break e;default:B=!1}}B&&(y.flags|=4)}y.ref!==null&&(y.flags|=512,y.flags|=2097152)}return la(y),null;case 6:if(g&&y.stateNode!=null)UI(g,y,g.memoizedProps,B);else{if(typeof B!="string"&&y.stateNode===null)throw Error(r(166));if(E=Vl(Mc.current),Vl(Zi.current),li(y)){if(B=y.stateNode,E=y.memoizedProps,B[pl]=y,(ne=B.nodeValue!==E)&&(g=gt,g!==null))switch(g.tag){case 3:gg(B.nodeValue,E,(g.mode&1)!==0);break;case 5:g.memoizedProps.suppressHydrationWarning!==!0&&gg(B.nodeValue,E,(g.mode&1)!==0)}ne&&(y.flags|=4)}else B=(E.nodeType===9?E:E.ownerDocument).createTextNode(B),B[pl]=y,y.stateNode=B}return la(y),null;case 13:if(pn(Dn),B=y.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(_t&&yt!==null&&(y.mode&1)!==0&&(y.flags&128)===0)Or(),Qt(),y.flags|=98560,ne=!1;else if(ne=li(y),B!==null&&B.dehydrated!==null){if(g===null){if(!ne)throw Error(r(318));if(ne=y.memoizedState,ne=ne!==null?ne.dehydrated:null,!ne)throw Error(r(317));ne[pl]=y}else Qt(),(y.flags&128)===0&&(y.memoizedState=null),y.flags|=4;la(y),ne=!1}else At!==null&&(Hj(At),At=null),ne=!0;if(!ne)return y.flags&65536?y:null}return(y.flags&128)!==0?(y.lanes=E,y):(B=B!==null,B!==(g!==null&&g.memoizedState!==null)&&B&&(y.child.flags|=8192,(y.mode&1)!==0&&(g===null||(Dn.current&1)!==0?lo===0&&(lo=3):Gj())),y.updateQueue!==null&&(y.flags|=4),la(y),null);case 4:return hl(),Rj(g,y),g===null&&Fu(y.stateNode.containerInfo),la(y),null;case 10:return Hn(y.type._context),la(y),null;case 17:return aa(y.type)&&mg(),la(y),null;case 19:if(pn(Dn),ne=y.memoizedState,ne===null)return la(y),null;if(B=(y.flags&128)!==0,ge=ne.rendering,ge===null)if(B)uy(ne,!1);else{if(lo!==0||g!==null&&(g.flags&128)!==0)for(g=y.child;g!==null;){if(ge=Is(g),ge!==null){for(y.flags|=128,uy(ne,!1),B=ge.updateQueue,B!==null&&(y.updateQueue=B,y.flags|=4),y.subtreeFlags=0,B=E,E=y.child;E!==null;)ne=E,g=B,ne.flags&=14680066,ge=ne.alternate,ge===null?(ne.childLanes=0,ne.lanes=g,ne.child=null,ne.subtreeFlags=0,ne.memoizedProps=null,ne.memoizedState=null,ne.updateQueue=null,ne.dependencies=null,ne.stateNode=null):(ne.childLanes=ge.childLanes,ne.lanes=ge.lanes,ne.child=ge.child,ne.subtreeFlags=0,ne.deletions=null,ne.memoizedProps=ge.memoizedProps,ne.memoizedState=ge.memoizedState,ne.updateQueue=ge.updateQueue,ne.type=ge.type,g=ge.dependencies,ne.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext}),E=E.sibling;return mn(Dn,Dn.current&1|2),y.child}g=g.sibling}ne.tail!==null&&jn()>Tg&&(y.flags|=128,B=!0,uy(ne,!1),y.lanes=4194304)}else{if(!B)if(g=Is(ge),g!==null){if(y.flags|=128,B=!0,E=g.updateQueue,E!==null&&(y.updateQueue=E,y.flags|=4),uy(ne,!0),ne.tail===null&&ne.tailMode==="hidden"&&!ge.alternate&&!_t)return la(y),null}else 2*jn()-ne.renderingStartTime>Tg&&E!==1073741824&&(y.flags|=128,B=!0,uy(ne,!1),y.lanes=4194304);ne.isBackwards?(ge.sibling=y.child,y.child=ge):(E=ne.last,E!==null?E.sibling=ge:y.child=ge,ne.last=ge)}return ne.tail!==null?(y=ne.tail,ne.rendering=y,ne.tail=y.sibling,ne.renderingStartTime=jn(),y.sibling=null,E=Dn.current,mn(Dn,B?E&1|2:E&1),y):(la(y),null);case 22:case 23:return Yj(),B=y.memoizedState!==null,g!==null&&g.memoizedState!==null!==B&&(y.flags|=8192),B&&(y.mode&1)!==0?(Rs&1073741824)!==0&&(la(y),y.subtreeFlags&6&&(y.flags|=8192)):la(y),null;case 24:return null;case 25:return null}throw Error(r(156,y.tag))}function iJ(g,y){switch(at(y),y.tag){case 1:return aa(y.type)&&mg(),g=y.flags,g&65536?(y.flags=g&-65537|128,y):null;case 3:return hl(),pn(oa),pn(ao),sy(),g=y.flags,(g&65536)!==0&&(g&128)===0?(y.flags=g&-65537|128,y):null;case 5:return oy(y),null;case 13:if(pn(Dn),g=y.memoizedState,g!==null&&g.dehydrated!==null){if(y.alternate===null)throw Error(r(340));Qt()}return g=y.flags,g&65536?(y.flags=g&-65537|128,y):null;case 19:return pn(Dn),null;case 4:return hl(),null;case 10:return Hn(y.type._context),null;case 22:case 23:return Yj(),null;case 24:return null;default:return null}}var v0=!1,ca=!1,oJ=typeof WeakSet=="function"?WeakSet:Set,Zt=null;function Eg(g,y){var E=g.ref;if(E!==null)if(typeof E=="function")try{E(null)}catch(B){Ti(g,y,B)}else E.current=null}function Lj(g,y,E){try{E()}catch(B){Ti(g,y,B)}}var HI=!1;function aJ(g,y){if(bp=Dd,g=Cn(),ri(g)){if("selectionStart"in g)var E={start:g.selectionStart,end:g.selectionEnd};else e:{E=(E=g.ownerDocument)&&E.defaultView||window;var B=E.getSelection&&E.getSelection();if(B&&B.rangeCount!==0){E=B.anchorNode;var J=B.anchorOffset,ne=B.focusNode;B=B.focusOffset;try{E.nodeType,ne.nodeType}catch{E=null;break e}var ge=0,Fe=-1,Ke=-1,pt=0,Lt=0,zt=g,Rt=null;t:for(;;){for(var Yt;zt!==E||J!==0&&zt.nodeType!==3||(Fe=ge+J),zt!==ne||B!==0&&zt.nodeType!==3||(Ke=ge+B),zt.nodeType===3&&(ge+=zt.nodeValue.length),(Yt=zt.firstChild)!==null;)Rt=zt,zt=Yt;for(;;){if(zt===g)break t;if(Rt===E&&++pt===J&&(Fe=ge),Rt===ne&&++Lt===B&&(Ke=ge),(Yt=zt.nextSibling)!==null)break;zt=Rt,Rt=zt.parentNode}zt=Yt}E=Fe===-1||Ke===-1?null:{start:Fe,end:Ke}}else E=null}E=E||{start:0,end:0}}else E=null;for(Mu={focusedElem:g,selectionRange:E},Dd=!1,Zt=y;Zt!==null;)if(y=Zt,g=y.child,(y.subtreeFlags&1028)!==0&&g!==null)g.return=y,Zt=g;else for(;Zt!==null;){y=Zt;try{var rr=y.alternate;if((y.flags&1024)!==0)switch(y.tag){case 0:case 11:case 15:break;case 1:if(rr!==null){var ar=rr.memoizedProps,Wi=rr.memoizedState,ot=y.stateNode,Je=ot.getSnapshotBeforeUpdate(y.elementType===y.type?ar:Kl(y.type,ar),Wi);ot.__reactInternalSnapshotBeforeUpdate=Je}break;case 3:var ut=y.stateNode.containerInfo;ut.nodeType===1?ut.textContent="":ut.nodeType===9&&ut.documentElement&&ut.removeChild(ut.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Dt){Ti(y,y.return,Dt)}if(g=y.sibling,g!==null){g.return=y.return,Zt=g;break}Zt=y.return}return rr=HI,HI=!1,rr}function dy(g,y,E){var B=y.updateQueue;if(B=B!==null?B.lastEffect:null,B!==null){var J=B=B.next;do{if((J.tag&g)===g){var ne=J.destroy;J.destroy=void 0,ne!==void 0&&Lj(y,E,ne)}J=J.next}while(J!==B)}}function y0(g,y){if(y=y.updateQueue,y=y!==null?y.lastEffect:null,y!==null){var E=y=y.next;do{if((E.tag&g)===g){var B=E.create;E.destroy=B()}E=E.next}while(E!==y)}}function Fj(g){var y=g.ref;if(y!==null){var E=g.stateNode;switch(g.tag){case 5:g=E;break;default:g=E}typeof y=="function"?y(g):y.current=g}}function VI(g){var y=g.alternate;y!==null&&(g.alternate=null,VI(y)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(y=g.stateNode,y!==null&&(delete y[pl],delete y[Zd],delete y[ia],delete y[bj],delete y[wj])),g.stateNode=null,g.return=null,g.dependencies=null,g.memoizedProps=null,g.memoizedState=null,g.pendingProps=null,g.stateNode=null,g.updateQueue=null}function YI(g){return g.tag===5||g.tag===3||g.tag===4}function GI(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||YI(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function zj(g,y,E){var B=g.tag;if(B===5||B===6)g=g.stateNode,y?E.nodeType===8?E.parentNode.insertBefore(g,y):E.insertBefore(g,y):(E.nodeType===8?(y=E.parentNode,y.insertBefore(g,E)):(y=E,y.appendChild(g)),E=E._reactRootContainer,E!=null||y.onclick!==null||(y.onclick=Xd));else if(B!==4&&(g=g.child,g!==null))for(zj(g,y,E),g=g.sibling;g!==null;)zj(g,y,E),g=g.sibling}function Mj(g,y,E){var B=g.tag;if(B===5||B===6)g=g.stateNode,y?E.insertBefore(g,y):E.appendChild(g);else if(B!==4&&(g=g.child,g!==null))for(Mj(g,y,E),g=g.sibling;g!==null;)Mj(g,y,E),g=g.sibling}var Ko=null,Ql=!1;function af(g,y,E){for(E=E.child;E!==null;)KI(g,y,E),E=E.sibling}function KI(g,y,E){if(zn&&typeof zn.onCommitFiberUnmount=="function")try{zn.onCommitFiberUnmount(Wt,E)}catch{}switch(E.tag){case 5:ca||Eg(E,y);case 6:var B=Ko,J=Ql;Ko=null,af(g,y,E),Ko=B,Ql=J,Ko!==null&&(Ql?(g=Ko,E=E.stateNode,g.nodeType===8?g.parentNode.removeChild(E):g.removeChild(E)):Ko.removeChild(E.stateNode));break;case 18:Ko!==null&&(Ql?(g=Ko,E=E.stateNode,g.nodeType===8?ry(g.parentNode,E):g.nodeType===1&&ry(g,E),Dl(g)):ry(Ko,E.stateNode));break;case 4:B=Ko,J=Ql,Ko=E.stateNode.containerInfo,Ql=!0,af(g,y,E),Ko=B,Ql=J;break;case 0:case 11:case 14:case 15:if(!ca&&(B=E.updateQueue,B!==null&&(B=B.lastEffect,B!==null))){J=B=B.next;do{var ne=J,ge=ne.destroy;ne=ne.tag,ge!==void 0&&((ne&2)!==0||(ne&4)!==0)&&Lj(E,y,ge),J=J.next}while(J!==B)}af(g,y,E);break;case 1:if(!ca&&(Eg(E,y),B=E.stateNode,typeof B.componentWillUnmount=="function"))try{B.props=E.memoizedProps,B.state=E.memoizedState,B.componentWillUnmount()}catch(Fe){Ti(E,y,Fe)}af(g,y,E);break;case 21:af(g,y,E);break;case 22:E.mode&1?(ca=(B=ca)||E.memoizedState!==null,af(g,y,E),ca=B):af(g,y,E);break;default:af(g,y,E)}}function QI(g){var y=g.updateQueue;if(y!==null){g.updateQueue=null;var E=g.stateNode;E===null&&(E=g.stateNode=new oJ),y.forEach(function(B){var J=gJ.bind(null,g,B);E.has(B)||(E.add(B),B.then(J,J))})}}function Xl(g,y){var E=y.deletions;if(E!==null)for(var B=0;B<E.length;B++){var J=E[B];try{var ne=g,ge=y,Fe=ge;e:for(;Fe!==null;){switch(Fe.tag){case 5:Ko=Fe.stateNode,Ql=!1;break e;case 3:Ko=Fe.stateNode.containerInfo,Ql=!0;break e;case 4:Ko=Fe.stateNode.containerInfo,Ql=!0;break e}Fe=Fe.return}if(Ko===null)throw Error(r(160));KI(ne,ge,J),Ko=null,Ql=!1;var Ke=J.alternate;Ke!==null&&(Ke.return=null),J.return=null}catch(pt){Ti(J,y,pt)}}if(y.subtreeFlags&12854)for(y=y.child;y!==null;)XI(y,g),y=y.sibling}function XI(g,y){var E=g.alternate,B=g.flags;switch(g.tag){case 0:case 11:case 14:case 15:if(Xl(y,g),Bc(g),B&4){try{dy(3,g,g.return),y0(3,g)}catch(ar){Ti(g,g.return,ar)}try{dy(5,g,g.return)}catch(ar){Ti(g,g.return,ar)}}break;case 1:Xl(y,g),Bc(g),B&512&&E!==null&&Eg(E,E.return);break;case 5:if(Xl(y,g),Bc(g),B&512&&E!==null&&Eg(E,E.return),g.flags&32){var J=g.stateNode;try{Te(J,"")}catch(ar){Ti(g,g.return,ar)}}if(B&4&&(J=g.stateNode,J!=null)){var ne=g.memoizedProps,ge=E!==null?E.memoizedProps:ne,Fe=g.type,Ke=g.updateQueue;if(g.updateQueue=null,Ke!==null)try{Fe==="input"&&ne.type==="radio"&&ne.name!=null&&be(J,ne),Ce(Fe,ge);var pt=Ce(Fe,ne);for(ge=0;ge<Ke.length;ge+=2){var Lt=Ke[ge],zt=Ke[ge+1];Lt==="style"?Et(J,zt):Lt==="dangerouslySetInnerHTML"?st(J,zt):Lt==="children"?Te(J,zt):k(J,Lt,zt,pt)}switch(Fe){case"input":De(J,ne);break;case"textarea":Ae(J,ne);break;case"select":var Rt=J._wrapperState.wasMultiple;J._wrapperState.wasMultiple=!!ne.multiple;var Yt=ne.value;Yt!=null?Se(J,!!ne.multiple,Yt,!1):Rt!==!!ne.multiple&&(ne.defaultValue!=null?Se(J,!!ne.multiple,ne.defaultValue,!0):Se(J,!!ne.multiple,ne.multiple?[]:"",!1))}J[Zd]=ne}catch(ar){Ti(g,g.return,ar)}}break;case 6:if(Xl(y,g),Bc(g),B&4){if(g.stateNode===null)throw Error(r(162));J=g.stateNode,ne=g.memoizedProps;try{J.nodeValue=ne}catch(ar){Ti(g,g.return,ar)}}break;case 3:if(Xl(y,g),Bc(g),B&4&&E!==null&&E.memoizedState.isDehydrated)try{Dl(y.containerInfo)}catch(ar){Ti(g,g.return,ar)}break;case 4:Xl(y,g),Bc(g);break;case 13:Xl(y,g),Bc(g),J=g.child,J.flags&8192&&(ne=J.memoizedState!==null,J.stateNode.isHidden=ne,!ne||J.alternate!==null&&J.alternate.memoizedState!==null||(Wj=jn())),B&4&&QI(g);break;case 22:if(Lt=E!==null&&E.memoizedState!==null,g.mode&1?(ca=(pt=ca)||Lt,Xl(y,g),ca=pt):Xl(y,g),Bc(g),B&8192){if(pt=g.memoizedState!==null,(g.stateNode.isHidden=pt)&&!Lt&&(g.mode&1)!==0)for(Zt=g,Lt=g.child;Lt!==null;){for(zt=Zt=Lt;Zt!==null;){switch(Rt=Zt,Yt=Rt.child,Rt.tag){case 0:case 11:case 14:case 15:dy(4,Rt,Rt.return);break;case 1:Eg(Rt,Rt.return);var rr=Rt.stateNode;if(typeof rr.componentWillUnmount=="function"){B=Rt,E=Rt.return;try{y=B,rr.props=y.memoizedProps,rr.state=y.memoizedState,rr.componentWillUnmount()}catch(ar){Ti(B,E,ar)}}break;case 5:Eg(Rt,Rt.return);break;case 22:if(Rt.memoizedState!==null){eO(zt);continue}}Yt!==null?(Yt.return=Rt,Zt=Yt):eO(zt)}Lt=Lt.sibling}e:for(Lt=null,zt=g;;){if(zt.tag===5){if(Lt===null){Lt=zt;try{J=zt.stateNode,pt?(ne=J.style,typeof ne.setProperty=="function"?ne.setProperty("display","none","important"):ne.display="none"):(Fe=zt.stateNode,Ke=zt.memoizedProps.style,ge=Ke!=null&&Ke.hasOwnProperty("display")?Ke.display:null,Fe.style.display=qe("display",ge))}catch(ar){Ti(g,g.return,ar)}}}else if(zt.tag===6){if(Lt===null)try{zt.stateNode.nodeValue=pt?"":zt.memoizedProps}catch(ar){Ti(g,g.return,ar)}}else if((zt.tag!==22&&zt.tag!==23||zt.memoizedState===null||zt===g)&&zt.child!==null){zt.child.return=zt,zt=zt.child;continue}if(zt===g)break e;for(;zt.sibling===null;){if(zt.return===null||zt.return===g)break e;Lt===zt&&(Lt=null),zt=zt.return}Lt===zt&&(Lt=null),zt.sibling.return=zt.return,zt=zt.sibling}}break;case 19:Xl(y,g),Bc(g),B&4&&QI(g);break;case 21:break;default:Xl(y,g),Bc(g)}}function Bc(g){var y=g.flags;if(y&2){try{e:{for(var E=g.return;E!==null;){if(YI(E)){var B=E;break e}E=E.return}throw Error(r(160))}switch(B.tag){case 5:var J=B.stateNode;B.flags&32&&(Te(J,""),B.flags&=-33);var ne=GI(g);Mj(g,ne,J);break;case 3:case 4:var ge=B.stateNode.containerInfo,Fe=GI(g);zj(g,Fe,ge);break;default:throw Error(r(161))}}catch(Ke){Ti(g,g.return,Ke)}g.flags&=-3}y&4096&&(g.flags&=-4097)}function sJ(g,y,E){Zt=g,ZI(g)}function ZI(g,y,E){for(var B=(g.mode&1)!==0;Zt!==null;){var J=Zt,ne=J.child;if(J.tag===22&&B){var ge=J.memoizedState!==null||v0;if(!ge){var Fe=J.alternate,Ke=Fe!==null&&Fe.memoizedState!==null||ca;Fe=v0;var pt=ca;if(v0=ge,(ca=Ke)&&!pt)for(Zt=J;Zt!==null;)ge=Zt,Ke=ge.child,ge.tag===22&&ge.memoizedState!==null?tO(J):Ke!==null?(Ke.return=ge,Zt=Ke):tO(J);for(;ne!==null;)Zt=ne,ZI(ne),ne=ne.sibling;Zt=J,v0=Fe,ca=pt}JI(g)}else(J.subtreeFlags&8772)!==0&&ne!==null?(ne.return=J,Zt=ne):JI(g)}}function JI(g){for(;Zt!==null;){var y=Zt;if((y.flags&8772)!==0){var E=y.alternate;try{if((y.flags&8772)!==0)switch(y.tag){case 0:case 11:case 15:ca||y0(5,y);break;case 1:var B=y.stateNode;if(y.flags&4&&!ca)if(E===null)B.componentDidMount();else{var J=y.elementType===y.type?E.memoizedProps:Kl(y.type,E.memoizedProps);B.componentDidUpdate(J,E.memoizedState,B.__reactInternalSnapshotBeforeUpdate)}var ne=y.updateQueue;ne!==null&&ts(y,ne,B);break;case 3:var ge=y.updateQueue;if(ge!==null){if(E=null,y.child!==null)switch(y.child.tag){case 5:E=y.child.stateNode;break;case 1:E=y.child.stateNode}ts(y,ge,E)}break;case 5:var Fe=y.stateNode;if(E===null&&y.flags&4){E=Fe;var Ke=y.memoizedProps;switch(y.type){case"button":case"input":case"select":case"textarea":Ke.autoFocus&&E.focus();break;case"img":Ke.src&&(E.src=Ke.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(y.memoizedState===null){var pt=y.alternate;if(pt!==null){var Lt=pt.memoizedState;if(Lt!==null){var zt=Lt.dehydrated;zt!==null&&Dl(zt)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}ca||y.flags&512&&Fj(y)}catch(Rt){Ti(y,y.return,Rt)}}if(y===g){Zt=null;break}if(E=y.sibling,E!==null){E.return=y.return,Zt=E;break}Zt=y.return}}function eO(g){for(;Zt!==null;){var y=Zt;if(y===g){Zt=null;break}var E=y.sibling;if(E!==null){E.return=y.return,Zt=E;break}Zt=y.return}}function tO(g){for(;Zt!==null;){var y=Zt;try{switch(y.tag){case 0:case 11:case 15:var E=y.return;try{y0(4,y)}catch(Ke){Ti(y,E,Ke)}break;case 1:var B=y.stateNode;if(typeof B.componentDidMount=="function"){var J=y.return;try{B.componentDidMount()}catch(Ke){Ti(y,J,Ke)}}var ne=y.return;try{Fj(y)}catch(Ke){Ti(y,ne,Ke)}break;case 5:var ge=y.return;try{Fj(y)}catch(Ke){Ti(y,ge,Ke)}}}catch(Ke){Ti(y,y.return,Ke)}if(y===g){Zt=null;break}var Fe=y.sibling;if(Fe!==null){Fe.return=y.return,Zt=Fe;break}Zt=y.return}}var lJ=Math.ceil,x0=j.ReactCurrentDispatcher,Dj=j.ReactCurrentOwner,vl=j.ReactCurrentBatchConfig,nn=0,Co=null,Ji=null,Qo=0,Rs=0,Ag=Ts(0),lo=0,fy=null,Cp=0,b0=0,Bj=0,py=null,ns=null,Wj=0,Tg=1/0,Uu=null,w0=!1,qj=null,sf=null,S0=!1,lf=null,j0=0,hy=0,$j=null,k0=-1,_0=0;function Ra(){return(nn&6)!==0?jn():k0!==-1?k0:k0=jn()}function cf(g){return(g.mode&1)===0?1:(nn&2)!==0&&Qo!==0?Qo&-Qo:hi.transition!==null?(_0===0&&(_0=Gi()),_0):(g=zr,g!==0||(g=window.event,g=g===void 0?16:Ec(g.type)),g)}function Zl(g,y,E,B){if(50<hy)throw hy=0,$j=null,Error(r(185));vu(g,E,B),((nn&2)===0||g!==Co)&&(g===Co&&((nn&2)===0&&(b0|=E),lo===4&&uf(g,Qo)),is(g,B),E===1&&nn===0&&(y.mode&1)===0&&(Tg=jn()+500,Sp&&oe()))}function is(g,y){var E=g.callbackNode;Fd(g,y);var B=_c(g,g===Co?Qo:0);if(B===0)E!==null&&xs(E),g.callbackNode=null,g.callbackPriority=0;else if(y=B&-B,g.callbackPriority!==y){if(E!=null&&xs(E),y===1)g.tag===0?te(nO.bind(null,g)):W(nO.bind(null,g)),yj(function(){(nn&6)===0&&oe()}),E=null;else{switch(sp(B)){case 1:E=tl;break;case 4:E=Mt;break;case 16:E=xr;break;case 536870912:E=yo;break;default:E=xr}E=dO(E,rO.bind(null,g))}g.callbackPriority=y,g.callbackNode=E}}function rO(g,y){if(k0=-1,_0=0,(nn&6)!==0)throw Error(r(327));var E=g.callbackNode;if(Pg()&&g.callbackNode!==E)return null;var B=_c(g,g===Co?Qo:0);if(B===0)return null;if((B&30)!==0||(B&g.expiredLanes)!==0||y)y=C0(g,B);else{y=B;var J=nn;nn|=2;var ne=oO();(Co!==g||Qo!==y)&&(Uu=null,Tg=jn()+500,Ap(g,y));do try{dJ();break}catch(Fe){iO(g,Fe)}while(!0);tn(),x0.current=ne,nn=J,Ji!==null?y=0:(Co=null,Qo=0,y=lo)}if(y!==0){if(y===2&&(J=bs(g),J!==0&&(B=J,y=Uj(g,J))),y===1)throw E=fy,Ap(g,0),uf(g,B),is(g,jn()),E;if(y===6)uf(g,B);else{if(J=g.current.alternate,(B&30)===0&&!cJ(J)&&(y=C0(g,B),y===2&&(ne=bs(g),ne!==0&&(B=ne,y=Uj(g,ne))),y===1))throw E=fy,Ap(g,0),uf(g,B),is(g,jn()),E;switch(g.finishedWork=J,g.finishedLanes=B,y){case 0:case 1:throw Error(r(345));case 2:Tp(g,ns,Uu);break;case 3:if(uf(g,B),(B&130023424)===B&&(y=Wj+500-jn(),10<y)){if(_c(g,0)!==0)break;if(J=g.suspendedLanes,(J&B)!==B){Ra(),g.pingedLanes|=g.suspendedLanes&J;break}g.timeoutHandle=ty(Tp.bind(null,g,ns,Uu),y);break}Tp(g,ns,Uu);break;case 4:if(uf(g,B),(B&4194240)===B)break;for(y=g.eventTimes,J=-1;0<B;){var ge=31-Gr(B);ne=1<<ge,ge=y[ge],ge>J&&(J=ge),B&=~ne}if(B=J,B=jn()-B,B=(120>B?120:480>B?480:1080>B?1080:1920>B?1920:3e3>B?3e3:4320>B?4320:1960*lJ(B/1960))-B,10<B){g.timeoutHandle=ty(Tp.bind(null,g,ns,Uu),B);break}Tp(g,ns,Uu);break;case 5:Tp(g,ns,Uu);break;default:throw Error(r(329))}}}return is(g,jn()),g.callbackNode===E?rO.bind(null,g):null}function Uj(g,y){var E=py;return g.current.memoizedState.isDehydrated&&(Ap(g,y).flags|=256),g=C0(g,y),g!==2&&(y=ns,ns=E,y!==null&&Hj(y)),g}function Hj(g){ns===null?ns=g:ns.push.apply(ns,g)}function cJ(g){for(var y=g;;){if(y.flags&16384){var E=y.updateQueue;if(E!==null&&(E=E.stores,E!==null))for(var B=0;B<E.length;B++){var J=E[B],ne=J.getSnapshot;J=J.value;try{if(!Ki(ne(),J))return!1}catch{return!1}}}if(E=y.child,y.subtreeFlags&16384&&E!==null)E.return=y,y=E;else{if(y===g)break;for(;y.sibling===null;){if(y.return===null||y.return===g)return!0;y=y.return}y.sibling.return=y.return,y=y.sibling}}return!0}function uf(g,y){for(y&=~Bj,y&=~b0,g.suspendedLanes|=y,g.pingedLanes&=~y,g=g.expirationTimes;0<y;){var E=31-Gr(y),B=1<<E;g[E]=-1,y&=~B}}function nO(g){if((nn&6)!==0)throw Error(r(327));Pg();var y=_c(g,0);if((y&1)===0)return is(g,jn()),null;var E=C0(g,y);if(g.tag!==0&&E===2){var B=bs(g);B!==0&&(y=B,E=Uj(g,B))}if(E===1)throw E=fy,Ap(g,0),uf(g,y),is(g,jn()),E;if(E===6)throw Error(r(345));return g.finishedWork=g.current.alternate,g.finishedLanes=y,Tp(g,ns,Uu),is(g,jn()),null}function Vj(g,y){var E=nn;nn|=1;try{return g(y)}finally{nn=E,nn===0&&(Tg=jn()+500,Sp&&oe())}}function Ep(g){lf!==null&&lf.tag===0&&(nn&6)===0&&Pg();var y=nn;nn|=1;var E=vl.transition,B=zr;try{if(vl.transition=null,zr=1,g)return g()}finally{zr=B,vl.transition=E,nn=y,(nn&6)===0&&oe()}}function Yj(){Rs=Ag.current,pn(Ag)}function Ap(g,y){g.finishedWork=null,g.finishedLanes=0;var E=g.timeoutHandle;if(E!==-1&&(g.timeoutHandle=-1,i0(E)),Ji!==null)for(E=Ji.return;E!==null;){var B=E;switch(at(B),B.tag){case 1:B=B.type.childContextTypes,B!=null&&mg();break;case 3:hl(),pn(oa),pn(ao),sy();break;case 5:oy(B);break;case 4:hl();break;case 13:pn(Dn);break;case 19:pn(Dn);break;case 10:Hn(B.type._context);break;case 22:case 23:Yj()}E=E.return}if(Co=g,Ji=g=df(g.current,null),Qo=Rs=y,lo=0,fy=null,Bj=b0=Cp=0,ns=py=null,An!==null){for(y=0;y<An.length;y++)if(E=An[y],B=E.interleaved,B!==null){E.interleaved=null;var J=B.next,ne=E.pending;if(ne!==null){var ge=ne.next;ne.next=J,B.next=ge}E.pending=B}An=null}return g}function iO(g,y){do{var E=Ji;try{if(tn(),vg.current=p0,rf){for(var B=Vn.memoizedState;B!==null;){var J=B.queue;J!==null&&(J.pending=null),B=B.next}rf=!1}if(gl=0,yi=Ai=Vn=null,Yl=!1,nf=0,Dj.current=null,E===null||E.return===null){lo=1,fy=y,Ji=null;break}e:{var ne=g,ge=E.return,Fe=E,Ke=y;if(y=Qo,Fe.flags|=32768,Ke!==null&&typeof Ke=="object"&&typeof Ke.then=="function"){var pt=Ke,Lt=Fe,zt=Lt.tag;if((Lt.mode&1)===0&&(zt===0||zt===11||zt===15)){var Rt=Lt.alternate;Rt?(Lt.updateQueue=Rt.updateQueue,Lt.memoizedState=Rt.memoizedState,Lt.lanes=Rt.lanes):(Lt.updateQueue=null,Lt.memoizedState=null)}var Yt=TI(ge);if(Yt!==null){Yt.flags&=-257,PI(Yt,ge,Fe,ne,y),Yt.mode&1&&AI(ne,pt,y),y=Yt,Ke=pt;var rr=y.updateQueue;if(rr===null){var ar=new Set;ar.add(Ke),y.updateQueue=ar}else rr.add(Ke);break e}else{if((y&1)===0){AI(ne,pt,y),Gj();break e}Ke=Error(r(426))}}else if(_t&&Fe.mode&1){var Wi=TI(ge);if(Wi!==null){(Wi.flags&65536)===0&&(Wi.flags|=256),PI(Wi,ge,Fe,ne,y),Ut(Cg(Ke,Fe));break e}}ne=Ke=Cg(Ke,Fe),lo!==4&&(lo=2),py===null?py=[ne]:py.push(ne),ne=ge;do{switch(ne.tag){case 3:ne.flags|=65536,y&=-y,ne.lanes|=y;var ot=CI(ne,Ke,y);Pn(ne,ot);break e;case 1:Fe=Ke;var Je=ne.type,ut=ne.stateNode;if((ne.flags&128)===0&&(typeof Je.getDerivedStateFromError=="function"||ut!==null&&typeof ut.componentDidCatch=="function"&&(sf===null||!sf.has(ut)))){ne.flags|=65536,y&=-y,ne.lanes|=y;var Dt=EI(ne,Fe,y);Pn(ne,Dt);break e}}ne=ne.return}while(ne!==null)}sO(E)}catch(cr){y=cr,Ji===E&&E!==null&&(Ji=E=E.return);continue}break}while(!0)}function oO(){var g=x0.current;return x0.current=p0,g===null?p0:g}function Gj(){(lo===0||lo===3||lo===2)&&(lo=4),Co===null||(Cp&268435455)===0&&(b0&268435455)===0||uf(Co,Qo)}function C0(g,y){var E=nn;nn|=2;var B=oO();(Co!==g||Qo!==y)&&(Uu=null,Ap(g,y));do try{uJ();break}catch(J){iO(g,J)}while(!0);if(tn(),nn=E,x0.current=B,Ji!==null)throw Error(r(261));return Co=null,Qo=0,lo}function uJ(){for(;Ji!==null;)aO(Ji)}function dJ(){for(;Ji!==null&&!el();)aO(Ji)}function aO(g){var y=uO(g.alternate,g,Rs);g.memoizedProps=g.pendingProps,y===null?sO(g):Ji=y,Dj.current=null}function sO(g){var y=g;do{var E=y.alternate;if(g=y.return,(y.flags&32768)===0){if(E=nJ(E,y,Rs),E!==null){Ji=E;return}}else{if(E=iJ(E,y),E!==null){E.flags&=32767,Ji=E;return}if(g!==null)g.flags|=32768,g.subtreeFlags=0,g.deletions=null;else{lo=6,Ji=null;return}}if(y=y.sibling,y!==null){Ji=y;return}Ji=y=g}while(y!==null);lo===0&&(lo=5)}function Tp(g,y,E){var B=zr,J=vl.transition;try{vl.transition=null,zr=1,fJ(g,y,E,B)}finally{vl.transition=J,zr=B}return null}function fJ(g,y,E,B){do Pg();while(lf!==null);if((nn&6)!==0)throw Error(r(327));E=g.finishedWork;var J=g.finishedLanes;if(E===null)return null;if(g.finishedWork=null,g.finishedLanes=0,E===g.current)throw Error(r(177));g.callbackNode=null,g.callbackPriority=0;var ne=E.lanes|E.childLanes;if(Wv(g,ne),g===Co&&(Ji=Co=null,Qo=0),(E.subtreeFlags&2064)===0&&(E.flags&2064)===0||S0||(S0=!0,dO(xr,function(){return Pg(),null})),ne=(E.flags&15990)!==0,(E.subtreeFlags&15990)!==0||ne){ne=vl.transition,vl.transition=null;var ge=zr;zr=1;var Fe=nn;nn|=4,Dj.current=null,aJ(g,E),XI(E,g),Mi(Mu),Dd=!!bp,Mu=bp=null,g.current=E,sJ(E),op(),nn=Fe,zr=ge,vl.transition=ne}else g.current=E;if(S0&&(S0=!1,lf=g,j0=J),ne=g.pendingLanes,ne===0&&(sf=null),gu(E.stateNode),is(g,jn()),y!==null)for(B=g.onRecoverableError,E=0;E<y.length;E++)J=y[E],B(J.value,{componentStack:J.stack,digest:J.digest});if(w0)throw w0=!1,g=qj,qj=null,g;return(j0&1)!==0&&g.tag!==0&&Pg(),ne=g.pendingLanes,(ne&1)!==0?g===$j?hy++:(hy=0,$j=g):hy=0,oe(),null}function Pg(){if(lf!==null){var g=sp(j0),y=vl.transition,E=zr;try{if(vl.transition=null,zr=16>g?16:g,lf===null)var B=!1;else{if(g=lf,lf=null,j0=0,(nn&6)!==0)throw Error(r(331));var J=nn;for(nn|=4,Zt=g.current;Zt!==null;){var ne=Zt,ge=ne.child;if((Zt.flags&16)!==0){var Fe=ne.deletions;if(Fe!==null){for(var Ke=0;Ke<Fe.length;Ke++){var pt=Fe[Ke];for(Zt=pt;Zt!==null;){var Lt=Zt;switch(Lt.tag){case 0:case 11:case 15:dy(8,Lt,ne)}var zt=Lt.child;if(zt!==null)zt.return=Lt,Zt=zt;else for(;Zt!==null;){Lt=Zt;var Rt=Lt.sibling,Yt=Lt.return;if(VI(Lt),Lt===pt){Zt=null;break}if(Rt!==null){Rt.return=Yt,Zt=Rt;break}Zt=Yt}}}var rr=ne.alternate;if(rr!==null){var ar=rr.child;if(ar!==null){rr.child=null;do{var Wi=ar.sibling;ar.sibling=null,ar=Wi}while(ar!==null)}}Zt=ne}}if((ne.subtreeFlags&2064)!==0&&ge!==null)ge.return=ne,Zt=ge;else e:for(;Zt!==null;){if(ne=Zt,(ne.flags&2048)!==0)switch(ne.tag){case 0:case 11:case 15:dy(9,ne,ne.return)}var ot=ne.sibling;if(ot!==null){ot.return=ne.return,Zt=ot;break e}Zt=ne.return}}var Je=g.current;for(Zt=Je;Zt!==null;){ge=Zt;var ut=ge.child;if((ge.subtreeFlags&2064)!==0&&ut!==null)ut.return=ge,Zt=ut;else e:for(ge=Je;Zt!==null;){if(Fe=Zt,(Fe.flags&2048)!==0)try{switch(Fe.tag){case 0:case 11:case 15:y0(9,Fe)}}catch(cr){Ti(Fe,Fe.return,cr)}if(Fe===ge){Zt=null;break e}var Dt=Fe.sibling;if(Dt!==null){Dt.return=Fe.return,Zt=Dt;break e}Zt=Fe.return}}if(nn=J,oe(),zn&&typeof zn.onPostCommitFiberRoot=="function")try{zn.onPostCommitFiberRoot(Wt,g)}catch{}B=!0}return B}finally{zr=E,vl.transition=y}}return!1}function lO(g,y,E){y=Cg(E,y),y=CI(g,y,1),g=mi(g,y,1),y=Ra(),g!==null&&(vu(g,1,y),is(g,y))}function Ti(g,y,E){if(g.tag===3)lO(g,g,E);else for(;y!==null;){if(y.tag===3){lO(y,g,E);break}else if(y.tag===1){var B=y.stateNode;if(typeof y.type.getDerivedStateFromError=="function"||typeof B.componentDidCatch=="function"&&(sf===null||!sf.has(B))){g=Cg(E,g),g=EI(y,g,1),y=mi(y,g,1),g=Ra(),y!==null&&(vu(y,1,g),is(y,g));break}}y=y.return}}function pJ(g,y,E){var B=g.pingCache;B!==null&&B.delete(y),y=Ra(),g.pingedLanes|=g.suspendedLanes&E,Co===g&&(Qo&E)===E&&(lo===4||lo===3&&(Qo&130023424)===Qo&&500>jn()-Wj?Ap(g,0):Bj|=E),is(g,y)}function cO(g,y){y===0&&((g.mode&1)===0?y=1:(y=Ea,Ea<<=1,(Ea&130023424)===0&&(Ea=4194304)));var E=Ra();g=Tn(g,y),g!==null&&(vu(g,y,E),is(g,E))}function hJ(g){var y=g.memoizedState,E=0;y!==null&&(E=y.retryLane),cO(g,E)}function gJ(g,y){var E=0;switch(g.tag){case 13:var B=g.stateNode,J=g.memoizedState;J!==null&&(E=J.retryLane);break;case 19:B=g.stateNode;break;default:throw Error(r(314))}B!==null&&B.delete(y),cO(g,E)}var uO;uO=function(g,y,E){if(g!==null)if(g.memoizedProps!==y.pendingProps||oa.current)rs=!0;else{if((g.lanes&E)===0&&(y.flags&128)===0)return rs=!1,rJ(g,y,E);rs=(g.flags&131072)!==0}else rs=!1,_t&&(y.flags&1048576)!==0&&nt(y,we,y.index);switch(y.lanes=0,y.tag){case 2:var B=y.type;m0(g,y),g=y.pendingProps;var J=ef(y,ao.current);ci(y,E),J=jp(null,y,B,g,J,E);var ne=ml();return y.flags|=1,typeof J=="object"&&J!==null&&typeof J.render=="function"&&J.$$typeof===void 0?(y.tag=1,y.memoizedState=null,y.updateQueue=null,aa(B)?(ne=!0,Wu(y)):ne=!1,y.memoizedState=J.state!==null&&J.state!==void 0?J.state:null,so(y),J.updater=h0,y.stateNode=J,J._reactInternals=y,_j(y,B,g,E),y=Tj(null,y,B,!0,ne,E)):(y.tag=0,_t&&ne&&bt(y),Na(null,y,J,E),y=y.child),y;case 16:B=y.elementType;e:{switch(m0(g,y),g=y.pendingProps,J=B._init,B=J(B._payload),y.type=B,J=y.tag=vJ(B),g=Kl(B,g),J){case 0:y=Aj(null,y,B,g,E);break e;case 1:y=FI(null,y,B,g,E);break e;case 11:y=II(null,y,B,g,E);break e;case 14:y=OI(null,y,B,Kl(B.type,g),E);break e}throw Error(r(306,B,""))}return y;case 0:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),Aj(g,y,B,J,E);case 1:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),FI(g,y,B,J,E);case 3:e:{if(zI(y),g===null)throw Error(r(387));B=y.pendingProps,ne=y.memoizedState,J=ne.element,sa(g,y),_o(y,B,null,E);var ge=y.memoizedState;if(B=ge.element,ne.isDehydrated)if(ne={element:B,isDehydrated:!1,cache:ge.cache,pendingSuspenseBoundaries:ge.pendingSuspenseBoundaries,transitions:ge.transitions},y.updateQueue.baseState=ne,y.memoizedState=ne,y.flags&256){J=Cg(Error(r(423)),y),y=MI(g,y,B,E,J);break e}else if(B!==J){J=Cg(Error(r(424)),y),y=MI(g,y,B,E,J);break e}else for(yt=Go(y.stateNode.containerInfo.firstChild),gt=y,_t=!0,At=null,E=ni(y,null,B,E),y.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(Qt(),B===J){y=$u(g,y,E);break e}Na(g,y,B,E)}y=y.child}return y;case 5:return l0(y),g===null&&er(y),B=y.type,J=y.pendingProps,ne=g!==null?g.memoizedProps:null,ge=J.children,ey(B,J)?ge=null:ne!==null&&ey(B,ne)&&(y.flags|=32),LI(g,y),Na(g,y,ge,E),y.child;case 6:return g===null&&er(y),null;case 13:return DI(g,y,E);case 4:return tf(y,y.stateNode.containerInfo),B=y.pendingProps,g===null?y.child=Ci(y,null,B,E):Na(g,y,B,E),y.child;case 11:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),II(g,y,B,J,E);case 7:return Na(g,y,y.pendingProps,E),y.child;case 8:return Na(g,y,y.pendingProps.children,E),y.child;case 12:return Na(g,y,y.pendingProps.children,E),y.child;case 10:e:{if(B=y.type._context,J=y.pendingProps,ne=y.memoizedProps,ge=J.value,mn(Di,B._currentValue),B._currentValue=ge,ne!==null)if(Ki(ne.value,ge)){if(ne.children===J.children&&!oa.current){y=$u(g,y,E);break e}}else for(ne=y.child,ne!==null&&(ne.return=y);ne!==null;){var Fe=ne.dependencies;if(Fe!==null){ge=ne.child;for(var Ke=Fe.firstContext;Ke!==null;){if(Ke.context===B){if(ne.tag===1){Ke=gi(-1,E&-E),Ke.tag=2;var pt=ne.updateQueue;if(pt!==null){pt=pt.shared;var Lt=pt.pending;Lt===null?Ke.next=Ke:(Ke.next=Lt.next,Lt.next=Ke),pt.pending=Ke}}ne.lanes|=E,Ke=ne.alternate,Ke!==null&&(Ke.lanes|=E),rn(ne.return,E,y),Fe.lanes|=E;break}Ke=Ke.next}}else if(ne.tag===10)ge=ne.type===y.type?null:ne.child;else if(ne.tag===18){if(ge=ne.return,ge===null)throw Error(r(341));ge.lanes|=E,Fe=ge.alternate,Fe!==null&&(Fe.lanes|=E),rn(ge,E,y),ge=ne.sibling}else ge=ne.child;if(ge!==null)ge.return=ne;else for(ge=ne;ge!==null;){if(ge===y){ge=null;break}if(ne=ge.sibling,ne!==null){ne.return=ge.return,ge=ne;break}ge=ge.return}ne=ge}Na(g,y,J.children,E),y=y.child}return y;case 9:return J=y.type,B=y.pendingProps.children,ci(y,E),J=ui(J),B=B(J),y.flags|=1,Na(g,y,B,E),y.child;case 14:return B=y.type,J=Kl(B,y.pendingProps),J=Kl(B.type,J),OI(g,y,B,J,E);case 15:return NI(g,y,y.type,y.pendingProps,E);case 17:return B=y.type,J=y.pendingProps,J=y.elementType===B?J:Kl(B,J),m0(g,y),y.tag=1,aa(B)?(g=!0,Wu(y)):g=!1,ci(y,E),kI(y,B,J),_j(y,B,J,E),Tj(null,y,B,!0,g,E);case 19:return WI(g,y,E);case 22:return RI(g,y,E)}throw Error(r(156,y.tag))};function dO(g,y){return Ca(g,y)}function mJ(g,y,E,B){this.tag=g,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=y,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=B,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yl(g,y,E,B){return new mJ(g,y,E,B)}function Kj(g){return g=g.prototype,!(!g||!g.isReactComponent)}function vJ(g){if(typeof g=="function")return Kj(g)?1:0;if(g!=null){if(g=g.$$typeof,g===I)return 11;if(g===M)return 14}return 2}function df(g,y){var E=g.alternate;return E===null?(E=yl(g.tag,y,g.key,g.mode),E.elementType=g.elementType,E.type=g.type,E.stateNode=g.stateNode,E.alternate=g,g.alternate=E):(E.pendingProps=y,E.type=g.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=g.flags&14680064,E.childLanes=g.childLanes,E.lanes=g.lanes,E.child=g.child,E.memoizedProps=g.memoizedProps,E.memoizedState=g.memoizedState,E.updateQueue=g.updateQueue,y=g.dependencies,E.dependencies=y===null?null:{lanes:y.lanes,firstContext:y.firstContext},E.sibling=g.sibling,E.index=g.index,E.ref=g.ref,E}function E0(g,y,E,B,J,ne){var ge=2;if(B=g,typeof g=="function")Kj(g)&&(ge=1);else if(typeof g=="string")ge=5;else e:switch(g){case A:return Pp(E.children,J,ne,y);case P:ge=8,J|=8;break;case N:return g=yl(12,E,y,J|2),g.elementType=N,g.lanes=ne,g;case R:return g=yl(13,E,y,J),g.elementType=R,g.lanes=ne,g;case F:return g=yl(19,E,y,J),g.elementType=F,g.lanes=ne,g;case X:return A0(E,J,ne,y);default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case O:ge=10;break e;case C:ge=9;break e;case I:ge=11;break e;case M:ge=14;break e;case Y:ge=16,B=null;break e}throw Error(r(130,g==null?g:typeof g,""))}return y=yl(ge,E,y,J),y.elementType=g,y.type=B,y.lanes=ne,y}function Pp(g,y,E,B){return g=yl(7,g,B,y),g.lanes=E,g}function A0(g,y,E,B){return g=yl(22,g,B,y),g.elementType=X,g.lanes=E,g.stateNode={isHidden:!1},g}function Qj(g,y,E){return g=yl(6,g,null,y),g.lanes=E,g}function Xj(g,y,E){return y=yl(4,g.children!==null?g.children:[],g.key,y),y.lanes=E,y.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},y}function yJ(g,y,E,B,J){this.tag=y,this.containerInfo=g,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zd(0),this.expirationTimes=zd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zd(0),this.identifierPrefix=B,this.onRecoverableError=J,this.mutableSourceEagerHydrationData=null}function Zj(g,y,E,B,J,ne,ge,Fe,Ke){return g=new yJ(g,y,E,Fe,Ke),y===1?(y=1,ne===!0&&(y|=8)):y=0,ne=yl(3,null,null,y),g.current=ne,ne.stateNode=g,ne.memoizedState={element:B,isDehydrated:E,cache:null,transitions:null,pendingSuspenseBoundaries:null},so(ne),g}function xJ(g,y,E){var B=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:B==null?null:""+B,children:g,containerInfo:y,implementation:E}}function fO(g){if(!g)return zc;g=g._reactInternals;e:{if(Fn(g)!==g||g.tag!==1)throw Error(r(170));var y=g;do{switch(y.tag){case 3:y=y.stateNode.context;break e;case 1:if(aa(y.type)){y=y.stateNode.__reactInternalMemoizedMergedChildContext;break e}}y=y.return}while(y!==null);throw Error(r(171))}if(g.tag===1){var E=g.type;if(aa(E))return iy(g,E,y)}return y}function pO(g,y,E,B,J,ne,ge,Fe,Ke){return g=Zj(E,B,!0,g,J,ne,ge,Fe,Ke),g.context=fO(null),E=g.current,B=Ra(),J=cf(E),ne=gi(B,J),ne.callback=y??null,mi(E,ne,J),g.current.lanes=J,vu(g,J,B),is(g,B),g}function T0(g,y,E,B){var J=y.current,ne=Ra(),ge=cf(J);return E=fO(E),y.context===null?y.context=E:y.pendingContext=E,y=gi(ne,ge),y.payload={element:g},B=B===void 0?null:B,B!==null&&(y.callback=B),g=mi(J,y,ge),g!==null&&(Zl(g,J,ge,ne),ko(g,J,ge)),ge}function P0(g){if(g=g.current,!g.child)return null;switch(g.child.tag){case 5:return g.child.stateNode;default:return g.child.stateNode}}function hO(g,y){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var E=g.retryLane;g.retryLane=E!==0&&E<y?E:y}}function Jj(g,y){hO(g,y),(g=g.alternate)&&hO(g,y)}function bJ(){return null}var gO=typeof reportError=="function"?reportError:function(g){console.error(g)};function e5(g){this._internalRoot=g}I0.prototype.render=e5.prototype.render=function(g){var y=this._internalRoot;if(y===null)throw Error(r(409));T0(g,y,null,null)},I0.prototype.unmount=e5.prototype.unmount=function(){var g=this._internalRoot;if(g!==null){this._internalRoot=null;var y=g.containerInfo;Ep(function(){T0(null,g,null,null)}),y[So]=null}};function I0(g){this._internalRoot=g}I0.prototype.unstable_scheduleHydration=function(g){if(g){var y=ig();g={blockedOn:null,target:g,priority:y};for(var E=0;E<ol.length&&y!==0&&y<ol[E].priority;E++);ol.splice(E,0,g),E===0&&al(g)}};function t5(g){return!(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)}function O0(g){return!(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11&&(g.nodeType!==8||g.nodeValue!==" react-mount-point-unstable "))}function mO(){}function wJ(g,y,E,B,J){if(J){if(typeof B=="function"){var ne=B;B=function(){var pt=P0(ge);ne.call(pt)}}var ge=pO(y,B,g,0,null,!1,!1,"",mO);return g._reactRootContainer=ge,g[So]=ge.current,Fu(g.nodeType===8?g.parentNode:g),Ep(),ge}for(;J=g.lastChild;)g.removeChild(J);if(typeof B=="function"){var Fe=B;B=function(){var pt=P0(Ke);Fe.call(pt)}}var Ke=Zj(g,0,!1,null,null,!1,!1,"",mO);return g._reactRootContainer=Ke,g[So]=Ke.current,Fu(g.nodeType===8?g.parentNode:g),Ep(function(){T0(y,Ke,E,B)}),Ke}function N0(g,y,E,B,J){var ne=E._reactRootContainer;if(ne){var ge=ne;if(typeof J=="function"){var Fe=J;J=function(){var Ke=P0(ge);Fe.call(Ke)}}T0(y,ge,g,J)}else ge=wJ(E,y,g,J,B);return P0(ge)}yu=function(g){switch(g.tag){case 3:var y=g.stateNode;if(y.current.memoizedState.isDehydrated){var E=nl(y.pendingLanes);E!==0&&(ap(y,E|1),is(y,jn()),(nn&6)===0&&(Tg=jn()+500,oe()))}break;case 13:Ep(function(){var B=Tn(g,1);if(B!==null){var J=Ra();Zl(B,g,1,J)}}),Jj(g,1)}},Cc=function(g){if(g.tag===13){var y=Tn(g,134217728);if(y!==null){var E=Ra();Zl(y,g,134217728,E)}Jj(g,134217728)}},Md=function(g){if(g.tag===13){var y=cf(g),E=Tn(g,y);if(E!==null){var B=Ra();Zl(E,g,y,B)}Jj(g,y)}},ig=function(){return zr},og=function(g,y){var E=zr;try{return zr=g,y()}finally{zr=E}},Be=function(g,y,E){switch(y){case"input":if(De(g,E),y=E.name,E.type==="radio"&&y!=null){for(E=g;E.parentNode;)E=E.parentNode;for(E=E.querySelectorAll("input[name="+JSON.stringify(""+y)+'][type="radio"]'),y=0;y<E.length;y++){var B=E[y];if(B!==g&&B.form===g.form){var J=wp(B);if(!J)throw Error(r(90));le(B),De(B,J)}}}break;case"textarea":Ae(g,E);break;case"select":y=E.value,y!=null&&Se(g,!!E.multiple,y,!1)}},je=Vj,xe=Ep;var SJ={usingClientEntryPoint:!1,Events:[Jd,Du,wp,ce,he,Vj]},gy={findFiberByHostInstance:Fc,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jJ={bundleType:gy.bundleType,version:gy.version,rendererPackageName:gy.rendererPackageName,rendererConfig:gy.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:j.ReactCurrentDispatcher,findHostInstanceByFiber:function(g){return g=Yi(g),g===null?null:g.stateNode},findFiberByHostInstance:gy.findFiberByHostInstance||bJ,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var R0=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!R0.isDisabled&&R0.supportsFiber)try{Wt=R0.inject(jJ),zn=R0}catch{}}return os.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=SJ,os.createPortal=function(g,y){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t5(y))throw Error(r(200));return xJ(g,y,null,E)},os.createRoot=function(g,y){if(!t5(g))throw Error(r(299));var E=!1,B="",J=gO;return y!=null&&(y.unstable_strictMode===!0&&(E=!0),y.identifierPrefix!==void 0&&(B=y.identifierPrefix),y.onRecoverableError!==void 0&&(J=y.onRecoverableError)),y=Zj(g,1,!1,null,null,E,!1,B,J),g[So]=y.current,Fu(g.nodeType===8?g.parentNode:g),new e5(y)},os.findDOMNode=function(g){if(g==null)return null;if(g.nodeType===1)return g;var y=g._reactInternals;if(y===void 0)throw typeof g.render=="function"?Error(r(188)):(g=Object.keys(g).join(","),Error(r(268,g)));return g=Yi(y),g=g===null?null:g.stateNode,g},os.flushSync=function(g){return Ep(g)},os.hydrate=function(g,y,E){if(!O0(y))throw Error(r(200));return N0(null,g,y,!0,E)},os.hydrateRoot=function(g,y,E){if(!t5(g))throw Error(r(405));var B=E!=null&&E.hydratedSources||null,J=!1,ne="",ge=gO;if(E!=null&&(E.unstable_strictMode===!0&&(J=!0),E.identifierPrefix!==void 0&&(ne=E.identifierPrefix),E.onRecoverableError!==void 0&&(ge=E.onRecoverableError)),y=pO(y,null,g,1,E??null,J,!1,ne,ge),g[So]=y.current,Fu(g),B)for(g=0;g<B.length;g++)E=B[g],J=E._getVersion,J=J(E._source),y.mutableSourceEagerHydrationData==null?y.mutableSourceEagerHydrationData=[E,J]:y.mutableSourceEagerHydrationData.push(E,J);return new I0(y)},os.render=function(g,y,E){if(!O0(y))throw Error(r(200));return N0(null,g,y,!1,E)},os.unmountComponentAtNode=function(g){if(!O0(g))throw Error(r(40));return g._reactRootContainer?(Ep(function(){N0(null,null,g,!1,function(){g._reactRootContainer=null,g[So]=null})}),!0):!1},os.unstable_batchedUpdates=Vj,os.unstable_renderSubtreeIntoContainer=function(g,y,E,B){if(!O0(E))throw Error(r(200));if(g==null||g._reactInternals===void 0)throw Error(r(38));return N0(g,y,E,!1,B)},os.version="18.3.1-next-f1338f8080-20240426",os}var kO;function nT(){if(kO)return i5.exports;kO=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),i5.exports=NJ(),i5.exports}var _O;function RJ(){if(_O)return F0;_O=1;var e=nT();return F0.createRoot=e.createRoot,F0.hydrateRoot=e.hydrateRoot,F0}var Hq=RJ(),S=Qw();const $e=dn(S),Vq=EJ({__proto__:null,default:$e},[S]);var iT=nT();const LJ=dn(iT);/**
* @remix-run/router v1.23.2
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function xx(){return xx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xx.apply(this,arguments)}var Ef;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Ef||(Ef={}));const CO="popstate";function FJ(e){e===void 0&&(e={});function t(n,o){let{pathname:a,search:s,hash:l}=n.location;return S3("",{pathname:a,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(n,o){return typeof o=="string"?o:J1(o)}return MJ(t,r,null,e)}function xi(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function oT(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function zJ(){return Math.random().toString(36).substr(2,8)}function EO(e,t){return{usr:e.state,key:e.key,idx:t}}function S3(e,t,r,n){return r===void 0&&(r=null),xx({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?mv(t):t,{state:r,key:t&&t.key||n||zJ()})}function J1(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function mv(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function MJ(e,t,r,n){n===void 0&&(n={});let{window:o=document.defaultView,v5Compat:a=!1}=n,s=o.history,l=Ef.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(xx({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=Ef.Pop;let b=d(),x=b==null?null:b-u;u=b,c&&c({action:l,location:m.location,delta:x})}function h(b,x){l=Ef.Push;let w=S3(m.location,b,x);u=d()+1;let k=EO(w,u),j=m.createHref(w);try{s.pushState(k,"",j)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;o.location.assign(j)}a&&c&&c({action:l,location:m.location,delta:1})}function p(b,x){l=Ef.Replace;let w=S3(m.location,b,x);u=d();let k=EO(w,u),j=m.createHref(w);s.replaceState(k,"",j),a&&c&&c({action:l,location:m.location,delta:0})}function v(b){let x=o.location.origin!=="null"?o.location.origin:o.location.href,w=typeof b=="string"?b:J1(b);return w=w.replace(/ $/,"%20"),xi(x,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,x)}let m={get action(){return l},get location(){return e(o,s)},listen(b){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(CO,f),c=b,()=>{o.removeEventListener(CO,f),c=null}},createHref(b){return t(o,b)},createURL:v,encodeLocation(b){let x=v(b);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:h,replace:p,go(b){return s.go(b)}};return m}var AO;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(AO||(AO={}));function DJ(e,t,r){return r===void 0&&(r="/"),BJ(e,t,r)}function BJ(e,t,r,n){let o=typeof t=="string"?mv(t):t,a=Pm(o.pathname||"/",r);if(a==null)return null;let s=Yq(e);WJ(s);let l=null;for(let c=0;l==null&&c<s.length;++c){let u=ZJ(a);l=QJ(s[c],u)}return l}function Yq(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let o=(a,s,l)=>{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};c.relativePath.startsWith("/")&&(xi(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Rf([n,c.relativePath]),d=r.concat(c);a.children&&a.children.length>0&&(xi(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Yq(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:GJ(u,a.index),routesMeta:d})};return e.forEach((a,s)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))o(a,s);else for(let c of Gq(a.path))o(a,s,c)}),t}function Gq(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return o?[a,""]:[a];let s=Gq(n.join("/")),l=[];return l.push(...s.map(c=>c===""?a:[a,c].join("/"))),o&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function WJ(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:KJ(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const qJ=/^:[\w-]+$/,$J=3,UJ=2,HJ=1,VJ=10,YJ=-2,TO=e=>e==="*";function GJ(e,t){let r=e.split("/"),n=r.length;return r.some(TO)&&(n+=YJ),t&&(n+=UJ),r.filter(o=>!TO(o)).reduce((o,a)=>o+(qJ.test(a)?$J:a===""?HJ:VJ),n)}function KJ(e,t){return e.length===t.length&&e.slice(0,-1).every((n,o)=>n===t[o])?e[e.length-1]-t[t.length-1]:0}function QJ(e,t,r){let{routesMeta:n}=e,o={},a="/",s=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=a==="/"?t:t.slice(a.length)||"/",f=j3({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),h=c.route;if(!f)return null;Object.assign(o,f.params),s.push({params:o,pathname:Rf([a,f.pathname]),pathnameBase:nee(Rf([a,f.pathnameBase])),route:h}),f.pathnameBase!=="/"&&(a=Rf([a,f.pathnameBase]))}return s}function j3(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=XJ(e.path,e.caseSensitive,e.end),o=t.match(r);if(!o)return null;let a=o[0],s=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:n.reduce((u,d,f)=>{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";s=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const v=l[f];return p&&!v?u[h]=void 0:u[h]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:s,pattern:e}}function XJ(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),oT(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),n]}function ZJ(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return oT(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Pm(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const JJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eee=e=>JJ.test(e);function tee(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:o=""}=typeof e=="string"?mv(e):e,a;if(r)if(eee(r))a=r;else{if(r.includes("//")){let s=r;r=r.replace(/\/\/+/g,"/"),oT(!1,"Pathnames cannot have embedded double slashes - normalizing "+(s+" -> "+r))}r.startsWith("/")?a=PO(r.substring(1),"/"):a=PO(r,t)}else a=t;return{pathname:a,search:iee(n),hash:oee(o)}}function PO(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function s5(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function ree(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function aT(e,t){let r=ree(e);return t?r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function sT(e,t,r,n){n===void 0&&(n=!1);let o;typeof e=="string"?o=mv(e):(o=xx({},e),xi(!o.pathname||!o.pathname.includes("?"),s5("?","pathname","search",o)),xi(!o.pathname||!o.pathname.includes("#"),s5("#","pathname","hash",o)),xi(!o.search||!o.search.includes("#"),s5("#","search","hash",o)));let a=e===""||o.pathname==="",s=a?"/":o.pathname,l;if(s==null)l=r;else{let f=t.length-1;if(!n&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;o.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=tee(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(a||s===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const Rf=e=>e.join("/").replace(/\/\/+/g,"/"),nee=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),iee=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,oee=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function aee(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Kq=["post","put","patch","delete"];new Set(Kq);const see=["get",...Kq];new Set(see);/**
* React Router v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function bx(){return bx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bx.apply(this,arguments)}const Xw=S.createContext(null),Qq=S.createContext(null),_d=S.createContext(null),Zw=S.createContext(null),uu=S.createContext({outlet:null,matches:[],isDataRoute:!1}),Xq=S.createContext(null);function lee(e,t){let{relative:r}=t===void 0?{}:t;vv()||xi(!1);let{basename:n,navigator:o}=S.useContext(_d),{hash:a,pathname:s,search:l}=eS(e,{relative:r}),c=s;return n!=="/"&&(c=s==="/"?n:Rf([n,s])),o.createHref({pathname:c,search:l,hash:a})}function vv(){return S.useContext(Zw)!=null}function Cd(){return vv()||xi(!1),S.useContext(Zw).location}function Zq(e){S.useContext(_d).static||S.useLayoutEffect(e)}function Ed(){let{isDataRoute:e}=S.useContext(uu);return e?jee():cee()}function cee(){vv()||xi(!1);let e=S.useContext(Xw),{basename:t,future:r,navigator:n}=S.useContext(_d),{matches:o}=S.useContext(uu),{pathname:a}=Cd(),s=JSON.stringify(aT(o,r.v7_relativeSplatPath)),l=S.useRef(!1);return Zq(()=>{l.current=!0}),S.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let f=sT(u,JSON.parse(s),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Rf([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,s,a,e])}const uee=S.createContext(null);function dee(e){let t=S.useContext(uu).outlet;return t&&S.createElement(uee.Provider,{value:e},t)}function Jw(){let{matches:e}=S.useContext(uu),t=e[e.length-1];return t?t.params:{}}function eS(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=S.useContext(_d),{matches:o}=S.useContext(uu),{pathname:a}=Cd(),s=JSON.stringify(aT(o,n.v7_relativeSplatPath));return S.useMemo(()=>sT(e,JSON.parse(s),a,r==="path"),[e,s,a,r])}function fee(e,t){return pee(e,t)}function pee(e,t,r,n){vv()||xi(!1);let{navigator:o}=S.useContext(_d),{matches:a}=S.useContext(uu),s=a[a.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=Cd(),d;if(t){var f;let b=typeof t=="string"?mv(t):t;c==="/"||(f=b.pathname)!=null&&f.startsWith(c)||xi(!1),d=b}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let b=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(b.length).join("/")}let v=DJ(e,{pathname:p}),m=yee(v&&v.map(b=>Object.assign({},b,{params:Object.assign({},l,b.params),pathname:Rf([c,o.encodeLocation?o.encodeLocation(b.pathname).pathname:b.pathname]),pathnameBase:b.pathnameBase==="/"?c:Rf([c,o.encodeLocation?o.encodeLocation(b.pathnameBase).pathname:b.pathnameBase])})),a,r,n);return t&&m?S.createElement(Zw.Provider,{value:{location:bx({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ef.Pop}},m):m}function hee(){let e=See(),t=aee(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},t),r?S.createElement("pre",{style:o},r):null,null)}const gee=S.createElement(hee,null);class mee extends S.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?S.createElement(uu.Provider,{value:this.props.routeContext},S.createElement(Xq.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function vee(e){let{routeContext:t,match:r,children:n}=e,o=S.useContext(Xw);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),S.createElement(uu.Provider,{value:t},n)}function yee(e,t,r,n){var o;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var a;if(!r)return null;if(r.errors)e=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,l=(o=r)==null?void 0:o.errors;if(l!=null){let d=s.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||xi(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:p}=r,v=f.route.loader&&h[f.route.id]===void 0&&(!p||p[f.route.id]===void 0);if(f.route.lazy||v){c=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let p,v=!1,m=null,b=null;r&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||gee,c&&(u<0&&h===0?(kee("route-fallback"),v=!0,b=null):u===h&&(v=!0,b=f.route.hydrateFallbackElement||null)));let x=t.concat(s.slice(0,h+1)),w=()=>{let k;return p?k=m:v?k=b:f.route.Component?k=S.createElement(f.route.Component,null):f.route.element?k=f.route.element:k=d,S.createElement(vee,{match:f,routeContext:{outlet:d,matches:x,isDataRoute:r!=null},children:k})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?S.createElement(mee,{location:r.location,revalidation:r.revalidation,component:m,error:p,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):w()},null)}var Jq=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Jq||{}),e$=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(e$||{});function xee(e){let t=S.useContext(Xw);return t||xi(!1),t}function bee(e){let t=S.useContext(Qq);return t||xi(!1),t}function wee(e){let t=S.useContext(uu);return t||xi(!1),t}function t$(e){let t=wee(),r=t.matches[t.matches.length-1];return r.route.id||xi(!1),r.route.id}function See(){var e;let t=S.useContext(Xq),r=bee(),n=t$();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function jee(){let{router:e}=xee(Jq.UseNavigateStable),t=t$(e$.UseNavigateStable),r=S.useRef(!1);return Zq(()=>{r.current=!0}),S.useCallback(function(o,a){a===void 0&&(a={}),r.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,bx({fromRouteId:t},a)))},[e,t])}const IO={};function kee(e,t,r){IO[e]||(IO[e]=!0)}function _ee(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function gh(e){let{to:t,replace:r,state:n,relative:o}=e;vv()||xi(!1);let{future:a,static:s}=S.useContext(_d),{matches:l}=S.useContext(uu),{pathname:c}=Cd(),u=Ed(),d=sT(t,aT(l,a.v7_relativeSplatPath),c,o==="path"),f=JSON.stringify(d);return S.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:o}),[u,f,o,r,n]),null}function r$(e){return dee(e.context)}function za(e){xi(!1)}function Cee(e){let{basename:t="/",children:r=null,location:n,navigationType:o=Ef.Pop,navigator:a,static:s=!1,future:l}=e;vv()&&xi(!1);let c=t.replace(/^\/*/,"/"),u=S.useMemo(()=>({basename:c,navigator:a,static:s,future:bx({v7_relativeSplatPath:!1},l)}),[c,l,a,s]);typeof n=="string"&&(n=mv(n));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:v="default"}=n,m=S.useMemo(()=>{let b=Pm(d,c);return b==null?null:{location:{pathname:b,search:f,hash:h,state:p,key:v},navigationType:o}},[c,d,f,h,p,v,o]);return m==null?null:S.createElement(_d.Provider,{value:u},S.createElement(Zw.Provider,{children:r,value:m}))}function Eee(e){let{children:t,location:r}=e;return fee(k3(t),r)}new Promise(()=>{});function k3(e,t){t===void 0&&(t=[]);let r=[];return S.Children.forEach(e,(n,o)=>{if(!S.isValidElement(n))return;let a=[...t,o];if(n.type===S.Fragment){r.push.apply(r,k3(n.props.children,a));return}n.type!==za&&xi(!1),!n.props.index||!n.props.children||xi(!1);let s={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=k3(n.props.children,a)),r.push(s)}),r}/**
* React Router DOM v6.30.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function e2(){return e2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e2.apply(this,arguments)}function n$(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function Aee(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tee(e,t){return e.button===0&&(!t||t==="_self")&&!Aee(e)}function _3(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(o=>[r,o]):[[r,n]])},[]))}function Pee(e,t){let r=_3(e);return t&&t.forEach((n,o)=>{r.has(o)||t.getAll(o).forEach(a=>{r.append(o,a)})}),r}const Iee=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Oee=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Nee="6";try{window.__reactRouterVersion=Nee}catch{}const Ree=S.createContext({isTransitioning:!1}),Lee="startTransition",OO=Vq[Lee];function Fee(e){let{basename:t,children:r,future:n,window:o}=e,a=S.useRef();a.current==null&&(a.current=FJ({window:o,v5Compat:!0}));let s=a.current,[l,c]=S.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},d=S.useCallback(f=>{u&&OO?OO(()=>c(f)):c(f)},[c,u]);return S.useLayoutEffect(()=>s.listen(d),[s,d]),S.useEffect(()=>_ee(n),[n]),S.createElement(Cee,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}const zee=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Mee=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dee=S.forwardRef(function(t,r){let{onClick:n,relative:o,reloadDocument:a,replace:s,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,h=n$(t,Iee),{basename:p}=S.useContext(_d),v,m=!1;if(typeof u=="string"&&Mee.test(u)&&(v=u,zee))try{let k=new URL(window.location.href),j=u.startsWith("//")?new URL(k.protocol+u):new URL(u),_=Pm(j.pathname,p);j.origin===k.origin&&_!=null?u=_+j.search+j.hash:m=!0}catch{}let b=lee(u,{relative:o}),x=Wee(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:o,viewTransition:f});function w(k){n&&n(k),k.defaultPrevented||x(k)}return S.createElement("a",e2({},h,{href:v||b,onClick:m||a?n:w,ref:r,target:c}))}),NO=S.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:o=!1,className:a="",end:s=!1,style:l,to:c,viewTransition:u,children:d}=t,f=n$(t,Oee),h=eS(c,{relative:f.relative}),p=Cd(),v=S.useContext(Qq),{navigator:m,basename:b}=S.useContext(_d),x=v!=null&&qee(h)&&u===!0,w=m.encodeLocation?m.encodeLocation(h).pathname:h.pathname,k=p.pathname,j=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;o||(k=k.toLowerCase(),j=j?j.toLowerCase():null,w=w.toLowerCase()),j&&b&&(j=Pm(j,b)||j);const _=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let T=k===w||!s&&k.startsWith(w)&&k.charAt(_)==="/",A=j!=null&&(j===w||!s&&j.startsWith(w)&&j.charAt(w.length)==="/"),P={isActive:T,isPending:A,isTransitioning:x},N=T?n:void 0,O;typeof a=="function"?O=a(P):O=[a,T?"active":null,A?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let C=typeof l=="function"?l(P):l;return S.createElement(Dee,e2({},f,{"aria-current":N,className:O,ref:r,style:C,to:c,viewTransition:u}),typeof d=="function"?d(P):d)});var C3;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(C3||(C3={}));var RO;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(RO||(RO={}));function Bee(e){let t=S.useContext(Xw);return t||xi(!1),t}function Wee(e,t){let{target:r,replace:n,state:o,preventScrollReset:a,relative:s,viewTransition:l}=t===void 0?{}:t,c=Ed(),u=Cd(),d=eS(e,{relative:s});return S.useCallback(f=>{if(Tee(f,r)){f.preventDefault();let h=n!==void 0?n:J1(u)===J1(d);c(e,{replace:h,state:o,preventScrollReset:a,relative:s,viewTransition:l})}},[u,c,d,n,o,r,e,a,s,l])}function i$(e){let t=S.useRef(_3(e)),r=S.useRef(!1),n=Cd(),o=S.useMemo(()=>Pee(n.search,r.current?null:t.current),[n.search]),a=Ed(),s=S.useCallback((l,c)=>{const u=_3(typeof l=="function"?l(o):l);r.current=!0,a("?"+u,c)},[a,o]);return[o,s]}function qee(e,t){t===void 0&&(t={});let r=S.useContext(Ree);r==null&&xi(!1);let{basename:n}=Bee(C3.useViewTransitionState),o=eS(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=Pm(r.currentLocation.pathname,n)||r.currentLocation.pathname,s=Pm(r.nextLocation.pathname,n)||r.nextLocation.pathname;return j3(o.pathname,s)!=null||j3(o.pathname,a)!=null}const o$=S.createContext({theme:"light",setTheme:()=>{}});function $ee({children:e}){const[t,r]=S.useState(()=>{try{const o=localStorage.getItem("eb-theme");if(o==="dark"||o==="light")return o}catch{}return"light"}),n=o=>{r(o);try{localStorage.setItem("eb-theme",o)}catch{}};return S.useEffect(()=>{const o=document.documentElement;t==="dark"?o.classList.add("dark"):o.classList.remove("dark")},[t]),i.jsx(o$.Provider,{value:{theme:t,setTheme:n},children:e})}function a$(){return S.useContext(o$)}let t2=0;const E3=new Set;function s$(){E3.forEach(e=>e())}function Uee(e){return E3.add(e),()=>{E3.delete(e)}}function LO(){return t2>0}function l$(){t2+=1,s$()}function c$(){t2=Math.max(0,t2-1),s$()}const Hee=new Set(["POST","PUT","PATCH","DELETE"]);function u$(e){const t=(e||"GET").toUpperCase();return Hee.has(t)}const cd="https://api.eventbuzz.live/api",lT=cd,Im={access:"eventbuzz_access_token",refresh:"eventbuzz_refresh_token"};let Ol=null,ud=null;function d$(){try{const e=localStorage.getItem(Im.access),t=localStorage.getItem(Im.refresh);e&&t&&(Ol=e,ud=t)}catch{}}d$();function kf(e,t){Ol=e,ud=t;try{localStorage.setItem(Im.access,e),localStorage.setItem(Im.refresh,t)}catch{}}function f$(){Ol=null,ud=null;try{localStorage.removeItem(Im.access),localStorage.removeItem(Im.refresh)}catch{}}function Vee(){return Ol||(d$(),Ol)}function Yee(){return ud}async function p$(){var t;if(!ud)return!1;const e=lT.replace(/\/api\/?$/,"");try{const n=await(await fetch(`${e}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:ud})})).json();if(n.success&&((t=n.data)!=null&&t.token))return kf(n.data.token,ud),!0}catch{}return f$(),!1}async function Qg(e,t={}){var a;const{skipGlobalLoading:r,...n}=t,o=u$(n.method)&&!r;o&&l$();try{const s=e.startsWith("http")?e:`${lT}${e.startsWith("/")?e:`/${e}`}`,l={"Content-Type":"application/json",...typeof n.headers=="object"&&!(n.headers instanceof Headers)?n.headers:{}};Ol&&(l.Authorization=`Bearer ${Ol}`);let c=await fetch(s,{...n,headers:l});c.status===401&&ud&&await p$()&&(l.Authorization=`Bearer ${Ol}`,c=await fetch(s,{...n,headers:l}));let u;try{u=await c.json()}catch{return{error:c.statusText||"Network error",status:c.status}}const d=u;return d.success===!0&&"data"in d?{data:d.data,status:c.status}:{error:((a=d.error)==null?void 0:a.message)||(typeof d.error=="string"?d.error:c.statusText),status:c.status}}finally{o&&c$()}}const Ve={get:e=>Qg(e,{method:"GET"}),post:(e,t)=>Qg(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Qg(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>Qg(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>Qg(e,{method:"DELETE"})};async function wh(e,t={}){const{skipGlobalLoading:r,...n}=t,o=u$(n.method)&&!r;o&&l$();try{const a=e.startsWith("http")?e:`${lT}${e.startsWith("/")?e:`/${e}`}`,s={...typeof n.headers=="object"&&n.headers&&!(n.headers instanceof Headers)?n.headers:{}};Ol&&(s.Authorization=`Bearer ${Ol}`),typeof FormData<"u"&&n.body instanceof FormData&&(delete s["Content-Type"],delete s["content-type"]);let l=await fetch(a,{...n,headers:s});return l.status===401&&ud&&await p$()&&(s.Authorization=`Bearer ${Ol}`,l=await fetch(a,{...n,headers:s})),l}finally{o&&c$()}}const Ma={async register(e){const t=await Ve.post("/auth/register",e);return t.data&&kf(t.data.token,t.data.refreshToken),t},async login(e,t){const r=await Ve.post("/auth/login",{email:e,password:t}),n=r.data;return n&&"requiresTwoFactor"in n&&n.requiresTwoFactor||n&&"token"in n&&n.token&&"refreshToken"in n&&kf(n.token,n.refreshToken),r},async googleLogin(e){const t=await Ve.post("/auth/google",{idToken:e}),r=t.data;return r&&"requiresTwoFactor"in r&&r.requiresTwoFactor||r&&"token"in r&&r.token&&"refreshToken"in r&&kf(r.token,r.refreshToken),t},async googleRegister(e){var r;const t=await Ve.post("/auth/google/register",e);return(r=t.data)!=null&&r.token&&t.data.refreshToken&&kf(t.data.token,t.data.refreshToken),t},async completeLogin2fa(e,t){var n;const r=await Ve.post("/auth/login/2fa",{twoFactorToken:e,token:t});return(n=r.data)!=null&&n.token&&r.data.refreshToken&&kf(r.data.token,r.data.refreshToken),r},async refresh(){var r;const e=Yee();if(!e)return{error:"No refresh token",status:401};const t=await Ve.post("/auth/refresh",{refreshToken:e});return(r=t.data)!=null&&r.token&&kf(t.data.token,e),t},async me(){return Ve.get("/auth/me")},async updateMe(e){return Ve.put("/auth/me",e)},async changePassword(e,t){return Ve.post("/auth/change-password",{currentPassword:e,newPassword:t})},async setup2fa(){return Ve.post("/auth/2fa/setup",{})},async verify2faSetup(e){return Ve.post("/auth/2fa/verify-setup",{token:e})},async disable2fa(e,t){return Ve.post("/auth/2fa/disable",{currentPassword:e,token:t??""})},logout(){f$()}},Lr={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.type&&t.set("type",e.type),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit)),e!=null&&e.recordKind&&t.set("recordKind",e.recordKind),e!=null&&e.activitySubtype&&t.set("activitySubtype",e.activitySubtype),e!=null&&e.enrich&&t.set("enrich","1");const r=t.toString();return Ve.get(`/events${r?`?${r}`:""}`)},get(e){return Ve.get(`/events/${e}`)},create(e){return Ve.post("/events",e)},update(e,t){return Ve.put(`/events/${e}`,t)},remove(e){return Ve.delete(`/events/${e}`)},analytics(e){return Ve.get(`/events/${e}/analytics`)},duplicate(e){return Ve.post(`/events/${e}/duplicate`,{})},generateFromAi(e){return Ve.post("/events/generate-from-ai",e)},aiExtractPreview(e){return Ve.post("/events/ai-extract-preview",e)},emailerLinkTargets(e){return Ve.get(`/events/${e}/emailer-link-targets`)}},FO={leaderboard(e,t){const r=t!=null&&t>0?`?limit=${encodeURIComponent(String(t))}`:"";return Ve.get(`/events/${e}/leaderboard${r}`)},create(e,t){return Ve.post(`/events/${e}/reward-points`,{source:"manual",...t})}},ai={listAll(e){var n,o;const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),t.set("page",String((e==null?void 0:e.page)??1)),t.set("limit",String((e==null?void 0:e.limit)??20)),(n=e==null?void 0:e.q)!=null&&n.trim()&&t.set("q",e.q.trim()),(o=e==null?void 0:e.tag)!=null&&o.trim()&&t.set("tag",e.tag.trim());const r=t.toString();return Ve.get(`/participants${r?`?${r}`:""}`)},listDistinctTags(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Ve.get(`/participants/tags${r?`?${r}`:""}`)},matchingIds(e){var n,o;const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),(n=e==null?void 0:e.q)!=null&&n.trim()&&t.set("q",e.q.trim()),(o=e==null?void 0:e.tag)!=null&&o.trim()&&t.set("tag",e.tag.trim());const r=t.toString();return Ve.get(`/participants/matching-ids${r?`?${r}`:""}`)},bulk(e){return Ve.post("/participants/bulk",e)},list(e,t){var o,a;const r=new URLSearchParams;r.set("page",String((t==null?void 0:t.page)??1)),r.set("limit",String((t==null?void 0:t.limit)??20)),t!=null&&t.status&&r.set("status",t.status),(o=t==null?void 0:t.q)!=null&&o.trim()&&r.set("q",t.q.trim()),t!=null&&t.designation&&r.set("designation",t.designation),(a=t==null?void 0:t.tag)!=null&&a.trim()&&r.set("tag",t.tag.trim());const n=r.toString();return Ve.get(`/events/${e}/participants${n?`?${n}`:""}`)},listDistinctTagsForEvent(e){return Ve.get(`/events/${e}/participants/tags`)},matchingIdsForEvent(e,t){var o,a;const r=new URLSearchParams;(o=t==null?void 0:t.q)!=null&&o.trim()&&r.set("q",t.q.trim()),(a=t==null?void 0:t.tag)!=null&&a.trim()&&r.set("tag",t.tag.trim()),t!=null&&t.status&&r.set("status",t.status),t!=null&&t.designation&&r.set("designation",t.designation);const n=r.toString();return Ve.get(`/events/${e}/participants/matching-ids${n?`?${n}`:""}`)},get(e){return Ve.get(`/participants/${e}`)},create(e,t){return Ve.post(`/events/${e}/participants`,t)},update(e,t){return Ve.put(`/participants/${e}`,t)},remove(e,t){const r=new URLSearchParams({event_id:t});return Ve.delete(`/participants/${e}?${r.toString()}`)},deleteOne(e){return Ve.delete(`/participants/${e}`)},checkIn(e,t){const r=new URLSearchParams({event_id:t});return Ve.post(`/participants/${e}/check-in?${r.toString()}`,{})},async downloadExport(e,t="participants-export.csv"){var s;const r=await wh(`/events/${e}/participants/export`,{method:"GET"});if(!r.ok){let l=r.statusText;try{const c=await r.json();l=((s=c==null?void 0:c.error)==null?void 0:s.message)||l}catch{}return{ok:!1,error:l}}const n=await r.blob(),o=URL.createObjectURL(n),a=document.createElement("a");return a.href=o,a.download=t,a.click(),URL.revokeObjectURL(o),{ok:!0}},importCsv(e,t){return Ve.post(`/events/${e}/participants/import`,{csv:t})},async downloadExportAll(e,t="all-participants-export.csv"){var c,u,d;const r=new URLSearchParams;e!=null&&e.organization&&r.set("organization",e.organization),(c=e==null?void 0:e.q)!=null&&c.trim()&&r.set("q",e.q.trim()),(u=e==null?void 0:e.tag)!=null&&u.trim()&&r.set("tag",e.tag.trim());const n=r.toString(),o=await wh(`/participants/export${n?`?${n}`:""}`,{method:"GET"});if(!o.ok){let f=o.statusText;try{const h=await o.json();f=((d=h==null?void 0:h.error)==null?void 0:d.message)||f}catch{}return{ok:!1,error:f}}const a=await o.blob(),s=URL.createObjectURL(a),l=document.createElement("a");return l.href=s,l.download=t,l.click(),URL.revokeObjectURL(s),{ok:!0}},importGlobal(e){return Ve.post("/participants/import",e)}},Wc={list(e){return Ve.get(`/events/${e}/attendances`)},get(e,t){return Ve.get(`/events/${e}/attendances/${t}`)},create(e,t){return Ve.post(`/events/${e}/attendances`,t)},update(e,t,r){return Ve.put(`/events/${e}/attendances/${t}`,r)},remove(e,t){return Ve.delete(`/events/${e}/attendances/${t}`)},regenerateToken(e,t){return Ve.post(`/events/${e}/attendances/${t}/regenerate-token`,{})},listCheckIns(e,t,r){const n=new URLSearchParams;n.set("page",String((r==null?void 0:r.page)??1)),n.set("limit",String((r==null?void 0:r.limit)??20));const o=n.toString();return Ve.get(`/events/${e}/attendances/${t}/check-ins?${o}`)},searchParticipants(e,t,r){const n=new URLSearchParams;r!=null&&r.trim()&&n.set("q",r.trim());const o=n.toString();return Ve.get(`/events/${e}/attendances/${t}/search-participants${o?`?${o}`:""}`)},checkIn(e,t,r){return Ve.post(`/events/${e}/attendances/${t}/check-in`,{participantId:r})},async downloadExport(e,t,r="attendance-check-ins.csv"){var l;const n=await wh(`/events/${e}/attendances/${t}/export`,{method:"GET"});if(!n.ok){let c=n.statusText;try{const u=await n.json();c=((l=u==null?void 0:u.error)==null?void 0:l.message)||c}catch{}return{ok:!1,error:c}}const o=await n.blob(),a=URL.createObjectURL(o),s=document.createElement("a");return s.href=a,s.download=r,s.click(),URL.revokeObjectURL(a),{ok:!0}}};async function l5(e){var n;let t;try{t=await e.json()}catch{return{error:e.statusText||"Network error"}}const r=t;return r.success===!0&&r.data!==void 0?{data:r.data}:{error:((n=r.error)==null?void 0:n.message)||"Request failed"}}function c5(e){const t=cd.endsWith("/")?cd.slice(0,-1):cd,r=e.startsWith("/")?e:`/${e}`;return`${t}${r}`}const u5={async getSession(e){const t=await fetch(c5(`/public/attendance/${encodeURIComponent(e)}`));return l5(t)},async search(e,t){const r=new URLSearchParams;t!=null&&t.trim()&&r.set("q",t.trim());const n=r.toString(),o=await fetch(c5(`/public/attendance/${encodeURIComponent(e)}/search${n?`?${n}`:""}`));return l5(o)},async checkIn(e,t){const r=await fetch(c5(`/public/attendance/${encodeURIComponent(e)}/check-in`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({participantId:t})});return l5(r)}},qa={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Ve.get(`/participant-lists${r?`?${r}`:""}`)},create(e){return Ve.post("/participant-lists",e)},get(e){return Ve.get(`/participant-lists/${e}`)},update(e,t){return Ve.put(`/participant-lists/${e}`,t)},members(e,t){const r=new URLSearchParams;return t!=null&&t.organization&&r.set("organization",t.organization),r.set("page",String((t==null?void 0:t.page)??1)),r.set("limit",String((t==null?void 0:t.limit)??50)),Ve.get(`/participant-lists/${e}/members?${r}`)},remove(e){return Ve.delete(`/participant-lists/${e}`)}},Vs={list(e){const t=new URLSearchParams;e!=null&&e.type&&t.set("type",e.type),e!=null&&e.organization&&t.set("organization",e.organization),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit));const r=t.toString();return Ve.get(`/design-templates${r?`?${r}`:""}`)},get(e){return Ve.get(`/design-templates/${e}`)},create(e){return Ve.post("/design-templates",e)},update(e,t){return Ve.put(`/design-templates/${e}`,t)},remove(e){return Ve.delete(`/design-templates/${e}`)},duplicate(e){return Ve.post(`/design-templates/${e}/duplicate`,{})},useForEvent(e,t){return Ve.post(`/design-templates/${e}/use/${t}`,{})}},wx={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),e!=null&&e.event&&t.set("event",e.event),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit));const r=t.toString();return Ve.get(`/badge-batches${r?`?${r}`:""}`)},get(e,t){const r=new URLSearchParams;t&&r.set("organization",t);const n=r.toString();return Ve.get(`/badge-batches/${e}${n?`?${n}`:""}`)},create(e){return Ve.post("/badge-batches",e)}},Ky={async list(e){var r;const t=await Ve.get(`/events/${e}/tickets`);if(t.error)throw new Error(t.error);return((r=t.data)==null?void 0:r.tickets)??[]},async create(e,t){const r=await Ve.post(`/events/${e}/tickets`,t);if(r.error||!r.data)throw new Error(r.error??"Failed to create ticket");return r.data},async update(e,t,r){const n=await Ve.patch(`/events/${e}/tickets/${t}`,r);if(n.error||!n.data)throw new Error(n.error??"Failed to update ticket");return n.data},async remove(e,t){const r=await Ve.delete(`/events/${e}/tickets/${t}`);if(r.error)throw new Error(r.error)}};async function pf(e){var n;let t;try{t=await e.json()}catch{return{error:e.statusText||"Network error"}}const r=t;return r.success===!0&&r.data!==void 0?{data:r.data}:{error:((n=r.error)==null?void 0:n.message)||"Request failed"}}function hf(e){const t=cd.endsWith("/")?cd.slice(0,-1):cd,r=e.startsWith("/")?e:`/${e}`;return`${t}${r}`}const gf={async getEventSummary(e){const t=await fetch(hf(`/public/events/${e}/summary`),{method:"GET"}),r=await pf(t);if(r.error)throw new Error(r.error);return r.data},async listTickets(e){var n;const t=await fetch(hf(`/public/events/${e}/tickets`),{method:"GET"}),r=await pf(t);if(r.error)throw new Error(r.error);return((n=r.data)==null?void 0:n.tickets)??[]},async checkoutOptions(e){const t=await fetch(hf(`/public/events/${e}/tickets/checkout-options`),{method:"GET"}),r=await pf(t);if(r.error)throw new Error(r.error);return r.data},async quote(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/quote`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data},async manualQuote(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/manual-quote`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data},async checkout(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/checkout`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data},async verifyPayment(e,t){const r=await fetch(hf(`/public/events/${e}/payment/verify`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error)},async manualSubmit(e,t){const r=await fetch(hf(`/public/events/${e}/tickets/manual-submit`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n=await pf(r);if(n.error)throw new Error(n.error);return n.data}},d5={async get(e){var r;const t=await Ve.get(`/events/${e}/ticketing-manual-payment`);if(t.error||!((r=t.data)!=null&&r.ticketingManualPayment))throw new Error(t.error??"Failed to load manual payment settings");return t.data.ticketingManualPayment},async patch(e,t){var n;const r=await Ve.patch(`/events/${e}/ticketing-manual-payment`,t);if(r.error||!((n=r.data)!=null&&n.ticketingManualPayment))throw new Error(r.error??"Failed to save");return r.data.ticketingManualPayment},async checkoutEnablementOrder(e){const t=await Ve.post(`/events/${e}/ticketing-manual-enablement/checkout-order`,{});if(t.error||!t.data)throw new Error(t.error??"Failed to create payment order");return t.data}},z0={async list(e,t="pending_review"){var o;const r=t==="pending_review"?"":`?status=${encodeURIComponent(t)}`,n=await Ve.get(`/events/${e}/ticket-manual-orders${r}`);if(n.error)throw new Error(n.error);return((o=n.data)==null?void 0:o.orders)??[]},async approve(e,t){const r=await Ve.post(`/events/${e}/ticket-manual-orders/${t}/approve`,{});if(r.error)throw new Error(r.error)},async reject(e,t,r){const n=await Ve.post(`/events/${e}/ticket-manual-orders/${t}/reject`,{reason:r});if(n.error)throw new Error(n.error)}},Lf={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization),(e==null?void 0:e.page)!=null&&t.set("page",String(e.page)),(e==null?void 0:e.limit)!=null&&t.set("limit",String(e.limit));const r=t.toString();return Ve.get(`/speakers${r?`?${r}`:""}`)},get(e){return Ve.get(`/speakers/${e}`)},create(e){return Ve.post("/speakers",e)},update(e,t){return Ve.put(`/speakers/${e}`,t)},remove(e){return Ve.delete(`/speakers/${e}`)},byEvent(e){return Ve.get(`/events/${e}/speakers`)}};async function M0(e){if(e.error||!e.data)throw new Error(e.error??"Request failed");return e.data}const Mo={async list(e){var o;const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString(),n=await Ve.get(`/forms${r?`?${r}`:""}`);if(n.error)throw new Error(n.error);return((o=n.data)==null?void 0:o.forms)??[]},async listForEvent(e){var r;const t=await Ve.get(`/events/${e}/forms`);if(t.error)throw new Error(t.error);return((r=t.data)==null?void 0:r.forms)??[]},async get(e){return M0(await Ve.get(`/forms/${e}`))},async create(e){return M0(await Ve.post("/forms",e))},async createForEvent(e,t){return M0(await Ve.post(`/events/${e}/forms`,t))},async update(e,t){return M0(await Ve.put(`/forms/${e}`,t))},async remove(e){const t=await Ve.delete(`/forms/${e}`);if(t.error)throw new Error(t.error)},async getPublic(e){var o;const t=`${cd}/public/forms/${e}`,r=await fetch(t);let n;try{n=await r.json()}catch{throw new Error("Network error")}if(!n.success||!n.data)throw new Error(((o=n.error)==null?void 0:o.message)||"Form not available");return n.data},async submit(e,t){const r=await Ve.post(`/forms/${e}/submit`,t);if(r.error)throw new Error(r.error);return r.data},async listSubmissions(e,t){var a,s,l,c;const r=new URLSearchParams;t!=null&&t.q&&r.set("q",t.q),t!=null&&t.dateFrom&&r.set("dateFrom",t.dateFrom),t!=null&&t.dateTo&&r.set("dateTo",t.dateTo),(t==null?void 0:t.page)!=null&&r.set("page",String(t.page)),(t==null?void 0:t.limit)!=null&&r.set("limit",String(t.limit));const n=r.toString(),o=await Ve.get(`/forms/${e}/submissions${n?`?${n}`:""}`);if(o.error)throw new Error(o.error);return{submissions:((a=o.data)==null?void 0:a.submissions)??[],total:((s=o.data)==null?void 0:s.total)??0,page:((l=o.data)==null?void 0:l.page)??1,limit:((c=o.data)==null?void 0:c.limit)??20}},async exportSubmissionsCsv(e,t){var o;const r=new URLSearchParams;r.set("export","csv"),t!=null&&t.q&&r.set("q",t.q),t!=null&&t.dateFrom&&r.set("dateFrom",t.dateFrom),t!=null&&t.dateTo&&r.set("dateTo",t.dateTo);const n=await wh(`/forms/${e}/submissions?${r.toString()}`,{method:"GET"});if(!n.ok){let a=n.statusText;try{a=((o=(await n.json()).error)==null?void 0:o.message)||a}catch{}throw new Error(a)}return n.blob()}},Sx={list(){return Ve.get("/users")},create(e){return Ve.post("/users",e)},update(e,t){return Ve.put(`/users/${e}`,t)},remove(e){return Ve.delete(`/users/${e}`)}},dm={list(e){return Ve.get(`/events/${e}/tracks`)},create(e,t){return Ve.post(`/events/${e}/tracks`,t)},update(e,t){return Ve.put(`/tracks/${e}`,t)},remove(e){return Ve.delete(`/tracks/${e}`)}},ta={list(e){return Ve.get(`/events/${e}/sessions`)},create(e,t){return Ve.post(`/events/${e}/sessions`,t)},update(e,t){return Ve.put(`/sessions/${e}`,t)},remove(e){return Ve.delete(`/sessions/${e}`)}},wa={listStaff(e){return Ve.get(`/events/${e}/staff`)},listAvailableUsers(e){return Ve.get(`/events/${e}/staff/available-users`)},agendaTree(e){return Ve.get(`/events/${e}/agenda-tree`)},addStaff(e,t){return Ve.post(`/events/${e}/staff`,t)},updateStaff(e,t,r){return Ve.put(`/events/${e}/staff/${t}`,r)},removeStaff(e,t){return Ve.delete(`/events/${e}/staff/${t}`)},sendInvites(e,t){return Ve.post(`/events/${e}/staff/invites`,t)},cancelInvite(e,t){return Ve.delete(`/events/${e}/staff/invites/${t}`)},resendInvite(e,t){return Ve.post(`/events/${e}/staff/invites/${t}/resend`,{})},invitePreview(e){return Ve.get(`/event-invites/${e}`)},inviteAccept(e){return Ve.post("/event-invites/accept",e)}},Pi={listByEvent(e){return Ve.get(`/events/${e}/quiz-polls`)},listBySession(e){return Ve.get(`/sessions/${e}/quiz-polls`)},get(e){return Ve.get(`/quiz-polls/${e}`)},create(e,t){return Ve.post(`/events/${e}/quiz-polls`,t)},update(e,t){return Ve.put(`/quiz-polls/${e}`,t)},remove(e){return Ve.delete(`/quiz-polls/${e}`)},publish(e){return Ve.post(`/quiz-polls/${e}/publish`,{})},close(e){return Ve.post(`/quiz-polls/${e}/close`,{})},setLiveQuestion(e,t){return Ve.post(`/quiz-polls/${e}/live-question`,{questionId:t})},setShowCorrect(e,t){return Ve.post(`/quiz-polls/${e}/show-correct`,{show:t})},ensurePresentationToken(e){return Ve.post(`/quiz-polls/${e}/presentation-token`,{})}},Gee=["home","agenda","speakers","registration","sponsors","custom"],Kee=["header","banner","contact_form","agenda","register_links","speakers","footer","sponsors","cta","custom_html","countdown","gallery","about","venue","faq","tickets"],Yc={list(e){return Ve.get(`/events/${e}/pages`)},get(e){return Ve.get(`/pages/${e}`)},create(e,t){return Ve.post(`/events/${e}/pages`,t)},update(e,t){return Ve.put(`/pages/${e}`,t)},remove(e){return Ve.delete(`/pages/${e}`)},publish(e){return Ve.post(`/pages/${e}/publish`,{})},exportHtml(e,t){const r=t?`?registrationUrl=${encodeURIComponent(t)}`:"";return Ve.get(`/pages/${e}/export-html${r}`)}},Xc={get(e){return Ve.get(`/events/${e}/website-settings`)},update(e,t){return Ve.put(`/events/${e}/website-settings`,t)},checkFolder(e,t,r){const n=new URLSearchParams({folder:t});return r&&n.set("micrositeId",r),Ve.get(`/events/${e}/website-settings/check-folder?${n.toString()}`)},publishMicrosite(e,t){return Ve.post(`/events/${e}/website/publish-microsite`,t??{})},micrositePreviewHtml(e,t){const r=t?`?micrositeId=${encodeURIComponent(t)}`:"";return Ve.get(`/events/${e}/website-settings/microsite-preview-html${r}`)}},ha={listForOrganization(e){return Ve.get(`/event-microsites?organization=${encodeURIComponent(e)}`)},list(e){return Ve.get(`/events/${e}/microsites`)},get(e,t){return Ve.get(`/events/${e}/microsites/${t}`)},create(e,t){return Ve.post(`/events/${e}/microsites`,t)},update(e,t,r){return Ve.put(`/events/${e}/microsites/${t}`,r)},delete(e,t){return Ve.delete(`/events/${e}/microsites/${t}`)},publish(e,t,r){return Ve.post(`/events/${e}/microsites/${t}/publish`,r??{})},previewHtml(e,t){return Ve.get(`/events/${e}/microsites/${t}/preview-html`)},checkFolder(e,t,r){const n=new URLSearchParams({folder:t});return r&&n.set("micrositeId",r),Ve.get(`/events/${e}/microsites/check-folder?${n.toString()}`)}};async function h$(e={}){var n,o;const t=new URLSearchParams;e.organization&&t.set("organization",e.organization),t.set("page",String(e.page??1)),t.set("limit",String(e.limit??200)),e.type&&t.set("type",e.type);const r=await Ve.get(`/library/media?${t.toString()}`);if(r.error)throw new Error(r.error);return{media:((n=r.data)==null?void 0:n.media)??[],total:((o=r.data)==null?void 0:o.total)??0}}async function Sa(e,t={}){var a;const r=new FormData;r.append("file",e),r.append("name",e.name),t.eventId&&r.append("eventId",t.eventId),t.module&&r.append("module",t.module),t.description!=null&&r.append("description",t.description),t.visibility&&r.append("visibility",t.visibility),t.tags&&r.append("tags",t.tags),t.contentCollectionId&&r.append("contentCollectionId",t.contentCollectionId);const o=await(await wh("/media/upload",{method:"POST",body:r,skipGlobalLoading:!0})).json();if(o.success&&o.data)return o.data;throw new Error(((a=o.error)==null?void 0:a.message)||"Upload failed")}const r2={async list(e){var n;const t=new URLSearchParams;t.set("limit","200"),e!=null&&e.organization&&t.set("organization",e.organization);const r=await Ve.get(`/content-collections?${t}`);if(r.error)throw new Error(r.error);return((n=r.data)==null?void 0:n.collections)??[]},async create(e){const t=await Ve.post("/content-collections",e);if(t.error||!t.data)throw new Error(t.error??"Failed to create collection");return t.data},async get(e){const t=await Ve.get(`/content-collections/${e}`);if(t.error||!t.data)throw new Error(t.error??"Not found");return t.data},async update(e,t){const r=await Ve.put(`/content-collections/${e}`,t);if(r.error||!r.data)throw new Error(r.error??"Failed to update collection");return r.data},async remove(e){const t=await Ve.delete(`/content-collections/${e}`);if(t.error)throw new Error(t.error)}},cs={async get(e){const t=e!=null&&e.cacheBust?`?_=${encodeURIComponent(String(Date.now()))}`:"",r=await Ve.get(`/organization${t}`);if(r.error)throw new Error(r.error);return r.data??null},async update(e){const t=await Ve.put("/organization",e);if(t.error||t.data==null)throw new Error(t.error??"Update failed");return t.data},getEmailSettings(){return Ve.get("/organization/email-settings")},updateEmailSettings(e){return Ve.put("/organization/email-settings",e)},testEmailSettings(e){return Ve.post("/organization/email-settings/test",{to:e})},getWhatsAppSettings(){return Ve.get("/organization/whatsapp-settings")},updateWhatsAppSettings(e){return Ve.put("/organization/whatsapp-settings",e)}},em={list(e){const t=new URLSearchParams;e!=null&&e.sync&&t.set("sync","1"),e!=null&&e.status&&t.set("status",e.status);const r=t.toString();return Ve.get(`/whatsapp-templates${r?`?${r}`:""}`)},get(e,t){const r=new URLSearchParams;t!=null&&t.sync&&r.set("sync","1");const n=r.toString();return Ve.get(`/whatsapp-templates/${e}${n?`?${n}`:""}`)},create(e){return Ve.post("/whatsapp-templates",e)},sync(e){return Ve.post(`/whatsapp-templates/${e}/sync`,{})},remove(e){return Ve.delete(`/whatsapp-templates/${e}`)}},Ls={list(e){const t=new URLSearchParams;e!=null&&e.organization&&t.set("organization",e.organization);const r=t.toString();return Ve.get(`/concierge-bots${r?`?${r}`:""}`)},get(e){return Ve.get(`/concierge-bots/${e}`)},getByEvent(e){return Ve.get(`/events/${e}/concierge-bot`)},create(e){return Ve.post("/concierge-bots",e)},update(e,t){return Ve.put(`/concierge-bots/${e}`,t)},remove(e){return Ve.delete(`/concierge-bots/${e}`)},listSources(e){return Ve.get(`/concierge-bots/${e}/sources`)},createSource(e,t){return Ve.post(`/concierge-bots/${e}/sources`,t)},deleteSource(e,t){return Ve.delete(`/concierge-bots/${e}/sources/${t}`)},syncSource(e,t){return Ve.post(`/concierge-bots/${e}/sources/${t}/sync`,{})},listChunks(e,t,r=!0){return Ve.get(`/concierge-bots/${e}/sources/${t}/chunks?staging=${r?"true":"false"}`)},patchChunk(e,t,r){return Ve.patch(`/concierge-bots/${e}/chunks/${t}`,{rawText:r})},deleteChunk(e,t){return Ve.delete(`/concierge-bots/${e}/chunks/${t}`)},approveSource(e,t){return Ve.post(`/concierge-bots/${e}/sources/${t}/approve`,{})},clearKnowledge(e){return Ve.post(`/concierge-bots/${e}/knowledge/clear`,{})},syncEventKnowledge(e){return Ve.post(`/concierge-bots/${e}/knowledge/sync-event`,{})}},fo={listByOrg(e){const t=new URLSearchParams;e!=null&&e.channel&&t.set("channel",e.channel);const r=t.toString();return Ve.get(`/campaigns${r?`?${r}`:""}`)},listForEvent(e){return Ve.get(`/events/${e}/campaigns`)},create(e,t){return Ve.post(`/events/${e}/campaigns`,t)},get(e){return Ve.get(`/campaigns/${e}`)},update(e,t){return Ve.put(`/campaigns/${e}`,t)},remove(e){return Ve.delete(`/campaigns/${e}`)},send(e,t={}){return Ve.post(`/campaigns/${e}/send`,t)},schedule(e,t){return Ve.post(`/campaigns/${e}/schedule`,{scheduledFor:t})},cancel(e){return Ve.post(`/campaigns/${e}/cancel`,{})},stop(e){return Ve.post(`/campaigns/${e}/stop`,{})},analytics(e){return Ve.get(`/campaigns/${e}/analytics`)},preview(e,t){return Ve.post(`/campaigns/${e}/preview`,t||{})}};function cT(){return typeof window>"u"?Promise.reject(new Error("No window")):window.Razorpay?Promise.resolve():new Promise((t,r)=>{const n=document.createElement("script");n.src="https://checkout.razorpay.com/v1/checkout.js",n.async=!0,n.onload=()=>t(),n.onerror=()=>r(new Error("Failed to load Razorpay")),document.body.appendChild(n)})}const ed={async catalog(){const e=await Ve.get("/subscription/catalog");if(e.error||!e.data)throw new Error(e.error??"Failed to load catalog");return e.data},async checkoutOrder(e){const t=await Ve.post("/subscription/checkout/order",{targetPlanId:e});if(t.error||!t.data)throw new Error(t.error??"Failed to create payment order");return t.data},async checkoutVerify(e){const t=await Ve.post("/subscription/checkout/verify",e);if(t.error||!t.data)throw new Error(t.error??"Payment verification failed");return t.data},async contactSalesRequest(e){const t=await Ve.post("/subscription/contact-sales",e);if(t.error||t.data==null)throw new Error(t.error??"Failed to send request");return t.data},async listInvoices(){const e=await Ve.get("/subscription/invoices");if(e.error||!e.data)throw new Error(e.error??"Failed to load invoices");return e.data},async downloadInvoice(e){const t=await wh(`/subscription/invoices/${encodeURIComponent(e)}/invoice`,{method:"GET",skipGlobalLoading:!0});if(!t.ok)throw new Error("Download failed");const r=await t.blob(),n=URL.createObjectURL(r),o=document.createElement("a");o.href=n,o.download=`eventbuzz-invoice-${e}.html`,o.click(),URL.revokeObjectURL(n)}},nd={async listOrganizations(e={}){const t=new URLSearchParams;e.page!=null&&t.set("page",String(e.page)),e.limit!=null&&t.set("limit",String(e.limit)),e.search&&t.set("search",e.search);const r=t.toString(),n=`/platform-admin/organizations${r?`?${r}`:""}`,o=await Ve.get(n);if(o.error||!o.data)throw new Error(o.error??"Failed to load organizations");const a=o.data;return{organizations:a.organizations??[],total:a.total??0,page:a.page??1,limit:a.limit??20}},async createOrganization(e){const t=await Ve.post("/platform-admin/organizations",e);if(t.error||!t.data)throw new Error(t.error??"Failed to create organization");return t.data},async getOrganization(e){const t=await Ve.get(`/platform-admin/organizations/${e}`);if(t.error||!t.data)throw new Error(t.error??"Failed to load organization");return t.data},async patchOrganizationSubscription(e,t){const r=await Ve.patch(`/platform-admin/organizations/${e}/subscription`,t);if(r.error||!r.data)throw new Error(r.error??"Failed to update subscription");return r.data},async listPermissions(){const e=await Ve.get("/platform-admin/permissions");if(e.error||!e.data)throw new Error(e.error??"Failed to load permissions");return e.data},async listPlans(){const e=await Ve.get("/platform-admin/plans");if(e.error||!e.data)throw new Error(e.error??"Failed to load plans");return e.data},async createPlan(e){const t=await Ve.post("/platform-admin/plans",e);if(t.error||!t.data)throw new Error(t.error??"Failed to create plan");return t.data},async updatePlan(e,t){const r=encodeURIComponent(e),n=await Ve.put(`/platform-admin/plans/${r}`,t);if(n.error||!n.data)throw new Error(n.error??"Failed to update plan");return n.data},async deletePlan(e){const t=encodeURIComponent(e),r=await Ve.delete(`/platform-admin/plans/${t}`);if(r.error||!r.data)throw new Error(r.error??"Failed to delete plan");return r.data}},zO={async create(e){const t=await Ve.post("/admin-requests",e);if(t.error||!t.data)throw new Error(t.error??"Request failed");return t.data}},Hu={getPlatformConfig(){return Ve.get("/platform/payment-config")},updatePlatformConfig(e){return Ve.put("/platform/payment-config",e)},getOrgProfile(){return Ve.get("/organization/payment-profile")},updateOrgProfile(e){return Ve.put("/organization/payment-profile",e)},addGateway(e){return Ve.post("/organization/payment-profile/gateways",e)},patchGateway(e,t){return Ve.patch(`/organization/payment-profile/gateways/${e}`,t)},deleteGateway(e){return Ve.delete(`/organization/payment-profile/gateways/${e}`)},listTransactions(e){const t=new URLSearchParams;Object.entries(e).forEach(([n,o])=>{o!=null&&String(o)!==""&&t.set(n,String(o))});const r=t.toString();return Ve.get(`/payment/transactions${r?`?${r}`:""}`)},async downloadTransactionsCsv(e){const t=new URLSearchParams;Object.entries(e).forEach(([s,l])=>{l&&t.set(s,l)});const r=await wh(`/payment/transactions/export?${t.toString()}`,{method:"GET",skipGlobalLoading:!0});if(!r.ok)throw new Error("Export failed");const n=await r.blob(),o=URL.createObjectURL(n),a=document.createElement("a");a.href=o,a.download="payment-transactions.csv",a.click(),URL.revokeObjectURL(o)}};function g$(e){if(e===null||typeof e!="object")return!1;const t=e;return t.version===1&&typeof t.layoutId=="string"&&Array.isArray(t.sections)}function Nn(e){if(!(!(e!=null&&e.organization)||typeof e.organization!="object"))return e.organization._id}const A3="eventbuzz_user";function Qee(){try{const e=localStorage.getItem(A3);return e?JSON.parse(e):null}catch{return null}}function xl(e){try{e?localStorage.setItem(A3,JSON.stringify(e)):localStorage.removeItem(A3)}catch{}}const m$=S.createContext(null);function Xee({children:e}){const[t,r]=S.useState(()=>({user:Qee(),loading:!0,checked:!1})),n=S.useCallback(async()=>{try{const f=await Ma.me();f.data?(xl(f.data),r(h=>({...h,user:f.data,checked:!0}))):(xl(null),r(h=>({...h,user:null,checked:!0})))}catch{xl(null),r(f=>({...f,user:null,checked:!0}))}},[]);S.useEffect(()=>{let f=!1;return(async()=>{try{const h=await Ma.me();if(f)return;h.data?(xl(h.data),r({user:h.data,loading:!1,checked:!0})):(xl(null),r({user:null,loading:!1,checked:!0}))}catch{f||(xl(null),r({user:null,loading:!1,checked:!0}))}})(),()=>{f=!0}},[]);const o=S.useCallback(async(f,h)=>{const p=await Ma.login(f,h);if(p.error)return{error:p.error};const v=p.data;return v&&"requiresTwoFactor"in v&&v.requiresTwoFactor&&v.twoFactorToken?{requiresTwoFactor:!0,twoFactorToken:v.twoFactorToken,email:"email"in v?v.email:void 0}:v&&"user"in v&&v.user?(xl(v.user),r(m=>({...m,user:v.user})),{success:!0}):{error:"Login failed"}},[]),a=S.useCallback(async f=>{let h=await Ma.googleLogin(f);if(h.error&&/register first|not registered/i.test(h.error)&&(h=await Ma.googleRegister({idToken:f})),h.error)return{error:h.error};const p=h.data;return p&&"requiresTwoFactor"in p&&p.requiresTwoFactor&&p.twoFactorToken?{requiresTwoFactor:!0,twoFactorToken:p.twoFactorToken,email:"email"in p?p.email:void 0}:p&&"user"in p&&p.user?(xl(p.user),r(v=>({...v,user:p.user})),{success:!0}):{error:"Google sign-in failed"}},[]),s=S.useCallback(async(f,h)=>{var v;const p=await Ma.completeLogin2fa(f,h.replace(/\s/g,""));return p.error?{error:p.error}:(v=p.data)!=null&&v.user?(xl(p.data.user),r(m=>({...m,user:p.data.user})),{}):{error:"Verification failed"}},[]),l=S.useCallback(async f=>{const h=await Ma.register(f);if(h.data){const p=h.data.user;return xl(p),r(v=>({...v,user:p})),{}}return{error:h.error||"Registration failed"}},[]),c=S.useCallback(async f=>{const h=await Ma.googleRegister(f);if(h.data){const p=h.data.user;return xl(p),r(v=>({...v,user:p})),{}}return{error:h.error||"Registration failed"}},[]),u=S.useCallback(()=>{Ma.logout(),xl(null),r({user:null,loading:!1,checked:!0})},[]),d={...t,login:o,loginWithGoogleCredential:a,completeTwoFactorLogin:s,register:l,registerWithGoogle:c,logout:u,refreshUser:n};return i.jsx(m$.Provider,{value:d,children:e})}function Mr(){const e=S.useContext(m$);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zee=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Jee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),MO=e=>{const t=Jee(e);return t.charAt(0).toUpperCase()+t.slice(1)},v$=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var ete={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"};/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tte=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:a,iconNode:s,...l},c)=>S.createElement("svg",{ref:c,...ete,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:v$("lucide",o),...l},[...s.map(([u,d])=>S.createElement(u,d)),...Array.isArray(a)?a:[a]]));/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nt=(e,t)=>{const r=S.forwardRef(({className:n,...o},a)=>S.createElement(tte,{ref:a,iconNode:t,className:v$(`lucide-${Zee(MO(e))}`,`lucide-${e}`,n),...o}));return r.displayName=MO(e),r};/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rte=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],nte=Nt("align-left",rte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ite=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],ote=Nt("archive",ite);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ate=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],uT=Nt("arrow-left",ate);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ste=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],dT=Nt("arrow-right",ste);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lte=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],cte=Nt("arrow-up-narrow-wide",lte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ute=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],dte=Nt("award",ute);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fte=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],pte=Nt("bell-off",fte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hte=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],fT=Nt("bell",hte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gte=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],n2=Nt("book-open",gte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mte=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],DO=Nt("bookmark",mte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vte=[["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"}]],yte=Nt("bot",vte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xte=[["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"}]],_b=Nt("building-2",xte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bte=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],y$=Nt("calendar-days",bte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wte=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Vi=Nt("calendar",wte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ste=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],pT=Nt("chart-column",Ste);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jte=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],x$=Nt("chart-line",jte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kte=[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]],_te=Nt("chart-no-axes-column-increasing",kte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Cte=[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]],Ad=Nt("chart-no-axes-column",Cte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ete=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],bi=Nt("check",Ete);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ate=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],go=Nt("chevron-down",Ate);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tte=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vd=Nt("chevron-left",Tte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pte=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ka=Nt("chevron-right",Pte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ite=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Qf=Nt("chevron-up",Ite);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ote=[["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"}]],Wh=Nt("circle-alert",Ote);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nte=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Rte=Nt("circle-check-big",Nte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],yv=Nt("circle-check",Lte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tS=Nt("circle-help",Fte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zte=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],hT=Nt("clipboard-check",zte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mte=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],rS=Nt("clock",Mte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dte=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Js=Nt("copy",Dte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bte=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],xv=Nt("credit-card",Bte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wte=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],ja=Nt("download",Wte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qte=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],$te=Nt("ellipsis",qte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ute=[["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"}]],bv=Nt("external-link",Ute);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hte=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],gT=Nt("eye-off",Hte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vte=[["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"}]],qh=Nt("eye",Vte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yte=[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],Gte=Nt("file-image",Yte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kte=[["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 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Sh=Nt("file-text",Kte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qte=[["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"}]],mT=Nt("file",Qte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xte=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],Zte=Nt("film",Xte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jte=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],BO=Nt("folder-open",Jte);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ere=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],tre=Nt("funnel",ere);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rre=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Wf=Nt("globe",rre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nre=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],wv=Nt("grip-vertical",nre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ire=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ore=Nt("hash",ire);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const are=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],vT=Nt("house",are);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sre=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],jx=Nt("image",sre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lre=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],nS=Nt("layers",lre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cre=[["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"}]],ure=Nt("layout-dashboard",cre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dre=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Cb=Nt("layout-grid",dre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fre=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],pre=Nt("layout-list",fre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hre=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],i2=Nt("link-2",hre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gre=[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]],mre=Nt("linkedin",gre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vre=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],Eb=Nt("list",vre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yre=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],kx=Nt("loader-circle",yre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xre=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],bre=Nt("lock",xre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wre=[["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"}]],Sre=Nt("log-out",wre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jre=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],b$=Nt("mail-check",jre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kre=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]],Xf=Nt("mail",kre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _re=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Ab=Nt("map-pin",_re);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Cre=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],Ere=Nt("menu",Cre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Are=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],$h=Nt("message-circle",Are);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tre=[["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"}]],dd=Nt("message-square",Tre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pre=[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]],iS=Nt("mic-vocal",Pre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ire=[["path",{d:"M5 12h14",key:"1ays0h"}]],oS=Nt("minus",Ire);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ore=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Nre=Nt("monitor",Ore);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rre=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],WO=Nt("moon",Rre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lre=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],Fre=Nt("mouse-pointer",Lre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zre=[["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"}]],tm=Nt("palette",zre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mre=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],w$=Nt("panels-top-left",Mre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dre=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],wi=Nt("pencil",Dre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bre=[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]],aS=Nt("phone",Bre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wre=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],S$=Nt("plug",Wre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qre=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gr=Nt("plus",qre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $re=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],Zf=Nt("qr-code",$re);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ure=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],Hre=Nt("radio",Ure);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vre=[["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"}]],_x=Nt("refresh-cw",Vre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yre=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],j$=Nt("rocket",Yre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gre=[["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"}]],Kre=Nt("rotate-ccw",Gre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qre=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],sS=Nt("save",Qre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xre=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],pi=Nt("search",Xre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zre=[["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"}]],k$=Nt("send",Zre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jre=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],hc=Nt("settings",Jre);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ene=[["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"}]],tne=Nt("shield-check",ene);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rne=[["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"}]],fd=Nt("shield",rne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nne=[["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"}]],ine=Nt("sparkles",nne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const one=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_$=Nt("square-check-big",one);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ane=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],T3=Nt("square-pen",ane);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sne=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],C$=Nt("square",sne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lne=[["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"}]],E$=Nt("star",lne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cne=[["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"}]],qO=Nt("sun",cne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const une=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Cx=Nt("tag",une);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dne=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],A$=Nt("ticket",dne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fne=[["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"}]],Xr=Nt("trash-2",fne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pne=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],T$=Nt("trending-up",pne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hne=[["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"}]],nu=Nt("trophy",hne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gne=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],mne=Nt("twitter",gne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vne=[["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"}]],Fl=Nt("upload",vne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yne=[["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"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]],lS=Nt("user-check",yne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xne=[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],yT=Nt("user-plus",xne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bne=[["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"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],wne=Nt("user-x",bne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Sne=[["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"}]],Om=Nt("user",Sne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jne=[["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"}]],Ri=Nt("users",jne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kne=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Gt=Nt("x",kne);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _ne=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],cS=Nt("zap",_ne);function Tb({title:e="Confirm",message:t,confirmLabel:r="Confirm",cancelLabel:n="Cancel",variant:o="danger",onConfirm:a,onCancel:s}){const l=o==="danger",c=o==="warning";return i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:110,display:"flex",alignItems:"center",justifyContent:"center"},onClick:s,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"360px",padding:"20px",boxShadow:"var(--shadow-xl)"},onClick:u=>u.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start",marginBottom:"20px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:l?"#fee2e2":c?"#fef3c7":"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(Wh,{size:16,style:{color:l?"var(--destructive)":c?"#b45309":"var(--muted)"}})}),i.jsxs("div",{children:[i.jsx("p",{id:"confirm-modal-title",style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px"},children:e}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:s,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:n}),i.jsx("button",{type:"button",onClick:a,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"none",background:l?"var(--destructive)":c?"#b45309":"var(--primary)",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:r})]})]})})}function hs(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function $O(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function P$(...e){return t=>{let r=!1;const n=e.map(o=>{const a=$O(o,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<n.length;o++){const a=n[o];typeof a=="function"?a():$O(e[o],null)}}}}function zl(...e){return S.useCallback(P$(...e),e)}function Cne(e,t){const r=S.createContext(t),n=a=>{const{children:s,...l}=a,c=S.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:s})};n.displayName=e+"Provider";function o(a){const s=S.useContext(r);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,o]}function uS(e,t=[]){let r=[];function n(a,s){const l=S.createContext(s),c=r.length;r=[...r,s];const u=f=>{var x;const{scope:h,children:p,...v}=f,m=((x=h==null?void 0:h[e])==null?void 0:x[c])||l,b=S.useMemo(()=>v,Object.values(v));return i.jsx(m.Provider,{value:b,children:p})};u.displayName=a+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,v=S.useContext(p);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const o=()=>{const a=r.map(s=>S.createContext(s));return function(l){const c=(l==null?void 0:l[e])||a;return S.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[n,Ene(o,...t)]}function Ene(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const s=n.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var jh=globalThis!=null&&globalThis.document?S.useLayoutEffect:()=>{},Ane=Vq.useId||(()=>{}),Tne=0;function F1(e){const[t,r]=S.useState(Ane());return jh(()=>{r(n=>n??String(Tne++))},[e]),e||(t?`radix-${t}`:"")}function qf(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function xT({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,o]=Pne({defaultProp:t,onChange:r}),a=e!==void 0,s=a?e:n,l=qf(r),c=S.useCallback(u=>{if(a){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else o(u)},[a,e,o,l]);return[s,c]}function Pne({defaultProp:e,onChange:t}){const r=S.useState(e),[n]=r,o=S.useRef(n),a=qf(t);return S.useEffect(()=>{o.current!==n&&(a(n),o.current=n)},[n,o,a]),r}var dS=S.forwardRef((e,t)=>{const{children:r,...n}=e,o=S.Children.toArray(r),a=o.find(One);if(a){const s=a.props.children,l=o.map(c=>c===a?S.Children.count(s)>1?S.Children.only(null):S.isValidElement(s)?s.props.children:null:c);return i.jsx(P3,{...n,ref:t,children:S.isValidElement(s)?S.cloneElement(s,void 0,l):null})}return i.jsx(P3,{...n,ref:t,children:r})});dS.displayName="Slot";var P3=S.forwardRef((e,t)=>{const{children:r,...n}=e;if(S.isValidElement(r)){const o=Rne(r),a=Nne(n,r.props);return r.type!==S.Fragment&&(a.ref=t?P$(t,o):o),S.cloneElement(r,a)}return S.Children.count(r)>1?S.Children.only(null):null});P3.displayName="SlotClone";var Ine=({children:e})=>i.jsx(i.Fragment,{children:e});function One(e){return S.isValidElement(e)&&e.type===Ine}function Nne(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...l)=>{a(...l),o(...l)}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function Rne(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Lne=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_a=Lne.reduce((e,t)=>{const r=S.forwardRef((n,o)=>{const{asChild:a,...s}=n,l=a?dS:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...s,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Fne(e,t){e&&iT.flushSync(()=>e.dispatchEvent(t))}function zne(e,t=globalThis==null?void 0:globalThis.document){const r=qf(e);S.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Mne="DismissableLayer",I3="dismissableLayer.update",Dne="dismissableLayer.pointerDownOutside",Bne="dismissableLayer.focusOutside",UO,I$=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),bT=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...c}=e,u=S.useContext(I$),[d,f]=S.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=S.useState({}),v=zl(t,A=>f(A)),m=Array.from(u.layers),[b]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=m.indexOf(b),w=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,j=w>=x,_=$ne(A=>{const P=A.target,N=[...u.branches].some(O=>O.contains(P));!j||N||(o==null||o(A),s==null||s(A),A.defaultPrevented||l==null||l())},h),T=Une(A=>{const P=A.target;[...u.branches].some(O=>O.contains(P))||(a==null||a(A),s==null||s(A),A.defaultPrevented||l==null||l())},h);return zne(A=>{w===u.layers.size-1&&(n==null||n(A),!A.defaultPrevented&&l&&(A.preventDefault(),l()))},h),S.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(UO=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),HO(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=UO)}},[d,h,r,u]),S.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),HO())},[d,u]),S.useEffect(()=>{const A=()=>p({});return document.addEventListener(I3,A),()=>document.removeEventListener(I3,A)},[]),i.jsx(_a.div,{...c,ref:v,style:{pointerEvents:k?j?"auto":"none":void 0,...e.style},onFocusCapture:hs(e.onFocusCapture,T.onFocusCapture),onBlurCapture:hs(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:hs(e.onPointerDownCapture,_.onPointerDownCapture)})});bT.displayName=Mne;var Wne="DismissableLayerBranch",qne=S.forwardRef((e,t)=>{const r=S.useContext(I$),n=S.useRef(null),o=zl(t,n);return S.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),i.jsx(_a.div,{...e,ref:o})});qne.displayName=Wne;function $ne(e,t=globalThis==null?void 0:globalThis.document){const r=qf(e),n=S.useRef(!1),o=S.useRef(()=>{});return S.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){O$(Dne,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Une(e,t=globalThis==null?void 0:globalThis.document){const r=qf(e),n=S.useRef(!1);return S.useEffect(()=>{const o=a=>{a.target&&!n.current&&O$(Bne,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function HO(){const e=new CustomEvent(I3);document.dispatchEvent(e)}function O$(e,t,r,{discrete:n}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?Fne(o,a):o.dispatchEvent(a)}var f5="focusScope.autoFocusOnMount",p5="focusScope.autoFocusOnUnmount",VO={bubbles:!1,cancelable:!0},Hne="FocusScope",wT=S.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=e,[l,c]=S.useState(null),u=qf(o),d=qf(a),f=S.useRef(null),h=zl(t,m=>c(m)),p=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(n){let m=function(k){if(p.paused||!l)return;const j=k.target;l.contains(j)?f.current=j:jf(f.current,{select:!0})},b=function(k){if(p.paused||!l)return;const j=k.relatedTarget;j!==null&&(l.contains(j)||jf(f.current,{select:!0}))},x=function(k){if(document.activeElement===document.body)for(const _ of k)_.removedNodes.length>0&&jf(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",b);const w=new MutationObserver(x);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",b),w.disconnect()}}},[n,l,p.paused]),S.useEffect(()=>{if(l){GO.add(p);const m=document.activeElement;if(!l.contains(m)){const x=new CustomEvent(f5,VO);l.addEventListener(f5,u),l.dispatchEvent(x),x.defaultPrevented||(Vne(Xne(N$(l)),{select:!0}),document.activeElement===m&&jf(l))}return()=>{l.removeEventListener(f5,u),setTimeout(()=>{const x=new CustomEvent(p5,VO);l.addEventListener(p5,d),l.dispatchEvent(x),x.defaultPrevented||jf(m??document.body,{select:!0}),l.removeEventListener(p5,d),GO.remove(p)},0)}}},[l,u,d,p]);const v=S.useCallback(m=>{if(!r&&!n||p.paused)return;const b=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,x=document.activeElement;if(b&&x){const w=m.currentTarget,[k,j]=Yne(w);k&&j?!m.shiftKey&&x===j?(m.preventDefault(),r&&jf(k,{select:!0})):m.shiftKey&&x===k&&(m.preventDefault(),r&&jf(j,{select:!0})):x===w&&m.preventDefault()}},[r,n,p.paused]);return i.jsx(_a.div,{tabIndex:-1,...s,ref:h,onKeyDown:v})});wT.displayName=Hne;function Vne(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(jf(n,{select:t}),document.activeElement!==r)return}function Yne(e){const t=N$(e),r=YO(t,e),n=YO(t.reverse(),e);return[r,n]}function N$(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function YO(e,t){for(const r of e)if(!Gne(r,{upTo:t}))return r}function Gne(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Kne(e){return e instanceof HTMLInputElement&&"select"in e}function jf(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Kne(e)&&t&&e.select()}}var GO=Qne();function Qne(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=KO(e,t),e.unshift(t)},remove(t){var r;e=KO(e,t),(r=e[0])==null||r.resume()}}}function KO(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Xne(e){return e.filter(t=>t.tagName!=="A")}var Zne="Portal",ST=S.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[o,a]=S.useState(!1);jh(()=>a(!0),[]);const s=r||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?LJ.createPortal(i.jsx(_a.div,{...n,ref:t}),s):null});ST.displayName=Zne;function Jne(e,t){return S.useReducer((r,n)=>t[r][n]??r,e)}var Sv=e=>{const{present:t,children:r}=e,n=eie(t),o=typeof r=="function"?r({present:n.isPresent}):S.Children.only(r),a=zl(n.ref,tie(o));return typeof r=="function"||n.isPresent?S.cloneElement(o,{ref:a}):null};Sv.displayName="Presence";function eie(e){const[t,r]=S.useState(),n=S.useRef({}),o=S.useRef(e),a=S.useRef("none"),s=e?"mounted":"unmounted",[l,c]=Jne(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{const u=D0(n.current);a.current=l==="mounted"?u:"none"},[l]),jh(()=>{const u=n.current,d=o.current;if(d!==e){const h=a.current,p=D0(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),jh(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=D0(n.current).includes(p.animationName);if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(a.current=D0(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:S.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function D0(e){return(e==null?void 0:e.animationName)||"none"}function tie(e){var n,o;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var h5=0;function R$(){S.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??QO()),document.body.insertAdjacentElement("beforeend",e[1]??QO()),h5++,()=>{h5===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),h5--}},[])}function QO(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Zc=function(){return Zc=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Zc.apply(this,arguments)};function L$(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function rie(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var z1="right-scroll-bar-position",M1="width-before-scroll-bar",nie="with-scroll-bars-hidden",iie="--removed-body-scroll-bar-size";function g5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function oie(e,t){var r=S.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var o=r.value;o!==n&&(r.value=n,r.callback(n,o))}}}})[0];return r.callback=t,r.facade}var aie=typeof window<"u"?S.useLayoutEffect:S.useEffect,XO=new WeakMap;function sie(e,t){var r=oie(null,function(n){return e.forEach(function(o){return g5(o,n)})});return aie(function(){var n=XO.get(r);if(n){var o=new Set(n),a=new Set(e),s=r.current;o.forEach(function(l){a.has(l)||g5(l,null)}),a.forEach(function(l){o.has(l)||g5(l,s)})}XO.set(r,e)},[e]),r}function lie(e){return e}function cie(e,t){t===void 0&&(t=lie);var r=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var s=t(a,n);return r.push(s),function(){r=r.filter(function(l){return l!==s})}},assignSyncMedium:function(a){for(n=!0;r.length;){var s=r;r=[],s.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){n=!0;var s=[];if(r.length){var l=r;r=[],l.forEach(a),s=r}var c=function(){var d=s;s=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){s.push(d),u()},filter:function(d){return s=s.filter(d),r}}}};return o}function uie(e){e===void 0&&(e={});var t=cie(null);return t.options=Zc({async:!0,ssr:!1},e),t}var F$=function(e){var t=e.sideCar,r=L$(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return S.createElement(n,Zc({},r))};F$.isSideCarExport=!0;function die(e,t){return e.useMedium(t),F$}var z$=uie(),m5=function(){},fS=S.forwardRef(function(e,t){var r=S.useRef(null),n=S.useState({onScrollCapture:m5,onWheelCapture:m5,onTouchMoveCapture:m5}),o=n[0],a=n[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,v=e.noIsolation,m=e.inert,b=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,k=e.gapMode,j=L$(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=h,T=sie([r,t]),A=Zc(Zc({},j),o);return S.createElement(S.Fragment,null,d&&S.createElement(_,{sideCar:z$,removeScrollBar:u,shards:f,noRelative:p,noIsolation:v,inert:m,setCallbacks:a,allowPinchZoom:!!b,lockRef:r,gapMode:k}),s?S.cloneElement(S.Children.only(l),Zc(Zc({},A),{ref:T})):S.createElement(w,Zc({},A,{className:c,ref:T}),l))});fS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fS.classNames={fullWidth:M1,zeroRight:z1};var fie=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function pie(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=fie();return t&&e.setAttribute("nonce",t),e}function hie(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gie(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var mie=function(){var e=0,t=null;return{add:function(r){e==0&&(t=pie())&&(hie(t,r),gie(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},vie=function(){var e=mie();return function(t,r){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},M$=function(){var e=vie(),t=function(r){var n=r.styles,o=r.dynamic;return e(n,o),null};return t},yie={left:0,top:0,right:0,gap:0},v5=function(e){return parseInt(e||"",10)||0},xie=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[v5(r),v5(n),v5(o)]},bie=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return yie;var t=xie(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},wie=M$(),fm="data-scroll-locked",Sie=function(e,t,r,n){var o=e.left,a=e.top,s=e.right,l=e.gap;return r===void 0&&(r="margin"),`
.`.concat(nie,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(l,"px ").concat(n,`;
}
body[`).concat(fm,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(o,`px;
padding-top: `).concat(a,`px;
padding-right: `).concat(s,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(l,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(z1,` {
right: `).concat(l,"px ").concat(n,`;
}
.`).concat(M1,` {
margin-right: `).concat(l,"px ").concat(n,`;
}
.`).concat(z1," .").concat(z1,` {
right: 0 `).concat(n,`;
}
.`).concat(M1," .").concat(M1,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(fm,`] {
`).concat(iie,": ").concat(l,`px;
}
`)},ZO=function(){var e=parseInt(document.body.getAttribute(fm)||"0",10);return isFinite(e)?e:0},jie=function(){S.useEffect(function(){return document.body.setAttribute(fm,(ZO()+1).toString()),function(){var e=ZO()-1;e<=0?document.body.removeAttribute(fm):document.body.setAttribute(fm,e.toString())}},[])},kie=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n;jie();var a=S.useMemo(function(){return bie(o)},[o]);return S.createElement(wie,{styles:Sie(a,!t,o,r?"":"!important")})},O3=!1;if(typeof window<"u")try{var B0=Object.defineProperty({},"passive",{get:function(){return O3=!0,!0}});window.addEventListener("test",B0,B0),window.removeEventListener("test",B0,B0)}catch{O3=!1}var Ig=O3?{passive:!1}:!1,_ie=function(e){return e.tagName==="TEXTAREA"},D$=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!_ie(e)&&r[t]==="visible")},Cie=function(e){return D$(e,"overflowY")},Eie=function(e){return D$(e,"overflowX")},JO=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=B$(e,n);if(o){var a=W$(e,n),s=a[1],l=a[2];if(s>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Aie=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},Tie=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},B$=function(e,t){return e==="v"?Cie(t):Eie(t)},W$=function(e,t){return e==="v"?Aie(t):Tie(t)},Pie=function(e,t){return e==="h"&&t==="rtl"?-1:1},Iie=function(e,t,r,n,o){var a=Pie(e,window.getComputedStyle(t).direction),s=a*n,l=r.target,c=t.contains(l),u=!1,d=s>0,f=0,h=0;do{if(!l)break;var p=W$(e,l),v=p[0],m=p[1],b=p[2],x=m-b-a*v;(v||x)&&B$(e,l)&&(f+=x,h+=v);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},W0=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},eN=function(e){return[e.deltaX,e.deltaY]},tN=function(e){return e&&"current"in e?e.current:e},Oie=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Nie=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},Rie=0,Og=[];function Lie(e){var t=S.useRef([]),r=S.useRef([0,0]),n=S.useRef(),o=S.useState(Rie++)[0],a=S.useState(M$)[0],s=S.useRef(e);S.useEffect(function(){s.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=rie([e.lockRef.current],(e.shards||[]).map(tN),!0).filter(Boolean);return m.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=S.useCallback(function(m,b){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var x=W0(m),w=r.current,k="deltaX"in m?m.deltaX:w[0]-x[0],j="deltaY"in m?m.deltaY:w[1]-x[1],_,T=m.target,A=Math.abs(k)>Math.abs(j)?"h":"v";if("touches"in m&&A==="h"&&T.type==="range")return!1;var P=window.getSelection(),N=P&&P.anchorNode,O=N?N===T||N.contains(T):!1;if(O)return!1;var C=JO(A,T);if(!C)return!0;if(C?_=A:(_=A==="v"?"h":"v",C=JO(A,T)),!C)return!1;if(!n.current&&"changedTouches"in m&&(k||j)&&(n.current=_),!_)return!0;var I=n.current||_;return Iie(I,b,m,I==="h"?k:j)},[]),c=S.useCallback(function(m){var b=m;if(!(!Og.length||Og[Og.length-1]!==a)){var x="deltaY"in b?eN(b):W0(b),w=t.current.filter(function(_){return _.name===b.type&&(_.target===b.target||b.target===_.shadowParent)&&Oie(_.delta,x)})[0];if(w&&w.should){b.cancelable&&b.preventDefault();return}if(!w){var k=(s.current.shards||[]).map(tN).filter(Boolean).filter(function(_){return _.contains(b.target)}),j=k.length>0?l(b,k[0]):!s.current.noIsolation;j&&b.cancelable&&b.preventDefault()}}},[]),u=S.useCallback(function(m,b,x,w){var k={name:m,delta:b,target:x,should:w,shadowParent:Fie(x)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(j){return j!==k})},1)},[]),d=S.useCallback(function(m){r.current=W0(m),n.current=void 0},[]),f=S.useCallback(function(m){u(m.type,eN(m),m.target,l(m,e.lockRef.current))},[]),h=S.useCallback(function(m){u(m.type,W0(m),m.target,l(m,e.lockRef.current))},[]);S.useEffect(function(){return Og.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Ig),document.addEventListener("touchmove",c,Ig),document.addEventListener("touchstart",d,Ig),function(){Og=Og.filter(function(m){return m!==a}),document.removeEventListener("wheel",c,Ig),document.removeEventListener("touchmove",c,Ig),document.removeEventListener("touchstart",d,Ig)}},[]);var p=e.removeScrollBar,v=e.inert;return S.createElement(S.Fragment,null,v?S.createElement(a,{styles:Nie(o)}):null,p?S.createElement(kie,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Fie(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const zie=die(z$,Lie);var jT=S.forwardRef(function(e,t){return S.createElement(fS,Zc({},e,{ref:t,sideCar:zie}))});jT.classNames=fS.classNames;var Mie=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ng=new WeakMap,q0=new WeakMap,$0={},y5=0,q$=function(e){return e&&(e.host||q$(e.parentNode))},Die=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=q$(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Bie=function(e,t,r,n){var o=Die(t,Array.isArray(e)?e:[e]);$0[r]||($0[r]=new WeakMap);var a=$0[r],s=[],l=new Set,c=new Set(o),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};o.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(n),v=p!==null&&p!=="false",m=(Ng.get(h)||0)+1,b=(a.get(h)||0)+1;Ng.set(h,m),a.set(h,b),s.push(h),m===1&&v&&q0.set(h,!0),b===1&&h.setAttribute(r,"true"),v||h.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return d(t),l.clear(),y5++,function(){s.forEach(function(f){var h=Ng.get(f)-1,p=a.get(f)-1;Ng.set(f,h),a.set(f,p),h||(q0.has(f)||f.removeAttribute(n),q0.delete(f)),p||f.removeAttribute(r)}),y5--,y5||(Ng=new WeakMap,Ng=new WeakMap,q0=new WeakMap,$0={})}},$$=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=Mie(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),Bie(n,o,r,"aria-hidden")):function(){return null}},kT="Dialog",[U$]=uS(kT),[Wie,bc]=U$(kT),H$=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=S.useRef(null),c=S.useRef(null),[u=!1,d]=xT({prop:n,defaultProp:o,onChange:a});return i.jsx(Wie,{scope:t,triggerRef:l,contentRef:c,contentId:F1(),titleId:F1(),descriptionId:F1(),open:u,onOpenChange:d,onOpenToggle:S.useCallback(()=>d(f=>!f),[d]),modal:s,children:r})};H$.displayName=kT;var V$="DialogTrigger",qie=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(V$,r),a=zl(t,o.triggerRef);return i.jsx(_a.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ET(o.open),...n,ref:a,onClick:hs(e.onClick,o.onOpenToggle)})});qie.displayName=V$;var _T="DialogPortal",[$ie,Y$]=U$(_T,{forceMount:void 0}),G$=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:o}=e,a=bc(_T,t);return i.jsx($ie,{scope:t,forceMount:r,children:S.Children.map(n,s=>i.jsx(Sv,{present:r||a.open,children:i.jsx(ST,{asChild:!0,container:o,children:s})}))})};G$.displayName=_T;var o2="DialogOverlay",K$=S.forwardRef((e,t)=>{const r=Y$(o2,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=bc(o2,e.__scopeDialog);return a.modal?i.jsx(Sv,{present:n||a.open,children:i.jsx(Uie,{...o,ref:t})}):null});K$.displayName=o2;var Uie=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(o2,r);return i.jsx(jT,{as:dS,allowPinchZoom:!0,shards:[o.contentRef],children:i.jsx(_a.div,{"data-state":ET(o.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),kh="DialogContent",Q$=S.forwardRef((e,t)=>{const r=Y$(kh,e.__scopeDialog),{forceMount:n=r.forceMount,...o}=e,a=bc(kh,e.__scopeDialog);return i.jsx(Sv,{present:n||a.open,children:a.modal?i.jsx(Hie,{...o,ref:t}):i.jsx(Vie,{...o,ref:t})})});Q$.displayName=kh;var Hie=S.forwardRef((e,t)=>{const r=bc(kh,e.__scopeDialog),n=S.useRef(null),o=zl(t,r.contentRef,n);return S.useEffect(()=>{const a=n.current;if(a)return $$(a)},[]),i.jsx(X$,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hs(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),(s=r.triggerRef.current)==null||s.focus()}),onPointerDownOutside:hs(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0;(s.button===2||l)&&a.preventDefault()}),onFocusOutside:hs(e.onFocusOutside,a=>a.preventDefault())})}),Vie=S.forwardRef((e,t)=>{const r=bc(kh,e.__scopeDialog),n=S.useRef(!1),o=S.useRef(!1);return i.jsx(X$,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(s))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),X$=S.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,...s}=e,l=bc(kh,r),c=S.useRef(null),u=zl(t,c);return R$(),i.jsxs(i.Fragment,{children:[i.jsx(wT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(bT,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ET(l.open),...s,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(Gie,{titleId:l.titleId}),i.jsx(Qie,{contentRef:c,descriptionId:l.descriptionId})]})]})}),CT="DialogTitle",Z$=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(CT,r);return i.jsx(_a.h2,{id:o.titleId,...n,ref:t})});Z$.displayName=CT;var J$="DialogDescription",Yie=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(J$,r);return i.jsx(_a.p,{id:o.descriptionId,...n,ref:t})});Yie.displayName=J$;var eU="DialogClose",tU=S.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,o=bc(eU,r);return i.jsx(_a.button,{type:"button",...n,ref:t,onClick:hs(e.onClick,()=>o.onOpenChange(!1))})});tU.displayName=eU;function ET(e){return e?"open":"closed"}var rU="DialogTitleWarning",[bFe,nU]=Cne(rU,{contentName:kh,titleName:CT,docsSlug:"dialog"}),Gie=({titleId:e})=>{const t=nU(rU),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return S.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Kie="DialogDescriptionWarning",Qie=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${nU(Kie).contentName}}.`;return S.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},iU=H$,oU=G$,aU=K$,sU=Q$,lU=Z$,cU=tU;function uU(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=uU(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Fr(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=uU(e))&&(n&&(n+=" "),n+=t);return n}const AT="-",Xie=e=>{const t=Jie(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{const l=s.split(AT);return l[0]===""&&l.length!==1&&l.shift(),dU(l,t)||Zie(s)},getConflictingClassGroupIds:(s,l)=>{const c=r[s]||[];return l&&n[s]?[...c,...n[s]]:c}}},dU=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?dU(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(AT);return(s=t.validators.find(({validator:l})=>l(a)))==null?void 0:s.classGroupId},rN=/^\[(.+)\]$/,Zie=e=>{if(rN.test(e)){const t=rN.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Jie=e=>{const{theme:t,classGroups:r}=e,n={nextPart:new Map,validators:[]};for(const o in r)N3(r[o],n,o,t);return n},N3=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:nN(t,o);a.classGroupId=r;return}if(typeof o=="function"){if(eoe(o)){N3(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([a,s])=>{N3(s,nN(t,a),r,n)})})},nN=(e,t)=>{let r=e;return t.split(AT).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},eoe=e=>e.isThemeGetter,toe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(a,s)=>{r.set(a,s),t++,t>e&&(t=0,n=r,r=new Map)};return{get(a){let s=r.get(a);if(s!==void 0)return s;if((s=n.get(a))!==void 0)return o(a,s),s},set(a,s){r.has(a)?r.set(a,s):o(a,s)}}},R3="!",L3=":",roe=L3.length,noe=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=o=>{const a=[];let s=0,l=0,c=0,u;for(let v=0;v<o.length;v++){let m=o[v];if(s===0&&l===0){if(m===L3){a.push(o.slice(c,v)),c=v+roe;continue}if(m==="/"){u=v;continue}}m==="["?s++:m==="]"?s--:m==="("?l++:m===")"&&l--}const d=a.length===0?o:o.substring(c),f=ioe(d),h=f!==d,p=u&&u>c?u-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}};if(t){const o=t+L3,a=n;n=s=>s.startsWith(o)?a(s.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:s,maybePostfixModifierPosition:void 0}}if(r){const o=n;n=a=>r({className:a,parseClassName:o})}return n},ioe=e=>e.endsWith(R3)?e.substring(0,e.length-1):e.startsWith(R3)?e.substring(1):e,ooe=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const o=[];let a=[];return n.forEach(s=>{s[0]==="["||t[s]?(o.push(...a.sort(),s),a=[]):a.push(s)}),o.push(...a.sort()),o}},aoe=e=>({cache:toe(e.cacheSize),parseClassName:noe(e),sortModifiers:ooe(e),...Xie(e)}),soe=/\s+/,loe=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:a}=t,s=[],l=e.trim().split(soe);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:m}=r(d);if(f){c=d+(c.length>0?" "+c:c);continue}let b=!!m,x=n(b?v.substring(0,m):v);if(!x){if(!b){c=d+(c.length>0?" "+c:c);continue}if(x=n(v),!x){c=d+(c.length>0?" "+c:c);continue}b=!1}const w=a(h).join(":"),k=p?w+R3:w,j=k+x;if(s.includes(j))continue;s.push(j);const _=o(x,b);for(let T=0;T<_.length;++T){const A=_[T];s.push(k+A)}c=d+(c.length>0?" "+c:c)}return c};function coe(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=fU(t))&&(n&&(n+=" "),n+=r);return n}const fU=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=fU(e[n]))&&(r&&(r+=" "),r+=t);return r};function uoe(e,...t){let r,n,o,a=s;function s(c){const u=t.reduce((d,f)=>f(d),e());return r=aoe(u),n=r.cache.get,o=r.cache.set,a=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=loe(c,r);return o(c,d),d}return function(){return a(coe.apply(null,arguments))}}const co=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},pU=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hU=/^\((?:(\w[\w-]*):)?(.+)\)$/i,doe=/^\d+\/\d+$/,foe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,poe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hoe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,goe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,moe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rg=e=>doe.test(e),Br=e=>!!e&&!Number.isNaN(Number(e)),mf=e=>!!e&&Number.isInteger(Number(e)),x5=e=>e.endsWith("%")&&Br(e.slice(0,-1)),Vu=e=>foe.test(e),voe=()=>!0,yoe=e=>poe.test(e)&&!hoe.test(e),gU=()=>!1,xoe=e=>goe.test(e),boe=e=>moe.test(e),woe=e=>!nr(e)&&!ir(e),Soe=e=>jv(e,yU,gU),nr=e=>pU.test(e),Ip=e=>jv(e,xU,yoe),b5=e=>jv(e,Eoe,Br),iN=e=>jv(e,mU,gU),joe=e=>jv(e,vU,boe),U0=e=>jv(e,bU,xoe),ir=e=>hU.test(e),vy=e=>kv(e,xU),koe=e=>kv(e,Aoe),oN=e=>kv(e,mU),_oe=e=>kv(e,yU),Coe=e=>kv(e,vU),H0=e=>kv(e,bU,!0),jv=(e,t,r)=>{const n=pU.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},kv=(e,t,r=!1)=>{const n=hU.exec(e);return n?n[1]?t(n[1]):r:!1},mU=e=>e==="position"||e==="percentage",vU=e=>e==="image"||e==="url",yU=e=>e==="length"||e==="size"||e==="bg-size",xU=e=>e==="length",Eoe=e=>e==="number",Aoe=e=>e==="family-name",bU=e=>e==="shadow",Toe=()=>{const e=co("color"),t=co("font"),r=co("text"),n=co("font-weight"),o=co("tracking"),a=co("leading"),s=co("breakpoint"),l=co("container"),c=co("spacing"),u=co("radius"),d=co("shadow"),f=co("inset-shadow"),h=co("text-shadow"),p=co("drop-shadow"),v=co("blur"),m=co("perspective"),b=co("aspect"),x=co("ease"),w=co("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...j(),ir,nr],T=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],P=()=>[ir,nr,c],N=()=>[Rg,"full","auto",...P()],O=()=>[mf,"none","subgrid",ir,nr],C=()=>["auto",{span:["full",mf,ir,nr]},mf,ir,nr],I=()=>[mf,"auto",ir,nr],R=()=>["auto","min","max","fr",ir,nr],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...P()],X=()=>[Rg,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],$=()=>[e,ir,nr],ee=()=>[...j(),oN,iN,{position:[ir,nr]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",_oe,Soe,{size:[ir,nr]}],z=()=>[x5,vy,Ip],q=()=>["","none","full",u,ir,nr],G=()=>["",Br,vy,Ip],U=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Br,x5,oN,iN],re=()=>["","none",v,ir,nr],H=()=>["none",Br,ir,nr],ie=()=>["none",Br,ir,nr],de=()=>[Br,ir,nr],le=()=>[Rg,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vu],breakpoint:[Vu],color:[voe],container:[Vu],"drop-shadow":[Vu],ease:["in","out","in-out"],font:[woe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vu],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vu],shadow:[Vu],spacing:["px",Br],text:[Vu],"text-shadow":[Vu],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rg,nr,ir,b]}],container:["container"],columns:[{columns:[Br,nr,ir,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[mf,"auto",ir,nr]}],basis:[{basis:[Rg,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Br,Rg,"auto","initial","none",nr]}],grow:[{grow:["",Br,ir,nr]}],shrink:[{shrink:["",Br,ir,nr]}],order:[{order:[mf,"first","last","none",ir,nr]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],w:[{w:[l,"screen",...X()]}],"min-w":[{"min-w":[l,"screen","none",...X()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[s]},...X()]}],h:[{h:["screen",...X()]}],"min-h":[{"min-h":["screen","none",...X()]}],"max-h":[{"max-h":["screen",...X()]}],"font-size":[{text:["base",r,vy,Ip]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,ir,b5]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",x5,nr]}],"font-family":[{font:[koe,nr,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ir,nr]}],"line-clamp":[{"line-clamp":[Br,"none",ir,b5]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",ir,nr]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ir,nr]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[Br,"from-font","auto",ir,Ip]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Br,"auto",ir,nr]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ir,nr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ir,nr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mf,ir,nr],radial:["",ir,nr],conic:[mf,ir,nr]},Coe,joe]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Br,ir,nr]}],"outline-w":[{outline:["",Br,vy,Ip]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,H0,U0]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,H0,U0]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Br,Ip]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",h,H0,U0]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Br,ir,nr]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Br]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[ir,nr]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[Br]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ir,nr]}],filter:[{filter:["","none",ir,nr]}],blur:[{blur:re()}],brightness:[{brightness:[Br,ir,nr]}],contrast:[{contrast:[Br,ir,nr]}],"drop-shadow":[{"drop-shadow":["","none",p,H0,U0]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Br,ir,nr]}],"hue-rotate":[{"hue-rotate":[Br,ir,nr]}],invert:[{invert:["",Br,ir,nr]}],saturate:[{saturate:[Br,ir,nr]}],sepia:[{sepia:["",Br,ir,nr]}],"backdrop-filter":[{"backdrop-filter":["","none",ir,nr]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[Br,ir,nr]}],"backdrop-contrast":[{"backdrop-contrast":[Br,ir,nr]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Br,ir,nr]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Br,ir,nr]}],"backdrop-invert":[{"backdrop-invert":["",Br,ir,nr]}],"backdrop-opacity":[{"backdrop-opacity":[Br,ir,nr]}],"backdrop-saturate":[{"backdrop-saturate":[Br,ir,nr]}],"backdrop-sepia":[{"backdrop-sepia":["",Br,ir,nr]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ir,nr]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Br,"initial",ir,nr]}],ease:[{ease:["linear","initial",x,ir,nr]}],delay:[{delay:[Br,ir,nr]}],animate:[{animate:["none",w,ir,nr]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ir,nr]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:de()}],"skew-x":[{"skew-x":de()}],"skew-y":[{"skew-y":de()}],transform:[{transform:[ir,nr,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ir,nr]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ir,nr]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Br,vy,Ip,b5]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Poe=uoe(Toe);function ea(...e){return Poe(Fr(e))}function Ioe({...e}){return i.jsx(iU,{"data-slot":"dialog",...e})}function Ooe({...e}){return i.jsx(oU,{"data-slot":"dialog-portal",...e})}const wU=S.forwardRef(({className:e,...t},r)=>i.jsx(aU,{ref:r,"data-slot":"dialog-overlay",className:ea("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t}));wU.displayName="DialogOverlay";function Noe({className:e,children:t,...r}){return i.jsxs(Ooe,{"data-slot":"dialog-portal",children:[i.jsx(wU,{}),i.jsxs(sU,{"data-slot":"dialog-content",className:ea("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,i.jsxs(cU,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[i.jsx(Gt,{}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Roe({className:e,...t}){return i.jsx("div",{"data-slot":"dialog-header",className:ea("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Loe({className:e,...t}){return i.jsx(lU,{"data-slot":"dialog-title",className:ea("text-lg leading-none font-semibold",e),...t})}function Foe({open:e,onOpenChange:t,title:r,children:n,contentClassName:o}){return i.jsx(Ioe,{open:e,onOpenChange:t,children:i.jsxs(Noe,{className:o,children:[r&&i.jsx(Roe,{children:i.jsx(Loe,{children:r})}),n]})})}function aN({icon:e,title:t,description:r,action:n,style:o}){return i.jsxs("div",{style:{textAlign:"center",padding:"48px 24px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",background:"var(--card)",...o},children:[e&&i.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 16px",color:"var(--muted)"},children:e}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"8px"},children:t}),r&&i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"20px",maxWidth:"360px",margin:"0 auto 20px"},children:r}),n]})}function _h({message:e="Loading…",style:t}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"12px",padding:"48px 24px",...t},children:[i.jsx("div",{style:{width:"32px",height:"32px",border:"3px solid var(--border)",borderTopColor:"var(--primary)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e}),i.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]})}class zoe extends S.Component{constructor(){super(...arguments);yn(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){var o,a;(a=(o=this.props).onError)==null||a.call(o,r,n)}render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:i.jsxs("div",{style:{padding:"24px",margin:"24px",border:"1px solid var(--destructive)",borderRadius:"var(--radius-card)",background:"#fef2f2",color:"var(--destructive)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[i.jsx(Wh,{size:20}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-base)"},children:"Something went wrong"})]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",margin:0},children:this.state.error.message})]}):this.props.children}}function Moe(){return S.useSyncExternalStore(Uee,LO,LO)?i.jsxs("div",{role:"status","aria-live":"polite","aria-busy":"true","aria-label":"Please wait",style:{position:"fixed",inset:0,zIndex:1e5,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(15, 23, 42, 0.45)",backdropFilter:"blur(2px)",pointerEvents:"all"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px",padding:"28px 36px",borderRadius:"var(--radius-card)",background:"var(--card)",border:"1px solid var(--border)",boxShadow:"var(--elevation-sm)",minWidth:"200px"},children:[i.jsx("div",{style:{width:"36px",height:"36px",border:"3px solid var(--border)",borderTopColor:"var(--primary)",borderRadius:"50%",animation:"eb-global-spin 0.8s linear infinite"}}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Please wait"})]}),i.jsx("style",{children:"@keyframes eb-global-spin { to { transform: rotate(360deg); } }"})]}):null}const Ao={p10df6080:"M37.7893 38.8274C36.0748 38.8274 34.6629 38.4744 33.5536 37.7684C32.4778 37.0289 31.6879 36.054 31.1836 34.8438C30.6794 33.6336 30.4272 32.3225 30.4272 30.9106C30.4272 29.9694 30.4777 29.0113 30.5785 28.0364C30.713 27.0615 30.8642 26.1371 31.0323 25.263L34.1587 10.4381H43.689L40.5122 25.616C40.4114 26.053 40.3105 26.6077 40.2097 27.28C40.1088 27.9188 40.0584 28.5239 40.0584 29.0953C40.0584 29.8013 40.2433 30.3392 40.6131 30.7089C40.9829 31.0451 41.4199 31.2132 41.9241 31.2132C42.4956 31.2132 43.0503 30.9611 43.5882 30.4568C44.1596 29.9526 44.6975 29.1626 45.2018 28.0868C45.706 27.0111 46.1262 25.6496 46.4624 24.0024L49.3366 10.4381H58.8669L52.9672 38.3231H45.353L45.6556 34.4404H45.4539C44.8488 35.4825 44.1765 36.3229 43.4369 36.9616C42.6973 37.6004 41.8569 38.071 40.9156 38.3735C40.008 38.6761 38.9659 38.8274 37.7893 38.8274Z",p142b6380:"M31.0583 13.3131C31.4698 13.0263 32.0388 13.1259 32.2977 13.5556C33.4072 15.3973 34.0662 17.4753 34.2208 19.6197C34.2569 20.1201 33.8493 20.5294 33.3477 20.5322V20.5322C32.846 20.5349 32.4408 20.1299 32.3996 19.6299C32.2533 17.8536 31.7076 16.1329 30.8035 14.5969C30.549 14.1646 30.6467 13.6 31.0583 13.3131V13.3131Z",p1674a600:"M53.2547 29.9849C53.3365 27.5678 52.774 25.1726 51.6264 23.0438C50.4786 20.9149 48.7858 19.1285 46.7213 17.8684C44.6571 16.6085 42.2954 15.9192 39.8775 15.8715C37.4595 15.8238 35.0718 16.4192 32.9594 17.5968C30.8471 18.7745 29.0848 20.4922 27.854 22.5741C26.6232 24.6561 25.9672 27.0281 25.9537 29.4466C25.9407 31.7765 26.5261 34.0685 27.6484 36.107L27.6474 36.1073L27.6618 36.1307C27.7003 36.2002 27.7376 36.2704 27.7774 36.3394L27.7828 36.3369L35.9118 50.1145C37.7038 49.0572 38.2991 46.7469 37.2418 44.9548L31.0476 34.4551L31.0598 34.4478C30.1875 32.9338 29.7328 31.2149 29.7426 29.4677C29.7524 27.7203 30.2264 26.0069 31.1156 24.5027C32.0048 22.9986 33.2778 21.7579 34.8038 20.907C36.3301 20.0561 38.0556 19.6251 39.8027 19.6596C41.5497 19.6941 43.2565 20.1923 44.748 21.1027C46.2394 22.013 47.4622 23.3033 48.2914 24.8413C49.1207 26.3794 49.5268 28.1107 49.4676 29.8572C49.4084 31.6035 48.8866 33.3032 47.9553 34.7816L47.9627 34.7867L37.0389 53.7059C35.9959 55.5125 36.6149 57.8227 38.4215 58.8657L51.1614 36.8009C52.4505 34.7545 53.1729 32.402 53.2547 29.9849Z",p1945f480:"M63.6456 33.23L69.3941 6.35351H71.8649L70.9068 12.3541H70.9573C71.5624 11.3792 72.3355 10.4043 73.2768 9.42944C74.2181 8.42094 75.3442 7.58052 76.6553 6.90819C77.9663 6.20224 79.4287 5.84926 81.0423 5.84926C82.4878 5.84926 83.7148 6.11819 84.7233 6.65606C85.7654 7.16031 86.5554 7.89988 87.0933 8.87476C87.6311 9.84965 87.9001 11.0598 87.9001 12.5054C87.9001 13.1105 87.8496 13.766 87.7488 14.4719C87.6816 15.1779 87.5807 15.8166 87.4462 16.3881L83.8156 33.23H80.8406L84.4712 16.0351C84.6392 15.3628 84.7569 14.7745 84.8241 14.2702C84.8914 13.766 84.925 13.2954 84.925 12.8583C84.925 11.3456 84.5216 10.2362 83.7148 9.53029C82.9416 8.82434 81.8154 8.47136 80.3363 8.47136C78.8572 8.47136 77.378 8.9588 75.8989 9.93369C74.4198 10.875 73.0919 12.2364 71.9153 14.0181C70.7724 15.7998 69.932 17.9513 69.3941 20.4725L66.6711 33.23H63.6456Z",p1e5a9f00:"M21.5276 21.5276C21.5276 18.7006 20.9708 15.9012 19.8889 13.2893C18.8071 10.6775 17.2213 8.30431 15.2223 6.30529C13.2233 4.30626 10.8501 2.72055 8.23826 1.63869C5.62641 0.556826 2.82705 -8.70599e-07 0 0L1.3922e-06 4.5208C2.23337 4.5208 4.44486 4.96069 6.50822 5.81536C8.57159 6.67003 10.4464 7.92274 12.0256 9.50197C13.6049 11.0812 14.8576 12.956 15.7122 15.0194C16.5669 17.0827 17.0068 19.2942 17.0068 21.5276H21.5276Z",p24dd2380:"M15.6318 38.8273C14.6905 38.8273 13.8333 38.7096 13.0601 38.4743C12.3206 38.239 11.6146 37.8524 10.9423 37.3145C10.3036 36.7766 9.64805 36.0875 8.97571 35.2471H8.77401L7.56381 38.323H6.10352e-05L8.11849 0H17.6488L16.4386 5.69803C16.2369 6.70653 16.0016 7.69822 15.7327 8.67311C15.4637 9.61437 15.1948 10.4716 14.9259 11.2448C14.6569 12.018 14.4216 12.6399 14.2199 13.1105H14.4216C14.8586 12.5726 15.3125 12.0684 15.7831 11.5978C16.2537 11.0935 16.8252 10.6901 17.4975 10.3876C18.1699 10.085 19.0271 9.93373 20.0692 9.93373C21.5147 9.93373 22.8258 10.2699 24.0024 10.9422C25.2126 11.6146 26.1706 12.7239 26.8766 14.2703C27.6162 15.8166 27.9859 17.9177 27.9859 20.5734C27.9859 21.9181 27.8179 23.414 27.4817 25.0612C27.1791 26.7084 26.7085 28.3389 26.0698 29.9525C25.4311 31.5661 24.6243 33.0452 23.6494 34.3899C22.6745 35.7345 21.5147 36.8103 20.1701 37.6171C18.8254 38.4239 17.3126 38.8273 15.6318 38.8273ZM13.3123 31.1627C13.8501 31.1627 14.3544 30.9778 14.825 30.608C15.3293 30.2046 15.7831 29.6835 16.1865 29.0448C16.5899 28.3725 16.9429 27.6161 17.2454 26.7757C17.5816 25.9016 17.8337 24.9772 18.0018 24.0023C18.1699 23.0274 18.2539 22.0693 18.2539 21.1281C18.2539 19.9851 18.069 19.1111 17.6992 18.506C17.3631 17.9009 16.842 17.5983 16.1361 17.5983C15.6318 17.5983 15.1612 17.7496 14.7242 18.0522C14.3208 18.3547 13.9342 18.7749 13.5644 19.3128C13.2282 19.817 12.9257 20.4053 12.6567 21.0777C12.3878 21.75 12.1525 22.4559 11.9508 23.1955C11.7827 23.9351 11.6482 24.6915 11.5474 25.4646C11.4465 26.2042 11.3961 26.927 11.3961 27.6329C11.3961 28.675 11.5474 29.5323 11.8499 30.2046C12.1861 30.8433 12.6735 31.1627 13.3123 31.1627Z",p2c694f80:"M48.5463 14.0889C48.1347 13.8021 47.5657 13.9017 47.3069 14.3314C46.3407 15.9351 45.7146 17.7206 45.4677 19.5764C45.4015 20.0737 45.7836 20.5069 46.2842 20.5398V20.5398C46.7848 20.5728 47.2137 20.1929 47.2849 19.6963C47.5039 18.1702 48.019 16.7014 48.8011 15.3727C49.0555 14.9404 48.9578 14.3758 48.5463 14.0889V14.0889Z",p2fc98c00:"M56.3998 38.3231L57.4588 32.8772L69.8129 17.8001H61.2407L62.9047 10.4381H82.873L81.5619 16.3882L69.3591 30.9611H78.7886L77.175 38.3231H56.3998Z",p30ec5580:"M78.8566 38.3231L79.9155 32.8772L92.2697 17.8001H83.6974L85.3614 10.4381H105.33L104.019 16.3882L91.8158 30.9611H101.245L99.6317 38.3231H78.8566Z",p33b7c800:"M53.7052 24.2408C55.6176 22.6016 57.9466 21.5226 60.4336 21.1246C62.9206 20.7266 65.4696 21.0249 67.7979 21.9852C70.1261 22.9455 72.1434 24.5309 73.6266 26.5663C75.1098 28.602 76.0016 31.0087 76.2024 33.5194C76.4031 36.03 75.9053 38.5473 74.7644 40.7927C73.6234 43.0382 71.8832 44.9243 69.737 46.2425C67.6663 47.5142 65.2953 48.2073 62.869 48.2567L62.8692 48.2576L62.8458 48.2568C62.7651 48.2583 62.6843 48.262 62.6035 48.2621L62.6027 48.2552L49.4801 48.1318C49.4996 46.0511 51.2025 44.3796 53.2832 44.3992L62.6 44.4869L62.6002 44.4727C64.4199 44.471 66.2041 43.966 67.7547 43.0137C69.3051 42.0613 70.5624 40.6984 71.3867 39.0762C72.2108 37.4541 72.5703 35.6354 72.4254 33.8217C72.2803 32.0078 71.6363 30.2688 70.5647 28.7981C69.493 27.3274 68.0347 26.1813 66.3524 25.4875C64.6702 24.7937 62.8287 24.5792 61.0319 24.8668C59.2352 25.1544 57.5531 25.9333 56.1715 27.1175C54.7898 28.3017 53.7621 29.845 53.203 31.5768L49.5972 30.4127C50.371 28.0159 51.793 25.8799 53.7052 24.2408Z",p3763d600:"M25.2927 33.23L21.6621 6.40394H24.5364L26.7551 23.7501C26.8895 24.5569 26.9904 25.3974 27.0576 26.2714C27.1249 27.1454 27.1921 27.969 27.2593 28.7422C27.3266 29.4818 27.3602 30.1205 27.3602 30.6584H27.5114C27.8476 29.9524 28.2006 29.2129 28.5704 28.4397C28.9738 27.6329 29.3772 26.8261 29.7806 26.0193C30.184 25.1789 30.5874 24.4057 30.9908 23.6997L40.6724 6.40394H43.7483L28.7216 33.23H25.2927Z",p37f9b00:"M28.0432 34.0512C29.248 36.0968 30.9683 37.7905 33.0324 38.9632C35.0965 40.136 37.4322 40.7467 39.8061 40.7343C42.1801 40.722 44.5093 40.0871 46.5611 38.893C48.613 37.699 50.3156 35.9875 51.4991 33.9295L49.6351 32.8576C48.6392 34.5895 47.2063 36.0297 45.4796 37.0346C43.7529 38.0395 41.7928 38.5738 39.795 38.5841C37.7972 38.5945 35.8317 38.0806 34.0946 37.0937C32.3576 36.1068 30.9099 34.6814 29.896 32.96L28.0432 34.0512Z",p48e8300:"M51.5881 33.7343C49.7728 33.7343 48.1424 33.3645 46.6969 32.625C45.2514 31.8518 44.1084 30.7088 43.268 29.1961C42.4612 27.6833 42.0578 25.784 42.0578 23.498C42.0578 21.2121 42.3772 19.027 43.0159 16.9428C43.6882 14.8249 44.6295 12.9424 45.8397 11.2952C47.0835 9.61436 48.529 8.30331 50.1762 7.36204C51.8235 6.38715 53.6556 5.89971 55.6726 5.89971C57.8577 5.89971 59.5553 6.45439 60.7655 7.56374C62.0093 8.63947 62.6312 10.085 62.6312 11.9003C62.6312 13.413 62.2614 14.7409 61.5219 15.8839C60.7823 16.9932 59.7066 17.9177 58.2947 18.6572C56.9164 19.3968 55.2187 19.9683 53.2017 20.3717C51.2184 20.7415 48.9492 20.9264 46.3944 20.9264H45.1337C45.1001 21.2625 45.0665 21.6659 45.0329 22.1366C44.9993 22.5736 44.9825 23.0106 44.9825 23.4476C44.9825 25.9353 45.6044 27.8682 46.8482 29.2465C48.092 30.5912 49.8401 31.2635 52.0924 31.2635C53.4707 31.2635 54.7313 31.0786 55.8743 30.7088C57.0172 30.339 58.1266 29.902 59.2023 29.3978V31.9694C58.1938 32.4401 57.0509 32.8603 55.7734 33.2301C54.5296 33.5662 53.1345 33.7343 51.5881 33.7343ZM46.949 18.506C49.3694 18.506 51.5545 18.3043 53.5043 17.9009C55.4541 17.4639 56.9836 16.7747 58.093 15.8334C59.2359 14.8586 59.8074 13.6147 59.8074 12.102C59.8074 11.0263 59.4376 10.1354 58.6981 9.42947C57.9921 8.72352 56.8996 8.37054 55.4204 8.37054C54.0758 8.37054 52.7311 8.77394 51.3864 9.58074C50.0754 10.3539 48.8988 11.4969 47.8567 13.0096C46.8146 14.5224 46.0414 16.3545 45.5371 18.506H46.949Z",p5358df0:"M13.382 21.5276C13.382 19.7702 13.0359 18.0301 12.3634 16.4065C11.6909 14.7829 10.7052 13.3077 9.46252 12.0651C8.21989 10.8224 6.74466 9.83673 5.12108 9.16422C3.4975 8.49172 1.75735 8.14558 2.50846e-06 8.14558L3.90565e-06 12.6826C1.16155 12.6826 2.31172 12.9114 3.38485 13.3559C4.45797 13.8004 5.43304 14.4519 6.25438 15.2732C7.07571 16.0946 7.72723 17.0696 8.17173 18.1428C8.61624 19.2159 8.84502 20.3661 8.84502 21.5276H13.382Z",p6535700:"M9.5304 33.7343C7.7151 33.7343 6.08469 33.3645 4.63917 32.625C3.19366 31.8518 2.05069 30.7088 1.21027 29.1961C0.403473 27.6833 7.30464e-05 25.784 7.30464e-05 23.498C7.30464e-05 21.2121 0.319431 19.027 0.958148 16.9428C1.63048 14.8249 2.57175 12.9424 3.78195 11.2952C5.02577 9.61436 6.47128 8.30331 8.1185 7.36204C9.76572 6.38715 11.5978 5.89971 13.6148 5.89971C15.7999 5.89971 17.4976 6.45439 18.7078 7.56374C19.9516 8.63947 20.5735 10.085 20.5735 11.9003C20.5735 13.413 20.2037 14.7409 19.4641 15.8839C18.7246 16.9932 17.6488 17.9177 16.2369 18.6572C14.8586 19.3968 13.161 19.9683 11.144 20.3717C9.16062 20.7415 6.89149 20.9264 4.33662 20.9264H3.076C3.04238 21.2625 3.00877 21.6659 2.97515 22.1366C2.94153 22.5736 2.92472 23.0106 2.92472 23.4476C2.92472 25.9353 3.54663 27.8682 4.79045 29.2465C6.03427 30.5912 7.78233 31.2635 10.0347 31.2635C11.4129 31.2635 12.6736 31.0786 13.8165 30.7088C14.9595 30.339 16.0688 29.902 17.1446 29.3978V31.9694C16.1361 32.4401 14.9931 32.8603 13.7157 33.2301C12.4719 33.5662 11.0768 33.7343 9.5304 33.7343ZM4.8913 18.506C7.3117 18.506 9.49678 18.3043 11.4466 17.9009C13.3963 17.4639 14.9259 16.7747 16.0352 15.8334C17.1782 14.8586 17.7497 13.6147 17.7497 12.102C17.7497 11.0263 17.3799 10.1354 16.6403 9.42947C15.9344 8.72352 14.8418 8.37054 13.3627 8.37054C12.018 8.37054 10.6734 8.77394 9.3287 9.58074C8.01765 10.3539 6.84107 11.4969 5.79895 13.0096C4.75683 14.5224 3.98365 16.3545 3.4794 18.506H4.8913Z",p6970200:"M31.8056 40.9033C32.6086 42.2668 33.7553 43.3958 35.1312 44.1775C36.507 44.9592 38.0639 45.3662 39.6463 45.358C41.2287 45.3498 42.7812 44.9266 44.1489 44.1307C45.5165 43.3348 46.6514 42.1939 47.4403 40.8222L45.2644 39.5709C44.6945 40.562 43.8745 41.3862 42.8864 41.9613C41.8982 42.5364 40.7765 42.8421 39.6332 42.8481C38.49 42.854 37.3651 42.5599 36.3711 41.9951C35.377 41.4303 34.5486 40.6147 33.9684 39.6295L31.8056 40.9033Z",pd494300:"M25.6088 24.241C23.6964 22.6019 21.3675 21.5229 18.8804 21.1248C16.3935 20.7269 13.8445 21.0251 11.5161 21.9855C9.18797 22.9458 7.17066 24.5312 5.6875 26.5666C4.20423 28.6022 3.31243 31.0089 3.11167 33.5196C2.91094 36.0303 3.40878 38.5476 4.54967 40.793C5.69062 43.0385 7.43083 44.9246 9.57707 46.2428C11.6477 47.5145 14.0188 48.2076 16.4451 48.2569L16.4448 48.2579L16.4683 48.2571C16.549 48.2586 16.6297 48.2623 16.7105 48.2623L16.7113 48.2555L29.834 48.132C29.8144 46.0513 28.1115 44.3798 26.0308 44.3994L16.7141 44.4872L16.7139 44.473C14.8942 44.4713 13.11 43.9663 11.5594 43.014C10.0089 42.0616 8.75165 40.6987 7.92739 39.0765C7.10323 37.4543 6.74374 35.6357 6.88868 33.822C7.03372 32.0081 7.67779 30.2691 8.74935 28.7984C9.82102 27.3276 11.2794 26.1816 12.9617 25.4877C14.6438 24.794 16.4854 24.5795 18.2821 24.867C20.0789 25.1547 21.7609 25.9335 23.1426 27.1177C24.5242 28.302 25.5519 29.8453 26.111 31.577L29.7168 30.413C28.943 28.0162 27.5211 25.8801 25.6088 24.241Z",pdd63b00:"M97.0978 33.7343C95.3833 33.7343 94.0218 33.3141 93.0133 32.4737C92.0048 31.6333 91.5006 30.3054 91.5006 28.4901C91.5006 28.0195 91.5342 27.5153 91.6014 26.9774C91.6687 26.4059 91.7695 25.8176 91.904 25.2125L95.3833 8.72354H91.3493L91.7023 7.16037L95.8876 6.15187L98.308 1.2012e-05H100.123L98.7618 6.40399H106.275L105.771 8.72354H98.2575L94.7782 25.1621C94.6774 25.6663 94.5765 26.1874 94.4757 26.7253C94.4084 27.2295 94.3748 27.717 94.3748 28.1876C94.3748 29.1289 94.6101 29.8852 95.0808 30.4567C95.585 31.0282 96.375 31.3139 97.4507 31.3139C98.1567 31.3139 98.8122 31.2635 99.4173 31.1627C100.022 31.0282 100.611 30.8601 101.182 30.6584V32.978C100.712 33.1461 100.106 33.3141 99.3669 33.4822C98.6609 33.6503 97.9046 33.7343 97.0978 33.7343Z"},SU="linear-gradient(135deg, rgb(11,77,209) 0%, rgb(29,102,239) 45%, rgb(107,53,210) 100%)",qc="#EF8D1D";function jU({variant:e="color",scale:t=1}){const r=e==="light"?"white":"#0F3072",n=Math.round(320*t),o=Math.round(60*t);return i.jsxs("div",{style:{position:"relative",width:n,height:o,flexShrink:0},children:[i.jsxs("svg",{style:{position:"absolute",left:0,top:0},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 79.3139 60.1372",width:Math.round(79*t),height:Math.round(60*t),children:[i.jsx("path",{d:Ao.pd494300,fill:qc}),i.jsx("path",{d:Ao.p33b7c800,fill:qc}),i.jsx("path",{d:Ao.p142b6380,fill:r}),i.jsx("path",{d:Ao.p2c694f80,fill:r}),i.jsx("circle",{cx:"39.8711",cy:"7.36343",r:"6.01221",fill:r,transform:"rotate(75 39.8711 7.36343)"}),i.jsx("circle",{cx:"17.7246",cy:"12.6819",r:"5.28744",fill:qc,transform:"rotate(75 17.7246 12.6819)"}),i.jsx("circle",{cx:"5.28744",cy:"5.28744",r:"5.28744",fill:qc,transform:"matrix(-0.258819 0.965926 0.965926 0.258819 58.2047 6.20616)"}),i.jsx("path",{d:Ao.p1674a600,fill:r}),i.jsx("path",{d:Ao.p6970200,fill:r}),i.jsx("path",{d:Ao.p37f9b00,fill:r})]}),i.jsxs("svg",{style:{position:"absolute",left:Math.round(91*t),top:Math.round(13*t)},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 106.275 33.7343",width:Math.round(106*t),height:Math.round(34*t),children:[i.jsx("path",{d:Ao.pdd63b00,fill:r}),i.jsx("path",{d:Ao.p1945f480,fill:r}),i.jsx("path",{d:Ao.p48e8300,fill:r}),i.jsx("path",{d:Ao.p3763d600,fill:r}),i.jsx("path",{d:Ao.p6535700,fill:r})]}),i.jsxs("svg",{style:{position:"absolute",left:Math.round(197*t),top:Math.round(8*t)},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 105.33 38.8275",width:Math.round(106*t),height:Math.round(39*t),children:[i.jsx("path",{d:Ao.p30ec5580,fill:qc}),i.jsx("path",{d:Ao.p2fc98c00,fill:qc}),i.jsx("path",{d:Ao.p10df6080,fill:qc}),i.jsx("path",{d:Ao.p24dd2380,fill:qc})]}),i.jsxs("svg",{style:{position:"absolute",left:Math.round(298*t),top:Math.round(9*t)},fill:"none",preserveAspectRatio:"none",viewBox:"0 0 21.5276 21.5276",width:Math.round(22*t),height:Math.round(22*t),children:[i.jsx("path",{d:Ao.p1e5a9f00,fill:qc}),i.jsx("path",{d:Ao.p5358df0,fill:qc})]})]})}function kU(){return i.jsxs("div",{"aria-hidden":"true",style:{position:"fixed",inset:0,zIndex:0,backgroundImage:SU,overflow:"hidden"},children:[i.jsx("div",{style:{position:"absolute",top:"-160px",right:"-160px",width:480,height:480,borderRadius:"50%",background:"rgba(255,255,255,0.07)"}}),i.jsx("div",{style:{position:"absolute",top:"-60px",right:"-60px",width:280,height:280,borderRadius:"50%",border:"1px solid rgba(255,255,255,0.12)",background:"transparent"}}),i.jsx("div",{style:{position:"absolute",bottom:"-200px",left:"-200px",width:560,height:560,borderRadius:"50%",background:"rgba(255,255,255,0.06)"}}),i.jsx("div",{style:{position:"absolute",bottom:"-80px",left:"-80px",width:300,height:300,borderRadius:"50%",border:"1px solid rgba(255,255,255,0.10)",background:"transparent"}}),i.jsx("div",{style:{position:"absolute",top:"20%",left:"12%",width:80,height:80,borderRadius:"50%",background:"rgba(255,255,255,0.05)"}}),i.jsx("div",{style:{position:"absolute",bottom:"18%",right:"8%",width:120,height:120,borderRadius:"50%",background:"rgba(255,255,255,0.05)"}})]})}function td({label:e,placeholder:t,value:r,onChange:n,type:o="text",required:a,showToggle:s,inputMode:l,autoComplete:c,name:u}){const[d,f]=S.useState(!1),[h,p]=S.useState(!1),v=s?h?"text":"password":o;return i.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:5},children:[a&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:3},children:"*"}),e]}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("input",{type:v,value:r,onChange:m=>n(m.target.value),placeholder:t,required:a,name:u,inputMode:l,autoComplete:c,onFocus:()=>f(!0),onBlur:()=>f(!1),style:{width:"100%",padding:"8px 12px",paddingRight:s?38:12,border:d?"1px solid var(--primary)":"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box",boxShadow:d?"0 0 0 2px rgba(11,77,209,0.10)":"none",transition:"border-color 0.15s, box-shadow 0.15s"}}),s&&i.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(m=>!m),style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0,lineHeight:0},children:h?i.jsx(gT,{size:15}):i.jsx(qh,{size:15})})]})]})}function _U({label:e,disabled:t}){const[r,n]=S.useState(!1),o=!!t;return i.jsx("button",{type:"submit",disabled:o,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"10px 24px",borderRadius:"var(--radius-button)",background:"var(--primary)",border:"none",cursor:o?"not-allowed":"pointer",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",color:"var(--primary-foreground)",letterSpacing:"0.02em",opacity:o?.55:r?.88:1,transition:"opacity 0.15s ease"},children:e})}function CU({prompt:e,linkLabel:t,onClick:r}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:e}),i.jsx("button",{type:"button",onClick:r,style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",color:"var(--primary)",textDecoration:"underline",textDecorationSkipInk:"none",background:"none",border:"none",cursor:"pointer",padding:0,opacity:1,transition:"opacity 0.15s ease"},onMouseEnter:n=>{n.currentTarget.style.opacity="0.7"},onMouseLeave:n=>{n.currentTarget.style.opacity="1"},children:t})]})}function a2({label:e}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"var(--muted)",whiteSpace:"nowrap"},children:e}),i.jsx("div",{style:{flex:1,height:1,background:"var(--border)"}})]})}const TT="951022141012-uqd3e8da53gj8vhbhg9ibha5f9k8jsqj.apps.googleusercontent.com";function Doe(e){try{const t=e.split(".")[1];if(!t)return null;const r=t.replace(/-/g,"+").replace(/_/g,"/"),n=r+"=".repeat((4-r.length%4)%4),o=atob(n);return JSON.parse(o)}catch{return null}}function EU({text:e,onCredential:t}){const r=S.useRef(null),n=S.useRef(t);return n.current=t,S.useEffect(()=>{var l,c;if(!r.current)return;const o=r.current;let a=!0;const s=()=>{var f,h;if(!a||!o.isConnected)return;const u=(h=(f=window.google)==null?void 0:f.accounts)==null?void 0:h.id;if(!u)return;o.innerHTML="",u.initialize({client_id:TT,callback:p=>{p.credential&&n.current(p.credential)}});const d=Math.max(Math.floor(o.getBoundingClientRect().width),280);u.renderButton(o,{type:"standard",theme:"outline",size:"large",text:e,width:Math.min(400,d)})};if((c=(l=window.google)==null?void 0:l.accounts)!=null&&c.id)s();else{const u=window.setInterval(()=>{var f,h;(h=(f=window.google)==null?void 0:f.accounts)!=null&&h.id&&(window.clearInterval(u),s())},100),d=window.setTimeout(()=>window.clearInterval(u),2e4);return()=>{a=!1,window.clearInterval(u),window.clearTimeout(d)}}return()=>{a=!1}},[e]),i.jsx("div",{style:{width:"100%"},children:i.jsx("div",{ref:r,style:{width:"100%",minHeight:44}})})}function Boe({onNavigateToLogin:e,onSuccess:t,onRegister:r,onRegisterWithGoogle:n}){const[o,a]=S.useState(""),[s,l]=S.useState(""),[c,u]=S.useState(""),[d,f]=S.useState(""),[h,p]=S.useState(""),[v,m]=S.useState(""),[b,x]=S.useState(null),[w,k]=S.useState(!1),j=async A=>{if(!n)return;x(null);const P=Doe(A);if(!(P!=null&&P.email)){x("Could not read your Google account details. Try again.");return}k(!0);try{const N=await n({idToken:A,teamName:o.trim()||void 0,firstName:P.given_name||void 0,lastName:P.family_name||void 0});if(N.error){x(N.error);return}t==null||t()}finally{k(!1)}},_=async A=>{if(A.preventDefault(),x(null),r){const P=await r({email:s,password:c,teamName:o.trim(),firstName:d||void 0,lastName:h||void 0});if(P.error){x(P.error);return}}t==null||t()},T=[{icon:i.jsx(Vi,{size:16}),label:"Manage all your events in one place"},{icon:i.jsx(Ri,{size:16}),label:"Track participants and attendance"},{icon:i.jsx(Ad,{size:16}),label:"Real-time analytics and insights"}];return i.jsxs("div",{style:{minHeight:"100vh",width:"100%",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 16px"},children:[i.jsx(kU,{}),i.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"row",borderRadius:"var(--radius-card)",overflow:"hidden",boxShadow:"0px 20px 48px 0px rgba(0,0,0,0.28), 0px 4px 12px 0px rgba(0,0,0,0.18)",width:"min(960px, 100%)",minHeight:640},children:[i.jsxs("div",{style:{flex:"0 0 42%",position:"relative",overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",padding:"40px 36px",minHeight:580},children:[i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"none",background:"linear-gradient(160deg, rgba(11,77,209,0.92) 0%, rgba(29,102,239,0.88) 50%, rgba(107,53,210,0.92) 100%)"}}),i.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"column",height:"100%",gap:0},children:[i.jsx("div",{children:i.jsx(jU,{variant:"light",scale:.72})}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",gap:20,paddingTop:32,paddingBottom:16},children:[i.jsxs("div",{children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-2xl)",color:"white",lineHeight:1.25,margin:"0 0 10px"},children:["Your event",i.jsx("br",{}),"management portal"]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"rgba(255,255,255,0.80)",lineHeight:1.55,margin:0},children:"Everything you need to run exceptional events — in one place."})]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:T.map((A,P)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx("div",{style:{width:28,height:28,borderRadius:"var(--radius-button)",background:"rgba(255,255,255,0.15)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",flexShrink:0},children:A.icon}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-normal)",color:"rgba(255,255,255,0.88)",lineHeight:1.4},children:A.label})]},P))})]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"rgba(255,255,255,0.55)",margin:0},children:"© 2026 Stratawiz Technologies · EventBuzz"})]})]}),i.jsxs("div",{style:{flex:"1 1 0",background:"var(--card)",display:"flex",flexDirection:"column",overflowY:"auto",padding:"40px 40px 36px"},children:[i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{marginBottom:28},children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-2xl)",color:"var(--foreground)",lineHeight:1.25,margin:"0 0 6px"},children:"Create your account"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"var(--muted)",margin:0,lineHeight:1.5},children:"Complete your registration to access the portal"})]}),i.jsxs("form",{onSubmit:_,style:{display:"flex",flexDirection:"column",gap:14,flex:1},children:[b&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0},children:b}),n&&TT&&i.jsxs(i.Fragment,{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 4px"},children:"Sign up with Google — your account is created instantly, no extra steps."}),w&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Creating your account with Google…"}),i.jsx(EU,{text:"signup_with",onCredential:A=>{j(A)}}),i.jsx(a2,{label:"or register with email"})]}),i.jsx(td,{label:"Team Name",placeholder:"Enter your team or organization name",value:o,onChange:a,type:"text",required:!0}),i.jsx(td,{label:"Email Address",placeholder:"Enter your email address",value:s,onChange:l,type:"email",required:!0}),r&&i.jsx(td,{label:"Password",placeholder:"Choose a password (min 6 characters)",value:c,onChange:u,type:"password",required:!0}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[i.jsx(td,{label:"First Name",placeholder:"First name",value:d,onChange:f,required:!0}),i.jsx(td,{label:"Last Name",placeholder:"Last name",value:h,onChange:p,required:!0})]}),i.jsx(td,{label:"Phone Number",placeholder:"Enter your phone number",value:v,onChange:m,type:"tel"}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[i.jsx(_U,{label:"Create Account"}),i.jsx(a2,{label:"Already registered?"}),i.jsx(CU,{prompt:"Have an account?",linkLabel:"Sign in here",onClick:e})]})]})]}),i.jsxs("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:24,lineHeight:1.5,textAlign:"center"},children:["By registering you agree to our"," ",i.jsx("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"Terms of Service"})," ","and"," ",i.jsx("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"Privacy Policy"}),"."]})]})]})]})}function Woe({onNavigateToRegister:e,onSuccess:t,onLogin:r,onLoginWithGoogle:n,onCompleteTwoFactorLogin:o}){const[a,s]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState("password"),[p,v]=S.useState(null),[m,b]=S.useState(null),[x,w]=S.useState(!1),k=async T=>{if(n){b(null),w(!0);try{const A=await n(T);if("error"in A&&A.error){b(A.error);return}if("requiresTwoFactor"in A&&A.requiresTwoFactor){v(A.twoFactorToken),A.email&&s(A.email),h("2fa"),d("");return}t==null||t()}finally{w(!1)}}},j=()=>{h("password"),v(null),d(""),b(null)},_=async T=>{if(T.preventDefault(),b(null),f==="2fa"){if(!o||!p)return;const A=await o(p,u.trim());if(A.error){b(A.error);return}t==null||t();return}if(r){const A=await r(a,l);if("error"in A){b(A.error);return}if("requiresTwoFactor"in A&&A.requiresTwoFactor){v(A.twoFactorToken),h("2fa"),d("");return}}else{t==null||t();return}t==null||t()};return i.jsxs("div",{style:{minHeight:"100vh",width:"100%",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 16px"},children:[i.jsx(kU,{}),i.jsxs("div",{style:{position:"relative",zIndex:1,background:"var(--card)",borderRadius:"var(--radius-card)",overflow:"hidden",boxShadow:"0px 20px 48px 0px rgba(0,0,0,0.28), 0px 4px 12px 0px rgba(0,0,0,0.18)",width:"min(440px, 100%)"},children:[i.jsxs("div",{style:{padding:"32px 40px 28px",backgroundImage:SU,display:"flex",flexDirection:"column",alignItems:"center",gap:16,position:"relative",overflow:"hidden"},children:[i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:-40,right:-40,width:160,height:160,borderRadius:"50%",border:"1px solid rgba(255,255,255,0.15)",background:"transparent"}}),i.jsx("div",{"aria-hidden":"true",style:{position:"absolute",bottom:-50,left:-30,width:120,height:120,borderRadius:"50%",background:"rgba(255,255,255,0.06)"}}),i.jsx("div",{style:{position:"relative",zIndex:1},children:i.jsx(jU,{variant:"light",scale:.72})}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-xs)",color:"rgba(255,255,255,0.72)",margin:0,letterSpacing:"0.04em",textTransform:"uppercase",position:"relative",zIndex:1},children:"Event Management Portal"})]}),i.jsxs("div",{style:{padding:"32px 40px 36px"},children:[i.jsxs("div",{style:{marginBottom:24,textAlign:"center"},children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-xl)",color:"var(--foreground)",margin:"0 0 6px",lineHeight:1.3},children:f==="2fa"?"Authenticator code":"Welcome back"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",fontSize:"var(--text-sm)",color:"var(--muted)",margin:0,lineHeight:1.5},children:f==="2fa"?"Open Google Authenticator and enter the 6-digit code for your EventBuzz account.":"Enter your email to access your portal"})]}),i.jsxs("form",{onSubmit:_,style:{display:"flex",flexDirection:"column",gap:14},children:[m&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0},children:m}),f==="password"?i.jsxs(i.Fragment,{children:[i.jsx(td,{label:"Email Address",placeholder:"Enter your email address",value:a,onChange:s,type:"email",required:!0}),r&&i.jsx(td,{label:"Password",placeholder:"Enter your password",value:l,onChange:c,type:"password",required:!0})]}):i.jsxs(i.Fragment,{children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:["Signed in as ",i.jsx("strong",{style:{color:"var(--foreground)"},children:a})]}),i.jsx(td,{label:"Authentication code",placeholder:"000000",value:u,onChange:d,type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[i.jsx(_U,{label:f==="2fa"?"Verify and sign in":"Sign In"}),f==="2fa"&&i.jsx("button",{type:"button",onClick:j,style:{background:"none",border:"none",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--primary)",padding:"4px 0"},children:"← Use a different account"}),f==="password"&&n&&TT&&i.jsxs(i.Fragment,{children:[i.jsx(a2,{label:"or"}),x&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Signing in with Google…"}),i.jsx(EU,{text:"signin_with",onCredential:T=>{k(T)}})]}),i.jsx(a2,{label:"New to EventBuzz?"}),i.jsx(CU,{prompt:"Don't have an account?",linkLabel:"Register here",onClick:e})]})]}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:24,lineHeight:1.5,textAlign:"center"},children:"© 2026 Stratawiz Technologies · EventBuzz"})]})]})]})}function qoe(){var c,u;const e=Ed(),t=Cd(),{user:r,checked:n,login:o,loginWithGoogleCredential:a,completeTwoFactorLogin:s}=Mr(),l=((u=(c=t.state)==null?void 0:c.from)==null?void 0:u.pathname)??"/home";return n&&r?i.jsx(gh,{to:l,replace:!0}):i.jsx(Woe,{onNavigateToRegister:()=>e("/register"),onSuccess:()=>e(l,{replace:!0}),onLogin:o,onLoginWithGoogle:a,onCompleteTwoFactorLogin:s})}function $oe(){const e=Ed(),{user:t,checked:r,register:n,registerWithGoogle:o}=Mr();return r&&t?i.jsx(gh,{to:"/home",replace:!0}):i.jsx(Boe,{onNavigateToLogin:()=>e("/login"),onSuccess:()=>e("/home",{replace:!0}),onRegister:n,onRegisterWithGoogle:o})}function Uoe(){const[e]=i$(),t=Ed(),r=e.get("token")||"",[n,o]=S.useState(!0),[a,s]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(!1);S.useEffect(()=>{if(!r){s("Missing invitation link."),o(!1);return}wa.invitePreview(r).then(w=>{if(o(!1),w.error||!w.data){s(w.error||"Invalid or expired invitation.");return}const k=w.data;c(k),k.accountExists&&!k.sameOrganization&&s("This email is already registered with another organization.")})},[r]);const x=async w=>{if(w.preventDefault(),!r||!u)return;b(!0),s(null);const k=await wa.inviteAccept({token:r,password:u,firstName:l!=null&&l.accountExists?void 0:f,lastName:l!=null&&l.accountExists?void 0:p});if(b(!1),k.error||!k.data){s(k.error||"Could not accept invitation.");return}const j=k.data;kf(j.token,j.refreshToken),t("/events",{replace:!0})};return n?i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Loading invitation…"}):i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--secondary)"},children:i.jsxs("div",{style:{width:"100%",maxWidth:420,background:"var(--card)",borderRadius:12,padding:28,border:"1px solid var(--border)",boxShadow:"var(--shadow-md)"},children:[i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"1.25rem",margin:"0 0 8px",color:"var(--foreground)"},children:"Event invitation"}),l&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:20,lineHeight:1.5},children:["Join ",i.jsx("strong",{children:l.eventName}),l.organizationName?` · ${l.organizationName}`:""," as ",i.jsx("strong",{children:l.eventRole||"team member"}),".",i.jsx("br",{}),i.jsx("span",{style:{fontSize:"var(--text-xs)"},children:l.email})]}),a&&i.jsx("div",{style:{padding:12,background:"#fef2f2",color:"#b91c1c",borderRadius:8,marginBottom:16,fontSize:"var(--text-sm)"},children:a}),l&&(!l.accountExists||l.sameOrganization)&&!(a!=null&&a.includes("another organization"))&&i.jsxs("form",{onSubmit:x,children:[!l.accountExists&&i.jsxs(i.Fragment,{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",marginBottom:6},children:"First name"}),i.jsx("input",{value:f,onChange:w=>h(w.target.value),style:{width:"100%",marginBottom:12,padding:10,borderRadius:8,border:"1px solid var(--border)"}}),i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",marginBottom:6},children:"Last name"}),i.jsx("input",{value:p,onChange:w=>v(w.target.value),style:{width:"100%",marginBottom:12,padding:10,borderRadius:8,border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",marginBottom:6},children:[l.accountExists?"Password":"Create password"," ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{type:"password",value:u,onChange:w=>d(w.target.value),placeholder:l.accountExists?"Your account password":"At least 6 characters",style:{width:"100%",marginBottom:16,padding:10,borderRadius:8,border:"1px solid var(--border)"},autoComplete:l.accountExists?"current-password":"new-password"}),i.jsx("button",{type:"submit",disabled:m||!u,style:{width:"100%",padding:12,borderRadius:8,border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontWeight:600,cursor:m?"wait":"pointer"},children:m?"Please wait…":l.accountExists?"Accept & sign in":"Create account & join"})]})]})})}const AU=S.createContext(null),Hoe="home";function Voe({children:e,activeNavFromUrl:t,setActiveNavToUrl:r}){const[n,o]=S.useState(Hoe),[a,s]=S.useState(null),[l,c]=S.useState(""),[u,d]=S.useState(!1),[f,h]=S.useState(!1),[p,v]=S.useState(null),[m,b]=S.useState(!1),[x,w]=S.useState(!1),[k,j]=S.useState(null),A={activeNav:t??n,setActiveNav:r??o,selectedEventId:a,setSelectedEventId:s,searchQuery:l,setSearchQuery:c,sidebarCollapsed:u,setSidebarCollapsed:d,drawerOpen:f,setDrawerOpen:h,settingsInitialSection:p,setSettingsInitialSection:v,openAgendaSessionPanelOnce:m,setOpenAgendaSessionPanelOnce:b,permissionsOpenAddOnce:x,setPermissionsOpenAddOnce:w,pendingMicrositeBuilder:k,setPendingMicrositeBuilder:j};return i.jsx(AU.Provider,{value:A,children:e})}function Li(){const e=S.useContext(AU);if(!e)throw new Error("useAppNav must be used within AppNavProvider");return e}function sN(e){return e<640?"mobile":e<1024?"tablet":"desktop"}function Si(){const[e,t]=S.useState(()=>sN(window.innerWidth));return S.useEffect(()=>{const r=()=>t(sN(window.innerWidth));return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),e}const lN=[{id:"home",label:"Home",icon:i.jsx(vT,{size:16})},{id:"events",label:"All Events",icon:i.jsx(nS,{size:16})},{id:"activities",label:"Activities",icon:i.jsx(cS,{size:16})},{id:"design",label:"Design",icon:i.jsx(tm,{size:16}),children:[{id:"design-brochure",label:"Brochure"},{id:"design-microsite",label:"Microsite Templates"},{id:"design-badges",label:"Badges"},{id:"design-emailers",label:"Emailers"},{id:"design-whatsapp-templates",label:"WhatsApp Templates"}]},{id:"faculty",label:"Faculty & Speakers",icon:i.jsx(iS,{size:16})},{id:"all-participants",label:"Participants",icon:i.jsx(Ri,{size:16})},{id:"forms",label:"Forms & Workflow",icon:i.jsx(Sh,{size:16}),children:[{id:"forms-feedback",label:"Feedback"},{id:"forms-registration",label:"Registration"},{id:"forms-other",label:"Other Forms"},{id:"forms-add",label:"Add New Form",isAction:!0}]},{id:"content",label:"Content",icon:i.jsx(n2,{size:16}),children:[{id:"content-library",label:"Library"},{id:"content-collections",label:"Collections"}]},{id:"messaging",label:"Messaging",icon:i.jsx(dd,{size:16}),children:[{id:"messaging-email",label:"Email"},{id:"messaging-whatsapp",label:"WhatsApp"},{id:"messaging-whatsapp-chatbots",label:"WhatsApp Chatbots"}]},{id:"payment",label:"Payment Settings",icon:i.jsx(xv,{size:16})},{id:"user-management",label:"User Management",icon:i.jsx(fd,{size:16})},{id:"settings",label:"Settings",icon:i.jsx(hc,{size:16})}];function TU(e,t){var r;return!!((r=e.children)!=null&&r.some(n=>n.id===t))}function Yoe(e,t){return t===e.id||TU(e,t)}function sh({label:e,children:t}){const[r,n]=S.useState(!1);return i.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[t,r&&i.jsxs("div",{style:{position:"absolute",left:"calc(100% + 8px)",top:"50%",transform:"translateY(-50%)",background:"var(--foreground)",color:"#fff",padding:"4px 10px",borderRadius:"var(--radius-button)",fontSize:"12px",fontFamily:"var(--font-noto-sans)",whiteSpace:"nowrap",zIndex:300,pointerEvents:"none",boxShadow:"var(--elevation-sm)"},children:[e,i.jsx("span",{style:{position:"absolute",right:"100%",top:"50%",transform:"translateY(-50%)",borderWidth:"4px",borderStyle:"solid",borderColor:"transparent var(--foreground) transparent transparent"}})]})]})}function cN({activeItem:e,onNavigate:t,showCollapsed:r,selectedEventId:n,onEventSelect:o}){const a=lN.filter(f=>f.children).reduce((f,h)=>(f[h.id]=TU(h,e),f),{}),[s,l]=S.useState({events:!0,...a}),c=f=>l(h=>({...h,[f]:!h[f]})),u=f=>({width:"100%",display:"flex",alignItems:"center",gap:r?0:"9px",padding:r?"8px 0":"7px 10px",justifyContent:r?"center":"flex-start",borderRadius:"var(--radius-button)",background:f?"var(--sidebar-accent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:f?"var(--font-weight-medium)":"var(--font-weight-normal)",color:f?"var(--sidebar-accent-foreground)":"var(--sidebar-foreground)",transition:"background 0.12s",marginBottom:"1px",whiteSpace:"nowrap",overflow:"hidden"}),d=f=>({color:f?"var(--sidebar-primary)":"var(--muted)",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"});return i.jsx(i.Fragment,{children:lN.map(f=>{if(f.id==="events"){const m=e==="events",b=!!s.events&&!r;return r?i.jsx(sh,{label:"All Events",children:i.jsxs("button",{onClick:()=>t("events"),style:{...u(m||!!n),position:"relative"},onMouseEnter:x=>{m||(x.currentTarget.style.background="var(--accent)")},onMouseLeave:x=>{m||(x.currentTarget.style.background=m||n?"var(--sidebar-accent)":"transparent")},children:[i.jsx("span",{style:d(m||!!n),children:f.icon}),n&&i.jsx("span",{style:{position:"absolute",top:"6px",right:"6px",width:"6px",height:"6px",borderRadius:"50%",background:"#16a34a",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--sidebar)"}})]})},"events"):i.jsx("div",{style:{marginBottom:"1px"},children:i.jsx("div",{style:{display:"flex",alignItems:"center"},children:i.jsxs("button",{onClick:()=>{t("events"),b||l(x=>({...x,events:!0}))},style:{...u(m),flex:1,borderRadius:"var(--radius-button) 0 0 var(--radius-button)",marginBottom:0,overflow:"hidden"},onMouseEnter:x=>{m||(x.currentTarget.style.background="var(--accent)")},onMouseLeave:x=>{m||(x.currentTarget.style.background="transparent")},children:[i.jsx("span",{style:d(m),children:f.icon}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",overflow:"hidden",textOverflow:"ellipsis"},children:f.label}),n&&!b&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--primary)",flexShrink:0,marginRight:"2px"}})]})})},"events")}const h=Yoe(f,e),p=!!s[f.id]&&!r;if(f.children){const m=i.jsxs("button",{onClick:()=>c(f.id),style:u(h),onMouseEnter:b=>{h||(b.currentTarget.style.background="var(--accent)")},onMouseLeave:b=>{h||(b.currentTarget.style.background="transparent")},children:[i.jsx("span",{style:d(h),children:f.icon}),!r&&i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:f.label}),i.jsx(ka,{size:13,style:{color:"var(--muted)",flexShrink:0,transform:p?"rotate(90deg)":"none",transition:"transform 0.18s"}})]})]});return i.jsxs("div",{children:[r?i.jsx(sh,{label:f.label,children:m}):m,p&&i.jsx("div",{style:{paddingLeft:"14px",marginBottom:"2px"},children:i.jsx("div",{style:{borderLeft:"1px solid var(--sidebar-border)",paddingLeft:"8px"},children:f.children.map(b=>{const x=e===b.id;return i.jsxs("button",{onClick:()=>t(b.id),style:{...u(x),padding:"5px 8px",fontSize:"var(--text-xs)",gap:"6px"},onMouseEnter:w=>{x||(w.currentTarget.style.background="var(--accent)")},onMouseLeave:w=>{x||(w.currentTarget.style.background="transparent")},children:[b.isAction&&i.jsx(gr,{size:11,style:{color:"var(--primary)",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:x?"var(--sidebar-accent-foreground)":b.isAction?"var(--primary)":"var(--card-foreground)"},children:b.label})]},b.id)})})})]},f.id)}const v=i.jsxs("button",{onClick:()=>t(f.id),style:u(h),onMouseEnter:m=>{h||(m.currentTarget.style.background="var(--accent)")},onMouseLeave:m=>{h||(m.currentTarget.style.background="transparent")},children:[i.jsx("span",{style:d(h),children:f.icon}),!r&&i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:f.label}),h&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--primary)",flexShrink:0}})]})]},f.id);return r?i.jsx(sh,{label:f.label,children:v},f.id):v})})}function PU(e){var t;return e?e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(" ").trim():((t=e.email)==null?void 0:t.split("@")[0])??"User":"User"}function Goe(e){return PU(e).slice(0,2).toUpperCase()||"?"}function uN({collapsed:e,onNavigate:t}){const{theme:r,setTheme:n}=a$(),{user:o,logout:a}=Mr(),s=Ed(),l=(o==null?void 0:o.platform_admin)==="yes",c=PU(o??null),u=Goe(o??null),d=(o==null?void 0:o.email)??"",f=()=>{a(),s("/login",{replace:!0})},h={width:"100%",display:"flex",alignItems:"center",gap:e?0:"9px",padding:e?"8px 0":"7px 10px",justifyContent:e?"center":"flex-start",borderRadius:"var(--radius-button)",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.12s",marginBottom:"1px",whiteSpace:"nowrap",overflow:"hidden"};return i.jsxs("div",{style:{borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--sidebar-border)",padding:e?"8px 4px 12px":"8px 8px 12px",display:"flex",flexDirection:"column",alignItems:e?"center":"stretch",gap:"2px",flexShrink:0},children:[e?i.jsx(sh,{label:r==="dark"?"Switch to Light":"Switch to Dark",children:i.jsx("button",{onClick:()=>n(r==="dark"?"light":"dark"),style:{...h,marginBottom:"4px"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:r==="dark"?i.jsx(qO,{size:16}):i.jsx(WO,{size:16})})})}):i.jsxs("div",{style:{marginBottom:"4px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"700",letterSpacing:"0.07em",textTransform:"uppercase",margin:"0 0 6px 2px"},children:"Appearance"}),i.jsx("div",{style:{display:"flex",alignItems:"center",background:"var(--sidebar-accent)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:"var(--sidebar-border)",borderRightColor:"var(--sidebar-border)",borderBottomColor:"var(--sidebar-border)",borderLeftColor:"var(--sidebar-border)",borderRadius:"var(--radius-button)",padding:"2px",gap:"2px"},children:["light","dark"].map(p=>{const v=r===p;return i.jsx("button",{onClick:()=>n(p),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"5px",borderRadius:"var(--radius-button)",border:"none",cursor:"pointer",background:v?"var(--sidebar)":"transparent",boxShadow:v?"var(--elevation-sm)":"none",color:v?"var(--sidebar-foreground)":"var(--muted)",transition:"background 0.15s, color 0.15s, box-shadow 0.15s"},onMouseEnter:m=>{v||(m.currentTarget.style.color="var(--sidebar-foreground)")},onMouseLeave:m=>{v||(m.currentTarget.style.color="var(--muted)")},title:p==="light"?"Light mode":"Dark mode",children:p==="light"?i.jsx(qO,{size:13}):i.jsx(WO,{size:13})},p)})})]}),l&&(e?i.jsx(sh,{label:"Go to Super Admin Panel",children:i.jsx("button",{type:"button",style:h,onClick:()=>s("/super-admin"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(fd,{size:16})})})}):i.jsxs("button",{type:"button",style:h,onClick:()=>s("/super-admin"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(fd,{size:16})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--sidebar-foreground)"},children:"Go to Super Admin Panel"})]})),e?i.jsx(sh,{label:"Settings",children:i.jsx("button",{style:h,onClick:()=>t("settings"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(hc,{size:16})})})}):i.jsxs("button",{style:h,onClick:()=>t("settings"),onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i.jsx("span",{style:{color:"var(--muted)",flexShrink:0,display:"flex"},children:i.jsx(hc,{size:16})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--sidebar-foreground)"},children:"Settings"})]}),e?i.jsx(sh,{label:`${c} · Log out`,children:i.jsx("button",{type:"button",onClick:f,style:{...h,padding:"6px 0"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:u})})})}):i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderRadius:"var(--radius-button)"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:u})}),i.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--sidebar-foreground)",lineHeight:"1.3",margin:0},children:c}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:0},children:d||"—"})]}),i.jsx("button",{type:"button",onClick:f,title:"Log out",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"2px",flexShrink:0},onMouseEnter:p=>{p.currentTarget.style.color="var(--foreground)"},onMouseLeave:p=>{p.currentTarget.style.color="var(--muted)"},children:i.jsx(Sre,{size:13})})]})]})}function dN(){return i.jsx("div",{style:{padding:"10px 14px 4px",flexShrink:0},children:i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"700",letterSpacing:"0.07em",textTransform:"uppercase",margin:0},children:"Portfolio"})})}function fN({activeItem:e,onItemClick:t,collapsed:r,onToggleCollapse:n,drawerOpen:o,onDrawerClose:a,selectedEventId:s,onEventSelect:l}){const c=Si(),u=c==="mobile"||c==="tablet",d=p=>{t(p),u&&a&&a()},f=p=>{l==null||l(p),u&&a&&a()};if(u)return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:a,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:40,opacity:o?1:0,pointerEvents:o?"auto":"none",transition:"opacity 0.22s"}}),i.jsxs("aside",{style:{position:"fixed",top:0,left:0,bottom:0,width:"272px",background:"var(--sidebar)",borderRight:"1px solid var(--sidebar-border)",zIndex:50,display:"flex",flexDirection:"column",transform:o?"translateX(0)":"translateX(-100%)",transition:"transform 0.22s cubic-bezier(0.4,0,0.2,1)",boxShadow:o?"var(--elevation-sm)":"none",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 14px 14px 16px",borderBottom:"1px solid var(--sidebar-border)",flexShrink:0,minHeight:"52px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"9px"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"6px",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:"EB"})}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-base)",color:"var(--sidebar-foreground)"},children:"EventBuzz"})]}),i.jsx("button",{onClick:a,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",borderRadius:"var(--radius-button)",color:"var(--muted)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)"},onMouseLeave:p=>{p.currentTarget.style.background="none"},children:i.jsx(Gt,{size:15})})]}),i.jsx(dN,{}),i.jsx("nav",{style:{flex:1,overflowY:"auto",overflowX:"hidden",padding:"4px 8px"},children:i.jsx(cN,{activeItem:e,onNavigate:d,showCollapsed:!1,selectedEventId:s,onEventSelect:f})}),i.jsx(uN,{collapsed:!1,onNavigate:d})]})]});const h=r?60:240;return i.jsxs("aside",{style:{width:`${h}px`,flexShrink:0,height:"100%",display:"flex",flexDirection:"column",background:"var(--sidebar)",borderRight:"1px solid var(--sidebar-border)",transition:"width 0.2s cubic-bezier(0.4,0,0.2,1)",overflow:"hidden",zIndex:30,position:"relative"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:r?"center":"space-between",padding:r?"14px 0":"14px 12px 14px 14px",borderBottom:"1px solid var(--sidebar-border)",flexShrink:0,minHeight:"52px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"9px",overflow:"hidden"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"6px",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:"EB"})}),!r&&i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-base)",color:"var(--sidebar-foreground)",whiteSpace:"nowrap",overflow:"hidden"},children:"EventBuzz"})]}),i.jsx("button",{onClick:n,title:r?"Expand sidebar":"Collapse sidebar",style:{width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",borderRadius:"var(--radius-button)",color:"var(--muted)",flexShrink:0},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)",p.currentTarget.style.color="var(--primary)"},onMouseLeave:p=>{p.currentTarget.style.background="none",p.currentTarget.style.color="var(--muted)"},children:r?i.jsx(ka,{size:14}):i.jsx(vd,{size:14})})]}),!r&&i.jsx(dN,{}),i.jsx("nav",{style:{flex:1,overflowY:"auto",overflowX:"hidden",padding:r?"8px 4px":"4px 8px"},children:i.jsx(cN,{activeItem:e,onNavigate:d,showCollapsed:r,selectedEventId:s,onEventSelect:f})}),r&&i.jsx("div",{style:{borderTop:"1px solid var(--sidebar-border)",padding:"8px 4px 4px",display:"flex",justifyContent:"center"},children:i.jsx("button",{onClick:n,title:"Expand",style:{width:"36px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",borderRadius:"var(--radius-button)",color:"var(--muted)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--accent)",p.currentTarget.style.color="var(--primary)"},onMouseLeave:p=>{p.currentTarget.style.background="none",p.currentTarget.style.color="var(--muted)"},children:i.jsx(ka,{size:14})})}),i.jsx(uN,{collapsed:r,onNavigate:d})]})}const F3="eb:organization-subscription-updated",z3={Live:{bg:"#dcfce7",color:"#15803d",dot:"#16a34a"},Upcoming:{bg:"#dbeafe",color:"#1d4ed8"},Completed:{bg:"#f1f5f9",color:"#475569"},Draft:{bg:"#ffedd5",color:"#c2410c"}},Koe={Physical:i.jsx(_b,{size:10}),Virtual:i.jsx(Wf,{size:10}),Hybrid:i.jsx(cS,{size:10})},PT=[{id:"e1",title:"Napcon Jaipur 2026",subtitle:"27th National Conference on Pulmonary Diseases",status:"Live",type:"Conference",location:"Birla Auditorium, Jaipur",locationType:"Physical",startDate:"Nov 23, 2025",endDate:"Nov 26, 2025",participants:26,sessions:12},{id:"e2",title:"Napcon Mumbai 2025",subtitle:"26th National Conference on Pulmonary Diseases",status:"Completed",type:"Conference",location:"NSCI Dome, Mumbai",locationType:"Physical",startDate:"Oct 12, 2025",endDate:"Oct 15, 2025",participants:342,sessions:28},{id:"e3",title:"CHEST India 2026",subtitle:"Annual Indian CHEST Conference",status:"Upcoming",type:"Conference",location:"Taj Palace, New Delhi",locationType:"Physical",startDate:"Mar 15, 2026",endDate:"Mar 18, 2026",participants:0,sessions:0},{id:"e4",title:"ICS Annual Conference 2026",subtitle:"Indian Chest Society Annual Scientific Conference",status:"Upcoming",type:"Conference",location:"Hotel Lalit, Bengaluru",locationType:"Hybrid",startDate:"Jun 10, 2026",endDate:"Jun 12, 2026",participants:0,sessions:0},{id:"e5",title:"COPD Management Workshop",subtitle:"Evidence-based COPD Treatment Protocols",status:"Completed",type:"Workshop",location:"AIIMS, New Delhi",locationType:"Physical",startDate:"Sep 05, 2025",endDate:"Sep 05, 2025",participants:48,sessions:6},{id:"e6",title:"Interventional Pulmonology",subtitle:"Advanced Bronchoscopy & Intervention Training",status:"Completed",type:"Workshop",location:"PGI Chandigarh",locationType:"Physical",startDate:"Nov 28, 2025",endDate:"Nov 29, 2025",participants:22,sessions:8},{id:"e7",title:"Respiratory Physiology Lab",subtitle:"Masterclass: PFT & Interpretation",status:"Upcoming",type:"Workshop",location:"Online",locationType:"Virtual",startDate:"Apr 10, 2026",endDate:"Apr 10, 2026",participants:0,sessions:0},{id:"e8",title:"IMA Annual Summit 2025",subtitle:"Indian Medical Association National Congress",status:"Completed",type:"Summit",location:"Vigyan Bhavan, New Delhi",locationType:"Physical",startDate:"Aug 20, 2025",endDate:"Aug 22, 2025",participants:520,sessions:18},{id:"e9",title:"AIIMS Research Conclave 2026",subtitle:"National Medical Research & Innovation Summit",status:"Upcoming",type:"Summit",location:"AIIMS Auditorium, New Delhi",locationType:"Physical",startDate:"Jul 15, 2026",endDate:"Jul 17, 2026",participants:0,sessions:0},{id:"e10",title:"Monthly CME – December 2025",subtitle:"Asthma & Allergy Management Update",status:"Upcoming",type:"CME",location:"Online",locationType:"Virtual",startDate:"Dec 20, 2025",endDate:"Dec 20, 2025",participants:0,sessions:0},{id:"e11",title:"Monthly CME – November 2025",subtitle:"COPD Exacerbations: Case Studies",status:"Completed",type:"CME",location:"Online",locationType:"Virtual",startDate:"Nov 20, 2025",endDate:"Nov 20, 2025",participants:65,sessions:4},{id:"e12",title:"Monthly CME – October 2025",subtitle:"Sleep Apnoea: Diagnosis & Management",status:"Completed",type:"CME",location:"Online",locationType:"Virtual",startDate:"Oct 18, 2025",endDate:"Oct 18, 2025",participants:72,sessions:4}],IU=[{id:"p0",navId:"home",title:"Home",section:"Portfolio",description:"Dashboard home — AI event ideas and quick actions",icon:i.jsx(vT,{size:14})},{id:"p1",navId:"events",title:"All Events",section:"Portfolio",description:"Browse and manage all your events",icon:i.jsx(nS,{size:14})},{id:"p2",navId:"design-brochure",title:"Design · Brochure",section:"Design",description:"Create and manage event brochures",icon:i.jsx(tm,{size:14})},{id:"p3",navId:"design-microsite",title:"Design · Microsite Templates",section:"Design",description:"Manage microsite templates for events",icon:i.jsx(tm,{size:14})},{id:"p4",navId:"design-badges",title:"Design · Badges",section:"Design",description:"Create attendee and speaker badges",icon:i.jsx(tm,{size:14})},{id:"p5",navId:"design-emailers",title:"Design · Emailers",section:"Design",description:"Design email templates and newsletters",icon:i.jsx(tm,{size:14})},{id:"p5w",navId:"design-whatsapp-templates",title:"Design · WhatsApp Templates",section:"Design",description:"Create Meta message templates and sync approval status",icon:i.jsx($h,{size:14})},{id:"p6",navId:"faculty",title:"Faculty & Speakers",section:"Portfolio",description:"Manage faculty profiles and speaker details",icon:i.jsx(iS,{size:14})},{id:"p7",navId:"all-participants",title:"Participants",section:"Portfolio",description:"View and manage all participants across events",icon:i.jsx(Ri,{size:14})},{id:"p8",navId:"forms-feedback",title:"Forms · Feedback",section:"Forms & Workflow",description:"Feedback forms and response analytics",icon:i.jsx(Sh,{size:14})},{id:"p9",navId:"forms-registration",title:"Forms · Registration",section:"Forms & Workflow",description:"Registration forms and submissions",icon:i.jsx(Sh,{size:14})},{id:"p10",navId:"content-library",title:"Content · Library",section:"Content",description:"Manage your content library and assets",icon:i.jsx(n2,{size:14})},{id:"p11",navId:"content-collections",title:"Content · Collections",section:"Content",description:"Organise content into curated collections",icon:i.jsx(n2,{size:14})},{id:"p12",navId:"messaging-email",title:"Messaging · Email",section:"Messaging",description:"Email campaigns, templates, and analytics",icon:i.jsx(dd,{size:14})},{id:"p13",navId:"messaging-whatsapp",title:"Messaging · WhatsApp",section:"Messaging",description:"WhatsApp messaging campaigns",icon:i.jsx(dd,{size:14})},{id:"p13b",navId:"messaging-whatsapp-chatbots",title:"WhatsApp Chatbots",section:"Messaging",description:"AI concierge bots per event",icon:i.jsx(dd,{size:14})},{id:"p14",navId:"payment",title:"Payment Settings",section:"Portfolio",description:"Configure payment gateways and billing",icon:i.jsx(xv,{size:14})},{id:"p15",navId:"user-management",title:"User Management",section:"Portfolio",description:"Manage team members, roles, and permissions",icon:i.jsx(fd,{size:14})},{id:"p16",navId:"settings",title:"Settings",section:"General",description:"Organisation, profile, and platform preferences",icon:i.jsx(hc,{size:14})},{id:"p17",navId:"dashboard",title:"Event Home",section:"Event",description:"Tracks, sessions, and schedule for the event",icon:i.jsx(Cb,{size:14})},{id:"p18",navId:"analytics",title:"Event Analytics",section:"Event",description:"Live stats, charts, and feature overview",icon:i.jsx(x$,{size:14})},{id:"p19",navId:"participants",title:"Event Participants",section:"Event",description:"Registrations, check-ins, and attendance",icon:i.jsx(Ri,{size:14})},{id:"p20",navId:"permissions",title:"Users & Permissions",section:"Event",description:"Manage event team members, roles, and session access",icon:i.jsx(fd,{size:14})},{id:"p21",navId:"event-activities",title:"Activities",section:"Event",description:"Polls, quizzes, and audience Q&A for sessions",icon:i.jsx(Ad,{size:14})},{id:"p23",navId:"rewards",title:"Reward Points",section:"Event",description:"Leaderboard, manual points, and attendee rankings",icon:i.jsx(dte,{size:14})},{id:"p24",navId:"ticketing",title:"Ticket configuration",section:"Event",description:"Configure ticket types, pricing, and UPI checkout",icon:i.jsx(A$,{size:14})}],Qoe=[{id:"a1",title:"Create New Event",description:"Set up a new conference, workshop, or CME",icon:i.jsx(gr,{size:14}),navTarget:"events"},{id:"a2",title:"Add Speaker / Faculty",description:"Add a new faculty or speaker profile",icon:i.jsx(iS,{size:14}),navTarget:"faculty"},{id:"a3",title:"New Email Campaign",description:"Draft and send an email campaign",icon:i.jsx(dd,{size:14}),navTarget:"messaging-email"},{id:"a4",title:"Invite Team Member",description:"Send an invitation to a team member",icon:i.jsx(Ri,{size:14}),navTarget:"user-management"},{id:"a5",title:"Upload Content",description:"Upload files, videos, or documents",icon:i.jsx(Fl,{size:14}),navTarget:"content-library"},{id:"a6",title:"Connect Payment Gateway",description:"Link Razorpay, Stripe, or other gateways",icon:i.jsx(xv,{size:14}),navTarget:"payment"}],Xoe=[{label:"Home",navId:"home",icon:i.jsx(vT,{size:12})},{label:"All Events",navId:"events",icon:i.jsx(nS,{size:12})},{label:"Faculty & Speakers",navId:"faculty",icon:i.jsx(iS,{size:12})},{label:"Design",navId:"design-brochure",icon:i.jsx(tm,{size:12})},{label:"Participants",navId:"all-participants",icon:i.jsx(Ri,{size:12})},{label:"Messaging",navId:"messaging-email",icon:i.jsx(dd,{size:12})},{label:"Settings",navId:"settings",icon:i.jsx(hc,{size:12})}];function OU(e){const t=e.trim().toLowerCase();if(!t)return{events:[],pages:[],actions:[],total:0};const r=(...s)=>s.some(l=>l.toLowerCase().includes(t)),n=PT.filter(s=>r(s.title,s.subtitle,s.location,s.type,s.status)),o=IU.filter(s=>r(s.title,s.section,s.description)),a=Qoe.filter(s=>r(s.title,s.description));return{events:n,pages:o,actions:a,total:n.length+o.length+a.length}}function V0({text:e,q:t}){if(!t.trim())return i.jsx(i.Fragment,{children:e});const r=e.toLowerCase().indexOf(t.toLowerCase());return r===-1?i.jsx(i.Fragment,{children:e}):i.jsxs(i.Fragment,{children:[e.slice(0,r),i.jsx("mark",{style:{background:"var(--accent)",color:"var(--accent-foreground)",borderRadius:"2px",padding:"0 1px"},children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}function pN({query:e,results:t,activeIndex:r,onEventClick:n,onPageClick:o,onActionClick:a,onViewAll:s}){const l=e.trim(),c=t?Math.min(t.events.length,4):0,u=t?Math.min(t.pages.length,5):0;t&&Math.min(t.actions.length,3);const d=c,f=c+u,h=({label:p,count:v})=>i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px 4px"},children:[i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em"},children:p}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"var(--secondary)",padding:"1px 6px",borderRadius:"999px"},children:v})]});return l?!t||t.total===0?i.jsxs("div",{style:{padding:"28px 14px",textAlign:"center"},children:[i.jsx(pi,{size:20,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:['No results for "',l,'"']}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Try a different search term"})]}):i.jsxs("div",{children:[t.events.length>0&&i.jsxs("div",{children:[i.jsx(h,{label:"Events",count:t.events.length}),t.events.slice(0,4).map((p,v)=>{const m=z3[p.status],b=r===v;return i.jsxs("button",{onClick:()=>n(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 14px",textAlign:"left",background:b?"var(--accent)":"none",border:"none",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:x=>{x.currentTarget.style.background="var(--secondary)"},onMouseLeave:x=>{x.currentTarget.style.background=b?"var(--accent)":"none"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:m.dot??m.color,flexShrink:0}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 1px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(V0,{text:p.title,q:l})}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"3px"},children:[i.jsx(Ab,{size:9}),p.location]}),i.jsx("span",{style:{margin:"0 6px",color:"var(--border)"},children:"·"}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"3px"},children:[i.jsx(Vi,{size:9}),p.startDate]})]})]}),i.jsx("span",{style:{padding:"1px 7px",borderRadius:"999px",background:m.bg,color:m.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:p.status})]},p.id)}),t.events.length>4&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",padding:"4px 14px 6px",margin:0},children:["+",t.events.length-4," more event",t.events.length-4>1?"s":""]})]}),t.events.length>0&&t.pages.length>0&&i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0"}}),t.pages.length>0&&i.jsxs("div",{children:[i.jsx(h,{label:"Pages",count:t.pages.length}),t.pages.slice(0,5).map((p,v)=>{const m=r===d+v;return i.jsxs("button",{onClick:()=>o(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"7px 14px",textAlign:"left",background:m?"var(--accent)":"none",border:"none",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:b=>{b.currentTarget.style.background="var(--secondary)"},onMouseLeave:b=>{b.currentTarget.style.background=m?"var(--accent)":"none"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--primary)"},children:p.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 1px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(V0,{text:p.title,q:l})}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:p.section})]}),i.jsx(ka,{size:12,style:{color:"var(--muted)",flexShrink:0}})]},p.id)})]}),(t.events.length>0||t.pages.length>0)&&t.actions.length>0&&i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0"}}),t.actions.length>0&&i.jsxs("div",{children:[i.jsx(h,{label:"Quick Actions",count:t.actions.length}),t.actions.slice(0,3).map((p,v)=>{const m=r===f+v;return i.jsxs("button",{onClick:()=>a(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"7px 14px",textAlign:"left",background:m?"var(--accent)":"none",border:"none",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:b=>{b.currentTarget.style.background="var(--secondary)"},onMouseLeave:b=>{b.currentTarget.style.background=m?"var(--accent)":"none"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"var(--radius-button)",background:"var(--accent)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--accent-foreground)"},children:p.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 1px"},children:i.jsx(V0,{text:p.title,q:l})}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(V0,{text:p.description,q:l})})]}),i.jsx("span",{style:{padding:"2px 8px",borderRadius:"var(--radius-button)",background:"var(--accent)",color:"var(--accent-foreground)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:"Go"})]},p.id)})]}),i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0 0"},children:i.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"10px 14px",background:"none",border:"none",cursor:"pointer",borderRadius:"0 0 var(--radius-card) var(--radius-card)",transition:"background 0.1s"},onMouseEnter:p=>{p.currentTarget.style.background="var(--secondary)"},onMouseLeave:p=>{p.currentTarget.style.background="none"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--primary)"},children:["View all ",t.total," result",t.total!==1?"s":"",' for "',l,'"']}),i.jsx(dT,{size:13,style:{color:"var(--primary)",flexShrink:0}})]})})]}):i.jsxs("div",{children:[i.jsxs("div",{style:{padding:"12px 14px 8px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em",marginBottom:"8px"},children:"Suggested"}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:Xoe.map(p=>i.jsxs("button",{onClick:()=>o({id:p.navId,navId:p.navId,title:p.label,section:"",description:"",icon:p.icon}),style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",cursor:"pointer",transition:"background 0.1s, border-color 0.1s"},onMouseEnter:v=>{v.currentTarget.style.borderColor="var(--primary)",v.currentTarget.style.color="var(--primary)"},onMouseLeave:v=>{v.currentTarget.style.borderColor="var(--border)",v.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx("span",{style:{color:"var(--primary)"},children:p.icon}),p.label]},p.navId))})]}),i.jsx("div",{style:{borderTop:"1px solid var(--border)",margin:"4px 0"}}),i.jsxs("div",{style:{padding:"4px 14px 10px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em",marginBottom:"4px",paddingTop:"8px"},children:"Recent Events"}),PT.slice(0,3).map(p=>{const v=z3[p.status];return i.jsxs("button",{onClick:()=>n(p),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"8px 0",textAlign:"left",background:"none",border:"none",borderBottom:"1px solid var(--border)",cursor:"pointer"},onMouseEnter:m=>{m.currentTarget.style.background="var(--secondary)",m.currentTarget.style.borderRadius="var(--radius-button)",m.currentTarget.style.paddingLeft="6px"},onMouseLeave:m=>{m.currentTarget.style.background="none",m.currentTarget.style.paddingLeft="0"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:v.dot??v.color,flexShrink:0}}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.title}),i.jsx("span",{style:{padding:"1px 6px",borderRadius:"999px",background:v.bg,color:v.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:p.status})]},p.id)})]})]})}function NU(e){var t;return e?e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(" ").trim():((t=e.email)==null?void 0:t.split("@")[0])??"User":"User"}function Zoe(e){return NU(e).slice(0,2).toUpperCase()||"?"}function Joe(e,t){if(!e)return"Free";const r=t.find(n=>n.id===e);return r!=null&&r.name?r.name:e.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function eae(e,t){var s,l,c;const r=(s=e.subscription)==null?void 0:s.maxParticipants;if(r!=null&&Number.isFinite(Number(r)))return Number(r);const n=((l=e.subscription)==null?void 0:l.plan)??"free",o=t.find(u=>u.id===n),a=(c=o==null?void 0:o.defaultLimits)==null?void 0:c.maxParticipants;return a!=null&&Number.isFinite(Number(a))?Number(a):null}function tae(e){if(!e)return{desktop:"",mobile:"",title:""};const t=new Date(e);if(Number.isNaN(t.getTime()))return{desktop:"",mobile:"",title:""};const r=t.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),n=t.toLocaleDateString("en-IN",{day:"numeric",month:"short"});return{desktop:` · Renews ${r}`,mobile:` · ${n}`,title:` Renews on ${r}.`}}function rae({isMobile:e}){const{user:t}=Mr(),r=NU(t??null),n=Zoe(t??null);return i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:e?"0":"8px",padding:e?"4px":"4px 8px 4px 4px",borderRadius:"var(--radius-button)",background:"none",border:"none",cursor:"pointer"},onMouseEnter:o=>{o.currentTarget.style.background="var(--secondary)"},onMouseLeave:o=>{o.currentTarget.style.background="none"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:n})}),!e&&i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:r})]})}function nae({onMenuClick:e,onNavigate:t,onEventSelect:r,onOpenSearchPage:n}){var q,G;const{user:o}=Mr(),{setActiveNav:a,setSettingsInitialSection:s}=Li(),[l,c]=S.useState(""),[u,d]=S.useState(!1),[f,h]=S.useState(-1),[p,v]=S.useState(!1),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState([]),[_,T]=S.useState(0),A=Si(),P=A==="mobile",N=A==="tablet",O=S.useRef(null),C=S.useRef(null),I=S.useRef(null),R=S.useMemo(()=>l.trim()?OU(l):null,[l]),F=S.useMemo(()=>R?[...R.events.slice(0,4).map(U=>({type:"event",data:U})),...R.pages.slice(0,5).map(U=>({type:"page",data:U})),...R.actions.slice(0,3).map(U=>({type:"action",data:U}))]:[],[R]);S.useEffect(()=>{const U=Q=>{O.current&&!O.current.contains(Q.target)&&(d(!1),h(-1))};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]),S.useEffect(()=>{const U=()=>T(Q=>Q+1);return window.addEventListener(F3,U),()=>window.removeEventListener(F3,U)},[]),S.useEffect(()=>{var Q;if(!((Q=o==null?void 0:o.organization)!=null&&Q._id)){w(null),j([]);return}let U=!1;return(async()=>{try{const[K,re]=await Promise.all([cs.get({cacheBust:_>0}),ed.catalog().then(H=>H.plans).catch(()=>[])]);U||(w(K),j(re))}catch{U||(w(null),j([]))}})(),()=>{U=!0}},[(q=o==null?void 0:o.organization)==null?void 0:q._id,_]);const M=S.useMemo(()=>{var le,ke,ve;if(!((le=o==null?void 0:o.organization)!=null&&le._id)||!x)return null;const U=(ke=x.subscription)==null?void 0:ke.plan,Q=Joe(U,k),K=eae(x,k),re=K==null?"Unlimited participants":`${K.toLocaleString("en-IN")} participants max`,H=tae((ve=x.subscription)==null?void 0:ve.expiresAt),ie=P?`${Q} · ${K==null?"∞":K.toLocaleString("en-IN")}${H.mobile}`:`${Q} · ${re}${H.desktop}`,de=`${Q} — ${re}.${H.title} Open Billing in Settings.`;return{label:ie,title:de}},[(G=o==null?void 0:o.organization)==null?void 0:G._id,x,k,P]);S.useEffect(()=>{const U=Q=>{var K;(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),P?(v(!0),setTimeout(()=>{var re;return(re=I.current)==null?void 0:re.focus()},50)):((K=C.current)==null||K.focus(),d(!0)))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[P]);const Y=U=>{if(U.key==="ArrowDown")U.preventDefault(),h(Q=>Math.min(Q+1,F.length-1));else if(U.key==="ArrowUp")U.preventDefault(),h(Q=>Math.max(Q-1,-1));else if(U.key==="Enter")if(f>=0&&F[f]){const Q=F[f];X(Q)}else l.trim()&&D();else U.key==="Escape"&&(d(!1),h(-1),v(!1))},X=U=>{U.type==="event"?r==null||r(U.data.id):U.type==="page"?t==null||t(U.data.navId):t==null||t(U.data.navTarget),z()},$=U=>{r==null||r(U.id),z()},ee=U=>{t==null||t(U.navId),z()},V=U=>{t==null||t(U.navTarget),z()},D=()=>{n==null||n(l),z()},z=()=>{d(!1),h(-1),v(!1),c("")};return i.jsxs(i.Fragment,{children:[i.jsxs("header",{style:{height:"52px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:P?"0 12px":"0 24px",background:"var(--card)",borderBottom:"1px solid var(--border)",flexShrink:0,zIndex:20,gap:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",flex:1,minWidth:0},children:[(P||N)&&i.jsx("button",{onClick:e,style:{width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",borderRadius:"var(--radius-button)",flexShrink:0},onMouseEnter:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.color="var(--foreground)"},onMouseLeave:U=>{U.currentTarget.style.background="none",U.currentTarget.style.color="var(--muted)"},"aria-label":"Open menu",children:i.jsx(Ere,{size:18})}),P&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"6px",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:"EB"})}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-sm)",color:"var(--foreground)"},children:"EventBuzz"})]}),!P&&i.jsxs("div",{ref:O,style:{position:"relative"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 10px",height:"32px",width:N?"220px":"300px",background:"var(--secondary)",borderRadius:u?"var(--radius-button) var(--radius-button) 0 0":"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:m||u?"var(--ring)":"transparent",borderBottomColor:u?"transparent":m?"var(--ring)":"transparent",transition:"border-color 0.15s",boxShadow:u?"0 -1px 0 0 var(--ring)":"none"},children:[i.jsx(pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{ref:C,type:"text",value:l,placeholder:"Search events, pages, actions…",onChange:U=>{c(U.target.value),h(-1),d(!0)},onFocus:()=>{b(!0),d(!0)},onBlur:()=>b(!1),onKeyDown:Y,style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),l?i.jsx("button",{onClick:()=>{c(""),h(-1)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"0",flexShrink:0},children:i.jsx(Gt,{size:12})}):!N&&i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0,background:"var(--border)",padding:"1px 5px",borderRadius:"3px"},children:"⌘K"})]}),u&&i.jsx("div",{style:{position:"absolute",top:"32px",left:0,width:N?"340px":"420px",background:"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--ring)",borderTop:"none",borderRadius:"0 var(--radius-card) var(--radius-card) var(--radius-card)",boxShadow:"var(--elevation-sm)",zIndex:200,maxHeight:"440px",overflowY:"auto"},children:i.jsx(pN,{query:l,results:R,activeIndex:f,onEventClick:$,onPageClick:ee,onActionClick:V,onViewAll:D})})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[P&&i.jsx("button",{"aria-label":"Search",onClick:()=>{v(!0),setTimeout(()=>{var U;return(U=I.current)==null?void 0:U.focus()},60)},style:{width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",borderRadius:"var(--radius-button)"},onMouseEnter:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.color="var(--foreground)"},onMouseLeave:U=>{U.currentTarget.style.background="none",U.currentTarget.style.color="var(--muted)"},children:i.jsx(pi,{size:16})}),M&&i.jsxs("button",{type:"button","aria-label":M.title,title:M.title,onClick:()=>{s("billing"),a("settings")},style:{display:"inline-flex",alignItems:"center",gap:"6px",maxWidth:P?"min(46vw, 200px)":"none",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",flexShrink:1,minWidth:0},onMouseEnter:U=>{U.currentTarget.style.background="var(--accent)",U.currentTarget.style.borderColor="var(--primary)"},onMouseLeave:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.borderColor="var(--border)"},children:[i.jsx(xv,{size:14,style:{color:"var(--primary)",flexShrink:0},"aria-hidden":!0}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",textAlign:"left",color:"var(--primary)"},children:M.label})]}),i.jsxs("button",{style:{position:"relative",width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",borderRadius:"var(--radius-button)"},"aria-label":"Notifications (3 unread)",onMouseEnter:U=>{U.currentTarget.style.background="var(--secondary)",U.currentTarget.style.color="var(--foreground)"},onMouseLeave:U=>{U.currentTarget.style.background="none",U.currentTarget.style.color="var(--muted)"},children:[i.jsx(fT,{size:16}),i.jsx("span",{style:{position:"absolute",top:"4px",right:"4px",minWidth:"14px",height:"14px",borderRadius:"999px",background:"var(--destructive)",border:"2px solid var(--card)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"8px",fontFamily:"var(--font-inter)",fontWeight:"700",color:"var(--destructive-foreground)",padding:"0 2px",lineHeight:1},children:"3"})]}),i.jsx("div",{style:{width:"1px",height:"20px",background:"var(--border)",margin:"0 2px"}}),i.jsx(rae,{isMobile:P})]})]}),p&&i.jsxs("div",{style:{position:"fixed",inset:0,zIndex:300,display:"flex",flexDirection:"column"},children:[i.jsx("div",{onClick:()=>v(!1),style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.5)"}}),i.jsxs("div",{style:{position:"relative",background:"var(--card)",boxShadow:"var(--elevation-sm)",display:"flex",flexDirection:"column",maxHeight:"90vh"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",borderBottom:"1px solid var(--border)"},children:[i.jsx(pi,{size:16,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{ref:I,type:"text",value:l,placeholder:"Search events, pages, actions…",onChange:U=>{c(U.target.value),h(-1)},onKeyDown:Y,style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"}}),l&&i.jsx("button",{onClick:()=>c(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"2px"},children:i.jsx(Gt,{size:14})}),i.jsx("button",{onClick:()=>{v(!1),c("")},style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",padding:"4px 0 4px 4px",flexShrink:0},children:"Cancel"})]}),i.jsx("div",{style:{overflowY:"auto",flex:1},children:i.jsx(pN,{query:l,results:R,activeIndex:f,onEventClick:$,onPageClick:ee,onActionClick:V,onViewAll:D})})]})]})]})}const RU=[{id:"dashboard",label:"Event Home",shortLabel:"Home",icon:i.jsx(ure,{size:13})},{id:"participants",label:"Participants",shortLabel:"People",icon:i.jsx(Ri,{size:13})},{id:"attendance",label:"Attendance",shortLabel:"Attend",icon:i.jsx(hT,{size:13})},{id:"event-activities",label:"Activities",shortLabel:"Activities",icon:i.jsx(cS,{size:13})},{id:"rewards",label:"Reward Points",shortLabel:"Rewards",icon:i.jsx(nu,{size:13})},{id:"analytics",label:"Analytics",shortLabel:"Analytics",icon:i.jsx(x$,{size:13})}],iae=new Set([...RU.map(e=>e.id),"website","permissions","ticketing","questions","quiz"]);function oae({activeItem:e,onNavigate:t}){const r=S.useRef(null),o=Si()==="mobile",[a,s]=S.useState(!1),[l,c]=S.useState(!1);return S.useEffect(()=>{const u=r.current;if(!u)return;const d=()=>{c(u.scrollLeft>4),s(u.scrollLeft+u.clientWidth<u.scrollWidth-4)};return d(),u.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),()=>{u.removeEventListener("scroll",d),window.removeEventListener("resize",d)}},[]),i.jsxs("div",{style:{flexShrink:0,background:"var(--card)",borderBottom:"1px solid var(--border)",zIndex:20,display:"flex",alignItems:"stretch",height:o?"40px":"44px",position:"relative"},children:[l&&i.jsx("div",{style:{position:"absolute",left:0,top:0,bottom:0,width:"32px",zIndex:2,background:"linear-gradient(to right, var(--card) 0%, transparent 100%)",pointerEvents:"none"}}),i.jsx("div",{ref:r,style:{display:"flex",alignItems:"stretch",flex:1,overflowX:"auto",scrollbarWidth:"none",msOverflowStyle:"none"},children:RU.map(u=>{const d=e===u.id||u.id==="event-activities"&&(e==="questions"||e==="quiz");return i.jsxs("button",{onClick:()=>t(u.id),style:{display:"flex",alignItems:"center",gap:o?"4px":"6px",padding:o?"0 10px":"0 16px",height:"100%",background:"transparent",borderTopWidth:0,borderTopStyle:"solid",borderTopColor:"transparent",borderLeftWidth:0,borderLeftStyle:"solid",borderLeftColor:"transparent",borderRightWidth:0,borderRightStyle:"solid",borderRightColor:"transparent",borderBottomWidth:"2px",borderBottomStyle:"solid",borderBottomColor:d?"var(--primary)":"transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:d?"var(--font-weight-medium)":"var(--font-weight-normal)",color:d?"var(--primary)":"var(--card-foreground)",whiteSpace:"nowrap",flexShrink:0,transition:"color 0.12s, border-color 0.12s, background 0.12s"},onMouseEnter:f=>{d||(f.currentTarget.style.background="var(--secondary)",f.currentTarget.style.color="var(--foreground)")},onMouseLeave:f=>{d||(f.currentTarget.style.background="transparent",f.currentTarget.style.color="var(--card-foreground)")},children:[i.jsx("span",{style:{color:d?"var(--primary)":"var(--muted)",display:"flex",flexShrink:0},children:u.icon}),o?u.shortLabel:u.label]},u.id)})}),a&&i.jsx("div",{style:{position:"absolute",right:0,top:0,bottom:0,width:"32px",zIndex:2,background:"linear-gradient(to left, var(--card) 0%, transparent 100%)",pointerEvents:"none"}})]})}function sc(e){return e==="dropdown"||e==="checkboxes"||e==="radio"}function Ch(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")||"field"}function aae(e){return{Conference:"conference",Workshop:"workshop",Summit:"summit",CME:"cme",Webinar:"webinar"}[e]||e.toLowerCase()}function sae(e){return{Draft:"draft",Upcoming:"upcoming",Live:"live",Completed:"completed"}[e]||e.toLowerCase()}function IT(e){return{Physical:"physical",Virtual:"virtual",Hybrid:"hybrid"}[e]||e.toLowerCase()}function w5(e){return new Date(e+"T12:00:00.000Z").toISOString()}function s2(e){const t=e==null?void 0:e.trim();if(!t)return null;const r=new Date(t);return Number.isNaN(r.getTime())?null:r.toISOString()}function lae(e){var l;const t=s2(e.startLocal),r=s2(e.endLocal);if(!t||!r)throw new RangeError("Invalid start or end date/time.");if(new Date(r).getTime()<=new Date(t).getTime())throw new RangeError("End must be after start.");const n=e.locationTypeLabel.trim(),o=e.virtualLink.trim(),a=o&&!o.startsWith("http")?`https://${o}`:o,s={name:e.eventName.trim(),description:e.description.trim()||void 0,type:"conference",status:"draft",startDate:t,endDate:r,location:e.venue.trim()||void 0,locationType:IT(n),virtualLink:n==="Virtual"||n==="Hybrid"?a:void 0,bootstrapAgenda:!0,settings:{registrationOpen:!1,requiresApproval:!1,verifyEmail:!0,enableFeedback:!0,enableRatings:!1,authenticationType:"otp_email",registrationBaseFields:"name_email"},tags:[],metadata:{registrationCustomFields:[]}};return(l=e.organizationId)!=null&&l.trim()&&(s.organization=e.organizationId.trim()),s}function cae(e){const t=(e||"physical").toLowerCase();return t==="virtual"?"Virtual":t==="hybrid"?"Hybrid":"Physical"}function LU(e,t,r){var p,v,m,b;const n=(t.eventName??e.name??"").trim();if(n.length<3)throw new RangeError("Event name must be at least 3 characters.");let o,a;if((p=t.startLocal)!=null&&p.trim()&&((v=t.endLocal)!=null&&v.trim())){const x=s2(t.startLocal),w=s2(t.endLocal);if(!x||!w)throw new RangeError("Invalid start or end date/time.");if(new Date(w).getTime()<=new Date(x).getTime())throw new RangeError("End must be after start.");o=x,a=w}else{const x=e.startDate,w=e.endDate;o=typeof x=="string"?x:new Date(x).toISOString(),a=typeof w=="string"?w:new Date(w).toISOString()}const s=((m=t.locationType)==null?void 0:m.trim())||cae(e.locationType),l=(t.venue??e.location??"").trim(),c=(t.virtualLink??e.virtualLink??"").trim(),u=c&&!c.startsWith("http")?`https://${c}`:c,d=typeof e.type=="string"&&e.type.trim()?e.type.trim().toLowerCase():"conference",f=typeof e.status=="string"&&e.status.trim()?e.status.trim().toLowerCase():"draft",h={name:n,description:((b=e.description)==null?void 0:b.trim())||void 0,type:d,status:f,startDate:o,endDate:a,location:l||void 0,locationType:IT(s),virtualLink:(s==="Virtual"||s==="Hybrid")&&u||void 0,bootstrapAgenda:!0,settings:{registrationOpen:!1,requiresApproval:!1,verifyEmail:!0,enableFeedback:!0,enableRatings:!1,authenticationType:"otp_email",registrationBaseFields:"name_email"},tags:Array.isArray(e.tags)?e.tags.filter(x=>typeof x=="string"&&x.trim()):[],metadata:{registrationCustomFields:[]}};return r!=null&&r.trim()&&(h.organization=r.trim()),h}function FU(e){return{name:String(e.name??""),subtitle:e.subtitle!=null?String(e.subtitle):void 0,description:e.description!=null?String(e.description):void 0,type:e.type!=null?String(e.type):void 0,status:e.status!=null?String(e.status):void 0,startDate:String(e.startDate??""),endDate:String(e.endDate??""),location:e.location!=null?String(e.location):void 0,locationType:String(e.locationType??"physical"),virtualLink:e.virtualLink!=null?String(e.virtualLink):void 0,tags:Array.isArray(e.tags)?e.tags.map(String):void 0}}function zU(e,t){const r=e.registrationRequired==="Yes",n=e.registrationMode;let o=!0,a=!1;r?(n==="Invite Only"&&(o=!1),n==="Approval Required"&&(a=!0)):o=!1;const s=e.virtualLink.trim(),l=s&&!s.startsWith("http")?`https://${s}`:s,c=e.eventType.trim()||"Conference",u=e.status.trim()||"Draft",d=e.locationType.trim()||"Physical",f=(t==null?void 0:t.tags)!=null?t.tags.map(h=>String(h).trim()).filter(Boolean):e.keyPeople.split(/[,;]/).map(h=>h.trim()).filter(Boolean);return{name:e.eventName.trim(),description:e.description.trim()||void 0,type:aae(c),status:sae(u),startDate:w5(e.startDate.trim()),endDate:w5(e.endDate.trim()),location:e.venue.trim()||void 0,locationType:IT(d),virtualLink:(d==="Virtual"||d==="Hybrid")&&l||void 0,image:e.eventLogo||void 0,bannerImage:e.eventBanner||void 0,tags:f,settings:{registrationOpen:o,requiresApproval:a,registrationMode:n||void 0,verifyEmail:e.verifyEmail==="Yes",registrationDeadline:e.registrationDeadline?w5(e.registrationDeadline.trim()):void 0,authenticationType:e.authenticationType||void 0,registrationBaseFields:e.registrationBaseFields||void 0,enableFeedback:e.enableFeedback==="Yes",enableRatings:e.enableRatings==="Yes"},metadata:{registrationCustomFields:e.customFields.filter(h=>h.label.trim()).map(h=>({label:h.label.trim(),code:(h.code.trim()||Ch(h.label)).replace(/[^a-z0-9_]/gi,"_"),fieldType:h.fieldType,options:sc(h.fieldType)?h.options.filter(p=>p.label.trim()&&p.value.trim()).map(p=>({value:p.value.trim(),label:p.label.trim()})):[]}))}}}const Qr={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},Ba={...Qr,cursor:"pointer",appearance:"none",paddingRight:"32px"};function ur({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"2px"},children:"*"}),e]})}function lr({children:e,error:t}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e,t?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"5px 0 0",lineHeight:1.35},children:t}):null]})}function No({children:e}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:e})}function Wa({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(go,{size:14,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function Af({name:e,value:t,onChange:r,options:n}){return i.jsx("div",{style:{display:"flex",gap:"20px",alignItems:"center",flexWrap:"wrap"},children:n.map(o=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[i.jsx("input",{type:"radio",name:e,value:o.value,checked:t===o.value,onChange:()=>r(o.value),style:{accentColor:"var(--primary)",width:"16px",height:"16px",cursor:"pointer"}}),o.label]},o.value))})}function l2({label:e,preview:t,error:r,inputRef:n,onFile:o}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[i.jsxs("div",{onClick:()=>{var a;return(a=n.current)==null?void 0:a.click()},onDragOver:a=>a.preventDefault(),onDrop:a=>{a.preventDefault();const s=a.dataTransfer.files[0];if(s!=null&&s.type.startsWith("image/")){const l=new FileReader;l.onload=()=>{typeof l.result=="string"&&o(l.result)},l.readAsDataURL(s)}},style:{border:`1.5px dashed ${r?"var(--destructive)":"var(--primary)"}`,borderRadius:"var(--radius-button)",background:"var(--secondary)",padding:"16px 12px",display:"flex",flexDirection:"column",alignItems:"center",gap:"6px",cursor:"pointer"},children:[i.jsx("input",{ref:n,type:"file",accept:"image/*",style:{display:"none"},onChange:a=>{var l;const s=(l=a.target.files)==null?void 0:l[0];if(s){const c=new FileReader;c.onload=()=>{typeof c.result=="string"&&o(c.result)},c.readAsDataURL(s)}}}),t?i.jsx("img",{src:t,alt:"",style:{maxHeight:72,maxWidth:"100%",objectFit:"contain",borderRadius:4}}):i.jsx(Fl,{size:22,style:{color:"var(--primary)"}}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textAlign:"center",margin:0},children:["Drag and drop or ",i.jsxs("span",{style:{color:"var(--primary)",textDecoration:"underline"},children:["select ",e]})]})]}),r?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0},children:r}):null]})}function uae({n:e,state:t}){const r=t==="todo"?"var(--muted)":"var(--primary)";return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(bi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function Tf({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onNext:l,nextLabel:c,nextDisabled:u}){const d=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(uae,{n:e,state:d}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:n?"var(--primary)":"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx(Qf,{size:18,style:{color:"var(--muted)"}}):i.jsx(go,{size:18,style:{color:"var(--muted)"}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 14px 40px"},children:r}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:s}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",marginTop:"18px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:[o&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"var(--text-xs)",color:"var(--primary)"},children:[i.jsx(bi,{size:12})," Complete"]}),i.jsx("button",{type:"button",disabled:u,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 16px",borderRadius:"var(--radius-button)",background:u?"var(--secondary)":"var(--primary)",color:u?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:u?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})]})]})]})}const OT=[{label:"Text",value:"text"},{label:"Textarea",value:"textarea"},{label:"Dropdown",value:"dropdown"},{label:"Checkboxes",value:"checkboxes"},{label:"Radio",value:"radio"},{label:"Yes / No",value:"yes_no"},{label:"Stars (rating)",value:"stars"},{label:"Image upload",value:"image_upload"},{label:"File upload",value:"file_upload"}],NT=[{label:"OTP on Email",value:"otp_email"},{label:"Link on Email",value:"link_email"},{label:"None",value:"none"}],RT=[{label:"Name & Email",value:"name_email"},{label:"Email Only",value:"email_only"},{label:"Name, Email & Phone",value:"name_email_phone"},{label:"Anonymous with Name",value:"anonymous_name"},{label:"Anonymous",value:"anonymous"}],MU=new Set(NT.map(e=>e.value)),DU=new Set(RT.map(e=>e.value));function BU(){return{id:Math.random().toString(36).slice(2),label:"",code:"",codeAuto:!0,fieldType:"text",options:[]}}const hN={eventName:"",eventType:"",description:"",status:"",locationType:"",venue:"",virtualLink:"",startDate:"",endDate:"",registrationRequired:"No",registrationMode:"",verifyEmail:"Yes",registrationDeadline:"",authenticationType:"otp_email",registrationBaseFields:"name_email",enableFeedback:"Yes",enableRatings:"No",keyPeople:"",eventLogo:null,eventBanner:null,customFields:[]};function S5(e){if(!e)return"";const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":t.toISOString().slice(0,10)}function dae(e){const t=(e||"conference").toLowerCase();return{conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"}[t]||"Conference"}function fae(e){const t=(e||"draft").toLowerCase();return{draft:"Draft",upcoming:"Upcoming",live:"Live",completed:"Completed"}[t]||"Draft"}function pae(e){const t=(e||"physical").toLowerCase();return t==="virtual"?"Virtual":t==="hybrid"?"Hybrid":"Physical"}function hae(e){const t=typeof e=="string"?e:"";return MU.has(t)?t:"otp_email"}function gae(e){const t=typeof e=="string"?e:"";return DU.has(t)?t:"name_email"}function c2(e){const t=e.settings||{};let r="No",n="";const o=t.registrationMode;o==="Invite Only"?(r="Yes",n="Invite Only"):o==="Approval Required"||t.requiresApproval===!0?(r="Yes",n="Approval Required"):o==="Open"||t.registrationOpen===!0?(r="Yes",n="Open"):t.registrationOpen===!1&&t.requiresApproval===!1&&!o?r="No":(t.registrationOpen||t.requiresApproval)&&(r="Yes",n=t.requiresApproval?"Approval Required":"Open");const l=((e.metadata||{}).registrationCustomFields||[]).map(d=>{const f=d.options||[],h=d.fieldType||"text";return{id:Math.random().toString(36).slice(2),label:String(d.label||""),code:String(d.code||Ch(String(d.label||""))),codeAuto:!d.code,fieldType:sc(h)||OT.some(p=>p.value===h)?h:"text",options:sc(h)?(f.length?f:[{value:"",label:""}]).map(p=>({id:Math.random().toString(36).slice(2),value:String(p.value??""),label:String(p.label??"")})):[]}}),c=String(e.virtualLink||""),u=pae(e.locationType);return{eventName:String(e.name||""),eventType:dae(e.type),description:String(e.description||e.subtitle||""),status:fae(e.status),locationType:u,venue:u==="Virtual"?"":String(e.location||""),virtualLink:u==="Physical"?"":c,startDate:S5(e.startDate),endDate:S5(e.endDate),registrationRequired:r,registrationMode:n,verifyEmail:t.verifyEmail===!1?"No":"Yes",registrationDeadline:t.registrationDeadline?S5(t.registrationDeadline):"",authenticationType:hae(t.authenticationType),registrationBaseFields:gae(t.registrationBaseFields),enableFeedback:t.enableFeedback===!1?"No":"Yes",enableRatings:t.enableRatings===!0?"Yes":"No",keyPeople:Array.isArray(e.tags)?e.tags.join(", "):"",eventLogo:e.image||null,eventBanner:e.bannerImage||null,customFields:l}}function mae(e,t){const r=c2(t),n=o=>o.trim();return{eventName:n(e.eventName)||r.eventName,description:e.description,eventType:e.eventType||r.eventType,status:e.status||r.status,locationType:e.locationType||r.locationType,venue:e.venue,virtualLink:e.virtualLink,startDate:n(e.startDate)||r.startDate,endDate:n(e.endDate)||r.endDate,registrationRequired:e.registrationRequired,registrationMode:e.registrationMode||r.registrationMode,verifyEmail:e.verifyEmail,registrationDeadline:e.registrationDeadline,authenticationType:e.authenticationType||r.authenticationType,registrationBaseFields:e.registrationBaseFields||r.registrationBaseFields,enableFeedback:e.enableFeedback,enableRatings:e.enableRatings,keyPeople:e.keyPeople,eventLogo:e.eventLogo,eventBanner:e.eventBanner,customFields:e.customFields}}function vae(e){const t={};if(e.locationType==="Virtual"||e.locationType==="Hybrid"){const r=e.virtualLink.trim();if(r)try{new URL(r.startsWith("http")?r:`https://${r}`)}catch{t.virtualLink="Enter a valid URL (e.g. https://…)."}}if(e.startDate&&e.endDate){const r=new Date(e.startDate);new Date(e.endDate)<r&&(t.endDate="End date must be on or after the start date.")}return t}function gN(e,t){const r={},n=e.eventName.trim();return n?n.length<3&&(r.eventName="Event name must be at least 3 characters."):r.eventName="Event name is required.",t!=null&&t.editMode||(e.eventType||(r.eventType="Please select an event type."),e.description.trim()||(r.description="Description is required.")),r}function mN(e,t){const r={};if(!(t!=null&&t.editMode)&&!e.status&&(r.status="Please select a status."),e.locationType||(r.locationType="Please select a location type."),e.startDate||(r.startDate="Start date is required."),e.endDate||(r.endDate="End date is required."),e.startDate&&e.endDate){const n=new Date(e.startDate);new Date(e.endDate)<n&&(r.endDate="End date must be on or after the start date.")}if((e.locationType==="Physical"||e.locationType==="Hybrid")&&(e.venue.trim()||(r.venue="Venue or address is required for this location type.")),e.locationType==="Virtual"||e.locationType==="Hybrid"){const n=e.virtualLink.trim();if(!n)r.virtualLink="Meeting or stream URL is required.";else try{new URL(n.startsWith("http")?n:`https://${n}`)}catch{r.virtualLink="Enter a valid URL (e.g. https://…)."}}return r}function vN(e,t){if(t!=null&&t.editMode)return{};const r={};return e.eventLogo||(r.eventLogo="Event logo is required."),e.eventBanner||(r.eventBanner="Banner image is required."),r}function yae(e){const t={};return e.label.trim()||(t[`cf_${e.id}_label`]="Field label is required."),e.fieldType||(t[`cf_${e.id}_type`]="Select a field type."),(e.code.trim()||Ch(e.label)).replace(/[^a-z0-9_]/gi,"_")||(t[`cf_${e.id}_code`]="Field code is required."),sc(e.fieldType)&&(e.options.filter(o=>o.label.trim()&&o.value.trim()).length===0&&(t[`cf_${e.id}_options`]="Add at least one option with both Value and Label."),e.options.forEach(o=>{const a=o.label.trim(),s=o.value.trim();a&&!s&&(t[`cf_${e.id}_opt_${o.id}`]="Value is required when Label is set."),s&&!a&&(t[`cf_${e.id}_opt_${o.id}`]="Label is required when Value is set.")})),t}function yN(e,t){const r={};return e.registrationRequired==="Yes"&&!e.registrationMode&&(r.registrationMode="Select a registration mode when registration is required."),!(t!=null&&t.editMode)&&e.registrationRequired==="Yes"&&((!e.authenticationType||!MU.has(e.authenticationType))&&(r.authenticationType="Select an authentication type."),(!e.registrationBaseFields||!DU.has(e.registrationBaseFields))&&(r.registrationBaseFields="Select registration base fields.")),t!=null&&t.editMode||e.customFields.forEach(n=>Object.assign(r,yae(n))),r}function xae(...e){return e.reduce((t,r)=>({...t,...r}),{})}function vf(e,t){const r={...e};return t.forEach(n=>{delete r[n]}),r}function j5(e){const t=["registrationMode","authenticationType","registrationBaseFields"];return e.customFields.forEach(r=>{t.push(`cf_${r.id}_label`,`cf_${r.id}_type`,`cf_${r.id}_code`,`cf_${r.id}_options`),r.options.forEach(n=>t.push(`cf_${r.id}_opt_${n.id}`))}),t}const k5=["eventName","eventType","description"],_5=["status","locationType","startDate","endDate","venue","virtualLink"],C5=["eventLogo","eventBanner"],pm=4;function bae({onClose:e,onSuccess:t,eventId:r}){const n=!!r,[o,a]=S.useState(1),[s,l]=S.useState(new Set),[c,u]=S.useState(hN),[d,f]=S.useState({}),[h,p]=S.useState(!1),[v,m]=S.useState(null),[b,x]=S.useState(null),[w,k]=S.useState(!!r),[j,_]=S.useState([]),T=S.useRef(null),A=S.useRef(null),P={editMode:n};S.useEffect(()=>{if(!r){k(!1),u(hN),_([]),l(new Set),a(1),x(null);return}k(!0),x(null),Lr.get(r).then(G=>{if(k(!1),G.error||!G.data){x(G.error||"Could not load event.");return}const U=G.data;u(c2(U));const Q=U.tags;_(Array.isArray(Q)?Q.map(String):[]),l(new Set([1,2,3,4])),a(1)})},[r]);const N=S.useCallback((G,U)=>{u(Q=>({...Q,[G]:U}))},[]),O=Math.round(s.size/pm*100),C=()=>u(G=>({...G,customFields:[...G.customFields,BU()]})),I=G=>{u(U=>({...U,customFields:U.customFields.filter(Q=>Q.id!==G)})),f(U=>{const Q={...U};return Object.keys(Q).forEach(K=>{(K.startsWith(`cf_${G}_`)||K===`cf_${G}_label`)&&delete Q[K]}),Q})},R=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>{if(K.id!==G)return K;const re={...K,label:U};return K.codeAuto&&(re.code=Ch(U)),re})}))},F=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>K.id===G?{...K,code:U,codeAuto:!1}:K)}))},M=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>{if(K.id!==G)return K;const re={...K,fieldType:U};return sc(U)&&K.options.length===0&&(re.options=[{id:Math.random().toString(36).slice(2),value:"",label:""}]),sc(U)||(re.options=[]),re})}))},Y=G=>{u(U=>({...U,customFields:U.customFields.map(Q=>Q.id===G?{...Q,options:[...Q.options,{id:Math.random().toString(36).slice(2),value:"",label:""}]}:Q)}))},X=(G,U)=>{u(Q=>({...Q,customFields:Q.customFields.map(K=>K.id===G?{...K,options:K.options.filter(re=>re.id!==U)}:K)})),f(Q=>{const K={...Q};return delete K[`cf_${G}_opt_${U}`],K})},$=(G,U,Q,K)=>{u(re=>({...re,customFields:re.customFields.map(H=>H.id===G?{...H,options:H.options.map(ie=>ie.id===U?{...ie,[Q]:K}:ie)}:H)}))},ee=G=>{m(null);let U={};if(G===1?U=gN(c,P):G===2?U=mN(c,P):G===3?U=vN(c,P):G===4&&(U=yN(c,P)),Object.keys(U).length>0){f(Q=>{let K={...Q};return G===1&&(K=vf(K,k5)),G===2&&(K=vf(K,_5)),G===3&&(K=vf(K,C5)),G===4&&(K=vf(K,j5(c))),{...K,...U}}),a(G);return}G===1&&f(Q=>vf(Q,k5)),G===2&&f(Q=>vf(Q,_5)),G===3&&f(Q=>vf(Q,C5)),G===4&&f(Q=>vf(Q,j5(c))),l(Q=>new Set([...Q,G])),G<pm&&a(G+1)},V=()=>zU(c,n?{tags:j}:void 0),D=async()=>{m(null);const G=xae(gN(c,P),mN(c,P),vN(c,P),yN(c,P));if(Object.keys(G).length>0){f(G);for(const K of[1,2,3,4]){let re=[];if(K===1&&(re=k5),K===2&&(re=_5),K===3&&(re=C5),K===4&&(re=j5(c)),re.some(H=>G[H])){a(K);break}}return}f({}),p(!0);const U=V(),Q=n&&r?await Lr.update(r,U):await Lr.create(U);p(!1),Q.data!=null&&!Q.error?(t==null||t(),e()):m(Q.error||"Could not save event. Please try again.")},z=G=>d[G],q=G=>a(U=>U===G?0:G);return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(580px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)",animation:"slideInRight 0.25s ease"},children:[i.jsx("style",{children:"@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:n?"Edit Event":"Create New Event"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0"},children:n?"Update details and save.":"4 steps: Basic → Schedule → Media → Registration & form fields. Save submits when all are valid."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:e,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:14})}),i.jsx("button",{type:"button",disabled:h||w||!!b,onClick:()=>D(),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:h||w||b?"var(--secondary)":"var(--primary)",color:h||w||b?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:h||w||b?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:h?"Saving…":n?"Save changes":"Save event"})]})]}),b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 8px"},children:b}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:[s.size," of ",pm," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[O,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${O}%`,background:"#22c55e",borderRadius:"99px",transition:"width 0.3s ease"}})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",position:"relative"},children:[w&&i.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(255,255,255,0.85)",zIndex:5,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Loading event…"}),i.jsxs(Tf,{n:1,title:"Basic Information",subtitle:"Core details about your event",open:o===1,completed:s.has(1),onToggle:()=>q(1),onNext:()=>ee(1),nextLabel:"Continue to Schedule & Location",nextDisabled:h,children:[i.jsxs(lr,{error:z("eventName"),children:[i.jsx(ur,{text:"Event Name",required:!0}),i.jsx("input",{style:{...Qr,...z("eventName")?{borderColor:"var(--destructive)"}:{}},value:c.eventName,onChange:G=>N("eventName",G.target.value)})]}),i.jsxs(lr,{error:z("eventType"),children:[i.jsx(ur,{text:"Event type",required:!n}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("eventType")?{borderColor:"var(--destructive)"}:{}},value:c.eventType,onChange:G=>N("eventType",G.target.value),children:[i.jsx("option",{value:"",children:"Select Type"}),i.jsx("option",{children:"Conference"}),i.jsx("option",{children:"Workshop"}),i.jsx("option",{children:"Summit"}),i.jsx("option",{children:"CME"}),i.jsx("option",{children:"Webinar"})]})})]}),i.jsxs(lr,{error:z("description"),children:[i.jsx(ur,{text:"Description",required:!n}),i.jsx("textarea",{style:{...Qr,resize:"vertical",minHeight:"80px",...z("description")?{borderColor:"var(--destructive)"}:{}},value:c.description,onChange:G=>N("description",G.target.value)})]})]}),i.jsxs(Tf,{n:2,title:"Schedule & Location",subtitle:"When and where",open:o===2,completed:s.has(2),onToggle:()=>q(2),onNext:()=>ee(2),nextLabel:"Continue to Media & Tags",nextDisabled:h,children:[i.jsxs(No,{children:[i.jsxs(lr,{error:z("status"),children:[i.jsx(ur,{text:"Status",required:!n}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("status")?{borderColor:"var(--destructive)"}:{}},value:c.status,onChange:G=>N("status",G.target.value),children:[i.jsx("option",{value:"",children:"Select Status"}),i.jsx("option",{children:"Draft"}),i.jsx("option",{children:"Upcoming"}),i.jsx("option",{children:"Live"}),i.jsx("option",{children:"Completed"})]})})]}),i.jsxs(lr,{error:z("locationType"),children:[i.jsx(ur,{text:"Location Type",required:!0}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("locationType")?{borderColor:"var(--destructive)"}:{}},value:c.locationType,onChange:G=>N("locationType",G.target.value),children:[i.jsx("option",{value:"",children:"Select"}),i.jsx("option",{children:"Physical"}),i.jsx("option",{children:"Virtual"}),i.jsx("option",{children:"Hybrid"})]})})]})]}),(c.locationType==="Physical"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:z("venue"),children:[i.jsx(ur,{text:"Venue / Address",required:!0}),i.jsx("input",{style:{...Qr,...z("venue")?{borderColor:"var(--destructive)"}:{}},value:c.venue,onChange:G=>N("venue",G.target.value)})]}),(c.locationType==="Virtual"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:z("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Qr,...z("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:c.virtualLink,onChange:G=>N("virtualLink",G.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:z("startDate"),children:[i.jsx(ur,{text:"Start Date",required:!0}),i.jsx("input",{type:"date",style:{...Qr,...z("startDate")?{borderColor:"var(--destructive)"}:{}},value:c.startDate,onChange:G=>N("startDate",G.target.value)})]}),i.jsxs(lr,{error:z("endDate"),children:[i.jsx(ur,{text:"End Date",required:!0}),i.jsx("input",{type:"date",style:{...Qr,...z("endDate")?{borderColor:"var(--destructive)"}:{}},value:c.endDate,onChange:G=>N("endDate",G.target.value)})]})]})]}),i.jsxs(Tf,{n:3,title:"Media",subtitle:"Logo and banner (optional)",open:o===3,completed:s.has(3),onToggle:()=>q(3),onNext:()=>ee(3),nextLabel:"Continue to Registration",nextDisabled:h,children:[i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Event logo"}),i.jsx(l2,{label:"logo",preview:c.eventLogo,error:z("eventLogo"),inputRef:T,onFile:G=>{N("eventLogo",G),f(U=>{const Q={...U};return delete Q.eventLogo,Q})}})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Banner image"}),i.jsx(l2,{label:"banner",preview:c.eventBanner,error:z("eventBanner"),inputRef:A,onFile:G=>{N("eventBanner",G),f(U=>{const Q={...U};return delete Q.eventBanner,Q})}})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Feedback",required:!n}),i.jsx(Af,{name:"enableFeedback",value:c.enableFeedback,onChange:G=>N("enableFeedback",G),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Ratings",required:!n}),i.jsx(Af,{name:"enableRatings",value:c.enableRatings,onChange:G=>N("enableRatings",G),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Tf,{n:4,title:"Registration & Form Fields",subtitle:"Registration rules and custom registration fields",open:o===4,completed:s.has(4),onToggle:()=>q(4),onNext:()=>D(),nextLabel:"Save event",nextDisabled:h,children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Registration settings"}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Required",required:!0}),i.jsx(Af,{name:"regRequired",value:c.registrationRequired,onChange:G=>N("registrationRequired",G),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{error:z("registrationMode"),children:[i.jsx(ur,{text:"Registration Mode",required:c.registrationRequired==="Yes"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...z("registrationMode")?{borderColor:"var(--destructive)"}:{}},value:c.registrationMode,onChange:G=>N("registrationMode",G.target.value),disabled:c.registrationRequired!=="Yes",children:[i.jsx("option",{value:"",children:c.registrationRequired==="Yes"?"Select mode":"N/A"}),i.jsx("option",{children:"Open"}),i.jsx("option",{children:"Invite Only"}),i.jsx("option",{children:"Approval Required"})]})})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Verify Email",required:!0}),i.jsx(Af,{name:"verifyEmail",value:c.verifyEmail,onChange:G=>N("verifyEmail",G),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Deadline"}),i.jsx("input",{type:"date",style:Qr,value:c.registrationDeadline,onChange:G=>N("registrationDeadline",G.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:z("authenticationType"),children:[i.jsx(ur,{text:"Authentication Type",required:c.registrationRequired==="Yes"&&!n}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...z("authenticationType")?{borderColor:"var(--destructive)"}:{}},value:c.authenticationType,onChange:G=>N("authenticationType",G.target.value),disabled:c.registrationRequired!=="Yes",children:NT.map(G=>i.jsx("option",{value:G.value,children:G.label},G.value))})})]}),i.jsxs(lr,{error:z("registrationBaseFields"),children:[i.jsx(ur,{text:"Registration Base Fields",required:c.registrationRequired==="Yes"&&!n}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...z("registrationBaseFields")?{borderColor:"var(--destructive)"}:{}},value:c.registrationBaseFields,onChange:G=>N("registrationBaseFields",G.target.value),disabled:c.registrationRequired!=="Yes",children:RT.map(G=>i.jsx("option",{value:G.value,children:G.label},G.value))})})]})]}),i.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"12px",marginTop:"4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 10px",fontFamily:"var(--font-noto-sans)"},children:"Custom registration fields (optional)"}),c.customFields.map((G,U)=>i.jsxs("div",{style:{background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"12px",marginBottom:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-noto-sans)"},children:["Field ",U+1]}),i.jsx("button",{type:"button",onClick:()=>I(G.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--destructive)"},children:i.jsx(Xr,{size:14})})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:z(`cf_${G.id}_label`),children:[i.jsx(ur,{text:"Field Label",required:!0}),i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_label`)?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dietary preference",value:G.label,onChange:Q=>R(G.id,Q.target.value)})]}),i.jsxs(lr,{error:z(`cf_${G.id}_code`),children:[i.jsx(ur,{text:"Field Code",required:!0}),i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_code`)?{borderColor:"var(--destructive)"}:{},opacity:G.codeAuto?.92:1},placeholder:"auto from label",value:G.code||(G.codeAuto?Ch(G.label):""),onChange:Q=>F(G.id,Q.target.value)}),i.jsx("p",{style:{fontSize:"10px",color:"var(--muted)",margin:"4px 0 0"},children:"Auto-updates from label until you edit it."})]})]}),i.jsxs(lr,{error:z(`cf_${G.id}_type`),children:[i.jsx(ur,{text:"Field Type",required:!0}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...z(`cf_${G.id}_type`)?{borderColor:"var(--destructive)"}:{}},value:G.fieldType,onChange:Q=>M(G.id,Q.target.value),children:OT.map(Q=>i.jsx("option",{value:Q.value,children:Q.label},Q.value))})})]}),sc(G.fieldType)&&i.jsxs("div",{style:{marginTop:"10px"},children:[i.jsx(ur,{text:"Options (Value & Label)",required:!0}),z(`cf_${G.id}_options`)&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 6px"},children:z(`cf_${G.id}_options`)}),G.options.map(Q=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr auto",gap:"8px",alignItems:"start",marginBottom:"8px"},children:[i.jsx(lr,{error:z(`cf_${G.id}_opt_${Q.id}`),children:i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_opt_${Q.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Value",value:Q.value,onChange:K=>$(G.id,Q.id,"value",K.target.value)})}),i.jsx(lr,{error:z(`cf_${G.id}_opt_${Q.id}`),children:i.jsx("input",{style:{...Qr,...z(`cf_${G.id}_opt_${Q.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Label",value:Q.label,onChange:K=>$(G.id,Q.id,"label",K.target.value)})}),i.jsx("button",{type:"button",onClick:()=>X(G.id,Q.id),style:{padding:"8px",border:"none",background:"transparent",cursor:"pointer",color:"var(--destructive)",marginTop:"4px"},"aria-label":"Remove option",children:i.jsx(Xr,{size:14})})]},Q.id)),i.jsxs("button",{type:"button",onClick:()=>Y(G.id),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"var(--card)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(gr,{size:12})," Add option"]})]})]},G.id)),i.jsxs("button",{type:"button",onClick:C,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"var(--secondary)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add custom field"]})]})]})]}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",background:"var(--card)"},children:[v&&i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",flex:1},children:v}),i.jsx("button",{type:"button",disabled:h,onClick:()=>D(),style:{padding:"8px 20px",borderRadius:"var(--radius-button)",background:h?"var(--secondary)":"var(--primary)",color:h?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:h?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:h?"Saving…":"Save event"})]})]})]})}var Lg={},E5,xN;function wae(){return xN||(xN=1,E5=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),E5}var A5={},yf={},bN;function Uh(){if(bN)return yf;bN=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return yf.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17},yf.getSymbolTotalCodewords=function(n){return t[n]},yf.getBCHDigit=function(r){let n=0;for(;r!==0;)n++,r>>>=1;return n},yf.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');e=n},yf.isKanjiModeEnabled=function(){return typeof e<"u"},yf.toSJIS=function(n){return e(n)},yf}var T5={},wN;function LT(){return wN||(wN=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,o){if(e.isValid(n))return n;try{return t(n)}catch{return o}}})(T5)),T5}var P5,SN;function Sae(){if(SN)return P5;SN=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const r=Math.floor(t/8);return(this.buffer[r]>>>7-t%8&1)===1},put:function(t,r){for(let n=0;n<r;n++)this.putBit((t>>>r-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),t&&(this.buffer[r]|=128>>>this.length%8),this.length++}},P5=e,P5}var I5,jN;function jae(){if(jN)return I5;jN=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,r,n,o){const a=t*this.size+r;this.data[a]=n,o&&(this.reservedBit[a]=!0)},e.prototype.get=function(t,r){return this.data[t*this.size+r]},e.prototype.xor=function(t,r,n){this.data[t*this.size+r]^=n},e.prototype.isReserved=function(t,r){return this.reservedBit[t*this.size+r]},I5=e,I5}var O5={},kN;function kae(){return kN||(kN=1,(function(e){const t=Uh().getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const o=Math.floor(n/7)+2,a=t(n),s=a===145?26:Math.ceil((a-13)/(2*o-2))*2,l=[a-7];for(let c=1;c<o-1;c++)l[c]=l[c-1]-s;return l.push(6),l.reverse()},e.getPositions=function(n){const o=[],a=e.getRowColCoords(n),s=a.length;for(let l=0;l<s;l++)for(let c=0;c<s;c++)l===0&&c===0||l===0&&c===s-1||l===s-1&&c===0||o.push([a[l],a[c]]);return o}})(O5)),O5}var N5={},_N;function _ae(){if(_N)return N5;_N=1;const e=Uh().getSymbolSize,t=7;return N5.getPositions=function(n){const o=e(n);return[[0,0],[o-t,0],[0,o-t]]},N5}var R5={},CN;function Cae(){return CN||(CN=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(o){return o!=null&&o!==""&&!isNaN(o)&&o>=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const a=o.size;let s=0,l=0,c=0,u=null,d=null;for(let f=0;f<a;f++){l=c=0,u=d=null;for(let h=0;h<a;h++){let p=o.get(f,h);p===u?l++:(l>=5&&(s+=t.N1+(l-5)),u=p,l=1),p=o.get(h,f),p===d?c++:(c>=5&&(s+=t.N1+(c-5)),d=p,c=1)}l>=5&&(s+=t.N1+(l-5)),c>=5&&(s+=t.N1+(c-5))}return s},e.getPenaltyN2=function(o){const a=o.size;let s=0;for(let l=0;l<a-1;l++)for(let c=0;c<a-1;c++){const u=o.get(l,c)+o.get(l,c+1)+o.get(l+1,c)+o.get(l+1,c+1);(u===4||u===0)&&s++}return s*t.N2},e.getPenaltyN3=function(o){const a=o.size;let s=0,l=0,c=0;for(let u=0;u<a;u++){l=c=0;for(let d=0;d<a;d++)l=l<<1&2047|o.get(u,d),d>=10&&(l===1488||l===93)&&s++,c=c<<1&2047|o.get(d,u),d>=10&&(c===1488||c===93)&&s++}return s*t.N3},e.getPenaltyN4=function(o){let a=0;const s=o.data.length;for(let c=0;c<s;c++)a+=o.data[c];return Math.abs(Math.ceil(a*100/s/5)-10)*t.N4};function r(n,o,a){switch(n){case e.Patterns.PATTERN000:return(o+a)%2===0;case e.Patterns.PATTERN001:return o%2===0;case e.Patterns.PATTERN010:return a%3===0;case e.Patterns.PATTERN011:return(o+a)%3===0;case e.Patterns.PATTERN100:return(Math.floor(o/2)+Math.floor(a/3))%2===0;case e.Patterns.PATTERN101:return o*a%2+o*a%3===0;case e.Patterns.PATTERN110:return(o*a%2+o*a%3)%2===0;case e.Patterns.PATTERN111:return(o*a%3+(o+a)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(o,a){const s=a.size;for(let l=0;l<s;l++)for(let c=0;c<s;c++)a.isReserved(c,l)||a.xor(c,l,r(o,c,l))},e.getBestMask=function(o,a){const s=Object.keys(e.Patterns).length;let l=0,c=1/0;for(let u=0;u<s;u++){a(u),e.applyMask(u,o);const d=e.getPenaltyN1(o)+e.getPenaltyN2(o)+e.getPenaltyN3(o)+e.getPenaltyN4(o);e.applyMask(u,o),d<c&&(c=d,l=u)}return l}})(R5)),R5}var Y0={},EN;function WU(){if(EN)return Y0;EN=1;const e=LT(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Y0.getBlocksCount=function(o,a){switch(a){case e.L:return t[(o-1)*4+0];case e.M:return t[(o-1)*4+1];case e.Q:return t[(o-1)*4+2];case e.H:return t[(o-1)*4+3];default:return}},Y0.getTotalCodewordsCount=function(o,a){switch(a){case e.L:return r[(o-1)*4+0];case e.M:return r[(o-1)*4+1];case e.Q:return r[(o-1)*4+2];case e.H:return r[(o-1)*4+3];default:return}},Y0}var L5={},yy={},AN;function Eae(){if(AN)return yy;AN=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let n=1;for(let o=0;o<255;o++)e[o]=n,t[n]=o,n<<=1,n&256&&(n^=285);for(let o=255;o<512;o++)e[o]=e[o-255]})(),yy.log=function(n){if(n<1)throw new Error("log("+n+")");return t[n]},yy.exp=function(n){return e[n]},yy.mul=function(n,o){return n===0||o===0?0:e[t[n]+t[o]]},yy}var TN;function Aae(){return TN||(TN=1,(function(e){const t=Eae();e.mul=function(n,o){const a=new Uint8Array(n.length+o.length-1);for(let s=0;s<n.length;s++)for(let l=0;l<o.length;l++)a[s+l]^=t.mul(n[s],o[l]);return a},e.mod=function(n,o){let a=new Uint8Array(n);for(;a.length-o.length>=0;){const s=a[0];for(let c=0;c<o.length;c++)a[c]^=t.mul(o[c],s);let l=0;for(;l<a.length&&a[l]===0;)l++;a=a.slice(l)}return a},e.generateECPolynomial=function(n){let o=new Uint8Array([1]);for(let a=0;a<n;a++)o=e.mul(o,new Uint8Array([1,t.exp(a)]));return o}})(L5)),L5}var F5,PN;function Tae(){if(PN)return F5;PN=1;const e=Aae();function t(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(n){this.degree=n,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(n.length+this.degree);o.set(n);const a=e.mod(o,this.genPoly),s=this.degree-a.length;if(s>0){const l=new Uint8Array(this.degree);return l.set(a,s),l}return a},F5=t,F5}var z5={},M5={},D5={},IN;function qU(){return IN||(IN=1,D5.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),D5}var $c={},ON;function $U(){if(ON)return $c;ON=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
]))+`;$c.KANJI=new RegExp(r,"g"),$c.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),$c.BYTE=new RegExp(n,"g"),$c.NUMERIC=new RegExp(e,"g"),$c.ALPHANUMERIC=new RegExp(t,"g");const o=new RegExp("^"+r+"$"),a=new RegExp("^"+e+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return $c.testKanji=function(c){return o.test(c)},$c.testNumeric=function(c){return a.test(c)},$c.testAlphanumeric=function(c){return s.test(c)},$c}var NN;function Hh(){return NN||(NN=1,(function(e){const t=qU(),r=$U();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(a,s){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?a.ccBits[0]:s<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return r.testNumeric(a)?e.NUMERIC:r.testAlphanumeric(a)?e.ALPHANUMERIC:r.testKanji(a)?e.KANJI:e.BYTE},e.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},e.isValid=function(a){return a&&a.bit&&a.ccBits};function n(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+o)}}e.from=function(a,s){if(e.isValid(a))return a;try{return n(a)}catch{return s}}})(M5)),M5}var RN;function Pae(){return RN||(RN=1,(function(e){const t=Uh(),r=WU(),n=LT(),o=Hh(),a=qU(),s=7973,l=t.getBCHDigit(s);function c(h,p,v){for(let m=1;m<=40;m++)if(p<=e.getCapacity(m,v,h))return m}function u(h,p){return o.getCharCountIndicator(h,p)+4}function d(h,p){let v=0;return h.forEach(function(m){const b=u(m.mode,p);v+=b+m.getBitsLength()}),v}function f(h,p){for(let v=1;v<=40;v++)if(d(h,v)<=e.getCapacity(v,p,o.MIXED))return v}e.from=function(p,v){return a.isValid(p)?parseInt(p,10):v},e.getCapacity=function(p,v,m){if(!a.isValid(p))throw new Error("Invalid QR Code version");typeof m>"u"&&(m=o.BYTE);const b=t.getSymbolTotalCodewords(p),x=r.getTotalCodewordsCount(p,v),w=(b-x)*8;if(m===o.MIXED)return w;const k=w-u(m,p);switch(m){case o.NUMERIC:return Math.floor(k/10*3);case o.ALPHANUMERIC:return Math.floor(k/11*2);case o.KANJI:return Math.floor(k/13);case o.BYTE:default:return Math.floor(k/8)}},e.getBestVersionForData=function(p,v){let m;const b=n.from(v,n.M);if(Array.isArray(p)){if(p.length>1)return f(p,b);if(p.length===0)return 1;m=p[0]}else m=p;return c(m.mode,m.getLength(),b)},e.getEncodedBits=function(p){if(!a.isValid(p)||p<7)throw new Error("Invalid QR Code version");let v=p<<12;for(;t.getBCHDigit(v)-l>=0;)v^=s<<t.getBCHDigit(v)-l;return p<<12|v}})(z5)),z5}var B5={},LN;function Iae(){if(LN)return B5;LN=1;const e=Uh(),t=1335,r=21522,n=e.getBCHDigit(t);return B5.getEncodedBits=function(a,s){const l=a.bit<<3|s;let c=l<<10;for(;e.getBCHDigit(c)-n>=0;)c^=t<<e.getBCHDigit(c)-n;return(l<<10|c)^r},B5}var W5={},q5,FN;function Oae(){if(FN)return q5;FN=1;const e=Hh();function t(r){this.mode=e.NUMERIC,this.data=r.toString()}return t.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(n){let o,a,s;for(o=0;o+3<=this.data.length;o+=3)a=this.data.substr(o,3),s=parseInt(a,10),n.put(s,10);const l=this.data.length-o;l>0&&(a=this.data.substr(o),s=parseInt(a,10),n.put(s,l*3+1))},q5=t,q5}var $5,zN;function Nae(){if(zN)return $5;zN=1;const e=Hh(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(n){this.mode=e.ALPHANUMERIC,this.data=n}return r.getBitsLength=function(o){return 11*Math.floor(o/2)+6*(o%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(o){let a;for(a=0;a+2<=this.data.length;a+=2){let s=t.indexOf(this.data[a])*45;s+=t.indexOf(this.data[a+1]),o.put(s,11)}this.data.length%2&&o.put(t.indexOf(this.data[a]),6)},$5=r,$5}var U5,MN;function Rae(){if(MN)return U5;MN=1;const e=Hh();function t(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return t.getBitsLength=function(n){return n*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){for(let n=0,o=this.data.length;n<o;n++)r.put(this.data[n],8)},U5=t,U5}var H5,DN;function Lae(){if(DN)return H5;DN=1;const e=Hh(),t=Uh();function r(n){this.mode=e.KANJI,this.data=n}return r.getBitsLength=function(o){return o*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(n){let o;for(o=0;o<this.data.length;o++){let a=t.toSJIS(this.data[o]);if(a>=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[o]+`
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),n.put(a,13)}},H5=r,H5}var V5={exports:{}},BN;function Fae(){return BN||(BN=1,(function(e){var t={single_source_shortest_paths:function(r,n,o){var a={},s={};s[n]=0;var l=t.PriorityQueue.make();l.push(n,0);for(var c,u,d,f,h,p,v,m,b;!l.empty();){c=l.pop(),u=c.value,f=c.cost,h=r[u]||{};for(d in h)h.hasOwnProperty(d)&&(p=h[d],v=f+p,m=s[d],b=typeof s[d]>"u",(b||m>v)&&(s[d]=v,l.push(d,v),a[d]=u))}if(typeof o<"u"&&typeof s[o]>"u"){var x=["Could not find a path from ",n," to ",o,"."].join("");throw new Error(x)}return a},extract_shortest_path_from_predecessor_list:function(r,n){for(var o=[],a=n;a;)o.push(a),r[a],a=r[a];return o.reverse(),o},find_path:function(r,n,o){var a=t.single_source_shortest_paths(r,n,o);return t.extract_shortest_path_from_predecessor_list(a,o)},PriorityQueue:{make:function(r){var n=t.PriorityQueue,o={},a;r=r||{};for(a in n)n.hasOwnProperty(a)&&(o[a]=n[a]);return o.queue=[],o.sorter=r.sorter||n.default_sorter,o},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var o={value:r,cost:n};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(V5)),V5.exports}var WN;function zae(){return WN||(WN=1,(function(e){const t=Hh(),r=Oae(),n=Nae(),o=Rae(),a=Lae(),s=$U(),l=Uh(),c=Fae();function u(x){return unescape(encodeURIComponent(x)).length}function d(x,w,k){const j=[];let _;for(;(_=x.exec(k))!==null;)j.push({data:_[0],index:_.index,mode:w,length:_[0].length});return j}function f(x){const w=d(s.NUMERIC,t.NUMERIC,x),k=d(s.ALPHANUMERIC,t.ALPHANUMERIC,x);let j,_;return l.isKanjiModeEnabled()?(j=d(s.BYTE,t.BYTE,x),_=d(s.KANJI,t.KANJI,x)):(j=d(s.BYTE_KANJI,t.BYTE,x),_=[]),w.concat(k,j,_).sort(function(A,P){return A.index-P.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function h(x,w){switch(w){case t.NUMERIC:return r.getBitsLength(x);case t.ALPHANUMERIC:return n.getBitsLength(x);case t.KANJI:return a.getBitsLength(x);case t.BYTE:return o.getBitsLength(x)}}function p(x){return x.reduce(function(w,k){const j=w.length-1>=0?w[w.length-1]:null;return j&&j.mode===k.mode?(w[w.length-1].data+=k.data,w):(w.push(k),w)},[])}function v(x){const w=[];for(let k=0;k<x.length;k++){const j=x[k];switch(j.mode){case t.NUMERIC:w.push([j,{data:j.data,mode:t.ALPHANUMERIC,length:j.length},{data:j.data,mode:t.BYTE,length:j.length}]);break;case t.ALPHANUMERIC:w.push([j,{data:j.data,mode:t.BYTE,length:j.length}]);break;case t.KANJI:w.push([j,{data:j.data,mode:t.BYTE,length:u(j.data)}]);break;case t.BYTE:w.push([{data:j.data,mode:t.BYTE,length:u(j.data)}])}}return w}function m(x,w){const k={},j={start:{}};let _=["start"];for(let T=0;T<x.length;T++){const A=x[T],P=[];for(let N=0;N<A.length;N++){const O=A[N],C=""+T+N;P.push(C),k[C]={node:O,lastCount:0},j[C]={};for(let I=0;I<_.length;I++){const R=_[I];k[R]&&k[R].node.mode===O.mode?(j[R][C]=h(k[R].lastCount+O.length,O.mode)-h(k[R].lastCount,O.mode),k[R].lastCount+=O.length):(k[R]&&(k[R].lastCount=O.length),j[R][C]=h(O.length,O.mode)+4+t.getCharCountIndicator(O.mode,w))}}_=P}for(let T=0;T<_.length;T++)j[_[T]].end=0;return{map:j,table:k}}function b(x,w){let k;const j=t.getBestModeForData(x);if(k=t.from(w,j),k!==t.BYTE&&k.bit<j.bit)throw new Error('"'+x+'" cannot be encoded with mode '+t.toString(k)+`.
Suggested mode is: `+t.toString(j));switch(k===t.KANJI&&!l.isKanjiModeEnabled()&&(k=t.BYTE),k){case t.NUMERIC:return new r(x);case t.ALPHANUMERIC:return new n(x);case t.KANJI:return new a(x);case t.BYTE:return new o(x)}}e.fromArray=function(w){return w.reduce(function(k,j){return typeof j=="string"?k.push(b(j,null)):j.data&&k.push(b(j.data,j.mode)),k},[])},e.fromString=function(w,k){const j=f(w,l.isKanjiModeEnabled()),_=v(j),T=m(_,k),A=c.find_path(T.map,"start","end"),P=[];for(let N=1;N<A.length-1;N++)P.push(T.table[A[N]].node);return e.fromArray(p(P))},e.rawSplit=function(w){return e.fromArray(f(w,l.isKanjiModeEnabled()))}})(W5)),W5}var qN;function Mae(){if(qN)return A5;qN=1;const e=Uh(),t=LT(),r=Sae(),n=jae(),o=kae(),a=_ae(),s=Cae(),l=WU(),c=Tae(),u=Pae(),d=Iae(),f=Hh(),h=zae();function p(T,A){const P=T.size,N=a.getPositions(A);for(let O=0;O<N.length;O++){const C=N[O][0],I=N[O][1];for(let R=-1;R<=7;R++)if(!(C+R<=-1||P<=C+R))for(let F=-1;F<=7;F++)I+F<=-1||P<=I+F||(R>=0&&R<=6&&(F===0||F===6)||F>=0&&F<=6&&(R===0||R===6)||R>=2&&R<=4&&F>=2&&F<=4?T.set(C+R,I+F,!0,!0):T.set(C+R,I+F,!1,!0))}}function v(T){const A=T.size;for(let P=8;P<A-8;P++){const N=P%2===0;T.set(P,6,N,!0),T.set(6,P,N,!0)}}function m(T,A){const P=o.getPositions(A);for(let N=0;N<P.length;N++){const O=P[N][0],C=P[N][1];for(let I=-2;I<=2;I++)for(let R=-2;R<=2;R++)I===-2||I===2||R===-2||R===2||I===0&&R===0?T.set(O+I,C+R,!0,!0):T.set(O+I,C+R,!1,!0)}}function b(T,A){const P=T.size,N=u.getEncodedBits(A);let O,C,I;for(let R=0;R<18;R++)O=Math.floor(R/3),C=R%3+P-8-3,I=(N>>R&1)===1,T.set(O,C,I,!0),T.set(C,O,I,!0)}function x(T,A,P){const N=T.size,O=d.getEncodedBits(A,P);let C,I;for(C=0;C<15;C++)I=(O>>C&1)===1,C<6?T.set(C,8,I,!0):C<8?T.set(C+1,8,I,!0):T.set(N-15+C,8,I,!0),C<8?T.set(8,N-C-1,I,!0):C<9?T.set(8,15-C-1+1,I,!0):T.set(8,15-C-1,I,!0);T.set(N-8,8,1,!0)}function w(T,A){const P=T.size;let N=-1,O=P-1,C=7,I=0;for(let R=P-1;R>0;R-=2)for(R===6&&R--;;){for(let F=0;F<2;F++)if(!T.isReserved(O,R-F)){let M=!1;I<A.length&&(M=(A[I]>>>C&1)===1),T.set(O,R-F,M),C--,C===-1&&(I++,C=7)}if(O+=N,O<0||P<=O){O-=N,N=-N;break}}}function k(T,A,P){const N=new r;P.forEach(function(F){N.put(F.mode.bit,4),N.put(F.getLength(),f.getCharCountIndicator(F.mode,T)),F.write(N)});const O=e.getSymbolTotalCodewords(T),C=l.getTotalCodewordsCount(T,A),I=(O-C)*8;for(N.getLengthInBits()+4<=I&&N.put(0,4);N.getLengthInBits()%8!==0;)N.putBit(0);const R=(I-N.getLengthInBits())/8;for(let F=0;F<R;F++)N.put(F%2?17:236,8);return j(N,T,A)}function j(T,A,P){const N=e.getSymbolTotalCodewords(A),O=l.getTotalCodewordsCount(A,P),C=N-O,I=l.getBlocksCount(A,P),R=N%I,F=I-R,M=Math.floor(N/I),Y=Math.floor(C/I),X=Y+1,$=M-Y,ee=new c($);let V=0;const D=new Array(I),z=new Array(I);let q=0;const G=new Uint8Array(T.buffer);for(let H=0;H<I;H++){const ie=H<F?Y:X;D[H]=G.slice(V,V+ie),z[H]=ee.encode(D[H]),V+=ie,q=Math.max(q,ie)}const U=new Uint8Array(N);let Q=0,K,re;for(K=0;K<q;K++)for(re=0;re<I;re++)K<D[re].length&&(U[Q++]=D[re][K]);for(K=0;K<$;K++)for(re=0;re<I;re++)U[Q++]=z[re][K];return U}function _(T,A,P,N){let O;if(Array.isArray(T))O=h.fromArray(T);else if(typeof T=="string"){let M=A;if(!M){const Y=h.rawSplit(T);M=u.getBestVersionForData(Y,P)}O=h.fromString(T,M||40)}else throw new Error("Invalid data");const C=u.getBestVersionForData(O,P);if(!C)throw new Error("The amount of data is too big to be stored in a QR Code");if(!A)A=C;else if(A<C)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+C+`.
`);const I=k(A,P,O),R=e.getSymbolSize(A),F=new n(R);return p(F,A),v(F),m(F,A),x(F,P,0),A>=7&&b(F,A),w(F,I),isNaN(N)&&(N=s.getBestMask(F,x.bind(null,F,P))),s.applyMask(N,F),x(F,P,N),{modules:F,version:A,errorCorrectionLevel:P,maskPattern:N,segments:O}}return A5.create=function(A,P){if(typeof A>"u"||A==="")throw new Error("No input text");let N=t.M,O,C;return typeof P<"u"&&(N=t.from(P.errorCorrectionLevel,t.M),O=u.from(P.version),C=s.from(P.maskPattern),P.toSJISFunc&&e.setToSJISFunction(P.toSJISFunc)),_(A,O,N,C)},A5}var Y5={},G5={},$N;function UU(){return $N||($N=1,(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const o=parseInt(n.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const o=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,a=n.width&&n.width>=21?n.width:void 0,s=n.scale||4;return{width:a,scale:a?4:s,margin:o,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,o){return o.width&&o.width>=n+o.margin*2?o.width/(n+o.margin*2):o.scale},e.getImageWidth=function(n,o){const a=e.getScale(n,o);return Math.floor((n+o.margin*2)*a)},e.qrToImageData=function(n,o,a){const s=o.modules.size,l=o.modules.data,c=e.getScale(s,a),u=Math.floor((s+a.margin*2)*c),d=a.margin*c,f=[a.color.light,a.color.dark];for(let h=0;h<u;h++)for(let p=0;p<u;p++){let v=(h*u+p)*4,m=a.color.light;if(h>=d&&p>=d&&h<u-d&&p<u-d){const b=Math.floor((h-d)/c),x=Math.floor((p-d)/c);m=f[l[b*s+x]?1:0]}n[v++]=m.r,n[v++]=m.g,n[v++]=m.b,n[v]=m.a}}})(G5)),G5}var UN;function Dae(){return UN||(UN=1,(function(e){const t=UU();function r(o,a,s){o.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=s,a.width=s,a.style.height=s+"px",a.style.width=s+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,s,l){let c=l,u=s;typeof c>"u"&&(!s||!s.getContext)&&(c=s,s=void 0),s||(u=n()),c=t.getOptions(c);const d=t.getImageWidth(a.modules.size,c),f=u.getContext("2d"),h=f.createImageData(d,d);return t.qrToImageData(h.data,a,c),r(f,u,d),f.putImageData(h,0,0),u},e.renderToDataURL=function(a,s,l){let c=l;typeof c>"u"&&(!s||!s.getContext)&&(c=s,s=void 0),c||(c={});const u=e.render(a,s,c),d=c.type||"image/png",f=c.rendererOpts||{};return u.toDataURL(d,f.quality)}})(Y5)),Y5}var K5={},HN;function Bae(){if(HN)return K5;HN=1;const e=UU();function t(o,a){const s=o.a/255,l=a+'="'+o.hex+'"';return s<1?l+" "+a+'-opacity="'+s.toFixed(2).slice(1)+'"':l}function r(o,a,s){let l=o+a;return typeof s<"u"&&(l+=" "+s),l}function n(o,a,s){let l="",c=0,u=!1,d=0;for(let f=0;f<o.length;f++){const h=Math.floor(f%a),p=Math.floor(f/a);!h&&!u&&(u=!0),o[f]?(d++,f>0&&h>0&&o[f-1]||(l+=u?r("M",h+s,.5+p+s):r("m",c,0),c=0,u=!1),h+1<a&&o[f+1]||(l+=r("h",d),d=0)):c++}return l}return K5.render=function(a,s,l){const c=e.getOptions(s),u=a.modules.size,d=a.modules.data,f=u+c.margin*2,h=c.color.light.a?"<path "+t(c.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",p="<path "+t(c.color.dark,"stroke")+' d="'+n(d,u,c.margin)+'"/>',v='viewBox="0 0 '+f+" "+f+'"',b='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+v+' shape-rendering="crispEdges">'+h+p+`</svg>
`;return typeof l=="function"&&l(null,b),b},K5}var VN;function Wae(){if(VN)return Lg;VN=1;const e=wae(),t=Mae(),r=Dae(),n=Bae();function o(a,s,l,c,u){const d=[].slice.call(arguments,1),f=d.length,h=typeof d[f-1]=="function";if(!h&&!e())throw new Error("Callback required as last argument");if(h){if(f<2)throw new Error("Too few arguments provided");f===2?(u=l,l=s,s=c=void 0):f===3&&(s.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=l,l=s,s=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=s,s=c=void 0):f===2&&!s.getContext&&(c=l,l=s,s=void 0),new Promise(function(p,v){try{const m=t.create(l,c);p(a(m,s,c))}catch(m){v(m)}})}try{const p=t.create(l,c);u(null,a(p,s,c))}catch(p){u(p)}}return Lg.create=t.create,Lg.toCanvas=o.bind(null,r.render),Lg.toDataURL=o.bind(null,r.renderToDataURL),Lg.toString=o.bind(null,function(a,s,l){return n.render(a,l)}),Lg}var qae=Wae();const _v=dn(qae);function $ae(e){return`https://eventbuzz.live/code/${e}`}function Uae(e,t){return new Promise((r,n)=>{const o=new Image;o.onload=()=>{const a=o.naturalWidth,s=o.naturalHeight,l=32,c=24,u=20,d=28,f=22,h=document.createElement("canvas"),p=h.getContext("2d");if(!p){n(new Error("Canvas not supported"));return}p.font=`bold ${f}px ui-monospace, "Courier New", Courier, monospace`,p.letterSpacing="3px";const v=p.measureText(t).width,m=f+10,b=Math.ceil(Math.max(a+l*2,v+l*2)),x=c+s+u+m+d;h.width=b,h.height=x,p.fillStyle="#ffffff",p.fillRect(0,0,b,x);const w=(b-a)/2;p.drawImage(o,w,c),p.fillStyle="#0f172a",p.font=`bold ${f}px ui-monospace, "Courier New", Courier, monospace`,p.letterSpacing="3px",p.textAlign="center",p.textBaseline="top";const k=c+s+u;p.fillText(t,b/2,k);try{r(h.toDataURL("image/png"))}catch(j){n(j)}},o.onerror=()=>n(new Error("Failed to load QR image")),o.src=e})}function FT({open:e,onClose:t,kind:r,joinCode:n,label:o}){const a=n.trim(),s=a?$ae(a):"",[l,c]=S.useState(null),[u,d]=S.useState(null),[f,h]=S.useState(!1),[p,v]=S.useState(!1);S.useEffect(()=>{if(!e){c(null),d(null),h(!1);return}if(!s){c(null),d(null);return}let w=!1;return d(null),_v.toDataURL(s,{width:256,margin:2,color:{dark:"#0f172a",light:"#ffffff"}}).then(k=>{w||c(k)}).catch(()=>{w||d("Could not generate QR code.")}),()=>{w=!0}},[e,s]);const m=()=>{s&&navigator.clipboard.writeText(s).then(()=>{h(!0),window.setTimeout(()=>h(!1),2e3)})},b=async()=>{if(!(!a||!l||p)){v(!0);try{const w=await Uae(l,a),k=document.createElement("a");k.href=w,k.download=`eventbuzz-${r}-${a}.png`,k.click()}catch{const w=document.createElement("a");w.href=l,w.download=`eventbuzz-${r}-${a}.png`,w.click()}finally{v(!1)}}};if(!e)return null;const x=r==="track"?"Track":r==="session"?"Session":"Event";return i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"agenda-qr-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},onClick:t,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"400px",padding:"20px",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border)"},onClick:w=>w.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"16px"},children:[i.jsxs("div",{children:[i.jsxs("h2",{id:"agenda-qr-title",style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:[x," QR code"]}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:1.4},children:o}),r==="event"&&a?i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"6px",lineHeight:1.4},children:["Same ",i.jsx("code",{style:{fontSize:"10px"},children:"/code/…"})," flow as sessions: scan resolves session first, then track, then this event."]}):null]}),i.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",color:"var(--card-foreground)",flexShrink:0},children:i.jsx(Gt,{size:16})})]}),a?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{textAlign:"center",marginBottom:"16px"},children:[i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"6px"},children:"Code"}),i.jsx("p",{style:{fontFamily:"ui-monospace, monospace",fontSize:"22px",fontWeight:700,letterSpacing:"0.12em",color:"var(--foreground)",userSelect:"all"},children:a})]}),i.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"200px",background:"var(--secondary)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",marginBottom:"16px"},children:u?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",padding:"16px"},children:u}):l?i.jsx("img",{src:l,alt:`QR code for ${s}`,style:{width:200,height:200,display:"block"}}):i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Generating…"})}),i.jsxs("div",{style:{marginBottom:"12px"},children:[i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Link"}),i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"stretch",flexWrap:"wrap"},children:[i.jsx("input",{readOnly:!0,value:s,onFocus:w=>w.target.select(),style:{flex:1,minWidth:"160px",padding:"8px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",fontSize:"12px",fontFamily:"ui-monospace, monospace",color:"var(--foreground)"}}),i.jsxs("button",{type:"button",onClick:m,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:f?"var(--accent)":"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},children:[i.jsx(Js,{size:14})," ",f?"Copied":"Copy"]})]})]}),i.jsxs("button",{type:"button",onClick:()=>void b(),disabled:!l||p,style:{width:"100%",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"10px 14px",borderRadius:"var(--radius-button)",border:"none",background:l&&!p?"var(--primary)":"var(--muted)",color:l&&!p?"var(--primary-foreground)":"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:l&&!p?"pointer":"not-allowed"},children:[i.jsx(ja,{size:16})," ",p?"Preparing…":"Download PNG (QR + code)"]}),i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"8px",textAlign:"center",lineHeight:1.4},children:"The saved image includes your code printed below the QR."})]}):i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",padding:"12px 0",textAlign:"center",lineHeight:1.5},children:r==="event"?i.jsxs(i.Fragment,{children:["This event has no join code yet. Open the event in the dashboard and save once, or run"," ",i.jsx("code",{style:{fontSize:"11px"},children:"npm run backfill:join-codes"})," in the backend."]}):i.jsxs(i.Fragment,{children:["No join code on this record yet. Reload the agenda after save, or run"," ",i.jsx("code",{style:{fontSize:"11px"},children:"npm run backfill:join-codes"})," in the backend once."]})})]})})}const YN={display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer",transition:"all 0.15s"};function Hae(){const{selectedEventId:e}=Li(),t=Si(),r=t==="mobile"||t==="tablet",[n,o]=S.useState(!1),[a,s]=S.useState(!1),[l,c]=S.useState(void 0);S.useEffect(()=>{if(!n||!e){c(void 0);return}c(void 0);let f=!1;return Lr.get(e).then(h=>{f||c(h.data??null)}),()=>{f=!0}},[n,e]);function u(){if(!e){window.alert("Select an event from the sidebar first.");return}o(!0)}function d(){!a&&!window.confirm("Start broadcasting this event as Live? All participants will be notified.")||s(f=>!f)}return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:u,disabled:!e,style:{...YN,borderColor:"var(--border)",background:"var(--card)",color:"var(--card-foreground)",opacity:e?1:.55,cursor:e?"pointer":"not-allowed"},onMouseEnter:f=>{e&&(f.currentTarget.style.borderColor="var(--primary)",f.currentTarget.style.color="var(--primary)")},onMouseLeave:f=>{f.currentTarget.style.borderColor="var(--border)",f.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Zf,{size:14}),r?"QR":"Generate QR Code"]}),i.jsxs("button",{type:"button",onClick:d,style:{...YN,borderColor:a?"var(--destructive)":"var(--border)",background:a?"var(--destructive)":"var(--card)",color:a?"var(--destructive-foreground)":"var(--card-foreground)"},onMouseEnter:f=>{a||(f.currentTarget.style.borderColor="var(--primary)",f.currentTarget.style.color="var(--primary)")},onMouseLeave:f=>{a||(f.currentTarget.style.borderColor="var(--border)",f.currentTarget.style.color="var(--card-foreground)")},children:[a?i.jsx("span",{style:{width:"7px",height:"7px",borderRadius:"50%",background:"var(--destructive-foreground)",display:"block"}}):i.jsx(Hre,{size:14}),a?"Stop Live":"Go Live"]})]}),n&&e&&l!==void 0?i.jsx(FT,{open:!0,onClose:()=>o(!1),kind:"event",joinCode:((l==null?void 0:l.joinCode)??"").trim(),label:(l==null?void 0:l.name)??"Event"}):null,n&&e&&l===void 0?i.jsx("div",{role:"status","aria-live":"polite",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},children:i.jsx("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:"24px 32px",border:"1px solid var(--border)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Loading event…"})}):null]})}const D1=[{key:"registrationComplete",label:"Registration complete",hint:"Awarded once when someone joins the event"},{key:"questionAsk",label:"Ask a question",hint:"Per question (signed-in attendee)"},{key:"questionUpvote",label:"Upvote a question",hint:"Per upvote state change"},{key:"questionDownvote",label:"Downvote a question",hint:"Per downvote state change"},{key:"quizPollSubmitted",label:"Quiz submitted",hint:"When a visitor completes a quiz"},{key:"quizCorrectPerQuestion",label:"Correct quiz answer",hint:"Loyalty per correct objective question"},{key:"pollParticipation",label:"Poll / survey participation",hint:"When a visitor submits a poll or survey"},{key:"feedbackFormSubmitted",label:"Feedback form (reserved)",hint:"Wire when visitor feedback API exists"},{key:"ratingSubmitted",label:"Rating (reserved)",hint:"Wire when visitor rating API exists"}];function Vae(e){return e?D1.filter(t=>{const r=e[t.key];return r!=null&&Number(r)>0}).length:0}function Yae(e,t){return{name:e.name,type:e.type,status:e.status,startDate:e.startDate,endDate:e.endDate,subtitle:e.subtitle??null,description:e.description??null,category:e.category??null,location:e.location??null,locationType:e.locationType??void 0,virtualLink:e.virtualLink??null,tags:e.tags,image:e.image??null,bannerImage:e.bannerImage??null,settings:e.settings,metadata:e.metadata,rewardRules:t}}function Gae({initialRules:e,onClose:t,onSave:r,saving:n}){const[o,a]=S.useState(()=>{const c={};for(const{key:u}of D1){const d=e[u];c[u]=d!=null&&d!==""?String(d):""}return c}),s=(c,u)=>a(d=>({...d,[c]:u})),l=()=>{const c={};for(const{key:u}of D1){const d=String(o[u]??"").trim();if(d==="")continue;const f=Number(d);Number.isFinite(f)&&f>=0&&(c[u]=f)}r(c)};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:201,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"reward-rules-title",style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"520px",boxShadow:"var(--elevation-sm)",display:"flex",flexDirection:"column",maxHeight:"90vh"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 22px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("div",{children:[i.jsx("p",{id:"reward-rules-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"2px"},children:"Reward rules"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Set to 0 or leave blank to disable. Session and quiz settings can override later."})]}),i.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",marginLeft:"12px"},children:i.jsx(Gt,{size:16})})]}),i.jsx("div",{style:{padding:"20px 22px",display:"flex",flexDirection:"column",gap:"12px",overflowY:"auto"},children:D1.map(c=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[i.jsxs("div",{style:{flex:1},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",marginBottom:"1px"},children:c.label}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:c.hint})]}),i.jsxs("div",{style:{display:"flex",alignItems:"stretch",flexShrink:0},children:[i.jsx("input",{type:"number",min:0,max:1e4,value:o[c.key]??"",onChange:u=>s(c.key,u.target.value),style:{width:"68px",height:"34px",padding:"0 8px",borderRadius:"var(--radius-button) 0 0 var(--radius-button)",border:"1px solid var(--border)",borderRight:"none",background:"var(--card)",fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",textAlign:"center"}}),i.jsx("div",{style:{padding:"0 10px",height:"34px",display:"flex",alignItems:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"0 var(--radius-button) var(--radius-button) 0"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:"pts"})})]})]},c.key))}),i.jsxs("div",{style:{padding:"14px 22px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsxs("button",{type:"button",disabled:n,onClick:l,style:{display:"flex",alignItems:"center",gap:"5px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:n?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:n?.75:1},children:[i.jsx(sS,{size:13})," Save"]})]})]})})}function Kae({eventId:e,onClose:t,onSaved:r}){const[n,o]=S.useState(null),[a,s]=S.useState(!0),[l,c]=S.useState(null),[u,d]=S.useState(!1);S.useEffect(()=>{let h=!1;return s(!0),c(null),Lr.get(e).then(p=>{h||(p.error||!p.data?(c(typeof p.error=="string"?p.error:"Failed to load event."),o(null)):o(p.data),s(!1))}),()=>{h=!0}},[e]);const f=async h=>{if(n){d(!0);try{(await Lr.update(e,Yae(n,h))).error||(r==null||r(),t())}finally{d(!1)}}};return a?i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:201,display:"flex",alignItems:"center",justifyContent:"center",backdropFilter:"blur(2px)"},children:i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",background:"var(--card)",padding:"16px 24px",borderRadius:"var(--radius-card)",border:"1px solid var(--border)"},children:"Loading reward rules…"})}):l||!n?i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:201,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:"20px 24px",maxWidth:400,border:"1px solid var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--destructive)",margin:"0 0 12px"},children:l??"Event not found."}),i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:"Close"})]})}):i.jsx(Gae,{initialRules:n.rewardRules||{},onClose:t,onSave:f,saving:u})}const Ht={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},Tr={...Ht,cursor:"pointer",appearance:"none",paddingRight:"32px"};({...Ht});const St=e=>{e.currentTarget.style.borderColor="var(--primary)",e.currentTarget.style.boxShadow="0 0 0 2px rgba(11,77,209,0.10)"},jt=e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"};function ht({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"3px"},children:"*"}),e]})}function Vt({text:e}){return i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{fontSize:"10px"},children:"ℹ"})," ",e]})}function dt({children:e,span2:t,error:r}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gridColumn:t?"1 / -1":void 0},children:[e,r&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"4px 0 0"},children:r})]})}function ro({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function Zr({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(go,{size:13,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function Hi({name:e,value:t,onChange:r,options:n}){return i.jsx("div",{style:{display:"flex",gap:"20px",alignItems:"center",paddingTop:"2px"},children:n.map(o=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",fontWeight:"var(--font-weight-normal)"},children:[i.jsx("input",{type:"radio",name:e,value:o.value,checked:t===o.value,onChange:()=>r(o.value),style:{accentColor:"var(--primary)",width:"16px",height:"16px",cursor:"pointer"}}),o.label]},o.value))})}function u2({text:e,onRemove:t}){return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 8px",borderRadius:"var(--radius-button)",background:"var(--accent)",border:"1px solid var(--accent-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--accent-foreground)"},children:[e,t&&i.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0,lineHeight:1},children:i.jsx(Gt,{size:10})})]})}function Qae(){return i.jsx("div",{style:{height:"1px",background:"var(--border)",margin:"4px 0"}})}function Nm({text:e}){return i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"8px",marginTop:"4px"},children:e})}function Xae({n:e,state:t}){return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:t==="todo"?"var(--muted)":"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(bi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function Ur({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onSave:l,nextLabel:c,nextDisabled:u,sectionError:d}){const f=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(Xae,{n:e,state:f}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:n?"var(--primary)":"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx(Qf,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(go,{size:18,style:{color:"var(--muted)",flexShrink:0}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px 40px"},children:r}),d&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"0 0 12px 40px"},children:d}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:s}),i.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",marginTop:"20px",paddingTop:"14px",borderTop:"1px solid var(--border)"},children:i.jsx("button",{type:"button",disabled:u,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 18px",borderRadius:"var(--radius-button)",background:u?"var(--secondary)":"var(--primary)",color:u?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:u?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})})]})]})}function ra({children:e,onClose:t,title:r,breadcrumb:n,description:o,completedCount:a,totalSections:s,ctaLabel:l,ctaDisabled:c,onCtaClick:u,showProgress:d=!0,hidePrimaryCta:f=!1,panelWidth:h}){const p=s>0?Math.round(a/s*100):0,v=u?!c:!c&&a>=s;return i.jsxs(i.Fragment,{children:[i.jsx("style",{children:"@keyframes __panelIn { from { transform:translateX(100%); opacity:.6 } to { transform:translateX(0); opacity:1 } }"}),i.jsx("div",{role:"presentation",onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200}}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"__panel-shell-title",onClick:m=>m.stopPropagation(),style:{position:"fixed",top:0,right:0,height:"100%",width:h??"min(560px,100vw)",maxWidth:"100vw",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)",animation:"__panelIn .25s cubic-bezier(.4,0,.2,1)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:d?"14px":"0"},children:[i.jsxs("div",{style:{flex:1,minWidth:0},children:[n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 3px"},children:n}),i.jsx("h3",{id:"__panel-shell-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:r}),o&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"5px 0 0"},children:o})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:t,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:m=>{m.currentTarget.style.borderColor="var(--destructive)",m.currentTarget.style.color="var(--destructive)"},onMouseLeave:m=>{m.currentTarget.style.borderColor="var(--border)",m.currentTarget.style.color="var(--muted)"},children:i.jsx(Gt,{size:14})}),!f&&i.jsx("button",{type:"button",disabled:!v,onClick:()=>v&&(u==null?void 0:u()),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:v?"var(--primary)":"var(--secondary)",color:v?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:v?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"background .2s"},children:l})]})]}),d&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[a," of ",s," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[p,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${p}%`,background:p===100?"#22c55e":"var(--primary)",borderRadius:"99px",transition:"width .35s ease"}})})]})]}),i.jsx("div",{style:{flex:1,overflowY:"auto"},children:e})]})]})}function wc(e){const[t,r]=S.useState(1),[n,o]=S.useState(new Set);return{open:t,done:n,advance:l=>{o(c=>new Set([...c,l])),l<e&&r(l+1)},toggle:l=>r(c=>c===l?0:l)}}function Zae(e){return e?typeof e=="string"?e:String(e._id??""):""}const HU=["Star Rating","NPS (0–10)","Multiple Choice","Radio","Short Text","Long Text","Checkboxes","Yes / No"],VU=["Text","Email","Phone","Dropdown","Radio","Checkboxes","Yes / No","Date","File Upload"],Jae=[...new Set([...HU,...VU])],$f=new Set(["Multiple Choice","Dropdown","Radio","Checkboxes"]),GN={Text:"text",Email:"email",Phone:"phone",Dropdown:"select",Radio:"radio",Checkboxes:"checkboxes","Yes / No":"checkbox",Date:"text","File Upload":"file"},ese=[{value:"",label:"Don't map (submission only)"},{value:"phone",label:"Phone"},{value:"organization",label:"Organization"},{value:"designation",label:"Designation"},{value:"notes",label:"Notes"},{value:"displayName",label:"Display name"},{value:"custom",label:"Custom field (key below)"}];function YU(e){return(e.options??[]).map(t=>String(t).trim()).filter(Boolean)}function KN(e){return $f.has(e.type)?YU(e).length>=2:!0}function zT(){return["Option 1","Option 2"]}function GU({options:e,onChange:t}){const r=e.length?e:["",""],n=(s,l)=>{const c=[...r];c[s]=l,t(c)},o=()=>t([...r,""]),a=s=>{r.length<=1||t(r.filter((l,c)=>c!==s))};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",paddingTop:"4px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontWeight:600,fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Choices"}),r.map((s,l)=>i.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[i.jsx("input",{style:{...Ht,flex:1},placeholder:`Choice ${l+1}`,value:s,onChange:c=>n(l,c.target.value),onFocus:St,onBlur:jt}),i.jsx("button",{type:"button",onClick:()=>a(l),disabled:r.length<=1,title:"Remove choice",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:r.length<=1?"not-allowed":"pointer",opacity:r.length<=1?.45:1,flexShrink:0},children:i.jsx(Xr,{size:13})})]},l)),i.jsxs("button",{type:"button",onClick:o,style:{alignSelf:"flex-start",display:"flex",alignItems:"center",gap:"6px",padding:"5px 10px",borderRadius:"var(--radius-button)",border:"1px dashed var(--border)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(gr,{size:12})," Add choice"]}),i.jsx(Vt,{text:"At least two non-empty choices are required."})]})}function M3(){return[{id:"reg-core-fn",label:"First name",type:"Text",required:"Yes",mapsTo:"firstName",fixed:!0},{id:"reg-core-ln",label:"Last name",type:"Text",required:"Yes",mapsTo:"lastName",fixed:!0},{id:"reg-core-em",label:"Email",type:"Email",required:"Yes",mapsTo:"email",fixed:!0}]}function tse({q:e,types:t,onPatch:r,onRemove:n,idx:o,canRemove:a}){const s=$f.has(e.type);return i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:[i.jsx("div",{style:{color:"var(--muted)",paddingTop:"6px",flexShrink:0},children:i.jsx(wv,{size:14})}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:a?"1fr auto auto auto":"1fr auto auto",gap:"8px",alignItems:"center"},children:[i.jsx("input",{style:Ht,placeholder:`Question ${o+1}`,value:e.label,onChange:l=>r({label:l.target.value}),onFocus:St,onBlur:jt}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:{...Tr,width:"auto",minWidth:"130px"},value:e.type,onChange:l=>{var d;const c=l.target.value,u={type:c};$f.has(c)?u.options=(d=e.options)!=null&&d.length?e.options:zT():u.options=[],r(u)},onFocus:St,onBlur:jt,children:t.map(l=>i.jsx("option",{children:l},l))})}),a&&i.jsx("button",{onClick:n,type:"button",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer",flexShrink:0},children:i.jsx(Xr,{size:13})})]}),s&&i.jsx(GU,{options:e.options??[],onChange:l=>r({options:l})}),i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[i.jsx("input",{type:"checkbox",checked:e.required==="Yes",onChange:l=>r({required:l.target.checked?"Yes":"No"}),style:{accentColor:"var(--primary)",width:"13px",height:"13px"}}),"Required field"]})})]})]})}function rse({q:e,idx:t,onPatch:r}){return i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start",padding:"10px 12px",background:"var(--accent)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:[i.jsx("div",{style:{color:"var(--muted)",paddingTop:"6px",flexShrink:0},children:i.jsx(wv,{size:14})}),i.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:i.jsxs("span",{style:{fontSize:"10px",fontWeight:600,fontFamily:"var(--font-noto-sans)",color:"var(--primary)",textTransform:"uppercase"},children:["Core · maps to ",e.mapsTo]})}),i.jsx("input",{style:Ht,placeholder:e.mapsTo==="email"?"Email address":"Label shown to registrants",value:e.label,onChange:n=>r({label:n.target.value}),onFocus:St,onBlur:jt})]})]})}function nse({q:e,types:t,onPatch:r,onRemove:n,idx:o}){const a=$f.has(e.type);return i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[i.jsx("div",{style:{color:"var(--muted)",paddingTop:"6px"},children:i.jsx(wv,{size:14})}),i.jsxs("div",{style:{flex:1,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",alignItems:"start"},children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Field label"}),i.jsx("input",{style:Ht,placeholder:`Field ${o+1}`,value:e.label,onChange:s=>r({label:s.target.value}),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Field type"}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Tr,value:e.type,onChange:s=>{var u;const l=s.target.value,c={type:l};$f.has(l)?c.options=(u=e.options)!=null&&u.length?e.options:zT():c.options=[],r(c)},onFocus:St,onBlur:jt,children:t.map(s=>i.jsx("option",{children:s},s))})})]}),a&&i.jsx(dt,{span2:!0,children:i.jsx(GU,{options:e.options??[],onChange:s=>r({options:s})})}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Map to participant"}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Tr,value:e.mapsTo??"",onChange:s=>r({mapsTo:s.target.value}),onFocus:St,onBlur:jt,children:ese.map(s=>i.jsx("option",{value:s.value,children:s.label},s.value||"—"))})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Required"}),i.jsx(Hi,{name:`req-${e.id}`,value:e.required,onChange:s=>r({required:s}),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),e.mapsTo==="custom"&&i.jsxs(dt,{span2:!0,children:[i.jsx(ht,{text:"Custom field key",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. dietaryPreference",value:e.customMapsKey??"",onChange:s=>r({customMapsKey:s.target.value}),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Stored under Participant.customFields[key]."})]})]}),i.jsx("button",{onClick:n,type:"button",title:"Remove field",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer",flexShrink:0},children:i.jsx(Xr,{size:13})})]})})}const d2=e=>{const t=e[0];return{id:Math.random().toString(36).slice(2),label:"",type:t,required:"No",options:$f.has(t)?zT():[],mapsTo:"",customMapsKey:"",fixed:!1}},ise=(e,t)=>({name:"",description:"",questions:[d2(e)],showThankYou:"Yes",thankYouMsg:"Thank you for your feedback!",collectEmail:"No",anonymous:t?"Yes":"No",publish:"Draft",paymentEnabled:"No",amount:"",confirmationEmail:"Yes",onSubmitTags:"",onSubmitListId:""});function KU(e,t,r){if(e==="stars"||e==="select"&&(t==null?void 0:t.length)===5&&t.every((n,o)=>n===String(o+1)))return"Star Rating";if(e==="select"&&(t==null?void 0:t.length)===11)return"NPS (0–10)";if(e==="radio")return"Radio";if(e==="checkboxes")return"Checkboxes";if(e==="select"){const n=(r==null?void 0:r.indexOf("Multiple Choice"))??-1,o=(r==null?void 0:r.indexOf("Dropdown"))??-1;return o>=0&&(n<0||o<n)?"Dropdown":(n>=0,"Multiple Choice")}return e==="checkbox"?r!=null&&r.includes("Yes / No")?"Yes / No":"Checkboxes":e==="textarea"?r!=null&&r.includes("Long Text")?"Long Text":"Text":e==="text"?r!=null&&r.includes("Short Text")?"Short Text":"Text":e==="email"?"Email":e==="phone"?"Phone":e==="file"?"File Upload":(r==null?void 0:r[0])??"Short Text"}function QU(e){return Array.isArray(e.options)?e.options.map(t=>String(t)):[]}function XU(e,t){var s;const r=((s=e.label)==null?void 0:s.trim())||"Untitled",n=e.required==="Yes",o=YU(e);if(t){if(e.type==="Star Rating")return{label:r,type:"stars",required:n,options:["1","2","3","4","5"]};if(e.type==="NPS (0–10)")return{label:r,type:"select",required:n,options:Array.from({length:11},(c,u)=>String(u))};if(e.type==="Multiple Choice")return{label:r,type:"select",required:n,options:o};if(e.type==="Radio")return{label:r,type:"radio",required:n,options:o};if(e.type==="Checkboxes")return{label:r,type:"checkboxes",required:n,options:o};if(e.type==="Short Text")return{label:r,type:"text",required:n};if(e.type==="Long Text")return{label:r,type:"textarea",required:n};if(e.type==="Yes / No")return{label:r,type:"checkbox",required:n};const l=GN[e.type];return l?l==="select"||l==="radio"||l==="checkboxes"?{label:r,type:l,required:n,options:o}:{label:r,type:l,required:n}:{label:r,type:"text",required:n}}const a=GN[e.type]??"text";return a==="select"||a==="radio"||a==="checkboxes"?{label:r,type:a,required:n,options:o}:{label:r,type:a,required:n}}function ZU(e){return e==="firstName"||e==="lastName"||e==="email"}function ose(e){var n;const t=XU(e,!1),r=e.fixed===!0||ZU(e.mapsTo)?!0:t.required;return{...t,required:r,mapsTo:e.mapsTo||void 0,customMapsKey:e.mapsTo==="custom"&&((n=e.customMapsKey)!=null&&n.trim())?e.customMapsKey.trim():void 0,isFixed:e.fixed===!0}}function ase(e){return e.isFixed===!0||ZU(e.mapsTo)||e.required?"Yes":"No"}function sse(e,t){return e!=null&&e.length?e.map((r,n)=>{const o=KU(r.type??"text",r.options,t);return{id:Math.random().toString(36).slice(2)+String(n),label:r.label??"",type:o,required:r.required?"Yes":"No",options:$f.has(o)?QU(r):[],mapsTo:r.mapsTo,customMapsKey:r.customMapsKey,fixed:r.isFixed}}):[d2(t)]}function lse(e,t,r){const n=KU(e.type??"text",e.options,r);return{id:`imp-${t}-${Math.random().toString(36).slice(2)}`,label:e.label??"",type:n,required:ase(e),options:$f.has(n)?QU(e):[],mapsTo:e.mapsTo,customMapsKey:e.customMapsKey,fixed:e.isFixed===!0}}function cse(e,t){const r=M3();if(!(e!=null&&e.length))return r;const n=e.map((o,a)=>lse(o,a,t));return n.some(o=>o.mapsTo==="firstName")?n:[...r,...n]}function tx({eventId:e,formId:t,mode:r,defaultFormName:n,onClose:o,onSuccess:a}){const{user:s}=Mr(),l=Nn(s),c=r==="feedback",u=r==="registration",d=r==="other",f=u?5:3,h=u?VU:d?Jae:HU,p=c||d,v=wc(f),[m,b]=S.useState(()=>{const U=ise(h,p);return u?{...U,questions:M3()}:U}),[x,w]=S.useState([]),[k,j]=S.useState({}),[_,T]=S.useState(!1),[A,P]=S.useState(!!t),[N,O]=S.useState([]),[C,I]=S.useState("");S.useEffect(()=>{if(!l){O([]);return}let U=!1;return Lr.list({organization:l,recordKind:"event",limit:500}).then(Q=>{var re;if(U)return;const K=((re=Q.data)==null?void 0:re.events)??[];O(K.map(H=>{var ie;return{_id:H._id,name:(ie=H.name)!=null&&ie.trim()?H.name:"Untitled"}}))}).catch(()=>{U||O([])}),()=>{U=!0}},[l]),S.useEffect(()=>{!t&&e&&I(e)},[t,e]),S.useEffect(()=>{t||!(n!=null&&n.trim())||b(U=>U.name.trim()?U:{...U,name:n.trim()})},[t,n]),S.useEffect(()=>{if(u){if(!l){w([]);return}qa.list({organization:l}).then(U=>{var Q;(Q=U.data)!=null&&Q.lists&&w(U.data.lists.filter(K=>K.type==="fixed"))}).catch(()=>w([]))}},[u,l]),S.useEffect(()=>{if(!t)return;let U=!1;return(async()=>{var Q;try{const K=await Mo.get(t);if(U)return;const re=K.type==="registration"?cse(K.fields,h):sse(K.fields,h),H=K.settings??{},ie=Array.isArray(H.onSubmitAddTags)?H.onSubmitAddTags.join(", "):"";b({name:K.name??"",description:K.description??"",questions:re.length?re:K.type==="registration"?M3():[d2(h)],showThankYou:H.showThankYou===!1?"No":"Yes",thankYouMsg:(Q=H.thankYouMessage)!=null&&Q.trim()?H.thankYouMessage:"Thank you for your feedback!",collectEmail:H.collectEmail?"Yes":"No",anonymous:H.allowAnonymous||p?"Yes":"No",publish:H.isActive!==!1?"Published":"Draft",paymentEnabled:H.paymentEnabled?"Yes":"No",amount:H.paymentAmount!=null&&H.paymentAmount!==""?String(H.paymentAmount):"",confirmationEmail:H.sendConfirmationEmail===!1?"No":"Yes",onSubmitTags:ie,onSubmitListId:H.onSubmitParticipantListId??""}),I(Zae(K.event))}catch{U||P(!1)}finally{U||P(!1)}})(),()=>{U=!0}},[t,h.join(","),p]);const R=(U,Q)=>b(K=>({...K,[U]:Q})),F=()=>b(U=>({...U,questions:[...U.questions,d2(h)]})),M=U=>b(Q=>({...Q,questions:Q.questions.filter(K=>!K.fixed&&K.id!==U)})),Y=(U,Q)=>b(K=>({...K,questions:K.questions.map(re=>re.id===U?{...re,...Q}:re)})),X=S.useCallback((U,Q)=>{if(Q===1)return U.name.trim().length>0&&C.trim().length>0;if(Q===2){if(u){const H=U.questions.filter(le=>le.fixed).every(le=>le.label.trim().length>0),de=U.questions.filter(le=>!le.fixed).every(le=>{var ke;return!(!le.label.trim()||le.mapsTo==="custom"&&!((ke=le.customMapsKey)!=null&&ke.trim())||!KN(le))});return H&&de}const K=U.questions.some(H=>H.label.trim().length>0),re=U.questions.every(H=>!H.label.trim()||KN(H));return K&&re}return!0},[u,C]),$=S.useCallback(U=>{const Q=X(m,U);j(K=>({...K,[U]:Q?"":"Please complete required fields before continuing."})),Q&&v.advance(U)},[m,X,v]),ee=S.useCallback(()=>{const U=u?"registration":d?"other":"feedback",Q=u?m.questions.filter(H=>H.label.trim()).map(H=>ose(H)):m.questions.filter(H=>H.label.trim()).map(H=>XU(H,p)),K=m.publish==="Published",re=m.onSubmitTags.split(/[,;\n]+/).map(H=>H.trim()).filter(Boolean);return{name:m.name.trim(),description:m.description.trim(),type:U,fields:Q,settings:{isActive:K,thankYouMessage:m.thankYouMsg.trim(),showThankYou:m.showThankYou==="Yes",collectEmail:m.collectEmail==="Yes",allowAnonymous:m.anonymous==="Yes",paymentEnabled:m.paymentEnabled==="Yes",paymentAmount:m.paymentEnabled==="Yes"&&m.amount.trim()?m.amount.trim():"",sendConfirmationEmail:m.confirmationEmail==="Yes",...u?{onSubmitAddTags:re,onSubmitParticipantListId:m.onSubmitListId.trim()||null}:{}}}},[m,u,d,p]),V=S.useCallback(async()=>{if(!m.name.trim()||!C.trim()){C.trim()||j(U=>({...U,1:"Select an event for this form."}));return}T(!0),j({});try{const U=ee();t?await Mo.update(t,{...U,event:C}):await Mo.create({...U,event:C}),a(),o()}catch{j(U=>({...U,1:"Failed to save. Please try again."}))}finally{T(!1)}},[m.name,t,C,ee,a,o]),D=S.useCallback(()=>{const U=u?5:3;if(!X(m,U)){j(Q=>({...Q,[U]:"Please complete required fields."}));return}j(Q=>({...Q,[U]:""})),V()},[m,u,X,V]),z=c?"Forms & Workflow · Feedback":u?"Forms & Workflow · Registration":"Forms & Workflow · Other Forms",q=t?c?"Edit Feedback Form":u?"Edit Registration Form":"Edit Form":c?"Create Feedback Form":u?"Create Registration Form":"Create Other Form",G=c?"Design a feedback form to collect responses from your attendees.":u?"Build a registration form; each submission creates or updates a participant.":"Build custom forms (other / general-purpose) for your event.";return A?i.jsx(ra,{onClose:o,title:q,breadcrumb:z,description:G,completedCount:0,totalSections:f,ctaLabel:"Save",ctaDisabled:!0,children:i.jsx("div",{style:{padding:"20px",color:"var(--muted)"},children:"Loading form…"})}):i.jsxs(ra,{onClose:o,title:q,breadcrumb:z,description:G,completedCount:v.done.size,totalSections:f,ctaLabel:"Save",ctaDisabled:!m.name.trim()||!C.trim()||_||!t&&N.length===0,onCtaClick:V,children:[i.jsxs(Ur,{n:1,title:"Form Details",subtitle:"Name and describe your form",open:v.open===1,completed:v.done.has(1),onToggle:()=>v.toggle(1),onSave:()=>$(1),nextLabel:p?"Questions":"Fields",sectionError:k[1],children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Form Name",required:!0}),i.jsx("input",{style:Ht,placeholder:p?"e.g. Post-Event Feedback 2026":"e.g. Conference Registration 2026",value:m.name,onChange:U=>R("name",U.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Event",required:!0}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Tr,value:C,onChange:U=>I(U.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select an event…"}),C&&!N.some(U=>U._id===C)?i.jsx("option",{value:C,children:"Current linked event"}):null,N.map(U=>i.jsx("option",{value:U._id,children:U.name},U._id))]})}),l&&N.length===0?i.jsx(Vt,{text:"No events in this organization. Create an event under Portfolio (All Events) first."}):null]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"Briefly describe this form…",value:m.description,onChange:U=>R("description",U.target.value),onFocus:St,onBlur:jt})]}),p&&i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Anonymous Responses",required:!0}),i.jsx(Hi,{name:"anon",value:m.anonymous,onChange:U=>R("anonymous",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Vt,{text:"Anonymous forms don't record the respondent's identity."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Collect Email"}),i.jsx(Hi,{name:"collectEmail",value:m.collectEmail,onChange:U=>R("collectEmail",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Ur,{n:2,title:p?"Questions":"Form Fields",subtitle:u?"Core fields (first name, last name, email) plus optional mapped fields":p?"Add and order your feedback questions":"Add and arrange fields",open:v.open===2,completed:v.done.has(2),onToggle:()=>v.toggle(2),onSave:()=>$(2),nextLabel:u?"Participant actions":"Settings",sectionError:k[2],children:[i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:u?i.jsxs(i.Fragment,{children:[m.questions.filter(U=>U.fixed).map((U,Q)=>i.jsx(rse,{q:U,idx:Q,onPatch:K=>Y(U.id,K)},U.id)),m.questions.filter(U=>!U.fixed).map((U,Q)=>i.jsx(nse,{q:U,types:h,idx:Q,onPatch:K=>Y(U.id,K),onRemove:()=>M(U.id)},U.id))]}):m.questions.map((U,Q)=>i.jsx(tse,{q:U,types:h,idx:Q,onPatch:K=>Y(U.id,K),onRemove:()=>M(U.id),canRemove:m.questions.length>1},U.id))}),u?i.jsxs("button",{type:"button",onClick:F,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add field"]}):i.jsxs("button",{type:"button",onClick:F,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add ",p?"Question":"Field"]}),i.jsx(Vt,{text:u?"Submissions must include the email field. Map extra fields to participant columns or customFields.":"Drag the grip icon to reorder questions."})]}),u&&i.jsxs(Ur,{n:3,title:"Participant actions",subtitle:"Tags and lists applied when someone submits",open:v.open===3,completed:v.done.has(3),onToggle:()=>v.toggle(3),onSave:()=>$(3),nextLabel:"Payment",sectionError:k[3],children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Add tags on submit"}),i.jsx("input",{style:Ht,placeholder:"e.g. VIP, Registered — comma separated",value:m.onSubmitTags,onChange:U=>R("onSubmitTags",U.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Merged onto the participant record (deduplicated)."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Add to fixed participant list"}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Tr,value:m.onSubmitListId,onChange:U=>R("onSubmitListId",U.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"— None —"}),x.map(U=>i.jsx("option",{value:U._id,children:U.name},U._id))]})}),i.jsx(Vt,{text:"Only fixed (manual) lists in your organization are shown."})]})]}),u&&i.jsx(Ur,{n:4,title:"Payment",subtitle:"Configure payment settings for paid registrations",open:v.open===4,completed:v.done.has(4),onToggle:()=>v.toggle(4),onSave:()=>$(4),nextLabel:"Publish Settings",sectionError:k[4],children:i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Enable Payment",required:!0}),i.jsx(Hi,{name:"regPayment",value:m.paymentEnabled,onChange:U=>R("paymentEnabled",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),m.paymentEnabled==="Yes"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Registration Fee (₹)",required:!0}),i.jsx("input",{type:"number",style:Ht,placeholder:"0.00",value:m.amount,onChange:U=>R("amount",U.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Confirmation Email",required:!0}),i.jsx(Hi,{name:"confEmail",value:m.confirmationEmail,onChange:U=>R("confirmationEmail",U),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Vt,{text:"Send a confirmation email after registration."})]})]})}),i.jsx(Ur,{n:u?5:3,title:"Publish Settings",subtitle:"Set the form status and thank-you message",open:v.open===(u?5:3),completed:v.done.has(u?5:3),onToggle:()=>v.toggle(u?5:3),onSave:D,nextLabel:"Save",sectionError:k[u?5:3],children:i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Status",required:!0}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:Tr,value:m.publish,onChange:U=>R("publish",U.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{children:"Draft"}),i.jsx("option",{children:"Published"})]})})]}),i.jsxs(dt,{span2:!0,children:[i.jsx(ht,{text:"Thank You Message"}),i.jsx("input",{style:Ht,placeholder:"Thank you for your response!",value:m.thankYouMsg,onChange:U=>R("thankYouMsg",U.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Shown to respondents after they submit the form."})]})]})})]})}function use(e){return!e||typeof e!="object"?{}:e}function dse(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return"—"}}function fse(e){var t;return!e||typeof e=="string"?"—":((t=e.email)==null?void 0:t.trim())||"—"}const QN=20,XN=4;function D3({formId:e,formName:t,onClose:r}){const[n,o]=S.useState(null),[a,s]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState(1),[k,j]=S.useState([]),[_,T]=S.useState(0),[A,P]=S.useState(!0),[N,O]=S.useState(null),[C,I]=S.useState(!1),R=((n==null?void 0:n.fields)||[]).map(D=>{var z;return(z=D.label)==null?void 0:z.trim()}).filter(Boolean),F=R.slice(0,XN),M=Math.max(0,R.length-F.length),Y=S.useCallback(async()=>{try{const D=await Mo.get(e);o(D)}catch{o(null)}},[e]),X=S.useCallback(async()=>{P(!0),O(null);try{const D=await Mo.listSubmissions(e,{q:l||void 0,dateFrom:p||void 0,dateTo:m||void 0,page:x,limit:QN});j(D.submissions),T(D.total)}catch(D){O(D instanceof Error?D.message:"Failed to load submissions."),j([]),T(0)}finally{P(!1)}},[e,l,p,m,x]);S.useEffect(()=>{Y()},[Y]),S.useEffect(()=>{X()},[X]);const $=()=>{c(a.trim()),v(u),b(f),w(1)},ee=async()=>{I(!0);try{const D=await Mo.exportSubmissionsCsv(e,{q:l||void 0,dateFrom:p||void 0,dateTo:m||void 0}),z=URL.createObjectURL(D),q=document.createElement("a");q.href=z,q.download=`form-${e}-submissions.csv`,q.click(),URL.revokeObjectURL(z)}catch(D){O(D instanceof Error?D.message:"Export failed.")}finally{I(!1)}},V=Math.max(1,Math.ceil(_/QN));return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:r,role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"form-submissions-title",style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.2)",animation:"formSubmissionsSlideIn 0.2s ease"},children:[i.jsx("style",{children:"@keyframes formSubmissionsSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,padding:"16px 18px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 4px"},children:"Submissions"}),i.jsx("h2",{id:"form-submissions-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3,wordBreak:"break-word"},children:t})]}),i.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{flexShrink:0,width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(Gt,{size:18})})]}),i.jsxs("div",{style:{padding:"12px 18px",borderBottom:"1px solid var(--border)",display:"flex",flexDirection:"column",gap:10,flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"flex-end"},children:[i.jsxs("div",{style:{flex:"1 1 160px",minWidth:0},children:[i.jsx("label",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",display:"block",marginBottom:4},children:"Search (* wildcards)"}),i.jsx("input",{value:a,onChange:D=>s(D.target.value),onKeyDown:D=>D.key==="Enter"&&$(),placeholder:"e.g. john*@*",style:{width:"100%",padding:"8px 10px",fontSize:"var(--text-sm)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",boxSizing:"border-box"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",display:"block",marginBottom:4},children:"From"}),i.jsx("input",{type:"date",value:u,onChange:D=>d(D.target.value),style:{padding:"8px 10px",fontSize:"var(--text-sm)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",display:"block",marginBottom:4},children:"To"}),i.jsx("input",{type:"date",value:f,onChange:D=>h(D.target.value),style:{padding:"8px 10px",fontSize:"var(--text-sm)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)"}})]}),i.jsx("button",{type:"button",onClick:$,style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:600,cursor:"pointer"},children:"Apply"}),i.jsxs("button",{type:"button",onClick:()=>void ee(),disabled:C||_===0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:600,cursor:C||_===0?"not-allowed":"pointer",opacity:C||_===0?.6:1},children:[i.jsx(ja,{size:14}),C?"Exporting…":"Export CSV"]})]}),i.jsxs("p",{style:{margin:0,fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:["Showing ",_.toLocaleString()," match",_===1?"":"es",". List view is paged; export includes all matches and"," ",i.jsx("strong",{style:{color:"var(--foreground)"},children:"all form fields"})," as columns.",M>0?` The table only shows the first ${XN} response fields (${M} more in the file only).`:null]})]}),i.jsxs("div",{style:{flex:1,overflow:"auto",padding:"0 0 16px"},children:[N?i.jsx("p",{style:{padding:"16px 18px",margin:0,color:"var(--destructive)",fontSize:"var(--text-sm)"},children:N}):null,A?i.jsx("p",{style:{padding:"24px 18px",margin:0,color:"var(--muted)"},children:"Loading…"}):k.length===0?i.jsx("p",{style:{padding:"24px 18px",margin:0,color:"var(--muted)"},children:"No submissions for this filter."}):i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:[i.jsx("th",{style:{textAlign:"left",padding:"10px 12px",whiteSpace:"nowrap"},children:"Submitted"}),i.jsx("th",{style:{textAlign:"left",padding:"10px 12px",whiteSpace:"nowrap"},children:"Email"}),F.map(D=>i.jsx("th",{style:{textAlign:"left",padding:"10px 12px",maxWidth:180},children:D},D)),M>0?i.jsxs("th",{style:{textAlign:"left",padding:"10px 12px",color:"var(--muted)",fontWeight:600,whiteSpace:"nowrap"},children:["+",M," more…"]},"__more__"):null]})}),i.jsx("tbody",{children:k.map(D=>{const z=use(D.data);return i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",verticalAlign:"top"},children:[i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap",color:"var(--foreground)"},children:dse(D.submittedAt)}),i.jsx("td",{style:{padding:"10px 12px",wordBreak:"break-all"},children:fse(D.participant)}),F.map(q=>i.jsx("td",{style:{padding:"10px 12px",wordBreak:"break-word",maxWidth:220},children:pse(z[q])},q)),M>0?i.jsx("td",{style:{padding:"10px 12px",color:"var(--muted)",fontSize:"10px",fontStyle:"italic"},children:"Export for full data"},"__more__"):null]},D._id)})})]})})]}),i.jsxs("div",{style:{padding:"12px 18px",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexShrink:0},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:["Page ",x," of ",V]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{type:"button",disabled:x<=1||A,onClick:()=>w(D=>Math.max(1,D-1)),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:x<=1||A?"not-allowed":"pointer",opacity:x<=1||A?.5:1},children:[i.jsx(vd,{size:16})," Prev"]}),i.jsxs("button",{type:"button",disabled:x>=V||A,onClick:()=>w(D=>D+1),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:x>=V||A?"not-allowed":"pointer",opacity:x>=V||A?.5:1},children:["Next ",i.jsx(ka,{size:16})]})]})]})]})]})}function pse(e){if(e==null)return"—";if(typeof e=="boolean")return e?"Yes":"No";if(Array.isArray(e))return e.join(", ");const t=String(e);return t.length>500?`${t.slice(0,500)}…`:t}const hse={fullWidthCenter:!0,shrinkToFit:!0,textAlign:"center",x:0,w:100};function Pb(e){return e.fullWidthCenter!==!1}function G0(e){return e.shrinkToFit!==!1}function gse(e){return Pb(e)?e.textAlign??"center":e.textAlign??"left"}function JU(e){return e.field==="qr"||e.field==="photo"||e.kind==="custom_image"}function mse(e){return e.field==="qr"}function f2(e){return e.w??(e.field==="qr"?28:e.kind==="custom_image"?25:18)}function vse(e,t){return Math.min(WT,Math.max(BT,t))}function yse(e){return Math.min(WT,Math.max(BT,e))}function Rm(e,t,r){const n=t>0?t:1;return yse(e*r/n)}function xse(e){return new Promise(t=>{const r=new Image;r.onload=()=>t(r.naturalWidth>0&&r.naturalHeight>0?r.naturalWidth/r.naturalHeight:1),r.onerror=()=>t(1),r.src=e})}function eH(e){const t=URL.createObjectURL(e);return xse(t).finally(()=>URL.revokeObjectURL(t))}function MT(e,t,r){const n=vse(e,t),o={w:n};if(mse(e)||e.field==="photo")o.h=n;else if(e.kind==="custom_image"){const s=e.imageAspectRatio??1;o.h=Rm(n,s,r)}const a={...e,...o};return{...o,...DT(a,a.x,a.y)}}function bse(e){if(e.field==="qr"){const t=f2(e);return{w:t,h:t}}if(e.kind==="custom_image")return{w:e.w??25,h:e.h??25};if(e.field==="photo"){const t=f2(e);return{w:t,h:t}}return pS(e)?Pb(e)?{w:0,h:Math.max(4,(e.fontSizePct??5)*2)}:{w:e.w??72,h:Math.max(4,(e.fontSizePct??5)*2.5)}:{w:0,h:0}}function DT(e,t,r){const n=bse(e),o=n.w>0?Math.max(0,100-n.w):100,a=n.h>0?Math.max(0,100-n.h):100;let s=Math.min(o,Math.max(0,t));const l=Math.min(a,Math.max(0,r));return pS(e)&&Pb(e)&&(s=0),{x:s,y:l}}const B3=[{id:"Inter",label:"Inter",css:"var(--font-inter), Inter, sans-serif"},{id:"Noto Sans",label:"Noto Sans",css:"var(--font-noto-sans), 'Noto Sans', sans-serif"},{id:"Arial",label:"Arial",css:"Arial, sans-serif"},{id:"Georgia",label:"Georgia",css:"Georgia, serif"},{id:"Times New Roman",label:"Times New Roman",css:"'Times New Roman', Times, serif"}],wse="#0f172a",xy=5,Q5=5,BT=8,WT=65,ZN={a6:{w:105,h:148},a7:{w:74,h:105},"4x3in":{w:101.6,h:76.2},"4x6in":{w:101.6,h:152.4}};function Sse(e,t,r,n){let o,a;if(e==="custom")o=parseFloat(r||"105")||105,a=parseFloat(n||"148")||148;else{const s=ZN[e]||ZN.a6;o=s.w,a=s.h}return t==="landscape"&&([o,a]=[a,o]),o/a}function jse(e){const t=(e||"#000000").replace("#",""),r=parseInt(t.slice(0,2),16)||0,n=parseInt(t.slice(2,4),16)||0,o=parseInt(t.slice(4,6),16)||0;return(.299*r+.587*n+.114*o)/255>.55?"#0f172a":"#ffffff"}function tH(e,t){return{color:t==="color"?jse(e):wse,fontFamily:"Inter",fontWeight:"normal",...hse}}function rH(e,t,r){const n={kind:"field",field:e,id:e,...tH(t,r)};switch(e){case"name":return{...n,y:8,fontSizePct:7,fontWeight:"bold"};case"title":return{...n,y:22,fontSizePct:4.5};case"org":return{...n,y:32,fontSizePct:4};case"badge_type":return{...n,y:44,fontSizePct:3.5};case"photo":return{kind:"field",field:e,id:e,x:74,y:6,w:18,h:18};case"qr":return{kind:"field",field:e,id:e,x:36,y:68,w:28,h:28};default:return{...n,y:8,fontSizePct:5}}}function nH(e,t,r){return e.filter(n=>["name","title","org","badge_type","qr","photo"].includes(n)).map(n=>rH(n,t,r))}function kse(e,t,r,n,o){return{id:e,kind:"custom_text",text:t,y:55+o*8,fontSizePct:4,fontWeight:"normal",...tH(r,n)}}function _se(){return`custom_${Math.random().toString(16).slice(2,10)}`}function Cse(){return`cimg_${Math.random().toString(16).slice(2,10)}`}function iH(e,t,r,n,o){const s=Rm(25,o,n);return{id:e,kind:"custom_image",imageUrl:t,imageAspectRatio:o,x:10+r*4,y:50+r*6,w:25,h:s}}function oH(e,t){var r;return(e.imageUrl??((r=t.find(n=>n.id===e.id))==null?void 0:r.imageUrl)??"").trim()}function Ese(e){const t=B3.find(r=>r.id===e);return(t==null?void 0:t.css)??B3[0].css}function Ase(e){return{name:"Jane Doe",title:"Keynote Speaker",org:"Acme Inc.",badgeType:e.trim()||"Attendee"}}const JN=["#2563eb","#16a34a","#d97706","#7c3aed","#0891b2","#be185d","#0d9488","#b45309"];function Tse(e){var r;const t=e.split(/\s+/).filter(Boolean);return t.length>=2?`${t[0].charAt(0)}${t[t.length-1].charAt(0)}`.toUpperCase():(((r=t[0])==null?void 0:r.charAt(0))||"J").toUpperCase()}function Pse(e){let t=0;for(let r=0;r<e.length;r++)t+=e.charCodeAt(r);return JN[t%JN.length]}function Ise(e,t){var r;if(e.kind==="custom_text")return((r=e.text)==null?void 0:r.trim())||"Your text";switch(e.field){case"name":return t.name;case"title":return t.title;case"org":return t.org;case"badge_type":return t.badgeType;default:return""}}function pS(e){return e.kind==="custom_text"?!0:e.field==="name"||e.field==="title"||e.field==="org"||e.field==="badge_type"}function eR(e,t,r,n,o,a,s){const l=new Set(t),c=new Map(r.map(_=>[_.id,_.text])),u=new Map(n.map(_=>[_.id,_.imageUrl])),d=e.filter(_=>_.kind==="field"&&_.field&&l.has(_.field)),f=e.filter(_=>_.kind==="custom_text"&&c.has(_.id)),h=e.filter(_=>_.kind==="custom_image"&&u.has(_.id)),p=new Set(d.map(_=>_.field)),v=t.filter(_=>["name","title","org","badge_type","qr","photo"].includes(_)).filter(_=>!p.has(_)).map(_=>rH(_,o,a)),m=new Set(f.map(_=>_.id)),b=r.filter(_=>!m.has(_.id)).map((_,T)=>kse(_.id,_.text,o,a,T)),x=new Set(h.map(_=>_.id)),w=n.filter(_=>!x.has(_.id)).map((_,T)=>iH(_.id,_.imageUrl,T,s,1)),k=[...f.map(_=>({..._,text:c.get(_.id)??_.text})),...b],j=[...h.map(_=>{const T=u.get(_.id)??_.imageUrl,A=_.imageAspectRatio??1,P=_.w??25;return{..._,imageUrl:T,h:Rm(P,A,s)}}),...w];return[...d,...v,...k,...j]}function Ose({aspectRatio:e,backgroundMode:t,backgroundColor:r,backgroundImageUrl:n,layoutElements:o,customImages:a,badgeTypeLabel:s,badgeAspectRatio:l,selectedId:c,onSelect:u,onLayoutChange:d}){const f=S.useRef(null),h=S.useRef(o),p=S.useRef(d),v=S.useRef(null),m=S.useRef(null),b=S.useRef(""),[,x]=$e.useState(0);h.current=o,p.current=d;const w=Ase(s);S.useEffect(()=>{_v.toDataURL("eventbuzz:preview:sample",{width:120,margin:1}).then(A=>{b.current=A,x(P=>P+1)}).catch(()=>{b.current=""})},[]);const k=S.useCallback((A,P)=>{const N=h.current.map(O=>O.id===A?{...O,...P}:O);h.current=N,p.current(N)},[]);S.useEffect(()=>{const A=N=>{var R;const O=(R=f.current)==null?void 0:R.getBoundingClientRect();if(!(O!=null&&O.width)||!O.height)return;const C=v.current;if(C){const F=h.current.find($=>$.id===C.id);if(!F)return;N.preventDefault();const M=(N.clientX-C.startX)/O.width*100,Y=(N.clientY-C.startY)/O.height*100,X=DT(F,C.origX+M,C.origY+Y);k(C.id,X);return}const I=m.current;if(I){const F=h.current.find($=>$.id===I.id);if(!F)return;N.preventDefault();const M=(N.clientX-I.startX)/O.width*100,Y=(N.clientY-I.startY)/O.height*100,X=(M+Y)/2;k(I.id,MT(F,I.origW+X,l))}},P=()=>{v.current=null,m.current=null};return window.addEventListener("pointermove",A,{passive:!1}),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P),()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P)}},[k]);const j=(A,P)=>{m.current||(A.preventDefault(),A.stopPropagation(),u(P.id),v.current={id:P.id,startX:A.clientX,startY:A.clientY,origX:P.x,origY:P.y})},_=(A,P)=>{A.preventDefault(),A.stopPropagation(),u(P.id),v.current=null,m.current={id:P.id,startX:A.clientX,startY:A.clientY,origW:f2(P)}},T=t==="image"&&n.trim()?{backgroundImage:`url(${n})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:r};return i.jsxs("div",{style:{padding:"8px 12px 16px 20px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 10px"},children:"Live preview — drag to move; drag corner handle to resize"}),i.jsx("div",{ref:f,role:"presentation",onClick:()=>u(null),style:{width:"100%",maxWidth:420,aspectRatio:String(e),position:"relative",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",boxShadow:"0 4px 20px rgba(0,0,0,0.12)",overflow:"hidden",containerType:"size",touchAction:"none",...T,cursor:"default",userSelect:"none"},children:o.map(A=>i.jsx(Nse,{el:A,sample:w,customImages:a,selected:c===A.id,qrUrl:b.current,onDragStart:j,onResizeStart:_},A.id))})]})}function Nse({el:e,sample:t,customImages:r,selected:n,qrUrl:o,onDragStart:a,onResizeStart:s}){const l=n?"2px solid var(--primary)":"1px dashed transparent",c=JU(e),u=f2(e),d=(f,h)=>i.jsxs("div",{onPointerDown:p=>a(p,e),onClick:p=>p.stopPropagation(),style:{position:"absolute",left:`${e.x}%`,top:`${e.y}%`,width:`${u}%`,aspectRatio:"1",border:l,borderRadius:e.field==="photo"?"50%":4,cursor:"grab",boxSizing:"border-box",touchAction:"none",...h},children:[f,n&&c&&i.jsx("div",{role:"presentation",onPointerDown:p=>s(p,e),style:{position:"absolute",right:-5,bottom:-5,width:14,height:14,borderRadius:3,background:"var(--primary)",border:"2px solid var(--card)",cursor:"nwse-resize",touchAction:"none",zIndex:2}})]});if(e.kind==="custom_image"){const f=oH(e,r),h=e.w??25,p=e.h??25;return i.jsxs("div",{onPointerDown:v=>a(v,e),onClick:v=>v.stopPropagation(),style:{position:"absolute",left:`${e.x}%`,top:`${e.y}%`,width:`${h}%`,height:`${p}%`,border:l,borderRadius:4,cursor:"grab",boxSizing:"border-box",touchAction:"none",overflow:"hidden",background:"#fff"},children:[f?i.jsx("img",{src:f,alt:"",draggable:!1,style:{width:"100%",height:"100%",objectFit:"contain",pointerEvents:"none"}}):i.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(jx,{size:18,style:{color:"var(--muted)"}})}),n&&c&&i.jsx("div",{role:"presentation",onPointerDown:v=>s(v,e),style:{position:"absolute",right:-5,bottom:-5,width:14,height:14,borderRadius:3,background:"var(--primary)",border:"2px solid var(--card)",cursor:"nwse-resize",touchAction:"none",zIndex:2}})]})}if(e.field==="photo"){const f=Tse(t.name),h=Pse(t.name);return d(i.jsx("div",{style:{width:"100%",height:"100%",borderRadius:"50%",background:h,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontFamily:"var(--font-inter)",fontWeight:600,fontSize:"clamp(10px, 42%, 22px)",pointerEvents:"none"},children:f}))}return e.field==="qr"?d(i.jsx("div",{style:{width:"100%",height:"100%",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",borderRadius:4},children:o?i.jsx("img",{src:o,alt:"",draggable:!1,style:{width:"100%",height:"100%",objectFit:"contain",pointerEvents:"none"}}):i.jsx("span",{style:{fontSize:8,color:"var(--muted)"},children:"QR"})}),{borderRadius:4,overflow:"hidden"}):pS(e)?i.jsx(Rse,{el:e,sample:t,selected:n,border:l,onDragStart:a}):null}function Rse({el:e,sample:t,selected:r,border:n,onDragStart:o}){const a=S.useRef(null),[s,l]=$e.useState(e.fontSizePct??5),c=Ise(e,t),u=Pb(e),d=gse(e),f=e.fontSizePct??5,h=u?100:e.w??72;return S.useEffect(()=>{l(f)},[f,c,u,h,d,e.shrinkToFit]),S.useEffect(()=>{const p=a.current,v=p==null?void 0:p.parentElement;if(!p||!v)return;if(!G0(e)){l(f);return}let m=f;const b=w=>{p.style.fontSize=`calc(${w} * 1cqh)`};b(m);const x=()=>p.scrollWidth<=v.clientWidth+1;if(x()){l(m);return}for(let w=0;w<32&&m>1.5&&(m-=.25,b(m),!x());w+=1);l(m)},[e,c,f,h,u,d]),i.jsx("div",{onPointerDown:p=>o(p,e),onClick:p=>p.stopPropagation(),style:{position:"absolute",left:u?0:`${e.x}%`,top:`${e.y}%`,width:`${h}%`,border:n,borderRadius:2,padding:"2px 4px",cursor:"grab",boxSizing:"border-box",textAlign:d,touchAction:"none"},children:i.jsx("div",{ref:a,style:{fontFamily:Ese(e.fontFamily),fontSize:`calc(${s} * 1cqh)`,fontWeight:e.fontWeight==="bold"?700:400,color:e.color??"#0f172a",lineHeight:1.15,whiteSpace:G0(e)?"nowrap":"normal",wordBreak:G0(e)?"normal":"break-word",overflow:G0(e)?"hidden":"visible",display:"block",width:"100%",pointerEvents:"none"},children:e.field==="badge_type"?i.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:4,background:"rgba(15,23,42,0.12)"},children:c}):c})})}function Lse(e,t,r,n){return Sse(e,t,r,n)}const Fse=[3,3.5,4,4.5,5,6,7,8,9,10],aH={position:"absolute",left:"calc(100% + 12px)",top:36,width:240,zIndex:10,padding:14,borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",boxShadow:"0 8px 28px rgba(0,0,0,0.15)",display:"flex",flexDirection:"column",gap:10,maxHeight:"calc(100vh - 120px)",overflowY:"auto"};function zse({element:e,customTextValue:t,customImages:r,badgeAspectRatio:n,onChange:o,onRemoveCustom:a,onCustomImageUploaded:s}){return e?pS(e)?i.jsx(Mse,{element:e,customTextValue:t,onChange:o,onRemoveCustom:a}):JU(e)?i.jsx(Dse,{element:e,customImages:r,badgeAspectRatio:n,onChange:o,onRemoveCustom:a,onCustomImageUploaded:s}):null:null}function Mse({element:e,customTextValue:t,onChange:r,onRemoveCustom:n}){const o=Pb(e),a=s=>{r(s?{fullWidthCenter:!0,x:0,w:100,textAlign:e.textAlign??"center"}:{fullWidthCenter:!1,x:e.x>0?e.x:6,w:72,textAlign:e.textAlign==="center"?"left":e.textAlign??"left"})};return i.jsxs("div",{role:"dialog","aria-label":"Selected field styling",onClick:s=>s.stopPropagation(),style:aH,children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Selected field styling"}),e.kind==="custom_text"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Text"}),i.jsx("input",{style:{...Ht,marginTop:4},value:e.text??t??"",onChange:s=>r({text:s.target.value}),onFocus:St,onBlur:jt})]}),n&&i.jsxs("button",{type:"button",onClick:n,style:sH,children:[i.jsx(Xr,{size:12})," Remove fixed text"]})]}),i.jsxs("label",{style:tR,children:[i.jsx("input",{type:"checkbox",checked:o,onChange:s=>a(s.target.checked),style:{marginTop:3}}),i.jsx("span",{children:"Full width & center text"})]}),i.jsxs("label",{style:tR,children:[i.jsx("input",{type:"checkbox",checked:e.shrinkToFit!==!1,onChange:s=>r({shrinkToFit:s.target.checked}),style:{marginTop:3}}),i.jsx("span",{children:"Shrink font if text overflows badge"})]}),i.jsxs("div",{children:[i.jsx(ht,{text:"Align"}),i.jsx(Hi,{name:"textAlign",value:e.textAlign??(o?"center":"left"),onChange:s=>r({textAlign:s}),options:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"}]})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Font colour"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:4},children:[i.jsx("input",{type:"color",value:e.color??"#0f172a",onChange:s=>r({color:s.target.value}),style:{width:40,height:32,border:"none",cursor:"pointer"}}),i.jsx("input",{style:{...Ht,flex:1},value:e.color??"#0f172a",onChange:s=>r({color:s.target.value}),onFocus:St,onBlur:jt})]})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Font family"}),i.jsx(Zr,{children:i.jsx("select",{style:{...Tr,marginTop:4},value:e.fontFamily??"Inter",onChange:s=>r({fontFamily:s.target.value}),onFocus:St,onBlur:jt,children:B3.map(s=>i.jsx("option",{value:s.id,children:s.label},s.id))})})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Font size"}),i.jsx(Zr,{children:i.jsx("select",{style:{...Tr,marginTop:4},value:String(e.fontSizePct??5),onChange:s=>r({fontSizePct:parseFloat(s.target.value)}),onFocus:St,onBlur:jt,children:Fse.map(s=>i.jsxs("option",{value:String(s),children:[s,"%"]},s))})})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Weight"}),i.jsx(Hi,{name:"fontWeight",value:e.fontWeight??"normal",onChange:s=>r({fontWeight:s}),options:[{label:"Normal",value:"normal"},{label:"Bold",value:"bold"}]})]}),i.jsx(Vt,{text:"Drag the field on the preview to move it."})]})}function Dse({element:e,customImages:t,badgeAspectRatio:r,onChange:n,onRemoveCustom:o,onCustomImageUploaded:a}){const s=S.useRef(null),[l,c]=S.useState(!1),u=e.w??28,d=e.field==="qr"?"QR code":e.field==="photo"?"Photo":"Fixed image",f=v=>{n(MT(e,v,r))},h=async v=>{if(!(!(v!=null&&v.type.startsWith("image/"))||e.kind!=="custom_image")){c(!0);try{const m=await eH(v),b=await Sa(v,{eventId:"portfolio",module:"badges/fixed-images"});if(b.url){const x=e.w??25,w=Rm(x,m,r);n({imageUrl:b.url,imageAspectRatio:m,h:w}),a==null||a(e.id,b.url,m)}}finally{c(!1)}}},p=e.kind==="custom_image"?oH(e,t):"";return i.jsxs("div",{role:"dialog","aria-label":"Selected element styling",onClick:v=>v.stopPropagation(),style:aH,children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:d}),e.kind==="custom_image"&&i.jsxs(i.Fragment,{children:[p?i.jsx("img",{src:p,alt:"",style:{maxWidth:"100%",maxHeight:80,objectFit:"contain",borderRadius:4,border:"1px solid var(--border)"}}):null,i.jsx("input",{ref:s,type:"file",accept:"image/*",style:{display:"none"},disabled:l,onChange:v=>{var m;h((m=v.target.files)==null?void 0:m[0]),v.target.value=""}}),i.jsxs("button",{type:"button",disabled:l,onClick:()=>{var v;return(v=s.current)==null?void 0:v.click()},style:Bse,children:[i.jsx(Fl,{size:14}),l?"Uploading…":p?"Replace image":"Upload image"]}),o&&i.jsxs("button",{type:"button",onClick:o,style:sH,children:[i.jsx(Xr,{size:12})," Remove fixed image"]})]}),i.jsxs("div",{children:[i.jsx(ht,{text:"Size"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginTop:6},children:[i.jsx("input",{type:"range",min:BT,max:WT,step:1,value:u,onChange:v=>f(parseFloat(v.target.value)),style:{flex:1}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",minWidth:36},children:[Math.round(u),"%"]})]})]}),i.jsx(Vt,{text:"Drag to move. Use the blue corner handle on the preview or the slider above to resize."})]})}const tR={display:"flex",alignItems:"flex-start",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},sH={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",border:"1px solid var(--destructive)",color:"var(--destructive)",background:"transparent",borderRadius:"var(--radius-button)",cursor:"pointer",fontSize:"var(--text-xs)",alignSelf:"flex-start"},Bse={display:"inline-flex",alignItems:"center",gap:8,padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"};function Wse(e){const t=e.event;return typeof t=="string"?t:t&&typeof t=="object"&&"_id"in t?String(t._id):""}function qse(e){const r=`Copy of ${(e||"Badge export").trim()}`;return r.length>120?`${r.slice(0,117)}…`:r}function $se(e){return e.config&&typeof e.config=="object"?e.config:{}}function Kc(e,t=""){return typeof e=="string"?e:t}function rR(e,t){return typeof e=="boolean"?e:t}function nR(e,t){return typeof e=="number"&&Number.isFinite(e)?String(e):t}function Use(e){const t=Kc(e.sizePreset,"a6");return t==="a7"||t==="4x3in"||t==="4x6in"||t==="custom"?t:"a6"}function Hse(e){const t=e.layout;return!Array.isArray(t)||t.length===0?[]:t.filter(r=>r!=null&&typeof r=="object"&&typeof r.id=="string").map(r=>({...r}))}function Vse(e,t){const r=Array.isArray(e.customTexts)?e.customTexts.filter(n=>n!=null&&typeof n=="object"&&typeof n.id=="string").map(n=>({id:String(n.id),text:String(n.text??"")})):[];return r.length?r:t.filter(n=>n.kind==="custom_text").map(n=>({id:n.id,text:Kc(n.text,"Your text")}))}function Yse(e,t){const r=Array.isArray(e.customImages)?e.customImages.filter(n=>n!=null&&typeof n=="object"&&typeof n.id=="string").map(n=>({id:String(n.id),imageUrl:String(n.imageUrl??"")})):[];return r.length?r:t.filter(n=>n.kind==="custom_image").map(n=>({id:n.id,imageUrl:Kc(n.imageUrl,"")})).filter(n=>n.imageUrl)}function Gse(e){const t=$se(e),r=Kc(t.backgroundMode,"color")==="image"?"image":"color",n=Kc(t.backgroundColor,"#0B4DD1"),o=Array.isArray(t.fields)?t.fields.map(f=>String(f)):["name","title","org","qr"];let a=Hse(t);!a.length&&o.length&&(a=nH(o,n,r));const s=Vse(t,a),l=Yse(t,a),c=Kc(t.participantScope,"all")==="participant_list"?"participant_list":"all",u=Kc(t.outputFormat,"pdf"),d=u==="png"||u==="jpeg"?u:"pdf";return{formName:qse(e.name),formEventId:Wse(e),sizePreset:Use(t),customW:nR(t.widthMm,"105"),customH:nR(t.heightMm,"148"),orientation:Kc(t.orientation,"portrait")==="landscape"?"landscape":"portrait",includeFaculty:rR(t.includeFaculty,!0),includeParticipants:rR(t.includeParticipants,!0),participantScope:c,participantListId:t.participantListId!=null?String(t.participantListId):"",backgroundMode:r,backgroundColor:n,backgroundImageUrl:Kc(t.backgroundImageUrl,""),enabledFields:o,layoutElements:a,customTexts:s,customImages:l,outputFormat:d,badgeTypeLabel:Kc(t.badgeTypeLabel,"Attendee")}}const Kse=[{id:"a6",label:"A6 (105 × 148 mm)"},{id:"a7",label:"A7 (74 × 105 mm)"},{id:"4x3in",label:"4 × 3 in"},{id:"4x6in",label:"4 × 6 in"},{id:"custom",label:"Custom (mm)"}],Qse=[{id:"name",icon:i.jsx(Om,{size:13}),label:"Full name"},{id:"title",icon:i.jsx(ore,{size:13}),label:"Title / role"},{id:"org",icon:i.jsx(_b,{size:13}),label:"Organisation"},{id:"badge_type",icon:i.jsx(bi,{size:13}),label:"Badge type tag"},{id:"qr",icon:i.jsx(Zf,{size:13}),label:"QR code"},{id:"photo",icon:i.jsx(Om,{size:13}),label:"Photo (faculty)"}];function Xse({busy:e,disabled:t,onFile:r}){const n=S.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:n,type:"file",accept:"image/*",style:{display:"none"},disabled:e||t,onChange:o=>{var s;const a=(s=o.target.files)==null?void 0:s[0];a&&r(a),o.target.value=""}}),i.jsxs("button",{type:"button",disabled:e||t,onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:e||t?"not-allowed":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",opacity:e||t?.6:1},children:[i.jsx(gr,{size:12})," ",e?"Uploading…":"Add fixed image"]})]})}function Zse({busy:e,disabled:t,onFile:r}){const n=S.useRef(null);return i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:n,type:"file",accept:"image/*",style:{display:"none"},disabled:e||t,onChange:o=>{var a;r((a=o.target.files)==null?void 0:a[0]),o.target.value=""}}),i.jsxs("button",{type:"button",disabled:e||t,onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},style:{display:"inline-flex",alignItems:"center",gap:8,marginTop:8,padding:"8px 14px",borderRadius:"var(--radius-button)",background:e?"var(--secondary)":"var(--primary)",color:e?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:e||t?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Fl,{size:14}),e?"Uploading…":"Choose file"]})]})}function lH({onClose:e,onSuccess:t,duplicateFromBatchId:r,initialEventId:n}){var Tt;const{user:o}=Mr(),a=Nn(o),s=3,l=wc(s),[c,u]=S.useState([]),[d,f]=S.useState([]),[h,p]=S.useState(""),[v,m]=S.useState(""),[b,x]=S.useState("a6"),[w,k]=S.useState("105"),[j,_]=S.useState("148"),[T,A]=S.useState("portrait"),[P,N]=S.useState(!0),[O,C]=S.useState(!0),[I,R]=S.useState("all"),[F,M]=S.useState(""),[Y,X]=S.useState("color"),[$,ee]=S.useState("#0B4DD1"),[V,D]=S.useState(""),[z,q]=S.useState(""),[G,U]=S.useState(["name","title","org","qr"]),[Q,K]=S.useState(()=>nH(["name","title","org","qr"],"#0B4DD1","color")),[re,H]=S.useState([]),[ie,de]=S.useState([]),[le,ke]=S.useState(!1),[ve,se]=S.useState(null),[be,De]=S.useState("Attendee"),[ae,ue]=S.useState("pdf"),[Me,Se]=S.useState(!1),[Pe,Ee]=S.useState(null),[Ae,Ye]=S.useState(""),[rt,He]=S.useState(!1),[xt,st]=S.useState(!!r),Te=Lse(b,T,w,j),et=!!r,Pt=z||V,qe=S.useMemo(()=>Q.find(We=>We.id===ve)??null,[Q,ve]);S.useEffect(()=>()=>{z.startsWith("blob:")&&URL.revokeObjectURL(z)},[z]),S.useEffect(()=>{K(We=>We.map(ce=>{let he={...ce};if(ce.field==="qr"){const je=ce.w??28;he={...he,w:je,h:je}}else if(ce.field==="photo"&&ce.w!=null)he={...he,h:ce.w};else if(ce.kind==="custom_image"&&ce.imageAspectRatio){const je=ce.w??25;he={...he,h:Rm(je,ce.imageAspectRatio,Te)}}return{...he,...DT(he,he.x,he.y)}}))},[b,T,w,j,Te]),S.useEffect(()=>{if(!r||!a){st(!1);return}let We=!1;return st(!0),Ye(""),wx.get(r,a).then(ce=>{if(We)return;if(ce.error||!ce.data){Ye(typeof ce.error=="string"?ce.error:"Could not load badge to duplicate."),st(!1);return}const he=Gse(ce.data);p(he.formName),m(he.formEventId),x(he.sizePreset),k(he.customW),_(he.customH),A(he.orientation),N(he.includeFaculty),C(he.includeParticipants),R(he.participantScope),M(he.participantListId),X(he.backgroundMode),ee(he.backgroundColor),D(he.backgroundImageUrl),q(""),U(he.enabledFields),K(he.layoutElements),H(he.customTexts),de(he.customImages),ue(he.outputFormat),De(he.badgeTypeLabel),se(null),st(!1)}),()=>{We=!0}},[r,a]),S.useEffect(()=>{n&&m(n)},[n]),S.useEffect(()=>{a&&(Lr.list({limit:100,organization:a}).then(We=>{var ce;(ce=We.data)!=null&&ce.events&&(u(We.data.events),m(he=>{var je;return he||n||((je=We.data.events[0])==null?void 0:je._id)||""}))}),qa.list({organization:a}).then(We=>{var ce;(ce=We.data)!=null&&ce.lists&&(f(We.data.lists),M(he=>{var je;return he||((je=We.data.lists[0])==null?void 0:je._id)||""}))}))},[a,n]);const Et=We=>{const ce=G.includes(We)?G.filter(he=>he!==We):[...G,We];U(ce),K(he=>eR(he,ce,re,ie,$,Y,Te)),!ce.includes(We)&&ve===We&&se(null)},vt=()=>{if(re.length>=xy)return;const We=_se(),he=[...re,{id:We,text:"Your text"}];H(he),K(je=>eR(je,G,he,ie,$,Y,Te)),se(We)},Ft=async We=>{if(ie.length>=Q5)return;if(!We.type.startsWith("image/")){Ye("Choose an image file.");return}const ce=Cse();ke(!0),Ye("");try{const he=await eH(We),je=await Sa(We,{eventId:"portfolio",module:"badges/fixed-images"});if(!je.url)throw new Error("Upload failed");const xe=[...ie,{id:ce,imageUrl:je.url}];de(xe),K(Re=>[...Re,iH(ce,je.url,ie.length,Te,he)]),se(ce)}catch(he){Ye(he instanceof Error?he.message:"Upload failed")}finally{ke(!1)}},Ce=We=>{de(ce=>ce.filter(he=>he.id!==We)),K(ce=>ce.filter(he=>he.id!==We)),ve===We&&se(null)},lt=We=>{H(ce=>ce.filter(he=>he.id!==We)),K(ce=>ce.filter(he=>he.id!==We)),ve===We&&se(null)},Xe=We=>{ve&&(K(ce=>ce.map(he=>{if(he.id!==ve)return he;const je={...he,...We};if(We.w!=null&&(he.field==="qr"||he.kind==="custom_image"||he.field==="photo"))return{...je,...MT(je,We.w,Te)};if(We.imageAspectRatio!=null&&he.kind==="custom_image"){const xe=je.w??25;return{...je,h:Rm(xe,We.imageAspectRatio,Te)}}return je})),We.text!==void 0&&(qe==null?void 0:qe.kind)==="custom_text"&&H(ce=>ce.map(he=>he.id===ve?{...he,text:We.text}:he)),We.imageUrl!==void 0&&(qe==null?void 0:qe.kind)==="custom_image"&&de(ce=>ce.map(he=>he.id===ve?{...he,imageUrl:We.imageUrl}:he)))},Be=async We=>{if(!We||!We.type.startsWith("image/")){Ye("Choose an image file.");return}const ce=URL.createObjectURL(We);q(ce),He(!0),Ye("");try{const he=await Sa(We,{eventId:"portfolio",module:"badges/backgrounds"});he.url&&(D(he.url),X("image"))}catch(he){Ye(he instanceof Error?he.message:"Upload failed")}finally{He(!1)}},ct=async()=>{var xe,Re;if(Ye(""),Ee(null),!a){Ye("No organisation context.");return}if(!h.trim()){Ye("Name is required.");return}if(!v){Ye("Select an event.");return}if(!P&&!O){Ye("Select Faculty and/or Participants.");return}if(O&&I==="participant_list"&&!F){Ye("Select a contact list.");return}if(Y==="image"&&!V.trim()){Ye("Upload a background image or switch to solid colour.");return}const We=Q.some(ze=>ze.kind==="custom_text")||Q.some(ze=>ze.kind==="custom_image");if(!G.length&&!We){Ye("Select at least one badge field, fixed text, or fixed image.");return}for(const ze of G)if(!Q.some(Le=>Le.kind==="field"&&Le.field===ze)){Ye(`Layout missing for field: ${ze}`);return}for(const ze of Q){if(ze.kind==="custom_text"&&!String(ze.text||((xe=re.find(Le=>Le.id===ze.id))==null?void 0:xe.text)||"").trim()){Ye("Fixed text fields must have content.");return}if(ze.kind==="custom_image"&&!(ze.imageUrl||((Re=ie.find(Qe=>Qe.id===ze.id))==null?void 0:Re.imageUrl)||"").trim()){Ye("Fixed image fields must have an uploaded image.");return}}if(b==="custom"){const ze=parseFloat(w),Le=parseFloat(j);if(!Number.isFinite(ze)||!Number.isFinite(Le)||ze<=0||Le<=0){Ye("Enter valid custom width and height (mm).");return}}const ce=Q.map(ze=>{var Le,Qe;return{...ze,text:ze.kind==="custom_text"?ze.text??((Le=re.find(mt=>mt.id===ze.id))==null?void 0:Le.text)??"":void 0,imageUrl:ze.kind==="custom_image"?ze.imageUrl??((Qe=ie.find(mt=>mt.id===ze.id))==null?void 0:Qe.imageUrl)??"":void 0}}),he={name:h.trim(),organization:a,event:v,sizePreset:b,...b==="custom"?{widthMm:parseFloat(w),heightMm:parseFloat(j)}:{},orientation:T,includeFaculty:P,includeParticipants:O,participantScope:I,...O&&I==="participant_list"?{participantListId:F}:{},backgroundMode:Y,backgroundImageUrl:Y==="image"?V.trim():"",backgroundColor:$,fields:G,layout:ce,customTexts:re.map(({id:ze,text:Le})=>({id:ze,text:Le})),customImages:ie.map(({id:ze,imageUrl:Le})=>({id:ze,imageUrl:Le})),outputFormat:ae,badgeTypeLabel:be.trim()||"Attendee"};Se(!0);const je=await wx.create(he);if(Se(!1),je.error){Ye(typeof je.error=="string"?je.error:"Request failed");return}Ee("We have received your request. Generation runs in the background — this page will refresh with a download link when ready (usually within a few minutes)."),t==null||t(),setTimeout(()=>e(),2500)};return i.jsxs(ra,{onClose:e,title:et?"Duplicate badge export":"Request badge export",breadcrumb:"Design · Badges",description:et?"Settings copied from the selected export. Adjust anything, then submit to queue a new batch.":"Faculty = speakers linked to sessions for the selected event. A zip file is built on the server and uploaded when ready.",completedCount:l.done.size,totalSections:s,ctaLabel:"Submit request",ctaDisabled:Me||xt,onCtaClick:ct,panelWidth:"min(1120px, 100vw)",children:[xt&&i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)",margin:"0 16px 0 20px"},children:"Loading badge settings…"}),i.jsxs("div",{style:{display:"flex",minHeight:"100%"},children:[i.jsx("div",{style:{flex:"0 0 42%",maxWidth:"42%",borderRight:"1px solid var(--border)",alignSelf:"flex-start",position:"sticky",top:0,overflow:"visible",zIndex:2},children:i.jsxs("div",{style:{position:"relative",overflow:"visible"},children:[i.jsx(Ose,{aspectRatio:Te,badgeAspectRatio:Te,backgroundMode:Y,backgroundColor:$,backgroundImageUrl:Pt,layoutElements:Q,customImages:ie,badgeTypeLabel:be,selectedId:ve,onSelect:se,onLayoutChange:K}),i.jsx(zse,{element:qe,customTextValue:(Tt=re.find(We=>We.id===ve))==null?void 0:Tt.text,customImages:ie,badgeAspectRatio:Te,onChange:Xe,onRemoveCustom:(qe==null?void 0:qe.kind)==="custom_text"?()=>lt(qe.id):(qe==null?void 0:qe.kind)==="custom_image"?()=>Ce(qe.id):void 0,onCustomImageUploaded:(We,ce,he)=>{de(je=>je.map(xe=>xe.id===We?{...xe,imageUrl:ce}:xe)),Xe({imageUrl:ce,imageAspectRatio:he})}})]})}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[Ae&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:"0 16px 0 20px"},children:Ae}),Pe&&i.jsx("p",{style:{color:"var(--foreground)",fontSize:"var(--text-sm)",margin:"0 16px 0 20px",background:"var(--accent)",padding:12,borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:Pe}),i.jsxs(Ur,{n:1,title:"Details & recipients",subtitle:"Event, size, orientation, who appears on badges",open:l.open===1,completed:l.done.has(1),onToggle:()=>l.toggle(1),onSave:()=>l.advance(1),nextLabel:"Design",children:[i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Export name",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. NAPCON 2026 — All badges",value:h,onChange:We=>p(We.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Associated event",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:v,onChange:We=>m(We.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select…"}),c.map(We=>i.jsx("option",{value:We._id,children:We.name},We._id))]})})]}),i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Badge size",required:!0}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:b,onChange:We=>x(We.target.value),onFocus:St,onBlur:jt,children:Kse.map(We=>i.jsx("option",{value:We.id,children:We.label},We.id))})})]}),b==="custom"&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Width (mm)",required:!0}),i.jsx("input",{style:Ht,value:w,onChange:We=>k(We.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Height (mm)",required:!0}),i.jsx("input",{style:Ht,value:j,onChange:We=>_(We.target.value),onFocus:St,onBlur:jt})]})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Orientation"}),i.jsx(Hi,{name:"bdOrientation",value:T,onChange:We=>A(We),options:[{label:"Portrait",value:"portrait"},{label:"Landscape",value:"landscape"}]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Include on export",required:!0}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:P,onChange:We=>N(We.target.checked)}),"Faculty (speakers linked to this event's sessions)"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:O,onChange:We=>C(We.target.checked)}),"Participants"]})]})]}),O&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Participants"}),i.jsx(Hi,{name:"partScope",value:I,onChange:We=>R(We),options:[{label:"All registered for this event",value:"all"},{label:"Specific contact list",value:"participant_list"}]}),I==="participant_list"&&i.jsx(Zr,{children:i.jsxs("select",{style:{...Tr,marginTop:8},value:F,onChange:We=>M(We.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select list…"}),d.map(We=>i.jsx("option",{value:We._id,children:We.name},We._id))]})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Badge type label (participants)"}),i.jsx("input",{style:Ht,value:be,onChange:We=>De(We.target.value),placeholder:"Attendee",onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Shown when “Badge type tag” is enabled; faculty use their speaker role when available."})]})]}),i.jsxs(Ur,{n:2,title:"Design",subtitle:"Background and fields on the badge",open:l.open===2,completed:l.done.has(2),onToggle:()=>l.toggle(2),onSave:()=>l.advance(2),nextLabel:"Output",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Background",required:!0}),i.jsx(Hi,{name:"bgMode",value:Y,onChange:We=>X(We),options:[{label:"Solid colour",value:"color"},{label:"Image",value:"image"}]})]}),Y==="color"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Colour"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx("input",{type:"color",value:$,onChange:We=>ee(We.target.value),style:{width:48,height:36,border:"none",cursor:"pointer"}}),i.jsx("input",{style:{...Ht,flex:1},value:$,onChange:We=>ee(We.target.value),onFocus:St,onBlur:jt})]})]}),Y==="image"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Background image"}),i.jsx("input",{style:Ht,value:V,onChange:We=>D(We.target.value),placeholder:"https://… or upload",onFocus:St,onBlur:jt}),i.jsx(Zse,{busy:rt,onFile:We=>void Be(We)}),i.jsx(Vt,{text:"Must be reachable by the server when the worker runs (public HTTPS)."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Badge fields"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Qse.map(We=>{const ce=G.includes(We.id);return i.jsxs("button",{type:"button",onClick:()=>Et(We.id),style:{display:"flex",alignItems:"center",gap:10,padding:"8px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${ce?"var(--primary)":"var(--border)"}`,background:ce?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left"},children:[i.jsx("span",{style:{color:"var(--muted)"},children:We.icon}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:We.label})]},We.id)})})]}),i.jsxs(dt,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(ht,{text:"Fixed text fields"}),i.jsxs("button",{type:"button",disabled:re.length>=xy,onClick:vt,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:re.length>=xy?"not-allowed":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",opacity:re.length>=xy?.6:1},children:[i.jsx(gr,{size:12})," Add fixed text"]})]}),i.jsx(Vt,{text:`Up to ${xy} custom labels. Click a field on the preview to style it in the panel beside the preview.`})]}),i.jsxs(dt,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[i.jsx(ht,{text:"Fixed images"}),i.jsx(Xse,{busy:le,disabled:ie.length>=Q5,onFile:We=>void Ft(We)})]}),i.jsx(Vt,{text:`Up to ${Q5} logos or graphics. Keeps the uploaded width/height ratio — drag and resize on preview.`})]})]}),i.jsxs(Ur,{n:3,title:"Output format",subtitle:"Files are zipped after generation",open:l.open===3,completed:l.done.has(3),onToggle:()=>l.toggle(3),onSave:()=>l.advance(3),nextLabel:"Submit",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Format",required:!0}),i.jsx(Hi,{name:"outFmt",value:ae,onChange:We=>ue(We),options:[{label:"PDF (multi-page, one badge per page)",value:"pdf"},{label:"PNG (one file per person)",value:"png"},{label:"JPEG (one file per person)",value:"jpeg"}]})]}),i.jsx(Vt,{text:"Run npm run badge-batch-worker on the server so jobs complete. AWS S3/CloudFront must be configured."})]})]})]})]})}function Jse(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function ele(e){return e==="ready"?"Ready":e==="processing"?"Processing":e==="failed"?"Failed":"Pending"}function tle({eventId:e,eventName:t,onClose:r,onAddBadge:n,onDuplicateBadge:o}){const{user:a}=Mr(),s=!!(a&&["super_admin","admin","moderator"].includes(a.role)),[l,c]=S.useState([]),[u,d]=S.useState(!0),[f,h]=S.useState(""),p=S.useCallback(async()=>{var v;d(!0),h("");try{const m=await wx.list({event:e,limit:100});m.error?(h(typeof m.error=="string"?m.error:"Failed to load badges."),c([])):c(((v=m.data)==null?void 0:v.batches)??[])}catch{h("Failed to load badges."),c([])}finally{d(!1)}},[e]);return S.useEffect(()=>{p()},[p]),i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:r,role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"event-badges-title",style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.2)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,padding:"16px 18px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 4px"},children:"Tag & Badge Configuration"}),i.jsx("h2",{id:"event-badges-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:t?`Badges · ${t}`:"Badges"})]}),i.jsxs("div",{style:{display:"flex",gap:8,flexShrink:0},children:[s?i.jsxs("button",{type:"button",onClick:n,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 12px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(gr,{size:14})," Add Badge"]}):null,i.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(Gt,{size:18})})]})]}),i.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px 18px"},children:[u?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Loading badges…"}):null,f?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)"},children:f}):null,!u&&!f&&l.length===0?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"48px 24px",gap:12},children:[i.jsx(Cx,{size:36,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"No badges yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,maxWidth:320,lineHeight:1.5},children:"Create a badge export to design attendee and speaker badges for this event."}),s?i.jsxs("button",{type:"button",onClick:n,style:{display:"inline-flex",alignItems:"center",gap:6,marginTop:8,padding:"8px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(gr,{size:14})," Add Badge"]}):null]}):null,!u&&!f&&l.length>0?i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:l.map(v=>i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"14px 16px",display:"flex",flexDirection:"column",gap:8},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx(Cx,{size:18,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:v.name})]}),i.jsxs("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Status: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:ele(v.status)}),v.itemCount!=null?` · ${v.itemCount} badge${v.itemCount!==1?"s":""}`:""]}),v.lastError&&v.status==="failed"?i.jsx("span",{style:{fontSize:"10px",color:"var(--destructive)"},children:v.lastError}):null,i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[s?i.jsxs("button",{type:"button",title:"Duplicate — copy settings and edit",onClick:()=>o(v._id),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(Js,{size:13})," Duplicate"]}):null,v.status==="ready"&&v.zipUrl?i.jsxs("a",{href:v.zipUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",textDecoration:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(ja,{size:13})," Download zip"]}):i.jsxs("button",{type:"button",disabled:!0,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--muted)",border:"1px solid var(--border)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"not-allowed"},children:[i.jsx(ja,{size:13})," Download zip"]})]}),v.createdAt?i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Requested ",Jse(v.createdAt)]}):null]},v._id))}):null]})]})]})}const by={width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"},Op={fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px",display:"block"},K0=i.jsx("span",{style:{color:"var(--destructive)",marginLeft:"2px"},children:"*"}),rle=["Single Choice","Multiple Choice","True / False"];function nle(e){return!!(e.text.trim()||e.imageUrl)}function iR({onSave:e,onClose:t,initial:r,eventId:n,showPerQuestionTimeLimit:o}){const[a,s]=S.useState((r==null?void 0:r.text)??""),[l,c]=S.useState((r==null?void 0:r.type)??"Single Choice"),[u,d]=S.useState((r==null?void 0:r.order)??0),[f,h]=S.useState((r==null?void 0:r.status)??"Active"),[p,v]=S.useState((r==null?void 0:r.imageUrl)??""),[m,b]=S.useState(typeof(r==null?void 0:r.timeLimit)=="number"&&Number.isFinite(r.timeLimit)?r.timeLimit:0),[x,w]=S.useState((r==null?void 0:r.options)??[{id:"o1",text:"",isCorrect:!1},{id:"o2",text:"",isCorrect:!1}]),[k,j]=S.useState(()=>{var D;return(r==null?void 0:r.useImagesOptions)??((D=r==null?void 0:r.options)==null?void 0:D.some(z=>z.imageUrl))??!1}),[_,T]=S.useState({}),[A,P]=S.useState(null),[N,O]=S.useState(null),C=S.useRef(null),I=()=>w(D=>[...D,{id:`o${Date.now()}`,text:"",isCorrect:!1}]),R=D=>w(z=>z.filter(q=>q.id!==D)),F=(D,z,q)=>w(G=>G.map(U=>U.id!==D?U:z==="isCorrect"&&q===!0&&l==="Single Choice"?{...U,isCorrect:!0}:{...U,[z]:q}).map(U=>z==="isCorrect"&&q===!0&&l==="Single Choice"&&U.id!==D?{...U,isCorrect:!1}:U)),M=async(D,z)=>{O(null),P(z);try{const q=await Sa(D,{eventId:n,module:"quiz-polls"});q!=null&&q.url&&(z==="question"?v(q.url):F(z,"imageUrl",q.url))}catch(q){O(q instanceof Error?q.message:"Upload failed")}finally{P(null)}},Y=D=>{var q;const z=(q=D.target.files)==null?void 0:q[0];D.target.value="",z&&M(z,"question")},X=(D,z)=>{var G;const q=(G=z.target.files)==null?void 0:G[0];z.target.value="",q&&M(q,D)},$=()=>{const D={};if(a.trim()||(D.text="Question text is required."),x.filter(nle).length<2&&(D.options="At least 2 options with text and/or image are required."),o){const q=Math.floor(Number(m));(!Number.isFinite(q)||q<=0)&&(D.timeLimit="Time limit must be greater than 0 seconds.")}return T(D),Object.keys(D).length===0},ee=()=>{$()&&(e({id:(r==null?void 0:r.id)??`q${Date.now()}`,text:a.trim(),type:l,order:u,status:f,options:x,imageUrl:p.trim()||void 0,useImagesOptions:k,...o?{timeLimit:Math.max(0,Math.floor(Number(m))||0)}:{}}),t())},V=A==="question";return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.28)",zIndex:200,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"580px",maxHeight:"92vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:r?"Edit Question":"Add Question"}),i.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex"},children:i.jsx(Gt,{size:16})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px",display:"flex",flexDirection:"column",gap:"18px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:Op,children:["Question ",K0]}),i.jsx("textarea",{value:a,onChange:D=>{s(D.target.value),_.text&&T(z=>({...z,text:""}))},rows:3,placeholder:"Enter your question…",style:{...by,height:"auto",padding:"10px",resize:"vertical",lineHeight:"1.5",borderColor:_.text?"var(--destructive)":"var(--border)"},onFocus:D=>{D.currentTarget.style.borderColor="var(--ring)"},onBlur:D=>{D.currentTarget.style.borderColor=_.text?"var(--destructive)":"var(--border)"}}),_.text&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginTop:"4px"},children:_.text})]}),i.jsxs("div",{children:[i.jsx("label",{style:Op,children:"Question Image"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"0 14px",height:"36px",background:V?"var(--border)":"var(--secondary)",cursor:V?"wait":"pointer",borderRight:"1px solid var(--border)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",whiteSpace:"nowrap",flexShrink:0},children:[i.jsx(jx,{size:13,style:{color:"var(--muted)"}}),V?"Uploading…":"Choose File",i.jsx("input",{ref:C,type:"file",accept:"image/*",disabled:!!V,onChange:Y,style:{display:"none"}})]}),i.jsx("span",{style:{padding:"0 12px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:p?"Image attached":"No file chosen"}),p&&i.jsx("button",{type:"button",onClick:()=>v(""),style:{padding:"0 10px",height:"36px",border:"none",background:"transparent",color:"var(--destructive)",fontSize:"var(--text-xs)",cursor:"pointer",flexShrink:0},children:"Remove"})]}),p&&i.jsx("img",{src:p,alt:"",style:{marginTop:"8px",maxWidth:"100%",maxHeight:"160px",borderRadius:"var(--radius-button)",objectFit:"contain",border:"1px solid var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:"Optional: uploads via media library (S3 / CloudFront)"}),N&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",marginTop:"4px"},children:N})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:Op,children:["Question Type ",K0]}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("select",{value:l,onChange:D=>c(D.target.value),style:{...by,appearance:"none",paddingRight:"28px",cursor:"pointer"},children:rle.map(D=>i.jsx("option",{value:D,children:D},D))}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:"var(--muted)"},fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M2 4l4 4 4-4"})})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:Op,children:"Order"}),i.jsx("input",{type:"number",min:0,value:u,onChange:D=>d(Number(D.target.value)),style:by,onFocus:D=>{D.currentTarget.style.borderColor="var(--ring)"},onBlur:D=>{D.currentTarget.style.borderColor="var(--border)"}})]})]}),o?i.jsxs("div",{children:[i.jsxs("label",{style:Op,children:["Time Limit (seconds)",K0]}),i.jsx("input",{type:"number",min:1,value:m,onChange:D=>{b(Number(D.target.value)),_.timeLimit&&T(z=>({...z,timeLimit:""}))},style:{...by,borderColor:_.timeLimit?"var(--destructive)":"var(--border)"},onFocus:D=>{D.currentTarget.style.borderColor="var(--ring)"},onBlur:D=>{D.currentTarget.style.borderColor=_.timeLimit?"var(--destructive)":"var(--border)"}}),_.timeLimit?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginTop:"4px"},children:_.timeLimit}):i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:"How long attendees have to answer this question in Quiz Master mode."})]}):null,i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[i.jsxs("label",{style:{...Op,marginBottom:0},children:["Options ",K0]}),i.jsxs("button",{type:"button",onClick:()=>j(D=>!D),style:{display:"flex",alignItems:"center",gap:"6px",background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[i.jsx("span",{style:{width:"14px",height:"14px",borderRadius:"50%",background:k?"var(--primary)":"var(--border)",display:"block",flexShrink:0}}),"Use Images in Options"]})]}),_.options&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginBottom:"6px"},children:_.options}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:x.map((D,z)=>i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",padding:k?"10px":"0",border:k?"1px solid var(--border)":"none",borderRadius:"var(--radius-button)",background:k?"var(--secondary)":"transparent"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("input",{type:"text",placeholder:k?`Label / alt text (option ${z+1})`:`Enter option ${z+1}`,value:D.text,onChange:q=>F(D.id,"text",q.target.value),style:{...by,flex:1},onFocus:q=>{q.currentTarget.style.borderColor="var(--ring)"},onBlur:q=>{q.currentTarget.style.borderColor="var(--border)"}}),i.jsxs("button",{type:"button",onClick:()=>F(D.id,"isCorrect",!D.isCorrect),style:{display:"flex",alignItems:"center",gap:"5px",padding:"0 10px",height:"36px",borderRadius:"var(--radius-button)",border:`1px solid ${D.isCorrect?"#16a34a":"var(--border)"}`,background:D.isCorrect?"#f0fdf4":"var(--card)",color:D.isCorrect?"#15803d":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:D.isCorrect?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer",transition:"all 0.12s",whiteSpace:"nowrap",flexShrink:0},children:[D.isCorrect&&i.jsx(bi,{size:11,strokeWidth:2.5}),"Correct"]}),i.jsx("button",{type:"button",onClick:()=>x.length>2&&R(D.id),disabled:x.length<=2,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"none",background:x.length<=2?"var(--border)":"var(--destructive)",color:"#fff",cursor:x.length<=2?"not-allowed":"pointer",flexShrink:0},children:i.jsx(Xr,{size:13})})]}),k&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"0 12px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:A===D.id?"var(--border)":"var(--card)",cursor:A===D.id?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(jx,{size:12}),A===D.id?"Uploading…":"Option image",i.jsx("input",{type:"file",accept:"image/*",disabled:A===D.id,onChange:q=>X(D.id,q),style:{display:"none"}})]}),D.imageUrl&&i.jsxs(i.Fragment,{children:[i.jsx("img",{src:D.imageUrl,alt:"",style:{width:"48px",height:"48px",objectFit:"cover",borderRadius:"6px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>F(D.id,"imageUrl",""),style:{fontSize:"var(--text-xs)",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:"Remove image"})]})]})]},D.id))}),i.jsxs("button",{type:"button",onClick:I,style:{display:"inline-flex",alignItems:"center",gap:"5px",marginTop:"10px",padding:"5px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:[i.jsx(gr,{size:13})," Add Option"]})]}),i.jsxs("div",{children:[i.jsx("label",{style:Op,children:"Status"}),i.jsx("div",{style:{display:"flex",gap:"8px"},children:["Active","Draft"].map(D=>i.jsx("button",{type:"button",onClick:()=>h(D),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",border:`1px solid ${f===D?"var(--primary)":"var(--border)"}`,background:f===D?"var(--accent)":"var(--card)",color:f===D?"var(--primary)":"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:f===D?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer"},children:D},D))})]})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:ee,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Save Question"})]})]})})}function ile(e){return e.displayMode==="quiz_master"&&e.timeRestricted==="Yes"}function ole(e){return e!=null&&e.length?e.map((t,r)=>{const n=(t.options||[]).map((a,s)=>({id:`o-${r}-${s}`,text:a.text||"",isCorrect:!!a.isCorrect,imageUrl:a.imageUrl})),o=n.some(a=>a.imageUrl);return{id:`q-${r}`,text:t.question||"",imageUrl:t.imageUrl,useImagesOptions:o,type:t.type==="multiple"?"Multiple Choice":(t.type==="text"||t.type==="rating","Single Choice"),order:r,options:n,status:"Active",timeLimit:typeof t.timeLimit=="number"&&Number.isFinite(t.timeLimit)?Math.max(0,Math.floor(t.timeLimit)):void 0}}):[]}function hS(e,t){var n,o;const r={question:e.text,imageUrl:(n=e.imageUrl)!=null&&n.trim()?e.imageUrl.trim():null,type:e.type==="Single Choice"||e.type==="True / False"?"single":e.type==="Multiple Choice"?"multiple":"text",options:(o=e.options)==null?void 0:o.map(a=>{var s;return{text:a.text,isCorrect:a.isCorrect,imageUrl:(s=a.imageUrl)!=null&&s.trim()?a.imageUrl.trim():null}}),required:!0,...t==="quiz"?{points:1}:{}};return typeof e.timeLimit=="number"&&Number.isFinite(e.timeLimit)&&e.timeLimit>0?{...r,timeLimit:Math.max(0,Math.floor(e.timeLimit))}:r}var X5=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],hm={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return typeof console<"u"&&console.warn(e)},getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var r=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-r.getTime())/864e5-3+(r.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},Ex={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},ls=function(e,t){return t===void 0&&(t=2),("000"+e).slice(t*-1)},Al=function(e){return e===!0?1:0};function oR(e,t){var r;return function(){var n=this,o=arguments;clearTimeout(r),r=setTimeout(function(){return e.apply(n,o)},t)}}var Z5=function(e){return e instanceof Array?e:[e]};function La(e,t,r){if(r===!0)return e.classList.add(t);e.classList.remove(t)}function hn(e,t,r){var n=window.document.createElement(e);return t=t||"",r=r||"",n.className=t,r!==void 0&&(n.textContent=r),n}function Q0(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function cH(e,t){if(t(e))return e;if(e.parentNode)return cH(e.parentNode,t)}function X0(e,t){var r=hn("div","numInputWrapper"),n=hn("input","numInput "+e),o=hn("span","arrowUp"),a=hn("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?n.type="number":(n.type="text",n.pattern="\\d*"),t!==void 0)for(var s in t)n.setAttribute(s,t[s]);return r.appendChild(n),r.appendChild(o),r.appendChild(a),r}function Fs(e){try{if(typeof e.composedPath=="function"){var t=e.composedPath();return t[0]}return e.target}catch{return e.target}}var J5=function(){},p2=function(e,t,r){return r.months[t?"shorthand":"longhand"][e]},ale={D:J5,F:function(e,t,r){e.setMonth(r.months.longhand.indexOf(t))},G:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,r){e.setHours(e.getHours()%12+12*Al(new RegExp(r.amPM[1],"i").test(t)))},M:function(e,t,r){e.setMonth(r.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(parseFloat(t)*1e3)},W:function(e,t,r){var n=parseInt(t),o=new Date(e.getFullYear(),0,2+(n-1)*7,0,0,0,0);return o.setDate(o.getDate()-o.getDay()+r.firstDayOfWeek),o},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours((e.getHours()>=12?12:0)+parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:J5,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:J5,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},ih={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},rx={Z:function(e){return e.toISOString()},D:function(e,t,r){return t.weekdays.shorthand[rx.w(e,t,r)]},F:function(e,t,r){return p2(rx.n(e,t,r)-1,!1,t)},G:function(e,t,r){return ls(rx.h(e,t,r))},H:function(e){return ls(e.getHours())},J:function(e,t){return t.ordinal!==void 0?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[Al(e.getHours()>11)]},M:function(e,t){return p2(e.getMonth(),!0,t)},S:function(e){return ls(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,r){return r.getWeek(e)},Y:function(e){return ls(e.getFullYear(),4)},d:function(e){return ls(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return ls(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return ls(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},uH=function(e){var t=e.config,r=t===void 0?hm:t,n=e.l10n,o=n===void 0?Ex:n,a=e.isMobile,s=a===void 0?!1:a;return function(l,c,u){var d=u||o;return r.formatDate!==void 0&&!s?r.formatDate(l,c,d):c.split("").map(function(f,h,p){return rx[f]&&p[h-1]!=="\\"?rx[f](l,d,r):f!=="\\"?f:""}).join("")}},W3=function(e){var t=e.config,r=t===void 0?hm:t,n=e.l10n,o=n===void 0?Ex:n;return function(a,s,l,c){if(!(a!==0&&!a)){var u=c||o,d,f=a;if(a instanceof Date)d=new Date(a.getTime());else if(typeof a!="string"&&a.toFixed!==void 0)d=new Date(a);else if(typeof a=="string"){var h=s||(r||hm).dateFormat,p=String(a).trim();if(p==="today")d=new Date,l=!0;else if(r&&r.parseDate)d=r.parseDate(a,h);else if(/Z$/.test(p)||/GMT$/.test(p))d=new Date(a);else{for(var v=void 0,m=[],b=0,x=0,w="";b<h.length;b++){var k=h[b],j=k==="\\",_=h[b-1]==="\\"||j;if(ih[k]&&!_){w+=ih[k];var T=new RegExp(w).exec(a);T&&(v=!0)&&m[k!=="Y"?"push":"unshift"]({fn:ale[k],val:T[++x]})}else j||(w+=".")}d=!r||!r.noCalendar?new Date(new Date().getFullYear(),0,1,0,0,0,0):new Date(new Date().setHours(0,0,0,0)),m.forEach(function(A){var P=A.fn,N=A.val;return d=P(d,N,u)||d}),d=v?d:void 0}}if(!(d instanceof Date&&!isNaN(d.getTime()))){r.errorHandler(new Error("Invalid date provided: "+f));return}return l===!0&&d.setHours(0,0,0,0),d}}};function Ds(e,t,r){return r===void 0&&(r=!0),r!==!1?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}var sle=function(e,t,r){return e>Math.min(t,r)&&e<Math.max(t,r)},ek=function(e,t,r){return e*3600+t*60+r},lle=function(e){var t=Math.floor(e/3600),r=(e-t*3600)/60;return[t,r,e-t*3600-r*60]},cle={DAY:864e5};function tk(e){var t=e.defaultHour,r=e.defaultMinute,n=e.defaultSeconds;if(e.minDate!==void 0){var o=e.minDate.getHours(),a=e.minDate.getMinutes(),s=e.minDate.getSeconds();t<o&&(t=o),t===o&&r<a&&(r=a),t===o&&r===a&&n<s&&(n=e.minDate.getSeconds())}if(e.maxDate!==void 0){var l=e.maxDate.getHours(),c=e.maxDate.getMinutes();t=Math.min(t,l),t===l&&(r=Math.min(c,r)),t===l&&r===c&&(n=e.maxDate.getSeconds())}return{hours:t,minutes:r,seconds:n}}typeof Object.assign!="function"&&(Object.assign=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var n=function(l){l&&Object.keys(l).forEach(function(c){return e[c]=l[c]})},o=0,a=t;o<a.length;o++){var s=a[o];n(s)}return e});var va=function(){return va=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},va.apply(this,arguments)},aR=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),o=0,t=0;t<r;t++)for(var a=arguments[t],s=0,l=a.length;s<l;s++,o++)n[o]=a[s];return n},ule=300;function dle(e,t){var r={config:va(va({},hm),to.defaultConfig),l10n:Ex};r.parseDate=W3({config:r.config,l10n:r.l10n}),r._handlers=[],r.pluginElements=[],r.loadedPlugins=[],r._bind=m,r._setHoursFromDate=h,r._positionCalendar=ue,r.changeMonth=D,r.changeYear=K,r.clear=z,r.close=q,r.onMouseOver=le,r._createElement=hn,r.createDay=T,r.destroy=G,r.isEnabled=re,r.jumpToDate=w,r.updateValue=ct,r.open=ve,r.redraw=Pe,r.set=rt,r.setDate=xt,r.toggle=Et;function n(){r.utils={getDaysInMonth:function(ce,he){return ce===void 0&&(ce=r.currentMonth),he===void 0&&(he=r.currentYear),ce===1&&(he%4===0&&he%100!==0||he%400===0)?29:r.l10n.daysInMonth[ce]}}}function o(){r.element=r.input=e,r.isOpen=!1,be(),ae(),et(),Te(),n(),r.isMobile||_(),x(),(r.selectedDates.length||r.config.noCalendar)&&(r.config.enableTime&&h(r.config.noCalendar?r.latestSelectedDateObj:void 0),ct(!1)),l();var ce=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!r.isMobile&&ce&&ue(),vt("onReady")}function a(){var ce;return((ce=r.calendarContainer)===null||ce===void 0?void 0:ce.getRootNode()).activeElement||document.activeElement}function s(ce){return ce.bind(r)}function l(){var ce=r.config;ce.weekNumbers===!1&&ce.showMonths===1||ce.noCalendar!==!0&&window.requestAnimationFrame(function(){if(r.calendarContainer!==void 0&&(r.calendarContainer.style.visibility="hidden",r.calendarContainer.style.display="block"),r.daysContainer!==void 0){var he=(r.days.offsetWidth+1)*ce.showMonths;r.daysContainer.style.width=he+"px",r.calendarContainer.style.width=he+(r.weekWrapper!==void 0?r.weekWrapper.offsetWidth:0)+"px",r.calendarContainer.style.removeProperty("visibility"),r.calendarContainer.style.removeProperty("display")}})}function c(ce){if(r.selectedDates.length===0){var he=r.config.minDate===void 0||Ds(new Date,r.config.minDate)>=0?new Date:new Date(r.config.minDate.getTime()),je=tk(r.config);he.setHours(je.hours,je.minutes,je.seconds,he.getMilliseconds()),r.selectedDates=[he],r.latestSelectedDateObj=he}ce!==void 0&&ce.type!=="blur"&&We(ce);var xe=r._input.value;f(),ct(),r._input.value!==xe&&r._debouncedChange()}function u(ce,he){return ce%12+12*Al(he===r.l10n.amPM[1])}function d(ce){switch(ce%24){case 0:case 12:return 12;default:return ce%12}}function f(){if(!(r.hourElement===void 0||r.minuteElement===void 0)){var ce=(parseInt(r.hourElement.value.slice(-2),10)||0)%24,he=(parseInt(r.minuteElement.value,10)||0)%60,je=r.secondElement!==void 0?(parseInt(r.secondElement.value,10)||0)%60:0;r.amPM!==void 0&&(ce=u(ce,r.amPM.textContent));var xe=r.config.minTime!==void 0||r.config.minDate&&r.minDateHasTime&&r.latestSelectedDateObj&&Ds(r.latestSelectedDateObj,r.config.minDate,!0)===0,Re=r.config.maxTime!==void 0||r.config.maxDate&&r.maxDateHasTime&&r.latestSelectedDateObj&&Ds(r.latestSelectedDateObj,r.config.maxDate,!0)===0;if(r.config.maxTime!==void 0&&r.config.minTime!==void 0&&r.config.minTime>r.config.maxTime){var ze=ek(r.config.minTime.getHours(),r.config.minTime.getMinutes(),r.config.minTime.getSeconds()),Le=ek(r.config.maxTime.getHours(),r.config.maxTime.getMinutes(),r.config.maxTime.getSeconds()),Qe=ek(ce,he,je);if(Qe>Le&&Qe<ze){var mt=lle(ze);ce=mt[0],he=mt[1],je=mt[2]}}else{if(Re){var ft=r.config.maxTime!==void 0?r.config.maxTime:r.config.maxDate;ce=Math.min(ce,ft.getHours()),ce===ft.getHours()&&(he=Math.min(he,ft.getMinutes())),he===ft.getMinutes()&&(je=Math.min(je,ft.getSeconds()))}if(xe){var It=r.config.minTime!==void 0?r.config.minTime:r.config.minDate;ce=Math.max(ce,It.getHours()),ce===It.getHours()&&he<It.getMinutes()&&(he=It.getMinutes()),he===It.getMinutes()&&(je=Math.max(je,It.getSeconds()))}}p(ce,he,je)}}function h(ce){var he=ce||r.latestSelectedDateObj;he&&he instanceof Date&&p(he.getHours(),he.getMinutes(),he.getSeconds())}function p(ce,he,je){r.latestSelectedDateObj!==void 0&&r.latestSelectedDateObj.setHours(ce%24,he,je||0,0),!(!r.hourElement||!r.minuteElement||r.isMobile)&&(r.hourElement.value=ls(r.config.time_24hr?ce:(12+ce)%12+12*Al(ce%12===0)),r.minuteElement.value=ls(he),r.amPM!==void 0&&(r.amPM.textContent=r.l10n.amPM[Al(ce>=12)]),r.secondElement!==void 0&&(r.secondElement.value=ls(je)))}function v(ce){var he=Fs(ce),je=parseInt(he.value)+(ce.delta||0);(je/1e3>1||ce.key==="Enter"&&!/[^\d]/.test(je.toString()))&&K(je)}function m(ce,he,je,xe){if(he instanceof Array)return he.forEach(function(Re){return m(ce,Re,je,xe)});if(ce instanceof Array)return ce.forEach(function(Re){return m(Re,he,je,xe)});ce.addEventListener(he,je,xe),r._handlers.push({remove:function(){return ce.removeEventListener(he,je,xe)}})}function b(){vt("onChange")}function x(){if(r.config.wrap&&["open","close","toggle","clear"].forEach(function(je){Array.prototype.forEach.call(r.element.querySelectorAll("[data-"+je+"]"),function(xe){return m(xe,"click",r[je])})}),r.isMobile){qe();return}var ce=oR(ke,50);if(r._debouncedChange=oR(b,ule),r.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&m(r.daysContainer,"mouseover",function(je){r.config.mode==="range"&&le(Fs(je))}),m(r._input,"keydown",de),r.calendarContainer!==void 0&&m(r.calendarContainer,"keydown",de),!r.config.inline&&!r.config.static&&m(window,"resize",ce),window.ontouchstart!==void 0?m(window.document,"touchstart",Q):m(window.document,"mousedown",Q),m(window.document,"focus",Q,{capture:!0}),r.config.clickOpens===!0&&(m(r._input,"focus",r.open),m(r._input,"click",r.open)),r.daysContainer!==void 0&&(m(r.monthNav,"click",Tt),m(r.monthNav,["keyup","increment"],v),m(r.daysContainer,"click",Ae)),r.timeContainer!==void 0&&r.minuteElement!==void 0&&r.hourElement!==void 0){var he=function(je){return Fs(je).select()};m(r.timeContainer,["increment"],c),m(r.timeContainer,"blur",c,{capture:!0}),m(r.timeContainer,"click",k),m([r.hourElement,r.minuteElement],["focus","click"],he),r.secondElement!==void 0&&m(r.secondElement,"focus",function(){return r.secondElement&&r.secondElement.select()}),r.amPM!==void 0&&m(r.amPM,"click",function(je){c(je)})}r.config.allowInput&&m(r._input,"blur",ie)}function w(ce,he){var je=ce!==void 0?r.parseDate(ce):r.latestSelectedDateObj||(r.config.minDate&&r.config.minDate>r.now?r.config.minDate:r.config.maxDate&&r.config.maxDate<r.now?r.config.maxDate:r.now),xe=r.currentYear,Re=r.currentMonth;try{je!==void 0&&(r.currentYear=je.getFullYear(),r.currentMonth=je.getMonth())}catch(ze){ze.message="Invalid date supplied: "+je,r.config.errorHandler(ze)}he&&r.currentYear!==xe&&(vt("onYearChange"),R()),he&&(r.currentYear!==xe||r.currentMonth!==Re)&&vt("onMonthChange"),r.redraw()}function k(ce){var he=Fs(ce);~he.className.indexOf("arrow")&&j(ce,he.classList.contains("arrowUp")?1:-1)}function j(ce,he,je){var xe=ce&&Fs(ce),Re=je||xe&&xe.parentNode&&xe.parentNode.firstChild,ze=Ft("increment");ze.delta=he,Re&&Re.dispatchEvent(ze)}function _(){var ce=window.document.createDocumentFragment();if(r.calendarContainer=hn("div","flatpickr-calendar"),r.calendarContainer.tabIndex=-1,!r.config.noCalendar){if(ce.appendChild(Y()),r.innerContainer=hn("div","flatpickr-innerContainer"),r.config.weekNumbers){var he=V(),je=he.weekWrapper,xe=he.weekNumbers;r.innerContainer.appendChild(je),r.weekNumbers=xe,r.weekWrapper=je}r.rContainer=hn("div","flatpickr-rContainer"),r.rContainer.appendChild($()),r.daysContainer||(r.daysContainer=hn("div","flatpickr-days"),r.daysContainer.tabIndex=-1),I(),r.rContainer.appendChild(r.daysContainer),r.innerContainer.appendChild(r.rContainer),ce.appendChild(r.innerContainer)}r.config.enableTime&&ce.appendChild(X()),La(r.calendarContainer,"rangeMode",r.config.mode==="range"),La(r.calendarContainer,"animate",r.config.animate===!0),La(r.calendarContainer,"multiMonth",r.config.showMonths>1),r.calendarContainer.appendChild(ce);var Re=r.config.appendTo!==void 0&&r.config.appendTo.nodeType!==void 0;if((r.config.inline||r.config.static)&&(r.calendarContainer.classList.add(r.config.inline?"inline":"static"),r.config.inline&&(!Re&&r.element.parentNode?r.element.parentNode.insertBefore(r.calendarContainer,r._input.nextSibling):r.config.appendTo!==void 0&&r.config.appendTo.appendChild(r.calendarContainer)),r.config.static)){var ze=hn("div","flatpickr-wrapper");r.element.parentNode&&r.element.parentNode.insertBefore(ze,r.element),ze.appendChild(r.element),r.altInput&&ze.appendChild(r.altInput),ze.appendChild(r.calendarContainer)}!r.config.static&&!r.config.inline&&(r.config.appendTo!==void 0?r.config.appendTo:window.document.body).appendChild(r.calendarContainer)}function T(ce,he,je,xe){var Re=re(he,!0),ze=hn("span",ce,he.getDate().toString());return ze.dateObj=he,ze.$i=xe,ze.setAttribute("aria-label",r.formatDate(he,r.config.ariaDateFormat)),ce.indexOf("hidden")===-1&&Ds(he,r.now)===0&&(r.todayDateElem=ze,ze.classList.add("today"),ze.setAttribute("aria-current","date")),Re?(ze.tabIndex=-1,Ce(he)&&(ze.classList.add("selected"),r.selectedDateElem=ze,r.config.mode==="range"&&(La(ze,"startRange",r.selectedDates[0]&&Ds(he,r.selectedDates[0],!0)===0),La(ze,"endRange",r.selectedDates[1]&&Ds(he,r.selectedDates[1],!0)===0),ce==="nextMonthDay"&&ze.classList.add("inRange")))):ze.classList.add("flatpickr-disabled"),r.config.mode==="range"&&lt(he)&&!Ce(he)&&ze.classList.add("inRange"),r.weekNumbers&&r.config.showMonths===1&&ce!=="prevMonthDay"&&xe%7===6&&r.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+r.config.getWeek(he)+"</span>"),vt("onDayCreate",ze),ze}function A(ce){ce.focus(),r.config.mode==="range"&&le(ce)}function P(ce){for(var he=ce>0?0:r.config.showMonths-1,je=ce>0?r.config.showMonths:-1,xe=he;xe!=je;xe+=ce)for(var Re=r.daysContainer.children[xe],ze=ce>0?0:Re.children.length-1,Le=ce>0?Re.children.length:-1,Qe=ze;Qe!=Le;Qe+=ce){var mt=Re.children[Qe];if(mt.className.indexOf("hidden")===-1&&re(mt.dateObj))return mt}}function N(ce,he){for(var je=ce.className.indexOf("Month")===-1?ce.dateObj.getMonth():r.currentMonth,xe=he>0?r.config.showMonths:-1,Re=he>0?1:-1,ze=je-r.currentMonth;ze!=xe;ze+=Re)for(var Le=r.daysContainer.children[ze],Qe=je-r.currentMonth===ze?ce.$i+he:he<0?Le.children.length-1:0,mt=Le.children.length,ft=Qe;ft>=0&&ft<mt&&ft!=(he>0?mt:-1);ft+=Re){var It=Le.children[ft];if(It.className.indexOf("hidden")===-1&&re(It.dateObj)&&Math.abs(ce.$i-ft)>=Math.abs(he))return A(It)}r.changeMonth(Re),O(P(Re),0)}function O(ce,he){var je=a(),xe=H(je||document.body),Re=ce!==void 0?ce:xe?je:r.selectedDateElem!==void 0&&H(r.selectedDateElem)?r.selectedDateElem:r.todayDateElem!==void 0&&H(r.todayDateElem)?r.todayDateElem:P(he>0?1:-1);Re===void 0?r._input.focus():xe?N(Re,he):A(Re)}function C(ce,he){for(var je=(new Date(ce,he,1).getDay()-r.l10n.firstDayOfWeek+7)%7,xe=r.utils.getDaysInMonth((he-1+12)%12,ce),Re=r.utils.getDaysInMonth(he,ce),ze=window.document.createDocumentFragment(),Le=r.config.showMonths>1,Qe=Le?"prevMonthDay hidden":"prevMonthDay",mt=Le?"nextMonthDay hidden":"nextMonthDay",ft=xe+1-je,It=0;ft<=xe;ft++,It++)ze.appendChild(T("flatpickr-day "+Qe,new Date(ce,he-1,ft),ft,It));for(ft=1;ft<=Re;ft++,It++)ze.appendChild(T("flatpickr-day",new Date(ce,he,ft),ft,It));for(var Bt=Re+1;Bt<=42-je&&(r.config.showMonths===1||It%7!==0);Bt++,It++)ze.appendChild(T("flatpickr-day "+mt,new Date(ce,he+1,Bt%Re),Bt,It));var dr=hn("div","dayContainer");return dr.appendChild(ze),dr}function I(){if(r.daysContainer!==void 0){Q0(r.daysContainer),r.weekNumbers&&Q0(r.weekNumbers);for(var ce=document.createDocumentFragment(),he=0;he<r.config.showMonths;he++){var je=new Date(r.currentYear,r.currentMonth,1);je.setMonth(r.currentMonth+he),ce.appendChild(C(je.getFullYear(),je.getMonth()))}r.daysContainer.appendChild(ce),r.days=r.daysContainer.firstChild,r.config.mode==="range"&&r.selectedDates.length===1&&le()}}function R(){if(!(r.config.showMonths>1||r.config.monthSelectorType!=="dropdown")){var ce=function(xe){return r.config.minDate!==void 0&&r.currentYear===r.config.minDate.getFullYear()&&xe<r.config.minDate.getMonth()?!1:!(r.config.maxDate!==void 0&&r.currentYear===r.config.maxDate.getFullYear()&&xe>r.config.maxDate.getMonth())};r.monthsDropdownContainer.tabIndex=-1,r.monthsDropdownContainer.innerHTML="";for(var he=0;he<12;he++)if(ce(he)){var je=hn("option","flatpickr-monthDropdown-month");je.value=new Date(r.currentYear,he).getMonth().toString(),je.textContent=p2(he,r.config.shorthandCurrentMonth,r.l10n),je.tabIndex=-1,r.currentMonth===he&&(je.selected=!0),r.monthsDropdownContainer.appendChild(je)}}}function F(){var ce=hn("div","flatpickr-month"),he=window.document.createDocumentFragment(),je;r.config.showMonths>1||r.config.monthSelectorType==="static"?je=hn("span","cur-month"):(r.monthsDropdownContainer=hn("select","flatpickr-monthDropdown-months"),r.monthsDropdownContainer.setAttribute("aria-label",r.l10n.monthAriaLabel),m(r.monthsDropdownContainer,"change",function(Le){var Qe=Fs(Le),mt=parseInt(Qe.value,10);r.changeMonth(mt-r.currentMonth),vt("onMonthChange")}),R(),je=r.monthsDropdownContainer);var xe=X0("cur-year",{tabindex:"-1"}),Re=xe.getElementsByTagName("input")[0];Re.setAttribute("aria-label",r.l10n.yearAriaLabel),r.config.minDate&&Re.setAttribute("min",r.config.minDate.getFullYear().toString()),r.config.maxDate&&(Re.setAttribute("max",r.config.maxDate.getFullYear().toString()),Re.disabled=!!r.config.minDate&&r.config.minDate.getFullYear()===r.config.maxDate.getFullYear());var ze=hn("div","flatpickr-current-month");return ze.appendChild(je),ze.appendChild(xe),he.appendChild(ze),ce.appendChild(he),{container:ce,yearElement:Re,monthElement:je}}function M(){Q0(r.monthNav),r.monthNav.appendChild(r.prevMonthNav),r.config.showMonths&&(r.yearElements=[],r.monthElements=[]);for(var ce=r.config.showMonths;ce--;){var he=F();r.yearElements.push(he.yearElement),r.monthElements.push(he.monthElement),r.monthNav.appendChild(he.container)}r.monthNav.appendChild(r.nextMonthNav)}function Y(){return r.monthNav=hn("div","flatpickr-months"),r.yearElements=[],r.monthElements=[],r.prevMonthNav=hn("span","flatpickr-prev-month"),r.prevMonthNav.innerHTML=r.config.prevArrow,r.nextMonthNav=hn("span","flatpickr-next-month"),r.nextMonthNav.innerHTML=r.config.nextArrow,M(),Object.defineProperty(r,"_hidePrevMonthArrow",{get:function(){return r.__hidePrevMonthArrow},set:function(ce){r.__hidePrevMonthArrow!==ce&&(La(r.prevMonthNav,"flatpickr-disabled",ce),r.__hidePrevMonthArrow=ce)}}),Object.defineProperty(r,"_hideNextMonthArrow",{get:function(){return r.__hideNextMonthArrow},set:function(ce){r.__hideNextMonthArrow!==ce&&(La(r.nextMonthNav,"flatpickr-disabled",ce),r.__hideNextMonthArrow=ce)}}),r.currentYearElement=r.yearElements[0],Xe(),r.monthNav}function X(){r.calendarContainer.classList.add("hasTime"),r.config.noCalendar&&r.calendarContainer.classList.add("noCalendar");var ce=tk(r.config);r.timeContainer=hn("div","flatpickr-time"),r.timeContainer.tabIndex=-1;var he=hn("span","flatpickr-time-separator",":"),je=X0("flatpickr-hour",{"aria-label":r.l10n.hourAriaLabel});r.hourElement=je.getElementsByTagName("input")[0];var xe=X0("flatpickr-minute",{"aria-label":r.l10n.minuteAriaLabel});if(r.minuteElement=xe.getElementsByTagName("input")[0],r.hourElement.tabIndex=r.minuteElement.tabIndex=-1,r.hourElement.value=ls(r.latestSelectedDateObj?r.latestSelectedDateObj.getHours():r.config.time_24hr?ce.hours:d(ce.hours)),r.minuteElement.value=ls(r.latestSelectedDateObj?r.latestSelectedDateObj.getMinutes():ce.minutes),r.hourElement.setAttribute("step",r.config.hourIncrement.toString()),r.minuteElement.setAttribute("step",r.config.minuteIncrement.toString()),r.hourElement.setAttribute("min",r.config.time_24hr?"0":"1"),r.hourElement.setAttribute("max",r.config.time_24hr?"23":"12"),r.hourElement.setAttribute("maxlength","2"),r.minuteElement.setAttribute("min","0"),r.minuteElement.setAttribute("max","59"),r.minuteElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(je),r.timeContainer.appendChild(he),r.timeContainer.appendChild(xe),r.config.time_24hr&&r.timeContainer.classList.add("time24hr"),r.config.enableSeconds){r.timeContainer.classList.add("hasSeconds");var Re=X0("flatpickr-second");r.secondElement=Re.getElementsByTagName("input")[0],r.secondElement.value=ls(r.latestSelectedDateObj?r.latestSelectedDateObj.getSeconds():ce.seconds),r.secondElement.setAttribute("step",r.minuteElement.getAttribute("step")),r.secondElement.setAttribute("min","0"),r.secondElement.setAttribute("max","59"),r.secondElement.setAttribute("maxlength","2"),r.timeContainer.appendChild(hn("span","flatpickr-time-separator",":")),r.timeContainer.appendChild(Re)}return r.config.time_24hr||(r.amPM=hn("span","flatpickr-am-pm",r.l10n.amPM[Al((r.latestSelectedDateObj?r.hourElement.value:r.config.defaultHour)>11)]),r.amPM.title=r.l10n.toggleTitle,r.amPM.tabIndex=-1,r.timeContainer.appendChild(r.amPM)),r.timeContainer}function $(){r.weekdayContainer?Q0(r.weekdayContainer):r.weekdayContainer=hn("div","flatpickr-weekdays");for(var ce=r.config.showMonths;ce--;){var he=hn("div","flatpickr-weekdaycontainer");r.weekdayContainer.appendChild(he)}return ee(),r.weekdayContainer}function ee(){if(r.weekdayContainer){var ce=r.l10n.firstDayOfWeek,he=aR(r.l10n.weekdays.shorthand);ce>0&&ce<he.length&&(he=aR(he.splice(ce,he.length),he.splice(0,ce)));for(var je=r.config.showMonths;je--;)r.weekdayContainer.children[je].innerHTML=`
<span class='flatpickr-weekday'>
`+he.join("</span><span class='flatpickr-weekday'>")+`
</span>
`}}function V(){r.calendarContainer.classList.add("hasWeeks");var ce=hn("div","flatpickr-weekwrapper");ce.appendChild(hn("span","flatpickr-weekday",r.l10n.weekAbbreviation));var he=hn("div","flatpickr-weeks");return ce.appendChild(he),{weekWrapper:ce,weekNumbers:he}}function D(ce,he){he===void 0&&(he=!0);var je=he?ce:ce-r.currentMonth;je<0&&r._hidePrevMonthArrow===!0||je>0&&r._hideNextMonthArrow===!0||(r.currentMonth+=je,(r.currentMonth<0||r.currentMonth>11)&&(r.currentYear+=r.currentMonth>11?1:-1,r.currentMonth=(r.currentMonth+12)%12,vt("onYearChange"),R()),I(),vt("onMonthChange"),Xe())}function z(ce,he){if(ce===void 0&&(ce=!0),he===void 0&&(he=!0),r.input.value="",r.altInput!==void 0&&(r.altInput.value=""),r.mobileInput!==void 0&&(r.mobileInput.value=""),r.selectedDates=[],r.latestSelectedDateObj=void 0,he===!0&&(r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth()),r.config.enableTime===!0){var je=tk(r.config),xe=je.hours,Re=je.minutes,ze=je.seconds;p(xe,Re,ze)}r.redraw(),ce&&vt("onChange")}function q(){r.isOpen=!1,r.isMobile||(r.calendarContainer!==void 0&&r.calendarContainer.classList.remove("open"),r._input!==void 0&&r._input.classList.remove("active")),vt("onClose")}function G(){r.config!==void 0&&vt("onDestroy");for(var ce=r._handlers.length;ce--;)r._handlers[ce].remove();if(r._handlers=[],r.mobileInput)r.mobileInput.parentNode&&r.mobileInput.parentNode.removeChild(r.mobileInput),r.mobileInput=void 0;else if(r.calendarContainer&&r.calendarContainer.parentNode)if(r.config.static&&r.calendarContainer.parentNode){var he=r.calendarContainer.parentNode;if(he.lastChild&&he.removeChild(he.lastChild),he.parentNode){for(;he.firstChild;)he.parentNode.insertBefore(he.firstChild,he);he.parentNode.removeChild(he)}}else r.calendarContainer.parentNode.removeChild(r.calendarContainer);r.altInput&&(r.input.type="text",r.altInput.parentNode&&r.altInput.parentNode.removeChild(r.altInput),delete r.altInput),r.input&&(r.input.type=r.input._type,r.input.classList.remove("flatpickr-input"),r.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(je){try{delete r[je]}catch{}})}function U(ce){return r.calendarContainer.contains(ce)}function Q(ce){if(r.isOpen&&!r.config.inline){var he=Fs(ce),je=U(he),xe=he===r.input||he===r.altInput||r.element.contains(he)||ce.path&&ce.path.indexOf&&(~ce.path.indexOf(r.input)||~ce.path.indexOf(r.altInput)),Re=!xe&&!je&&!U(ce.relatedTarget),ze=!r.config.ignoredFocusElements.some(function(Le){return Le.contains(he)});Re&&ze&&(r.config.allowInput&&r.setDate(r._input.value,!1,r.config.altInput?r.config.altFormat:r.config.dateFormat),r.timeContainer!==void 0&&r.minuteElement!==void 0&&r.hourElement!==void 0&&r.input.value!==""&&r.input.value!==void 0&&c(),r.close(),r.config&&r.config.mode==="range"&&r.selectedDates.length===1&&r.clear(!1))}}function K(ce){if(!(!ce||r.config.minDate&&ce<r.config.minDate.getFullYear()||r.config.maxDate&&ce>r.config.maxDate.getFullYear())){var he=ce,je=r.currentYear!==he;r.currentYear=he||r.currentYear,r.config.maxDate&&r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth=Math.min(r.config.maxDate.getMonth(),r.currentMonth):r.config.minDate&&r.currentYear===r.config.minDate.getFullYear()&&(r.currentMonth=Math.max(r.config.minDate.getMonth(),r.currentMonth)),je&&(r.redraw(),vt("onYearChange"),R())}}function re(ce,he){var je;he===void 0&&(he=!0);var xe=r.parseDate(ce,void 0,he);if(r.config.minDate&&xe&&Ds(xe,r.config.minDate,he!==void 0?he:!r.minDateHasTime)<0||r.config.maxDate&&xe&&Ds(xe,r.config.maxDate,he!==void 0?he:!r.maxDateHasTime)>0)return!1;if(!r.config.enable&&r.config.disable.length===0)return!0;if(xe===void 0)return!1;for(var Re=!!r.config.enable,ze=(je=r.config.enable)!==null&&je!==void 0?je:r.config.disable,Le=0,Qe=void 0;Le<ze.length;Le++){if(Qe=ze[Le],typeof Qe=="function"&&Qe(xe))return Re;if(Qe instanceof Date&&xe!==void 0&&Qe.getTime()===xe.getTime())return Re;if(typeof Qe=="string"){var mt=r.parseDate(Qe,void 0,!0);return mt&&mt.getTime()===xe.getTime()?Re:!Re}else if(typeof Qe=="object"&&xe!==void 0&&Qe.from&&Qe.to&&xe.getTime()>=Qe.from.getTime()&&xe.getTime()<=Qe.to.getTime())return Re}return!Re}function H(ce){return r.daysContainer!==void 0?ce.className.indexOf("hidden")===-1&&ce.className.indexOf("flatpickr-disabled")===-1&&r.daysContainer.contains(ce):!1}function ie(ce){var he=ce.target===r._input,je=r._input.value.trimEnd()!==Be();he&&je&&!(ce.relatedTarget&&U(ce.relatedTarget))&&r.setDate(r._input.value,!0,ce.target===r.altInput?r.config.altFormat:r.config.dateFormat)}function de(ce){var he=Fs(ce),je=r.config.wrap?e.contains(he):he===r._input,xe=r.config.allowInput,Re=r.isOpen&&(!xe||!je),ze=r.config.inline&&je&&!xe;if(ce.keyCode===13&&je){if(xe)return r.setDate(r._input.value,!0,he===r.altInput?r.config.altFormat:r.config.dateFormat),r.close(),he.blur();r.open()}else if(U(he)||Re||ze){var Le=!!r.timeContainer&&r.timeContainer.contains(he);switch(ce.keyCode){case 13:Le?(ce.preventDefault(),c(),Ee()):Ae(ce);break;case 27:ce.preventDefault(),Ee();break;case 8:case 46:je&&!r.config.allowInput&&(ce.preventDefault(),r.clear());break;case 37:case 39:if(!Le&&!je){ce.preventDefault();var Qe=a();if(r.daysContainer!==void 0&&(xe===!1||Qe&&H(Qe))){var mt=ce.keyCode===39?1:-1;ce.ctrlKey?(ce.stopPropagation(),D(mt),O(P(1),0)):O(void 0,mt)}}else r.hourElement&&r.hourElement.focus();break;case 38:case 40:ce.preventDefault();var ft=ce.keyCode===40?1:-1;r.daysContainer&&he.$i!==void 0||he===r.input||he===r.altInput?ce.ctrlKey?(ce.stopPropagation(),K(r.currentYear-ft),O(P(1),0)):Le||O(void 0,ft*7):he===r.currentYearElement?K(r.currentYear-ft):r.config.enableTime&&(!Le&&r.hourElement&&r.hourElement.focus(),c(ce),r._debouncedChange());break;case 9:if(Le){var It=[r.hourElement,r.minuteElement,r.secondElement,r.amPM].concat(r.pluginElements).filter(function(pr){return pr}),Bt=It.indexOf(he);if(Bt!==-1){var dr=It[Bt+(ce.shiftKey?-1:1)];ce.preventDefault(),(dr||r._input).focus()}}else!r.config.noCalendar&&r.daysContainer&&r.daysContainer.contains(he)&&ce.shiftKey&&(ce.preventDefault(),r._input.focus());break}}if(r.amPM!==void 0&&he===r.amPM)switch(ce.key){case r.l10n.amPM[0].charAt(0):case r.l10n.amPM[0].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[0],f(),ct();break;case r.l10n.amPM[1].charAt(0):case r.l10n.amPM[1].charAt(0).toLowerCase():r.amPM.textContent=r.l10n.amPM[1],f(),ct();break}(je||U(he))&&vt("onKeyDown",ce)}function le(ce,he){if(he===void 0&&(he="flatpickr-day"),!(r.selectedDates.length!==1||ce&&(!ce.classList.contains(he)||ce.classList.contains("flatpickr-disabled")))){for(var je=ce?ce.dateObj.getTime():r.days.firstElementChild.dateObj.getTime(),xe=r.parseDate(r.selectedDates[0],void 0,!0).getTime(),Re=Math.min(je,r.selectedDates[0].getTime()),ze=Math.max(je,r.selectedDates[0].getTime()),Le=!1,Qe=0,mt=0,ft=Re;ft<ze;ft+=cle.DAY)re(new Date(ft),!0)||(Le=Le||ft>Re&&ft<ze,ft<xe&&(!Qe||ft>Qe)?Qe=ft:ft>xe&&(!mt||ft<mt)&&(mt=ft));var It=Array.from(r.rContainer.querySelectorAll("*:nth-child(-n+"+r.config.showMonths+") > ."+he));It.forEach(function(Bt){var dr=Bt.dateObj,pr=dr.getTime(),an=Qe>0&&pr<Qe||mt>0&&pr>mt;if(an){Bt.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(Jn){Bt.classList.remove(Jn)});return}else if(Le&&!an)return;["startRange","inRange","endRange","notAllowed"].forEach(function(Jn){Bt.classList.remove(Jn)}),ce!==void 0&&(ce.classList.add(je<=r.selectedDates[0].getTime()?"startRange":"endRange"),xe<je&&pr===xe?Bt.classList.add("startRange"):xe>je&&pr===xe&&Bt.classList.add("endRange"),pr>=Qe&&(mt===0||pr<=mt)&&sle(pr,xe,je)&&Bt.classList.add("inRange"))})}}function ke(){r.isOpen&&!r.config.static&&!r.config.inline&&ue()}function ve(ce,he){if(he===void 0&&(he=r._positionElement),r.isMobile===!0){if(ce){ce.preventDefault();var je=Fs(ce);je&&je.blur()}r.mobileInput!==void 0&&(r.mobileInput.focus(),r.mobileInput.click()),vt("onOpen");return}else if(r._input.disabled||r.config.inline)return;var xe=r.isOpen;r.isOpen=!0,xe||(r.calendarContainer.classList.add("open"),r._input.classList.add("active"),vt("onOpen"),ue(he)),r.config.enableTime===!0&&r.config.noCalendar===!0&&r.config.allowInput===!1&&(ce===void 0||!r.timeContainer.contains(ce.relatedTarget))&&setTimeout(function(){return r.hourElement.select()},50)}function se(ce){return function(he){var je=r.config["_"+ce+"Date"]=r.parseDate(he,r.config.dateFormat),xe=r.config["_"+(ce==="min"?"max":"min")+"Date"];je!==void 0&&(r[ce==="min"?"minDateHasTime":"maxDateHasTime"]=je.getHours()>0||je.getMinutes()>0||je.getSeconds()>0),r.selectedDates&&(r.selectedDates=r.selectedDates.filter(function(Re){return re(Re)}),!r.selectedDates.length&&ce==="min"&&h(je),ct()),r.daysContainer&&(Pe(),je!==void 0?r.currentYearElement[ce]=je.getFullYear().toString():r.currentYearElement.removeAttribute(ce),r.currentYearElement.disabled=!!xe&&je!==void 0&&xe.getFullYear()===je.getFullYear())}}function be(){var ce=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],he=va(va({},JSON.parse(JSON.stringify(e.dataset||{}))),t),je={};r.config.parseDate=he.parseDate,r.config.formatDate=he.formatDate,Object.defineProperty(r.config,"enable",{get:function(){return r.config._enable},set:function(It){r.config._enable=st(It)}}),Object.defineProperty(r.config,"disable",{get:function(){return r.config._disable},set:function(It){r.config._disable=st(It)}});var xe=he.mode==="time";if(!he.dateFormat&&(he.enableTime||xe)){var Re=to.defaultConfig.dateFormat||hm.dateFormat;je.dateFormat=he.noCalendar||xe?"H:i"+(he.enableSeconds?":S":""):Re+" H:i"+(he.enableSeconds?":S":"")}if(he.altInput&&(he.enableTime||xe)&&!he.altFormat){var ze=to.defaultConfig.altFormat||hm.altFormat;je.altFormat=he.noCalendar||xe?"h:i"+(he.enableSeconds?":S K":" K"):ze+(" h:i"+(he.enableSeconds?":S":"")+" K")}Object.defineProperty(r.config,"minDate",{get:function(){return r.config._minDate},set:se("min")}),Object.defineProperty(r.config,"maxDate",{get:function(){return r.config._maxDate},set:se("max")});var Le=function(It){return function(Bt){r.config[It==="min"?"_minTime":"_maxTime"]=r.parseDate(Bt,"H:i:S")}};Object.defineProperty(r.config,"minTime",{get:function(){return r.config._minTime},set:Le("min")}),Object.defineProperty(r.config,"maxTime",{get:function(){return r.config._maxTime},set:Le("max")}),he.mode==="time"&&(r.config.noCalendar=!0,r.config.enableTime=!0),Object.assign(r.config,je,he);for(var Qe=0;Qe<ce.length;Qe++)r.config[ce[Qe]]=r.config[ce[Qe]]===!0||r.config[ce[Qe]]==="true";X5.filter(function(It){return r.config[It]!==void 0}).forEach(function(It){r.config[It]=Z5(r.config[It]||[]).map(s)}),r.isMobile=!r.config.disableMobile&&!r.config.inline&&r.config.mode==="single"&&!r.config.disable.length&&!r.config.enable&&!r.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var Qe=0;Qe<r.config.plugins.length;Qe++){var mt=r.config.plugins[Qe](r)||{};for(var ft in mt)X5.indexOf(ft)>-1?r.config[ft]=Z5(mt[ft]).map(s).concat(r.config[ft]):typeof he[ft]>"u"&&(r.config[ft]=mt[ft])}he.altInputClass||(r.config.altInputClass=De().className+" "+r.config.altInputClass),vt("onParseConfig")}function De(){return r.config.wrap?e.querySelector("[data-input]"):e}function ae(){typeof r.config.locale!="object"&&typeof to.l10ns[r.config.locale]>"u"&&r.config.errorHandler(new Error("flatpickr: invalid locale "+r.config.locale)),r.l10n=va(va({},to.l10ns.default),typeof r.config.locale=="object"?r.config.locale:r.config.locale!=="default"?to.l10ns[r.config.locale]:void 0),ih.D="("+r.l10n.weekdays.shorthand.join("|")+")",ih.l="("+r.l10n.weekdays.longhand.join("|")+")",ih.M="("+r.l10n.months.shorthand.join("|")+")",ih.F="("+r.l10n.months.longhand.join("|")+")",ih.K="("+r.l10n.amPM[0]+"|"+r.l10n.amPM[1]+"|"+r.l10n.amPM[0].toLowerCase()+"|"+r.l10n.amPM[1].toLowerCase()+")";var ce=va(va({},t),JSON.parse(JSON.stringify(e.dataset||{})));ce.time_24hr===void 0&&to.defaultConfig.time_24hr===void 0&&(r.config.time_24hr=r.l10n.time_24hr),r.formatDate=uH(r),r.parseDate=W3({config:r.config,l10n:r.l10n})}function ue(ce){if(typeof r.config.position=="function")return void r.config.position(r,ce);if(r.calendarContainer!==void 0){vt("onPreCalendarPosition");var he=ce||r._positionElement,je=Array.prototype.reduce.call(r.calendarContainer.children,(function(xs,el){return xs+el.offsetHeight}),0),xe=r.calendarContainer.offsetWidth,Re=r.config.position.split(" "),ze=Re[0],Le=Re.length>1?Re[1]:null,Qe=he.getBoundingClientRect(),mt=window.innerHeight-Qe.bottom,ft=ze==="above"||ze!=="below"&&mt<je&&Qe.top>je,It=window.pageYOffset+Qe.top+(ft?-je-2:he.offsetHeight+2);if(La(r.calendarContainer,"arrowTop",!ft),La(r.calendarContainer,"arrowBottom",ft),!r.config.inline){var Bt=window.pageXOffset+Qe.left,dr=!1,pr=!1;Le==="center"?(Bt-=(xe-Qe.width)/2,dr=!0):Le==="right"&&(Bt-=xe-Qe.width,pr=!0),La(r.calendarContainer,"arrowLeft",!dr&&!pr),La(r.calendarContainer,"arrowCenter",dr),La(r.calendarContainer,"arrowRight",pr);var an=window.document.body.offsetWidth-(window.pageXOffset+Qe.right),Jn=Bt+xe>window.document.body.offsetWidth,Fi=an+xe>window.document.body.offsetWidth;if(La(r.calendarContainer,"rightMost",Jn),!r.config.static)if(r.calendarContainer.style.top=It+"px",!Jn)r.calendarContainer.style.left=Bt+"px",r.calendarContainer.style.right="auto";else if(!Fi)r.calendarContainer.style.left="auto",r.calendarContainer.style.right=an+"px";else{var Fn=Me();if(Fn===void 0)return;var Bo=window.document.body.offsetWidth,io=Math.max(0,Bo/2-xe/2),Wo=".flatpickr-calendar.centerMost:before",Yi=".flatpickr-calendar.centerMost:after",qo=Fn.cssRules.length,Ca="{left:"+Qe.left+"px;right:auto;}";La(r.calendarContainer,"rightMost",!1),La(r.calendarContainer,"centerMost",!0),Fn.insertRule(Wo+","+Yi+Ca,qo),r.calendarContainer.style.left=io+"px",r.calendarContainer.style.right="auto"}}}}function Me(){for(var ce=null,he=0;he<document.styleSheets.length;he++){var je=document.styleSheets[he];if(je.cssRules){try{je.cssRules}catch{continue}ce=je;break}}return ce??Se()}function Se(){var ce=document.createElement("style");return document.head.appendChild(ce),ce.sheet}function Pe(){r.config.noCalendar||r.isMobile||(R(),Xe(),I())}function Ee(){r._input.focus(),window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==void 0?setTimeout(r.close,0):r.close()}function Ae(ce){ce.preventDefault(),ce.stopPropagation();var he=function(It){return It.classList&&It.classList.contains("flatpickr-day")&&!It.classList.contains("flatpickr-disabled")&&!It.classList.contains("notAllowed")},je=cH(Fs(ce),he);if(je!==void 0){var xe=je,Re=r.latestSelectedDateObj=new Date(xe.dateObj.getTime()),ze=(Re.getMonth()<r.currentMonth||Re.getMonth()>r.currentMonth+r.config.showMonths-1)&&r.config.mode!=="range";if(r.selectedDateElem=xe,r.config.mode==="single")r.selectedDates=[Re];else if(r.config.mode==="multiple"){var Le=Ce(Re);Le?r.selectedDates.splice(parseInt(Le),1):r.selectedDates.push(Re)}else r.config.mode==="range"&&(r.selectedDates.length===2&&r.clear(!1,!1),r.latestSelectedDateObj=Re,r.selectedDates.push(Re),Ds(Re,r.selectedDates[0],!0)!==0&&r.selectedDates.sort(function(It,Bt){return It.getTime()-Bt.getTime()}));if(f(),ze){var Qe=r.currentYear!==Re.getFullYear();r.currentYear=Re.getFullYear(),r.currentMonth=Re.getMonth(),Qe&&(vt("onYearChange"),R()),vt("onMonthChange")}if(Xe(),I(),ct(),!ze&&r.config.mode!=="range"&&r.config.showMonths===1?A(xe):r.selectedDateElem!==void 0&&r.hourElement===void 0&&r.selectedDateElem&&r.selectedDateElem.focus(),r.hourElement!==void 0&&r.hourElement!==void 0&&r.hourElement.focus(),r.config.closeOnSelect){var mt=r.config.mode==="single"&&!r.config.enableTime,ft=r.config.mode==="range"&&r.selectedDates.length===2&&!r.config.enableTime;(mt||ft)&&Ee()}b()}}var Ye={locale:[ae,ee],showMonths:[M,l,$],minDate:[w],maxDate:[w],positionElement:[Pt],clickOpens:[function(){r.config.clickOpens===!0?(m(r._input,"focus",r.open),m(r._input,"click",r.open)):(r._input.removeEventListener("focus",r.open),r._input.removeEventListener("click",r.open))}]};function rt(ce,he){if(ce!==null&&typeof ce=="object"){Object.assign(r.config,ce);for(var je in ce)Ye[je]!==void 0&&Ye[je].forEach(function(xe){return xe()})}else r.config[ce]=he,Ye[ce]!==void 0?Ye[ce].forEach(function(xe){return xe()}):X5.indexOf(ce)>-1&&(r.config[ce]=Z5(he));r.redraw(),ct(!0)}function He(ce,he){var je=[];if(ce instanceof Array)je=ce.map(function(xe){return r.parseDate(xe,he)});else if(ce instanceof Date||typeof ce=="number")je=[r.parseDate(ce,he)];else if(typeof ce=="string")switch(r.config.mode){case"single":case"time":je=[r.parseDate(ce,he)];break;case"multiple":je=ce.split(r.config.conjunction).map(function(xe){return r.parseDate(xe,he)});break;case"range":je=ce.split(r.l10n.rangeSeparator).map(function(xe){return r.parseDate(xe,he)});break}else r.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(ce)));r.selectedDates=r.config.allowInvalidPreload?je:je.filter(function(xe){return xe instanceof Date&&re(xe,!1)}),r.config.mode==="range"&&r.selectedDates.sort(function(xe,Re){return xe.getTime()-Re.getTime()})}function xt(ce,he,je){if(he===void 0&&(he=!1),je===void 0&&(je=r.config.dateFormat),ce!==0&&!ce||ce instanceof Array&&ce.length===0)return r.clear(he);He(ce,je),r.latestSelectedDateObj=r.selectedDates[r.selectedDates.length-1],r.redraw(),w(void 0,he),h(),r.selectedDates.length===0&&r.clear(!1),ct(he),he&&vt("onChange")}function st(ce){return ce.slice().map(function(he){return typeof he=="string"||typeof he=="number"||he instanceof Date?r.parseDate(he,void 0,!0):he&&typeof he=="object"&&he.from&&he.to?{from:r.parseDate(he.from,void 0),to:r.parseDate(he.to,void 0)}:he}).filter(function(he){return he})}function Te(){r.selectedDates=[],r.now=r.parseDate(r.config.now)||new Date;var ce=r.config.defaultDate||((r.input.nodeName==="INPUT"||r.input.nodeName==="TEXTAREA")&&r.input.placeholder&&r.input.value===r.input.placeholder?null:r.input.value);ce&&He(ce,r.config.dateFormat),r._initialDate=r.selectedDates.length>0?r.selectedDates[0]:r.config.minDate&&r.config.minDate.getTime()>r.now.getTime()?r.config.minDate:r.config.maxDate&&r.config.maxDate.getTime()<r.now.getTime()?r.config.maxDate:r.now,r.currentYear=r._initialDate.getFullYear(),r.currentMonth=r._initialDate.getMonth(),r.selectedDates.length>0&&(r.latestSelectedDateObj=r.selectedDates[0]),r.config.minTime!==void 0&&(r.config.minTime=r.parseDate(r.config.minTime,"H:i")),r.config.maxTime!==void 0&&(r.config.maxTime=r.parseDate(r.config.maxTime,"H:i")),r.minDateHasTime=!!r.config.minDate&&(r.config.minDate.getHours()>0||r.config.minDate.getMinutes()>0||r.config.minDate.getSeconds()>0),r.maxDateHasTime=!!r.config.maxDate&&(r.config.maxDate.getHours()>0||r.config.maxDate.getMinutes()>0||r.config.maxDate.getSeconds()>0)}function et(){if(r.input=De(),!r.input){r.config.errorHandler(new Error("Invalid input element specified"));return}r.input._type=r.input.type,r.input.type="text",r.input.classList.add("flatpickr-input"),r._input=r.input,r.config.altInput&&(r.altInput=hn(r.input.nodeName,r.config.altInputClass),r._input=r.altInput,r.altInput.placeholder=r.input.placeholder,r.altInput.disabled=r.input.disabled,r.altInput.required=r.input.required,r.altInput.tabIndex=r.input.tabIndex,r.altInput.type="text",r.input.setAttribute("type","hidden"),!r.config.static&&r.input.parentNode&&r.input.parentNode.insertBefore(r.altInput,r.input.nextSibling)),r.config.allowInput||r._input.setAttribute("readonly","readonly"),Pt()}function Pt(){r._positionElement=r.config.positionElement||r._input}function qe(){var ce=r.config.enableTime?r.config.noCalendar?"time":"datetime-local":"date";r.mobileInput=hn("input",r.input.className+" flatpickr-mobile"),r.mobileInput.tabIndex=1,r.mobileInput.type=ce,r.mobileInput.disabled=r.input.disabled,r.mobileInput.required=r.input.required,r.mobileInput.placeholder=r.input.placeholder,r.mobileFormatStr=ce==="datetime-local"?"Y-m-d\\TH:i:S":ce==="date"?"Y-m-d":"H:i:S",r.selectedDates.length>0&&(r.mobileInput.defaultValue=r.mobileInput.value=r.formatDate(r.selectedDates[0],r.mobileFormatStr)),r.config.minDate&&(r.mobileInput.min=r.formatDate(r.config.minDate,"Y-m-d")),r.config.maxDate&&(r.mobileInput.max=r.formatDate(r.config.maxDate,"Y-m-d")),r.input.getAttribute("step")&&(r.mobileInput.step=String(r.input.getAttribute("step"))),r.input.type="hidden",r.altInput!==void 0&&(r.altInput.type="hidden");try{r.input.parentNode&&r.input.parentNode.insertBefore(r.mobileInput,r.input.nextSibling)}catch{}m(r.mobileInput,"change",function(he){r.setDate(Fs(he).value,!1,r.mobileFormatStr),vt("onChange"),vt("onClose")})}function Et(ce){if(r.isOpen===!0)return r.close();r.open(ce)}function vt(ce,he){if(r.config!==void 0){var je=r.config[ce];if(je!==void 0&&je.length>0)for(var xe=0;je[xe]&&xe<je.length;xe++)je[xe](r.selectedDates,r.input.value,r,he);ce==="onChange"&&(r.input.dispatchEvent(Ft("change")),r.input.dispatchEvent(Ft("input")))}}function Ft(ce){var he=document.createEvent("Event");return he.initEvent(ce,!0,!0),he}function Ce(ce){for(var he=0;he<r.selectedDates.length;he++){var je=r.selectedDates[he];if(je instanceof Date&&Ds(je,ce)===0)return""+he}return!1}function lt(ce){return r.config.mode!=="range"||r.selectedDates.length<2?!1:Ds(ce,r.selectedDates[0])>=0&&Ds(ce,r.selectedDates[1])<=0}function Xe(){r.config.noCalendar||r.isMobile||!r.monthNav||(r.yearElements.forEach(function(ce,he){var je=new Date(r.currentYear,r.currentMonth,1);je.setMonth(r.currentMonth+he),r.config.showMonths>1||r.config.monthSelectorType==="static"?r.monthElements[he].textContent=p2(je.getMonth(),r.config.shorthandCurrentMonth,r.l10n)+" ":r.monthsDropdownContainer.value=je.getMonth().toString(),ce.value=je.getFullYear().toString()}),r._hidePrevMonthArrow=r.config.minDate!==void 0&&(r.currentYear===r.config.minDate.getFullYear()?r.currentMonth<=r.config.minDate.getMonth():r.currentYear<r.config.minDate.getFullYear()),r._hideNextMonthArrow=r.config.maxDate!==void 0&&(r.currentYear===r.config.maxDate.getFullYear()?r.currentMonth+1>r.config.maxDate.getMonth():r.currentYear>r.config.maxDate.getFullYear()))}function Be(ce){var he=ce||(r.config.altInput?r.config.altFormat:r.config.dateFormat);return r.selectedDates.map(function(je){return r.formatDate(je,he)}).filter(function(je,xe,Re){return r.config.mode!=="range"||r.config.enableTime||Re.indexOf(je)===xe}).join(r.config.mode!=="range"?r.config.conjunction:r.l10n.rangeSeparator)}function ct(ce){ce===void 0&&(ce=!0),r.mobileInput!==void 0&&r.mobileFormatStr&&(r.mobileInput.value=r.latestSelectedDateObj!==void 0?r.formatDate(r.latestSelectedDateObj,r.mobileFormatStr):""),r.input.value=Be(r.config.dateFormat),r.altInput!==void 0&&(r.altInput.value=Be(r.config.altFormat)),ce!==!1&&vt("onValueUpdate")}function Tt(ce){var he=Fs(ce),je=r.prevMonthNav.contains(he),xe=r.nextMonthNav.contains(he);je||xe?D(je?-1:1):r.yearElements.indexOf(he)>=0?he.select():he.classList.contains("arrowUp")?r.changeYear(r.currentYear+1):he.classList.contains("arrowDown")&&r.changeYear(r.currentYear-1)}function We(ce){ce.preventDefault();var he=ce.type==="keydown",je=Fs(ce),xe=je;r.amPM!==void 0&&je===r.amPM&&(r.amPM.textContent=r.l10n.amPM[Al(r.amPM.textContent===r.l10n.amPM[0])]);var Re=parseFloat(xe.getAttribute("min")),ze=parseFloat(xe.getAttribute("max")),Le=parseFloat(xe.getAttribute("step")),Qe=parseInt(xe.value,10),mt=ce.delta||(he?ce.which===38?1:-1:0),ft=Qe+Le*mt;if(typeof xe.value<"u"&&xe.value.length===2){var It=xe===r.hourElement,Bt=xe===r.minuteElement;ft<Re?(ft=ze+ft+Al(!It)+(Al(It)&&Al(!r.amPM)),Bt&&j(void 0,-1,r.hourElement)):ft>ze&&(ft=xe===r.hourElement?ft-ze-Al(!r.amPM):Re,Bt&&j(void 0,1,r.hourElement)),r.amPM&&It&&(Le===1?ft+Qe===23:Math.abs(ft-Qe)>Le)&&(r.amPM.textContent=r.l10n.amPM[Al(r.amPM.textContent===r.l10n.amPM[0])]),xe.value=ls(ft)}}return o(),r}function gm(e,t){for(var r=Array.prototype.slice.call(e).filter(function(s){return s instanceof HTMLElement}),n=[],o=0;o<r.length;o++){var a=r[o];try{if(a.getAttribute("data-fp-omit")!==null)continue;a._flatpickr!==void 0&&(a._flatpickr.destroy(),a._flatpickr=void 0),a._flatpickr=dle(a,t||{}),n.push(a._flatpickr)}catch(s){console.error(s)}}return n.length===1?n[0]:n}typeof HTMLElement<"u"&&typeof HTMLCollection<"u"&&typeof NodeList<"u"&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return gm(this,e)},HTMLElement.prototype.flatpickr=function(e){return gm([this],e)});var to=function(e,t){return typeof e=="string"?gm(window.document.querySelectorAll(e),t):e instanceof Node?gm([e],t):gm(e,t)};to.defaultConfig={};to.l10ns={en:va({},Ex),default:va({},Ex)};to.localize=function(e){to.l10ns.default=va(va({},to.l10ns.default),e)};to.setDefaults=function(e){to.defaultConfig=va(va({},to.defaultConfig),e)};to.parseDate=W3({});to.formatDate=uH({});to.compareDates=Ds;typeof jQuery<"u"&&typeof jQuery.fn<"u"&&(jQuery.fn.flatpickr=function(e){return gm(this,e)});Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof e=="string"?parseInt(e,10):e))};typeof window<"u"&&(window.flatpickr=to);function Z0(e){return String(e).padStart(2,"0")}function sR(e){if(!e)return"";const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":`${t.getFullYear()}-${Z0(t.getMonth()+1)}-${Z0(t.getDate())}T${Z0(t.getHours())}:${Z0(t.getMinutes())}`}function lR(e){if(!e.trim())return;const t=new Date(e);return Number.isNaN(t.getTime())?void 0:t}function Pf({value:e,onChange:t,style:r,disabled:n,placeholder:o="Select date & time…",hasError:a}){const s=S.useRef(null),l=S.useRef(null);return S.useEffect(()=>{const c=s.current;if(!c)return;const u=to(c,{enableTime:!0,time_24hr:!0,dateFormat:"Y-m-d H:i",allowInput:!0,defaultDate:lR(e),onChange:d=>{const f=d[0];t(f?sR(f):"")}});return l.current=u,()=>{u.destroy(),l.current=null}},[]),S.useEffect(()=>{const c=l.current;if(!c)return;const u=c.selectedDates[0],d=u?sR(u):"";if(e===d)return;const f=lR(e);f?c.setDate(f,!1):c.clear(!1)},[e]),S.useEffect(()=>{const c=l.current;if(!c)return;const u=c.input;u.disabled=!!n,c.set("clickOpens",!n)},[n]),i.jsx("input",{ref:s,type:"text",placeholder:o,readOnly:!1,autoComplete:"off",style:{...r,...a?{borderColor:"var(--destructive)"}:{}}})}const Zu={width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"},fle={fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px",display:"block"},h2={fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px",lineHeight:"1.45"},ple=i.jsx("span",{style:{color:"var(--destructive)",marginLeft:"2px"},children:"*"}),hle=["always_live","always_sched","manual","quiz_master"],gle=[{value:"",label:"-- Select Display Mode --"},{value:"always_live",label:"Always Visible and Live"},{value:"always_sched",label:"Always Visible and Scheduled Live"},{value:"quiz_master",label:"Quiz Master mode (1 question at a time manually)"},{value:"manual",label:"Not Visible and Manual Live"}],q3=["-- Select Status --","Active","Draft"];function qT(){return{title:"",description:"",status:q3[0],displayMode:"",isLive:"No",scheduledStart:"",scheduledEnd:"",timeRestricted:"No",timeLimit:0,showResults:"No",multipleAttempts:"No",rewardQuizPollSubmitted:"",rewardQuizCorrectPerQuestion:"",rewardPollParticipation:""}}function g2(e){if(!e)return"";const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const r=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function m2(e){if(!(e!=null&&e.trim()))return;const t=new Date(e).getTime();if(!Number.isNaN(t))return new Date(t).toISOString()}function cR(){const e=new Date;e.setMinutes(0,0,0);const t=new Date(e.getTime()+7200*1e3);return{start:g2(e.toISOString()),end:g2(t.toISOString())}}function mle(e){return hle.includes(e)}function vle(e,t){const r=e.settings||{},n=r.rewardRules&&typeof r.rewardRules=="object"?r.rewardRules:{};let o=typeof r.displayMode=="string"?r.displayMode:"";(!o||!mle(o))&&(r.startTime&&r.endTime?o="always_sched":o="always_live");const a=o==="always_sched",s=typeof r.status=="string"?r.status:"",l=typeof r.isLive=="boolean"?r.isLive:r.isActive===!0,c=s==="draft"||!s&&typeof r.isLive!="boolean"&&r.isActive===!1;return{form:{title:e.title||"",description:e.description||"",status:c?"Draft":"Active",displayMode:o,isLive:l?"Yes":"No",scheduledStart:a?g2(r.startTime):"",scheduledEnd:a?g2(r.endTime):"",timeRestricted:r.timeRestricted===!0?"Yes":"No",timeLimit:typeof r.timeLimit=="number"&&Number.isFinite(r.timeLimit)?r.timeLimit:0,showResults:r.showResults!==!1?"Yes":"No",multipleAttempts:r.allowMultipleAttempts?"Yes":"No",rewardQuizPollSubmitted:n.quizPollSubmitted!=null&&n.quizPollSubmitted!==""?String(n.quizPollSubmitted):"",rewardQuizCorrectPerQuestion:n.quizCorrectPerQuestion!=null&&n.quizCorrectPerQuestion!==""?String(n.quizCorrectPerQuestion):"",rewardPollParticipation:n.pollParticipation!=null&&n.pollParticipation!==""?String(n.pollParticipation):""},questions:t}}function Fg(e){const t=String(e??"").trim();if(t==="")return;const r=Number(t);return Number.isFinite(r)?r:void 0}function gS(e,t){const r=e.displayMode==="always_sched",n={status:e.status==="Draft"?"draft":"active",isLive:e.isLive==="Yes",displayMode:e.displayMode||"always_live",startTime:r?m2(e.scheduledStart)??null:null,endTime:r?m2(e.scheduledEnd)??null:null,showResults:e.showResults==="Yes",allowMultipleAttempts:e.multipleAttempts==="Yes",timeRestricted:e.timeRestricted==="Yes",timeLimit:Math.max(0,Math.floor(Number(e.timeLimit))||0)},o={};if(t==="quiz"){const a=Fg(e.rewardQuizPollSubmitted),s=Fg(e.rewardQuizCorrectPerQuestion);a!==void 0&&(o.quizPollSubmitted=a),s!==void 0&&(o.quizCorrectPerQuestion=s)}else if(t==="poll"){const a=Fg(e.rewardPollParticipation);a!==void 0&&(o.pollParticipation=a)}else{const a=Fg(e.rewardQuizPollSubmitted),s=Fg(e.rewardQuizCorrectPerQuestion),l=Fg(e.rewardPollParticipation);a!==void 0&&(o.quizPollSubmitted=a),s!==void 0&&(o.quizCorrectPerQuestion=s),l!==void 0&&(o.pollParticipation=l)}return Object.keys(o).length&&(n.rewardRules=o),n}function as({label:e,hint:t,required:r,error:n,children:o}){return i.jsxs("div",{children:[i.jsxs("label",{style:fle,children:[e,r&&ple]}),o,t&&!n&&i.jsx("p",{style:h2,children:t}),n&&i.jsx("p",{style:{...h2,color:"var(--destructive)"},children:n})]})}function zg({value:e,onChange:t,options:r,error:n}){const o=r.map(a=>typeof a=="string"?{value:a,label:a}:a);return i.jsxs("div",{style:{position:"relative"},children:[i.jsx("select",{value:e,onChange:a=>t(a.target.value),style:{...Zu,appearance:"none",paddingRight:"28px",cursor:"pointer",borderColor:n?"var(--destructive)":"var(--border)"},children:o.map(a=>i.jsx("option",{value:a.value,children:a.label},a.value))}),i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",pointerEvents:"none",color:"var(--muted)"},fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("path",{d:"M2 4l4 4 4-4"})})]})}function yle({q:e,index:t,onEdit:r,onDelete:n,showPerQuestionTimeLimit:o}){const[a,s]=S.useState(!1);return i.jsxs("div",{onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"12px 14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:a?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx("span",{style:{width:"22px",height:"22px",borderRadius:"50%",background:"var(--accent)",color:"var(--primary)",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginTop:"1px"},children:t+1}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"flex-start"},children:[e.imageUrl&&i.jsx("img",{src:e.imageUrl,alt:"",style:{width:"44px",height:"44px",objectFit:"cover",borderRadius:"6px",border:"1px solid var(--border)",flexShrink:0}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",lineHeight:"1.4",marginBottom:"4px",flex:1,minWidth:0},children:e.text})]}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",padding:"1px 7px",borderRadius:"3px",background:"var(--accent)",color:"var(--accent-foreground)"},children:e.type}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.options.length," options"]}),e.options.some(l=>l.imageUrl)&&i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"with images"}),o&&typeof e.timeLimit=="number"&&e.timeLimit>0?i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.timeLimit,"s limit"]}):null,i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"#15803d"},children:[e.options.filter(l=>l.isCorrect).length," correct"]})]})]}),i.jsxs("div",{style:{display:"flex",gap:"4px",opacity:a?1:0,transition:"opacity 0.15s",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:r,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},onMouseEnter:l=>{l.currentTarget.style.borderColor="var(--primary)",l.currentTarget.style.color="var(--primary)"},onMouseLeave:l=>{l.currentTarget.style.borderColor="var(--border)",l.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:12})}),i.jsx("button",{type:"button",onClick:n,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},onMouseEnter:l=>{l.currentTarget.style.borderColor="var(--destructive)",l.currentTarget.style.color="var(--destructive)"},onMouseLeave:l=>{l.currentTarget.style.borderColor="var(--border)",l.currentTarget.style.color="var(--muted)"},children:i.jsx(Xr,{size:12})})]})]})}function Ax({kind:e,initial:t,onClose:r,onSave:n,eventId:o,variant:a="modal"}){const[s,l]=S.useState("settings"),[c,u]=S.useState((t==null?void 0:t.questions)??[]),[d,f]=S.useState(!1),[h,p]=S.useState(null),[v,m]=S.useState({}),[b,x]=S.useState((t==null?void 0:t.form)??qT()),w=e==="poll"?"Poll":"Quiz",k=ile(b),j=(R,F)=>{x(M=>({...M,[R]:F})),v[R]&&m(M=>({...M,[R]:""}))},_=()=>{const R={};if(b.title.trim()||(R.title=`${w} title is required.`),b.status===q3[0]&&(R.status="Please select a status."),b.displayMode||(R.displayMode="Please select a display mode."),b.displayMode==="always_sched"){b.scheduledStart.trim()||(R.scheduledStart="Start date & time is required."),b.scheduledEnd.trim()||(R.scheduledEnd="End date & time is required.");const F=new Date(b.scheduledStart).getTime(),M=new Date(b.scheduledEnd).getTime();Number.isFinite(F)&&Number.isFinite(M)&&M<=F&&(R.scheduledEnd="End must be after start.")}return m(R),Object.keys(R).length===0},T=()=>{if(c.length===0){m(R=>({...R,questions:"Add at least one question."}));return}if(k&&c.some(F=>!F.timeLimit||F.timeLimit<=0)){m(F=>({...F,questions:"Each question needs a time limit (seconds) in Quiz Master mode with Time Restricted enabled."}));return}n==null||n({form:b,questions:c})},A=R=>u(F=>[...F,R]),P=R=>u(F=>F.filter(M=>M.id!==R)),N=R=>u(F=>F.map(M=>M.id===R.id?R:M)),O=[{value:"No",label:"No"},{value:"Yes",label:"Yes"}],I=i.jsxs("div",{style:{background:"var(--card)",borderRadius:a==="panel"?0:"var(--radius-card)",width:"100%",maxWidth:a==="panel"?"none":"720px",height:a==="panel"?"100%":void 0,maxHeight:a==="panel"?"100%":"92vh",display:"flex",flexDirection:"column",boxShadow:a==="panel"?"none":"var(--elevation-sm)",minHeight:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"2px"},children:t?`Edit ${w}`:`Add ${w}`}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Session quiz / poll"})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s==="questions"&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",onClick:T,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",background:"#16a34a",border:"none",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:["Save ",w]}),i.jsx("button",{type:"button",onClick:()=>l("settings"),style:{padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Back"})]}),s==="settings"&&i.jsx("button",{type:"button",onClick:()=>{_()&&l("questions")},style:{padding:"7px 16px",borderRadius:"var(--radius-button)",background:"#16a34a",border:"none",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Next →"}),i.jsx("button",{type:"button",onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",marginLeft:"4px"},children:i.jsx(Gt,{size:16})})]})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["settings","questions"].map((R,F)=>i.jsxs("button",{type:"button",onClick:()=>{R==="questions"?_()&&l("questions"):l("settings")},style:{padding:"10px 0",marginRight:"24px",background:"none",border:"none",borderBottom:`2px solid ${s===R?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:s===R?"var(--font-weight-medium)":"var(--font-weight-normal)",color:s===R?"var(--primary)":"var(--muted)",display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx("span",{style:{width:"18px",height:"18px",borderRadius:"50%",background:s===R?"var(--primary)":F===1&&c.length>0?"#16a34a":"var(--border)",color:"#fff",fontSize:"10px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:F===1&&c.length>0?c.length:F+1}),R==="settings"?"Settings":"Questions"]},R))}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:[s==="settings"&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[i.jsx(as,{label:`${w} Title`,required:!0,error:v.title,children:i.jsx("input",{value:b.title,onChange:R=>j("title",R.target.value),placeholder:`Enter ${w.toLowerCase()} title`,style:{...Zu,borderColor:v.title?"var(--destructive)":"var(--border)"},onFocus:R=>{R.currentTarget.style.borderColor="var(--ring)"},onBlur:R=>{R.currentTarget.style.borderColor=v.title?"var(--destructive)":"var(--border)"}})}),i.jsx(as,{label:"Description",children:i.jsx("textarea",{value:b.description,onChange:R=>j("description",R.target.value),rows:3,placeholder:"Enter description",style:{...Zu,height:"auto",padding:"10px",resize:"vertical",lineHeight:"1.5"},onFocus:R=>{R.currentTarget.style.borderColor="var(--ring)"},onBlur:R=>{R.currentTarget.style.borderColor="var(--border)"}})}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Status",required:!0,error:v.status,children:i.jsx(zg,{value:b.status,onChange:R=>j("status",R),options:q3.map(R=>({value:R,label:R})),error:v.status})}),i.jsx(as,{label:"Is Live",hint:'Manually set if this item is currently live. For "Not Visible and Manual Live", set to Yes when you want it live.',children:i.jsx(zg,{value:b.isLive,onChange:R=>j("isLive",R),options:O})})]}),i.jsx(as,{label:"Display Mode",required:!0,hint:"Always Visible and Live: visible and live immediately. Always Visible and Scheduled Live: visible; live window uses start/end below. Quiz Master: one question at a time, advanced manually. Not Visible and Manual Live: hidden until you mark live.",error:v.displayMode,children:i.jsx(zg,{value:b.displayMode,onChange:R=>j("displayMode",R),options:gle,error:v.displayMode})}),b.displayMode==="always_sched"&&i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Start date & time",required:!0,error:v.scheduledStart,children:i.jsx(Pf,{value:b.scheduledStart,onChange:R=>j("scheduledStart",R),style:Zu,hasError:!!v.scheduledStart})}),i.jsx(as,{label:"End date & time",required:!0,error:v.scheduledEnd,children:i.jsx(Pf,{value:b.scheduledEnd,onChange:R=>j("scheduledEnd",R),style:Zu,hasError:!!v.scheduledEnd})})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:k?"1fr":"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Time Restricted",required:!0,hint:k?"When enabled, set a time limit on each question in the Questions step (Quiz Master mode).":"If enabled, enforce a time limit when the user takes the quiz/poll (synced to the database and live clients).",children:i.jsx(zg,{value:b.timeRestricted,onChange:R=>j("timeRestricted",R),options:O})}),k?null:i.jsx(as,{label:"Time Limit (seconds)",hint:"Only used if Time Restricted is Yes.",children:i.jsx("input",{type:"number",min:0,value:b.timeLimit,onChange:R=>j("timeLimit",Number(R.target.value)),style:Zu,onFocus:R=>{R.currentTarget.style.borderColor="var(--ring)"},onBlur:R=>{R.currentTarget.style.borderColor="var(--border)"}})})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Show Results After Submission",required:!0,hint:"Show results/score after submit.",children:i.jsx(zg,{value:b.showResults,onChange:R=>j("showResults",R),options:O})}),i.jsx(as,{label:"Allow Multiple Attempts",required:!0,children:i.jsx(zg,{value:b.multipleAttempts,onChange:R=>j("multipleAttempts",R),options:O})})]}),i.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"16px",marginTop:"4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-noto-sans)",marginBottom:"10px",color:"var(--foreground)"},children:"Loyalty points (optional overrides)"}),i.jsx("p",{style:{...h2,marginBottom:"12px"},children:"Leave blank to use session/event defaults. Enter 0 to disable this action for this activity only."}),e==="quiz"?i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[i.jsx(as,{label:"Points per quiz submission",hint:"When a visitor submits this quiz.",children:i.jsx("input",{type:"number",min:0,value:b.rewardQuizPollSubmitted,onChange:R=>j("rewardQuizPollSubmitted",R.target.value),placeholder:"Inherit",style:Zu})}),i.jsx(as,{label:"Points per correct question",hint:"Loyalty only; separate from scoring points per question.",children:i.jsx("input",{type:"number",min:0,value:b.rewardQuizCorrectPerQuestion,onChange:R=>j("rewardQuizCorrectPerQuestion",R.target.value),placeholder:"Inherit",style:Zu})})]}):i.jsx("div",{style:{maxWidth:"360px"},children:i.jsx(as,{label:"Points for poll/survey participation",hint:"When a visitor submits this poll.",children:i.jsx("input",{type:"number",min:0,value:b.rewardPollParticipation,onChange:R=>j("rewardPollParticipation",R.target.value),placeholder:"Inherit",style:Zu})})})]})]}),s==="questions"&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c.length," question",c.length!==1?"s":""," added"]}),i.jsxs("button",{type:"button",onClick:()=>f(!0),style:{display:"flex",alignItems:"center",gap:"5px",padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add Question"]})]}),v.questions&&i.jsx("p",{style:{...h2,color:"var(--destructive)"},children:v.questions}),c.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"48px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(tS,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No questions yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"16px"},children:"Add at least one question."}),i.jsxs("button",{type:"button",onClick:()=>f(!0),style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add First Question"]})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[c.map((R,F)=>i.jsx(yle,{q:R,index:F,onEdit:()=>p(R),onDelete:()=>P(R.id),showPerQuestionTimeLimit:k},R.id)),i.jsxs("button",{type:"button",onClick:()=>f(!0),style:{display:"flex",alignItems:"center",gap:"5px",padding:"10px",borderRadius:"var(--radius-card)",border:"2px dashed var(--border)",background:"transparent",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",justifyContent:"center",transition:"border-color 0.12s, color 0.12s"},onMouseEnter:R=>{R.currentTarget.style.borderColor="var(--primary)",R.currentTarget.style.color="var(--primary)"},onMouseLeave:R=>{R.currentTarget.style.borderColor="var(--border)",R.currentTarget.style.color="var(--muted)"},children:[i.jsx(gr,{size:13})," Add another question"]})]})]})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("div",{children:s==="questions"&&i.jsx("button",{type:"button",onClick:()=>l("settings"),style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"← Back"})}),i.jsxs("div",{style:{display:"flex",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:r,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),s==="settings"?i.jsx("button",{type:"button",onClick:()=>{_()&&l("questions")},style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Next: Questions →"}):i.jsxs("button",{type:"button",onClick:T,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:["Save ",w]})]})]})]});return i.jsxs(i.Fragment,{children:[a==="panel"?I:i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.28)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",backdropFilter:"blur(2px)"},children:I}),d&&i.jsx(iR,{eventId:o,showPerQuestionTimeLimit:k,onClose:()=>f(!1),onSave:A}),h&&i.jsx(iR,{eventId:o,initial:h,showPerQuestionTimeLimit:k,onClose:()=>p(null),onSave:N})]})}const $3="Registration Form";async function xle(e,t){var a;const n=(await Mo.listForEvent(e)).filter(s=>s.type==="registration"),o=t==null?void 0:t.trim();if(o){const s=n.find(l=>l._id===o);if(s)return s;try{const l=await Mo.get(o);if(l.type==="registration"){const c=((a=n.find(u=>u._id===l._id))==null?void 0:a.submissionCount)??0;return{...l,submissionCount:c}}}catch{}}return n[0]??null}function ble(e){var t;return((t=e==null?void 0:e.name)==null?void 0:t.trim())||$3}const U3="Feedback form";async function wle(e){return(await Mo.listForEvent(e)).filter(n=>n.type==="feedback"||n.type==="survey")[0]??null}function Sle(e){var t;return((t=e==null?void 0:e.name)==null?void 0:t.trim())||U3}function Np({icon:e,title:t,description:r,meta:n,actions:o}){const s=Si()==="mobile";return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:s?"14px":"16px",display:"flex",flexDirection:"column",gap:"12px",minHeight:"auto"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px",flex:1},children:[i.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"var(--radius-button)",background:"color-mix(in srgb, var(--primary) 12%, transparent)",color:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),i.jsxs("div",{style:{minWidth:0,flex:1},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:t}),r?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",lineHeight:1.4},children:r}):null,n?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0"},children:n}):null]})]}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"nowrap"},children:o})]})}function bl(e=!1){return{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"6px",flex:"1 1 0",minWidth:0,padding:"6px 8px",borderRadius:"var(--radius-button)",border:e?"none":"1px solid var(--border)",background:e?"var(--primary)":"var(--card)",color:e?"var(--primary-foreground)":"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"}}function jle({formName:e,onClose:t}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"default-reg-responses-title",style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.2)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,padding:"16px 18px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 4px"},children:"Submissions"}),i.jsx("h2",{id:"default-reg-responses-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:e})]}),i.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{flexShrink:0,width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(Gt,{size:18})})]}),i.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 24px",textAlign:"center"},children:i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:"No responses yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,maxWidth:"360px",lineHeight:1.5},children:"Using the default registration form (first name, last name, email). Save the form via Edit to customize it and start collecting responses."})]})})]})]})}function kle({formName:e,onClose:t}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"default-feedback-responses-title",style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.2)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,padding:"16px 18px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 4px"},children:"Submissions"}),i.jsx("h2",{id:"default-feedback-responses-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,lineHeight:1.3},children:e})]}),i.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{flexShrink:0,width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(Gt,{size:18})})]}),i.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 24px",textAlign:"center"},children:i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:"No responses yet"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,maxWidth:"360px",lineHeight:1.5},children:"Save a feedback form via Edit to start collecting responses from attendees."})]})})]})]})}function _le(){const{selectedEventId:e,setActiveNav:t,setPermissionsOpenAddOnce:r}=Li(),n=Si(),s=n==="mobile"?"1fr":n==="tablet"?"repeat(2, minmax(0, 1fr))":"repeat(auto-fill, minmax(240px, 1fr))",[l,c]=S.useState(),[u,d]=S.useState(null),[f,h]=S.useState(!1),[p,v]=S.useState(!1),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState(!1),[_,T]=S.useState(!1),[A,P]=S.useState(!1),[N,O]=S.useState({polls:0,quizzes:0}),[C,I]=S.useState(!1),[R,F]=S.useState(!1),[M,Y]=S.useState(!1),[X,$]=S.useState({members:0,invites:0}),[ee,V]=S.useState(!1),[D,z]=S.useState(0),[q,G]=S.useState(!1),[U,Q]=S.useState(null),[K,re]=S.useState(!1),[H,ie]=S.useState(!1),[de,le]=S.useState(null),[ke,ve]=S.useState(0),[se,be]=S.useState(!1),[De,ae]=S.useState(0),[ue,Me]=S.useState(!1),[Se,Pe]=S.useState(!1);S.useEffect(()=>{if(!e){c(void 0),Q(null);return}let je=!1;return Lr.get(e).then(xe=>{var Re,ze,Le;je||(c((ze=(Re=xe.data)==null?void 0:Re.website)==null?void 0:ze.registrationFormId),Q(((Le=xe.data)==null?void 0:Le.name)??null))}),()=>{je=!0}},[e]);const Ee=S.useCallback(async()=>{if(!e){d(null),h(!1);return}h(!0);try{const je=await xle(e,l);d(je)}catch{d(null)}finally{h(!1)}},[e,l]);S.useEffect(()=>{Ee()},[Ee]);const Ae=S.useCallback(async()=>{if(!e){w(null),j(!1);return}j(!0);try{const je=await wle(e);w(je)}catch{w(null)}finally{j(!1)}},[e]);S.useEffect(()=>{Ae()},[Ae]);const Ye=S.useCallback(async()=>{var je;if(!e){O({polls:0,quizzes:0}),I(!1);return}I(!0);try{const Re=((je=(await Pi.listByEvent(e)).data)==null?void 0:je.quizPolls)??[];O({polls:Re.filter(ze=>ze.type==="poll").length,quizzes:Re.filter(ze=>ze.type==="quiz").length})}catch{O({polls:0,quizzes:0})}finally{I(!1)}},[e]);S.useEffect(()=>{Ye()},[Ye]);const rt=S.useCallback(async()=>{var je,xe;if(!e){$({members:0,invites:0}),V(!1);return}V(!0);try{const Re=await wa.listStaff(e);Re.data?$({members:((je=Re.data.members)==null?void 0:je.length)??0,invites:((xe=Re.data.invites)==null?void 0:xe.length)??0}):$({members:0,invites:0})}catch{$({members:0,invites:0})}finally{V(!1)}},[e]);S.useEffect(()=>{rt()},[rt]);const He=S.useCallback(async()=>{var je,xe;if(!e){z(0),G(!1);return}G(!0);try{const Re=await wx.list({event:e,limit:100});z(((xe=(je=Re.data)==null?void 0:je.batches)==null?void 0:xe.length)??0)}catch{z(0)}finally{G(!1)}},[e]);S.useEffect(()=>{He()},[He]);const xt=S.useCallback(async()=>{if(!e){ve(0),be(!1);return}be(!0);try{const je=await Ky.list(e);ve(je.length)}catch{ve(0)}finally{be(!1)}},[e]);S.useEffect(()=>{xt()},[xt]);const st=S.useCallback(async()=>{var je;if(!e){ae(0),Me(!1);return}Me(!0);try{const xe=await Lr.get(e);ae(Vae((je=xe.data)==null?void 0:je.rewardRules))}catch{ae(0)}finally{Me(!1)}},[e]);S.useEffect(()=>{st()},[st]);const Te=()=>{ie(!1),le(null),He()},et=()=>{le(null),ie(!0)},Pt=je=>{re(!1),le(je),ie(!0)},qe=()=>{v(!1),Ee()},Et=()=>{T(!1),Ae()},vt=ble(u),Ft=Sle(x),Ce=e?f?"Loading…":`${((u==null?void 0:u.submissionCount)??0).toLocaleString()} response${((u==null?void 0:u.submissionCount)??0)===1?"":"s"}`:"Select an event to view responses",lt=e?k?"Loading…":`${((x==null?void 0:x.submissionCount)??0).toLocaleString()} response${((x==null?void 0:x.submissionCount)??0)===1?"":"s"}`:"Select an event to view responses",Xe=!e,Be=e?C?"Loading…":`${N.polls} poll${N.polls===1?"":"s"} · ${N.quizzes} quiz${N.quizzes===1?"":"zes"}`:"Select an event to create polls and quizzes",ct=e?ee?"Loading…":`${X.members} member${X.members===1?"":"s"} · ${X.invites} pending invite${X.invites===1?"":"s"}`:"Select an event to manage team access",Tt=e?q?"Loading…":`${D} badge${D===1?"":"s"}`:"Select an event to manage badges",We=e?se?"Loading…":`${ke} ticket type${ke===1?"":"s"}`:"Select an event to configure tickets",ce=e?ue?"Loading…":De===0?"No rules configured":`${De} rule${De===1?"":"s"} configured`:"Select an event to configure reward rules",he=async(je,xe)=>{var mt,ft;if(!e)return;const ze=(ft=(mt=(await ta.list(e)).data)==null?void 0:mt.sessions)==null?void 0:ft[0],Le={...ze!=null&&ze._id?{session:ze._id}:{},title:xe.form.title,type:je,description:xe.form.description||void 0,questions:xe.questions.map(It=>hS(It,je)),settings:gS(xe.form,je)};(await Pi.create(e,Le)).error||(je==="poll"?F(!1):Y(!1),Ye())};return i.jsxs(i.Fragment,{children:[i.jsxs("section",{"aria-label":"Event modules",style:{display:"grid",gridTemplateColumns:s,gap:"12px"},children:[i.jsx(Np,{icon:i.jsx(Sh,{size:18}),title:$3,meta:Ce,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>v(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"Edit"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>b(!0),children:"Responses"})]})}),i.jsx(Np,{icon:i.jsx(dd,{size:18}),title:U3,meta:lt,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>T(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"Edit"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>P(!0),children:"View Responses"})]})}),i.jsx(Np,{icon:i.jsx(tne,{size:18}),title:"Users & Permissions",meta:ct,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>t("permissions"),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"View"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>{r(!0),t("permissions")},children:"Add New"})]})}),i.jsx(Np,{icon:i.jsx(Ad,{size:18}),title:"Activities",meta:Be,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>F(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"Poll"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>Y(!0),children:"Quiz"})]})}),i.jsx(Np,{icon:i.jsx(Cx,{size:18}),title:"Tag & Badge Configuration",meta:Tt,actions:i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:Xe,style:{...bl(),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>re(!0),onMouseEnter:je=>{Xe||(je.currentTarget.style.borderColor="var(--primary)",je.currentTarget.style.color="var(--primary)")},onMouseLeave:je=>{Xe||(je.currentTarget.style.borderColor="var(--border)",je.currentTarget.style.color="var(--card-foreground)")},children:"View Badges"}),i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:et,children:"Add Badge"})]})}),i.jsx(Np,{icon:i.jsx(A$,{size:18}),title:"Ticket configuration",meta:We,actions:i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>t("ticketing"),children:"View"})}),i.jsx(Np,{icon:i.jsx(nu,{size:18}),title:"Reward Points Config",meta:ce,actions:i.jsx("button",{type:"button",disabled:Xe,style:{...bl(!0),opacity:Xe?.55:1,cursor:Xe?"not-allowed":"pointer"},onClick:()=>Pe(!0),children:"View"})})]}),p&&e?i.jsx(tx,{mode:"registration",eventId:e,formId:u==null?void 0:u._id,defaultFormName:u?void 0:$3,onClose:()=>v(!1),onSuccess:qe}):null,m&&e&&(u!=null&&u._id)?i.jsx(D3,{formId:u._id,formName:vt,onClose:()=>b(!1)}):null,m&&e&&!(u!=null&&u._id)?i.jsx(jle,{formName:vt,onClose:()=>b(!1)}):null,_&&e?i.jsx(tx,{mode:"feedback",eventId:e,formId:x==null?void 0:x._id,defaultFormName:x?void 0:U3,onClose:()=>T(!1),onSuccess:Et}):null,A&&e&&(x!=null&&x._id)?i.jsx(D3,{formId:x._id,formName:Ft,onClose:()=>P(!1)}):null,A&&e&&!(x!=null&&x._id)?i.jsx(kle,{formName:Ft,onClose:()=>P(!1)}):null,R?i.jsx(Ax,{kind:"poll",eventId:e??void 0,onClose:()=>F(!1),onSave:je=>void he("poll",je)}):null,M?i.jsx(Ax,{kind:"quiz",eventId:e??void 0,onClose:()=>Y(!1),onSave:je=>void he("quiz",je)}):null,K&&e?i.jsx(tle,{eventId:e,eventName:U??void 0,onClose:()=>re(!1),onAddBadge:()=>{re(!1),et()},onDuplicateBadge:Pt}):null,H&&e?i.jsx(lH,{initialEventId:e,duplicateFromBatchId:de,onClose:()=>{ie(!1),le(null)},onSuccess:Te},de??"create"):null,Se&&e?i.jsx(Kae,{eventId:e,onClose:()=>Pe(!1),onSaved:()=>void st()}):null]})}function J0(e){return e==null||Number.isNaN(e)?"—":e.toLocaleString()}function Cle({loading:e,participantCount:t,sessionCount:r,quizPollCount:n,pointsAwarded:o,statusCounts:a,upcomingSessionCount:s,pointsRedeemed:l}){const c=Si(),u=c==="mobile"?2:4,d=S.useMemo(()=>{if(e)return;const v=(a==null?void 0:a.checked_in)??0,m=(a==null?void 0:a.confirmed)??0;if(v)return`${v.toLocaleString()} checked in`;if(m)return`${m.toLocaleString()} confirmed`},[e,a]),f=!e&&s!=null&&s>0?`${s} upcoming`:void 0,h=!e&&l!=null&&l>0?`${l.toLocaleString()} redeemed`:void 0,p=[{icon:i.jsx(Ri,{size:15}),label:"Participants",value:e?"—":J0(t),trend:d,trendUp:!!(a!=null&&a.checked_in&&a.checked_in>0),accent:"var(--chart-1)"},{icon:i.jsx(y$,{size:15}),label:"Sessions",value:e?"—":J0(r),trend:f,trendUp:!1,accent:"var(--chart-3)"},{icon:i.jsx(Ad,{size:15}),label:"Quizzes & Polls",value:e?"—":J0(n),trend:void 0,trendUp:!1,accent:"var(--chart-4)"},{icon:i.jsx(nu,{size:15}),label:"Points Awarded",value:e?"—":J0(o),trend:h,trendUp:!1,accent:"var(--chart-2)"}];return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:c==="mobile"?"10px":"12px"},children:p.map((v,m)=>i.jsxs("div",{style:{background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"3px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:v.accent,borderRadius:"var(--radius-card)",padding:c==="mobile"?"14px 14px":"16px 20px",display:"flex",alignItems:"flex-start",gap:"12px"},children:[i.jsx("div",{style:{width:"30px",height:"30px",borderRadius:"var(--radius-button)",background:v.accent+"15",display:"flex",alignItems:"center",justifyContent:"center",color:v.accent,flexShrink:0,marginTop:"2px"},children:v.icon}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:c==="mobile"?"var(--text-xl)":"var(--text-2xl)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.1"},children:v.value}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"3px",lineHeight:"1.3"},children:v.label}),v.trend&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:v.trendUp?"#16a34a":"var(--muted)",marginTop:"6px",lineHeight:"1.2"},children:v.trend})]})]},m))})}var rk,uR;function vs(){if(uR)return rk;uR=1;var e=Array.isArray;return rk=e,rk}var nk,dR;function dH(){if(dR)return nk;dR=1;var e=typeof L0=="object"&&L0&&L0.Object===Object&&L0;return nk=e,nk}var ik,fR;function du(){if(fR)return ik;fR=1;var e=dH(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return ik=r,ik}var ok,pR;function Ib(){if(pR)return ok;pR=1;var e=du(),t=e.Symbol;return ok=t,ok}var ak,hR;function Ele(){if(hR)return ak;hR=1;var e=Ib(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;function a(s){var l=r.call(s,o),c=s[o];try{s[o]=void 0;var u=!0}catch{}var d=n.call(s);return u&&(l?s[o]=c:delete s[o]),d}return ak=a,ak}var sk,gR;function Ale(){if(gR)return sk;gR=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return sk=r,sk}var lk,mR;function Td(){if(mR)return lk;mR=1;var e=Ib(),t=Ele(),r=Ale(),n="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function s(l){return l==null?l===void 0?o:n:a&&a in Object(l)?t(l):r(l)}return lk=s,lk}var ck,vR;function Pd(){if(vR)return ck;vR=1;function e(t){return t!=null&&typeof t=="object"}return ck=e,ck}var uk,yR;function Cv(){if(yR)return uk;yR=1;var e=Td(),t=Pd(),r="[object Symbol]";function n(o){return typeof o=="symbol"||t(o)&&e(o)==r}return uk=n,uk}var dk,xR;function $T(){if(xR)return dk;xR=1;var e=vs(),t=Cv(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function o(a,s){if(e(a))return!1;var l=typeof a;return l=="number"||l=="symbol"||l=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||s!=null&&a in Object(s)}return dk=o,dk}var fk,bR;function Jf(){if(bR)return fk;bR=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return fk=e,fk}var pk,wR;function UT(){if(wR)return pk;wR=1;var e=Td(),t=Jf(),r="[object AsyncFunction]",n="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function s(l){if(!t(l))return!1;var c=e(l);return c==n||c==o||c==r||c==a}return pk=s,pk}var hk,SR;function Tle(){if(SR)return hk;SR=1;var e=du(),t=e["__core-js_shared__"];return hk=t,hk}var gk,jR;function Ple(){if(jR)return gk;jR=1;var e=Tle(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return gk=r,gk}var mk,kR;function fH(){if(kR)return mk;kR=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return mk=r,mk}var vk,_R;function Ile(){if(_R)return vk;_R=1;var e=UT(),t=Ple(),r=Jf(),n=fH(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(h){if(!r(h)||t(h))return!1;var p=e(h)?d:a;return p.test(n(h))}return vk=f,vk}var yk,CR;function Ole(){if(CR)return yk;CR=1;function e(t,r){return t==null?void 0:t[r]}return yk=e,yk}var xk,ER;function Vh(){if(ER)return xk;ER=1;var e=Ile(),t=Ole();function r(n,o){var a=t(n,o);return e(a)?a:void 0}return xk=r,xk}var bk,AR;function mS(){if(AR)return bk;AR=1;var e=Vh(),t=e(Object,"create");return bk=t,bk}var wk,TR;function Nle(){if(TR)return wk;TR=1;var e=mS();function t(){this.__data__=e?e(null):{},this.size=0}return wk=t,wk}var Sk,PR;function Rle(){if(PR)return Sk;PR=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Sk=e,Sk}var jk,IR;function Lle(){if(IR)return jk;IR=1;var e=mS(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function o(a){var s=this.__data__;if(e){var l=s[a];return l===t?void 0:l}return n.call(s,a)?s[a]:void 0}return jk=o,jk}var kk,OR;function Fle(){if(OR)return kk;OR=1;var e=mS(),t=Object.prototype,r=t.hasOwnProperty;function n(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return kk=n,kk}var _k,NR;function zle(){if(NR)return _k;NR=1;var e=mS(),t="__lodash_hash_undefined__";function r(n,o){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&o===void 0?t:o,this}return _k=r,_k}var Ck,RR;function Mle(){if(RR)return Ck;RR=1;var e=Nle(),t=Rle(),r=Lle(),n=Fle(),o=zle();function a(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Ck=a,Ck}var Ek,LR;function Dle(){if(LR)return Ek;LR=1;function e(){this.__data__=[],this.size=0}return Ek=e,Ek}var Ak,FR;function HT(){if(FR)return Ak;FR=1;function e(t,r){return t===r||t!==t&&r!==r}return Ak=e,Ak}var Tk,zR;function vS(){if(zR)return Tk;zR=1;var e=HT();function t(r,n){for(var o=r.length;o--;)if(e(r[o][0],n))return o;return-1}return Tk=t,Tk}var Pk,MR;function Ble(){if(MR)return Pk;MR=1;var e=vS(),t=Array.prototype,r=t.splice;function n(o){var a=this.__data__,s=e(a,o);if(s<0)return!1;var l=a.length-1;return s==l?a.pop():r.call(a,s,1),--this.size,!0}return Pk=n,Pk}var Ik,DR;function Wle(){if(DR)return Ik;DR=1;var e=vS();function t(r){var n=this.__data__,o=e(n,r);return o<0?void 0:n[o][1]}return Ik=t,Ik}var Ok,BR;function qle(){if(BR)return Ok;BR=1;var e=vS();function t(r){return e(this.__data__,r)>-1}return Ok=t,Ok}var Nk,WR;function $le(){if(WR)return Nk;WR=1;var e=vS();function t(r,n){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,n])):o[a][1]=n,this}return Nk=t,Nk}var Rk,qR;function yS(){if(qR)return Rk;qR=1;var e=Dle(),t=Ble(),r=Wle(),n=qle(),o=$le();function a(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Rk=a,Rk}var Lk,$R;function VT(){if($R)return Lk;$R=1;var e=Vh(),t=du(),r=e(t,"Map");return Lk=r,Lk}var Fk,UR;function Ule(){if(UR)return Fk;UR=1;var e=Mle(),t=yS(),r=VT();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Fk=n,Fk}var zk,HR;function Hle(){if(HR)return zk;HR=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return zk=e,zk}var Mk,VR;function xS(){if(VR)return Mk;VR=1;var e=Hle();function t(r,n){var o=r.__data__;return e(n)?o[typeof n=="string"?"string":"hash"]:o.map}return Mk=t,Mk}var Dk,YR;function Vle(){if(YR)return Dk;YR=1;var e=xS();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Dk=t,Dk}var Bk,GR;function Yle(){if(GR)return Bk;GR=1;var e=xS();function t(r){return e(this,r).get(r)}return Bk=t,Bk}var Wk,KR;function Gle(){if(KR)return Wk;KR=1;var e=xS();function t(r){return e(this,r).has(r)}return Wk=t,Wk}var qk,QR;function Kle(){if(QR)return qk;QR=1;var e=xS();function t(r,n){var o=e(this,r),a=o.size;return o.set(r,n),this.size+=o.size==a?0:1,this}return qk=t,qk}var $k,XR;function YT(){if(XR)return $k;XR=1;var e=Ule(),t=Vle(),r=Yle(),n=Gle(),o=Kle();function a(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,$k=a,$k}var Uk,ZR;function pH(){if(ZR)return Uk;ZR=1;var e=YT(),t="Expected a function";function r(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var s=arguments,l=o?o.apply(this,s):s[0],c=a.cache;if(c.has(l))return c.get(l);var u=n.apply(this,s);return a.cache=c.set(l,u)||c,u};return a.cache=new(r.Cache||e),a}return r.Cache=e,Uk=r,Uk}var Hk,JR;function Qle(){if(JR)return Hk;JR=1;var e=pH(),t=500;function r(n){var o=e(n,function(s){return a.size===t&&a.clear(),s}),a=o.cache;return o}return Hk=r,Hk}var Vk,eL;function Xle(){if(eL)return Vk;eL=1;var e=Qle(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(s,l,c,u){a.push(c?u.replace(r,"$1"):l||s)}),a});return Vk=n,Vk}var Yk,tL;function GT(){if(tL)return Yk;tL=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=Array(o);++n<o;)a[n]=r(t[n],n,t);return a}return Yk=e,Yk}var Gk,rL;function Zle(){if(rL)return Gk;rL=1;var e=Ib(),t=GT(),r=vs(),n=Cv(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function s(l){if(typeof l=="string")return l;if(r(l))return t(l,s)+"";if(n(l))return a?a.call(l):"";var c=l+"";return c=="0"&&1/l==-1/0?"-0":c}return Gk=s,Gk}var Kk,nL;function hH(){if(nL)return Kk;nL=1;var e=Zle();function t(r){return r==null?"":e(r)}return Kk=t,Kk}var Qk,iL;function gH(){if(iL)return Qk;iL=1;var e=vs(),t=$T(),r=Xle(),n=hH();function o(a,s){return e(a)?a:t(a,s)?[a]:r(n(a))}return Qk=o,Qk}var Xk,oL;function bS(){if(oL)return Xk;oL=1;var e=Cv();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Xk=t,Xk}var Zk,aL;function KT(){if(aL)return Zk;aL=1;var e=gH(),t=bS();function r(n,o){o=e(o,n);for(var a=0,s=o.length;n!=null&&a<s;)n=n[t(o[a++])];return a&&a==s?n:void 0}return Zk=r,Zk}var Jk,sL;function mH(){if(sL)return Jk;sL=1;var e=KT();function t(r,n,o){var a=r==null?void 0:e(r,n);return a===void 0?o:a}return Jk=t,Jk}var Jle=mH();const Gs=dn(Jle);var e_,lL;function ece(){if(lL)return e_;lL=1;function e(t){return t==null}return e_=e,e_}var tce=ece();const Rr=dn(tce);var t_,cL;function rce(){if(cL)return t_;cL=1;var e=Td(),t=vs(),r=Pd(),n="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return t_=o,t_}var nce=rce();const Ob=dn(nce);var ice=UT();const Ar=dn(ice);var oce=Jf();const Ev=dn(oce);var r_={exports:{}},xn={};/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var uL;function ace(){if(uL)return xn;uL=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),v;v=Symbol.for("react.module.reference");function m(b){if(typeof b=="object"&&b!==null){var x=b.$$typeof;switch(x){case e:switch(b=b.type,b){case r:case o:case n:case u:case d:return b;default:switch(b=b&&b.$$typeof,b){case l:case s:case c:case h:case f:case a:return b;default:return x}}case t:return x}}}return xn.ContextConsumer=s,xn.ContextProvider=a,xn.Element=e,xn.ForwardRef=c,xn.Fragment=r,xn.Lazy=h,xn.Memo=f,xn.Portal=t,xn.Profiler=o,xn.StrictMode=n,xn.Suspense=u,xn.SuspenseList=d,xn.isAsyncMode=function(){return!1},xn.isConcurrentMode=function(){return!1},xn.isContextConsumer=function(b){return m(b)===s},xn.isContextProvider=function(b){return m(b)===a},xn.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===e},xn.isForwardRef=function(b){return m(b)===c},xn.isFragment=function(b){return m(b)===r},xn.isLazy=function(b){return m(b)===h},xn.isMemo=function(b){return m(b)===f},xn.isPortal=function(b){return m(b)===t},xn.isProfiler=function(b){return m(b)===o},xn.isStrictMode=function(b){return m(b)===n},xn.isSuspense=function(b){return m(b)===u},xn.isSuspenseList=function(b){return m(b)===d},xn.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===r||b===o||b===n||b===u||b===d||b===p||typeof b=="object"&&b!==null&&(b.$$typeof===h||b.$$typeof===f||b.$$typeof===a||b.$$typeof===s||b.$$typeof===c||b.$$typeof===v||b.getModuleId!==void 0)},xn.typeOf=m,xn}var dL;function sce(){return dL||(dL=1,r_.exports=ace()),r_.exports}var lce=sce(),n_,fL;function vH(){if(fL)return n_;fL=1;var e=Td(),t=Pd(),r="[object Number]";function n(o){return typeof o=="number"||t(o)&&e(o)==r}return n_=n,n_}var i_,pL;function cce(){if(pL)return i_;pL=1;var e=vH();function t(r){return e(r)&&r!=+r}return i_=t,i_}var uce=cce();const Nb=dn(uce);var dce=vH();const fce=dn(dce);var $a=function(t){return t===0?0:t>0?1:-1},lh=function(t){return Ob(t)&&t.indexOf("%")===t.length-1},qt=function(t){return fce(t)&&!Nb(t)},mo=function(t){return qt(t)||Ob(t)},pce=0,Av=function(t){var r=++pce;return"".concat(t||"").concat(r)},Ua=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!qt(t)&&!Ob(t))return n;var a;if(lh(t)){var s=t.indexOf("%");a=r*parseFloat(t.slice(0,s))/100}else a=+t;return Nb(a)&&(a=n),o&&a>r&&(a=r),a},Cf=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},hce=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},o=0;o<r;o++)if(!n[t[o]])n[t[o]]=!0;else return!0;return!1},$s=function(t,r){return qt(t)&&qt(r)?function(n){return t+n*(r-t)}:function(){return r}};function v2(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):Gs(n,t))===r})}function mm(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function H3(e){"@babel/helpers - typeof";return H3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H3(e)}var gce=["viewBox","children"],mce=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],hL=["points","pathLength"],o_={svg:gce,polygon:hL,polyline:hL},QT=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],y2=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(S.isValidElement(t)&&(n=t.props),!Ev(n))return null;var o={};return Object.keys(n).forEach(function(a){QT.includes(a)&&(o[a]=r||function(s){return n[a](n,s)})}),o},vce=function(t,r,n){return function(o){return t(r,n,o),null}},Eh=function(t,r,n){if(!Ev(t)||H3(t)!=="object")return null;var o=null;return Object.keys(t).forEach(function(a){var s=t[a];QT.includes(a)&&typeof s=="function"&&(o||(o={}),o[a]=vce(s,r,n))}),o},yce=["children"],xce=["children"];function gL(e,t){if(e==null)return{};var r=bce(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function bce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function V3(e){"@babel/helpers - typeof";return V3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V3(e)}var mL={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},pd=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},vL=null,a_=null,XT=function e(t){if(t===vL&&Array.isArray(a_))return a_;var r=[];return S.Children.forEach(t,function(n){Rr(n)||(lce.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),a_=r,vL=t,r};function Ks(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(o){return pd(o)}):n=[pd(t)],XT(e).forEach(function(o){var a=Gs(o,"type.displayName")||Gs(o,"type.name");n.indexOf(a)!==-1&&r.push(o)}),r}function qs(e,t){var r=Ks(e,t);return r&&r[0]}var yL=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,o=r.height;return!(!qt(n)||n<=0||!qt(o)||o<=0)},wce=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Sce=function(t){return t&&t.type&&Ob(t.type)&&wce.indexOf(t.type)>=0},jce=function(t){return t&&V3(t)==="object"&&"clipDot"in t},kce=function(t,r,n,o){var a,s=(a=o_==null?void 0:o_[o])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!Ar(t)&&(o&&s.includes(r)||mce.includes(r))||n&&QT.includes(r)},yr=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var o=t;if(S.isValidElement(t)&&(o=t.props),!Ev(o))return null;var a={};return Object.keys(o).forEach(function(s){var l;kce((l=o)===null||l===void 0?void 0:l[s],s,r,n)&&(a[s]=o[s])}),a},Y3=function e(t,r){if(t===r)return!0;var n=S.Children.count(t);if(n!==S.Children.count(r))return!1;if(n===0)return!0;if(n===1)return xL(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var o=0;o<n;o++){var a=t[o],s=r[o];if(Array.isArray(a)||Array.isArray(s)){if(!e(a,s))return!1}else if(!xL(a,s))return!1}return!0},xL=function(t,r){if(Rr(t)&&Rr(r))return!0;if(!Rr(t)&&!Rr(r)){var n=t.props||{},o=n.children,a=gL(n,yce),s=r.props||{},l=s.children,c=gL(s,xce);return o&&l?mm(a,c)&&Y3(o,l):!o&&!l?mm(a,c):!1}return!1},bL=function(t,r){var n=[],o={};return XT(t).forEach(function(a,s){if(Sce(a))n.push(a);else if(a){var l=pd(a.type),c=r[l]||{},u=c.handler,d=c.once;if(u&&(!d||!o[l])){var f=u(a,l,s);n.push(f),o[l]=!0}}}),n},_ce=function(t){var r=t&&t.type;return r&&mL[r]?mL[r]:null},Cce=function(t,r){return XT(r).indexOf(t)},Ece=["children","width","height","viewBox","className","style","title","desc"];function G3(){return G3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G3.apply(this,arguments)}function Ace(e,t){if(e==null)return{};var r=Tce(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Tce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function K3(e){var t=e.children,r=e.width,n=e.height,o=e.viewBox,a=e.className,s=e.style,l=e.title,c=e.desc,u=Ace(e,Ece),d=o||{width:r,height:n,x:0,y:0},f=Fr("recharts-surface",a);return $e.createElement("svg",G3({},yr(u,!0,"svg"),{className:f,width:r,height:n,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),$e.createElement("title",null,l),$e.createElement("desc",null,c),t)}var Pce=["children","className"];function Q3(){return Q3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Q3.apply(this,arguments)}function Ice(e,t){if(e==null)return{};var r=Oce(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Oce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var cn=$e.forwardRef(function(e,t){var r=e.children,n=e.className,o=Ice(e,Pce),a=Fr("recharts-layer",n);return $e.createElement("g",Q3({className:a},yr(o,!0),{ref:t}),r)}),dc=function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),a=2;a<n;a++)o[a-2]=arguments[a]},s_,wL;function Nce(){if(wL)return s_;wL=1;function e(t,r,n){var o=-1,a=t.length;r<0&&(r=-r>a?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var s=Array(a);++o<a;)s[o]=t[o+r];return s}return s_=e,s_}var l_,SL;function Rce(){if(SL)return l_;SL=1;var e=Nce();function t(r,n,o){var a=r.length;return o=o===void 0?a:o,!n&&o>=a?r:e(r,n,o)}return l_=t,l_}var c_,jL;function yH(){if(jL)return c_;jL=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,a="\\ufe0e\\ufe0f",s="\\u200d",l=RegExp("["+s+e+o+a+"]");function c(u){return l.test(u)}return c_=c,c_}var u_,kL;function Lce(){if(kL)return u_;kL=1;function e(t){return t.split("")}return u_=e,u_}var d_,_L;function Fce(){if(_L)return d_;_L=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,a="\\ufe0e\\ufe0f",s="["+e+"]",l="["+o+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+l+"|"+c+")",d="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",v=u+"?",m="["+a+"]?",b="(?:"+p+"(?:"+[d,f,h].join("|")+")"+m+v+")*",x=m+v+b,w="(?:"+[d+l+"?",l,f,h,s].join("|")+")",k=RegExp(c+"(?="+c+")|"+w+x,"g");function j(_){return _.match(k)||[]}return d_=j,d_}var f_,CL;function zce(){if(CL)return f_;CL=1;var e=Lce(),t=yH(),r=Fce();function n(o){return t(o)?r(o):e(o)}return f_=n,f_}var p_,EL;function Mce(){if(EL)return p_;EL=1;var e=Rce(),t=yH(),r=zce(),n=hH();function o(a){return function(s){s=n(s);var l=t(s)?r(s):void 0,c=l?l[0]:s.charAt(0),u=l?e(l,1).join(""):s.slice(1);return c[a]()+u}}return p_=o,p_}var h_,AL;function Dce(){if(AL)return h_;AL=1;var e=Mce(),t=e("toUpperCase");return h_=t,h_}var Bce=Dce();const wS=dn(Bce);function Gn(e){return function(){return e}}const xH=Math.cos,x2=Math.sin,Sc=Math.sqrt,b2=Math.PI,SS=2*b2,X3=Math.PI,Z3=2*X3,Qp=1e-6,Wce=Z3-Qp;function bH(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function qce(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return bH;const r=10**t;return function(n){this._+=n[0];for(let o=1,a=n.length;o<a;++o)this._+=Math.round(arguments[o]*r)/r+n[o]}}let $ce=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?bH:qce(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,o){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+o}`}bezierCurveTo(t,r,n,o,a,s){this._append`C${+t},${+r},${+n},${+o},${this._x1=+a},${this._y1=+s}`}arcTo(t,r,n,o,a){if(t=+t,r=+r,n=+n,o=+o,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,l=this._y1,c=n-t,u=o-r,d=s-t,f=l-r,h=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(h>Qp)if(!(Math.abs(f*c-u*d)>Qp)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-s,v=o-l,m=c*c+u*u,b=p*p+v*v,x=Math.sqrt(m),w=Math.sqrt(h),k=a*Math.tan((X3-Math.acos((m+h-b)/(2*x*w)))/2),j=k/w,_=k/x;Math.abs(j-1)>Qp&&this._append`L${t+j*d},${r+j*f}`,this._append`A${a},${a},0,0,${+(f*p>d*v)},${this._x1=t+_*c},${this._y1=r+_*u}`}}arc(t,r,n,o,a,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(o),c=n*Math.sin(o),u=t+l,d=r+c,f=1^s,h=s?o-a:a-o;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Qp||Math.abs(this._y1-d)>Qp)&&this._append`L${u},${d}`,n&&(h<0&&(h=h%Z3+Z3),h>Wce?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=u},${this._y1=d}`:h>Qp&&this._append`A${n},${n},0,${+(h>=X3)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+o}h${-n}Z`}toString(){return this._}};function ZT(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new $ce(t)}function JT(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wH(e){this._context=e}wH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function jS(e){return new wH(e)}function SH(e){return e[0]}function jH(e){return e[1]}function kH(e,t){var r=Gn(!0),n=null,o=jS,a=null,s=ZT(l);e=typeof e=="function"?e:e===void 0?SH:Gn(e),t=typeof t=="function"?t:t===void 0?jH:Gn(t);function l(c){var u,d=(c=JT(c)).length,f,h=!1,p;for(n==null&&(a=o(p=s())),u=0;u<=d;++u)!(u<d&&r(f=c[u],u,c))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(f,u,c),+t(f,u,c));if(p)return a=null,p+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:Gn(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:Gn(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Gn(!!c),l):r},l.curve=function(c){return arguments.length?(o=c,n!=null&&(a=o(n)),l):o},l.context=function(c){return arguments.length?(c==null?n=a=null:a=o(n=c),l):n},l}function e1(e,t,r){var n=null,o=Gn(!0),a=null,s=jS,l=null,c=ZT(u);e=typeof e=="function"?e:e===void 0?SH:Gn(+e),t=typeof t=="function"?t:Gn(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?jH:Gn(+r);function u(f){var h,p,v,m=(f=JT(f)).length,b,x=!1,w,k=new Array(m),j=new Array(m);for(a==null&&(l=s(w=c())),h=0;h<=m;++h){if(!(h<m&&o(b=f[h],h,f))===x)if(x=!x)p=h,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),v=h-1;v>=p;--v)l.point(k[v],j[v]);l.lineEnd(),l.areaEnd()}x&&(k[h]=+e(b,h,f),j[h]=+t(b,h,f),l.point(n?+n(b,h,f):k[h],r?+r(b,h,f):j[h]))}if(w)return l=null,w+""||null}function d(){return kH().defined(o).curve(s).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Gn(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Gn(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Gn(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Gn(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Gn(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Gn(+f),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(n).y(t)},u.defined=function(f){return arguments.length?(o=typeof f=="function"?f:Gn(!!f),u):o},u.curve=function(f){return arguments.length?(s=f,a!=null&&(l=s(a)),u):s},u.context=function(f){return arguments.length?(f==null?a=l=null:l=s(a=f),u):a},u}class _H{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function Uce(e){return new _H(e,!0)}function Hce(e){return new _H(e,!1)}const eP={draw(e,t){const r=Sc(t/b2);e.moveTo(r,0),e.arc(0,0,r,0,SS)}},Vce={draw(e,t){const r=Sc(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},CH=Sc(1/3),Yce=CH*2,Gce={draw(e,t){const r=Sc(t/Yce),n=r*CH;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},Kce={draw(e,t){const r=Sc(t),n=-r/2;e.rect(n,n,r,r)}},Qce=.8908130915292852,EH=x2(b2/10)/x2(7*b2/10),Xce=x2(SS/10)*EH,Zce=-xH(SS/10)*EH,Jce={draw(e,t){const r=Sc(t*Qce),n=Xce*r,o=Zce*r;e.moveTo(0,-r),e.lineTo(n,o);for(let a=1;a<5;++a){const s=SS*a/5,l=xH(s),c=x2(s);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*o,c*n+l*o)}e.closePath()}},g_=Sc(3),eue={draw(e,t){const r=-Sc(t/(g_*3));e.moveTo(0,r*2),e.lineTo(-g_*r,-r),e.lineTo(g_*r,-r),e.closePath()}},wl=-.5,Sl=Sc(3)/2,J3=1/Sc(12),tue=(J3/2+1)*3,rue={draw(e,t){const r=Sc(t/tue),n=r/2,o=r*J3,a=n,s=r*J3+r,l=-a,c=s;e.moveTo(n,o),e.lineTo(a,s),e.lineTo(l,c),e.lineTo(wl*n-Sl*o,Sl*n+wl*o),e.lineTo(wl*a-Sl*s,Sl*a+wl*s),e.lineTo(wl*l-Sl*c,Sl*l+wl*c),e.lineTo(wl*n+Sl*o,wl*o-Sl*n),e.lineTo(wl*a+Sl*s,wl*s-Sl*a),e.lineTo(wl*l+Sl*c,wl*c-Sl*l),e.closePath()}};function nue(e,t){let r=null,n=ZT(o);e=typeof e=="function"?e:Gn(e||eP),t=typeof t=="function"?t:Gn(t===void 0?64:+t);function o(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return o.type=function(a){return arguments.length?(e=typeof a=="function"?a:Gn(a),o):e},o.size=function(a){return arguments.length?(t=typeof a=="function"?a:Gn(+a),o):t},o.context=function(a){return arguments.length?(r=a??null,o):r},o}function w2(){}function S2(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function AH(e){this._context=e}AH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:S2(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function iue(e){return new AH(e)}function TH(e){this._context=e}TH.prototype={areaStart:w2,areaEnd:w2,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function oue(e){return new TH(e)}function PH(e){this._context=e}PH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:S2(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function aue(e){return new PH(e)}function IH(e){this._context=e}IH.prototype={areaStart:w2,areaEnd:w2,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function sue(e){return new IH(e)}function TL(e){return e<0?-1:1}function PL(e,t,r){var n=e._x1-e._x0,o=t-e._x1,a=(e._y1-e._y0)/(n||o<0&&-0),s=(r-e._y1)/(o||n<0&&-0),l=(a*o+s*n)/(n+o);return(TL(a)+TL(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(l))||0}function IL(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function m_(e,t,r){var n=e._x0,o=e._y0,a=e._x1,s=e._y1,l=(a-n)/3;e._context.bezierCurveTo(n+l,o+l*t,a-l,s-l*r,a,s)}function j2(e){this._context=e}j2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:m_(this,this._t0,IL(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,m_(this,IL(this,r=PL(this,e,t)),r);break;default:m_(this,this._t0,r=PL(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function OH(e){this._context=new NH(e)}(OH.prototype=Object.create(j2.prototype)).point=function(e,t){j2.prototype.point.call(this,t,e)};function NH(e){this._context=e}NH.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,o,a){this._context.bezierCurveTo(t,e,n,r,a,o)}};function lue(e){return new j2(e)}function cue(e){return new OH(e)}function RH(e){this._context=e}RH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=OL(e),o=OL(t),a=0,s=1;s<r;++a,++s)this._context.bezierCurveTo(n[0][a],o[0][a],n[1][a],o[1][a],e[s],t[s]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function OL(e){var t,r=e.length-1,n,o=new Array(r),a=new Array(r),s=new Array(r);for(o[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)o[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(o[r-1]=2,a[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=o[t]/a[t-1],a[t]-=n,s[t]-=n*s[t-1];for(o[r-1]=s[r-1]/a[r-1],t=r-2;t>=0;--t)o[t]=(s[t]-o[t+1])/a[t];for(a[r-1]=(e[r]+o[r-1])/2,t=0;t<r-1;++t)a[t]=2*e[t+1]-o[t+1];return[o,a]}function uue(e){return new RH(e)}function kS(e,t){this._context=e,this._t=t}kS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function due(e){return new kS(e,.5)}function fue(e){return new kS(e,0)}function pue(e){return new kS(e,1)}function Lm(e,t){if((s=e.length)>1)for(var r=1,n,o,a=e[t[0]],s,l=a.length;r<s;++r)for(o=a,a=e[t[r]],n=0;n<l;++n)a[n][1]+=a[n][0]=isNaN(o[n][1])?o[n][0]:o[n][1]}function eA(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function hue(e,t){return e[t]}function gue(e){const t=[];return t.key=e,t}function mue(){var e=Gn([]),t=eA,r=Lm,n=hue;function o(a){var s=Array.from(e.apply(this,arguments),gue),l,c=s.length,u=-1,d;for(const f of a)for(l=0,++u;l<c;++l)(s[l][u]=[0,+n(f,s[l].key,u,a)]).data=f;for(l=0,d=JT(t(s));l<c;++l)s[d[l]].index=l;return r(s,d),s}return o.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Gn(Array.from(a)),o):e},o.value=function(a){return arguments.length?(n=typeof a=="function"?a:Gn(+a),o):n},o.order=function(a){return arguments.length?(t=a==null?eA:typeof a=="function"?a:Gn(Array.from(a)),o):t},o.offset=function(a){return arguments.length?(r=a??Lm,o):r},o}function vue(e,t){if((n=e.length)>0){for(var r,n,o=0,a=e[0].length,s;o<a;++o){for(s=r=0;r<n;++r)s+=e[r][o][1]||0;if(s)for(r=0;r<n;++r)e[r][o][1]/=s}Lm(e,t)}}function yue(e,t){if((o=e.length)>0){for(var r=0,n=e[t[0]],o,a=n.length;r<a;++r){for(var s=0,l=0;s<o;++s)l+=e[s][r][1]||0;n[r][1]+=n[r][0]=-l/2}Lm(e,t)}}function xue(e,t){if(!(!((s=e.length)>0)||!((a=(o=e[t[0]]).length)>0))){for(var r=0,n=1,o,a,s;n<a;++n){for(var l=0,c=0,u=0;l<s;++l){for(var d=e[t[l]],f=d[n][1]||0,h=d[n-1][1]||0,p=(f-h)/2,v=0;v<l;++v){var m=e[t[v]],b=m[n][1]||0,x=m[n-1][1]||0;p+=b-x}c+=f,u+=p*f}o[n-1][1]+=o[n-1][0]=r,c&&(r-=u/c)}o[n-1][1]+=o[n-1][0]=r,Lm(e,t)}}function Tx(e){"@babel/helpers - typeof";return Tx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tx(e)}var bue=["type","size","sizeType"];function tA(){return tA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tA.apply(this,arguments)}function NL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function RL(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?NL(Object(r),!0).forEach(function(n){wue(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wue(e,t,r){return t=Sue(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sue(e){var t=jue(e,"string");return Tx(t)=="symbol"?t:t+""}function jue(e,t){if(Tx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Tx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kue(e,t){if(e==null)return{};var r=_ue(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _ue(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var LH={symbolCircle:eP,symbolCross:Vce,symbolDiamond:Gce,symbolSquare:Kce,symbolStar:Jce,symbolTriangle:eue,symbolWye:rue},Cue=Math.PI/180,Eue=function(t){var r="symbol".concat(wS(t));return LH[r]||eP},Aue=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var o=18*Cue;return 1.25*t*t*(Math.tan(o)-Math.tan(o*2)*Math.pow(Math.tan(o),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Tue=function(t,r){LH["symbol".concat(wS(t))]=r},tP=function(t){var r=t.type,n=r===void 0?"circle":r,o=t.size,a=o===void 0?64:o,s=t.sizeType,l=s===void 0?"area":s,c=kue(t,bue),u=RL(RL({},c),{},{type:n,size:a,sizeType:l}),d=function(){var b=Eue(n),x=nue().type(b).size(Aue(a,l,n));return x()},f=u.className,h=u.cx,p=u.cy,v=yr(u,!0);return h===+h&&p===+p&&a===+a?$e.createElement("path",tA({},v,{className:Fr("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};tP.registerSymbol=Tue;function Fm(e){"@babel/helpers - typeof";return Fm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fm(e)}function rA(){return rA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rA.apply(this,arguments)}function LL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Pue(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LL(Object(r),!0).forEach(function(n){Px(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LL(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Iue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Oue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,zH(n.key),n)}}function Nue(e,t,r){return t&&Oue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rue(e,t,r){return t=k2(t),Lue(e,FH()?Reflect.construct(t,r||[],k2(e).constructor):t.apply(e,r))}function Lue(e,t){if(t&&(Fm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fue(e)}function Fue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function FH(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FH=function(){return!!e})()}function k2(e){return k2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},k2(e)}function zue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&nA(e,t)}function nA(e,t){return nA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},nA(e,t)}function Px(e,t,r){return t=zH(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zH(e){var t=Mue(e,"string");return Fm(t)=="symbol"?t:t+""}function Mue(e,t){if(Fm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Fm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var jl=32,rP=(function(e){function t(){return Iue(this,t),Rue(this,t,arguments)}return zue(t,e),Nue(t,[{key:"renderIcon",value:function(n){var o=this.props.inactiveColor,a=jl/2,s=jl/6,l=jl/3,c=n.inactive?o:n.color;if(n.type==="plainline")return $e.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:a,x2:jl,y2:a,className:"recharts-legend-icon"});if(n.type==="line")return $e.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(a,"h").concat(l,`
A`).concat(s,",").concat(s,",0,1,1,").concat(2*l,",").concat(a,`
H`).concat(jl,"M").concat(2*l,",").concat(a,`
A`).concat(s,",").concat(s,",0,1,1,").concat(l,",").concat(a),className:"recharts-legend-icon"});if(n.type==="rect")return $e.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(jl/8,"h").concat(jl,"v").concat(jl*3/4,"h").concat(-jl,"z"),className:"recharts-legend-icon"});if($e.isValidElement(n.legendIcon)){var u=Pue({},n);return delete u.legendIcon,$e.cloneElement(n.legendIcon,u)}return $e.createElement(tP,{fill:c,cx:a,cy:a,size:jl,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,o=this.props,a=o.payload,s=o.iconSize,l=o.layout,c=o.formatter,u=o.inactiveColor,d={x:0,y:0,width:jl,height:jl},f={display:l==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(p,v){var m=p.formatter||c,b=Fr(Px(Px({"recharts-legend-item":!0},"legend-item-".concat(v),!0),"inactive",p.inactive));if(p.type==="none")return null;var x=Ar(p.value)?null:p.value;dc(!Ar(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var w=p.inactive?u:p.color;return $e.createElement("li",rA({className:b,style:f,key:"legend-item-".concat(v)},Eh(n.props,p,v)),$e.createElement(K3,{width:s,height:s,viewBox:d,style:h},n.renderIcon(p)),$e.createElement("span",{className:"recharts-legend-item-text",style:{color:w}},m?m(x,p,v):x))})}},{key:"render",value:function(){var n=this.props,o=n.payload,a=n.layout,s=n.align;if(!o||!o.length)return null;var l={padding:0,margin:0,textAlign:a==="horizontal"?s:"left"};return $e.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])})(S.PureComponent);Px(rP,"displayName","Legend");Px(rP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var v_,FL;function Due(){if(FL)return v_;FL=1;var e=yS();function t(){this.__data__=new e,this.size=0}return v_=t,v_}var y_,zL;function Bue(){if(zL)return y_;zL=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return y_=e,y_}var x_,ML;function Wue(){if(ML)return x_;ML=1;function e(t){return this.__data__.get(t)}return x_=e,x_}var b_,DL;function que(){if(DL)return b_;DL=1;function e(t){return this.__data__.has(t)}return b_=e,b_}var w_,BL;function $ue(){if(BL)return w_;BL=1;var e=yS(),t=VT(),r=YT(),n=200;function o(a,s){var l=this.__data__;if(l instanceof e){var c=l.__data__;if(!t||c.length<n-1)return c.push([a,s]),this.size=++l.size,this;l=this.__data__=new r(c)}return l.set(a,s),this.size=l.size,this}return w_=o,w_}var S_,WL;function MH(){if(WL)return S_;WL=1;var e=yS(),t=Due(),r=Bue(),n=Wue(),o=que(),a=$ue();function s(l){var c=this.__data__=new e(l);this.size=c.size}return s.prototype.clear=t,s.prototype.delete=r,s.prototype.get=n,s.prototype.has=o,s.prototype.set=a,S_=s,S_}var j_,qL;function Uue(){if(qL)return j_;qL=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return j_=t,j_}var k_,$L;function Hue(){if($L)return k_;$L=1;function e(t){return this.__data__.has(t)}return k_=e,k_}var __,UL;function DH(){if(UL)return __;UL=1;var e=YT(),t=Uue(),r=Hue();function n(o){var a=-1,s=o==null?0:o.length;for(this.__data__=new e;++a<s;)this.add(o[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,__=n,__}var C_,HL;function BH(){if(HL)return C_;HL=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(r(t[n],n,t))return!0;return!1}return C_=e,C_}var E_,VL;function WH(){if(VL)return E_;VL=1;function e(t,r){return t.has(r)}return E_=e,E_}var A_,YL;function qH(){if(YL)return A_;YL=1;var e=DH(),t=BH(),r=WH(),n=1,o=2;function a(s,l,c,u,d,f){var h=c&n,p=s.length,v=l.length;if(p!=v&&!(h&&v>p))return!1;var m=f.get(s),b=f.get(l);if(m&&b)return m==l&&b==s;var x=-1,w=!0,k=c&o?new e:void 0;for(f.set(s,l),f.set(l,s);++x<p;){var j=s[x],_=l[x];if(u)var T=h?u(_,j,x,l,s,f):u(j,_,x,s,l,f);if(T!==void 0){if(T)continue;w=!1;break}if(k){if(!t(l,function(A,P){if(!r(k,P)&&(j===A||d(j,A,c,u,f)))return k.push(P)})){w=!1;break}}else if(!(j===_||d(j,_,c,u,f))){w=!1;break}}return f.delete(s),f.delete(l),w}return A_=a,A_}var T_,GL;function Vue(){if(GL)return T_;GL=1;var e=du(),t=e.Uint8Array;return T_=t,T_}var P_,KL;function Yue(){if(KL)return P_;KL=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o,a){n[++r]=[a,o]}),n}return P_=e,P_}var I_,QL;function nP(){if(QL)return I_;QL=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o){n[++r]=o}),n}return I_=e,I_}var O_,XL;function Gue(){if(XL)return O_;XL=1;var e=Ib(),t=Vue(),r=HT(),n=qH(),o=Yue(),a=nP(),s=1,l=2,c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",h="[object Number]",p="[object RegExp]",v="[object Set]",m="[object String]",b="[object Symbol]",x="[object ArrayBuffer]",w="[object DataView]",k=e?e.prototype:void 0,j=k?k.valueOf:void 0;function _(T,A,P,N,O,C,I){switch(P){case w:if(T.byteLength!=A.byteLength||T.byteOffset!=A.byteOffset)return!1;T=T.buffer,A=A.buffer;case x:return!(T.byteLength!=A.byteLength||!C(new t(T),new t(A)));case c:case u:case h:return r(+T,+A);case d:return T.name==A.name&&T.message==A.message;case p:case m:return T==A+"";case f:var R=o;case v:var F=N&s;if(R||(R=a),T.size!=A.size&&!F)return!1;var M=I.get(T);if(M)return M==A;N|=l,I.set(T,A);var Y=n(R(T),R(A),N,O,C,I);return I.delete(T),Y;case b:if(j)return j.call(T)==j.call(A)}return!1}return O_=_,O_}var N_,ZL;function $H(){if(ZL)return N_;ZL=1;function e(t,r){for(var n=-1,o=r.length,a=t.length;++n<o;)t[a+n]=r[n];return t}return N_=e,N_}var R_,JL;function Kue(){if(JL)return R_;JL=1;var e=$H(),t=vs();function r(n,o,a){var s=o(n);return t(n)?s:e(s,a(n))}return R_=r,R_}var L_,eF;function Que(){if(eF)return L_;eF=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=0,s=[];++n<o;){var l=t[n];r(l,n,t)&&(s[a++]=l)}return s}return L_=e,L_}var F_,tF;function Xue(){if(tF)return F_;tF=1;function e(){return[]}return F_=e,F_}var z_,rF;function Zue(){if(rF)return z_;rF=1;var e=Que(),t=Xue(),r=Object.prototype,n=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(s){return s==null?[]:(s=Object(s),e(o(s),function(l){return n.call(s,l)}))}:t;return z_=a,z_}var M_,nF;function Jue(){if(nF)return M_;nF=1;function e(t,r){for(var n=-1,o=Array(t);++n<t;)o[n]=r(n);return o}return M_=e,M_}var D_,iF;function ede(){if(iF)return D_;iF=1;var e=Td(),t=Pd(),r="[object Arguments]";function n(o){return t(o)&&e(o)==r}return D_=n,D_}var B_,oF;function iP(){if(oF)return B_;oF=1;var e=ede(),t=Pd(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(s){return t(s)&&n.call(s,"callee")&&!o.call(s,"callee")};return B_=a,B_}var Qy={exports:{}},W_,aF;function tde(){if(aF)return W_;aF=1;function e(){return!1}return W_=e,W_}Qy.exports;var sF;function UH(){return sF||(sF=1,(function(e,t){var r=du(),n=tde(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===o,l=s?r.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||n;e.exports=u})(Qy,Qy.exports)),Qy.exports}var q_,lF;function oP(){if(lF)return q_;lF=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,o){var a=typeof n;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<o}return q_=r,q_}var $_,cF;function aP(){if(cF)return $_;cF=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return $_=t,$_}var U_,uF;function rde(){if(uF)return U_;uF=1;var e=Td(),t=aP(),r=Pd(),n="[object Arguments]",o="[object Array]",a="[object Boolean]",s="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",h="[object RegExp]",p="[object Set]",v="[object String]",m="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",w="[object Float32Array]",k="[object Float64Array]",j="[object Int8Array]",_="[object Int16Array]",T="[object Int32Array]",A="[object Uint8Array]",P="[object Uint8ClampedArray]",N="[object Uint16Array]",O="[object Uint32Array]",C={};C[w]=C[k]=C[j]=C[_]=C[T]=C[A]=C[P]=C[N]=C[O]=!0,C[n]=C[o]=C[b]=C[a]=C[x]=C[s]=C[l]=C[c]=C[u]=C[d]=C[f]=C[h]=C[p]=C[v]=C[m]=!1;function I(R){return r(R)&&t(R.length)&&!!C[e(R)]}return U_=I,U_}var H_,dF;function HH(){if(dF)return H_;dF=1;function e(t){return function(r){return t(r)}}return H_=e,H_}var Xy={exports:{}};Xy.exports;var fF;function nde(){return fF||(fF=1,(function(e,t){var r=dH(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===n,s=a&&r.process,l=(function(){try{var c=o&&o.require&&o.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}})();e.exports=l})(Xy,Xy.exports)),Xy.exports}var V_,pF;function VH(){if(pF)return V_;pF=1;var e=rde(),t=HH(),r=nde(),n=r&&r.isTypedArray,o=n?t(n):e;return V_=o,V_}var Y_,hF;function ide(){if(hF)return Y_;hF=1;var e=Jue(),t=iP(),r=vs(),n=UH(),o=oP(),a=VH(),s=Object.prototype,l=s.hasOwnProperty;function c(u,d){var f=r(u),h=!f&&t(u),p=!f&&!h&&n(u),v=!f&&!h&&!p&&a(u),m=f||h||p||v,b=m?e(u.length,String):[],x=b.length;for(var w in u)(d||l.call(u,w))&&!(m&&(w=="length"||p&&(w=="offset"||w=="parent")||v&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||o(w,x)))&&b.push(w);return b}return Y_=c,Y_}var G_,gF;function ode(){if(gF)return G_;gF=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,o=typeof n=="function"&&n.prototype||e;return r===o}return G_=t,G_}var K_,mF;function YH(){if(mF)return K_;mF=1;function e(t,r){return function(n){return t(r(n))}}return K_=e,K_}var Q_,vF;function ade(){if(vF)return Q_;vF=1;var e=YH(),t=e(Object.keys,Object);return Q_=t,Q_}var X_,yF;function sde(){if(yF)return X_;yF=1;var e=ode(),t=ade(),r=Object.prototype,n=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var s=[];for(var l in Object(a))n.call(a,l)&&l!="constructor"&&s.push(l);return s}return X_=o,X_}var Z_,xF;function Rb(){if(xF)return Z_;xF=1;var e=UT(),t=aP();function r(n){return n!=null&&t(n.length)&&!e(n)}return Z_=r,Z_}var J_,bF;function _S(){if(bF)return J_;bF=1;var e=ide(),t=sde(),r=Rb();function n(o){return r(o)?e(o):t(o)}return J_=n,J_}var eC,wF;function lde(){if(wF)return eC;wF=1;var e=Kue(),t=Zue(),r=_S();function n(o){return e(o,r,t)}return eC=n,eC}var tC,SF;function cde(){if(SF)return tC;SF=1;var e=lde(),t=1,r=Object.prototype,n=r.hasOwnProperty;function o(a,s,l,c,u,d){var f=l&t,h=e(a),p=h.length,v=e(s),m=v.length;if(p!=m&&!f)return!1;for(var b=p;b--;){var x=h[b];if(!(f?x in s:n.call(s,x)))return!1}var w=d.get(a),k=d.get(s);if(w&&k)return w==s&&k==a;var j=!0;d.set(a,s),d.set(s,a);for(var _=f;++b<p;){x=h[b];var T=a[x],A=s[x];if(c)var P=f?c(A,T,x,s,a,d):c(T,A,x,a,s,d);if(!(P===void 0?T===A||u(T,A,l,c,d):P)){j=!1;break}_||(_=x=="constructor")}if(j&&!_){var N=a.constructor,O=s.constructor;N!=O&&"constructor"in a&&"constructor"in s&&!(typeof N=="function"&&N instanceof N&&typeof O=="function"&&O instanceof O)&&(j=!1)}return d.delete(a),d.delete(s),j}return tC=o,tC}var rC,jF;function ude(){if(jF)return rC;jF=1;var e=Vh(),t=du(),r=e(t,"DataView");return rC=r,rC}var nC,kF;function dde(){if(kF)return nC;kF=1;var e=Vh(),t=du(),r=e(t,"Promise");return nC=r,nC}var iC,_F;function GH(){if(_F)return iC;_F=1;var e=Vh(),t=du(),r=e(t,"Set");return iC=r,iC}var oC,CF;function fde(){if(CF)return oC;CF=1;var e=Vh(),t=du(),r=e(t,"WeakMap");return oC=r,oC}var aC,EF;function pde(){if(EF)return aC;EF=1;var e=ude(),t=VT(),r=dde(),n=GH(),o=fde(),a=Td(),s=fH(),l="[object Map]",c="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",h="[object DataView]",p=s(e),v=s(t),m=s(r),b=s(n),x=s(o),w=a;return(e&&w(new e(new ArrayBuffer(1)))!=h||t&&w(new t)!=l||r&&w(r.resolve())!=u||n&&w(new n)!=d||o&&w(new o)!=f)&&(w=function(k){var j=a(k),_=j==c?k.constructor:void 0,T=_?s(_):"";if(T)switch(T){case p:return h;case v:return l;case m:return u;case b:return d;case x:return f}return j}),aC=w,aC}var sC,AF;function hde(){if(AF)return sC;AF=1;var e=MH(),t=qH(),r=Gue(),n=cde(),o=pde(),a=vs(),s=UH(),l=VH(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",h=Object.prototype,p=h.hasOwnProperty;function v(m,b,x,w,k,j){var _=a(m),T=a(b),A=_?d:o(m),P=T?d:o(b);A=A==u?f:A,P=P==u?f:P;var N=A==f,O=P==f,C=A==P;if(C&&s(m)){if(!s(b))return!1;_=!0,N=!1}if(C&&!N)return j||(j=new e),_||l(m)?t(m,b,x,w,k,j):r(m,b,A,x,w,k,j);if(!(x&c)){var I=N&&p.call(m,"__wrapped__"),R=O&&p.call(b,"__wrapped__");if(I||R){var F=I?m.value():m,M=R?b.value():b;return j||(j=new e),k(F,M,x,w,j)}}return C?(j||(j=new e),n(m,b,x,w,k,j)):!1}return sC=v,sC}var lC,TF;function sP(){if(TF)return lC;TF=1;var e=hde(),t=Pd();function r(n,o,a,s,l){return n===o?!0:n==null||o==null||!t(n)&&!t(o)?n!==n&&o!==o:e(n,o,a,s,r,l)}return lC=r,lC}var cC,PF;function gde(){if(PF)return cC;PF=1;var e=MH(),t=sP(),r=1,n=2;function o(a,s,l,c){var u=l.length,d=u,f=!c;if(a==null)return!d;for(a=Object(a);u--;){var h=l[u];if(f&&h[2]?h[1]!==a[h[0]]:!(h[0]in a))return!1}for(;++u<d;){h=l[u];var p=h[0],v=a[p],m=h[1];if(f&&h[2]){if(v===void 0&&!(p in a))return!1}else{var b=new e;if(c)var x=c(v,m,p,a,s,b);if(!(x===void 0?t(m,v,r|n,c,b):x))return!1}}return!0}return cC=o,cC}var uC,IF;function KH(){if(IF)return uC;IF=1;var e=Jf();function t(r){return r===r&&!e(r)}return uC=t,uC}var dC,OF;function mde(){if(OF)return dC;OF=1;var e=KH(),t=_S();function r(n){for(var o=t(n),a=o.length;a--;){var s=o[a],l=n[s];o[a]=[s,l,e(l)]}return o}return dC=r,dC}var fC,NF;function QH(){if(NF)return fC;NF=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return fC=e,fC}var pC,RF;function vde(){if(RF)return pC;RF=1;var e=gde(),t=mde(),r=QH();function n(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(s){return s===o||e(s,o,a)}}return pC=n,pC}var hC,LF;function yde(){if(LF)return hC;LF=1;function e(t,r){return t!=null&&r in Object(t)}return hC=e,hC}var gC,FF;function xde(){if(FF)return gC;FF=1;var e=gH(),t=iP(),r=vs(),n=oP(),o=aP(),a=bS();function s(l,c,u){c=e(c,l);for(var d=-1,f=c.length,h=!1;++d<f;){var p=a(c[d]);if(!(h=l!=null&&u(l,p)))break;l=l[p]}return h||++d!=f?h:(f=l==null?0:l.length,!!f&&o(f)&&n(p,f)&&(r(l)||t(l)))}return gC=s,gC}var mC,zF;function bde(){if(zF)return mC;zF=1;var e=yde(),t=xde();function r(n,o){return n!=null&&t(n,o,e)}return mC=r,mC}var vC,MF;function wde(){if(MF)return vC;MF=1;var e=sP(),t=mH(),r=bde(),n=$T(),o=KH(),a=QH(),s=bS(),l=1,c=2;function u(d,f){return n(d)&&o(f)?a(s(d),f):function(h){var p=t(h,d);return p===void 0&&p===f?r(h,d):e(f,p,l|c)}}return vC=u,vC}var yC,DF;function Tv(){if(DF)return yC;DF=1;function e(t){return t}return yC=e,yC}var xC,BF;function Sde(){if(BF)return xC;BF=1;function e(t){return function(r){return r==null?void 0:r[t]}}return xC=e,xC}var bC,WF;function jde(){if(WF)return bC;WF=1;var e=KT();function t(r){return function(n){return e(n,r)}}return bC=t,bC}var wC,qF;function kde(){if(qF)return wC;qF=1;var e=Sde(),t=jde(),r=$T(),n=bS();function o(a){return r(a)?e(n(a)):t(a)}return wC=o,wC}var SC,$F;function fu(){if($F)return SC;$F=1;var e=vde(),t=wde(),r=Tv(),n=vs(),o=kde();function a(s){return typeof s=="function"?s:s==null?r:typeof s=="object"?n(s)?t(s[0],s[1]):e(s):o(s)}return SC=a,SC}var jC,UF;function XH(){if(UF)return jC;UF=1;function e(t,r,n,o){for(var a=t.length,s=n+(o?1:-1);o?s--:++s<a;)if(r(t[s],s,t))return s;return-1}return jC=e,jC}var kC,HF;function _de(){if(HF)return kC;HF=1;function e(t){return t!==t}return kC=e,kC}var _C,VF;function Cde(){if(VF)return _C;VF=1;function e(t,r,n){for(var o=n-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return _C=e,_C}var CC,YF;function Ede(){if(YF)return CC;YF=1;var e=XH(),t=_de(),r=Cde();function n(o,a,s){return a===a?r(o,a,s):e(o,t,s)}return CC=n,CC}var EC,GF;function Ade(){if(GF)return EC;GF=1;var e=Ede();function t(r,n){var o=r==null?0:r.length;return!!o&&e(r,n,0)>-1}return EC=t,EC}var AC,KF;function Tde(){if(KF)return AC;KF=1;function e(t,r,n){for(var o=-1,a=t==null?0:t.length;++o<a;)if(n(r,t[o]))return!0;return!1}return AC=e,AC}var TC,QF;function Pde(){if(QF)return TC;QF=1;function e(){}return TC=e,TC}var PC,XF;function Ide(){if(XF)return PC;XF=1;var e=GH(),t=Pde(),r=nP(),n=1/0,o=e&&1/r(new e([,-0]))[1]==n?function(a){return new e(a)}:t;return PC=o,PC}var IC,ZF;function Ode(){if(ZF)return IC;ZF=1;var e=DH(),t=Ade(),r=Tde(),n=WH(),o=Ide(),a=nP(),s=200;function l(c,u,d){var f=-1,h=t,p=c.length,v=!0,m=[],b=m;if(d)v=!1,h=r;else if(p>=s){var x=u?null:o(c);if(x)return a(x);v=!1,h=n,b=new e}else b=u?[]:m;e:for(;++f<p;){var w=c[f],k=u?u(w):w;if(w=d||w!==0?w:0,v&&k===k){for(var j=b.length;j--;)if(b[j]===k)continue e;u&&b.push(k),m.push(w)}else h(b,k,d)||(b!==m&&b.push(k),m.push(w))}return m}return IC=l,IC}var OC,JF;function Nde(){if(JF)return OC;JF=1;var e=fu(),t=Ode();function r(n,o){return n&&n.length?t(n,e(o,2)):[]}return OC=r,OC}var Rde=Nde();const ez=dn(Rde);function ZH(e,t,r){return t===!0?ez(e,r):Ar(t)?ez(e,t):e}function zm(e){"@babel/helpers - typeof";return zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zm(e)}var Lde=["ref"];function tz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Yu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tz(Object(r),!0).forEach(function(n){CS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tz(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fde(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rz(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,eV(n.key),n)}}function zde(e,t,r){return t&&rz(e.prototype,t),r&&rz(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mde(e,t,r){return t=_2(t),Dde(e,JH()?Reflect.construct(t,r||[],_2(e).constructor):t.apply(e,r))}function Dde(e,t){if(t&&(zm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bde(e)}function Bde(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function JH(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(JH=function(){return!!e})()}function _2(e){return _2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},_2(e)}function Wde(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&iA(e,t)}function iA(e,t){return iA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},iA(e,t)}function CS(e,t,r){return t=eV(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eV(e){var t=qde(e,"string");return zm(t)=="symbol"?t:t+""}function qde(e,t){if(zm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(zm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function $de(e,t){if(e==null)return{};var r=Ude(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ude(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hde(e){return e.value}function Vde(e,t){if($e.isValidElement(e))return $e.cloneElement(e,t);if(typeof e=="function")return $e.createElement(e,t);t.ref;var r=$de(t,Lde);return $e.createElement(rP,r)}var nz=1,Ff=(function(e){function t(){var r;Fde(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=Mde(this,t,[].concat(o)),CS(r,"lastBoundingBox",{width:-1,height:-1}),r}return Wde(t,e),zde(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,o=this.getBBox();o?(Math.abs(o.width-this.lastBoundingBox.width)>nz||Math.abs(o.height-this.lastBoundingBox.height)>nz)&&(this.lastBoundingBox.width=o.width,this.lastBoundingBox.height=o.height,n&&n(o)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Yu({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var o=this.props,a=o.layout,s=o.align,l=o.verticalAlign,c=o.margin,u=o.chartWidth,d=o.chartHeight,f,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(s==="center"&&a==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var v=this.getBBoxSnapshot();h={top:((d||0)-v.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Yu(Yu({},f),h)}},{key:"render",value:function(){var n=this,o=this.props,a=o.content,s=o.width,l=o.height,c=o.wrapperStyle,u=o.payloadUniqBy,d=o.payload,f=Yu(Yu({position:"absolute",width:s||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return $e.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){n.wrapperNode=p}},Vde(a,Yu(Yu({},this.props),{},{payload:ZH(d,u,Hde)})))}}],[{key:"getWithHeight",value:function(n,o){var a=Yu(Yu({},this.defaultProps),n.props),s=a.layout;return s==="vertical"&&qt(n.props.height)?{height:n.props.height}:s==="horizontal"?{width:n.props.width||o}:null}}])})(S.PureComponent);CS(Ff,"displayName","Legend");CS(Ff,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var NC,iz;function Yde(){if(iz)return NC;iz=1;var e=Ib(),t=iP(),r=vs(),n=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(n&&a&&a[n])}return NC=o,NC}var RC,oz;function tV(){if(oz)return RC;oz=1;var e=$H(),t=Yde();function r(n,o,a,s,l){var c=-1,u=n.length;for(a||(a=t),l||(l=[]);++c<u;){var d=n[c];o>0&&a(d)?o>1?r(d,o-1,a,s,l):e(l,d):s||(l[l.length]=d)}return l}return RC=r,RC}var LC,az;function Gde(){if(az)return LC;az=1;function e(t){return function(r,n,o){for(var a=-1,s=Object(r),l=o(r),c=l.length;c--;){var u=l[t?c:++a];if(n(s[u],u,s)===!1)break}return r}}return LC=e,LC}var FC,sz;function Kde(){if(sz)return FC;sz=1;var e=Gde(),t=e();return FC=t,FC}var zC,lz;function rV(){if(lz)return zC;lz=1;var e=Kde(),t=_S();function r(n,o){return n&&e(n,o,t)}return zC=r,zC}var MC,cz;function Qde(){if(cz)return MC;cz=1;var e=Rb();function t(r,n){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var s=o.length,l=n?s:-1,c=Object(o);(n?l--:++l<s)&&a(c[l],l,c)!==!1;);return o}}return MC=t,MC}var DC,uz;function lP(){if(uz)return DC;uz=1;var e=rV(),t=Qde(),r=t(e);return DC=r,DC}var BC,dz;function nV(){if(dz)return BC;dz=1;var e=lP(),t=Rb();function r(n,o){var a=-1,s=t(n)?Array(n.length):[];return e(n,function(l,c,u){s[++a]=o(l,c,u)}),s}return BC=r,BC}var WC,fz;function Xde(){if(fz)return WC;fz=1;function e(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}return WC=e,WC}var qC,pz;function Zde(){if(pz)return qC;pz=1;var e=Cv();function t(r,n){if(r!==n){var o=r!==void 0,a=r===null,s=r===r,l=e(r),c=n!==void 0,u=n===null,d=n===n,f=e(n);if(!u&&!f&&!l&&r>n||l&&c&&d&&!u&&!f||a&&c&&d||!o&&d||!s)return 1;if(!a&&!l&&!f&&r<n||f&&o&&s&&!a&&!l||u&&o&&s||!c&&s||!d)return-1}return 0}return qC=t,qC}var $C,hz;function Jde(){if(hz)return $C;hz=1;var e=Zde();function t(r,n,o){for(var a=-1,s=r.criteria,l=n.criteria,c=s.length,u=o.length;++a<c;){var d=e(s[a],l[a]);if(d){if(a>=u)return d;var f=o[a];return d*(f=="desc"?-1:1)}}return r.index-n.index}return $C=t,$C}var UC,gz;function efe(){if(gz)return UC;gz=1;var e=GT(),t=KT(),r=fu(),n=nV(),o=Xde(),a=HH(),s=Jde(),l=Tv(),c=vs();function u(d,f,h){f.length?f=e(f,function(m){return c(m)?function(b){return t(b,m.length===1?m[0]:m)}:m}):f=[l];var p=-1;f=e(f,a(r));var v=n(d,function(m,b,x){var w=e(f,function(k){return k(m)});return{criteria:w,index:++p,value:m}});return o(v,function(m,b){return s(m,b,h)})}return UC=u,UC}var HC,mz;function tfe(){if(mz)return HC;mz=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return HC=e,HC}var VC,vz;function rfe(){if(vz)return VC;vz=1;var e=tfe(),t=Math.max;function r(n,o,a){return o=t(o===void 0?n.length-1:o,0),function(){for(var s=arguments,l=-1,c=t(s.length-o,0),u=Array(c);++l<c;)u[l]=s[o+l];l=-1;for(var d=Array(o+1);++l<o;)d[l]=s[l];return d[o]=a(u),e(n,this,d)}}return VC=r,VC}var YC,yz;function nfe(){if(yz)return YC;yz=1;function e(t){return function(){return t}}return YC=e,YC}var GC,xz;function iV(){if(xz)return GC;xz=1;var e=Vh(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return GC=t,GC}var KC,bz;function ife(){if(bz)return KC;bz=1;var e=nfe(),t=iV(),r=Tv(),n=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return KC=n,KC}var QC,wz;function ofe(){if(wz)return QC;wz=1;var e=800,t=16,r=Date.now;function n(o){var a=0,s=0;return function(){var l=r(),c=t-(l-s);if(s=l,c>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return QC=n,QC}var XC,Sz;function afe(){if(Sz)return XC;Sz=1;var e=ife(),t=ofe(),r=t(e);return XC=r,XC}var ZC,jz;function sfe(){if(jz)return ZC;jz=1;var e=Tv(),t=rfe(),r=afe();function n(o,a){return r(t(o,a,e),o+"")}return ZC=n,ZC}var JC,kz;function ES(){if(kz)return JC;kz=1;var e=HT(),t=Rb(),r=oP(),n=Jf();function o(a,s,l){if(!n(l))return!1;var c=typeof s;return(c=="number"?t(l)&&r(s,l.length):c=="string"&&s in l)?e(l[s],a):!1}return JC=o,JC}var e4,_z;function lfe(){if(_z)return e4;_z=1;var e=tV(),t=efe(),r=sfe(),n=ES(),o=r(function(a,s){if(a==null)return[];var l=s.length;return l>1&&n(a,s[0],s[1])?s=[]:l>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(a,e(s,1),[])});return e4=o,e4}var cfe=lfe();const cP=dn(cfe);function Ix(e){"@babel/helpers - typeof";return Ix=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ix(e)}function oA(){return oA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},oA.apply(this,arguments)}function ufe(e,t){return hfe(e)||pfe(e,t)||ffe(e,t)||dfe()}function dfe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ffe(e,t){if(e){if(typeof e=="string")return Cz(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cz(e,t)}}function Cz(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function pfe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function hfe(e){if(Array.isArray(e))return e}function Ez(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function t4(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ez(Object(r),!0).forEach(function(n){gfe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ez(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gfe(e,t,r){return t=mfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mfe(e){var t=vfe(e,"string");return Ix(t)=="symbol"?t:t+""}function vfe(e,t){if(Ix(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ix(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yfe(e){return Array.isArray(e)&&mo(e[0])&&mo(e[1])?e.join(" ~ "):e}var xfe=function(t){var r=t.separator,n=r===void 0?" : ":r,o=t.contentStyle,a=o===void 0?{}:o,s=t.itemStyle,l=s===void 0?{}:s,c=t.labelStyle,u=c===void 0?{}:c,d=t.payload,f=t.formatter,h=t.itemSorter,p=t.wrapperClassName,v=t.labelClassName,m=t.label,b=t.labelFormatter,x=t.accessibilityLayer,w=x===void 0?!1:x,k=function(){if(d&&d.length){var I={padding:0,margin:0},R=(h?cP(d,h):d).map(function(F,M){if(F.type==="none")return null;var Y=t4({display:"block",paddingTop:4,paddingBottom:4,color:F.color||"#000"},l),X=F.formatter||f||yfe,$=F.value,ee=F.name,V=$,D=ee;if(X&&V!=null&&D!=null){var z=X($,ee,F,M,d);if(Array.isArray(z)){var q=ufe(z,2);V=q[0],D=q[1]}else V=z}return $e.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(M),style:Y},mo(D)?$e.createElement("span",{className:"recharts-tooltip-item-name"},D):null,mo(D)?$e.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,$e.createElement("span",{className:"recharts-tooltip-item-value"},V),$e.createElement("span",{className:"recharts-tooltip-item-unit"},F.unit||""))});return $e.createElement("ul",{className:"recharts-tooltip-item-list",style:I},R)}return null},j=t4({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),_=t4({margin:0},u),T=!Rr(m),A=T?m:"",P=Fr("recharts-default-tooltip",p),N=Fr("recharts-tooltip-label",v);T&&b&&d!==void 0&&d!==null&&(A=b(m,d));var O=w?{role:"status","aria-live":"assertive"}:{};return $e.createElement("div",oA({className:P,style:j},O),$e.createElement("p",{className:N,style:_},$e.isValidElement(A)?A:"".concat(A)),k())};function Ox(e){"@babel/helpers - typeof";return Ox=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ox(e)}function t1(e,t,r){return t=bfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bfe(e){var t=wfe(e,"string");return Ox(t)=="symbol"?t:t+""}function wfe(e,t){if(Ox(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ox(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wy="recharts-tooltip-wrapper",Sfe={visibility:"hidden"};function jfe(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return Fr(wy,t1(t1(t1(t1({},"".concat(wy,"-right"),qt(r)&&t&&qt(t.x)&&r>=t.x),"".concat(wy,"-left"),qt(r)&&t&&qt(t.x)&&r<t.x),"".concat(wy,"-bottom"),qt(n)&&t&&qt(t.y)&&n>=t.y),"".concat(wy,"-top"),qt(n)&&t&&qt(t.y)&&n<t.y))}function Az(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.key,o=e.offsetTopLeft,a=e.position,s=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,u=e.viewBoxDimension;if(a&&qt(a[n]))return a[n];var d=r[n]-l-o,f=r[n]+o;if(t[n])return s[n]?d:f;if(s[n]){var h=d,p=c[n];return h<p?Math.max(f,c[n]):Math.max(d,c[n])}var v=f+l,m=c[n]+u;return v>m?Math.max(d,c[n]):Math.max(f,c[n])}function kfe(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function _fe(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,o=e.position,a=e.reverseDirection,s=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return s.height>0&&s.width>0&&r?(d=Az({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),f=Az({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),u=kfe({translateX:d,translateY:f,useTranslate3d:l})):u=Sfe,{cssProperties:u,cssClasses:jfe({translateX:d,translateY:f,coordinate:r})}}function Mm(e){"@babel/helpers - typeof";return Mm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mm(e)}function Tz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Pz(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Tz(Object(r),!0).forEach(function(n){sA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tz(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cfe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Efe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,aV(n.key),n)}}function Afe(e,t,r){return t&&Efe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Tfe(e,t,r){return t=C2(t),Pfe(e,oV()?Reflect.construct(t,r||[],C2(e).constructor):t.apply(e,r))}function Pfe(e,t){if(t&&(Mm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ife(e)}function Ife(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oV(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(oV=function(){return!!e})()}function C2(e){return C2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},C2(e)}function Ofe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&aA(e,t)}function aA(e,t){return aA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},aA(e,t)}function sA(e,t,r){return t=aV(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aV(e){var t=Nfe(e,"string");return Mm(t)=="symbol"?t:t+""}function Nfe(e,t){if(Mm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Mm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Iz=1,Rfe=(function(e){function t(){var r;Cfe(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=Tfe(this,t,[].concat(o)),sA(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),sA(r,"handleKeyDown",function(s){if(s.key==="Escape"){var l,c,u,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),r}return Ofe(t,e),Afe(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>Iz||Math.abs(n.height-this.state.lastBoundingBox.height)>Iz)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,o;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((o=this.props.coordinate)===null||o===void 0?void 0:o.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,o=this.props,a=o.active,s=o.allowEscapeViewBox,l=o.animationDuration,c=o.animationEasing,u=o.children,d=o.coordinate,f=o.hasPayload,h=o.isAnimationActive,p=o.offset,v=o.position,m=o.reverseDirection,b=o.useTranslate3d,x=o.viewBox,w=o.wrapperStyle,k=_fe({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:v,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:b,viewBox:x}),j=k.cssClasses,_=k.cssProperties,T=Pz(Pz({transition:h&&a?"transform ".concat(l,"ms ").concat(c):void 0},_),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},w);return $e.createElement("div",{tabIndex:-1,className:j,style:T,ref:function(P){n.wrapperNode=P}},u)}}])})(S.PureComponent),Lfe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Yh={isSsr:Lfe()};function Dm(e){"@babel/helpers - typeof";return Dm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dm(e)}function Oz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Nz(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Oz(Object(r),!0).forEach(function(n){uP(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oz(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ffe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zfe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,lV(n.key),n)}}function Mfe(e,t,r){return t&&zfe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dfe(e,t,r){return t=E2(t),Bfe(e,sV()?Reflect.construct(t,r||[],E2(e).constructor):t.apply(e,r))}function Bfe(e,t){if(t&&(Dm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wfe(e)}function Wfe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sV(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sV=function(){return!!e})()}function E2(e){return E2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},E2(e)}function qfe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&lA(e,t)}function lA(e,t){return lA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},lA(e,t)}function uP(e,t,r){return t=lV(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lV(e){var t=$fe(e,"string");return Dm(t)=="symbol"?t:t+""}function $fe(e,t){if(Dm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Dm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Ufe(e){return e.dataKey}function Hfe(e,t){return $e.isValidElement(e)?$e.cloneElement(e,t):typeof e=="function"?$e.createElement(e,t):$e.createElement(xfe,t)}var Tl=(function(e){function t(){return Ffe(this,t),Dfe(this,t,arguments)}return qfe(t,e),Mfe(t,[{key:"render",value:function(){var n=this,o=this.props,a=o.active,s=o.allowEscapeViewBox,l=o.animationDuration,c=o.animationEasing,u=o.content,d=o.coordinate,f=o.filterNull,h=o.isAnimationActive,p=o.offset,v=o.payload,m=o.payloadUniqBy,b=o.position,x=o.reverseDirection,w=o.useTranslate3d,k=o.viewBox,j=o.wrapperStyle,_=v??[];f&&_.length&&(_=ZH(v.filter(function(A){return A.value!=null&&(A.hide!==!0||n.props.includeHidden)}),m,Ufe));var T=_.length>0;return $e.createElement(Rfe,{allowEscapeViewBox:s,animationDuration:l,animationEasing:c,isAnimationActive:h,active:a,coordinate:d,hasPayload:T,offset:p,position:b,reverseDirection:x,useTranslate3d:w,viewBox:k,wrapperStyle:j},Hfe(u,Nz(Nz({},this.props),{},{payload:_})))}}])})(S.PureComponent);uP(Tl,"displayName","Tooltip");uP(Tl,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Yh.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var r4,Rz;function Vfe(){if(Rz)return r4;Rz=1;var e=du(),t=function(){return e.Date.now()};return r4=t,r4}var n4,Lz;function Yfe(){if(Lz)return n4;Lz=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return n4=t,n4}var i4,Fz;function Gfe(){if(Fz)return i4;Fz=1;var e=Yfe(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return i4=r,i4}var o4,zz;function cV(){if(zz)return o4;zz=1;var e=Gfe(),t=Jf(),r=Cv(),n=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function c(u){if(typeof u=="number")return u;if(r(u))return n;if(t(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=t(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=a.test(u);return f||s.test(u)?l(u.slice(2),f?2:8):o.test(u)?n:+u}return o4=c,o4}var a4,Mz;function Kfe(){if(Mz)return a4;Mz=1;var e=Jf(),t=Vfe(),r=cV(),n="Expected a function",o=Math.max,a=Math.min;function s(l,c,u){var d,f,h,p,v,m,b=0,x=!1,w=!1,k=!0;if(typeof l!="function")throw new TypeError(n);c=r(c)||0,e(u)&&(x=!!u.leading,w="maxWait"in u,h=w?o(r(u.maxWait)||0,c):h,k="trailing"in u?!!u.trailing:k);function j(R){var F=d,M=f;return d=f=void 0,b=R,p=l.apply(M,F),p}function _(R){return b=R,v=setTimeout(P,c),x?j(R):p}function T(R){var F=R-m,M=R-b,Y=c-F;return w?a(Y,h-M):Y}function A(R){var F=R-m,M=R-b;return m===void 0||F>=c||F<0||w&&M>=h}function P(){var R=t();if(A(R))return N(R);v=setTimeout(P,T(R))}function N(R){return v=void 0,k&&d?j(R):(d=f=void 0,p)}function O(){v!==void 0&&clearTimeout(v),b=0,d=m=f=v=void 0}function C(){return v===void 0?p:N(t())}function I(){var R=t(),F=A(R);if(d=arguments,f=this,m=R,F){if(v===void 0)return _(m);if(w)return clearTimeout(v),v=setTimeout(P,c),j(m)}return v===void 0&&(v=setTimeout(P,c)),p}return I.cancel=O,I.flush=C,I}return a4=s,a4}var s4,Dz;function Qfe(){if(Dz)return s4;Dz=1;var e=Kfe(),t=Jf(),r="Expected a function";function n(o,a,s){var l=!0,c=!0;if(typeof o!="function")throw new TypeError(r);return t(s)&&(l="leading"in s?!!s.leading:l,c="trailing"in s?!!s.trailing:c),e(o,a,{leading:l,maxWait:a,trailing:c})}return s4=n,s4}var Xfe=Qfe();const uV=dn(Xfe);function Nx(e){"@babel/helpers - typeof";return Nx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nx(e)}function Bz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function r1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bz(Object(r),!0).forEach(function(n){Zfe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bz(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zfe(e,t,r){return t=Jfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jfe(e){var t=epe(e,"string");return Nx(t)=="symbol"?t:t+""}function epe(e,t){if(Nx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Nx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tpe(e,t){return ope(e)||ipe(e,t)||npe(e,t)||rpe()}function rpe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function npe(e,t){if(e){if(typeof e=="string")return Wz(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wz(e,t)}}function Wz(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ipe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function ope(e){if(Array.isArray(e))return e}var l4=S.forwardRef(function(e,t){var r=e.aspect,n=e.initialDimension,o=n===void 0?{width:-1,height:-1}:n,a=e.width,s=a===void 0?"100%":a,l=e.height,c=l===void 0?"100%":l,u=e.minWidth,d=u===void 0?0:u,f=e.minHeight,h=e.maxHeight,p=e.children,v=e.debounce,m=v===void 0?0:v,b=e.id,x=e.className,w=e.onResize,k=e.style,j=k===void 0?{}:k,_=S.useRef(null),T=S.useRef();T.current=w,S.useImperativeHandle(t,function(){return Object.defineProperty(_.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),_.current},configurable:!0})});var A=S.useState({containerWidth:o.width,containerHeight:o.height}),P=tpe(A,2),N=P[0],O=P[1],C=S.useCallback(function(R,F){O(function(M){var Y=Math.round(R),X=Math.round(F);return M.containerWidth===Y&&M.containerHeight===X?M:{containerWidth:Y,containerHeight:X}})},[]);S.useEffect(function(){var R=function(ee){var V,D=ee[0].contentRect,z=D.width,q=D.height;C(z,q),(V=T.current)===null||V===void 0||V.call(T,z,q)};m>0&&(R=uV(R,m,{trailing:!0,leading:!1}));var F=new ResizeObserver(R),M=_.current.getBoundingClientRect(),Y=M.width,X=M.height;return C(Y,X),F.observe(_.current),function(){F.disconnect()}},[C,m]);var I=S.useMemo(function(){var R=N.containerWidth,F=N.containerHeight;if(R<0||F<0)return null;dc(lh(s)||lh(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,s,c),dc(!r||r>0,"The aspect(%s) must be greater than zero.",r);var M=lh(s)?R:s,Y=lh(c)?F:c;r&&r>0&&(M?Y=M/r:Y&&(M=Y*r),h&&Y>h&&(Y=h)),dc(M>0||Y>0,`The width(%s) and height(%s) of chart should be greater than 0,
please check the style of container, or the props width(%s) and height(%s),
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
height and width.`,M,Y,s,c,d,f,r);var X=!Array.isArray(p)&&pd(p.type).endsWith("Chart");return $e.Children.map(p,function($){return $e.isValidElement($)?S.cloneElement($,r1({width:M,height:Y},X?{style:r1({height:"100%",width:"100%",maxHeight:Y,maxWidth:M},$.props.style)}:{})):$})},[r,p,c,h,f,d,N,s]);return $e.createElement("div",{id:b?"".concat(b):void 0,className:Fr("recharts-responsive-container",x),style:r1(r1({},j),{},{width:s,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:_},I)}),AS=function(t){return null};AS.displayName="Cell";function Rx(e){"@babel/helpers - typeof";return Rx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rx(e)}function qz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function cA(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qz(Object(r),!0).forEach(function(n){ape(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qz(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ape(e,t,r){return t=spe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function spe(e){var t=lpe(e,"string");return Rx(t)=="symbol"?t:t+""}function lpe(e,t){if(Rx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Rx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Mg={widthCache:{},cacheCount:0},cpe=2e3,upe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},$z="recharts_measurement_span";function dpe(e){var t=cA({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var nx=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Yh.isSsr)return{width:0,height:0};var n=dpe(r),o=JSON.stringify({text:t,copyStyle:n});if(Mg.widthCache[o])return Mg.widthCache[o];try{var a=document.getElementById($z);a||(a=document.createElement("span"),a.setAttribute("id",$z),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var s=cA(cA({},upe),n);Object.assign(a.style,s),a.textContent="".concat(t);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return Mg.widthCache[o]=c,++Mg.cacheCount>cpe&&(Mg.cacheCount=0,Mg.widthCache={}),c}catch{return{width:0,height:0}}},fpe=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Lx(e){"@babel/helpers - typeof";return Lx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lx(e)}function A2(e,t){return mpe(e)||gpe(e,t)||hpe(e,t)||ppe()}function ppe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hpe(e,t){if(e){if(typeof e=="string")return Uz(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Uz(e,t)}}function Uz(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gpe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function mpe(e){if(Array.isArray(e))return e}function vpe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hz(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xpe(n.key),n)}}function ype(e,t,r){return t&&Hz(e.prototype,t),r&&Hz(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xpe(e){var t=bpe(e,"string");return Lx(t)=="symbol"?t:t+""}function bpe(e,t){if(Lx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Lx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Vz=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Yz=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,wpe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Spe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,dV={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},jpe=Object.keys(dV),rm="NaN";function kpe(e,t){return e*dV[t]}var n1=(function(){function e(t,r){vpe(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!wpe.test(r)&&(this.num=NaN,this.unit=""),jpe.includes(r)&&(this.num=kpe(t,r),this.unit="px")}return ype(e,[{key:"add",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,o=(n=Spe.exec(r))!==null&&n!==void 0?n:[],a=A2(o,3),s=a[1],l=a[2];return new e(parseFloat(s),l??"")}}])})();function fV(e){if(e.includes(rm))return rm;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=Vz.exec(t))!==null&&r!==void 0?r:[],o=A2(n,4),a=o[1],s=o[2],l=o[3],c=n1.parse(a??""),u=n1.parse(l??""),d=s==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return rm;t=t.replace(Vz,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,h=(f=Yz.exec(t))!==null&&f!==void 0?f:[],p=A2(h,4),v=p[1],m=p[2],b=p[3],x=n1.parse(v??""),w=n1.parse(b??""),k=m==="+"?x.add(w):x.subtract(w);if(k.isNaN())return rm;t=t.replace(Yz,k.toString())}return t}var Gz=/\(([^()]*)\)/;function _pe(e){for(var t=e;t.includes("(");){var r=Gz.exec(t),n=A2(r,2),o=n[1];t=t.replace(Gz,fV(o))}return t}function Cpe(e){var t=e.replace(/\s+/g,"");return t=_pe(t),t=fV(t),t}function Epe(e){try{return Cpe(e)}catch{return rm}}function c4(e){var t=Epe(e.slice(5,-1));return t===rm?"":t}var Ape=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],Tpe=["dx","dy","angle","className","breakAll"];function uA(){return uA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},uA.apply(this,arguments)}function Kz(e,t){if(e==null)return{};var r=Ppe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ppe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Qz(e,t){return Rpe(e)||Npe(e,t)||Ope(e,t)||Ipe()}function Ipe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ope(e,t){if(e){if(typeof e=="string")return Xz(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xz(e,t)}}function Xz(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Npe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function Rpe(e){if(Array.isArray(e))return e}var pV=/[ \f\n\r\t\v\u2028\u2029]+/,hV=function(t){var r=t.children,n=t.breakAll,o=t.style;try{var a=[];Rr(r)||(n?a=r.toString().split(""):a=r.toString().split(pV));var s=a.map(function(c){return{word:c,width:nx(c,o).width}}),l=n?0:nx(" ",o).width;return{wordsWithComputedWidth:s,spaceWidth:l}}catch{return null}},Lpe=function(t,r,n,o,a){var s=t.maxLines,l=t.children,c=t.style,u=t.breakAll,d=qt(s),f=l,h=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return M.reduce(function(Y,X){var $=X.word,ee=X.width,V=Y[Y.length-1];if(V&&(o==null||a||V.width+ee+n<Number(o)))V.words.push($),V.width+=ee+n;else{var D={words:[$],width:ee};Y.push(D)}return Y},[])},p=h(r),v=function(M){return M.reduce(function(Y,X){return Y.width>X.width?Y:X})};if(!d)return p;for(var m="…",b=function(M){var Y=f.slice(0,M),X=hV({breakAll:u,style:c,children:Y+m}).wordsWithComputedWidth,$=h(X),ee=$.length>s||v($).width>Number(o);return[ee,$]},x=0,w=f.length-1,k=0,j;x<=w&&k<=f.length-1;){var _=Math.floor((x+w)/2),T=_-1,A=b(T),P=Qz(A,2),N=P[0],O=P[1],C=b(_),I=Qz(C,1),R=I[0];if(!N&&!R&&(x=_+1),N&&R&&(w=_-1),!N&&R){j=O;break}k++}return j||p},Zz=function(t){var r=Rr(t)?[]:t.toString().split(pV);return[{words:r}]},Fpe=function(t){var r=t.width,n=t.scaleToFit,o=t.children,a=t.style,s=t.breakAll,l=t.maxLines;if((r||n)&&!Yh.isSsr){var c,u,d=hV({breakAll:s,children:o,style:a});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return Zz(o);return Lpe({breakAll:s,children:o,maxLines:l,style:a},c,u,r,n)}return Zz(o)},Jz="#808080",Ah=function(t){var r=t.x,n=r===void 0?0:r,o=t.y,a=o===void 0?0:o,s=t.lineHeight,l=s===void 0?"1em":s,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,v=t.verticalAnchor,m=v===void 0?"end":v,b=t.fill,x=b===void 0?Jz:b,w=Kz(t,Ape),k=S.useMemo(function(){return Fpe({breakAll:w.breakAll,children:w.children,maxLines:w.maxLines,scaleToFit:f,style:w.style,width:w.width})},[w.breakAll,w.children,w.maxLines,f,w.style,w.width]),j=w.dx,_=w.dy,T=w.angle,A=w.className,P=w.breakAll,N=Kz(w,Tpe);if(!mo(n)||!mo(a))return null;var O=n+(qt(j)?j:0),C=a+(qt(_)?_:0),I;switch(m){case"start":I=c4("calc(".concat(u,")"));break;case"middle":I=c4("calc(".concat((k.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:I=c4("calc(".concat(k.length-1," * -").concat(l,")"));break}var R=[];if(f){var F=k[0].width,M=w.width;R.push("scale(".concat((qt(M)?M/F:1)/F,")"))}return T&&R.push("rotate(".concat(T,", ").concat(O,", ").concat(C,")")),R.length&&(N.transform=R.join(" ")),$e.createElement("text",uA({},yr(N,!0),{x:O,y:C,className:Fr("recharts-text",A),textAnchor:p,fill:x.includes("url")?Jz:x}),k.map(function(Y,X){var $=Y.words.join(P?"":" ");return $e.createElement("tspan",{x:O,dy:X===0?I:l,key:"".concat($,"-").concat(X)},$)}))};function zf(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function zpe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function dP(e){let t,r,n;e.length!==2?(t=zf,r=(l,c)=>zf(e(l),c),n=(l,c)=>e(l)-c):(t=e===zf||e===zpe?e:Mpe,r=e,n=e);function o(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function a(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function s(l,c,u=0,d=l.length){const f=o(l,c,u,d-1);return f>u&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:o,center:s,right:a}}function Mpe(){return 0}function gV(e){return e===null?NaN:+e}function*Dpe(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const Bpe=dP(zf),Lb=Bpe.right;dP(gV).center;class eM extends Map{constructor(t,r=$pe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,o]of t)this.set(n,o)}get(t){return super.get(tM(this,t))}has(t){return super.has(tM(this,t))}set(t,r){return super.set(Wpe(this,t),r)}delete(t){return super.delete(qpe(this,t))}}function tM({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Wpe({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function qpe({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function $pe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Upe(e=zf){if(e===zf)return mV;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function mV(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Hpe=Math.sqrt(50),Vpe=Math.sqrt(10),Ype=Math.sqrt(2);function T2(e,t,r){const n=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(n)),a=n/Math.pow(10,o),s=a>=Hpe?10:a>=Vpe?5:a>=Ype?2:1;let l,c,u;return o<0?(u=Math.pow(10,-o)/s,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,o)*s,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=r&&r<2?T2(e,t,r*2):[l,c,u]}function dA(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[o,a,s]=n?T2(t,e,r):T2(e,t,r);if(!(a>=o))return[];const l=a-o+1,c=new Array(l);if(n)if(s<0)for(let u=0;u<l;++u)c[u]=(a-u)/-s;else for(let u=0;u<l;++u)c[u]=(a-u)*s;else if(s<0)for(let u=0;u<l;++u)c[u]=(o+u)/-s;else for(let u=0;u<l;++u)c[u]=(o+u)*s;return c}function fA(e,t,r){return t=+t,e=+e,r=+r,T2(e,t,r)[2]}function pA(e,t,r){t=+t,e=+e,r=+r;const n=t<e,o=n?fA(t,e,r):fA(e,t,r);return(n?-1:1)*(o<0?1/-o:o)}function rM(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function nM(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function vV(e,t,r=0,n=1/0,o){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(o=o===void 0?mV:Upe(o);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(r,Math.floor(t-u*f/c+h)),v=Math.min(n,Math.floor(t+(c-u)*f/c+h));vV(e,t,p,v,o)}const a=e[t];let s=r,l=n;for(Sy(e,r,t),o(e[n],a)>0&&Sy(e,r,n);s<l;){for(Sy(e,s,l),++s,--l;o(e[s],a)<0;)++s;for(;o(e[l],a)>0;)--l}o(e[r],a)===0?Sy(e,r,l):(++l,Sy(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Sy(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Gpe(e,t,r){if(e=Float64Array.from(Dpe(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return nM(e);if(t>=1)return rM(e);var n,o=(n-1)*t,a=Math.floor(o),s=rM(vV(e,a).subarray(0,a+1)),l=nM(e.subarray(a+1));return s+(l-s)*(o-a)}}function Kpe(e,t,r=gV){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,o=(n-1)*t,a=Math.floor(o),s=+r(e[a],a,e),l=+r(e[a+1],a+1,e);return s+(l-s)*(o-a)}}function Qpe(e,t,r){e=+e,t=+t,r=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+r;for(var n=-1,o=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(o);++n<o;)a[n]=e+n*r;return a}function Ml(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Id(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const hA=Symbol("implicit");function fP(){var e=new eM,t=[],r=[],n=hA;function o(a){let s=e.get(a);if(s===void 0){if(n!==hA)return n;e.set(a,s=t.push(a)-1)}return r[s%r.length]}return o.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new eM;for(const s of a)e.has(s)||e.set(s,t.push(s)-1);return o},o.range=function(a){return arguments.length?(r=Array.from(a),o):r.slice()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.copy=function(){return fP(t,r).unknown(n)},Ml.apply(o,arguments),o}function Fx(){var e=fP().unknown(void 0),t=e.domain,r=e.range,n=0,o=1,a,s,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var h=t().length,p=o<n,v=p?o:n,m=p?n:o;a=(m-v)/Math.max(1,h-c+u*2),l&&(a=Math.floor(a)),v+=(m-v-a*(h-c))*d,s=a*(1-c),l&&(v=Math.round(v),s=Math.round(s));var b=Qpe(h).map(function(x){return v+a*x});return r(p?b.reverse():b)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([n,o]=h,n=+n,o=+o,f()):[n,o]},e.rangeRound=function(h){return[n,o]=h,n=+n,o=+o,l=!0,f()},e.bandwidth=function(){return s},e.step=function(){return a},e.round=function(h){return arguments.length?(l=!!h,f()):l},e.padding=function(h){return arguments.length?(c=Math.min(1,u=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(u=+h,f()):u},e.align=function(h){return arguments.length?(d=Math.max(0,Math.min(1,h)),f()):d},e.copy=function(){return Fx(t(),[n,o]).round(l).paddingInner(c).paddingOuter(u).align(d)},Ml.apply(f(),arguments)}function yV(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return yV(t())},e}function ix(){return yV(Fx.apply(null,arguments).paddingInner(1))}function pP(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function xV(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Fb(){}var zx=.7,P2=1/zx,vm="\\s*([+-]?\\d+)\\s*",Mx="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",iu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xpe=/^#([0-9a-f]{3,8})$/,Zpe=new RegExp(`^rgb\\(${vm},${vm},${vm}\\)$`),Jpe=new RegExp(`^rgb\\(${iu},${iu},${iu}\\)$`),ehe=new RegExp(`^rgba\\(${vm},${vm},${vm},${Mx}\\)$`),the=new RegExp(`^rgba\\(${iu},${iu},${iu},${Mx}\\)$`),rhe=new RegExp(`^hsl\\(${Mx},${iu},${iu}\\)$`),nhe=new RegExp(`^hsla\\(${Mx},${iu},${iu},${Mx}\\)$`),iM={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};pP(Fb,Dx,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:oM,formatHex:oM,formatHex8:ihe,formatHsl:ohe,formatRgb:aM,toString:aM});function oM(){return this.rgb().formatHex()}function ihe(){return this.rgb().formatHex8()}function ohe(){return bV(this).formatHsl()}function aM(){return this.rgb().formatRgb()}function Dx(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Xpe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?sM(t):r===3?new us(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?i1(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?i1(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Zpe.exec(e))?new us(t[1],t[2],t[3],1):(t=Jpe.exec(e))?new us(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ehe.exec(e))?i1(t[1],t[2],t[3],t[4]):(t=the.exec(e))?i1(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=rhe.exec(e))?uM(t[1],t[2]/100,t[3]/100,1):(t=nhe.exec(e))?uM(t[1],t[2]/100,t[3]/100,t[4]):iM.hasOwnProperty(e)?sM(iM[e]):e==="transparent"?new us(NaN,NaN,NaN,0):null}function sM(e){return new us(e>>16&255,e>>8&255,e&255,1)}function i1(e,t,r,n){return n<=0&&(e=t=r=NaN),new us(e,t,r,n)}function ahe(e){return e instanceof Fb||(e=Dx(e)),e?(e=e.rgb(),new us(e.r,e.g,e.b,e.opacity)):new us}function gA(e,t,r,n){return arguments.length===1?ahe(e):new us(e,t,r,n??1)}function us(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}pP(us,gA,xV(Fb,{brighter(e){return e=e==null?P2:Math.pow(P2,e),new us(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zx:Math.pow(zx,e),new us(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new us(mh(this.r),mh(this.g),mh(this.b),I2(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:lM,formatHex:lM,formatHex8:she,formatRgb:cM,toString:cM}));function lM(){return`#${ch(this.r)}${ch(this.g)}${ch(this.b)}`}function she(){return`#${ch(this.r)}${ch(this.g)}${ch(this.b)}${ch((isNaN(this.opacity)?1:this.opacity)*255)}`}function cM(){const e=I2(this.opacity);return`${e===1?"rgb(":"rgba("}${mh(this.r)}, ${mh(this.g)}, ${mh(this.b)}${e===1?")":`, ${e})`}`}function I2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function mh(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ch(e){return e=mh(e),(e<16?"0":"")+e.toString(16)}function uM(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new oc(e,t,r,n)}function bV(e){if(e instanceof oc)return new oc(e.h,e.s,e.l,e.opacity);if(e instanceof Fb||(e=Dx(e)),!e)return new oc;if(e instanceof oc)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,o=Math.min(t,r,n),a=Math.max(t,r,n),s=NaN,l=a-o,c=(a+o)/2;return l?(t===a?s=(r-n)/l+(r<n)*6:r===a?s=(n-t)/l+2:s=(t-r)/l+4,l/=c<.5?a+o:2-a-o,s*=60):l=c>0&&c<1?0:s,new oc(s,l,c,e.opacity)}function lhe(e,t,r,n){return arguments.length===1?bV(e):new oc(e,t,r,n??1)}function oc(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}pP(oc,lhe,xV(Fb,{brighter(e){return e=e==null?P2:Math.pow(P2,e),new oc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zx:Math.pow(zx,e),new oc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,o=2*r-n;return new us(u4(e>=240?e-240:e+120,o,n),u4(e,o,n),u4(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new oc(dM(this.h),o1(this.s),o1(this.l),I2(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=I2(this.opacity);return`${e===1?"hsl(":"hsla("}${dM(this.h)}, ${o1(this.s)*100}%, ${o1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function dM(e){return e=(e||0)%360,e<0?e+360:e}function o1(e){return Math.max(0,Math.min(1,e||0))}function u4(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const hP=e=>()=>e;function che(e,t){return function(r){return e+r*t}}function uhe(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function dhe(e){return(e=+e)==1?wV:function(t,r){return r-t?uhe(t,r,e):hP(isNaN(t)?r:t)}}function wV(e,t){var r=t-e;return r?che(e,r):hP(isNaN(e)?t:e)}const fM=(function e(t){var r=dhe(t);function n(o,a){var s=r((o=gA(o)).r,(a=gA(a)).r),l=r(o.g,a.g),c=r(o.b,a.b),u=wV(o.opacity,a.opacity);return function(d){return o.r=s(d),o.g=l(d),o.b=c(d),o.opacity=u(d),o+""}}return n.gamma=e,n})(1);function fhe(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),o;return function(a){for(o=0;o<r;++o)n[o]=e[o]*(1-a)+t[o]*a;return n}}function phe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hhe(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,o=new Array(n),a=new Array(r),s;for(s=0;s<n;++s)o[s]=Pv(e[s],t[s]);for(;s<r;++s)a[s]=t[s];return function(l){for(s=0;s<n;++s)a[s]=o[s](l);return a}}function ghe(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function O2(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function mhe(e,t){var r={},n={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?r[o]=Pv(e[o],t[o]):n[o]=t[o];return function(a){for(o in r)n[o]=r[o](a);return n}}var mA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,d4=new RegExp(mA.source,"g");function vhe(e){return function(){return e}}function yhe(e){return function(t){return e(t)+""}}function xhe(e,t){var r=mA.lastIndex=d4.lastIndex=0,n,o,a,s=-1,l=[],c=[];for(e=e+"",t=t+"";(n=mA.exec(e))&&(o=d4.exec(t));)(a=o.index)>r&&(a=t.slice(r,a),l[s]?l[s]+=a:l[++s]=a),(n=n[0])===(o=o[0])?l[s]?l[s]+=o:l[++s]=o:(l[++s]=null,c.push({i:s,x:O2(n,o)})),r=d4.lastIndex;return r<t.length&&(a=t.slice(r),l[s]?l[s]+=a:l[++s]=a),l.length<2?c[0]?yhe(c[0].x):vhe(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function Pv(e,t){var r=typeof t,n;return t==null||r==="boolean"?hP(t):(r==="number"?O2:r==="string"?(n=Dx(t))?(t=n,fM):xhe:t instanceof Dx?fM:t instanceof Date?ghe:phe(t)?fhe:Array.isArray(t)?hhe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?mhe:O2)(e,t)}function gP(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function bhe(e,t){t===void 0&&(t=e,e=Pv);for(var r=0,n=t.length-1,o=t[0],a=new Array(n<0?0:n);r<n;)a[r]=e(o,o=t[++r]);return function(s){var l=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return a[l](s-l)}}function whe(e){return function(){return e}}function N2(e){return+e}var pM=[0,1];function Ha(e){return e}function vA(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:whe(isNaN(t)?NaN:.5)}function She(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function jhe(e,t,r){var n=e[0],o=e[1],a=t[0],s=t[1];return o<n?(n=vA(o,n),a=r(s,a)):(n=vA(n,o),a=r(a,s)),function(l){return a(n(l))}}function khe(e,t,r){var n=Math.min(e.length,t.length)-1,o=new Array(n),a=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)o[s]=vA(e[s],e[s+1]),a[s]=r(t[s],t[s+1]);return function(l){var c=Lb(e,l,1,n)-1;return a[c](o[c](l))}}function zb(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function TS(){var e=pM,t=pM,r=Pv,n,o,a,s=Ha,l,c,u;function d(){var h=Math.min(e.length,t.length);return s!==Ha&&(s=She(e[0],e[h-1])),l=h>2?khe:jhe,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?a:(c||(c=l(e.map(n),t,r)))(n(s(h)))}return f.invert=function(h){return s(o((u||(u=l(t,e.map(n),O2)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,N2),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),r=gP,d()},f.clamp=function(h){return arguments.length?(s=h?!0:Ha,d()):s!==Ha},f.interpolate=function(h){return arguments.length?(r=h,d()):r},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return n=h,o=p,d()}}function mP(){return TS()(Ha,Ha)}function _he(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function R2(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Bm(e){return e=R2(Math.abs(e)),e?e[1]:NaN}function Che(e,t){return function(r,n){for(var o=r.length,a=[],s=0,l=e[0],c=0;o>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),a.push(r.substring(o-=l,o+l)),!((c+=l+1)>n));)l=e[s=(s+1)%e.length];return a.reverse().join(t)}}function Ehe(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Ahe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Bx(e){if(!(t=Ahe.exec(e)))throw new Error("invalid format: "+e);var t;return new vP({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Bx.prototype=vP.prototype;function vP(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}vP.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function The(e){e:for(var t=e.length,r=1,n=-1,o;r<t;++r)switch(e[r]){case".":n=o=r;break;case"0":n===0&&(n=r),o=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(o+1):e}var L2;function Phe(e,t){var r=R2(e,t);if(!r)return L2=void 0,e.toPrecision(t);var n=r[0],o=r[1],a=o-(L2=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,s=n.length;return a===s?n:a>s?n+new Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+R2(e,Math.max(0,t+a-1))[0]}function hM(e,t){var r=R2(e,t);if(!r)return e+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}const gM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:_he,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>hM(e*100,t),r:hM,s:Phe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function mM(e){return e}var vM=Array.prototype.map,yM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ihe(e){var t=e.grouping===void 0||e.thousands===void 0?mM:Che(vM.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?mM:Ehe(vM.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f,h){f=Bx(f);var p=f.fill,v=f.align,m=f.sign,b=f.symbol,x=f.zero,w=f.width,k=f.comma,j=f.precision,_=f.trim,T=f.type;T==="n"?(k=!0,T="g"):gM[T]||(j===void 0&&(j=12),_=!0,T="g"),(x||p==="0"&&v==="=")&&(x=!0,p="0",v="=");var A=(h&&h.prefix!==void 0?h.prefix:"")+(b==="$"?r:b==="#"&&/[boxX]/.test(T)?"0"+T.toLowerCase():""),P=(b==="$"?n:/[%p]/.test(T)?s:"")+(h&&h.suffix!==void 0?h.suffix:""),N=gM[T],O=/[defgprs%]/.test(T);j=j===void 0?6:/[gprs]/.test(T)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function C(I){var R=A,F=P,M,Y,X;if(T==="c")F=N(I)+F,I="";else{I=+I;var $=I<0||1/I<0;if(I=isNaN(I)?c:N(Math.abs(I),j),_&&(I=The(I)),$&&+I==0&&m!=="+"&&($=!1),R=($?m==="("?m:l:m==="-"||m==="("?"":m)+R,F=(T==="s"&&!isNaN(I)&&L2!==void 0?yM[8+L2/3]:"")+F+($&&m==="("?")":""),O){for(M=-1,Y=I.length;++M<Y;)if(X=I.charCodeAt(M),48>X||X>57){F=(X===46?o+I.slice(M+1):I.slice(M))+F,I=I.slice(0,M);break}}}k&&!x&&(I=t(I,1/0));var ee=R.length+I.length+F.length,V=ee<w?new Array(w-ee+1).join(p):"";switch(k&&x&&(I=t(V+I,V.length?w-F.length:1/0),V=""),v){case"<":I=R+I+F+V;break;case"=":I=R+V+I+F;break;case"^":I=V.slice(0,ee=V.length>>1)+R+I+F+V.slice(ee);break;default:I=V+R+I+F;break}return a(I)}return C.toString=function(){return f+""},C}function d(f,h){var p=Math.max(-8,Math.min(8,Math.floor(Bm(h)/3)))*3,v=Math.pow(10,-p),m=u((f=Bx(f),f.type="f",f),{suffix:yM[8+p/3]});return function(b){return m(v*b)}}return{format:u,formatPrefix:d}}var a1,yP,SV;Ohe({thousands:",",grouping:[3],currency:["$",""]});function Ohe(e){return a1=Ihe(e),yP=a1.format,SV=a1.formatPrefix,a1}function Nhe(e){return Math.max(0,-Bm(Math.abs(e)))}function Rhe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bm(t)/3)))*3-Bm(Math.abs(e)))}function Lhe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Bm(t)-Bm(e))+1}function jV(e,t,r,n){var o=pA(e,t,r),a;switch(n=Bx(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=Rhe(o,s))&&(n.precision=a),SV(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=Lhe(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=Nhe(o))&&(n.precision=a-(n.type==="%")*2);break}}return yP(n)}function ep(e){var t=e.domain;return e.ticks=function(r){var n=t();return dA(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return jV(o[0],o[o.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),o=0,a=n.length-1,s=n[o],l=n[a],c,u,d=10;for(l<s&&(u=s,s=l,l=u,u=o,o=a,a=u);d-- >0;){if(u=fA(s,l,r),u===c)return n[o]=s,n[a]=l,t(n);if(u>0)s=Math.floor(s/u)*u,l=Math.ceil(l/u)*u;else if(u<0)s=Math.ceil(s*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function F2(){var e=mP();return e.copy=function(){return zb(e,F2())},Ml.apply(e,arguments),ep(e)}function kV(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,N2),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return kV(e).unknown(t)},e=arguments.length?Array.from(e,N2):[0,1],ep(r)}function _V(e,t){e=e.slice();var r=0,n=e.length-1,o=e[r],a=e[n],s;return a<o&&(s=r,r=n,n=s,s=o,o=a,a=s),e[r]=t.floor(o),e[n]=t.ceil(a),e}function xM(e){return Math.log(e)}function bM(e){return Math.exp(e)}function Fhe(e){return-Math.log(-e)}function zhe(e){return-Math.exp(-e)}function Mhe(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Dhe(e){return e===10?Mhe:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Bhe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function wM(e){return(t,r)=>-e(-t,r)}function xP(e){const t=e(xM,bM),r=t.domain;let n=10,o,a;function s(){return o=Bhe(n),a=Dhe(n),r()[0]<0?(o=wM(o),a=wM(a),e(Fhe,zhe)):e(xM,bM),t}return t.base=function(l){return arguments.length?(n=+l,s()):n},t.domain=function(l){return arguments.length?(r(l),s()):r()},t.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let h=o(u),p=o(d),v,m;const b=l==null?10:+l;let x=[];if(!(n%1)&&p-h<b){if(h=Math.floor(h),p=Math.ceil(p),u>0){for(;h<=p;++h)for(v=1;v<n;++v)if(m=h<0?v/a(-h):v*a(h),!(m<u)){if(m>d)break;x.push(m)}}else for(;h<=p;++h)for(v=n-1;v>=1;--v)if(m=h>0?v/a(-h):v*a(h),!(m<u)){if(m>d)break;x.push(m)}x.length*2<b&&(x=dA(u,d,b))}else x=dA(h,p,Math.min(p-h,b)).map(a);return f?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Bx(c)).precision==null&&(c.trim=!0),c=yP(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return d=>{let f=d/a(Math.round(o(d)));return f*n<n-.5&&(f*=n),f<=u?c(d):""}},t.nice=()=>r(_V(r(),{floor:l=>a(Math.floor(o(l))),ceil:l=>a(Math.ceil(o(l)))})),t}function CV(){const e=xP(TS()).domain([1,10]);return e.copy=()=>zb(e,CV()).base(e.base()),Ml.apply(e,arguments),e}function SM(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function jM(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function bP(e){var t=1,r=e(SM(t),jM(t));return r.constant=function(n){return arguments.length?e(SM(t=+n),jM(t)):t},ep(r)}function EV(){var e=bP(TS());return e.copy=function(){return zb(e,EV()).constant(e.constant())},Ml.apply(e,arguments)}function kM(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Whe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function qhe(e){return e<0?-e*e:e*e}function wP(e){var t=e(Ha,Ha),r=1;function n(){return r===1?e(Ha,Ha):r===.5?e(Whe,qhe):e(kM(r),kM(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},ep(t)}function SP(){var e=wP(TS());return e.copy=function(){return zb(e,SP()).exponent(e.exponent())},Ml.apply(e,arguments),e}function $he(){return SP.apply(null,arguments).exponent(.5)}function _M(e){return Math.sign(e)*e*e}function Uhe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function AV(){var e=mP(),t=[0,1],r=!1,n;function o(a){var s=Uhe(e(a));return isNaN(s)?n:r?Math.round(s):s}return o.invert=function(a){return e.invert(_M(a))},o.domain=function(a){return arguments.length?(e.domain(a),o):e.domain()},o.range=function(a){return arguments.length?(e.range((t=Array.from(a,N2)).map(_M)),o):t.slice()},o.rangeRound=function(a){return o.range(a).round(!0)},o.round=function(a){return arguments.length?(r=!!a,o):r},o.clamp=function(a){return arguments.length?(e.clamp(a),o):e.clamp()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.copy=function(){return AV(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Ml.apply(o,arguments),ep(o)}function TV(){var e=[],t=[],r=[],n;function o(){var s=0,l=Math.max(1,t.length);for(r=new Array(l-1);++s<l;)r[s-1]=Kpe(e,s/l);return a}function a(s){return s==null||isNaN(s=+s)?n:t[Lb(r,s)]}return a.invertExtent=function(s){var l=t.indexOf(s);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},a.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let l of s)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(zf),o()},a.range=function(s){return arguments.length?(t=Array.from(s),o()):t.slice()},a.unknown=function(s){return arguments.length?(n=s,a):n},a.quantiles=function(){return r.slice()},a.copy=function(){return TV().domain(e).range(t).unknown(n)},Ml.apply(a,arguments)}function PV(){var e=0,t=1,r=1,n=[.5],o=[0,1],a;function s(c){return c!=null&&c<=c?o[Lb(n,c,0,r)]:a}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+1);return s}return s.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},s.range=function(c){return arguments.length?(r=(o=Array.from(c)).length-1,l()):o.slice()},s.invertExtent=function(c){var u=o.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,n[0]]:u>=r?[n[r-1],t]:[n[u-1],n[u]]},s.unknown=function(c){return arguments.length&&(a=c),s},s.thresholds=function(){return n.slice()},s.copy=function(){return PV().domain([e,t]).range(o).unknown(a)},Ml.apply(ep(s),arguments)}function IV(){var e=[.5],t=[0,1],r,n=1;function o(a){return a!=null&&a<=a?t[Lb(e,a,0,n)]:r}return o.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),o):e.slice()},o.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),o):t.slice()},o.invertExtent=function(a){var s=t.indexOf(a);return[e[s-1],e[s]]},o.unknown=function(a){return arguments.length?(r=a,o):r},o.copy=function(){return IV().domain(e).range(t).unknown(r)},Ml.apply(o,arguments)}const f4=new Date,p4=new Date;function vo(e,t,r,n){function o(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return o.floor=a=>(e(a=new Date(+a)),a),o.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),o.round=a=>{const s=o(a),l=o.ceil(a);return a-s<l-a?s:l},o.offset=(a,s)=>(t(a=new Date(+a),s==null?1:Math.floor(s)),a),o.range=(a,s,l)=>{const c=[];if(a=o.ceil(a),l=l==null?1:Math.floor(l),!(a<s)||!(l>0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(u<a&&a<s);return c},o.filter=a=>vo(s=>{if(s>=s)for(;e(s),!a(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;t(s,-1),!a(s););else for(;--l>=0;)for(;t(s,1),!a(s););}),r&&(o.count=(a,s)=>(f4.setTime(+a),p4.setTime(+s),e(f4),e(p4),Math.floor(r(f4,p4))),o.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?o.filter(n?s=>n(s)%a===0:s=>o.count(0,s)%a===0):o)),o}const z2=vo(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);z2.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?vo(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):z2);z2.range;const od=1e3,Il=od*60,ad=Il*60,yd=ad*24,jP=yd*7,CM=yd*30,h4=yd*365,uh=vo(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*od)},(e,t)=>(t-e)/od,e=>e.getUTCSeconds());uh.range;const kP=vo(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*od)},(e,t)=>{e.setTime(+e+t*Il)},(e,t)=>(t-e)/Il,e=>e.getMinutes());kP.range;const _P=vo(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Il)},(e,t)=>(t-e)/Il,e=>e.getUTCMinutes());_P.range;const CP=vo(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*od-e.getMinutes()*Il)},(e,t)=>{e.setTime(+e+t*ad)},(e,t)=>(t-e)/ad,e=>e.getHours());CP.range;const EP=vo(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ad)},(e,t)=>(t-e)/ad,e=>e.getUTCHours());EP.range;const Mb=vo(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Il)/yd,e=>e.getDate()-1);Mb.range;const PS=vo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/yd,e=>e.getUTCDate()-1);PS.range;const OV=vo(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/yd,e=>Math.floor(e/yd));OV.range;function Gh(e){return vo(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Il)/jP)}const IS=Gh(0),M2=Gh(1),Hhe=Gh(2),Vhe=Gh(3),Wm=Gh(4),Yhe=Gh(5),Ghe=Gh(6);IS.range;M2.range;Hhe.range;Vhe.range;Wm.range;Yhe.range;Ghe.range;function Kh(e){return vo(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/jP)}const OS=Kh(0),D2=Kh(1),Khe=Kh(2),Qhe=Kh(3),qm=Kh(4),Xhe=Kh(5),Zhe=Kh(6);OS.range;D2.range;Khe.range;Qhe.range;qm.range;Xhe.range;Zhe.range;const AP=vo(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());AP.range;const TP=vo(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());TP.range;const xd=vo(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());xd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:vo(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});xd.range;const bd=vo(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());bd.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:vo(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});bd.range;function NV(e,t,r,n,o,a){const s=[[uh,1,od],[uh,5,5*od],[uh,15,15*od],[uh,30,30*od],[a,1,Il],[a,5,5*Il],[a,15,15*Il],[a,30,30*Il],[o,1,ad],[o,3,3*ad],[o,6,6*ad],[o,12,12*ad],[n,1,yd],[n,2,2*yd],[r,1,jP],[t,1,CM],[t,3,3*CM],[e,1,h4]];function l(u,d,f){const h=d<u;h&&([u,d]=[d,u]);const p=f&&typeof f.range=="function"?f:c(u,d,f),v=p?p.range(u,+d+1):[];return h?v.reverse():v}function c(u,d,f){const h=Math.abs(d-u)/f,p=dP(([,,b])=>b).right(s,h);if(p===s.length)return e.every(pA(u/h4,d/h4,f));if(p===0)return z2.every(Math.max(pA(u,d,f),1));const[v,m]=s[h/s[p-1][2]<s[p][2]/h?p-1:p];return v.every(m)}return[l,c]}const[Jhe,ege]=NV(bd,TP,OS,OV,EP,_P),[tge,rge]=NV(xd,AP,IS,Mb,CP,kP);function g4(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function m4(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function jy(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function nge(e){var t=e.dateTime,r=e.date,n=e.time,o=e.periods,a=e.days,s=e.shortDays,l=e.months,c=e.shortMonths,u=ky(o),d=_y(o),f=ky(a),h=_y(a),p=ky(s),v=_y(s),m=ky(l),b=_y(l),x=ky(c),w=_y(c),k={a:X,A:$,b:ee,B:V,c:null,d:OM,e:OM,f:Cge,g:Fge,G:Mge,H:jge,I:kge,j:_ge,L:RV,m:Ege,M:Age,p:D,q:z,Q:LM,s:FM,S:Tge,u:Pge,U:Ige,V:Oge,w:Nge,W:Rge,x:null,X:null,y:Lge,Y:zge,Z:Dge,"%":RM},j={a:q,A:G,b:U,B:Q,c:null,d:NM,e:NM,f:$ge,g:Jge,G:tme,H:Bge,I:Wge,j:qge,L:FV,m:Uge,M:Hge,p:K,q:re,Q:LM,s:FM,S:Vge,u:Yge,U:Gge,V:Kge,w:Qge,W:Xge,x:null,X:null,y:Zge,Y:eme,Z:rme,"%":RM},_={a:O,A:C,b:I,B:R,c:F,d:PM,e:PM,f:xge,g:TM,G:AM,H:IM,I:IM,j:gge,L:yge,m:hge,M:mge,p:N,q:pge,Q:wge,s:Sge,S:vge,u:lge,U:cge,V:uge,w:sge,W:dge,x:M,X:Y,y:TM,Y:AM,Z:fge,"%":bge};k.x=T(r,k),k.X=T(n,k),k.c=T(t,k),j.x=T(r,j),j.X=T(n,j),j.c=T(t,j);function T(H,ie){return function(de){var le=[],ke=-1,ve=0,se=H.length,be,De,ae;for(de instanceof Date||(de=new Date(+de));++ke<se;)H.charCodeAt(ke)===37&&(le.push(H.slice(ve,ke)),(De=EM[be=H.charAt(++ke)])!=null?be=H.charAt(++ke):De=be==="e"?" ":"0",(ae=ie[be])&&(be=ae(de,De)),le.push(be),ve=ke+1);return le.push(H.slice(ve,ke)),le.join("")}}function A(H,ie){return function(de){var le=jy(1900,void 0,1),ke=P(le,H,de+="",0),ve,se;if(ke!=de.length)return null;if("Q"in le)return new Date(le.Q);if("s"in le)return new Date(le.s*1e3+("L"in le?le.L:0));if(ie&&!("Z"in le)&&(le.Z=0),"p"in le&&(le.H=le.H%12+le.p*12),le.m===void 0&&(le.m="q"in le?le.q:0),"V"in le){if(le.V<1||le.V>53)return null;"w"in le||(le.w=1),"Z"in le?(ve=m4(jy(le.y,0,1)),se=ve.getUTCDay(),ve=se>4||se===0?D2.ceil(ve):D2(ve),ve=PS.offset(ve,(le.V-1)*7),le.y=ve.getUTCFullYear(),le.m=ve.getUTCMonth(),le.d=ve.getUTCDate()+(le.w+6)%7):(ve=g4(jy(le.y,0,1)),se=ve.getDay(),ve=se>4||se===0?M2.ceil(ve):M2(ve),ve=Mb.offset(ve,(le.V-1)*7),le.y=ve.getFullYear(),le.m=ve.getMonth(),le.d=ve.getDate()+(le.w+6)%7)}else("W"in le||"U"in le)&&("w"in le||(le.w="u"in le?le.u%7:"W"in le?1:0),se="Z"in le?m4(jy(le.y,0,1)).getUTCDay():g4(jy(le.y,0,1)).getDay(),le.m=0,le.d="W"in le?(le.w+6)%7+le.W*7-(se+5)%7:le.w+le.U*7-(se+6)%7);return"Z"in le?(le.H+=le.Z/100|0,le.M+=le.Z%100,m4(le)):g4(le)}}function P(H,ie,de,le){for(var ke=0,ve=ie.length,se=de.length,be,De;ke<ve;){if(le>=se)return-1;if(be=ie.charCodeAt(ke++),be===37){if(be=ie.charAt(ke++),De=_[be in EM?ie.charAt(ke++):be],!De||(le=De(H,de,le))<0)return-1}else if(be!=de.charCodeAt(le++))return-1}return le}function N(H,ie,de){var le=u.exec(ie.slice(de));return le?(H.p=d.get(le[0].toLowerCase()),de+le[0].length):-1}function O(H,ie,de){var le=p.exec(ie.slice(de));return le?(H.w=v.get(le[0].toLowerCase()),de+le[0].length):-1}function C(H,ie,de){var le=f.exec(ie.slice(de));return le?(H.w=h.get(le[0].toLowerCase()),de+le[0].length):-1}function I(H,ie,de){var le=x.exec(ie.slice(de));return le?(H.m=w.get(le[0].toLowerCase()),de+le[0].length):-1}function R(H,ie,de){var le=m.exec(ie.slice(de));return le?(H.m=b.get(le[0].toLowerCase()),de+le[0].length):-1}function F(H,ie,de){return P(H,t,ie,de)}function M(H,ie,de){return P(H,r,ie,de)}function Y(H,ie,de){return P(H,n,ie,de)}function X(H){return s[H.getDay()]}function $(H){return a[H.getDay()]}function ee(H){return c[H.getMonth()]}function V(H){return l[H.getMonth()]}function D(H){return o[+(H.getHours()>=12)]}function z(H){return 1+~~(H.getMonth()/3)}function q(H){return s[H.getUTCDay()]}function G(H){return a[H.getUTCDay()]}function U(H){return c[H.getUTCMonth()]}function Q(H){return l[H.getUTCMonth()]}function K(H){return o[+(H.getUTCHours()>=12)]}function re(H){return 1+~~(H.getUTCMonth()/3)}return{format:function(H){var ie=T(H+="",k);return ie.toString=function(){return H},ie},parse:function(H){var ie=A(H+="",!1);return ie.toString=function(){return H},ie},utcFormat:function(H){var ie=T(H+="",j);return ie.toString=function(){return H},ie},utcParse:function(H){var ie=A(H+="",!0);return ie.toString=function(){return H},ie}}}var EM={"-":"",_:" ",0:"0"},Do=/^\s*\d+/,ige=/^%/,oge=/[\\^$*+?|[\]().{}]/g;function un(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",a=o.length;return n+(a<r?new Array(r-a+1).join(t)+o:o)}function age(e){return e.replace(oge,"\\$&")}function ky(e){return new RegExp("^(?:"+e.map(age).join("|")+")","i")}function _y(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function sge(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function lge(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function cge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function uge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function dge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function AM(e,t,r){var n=Do.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function TM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function fge(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function pge(e,t,r){var n=Do.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function hge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function PM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function gge(e,t,r){var n=Do.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function IM(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function mge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function vge(e,t,r){var n=Do.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function yge(e,t,r){var n=Do.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function xge(e,t,r){var n=Do.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function bge(e,t,r){var n=ige.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function wge(e,t,r){var n=Do.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Sge(e,t,r){var n=Do.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function OM(e,t){return un(e.getDate(),t,2)}function jge(e,t){return un(e.getHours(),t,2)}function kge(e,t){return un(e.getHours()%12||12,t,2)}function _ge(e,t){return un(1+Mb.count(xd(e),e),t,3)}function RV(e,t){return un(e.getMilliseconds(),t,3)}function Cge(e,t){return RV(e,t)+"000"}function Ege(e,t){return un(e.getMonth()+1,t,2)}function Age(e,t){return un(e.getMinutes(),t,2)}function Tge(e,t){return un(e.getSeconds(),t,2)}function Pge(e){var t=e.getDay();return t===0?7:t}function Ige(e,t){return un(IS.count(xd(e)-1,e),t,2)}function LV(e){var t=e.getDay();return t>=4||t===0?Wm(e):Wm.ceil(e)}function Oge(e,t){return e=LV(e),un(Wm.count(xd(e),e)+(xd(e).getDay()===4),t,2)}function Nge(e){return e.getDay()}function Rge(e,t){return un(M2.count(xd(e)-1,e),t,2)}function Lge(e,t){return un(e.getFullYear()%100,t,2)}function Fge(e,t){return e=LV(e),un(e.getFullYear()%100,t,2)}function zge(e,t){return un(e.getFullYear()%1e4,t,4)}function Mge(e,t){var r=e.getDay();return e=r>=4||r===0?Wm(e):Wm.ceil(e),un(e.getFullYear()%1e4,t,4)}function Dge(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+un(t/60|0,"0",2)+un(t%60,"0",2)}function NM(e,t){return un(e.getUTCDate(),t,2)}function Bge(e,t){return un(e.getUTCHours(),t,2)}function Wge(e,t){return un(e.getUTCHours()%12||12,t,2)}function qge(e,t){return un(1+PS.count(bd(e),e),t,3)}function FV(e,t){return un(e.getUTCMilliseconds(),t,3)}function $ge(e,t){return FV(e,t)+"000"}function Uge(e,t){return un(e.getUTCMonth()+1,t,2)}function Hge(e,t){return un(e.getUTCMinutes(),t,2)}function Vge(e,t){return un(e.getUTCSeconds(),t,2)}function Yge(e){var t=e.getUTCDay();return t===0?7:t}function Gge(e,t){return un(OS.count(bd(e)-1,e),t,2)}function zV(e){var t=e.getUTCDay();return t>=4||t===0?qm(e):qm.ceil(e)}function Kge(e,t){return e=zV(e),un(qm.count(bd(e),e)+(bd(e).getUTCDay()===4),t,2)}function Qge(e){return e.getUTCDay()}function Xge(e,t){return un(D2.count(bd(e)-1,e),t,2)}function Zge(e,t){return un(e.getUTCFullYear()%100,t,2)}function Jge(e,t){return e=zV(e),un(e.getUTCFullYear()%100,t,2)}function eme(e,t){return un(e.getUTCFullYear()%1e4,t,4)}function tme(e,t){var r=e.getUTCDay();return e=r>=4||r===0?qm(e):qm.ceil(e),un(e.getUTCFullYear()%1e4,t,4)}function rme(){return"+0000"}function RM(){return"%"}function LM(e){return+e}function FM(e){return Math.floor(+e/1e3)}var Dg,MV,DV;nme({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function nme(e){return Dg=nge(e),MV=Dg.format,Dg.parse,DV=Dg.utcFormat,Dg.utcParse,Dg}function ime(e){return new Date(e)}function ome(e){return e instanceof Date?+e:+new Date(+e)}function PP(e,t,r,n,o,a,s,l,c,u){var d=mP(),f=d.invert,h=d.domain,p=u(".%L"),v=u(":%S"),m=u("%I:%M"),b=u("%I %p"),x=u("%a %d"),w=u("%b %d"),k=u("%B"),j=u("%Y");function _(T){return(c(T)<T?p:l(T)<T?v:s(T)<T?m:a(T)<T?b:n(T)<T?o(T)<T?x:w:r(T)<T?k:j)(T)}return d.invert=function(T){return new Date(f(T))},d.domain=function(T){return arguments.length?h(Array.from(T,ome)):h().map(ime)},d.ticks=function(T){var A=h();return e(A[0],A[A.length-1],T??10)},d.tickFormat=function(T,A){return A==null?_:u(A)},d.nice=function(T){var A=h();return(!T||typeof T.range!="function")&&(T=t(A[0],A[A.length-1],T??10)),T?h(_V(A,T)):d},d.copy=function(){return zb(d,PP(e,t,r,n,o,a,s,l,c,u))},d}function ame(){return Ml.apply(PP(tge,rge,xd,AP,IS,Mb,CP,kP,uh,MV).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function sme(){return Ml.apply(PP(Jhe,ege,bd,TP,OS,PS,EP,_P,uh,DV).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function NS(){var e=0,t=1,r,n,o,a,s=Ha,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:s(o===0?.5:(f=(a(f)-r)*o,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,r=a(e=+e),n=a(t=+t),o=r===n?0:1/(n-r),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(s=f,u):s};function d(f){return function(h){var p,v;return arguments.length?([p,v]=h,s=f(p,v),u):[s(0),s(1)]}}return u.range=d(Pv),u.rangeRound=d(gP),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return a=f,r=f(e),n=f(t),o=r===n?0:1/(n-r),u}}function tp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function BV(){var e=ep(NS()(Ha));return e.copy=function(){return tp(e,BV())},Id.apply(e,arguments)}function WV(){var e=xP(NS()).domain([1,10]);return e.copy=function(){return tp(e,WV()).base(e.base())},Id.apply(e,arguments)}function qV(){var e=bP(NS());return e.copy=function(){return tp(e,qV()).constant(e.constant())},Id.apply(e,arguments)}function IP(){var e=wP(NS());return e.copy=function(){return tp(e,IP()).exponent(e.exponent())},Id.apply(e,arguments)}function lme(){return IP.apply(null,arguments).exponent(.5)}function $V(){var e=[],t=Ha;function r(n){if(n!=null&&!isNaN(n=+n))return t((Lb(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let o of n)o!=null&&!isNaN(o=+o)&&e.push(o);return e.sort(zf),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,o)=>t(o/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(o,a)=>Gpe(e,a/n))},r.copy=function(){return $V(t).domain(e)},Id.apply(r,arguments)}function RS(){var e=0,t=.5,r=1,n=1,o,a,s,l,c,u=Ha,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-a)*(n*m<n*a?l:c),u(f?Math.max(0,Math.min(1,m)):m))}p.domain=function(m){return arguments.length?([e,t,r]=m,o=d(e=+e),a=d(t=+t),s=d(r=+r),l=o===a?0:.5/(a-o),c=a===s?0:.5/(s-a),n=a<o?-1:1,p):[e,t,r]},p.clamp=function(m){return arguments.length?(f=!!m,p):f},p.interpolator=function(m){return arguments.length?(u=m,p):u};function v(m){return function(b){var x,w,k;return arguments.length?([x,w,k]=b,u=bhe(m,[x,w,k]),p):[u(0),u(.5),u(1)]}}return p.range=v(Pv),p.rangeRound=v(gP),p.unknown=function(m){return arguments.length?(h=m,p):h},function(m){return d=m,o=m(e),a=m(t),s=m(r),l=o===a?0:.5/(a-o),c=a===s?0:.5/(s-a),n=a<o?-1:1,p}}function UV(){var e=ep(RS()(Ha));return e.copy=function(){return tp(e,UV())},Id.apply(e,arguments)}function HV(){var e=xP(RS()).domain([.1,1,10]);return e.copy=function(){return tp(e,HV()).base(e.base())},Id.apply(e,arguments)}function VV(){var e=bP(RS());return e.copy=function(){return tp(e,VV()).constant(e.constant())},Id.apply(e,arguments)}function OP(){var e=wP(RS());return e.copy=function(){return tp(e,OP()).exponent(e.exponent())},Id.apply(e,arguments)}function cme(){return OP.apply(null,arguments).exponent(.5)}const zM=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Fx,scaleDiverging:UV,scaleDivergingLog:HV,scaleDivergingPow:OP,scaleDivergingSqrt:cme,scaleDivergingSymlog:VV,scaleIdentity:kV,scaleImplicit:hA,scaleLinear:F2,scaleLog:CV,scaleOrdinal:fP,scalePoint:ix,scalePow:SP,scaleQuantile:TV,scaleQuantize:PV,scaleRadial:AV,scaleSequential:BV,scaleSequentialLog:WV,scaleSequentialPow:IP,scaleSequentialQuantile:$V,scaleSequentialSqrt:lme,scaleSequentialSymlog:qV,scaleSqrt:$he,scaleSymlog:EV,scaleThreshold:IV,scaleTime:ame,scaleUtc:sme,tickFormat:jV},Symbol.toStringTag,{value:"Module"}));var v4,MM;function LS(){if(MM)return v4;MM=1;var e=Cv();function t(r,n,o){for(var a=-1,s=r.length;++a<s;){var l=r[a],c=n(l);if(c!=null&&(u===void 0?c===c&&!e(c):o(c,u)))var u=c,d=l}return d}return v4=t,v4}var y4,DM;function YV(){if(DM)return y4;DM=1;function e(t,r){return t>r}return y4=e,y4}var x4,BM;function ume(){if(BM)return x4;BM=1;var e=LS(),t=YV(),r=Tv();function n(o){return o&&o.length?e(o,r,t):void 0}return x4=n,x4}var dme=ume();const FS=dn(dme);var b4,WM;function GV(){if(WM)return b4;WM=1;function e(t,r){return t<r}return b4=e,b4}var w4,qM;function fme(){if(qM)return w4;qM=1;var e=LS(),t=GV(),r=Tv();function n(o){return o&&o.length?e(o,r,t):void 0}return w4=n,w4}var pme=fme();const zS=dn(pme);var S4,$M;function hme(){if($M)return S4;$M=1;var e=GT(),t=fu(),r=nV(),n=vs();function o(a,s){var l=n(a)?e:r;return l(a,t(s,3))}return S4=o,S4}var j4,UM;function gme(){if(UM)return j4;UM=1;var e=tV(),t=hme();function r(n,o){return e(t(n,o),1)}return j4=r,j4}var mme=gme();const vme=dn(mme);var k4,HM;function KV(){if(HM)return k4;HM=1;var e=sP();function t(r,n){return e(r,n)}return k4=t,k4}var yme=KV();const Db=dn(yme);var Iv=1e9,xme={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},RP,fi=!0,Rl="[DecimalError] ",vh=Rl+"Invalid argument: ",NP=Rl+"Exponent out of range: ",Ov=Math.floor,Xp=Math.pow,bme=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Hs,Oo=1e7,oi=7,QV=9007199254740991,B2=Ov(QV/oi),Jt={};Jt.absoluteValue=Jt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Jt.comparedTo=Jt.cmp=function(e){var t,r,n,o,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(n=a.d.length,o=e.d.length,t=0,r=n<o?n:o;t<r;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return n===o?0:n>o^a.s<0?1:-1};Jt.decimalPlaces=Jt.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*oi;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};Jt.dividedBy=Jt.div=function(e){return hd(this,new this.constructor(e))};Jt.dividedToIntegerBy=Jt.idiv=function(e){var t=this,r=t.constructor;return Wn(hd(t,new r(e),0,1),r.precision)};Jt.equals=Jt.eq=function(e){return!this.cmp(e)};Jt.exponent=function(){return no(this)};Jt.greaterThan=Jt.gt=function(e){return this.cmp(e)>0};Jt.greaterThanOrEqualTo=Jt.gte=function(e){return this.cmp(e)>=0};Jt.isInteger=Jt.isint=function(){return this.e>this.d.length-2};Jt.isNegative=Jt.isneg=function(){return this.s<0};Jt.isPositive=Jt.ispos=function(){return this.s>0};Jt.isZero=function(){return this.s===0};Jt.lessThan=Jt.lt=function(e){return this.cmp(e)<0};Jt.lessThanOrEqualTo=Jt.lte=function(e){return this.cmp(e)<1};Jt.logarithm=Jt.log=function(e){var t,r=this,n=r.constructor,o=n.precision,a=o+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Hs))throw Error(Rl+"NaN");if(r.s<1)throw Error(Rl+(r.s?"NaN":"-Infinity"));return r.eq(Hs)?new n(0):(fi=!1,t=hd(Wx(r,a),Wx(e,a),a),fi=!0,Wn(t,o))};Jt.minus=Jt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?JV(t,e):XV(t,(e.s=-e.s,e))};Jt.modulo=Jt.mod=function(e){var t,r=this,n=r.constructor,o=n.precision;if(e=new n(e),!e.s)throw Error(Rl+"NaN");return r.s?(fi=!1,t=hd(r,e,0,1).times(e),fi=!0,r.minus(t)):Wn(new n(r),o)};Jt.naturalExponential=Jt.exp=function(){return ZV(this)};Jt.naturalLogarithm=Jt.ln=function(){return Wx(this)};Jt.negated=Jt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Jt.plus=Jt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?XV(t,e):JV(t,(e.s=-e.s,e))};Jt.precision=Jt.sd=function(e){var t,r,n,o=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(vh+e);if(t=no(o)+1,n=o.d.length-1,r=n*oi+1,n=o.d[n],n){for(;n%10==0;n/=10)r--;for(n=o.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};Jt.squareRoot=Jt.sqrt=function(){var e,t,r,n,o,a,s,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Rl+"NaN")}for(e=no(l),fi=!1,o=Math.sqrt(+l),o==0||o==1/0?(t=Jc(l.d),(t.length+e)%2==0&&(t+="0"),o=Math.sqrt(t),e=Ov((e+1)/2)-(e<0||e%2),o==1/0?t="5e"+e:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(o.toString()),r=c.precision,o=s=r+3;;)if(a=n,n=a.plus(hd(l,a,s+2)).times(.5),Jc(a.d).slice(0,s)===(t=Jc(n.d)).slice(0,s)){if(t=t.slice(s-3,s+1),o==s&&t=="4999"){if(Wn(a,r+1,0),a.times(a).eq(l)){n=a;break}}else if(t!="9999")break;s+=4}return fi=!0,Wn(n,r)};Jt.times=Jt.mul=function(e){var t,r,n,o,a,s,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=h.length,u=p.length,c<u&&(a=h,h=p,p=a,s=c,c=u,u=s),a=[],s=c+u,n=s;n--;)a.push(0);for(n=u;--n>=0;){for(t=0,o=c+n;o>n;)l=a[o]+p[n]*h[o-n-1]+t,a[o--]=l%Oo|0,t=l/Oo|0;a[o]=(a[o]+t)%Oo|0}for(;!a[--s];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,fi?Wn(e,f.precision):e};Jt.toDecimalPlaces=Jt.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(su(e,0,Iv),t===void 0?t=n.rounding:su(t,0,8),Wn(r,e+no(r)+1,t))};Jt.toExponential=function(e,t){var r,n=this,o=n.constructor;return e===void 0?r=Th(n,!0):(su(e,0,Iv),t===void 0?t=o.rounding:su(t,0,8),n=Wn(new o(n),e+1,t),r=Th(n,!0,e+1)),r};Jt.toFixed=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?Th(o):(su(e,0,Iv),t===void 0?t=a.rounding:su(t,0,8),n=Wn(new a(o),e+no(o)+1,t),r=Th(n.abs(),!1,e+no(n)+1),o.isneg()&&!o.isZero()?"-"+r:r)};Jt.toInteger=Jt.toint=function(){var e=this,t=e.constructor;return Wn(new t(e),no(e)+1,t.rounding)};Jt.toNumber=function(){return+this};Jt.toPower=Jt.pow=function(e){var t,r,n,o,a,s,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Hs);if(l=new c(l),!l.s){if(e.s<1)throw Error(Rl+"Infinity");return l}if(l.eq(Hs))return l;if(n=c.precision,e.eq(Hs))return Wn(l,n);if(t=e.e,r=e.d.length-1,s=t>=r,a=l.s,s){if((r=d<0?-d:d)<=QV){for(o=new c(Hs),t=Math.ceil(n/oi+4),fi=!1;r%2&&(o=o.times(l),YM(o.d,t)),r=Ov(r/2),r!==0;)l=l.times(l),YM(l.d,t);return fi=!0,e.s<0?new c(Hs).div(o):Wn(o,n)}}else if(a<0)throw Error(Rl+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,fi=!1,o=e.times(Wx(l,n+u)),fi=!0,o=ZV(o),o.s=a,o};Jt.toPrecision=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?(r=no(o),n=Th(o,r<=a.toExpNeg||r>=a.toExpPos)):(su(e,1,Iv),t===void 0?t=a.rounding:su(t,0,8),o=Wn(new a(o),e,t),r=no(o),n=Th(o,e<=r||r<=a.toExpNeg,e)),n};Jt.toSignificantDigits=Jt.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(su(e,1,Iv),t===void 0?t=n.rounding:su(t,0,8)),Wn(new n(r),e,t)};Jt.toString=Jt.valueOf=Jt.val=Jt.toJSON=Jt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=no(e),r=e.constructor;return Th(e,t<=r.toExpNeg||t>=r.toExpPos)};function XV(e,t){var r,n,o,a,s,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),fi?Wn(t,f):t;if(c=e.d,u=t.d,s=e.e,o=t.e,c=c.slice(),a=s-o,a){for(a<0?(n=c,a=-a,l=u.length):(n=u,o=s,l=c.length),s=Math.ceil(f/oi),l=s>l?s+1:l+1,a>l&&(a=l,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,n=u,u=c,c=n),r=0;a;)r=(c[--a]=c[a]+u[a]+r)/Oo|0,c[a]%=Oo;for(r&&(c.unshift(r),++o),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=o,fi?Wn(t,f):t}function su(e,t,r){if(e!==~~e||e<t||e>r)throw Error(vh+e)}function Jc(e){var t,r,n,o=e.length-1,a="",s=e[0];if(o>0){for(a+=s,t=1;t<o;t++)n=e[t]+"",r=oi-n.length,r&&(a+=_f(r)),a+=n;s=e[t],n=s+"",r=oi-n.length,r&&(a+=_f(r))}else if(s===0)return"0";for(;s%10===0;)s/=10;return a+s}var hd=(function(){function e(n,o){var a,s=0,l=n.length;for(n=n.slice();l--;)a=n[l]*o+s,n[l]=a%Oo|0,s=a/Oo|0;return s&&n.unshift(s),n}function t(n,o,a,s){var l,c;if(a!=s)c=a>s?1:-1;else for(l=c=0;l<a;l++)if(n[l]!=o[l]){c=n[l]>o[l]?1:-1;break}return c}function r(n,o,a){for(var s=0;a--;)n[a]-=s,s=n[a]<o[a]?1:0,n[a]=s*Oo+n[a]-o[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,o,a,s){var l,c,u,d,f,h,p,v,m,b,x,w,k,j,_,T,A,P,N=n.constructor,O=n.s==o.s?1:-1,C=n.d,I=o.d;if(!n.s)return new N(n);if(!o.s)throw Error(Rl+"Division by zero");for(c=n.e-o.e,A=I.length,_=C.length,p=new N(O),v=p.d=[],u=0;I[u]==(C[u]||0);)++u;if(I[u]>(C[u]||0)&&--c,a==null?w=a=N.precision:s?w=a+(no(n)-no(o))+1:w=a,w<0)return new N(0);if(w=w/oi+2|0,u=0,A==1)for(d=0,I=I[0],w++;(u<_||d)&&w--;u++)k=d*Oo+(C[u]||0),v[u]=k/I|0,d=k%I|0;else{for(d=Oo/(I[0]+1)|0,d>1&&(I=e(I,d),C=e(C,d),A=I.length,_=C.length),j=A,m=C.slice(0,A),b=m.length;b<A;)m[b++]=0;P=I.slice(),P.unshift(0),T=I[0],I[1]>=Oo/2&&++T;do d=0,l=t(I,m,A,b),l<0?(x=m[0],A!=b&&(x=x*Oo+(m[1]||0)),d=x/T|0,d>1?(d>=Oo&&(d=Oo-1),f=e(I,d),h=f.length,b=m.length,l=t(f,m,h,b),l==1&&(d--,r(f,A<h?P:I,h))):(d==0&&(l=d=1),f=I.slice()),h=f.length,h<b&&f.unshift(0),r(m,f,b),l==-1&&(b=m.length,l=t(I,m,A,b),l<1&&(d++,r(m,A<b?P:I,b))),b=m.length):l===0&&(d++,m=[0]),v[u++]=d,l&&m[0]?m[b++]=C[j]||0:(m=[C[j]],b=1);while((j++<_||m[0]!==void 0)&&w--)}return v[0]||v.shift(),p.e=c,Wn(p,s?a+no(p)+1:a)}})();function ZV(e,t){var r,n,o,a,s,l,c=0,u=0,d=e.constructor,f=d.precision;if(no(e)>16)throw Error(NP+no(e));if(!e.s)return new d(Hs);for(fi=!1,l=f,s=new d(.03125);e.abs().gte(.1);)e=e.times(s),u+=5;for(n=Math.log(Xp(2,u))/Math.LN10*2+5|0,l+=n,r=o=a=new d(Hs),d.precision=l;;){if(o=Wn(o.times(e),l),r=r.times(++c),s=a.plus(hd(o,r,l)),Jc(s.d).slice(0,l)===Jc(a.d).slice(0,l)){for(;u--;)a=Wn(a.times(a),l);return d.precision=f,t==null?(fi=!0,Wn(a,f)):a}a=s}}function no(e){for(var t=e.e*oi,r=e.d[0];r>=10;r/=10)t++;return t}function _4(e,t,r){if(t>e.LN10.sd())throw fi=!0,r&&(e.precision=r),Error(Rl+"LN10 precision limit exceeded");return Wn(new e(e.LN10),t)}function _f(e){for(var t="";e--;)t+="0";return t}function Wx(e,t){var r,n,o,a,s,l,c,u,d,f=1,h=10,p=e,v=p.d,m=p.constructor,b=m.precision;if(p.s<1)throw Error(Rl+(p.s?"NaN":"-Infinity"));if(p.eq(Hs))return new m(0);if(t==null?(fi=!1,u=b):u=t,p.eq(10))return t==null&&(fi=!0),_4(m,u);if(u+=h,m.precision=u,r=Jc(v),n=r.charAt(0),a=no(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=Jc(p.d),n=r.charAt(0),f++;a=no(p),n>1?(p=new m("0."+r),a++):p=new m(n+"."+r.slice(1))}else return c=_4(m,u+2,b).times(a+""),p=Wx(new m(n+"."+r.slice(1)),u-h).plus(c),m.precision=b,t==null?(fi=!0,Wn(p,b)):p;for(l=s=p=hd(p.minus(Hs),p.plus(Hs),u),d=Wn(p.times(p),u),o=3;;){if(s=Wn(s.times(d),u),c=l.plus(hd(s,new m(o),u)),Jc(c.d).slice(0,u)===Jc(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(_4(m,u+2,b).times(a+""))),l=hd(l,new m(f),u),m.precision=b,t==null?(fi=!0,Wn(l,b)):l;l=c,o+=2}}function VM(e,t){var r,n,o;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(o=t.length;t.charCodeAt(o-1)===48;)--o;if(t=t.slice(n,o),t){if(o-=n,r=r-n-1,e.e=Ov(r/oi),e.d=[],n=(r+1)%oi,r<0&&(n+=oi),n<o){for(n&&e.d.push(+t.slice(0,n)),o-=oi;n<o;)e.d.push(+t.slice(n,n+=oi));t=t.slice(n),n=oi-t.length}else n-=o;for(;n--;)t+="0";if(e.d.push(+t),fi&&(e.e>B2||e.e<-B2))throw Error(NP+r)}else e.s=0,e.e=0,e.d=[0];return e}function Wn(e,t,r){var n,o,a,s,l,c,u,d,f=e.d;for(s=1,a=f[0];a>=10;a/=10)s++;if(n=t-s,n<0)n+=oi,o=t,u=f[d=0];else{if(d=Math.ceil((n+1)/oi),a=f.length,d>=a)return e;for(u=a=f[d],s=1;a>=10;a/=10)s++;n%=oi,o=n-oi+s}if(r!==void 0&&(a=Xp(10,s-o-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?o>0?u/Xp(10,s-o):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(a=no(e),f.length=1,t=t-a-1,f[0]=Xp(10,(oi-t%oi)%oi),e.e=Ov(-t/oi)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,a=1,d--):(f.length=d+1,a=Xp(10,oi-n),f[d]=o>0?(u/Xp(10,s-o)%Xp(10,o)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==Oo&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=Oo)break;f[d--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(fi&&(e.e>B2||e.e<-B2))throw Error(NP+no(e));return e}function JV(e,t){var r,n,o,a,s,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),fi?Wn(t,p):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),s=u-n,s){for(d=s<0,d?(r=c,s=-s,l=f.length):(r=f,n=u,l=c.length),o=Math.max(Math.ceil(p/oi),l)+2,s>o&&(s=o,r.length=1),r.reverse(),o=s;o--;)r.push(0);r.reverse()}else{for(o=c.length,l=f.length,d=o<l,d&&(l=o),o=0;o<l;o++)if(c[o]!=f[o]){d=c[o]<f[o];break}s=0}for(d&&(r=c,c=f,f=r,t.s=-t.s),l=c.length,o=f.length-l;o>0;--o)c[l++]=0;for(o=f.length;o>s;){if(c[--o]<f[o]){for(a=o;a&&c[--a]===0;)c[a]=Oo-1;--c[a],c[o]+=Oo}c[o]-=f[o]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,fi?Wn(t,p):t):new h(0)}function Th(e,t,r){var n,o=no(e),a=Jc(e.d),s=a.length;return t?(r&&(n=r-s)>0?a=a.charAt(0)+"."+a.slice(1)+_f(n):s>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(o<0?"e":"e+")+o):o<0?(a="0."+_f(-o-1)+a,r&&(n=r-s)>0&&(a+=_f(n))):o>=s?(a+=_f(o+1-s),r&&(n=r-o-1)>0&&(a=a+"."+_f(n))):((n=o+1)<s&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-s)>0&&(o+1===s&&(a+="."),a+=_f(n))),e.s<0?"-"+a:a}function YM(e,t){if(e.length>t)return e.length=t,!0}function eY(e){var t,r,n;function o(a){var s=this;if(!(s instanceof o))return new o(a);if(s.constructor=o,a instanceof o){s.s=a.s,s.e=a.e,s.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(vh+a);if(a>0)s.s=1;else if(a<0)a=-a,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(a===~~a&&a<1e7){s.e=0,s.d=[a];return}return VM(s,a.toString())}else if(typeof a!="string")throw Error(vh+a);if(a.charCodeAt(0)===45?(a=a.slice(1),s.s=-1):s.s=1,bme.test(a))VM(s,a);else throw Error(vh+a)}if(o.prototype=Jt,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.clone=eY,o.config=o.set=wme,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return o.config(e),o}function wme(e){if(!e||typeof e!="object")throw Error(Rl+"Object expected");var t,r,n,o=["precision",1,Iv,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<o.length;t+=3)if((n=e[r=o[t]])!==void 0)if(Ov(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(vh+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(vh+r+": "+n);return this}var RP=eY(xme);Hs=new RP(1);const Ln=RP;function Sme(e){return Cme(e)||_me(e)||kme(e)||jme()}function jme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kme(e,t){if(e){if(typeof e=="string")return yA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yA(e,t)}}function _me(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Cme(e){if(Array.isArray(e))return yA(e)}function yA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Eme=function(t){return t},tY={},rY=function(t){return t===tY},GM=function(t){return function r(){return arguments.length===0||arguments.length===1&&rY(arguments.length<=0?void 0:arguments[0])?r:t.apply(void 0,arguments)}},Ame=function e(t,r){return t===1?r:GM(function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];var s=o.filter(function(l){return l!==tY}).length;return s>=t?r.apply(void 0,o):e(t-s,GM(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=o.map(function(f){return rY(f)?c.shift():f});return r.apply(void 0,Sme(d).concat(c))}))})},MS=function(t){return Ame(t.length,t)},xA=function(t,r){for(var n=[],o=t;o<r;++o)n[o-t]=o;return n},Tme=MS(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),Pme=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r.length)return Eme;var o=r.reverse(),a=o[0],s=o.slice(1);return function(){return s.reduce(function(l,c){return c(l)},a.apply(void 0,arguments))}},bA=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},nY=function(t){var r=null,n=null;return function(){for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return r&&a.every(function(l,c){return l===r[c]})||(r=a,n=t.apply(void 0,a)),n}};function Ime(e){var t;return e===0?t=1:t=Math.floor(new Ln(e).abs().log(10).toNumber())+1,t}function Ome(e,t,r){for(var n=new Ln(e),o=0,a=[];n.lt(t)&&o<1e5;)a.push(n.toNumber()),n=n.add(r),o++;return a}var Nme=MS(function(e,t,r){var n=+e,o=+t;return n+r*(o-n)}),Rme=MS(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),Lme=MS(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const DS={rangeStep:Ome,getDigitCount:Ime,interpolateNumber:Nme,uninterpolateNumber:Rme,uninterpolateTruncation:Lme};function wA(e){return Mme(e)||zme(e)||iY(e)||Fme()}function Fme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zme(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Mme(e){if(Array.isArray(e))return SA(e)}function qx(e,t){return Wme(e)||Bme(e,t)||iY(e,t)||Dme()}function Dme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iY(e,t){if(e){if(typeof e=="string")return SA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return SA(e,t)}}function SA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Bme(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,o=!1,a=void 0;try{for(var s=e[Symbol.iterator](),l;!(n=(l=s.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(c){o=!0,a=c}finally{try{!n&&s.return!=null&&s.return()}finally{if(o)throw a}}return r}}function Wme(e){if(Array.isArray(e))return e}function oY(e){var t=qx(e,2),r=t[0],n=t[1],o=r,a=n;return r>n&&(o=n,a=r),[o,a]}function aY(e,t,r){if(e.lte(0))return new Ln(0);var n=DS.getDigitCount(e.toNumber()),o=new Ln(10).pow(n),a=e.div(o),s=n!==1?.05:.1,l=new Ln(Math.ceil(a.div(s).toNumber())).add(r).mul(s),c=l.mul(o);return t?c:new Ln(Math.ceil(c))}function qme(e,t,r){var n=1,o=new Ln(e);if(!o.isint()&&r){var a=Math.abs(e);a<1?(n=new Ln(10).pow(DS.getDigitCount(e)-1),o=new Ln(Math.floor(o.div(n).toNumber())).mul(n)):a>1&&(o=new Ln(Math.floor(e)))}else e===0?o=new Ln(Math.floor((t-1)/2)):r||(o=new Ln(Math.floor(e)));var s=Math.floor((t-1)/2),l=Pme(Tme(function(c){return o.add(new Ln(c-s).mul(n)).toNumber()}),xA);return l(0,t)}function sY(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new Ln(0),tickMin:new Ln(0),tickMax:new Ln(0)};var a=aY(new Ln(t).sub(e).div(r-1),n,o),s;e<=0&&t>=0?s=new Ln(0):(s=new Ln(e).add(t).div(2),s=s.sub(new Ln(s).mod(a)));var l=Math.ceil(s.sub(e).div(a).toNumber()),c=Math.ceil(new Ln(t).sub(s).div(a).toNumber()),u=l+c+1;return u>r?sY(e,t,r,n,o+1):(u<r&&(c=t>0?c+(r-u):c,l=t>0?l:l+(r-u)),{step:a,tickMin:s.sub(new Ln(l).mul(a)),tickMax:s.add(new Ln(c).mul(a))})}function $me(e){var t=qx(e,2),r=t[0],n=t[1],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(o,2),l=oY([r,n]),c=qx(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(wA(xA(0,o-1).map(function(){return 1/0}))):[].concat(wA(xA(0,o-1).map(function(){return-1/0})),[d]);return r>n?bA(f):f}if(u===d)return qme(u,o,a);var h=sY(u,d,s,a),p=h.step,v=h.tickMin,m=h.tickMax,b=DS.rangeStep(v,m.add(new Ln(.1).mul(p)),p);return r>n?bA(b):b}function Ume(e,t){var r=qx(e,2),n=r[0],o=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=oY([n,o]),l=qx(s,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,o];if(c===u)return[c];var d=Math.max(t,2),f=aY(new Ln(u).sub(c).div(d-1),a,0),h=[].concat(wA(DS.rangeStep(new Ln(c),new Ln(u).sub(new Ln(.99).mul(f)),f)),[u]);return n>o?bA(h):h}var Hme=nY($me),Vme=nY(Ume),Yme="Invariant failed";function Ph(e,t){throw new Error(Yme)}var Gme=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function $m(e){"@babel/helpers - typeof";return $m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$m(e)}function W2(){return W2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},W2.apply(this,arguments)}function Kme(e,t){return Jme(e)||Zme(e,t)||Xme(e,t)||Qme()}function Qme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xme(e,t){if(e){if(typeof e=="string")return KM(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return KM(e,t)}}function KM(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Zme(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function Jme(e){if(Array.isArray(e))return e}function eve(e,t){if(e==null)return{};var r=tve(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tve(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function rve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,uY(n.key),n)}}function ive(e,t,r){return t&&nve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ove(e,t,r){return t=q2(t),ave(e,lY()?Reflect.construct(t,r||[],q2(e).constructor):t.apply(e,r))}function ave(e,t){if(t&&($m(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sve(e)}function sve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lY=function(){return!!e})()}function q2(e){return q2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},q2(e)}function lve(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jA(e,t)}function jA(e,t){return jA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},jA(e,t)}function cY(e,t,r){return t=uY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uY(e){var t=cve(e,"string");return $m(t)=="symbol"?t:t+""}function cve(e,t){if($m(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($m(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Bb=(function(e){function t(){return rve(this,t),ove(this,t,arguments)}return lve(t,e),ive(t,[{key:"render",value:function(){var n=this.props,o=n.offset,a=n.layout,s=n.width,l=n.dataKey,c=n.data,u=n.dataPointFormatter,d=n.xAxis,f=n.yAxis,h=eve(n,Gme),p=yr(h,!1);this.props.direction==="x"&&d.type!=="number"&&Ph();var v=c.map(function(m){var b=u(m,l),x=b.x,w=b.y,k=b.value,j=b.errorVal;if(!j)return null;var _=[],T,A;if(Array.isArray(j)){var P=Kme(j,2);T=P[0],A=P[1]}else T=A=j;if(a==="vertical"){var N=d.scale,O=w+o,C=O+s,I=O-s,R=N(k-T),F=N(k+A);_.push({x1:F,y1:C,x2:F,y2:I}),_.push({x1:R,y1:O,x2:F,y2:O}),_.push({x1:R,y1:C,x2:R,y2:I})}else if(a==="horizontal"){var M=f.scale,Y=x+o,X=Y-s,$=Y+s,ee=M(k-T),V=M(k+A);_.push({x1:X,y1:V,x2:$,y2:V}),_.push({x1:Y,y1:ee,x2:Y,y2:V}),_.push({x1:X,y1:ee,x2:$,y2:ee})}return $e.createElement(cn,W2({className:"recharts-errorBar",key:"bar-".concat(_.map(function(D){return"".concat(D.x1,"-").concat(D.x2,"-").concat(D.y1,"-").concat(D.y2)}))},p),_.map(function(D){return $e.createElement("line",W2({},D,{key:"line-".concat(D.x1,"-").concat(D.x2,"-").concat(D.y1,"-").concat(D.y2)}))}))});return $e.createElement(cn,{className:"recharts-errorBars"},v)}}])})($e.Component);cY(Bb,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});cY(Bb,"displayName","ErrorBar");function $x(e){"@babel/helpers - typeof";return $x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$x(e)}function QM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Rp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?QM(Object(r),!0).forEach(function(n){uve(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uve(e,t,r){return t=dve(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dve(e){var t=fve(e,"string");return $x(t)=="symbol"?t:t+""}function fve(e,t){if($x(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($x(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var dY=function(t){var r=t.children,n=t.formattedGraphicalItems,o=t.legendWidth,a=t.legendContent,s=qs(r,Ff);if(!s)return null;var l=Ff.defaultProps,c=l!==void 0?Rp(Rp({},l),s.props):{},u;return s.props&&s.props.payload?u=s.props&&s.props.payload:a==="children"?u=(n||[]).reduce(function(d,f){var h=f.item,p=f.props,v=p.sectors||p.data||[];return d.concat(v.map(function(m){return{type:s.props.iconType||h.props.legendType,value:m.name,color:m.fill,payload:m}}))},[]):u=(n||[]).map(function(d){var f=d.item,h=f.type.defaultProps,p=h!==void 0?Rp(Rp({},h),f.props):{},v=p.dataKey,m=p.name,b=p.legendType,x=p.hide;return{inactive:x,dataKey:v,type:c.iconType||b||"square",color:LP(f),value:m||v,payload:p}}),Rp(Rp(Rp({},c),Ff.getWithHeight(s,o)),{},{payload:u,item:s})};function Ux(e){"@babel/helpers - typeof";return Ux=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ux(e)}function XM(e){return mve(e)||gve(e)||hve(e)||pve()}function pve(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hve(e,t){if(e){if(typeof e=="string")return kA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kA(e,t)}}function gve(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function mve(e){if(Array.isArray(e))return kA(e)}function kA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ZM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Oi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZM(Object(r),!0).forEach(function(n){ym(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZM(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ym(e,t,r){return t=vve(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vve(e){var t=yve(e,"string");return Ux(t)=="symbol"?t:t+""}function yve(e,t){if(Ux(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ux(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function po(e,t,r){return Rr(e)||Rr(t)?r:mo(t)?Gs(e,t,r):Ar(t)?t(e):r}function ox(e,t,r,n){var o=vme(e,function(l){return po(l,t)});if(r==="number"){var a=o.filter(function(l){return qt(l)||parseFloat(l)});return a.length?[zS(a),FS(a)]:[1/0,-1/0]}var s=n?o.filter(function(l){return!Rr(l)}):o;return s.map(function(l){return mo(l)||l instanceof Date?l:""})}var xve=function(t){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,s=-1,l=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(l<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,u=0;u<l;u++){var d=u>0?o[u-1].coordinate:o[l-1].coordinate,f=o[u].coordinate,h=u>=l-1?o[0].coordinate:o[u+1].coordinate,p=void 0;if($a(f-d)!==$a(h-f)){var v=[];if($a(h-f)===$a(c[1]-c[0])){p=h;var m=f+c[1]-c[0];v[0]=Math.min(m,(m+d)/2),v[1]=Math.max(m,(m+d)/2)}else{p=d;var b=h+c[1]-c[0];v[0]=Math.min(f,(b+f)/2),v[1]=Math.max(f,(b+f)/2)}var x=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>x[0]&&t<=x[1]||t>=v[0]&&t<=v[1]){s=o[u].index;break}}else{var w=Math.min(d,h),k=Math.max(d,h);if(t>(w+f)/2&&t<=(k+f)/2){s=o[u].index;break}}}else for(var j=0;j<l;j++)if(j===0&&t<=(n[j].coordinate+n[j+1].coordinate)/2||j>0&&j<l-1&&t>(n[j].coordinate+n[j-1].coordinate)/2&&t<=(n[j].coordinate+n[j+1].coordinate)/2||j===l-1&&t>(n[j].coordinate+n[j-1].coordinate)/2){s=n[j].index;break}return s},LP=function(t){var r,n=t,o=n.type.displayName,a=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Oi(Oi({},t.type.defaultProps),t.props):t.props,s=a.stroke,l=a.fill,c;switch(o){case"Line":c=s;break;case"Area":case"Radar":c=s&&s!=="none"?s:l;break;default:c=l;break}return c},bve=function(t){var r=t.barSize,n=t.totalSize,o=t.stackGroups,a=o===void 0?{}:o;if(!a)return{};for(var s={},l=Object.keys(a),c=0,u=l.length;c<u;c++)for(var d=a[l[c]].stackGroups,f=Object.keys(d),h=0,p=f.length;h<p;h++){var v=d[f[h]],m=v.items,b=v.cateAxisId,x=m.filter(function(A){return pd(A.type).indexOf("Bar")>=0});if(x&&x.length){var w=x[0].type.defaultProps,k=w!==void 0?Oi(Oi({},w),x[0].props):x[0].props,j=k.barSize,_=k[b];s[_]||(s[_]=[]);var T=Rr(j)?r:j;s[_].push({item:x[0],stackList:x.slice(1),barSize:Rr(T)?void 0:Ua(T,n,0)})}}return s},wve=function(t){var r=t.barGap,n=t.barCategoryGap,o=t.bandSize,a=t.sizeList,s=a===void 0?[]:a,l=t.maxBarSize,c=s.length;if(c<1)return null;var u=Ua(r,o,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=o/c,v=s.reduce(function(j,_){return j+_.barSize||0},0);v+=(c-1)*u,v>=o&&(v-=(c-1)*u,u=0),v>=o&&p>0&&(h=!0,p*=.9,v=c*p);var m=(o-v)/2>>0,b={offset:m-u,size:0};d=s.reduce(function(j,_){var T={item:_.item,position:{offset:b.offset+b.size+u,size:h?p:_.barSize}},A=[].concat(XM(j),[T]);return b=A[A.length-1].position,_.stackList&&_.stackList.length&&_.stackList.forEach(function(P){A.push({item:P,position:b})}),A},f)}else{var x=Ua(n,o,0,!0);o-2*x-(c-1)*u<=0&&(u=0);var w=(o-2*x-(c-1)*u)/c;w>1&&(w>>=0);var k=l===+l?Math.min(w,l):w;d=s.reduce(function(j,_,T){var A=[].concat(XM(j),[{item:_.item,position:{offset:x+(w+u)*T+(w-k)/2,size:k}}]);return _.stackList&&_.stackList.length&&_.stackList.forEach(function(P){A.push({item:P,position:A[A.length-1].position})}),A},f)}return d},Sve=function(t,r,n,o){var a=n.children,s=n.width,l=n.margin,c=s-(l.left||0)-(l.right||0),u=dY({children:a,legendWidth:c});if(u){var d=o||{},f=d.width,h=d.height,p=u.align,v=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&v==="middle")&&p!=="center"&&qt(t[p]))return Oi(Oi({},t),{},ym({},p,t[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&v!=="middle"&&qt(t[v]))return Oi(Oi({},t),{},ym({},v,t[v]+(h||0)))}return t},jve=function(t,r,n){return Rr(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},fY=function(t,r,n,o,a){var s=r.props.children,l=Ks(s,Bb).filter(function(u){return jve(o,a,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=po(d,n);if(Rr(f))return u;var h=Array.isArray(f)?[zS(f),FS(f)]:[f,f],p=c.reduce(function(v,m){var b=po(d,m,0),x=h[0]-Math.abs(Array.isArray(b)?b[0]:b),w=h[1]+Math.abs(Array.isArray(b)?b[1]:b);return[Math.min(x,v[0]),Math.max(w,v[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},kve=function(t,r,n,o,a){var s=r.map(function(l){return fY(t,l,n,a,o)}).filter(function(l){return!Rr(l)});return s&&s.length?s.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},pY=function(t,r,n,o,a){var s=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&fY(t,c,u,o)||ox(t,u,n,a)});if(n==="number")return s.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return s.reduce(function(c,u){for(var d=0,f=u.length;d<f;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},hY=function(t,r){return t==="horizontal"&&r==="xAxis"||t==="vertical"&&r==="yAxis"||t==="centric"&&r==="angleAxis"||t==="radial"&&r==="radiusAxis"},gY=function(t,r,n,o){if(o)return t.map(function(c){return c.coordinate});var a,s,l=t.map(function(c){return c.coordinate===r&&(a=!0),c.coordinate===n&&(s=!0),c.coordinate});return a||l.push(r),s||l.push(n),l},sd=function(t,r,n){if(!t)return null;var o=t.scale,a=t.duplicateDomain,s=t.type,l=t.range,c=t.realScaleType==="scaleBand"?o.bandwidth()/2:2,u=(r||n)&&s==="category"&&o.bandwidth?o.bandwidth()/c:0;if(u=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?$a(l[0]-l[1])*2*u:u,r&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=a?a.indexOf(f):f;return{coordinate:o(h)+u,value:f,offset:u}});return d.filter(function(f){return!Nb(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:o(f)+u,value:f,index:h,offset:u}}):o.ticks&&!n?o.ticks(t.tickCount).map(function(f){return{coordinate:o(f)+u,value:f,offset:u}}):o.domain().map(function(f,h){return{coordinate:o(f)+u,value:a?a[f]:f,index:h,offset:u}})},C4=new WeakMap,s1=function(t,r){if(typeof r!="function")return t;C4.has(t)||C4.set(t,new WeakMap);var n=C4.get(t);if(n.has(r))return n.get(r);var o=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,o),o},mY=function(t,r,n){var o=t.scale,a=t.type,s=t.layout,l=t.axisType;if(o==="auto")return s==="radial"&&l==="radiusAxis"?{scale:Fx(),realScaleType:"band"}:s==="radial"&&l==="angleAxis"?{scale:F2(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:ix(),realScaleType:"point"}:a==="category"?{scale:Fx(),realScaleType:"band"}:{scale:F2(),realScaleType:"linear"};if(Ob(o)){var c="scale".concat(wS(o));return{scale:(zM[c]||ix)(),realScaleType:zM[c]?c:"point"}}return Ar(o)?{scale:o}:{scale:ix(),realScaleType:"point"}},JM=1e-4,vY=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,o=t.range(),a=Math.min(o[0],o[1])-JM,s=Math.max(o[0],o[1])+JM,l=t(r[0]),c=t(r[n-1]);(l<a||l>s||c<a||c>s)&&t.domain([r[0],r[n-1]])}},_ve=function(t,r){if(!t)return null;for(var n=0,o=t.length;n<o;n++)if(t[n].item===r)return t[n].position;return null},Cve=function(t,r){if(!r||r.length!==2||!qt(r[0])||!qt(r[1]))return t;var n=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]),a=[t[0],t[1]];return(!qt(t[0])||t[0]<n)&&(a[0]=n),(!qt(t[1])||t[1]>o)&&(a[1]=o),a[0]>o&&(a[0]=o),a[1]<n&&(a[1]=n),a},Eve=function(t){var r=t.length;if(!(r<=0))for(var n=0,o=t[0].length;n<o;++n)for(var a=0,s=0,l=0;l<r;++l){var c=Nb(t[l][n][1])?t[l][n][0]:t[l][n][1];c>=0?(t[l][n][0]=a,t[l][n][1]=a+c,a=t[l][n][1]):(t[l][n][0]=s,t[l][n][1]=s+c,s=t[l][n][1])}},Ave=function(t){var r=t.length;if(!(r<=0))for(var n=0,o=t[0].length;n<o;++n)for(var a=0,s=0;s<r;++s){var l=Nb(t[s][n][1])?t[s][n][0]:t[s][n][1];l>=0?(t[s][n][0]=a,t[s][n][1]=a+l,a=t[s][n][1]):(t[s][n][0]=0,t[s][n][1]=0)}},Tve={sign:Eve,expand:vue,none:Lm,silhouette:yue,wiggle:xue,positive:Ave},Pve=function(t,r,n){var o=r.map(function(l){return l.props.dataKey}),a=Tve[n],s=mue().keys(o).value(function(l,c){return+po(l,c,0)}).order(eA).offset(a);return s(t)},Ive=function(t,r,n,o,a,s){if(!t)return null;var l=s?r.reverse():r,c={},u=l.reduce(function(f,h){var p,v=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Oi(Oi({},h.type.defaultProps),h.props):h.props,m=v.stackId,b=v.hide;if(b)return f;var x=v[n],w=f[x]||{hasStack:!1,stackGroups:{}};if(mo(m)){var k=w.stackGroups[m]||{numericAxisId:n,cateAxisId:o,items:[]};k.items.push(h),w.hasStack=!0,w.stackGroups[m]=k}else w.stackGroups[Av("_stackId_")]={numericAxisId:n,cateAxisId:o,items:[h]};return Oi(Oi({},f),{},ym({},x,w))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var v={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,b){var x=p.stackGroups[b];return Oi(Oi({},m),{},ym({},b,{numericAxisId:n,cateAxisId:o,items:x.items,stackedData:Pve(t,x.items,a)}))},v)}return Oi(Oi({},f),{},ym({},h,p))},d)},yY=function(t,r){var n=r.realScaleType,o=r.type,a=r.tickCount,s=r.originalDomain,l=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&o==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=Hme(u,a,l);return t.domain([zS(d),FS(d)]),{niceTicks:d}}if(a&&o==="number"){var f=t.domain(),h=Vme(f,a,l);return{niceTicks:h}}return null};function eD(e){var t=e.axis,r=e.ticks,n=e.bandSize,o=e.entry,a=e.index,s=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Rr(o[t.dataKey])){var l=v2(r,"value",o[t.dataKey]);if(l)return l.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var c=po(o,Rr(s)?t.dataKey:s);return Rr(c)?null:t.scale(c)}var tD=function(t){var r=t.axis,n=t.ticks,o=t.offset,a=t.bandSize,s=t.entry,l=t.index;if(r.type==="category")return n[l]?n[l].coordinate+o:null;var c=po(s,r.dataKey,r.domain[l]);return Rr(c)?null:r.scale(c)-a/2+o},Ove=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var o=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return o<=0&&a>=0?0:a<0?a:o}return n[0]},Nve=function(t,r){var n,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Oi(Oi({},t.type.defaultProps),t.props):t.props,a=o.stackId;if(mo(a)){var s=r[a];if(s){var l=s.items.indexOf(t);return l>=0?s.stackedData[l]:null}}return null},Rve=function(t){return t.reduce(function(r,n){return[zS(n.concat([r[0]]).filter(qt)),FS(n.concat([r[1]]).filter(qt))]},[1/0,-1/0])},xY=function(t,r,n){return Object.keys(t).reduce(function(o,a){var s=t[a],l=s.stackedData,c=l.reduce(function(u,d){var f=Rve(d.slice(r,n+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],o[0]),Math.max(c[1],o[1])]},[1/0,-1/0]).map(function(o){return o===1/0||o===-1/0?0:o})},rD=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,nD=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,_A=function(t,r,n){if(Ar(t))return t(r,n);if(!Array.isArray(t))return r;var o=[];if(qt(t[0]))o[0]=n?t[0]:Math.min(t[0],r[0]);else if(rD.test(t[0])){var a=+rD.exec(t[0])[1];o[0]=r[0]-a}else Ar(t[0])?o[0]=t[0](r[0]):o[0]=r[0];if(qt(t[1]))o[1]=n?t[1]:Math.max(t[1],r[1]);else if(nD.test(t[1])){var s=+nD.exec(t[1])[1];o[1]=r[1]+s}else Ar(t[1])?o[1]=t[1](r[1]):o[1]=r[1];return o},$2=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var o=t.scale.bandwidth();if(!n||o>0)return o}if(t&&r&&r.length>=2){for(var a=cP(r,function(f){return f.coordinate}),s=1/0,l=1,c=a.length;l<c;l++){var u=a[l],d=a[l-1];s=Math.min((u.coordinate||0)-(d.coordinate||0),s)}return s===1/0?0:s}return n?void 0:0},iD=function(t,r,n){return!t||!t.length||Db(t,Gs(n,"type.defaultProps.domain"))?r:t},bY=function(t,r){var n=t.type.defaultProps?Oi(Oi({},t.type.defaultProps),t.props):t.props,o=n.dataKey,a=n.name,s=n.unit,l=n.formatter,c=n.tooltipType,u=n.chartType,d=n.hide;return Oi(Oi({},yr(t,!1)),{},{dataKey:o,unit:s,formatter:l,name:a||o,color:LP(t),value:po(r,o),type:c,payload:r,chartType:u,hide:d})};function Hx(e){"@babel/helpers - typeof";return Hx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hx(e)}function oD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ju(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oD(Object(r),!0).forEach(function(n){wY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wY(e,t,r){return t=Lve(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lve(e){var t=Fve(e,"string");return Hx(t)=="symbol"?t:t+""}function Fve(e,t){if(Hx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zve(e,t){return Wve(e)||Bve(e,t)||Dve(e,t)||Mve()}function Mve(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dve(e,t){if(e){if(typeof e=="string")return aD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return aD(e,t)}}function aD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Bve(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function Wve(e){if(Array.isArray(e))return e}var U2=Math.PI/180,qve=function(t){return t*180/Math.PI},Xn=function(t,r,n,o){return{x:t+Math.cos(-U2*o)*n,y:r+Math.sin(-U2*o)*n}},SY=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},$ve=function(t,r,n,o,a){var s=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Ua(t.cx,s,s/2),f=Ua(t.cy,l,l/2),h=SY(s,l,n),p=Ua(t.innerRadius,h,0),v=Ua(t.outerRadius,h,h*.8),m=Object.keys(r);return m.reduce(function(b,x){var w=r[x],k=w.domain,j=w.reversed,_;if(Rr(w.range))o==="angleAxis"?_=[c,u]:o==="radiusAxis"&&(_=[p,v]),j&&(_=[_[1],_[0]]);else{_=w.range;var T=_,A=zve(T,2);c=A[0],u=A[1]}var P=mY(w,a),N=P.realScaleType,O=P.scale;O.domain(k).range(_),vY(O);var C=yY(O,Ju(Ju({},w),{},{realScaleType:N})),I=Ju(Ju(Ju({},w),C),{},{range:_,radius:v,realScaleType:N,scale:O,cx:d,cy:f,innerRadius:p,outerRadius:v,startAngle:c,endAngle:u});return Ju(Ju({},b),{},wY({},x,I))},{})},Uve=function(t,r){var n=t.x,o=t.y,a=r.x,s=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(o-s,2))},Hve=function(t,r){var n=t.x,o=t.y,a=r.cx,s=r.cy,l=Uve({x:n,y:o},{x:a,y:s});if(l<=0)return{radius:l};var c=(n-a)/l,u=Math.acos(c);return o>s&&(u=2*Math.PI-u),{radius:l,angle:qve(u),angleInRadian:u}},Vve=function(t){var r=t.startAngle,n=t.endAngle,o=Math.floor(r/360),a=Math.floor(n/360),s=Math.min(o,a);return{startAngle:r-s*360,endAngle:n-s*360}},Yve=function(t,r){var n=r.startAngle,o=r.endAngle,a=Math.floor(n/360),s=Math.floor(o/360),l=Math.min(a,s);return t+l*360},sD=function(t,r){var n=t.x,o=t.y,a=Hve({x:n,y:o},r),s=a.radius,l=a.angle,c=r.innerRadius,u=r.outerRadius;if(s<c||s>u)return!1;if(s===0)return!0;var d=Vve(r),f=d.startAngle,h=d.endAngle,p=l,v;if(f<=h){for(;p>h;)p-=360;for(;p<f;)p+=360;v=p>=f&&p<=h}else{for(;p>f;)p-=360;for(;p<h;)p+=360;v=p>=h&&p<=f}return v?Ju(Ju({},r),{},{radius:s,angle:Yve(p,r)}):null},jY=function(t){return!S.isValidElement(t)&&!Ar(t)&&typeof t!="boolean"?t.className:""};function Vx(e){"@babel/helpers - typeof";return Vx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vx(e)}var Gve=["offset"];function Kve(e){return Jve(e)||Zve(e)||Xve(e)||Qve()}function Qve(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xve(e,t){if(e){if(typeof e=="string")return CA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return CA(e,t)}}function Zve(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Jve(e){if(Array.isArray(e))return CA(e)}function CA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function eye(e,t){if(e==null)return{};var r=tye(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function tye(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function lD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function uo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lD(Object(r),!0).forEach(function(n){rye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rye(e,t,r){return t=nye(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nye(e){var t=iye(e,"string");return Vx(t)=="symbol"?t:t+""}function iye(e,t){if(Vx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yx(){return Yx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yx.apply(this,arguments)}var oye=function(t){var r=t.value,n=t.formatter,o=Rr(t.children)?r:t.children;return Ar(n)?n(o):o},aye=function(t,r){var n=$a(r-t),o=Math.min(Math.abs(r-t),360);return n*o},sye=function(t,r,n){var o=t.position,a=t.viewBox,s=t.offset,l=t.className,c=a,u=c.cx,d=c.cy,f=c.innerRadius,h=c.outerRadius,p=c.startAngle,v=c.endAngle,m=c.clockWise,b=(f+h)/2,x=aye(p,v),w=x>=0?1:-1,k,j;o==="insideStart"?(k=p+w*s,j=m):o==="insideEnd"?(k=v-w*s,j=!m):o==="end"&&(k=v+w*s,j=m),j=x<=0?j:!j;var _=Xn(u,d,b,k),T=Xn(u,d,b,k+(j?1:-1)*359),A="M".concat(_.x,",").concat(_.y,`
A`).concat(b,",").concat(b,",0,1,").concat(j?0:1,`,
`).concat(T.x,",").concat(T.y),P=Rr(t.id)?Av("recharts-radial-line-"):t.id;return $e.createElement("text",Yx({},n,{dominantBaseline:"central",className:Fr("recharts-radial-bar-label",l)}),$e.createElement("defs",null,$e.createElement("path",{id:P,d:A})),$e.createElement("textPath",{xlinkHref:"#".concat(P)},r))},lye=function(t){var r=t.viewBox,n=t.offset,o=t.position,a=r,s=a.cx,l=a.cy,c=a.innerRadius,u=a.outerRadius,d=a.startAngle,f=a.endAngle,h=(d+f)/2;if(o==="outside"){var p=Xn(s,l,u+n,h),v=p.x,m=p.y;return{x:v,y:m,textAnchor:v>=s?"start":"end",verticalAnchor:"middle"}}if(o==="center")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(o==="centerTop")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"start"};if(o==="centerBottom")return{x:s,y:l,textAnchor:"middle",verticalAnchor:"end"};var b=(c+u)/2,x=Xn(s,l,b,h),w=x.x,k=x.y;return{x:w,y:k,textAnchor:"middle",verticalAnchor:"middle"}},cye=function(t){var r=t.viewBox,n=t.parentViewBox,o=t.offset,a=t.position,s=r,l=s.x,c=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*o,p=f>0?"end":"start",v=f>0?"start":"end",m=u>=0?1:-1,b=m*o,x=m>0?"end":"start",w=m>0?"start":"end";if(a==="top"){var k={x:l+u/2,y:c-f*o,textAnchor:"middle",verticalAnchor:p};return uo(uo({},k),n?{height:Math.max(c-n.y,0),width:u}:{})}if(a==="bottom"){var j={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:v};return uo(uo({},j),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(a==="left"){var _={x:l-b,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return uo(uo({},_),n?{width:Math.max(_.x-n.x,0),height:d}:{})}if(a==="right"){var T={x:l+u+b,y:c+d/2,textAnchor:w,verticalAnchor:"middle"};return uo(uo({},T),n?{width:Math.max(n.x+n.width-T.x,0),height:d}:{})}var A=n?{width:u,height:d}:{};return a==="insideLeft"?uo({x:l+b,y:c+d/2,textAnchor:w,verticalAnchor:"middle"},A):a==="insideRight"?uo({x:l+u-b,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},A):a==="insideTop"?uo({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:v},A):a==="insideBottom"?uo({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},A):a==="insideTopLeft"?uo({x:l+b,y:c+h,textAnchor:w,verticalAnchor:v},A):a==="insideTopRight"?uo({x:l+u-b,y:c+h,textAnchor:x,verticalAnchor:v},A):a==="insideBottomLeft"?uo({x:l+b,y:c+d-h,textAnchor:w,verticalAnchor:p},A):a==="insideBottomRight"?uo({x:l+u-b,y:c+d-h,textAnchor:x,verticalAnchor:p},A):Ev(a)&&(qt(a.x)||lh(a.x))&&(qt(a.y)||lh(a.y))?uo({x:l+Ua(a.x,u),y:c+Ua(a.y,d),textAnchor:"end",verticalAnchor:"end"},A):uo({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},A)},uye=function(t){return"cx"in t&&qt(t.cx)};function Fo(e){var t=e.offset,r=t===void 0?5:t,n=eye(e,Gve),o=uo({offset:r},n),a=o.viewBox,s=o.position,l=o.value,c=o.children,u=o.content,d=o.className,f=d===void 0?"":d,h=o.textBreakAll;if(!a||Rr(l)&&Rr(c)&&!S.isValidElement(u)&&!Ar(u))return null;if(S.isValidElement(u))return S.cloneElement(u,o);var p;if(Ar(u)){if(p=S.createElement(u,o),S.isValidElement(p))return p}else p=oye(o);var v=uye(a),m=yr(o,!0);if(v&&(s==="insideStart"||s==="insideEnd"||s==="end"))return sye(o,p,m);var b=v?lye(o):cye(o);return $e.createElement(Ah,Yx({className:Fr("recharts-label",f)},m,b,{breakAll:h}),p)}Fo.displayName="Label";var kY=function(t){var r=t.cx,n=t.cy,o=t.angle,a=t.startAngle,s=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,v=t.left,m=t.width,b=t.height,x=t.clockWise,w=t.labelViewBox;if(w)return w;if(qt(m)&&qt(b)){if(qt(f)&&qt(h))return{x:f,y:h,width:m,height:b};if(qt(p)&&qt(v))return{x:p,y:v,width:m,height:b}}return qt(f)&&qt(h)?{x:f,y:h,width:0,height:0}:qt(r)&&qt(n)?{cx:r,cy:n,startAngle:a||o||0,endAngle:s||o||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:x}:t.viewBox?t.viewBox:{}},dye=function(t,r){return t?t===!0?$e.createElement(Fo,{key:"label-implicit",viewBox:r}):mo(t)?$e.createElement(Fo,{key:"label-implicit",viewBox:r,value:t}):S.isValidElement(t)?t.type===Fo?S.cloneElement(t,{key:"label-implicit",viewBox:r}):$e.createElement(Fo,{key:"label-implicit",content:t,viewBox:r}):Ar(t)?$e.createElement(Fo,{key:"label-implicit",content:t,viewBox:r}):Ev(t)?$e.createElement(Fo,Yx({viewBox:r},t,{key:"label-implicit"})):null:null},fye=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var o=t.children,a=kY(t),s=Ks(o,Fo).map(function(c,u){return S.cloneElement(c,{viewBox:r||a,key:"label-".concat(u)})});if(!n)return s;var l=dye(t.label,r||a);return[l].concat(Kve(s))};Fo.parseViewBox=kY;Fo.renderCallByParent=fye;var E4,cD;function pye(){if(cD)return E4;cD=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return E4=e,E4}var hye=pye();const gye=dn(hye);function Gx(e){"@babel/helpers - typeof";return Gx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gx(e)}var mye=["valueAccessor"],vye=["data","dataKey","clockWise","id","textBreakAll"];function yye(e){return Sye(e)||wye(e)||bye(e)||xye()}function xye(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bye(e,t){if(e){if(typeof e=="string")return EA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return EA(e,t)}}function wye(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Sye(e){if(Array.isArray(e))return EA(e)}function EA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function H2(){return H2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},H2.apply(this,arguments)}function uD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function dD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uD(Object(r),!0).forEach(function(n){jye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jye(e,t,r){return t=kye(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kye(e){var t=_ye(e,"string");return Gx(t)=="symbol"?t:t+""}function _ye(e,t){if(Gx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Gx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fD(e,t){if(e==null)return{};var r=Cye(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cye(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Eye=function(t){return Array.isArray(t.value)?gye(t.value):t.value};function gd(e){var t=e.valueAccessor,r=t===void 0?Eye:t,n=fD(e,mye),o=n.data,a=n.dataKey,s=n.clockWise,l=n.id,c=n.textBreakAll,u=fD(n,vye);return!o||!o.length?null:$e.createElement(cn,{className:"recharts-label-list"},o.map(function(d,f){var h=Rr(a)?r(d,f):po(d&&d.payload,a),p=Rr(l)?{}:{id:"".concat(l,"-").concat(f)};return $e.createElement(Fo,H2({},yr(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Fo.parseViewBox(Rr(s)?d:dD(dD({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}gd.displayName="LabelList";function Aye(e,t){return e?e===!0?$e.createElement(gd,{key:"labelList-implicit",data:t}):$e.isValidElement(e)||Ar(e)?$e.createElement(gd,{key:"labelList-implicit",data:t,content:e}):Ev(e)?$e.createElement(gd,H2({data:t},e,{key:"labelList-implicit"})):null:null}function Tye(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,o=Ks(n,gd).map(function(s,l){return S.cloneElement(s,{data:t,key:"labelList-".concat(l)})});if(!r)return o;var a=Aye(e.label,t);return[a].concat(yye(o))}gd.renderCallByParent=Tye;function Kx(e){"@babel/helpers - typeof";return Kx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kx(e)}function AA(){return AA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},AA.apply(this,arguments)}function pD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function hD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pD(Object(r),!0).forEach(function(n){Pye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Pye(e,t,r){return t=Iye(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Iye(e){var t=Oye(e,"string");return Kx(t)=="symbol"?t:t+""}function Oye(e,t){if(Kx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Kx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Nye=function(t,r){var n=$a(r-t),o=Math.min(Math.abs(r-t),359.999);return n*o},l1=function(t){var r=t.cx,n=t.cy,o=t.radius,a=t.angle,s=t.sign,l=t.isExternal,c=t.cornerRadius,u=t.cornerIsExternal,d=c*(l?1:-1)+o,f=Math.asin(c/d)/U2,h=u?a:a+s*f,p=Xn(r,n,d,h),v=Xn(r,n,o,h),m=u?a-s*f:a,b=Xn(r,n,d*Math.cos(f*U2),m);return{center:p,circleTangency:v,lineTangency:b,theta:f}},_Y=function(t){var r=t.cx,n=t.cy,o=t.innerRadius,a=t.outerRadius,s=t.startAngle,l=t.endAngle,c=Nye(s,l),u=s+c,d=Xn(r,n,a,s),f=Xn(r,n,a,u),h="M ".concat(d.x,",").concat(d.y,`
A `).concat(a,",").concat(a,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(s>u),`,
`).concat(f.x,",").concat(f.y,`
`);if(o>0){var p=Xn(r,n,o,s),v=Xn(r,n,o,u);h+="L ".concat(v.x,",").concat(v.y,`
A `).concat(o,",").concat(o,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(s<=u),`,
`).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},Rye=function(t){var r=t.cx,n=t.cy,o=t.innerRadius,a=t.outerRadius,s=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=$a(d-u),h=l1({cx:r,cy:n,radius:a,angle:u,sign:f,cornerRadius:s,cornerIsExternal:c}),p=h.circleTangency,v=h.lineTangency,m=h.theta,b=l1({cx:r,cy:n,radius:a,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:c}),x=b.circleTangency,w=b.lineTangency,k=b.theta,j=c?Math.abs(u-d):Math.abs(u-d)-m-k;if(j<0)return l?"M ".concat(v.x,",").concat(v.y,`
a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0
a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0
`):_Y({cx:r,cy:n,innerRadius:o,outerRadius:a,startAngle:u,endAngle:d});var _="M ".concat(v.x,",").concat(v.y,`
A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,`
A`).concat(a,",").concat(a,",0,").concat(+(j>180),",").concat(+(f<0),",").concat(x.x,",").concat(x.y,`
A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(w.x,",").concat(w.y,`
`);if(o>0){var T=l1({cx:r,cy:n,radius:o,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),A=T.circleTangency,P=T.lineTangency,N=T.theta,O=l1({cx:r,cy:n,radius:o,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),C=O.circleTangency,I=O.lineTangency,R=O.theta,F=c?Math.abs(u-d):Math.abs(u-d)-N-R;if(F<0&&s===0)return"".concat(_,"L").concat(r,",").concat(n,"Z");_+="L".concat(I.x,",").concat(I.y,`
A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(C.x,",").concat(C.y,`
A`).concat(o,",").concat(o,",0,").concat(+(F>180),",").concat(+(f>0),",").concat(A.x,",").concat(A.y,`
A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(P.x,",").concat(P.y,"Z")}else _+="L".concat(r,",").concat(n,"Z");return _},Lye={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},CY=function(t){var r=hD(hD({},Lye),t),n=r.cx,o=r.cy,a=r.innerRadius,s=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,f=r.endAngle,h=r.className;if(s<a||d===f)return null;var p=Fr("recharts-sector",h),v=s-a,m=Ua(l,v,0,!0),b;return m>0&&Math.abs(d-f)<360?b=Rye({cx:n,cy:o,innerRadius:a,outerRadius:s,cornerRadius:Math.min(m,v/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):b=_Y({cx:n,cy:o,innerRadius:a,outerRadius:s,startAngle:d,endAngle:f}),$e.createElement("path",AA({},yr(r,!0),{className:p,d:b,role:"img"}))};function Qx(e){"@babel/helpers - typeof";return Qx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qx(e)}function TA(){return TA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},TA.apply(this,arguments)}function gD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function mD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gD(Object(r),!0).forEach(function(n){Fye(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fye(e,t,r){return t=zye(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zye(e){var t=Mye(e,"string");return Qx(t)=="symbol"?t:t+""}function Mye(e,t){if(Qx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Qx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var vD={curveBasisClosed:oue,curveBasisOpen:aue,curveBasis:iue,curveBumpX:Uce,curveBumpY:Hce,curveLinearClosed:sue,curveLinear:jS,curveMonotoneX:lue,curveMonotoneY:cue,curveNatural:uue,curveStep:due,curveStepAfter:pue,curveStepBefore:fue},c1=function(t){return t.x===+t.x&&t.y===+t.y},Cy=function(t){return t.x},Ey=function(t){return t.y},Dye=function(t,r){if(Ar(t))return t;var n="curve".concat(wS(t));return(n==="curveMonotone"||n==="curveBump")&&r?vD["".concat(n).concat(r==="vertical"?"Y":"X")]:vD[n]||jS},Bye=function(t){var r=t.type,n=r===void 0?"linear":r,o=t.points,a=o===void 0?[]:o,s=t.baseLine,l=t.layout,c=t.connectNulls,u=c===void 0?!1:c,d=Dye(n,l),f=u?a.filter(function(m){return c1(m)}):a,h;if(Array.isArray(s)){var p=u?s.filter(function(m){return c1(m)}):s,v=f.map(function(m,b){return mD(mD({},m),{},{base:p[b]})});return l==="vertical"?h=e1().y(Ey).x1(Cy).x0(function(m){return m.base.x}):h=e1().x(Cy).y1(Ey).y0(function(m){return m.base.y}),h.defined(c1).curve(d),h(v)}return l==="vertical"&&qt(s)?h=e1().y(Ey).x1(Cy).x0(s):qt(s)?h=e1().x(Cy).y1(Ey).y0(s):h=kH().x(Cy).y(Ey),h.defined(c1).curve(d),h(f)},V2=function(t){var r=t.className,n=t.points,o=t.path,a=t.pathRef;if((!n||!n.length)&&!o)return null;var s=n&&n.length?Bye(t):o;return $e.createElement("path",TA({},yr(t,!1),y2(t),{className:Fr("recharts-curve",r),d:s,ref:a}))},A4={exports:{}},T4,yD;function Wye(){if(yD)return T4;yD=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return T4=e,T4}var P4,xD;function qye(){if(xD)return P4;xD=1;var e=Wye();function t(){}function r(){}return r.resetWarningCache=t,P4=function(){function n(s,l,c,u,d,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}n.isRequired=n;function o(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return a.PropTypes=a,a},P4}var bD;function $ye(){return bD||(bD=1,A4.exports=qye()()),A4.exports}var Uye=$ye();const bn=dn(Uye),{getOwnPropertyNames:Hye,getOwnPropertySymbols:Vye}=Object,{hasOwnProperty:Yye}=Object.prototype;function I4(e,t){return function(n,o,a){return e(n,o,a)&&t(n,o,a)}}function u1(e){return function(r,n,o){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,o);const{cache:a}=o,s=a.get(r),l=a.get(n);if(s&&l)return s===n&&l===r;a.set(r,n),a.set(n,r);const c=e(r,n,o);return a.delete(r),a.delete(n),c}}function Gye(e){return e!=null?e[Symbol.toStringTag]:void 0}function wD(e){return Hye(e).concat(Vye(e))}const Kye=Object.hasOwn||((e,t)=>Yye.call(e,t));function Qh(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const Qye="__v",Xye="__o",Zye="_owner",{getOwnPropertyDescriptor:SD,keys:jD}=Object;function Jye(e,t){return e.byteLength===t.byteLength&&Y2(new Uint8Array(e),new Uint8Array(t))}function exe(e,t,r){let n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function txe(e,t){return e.byteLength===t.byteLength&&Y2(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function rxe(e,t){return Qh(e.getTime(),t.getTime())}function nxe(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function ixe(e,t){return e===t}function kD(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const o=new Array(n),a=e.entries();let s,l,c=0;for(;(s=a.next())&&!s.done;){const u=t.entries();let d=!1,f=0;for(;(l=u.next())&&!l.done;){if(o[f]){f++;continue}const h=s.value,p=l.value;if(r.equals(h[0],p[0],c,f,e,t,r)&&r.equals(h[1],p[1],h[0],p[0],e,t,r)){d=o[f]=!0;break}f++}if(!d)return!1;c++}return!0}const oxe=Qh;function axe(e,t,r){const n=jD(e);let o=n.length;if(jD(t).length!==o)return!1;for(;o-- >0;)if(!EY(e,t,r,n[o]))return!1;return!0}function Ay(e,t,r){const n=wD(e);let o=n.length;if(wD(t).length!==o)return!1;let a,s,l;for(;o-- >0;)if(a=n[o],!EY(e,t,r,a)||(s=SD(e,a),l=SD(t,a),(s||l)&&(!s||!l||s.configurable!==l.configurable||s.enumerable!==l.enumerable||s.writable!==l.writable)))return!1;return!0}function sxe(e,t){return Qh(e.valueOf(),t.valueOf())}function lxe(e,t){return e.source===t.source&&e.flags===t.flags}function _D(e,t,r){const n=e.size;if(n!==t.size)return!1;if(!n)return!0;const o=new Array(n),a=e.values();let s,l;for(;(s=a.next())&&!s.done;){const c=t.values();let u=!1,d=0;for(;(l=c.next())&&!l.done;){if(!o[d]&&r.equals(s.value,l.value,s.value,l.value,e,t,r)){u=o[d]=!0;break}d++}if(!u)return!1}return!0}function Y2(e,t){let r=e.byteLength;if(t.byteLength!==r||e.byteOffset!==t.byteOffset)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function cxe(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function EY(e,t,r,n){return(n===Zye||n===Xye||n===Qye)&&(e.$$typeof||t.$$typeof)?!0:Kye(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}const uxe="[object ArrayBuffer]",dxe="[object Arguments]",fxe="[object Boolean]",pxe="[object DataView]",hxe="[object Date]",gxe="[object Error]",mxe="[object Map]",vxe="[object Number]",yxe="[object Object]",xxe="[object RegExp]",bxe="[object Set]",wxe="[object String]",Sxe={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},jxe="[object URL]",kxe=Object.prototype.toString;function _xe({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:a,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:u,areRegExpsEqual:d,areSetsEqual:f,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:v}){return function(b,x,w){if(b===x)return!0;if(b==null||x==null)return!1;const k=typeof b;if(k!==typeof x)return!1;if(k!=="object")return k==="number"?l(b,x,w):k==="function"?a(b,x,w):!1;const j=b.constructor;if(j!==x.constructor)return!1;if(j===Object)return c(b,x,w);if(Array.isArray(b))return t(b,x,w);if(j===Date)return n(b,x,w);if(j===RegExp)return d(b,x,w);if(j===Map)return s(b,x,w);if(j===Set)return f(b,x,w);const _=kxe.call(b);if(_===hxe)return n(b,x,w);if(_===xxe)return d(b,x,w);if(_===mxe)return s(b,x,w);if(_===bxe)return f(b,x,w);if(_===yxe)return typeof b.then!="function"&&typeof x.then!="function"&&c(b,x,w);if(_===jxe)return p(b,x,w);if(_===gxe)return o(b,x,w);if(_===dxe)return c(b,x,w);if(Sxe[_])return h(b,x,w);if(_===uxe)return e(b,x,w);if(_===pxe)return r(b,x,w);if(_===fxe||_===vxe||_===wxe)return u(b,x,w);if(v){let T=v[_];if(!T){const A=Gye(b);A&&(T=v[A])}if(T)return T(b,x,w)}return!1}}function Cxe({circular:e,createCustomConfig:t,strict:r}){let n={areArrayBuffersEqual:Jye,areArraysEqual:r?Ay:exe,areDataViewsEqual:txe,areDatesEqual:rxe,areErrorsEqual:nxe,areFunctionsEqual:ixe,areMapsEqual:r?I4(kD,Ay):kD,areNumbersEqual:oxe,areObjectsEqual:r?Ay:axe,arePrimitiveWrappersEqual:sxe,areRegExpsEqual:lxe,areSetsEqual:r?I4(_D,Ay):_D,areTypedArraysEqual:r?I4(Y2,Ay):Y2,areUrlsEqual:cxe,unknownTagComparators:void 0};if(t&&(n=Object.assign({},n,t(n))),e){const o=u1(n.areArraysEqual),a=u1(n.areMapsEqual),s=u1(n.areObjectsEqual),l=u1(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:a,areObjectsEqual:s,areSetsEqual:l})}return n}function Exe(e){return function(t,r,n,o,a,s,l){return e(t,r,l)}}function Axe({circular:e,comparator:t,createState:r,equals:n,strict:o}){if(r)return function(l,c){const{cache:u=e?new WeakMap:void 0,meta:d}=r();return t(l,c,{cache:u,equals:n,meta:d,strict:o})};if(e)return function(l,c){return t(l,c,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};const a={cache:void 0,equals:n,meta:void 0,strict:o};return function(l,c){return t(l,c,a)}}const Txe=rp();rp({strict:!0});rp({circular:!0});rp({circular:!0,strict:!0});rp({createInternalComparator:()=>Qh});rp({strict:!0,createInternalComparator:()=>Qh});rp({circular:!0,createInternalComparator:()=>Qh});rp({circular:!0,createInternalComparator:()=>Qh,strict:!0});function rp(e={}){const{circular:t=!1,createInternalComparator:r,createState:n,strict:o=!1}=e,a=Cxe(e),s=_xe(a),l=r?r(s):Exe(s);return Axe({circular:t,comparator:s,createState:n,equals:l,strict:o})}function Pxe(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function CD(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function o(a){r<0&&(r=a),a-r>t?(e(a),r=-1):Pxe(o)};requestAnimationFrame(n)}function PA(e){"@babel/helpers - typeof";return PA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},PA(e)}function Ixe(e){return Lxe(e)||Rxe(e)||Nxe(e)||Oxe()}function Oxe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nxe(e,t){if(e){if(typeof e=="string")return ED(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ED(e,t)}}function ED(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Rxe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lxe(e){if(Array.isArray(e))return e}function Fxe(){var e={},t=function(){return null},r=!1,n=function o(a){if(!r){if(Array.isArray(a)){if(!a.length)return;var s=a,l=Ixe(s),c=l[0],u=l.slice(1);if(typeof c=="number"){CD(o.bind(null,u),c);return}o(c),CD(o.bind(null,u));return}PA(a)==="object"&&(e=a,t(e)),typeof a=="function"&&a()}};return{stop:function(){r=!0},start:function(a){r=!1,n(a)},subscribe:function(a){return t=a,function(){t=function(){return null}}}}}function Xx(e){"@babel/helpers - typeof";return Xx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xx(e)}function AD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function TD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?AD(Object(r),!0).forEach(function(n){AY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function AY(e,t,r){return t=zxe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zxe(e){var t=Mxe(e,"string");return Xx(t)==="symbol"?t:String(t)}function Mxe(e,t){if(Xx(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Xx(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Dxe=function(t,r){return[Object.keys(t),Object.keys(r)].reduce(function(n,o){return n.filter(function(a){return o.includes(a)})})},Bxe=function(t){return t},Wxe=function(t){return t.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},ax=function(t,r){return Object.keys(r).reduce(function(n,o){return TD(TD({},n),{},AY({},o,t(o,r[o])))},{})},PD=function(t,r,n){return t.map(function(o){return"".concat(Wxe(o)," ").concat(r,"ms ").concat(n)}).join(",")};function qxe(e,t){return Hxe(e)||Uxe(e,t)||TY(e,t)||$xe()}function $xe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uxe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function Hxe(e){if(Array.isArray(e))return e}function Vxe(e){return Kxe(e)||Gxe(e)||TY(e)||Yxe()}function Yxe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TY(e,t){if(e){if(typeof e=="string")return IA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return IA(e,t)}}function Gxe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Kxe(e){if(Array.isArray(e))return IA(e)}function IA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var G2=1e-4,PY=function(t,r){return[0,3*t,3*r-6*t,3*t-3*r+1]},IY=function(t,r){return t.map(function(n,o){return n*Math.pow(r,o)}).reduce(function(n,o){return n+o})},ID=function(t,r){return function(n){var o=PY(t,r);return IY(o,n)}},Qxe=function(t,r){return function(n){var o=PY(t,r),a=[].concat(Vxe(o.map(function(s,l){return s*l}).slice(1)),[0]);return IY(a,n)}},OD=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r[0],a=r[1],s=r[2],l=r[3];if(r.length===1)switch(r[0]){case"linear":o=0,a=0,s=1,l=1;break;case"ease":o=.25,a=.1,s=.25,l=1;break;case"ease-in":o=.42,a=0,s=1,l=1;break;case"ease-out":o=.42,a=0,s=.58,l=1;break;case"ease-in-out":o=0,a=0,s=.58,l=1;break;default:{var c=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(b){return parseFloat(b)}),d=qxe(u,4);o=d[0],a=d[1],s=d[2],l=d[3]}}}var f=ID(o,s),h=ID(a,l),p=Qxe(o,s),v=function(x){return x>1?1:x<0?0:x},m=function(x){for(var w=x>1?1:x,k=w,j=0;j<8;++j){var _=f(k)-w,T=p(k);if(Math.abs(_-w)<G2||T<G2)return h(k);k=v(k-_/T)}return h(k)};return m.isStepper=!1,m},Xxe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,o=t.damping,a=o===void 0?8:o,s=t.dt,l=s===void 0?17:s,c=function(d,f,h){var p=-(d-f)*n,v=h*a,m=h+(p-v)*l/1e3,b=h*l/1e3+d;return Math.abs(b-f)<G2&&Math.abs(m)<G2?[f,0]:[b,m]};return c.isStepper=!0,c.dt=l,c},Zxe=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var o=r[0];if(typeof o=="string")switch(o){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return OD(o);case"spring":return Xxe();default:if(o.split("(")[0]==="cubic-bezier")return OD(o)}return typeof o=="function"?o:null};function Zx(e){"@babel/helpers - typeof";return Zx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zx(e)}function ND(e){return tbe(e)||ebe(e)||OY(e)||Jxe()}function Jxe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ebe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tbe(e){if(Array.isArray(e))return NA(e)}function RD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Jo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?RD(Object(r),!0).forEach(function(n){OA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function OA(e,t,r){return t=rbe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rbe(e){var t=nbe(e,"string");return Zx(t)==="symbol"?t:String(t)}function nbe(e,t){if(Zx(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Zx(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ibe(e,t){return sbe(e)||abe(e,t)||OY(e,t)||obe()}function obe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OY(e,t){if(e){if(typeof e=="string")return NA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return NA(e,t)}}function NA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function abe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function sbe(e){if(Array.isArray(e))return e}var K2=function(t,r,n){return t+(r-t)*n},RA=function(t){var r=t.from,n=t.to;return r!==n},lbe=function e(t,r,n){var o=ax(function(a,s){if(RA(s)){var l=t(s.from,s.to,s.velocity),c=ibe(l,2),u=c[0],d=c[1];return Jo(Jo({},s),{},{from:u,velocity:d})}return s},r);return n<1?ax(function(a,s){return RA(s)?Jo(Jo({},s),{},{velocity:K2(s.velocity,o[a].velocity,n),from:K2(s.from,o[a].from,n)}):s},r):e(t,o,n-1)};const cbe=(function(e,t,r,n,o){var a=Dxe(e,t),s=a.reduce(function(b,x){return Jo(Jo({},b),{},OA({},x,[e[x],t[x]]))},{}),l=a.reduce(function(b,x){return Jo(Jo({},b),{},OA({},x,{from:e[x],velocity:0,to:t[x]}))},{}),c=-1,u,d,f=function(){return null},h=function(){return ax(function(x,w){return w.from},l)},p=function(){return!Object.values(l).filter(RA).length},v=function(x){u||(u=x);var w=x-u,k=w/r.dt;l=lbe(r,l,k),o(Jo(Jo(Jo({},e),t),h())),u=x,p()||(c=requestAnimationFrame(f))},m=function(x){d||(d=x);var w=(x-d)/n,k=ax(function(_,T){return K2.apply(void 0,ND(T).concat([r(w)]))},s);if(o(Jo(Jo(Jo({},e),t),k)),w<1)c=requestAnimationFrame(f);else{var j=ax(function(_,T){return K2.apply(void 0,ND(T).concat([r(1)]))},s);o(Jo(Jo(Jo({},e),t),j))}};return f=r.isStepper?v:m,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}});function Um(e){"@babel/helpers - typeof";return Um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Um(e)}var ube=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function dbe(e,t){if(e==null)return{};var r=fbe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function fbe(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function O4(e){return mbe(e)||gbe(e)||hbe(e)||pbe()}function pbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hbe(e,t){if(e){if(typeof e=="string")return LA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return LA(e,t)}}function gbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function mbe(e){if(Array.isArray(e))return LA(e)}function LA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function LD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Jl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LD(Object(r),!0).forEach(function(n){Zy(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zy(e,t,r){return t=NY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ybe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,NY(n.key),n)}}function xbe(e,t,r){return t&&ybe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function NY(e){var t=bbe(e,"string");return Um(t)==="symbol"?t:String(t)}function bbe(e,t){if(Um(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Um(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wbe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&FA(e,t)}function FA(e,t){return FA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},FA(e,t)}function Sbe(e){var t=jbe();return function(){var n=Q2(e),o;if(t){var a=Q2(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return zA(this,o)}}function zA(e,t){if(t&&(Um(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return MA(e)}function MA(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jbe(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Q2(e){return Q2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Q2(e)}var lu=(function(e){wbe(r,e);var t=Sbe(r);function r(n,o){var a;vbe(this,r),a=t.call(this,n,o);var s=a.props,l=s.isActive,c=s.attributeName,u=s.from,d=s.to,f=s.steps,h=s.children,p=s.duration;if(a.handleStyleChange=a.handleStyleChange.bind(MA(a)),a.changeStyle=a.changeStyle.bind(MA(a)),!l||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:d}),zA(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof h=="function")return a.state={style:u},zA(a);a.state={style:c?Zy({},c,u):u}}else a.state={style:{}};return a}return xbe(r,[{key:"componentDidMount",value:function(){var o=this.props,a=o.isActive,s=o.canBegin;this.mounted=!0,!(!a||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(o){var a=this.props,s=a.isActive,l=a.canBegin,c=a.attributeName,u=a.shouldReAnimate,d=a.to,f=a.from,h=this.state.style;if(l){if(!s){var p={style:c?Zy({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(Txe(o.to,d)&&o.canBegin&&o.isActive)){var v=!o.canBegin||!o.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=v||u?f:o.to;if(this.state&&h){var b={style:c?Zy({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(b)}this.runAnimation(Jl(Jl({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var o=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),o&&o()}},{key:"handleStyleChange",value:function(o){this.changeStyle(o)}},{key:"changeStyle",value:function(o){this.mounted&&this.setState({style:o})}},{key:"runJSAnimation",value:function(o){var a=this,s=o.from,l=o.to,c=o.duration,u=o.easing,d=o.begin,f=o.onAnimationEnd,h=o.onAnimationStart,p=cbe(s,l,Zxe(u),c,this.changeStyle),v=function(){a.stopJSAnimation=p()};this.manager.start([h,d,v,c,f])}},{key:"runStepAnimation",value:function(o){var a=this,s=o.steps,l=o.begin,c=o.onAnimationStart,u=s[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,b,x){if(x===0)return m;var w=b.duration,k=b.easing,j=k===void 0?"ease":k,_=b.style,T=b.properties,A=b.onAnimationEnd,P=x>0?s[x-1]:b,N=T||Object.keys(_);if(typeof j=="function"||j==="spring")return[].concat(O4(m),[a.runJSAnimation.bind(a,{from:P.style,to:_,duration:w,easing:j}),w]);var O=PD(N,w,j),C=Jl(Jl(Jl({},P.style),_),{},{transition:O});return[].concat(O4(m),[C,w,A]).filter(Bxe)};return this.manager.start([c].concat(O4(s.reduce(p,[d,Math.max(h,l)])),[o.onAnimationEnd]))}},{key:"runAnimation",value:function(o){this.manager||(this.manager=Fxe());var a=o.begin,s=o.duration,l=o.attributeName,c=o.to,u=o.easing,d=o.onAnimationStart,f=o.onAnimationEnd,h=o.steps,p=o.children,v=this.manager;if(this.unSubscribe=v.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(o);return}if(h.length>1){this.runStepAnimation(o);return}var m=l?Zy({},l,c):c,b=PD(Object.keys(m),s,u);v.start([d,a,Jl(Jl({},m),{},{transition:b}),s,f])}},{key:"render",value:function(){var o=this.props,a=o.children;o.begin;var s=o.duration;o.attributeName,o.easing;var l=o.isActive;o.steps,o.from,o.to,o.canBegin,o.onAnimationEnd,o.shouldReAnimate,o.onAnimationReStart;var c=dbe(o,ube),u=S.Children.count(a),d=this.state.style;if(typeof a=="function")return a(d);if(!l||u===0||s<=0)return a;var f=function(p){var v=p.props,m=v.style,b=m===void 0?{}:m,x=v.className,w=S.cloneElement(p,Jl(Jl({},c),{},{style:Jl(Jl({},b),d),className:x}));return w};return u===1?f(S.Children.only(a)):$e.createElement("div",null,S.Children.map(a,function(h){return f(h)}))}}]),r})(S.PureComponent);lu.displayName="Animate";lu.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};lu.propTypes={from:bn.oneOfType([bn.object,bn.string]),to:bn.oneOfType([bn.object,bn.string]),attributeName:bn.string,duration:bn.number,begin:bn.number,easing:bn.oneOfType([bn.string,bn.func]),steps:bn.arrayOf(bn.shape({duration:bn.number.isRequired,style:bn.object.isRequired,easing:bn.oneOfType([bn.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),bn.func]),properties:bn.arrayOf("string"),onAnimationEnd:bn.func})),children:bn.oneOfType([bn.node,bn.func]),isActive:bn.bool,canBegin:bn.bool,onAnimationEnd:bn.func,shouldReAnimate:bn.bool,onAnimationStart:bn.func,onAnimationReStart:bn.func};function Jx(e){"@babel/helpers - typeof";return Jx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jx(e)}function X2(){return X2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},X2.apply(this,arguments)}function kbe(e,t){return Abe(e)||Ebe(e,t)||Cbe(e,t)||_be()}function _be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cbe(e,t){if(e){if(typeof e=="string")return FD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return FD(e,t)}}function FD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ebe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function Abe(e){if(Array.isArray(e))return e}function zD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function MD(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zD(Object(r),!0).forEach(function(n){Tbe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tbe(e,t,r){return t=Pbe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pbe(e){var t=Ibe(e,"string");return Jx(t)=="symbol"?t:t+""}function Ibe(e,t){if(Jx(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Jx(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var DD=function(t,r,n,o,a){var s=Math.min(Math.abs(n)/2,Math.abs(o)/2),l=o>=0?1:-1,c=n>=0?1:-1,u=o>=0&&n>=0||o<0&&n<0?1:0,d;if(s>0&&a instanceof Array){for(var f=[0,0,0,0],h=0,p=4;h<p;h++)f[h]=a[h]>s?s:a[h];d="M".concat(t,",").concat(r+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(r)),d+="L ".concat(t+n-c*f[1],",").concat(r),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`,
`).concat(t+n,",").concat(r+l*f[1])),d+="L ".concat(t+n,",").concat(r+o-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`,
`).concat(t+n-c*f[2],",").concat(r+o)),d+="L ".concat(t+c*f[3],",").concat(r+o),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`,
`).concat(t,",").concat(r+o-l*f[3])),d+="Z"}else if(s>0&&a===+a&&a>0){var v=Math.min(s,a);d="M ".concat(t,",").concat(r+l*v,`
A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+c*v,",").concat(r,`
L `).concat(t+n-c*v,",").concat(r,`
A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+n,",").concat(r+l*v,`
L `).concat(t+n,",").concat(r+o-l*v,`
A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t+n-c*v,",").concat(r+o,`
L `).concat(t+c*v,",").concat(r+o,`
A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(t,",").concat(r+o-l*v," Z")}else d="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(o," h ").concat(-n," Z");return d},Obe=function(t,r){if(!t||!r)return!1;var n=t.x,o=t.y,a=r.x,s=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(a,a+l),d=Math.max(a,a+l),f=Math.min(s,s+c),h=Math.max(s,s+c);return n>=u&&n<=d&&o>=f&&o<=h}return!1},Nbe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},FP=function(t){var r=MD(MD({},Nbe),t),n=S.useRef(),o=S.useState(-1),a=kbe(o,2),s=a[0],l=a[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var j=n.current.getTotalLength();j&&l(j)}catch{}},[]);var c=r.x,u=r.y,d=r.width,f=r.height,h=r.radius,p=r.className,v=r.animationEasing,m=r.animationDuration,b=r.animationBegin,x=r.isAnimationActive,w=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var k=Fr("recharts-rectangle",p);return w?$e.createElement(lu,{canBegin:s>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:v,isActive:w},function(j){var _=j.width,T=j.height,A=j.x,P=j.y;return $e.createElement(lu,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:m,isActive:x,easing:v},$e.createElement("path",X2({},yr(r,!0),{className:k,d:DD(A,P,_,T,h),ref:n})))}):$e.createElement("path",X2({},yr(r,!0),{className:k,d:DD(c,u,d,f,h)}))},Rbe=["points","className","baseLinePoints","connectNulls"];function nm(){return nm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nm.apply(this,arguments)}function Lbe(e,t){if(e==null)return{};var r=Fbe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fbe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function BD(e){return Bbe(e)||Dbe(e)||Mbe(e)||zbe()}function zbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mbe(e,t){if(e){if(typeof e=="string")return DA(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return DA(e,t)}}function Dbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bbe(e){if(Array.isArray(e))return DA(e)}function DA(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var WD=function(t){return t&&t.x===+t.x&&t.y===+t.y},Wbe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){WD(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),WD(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},sx=function(t,r){var n=Wbe(t);r&&(n=[n.reduce(function(a,s){return[].concat(BD(a),BD(s))},[])]);var o=n.map(function(a){return a.reduce(function(s,l,c){return"".concat(s).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return n.length===1?"".concat(o,"Z"):o},qbe=function(t,r,n){var o=sx(t,n);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(sx(r.reverse(),n).slice(1))},$be=function(t){var r=t.points,n=t.className,o=t.baseLinePoints,a=t.connectNulls,s=Lbe(t,Rbe);if(!r||!r.length)return null;var l=Fr("recharts-polygon",n);if(o&&o.length){var c=s.stroke&&s.stroke!=="none",u=qbe(r,o,a);return $e.createElement("g",{className:l},$e.createElement("path",nm({},yr(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),c?$e.createElement("path",nm({},yr(s,!0),{fill:"none",d:sx(r,a)})):null,c?$e.createElement("path",nm({},yr(s,!0),{fill:"none",d:sx(o,a)})):null)}var d=sx(r,a);return $e.createElement("path",nm({},yr(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:l,d}))};function BA(){return BA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},BA.apply(this,arguments)}var BS=function(t){var r=t.cx,n=t.cy,o=t.r,a=t.className,s=Fr("recharts-dot",a);return r===+r&&n===+n&&o===+o?$e.createElement("circle",BA({},yr(t,!1),y2(t),{className:s,cx:r,cy:n,r:o})):null};function eb(e){"@babel/helpers - typeof";return eb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eb(e)}var Ube=["x","y","top","left","width","height","className"];function WA(){return WA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},WA.apply(this,arguments)}function qD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Hbe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qD(Object(r),!0).forEach(function(n){Vbe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vbe(e,t,r){return t=Ybe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ybe(e){var t=Gbe(e,"string");return eb(t)=="symbol"?t:t+""}function Gbe(e,t){if(eb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(eb(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kbe(e,t){if(e==null)return{};var r=Qbe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Qbe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Xbe=function(t,r,n,o,a,s){return"M".concat(t,",").concat(a,"v").concat(o,"M").concat(s,",").concat(r,"h").concat(n)},Zbe=function(t){var r=t.x,n=r===void 0?0:r,o=t.y,a=o===void 0?0:o,s=t.top,l=s===void 0?0:s,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,v=t.className,m=Kbe(t,Ube),b=Hbe({x:n,y:a,top:l,left:u,width:f,height:p},m);return!qt(n)||!qt(a)||!qt(f)||!qt(p)||!qt(l)||!qt(u)?null:$e.createElement("path",WA({},yr(b,!0),{className:Fr("recharts-cross",v),d:Xbe(n,a,f,p,l,u)}))},N4,$D;function Jbe(){if($D)return N4;$D=1;var e=LS(),t=YV(),r=fu();function n(o,a){return o&&o.length?e(o,r(a,2),t):void 0}return N4=n,N4}var e0e=Jbe();const t0e=dn(e0e);var R4,UD;function r0e(){if(UD)return R4;UD=1;var e=LS(),t=fu(),r=GV();function n(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return R4=n,R4}var n0e=r0e();const i0e=dn(n0e);var o0e=["cx","cy","angle","ticks","axisLine"],a0e=["ticks","tick","angle","tickFormatter","stroke"];function Hm(e){"@babel/helpers - typeof";return Hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hm(e)}function lx(){return lx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lx.apply(this,arguments)}function HD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Lp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?HD(Object(r),!0).forEach(function(n){WS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):HD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function VD(e,t){if(e==null)return{};var r=s0e(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function s0e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function l0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YD(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,LY(n.key),n)}}function c0e(e,t,r){return t&&YD(e.prototype,t),r&&YD(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u0e(e,t,r){return t=Z2(t),d0e(e,RY()?Reflect.construct(t,r||[],Z2(e).constructor):t.apply(e,r))}function d0e(e,t){if(t&&(Hm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f0e(e)}function f0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function RY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RY=function(){return!!e})()}function Z2(e){return Z2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Z2(e)}function p0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qA(e,t)}function qA(e,t){return qA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},qA(e,t)}function WS(e,t,r){return t=LY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function LY(e){var t=h0e(e,"string");return Hm(t)=="symbol"?t:t+""}function h0e(e,t){if(Hm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qS=(function(e){function t(){return l0e(this,t),u0e(this,t,arguments)}return p0e(t,e),c0e(t,[{key:"getTickValueCoord",value:function(n){var o=n.coordinate,a=this.props,s=a.angle,l=a.cx,c=a.cy;return Xn(l,c,o,s)}},{key:"getTickTextAnchor",value:function(){var n=this.props.orientation,o;switch(n){case"left":o="end";break;case"right":o="start";break;default:o="middle";break}return o}},{key:"getViewBox",value:function(){var n=this.props,o=n.cx,a=n.cy,s=n.angle,l=n.ticks,c=t0e(l,function(d){return d.coordinate||0}),u=i0e(l,function(d){return d.coordinate||0});return{cx:o,cy:a,startAngle:s,endAngle:s,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var n=this.props,o=n.cx,a=n.cy,s=n.angle,l=n.ticks,c=n.axisLine,u=VD(n,o0e),d=l.reduce(function(v,m){return[Math.min(v[0],m.coordinate),Math.max(v[1],m.coordinate)]},[1/0,-1/0]),f=Xn(o,a,d[0],s),h=Xn(o,a,d[1],s),p=Lp(Lp(Lp({},yr(u,!1)),{},{fill:"none"},yr(c,!1)),{},{x1:f.x,y1:f.y,x2:h.x,y2:h.y});return $e.createElement("line",lx({className:"recharts-polar-radius-axis-line"},p))}},{key:"renderTicks",value:function(){var n=this,o=this.props,a=o.ticks,s=o.tick,l=o.angle,c=o.tickFormatter,u=o.stroke,d=VD(o,a0e),f=this.getTickTextAnchor(),h=yr(d,!1),p=yr(s,!1),v=a.map(function(m,b){var x=n.getTickValueCoord(m),w=Lp(Lp(Lp(Lp({textAnchor:f,transform:"rotate(".concat(90-l,", ").concat(x.x,", ").concat(x.y,")")},h),{},{stroke:"none",fill:u},p),{},{index:b},x),{},{payload:m});return $e.createElement(cn,lx({className:Fr("recharts-polar-radius-axis-tick",jY(s)),key:"tick-".concat(m.coordinate)},Eh(n.props,m,b)),t.renderTickItem(s,w,c?c(m.value,b):m.value))});return $e.createElement(cn,{className:"recharts-polar-radius-axis-ticks"},v)}},{key:"render",value:function(){var n=this.props,o=n.ticks,a=n.axisLine,s=n.tick;return!o||!o.length?null:$e.createElement(cn,{className:Fr("recharts-polar-radius-axis",this.props.className)},a&&this.renderAxisLine(),s&&this.renderTicks(),Fo.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(n,o,a){var s;return $e.isValidElement(n)?s=$e.cloneElement(n,o):Ar(n)?s=n(o):s=$e.createElement(Ah,lx({},o,{className:"recharts-polar-radius-axis-tick-value"}),a),s}}])})(S.PureComponent);WS(qS,"displayName","PolarRadiusAxis");WS(qS,"axisType","radiusAxis");WS(qS,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function Vm(e){"@babel/helpers - typeof";return Vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vm(e)}function oh(){return oh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},oh.apply(this,arguments)}function GD(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Fp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GD(Object(r),!0).forEach(function(n){$S(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GD(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function g0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KD(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,zY(n.key),n)}}function m0e(e,t,r){return t&&KD(e.prototype,t),r&&KD(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v0e(e,t,r){return t=J2(t),y0e(e,FY()?Reflect.construct(t,r||[],J2(e).constructor):t.apply(e,r))}function y0e(e,t){if(t&&(Vm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x0e(e)}function x0e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function FY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FY=function(){return!!e})()}function J2(e){return J2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},J2(e)}function b0e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$A(e,t)}function $A(e,t){return $A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$A(e,t)}function $S(e,t,r){return t=zY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zY(e){var t=w0e(e,"string");return Vm(t)=="symbol"?t:t+""}function w0e(e,t){if(Vm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var S0e=Math.PI/180,QD=1e-5,US=(function(e){function t(){return g0e(this,t),v0e(this,t,arguments)}return b0e(t,e),m0e(t,[{key:"getTickLineCoord",value:function(n){var o=this.props,a=o.cx,s=o.cy,l=o.radius,c=o.orientation,u=o.tickSize,d=u||8,f=Xn(a,s,l,n.coordinate),h=Xn(a,s,l+(c==="inner"?-1:1)*d,n.coordinate);return{x1:f.x,y1:f.y,x2:h.x,y2:h.y}}},{key:"getTickTextAnchor",value:function(n){var o=this.props.orientation,a=Math.cos(-n.coordinate*S0e),s;return a>QD?s=o==="outer"?"start":"end":a<-QD?s=o==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var n=this.props,o=n.cx,a=n.cy,s=n.radius,l=n.axisLine,c=n.axisLineType,u=Fp(Fp({},yr(this.props,!1)),{},{fill:"none"},yr(l,!1));if(c==="circle")return $e.createElement(BS,oh({className:"recharts-polar-angle-axis-line"},u,{cx:o,cy:a,r:s}));var d=this.props.ticks,f=d.map(function(h){return Xn(o,a,s,h.coordinate)});return $e.createElement($be,oh({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var n=this,o=this.props,a=o.ticks,s=o.tick,l=o.tickLine,c=o.tickFormatter,u=o.stroke,d=yr(this.props,!1),f=yr(s,!1),h=Fp(Fp({},d),{},{fill:"none"},yr(l,!1)),p=a.map(function(v,m){var b=n.getTickLineCoord(v),x=n.getTickTextAnchor(v),w=Fp(Fp(Fp({textAnchor:x},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:v,x:b.x2,y:b.y2});return $e.createElement(cn,oh({className:Fr("recharts-polar-angle-axis-tick",jY(s)),key:"tick-".concat(v.coordinate)},Eh(n.props,v,m)),l&&$e.createElement("line",oh({className:"recharts-polar-angle-axis-tick-line"},h,b)),s&&t.renderTickItem(s,w,c?c(v.value,m):v.value))});return $e.createElement(cn,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var n=this.props,o=n.ticks,a=n.radius,s=n.axisLine;return a<=0||!o||!o.length?null:$e.createElement(cn,{className:Fr("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,o,a){var s;return $e.isValidElement(n)?s=$e.cloneElement(n,o):Ar(n)?s=n(o):s=$e.createElement(Ah,oh({},o,{className:"recharts-polar-angle-axis-tick-value"}),a),s}}])})(S.PureComponent);$S(US,"displayName","PolarAngleAxis");$S(US,"axisType","angleAxis");$S(US,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var L4,XD;function j0e(){if(XD)return L4;XD=1;var e=YH(),t=e(Object.getPrototypeOf,Object);return L4=t,L4}var F4,ZD;function k0e(){if(ZD)return F4;ZD=1;var e=Td(),t=j0e(),r=Pd(),n="[object Object]",o=Function.prototype,a=Object.prototype,s=o.toString,l=a.hasOwnProperty,c=s.call(Object);function u(d){if(!r(d)||e(d)!=n)return!1;var f=t(d);if(f===null)return!0;var h=l.call(f,"constructor")&&f.constructor;return typeof h=="function"&&h instanceof h&&s.call(h)==c}return F4=u,F4}var _0e=k0e();const C0e=dn(_0e);var z4,JD;function E0e(){if(JD)return z4;JD=1;var e=Td(),t=Pd(),r="[object Boolean]";function n(o){return o===!0||o===!1||t(o)&&e(o)==r}return z4=n,z4}var A0e=E0e();const T0e=dn(A0e);function tb(e){"@babel/helpers - typeof";return tb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tb(e)}function ew(){return ew=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ew.apply(this,arguments)}function P0e(e,t){return R0e(e)||N0e(e,t)||O0e(e,t)||I0e()}function I0e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O0e(e,t){if(e){if(typeof e=="string")return e7(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e7(e,t)}}function e7(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function N0e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function R0e(e){if(Array.isArray(e))return e}function t7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function r7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?t7(Object(r),!0).forEach(function(n){L0e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function L0e(e,t,r){return t=F0e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F0e(e){var t=z0e(e,"string");return tb(t)=="symbol"?t:t+""}function z0e(e,t){if(tb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(tb(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var n7=function(t,r,n,o,a){var s=n-o,l;return l="M ".concat(t,",").concat(r),l+="L ".concat(t+n,",").concat(r),l+="L ".concat(t+n-s/2,",").concat(r+a),l+="L ".concat(t+n-s/2-o,",").concat(r+a),l+="L ".concat(t,",").concat(r," Z"),l},M0e={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},D0e=function(t){var r=r7(r7({},M0e),t),n=S.useRef(),o=S.useState(-1),a=P0e(o,2),s=a[0],l=a[1];S.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var k=n.current.getTotalLength();k&&l(k)}catch{}},[]);var c=r.x,u=r.y,d=r.upperWidth,f=r.lowerWidth,h=r.height,p=r.className,v=r.animationEasing,m=r.animationDuration,b=r.animationBegin,x=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||h!==+h||d===0&&f===0||h===0)return null;var w=Fr("recharts-trapezoid",p);return x?$e.createElement(lu,{canBegin:s>0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:m,animationEasing:v,isActive:x},function(k){var j=k.upperWidth,_=k.lowerWidth,T=k.height,A=k.x,P=k.y;return $e.createElement(lu,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:m,easing:v},$e.createElement("path",ew({},yr(r,!0),{className:w,d:n7(A,P,j,_,T),ref:n})))}):$e.createElement("g",null,$e.createElement("path",ew({},yr(r,!0),{className:w,d:n7(c,u,d,f,h)})))},B0e=["option","shapeType","propTransformer","activeClassName","isActive"];function rb(e){"@babel/helpers - typeof";return rb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rb(e)}function W0e(e,t){if(e==null)return{};var r=q0e(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function q0e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function i7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function tw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?i7(Object(r),!0).forEach(function(n){$0e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $0e(e,t,r){return t=U0e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U0e(e){var t=H0e(e,"string");return rb(t)=="symbol"?t:t+""}function H0e(e,t){if(rb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(rb(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function V0e(e,t){return tw(tw({},t),e)}function Y0e(e,t){return e==="symbols"}function o7(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return $e.createElement(FP,r);case"trapezoid":return $e.createElement(D0e,r);case"sector":return $e.createElement(CY,r);case"symbols":if(Y0e(t))return $e.createElement(tP,r);break;default:return null}}function G0e(e){return S.isValidElement(e)?e.props:e}function MY(e){var t=e.option,r=e.shapeType,n=e.propTransformer,o=n===void 0?V0e:n,a=e.activeClassName,s=a===void 0?"recharts-active-shape":a,l=e.isActive,c=W0e(e,B0e),u;if(S.isValidElement(t))u=S.cloneElement(t,tw(tw({},c),G0e(t)));else if(Ar(t))u=t(c);else if(C0e(t)&&!T0e(t)){var d=o(t,c);u=$e.createElement(o7,{shapeType:r,elementProps:d})}else{var f=c;u=$e.createElement(o7,{shapeType:r,elementProps:f})}return l?$e.createElement(cn,{className:s},u):u}function HS(e,t){return t!=null&&"trapezoids"in e.props}function VS(e,t){return t!=null&&"sectors"in e.props}function nb(e,t){return t!=null&&"points"in e.props}function K0e(e,t){var r,n,o=e.x===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.x)||e.x===t.x,a=e.y===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.y)||e.y===t.y;return o&&a}function Q0e(e,t){var r=e.endAngle===t.endAngle,n=e.startAngle===t.startAngle;return r&&n}function X0e(e,t){var r=e.x===t.x,n=e.y===t.y,o=e.z===t.z;return r&&n&&o}function Z0e(e,t){var r;return HS(e,t)?r=K0e:VS(e,t)?r=Q0e:nb(e,t)&&(r=X0e),r}function J0e(e,t){var r;return HS(e,t)?r="trapezoids":VS(e,t)?r="sectors":nb(e,t)&&(r="points"),r}function e1e(e,t){if(HS(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(VS(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return nb(e,t)?t.payload:{}}function t1e(e){var t=e.activeTooltipItem,r=e.graphicalItem,n=e.itemData,o=J0e(r,t),a=e1e(r,t),s=n.filter(function(c,u){var d=Db(a,c),f=r.props[o].filter(function(v){var m=Z0e(r,t);return m(v,t)}),h=r.props[o].indexOf(f[f.length-1]),p=u===h;return d&&p}),l=n.indexOf(s[s.length-1]);return l}var B1;function Ym(e){"@babel/helpers - typeof";return Ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ym(e)}function im(){return im=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},im.apply(this,arguments)}function a7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Yn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?a7(Object(r),!0).forEach(function(n){Pl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function r1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,BY(n.key),n)}}function n1e(e,t,r){return t&&s7(e.prototype,t),r&&s7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function i1e(e,t,r){return t=rw(t),o1e(e,DY()?Reflect.construct(t,r||[],rw(e).constructor):t.apply(e,r))}function o1e(e,t){if(t&&(Ym(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a1e(e)}function a1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function DY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DY=function(){return!!e})()}function rw(e){return rw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},rw(e)}function s1e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&UA(e,t)}function UA(e,t){return UA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},UA(e,t)}function Pl(e,t,r){return t=BY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function BY(e){var t=l1e(e,"string");return Ym(t)=="symbol"?t:t+""}function l1e(e,t){if(Ym(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ym(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Od=(function(e){function t(r){var n;return r1e(this,t),n=i1e(this,t,[r]),Pl(n,"pieRef",null),Pl(n,"sectorRefs",[]),Pl(n,"id",Av("recharts-pie-")),Pl(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Ar(o)&&o()}),Pl(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Ar(o)&&o()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return s1e(t,e),n1e(t,[{key:"isActiveIndex",value:function(n){var o=this.props.activeIndex;return Array.isArray(o)?o.indexOf(n)!==-1:n===o}},{key:"hasActiveIndex",value:function(){var n=this.props.activeIndex;return Array.isArray(n)?n.length!==0:n||n===0}},{key:"renderLabels",value:function(n){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var a=this.props,s=a.label,l=a.labelLine,c=a.dataKey,u=a.valueKey,d=yr(this.props,!1),f=yr(s,!1),h=yr(l,!1),p=s&&s.offsetRadius||20,v=n.map(function(m,b){var x=(m.startAngle+m.endAngle)/2,w=Xn(m.cx,m.cy,m.outerRadius+p,x),k=Yn(Yn(Yn(Yn({},d),m),{},{stroke:"none"},f),{},{index:b,textAnchor:t.getTextAnchor(w.x,m.cx)},w),j=Yn(Yn(Yn(Yn({},d),m),{},{fill:"none",stroke:m.fill},h),{},{index:b,points:[Xn(m.cx,m.cy,m.outerRadius,x),w]}),_=c;return Rr(c)&&Rr(u)?_="value":Rr(c)&&(_=u),$e.createElement(cn,{key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(b)},l&&t.renderLabelLineItem(l,j,"line"),t.renderLabelItem(s,k,po(m,_)))});return $e.createElement(cn,{className:"recharts-pie-labels"},v)}},{key:"renderSectorsStatically",value:function(n){var o=this,a=this.props,s=a.activeShape,l=a.blendStroke,c=a.inactiveShape;return n.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&n.length!==1)return null;var f=o.isActiveIndex(d),h=c&&o.hasActiveIndex()?c:null,p=f?s:h,v=Yn(Yn({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return $e.createElement(cn,im({ref:function(b){b&&!o.sectorRefs.includes(b)&&o.sectorRefs.push(b)},tabIndex:-1,className:"recharts-pie-sector"},Eh(o.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),$e.createElement(MY,im({option:p,isActive:f,shapeType:"sector"},v)))})}},{key:"renderSectorsWithAnimation",value:function(){var n=this,o=this.props,a=o.sectors,s=o.isAnimationActive,l=o.animationBegin,c=o.animationDuration,u=o.animationEasing,d=o.animationId,f=this.state,h=f.prevSectors,p=f.prevIsAnimationActive;return $e.createElement(lu,{begin:l,duration:c,isActive:s,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(p),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(v){var m=v.t,b=[],x=a&&a[0],w=x.startAngle;return a.forEach(function(k,j){var _=h&&h[j],T=j>0?Gs(k,"paddingAngle",0):0;if(_){var A=$s(_.endAngle-_.startAngle,k.endAngle-k.startAngle),P=Yn(Yn({},k),{},{startAngle:w+T,endAngle:w+A(m)+T});b.push(P),w=P.endAngle}else{var N=k.endAngle,O=k.startAngle,C=$s(0,N-O),I=C(m),R=Yn(Yn({},k),{},{startAngle:w+T,endAngle:w+I+T});b.push(R),w=R.endAngle}}),$e.createElement(cn,null,n.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(n){var o=this;n.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var s=++o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[s].focus(),o.setState({sectorToFocus:s});break}case"ArrowRight":{var l=--o.state.sectorToFocus<0?o.sectorRefs.length-1:o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[l].focus(),o.setState({sectorToFocus:l});break}case"Escape":{o.sectorRefs[o.state.sectorToFocus].blur(),o.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var n=this.props,o=n.sectors,a=n.isAnimationActive,s=this.state.prevSectors;return a&&o&&o.length&&(!s||!Db(s,o))?this.renderSectorsWithAnimation():this.renderSectorsStatically(o)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,o=this.props,a=o.hide,s=o.sectors,l=o.className,c=o.label,u=o.cx,d=o.cy,f=o.innerRadius,h=o.outerRadius,p=o.isAnimationActive,v=this.state.isAnimationFinished;if(a||!s||!s.length||!qt(u)||!qt(d)||!qt(f)||!qt(h))return null;var m=Fr("recharts-pie",l);return $e.createElement(cn,{tabIndex:this.props.rootTabIndex,className:m,ref:function(x){n.pieRef=x}},this.renderSectors(),c&&this.renderLabels(s),Fo.renderCallByParent(this.props,null,!1),(!p||v)&&gd.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,o){return o.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==o.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:o.curSectors,isAnimationFinished:!0}:n.sectors!==o.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,o){return n>o?"start":n<o?"end":"middle"}},{key:"renderLabelLineItem",value:function(n,o,a){if($e.isValidElement(n))return $e.cloneElement(n,o);if(Ar(n))return n(o);var s=Fr("recharts-pie-label-line",typeof n!="boolean"?n.className:"");return $e.createElement(V2,im({},o,{key:a,type:"linear",className:s}))}},{key:"renderLabelItem",value:function(n,o,a){if($e.isValidElement(n))return $e.cloneElement(n,o);var s=a;if(Ar(n)&&(s=n(o),$e.isValidElement(s)))return s;var l=Fr("recharts-pie-label-text",typeof n!="boolean"&&!Ar(n)?n.className:"");return $e.createElement(Ah,im({},o,{alignmentBaseline:"middle",className:l}),s)}}])})(S.PureComponent);B1=Od;Pl(Od,"displayName","Pie");Pl(Od,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Yh.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Pl(Od,"parseDeltaAngle",function(e,t){var r=$a(t-e),n=Math.min(Math.abs(t-e),360);return r*n});Pl(Od,"getRealPieData",function(e){var t=e.data,r=e.children,n=yr(e,!1),o=Ks(r,AS);return t&&t.length?t.map(function(a,s){return Yn(Yn(Yn({payload:a},n),a),o&&o[s]&&o[s].props)}):o&&o.length?o.map(function(a){return Yn(Yn({},n),a.props)}):[]});Pl(Od,"parseCoordinateOfPie",function(e,t){var r=t.top,n=t.left,o=t.width,a=t.height,s=SY(o,a),l=n+Ua(e.cx,o,o/2),c=r+Ua(e.cy,a,a/2),u=Ua(e.innerRadius,s,0),d=Ua(e.outerRadius,s,s*.8),f=e.maxRadius||Math.sqrt(o*o+a*a)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:f}});Pl(Od,"getComposedData",function(e){var t=e.item,r=e.offset,n=t.type.defaultProps!==void 0?Yn(Yn({},t.type.defaultProps),t.props):t.props,o=B1.getRealPieData(n);if(!o||!o.length)return null;var a=n.cornerRadius,s=n.startAngle,l=n.endAngle,c=n.paddingAngle,u=n.dataKey,d=n.nameKey,f=n.valueKey,h=n.tooltipType,p=Math.abs(n.minAngle),v=B1.parseCoordinateOfPie(n,r),m=B1.parseDeltaAngle(s,l),b=Math.abs(m),x=u;Rr(u)&&Rr(f)?(dc(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),x="value"):Rr(u)&&(dc(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),x=f);var w=o.filter(function(P){return po(P,x,0)!==0}).length,k=(b>=360?w:w-1)*c,j=b-w*p-k,_=o.reduce(function(P,N){var O=po(N,x,0);return P+(qt(O)?O:0)},0),T;if(_>0){var A;T=o.map(function(P,N){var O=po(P,x,0),C=po(P,d,N),I=(qt(O)?O:0)/_,R;N?R=A.endAngle+$a(m)*c*(O!==0?1:0):R=s;var F=R+$a(m)*((O!==0?p:0)+I*j),M=(R+F)/2,Y=(v.innerRadius+v.outerRadius)/2,X=[{name:C,value:O,payload:P,dataKey:x,type:h}],$=Xn(v.cx,v.cy,Y,M);return A=Yn(Yn(Yn({percent:I,cornerRadius:a,name:C,tooltipPayload:X,midAngle:M,middleRadius:Y,tooltipPosition:$},P),v),{},{value:po(P,x),startAngle:R,endAngle:F,payload:P,paddingAngle:$a(m)*c}),A})}return Yn(Yn({},v),{},{sectors:T,data:o})});var M4,l7;function c1e(){if(l7)return M4;l7=1;var e=Math.ceil,t=Math.max;function r(n,o,a,s){for(var l=-1,c=t(e((o-n)/(a||1)),0),u=Array(c);c--;)u[s?c:++l]=n,n+=a;return u}return M4=r,M4}var D4,c7;function WY(){if(c7)return D4;c7=1;var e=cV(),t=1/0,r=17976931348623157e292;function n(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-t){var a=o<0?-1:1;return a*r}return o===o?o:0}return D4=n,D4}var B4,u7;function u1e(){if(u7)return B4;u7=1;var e=c1e(),t=ES(),r=WY();function n(o){return function(a,s,l){return l&&typeof l!="number"&&t(a,s,l)&&(s=l=void 0),a=r(a),s===void 0?(s=a,a=0):s=r(s),l=l===void 0?a<s?1:-1:r(l),e(a,s,l,o)}}return B4=n,B4}var W4,d7;function d1e(){if(d7)return W4;d7=1;var e=u1e(),t=e();return W4=t,W4}var f1e=d1e();const nw=dn(f1e);function ib(e){"@babel/helpers - typeof";return ib=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ib(e)}function f7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function p7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?f7(Object(r),!0).forEach(function(n){qY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qY(e,t,r){return t=p1e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p1e(e){var t=h1e(e,"string");return ib(t)=="symbol"?t:t+""}function h1e(e,t){if(ib(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ib(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var g1e=["Webkit","Moz","O","ms"],m1e=function(t,r){var n=t.replace(/(\w)/,function(a){return a.toUpperCase()}),o=g1e.reduce(function(a,s){return p7(p7({},a),{},qY({},s+n,r))},{});return o[t]=r,o};function Gm(e){"@babel/helpers - typeof";return Gm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gm(e)}function iw(){return iw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},iw.apply(this,arguments)}function h7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function q4(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?h7(Object(r),!0).forEach(function(n){Ws(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function v1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,UY(n.key),n)}}function y1e(e,t,r){return t&&g7(e.prototype,t),r&&g7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function x1e(e,t,r){return t=ow(t),b1e(e,$Y()?Reflect.construct(t,r||[],ow(e).constructor):t.apply(e,r))}function b1e(e,t){if(t&&(Gm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return w1e(e)}function w1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($Y=function(){return!!e})()}function ow(e){return ow=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ow(e)}function S1e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&HA(e,t)}function HA(e,t){return HA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},HA(e,t)}function Ws(e,t,r){return t=UY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function UY(e){var t=j1e(e,"string");return Gm(t)=="symbol"?t:t+""}function j1e(e,t){if(Gm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Gm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var k1e=function(t){var r=t.data,n=t.startIndex,o=t.endIndex,a=t.x,s=t.width,l=t.travellerWidth;if(!r||!r.length)return{};var c=r.length,u=ix().domain(nw(0,c)).range([a,a+s-l]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(n),endX:u(o),scale:u,scaleValues:d}},m7=function(t){return t.changedTouches&&!!t.changedTouches.length},Km=(function(e){function t(r){var n;return v1e(this,t),n=x1e(this,t,[r]),Ws(n,"handleDrag",function(o){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(o):n.state.isSlideMoving&&n.handleSlideDrag(o)}),Ws(n,"handleTouchMove",function(o){o.changedTouches!=null&&o.changedTouches.length>0&&n.handleDrag(o.changedTouches[0])}),Ws(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var o=n.props,a=o.endIndex,s=o.onDragEnd,l=o.startIndex;s==null||s({endIndex:a,startIndex:l})}),n.detachDragEndListener()}),Ws(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Ws(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Ws(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Ws(n,"handleSlideDragStart",function(o){var a=m7(o)?o.changedTouches[0]:o;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return S1e(t,e),y1e(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var o=n.startX,a=n.endX,s=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(o,a),h=Math.max(o,a),p=t.getIndexInRange(s,f),v=t.getIndexInRange(s,h);return{startIndex:p-p%c,endIndex:v===d?d:v-v%c}}},{key:"getTextOfTick",value:function(n){var o=this.props,a=o.data,s=o.tickFormatter,l=o.dataKey,c=po(a[n],l,n);return Ar(s)?s(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var o=this.state,a=o.slideMoveStartX,s=o.startX,l=o.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,v=c.onChange,m=n.pageX-a;m>0?m=Math.min(m,u+d-f-l,u+d-f-s):m<0&&(m=Math.max(m,u-s,u-l));var b=this.getIndex({startX:s+m,endX:l+m});(b.startIndex!==h||b.endIndex!==p)&&v&&v(b),this.setState({startX:s+m,endX:l+m,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,o){var a=m7(o)?o.changedTouches[0]:o;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var o=this.state,a=o.brushMoveStartX,s=o.movingTravellerId,l=o.endX,c=o.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,v=d.onChange,m=d.gap,b=d.data,x={startX:this.state.startX,endX:this.state.endX},w=n.pageX-a;w>0?w=Math.min(w,f+h-p-u):w<0&&(w=Math.max(w,f-u)),x[s]=u+w;var k=this.getIndex(x),j=k.startIndex,_=k.endIndex,T=function(){var P=b.length-1;return s==="startX"&&(l>c?j%m===0:_%m===0)||l<c&&_===P||s==="endX"&&(l>c?_%m===0:j%m===0)||l>c&&_===P};this.setState(Ws(Ws({},s,u+w),"brushMoveStartX",n.pageX),function(){v&&T()&&v(k)})}},{key:"handleTravellerMoveKeyboard",value:function(n,o){var a=this,s=this.state,l=s.scaleValues,c=s.startX,u=s.endX,d=this.state[o],f=l.indexOf(d);if(f!==-1){var h=f+n;if(!(h===-1||h>=l.length)){var p=l[h];o==="startX"&&p>=u||o==="endX"&&p<=c||this.setState(Ws({},o,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,o=n.x,a=n.y,s=n.width,l=n.height,c=n.fill,u=n.stroke;return $e.createElement("rect",{stroke:u,fill:c,x:o,y:a,width:s,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,o=n.x,a=n.y,s=n.width,l=n.height,c=n.data,u=n.children,d=n.padding,f=S.Children.only(u);return f?$e.cloneElement(f,{x:o,y:a,width:s,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,o){var a,s,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,v=c.data,m=c.startIndex,b=c.endIndex,x=Math.max(n,this.props.x),w=q4(q4({},yr(this.props,!1)),{},{x,y:u,width:d,height:f}),k=p||"Min value: ".concat((a=v[m])===null||a===void 0?void 0:a.name,", Max value: ").concat((s=v[b])===null||s===void 0?void 0:s.name);return $e.createElement(cn,{tabIndex:0,role:"slider","aria-label":k,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[o],onTouchStart:this.travellerDragStartHandlers[o],onKeyDown:function(_){["ArrowLeft","ArrowRight"].includes(_.key)&&(_.preventDefault(),_.stopPropagation(),l.handleTravellerMoveKeyboard(_.key==="ArrowRight"?1:-1,o))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,w))}},{key:"renderSlide",value:function(n,o){var a=this.props,s=a.y,l=a.height,c=a.stroke,u=a.travellerWidth,d=Math.min(n,o)+u,f=Math.max(Math.abs(o-n)-u,0);return $e.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:s,width:f,height:l})}},{key:"renderText",value:function(){var n=this.props,o=n.startIndex,a=n.endIndex,s=n.y,l=n.height,c=n.travellerWidth,u=n.stroke,d=this.state,f=d.startX,h=d.endX,p=5,v={pointerEvents:"none",fill:u};return $e.createElement(cn,{className:"recharts-brush-texts"},$e.createElement(Ah,iw({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+l/2},v),this.getTextOfTick(o)),$e.createElement(Ah,iw({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:s+l/2},v),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,o=n.data,a=n.className,s=n.children,l=n.x,c=n.y,u=n.width,d=n.height,f=n.alwaysShowText,h=this.state,p=h.startX,v=h.endX,m=h.isTextActive,b=h.isSlideMoving,x=h.isTravellerMoving,w=h.isTravellerFocused;if(!o||!o.length||!qt(l)||!qt(c)||!qt(u)||!qt(d)||u<=0||d<=0)return null;var k=Fr("recharts-brush",a),j=$e.Children.count(s)===1,_=m1e("userSelect","none");return $e.createElement(cn,{className:k,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:_},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,v),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(v,"endX"),(m||b||x||w||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var o=n.x,a=n.y,s=n.width,l=n.height,c=n.stroke,u=Math.floor(a+l/2)-1;return $e.createElement($e.Fragment,null,$e.createElement("rect",{x:o,y:a,width:s,height:l,fill:c,stroke:"none"}),$e.createElement("line",{x1:o+1,y1:u,x2:o+s-1,y2:u,fill:"none",stroke:"#fff"}),$e.createElement("line",{x1:o+1,y1:u+2,x2:o+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,o){var a;return $e.isValidElement(n)?a=$e.cloneElement(n,o):Ar(n)?a=n(o):a=t.renderDefaultTraveller(o),a}},{key:"getDerivedStateFromProps",value:function(n,o){var a=n.data,s=n.width,l=n.x,c=n.travellerWidth,u=n.updateId,d=n.startIndex,f=n.endIndex;if(a!==o.prevData||u!==o.prevUpdateId)return q4({prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s},a&&a.length?k1e({data:a,width:s,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(o.scale&&(s!==o.prevWidth||l!==o.prevX||c!==o.prevTravellerWidth)){o.scale.range([l,l+s-c]);var h=o.scale.domain().map(function(p){return o.scale(p)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:s,startX:o.scale(n.startIndex),endX:o.scale(n.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(n,o){for(var a=n.length,s=0,l=a-1;l-s>1;){var c=Math.floor((s+l)/2);n[c]>o?l=c:s=c}return o>=n[l]?l:s}}])})(S.PureComponent);Ws(Km,"displayName","Brush");Ws(Km,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var $4,v7;function _1e(){if(v7)return $4;v7=1;var e=lP();function t(r,n){var o;return e(r,function(a,s,l){return o=n(a,s,l),!o}),!!o}return $4=t,$4}var U4,y7;function C1e(){if(y7)return U4;y7=1;var e=BH(),t=fu(),r=_1e(),n=vs(),o=ES();function a(s,l,c){var u=n(s)?e:r;return c&&o(s,l,c)&&(l=void 0),u(s,t(l,3))}return U4=a,U4}var E1e=C1e();const A1e=dn(E1e);var ou=function(t,r){var n=t.alwaysShow,o=t.ifOverflow;return n&&(o="extendDomain"),o===r},H4,x7;function T1e(){if(x7)return H4;x7=1;var e=iV();function t(r,n,o){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[n]=o}return H4=t,H4}var V4,b7;function P1e(){if(b7)return V4;b7=1;var e=T1e(),t=rV(),r=fu();function n(o,a){var s={};return a=r(a,3),t(o,function(l,c,u){e(s,c,a(l,c,u))}),s}return V4=n,V4}var I1e=P1e();const O1e=dn(I1e);var Y4,w7;function N1e(){if(w7)return Y4;w7=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(!r(t[n],n,t))return!1;return!0}return Y4=e,Y4}var G4,S7;function R1e(){if(S7)return G4;S7=1;var e=lP();function t(r,n){var o=!0;return e(r,function(a,s,l){return o=!!n(a,s,l),o}),o}return G4=t,G4}var K4,j7;function L1e(){if(j7)return K4;j7=1;var e=N1e(),t=R1e(),r=fu(),n=vs(),o=ES();function a(s,l,c){var u=n(s)?e:t;return c&&o(s,l,c)&&(l=void 0),u(s,r(l,3))}return K4=a,K4}var F1e=L1e();const HY=dn(F1e);var z1e=["x","y"];function ob(e){"@babel/helpers - typeof";return ob=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ob(e)}function VA(){return VA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},VA.apply(this,arguments)}function k7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ty(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?k7(Object(r),!0).forEach(function(n){M1e(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function M1e(e,t,r){return t=D1e(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D1e(e){var t=B1e(e,"string");return ob(t)=="symbol"?t:t+""}function B1e(e,t){if(ob(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ob(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W1e(e,t){if(e==null)return{};var r=q1e(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function q1e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function $1e(e,t){var r=e.x,n=e.y,o=W1e(e,z1e),a="".concat(r),s=parseInt(a,10),l="".concat(n),c=parseInt(l,10),u="".concat(t.height||o.height),d=parseInt(u,10),f="".concat(t.width||o.width),h=parseInt(f,10);return Ty(Ty(Ty(Ty(Ty({},t),o),s?{x:s}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function _7(e){return $e.createElement(MY,VA({shapeType:"rectangle",propTransformer:$1e,activeClassName:"recharts-active-bar"},e))}var U1e=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,o){if(typeof t=="number")return t;var a=typeof n=="number";return a?t(n,o):(a||Ph(),r)}},H1e=["value","background"],VY;function Qm(e){"@babel/helpers - typeof";return Qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qm(e)}function V1e(e,t){if(e==null)return{};var r=Y1e(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Y1e(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function aw(){return aw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},aw.apply(this,arguments)}function C7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function eo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?C7(Object(r),!0).forEach(function(n){If(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function G1e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,GY(n.key),n)}}function K1e(e,t,r){return t&&E7(e.prototype,t),r&&E7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Q1e(e,t,r){return t=sw(t),X1e(e,YY()?Reflect.construct(t,r||[],sw(e).constructor):t.apply(e,r))}function X1e(e,t){if(t&&(Qm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Z1e(e)}function Z1e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function YY(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YY=function(){return!!e})()}function sw(e){return sw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sw(e)}function J1e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&YA(e,t)}function YA(e,t){return YA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},YA(e,t)}function If(e,t,r){return t=GY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function GY(e){var t=e2e(e,"string");return Qm(t)=="symbol"?t:t+""}function e2e(e,t){if(Qm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Qm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Uf=(function(e){function t(){var r;G1e(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=Q1e(this,t,[].concat(o)),If(r,"state",{isAnimationFinished:!1}),If(r,"id",Av("recharts-bar-")),If(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),s&&s()}),If(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),s&&s()}),r}return J1e(t,e),K1e(t,[{key:"renderRectanglesStatically",value:function(n){var o=this,a=this.props,s=a.shape,l=a.dataKey,c=a.activeIndex,u=a.activeBar,d=yr(this.props,!1);return n&&n.map(function(f,h){var p=h===c,v=p?u:s,m=eo(eo(eo({},d),f),{},{isActive:p,option:v,index:h,dataKey:l,onAnimationStart:o.handleAnimationStart,onAnimationEnd:o.handleAnimationEnd});return $e.createElement(cn,aw({className:"recharts-bar-rectangle"},Eh(o.props,f,h),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(h)}),$e.createElement(_7,m))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,o=this.props,a=o.data,s=o.layout,l=o.isAnimationActive,c=o.animationBegin,u=o.animationDuration,d=o.animationEasing,f=o.animationId,h=this.state.prevData;return $e.createElement(lu,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(p){var v=p.t,m=a.map(function(b,x){var w=h&&h[x];if(w){var k=$s(w.x,b.x),j=$s(w.y,b.y),_=$s(w.width,b.width),T=$s(w.height,b.height);return eo(eo({},b),{},{x:k(v),y:j(v),width:_(v),height:T(v)})}if(s==="horizontal"){var A=$s(0,b.height),P=A(v);return eo(eo({},b),{},{y:b.y+b.height-P,height:P})}var N=$s(0,b.width),O=N(v);return eo(eo({},b),{},{width:O})});return $e.createElement(cn,null,n.renderRectanglesStatically(m))})}},{key:"renderRectangles",value:function(){var n=this.props,o=n.data,a=n.isAnimationActive,s=this.state.prevData;return a&&o&&o.length&&(!s||!Db(s,o))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(o)}},{key:"renderBackground",value:function(){var n=this,o=this.props,a=o.data,s=o.dataKey,l=o.activeIndex,c=yr(this.props.background,!1);return a.map(function(u,d){u.value;var f=u.background,h=V1e(u,H1e);if(!f)return null;var p=eo(eo(eo(eo(eo({},h),{},{fill:"#eee"},f),c),Eh(n.props,u,d)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:s,index:d,className:"recharts-bar-background-rectangle"});return $e.createElement(_7,aw({key:"background-bar-".concat(d),option:n.props.background,isActive:d===l},p))})}},{key:"renderErrorBar",value:function(n,o){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,s=a.data,l=a.xAxis,c=a.yAxis,u=a.layout,d=a.children,f=Ks(d,Bb);if(!f)return null;var h=u==="vertical"?s[0].height/2:s[0].width/2,p=function(b,x){var w=Array.isArray(b.value)?b.value[1]:b.value;return{x:b.x,y:b.y,value:w,errorVal:po(b,x)}},v={clipPath:n?"url(#clipPath-".concat(o,")"):null};return $e.createElement(cn,v,f.map(function(m){return $e.cloneElement(m,{key:"error-bar-".concat(o,"-").concat(m.props.dataKey),data:s,xAxis:l,yAxis:c,layout:u,offset:h,dataPointFormatter:p})}))}},{key:"render",value:function(){var n=this.props,o=n.hide,a=n.data,s=n.className,l=n.xAxis,c=n.yAxis,u=n.left,d=n.top,f=n.width,h=n.height,p=n.isAnimationActive,v=n.background,m=n.id;if(o||!a||!a.length)return null;var b=this.state.isAnimationFinished,x=Fr("recharts-bar",s),w=l&&l.allowDataOverflow,k=c&&c.allowDataOverflow,j=w||k,_=Rr(m)?this.id:m;return $e.createElement(cn,{className:x},w||k?$e.createElement("defs",null,$e.createElement("clipPath",{id:"clipPath-".concat(_)},$e.createElement("rect",{x:w?u:u-f/2,y:k?d:d-h/2,width:w?f:f*2,height:k?h:h*2}))):null,$e.createElement(cn,{className:"recharts-bar-rectangles",clipPath:j?"url(#clipPath-".concat(_,")"):null},v?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(j,_),(!p||b)&&gd.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(n,o){return n.animationId!==o.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:o.curData}:n.data!==o.curData?{curData:n.data}:null}}])})(S.PureComponent);VY=Uf;If(Uf,"displayName","Bar");If(Uf,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Yh.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});If(Uf,"getComposedData",function(e){var t=e.props,r=e.item,n=e.barPosition,o=e.bandSize,a=e.xAxis,s=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=_ve(n,r);if(!p)return null;var v=t.layout,m=r.type.defaultProps,b=m!==void 0?eo(eo({},m),r.props):r.props,x=b.dataKey,w=b.children,k=b.minPointSize,j=v==="horizontal"?s:a,_=u?j.scale.domain():null,T=Ove({numericAxis:j}),A=Ks(w,AS),P=f.map(function(N,O){var C,I,R,F,M,Y;u?C=Cve(u[d+O],_):(C=po(N,x),Array.isArray(C)||(C=[T,C]));var X=U1e(k,VY.defaultProps.minPointSize)(C[1],O);if(v==="horizontal"){var $,ee=[s.scale(C[0]),s.scale(C[1])],V=ee[0],D=ee[1];I=tD({axis:a,ticks:l,bandSize:o,offset:p.offset,entry:N,index:O}),R=($=D??V)!==null&&$!==void 0?$:void 0,F=p.size;var z=V-D;if(M=Number.isNaN(z)?0:z,Y={x:I,y:s.y,width:F,height:s.height},Math.abs(X)>0&&Math.abs(M)<Math.abs(X)){var q=$a(M||X)*(Math.abs(X)-Math.abs(M));R-=q,M+=q}}else{var G=[a.scale(C[0]),a.scale(C[1])],U=G[0],Q=G[1];if(I=U,R=tD({axis:s,ticks:c,bandSize:o,offset:p.offset,entry:N,index:O}),F=Q-U,M=p.size,Y={x:a.x,y:R,width:a.width,height:M},Math.abs(X)>0&&Math.abs(F)<Math.abs(X)){var K=$a(F||X)*(Math.abs(X)-Math.abs(F));F+=K}}return eo(eo(eo({},N),{},{x:I,y:R,width:F,height:M,value:u?C:C[1],payload:N,background:Y},A&&A[O]&&A[O].props),{},{tooltipPayload:[bY(r,N)],tooltipPosition:{x:I+F/2,y:R+M/2}})});return eo({data:P,layout:v},h)});function ab(e){"@babel/helpers - typeof";return ab=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ab(e)}function t2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,KY(n.key),n)}}function r2e(e,t,r){return t&&A7(e.prototype,t),r&&A7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function T7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function nc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?T7(Object(r),!0).forEach(function(n){YS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YS(e,t,r){return t=KY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function KY(e){var t=n2e(e,"string");return ab(t)=="symbol"?t:t+""}function n2e(e,t){if(ab(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ab(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var QY=function(t,r,n,o,a){var s=t.width,l=t.height,c=t.layout,u=t.children,d=Object.keys(r),f={left:n.left,leftMirror:n.left,right:s-n.right,rightMirror:s-n.right,top:n.top,topMirror:n.top,bottom:l-n.bottom,bottomMirror:l-n.bottom},h=!!qs(u,Uf);return d.reduce(function(p,v){var m=r[v],b=m.orientation,x=m.domain,w=m.padding,k=w===void 0?{}:w,j=m.mirror,_=m.reversed,T="".concat(b).concat(j?"Mirror":""),A,P,N,O,C;if(m.type==="number"&&(m.padding==="gap"||m.padding==="no-gap")){var I=x[1]-x[0],R=1/0,F=m.categoricalDomain.sort();if(F.forEach(function(G,U){U>0&&(R=Math.min((G||0)-(F[U-1]||0),R))}),Number.isFinite(R)){var M=R/I,Y=m.layout==="vertical"?n.height:n.width;if(m.padding==="gap"&&(A=M*Y/2),m.padding==="no-gap"){var X=Ua(t.barCategoryGap,M*Y),$=M*Y/2;A=$-X-($-X)/Y*X}}}o==="xAxis"?P=[n.left+(k.left||0)+(A||0),n.left+n.width-(k.right||0)-(A||0)]:o==="yAxis"?P=c==="horizontal"?[n.top+n.height-(k.bottom||0),n.top+(k.top||0)]:[n.top+(k.top||0)+(A||0),n.top+n.height-(k.bottom||0)-(A||0)]:P=m.range,_&&(P=[P[1],P[0]]);var ee=mY(m,a,h),V=ee.scale,D=ee.realScaleType;V.domain(x).range(P),vY(V);var z=yY(V,nc(nc({},m),{},{realScaleType:D}));o==="xAxis"?(C=b==="top"&&!j||b==="bottom"&&j,N=n.left,O=f[T]-C*m.height):o==="yAxis"&&(C=b==="left"&&!j||b==="right"&&j,N=f[T]-C*m.width,O=n.top);var q=nc(nc(nc({},m),z),{},{realScaleType:D,x:N,y:O,scale:V,width:o==="xAxis"?n.width:m.width,height:o==="yAxis"?n.height:m.height});return q.bandSize=$2(q,z),!m.hide&&o==="xAxis"?f[T]+=(C?-1:1)*q.height:m.hide||(f[T]+=(C?-1:1)*q.width),nc(nc({},p),{},YS({},v,q))},{})},XY=function(t,r){var n=t.x,o=t.y,a=r.x,s=r.y;return{x:Math.min(n,a),y:Math.min(o,s),width:Math.abs(a-n),height:Math.abs(s-o)}},i2e=function(t){var r=t.x1,n=t.y1,o=t.x2,a=t.y2;return XY({x:r,y:n},{x:o,y:a})},ZY=(function(){function e(t){t2e(this,e),this.scale=t}return r2e(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+s}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(o){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),o=n[0],a=n[n.length-1];return o<=a?r>=o&&r<=a:r>=a&&r<=o}}],[{key:"create",value:function(r){return new e(r)}}])})();YS(ZY,"EPS",1e-4);var zP=function(t){var r=Object.keys(t).reduce(function(n,o){return nc(nc({},n),{},YS({},o,ZY.create(t[o])))},{});return nc(nc({},r),{},{apply:function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=a.bandAware,l=a.position;return O1e(o,function(c,u){return r[u].apply(c,{bandAware:s,position:l})})},isInRange:function(o){return HY(o,function(a,s){return r[s].isInRange(a)})}})};function o2e(e){return(e%180+180)%180}var a2e=function(t){var r=t.width,n=t.height,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=o2e(o),s=a*Math.PI/180,l=Math.atan(n/r),c=s>l&&s<Math.PI-l?n/Math.sin(s):r/Math.cos(s);return Math.abs(c)},Q4,P7;function s2e(){if(P7)return Q4;P7=1;var e=fu(),t=Rb(),r=_S();function n(o){return function(a,s,l){var c=Object(a);if(!t(a)){var u=e(s,3);a=r(a),s=function(f){return u(c[f],f,c)}}var d=o(a,s,l);return d>-1?c[u?a[d]:d]:void 0}}return Q4=n,Q4}var X4,I7;function l2e(){if(I7)return X4;I7=1;var e=WY();function t(r){var n=e(r),o=n%1;return n===n?o?n-o:n:0}return X4=t,X4}var Z4,O7;function c2e(){if(O7)return Z4;O7=1;var e=XH(),t=fu(),r=l2e(),n=Math.max;function o(a,s,l){var c=a==null?0:a.length;if(!c)return-1;var u=l==null?0:r(l);return u<0&&(u=n(c+u,0)),e(a,t(s,3),u)}return Z4=o,Z4}var J4,N7;function u2e(){if(N7)return J4;N7=1;var e=s2e(),t=c2e(),r=e(t);return J4=r,J4}var d2e=u2e();const f2e=dn(d2e);var p2e=pH();const h2e=dn(p2e);var g2e=h2e(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),MP=S.createContext(void 0),DP=S.createContext(void 0),JY=S.createContext(void 0),eG=S.createContext({}),tG=S.createContext(void 0),rG=S.createContext(0),nG=S.createContext(0),R7=function(t){var r=t.state,n=r.xAxisMap,o=r.yAxisMap,a=r.offset,s=t.clipPathId,l=t.children,c=t.width,u=t.height,d=g2e(a);return $e.createElement(MP.Provider,{value:n},$e.createElement(DP.Provider,{value:o},$e.createElement(eG.Provider,{value:a},$e.createElement(JY.Provider,{value:d},$e.createElement(tG.Provider,{value:s},$e.createElement(rG.Provider,{value:u},$e.createElement(nG.Provider,{value:c},l)))))))},m2e=function(){return S.useContext(tG)},iG=function(t){var r=S.useContext(MP);r==null&&Ph();var n=r[t];return n==null&&Ph(),n},v2e=function(){var t=S.useContext(MP);return Cf(t)},y2e=function(){var t=S.useContext(DP),r=f2e(t,function(n){return HY(n.domain,Number.isFinite)});return r||Cf(t)},oG=function(t){var r=S.useContext(DP);r==null&&Ph();var n=r[t];return n==null&&Ph(),n},x2e=function(){var t=S.useContext(JY);return t},b2e=function(){return S.useContext(eG)},BP=function(){return S.useContext(nG)},WP=function(){return S.useContext(rG)};function Xm(e){"@babel/helpers - typeof";return Xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xm(e)}function w2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S2e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,sG(n.key),n)}}function j2e(e,t,r){return t&&S2e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function k2e(e,t,r){return t=lw(t),_2e(e,aG()?Reflect.construct(t,r||[],lw(e).constructor):t.apply(e,r))}function _2e(e,t){if(t&&(Xm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C2e(e)}function C2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function aG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(aG=function(){return!!e})()}function lw(e){return lw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},lw(e)}function E2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&GA(e,t)}function GA(e,t){return GA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},GA(e,t)}function L7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function F7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?L7(Object(r),!0).forEach(function(n){qP(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qP(e,t,r){return t=sG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sG(e){var t=A2e(e,"string");return Xm(t)=="symbol"?t:t+""}function A2e(e,t){if(Xm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Xm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function T2e(e,t){return N2e(e)||O2e(e,t)||I2e(e,t)||P2e()}function P2e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I2e(e,t){if(e){if(typeof e=="string")return z7(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z7(e,t)}}function z7(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function O2e(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function N2e(e){if(Array.isArray(e))return e}function KA(){return KA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},KA.apply(this,arguments)}var R2e=function(t,r){var n;return $e.isValidElement(t)?n=$e.cloneElement(t,r):Ar(t)?n=t(r):n=$e.createElement("line",KA({},r,{className:"recharts-reference-line-line"})),n},L2e=function(t,r,n,o,a,s,l,c,u){var d=a.x,f=a.y,h=a.width,p=a.height;if(n){var v=u.y,m=t.y.apply(v,{position:s});if(ou(u,"discard")&&!t.y.isInRange(m))return null;var b=[{x:d+h,y:m},{x:d,y:m}];return c==="left"?b.reverse():b}if(r){var x=u.x,w=t.x.apply(x,{position:s});if(ou(u,"discard")&&!t.x.isInRange(w))return null;var k=[{x:w,y:f+p},{x:w,y:f}];return l==="top"?k.reverse():k}if(o){var j=u.segment,_=j.map(function(T){return t.apply(T,{position:s})});return ou(u,"discard")&&A1e(_,function(T){return!t.isInRange(T)})?null:_}return null};function F2e(e){var t=e.x,r=e.y,n=e.segment,o=e.xAxisId,a=e.yAxisId,s=e.shape,l=e.className,c=e.alwaysShow,u=m2e(),d=iG(o),f=oG(a),h=x2e();if(!u||!h)return null;dc(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=zP({x:d.scale,y:f.scale}),v=mo(t),m=mo(r),b=n&&n.length===2,x=L2e(p,v,m,b,h,e.position,d.orientation,f.orientation,e);if(!x)return null;var w=T2e(x,2),k=w[0],j=k.x,_=k.y,T=w[1],A=T.x,P=T.y,N=ou(e,"hidden")?"url(#".concat(u,")"):void 0,O=F7(F7({clipPath:N},yr(e,!0)),{},{x1:j,y1:_,x2:A,y2:P});return $e.createElement(cn,{className:Fr("recharts-reference-line",l)},R2e(s,O),Fo.renderCallByParent(e,i2e({x1:j,y1:_,x2:A,y2:P})))}var $P=(function(e){function t(){return w2e(this,t),k2e(this,t,arguments)}return E2e(t,e),j2e(t,[{key:"render",value:function(){return $e.createElement(F2e,this.props)}}])})($e.Component);qP($P,"displayName","ReferenceLine");qP($P,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function QA(){return QA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},QA.apply(this,arguments)}function Zm(e){"@babel/helpers - typeof";return Zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zm(e)}function M7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function D7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?M7(Object(r),!0).forEach(function(n){GS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function z2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M2e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,cG(n.key),n)}}function D2e(e,t,r){return t&&M2e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function B2e(e,t,r){return t=cw(t),W2e(e,lG()?Reflect.construct(t,r||[],cw(e).constructor):t.apply(e,r))}function W2e(e,t){if(t&&(Zm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return q2e(e)}function q2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lG=function(){return!!e})()}function cw(e){return cw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},cw(e)}function $2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&XA(e,t)}function XA(e,t){return XA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},XA(e,t)}function GS(e,t,r){return t=cG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cG(e){var t=U2e(e,"string");return Zm(t)=="symbol"?t:t+""}function U2e(e,t){if(Zm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Zm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var H2e=function(t){var r=t.x,n=t.y,o=t.xAxis,a=t.yAxis,s=zP({x:o.scale,y:a.scale}),l=s.apply({x:r,y:n},{bandAware:!0});return ou(t,"discard")&&!s.isInRange(l)?null:l},KS=(function(e){function t(){return z2e(this,t),B2e(this,t,arguments)}return $2e(t,e),D2e(t,[{key:"render",value:function(){var n=this.props,o=n.x,a=n.y,s=n.r,l=n.alwaysShow,c=n.clipPathId,u=mo(o),d=mo(a);if(dc(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=H2e(this.props);if(!f)return null;var h=f.x,p=f.y,v=this.props,m=v.shape,b=v.className,x=ou(this.props,"hidden")?"url(#".concat(c,")"):void 0,w=D7(D7({clipPath:x},yr(this.props,!0)),{},{cx:h,cy:p});return $e.createElement(cn,{className:Fr("recharts-reference-dot",b)},t.renderDot(m,w),Fo.renderCallByParent(this.props,{x:h-s,y:p-s,width:2*s,height:2*s}))}}])})($e.Component);GS(KS,"displayName","ReferenceDot");GS(KS,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});GS(KS,"renderDot",function(e,t){var r;return $e.isValidElement(e)?r=$e.cloneElement(e,t):Ar(e)?r=e(t):r=$e.createElement(BS,QA({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function ZA(){return ZA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ZA.apply(this,arguments)}function Jm(e){"@babel/helpers - typeof";return Jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jm(e)}function B7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function W7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?B7(Object(r),!0).forEach(function(n){QS(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function V2e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Y2e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,dG(n.key),n)}}function G2e(e,t,r){return t&&Y2e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function K2e(e,t,r){return t=uw(t),Q2e(e,uG()?Reflect.construct(t,r||[],uw(e).constructor):t.apply(e,r))}function Q2e(e,t){if(t&&(Jm(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return X2e(e)}function X2e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uG=function(){return!!e})()}function uw(e){return uw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},uw(e)}function Z2e(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&JA(e,t)}function JA(e,t){return JA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},JA(e,t)}function QS(e,t,r){return t=dG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dG(e){var t=J2e(e,"string");return Jm(t)=="symbol"?t:t+""}function J2e(e,t){if(Jm(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Jm(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ewe=function(t,r,n,o,a){var s=a.x1,l=a.x2,c=a.y1,u=a.y2,d=a.xAxis,f=a.yAxis;if(!d||!f)return null;var h=zP({x:d.scale,y:f.scale}),p={x:t?h.x.apply(s,{position:"start"}):h.x.rangeMin,y:n?h.y.apply(c,{position:"start"}):h.y.rangeMin},v={x:r?h.x.apply(l,{position:"end"}):h.x.rangeMax,y:o?h.y.apply(u,{position:"end"}):h.y.rangeMax};return ou(a,"discard")&&(!h.isInRange(p)||!h.isInRange(v))?null:XY(p,v)},XS=(function(e){function t(){return V2e(this,t),K2e(this,t,arguments)}return Z2e(t,e),G2e(t,[{key:"render",value:function(){var n=this.props,o=n.x1,a=n.x2,s=n.y1,l=n.y2,c=n.className,u=n.alwaysShow,d=n.clipPathId;dc(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=mo(o),h=mo(a),p=mo(s),v=mo(l),m=this.props.shape;if(!f&&!h&&!p&&!v&&!m)return null;var b=ewe(f,h,p,v,this.props);if(!b&&!m)return null;var x=ou(this.props,"hidden")?"url(#".concat(d,")"):void 0;return $e.createElement(cn,{className:Fr("recharts-reference-area",c)},t.renderRect(m,W7(W7({clipPath:x},yr(this.props,!0)),b)),Fo.renderCallByParent(this.props,b))}}])})($e.Component);QS(XS,"displayName","ReferenceArea");QS(XS,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});QS(XS,"renderRect",function(e,t){var r;return $e.isValidElement(e)?r=$e.cloneElement(e,t):Ar(e)?r=e(t):r=$e.createElement(FP,ZA({},t,{className:"recharts-reference-area-rect"})),r});function fG(e,t,r){if(t<1)return[];if(t===1&&r===void 0)return e;for(var n=[],o=0;o<e.length;o+=t)n.push(e[o]);return n}function twe(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return a2e(n,r)}function rwe(e,t,r){var n=r==="width",o=e.x,a=e.y,s=e.width,l=e.height;return t===1?{start:n?o:a,end:n?o+s:a+l}:{start:n?o+s:a+l,end:n?o:a}}function dw(e,t,r,n,o){if(e*t<e*n||e*t>e*o)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-o)<=0}function nwe(e,t){return fG(e,t+1)}function iwe(e,t,r,n,o){for(var a=(n||[]).slice(),s=t.start,l=t.end,c=0,u=1,d=s,f=function(){var v=n==null?void 0:n[c];if(v===void 0)return{v:fG(n,u)};var m=c,b,x=function(){return b===void 0&&(b=r(v,m)),b},w=v.coordinate,k=c===0||dw(e,w,x,d,l);k||(c=0,d=s,u+=1),k&&(d=w+e*(x()/2+o),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function sb(e){"@babel/helpers - typeof";return sb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sb(e)}function q7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ga(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?q7(Object(r),!0).forEach(function(n){owe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function owe(e,t,r){return t=awe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function awe(e){var t=swe(e,"string");return sb(t)=="symbol"?t:t+""}function swe(e,t){if(sb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(sb(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lwe(e,t,r,n,o){for(var a=(n||[]).slice(),s=a.length,l=t.start,c=t.end,u=function(h){var p=a[h],v,m=function(){return v===void 0&&(v=r(p,h)),v};if(h===s-1){var b=e*(p.coordinate+e*m()/2-c);a[h]=p=ga(ga({},p),{},{tickCoord:b>0?p.coordinate-b*e:p.coordinate})}else a[h]=p=ga(ga({},p),{},{tickCoord:p.coordinate});var x=dw(e,p.tickCoord,m,l,c);x&&(c=p.tickCoord-e*(m()/2+o),a[h]=ga(ga({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return a}function cwe(e,t,r,n,o,a){var s=(n||[]).slice(),l=s.length,c=t.start,u=t.end;if(a){var d=n[l-1],f=r(d,l-1),h=e*(d.coordinate+e*f/2-u);s[l-1]=d=ga(ga({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=dw(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+o),s[l-1]=ga(ga({},d),{},{isShow:!0}))}for(var v=a?l-1:l,m=function(w){var k=s[w],j,_=function(){return j===void 0&&(j=r(k,w)),j};if(w===0){var T=e*(k.coordinate-e*_()/2-c);s[w]=k=ga(ga({},k),{},{tickCoord:T<0?k.coordinate-T*e:k.coordinate})}else s[w]=k=ga(ga({},k),{},{tickCoord:k.coordinate});var A=dw(e,k.tickCoord,_,c,u);A&&(c=k.tickCoord+e*(_()/2+o),s[w]=ga(ga({},k),{},{isShow:!0}))},b=0;b<v;b++)m(b);return s}function UP(e,t,r){var n=e.tick,o=e.ticks,a=e.viewBox,s=e.minTickGap,l=e.orientation,c=e.interval,u=e.tickFormatter,d=e.unit,f=e.angle;if(!o||!o.length||!n)return[];if(qt(c)||Yh.isSsr)return nwe(o,typeof c=="number"&&qt(c)?c:0);var h=[],p=l==="top"||l==="bottom"?"width":"height",v=d&&p==="width"?nx(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},m=function(k,j){var _=Ar(u)?u(k.value,j):k.value;return p==="width"?twe(nx(_,{fontSize:t,letterSpacing:r}),v,f):nx(_,{fontSize:t,letterSpacing:r})[p]},b=o.length>=2?$a(o[1].coordinate-o[0].coordinate):1,x=rwe(a,b,p);return c==="equidistantPreserveStart"?iwe(b,x,m,o,s):(c==="preserveStart"||c==="preserveStartEnd"?h=cwe(b,x,m,o,s,c==="preserveStartEnd"):h=lwe(b,x,m,o,s),h.filter(function(w){return w.isShow}))}var uwe=["viewBox"],dwe=["viewBox"],fwe=["ticks"];function ev(e){"@babel/helpers - typeof";return ev=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ev(e)}function om(){return om=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},om.apply(this,arguments)}function $7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Fa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$7(Object(r),!0).forEach(function(n){HP(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function eE(e,t){if(e==null)return{};var r=pwe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pwe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function hwe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,hG(n.key),n)}}function gwe(e,t,r){return t&&U7(e.prototype,t),r&&U7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function mwe(e,t,r){return t=fw(t),vwe(e,pG()?Reflect.construct(t,r||[],fw(e).constructor):t.apply(e,r))}function vwe(e,t){if(t&&(ev(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ywe(e)}function ywe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pG=function(){return!!e})()}function fw(e){return fw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fw(e)}function xwe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&e6(e,t)}function e6(e,t){return e6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},e6(e,t)}function HP(e,t,r){return t=hG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hG(e){var t=bwe(e,"string");return ev(t)=="symbol"?t:t+""}function bwe(e,t){if(ev(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ev(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Nv=(function(e){function t(r){var n;return hwe(this,t),n=mwe(this,t,[r]),n.state={fontSize:"",letterSpacing:""},n}return xwe(t,e),gwe(t,[{key:"shouldComponentUpdate",value:function(n,o){var a=n.viewBox,s=eE(n,uwe),l=this.props,c=l.viewBox,u=eE(l,dwe);return!mm(a,c)||!mm(s,u)||!mm(o,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var o=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];o&&this.setState({fontSize:window.getComputedStyle(o).fontSize,letterSpacing:window.getComputedStyle(o).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var o=this.props,a=o.x,s=o.y,l=o.width,c=o.height,u=o.orientation,d=o.tickSize,f=o.mirror,h=o.tickMargin,p,v,m,b,x,w,k=f?-1:1,j=n.tickSize||d,_=qt(n.tickCoord)?n.tickCoord:n.coordinate;switch(u){case"top":p=v=n.coordinate,b=s+ +!f*c,m=b-k*j,w=m-k*h,x=_;break;case"left":m=b=n.coordinate,v=a+ +!f*l,p=v-k*j,x=p-k*h,w=_;break;case"right":m=b=n.coordinate,v=a+ +f*l,p=v+k*j,x=p+k*h,w=_;break;default:p=v=n.coordinate,b=s+ +f*c,m=b+k*j,w=m+k*h,x=_;break}return{line:{x1:p,y1:m,x2:v,y2:b},tick:{x,y:w}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,o=n.orientation,a=n.mirror,s;switch(o){case"left":s=a?"start":"end";break;case"right":s=a?"end":"start";break;default:s="middle";break}return s}},{key:"getTickVerticalAnchor",value:function(){var n=this.props,o=n.orientation,a=n.mirror,s="end";switch(o){case"left":case"right":s="middle";break;case"top":s=a?"start":"end";break;default:s=a?"end":"start";break}return s}},{key:"renderAxisLine",value:function(){var n=this.props,o=n.x,a=n.y,s=n.width,l=n.height,c=n.orientation,u=n.mirror,d=n.axisLine,f=Fa(Fa(Fa({},yr(this.props,!1)),yr(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var h=+(c==="top"&&!u||c==="bottom"&&u);f=Fa(Fa({},f),{},{x1:o,y1:a+h*l,x2:o+s,y2:a+h*l})}else{var p=+(c==="left"&&!u||c==="right"&&u);f=Fa(Fa({},f),{},{x1:o+p*s,y1:a,x2:o+p*s,y2:a+l})}return $e.createElement("line",om({},f,{className:Fr("recharts-cartesian-axis-line",Gs(d,"className"))}))}},{key:"renderTicks",value:function(n,o,a){var s=this,l=this.props,c=l.tickLine,u=l.stroke,d=l.tick,f=l.tickFormatter,h=l.unit,p=UP(Fa(Fa({},this.props),{},{ticks:n}),o,a),v=this.getTickTextAnchor(),m=this.getTickVerticalAnchor(),b=yr(this.props,!1),x=yr(d,!1),w=Fa(Fa({},b),{},{fill:"none"},yr(c,!1)),k=p.map(function(j,_){var T=s.getTickLineCoord(j),A=T.line,P=T.tick,N=Fa(Fa(Fa(Fa({textAnchor:v,verticalAnchor:m},b),{},{stroke:"none",fill:u},x),P),{},{index:_,payload:j,visibleTicksCount:p.length,tickFormatter:f});return $e.createElement(cn,om({className:"recharts-cartesian-axis-tick",key:"tick-".concat(j.value,"-").concat(j.coordinate,"-").concat(j.tickCoord)},Eh(s.props,j,_)),c&&$e.createElement("line",om({},w,A,{className:Fr("recharts-cartesian-axis-tick-line",Gs(c,"className"))})),d&&t.renderTickItem(d,N,"".concat(Ar(f)?f(j.value,_):j.value).concat(h||"")))});return $e.createElement("g",{className:"recharts-cartesian-axis-ticks"},k)}},{key:"render",value:function(){var n=this,o=this.props,a=o.axisLine,s=o.width,l=o.height,c=o.ticksGenerator,u=o.className,d=o.hide;if(d)return null;var f=this.props,h=f.ticks,p=eE(f,fwe),v=h;return Ar(c)&&(v=h&&h.length>0?c(this.props):c(p)),s<=0||l<=0||!v||!v.length?null:$e.createElement(cn,{className:Fr("recharts-cartesian-axis",u),ref:function(b){n.layerReference=b}},a&&this.renderAxisLine(),this.renderTicks(v,this.state.fontSize,this.state.letterSpacing),Fo.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,o,a){var s;return $e.isValidElement(n)?s=$e.cloneElement(n,o):Ar(n)?s=n(o):s=$e.createElement(Ah,om({},o,{className:"recharts-cartesian-axis-tick-value"}),a),s}}])})(S.Component);HP(Nv,"displayName","CartesianAxis");HP(Nv,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var wwe=["x1","y1","x2","y2","key"],Swe=["offset"];function Ih(e){"@babel/helpers - typeof";return Ih=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ih(e)}function H7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ya(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?H7(Object(r),!0).forEach(function(n){jwe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jwe(e,t,r){return t=kwe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kwe(e){var t=_we(e,"string");return Ih(t)=="symbol"?t:t+""}function _we(e,t){if(Ih(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ih(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dh(){return dh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dh.apply(this,arguments)}function V7(e,t){if(e==null)return{};var r=Cwe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cwe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Ewe=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,o=t.x,a=t.y,s=t.width,l=t.height,c=t.ry;return $e.createElement("rect",{x:o,y:a,ry:c,width:s,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function gG(e,t){var r;if($e.isValidElement(e))r=$e.cloneElement(e,t);else if(Ar(e))r=e(t);else{var n=t.x1,o=t.y1,a=t.x2,s=t.y2,l=t.key,c=V7(t,wwe),u=yr(c,!1);u.offset;var d=V7(u,Swe);r=$e.createElement("line",dh({},d,{x1:n,y1:o,x2:a,y2:s,fill:"none",key:l}))}return r}function Awe(e){var t=e.x,r=e.width,n=e.horizontal,o=n===void 0?!0:n,a=e.horizontalPoints;if(!o||!a||!a.length)return null;var s=a.map(function(l,c){var u=ya(ya({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return gG(o,u)});return $e.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function Twe(e){var t=e.y,r=e.height,n=e.vertical,o=n===void 0?!0:n,a=e.verticalPoints;if(!o||!a||!a.length)return null;var s=a.map(function(l,c){var u=ya(ya({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return gG(o,u)});return $e.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function Pwe(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,o=e.y,a=e.width,s=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(h){return Math.round(h+o-o)}).sort(function(h,p){return h-p});o!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var v=!d[p+1],m=v?o+s-h:d[p+1]-h;if(m<=0)return null;var b=p%t.length;return $e.createElement("rect",{key:"react-".concat(p),y:h,x:n,height:m,width:a,stroke:"none",fill:t[b],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return $e.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Iwe(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,o=e.fillOpacity,a=e.x,s=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var d=u.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var v=!d[p+1],m=v?a+l-h:d[p+1]-h;if(m<=0)return null;var b=p%n.length;return $e.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:m,height:c,stroke:"none",fill:n[b],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return $e.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Owe=function(t,r){var n=t.xAxis,o=t.width,a=t.height,s=t.offset;return gY(UP(ya(ya(ya({},Nv.defaultProps),n),{},{ticks:sd(n,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.left,s.left+s.width,r)},Nwe=function(t,r){var n=t.yAxis,o=t.width,a=t.height,s=t.offset;return gY(UP(ya(ya(ya({},Nv.defaultProps),n),{},{ticks:sd(n,!0),viewBox:{x:0,y:0,width:o,height:a}})),s.top,s.top+s.height,r)},Bg={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function t6(e){var t,r,n,o,a,s,l=BP(),c=WP(),u=b2e(),d=ya(ya({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Bg.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Bg.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Bg.horizontal,horizontalFill:(o=e.horizontalFill)!==null&&o!==void 0?o:Bg.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:Bg.vertical,verticalFill:(s=e.verticalFill)!==null&&s!==void 0?s:Bg.verticalFill,x:qt(e.x)?e.x:u.left,y:qt(e.y)?e.y:u.top,width:qt(e.width)?e.width:u.width,height:qt(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,v=d.height,m=d.syncWithTicks,b=d.horizontalValues,x=d.verticalValues,w=v2e(),k=y2e();if(!qt(p)||p<=0||!qt(v)||v<=0||!qt(f)||f!==+f||!qt(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||Owe,_=d.horizontalCoordinatesGenerator||Nwe,T=d.horizontalPoints,A=d.verticalPoints;if((!T||!T.length)&&Ar(_)){var P=b&&b.length,N=_({yAxis:k?ya(ya({},k),{},{ticks:P?b:k.ticks}):void 0,width:l,height:c,offset:u},P?!0:m);dc(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Ih(N),"]")),Array.isArray(N)&&(T=N)}if((!A||!A.length)&&Ar(j)){var O=x&&x.length,C=j({xAxis:w?ya(ya({},w),{},{ticks:O?x:w.ticks}):void 0,width:l,height:c,offset:u},O?!0:m);dc(Array.isArray(C),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Ih(C),"]")),Array.isArray(C)&&(A=C)}return $e.createElement("g",{className:"recharts-cartesian-grid"},$e.createElement(Ewe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),$e.createElement(Awe,dh({},d,{offset:u,horizontalPoints:T,xAxis:w,yAxis:k})),$e.createElement(Twe,dh({},d,{offset:u,verticalPoints:A,xAxis:w,yAxis:k})),$e.createElement(Pwe,dh({},d,{horizontalPoints:T})),$e.createElement(Iwe,dh({},d,{verticalPoints:A})))}t6.displayName="CartesianGrid";var Rwe=["type","layout","connectNulls","ref"],Lwe=["key"];function tv(e){"@babel/helpers - typeof";return tv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tv(e)}function Y7(e,t){if(e==null)return{};var r=Fwe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Fwe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function cx(){return cx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},cx.apply(this,arguments)}function G7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Bs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?G7(Object(r),!0).forEach(function(n){ic(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wg(e){return Bwe(e)||Dwe(e)||Mwe(e)||zwe()}function zwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mwe(e,t){if(e){if(typeof e=="string")return r6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return r6(e,t)}}function Dwe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bwe(e){if(Array.isArray(e))return r6(e)}function r6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Wwe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,vG(n.key),n)}}function qwe(e,t,r){return t&&K7(e.prototype,t),r&&K7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $we(e,t,r){return t=pw(t),Uwe(e,mG()?Reflect.construct(t,r||[],pw(e).constructor):t.apply(e,r))}function Uwe(e,t){if(t&&(tv(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hwe(e)}function Hwe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mG=function(){return!!e})()}function pw(e){return pw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},pw(e)}function Vwe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n6(e,t)}function n6(e,t){return n6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},n6(e,t)}function ic(e,t,r){return t=vG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vG(e){var t=Ywe(e,"string");return tv(t)=="symbol"?t:t+""}function Ywe(e,t){if(tv(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(tv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var rv=(function(e){function t(){var r;Wwe(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=$we(this,t,[].concat(o)),ic(r,"state",{isAnimationFinished:!0,totalLength:0}),ic(r,"generateSimpleStrokeDasharray",function(s,l){return"".concat(l,"px ").concat(s-l,"px")}),ic(r,"getStrokeDasharray",function(s,l,c){var u=c.reduce(function(x,w){return x+w});if(!u)return r.generateSimpleStrokeDasharray(l,s);for(var d=Math.floor(s/u),f=s%u,h=l-s,p=[],v=0,m=0;v<c.length;m+=c[v],++v)if(m+c[v]>f){p=[].concat(Wg(c.slice(0,v)),[f-m]);break}var b=p.length%2===0?[0,h]:[h];return[].concat(Wg(t.repeat(c,d)),Wg(p),b).map(function(x){return"".concat(x,"px")}).join(", ")}),ic(r,"id",Av("recharts-line-")),ic(r,"pathRef",function(s){r.mainCurve=s}),ic(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),ic(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Vwe(t,e),qwe(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,o){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,s=a.points,l=a.xAxis,c=a.yAxis,u=a.layout,d=a.children,f=Ks(d,Bb);if(!f)return null;var h=function(m,b){return{x:m.x,y:m.y,value:m.value,errorVal:po(m.payload,b)}},p={clipPath:n?"url(#clipPath-".concat(o,")"):null};return $e.createElement(cn,p,f.map(function(v){return $e.cloneElement(v,{key:"bar-".concat(v.props.dataKey),data:s,xAxis:l,yAxis:c,layout:u,dataPointFormatter:h})}))}},{key:"renderDots",value:function(n,o,a){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=yr(this.props,!1),h=yr(c,!0),p=u.map(function(m,b){var x=Bs(Bs(Bs({key:"dot-".concat(b),r:3},f),h),{},{index:b,cx:m.x,cy:m.y,value:m.value,dataKey:d,payload:m.payload,points:u});return t.renderDotItem(c,x)}),v={clipPath:n?"url(#clipPath-".concat(o?"":"dots-").concat(a,")"):null};return $e.createElement(cn,cx({className:"recharts-line-dots",key:"dots"},v),p)}},{key:"renderCurveStatically",value:function(n,o,a,s){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=Y7(l,Rwe),h=Bs(Bs(Bs({},yr(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:o?"url(#clipPath-".concat(a,")"):null,points:n},s),{},{type:c,layout:u,connectNulls:d});return $e.createElement(V2,cx({},h,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,o){var a=this,s=this.props,l=s.points,c=s.strokeDasharray,u=s.isAnimationActive,d=s.animationBegin,f=s.animationDuration,h=s.animationEasing,p=s.animationId,v=s.animateNewValues,m=s.width,b=s.height,x=this.state,w=x.prevPoints,k=x.totalLength;return $e.createElement(lu,{begin:d,duration:f,isActive:u,easing:h,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(j){var _=j.t;if(w){var T=w.length/l.length,A=l.map(function(I,R){var F=Math.floor(R*T);if(w[F]){var M=w[F],Y=$s(M.x,I.x),X=$s(M.y,I.y);return Bs(Bs({},I),{},{x:Y(_),y:X(_)})}if(v){var $=$s(m*2,I.x),ee=$s(b/2,I.y);return Bs(Bs({},I),{},{x:$(_),y:ee(_)})}return Bs(Bs({},I),{},{x:I.x,y:I.y})});return a.renderCurveStatically(A,n,o)}var P=$s(0,k),N=P(_),O;if(c){var C="".concat(c).split(/[,\s]+/gim).map(function(I){return parseFloat(I)});O=a.getStrokeDasharray(N,k,C)}else O=a.generateSimpleStrokeDasharray(k,N);return a.renderCurveStatically(l,n,o,{strokeDasharray:O})})}},{key:"renderCurve",value:function(n,o){var a=this.props,s=a.points,l=a.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&s&&s.length&&(!u&&d>0||!Db(u,s))?this.renderCurveWithAnimation(n,o):this.renderCurveStatically(s,n,o)}},{key:"render",value:function(){var n,o=this.props,a=o.hide,s=o.dot,l=o.points,c=o.className,u=o.xAxis,d=o.yAxis,f=o.top,h=o.left,p=o.width,v=o.height,m=o.isAnimationActive,b=o.id;if(a||!l||!l.length)return null;var x=this.state.isAnimationFinished,w=l.length===1,k=Fr("recharts-line",c),j=u&&u.allowDataOverflow,_=d&&d.allowDataOverflow,T=j||_,A=Rr(b)?this.id:b,P=(n=yr(s,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},N=P.r,O=N===void 0?3:N,C=P.strokeWidth,I=C===void 0?2:C,R=jce(s)?s:{},F=R.clipDot,M=F===void 0?!0:F,Y=O*2+I;return $e.createElement(cn,{className:k},j||_?$e.createElement("defs",null,$e.createElement("clipPath",{id:"clipPath-".concat(A)},$e.createElement("rect",{x:j?h:h-p/2,y:_?f:f-v/2,width:j?p:p*2,height:_?v:v*2})),!M&&$e.createElement("clipPath",{id:"clipPath-dots-".concat(A)},$e.createElement("rect",{x:h-Y/2,y:f-Y/2,width:p+Y,height:v+Y}))):null,!w&&this.renderCurve(T,A),this.renderErrorBar(T,A),(w||s)&&this.renderDots(T,M,A),(!m||x)&&gd.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(n,o){return n.animationId!==o.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:o.curPoints}:n.points!==o.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,o){for(var a=n.length%2!==0?[].concat(Wg(n),[0]):n,s=[],l=0;l<o;++l)s=[].concat(Wg(s),Wg(a));return s}},{key:"renderDotItem",value:function(n,o){var a;if($e.isValidElement(n))a=$e.cloneElement(n,o);else if(Ar(n))a=n(o);else{var s=o.key,l=Y7(o,Lwe),c=Fr("recharts-line-dot",typeof n!="boolean"?n.className:"");a=$e.createElement(BS,cx({key:s},l,{className:c}))}return a}}])})(S.PureComponent);ic(rv,"displayName","Line");ic(rv,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Yh.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});ic(rv,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,o=e.xAxisTicks,a=e.yAxisTicks,s=e.dataKey,l=e.bandSize,c=e.displayedData,u=e.offset,d=t.layout,f=c.map(function(h,p){var v=po(h,s);return d==="horizontal"?{x:eD({axis:r,ticks:o,bandSize:l,entry:h,index:p}),y:Rr(v)?null:n.scale(v),value:v,payload:h}:{x:Rr(v)?null:r.scale(v),y:eD({axis:n,ticks:a,bandSize:l,entry:h,index:p}),value:v,payload:h}});return Bs({points:f,layout:d},u)});function nv(e){"@babel/helpers - typeof";return nv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nv(e)}function Gwe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kwe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,bG(n.key),n)}}function Qwe(e,t,r){return t&&Kwe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xwe(e,t,r){return t=hw(t),Zwe(e,yG()?Reflect.construct(t,r||[],hw(e).constructor):t.apply(e,r))}function Zwe(e,t){if(t&&(nv(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Jwe(e)}function Jwe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yG=function(){return!!e})()}function hw(e){return hw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},hw(e)}function eSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i6(e,t)}function i6(e,t){return i6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},i6(e,t)}function xG(e,t,r){return t=bG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bG(e){var t=tSe(e,"string");return nv(t)=="symbol"?t:t+""}function tSe(e,t){if(nv(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(nv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function o6(){return o6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o6.apply(this,arguments)}function rSe(e){var t=e.xAxisId,r=BP(),n=WP(),o=iG(t);return o==null?null:$e.createElement(Nv,o6({},o,{className:Fr("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(s){return sd(s,!0)}}))}var iv=(function(e){function t(){return Gwe(this,t),Xwe(this,t,arguments)}return eSe(t,e),Qwe(t,[{key:"render",value:function(){return $e.createElement(rSe,this.props)}}])})($e.Component);xG(iv,"displayName","XAxis");xG(iv,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function ov(e){"@babel/helpers - typeof";return ov=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ov(e)}function nSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iSe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,jG(n.key),n)}}function oSe(e,t,r){return t&&iSe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function aSe(e,t,r){return t=gw(t),sSe(e,wG()?Reflect.construct(t,r||[],gw(e).constructor):t.apply(e,r))}function sSe(e,t){if(t&&(ov(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lSe(e)}function lSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wG=function(){return!!e})()}function gw(e){return gw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},gw(e)}function cSe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a6(e,t)}function a6(e,t){return a6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},a6(e,t)}function SG(e,t,r){return t=jG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jG(e){var t=uSe(e,"string");return ov(t)=="symbol"?t:t+""}function uSe(e,t){if(ov(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ov(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function s6(){return s6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s6.apply(this,arguments)}var dSe=function(t){var r=t.yAxisId,n=BP(),o=WP(),a=oG(r);return a==null?null:$e.createElement(Nv,s6({},a,{className:Fr("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:o},ticksGenerator:function(l){return sd(l,!0)}}))},av=(function(e){function t(){return nSe(this,t),aSe(this,t,arguments)}return cSe(t,e),oSe(t,[{key:"render",value:function(){return $e.createElement(dSe,this.props)}}])})($e.Component);SG(av,"displayName","YAxis");SG(av,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function Q7(e){return gSe(e)||hSe(e)||pSe(e)||fSe()}function fSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pSe(e,t){if(e){if(typeof e=="string")return l6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l6(e,t)}}function hSe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function gSe(e){if(Array.isArray(e))return l6(e)}function l6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var c6=function(t,r,n,o,a){var s=Ks(t,$P),l=Ks(t,KS),c=[].concat(Q7(s),Q7(l)),u=Ks(t,XS),d="".concat(o,"Id"),f=o[0],h=r;if(c.length&&(h=c.reduce(function(m,b){if(b.props[d]===n&&ou(b.props,"extendDomain")&&qt(b.props[f])){var x=b.props[f];return[Math.min(m[0],x),Math.max(m[1],x)]}return m},h)),u.length){var p="".concat(f,"1"),v="".concat(f,"2");h=u.reduce(function(m,b){if(b.props[d]===n&&ou(b.props,"extendDomain")&&qt(b.props[p])&&qt(b.props[v])){var x=b.props[p],w=b.props[v];return[Math.min(m[0],x,w),Math.max(m[1],x,w)]}return m},h)}return a&&a.length&&(h=a.reduce(function(m,b){return qt(b)?[Math.min(m[0],b),Math.max(m[1],b)]:m},h)),h},tE={exports:{}},X7;function mSe(){return X7||(X7=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function o(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function a(c,u,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new o(d,f||c,h),v=r?r+u:u;return c._events[v]?c._events[v].fn?c._events[v]=[c._events[v],p]:c._events[v].push(p):(c._events[v]=p,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=r?r+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var h=0,p=f.length,v=new Array(p);h<p;h++)v[h]=f[h].fn;return v},l.prototype.listenerCount=function(u){var d=r?r+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,h,p,v){var m=r?r+u:u;if(!this._events[m])return!1;var b=this._events[m],x=arguments.length,w,k;if(b.fn){switch(b.once&&this.removeListener(u,b.fn,void 0,!0),x){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,d),!0;case 3:return b.fn.call(b.context,d,f),!0;case 4:return b.fn.call(b.context,d,f,h),!0;case 5:return b.fn.call(b.context,d,f,h,p),!0;case 6:return b.fn.call(b.context,d,f,h,p,v),!0}for(k=1,w=new Array(x-1);k<x;k++)w[k-1]=arguments[k];b.fn.apply(b.context,w)}else{var j=b.length,_;for(k=0;k<j;k++)switch(b[k].once&&this.removeListener(u,b[k].fn,void 0,!0),x){case 1:b[k].fn.call(b[k].context);break;case 2:b[k].fn.call(b[k].context,d);break;case 3:b[k].fn.call(b[k].context,d,f);break;case 4:b[k].fn.call(b[k].context,d,f,h);break;default:if(!w)for(_=1,w=new Array(x-1);_<x;_++)w[_-1]=arguments[_];b[k].fn.apply(b[k].context,w)}}return!0},l.prototype.on=function(u,d,f){return a(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return a(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,h){var p=r?r+u:u;if(!this._events[p])return this;if(!d)return s(this,p),this;var v=this._events[p];if(v.fn)v.fn===d&&(!h||v.once)&&(!f||v.context===f)&&s(this,p);else{for(var m=0,b=[],x=v.length;m<x;m++)(v[m].fn!==d||h&&!v[m].once||f&&v[m].context!==f)&&b.push(v[m]);b.length?this._events[p]=b.length===1?b[0]:b:s(this,p)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&s(this,d)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(tE)),tE.exports}var vSe=mSe();const ySe=dn(vSe);var rE=new ySe,nE="recharts.syncMouseEvents";function lb(e){"@babel/helpers - typeof";return lb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lb(e)}function xSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bSe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,kG(n.key),n)}}function wSe(e,t,r){return t&&bSe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function iE(e,t,r){return t=kG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kG(e){var t=SSe(e,"string");return lb(t)=="symbol"?t:t+""}function SSe(e,t){if(lb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(lb(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var jSe=(function(){function e(){xSe(this,e),iE(this,"activeIndex",0),iE(this,"coordinateList",[]),iE(this,"layout","horizontal")}return wSe(e,[{key:"setDetails",value:function(r){var n,o=r.coordinateList,a=o===void 0?null:o,s=r.container,l=s===void 0?null:s,c=r.layout,u=c===void 0?null:c,d=r.offset,f=d===void 0?null:d,h=r.mouseHandlerCallback,p=h===void 0?null:h;this.coordinateList=(n=a??this.coordinateList)!==null&&n!==void 0?n:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=p??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var o=this.container.getBoundingClientRect(),a=o.x,s=o.y,l=o.height,c=this.coordinateList[this.activeIndex].coordinate,u=((r=window)===null||r===void 0?void 0:r.scrollX)||0,d=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=a+c+u,h=s+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:f,pageY:h})}}}])})();function kSe(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e==null?void 0:e[0],o=e==null?void 0:e[1];if(n&&o&&qt(n)&&qt(o))return!0}return!1}function _Se(e,t,r,n){var o=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-o:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-o,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function _G(e){var t=e.cx,r=e.cy,n=e.radius,o=e.startAngle,a=e.endAngle,s=Xn(t,r,n,o),l=Xn(t,r,n,a);return{points:[s,l],cx:t,cy:r,radius:n,startAngle:o,endAngle:a}}function CSe(e,t,r){var n,o,a,s;if(e==="horizontal")n=t.x,a=n,o=r.top,s=r.top+r.height;else if(e==="vertical")o=t.y,s=o,n=r.left,a=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,u=t.innerRadius,d=t.outerRadius,f=t.angle,h=Xn(l,c,u,f),p=Xn(l,c,d,f);n=h.x,o=h.y,a=p.x,s=p.y}else return _G(t);return[{x:n,y:o},{x:a,y:s}]}function cb(e){"@babel/helpers - typeof";return cb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cb(e)}function Z7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function d1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Z7(Object(r),!0).forEach(function(n){ESe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ESe(e,t,r){return t=ASe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ASe(e){var t=TSe(e,"string");return cb(t)=="symbol"?t:t+""}function TSe(e,t){if(cb(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(cb(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function PSe(e){var t,r,n=e.element,o=e.tooltipEventType,a=e.isActive,s=e.activeCoordinate,l=e.activePayload,c=e.offset,u=e.activeTooltipIndex,d=e.tooltipAxisBandSize,f=e.layout,h=e.chartName,p=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!p||!a||!s||h!=="ScatterChart"&&o!=="axis")return null;var v,m=V2;if(h==="ScatterChart")v=s,m=Zbe;else if(h==="BarChart")v=_Se(f,s,c,d),m=FP;else if(f==="radial"){var b=_G(s),x=b.cx,w=b.cy,k=b.radius,j=b.startAngle,_=b.endAngle;v={cx:x,cy:w,startAngle:j,endAngle:_,innerRadius:k,outerRadius:k},m=CY}else v={points:CSe(f,s,c)},m=V2;var T=d1(d1(d1(d1({stroke:"#ccc",pointerEvents:"none"},c),v),yr(p,!1)),{},{payload:l,payloadIndex:u,className:Fr("recharts-tooltip-cursor",p.className)});return S.isValidElement(p)?S.cloneElement(p,T):S.createElement(m,T)}var ISe=["item"],OSe=["children","className","width","height","style","compact","title","desc"];function sv(e){"@babel/helpers - typeof";return sv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sv(e)}function am(){return am=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},am.apply(this,arguments)}function J7(e,t){return LSe(e)||RSe(e,t)||EG(e,t)||NSe()}function NSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RSe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function LSe(e){if(Array.isArray(e))return e}function eB(e,t){if(e==null)return{};var r=FSe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function FSe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function zSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MSe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,AG(n.key),n)}}function DSe(e,t,r){return t&&MSe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function BSe(e,t,r){return t=mw(t),WSe(e,CG()?Reflect.construct(t,r||[],mw(e).constructor):t.apply(e,r))}function WSe(e,t){if(t&&(sv(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qSe(e)}function qSe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function CG(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(CG=function(){return!!e})()}function mw(e){return mw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mw(e)}function $Se(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u6(e,t)}function u6(e,t){return u6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},u6(e,t)}function lv(e){return VSe(e)||HSe(e)||EG(e)||USe()}function USe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EG(e,t){if(e){if(typeof e=="string")return d6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d6(e,t)}}function HSe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function VSe(e){if(Array.isArray(e))return d6(e)}function d6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tB(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function kt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tB(Object(r),!0).forEach(function(n){br(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tB(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function br(e,t,r){return t=AG(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AG(e){var t=YSe(e,"string");return sv(t)=="symbol"?t:t+""}function YSe(e,t){if(sv(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(sv(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var GSe={xAxis:["bottom","top"],yAxis:["left","right"]},KSe={width:"100%",height:"100%"},TG={x:0,y:0};function f1(e){return e}var QSe=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},XSe=function(t,r,n,o){var a=r.find(function(d){return d&&d.index===n});if(a){if(t==="horizontal")return{x:a.coordinate,y:o.y};if(t==="vertical")return{x:o.x,y:a.coordinate};if(t==="centric"){var s=a.coordinate,l=o.radius;return kt(kt(kt({},o),Xn(o.cx,o.cy,l,s)),{},{angle:s,radius:l})}var c=a.coordinate,u=o.angle;return kt(kt(kt({},o),Xn(o.cx,o.cy,c,u)),{},{angle:u,radius:c})}return TG},ZS=function(t,r){var n=r.graphicalItems,o=r.dataStartIndex,a=r.dataEndIndex,s=(n??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(lv(l),lv(u)):l},[]);return s.length>0?s:t&&t.length&&qt(o)&&qt(a)?t.slice(o,a+1):[]};function PG(e){return e==="number"?[0,"auto"]:void 0}var f6=function(t,r,n,o){var a=t.graphicalItems,s=t.tooltipAxis,l=ZS(r,t);return n<0||!a||!a.length||n>=l.length?null:a.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:r;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?l:f;h=v2(p,s.dataKey,o)}else h=f&&f[n]||l[n];return h?[].concat(lv(c),[bY(u,h)]):c},[])},rB=function(t,r,n,o){var a=o||{x:t.chartX,y:t.chartY},s=QSe(a,n),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=xve(s,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=f6(t,r,d,f),p=XSe(n,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},ZSe=function(t,r){var n=r.axes,o=r.graphicalItems,a=r.axisType,s=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=hY(d,a);return n.reduce(function(v,m){var b,x=m.type.defaultProps!==void 0?kt(kt({},m.type.defaultProps),m.props):m.props,w=x.type,k=x.dataKey,j=x.allowDataOverflow,_=x.allowDuplicatedCategory,T=x.scale,A=x.ticks,P=x.includeHidden,N=x[s];if(v[N])return v;var O=ZS(t.data,{graphicalItems:o.filter(function(z){var q,G=s in z.props?z.props[s]:(q=z.type.defaultProps)===null||q===void 0?void 0:q[s];return G===N}),dataStartIndex:c,dataEndIndex:u}),C=O.length,I,R,F;kSe(x.domain,j,w)&&(I=_A(x.domain,null,j),p&&(w==="number"||T!=="auto")&&(F=ox(O,k,"category")));var M=PG(w);if(!I||I.length===0){var Y,X=(Y=x.domain)!==null&&Y!==void 0?Y:M;if(k){if(I=ox(O,k,w),w==="category"&&p){var $=hce(I);_&&$?(R=I,I=nw(0,C)):_||(I=iD(X,I,m).reduce(function(z,q){return z.indexOf(q)>=0?z:[].concat(lv(z),[q])},[]))}else if(w==="category")_?I=I.filter(function(z){return z!==""&&!Rr(z)}):I=iD(X,I,m).reduce(function(z,q){return z.indexOf(q)>=0||q===""||Rr(q)?z:[].concat(lv(z),[q])},[]);else if(w==="number"){var ee=kve(O,o.filter(function(z){var q,G,U=s in z.props?z.props[s]:(q=z.type.defaultProps)===null||q===void 0?void 0:q[s],Q="hide"in z.props?z.props.hide:(G=z.type.defaultProps)===null||G===void 0?void 0:G.hide;return U===N&&(P||!Q)}),k,a,d);ee&&(I=ee)}p&&(w==="number"||T!=="auto")&&(F=ox(O,k,"category"))}else p?I=nw(0,C):l&&l[N]&&l[N].hasStack&&w==="number"?I=h==="expand"?[0,1]:xY(l[N].stackGroups,c,u):I=pY(O,o.filter(function(z){var q=s in z.props?z.props[s]:z.type.defaultProps[s],G="hide"in z.props?z.props.hide:z.type.defaultProps.hide;return q===N&&(P||!G)}),w,d,!0);if(w==="number")I=c6(f,I,N,a,A),X&&(I=_A(X,I,j));else if(w==="category"&&X){var V=X,D=I.every(function(z){return V.indexOf(z)>=0});D&&(I=V)}}return kt(kt({},v),{},br({},N,kt(kt({},x),{},{axisType:a,domain:I,categoricalDomain:F,duplicateDomain:R,originalDomain:(b=x.domain)!==null&&b!==void 0?b:M,isCategorical:p,layout:d})))},{})},JSe=function(t,r){var n=r.graphicalItems,o=r.Axis,a=r.axisType,s=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,h=ZS(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),p=h.length,v=hY(d,a),m=-1;return n.reduce(function(b,x){var w=x.type.defaultProps!==void 0?kt(kt({},x.type.defaultProps),x.props):x.props,k=w[s],j=PG("number");if(!b[k]){m++;var _;return v?_=nw(0,p):l&&l[k]&&l[k].hasStack?(_=xY(l[k].stackGroups,c,u),_=c6(f,_,k,a)):(_=_A(j,pY(h,n.filter(function(T){var A,P,N=s in T.props?T.props[s]:(A=T.type.defaultProps)===null||A===void 0?void 0:A[s],O="hide"in T.props?T.props.hide:(P=T.type.defaultProps)===null||P===void 0?void 0:P.hide;return N===k&&!O}),"number",d),o.defaultProps.allowDataOverflow),_=c6(f,_,k,a)),kt(kt({},b),{},br({},k,kt(kt({axisType:a},o.defaultProps),{},{hide:!0,orientation:Gs(GSe,"".concat(a,".").concat(m%2),null),domain:_,originalDomain:j,isCategorical:v,layout:d})))}return b},{})},eje=function(t,r){var n=r.axisType,o=n===void 0?"xAxis":n,a=r.AxisComp,s=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.children,f="".concat(o,"Id"),h=Ks(d,a),p={};return h&&h.length?p=ZSe(t,{axes:h,graphicalItems:s,axisType:o,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):s&&s.length&&(p=JSe(t,{Axis:a,graphicalItems:s,axisType:o,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},tje=function(t){var r=Cf(t),n=sd(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:cP(n,function(o){return o.coordinate}),tooltipAxis:r,tooltipAxisBandSize:$2(r,n)}},nB=function(t){var r=t.children,n=t.defaultShowTooltip,o=qs(r,Km),a=0,s=0;return t.data&&t.data.length!==0&&(s=t.data.length-1),o&&o.props&&(o.props.startIndex>=0&&(a=o.props.startIndex),o.props.endIndex>=0&&(s=o.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!n}},rje=function(t){return!t||!t.length?!1:t.some(function(r){var n=pd(r&&r.type);return n&&n.indexOf("Bar")>=0})},iB=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},nje=function(t,r){var n=t.props,o=t.graphicalItems,a=t.xAxisMap,s=a===void 0?{}:a,l=t.yAxisMap,c=l===void 0?{}:l,u=n.width,d=n.height,f=n.children,h=n.margin||{},p=qs(f,Km),v=qs(f,Ff),m=Object.keys(c).reduce(function(_,T){var A=c[T],P=A.orientation;return!A.mirror&&!A.hide?kt(kt({},_),{},br({},P,_[P]+A.width)):_},{left:h.left||0,right:h.right||0}),b=Object.keys(s).reduce(function(_,T){var A=s[T],P=A.orientation;return!A.mirror&&!A.hide?kt(kt({},_),{},br({},P,Gs(_,"".concat(P))+A.height)):_},{top:h.top||0,bottom:h.bottom||0}),x=kt(kt({},b),m),w=x.bottom;p&&(x.bottom+=p.props.height||Km.defaultProps.height),v&&r&&(x=Sve(x,o,n,r));var k=u-x.left-x.right,j=d-x.top-x.bottom;return kt(kt({brushBottom:w},x),{},{width:Math.max(k,0),height:Math.max(j,0)})},ije=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},VP=function(t){var r=t.chartName,n=t.GraphicalChild,o=t.defaultTooltipEventType,a=o===void 0?"axis":o,s=t.validateTooltipEventTypes,l=s===void 0?["axis"]:s,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(x,w){var k=w.graphicalItems,j=w.stackGroups,_=w.offset,T=w.updateId,A=w.dataStartIndex,P=w.dataEndIndex,N=x.barSize,O=x.layout,C=x.barGap,I=x.barCategoryGap,R=x.maxBarSize,F=iB(O),M=F.numericAxisName,Y=F.cateAxisName,X=rje(k),$=[];return k.forEach(function(ee,V){var D=ZS(x.data,{graphicalItems:[ee],dataStartIndex:A,dataEndIndex:P}),z=ee.type.defaultProps!==void 0?kt(kt({},ee.type.defaultProps),ee.props):ee.props,q=z.dataKey,G=z.maxBarSize,U=z["".concat(M,"Id")],Q=z["".concat(Y,"Id")],K={},re=c.reduce(function(Se,Pe){var Ee=w["".concat(Pe.axisType,"Map")],Ae=z["".concat(Pe.axisType,"Id")];Ee&&Ee[Ae]||Pe.axisType==="zAxis"||Ph();var Ye=Ee[Ae];return kt(kt({},Se),{},br(br({},Pe.axisType,Ye),"".concat(Pe.axisType,"Ticks"),sd(Ye)))},K),H=re[Y],ie=re["".concat(Y,"Ticks")],de=j&&j[U]&&j[U].hasStack&&Nve(ee,j[U].stackGroups),le=pd(ee.type).indexOf("Bar")>=0,ke=$2(H,ie),ve=[],se=X&&bve({barSize:N,stackGroups:j,totalSize:ije(re,Y)});if(le){var be,De,ae=Rr(G)?R:G,ue=(be=(De=$2(H,ie,!0))!==null&&De!==void 0?De:ae)!==null&&be!==void 0?be:0;ve=wve({barGap:C,barCategoryGap:I,bandSize:ue!==ke?ue:ke,sizeList:se[Q],maxBarSize:ae}),ue!==ke&&(ve=ve.map(function(Se){return kt(kt({},Se),{},{position:kt(kt({},Se.position),{},{offset:Se.position.offset-ue/2})})}))}var Me=ee&&ee.type&&ee.type.getComposedData;Me&&$.push({props:kt(kt({},Me(kt(kt({},re),{},{displayedData:D,props:x,dataKey:q,item:ee,bandSize:ke,barPosition:ve,offset:_,stackedData:de,layout:O,dataStartIndex:A,dataEndIndex:P}))),{},br(br(br({key:ee.key||"item-".concat(V)},M,re[M]),Y,re[Y]),"animationId",T)),childIndex:Cce(ee,x.children),item:ee})}),$},p=function(x,w){var k=x.props,j=x.dataStartIndex,_=x.dataEndIndex,T=x.updateId;if(!yL({props:k}))return null;var A=k.children,P=k.layout,N=k.stackOffset,O=k.data,C=k.reverseStackOrder,I=iB(P),R=I.numericAxisName,F=I.cateAxisName,M=Ks(A,n),Y=Ive(O,M,"".concat(R,"Id"),"".concat(F,"Id"),N,C),X=c.reduce(function(z,q){var G="".concat(q.axisType,"Map");return kt(kt({},z),{},br({},G,eje(k,kt(kt({},q),{},{graphicalItems:M,stackGroups:q.axisType===R&&Y,dataStartIndex:j,dataEndIndex:_}))))},{}),$=nje(kt(kt({},X),{},{props:k,graphicalItems:M}),w==null?void 0:w.legendBBox);Object.keys(X).forEach(function(z){X[z]=d(k,X[z],$,z.replace("Map",""),r)});var ee=X["".concat(F,"Map")],V=tje(ee),D=h(k,kt(kt({},X),{},{dataStartIndex:j,dataEndIndex:_,updateId:T,graphicalItems:M,stackGroups:Y,offset:$}));return kt(kt({formattedGraphicalItems:D,graphicalItems:M,offset:$,stackGroups:Y},V),X)},v=(function(b){function x(w){var k,j,_;return zSe(this,x),_=BSe(this,x,[w]),br(_,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),br(_,"accessibilityManager",new jSe),br(_,"handleLegendBBoxUpdate",function(T){if(T){var A=_.state,P=A.dataStartIndex,N=A.dataEndIndex,O=A.updateId;_.setState(kt({legendBBox:T},p({props:_.props,dataStartIndex:P,dataEndIndex:N,updateId:O},kt(kt({},_.state),{},{legendBBox:T}))))}}),br(_,"handleReceiveSyncEvent",function(T,A,P){if(_.props.syncId===T){if(P===_.eventEmitterSymbol&&typeof _.props.syncMethod!="function")return;_.applySyncEvent(A)}}),br(_,"handleBrushChange",function(T){var A=T.startIndex,P=T.endIndex;if(A!==_.state.dataStartIndex||P!==_.state.dataEndIndex){var N=_.state.updateId;_.setState(function(){return kt({dataStartIndex:A,dataEndIndex:P},p({props:_.props,dataStartIndex:A,dataEndIndex:P,updateId:N},_.state))}),_.triggerSyncEvent({dataStartIndex:A,dataEndIndex:P})}}),br(_,"handleMouseEnter",function(T){var A=_.getMouseInfo(T);if(A){var P=kt(kt({},A),{},{isTooltipActive:!0});_.setState(P),_.triggerSyncEvent(P);var N=_.props.onMouseEnter;Ar(N)&&N(P,T)}}),br(_,"triggeredAfterMouseMove",function(T){var A=_.getMouseInfo(T),P=A?kt(kt({},A),{},{isTooltipActive:!0}):{isTooltipActive:!1};_.setState(P),_.triggerSyncEvent(P);var N=_.props.onMouseMove;Ar(N)&&N(P,T)}),br(_,"handleItemMouseEnter",function(T){_.setState(function(){return{isTooltipActive:!0,activeItem:T,activePayload:T.tooltipPayload,activeCoordinate:T.tooltipPosition||{x:T.cx,y:T.cy}}})}),br(_,"handleItemMouseLeave",function(){_.setState(function(){return{isTooltipActive:!1}})}),br(_,"handleMouseMove",function(T){T.persist(),_.throttleTriggeredAfterMouseMove(T)}),br(_,"handleMouseLeave",function(T){_.throttleTriggeredAfterMouseMove.cancel();var A={isTooltipActive:!1};_.setState(A),_.triggerSyncEvent(A);var P=_.props.onMouseLeave;Ar(P)&&P(A,T)}),br(_,"handleOuterEvent",function(T){var A=_ce(T),P=Gs(_.props,"".concat(A));if(A&&Ar(P)){var N,O;/.*touch.*/i.test(A)?O=_.getMouseInfo(T.changedTouches[0]):O=_.getMouseInfo(T),P((N=O)!==null&&N!==void 0?N:{},T)}}),br(_,"handleClick",function(T){var A=_.getMouseInfo(T);if(A){var P=kt(kt({},A),{},{isTooltipActive:!0});_.setState(P),_.triggerSyncEvent(P);var N=_.props.onClick;Ar(N)&&N(P,T)}}),br(_,"handleMouseDown",function(T){var A=_.props.onMouseDown;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"handleMouseUp",function(T){var A=_.props.onMouseUp;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"handleTouchMove",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&_.throttleTriggeredAfterMouseMove(T.changedTouches[0])}),br(_,"handleTouchStart",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&_.handleMouseDown(T.changedTouches[0])}),br(_,"handleTouchEnd",function(T){T.changedTouches!=null&&T.changedTouches.length>0&&_.handleMouseUp(T.changedTouches[0])}),br(_,"handleDoubleClick",function(T){var A=_.props.onDoubleClick;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"handleContextMenu",function(T){var A=_.props.onContextMenu;if(Ar(A)){var P=_.getMouseInfo(T);A(P,T)}}),br(_,"triggerSyncEvent",function(T){_.props.syncId!==void 0&&rE.emit(nE,_.props.syncId,T,_.eventEmitterSymbol)}),br(_,"applySyncEvent",function(T){var A=_.props,P=A.layout,N=A.syncMethod,O=_.state.updateId,C=T.dataStartIndex,I=T.dataEndIndex;if(T.dataStartIndex!==void 0||T.dataEndIndex!==void 0)_.setState(kt({dataStartIndex:C,dataEndIndex:I},p({props:_.props,dataStartIndex:C,dataEndIndex:I,updateId:O},_.state)));else if(T.activeTooltipIndex!==void 0){var R=T.chartX,F=T.chartY,M=T.activeTooltipIndex,Y=_.state,X=Y.offset,$=Y.tooltipTicks;if(!X)return;if(typeof N=="function")M=N($,T);else if(N==="value"){M=-1;for(var ee=0;ee<$.length;ee++)if($[ee].value===T.activeLabel){M=ee;break}}var V=kt(kt({},X),{},{x:X.left,y:X.top}),D=Math.min(R,V.x+V.width),z=Math.min(F,V.y+V.height),q=$[M]&&$[M].value,G=f6(_.state,_.props.data,M),U=$[M]?{x:P==="horizontal"?$[M].coordinate:D,y:P==="horizontal"?z:$[M].coordinate}:TG;_.setState(kt(kt({},T),{},{activeLabel:q,activeCoordinate:U,activePayload:G,activeTooltipIndex:M}))}else _.setState(T)}),br(_,"renderCursor",function(T){var A,P=_.state,N=P.isTooltipActive,O=P.activeCoordinate,C=P.activePayload,I=P.offset,R=P.activeTooltipIndex,F=P.tooltipAxisBandSize,M=_.getTooltipEventType(),Y=(A=T.props.active)!==null&&A!==void 0?A:N,X=_.props.layout,$=T.key||"_recharts-cursor";return $e.createElement(PSe,{key:$,activeCoordinate:O,activePayload:C,activeTooltipIndex:R,chartName:r,element:T,isActive:Y,layout:X,offset:I,tooltipAxisBandSize:F,tooltipEventType:M})}),br(_,"renderPolarAxis",function(T,A,P){var N=Gs(T,"type.axisType"),O=Gs(_.state,"".concat(N,"Map")),C=T.type.defaultProps,I=C!==void 0?kt(kt({},C),T.props):T.props,R=O&&O[I["".concat(N,"Id")]];return S.cloneElement(T,kt(kt({},R),{},{className:Fr(N,R.className),key:T.key||"".concat(A,"-").concat(P),ticks:sd(R,!0)}))}),br(_,"renderPolarGrid",function(T){var A=T.props,P=A.radialLines,N=A.polarAngles,O=A.polarRadius,C=_.state,I=C.radiusAxisMap,R=C.angleAxisMap,F=Cf(I),M=Cf(R),Y=M.cx,X=M.cy,$=M.innerRadius,ee=M.outerRadius;return S.cloneElement(T,{polarAngles:Array.isArray(N)?N:sd(M,!0).map(function(V){return V.coordinate}),polarRadius:Array.isArray(O)?O:sd(F,!0).map(function(V){return V.coordinate}),cx:Y,cy:X,innerRadius:$,outerRadius:ee,key:T.key||"polar-grid",radialLines:P})}),br(_,"renderLegend",function(){var T=_.state.formattedGraphicalItems,A=_.props,P=A.children,N=A.width,O=A.height,C=_.props.margin||{},I=N-(C.left||0)-(C.right||0),R=dY({children:P,formattedGraphicalItems:T,legendWidth:I,legendContent:u});if(!R)return null;var F=R.item,M=eB(R,ISe);return S.cloneElement(F,kt(kt({},M),{},{chartWidth:N,chartHeight:O,margin:C,onBBoxUpdate:_.handleLegendBBoxUpdate}))}),br(_,"renderTooltip",function(){var T,A=_.props,P=A.children,N=A.accessibilityLayer,O=qs(P,Tl);if(!O)return null;var C=_.state,I=C.isTooltipActive,R=C.activeCoordinate,F=C.activePayload,M=C.activeLabel,Y=C.offset,X=(T=O.props.active)!==null&&T!==void 0?T:I;return S.cloneElement(O,{viewBox:kt(kt({},Y),{},{x:Y.left,y:Y.top}),active:X,label:M,payload:X?F:[],coordinate:R,accessibilityLayer:N})}),br(_,"renderBrush",function(T){var A=_.props,P=A.margin,N=A.data,O=_.state,C=O.offset,I=O.dataStartIndex,R=O.dataEndIndex,F=O.updateId;return S.cloneElement(T,{key:T.key||"_recharts-brush",onChange:s1(_.handleBrushChange,T.props.onChange),data:N,x:qt(T.props.x)?T.props.x:C.left,y:qt(T.props.y)?T.props.y:C.top+C.height+C.brushBottom-(P.bottom||0),width:qt(T.props.width)?T.props.width:C.width,startIndex:I,endIndex:R,updateId:"brush-".concat(F)})}),br(_,"renderReferenceElement",function(T,A,P){if(!T)return null;var N=_,O=N.clipPathId,C=_.state,I=C.xAxisMap,R=C.yAxisMap,F=C.offset,M=T.type.defaultProps||{},Y=T.props,X=Y.xAxisId,$=X===void 0?M.xAxisId:X,ee=Y.yAxisId,V=ee===void 0?M.yAxisId:ee;return S.cloneElement(T,{key:T.key||"".concat(A,"-").concat(P),xAxis:I[$],yAxis:R[V],viewBox:{x:F.left,y:F.top,width:F.width,height:F.height},clipPathId:O})}),br(_,"renderActivePoints",function(T){var A=T.item,P=T.activePoint,N=T.basePoint,O=T.childIndex,C=T.isRange,I=[],R=A.props.key,F=A.item.type.defaultProps!==void 0?kt(kt({},A.item.type.defaultProps),A.item.props):A.item.props,M=F.activeDot,Y=F.dataKey,X=kt(kt({index:O,dataKey:Y,cx:P.x,cy:P.y,r:4,fill:LP(A.item),strokeWidth:2,stroke:"#fff",payload:P.payload,value:P.value},yr(M,!1)),y2(M));return I.push(x.renderActiveDot(M,X,"".concat(R,"-activePoint-").concat(O))),N?I.push(x.renderActiveDot(M,kt(kt({},X),{},{cx:N.x,cy:N.y}),"".concat(R,"-basePoint-").concat(O))):C&&I.push(null),I}),br(_,"renderGraphicChild",function(T,A,P){var N=_.filterFormatItem(T,A,P);if(!N)return null;var O=_.getTooltipEventType(),C=_.state,I=C.isTooltipActive,R=C.tooltipAxis,F=C.activeTooltipIndex,M=C.activeLabel,Y=_.props.children,X=qs(Y,Tl),$=N.props,ee=$.points,V=$.isRange,D=$.baseLine,z=N.item.type.defaultProps!==void 0?kt(kt({},N.item.type.defaultProps),N.item.props):N.item.props,q=z.activeDot,G=z.hide,U=z.activeBar,Q=z.activeShape,K=!!(!G&&I&&X&&(q||U||Q)),re={};O!=="axis"&&X&&X.props.trigger==="click"?re={onClick:s1(_.handleItemMouseEnter,T.props.onClick)}:O!=="axis"&&(re={onMouseLeave:s1(_.handleItemMouseLeave,T.props.onMouseLeave),onMouseEnter:s1(_.handleItemMouseEnter,T.props.onMouseEnter)});var H=S.cloneElement(T,kt(kt({},N.props),re));function ie(Pe){return typeof R.dataKey=="function"?R.dataKey(Pe.payload):null}if(K)if(F>=0){var de,le;if(R.dataKey&&!R.allowDuplicatedCategory){var ke=typeof R.dataKey=="function"?ie:"payload.".concat(R.dataKey.toString());de=v2(ee,ke,M),le=V&&D&&v2(D,ke,M)}else de=ee==null?void 0:ee[F],le=V&&D&&D[F];if(Q||U){var ve=T.props.activeIndex!==void 0?T.props.activeIndex:F;return[S.cloneElement(T,kt(kt(kt({},N.props),re),{},{activeIndex:ve})),null,null]}if(!Rr(de))return[H].concat(lv(_.renderActivePoints({item:N,activePoint:de,basePoint:le,childIndex:F,isRange:V})))}else{var se,be=(se=_.getItemByXY(_.state.activeCoordinate))!==null&&se!==void 0?se:{graphicalItem:H},De=be.graphicalItem,ae=De.item,ue=ae===void 0?T:ae,Me=De.childIndex,Se=kt(kt(kt({},N.props),re),{},{activeIndex:Me});return[S.cloneElement(ue,Se),null,null]}return V?[H,null,null]:[H,null]}),br(_,"renderCustomized",function(T,A,P){return S.cloneElement(T,kt(kt({key:"recharts-customized-".concat(P)},_.props),_.state))}),br(_,"renderMap",{CartesianGrid:{handler:f1,once:!0},ReferenceArea:{handler:_.renderReferenceElement},ReferenceLine:{handler:f1},ReferenceDot:{handler:_.renderReferenceElement},XAxis:{handler:f1},YAxis:{handler:f1},Brush:{handler:_.renderBrush,once:!0},Bar:{handler:_.renderGraphicChild},Line:{handler:_.renderGraphicChild},Area:{handler:_.renderGraphicChild},Radar:{handler:_.renderGraphicChild},RadialBar:{handler:_.renderGraphicChild},Scatter:{handler:_.renderGraphicChild},Pie:{handler:_.renderGraphicChild},Funnel:{handler:_.renderGraphicChild},Tooltip:{handler:_.renderCursor,once:!0},PolarGrid:{handler:_.renderPolarGrid,once:!0},PolarAngleAxis:{handler:_.renderPolarAxis},PolarRadiusAxis:{handler:_.renderPolarAxis},Customized:{handler:_.renderCustomized}}),_.clipPathId="".concat((k=w.id)!==null&&k!==void 0?k:Av("recharts"),"-clip"),_.throttleTriggeredAfterMouseMove=uV(_.triggeredAfterMouseMove,(j=w.throttleDelay)!==null&&j!==void 0?j:1e3/60),_.state={},_}return $Se(x,b),DSe(x,[{key:"componentDidMount",value:function(){var k,j;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(k=this.props.margin.left)!==null&&k!==void 0?k:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var k=this.props,j=k.children,_=k.data,T=k.height,A=k.layout,P=qs(j,Tl);if(P){var N=P.props.defaultIndex;if(!(typeof N!="number"||N<0||N>this.state.tooltipTicks.length-1)){var O=this.state.tooltipTicks[N]&&this.state.tooltipTicks[N].value,C=f6(this.state,_,N,O),I=this.state.tooltipTicks[N].coordinate,R=(this.state.offset.top+T)/2,F=A==="horizontal",M=F?{x:I,y:R}:{y:I,x:R},Y=this.state.formattedGraphicalItems.find(function($){var ee=$.item;return ee.type.name==="Scatter"});Y&&(M=kt(kt({},M),Y.props.points[N].tooltipPosition),C=Y.props.points[N].tooltipPayload);var X={activeTooltipIndex:N,isTooltipActive:!0,activeLabel:O,activePayload:C,activeCoordinate:M};this.setState(X),this.renderCursor(P),this.accessibilityManager.setIndex(N)}}}},{key:"getSnapshotBeforeUpdate",value:function(k,j){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==j.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==k.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==k.margin){var _,T;this.accessibilityManager.setDetails({offset:{left:(_=this.props.margin.left)!==null&&_!==void 0?_:0,top:(T=this.props.margin.top)!==null&&T!==void 0?T:0}})}return null}},{key:"componentDidUpdate",value:function(k){Y3([qs(k.children,Tl)],[qs(this.props.children,Tl)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var k=qs(this.props.children,Tl);if(k&&typeof k.props.shared=="boolean"){var j=k.props.shared?"axis":"item";return l.indexOf(j)>=0?j:a}return a}},{key:"getMouseInfo",value:function(k){if(!this.container)return null;var j=this.container,_=j.getBoundingClientRect(),T=fpe(_),A={chartX:Math.round(k.pageX-T.left),chartY:Math.round(k.pageY-T.top)},P=_.width/j.offsetWidth||1,N=this.inRange(A.chartX,A.chartY,P);if(!N)return null;var O=this.state,C=O.xAxisMap,I=O.yAxisMap,R=this.getTooltipEventType(),F=rB(this.state,this.props.data,this.props.layout,N);if(R!=="axis"&&C&&I){var M=Cf(C).scale,Y=Cf(I).scale,X=M&&M.invert?M.invert(A.chartX):null,$=Y&&Y.invert?Y.invert(A.chartY):null;return kt(kt({},A),{},{xValue:X,yValue:$},F)}return F?kt(kt({},A),F):null}},{key:"inRange",value:function(k,j){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,T=this.props.layout,A=k/_,P=j/_;if(T==="horizontal"||T==="vertical"){var N=this.state.offset,O=A>=N.left&&A<=N.left+N.width&&P>=N.top&&P<=N.top+N.height;return O?{x:A,y:P}:null}var C=this.state,I=C.angleAxisMap,R=C.radiusAxisMap;if(I&&R){var F=Cf(I);return sD({x:A,y:P},F)}return null}},{key:"parseEventsOfWrapper",value:function(){var k=this.props.children,j=this.getTooltipEventType(),_=qs(k,Tl),T={};_&&j==="axis"&&(_.props.trigger==="click"?T={onClick:this.handleClick}:T={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var A=y2(this.props,this.handleOuterEvent);return kt(kt({},A),T)}},{key:"addListener",value:function(){rE.on(nE,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){rE.removeListener(nE,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(k,j,_){for(var T=this.state.formattedGraphicalItems,A=0,P=T.length;A<P;A++){var N=T[A];if(N.item===k||N.props.key===k.key||j===pd(N.item.type)&&_===N.childIndex)return N}return null}},{key:"renderClipPath",value:function(){var k=this.clipPathId,j=this.state.offset,_=j.left,T=j.top,A=j.height,P=j.width;return $e.createElement("defs",null,$e.createElement("clipPath",{id:k},$e.createElement("rect",{x:_,y:T,height:A,width:P})))}},{key:"getXScales",value:function(){var k=this.state.xAxisMap;return k?Object.entries(k).reduce(function(j,_){var T=J7(_,2),A=T[0],P=T[1];return kt(kt({},j),{},br({},A,P.scale))},{}):null}},{key:"getYScales",value:function(){var k=this.state.yAxisMap;return k?Object.entries(k).reduce(function(j,_){var T=J7(_,2),A=T[0],P=T[1];return kt(kt({},j),{},br({},A,P.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(k){var j;return(j=this.state.xAxisMap)===null||j===void 0||(j=j[k])===null||j===void 0?void 0:j.scale}},{key:"getYScaleByAxisId",value:function(k){var j;return(j=this.state.yAxisMap)===null||j===void 0||(j=j[k])===null||j===void 0?void 0:j.scale}},{key:"getItemByXY",value:function(k){var j=this.state,_=j.formattedGraphicalItems,T=j.activeItem;if(_&&_.length)for(var A=0,P=_.length;A<P;A++){var N=_[A],O=N.props,C=N.item,I=C.type.defaultProps!==void 0?kt(kt({},C.type.defaultProps),C.props):C.props,R=pd(C.type);if(R==="Bar"){var F=(O.data||[]).find(function($){return Obe(k,$)});if(F)return{graphicalItem:N,payload:F}}else if(R==="RadialBar"){var M=(O.data||[]).find(function($){return sD(k,$)});if(M)return{graphicalItem:N,payload:M}}else if(HS(N,T)||VS(N,T)||nb(N,T)){var Y=t1e({graphicalItem:N,activeTooltipItem:T,itemData:I.data}),X=I.activeIndex===void 0?Y:I.activeIndex;return{graphicalItem:kt(kt({},N),{},{childIndex:X}),payload:nb(N,T)?I.data[Y]:N.props.data[Y]}}}return null}},{key:"render",value:function(){var k=this;if(!yL(this))return null;var j=this.props,_=j.children,T=j.className,A=j.width,P=j.height,N=j.style,O=j.compact,C=j.title,I=j.desc,R=eB(j,OSe),F=yr(R,!1);if(O)return $e.createElement(R7,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},$e.createElement(K3,am({},F,{width:A,height:P,title:C,desc:I}),this.renderClipPath(),bL(_,this.renderMap)));if(this.props.accessibilityLayer){var M,Y;F.tabIndex=(M=this.props.tabIndex)!==null&&M!==void 0?M:0,F.role=(Y=this.props.role)!==null&&Y!==void 0?Y:"application",F.onKeyDown=function($){k.accessibilityManager.keyboardEvent($)},F.onFocus=function(){k.accessibilityManager.focus()}}var X=this.parseEventsOfWrapper();return $e.createElement(R7,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},$e.createElement("div",am({className:Fr("recharts-wrapper",T),style:kt({position:"relative",cursor:"default",width:A,height:P},N)},X,{ref:function(ee){k.container=ee}}),$e.createElement(K3,am({},F,{width:A,height:P,title:C,desc:I,style:KSe}),this.renderClipPath(),bL(_,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])})(S.Component);br(v,"displayName",r),br(v,"defaultProps",kt({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),br(v,"getDerivedStateFromProps",function(b,x){var w=b.dataKey,k=b.data,j=b.children,_=b.width,T=b.height,A=b.layout,P=b.stackOffset,N=b.margin,O=x.dataStartIndex,C=x.dataEndIndex;if(x.updateId===void 0){var I=nB(b);return kt(kt(kt({},I),{},{updateId:0},p(kt(kt({props:b},I),{},{updateId:0}),x)),{},{prevDataKey:w,prevData:k,prevWidth:_,prevHeight:T,prevLayout:A,prevStackOffset:P,prevMargin:N,prevChildren:j})}if(w!==x.prevDataKey||k!==x.prevData||_!==x.prevWidth||T!==x.prevHeight||A!==x.prevLayout||P!==x.prevStackOffset||!mm(N,x.prevMargin)){var R=nB(b),F={chartX:x.chartX,chartY:x.chartY,isTooltipActive:x.isTooltipActive},M=kt(kt({},rB(x,k,A)),{},{updateId:x.updateId+1}),Y=kt(kt(kt({},R),F),M);return kt(kt(kt({},Y),p(kt({props:b},Y),x)),{},{prevDataKey:w,prevData:k,prevWidth:_,prevHeight:T,prevLayout:A,prevStackOffset:P,prevMargin:N,prevChildren:j})}if(!Y3(j,x.prevChildren)){var X,$,ee,V,D=qs(j,Km),z=D&&(X=($=D.props)===null||$===void 0?void 0:$.startIndex)!==null&&X!==void 0?X:O,q=D&&(ee=(V=D.props)===null||V===void 0?void 0:V.endIndex)!==null&&ee!==void 0?ee:C,G=z!==O||q!==C,U=!Rr(k),Q=U&&!G?x.updateId:x.updateId+1;return kt(kt({updateId:Q},p(kt(kt({props:b},x),{},{updateId:Q,dataStartIndex:z,dataEndIndex:q}),x)),{},{prevChildren:j,dataStartIndex:z,dataEndIndex:q})}return null}),br(v,"renderActiveDot",function(b,x,w){var k;return S.isValidElement(b)?k=S.cloneElement(b,x):Ar(b)?k=b(x):k=$e.createElement(BS,x),$e.createElement(cn,{className:"recharts-active-dot",key:w},k)});var m=S.forwardRef(function(x,w){return $e.createElement(v,am({},x,{ref:w}))});return m.displayName=v.displayName,m},oje=VP({chartName:"LineChart",GraphicalChild:rv,axisComponents:[{axisType:"xAxis",AxisComp:iv},{axisType:"yAxis",AxisComp:av}],formatAxisMap:QY}),aje=VP({chartName:"BarChart",GraphicalChild:Uf,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:iv},{axisType:"yAxis",AxisComp:av}],formatAxisMap:QY}),sje=VP({chartName:"PieChart",GraphicalChild:Od,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:US},{axisType:"radiusAxis",AxisComp:qS}],formatAxisMap:$ve,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const p1=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"],oE={background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",fontSize:"12px",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",boxShadow:"var(--elevation-sm)"},h1={fontSize:11,fontFamily:"var(--font-noto-sans)",fill:"var(--muted)"};function aE({title:e,subtitle:t,children:r}){return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsxs("div",{style:{marginBottom:"16px"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3"},children:e}),t?i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:t}):null]}),r]})}function qg({message:e}){return i.jsx("div",{style:{height:160,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"0 16px"},children:i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:e})})}function lje(e,t=14){const r=e.trim();return r.length>t?`${r.slice(0,t-1)}…`:r}function cje({loading:e,registrationTrend:t=[],quizStats:r=[],participantBreakdown:n=[],participantBreakdownSource:o="status"}){const a=Si(),s=a==="mobile",l=a==="tablet",c=s?1:l?2:3,u=s?160:180,d=S.useMemo(()=>(t??[]).map(x=>({period:x.date,Registrations:x.registrations,"Check-ins":x.checkIns})),[t]),f=S.useMemo(()=>(r??[]).slice(0,8).map(x=>({name:lje(x.title),Responses:x.responses,"Avg Score":x.avgScore??0})),[r]),h=S.useMemo(()=>(n??[]).filter(x=>x.count>0).map(x=>({name:x.label,value:x.count})),[n]),p=d.some(x=>x.Registrations>0||x["Check-ins"]>0),v=f.some(x=>x.Responses>0),m=h.length>0,b=o==="tags"?"Participants by tag":"Participants by status";return i.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c}, 1fr)`,gap:s?"12px":"16px"},children:[i.jsx(aE,{title:"Registration Trend",subtitle:"Registrations vs check-ins over time",children:e?i.jsx(qg,{message:"Loading…"}):p?i.jsx(l4,{width:"100%",height:u,children:i.jsxs(oje,{data:d,margin:{top:4,right:8,left:-24,bottom:0},children:[i.jsx(t6,{strokeDasharray:"3 3",stroke:"var(--border)",vertical:!1}),i.jsx(iv,{dataKey:"period",tick:h1,axisLine:!1,tickLine:!1}),i.jsx(av,{tick:h1,axisLine:!1,tickLine:!1}),i.jsx(Tl,{contentStyle:oE}),i.jsx(Ff,{iconType:"circle",iconSize:7,wrapperStyle:{fontSize:"11px",fontFamily:"var(--font-noto-sans)"}}),i.jsx(rv,{type:"monotone",dataKey:"Registrations",stroke:"var(--chart-2)",strokeWidth:2,dot:{r:3,fill:"var(--chart-2)",strokeWidth:0},activeDot:{r:5}}),i.jsx(rv,{type:"monotone",dataKey:"Check-ins",stroke:"var(--chart-1)",strokeWidth:2,dot:{r:3,fill:"var(--chart-1)",strokeWidth:0},activeDot:{r:5},strokeDasharray:"4 3"})]})}):i.jsx(qg,{message:"No registrations yet."})}),i.jsx(aE,{title:"Quiz Participation",subtitle:"Responses and average scores",children:e?i.jsx(qg,{message:"Loading…"}):v?i.jsx(l4,{width:"100%",height:u,children:i.jsxs(aje,{data:f,margin:{top:4,right:8,left:-24,bottom:0},children:[i.jsx(t6,{strokeDasharray:"3 3",stroke:"var(--border)",vertical:!1}),i.jsx(iv,{dataKey:"name",tick:h1,axisLine:!1,tickLine:!1}),i.jsx(av,{tick:h1,axisLine:!1,tickLine:!1}),i.jsx(Tl,{contentStyle:oE}),i.jsx(Ff,{iconType:"square",iconSize:7,wrapperStyle:{fontSize:"11px",fontFamily:"var(--font-noto-sans)"}}),i.jsx(Uf,{dataKey:"Responses",fill:"var(--chart-3)",radius:[3,3,0,0]}),i.jsx(Uf,{dataKey:"Avg Score",fill:"var(--chart-4)",radius:[3,3,0,0]})]})}):i.jsx(qg,{message:"No quiz responses yet."})}),i.jsx("div",{style:l?{gridColumn:"1 / -1"}:{},children:i.jsx(aE,{title:b,subtitle:"Breakdown of registered participants",children:e?i.jsx(qg,{message:"Loading…"}):m?i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[i.jsx(l4,{width:s?"45%":"50%",height:s?140:160,children:i.jsxs(sje,{children:[i.jsx(Od,{data:h,cx:"50%",cy:"50%",innerRadius:s?36:44,outerRadius:s?60:72,paddingAngle:2,dataKey:"value",children:h.map((x,w)=>i.jsx(AS,{fill:p1[w%p1.length]},`cell-${x.name}`))}),i.jsx(Tl,{contentStyle:oE})]})}),i.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"7px"},children:h.map((x,w)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px"},children:[i.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:p1[w%p1.length],flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",flex:1},children:x.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:x.value})]},`legend-${x.name}`))})]}):i.jsx(qg,{message:"No participants to show yet."})})})]})}function Py({children:e}){return i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px",display:"flex",flexDirection:"column",gap:"16px"},children:e})}function Iy({icon:e,title:t,color:r,onViewAll:n}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"var(--radius-button)",background:r+"15",display:"flex",alignItems:"center",justifyContent:"center",color:r},children:e}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:t})]}),n?i.jsxs("button",{type:"button",onClick:n,style:{display:"flex",alignItems:"center",gap:"3px",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",padding:"2px 4px"},onMouseEnter:o=>{o.currentTarget.style.color="var(--primary)"},onMouseLeave:o=>{o.currentTarget.style.color="var(--muted)"},children:["View all ",i.jsx(ka,{size:12})]}):null]})}function oB({label:e,pct:t,color:r}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[t,"%"]})]}),i.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"99px",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${t}%`,background:r,borderRadius:"99px"}})})]})}function uje({label:e,bg:t,color:r}){return i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"4px",background:t,color:r,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",whiteSpace:"nowrap"},children:e})}function Oy({items:e}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${e.length}, 1fr)`,gap:"1px",background:"var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:e.map(([t,r])=>i.jsxs("div",{style:{background:"var(--secondary)",padding:"10px 12px",textAlign:"center"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:t}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:r})]},r))})}function dje(e){return[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||e.email||"Participant"}function fje(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/6e4);if(r<1)return"just now";if(r<60)return`${r}m`;const n=Math.floor(r/60);return n<48?`${n}h`:`${Math.floor(n/24)}d`}function pje(e){const t=e.toLowerCase();return t.includes("keynote")||t.includes("plenary")?{bg:"#ede9fe",color:"#5b21b6"}:t.includes("workshop")?{bg:"#dcfce7",color:"#15803d"}:t.includes("panel")?{bg:"#fee2e2",color:"#b91c1c"}:t.includes("break")?{bg:"#f3f4f6",color:"#6b7280"}:{bg:"#dbeafe",color:"#1d4ed8"}}function hje({loading:e,analytics:t,onNavigate:r}){var j,_,T;const n=Si(),o=n==="mobile"?1:n==="tablet"?2:3,a=(t==null?void 0:t.quizStats)??[],s=(t==null?void 0:t.pollSummaries)??[],l=(t==null?void 0:t.leaderboardTop)??[],c=t==null?void 0:t.agendaSummary,u=(t==null?void 0:t.recentParticipants)??[],d=a.filter(A=>A.responses>0),f=a.reduce((A,P)=>A+P.questionCount,0),h=d.length>0?Math.round(d.reduce((A,P)=>A+(P.avgScore??0),0)/d.length):0,p=((j=t==null?void 0:t.statusCounts)==null?void 0:j.checked_in)??0,v=(t==null?void 0:t.participantCount)??0,m=v>0?Math.round(p/v*100):0,[b,x]=S.useState(0),w=s[b]??s[0],k=e?"—":void 0;return i.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${o}, 1fr)`,gap:n==="mobile"?"12px":"16px"},children:[i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(tS,{size:15}),title:"Quiz",color:"var(--chart-3)",onViewAll:r?()=>r("event-activities"):void 0}),i.jsx(Oy,{items:[[k??String(a.length),"Active"],[k??String(f),"Questions"],[k??(d.length?`${h}%`:"—"),"Avg Score"]]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):a.length===0?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No quizzes yet."}):a.slice(0,4).map(A=>i.jsx(oB,{label:A.title,pct:A.avgScore??0,color:"var(--chart-3)"},A.id))})]}),i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(Ad,{size:15}),title:"Polls",color:"var(--chart-4)",onViewAll:r?()=>r("event-activities"):void 0}),i.jsx(Oy,{items:[[k??String((t==null?void 0:t.pollCount)??0),"Active Polls"],[k??String(s.reduce((A,P)=>A+P.totalVotes,0)),"Total Votes"]]}),e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):w?i.jsxs(i.Fragment,{children:[s.length>1?i.jsx("div",{style:{display:"flex",gap:"6px"},children:s.map((A,P)=>i.jsxs("button",{type:"button",onClick:()=>x(P),style:{flex:1,padding:"5px 0",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:b===P?"var(--primary)":"var(--card)",color:b===P?"#fff":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:["Poll ",P+1]},A.id))}):null,i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"3px"},children:w.title}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"10px"},children:[w.totalVotes," votes"]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"7px"},children:w.options.length?w.options.map(A=>i.jsx(oB,{label:A.label,pct:A.pct,color:"var(--chart-4)"},A.label)):i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No votes recorded yet."})})]})]}):i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No polls yet."})]}),i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(nu,{size:15}),title:"Reward Points",color:"var(--chart-2)",onViewAll:r?()=>r("rewards"):void 0}),i.jsx(Oy,{items:[[k??((_=t==null?void 0:t.pointsAwarded)==null?void 0:_.toLocaleString())??"0","Total Points"],[k??String(l.length),"Earners"]]}),i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):l.length===0?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No leaderboard entries yet."}):l.slice(0,6).map((A,P)=>{const N=["🥇","🥈","🥉"],O=P<3?N[P]:String(P+1),C=dje(A);return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"7px 0",borderBottom:P<Math.min(l.length,6)-1?"1px solid var(--border)":"none"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",width:"20px",textAlign:"center",flexShrink:0},children:O}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:C}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:P<3?"#b45309":"var(--muted)",background:P<3?"#fef9c3":"var(--secondary)",padding:"2px 8px",borderRadius:"99px"},children:A.total})]},String(A.participantId))})})]}),i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(y$,{size:15}),title:"Agenda",color:"var(--chart-5)",onViewAll:r?()=>r("agenda"):void 0}),i.jsx(Oy,{items:[[k??String((c==null?void 0:c.sessionCount)??(t==null?void 0:t.sessionCount)??0),"Sessions"],[k??String((c==null?void 0:c.dayCount)??0),"Days"],[k??String((c==null?void 0:c.speakerCount)??0),"Speakers"]]}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Today"}),e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):(T=c==null?void 0:c.todaySessions)!=null&&T.length?i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:c.todaySessions.map((A,P)=>{const N=pje(A.track);return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderBottom:P<c.todaySessions.length-1?"1px solid var(--border)":"none"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0,width:"36px"},children:A.time}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",lineHeight:"1.3"},children:A.title}),i.jsx(uje,{label:A.track,bg:N.bg,color:N.color})]},A.sessionId)})}):i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No sessions scheduled for today."})]})]}),i.jsxs(Py,{children:[i.jsx(Iy,{icon:i.jsx(Ri,{size:15}),title:"Participants",color:"var(--chart-1)",onViewAll:r?()=>r("participants"):void 0}),i.jsx(Oy,{items:[[k??String(v),"Registered"],[k??String(p),"Checked In"],[k??(v?`${m}%`:"—"),"Rate"]]}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent Activity"}),e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Loading…"}):u.length===0?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No recent activity."}):i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:u.map((A,P)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"7px 0",borderBottom:P<u.length-1?"1px solid var(--border)":"none"},children:[i.jsx("div",{style:{width:"26px",height:"26px",borderRadius:"50%",background:"var(--accent)",color:"var(--accent-foreground)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",flexShrink:0},children:A.name.slice(0,1).toUpperCase()}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.name}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[A.status," · ",fje(A.activityAt)," ago"]})]}),A.checkedIn?i.jsx(yv,{size:14,style:{color:"#16a34a",flexShrink:0}}):i.jsx(rS,{size:14,style:{color:"var(--muted)",flexShrink:0}})]},A.id))})]})]})]})}function gje({eventId:e,onNavigate:t}){const r=Si(),[n,o]=S.useState(null),[a,s]=S.useState(null),[l,c]=S.useState(!1),[u,d]=S.useState(null),f=S.useCallback(async()=>{if(!e){o(null),s(null),d(null),c(!1);return}c(!0),d(null);try{const[p,v]=await Promise.all([Lr.get(e),Lr.analytics(e)]);if(p.error){d(typeof p.error=="string"?p.error:"Failed to load event."),o(null),s(null);return}if(o(p.data??null),v.error){d(typeof v.error=="string"?v.error:"Failed to load analytics."),s(null);return}s(v.data??null)}catch{d("Failed to load analytics."),s(null)}finally{c(!1)}},[e]);S.useEffect(()=>{f()},[f]);const h=p=>{if(p==="agenda"){t==null||t("dashboard");return}t==null||t(p)};return e?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:l&&!n?"Loading…":(n==null?void 0:n.name)??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:r==="mobile"?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:"Analytics"}),u?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginTop:"8px"},children:u}):null]}),i.jsx(Cle,{loading:l,participantCount:a==null?void 0:a.participantCount,sessionCount:a==null?void 0:a.sessionCount,quizPollCount:a==null?void 0:a.quizPollCount,pointsAwarded:a==null?void 0:a.pointsAwarded,pointsRedeemed:a==null?void 0:a.pointsRedeemed,statusCounts:a==null?void 0:a.statusCounts,upcomingSessionCount:a==null?void 0:a.upcomingSessionCount}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"10px"},children:"Charts"}),i.jsx(cje,{loading:l,registrationTrend:a==null?void 0:a.registrationTrend,quizStats:a==null?void 0:a.quizStats,participantBreakdown:a==null?void 0:a.participantBreakdown,participantBreakdownSource:a==null?void 0:a.participantBreakdownSource})]}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"10px"},children:"Features"}),i.jsx(hje,{loading:l,analytics:a,onNavigate:t?h:void 0})]}),i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})})]}):i.jsx("div",{style:{padding:"24px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Select an event to view analytics."})}function mje(){const e="https://web.eventbuzz.live".trim()||!1;return e?e.replace(/\/+$/,""):(typeof window<"u"?window.location.origin:"").replace(/\/+$/,"")}function vje(e){return null}function yje(e){const t=mje();return!t||!e.trim()?null:`${t}/event/${e}`}const xje={conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"},aB={draft:{label:"Draft",bg:"#64748b"},upcoming:{label:"Upcoming",bg:"#2563eb"},live:{label:"Live",bg:"#16a34a"},completed:{label:"Completed",bg:"#475569"}},bje={physical:"Physical",virtual:"Virtual",hybrid:"Hybrid"};function wje(e,t){const r=new Date(e),n=new Date(t);if(Number.isNaN(r.getTime())||Number.isNaN(n.getTime()))return"—";const o=r.toDateString()===n.toDateString(),a=r.getFullYear(),s=n.getFullYear(),l=u=>u.toLocaleDateString(void 0,{month:"short"}),c=u=>u.getDate();return o?r.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):r.getMonth()===n.getMonth()&&a===s?`${l(r)} ${c(r)}–${c(n)}, ${a}`:a===s?`${l(r)} ${c(r)} – ${l(n)} ${c(n)}, ${a}`:`${l(r)} ${c(r)}, ${a} – ${l(n)} ${c(n)}, ${s}`}function Sje(e){var n,o,a,s;const t=(n=e.bannerImage)==null?void 0:n.trim();if(t)return t;const r=(s=(a=(o=e.website)==null?void 0:o.banners)==null?void 0:a[0])==null?void 0:s.trim();return r||null}function jje({event:e,loading:t=!1,onEditEvent:r,canEdit:n=!0}){var x,w,k,j,_,T,A,P,N,O;const a=Si()==="mobile",[s,l]=S.useState(!1);S.useEffect(()=>{l(!1)},[e==null?void 0:e._id,e==null?void 0:e.bannerImage,(w=(x=e==null?void 0:e.website)==null?void 0:x.banners)==null?void 0:w[0]]);const c=e?Sje(e):null,u=e!=null&&e.status&&aB[e.status]?e.status:"draft",d=aB[u],f=e!=null&&e.type?xje[e.type]??e.type:"Event",h=e!=null&&e.locationType?bje[e.locationType]??e.locationType:"",p=e!=null&&e.startDate&&(e!=null&&e.endDate)?wje(e.startDate,e.endDate):"—",v=(e==null?void 0:e.locationType)==="virtual"?((k=e.virtualLink)==null?void 0:k.trim())||"Virtual event":(e==null?void 0:e.locationType)==="hybrid"?[(j=e.location)==null?void 0:j.trim(),(_=e.virtualLink)==null?void 0:_.trim()].filter(Boolean).join(" · ")||"Hybrid":((T=e==null?void 0:e.location)==null?void 0:T.trim())||"—",m=(A=e==null?void 0:e.website)!=null&&A.folder?vje(e.website.folder):e!=null&&e._id?yje(e._id):null,b=(e==null?void 0:e.status)==="live"?{dot:"#16a34a",text:a?"Live":"Live now"}:(e==null?void 0:e.status)==="upcoming"?{dot:"#2563eb",text:"Upcoming"}:(e==null?void 0:e.status)==="completed"?{dot:"#64748b",text:a?"Ended":"Completed"}:{dot:"#94a3b8",text:"Draft"};return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",display:"flex",flexDirection:"column"},children:[i.jsxs("div",{style:{position:"relative",height:a?"110px":"140px",overflow:"hidden",background:c&&!s?void 0:"linear-gradient(135deg, #1e293b 0%, #334155 50%, #0f172a 100%)"},children:[c&&!s?i.jsx("img",{src:c,alt:"",onError:()=>l(!0),style:{width:"100%",height:"100%",objectFit:"cover"}}):null,i.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to right, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.15) 100%)",display:"flex",alignItems:"flex-end",padding:a?"12px 14px":"16px 20px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",width:"100%",gap:"10px"},children:[i.jsxs("div",{style:{overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"5px",flexWrap:"wrap"},children:[t?i.jsx("span",{style:{display:"inline-block",width:"72px",height:"18px",borderRadius:"999px",background:"rgba(255,255,255,0.2)"}}):i.jsx("span",{style:{background:d.bg,color:"#fff",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",padding:"2px 8px",borderRadius:"999px"},children:d.label}),!a&&i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"rgba(255,255,255,0.65)"},children:[h,f].filter(Boolean).join(" · ")})]}),i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:a?"var(--text-base)":"var(--text-xl)",fontWeight:"var(--font-weight-medium)",color:"#fff",lineHeight:"1.2",marginBottom:"2px"},children:t?"…":(e==null?void 0:e.name)??"Select an event"}),!a&&i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",color:"rgba(255,255,255,0.7)"},children:t?" ":((P=e==null?void 0:e.subtitle)==null?void 0:P.trim())||((O=(N=e==null?void 0:e.description)==null?void 0:N.trim())==null?void 0:O.slice(0,120))||" "})]}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexShrink:0,flexWrap:a?"wrap":"nowrap"},children:[!a&&m?i.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"5px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"rgba(255,255,255,0.15)",backdropFilter:"blur(4px)",color:"#fff",border:"1px solid rgba(255,255,255,0.25)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer",textDecoration:"none"},children:[i.jsx(bv,{size:12})," View Website"]}):null,i.jsxs("button",{type:"button",disabled:!n||!e,onClick:()=>n&&e&&(r==null?void 0:r()),style:{display:"flex",alignItems:"center",gap:"5px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:n&&e?"var(--primary)":"var(--secondary)",color:n&&e?"var(--primary-foreground)":"var(--muted)",border:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:n&&e?"pointer":"not-allowed",opacity:n&&e?1:.7},children:[i.jsx(wi,{size:12})," Edit"]})]})]})})]}),i.jsxs("div",{style:{padding:a?"8px 14px":"10px 20px",display:"flex",alignItems:"center",gap:a?"12px":"20px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(Vi,{size:12,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t?"…":p})]}),!a&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(Ab,{size:12,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t?"…":v})]}),i.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:b.dot,display:"block"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:b.dot,fontWeight:"var(--font-weight-medium)"},children:t?"…":b.text})]})]})]})}const g1={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function m1({msg:e}){return e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:e}):null}function kje({n:e,state:t}){const r=t==="todo"?"var(--muted)":"var(--primary)";return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(bi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function _je({eventId:e,existingTrack:t,onClose:r,onSuccess:n}){const o=!!(t!=null&&t._id),[a,s]=S.useState(1),[l,c]=S.useState(()=>o?new Set([1,2,3]):new Set),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState((t==null?void 0:t.name)||""),[m,b]=S.useState((t==null?void 0:t.trackType)||"general"),[x,w]=S.useState((t==null?void 0:t.hall)||""),[k,j]=S.useState((t==null?void 0:t.status)||"active"),[_,T]=S.useState({}),[A,P]=S.useState({}),[N,O]=S.useState({}),C=S.useCallback(()=>{const ee={};return p.trim()?p.trim().length<2&&(ee.name="Use at least 2 characters."):ee.name="Track name is required.",T(ee),Object.keys(ee).length===0},[p]),I=S.useCallback(()=>(P({}),!0),[]),R=S.useCallback(()=>(O({}),!0),[]),F=S.useCallback(()=>{const ee=C(),V=I(),D=R();return ee&&V&&D},[C,I,R]),M=ee=>{ee===1&&!C()||ee===2&&!I()||(c(V=>new Set([...V,ee])),ee<3&&s(ee+1))},Y=async()=>{if(h(null),!F()){C()?I()?s(3):s(2):s(1);return}d(!0);const ee={name:p.trim(),hall:x.trim()||void 0,trackType:m,status:k},V=o?await dm.update(t._id,ee):await dm.create(e,ee);if(d(!1),V.error){h(V.error);return}n(),r()},X=[{n:1,title:"Track name",subtitle:"How this track appears on the agenda."},{n:2,title:"Type & venue",subtitle:"Track category and hall or room."},{n:3,title:"Status",subtitle:"Active tracks show on the public agenda."}],$=({className:ee})=>i.jsx("button",{type:"button",disabled:u,onClick:Y,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:u?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:u?.85:1,...ee?{}:{}},children:u?"Saving…":o?"Save changes":"Save track"});return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:r,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:o?"Edit track":"Add track"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"6px 0 0",fontFamily:"var(--font-noto-sans)"},children:"Complete each section before continuing. Save submits the track."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:r,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:14})}),i.jsx($,{})]})]}),f&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-xs)",marginTop:"10px",fontFamily:"var(--font-noto-sans)"},children:f})]}),i.jsx("div",{style:{flex:1,overflowY:"auto"},children:X.map(ee=>{const V=a===ee.n,D=l.has(ee.n),z=V?"active":D?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:()=>s(V?0:ee.n),style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(kje,{n:ee.n,state:z}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:V?"var(--primary)":"var(--card-foreground)",margin:0},children:ee.title}),!V&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:ee.subtitle})]}),V?i.jsx(Qf,{size:18,style:{color:"var(--muted)"}}):i.jsx(go,{size:18,style:{color:"var(--muted)"}})]}),V&&i.jsxs("div",{style:{padding:"0 20px 16px 52px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 14px",fontFamily:"var(--font-noto-sans)"},children:ee.subtitle}),ee.n===1&&i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Track name ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{value:p,onChange:q=>{v(q.target.value),_.name&&T({})},placeholder:"e.g. Main hall track",style:g1}),i.jsx(m1,{msg:_.name})]}),ee.n===2&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Track type"}),i.jsxs("select",{value:m,onChange:q=>b(q.target.value),style:{...g1,cursor:"pointer"},children:[i.jsx("option",{value:"general",children:"General"}),i.jsx("option",{value:"workshop",children:"Workshop"}),i.jsx("option",{value:"plenary",children:"Plenary"}),i.jsx("option",{value:"symposium",children:"Symposium"})]}),i.jsx(m1,{msg:A.trackType})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Hall / venue"}),i.jsx("input",{value:x,onChange:q=>w(q.target.value),placeholder:"Optional",style:g1}),i.jsx(m1,{msg:A.hall})]})]}),ee.n===3&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Status"}),i.jsxs("select",{value:k,onChange:q=>j(q.target.value),style:{...g1,cursor:"pointer"},children:[i.jsx("option",{value:"active",children:"Active"}),i.jsx("option",{value:"inactive",children:"Inactive"})]}),i.jsx(m1,{msg:N.status})]}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"16px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:ee.n<3?i.jsx("button",{type:"button",onClick:()=>M(ee.n),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Next section"}):i.jsx($,{})})]})]},ee.n)})}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"10px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:r,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx($,{})]})]})]})}const ma="__unassigned__",zp="__new__",Cje=["Presentation","Panel","Keynote","Workshop","Qna","Demo","Debate","Symposium","Other"],Eje=["Scheduled","Live","Completed","Cancelled"],Aje={Presentation:"panel",Panel:"panel",Keynote:"keynote",Workshop:"workshop",Qna:"networking",Demo:"breakout",Debate:"panel",Symposium:"workshop",Other:"breakout"},Tje={keynote:"Keynote",workshop:"Workshop",panel:"Panel",breakout:"Other",networking:"Qna"},Pje={Scheduled:"scheduled",Live:"ongoing",Completed:"completed",Cancelled:"cancelled"},Ije={scheduled:"Scheduled",ongoing:"Live",completed:"Completed",cancelled:"Cancelled"};function sm(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const r=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function Oje(e){const t=new Date(e);if(Number.isNaN(t.getTime())){const o=new Date;o.setHours(9,0,0,0);const a=new Date(o);return a.setHours(10,0,0,0),{start:sm(o.toISOString()),end:sm(a.toISOString())}}const r=new Date(t);r.setHours(9,0,0,0);const n=new Date(r);return n.setHours(10,0,0,0),{start:sm(r.toISOString()),end:sm(n.toISOString())}}const To={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function xf({msg:e}){return e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:e}):null}function Nje({n:e,state:t}){const r=t==="todo"?"var(--muted)":"var(--primary)";return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:r,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(bi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function Rje(e){var t;return(t=e==null?void 0:e.speakers)!=null&&t.length?e.speakers.map(r=>typeof r=="object"&&r&&"_id"in r?String(r._id):String(r)):[]}function sB(e,t){if(!e)return"";const r=e[t];return r==null||r===""?"":String(r)}function Lje({eventId:e,eventName:t,eventStartIso:r,organizationId:n,tracks:o,initialTrackId:a,session:s,onClose:l,onSuccess:c,onTrackCreated:u}){const d=!!(s!=null&&s._id),f=S.useMemo(()=>Oje(r),[r]),h=S.useMemo(()=>{if(!(s!=null&&s.track))return ma;const Mt=s.track;return typeof Mt=="object"&&Mt&&"_id"in Mt?String(Mt._id):String(Mt)},[s]),[p,v]=S.useState(1),[m,b]=S.useState(()=>d?new Set([1,2,3,4]):new Set),[x,w]=S.useState(!1),[k,j]=S.useState(null),[_,T]=S.useState(()=>d?h:a===ma?ma:a&&a!==ma?a:o.length?o[0]._id:zp),[A,P]=S.useState(""),[N,O]=S.useState(""),[C,I]=S.useState("general"),[R,F]=S.useState(!1),[M,Y]=S.useState({}),[X,$]=S.useState((s==null?void 0:s.title)||""),[ee,V]=S.useState((s==null?void 0:s.type)&&Tje[s.type]||"Presentation"),[D,z]=S.useState((s==null?void 0:s.status)&&Ije[s.status]||"Scheduled"),[q,G]=S.useState(s!=null&&s.startTime?sm(s.startTime):f.start),[U,Q]=S.useState(s!=null&&s.endTime?sm(s.endTime):f.end),[K,re]=S.useState((s==null?void 0:s.description)||""),H=Mt=>Mt!==!1,[ie,de]=S.useState(()=>s?H(s.audienceFeedbackEnabled):!0),[le,ke]=S.useState(()=>s?H(s.audienceRatingsEnabled):!0),[ve,se]=S.useState(()=>s?H(s.audienceKeyPersonsEnabled):!0),[be,De]=S.useState(()=>s?H(s.audienceMySessionsEnabled):!0),[ae,ue]=S.useState(()=>s?H(s.audienceAgendaEnabled):!0),[Me,Se]=S.useState(()=>sB(s??null,"audienceFeedbackForm")),[Pe,Ee]=S.useState(()=>sB(s??null,"audienceRatingsForm")),[Ae,Ye]=S.useState([]),[rt,He]=S.useState(!1),[xt,st]=S.useState([]),[Te,et]=S.useState(!0),[Pt,qe]=S.useState(()=>Rje(s)),[Et,vt]=S.useState(""),[Ft,Ce]=S.useState(!1),[lt,Xe]=S.useState(""),[Be,ct]=S.useState(""),[Tt,We]=S.useState(""),[ce,he]=S.useState(""),[je,xe]=S.useState(""),[Re,ze]=S.useState({}),[Le,Qe]=S.useState(!1);S.useEffect(()=>{let Mt=!1;return(async()=>{var yo;et(!0);const xr={limit:500};n&&(xr.organization=n);const $n=await Lf.list(xr);!Mt&&((yo=$n.data)!=null&&yo.speakers)&&st($n.data.speakers),Mt||et(!1)})(),()=>{Mt=!0}},[n]),S.useEffect(()=>{const Mt=n==null?void 0:n.trim();if(!Mt){Ye([]);return}let xr=!1;return He(!0),Mo.list({organization:Mt}).then($n=>{xr||Ye($n.filter(yo=>yo.type==="feedback"&&!["Give us your feedback","Rate us","EventBuzz Default Feedback","EventBuzz Default Ratings"].includes(yo.name??"")))}).catch(()=>{xr||Ye([])}).finally(()=>{xr||He(!1)}),()=>{xr=!0}},[n]);const mt=S.useCallback(Mt=>{const xr=xt.find($n=>$n._id===Mt);return xr?`${xr.firstName} ${xr.lastName}`.trim():`Speaker…${Mt.slice(-6)}`},[xt]),ft=Mt=>{!Mt||Pt.includes(Mt)||qe(xr=>[...xr,Mt])},It=Mt=>qe(xr=>xr.filter($n=>$n!==Mt)),Bt=async()=>{const Mt={};if(lt.trim()||(Mt.firstName="First name is required."),Be.trim()||(Mt.lastName="Last name is required."),Tt.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Tt.trim())||(Mt.email="Enter a valid email."):Mt.email="Email is required.",ze(Mt),Object.keys(Mt).length)return;Qe(!0);const xr=await Lf.create({firstName:lt.trim(),lastName:Be.trim(),email:Tt.trim().toLowerCase(),phone:ce.trim()||void 0,title:je.trim()||void 0,...n?{organization:n}:{}});if(Qe(!1),xr.error||!xr.data){ze({email:xr.error||"Could not create speaker"});return}const $n=xr.data;st(yo=>[$n,...yo.filter(Wt=>Wt._id!==$n._id)]),ft($n._id),Xe(""),ct(""),We(""),he(""),xe(""),ze({}),Ce(!1)},[dr,pr]=S.useState({}),[an,Jn]=S.useState({}),[Fi,Fn]=S.useState({}),[Bo,io]=S.useState({}),Wo=S.useCallback(()=>{const Mt={};return _===zp?Mt.track='Choose "Add new track" and fill the form below, or pick an existing track.':_||(Mt.track="Select a track."),pr(Mt),Object.keys(Mt).length===0},[_]),Yi=S.useCallback(()=>{const Mt={};return X.trim()||(Mt.title="Session title is required."),Jn(Mt),Object.keys(Mt).length===0},[X]),qo=S.useCallback(()=>{const Mt={};q||(Mt.start="Start date and time required."),U||(Mt.end="End date and time required.");const xr=new Date(q).getTime(),$n=new Date(U).getTime();return q&&U&&!($n>xr)&&(Mt.end="End must be after start."),Fn(Mt),Object.keys(Mt).length===0},[q,U]),Ca=S.useCallback(()=>(io({}),!0),[]),xs=S.useCallback(()=>Wo()&&Yi()&&qo()&&Ca(),[Wo,Yi,qo,Ca]),el=async()=>{const Mt={};if(A.trim()||(Mt.name="Track name is required."),Y(Mt),Object.keys(Mt).length)return;F(!0);const xr=await dm.create(e,{name:A.trim(),hall:N.trim()||void 0,trackType:C,status:"active"});if(F(!1),xr.error||!xr.data){Y({name:xr.error||"Could not create track"});return}const $n=xr.data;u($n),T($n._id),P(""),O(""),Y({})},op=Mt=>{Mt===1&&!Wo()||Mt===2&&!Yi()||Mt===3&&!qo()||Mt===4&&!Ca()||(b(xr=>new Set([...xr,Mt])),Mt<4&&v(Mt+1))},jn=async()=>{if(j(null),_===zp){v(1),Wo();return}if(!xs()){Wo()?Yi()?qo()?v(4):v(3):v(2):v(1);return}const Mt={title:X.trim(),description:K.trim()||void 0,type:Aje[ee],startTime:new Date(q).toISOString(),endTime:new Date(U).toISOString(),status:Pje[D],track:_===ma?null:_,speakers:Pt,audienceFeedbackEnabled:ie,audienceRatingsEnabled:le,audienceKeyPersonsEnabled:ve,audienceMySessionsEnabled:be,audienceAgendaEnabled:ae,audienceFeedbackForm:ie&&Me.trim()||null,audienceRatingsForm:le&&Pe.trim()||null};w(!0);const xr=d?await ta.update(s._id,Mt):await ta.create(e,Mt);if(w(!1),xr.error){j(xr.error);return}c(),l()},Ld=[{n:1,title:"Track",subtitle:"Assign this session to a track. You can create a new track inline."},{n:2,title:"Session details",subtitle:"Title, format, and status."},{n:3,title:"Schedule",subtitle:"Start and end date/time."},{n:4,title:"Speakers & notes",subtitle:"Faculty from your organization; add new speakers as needed."}],tl=()=>i.jsx("button",{type:"button",disabled:x,onClick:jn,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:x?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:x?.85:1},children:x?"Saving…":"Save session"});return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:l,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(560px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 4px",fontFamily:"var(--font-noto-sans)"},children:t}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:d?"Edit session":"New session"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"6px 0 0",fontFamily:"var(--font-noto-sans)"},children:"Complete each section to continue. Top and bottom Save submit the session."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:l,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:14})}),i.jsx(tl,{})]})]}),k&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-xs)",marginTop:"10px",fontFamily:"var(--font-noto-sans)"},children:k})]}),i.jsx("div",{style:{flex:1,overflowY:"auto"},children:Ld.map(Mt=>{const xr=p===Mt.n,$n=m.has(Mt.n),yo=xr?"active":$n?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:()=>v(xr?0:Mt.n),style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(Nje,{n:Mt.n,state:yo}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:xr?"var(--primary)":"var(--card-foreground)",margin:0},children:Mt.title}),!xr&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:Mt.subtitle})]}),xr?i.jsx(Qf,{size:18,style:{color:"var(--muted)"}}):i.jsx(go,{size:18,style:{color:"var(--muted)"}})]}),xr&&i.jsxs("div",{style:{padding:"0 20px 16px 52px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 14px",fontFamily:"var(--font-noto-sans)"},children:Mt.subtitle}),Mt.n===1&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Track ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsxs("select",{value:_===zp?zp:_,onChange:Wt=>{const zn=Wt.target.value;T(zn),pr({})},style:{...To,cursor:"pointer"},children:[i.jsx("option",{value:ma,children:"Unassigned"}),o.map(Wt=>i.jsxs("option",{value:Wt._id,children:[Wt.name,Wt.hall?` · ${Wt.hall}`:""]},Wt._id)),i.jsx("option",{value:zp,children:"+ Add new track"})]}),i.jsx(xf,{msg:dr.track})]}),_===zp&&i.jsxs("div",{style:{padding:"14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:"600",margin:0,fontFamily:"var(--font-noto-sans)"},children:"New track"}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Name *"}),i.jsx("input",{value:A,onChange:Wt=>{P(Wt.target.value),M.name&&Y({})},placeholder:"Track name",style:To}),i.jsx(xf,{msg:M.name})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Type"}),i.jsxs("select",{value:C,onChange:Wt=>I(Wt.target.value),style:{...To,cursor:"pointer"},children:[i.jsx("option",{value:"general",children:"General"}),i.jsx("option",{value:"workshop",children:"Workshop"}),i.jsx("option",{value:"plenary",children:"Plenary"}),i.jsx("option",{value:"symposium",children:"Symposium"})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Hall / venue"}),i.jsx("input",{value:N,onChange:Wt=>O(Wt.target.value),placeholder:"Optional",style:To})]}),i.jsxs("button",{type:"button",disabled:R,onClick:el,style:{display:"inline-flex",alignItems:"center",gap:"6px",alignSelf:"flex-start",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:R?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(gr,{size:14})," ",R?"Creating…":"Create track & select"]})]})]}),Mt.n===2&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Title ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{value:X,onChange:Wt=>{$(Wt.target.value),an.title&&Jn({})},placeholder:"Session title",style:To}),i.jsx(xf,{msg:an.title})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Type"}),i.jsx("select",{value:ee,onChange:Wt=>V(Wt.target.value),style:{...To,cursor:"pointer"},children:Cje.map(Wt=>i.jsx("option",{value:Wt,children:Wt},Wt))})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Status"}),i.jsx("select",{value:D,onChange:Wt=>z(Wt.target.value),style:{...To,cursor:"pointer"},children:Eje.map(Wt=>i.jsx("option",{value:Wt,children:Wt},Wt))})]})]})]}),Mt.n===3&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["Start ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx(Pf,{value:q,onChange:Wt=>{G(Wt),Fi.start&&Fn({})},style:To,hasError:!!Fi.start,disabled:x}),i.jsx(xf,{msg:Fi.start})]}),i.jsxs("div",{children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:["End ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx(Pf,{value:U,onChange:Wt=>{Q(Wt),Fi.end&&Fn({})},style:To,hasError:!!Fi.end,disabled:x}),i.jsx(xf,{msg:Fi.end})]})]}),Mt.n===4&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Speakers"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 8px",fontFamily:"var(--font-noto-sans)"},children:"Select from your organization's faculty directory or add someone new."}),Pt.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"10px"},children:Pt.map(Wt=>i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px 4px 10px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[mt(Wt),i.jsx("button",{type:"button",onClick:()=>It(Wt),style:{display:"flex",padding:0,border:"none",background:"none",cursor:"pointer",color:"var(--muted)"},"aria-label":"Remove",children:i.jsx(Gt,{size:12})})]},Wt))}),Te?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading faculty…"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{position:"relative",marginBottom:"8px"},children:[i.jsx(pi,{size:14,style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)"}}),i.jsx("input",{value:Et,onChange:Wt=>vt(Wt.target.value),placeholder:"Search by name or email…",style:{...To,paddingLeft:"32px"}})]}),i.jsx("div",{style:{maxHeight:"160px",overflowY:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)"},children:(()=>{const Wt=xt.filter(Gr=>!Pt.includes(Gr._id)),zn=Et.trim().toLowerCase(),gu=Wt.filter(Gr=>zn?`${Gr.firstName} ${Gr.lastName}`.toLowerCase().includes(zn)||(Gr.email||"").toLowerCase().includes(zn):!0);return xt.length===0?i.jsx("p",{style:{padding:"12px",fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"No speakers in the directory yet. Add one below."}):Wt.length===0?i.jsx("p",{style:{padding:"12px",fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Everyone listed is already on this session. Add a new speaker or remove someone above."}):gu.length===0?i.jsx("p",{style:{padding:"12px",fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"No matches. Try another search."}):gu.slice(0,80).map(Gr=>i.jsxs("button",{type:"button",onClick:()=>ft(Gr._id),style:{width:"100%",textAlign:"left",padding:"8px 12px",border:"none",borderBottom:"1px solid var(--border)",background:"transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},onMouseEnter:rl=>{rl.currentTarget.style.background="var(--secondary)"},onMouseLeave:rl=>{rl.currentTarget.style.background="transparent"},children:[i.jsxs("span",{style:{fontWeight:"var(--font-weight-medium)"},children:[Gr.firstName," ",Gr.lastName]}),Gr.title&&i.jsx("span",{style:{color:"var(--muted)",fontSize:"var(--text-xs)",marginLeft:"6px"},children:Gr.title}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)"},children:Gr.email})]},Gr._id))})()})]}),i.jsxs("button",{type:"button",onClick:()=>{Ce(Wt=>!Wt),ze({})},style:{display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"4px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px dashed var(--border)",background:"transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)"},children:[i.jsx(yT,{size:14})," ",Ft?"Hide new speaker form":"Add new speaker"]}),Ft&&i.jsxs("div",{style:{marginTop:"10px",padding:"14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:"600",margin:0,fontFamily:"var(--font-noto-sans)"},children:"New faculty member (saved to your organization)"}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"First name *"}),i.jsx("input",{value:lt,onChange:Wt=>{Xe(Wt.target.value),Re.firstName&&ze({})},style:To}),i.jsx(xf,{msg:Re.firstName})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Last name *"}),i.jsx("input",{value:Be,onChange:Wt=>{ct(Wt.target.value),Re.lastName&&ze({})},style:To}),i.jsx(xf,{msg:Re.lastName})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Email *"}),i.jsx("input",{type:"email",value:Tt,onChange:Wt=>{We(Wt.target.value),Re.email&&ze({})},style:To}),i.jsx(xf,{msg:Re.email})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Phone"}),i.jsx("input",{value:ce,onChange:Wt=>he(Wt.target.value),style:To})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",display:"block",marginBottom:"4px",fontFamily:"var(--font-noto-sans)"},children:"Title / role"}),i.jsx("input",{value:je,onChange:Wt=>xe(Wt.target.value),placeholder:"e.g. Prof. of Medicine",style:To})]})]}),i.jsxs("button",{type:"button",disabled:Le,onClick:Bt,style:{alignSelf:"flex-start",display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:Le?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," ",Le?"Saving…":"Create & attach to session"]})]})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",marginBottom:"6px",fontFamily:"var(--font-noto-sans)"},children:"Session notes"}),i.jsx("textarea",{value:K,onChange:Wt=>re(Wt.target.value),rows:2,style:{...To,resize:"vertical"},placeholder:"Optional description for this session"})]}),i.jsxs("div",{style:{marginTop:"4px",padding:"14px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:"600",margin:0,fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:"Attendee session page"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)",lineHeight:1.45},children:"Controls what appears on this session's mobile page for attendees."}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:ve,onChange:Wt=>se(Wt.target.checked),style:{marginTop:"3px",width:"16px",height:"16px",flexShrink:0}}),i.jsxs("span",{style:{flex:1,minWidth:0},children:[i.jsx("span",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Key Persons"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show speakers and moderators for this session."})]})]}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:be,onChange:Wt=>De(Wt.target.checked),style:{marginTop:"3px",width:"16px",height:"16px",flexShrink:0}}),i.jsxs("span",{style:{flex:1,minWidth:0},children:[i.jsx("span",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"My Sessions"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show bookmarked sessions for this event."})]})]}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:ae,onChange:Wt=>ue(Wt.target.checked),style:{marginTop:"3px",width:"16px",height:"16px",flexShrink:0}}),i.jsxs("span",{style:{flex:1,minWidth:0},children:[i.jsx("span",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Agenda"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show the full event agenda schedule."})]})]}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:ie,onChange:Wt=>{const zn=Wt.target.checked;de(zn),zn||Se("")},style:{marginTop:"3px",width:"16px",height:"16px",flexShrink:0}}),i.jsxs("span",{style:{flex:1,minWidth:0},children:[i.jsx("span",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Feedback form"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show a link to submit event feedback from this session page."})]})]}),ie?i.jsxs("div",{style:{margin:"-4px 0 4px 26px"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",marginBottom:"6px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Which form?"}),i.jsxs("select",{value:Me,onChange:Wt=>Se(Wt.target.value),disabled:rt,style:{...To,cursor:rt?"wait":"pointer",maxWidth:"100%"},children:[i.jsx("option",{value:"",children:"Default form"}),Ae.map(Wt=>i.jsx("option",{value:Wt._id,children:Wt.name},Wt._id))]}),n!=null&&n.trim()?null:i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"6px 0 0",fontFamily:"var(--font-noto-sans)",lineHeight:1.45},children:"Organization is required on the event to load forms from Forms & Workflow → Feedback."})]}):null,i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"10px",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:le,onChange:Wt=>{const zn=Wt.target.checked;ke(zn),zn||Ee("")},style:{marginTop:"3px",width:"16px",height:"16px",flexShrink:0}}),i.jsxs("span",{style:{flex:1,minWidth:0},children:[i.jsx("span",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Ratings section"}),i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"2px"},children:"Show a link to rate the event from this session page."})]})]}),le?i.jsxs("div",{style:{margin:"-4px 0 0 26px"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",marginBottom:"6px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Which form?"}),i.jsxs("select",{value:Pe,onChange:Wt=>Ee(Wt.target.value),disabled:rt,style:{...To,cursor:rt?"wait":"pointer",maxWidth:"100%"},children:[i.jsx("option",{value:"",children:"Default form"}),Ae.map(Wt=>i.jsx("option",{value:Wt._id,children:Wt.name},Wt._id))]})]}):null]})]}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"16px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:Mt.n<4?i.jsx("button",{type:"button",onClick:()=>op(Mt.n),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Next section"}):i.jsx(tl,{})})]})]},Mt.n)})}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"10px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:l,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx(tl,{})]})]})]})}const Fje={keynote:"Keynote",workshop:"Workshop",panel:"Panel",breakout:"Other",networking:"Qna"},zje={scheduled:"Scheduled",ongoing:"Live",completed:"Completed",cancelled:"Cancelled"};function Mje(e){return{general:"General",workshop:"Workshop",plenary:"Plenary",symposium:"Symposium"}[e]||"General"}function Dje(e){if(e&&typeof e=="object"&&"firstName"in e){const t=e;return`${t.firstName||""} ${t.lastName||""}`.trim()}return""}function Bje(e){var r,n;if((r=e.speakers)!=null&&r.length){const o=e.speakers.map(Dje).filter(Boolean);if(o.length===1)return o[0];if(o.length===2)return`${o[0]} & ${o[1]}`;if(o.length>2)return`${o[0]}, ${o[1]} +${o.length-2}`}const t=(e.description||"").match(/Speaker:\s*(.+?)(?:\n|$)/i);return(n=t==null?void 0:t[1])==null?void 0:n.trim()}function Wje(e){const t=new Date(e.startTime),r=new Date(e.endTime),n=s=>Number.isNaN(s.getTime())?{date:"—",time:"—"}:{date:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),time:s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})},o=n(t),a=n(r);return{id:e._id,joinCode:e.joinCode,title:e.title,type:Fje[e.type]||"Other",startDate:o.date,startTime:o.time,endDate:a.date,endTime:a.time,status:zje[e.status]||"Scheduled",speaker:Bje(e),description:e.description}}const p6={Presentation:{bg:"#dbeafe",color:"#1d4ed8"},Panel:{bg:"#dcfce7",color:"#15803d"},Keynote:{bg:"#ede9fe",color:"#5b21b6"},Workshop:{bg:"#ffedd5",color:"#c2410c"},Qna:{bg:"#ccfbf1",color:"#0d9488"},Demo:{bg:"#f1f5f9",color:"#475569"},Other:{bg:"#f3f4f6",color:"#6b7280"},Debate:{bg:"#fce7f3",color:"#be185d"},Symposium:{bg:"#dbeafe",color:"#1d4ed8"}},qje={Scheduled:{bg:"#e0e7ff",color:"#3730a3"},Live:{bg:"#dcfce7",color:"#15803d"},Completed:{bg:"#f1f5f9",color:"#475569"},Cancelled:{bg:"#fee2e2",color:"#b91c1c"}};function IG({type:e}){const t=p6[e]||p6.Other;return i.jsx("span",{style:{display:"inline-flex",padding:"2px 7px",borderRadius:"3px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e})}function OG({status:e}){const t=qje[e];return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:[e==="Live"&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"block"}}),e]})}const lc={width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--card-foreground)",flexShrink:0};function $je({session:e,onEdit:t,onDelete:r,onDuplicate:n,onOpenQr:o,duplicateLoading:a}){var c,u,d,f;const[s,l]=S.useState(!1);return i.jsxs("tr",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:s?"var(--secondary)":"transparent",transition:"background 0.12s",borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:{width:"32px",paddingLeft:"12px"},children:i.jsx("div",{style:{opacity:s?1:0,transition:"opacity 0.15s",color:"var(--muted)",cursor:"grab",display:"flex"},children:i.jsx(wv,{size:14})})}),i.jsxs("td",{style:{padding:"10px 12px 10px 4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",fontWeight:"var(--font-weight-medium)",lineHeight:"1.4"},children:e.title}),e.speaker&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px",display:"flex",alignItems:"center",gap:"3px"},children:[i.jsx(Om,{size:10})," ",e.speaker]})]}),i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap"},children:i.jsx(IG,{type:e.type})}),i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(rS,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[e.startDate,", ",e.startTime," – ",e.endTime]})]})}),i.jsx("td",{style:{padding:"10px 12px",whiteSpace:"nowrap"},children:i.jsx(OG,{status:e.status})}),i.jsx("td",{style:{padding:"10px 12px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"4px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:h=>{h.stopPropagation(),t()},title:"Edit",style:{display:"flex",alignItems:"center",gap:"4px",padding:"3px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(wi,{size:11})," Edit"]}),i.jsx("button",{type:"button",title:(c=e.joinCode)!=null&&c.trim()?"QR code":"Join code not available yet",disabled:!((u=e.joinCode)!=null&&u.trim()),onClick:h=>{h.stopPropagation(),o()},style:{...lc,opacity:(d=e.joinCode)!=null&&d.trim()?1:.35,cursor:(f=e.joinCode)!=null&&f.trim()?"pointer":"not-allowed"},onMouseEnter:h=>{var p;(p=e.joinCode)!=null&&p.trim()&&(h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)")},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(Zf,{size:13})}),i.jsx("button",{type:"button",title:"Duplicate",disabled:a,onClick:h=>{h.stopPropagation(),n()},style:{...lc,opacity:a?.7:1,cursor:a?"wait":"pointer"},onMouseEnter:h=>{a||(h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)")},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:a?i.jsx(kx,{size:13,className:"animate-spin"}):i.jsx(Js,{size:13})}),i.jsx("button",{type:"button",title:"Delete",onClick:h=>{h.stopPropagation(),r()},style:{...lc,color:"var(--destructive)",borderColor:"var(--border)"},onMouseEnter:h=>{h.currentTarget.style.background="#fef2f2",h.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:h=>{h.currentTarget.style.background="var(--card)",h.currentTarget.style.borderColor="var(--border)"},children:i.jsx(Xr,{size:13})})]})})]})}function Uje({session:e,onEdit:t,onDelete:r,onDuplicate:n,onOpenQr:o,duplicateLoading:a}){var c,u,d,f,h;const[s,l]=S.useState(!1);return i.jsxs("div",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"8px",borderTop:`3px solid ${((c=p6[e.type])==null?void 0:c.color)||"#94a3b8"}`,transition:"box-shadow 0.15s",boxShadow:s?"var(--elevation-sm)":"none"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"8px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.4",flex:1},children:e.title}),i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:i.jsx(IG,{type:e.type})})]}),e.speaker&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx(Om,{size:10})," ",e.speaker]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"8px",borderTop:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(rS,{size:11,style:{color:"var(--muted)"}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[e.startDate,", ",e.startTime," – ",e.endTime]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap",justifyContent:"flex-end"},children:[i.jsx(OG,{status:e.status}),i.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:t,title:"Edit",style:{...lc,width:"28px",height:"28px"},onMouseEnter:p=>{p.currentTarget.style.borderColor="var(--primary)",p.currentTarget.style.color="var(--primary)"},onMouseLeave:p=>{p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(wi,{size:11})}),i.jsx("button",{type:"button",title:(u=e.joinCode)!=null&&u.trim()?"QR code":"Join code not available yet",disabled:!((d=e.joinCode)!=null&&d.trim()),onClick:o,style:{...lc,width:"28px",height:"28px",opacity:(f=e.joinCode)!=null&&f.trim()?1:.35,cursor:(h=e.joinCode)!=null&&h.trim()?"pointer":"not-allowed"},onMouseEnter:p=>{var v;(v=e.joinCode)!=null&&v.trim()&&(p.currentTarget.style.borderColor="var(--primary)",p.currentTarget.style.color="var(--primary)")},onMouseLeave:p=>{p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(Zf,{size:11})}),i.jsx("button",{type:"button",title:"Duplicate",disabled:a,onClick:n,style:{...lc,width:"28px",height:"28px",opacity:a?.7:1,cursor:a?"wait":"pointer"},onMouseEnter:p=>{a||(p.currentTarget.style.borderColor="var(--primary)",p.currentTarget.style.color="var(--primary)")},onMouseLeave:p=>{p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--card-foreground)"},children:a?i.jsx(kx,{size:13,className:"animate-spin"}):i.jsx(Js,{size:13})}),i.jsx("button",{type:"button",title:"Delete",onClick:r,style:{...lc,width:"28px",height:"28px",color:"var(--destructive)"},onMouseEnter:p=>{p.currentTarget.style.background="#fef2f2",p.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:p=>{p.currentTarget.style.background="var(--card)",p.currentTarget.style.borderColor="var(--border)",p.currentTarget.style.color="var(--destructive)"},children:i.jsx(Xr,{size:13})})]})]})]})]})}function Hje({title:e,message:t,confirmLabel:r,variant:n,onConfirm:o,onCancel:a}){const s=n==="danger";return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:110,display:"flex",alignItems:"center",justifyContent:"center"},onClick:a,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"min(400px, calc(100vw - 32px))",padding:"20px",boxShadow:"var(--shadow-xl)"},onClick:l=>l.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start",marginBottom:"20px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:s?"#fee2e2":"var(--secondary)",border:s?"none":"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s?i.jsx(Wh,{size:16,style:{color:"var(--destructive)"}}):i.jsx(Js,{size:16,style:{color:"var(--primary)"}})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px"},children:e}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:t})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:a,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:()=>void Promise.resolve(o()),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"none",background:s?"var(--destructive)":"var(--primary)",color:s?"#fff":"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:r})]})]})})}function Vje({track:e,isOpen:t,virtual:r,onToggle:n,onEdit:o,onDelete:a,onDuplicate:s,onOpenTrackQr:l,duplicateTrackLoading:c,onAddSession:u,onEditSession:d,onDeleteSession:f,onDuplicateSession:h,onOpenSessionQr:p,duplicatingSessionId:v}){var k,j,_,T;const b=Si()==="mobile",[x,w]=S.useState(b?"card":"list");return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:b?"0 12px":"0 16px",background:"var(--card)",borderBottom:t?"1px solid var(--border)":"none",minHeight:b?"56px":"52px"},children:[i.jsx("button",{onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"22px",height:"22px",borderRadius:"4px",background:"var(--secondary)",border:"none",cursor:"pointer",color:"var(--muted)",flexShrink:0},children:t?i.jsx(go,{size:13}):i.jsx(ka,{size:13})}),i.jsxs("button",{onClick:n,style:{display:"flex",alignItems:"center",gap:"8px",flex:1,background:"none",border:"none",cursor:"pointer",textAlign:"left",padding:"0",minWidth:0},children:[i.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--primary)",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),!b&&i.jsx("span",{style:{display:"inline-flex",padding:"1px 7px",borderRadius:"3px",background:"var(--accent)",color:"var(--accent-foreground)",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0},children:e.type}),!b&&i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"3px",flexShrink:0},children:[i.jsx(Ab,{size:11,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e.hall})]}),i.jsx("span",{style:{marginLeft:"auto",fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"var(--secondary)",border:"1px solid var(--border)",padding:"1px 8px",borderRadius:"99px",flexShrink:0},children:e.sessions.length}),!b&&e.status==="Active"&&i.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"#15803d",flexShrink:0},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"block"}}),"Active"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0,flexWrap:"wrap",justifyContent:"flex-end"},children:[i.jsxs("button",{type:"button",onClick:A=>{A.stopPropagation(),u()},style:{display:"flex",alignItems:"center",gap:"5px",padding:b?"8px":"5px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:12}),!b&&" Add Session"]}),!r&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",title:"Edit track",onClick:A=>{A.stopPropagation(),o()},style:{...lc},onMouseEnter:A=>{A.currentTarget.style.borderColor="var(--primary)",A.currentTarget.style.color="var(--primary)"},onMouseLeave:A=>{A.currentTarget.style.borderColor="var(--border)",A.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(wi,{size:13})}),i.jsx("button",{type:"button",title:(k=e.joinCode)!=null&&k.trim()?"QR code":"Join code not available yet",disabled:!((j=e.joinCode)!=null&&j.trim()),onClick:A=>{A.stopPropagation(),l()},style:{...lc,opacity:(_=e.joinCode)!=null&&_.trim()?1:.35,cursor:(T=e.joinCode)!=null&&T.trim()?"pointer":"not-allowed"},onMouseEnter:A=>{var P;(P=e.joinCode)!=null&&P.trim()&&(A.currentTarget.style.borderColor="var(--primary)",A.currentTarget.style.color="var(--primary)")},onMouseLeave:A=>{A.currentTarget.style.borderColor="var(--border)",A.currentTarget.style.color="var(--card-foreground)"},children:i.jsx(Zf,{size:13})}),i.jsx("button",{type:"button",title:"Duplicate track",disabled:c,onClick:A=>{A.stopPropagation(),s()},style:{...lc,opacity:c?.7:1,cursor:c?"wait":"pointer"},onMouseEnter:A=>{c||(A.currentTarget.style.borderColor="var(--primary)",A.currentTarget.style.color="var(--primary)")},onMouseLeave:A=>{A.currentTarget.style.borderColor="var(--border)",A.currentTarget.style.color="var(--card-foreground)"},children:c?i.jsx(kx,{size:13,className:"animate-spin"}):i.jsx(Js,{size:13})}),i.jsx("button",{type:"button",title:"Delete track",onClick:A=>{A.stopPropagation(),a()},style:{...lc,color:"var(--destructive)"},onMouseEnter:A=>{A.currentTarget.style.background="#fef2f2",A.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:A=>{A.currentTarget.style.background="var(--card)",A.currentTarget.style.borderColor="var(--border)",A.currentTarget.style.color="var(--destructive)"},children:i.jsx(Xr,{size:13})})]})]})]}),t&&i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.sessions.length," session",e.sessions.length!==1?"s":""," in this track"]}),i.jsx("div",{style:{display:"flex",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--card)"},children:["list","card"].map(A=>i.jsxs("button",{onClick:()=>w(A),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",background:x===A?"var(--primary)":"transparent",color:x===A?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:A==="card"?"1px solid var(--border)":"none"},children:[A==="list"?i.jsx(Eb,{size:13}):i.jsx(Cb,{size:13}),A==="list"?"List":"Cards"]},A))})]}),e.sessions.length===0?i.jsxs("div",{style:{padding:"36px 16px",textAlign:"center"},children:[i.jsx(Vi,{size:28,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"14px"},children:"No sessions yet"}),i.jsxs("button",{onClick:u,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add First Session"]})]}):x==="list"?i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--secondary)"},children:[i.jsx("th",{style:{width:"32px",padding:"8px 0 8px 12px"}}),["Session","Type","Time","Status",""].map(A=>i.jsx("th",{style:{padding:"8px 12px",textAlign:"left",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase",whiteSpace:"nowrap",borderBottom:"1px solid var(--border)"},children:A},A))]})}),i.jsx("tbody",{children:e.sessions.map(A=>i.jsx($je,{session:A,onEdit:()=>d(A),onDelete:()=>f(A.id),onDuplicate:()=>h(A),onOpenQr:()=>p(A),duplicateLoading:v===A.id},A.id))})]})}):i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px",padding:"14px 16px"},children:e.sessions.map(A=>i.jsx(Uje,{session:A,onEdit:()=>d(A),onDelete:()=>f(A.id),onDuplicate:()=>h(A),onOpenQr:()=>p(A),duplicateLoading:v===A.id},A.id))})]})]})}function lB({embedInDashboard:e=!1}={}){const{selectedEventId:t,openAgendaSessionPanelOnce:r,setOpenAgendaSessionPanelOnce:n}=Li(),o=Si(),a=o==="mobile",s=o==="mobile"||o==="tablet",[l,c]=S.useState(""),[u,d]=S.useState(new Date().toISOString()),[f,h]=S.useState(""),[p,v]=S.useState([]),[m,b]=S.useState({}),[x,w]=S.useState([]),[k,j]=S.useState(new Set),[_,T]=S.useState(!1),[A,P]=S.useState(null),[N,O]=S.useState(null),[C,I]=S.useState(null),[R,F]=S.useState(null),[M,Y]=S.useState(null),[X,$]=S.useState(null),[ee,V]=S.useState(null);S.useEffect(()=>{!t||!r||(O({initialTrackId:ma}),n(!1))},[t,r,n]);const D=S.useCallback(async()=>{var Ae,Ye;if(!t)return;T(!0),P(null);const[le,ke,ve]=await Promise.all([Lr.get(t),dm.list(t),ta.list(t)]);if(T(!1),le.error||!le.data){P(le.error||"Could not load event");return}const se=le.data;c(se.name||"Event"),d(se.startDate||new Date().toISOString());const be=typeof se.organization=="object"&&se.organization&&"_id"in se.organization?String(se.organization._id):se.organization?String(se.organization):"";h(be);const De=((Ae=ke.data)==null?void 0:Ae.tracks)||[];v(De);const ae=((Ye=ve.data)==null?void 0:Ye.sessions)||[],ue={};ae.forEach(rt=>{ue[rt._id]=rt}),b(ue);const Me=[...De].sort((rt,He)=>(rt.sortOrder??0)-(He.sortOrder??0)||rt.name.localeCompare(He.name)),Se=new Map;Me.forEach(rt=>{Se.set(rt._id,{id:rt._id,joinCode:rt.joinCode,name:rt.name,type:Mje(rt.trackType),hall:rt.hall||"—",status:rt.status==="active"?"Active":"Inactive",sessions:[]})});const Pe={id:ma,name:"Unassigned",type:"General",hall:"—",status:"Active",sessions:[]};ae.forEach(rt=>{const He=Wje(rt),xt=typeof rt.track=="object"&&rt.track&&"_id"in rt.track?String(rt.track._id):rt.track?String(rt.track):"";xt&&Se.has(xt)?Se.get(xt).sessions.push(He):Pe.sessions.push(He)});const Ee=[...Se.values()];Pe.sessions.sort((rt,He)=>rt.startDate.localeCompare(He.startDate)||rt.startTime.localeCompare(He.startTime)),Ee.forEach(rt=>{rt.sessions.sort((He,xt)=>He.startDate.localeCompare(xt.startDate)||He.startTime.localeCompare(xt.startTime))}),Pe.sessions.length&&Ee.push(Pe),w(Ee),j(rt=>rt.size===0&&Ee.length?new Set([Ee[0].id]):rt)},[t]);S.useEffect(()=>{D()},[D]);const z=le=>j(ke=>{const ve=new Set(ke);return ve.has(le)?ve.delete(le):ve.add(le),ve}),q=()=>I({editTrack:null}),G=le=>{if(le.id===ma)return;const ke=p.find(ve=>ve._id===le.id);ke&&I({editTrack:ke})},U=le=>{if(le===ma)return;const ke=x.find(ve=>ve.id===le);F({title:"Confirm Delete",msg:`Delete "${ke==null?void 0:ke.name}"? Sessions in this track become unassigned.`,confirmLabel:"Delete",variant:"danger",onConfirm:async()=>{const ve=await dm.remove(le);F(null),ve.error||await D()}})},Q=async le=>{if(le.id===ma||!t)return;const ke=p.find(be=>be._id===le.id);if(!ke)return;const ve=await dm.create(t,{name:`${ke.name} (Copy)`,hall:ke.hall,trackType:ke.trackType,status:"active",sortOrder:(ke.sortOrder??0)+1});if(ve.error||!ve.data)return;const se=ve.data;for(const be of le.sessions){const De=m[be.id];if(!De)continue;typeof De.track=="object"&&De.track&&"_id"in De.track?String(De.track._id):De.track&&String(De.track);const ae=(De.speakers||[]).map(ue=>typeof ue=="object"&&ue&&"_id"in ue?String(ue._id):String(ue));await ta.create(t,{title:`${De.title} (Copy)`,description:De.description,type:De.type,startTime:De.startTime,endTime:De.endTime,location:De.location,status:De.status,track:se._id,speakers:ae.filter(Boolean)})}await D()},K=le=>{le.id===ma||!t||F({title:"Duplicate track",msg:`Create a copy of "${le.name}" including all ${le.sessions.length} session(s)? This may take a moment.`,confirmLabel:"Duplicate",variant:"primary",onConfirm:async()=>{F(null),$(le.id);try{await Q(le)}finally{$(null)}}})},re=(le,ke)=>{const ve=m[ke];F({title:"Confirm Delete",msg:`Delete "${(ve==null?void 0:ve.title)||"session"}"?`,confirmLabel:"Delete",variant:"danger",onConfirm:async()=>{const se=await ta.remove(ke);F(null),se.error||await D()}})},H=async(le,ke)=>{if(!t)return;const ve=m[ke.id];if(!ve)return;const se=typeof ve.track=="object"&&ve.track&&"_id"in ve.track?ve.track._id:ve.track||null,be=(ve.speakers||[]).map(De=>typeof De=="object"&&De&&"_id"in De?String(De._id):String(De));await ta.create(t,{title:`${ve.title} (Copy)`,description:ve.description,type:ve.type,startTime:ve.startTime,endTime:ve.endTime,location:ve.location,status:ve.status,track:se?String(se):null,speakers:be.filter(Boolean),audienceFeedbackEnabled:ve.audienceFeedbackEnabled,audienceRatingsEnabled:ve.audienceRatingsEnabled,audienceKeyPersonsEnabled:ve.audienceKeyPersonsEnabled,audienceMySessionsEnabled:ve.audienceMySessionsEnabled,audienceAgendaEnabled:ve.audienceAgendaEnabled,audienceFeedbackForm:ve.audienceFeedbackForm??null,audienceRatingsForm:ve.audienceRatingsForm??null}),await D()},ie=(le,ke)=>{F({title:"Duplicate session",msg:`Create a copy of "${ke.title}"?`,confirmLabel:"Duplicate",variant:"primary",onConfirm:async()=>{F(null),V(ke.id);try{await H(le,ke)}finally{V(null)}}})},de=x.reduce((le,ke)=>le+ke.sessions.length,0);return t?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:_?"…":l}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:a?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2",marginBottom:"4px"},children:e?"Agenda":"Event Home"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:A?i.jsx("span",{style:{color:"var(--destructive)"},children:A}):`${x.filter(le=>le.id!==ma).length} tracks · ${de} sessions`})]}),i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:i.jsxs("button",{onClick:q,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:le=>{le.currentTarget.style.borderColor="var(--primary)",le.currentTarget.style.color="var(--primary)"},onMouseLeave:le=>{le.currentTarget.style.borderColor="var(--border)",le.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(gr,{size:14})," ",s?"Track":"Add Track"]})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("button",{onClick:()=>j(new Set(x.map(le=>le.id))),style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"none",border:"none",cursor:"pointer",padding:"0 4px"},onMouseEnter:le=>{le.currentTarget.style.color="var(--foreground)"},onMouseLeave:le=>{le.currentTarget.style.color="var(--muted)"},children:"Expand all"}),i.jsx("span",{style:{color:"var(--border)"},children:"·"}),i.jsx("button",{onClick:()=>j(new Set),style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"none",border:"none",cursor:"pointer",padding:"0 4px"},onMouseEnter:le=>{le.currentTarget.style.color="var(--foreground)"},onMouseLeave:le=>{le.currentTarget.style.color="var(--muted)"},children:"Collapse all"})]}),x.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Vi,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No tracks yet"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px"},children:"Create your first track to start organizing sessions."}),i.jsxs("button",{onClick:q,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," Add First Track"]})]}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:x.map(le=>i.jsx(Vje,{track:le,virtual:le.id===ma,isOpen:k.has(le.id),onToggle:()=>z(le.id),onEdit:()=>G(le),onDelete:()=>U(le.id),onDuplicate:()=>K(le),onOpenTrackQr:()=>Y({kind:"track",label:le.name,joinCode:le.joinCode||""}),duplicateTrackLoading:X===le.id,onAddSession:()=>O({initialTrackId:le.id===ma?ma:le.id}),onEditSession:ke=>O({initialTrackId:le.id,sessionId:ke.id}),onDeleteSession:ke=>re(le.id,ke),onDuplicateSession:ke=>ie(le.id,ke),onOpenSessionQr:ke=>Y({kind:"session",label:ke.title,joinCode:ke.joinCode||""}),duplicatingSessionId:ee},le.id))}),!e&&i.jsx("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})}),N&&t&&i.jsx(Lje,{eventId:t,eventName:l,eventStartIso:u,organizationId:f,tracks:p,initialTrackId:N.initialTrackId??void 0,session:N.sessionId?m[N.sessionId]??null:null,onClose:()=>O(null),onSuccess:()=>D(),onTrackCreated:le=>v(ke=>[...ke,le])}),C&&t&&i.jsx(_je,{eventId:t,existingTrack:C.editTrack,onClose:()=>I(null),onSuccess:()=>D()}),R&&i.jsx(Hje,{title:R.title,message:R.msg,confirmLabel:R.confirmLabel,variant:R.variant,onConfirm:R.onConfirm,onCancel:()=>F(null)}),M&&i.jsx(FT,{open:!0,onClose:()=>Y(null),kind:M.kind,joinCode:M.joinCode,label:M.label})]}):i.jsxs("div",{style:{textAlign:"center",padding:"80px 24px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Vi,{size:40,style:{color:"var(--border)",margin:"0 auto 16px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Select an event"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:"8px",fontFamily:"var(--font-noto-sans)"},children:"Choose an event in the sidebar to manage its agenda."})]})}const Mp={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function Dp({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"3px"},children:"*"}),e]})}function v1({msg:e}){return e?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:e}):null}function Bp({children:e}){return i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e})}function cB({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function Yje({n:e,state:t}){return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:t==="todo"?"var(--muted)":"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(bi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function sE({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onNext:l,nextLabel:c,nextDisabled:u}){const d=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(Yje,{n:e,state:d}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx(Qf,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(go,{size:18,style:{color:"var(--muted)",flexShrink:0}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px 40px"},children:r}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:s}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"20px",paddingTop:"14px",borderTop:"1px solid var(--border)"},children:i.jsx("button",{type:"button",disabled:u,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 18px",borderRadius:"var(--radius-button)",background:u?"var(--secondary)":"var(--primary)",color:u?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:u?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})})]})]})}const Gje={firstName:"",lastName:"",email:"",phone:"",organization:"",designation:"",notes:""},Kje=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function uB(e){const t={};e.firstName.trim()||(t.firstName="First name is required."),e.lastName.trim()||(t.lastName="Last name is required."),e.email.trim()?Kje.test(e.email.trim())||(t.email="Enter a valid email address."):t.email="Email is required.";const r=e.phone.trim();return r&&!/^[\d\s+().-]{6,}$/.test(r)&&(t.phone="Enter a valid phone number."),t}function dB(e){return{}}function Qje({eventId:e,onClose:t,participantId:r,onSuccess:n}){const o=!!r,a=3,[s,l]=S.useState(1),[c,u]=S.useState(()=>o?new Set([1,2,3]):new Set),[d,f]=S.useState(Gje),[h,p]=S.useState(!1),[v,m]=S.useState({}),[b,x]=S.useState(null);S.useEffect(()=>{r&&ai.get(r).then(N=>{const O=N.data;O&&(f({firstName:O.firstName??"",lastName:O.lastName??"",email:O.email??"",phone:O.phone??"",organization:O.organization??"",designation:O.designation??"",notes:O.notes??""}),u(new Set([1,2,3])))})},[r]);const w=S.useCallback((N,O)=>{f(C=>({...C,[N]:O})),m(C=>{if(!C[N])return C;const I={...C};return delete I[N],I}),x(null)},[]),k=S.useCallback(()=>{const N=uB(d),O=dB(),C={...N,...O};return m(C),Object.keys(N).length?{ok:!1,section:1}:Object.keys(O).length?{ok:!1,section:2}:{ok:!0,section:0}},[d]),j=N=>{if(N===1){const O=uB(d);if(m(C=>({...C,...O})),Object.keys(O).length)return;u(C=>new Set([...C,1])),l(2);return}if(N===2){const O=dB();if(m(C=>({...C,...O})),Object.keys(O).length)return;u(C=>new Set([...C,2])),l(3);return}N===3&&_()},_=async()=>{const N=k();if(!N.ok){l(N.section);return}p(!0),x(null);const O={firstName:d.firstName.trim(),lastName:d.lastName.trim(),email:d.email.trim(),phone:d.phone.trim()||void 0,organization:d.organization.trim()||void 0,designation:d.designation.trim()||void 0,notes:d.notes.trim()||void 0},C=o&&r?await ai.update(r,O):await ai.create(e,O);if(p(!1),C.error){x(C.error),/email|duplicate|exists/i.test(C.error)&&m(I=>({...I,email:C.error||"This email may already be registered for this event."}));return}n==null||n(),t()},T=N=>l(O=>O===N?0:N),A=!h,P=({compact:N})=>i.jsx("button",{type:"button",disabled:!A,onClick:_,style:{padding:N?"6px 16px":"7px 18px",borderRadius:"var(--radius-button)",background:A?"var(--primary)":"var(--secondary)",color:A?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:A?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:h?"Saving…":o?"Save changes":"Save participant"});return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"14px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 3px"},children:"Participants"}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:o?"Edit participant":"Add participant"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"5px 0 0"},children:["Complete each section to continue. Use ",i.jsx("strong",{children:"Next"})," or ",i.jsx("strong",{children:"Save"})," (top or bottom) to submit."]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:t,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:14})}),i.jsx(P,{compact:!0})]})]}),b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",marginBottom:"8px",fontFamily:"var(--font-noto-sans)"},children:b}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c.size," of ",a," sections passed"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[Math.round(c.size/a*100),"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${Math.round(c.size/a*100)}%`,background:"var(--primary)",borderRadius:"99px",transition:"width 0.35s ease"}})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i.jsx(sE,{n:1,title:"Personal information",subtitle:"Name and contact details",open:s===1,completed:c.has(1),onToggle:()=>T(1),onNext:()=>j(1),nextLabel:"Next: Professional details",children:i.jsxs(cB,{cols:2,children:[i.jsxs(Bp,{children:[i.jsx(Dp,{text:"First name",required:!0}),i.jsx("input",{style:Mp,placeholder:"John",value:d.firstName,onChange:N=>w("firstName",N.target.value)}),i.jsx(v1,{msg:v.firstName})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Last name",required:!0}),i.jsx("input",{style:Mp,placeholder:"Smith",value:d.lastName,onChange:N=>w("lastName",N.target.value)}),i.jsx(v1,{msg:v.lastName})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Email",required:!0}),i.jsx("input",{type:"email",style:Mp,placeholder:"john@example.com",value:d.email,onChange:N=>w("email",N.target.value)}),i.jsx(v1,{msg:v.email})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Phone"}),i.jsx("input",{type:"tel",style:Mp,placeholder:"+91 9800000000",value:d.phone,onChange:N=>w("phone",N.target.value)}),i.jsx(v1,{msg:v.phone})]})]})}),i.jsx(sE,{n:2,title:"Professional details",subtitle:"Organization and designation",open:s===2,completed:c.has(2),onToggle:()=>T(2),onNext:()=>j(2),nextLabel:"Next: Additional info",children:i.jsxs(cB,{cols:2,children:[i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Organization"}),i.jsx("input",{style:Mp,placeholder:"Company or institution",value:d.organization,onChange:N=>w("organization",N.target.value)})]}),i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Designation"}),i.jsx("input",{style:Mp,placeholder:"e.g. Delegate, Speaker",value:d.designation,onChange:N=>w("designation",N.target.value)})]})]})}),i.jsx(sE,{n:3,title:"Additional info",subtitle:"Internal notes (optional)",open:s===3,completed:c.has(3),onToggle:()=>T(3),onNext:()=>j(3),nextLabel:"Save participant",nextDisabled:h,children:i.jsxs(Bp,{children:[i.jsx(Dp,{text:"Notes"}),i.jsx("textarea",{style:{...Mp,resize:"vertical",minHeight:"80px"},placeholder:"Internal notes (optional)",value:d.notes,onChange:N=>w("notes",N.target.value)})]})})]}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"10px",flexShrink:0,background:"var(--card)"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx(P,{})]})]})]})}const NG=["Status","Tag","Event"],Xje=["is","is not"],RG=[{label:"Pending",value:"pending"},{label:"Confirmed",value:"confirmed"},{label:"Checked In",value:"checked_in"},{label:"Cancelled",value:"cancelled"}],fB=()=>({listName:"",description:"",rules:[{id:`r-${Math.random().toString(36).slice(2)}`,field:"Status",operator:"is",value:"pending"}],conjunction:"AND",visibility:"Private",autoUpdate:"Yes"});function LG(e){return`rule-${e}-${Math.random().toString(36).slice(2,10)}`}function Zje(e,t){const r=String(e.field??"Status"),n=NG.includes(r)?r:"Status",a=String(e.operator??"is").trim().toLowerCase()==="is not"?"is not":"is";let s=String(e.value??"");return n==="Status"&&(RG.some(c=>c.value===s)||(s="pending")),{id:LG(t),field:n,operator:a,value:s}}function lE(e){const t=e.rules,r=Array.isArray(t==null?void 0:t.rules)?t.rules:[],n=r.length?r.map((o,a)=>Zje(o,a)):[{id:LG(0),field:"Status",operator:"is",value:"pending"}];return{listName:e.name,description:e.description??"",rules:n,conjunction:(t==null?void 0:t.conjunction)==="OR"?"OR":"AND",visibility:e.visibility==="shared"?"Shared":"Private",autoUpdate:e.autoUpdate!==!1?"Yes":"No"}}function YP({onClose:e,onCreated:t,onSaved:r,editList:n=null}){const{user:o}=Mr(),a=Nn(o),s=3,l=wc(s),c=(n==null?void 0:n.type)==="rule_based",[u,d]=S.useState(()=>c&&n?lE(n):fB()),f=(R,F)=>d(M=>({...M,[R]:F})),[h,p]=S.useState([]),[v,m]=S.useState([]),[b,x]=S.useState(!0),[w,k]=S.useState(!1),[j,_]=S.useState(null);S.useEffect(()=>{let R=!1;if(!a){x(!1);return}return x(!0),Promise.all([ai.listDistinctTags({organization:a}),Lr.list({limit:400,organization:a})]).then(([F,M])=>{var Y,X;R||((Y=F.data)!=null&&Y.tags&&p(F.data.tags),(X=M.data)!=null&&X.events&&m(M.data.events),x(!1))}).catch(()=>{R||x(!1)}),()=>{R=!0}},[a]),S.useEffect(()=>{if(!n||n.type!=="rule_based"){d(fB());return}d(lE(n));let R=!1;return qa.get(n._id).then(F=>{if(R||F.error||!F.data)return;const M=F.data;M.type==="rule_based"&&d(lE(M))}),()=>{R=!0}},[n==null?void 0:n._id]),S.useEffect(()=>{h.length&&d(R=>({...R,rules:R.rules.map(F=>F.field!=="Tag"||F.value&&h.includes(F.value)?F:{...F,value:h[0]})}))},[h]),S.useEffect(()=>{v.length&&d(R=>({...R,rules:R.rules.map(F=>F.field!=="Event"||F.value&&v.some(M=>M._id===F.value)?F:{...F,value:v[0]._id})}))},[v]);const T=()=>d(R=>({...R,rules:[...R.rules,{id:Math.random().toString(36).slice(2),field:"Status",operator:"is",value:"pending"}]})),A=R=>d(F=>({...F,rules:F.rules.filter(M=>M.id!==R)})),P=(R,F,M)=>d(Y=>({...Y,rules:Y.rules.map(X=>X.id===R?{...X,[F]:M}:X)})),N=(R,F)=>{let M="";F==="Status"?M="pending":F==="Tag"&&h[0]?M=h[0]:F==="Event"&&v[0]&&(M=v[0]._id),d(Y=>({...Y,rules:Y.rules.map(X=>X.id===R?{...X,field:F,operator:"is",value:M}:X)}))},O=R=>{if(R.field==="Status")return i.jsx("select",{style:Tr,value:R.value||"pending",onChange:F=>P(R.id,"value",F.target.value),onFocus:St,onBlur:jt,children:RG.map(F=>i.jsx("option",{value:F.value,children:F.label},F.value))});if(R.field==="Tag"){if(b)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading tags…"});if(h.length===0)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No tags yet. Add tags to participants first."});const F=R.value&&h.includes(R.value)?R.value:h[0];return i.jsx("select",{style:Tr,value:F,onChange:M=>P(R.id,"value",M.target.value),onFocus:St,onBlur:jt,children:h.map(M=>i.jsx("option",{value:M,children:M},M))})}if(R.field==="Event"){if(b)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading events…"});if(v.length===0)return i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No events available."});const F=R.value&&v.some(M=>M._id===R.value)?R.value:v[0]._id;return i.jsx("select",{style:Tr,value:F,onChange:M=>P(R.id,"value",M.target.value),onFocus:St,onBlur:jt,children:v.map(M=>i.jsx("option",{value:M._id,children:M.name},M._id))})}return null},C=async()=>{if(_(null),!u.listName.trim()){_("List name is required.");return}if(u.rules.some(F=>F.field==="Tag"&&!h.length||F.field==="Event"&&!v.length)){_("Each rule needs a valid value. Add tags or events, or adjust rules.");return}k(!0);try{const F={rules:u.rules.map(({field:M,operator:Y,value:X})=>({field:M,operator:Y,value:X})),conjunction:u.conjunction};if(c&&n){const M=await qa.update(n._id,{name:u.listName.trim(),description:u.description.trim(),visibility:u.visibility==="Shared"?"shared":"private",type:"rule_based",autoUpdate:u.autoUpdate==="Yes",rules:F});if(M.error){_(M.error||"Could not update list."),k(!1);return}M.data&&(r==null||r(M.data)),e()}else{const M=await qa.create({name:u.listName.trim(),description:u.description.trim(),visibility:u.visibility==="Shared"?"shared":"private",type:"rule_based",autoUpdate:u.autoUpdate==="Yes",rules:F});if(M.error){_(M.error||"Could not create list."),k(!1);return}t==null||t(),e()}}catch{_(c?"Could not update list.":"Could not create list.")}k(!1)},I=c?"Save changes":"Create List";return i.jsxs(ra,{onClose:e,title:c?"Edit Custom List":"Create Custom List",breadcrumb:"Participants · Custom Lists",description:c?"Update name, rules, and settings for this list. Fields marked * are required.":"Build a smart filtered list from your participant database. Fields marked * are required.",completedCount:l.done.size,totalSections:s,ctaLabel:w?"Saving…":I,ctaDisabled:w,onCtaClick:C,children:[j&&i.jsx("p",{style:{margin:"0 20px 12px",fontSize:"var(--text-sm)",color:"var(--destructive)",fontFamily:"var(--font-noto-sans)"},children:j}),i.jsxs(Ur,{n:1,title:"List Details",subtitle:"Name and describe your custom list",open:l.open===1,completed:l.done.has(1),onToggle:()=>l.toggle(1),onSave:()=>l.advance(1),nextLabel:"Filter Rules",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"List Name",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. VIP Delegates — NAPCON 2026",value:u.listName,onChange:R=>f("listName",R.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"Briefly describe who this list is for…",value:u.description,onChange:R=>f("description",R.target.value),onFocus:St,onBlur:jt})]})]}),i.jsxs(Ur,{n:2,title:"Filter Rules",subtitle:"Define conditions to automatically populate this list",open:l.open===2,completed:l.done.has(2),onToggle:()=>l.toggle(2),onSave:()=>l.advance(2),nextLabel:"Settings",children:[u.rules.length>1&&i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",marginBottom:"4px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Match"}),["AND","OR"].map(R=>i.jsx("button",{type:"button",onClick:()=>f("conjunction",R),style:{padding:"4px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${u.conjunction===R?"var(--primary)":"var(--border)"}`,background:u.conjunction===R?"var(--accent)":"transparent",color:u.conjunction===R?"var(--primary)":"var(--muted)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:R},R)),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"of the following rules"})]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:u.rules.map((R,F)=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr auto",gap:"8px",alignItems:"center",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:[F>0&&i.jsx("span",{style:{gridColumn:"1/-1",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:u.conjunction}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Tr,value:R.field,onChange:M=>N(R.id,M.target.value),onFocus:St,onBlur:jt,children:NG.map(M=>i.jsx("option",{value:M,children:M},M))})}),i.jsx("div",{style:{position:"relative"},children:i.jsx("select",{style:Tr,value:R.operator,onChange:M=>P(R.id,"operator",M.target.value),onFocus:St,onBlur:jt,children:Xje.map(M=>i.jsx("option",{value:M,children:M},M))})}),i.jsx("div",{style:{position:"relative",minWidth:0},children:O(R)}),i.jsx("button",{type:"button",onClick:()=>A(R.id),disabled:u.rules.length===1,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:u.rules.length===1?"var(--muted-foreground)":"var(--destructive)",cursor:u.rules.length===1?"not-allowed":"pointer"},children:i.jsx(Xr,{size:13})})]},R.id))}),i.jsxs("button",{type:"button",onClick:T,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add Rule"]}),i.jsx(Vt,{text:"Status, Tag, and Event use lists from your organization. Tag options come from participant tags; Event from your events."})]}),i.jsx(Ur,{n:3,title:"Settings",subtitle:"Configure visibility and update behaviour",open:l.open===3,completed:l.done.has(3),onToggle:()=>l.toggle(3),onSave:()=>void C(),nextLabel:I,nextDisabled:w,children:i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Visibility",required:!0}),i.jsx(Hi,{name:"clVisibility",value:u.visibility,onChange:R=>f("visibility",R),options:[{label:"Private",value:"Private"},{label:"Shared",value:"Shared"}]}),i.jsx(Vt,{text:"Shared lists are visible to all admins."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Auto Update",required:!0}),i.jsx(Hi,{name:"clAutoUpdate",value:u.autoUpdate,onChange:R=>f("autoUpdate",R),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx(Vt,{text:"Recompute rule-based members when you open the list."})]})]})})]})}function Jje(e){return`eventbuzz:participant:${String(e||"").trim()}`}function e5e(e,t){return new Promise((r,n)=>{const o=new Image;o.onload=()=>{const a=o.naturalWidth,s=o.naturalHeight,l=28,c=20,u=14,d=22,f=11,h=document.createElement("canvas"),p=h.getContext("2d");if(!p){n(new Error("Canvas not supported"));return}p.font=`600 ${f}px ui-monospace, monospace`;const v=t.length>36?[t.slice(0,36),t.slice(36,72)]:[t],m=f+4,b=v.length*m+6,x=Math.max(...v.map(j=>p.measureText(j).width)),w=Math.ceil(Math.max(a+l*2,x+l*2)),k=c+s+u+b+d;h.width=w,h.height=k,p.fillStyle="#ffffff",p.fillRect(0,0,w,k),p.drawImage(o,(w-a)/2,c),p.fillStyle="#0f172a",p.font=`600 ${f}px ui-monospace, monospace`,p.textAlign="center",v.forEach((j,_)=>{p.fillText(j,w/2,c+s+u+_*m)});try{r(h.toDataURL("image/png"))}catch(j){n(j)}},o.onerror=()=>n(new Error("Failed to load QR image")),o.src=e})}function t5e({open:e,onClose:t,participantId:r,participantName:n}){const o=r?Jje(r):"",[a,s]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(!1);S.useEffect(()=>{if(!e){s(null),c(null),d(!1);return}if(!o){s(null),c(null);return}let m=!1;return c(null),_v.toDataURL(o,{width:256,margin:2,errorCorrectionLevel:"M",color:{dark:"#0f172a",light:"#ffffff"}}).then(b=>{m||s(b)}).catch(()=>{m||c("Could not generate QR code.")}),()=>{m=!0}},[e,o]);const p=()=>{o&&navigator.clipboard.writeText(o).then(()=>{d(!0),window.setTimeout(()=>d(!1),2e3)})},v=async()=>{if(!a||f)return;h(!0);const m=n.replace(/[^\w\-]+/g,"_").slice(0,40)||"participant";try{const b=await e5e(a,o),x=document.createElement("a");x.href=b,x.download=`checkin-qr-${m}.png`,x.click()}catch{const b=document.createElement("a");b.href=a,b.download=`checkin-qr-${m}.png`,b.click()}finally{h(!1)}};return e?i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"participant-qr-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},onClick:t,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"400px",padding:"20px",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border)"},onClick:m=>m.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"16px"},children:[i.jsxs("div",{children:[i.jsx("h2",{id:"participant-qr-title",style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:"Check-in QR code"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:1.4},children:n}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"8px",lineHeight:1.45},children:["Scan with the ",i.jsx("strong",{children:"EventBuzz Checkins"})," app during an attendance session."]})]}),i.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",color:"var(--card-foreground)",flexShrink:0},children:i.jsx(Gt,{size:16})})]}),i.jsxs("div",{style:{marginBottom:"12px"},children:[i.jsx("p",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"QR payload"}),i.jsx("input",{readOnly:!0,value:o,onFocus:m=>m.target.select(),style:{width:"100%",padding:"8px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",fontSize:"11px",fontFamily:"ui-monospace, monospace",color:"var(--foreground)"}})]}),i.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"200px",background:"var(--secondary)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",marginBottom:"16px"},children:l?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",padding:"16px"},children:l}):a?i.jsx("img",{src:a,alt:`Check-in QR for ${n}`,style:{width:200,height:200,display:"block"}}):i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Generating…"})}),i.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:p,disabled:!o,style:{flex:1,minWidth:"120px",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:o?"pointer":"not-allowed"},children:[i.jsx(Js,{size:14}),u?"Copied":"Copy payload"]}),i.jsxs("button",{type:"button",onClick:()=>void v(),disabled:!a||f,style:{flex:1,minWidth:"120px",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:a&&!f?"pointer":"not-allowed",opacity:a&&!f?1:.6},children:[i.jsx(ja,{size:14}),f?"Saving…":"Download PNG"]})]})]})}):null}function GP(e){const r={VIP:{bg:"#fef3c7",color:"#92400e"},Speaker:{bg:"var(--accent)",color:"var(--accent-foreground)"},Sponsor:{bg:"#dcfce7",color:"#15803d"},Press:{bg:"#f3e8ff",color:"#6b21a8"},Virtual:{bg:"#e0f2fe",color:"#075985"},Workshop:{bg:"#ffedd5",color:"#c2410c"}}[e];if(r)return r;let n=0;for(let a=0;a<e.length;a++)n=e.charCodeAt(a)+((n<<5)-n);const o=Math.abs(n)%360;return{bg:`hsl(${o}, 42%, 93%)`,color:`hsl(${o}, 55%, 30%)`}}function r5e(e){return e.split(/[,;\n]+/).map(t=>t.trim()).filter(Boolean)}function FG(e,t=[]){const[r,n]=S.useState([]),[o,a]=S.useState(!1),s=S.useRef(null);return S.useEffect(()=>{a(!1)},t),S.useEffect(()=>{r.length===0&&a(!1)},[r.length]),S.useEffect(()=>{const d=s.current;if(!d||e.length===0)return;const f=e.filter(h=>r.includes(h)).length;d.indeterminate=f>0&&f<e.length,d.checked=f===e.length&&e.length>0},[e,r]),{selectedIds:r,setSelectedIds:n,selectAllMatchingActive:o,setSelectAllMatchingActive:a,headerSelectRef:s,toggleRow:d=>{a(!1),n(f=>f.includes(d)?f.filter(h=>h!==d):[...f,d])},toggleAllVisible:()=>{a(!1),n(d=>{const f=new Set(d);return e.length>0&&e.every(p=>f.has(p))?e.forEach(p=>f.delete(p)):e.forEach(p=>f.add(p)),[...f]})},clearSelection:()=>{a(!1),n([])}}}function zG(e){const{selectedIds:t,listOrgId:r,eventId:n,onMessage:o,onClearSelection:a,onRefresh:s}=e,[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState([]),[k,j]=S.useState(()=>new Set),[_,T]=S.useState([]),[A,P]=S.useState("");return{bulkDialog:l,setBulkDialog:c,bulkBusy:u,tagBulkInput:f,setTagBulkInput:h,newListName:p,setNewListName:v,newListDesc:m,setNewListDesc:b,eventsPick:x,eventPickIds:k,toggleEventPick:X=>{j($=>{const ee=new Set($);return ee.has(X)?ee.delete(X):ee.add(X),ee})},fixedLists:_,addToListId:A,setAddToListId:P,openBulkDialog:async X=>{var $,ee;if(h(""),v(""),b(""),P(""),j(new Set),X==="assignEvents"){if(!r){o("Organisation required to load events.");return}const V=await Lr.list({limit:400,organization:r});($=V.data)!=null&&$.events&&w(V.data.events)}if(X==="addToList"){if(!r){o("Organisation required to load lists.");return}const D=(((ee=(await qa.list({organization:r})).data)==null?void 0:ee.lists)??[]).filter(z=>z.type==="fixed");T(D),D[0]&&P(D[0]._id)}c(X)},runBulkTags:async X=>{var V;const $=r5e(f);if(!$.length)return;d(!0);const ee=await ai.bulk({action:X,participantIds:t,tags:$});d(!1),ee.error?o(ee.error):(o(`${X==="add_tags"?"Added":"Removed"} tags for ${((V=ee.data)==null?void 0:V.updated)??0} participant(s).`),c(null),a(),s())},runBulkAssignEvents:async()=>{var ee;const X=[...k];if(!X.length)return;d(!0);const $=await ai.bulk({action:"assign_events",participantIds:t,eventIds:X});d(!1),$.error?o($.error):(o(`Assigned ${t.length} people to event(s). ${((ee=$.data)==null?void 0:ee.membershipsAdded)??0} new membership(s).`),c(null),a(),s())},runBulkNewList:async()=>{const X=p.trim();if(!X)return;d(!0);const $=await qa.create({name:X,description:m.trim(),type:"fixed",visibility:"private",autoUpdate:!1,participantIds:t});d(!1),$.error?o($.error):(o(`Custom list "${X}" created with ${t.length} member(s).`),c(null),a(),s())},runBulkAddToList:async()=>{var $;if(!A)return;d(!0);const X=await ai.bulk({action:"add_to_fixed_list",participantIds:t,listId:A});d(!1),X.error?o(X.error):(o(`Added ${(($=X.data)==null?void 0:$.updated)??0} people to the list.`),c(null),a(),s())},runBulkDelete:async()=>{var $;d(!0);const X=await ai.bulk({action:"delete",participantIds:t});d(!1),X.error?o(X.error):(o(`Deleted ${(($=X.data)==null?void 0:$.deleted)??0} participant(s).`),a(),s())},runBulkRemoveFromEvent:async()=>{var $;if(!n)return;d(!0);const X=await ai.bulk({action:"remove_from_event",participantIds:t,eventId:n});d(!1),X.error?o(X.error):(o(`Removed ${(($=X.data)==null?void 0:$.removed)??0} participant(s) from this event.`),a(),s())}}}function n5e({onOpenLists:e,onCreateList:t,isMobile:r=!1}){return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:e,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Custom lists"}),i.jsxs("button",{type:"button",onClick:t,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," ",r?"New list":"Create Custom List"]})]})}function MG({tagOptions:e,activeTag:t,onChange:r}){return e.length===0?null:i.jsx("div",{style:{display:"flex",gap:"5px",flexWrap:"wrap",alignItems:"center"},children:e.map(n=>{const o=t===n,a=GP(n);return i.jsx("button",{type:"button",onClick:()=>r(o?null:n),style:{padding:"3px 10px",borderRadius:"999px",border:`1px solid ${o?a.color:"var(--border)"}`,background:o?a.bg:"var(--card)",color:o?a.color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",cursor:"pointer"},children:n},n)})})}function DG({total:e,loading:t,busy:r,checked:n,onChange:o}){return t||e<=0?null:i.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:"8px",flexShrink:0,cursor:r?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",userSelect:"none"},children:[i.jsx("input",{type:"checkbox",checked:n,disabled:r,onChange:a=>o(a.target.checked),style:{width:"16px",height:"16px",cursor:r?"wait":"pointer",accentColor:"var(--primary)"}}),i.jsxs("span",{children:["Select all matching filters (",e,")"]})]})}function BG({selectedCount:e,busy:t,variant:r,onAddTags:n,onRemoveTags:o,onAssignEvents:a,onNewList:s,onAddToList:l,onDeleteSelected:c,onRemoveFromEvent:u,onClearSelection:d}){if(e<=0)return null;const f={padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:t?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"};return i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",padding:"12px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:[e," selected"]}),i.jsx("button",{type:"button",disabled:t,onClick:n,style:f,children:"Add tags"}),i.jsx("button",{type:"button",disabled:t,onClick:o,style:f,children:"Remove tags"}),r==="portfolio"&&a?i.jsx("button",{type:"button",disabled:t,onClick:a,style:f,children:"Assign to event(s)"}):null,i.jsx("button",{type:"button",disabled:t,onClick:s,style:f,children:"New custom list"}),i.jsx("button",{type:"button",disabled:t,onClick:l,style:f,children:"Add to list"}),r==="portfolio"&&c?i.jsx("button",{type:"button",disabled:t,onClick:c,style:{...f,border:"1px solid var(--destructive)",background:"transparent",color:"var(--destructive)"},children:"Delete selected"}):null,r==="event"&&u?i.jsx("button",{type:"button",disabled:t,onClick:u,style:{...f,border:"1px solid var(--destructive)",background:"transparent",color:"var(--destructive)"},children:"Remove from event"}):null,i.jsx("button",{type:"button",onClick:d,style:{marginLeft:"auto",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"none",background:"transparent",color:"var(--muted)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:"Clear selection"})]})}function WG({bulkDialog:e,bulkBusy:t,selectedCount:r,tagBulkInput:n,onTagBulkInputChange:o,newListName:a,onNewListNameChange:s,newListDesc:l,onNewListDescChange:c,eventsPick:u,eventPickIds:d,onToggleEventPick:f,fixedLists:h,addToListId:p,onAddToListIdChange:v,onClose:m,onApplyTags:b,onAssignEvents:x,onCreateList:w,onAddToList:k}){const j=T=>i.jsx("div",{role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:205,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>!t&&m(),children:i.jsx("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:"20px",width:"min(440px, 92vw)",maxHeight:"80vh",overflow:"auto",boxShadow:"var(--shadow-xl)"},onClick:A=>A.stopPropagation(),children:T})}),_=T=>i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"14px"},children:[i.jsx("button",{type:"button",disabled:t,onClick:m,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Cancel"}),T]});return e==="addTags"||e==="removeTags"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:e==="addTags"?"Add tags":"Remove tags"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:["Apply to ",r," selected (comma-separated)."]}),i.jsx("input",{value:n,onChange:T=>o(T.target.value),placeholder:"e.g. VIP, Sponsor",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)",boxSizing:"border-box"}}),_(i.jsx("button",{type:"button",disabled:t,onClick:()=>b(e==="addTags"?"add_tags":"remove_tags"),style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Apply"}))]})):e==="assignEvents"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:"Assign to event(s)"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:[r," people · adds pending membership where missing."]}),i.jsx("div",{style:{maxHeight:"240px",overflowY:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"8px"},children:u.map(T=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 4px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("input",{type:"checkbox",checked:d.has(T._id),onChange:()=>f(T._id)}),T.name]},T._id))}),_(i.jsx("button",{type:"button",disabled:t||d.size===0,onClick:x,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Assign"}))]})):e==="newList"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:"New custom list"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:["Fixed list with ",r," selected people."]}),i.jsx("input",{value:a,onChange:T=>s(T.target.value),placeholder:"List name",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",marginBottom:"8px",boxSizing:"border-box",fontSize:"var(--text-sm)"}}),i.jsx("textarea",{value:l,onChange:T=>c(T.target.value),placeholder:"Description (optional)",rows:3,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",boxSizing:"border-box",fontSize:"var(--text-sm)",resize:"vertical"}}),_(i.jsx("button",{type:"button",disabled:t||!a.trim(),onClick:w,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Create"}))]})):e==="addToList"?j(i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",margin:"0 0 8px"},children:"Add to existing list"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px",fontFamily:"var(--font-noto-sans)"},children:["Append ",r," people to a fixed list."]}),h.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No fixed lists yet. Create one first."}):i.jsx("select",{value:p,onChange:T=>v(T.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"},children:h.map(T=>i.jsx("option",{value:T._id,children:T.name},T._id))}),_(i.jsx("button",{type:"button",disabled:t||h.length===0||!p,onClick:k,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Add"}))]})):null}function i5e(e){var o;const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||"—",r=e.registrationDate?new Date(e.registrationDate).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}):null,n={pending:"Pending",confirmed:"Confirmed",checked_in:"Checked In",cancelled:"Cancelled"}[e.status]??e.status;return{id:e._id,name:t,email:e.email??"",phone:e.phone??"",role:((o=e.designation)==null?void 0:o.trim())||"—",status:n,checkedIn:e.status==="checked_in"||!!e.checkedIn,registrationDate:r,tags:e.tags??[]}}const pB=[20,50,100];function hB(e,t){if(t<=5)return Array.from({length:t},(a,s)=>s+1);const r=Math.max(1,e-2),n=Math.min(t,e+2),o=[];r>1&&(o.push(1),r>2&&o.push("ellipsis"));for(let a=r;a<=n;a++)o.push(a);return n<t&&(n<t-1&&o.push("ellipsis"),o.push(t)),o}const gB=[{bg:"#dbeafe",color:"#1d4ed8"},{bg:"#ede9fe",color:"#5b21b6"},{bg:"#dcfce7",color:"#15803d"},{bg:"#ffedd5",color:"#c2410c"},{bg:"#fce7f3",color:"#be185d"},{bg:"#ccfbf1",color:"#0d9488"},{bg:"#fef9c3",color:"#a16207"}];function qG(e){const t=(e.charCodeAt(0)||0)+(e.charCodeAt(1)||0);return gB[t%gB.length]}function $G(e){var r;const t=e.trim().replace(/^Dr\.\s*/i,"").split(/\s+/);return t.length===1?((r=t[0][0])==null?void 0:r.toUpperCase())??"?":(t[0][0]+t[t.length-1][0]).toUpperCase()}const o5e={bg:"#e5e7eb",color:"#374151"},a5e={Delegate:{bg:"#e0e7ff",color:"#3730a3"},Speaker:{bg:"#ede9fe",color:"#5b21b6"},Moderator:{bg:"#dcfce7",color:"#15803d"},Panelist:{bg:"#ffedd5",color:"#c2410c"}};function UG({name:e,size:t=36}){const r=qG(e);return i.jsx("div",{style:{width:t,height:t,borderRadius:"50%",background:r.bg,color:r.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:t>32?"var(--text-sm)":"11px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:$G(e)})}function KP({role:e}){const t=a5e[e]??o5e;return i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"3px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e})}function HG({checked:e}){return i.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",background:e?"#dcfce7":"#f1f5f9",color:e?"#15803d":"#6b7280",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e?i.jsxs(i.Fragment,{children:[i.jsx(yv,{size:10})," Yes"]}):i.jsxs(i.Fragment,{children:[i.jsx(rS,{size:10})," No"]})})}function QP({status:e}){const t=e==="Cancelled"?"var(--muted)":e==="Checked In"?"#15803d":e==="Confirmed"?"#2563eb":"var(--card-foreground)",r=e==="Cancelled"?"#9ca3af":e==="Checked In"?"#16a34a":e==="Confirmed"?"#2563eb":"#94a3b8";return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:t},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:r,display:"block"}}),e]})}function mB({label:e,value:t,options:r,onChange:n}){return i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[i.jsxs("select",{value:t,onChange:o=>n(o.target.value),style:{appearance:"none",padding:"6px 28px 6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",color:t!=="All"?"var(--foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",outline:"none",height:"34px",borderColor:t!=="All"?"var(--primary)":"var(--border)"},children:[i.jsx("option",{value:"All",children:e}),r.map(o=>i.jsx("option",{value:o,children:o},o))]}),i.jsx(go,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:"var(--muted)"}})]})}function s5e({p:e,onView:t,onEdit:r,onDelete:n,onToggleCheckIn:o,onQr:a,canEdit:s,selectable:l,selected:c,onToggleSelect:u}){const[d,f]=S.useState(!1);return i.jsxs("tr",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{background:d?"var(--secondary)":"transparent",transition:"background 0.12s",cursor:"default",borderBottom:"1px solid var(--border)"},children:[l?i.jsx("td",{style:{padding:"12px 8px 12px 16px",width:"36px"},children:i.jsx("input",{type:"checkbox",checked:!!c,onChange:u,style:{width:"16px",height:"16px",cursor:"pointer"}})}):null,i.jsx("td",{style:{padding:"12px 16px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx(UG,{name:e.name,size:32}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3"},children:e.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"1px"},children:e.email})]})]})}),i.jsx("td",{style:{padding:"12px 12px",whiteSpace:"nowrap"},children:i.jsx(KP,{role:e.role})}),l?i.jsx("td",{style:{padding:"12px 12px"},children:i.jsxs("div",{style:{display:"flex",gap:"3px",flexWrap:"wrap"},children:[e.tags.map(h=>{const p=GP(h);return i.jsx("span",{style:{padding:"1px 6px",borderRadius:"999px",background:p.bg,color:p.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:h},h)}),e.tags.length===0?i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"—"}):null]})}):null,i.jsx("td",{style:{padding:"12px 12px"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.phone})}),i.jsx("td",{style:{padding:"12px 12px"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:e.registrationDate?"var(--card-foreground)":"var(--muted)"},children:e.registrationDate??"—"})}),i.jsx("td",{style:{padding:"12px 12px",whiteSpace:"nowrap"},children:i.jsx(QP,{status:e.status})}),i.jsx("td",{style:{padding:"12px 12px",whiteSpace:"nowrap"},children:i.jsx(HG,{checked:e.checkedIn})}),i.jsx("td",{style:{padding:"12px 16px 12px 8px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsxs("button",{onClick:o,title:e.checkedIn?"Undo check-in":"Mark checked in",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:e.checkedIn?"var(--secondary)":"#dcfce7",border:`1px solid ${e.checkedIn?"var(--border)":"#86efac"}`,color:e.checkedIn?"var(--muted)":"#15803d",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",fontWeight:"var(--font-weight-medium)"},children:[e.checkedIn?i.jsx(Gt,{size:11}):i.jsx(bi,{size:11}),e.checkedIn?"Undo":"Check In"]}),i.jsxs("button",{onClick:a,title:"Check-in QR code (EventBuzz Checkins app)",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Zf,{size:11})," QR"]}),i.jsxs("button",{onClick:t,title:"View profile",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(qh,{size:11})," View"]}),s&&i.jsxs("button",{onClick:r,title:"Edit participant",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.borderColor="var(--primary)",h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.borderColor="var(--border)",h.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(wi,{size:11})," Edit"]}),i.jsxs("button",{onClick:n,title:"Delete participant",style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--destructive)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.background="#fef2f2",h.currentTarget.style.borderColor="var(--destructive)"},onMouseLeave:h=>{h.currentTarget.style.background="var(--card)",h.currentTarget.style.borderColor="var(--border)"},children:[i.jsx(Xr,{size:11})," Delete"]})]})})]})}function l5e({p:e,onView:t,onEdit:r,onDelete:n,onToggleCheckIn:o,onQr:a,canEdit:s,selectable:l,selected:c,onToggleSelect:u}){const[d,f]=S.useState(!1);return i.jsxs("div",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px",display:"flex",flexDirection:"column",gap:"12px",transition:"box-shadow 0.15s, border-color 0.15s",boxShadow:d?"var(--elevation-sm)":"none",borderColor:d?"var(--primary)":"var(--border)",cursor:"default"},children:[l?i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:!!c,onChange:u,style:{width:"16px",height:"16px",cursor:"pointer"}}),"Select"]}):null,i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px"},children:[i.jsx(UG,{name:e.name,size:42}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginTop:"4px"},children:[i.jsx(KP,{role:e.role}),i.jsx(QP,{status:e.status})]})]}),i.jsx("button",{onClick:o,title:e.checkedIn?"Undo check-in":"Mark as checked in",style:{width:"28px",height:"28px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",background:e.checkedIn?"#dcfce7":"var(--secondary)",border:`1px solid ${e.checkedIn?"#86efac":"var(--border)"}`,color:e.checkedIn?"#15803d":"var(--muted)",cursor:"pointer"},children:i.jsx(bi,{size:13})})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"5px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(Xf,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.email})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(aS,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e.phone})]}),e.registrationDate&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(Vi,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:e.registrationDate})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"10px",borderTop:"1px solid var(--border)"},children:[i.jsx(HG,{checked:e.checkedIn}),i.jsxs("div",{style:{display:"flex",gap:"4px"},children:[i.jsx("button",{onClick:a,title:"Check-in QR code",style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:h=>{h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(Zf,{size:12})}),i.jsx("button",{onClick:t,title:"View",style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:h=>{h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(qh,{size:12})}),s&&i.jsx("button",{onClick:r,title:"Edit",style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:h=>{h.currentTarget.style.color="var(--primary)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:12})}),i.jsx("button",{onClick:n,title:"Delete",style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:h=>{h.currentTarget.style.color="var(--destructive)"},onMouseLeave:h=>{h.currentTarget.style.color="var(--muted)"},children:i.jsx(Xr,{size:12})})]})]})]})}function c5e({p:e,onClose:t,onEdit:r,canEdit:n}){const o=qG(e.name);return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:t,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"420px",maxWidth:"94vw",boxShadow:"var(--shadow-xl)",overflow:"hidden"},onClick:a=>a.stopPropagation(),children:[i.jsxs("div",{style:{background:o.bg,padding:"24px 24px 16px",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"14px"},children:[i.jsx("div",{style:{width:"52px",height:"52px",borderRadius:"50%",background:o.color+"20",border:`2px solid ${o.color}40`,display:"flex",alignItems:"center",justifyContent:"center",color:o.color,fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",fontSize:"var(--text-xl)"},children:$G(e.name)}),i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:o.color,lineHeight:"1.3"},children:e.name}),i.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"5px"},children:[i.jsx(KP,{role:e.role}),i.jsx(QP,{status:e.status})]})]})]}),i.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:o.color,padding:"2px",opacity:.6},children:i.jsx(Gt,{size:16})})]}),i.jsx("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",gap:"0"},children:[{icon:i.jsx(Xf,{size:14}),label:"Email",value:e.email},{icon:i.jsx(aS,{size:14}),label:"Phone",value:e.phone},{icon:i.jsx(Vi,{size:14}),label:"Registered",value:e.registrationDate||"—"},{icon:i.jsx(lS,{size:14}),label:"Checked In",value:e.checkedIn?"Yes":"Not yet"}].map((a,s,l)=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"11px 0",borderBottom:s<l.length-1?"1px solid var(--border)":"none"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex",flexShrink:0},children:a.icon}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",width:"80px",flexShrink:0},children:a.label}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",fontWeight:"var(--font-weight-medium)"},children:a.value})]},a.label))}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",padding:"14px 24px",borderTop:"1px solid var(--border)"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Close"}),n&&i.jsxs("button",{type:"button",onClick:r,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(wi,{size:13})," Edit"]})]})]})})}const u5e=["Pending","Confirmed","Checked In","Cancelled"],vB={Pending:"pending",Confirmed:"confirmed","Checked In":"checked_in",Cancelled:"cancelled"},d5e=["Delegate","Speaker","Moderator","Panelist"];function f5e({message:e,onConfirm:t,onCancel:r}){return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:110,display:"flex",alignItems:"center",justifyContent:"center"},onClick:r,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"360px",padding:"20px",boxShadow:"var(--shadow-xl)"},onClick:n=>n.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start",marginBottom:"20px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:"#fee2e2",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(Wh,{size:16,style:{color:"var(--destructive)"}})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"5px"},children:"Confirm Delete"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{onClick:r,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{onClick:t,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--destructive)",color:"#fff",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Delete"})]})]})})}function VG({compactChrome:e=!1}={}){const{selectedEventId:t,setActiveNav:r}=Li(),{user:n}=Mr(),o=Nn(n),s=Si()==="mobile",l=(n==null?void 0:n.role)==="super_admin",c=!e,[u,d]=S.useState([]),[f,h]=S.useState(0),[p,v]=S.useState(1),[m,b]=S.useState(20),[x,w]=S.useState(""),[k,j]=S.useState(""),[_,T]=S.useState("All"),[A,P]=S.useState("All"),[N,O]=S.useState(null),[C,I]=S.useState([]),[R,F]=S.useState(0),[M,Y]=S.useState(!1),[X,$]=S.useState(s?"card":"list"),[ee,V]=S.useState(!1),[D,z]=S.useState(!1),[q,G]=S.useState(!1),[U,Q]=S.useState(null),{selectedIds:K,setSelectedIds:re,selectAllMatchingActive:H,setSelectAllMatchingActive:ie,headerSelectRef:de,toggleRow:le,toggleAllVisible:ke,clearSelection:ve}=FG(c?u.map(xe=>xe.id):[],c?[k,N,_,A]:[]),se=S.useCallback(()=>F(xe=>xe+1),[]),be=zG({selectedIds:c?K:[],listOrgId:o,eventId:t??void 0,onMessage:xe=>Q(xe),onClearSelection:ve,onRefresh:se}),[De,ae]=S.useState(null),[ue,Me]=S.useState(null),[Se,Pe]=S.useState(!1),[Ee,Ae]=S.useState(null),[Ye,rt]=S.useState(null),[He,xt]=S.useState(!1),[st,Te]=S.useState(!1),et=S.useRef(null),[Pt,qe]=S.useState(null),[Et,vt]=S.useState(null),Ft=S.useCallback(()=>{t&&(Y(!0),ai.list(t,{page:p,limit:m,q:k||void 0,status:_!=="All"?vB[_]??_:void 0,designation:A!=="All"?A:void 0,tag:N??void 0}).then(xe=>{var Re;Y(!1),(Re=xe.data)!=null&&Re.participants&&(d(xe.data.participants.map(i5e)),h(xe.data.total??0))}).catch(()=>Y(!1)))},[t,p,m,k,_,A,N,R]);S.useEffect(()=>{Ft()},[Ft]),S.useEffect(()=>{if(!t||!c){I([]);return}ai.listDistinctTagsForEvent(t).then(xe=>{var Re;(Re=xe.data)!=null&&Re.tags&&I(xe.data.tags)})},[t,R,c]);const Ce=S.useRef();S.useEffect(()=>(Ce.current=setTimeout(()=>j(x.trim()),300),()=>{Ce.current&&clearTimeout(Ce.current)}),[x]),S.useEffect(()=>{v(1)},[k,_,A,N,m]);const lt=async()=>{var ze,Le;if(!t)return;const xe=await ai.matchingIdsForEvent(t,{q:k||void 0,tag:N??void 0,status:_!=="All"?vB[_]??_:void 0,designation:A!=="All"?A:void 0});if(xe.error){Q(xe.error),ie(!1);return}const Re=((ze=xe.data)==null?void 0:ze.ids)??[];(Le=xe.data)!=null&&Le.capped&&Q(`Note: only the first ${Re.length} matching people are selected (limit). Refine filters if needed.`),re(Re),ie(Re.length>0)},Xe=Math.max(1,Math.ceil(f/m)),Be=u.filter(xe=>xe.checkedIn).length,ct=u.filter(xe=>["Speaker","Moderator","Panelist"].includes(xe.role)).length,Tt=xe=>{const Re=u.find(ze=>ze.id===xe);rt({msg:`Remove "${Re==null?void 0:Re.name}" from this event?`,onConfirm:()=>{t&&ai.remove(xe,t).then(()=>{Ft(),rt(null)})}})},We=xe=>{t&&ai.checkIn(xe,t).then(()=>Ft())},ce=async()=>{if(!t||He)return;xt(!0);const xe=await ai.downloadExport(t);xt(!1),!xe.ok&&"error"in xe?vt(xe.error||"Export failed"):vt(null)},he=async xe=>{var ze;const Re=(ze=xe.target.files)==null?void 0:ze[0];if(!(!Re||!t)){Te(!0);try{const Le=await Re.text(),Qe=await ai.importCsv(t,Le);Qe.data?(qe(Qe.data),Ft()):vt(Qe.error||"Import failed")}catch{vt("Could not read file.")}Te(!1),xe.target.value=""}},je=_!=="All"||A!=="All"||!!N;return t?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[U&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{children:U}),i.jsx("button",{type:"button",onClick:()=>Q(null),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:16})})]}),Et&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 14px",borderRadius:"var(--radius-button)",background:"#fef2f2",border:"1px solid #fecaca",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{children:Et}),i.jsx("button",{type:"button",onClick:()=>vt(null),style:{background:"none",border:"none",cursor:"pointer",color:"inherit",padding:"4px"},children:i.jsx(Gt,{size:16})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[e?i.jsxs("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[f," registered · ",Be," checked in on this page"]}):i.jsxs("div",{children:[i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2",marginBottom:"4px"},children:"Participants"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[f," registered · ",Be," checked in on this page"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx("input",{ref:et,type:"file",accept:".csv,text/csv",style:{display:"none"},onChange:he}),i.jsxs("button",{type:"button",disabled:He,onClick:ce,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:He?"wait":"pointer",opacity:He?.8:1},onMouseEnter:xe=>{He||(xe.currentTarget.style.borderColor="var(--primary)",xe.currentTarget.style.color="var(--primary)")},onMouseLeave:xe=>{xe.currentTarget.style.borderColor="var(--border)",xe.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(ja,{size:14})," ",He?"Exporting…":s?"Export":"Export CSV"]}),l&&i.jsxs("button",{type:"button",disabled:st,onClick:()=>{var xe;return(xe=et.current)==null?void 0:xe.click()},style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:st?"wait":"pointer"},onMouseEnter:xe=>{st||(xe.currentTarget.style.borderColor="var(--primary)",xe.currentTarget.style.color="var(--primary)")},onMouseLeave:xe=>{xe.currentTarget.style.borderColor="var(--border)",xe.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(Fl,{size:14})," ",st?"Importing…":s?"Import":"Import CSV"]}),l&&i.jsxs("button",{type:"button",onClick:()=>{Ae(null),Pe(!0)},style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," ",s?"Add":"Add Participant"]}),c?i.jsx(n5e,{isMobile:s,onOpenLists:()=>r("participant-lists"),onCreateList:()=>G(!0)}):null]})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:s?"repeat(2, 1fr)":"repeat(4, 1fr)",gap:s?"10px":"12px"},children:[{icon:i.jsx(Ri,{size:14}),label:"Total Registered",value:f,accent:"var(--chart-1)"},{icon:i.jsx(lS,{size:14}),label:"Checked In (this page)",value:Be,accent:"var(--chart-2)",sub:u.length?`${Math.round(Be/u.length*100)}%`:""},{icon:i.jsx(wne,{size:14}),label:"Not Checked In (this page)",value:u.length-Be,accent:"var(--chart-3)"},{icon:i.jsx(Om,{size:14}),label:"Speakers & Staff (this page)",value:ct,accent:"var(--chart-4)"}].map(xe=>i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"14px 16px",display:"flex",alignItems:"center",gap:"12px",borderLeft:`3px solid ${xe.accent}`},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",background:xe.accent+"15",display:"flex",alignItems:"center",justifyContent:"center",color:xe.accent,flexShrink:0},children:xe.icon}),i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.1"},children:xe.value}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:xe.label}),xe.sub&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"#16a34a",marginTop:"3px"},children:xe.sub})]})]},xe.label))}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"36px",flex:1,background:"var(--card)",border:`1px solid ${ee?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",transition:"border-color 0.15s"},children:[i.jsx(pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:x,onChange:xe=>w(xe.target.value),placeholder:s?"Search…":"Search by name, email or phone…",onFocus:()=>V(!0),onBlur:()=>V(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),x&&i.jsx("button",{onClick:()=>w(""),type:"button",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:0,display:"flex"},children:i.jsx(Gt,{size:12})})]}),s&&i.jsxs("button",{onClick:()=>z(xe=>!xe),style:{display:"flex",alignItems:"center",gap:"5px",padding:"0 12px",height:"36px",borderRadius:"var(--radius-button)",border:`1px solid ${je?"var(--primary)":"var(--border)"}`,background:je?"var(--accent)":"var(--card)",color:je?"var(--primary)":"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",flexShrink:0},children:[i.jsx(tre,{size:13})," ",je?"Filtered":"Filter"]}),i.jsx("div",{style:{display:"flex",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--card)",flexShrink:0},children:["list","card"].map(xe=>i.jsxs("button",{onClick:()=>$(xe),style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 10px",height:"36px",background:X===xe?"var(--primary)":"transparent",color:X===xe?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:xe==="card"?"1px solid var(--border)":"none"},children:[xe==="list"?i.jsx(Eb,{size:13}):i.jsx(Cb,{size:13}),!s&&(xe==="list"?"List":"Cards")]},xe))})]}),(!s||D)&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[c?i.jsx(DG,{total:f,loading:M,busy:be.bulkBusy,checked:H,onChange:xe=>{xe?lt():ve()}}):null,i.jsx(mB,{label:"All Statuses",value:_,options:u5e,onChange:T}),i.jsx(mB,{label:"All Designations",value:A,options:d5e,onChange:P}),c?i.jsx(MG,{tagOptions:C,activeTag:N,onChange:O}):null,je&&i.jsxs("button",{type:"button",onClick:()=>{T("All"),P("All"),O(null)},style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:[i.jsx(Gt,{size:11})," Clear"]})]})]}),c?i.jsx(BG,{selectedCount:K.length,busy:be.bulkBusy,variant:"event",onAddTags:()=>void be.openBulkDialog("addTags"),onRemoveTags:()=>void be.openBulkDialog("removeTags"),onNewList:()=>void be.openBulkDialog("newList"),onAddToList:()=>void be.openBulkDialog("addToList"),onRemoveFromEvent:()=>{window.confirm(`Remove ${K.length} participant(s) from this event?`)&&be.runBulkRemoveFromEvent()},onClearSelection:ve}):null,i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Showing ",i.jsx("strong",{style:{color:"var(--foreground)"},children:(p-1)*m+1}),"–",i.jsx("strong",{children:Math.min(p*m,f)})," of ",f," participants"]}),M?i.jsx("div",{style:{textAlign:"center",padding:"48px 20px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading…"}):u.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Ri,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No participants found"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px"},children:"Try adjusting your search or filters."}),i.jsxs("button",{type:"button",onClick:()=>{w(""),j(""),T("All"),P("All"),O(null),v(1)},style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(Gt,{size:13})," Clear all filters"]})]}):X==="list"?i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:[c?i.jsx("th",{style:{padding:"9px 8px 9px 16px",width:"36px"},children:i.jsx("input",{ref:de,type:"checkbox",title:"Select visible rows",onChange:ke,style:{width:"16px",height:"16px",cursor:"pointer"}})}):null,(c?["Participant","Role","Tags","Phone","Registered","Status","Checked In",""]:["Participant","Role","Phone","Registered","Status","Checked In",""]).map(xe=>i.jsx("th",{style:{padding:"9px 12px",textAlign:"left",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase",whiteSpace:"nowrap"},children:xe},xe))]})}),i.jsx("tbody",{children:u.map(xe=>i.jsx(s5e,{p:xe,selectable:c,selected:K.includes(xe.id),onToggleSelect:()=>le(xe.id),onView:()=>ae(xe),onEdit:()=>{Ae(xe.id),Pe(!0)},onDelete:()=>Tt(xe.id),onToggleCheckIn:()=>We(xe.id),onQr:()=>Me(xe),canEdit:l},xe.id))})]})}),i.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Per page"}),i.jsx("select",{value:m,onChange:xe=>{b(Number(xe.target.value)),v(1)},style:{padding:"4px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:pB.map(xe=>i.jsx("option",{value:xe,children:xe},xe))})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("button",{type:"button",disabled:p<=1,onClick:()=>v(xe=>Math.max(1,xe-1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p<=1?"not-allowed":"pointer",color:p<=1?"var(--muted)":"var(--foreground)"},children:i.jsx(vd,{size:16})}),hB(p,Xe).map((xe,Re)=>xe==="ellipsis"?i.jsx("span",{style:{padding:"0 4px",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"…"},`e-${Re}`):i.jsx("button",{type:"button",onClick:()=>v(xe),style:{minWidth:"32px",padding:"6px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:p===xe?"var(--primary)":"var(--card)",color:p===xe?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:xe},xe)),i.jsx("button",{type:"button",disabled:p>=Xe,onClick:()=>v(xe=>Math.min(Xe,xe+1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p>=Xe?"not-allowed":"pointer",color:p>=Xe?"var(--muted)":"var(--foreground)"},children:i.jsx(ka,{size:16})})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:"14px"},children:u.map(xe=>i.jsx(l5e,{p:xe,selectable:c,selected:K.includes(xe.id),onToggleSelect:()=>le(xe.id),onView:()=>ae(xe),onEdit:()=>{Ae(xe.id),Pe(!0)},onDelete:()=>Tt(xe.id),onToggleCheckIn:()=>We(xe.id),onQr:()=>Me(xe),canEdit:l},xe.id))}),i.jsxs("div",{style:{padding:"12px 16px",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",background:"var(--card)",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Per page"}),i.jsx("select",{value:m,onChange:xe=>{b(Number(xe.target.value)),v(1)},style:{padding:"4px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:pB.map(xe=>i.jsx("option",{value:xe,children:xe},xe))})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("button",{type:"button",disabled:p<=1,onClick:()=>v(xe=>Math.max(1,xe-1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p<=1?"not-allowed":"pointer",color:p<=1?"var(--muted)":"var(--foreground)"},children:i.jsx(vd,{size:16})}),hB(p,Xe).map((xe,Re)=>xe==="ellipsis"?i.jsx("span",{style:{padding:"0 4px",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"…"},`e2-${Re}`):i.jsx("button",{type:"button",onClick:()=>v(xe),style:{minWidth:"32px",padding:"6px 8px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:p===xe?"var(--primary)":"var(--card)",color:p===xe?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:xe},xe)),i.jsx("button",{type:"button",disabled:p>=Xe,onClick:()=>v(xe=>Math.min(Xe,xe+1)),style:{display:"flex",alignItems:"center",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:p>=Xe?"not-allowed":"pointer",color:p>=Xe?"var(--muted)":"var(--foreground)"},children:i.jsx(ka,{size:16})})]})]})]}),e?null:i.jsx("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})}),De&&i.jsx(c5e,{p:De,onClose:()=>ae(null),onEdit:()=>{Ae(De.id),ae(null),Pe(!0)},canEdit:l}),ue&&i.jsx(t5e,{open:!0,participantId:ue.id,participantName:ue.name,onClose:()=>Me(null)}),Se&&t&&i.jsx(Qje,{eventId:t,participantId:Ee??void 0,onClose:()=>{Pe(!1),Ae(null)},onSuccess:()=>{Ft(),Pe(!1),Ae(null)}}),Ye&&i.jsx(f5e,{message:Ye.msg,onConfirm:Ye.onConfirm,onCancel:()=>rt(null)}),Pt&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},onClick:()=>qe(null),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",maxWidth:"440px",width:"100%",padding:"22px",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border)"},onClick:xe=>xe.stopPropagation(),children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 12px"},children:"Import finished"}),i.jsxs("ul",{style:{margin:"0 0 14px",paddingLeft:"18px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",lineHeight:1.6},children:[i.jsxs("li",{children:[i.jsx("strong",{children:Pt.created})," added"]}),i.jsxs("li",{children:[i.jsx("strong",{children:Pt.skippedDuplicate})," skipped (email already registered for this event)"]}),Pt.failed>0&&i.jsxs("li",{children:[i.jsx("strong",{children:Pt.failed})," rows failed validation"]})]}),Pt.errors.length>0&&i.jsxs("div",{style:{maxHeight:"160px",overflowY:"auto",marginBottom:"14px",padding:"10px",background:"var(--secondary)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[Pt.errors.map((xe,Re)=>i.jsxs("div",{style:{marginBottom:"6px"},children:["Line ",xe.line,": ",xe.message]},Re)),Pt.failed>Pt.errors.length&&i.jsx("div",{children:"…and more"})]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 14px",fontFamily:"var(--font-noto-sans)"},children:["Required columns: ",i.jsx("code",{style:{fontSize:"11px"},children:"email"}),", ",i.jsx("code",{children:"firstName"})," (or First name), ",i.jsx("code",{children:"lastName"})," (or Last name). Optional: phone, organization, designation, tags, notes."]}),i.jsx("button",{type:"button",onClick:()=>qe(null),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"OK"})]})}),c?i.jsxs(i.Fragment,{children:[i.jsx(WG,{bulkDialog:be.bulkDialog,bulkBusy:be.bulkBusy,selectedCount:K.length,tagBulkInput:be.tagBulkInput,onTagBulkInputChange:be.setTagBulkInput,newListName:be.newListName,onNewListNameChange:be.setNewListName,newListDesc:be.newListDesc,onNewListDescChange:be.setNewListDesc,eventsPick:be.eventsPick,eventPickIds:be.eventPickIds,onToggleEventPick:be.toggleEventPick,fixedLists:be.fixedLists,addToListId:be.addToListId,onAddToListIdChange:be.setAddToListId,onClose:()=>be.setBulkDialog(null),onApplyTags:xe=>void be.runBulkTags(xe),onAssignEvents:()=>void be.runBulkAssignEvents(),onCreateList:()=>void be.runBulkNewList(),onAddToList:()=>void be.runBulkAddToList()}),q?i.jsx(YP,{onClose:()=>G(!1),onCreated:()=>se()}):null]}):null]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",alignItems:"center",justifyContent:"center",minHeight:"280px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(Ri,{size:40,style:{opacity:.5}}),i.jsx("p",{style:{fontSize:"var(--text-base)"},children:"Select an event to view participants."})]})}function p5e(e){return`${window.location.origin}/attendance/${e}`}function yB(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const xB={name:"",description:"",allowDuplicateCheckIn:!1,publicLinkEnabled:!0};function h5e(){var re;const{selectedEventId:e}=Li(),[t,r]=S.useState([]),[n,o]=S.useState(!1),[a,s]=S.useState(null),[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState(xB),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState(""),[_,T]=S.useState([]),[A,P]=S.useState(!1),[N,O]=S.useState(null),[C,I]=S.useState([]),[R,F]=S.useState(0),[M,Y]=S.useState(!1),X=t.find(H=>H._id===l)??null,$=S.useCallback(async()=>{var ie;if(!e)return;o(!0),s(null);const H=await Wc.list(e);if(o(!1),H.error){s(H.error);return}r(((ie=H.data)==null?void 0:ie.attendances)??[])},[e]);S.useEffect(()=>{$()},[$]);const ee=S.useCallback(async()=>{if(!e||!l)return;Y(!0);const H=await Wc.listCheckIns(e,l,{limit:50});Y(!1),H.data&&(I(H.data.checkIns),F(H.data.total))},[e,l]);S.useEffect(()=>{l&&ee()},[l,ee]),S.useEffect(()=>{if(!e||!l)return;const H=setTimeout(async()=>{P(!0);const ie=await Wc.searchParticipants(e,l,k.trim()||void 0);P(!1),ie.data&&T(ie.data.participants)},300);return()=>clearTimeout(H)},[k,e,l]);const V=()=>{h(null),v(xB),d(!0)},D=H=>{var ie,de;h(H._id),v({name:H.name,description:H.description||"",allowDuplicateCheckIn:!!((ie=H.settings)!=null&&ie.allowDuplicateCheckIn),publicLinkEnabled:((de=H.settings)==null?void 0:de.publicLinkEnabled)!==!1}),d(!0)},z=async()=>{var de;if(!e||!p.name.trim())return;b(!0);const H={name:p.name.trim(),description:p.description.trim(),settings:{allowDuplicateCheckIn:p.allowDuplicateCheckIn,publicLinkEnabled:p.publicLinkEnabled}},ie=f?await Wc.update(e,f,H):await Wc.create(e,H);if(b(!1),ie.error){s(ie.error);return}d(!1),await $(),(de=ie.data)!=null&&de._id&&!f&&c(ie.data._id)},q=async H=>{if(!e||!confirm("Archive this attendance session?"))return;const ie=await Wc.remove(e,H);if(ie.error){s(ie.error);return}l===H&&c(null),await $()},G=async H=>{if(!e||!l)return;O(H);const ie=await Wc.checkIn(e,l,H);if(O(null),ie.error){s(ie.error);return}await $(),await ee();const de=await Wc.searchParticipants(e,l,k.trim()||void 0);de.data&&T(de.data.participants)},U=async H=>{try{await navigator.clipboard.writeText(p5e(H)),w("Link copied"),setTimeout(()=>w(null),2e3)}catch{w("Could not copy")}},Q=async H=>{if(!e||!confirm("Regenerate public link? Old links will stop working."))return;const ie=await Wc.regenerateToken(e,H);if(ie.error){s(ie.error);return}await $()},K=async()=>{if(!e||!l||!X)return;const H=X.name.replace(/[^a-z0-9-_]+/gi,"-").slice(0,40);await Wc.downloadExport(e,l,`${H}-check-ins.csv`)};return e?i.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(hT,{size:20,color:"var(--primary)"}),i.jsx("h1",{style:{margin:0,fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:600},children:"Attendance"})]}),i.jsxs("button",{type:"button",onClick:V,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",background:"var(--primary)",color:"#fff",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer",fontSize:"var(--text-sm)"},children:[i.jsx(gr,{size:14})," Add session"]})]}),a&&i.jsxs("div",{style:{margin:"12px 20px 0",padding:"10px 12px",background:"#fef2f2",color:"#b91c1c",borderRadius:"var(--radius-button)",fontSize:"var(--text-sm)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a,i.jsx("button",{type:"button",onClick:()=>s(null),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:14})})]}),x&&i.jsx("div",{style:{margin:"8px 20px 0",fontSize:"var(--text-sm)",color:"var(--primary)"},children:x}),i.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,overflow:"hidden"},children:[i.jsxs("div",{style:{width:l?280:"100%",maxWidth:l?280:void 0,borderRight:l?"1px solid var(--border)":void 0,overflow:"auto",flexShrink:0},children:[n&&i.jsx("p",{style:{padding:20,color:"var(--muted)"},children:"Loading…"}),!n&&t.length===0&&i.jsx("p",{style:{padding:20,color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No attendance sessions yet. Create one to start check-ins."}),t.map(H=>i.jsxs("button",{type:"button",onClick:()=>c(H._id),style:{display:"block",width:"100%",textAlign:"left",padding:"14px 16px",border:"none",borderBottom:"1px solid var(--border)",background:l===H._id?"var(--secondary)":"transparent",cursor:"pointer"},children:[i.jsx("div",{style:{fontWeight:600,fontSize:"var(--text-sm)",marginBottom:4},children:H.name}),i.jsxs("div",{style:{fontSize:"11px",color:"var(--muted)"},children:[H.totalCheckedIn??0," check-in",(H.totalCheckedIn??0)===1?"":"s"," ·"," ",H.uniqueParticipants??0," people"]}),H.status==="archived"&&i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)"},children:"Archived"})]},H._id))]}),X&&e&&i.jsxs("div",{style:{flex:1,overflow:"auto",padding:20,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginBottom:20,flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>c(null),style:{display:"none",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",color:"var(--muted)",fontSize:"var(--text-sm)",marginBottom:8},className:"attendance-back-mobile",children:[i.jsx(vd,{size:16})," Back"]}),i.jsx("h2",{style:{margin:0,fontSize:"var(--text-base)",fontWeight:600},children:X.name}),X.description&&i.jsx("p",{style:{margin:"6px 0 0",fontSize:"var(--text-sm)",color:"var(--muted)"},children:X.description})]}),i.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[i.jsx("button",{type:"button",onClick:()=>D(X),title:"Edit",style:Ny,children:i.jsx(wi,{size:14})}),i.jsx("button",{type:"button",onClick:K,title:"Export CSV",style:Ny,children:i.jsx(ja,{size:14})}),i.jsx("button",{type:"button",onClick:()=>U(X.publicToken),title:"Copy public link",style:Ny,disabled:!((re=X.settings)!=null&&re.publicLinkEnabled),children:i.jsx(i2,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Q(X._id),title:"Regenerate link",style:Ny,children:i.jsx(_x,{size:14})}),i.jsx("button",{type:"button",onClick:()=>q(X._id),title:"Archive",style:Ny,children:i.jsx(Xr,{size:14})})]})]}),i.jsxs("div",{style:{marginBottom:24},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:500,marginBottom:8},children:[i.jsx(pi,{size:14,style:{verticalAlign:"middle",marginRight:6}}),"Find participant to check in"]}),i.jsx("input",{type:"search",value:k,onChange:H=>j(H.target.value),placeholder:"Name, email, or phone…",style:cE}),A&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:8},children:"Searching…"}),i.jsxs("div",{style:{marginTop:12,display:"flex",flexDirection:"column",gap:8},children:[_.map(H=>{var de,le;const ie=!H.alreadyCheckedIn||!!((de=X.settings)!=null&&de.allowDuplicateCheckIn);return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"12px 14px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)"},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("div",{style:{fontWeight:500,fontSize:"var(--text-sm)"},children:H.displayName}),i.jsx("div",{style:{fontSize:"11px",color:"var(--muted)"},children:[H.email,H.phone].filter(Boolean).join(" · ")||"—"}),H.alreadyCheckedIn&&i.jsxs("div",{style:{fontSize:"11px",color:"#15803d",marginTop:4},children:["Checked in ",H.checkInCount," time",H.checkInCount===1?"":"s",H.lastCheckedInAt?` · ${yB(H.lastCheckedInAt)}`:""]})]}),i.jsxs("button",{type:"button",disabled:!ie||N===H._id,onClick:()=>G(H._id),style:{...g5e,opacity:ie?1:.5},children:[i.jsx(lS,{size:14}),H.alreadyCheckedIn&&((le=X.settings)!=null&&le.allowDuplicateCheckIn)?"Again":"Check in"]})]},H._id)}),!A&&_.length===0&&k.trim()&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No participants found."})]})]}),i.jsxs("div",{children:[i.jsxs("h3",{style:{fontSize:"var(--text-sm)",fontWeight:600,marginBottom:12},children:["Check-ins (",R,")"]}),M&&i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading…"}),!M&&C.length===0&&i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No check-ins yet."}),i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-sm)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)",textAlign:"left"},children:[i.jsx("th",{style:Ry,children:"Name"}),i.jsx("th",{style:Ry,children:"Email"}),i.jsx("th",{style:Ry,children:"Phone"}),i.jsx("th",{style:Ry,children:"Last check-in"}),i.jsx("th",{style:Ry,children:"Count"})]})}),i.jsx("tbody",{children:C.map(H=>{const ie=[H.firstName,H.lastName].filter(Boolean).join(" ").trim()||"—";return i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:Ly,children:ie}),i.jsx("td",{style:Ly,children:H.email||"—"}),i.jsx("td",{style:Ly,children:H.phone||"—"}),i.jsx("td",{style:Ly,children:yB(H.lastCheckedInAt)}),i.jsx("td",{style:Ly,children:H.checkInCount})]},H._id)})})]})})]})]}),!X&&t.length>0&&i.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Select a session to manage check-ins"})]}),u&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:200,display:"flex",alignItems:"center",justifyContent:"center",padding:24},onClick:()=>d(!1),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:440,boxShadow:"var(--elevation-sm)"},onClick:H=>H.stopPropagation(),children:[i.jsx("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border)"},children:i.jsx("h3",{style:{margin:0,fontSize:"var(--text-base)",fontWeight:600},children:f?"Edit session":"New attendance session"})}),i.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",gap:14},children:[i.jsxs("label",{style:bB,children:["Name *",i.jsx("input",{value:p.name,onChange:H=>v(ie=>({...ie,name:H.target.value})),style:cE,placeholder:"e.g. Main entrance – Day 1"})]}),i.jsxs("label",{style:bB,children:["Description",i.jsx("textarea",{value:p.description,onChange:H=>v(ie=>({...ie,description:H.target.value})),style:{...cE,minHeight:72,resize:"vertical"}})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:p.allowDuplicateCheckIn,onChange:H=>v(ie=>({...ie,allowDuplicateCheckIn:H.target.checked}))}),"Allow duplicate check-ins"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:p.publicLinkEnabled,onChange:H=>v(ie=>({...ie,publicLinkEnabled:H.target.checked}))}),"Enable public check-in link"]})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:8},children:[i.jsx("button",{type:"button",onClick:()=>d(!1),style:m5e,children:"Cancel"}),i.jsx("button",{type:"button",onClick:z,disabled:m||!p.name.trim(),style:v5e,children:m?"Saving…":f?"Save":"Create"})]})]})})]}):i.jsx("div",{style:{padding:24,color:"var(--muted)"},children:"Select an event to manage attendance."})}const Ny={width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},cE={width:"100%",height:40,padding:"0 12px",marginTop:6,borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)",boxSizing:"border-box"},bB={display:"block",fontSize:"var(--text-sm)",fontWeight:500},Ry={padding:"8px 10px",fontWeight:600,color:"var(--muted)"},Ly={padding:"10px"},g5e={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 12px",background:"var(--primary)",color:"#fff",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer",fontSize:"var(--text-sm)",flexShrink:0},m5e={padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)"},v5e={padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"#fff",cursor:"pointer",fontSize:"var(--text-sm)"},y5e={id:"venue",prompt:"What is the venue or address for the in-person part of this event?"},x5e={id:"virtualLink",prompt:"What is the meeting or stream URL (e.g. https://…)?"};function YG(e){const t=e.trim();if(!t)return!1;try{return new URL(t.startsWith("http")?t:`https://${t}`),!0}catch{return!1}}function b5e(e,t){const r=[],n=(t.location||"").trim(),o=(t.virtualLink||"").trim();return(e==="Physical"||e==="Hybrid")&&(n||r.push(y5e)),(e==="Virtual"||e==="Hybrid")&&(YG(o)||r.push(x5e)),r}function w5e(e,t,r){const n=new Set(e.slice(t+1).map(a=>a.id)),o=r.filter(a=>!n.has(a.id));return[...e.slice(0,t+1),...o,...e.slice(t+1)]}function S5e({gaps:e,mergedPreview:t,organizationId:r,onClose:n,onCreated:o}){const a=S.useMemo(()=>FU(t),[t]),[s,l]=S.useState(()=>[...e]),[c,u]=S.useState(0),[d,f]=S.useState({}),[h,p]=S.useState({}),[v,m]=S.useState(!1),[b,x]=S.useState(null),[w,k]=S.useState(""),[j,_]=S.useState(""),[T,A]=S.useState(""),[P,N]=S.useState(""),[O,C]=S.useState(""),[I,R]=S.useState(""),F=s[c],M=c>=s.length;S.useEffect(()=>{!F||M||(p({}),F.id==="eventName"&&k(d.eventName??a.name??""),F.id==="startEnd"&&(_(d.startLocal??""),A(d.endLocal??"")),F.id==="locationType"&&N(d.locationType||""),F.id==="venue"&&C(d.venue??a.location??""),F.id==="virtualLink"&&R(d.virtualLink??a.virtualLink??""))},[F,M,d,a]);const Y=S.useCallback(q=>h[q],[h]),X=S.useCallback(()=>{const q={};if(!F)return q;if(F.id==="eventName"&&w.trim().length<3&&(q.eventName="Name must be at least 3 characters."),F.id==="startEnd"&&(j.trim()||(q.startLocal="Start is required."),T.trim()||(q.endLocal="End is required."),j&&T)){const G=new Date(j).getTime(),U=new Date(T).getTime();!Number.isNaN(G)&&!Number.isNaN(U)&&U<=G&&(q.endLocal="End must be after start.")}return F.id==="locationType"&&(P||(q.locationType="Select a type.")),F.id==="venue"&&(O.trim()||(q.venue="Venue or address is required.")),F.id==="virtualLink"&&(I.trim()?YG(I)||(q.virtualLink="Enter a valid URL (e.g. https://…)."):q.virtualLink="URL is required."),q},[F,w,j,T,P,O,I]),$=S.useCallback(()=>{if(!F)return d;const q={...d};return F.id==="eventName"&&(q.eventName=w.trim()),F.id==="startEnd"&&(q.startLocal=j,q.endLocal=T),F.id==="locationType"&&(q.locationType=P),F.id==="venue"&&(q.venue=O.trim()),F.id==="virtualLink"&&(q.virtualLink=I.trim()),q},[d,F,w,j,T,P,O,I]),ee=()=>{const q=X();if(Object.keys(q).length>0){p(q);return}const G=$();if(f(G),(F==null?void 0:F.id)==="locationType"&&P){const U=b5e(P,a);U.length>0&&l(Q=>w5e(Q,c,U))}u(U=>U+1)},V=()=>{x(null),p({}),u(q=>Math.max(0,q-1))},D=S.useMemo(()=>{const q=(a.locationType||"physical").toLowerCase(),G={physical:"Physical",virtual:"Virtual",hybrid:"Hybrid"},U=d.locationType||G[q]||"Physical",Q=(d.eventName??a.name).trim(),K=(a.description||"").trim()||"—";let re=d.startLocal,H=d.endLocal;if(!re||!H)try{re=new Date(a.startDate).toLocaleString(),H=new Date(a.endDate).toLocaleString()}catch{re=a.startDate,H=a.endDate}const ie=(d.venue??a.location??"").trim()||"—",de=(d.virtualLink??a.virtualLink??"").trim()||"—";return[{k:"Name",v:Q},{k:"Description",v:K},{k:"Type",v:U},{k:"Venue",v:ie},{k:"Virtual link",v:de},{k:"Start",v:re},{k:"End",v:H},{k:"Event type (program)",v:a.type||"conference"},{k:"Status",v:a.status||"draft"}]},[d,a]),z=async()=>{x(null);let q;try{q=LU(a,d,r)}catch(U){x(U instanceof Error?U.message:"Invalid event data.");return}m(!0);const G=await Lr.create(q);if(m(!1),G.data!=null&&!G.error){const U=G.data._id;U?(o(U),n()):x("Could not create the event.")}else x(G.error||"Could not create the event.")};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:n,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)"},children:[i.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"A few details needed"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"4px 0 0",fontFamily:"var(--font-noto-sans)"},children:["Step ",M?s.length+1:c+1," of ",s.length+1]})]}),i.jsx("button",{type:"button",onClick:n,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:14})})]})}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[!M&&F&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{alignSelf:"flex-start",maxWidth:"100%",padding:"12px 14px",borderRadius:"12px",background:"var(--secondary)",border:"1px solid var(--border)"},children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",marginBottom:"6px"},children:"Assistant"}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",color:"var(--foreground)",fontFamily:"var(--font-noto-sans)",lineHeight:1.5},children:F.prompt})]}),F.id==="eventName"&&i.jsxs(lr,{error:Y("eventName"),children:[i.jsx(ur,{text:"Event name",required:!0}),i.jsx("input",{style:{...Qr,...Y("eventName")?{borderColor:"var(--destructive)"}:{}},value:w,onChange:q=>k(q.target.value)})]}),F.id==="startEnd"&&i.jsxs(No,{children:[i.jsxs(lr,{error:Y("startLocal"),children:[i.jsx(ur,{text:"Start date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...Y("startLocal")?{borderColor:"var(--destructive)"}:{}},value:j,onChange:q=>_(q.target.value)})]}),i.jsxs(lr,{error:Y("endLocal"),children:[i.jsx(ur,{text:"End date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...Y("endLocal")?{borderColor:"var(--destructive)"}:{}},value:T,onChange:q=>A(q.target.value)})]})]}),F.id==="locationType"&&i.jsxs(lr,{error:Y("locationType"),children:[i.jsx(ur,{text:"Type",required:!0}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...Y("locationType")?{borderColor:"var(--destructive)"}:{}},value:P,onChange:q=>N(q.target.value),children:[i.jsx("option",{value:"",children:"Select"}),i.jsx("option",{value:"Physical",children:"Physical"}),i.jsx("option",{value:"Virtual",children:"Virtual"}),i.jsx("option",{value:"Hybrid",children:"Hybrid"})]})})]}),F.id==="venue"&&i.jsxs(lr,{error:Y("venue"),children:[i.jsx(ur,{text:"Location / venue",required:!0}),i.jsx("input",{style:{...Qr,...Y("venue")?{borderColor:"var(--destructive)"}:{}},value:O,onChange:q=>C(q.target.value)})]}),F.id==="virtualLink"&&i.jsxs(lr,{error:Y("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Qr,...Y("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:I,onChange:q=>R(q.target.value)})]})]}),M&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{alignSelf:"flex-start",maxWidth:"100%",padding:"12px 14px",borderRadius:"12px",background:"var(--secondary)",border:"1px solid var(--border)"},children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",marginBottom:"6px"},children:"Assistant"}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",color:"var(--foreground)",fontFamily:"var(--font-noto-sans)",lineHeight:1.5},children:"Here is a summary of your event. When you are ready, create the draft and open your dashboard."})]}),i.jsx("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"12px 14px",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:D.map(q=>i.jsxs("div",{style:{display:"flex",gap:"10px",padding:"6px 0",borderBottom:"1px solid var(--border)"},children:[i.jsx("span",{style:{color:"var(--muted)",minWidth:"120px",flexShrink:0},children:q.k}),i.jsx("span",{style:{color:"var(--foreground)",wordBreak:"break-word"},children:q.v})]},q.k))})]}),b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:b})]}),i.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--border)",display:"flex",gap:"10px",justifyContent:"flex-end",flexShrink:0},children:[!M&&c>0&&i.jsx("button",{type:"button",onClick:V,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Back"}),!M&&i.jsx("button",{type:"button",onClick:ee,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c>=s.length-1?"Review":"Next"}),M&&i.jsx("button",{type:"button",disabled:v,onClick:()=>void z(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:v?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:v?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:v?"Creating…":"Create event"})]})]})]})}function j5e({organizationId:e,onCreated:t}){const[r,n]=S.useState(""),[o,a]=S.useState(!1),[s,l]=S.useState(null),[c,u]=S.useState(!1),[d,f]=S.useState([]),[h,p]=S.useState(null),v=()=>{(async()=>{var b;l(null);const m=r.trim();if(m.length<10){l("Add a bit more detail (at least 10 characters).");return}a(!0);try{const x=await Lr.aiExtractPreview({description:m,organization:e});if(x.error!=null||x.data==null){l(x.error||"Could not analyze the description.");return}const{gaps:w,mergedPreview:k}=x.data,j=Array.isArray(w)?w:[],_=k!=null&&typeof k=="object"?k:{};if(j.length===0)try{const T=FU(_),A=LU(T,{},e),P=await Lr.create(A);if(P.error!=null||!((b=P.data)!=null&&b._id)){l(P.error||"Could not create the event.");return}t(String(P.data._id)),n("")}catch(T){l(T instanceof Error?T.message:"Could not create the event.")}else f(j),p(_),u(!0)}finally{a(!1)}})()};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"16px 20px",marginBottom:"14px"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Describe your Event, Session and other details"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"12px",lineHeight:1.45},children:"Include the event name, what it is about, dates, venue or online link, and anything else relevant. We infer fields from your description. If something important is missing, we will ask a few short questions before creating your draft event with a default track and opening session."}),i.jsx("textarea",{value:r,onChange:m=>n(m.target.value),rows:5,disabled:o,placeholder:"Example: Annual cardiometabolic summit on 15–16 June 2026 at Hyderabad International Convention Centre, keynote on GLP-1 therapies…",style:{width:"100%",boxSizing:"border-box",resize:"vertical",minHeight:"120px",padding:"12px 14px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",lineHeight:1.45,marginBottom:"12px"}}),s&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginBottom:"10px"},children:s}),i.jsxs("button",{type:"button",onClick:v,disabled:o,style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:o?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:o?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:o?.85:1},children:[i.jsx(ine,{size:16}),o?"Analyzing…":"Generate your Event using AI"]})]}),c&&h!=null&&i.jsx(S5e,{gaps:d,mergedPreview:h,organizationId:e,onClose:()=>{u(!1),p(null)},onCreated:m=>{u(!1),p(null),n(""),t(m)}})]})}function GG({onClose:e,onSuccess:t,onCreated:r,organizationId:n}){const{user:o}=Mr(),a=Nn(o),s=n??a??void 0,[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState(""),[k,j]=S.useState(""),[_,T]=S.useState({}),[A,P]=S.useState(!1),[N,O]=S.useState(null),C=S.useCallback(F=>_[F],[_]),I=S.useCallback(()=>{const F={};if(l.trim().length<3&&(F.eventName="Name must be at least 3 characters."),f||(F.locationType="Select a type."),(f==="Physical"||f==="Hybrid")&&(p.trim()||(F.venue="Venue or address is required.")),(f==="Virtual"||f==="Hybrid")&&(m.trim()||(F.virtualLink="Virtual link is required.")),x.trim()||(F.startLocal="Start date and time are required."),k.trim()||(F.endLocal="End date and time are required."),x&&k){const Y=new Date(x).getTime(),X=new Date(k).getTime();!Number.isNaN(Y)&&!Number.isNaN(X)&&X<=Y&&(F.endLocal="End must be after start.")}return F},[l,f,p,m,x,k]),R=async()=>{O(null);const F=I();if(Object.keys(F).length>0){T(F);return}T({});let M;try{M=lae({eventName:l,description:u,locationTypeLabel:f,venue:p,virtualLink:m,startLocal:x,endLocal:k,organizationId:s})}catch(X){O(X instanceof Error?X.message:"Invalid dates.");return}P(!0);const Y=await Lr.create(M);if(P(!1),Y.data!=null&&!Y.error){const X=Y.data._id;X&&(r==null||r(X)),t==null||t(),e()}else O(Y.error||"Could not create event. Please try again.")};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)",animation:"slideInRightQuick 0.25s ease"},children:[i.jsx("style",{children:"@keyframes slideInRightQuick { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Create event"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",lineHeight:1.45},children:"A default track and opening session are added automatically."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{type:"button",onClick:e,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:14})}),i.jsx("button",{type:"button",disabled:A,onClick:()=>void R(),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",background:A?"var(--secondary)":"var(--primary)",color:A?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:A?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:A?"Creating…":"Create event"})]})]}),N?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"10px 0 0"},children:N}):null]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(lr,{error:C("eventName"),children:[i.jsx(ur,{text:"Event name",required:!0}),i.jsx("input",{style:{...Qr,...C("eventName")?{borderColor:"var(--destructive)"}:{}},value:l,onChange:F=>c(F.target.value),autoComplete:"off"})]}),i.jsxs(lr,{error:C("description"),children:[i.jsx(ur,{text:"Description"}),i.jsx("textarea",{style:{...Qr,resize:"vertical",minHeight:"72px",...C("description")?{borderColor:"var(--destructive)"}:{}},value:u,onChange:F=>d(F.target.value)})]}),i.jsxs(lr,{error:C("locationType"),children:[i.jsx(ur,{text:"Type",required:!0}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...C("locationType")?{borderColor:"var(--destructive)"}:{}},value:f,onChange:F=>h(F.target.value),children:[i.jsx("option",{value:"",children:"Physical / Virtual / Hybrid"}),i.jsx("option",{value:"Physical",children:"Physical"}),i.jsx("option",{value:"Virtual",children:"Virtual"}),i.jsx("option",{value:"Hybrid",children:"Hybrid"})]})})]}),(f==="Physical"||f==="Hybrid")&&i.jsxs(lr,{error:C("venue"),children:[i.jsx(ur,{text:"Location / venue",required:!0}),i.jsx("input",{style:{...Qr,...C("venue")?{borderColor:"var(--destructive)"}:{}},value:p,onChange:F=>v(F.target.value)})]}),(f==="Virtual"||f==="Hybrid")&&i.jsxs(lr,{error:C("virtualLink"),children:[i.jsx(ur,{text:"Virtual link",required:!0}),i.jsx("input",{style:{...Qr,...C("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:m,onChange:F=>b(F.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:C("startLocal"),children:[i.jsx(ur,{text:"Start date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...C("startLocal")?{borderColor:"var(--destructive)"}:{}},value:x,onChange:F=>w(F.target.value)})]}),i.jsxs(lr,{error:C("endLocal"),children:[i.jsx(ur,{text:"End date & time",required:!0}),i.jsx("input",{type:"datetime-local",style:{...Qr,...C("endLocal")?{borderColor:"var(--destructive)"}:{}},value:k,onChange:F=>j(F.target.value)})]})]})]})]})]})}function k5e(e){var t;return e?e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(" ").trim():((t=e.email)==null?void 0:t.split("@")[0])??"there":"there"}function _5e({msg:e,onDone:t}){return S.useEffect(()=>{const r=setTimeout(t,3e3);return()=>clearTimeout(r)},[]),i.jsxs("div",{style:{position:"fixed",bottom:"24px",left:"50%",transform:"translateX(-50%)",background:"var(--foreground)",color:"var(--background)",padding:"10px 20px",borderRadius:"var(--radius-button)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",boxShadow:"var(--shadow-xl)",zIndex:200,display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(bv,{size:13})," ",e]})}function C5e(){const{setActiveNav:e,setSelectedEventId:t}=Li(),{user:r}=Mr(),n=Nn(r),o=k5e(r??null),[a,s]=S.useState(null),[l,c]=S.useState(!1),[u,d]=S.useState(!1),h=Si()==="mobile",p=v=>{v==="event"?c(!0):(v==="qna"||v==="quiz-poll")&&d(!0)};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:h?"32px":"40px",maxWidth:"1200px",margin:"0 auto"},children:[i.jsx("div",{children:i.jsxs("h1",{style:{fontFamily:"var(--font-inter)",fontSize:h?"var(--text-2xl)":"var(--text-3xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:["Hi, ",o]})}),i.jsxs("div",{children:[i.jsx("h2",{style:{fontFamily:"var(--font-noto-sans)",fontSize:h?"var(--text-lg)":"var(--text-xl)",fontWeight:"var(--font-weight-normal)",color:"var(--foreground)",margin:"0 0 20px",lineHeight:1.4},children:"Tell us about your event or activity, we will create it for you."}),n?i.jsx(j5e,{organizationId:n,onCreated:v=>{t(v),e("dashboard"),s("Event, track, and opening session created from your description.")}}):i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,lineHeight:1.5},children:"Set up an organization in your portfolio to generate events with AI from here."})]}),i.jsx("div",{children:i.jsxs("div",{style:{display:"grid",gridTemplateColumns:h?"1fr":"repeat(3, 1fr)",gap:h?"12px":"20px"},children:[i.jsx(uE,{icon:i.jsx(Vi,{size:32}),title:"Create new event",onClick:()=>p("event")}),i.jsx(uE,{icon:i.jsx($h,{size:32}),title:"Create Q&A Session",onClick:()=>p("qna")}),i.jsx(uE,{icon:i.jsx(pT,{size:32}),title:"Create quiz or poll",onClick:()=>p("quiz-poll")})]})}),u&&i.jsx(E5e,{onClose:()=>d(!1)}),l&&i.jsx(GG,{organizationId:n,onClose:()=>c(!1),onCreated:v=>{t(v),e("dashboard")}}),a&&i.jsx(_5e,{msg:a,onDone:()=>s(null)})]})}function uE({icon:e,title:t,onClick:r}){return i.jsxs("button",{type:"button",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"20px",padding:"48px 24px",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",cursor:"pointer",transition:"border-color 0.15s, background 0.15s, box-shadow 0.15s",minHeight:"200px"},onMouseEnter:n=>{n.currentTarget.style.borderColor="var(--primary)",n.currentTarget.style.background="var(--accent)",n.currentTarget.style.boxShadow="0 4px 12px rgba(11,77,209,0.15)"},onMouseLeave:n=>{n.currentTarget.style.borderColor="var(--border)",n.currentTarget.style.background="var(--card)",n.currentTarget.style.boxShadow="none"},children:[i.jsx("div",{style:{color:"var(--primary)"},children:e}),i.jsx("p",{style:{fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,textAlign:"center"},children:t})]})}function E5e({onClose:e}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200},role:"presentation"}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(480px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)",animation:"homePanelIn 0.25s cubic-bezier(0.4, 0, 0.2, 1)"},children:[i.jsx("style",{children:"@keyframes homePanelIn { from { transform:translateX(100%); opacity:.6 } to { transform:translateX(0); opacity:1 } }"}),i.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Quick activity creation"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0"},children:"Create a Q&A session, quiz, or poll in seconds"})]}),i.jsx("div",{style:{flex:1,overflowY:"auto",padding:"24px"},children:i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",textAlign:"center",marginTop:"60px"},children:"Quick activity creation interface coming soon!"})}),i.jsxs("div",{style:{padding:"16px 24px",borderTop:"1px solid var(--border)",display:"flex",gap:"12px"},children:[i.jsx("button",{type:"button",onClick:e,style:{flex:1,padding:"10px 20px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"background 0.15s"},onMouseEnter:t=>{t.currentTarget.style.background="var(--secondary)"},onMouseLeave:t=>{t.currentTarget.style.background="var(--card)"},children:"Cancel"}),i.jsx("button",{type:"button",style:{flex:1,padding:"10px 20px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"opacity 0.15s ease",opacity:1},onMouseEnter:t=>{t.currentTarget.style.opacity="0.88"},onMouseLeave:t=>{t.currentTarget.style.opacity="1"},children:"Create Activity"})]})]})]})}function on(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Zs(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Da(e,t){const r=on(e);return isNaN(t)?Zs(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function gc(e,t){const r=on(e);if(isNaN(t))return Zs(e,NaN);if(!t)return r;const n=r.getDate(),o=Zs(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);const a=o.getDate();return n>=a?o:(r.setFullYear(o.getFullYear(),o.getMonth(),n),r)}const XP=6048e5,A5e=864e5;let T5e={};function Wb(){return T5e}function cu(e,t){var l,c,u,d;const r=Wb(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=on(e),a=o.getDay(),s=(a<n?7:0)+a-n;return o.setDate(o.getDate()-s),o.setHours(0,0,0,0),o}function Oh(e){return cu(e,{weekStartsOn:1})}function KG(e){const t=on(e),r=t.getFullYear(),n=Zs(e,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const o=Oh(n),a=Zs(e,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const s=Oh(a);return t.getTime()>=o.getTime()?r+1:t.getTime()>=s.getTime()?r:r-1}function cv(e){const t=on(e);return t.setHours(0,0,0,0),t}function vw(e){const t=on(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function eu(e,t){const r=cv(e),n=cv(t),o=+r-vw(r),a=+n-vw(n);return Math.round((o-a)/A5e)}function P5e(e){const t=KG(e),r=Zs(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),Oh(r)}function h6(e,t){const r=t*7;return Da(e,r)}function I5e(e,t){return gc(e,t*12)}function O5e(e){let t;return e.forEach(function(r){const n=on(r);(t===void 0||t<n||isNaN(Number(n)))&&(t=n)}),t||new Date(NaN)}function N5e(e){let t;return e.forEach(r=>{const n=on(r);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function ds(e,t){const r=cv(e),n=cv(t);return+r==+n}function ZP(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function R5e(e){if(!ZP(e)&&typeof e!="number")return!1;const t=on(e);return!isNaN(Number(t))}function ub(e,t){const r=on(e),n=on(t),o=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return o*12+a}function L5e(e,t,r){const n=cu(e,r),o=cu(t,r),a=+n-vw(n),s=+o-vw(o);return Math.round((a-s)/XP)}function JP(e){const t=on(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function gs(e){const t=on(e);return t.setDate(1),t.setHours(0,0,0,0),t}function QG(e){const t=on(e),r=Zs(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function e8(e,t){var l,c,u,d;const r=Wb(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,o=on(e),a=o.getDay(),s=(a<n?-7:0)+6-(a-n);return o.setDate(o.getDate()+s),o.setHours(23,59,59,999),o}function XG(e){return e8(e,{weekStartsOn:1})}const F5e={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},z5e=(e,t,r)=>{let n;const o=F5e[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function dE(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const M5e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},D5e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},B5e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},W5e={date:dE({formats:M5e,defaultWidth:"full"}),time:dE({formats:D5e,defaultWidth:"full"}),dateTime:dE({formats:B5e,defaultWidth:"full"})},q5e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},$5e=(e,t,r,n)=>q5e[e];function Fy(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const s=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):s;o=e.formattingValues[l]||e.formattingValues[s]}else{const s=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;o=e.values[l]||e.values[s]}const a=e.argumentCallback?e.argumentCallback(t):t;return o[a]}}const U5e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},H5e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},V5e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Y5e={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},G5e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},K5e={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Q5e=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},X5e={ordinalNumber:Q5e,era:Fy({values:U5e,defaultWidth:"wide"}),quarter:Fy({values:H5e,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Fy({values:V5e,defaultWidth:"wide"}),day:Fy({values:Y5e,defaultWidth:"wide"}),dayPeriod:Fy({values:G5e,defaultWidth:"wide",formattingValues:K5e,defaultFormattingWidth:"wide"})};function zy(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const s=a[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?J5e(l,f=>f.test(s)):Z5e(l,f=>f.test(s));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(s.length);return{value:u,rest:d}}}function Z5e(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function J5e(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function eke(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],a=t.match(e.parsePattern);if(!a)return null;let s=e.valueCallback?e.valueCallback(a[0]):a[0];s=r.valueCallback?r.valueCallback(s):s;const l=t.slice(o.length);return{value:s,rest:l}}}const tke=/^(\d+)(th|st|nd|rd)?/i,rke=/\d+/i,nke={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ike={any:[/^b/i,/^(a|c)/i]},oke={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ake={any:[/1/i,/2/i,/3/i,/4/i]},ske={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},lke={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},cke={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uke={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},dke={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},fke={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},pke={ordinalNumber:eke({matchPattern:tke,parsePattern:rke,valueCallback:e=>parseInt(e,10)}),era:zy({matchPatterns:nke,defaultMatchWidth:"wide",parsePatterns:ike,defaultParseWidth:"any"}),quarter:zy({matchPatterns:oke,defaultMatchWidth:"wide",parsePatterns:ake,defaultParseWidth:"any",valueCallback:e=>e+1}),month:zy({matchPatterns:ske,defaultMatchWidth:"wide",parsePatterns:lke,defaultParseWidth:"any"}),day:zy({matchPatterns:cke,defaultMatchWidth:"wide",parsePatterns:uke,defaultParseWidth:"any"}),dayPeriod:zy({matchPatterns:dke,defaultMatchWidth:"any",parsePatterns:fke,defaultParseWidth:"any"})},ZG={code:"en-US",formatDistance:z5e,formatLong:W5e,formatRelative:$5e,localize:X5e,match:pke,options:{weekStartsOn:0,firstWeekContainsDate:1}};function hke(e){const t=on(e);return eu(t,QG(t))+1}function JG(e){const t=on(e),r=+Oh(t)-+P5e(t);return Math.round(r/XP)+1}function eK(e,t){var d,f,h,p;const r=on(e),n=r.getFullYear(),o=Wb(),a=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??o.firstWeekContainsDate??((p=(h=o.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,s=Zs(e,0);s.setFullYear(n+1,0,a),s.setHours(0,0,0,0);const l=cu(s,t),c=Zs(e,0);c.setFullYear(n,0,a),c.setHours(0,0,0,0);const u=cu(c,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function gke(e,t){var l,c,u,d;const r=Wb(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,o=eK(e,t),a=Zs(e,0);return a.setFullYear(o,0,n),a.setHours(0,0,0,0),cu(a,t)}function tK(e,t){const r=on(e),n=+cu(r,t)-+gke(r,t);return Math.round(n/XP)+1}function In(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const bf={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return In(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):In(r+1,2)},d(e,t){return In(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return In(e.getHours()%12||12,t.length)},H(e,t){return In(e.getHours(),t.length)},m(e,t){return In(e.getMinutes(),t.length)},s(e,t){return In(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return In(o,t.length)}},$g={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wB={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return bf.y(e,t)},Y:function(e,t,r,n){const o=eK(e,n),a=o>0?o:1-o;if(t==="YY"){const s=a%100;return In(s,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):In(a,t.length)},R:function(e,t){const r=KG(e);return In(r,t.length)},u:function(e,t){const r=e.getFullYear();return In(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return In(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return In(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return bf.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return In(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const o=tK(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):In(o,t.length)},I:function(e,t,r){const n=JG(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):In(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):bf.d(e,t)},D:function(e,t,r){const n=hke(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):In(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return In(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return In(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),o=n===0?7:n;switch(t){case"i":return String(o);case"ii":return In(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let o;switch(n===12?o=$g.noon:n===0?o=$g.midnight:o=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let o;switch(n>=17?o=$g.evening:n>=12?o=$g.afternoon:n>=4?o=$g.morning:o=$g.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return bf.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):bf.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):In(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):In(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):bf.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):bf.s(e,t)},S:function(e,t){return bf.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return jB(n);case"XXXX":case"XX":return Zp(n);case"XXXXX":case"XXX":default:return Zp(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return jB(n);case"xxxx":case"xx":return Zp(n);case"xxxxx":case"xxx":default:return Zp(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+SB(n,":");case"OOOO":default:return"GMT"+Zp(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+SB(n,":");case"zzzz":default:return"GMT"+Zp(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return In(n,t.length)},T:function(e,t,r){const n=e.getTime();return In(n,t.length)}};function SB(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),a=n%60;return a===0?r+String(o):r+String(o)+t+In(a,2)}function jB(e,t){return e%60===0?(e>0?"-":"+")+In(Math.abs(e)/60,2):Zp(e,t)}function Zp(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=In(Math.trunc(n/60),2),a=In(n%60,2);return r+o+t+a}const kB=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},rK=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},mke=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return kB(e,t);let a;switch(n){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",kB(n,t)).replace("{{time}}",rK(o,t))},vke={p:rK,P:mke},yke=/^D+$/,xke=/^Y+$/,bke=["D","DD","YY","YYYY"];function wke(e){return yke.test(e)}function Ske(e){return xke.test(e)}function jke(e,t,r){const n=kke(e,t,r);if(console.warn(n),bke.includes(e))throw new RangeError(n)}function kke(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const _ke=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Cke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Eke=/^'([^]*?)'?$/,Ake=/''/g,Tke=/[a-zA-Z]/;function Xh(e,t,r){var d,f,h,p,v,m,b,x;const n=Wb(),o=(r==null?void 0:r.locale)??n.locale??ZG,a=(r==null?void 0:r.firstWeekContainsDate)??((f=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(h=n.locale)==null?void 0:h.options)==null?void 0:p.firstWeekContainsDate)??1,s=(r==null?void 0:r.weekStartsOn)??((m=(v=r==null?void 0:r.locale)==null?void 0:v.options)==null?void 0:m.weekStartsOn)??n.weekStartsOn??((x=(b=n.locale)==null?void 0:b.options)==null?void 0:x.weekStartsOn)??0,l=on(e);if(!R5e(l))throw new RangeError("Invalid time value");let c=t.match(Cke).map(w=>{const k=w[0];if(k==="p"||k==="P"){const j=vke[k];return j(w,o.formatLong)}return w}).join("").match(_ke).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const k=w[0];if(k==="'")return{isToken:!1,value:Pke(w)};if(wB[k])return{isToken:!0,value:w};if(k.match(Tke))throw new RangeError("Format string contains an unescaped latin alphabet character `"+k+"`");return{isToken:!1,value:w}});o.localize.preprocessor&&(c=o.localize.preprocessor(l,c));const u={firstWeekContainsDate:a,weekStartsOn:s,locale:o};return c.map(w=>{if(!w.isToken)return w.value;const k=w.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&Ske(k)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&wke(k))&&jke(k,t,String(e));const j=wB[k[0]];return j(l,k,o.localize,u)}).join("")}function Pke(e){const t=e.match(Eke);return t?t[1].replace(Ake,"'"):e}function Ike(e){const t=on(e),r=t.getFullYear(),n=t.getMonth(),o=Zs(e,0);return o.setFullYear(r,n+1,0),o.setHours(0,0,0,0),o.getDate()}function Oke(e){return Math.trunc(+on(e)/1e3)}function Nke(e){const t=on(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function Rke(e,t){return L5e(Nke(e),gs(e),t)+1}function g6(e,t){const r=on(e),n=on(t);return r.getTime()>n.getTime()}function nK(e,t){const r=on(e),n=on(t);return+r<+n}function t8(e,t){const r=on(e),n=on(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function Lke(e,t){const r=on(e),n=on(t);return r.getFullYear()===n.getFullYear()}function fE(e,t){return Da(e,-t)}function pE(e,t){const r=on(e),n=r.getFullYear(),o=r.getDate(),a=Zs(e,0);a.setFullYear(n,t,15),a.setHours(0,0,0,0);const s=Ike(a);return r.setMonth(t,Math.min(o,s)),r}function _B(e,t){const r=on(e);return isNaN(+r)?Zs(e,NaN):(r.setFullYear(t),r)}var Sr=function(){return Sr=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Sr.apply(this,arguments)};function Fke(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function iK(e,t,r){for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function qb(e){return e.mode==="multiple"}function $b(e){return e.mode==="range"}function JS(e){return e.mode==="single"}var zke={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function Mke(e,t){return Xh(e,"LLLL y",t)}function Dke(e,t){return Xh(e,"d",t)}function Bke(e,t){return Xh(e,"LLLL",t)}function Wke(e){return"".concat(e)}function qke(e,t){return Xh(e,"cccccc",t)}function $ke(e,t){return Xh(e,"yyyy",t)}var Uke=Object.freeze({__proto__:null,formatCaption:Mke,formatDay:Dke,formatMonthCaption:Bke,formatWeekNumber:Wke,formatWeekdayName:qke,formatYearCaption:$ke}),Hke=function(e,t,r){return Xh(e,"do MMMM (EEEE)",r)},Vke=function(){return"Month: "},Yke=function(){return"Go to next month"},Gke=function(){return"Go to previous month"},Kke=function(e,t){return Xh(e,"cccc",t)},Qke=function(e){return"Week n. ".concat(e)},Xke=function(){return"Year: "},Zke=Object.freeze({__proto__:null,labelDay:Hke,labelMonthDropdown:Vke,labelNext:Yke,labelPrevious:Gke,labelWeekNumber:Qke,labelWeekday:Kke,labelYearDropdown:Xke});function Jke(){var e="buttons",t=zke,r=ZG,n={},o={},a=1,s={},l=new Date;return{captionLayout:e,classNames:t,formatters:Uke,labels:Zke,locale:r,modifiersClassNames:n,modifiers:o,numberOfMonths:a,styles:s,today:l,mode:"default"}}function e_e(e){var t=e.fromYear,r=e.toYear,n=e.fromMonth,o=e.toMonth,a=e.fromDate,s=e.toDate;return n?a=gs(n):t&&(a=new Date(t,0,1)),o?s=JP(o):r&&(s=new Date(r,11,31)),{fromDate:a?cv(a):void 0,toDate:s?cv(s):void 0}}var oK=S.createContext(void 0);function t_e(e){var t,r=e.initialProps,n=Jke(),o=e_e(r),a=o.fromDate,s=o.toDate,l=(t=r.captionLayout)!==null&&t!==void 0?t:n.captionLayout;l!=="buttons"&&(!a||!s)&&(l="buttons");var c;(JS(r)||qb(r)||$b(r))&&(c=r.onSelect);var u=Sr(Sr(Sr({},n),r),{captionLayout:l,classNames:Sr(Sr({},n.classNames),r.classNames),components:Sr({},r.components),formatters:Sr(Sr({},n.formatters),r.formatters),fromDate:a,labels:Sr(Sr({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:Sr(Sr({},n.modifiers),r.modifiers),modifiersClassNames:Sr(Sr({},n.modifiersClassNames),r.modifiersClassNames),onSelect:c,styles:Sr(Sr({},n.styles),r.styles),toDate:s});return i.jsx(oK.Provider,{value:u,children:e.children})}function Zn(){var e=S.useContext(oK);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function aK(e){var t=Zn(),r=t.locale,n=t.classNames,o=t.styles,a=t.formatters.formatCaption;return i.jsx("div",{className:n.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:a(e.displayMonth,{locale:r})})}function r_e(e){return i.jsx("svg",Sr({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:i.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function sK(e){var t,r,n=e.onChange,o=e.value,a=e.children,s=e.caption,l=e.className,c=e.style,u=Zn(),d=(r=(t=u.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&r!==void 0?r:r_e;return i.jsxs("div",{className:l,style:c,children:[i.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),i.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:o,onChange:n,children:a}),i.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[s,i.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function n_e(e){var t,r=Zn(),n=r.fromDate,o=r.toDate,a=r.styles,s=r.locale,l=r.formatters.formatMonthCaption,c=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!n)return i.jsx(i.Fragment,{});if(!o)return i.jsx(i.Fragment,{});var f=[];if(Lke(n,o))for(var h=gs(n),p=n.getMonth();p<=o.getMonth();p++)f.push(pE(h,p));else for(var h=gs(new Date),p=0;p<=11;p++)f.push(pE(h,p));var v=function(b){var x=Number(b.target.value),w=pE(gs(e.displayMonth),x);e.onChange(w)},m=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:sK;return i.jsx(m,{name:"months","aria-label":d(),className:c.dropdown_month,style:a.dropdown_month,onChange:v,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:f.map(function(b){return i.jsx("option",{value:b.getMonth(),children:l(b,{locale:s})},b.getMonth())})})}function i_e(e){var t,r=e.displayMonth,n=Zn(),o=n.fromDate,a=n.toDate,s=n.locale,l=n.styles,c=n.classNames,u=n.components,d=n.formatters.formatYearCaption,f=n.labels.labelYearDropdown,h=[];if(!o)return i.jsx(i.Fragment,{});if(!a)return i.jsx(i.Fragment,{});for(var p=o.getFullYear(),v=a.getFullYear(),m=p;m<=v;m++)h.push(_B(QG(new Date),m));var b=function(w){var k=_B(gs(r),Number(w.target.value));e.onChange(k)},x=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:sK;return i.jsx(x,{name:"years","aria-label":f(),className:c.dropdown_year,style:l.dropdown_year,onChange:b,value:r.getFullYear(),caption:d(r,{locale:s}),children:h.map(function(w){return i.jsx("option",{value:w.getFullYear(),children:d(w,{locale:s})},w.getFullYear())})})}function o_e(e,t){var r=S.useState(e),n=r[0],o=r[1],a=t===void 0?n:t;return[a,o]}function a_e(e){var t=e.month,r=e.defaultMonth,n=e.today,o=t||r||n||new Date,a=e.toDate,s=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(a&&ub(a,o)<0){var u=-1*(c-1);o=gc(a,u)}return s&&ub(o,s)<0&&(o=s),gs(o)}function s_e(){var e=Zn(),t=a_e(e),r=o_e(t,e.month),n=r[0],o=r[1],a=function(s){var l;if(!e.disableNavigation){var c=gs(s);o(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[n,a]}function l_e(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,o=gs(e),a=gs(gc(o,n)),s=ub(a,o),l=[],c=0;c<s;c++){var u=gc(o,c);l.push(u)}return r&&(l=l.reverse()),l}function c_e(e,t){if(!t.disableNavigation){var r=t.toDate,n=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,s=n?a:1,l=gs(e);if(!r)return gc(l,s);var c=ub(r,e);if(!(c<a))return gc(l,s)}}function u_e(e,t){if(!t.disableNavigation){var r=t.fromDate,n=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,s=n?a:1,l=gs(e);if(!r)return gc(l,-s);var c=ub(l,r);if(!(c<=0))return gc(l,-s)}}var lK=S.createContext(void 0);function d_e(e){var t=Zn(),r=s_e(),n=r[0],o=r[1],a=l_e(n,t),s=c_e(n,t),l=u_e(n,t),c=function(f){return a.some(function(h){return t8(f,h)})},u=function(f,h){c(f)||(h&&nK(f,h)?o(gc(f,1+t.numberOfMonths*-1)):o(f))},d={currentMonth:n,displayMonths:a,goToMonth:o,goToDate:u,previousMonth:l,nextMonth:s,isDateDisplayed:c};return i.jsx(lK.Provider,{value:d,children:e.children})}function Ub(){var e=S.useContext(lK);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function CB(e){var t,r=Zn(),n=r.classNames,o=r.styles,a=r.components,s=Ub().goToMonth,l=function(d){s(gc(d,e.displayIndex?-e.displayIndex:0))},c=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:aK,u=i.jsx(c,{id:e.id,displayMonth:e.displayMonth});return i.jsxs("div",{className:n.caption_dropdowns,style:o.caption_dropdowns,children:[i.jsx("div",{className:n.vhidden,children:u}),i.jsx(n_e,{onChange:l,displayMonth:e.displayMonth}),i.jsx(i_e,{onChange:l,displayMonth:e.displayMonth})]})}function f_e(e){return i.jsx("svg",Sr({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:i.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function p_e(e){return i.jsx("svg",Sr({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:i.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var yw=S.forwardRef(function(e,t){var r=Zn(),n=r.classNames,o=r.styles,a=[n.button_reset,n.button];e.className&&a.push(e.className);var s=a.join(" "),l=Sr(Sr({},o.button_reset),o.button);return e.style&&Object.assign(l,e.style),i.jsx("button",Sr({},e,{ref:t,type:"button",className:s,style:l}))});function h_e(e){var t,r,n=Zn(),o=n.dir,a=n.locale,s=n.classNames,l=n.styles,c=n.labels,u=c.labelPrevious,d=c.labelNext,f=n.components;if(!e.nextMonth&&!e.previousMonth)return i.jsx(i.Fragment,{});var h=u(e.previousMonth,{locale:a}),p=[s.nav_button,s.nav_button_previous].join(" "),v=d(e.nextMonth,{locale:a}),m=[s.nav_button,s.nav_button_next].join(" "),b=(t=f==null?void 0:f.IconRight)!==null&&t!==void 0?t:p_e,x=(r=f==null?void 0:f.IconLeft)!==null&&r!==void 0?r:f_e;return i.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&i.jsx(yw,{name:"previous-month","aria-label":h,className:p,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?i.jsx(b,{className:s.nav_icon,style:l.nav_icon}):i.jsx(x,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&i.jsx(yw,{name:"next-month","aria-label":v,className:m,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?i.jsx(x,{className:s.nav_icon,style:l.nav_icon}):i.jsx(b,{className:s.nav_icon,style:l.nav_icon})})]})}function EB(e){var t=Zn().numberOfMonths,r=Ub(),n=r.previousMonth,o=r.nextMonth,a=r.goToMonth,s=r.displayMonths,l=s.findIndex(function(v){return t8(e.displayMonth,v)}),c=l===0,u=l===s.length-1,d=t>1&&(c||!u),f=t>1&&(u||!c),h=function(){n&&a(n)},p=function(){o&&a(o)};return i.jsx(h_e,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:o,previousMonth:n,onPreviousClick:h,onNextClick:p})}function g_e(e){var t,r=Zn(),n=r.classNames,o=r.disableNavigation,a=r.styles,s=r.captionLayout,l=r.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:aK,u;return o?u=i.jsx(c,{id:e.id,displayMonth:e.displayMonth}):s==="dropdown"?u=i.jsx(CB,{displayMonth:e.displayMonth,id:e.id}):s==="dropdown-buttons"?u=i.jsxs(i.Fragment,{children:[i.jsx(CB,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),i.jsx(EB,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=i.jsxs(i.Fragment,{children:[i.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),i.jsx(EB,{displayMonth:e.displayMonth,id:e.id})]}),i.jsx("div",{className:n.caption,style:a.caption,children:u})}function m_e(e){var t=Zn(),r=t.footer,n=t.styles,o=t.classNames.tfoot;return r?i.jsx("tfoot",{className:o,style:n.tfoot,children:i.jsx("tr",{children:i.jsx("td",{colSpan:8,children:r})})}):i.jsx(i.Fragment,{})}function v_e(e,t,r){for(var n=r?Oh(new Date):cu(new Date,{locale:e,weekStartsOn:t}),o=[],a=0;a<7;a++){var s=Da(n,a);o.push(s)}return o}function y_e(){var e=Zn(),t=e.classNames,r=e.styles,n=e.showWeekNumber,o=e.locale,a=e.weekStartsOn,s=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=v_e(o,a,s);return i.jsxs("tr",{style:r.head_row,className:t.head_row,children:[n&&i.jsx("td",{style:r.head_cell,className:t.head_cell}),u.map(function(d,f){return i.jsx("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":c(d,{locale:o}),children:l(d,{locale:o})},f)})]})}function x_e(){var e,t=Zn(),r=t.classNames,n=t.styles,o=t.components,a=(e=o==null?void 0:o.HeadRow)!==null&&e!==void 0?e:y_e;return i.jsx("thead",{style:n.head,className:r.head,children:i.jsx(a,{})})}function b_e(e){var t=Zn(),r=t.locale,n=t.formatters.formatDay;return i.jsx(i.Fragment,{children:n(e.date,{locale:r})})}var r8=S.createContext(void 0);function w_e(e){if(!qb(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return i.jsx(r8.Provider,{value:t,children:e.children})}return i.jsx(S_e,{initialProps:e.initialProps,children:e.children})}function S_e(e){var t=e.initialProps,r=e.children,n=t.selected,o=t.min,a=t.max,s=function(u,d,f){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,u,d,f);var v=!!(d.selected&&o&&(n==null?void 0:n.length)===o);if(!v){var m=!!(!d.selected&&a&&(n==null?void 0:n.length)===a);if(!m){var b=n?iK([],n):[];if(d.selected){var x=b.findIndex(function(w){return ds(u,w)});b.splice(x,1)}else b.push(u);(p=t.onSelect)===null||p===void 0||p.call(t,b,u,d,f)}}},l={disabled:[]};n&&l.disabled.push(function(u){var d=a&&n.length>a-1,f=n.some(function(h){return ds(h,u)});return!!(d&&!f)});var c={selected:n,onDayClick:s,modifiers:l};return i.jsx(r8.Provider,{value:c,children:r})}function n8(){var e=S.useContext(r8);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function j_e(e,t){var r=t||{},n=r.from,o=r.to;return n&&o?ds(o,e)&&ds(n,e)?void 0:ds(o,e)?{from:o,to:void 0}:ds(n,e)?void 0:g6(n,e)?{from:e,to:o}:{from:n,to:e}:o?g6(e,o)?{from:o,to:e}:{from:e,to:o}:n?nK(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var i8=S.createContext(void 0);function k_e(e){if(!$b(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return i.jsx(i8.Provider,{value:t,children:e.children})}return i.jsx(__e,{initialProps:e.initialProps,children:e.children})}function __e(e){var t=e.initialProps,r=e.children,n=t.selected,o=n||{},a=o.from,s=o.to,l=t.min,c=t.max,u=function(p,v,m){var b,x;(b=t.onDayClick)===null||b===void 0||b.call(t,p,v,m);var w=j_e(p,n);(x=t.onSelect)===null||x===void 0||x.call(t,w,p,v,m)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(d.range_start=[a],s?(d.range_end=[s],ds(a,s)||(d.range_middle=[{after:a,before:s}])):d.range_end=[a]):s&&(d.range_start=[s],d.range_end=[s]),l&&(a&&!s&&d.disabled.push({after:fE(a,l-1),before:Da(a,l-1)}),a&&s&&d.disabled.push({after:a,before:Da(a,l-1)}),!a&&s&&d.disabled.push({after:fE(s,l-1),before:Da(s,l-1)})),c){if(a&&!s&&(d.disabled.push({before:Da(a,-c+1)}),d.disabled.push({after:Da(a,c-1)})),a&&s){var f=eu(s,a)+1,h=c-f;d.disabled.push({before:fE(a,h)}),d.disabled.push({after:Da(s,h)})}!a&&s&&(d.disabled.push({before:Da(s,-c+1)}),d.disabled.push({after:Da(s,c-1)}))}return i.jsx(i8.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:r})}function o8(){var e=S.useContext(i8);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function W1(e){return Array.isArray(e)?iK([],e):e!==void 0?[e]:[]}function C_e(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],o=r[1];t[n]=W1(o)}),t}var mc;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(mc||(mc={}));var E_e=mc.Selected,Gu=mc.Disabled,A_e=mc.Hidden,T_e=mc.Today,hE=mc.RangeEnd,gE=mc.RangeMiddle,mE=mc.RangeStart,P_e=mc.Outside;function I_e(e,t,r){var n,o=(n={},n[E_e]=W1(e.selected),n[Gu]=W1(e.disabled),n[A_e]=W1(e.hidden),n[T_e]=[e.today],n[hE]=[],n[gE]=[],n[mE]=[],n[P_e]=[],n);return e.fromDate&&o[Gu].push({before:e.fromDate}),e.toDate&&o[Gu].push({after:e.toDate}),qb(e)?o[Gu]=o[Gu].concat(t.modifiers[Gu]):$b(e)&&(o[Gu]=o[Gu].concat(r.modifiers[Gu]),o[mE]=r.modifiers[mE],o[gE]=r.modifiers[gE],o[hE]=r.modifiers[hE]),o}var cK=S.createContext(void 0);function O_e(e){var t=Zn(),r=n8(),n=o8(),o=I_e(t,r,n),a=C_e(t.modifiers),s=Sr(Sr({},o),a);return i.jsx(cK.Provider,{value:s,children:e.children})}function uK(){var e=S.useContext(cK);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function N_e(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function R_e(e){return!!(e&&typeof e=="object"&&"from"in e)}function L_e(e){return!!(e&&typeof e=="object"&&"after"in e)}function F_e(e){return!!(e&&typeof e=="object"&&"before"in e)}function z_e(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function M_e(e,t){var r,n=t.from,o=t.to;if(n&&o){var a=eu(o,n)<0;a&&(r=[o,n],n=r[0],o=r[1]);var s=eu(e,n)>=0&&eu(o,e)>=0;return s}return o?ds(o,e):n?ds(n,e):!1}function D_e(e){return ZP(e)}function B_e(e){return Array.isArray(e)&&e.every(ZP)}function W_e(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(D_e(r))return ds(e,r);if(B_e(r))return r.includes(e);if(R_e(r))return M_e(e,r);if(z_e(r))return r.dayOfWeek.includes(e.getDay());if(N_e(r)){var n=eu(r.before,e),o=eu(r.after,e),a=n>0,s=o<0,l=g6(r.before,r.after);return l?s&&a:a||s}return L_e(r)?eu(e,r.after)>0:F_e(r)?eu(r.before,e)>0:typeof r=="function"?r(e):!1})}function a8(e,t,r){var n=Object.keys(t).reduce(function(a,s){var l=t[s];return W_e(e,l)&&a.push(s),a},[]),o={};return n.forEach(function(a){return o[a]=!0}),r&&!t8(e,r)&&(o.outside=!0),o}function q_e(e,t){for(var r=gs(e[0]),n=JP(e[e.length-1]),o,a,s=r;s<=n;){var l=a8(s,t),c=!l.disabled&&!l.hidden;if(!c){s=Da(s,1);continue}if(l.selected)return s;l.today&&!a&&(a=s),o||(o=s),s=Da(s,1)}return a||o}var $_e=365;function dK(e,t){var r=t.moveBy,n=t.direction,o=t.context,a=t.modifiers,s=t.retry,l=s===void 0?{count:0,lastFocused:e}:s,c=o.weekStartsOn,u=o.fromDate,d=o.toDate,f=o.locale,h={day:Da,week:h6,month:gc,year:I5e,startOfWeek:function(b){return o.ISOWeek?Oh(b):cu(b,{locale:f,weekStartsOn:c})},endOfWeek:function(b){return o.ISOWeek?XG(b):e8(b,{locale:f,weekStartsOn:c})}},p=h[r](e,n==="after"?1:-1);n==="before"&&u?p=O5e([u,p]):n==="after"&&d&&(p=N5e([d,p]));var v=!0;if(a){var m=a8(p,a);v=!m.disabled&&!m.hidden}return v?p:l.count>$_e?l.lastFocused:dK(p,{moveBy:r,direction:n,context:o,modifiers:a,retry:Sr(Sr({},l),{count:l.count+1})})}var fK=S.createContext(void 0);function U_e(e){var t=Ub(),r=uK(),n=S.useState(),o=n[0],a=n[1],s=S.useState(),l=s[0],c=s[1],u=q_e(t.displayMonths,r),d=o??(l&&t.isDateDisplayed(l))?l:u,f=function(){c(o),a(void 0)},h=function(b){a(b)},p=Zn(),v=function(b,x){if(o){var w=dK(o,{moveBy:b,direction:x,context:p,modifiers:r});ds(o,w)||(t.goToDate(w,o),h(w))}},m={focusedDay:o,focusTarget:d,blur:f,focus:h,focusDayAfter:function(){return v("day","after")},focusDayBefore:function(){return v("day","before")},focusWeekAfter:function(){return v("week","after")},focusWeekBefore:function(){return v("week","before")},focusMonthBefore:function(){return v("month","before")},focusMonthAfter:function(){return v("month","after")},focusYearBefore:function(){return v("year","before")},focusYearAfter:function(){return v("year","after")},focusStartOfWeek:function(){return v("startOfWeek","before")},focusEndOfWeek:function(){return v("endOfWeek","after")}};return i.jsx(fK.Provider,{value:m,children:e.children})}function s8(){var e=S.useContext(fK);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function H_e(e,t){var r=uK(),n=a8(e,r,t);return n}var l8=S.createContext(void 0);function V_e(e){if(!JS(e.initialProps)){var t={selected:void 0};return i.jsx(l8.Provider,{value:t,children:e.children})}return i.jsx(Y_e,{initialProps:e.initialProps,children:e.children})}function Y_e(e){var t=e.initialProps,r=e.children,n=function(a,s,l){var c,u,d;if((c=t.onDayClick)===null||c===void 0||c.call(t,a,s,l),s.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,a,s,l);return}(d=t.onSelect)===null||d===void 0||d.call(t,a,a,s,l)},o={selected:t.selected,onDayClick:n};return i.jsx(l8.Provider,{value:o,children:r})}function pK(){var e=S.useContext(l8);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function G_e(e,t){var r=Zn(),n=pK(),o=n8(),a=o8(),s=s8(),l=s.focusDayAfter,c=s.focusDayBefore,u=s.focusWeekAfter,d=s.focusWeekBefore,f=s.blur,h=s.focus,p=s.focusMonthBefore,v=s.focusMonthAfter,m=s.focusYearBefore,b=s.focusYearAfter,x=s.focusStartOfWeek,w=s.focusEndOfWeek,k=function(X){var $,ee,V,D;JS(r)?($=n.onDayClick)===null||$===void 0||$.call(n,e,t,X):qb(r)?(ee=o.onDayClick)===null||ee===void 0||ee.call(o,e,t,X):$b(r)?(V=a.onDayClick)===null||V===void 0||V.call(a,e,t,X):(D=r.onDayClick)===null||D===void 0||D.call(r,e,t,X)},j=function(X){var $;h(e),($=r.onDayFocus)===null||$===void 0||$.call(r,e,t,X)},_=function(X){var $;f(),($=r.onDayBlur)===null||$===void 0||$.call(r,e,t,X)},T=function(X){var $;($=r.onDayMouseEnter)===null||$===void 0||$.call(r,e,t,X)},A=function(X){var $;($=r.onDayMouseLeave)===null||$===void 0||$.call(r,e,t,X)},P=function(X){var $;($=r.onDayPointerEnter)===null||$===void 0||$.call(r,e,t,X)},N=function(X){var $;($=r.onDayPointerLeave)===null||$===void 0||$.call(r,e,t,X)},O=function(X){var $;($=r.onDayTouchCancel)===null||$===void 0||$.call(r,e,t,X)},C=function(X){var $;($=r.onDayTouchEnd)===null||$===void 0||$.call(r,e,t,X)},I=function(X){var $;($=r.onDayTouchMove)===null||$===void 0||$.call(r,e,t,X)},R=function(X){var $;($=r.onDayTouchStart)===null||$===void 0||$.call(r,e,t,X)},F=function(X){var $;($=r.onDayKeyUp)===null||$===void 0||$.call(r,e,t,X)},M=function(X){var $;switch(X.key){case"ArrowLeft":X.preventDefault(),X.stopPropagation(),r.dir==="rtl"?l():c();break;case"ArrowRight":X.preventDefault(),X.stopPropagation(),r.dir==="rtl"?c():l();break;case"ArrowDown":X.preventDefault(),X.stopPropagation(),u();break;case"ArrowUp":X.preventDefault(),X.stopPropagation(),d();break;case"PageUp":X.preventDefault(),X.stopPropagation(),X.shiftKey?m():p();break;case"PageDown":X.preventDefault(),X.stopPropagation(),X.shiftKey?b():v();break;case"Home":X.preventDefault(),X.stopPropagation(),x();break;case"End":X.preventDefault(),X.stopPropagation(),w();break}($=r.onDayKeyDown)===null||$===void 0||$.call(r,e,t,X)},Y={onClick:k,onFocus:j,onBlur:_,onKeyDown:M,onKeyUp:F,onMouseEnter:T,onMouseLeave:A,onPointerEnter:P,onPointerLeave:N,onTouchCancel:O,onTouchEnd:C,onTouchMove:I,onTouchStart:R};return Y}function K_e(){var e=Zn(),t=pK(),r=n8(),n=o8(),o=JS(e)?t.selected:qb(e)?r.selected:$b(e)?n.selected:void 0;return o}function Q_e(e){return Object.values(mc).includes(e)}function X_e(e,t){var r=[e.classNames.day];return Object.keys(t).forEach(function(n){var o=e.modifiersClassNames[n];if(o)r.push(o);else if(Q_e(n)){var a=e.classNames["day_".concat(n)];a&&r.push(a)}}),r}function Z_e(e,t){var r=Sr({},e.styles.day);return Object.keys(t).forEach(function(n){var o;r=Sr(Sr({},r),(o=e.modifiersStyles)===null||o===void 0?void 0:o[n])}),r}function J_e(e,t,r){var n,o,a,s=Zn(),l=s8(),c=H_e(e,t),u=G_e(e,c),d=K_e(),f=!!(s.onDayClick||s.mode!=="default");S.useEffect(function(){var T;c.outside||l.focusedDay&&f&&ds(l.focusedDay,e)&&((T=r.current)===null||T===void 0||T.focus())},[l.focusedDay,e,r,f,c.outside]);var h=X_e(s,c).join(" "),p=Z_e(s,c),v=!!(c.outside&&!s.showOutsideDays||c.hidden),m=(a=(o=s.components)===null||o===void 0?void 0:o.DayContent)!==null&&a!==void 0?a:b_e,b=i.jsx(m,{date:e,displayMonth:t,activeModifiers:c}),x={style:p,className:h,children:b,role:"gridcell"},w=l.focusTarget&&ds(l.focusTarget,e)&&!c.outside,k=l.focusedDay&&ds(l.focusedDay,e),j=Sr(Sr(Sr({},x),(n={disabled:c.disabled,role:"gridcell"},n["aria-selected"]=c.selected,n.tabIndex=k||w?0:-1,n)),u),_={isButton:f,isHidden:v,activeModifiers:c,selectedDays:d,buttonProps:j,divProps:x};return _}function eCe(e){var t=S.useRef(null),r=J_e(e.date,e.displayMonth,t);return r.isHidden?i.jsx("div",{role:"gridcell"}):r.isButton?i.jsx(yw,Sr({name:"day",ref:t},r.buttonProps)):i.jsx("div",Sr({},r.divProps))}function tCe(e){var t=e.number,r=e.dates,n=Zn(),o=n.onWeekNumberClick,a=n.styles,s=n.classNames,l=n.locale,c=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,d=u(Number(t),{locale:l});if(!o)return i.jsx("span",{className:s.weeknumber,style:a.weeknumber,children:d});var f=c(Number(t),{locale:l}),h=function(p){o(t,r,p)};return i.jsx(yw,{name:"week-number","aria-label":f,className:s.weeknumber,style:a.weeknumber,onClick:h,children:d})}function rCe(e){var t,r,n=Zn(),o=n.styles,a=n.classNames,s=n.showWeekNumber,l=n.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:eCe,u=(r=l==null?void 0:l.WeekNumber)!==null&&r!==void 0?r:tCe,d;return s&&(d=i.jsx("td",{className:a.cell,style:o.cell,children:i.jsx(u,{number:e.weekNumber,dates:e.dates})})),i.jsxs("tr",{className:a.row,style:o.row,children:[d,e.dates.map(function(f){return i.jsx("td",{className:a.cell,style:o.cell,role:"presentation",children:i.jsx(c,{displayMonth:e.displayMonth,date:f})},Oke(f))})]})}function AB(e,t,r){for(var n=r!=null&&r.ISOWeek?XG(t):e8(t,r),o=r!=null&&r.ISOWeek?Oh(e):cu(e,r),a=eu(n,o),s=[],l=0;l<=a;l++)s.push(Da(o,l));var c=s.reduce(function(u,d){var f=r!=null&&r.ISOWeek?JG(d):tK(d,r),h=u.find(function(p){return p.weekNumber===f});return h?(h.dates.push(d),u):(u.push({weekNumber:f,dates:[d]}),u)},[]);return c}function nCe(e,t){var r=AB(gs(e),JP(e),t);if(t!=null&&t.useFixedWeeks){var n=Rke(e,t);if(n<6){var o=r[r.length-1],a=o.dates[o.dates.length-1],s=h6(a,6-n),l=AB(h6(a,1),s,t);r.push.apply(r,l)}}return r}function iCe(e){var t,r,n,o=Zn(),a=o.locale,s=o.classNames,l=o.styles,c=o.hideHead,u=o.fixedWeeks,d=o.components,f=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,v=nCe(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:h}),m=(t=d==null?void 0:d.Head)!==null&&t!==void 0?t:x_e,b=(r=d==null?void 0:d.Row)!==null&&r!==void 0?r:rCe,x=(n=d==null?void 0:d.Footer)!==null&&n!==void 0?n:m_e;return i.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&i.jsx(m,{}),i.jsx("tbody",{className:s.tbody,style:l.tbody,children:v.map(function(w){return i.jsx(b,{displayMonth:e.displayMonth,dates:w.dates,weekNumber:w.weekNumber},w.weekNumber)})}),i.jsx(x,{displayMonth:e.displayMonth})]})}function oCe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var aCe=oCe()?S.useLayoutEffect:S.useEffect,vE=!1,sCe=0;function TB(){return"react-day-picker-".concat(++sCe)}function lCe(e){var t,r=e??(vE?TB():null),n=S.useState(r),o=n[0],a=n[1];return aCe(function(){o===null&&a(TB())},[]),S.useEffect(function(){vE===!1&&(vE=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function cCe(e){var t,r,n=Zn(),o=n.dir,a=n.classNames,s=n.styles,l=n.components,c=Ub().displayMonths,u=lCe(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),d=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[a.month],h=s.month,p=e.displayIndex===0,v=e.displayIndex===c.length-1,m=!p&&!v;o==="rtl"&&(t=[p,v],v=t[0],p=t[1]),p&&(f.push(a.caption_start),h=Sr(Sr({},h),s.caption_start)),v&&(f.push(a.caption_end),h=Sr(Sr({},h),s.caption_end)),m&&(f.push(a.caption_between),h=Sr(Sr({},h),s.caption_between));var b=(r=l==null?void 0:l.Caption)!==null&&r!==void 0?r:g_e;return i.jsxs("div",{className:f.join(" "),style:h,children:[i.jsx(b,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),i.jsx(iCe,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function uCe(e){var t=Zn(),r=t.classNames,n=t.styles;return i.jsx("div",{className:r.months,style:n.months,children:e.children})}function dCe(e){var t,r,n=e.initialProps,o=Zn(),a=s8(),s=Ub(),l=S.useState(!1),c=l[0],u=l[1];S.useEffect(function(){o.initialFocus&&a.focusTarget&&(c||(a.focus(a.focusTarget),u(!0)))},[o.initialFocus,c,a.focus,a.focusTarget,a]);var d=[o.classNames.root,o.className];o.numberOfMonths>1&&d.push(o.classNames.multiple_months),o.showWeekNumber&&d.push(o.classNames.with_weeknumber);var f=Sr(Sr({},o.styles.root),o.style),h=Object.keys(n).filter(function(v){return v.startsWith("data-")}).reduce(function(v,m){var b;return Sr(Sr({},v),(b={},b[m]=n[m],b))},{}),p=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:uCe;return i.jsx("div",Sr({className:d.join(" "),style:f,dir:o.dir,id:o.id,nonce:n.nonce,title:n.title,lang:n.lang},h,{children:i.jsx(p,{children:s.displayMonths.map(function(v,m){return i.jsx(cCe,{displayIndex:m,displayMonth:v},m)})})}))}function fCe(e){var t=e.children,r=Fke(e,["children"]);return i.jsx(t_e,{initialProps:r,children:i.jsx(d_e,{children:i.jsx(V_e,{initialProps:r,children:i.jsx(w_e,{initialProps:r,children:i.jsx(k_e,{initialProps:r,children:i.jsx(O_e,{children:i.jsx(U_e,{children:t})})})})})})})}function pCe(e){return i.jsx(fCe,Sr({},e,{children:i.jsx(dCe,{initialProps:e})}))}const PB=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,IB=Fr,hCe=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return IB(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:o,defaultVariants:a}=t,s=Object.keys(o).map(u=>{const d=r==null?void 0:r[u],f=a==null?void 0:a[u];if(d===null)return null;const h=PB(d)||PB(f);return o[u][h]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(v=>{let[m,b]=v;return Array.isArray(b)?b.includes({...a,...l}[m]):{...a,...l}[m]===b})?[...u,f,h]:u},[]);return IB(e,s,c,r==null?void 0:r.class,r==null?void 0:r.className)},OB=hCe("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9 rounded-md"}},defaultVariants:{variant:"default",size:"default"}});function gCe({className:e,classNames:t,showOutsideDays:r=!0,...n}){return i.jsx(pCe,{showOutsideDays:r,className:ea("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:ea(OB({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:ea("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",n.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:ea(OB({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({className:o,...a})=>i.jsx(vd,{className:ea("size-4",o),...a}),IconRight:({className:o,...a})=>i.jsx(ka,{className:ea("size-4",o),...a})},...n})}const mCe=["top","right","bottom","left"],Hf=Math.min,Us=Math.max,xw=Math.round,y1=Math.floor,au=e=>({x:e,y:e}),vCe={left:"right",right:"left",bottom:"top",top:"bottom"};function m6(e,t,r){return Us(e,Hf(t,r))}function wd(e,t){return typeof e=="function"?e(t):e}function Sd(e){return e.split("-")[0]}function Rv(e){return e.split("-")[1]}function c8(e){return e==="x"?"y":"x"}function u8(e){return e==="y"?"height":"width"}function tu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function d8(e){return c8(tu(e))}function yCe(e,t,r){r===void 0&&(r=!1);const n=Rv(e),o=d8(e),a=u8(o);let s=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=bw(s)),[s,bw(s)]}function xCe(e){const t=bw(e);return[v6(e),t,v6(t)]}function v6(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const NB=["left","right"],RB=["right","left"],bCe=["top","bottom"],wCe=["bottom","top"];function SCe(e,t,r){switch(e){case"top":case"bottom":return r?t?RB:NB:t?NB:RB;case"left":case"right":return t?bCe:wCe;default:return[]}}function jCe(e,t,r,n){const o=Rv(e);let a=SCe(Sd(e),r==="start",n);return o&&(a=a.map(s=>s+"-"+o),t&&(a=a.concat(a.map(v6)))),a}function bw(e){const t=Sd(e);return vCe[t]+e.slice(t.length)}function kCe(e){return{top:0,right:0,bottom:0,left:0,...e}}function hK(e){return typeof e!="number"?kCe(e):{top:e,right:e,bottom:e,left:e}}function ww(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function LB(e,t,r){let{reference:n,floating:o}=e;const a=tu(t),s=d8(t),l=u8(s),c=Sd(t),u=a==="y",d=n.x+n.width/2-o.width/2,f=n.y+n.height/2-o.height/2,h=n[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:n.y-o.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:f};break;case"left":p={x:n.x-o.width,y:f};break;default:p={x:n.x,y:n.y}}switch(Rv(t)){case"start":p[s]-=h*(r&&u?-1:1);break;case"end":p[s]+=h*(r&&u?-1:1);break}return p}async function _Ce(e,t){var r;t===void 0&&(t={});const{x:n,y:o,platform:a,rects:s,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=wd(t,e),v=hK(p),b=l[h?f==="floating"?"reference":"floating":f],x=ww(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(b)))==null||r?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),w=f==="floating"?{x:n,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),j=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},_=ww(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:k,strategy:c}):w);return{top:(x.top-_.top+v.top)/j.y,bottom:(_.bottom-x.bottom+v.bottom)/j.y,left:(x.left-_.left+v.left)/j.x,right:(_.right-x.right+v.right)/j.x}}const CCe=50,ECe=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:a=[],platform:s}=r,l=s.detectOverflow?s:{...s,detectOverflow:_Ce},c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=LB(u,n,c),h=n,p=0;const v={};for(let m=0;m<a.length;m++){const b=a[m];if(!b)continue;const{name:x,fn:w}=b,{x:k,y:j,data:_,reset:T}=await w({x:d,y:f,initialPlacement:n,placement:h,strategy:o,middlewareData:v,rects:u,platform:l,elements:{reference:e,floating:t}});d=k??d,f=j??f,v[x]={...v[x],..._},T&&p<CCe&&(p++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(u=T.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:d,y:f}=LB(u,h,c)),m=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:v}},ACe=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:a,platform:s,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=wd(e,t)||{};if(u==null)return{};const f=hK(d),h={x:r,y:n},p=d8(o),v=u8(p),m=await s.getDimensions(u),b=p==="y",x=b?"top":"left",w=b?"bottom":"right",k=b?"clientHeight":"clientWidth",j=a.reference[v]+a.reference[p]-h[p]-a.floating[v],_=h[p]-a.reference[p],T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let A=T?T[k]:0;(!A||!await(s.isElement==null?void 0:s.isElement(T)))&&(A=l.floating[k]||a.floating[v]);const P=j/2-_/2,N=A/2-m[v]/2-1,O=Hf(f[x],N),C=Hf(f[w],N),I=O,R=A-m[v]-C,F=A/2-m[v]/2+P,M=m6(I,F,R),Y=!c.arrow&&Rv(o)!=null&&F!==M&&a.reference[v]/2-(F<I?O:C)-m[v]/2<0,X=Y?F<I?F-I:F-R:0;return{[p]:h[p]+X,data:{[p]:M,centerOffset:F-M-X,...Y&&{alignmentOffset:X}},reset:Y}}}),TCe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:o,middlewareData:a,rects:s,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:m=!0,...b}=wd(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const x=Sd(o),w=tu(l),k=Sd(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=h||(k||!m?[bw(l)]:xCe(l)),T=v!=="none";!h&&T&&_.push(...jCe(l,m,v,j));const A=[l,..._],P=await c.detectOverflow(t,b),N=[];let O=((n=a.flip)==null?void 0:n.overflows)||[];if(d&&N.push(P[x]),f){const F=yCe(o,s,j);N.push(P[F[0]],P[F[1]])}if(O=[...O,{placement:o,overflows:N}],!N.every(F=>F<=0)){var C,I;const F=(((C=a.flip)==null?void 0:C.index)||0)+1,M=A[F];if(M&&(!(f==="alignment"?w!==tu(M):!1)||O.every($=>tu($.placement)===w?$.overflows[0]>0:!0)))return{data:{index:F,overflows:O},reset:{placement:M}};let Y=(I=O.filter(X=>X.overflows[0]<=0).sort((X,$)=>X.overflows[1]-$.overflows[1])[0])==null?void 0:I.placement;if(!Y)switch(p){case"bestFit":{var R;const X=(R=O.filter($=>{if(T){const ee=tu($.placement);return ee===w||ee==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ee=>ee>0).reduce((ee,V)=>ee+V,0)]).sort(($,ee)=>$[1]-ee[1])[0])==null?void 0:R[0];X&&(Y=X);break}case"initialPlacement":Y=l;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function FB(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zB(e){return mCe.some(t=>e[t]>=0)}const PCe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:o="referenceHidden",...a}=wd(e,t);switch(o){case"referenceHidden":{const s=await n.detectOverflow(t,{...a,elementContext:"reference"}),l=FB(s,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zB(l)}}}case"escaped":{const s=await n.detectOverflow(t,{...a,altBoundary:!0}),l=FB(s,r.floating);return{data:{escapedOffsets:l,escaped:zB(l)}}}default:return{}}}}},gK=new Set(["left","top"]);async function ICe(e,t){const{placement:r,platform:n,elements:o}=e,a=await(n.isRTL==null?void 0:n.isRTL(o.floating)),s=Sd(r),l=Rv(r),c=tu(r)==="y",u=gK.has(s)?-1:1,d=a&&c?-1:1,f=wd(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof v=="number"&&(p=l==="end"?v*-1:v),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const OCe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:a,placement:s,middlewareData:l}=t,c=await ICe(t,e);return s===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:o+c.x,y:a+c.y,data:{...c,placement:s}}}}},NCe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o,platform:a}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:x=>{let{x:w,y:k}=x;return{x:w,y:k}}},...u}=wd(e,t),d={x:r,y:n},f=await a.detectOverflow(t,u),h=tu(Sd(o)),p=c8(h);let v=d[p],m=d[h];if(s){const x=p==="y"?"top":"left",w=p==="y"?"bottom":"right",k=v+f[x],j=v-f[w];v=m6(k,v,j)}if(l){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",k=m+f[x],j=m-f[w];m=m6(k,m,j)}const b=c.fn({...t,[p]:v,[h]:m});return{...b,data:{x:b.x-r,y:b.y-n,enabled:{[p]:s,[h]:l}}}}}},RCe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:a,middlewareData:s}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=wd(e,t),d={x:r,y:n},f=tu(o),h=c8(f);let p=d[h],v=d[f];const m=wd(l,t),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=h==="y"?"height":"width",j=a.reference[h]-a.floating[k]+b.mainAxis,_=a.reference[h]+a.reference[k]-b.mainAxis;p<j?p=j:p>_&&(p=_)}if(u){var x,w;const k=h==="y"?"width":"height",j=gK.has(Sd(o)),_=a.reference[f]-a.floating[k]+(j&&((x=s.offset)==null?void 0:x[f])||0)+(j?0:b.crossAxis),T=a.reference[f]+a.reference[k]+(j?0:((w=s.offset)==null?void 0:w[f])||0)-(j?b.crossAxis:0);v<_?v=_:v>T&&(v=T)}return{[h]:p,[f]:v}}}},LCe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:a,platform:s,elements:l}=t,{apply:c=()=>{},...u}=wd(e,t),d=await s.detectOverflow(t,u),f=Sd(o),h=Rv(o),p=tu(o)==="y",{width:v,height:m}=a.floating;let b,x;f==="top"||f==="bottom"?(b=f,x=h===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(x=f,b=h==="end"?"top":"bottom");const w=m-d.top-d.bottom,k=v-d.left-d.right,j=Hf(m-d[b],w),_=Hf(v-d[x],k),T=!t.middlewareData.shift;let A=j,P=_;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(P=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(A=w),T&&!h){const O=Us(d.left,0),C=Us(d.right,0),I=Us(d.top,0),R=Us(d.bottom,0);p?P=v-2*(O!==0||C!==0?O+C:Us(d.left,d.right)):A=m-2*(I!==0||R!==0?I+R:Us(d.top,d.bottom))}await c({...t,availableWidth:P,availableHeight:A});const N=await s.getDimensions(l.floating);return v!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function ej(){return typeof window<"u"}function Lv(e){return mK(e)?(e.nodeName||"").toLowerCase():"#document"}function Qs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pu(e){var t;return(t=(mK(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mK(e){return ej()?e instanceof Node||e instanceof Qs(e).Node:!1}function vc(e){return ej()?e instanceof Element||e instanceof Qs(e).Element:!1}function Nd(e){return ej()?e instanceof HTMLElement||e instanceof Qs(e).HTMLElement:!1}function MB(e){return!ej()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qs(e).ShadowRoot}function Hb(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=yc(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&o!=="inline"&&o!=="contents"}function FCe(e){return/^(table|td|th)$/.test(Lv(e))}function tj(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const zCe=/transform|translate|scale|rotate|perspective|filter/,MCe=/paint|layout|strict|content/,Wp=e=>!!e&&e!=="none";let yE;function f8(e){const t=vc(e)?yc(e):e;return Wp(t.transform)||Wp(t.translate)||Wp(t.scale)||Wp(t.rotate)||Wp(t.perspective)||!p8()&&(Wp(t.backdropFilter)||Wp(t.filter))||zCe.test(t.willChange||"")||MCe.test(t.contain||"")}function DCe(e){let t=Vf(e);for(;Nd(t)&&!uv(t);){if(f8(t))return t;if(tj(t))return null;t=Vf(t)}return null}function p8(){return yE==null&&(yE=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yE}function uv(e){return/^(html|body|#document)$/.test(Lv(e))}function yc(e){return Qs(e).getComputedStyle(e)}function rj(e){return vc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Vf(e){if(Lv(e)==="html")return e;const t=e.assignedSlot||e.parentNode||MB(e)&&e.host||pu(e);return MB(t)?t.host:t}function vK(e){const t=Vf(e);return uv(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nd(t)&&Hb(t)?t:vK(t)}function db(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=vK(e),a=o===((n=e.ownerDocument)==null?void 0:n.body),s=Qs(o);if(a){const l=y6(s);return t.concat(s,s.visualViewport||[],Hb(o)?o:[],l&&r?db(l):[])}else return t.concat(o,db(o,[],r))}function y6(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yK(e){const t=yc(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=Nd(e),a=o?e.offsetWidth:r,s=o?e.offsetHeight:n,l=xw(r)!==a||xw(n)!==s;return l&&(r=a,n=s),{width:r,height:n,$:l}}function h8(e){return vc(e)?e:e.contextElement}function xm(e){const t=h8(e);if(!Nd(t))return au(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:a}=yK(t);let s=(a?xw(r.width):r.width)/n,l=(a?xw(r.height):r.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const BCe=au(0);function xK(e){const t=Qs(e);return!p8()||!t.visualViewport?BCe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function WCe(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Qs(e)?!1:t}function Nh(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),a=h8(e);let s=au(1);t&&(n?vc(n)&&(s=xm(n)):s=xm(e));const l=WCe(a,r,n)?xK(a):au(0);let c=(o.left+l.x)/s.x,u=(o.top+l.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(a){const h=Qs(a),p=n&&vc(n)?Qs(n):n;let v=h,m=y6(v);for(;m&&n&&p!==v;){const b=xm(m),x=m.getBoundingClientRect(),w=yc(m),k=x.left+(m.clientLeft+parseFloat(w.paddingLeft))*b.x,j=x.top+(m.clientTop+parseFloat(w.paddingTop))*b.y;c*=b.x,u*=b.y,d*=b.x,f*=b.y,c+=k,u+=j,v=Qs(m),m=y6(v)}}return ww({width:d,height:f,x:c,y:u})}function nj(e,t){const r=rj(e).scrollLeft;return t?t.left+r:Nh(pu(e)).left+r}function bK(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-nj(e,r),o=r.top+t.scrollTop;return{x:n,y:o}}function qCe(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const a=o==="fixed",s=pu(n),l=t?tj(t.floating):!1;if(n===s||l&&a)return r;let c={scrollLeft:0,scrollTop:0},u=au(1);const d=au(0),f=Nd(n);if((f||!f&&!a)&&((Lv(n)!=="body"||Hb(s))&&(c=rj(n)),f)){const p=Nh(n);u=xm(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const h=s&&!f&&!a?bK(s,c):au(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:r.y*u.y-c.scrollTop*u.y+d.y+h.y}}function $Ce(e){return Array.from(e.getClientRects())}function UCe(e){const t=pu(e),r=rj(e),n=e.ownerDocument.body,o=Us(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=Us(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-r.scrollLeft+nj(e);const l=-r.scrollTop;return yc(n).direction==="rtl"&&(s+=Us(t.clientWidth,n.clientWidth)-o),{width:o,height:a,x:s,y:l}}const DB=25;function HCe(e,t){const r=Qs(e),n=pu(e),o=r.visualViewport;let a=n.clientWidth,s=n.clientHeight,l=0,c=0;if(o){a=o.width,s=o.height;const d=p8();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=nj(n);if(u<=0){const d=n.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(n.clientWidth-f.clientWidth-p);v<=DB&&(a-=v)}else u<=DB&&(a+=u);return{width:a,height:s,x:l,y:c}}function VCe(e,t){const r=Nh(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,a=Nd(e)?xm(e):au(1),s=e.clientWidth*a.x,l=e.clientHeight*a.y,c=o*a.x,u=n*a.y;return{width:s,height:l,x:c,y:u}}function BB(e,t,r){let n;if(t==="viewport")n=HCe(e,r);else if(t==="document")n=UCe(pu(e));else if(vc(t))n=VCe(t,r);else{const o=xK(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ww(n)}function wK(e,t){const r=Vf(e);return r===t||!vc(r)||uv(r)?!1:yc(r).position==="fixed"||wK(r,t)}function YCe(e,t){const r=t.get(e);if(r)return r;let n=db(e,[],!1).filter(l=>vc(l)&&Lv(l)!=="body"),o=null;const a=yc(e).position==="fixed";let s=a?Vf(e):e;for(;vc(s)&&!uv(s);){const l=yc(s),c=f8(s);!c&&l.position==="fixed"&&(o=null),(a?!c&&!o:!c&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Hb(s)&&!c&&wK(e,s))?n=n.filter(d=>d!==s):o=l,s=Vf(s)}return t.set(e,n),n}function GCe(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const s=[...r==="clippingAncestors"?tj(t)?[]:YCe(t,this._c):[].concat(r),n],l=BB(t,s[0],o);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let h=1;h<s.length;h++){const p=BB(t,s[h],o);c=Us(p.top,c),u=Hf(p.right,u),d=Hf(p.bottom,d),f=Us(p.left,f)}return{width:u-f,height:d-c,x:f,y:c}}function KCe(e){const{width:t,height:r}=yK(e);return{width:t,height:r}}function QCe(e,t,r){const n=Nd(t),o=pu(t),a=r==="fixed",s=Nh(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=au(0);function u(){c.x=nj(o)}if(n||!n&&!a)if((Lv(t)!=="body"||Hb(o))&&(l=rj(t)),n){const p=Nh(t,!0,a,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&u();a&&!n&&o&&u();const d=o&&!n&&!a?bK(o,l):au(0),f=s.left+l.scrollLeft-c.x-d.x,h=s.top+l.scrollTop-c.y-d.y;return{x:f,y:h,width:s.width,height:s.height}}function xE(e){return yc(e).position==="static"}function WB(e,t){if(!Nd(e)||yc(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pu(e)===r&&(r=r.ownerDocument.body),r}function SK(e,t){const r=Qs(e);if(tj(e))return r;if(!Nd(e)){let o=Vf(e);for(;o&&!uv(o);){if(vc(o)&&!xE(o))return o;o=Vf(o)}return r}let n=WB(e,t);for(;n&&FCe(n)&&xE(n);)n=WB(n,t);return n&&uv(n)&&xE(n)&&!f8(n)?r:n||DCe(e)||r}const XCe=async function(e){const t=this.getOffsetParent||SK,r=this.getDimensions,n=await r(e.floating);return{reference:QCe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function ZCe(e){return yc(e).direction==="rtl"}const JCe={convertOffsetParentRelativeRectToViewportRelativeRect:qCe,getDocumentElement:pu,getClippingRect:GCe,getOffsetParent:SK,getElementRects:XCe,getClientRects:$Ce,getDimensions:KCe,getScale:xm,isElement:vc,isRTL:ZCe};function jK(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function e4e(e,t){let r=null,n;const o=pu(e);function a(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const u=e.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=u;if(l||t(),!h||!p)return;const v=y1(f),m=y1(o.clientWidth-(d+h)),b=y1(o.clientHeight-(f+p)),x=y1(d),k={rootMargin:-v+"px "+-m+"px "+-b+"px "+-x+"px",threshold:Us(0,Hf(1,c))||1};let j=!0;function _(T){const A=T[0].intersectionRatio;if(A!==c){if(!j)return s();A?s(!1,A):n=setTimeout(()=>{s(!1,1e-7)},1e3)}A===1&&!jK(u,e.getBoundingClientRect())&&s(),j=!1}try{r=new IntersectionObserver(_,{...k,root:o.ownerDocument})}catch{r=new IntersectionObserver(_,k)}r.observe(e)}return s(!0),a}function t4e(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=h8(e),d=o||a?[...u?db(u):[],...t?db(t):[]]:[];d.forEach(x=>{o&&x.addEventListener("scroll",r,{passive:!0}),a&&x.addEventListener("resize",r)});const f=u&&l?e4e(u,r):null;let h=-1,p=null;s&&(p=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),r()}),u&&!c&&p.observe(u),t&&p.observe(t));let v,m=c?Nh(e):null;c&&b();function b(){const x=Nh(e);m&&!jK(m,x)&&r(),m=x,v=requestAnimationFrame(b)}return r(),()=>{var x;d.forEach(w=>{o&&w.removeEventListener("scroll",r),a&&w.removeEventListener("resize",r)}),f==null||f(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(v)}}const r4e=OCe,n4e=NCe,i4e=TCe,o4e=LCe,a4e=PCe,qB=ACe,s4e=RCe,l4e=(e,t,r)=>{const n=new Map,o={platform:JCe,...r},a={...o.platform,_c:n};return ECe(e,t,{...o,platform:a})};var c4e=typeof document<"u",u4e=function(){},q1=c4e?S.useLayoutEffect:u4e;function Sw(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Sw(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const a=o[n];if(!(a==="_owner"&&e.$$typeof)&&!Sw(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function kK(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $B(e,t){const r=kK(e);return Math.round(t*r)/r}function bE(e){const t=S.useRef(e);return q1(()=>{t.current=e}),t}function d4e(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=S.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=S.useState(n);Sw(h,n)||p(n);const[v,m]=S.useState(null),[b,x]=S.useState(null),w=S.useCallback($=>{$!==T.current&&(T.current=$,m($))},[]),k=S.useCallback($=>{$!==A.current&&(A.current=$,x($))},[]),j=a||v,_=s||b,T=S.useRef(null),A=S.useRef(null),P=S.useRef(d),N=c!=null,O=bE(c),C=bE(o),I=bE(u),R=S.useCallback(()=>{if(!T.current||!A.current)return;const $={placement:t,strategy:r,middleware:h};C.current&&($.platform=C.current),l4e(T.current,A.current,$).then(ee=>{const V={...ee,isPositioned:I.current!==!1};F.current&&!Sw(P.current,V)&&(P.current=V,iT.flushSync(()=>{f(V)}))})},[h,t,r,C,I]);q1(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const F=S.useRef(!1);q1(()=>(F.current=!0,()=>{F.current=!1}),[]),q1(()=>{if(j&&(T.current=j),_&&(A.current=_),j&&_){if(O.current)return O.current(j,_,R);R()}},[j,_,R,O,N]);const M=S.useMemo(()=>({reference:T,floating:A,setReference:w,setFloating:k}),[w,k]),Y=S.useMemo(()=>({reference:j,floating:_}),[j,_]),X=S.useMemo(()=>{const $={position:r,left:0,top:0};if(!Y.floating)return $;const ee=$B(Y.floating,d.x),V=$B(Y.floating,d.y);return l?{...$,transform:"translate("+ee+"px, "+V+"px)",...kK(Y.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ee,top:V}},[r,l,Y.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:R,refs:M,elements:Y,floatingStyles:X}),[d,R,M,Y,X])}const f4e=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?qB({element:n.current,padding:o}).fn(r):{}:n?qB({element:n,padding:o}).fn(r):{}}}},p4e=(e,t)=>{const r=r4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},h4e=(e,t)=>{const r=n4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},g4e=(e,t)=>({fn:s4e(e).fn,options:[e,t]}),m4e=(e,t)=>{const r=i4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},v4e=(e,t)=>{const r=o4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},y4e=(e,t)=>{const r=a4e(e);return{name:r.name,fn:r.fn,options:[e,t]}},x4e=(e,t)=>{const r=f4e(e);return{name:r.name,fn:r.fn,options:[e,t]}};var b4e="Arrow",_K=S.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...a}=e;return i.jsx(_a.svg,{...a,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});_K.displayName=b4e;var w4e=_K;function CK(e){const[t,r]=S.useState(void 0);return jh(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let s,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,l=u.blockSize}else s=e.offsetWidth,l=e.offsetHeight;r({width:s,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var g8="Popper",[EK,AK]=uS(g8),[S4e,TK]=EK(g8),PK=e=>{const{__scopePopper:t,children:r}=e,[n,o]=S.useState(null);return i.jsx(S4e,{scope:t,anchor:n,onAnchorChange:o,children:r})};PK.displayName=g8;var IK="PopperAnchor",OK=S.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,a=TK(IK,r),s=S.useRef(null),l=zl(t,s);return S.useEffect(()=>{a.onAnchorChange((n==null?void 0:n.current)||s.current)}),n?null:i.jsx(_a.div,{...o,ref:l})});OK.displayName=IK;var m8="PopperContent",[j4e,k4e]=EK(m8),NK=S.forwardRef((e,t)=>{var K,re,H,ie,de,le;const{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:a="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:v,...m}=e,b=TK(m8,r),[x,w]=S.useState(null),k=zl(t,ke=>w(ke)),[j,_]=S.useState(null),T=CK(j),A=(T==null?void 0:T.width)??0,P=(T==null?void 0:T.height)??0,N=n+(a!=="center"?"-"+a:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},C=Array.isArray(u)?u:[u],I=C.length>0,R={padding:O,boundary:C.filter(C4e),altBoundary:I},{refs:F,floatingStyles:M,placement:Y,isPositioned:X,middlewareData:$}=d4e({strategy:"fixed",placement:N,whileElementsMounted:(...ke)=>t4e(...ke,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[p4e({mainAxis:o+P,alignmentAxis:s}),c&&h4e({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?g4e():void 0,...R}),c&&m4e({...R}),v4e({...R,apply:({elements:ke,rects:ve,availableWidth:se,availableHeight:be})=>{const{width:De,height:ae}=ve.reference,ue=ke.floating.style;ue.setProperty("--radix-popper-available-width",`${se}px`),ue.setProperty("--radix-popper-available-height",`${be}px`),ue.setProperty("--radix-popper-anchor-width",`${De}px`),ue.setProperty("--radix-popper-anchor-height",`${ae}px`)}}),j&&x4e({element:j,padding:l}),E4e({arrowWidth:A,arrowHeight:P}),h&&y4e({strategy:"referenceHidden",...R})]}),[ee,V]=FK(Y),D=qf(v);jh(()=>{X&&(D==null||D())},[X,D]);const z=(K=$.arrow)==null?void 0:K.x,q=(re=$.arrow)==null?void 0:re.y,G=((H=$.arrow)==null?void 0:H.centerOffset)!==0,[U,Q]=S.useState();return jh(()=>{x&&Q(window.getComputedStyle(x).zIndex)},[x]),i.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:X?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(ie=$.transformOrigin)==null?void 0:ie.x,(de=$.transformOrigin)==null?void 0:de.y].join(" "),...((le=$.hide)==null?void 0:le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(j4e,{scope:r,placedSide:ee,onArrowChange:_,arrowX:z,arrowY:q,shouldHideArrow:G,children:i.jsx(_a.div,{"data-side":ee,"data-align":V,...m,ref:k,style:{...m.style,animation:X?void 0:"none"}})})})});NK.displayName=m8;var RK="PopperArrow",_4e={top:"bottom",right:"left",bottom:"top",left:"right"},LK=S.forwardRef(function(t,r){const{__scopePopper:n,...o}=t,a=k4e(RK,n),s=_4e[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(w4e,{...o,ref:r,style:{...o.style,display:"block"}})})});LK.displayName=RK;function C4e(e){return e!==null}var E4e=e=>({name:"transformOrigin",options:e,fn(t){var b,x,w;const{placement:r,rects:n,middlewareData:o}=t,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[u,d]=FK(r),f={start:"0%",center:"50%",end:"100%"}[d],h=(((x=o.arrow)==null?void 0:x.x)??0)+l/2,p=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let v="",m="";return u==="bottom"?(v=s?f:`${h}px`,m=`${-c}px`):u==="top"?(v=s?f:`${h}px`,m=`${n.floating.height+c}px`):u==="right"?(v=`${-c}px`,m=s?f:`${p}px`):u==="left"&&(v=`${n.floating.width+c}px`,m=s?f:`${p}px`),{data:{x:v,y:m}}}});function FK(e){const[t,r="center"]=e.split("-");return[t,r]}var A4e=PK,zK=OK,T4e=NK,P4e=LK,v8="Popover",[MK]=uS(v8,[AK]),Vb=AK(),[I4e,np]=MK(v8),DK=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:o,onOpenChange:a,modal:s=!1}=e,l=Vb(t),c=S.useRef(null),[u,d]=S.useState(!1),[f=!1,h]=xT({prop:n,defaultProp:o,onChange:a});return i.jsx(A4e,{...l,children:i.jsx(I4e,{scope:t,contentId:F1(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:S.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:S.useCallback(()=>d(!0),[]),onCustomAnchorRemove:S.useCallback(()=>d(!1),[]),modal:s,children:r})})};DK.displayName=v8;var BK="PopoverAnchor",O4e=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=np(BK,r),a=Vb(r),{onCustomAnchorAdd:s,onCustomAnchorRemove:l}=o;return S.useEffect(()=>(s(),()=>l()),[s,l]),i.jsx(zK,{...a,...n,ref:t})});O4e.displayName=BK;var WK="PopoverTrigger",qK=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=np(WK,r),a=Vb(r),s=zl(t,o.triggerRef),l=i.jsx(_a.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":YK(o.open),...n,ref:s,onClick:hs(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:i.jsx(zK,{asChild:!0,...a,children:l})});qK.displayName=WK;var y8="PopoverPortal",[N4e,R4e]=MK(y8,{forceMount:void 0}),$K=e=>{const{__scopePopover:t,forceMount:r,children:n,container:o}=e,a=np(y8,t);return i.jsx(N4e,{scope:t,forceMount:r,children:i.jsx(Sv,{present:r||a.open,children:i.jsx(ST,{asChild:!0,container:o,children:n})})})};$K.displayName=y8;var dv="PopoverContent",UK=S.forwardRef((e,t)=>{const r=R4e(dv,e.__scopePopover),{forceMount:n=r.forceMount,...o}=e,a=np(dv,e.__scopePopover);return i.jsx(Sv,{present:n||a.open,children:a.modal?i.jsx(L4e,{...o,ref:t}):i.jsx(F4e,{...o,ref:t})})});UK.displayName=dv;var L4e=S.forwardRef((e,t)=>{const r=np(dv,e.__scopePopover),n=S.useRef(null),o=zl(t,n),a=S.useRef(!1);return S.useEffect(()=>{const s=n.current;if(s)return $$(s)},[]),i.jsx(jT,{as:dS,allowPinchZoom:!0,children:i.jsx(HK,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:hs(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),a.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:hs(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;a.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:hs(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),F4e=S.forwardRef((e,t)=>{const r=np(dv,e.__scopePopover),n=S.useRef(!1),o=S.useRef(!1);return i.jsx(HK,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var s,l;(s=e.onCloseAutoFocus)==null||s.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(s))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),HK=S.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,h=np(dv,r),p=Vb(r);return R$(),i.jsx(wT,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:a,children:i.jsx(bT,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:i.jsx(T4e,{"data-state":YK(h.open),role:"dialog",id:h.contentId,...p,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),VK="PopoverClose",z4e=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=np(VK,r);return i.jsx(_a.button,{type:"button",...n,ref:t,onClick:hs(e.onClick,()=>o.onOpenChange(!1))})});z4e.displayName=VK;var M4e="PopoverArrow",D4e=S.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,o=Vb(r);return i.jsx(P4e,{...o,...n,ref:t})});D4e.displayName=M4e;function YK(e){return e?"open":"closed"}var B4e=DK,W4e=qK,q4e=$K,$4e=UK;function U4e({...e}){return i.jsx(B4e,{"data-slot":"popover",...e})}function H4e({...e}){return i.jsx(W4e,{"data-slot":"popover-trigger",...e})}function V4e({className:e,align:t="center",sideOffset:r=4,...n}){return i.jsx(q4e,{children:i.jsx($4e,{"data-slot":"popover-content",align:t,sideOffset:r,className:ea("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}const UB="eventbuzz_setup_checklist_dismissed",Y4e=["organisation","event","session","team","notifications"];function G4e(e){return e?[e.description,e.email,e.phone,e.website,e.address,e.logo,e.timezone,e.dateFormat,e.language].some(r=>r!=null&&String(r).trim()!==""):!1}function K4e(e,t){return e.some(r=>String(r._id)!==String(t))}function Q4e(e){return Y4e.every(t=>e[t]===!0)}function X4e(e){const t=String(e||"conference").toLowerCase().replace(/[\s_-]+/g,"");return{conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"}[t]||"Conference"}function Z4e(e){const t=String(e||"draft").toLowerCase();return{live:"Live",upcoming:"Upcoming",completed:"Completed",draft:"Draft"}[t]||"Draft"}function jw(e){return(typeof e=="string"?new Date(e):e).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}function J4e(e,t){var c,u,d;const r=Z4e(e.status),n=X4e(e.type),o=(e.locationType||"physical").toLowerCase(),a=o==="virtual"?"Virtual":o==="hybrid"?"Hybrid":"Physical",s=typeof e.startDate=="string"?e.startDate:new Date(e.startDate).toISOString(),l=typeof e.endDate=="string"?e.endDate:new Date(e.endDate).toISOString();return{id:e._id,name:e.name,subtitle:e.subtitle,categoryId:t,type:n,status:r,startDate:s,endDate:l,location:e.location||"",locationType:a,participants:0,sessions:0,totalRevenue:(c=e.metadata)==null?void 0:c.totalRevenue,rating:(u=e.metadata)==null?void 0:u.rating,ratingCount:(d=e.metadata)==null?void 0:d.ratingCount}}function eEe(e){return[{id:"all",name:"All Events",description:"",accent:"var(--chart-1)",events:e.map(n=>J4e(n,"all"))}]}const x8={Live:{bg:"#dcfce7",color:"#15803d",label:"Live"},Upcoming:{bg:"#dbeafe",color:"#1d4ed8",label:"Upcoming"},Completed:{bg:"#f1f5f9",color:"#475569",label:"Completed"},Draft:{bg:"#ffedd5",color:"#c2410c",label:"Draft"}},tEe={Conference:{bg:"#ede9fe",color:"#5b21b6"},Workshop:{bg:"#ffedd5",color:"#c2410c"},Summit:{bg:"#fce7f3",color:"#be185d"},CME:{bg:"#ccfbf1",color:"#0d9488"},Webinar:{bg:"#e0e7ff",color:"#3730a3"}},rEe={bg:"#f1f5f9",color:"#475569"},b8={bg:"#f1f5f9",color:"#475569",label:"Unknown"},w8={Physical:i.jsx(_b,{size:11}),Virtual:i.jsx(Wf,{size:11}),Hybrid:i.jsx(cS,{size:11})};function S8({status:e}){const t=x8[e]??b8;return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"999px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:[e==="Live"&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"block",animation:"pulse 1.5s infinite"}}),t.label]})}function j8({type:e}){const t=tEe[e]??rEe;return i.jsx("span",{style:{display:"inline-flex",padding:"2px 7px",borderRadius:"3px",background:t.bg,color:t.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:e})}function GK({name:e,accent:t}){return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 0px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:t,whiteSpace:"nowrap"},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:t,display:"block",flexShrink:0}}),e]})}function HB({icon:e,value:t,label:r}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex"},children:e}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",fontWeight:"var(--font-weight-medium)"},children:t}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:r})]})}function nEe({items:e}){const[t,r]=S.useState(!1),n=S.useRef(null);return S.useEffect(()=>{const o=a=>{n.current&&!n.current.contains(a.target)&&r(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[]),i.jsxs("div",{ref:n,style:{position:"relative"},children:[i.jsx("button",{onClick:o=>{o.stopPropagation(),r(a=>!a)},style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"1px solid transparent",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:o=>{o.currentTarget.style.background="var(--secondary)",o.currentTarget.style.borderColor="var(--border)"},onMouseLeave:o=>{t||(o.currentTarget.style.background="transparent",o.currentTarget.style.borderColor="transparent")},children:i.jsx($te,{size:14})}),t&&i.jsx("div",{style:{position:"absolute",right:0,top:"calc(100% + 4px)",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--shadow-md)",zIndex:50,minWidth:"160px",overflow:"hidden"},children:e.map((o,a)=>i.jsxs("button",{onClick:()=>{o.onClick(),r(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:"none",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:o.danger?"var(--destructive)":"var(--card-foreground)",borderBottom:a<e.length-1?"1px solid var(--border)":"none"},onMouseEnter:s=>{s.currentTarget.style.background=o.danger?"#fef2f2":"var(--secondary)"},onMouseLeave:s=>{s.currentTarget.style.background="none"},children:[o.icon," ",o.label]},a))})]})}function KK(e){return e>=1e5?`₹${(e/1e5).toFixed(2)}L`:e>=1e3?`₹${(e/1e3).toFixed(1)}K`:`₹${e}`}function iEe({rating:e,count:t}){const r=Math.floor(e),n=e%1>=.4;return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Rating (",t,")"]}),i.jsx("div",{style:{display:"flex",gap:"1px"},children:[1,2,3,4,5].map(o=>i.jsx(E$,{size:11,style:{color:o<=r||o===r+1&&n?"#f59e0b":"var(--border)",fill:o<=r||o===r+1&&n?"#f59e0b":"none"}},o))}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",fontWeight:"var(--font-weight-medium)"},children:e.toFixed(1)})]})}function oEe({event:e,accent:t,categoryName:r,onOpen:n}){const[o,a]=S.useState(!1),[s,l]=S.useState("attendance");x8[e.status];const c=(e.status==="Live"||e.status==="Completed")&&e.registeredAttendees!==void 0;return i.jsxs("div",{onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:"var(--card)",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:o?t:"var(--border)",borderRightColor:o?t:"var(--border)",borderBottomColor:o?t:"var(--border)",borderLeftColor:o?t:"var(--border)",borderRadius:"var(--radius-card)",display:"flex",flexDirection:"column",overflow:"hidden",transition:"box-shadow 0.15s, border-color 0.15s, transform 0.15s",boxShadow:o?"var(--elevation-sm)":"none",transform:o?"translateY(-2px)":"translateY(0)",position:"relative",cursor:"pointer"},children:[i.jsxs("div",{style:{padding:"16px 16px 12px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"8px",marginBottom:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},children:[i.jsx(S8,{status:e.status}),i.jsx(j8,{type:e.type}),i.jsx(GK,{name:r,accent:t})]}),c&&i.jsx("div",{style:{display:"flex",alignItems:"center",flexShrink:0,background:"var(--secondary)",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderRadius:"999px",padding:"2px"},children:["attendance","sales"].map(u=>i.jsx("button",{onClick:d=>{d.stopPropagation(),l(u)},style:{padding:"2px 8px",borderRadius:"999px",border:"none",cursor:"pointer",background:s===u?"var(--primary)":"transparent",color:s===u?"var(--primary-foreground)":"var(--muted)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:s===u?"var(--font-weight-medium)":"var(--font-weight-normal)",transition:"background 0.15s, color 0.15s"},children:u==="attendance"?"Attendance":"Sales"},u))})]}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.35",marginBottom:"4px"},children:e.name}),e.subtitle&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:"1.4",marginBottom:"8px"},children:e.subtitle}),i.jsxs("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",marginBottom:c?"12px":"0"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx(Vi,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[jw(e.startDate),e.endDate!==e.startDate?` – ${jw(e.endDate)}`:""]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex",flexShrink:0},children:w8[e.locationType]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.location})]})]}),c&&i.jsxs("div",{style:{borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[s==="attendance"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",background:"var(--secondary)",borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:"var(--border)"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Registered Attendees"}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e.registeredAttendees})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr"},children:[i.jsxs("div",{style:{padding:"8px 6px",textAlign:"center",borderRightStyle:"solid",borderRightWidth:"1px",borderRightColor:"var(--border)",background:"var(--success-bg)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--success-fg)",lineHeight:"1.2",fontSize:"var(--text-base)"},children:e.attended}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--success-fg-label)",marginTop:"2px"},children:"Attended"})]}),i.jsxs("div",{style:{padding:"8px 6px",textAlign:"center",borderRightStyle:"solid",borderRightWidth:"1px",borderRightColor:"var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",lineHeight:"1.2",fontSize:"var(--text-base)"},children:e.notAttended}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:"Absent"})]}),i.jsxs("div",{style:{padding:"8px 6px",textAlign:"center"},children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",lineHeight:"1.2",fontSize:"var(--text-base)",color:e.attendancePct!==void 0?e.attendancePct>=75?"#15803d":e.attendancePct>=50?"#d97706":"var(--destructive)":"var(--card-foreground)"},children:[e.attendancePct,"%"]}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:"% Rate"})]})]})]}):i.jsx(i.Fragment,{children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 10px",background:e.totalRevenue&&e.totalRevenue>0?"rgba(11, 77, 209, 0.04)":"var(--secondary)"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"var(--radius-button)",background:e.totalRevenue&&e.totalRevenue>0?"rgba(11, 77, 209, 0.1)":"var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(T$,{size:13,style:{color:e.totalRevenue&&e.totalRevenue>0?"var(--primary)":"var(--muted)"}})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:e.totalRevenue&&e.totalRevenue>0?"var(--primary)":"var(--muted)",lineHeight:"1.1",fontSize:"var(--text-base)"},children:e.totalRevenue&&e.totalRevenue>0?KK(e.totalRevenue):"Free event"}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"2px"},children:e.totalRevenue&&e.totalRevenue>0?"Total Revenue Earned":"No paid tickets"})]})]})}),e.rating!==void 0&&e.ratingCount!==void 0&&i.jsx("div",{style:{padding:"6px 10px",borderTopStyle:"solid",borderTopWidth:"1px",borderTopColor:"var(--border)",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(iEe,{rating:e.rating,count:e.ratingCount})})]})]}),i.jsxs("div",{style:{padding:"10px 16px",borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--border)",background:"var(--secondary)",display:"flex",alignItems:"center",gap:"12px",marginTop:"auto"},children:[i.jsx(HB,{icon:i.jsx(Ri,{size:11}),value:e.participants>0?e.participants:"—",label:e.participants===1?"participant":"participants"}),i.jsx(HB,{icon:i.jsx(Vi,{size:11}),value:e.sessions>0?e.sessions:"—",label:"sessions"})]})]})}function aEe({event:e,categoryName:t,accent:r,onOpen:n}){const[o,a]=S.useState(!1),[s,l]=S.useState(!1),c=(e.status==="Live"||e.status==="Completed")&&e.registeredAttendees!==void 0;x8[e.status];const u=o?"var(--secondary)":e.isCurrent?"var(--accent)":"transparent";return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),style:{background:u,transition:"background 0.12s",borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:s?"transparent":"var(--border)"},children:[i.jsx("td",{style:{padding:"11px 8px 11px 12px",width:"32px"},children:c?i.jsx("button",{onClick:()=>l(d=>!d),title:s?"Collapse attendance & sales details":"Expand attendance & sales details","aria-expanded":s,"aria-label":s?"Collapse details":"Expand details",style:{width:"22px",height:"22px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",cursor:"pointer",background:s?"var(--primary)":"var(--secondary)",borderStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:s?"var(--primary)":"var(--border)",borderRightColor:s?"var(--primary)":"var(--border)",borderBottomColor:s?"var(--primary)":"var(--border)",borderLeftColor:s?"var(--primary)":"var(--border)",color:s?"var(--primary-foreground)":"var(--muted)",transition:"background 0.15s, color 0.15s, border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s",flexShrink:0},children:s?i.jsx(Qf,{size:12}):i.jsx(go,{size:12})}):i.jsx("span",{style:{width:"22px",height:"22px",display:"block"}})}),i.jsx("td",{style:{padding:"11px 16px 11px 4px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.isCurrent&&i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--primary)",display:"block",flexShrink:0}}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3"},children:e.name}),e.subtitle&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"1px"},children:e.subtitle})]})]})}),i.jsx("td",{style:{padding:"11px 12px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",flexWrap:"wrap"},children:[i.jsx(j8,{type:e.type}),i.jsx(GK,{name:t,accent:r})]})}),i.jsx("td",{style:{padding:"11px 12px",whiteSpace:"nowrap"},children:i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[jw(e.startDate),e.endDate!==e.startDate?` – ${jw(e.endDate)}`:""]})}),i.jsx("td",{style:{padding:"11px 12px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex"},children:w8[e.locationType]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.location})]})}),i.jsx("td",{style:{padding:"11px 12px",whiteSpace:"nowrap"},children:i.jsx(S8,{status:e.status})}),i.jsx("td",{style:{padding:"11px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e.participants>0?e.participants.toLocaleString():"—"})}),i.jsx("td",{style:{padding:"11px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.sessions>0?e.sessions:"—"})}),i.jsx("td",{style:{padding:"11px 16px 11px 8px",whiteSpace:"nowrap"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",opacity:o?1:0,transition:"opacity 0.15s"},children:[i.jsxs("button",{onClick:n,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:d=>{d.currentTarget.style.borderColor="var(--primary)",d.currentTarget.style.color="var(--primary)"},onMouseLeave:d=>{d.currentTarget.style.borderColor="var(--border)",d.currentTarget.style.color="var(--card-foreground)"},children:[i.jsx(bv,{size:11})," Open"]}),i.jsx(nEe,{items:[{label:"Duplicate",icon:i.jsx(Js,{size:13}),onClick:()=>{}},{label:"Edit",icon:i.jsx(wi,{size:13}),onClick:()=>{}},{label:"Delete",icon:i.jsx(Xr,{size:13}),danger:!0,onClick:()=>{window.confirm("Delete this event? This cannot be undone.")}}]})]})})]}),c&&s&&i.jsx("tr",{style:{borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:"var(--border)",background:"var(--card)"},children:i.jsx("td",{colSpan:9,style:{padding:"0 16px 14px 48px",background:"var(--accent)"},children:(()=>{const d=e.attendancePct??0,f=d>=75?"#15803d":d>=50?"#d97706":"var(--destructive)",h=e.totalRevenue!==void 0&&e.totalRevenue>0,p=e.rating!==void 0&&e.ratingCount!==void 0;return i.jsxs("div",{style:{display:"flex",alignItems:"center",background:"var(--secondary)",borderTopWidth:"1px",borderTopStyle:"solid",borderTopColor:"var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 12px",flexShrink:0},children:[i.jsx(Ri,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e.registeredAttendees})," ","reg."]})]}),i.jsx("div",{style:{width:"1px",height:"28px",background:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"7px 12px",flex:"1 1 0",minWidth:0},children:[i.jsx("div",{style:{flex:"1 1 60px",minWidth:"40px",maxWidth:"100px",height:"5px",borderRadius:"999px",background:"var(--border)",overflow:"hidden",flexShrink:0},children:i.jsx("div",{style:{height:"100%",borderRadius:"999px",width:`${d}%`,background:f,transition:"width 0.4s ease"}})}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:f,whiteSpace:"nowrap",flexShrink:0},children:[d,"%"]}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"#15803d",whiteSpace:"nowrap",flexShrink:0},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a",display:"inline-block",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:e.attended})," ","attended"]}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap",flexShrink:0},children:[i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--muted-foreground)",display:"inline-block",flexShrink:0}}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:e.notAttended})," ","absent"]})]}),h&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"1px",height:"28px",background:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 12px",flexShrink:0},children:[i.jsx(T$,{size:11,style:{color:"var(--primary)",flexShrink:0}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--primary)"},children:KK(e.totalRevenue)})," ","revenue"]})]})]}),p&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{width:"1px",height:"28px",background:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"7px 12px",flexShrink:0},children:[i.jsx(E$,{size:11,style:{color:"#f59e0b",fill:"#f59e0b",flexShrink:0}}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",whiteSpace:"nowrap"},children:e.rating.toFixed(1)}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:["(",e.ratingCount,")"]})]})]})]})})()})})]})}function sEe({categories:e,onOpenEvent:t}){const r=new Date,[n,o]=S.useState(new Date(r.getFullYear(),r.getMonth(),1)),[a,s]=S.useState(null);function l(w){return`${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}`}const c=l(r),u=S.useMemo(()=>{const w=new Map;return e.forEach(k=>{k.events.forEach(j=>{const _=new Date(j.startDate),T=new Date(j.endDate),A=new Date(_);let P=0;for(;A<=T&&P<60;){const N=l(A);w.has(N)||w.set(N,[]),w.get(N).push({event:j,category:k}),A.setDate(A.getDate()+1),P++}})}),w},[e]),d=n.getFullYear(),f=n.getMonth(),h=new Date(d,f,1).getDay(),p=new Date(d,f+1,0).getDate(),v=[...Array(h).fill(null),...Array.from({length:p},(w,k)=>k+1)];for(;v.length%7!==0;)v.push(null);const m=["January","February","March","April","May","June","July","August","September","October","November","December"],b=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],x=a?e.find(w=>w.id===a.categoryId):null;return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx("button",{onClick:()=>o(new Date(d,f-1,1)),style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(vd,{size:13})}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:[m[f]," ",d]}),i.jsx("button",{onClick:()=>o(new Date(r.getFullYear(),r.getMonth(),1)),style:{padding:"3px 10px",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Today"})]}),i.jsx("button",{onClick:()=>o(new Date(d,f+1,1)),style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(ka,{size:13})})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",borderBottom:"1px solid var(--border)"},children:b.map(w=>i.jsx("div",{style:{padding:"7px 0",textAlign:"center",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase"},children:w},w))}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)"},children:v.map((w,k)=>{const j=k%7,_=k>=v.length-7;if(w===null)return i.jsx("div",{style:{minHeight:"90px",background:"var(--secondary)",borderRightWidth:j<6?"1px":"0",borderRightStyle:"solid",borderRightColor:"var(--border)",borderBottomWidth:_?"0":"1px",borderBottomStyle:"solid",borderBottomColor:"var(--border)"}},`pad-${k}`);const T=l(new Date(d,f,w)),A=u.get(T)||[],P=T===c,N=j===0||j===6;return i.jsxs("div",{style:{minHeight:"90px",padding:"5px",background:N?"var(--secondary)":"var(--card)",borderRightWidth:j<6?"1px":"0",borderRightStyle:"solid",borderRightColor:"var(--border)",borderBottomWidth:_?"0":"1px",borderBottomStyle:"solid",borderBottomColor:"var(--border)"},children:[i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"3px"},children:i.jsx("span",{style:{width:"22px",height:"22px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",background:P?"var(--primary)":"transparent",color:P?"var(--primary-foreground)":N?"var(--muted)":"var(--foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:P?"var(--font-weight-medium)":"var(--font-weight-normal)"},children:w})}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[A.slice(0,3).map(({event:O,category:C})=>i.jsx("button",{title:O.name,onClick:()=>s(I=>(I==null?void 0:I.id)===O.id?null:O),style:{display:"block",width:"100%",textAlign:"left",padding:"2px 5px",borderRadius:"3px",background:(a==null?void 0:a.id)===O.id?C.accent+"30":C.accent+"18",borderLeftWidth:"2px",borderLeftStyle:"solid",borderLeftColor:C.accent,borderTopWidth:"0",borderRightWidth:"0",borderBottomWidth:"0",outlineWidth:(a==null?void 0:a.id)===O.id?"1px":"0",outlineStyle:"solid",outlineColor:C.accent,cursor:"pointer",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.name},O.id)),A.length>3&&i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",paddingLeft:"4px"},children:["+",A.length-3," more"]})]})]},T)})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",flexWrap:"wrap",padding:"0 2px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:"Categories:"}),e.map(w=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"2px",background:w.accent,flexShrink:0}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:w.name})]},w.id))]}),a&&x&&i.jsxs("div",{style:{background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"4px",borderStyle:"solid",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:x.accent,borderRadius:"var(--radius-card)",padding:"16px 20px",display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"16px"},children:[i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px",flexWrap:"wrap"},children:[i.jsx(S8,{status:a.status}),i.jsx(j8,{type:a.type}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:x.name})]}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:a.name}),a.subtitle&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"10px"},children:a.subtitle}),i.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(Vi,{size:11,style:{color:"var(--muted)"}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[a.startDate,a.endDate!==a.startDate?` – ${a.endDate}`:""]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex"},children:w8[a.locationType]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:a.location})]}),a.participants>0&&i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[i.jsx(Ri,{size:11,style:{color:"var(--muted)"}}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[a.participants.toLocaleString()," participants"]})]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsxs("button",{onClick:()=>t(a),style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:["Open ",i.jsx(dT,{size:11})]}),i.jsx("button",{onClick:()=>s(null),style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--secondary)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderStyle:"solid",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:13})})]})]})]})}function lEe({msg:e,onDone:t}){return S.useEffect(()=>{const r=setTimeout(t,3e3);return()=>clearTimeout(r)},[]),i.jsxs("div",{style:{position:"fixed",bottom:"24px",left:"50%",transform:"translateX(-50%)",background:"var(--foreground)",color:"var(--background)",padding:"10px 20px",borderRadius:"var(--radius-button)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",boxShadow:"var(--shadow-xl)",zIndex:200,display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(bv,{size:13})," ",e]})}function cEe({onNavigateToEvent:e}){const{user:t}=Mr(),r=Nn(t),{setActiveNav:n,setSelectedEventId:o,setSettingsInitialSection:a,setOpenAgendaSessionPanelOnce:s}=Li(),{theme:l}=a$(),[c,u]=S.useState("card"),[d,f]=S.useState(""),[h,p]=S.useState("All"),[v,m]=S.useState("All"),[b,x]=S.useState("All"),[w,k]=S.useState(!1),[j,_]=S.useState(null),[T,A]=S.useState(void 0),[P,N]=S.useState(!1),[O,C]=S.useState(!1),[I,R]=S.useState([]),[F,M]=S.useState(!0),[Y,X]=S.useState(null),[$,ee]=S.useState(()=>{try{return localStorage.getItem(UB)==="1"}catch{return!1}}),[V,D]=S.useState(null),[z,q]=S.useState([]),[G,U]=S.useState(!1),[Q,K]=S.useState(0),re=S.useMemo(()=>eEe(I),[I]),H=(t==null?void 0:t.role)==="super_admin"||(t==null?void 0:t.role)==="admin",ie=S.useMemo(()=>({organisation:G4e(V),event:I.length>=1,session:Q>=1,team:H?G?!1:K4e(z,(t==null?void 0:t._id)??""):!1,notifications:!!(t!=null&&t.notificationPreferencesSavedAt)}),[V,I.length,Q,H,G,z,t==null?void 0:t._id,t==null?void 0:t.notificationPreferencesSavedAt]);S.useEffect(()=>{var Me;if(!r||F||Y)return;let ae=!1;const ue=(Me=I[0])==null?void 0:Me._id;return(async()=>{var He,xt,st;const Se=cs.get().catch(()=>null),Pe=H?Sx.list():Promise.resolve(null),Ee=ue?ta.list(ue):Promise.resolve(null),[Ae,Ye,rt]=await Promise.all([Se,Pe,Ee]);ae||(D(Ae),H&&Ye?Ye.error?(q([]),U(!0)):(q(((He=Ye.data)==null?void 0:He.users)??[]),U(!1)):(q([]),U(!1)),K(ue&&rt?rt.error?0:((st=(xt=rt.data)==null?void 0:xt.sessions)==null?void 0:st.length)??0:0))})(),()=>{ae=!0}},[r,F,Y,H,I]);const de=S.useCallback(()=>{if(M(!0),X(null),!r){R([]),X((t==null?void 0:t.role)==="super_admin"?"Assign an organisation to your account to load events for that tenant.":"Your profile has no organisation."),M(!1);return}Lr.list({organization:r}).then(ae=>{var ue;((ue=ae.data)==null?void 0:ue.events)!=null?R(ae.data.events):X(ae.error||"Failed to load events")}).catch(()=>X("Failed to load events")).finally(()=>M(!1))},[r,t==null?void 0:t.role]);S.useEffect(()=>{de()},[de]);const le=S.useMemo(()=>re.flatMap(ae=>ae.events.map(ue=>({ev:ue,cat:ae}))),[re]),ke=S.useMemo(()=>le.filter(({ev:ae,cat:ue})=>{const Me=d.toLowerCase(),Se=!Me||ae.name.toLowerCase().includes(Me)||ae.location.toLowerCase().includes(Me)||(ae.subtitle||"").toLowerCase().includes(Me)||ue.name.toLowerCase().includes(Me),Pe=h==="All"||ae.status===h,Ee=v==="All"||ae.type===v,Ae=b==="All"||ue.id===b;return Se&&Pe&&Ee&&Ae}),[le,d,h,v,b]),ve=ke.length,se=h!=="All"||v!=="All"||b!=="All"||!!d,be=!F&&I.length>0,De=ae=>{e?e(ae.id):_(ae.isCurrent?`You are already viewing ${ae.name}`:`Switching to ${ae.name}…`)};return S.useCallback(()=>{try{localStorage.setItem(UB,"1")}catch{}ee(!0)},[]),S.useCallback(ae=>{var ue;if(ae==="organisation"){a("org"),n("settings");return}if(ae==="event"){C(!0);return}if(ae==="session"){const Me=(ue=I[0])==null?void 0:ue._id;Me?(o(Me),s(!0),n("dashboard")):C(!0);return}if(ae==="team"){n("user-management");return}ae==="notifications"&&(a("notifications"),n("settings"))},[I,n,o,a,s]),r&&!F&&!Y&&!$&&Q4e(ie),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"EventBuzz · Organisation"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2",marginBottom:"4px"},children:"All Events"}),(F||Y||(T==null?void 0:T.from))&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[F?"Loading…":Y||null,(T==null?void 0:T.from)&&i.jsx("span",{style:{marginLeft:F||Y?"8px":0,color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:F||Y?"· filtered by date range":"Filtered by date range"})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs(U4e,{open:P,onOpenChange:N,children:[i.jsx(H4e,{asChild:!0,children:i.jsxs("button",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"7px 12px",borderRadius:"var(--radius-button)",background:T!=null&&T.from?"var(--accent)":"var(--secondary)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:T!=null&&T.from?"var(--primary)":"var(--border)",borderRightColor:T!=null&&T.from?"var(--primary)":"var(--border)",borderBottomColor:T!=null&&T.from?"var(--primary)":"var(--border)",borderLeftColor:T!=null&&T.from?"var(--primary)":"var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",color:T!=null&&T.from?"var(--primary)":"var(--muted)",transition:"border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s, background 0.15s",whiteSpace:"nowrap"},onMouseEnter:ae=>{T!=null&&T.from||(ae.currentTarget.style.borderTopColor="var(--ring)",ae.currentTarget.style.borderRightColor="var(--ring)",ae.currentTarget.style.borderBottomColor="var(--ring)",ae.currentTarget.style.borderLeftColor="var(--ring)",ae.currentTarget.style.color="var(--foreground)")},onMouseLeave:ae=>{T!=null&&T.from||(ae.currentTarget.style.borderTopColor="var(--border)",ae.currentTarget.style.borderRightColor="var(--border)",ae.currentTarget.style.borderBottomColor="var(--border)",ae.currentTarget.style.borderLeftColor="var(--border)",ae.currentTarget.style.color="var(--muted)")},children:[i.jsx(Vi,{size:13,style:{flexShrink:0}}),T!=null&&T.from?i.jsxs("span",{children:[T.from.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),T.to&&T.to.getTime()!==T.from.getTime()?` – ${T.to.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}`:""]}):i.jsx("span",{children:"Select date range"}),T!=null&&T.from?i.jsx("span",{onClick:ae=>{ae.stopPropagation(),A(void 0)},style:{display:"flex",alignItems:"center",justifyContent:"center",marginLeft:"2px",cursor:"pointer",color:"var(--muted)"},onMouseEnter:ae=>{ae.currentTarget.style.color="var(--destructive)"},onMouseLeave:ae=>{ae.currentTarget.style.color="var(--muted)"},children:i.jsx(Gt,{size:11})}):i.jsx(go,{size:11,style:{flexShrink:0}})]})}),i.jsxs(V4e,{align:"end",sideOffset:6,style:{padding:0,background:"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--elevation-sm)",overflow:"hidden",width:"auto"},children:[i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",padding:"10px 12px 8px",borderBottom:"1px solid var(--border)"},children:[{label:"Last 30 days",days:30},{label:"Last 90 days",days:90},{label:"This year",days:365}].map(ae=>{var Pe,Ee;const ue=new Date,Me=new Date;Me.setDate(Me.getDate()-ae.days);const Se=((Pe=T==null?void 0:T.from)==null?void 0:Pe.toDateString())===Me.toDateString()&&((Ee=T==null?void 0:T.to)==null?void 0:Ee.toDateString())===ue.toDateString();return i.jsx("button",{onClick:()=>{A({from:Me,to:ue}),N(!1)},style:{padding:"3px 10px",borderRadius:"999px",background:Se?"var(--primary)":"var(--secondary)",borderWidth:"1px",borderStyle:"solid",borderColor:Se?"var(--primary)":"var(--border)",color:Se?"var(--primary-foreground)":"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-normal)",transition:"all 0.12s"},onMouseEnter:Ae=>{Se||(Ae.currentTarget.style.borderColor="var(--primary)",Ae.currentTarget.style.color="var(--primary)")},onMouseLeave:Ae=>{Se||(Ae.currentTarget.style.borderColor="var(--border)",Ae.currentTarget.style.color="var(--card-foreground)")},children:ae.label},ae.label)})}),i.jsx(gCe,{mode:"range",selected:T,onSelect:A,numberOfMonths:2,defaultMonth:(()=>{const ae=new Date;return ae.setMonth(ae.getMonth()-1),ae})(),style:{padding:"8px 12px 12px",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)"}}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"8px",padding:"8px 12px 10px",borderTop:"1px solid var(--border)"},children:[i.jsx("button",{onClick:()=>{A(void 0),N(!1)},style:{padding:"5px 14px",borderRadius:"var(--radius-button)",background:"transparent",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},onMouseEnter:ae=>{ae.currentTarget.style.borderColor="var(--ring)"},onMouseLeave:ae=>{ae.currentTarget.style.borderColor="var(--border)"},children:"Clear"}),i.jsx("button",{onClick:()=>N(!1),style:{padding:"5px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Apply"})]})]})]}),i.jsxs("button",{onClick:()=>C(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," Create Event"]})]})]}),F&&i.jsx(_h,{message:"Loading events…"}),!F&&Y&&i.jsxs("div",{style:{padding:"32px 24px",textAlign:"center",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",background:"var(--card)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",marginBottom:"12px"},children:Y}),i.jsx("button",{type:"button",onClick:()=>de(),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Retry"})]}),!F&&!Y&&!be&&i.jsxs("div",{style:{textAlign:"center",padding:"48px 24px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",background:"var(--secondary)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"8px"},children:"No events yet"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px",maxWidth:"360px",marginLeft:"auto",marginRight:"auto"},children:"Create an event to see it listed here with stats, filters, and calendar view."}),i.jsxs("button",{type:"button",onClick:()=>C(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:16})," Create your first event"]})]}),!F&&!Y&&be&&i.jsxs($e.Fragment,{children:[i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"34px",flex:"1 1 180px",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:w?"var(--ring)":"var(--border)",borderRightColor:w?"var(--ring)":"var(--border)",borderBottomColor:w?"var(--ring)":"var(--border)",borderLeftColor:w?"var(--ring)":"var(--border)",borderRadius:"var(--radius-button)",transition:"border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s"},children:[i.jsx(pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:d,onChange:ae=>f(ae.target.value),placeholder:"Search events…",onFocus:()=>k(!0),onBlur:()=>k(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),d&&i.jsx("button",{onClick:()=>f(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:0,display:"flex"},children:i.jsx(Gt,{size:12})})]}),i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[i.jsxs("select",{value:h,onChange:ae=>p(ae.target.value),style:{height:"34px",paddingLeft:"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:h!=="All"?"var(--accent)":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:h!=="All"?"var(--primary)":"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:h!=="All"?"var(--primary)":"var(--card-foreground)",cursor:"pointer",outline:"none",minWidth:"100px"},children:[i.jsx("option",{value:"All",children:"Status"}),["Live","Upcoming","Completed","Draft"].map(ae=>i.jsx("option",{value:ae,children:ae},ae))]}),i.jsx(go,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:h!=="All"?"var(--primary)":"var(--muted)"}})]}),i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[i.jsxs("select",{value:v,onChange:ae=>m(ae.target.value),style:{height:"34px",paddingLeft:"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:v!=="All"?"var(--accent)":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:v!=="All"?"var(--primary)":"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:v!=="All"?"var(--primary)":"var(--card-foreground)",cursor:"pointer",outline:"none",minWidth:"110px"},children:[i.jsx("option",{value:"All",children:"Type"}),["Conference","Workshop","Summit","CME","Webinar"].map(ae=>i.jsx("option",{value:ae,children:ae},ae))]}),i.jsx(go,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:v!=="All"?"var(--primary)":"var(--muted)"}})]}),(()=>{const ae=b!=="All"?re.find(ue=>ue.id===b):null;return i.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",flexShrink:0},children:[ae&&i.jsx("span",{style:{position:"absolute",left:"10px",width:"7px",height:"7px",borderRadius:"50%",background:ae.accent,flexShrink:0,zIndex:1,pointerEvents:"none"}}),i.jsxs("select",{value:b,onChange:ue=>x(ue.target.value),style:{height:"34px",paddingLeft:ae?"24px":"10px",paddingRight:"28px",appearance:"none",WebkitAppearance:"none",background:ae?ae.accent+"18":"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:ae?ae.accent:"var(--border)",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:ae?ae.accent:"var(--card-foreground)",cursor:"pointer",outline:"none",minWidth:"120px"},children:[i.jsx("option",{value:"All",children:"Category"}),re.map(ue=>i.jsx("option",{value:ue.id,children:ue.name},ue.id))]}),i.jsx(go,{size:12,style:{position:"absolute",right:"8px",pointerEvents:"none",color:ae?ae.accent:"var(--muted)"}})]})})(),se&&i.jsxs("button",{onClick:()=>{f(""),p("All"),m("All"),x("All")},style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 10px",height:"34px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",flexShrink:0},children:[i.jsx(Gt,{size:11})," Clear"]}),i.jsx("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"6px"},children:i.jsx("div",{style:{display:"flex",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--card)"},children:["card","list","calendar"].map(ae=>i.jsxs("button",{onClick:()=>u(ae),style:{display:"flex",alignItems:"center",gap:"4px",padding:"5px 10px",background:c===ae?"var(--primary)":"transparent",color:c===ae?"#fff":"var(--muted)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",borderLeft:ae!=="card"?"1px solid var(--border)":"none"},children:[ae==="card"?i.jsx(Cb,{size:13}):ae==="list"?i.jsx(Eb,{size:13}):i.jsx(Vi,{size:13}),ae==="card"?"Cards":ae==="list"?"List":"Calendar"]},ae))})})]})}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Showing ",i.jsx("strong",{style:{color:"var(--foreground)",fontFamily:"var(--font-inter)"},children:ve})," event",ve!==1?"s":"",se&&i.jsx("span",{style:{color:"var(--primary)",marginLeft:"6px"},children:"· filtered"})]}),c==="calendar"?i.jsx(sEe,{categories:re,onOpenEvent:De}):ke.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(pi,{size:28,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No events match your filters"}),i.jsxs("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"16px"},children:[d?`No results for "${d}". `:"","Try adjusting your status, type, or category filters."]}),i.jsxs("button",{onClick:()=>{f(""),p("All"),m("All"),x("All")},style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"6px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Gt,{size:12})," Clear all filters"]})]}):c==="card"?i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(288px, 1fr))",gap:"14px"},children:ke.map(({ev:ae,cat:ue})=>i.jsx(oEe,{event:ae,accent:ue.accent,categoryName:ue.name,onOpen:()=>De(ae)},ae.id))}):i.jsx("div",{style:{background:"var(--card)",borderStyle:"solid",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopColor:"var(--border)",borderRightColor:"var(--border)",borderBottomColor:"var(--border)",borderLeftColor:"var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsx("tr",{style:{background:"var(--secondary)",borderBottomStyle:"solid",borderBottomWidth:"1px",borderBottomColor:"var(--border)"},children:["","Event","Type / Category","Dates","Location","Status","Participants","Sessions",""].map((ae,ue)=>i.jsx("th",{style:{padding:ue===0?"8px 8px 8px 12px":"8px 12px",textAlign:ae==="Participants"||ae==="Sessions"?"right":"left",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",letterSpacing:"0.04em",textTransform:"uppercase",whiteSpace:"nowrap"},children:ae},ue))})}),i.jsx("tbody",{children:ke.map(({ev:ae,cat:ue})=>i.jsx(aEe,{event:ae,categoryName:ue.name,accent:ue.accent,onOpen:()=>De(ae)},ae.id))})]})})}),i.jsx("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})})]}),j&&i.jsx(lEe,{msg:j,onDone:()=>_(null)}),O&&i.jsx(GG,{organizationId:r,onClose:()=>{C(!1),de()},onCreated:ae=>{e==null||e(ae)}})]})}function uEe(e,t){return hS(e,t)}function dEe(e){return e==="quiz"?"Quiz":e==="poll"?"Poll":"Q&A Session"}function fEe(e){const t=(e||"draft").toLowerCase();return t==="live"?"Active":t==="upcoming"?"Scheduled":t==="completed"?"Completed":"Draft"}function pEe(e){if(!e)return"—";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return"—"}}const qp={width:"100%",boxSizing:"border-box",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"};async function VB(e,t,r,n,o){var v,m,b;const a=m2(n),s=m2(o);if(!a||!s)return{ok:!1,error:"Invalid start or end date/time."};const l=new Date(a);let c=new Date(s);c<=l&&(c=new Date(l.getTime()+3600*1e3));const u=await Lr.create({name:t.trim(),type:"webinar",recordKind:"activity",activitySubtype:r,status:"draft",startDate:l.toISOString(),endDate:c.toISOString(),locationType:"virtual",organization:e});if(u.error||!((v=u.data)!=null&&v._id))return{ok:!1,error:u.error||"Could not create activity."};const d=u.data._id,p=(b=(((m=(await ta.list(d)).data)==null?void 0:m.sessions)??[])[0])==null?void 0:b._id;return p?{ok:!0,eventId:d,sessionId:p}:{ok:!1,error:"Activity created but no session was found."}}function hEe(e){var r,n;const t=e.activityStats;return{id:e._id,name:e.name,type:dEe(e.activitySubtype),status:fEe(e.status),createdDate:pEe(e.createdAt),subtitle:(r=e.description)!=null&&r.trim()?e.description.trim().slice(0,120):((n=e.subtitle)==null?void 0:n.trim())||void 0,participants:(t==null?void 0:t.participantCount)??0,questions:(t==null?void 0:t.questionCount)??0,responses:(t==null?void 0:t.responseCount)??0,subtype:e.activitySubtype||"qna",raw:e}}const QK={"Q&A Session":{bg:"#E8EFFC",fg:"#0B4DD1",icon:i.jsx($h,{size:14})},Quiz:{bg:"#FEF3C7",fg:"#D97706",icon:i.jsx(tS,{size:14})},Poll:{bg:"#ECFDF5",fg:"#059669",icon:i.jsx(pT,{size:14})}},XK={Active:{bg:"#dcfce7",color:"#15803d"},Scheduled:{bg:"#dbeafe",color:"#1d4ed8"},Completed:{bg:"#f1f5f9",color:"#475569"},Draft:{bg:"#ffedd5",color:"#c2410c"}};function YB({title:e,subtitle:t,onClose:r,children:n,footer:o}){return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:r,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200},role:"presentation"}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)",animation:"activityPanelIn 0.25s ease"},children:[i.jsx("style",{children:"@keyframes activityPanelIn { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:e}),t?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0",lineHeight:1.45},children:t}):null]}),i.jsx("button",{type:"button",onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:4},children:i.jsx(Gt,{size:20})})]}),i.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:n}),o?i.jsx("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",flexShrink:0},children:o}):null]})]})}function gEe({onNavigateToActivity:e}){const{user:t}=Mr(),r=Nn(t),[n,o]=S.useState("card"),[a,s]=S.useState(""),[l,c]=S.useState("all"),[u,d]=S.useState("all"),[f,h]=S.useState(!1),[p,v]=S.useState([]),[m,b]=S.useState(!0),[x,w]=S.useState(null),[k,j]=S.useState(!1),[_,T]=S.useState(!1),[A,P]=S.useState("shell"),[N,O]=S.useState("poll"),[C,I]=S.useState(""),[R,F]=S.useState(""),[M,Y]=S.useState(""),[X,$]=S.useState(!1),[ee,V]=S.useState(null),[D,z]=S.useState(null),[q,G]=S.useState(null),[U,Q]=S.useState(!1),[K,re]=S.useState(null),[H,ie]=S.useState(null),de=Si(),le=de==="mobile",ke=de==="mobile"?"1fr":"repeat(4, minmax(0, 1fr))",ve=S.useCallback(async()=>{var Ye;if(!r){v([]),b(!1);return}b(!0),w(null);const Ae=await Lr.list({organization:r,recordKind:"activity",enrich:!0,limit:200});if(b(!1),Ae.error||!((Ye=Ae.data)!=null&&Ye.events)){w(Ae.error||"Could not load activities."),v([]);return}v(Ae.data.events.map(hEe))},[r]);S.useEffect(()=>{ve()},[ve]);const se=()=>{const{start:Ae,end:Ye}=cR();I(""),F(Ae),Y(Ye),re(null),j(!0)},be=()=>{const{start:Ae,end:Ye}=cR();I(""),F(Ae),Y(Ye),O("poll"),V(null),P("shell"),z(null),G(null),T(!0)},De=()=>{T(!1),P("shell"),z(null),G(null),V(null),ie(null)},ae=S.useMemo(()=>{if(A!=="form")return;const Ae=qT();return Ae.title=C.trim(),Ae.status="Draft",Ae.displayMode="always_sched",Ae.scheduledStart=R,Ae.scheduledEnd=M,{form:Ae,questions:[]}},[A,C,R,M]),ue=()=>{(async()=>{if(!r)return;re(null);const Ae=C.trim();if(Ae.length<3){re("Name must be at least 3 characters.");return}Q(!0);const Ye=await VB(r,Ae,"qna",R,M);if(Q(!1),!Ye.ok){re(Ye.error);return}j(!1),ve(),e==null||e(Ye.eventId)})()},Me=()=>{(async()=>{if(!r)return;V(null);const Ae=C.trim();if(Ae.length<3){V("Name must be at least 3 characters.");return}$(!0);const Ye=await VB(r,Ae,N,R,M);if($(!1),!Ye.ok){V(Ye.error);return}z(Ye.eventId),G(Ye.sessionId),ie(null),P("form")})()},Se=Ae=>{(async()=>{if(!D||!q)return;const Ye=N;ie(null);const rt={session:q,title:Ae.form.title,type:Ye,description:Ae.form.description||void 0,questions:Ae.questions.map(xt=>uEe(xt,Ye)),settings:gS(Ae.form,Ye)},He=await Pi.create(D,rt);if(He.error){ie(He.error);return}De(),ve(),e==null||e(D)})()},Pe=S.useMemo(()=>p.filter(Ae=>{var xt;const Ye=a===""||Ae.name.toLowerCase().includes(a.toLowerCase())||(((xt=Ae.subtitle)==null?void 0:xt.toLowerCase().includes(a.toLowerCase()))??!1),rt=l==="all"||Ae.type===l,He=u==="all"||Ae.status===u;return Ye&&rt&&He}),[p,a,l,u]),Ee=S.useMemo(()=>{const Ae=p;return{count:Ae.length,active:Ae.filter(Ye=>Ye.status==="Active").length,participants:Ae.reduce((Ye,rt)=>Ye+rt.participants,0),responses:Ae.reduce((Ye,rt)=>Ye+rt.responses,0)}},[p]);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:le?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 6px"},children:"Activities"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:"Manage Q&A sessions, quizzes, and polls (standalone activity events)"})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[i.jsxs("button",{type:"button",onClick:()=>r&&se(),disabled:!r,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:r?"var(--primary)":"var(--muted)",color:"var(--primary-foreground)",border:"none",cursor:r?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:r?1:.7},children:[i.jsx($h,{size:14})," Create Q&A Session"]}),i.jsxs("button",{type:"button",onClick:()=>r&&be(),disabled:!r,style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 16px",borderRadius:"var(--radius-button)",background:r?"var(--card)":"var(--muted)",color:r?"var(--foreground)":"var(--muted-foreground)",border:"1px solid var(--border)",cursor:r?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(pT,{size:14})," Create Quiz/Poll"]})]})]}),!r&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:"Set up an organization in your portfolio to view and create activities."}),x&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:0},children:x}),m&&r?i.jsx(_h,{message:"Loading activities…"}):null,!m&&r?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:le?"1fr 1fr":"repeat(4, 1fr)",gap:"12px"},children:[i.jsx(x1,{label:"Total Activities",value:String(Ee.count)}),i.jsx(x1,{label:"Active",value:String(Ee.active),color:"#15803d"}),i.jsx(x1,{label:"Total Participants",value:String(Ee.participants)}),i.jsx(x1,{label:"Total Responses",value:String(Ee.responses)})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"34px",flex:le?"1 1 100%":"1 1 180px",background:"var(--card)",borderTopWidth:"1px",borderRightWidth:"1px",borderBottomWidth:"1px",borderLeftWidth:"1px",borderTopStyle:"solid",borderRightStyle:"solid",borderBottomStyle:"solid",borderLeftStyle:"solid",borderTopColor:f?"var(--ring)":"var(--border)",borderRightColor:f?"var(--ring)":"var(--border)",borderBottomColor:f?"var(--ring)":"var(--border)",borderLeftColor:f?"var(--ring)":"var(--border)",borderRadius:"var(--radius-button)",transition:"border-top-color 0.15s, border-right-color 0.15s, border-bottom-color 0.15s, border-left-color 0.15s"},children:[i.jsx(pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:a,onChange:Ae=>s(Ae.target.value),placeholder:"Search activities…",onFocus:()=>h(!0),onBlur:()=>h(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",width:"100%"}}),a?i.jsx("button",{type:"button",onClick:()=>s(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:0,display:"flex"},children:i.jsx(Gt,{size:12})}):null]}),i.jsxs("select",{value:l,onChange:Ae=>c(Ae.target.value),style:{padding:"0 32px 0 10px",height:"34px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",cursor:"pointer",outline:"none"},children:[i.jsx("option",{value:"all",children:"All Types"}),i.jsx("option",{value:"Q&A Session",children:"Q&A Session"}),i.jsx("option",{value:"Quiz",children:"Quiz"}),i.jsx("option",{value:"Poll",children:"Poll"})]}),i.jsxs("select",{value:u,onChange:Ae=>d(Ae.target.value),style:{padding:"0 32px 0 10px",height:"34px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",cursor:"pointer",outline:"none"},children:[i.jsx("option",{value:"all",children:"All Status"}),i.jsx("option",{value:"Active",children:"Active"}),i.jsx("option",{value:"Scheduled",children:"Scheduled"}),i.jsx("option",{value:"Completed",children:"Completed"}),i.jsx("option",{value:"Draft",children:"Draft"})]}),i.jsx("div",{style:{flex:1}}),i.jsx("div",{style:{display:"flex",gap:"4px",borderRadius:"var(--radius-button)",background:"var(--secondary)",padding:"3px"},children:[{mode:"card",icon:i.jsx(Cb,{size:14}),label:"Cards"},{mode:"list",icon:i.jsx(Eb,{size:14}),label:"List"},{mode:"calendar",icon:i.jsx(Vi,{size:14}),label:"Calendar"}].map(Ae=>i.jsx("button",{type:"button",onClick:()=>o(Ae.mode),title:Ae.label,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"28px",borderRadius:"var(--radius-button)",background:n===Ae.mode?"var(--card)":"transparent",color:n===Ae.mode?"var(--primary)":"var(--muted)",border:"none",cursor:"pointer",transition:"all 0.15s"},children:Ae.icon},Ae.mode))})]}),i.jsxs("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Showing ",Pe.length," ",Pe.length===1?"activity":"activities"]}),n==="card"&&i.jsx("div",{style:{display:"grid",gridTemplateColumns:ke,gap:"16px"},children:Pe.map(Ae=>i.jsx(mEe,{activity:Ae,onClick:()=>e==null?void 0:e(Ae.id)},Ae.id))}),n==="list"&&i.jsx("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",overflow:"hidden"},children:Pe.map((Ae,Ye)=>i.jsx(vEe,{activity:Ae,isLast:Ye===Pe.length-1,onClick:()=>e==null?void 0:e(Ae.id)},Ae.id))}),n==="calendar"&&i.jsxs("div",{style:{padding:"60px 20px",textAlign:"center",background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)"},children:[i.jsx(Vi,{size:32,style:{color:"var(--muted)",margin:"0 auto 16px",display:"block"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Calendar view coming soon"})]}),Pe.length===0&&!m?i.jsxs("div",{style:{padding:"60px 20px",textAlign:"center",background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)"},children:[i.jsx(pi,{size:32,style:{color:"var(--muted)",margin:"0 auto 16px",display:"block"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:p.length===0?"No activities yet. Create one to get started.":"No activities match your filters."})]}):null]}):null,k&&r?i.jsx(YB,{title:"Create Q&A Session",subtitle:"Name is used for the event and the session. Track: Default.",onClose:()=>{j(!1),re(null)},footer:i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[i.jsx("button",{type:"button",onClick:()=>{j(!1),re(null)},disabled:U,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:U?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:ue,disabled:U,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:U?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",cursor:U?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:U?"Creating…":"Create"})]}),children:i.jsxs("div",{style:{padding:"20px",overflowY:"auto"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Name of activity"}),i.jsx("input",{value:C,onChange:Ae=>I(Ae.target.value),disabled:U,placeholder:"e.g. Keynote Q&A",style:{...qp,marginBottom:"16px"}}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:le?"1fr":"1fr 1fr",gap:"16px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Start"}),i.jsx(Pf,{value:R,onChange:F,style:qp,disabled:U})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"End"}),i.jsx(Pf,{value:M,onChange:Y,style:qp,disabled:U})]})]}),K?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginTop:"14px",marginBottom:0},children:K}):null]})}):null,_&&r?i.jsx(YB,{title:A==="shell"?"Create Quiz / Poll":N==="quiz"?"New quiz":"New poll",subtitle:A==="shell"?"Step 1: name and schedule (event & session; track: Default). Step 2: same form as Quiz & Polls in the event dashboard.":void 0,onClose:De,footer:A==="shell"?i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px"},children:[i.jsx("button",{type:"button",onClick:De,disabled:X,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:X?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:Me,disabled:X,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:X?"var(--muted)":"var(--primary)",color:"var(--primary-foreground)",cursor:X?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:X?"Creating…":"Continue to form"})]}):void 0,children:A==="shell"?i.jsxs("div",{style:{padding:"20px",overflowY:"auto"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Name of activity"}),i.jsx("input",{value:C,onChange:Ae=>I(Ae.target.value),disabled:X,placeholder:"e.g. Audience pulse check",style:{...qp,marginBottom:"16px"}}),i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Type"}),i.jsxs("select",{value:N,onChange:Ae=>O(Ae.target.value),disabled:X,style:{...qp,marginBottom:"16px",cursor:X?"not-allowed":"pointer"},children:[i.jsx("option",{value:"poll",children:"Poll"}),i.jsx("option",{value:"quiz",children:"Quiz"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:le?"1fr":"1fr 1fr",gap:"16px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"Start"}),i.jsx(Pf,{value:R,onChange:F,style:qp,disabled:X})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"6px"},children:"End"}),i.jsx(Pf,{value:M,onChange:Y,style:qp,disabled:X})]})]}),ee?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginTop:"14px",marginBottom:0},children:ee}):null]}):D&&ae?i.jsxs("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[H?i.jsx("div",{style:{padding:"10px 20px",borderBottom:"1px solid var(--border)",background:"var(--secondary)",color:"var(--destructive)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:H}):null,i.jsx(Ax,{variant:"panel",kind:N,eventId:D,initial:ae,onClose:De,onSave:Se},`${D}-${N}`)]}):null}):null]})}function x1({label:e,value:t,color:r}){return i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",padding:"16px 20px"},children:[i.jsx("div",{style:{fontSize:"var(--text-2xl)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:r||"var(--foreground)",marginBottom:"4px"},children:t}),i.jsx("div",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:e})]})}function mEe({activity:e,onClick:t}){const r=QK[e.type],n=XK[e.status];return i.jsxs("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())},style:{background:"var(--card)",borderRadius:"var(--radius-card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",padding:"20px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},onMouseEnter:o=>{o.currentTarget.style.borderColor="var(--primary)",o.currentTarget.style.boxShadow="0 4px 12px rgba(11,77,209,0.1)"},onMouseLeave:o=>{o.currentTarget.style.borderColor="var(--border)",o.currentTarget.style.boxShadow="none"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"12px"},children:[i.jsx("h3",{style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,flex:1},children:e.name}),i.jsx("span",{style:{padding:"3px 10px",borderRadius:"999px",background:n.bg,color:n.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.3px"},children:e.status})]}),i.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:r.bg,marginBottom:"16px"},children:[r.icon,i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:r.fg},children:e.type})]}),e.subtitle?i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px",lineHeight:1.4},children:e.subtitle}):null,i.jsxs("div",{style:{display:"flex",gap:"16px",paddingTop:"12px",borderTop:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(Ri,{size:14,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.participants})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(tS,{size:14,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.questions})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx(yv,{size:14,style:{color:"var(--muted)"}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:e.responses})]})]})]})}function vEe({activity:e,isLast:t,onClick:r}){const n=QK[e.type],o=XK[e.status];return i.jsxs("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),r())},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px 20px",borderBottom:t?"none":"1px solid var(--border)",cursor:"pointer",transition:"background 0.15s"},onMouseEnter:a=>{a.currentTarget.style.background="var(--secondary)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[i.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"var(--radius-button)",background:n.bg,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:n.fg},children:n.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("h4",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 3px"},children:e.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:e.createdDate})]}),i.jsx("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",minWidth:"100px"},children:e.type}),i.jsx("div",{style:{display:"flex",gap:"12px",minWidth:"120px"},children:i.jsxs("div",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[e.participants," participants"]})}),i.jsx("span",{style:{padding:"3px 10px",borderRadius:"999px",background:o.bg,color:o.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",flexShrink:0,textTransform:"uppercase"},children:e.status})]})}const yEe=()=>{};var GB={};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const ZK={NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const $t=function(e,t){if(!e)throw Fv(t)},Fv=function(e){return new Error("Firebase Database ("+ZK.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const JK=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):(o&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},xEe=function(e){const t=[];let r=0,n=0;for(;r<e.length;){const o=e[r++];if(o<128)t[n++]=String.fromCharCode(o);else if(o>191&&o<224){const a=e[r++];t[n++]=String.fromCharCode((o&31)<<6|a&63)}else if(o>239&&o<365){const a=e[r++],s=e[r++],l=e[r++],c=((o&7)<<18|(a&63)<<12|(s&63)<<6|l&63)-65536;t[n++]=String.fromCharCode(55296+(c>>10)),t[n++]=String.fromCharCode(56320+(c&1023))}else{const a=e[r++],s=e[r++];t[n++]=String.fromCharCode((o&15)<<12|(a&63)<<6|s&63)}}return t.join("")},k8={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let o=0;o<e.length;o+=3){const a=e[o],s=o+1<e.length,l=s?e[o+1]:0,c=o+2<e.length,u=c?e[o+2]:0,d=a>>2,f=(a&3)<<4|l>>4;let h=(l&15)<<2|u>>6,p=u&63;c||(p=64,s||(h=64)),n.push(r[d],r[f],r[h],r[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(JK(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):xEe(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let o=0;o<e.length;){const a=r[e.charAt(o++)],l=o<e.length?r[e.charAt(o)]:0;++o;const u=o<e.length?r[e.charAt(o)]:64;++o;const f=o<e.length?r[e.charAt(o)]:64;if(++o,a==null||l==null||u==null||f==null)throw new bEe;const h=a<<2|l>>4;if(n.push(h),u!==64){const p=l<<4&240|u>>2;if(n.push(p),f!==64){const v=u<<6&192|f;n.push(v)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class bEe extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const eQ=function(e){const t=JK(e);return k8.encodeByteArray(t,!0)},kw=function(e){return eQ(e).replace(/\./g,"")},x6=function(e){try{return k8.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function wEe(e){return tQ(void 0,e)}function tQ(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const r=t;return new Date(r.getTime());case Object:e===void 0&&(e={});break;case Array:e=[];break;default:return t}for(const r in t)!t.hasOwnProperty(r)||!SEe(r)||(e[r]=tQ(e[r],t[r]));return e}function SEe(e){return e!=="__proto__"}/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function jEe(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const kEe=()=>jEe().__FIREBASE_DEFAULTS__,_Ee=()=>{if(typeof process>"u"||typeof GB>"u")return;const e=GB.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},CEe=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&x6(e[1]);return t&&JSON.parse(t)},rQ=()=>{try{return yEe()||kEe()||_Ee()||CEe()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},EEe=e=>{var t,r;return(r=(t=rQ())===null||t===void 0?void 0:t.emulatorHosts)===null||r===void 0?void 0:r[e]},AEe=e=>{const t=EEe(e);if(!t)return;const r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const n=parseInt(t.substring(r+1),10);return t[0]==="["?[t.substring(1,r-1),n]:[t.substring(0,r),n]},nQ=()=>{var e;return(e=rQ())===null||e===void 0?void 0:e.config};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class _8{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,r)=>{this.resolve=t,this.reject=r})}wrapCallback(t){return(r,n)=>{r?this.reject(r):this.resolve(n),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(r):t(r,n))}}}/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function C8(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function TEe(e){return(await fetch(e,{credentials:"include"})).ok}/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function PEe(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const r={alg:"none",type:"JWT"},n=t||"demo-project",o=e.iat||0,a=e.sub||e.user_id;if(!a)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:o,exp:o+3600,auth_time:o,sub:a,user_id:a,firebase:{sign_in_provider:"custom",identities:{}}},e);return[kw(JSON.stringify(r)),kw(JSON.stringify(s)),""].join(".")}const ux={};function IEe(){const e={prod:[],emulator:[]};for(const t of Object.keys(ux))ux[t]?e.emulator.push(t):e.prod.push(t);return e}function OEe(e){let t=document.getElementById(e),r=!1;return t||(t=document.createElement("div"),t.setAttribute("id",e),r=!0),{created:r,element:t}}let KB=!1;function NEe(e,t){if(typeof window>"u"||typeof document>"u"||!C8(window.location.host)||ux[e]===t||ux[e]||KB)return;ux[e]=t;function r(h){return`__firebase__banner__${h}`}const n="__firebase__banner",a=IEe().prod.length>0;function s(){const h=document.getElementById(n);h&&h.remove()}function l(h){h.style.display="flex",h.style.background="#7faaf0",h.style.position="fixed",h.style.bottom="5px",h.style.left="5px",h.style.padding=".5em",h.style.borderRadius="5px",h.style.alignItems="center"}function c(h,p){h.setAttribute("width","24"),h.setAttribute("id",p),h.setAttribute("height","24"),h.setAttribute("viewBox","0 0 24 24"),h.setAttribute("fill","none"),h.style.marginLeft="-6px"}function u(){const h=document.createElement("span");return h.style.cursor="pointer",h.style.marginLeft="16px",h.style.fontSize="24px",h.innerHTML=" &times;",h.onclick=()=>{KB=!0,s()},h}function d(h,p){h.setAttribute("id",p),h.innerText="Learn more",h.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",h.setAttribute("target","__blank"),h.style.paddingLeft="5px",h.style.textDecoration="underline"}function f(){const h=OEe(n),p=r("text"),v=document.getElementById(p)||document.createElement("span"),m=r("learnmore"),b=document.getElementById(m)||document.createElement("a"),x=r("preprendIcon"),w=document.getElementById(x)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(h.created){const k=h.element;l(k),d(b,m);const j=u();c(w,x),k.append(w,v,b,j),document.body.appendChild(k)}a?(v.innerText="Preview backend disconnected.",w.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
</g>
<defs>
<clipPath id="clip0_6013_33858">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>`):(w.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
</g>
<defs>
<clipPath id="clip0_6083_34804">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>`,v.innerText="Preview backend running in this workspace."),v.setAttribute("id",p)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",f):f()}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function REe(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function iQ(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(REe())}function LEe(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function FEe(){return ZK.NODE_ADMIN===!0}function zEe(){try{return typeof indexedDB=="object"}catch{return!1}}function MEe(){return new Promise((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(n);o.onsuccess=()=>{o.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},o.onupgradeneeded=()=>{r=!1},o.onerror=()=>{var a;t(((a=o.error)===null||a===void 0?void 0:a.message)||"")}}catch(r){t(r)}})}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const DEe="FirebaseError";class Yb extends Error{constructor(t,r,n){super(r),this.code=t,this.customData=n,this.name=DEe,Object.setPrototypeOf(this,Yb.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,oQ.prototype.create)}}class oQ{constructor(t,r,n){this.service=t,this.serviceName=r,this.errors=n}create(t,...r){const n=r[0]||{},o=`${this.service}/${t}`,a=this.errors[t],s=a?BEe(a,n):"Error",l=`${this.serviceName}: ${s} (${o}).`;return new Yb(o,l,n)}}function BEe(e,t){return e.replace(WEe,(r,n)=>{const o=t[n];return o!=null?String(o):`<${n}?>`})}const WEe=/\{\$([^}]+)}/g;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function fb(e){return JSON.parse(e)}function zo(e){return JSON.stringify(e)}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const aQ=function(e){let t={},r={},n={},o="";try{const a=e.split(".");t=fb(x6(a[0])||""),r=fb(x6(a[1])||""),o=a[2],n=r.d||{},delete r.d}catch{}return{header:t,claims:r,data:n,signature:o}},qEe=function(e){const t=aQ(e),r=t.claims;return!!r&&typeof r=="object"&&r.hasOwnProperty("iat")},$Ee=function(e){const t=aQ(e).claims;return typeof t=="object"&&t.admin===!0};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function Rd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fv(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function QB(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function _w(e,t,r){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=t.call(r,e[o],o,e));return n}function Cw(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const o of r){if(!n.includes(o))return!1;const a=e[o],s=t[o];if(XB(a)&&XB(s)){if(!Cw(a,s))return!1}else if(a!==s)return!1}for(const o of n)if(!r.includes(o))return!1;return!0}function XB(e){return e!==null&&typeof e=="object"}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function UEe(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(o=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(o))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class HEe{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let t=1;t<this.blockSize;++t)this.pad_[t]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(t,r){r||(r=0);const n=this.W_;if(typeof t=="string")for(let f=0;f<16;f++)n[f]=t.charCodeAt(r)<<24|t.charCodeAt(r+1)<<16|t.charCodeAt(r+2)<<8|t.charCodeAt(r+3),r+=4;else for(let f=0;f<16;f++)n[f]=t[r]<<24|t[r+1]<<16|t[r+2]<<8|t[r+3],r+=4;for(let f=16;f<80;f++){const h=n[f-3]^n[f-8]^n[f-14]^n[f-16];n[f]=(h<<1|h>>>31)&4294967295}let o=this.chain_[0],a=this.chain_[1],s=this.chain_[2],l=this.chain_[3],c=this.chain_[4],u,d;for(let f=0;f<80;f++){f<40?f<20?(u=l^a&(s^l),d=1518500249):(u=a^s^l,d=1859775393):f<60?(u=a&s|l&(a|s),d=2400959708):(u=a^s^l,d=3395469782);const h=(o<<5|o>>>27)+u+c+d+n[f]&4294967295;c=l,l=s,s=(a<<30|a>>>2)&4294967295,a=o,o=h}this.chain_[0]=this.chain_[0]+o&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+s&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(t,r){if(t==null)return;r===void 0&&(r=t.length);const n=r-this.blockSize;let o=0;const a=this.buf_;let s=this.inbuf_;for(;o<r;){if(s===0)for(;o<=n;)this.compress_(t,o),o+=this.blockSize;if(typeof t=="string"){for(;o<r;)if(a[s]=t.charCodeAt(o),++s,++o,s===this.blockSize){this.compress_(a),s=0;break}}else for(;o<r;)if(a[s]=t[o],++s,++o,s===this.blockSize){this.compress_(a),s=0;break}}this.inbuf_=s,this.total_+=r}digest(){const t=[];let r=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let o=this.blockSize-1;o>=56;o--)this.buf_[o]=r&255,r/=256;this.compress_(this.buf_);let n=0;for(let o=0;o<5;o++)for(let a=24;a>=0;a-=8)t[n]=this.chain_[o]>>a&255,++n;return t}}function sQ(e,t){return`${e} failed: ${t} argument `}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const VEe=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o>=55296&&o<=56319){const a=o-55296;n++,$t(n<e.length,"Surrogate pair missing trail surrogate.");const s=e.charCodeAt(n)-56320;o=65536+(a<<10)+s}o<128?t[r++]=o:o<2048?(t[r++]=o>>6|192,t[r++]=o&63|128):o<65536?(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=o&63|128):(t[r++]=o>>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=o&63|128)}return t},ij=function(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);n<128?t++:n<2048?t+=2:n>=55296&&n<=56319?(t+=4,r++):t+=3}return t};/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function oj(e){return e&&e._delegate?e._delegate:e}class pb{constructor(t,r,n){this.name=t,this.instanceFactory=r,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Jp="[DEFAULT]";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class YEe{constructor(t,r){this.name=t,this.container=r,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const r=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(r)){const n=new _8;if(this.instancesDeferred.set(r,n),this.isInitialized(r)||this.shouldAutoInitialize())try{const o=this.getOrInitializeService({instanceIdentifier:r});o&&n.resolve(o)}catch{}}return this.instancesDeferred.get(r).promise}getImmediate(t){var r;const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),o=(r=t==null?void 0:t.optional)!==null&&r!==void 0?r:!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(a){if(o)return null;throw a}else{if(o)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(KEe(t))try{this.getOrInitializeService({instanceIdentifier:Jp})}catch{}for(const[r,n]of this.instancesDeferred.entries()){const o=this.normalizeInstanceIdentifier(r);try{const a=this.getOrInitializeService({instanceIdentifier:o});n.resolve(a)}catch{}}}}clearInstance(t=Jp){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(r=>"INTERNAL"in r).map(r=>r.INTERNAL.delete()),...t.filter(r=>"_delete"in r).map(r=>r._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=Jp){return this.instances.has(t)}getOptions(t=Jp){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:r={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const o=this.getOrInitializeService({instanceIdentifier:n,options:r});for(const[a,s]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(a);n===l&&s.resolve(o)}return o}onInit(t,r){var n;const o=this.normalizeInstanceIdentifier(r),a=(n=this.onInitCallbacks.get(o))!==null&&n!==void 0?n:new Set;a.add(t),this.onInitCallbacks.set(o,a);const s=this.instances.get(o);return s&&t(s,o),()=>{a.delete(t)}}invokeOnInitCallbacks(t,r){const n=this.onInitCallbacks.get(r);if(n)for(const o of n)try{o(t,r)}catch{}}getOrInitializeService({instanceIdentifier:t,options:r={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:GEe(t),options:r}),this.instances.set(t,n),this.instancesOptions.set(t,r),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch{}return n||null}normalizeInstanceIdentifier(t=Jp){return this.component?this.component.multipleInstances?t:Jp:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function GEe(e){return e===Jp?void 0:e}function KEe(e){return e.instantiationMode==="EAGER"}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class QEe{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const r=this.getProvider(t.name);if(r.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);r.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const r=new YEe(t,this);return this.providers.set(t,r),r}getProviders(){return Array.from(this.providers.values())}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var Kn;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(Kn||(Kn={}));const XEe={debug:Kn.DEBUG,verbose:Kn.VERBOSE,info:Kn.INFO,warn:Kn.WARN,error:Kn.ERROR,silent:Kn.SILENT},ZEe=Kn.INFO,JEe={[Kn.DEBUG]:"log",[Kn.VERBOSE]:"log",[Kn.INFO]:"info",[Kn.WARN]:"warn",[Kn.ERROR]:"error"},e3e=(e,t,...r)=>{if(t<e.logLevel)return;const n=new Date().toISOString(),o=JEe[t];if(o)console[o](`[${n}] ${e.name}:`,...r);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class lQ{constructor(t){this.name=t,this._logLevel=ZEe,this._logHandler=e3e,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Kn))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?XEe[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,Kn.DEBUG,...t),this._logHandler(this,Kn.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Kn.VERBOSE,...t),this._logHandler(this,Kn.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Kn.INFO,...t),this._logHandler(this,Kn.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Kn.WARN,...t),this._logHandler(this,Kn.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Kn.ERROR,...t),this._logHandler(this,Kn.ERROR,...t)}}const t3e=(e,t)=>t.some(r=>e instanceof r);let ZB,JB;function r3e(){return ZB||(ZB=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function n3e(){return JB||(JB=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const cQ=new WeakMap,b6=new WeakMap,uQ=new WeakMap,wE=new WeakMap,E8=new WeakMap;function i3e(e){const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("success",a),e.removeEventListener("error",s)},a=()=>{r(Mf(e.result)),o()},s=()=>{n(e.error),o()};e.addEventListener("success",a),e.addEventListener("error",s)});return t.then(r=>{r instanceof IDBCursor&&cQ.set(r,e)}).catch(()=>{}),E8.set(t,e),t}function o3e(e){if(b6.has(e))return;const t=new Promise((r,n)=>{const o=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",s),e.removeEventListener("abort",s)},a=()=>{r(),o()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),o()};e.addEventListener("complete",a),e.addEventListener("error",s),e.addEventListener("abort",s)});b6.set(e,t)}let w6={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return b6.get(e);if(t==="objectStoreNames")return e.objectStoreNames||uQ.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Mf(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function a3e(e){w6=e(w6)}function s3e(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){const n=e.call(SE(this),t,...r);return uQ.set(n,t.sort?t.sort():[t]),Mf(n)}:n3e().includes(e)?function(...t){return e.apply(SE(this),t),Mf(cQ.get(this))}:function(...t){return Mf(e.apply(SE(this),t))}}function l3e(e){return typeof e=="function"?s3e(e):(e instanceof IDBTransaction&&o3e(e),t3e(e,r3e())?new Proxy(e,w6):e)}function Mf(e){if(e instanceof IDBRequest)return i3e(e);if(wE.has(e))return wE.get(e);const t=l3e(e);return t!==e&&(wE.set(e,t),E8.set(t,e)),t}const SE=e=>E8.get(e);function c3e(e,t,{blocked:r,upgrade:n,blocking:o,terminated:a}={}){const s=indexedDB.open(e,t),l=Mf(s);return n&&s.addEventListener("upgradeneeded",c=>{n(Mf(s.result),c.oldVersion,c.newVersion,Mf(s.transaction),c)}),r&&s.addEventListener("blocked",c=>r(c.oldVersion,c.newVersion,c)),l.then(c=>{a&&c.addEventListener("close",()=>a()),o&&c.addEventListener("versionchange",u=>o(u.oldVersion,u.newVersion,u))}).catch(()=>{}),l}const u3e=["get","getKey","getAll","getAllKeys","count"],d3e=["put","add","delete","clear"],jE=new Map;function e9(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(jE.get(t))return jE.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,o=d3e.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(o||u3e.includes(r)))return;const a=async function(s,...l){const c=this.transaction(s,o?"readwrite":"readonly");let u=c.store;return n&&(u=u.index(l.shift())),(await Promise.all([u[r](...l),o&&c.done]))[0]};return jE.set(t,a),a}a3e(e=>({...e,get:(t,r,n)=>e9(t,r)||e.get(t,r,n),has:(t,r)=>!!e9(t,r)||e.has(t,r)}));/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class f3e{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(r=>{if(p3e(r)){const n=r.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(r=>r).join(" ")}}function p3e(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const S6="@firebase/app",t9="0.13.2";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const jd=new lQ("@firebase/app"),h3e="@firebase/app-compat",g3e="@firebase/analytics-compat",m3e="@firebase/analytics",v3e="@firebase/app-check-compat",y3e="@firebase/app-check",x3e="@firebase/auth",b3e="@firebase/auth-compat",w3e="@firebase/database",S3e="@firebase/data-connect",j3e="@firebase/database-compat",k3e="@firebase/functions",_3e="@firebase/functions-compat",C3e="@firebase/installations",E3e="@firebase/installations-compat",A3e="@firebase/messaging",T3e="@firebase/messaging-compat",P3e="@firebase/performance",I3e="@firebase/performance-compat",O3e="@firebase/remote-config",N3e="@firebase/remote-config-compat",R3e="@firebase/storage",L3e="@firebase/storage-compat",F3e="@firebase/firestore",z3e="@firebase/ai",M3e="@firebase/firestore-compat",D3e="firebase",B3e="11.10.0";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const j6="[DEFAULT]",W3e={[S6]:"fire-core",[h3e]:"fire-core-compat",[m3e]:"fire-analytics",[g3e]:"fire-analytics-compat",[y3e]:"fire-app-check",[v3e]:"fire-app-check-compat",[x3e]:"fire-auth",[b3e]:"fire-auth-compat",[w3e]:"fire-rtdb",[S3e]:"fire-data-connect",[j3e]:"fire-rtdb-compat",[k3e]:"fire-fn",[_3e]:"fire-fn-compat",[C3e]:"fire-iid",[E3e]:"fire-iid-compat",[A3e]:"fire-fcm",[T3e]:"fire-fcm-compat",[P3e]:"fire-perf",[I3e]:"fire-perf-compat",[O3e]:"fire-rc",[N3e]:"fire-rc-compat",[R3e]:"fire-gcs",[L3e]:"fire-gcs-compat",[F3e]:"fire-fst",[M3e]:"fire-fst-compat",[z3e]:"fire-vertex","fire-js":"fire-js",[D3e]:"fire-js-all"};/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const hb=new Map,q3e=new Map,k6=new Map;function r9(e,t){try{e.container.addComponent(t)}catch(r){jd.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function Ew(e){const t=e.name;if(k6.has(t))return jd.debug(`There were multiple attempts to register component ${t}.`),!1;k6.set(t,e);for(const r of hb.values())r9(r,e);for(const r of q3e.values())r9(r,e);return!0}function $3e(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function U3e(e){return e==null?!1:e.settings!==void 0}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const H3e={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Df=new oQ("app","Firebase",H3e);/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class V3e{constructor(t,r,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},r),this._name=r.name,this._automaticDataCollectionEnabled=r.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new pb("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Df.create("app-deleted",{appName:this._name})}}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Y3e=B3e;function dQ(e,t={}){let r=e;typeof t!="object"&&(t={name:t});const n=Object.assign({name:j6,automaticDataCollectionEnabled:!0},t),o=n.name;if(typeof o!="string"||!o)throw Df.create("bad-app-name",{appName:String(o)});if(r||(r=nQ()),!r)throw Df.create("no-options");const a=hb.get(o);if(a){if(Cw(r,a.options)&&Cw(n,a.config))return a;throw Df.create("duplicate-app",{appName:o})}const s=new QEe(o);for(const c of k6.values())s.addComponent(c);const l=new V3e(r,n,s);return hb.set(o,l),l}function G3e(e=j6){const t=hb.get(e);if(!t&&e===j6&&nQ())return dQ();if(!t)throw Df.create("no-app",{appName:e});return t}function n9(){return Array.from(hb.values())}function bm(e,t,r){var n;let o=(n=W3e[e])!==null&&n!==void 0?n:e;r&&(o+=`-${r}`);const a=o.match(/\s|\//),s=t.match(/\s|\//);if(a||s){const l=[`Unable to register library "${o}" with version "${t}":`];a&&l.push(`library name "${o}" contains illegal characters (whitespace or "/")`),a&&s&&l.push("and"),s&&l.push(`version name "${t}" contains illegal characters (whitespace or "/")`),jd.warn(l.join(" "));return}Ew(new pb(`${o}-version`,()=>({library:o,version:t}),"VERSION"))}/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const K3e="firebase-heartbeat-database",Q3e=1,gb="firebase-heartbeat-store";let kE=null;function fQ(){return kE||(kE=c3e(K3e,Q3e,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(gb)}catch(r){console.warn(r)}}}}).catch(e=>{throw Df.create("idb-open",{originalErrorMessage:e.message})})),kE}async function X3e(e){try{const r=(await fQ()).transaction(gb),n=await r.objectStore(gb).get(pQ(e));return await r.done,n}catch(t){if(t instanceof Yb)jd.warn(t.message);else{const r=Df.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});jd.warn(r.message)}}}async function i9(e,t){try{const n=(await fQ()).transaction(gb,"readwrite");await n.objectStore(gb).put(t,pQ(e)),await n.done}catch(r){if(r instanceof Yb)jd.warn(r.message);else{const n=Df.create("idb-set",{originalErrorMessage:r==null?void 0:r.message});jd.warn(n.message)}}}function pQ(e){return`${e.name}!${e.options.appId}`}/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Z3e=1024,J3e=30;class eAe{constructor(t){this.container=t,this._heartbeatsCache=null;const r=this.container.getProvider("app").getImmediate();this._storage=new rAe(r),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){var t,r;try{const o=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),a=o9();if(((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((r=this._heartbeatsCache)===null||r===void 0?void 0:r.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===a||this._heartbeatsCache.heartbeats.some(s=>s.date===a))return;if(this._heartbeatsCache.heartbeats.push({date:a,agent:o}),this._heartbeatsCache.heartbeats.length>J3e){const s=nAe(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(n){jd.warn(n)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const r=o9(),{heartbeatsToSend:n,unsentEntries:o}=tAe(this._heartbeatsCache.heartbeats),a=kw(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=r,o.length>0?(this._heartbeatsCache.heartbeats=o,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),a}catch(r){return jd.warn(r),""}}}function o9(){return new Date().toISOString().substring(0,10)}function tAe(e,t=Z3e){const r=[];let n=e.slice();for(const o of e){const a=r.find(s=>s.agent===o.agent);if(a){if(a.dates.push(o.date),a9(r)>t){a.dates.pop();break}}else if(r.push({agent:o.agent,dates:[o.date]}),a9(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}class rAe{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return zEe()?MEe().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const r=await X3e(this.app);return r!=null&&r.heartbeats?r:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return i9(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){var r;if(await this._canUseIndexedDBPromise){const o=await this.read();return i9(this.app,{lastSentHeartbeatDate:(r=t.lastSentHeartbeatDate)!==null&&r!==void 0?r:o.lastSentHeartbeatDate,heartbeats:[...o.heartbeats,...t.heartbeats]})}else return}}function a9(e){return kw(JSON.stringify({version:2,heartbeats:e})).length}function nAe(e){if(e.length===0)return-1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t}/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function iAe(e){Ew(new pb("platform-logger",t=>new f3e(t),"PRIVATE")),Ew(new pb("heartbeat",t=>new eAe(t),"PRIVATE")),bm(S6,t9,e),bm(S6,t9,"esm2017"),bm("fire-js","")}iAe("");var s9={};const l9="@firebase/database",c9="1.0.20";/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let hQ="";function oAe(e){hQ=e}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class aAe{constructor(t){this.domStorage_=t,this.prefix_="firebase:"}set(t,r){r==null?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),zo(r))}get(t){const r=this.domStorage_.getItem(this.prefixedName_(t));return r==null?null:fb(r)}remove(t){this.domStorage_.removeItem(this.prefixedName_(t))}prefixedName_(t){return this.prefix_+t}toString(){return this.domStorage_.toString()}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class sAe{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(t,r){r==null?delete this.cache_[t]:this.cache_[t]=r}get(t){return Rd(this.cache_,t)?this.cache_[t]:null}remove(t){delete this.cache_[t]}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const gQ=function(e){try{if(typeof window<"u"&&typeof window[e]<"u"){const t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new aAe(t)}}catch{}return new sAe},fh=gQ("localStorage"),lAe=gQ("sessionStorage");/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const wm=new lQ("@firebase/database"),cAe=(function(){let e=1;return function(){return e++}})(),mQ=function(e){const t=VEe(e),r=new HEe;r.update(t);const n=r.digest();return k8.encodeByteArray(n)},Gb=function(...e){let t="";for(let r=0;r<e.length;r++){const n=e[r];Array.isArray(n)||n&&typeof n=="object"&&typeof n.length=="number"?t+=Gb.apply(null,n):typeof n=="object"?t+=zo(n):t+=n,t+=" "}return t};let dx=null,u9=!0;const uAe=function(e,t){$t(!0,"Can't turn on custom loggers persistently."),wm.logLevel=Kn.VERBOSE,dx=wm.log.bind(wm)},xa=function(...e){if(u9===!0&&(u9=!1,dx===null&&lAe.get("logging_enabled")===!0&&uAe()),dx){const t=Gb.apply(null,e);dx(t)}},Kb=function(e){return function(...t){xa(e,...t)}},_6=function(...e){const t="FIREBASE INTERNAL ERROR: "+Gb(...e);wm.error(t)},kd=function(...e){const t=`FIREBASE FATAL ERROR: ${Gb(...e)}`;throw wm.error(t),new Error(t)},Xs=function(...e){const t="FIREBASE WARNING: "+Gb(...e);wm.warn(t)},dAe=function(){typeof window<"u"&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&Xs("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},vQ=function(e){return typeof e=="number"&&(e!==e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY)},fAe=function(e){if(document.readyState==="complete")e();else{let t=!1;const r=function(){if(!document.body){setTimeout(r,Math.floor(10));return}t||(t=!0,e())};document.addEventListener?(document.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{document.readyState==="complete"&&r()}),window.attachEvent("onload",r))}},pv="[MIN_NAME]",Rh="[MAX_NAME]",zv=function(e,t){if(e===t)return 0;if(e===pv||t===Rh)return-1;if(t===pv||e===Rh)return 1;{const r=d9(e),n=d9(t);return r!==null?n!==null?r-n===0?e.length-t.length:r-n:-1:n!==null?1:e<t?-1:1}},pAe=function(e,t){return e===t?0:e<t?-1:1},My=function(e,t){if(t&&e in t)return t[e];throw new Error("Missing required key ("+e+") in object: "+zo(t))},A8=function(e){if(typeof e!="object"||e===null)return zo(e);const t=[];for(const n in e)t.push(n);t.sort();let r="{";for(let n=0;n<t.length;n++)n!==0&&(r+=","),r+=zo(t[n]),r+=":",r+=A8(e[t[n]]);return r+="}",r},yQ=function(e,t){const r=e.length;if(r<=t)return[e];const n=[];for(let o=0;o<r;o+=t)o+t>r?n.push(e.substring(o,r)):n.push(e.substring(o,o+t));return n};function ms(e,t){for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])}const xQ=function(e){$t(!vQ(e),"Invalid JSON number");const t=11,r=52,n=(1<<t-1)-1;let o,a,s,l,c;e===0?(a=0,s=0,o=1/e===-1/0?1:0):(o=e<0,e=Math.abs(e),e>=Math.pow(2,1-n)?(l=Math.min(Math.floor(Math.log(e)/Math.LN2),n),a=l+n,s=Math.round(e*Math.pow(2,r-l)-Math.pow(2,r))):(a=0,s=Math.round(e/Math.pow(2,1-n-r))));const u=[];for(c=r;c;c-=1)u.push(s%2?1:0),s=Math.floor(s/2);for(c=t;c;c-=1)u.push(a%2?1:0),a=Math.floor(a/2);u.push(o?1:0),u.reverse();const d=u.join("");let f="";for(c=0;c<64;c+=8){let h=parseInt(d.substr(c,8),2).toString(16);h.length===1&&(h="0"+h),f=f+h}return f.toLowerCase()},hAe=function(){return!!(typeof window=="object"&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))},gAe=function(){return typeof Windows=="object"&&typeof Windows.UI=="object"};function mAe(e,t){let r="Unknown Error";e==="too_big"?r="The data requested exceeds the maximum size that can be accessed with a single request.":e==="permission_denied"?r="Client doesn't have permission to access the desired data.":e==="unavailable"&&(r="The service is unavailable");const n=new Error(e+" at "+t._path.toString()+": "+r);return n.code=e.toUpperCase(),n}const vAe=new RegExp("^-?(0*)\\d{1,10}$"),yAe=-2147483648,xAe=2147483647,d9=function(e){if(vAe.test(e)){const t=Number(e);if(t>=yAe&&t<=xAe)return t}return null},Qb=function(e){try{e()}catch(t){setTimeout(()=>{const r=t.stack||"";throw Xs("Exception was thrown by user callback.",r),t},Math.floor(0))}},bAe=function(){return(typeof window=="object"&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},fx=function(e,t){const r=setTimeout(e,t);return typeof r=="number"&&typeof Deno<"u"&&Deno.unrefTimer?Deno.unrefTimer(r):typeof r=="object"&&r.unref&&r.unref(),r};/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class wAe{constructor(t,r){this.appCheckProvider=r,this.appName=t.name,U3e(t)&&t.settings.appCheckToken&&(this.serverAppAppCheckToken=t.settings.appCheckToken),this.appCheck=r==null?void 0:r.getImmediate({optional:!0}),this.appCheck||r==null||r.get().then(n=>this.appCheck=n)}getToken(t){if(this.serverAppAppCheckToken){if(t)throw new Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(t):new Promise((r,n)=>{setTimeout(()=>{this.appCheck?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){var r;(r=this.appCheckProvider)===null||r===void 0||r.get().then(n=>n.addTokenListener(t))}notifyForInvalidToken(){Xs(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class SAe{constructor(t,r,n){this.appName_=t,this.firebaseOptions_=r,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(o=>this.auth_=o)}getToken(t){return this.auth_?this.auth_.getToken(t).catch(r=>r&&r.code==="auth/token-not-initialized"?(xa("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(r)):new Promise((r,n)=>{setTimeout(()=>{this.auth_?this.getToken(t).then(r,n):r(null)},0)})}addTokenChangeListener(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then(r=>r.addAuthTokenListener(t))}removeTokenChangeListener(t){this.authProvider_.get().then(r=>r.removeAuthTokenListener(t))}notifyForInvalidToken(){let t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Xs(t)}}class $1{constructor(t){this.accessToken=t}getToken(t){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(t){t(this.accessToken)}removeTokenChangeListener(t){}notifyForInvalidToken(){}}$1.OWNER="owner";/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const T8="5",bQ="v",wQ="s",SQ="r",jQ="f",kQ=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,_Q="ls",CQ="p",C6="ac",EQ="websocket",AQ="long_polling";/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class TQ{constructor(t,r,n,o,a=!1,s="",l=!1,c=!1,u=null){this.secure=r,this.namespace=n,this.webSocketOnly=o,this.nodeAdmin=a,this.persistenceKey=s,this.includeNamespaceInQueryParams=l,this.isUsingEmulator=c,this.emulatorOptions=u,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=fh.get("host:"+t)||this._host}isCacheableHost(){return this.internalHost.substr(0,2)==="s-"}isCustomHost(){return this._domain!=="firebaseio.com"&&this._domain!=="firebaseio-demo.com"}get host(){return this._host}set host(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&fh.set("host:"+this._host,this.internalHost))}toString(){let t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t}toURLString(){const t=this.secure?"https://":"http://",r=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${t}${this.host}/${r}`}}function jAe(e){return e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams}function PQ(e,t,r){$t(typeof t=="string","typeof type must == string"),$t(typeof r=="object","typeof params must == object");let n;if(t===EQ)n=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===AQ)n=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw new Error("Unknown connection type: "+t);jAe(e)&&(r.ns=e.namespace);const o=[];return ms(r,(a,s)=>{o.push(a+"="+s)}),n+o.join("&")}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class kAe{constructor(){this.counters_={}}incrementCounter(t,r=1){Rd(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=r}get(){return wEe(this.counters_)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const _E={},CE={};function P8(e){const t=e.toString();return _E[t]||(_E[t]=new kAe),_E[t]}function _Ae(e,t){const r=e.toString();return CE[r]||(CE[r]=t()),CE[r]}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class CAe{constructor(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(t,r){this.closeAfterResponse=t,this.onClose=r,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(t,r){for(this.pendingResponses[t]=r;this.pendingResponses[this.currentResponseNum];){const n=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let o=0;o<n.length;++o)n[o]&&Qb(()=>{this.onMessage_(n[o])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const f9="start",EAe="close",AAe="pLPCommand",TAe="pRTLPCB",IQ="id",OQ="pw",NQ="ser",PAe="cb",IAe="seg",OAe="ts",NAe="d",RAe="dframe",RQ=1870,LQ=30,LAe=RQ-LQ,FAe=25e3,zAe=3e4;class lm{constructor(t,r,n,o,a,s,l){this.connId=t,this.repoInfo=r,this.applicationId=n,this.appCheckToken=o,this.authToken=a,this.transportSessionId=s,this.lastSessionId=l,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=Kb(t),this.stats_=P8(r),this.urlFn=c=>(this.appCheckToken&&(c[C6]=this.appCheckToken),PQ(r,AQ,c))}open(t,r){this.curSegmentNum=0,this.onDisconnect_=r,this.myPacketOrderer=new CAe(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(zAe)),fAe(()=>{if(this.isClosed_)return;this.scriptTagHolder=new I8((...a)=>{const[s,l,c,u,d]=a;if(this.incrementIncomingBytes_(a),!!this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,s===f9)this.id=l,this.password=c;else if(s===EAe)l?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(l,()=>{this.onClosed_()})):this.onClosed_();else throw new Error("Unrecognized command received: "+s)},(...a)=>{const[s,l]=a;this.incrementIncomingBytes_(a),this.myPacketOrderer.handleResponse(s,l)},()=>{this.onClosed_()},this.urlFn);const n={};n[f9]="t",n[NQ]=Math.floor(Math.random()*1e8),this.scriptTagHolder.uniqueCallbackIdentifier&&(n[PAe]=this.scriptTagHolder.uniqueCallbackIdentifier),n[bQ]=T8,this.transportSessionId&&(n[wQ]=this.transportSessionId),this.lastSessionId&&(n[_Q]=this.lastSessionId),this.applicationId&&(n[CQ]=this.applicationId),this.appCheckToken&&(n[C6]=this.appCheckToken),typeof location<"u"&&location.hostname&&kQ.test(location.hostname)&&(n[SQ]=jQ);const o=this.urlFn(n);this.log_("Connecting via long-poll to "+o),this.scriptTagHolder.addTag(o,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){lm.forceAllow_=!0}static forceDisallow(){lm.forceDisallow_=!0}static isAvailable(){return lm.forceAllow_?!0:!lm.forceDisallow_&&typeof document<"u"&&document.createElement!=null&&!hAe()&&!gAe()}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(t){const r=zo(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=eQ(r),o=yQ(n,LAe);for(let a=0;a<o.length;a++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,o.length,o[a]),this.curSegmentNum++}addDisconnectPingFrame(t,r){this.myDisconnFrame=document.createElement("iframe");const n={};n[RAe]="t",n[IQ]=t,n[OQ]=r,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(t){const r=zo(t).length;this.bytesReceived+=r,this.stats_.incrementCounter("bytes_received",r)}}class I8{constructor(t,r,n,o){this.onDisconnect=n,this.urlFn=o,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(Math.random()*1e8),this.sendNewPolls=!0;{this.uniqueCallbackIdentifier=cAe(),window[AAe+this.uniqueCallbackIdentifier]=t,window[TAe+this.uniqueCallbackIdentifier]=r,this.myIFrame=I8.createIFrame_();let a="";this.myIFrame.src&&this.myIFrame.src.substr(0,11)==="javascript:"&&(a='<script>document.domain="'+document.domain+'";<\/script>');const s="<html><body>"+a+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(l){xa("frame writing exception"),l.stack&&xa(l.stack),xa(l)}}}static createIFrame_(){const t=document.createElement("iframe");if(t.style.display="none",document.body){document.body.appendChild(t);try{t.contentWindow.document||xa("No IE domain setting required")}catch{const n=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{this.myIFrame!==null&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));const t=this.onDisconnect;t&&(this.onDisconnect=null,t())}startLongPoll(t,r){for(this.myID=t,this.myPW=r,this.alive=!0;this.newRequest_(););}newRequest_(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;const t={};t[IQ]=this.myID,t[OQ]=this.myPW,t[NQ]=this.currentSerial;let r=this.urlFn(t),n="",o=0;for(;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+LQ+n.length<=RQ;){const s=this.pendingSegs.shift();n=n+"&"+IAe+o+"="+s.seg+"&"+OAe+o+"="+s.ts+"&"+NAe+o+"="+s.d,o++}return r=r+n,this.addLongPollTag_(r,this.currentSerial),!0}else return!1}enqueueSegment(t,r,n){this.pendingSegs.push({seg:t,ts:r,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(t,r){this.outstandingRequests.add(r);const n=()=>{this.outstandingRequests.delete(r),this.newRequest_()},o=setTimeout(n,Math.floor(FAe)),a=()=>{clearTimeout(o),n()};this.addTag(t,a)}addTag(t,r){setTimeout(()=>{try{if(!this.sendNewPolls)return;const n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){const o=n.readyState;(!o||o==="loaded"||o==="complete")&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),r())},n.onerror=()=>{xa("Long-poll script failed to load: "+t),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch{}},Math.floor(1))}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const MAe=16384,DAe=45e3;let Aw=null;typeof MozWebSocket<"u"?Aw=MozWebSocket:typeof WebSocket<"u"&&(Aw=WebSocket);class ac{constructor(t,r,n,o,a,s,l){this.connId=t,this.applicationId=n,this.appCheckToken=o,this.authToken=a,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=Kb(this.connId),this.stats_=P8(r),this.connURL=ac.connectionURL_(r,s,l,o,n),this.nodeAdmin=r.nodeAdmin}static connectionURL_(t,r,n,o,a){const s={};return s[bQ]=T8,typeof location<"u"&&location.hostname&&kQ.test(location.hostname)&&(s[SQ]=jQ),r&&(s[wQ]=r),n&&(s[_Q]=n),o&&(s[C6]=o),a&&(s[CQ]=a),PQ(t,EQ,s)}open(t,r){this.onDisconnect=r,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,fh.set("previous_websocket_failure",!0);try{let n;FEe(),this.mySock=new Aw(this.connURL,[],n)}catch(n){this.log_("Error instantiating WebSocket.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=n=>{this.handleIncomingFrame(n)},this.mySock.onerror=n=>{this.log_("WebSocket error. Closing connection.");const o=n.message||n.data;o&&this.log_(o),this.onClosed_()}}start(){}static forceDisallow(){ac.forceDisallow_=!0}static isAvailable(){let t=!1;if(typeof navigator<"u"&&navigator.userAgent){const r=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(r);n&&n.length>1&&parseFloat(n[1])<4.4&&(t=!0)}return!t&&Aw!==null&&!ac.forceDisallow_}static previouslyFailed(){return fh.isInMemoryStorage||fh.get("previous_websocket_failure")===!0}markConnectionHealthy(){fh.remove("previous_websocket_failure")}appendFrame_(t){if(this.frames.push(t),this.frames.length===this.totalFrames){const r=this.frames.join("");this.frames=null;const n=fb(r);this.onMessage(n)}}handleNewFrameCount_(t){this.totalFrames=t,this.frames=[]}extractFrameCount_(t){if($t(this.frames===null,"We already have a frame buffer"),t.length<=6){const r=Number(t);if(!isNaN(r))return this.handleNewFrameCount_(r),null}return this.handleNewFrameCount_(1),t}handleIncomingFrame(t){if(this.mySock===null)return;const r=t.data;if(this.bytesReceived+=r.length,this.stats_.incrementCounter("bytes_received",r.length),this.resetKeepAlive(),this.frames!==null)this.appendFrame_(r);else{const n=this.extractFrameCount_(r);n!==null&&this.appendFrame_(n)}}send(t){this.resetKeepAlive();const r=zo(t);this.bytesSent+=r.length,this.stats_.incrementCounter("bytes_sent",r.length);const n=yQ(r,MAe);n.length>1&&this.sendString_(String(n.length));for(let o=0;o<n.length;o++)this.sendString_(n[o])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(DAe))}sendString_(t){try{this.mySock.send(t)}catch(r){this.log_("Exception thrown from WebSocket.send():",r.message||r.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}ac.responsesRequiredToBeHealthy=2;ac.healthyTimeout=3e4;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class mb{static get ALL_TRANSPORTS(){return[lm,ac]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(t){this.initTransports_(t)}initTransports_(t){const r=ac&&ac.isAvailable();let n=r&&!ac.previouslyFailed();if(t.webSocketOnly&&(r||Xs("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),n=!0),n)this.transports_=[ac];else{const o=this.transports_=[];for(const a of mb.ALL_TRANSPORTS)a&&a.isAvailable()&&o.push(a);mb.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}mb.globalTransportInitialized_=!1;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const BAe=6e4,WAe=5e3,qAe=10*1024,$Ae=100*1024,EE="t",p9="d",UAe="s",h9="r",HAe="e",g9="o",m9="a",v9="n",y9="p",VAe="h";class YAe{constructor(t,r,n,o,a,s,l,c,u,d){this.id=t,this.repoInfo_=r,this.applicationId_=n,this.appCheckToken_=o,this.authToken_=a,this.onMessage_=s,this.onReady_=l,this.onDisconnect_=c,this.onKill_=u,this.lastSessionId=d,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=Kb("c:"+this.id+":"),this.transportManager_=new mb(r),this.log_("Connection created"),this.start_()}start_(){const t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const r=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(r,n)},Math.floor(0));const o=t.healthyTimeout||0;o>0&&(this.healthyTimeout_=fx(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>$Ae?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>qAe?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(o)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(t){return r=>{t===this.conn_?this.onConnectionLost_(r):t===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(t){return r=>{this.state_!==2&&(t===this.rx_?this.onPrimaryMessageReceived_(r):t===this.secondaryConn_?this.onSecondaryMessageReceived_(r):this.log_("message on old connection"))}}sendRequest(t){const r={t:"d",d:t};this.sendData_(r)}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(t){if(EE in t){const r=t[EE];r===m9?this.upgradeIfSecondaryHealthy_():r===h9?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):r===g9&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(t){const r=My("t",t),n=My("d",t);if(r==="c")this.onSecondaryControl_(n);else if(r==="d")this.pendingDataMessages.push(n);else throw new Error("Unknown protocol layer: "+r)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:y9,d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:m9,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:v9,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(t){const r=My("t",t),n=My("d",t);r==="c"?this.onControl_(n):r==="d"&&this.onDataMessage_(n)}onDataMessage_(t){this.onPrimaryResponse_(),this.onMessage_(t)}onPrimaryResponse_(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(t){const r=My(EE,t);if(p9 in t){const n=t[p9];if(r===VAe){const o=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(o.h=this.repoInfo_.host),this.onHandshake_(o)}else if(r===v9){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let o=0;o<this.pendingDataMessages.length;++o)this.onDataMessage_(this.pendingDataMessages[o]);this.pendingDataMessages=[],this.tryCleanupConnection()}else r===UAe?this.onConnectionShutdown_(n):r===h9?this.onReset_(n):r===HAe?_6("Server Error: "+n):r===g9?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):_6("Unknown control packet command: "+r)}}onHandshake_(t){const r=t.ts,n=t.v,o=t.h;this.sessionId=t.s,this.repoInfo_.host=o,this.state_===0&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,r),T8!==n&&Xs("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){const t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)}startUpgrade_(t){this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;const r=this.connReceiver_(this.secondaryConn_),n=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(r,n),fx(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(BAe))}onReset_(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.host=t,this.state_===1?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(t,r){this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(r,this.sessionId),this.onReady_=null),this.primaryResponsesRequired_===0?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):fx(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(WAe))}sendPingOnPrimaryIfNecessary_(){!this.isHealthy_&&this.state_===1&&(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:y9,d:{}}}))}onSecondaryConnectionLost_(){const t=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===t||this.rx_===t)&&this.close()}onConnectionLost_(t){this.conn_=null,!t&&this.state_===0?(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(fh.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)):this.state_===1&&this.log_("Realtime connection lost."),this.close()}onConnectionShutdown_(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(t){if(this.state_!==1)throw"Connection is not connected";this.tx_.send(t)}close(){this.state_!==2&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class FQ{put(t,r,n,o){}merge(t,r,n,o){}refreshAuthToken(t){}refreshAppCheckToken(t){}onDisconnectPut(t,r,n){}onDisconnectMerge(t,r,n){}onDisconnectCancel(t,r){}reportStats(t){}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class zQ{constructor(t){this.allowedEvents_=t,this.listeners_={},$t(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}trigger(t,...r){if(Array.isArray(this.listeners_[t])){const n=[...this.listeners_[t]];for(let o=0;o<n.length;o++)n[o].callback.apply(n[o].context,r)}}on(t,r,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:r,context:n});const o=this.getInitialEvent(t);o&&r.apply(n,o)}off(t,r,n){this.validateEventType_(t);const o=this.listeners_[t]||[];for(let a=0;a<o.length;a++)if(o[a].callback===r&&(!n||n===o[a].context)){o.splice(a,1);return}}validateEventType_(t){$t(this.allowedEvents_.find(r=>r===t),"Unknown event: "+t)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Tw extends zQ{static getInstance(){return new Tw}constructor(){super(["online"]),this.online_=!0,typeof window<"u"&&typeof window.addEventListener<"u"&&!iQ()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(t){return $t(t==="online","Unknown event type: "+t),[this.online_]}currentlyOnline(){return this.online_}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const x9=32,b9=768;class qn{constructor(t,r){if(r===void 0){this.pieces_=t.split("/");let n=0;for(let o=0;o<this.pieces_.length;o++)this.pieces_[o].length>0&&(this.pieces_[n]=this.pieces_[o],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=r}toString(){let t="";for(let r=this.pieceNum_;r<this.pieces_.length;r++)this.pieces_[r]!==""&&(t+="/"+this.pieces_[r]);return t||"/"}}function gn(){return new qn("")}function Vr(e){return e.pieceNum_>=e.pieces_.length?null:e.pieces_[e.pieceNum_]}function Yf(e){return e.pieces_.length-e.pieceNum_}function Qn(e){let t=e.pieceNum_;return t<e.pieces_.length&&t++,new qn(e.pieces_,t)}function MQ(e){return e.pieceNum_<e.pieces_.length?e.pieces_[e.pieces_.length-1]:null}function GAe(e){let t="";for(let r=e.pieceNum_;r<e.pieces_.length;r++)e.pieces_[r]!==""&&(t+="/"+encodeURIComponent(String(e.pieces_[r])));return t||"/"}function DQ(e,t=0){return e.pieces_.slice(e.pieceNum_+t)}function BQ(e){if(e.pieceNum_>=e.pieces_.length)return null;const t=[];for(let r=e.pieceNum_;r<e.pieces_.length-1;r++)t.push(e.pieces_[r]);return new qn(t,0)}function ho(e,t){const r=[];for(let n=e.pieceNum_;n<e.pieces_.length;n++)r.push(e.pieces_[n]);if(t instanceof qn)for(let n=t.pieceNum_;n<t.pieces_.length;n++)r.push(t.pieces_[n]);else{const n=t.split("/");for(let o=0;o<n.length;o++)n[o].length>0&&r.push(n[o])}return new qn(r,0)}function Yr(e){return e.pieceNum_>=e.pieces_.length}function fs(e,t){const r=Vr(e),n=Vr(t);if(r===null)return t;if(r===n)return fs(Qn(e),Qn(t));throw new Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function O8(e,t){if(Yf(e)!==Yf(t))return!1;for(let r=e.pieceNum_,n=t.pieceNum_;r<=e.pieces_.length;r++,n++)if(e.pieces_[r]!==t.pieces_[n])return!1;return!0}function cc(e,t){let r=e.pieceNum_,n=t.pieceNum_;if(Yf(e)>Yf(t))return!1;for(;r<e.pieces_.length;){if(e.pieces_[r]!==t.pieces_[n])return!1;++r,++n}return!0}class KAe{constructor(t,r){this.errorPrefix_=r,this.parts_=DQ(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(let n=0;n<this.parts_.length;n++)this.byteLength_+=ij(this.parts_[n]);WQ(this)}}function QAe(e,t){e.parts_.length>0&&(e.byteLength_+=1),e.parts_.push(t),e.byteLength_+=ij(t),WQ(e)}function XAe(e){const t=e.parts_.pop();e.byteLength_-=ij(t),e.parts_.length>0&&(e.byteLength_-=1)}function WQ(e){if(e.byteLength_>b9)throw new Error(e.errorPrefix_+"has a key path longer than "+b9+" bytes ("+e.byteLength_+").");if(e.parts_.length>x9)throw new Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+x9+") or object contains a cycle "+eh(e))}function eh(e){return e.parts_.length===0?"":"in property '"+e.parts_.join(".")+"'"}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class N8 extends zQ{static getInstance(){return new N8}constructor(){super(["visible"]);let t,r;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(r="visibilitychange",t="hidden"):typeof document.mozHidden<"u"?(r="mozvisibilitychange",t="mozHidden"):typeof document.msHidden<"u"?(r="msvisibilitychange",t="msHidden"):typeof document.webkitHidden<"u"&&(r="webkitvisibilitychange",t="webkitHidden")),this.visible_=!0,r&&document.addEventListener(r,()=>{const n=!document[t];n!==this.visible_&&(this.visible_=n,this.trigger("visible",n))},!1)}getInitialEvent(t){return $t(t==="visible","Unknown event type: "+t),[this.visible_]}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Dy=1e3,ZAe=300*1e3,w9=30*1e3,JAe=1.3,e6e=3e4,t6e="server_kill",S9=3;class md extends FQ{constructor(t,r,n,o,a,s,l,c){if(super(),this.repoInfo_=t,this.applicationId_=r,this.onDataUpdate_=n,this.onConnectStatus_=o,this.onServerInfoUpdate_=a,this.authTokenProvider_=s,this.appCheckTokenProvider_=l,this.authOverride_=c,this.id=md.nextPersistentConnectionId_++,this.log_=Kb("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=Dy,this.maxReconnectDelay_=ZAe,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,c)throw new Error("Auth override specified in options, but not supported on non Node.js platforms");N8.getInstance().on("visible",this.onVisible_,this),t.host.indexOf("fblocal")===-1&&Tw.getInstance().on("online",this.onOnline_,this)}sendRequest(t,r,n){const o=++this.requestNumber_,a={r:o,a:t,b:r};this.log_(zo(a)),$t(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(a),n&&(this.requestCBHash_[o]=n)}get(t){this.initConnection_();const r=new _8,o={action:"g",request:{p:t._path.toString(),q:t._queryObject},onComplete:s=>{const l=s.d;s.s==="ok"?r.resolve(l):r.reject(l)}};this.outstandingGets_.push(o),this.outstandingGetCount_++;const a=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(a),r.promise}listen(t,r,n,o){this.initConnection_();const a=t._queryIdentifier,s=t._path.toString();this.log_("Listen called for "+s+" "+a),this.listens.has(s)||this.listens.set(s,new Map),$t(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),$t(!this.listens.get(s).has(a),"listen() called twice for same path/queryId.");const l={onComplete:o,hashFn:r,query:t,tag:n};this.listens.get(s).set(a,l),this.connected_&&this.sendListen_(l)}sendGet_(t){const r=this.outstandingGets_[t];this.sendRequest("g",r.request,n=>{delete this.outstandingGets_[t],this.outstandingGetCount_--,this.outstandingGetCount_===0&&(this.outstandingGets_=[]),r.onComplete&&r.onComplete(n)})}sendListen_(t){const r=t.query,n=r._path.toString(),o=r._queryIdentifier;this.log_("Listen on "+n+" for "+o);const a={p:n},s="q";t.tag&&(a.q=r._queryObject,a.t=t.tag),a.h=t.hashFn(),this.sendRequest(s,a,l=>{const c=l.d,u=l.s;md.warnOnListenWarnings_(c,r),(this.listens.get(n)&&this.listens.get(n).get(o))===t&&(this.log_("listen response",l),u!=="ok"&&this.removeListen_(n,o),t.onComplete&&t.onComplete(u,c))})}static warnOnListenWarnings_(t,r){if(t&&typeof t=="object"&&Rd(t,"w")){const n=fv(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){const o='".indexOn": "'+r._queryParams.getIndex().toString()+'"',a=r._path.toString();Xs(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${o} at ${a} to your security rules for better performance.`)}}}refreshAuthToken(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(t)}reduceReconnectDelayIfAdminCredential_(t){(t&&t.length===40||$Ee(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=w9)}refreshAppCheckToken(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){const t=this.authToken_,r=qEe(t)?"auth":"gauth",n={cred:t};this.authOverride_===null?n.noauth=!0:typeof this.authOverride_=="object"&&(n.authvar=this.authOverride_),this.sendRequest(r,n,o=>{const a=o.s,s=o.d||"error";this.authToken_===t&&(a==="ok"?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(a,s))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},t=>{const r=t.s,n=t.d||"error";r==="ok"?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(r,n)})}unlisten(t,r){const n=t._path.toString(),o=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+o),$t(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,o)&&this.connected_&&this.sendUnlisten_(n,o,t._queryObject,r)}sendUnlisten_(t,r,n,o){this.log_("Unlisten on "+t+" for "+r);const a={p:t},s="n";o&&(a.q=n,a.t=o),this.sendRequest(s,a)}onDisconnectPut(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:r,onComplete:n})}onDisconnectMerge(t,r,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,r,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:r,onComplete:n})}onDisconnectCancel(t,r){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,r):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:r})}sendOnDisconnect_(t,r,n,o){const a={p:r,d:n};this.log_("onDisconnect "+t,a),this.sendRequest(t,a,s=>{o&&setTimeout(()=>{o(s.s,s.d)},Math.floor(0))})}put(t,r,n,o){this.putInternal("p",t,r,n,o)}merge(t,r,n,o){this.putInternal("m",t,r,n,o)}putInternal(t,r,n,o,a){this.initConnection_();const s={p:r,d:n};a!==void 0&&(s.h=a),this.outstandingPuts_.push({action:t,request:s,onComplete:o}),this.outstandingPutCount_++;const l=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(l):this.log_("Buffering put: "+r)}sendPut_(t){const r=this.outstandingPuts_[t].action,n=this.outstandingPuts_[t].request,o=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(r,n,a=>{this.log_(r+" response",a),delete this.outstandingPuts_[t],this.outstandingPutCount_--,this.outstandingPutCount_===0&&(this.outstandingPuts_=[]),o&&o(a.s,a.d)})}reportStats(t){if(this.connected_){const r={c:t};this.log_("reportStats",r),this.sendRequest("s",r,n=>{if(n.s!=="ok"){const a=n.d;this.log_("reportStats","Error sending stats: "+a)}})}}onDataMessage_(t){if("r"in t){this.log_("from server: "+zo(t));const r=t.r,n=this.requestCBHash_[r];n&&(delete this.requestCBHash_[r],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}}onDataPush_(t,r){this.log_("handleServerMessage",t,r),t==="d"?this.onDataUpdate_(r.p,r.d,!1,r.t):t==="m"?this.onDataUpdate_(r.p,r.d,!0,r.t):t==="c"?this.onListenRevoked_(r.p,r.q):t==="ac"?this.onAuthRevoked_(r.s,r.d):t==="apc"?this.onAppCheckRevoked_(r.s,r.d):t==="sd"?this.onSecurityDebugPacket_(r):_6("Unrecognized action received from server: "+zo(t)+`
Are you using the latest client?`)}onReady_(t,r){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(t),this.lastSessionId=r,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(t){$t(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(t))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=Dy,this.realtime_||this.scheduleConnect_(0)),this.visible_=t}onOnline_(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Dy,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>e6e&&(this.reconnectDelay_=Dy),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());const t=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_);let r=Math.max(0,this.reconnectDelay_-t);r=Math.random()*r,this.log_("Trying to reconnect in "+r+"ms"),this.scheduleConnect_(r),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*JAe)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;const t=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+md.nextConnectionId_++,a=this.lastSessionId;let s=!1,l=null;const c=function(){l?l.close():(s=!0,n())},u=function(f){$t(l,"sendRequest call when we're not connected not allowed."),l.sendRequest(f)};this.realtime_={close:c,sendRequest:u};const d=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{const[f,h]=await Promise.all([this.authTokenProvider_.getToken(d),this.appCheckTokenProvider_.getToken(d)]);s?xa("getToken() completed but was canceled"):(xa("getToken() completed. Creating connection."),this.authToken_=f&&f.accessToken,this.appCheckToken_=h&&h.token,l=new YAe(o,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,t,r,n,p=>{Xs(p+" ("+this.repoInfo_.toString()+")"),this.interrupt(t6e)},a))}catch(f){this.log_("Failed to get token: "+f),s||(this.repoInfo_.nodeAdmin&&Xs(f),c())}}}interrupt(t){xa("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(t){xa("Resuming connection for reason: "+t),delete this.interruptReasons_[t],QB(this.interruptReasons_)&&(this.reconnectDelay_=Dy,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(t){const r=t-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:r})}cancelSentTransactions_(){for(let t=0;t<this.outstandingPuts_.length;t++){const r=this.outstandingPuts_[t];r&&"h"in r.request&&r.queued&&(r.onComplete&&r.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}this.outstandingPutCount_===0&&(this.outstandingPuts_=[])}onListenRevoked_(t,r){let n;r?n=r.map(a=>A8(a)).join("$"):n="default";const o=this.removeListen_(t,n);o&&o.onComplete&&o.onComplete("permission_denied")}removeListen_(t,r){const n=new qn(t).toString();let o;if(this.listens.has(n)){const a=this.listens.get(n);o=a.get(r),a.delete(r),a.size===0&&this.listens.delete(n)}else o=void 0;return o}onAuthRevoked_(t,r){xa("Auth token revoked: "+t+"/"+r),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),(t==="invalid_token"||t==="permission_denied")&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=S9&&(this.reconnectDelay_=w9,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(t,r){xa("App check token revoked: "+t+"/"+r),this.appCheckToken_=null,this.forceTokenRefresh_=!0,(t==="invalid_token"||t==="permission_denied")&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=S9&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace(`
`,`
FIREBASE: `))}restoreState_(){this.tryAuth(),this.tryAppCheck();for(const t of this.listens.values())for(const r of t.values())this.sendListen_(r);for(let t=0;t<this.outstandingPuts_.length;t++)this.outstandingPuts_[t]&&this.sendPut_(t);for(;this.onDisconnectRequestQueue_.length;){const t=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(t.action,t.pathString,t.data,t.onComplete)}for(let t=0;t<this.outstandingGets_.length;t++)this.outstandingGets_[t]&&this.sendGet_(t)}sendConnectStats_(){const t={};let r="js";t["sdk."+r+"."+hQ.replace(/\./g,"-")]=1,iQ()?t["framework.cordova"]=1:LEe()&&(t["framework.reactnative"]=1),this.reportStats(t)}shouldReconnect_(){const t=Tw.getInstance().currentlyOnline();return QB(this.interruptReasons_)&&t}}md.nextPersistentConnectionId_=0;md.nextConnectionId_=0;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class $r{constructor(t,r){this.name=t,this.node=r}static Wrap(t,r){return new $r(t,r)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class aj{getCompare(){return this.compare.bind(this)}indexedValueChanged(t,r){const n=new $r(pv,t),o=new $r(pv,r);return this.compare(n,o)!==0}minPost(){return $r.MIN}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let b1;class qQ extends aj{static get __EMPTY_NODE(){return b1}static set __EMPTY_NODE(t){b1=t}compare(t,r){return zv(t.name,r.name)}isDefinedOn(t){throw Fv("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(t,r){return!1}minPost(){return $r.MIN}maxPost(){return new $r(Rh,b1)}makePost(t,r){return $t(typeof t=="string","KeyIndex indexValue must always be a string."),new $r(t,b1)}toString(){return".key"}}const Sm=new qQ;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class w1{constructor(t,r,n,o,a=null){this.isReverse_=o,this.resultGenerator_=a,this.nodeStack_=[];let s=1;for(;!t.isEmpty();)if(t=t,s=r?n(t.key,r):1,o&&(s*=-1),s<0)this.isReverse_?t=t.left:t=t.right;else if(s===0){this.nodeStack_.push(t);break}else this.nodeStack_.push(t),this.isReverse_?t=t.right:t=t.left}getNext(){if(this.nodeStack_.length===0)return null;let t=this.nodeStack_.pop(),r;if(this.resultGenerator_?r=this.resultGenerator_(t.key,t.value):r={key:t.key,value:t.value},this.isReverse_)for(t=t.left;!t.isEmpty();)this.nodeStack_.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return r}hasNext(){return this.nodeStack_.length>0}peek(){if(this.nodeStack_.length===0)return null;const t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}}}class Ro{constructor(t,r,n,o,a){this.key=t,this.value=r,this.color=n??Ro.RED,this.left=o??ps.EMPTY_NODE,this.right=a??ps.EMPTY_NODE}copy(t,r,n,o,a){return new Ro(t??this.key,r??this.value,n??this.color,o??this.left,a??this.right)}count(){return this.left.count()+1+this.right.count()}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min_(){return this.left.isEmpty()?this:this.left.min_()}minKey(){return this.min_().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,r,n){let o=this;const a=n(t,o.key);return a<0?o=o.copy(null,null,null,o.left.insert(t,r,n),null):a===0?o=o.copy(null,r,null,null,null):o=o.copy(null,null,null,null,o.right.insert(t,r,n)),o.fixUp_()}removeMin_(){if(this.left.isEmpty())return ps.EMPTY_NODE;let t=this;return!t.left.isRed_()&&!t.left.left.isRed_()&&(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()}remove(t,r){let n,o;if(n=this,r(t,n.key)<0)!n.left.isEmpty()&&!n.left.isRed_()&&!n.left.left.isRed_()&&(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,r),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),!n.right.isEmpty()&&!n.right.isRed_()&&!n.right.left.isRed_()&&(n=n.moveRedRight_()),r(t,n.key)===0){if(n.right.isEmpty())return ps.EMPTY_NODE;o=n.right.min_(),n=n.copy(o.key,o.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,r))}return n.fixUp_()}isRed_(){return this.color}fixUp_(){let t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t}moveRedLeft_(){let t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t}moveRedRight_(){let t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t}rotateLeft_(){const t=this.copy(null,null,Ro.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight_(){const t=this.copy(null,null,Ro.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip_(){const t=this.left.copy(null,null,!this.left.color,null,null),r=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,r)}checkMaxDepth_(){const t=this.check_();return Math.pow(2,t)<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");const t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)}}Ro.RED=!0;Ro.BLACK=!1;class r6e{copy(t,r,n,o,a){return this}insert(t,r,n){return new Ro(t,r,null)}remove(t,r){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class ps{constructor(t,r=ps.EMPTY_NODE){this.comparator_=t,this.root_=r}insert(t,r){return new ps(this.comparator_,this.root_.insert(t,r,this.comparator_).copy(null,null,Ro.BLACK,null,null))}remove(t){return new ps(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Ro.BLACK,null,null))}get(t){let r,n=this.root_;for(;!n.isEmpty();){if(r=this.comparator_(t,n.key),r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}getPredecessorKey(t){let r,n=this.root_,o=null;for(;!n.isEmpty();)if(r=this.comparator_(t,n.key),r===0){if(n.left.isEmpty())return o?o.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}else r<0?n=n.left:r>0&&(o=n,n=n.right);throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(t){return this.root_.inorderTraversal(t)}reverseTraversal(t){return this.root_.reverseTraversal(t)}getIterator(t){return new w1(this.root_,null,this.comparator_,!1,t)}getIteratorFrom(t,r){return new w1(this.root_,t,this.comparator_,!1,r)}getReverseIteratorFrom(t,r){return new w1(this.root_,t,this.comparator_,!0,r)}getReverseIterator(t){return new w1(this.root_,null,this.comparator_,!0,t)}}ps.EMPTY_NODE=new r6e;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function n6e(e,t){return zv(e.name,t.name)}function R8(e,t){return zv(e,t)}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let E6;function i6e(e){E6=e}const $Q=function(e){return typeof e=="number"?"number:"+xQ(e):"string:"+e},UQ=function(e){if(e.isLeafNode()){const t=e.val();$t(typeof t=="string"||typeof t=="number"||typeof t=="object"&&Rd(t,".sv"),"Priority must be a string or number.")}else $t(e===E6||e.isEmpty(),"priority of unexpected type.");$t(e===E6||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let j9;class Io{static set __childrenNodeConstructor(t){j9=t}static get __childrenNodeConstructor(){return j9}constructor(t,r=Io.__childrenNodeConstructor.EMPTY_NODE){this.value_=t,this.priorityNode_=r,this.lazyHash_=null,$t(this.value_!==void 0&&this.value_!==null,"LeafNode shouldn't be created with null/undefined value."),UQ(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(t){return new Io(this.value_,t)}getImmediateChild(t){return t===".priority"?this.priorityNode_:Io.__childrenNodeConstructor.EMPTY_NODE}getChild(t){return Yr(t)?this:Vr(t)===".priority"?this.priorityNode_:Io.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(t,r){return null}updateImmediateChild(t,r){return t===".priority"?this.updatePriority(r):r.isEmpty()&&t!==".priority"?this:Io.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,r).updatePriority(this.priorityNode_)}updateChild(t,r){const n=Vr(t);return n===null?r:r.isEmpty()&&n!==".priority"?this:($t(n!==".priority"||Yf(t)===1,".priority must be the last token in a path"),this.updateImmediateChild(n,Io.__childrenNodeConstructor.EMPTY_NODE.updateChild(Qn(t),r)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(t,r){return!1}val(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(this.lazyHash_===null){let t="";this.priorityNode_.isEmpty()||(t+="priority:"+$Q(this.priorityNode_.val())+":");const r=typeof this.value_;t+=r+":",r==="number"?t+=xQ(this.value_):t+=this.value_,this.lazyHash_=mQ(t)}return this.lazyHash_}getValue(){return this.value_}compareTo(t){return t===Io.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Io.__childrenNodeConstructor?-1:($t(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))}compareToLeafNode_(t){const r=typeof t.value_,n=typeof this.value_,o=Io.VALUE_TYPE_ORDER.indexOf(r),a=Io.VALUE_TYPE_ORDER.indexOf(n);return $t(o>=0,"Unknown leaf type: "+r),$t(a>=0,"Unknown leaf type: "+n),o===a?n==="object"?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:a-o}withIndex(){return this}isIndexed(){return!0}equals(t){if(t===this)return!0;if(t.isLeafNode()){const r=t;return this.value_===r.value_&&this.priorityNode_.equals(r.priorityNode_)}else return!1}}Io.VALUE_TYPE_ORDER=["object","boolean","number","string"];/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let HQ,VQ;function o6e(e){HQ=e}function a6e(e){VQ=e}class s6e extends aj{compare(t,r){const n=t.node.getPriority(),o=r.node.getPriority(),a=n.compareTo(o);return a===0?zv(t.name,r.name):a}isDefinedOn(t){return!t.getPriority().isEmpty()}indexedValueChanged(t,r){return!t.getPriority().equals(r.getPriority())}minPost(){return $r.MIN}maxPost(){return new $r(Rh,new Io("[PRIORITY-POST]",VQ))}makePost(t,r){const n=HQ(t);return new $r(r,new Io("[PRIORITY-POST]",n))}toString(){return".priority"}}const Ni=new s6e;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const l6e=Math.log(2);class c6e{constructor(t){const r=a=>parseInt(Math.log(a)/l6e,10),n=a=>parseInt(Array(a+1).join("1"),2);this.count=r(t+1),this.current_=this.count-1;const o=n(this.count);this.bits_=t+1&o}nextBitIsOne(){const t=!(this.bits_&1<<this.current_);return this.current_--,t}}const Pw=function(e,t,r,n){e.sort(t);const o=function(c,u){const d=u-c;let f,h;if(d===0)return null;if(d===1)return f=e[c],h=r?r(f):f,new Ro(h,f.node,Ro.BLACK,null,null);{const p=parseInt(d/2,10)+c,v=o(c,p),m=o(p+1,u);return f=e[p],h=r?r(f):f,new Ro(h,f.node,Ro.BLACK,v,m)}},a=function(c){let u=null,d=null,f=e.length;const h=function(v,m){const b=f-v,x=f;f-=v;const w=o(b+1,x),k=e[b],j=r?r(k):k;p(new Ro(j,k.node,m,null,w))},p=function(v){u?(u.left=v,u=v):(d=v,u=v)};for(let v=0;v<c.count;++v){const m=c.nextBitIsOne(),b=Math.pow(2,c.count-(v+1));m?h(b,Ro.BLACK):(h(b,Ro.BLACK),h(b,Ro.RED))}return d},s=new c6e(e.length),l=a(s);return new ps(n||t,l)};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let AE;const Ug={};class ld{static get Default(){return $t(Ug&&Ni,"ChildrenNode.ts has not been loaded"),AE=AE||new ld({".priority":Ug},{".priority":Ni}),AE}constructor(t,r){this.indexes_=t,this.indexSet_=r}get(t){const r=fv(this.indexes_,t);if(!r)throw new Error("No index defined for "+t);return r instanceof ps?r:null}hasIndex(t){return Rd(this.indexSet_,t.toString())}addIndex(t,r){$t(t!==Sm,"KeyIndex always exists and isn't meant to be added to the IndexMap.");const n=[];let o=!1;const a=r.getIterator($r.Wrap);let s=a.getNext();for(;s;)o=o||t.isDefinedOn(s.node),n.push(s),s=a.getNext();let l;o?l=Pw(n,t.getCompare()):l=Ug;const c=t.toString(),u=Object.assign({},this.indexSet_);u[c]=t;const d=Object.assign({},this.indexes_);return d[c]=l,new ld(d,u)}addToIndexes(t,r){const n=_w(this.indexes_,(o,a)=>{const s=fv(this.indexSet_,a);if($t(s,"Missing index implementation for "+a),o===Ug)if(s.isDefinedOn(t.node)){const l=[],c=r.getIterator($r.Wrap);let u=c.getNext();for(;u;)u.name!==t.name&&l.push(u),u=c.getNext();return l.push(t),Pw(l,s.getCompare())}else return Ug;else{const l=r.get(t.name);let c=o;return l&&(c=c.remove(new $r(t.name,l))),c.insert(t,t.node)}});return new ld(n,this.indexSet_)}removeFromIndexes(t,r){const n=_w(this.indexes_,o=>{if(o===Ug)return o;{const a=r.get(t.name);return a?o.remove(new $r(t.name,a)):o}});return new ld(n,this.indexSet_)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let By;class kr{static get EMPTY_NODE(){return By||(By=new kr(new ps(R8),null,ld.Default))}constructor(t,r,n){this.children_=t,this.priorityNode_=r,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&UQ(this.priorityNode_),this.children_.isEmpty()&&$t(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||By}updatePriority(t){return this.children_.isEmpty()?this:new kr(this.children_,t,this.indexMap_)}getImmediateChild(t){if(t===".priority")return this.getPriority();{const r=this.children_.get(t);return r===null?By:r}}getChild(t){const r=Vr(t);return r===null?this:this.getImmediateChild(r).getChild(Qn(t))}hasChild(t){return this.children_.get(t)!==null}updateImmediateChild(t,r){if($t(r,"We should always be passing snapshot nodes"),t===".priority")return this.updatePriority(r);{const n=new $r(t,r);let o,a;r.isEmpty()?(o=this.children_.remove(t),a=this.indexMap_.removeFromIndexes(n,this.children_)):(o=this.children_.insert(t,r),a=this.indexMap_.addToIndexes(n,this.children_));const s=o.isEmpty()?By:this.priorityNode_;return new kr(o,s,a)}}updateChild(t,r){const n=Vr(t);if(n===null)return r;{$t(Vr(t)!==".priority"||Yf(t)===1,".priority must be the last token in a path");const o=this.getImmediateChild(n).updateChild(Qn(t),r);return this.updateImmediateChild(n,o)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(t){if(this.isEmpty())return null;const r={};let n=0,o=0,a=!0;if(this.forEachChild(Ni,(s,l)=>{r[s]=l.val(t),n++,a&&kr.INTEGER_REGEXP_.test(s)?o=Math.max(o,Number(s)):a=!1}),!t&&a&&o<2*n){const s=[];for(const l in r)s[l]=r[l];return s}else return t&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r}hash(){if(this.lazyHash_===null){let t="";this.getPriority().isEmpty()||(t+="priority:"+$Q(this.getPriority().val())+":"),this.forEachChild(Ni,(r,n)=>{const o=n.hash();o!==""&&(t+=":"+r+":"+o)}),this.lazyHash_=t===""?"":mQ(t)}return this.lazyHash_}getPredecessorChildName(t,r,n){const o=this.resolveIndex_(n);if(o){const a=o.getPredecessorKey(new $r(t,r));return a?a.name:null}else return this.children_.getPredecessorKey(t)}getFirstChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.minKey();return n&&n.name}else return this.children_.minKey()}getFirstChild(t){const r=this.getFirstChildName(t);return r?new $r(r,this.children_.get(r)):null}getLastChildName(t){const r=this.resolveIndex_(t);if(r){const n=r.maxKey();return n&&n.name}else return this.children_.maxKey()}getLastChild(t){const r=this.getLastChildName(t);return r?new $r(r,this.children_.get(r)):null}forEachChild(t,r){const n=this.resolveIndex_(t);return n?n.inorderTraversal(o=>r(o.name,o.node)):this.children_.inorderTraversal(r)}getIterator(t){return this.getIteratorFrom(t.minPost(),t)}getIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getIteratorFrom(t,o=>o);{const o=this.children_.getIteratorFrom(t.name,$r.Wrap);let a=o.peek();for(;a!=null&&r.compare(a,t)<0;)o.getNext(),a=o.peek();return o}}getReverseIterator(t){return this.getReverseIteratorFrom(t.maxPost(),t)}getReverseIteratorFrom(t,r){const n=this.resolveIndex_(r);if(n)return n.getReverseIteratorFrom(t,o=>o);{const o=this.children_.getReverseIteratorFrom(t.name,$r.Wrap);let a=o.peek();for(;a!=null&&r.compare(a,t)>0;)o.getNext(),a=o.peek();return o}}compareTo(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Xb?-1:0}withIndex(t){if(t===Sm||this.indexMap_.hasIndex(t))return this;{const r=this.indexMap_.addIndex(t,this.children_);return new kr(this.children_,this.priorityNode_,r)}}isIndexed(t){return t===Sm||this.indexMap_.hasIndex(t)}equals(t){if(t===this)return!0;if(t.isLeafNode())return!1;{const r=t;if(this.getPriority().equals(r.getPriority()))if(this.children_.count()===r.children_.count()){const n=this.getIterator(Ni),o=r.getIterator(Ni);let a=n.getNext(),s=o.getNext();for(;a&&s;){if(a.name!==s.name||!a.node.equals(s.node))return!1;a=n.getNext(),s=o.getNext()}return a===null&&s===null}else return!1;else return!1}}resolveIndex_(t){return t===Sm?null:this.indexMap_.get(t.toString())}}kr.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class u6e extends kr{constructor(){super(new ps(R8),kr.EMPTY_NODE,ld.Default)}compareTo(t){return t===this?0:1}equals(t){return t===this}getPriority(){return this}getImmediateChild(t){return kr.EMPTY_NODE}isEmpty(){return!1}}const Xb=new u6e;Object.defineProperties($r,{MIN:{value:new $r(pv,kr.EMPTY_NODE)},MAX:{value:new $r(Rh,Xb)}});qQ.__EMPTY_NODE=kr.EMPTY_NODE;Io.__childrenNodeConstructor=kr;i6e(Xb);a6e(Xb);/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const d6e=!0;function ba(e,t=null){if(e===null)return kr.EMPTY_NODE;if(typeof e=="object"&&".priority"in e&&(t=e[".priority"]),$t(t===null||typeof t=="string"||typeof t=="number"||typeof t=="object"&&".sv"in t,"Invalid priority type found: "+typeof t),typeof e=="object"&&".value"in e&&e[".value"]!==null&&(e=e[".value"]),typeof e!="object"||".sv"in e){const r=e;return new Io(r,ba(t))}if(!(e instanceof Array)&&d6e){const r=[];let n=!1;if(ms(e,(s,l)=>{if(s.substring(0,1)!=="."){const c=ba(l);c.isEmpty()||(n=n||!c.getPriority().isEmpty(),r.push(new $r(s,c)))}}),r.length===0)return kr.EMPTY_NODE;const a=Pw(r,n6e,s=>s.name,R8);if(n){const s=Pw(r,Ni.getCompare());return new kr(a,ba(t),new ld({".priority":s},{".priority":Ni}))}else return new kr(a,ba(t),ld.Default)}else{let r=kr.EMPTY_NODE;return ms(e,(n,o)=>{if(Rd(e,n)&&n.substring(0,1)!=="."){const a=ba(o);(a.isLeafNode()||!a.isEmpty())&&(r=r.updateImmediateChild(n,a))}}),r.updatePriority(ba(t))}}o6e(ba);/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class f6e extends aj{constructor(t){super(),this.indexPath_=t,$t(!Yr(t)&&Vr(t)!==".priority","Can't create PathIndex with empty path or .priority key")}extractChild(t){return t.getChild(this.indexPath_)}isDefinedOn(t){return!t.getChild(this.indexPath_).isEmpty()}compare(t,r){const n=this.extractChild(t.node),o=this.extractChild(r.node),a=n.compareTo(o);return a===0?zv(t.name,r.name):a}makePost(t,r){const n=ba(t),o=kr.EMPTY_NODE.updateChild(this.indexPath_,n);return new $r(r,o)}maxPost(){const t=kr.EMPTY_NODE.updateChild(this.indexPath_,Xb);return new $r(Rh,t)}toString(){return DQ(this.indexPath_,0).join("/")}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class p6e extends aj{compare(t,r){const n=t.node.compareTo(r.node);return n===0?zv(t.name,r.name):n}isDefinedOn(t){return!0}indexedValueChanged(t,r){return!t.equals(r)}minPost(){return $r.MIN}maxPost(){return $r.MAX}makePost(t,r){const n=ba(t);return new $r(r,n)}toString(){return".value"}}const h6e=new p6e;/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function YQ(e){return{type:"value",snapshotNode:e}}function hv(e,t){return{type:"child_added",snapshotNode:t,childName:e}}function vb(e,t){return{type:"child_removed",snapshotNode:t,childName:e}}function yb(e,t,r){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:r}}function g6e(e,t){return{type:"child_moved",snapshotNode:t,childName:e}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class L8{constructor(t){this.index_=t}updateChild(t,r,n,o,a,s){$t(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");const l=t.getImmediateChild(r);return l.getChild(o).equals(n.getChild(o))&&l.isEmpty()===n.isEmpty()||(s!=null&&(n.isEmpty()?t.hasChild(r)?s.trackChildChange(vb(r,l)):$t(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):l.isEmpty()?s.trackChildChange(hv(r,n)):s.trackChildChange(yb(r,n,l))),t.isLeafNode()&&n.isEmpty())?t:t.updateImmediateChild(r,n).withIndex(this.index_)}updateFullNode(t,r,n){return n!=null&&(t.isLeafNode()||t.forEachChild(Ni,(o,a)=>{r.hasChild(o)||n.trackChildChange(vb(o,a))}),r.isLeafNode()||r.forEachChild(Ni,(o,a)=>{if(t.hasChild(o)){const s=t.getImmediateChild(o);s.equals(a)||n.trackChildChange(yb(o,a,s))}else n.trackChildChange(hv(o,a))})),r.withIndex(this.index_)}updatePriority(t,r){return t.isEmpty()?kr.EMPTY_NODE:t.updatePriority(r)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class xb{constructor(t){this.indexedFilter_=new L8(t.getIndex()),this.index_=t.getIndex(),this.startPost_=xb.getStartPost_(t),this.endPost_=xb.getEndPost_(t),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(t){const r=this.startIsInclusive_?this.index_.compare(this.getStartPost(),t)<=0:this.index_.compare(this.getStartPost(),t)<0,n=this.endIsInclusive_?this.index_.compare(t,this.getEndPost())<=0:this.index_.compare(t,this.getEndPost())<0;return r&&n}updateChild(t,r,n,o,a,s){return this.matches(new $r(r,n))||(n=kr.EMPTY_NODE),this.indexedFilter_.updateChild(t,r,n,o,a,s)}updateFullNode(t,r,n){r.isLeafNode()&&(r=kr.EMPTY_NODE);let o=r.withIndex(this.index_);o=o.updatePriority(kr.EMPTY_NODE);const a=this;return r.forEachChild(Ni,(s,l)=>{a.matches(new $r(s,l))||(o=o.updateImmediateChild(s,kr.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,o,n)}updatePriority(t,r){return t}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(t){if(t.hasStart()){const r=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),r)}else return t.getIndex().minPost()}static getEndPost_(t){if(t.hasEnd()){const r=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),r)}else return t.getIndex().maxPost()}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class m6e{constructor(t){this.withinDirectionalStart=r=>this.reverse_?this.withinEndPost(r):this.withinStartPost(r),this.withinDirectionalEnd=r=>this.reverse_?this.withinStartPost(r):this.withinEndPost(r),this.withinStartPost=r=>{const n=this.index_.compare(this.rangedFilter_.getStartPost(),r);return this.startIsInclusive_?n<=0:n<0},this.withinEndPost=r=>{const n=this.index_.compare(r,this.rangedFilter_.getEndPost());return this.endIsInclusive_?n<=0:n<0},this.rangedFilter_=new xb(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft(),this.startIsInclusive_=!t.startAfterSet_,this.endIsInclusive_=!t.endBeforeSet_}updateChild(t,r,n,o,a,s){return this.rangedFilter_.matches(new $r(r,n))||(n=kr.EMPTY_NODE),t.getImmediateChild(r).equals(n)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,r,n,o,a,s):this.fullLimitUpdateChild_(t,r,n,a,s)}updateFullNode(t,r,n){let o;if(r.isLeafNode()||r.isEmpty())o=kr.EMPTY_NODE.withIndex(this.index_);else if(this.limit_*2<r.numChildren()&&r.isIndexed(this.index_)){o=kr.EMPTY_NODE.withIndex(this.index_);let a;this.reverse_?a=r.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):a=r.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let s=0;for(;a.hasNext()&&s<this.limit_;){const l=a.getNext();if(this.withinDirectionalStart(l))if(this.withinDirectionalEnd(l))o=o.updateImmediateChild(l.name,l.node),s++;else break;else continue}}else{o=r.withIndex(this.index_),o=o.updatePriority(kr.EMPTY_NODE);let a;this.reverse_?a=o.getReverseIterator(this.index_):a=o.getIterator(this.index_);let s=0;for(;a.hasNext();){const l=a.getNext();s<this.limit_&&this.withinDirectionalStart(l)&&this.withinDirectionalEnd(l)?s++:o=o.updateImmediateChild(l.name,kr.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,o,n)}updatePriority(t,r){return t}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}fullLimitUpdateChild_(t,r,n,o,a){let s;if(this.reverse_){const f=this.index_.getCompare();s=(h,p)=>f(p,h)}else s=this.index_.getCompare();const l=t;$t(l.numChildren()===this.limit_,"");const c=new $r(r,n),u=this.reverse_?l.getFirstChild(this.index_):l.getLastChild(this.index_),d=this.rangedFilter_.matches(c);if(l.hasChild(r)){const f=l.getImmediateChild(r);let h=o.getChildAfterChild(this.index_,u,this.reverse_);for(;h!=null&&(h.name===r||l.hasChild(h.name));)h=o.getChildAfterChild(this.index_,h,this.reverse_);const p=h==null?1:s(h,c);if(d&&!n.isEmpty()&&p>=0)return a!=null&&a.trackChildChange(yb(r,n,f)),l.updateImmediateChild(r,n);{a!=null&&a.trackChildChange(vb(r,f));const m=l.updateImmediateChild(r,kr.EMPTY_NODE);return h!=null&&this.rangedFilter_.matches(h)?(a!=null&&a.trackChildChange(hv(h.name,h.node)),m.updateImmediateChild(h.name,h.node)):m}}else return n.isEmpty()?t:d&&s(u,c)>=0?(a!=null&&(a.trackChildChange(vb(u.name,u.node)),a.trackChildChange(hv(r,n))),l.updateImmediateChild(r,n).updateImmediateChild(u.name,kr.EMPTY_NODE)):t}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class F8{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Ni}hasStart(){return this.startSet_}isViewFromLeft(){return this.viewFrom_===""?this.startSet_:this.viewFrom_==="l"}getIndexStartValue(){return $t(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return $t(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:pv}hasEnd(){return this.endSet_}getIndexEndValue(){return $t(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return $t(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Rh}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&this.viewFrom_!==""}getLimit(){return $t(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===Ni}copy(){const t=new F8;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.startAfterSet_=this.startAfterSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.endBeforeSet_=this.endBeforeSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t}}function v6e(e){return e.loadsAllData()?new L8(e.getIndex()):e.hasLimit()?new m6e(e):new xb(e)}function k9(e){const t={};if(e.isDefault())return t;let r;if(e.index_===Ni?r="$priority":e.index_===h6e?r="$value":e.index_===Sm?r="$key":($t(e.index_ instanceof f6e,"Unrecognized index type!"),r=e.index_.toString()),t.orderBy=zo(r),e.startSet_){const n=e.startAfterSet_?"startAfter":"startAt";t[n]=zo(e.indexStartValue_),e.startNameSet_&&(t[n]+=","+zo(e.indexStartName_))}if(e.endSet_){const n=e.endBeforeSet_?"endBefore":"endAt";t[n]=zo(e.indexEndValue_),e.endNameSet_&&(t[n]+=","+zo(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?t.limitToFirst=e.limit_:t.limitToLast=e.limit_),t}function _9(e){const t={};if(e.startSet_&&(t.sp=e.indexStartValue_,e.startNameSet_&&(t.sn=e.indexStartName_),t.sin=!e.startAfterSet_),e.endSet_&&(t.ep=e.indexEndValue_,e.endNameSet_&&(t.en=e.indexEndName_),t.ein=!e.endBeforeSet_),e.limitSet_){t.l=e.limit_;let r=e.viewFrom_;r===""&&(e.isViewFromLeft()?r="l":r="r"),t.vf=r}return e.index_!==Ni&&(t.i=e.index_.toString()),t}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Iw extends FQ{reportStats(t){throw new Error("Method not implemented.")}static getListenId_(t,r){return r!==void 0?"tag$"+r:($t(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())}constructor(t,r,n,o){super(),this.repoInfo_=t,this.onDataUpdate_=r,this.authTokenProvider_=n,this.appCheckTokenProvider_=o,this.log_=Kb("p:rest:"),this.listens_={}}listen(t,r,n,o){const a=t._path.toString();this.log_("Listen called for "+a+" "+t._queryIdentifier);const s=Iw.getListenId_(t,n),l={};this.listens_[s]=l;const c=k9(t._queryParams);this.restRequest_(a+".json",c,(u,d)=>{let f=d;if(u===404&&(f=null,u=null),u===null&&this.onDataUpdate_(a,f,!1,n),fv(this.listens_,s)===l){let h;u?u===401?h="permission_denied":h="rest_error:"+u:h="ok",o(h,null)}})}unlisten(t,r){const n=Iw.getListenId_(t,r);delete this.listens_[n]}get(t){const r=k9(t._queryParams),n=t._path.toString(),o=new _8;return this.restRequest_(n+".json",r,(a,s)=>{let l=s;a===404&&(l=null,a=null),a===null?(this.onDataUpdate_(n,l,!1,null),o.resolve(l)):o.reject(new Error(l))}),o.promise}refreshAuthToken(t){}restRequest_(t,r={},n){return r.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([o,a])=>{o&&o.accessToken&&(r.auth=o.accessToken),a&&a.token&&(r.ac=a.token);const s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+t+"?ns="+this.repoInfo_.namespace+UEe(r);this.log_("Sending REST request for "+s);const l=new XMLHttpRequest;l.onreadystatechange=()=>{if(n&&l.readyState===4){this.log_("REST Response for "+s+" received. status:",l.status,"response:",l.responseText);let c=null;if(l.status>=200&&l.status<300){try{c=fb(l.responseText)}catch{Xs("Failed to parse JSON response for "+s+": "+l.responseText)}n(null,c)}else l.status!==401&&l.status!==404&&Xs("Got unsuccessful REST response for "+s+" Status: "+l.status),n(l.status);n=null}},l.open("GET",s,!0),l.send()})}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class y6e{constructor(){this.rootNode_=kr.EMPTY_NODE}getNode(t){return this.rootNode_.getChild(t)}updateSnapshot(t,r){this.rootNode_=this.rootNode_.updateChild(t,r)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function Ow(){return{value:null,children:new Map}}function GQ(e,t,r){if(Yr(t))e.value=r,e.children.clear();else if(e.value!==null)e.value=e.value.updateChild(t,r);else{const n=Vr(t);e.children.has(n)||e.children.set(n,Ow());const o=e.children.get(n);t=Qn(t),GQ(o,t,r)}}function A6(e,t,r){e.value!==null?r(t,e.value):x6e(e,(n,o)=>{const a=new qn(t.toString()+"/"+n);A6(o,a,r)})}function x6e(e,t){e.children.forEach((r,n)=>{t(n,r)})}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class b6e{constructor(t){this.collection_=t,this.last_=null}get(){const t=this.collection_.get(),r=Object.assign({},t);return this.last_&&ms(this.last_,(n,o)=>{r[n]=r[n]-o}),this.last_=t,r}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const C9=10*1e3,w6e=30*1e3,S6e=300*1e3;class j6e{constructor(t,r){this.server_=r,this.statsToReport_={},this.statsListener_=new b6e(t);const n=C9+(w6e-C9)*Math.random();fx(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){const t=this.statsListener_.get(),r={};let n=!1;ms(t,(o,a)=>{a>0&&Rd(this.statsToReport_,o)&&(r[o]=a,n=!0)}),n&&this.server_.reportStats(r),fx(this.reportStats_.bind(this),Math.floor(Math.random()*2*S6e))}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var uc;(function(e){e[e.OVERWRITE=0]="OVERWRITE",e[e.MERGE=1]="MERGE",e[e.ACK_USER_WRITE=2]="ACK_USER_WRITE",e[e.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"})(uc||(uc={}));function KQ(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function z8(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function M8(e){return{fromUser:!1,fromServer:!0,queryId:e,tagged:!0}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Nw{constructor(t,r,n){this.path=t,this.affectedTree=r,this.revert=n,this.type=uc.ACK_USER_WRITE,this.source=KQ()}operationForChild(t){if(Yr(this.path)){if(this.affectedTree.value!=null)return $t(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{const r=this.affectedTree.subtree(new qn(t));return new Nw(gn(),r,this.revert)}}else return $t(Vr(this.path)===t,"operationForChild called for unrelated child."),new Nw(Qn(this.path),this.affectedTree,this.revert)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class bb{constructor(t,r){this.source=t,this.path=r,this.type=uc.LISTEN_COMPLETE}operationForChild(t){return Yr(this.path)?new bb(this.source,gn()):new bb(this.source,Qn(this.path))}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Lh{constructor(t,r,n){this.source=t,this.path=r,this.snap=n,this.type=uc.OVERWRITE}operationForChild(t){return Yr(this.path)?new Lh(this.source,gn(),this.snap.getImmediateChild(t)):new Lh(this.source,Qn(this.path),this.snap)}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class wb{constructor(t,r,n){this.source=t,this.path=r,this.children=n,this.type=uc.MERGE}operationForChild(t){if(Yr(this.path)){const r=this.children.subtree(new qn(t));return r.isEmpty()?null:r.value?new Lh(this.source,gn(),r.value):new wb(this.source,gn(),r)}else return $t(Vr(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new wb(this.source,Qn(this.path),this.children)}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Fh{constructor(t,r,n){this.node_=t,this.fullyInitialized_=r,this.filtered_=n}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(t){if(Yr(t))return this.isFullyInitialized()&&!this.filtered_;const r=Vr(t);return this.isCompleteForChild(r)}isCompleteForChild(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)}getNode(){return this.node_}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class k6e{constructor(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()}}function _6e(e,t,r,n){const o=[],a=[];return t.forEach(s=>{s.type==="child_changed"&&e.index_.indexedValueChanged(s.oldSnap,s.snapshotNode)&&a.push(g6e(s.childName,s.snapshotNode))}),Wy(e,o,"child_removed",t,n,r),Wy(e,o,"child_added",t,n,r),Wy(e,o,"child_moved",a,n,r),Wy(e,o,"child_changed",t,n,r),Wy(e,o,"value",t,n,r),o}function Wy(e,t,r,n,o,a){const s=n.filter(l=>l.type===r);s.sort((l,c)=>E6e(e,l,c)),s.forEach(l=>{const c=C6e(e,l,a);o.forEach(u=>{u.respondsTo(l.type)&&t.push(u.createEvent(c,e.query_))})})}function C6e(e,t,r){return t.type==="value"||t.type==="child_removed"||(t.prevName=r.getPredecessorChildName(t.childName,t.snapshotNode,e.index_)),t}function E6e(e,t,r){if(t.childName==null||r.childName==null)throw Fv("Should only compare child_ events.");const n=new $r(t.childName,t.snapshotNode),o=new $r(r.childName,r.snapshotNode);return e.index_.compare(n,o)}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function sj(e,t){return{eventCache:e,serverCache:t}}function px(e,t,r,n){return sj(new Fh(t,r,n),e.serverCache)}function QQ(e,t,r,n){return sj(e.eventCache,new Fh(t,r,n))}function T6(e){return e.eventCache.isFullyInitialized()?e.eventCache.getNode():null}function zh(e){return e.serverCache.isFullyInitialized()?e.serverCache.getNode():null}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let TE;const A6e=()=>(TE||(TE=new ps(pAe)),TE);class ii{static fromObject(t){let r=new ii(null);return ms(t,(n,o)=>{r=r.set(new qn(n),o)}),r}constructor(t,r=A6e()){this.value=t,this.children=r}isEmpty(){return this.value===null&&this.children.isEmpty()}findRootMostMatchingPathAndValue(t,r){if(this.value!=null&&r(this.value))return{path:gn(),value:this.value};if(Yr(t))return null;{const n=Vr(t),o=this.children.get(n);if(o!==null){const a=o.findRootMostMatchingPathAndValue(Qn(t),r);return a!=null?{path:ho(new qn(n),a.path),value:a.value}:null}else return null}}findRootMostValueAndPath(t){return this.findRootMostMatchingPathAndValue(t,()=>!0)}subtree(t){if(Yr(t))return this;{const r=Vr(t),n=this.children.get(r);return n!==null?n.subtree(Qn(t)):new ii(null)}}set(t,r){if(Yr(t))return new ii(r,this.children);{const n=Vr(t),a=(this.children.get(n)||new ii(null)).set(Qn(t),r),s=this.children.insert(n,a);return new ii(this.value,s)}}remove(t){if(Yr(t))return this.children.isEmpty()?new ii(null):new ii(null,this.children);{const r=Vr(t),n=this.children.get(r);if(n){const o=n.remove(Qn(t));let a;return o.isEmpty()?a=this.children.remove(r):a=this.children.insert(r,o),this.value===null&&a.isEmpty()?new ii(null):new ii(this.value,a)}else return this}}get(t){if(Yr(t))return this.value;{const r=Vr(t),n=this.children.get(r);return n?n.get(Qn(t)):null}}setTree(t,r){if(Yr(t))return r;{const n=Vr(t),a=(this.children.get(n)||new ii(null)).setTree(Qn(t),r);let s;return a.isEmpty()?s=this.children.remove(n):s=this.children.insert(n,a),new ii(this.value,s)}}fold(t){return this.fold_(gn(),t)}fold_(t,r){const n={};return this.children.inorderTraversal((o,a)=>{n[o]=a.fold_(ho(t,o),r)}),r(t,this.value,n)}findOnPath(t,r){return this.findOnPath_(t,gn(),r)}findOnPath_(t,r,n){const o=this.value?n(r,this.value):!1;if(o)return o;if(Yr(t))return null;{const a=Vr(t),s=this.children.get(a);return s?s.findOnPath_(Qn(t),ho(r,a),n):null}}foreachOnPath(t,r){return this.foreachOnPath_(t,gn(),r)}foreachOnPath_(t,r,n){if(Yr(t))return this;{this.value&&n(r,this.value);const o=Vr(t),a=this.children.get(o);return a?a.foreachOnPath_(Qn(t),ho(r,o),n):new ii(null)}}foreach(t){this.foreach_(gn(),t)}foreach_(t,r){this.children.inorderTraversal((n,o)=>{o.foreach_(ho(t,n),r)}),this.value&&r(t,this.value)}foreachChild(t){this.children.inorderTraversal((r,n)=>{n.value&&t(r,n.value)})}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class fc{constructor(t){this.writeTree_=t}static empty(){return new fc(new ii(null))}}function hx(e,t,r){if(Yr(t))return new fc(new ii(r));{const n=e.writeTree_.findRootMostValueAndPath(t);if(n!=null){const o=n.path;let a=n.value;const s=fs(o,t);return a=a.updateChild(s,r),new fc(e.writeTree_.set(o,a))}else{const o=new ii(r),a=e.writeTree_.setTree(t,o);return new fc(a)}}}function E9(e,t,r){let n=e;return ms(r,(o,a)=>{n=hx(n,ho(t,o),a)}),n}function A9(e,t){if(Yr(t))return fc.empty();{const r=e.writeTree_.setTree(t,new ii(null));return new fc(r)}}function P6(e,t){return Zh(e,t)!=null}function Zh(e,t){const r=e.writeTree_.findRootMostValueAndPath(t);return r!=null?e.writeTree_.get(r.path).getChild(fs(r.path,t)):null}function T9(e){const t=[],r=e.writeTree_.value;return r!=null?r.isLeafNode()||r.forEachChild(Ni,(n,o)=>{t.push(new $r(n,o))}):e.writeTree_.children.inorderTraversal((n,o)=>{o.value!=null&&t.push(new $r(n,o.value))}),t}function Bf(e,t){if(Yr(t))return e;{const r=Zh(e,t);return r!=null?new fc(new ii(r)):new fc(e.writeTree_.subtree(t))}}function I6(e){return e.writeTree_.isEmpty()}function gv(e,t){return XQ(gn(),e.writeTree_,t)}function XQ(e,t,r){if(t.value!=null)return r.updateChild(e,t.value);{let n=null;return t.children.inorderTraversal((o,a)=>{o===".priority"?($t(a.value!==null,"Priority writes must always be leaf nodes"),n=a.value):r=XQ(ho(e,o),a,r)}),!r.getChild(e).isEmpty()&&n!==null&&(r=r.updateChild(ho(e,".priority"),n)),r}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function D8(e,t){return tX(t,e)}function T6e(e,t,r,n,o){$t(n>e.lastWriteId,"Stacking an older write on top of newer ones"),o===void 0&&(o=!0),e.allWrites.push({path:t,snap:r,writeId:n,visible:o}),o&&(e.visibleWrites=hx(e.visibleWrites,t,r)),e.lastWriteId=n}function P6e(e,t){for(let r=0;r<e.allWrites.length;r++){const n=e.allWrites[r];if(n.writeId===t)return n}return null}function I6e(e,t){const r=e.allWrites.findIndex(l=>l.writeId===t);$t(r>=0,"removeWrite called with nonexistent writeId.");const n=e.allWrites[r];e.allWrites.splice(r,1);let o=n.visible,a=!1,s=e.allWrites.length-1;for(;o&&s>=0;){const l=e.allWrites[s];l.visible&&(s>=r&&O6e(l,n.path)?o=!1:cc(n.path,l.path)&&(a=!0)),s--}if(o){if(a)return N6e(e),!0;if(n.snap)e.visibleWrites=A9(e.visibleWrites,n.path);else{const l=n.children;ms(l,c=>{e.visibleWrites=A9(e.visibleWrites,ho(n.path,c))})}return!0}else return!1}function O6e(e,t){if(e.snap)return cc(e.path,t);for(const r in e.children)if(e.children.hasOwnProperty(r)&&cc(ho(e.path,r),t))return!0;return!1}function N6e(e){e.visibleWrites=ZQ(e.allWrites,R6e,gn()),e.allWrites.length>0?e.lastWriteId=e.allWrites[e.allWrites.length-1].writeId:e.lastWriteId=-1}function R6e(e){return e.visible}function ZQ(e,t,r){let n=fc.empty();for(let o=0;o<e.length;++o){const a=e[o];if(t(a)){const s=a.path;let l;if(a.snap)cc(r,s)?(l=fs(r,s),n=hx(n,l,a.snap)):cc(s,r)&&(l=fs(s,r),n=hx(n,gn(),a.snap.getChild(l)));else if(a.children){if(cc(r,s))l=fs(r,s),n=E9(n,l,a.children);else if(cc(s,r))if(l=fs(s,r),Yr(l))n=E9(n,gn(),a.children);else{const c=fv(a.children,Vr(l));if(c){const u=c.getChild(Qn(l));n=hx(n,gn(),u)}}}else throw Fv("WriteRecord should have .snap or .children")}}return n}function JQ(e,t,r,n,o){if(!n&&!o){const a=Zh(e.visibleWrites,t);if(a!=null)return a;{const s=Bf(e.visibleWrites,t);if(I6(s))return r;if(r==null&&!P6(s,gn()))return null;{const l=r||kr.EMPTY_NODE;return gv(s,l)}}}else{const a=Bf(e.visibleWrites,t);if(!o&&I6(a))return r;if(!o&&r==null&&!P6(a,gn()))return null;{const s=function(u){return(u.visible||o)&&(!n||!~n.indexOf(u.writeId))&&(cc(u.path,t)||cc(t,u.path))},l=ZQ(e.allWrites,s,t),c=r||kr.EMPTY_NODE;return gv(l,c)}}}function L6e(e,t,r){let n=kr.EMPTY_NODE;const o=Zh(e.visibleWrites,t);if(o)return o.isLeafNode()||o.forEachChild(Ni,(a,s)=>{n=n.updateImmediateChild(a,s)}),n;if(r){const a=Bf(e.visibleWrites,t);return r.forEachChild(Ni,(s,l)=>{const c=gv(Bf(a,new qn(s)),l);n=n.updateImmediateChild(s,c)}),T9(a).forEach(s=>{n=n.updateImmediateChild(s.name,s.node)}),n}else{const a=Bf(e.visibleWrites,t);return T9(a).forEach(s=>{n=n.updateImmediateChild(s.name,s.node)}),n}}function F6e(e,t,r,n,o){$t(n||o,"Either existingEventSnap or existingServerSnap must exist");const a=ho(t,r);if(P6(e.visibleWrites,a))return null;{const s=Bf(e.visibleWrites,a);return I6(s)?o.getChild(r):gv(s,o.getChild(r))}}function z6e(e,t,r,n){const o=ho(t,r),a=Zh(e.visibleWrites,o);if(a!=null)return a;if(n.isCompleteForChild(r)){const s=Bf(e.visibleWrites,o);return gv(s,n.getNode().getImmediateChild(r))}else return null}function M6e(e,t){return Zh(e.visibleWrites,t)}function D6e(e,t,r,n,o,a,s){let l;const c=Bf(e.visibleWrites,t),u=Zh(c,gn());if(u!=null)l=u;else if(r!=null)l=gv(c,r);else return[];if(l=l.withIndex(s),!l.isEmpty()&&!l.isLeafNode()){const d=[],f=s.getCompare(),h=a?l.getReverseIteratorFrom(n,s):l.getIteratorFrom(n,s);let p=h.getNext();for(;p&&d.length<o;)f(p,n)!==0&&d.push(p),p=h.getNext();return d}else return[]}function B6e(){return{visibleWrites:fc.empty(),allWrites:[],lastWriteId:-1}}function Rw(e,t,r,n){return JQ(e.writeTree,e.treePath,t,r,n)}function B8(e,t){return L6e(e.writeTree,e.treePath,t)}function P9(e,t,r,n){return F6e(e.writeTree,e.treePath,t,r,n)}function Lw(e,t){return M6e(e.writeTree,ho(e.treePath,t))}function W6e(e,t,r,n,o,a){return D6e(e.writeTree,e.treePath,t,r,n,o,a)}function W8(e,t,r){return z6e(e.writeTree,e.treePath,t,r)}function eX(e,t){return tX(ho(e.treePath,t),e.writeTree)}function tX(e,t){return{treePath:e,writeTree:t}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class q6e{constructor(){this.changeMap=new Map}trackChildChange(t){const r=t.type,n=t.childName;$t(r==="child_added"||r==="child_changed"||r==="child_removed","Only child changes supported for tracking"),$t(n!==".priority","Only non-priority child changes can be tracked.");const o=this.changeMap.get(n);if(o){const a=o.type;if(r==="child_added"&&a==="child_removed")this.changeMap.set(n,yb(n,t.snapshotNode,o.snapshotNode));else if(r==="child_removed"&&a==="child_added")this.changeMap.delete(n);else if(r==="child_removed"&&a==="child_changed")this.changeMap.set(n,vb(n,o.oldSnap));else if(r==="child_changed"&&a==="child_added")this.changeMap.set(n,hv(n,t.snapshotNode));else if(r==="child_changed"&&a==="child_changed")this.changeMap.set(n,yb(n,t.snapshotNode,o.oldSnap));else throw Fv("Illegal combination of changes: "+t+" occurred after "+o)}else this.changeMap.set(n,t)}getChanges(){return Array.from(this.changeMap.values())}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class $6e{getCompleteChild(t){return null}getChildAfterChild(t,r,n){return null}}const rX=new $6e;class q8{constructor(t,r,n=null){this.writes_=t,this.viewCache_=r,this.optCompleteServerCache_=n}getCompleteChild(t){const r=this.viewCache_.eventCache;if(r.isCompleteForChild(t))return r.getNode().getImmediateChild(t);{const n=this.optCompleteServerCache_!=null?new Fh(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return W8(this.writes_,t,n)}}getChildAfterChild(t,r,n){const o=this.optCompleteServerCache_!=null?this.optCompleteServerCache_:zh(this.viewCache_),a=W6e(this.writes_,o,r,1,n,t);return a.length===0?null:a[0]}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function U6e(e){return{filter:e}}function H6e(e,t){$t(t.eventCache.getNode().isIndexed(e.filter.getIndex()),"Event snap not indexed"),$t(t.serverCache.getNode().isIndexed(e.filter.getIndex()),"Server snap not indexed")}function V6e(e,t,r,n,o){const a=new q6e;let s,l;if(r.type===uc.OVERWRITE){const u=r;u.source.fromUser?s=O6(e,t,u.path,u.snap,n,o,a):($t(u.source.fromServer,"Unknown source."),l=u.source.tagged||t.serverCache.isFiltered()&&!Yr(u.path),s=Fw(e,t,u.path,u.snap,n,o,l,a))}else if(r.type===uc.MERGE){const u=r;u.source.fromUser?s=G6e(e,t,u.path,u.children,n,o,a):($t(u.source.fromServer,"Unknown source."),l=u.source.tagged||t.serverCache.isFiltered(),s=N6(e,t,u.path,u.children,n,o,l,a))}else if(r.type===uc.ACK_USER_WRITE){const u=r;u.revert?s=X6e(e,t,u.path,n,o,a):s=K6e(e,t,u.path,u.affectedTree,n,o,a)}else if(r.type===uc.LISTEN_COMPLETE)s=Q6e(e,t,r.path,n,a);else throw Fv("Unknown operation type: "+r.type);const c=a.getChanges();return Y6e(t,s,c),{viewCache:s,changes:c}}function Y6e(e,t,r){const n=t.eventCache;if(n.isFullyInitialized()){const o=n.getNode().isLeafNode()||n.getNode().isEmpty(),a=T6(e);(r.length>0||!e.eventCache.isFullyInitialized()||o&&!n.getNode().equals(a)||!n.getNode().getPriority().equals(a.getPriority()))&&r.push(YQ(T6(t)))}}function nX(e,t,r,n,o,a){const s=t.eventCache;if(Lw(n,r)!=null)return t;{let l,c;if(Yr(r))if($t(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){const u=zh(t),d=u instanceof kr?u:kr.EMPTY_NODE,f=B8(n,d);l=e.filter.updateFullNode(t.eventCache.getNode(),f,a)}else{const u=Rw(n,zh(t));l=e.filter.updateFullNode(t.eventCache.getNode(),u,a)}else{const u=Vr(r);if(u===".priority"){$t(Yf(r)===1,"Can't have a priority with additional path components");const d=s.getNode();c=t.serverCache.getNode();const f=P9(n,r,d,c);f!=null?l=e.filter.updatePriority(d,f):l=s.getNode()}else{const d=Qn(r);let f;if(s.isCompleteForChild(u)){c=t.serverCache.getNode();const h=P9(n,r,s.getNode(),c);h!=null?f=s.getNode().getImmediateChild(u).updateChild(d,h):f=s.getNode().getImmediateChild(u)}else f=W8(n,u,t.serverCache);f!=null?l=e.filter.updateChild(s.getNode(),u,f,d,o,a):l=s.getNode()}}return px(t,l,s.isFullyInitialized()||Yr(r),e.filter.filtersNodes())}}function Fw(e,t,r,n,o,a,s,l){const c=t.serverCache;let u;const d=s?e.filter:e.filter.getIndexedFilter();if(Yr(r))u=d.updateFullNode(c.getNode(),n,null);else if(d.filtersNodes()&&!c.isFiltered()){const p=c.getNode().updateChild(r,n);u=d.updateFullNode(c.getNode(),p,null)}else{const p=Vr(r);if(!c.isCompleteForPath(r)&&Yf(r)>1)return t;const v=Qn(r),b=c.getNode().getImmediateChild(p).updateChild(v,n);p===".priority"?u=d.updatePriority(c.getNode(),b):u=d.updateChild(c.getNode(),p,b,v,rX,null)}const f=QQ(t,u,c.isFullyInitialized()||Yr(r),d.filtersNodes()),h=new q8(o,f,a);return nX(e,f,r,o,h,l)}function O6(e,t,r,n,o,a,s){const l=t.eventCache;let c,u;const d=new q8(o,t,a);if(Yr(r))u=e.filter.updateFullNode(t.eventCache.getNode(),n,s),c=px(t,u,!0,e.filter.filtersNodes());else{const f=Vr(r);if(f===".priority")u=e.filter.updatePriority(t.eventCache.getNode(),n),c=px(t,u,l.isFullyInitialized(),l.isFiltered());else{const h=Qn(r),p=l.getNode().getImmediateChild(f);let v;if(Yr(h))v=n;else{const m=d.getCompleteChild(f);m!=null?MQ(h)===".priority"&&m.getChild(BQ(h)).isEmpty()?v=m:v=m.updateChild(h,n):v=kr.EMPTY_NODE}if(p.equals(v))c=t;else{const m=e.filter.updateChild(l.getNode(),f,v,h,d,s);c=px(t,m,l.isFullyInitialized(),e.filter.filtersNodes())}}}return c}function I9(e,t){return e.eventCache.isCompleteForChild(t)}function G6e(e,t,r,n,o,a,s){let l=t;return n.foreach((c,u)=>{const d=ho(r,c);I9(t,Vr(d))&&(l=O6(e,l,d,u,o,a,s))}),n.foreach((c,u)=>{const d=ho(r,c);I9(t,Vr(d))||(l=O6(e,l,d,u,o,a,s))}),l}function O9(e,t,r){return r.foreach((n,o)=>{t=t.updateChild(n,o)}),t}function N6(e,t,r,n,o,a,s,l){if(t.serverCache.getNode().isEmpty()&&!t.serverCache.isFullyInitialized())return t;let c=t,u;Yr(r)?u=n:u=new ii(null).setTree(r,n);const d=t.serverCache.getNode();return u.children.inorderTraversal((f,h)=>{if(d.hasChild(f)){const p=t.serverCache.getNode().getImmediateChild(f),v=O9(e,p,h);c=Fw(e,c,new qn(f),v,o,a,s,l)}}),u.children.inorderTraversal((f,h)=>{const p=!t.serverCache.isCompleteForChild(f)&&h.value===null;if(!d.hasChild(f)&&!p){const v=t.serverCache.getNode().getImmediateChild(f),m=O9(e,v,h);c=Fw(e,c,new qn(f),m,o,a,s,l)}}),c}function K6e(e,t,r,n,o,a,s){if(Lw(o,r)!=null)return t;const l=t.serverCache.isFiltered(),c=t.serverCache;if(n.value!=null){if(Yr(r)&&c.isFullyInitialized()||c.isCompleteForPath(r))return Fw(e,t,r,c.getNode().getChild(r),o,a,l,s);if(Yr(r)){let u=new ii(null);return c.getNode().forEachChild(Sm,(d,f)=>{u=u.set(new qn(d),f)}),N6(e,t,r,u,o,a,l,s)}else return t}else{let u=new ii(null);return n.foreach((d,f)=>{const h=ho(r,d);c.isCompleteForPath(h)&&(u=u.set(d,c.getNode().getChild(h)))}),N6(e,t,r,u,o,a,l,s)}}function Q6e(e,t,r,n,o){const a=t.serverCache,s=QQ(t,a.getNode(),a.isFullyInitialized()||Yr(r),a.isFiltered());return nX(e,s,r,n,rX,o)}function X6e(e,t,r,n,o,a){let s;if(Lw(n,r)!=null)return t;{const l=new q8(n,t,o),c=t.eventCache.getNode();let u;if(Yr(r)||Vr(r)===".priority"){let d;if(t.serverCache.isFullyInitialized())d=Rw(n,zh(t));else{const f=t.serverCache.getNode();$t(f instanceof kr,"serverChildren would be complete if leaf node"),d=B8(n,f)}d=d,u=e.filter.updateFullNode(c,d,a)}else{const d=Vr(r);let f=W8(n,d,t.serverCache);f==null&&t.serverCache.isCompleteForChild(d)&&(f=c.getImmediateChild(d)),f!=null?u=e.filter.updateChild(c,d,f,Qn(r),l,a):t.eventCache.getNode().hasChild(d)?u=e.filter.updateChild(c,d,kr.EMPTY_NODE,Qn(r),l,a):u=c,u.isEmpty()&&t.serverCache.isFullyInitialized()&&(s=Rw(n,zh(t)),s.isLeafNode()&&(u=e.filter.updateFullNode(u,s,a)))}return s=t.serverCache.isFullyInitialized()||Lw(n,gn())!=null,px(t,u,s,e.filter.filtersNodes())}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Z6e{constructor(t,r){this.query_=t,this.eventRegistrations_=[];const n=this.query_._queryParams,o=new L8(n.getIndex()),a=v6e(n);this.processor_=U6e(a);const s=r.serverCache,l=r.eventCache,c=o.updateFullNode(kr.EMPTY_NODE,s.getNode(),null),u=a.updateFullNode(kr.EMPTY_NODE,l.getNode(),null),d=new Fh(c,s.isFullyInitialized(),o.filtersNodes()),f=new Fh(u,l.isFullyInitialized(),a.filtersNodes());this.viewCache_=sj(f,d),this.eventGenerator_=new k6e(this.query_)}get query(){return this.query_}}function J6e(e){return e.viewCache_.serverCache.getNode()}function eTe(e,t){const r=zh(e.viewCache_);return r&&(e.query._queryParams.loadsAllData()||!Yr(t)&&!r.getImmediateChild(Vr(t)).isEmpty())?r.getChild(t):null}function N9(e){return e.eventRegistrations_.length===0}function tTe(e,t){e.eventRegistrations_.push(t)}function R9(e,t,r){const n=[];if(r){$t(t==null,"A cancel should cancel all event registrations.");const o=e.query._path;e.eventRegistrations_.forEach(a=>{const s=a.createCancelEvent(r,o);s&&n.push(s)})}if(t){let o=[];for(let a=0;a<e.eventRegistrations_.length;++a){const s=e.eventRegistrations_[a];if(!s.matches(t))o.push(s);else if(t.hasAnyCallback()){o=o.concat(e.eventRegistrations_.slice(a+1));break}}e.eventRegistrations_=o}else e.eventRegistrations_=[];return n}function L9(e,t,r,n){t.type===uc.MERGE&&t.source.queryId!==null&&($t(zh(e.viewCache_),"We should always have a full cache before handling merges"),$t(T6(e.viewCache_),"Missing event cache, even though we have a server cache"));const o=e.viewCache_,a=V6e(e.processor_,o,t,r,n);return H6e(e.processor_,a.viewCache),$t(a.viewCache.serverCache.isFullyInitialized()||!o.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),e.viewCache_=a.viewCache,iX(e,a.changes,a.viewCache.eventCache.getNode(),null)}function rTe(e,t){const r=e.viewCache_.eventCache,n=[];return r.getNode().isLeafNode()||r.getNode().forEachChild(Ni,(a,s)=>{n.push(hv(a,s))}),r.isFullyInitialized()&&n.push(YQ(r.getNode())),iX(e,n,r.getNode(),t)}function iX(e,t,r,n){const o=n?[n]:e.eventRegistrations_;return _6e(e.eventGenerator_,t,r,o)}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let zw;class nTe{constructor(){this.views=new Map}}function iTe(e){$t(!zw,"__referenceConstructor has already been defined"),zw=e}function oTe(){return $t(zw,"Reference.ts has not been loaded"),zw}function aTe(e){return e.views.size===0}function $8(e,t,r,n){const o=t.source.queryId;if(o!==null){const a=e.views.get(o);return $t(a!=null,"SyncTree gave us an op for an invalid query."),L9(a,t,r,n)}else{let a=[];for(const s of e.views.values())a=a.concat(L9(s,t,r,n));return a}}function sTe(e,t,r,n,o){const a=t._queryIdentifier,s=e.views.get(a);if(!s){let l=Rw(r,o?n:null),c=!1;l?c=!0:n instanceof kr?(l=B8(r,n),c=!1):(l=kr.EMPTY_NODE,c=!1);const u=sj(new Fh(l,c,!1),new Fh(n,o,!1));return new Z6e(t,u)}return s}function lTe(e,t,r,n,o,a){const s=sTe(e,t,n,o,a);return e.views.has(t._queryIdentifier)||e.views.set(t._queryIdentifier,s),tTe(s,r),rTe(s,r)}function cTe(e,t,r,n){const o=t._queryIdentifier,a=[];let s=[];const l=Gf(e);if(o==="default")for(const[c,u]of e.views.entries())s=s.concat(R9(u,r,n)),N9(u)&&(e.views.delete(c),u.query._queryParams.loadsAllData()||a.push(u.query));else{const c=e.views.get(o);c&&(s=s.concat(R9(c,r,n)),N9(c)&&(e.views.delete(o),c.query._queryParams.loadsAllData()||a.push(c.query)))}return l&&!Gf(e)&&a.push(new(oTe())(t._repo,t._path)),{removed:a,events:s}}function oX(e){const t=[];for(const r of e.views.values())r.query._queryParams.loadsAllData()||t.push(r);return t}function jm(e,t){let r=null;for(const n of e.views.values())r=r||eTe(n,t);return r}function aX(e,t){if(t._queryParams.loadsAllData())return lj(e);{const n=t._queryIdentifier;return e.views.get(n)}}function sX(e,t){return aX(e,t)!=null}function Gf(e){return lj(e)!=null}function lj(e){for(const t of e.views.values())if(t.query._queryParams.loadsAllData())return t;return null}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/let Mw;function uTe(e){$t(!Mw,"__referenceConstructor has already been defined"),Mw=e}function dTe(){return $t(Mw,"Reference.ts has not been loaded"),Mw}let fTe=1;class F9{constructor(t){this.listenProvider_=t,this.syncPointTree_=new ii(null),this.pendingWriteTree_=B6e(),this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function pTe(e,t,r,n,o){return T6e(e.pendingWriteTree_,t,r,n,o),o?Zb(e,new Lh(KQ(),t,r)):[]}function cm(e,t,r=!1){const n=P6e(e.pendingWriteTree_,t);if(I6e(e.pendingWriteTree_,t)){let a=new ii(null);return n.snap!=null?a=a.set(gn(),!0):ms(n.children,s=>{a=a.set(new qn(s),!0)}),Zb(e,new Nw(n.path,a,r))}else return[]}function cj(e,t,r){return Zb(e,new Lh(z8(),t,r))}function hTe(e,t,r){const n=ii.fromObject(r);return Zb(e,new wb(z8(),t,n))}function gTe(e,t){return Zb(e,new bb(z8(),t))}function mTe(e,t,r){const n=U8(e,r);if(n){const o=H8(n),a=o.path,s=o.queryId,l=fs(a,t),c=new bb(M8(s),l);return V8(e,a,c)}else return[]}function R6(e,t,r,n,o=!1){const a=t._path,s=e.syncPointTree_.get(a);let l=[];if(s&&(t._queryIdentifier==="default"||sX(s,t))){const c=cTe(s,t,r,n);aTe(s)&&(e.syncPointTree_=e.syncPointTree_.remove(a));const u=c.removed;if(l=c.events,!o){const d=u.findIndex(h=>h._queryParams.loadsAllData())!==-1,f=e.syncPointTree_.findOnPath(a,(h,p)=>Gf(p));if(d&&!f){const h=e.syncPointTree_.subtree(a);if(!h.isEmpty()){const p=xTe(h);for(let v=0;v<p.length;++v){const m=p[v],b=m.query,x=dX(e,m);e.listenProvider_.startListening(gx(b),Dw(e,b),x.hashFn,x.onComplete)}}}!f&&u.length>0&&!n&&(d?e.listenProvider_.stopListening(gx(t),null):u.forEach(h=>{const p=e.queryToTagMap.get(uj(h));e.listenProvider_.stopListening(gx(h),p)}))}bTe(e,u)}return l}function vTe(e,t,r,n){const o=U8(e,n);if(o!=null){const a=H8(o),s=a.path,l=a.queryId,c=fs(s,t),u=new Lh(M8(l),c,r);return V8(e,s,u)}else return[]}function yTe(e,t,r,n){const o=U8(e,n);if(o){const a=H8(o),s=a.path,l=a.queryId,c=fs(s,t),u=ii.fromObject(r),d=new wb(M8(l),c,u);return V8(e,s,d)}else return[]}function z9(e,t,r,n=!1){const o=t._path;let a=null,s=!1;e.syncPointTree_.foreachOnPath(o,(h,p)=>{const v=fs(h,o);a=a||jm(p,v),s=s||Gf(p)});let l=e.syncPointTree_.get(o);l?(s=s||Gf(l),a=a||jm(l,gn())):(l=new nTe,e.syncPointTree_=e.syncPointTree_.set(o,l));let c;a!=null?c=!0:(c=!1,a=kr.EMPTY_NODE,e.syncPointTree_.subtree(o).foreachChild((p,v)=>{const m=jm(v,gn());m&&(a=a.updateImmediateChild(p,m))}));const u=sX(l,t);if(!u&&!t._queryParams.loadsAllData()){const h=uj(t);$t(!e.queryToTagMap.has(h),"View does not exist, but we have a tag");const p=wTe();e.queryToTagMap.set(h,p),e.tagToQueryMap.set(p,h)}const d=D8(e.pendingWriteTree_,o);let f=lTe(l,t,r,d,a,c);if(!u&&!s&&!n){const h=aX(l,t);f=f.concat(STe(e,t,h))}return f}function lX(e,t,r){const o=e.pendingWriteTree_,a=e.syncPointTree_.findOnPath(t,(s,l)=>{const c=fs(s,t),u=jm(l,c);if(u)return u});return JQ(o,t,a,r,!0)}function Zb(e,t){return cX(t,e.syncPointTree_,null,D8(e.pendingWriteTree_,gn()))}function cX(e,t,r,n){if(Yr(e.path))return uX(e,t,r,n);{const o=t.get(gn());r==null&&o!=null&&(r=jm(o,gn()));let a=[];const s=Vr(e.path),l=e.operationForChild(s),c=t.children.get(s);if(c&&l){const u=r?r.getImmediateChild(s):null,d=eX(n,s);a=a.concat(cX(l,c,u,d))}return o&&(a=a.concat($8(o,e,n,r))),a}}function uX(e,t,r,n){const o=t.get(gn());r==null&&o!=null&&(r=jm(o,gn()));let a=[];return t.children.inorderTraversal((s,l)=>{const c=r?r.getImmediateChild(s):null,u=eX(n,s),d=e.operationForChild(s);d&&(a=a.concat(uX(d,l,c,u)))}),o&&(a=a.concat($8(o,e,n,r))),a}function dX(e,t){const r=t.query,n=Dw(e,r);return{hashFn:()=>(J6e(t)||kr.EMPTY_NODE).hash(),onComplete:o=>{if(o==="ok")return n?mTe(e,r._path,n):gTe(e,r._path);{const a=mAe(o,r);return R6(e,r,null,a)}}}}function Dw(e,t){const r=uj(t);return e.queryToTagMap.get(r)}function uj(e){return e._path.toString()+"$"+e._queryIdentifier}function U8(e,t){return e.tagToQueryMap.get(t)}function H8(e){const t=e.indexOf("$");return $t(t!==-1&&t<e.length-1,"Bad queryKey."),{queryId:e.substr(t+1),path:new qn(e.substr(0,t))}}function V8(e,t,r){const n=e.syncPointTree_.get(t);$t(n,"Missing sync point for query tag that we're tracking");const o=D8(e.pendingWriteTree_,t);return $8(n,r,o,null)}function xTe(e){return e.fold((t,r,n)=>{if(r&&Gf(r))return[lj(r)];{let o=[];return r&&(o=oX(r)),ms(n,(a,s)=>{o=o.concat(s)}),o}})}function gx(e){return e._queryParams.loadsAllData()&&!e._queryParams.isDefault()?new(dTe())(e._repo,e._path):e}function bTe(e,t){for(let r=0;r<t.length;++r){const n=t[r];if(!n._queryParams.loadsAllData()){const o=uj(n),a=e.queryToTagMap.get(o);e.queryToTagMap.delete(o),e.tagToQueryMap.delete(a)}}}function wTe(){return fTe++}function STe(e,t,r){const n=t._path,o=Dw(e,t),a=dX(e,r),s=e.listenProvider_.startListening(gx(t),o,a.hashFn,a.onComplete),l=e.syncPointTree_.subtree(n);if(o)$t(!Gf(l.value),"If we're adding a query, it shouldn't be shadowed");else{const c=l.fold((u,d,f)=>{if(!Yr(u)&&d&&Gf(d))return[lj(d).query];{let h=[];return d&&(h=h.concat(oX(d).map(p=>p.query))),ms(f,(p,v)=>{h=h.concat(v)}),h}});for(let u=0;u<c.length;++u){const d=c[u];e.listenProvider_.stopListening(gx(d),Dw(e,d))}}return s}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Y8{constructor(t){this.node_=t}getImmediateChild(t){const r=this.node_.getImmediateChild(t);return new Y8(r)}node(){return this.node_}}class G8{constructor(t,r){this.syncTree_=t,this.path_=r}getImmediateChild(t){const r=ho(this.path_,t);return new G8(this.syncTree_,r)}node(){return lX(this.syncTree_,this.path_)}}const jTe=function(e){return e=e||{},e.timestamp=e.timestamp||new Date().getTime(),e},M9=function(e,t,r){if(!e||typeof e!="object")return e;if($t(".sv"in e,"Unexpected leaf node or priority contents"),typeof e[".sv"]=="string")return kTe(e[".sv"],t,r);if(typeof e[".sv"]=="object")return _Te(e[".sv"],t);$t(!1,"Unexpected server value: "+JSON.stringify(e,null,2))},kTe=function(e,t,r){switch(e){case"timestamp":return r.timestamp;default:$t(!1,"Unexpected server value: "+e)}},_Te=function(e,t,r){e.hasOwnProperty("increment")||$t(!1,"Unexpected server value: "+JSON.stringify(e,null,2));const n=e.increment;typeof n!="number"&&$t(!1,"Unexpected increment value: "+n);const o=t.node();if($t(o!==null&&typeof o<"u","Expected ChildrenNode.EMPTY_NODE for nulls"),!o.isLeafNode())return n;const s=o.getValue();return typeof s!="number"?n:s+n},CTe=function(e,t,r,n){return K8(t,new G8(r,e),n)},ETe=function(e,t,r){return K8(e,new Y8(t),r)};function K8(e,t,r){const n=e.getPriority().val(),o=M9(n,t.getImmediateChild(".priority"),r);let a;if(e.isLeafNode()){const s=e,l=M9(s.getValue(),t,r);return l!==s.getValue()||o!==s.getPriority().val()?new Io(l,ba(o)):e}else{const s=e;return a=s,o!==s.getPriority().val()&&(a=a.updatePriority(new Io(o))),s.forEachChild(Ni,(l,c)=>{const u=K8(c,t.getImmediateChild(l),r);u!==c&&(a=a.updateImmediateChild(l,u))}),a}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Q8{constructor(t="",r=null,n={children:{},childCount:0}){this.name=t,this.parent=r,this.node=n}}function X8(e,t){let r=t instanceof qn?t:new qn(t),n=e,o=Vr(r);for(;o!==null;){const a=fv(n.node.children,o)||{children:{},childCount:0};n=new Q8(o,n,a),r=Qn(r),o=Vr(r)}return n}function Mv(e){return e.node.value}function fX(e,t){e.node.value=t,L6(e)}function pX(e){return e.node.childCount>0}function ATe(e){return Mv(e)===void 0&&!pX(e)}function dj(e,t){ms(e.node.children,(r,n)=>{t(new Q8(r,e,n))})}function hX(e,t,r,n){r&&t(e),dj(e,o=>{hX(o,t,!0)})}function TTe(e,t,r){let n=e.parent;for(;n!==null;){if(t(n))return!0;n=n.parent}return!1}function Jb(e){return new qn(e.parent===null?e.name:Jb(e.parent)+"/"+e.name)}function L6(e){e.parent!==null&&PTe(e.parent,e.name,e)}function PTe(e,t,r){const n=ATe(r),o=Rd(e.node.children,t);n&&o?(delete e.node.children[t],e.node.childCount--,L6(e)):!n&&!o&&(e.node.children[t]=r.node,e.node.childCount++,L6(e))}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const ITe=/[\[\].#$\/\u0000-\u001F\u007F]/,OTe=/[\[\].#$\u0000-\u001F\u007F]/,PE=10*1024*1024,gX=function(e){return typeof e=="string"&&e.length!==0&&!ITe.test(e)},mX=function(e){return typeof e=="string"&&e.length!==0&&!OTe.test(e)},NTe=function(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),mX(e)},vX=function(e,t,r){const n=r instanceof qn?new KAe(r,e):r;if(t===void 0)throw new Error(e+"contains undefined "+eh(n));if(typeof t=="function")throw new Error(e+"contains a function "+eh(n)+" with contents = "+t.toString());if(vQ(t))throw new Error(e+"contains "+t.toString()+" "+eh(n));if(typeof t=="string"&&t.length>PE/3&&ij(t)>PE)throw new Error(e+"contains a string greater than "+PE+" utf8 bytes "+eh(n)+" ('"+t.substring(0,50)+"...')");if(t&&typeof t=="object"){let o=!1,a=!1;if(ms(t,(s,l)=>{if(s===".value")o=!0;else if(s!==".priority"&&s!==".sv"&&(a=!0,!gX(s)))throw new Error(e+" contains an invalid key ("+s+") "+eh(n)+`. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"`);QAe(n,s),vX(e,l,n),XAe(n)}),o&&a)throw new Error(e+' contains ".value" child '+eh(n)+" in addition to actual children.")}},yX=function(e,t,r,n){if(!mX(r))throw new Error(sQ(e,t)+'was an invalid path = "'+r+`". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"`)},RTe=function(e,t,r,n){r&&(r=r.replace(/^\/*\.info(\/|$)/,"/")),yX(e,t,r)},LTe=function(e,t){const r=t.path.toString();if(typeof t.repoInfo.host!="string"||t.repoInfo.host.length===0||!gX(t.repoInfo.namespace)&&t.repoInfo.host.split(":")[0]!=="localhost"||r.length!==0&&!NTe(r))throw new Error(sQ(e,"url")+`must be a valid firebase URL and the path can't contain ".", "#", "$", "[", or "]".`)};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class FTe{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function xX(e,t){let r=null;for(let n=0;n<t.length;n++){const o=t[n],a=o.getPath();r!==null&&!O8(a,r.path)&&(e.eventLists_.push(r),r=null),r===null&&(r={events:[],path:a}),r.events.push(o)}r&&e.eventLists_.push(r)}function bX(e,t,r){xX(e,r),wX(e,n=>O8(n,t))}function Jh(e,t,r){xX(e,r),wX(e,n=>cc(n,t)||cc(t,n))}function wX(e,t){e.recursionDepth_++;let r=!0;for(let n=0;n<e.eventLists_.length;n++){const o=e.eventLists_[n];if(o){const a=o.path;t(a)?(zTe(e.eventLists_[n]),e.eventLists_[n]=null):r=!1}}r&&(e.eventLists_=[]),e.recursionDepth_--}function zTe(e){for(let t=0;t<e.events.length;t++){const r=e.events[t];if(r!==null){e.events[t]=null;const n=r.getEventRunner();dx&&xa("event: "+r.toString()),Qb(n)}}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const MTe="repo_interrupt",DTe=25;class BTe{constructor(t,r,n,o){this.repoInfo_=t,this.forceRestClient_=r,this.authTokenProvider_=n,this.appCheckProvider_=o,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new FTe,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=Ow(),this.transactionQueueTree_=new Q8,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function WTe(e,t,r){if(e.stats_=P8(e.repoInfo_),e.forceRestClient_||bAe())e.server_=new Iw(e.repoInfo_,(n,o,a,s)=>{D9(e,n,o,a,s)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>B9(e,!0),0);else{if(typeof r<"u"&&r!==null){if(typeof r!="object")throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{zo(r)}catch(n){throw new Error("Invalid authOverride provided: "+n)}}e.persistentConnection_=new md(e.repoInfo_,t,(n,o,a,s)=>{D9(e,n,o,a,s)},n=>{B9(e,n)},n=>{$Te(e,n)},e.authTokenProvider_,e.appCheckProvider_,r),e.server_=e.persistentConnection_}e.authTokenProvider_.addTokenChangeListener(n=>{e.server_.refreshAuthToken(n)}),e.appCheckProvider_.addTokenChangeListener(n=>{e.server_.refreshAppCheckToken(n.token)}),e.statsReporter_=_Ae(e.repoInfo_,()=>new j6e(e.stats_,e.server_)),e.infoData_=new y6e,e.infoSyncTree_=new F9({startListening:(n,o,a,s)=>{let l=[];const c=e.infoData_.getNode(n._path);return c.isEmpty()||(l=cj(e.infoSyncTree_,n._path,c),setTimeout(()=>{s("ok")},0)),l},stopListening:()=>{}}),Z8(e,"connected",!1),e.serverSyncTree_=new F9({startListening:(n,o,a,s)=>(e.server_.listen(n,a,o,(l,c)=>{const u=s(l,c);Jh(e.eventQueue_,n._path,u)}),[]),stopListening:(n,o)=>{e.server_.unlisten(n,o)}})}function qTe(e){const r=e.infoData_.getNode(new qn(".info/serverTimeOffset")).val()||0;return new Date().getTime()+r}function SX(e){return jTe({timestamp:qTe(e)})}function D9(e,t,r,n,o){e.dataUpdateCount++;const a=new qn(t);r=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,r):r;let s=[];if(o)if(n){const c=_w(r,u=>ba(u));s=yTe(e.serverSyncTree_,a,c,o)}else{const c=ba(r);s=vTe(e.serverSyncTree_,a,c,o)}else if(n){const c=_w(r,u=>ba(u));s=hTe(e.serverSyncTree_,a,c)}else{const c=ba(r);s=cj(e.serverSyncTree_,a,c)}let l=a;s.length>0&&(l=eI(e,a)),Jh(e.eventQueue_,l,s)}function B9(e,t){Z8(e,"connected",t),t===!1&&HTe(e)}function $Te(e,t){ms(t,(r,n)=>{Z8(e,r,n)})}function Z8(e,t,r){const n=new qn("/.info/"+t),o=ba(r);e.infoData_.updateSnapshot(n,o);const a=cj(e.infoSyncTree_,n,o);Jh(e.eventQueue_,n,a)}function UTe(e){return e.nextWriteId_++}function HTe(e){jX(e,"onDisconnectEvents");const t=SX(e),r=Ow();A6(e.onDisconnect_,gn(),(o,a)=>{const s=CTe(o,a,e.serverSyncTree_,t);GQ(r,o,s)});let n=[];A6(r,gn(),(o,a)=>{n=n.concat(cj(e.serverSyncTree_,o,a));const s=QTe(e,o);eI(e,s)}),e.onDisconnect_=Ow(),Jh(e.eventQueue_,gn(),n)}function VTe(e,t,r){let n;Vr(t._path)===".info"?n=z9(e.infoSyncTree_,t,r):n=z9(e.serverSyncTree_,t,r),bX(e.eventQueue_,t._path,n)}function W9(e,t,r){let n;Vr(t._path)===".info"?n=R6(e.infoSyncTree_,t,r):n=R6(e.serverSyncTree_,t,r),bX(e.eventQueue_,t._path,n)}function YTe(e){e.persistentConnection_&&e.persistentConnection_.interrupt(MTe)}function jX(e,...t){let r="";e.persistentConnection_&&(r=e.persistentConnection_.id+":"),xa(r,...t)}function kX(e,t,r){return lX(e.serverSyncTree_,t,r)||kr.EMPTY_NODE}function J8(e,t=e.transactionQueueTree_){if(t||fj(e,t),Mv(t)){const r=CX(e,t);$t(r.length>0,"Sending zero length transaction queue"),r.every(o=>o.status===0)&&GTe(e,Jb(t),r)}else pX(t)&&dj(t,r=>{J8(e,r)})}function GTe(e,t,r){const n=r.map(u=>u.currentWriteId),o=kX(e,t,n);let a=o;const s=o.hash();for(let u=0;u<r.length;u++){const d=r[u];$t(d.status===0,"tryToSendTransactionQueue_: items in queue should all be run."),d.status=1,d.retryCount++;const f=fs(t,d.path);a=a.updateChild(f,d.currentOutputSnapshotRaw)}const l=a.val(!0),c=t;e.server_.put(c.toString(),l,u=>{jX(e,"transaction put response",{path:c.toString(),status:u});let d=[];if(u==="ok"){const f=[];for(let h=0;h<r.length;h++)r[h].status=2,d=d.concat(cm(e.serverSyncTree_,r[h].currentWriteId)),r[h].onComplete&&f.push(()=>r[h].onComplete(null,!0,r[h].currentOutputSnapshotResolved)),r[h].unwatcher();fj(e,X8(e.transactionQueueTree_,t)),J8(e,e.transactionQueueTree_),Jh(e.eventQueue_,t,d);for(let h=0;h<f.length;h++)Qb(f[h])}else{if(u==="datastale")for(let f=0;f<r.length;f++)r[f].status===3?r[f].status=4:r[f].status=0;else{Xs("transaction at "+c.toString()+" failed: "+u);for(let f=0;f<r.length;f++)r[f].status=4,r[f].abortReason=u}eI(e,t)}},s)}function eI(e,t){const r=_X(e,t),n=Jb(r),o=CX(e,r);return KTe(e,o,n),n}function KTe(e,t,r){if(t.length===0)return;const n=[];let o=[];const s=t.filter(l=>l.status===0).map(l=>l.currentWriteId);for(let l=0;l<t.length;l++){const c=t[l],u=fs(r,c.path);let d=!1,f;if($t(u!==null,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===4)d=!0,f=c.abortReason,o=o.concat(cm(e.serverSyncTree_,c.currentWriteId,!0));else if(c.status===0)if(c.retryCount>=DTe)d=!0,f="maxretry",o=o.concat(cm(e.serverSyncTree_,c.currentWriteId,!0));else{const h=kX(e,c.path,s);c.currentInputSnapshot=h;const p=t[l].update(h.val());if(p!==void 0){vX("transaction failed: Data returned ",p,c.path);let v=ba(p);typeof p=="object"&&p!=null&&Rd(p,".priority")||(v=v.updatePriority(h.getPriority()));const b=c.currentWriteId,x=SX(e),w=ETe(v,h,x);c.currentOutputSnapshotRaw=v,c.currentOutputSnapshotResolved=w,c.currentWriteId=UTe(e),s.splice(s.indexOf(b),1),o=o.concat(pTe(e.serverSyncTree_,c.path,w,c.currentWriteId,c.applyLocally)),o=o.concat(cm(e.serverSyncTree_,b,!0))}else d=!0,f="nodata",o=o.concat(cm(e.serverSyncTree_,c.currentWriteId,!0))}Jh(e.eventQueue_,r,o),o=[],d&&(t[l].status=2,(function(h){setTimeout(h,Math.floor(0))})(t[l].unwatcher),t[l].onComplete&&(f==="nodata"?n.push(()=>t[l].onComplete(null,!1,t[l].currentInputSnapshot)):n.push(()=>t[l].onComplete(new Error(f),!1,null))))}fj(e,e.transactionQueueTree_);for(let l=0;l<n.length;l++)Qb(n[l]);J8(e,e.transactionQueueTree_)}function _X(e,t){let r,n=e.transactionQueueTree_;for(r=Vr(t);r!==null&&Mv(n)===void 0;)n=X8(n,r),t=Qn(t),r=Vr(t);return n}function CX(e,t){const r=[];return EX(e,t,r),r.sort((n,o)=>n.order-o.order),r}function EX(e,t,r){const n=Mv(t);if(n)for(let o=0;o<n.length;o++)r.push(n[o]);dj(t,o=>{EX(e,o,r)})}function fj(e,t){const r=Mv(t);if(r){let n=0;for(let o=0;o<r.length;o++)r[o].status!==2&&(r[n]=r[o],n++);r.length=n,fX(t,r.length>0?r:void 0)}dj(t,n=>{fj(e,n)})}function QTe(e,t){const r=Jb(_X(e,t)),n=X8(e.transactionQueueTree_,t);return TTe(n,o=>{IE(e,o)}),IE(e,n),hX(n,o=>{IE(e,o)}),r}function IE(e,t){const r=Mv(t);if(r){const n=[];let o=[],a=-1;for(let s=0;s<r.length;s++)r[s].status===3||(r[s].status===1?($t(a===s-1,"All SENT items should be at beginning of queue."),a=s,r[s].status=3,r[s].abortReason="set"):($t(r[s].status===0,"Unexpected transaction status in abort"),r[s].unwatcher(),o=o.concat(cm(e.serverSyncTree_,r[s].currentWriteId,!0)),r[s].onComplete&&n.push(r[s].onComplete.bind(null,new Error("set"),!1,null))));a===-1?fX(t,void 0):r.length=a+1,Jh(e.eventQueue_,Jb(t),o);for(let s=0;s<n.length;s++)Qb(n[s])}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function XTe(e){let t="";const r=e.split("/");for(let n=0;n<r.length;n++)if(r[n].length>0){let o=r[n];try{o=decodeURIComponent(o.replace(/\+/g," "))}catch{}t+="/"+o}return t}function ZTe(e){const t={};e.charAt(0)==="?"&&(e=e.substring(1));for(const r of e.split("&")){if(r.length===0)continue;const n=r.split("=");n.length===2?t[decodeURIComponent(n[0])]=decodeURIComponent(n[1]):Xs(`Invalid query segment '${r}' in query '${e}'`)}return t}const q9=function(e,t){const r=JTe(e),n=r.namespace;r.domain==="firebase.com"&&kd(r.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),(!n||n==="undefined")&&r.domain!=="localhost"&&kd("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),r.secure||dAe();const o=r.scheme==="ws"||r.scheme==="wss";return{repoInfo:new TQ(r.host,r.secure,n,o,t,"",n!==r.subdomain),path:new qn(r.pathString)}},JTe=function(e){let t="",r="",n="",o="",a="",s=!0,l="https",c=443;if(typeof e=="string"){let u=e.indexOf("//");u>=0&&(l=e.substring(0,u-1),e=e.substring(u+2));let d=e.indexOf("/");d===-1&&(d=e.length);let f=e.indexOf("?");f===-1&&(f=e.length),t=e.substring(0,Math.min(d,f)),d<f&&(o=XTe(e.substring(d,f)));const h=ZTe(e.substring(Math.min(e.length,f)));u=t.indexOf(":"),u>=0?(s=l==="https"||l==="wss",c=parseInt(t.substring(u+1),10)):u=t.length;const p=t.slice(0,u);if(p.toLowerCase()==="localhost")r="localhost";else if(p.split(".").length<=2)r=p;else{const v=t.indexOf(".");n=t.substring(0,v).toLowerCase(),r=t.substring(v+1),a=n}"ns"in h&&(a=h.ns)}return{host:t,port:c,domain:r,subdomain:n,secure:s,scheme:l,pathString:o,namespace:a}};/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class ePe{constructor(t,r,n,o){this.eventType=t,this.eventRegistration=r,this.snapshot=n,this.prevName=o}getPath(){const t=this.snapshot.ref;return this.eventType==="value"?t._path:t.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+zo(this.snapshot.exportVal())}}class tPe{constructor(t,r,n){this.eventRegistration=t,this.error=r,this.path=n}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class rPe{constructor(t,r){this.snapshotCallback=t,this.cancelCallback=r}onValue(t,r){this.snapshotCallback.call(null,t,r)}onCancel(t){return $t(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)}get hasCancelCallback(){return!!this.cancelCallback}matches(t){return this.snapshotCallback===t.snapshotCallback||this.snapshotCallback.userCallback!==void 0&&this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context}}/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class tI{constructor(t,r,n,o){this._repo=t,this._path=r,this._queryParams=n,this._orderByCalled=o}get key(){return Yr(this._path)?null:MQ(this._path)}get ref(){return new ip(this._repo,this._path)}get _queryIdentifier(){const t=_9(this._queryParams),r=A8(t);return r==="{}"?"default":r}get _queryObject(){return _9(this._queryParams)}isEqual(t){if(t=oj(t),!(t instanceof tI))return!1;const r=this._repo===t._repo,n=O8(this._path,t._path),o=this._queryIdentifier===t._queryIdentifier;return r&&n&&o}toJSON(){return this.toString()}toString(){return this._repo.toString()+GAe(this._path)}}class ip extends tI{constructor(t,r){super(t,r,new F8,!1)}get parent(){const t=BQ(this._path);return t===null?null:new ip(this._repo,t)}get root(){let t=this;for(;t.parent!==null;)t=t.parent;return t}}class Bw{constructor(t,r,n){this._node=t,this.ref=r,this._index=n}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(t){const r=new qn(t),n=F6(this.ref,t);return new Bw(this._node.getChild(r),n,Ni)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(t){return this._node.isLeafNode()?!1:!!this._node.forEachChild(this._index,(n,o)=>t(new Bw(o,F6(this.ref,n),Ni)))}hasChild(t){const r=new qn(t);return!this._node.getChild(r).isEmpty()}hasChildren(){return this._node.isLeafNode()?!1:!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function nPe(e,t){return e=oj(e),e._checkNotDeleted("ref"),t!==void 0?F6(e._root,t):e._root}function F6(e,t){return e=oj(e),Vr(e._path)===null?RTe("child","path",t):yX("child","path",t),new ip(e._repo,ho(e._path,t))}class rI{constructor(t){this.callbackContext=t}respondsTo(t){return t==="value"}createEvent(t,r){const n=r._queryParams.getIndex();return new ePe("value",this,new Bw(t.snapshotNode,new ip(r._repo,r._path),n))}getEventRunner(t){return t.getEventType()==="cancel"?()=>this.callbackContext.onCancel(t.error):()=>this.callbackContext.onValue(t.snapshot,null)}createCancelEvent(t,r){return this.callbackContext.hasCancelCallback?new tPe(this,t,r):null}matches(t){return t instanceof rI?!t.callbackContext||!this.callbackContext?!0:t.callbackContext.matches(this.callbackContext):!1}hasAnyCallback(){return this.callbackContext!==null}}function iPe(e,t,r,n,o){let a;if(typeof n=="object"&&(a=void 0,o=n),typeof n=="function"&&(a=n),o&&o.onlyOnce){const c=r,u=(d,f)=>{W9(e._repo,e,l),c(d,f)};u.userCallback=r.userCallback,u.context=r.context,r=u}const s=new rPe(r,a||void 0),l=new rI(s);return VTe(e._repo,e,l),()=>W9(e._repo,e,l)}function oPe(e,t,r,n){return iPe(e,"value",t,r,n)}iTe(ip);uTe(ip);/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const aPe="FIREBASE_DATABASE_EMULATOR_HOST",z6={};let sPe=!1;function lPe(e,t,r,n){const o=t.lastIndexOf(":"),a=t.substring(0,o),s=C8(a);e.repoInfo_=new TQ(t,s,e.repoInfo_.namespace,e.repoInfo_.webSocketOnly,e.repoInfo_.nodeAdmin,e.repoInfo_.persistenceKey,e.repoInfo_.includeNamespaceInQueryParams,!0,r),n&&(e.authTokenProvider_=n)}function cPe(e,t,r,n,o){let a=n||e.options.databaseURL;a===void 0&&(e.options.projectId||kd("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),xa("Using default host for project ",e.options.projectId),a=`${e.options.projectId}-default-rtdb.firebaseio.com`);let s=q9(a,o),l=s.repoInfo,c;typeof process<"u"&&s9&&(c=s9[aPe]),c?(a=`http://${c}?ns=${l.namespace}`,s=q9(a,o),l=s.repoInfo):s.repoInfo.secure;const u=new SAe(e.name,e.options,t);LTe("Invalid Firebase Database URL",s),Yr(s.path)||kd("Database URL must point to the root of a Firebase Database (not including a child path).");const d=dPe(l,e,u,new wAe(e,r));return new fPe(d,e)}function uPe(e,t){const r=z6[t];(!r||r[e.key]!==e)&&kd(`Database ${t}(${e.repoInfo_}) has already been deleted.`),YTe(e),delete r[e.key]}function dPe(e,t,r,n){let o=z6[t.name];o||(o={},z6[t.name]=o);let a=o[e.toURLString()];return a&&kd("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),a=new BTe(e,sPe,r,n),o[e.toURLString()]=a,a}class fPe{constructor(t,r){this._repoInternal=t,this.app=r,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(WTe(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new ip(this._repo,gn())),this._rootInternal}_delete(){return this._rootInternal!==null&&(uPe(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(t){this._rootInternal===null&&kd("Cannot call "+t+" on a deleted database.")}}function pPe(e=G3e(),t){const r=$3e(e,"database").getImmediate({identifier:t});if(!r._instanceStarted){const n=AEe("database");n&&hPe(r,...n)}return r}function hPe(e,t,r,n={}){e=oj(e),e._checkNotDeleted("useEmulator");const o=`${t}:${r}`,a=e._repoInternal;if(e._instanceStarted){if(o===e._repoInternal.repoInfo_.host&&Cw(n,a.repoInfo_.emulatorOptions))return;kd("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}let s;if(a.repoInfo_.nodeAdmin)n.mockUserToken&&kd('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new $1($1.OWNER);else if(n.mockUserToken){const l=typeof n.mockUserToken=="string"?n.mockUserToken:PEe(n.mockUserToken,e.app.options.projectId);s=new $1(l)}C8(t)&&(TEe(t),NEe("Database",!0)),lPe(a,o,n,s)}/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function gPe(e){oAe(Y3e),Ew(new pb("database",(t,{instanceIdentifier:r})=>{const n=t.getProvider("app").getImmediate(),o=t.getProvider("auth-internal"),a=t.getProvider("app-check-internal");return cPe(n,o,a,r)},"PUBLIC").setMultipleInstances(!0)),bm(l9,c9,e),bm(l9,c9,"esm2017")}md.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)};md.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)};gPe();var mPe="firebase",vPe="11.10.0";/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/bm(mPe,vPe,"app");const AX="AIzaSyBbrU8aLBBUyXPYWRSlVBNGYRRq1AcdXQ4",TX="https://eventbuzz-live-default-rtdb.asia-southeast1.firebasedatabase.app";let S1=null;function PX(){return!!(AX.trim()&&TX.trim())}function yPe(){if(!PX())throw new Error("VITE_FIREBASE_API_KEY and VITE_FIREBASE_DATABASE_URL must be set.");return S1||(n9().length?S1=n9()[0]:S1=dQ({apiKey:AX.trim(),databaseURL:TX.trim()})),S1}function xPe(){return pPe(yPe())}function Ww(e){if(typeof e=="number"&&!Number.isNaN(e))return e;const t=Number(e);return Number.isFinite(t)?t:0}function bPe(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).map(([r,n])=>{if(!n||typeof n!="object")return null;const o=n,s=(o._id!=null&&String(o._id).trim()!==""?String(o._id).trim():"")||r,l=o.status!=null?String(o.status):"pending";return{_id:s,author:String(o.authorName??"Anonymous"),text:String(o.question??""),up:Ww(o.upvotes),down:Ww(o.downvotes),createdAt:o.createdAt!=null?String(o.createdAt):void 0,status:l,shortlisted:!!o.shortlisted,audienceListed:o.audienceListed!==!1}}).filter(r=>r!=null).sort((r,n)=>{if(n.up!==r.up)return n.up-r.up;const o=r.createdAt?Date.parse(r.createdAt):0;return(n.createdAt?Date.parse(n.createdAt):0)-o})}function wPe(e){if(!Array.isArray(e))return[];const t=[];for(const r of e){if(!r||typeof r!="object")continue;const n=r,o=n._id!=null?String(n._id):"";if(!o)continue;const a=n.participant&&typeof n.participant=="object"&&!Array.isArray(n.participant)?n.participant:null;let s="Anonymous";if(!n.isAnonymous&&a){const u=a.displayName!=null?String(a.displayName).trim():"",d=[a.firstName,a.lastName].filter(h=>h!=null&&String(h).trim()).map(h=>String(h).trim()).join(" ").trim(),f=a.email!=null?String(a.email).trim():"";s=u||d||f&&f.split("@")[0]||"Guest"}const l=n.status!=null?String(n.status):"pending",c=n.createdAt!=null?typeof n.createdAt=="string"?n.createdAt:new Date(n.createdAt).toISOString():void 0;t.push({_id:o,author:s,text:n.question!=null?String(n.question):"",up:Ww(n.upvotes),down:Ww(n.downvotes),createdAt:c,status:l,shortlisted:!!n.shortlisted,audienceListed:n.audienceListed!==!1})}return t.sort((r,n)=>{if(n.up!==r.up)return n.up-r.up;const o=r.createdAt?Date.parse(r.createdAt):0;return(n.createdAt?Date.parse(n.createdAt):0)-o}),t}function SPe(e,t,r){const n=xPe(),o=nPe(n,`sessions/${e}/questions`);return oPe(o,a=>{try{t(bPe(a.val()))}catch(s){r==null||r(s instanceof Error?s:new Error(String(s)))}},a=>{r==null||r(a instanceof Error?a:new Error(String(a)))})}const nI={listBySession(e){return Ve.get(`/sessions/${e}/questions`)},patch(e,t){return Qg(`/questions/${e}`,{method:"PATCH",body:JSON.stringify(t),skipGlobalLoading:!0})}},jPe=4e3;function kPe(e){return/permission_denied|PERMISSION_DENIED|permission denied/i.test(e)}function _Pe(e){const[t,r]=S.useState([]),[n,o]=S.useState(!0),[a,s]=S.useState(null),l=(e==null?void 0:e.trim())??"";return S.useEffect(()=>{if(!l){r([]),o(!1),s(null);return}let c=!1,u=null,d=null,f=!1;const h=async()=>{var b;const v=await nI.listBySession(l);if(c)return;if(v.error){s(v.error),r([]),o(!1);return}const m=wPe(((b=v.data)==null?void 0:b.questions)??[]);r(m),o(!1),s(null)},p=()=>{f||(f=!0,d&&(d(),d=null),h(),u=setInterval(()=>{c||document.visibilityState!=="visible"||h()},jPe))};return o(!0),s(null),PX()?d=SPe(l,v=>{c||f||(r(v),o(!1),s(null))},v=>{if(c)return;const m=v.message||String(v);if(kPe(m)){p();return}s(m),r([]),o(!1)}):p(),()=>{c=!0,d&&d(),u&&clearInterval(u)}},[l]),{items:t,loading:n,error:a}}function iI(e){return!Number.isNaN(e.getTime())}function oI(e){if(e==null||String(e).trim()==="")return"—";const t=new Date(e);return iI(t)?t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):String(e)}function IX(e){if(e==null||String(e).trim()==="")return"";const t=String(e).trim(),r=t.match(/^(\d{4}-\d{2}-\d{2})/);if(r)return r[1];const n=new Date(t);return iI(n)?n.toISOString().slice(0,10):""}function CPe(e){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return"Date TBD";const t=new Date(`${e}T12:00:00`);return iI(t)?t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"}):e}function EPe(e){return e===new Date().toISOString().slice(0,10)}function OX(e){const t=new Map;for(const n of e){const o=n.trackId??null,a=n.name||"Unassigned";for(const s of n.sessions){const c=IX(s.startTime)||"_nodate";t.has(c)||t.set(c,[]),t.get(c).push({trackId:o,trackName:a,sessionId:s.sessionId,title:s.title,startTime:s.startTime})}}return Array.from(t.keys()).sort((n,o)=>n==="_nodate"?1:o==="_nodate"?-1:n.localeCompare(o)).map(n=>{const o=t.get(n),a=new Map;for(const s of o){const l=s.trackId??s.trackName;a.has(l)||a.set(l,{trackId:s.trackId,trackName:s.trackName,sessions:[]}),a.get(l).sessions.push({sessionId:s.sessionId,title:s.title,startTime:s.startTime})}return a.forEach(s=>s.sessions.sort((l,c)=>l.startTime.localeCompare(c.startTime))),{dateKey:n,dateLabel:n==="_nodate"?"No date":CPe(n),tracks:Array.from(a.values())}})}function NX(e){const t=[];for(const r of e)for(const n of r.sessions)t.push({id:n.sessionId,trackName:r.name||"Unassigned",label:n.title,startTime:n.startTime,timeLabel:oI(n.startTime),dateKey:IX(n.startTime)||"_nodate"});return t.sort((r,n)=>r.startTime.localeCompare(n.startTime)),t}function RX({sessions:e,sessionId:t,onOpenSessionPicker:r}){const n=e.find(a=>a.id===t)??e[0],o=e.length>1;return e.length===0?null:i.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:[i.jsxs("div",{style:{padding:"7px 14px",flex:1},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"1px",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Session"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.3"},children:[(n==null?void 0:n.label)??"—",i.jsx("span",{style:{color:"var(--muted)",fontWeight:"var(--font-weight-normal)",marginLeft:"6px"},children:(n==null?void 0:n.timeLabel)??""})]})]}),o?i.jsx("button",{type:"button",onClick:r,style:{padding:"0 14px",background:"var(--secondary)",border:"none",borderLeft:"1px solid var(--border)",cursor:"pointer",display:"flex",alignItems:"center",color:"var(--primary)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Change"}):null]})}function LX({dateGroups:e,onSelectSession:t,selectPrompt:r}){var f;const n=new Date().toISOString().slice(0,10),o=e.some(h=>h.dateKey===n)?n:((f=e[0])==null?void 0:f.dateKey)??"",[a,s]=S.useState(o),[l,c]=S.useState(new Set);S.useEffect(()=>{e.length&&o&&s(o)},[e.length,o]);const u=e.find(h=>h.dateKey===a)??e[0];S.useEffect(()=>{const h=e.find(v=>v.dateKey===a)??e[0];if(!(h!=null&&h.tracks.length)){c(new Set);return}const p=h.tracks.map((v,m)=>String(v.trackId??v.trackName??`t-${m}`));c(new Set(p))},[a,e]);const d=h=>{c(p=>{const v=new Set(p);return v.has(h)?v.delete(h):v.add(h),v})};return e.length===0?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:320,padding:24,textAlign:"center"},children:[i.jsx(pre,{size:40,style:{color:"var(--border)",marginBottom:12}}),i.jsx("p",{style:{fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"No sessions in this event. Add tracks and sessions in Agenda first."})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:380,padding:24},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:16},children:r??"Select a session"}),i.jsx("div",{style:{display:"flex",gap:4,marginBottom:20,flexWrap:"wrap",justifyContent:"center"},children:e.map(h=>i.jsx("button",{type:"button",onClick:()=>s(h.dateKey),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:a===h.dateKey?"var(--primary)":"var(--card)",color:a===h.dateKey?"var(--primary-foreground)":"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:a===h.dateKey?600:400,cursor:"pointer"},children:h.dateKey!=="_nodate"&&EPe(h.dateKey)?"Today":h.dateLabel},h.dateKey))}),i.jsx("div",{style:{width:"100%",maxWidth:920,border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",background:"var(--card)"},children:u==null?void 0:u.tracks.map((h,p)=>{const v=String(h.trackId??h.trackName??`t-${p}`),m=l.has(v);return i.jsxs("div",{style:{borderBottom:p<u.tracks.length-1?"1px solid var(--border)":"none"},children:[i.jsxs("button",{type:"button",onClick:()=>d(v),style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"12px 16px",background:"var(--secondary)",border:"none",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:600,color:"var(--foreground)",textAlign:"left"},children:[i.jsx(go,{size:14,style:{transform:m?"rotate(180deg)":"none",transition:"transform 0.2s"}}),h.trackName,i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontWeight:400},children:["(",h.sessions.length," session",h.sessions.length!==1?"s":"",")"]})]}),m&&i.jsx("div",{style:{padding:"4px 0"},children:h.sessions.map(b=>i.jsxs("button",{type:"button",onClick:()=>t(b.sessionId),style:{width:"100%",padding:"10px 16px 10px 44px",border:"none",background:"none",cursor:"pointer",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",textAlign:"left"},onMouseEnter:x=>{x.currentTarget.style.background="var(--secondary)"},onMouseLeave:x=>{x.currentTarget.style.background="none"},children:[b.title,i.jsx("span",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:2},children:oI(b.startTime)})]},b.sessionId))})]},v)})})]})}function APe(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():(t[0]||"?").slice(0,2).toUpperCase()}const $9=["#16a34a","#2563eb","#d97706","#7c3aed","#0891b2","#be185d","#0d9488","#ea580c"];function TPe(e){let t=0;for(let r=0;r<e.length;r++)t=(t+e.charCodeAt(r)*(r+1))%$9.length;return $9[t]??"#64748b"}function PPe(e){if(!e)return"—";const t=Date.parse(e);return Number.isNaN(t)?"—":new Date(t).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function IPe({q:e,busy:t,onShortlist:r,onAudienceToggle:n,onArchive:o,onRestore:a}){const[s,l]=S.useState(!1),c=APe(e.author),u=TPe(e._id),d=e.status==="archived",f=(h,p,v,m,b)=>i.jsxs("button",{type:"button",disabled:b||t,onClick:v,style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:b||t?"not-allowed":"pointer",opacity:b||t?.55:1,transition:"all 0.1s"},onMouseEnter:x=>{b||t||(x.currentTarget.style.borderColor=m,x.currentTarget.style.color=m,x.currentTarget.style.background=m+"10")},onMouseLeave:x=>{x.currentTarget.style.borderColor="var(--border)",x.currentTarget.style.color="var(--muted)",x.currentTarget.style.background="var(--card)"},children:[h," ",p]});return i.jsxs("div",{onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",gap:"0",background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",overflow:"hidden",boxShadow:s?"var(--elevation-sm)":"none",transition:"box-shadow 0.15s"},children:[i.jsxs("div",{style:{width:"72px",flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"2px",padding:"16px 0",borderRight:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1"},children:e.up}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"upvotes"}),i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[e.down," down"]})]}),i.jsxs("div",{style:{flex:1,padding:"14px 16px",minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"7px",flexWrap:"wrap"},children:[i.jsx("div",{style:{width:"22px",height:"22px",borderRadius:"50%",background:u,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"8px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:c})}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:e.author}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"·"}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:PPe(e.createdAt)}),i.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:"4px",flexWrap:"wrap"},children:[e.shortlisted&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#dcfce7",color:"#15803d",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Shortlisted"}),!e.audienceListed&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#fee2e2",color:"#b91c1c",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Hidden"}),d&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#f1f5f9",color:"#475569",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Archived"}),e.status==="answered"&&!d&&i.jsx("span",{style:{padding:"2px 8px",borderRadius:"999px",background:"#e0f2fe",color:"#0369a1",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:"Answered"})]})]}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",lineHeight:"1.6",marginBottom:"10px"},children:e.text}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[e.shortlisted?f(i.jsx(DO,{size:11}),"Remove shortlist",()=>r(!1),"#15803d",d):f(i.jsx(DO,{size:11}),"Shortlist",()=>r(!0),"#15803d",d),e.audienceListed?f(i.jsx(gT,{size:11}),"Hide from audience",()=>n(!1),"#b91c1c",d):f(i.jsx(qh,{size:11}),"Show to audience",()=>n(!0),"#15803d",d),d?f(i.jsx(Kre,{size:11}),"Restore",a,"#2563eb",!1):f(i.jsx(ote,{size:11}),"Archive",o,"#475569",!1)]})]})]})}function FX({fixedSessionId:e=null,compactChrome:t=!1}={}){const n=Si()==="mobile",{selectedEventId:o}=Li(),[a,s]=S.useState(e??null),[l,c]=S.useState([]),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState("All"),[m,b]=S.useState("votes"),[x,w]=S.useState(""),[k,j]=S.useState(!1),[_,T]=S.useState(null),[A,P]=S.useState(null),N=S.useMemo(()=>OX(l),[l]),O=S.useMemo(()=>NX(l),[l]),{items:C,loading:I,error:R}=_Pe(a);S.useEffect(()=>{if(!o){h(null);return}Lr.get(o).then(V=>{var D;(D=V.data)!=null&&D.name?h(V.data.name):h(null)})},[o]),S.useEffect(()=>{if(!o){c([]),s(null);return}d(!0),wa.agendaTree(o).then(V=>{var D;d(!1),c(((D=V.data)==null?void 0:D.tracks)??[])})},[o]),S.useLayoutEffect(()=>{if(e){s(e);return}!o||u||a===null&&O.length===1&&s(O[0].id)},[o,u,a,O,e]);const F=S.useMemo(()=>{const V=C.length,D=C.filter(G=>G.shortlisted).length,z=C.filter(G=>!G.audienceListed).length,q=C.filter(G=>G.status==="archived").length;return{All:V,Shortlisted:D,Hidden:z,Archived:q}},[C]),M=S.useMemo(()=>{let V=C;p==="Shortlisted"?V=V.filter(z=>z.shortlisted):p==="Hidden"?V=V.filter(z=>!z.audienceListed):p==="Archived"&&(V=V.filter(z=>z.status==="archived")),V=V.filter(z=>!x||z.text.toLowerCase().includes(x.toLowerCase())||z.author.toLowerCase().includes(x.toLowerCase()));const D=[...V];return m==="votes"?D.sort((z,q)=>q.up-z.up||(q.createdAt?Date.parse(q.createdAt):0)-(z.createdAt?Date.parse(z.createdAt):0)):D.sort((z,q)=>(q.createdAt?Date.parse(q.createdAt):0)-(z.createdAt?Date.parse(z.createdAt):0)),D},[C,p,x,m]),Y=async(V,D)=>{P(null),T(V);const z=await nI.patch(V,D);T(null),z.error&&P(z.error)},X=["All","Shortlisted","Hidden","Archived"];if(!o)return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(Vi,{size:40,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"Select an event to manage audience questions."})]});const $=!e&&a===null,ee=O.find(V=>V.id===a);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[t?i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:[F.All," in session  · ",i.jsxs("span",{style:{color:"#15803d"},children:[F.Shortlisted," shortlisted"]})," · ",i.jsxs("span",{style:{color:"#b91c1c"},children:[F.Hidden," hidden"]})," · ",i.jsxs("span",{children:[F.Archived," archived"]})]}):i.jsxs("div",{style:{display:"flex",alignItems:n?"stretch":"flex-start",flexDirection:n?"column":"row",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:f??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:n?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Questions"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[F.All," in session  · ",i.jsxs("span",{style:{color:"#15803d"},children:[F.Shortlisted," shortlisted"]})," · ",i.jsxs("span",{style:{color:"#b91c1c"},children:[F.Hidden," hidden"]})," · ",i.jsxs("span",{children:[F.Archived," archived"]})]})]}),!$&&!e?i.jsx("div",{style:{flex:n?1:"none",minWidth:0,maxWidth:n?"100%":360},children:i.jsx(RX,{sessions:O,sessionId:a,onOpenSessionPicker:()=>s(null)})}):null]}),A&&i.jsx("div",{style:{padding:"10px 14px",borderRadius:"var(--radius-button)",background:"#fef2f2",border:"1px solid #fecaca",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:A}),$?u?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(LX,{dateGroups:N,onSelectSession:V=>s(V),selectPrompt:"Select a session to view and moderate audience questions"}):i.jsxs(i.Fragment,{children:[ee&&!t&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Session: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:ee.label}),i.jsx("span",{style:{marginLeft:8},children:ee.trackName}),i.jsx("span",{style:{marginLeft:8,color:"var(--muted)"},children:oI(ee.startTime)})]}),R&&i.jsx("div",{style:{padding:"12px 16px",borderRadius:"var(--radius-button)",background:"#fff7ed",border:"1px solid #fed7aa",color:"#9a3412",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:R}),I&&!R?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading questions…"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx("div",{style:{display:"flex",background:"var(--secondary)",borderRadius:"var(--radius-button)",padding:"2px",gap:"2px"},children:X.map(V=>i.jsxs("button",{type:"button",onClick:()=>v(V),style:{padding:"5px 12px",borderRadius:"var(--radius-button)",border:"none",background:p===V?"var(--card)":"transparent",color:p===V?"var(--foreground)":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:p===V?"var(--font-weight-medium)":"var(--font-weight-normal)",cursor:"pointer",transition:"all 0.12s",boxShadow:p===V?"var(--elevation-sm)":"none",display:"flex",alignItems:"center",gap:"5px"},children:[V==="Hidden"?"Hidden from audience":V,F[V]>0&&i.jsx("span",{style:{padding:"0 5px",borderRadius:"999px",background:p===V?"var(--accent)":"transparent",color:p===V?"var(--primary)":"var(--muted)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:F[V]})]},V))}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"32px",flex:"1 1 180px",background:"var(--card)",border:`1px solid ${k?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",transition:"border-color 0.12s"},children:[i.jsx(pi,{size:12,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:x,onChange:V=>w(V.target.value),placeholder:"Search questions or authors…",onFocus:()=>j(!0),onBlur:()=>j(!1),style:{background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",width:"100%"}}),x&&i.jsx("button",{type:"button",onClick:()=>w(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{size:11})})]}),i.jsxs("button",{type:"button",onClick:()=>b(V=>V==="votes"?"recent":"votes"),style:{display:"flex",alignItems:"center",gap:"5px",height:"32px",padding:"0 12px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},onMouseEnter:V=>{V.currentTarget.style.borderColor="var(--primary)",V.currentTarget.style.color="var(--primary)"},onMouseLeave:V=>{V.currentTarget.style.borderColor="var(--border)",V.currentTarget.style.color="var(--muted)"},children:[i.jsx(cte,{size:12}),m==="votes"?"Most upvoted":"Most recent"]})]}),M.length===0?i.jsxs("div",{style:{textAlign:"center",padding:"64px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(dd,{size:32,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:x?"No questions match your search":"No questions yet"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:x?"Try different keywords.":"Audience questions will appear here when submitted for this session."})]}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:M.map(V=>i.jsx(IPe,{q:V,busy:_===V._id,onShortlist:D=>void Y(V._id,{shortlisted:D}),onAudienceToggle:D=>void Y(V._id,{audienceListed:D}),onArchive:()=>void Y(V._id,{status:"archived"}),onRestore:()=>void Y(V._id,{status:"pending"})},V._id))})]})]}),t?null:i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})})]})}function OPe({active:e,onClick:t,busy:r,disabled:n}){return i.jsx("button",{type:"button",disabled:n||r,onClick:t,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",background:e?"#fffbeb":"var(--secondary)",border:`1px solid ${e?"#fcd34d":"var(--border)"}`,cursor:n||r?"not-allowed":"pointer",transition:"all 0.15s",whiteSpace:"nowrap",opacity:n?.45:r?.7:1},children:i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:e?"#b45309":"var(--muted)"},children:e?"Hide Correct":"Show Correct"})})}function NPe({live:e,onClick:t,busy:r}){return i.jsxs("button",{type:"button",disabled:r,onClick:t,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",background:e?"#f0fdf4":"var(--secondary)",border:`1px solid ${e?"#bbf7d0":"var(--border)"}`,cursor:r?"wait":"pointer",transition:"all 0.15s",whiteSpace:"nowrap",opacity:r?.7:1},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:e?"#16a34a":"var(--border)",display:"block",flexShrink:0}}),i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:e?"#15803d":"var(--muted)"},children:e?"Make Offline":"Make Live"})]})}function RPe(e,t){return e._id!=null&&String(e._id).trim()!==""?String(e._id):`q-${t}`}function LPe({quiz:e,onClose:t,onUpdated:r}){var x,w;const[n,o]=S.useState(null),[a,s]=S.useState(!1),[l,c]=S.useState(!1),[u,d]=S.useState(null),f=((x=e.settings)==null?void 0:x.liveQuestionId)!=null&&String(e.settings.liveQuestionId).trim()!==""?String(e.settings.liveQuestionId).trim():null,h=((w=e.settings)==null?void 0:w.showCorrectAnswer)===!0,p=e.questions||[],v=async k=>{d(null),o(k??"__clear__");const j=await Pi.setLiveQuestion(e._id,k);if(o(null),j.error){d(j.error);return}await r()},m=async()=>{d(null),s(!0);const k=await Pi.setShowCorrect(e._id,!h);if(s(!1),k.error){d(k.error);return}await r()},b=async()=>{d(null),c(!0);const k=await Pi.close(e._id);if(c(!1),k.error){d(k.error);return}await r(),t()};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:200},role:"presentation"}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(720px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 32px rgba(0,0,0,0.18)",animation:"quizMasterPanelIn 0.25s ease"},children:[i.jsx("style",{children:"@keyframes quizMasterPanelIn { from { transform: translateX(100%); } to { transform: translateX(0); } }"}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Present quiz"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0",lineHeight:1.45},children:e.title}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",lineHeight:1.45},children:"Make one question live at a time. Attendees only see the live question."})]}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:4},children:i.jsx(Gt,{size:20})})]}),i.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:"12px 20px"},children:[u?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",marginBottom:"12px"},children:u}):null,p.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",padding:"24px 0",textAlign:"center"},children:"No questions on this quiz."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:p.map((k,j)=>{const _=RPe(k,j),T=f===_,A=n===_||n==="__clear__"&&T;return i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"12px 14px",border:`1px solid ${T?"#bbf7d0":"var(--border)"}`,borderRadius:"var(--radius-card)",background:T?"#f0fdf4":"var(--card)"},children:[i.jsx("span",{style:{width:"22px",height:"22px",borderRadius:"50%",background:T?"#16a34a":"var(--accent)",color:T?"#fff":"var(--primary)",fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,marginTop:"1px"},children:j+1}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",lineHeight:1.4,marginBottom:"6px"},children:k.question}),i.jsxs("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",alignItems:"center"},children:[i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",padding:"1px 7px",borderRadius:"3px",background:"var(--accent)",color:"var(--accent-foreground)"},children:k.type||"single"}),typeof k.timeLimit=="number"&&k.timeLimit>0?i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[k.timeLimit,"s limit"]}):null,T?i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"#15803d",fontWeight:"600"},children:"Live now"}):null]})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px",flexShrink:0,alignItems:"flex-end"},children:[i.jsx(NPe,{live:T,busy:A,onClick:()=>void v(T?null:_)}),i.jsx(OPe,{active:T&&h,busy:a,disabled:!T,onClick:()=>void m()})]})]},_)})})]}),i.jsxs("div",{style:{padding:"14px 20px",borderTop:"1px solid var(--border)",flexShrink:0,display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Close"}),i.jsx("button",{type:"button",disabled:l,onClick:()=>void b(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--destructive)",color:"#fff",cursor:l?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:l?.8:1},children:l?"Taking offline…":"Make quiz offline"})]})]})]})}function Of(e){if(typeof e.enableQnA=="boolean")return e.enableQnA;const t=e.qnaEnabled;return typeof t=="boolean"?t:!0}function ph(e){return typeof e.enableQnP=="boolean"?e.enableQnP:!0}function mx(e){const t=e.track;let r=null;t&&typeof t=="object"&&"_id"in t?r=String(t._id):typeof t=="string"&&t.trim()&&(r=t);const n=(e.speakers||[]).map(o=>typeof o=="string"?o:o._id);return{title:e.title,description:e.description??"",type:e.type,startTime:e.startTime,endTime:e.endTime,location:e.location,track:r,speakers:n,moderator:e.moderator??null,capacity:e.capacity,status:e.status,resources:e.resources,audienceFeedbackEnabled:e.audienceFeedbackEnabled,audienceRatingsEnabled:e.audienceRatingsEnabled,audienceKeyPersonsEnabled:e.audienceKeyPersonsEnabled,audienceMySessionsEnabled:e.audienceMySessionsEnabled,audienceAgendaEnabled:e.audienceAgendaEnabled,audienceFeedbackForm:e.audienceFeedbackForm??null,audienceRatingsForm:e.audienceRatingsForm??null,enableQnA:Of(e),enableQnP:ph(e)}}const FPe=[{rank:1,name:"Ravi Gulhane",polls:18,quiz:27,total:45},{rank:2,name:"Pawankumar J.",polls:15,quiz:23,total:38},{rank:3,name:"Zeeshan",polls:12,quiz:20,total:32},{rank:4,name:"Amey Bhagwat",polls:10,quiz:18,total:28},{rank:5,name:"Abhijit Aundhkar",polls:8,quiz:16,total:24},{rank:6,name:"Shabareesh D.",polls:7,quiz:14,total:21}],zPe={Active:{bg:"#dcfce7",color:"#15803d"},Completed:{bg:"var(--secondary)",color:"var(--muted)"},Draft:{bg:"#f3f4f6",color:"#6b7280"}},MPe={1:{bg:"#fef3c7",color:"#92400e",medal:"🥇"},2:{bg:"#f1f5f9",color:"#475569",medal:"🥈"},3:{bg:"#ffedd5",color:"#c2410c",medal:"🥉"}},j1={width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",cursor:"pointer",color:"var(--muted)",flexShrink:0};function DPe({sessions:e,itemId:t,itemType:r,eventId:n,onClose:o,onDone:a}){const[s,l]=S.useState(""),[c,u]=S.useState(!1),[d,f]=S.useState(!1),[h,p]=S.useState(null);S.useEffect(()=>{t&&(l(""),u(!0),p(null),Pi.get(t).then(m=>{var b;u(!1),(b=m.data)!=null&&b.session?l(String(m.data.session)):e.length&&l(e[0].id)}))},[t,e.length]);const v=async()=>{if(!s||!n)return;f(!0),p(null);const m=await Pi.get(t);if(m.error||!m.data){p(m.error||"Failed to load item"),f(!1);return}const b=m.data,x={session:s,title:(b.title||"").trim()+" (Copy)",type:b.type,description:b.description,questions:(b.questions||[]).map(k=>({question:k.question,type:k.type,imageUrl:k.imageUrl,options:(k.options||[]).map(j=>({text:j.text,isCorrect:j.isCorrect,imageUrl:j.imageUrl})),points:k.points,required:k.required,timeLimit:k.timeLimit})),settings:b.settings?{...b.settings,isLive:!1,liveQuestionId:null,showCorrectAnswer:!1,presentationToken:void 0}:void 0},w=await Pi.create(n,x);if(f(!1),w.error){p(w.error);return}a(),o()};return c?i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("div",{style:{background:"var(--card)",padding:24,borderRadius:"var(--radius-card)"},children:"Loading…"})}):i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24},onClick:o,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:420,boxShadow:"var(--elevation-sm)"},onClick:m=>m.stopPropagation(),children:[i.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:4},children:["Copy ",r==="poll"?"Poll":"Quiz"]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:["Select the session to copy this ",r," to (with all questions)."]})]}),i.jsxs("div",{style:{padding:"20px 24px"},children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:500,marginBottom:8},children:"Session"}),i.jsxs("select",{value:s,onChange:m=>l(m.target.value),style:{width:"100%",height:40,padding:"0 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:[i.jsx("option",{value:"",children:"Select session"}),e.map(m=>i.jsxs("option",{value:m.id,children:[m.label," · ",m.trackName]},m.id))]}),h&&i.jsx("p",{style:{marginTop:8,fontSize:"var(--text-sm)",color:"var(--destructive)"},children:h})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:8},children:[i.jsx("button",{type:"button",onClick:o,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:v,disabled:!s||d,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:s&&!d?"var(--primary)":"var(--border)",color:s&&!d?"var(--primary-foreground)":"var(--muted)",cursor:s&&!d?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontWeight:600},children:d?"Copying…":"Copy here"})]})]})})}function U9({live:e,onChange:t}){return i.jsxs("button",{onClick:t,style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",background:e?"#f0fdf4":"var(--secondary)",border:`1px solid ${e?"#bbf7d0":"var(--border)"}`,cursor:"pointer",transition:"all 0.15s",whiteSpace:"nowrap"},children:[i.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:e?"#16a34a":"var(--border)",display:"block",flexShrink:0}}),i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:e?"#15803d":"var(--muted)"},children:e?"Make Offline":"Make Live"})]})}function OE({checked:e,onChange:t}){return i.jsxs("button",{onClick:t,style:{width:"16px",height:"16px",borderRadius:"3px",border:`1.5px solid ${e?"var(--primary)":"var(--border)"}`,background:e===!0?"var(--primary)":"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0,padding:0},children:[e===!0&&i.jsx(bi,{size:10,strokeWidth:3,color:"#fff"}),e==="indeterminate"&&i.jsx(oS,{size:10,strokeWidth:3,color:"var(--primary)"})]})}function BPe({polls:e,quizzes:t,onClose:r}){const[n,o]=S.useState(new Set),[a,s]=S.useState(new Set),[l,c]=S.useState(!0),[u,d]=S.useState(!1),f=_=>o(T=>{const A=new Set(T);return A.has(_)?A.delete(_):A.add(_),A}),h=_=>s(T=>{const A=new Set(T);return A.has(_)?A.delete(_):A.add(_),A}),p=e.map(_=>_.id),v=t.map(_=>_.id),m=n.size+a.size,b=p.length+v.length,x=n.size===p.length&&a.size===v.length,w=m>0,k=()=>m===0?!1:m===b?!0:"indeterminate",j=()=>{x?(o(new Set),s(new Set)):(o(new Set(p)),s(new Set(v)))};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.3)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"680px",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)",overflow:"hidden"},children:[i.jsxs("div",{style:{background:"var(--primary)",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(nu,{size:15,color:"rgba(255,255,255,0.9)"}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"#fff"},children:"Session Leaderboard"})]}),i.jsx("button",{onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"rgba(255,255,255,0.7)",display:"flex"},children:i.jsx(Gt,{size:16})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{onClick:()=>c(_=>!_),style:{width:"100%",display:"flex",alignItems:"center",gap:"10px",padding:"12px 20px",background:"var(--secondary)",border:"none",cursor:"pointer",borderBottom:l?"1px solid var(--border)":"none"},children:[i.jsx(_te,{size:13,style:{color:"var(--muted)"}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Filter Quizzes & Polls"}),m>0&&!u&&i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",background:"var(--accent)",color:"var(--primary)",padding:"2px 7px",borderRadius:"999px",fontWeight:"600"},children:[m," selected"]}),i.jsx(go,{size:13,style:{color:"var(--muted)",transform:l?"rotate(180deg)":"none",transition:"transform 0.15s"}})]}),l&&i.jsxs("div",{style:{padding:"16px 20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"14px",paddingBottom:"12px",borderBottom:"1px solid var(--border)"},children:[i.jsx(OE,{checked:k(),onChange:j}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"},children:"Select all"}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginLeft:"auto"},children:[m," of ",b," selected"]})]}),i.jsxs("div",{style:{marginBottom:"14px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[i.jsx(Ad,{size:12,style:{color:"#16a34a"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"#16a34a",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Polls"})]}),e.map(_=>i.jsxs("div",{onClick:()=>f(_.id),style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"7px 0 7px 16px",borderBottom:"1px solid var(--border)",cursor:"pointer"},children:[i.jsx(OE,{checked:n.has(_.id),onChange:()=>{}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:_.name})]},_.id))]}),i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[i.jsx(_$,{size:12,style:{color:"var(--primary)"}}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--primary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Quizzes"})]}),t.map(_=>i.jsxs("div",{onClick:()=>h(_.id),style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"7px 0 7px 16px",borderBottom:"1px solid var(--border)",cursor:"pointer"},children:[i.jsx(OE,{checked:a.has(_.id),onChange:()=>{}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:_.name})]},_.id))]}),i.jsxs("button",{onClick:()=>w&&d(!0),style:{width:"100%",marginTop:"16px",padding:"11px",borderRadius:"var(--radius-button)",background:w?"var(--primary)":"var(--border)",color:w?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:w?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"background 0.15s"},children:[i.jsx(nu,{size:13})," Generate Leaderboard"]})]})]}),u?i.jsxs("div",{style:{padding:"20px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:"14px"},children:"Results"}),i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"48px 1fr 80px 80px 80px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["#","Participant","Polls","Quiz","Total"].map((_,T)=>i.jsx("div",{style:{padding:"8px 12px",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.04em",textAlign:T>1?"right":"left"},children:_},_))}),FPe.map(_=>{const T=MPe[_.rank];return i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"48px 1fr 80px 80px 80px",alignItems:"center",borderBottom:"1px solid var(--border)",background:"var(--card)"},children:[i.jsx("div",{style:{padding:"10px 12px"},children:T?i.jsx("span",{style:{fontSize:"13px"},children:T.medal}):i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["#",_.rank]})}),i.jsx("div",{style:{padding:"10px 12px"},children:i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",fontWeight:"var(--font-weight-medium)"},children:_.name})}),i.jsx("div",{style:{padding:"10px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:_.polls})}),i.jsx("div",{style:{padding:"10px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:_.quiz})}),i.jsx("div",{style:{padding:"10px 12px",textAlign:"right"},children:i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:_.total})})]},_.rank)})]})]}):l?null:i.jsxs("div",{style:{padding:"60px 20px",textAlign:"center"},children:[i.jsx(nu,{size:40,style:{color:"var(--border)",margin:"0 auto 14px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Select quizzes and polls to generate"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Use the filter section above to pick items, then click Generate Leaderboard."})]})]})]})})}function M6(e){return(e??"").trim()==="quiz_master"}function WPe(e){return(e??"").trim()==="manual"}const H9={display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",background:"var(--secondary)",border:"1px solid var(--border)",cursor:"pointer",transition:"all 0.15s",whiteSpace:"nowrap",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)"};function V9({name:e,description:t,badge:r,status:n,live:o,showLiveToggle:a,showQuizMasterControls:s,onToggleLive:l,onPresent:c,onMakeOffline:u,onCopyPresentation:d,presentationCopied:f,onDuplicate:h,onEdit:p,onDelete:v}){const[m,b]=S.useState(!1),x=zPe[n];return i.jsxs("div",{onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),style:{display:"flex",alignItems:"center",gap:"12px",padding:"13px 18px",borderBottom:"1px solid var(--border)",background:m?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx(wv,{size:13,style:{color:"var(--border)",flexShrink:0}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",marginBottom:"3px",flexWrap:"wrap"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:e}),i.jsx("span",{style:{padding:"1px 7px",borderRadius:"3px",background:x.bg,color:x.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:n}),r&&i.jsx("span",{style:{padding:"1px 7px",borderRadius:"3px",background:"var(--accent)",color:"var(--accent-foreground)",fontSize:"10px",fontFamily:"var(--font-noto-sans)"},children:r})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:"1.45",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"480px"},children:t})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[s?i.jsxs(i.Fragment,{children:[o?i.jsx("button",{type:"button",onClick:c,style:H9,children:"Manage"}):i.jsx("button",{type:"button",onClick:c,style:{...H9,color:"var(--primary)",borderColor:"var(--primary)"},children:"Make Live"}),o?i.jsx(U9,{live:!0,onChange:()=>u==null?void 0:u()}):null]}):null,a?i.jsx(U9,{live:o,onChange:l}):null,i.jsx("button",{type:"button",onClick:d,style:j1,title:"Copy presentation link",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--primary)",w.currentTarget.style.color="var(--primary)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:f?i.jsx(bi,{size:12}):i.jsx(Nre,{size:12})}),i.jsx("button",{type:"button",onClick:h,style:j1,title:"Duplicate",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--primary)",w.currentTarget.style.color="var(--primary)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:i.jsx(Js,{size:12})}),i.jsx("button",{type:"button",onClick:p,style:j1,title:"Edit",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--primary)",w.currentTarget.style.color="var(--primary)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:12})}),i.jsx("button",{type:"button",onClick:v,style:{...j1,color:"var(--muted)"},title:"Delete",onMouseEnter:w=>{w.currentTarget.style.borderColor="var(--destructive)",w.currentTarget.style.color="var(--destructive)"},onMouseLeave:w=>{w.currentTarget.style.borderColor="var(--border)",w.currentTarget.style.color="var(--muted)"},children:i.jsx(Xr,{size:12})})]})]})}function Y9(e){var a,s,l,c,u,d,f,h;const t=(a=e.settings)==null?void 0:a.status,r=!t&&(((s=e.settings)==null?void 0:s.isLive)===!1||((l=e.settings)==null?void 0:l.isLive)===void 0&&((c=e.settings)==null?void 0:c.isActive)===!1),n=t==="draft"||r,o=((u=e.settings)==null?void 0:u.isLive)??((d=e.settings)==null?void 0:d.isActive)??!1;return{id:e._id,name:e.title,description:e.description??"",status:n?"Draft":"Active",live:o,showLiveToggle:WPe((f=e.settings)==null?void 0:f.displayMode),showQuizMasterControls:M6((h=e.settings)==null?void 0:h.displayMode),type:e.type==="quiz"?"Quiz":void 0}}const U1={display:"flex",alignItems:"center",gap:"5px",padding:"5px 12px",borderRadius:"var(--radius-button)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"};function NE({icon:e,iconColor:t,title:r,count:n,addLabel:o,onAdd:a,headerActions:s,hideAdd:l,children:c,emptyBody:u}){return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"13px 18px",borderBottom:"1px solid var(--border)",background:"var(--secondary)",flexWrap:"wrap"},children:[i.jsx("span",{style:{color:t},children:e}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:r}),i.jsx("span",{style:{width:"18px",height:"18px",borderRadius:"50%",background:t,color:"#fff",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",display:"flex",alignItems:"center",justifyContent:"center"},children:n}),i.jsx("div",{style:{flex:1}}),s??(!l&&a&&o?i.jsxs("button",{type:"button",onClick:a,style:{...U1,background:t,color:"#fff"},children:[i.jsx(gr,{size:12})," ",o]}):null)]}),u??c]})}function zX({fixedSessionId:e=null,compactChrome:t=!1,includeQnASection:r=!0,onQuizPollPersisted:n}={}){const a=Si()==="mobile",{selectedEventId:s}=Li(),[l,c]=S.useState(e??null),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState(null),[m,b]=S.useState(null),[x,w]=S.useState(null),[k,j]=S.useState(null),[_,T]=S.useState(null),[A,P]=S.useState([]),[N,O]=S.useState([]),[C,I]=S.useState(!1),[R,F]=S.useState(!1),[M,Y]=S.useState(null),[X,$]=S.useState(!1),[ee,V]=S.useState(0),[D,z]=S.useState(!1),[q,G]=S.useState(!1),U=S.useMemo(()=>OX(A),[A]),Q=S.useMemo(()=>NX(A),[A]);S.useEffect(()=>{if(!s){P([]),c(null);return}I(!0),wa.agendaTree(s).then(Ee=>{var Ae;I(!1),P(((Ae=Ee.data)==null?void 0:Ae.tracks)??[])})},[s]),S.useLayoutEffect(()=>{if(e){c(e);return}!s||C||l===null&&Q.length===1&&c(Q[0].id)},[s,C,l,Q,e]);const K=()=>{l&&(F(!0),Pi.listBySession(l).then(Ee=>{var Ae;F(!1),O(((Ae=Ee.data)==null?void 0:Ae.quizPolls)??[])}))};S.useEffect(()=>{if(!l){O([]);return}K()},[l]),S.useEffect(()=>{if(z(!1),!s||!l||!r){Y(null),V(0);return}let Ee=!1;return $(!0),ta.list(s).then(Ae=>{var rt;if(Ee)return;$(!1);const Ye=(((rt=Ae.data)==null?void 0:rt.sessions)??[]).find(He=>He._id===l)??null;Y(Ye)}),nI.listBySession(l).then(Ae=>{var Ye,rt;Ee||V(((rt=(Ye=Ae.data)==null?void 0:Ye.questions)==null?void 0:rt.length)??0)}),()=>{Ee=!0}},[s,l,r]);const re=M?Of(M):!0,H=async Ee=>{if(!(!M||q)){G(!0);try{const Ae=await ta.update(M._id,{...mx(M),enableQnA:Ee});Ae.error||(Y(Ae.data??{...M,enableQnA:Ee}),Ee||z(!1))}finally{G(!1)}}};S.useEffect(()=>{if(!f||f.mode!=="edit"){v(null);return}v(null),Pi.get(f.id).then(Ee=>{if(!Ee.data)return;const Ae=Ee.data,Ye=Ae.type==="quiz"?"quiz":"poll",rt=vle(Ae,ole(Ae.questions));v({kind:Ye,form:rt.form,questions:rt.questions})})},[f]);const ie=S.useMemo(()=>N.filter(Ee=>Ee.type==="poll").map(Y9),[N]),de=S.useMemo(()=>N.filter(Ee=>Ee.type==="quiz").map(Y9),[N]),le=async Ee=>{var rt,He,xt,st;const Ae=N.find(Te=>Te._id===Ee);if(!Ae)return;if(M6((rt=Ae.settings)==null?void 0:rt.displayMode)){w(Ee);return}const Ye=!(((He=Ae.settings)==null?void 0:He.isLive)??((xt=Ae.settings)==null?void 0:xt.isActive));if(await Pi[Ye?"publish":"close"](Ee),l){const Te=await Pi.listBySession(l);O(((st=Te.data)==null?void 0:st.quizPolls)??[])}},ke=async Ee=>{var rt,He,xt,st;const Ae=N.find(Te=>Te._id===Ee);if(!Ae)return;if(M6((rt=Ae.settings)==null?void 0:rt.displayMode)){w(Ee);return}const Ye=!(((He=Ae.settings)==null?void 0:He.isLive)??((xt=Ae.settings)==null?void 0:xt.isActive));if(await Pi[Ye?"publish":"close"](Ee),l){const Te=await Pi.listBySession(l);O(((st=Te.data)==null?void 0:st.quizPolls)??[])}},ve=async Ee=>{await Pi.close(Ee),x===Ee&&w(null),K()},se=async Ee=>{var Ye;T(null);const Ae=await Pi.ensurePresentationToken(Ee);if(Ae.error||!((Ye=Ae.data)!=null&&Ye.presentationUrl)){T(Ae.error??"Could not create presentation link.");return}try{await navigator.clipboard.writeText(Ae.data.presentationUrl),j(Ee),T("Presentation link copied to clipboard."),window.setTimeout(()=>j(null),4e3),window.setTimeout(()=>T(null),4e3)}catch{T("Could not copy to clipboard.")}},be=x?N.find(Ee=>Ee._id===x)??null:null,De=()=>{h(null),v(null)},ae=async Ee=>{if(!s||!l||!f)return;const Ae=f.mode==="create"?f.kind:(p==null?void 0:p.kind)??"poll",Ye=f.mode==="edit"?f.id:null,rt={session:l,title:Ee.form.title,type:Ae,description:Ee.form.description||void 0,questions:Ee.questions.map(xt=>hS(xt,Ae)),settings:gS(Ee.form,Ae)};if(Ye){(await Pi.update(Ye,rt)).error||(K(),De(),await(n==null?void 0:n()));return}(await Pi.create(s,rt)).error||(K(),De(),await(n==null?void 0:n()))},ue=async Ee=>{if(!confirm("Delete this poll? You can restore it later if needed (soft delete)."))return;(await Pi.remove(Ee)).error||K()},Me=async Ee=>{if(!confirm("Delete this quiz? You can restore it later if needed (soft delete)."))return;(await Pi.remove(Ee)).error||K()};if(!s)return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(Vi,{size:40,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"Select an event to manage activities."})]});const Se=!e&&l===null,Pe=Q.find(Ee=>Ee.id===l);return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[t?Se?null:i.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:i.jsxs("button",{type:"button",onClick:()=>d(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:[i.jsx(nu,{size:13})," ",a?"Leaderboard":"Session Leaderboard"]})}):i.jsxs("div",{style:{display:"flex",alignItems:a?"stretch":"flex-start",flexDirection:a?"column":"row",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Activities"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:a?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Activities"})]}),!Se&&i.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexWrap:a?"wrap":"nowrap"},children:[e?null:i.jsx("div",{style:{flex:a?1:"none",minWidth:0},children:i.jsx(RX,{sessions:Q,sessionId:l,onOpenSessionPicker:()=>c(null)})}),i.jsxs("button",{type:"button",onClick:()=>d(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:[i.jsx(nu,{size:13})," ",a?"Leaderboard":"Session Leaderboard"]})]})]}),Se?C?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(LX,{dateGroups:U,onSelectSession:Ee=>c(Ee),selectPrompt:"Select a session to manage activities"}):i.jsxs(i.Fragment,{children:[Pe&&!t&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Session: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:Pe.label}),i.jsx("span",{style:{marginLeft:8},children:Pe.trackName})]}),D&&r&&l?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[i.jsxs("button",{type:"button",onClick:()=>z(!1),style:{display:"inline-flex",alignItems:"center",gap:"6px",alignSelf:"flex-start",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"},children:[i.jsx(uT,{size:14})," Back to Activities"]}),i.jsx(FX,{fixedSessionId:l,compactChrome:!0})]}):R?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading activities…"}):i.jsxs(i.Fragment,{children:[_?i.jsx("p",{style:{marginBottom:12,fontSize:"var(--text-sm)",color:"var(--primary)",fontFamily:"var(--font-noto-sans)"},children:_}):null,i.jsx(NE,{icon:i.jsx(Ad,{size:15}),iconColor:"#16a34a",title:"Polls",count:ie.length,addLabel:"Add Poll",onAdd:()=>h({mode:"create",kind:"poll"}),children:ie.map(Ee=>i.jsx(V9,{name:Ee.name,description:Ee.description,status:Ee.status,live:Ee.live,showLiveToggle:Ee.showLiveToggle,showQuizMasterControls:Ee.showQuizMasterControls,onToggleLive:()=>void le(Ee.id),onPresent:()=>w(Ee.id),onMakeOffline:()=>void ve(Ee.id),onCopyPresentation:()=>void se(Ee.id),presentationCopied:k===Ee.id,onDuplicate:()=>b({id:Ee.id,type:"poll"}),onEdit:()=>h({mode:"edit",id:Ee.id}),onDelete:()=>ue(Ee.id)},Ee.id))}),i.jsx(NE,{icon:i.jsx(_$,{size:15}),iconColor:"var(--primary)",title:"Quizzes",count:de.length,addLabel:"Add Quiz",onAdd:()=>h({mode:"create",kind:"quiz"}),children:de.map(Ee=>i.jsx(V9,{name:Ee.name,description:Ee.description,badge:Ee.type,status:Ee.status,live:Ee.live,showLiveToggle:Ee.showLiveToggle,showQuizMasterControls:Ee.showQuizMasterControls,onToggleLive:()=>void ke(Ee.id),onPresent:()=>w(Ee.id),onMakeOffline:()=>void ve(Ee.id),onCopyPresentation:()=>void se(Ee.id),presentationCopied:k===Ee.id,onDuplicate:()=>b({id:Ee.id,type:"quiz"}),onEdit:()=>h({mode:"edit",id:Ee.id}),onDelete:()=>Me(Ee.id)},Ee.id))}),r?i.jsx(NE,{icon:i.jsx(dd,{size:15}),iconColor:"#7c3aed",title:"Q&A",count:ee,hideAdd:!0,headerActions:i.jsx("div",{style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"},children:re?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:q||X,onClick:()=>void H(!1),style:{...U1,background:"var(--card)",color:"var(--muted)",border:"1px solid var(--border)",cursor:q?"wait":"pointer"},children:"Disable"}),i.jsx("button",{type:"button",onClick:()=>z(!0),style:{...U1,background:"#7c3aed",color:"#fff"},children:"Manage"})]}):i.jsx("button",{type:"button",disabled:q||X||!M,onClick:()=>void H(!0),style:{...U1,background:"#7c3aed",color:"#fff",cursor:q||!M?"wait":"pointer",opacity:M?1:.6},children:q?"Enabling…":"Enable"})}),emptyBody:i.jsx("div",{style:{padding:"16px 18px"},children:i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",lineHeight:1.5},children:re?"Audience questions are enabled on the visitor session page. Use Manage to moderate submitted questions.":"Controls whether attendees can ask and view questions on the visitor session page."})})}):null]})]}),t?null:i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})}),u&&i.jsx(BPe,{polls:ie,quizzes:de,onClose:()=>d(!1)}),f&&(f.mode==="create"||p)&&i.jsx(Ax,{kind:f.mode==="create"?f.kind:p.kind,initial:f.mode==="edit"?{form:p.form,questions:p.questions}:void 0,eventId:s,onClose:De,onSave:Ee=>void ae(Ee)},f.mode==="edit"?f.id:`new-${f.kind}`),m&&s&&Q.length>0&&i.jsx(DPe,{sessions:Q,itemId:m.id,itemType:m.type,eventId:s,onClose:()=>b(null),onDone:K}),be?i.jsx(LPe,{quiz:be,onClose:()=>w(null),onUpdated:async()=>{K()}}):null]})}function qPe(e={}){return i.jsx(zX,{...e,includeQnASection:e.includeQnASection??!1})}function $Pe({event:e,session:t,selectedEventId:r,onSaved:n}){const[o,a]=S.useState(1),[s,l]=S.useState(()=>new Set([1,2,3,4])),[c,u]=S.useState(()=>c2(e)),[d,f]=S.useState(()=>Of(t)),[h,p]=S.useState(()=>ph(t)),[v,m]=S.useState({}),[b,x]=S.useState(!1),[w,k]=S.useState(null),j=S.useRef(null),_=S.useRef(null);S.useEffect(()=>{u(c2(e)),f(Of(t)),p(ph(t)),m({}),k(null)},[e._id,e.updatedAt,t._id,t]);const T=S.useCallback((V,D)=>{u(z=>({...z,[V]:D}))},[]),A=V=>v[V],P=V=>a(D=>D===V?0:V),N=()=>u(V=>({...V,customFields:[...V.customFields,BU()]})),O=V=>{u(D=>({...D,customFields:D.customFields.filter(z=>z.id!==V)})),m(D=>{const z={...D};return Object.keys(z).forEach(q=>{(q.startsWith(`cf_${V}_`)||q===`cf_${V}_label`)&&delete z[q]}),z})},C=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>{if(q.id!==V)return q;const G={...q,label:D};return q.codeAuto&&(G.code=Ch(D)),G})}))},I=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>q.id===V?{...q,code:D,codeAuto:!1}:q)}))},R=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>{if(q.id!==V)return q;const G={...q,fieldType:D};return sc(D)&&q.options.length===0&&(G.options=[{id:Math.random().toString(36).slice(2),value:"",label:""}]),sc(D)||(G.options=[]),G})}))},F=V=>{u(D=>({...D,customFields:D.customFields.map(z=>z.id===V?{...z,options:[...z.options,{id:Math.random().toString(36).slice(2),value:"",label:""}]}:z)}))},M=(V,D)=>{u(z=>({...z,customFields:z.customFields.map(q=>q.id===V?{...q,options:q.options.filter(G=>G.id!==D)}:q)})),m(z=>{const q={...z};return delete q[`cf_${V}_opt_${D}`],q})},Y=(V,D,z,q)=>{u(G=>({...G,customFields:G.customFields.map(U=>U.id===V?{...U,options:U.options.map(Q=>Q.id===D?{...Q,[z]:q}:Q)}:U)}))},X=V=>{k(null),m({}),l(D=>new Set([...D,V])),V<pm&&a(V+1)},$=async()=>{k(null);const V=mae(c,e),D=V.customFields.filter(G=>!(!G.label.trim()||sc(G.fieldType)&&G.options.filter(Q=>Q.label.trim()&&Q.value.trim()).length===0)),z={...V,customFields:D},q=vae(z);if(Object.keys(q).length>0){m(q),(q.virtualLink||q.endDate)&&a(2),k("Fix the highlighted fields, then save again.");return}m({}),x(!0);try{const U={...zU(z),recordKind:e.recordKind??"activity",activitySubtype:e.activitySubtype},Q=await Lr.update(r,U);if(Q.error){k(Q.error);return}const K=await ta.update(t._id,{...mx(t),enableQnA:d,enableQnP:h});if(K.error){k(K.error);return}k("Saved."),await n()}finally{x(!1)}},ee=Math.round(s.size/pm*100);return i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",overflow:"hidden"},children:[i.jsxs("div",{style:{padding:"14px 20px",borderBottom:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px",flexWrap:"wrap",gap:"10px"},children:[i.jsxs("div",{children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Activity settings"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0"},children:"Empty fields keep existing saved values. Session Q&A and quiz toggles are under Basic."})]}),i.jsx("button",{type:"button",disabled:b,onClick:()=>void $(),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:b?"var(--secondary)":"var(--primary)",color:b?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:b?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:b?"Saving…":"Save settings"})]}),w&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:w==="Saved."?"#15803d":"#b91c1c",margin:"8px 0 0"},children:w}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"10px",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:[s.size," of ",pm," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[ee,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${ee}%`,background:"#22c55e",borderRadius:"99px",transition:"width 0.3s ease"}})})]}),i.jsxs("div",{style:{maxHeight:"min(70vh, 640px)",overflowY:"auto"},children:[i.jsxs(Tf,{n:1,title:"Basic",subtitle:"Name, description, and session features",open:o===1,completed:s.has(1),onToggle:()=>P(1),onNext:()=>X(1),nextLabel:"Continue to Schedule & Location",nextDisabled:b,children:[i.jsxs(lr,{error:A("eventName"),children:[i.jsx(ur,{text:"Activity name"}),i.jsx("input",{style:{...Qr,...A("eventName")?{borderColor:"var(--destructive)"}:{}},value:c.eventName,onChange:V=>T("eventName",V.target.value)})]}),i.jsxs(lr,{error:A("description"),children:[i.jsx(ur,{text:"Description"}),i.jsx("textarea",{style:{...Qr,resize:"vertical",minHeight:"80px",...A("description")?{borderColor:"var(--destructive)"}:{}},value:c.description,onChange:V=>T("description",V.target.value)})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:d,onChange:V=>f(V.target.checked)}),"Enable Q&A (Questions tab)"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:h,onChange:V=>p(V.target.checked)}),"Enable quiz & polls (Quiz & Polls tab)"]})]}),i.jsxs(Tf,{n:2,title:"Schedule & Location",subtitle:"When and where",open:o===2,completed:s.has(2),onToggle:()=>P(2),onNext:()=>X(2),nextLabel:"Continue to Media & Tags",nextDisabled:b,children:[i.jsxs(No,{children:[i.jsxs(lr,{error:A("status"),children:[i.jsx(ur,{text:"Status"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...A("status")?{borderColor:"var(--destructive)"}:{}},value:c.status,onChange:V=>T("status",V.target.value),children:[i.jsx("option",{value:"",children:"Select Status"}),i.jsx("option",{children:"Draft"}),i.jsx("option",{children:"Upcoming"}),i.jsx("option",{children:"Live"}),i.jsx("option",{children:"Completed"})]})})]}),i.jsxs(lr,{error:A("locationType"),children:[i.jsx(ur,{text:"Location Type"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...A("locationType")?{borderColor:"var(--destructive)"}:{}},value:c.locationType,onChange:V=>T("locationType",V.target.value),children:[i.jsx("option",{value:"",children:"Select"}),i.jsx("option",{children:"Physical"}),i.jsx("option",{children:"Virtual"}),i.jsx("option",{children:"Hybrid"})]})})]})]}),(c.locationType==="Physical"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:A("venue"),children:[i.jsx(ur,{text:"Venue / Address"}),i.jsx("input",{style:{...Qr,...A("venue")?{borderColor:"var(--destructive)"}:{}},value:c.venue,onChange:V=>T("venue",V.target.value)})]}),(c.locationType==="Virtual"||c.locationType==="Hybrid")&&i.jsxs(lr,{error:A("virtualLink"),children:[i.jsx(ur,{text:"Virtual link"}),i.jsx("input",{style:{...Qr,...A("virtualLink")?{borderColor:"var(--destructive)"}:{}},placeholder:"https://…",value:c.virtualLink,onChange:V=>T("virtualLink",V.target.value)})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:A("startDate"),children:[i.jsx(ur,{text:"Start Date"}),i.jsx("input",{type:"date",style:{...Qr,...A("startDate")?{borderColor:"var(--destructive)"}:{}},value:c.startDate,onChange:V=>T("startDate",V.target.value)})]}),i.jsxs(lr,{error:A("endDate"),children:[i.jsx(ur,{text:"End Date"}),i.jsx("input",{type:"date",style:{...Qr,...A("endDate")?{borderColor:"var(--destructive)"}:{}},value:c.endDate,onChange:V=>T("endDate",V.target.value)})]})]})]}),i.jsxs(Tf,{n:3,title:"Media & Tags",subtitle:"Logo, banner, and tags",open:o===3,completed:s.has(3),onToggle:()=>P(3),onNext:()=>X(3),nextLabel:"Continue to Registration & Form Fields",nextDisabled:b,children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Key People (tags)"}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx(pi,{size:13,style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}}),i.jsx("input",{style:{...Qr,paddingLeft:"30px"},placeholder:"Comma-separated",value:c.keyPeople,onChange:V=>T("keyPeople",V.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Event Logo"}),i.jsx(l2,{label:"logo",preview:c.eventLogo,error:A("eventLogo"),inputRef:j,onFile:V=>{T("eventLogo",V),m(D=>{const z={...D};return delete z.eventLogo,z})}})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Banner Image"}),i.jsx(l2,{label:"banner",preview:c.eventBanner,error:A("eventBanner"),inputRef:_,onFile:V=>{T("eventBanner",V),m(D=>{const z={...D};return delete z.eventBanner,z})}})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Feedback"}),i.jsx(Af,{name:"enableFeedback",value:c.enableFeedback,onChange:V=>T("enableFeedback",V),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Enable Ratings"}),i.jsx(Af,{name:"enableRatings",value:c.enableRatings,onChange:V=>T("enableRatings",V),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]})]})]}),i.jsxs(Tf,{n:4,title:"Registration & Form Fields",subtitle:"Registration rules and custom registration fields",open:o===4,completed:s.has(4),onToggle:()=>P(4),onNext:()=>void $(),nextLabel:"Save settings",nextDisabled:b,children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Registration settings"}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Required"}),i.jsx(Af,{name:"regRequired",value:c.registrationRequired,onChange:V=>T("registrationRequired",V),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{error:A("registrationMode"),children:[i.jsx(ur,{text:"Registration Mode"}),i.jsx(Wa,{children:i.jsxs("select",{style:{...Ba,...A("registrationMode")?{borderColor:"var(--destructive)"}:{}},value:c.registrationMode,onChange:V=>T("registrationMode",V.target.value),disabled:c.registrationRequired!=="Yes",children:[i.jsx("option",{value:"",children:c.registrationRequired==="Yes"?"Select mode":"N/A"}),i.jsx("option",{children:"Open"}),i.jsx("option",{children:"Invite Only"}),i.jsx("option",{children:"Approval Required"})]})})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{children:[i.jsx(ur,{text:"Verify Email"}),i.jsx(Af,{name:"verifyEmail",value:c.verifyEmail,onChange:V=>T("verifyEmail",V),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(lr,{children:[i.jsx(ur,{text:"Registration Deadline"}),i.jsx("input",{type:"date",style:Qr,value:c.registrationDeadline,onChange:V=>T("registrationDeadline",V.target.value)})]})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:A("authenticationType"),children:[i.jsx(ur,{text:"Authentication Type"}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...A("authenticationType")?{borderColor:"var(--destructive)"}:{}},value:c.authenticationType,onChange:V=>T("authenticationType",V.target.value),disabled:c.registrationRequired!=="Yes",children:NT.map(V=>i.jsx("option",{value:V.value,children:V.label},V.value))})})]}),i.jsxs(lr,{error:A("registrationBaseFields"),children:[i.jsx(ur,{text:"Registration Base Fields"}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...A("registrationBaseFields")?{borderColor:"var(--destructive)"}:{}},value:c.registrationBaseFields,onChange:V=>T("registrationBaseFields",V.target.value),disabled:c.registrationRequired!=="Yes",children:RT.map(V=>i.jsx("option",{value:V.value,children:V.label},V.value))})})]})]}),i.jsxs("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"12px",marginTop:"4px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 10px",fontFamily:"var(--font-noto-sans)"},children:"Custom registration fields (optional)"}),c.customFields.map((V,D)=>i.jsxs("div",{style:{background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"12px",marginBottom:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"10px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-noto-sans)"},children:["Field ",D+1]}),i.jsx("button",{type:"button",onClick:()=>O(V.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--destructive)"},children:i.jsx(Xr,{size:14})})]}),i.jsxs(No,{children:[i.jsxs(lr,{error:A(`cf_${V.id}_label`),children:[i.jsx(ur,{text:"Field Label"}),i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_label`)?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dietary preference",value:V.label,onChange:z=>C(V.id,z.target.value)})]}),i.jsxs(lr,{error:A(`cf_${V.id}_code`),children:[i.jsx(ur,{text:"Field Code"}),i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_code`)?{borderColor:"var(--destructive)"}:{},opacity:V.codeAuto?.92:1},placeholder:"auto from label",value:V.code||(V.codeAuto?Ch(V.label):""),onChange:z=>I(V.id,z.target.value)}),i.jsx("p",{style:{fontSize:"10px",color:"var(--muted)",margin:"4px 0 0"},children:"Auto-updates from label until you edit it."})]})]}),i.jsxs(lr,{error:A(`cf_${V.id}_type`),children:[i.jsx(ur,{text:"Field Type"}),i.jsx(Wa,{children:i.jsx("select",{style:{...Ba,...A(`cf_${V.id}_type`)?{borderColor:"var(--destructive)"}:{}},value:V.fieldType,onChange:z=>R(V.id,z.target.value),children:OT.map(z=>i.jsx("option",{value:z.value,children:z.label},z.value))})})]}),sc(V.fieldType)&&i.jsxs("div",{style:{marginTop:"10px"},children:[i.jsx(ur,{text:"Options (Value & Label)"}),A(`cf_${V.id}_options`)&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 6px"},children:A(`cf_${V.id}_options`)}),V.options.map(z=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr auto",gap:"8px",alignItems:"start",marginBottom:"8px"},children:[i.jsx(lr,{error:A(`cf_${V.id}_opt_${z.id}`),children:i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_opt_${z.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Value",value:z.value,onChange:q=>Y(V.id,z.id,"value",q.target.value)})}),i.jsx(lr,{error:A(`cf_${V.id}_opt_${z.id}`),children:i.jsx("input",{style:{...Qr,...A(`cf_${V.id}_opt_${z.id}`)?{borderColor:"var(--destructive)"}:{}},placeholder:"Label",value:z.label,onChange:q=>Y(V.id,z.id,"label",q.target.value)})}),i.jsx("button",{type:"button",onClick:()=>M(V.id,z.id),style:{padding:"8px",border:"none",background:"transparent",cursor:"pointer",color:"var(--destructive)",marginTop:"4px"},"aria-label":"Remove option",children:i.jsx(Xr,{size:14})})]},z.id)),i.jsxs("button",{type:"button",onClick:()=>F(V.id),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",background:"var(--card)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(gr,{size:12})," Add option"]})]})]},V.id)),i.jsxs("button",{type:"button",onClick:N,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"var(--secondary)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add custom field"]})]})]})]})]})}function UPe(e,t){return hS(e,t)}function HPe(e){const t=e.activityStats;if(!t)return 0;const r=Math.min(t.questionCount*12,35),n=Math.min(t.participantCount*6,35),o=Math.min(t.responseCount*3,30);return Math.min(100,Math.round(r+n+o))}function VPe(){var F,M,Y,X;const{selectedEventId:e,setActiveNav:t}=Li(),n=Si()==="mobile",[o,a]=S.useState(null),[s,l]=S.useState(null),[c,u]=S.useState(!0),[d,f]=S.useState(null),[h,p]=S.useState("questions"),[v,m]=S.useState(!1),[b,x]=S.useState(!1),[w,k]=S.useState(null),j=S.useCallback(async()=>{var $;if(e){u(!0),f(null);try{const[ee,V]=await Promise.all([Lr.get(e),ta.list(e)]);if(ee.error||!ee.data){f(ee.error||"Could not load activity."),a(null),l(null);return}const D=ee.data;a(D);const q=((($=V.data)==null?void 0:$.sessions)??[])[0]??null;l(q)}finally{u(!1)}}},[e]);S.useEffect(()=>{j()},[j]);const _=s?Of(s):!0,T=s?ph(s):!0,A=S.useMemo(()=>{const $=[];return _&&$.push({id:"questions",label:"Questions"}),T&&$.push({id:"quiz-polls",label:"Quiz & Polls"}),$.push({id:"participants",label:"Participants"},{id:"settings",label:"Settings"}),$},[_,T]);S.useEffect(()=>{var $;A.some(ee=>ee.id===h)||p((($=A[0])==null?void 0:$.id)??"participants")},[A,h]),o&&HPe(o);const P=s?Of(s):!0,N=s?ph(s):!0;o!=null&&o.activitySubtype;const O=async()=>{if(!(!s||b)){x(!0);try{(await ta.update(s._id,{...mx(s),enableQnA:!0,enableQnP:ph(s)})).error||await j()}finally{x(!1)}}},C=S.useCallback(async()=>{if(!s||ph(s))return;(await ta.update(s._id,{...mx(s),enableQnP:!0,enableQnA:Of(s)})).error||await j()},[s,j]),I=S.useMemo(()=>{var ee;if(!w||!o)return;const $=qT();return $.title=(ee=o.name)!=null&&ee.trim()?o.name.trim().slice(0,200):w==="quiz"?"New quiz":"New poll",{form:$,questions:[]}},[w,o]),R=async $=>{if(!e||!s||!w)return;const ee=w,V={session:s._id,title:$.form.title,type:ee,description:$.form.description||void 0,questions:$.questions.map(q=>UPe(q,ee)),settings:gS($.form,ee)};if((await Pi.create(e,V)).error)return;k(null),(await ta.update(s._id,{...mx(s),enableQnP:!0,enableQnA:Of(s)})).error||await j()};return e?c&&!o?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading activity…"}):d||!o||!s?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,alignItems:"center",padding:40},children:[i.jsx("p",{style:{color:"#b91c1c",fontFamily:"var(--font-noto-sans)"},children:d||"This activity has no session yet."}),i.jsx("button",{type:"button",onClick:()=>t("activities"),style:{padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Back to activities"})]}):o.recordKind&&o.recordKind!=="activity"?i.jsx("div",{style:{padding:24,fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"This view is for standalone activities. Use the main event dashboard for conference-style events."}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"16px",flexWrap:"wrap"},children:[i.jsx("div",{style:{flex:1,minWidth:0},children:i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:n?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:o.name})}),i.jsxs("button",{type:"button",disabled:!((F=s.joinCode)!=null&&F.trim()),title:(M=s.joinCode)!=null&&M.trim()?"QR code":"Join code not available yet",onClick:()=>m(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:n?"8px 12px":"6px 14px",borderRadius:"var(--radius-button)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:(Y=s.joinCode)!=null&&Y.trim()?"pointer":"not-allowed",flexShrink:0,opacity:(X=s.joinCode)!=null&&X.trim()?1:.55,transition:"all 0.15s"},onMouseEnter:$=>{var V;if(!((V=s.joinCode)!=null&&V.trim()))return;const ee=$.currentTarget;ee.style.background="var(--secondary)",ee.style.borderColor="var(--primary)",ee.style.color="var(--primary)"},onMouseLeave:$=>{var V;if(!((V=s.joinCode)!=null&&V.trim()))return;const ee=$.currentTarget;ee.style.background="var(--card)",ee.style.borderColor="var(--border)",ee.style.color="var(--card-foreground)"},children:[i.jsx(Zf,{size:n?18:15,"aria-hidden":!0}),"Generate QR Code"]})]}),i.jsx("div",{style:{borderBottom:"1px solid var(--border)"},children:i.jsx("div",{style:{display:"flex",gap:n?"8px":"0",flexWrap:"wrap"},children:A.map($=>i.jsx("button",{type:"button",onClick:()=>p($.id),style:{padding:n?"10px 16px":"12px 24px",background:"none",border:"none",borderBottom:h===$.id?"2px solid var(--primary)":"2px solid transparent",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:h===$.id?"var(--font-weight-medium)":"var(--font-weight-normal)",color:h===$.id?"var(--primary)":"var(--card-foreground)",transition:"all 0.15s"},children:$.label},$.id))})}),i.jsxs("div",{style:{minHeight:"240px"},children:[h==="questions"&&_?i.jsx(FX,{fixedSessionId:s._id,compactChrome:!0}):null,h==="quiz-polls"&&T?i.jsx(qPe,{fixedSessionId:s._id,compactChrome:!0,onQuizPollPersisted:C}):null,h==="participants"?i.jsx(VG,{compactChrome:!0}):null,h==="settings"?i.jsx("div",{style:{padding:"20px"},children:i.jsx($Pe,{event:o,session:s,selectedEventId:e,onSaved:j})}):null]}),!P||!N?i.jsxs("div",{style:{paddingTop:"16px",borderTop:"1px solid var(--border)"},children:[i.jsx("h2",{style:{fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:"Next steps"}),P?null:i.jsxs("div",{style:{marginBottom:N?0:"24px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px",lineHeight:1.5},children:"Turn on Q&A to collect and moderate audience questions for this session. This will show the Questions tab."}),i.jsx("button",{type:"button",disabled:b,onClick:()=>void O(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"14px 32px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:b?"wait":"pointer",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:b?.85:1},children:b?"Enabling…":"Enable Q&A"})]}),N?null:i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 16px",lineHeight:1.5},children:"Add a quiz or add a poll to engage your audience. Saving either one will enable the Quiz & Polls tab for this session."}),i.jsxs("div",{style:{display:"flex",gap:"16px",flexWrap:"wrap"},children:[i.jsx("button",{type:"button",onClick:()=>k("quiz"),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"14px 32px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flex:n?"1 1 100%":"0 1 auto"},children:"Add a quiz"}),i.jsx("button",{type:"button",onClick:()=>k("poll"),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:"14px 32px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flex:n?"1 1 100%":"0 1 auto"},children:"Add a poll"})]})]})]}):null,w&&I?i.jsx(Ax,{kind:w,initial:I,eventId:e,onClose:()=>k(null),onSave:$=>void R($)},w):null,i.jsx(FT,{open:v,onClose:()=>m(!1),kind:"session",joinCode:s.joinCode??"",label:s.title||o.name})]}):i.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Select an activity from the list to view details."})}const aI=["Moderator","Presenter","Co-organiser","Viewer"];function MX(e,t,r){return e||t?[e==null?void 0:e[0],t==null?void 0:t[0]].filter(Boolean).join("").toUpperCase().slice(0,2):r?r.slice(0,2).toUpperCase():"??"}const G9=["#f97316","#16a34a","#7c3aed","#0891b2","#be185d","#0d9488"];function D6(e){let t=0;for(let r=0;r<e.length;r++)t+=e.charCodeAt(r);return G9[t%G9.length]}function RE({checked:e,onChange:t}){return i.jsxs("button",{type:"button",onClick:t,style:{width:16,height:16,borderRadius:3,border:`1.5px solid ${e?"var(--primary)":"var(--border)"}`,background:e===!0?"var(--primary)":"var(--card)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",flexShrink:0,padding:0},children:[e===!0&&i.jsx(bi,{size:10,strokeWidth:3,color:"#fff"}),e==="indeterminate"&&i.jsx(oS,{size:10,strokeWidth:3,color:"var(--primary)"})]})}function B6({initials:e,color:t,size:r=34}){return i.jsx("div",{style:{width:r,height:r,borderRadius:"50%",background:t,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:r<30?9:11,fontFamily:"var(--font-inter)",fontWeight:600},children:e})})}function pj(e){return e.flatMap(t=>t.sessions.map(r=>r.sessionId))}function sI({tracks:e,selected:t,onToggle:r,onSelectGroup:n,onSelectAll:o}){const a=S.useMemo(()=>pj(e),[e]),s=c=>{const u=c.filter(d=>t.has(d)).length;return u===0?!1:u===c.length?!0:"indeterminate"},l=s(a);return a.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No tracks or sessions for this event. Add them in Agenda first."}):i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Session access"}),i.jsxs("div",{style:{display:"flex",gap:6},children:[i.jsxs("button",{type:"button",onClick:()=>o(!0),style:{display:"flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"var(--primary)",color:"#fff",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(bi,{size:11})," Select all"]}),i.jsxs("button",{type:"button",onClick:()=>o(!1),style:{display:"flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(oS,{size:11})," Clear"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 0",marginBottom:10,borderBottom:"1px solid var(--border)"},children:[i.jsx(RE,{checked:l,onChange:()=>o(l!==!0)}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontWeight:600},children:[t.size," of ",a.length," sessions"]})]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:e.map((c,u)=>{const d=c.sessions.map(h=>h.sessionId),f=s(d);return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:[i.jsx(RE,{checked:f,onChange:()=>n(d,f!==!0)}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontWeight:600,color:"var(--foreground)"},children:c.name||"Unassigned"}),i.jsxs("span",{style:{fontSize:11,color:"var(--muted)"},children:[d.filter(h=>t.has(h)).length,"/",d.length]})]}),c.sessions.map(h=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px 8px 38px",background:"var(--card)",borderBottom:"1px solid var(--border)"},children:[i.jsx(RE,{checked:t.has(h.sessionId),onChange:()=>r(h.sessionId)}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",color:"var(--card-foreground)"},children:h.title}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:h.startTime?new Date(h.startTime).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):""})]},h.sessionId))]},c.trackId??u)})})]})}function YPe({eventId:e,onClose:t,onSuccess:r}){const[n,o]=S.useState("users"),[a,s]=S.useState([]),[l,c]=S.useState([]),[u,d]=S.useState(!0),[f,h]=S.useState(!1),[p,v]=S.useState(null),[m,b]=S.useState(new Set),[x,w]=S.useState("Viewer"),[k,j]=S.useState(new Set),_=S.useMemo(()=>pj(l),[l]);S.useEffect(()=>{let I=!1;return d(!0),Promise.all([wa.listAvailableUsers(e),wa.agendaTree(e)]).then(([R,F])=>{var M,Y;I||(d(!1),(M=R.data)!=null&&M.users&&s(R.data.users),(Y=F.data)!=null&&Y.tracks&&c(F.data.tracks))}),()=>{I=!0}},[e]);const T=I=>{b(R=>{const F=new Set(R);return F.has(I)?F.delete(I):F.add(I),F})},A=I=>{j(R=>{const F=new Set(R);return F.has(I)?F.delete(I):F.add(I),F})},P=(I,R)=>{j(F=>{const M=new Set(F);return I.forEach(Y=>R?M.add(Y):M.delete(Y)),M})},N=I=>j(I?new Set(_):new Set),O=m.size>0&&x,C=async()=>{v(null),h(!0);const I=await wa.addStaff(e,{userIds:Array.from(m),sessionIds:Array.from(k),eventRole:x});if(h(!1),I.error){v(I.error);return}r(),t()};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24,backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:560,maxHeight:"88vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:2},children:"Add users to event"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Select organisation members and their session access."})]}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:2},children:i.jsx(Gt,{size:16})})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["users","sessions"].map((I,R)=>i.jsxs("button",{type:"button",onClick:()=>o(I),style:{padding:"10px 0",marginRight:24,background:"none",border:"none",borderBottom:`2px solid ${n===I?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:n===I?600:400,color:n===I?"var(--primary)":"var(--muted)"},children:[i.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:"50%",background:n===I?"var(--primary)":"var(--border)",color:"#fff",fontSize:10,marginRight:6},children:R+1}),I==="users"?"Users & role":"Session access"]},I))}),i.jsx("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:u?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):n==="users"?i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:8},children:"Event role (applies to all selected)"}),i.jsx("div",{style:{marginBottom:16},children:i.jsx("select",{value:x,onChange:I=>w(I.target.value),style:{width:"100%",maxWidth:200,height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:aI.map(I=>i.jsx("option",{value:I,children:I},I))})}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:10},children:"Select users"}),a.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No other users available; they may already be on this event."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map(I=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:10,background:"var(--secondary)",borderRadius:"var(--radius-button)",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:m.has(I._id),onChange:()=>T(I._id)}),i.jsx(B6,{initials:MX(I.firstName,I.lastName,I.email),color:D6(I.email),size:28}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontWeight:500},children:[I.firstName,I.lastName].filter(Boolean).join(" ")||I.email}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:I.email})]},I._id))})]}):i.jsx(sI,{tracks:l,selected:k,onToggle:A,onSelectGroup:P,onSelectAll:N})}),p&&i.jsx("div",{style:{padding:"8px 24px",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)"},children:p}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("div",{children:n==="sessions"&&i.jsx("button",{type:"button",onClick:()=>o("users"),style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"← Back"})}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Cancel"}),n==="users"?i.jsx("button",{type:"button",onClick:()=>o("sessions"),disabled:!O,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:O?"var(--primary)":"var(--border)",color:O?"var(--primary-foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontWeight:600,cursor:O?"pointer":"not-allowed"},children:"Next: Session access →"}):i.jsx("button",{type:"button",onClick:C,disabled:f,style:{display:"flex",alignItems:"center",gap:6,padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontWeight:600,cursor:f?"wait":"pointer"},children:f?"Adding…":"Add to event"})]})]})]})})}function GPe({eventId:e,onClose:t,onSuccess:r}){const[n,o]=S.useState([{id:"r1",email:"",role:"Viewer"}]),[a,s]=S.useState("users"),[l,c]=S.useState([]),[u,d]=S.useState(new Set),[f,h]=S.useState(!1),[p,v]=S.useState(!1),[m,b]=S.useState(null),x=S.useMemo(()=>pj(l),[l]);S.useEffect(()=>{a==="sessions"&&(h(!0),wa.agendaTree(e).then(C=>{var I;h(!1),(I=C.data)!=null&&I.tracks&&c(C.data.tracks)}))},[e,a]);const w=()=>o(C=>[...C,{id:`r${Date.now()}`,email:"",role:"Viewer"}]),k=C=>o(I=>I.filter(R=>R.id!==C)),j=(C,I,R)=>o(F=>F.map(M=>M.id===C?{...M,[I]:R}:M)),_=C=>d(I=>{const R=new Set(I);return R.has(C)?R.delete(C):R.add(C),R}),T=(C,I)=>d(R=>{const F=new Set(R);return C.forEach(M=>I?F.add(M):F.delete(M)),F}),A=C=>d(C?new Set(x):new Set),P=n.filter(C=>C.email.trim()&&C.role),N=P.length>0,O=async()=>{var I;b(null),v(!0);const C=await wa.sendInvites(e,{invites:P.map(R=>({email:R.email.trim(),eventRole:R.role||"Viewer"})),sessionIds:Array.from(u)});v(!1),C.data&&b(C.data),!(C.error&&!C.data)&&C.data&&(C.data.sent>0||((I=C.data.errors)==null?void 0:I.length)===0)&&(r(),t())};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24,backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:680,maxHeight:"88vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:2},children:"Invite by email"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"They will receive an email to join this event (and organisation if new)."})]}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:2},children:i.jsx(Gt,{size:16})})]}),i.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border)",padding:"0 24px"},children:["users","sessions"].map((C,I)=>i.jsxs("button",{type:"button",onClick:()=>s(C),style:{padding:"10px 0",marginRight:24,background:"none",border:"none",borderBottom:`2px solid ${a===C?"var(--primary)":"transparent"}`,cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:a===C?600:400,color:a===C?"var(--primary)":"var(--muted)"},children:[i.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:"50%",background:a===C?"var(--primary)":"var(--border)",color:"#fff",fontSize:10,marginRight:6},children:I+1}),C==="users"?"Emails & roles":"Session access"]},C))}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:[a==="users"&&i.jsxs("div",{children:[i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,marginBottom:16},children:n.map(C=>i.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-start",background:"var(--secondary)",borderRadius:"var(--radius-card)",padding:14},children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",marginBottom:5},children:["Email ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("input",{type:"email",placeholder:"user@example.com",value:C.email,onChange:I=>j(C.id,"email",I.target.value),style:{width:"100%",height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{style:{width:160},children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",marginBottom:5},children:["Role ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})]}),i.jsx("select",{value:C.role,onChange:I=>j(C.id,"role",I.target.value),style:{width:"100%",height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:aI.map(I=>i.jsx("option",{value:I,children:I},I))})]}),n.length>1&&i.jsx("button",{type:"button",onClick:()=>k(C.id),style:{width:36,height:36,marginTop:18,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:12})})]},C.id))}),i.jsxs("button",{type:"button",onClick:w,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",fontSize:"var(--text-sm)",cursor:"pointer"},children:[i.jsx(yT,{size:13})," Add another"]})]}),a==="sessions"&&(f?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(sI,{tracks:l,selected:u,onToggle:_,onSelectGroup:T,onSelectAll:A}))]}),(m==null?void 0:m.errors)&&m.errors.length>0&&i.jsx("div",{style:{padding:"8px 24px",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)"},children:m.errors.map((C,I)=>i.jsxs("div",{children:[C.email,": ",C.message]},I))}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("div",{children:a==="sessions"&&i.jsx("button",{type:"button",onClick:()=>s("users"),style:{background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"← Back"})}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Cancel"}),a==="users"?i.jsx("button",{type:"button",onClick:()=>s("sessions"),disabled:!N,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:N?"var(--primary)":"var(--border)",color:N?"var(--primary-foreground)":"var(--muted)",fontSize:"var(--text-sm)",fontWeight:600,cursor:N?"pointer":"not-allowed"},children:"Next: Session access →"}):i.jsxs("button",{type:"button",onClick:O,disabled:p,style:{display:"flex",alignItems:"center",gap:6,padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontWeight:600,cursor:p?"wait":"pointer"},children:[i.jsx(b$,{size:13})," Send invitations"]})]})]})]})})}function KPe({eventId:e,member:t,onClose:r,onSuccess:n}){const[o,a]=S.useState([]),[s,l]=S.useState(!0),[c,u]=S.useState(!1),[d,f]=S.useState(new Set(t.sessionIds)),[h,p]=S.useState(t.eventRole||"Viewer"),v=S.useMemo(()=>pj(o),[o]);S.useEffect(()=>{wa.agendaTree(e).then(k=>{var j;l(!1),(j=k.data)!=null&&j.tracks&&a(k.data.tracks)})},[e]);const m=k=>f(j=>{const _=new Set(j);return _.has(k)?_.delete(k):_.add(k),_}),b=(k,j)=>f(_=>{const T=new Set(_);return k.forEach(A=>j?T.add(A):T.delete(A)),T}),x=k=>f(k?new Set(v):new Set),w=async()=>{u(!0);const k=await wa.updateStaff(e,t.userId,{sessionIds:Array.from(d),eventRole:h});u(!1),k.error||(n(),r())};return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:24,backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:520,maxHeight:"88vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:600,color:"var(--foreground)",marginBottom:2},children:"Edit access"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:[t.firstName,t.lastName].filter(Boolean).join(" ")||t.email})]}),i.jsx("button",{type:"button",onClick:r,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",padding:2},children:i.jsx(Gt,{size:16})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px"},children:[i.jsxs("div",{style:{marginBottom:16},children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",display:"block",marginBottom:6},children:"Event role"}),i.jsx("select",{value:h,onChange:k=>p(k.target.value),style:{width:"100%",maxWidth:200,height:36,padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-sm)"},children:aI.map(k=>i.jsx("option",{value:k,children:k},k))})]}),s?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading sessions…"}):i.jsx(sI,{tracks:o,selected:d,onToggle:m,onSelectGroup:b,onSelectAll:x})]}),i.jsxs("div",{style:{padding:"14px 24px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:8},children:[i.jsx("button",{type:"button",onClick:r,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:w,disabled:c,style:{padding:"8px 18px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"var(--text-sm)",fontWeight:600,cursor:c?"wait":"pointer"},children:c?"Saving…":"Save"})]})]})})}function QPe(){const{selectedEventId:e,permissionsOpenAddOnce:t,setPermissionsOpenAddOnce:r}=Li(),[n,o]=S.useState(null),[a,s]=S.useState([]),[l,c]=S.useState([]),[u,d]=S.useState(!0),[f,h]=S.useState(!1),[p,v]=S.useState(""),[m,b]=S.useState(null),[x,w]=S.useState(!1),[k,j]=S.useState(!1),[_,T]=S.useState(!1),[A,P]=S.useState(null),N=async()=>{var X;if(!e){d(!1),s([]),c([]),o(null);return}d(!0),h(!1);const[M,Y]=await Promise.all([Lr.get(e),wa.listStaff(e)]);if(d(!1),(X=M.data)!=null&&X.name&&o(M.data.name),Y.error){Y.status===403&&h(!0);return}Y.data&&(s(Y.data.members??[]),c(Y.data.invites??[]))};S.useEffect(()=>{N()},[e]),S.useEffect(()=>{t&&(j(!0),r(!1))},[t,r]);const O=S.useMemo(()=>{if(!p.trim())return a;const M=p.toLowerCase();return a.filter(Y=>Y.email.toLowerCase().includes(M)||[Y.firstName,Y.lastName].filter(Boolean).join(" ").toLowerCase().includes(M))},[a,p]),C=S.useMemo(()=>p.trim()?l.filter(M=>M.email.toLowerCase().includes(p.toLowerCase())):l,[l,p]),I=async M=>{if(!e||!confirm("Remove this user from the event?"))return;(await wa.removeStaff(e,M)).error||N()},R=async M=>{e&&(await wa.resendInvite(e,M),N())},F=async M=>{if(!e||!confirm("Cancel this invitation?"))return;(await wa.cancelInvite(e,M)).error||N()};return e?f?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(fd,{size:40,style:{color:"var(--destructive)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"You don’t have permission to manage this event’s team."})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:4},children:n??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:600,color:"var(--foreground)",lineHeight:1.2,marginBottom:6},children:"Users & Permissions"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:[a.length," member",a.length!==1?"s":""," · ",l.length," pending invite",l.length!==1?"s":""]})]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{type:"button",onClick:()=>j(!0),style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",fontSize:"var(--text-sm)",fontWeight:600,cursor:"pointer"},children:[i.jsx(Ri,{size:14})," Add users"]}),i.jsxs("button",{type:"button",onClick:()=>T(!0),style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontWeight:600},children:[i.jsx(yT,{size:14})," Invite by email"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,height:38,padding:"0 12px",background:"var(--card)",border:`1px solid ${x?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",maxWidth:380},children:[i.jsx(pi,{size:14,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:p,onChange:M=>v(M.target.value),placeholder:"Search by name or email…",onFocus:()=>w(!0),onBlur:()=>w(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),p&&i.jsx("button",{type:"button",onClick:()=>v(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{size:12})})]}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"minmax(160px,1fr) minmax(200px,1.5fr) 110px 160px",padding:"9px 20px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["User","Email","Access",""].map(M=>i.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:M},M))}),u?i.jsx("div",{style:{padding:48,textAlign:"center",color:"var(--muted)"},children:"Loading…"}):O.length===0&&C.length===0?i.jsxs("div",{style:{padding:"48px 20px",textAlign:"center"},children:[i.jsx(fd,{size:28,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No users or invites match your search."})]}):i.jsxs(i.Fragment,{children:[O.map(M=>i.jsxs("div",{onMouseEnter:()=>b(M.userId),onMouseLeave:()=>b(null),style:{display:"grid",gridTemplateColumns:"minmax(160px,1fr) minmax(200px,1.5fr) 110px 160px",alignItems:"center",padding:"13px 20px",borderBottom:"1px solid var(--border)",background:m===M.userId?"var(--secondary)":"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(B6,{initials:MX(M.firstName,M.lastName,M.email),color:D6(M.email)}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:[M.firstName,M.lastName].filter(Boolean).join(" ")||M.email})]}),i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:M.email}),i.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,width:"fit-content",background:"#e0e7ff",color:"#3730a3",fontSize:11,fontWeight:600},children:M.eventRole||"Viewer"}),i.jsxs("div",{style:{display:"flex",gap:6,opacity:m===M.userId?1:0},children:[i.jsxs("button",{type:"button",onClick:()=>P(M),style:{display:"flex",alignItems:"center",gap:4,padding:"5px 11px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(wi,{size:12})," Edit"]}),i.jsx("button",{type:"button",onClick:()=>I(M.userId),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(Xr,{size:12})})]})]},M.userId)),C.map(M=>i.jsxs("div",{onMouseEnter:()=>b(`inv-${M.id}`),onMouseLeave:()=>b(null),style:{display:"grid",gridTemplateColumns:"minmax(160px,1fr) minmax(200px,1.5fr) 110px 160px",alignItems:"center",padding:"13px 20px",borderBottom:"1px solid var(--border)",background:m===`inv-${M.id}`?"var(--secondary)":"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(B6,{initials:M.email.slice(0,2).toUpperCase(),color:D6(M.email)}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:M.email})]}),i.jsx("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Pending invite"}),i.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,width:"fit-content",background:"#fef9c3",color:"#92400e",fontSize:11,fontWeight:600},children:M.eventRole}),i.jsxs("div",{style:{display:"flex",gap:6,opacity:m===`inv-${M.id}`?1:0},children:[i.jsxs("button",{type:"button",onClick:()=>R(M.id),style:{display:"flex",alignItems:"center",gap:4,padding:"5px 11px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",cursor:"pointer"},children:[i.jsx(b$,{size:12})," Resend"]}),i.jsx("button",{type:"button",onClick:()=>F(M.id),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(Xr,{size:12})})]})]},M.id))]})]}),k&&e&&i.jsx(YPe,{eventId:e,onClose:()=>j(!1),onSuccess:N}),_&&e&&i.jsx(GPe,{eventId:e,onClose:()=>T(!1),onSuccess:N}),A&&e&&i.jsx(KPe,{eventId:e,member:A,onClose:()=>P(null),onSuccess:N})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24,alignItems:"center",justifyContent:"center",minHeight:280},children:[i.jsx(fd,{size:40,style:{color:"var(--border)"}}),i.jsx("p",{style:{fontSize:"var(--text-base)",color:"var(--muted)"},children:"Select an event to manage users and permissions."})]})}function yh(e){const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim();return t||(e.email?e.email:"Participant")}function XPe({top3:e}){const[t,r,n]=[e[0],e[1],e[2]],o=[r,t,n],a=[72,100,56],s=["🥈","🥇","🥉"],l=["#475569","#92400e","#c2410c"],c=["#f1f5f9","#fef3c7","#ffedd5"];return!t&&!r&&!n?i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"24px 20px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:"No leaderboard entries yet. Configure point rules and let attendees earn points."}):i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"24px 20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"24px"},children:[i.jsx(nu,{size:15,style:{color:"#d97706"}}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Top performers"})]}),i.jsx("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"center",gap:"8px",height:"200px"},children:o.map((u,d)=>u?i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flex:1,maxWidth:"180px"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"10px",flex:1,justifyContent:"flex-end"},children:[i.jsx("span",{style:{fontSize:"20px",marginBottom:"4px"},children:s[d]}),i.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"50%",background:d===1?"var(--primary)":"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid var(--border)",marginBottom:"5px"},children:i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-inter)",fontWeight:"600",color:d===1?"#fff":"var(--foreground)"},children:yh(u).slice(0,2).toUpperCase()})}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-xs)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",textAlign:"center",lineHeight:"1.3",maxWidth:"120px"},children:yh(u)}),i.jsxs("p",{style:{display:"inline-flex",marginTop:"4px",padding:"2px 8px",borderRadius:"999px",background:c[d],color:l[d],fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:[u.total," pts"]})]}),i.jsx("div",{style:{width:"100%",height:a[d],background:d===1?"var(--accent)":"var(--secondary)",borderRadius:"4px 4px 0 0",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",borderBottom:"none"},children:i.jsxs("span",{style:{fontSize:"var(--text-base)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:d===1?"var(--primary)":"var(--muted)"},children:["#",d===0?2:d===1?1:3]})})]},u.participantId+d):i.jsx("div",{style:{flex:1,maxWidth:"180px"}},`empty-${d}`))}),i.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"0 0 4px 4px"}})]})}function ZPe({row:e,onClose:t,onSubmit:r,loading:n}){const[o,a]=S.useState(5),[s,l]=S.useState("");return i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(15,48,114,0.25)",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",backdropFilter:"blur(2px)"},children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:"380px",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Add points"}),i.jsx("button",{type:"button",onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex"},children:i.jsx(Gt,{size:15})})]}),i.jsxs("div",{style:{padding:"18px 20px",display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs("div",{style:{background:"var(--secondary)",borderRadius:"var(--radius-button)",padding:"10px 14px",display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:yh(e).slice(0,2).toUpperCase()})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:yh(e)}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Net ",e.total," pts"]})]})]}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",marginBottom:"5px"},children:"Points to add"}),i.jsx("input",{type:"number",min:1,value:o,onChange:c=>a(Number(c.target.value)),style:{width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"}})]}),i.jsxs("div",{children:[i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",marginBottom:"5px"},children:["Reason ",i.jsx("span",{style:{color:"var(--muted)"},children:"(optional)"})]}),i.jsx("input",{type:"text",value:s,onChange:c=>l(c.target.value),placeholder:"e.g. Best question award",style:{width:"100%",height:"36px",padding:"0 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)",outline:"none",boxSizing:"border-box"}})]})]}),i.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--border)",display:"flex",justifyContent:"flex-end",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:t,style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Cancel"}),i.jsxs("button",{type:"button",disabled:n,onClick:()=>r(o,s.trim()),style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:n?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add ",o," pts"]})]})]})})}function JPe({eventId:e}){var N;const[t,r]=S.useState(null),[n,o]=S.useState(null),[a,s]=S.useState([]),[l,c]=S.useState(null),[u,d]=S.useState(!1),[f,h]=S.useState(!1),[p,v]=S.useState(""),[m,b]=S.useState(!1),[x,w]=S.useState(null),k=S.useCallback(async()=>{var O;if(!e){o(null),s([]);return}d(!0),c(null);try{const[C,I]=await Promise.all([Lr.get(e),FO.leaderboard(e,200)]);if(C.error){c(C.error),o(null),s([]);return}o(C.data??null);const R=((O=I.data)==null?void 0:O.leaderboard)??[];if(I.error){c(I.error),s([]);return}s(R)}finally{d(!1)}},[e]);S.useEffect(()=>{k()},[k]);const j=S.useMemo(()=>{const O=p.trim().toLowerCase();return O?a.filter(C=>{const I=yh(C).toLowerCase(),R=(C.email||"").toLowerCase();return I.includes(O)||R.includes(O)}):a},[a,p]),_=j.slice(0,3),T=Math.max(((N=j[0])==null?void 0:N.total)??1,1),A=()=>{const O=[["rank","name","email","net_points"].join(",")];j.forEach((F,M)=>{const Y=yh(F).replace(/"/g,'""'),X=(F.email||"").replace(/"/g,'""');O.push(`${M+1},"${Y}","${X}",${F.total}`)});const C=new Blob([O.join(`
`)],{type:"text/csv"}),I=URL.createObjectURL(C),R=document.createElement("a");R.href=I,R.download=`reward-leaderboard-${e||"event"}.csv`,R.click(),URL.revokeObjectURL(I)},P=async(O,C)=>{if(!(!e||!t)){h(!0);try{await FO.create(e,{participant:t.participantId,points:Math.max(1,Math.floor(O)),type:"earned",source:"manual",description:C||void 0}),r(null),await k()}finally{h(!1)}}};return e?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:u?"Loading…":(n==null?void 0:n.name)??"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"Reward points"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:l?i.jsx("span",{style:{color:"var(--destructive)"},children:l}):`${a.length} on leaderboard · Net score (earned − redeemed)`})]}),i.jsx("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:i.jsxs("button",{type:"button",onClick:A,disabled:!j.length,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)",cursor:j.length?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",opacity:j.length?1:.5},children:[i.jsx(ja,{size:13})," Export CSV"]})})]}),i.jsx(XPe,{top3:_}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Rankings"}),i.jsx("div",{style:{flex:1}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 10px",background:"var(--card)",border:`1px solid ${m?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",width:"200px"},children:[i.jsx(pi,{size:11,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:p,onChange:O=>v(O.target.value),placeholder:"Search…",onFocus:()=>b(!0),onBlur:()=>b(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),p&&i.jsx("button",{type:"button",onClick:()=>v(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{size:10})})]})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"56px 1fr 1.6fr 80px 120px",padding:"8px 16px",background:"var(--card)",borderBottom:"1px solid var(--border)"},children:["Rank","Name","Email","Points",""].map(O=>i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.04em"},children:O},O))}),!j.length&&!u?i.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:"No participants with positive net points yet."}):j.map((O,C)=>{const I=C+1,R=I<=3,F=O.total/T;return i.jsxs("div",{onMouseEnter:()=>w(C),onMouseLeave:()=>w(null),style:{display:"grid",gridTemplateColumns:"56px 1fr 1.6fr 80px 120px",alignItems:"center",padding:"10px 16px",borderBottom:"1px solid var(--border)",background:x===C?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx("div",{children:I===1?i.jsx("span",{style:{fontSize:"16px"},children:"🥇"}):I===2?i.jsx("span",{style:{fontSize:"16px"},children:"🥈"}):I===3?i.jsx("span",{style:{fontSize:"16px"},children:"🥉"}):i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["#",I]})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:R?"var(--font-weight-medium)":"var(--font-weight-normal)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:yh(O)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.email??"—"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:O.total}),i.jsx("div",{style:{flex:1,height:"3px",background:"var(--border)",borderRadius:"999px",overflow:"hidden"},children:i.jsx("div",{style:{width:`${Math.round(F*100)}%`,height:"100%",background:"var(--primary)",opacity:.5,borderRadius:"999px"}})})]}),i.jsx("div",{style:{opacity:x===C?1:0,transition:"opacity 0.15s"},children:i.jsxs("button",{type:"button",onClick:()=>r(O),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"var(--radius-button)",background:"var(--card)",border:"1px solid var(--border)",color:"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",whiteSpace:"nowrap"},children:[i.jsx(gr,{size:11})," Add points"]})})]},O.participantId)})]}),t&&i.jsx(ZPe,{row:t,onClose:()=>r(null),onSubmit:P,loading:f})]}):i.jsx("div",{style:{padding:"24px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Select an event to manage reward points and the leaderboard."})}function DX(e){const t=e.cu??"INR",r=e.pa.trim(),n=e.pn.trim().slice(0,99),o=e.am.trim();return!r||!n||!o?"":`upi://pay?pa=${encodeURIComponent(r)}&pn=${encodeURIComponent(n)}&am=${encodeURIComponent(o)}&cu=${encodeURIComponent(t)}`}const Xo={fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)",textTransform:"uppercase",letterSpacing:"0.06em"};function e8e(e,t){return`${t} ${(e/100).toFixed(2)}`}const K9="__eb_payment_cancelled__";function t8e(){var je,xe;const{user:e}=Mr(),{selectedEventId:t}=Li(),r=Nn(e),[n,o]=S.useState([]),[a,s]=S.useState(!0),[l,c]=S.useState(null),[u,d]=S.useState([]),[f,h]=S.useState([]),[p,v]=S.useState(!1),[m,b]=S.useState(null),[x,w]=S.useState(!1),[k,j]=S.useState(""),[_,T]=S.useState(""),[A,P]=S.useState([""]),[N,O]=S.useState(""),[C,I]=S.useState("INR"),[R,F]=S.useState(0),[M,Y]=S.useState(""),[X,$]=S.useState(""),[ee,V]=S.useState(""),[D,z]=S.useState([]),[q,G]=S.useState(null),[U,Q]=S.useState(!1),[K,re]=S.useState(null),[H,ie]=S.useState(!1),[de,le]=S.useState(!1),[ke,ve]=S.useState(""),[se,be]=S.useState("upload"),[De,ae]=S.useState(""),[ue,Me]=S.useState(""),[Se,Pe]=S.useState(""),[Ee,Ae]=S.useState(""),[Ye,rt]=S.useState(""),[He,xt]=S.useState([]),[st,Te]=S.useState(!1),[et,Pt]=S.useState(!1),qe=(e==null?void 0:e.role)==="super_admin"||(e==null?void 0:e.role)==="admin",Et=typeof window<"u"&&t?`${window.location.origin}/event/${t}/tickets`:"",vt=S.useCallback(async()=>{var Re;if(!t||!r){o([]),s(!1);return}s(!0),c(null);try{const[ze,Le,Qe]=await Promise.all([Ky.list(t),qa.list({organization:r}),Mo.listForEvent(t)]);if(o(ze),Le.error)throw new Error(Le.error);d((((Re=Le.data)==null?void 0:Re.lists)??[]).filter(mt=>mt.type==="fixed")),h(Qe)}catch(ze){c(ze instanceof Error?ze.message:"Failed to load"),o([])}finally{s(!1)}},[t,r]);S.useEffect(()=>{vt()},[vt]);const Ft=S.useCallback(async()=>{var Re,ze;if(!t){G(null);return}Q(!0),re(null);try{const[Le,Qe]=await Promise.all([d5.get(t),Lr.get(t)]);ve(((ze=(Re=Qe.data)==null?void 0:Re.name)==null?void 0:ze.trim())||""),G(Le),le(Le.enabled),be(Le.manualQrMode==="dynamic"?"dynamic":"upload"),Me(Le.upiQrImageUrl||""),Pe(Le.upiId||""),Ae(Le.payeeName||""),rt(Le.instructions||"");const mt=await z0.list(t,"pending_review");xt(mt)}catch(Le){re(Le instanceof Error?Le.message:"Failed to load UPI settings"),G(null)}finally{Q(!1)}},[t]);S.useEffect(()=>{Ft()},[Ft]),S.useEffect(()=>{var It,Bt;if(se!=="dynamic"||!Se.trim()||!ke.trim()){ae("");return}const ze=`${((It=n[0])==null?void 0:It.name)||"Sample ticket"} · ${ke}`.slice(0,99),Qe=((((Bt=n[0])==null?void 0:Bt.basePriceMinor)??1e4)/100).toFixed(2),mt=DX({pa:Se.trim(),pn:ze,am:Qe});if(!mt){ae("");return}let ft=!1;return _v.toDataURL(mt,{margin:1,width:220,errorCorrectionLevel:"M"}).then(dr=>{ft||ae(dr)}),()=>{ft=!0}},[se,Se,ke,n]);const Ce=async()=>{if(t){Te(!0);try{xt(await z0.list(t,"pending_review"))}catch{}finally{Te(!1)}}},lt=async()=>{if(t){ie(!0);try{const Re={enabled:de,manualQrMode:se,upiQrImageUrl:ue.trim(),upiId:Se.trim(),payeeName:Ee.trim(),instructions:Ye,platformFeeInr:null},ze=await d5.patch(t,Re);G(ze),le(ze.enabled),be(ze.manualQrMode==="dynamic"?"dynamic":"upload"),Me(ze.upiQrImageUrl||""),await Ce()}catch(Re){window.alert(Re instanceof Error?Re.message:"Save failed")}finally{ie(!1)}}},Xe=async()=>{if(!(!t||!qe)){Pt(!0);try{await cT();const Re=await d5.checkoutEnablementOrder(t),ze=window.Razorpay;await new Promise((Le,Qe)=>{let mt=!1;const ft=new ze({key:Re.keyId,amount:Re.amount,currency:Re.currency,order_id:Re.orderId,name:"EventBuzz",description:"Manual UPI ticketing — enablement fee",handler:It=>{mt=!0,ed.checkoutVerify({orderId:It.razorpay_order_id,paymentId:It.razorpay_payment_id,signature:It.razorpay_signature}).then(()=>Le()).catch(Bt=>Qe(Bt instanceof Error?Bt:new Error("Verification failed")))},modal:{ondismiss:()=>{mt||Qe(new Error(K9))}},theme:{color:"#0B4DD1"},prefill:e!=null&&e.email?{email:e.email}:void 0});ft.on("payment.failed",It=>{var Bt;Qe(new Error(((Bt=It.error)==null?void 0:Bt.description)||"Payment failed"))}),ft.open()}),await Ft()}catch(Re){const ze=Re instanceof Error?Re.message:"Payment failed";ze!==K9&&window.alert(ze)}finally{Pt(!1)}}},Be=async Re=>{var ze;if(!(!Re||!t||!r))try{const Qe=(ze=(await Sa(Re,{eventId:t,module:"ticketing-upi-qr"})).url)==null?void 0:ze.trim();Qe&&Me(Qe)}catch(Le){window.alert(Le instanceof Error?Le.message:"Upload failed")}},ct=()=>{var Re;b(null),j(""),T(""),P([""]),O(""),I("INR"),F(0),Y(""),$(((Re=u[0])==null?void 0:Re._id)||""),V(""),z([]),v(!0)},Tt=Re=>{var ze,Le;b(Re),j(Re.name),T(Re.description||""),P((ze=Re.keyPoints)!=null&&ze.length?Re.keyPoints:[""]),O(String((Re.basePriceMinor||0)/100)),I(Re.currency||"INR"),F(Re.sortOrder??0),Y(Re.maxPerOrder!=null?String(Re.maxPerOrder):""),$(Re.participantList),V(Re.registrationForm||""),z((Le=Re.taxItems)!=null&&Le.length?[...Re.taxItems]:[]),v(!0)},We=async()=>{if(!t||!X)return;const Re=parseFloat(N);if(!Number.isFinite(Re)||Re<0){window.alert("Enter a valid price.");return}const ze=Math.round(Re*100),Le={name:k.trim(),description:_.trim(),keyPoints:A.map(Qe=>Qe.trim()).filter(Boolean),basePriceMinor:ze,currency:C,sortOrder:R,maxPerOrder:M.trim()?parseInt(M,10):null,taxItems:D,participantList:X,registrationForm:ee.trim()||null,isActive:!0};w(!0);try{m?await Ky.update(t,m._id,Le):await Ky.create(t,Le),v(!1),await vt()}catch(Qe){window.alert(Qe instanceof Error?Qe.message:"Save failed")}finally{w(!1)}},ce=async Re=>{if(t&&window.confirm(`Deactivate “${Re.name}”? It will no longer appear on the public checkout page.`))try{await Ky.remove(t,Re._id),await vt()}catch(ze){window.alert(ze instanceof Error?ze.message:"Failed")}},he=()=>{Et&&navigator.clipboard.writeText(Et).then(()=>window.alert("Checkout link copied."),()=>window.alert(Et))};return t?r?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:Xo,children:"Event"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Ticketing"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:"6px",maxWidth:"560px"},children:"Sell tickets on the public checkout page. Buyers are added to the participant list you choose. Online card/UPI uses your Razorpay (or platform) gateway when configured; if not, you can enable per-event UPI QR and review payment screenshots below."})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px",alignItems:"flex-end"},children:[i.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:he,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(Js,{size:14})," Copy checkout link"]}),i.jsxs("a",{href:Et||"#",target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",color:"var(--primary)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",textDecoration:"none"},children:[i.jsx(bv,{size:14})," Open checkout"]}),i.jsxs("button",{type:"button",onClick:ct,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," Add ticket"]})]}),Et&&i.jsx("code",{style:{fontSize:"11px",color:"var(--muted)",maxWidth:"420px",wordBreak:"break-all",textAlign:"right"},children:Et})]})]}),l&&i.jsx("p",{style:{color:"var(--destructive)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:l}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 360px), 1fr))",gap:"24px",alignItems:"start"},children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",minWidth:0},children:[a&&i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}),!a&&n.length===0&&!l&&i.jsx("div",{style:{padding:"40px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",textAlign:"center",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No tickets yet. Add a ticket to publish it on the public checkout page."}),i.jsx("div",{style:{display:"grid",gap:"12px"},children:n.map(Re=>{var ze;return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"16px",background:"var(--card)",display:"flex",justifyContent:"space-between",gap:"12px",flexWrap:"wrap",opacity:Re.isActive?1:.65},children:[i.jsxs("div",{children:[i.jsxs("p",{style:{fontWeight:"var(--font-weight-medium)",fontFamily:"var(--font-inter)",marginBottom:"4px"},children:[Re.name," ",!Re.isActive&&i.jsx("span",{style:{fontSize:"11px",color:"var(--muted)"},children:"(inactive)"})]}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"8px"},children:[e8e(Re.basePriceMinor,Re.currency),(ze=Re.taxItems)!=null&&ze.length?` · ${Re.taxItems.length} tax row(s)`:""]}),Re.description&&i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",maxWidth:"640px"},children:Re.description})]}),i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-start"},children:[i.jsxs("button",{type:"button",onClick:()=>Tt(Re),style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"var(--text-xs)"},children:[i.jsx(wi,{size:14})," Edit"]}),Re.isActive&&i.jsxs("button",{type:"button",onClick:()=>void ce(Re),style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--destructive)",color:"var(--destructive)",background:"transparent",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"var(--text-xs)"},children:[i.jsx(Xr,{size:14})," Deactivate"]})]})]},Re._id)})})]}),i.jsx("aside",{style:{minWidth:0},children:i.jsxs("section",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"16px",background:"var(--card)",position:"sticky",top:16},children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",margin:"0 0 8px"},children:"UPI / manual checkout"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:"0 0 12px"},children:"For events without an online payment gateway. Buyers pay you directly, then upload proof for you to approve."}),K&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)"},children:K}),U&&i.jsx("p",{style:{color:"var(--muted)"},children:"Loading UPI settings…"}),!U&&q&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[q.enablementPaid?i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:["Enablement fee paid",q.enablementPaidAt?` · ${new Date(q.enablementPaidAt).toLocaleString()}`:"",". You can configure and enable manual checkout below."]}):i.jsxs("div",{style:{padding:"12px",borderRadius:"8px",border:"1px solid var(--border)",background:"var(--muted-background, rgba(0,0,0,0.04))"},children:[i.jsxs("p",{style:{fontSize:"var(--text-sm)",margin:"0 0 10px",color:"var(--foreground)"},children:["Pay a one-time ",i.jsxs("strong",{children:["INR ",((xe=(je=q.enablementFeeInr)==null?void 0:je.toFixed)==null?void 0:xe.call(je,0))??q.enablementFeeInr]})," ","enablement fee per event to turn on manual UPI checkout. The receipt is listed under"," ",i.jsx("strong",{children:"Settings → Billing"})," with your other invoices."]}),qe?i.jsx("button",{type:"button",disabled:et,onClick:()=>void Xe(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:et?"wait":"pointer",fontSize:"var(--text-sm)"},children:et?"Processing…":"Pay enablement fee"}):i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Only organisation administrators can complete this payment."})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"checkbox",checked:de,disabled:!q.enablementPaid&&!de,onChange:Re=>le(Re.target.checked)}),"Enable UPI / manual checkout for this event"]}),!q.enablementPaid&&!de?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Complete payment above before you can enable this option."}):null,de&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{background:"#fffbeb",border:"1px solid #fcd34d",borderRadius:"8px",padding:"12px",fontSize:"var(--text-sm)",color:"#92400e",lineHeight:1.45},children:[i.jsx("strong",{children:"Manual verification required."})," EventBuzz does not confirm money movement on UPI. You must check each payment in your bank or UPI app, match it to the buyer’s screenshot, then approve or reject the ticket in the queue below. Unmatched or fraudulent payments should be rejected."]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[i.jsx("span",{style:Xo,children:"QR code"}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"8px",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"radio",name:"eb-manual-qr-mode",checked:se==="upload",onChange:()=>be("upload"),style:{marginTop:3}}),i.jsx("span",{children:"Upload a static QR image (or image URL)"})]}),i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"8px",fontSize:"var(--text-sm)"},children:[i.jsx("input",{type:"radio",name:"eb-manual-qr-mode",checked:se==="dynamic",onChange:()=>be("dynamic"),style:{marginTop:3}}),i.jsxs("span",{children:["Generate QR from UPI ID: payee name is ",i.jsx("em",{children:"ticket name · event name"}),"; amount is the buyer’s order total at checkout."]})]})]}),se==="upload"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"UPI QR image"}),i.jsx("input",{type:"file",accept:"image/*",onChange:Re=>{var ze;return void Be(((ze=Re.target.files)==null?void 0:ze[0])??null)}}),ue?i.jsx("img",{src:ue,alt:"QR",style:{maxWidth:200,borderRadius:8,border:"1px solid var(--border)"}}):null,i.jsx("input",{value:ue,onChange:Re=>Me(Re.target.value),placeholder:"Or paste image URL",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"UPI ID (optional, shown to buyers)"}),i.jsx("input",{value:Se,onChange:Re=>Pe(Re.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Payee name (optional)"}),i.jsx("input",{value:Ee,onChange:Re=>Ae(Re.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"UPI ID (VPA) — required"}),i.jsx("input",{value:Se,onChange:Re=>Pe(Re.target.value),placeholder:"e.g. merchant@paytm",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsx("p",{style:{fontSize:"11px",color:"var(--muted)",margin:0},children:"Preview uses your first ticket’s base price only. On the public page the QR updates with the exact total (ticket + tax, no Eventbuzz add-on)."}),De?i.jsx("img",{src:De,alt:"Sample UPI QR",style:{maxWidth:220,borderRadius:8,border:"1px solid var(--border)"}}):null]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Instructions for buyers"}),i.jsx("textarea",{value:Ye,onChange:Re=>rt(Re.target.value),rows:3,style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)",fontFamily:"inherit"}})]}),i.jsx("p",{style:{fontSize:"11px",color:"var(--muted)",margin:0,lineHeight:1.45},children:"Buyers pay ticket price plus tax only on this path. Eventbuzz is covered by the one-time manual UPI enablement fee you pay per event (Billing)."}),i.jsx("button",{type:"button",disabled:H,onClick:()=>void lt(),style:{alignSelf:"flex-start",padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer"},children:H?"Saving…":"Save UPI settings"})]})]}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",marginTop:"24px",marginBottom:"8px"},children:"Pending UPI proofs"}),st?i.jsx("p",{style:{color:"var(--muted)"},children:"Refreshing…"}):He.length===0?i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No pending reviews."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:He.map(Re=>{var ze;return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"8px",padding:"12px",display:"grid",gap:"8px",gridTemplateColumns:"1fr auto",alignItems:"start"},children:[i.jsxs("div",{children:[i.jsxs("p",{style:{fontWeight:"var(--font-weight-medium)",margin:"0 0 4px"},children:[((ze=Re.ticket)==null?void 0:ze.name)||"Ticket"," · ",Re.purchaserEmail]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:[Re.quote&&typeof Re.quote.totalMinor=="number"?`${Re.quote.totalMinor/100} ${Re.currency}`:"—"," ","· ",Re.createdAt?new Date(Re.createdAt).toLocaleString():""]}),Re.buyerNote?i.jsx("p",{style:{fontSize:"var(--text-sm)",margin:"8px 0 0"},children:Re.buyerNote}):null,Re.screenshotUrl?i.jsx("a",{href:Re.screenshotUrl,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"var(--text-sm)"},children:"View screenshot"}):null]}),i.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[i.jsx("button",{type:"button",onClick:()=>{(async()=>{if(t&&window.confirm("Approve this payment and register attendees?"))try{await z0.approve(t,Re._id),await Ce(),await vt()}catch(Le){window.alert(Le instanceof Error?Le.message:"Approve failed")}})()},style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-xs)"},children:"Approve"}),i.jsx("button",{type:"button",onClick:()=>{(async()=>{if(!t)return;const Le=window.prompt("Reject reason (optional)")??"";try{await z0.reject(t,Re._id,Le),await Ce()}catch(Qe){window.alert(Qe instanceof Error?Qe.message:"Reject failed")}})()},style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--destructive)",color:"var(--destructive)",background:"transparent",cursor:"pointer",fontSize:"var(--text-xs)"},children:"Reject"})]})]},Re._id)})})]})})]}),p&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.35)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},onClick:()=>!x&&v(!1),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",maxWidth:"560px",width:"100%",maxHeight:"90vh",overflow:"auto",padding:"20px",border:"1px solid var(--border)"},onClick:Re=>Re.stopPropagation(),children:[i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",marginBottom:"16px"},children:m?"Edit ticket":"New ticket"}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Name"}),i.jsx("input",{value:k,onChange:Re=>j(Re.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Description"}),i.jsx("textarea",{value:_,onChange:Re=>T(Re.target.value),rows:3,style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)",fontFamily:"inherit"}})]}),i.jsxs("div",{children:[i.jsx("span",{style:Xo,children:"Key points"}),A.map((Re,ze)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"6px"},children:[i.jsx("input",{value:Re,onChange:Le=>{const Qe=[...A];Qe[ze]=Le.target.value,P(Qe)},placeholder:"Bullet point",style:{flex:1,padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>P(A.filter((Le,Qe)=>Qe!==ze)),style:{padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"8px",background:"var(--background)"},children:"−"})]},ze)),i.jsx("button",{type:"button",onClick:()=>P([...A,""]),style:{marginTop:"8px",padding:"6px 12px",borderRadius:"8px",border:"1px dashed var(--border)",background:"transparent",cursor:"pointer"},children:"+ Add point"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsxs("span",{style:Xo,children:["Price (",C,")"]}),i.jsx("input",{value:N,onChange:Re=>O(Re.target.value),placeholder:"0.00",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Currency"}),i.jsx("input",{value:C,onChange:Re=>I(Re.target.value.toUpperCase()),maxLength:3,style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Sort order"}),i.jsx("input",{type:"number",value:R,onChange:Re=>F(parseInt(Re.target.value,10)||0),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Max per order (optional)"}),i.jsx("input",{value:M,onChange:Re=>Y(Re.target.value),placeholder:"Unlimited",style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"}})]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Participant list (fixed)"}),i.jsxs("select",{value:X,onChange:Re=>$(Re.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"},children:[i.jsx("option",{value:"",children:"Select list…"}),u.map(Re=>i.jsx("option",{value:Re._id,children:Re.name},Re._id))]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[i.jsx("span",{style:Xo,children:"Registration form (optional)"}),i.jsxs("select",{value:ee,onChange:Re=>V(Re.target.value),style:{padding:"8px 10px",borderRadius:"8px",border:"1px solid var(--border)"},children:[i.jsx("option",{value:"",children:"None"}),f.map(Re=>i.jsxs("option",{value:Re._id,children:[Re.name," (",Re.type,")"]},Re._id))]})]}),i.jsxs("div",{children:[i.jsx("span",{style:Xo,children:"Tax items"}),i.jsx("p",{style:{fontSize:"11px",color:"var(--muted)",margin:"4px 0 8px"},children:"Rate as percent (e.g. 18 for 18%). Leave states empty to apply everywhere; otherwise enter comma-separated codes (e.g. KA,MH)."}),D.map((Re,ze)=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 80px 1fr auto",gap:"8px",marginBottom:"8px"},children:[i.jsx("input",{placeholder:"Label (e.g. GST)",value:Re.label,onChange:Le=>{const Qe=[...D];Qe[ze]={...Qe[ze],label:Le.target.value},z(Qe)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("input",{type:"number",placeholder:"%",value:Re.rateBps/100,onChange:Le=>{const Qe=parseFloat(Le.target.value)||0,mt=[...D];mt[ze]={...mt[ze],rateBps:Math.round(Qe*100)},z(mt)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("input",{placeholder:"States or empty = all",value:Re.appliesToStates.join(","),onChange:Le=>{const Qe=[...D];Qe[ze]={...Qe[ze],appliesToStates:Le.target.value.split(",").map(mt=>mt.trim().toUpperCase()).filter(Boolean)},z(Qe)},style:{padding:"8px",borderRadius:"8px",border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>z(D.filter((Le,Qe)=>Qe!==ze)),style:{padding:"8px",border:"1px solid var(--border)",borderRadius:"8px"},children:"×"})]},ze)),i.jsx("button",{type:"button",onClick:()=>z([...D,{label:"",rateBps:0,appliesToStates:[]}]),style:{padding:"6px 12px",borderRadius:"8px",border:"1px dashed var(--border)",background:"transparent"},children:"+ Tax row"})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"20px"},children:[i.jsx("button",{type:"button",disabled:x,onClick:()=>v(!1),style:{padding:"8px 16px",borderRadius:"8px",border:"1px solid var(--border)",background:"var(--background)"},children:"Cancel"}),i.jsx("button",{type:"button",disabled:x||!k.trim()||!X,onClick:()=>void We(),style:{padding:"8px 16px",borderRadius:"8px",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",opacity:x?.7:1},children:x?"Saving…":"Save"})]})]})})]}):i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Your account needs an organisation to use ticketing."}):i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Select an event to manage tickets."})}function r8e({...e}){return i.jsx(iU,{"data-slot":"sheet",...e})}function n8e({...e}){return i.jsx(oU,{"data-slot":"sheet-portal",...e})}const BX=S.forwardRef(({className:e,...t},r)=>i.jsx(aU,{ref:r,"data-slot":"sheet-overlay",className:ea("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t}));BX.displayName="SheetOverlay";function i8e({className:e,children:t,side:r="right",...n}){return i.jsxs(n8e,{children:[i.jsx(BX,{}),i.jsxs(sU,{"data-slot":"sheet-content",className:ea("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",r==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",r==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",r==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,i.jsxs(cU,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[i.jsx(Gt,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function o8e({className:e,...t}){return i.jsx("div",{"data-slot":"sheet-header",className:ea("flex flex-col gap-1.5 p-4",e),...t})}function a8e({className:e,...t}){return i.jsx(lU,{"data-slot":"sheet-title",className:ea("text-foreground font-semibold",e),...t})}function s8e(e){const t=S.useRef({value:e,previous:e});return S.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var lI="Switch",[l8e]=uS(lI),[c8e,u8e]=l8e(lI),WX=S.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:o,defaultChecked:a,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=S.useState(null),v=zl(t,k=>p(k)),m=S.useRef(!1),b=h?d||!!h.closest("form"):!0,[x=!1,w]=xT({prop:o,defaultProp:a,onChange:u});return i.jsxs(c8e,{scope:r,checked:x,disabled:l,children:[i.jsx(_a.button,{type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":UX(x),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:v,onClick:hs(e.onClick,k=>{w(j=>!j),b&&(m.current=k.isPropagationStopped(),m.current||k.stopPropagation())})}),b&&i.jsx(d8e,{control:h,bubbles:!m.current,name:n,value:c,checked:x,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});WX.displayName=lI;var qX="SwitchThumb",$X=S.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,o=u8e(qX,r);return i.jsx(_a.span,{"data-state":UX(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:t})});$X.displayName=qX;var d8e=e=>{const{control:t,checked:r,bubbles:n=!0,...o}=e,a=S.useRef(null),s=s8e(r),l=CK(t);return S.useEffect(()=>{const c=a.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==r&&f){const h=new Event("click",{bubbles:n});f.call(c,r),c.dispatchEvent(h)}},[s,r,n]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:a,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function UX(e){return e?"checked":"unchecked"}var f8e=WX,p8e=$X;function h8e({className:e,...t}){return i.jsx(f8e,{"data-slot":"switch",className:ea("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:i.jsx(p8e,{"data-slot":"switch-thumb",className:ea("bg-card dark:data-[state=unchecked]:bg-card-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}const g8e="https://api.eventbuzz.live/api".replace(/\/api\/?$/,"")||(typeof window<"u"?window.location.origin:"");function qy(e){return e?e.startsWith("http")?e:`${g8e}${e.startsWith("/")?"":"/"}${e}`:""}const m8e=3;function v8e({eventId:e,open:t,onOpenChange:r}){const[n,o]=S.useState({}),[a,s]=S.useState(!1),[l,c]=S.useState(null),[u,d]=S.useState("idle"),[f,h]=S.useState(null),[p,v]=S.useState([]),[m,b]=S.useState(!1),x=S.useRef(null),w=wc(m8e),k=S.useCallback(async()=>{if(e){s(!0);try{const O=await Xc.get(e);o(O.data||{})}catch{o({})}finally{s(!1)}}},[e]);S.useEffect(()=>{t&&e&&(k(),b(!0),Vs.list({type:"microsite",limit:50}).then(O=>{var C;v(((C=O.data)==null?void 0:C.templates)??[])}).catch(()=>v([])).finally(()=>b(!1)))},[t,e,k]);const j=S.useCallback(async O=>{if(e){h(null),c(O);try{await Xc.update(e,n),w.advance(O)}catch(C){h(C instanceof Error?C.message:"Failed to save")}finally{c(null)}}},[e,n,w]),_=S.useCallback(async()=>{var C;const O=(n.folder||"").trim().toLowerCase().replace(/[^a-z0-9-]/g,"");if(!O){d("idle");return}if(e){d("checking");try{const I=await Xc.checkFolder(e,O);d((C=I.data)!=null&&C.available?"available":"taken")}catch{d("idle")}}},[e,n.folder]);S.useEffect(()=>{if(x.current&&clearTimeout(x.current),!(n.folder||"").trim()){d("idle");return}return x.current=setTimeout(()=>_(),500),()=>{x.current&&clearTimeout(x.current)}},[n.folder,_]);const T=async O=>{var I;const C=(I=O.target.files)==null?void 0:I[0];if(!(!C||!e)){try{const R=await Sa(C,{eventId:e,module:"website/logo"});o(F=>({...F,logo:R.url}))}catch{}O.target.value=""}},A=async O=>{var I;const C=(I=O.target.files)==null?void 0:I[0];if(!(!C||!e)){try{const R=await Sa(C,{eventId:e,module:"website/banner"});o(F=>({...F,banners:[...F.banners||[],R.url]}))}catch{}O.target.value=""}},P=O=>{o(C=>({...C,banners:(C.banners||[]).filter((I,R)=>R!==O)}))},N=async O=>{var I;const C=(I=O.target.files)==null?void 0:I[0];if(!(!C||!e)){try{const R=await Sa(C,{eventId:e,module:"website/favicon"});o(F=>({...F,favicon:R.url}))}catch{}O.target.value=""}};return i.jsx(r8e,{open:t,onOpenChange:r,children:i.jsxs(i8e,{side:"right",className:"sm:max-w-2xl flex flex-col p-0",children:[i.jsx(o8e,{className:"px-4 pt-4 pb-2 border-b border-border",children:i.jsxs(a8e,{className:"flex items-center gap-2",children:[i.jsx(hc,{size:18})," Website Settings"]})}),i.jsx("div",{className:"flex-1 overflow-y-auto",children:a?i.jsx("div",{className:"flex items-center justify-center py-12",children:i.jsx(kx,{className:"size-6 animate-spin text-muted-foreground"})}):i.jsxs(i.Fragment,{children:[i.jsxs(Ur,{n:1,title:"Basic configuration",subtitle:"Enable website, folder, title, description and keywords",open:w.open===1,completed:w.done.has(1),onToggle:()=>w.toggle(1),onSave:()=>j(1),nextLabel:l===1?"Saving…":"Save",nextDisabled:l!==null,sectionError:f||(u==="taken"?"Another event uses this website folder.":void 0),children:[i.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[i.jsx(h8e,{checked:!!n.enabled,onCheckedChange:O=>o(C=>({...C,enabled:O}))}),i.jsx("span",{className:"text-sm text-foreground font-medium",children:"Enable website"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Website folder"}),i.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[i.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"http://web.eventbuzz.live/"}),i.jsx("input",{type:"text",value:n.folder||"",onChange:O=>o(C=>({...C,folder:O.target.value})),placeholder:"e.g. napcon-2026",style:{flex:"1 1 120px",minWidth:0,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),u==="checking"&&i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Checking…"}),u==="available"&&i.jsx("p",{className:"text-xs text-green-600 mt-1",children:"Available"}),u==="taken"&&i.jsx("p",{className:"text-xs text-destructive mt-1",children:"Another event uses this folder"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Website title"}),i.jsx("input",{type:"text",value:n.title||"",onChange:O=>o(C=>({...C,title:O.target.value})),placeholder:"Event website title",style:{width:"100%",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Description"}),i.jsx("textarea",{value:n.description||"",onChange:O=>o(C=>({...C,description:O.target.value})),placeholder:"Meta description",rows:2,style:{width:"100%",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",resize:"none"}})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Keywords (comma-separated)"}),i.jsx("input",{type:"text",value:Array.isArray(n.keywords)?n.keywords.join(", "):n.keywords||"",onChange:O=>o(C=>({...C,keywords:O.target.value.split(",").map(I=>I.trim()).filter(Boolean)})),placeholder:"event, conference, 2026",style:{width:"100%",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]})]}),i.jsxs(Ur,{n:2,title:"Template",subtitle:"Choose a microsite template",open:w.open===2,completed:w.done.has(2),onToggle:()=>w.toggle(2),onSave:()=>j(2),nextLabel:l===2?"Saving…":"Save",nextDisabled:l!==null,children:[m?i.jsx("div",{className:"flex items-center justify-center py-6",children:i.jsx(kx,{className:"size-5 animate-spin text-muted-foreground"})}):i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:p.map(O=>i.jsxs("div",{style:{background:"var(--card)",border:n.templateId===O._id?"2px solid var(--primary)":"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{height:"100px",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid var(--border)"},children:O.thumbnail?i.jsx("img",{src:qy(O.thumbnail),alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):i.jsx(w$,{size:28,style:{color:"var(--muted)"}})}),i.jsxs("div",{style:{padding:"8px 10px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:O.name}),i.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>o(C=>({...C,templateId:O._id})),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 8px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:n.templateId===O._id?"var(--primary)":"var(--secondary)",color:n.templateId===O._id?"var(--primary-foreground)":"var(--foreground)",cursor:"pointer",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"500"},children:[n.templateId===O._id?i.jsx(bi,{size:10}):null," Select"]}),i.jsxs("button",{type:"button",onClick:()=>O.thumbnail?window.open(qy(O.thumbnail),"_blank"):null,style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 8px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",cursor:"pointer",fontSize:"11px",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(qh,{size:10})," Preview"]})]})]})]},O._id))}),!m&&p.length===0&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No microsite templates found. Create templates under Design → Microsite Templates."})]}),i.jsxs(Ur,{n:3,title:"Logo & Banners",subtitle:"Upload logo, favicon and banner images",open:w.open===3,completed:w.done.has(3),onToggle:()=>w.toggle(3),onSave:()=>j(3),nextLabel:l===3?"Saving…":"Save",nextDisabled:l!==null,children:[i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Logo"}),n.logo?i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("img",{src:qy(n.logo),alt:"Logo",style:{height:40,objectFit:"contain",border:"1px solid var(--border)",borderRadius:4}}),i.jsx("button",{type:"button",onClick:()=>o(O=>({...O,logo:void 0})),style:{fontSize:"var(--text-xs)",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:"Remove"})]}):null,i.jsx("input",{type:"file",accept:"image/*",onChange:T,className:"text-sm text-muted-foreground file:mr-2 file:py-1 file:px-2 file:rounded file:border file:text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Favicon"}),n.favicon?i.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[i.jsx("img",{src:qy(n.favicon),alt:"Favicon",style:{width:24,height:24,objectFit:"contain"}}),i.jsx("button",{type:"button",onClick:()=>o(O=>({...O,favicon:void 0})),style:{fontSize:"var(--text-xs)",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:"Remove"})]}):null,i.jsx("input",{type:"file",accept:"image/*,.ico",onChange:N,className:"text-sm text-muted-foreground file:mr-2 file:py-1 file:px-2 file:rounded file:border file:text-xs"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:"Banner images (multiple)"}),i.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:(n.banners||[]).map((O,C)=>i.jsxs("div",{style:{position:"relative"},children:[i.jsx("img",{src:qy(O),alt:"",style:{height:64,width:96,objectFit:"cover",borderRadius:4,border:"1px solid var(--border)"}}),i.jsx("button",{type:"button",onClick:()=>P(C),style:{position:"absolute",top:-4,right:-4,width:20,height:20,borderRadius:"50%",background:"var(--destructive)",color:"var(--destructive-foreground)",border:"none",cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",justifyContent:"center"},children:"×"})]},C))}),i.jsx("input",{type:"file",accept:"image/*",onChange:A,className:"text-sm text-muted-foreground file:mr-2 file:py-1 file:px-2 file:rounded file:border file:text-xs"})]})]})]})})]})})}function y8e(e){return e.replace(/\/+$/,"")}function x8e(){return y8e("https://builder.eventbuzz.live")}function HX(){try{return new URL(x8e()).origin}catch{return"*"}}const b8e="EB_EXPORT_HTML",w8e="EB_EXPORT_HTML_RESULT";function qw(e,t=2e4){return new Promise((r,n)=>{const o=e==null?void 0:e.contentWindow;if(!o){n(new Error("Editor is not ready."));return}const a=`${Date.now()}-${Math.random().toString(36).slice(2)}`,s=HX(),l=u=>{var d;u.source===o&&(((d=u.data)==null?void 0:d.type)!==w8e||u.data.requestId!==a||(window.removeEventListener("message",l),window.clearTimeout(c),u.data.error?n(new Error(String(u.data.error))):r(String(u.data.html??""))))};window.addEventListener("message",l);const c=window.setTimeout(()=>{window.removeEventListener("message",l),n(new Error("Timed out waiting for editor HTML."))},t);o.postMessage({type:b8e,requestId:a},s==="*"?"*":s)})}function VX(e){return e.replace(/\/+$/,"")}function S8e(){return VX("https://builder.eventbuzz.live")}function j8e(){return VX("https://api.eventbuzz.live/api")}function k8e(...e){return t=>{e.forEach(r=>{r&&(typeof r=="function"?r(t):r.current=t)})}}const _8e="EB_BUILDER_READY",YX=S.forwardRef(function({pageId:t,eventId:r,micrositeId:n=null,variant:o="default",mountNonce:a=0},s){const l=S.useRef(null),c=HX(),u=S.useCallback(()=>{var w;const v=(w=l.current)==null?void 0:w.contentWindow;if(!v)return;const m=Vee(),b=j8e(),x={type:"SET_AUTH_TOKEN",token:m,pageId:t,eventId:r,apiBaseUrl:b};n&&String(n).trim()&&(x.micrositeId=String(n).trim()),v.postMessage(x,c==="*"?"*":c)},[t,r,n,c]),d=S.useCallback(()=>{u(),window.setTimeout(u,0),window.setTimeout(u,50),window.setTimeout(u,200)},[u]);S.useEffect(()=>{const v=m=>{var b,x;m.source===((b=l.current)==null?void 0:b.contentWindow)&&((x=m.data)==null?void 0:x.type)===_8e&&d()};return window.addEventListener("message",v),()=>window.removeEventListener("message",v)},[d]);const f=S.useCallback(()=>{d()},[d]),h=S8e(),p=o==="fullscreen";return i.jsx("div",{style:{width:"100%",height:p?"100%":"calc(100vh - 220px)",minHeight:p?0:"min(70vh, 900px)",maxHeight:p?"none":"1200px",flex:p?1:void 0,display:"flex",flexDirection:"column",border:p?"none":"1px solid var(--border)",borderRadius:p?0:"var(--radius-card)",overflow:"hidden",background:p?"var(--background)":"var(--card)"},children:i.jsx("iframe",{ref:k8e(l,s),src:h,onLoad:f,title:"Microsite visual editor",style:{width:"100%",flex:1,minHeight:0,border:"none"}},`${t}-${a}-${n??"legacy"}`)})}),Q9={header:"Header",banner:"Banner",contact_form:"Contact form",agenda:"Agenda / schedule",register_links:"Register links",speakers:"Speakers",footer:"Footer",sponsors:"Sponsors",cta:"CTA",custom_html:"Custom HTML",countdown:"Countdown strip",gallery:"Gallery",about:"About",venue:"Venue",faq:"FAQ",tickets:"Tickets / pricing"};function X9(e){switch(e){case"header":return{logoText:"",menuItems:[]};case"banner":return{headline:"",subtext:"",ctaText:"",ctaUrl:"#",secondaryCtaText:"View schedule",secondaryCtaUrl:"#schedule",backgroundClass:"bg-primary"};case"contact_form":return{title:"Contact Us",submitLabel:"Send"};case"agenda":return{title:"Schedule"};case"register_links":return{title:"Register",primaryLabel:"Register Now",primaryUrl:"#",secondaryLabel:"",secondaryUrl:"#"};case"speakers":return{title:"Speakers",limit:12};case"footer":return{copyrightText:"",links:[]};case"sponsors":return{title:"Sponsors & partners",sponsors:[],partnerCtaLabel:"",partnerCtaUrl:"#"};case"cta":return{headline:"Join us",subtext:"",buttonLabel:"Register",buttonUrl:"#"};case"custom_html":return{html:""};case"countdown":return{headingLine:""};case"gallery":return{title:"Gallery",images:[]};case"about":return{title:"About",lead:"",bulletsTitle:"Why attend",bullets:[],ctaLabel:"",ctaUrl:"#register"};case"venue":return{title:"Venue",venueName:"",intro:"",mapEmbedUrl:"",transportCards:[]};case"faq":return{title:"FAQ",items:[],contactEmail:""};case"tickets":return{title:"Tickets",intro:"",tiers:[],includedTitle:"",includedBullets:[]};default:return{}}}function C8e(){var vt,Ft;const{selectedEventId:e,pendingMicrositeBuilder:t,setPendingMicrositeBuilder:r}=Li(),[n,o]=S.useState([]),[a,s]=S.useState(!1),[l,c]=S.useState(!1),[u,d]=S.useState(""),[f,h]=S.useState("home"),[p,v]=S.useState(""),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState(null),[_,T]=S.useState(!1),[A,P]=S.useState(!1),[N,O]=S.useState(!1),C=S.useRef(null),[I,R]=S.useState(null),[F,M]=S.useState({}),[Y,X]=S.useState(""),[$,ee]=S.useState(!1),[V,D]=S.useState(!1),[z,q]=S.useState(null),[G,U]=S.useState(""),[Q,K]=S.useState(!1),[re,H]=S.useState("sections"),[ie,de]=S.useState(""),[le,ke]=S.useState(null),ve=S.useRef(null),[se,be]=S.useState(!1),[De,ae]=S.useState(null),ue=S.useCallback(async()=>{var Ce;if(e){s(!0);try{const lt=await Yc.list(e);o(((Ce=lt.data)==null?void 0:Ce.pages)??[])}catch{o([])}finally{s(!1)}}},[e]);S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{if(!e){de(""),ke(null);return}(async()=>{var Be;const Ce=await ha.list(e);if(Ce.data&&Ce.data.length>0){const ct=Ce.data[0];ke(ct._id),de(ct.publishFolder!=null?String(ct.publishFolder).trim():"");return}ke(null);const lt=await Xc.get(e),Xe=((Be=lt.data)==null?void 0:Be.folder)!=null?String(lt.data.folder).trim():"";de(Xe)})().catch(()=>{ke(null),de("")})},[e]),S.useEffect(()=>{const Ce=t;!Ce||!e||Ce.eventId!==e||(r(null),(async()=>{var Xe;let lt=Ce.pageId;if(!lt)try{const ct=((Xe=(await Yc.list(e)).data)==null?void 0:Xe.pages)??[],Tt=ct.find(We=>We.type==="home")??ct[0];lt=(Tt==null?void 0:Tt._id)??null}catch{lt=null}lt&&(w(lt),H(Ce.mode))})())},[t,e,r]);const Me=S.useCallback(async()=>{if(ae(null),!e||!ie.trim()){ae("Set a microsite URL slug in Configure event microsite first.");return}be(!0);try{const Ce=await qw(ve.current);if(le){const lt=await ha.update(e,le,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await ha.publish(e,le,{targets:"draft"});if(Xe.error)throw new Error(Xe.error)}else{const lt=await Xc.update(e,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await Xc.publishMicrosite(e,{targets:"draft"});if(Xe.error)throw new Error(Xe.error)}}catch(Ce){ae(Ce instanceof Error?Ce.message:"Save failed")}finally{be(!1)}},[e,ie,le]),Se=S.useCallback(async()=>{if(ae(null),!e||!ie.trim()){ae("Set a microsite URL slug in Configure event microsite first.");return}be(!0);try{const Ce=await qw(ve.current);if(le){const lt=await ha.update(e,le,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await ha.publish(e,le,{targets:"both"});if(Xe.error)throw new Error(Xe.error)}else{const lt=await Xc.update(e,{micrositeHtml:Ce});if(lt.error)throw new Error(lt.error);const Xe=await Xc.publishMicrosite(e,{targets:"both"});if(Xe.error)throw new Error(Xe.error)}}catch(Ce){ae(Ce instanceof Error?Ce.message:"Publish failed")}finally{be(!1)}},[e,ie,le]),Pe=S.useCallback(async Ce=>{T(!0);try{const lt=await Yc.get(Ce);j(lt.data??null)}catch{j(null)}finally{T(!1)}},[]);S.useEffect(()=>{x?Pe(x):j(null)},[x,Pe]),S.useEffect(()=>{const Ce=lt=>{C.current&&!C.current.contains(lt.target)&&P(!1)};return document.addEventListener("mousedown",Ce),()=>document.removeEventListener("mousedown",Ce)},[]);const Ee=async Ce=>{if(!x)return;const lt=await Yc.update(x,{sections:Ce});lt.data&&j(lt.data)},Ae=(Ce,lt)=>{if(!(k!=null&&k.sections))return;const Be=[...[...k.sections].sort((We,ce)=>(We.order??0)-(ce.order??0))],ct=lt==="up"?Ce-1:Ce+1;if(ct<0||ct>=Be.length)return;[Be[Ce],Be[ct]]=[Be[ct],Be[Ce]];const Tt=Be.map((We,ce)=>({...We,order:ce}));Ee(Tt)},Ye=Ce=>{if(!(k!=null&&k.sections))return;const Xe=[...k.sections].sort((Be,ct)=>(Be.order??0)-(ct.order??0)).filter((Be,ct)=>ct!==Ce).map((Be,ct)=>({...Be,order:ct}));Ee(Xe)},rt=async Ce=>{if(!x||!k)return;P(!1),O(!0);const lt=k.sections??[],Xe=lt.length,Be={id:crypto.randomUUID(),type:Ce,order:Xe,config:X9(Ce)},ct=[...lt,Be];try{const Tt=await Yc.update(x,{sections:ct});Tt.data&&j(Tt.data)}finally{O(!1)}},He=Ce=>{R(Ce.id),X(Ce.type),M({...Ce.config||X9(Ce.type)})},xt=async()=>{if(!x||!k||!I)return;ee(!0);const Ce=(k.sections??[]).map(lt=>lt.id===I?{...lt,config:{...F}}:lt);try{const lt=await Yc.update(x,{sections:Ce});lt.data&&(j(lt.data),R(null))}finally{ee(!1)}},st=(Ce,lt)=>{M(Xe=>({...Xe,[Ce]:lt}))},Te=(Ce,lt,Xe,Be)=>{M(ct=>{const We=[...ct[Ce]??[]];return We[lt]?(We[lt]={...We[lt],[Xe]:Be},{...ct,[Ce]:We}):ct})},et=(Ce,lt)=>{M(Xe=>{const Be=Xe[Ce]??[];return{...Xe,[Ce]:[...Be,lt]}})},Pt=(Ce,lt)=>{M(Xe=>{const Be=Xe[Ce]??[];return{...Xe,[Ce]:Be.filter((ct,Tt)=>Tt!==lt)}})},qe=async Ce=>{var lt;if(x){q(null),D(!0);try{const Xe=await Yc.exportHtml(x,G.trim()||void 0);if(Xe.error){q(Xe.error);return}const Be=(lt=Xe.data)==null?void 0:lt.html;if(!Be){q("No HTML returned");return}if(Ce){const ct=window.open("","_blank");ct?(ct.document.write(Be),ct.document.close()):q("Popup blocked. Allow popups to preview.")}else{const ct=new Blob([Be],{type:"text/html"}),Tt=URL.createObjectURL(ct),We=document.createElement("a");We.href=Tt,We.download=((k==null?void 0:k.slug)||"page")+".html",We.click(),URL.revokeObjectURL(Tt)}}catch(Xe){q(Xe instanceof Error?Xe.message:"Export failed")}finally{D(!1)}}},Et=async Ce=>{if(Ce.preventDefault(),!(!e||!u.trim())){b(!0);try{(await Yc.create(e,{title:u.trim(),type:f,slug:p.trim()||void 0})).data&&(c(!1),d(""),h("home"),v(""),ue())}finally{b(!1)}}};return e?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Event Website"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:"Event Website"}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:"4px"},children:"Pages"})]}),x?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>{w(null),j(null),q(null),H("sections")},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(uT,{size:14})," Back to pages"]}),i.jsx("span",{style:{flex:1,minWidth:"120px",fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:(k==null?void 0:k.title)??((vt=n.find(Ce=>Ce._id===x))==null?void 0:vt.title)??"Page"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>H("visual"),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",boxShadow:re==="visual"?"0 0 0 2px var(--ring, rgba(99,102,241,0.5))":void 0},title:"Open GrapesJS visual editor (run website_builder separately)",children:[i.jsx(T3,{size:16})," Visual builder"]}),i.jsxs("button",{type:"button",onClick:()=>K(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(hc,{size:14})," Settings"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",flexWrap:"wrap",padding:"4px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",width:"fit-content"},role:"tablist","aria-label":"Editor mode",children:[i.jsx("button",{type:"button",role:"tab","aria-selected":re==="sections",onClick:()=>H("sections"),style:{padding:"8px 14px",borderRadius:"calc(var(--radius-button) - 2px)",border:"none",background:re==="sections"?"var(--card)":"transparent",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:re==="sections"?"600":"400",boxShadow:re==="sections"?"0 1px 2px rgba(0,0,0,0.06)":void 0},children:"Sections list"}),i.jsx("button",{type:"button",role:"tab","aria-selected":re==="visual",onClick:()=>H("visual"),style:{padding:"8px 14px",borderRadius:"calc(var(--radius-button) - 2px)",border:"none",background:re==="visual"?"var(--card)":"transparent",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:re==="visual"?"600":"400",boxShadow:re==="visual"?"0 1px 2px rgba(0,0,0,0.06)":void 0},children:"Visual editor (iframe)"})]}),re==="visual"?i.jsxs(i.Fragment,{children:[i.jsxs("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:["Visual HTML is stored on ",le?i.jsxs(i.Fragment,{children:["the selected ",i.jsx("code",{style:{fontSize:"0.85em"},children:"EventMicrosite"})," template"]}):i.jsxs(i.Fragment,{children:[i.jsx("code",{style:{fontSize:"0.85em"},children:"Event.website.micrositeHtml"})," (legacy)"]}),". ",i.jsx("strong",{children:"Save (draft site)"})," updates the DB and publishes only ",i.jsxs("code",{style:{fontSize:"0.85em"},children:[ie||"slug","_draft"]}),". ",i.jsx("strong",{children:"Publish"})," writes both draft and live folders. Set ",i.jsx("code",{style:{fontSize:"0.85em"},children:"VITE_PARENT_ORIGIN"})," on the builder in production."]}),e&&x?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginTop:"10px"},children:[i.jsxs("button",{type:"button",disabled:se||!ie.trim(),onClick:()=>void Me(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",cursor:se||!ie.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(sS,{size:16,"aria-hidden":!0})," ",se?"Working…":"Save (draft site)"]}),i.jsxs("button",{type:"button",disabled:se||!ie.trim(),onClick:()=>void Se(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:se||!ie.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(j$,{size:16,"aria-hidden":!0})," Publish"]})]}),De?i.jsx("p",{style:{margin:"8px 0 0",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)"},children:De}):null,i.jsx(YX,{ref:ve,pageId:x,eventId:e,micrositeId:le??void 0})]}):i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Select an event and page to open the visual editor."})]}):k?i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"},children:[i.jsx("input",{type:"text",placeholder:"Registration URL (optional)",value:G,onChange:Ce=>U(Ce.target.value),style:{maxWidth:"280px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}}),i.jsxs("button",{type:"button",onClick:()=>qe(!0),disabled:V,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:V?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(bv,{size:14})," ",V?"Loading…":"Preview HTML"]}),i.jsxs("button",{type:"button",onClick:()=>qe(!1),disabled:V,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:V?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(ja,{size:14})," Download HTML"]})]}),z&&i.jsx("div",{style:{padding:"8px 12px",borderRadius:"var(--radius-button)",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:z}),i.jsxs("div",{style:{marginBottom:"12px",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"8px"},children:[i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Add a section to this page"}),i.jsxs("div",{ref:C,style:{position:"relative"},children:[i.jsxs("button",{type:"button",disabled:N,onClick:()=>P(Ce=>!Ce),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:N?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," Add section"]}),A&&i.jsx("div",{style:{position:"absolute",right:0,top:"100%",marginTop:"4px",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--shadow-md)",zIndex:50,minWidth:"180px",overflow:"hidden"},children:Kee.map(Ce=>i.jsx("button",{type:"button",onClick:()=>rt(Ce),style:{display:"block",width:"100%",padding:"10px 14px",textAlign:"left",background:"none",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"},children:Q9[Ce]??Ce},Ce))})]})]}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Sections"}),_?i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading…"}):(Ft=k.sections)!=null&&Ft.length?i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:[...k.sections??[]].sort((Ce,lt)=>(Ce.order??0)-(lt.order??0)).map((Ce,lt)=>{var Xe,Be,ct;return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 16px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"4px",background:"var(--secondary)",color:"var(--foreground)",fontSize:"var(--text-xs)",fontWeight:"500",minWidth:"100px"},children:Ce.type.replace(/_/g," ")}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:["Order: ",lt+1]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginLeft:"auto"},children:[i.jsx("button",{type:"button",onClick:()=>He(Ce),title:"Edit section",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(wi,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ae(lt,"up"),disabled:lt===0,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:lt===0?"not-allowed":"pointer",opacity:lt===0?.5:1},children:i.jsx(Qf,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ae(lt,"down"),disabled:lt===(((Xe=k.sections)==null?void 0:Xe.length)??0)-1,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:lt===(((Be=k.sections)==null?void 0:Be.length)??0)-1?"not-allowed":"pointer",opacity:lt===(((ct=k.sections)==null?void 0:ct.length)??0)-1?.5:1},children:i.jsx(go,{size:14})}),i.jsx("button",{type:"button",onClick:()=>Ye(lt),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer"},children:i.jsx(Xr,{size:14})})]})]},Ce.id)})}):i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No sections yet. Add one below."})]})]}):i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:_?"Loading page…":"Could not load this page."})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsx("div",{style:{flex:1,minWidth:0}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsxs("button",{type:"button",onClick:()=>K(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(hc,{size:14})," Settings"]}),i.jsxs("button",{type:"button",onClick:()=>c(!0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," Add page"]})]})]}),l&&i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Add page"}),i.jsx("button",{type:"button",onClick:()=>{c(!1),d(""),v("")},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--muted)"},children:i.jsx(Gt,{size:18})})]}),i.jsxs("form",{onSubmit:Et,style:{display:"flex",flexDirection:"column",gap:"12px",maxWidth:"400px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Title *"}),i.jsx("input",{type:"text",value:u,onChange:Ce=>d(Ce.target.value),required:!0,placeholder:"e.g. Home",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Type"}),i.jsx("select",{value:f,onChange:Ce=>h(Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"},children:Gee.map(Ce=>i.jsx("option",{value:Ce,children:Ce},Ce))})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Slug (optional)"}),i.jsx("input",{type:"text",value:p,onChange:Ce=>v(Ce.target.value),placeholder:"e.g. home",style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{style:{display:"flex",gap:"8px"},children:[i.jsx("button",{type:"submit",disabled:m||!u.trim(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:m?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:m?"Saving…":"Create"}),i.jsx("button",{type:"button",onClick:()=>{c(!1),d(""),v("")},style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"})]})]})]}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:a?i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading pages…"}):n.length===0?i.jsx("div",{style:{padding:"32px"},children:i.jsx(aN,{icon:i.jsx(Wf,{size:24}),title:"No pages yet",description:"Add one to get started."})}):i.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[i.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)",background:"var(--secondary)",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Click a page to edit sections, or use ",i.jsx("strong",{style:{color:"var(--foreground)"},children:"Visual builder"})," to open the GrapesJS editor in an iframe (run ",i.jsx("code",{style:{fontSize:"0.85em"},children:"website_builder"})," locally)."]}),n.map(Ce=>{var lt;return i.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{w(Ce._id),H("sections")},onKeyDown:Xe=>{(Xe.key==="Enter"||Xe.key===" ")&&(Xe.preventDefault(),w(Ce._id),H("sections"))},style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px 16px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:[i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:Ce.title}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:Ce.slug}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",textTransform:"capitalize"},children:Ce.type}),((lt=Ce.settings)==null?void 0:lt.isPublished)&&i.jsx("span",{style:{display:"inline-flex",padding:"2px 8px",borderRadius:"999px",background:"#dcfce7",color:"#15803d",fontSize:"10px",fontWeight:"600"},children:"Published"}),i.jsxs("button",{type:"button",onClick:Xe=>{Xe.stopPropagation(),w(Ce._id),H("visual")},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:[i.jsx(T3,{size:14})," Visual builder"]})]},Ce._id)})]})})]}),i.jsx(v8e,{eventId:e,open:Q,onOpenChange:K}),i.jsx(Foe,{open:!!I,onOpenChange:Ce=>{Ce||R(null)},title:`Edit section: ${Q9[Y]??Y}`,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px",maxHeight:"70vh",overflowY:"auto"},children:[Y==="header"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Logo text"}),i.jsx("input",{type:"text",value:String(F.logoText??""),onChange:Ce=>st("logoText",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Menu items (label, url)"}),(F.menuItems??[]).map((Ce,lt)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Label",value:(Ce==null?void 0:Ce.label)??"",onChange:Xe=>Te("menuItems",lt,"label",Xe.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"URL",value:(Ce==null?void 0:Ce.url)??"",onChange:Xe=>Te("menuItems",lt,"url",Xe.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("button",{type:"button",onClick:()=>Pt("menuItems",lt),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(Xr,{size:14})})]},lt)),i.jsx("button",{type:"button",onClick:()=>et("menuItems",{label:"",url:"#"}),style:{padding:"6px 12px",fontSize:"var(--text-xs)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer"},children:"+ Add item"})]})]}),Y==="banner"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Headline"}),i.jsx("input",{type:"text",value:String(F.headline??""),onChange:Ce=>st("headline",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Subtext"}),i.jsx("input",{type:"text",value:String(F.subtext??""),onChange:Ce=>st("subtext",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA text"}),i.jsx("input",{type:"text",value:String(F.ctaText??""),onChange:Ce=>st("ctaText",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA URL"}),i.jsx("input",{type:"text",value:String(F.ctaUrl??""),onChange:Ce=>st("ctaUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary CTA text"}),i.jsx("input",{type:"text",value:String(F.secondaryCtaText??""),onChange:Ce=>st("secondaryCtaText",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary CTA URL"}),i.jsx("input",{type:"text",value:String(F.secondaryCtaUrl??""),onChange:Ce=>st("secondaryCtaUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Background class (e.g. bg-primary)"}),i.jsx("input",{type:"text",value:String(F.backgroundClass??""),onChange:Ce=>st("backgroundClass",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="contact_form"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Submit button label"}),i.jsx("input",{type:"text",value:String(F.submitLabel??""),onChange:Ce=>st("submitLabel",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="agenda"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),Y==="register_links"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Primary button label"}),i.jsx("input",{type:"text",value:String(F.primaryLabel??""),onChange:Ce=>st("primaryLabel",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Primary URL"}),i.jsx("input",{type:"text",value:String(F.primaryUrl??""),onChange:Ce=>st("primaryUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary button label"}),i.jsx("input",{type:"text",value:String(F.secondaryLabel??""),onChange:Ce=>st("secondaryLabel",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Secondary URL"}),i.jsx("input",{type:"text",value:String(F.secondaryUrl??""),onChange:Ce=>st("secondaryUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="speakers"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Limit (number)"}),i.jsx("input",{type:"number",value:Number(F.limit??12),onChange:Ce=>st("limit",Ce.target.value===""?12:parseInt(Ce.target.value,10)||12),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="footer"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Copyright text"}),i.jsx("input",{type:"text",value:String(F.copyrightText??""),onChange:Ce=>st("copyrightText",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Links (label, url)"}),(F.links??[]).map((Ce,lt)=>i.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Label",value:(Ce==null?void 0:Ce.label)??"",onChange:Xe=>Te("links",lt,"label",Xe.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"URL",value:(Ce==null?void 0:Ce.url)??"",onChange:Xe=>Te("links",lt,"url",Xe.target.value),style:{flex:1,padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("button",{type:"button",onClick:()=>Pt("links",lt),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(Xr,{size:14})})]},lt)),i.jsx("button",{type:"button",onClick:()=>et("links",{label:"",url:"#"}),style:{padding:"6px 12px",fontSize:"var(--text-xs)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer"},children:"+ Add link"})]})]}),Y==="sponsors"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Sponsors (name, logoUrl, url)"}),(F.sponsors??[]).map((Ce,lt)=>i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"6px"},children:[i.jsx("input",{type:"text",placeholder:"Name",value:(Ce==null?void 0:Ce.name)??"",onChange:Xe=>Te("sponsors",lt,"name",Xe.target.value),style:{flex:"1 1 120px",minWidth:"80px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"Logo URL",value:(Ce==null?void 0:Ce.logoUrl)??"",onChange:Xe=>Te("sponsors",lt,"logoUrl",Xe.target.value),style:{flex:"1 1 120px",minWidth:"80px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("input",{type:"text",placeholder:"URL",value:(Ce==null?void 0:Ce.url)??"",onChange:Xe=>Te("sponsors",lt,"url",Xe.target.value),style:{flex:"1 1 100px",minWidth:"80px",padding:"6px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}}),i.jsx("button",{type:"button",onClick:()=>Pt("sponsors",lt),style:{padding:"6px 10px",color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(Xr,{size:14})})]},lt)),i.jsx("button",{type:"button",onClick:()=>et("sponsors",{name:"",logoUrl:"",url:"#"}),style:{padding:"6px 12px",fontSize:"var(--text-xs)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer"},children:"+ Add sponsor"})]})]}),Y==="cta"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Headline"}),i.jsx("input",{type:"text",value:String(F.headline??""),onChange:Ce=>st("headline",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Subtext"}),i.jsx("input",{type:"text",value:String(F.subtext??""),onChange:Ce=>st("subtext",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Button label"}),i.jsx("input",{type:"text",value:String(F.buttonLabel??""),onChange:Ce=>st("buttonLabel",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Button URL"}),i.jsx("input",{type:"text",value:String(F.buttonUrl??""),onChange:Ce=>st("buttonUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="custom_html"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"HTML"}),i.jsx("textarea",{value:String(F.html??""),onChange:Ce=>st("html",Ce.target.value),rows:8,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"monospace"}})]}),Y==="countdown"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Countdown heading line"}),i.jsx("input",{type:"text",value:String(F.headingLine??""),onChange:Ce=>st("headingLine",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),Y==="gallery"&&i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),Y==="about"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Lead paragraph"}),i.jsx("textarea",{value:String(F.lead??""),onChange:Ce=>st("lead",Ce.target.value),rows:3,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Bullets title"}),i.jsx("input",{type:"text",value:String(F.bulletsTitle??""),onChange:Ce=>st("bulletsTitle",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA label"}),i.jsx("input",{type:"text",value:String(F.ctaLabel??""),onChange:Ce=>st("ctaLabel",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"CTA URL"}),i.jsx("input",{type:"text",value:String(F.ctaUrl??""),onChange:Ce=>st("ctaUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="venue"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Venue name"}),i.jsx("input",{type:"text",value:String(F.venueName??""),onChange:Ce=>st("venueName",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Intro"}),i.jsx("textarea",{value:String(F.intro??""),onChange:Ce=>st("intro",Ce.target.value),rows:3,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Map embed URL"}),i.jsx("input",{type:"text",value:String(F.mapEmbedUrl??""),onChange:Ce=>st("mapEmbedUrl",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="faq"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Contact email"}),i.jsx("input",{type:"text",value:String(F.contactEmail??""),onChange:Ce=>st("contactEmail",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),Y==="tickets"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Title"}),i.jsx("input",{type:"text",value:String(F.title??""),onChange:Ce=>st("title",Ce.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]}),i.jsxs("div",{children:[i.jsx("label",{style:{display:"block",fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Intro"}),i.jsx("textarea",{value:String(F.intro??""),onChange:Ce=>st("intro",Ce.target.value),rows:2,style:{width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",fontSize:"var(--text-sm)"}})]})]}),i.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"8px"},children:[i.jsx("button",{type:"button",onClick:xt,disabled:$,style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:$?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:$?"Saving…":"Save"}),i.jsx("button",{type:"button",onClick:()=>R(null),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"})]})]})})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Event Website"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:"Event Website"})]}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"32px"},children:i.jsx(aN,{icon:i.jsx(Wf,{size:24}),title:"Select an event",description:"Choose an event from the sidebar to build and manage its website pages."})})]})}const rc={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},Z9={...rc,cursor:"pointer",appearance:"none",paddingRight:"32px"},Cl=e=>{e.currentTarget.style.borderColor="var(--primary)",e.currentTarget.style.boxShadow="0 0 0 2px rgba(11,77,209,0.12)"},El=e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"};function Po({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"3px"},children:"*"}),e]})}function $y({text:e}){return i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx("span",{style:{fontSize:"10px"},children:"ℹ"})," ",e]})}function Zo({children:e,span2:t,error:r}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gridColumn:t?"1 / -1":void 0},children:[e,r?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"5px 0 0",lineHeight:1.35},children:r}):null]})}function LE({children:e,cols:t=2}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${t}, 1fr)`,gap:"12px"},children:e})}function J9({children:e}){return i.jsxs("div",{style:{position:"relative"},children:[e,i.jsx(go,{size:13,style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}})]})}function Uy({name:e,value:t,onChange:r,options:n}){return i.jsx("div",{style:{display:"flex",gap:"20px",alignItems:"center",paddingTop:"2px"},children:n.map(o=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",fontWeight:"var(--font-weight-normal)"},children:[i.jsx("input",{type:"radio",name:e,value:o.value,checked:t===o.value,onChange:()=>r(o.value),style:{accentColor:"var(--primary)",width:"16px",height:"16px",cursor:"pointer"}}),o.label]},o.value))})}const E8e=2*1024*1024,GX="image/jpeg,image/png,image/webp,image/gif";function A8e(e){return e.type&&GX.split(",").includes(e.type)?!0:/\.(jpe?g|png|webp|gif)$/i.test(e.name)}function T8e({preview:e,onChange:t,eventId:r}){const n=S.useRef(null),[o,a]=S.useState(!1),[s,l]=S.useState(null),c=async d=>{if(l(null),!A8e(d)){l("Use a JPG, PNG, WEBP, or GIF image.");return}if(d.size>E8e){l("Image must be 2 MB or smaller.");return}a(!0);try{const f=await Sa(d,{...r!=null&&r.trim()?{eventId:r.trim()}:{},module:"speakers/photo"});if(f!=null&&f.url)t(f.url);else throw new Error("Upload did not return a URL")}catch(f){l(f instanceof Error?f.message:"Upload failed")}finally{a(!1)}},u=d=>{d&&c(d)};return i.jsxs("div",{onClick:()=>{var d;o||(d=n.current)==null||d.click()},onDragOver:d=>d.preventDefault(),onDrop:d=>{if(d.preventDefault(),o)return;const f=d.dataTransfer.files[0];u(f)},style:{border:"1.5px dashed var(--primary)",borderRadius:"var(--radius-button)",background:"var(--secondary)",padding:"20px 12px",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",cursor:o?"wait":"pointer",transition:"background 0.15s",opacity:o?.85:1},onMouseEnter:d=>{o||(d.currentTarget.style.background="var(--accent)")},onMouseLeave:d=>{d.currentTarget.style.background="var(--secondary)"},children:[i.jsx("input",{ref:n,type:"file",accept:GX,style:{display:"none"},disabled:o,onChange:d=>{var h;const f=(h=d.target.files)==null?void 0:h[0];d.target.value="",u(f)}}),e?i.jsx("img",{src:e,alt:"Speaker photo",style:{width:64,height:64,borderRadius:"50%",objectFit:"cover",border:"2px solid var(--primary)"}}):i.jsx("div",{style:{width:56,height:56,borderRadius:"50%",background:"var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(Fl,{size:22,style:{color:"var(--primary)"}})}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",textAlign:"center",margin:0},children:o?"Uploading…":i.jsxs(i.Fragment,{children:["Drag and drop or"," ",i.jsx("span",{style:{color:"var(--primary)",textDecoration:"underline"},children:"choose a file"}),". Files are stored on S3 and served via CDN."]})}),e&&!o&&i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--primary)"},children:"Click to change photo"}),s?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:0,textAlign:"center"},children:s}):null]})}function FE({icon:e,placeholder:t,value:r,onChange:n}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--muted)"},children:e}),i.jsx("input",{style:{...rc,flex:1,width:"auto"},placeholder:t,value:r,onChange:o=>n(o.target.value),onFocus:Cl,onBlur:El})]})}function P8e({n:e,state:t}){return i.jsx("div",{style:{width:28,height:28,borderRadius:"50%",background:t==="todo"?"var(--muted)":"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t==="done"?i.jsx(bi,{size:13,style:{color:"#fff"}}):i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-inter)",color:"#fff",fontWeight:"var(--font-weight-medium)"},children:e})})}function zE({n:e,title:t,subtitle:r,open:n,completed:o,onToggle:a,children:s,onSave:l,nextLabel:c,isLast:u,nextDisabled:d}){const f=n?"active":o?"done":"todo";return i.jsxs("div",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("button",{onClick:a,style:{width:"100%",display:"flex",alignItems:"center",gap:"12px",padding:"14px 20px",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[i.jsx(P8e,{n:e,state:f}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:n?"var(--primary)":"var(--card-foreground)",margin:0},children:t}),!n&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:r})]}),n?i.jsx(Qf,{size:18,style:{color:"var(--muted)",flexShrink:0}}):i.jsx(go,{size:18,style:{color:"var(--muted)",flexShrink:0}})]}),n&&i.jsxs("div",{style:{padding:"0 20px 16px"},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 12px 40px"},children:r}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:s}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"12px",marginTop:"20px",paddingTop:"14px",borderTop:"1px solid var(--border)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)"},children:[i.jsx(bi,{size:12})," Saved"]}),i.jsx("button",{type:"button",disabled:d,onClick:l,style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 18px",borderRadius:"var(--radius-button)",background:d?"var(--secondary)":"var(--primary)",color:d?"var(--muted)":"var(--primary-foreground)",border:"none",cursor:d?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:c})]})]})]})}const I8e={fullName:"",title:"",specialisation:"",organisation:"",email:"",phone:"",photo:null,bio:"",website:"",linkedin:"",twitter:"",role:"Speaker",visibility:"Public",featured:"No",honorarium:"No",honorariumAmount:"",travelRequired:"No",accommodation:"No",dietaryRequirements:"",notes:""};function O8e(e){const t=e.trim().split(/\s+/);return t.length===0?{firstName:"",lastName:""}:t.length===1?{firstName:t[0],lastName:""}:{firstName:t[0],lastName:t.slice(1).join(" ")}}const Hy=["fullName","title","specialisation","organisation","email","role"];function eW(e){const t={};return e.fullName.trim()||(t.fullName="Full name is required."),e.title||(t.title="Please select a title."),e.specialisation.trim()||(t.specialisation="Specialisation is required."),e.organisation.trim()||(t.organisation="Organisation / Institution is required."),e.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.email.trim())||(t.email="Enter a valid email address."):t.email="Email is required.",e.role||(t.role="Please select a speaker role."),t}function tW(e){const t={};return e.bio.trim()||(t.bio="Bio is required."),t}function Vy(e,t){const r={...e};return t.forEach(n=>{delete r[n]}),r}function N8e({onClose:e,speakerId:t,onSuccess:r,eventId:n}){const{user:o}=Mr(),a=o!=null&&o.organization&&typeof o.organization=="object"&&"_id"in o.organization?String(o.organization._id):o!=null&&o.organization?String(o.organization):void 0,s=!!t,[l,c]=S.useState(1),[u,d]=S.useState(new Set),[f,h]=S.useState(I8e),[p,v]=S.useState(!1),[m,b]=S.useState({}),[x,w]=S.useState(!1),[k,j]=S.useState(!1);S.useEffect(()=>{t&&Lf.get(t).then(M=>{var Y,X,$,ee,V;if(M.data){const D=M.data,z=D.logistics;h({fullName:`${D.firstName} ${D.lastName}`.trim(),title:D.title??"",specialisation:((Y=D.expertise)==null?void 0:Y[0])??"",organisation:D.organizationName??"",email:D.email,phone:D.phone??"",photo:D.photo??null,bio:D.bio??"",website:((X=D.socialLinks)==null?void 0:X.website)??"",linkedin:(($=D.socialLinks)==null?void 0:$.linkedin)??"",twitter:((ee=D.socialLinks)==null?void 0:ee.twitter)??"",role:((V=D.speakerRole)==null?void 0:V.trim())||"Speaker",visibility:D.profileVisibility==="private"?"Private":"Public",featured:D.isFeatured?"Yes":"No",honorarium:z!=null&&z.honorarium?"Yes":"No",honorariumAmount:(z==null?void 0:z.honorariumAmount)!=null?String(z.honorariumAmount):"",travelRequired:z!=null&&z.travelRequired?"Yes":"No",accommodation:z!=null&&z.accommodation?"Yes":"No",dietaryRequirements:(z==null?void 0:z.dietaryRequirements)??"",notes:(z==null?void 0:z.internalNotes)??""}),d(new Set([1,2,3]))}})},[t]),S.useEffect(()=>{if(!x)return;const M=eW(f);Object.keys(M).length===0?b(Y=>Vy(Y,Hy)):b(Y=>({...Vy(Y,Hy),...M}))},[f.fullName,f.email,f.title,f.specialisation,f.organisation,f.role,x]),S.useEffect(()=>{if(!k)return;const M=tW(f);Object.keys(M).length===0?b(Y=>{const X={...Y};return delete X.bio,X}):b(Y=>({...Y,bio:M.bio}))},[f.bio,k]);const _=3,T=u.size,A=Math.round(T/_*100),P=(M,Y)=>h(X=>({...X,[M]:Y})),N=M=>{d(Y=>new Set([...Y,M])),M===1&&b(Y=>Vy(Y,Hy)),M===2&&b(Y=>{const X={...Y};return delete X.bio,X}),M<_&&c(M+1)},O=M=>{if(M===1){const Y=eW(f);if(Object.keys(Y).length){w(!0),b($=>({...Vy($,Hy),...Y}));return}w(!1),b($=>Vy($,Hy)),N(1);return}if(M===2){const Y=tW(f);if(Object.keys(Y).length){j(!0),b(X=>({...X,...Y}));return}j(!1),b(X=>{const $={...X};return delete $.bio,$}),N(2)}},C=()=>{b(M=>{const Y={...M};return delete Y._submit,Y}),N(3),F()},I=M=>c(Y=>Y===M?0:M),R=!p&&!!f.fullName.trim()&&!!f.email.trim(),F=async()=>{const{firstName:M,lastName:Y}=O8e(f.fullName);if(!M.trim()||!f.email.trim())return;v(!0);const X={firstName:M,lastName:Y,email:f.email.trim(),phone:f.phone||void 0,title:f.title||void 0,organizationName:f.organisation||void 0,bio:f.bio||void 0,photo:f.photo||void 0,socialLinks:f.website||f.linkedin||f.twitter?{website:f.website||void 0,linkedin:f.linkedin||void 0,twitter:f.twitter||void 0}:void 0,expertise:f.specialisation?[f.specialisation]:void 0,isFeatured:f.featured==="Yes",speakerRole:f.role.trim()||void 0,profileVisibility:f.visibility==="Private"?"private":"public",logistics:{honorarium:f.honorarium==="Yes",honorariumAmount:f.honorariumAmount.trim()||"",travelRequired:f.travelRequired==="Yes",accommodation:f.accommodation==="Yes",dietaryRequirements:f.dietaryRequirements.trim()||"",internalNotes:f.notes.trim()||""}};(o==null?void 0:o.role)==="super_admin"&&a&&(X.organization=a);const $=s&&t?await Lf.update(t,X):await Lf.create(X);v(!1),$.error?(b(ee=>({...ee,_submit:$.error||"Could not save. Please try again."})),c(3)):(r==null||r(),e())};return i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:e,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(560px, 100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)",animation:"spSlideIn 0.25s cubic-bezier(0.4,0,0.2,1)"},children:[i.jsx("style",{children:`
@keyframes spSlideIn {
from { transform: translateX(100%); opacity: 0.6; }
to { transform: translateX(0); opacity: 1; }
}
`}),i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",marginBottom:"14px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 3px"},children:"Faculty & Speakers"}),i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:s?"Edit Speaker":"Add Speaker"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"5px 0 0"},children:["Add a speaker's details and manage logistics. Fields marked with ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})," are required."]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[i.jsx("button",{onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:M=>{M.currentTarget.style.borderColor="var(--destructive)",M.currentTarget.style.color="var(--destructive)"},onMouseLeave:M=>{M.currentTarget.style.borderColor="var(--border)",M.currentTarget.style.color="var(--muted)"},children:i.jsx(Gt,{size:14})}),i.jsx("button",{type:"button",disabled:!R,onClick:F,style:{padding:"6px 16px",borderRadius:"var(--radius-button)",background:R?"var(--primary)":"var(--secondary)",color:R?"var(--primary-foreground)":"var(--muted)",border:"none",cursor:R?"pointer":"not-allowed",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"background 0.2s"},children:p?"Saving…":s?"Save changes":"Save Speaker"})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[T," of ",_," sections complete"]}),i.jsxs("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--primary)",fontWeight:"var(--font-weight-medium)"},children:[A,"%"]})]}),i.jsx("div",{style:{height:"6px",borderRadius:"99px",background:"var(--border)",overflow:"hidden"},children:i.jsx("div",{style:{height:"100%",width:`${A}%`,background:A===100?"#22c55e":"var(--primary)",borderRadius:"99px",transition:"width 0.35s ease"}})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i.jsx(zE,{n:1,title:"Personal Information",subtitle:"Name, contact, role on programme, and profile visibility",open:l===1,completed:u.has(1),onToggle:()=>I(1),onSave:()=>O(1),nextLabel:"Profile & Media",children:i.jsxs(LE,{cols:2,children:[i.jsxs(Zo,{error:m.fullName,children:[i.jsx(Po,{text:"Full Name",required:!0}),i.jsx("input",{style:{...rc,...m.fullName?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Dr. Rajesh Sharma",value:f.fullName,onChange:M=>P("fullName",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.title,children:[i.jsx(Po,{text:"Title / Designation",required:!0}),i.jsx(J9,{children:i.jsxs("select",{style:{...Z9,...m.title?{borderColor:"var(--destructive)"}:{}},value:f.title,onChange:M=>P("title",M.target.value),onFocus:Cl,onBlur:El,children:[i.jsx("option",{value:"",children:"Select Title"}),i.jsx("option",{children:"Dr."}),i.jsx("option",{children:"Prof."}),i.jsx("option",{children:"Mr."}),i.jsx("option",{children:"Ms."}),i.jsx("option",{children:"Mrs."})]})})]}),i.jsxs(Zo,{error:m.specialisation,children:[i.jsx(Po,{text:"Specialisation",required:!0}),i.jsx("input",{style:{...rc,...m.specialisation?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. Pulmonologist",value:f.specialisation,onChange:M=>P("specialisation",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.organisation,children:[i.jsx(Po,{text:"Organisation / Institution",required:!0}),i.jsx("input",{style:{...rc,...m.organisation?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. AIIMS Delhi",value:f.organisation,onChange:M=>P("organisation",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.email,children:[i.jsx(Po,{text:"Email Address",required:!0}),i.jsx("input",{type:"email",style:{...rc,...m.email?{borderColor:"var(--destructive)"}:{}},placeholder:"name@institution.org",value:f.email,onChange:M=>P("email",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{children:[i.jsx(Po,{text:"Phone Number"}),i.jsx("input",{type:"tel",style:rc,placeholder:"+91 98765 43210",value:f.phone,onChange:M=>P("phone",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{error:m.role,children:[i.jsx(Po,{text:"Speaker Role",required:!0}),i.jsx(J9,{children:i.jsxs("select",{style:{...Z9,...m.role?{borderColor:"var(--destructive)"}:{}},value:f.role,onChange:M=>P("role",M.target.value),onFocus:Cl,onBlur:El,children:[i.jsx("option",{value:"",children:"Select Role"}),i.jsx("option",{children:"Speaker"}),i.jsx("option",{children:"Keynote Speaker"}),i.jsx("option",{children:"Moderator"}),i.jsx("option",{children:"Panelist"}),i.jsx("option",{children:"Chair"}),i.jsx("option",{children:"Co-Chair"}),i.jsx("option",{children:"Workshop Leader"})]})})]}),i.jsxs(Zo,{children:[i.jsx(Po,{text:"Profile Visibility",required:!0}),i.jsx(Uy,{name:"visibility",value:f.visibility,onChange:M=>P("visibility",M),options:[{label:"Public",value:"Public"},{label:"Private",value:"Private"}]}),i.jsx($y,{text:"Public speakers appear on the event website."})]}),i.jsxs(Zo,{span2:!0,children:[i.jsx(Po,{text:"Featured Speaker"}),i.jsx(Uy,{name:"featured",value:f.featured,onChange:M=>P("featured",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]}),i.jsx($y,{text:"Featured speakers appear on the event homepage."})]})]})}),i.jsxs(zE,{n:2,title:"Profile & Media",subtitle:"Upload a photo, write a bio, and add social links",open:l===2,completed:u.has(2),onToggle:()=>I(2),onSave:()=>O(2),nextLabel:"Logistics",children:[i.jsxs(LE,{cols:2,children:[i.jsxs(Zo,{children:[i.jsx(Po,{text:"Profile Photo"}),i.jsx(T8e,{preview:f.photo,onChange:M=>P("photo",M),eventId:n??void 0}),i.jsx($y,{text:"JPG, PNG, WEBP or GIF · Max 2 MB · Square crop recommended · Uploaded via media API (S3 / CDN)"})]}),i.jsxs(Zo,{error:m.bio,children:[i.jsx(Po,{text:"Bio",required:!0}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("textarea",{style:{...rc,resize:"vertical",minHeight:"112px",paddingBottom:"22px",...m.bio?{borderColor:"var(--destructive)"}:{}},placeholder:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",value:f.bio,maxLength:400,onChange:M=>P("bio",M.target.value),onFocus:Cl,onBlur:El}),i.jsxs("span",{style:{position:"absolute",bottom:"7px",right:"10px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:f.bio.length>360?"var(--destructive)":"var(--muted)"},children:[f.bio.length,"/400"]})]}),i.jsx($y,{text:"A short professional bio visible to attendees."})]})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[i.jsx(Po,{text:"Social & Web Links"}),i.jsx(FE,{icon:i.jsx(Wf,{size:14}),placeholder:"https://personal-website.com",value:f.website,onChange:M=>P("website",M)}),i.jsx(FE,{icon:i.jsx(mre,{size:14}),placeholder:"linkedin.com/in/username",value:f.linkedin,onChange:M=>P("linkedin",M)}),i.jsx(FE,{icon:i.jsx(mne,{size:14}),placeholder:"twitter.com/handle",value:f.twitter,onChange:M=>P("twitter",M)})]})]}),i.jsx(zE,{n:3,title:"Logistics",subtitle:"Manage honorarium, travel, and special requirements",open:l===3,completed:u.has(3),onToggle:()=>I(3),onSave:C,nextLabel:"Save Speaker",nextDisabled:!R,isLast:!0,children:i.jsxs(LE,{cols:2,children:[i.jsxs(Zo,{children:[i.jsx(Po,{text:"Honorarium",required:!0}),i.jsx(Uy,{name:"honorarium",value:f.honorarium,onChange:M=>P("honorarium",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),f.honorarium==="Yes"&&i.jsxs(Zo,{children:[i.jsx(Po,{text:"Amount (₹)"}),i.jsx("input",{type:"number",style:rc,placeholder:"0.00",value:f.honorariumAmount,onChange:M=>P("honorariumAmount",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{children:[i.jsx(Po,{text:"Travel Required",required:!0}),i.jsx(Uy,{name:"travel",value:f.travelRequired,onChange:M=>P("travelRequired",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(Zo,{children:[i.jsx(Po,{text:"Accommodation",required:!0}),i.jsx(Uy,{name:"accommodation",value:f.accommodation,onChange:M=>P("accommodation",M),options:[{label:"Yes",value:"Yes"},{label:"No",value:"No"}]})]}),i.jsxs(Zo,{span2:!0,children:[i.jsx(Po,{text:"Dietary / Special Requirements"}),i.jsx("input",{style:rc,placeholder:"e.g. Vegetarian, Gluten-free, Wheelchair access…",value:f.dietaryRequirements,onChange:M=>P("dietaryRequirements",M.target.value),onFocus:Cl,onBlur:El})]}),i.jsxs(Zo,{span2:!0,children:[i.jsx(Po,{text:"Internal Notes"}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("textarea",{style:{...rc,resize:"vertical",minHeight:"72px",paddingBottom:"22px"},placeholder:"Internal notes visible only to organisers…",value:f.notes,maxLength:300,onChange:M=>P("notes",M.target.value),onFocus:Cl,onBlur:El}),i.jsxs("span",{style:{position:"absolute",bottom:"7px",right:"10px",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[f.notes.length,"/300"]})]}),i.jsx($y,{text:"Not visible to attendees or the speaker."})]}),m._submit&&i.jsx("div",{style:{gridColumn:"1 / -1"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"4px 0 0",lineHeight:1.35},children:m._submit})})]})})]})]})]})}function R8e({onClose:e,onSuccess:t}){var C;const{user:r}=Mr(),n=Nn(r),[o,a]=S.useState(""),[s,l]=S.useState(null),[c,u]=S.useState([]),[d,f]=S.useState(new Set),[h,p]=S.useState(!1),[v,m]=S.useState(""),[b,x]=S.useState(""),[w,k]=S.useState(!1),[j,_]=S.useState(null),T=!!((C=r==null?void 0:r.organization)!=null&&C._id||r!=null&&r.organization);S.useEffect(()=>{n&&Lr.list({limit:400,organization:n}).then(I=>{var R;(R=I.data)!=null&&R.events&&u(I.data.events)})},[n]);const A=I=>{f(R=>{const F=new Set(R);return F.has(I)?F.delete(I):F.add(I),F})},P=I=>{var F;const R=(F=I.target.files)==null?void 0:F[0];R&&(_(null),R.text().then(M=>{a(M),l(R.name)}).catch(()=>_("Could not read file.")),I.target.value="")},N=S.useCallback(async()=>{if(_(null),!T){_("Your account must belong to an organization.");return}if(!o.trim()){_("Choose a CSV file first.");return}if(h&&!v.trim()){_("Enter a list name for the custom list.");return}k(!0);const I=await ai.importGlobal({csv:o,eventIds:[...d],createCustomList:h,listName:h?v.trim():void 0,listDescription:h?b.trim():void 0});if(k(!1),I.error){_(I.error);return}const R=I.data,F=[(R==null?void 0:R.participantsCreated)!=null?`${R.participantsCreated} new participant(s)`:null,R!=null&&R.membershipsAdded?`${R.membershipsAdded} event membership(s) added`:null,R!=null&&R.profilesUpdated?`${R.profilesUpdated} profile(s) updated`:null].filter(Boolean);let M=F.length?F.join(" · "):"Import finished.";R!=null&&R.skippedDuplicate&&(M+=` · Skipped duplicate membership(s): ${R.skippedDuplicate}.`),R!=null&&R.failed&&(M+=` · Failed rows: ${R.failed}.`),h&&(R!=null&&R.listId)&&(M+=` Custom list created (${R.listRows??0} rows, ${R.listLinked??0} linked).`),t(M),e()},[o,d,h,v,b,T,e,t]),O=w||!o.trim()||!T||h&&!v.trim();return i.jsx(ra,{onClose:e,title:"Import participants",breadcrumb:"Participants · Import",description:"Upload a CSV (same columns as event import). Everyone is added under your organization. Optionally attach rows to events and/or save a fixed custom list from this file.",completedCount:o.trim()?1:0,totalSections:1,ctaLabel:w?"Importing…":"Import",ctaDisabled:O,onCtaClick:N,children:i.jsxs("div",{style:{padding:"0 20px 24px",display:"flex",flexDirection:"column",gap:"16px"},children:[j&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:j}),!T&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:"Your account is not linked to an organization; imports cannot be scoped."}),i.jsxs(dt,{children:[i.jsx(ht,{text:"CSV file",required:!0}),i.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"var(--radius-button)",border:"1px dashed var(--primary)",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Fl,{size:16}),s||"Choose file…",i.jsx("input",{type:"file",accept:".csv,text/csv",style:{display:"none"},onChange:P})]}),i.jsx(Vt,{text:"Required: email, first name, last name per row."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Attach to events (optional)"}),i.jsx("div",{style:{maxHeight:"200px",overflowY:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"8px 10px"},children:c.length===0?i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No events loaded."}):c.map(I=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 4px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("input",{type:"checkbox",checked:d.has(I._id),onChange:()=>A(I._id)}),i.jsx("span",{children:I.name})]},I._id))}),i.jsx(Vt,{text:"Selected events get a pending membership for each imported person. Leave empty to only add/update people in your org pool."})]}),i.jsx(dt,{children:i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("input",{type:"checkbox",checked:h,onChange:I=>p(I.target.checked)}),"Also create a custom list from this import"]})}),h&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"List name",required:!0}),i.jsx("input",{style:Ht,value:v,onChange:I=>m(I.target.value),onFocus:St,onBlur:jt,placeholder:"e.g. January invitees"})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},value:b,onChange:I=>x(I.target.value),onFocus:St,onBlur:jt,placeholder:"Optional notes for admins"})]})]})]})})}function L8e(e){return e.split(/[,;\n]+/).map(t=>t.trim()).filter(Boolean)}function F8e({participantId:e,onClose:t,onSaved:r}){const[n,o]=S.useState(""),[a,s]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(""),[x,w]=S.useState(""),[k,j]=S.useState(!0),[_,T]=S.useState(!1),[A,P]=S.useState(null);S.useEffect(()=>{j(!0),P(null),ai.get(e).then(O=>{if(j(!1),O.error||!O.data){P(O.error||"Could not load participant");return}const C=O.data;o(C.email??""),s(C.firstName??""),c(C.lastName??""),d(C.phone??""),h(C.organization??""),v(C.designation??""),b(C.notes??"");const I=C.tags;w(Array.isArray(I)?I.join(", "):"")}).catch(()=>{j(!1),P("Could not load participant")})},[e]);const N=S.useCallback(async()=>{if(P(null),!n.trim()){P("Email is required");return}T(!0);const O=L8e(x),C=await ai.update(e,{email:n.trim(),firstName:a.trim(),lastName:l.trim(),phone:u.trim()||void 0,organization:f.trim()||void 0,designation:p.trim()||void 0,notes:m.trim()||void 0,tags:O});if(T(!1),C.error){P(C.error);return}r(),t()},[e,n,a,l,u,f,p,m,x,t,r]);return i.jsx(ra,{onClose:t,title:"Edit participant",breadcrumb:"Participants · Edit",description:"Update profile and tags for this person in your organization.",completedCount:k?0:1,totalSections:1,ctaLabel:_?"Saving…":"Save",ctaDisabled:_||k,onCtaClick:N,children:i.jsxs("div",{style:{padding:"0 20px 24px",display:"flex",flexDirection:"column",gap:"14px"},children:[A&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0,fontFamily:"var(--font-noto-sans)"},children:A}),k?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading…"}):i.jsxs(i.Fragment,{children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Email",required:!0}),i.jsx("input",{style:Ht,value:n,onChange:O=>o(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"First name",required:!0}),i.jsx("input",{style:Ht,value:a,onChange:O=>s(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Last name",required:!0}),i.jsx("input",{style:Ht,value:l,onChange:O=>c(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Phone"}),i.jsx("input",{style:Ht,value:u,onChange:O=>d(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Organization"}),i.jsx("input",{style:Ht,value:f,onChange:O=>h(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Designation"}),i.jsx("input",{style:Ht,value:p,onChange:O=>v(O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Tags"}),i.jsx("input",{style:Ht,value:x,onChange:O=>w(O.target.value),onFocus:St,onBlur:jt,placeholder:"e.g. VIP, Speaker"}),i.jsx(Vt,{text:"Comma or semicolon separated."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Notes"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},value:m,onChange:O=>b(O.target.value),onFocus:St,onBlur:jt})]})]})]})})}function z8e(e){return e<1024?e+" B":e<1048576?(e/1024).toFixed(1)+" KB":(e/1048576).toFixed(1)+" MB"}function M8e({onClose:e,onSuccess:t}){const{user:r}=Mr(),n=Nn(r),o=3,a=wc(o),s=S.useRef(null),[l,c]=S.useState([]),[u,d]=S.useState(!1),[f,h]=S.useState({collection:"",description:"",visibility:"Private",tags:""}),[p,v]=S.useState([]),[m,b]=S.useState(""),[x,w]=S.useState({}),[k,j]=S.useState({}),[_,T]=S.useState(!1),A=(M,Y)=>{h(X=>({...X,[M]:Y})),j(X=>({...X,[M]:void 0}))};S.useEffect(()=>{if(!n){v([]),b("Organisation required to load collections.");return}r2.list({organization:n}).then(v).catch(()=>{v([]),b("Could not load collections.")})},[n]);const P=M=>{const Y=Array.from(M).map(X=>({id:Math.random().toString(36).slice(2),file:X}));c(X=>[...X,...Y]),j(X=>({...X,files:void 0}))},N=S.useCallback(M=>M===1?l.length===0?(j(Y=>({...Y,files:"Add at least one file to upload."})),!1):(j(Y=>({...Y,files:void 0})),!0):M===2?f.collection&&!p.some(X=>X._id===f.collection)?(j(X=>({...X,collection:"Select a valid collection or choose None."})),!1):(j(Y=>({...Y,collection:void 0})),!0):M===3?f.visibility!=="Private"&&f.visibility!=="Public"?(j(Y=>({...Y,visibility:"Select a visibility option."})),!1):(j(Y=>({...Y,visibility:void 0})),!0):!0,[l.length,f.collection,f.visibility,p]),O=M=>{const Y=N(M);w(X=>({...X,[M]:Y?"":"Fix the errors below before continuing."})),Y&&a.advance(M)},C=S.useCallback(()=>{const M=N(1),Y=N(2),X=N(3);return w($=>({...$,99:"",1:M?"":$[1]||"Fix the errors below before continuing.",2:Y?"":$[2]||"Fix the errors below before continuing.",3:X?"":$[3]||"Fix the errors below before continuing."})),!M||!Y||!X?(w($=>({...$,99:"Complete and fix all sections before uploading."})),!1):!0},[N]),I=M=>{c(Y=>Y.filter(X=>X.id!==M))},R=async()=>{if(!C())return;T(!0),c(V=>V.map(D=>({...D,error:void 0,uploading:!0,done:!1})));const M=f.visibility==="Public"?"public":"private",Y=f.tags.trim(),X=f.description.trim(),$=f.collection.trim()||void 0;let ee=!1;for(let V=0;V<l.length;V++){const D=l[V],z=D.id;try{await Sa(D.file,{eventId:"portfolio",module:"content-library",description:X,visibility:M,tags:Y||void 0,contentCollectionId:$}),c(q=>q.map(G=>G.id===z?{...G,uploading:!1,done:!0}:G))}catch(q){ee=!0;const G=q instanceof Error?q.message:"Upload failed";c(U=>U.map(Q=>Q.id===z?{...Q,uploading:!1,done:!1,error:G}:Q))}}T(!1),ee||(t==null||t(),e())},F=()=>{R()};return i.jsxs(ra,{onClose:e,title:"Upload Files",breadcrumb:"Content · Library",description:"Upload files to your content library. You can attach them to a collection after uploading.",completedCount:a.done.size,totalSections:o,ctaLabel:"Save Files",ctaDisabled:_||a.done.size<o,onCtaClick:R,children:[x[99]&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",padding:"0 20px",margin:0},children:x[99]}),i.jsxs(Ur,{n:1,title:"Upload Files",subtitle:"Drag and drop or select files to upload",open:a.open===1,completed:a.done.has(1),onToggle:()=>a.toggle(1),onSave:()=>O(1),nextLabel:"File Details",nextDisabled:_,sectionError:x[1],children:[i.jsx(dt,{error:k.files,children:i.jsxs("div",{onClick:()=>{var M;return(M=s.current)==null?void 0:M.click()},onDragOver:M=>{M.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:M=>{M.preventDefault(),d(!1),P(M.dataTransfer.files)},style:{border:`2px dashed ${u?"var(--primary)":k.files?"var(--destructive)":"var(--border)"}`,borderRadius:"var(--radius-card)",background:u?"var(--accent)":"var(--secondary)",padding:"32px 20px",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px",cursor:"pointer",transition:"all .15s"},children:[i.jsx("input",{ref:s,type:"file",multiple:!0,style:{display:"none"},onChange:M=>M.target.files&&P(M.target.files)}),i.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"var(--card)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(Fl,{size:22,style:{color:"var(--primary)"}})}),i.jsxs("div",{style:{textAlign:"center"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",margin:"0 0 4px"},children:"Drag and drop files here"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:["or ",i.jsx("span",{style:{color:"var(--primary)",textDecoration:"underline"},children:"select files"})," to upload · Max 50 MB per file"]})]})]})}),l.length>0&&i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:l.map(M=>{const Y=M.file.type.startsWith("image")?"var(--chart-1)":M.file.type==="application/pdf"?"var(--destructive)":"var(--muted)";return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"var(--secondary)",borderRadius:"var(--radius-button)",border:`1px solid ${M.error?"var(--destructive)":"var(--border)"}`},children:[i.jsx(mT,{size:18,style:{color:Y,flexShrink:0}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:M.file.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"2px 0 0"},children:z8e(M.file.size)}),M.error&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"4px 0 0",display:"flex",alignItems:"center",gap:"4px"},children:[i.jsx(Wh,{size:12})," ",M.error]})]}),M.uploading&&i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)"},children:"Uploading…"}),M.done&&!M.error&&i.jsx(yv,{size:14,style:{color:"#22c55e",flexShrink:0}}),i.jsx("button",{type:"button",onClick:()=>I(M.id),disabled:_,style:{background:"none",border:"none",cursor:_?"not-allowed":"pointer",color:"var(--muted)",display:"flex",flexShrink:0},children:i.jsx(Gt,{size:14})})]},M.id)})}),i.jsx(Vt,{text:"Supported: PDF, JPG, PNG, MP4, ZIP, PPTX, DOCX."})]}),i.jsxs(Ur,{n:2,title:"File Details",subtitle:"Add metadata and organise your files",open:a.open===2,completed:a.done.has(2),onToggle:()=>a.toggle(2),onSave:()=>O(2),nextLabel:"Visibility",nextDisabled:_,sectionError:x[2],children:[m&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:0},children:m}),i.jsxs(dt,{error:k.collection,children:[i.jsx(ht,{text:"Add to Collection"}),i.jsx("div",{style:{position:"relative"},children:i.jsxs("select",{style:{...Tr,...k.collection?{borderColor:"var(--destructive)"}:{}},value:f.collection,onChange:M=>A("collection",M.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"None (Library only)"}),p.map(M=>i.jsx("option",{value:M._id,children:M.name},M._id))]})}),i.jsx(Vt,{text:"Optional. New files are appended to the collection after upload."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description / Notes"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"Optional notes about these files…",value:f.description,onChange:M=>A("description",M.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Tags"}),i.jsx("input",{style:Ht,placeholder:"e.g. keynote, day1, sponsor",value:f.tags,onChange:M=>A("tags",M.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Separate tags with commas."})]})]}),i.jsx(Ur,{n:3,title:"Visibility",subtitle:"Control who can access these files",open:a.open===3,completed:a.done.has(3),onToggle:()=>a.toggle(3),onSave:F,nextLabel:"Save Files",nextDisabled:_,sectionError:x[3],children:i.jsxs(dt,{error:k.visibility,children:[i.jsx(ht,{text:"File Visibility",required:!0}),i.jsx(Hi,{name:"fileVis",value:f.visibility,onChange:M=>A("visibility",M),options:[{label:"Private (team only)",value:"Private"},{label:"Public (attendees can view)",value:"Public"}]}),i.jsx(Vt,{text:"Public files may be linked from the event website."})]})})]})}function rW(e){const t=e.type;return t==="image"?"Image":t==="pdf"?"PDF":t==="video"?"Video":"Other"}function D8e(e){return e==null||Number.isNaN(e)?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function k1(e){return[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||e.email}const nW={Image:"var(--chart-1)",PDF:"var(--destructive)",Video:"var(--chart-5)",Other:"var(--muted)"},B8e={Image:i.jsx(Gte,{size:14}),PDF:i.jsx(Sh,{size:14}),Video:i.jsx(Zte,{size:14}),Other:i.jsx(mT,{size:14})},W8e=["Media Kit","Presentations","Speaker Resources","Recordings","Marketing Assets","Attendee Resources","Other"],q8e=["📁","🗂️","📸","🎥","📄","🎤","🏆","⭐","🎨","📊","🔖","💼"],$8e=["All","Image","PDF","Video","Other"];function U8e(e){return e!=null&&e.length?e.map(t=>typeof t=="string"?t:t._id):[]}function H8e(e){const t=e.visibility,r=t==="shared"?"Shared":t==="public"?"Public":"Private";let n="";if(e.expiryDate){const o=new Date(e.expiryDate);Number.isNaN(o.getTime())||(n=o.toISOString().slice(0,10))}return{name:e.name??"",description:e.description??"",collectionType:e.collectionType??"",coverIcon:e.coverIcon||"📁",tags:e.tags??[],selectedFiles:[...e.contentIds??[]],visibility:r,sharedWith:U8e(e.sharedWith),passwordProtected:!!e.passwordProtected,password:"",expiryEnabled:!!e.expiryEnabled,expiryDate:n,notifyOnAdd:e.notifyOnAdd!==!1,notifyOnShare:e.notifyOnShare!==!1}}function V8e({onClose:e,onSuccess:t,editing:r=null}){const{user:n}=Mr(),o=Nn(n),a=4,s=wc(a),[l,c]=S.useState({name:"",description:"",collectionType:"",coverIcon:"📁",tags:[],selectedFiles:[],visibility:"Private",sharedWith:[],passwordProtected:!1,password:"",expiryEnabled:!1,expiryDate:"",notifyOnAdd:!0,notifyOnShare:!0}),[u,d]=S.useState([]),[f,h]=S.useState([]),[p,v]=S.useState(""),[m,b]=S.useState({}),[x,w]=S.useState({}),[k,j]=S.useState(!1),_=(H,ie)=>{c(ke=>({...ke,[H]:ie}));const le={name:["name"],collectionType:["collectionType"],visibility:["visibility","sharedWith","password","expiryDate"],sharedWith:["sharedWith"],passwordProtected:["password"],password:["password"],expiryEnabled:["expiryDate"],expiryDate:["expiryDate"],selectedFiles:["files"]}[H];le!=null&&le.length&&w(ke=>{const ve={...ke};for(const se of le)delete ve[se];return ve})};S.useEffect(()=>{let H=!1;if(!o){d([]),v("Organisation required to load library.");return}return(async()=>{try{const{media:ie}=await h$({limit:400,organization:o});H||(d(ie),v(""))}catch{H||(d([]),v("Could not load library."))}})(),()=>{H=!0}},[o]),S.useEffect(()=>{let H=!1;return(async()=>{var le;const ie=await Sx.list();if(H)return;if(ie.error||!((le=ie.data)!=null&&le.users)){h([]);return}const de=n==null?void 0:n._id;h(de?ie.data.users.filter(ke=>ke._id!==de):ie.data.users)})(),()=>{H=!0}},[n==null?void 0:n._id]),S.useEffect(()=>{r&&(c(H8e(r)),b({}),w({}))},[r==null?void 0:r._id]);const T=S.useCallback(H=>{if(H===1){const ie={};return l.name.trim()||(ie.name="Collection name is required."),l.collectionType.trim()||(ie.collectionType="Select a collection type."),Object.keys(ie).length>0?(w(de=>({...de,...ie})),!1):(w(de=>({...de,name:void 0,collectionType:void 0})),!0)}if(H===2){if(l.selectedFiles.length<1)return w(le=>({...le,files:"Select at least one file from your library."})),!1;const ie=new Set(u.map(le=>le._id));return l.selectedFiles.every(le=>ie.has(le))?(w(le=>({...le,files:void 0})),!0):(w(le=>({...le,files:"One or more selected files are no longer available."})),!1)}if(H===3){const ie={};if(["Private","Shared","Public"].includes(l.visibility)||(ie.visibility="Select a visibility option."),l.visibility==="Shared"&&l.sharedWith.length<1&&(ie.sharedWith="Add at least one team member to share with."),l.visibility==="Public"&&l.passwordProtected&&(!r||!r.passwordProtected&&l.passwordProtected)&&!l.password.trim()&&(ie.password="Enter a password or turn off password protection."),l.visibility==="Public"&&l.expiryEnabled)if(!l.expiryDate.trim())ie.expiryDate="Choose an expiry date.";else{const de=new Date(l.expiryDate);de.setHours(23,59,59,999),de.getTime()<=Date.now()&&(ie.expiryDate="Expiry date must be in the future.")}return w(de=>({...de,...ie})),Object.keys(ie).length?!1:(w(de=>({...de,visibility:void 0,sharedWith:void 0,password:void 0,expiryDate:void 0})),!0)}return!0},[l.name,l.collectionType,l.selectedFiles,l.visibility,l.sharedWith,l.passwordProtected,l.password,l.expiryEnabled,l.expiryDate,u,r]),A=H=>{const ie=T(H);b(de=>({...de,[H]:ie?"":"Fix the errors below before continuing."})),ie&&s.advance(H)},P=S.useCallback(()=>{const H=T(1),ie=T(2),de=T(3),le=T(4);return b(ke=>({...ke,99:"",1:H?"":ke[1]||"Fix the errors below before continuing.",2:ie?"":ke[2]||"Fix the errors below before continuing.",3:de?"":ke[3]||"Fix the errors below before continuing.",4:le?"":ke[4]||"Fix the errors below before continuing."})),!H||!ie||!de||!le?(b(ke=>({...ke,99:r?"Complete and fix all sections before saving.":"Complete and fix all sections before creating the collection."})),!1):!0},[T,r]),N=()=>{const H=l.visibility==="Private"?"private":l.visibility==="Shared"?"shared":"public";return{name:l.name.trim(),description:l.description.trim()||void 0,collectionType:l.collectionType,coverIcon:l.coverIcon,tags:l.tags,contentIds:l.selectedFiles,visibility:H,sharedWith:l.visibility==="Shared"?l.sharedWith:[],passwordProtected:l.visibility==="Public"?l.passwordProtected:!1,password:l.visibility==="Public"&&l.passwordProtected&&l.password.trim()?l.password.trim():void 0,expiryEnabled:l.visibility==="Public"?l.expiryEnabled:!1,expiryDate:l.visibility==="Public"&&l.expiryEnabled&&l.expiryDate.trim()?new Date(l.expiryDate).toISOString():void 0,notifyOnAdd:l.notifyOnAdd,notifyOnShare:l.notifyOnShare}},O=async()=>{if(!P())return;j(!0),b(ie=>({...ie,99:""}));const H=N();try{r!=null&&r._id?await r2.update(r._id,H):await r2.create(H),t==null||t(),e()}catch(ie){const de=ie instanceof Error?ie.message:r?"Could not update collection.":"Could not create collection.";b(le=>({...le,99:de}))}finally{j(!1)}},C=()=>{O()},[I,R]=S.useState(""),F=S.useRef(null),M=()=>{const H=I.trim();H&&!l.tags.includes(H)&&_("tags",[...l.tags,H]),R("")},Y=H=>_("tags",l.tags.filter(ie=>ie!==H)),X=H=>{(H.key==="Enter"||H.key===",")&&(H.preventDefault(),M()),H.key==="Backspace"&&!I&&l.tags.length&&Y(l.tags[l.tags.length-1])},[$,ee]=S.useState(""),[V,D]=S.useState("All"),z=u.filter(H=>{const ie=rW(H);return(!$||H.name.toLowerCase().includes($.toLowerCase()))&&(V==="All"||ie===V)}),q=H=>_("selectedFiles",l.selectedFiles.includes(H)?l.selectedFiles.filter(ie=>ie!==H):[...l.selectedFiles,H]),[G,U]=S.useState(""),Q=f.filter(H=>!l.sharedWith.includes(H._id)&&k1(H).toLowerCase().includes(G.toLowerCase())),K=H=>{_("sharedWith",[...l.sharedWith,H]),U("")},re=H=>_("sharedWith",l.sharedWith.filter(ie=>ie!==H));return i.jsxs(ra,{onClose:e,title:r?"Edit Collection":"New Collection",breadcrumb:"Content · Collections",description:r?"Update details, library files, and access for this collection.":"Group related files into a shareable, access-controlled collection.",completedCount:s.done.size,totalSections:a,ctaLabel:r?"Save changes":"Create Collection",ctaDisabled:k||s.done.size<a,onCtaClick:()=>{O()},children:[m[99]&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",padding:"0 20px",margin:0},children:m[99]}),i.jsxs(Ur,{n:1,title:"Collection Details",subtitle:"Name, type, icon and tags",open:s.open===1,completed:s.done.has(1),onToggle:()=>s.toggle(1),onSave:()=>A(1),nextLabel:"Add Files",nextDisabled:k,sectionError:m[1],children:[i.jsxs(dt,{error:x.name,children:[i.jsx(ht,{text:"Collection Name",required:!0}),i.jsx("input",{style:{...Ht,...x.name?{borderColor:"var(--destructive)"}:{}},placeholder:"e.g. NAPCON 2026 Media Kit",value:l.name,onChange:H=>_("name",H.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"What does this collection contain? Who is it for?",value:l.description,onChange:H=>_("description",H.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{error:x.collectionType,children:[i.jsx(ht,{text:"Collection Type",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:{...Tr,...x.collectionType?{borderColor:"var(--destructive)"}:{}},value:l.collectionType,onChange:H=>_("collectionType",H.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select type…"}),W8e.map(H=>i.jsx("option",{value:H,children:H},H))]})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Cover Icon"}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",paddingTop:"2px"},children:q8e.map(H=>i.jsx("button",{onClick:()=>_("coverIcon",H),title:H,style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:`2px solid ${l.coverIcon===H?"var(--primary)":"var(--border)"}`,background:l.coverIcon===H?"var(--accent)":"var(--secondary)",cursor:"pointer",fontSize:"15px",display:"flex",alignItems:"center",justifyContent:"center",transition:"border-color .12s"},children:H},H))})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Tags"}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"7px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",cursor:"text",minHeight:"40px",alignItems:"center"},onClick:()=>{var H;return(H=F.current)==null?void 0:H.focus()},children:[l.tags.map(H=>i.jsx(u2,{text:H,onRemove:()=>Y(H)},H)),i.jsx("input",{ref:F,value:I,onChange:H=>R(H.target.value),onKeyDown:X,onBlur:M,placeholder:l.tags.length===0?"Add tags — press Enter or comma…":"",style:{border:"none",outline:"none",background:"transparent",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",flex:1,minWidth:"120px"}})]}),i.jsx(Vt,{text:"Tags help attendees and admins find this collection quickly."})]})]}),i.jsxs(Ur,{n:2,title:"Add Files",subtitle:"Pick files from your library to include",open:s.open===2,completed:s.done.has(2),onToggle:()=>s.toggle(2),onSave:()=>A(2),nextLabel:"Visibility & Access",nextDisabled:k,sectionError:m[2],children:[p&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"0 0 8px"},children:p}),l.selectedFiles.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 10px",background:"var(--accent)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"},children:l.selectedFiles.map(H=>{const ie=u.find(de=>de._id===H);return i.jsx(u2,{text:(ie==null?void 0:ie.name)??H,onRemove:()=>q(H)},H)})}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx(pi,{size:13,style:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:"var(--muted)",pointerEvents:"none"}}),i.jsx("input",{style:{...Ht,paddingLeft:"30px"},placeholder:"Search library…",value:$,onChange:H=>ee(H.target.value),onFocus:St,onBlur:jt})]}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:$8e.map(H=>i.jsxs("button",{onClick:()=>D(H),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"99px",border:`1px solid ${V===H?"var(--primary)":"var(--border)"}`,background:V===H?"var(--accent)":"var(--card)",color:V===H?"var(--primary)":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",transition:"all .12s"},children:[H!=="All"&&i.jsx("span",{style:{color:nW[H]??"var(--muted)"},children:B8e[H]}),H]},H))}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"3px",maxHeight:"260px",overflowY:"auto",paddingRight:"2px"},children:p?null:u.length===0?i.jsx("p",{style:{textAlign:"center",padding:"24px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"No files in your library yet. Upload files from the Library tab first."}):z.length===0?i.jsx("p",{style:{textAlign:"center",padding:"24px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"No files match your search."}):z.map(H=>{const ie=rW(H),de=l.selectedFiles.includes(H._id);return i.jsxs("button",{onClick:()=>q(H._id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"9px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${de?"var(--primary)":"var(--border)"}`,background:de?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left",transition:"all .12s"},children:[i.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",border:`2px solid ${de?"var(--primary)":"var(--border)"}`,background:de?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all .12s"},children:de&&i.jsx(bi,{size:10,style:{color:"#fff"}})}),i.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:nW[ie]??"var(--muted)",flexShrink:0}}),i.jsx("span",{style:{flex:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0},children:ie}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",flexShrink:0,minWidth:"52px",textAlign:"right"},children:D8e(H.size)})]},H._id)})}),i.jsx(dt,{error:x.files,children:i.jsx(Vt,{text:`${l.selectedFiles.length} file${l.selectedFiles.length!==1?"s":""} selected. You can add more files later.`})})]}),i.jsxs(Ur,{n:3,title:"Visibility & Access",subtitle:"Control who can view or manage this collection",open:s.open===3,completed:s.done.has(3),onToggle:()=>s.toggle(3),onSave:()=>A(3),nextLabel:"Notifications",nextDisabled:k,sectionError:m[3],children:[i.jsxs(dt,{error:x.visibility,children:[i.jsx(ht,{text:"Visibility",required:!0}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["Private","Shared","Public"].map(H=>{const ie={Private:{icon:i.jsx(bre,{size:14}),desc:"Only you can see this collection."},Shared:{icon:i.jsx(BO,{size:14}),desc:"Specific admins or editors you invite."},Public:{icon:i.jsx(i2,{size:14}),desc:"Anyone with the link can view."}},de=l.visibility===H;return i.jsxs("button",{type:"button",onClick:()=>_("visibility",H),style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"10px 12px",borderRadius:"var(--radius-button)",border:`1.5px solid ${de?"var(--primary)":"var(--border)"}`,background:de?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left",transition:"all .12s"},children:[i.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"50%",flexShrink:0,marginTop:"2px",border:`2px solid ${de?"var(--primary)":"var(--border)"}`,background:de?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",transition:"all .12s"},children:de&&i.jsx("div",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#fff"}})}),i.jsx("span",{style:{color:de?"var(--primary)":"var(--muted)",marginTop:"1px",flexShrink:0},children:ie[H].icon}),i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:de?"var(--primary)":"var(--card-foreground)"},children:H}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:ie[H].desc})]})]},H)})})]}),l.visibility==="Shared"&&i.jsxs(dt,{error:x.sharedWith,children:[i.jsx(ht,{text:"Share With"}),l.sharedWith.length>0&&i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"8px"},children:l.sharedWith.map(H=>{const ie=f.find(le=>le._id===H),de=ie?k1(ie):H;return i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"4px 8px",borderRadius:"var(--radius-button)",background:"var(--accent)",border:"1px solid var(--border)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:[i.jsx("span",{style:{width:"18px",height:"18px",borderRadius:"50%",background:"var(--primary)",color:"var(--primary-foreground)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"9px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)"},children:de.split(/\s+/).filter(Boolean).map(le=>le[0]).join("").slice(0,2).toUpperCase()}),de,i.jsx("button",{type:"button",onClick:()=>re(H),style:{background:"none",border:"none",cursor:"pointer",display:"flex",padding:0,color:"var(--muted)"},children:i.jsx(Gt,{size:10})})]},H)})}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("input",{style:Ht,placeholder:"Search team members…",value:G,onChange:H=>U(H.target.value),onFocus:St,onBlur:jt}),G&&Q.length>0&&i.jsx("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",zIndex:10,boxShadow:"0 4px 12px rgba(0,0,0,0.10)",overflow:"hidden"},children:Q.map(H=>i.jsxs("button",{type:"button",onMouseDown:()=>K(H._id),style:{width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"9px 12px",background:"none",border:"none",cursor:"pointer",textAlign:"left",borderBottom:"1px solid var(--border)"},onMouseEnter:ie=>{ie.currentTarget.style.background="var(--secondary)"},onMouseLeave:ie=>{ie.currentTarget.style.background="none"},children:[i.jsx("span",{style:{width:"24px",height:"24px",borderRadius:"50%",background:"var(--primary)",color:"var(--primary-foreground)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:k1(H).split(/\s+/).filter(Boolean).map(ie=>ie[0]).join("").slice(0,2).toUpperCase()}),i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:k1(H)}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:H.role})]})]},H._id))})]}),i.jsx(Vt,{text:"Team members will receive an email notification when added."})]}),l.visibility==="Public"&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{error:x.password,children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Password Protection"}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Require a password to access this collection"})]}),i.jsx(W6,{value:l.passwordProtected,onChange:H=>_("passwordProtected",H)})]}),l.passwordProtected&&i.jsxs(i.Fragment,{children:[i.jsx("input",{style:{...Ht,marginTop:"8px",...x.password?{borderColor:"var(--destructive)"}:{}},type:"password",placeholder:"Set access password…",value:l.password,onChange:H=>_("password",H.target.value),onFocus:St,onBlur:jt}),(r==null?void 0:r.passwordProtected)&&i.jsx(Vt,{text:"Leave blank to keep the current password. Enter a new value to replace it."})]})]}),i.jsxs(dt,{error:x.expiryDate,children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Link Expiry"}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Automatically revoke access after a date"})]}),i.jsx(W6,{value:l.expiryEnabled,onChange:H=>_("expiryEnabled",H)})]}),l.expiryEnabled&&i.jsx("input",{style:{...Ht,marginTop:"8px",...x.expiryDate?{borderColor:"var(--destructive)"}:{}},type:"date",value:l.expiryDate,onChange:H=>_("expiryDate",H.target.value),onFocus:St,onBlur:jt})]})]})]}),i.jsxs(Ur,{n:4,title:"Notifications",subtitle:"Choose when to receive alerts for this collection",open:s.open===4,completed:s.done.has(4),onToggle:()=>s.toggle(4),onSave:C,nextLabel:r?"Save changes":"Create Collection",nextDisabled:k,sectionError:m[4],children:[i.jsx(Nm,{text:"Notify me when…"}),i.jsx(iW,{icon:i.jsx(BO,{size:14}),label:"Files are added or removed",description:"Get notified whenever a file is uploaded or deleted.",value:l.notifyOnAdd,onChange:H=>_("notifyOnAdd",H)}),i.jsx(iW,{icon:i.jsx(i2,{size:14}),label:"Collection is shared",description:"Alert me when someone shares or accesses this collection.",value:l.notifyOnShare,onChange:H=>_("notifyOnShare",H)}),i.jsx(Vt,{text:"Notifications are sent to your account email. You can change preferences in Settings."})]})]})}function W6({value:e,onChange:t}){return i.jsx("button",{onClick:()=>t(!e),"aria-pressed":e,style:{width:"36px",height:"20px",borderRadius:"99px",border:"none",cursor:"pointer",flexShrink:0,background:e?"var(--primary)":"var(--border)",position:"relative",transition:"background .2s"},children:i.jsx("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"14px",height:"14px",borderRadius:"50%",background:"#fff",transition:"left .2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})}function iW({icon:e,label:t,description:r,value:n,onChange:o}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px",flex:1},children:[i.jsx("span",{style:{color:n?"var(--primary)":"var(--muted)",marginTop:"2px",flexShrink:0},children:n?i.jsx(fT,{size:14}):i.jsx(pte,{size:14})}),i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:t}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:r})]})]}),i.jsx(W6,{value:n,onChange:o})]})}var H1={exports:{}};/*!
* Quill Editor v1.3.7
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
*/var Y8e=H1.exports,oW;function G8e(){return oW||(oW=1,(function(e,t){(function(n,o){e.exports=o()})(typeof self<"u"?self:Y8e,function(){return(function(r){var n={};function o(a){if(n[a])return n[a].exports;var s=n[a]={i:a,l:!1,exports:{}};return r[a].call(s.exports,s,s.exports,o),s.l=!0,s.exports}return o.m=r,o.c=n,o.d=function(a,s,l){o.o(a,s)||Object.defineProperty(a,s,{configurable:!1,enumerable:!0,get:l})},o.n=function(a){var s=a&&a.__esModule?function(){return a.default}:function(){return a};return o.d(s,"a",s),s},o.o=function(a,s){return Object.prototype.hasOwnProperty.call(a,s)},o.p="",o(o.s=109)})([(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(17),s=o(18),l=o(19),c=o(45),u=o(46),d=o(47),f=o(48),h=o(49),p=o(12),v=o(32),m=o(33),b=o(31),x=o(1),w={Scope:x.Scope,create:x.create,find:x.find,query:x.query,register:x.register,Container:a.default,Format:s.default,Leaf:l.default,Embed:f.default,Scroll:c.default,Block:d.default,Inline:u.default,Text:h.default,Attributor:{Attribute:p.default,Class:v.default,Style:m.default,Store:b.default}};n.default=w}),(function(r,n,o){var a=this&&this.__extends||(function(){var b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,w){x.__proto__=w}||function(x,w){for(var k in w)w.hasOwnProperty(k)&&(x[k]=w[k])};return function(x,w){b(x,w);function k(){this.constructor=x}x.prototype=w===null?Object.create(w):(k.prototype=w.prototype,new k)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=(function(b){a(x,b);function x(w){var k=this;return w="[Parchment] "+w,k=b.call(this,w)||this,k.message=w,k.name=k.constructor.name,k}return x})(Error);n.ParchmentError=s;var l={},c={},u={},d={};n.DATA_KEY="__blot";var f;(function(b){b[b.TYPE=3]="TYPE",b[b.LEVEL=12]="LEVEL",b[b.ATTRIBUTE=13]="ATTRIBUTE",b[b.BLOT=14]="BLOT",b[b.INLINE=7]="INLINE",b[b.BLOCK=11]="BLOCK",b[b.BLOCK_BLOT=10]="BLOCK_BLOT",b[b.INLINE_BLOT=6]="INLINE_BLOT",b[b.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",b[b.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",b[b.ANY=15]="ANY"})(f=n.Scope||(n.Scope={}));function h(b,x){var w=v(b);if(w==null)throw new s("Unable to create "+b+" blot");var k=w,j=b instanceof Node||b.nodeType===Node.TEXT_NODE?b:k.create(x);return new k(j,x)}n.create=h;function p(b,x){return x===void 0&&(x=!1),b==null?null:b[n.DATA_KEY]!=null?b[n.DATA_KEY].blot:x?p(b.parentNode,x):null}n.find=p;function v(b,x){x===void 0&&(x=f.ANY);var w;if(typeof b=="string")w=d[b]||l[b];else if(b instanceof Text||b.nodeType===Node.TEXT_NODE)w=d.text;else if(typeof b=="number")b&f.LEVEL&f.BLOCK?w=d.block:b&f.LEVEL&f.INLINE&&(w=d.inline);else if(b instanceof HTMLElement){var k=(b.getAttribute("class")||"").split(/\s+/);for(var j in k)if(w=c[k[j]],w)break;w=w||u[b.tagName]}return w==null?null:x&f.LEVEL&w.scope&&x&f.TYPE&w.scope?w:null}n.query=v;function m(){for(var b=[],x=0;x<arguments.length;x++)b[x]=arguments[x];if(b.length>1)return b.map(function(j){return m(j)});var w=b[0];if(typeof w.blotName!="string"&&typeof w.attrName!="string")throw new s("Invalid definition");if(w.blotName==="abstract")throw new s("Cannot register abstract class");if(d[w.blotName||w.attrName]=w,typeof w.keyName=="string")l[w.keyName]=w;else if(w.className!=null&&(c[w.className]=w),w.tagName!=null){Array.isArray(w.tagName)?w.tagName=w.tagName.map(function(j){return j.toUpperCase()}):w.tagName=w.tagName.toUpperCase();var k=Array.isArray(w.tagName)?w.tagName:[w.tagName];k.forEach(function(j){(u[j]==null||w.className==null)&&(u[j]=w)})}return w}n.register=m}),(function(r,n,o){var a=o(51),s=o(11),l=o(3),c=o(20),u="\0",d=function(f){Array.isArray(f)?this.ops=f:f!=null&&Array.isArray(f.ops)?this.ops=f.ops:this.ops=[]};d.prototype.insert=function(f,h){var p={};return f.length===0?this:(p.insert=f,h!=null&&typeof h=="object"&&Object.keys(h).length>0&&(p.attributes=h),this.push(p))},d.prototype.delete=function(f){return f<=0?this:this.push({delete:f})},d.prototype.retain=function(f,h){if(f<=0)return this;var p={retain:f};return h!=null&&typeof h=="object"&&Object.keys(h).length>0&&(p.attributes=h),this.push(p)},d.prototype.push=function(f){var h=this.ops.length,p=this.ops[h-1];if(f=l(!0,{},f),typeof p=="object"){if(typeof f.delete=="number"&&typeof p.delete=="number")return this.ops[h-1]={delete:p.delete+f.delete},this;if(typeof p.delete=="number"&&f.insert!=null&&(h-=1,p=this.ops[h-1],typeof p!="object"))return this.ops.unshift(f),this;if(s(f.attributes,p.attributes)){if(typeof f.insert=="string"&&typeof p.insert=="string")return this.ops[h-1]={insert:p.insert+f.insert},typeof f.attributes=="object"&&(this.ops[h-1].attributes=f.attributes),this;if(typeof f.retain=="number"&&typeof p.retain=="number")return this.ops[h-1]={retain:p.retain+f.retain},typeof f.attributes=="object"&&(this.ops[h-1].attributes=f.attributes),this}}return h===this.ops.length?this.ops.push(f):this.ops.splice(h,0,f),this},d.prototype.chop=function(){var f=this.ops[this.ops.length-1];return f&&f.retain&&!f.attributes&&this.ops.pop(),this},d.prototype.filter=function(f){return this.ops.filter(f)},d.prototype.forEach=function(f){this.ops.forEach(f)},d.prototype.map=function(f){return this.ops.map(f)},d.prototype.partition=function(f){var h=[],p=[];return this.forEach(function(v){var m=f(v)?h:p;m.push(v)}),[h,p]},d.prototype.reduce=function(f,h){return this.ops.reduce(f,h)},d.prototype.changeLength=function(){return this.reduce(function(f,h){return h.insert?f+c.length(h):h.delete?f-h.delete:f},0)},d.prototype.length=function(){return this.reduce(function(f,h){return f+c.length(h)},0)},d.prototype.slice=function(f,h){f=f||0,typeof h!="number"&&(h=1/0);for(var p=[],v=c.iterator(this.ops),m=0;m<h&&v.hasNext();){var b;m<f?b=v.next(f-m):(b=v.next(h-m),p.push(b)),m+=c.length(b)}return new d(p)},d.prototype.compose=function(f){var h=c.iterator(this.ops),p=c.iterator(f.ops),v=[],m=p.peek();if(m!=null&&typeof m.retain=="number"&&m.attributes==null){for(var b=m.retain;h.peekType()==="insert"&&h.peekLength()<=b;)b-=h.peekLength(),v.push(h.next());m.retain-b>0&&p.next(m.retain-b)}for(var x=new d(v);h.hasNext()||p.hasNext();)if(p.peekType()==="insert")x.push(p.next());else if(h.peekType()==="delete")x.push(h.next());else{var w=Math.min(h.peekLength(),p.peekLength()),k=h.next(w),j=p.next(w);if(typeof j.retain=="number"){var _={};typeof k.retain=="number"?_.retain=w:_.insert=k.insert;var T=c.attributes.compose(k.attributes,j.attributes,typeof k.retain=="number");if(T&&(_.attributes=T),x.push(_),!p.hasNext()&&s(x.ops[x.ops.length-1],_)){var A=new d(h.rest());return x.concat(A).chop()}}else typeof j.delete=="number"&&typeof k.retain=="number"&&x.push(j)}return x.chop()},d.prototype.concat=function(f){var h=new d(this.ops.slice());return f.ops.length>0&&(h.push(f.ops[0]),h.ops=h.ops.concat(f.ops.slice(1))),h},d.prototype.diff=function(f,h){if(this.ops===f.ops)return new d;var p=[this,f].map(function(w){return w.map(function(k){if(k.insert!=null)return typeof k.insert=="string"?k.insert:u;var j=w===f?"on":"with";throw new Error("diff() called "+j+" non-document")}).join("")}),v=new d,m=a(p[0],p[1],h),b=c.iterator(this.ops),x=c.iterator(f.ops);return m.forEach(function(w){for(var k=w[1].length;k>0;){var j=0;switch(w[0]){case a.INSERT:j=Math.min(x.peekLength(),k),v.push(x.next(j));break;case a.DELETE:j=Math.min(k,b.peekLength()),b.next(j),v.delete(j);break;case a.EQUAL:j=Math.min(b.peekLength(),x.peekLength(),k);var _=b.next(j),T=x.next(j);s(_.insert,T.insert)?v.retain(j,c.attributes.diff(_.attributes,T.attributes)):v.push(T).delete(j);break}k-=j}}),v.chop()},d.prototype.eachLine=function(f,h){h=h||`
`;for(var p=c.iterator(this.ops),v=new d,m=0;p.hasNext();){if(p.peekType()!=="insert")return;var b=p.peek(),x=c.length(b)-p.peekLength(),w=typeof b.insert=="string"?b.insert.indexOf(h,x)-x:-1;if(w<0)v.push(p.next());else if(w>0)v.push(p.next(w));else{if(f(v,p.next(1).attributes||{},m)===!1)return;m+=1,v=new d}}v.length()>0&&f(v,{},m)},d.prototype.transform=function(f,h){if(h=!!h,typeof f=="number")return this.transformPosition(f,h);for(var p=c.iterator(this.ops),v=c.iterator(f.ops),m=new d;p.hasNext()||v.hasNext();)if(p.peekType()==="insert"&&(h||v.peekType()!=="insert"))m.retain(c.length(p.next()));else if(v.peekType()==="insert")m.push(v.next());else{var b=Math.min(p.peekLength(),v.peekLength()),x=p.next(b),w=v.next(b);if(x.delete)continue;w.delete?m.push(w):m.retain(b,c.attributes.transform(x.attributes,w.attributes,h))}return m.chop()},d.prototype.transformPosition=function(f,h){h=!!h;for(var p=c.iterator(this.ops),v=0;p.hasNext()&&v<=f;){var m=p.peekLength(),b=p.peekType();if(p.next(),b==="delete"){f-=Math.min(m,f-v);continue}else b==="insert"&&(v<f||!h)&&(f+=m);v+=m}return f},r.exports=d}),(function(r,n){var o=Object.prototype.hasOwnProperty,a=Object.prototype.toString,s=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=function(p){return typeof Array.isArray=="function"?Array.isArray(p):a.call(p)==="[object Array]"},u=function(p){if(!p||a.call(p)!=="[object Object]")return!1;var v=o.call(p,"constructor"),m=p.constructor&&p.constructor.prototype&&o.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!v&&!m)return!1;var b;for(b in p);return typeof b>"u"||o.call(p,b)},d=function(p,v){s&&v.name==="__proto__"?s(p,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):p[v.name]=v.newValue},f=function(p,v){if(v==="__proto__")if(o.call(p,v)){if(l)return l(p,v).value}else return;return p[v]};r.exports=function h(){var p,v,m,b,x,w,k=arguments[0],j=1,_=arguments.length,T=!1;for(typeof k=="boolean"&&(T=k,k=arguments[1]||{},j=2),(k==null||typeof k!="object"&&typeof k!="function")&&(k={});j<_;++j)if(p=arguments[j],p!=null)for(v in p)m=f(k,v),b=f(p,v),k!==b&&(T&&b&&(u(b)||(x=c(b)))?(x?(x=!1,w=m&&c(m)?m:[]):w=m&&u(m)?m:{},d(k,{name:v,newValue:h(T,w,b)})):typeof b<"u"&&d(k,{name:v,newValue:b}));return k}}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BlockEmbed=n.bubbleFormats=void 0;var a=(function(){function C(I,R){for(var F=0;F<R.length;F++){var M=R[F];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(I,M.key,M)}}return function(I,R,F){return R&&C(I.prototype,R),F&&C(I,F),I}})(),s=function C(I,R,F){I===null&&(I=Function.prototype);var M=Object.getOwnPropertyDescriptor(I,R);if(M===void 0){var Y=Object.getPrototypeOf(I);return Y===null?void 0:C(Y,R,F)}else{if("value"in M)return M.value;var X=M.get;return X===void 0?void 0:X.call(F)}},l=o(3),c=k(l),u=o(2),d=k(u),f=o(0),h=k(f),p=o(16),v=k(p),m=o(6),b=k(m),x=o(7),w=k(x);function k(C){return C&&C.__esModule?C:{default:C}}function j(C,I){if(!(C instanceof I))throw new TypeError("Cannot call a class as a function")}function _(C,I){if(!C)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:C}function T(C,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);C.prototype=Object.create(I&&I.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(C,I):C.__proto__=I)}var A=1,P=(function(C){T(I,C);function I(){return j(this,I),_(this,(I.__proto__||Object.getPrototypeOf(I)).apply(this,arguments))}return a(I,[{key:"attach",value:function(){s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"attach",this).call(this),this.attributes=new h.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return new d.default().insert(this.value(),(0,c.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function(F,M){var Y=h.default.query(F,h.default.Scope.BLOCK_ATTRIBUTE);Y!=null&&this.attributes.attribute(Y,M)}},{key:"formatAt",value:function(F,M,Y,X){this.format(Y,X)}},{key:"insertAt",value:function(F,M,Y){if(typeof M=="string"&&M.endsWith(`
`)){var X=h.default.create(N.blotName);this.parent.insertBefore(X,F===0?this:this.next),X.insertAt(0,M.slice(0,-1))}else s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"insertAt",this).call(this,F,M,Y)}}]),I})(h.default.Embed);P.scope=h.default.Scope.BLOCK_BLOT;var N=(function(C){T(I,C);function I(R){j(this,I);var F=_(this,(I.__proto__||Object.getPrototypeOf(I)).call(this,R));return F.cache={},F}return a(I,[{key:"delta",value:function(){return this.cache.delta==null&&(this.cache.delta=this.descendants(h.default.Leaf).reduce(function(F,M){return M.length()===0?F:F.insert(M.value(),O(M))},new d.default).insert(`
`,O(this))),this.cache.delta}},{key:"deleteAt",value:function(F,M){s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"deleteAt",this).call(this,F,M),this.cache={}}},{key:"formatAt",value:function(F,M,Y,X){M<=0||(h.default.query(Y,h.default.Scope.BLOCK)?F+M===this.length()&&this.format(Y,X):s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"formatAt",this).call(this,F,Math.min(M,this.length()-F-1),Y,X),this.cache={})}},{key:"insertAt",value:function(F,M,Y){if(Y!=null)return s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"insertAt",this).call(this,F,M,Y);if(M.length!==0){var X=M.split(`
`),$=X.shift();$.length>0&&(F<this.length()-1||this.children.tail==null?s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"insertAt",this).call(this,Math.min(F,this.length()-1),$):this.children.tail.insertAt(this.children.tail.length(),$),this.cache={});var ee=this;X.reduce(function(V,D){return ee=ee.split(V,!0),ee.insertAt(0,D),D.length},F+$.length)}}},{key:"insertBefore",value:function(F,M){var Y=this.children.head;s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"insertBefore",this).call(this,F,M),Y instanceof v.default&&Y.remove(),this.cache={}}},{key:"length",value:function(){return this.cache.length==null&&(this.cache.length=s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"length",this).call(this)+A),this.cache.length}},{key:"moveChildren",value:function(F,M){s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"moveChildren",this).call(this,F,M),this.cache={}}},{key:"optimize",value:function(F){s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"optimize",this).call(this,F),this.cache={}}},{key:"path",value:function(F){return s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"path",this).call(this,F,!0)}},{key:"removeChild",value:function(F){s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"removeChild",this).call(this,F),this.cache={}}},{key:"split",value:function(F){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(M&&(F===0||F>=this.length()-A)){var Y=this.clone();return F===0?(this.parent.insertBefore(Y,this),this):(this.parent.insertBefore(Y,this.next),Y)}else{var X=s(I.prototype.__proto__||Object.getPrototypeOf(I.prototype),"split",this).call(this,F,M);return this.cache={},X}}}]),I})(h.default.Block);N.blotName="block",N.tagName="P",N.defaultChild="break",N.allowedChildren=[b.default,h.default.Embed,w.default];function O(C){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return C==null||(typeof C.formats=="function"&&(I=(0,c.default)(I,C.formats())),C.parent==null||C.parent.blotName=="scroll"||C.parent.statics.scope!==C.statics.scope)?I:O(C.parent,I)}n.bubbleFormats=O,n.BlockEmbed=P,n.default=N}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.overload=n.expandConfig=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},s=(function(){function ee(V,D){var z=[],q=!0,G=!1,U=void 0;try{for(var Q=V[Symbol.iterator](),K;!(q=(K=Q.next()).done)&&(z.push(K.value),!(D&&z.length===D));q=!0);}catch(re){G=!0,U=re}finally{try{!q&&Q.return&&Q.return()}finally{if(G)throw U}}return z}return function(V,D){if(Array.isArray(V))return V;if(Symbol.iterator in Object(V))return ee(V,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function ee(V,D){for(var z=0;z<D.length;z++){var q=D[z];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(V,q.key,q)}}return function(V,D,z){return D&&ee(V.prototype,D),z&&ee(V,z),V}})();o(50);var c=o(2),u=O(c),d=o(14),f=O(d),h=o(8),p=O(h),v=o(9),m=O(v),b=o(0),x=O(b),w=o(15),k=O(w),j=o(3),_=O(j),T=o(10),A=O(T),P=o(34),N=O(P);function O(ee){return ee&&ee.__esModule?ee:{default:ee}}function C(ee,V,D){return V in ee?Object.defineProperty(ee,V,{value:D,enumerable:!0,configurable:!0,writable:!0}):ee[V]=D,ee}function I(ee,V){if(!(ee instanceof V))throw new TypeError("Cannot call a class as a function")}var R=(0,A.default)("quill"),F=(function(){l(ee,null,[{key:"debug",value:function(D){D===!0&&(D="log"),A.default.level(D)}},{key:"find",value:function(D){return D.__quill||x.default.find(D)}},{key:"import",value:function(D){return this.imports[D]==null&&R.error("Cannot import "+D+". Are you sure it was registered?"),this.imports[D]}},{key:"register",value:function(D,z){var q=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(typeof D!="string"){var U=D.attrName||D.blotName;typeof U=="string"?this.register("formats/"+U,D,z):Object.keys(D).forEach(function(Q){q.register(Q,D[Q],z)})}else this.imports[D]!=null&&!G&&R.warn("Overwriting "+D+" with",z),this.imports[D]=z,(D.startsWith("blots/")||D.startsWith("formats/"))&&z.blotName!=="abstract"?x.default.register(z):D.startsWith("modules")&&typeof z.register=="function"&&z.register()}}]);function ee(V){var D=this,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(I(this,ee),this.options=M(V,z),this.container=this.options.container,this.container==null)return R.error("Invalid Quill container",V);this.options.debug&&ee.debug(this.options.debug);var q=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new p.default,this.scroll=x.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new f.default(this.scroll),this.selection=new k.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(p.default.events.EDITOR_CHANGE,function(U){U===p.default.events.TEXT_CHANGE&&D.root.classList.toggle("ql-blank",D.editor.isBlank())}),this.emitter.on(p.default.events.SCROLL_UPDATE,function(U,Q){var K=D.selection.lastRange,re=K&&K.length===0?K.index:void 0;Y.call(D,function(){return D.editor.update(null,Q,re)},U)});var G=this.clipboard.convert(`<div class='ql-editor' style="white-space: normal;">`+q+"<p><br></p></div>");this.setContents(G),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return l(ee,[{key:"addContainer",value:function(D){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof D=="string"){var q=D;D=document.createElement("div"),D.classList.add(q)}return this.container.insertBefore(D,z),D}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(D,z,q){var G=this,U=X(D,z,q),Q=s(U,4);return D=Q[0],z=Q[1],q=Q[3],Y.call(this,function(){return G.editor.deleteText(D,z)},q,D,-1*z)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(D),this.container.classList.toggle("ql-disabled",!D)}},{key:"focus",value:function(){var D=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=D,this.scrollIntoView()}},{key:"format",value:function(D,z){var q=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p.default.sources.API;return Y.call(this,function(){var U=q.getSelection(!0),Q=new u.default;if(U==null)return Q;if(x.default.query(D,x.default.Scope.BLOCK))Q=q.editor.formatLine(U.index,U.length,C({},D,z));else{if(U.length===0)return q.selection.format(D,z),Q;Q=q.editor.formatText(U.index,U.length,C({},D,z))}return q.setSelection(U,p.default.sources.SILENT),Q},G)}},{key:"formatLine",value:function(D,z,q,G,U){var Q=this,K=void 0,re=X(D,z,q,G,U),H=s(re,4);return D=H[0],z=H[1],K=H[2],U=H[3],Y.call(this,function(){return Q.editor.formatLine(D,z,K)},U,D,0)}},{key:"formatText",value:function(D,z,q,G,U){var Q=this,K=void 0,re=X(D,z,q,G,U),H=s(re,4);return D=H[0],z=H[1],K=H[2],U=H[3],Y.call(this,function(){return Q.editor.formatText(D,z,K)},U,D,0)}},{key:"getBounds",value:function(D){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,q=void 0;typeof D=="number"?q=this.selection.getBounds(D,z):q=this.selection.getBounds(D.index,D.length);var G=this.container.getBoundingClientRect();return{bottom:q.bottom-G.top,height:q.height,left:q.left-G.left,right:q.right-G.left,top:q.top-G.top,width:q.width}}},{key:"getContents",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,q=X(D,z),G=s(q,2);return D=G[0],z=G[1],this.editor.getContents(D,z)}},{key:"getFormat",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof D=="number"?this.editor.getFormat(D,z):this.editor.getFormat(D.index,D.length)}},{key:"getIndex",value:function(D){return D.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(D){return this.scroll.leaf(D)}},{key:"getLine",value:function(D){return this.scroll.line(D)}},{key:"getLines",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof D!="number"?this.scroll.lines(D.index,D.length):this.scroll.lines(D,z)}},{key:"getModule",value:function(D){return this.theme.modules[D]}},{key:"getSelection",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return D&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-D,q=X(D,z),G=s(q,2);return D=G[0],z=G[1],this.editor.getText(D,z)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(D,z,q){var G=this,U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:ee.sources.API;return Y.call(this,function(){return G.editor.insertEmbed(D,z,q)},U,D)}},{key:"insertText",value:function(D,z,q,G,U){var Q=this,K=void 0,re=X(D,0,q,G,U),H=s(re,4);return D=H[0],K=H[2],U=H[3],Y.call(this,function(){return Q.editor.insertText(D,z,K)},U,D,z.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(D,z,q){this.clipboard.dangerouslyPasteHTML(D,z,q)}},{key:"removeFormat",value:function(D,z,q){var G=this,U=X(D,z,q),Q=s(U,4);return D=Q[0],z=Q[1],q=Q[3],Y.call(this,function(){return G.editor.removeFormat(D,z)},q,D)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(D){var z=this,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.default.sources.API;return Y.call(this,function(){D=new u.default(D);var G=z.getLength(),U=z.editor.deleteText(0,G),Q=z.editor.applyDelta(D),K=Q.ops[Q.ops.length-1];K!=null&&typeof K.insert=="string"&&K.insert[K.insert.length-1]===`
`&&(z.editor.deleteText(z.getLength()-1,1),Q.delete(1));var re=U.compose(Q);return re},q)}},{key:"setSelection",value:function(D,z,q){if(D==null)this.selection.setRange(null,z||ee.sources.API);else{var G=X(D,z,q),U=s(G,4);D=U[0],z=U[1],q=U[3],this.selection.setRange(new w.Range(D,z),q),q!==p.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(D){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.default.sources.API,q=new u.default().insert(D);return this.setContents(q,z)}},{key:"update",value:function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p.default.sources.USER,z=this.scroll.update(D);return this.selection.update(D),z}},{key:"updateContents",value:function(D){var z=this,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.default.sources.API;return Y.call(this,function(){return D=new u.default(D),z.editor.applyDelta(D,q)},q,!0)}}]),ee})();F.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},F.events=p.default.events,F.sources=p.default.sources,F.version="1.3.7",F.imports={delta:u.default,parchment:x.default,"core/module":m.default,"core/theme":N.default};function M(ee,V){if(V=(0,_.default)(!0,{container:ee,modules:{clipboard:!0,keyboard:!0,history:!0}},V),!V.theme||V.theme===F.DEFAULTS.theme)V.theme=N.default;else if(V.theme=F.import("themes/"+V.theme),V.theme==null)throw new Error("Invalid theme "+V.theme+". Did you register it?");var D=(0,_.default)(!0,{},V.theme.DEFAULTS);[D,V].forEach(function(G){G.modules=G.modules||{},Object.keys(G.modules).forEach(function(U){G.modules[U]===!0&&(G.modules[U]={})})});var z=Object.keys(D.modules).concat(Object.keys(V.modules)),q=z.reduce(function(G,U){var Q=F.import("modules/"+U);return Q==null?R.error("Cannot load "+U+" module. Are you sure you registered it?"):G[U]=Q.DEFAULTS||{},G},{});return V.modules!=null&&V.modules.toolbar&&V.modules.toolbar.constructor!==Object&&(V.modules.toolbar={container:V.modules.toolbar}),V=(0,_.default)(!0,{},F.DEFAULTS,{modules:q},D,V),["bounds","container","scrollingContainer"].forEach(function(G){typeof V[G]=="string"&&(V[G]=document.querySelector(V[G]))}),V.modules=Object.keys(V.modules).reduce(function(G,U){return V.modules[U]&&(G[U]=V.modules[U]),G},{}),V}function Y(ee,V,D,z){if(this.options.strict&&!this.isEnabled()&&V===p.default.sources.USER)return new u.default;var q=D==null?null:this.getSelection(),G=this.editor.delta,U=ee();if(q!=null&&(D===!0&&(D=q.index),z==null?q=$(q,U,V):z!==0&&(q=$(q,D,z,V)),this.setSelection(q,p.default.sources.SILENT)),U.length()>0){var Q,K=[p.default.events.TEXT_CHANGE,U,G,V];if((Q=this.emitter).emit.apply(Q,[p.default.events.EDITOR_CHANGE].concat(K)),V!==p.default.sources.SILENT){var re;(re=this.emitter).emit.apply(re,K)}}return U}function X(ee,V,D,z,q){var G={};return typeof ee.index=="number"&&typeof ee.length=="number"?typeof V!="number"?(q=z,z=D,D=V,V=ee.length,ee=ee.index):(V=ee.length,ee=ee.index):typeof V!="number"&&(q=z,z=D,D=V,V=0),(typeof D>"u"?"undefined":a(D))==="object"?(G=D,q=z):typeof D=="string"&&(z!=null?G[D]=z:q=D),q=q||p.default.sources.API,[ee,V,G,q]}function $(ee,V,D,z){if(ee==null)return null;var q=void 0,G=void 0;if(V instanceof u.default){var U=[ee.index,ee.index+ee.length].map(function(H){return V.transformPosition(H,z!==p.default.sources.USER)}),Q=s(U,2);q=Q[0],G=Q[1]}else{var K=[ee.index,ee.index+ee.length].map(function(H){return H<V||H===V&&z===p.default.sources.USER?H:D>=0?H+D:Math.max(V,H+D)}),re=s(K,2);q=re[0],G=re[1]}return new w.Range(q,G-q)}n.expandConfig=M,n.overload=X,n.default=F}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function b(x,w){for(var k=0;k<w.length;k++){var j=w[k];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(x,j.key,j)}}return function(x,w,k){return w&&b(x.prototype,w),k&&b(x,k),x}})(),s=function b(x,w,k){x===null&&(x=Function.prototype);var j=Object.getOwnPropertyDescriptor(x,w);if(j===void 0){var _=Object.getPrototypeOf(x);return _===null?void 0:b(_,w,k)}else{if("value"in j)return j.value;var T=j.get;return T===void 0?void 0:T.call(k)}},l=o(7),c=f(l),u=o(0),d=f(u);function f(b){return b&&b.__esModule?b:{default:b}}function h(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function p(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function v(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var m=(function(b){v(x,b);function x(){return h(this,x),p(this,(x.__proto__||Object.getPrototypeOf(x)).apply(this,arguments))}return a(x,[{key:"formatAt",value:function(k,j,_,T){if(x.compare(this.statics.blotName,_)<0&&d.default.query(_,d.default.Scope.BLOT)){var A=this.isolate(k,j);T&&A.wrap(_,T)}else s(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"formatAt",this).call(this,k,j,_,T)}},{key:"optimize",value:function(k){if(s(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"optimize",this).call(this,k),this.parent instanceof x&&x.compare(this.statics.blotName,this.parent.statics.blotName)>0){var j=this.parent.isolate(this.offset(),this.length());this.moveChildren(j),j.wrap(this)}}}],[{key:"compare",value:function(k,j){var _=x.order.indexOf(k),T=x.order.indexOf(j);return _>=0||T>=0?_-T:k===j?0:k<j?-1:1}}]),x})(d.default.Inline);m.allowedChildren=[m,d.default.Embed,c.default],m.order=["cursor","inline","underline","strike","italic","bold","script","link","code"],n.default=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(0),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}function c(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function u(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function d(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var f=(function(h){d(p,h);function p(){return c(this,p),u(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return p})(s.default.Text);n.default=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function w(k,j){for(var _=0;_<j.length;_++){var T=j[_];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(k,T.key,T)}}return function(k,j,_){return j&&w(k.prototype,j),_&&w(k,_),k}})(),s=function w(k,j,_){k===null&&(k=Function.prototype);var T=Object.getOwnPropertyDescriptor(k,j);if(T===void 0){var A=Object.getPrototypeOf(k);return A===null?void 0:w(A,j,_)}else{if("value"in T)return T.value;var P=T.get;return P===void 0?void 0:P.call(_)}},l=o(54),c=f(l),u=o(10),d=f(u);function f(w){return w&&w.__esModule?w:{default:w}}function h(w,k){if(!(w instanceof k))throw new TypeError("Cannot call a class as a function")}function p(w,k){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:w}function v(w,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);w.prototype=Object.create(k&&k.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(w,k):w.__proto__=k)}var m=(0,d.default)("quill:events"),b=["selectionchange","mousedown","mouseup","click"];b.forEach(function(w){document.addEventListener(w,function(){for(var k=arguments.length,j=Array(k),_=0;_<k;_++)j[_]=arguments[_];[].slice.call(document.querySelectorAll(".ql-container")).forEach(function(T){if(T.__quill&&T.__quill.emitter){var A;(A=T.__quill.emitter).handleDOM.apply(A,j)}})})});var x=(function(w){v(k,w);function k(){h(this,k);var j=p(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));return j.listeners={},j.on("error",m.error),j}return a(k,[{key:"emit",value:function(){m.log.apply(m,arguments),s(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"emit",this).apply(this,arguments)}},{key:"handleDOM",value:function(_){for(var T=arguments.length,A=Array(T>1?T-1:0),P=1;P<T;P++)A[P-1]=arguments[P];(this.listeners[_.type]||[]).forEach(function(N){var O=N.node,C=N.handler;(_.target===O||O.contains(_.target))&&C.apply(void 0,[_].concat(A))})}},{key:"listenDOM",value:function(_,T,A){this.listeners[_]||(this.listeners[_]=[]),this.listeners[_].push({node:T,handler:A})}}]),k})(c.default);x.events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},x.sources={API:"api",SILENT:"silent",USER:"user"},n.default=x}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});function a(l,c){if(!(l instanceof c))throw new TypeError("Cannot call a class as a function")}var s=function l(c){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};a(this,l),this.quill=c,this.options=u};s.DEFAULTS={},n.default=s}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=["error","warn","log","info"],s="warn";function l(u){if(a.indexOf(u)<=a.indexOf(s)){for(var d,f=arguments.length,h=Array(f>1?f-1:0),p=1;p<f;p++)h[p-1]=arguments[p];(d=console)[u].apply(d,h)}}function c(u){return a.reduce(function(d,f){return d[f]=l.bind(console,f,u),d},{})}l.level=c.level=function(u){s=u},n.default=c}),(function(r,n,o){var a=Array.prototype.slice,s=o(52),l=o(53),c=r.exports=function(h,p,v){return v||(v={}),h===p?!0:h instanceof Date&&p instanceof Date?h.getTime()===p.getTime():!h||!p||typeof h!="object"&&typeof p!="object"?v.strict?h===p:h==p:f(h,p,v)};function u(h){return h==null}function d(h){return!(!h||typeof h!="object"||typeof h.length!="number"||typeof h.copy!="function"||typeof h.slice!="function"||h.length>0&&typeof h[0]!="number")}function f(h,p,v){var m,b;if(u(h)||u(p)||h.prototype!==p.prototype)return!1;if(l(h))return l(p)?(h=a.call(h),p=a.call(p),c(h,p,v)):!1;if(d(h)){if(!d(p)||h.length!==p.length)return!1;for(m=0;m<h.length;m++)if(h[m]!==p[m])return!1;return!0}try{var x=s(h),w=s(p)}catch{return!1}if(x.length!=w.length)return!1;for(x.sort(),w.sort(),m=x.length-1;m>=0;m--)if(x[m]!=w[m])return!1;for(m=x.length-1;m>=0;m--)if(b=x[m],!c(h[b],p[b],v))return!1;return typeof h==typeof p}}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(1),s=(function(){function l(c,u,d){d===void 0&&(d={}),this.attrName=c,this.keyName=u;var f=a.Scope.TYPE&a.Scope.ATTRIBUTE;d.scope!=null?this.scope=d.scope&a.Scope.LEVEL|f:this.scope=a.Scope.ATTRIBUTE,d.whitelist!=null&&(this.whitelist=d.whitelist)}return l.keys=function(c){return[].map.call(c.attributes,function(u){return u.name})},l.prototype.add=function(c,u){return this.canAdd(c,u)?(c.setAttribute(this.keyName,u),!0):!1},l.prototype.canAdd=function(c,u){var d=a.query(c,a.Scope.BLOT&(this.scope|a.Scope.TYPE));return d==null?!1:this.whitelist==null?!0:typeof u=="string"?this.whitelist.indexOf(u.replace(/["']/g,""))>-1:this.whitelist.indexOf(u)>-1},l.prototype.remove=function(c){c.removeAttribute(this.keyName)},l.prototype.value=function(c){var u=c.getAttribute(this.keyName);return this.canAdd(c,u)&&u?u:""},l})();n.default=s}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Code=void 0;var a=(function(){function P(N,O){var C=[],I=!0,R=!1,F=void 0;try{for(var M=N[Symbol.iterator](),Y;!(I=(Y=M.next()).done)&&(C.push(Y.value),!(O&&C.length===O));I=!0);}catch(X){R=!0,F=X}finally{try{!I&&M.return&&M.return()}finally{if(R)throw F}}return C}return function(N,O){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return P(N,O);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function P(N,O){for(var C=0;C<O.length;C++){var I=O[C];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(N,I.key,I)}}return function(N,O,C){return O&&P(N.prototype,O),C&&P(N,C),N}})(),l=function P(N,O,C){N===null&&(N=Function.prototype);var I=Object.getOwnPropertyDescriptor(N,O);if(I===void 0){var R=Object.getPrototypeOf(N);return R===null?void 0:P(R,O,C)}else{if("value"in I)return I.value;var F=I.get;return F===void 0?void 0:F.call(C)}},c=o(2),u=w(c),d=o(0),f=w(d),h=o(4),p=w(h),v=o(6),m=w(v),b=o(7),x=w(b);function w(P){return P&&P.__esModule?P:{default:P}}function k(P,N){if(!(P instanceof N))throw new TypeError("Cannot call a class as a function")}function j(P,N){if(!P)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return N&&(typeof N=="object"||typeof N=="function")?N:P}function _(P,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof N);P.prototype=Object.create(N&&N.prototype,{constructor:{value:P,enumerable:!1,writable:!0,configurable:!0}}),N&&(Object.setPrototypeOf?Object.setPrototypeOf(P,N):P.__proto__=N)}var T=(function(P){_(N,P);function N(){return k(this,N),j(this,(N.__proto__||Object.getPrototypeOf(N)).apply(this,arguments))}return N})(m.default);T.blotName="code",T.tagName="CODE";var A=(function(P){_(N,P);function N(){return k(this,N),j(this,(N.__proto__||Object.getPrototypeOf(N)).apply(this,arguments))}return s(N,[{key:"delta",value:function(){var C=this,I=this.domNode.textContent;return I.endsWith(`
`)&&(I=I.slice(0,-1)),I.split(`
`).reduce(function(R,F){return R.insert(F).insert(`
`,C.formats())},new u.default)}},{key:"format",value:function(C,I){if(!(C===this.statics.blotName&&I)){var R=this.descendant(x.default,this.length()-1),F=a(R,1),M=F[0];M!=null&&M.deleteAt(M.length()-1,1),l(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"format",this).call(this,C,I)}}},{key:"formatAt",value:function(C,I,R,F){if(I!==0&&!(f.default.query(R,f.default.Scope.BLOCK)==null||R===this.statics.blotName&&F===this.statics.formats(this.domNode))){var M=this.newlineIndex(C);if(!(M<0||M>=C+I)){var Y=this.newlineIndex(C,!0)+1,X=M-Y+1,$=this.isolate(Y,X),ee=$.next;$.format(R,F),ee instanceof N&&ee.formatAt(0,C-Y+I-X,R,F)}}}},{key:"insertAt",value:function(C,I,R){if(R==null){var F=this.descendant(x.default,C),M=a(F,2),Y=M[0],X=M[1];Y.insertAt(X,I)}}},{key:"length",value:function(){var C=this.domNode.textContent.length;return this.domNode.textContent.endsWith(`
`)?C:C+1}},{key:"newlineIndex",value:function(C){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(I)return this.domNode.textContent.slice(0,C).lastIndexOf(`
`);var R=this.domNode.textContent.slice(C).indexOf(`
`);return R>-1?C+R:-1}},{key:"optimize",value:function(C){this.domNode.textContent.endsWith(`
`)||this.appendChild(f.default.create("text",`
`)),l(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"optimize",this).call(this,C);var I=this.next;I!=null&&I.prev===this&&I.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===I.statics.formats(I.domNode)&&(I.optimize(C),I.moveChildren(this),I.remove())}},{key:"replace",value:function(C){l(N.prototype.__proto__||Object.getPrototypeOf(N.prototype),"replace",this).call(this,C),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(I){var R=f.default.find(I);R==null?I.parentNode.removeChild(I):R instanceof f.default.Embed?R.remove():R.unwrap()})}}],[{key:"create",value:function(C){var I=l(N.__proto__||Object.getPrototypeOf(N),"create",this).call(this,C);return I.setAttribute("spellcheck",!1),I}},{key:"formats",value:function(){return!0}}]),N})(p.default);A.blotName="code-block",A.tagName="PRE",A.TAB=" ",n.Code=T,n.default=A}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ee){return typeof ee}:function(ee){return ee&&typeof Symbol=="function"&&ee.constructor===Symbol&&ee!==Symbol.prototype?"symbol":typeof ee},s=(function(){function ee(V,D){var z=[],q=!0,G=!1,U=void 0;try{for(var Q=V[Symbol.iterator](),K;!(q=(K=Q.next()).done)&&(z.push(K.value),!(D&&z.length===D));q=!0);}catch(re){G=!0,U=re}finally{try{!q&&Q.return&&Q.return()}finally{if(G)throw U}}return z}return function(V,D){if(Array.isArray(V))return V;if(Symbol.iterator in Object(V))return ee(V,D);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function ee(V,D){for(var z=0;z<D.length;z++){var q=D[z];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(V,q.key,q)}}return function(V,D,z){return D&&ee(V.prototype,D),z&&ee(V,z),V}})(),c=o(2),u=I(c),d=o(20),f=I(d),h=o(0),p=I(h),v=o(13),m=I(v),b=o(24),x=I(b),w=o(4),k=I(w),j=o(16),_=I(j),T=o(21),A=I(T),P=o(11),N=I(P),O=o(3),C=I(O);function I(ee){return ee&&ee.__esModule?ee:{default:ee}}function R(ee,V,D){return V in ee?Object.defineProperty(ee,V,{value:D,enumerable:!0,configurable:!0,writable:!0}):ee[V]=D,ee}function F(ee,V){if(!(ee instanceof V))throw new TypeError("Cannot call a class as a function")}var M=/^[ -~]*$/,Y=(function(){function ee(V){F(this,ee),this.scroll=V,this.delta=this.getDelta()}return l(ee,[{key:"applyDelta",value:function(D){var z=this,q=!1;this.scroll.update();var G=this.scroll.length();return this.scroll.batchStart(),D=$(D),D.reduce(function(U,Q){var K=Q.retain||Q.delete||Q.insert.length||1,re=Q.attributes||{};if(Q.insert!=null){if(typeof Q.insert=="string"){var H=Q.insert;H.endsWith(`
`)&&q&&(q=!1,H=H.slice(0,-1)),U>=G&&!H.endsWith(`
`)&&(q=!0),z.scroll.insertAt(U,H);var ie=z.scroll.line(U),de=s(ie,2),le=de[0],ke=de[1],ve=(0,C.default)({},(0,w.bubbleFormats)(le));if(le instanceof k.default){var se=le.descendant(p.default.Leaf,ke),be=s(se,1),De=be[0];ve=(0,C.default)(ve,(0,w.bubbleFormats)(De))}re=f.default.attributes.diff(ve,re)||{}}else if(a(Q.insert)==="object"){var ae=Object.keys(Q.insert)[0];if(ae==null)return U;z.scroll.insertAt(U,ae,Q.insert[ae])}G+=K}return Object.keys(re).forEach(function(ue){z.scroll.formatAt(U,K,ue,re[ue])}),U+K},0),D.reduce(function(U,Q){return typeof Q.delete=="number"?(z.scroll.deleteAt(U,Q.delete),U):U+(Q.retain||Q.insert.length||1)},0),this.scroll.batchEnd(),this.update(D)}},{key:"deleteText",value:function(D,z){return this.scroll.deleteAt(D,z),this.update(new u.default().retain(D).delete(z))}},{key:"formatLine",value:function(D,z){var q=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.scroll.update(),Object.keys(G).forEach(function(U){if(!(q.scroll.whitelist!=null&&!q.scroll.whitelist[U])){var Q=q.scroll.lines(D,Math.max(z,1)),K=z;Q.forEach(function(re){var H=re.length();if(!(re instanceof m.default))re.format(U,G[U]);else{var ie=D-re.offset(q.scroll),de=re.newlineIndex(ie+K)-ie+1;re.formatAt(ie,de,U,G[U])}K-=H})}}),this.scroll.optimize(),this.update(new u.default().retain(D).retain(z,(0,A.default)(G)))}},{key:"formatText",value:function(D,z){var q=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Object.keys(G).forEach(function(U){q.scroll.formatAt(D,z,U,G[U])}),this.update(new u.default().retain(D).retain(z,(0,A.default)(G)))}},{key:"getContents",value:function(D,z){return this.delta.slice(D,D+z)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(D,z){return D.concat(z.delta())},new u.default)}},{key:"getFormat",value:function(D){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,q=[],G=[];z===0?this.scroll.path(D).forEach(function(Q){var K=s(Q,1),re=K[0];re instanceof k.default?q.push(re):re instanceof p.default.Leaf&&G.push(re)}):(q=this.scroll.lines(D,z),G=this.scroll.descendants(p.default.Leaf,D,z));var U=[q,G].map(function(Q){if(Q.length===0)return{};for(var K=(0,w.bubbleFormats)(Q.shift());Object.keys(K).length>0;){var re=Q.shift();if(re==null)return K;K=X((0,w.bubbleFormats)(re),K)}return K});return C.default.apply(C.default,U)}},{key:"getText",value:function(D,z){return this.getContents(D,z).filter(function(q){return typeof q.insert=="string"}).map(function(q){return q.insert}).join("")}},{key:"insertEmbed",value:function(D,z,q){return this.scroll.insertAt(D,z,q),this.update(new u.default().retain(D).insert(R({},z,q)))}},{key:"insertText",value:function(D,z){var q=this,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return z=z.replace(/\r\n/g,`
`).replace(/\r/g,`
`),this.scroll.insertAt(D,z),Object.keys(G).forEach(function(U){q.scroll.formatAt(D,z.length,U,G[U])}),this.update(new u.default().retain(D).insert(z,(0,A.default)(G)))}},{key:"isBlank",value:function(){if(this.scroll.children.length==0)return!0;if(this.scroll.children.length>1)return!1;var D=this.scroll.children.head;return D.statics.blotName!==k.default.blotName||D.children.length>1?!1:D.children.head instanceof _.default}},{key:"removeFormat",value:function(D,z){var q=this.getText(D,z),G=this.scroll.line(D+z),U=s(G,2),Q=U[0],K=U[1],re=0,H=new u.default;Q!=null&&(Q instanceof m.default?re=Q.newlineIndex(K)-K+1:re=Q.length()-K,H=Q.delta().slice(K,K+re-1).insert(`
`));var ie=this.getContents(D,z+re),de=ie.diff(new u.default().insert(q).concat(H)),le=new u.default().retain(D).concat(de);return this.applyDelta(le)}},{key:"update",value:function(D){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,G=this.delta;if(z.length===1&&z[0].type==="characterData"&&z[0].target.data.match(M)&&p.default.find(z[0].target)){var U=p.default.find(z[0].target),Q=(0,w.bubbleFormats)(U),K=U.offset(this.scroll),re=z[0].oldValue.replace(x.default.CONTENTS,""),H=new u.default().insert(re),ie=new u.default().insert(U.value()),de=new u.default().retain(K).concat(H.diff(ie,q));D=de.reduce(function(le,ke){return ke.insert?le.insert(ke.insert,Q):le.push(ke)},new u.default),this.delta=G.compose(D)}else this.delta=this.getDelta(),(!D||!(0,N.default)(G.compose(D),this.delta))&&(D=G.diff(this.delta,q));return D}}]),ee})();function X(ee,V){return Object.keys(V).reduce(function(D,z){return ee[z]==null||(V[z]===ee[z]?D[z]=V[z]:Array.isArray(V[z])?V[z].indexOf(ee[z])<0&&(D[z]=V[z].concat([ee[z]])):D[z]=[V[z],ee[z]]),D},{})}function $(ee){return ee.reduce(function(V,D){if(D.insert===1){var z=(0,A.default)(D.attributes);return delete z.image,V.insert({image:D.attributes.image},z)}if(D.attributes!=null&&(D.attributes.list===!0||D.attributes.bullet===!0)&&(D=(0,A.default)(D),D.attributes.list?D.attributes.list="ordered":(D.attributes.list="bullet",delete D.attributes.bullet)),typeof D.insert=="string"){var q=D.insert.replace(/\r\n/g,`
`).replace(/\r/g,`
`);return V.insert(q,D.attributes)}return V.push(D)},new u.default)}n.default=Y}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.Range=void 0;var a=(function(){function P(N,O){var C=[],I=!0,R=!1,F=void 0;try{for(var M=N[Symbol.iterator](),Y;!(I=(Y=M.next()).done)&&(C.push(Y.value),!(O&&C.length===O));I=!0);}catch(X){R=!0,F=X}finally{try{!I&&M.return&&M.return()}finally{if(R)throw F}}return C}return function(N,O){if(Array.isArray(N))return N;if(Symbol.iterator in Object(N))return P(N,O);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function P(N,O){for(var C=0;C<O.length;C++){var I=O[C];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(N,I.key,I)}}return function(N,O,C){return O&&P(N.prototype,O),C&&P(N,C),N}})(),l=o(0),c=x(l),u=o(21),d=x(u),f=o(11),h=x(f),p=o(8),v=x(p),m=o(10),b=x(m);function x(P){return P&&P.__esModule?P:{default:P}}function w(P){if(Array.isArray(P)){for(var N=0,O=Array(P.length);N<P.length;N++)O[N]=P[N];return O}else return Array.from(P)}function k(P,N){if(!(P instanceof N))throw new TypeError("Cannot call a class as a function")}var j=(0,b.default)("quill:selection"),_=function P(N){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;k(this,P),this.index=N,this.length=O},T=(function(){function P(N,O){var C=this;k(this,P),this.emitter=O,this.scroll=N,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=c.default.create("cursor",this),this.lastRange=this.savedRange=new _(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){C.mouseDown||setTimeout(C.update.bind(C,v.default.sources.USER),1)}),this.emitter.on(v.default.events.EDITOR_CHANGE,function(I,R){I===v.default.events.TEXT_CHANGE&&R.length()>0&&C.update(v.default.sources.SILENT)}),this.emitter.on(v.default.events.SCROLL_BEFORE_UPDATE,function(){if(C.hasFocus()){var I=C.getNativeRange();I!=null&&I.start.node!==C.cursor.textNode&&C.emitter.once(v.default.events.SCROLL_UPDATE,function(){try{C.setNativeRange(I.start.node,I.start.offset,I.end.node,I.end.offset)}catch{}})}}),this.emitter.on(v.default.events.SCROLL_OPTIMIZE,function(I,R){if(R.range){var F=R.range,M=F.startNode,Y=F.startOffset,X=F.endNode,$=F.endOffset;C.setNativeRange(M,Y,X,$)}}),this.update(v.default.sources.SILENT)}return s(P,[{key:"handleComposition",value:function(){var O=this;this.root.addEventListener("compositionstart",function(){O.composing=!0}),this.root.addEventListener("compositionend",function(){if(O.composing=!1,O.cursor.parent){var C=O.cursor.restore();if(!C)return;setTimeout(function(){O.setNativeRange(C.startNode,C.startOffset,C.endNode,C.endOffset)},1)}})}},{key:"handleDragging",value:function(){var O=this;this.emitter.listenDOM("mousedown",document.body,function(){O.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){O.mouseDown=!1,O.update(v.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(O,C){if(!(this.scroll.whitelist!=null&&!this.scroll.whitelist[O])){this.scroll.update();var I=this.getNativeRange();if(!(I==null||!I.native.collapsed||c.default.query(O,c.default.Scope.BLOCK))){if(I.start.node!==this.cursor.textNode){var R=c.default.find(I.start.node,!1);if(R==null)return;if(R instanceof c.default.Leaf){var F=R.split(I.start.offset);R.parent.insertBefore(this.cursor,F)}else R.insertBefore(this.cursor,I.start.node);this.cursor.attach()}this.cursor.format(O,C),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,I=this.scroll.length();O=Math.min(O,I-1),C=Math.min(O+C,I-1)-O;var R=void 0,F=this.scroll.leaf(O),M=a(F,2),Y=M[0],X=M[1];if(Y==null)return null;var $=Y.position(X,!0),ee=a($,2);R=ee[0],X=ee[1];var V=document.createRange();if(C>0){V.setStart(R,X);var D=this.scroll.leaf(O+C),z=a(D,2);if(Y=z[0],X=z[1],Y==null)return null;var q=Y.position(X,!0),G=a(q,2);return R=G[0],X=G[1],V.setEnd(R,X),V.getBoundingClientRect()}else{var U="left",Q=void 0;return R instanceof Text?(X<R.data.length?(V.setStart(R,X),V.setEnd(R,X+1)):(V.setStart(R,X-1),V.setEnd(R,X),U="right"),Q=V.getBoundingClientRect()):(Q=Y.domNode.getBoundingClientRect(),X>0&&(U="right")),{bottom:Q.top+Q.height,height:Q.height,left:Q[U],right:Q[U],top:Q.top,width:0}}}},{key:"getNativeRange",value:function(){var O=document.getSelection();if(O==null||O.rangeCount<=0)return null;var C=O.getRangeAt(0);if(C==null)return null;var I=this.normalizeNative(C);return j.info("getNativeRange",I),I}},{key:"getRange",value:function(){var O=this.getNativeRange();if(O==null)return[null,null];var C=this.normalizedToRange(O);return[C,O]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(O){var C=this,I=[[O.start.node,O.start.offset]];O.native.collapsed||I.push([O.end.node,O.end.offset]);var R=I.map(function(Y){var X=a(Y,2),$=X[0],ee=X[1],V=c.default.find($,!0),D=V.offset(C.scroll);return ee===0?D:V instanceof c.default.Container?D+V.length():D+V.index($,ee)}),F=Math.min(Math.max.apply(Math,w(R)),this.scroll.length()-1),M=Math.min.apply(Math,[F].concat(w(R)));return new _(M,F-M)}},{key:"normalizeNative",value:function(O){if(!A(this.root,O.startContainer)||!O.collapsed&&!A(this.root,O.endContainer))return null;var C={start:{node:O.startContainer,offset:O.startOffset},end:{node:O.endContainer,offset:O.endOffset},native:O};return[C.start,C.end].forEach(function(I){for(var R=I.node,F=I.offset;!(R instanceof Text)&&R.childNodes.length>0;)if(R.childNodes.length>F)R=R.childNodes[F],F=0;else if(R.childNodes.length===F)R=R.lastChild,F=R instanceof Text?R.data.length:R.childNodes.length+1;else break;I.node=R,I.offset=F}),C}},{key:"rangeToNative",value:function(O){var C=this,I=O.collapsed?[O.index]:[O.index,O.index+O.length],R=[],F=this.scroll.length();return I.forEach(function(M,Y){M=Math.min(F-1,M);var X=void 0,$=C.scroll.leaf(M),ee=a($,2),V=ee[0],D=ee[1],z=V.position(D,Y!==0),q=a(z,2);X=q[0],D=q[1],R.push(X,D)}),R.length<2&&(R=R.concat(R)),R}},{key:"scrollIntoView",value:function(O){var C=this.lastRange;if(C!=null){var I=this.getBounds(C.index,C.length);if(I!=null){var R=this.scroll.length()-1,F=this.scroll.line(Math.min(C.index,R)),M=a(F,1),Y=M[0],X=Y;if(C.length>0){var $=this.scroll.line(Math.min(C.index+C.length,R)),ee=a($,1);X=ee[0]}if(!(Y==null||X==null)){var V=O.getBoundingClientRect();I.top<V.top?O.scrollTop-=V.top-I.top:I.bottom>V.bottom&&(O.scrollTop+=I.bottom-V.bottom)}}}}},{key:"setNativeRange",value:function(O,C){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:O,R=arguments.length>3&&arguments[3]!==void 0?arguments[3]:C,F=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(j.info("setNativeRange",O,C,I,R),!(O!=null&&(this.root.parentNode==null||O.parentNode==null||I.parentNode==null))){var M=document.getSelection();if(M!=null)if(O!=null){this.hasFocus()||this.root.focus();var Y=(this.getNativeRange()||{}).native;if(Y==null||F||O!==Y.startContainer||C!==Y.startOffset||I!==Y.endContainer||R!==Y.endOffset){O.tagName=="BR"&&(C=[].indexOf.call(O.parentNode.childNodes,O),O=O.parentNode),I.tagName=="BR"&&(R=[].indexOf.call(I.parentNode.childNodes,I),I=I.parentNode);var X=document.createRange();X.setStart(O,C),X.setEnd(I,R),M.removeAllRanges(),M.addRange(X)}}else M.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(O){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:v.default.sources.API;if(typeof C=="string"&&(I=C,C=!1),j.info("setRange",O),O!=null){var R=this.rangeToNative(O);this.setNativeRange.apply(this,w(R).concat([C]))}else this.setNativeRange(null);this.update(I)}},{key:"update",value:function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v.default.sources.USER,C=this.lastRange,I=this.getRange(),R=a(I,2),F=R[0],M=R[1];if(this.lastRange=F,this.lastRange!=null&&(this.savedRange=this.lastRange),!(0,h.default)(C,this.lastRange)){var Y;!this.composing&&M!=null&&M.native.collapsed&&M.start.node!==this.cursor.textNode&&this.cursor.restore();var X=[v.default.events.SELECTION_CHANGE,(0,d.default)(this.lastRange),(0,d.default)(C),O];if((Y=this.emitter).emit.apply(Y,[v.default.events.EDITOR_CHANGE].concat(X)),O!==v.default.sources.SILENT){var $;($=this.emitter).emit.apply($,X)}}}}]),P})();function A(P,N){try{N.parentNode}catch{return!1}return N instanceof Text&&(N=N.parentNode),P.contains(N)}n.Range=_,n.default=T}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(m,b){for(var x=0;x<b.length;x++){var w=b[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(m,w.key,w)}}return function(m,b,x){return b&&v(m.prototype,b),x&&v(m,x),m}})(),s=function v(m,b,x){m===null&&(m=Function.prototype);var w=Object.getOwnPropertyDescriptor(m,b);if(w===void 0){var k=Object.getPrototypeOf(m);return k===null?void 0:v(k,b,x)}else{if("value"in w)return w.value;var j=w.get;return j===void 0?void 0:j.call(x)}},l=o(0),c=u(l);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function f(v,m){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:v}function h(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(v,m):v.__proto__=m)}var p=(function(v){h(m,v);function m(){return d(this,m),f(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return a(m,[{key:"insertInto",value:function(x,w){x.children.length===0?s(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"insertInto",this).call(this,x,w):this.remove()}},{key:"length",value:function(){return 0}},{key:"value",value:function(){return""}}],[{key:"value",value:function(){}}]),m})(c.default.Embed);p.blotName="break",p.tagName="BR",n.default=p}),(function(r,n,o){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var v in p)p.hasOwnProperty(v)&&(h[v]=p[v])};return function(h,p){f(h,p);function v(){this.constructor=h}h.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(44),l=o(30),c=o(1),u=(function(f){a(h,f);function h(p){var v=f.call(this,p)||this;return v.build(),v}return h.prototype.appendChild=function(p){this.insertBefore(p)},h.prototype.attach=function(){f.prototype.attach.call(this),this.children.forEach(function(p){p.attach()})},h.prototype.build=function(){var p=this;this.children=new s.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(v){try{var m=d(v);p.insertBefore(m,p.children.head||void 0)}catch(b){if(b instanceof c.ParchmentError)return;throw b}})},h.prototype.deleteAt=function(p,v){if(p===0&&v===this.length())return this.remove();this.children.forEachAt(p,v,function(m,b,x){m.deleteAt(b,x)})},h.prototype.descendant=function(p,v){var m=this.children.find(v),b=m[0],x=m[1];return p.blotName==null&&p(b)||p.blotName!=null&&b instanceof p?[b,x]:b instanceof h?b.descendant(p,x):[null,-1]},h.prototype.descendants=function(p,v,m){v===void 0&&(v=0),m===void 0&&(m=Number.MAX_VALUE);var b=[],x=m;return this.children.forEachAt(v,m,function(w,k,j){(p.blotName==null&&p(w)||p.blotName!=null&&w instanceof p)&&b.push(w),w instanceof h&&(b=b.concat(w.descendants(p,k,x))),x-=j}),b},h.prototype.detach=function(){this.children.forEach(function(p){p.detach()}),f.prototype.detach.call(this)},h.prototype.formatAt=function(p,v,m,b){this.children.forEachAt(p,v,function(x,w,k){x.formatAt(w,k,m,b)})},h.prototype.insertAt=function(p,v,m){var b=this.children.find(p),x=b[0],w=b[1];if(x)x.insertAt(w,v,m);else{var k=m==null?c.create("text",v):c.create(v,m);this.appendChild(k)}},h.prototype.insertBefore=function(p,v){if(this.statics.allowedChildren!=null&&!this.statics.allowedChildren.some(function(m){return p instanceof m}))throw new c.ParchmentError("Cannot insert "+p.statics.blotName+" into "+this.statics.blotName);p.insertInto(this,v)},h.prototype.length=function(){return this.children.reduce(function(p,v){return p+v.length()},0)},h.prototype.moveChildren=function(p,v){this.children.forEach(function(m){p.insertBefore(m,v)})},h.prototype.optimize=function(p){if(f.prototype.optimize.call(this,p),this.children.length===0)if(this.statics.defaultChild!=null){var v=c.create(this.statics.defaultChild);this.appendChild(v),v.optimize(p)}else this.remove()},h.prototype.path=function(p,v){v===void 0&&(v=!1);var m=this.children.find(p,v),b=m[0],x=m[1],w=[[this,p]];return b instanceof h?w.concat(b.path(x,v)):(b!=null&&w.push([b,x]),w)},h.prototype.removeChild=function(p){this.children.remove(p)},h.prototype.replace=function(p){p instanceof h&&p.moveChildren(this),f.prototype.replace.call(this,p)},h.prototype.split=function(p,v){if(v===void 0&&(v=!1),!v){if(p===0)return this;if(p===this.length())return this.next}var m=this.clone();return this.parent.insertBefore(m,this.next),this.children.forEachAt(p,this.length(),function(b,x,w){b=b.split(x,v),m.appendChild(b)}),m},h.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},h.prototype.update=function(p,v){var m=this,b=[],x=[];p.forEach(function(w){w.target===m.domNode&&w.type==="childList"&&(b.push.apply(b,w.addedNodes),x.push.apply(x,w.removedNodes))}),x.forEach(function(w){if(!(w.parentNode!=null&&w.tagName!=="IFRAME"&&document.body.compareDocumentPosition(w)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var k=c.find(w);k!=null&&(k.domNode.parentNode==null||k.domNode.parentNode===m.domNode)&&k.detach()}}),b.filter(function(w){return w.parentNode==m.domNode}).sort(function(w,k){return w===k?0:w.compareDocumentPosition(k)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(w){var k=null;w.nextSibling!=null&&(k=c.find(w.nextSibling));var j=d(w);(j.next!=k||j.next==null)&&(j.parent!=null&&j.parent.removeChild(m),m.insertBefore(j,k||void 0))})},h})(l.default);function d(f){var h=c.find(f);if(h==null)try{h=c.create(f)}catch{h=c.create(c.Scope.INLINE),[].slice.call(f.childNodes).forEach(function(v){h.domNode.appendChild(v)}),f.parentNode&&f.parentNode.replaceChild(h.domNode,f),h.attach()}return h}n.default=u}),(function(r,n,o){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var v in p)p.hasOwnProperty(v)&&(h[v]=p[v])};return function(h,p){f(h,p);function v(){this.constructor=h}h.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(12),l=o(31),c=o(17),u=o(1),d=(function(f){a(h,f);function h(p){var v=f.call(this,p)||this;return v.attributes=new l.default(v.domNode),v}return h.formats=function(p){if(typeof this.tagName=="string")return!0;if(Array.isArray(this.tagName))return p.tagName.toLowerCase()},h.prototype.format=function(p,v){var m=u.query(p);m instanceof s.default?this.attributes.attribute(m,v):v&&m!=null&&(p!==this.statics.blotName||this.formats()[p]!==v)&&this.replaceWith(p,v)},h.prototype.formats=function(){var p=this.attributes.values(),v=this.statics.formats(this.domNode);return v!=null&&(p[this.statics.blotName]=v),p},h.prototype.replaceWith=function(p,v){var m=f.prototype.replaceWith.call(this,p,v);return this.attributes.copy(m),m},h.prototype.update=function(p,v){var m=this;f.prototype.update.call(this,p,v),p.some(function(b){return b.target===m.domNode&&b.type==="attributes"})&&this.attributes.build()},h.prototype.wrap=function(p,v){var m=f.prototype.wrap.call(this,p,v);return m instanceof h&&m.statics.scope===this.statics.scope&&this.attributes.move(m),m},h})(c.default);n.default=d}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(30),l=o(1),c=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.value=function(f){return!0},d.prototype.index=function(f,h){return this.domNode===f||this.domNode.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(h,1):-1},d.prototype.position=function(f,h){var p=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return f>0&&(p+=1),[this.parent.domNode,p]},d.prototype.value=function(){var f;return f={},f[this.statics.blotName]=this.statics.value(this.domNode)||!0,f},d.scope=l.Scope.INLINE_BLOT,d})(s.default);n.default=c}),(function(r,n,o){var a=o(11),s=o(3),l={attributes:{compose:function(u,d,f){typeof u!="object"&&(u={}),typeof d!="object"&&(d={});var h=s(!0,{},d);f||(h=Object.keys(h).reduce(function(v,m){return h[m]!=null&&(v[m]=h[m]),v},{}));for(var p in u)u[p]!==void 0&&d[p]===void 0&&(h[p]=u[p]);return Object.keys(h).length>0?h:void 0},diff:function(u,d){typeof u!="object"&&(u={}),typeof d!="object"&&(d={});var f=Object.keys(u).concat(Object.keys(d)).reduce(function(h,p){return a(u[p],d[p])||(h[p]=d[p]===void 0?null:d[p]),h},{});return Object.keys(f).length>0?f:void 0},transform:function(u,d,f){if(typeof u!="object")return d;if(typeof d=="object"){if(!f)return d;var h=Object.keys(d).reduce(function(p,v){return u[v]===void 0&&(p[v]=d[v]),p},{});return Object.keys(h).length>0?h:void 0}}},iterator:function(u){return new c(u)},length:function(u){return typeof u.delete=="number"?u.delete:typeof u.retain=="number"?u.retain:typeof u.insert=="string"?u.insert.length:1}};function c(u){this.ops=u,this.index=0,this.offset=0}c.prototype.hasNext=function(){return this.peekLength()<1/0},c.prototype.next=function(u){u||(u=1/0);var d=this.ops[this.index];if(d){var f=this.offset,h=l.length(d);if(u>=h-f?(u=h-f,this.index+=1,this.offset=0):this.offset+=u,typeof d.delete=="number")return{delete:u};var p={};return d.attributes&&(p.attributes=d.attributes),typeof d.retain=="number"?p.retain=u:typeof d.insert=="string"?p.insert=d.insert.substr(f,u):p.insert=d.insert,p}else return{retain:1/0}},c.prototype.peek=function(){return this.ops[this.index]},c.prototype.peekLength=function(){return this.ops[this.index]?l.length(this.ops[this.index])-this.offset:1/0},c.prototype.peekType=function(){return this.ops[this.index]?typeof this.ops[this.index].delete=="number"?"delete":typeof this.ops[this.index].retain=="number"?"retain":"insert":"retain"},c.prototype.rest=function(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);var u=this.offset,d=this.index,f=this.next(),h=this.ops.slice(this.index);return this.offset=u,this.index=d,[f].concat(h)}else return[]},r.exports=l}),(function(r,n){var o=(function(){function a(m,b){return b!=null&&m instanceof b}var s;try{s=Map}catch{s=function(){}}var l;try{l=Set}catch{l=function(){}}var c;try{c=Promise}catch{c=function(){}}function u(m,b,x,w,k){typeof b=="object"&&(x=b.depth,w=b.prototype,k=b.includeNonEnumerable,b=b.circular);var j=[],_=[],T=typeof Buffer<"u";typeof b>"u"&&(b=!0),typeof x>"u"&&(x=1/0);function A(P,N){if(P===null)return null;if(N===0)return P;var O,C;if(typeof P!="object")return P;if(a(P,s))O=new s;else if(a(P,l))O=new l;else if(a(P,c))O=new c(function(V,D){P.then(function(z){V(A(z,N-1))},function(z){D(A(z,N-1))})});else if(u.__isArray(P))O=[];else if(u.__isRegExp(P))O=new RegExp(P.source,v(P)),P.lastIndex&&(O.lastIndex=P.lastIndex);else if(u.__isDate(P))O=new Date(P.getTime());else{if(T&&Buffer.isBuffer(P))return Buffer.allocUnsafe?O=Buffer.allocUnsafe(P.length):O=new Buffer(P.length),P.copy(O),O;a(P,Error)?O=Object.create(P):typeof w>"u"?(C=Object.getPrototypeOf(P),O=Object.create(C)):(O=Object.create(w),C=w)}if(b){var I=j.indexOf(P);if(I!=-1)return _[I];j.push(P),_.push(O)}a(P,s)&&P.forEach(function(V,D){var z=A(D,N-1),q=A(V,N-1);O.set(z,q)}),a(P,l)&&P.forEach(function(V){var D=A(V,N-1);O.add(D)});for(var R in P){var F;C&&(F=Object.getOwnPropertyDescriptor(C,R)),!(F&&F.set==null)&&(O[R]=A(P[R],N-1))}if(Object.getOwnPropertySymbols)for(var M=Object.getOwnPropertySymbols(P),R=0;R<M.length;R++){var Y=M[R],X=Object.getOwnPropertyDescriptor(P,Y);X&&!X.enumerable&&!k||(O[Y]=A(P[Y],N-1),X.enumerable||Object.defineProperty(O,Y,{enumerable:!1}))}if(k)for(var $=Object.getOwnPropertyNames(P),R=0;R<$.length;R++){var ee=$[R],X=Object.getOwnPropertyDescriptor(P,ee);X&&X.enumerable||(O[ee]=A(P[ee],N-1),Object.defineProperty(O,ee,{enumerable:!1}))}return O}return A(m,x)}u.clonePrototype=function(b){if(b===null)return null;var x=function(){};return x.prototype=b,new x};function d(m){return Object.prototype.toString.call(m)}u.__objToStr=d;function f(m){return typeof m=="object"&&d(m)==="[object Date]"}u.__isDate=f;function h(m){return typeof m=="object"&&d(m)==="[object Array]"}u.__isArray=h;function p(m){return typeof m=="object"&&d(m)==="[object RegExp]"}u.__isRegExp=p;function v(m){var b="";return m.global&&(b+="g"),m.ignoreCase&&(b+="i"),m.multiline&&(b+="m"),b}return u.__getRegExpFlags=v,u})();typeof r=="object"&&r.exports&&(r.exports=o)}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function O(C,I){var R=[],F=!0,M=!1,Y=void 0;try{for(var X=C[Symbol.iterator](),$;!(F=($=X.next()).done)&&(R.push($.value),!(I&&R.length===I));F=!0);}catch(ee){M=!0,Y=ee}finally{try{!F&&X.return&&X.return()}finally{if(M)throw Y}}return R}return function(C,I){if(Array.isArray(C))return C;if(Symbol.iterator in Object(C))return O(C,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function O(C,I){for(var R=0;R<I.length;R++){var F=I[R];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(C,F.key,F)}}return function(C,I,R){return I&&O(C.prototype,I),R&&O(C,R),C}})(),l=function O(C,I,R){C===null&&(C=Function.prototype);var F=Object.getOwnPropertyDescriptor(C,I);if(F===void 0){var M=Object.getPrototypeOf(C);return M===null?void 0:O(M,I,R)}else{if("value"in F)return F.value;var Y=F.get;return Y===void 0?void 0:Y.call(R)}},c=o(0),u=j(c),d=o(8),f=j(d),h=o(4),p=j(h),v=o(16),m=j(v),b=o(13),x=j(b),w=o(25),k=j(w);function j(O){return O&&O.__esModule?O:{default:O}}function _(O,C){if(!(O instanceof C))throw new TypeError("Cannot call a class as a function")}function T(O,C){if(!O)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:O}function A(O,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);O.prototype=Object.create(C&&C.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(O,C):O.__proto__=C)}function P(O){return O instanceof p.default||O instanceof h.BlockEmbed}var N=(function(O){A(C,O);function C(I,R){_(this,C);var F=T(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,I));return F.emitter=R.emitter,Array.isArray(R.whitelist)&&(F.whitelist=R.whitelist.reduce(function(M,Y){return M[Y]=!0,M},{})),F.domNode.addEventListener("DOMNodeInserted",function(){}),F.optimize(),F.enable(),F}return s(C,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(R,F){var M=this.line(R),Y=a(M,2),X=Y[0],$=Y[1],ee=this.line(R+F),V=a(ee,1),D=V[0];if(l(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"deleteAt",this).call(this,R,F),D!=null&&X!==D&&$>0){if(X instanceof h.BlockEmbed||D instanceof h.BlockEmbed){this.optimize();return}if(X instanceof x.default){var z=X.newlineIndex(X.length(),!0);if(z>-1&&(X=X.split(z+1),X===D)){this.optimize();return}}else if(D instanceof x.default){var q=D.newlineIndex(0);q>-1&&D.split(q+1)}var G=D.children.head instanceof m.default?null:D.children.head;X.moveChildren(D,G),X.remove()}this.optimize()}},{key:"enable",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",R)}},{key:"formatAt",value:function(R,F,M,Y){this.whitelist!=null&&!this.whitelist[M]||(l(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"formatAt",this).call(this,R,F,M,Y),this.optimize())}},{key:"insertAt",value:function(R,F,M){if(!(M!=null&&this.whitelist!=null&&!this.whitelist[F])){if(R>=this.length())if(M==null||u.default.query(F,u.default.Scope.BLOCK)==null){var Y=u.default.create(this.statics.defaultChild);this.appendChild(Y),M==null&&F.endsWith(`
`)&&(F=F.slice(0,-1)),Y.insertAt(0,F,M)}else{var X=u.default.create(F,M);this.appendChild(X)}else l(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"insertAt",this).call(this,R,F,M);this.optimize()}}},{key:"insertBefore",value:function(R,F){if(R.statics.scope===u.default.Scope.INLINE_BLOT){var M=u.default.create(this.statics.defaultChild);M.appendChild(R),R=M}l(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"insertBefore",this).call(this,R,F)}},{key:"leaf",value:function(R){return this.path(R).pop()||[null,-1]}},{key:"line",value:function(R){return R===this.length()?this.line(R-1):this.descendant(P,R)}},{key:"lines",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE,M=function Y(X,$,ee){var V=[],D=ee;return X.children.forEachAt($,ee,function(z,q,G){P(z)?V.push(z):z instanceof u.default.Container&&(V=V.concat(Y(z,q,D))),D-=G}),V};return M(this,R,F)}},{key:"optimize",value:function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch!==!0&&(l(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"optimize",this).call(this,R,F),R.length>0&&this.emitter.emit(f.default.events.SCROLL_OPTIMIZE,R,F))}},{key:"path",value:function(R){return l(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"path",this).call(this,R).slice(1)}},{key:"update",value:function(R){if(this.batch!==!0){var F=f.default.sources.USER;typeof R=="string"&&(F=R),Array.isArray(R)||(R=this.observer.takeRecords()),R.length>0&&this.emitter.emit(f.default.events.SCROLL_BEFORE_UPDATE,F,R),l(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"update",this).call(this,R.concat([])),R.length>0&&this.emitter.emit(f.default.events.SCROLL_UPDATE,F,R)}}}]),C})(u.default.Scroll);N.blotName="scroll",N.className="ql-editor",N.tagName="DIV",N.defaultChild="block",N.allowedChildren=[p.default,h.BlockEmbed,k.default],n.default=N}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.SHORTKEY=n.default=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},s=(function(){function Q(K,re){var H=[],ie=!0,de=!1,le=void 0;try{for(var ke=K[Symbol.iterator](),ve;!(ie=(ve=ke.next()).done)&&(H.push(ve.value),!(re&&H.length===re));ie=!0);}catch(se){de=!0,le=se}finally{try{!ie&&ke.return&&ke.return()}finally{if(de)throw le}}return H}return function(K,re){if(Array.isArray(K))return K;if(Symbol.iterator in Object(K))return Q(K,re);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function Q(K,re){for(var H=0;H<re.length;H++){var ie=re[H];ie.enumerable=ie.enumerable||!1,ie.configurable=!0,"value"in ie&&(ie.writable=!0),Object.defineProperty(K,ie.key,ie)}}return function(K,re,H){return re&&Q(K.prototype,re),H&&Q(K,H),K}})(),c=o(21),u=O(c),d=o(11),f=O(d),h=o(3),p=O(h),v=o(2),m=O(v),b=o(20),x=O(b),w=o(0),k=O(w),j=o(5),_=O(j),T=o(10),A=O(T),P=o(9),N=O(P);function O(Q){return Q&&Q.__esModule?Q:{default:Q}}function C(Q,K,re){return K in Q?Object.defineProperty(Q,K,{value:re,enumerable:!0,configurable:!0,writable:!0}):Q[K]=re,Q}function I(Q,K){if(!(Q instanceof K))throw new TypeError("Cannot call a class as a function")}function R(Q,K){if(!Q)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return K&&(typeof K=="object"||typeof K=="function")?K:Q}function F(Q,K){if(typeof K!="function"&&K!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof K);Q.prototype=Object.create(K&&K.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}}),K&&(Object.setPrototypeOf?Object.setPrototypeOf(Q,K):Q.__proto__=K)}var M=(0,A.default)("quill:keyboard"),Y=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",X=(function(Q){F(K,Q),l(K,null,[{key:"match",value:function(H,ie){return ie=U(ie),["altKey","ctrlKey","metaKey","shiftKey"].some(function(de){return!!ie[de]!==H[de]&&ie[de]!==null})?!1:ie.key===(H.which||H.keyCode)}}]);function K(re,H){I(this,K);var ie=R(this,(K.__proto__||Object.getPrototypeOf(K)).call(this,re,H));return ie.bindings={},Object.keys(ie.options.bindings).forEach(function(de){de==="list autofill"&&re.scroll.whitelist!=null&&!re.scroll.whitelist.list||ie.options.bindings[de]&&ie.addBinding(ie.options.bindings[de])}),ie.addBinding({key:K.keys.ENTER,shiftKey:null},z),ie.addBinding({key:K.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(ie.addBinding({key:K.keys.BACKSPACE},{collapsed:!0},ee),ie.addBinding({key:K.keys.DELETE},{collapsed:!0},V)):(ie.addBinding({key:K.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},ee),ie.addBinding({key:K.keys.DELETE},{collapsed:!0,suffix:/^.?$/},V)),ie.addBinding({key:K.keys.BACKSPACE},{collapsed:!1},D),ie.addBinding({key:K.keys.DELETE},{collapsed:!1},D),ie.addBinding({key:K.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},ee),ie.listen(),ie}return l(K,[{key:"addBinding",value:function(H){var ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},de=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},le=U(H);if(le==null||le.key==null)return M.warn("Attempted to add invalid keyboard binding",le);typeof ie=="function"&&(ie={handler:ie}),typeof de=="function"&&(de={handler:de}),le=(0,p.default)(le,ie,de),this.bindings[le.key]=this.bindings[le.key]||[],this.bindings[le.key].push(le)}},{key:"listen",value:function(){var H=this;this.quill.root.addEventListener("keydown",function(ie){if(!ie.defaultPrevented){var de=ie.which||ie.keyCode,le=(H.bindings[de]||[]).filter(function(Te){return K.match(ie,Te)});if(le.length!==0){var ke=H.quill.getSelection();if(!(ke==null||!H.quill.hasFocus())){var ve=H.quill.getLine(ke.index),se=s(ve,2),be=se[0],De=se[1],ae=H.quill.getLeaf(ke.index),ue=s(ae,2),Me=ue[0],Se=ue[1],Pe=ke.length===0?[Me,Se]:H.quill.getLeaf(ke.index+ke.length),Ee=s(Pe,2),Ae=Ee[0],Ye=Ee[1],rt=Me instanceof k.default.Text?Me.value().slice(0,Se):"",He=Ae instanceof k.default.Text?Ae.value().slice(Ye):"",xt={collapsed:ke.length===0,empty:ke.length===0&&be.length()<=1,format:H.quill.getFormat(ke),offset:De,prefix:rt,suffix:He},st=le.some(function(Te){if(Te.collapsed!=null&&Te.collapsed!==xt.collapsed||Te.empty!=null&&Te.empty!==xt.empty||Te.offset!=null&&Te.offset!==xt.offset)return!1;if(Array.isArray(Te.format)){if(Te.format.every(function(et){return xt.format[et]==null}))return!1}else if(a(Te.format)==="object"&&!Object.keys(Te.format).every(function(et){return Te.format[et]===!0?xt.format[et]!=null:Te.format[et]===!1?xt.format[et]==null:(0,f.default)(Te.format[et],xt.format[et])}))return!1;return Te.prefix!=null&&!Te.prefix.test(xt.prefix)||Te.suffix!=null&&!Te.suffix.test(xt.suffix)?!1:Te.handler.call(H,ke,xt)!==!0});st&&ie.preventDefault()}}}})}}]),K})(N.default);X.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},X.DEFAULTS={bindings:{bold:G("bold"),italic:G("italic"),underline:G("underline"),indent:{key:X.keys.TAB,format:["blockquote","indent","list"],handler:function(K,re){if(re.collapsed&&re.offset!==0)return!0;this.quill.format("indent","+1",_.default.sources.USER)}},outdent:{key:X.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(K,re){if(re.collapsed&&re.offset!==0)return!0;this.quill.format("indent","-1",_.default.sources.USER)}},"outdent backspace":{key:X.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(K,re){re.format.indent!=null?this.quill.format("indent","-1",_.default.sources.USER):re.format.list!=null&&this.quill.format("list",!1,_.default.sources.USER)}},"indent code-block":q(!0),"outdent code-block":q(!1),"remove tab":{key:X.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(K){this.quill.deleteText(K.index-1,1,_.default.sources.USER)}},tab:{key:X.keys.TAB,handler:function(K){this.quill.history.cutoff();var re=new m.default().retain(K.index).delete(K.length).insert(" ");this.quill.updateContents(re,_.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(K.index+1,_.default.sources.SILENT)}},"list empty enter":{key:X.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(K,re){this.quill.format("list",!1,_.default.sources.USER),re.format.indent&&this.quill.format("indent",!1,_.default.sources.USER)}},"checklist enter":{key:X.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(K){var re=this.quill.getLine(K.index),H=s(re,2),ie=H[0],de=H[1],le=(0,p.default)({},ie.formats(),{list:"checked"}),ke=new m.default().retain(K.index).insert(`
`,le).retain(ie.length()-de-1).retain(1,{list:"unchecked"});this.quill.updateContents(ke,_.default.sources.USER),this.quill.setSelection(K.index+1,_.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:X.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(K,re){var H=this.quill.getLine(K.index),ie=s(H,2),de=ie[0],le=ie[1],ke=new m.default().retain(K.index).insert(`
`,re.format).retain(de.length()-le-1).retain(1,{header:null});this.quill.updateContents(ke,_.default.sources.USER),this.quill.setSelection(K.index+1,_.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(K,re){var H=re.prefix.length,ie=this.quill.getLine(K.index),de=s(ie,2),le=de[0],ke=de[1];if(ke>H)return!0;var ve=void 0;switch(re.prefix.trim()){case"[]":case"[ ]":ve="unchecked";break;case"[x]":ve="checked";break;case"-":case"*":ve="bullet";break;default:ve="ordered"}this.quill.insertText(K.index," ",_.default.sources.USER),this.quill.history.cutoff();var se=new m.default().retain(K.index-ke).delete(H+1).retain(le.length()-2-ke).retain(1,{list:ve});this.quill.updateContents(se,_.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(K.index-H,_.default.sources.SILENT)}},"code exit":{key:X.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(K){var re=this.quill.getLine(K.index),H=s(re,2),ie=H[0],de=H[1],le=new m.default().retain(K.index+ie.length()-de-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(le,_.default.sources.USER)}},"embed left":$(X.keys.LEFT,!1),"embed left shift":$(X.keys.LEFT,!0),"embed right":$(X.keys.RIGHT,!1),"embed right shift":$(X.keys.RIGHT,!0)}};function $(Q,K){var re,H=Q===X.keys.LEFT?"prefix":"suffix";return re={key:Q,shiftKey:K,altKey:null},C(re,H,/^$/),C(re,"handler",function(de){var le=de.index;Q===X.keys.RIGHT&&(le+=de.length+1);var ke=this.quill.getLeaf(le),ve=s(ke,1),se=ve[0];return se instanceof k.default.Embed?(Q===X.keys.LEFT?K?this.quill.setSelection(de.index-1,de.length+1,_.default.sources.USER):this.quill.setSelection(de.index-1,_.default.sources.USER):K?this.quill.setSelection(de.index,de.length+1,_.default.sources.USER):this.quill.setSelection(de.index+de.length+1,_.default.sources.USER),!1):!0}),re}function ee(Q,K){if(!(Q.index===0||this.quill.getLength()<=1)){var re=this.quill.getLine(Q.index),H=s(re,1),ie=H[0],de={};if(K.offset===0){var le=this.quill.getLine(Q.index-1),ke=s(le,1),ve=ke[0];if(ve!=null&&ve.length()>1){var se=ie.formats(),be=this.quill.getFormat(Q.index-1,1);de=x.default.attributes.diff(se,be)||{}}}var De=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(K.prefix)?2:1;this.quill.deleteText(Q.index-De,De,_.default.sources.USER),Object.keys(de).length>0&&this.quill.formatLine(Q.index-De,De,de,_.default.sources.USER),this.quill.focus()}}function V(Q,K){var re=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(K.suffix)?2:1;if(!(Q.index>=this.quill.getLength()-re)){var H={},ie=0,de=this.quill.getLine(Q.index),le=s(de,1),ke=le[0];if(K.offset>=ke.length()-1){var ve=this.quill.getLine(Q.index+1),se=s(ve,1),be=se[0];if(be){var De=ke.formats(),ae=this.quill.getFormat(Q.index,1);H=x.default.attributes.diff(De,ae)||{},ie=be.length()}}this.quill.deleteText(Q.index,re,_.default.sources.USER),Object.keys(H).length>0&&this.quill.formatLine(Q.index+ie-1,re,H,_.default.sources.USER)}}function D(Q){var K=this.quill.getLines(Q),re={};if(K.length>1){var H=K[0].formats(),ie=K[K.length-1].formats();re=x.default.attributes.diff(ie,H)||{}}this.quill.deleteText(Q,_.default.sources.USER),Object.keys(re).length>0&&this.quill.formatLine(Q.index,1,re,_.default.sources.USER),this.quill.setSelection(Q.index,_.default.sources.SILENT),this.quill.focus()}function z(Q,K){var re=this;Q.length>0&&this.quill.scroll.deleteAt(Q.index,Q.length);var H=Object.keys(K.format).reduce(function(ie,de){return k.default.query(de,k.default.Scope.BLOCK)&&!Array.isArray(K.format[de])&&(ie[de]=K.format[de]),ie},{});this.quill.insertText(Q.index,`
`,H,_.default.sources.USER),this.quill.setSelection(Q.index+1,_.default.sources.SILENT),this.quill.focus(),Object.keys(K.format).forEach(function(ie){H[ie]==null&&(Array.isArray(K.format[ie])||ie!=="link"&&re.quill.format(ie,K.format[ie],_.default.sources.USER))})}function q(Q){return{key:X.keys.TAB,shiftKey:!Q,format:{"code-block":!0},handler:function(re){var H=k.default.query("code-block"),ie=re.index,de=re.length,le=this.quill.scroll.descendant(H,ie),ke=s(le,2),ve=ke[0],se=ke[1];if(ve!=null){var be=this.quill.getIndex(ve),De=ve.newlineIndex(se,!0)+1,ae=ve.newlineIndex(be+se+de),ue=ve.domNode.textContent.slice(De,ae).split(`
`);se=0,ue.forEach(function(Me,Se){Q?(ve.insertAt(De+se,H.TAB),se+=H.TAB.length,Se===0?ie+=H.TAB.length:de+=H.TAB.length):Me.startsWith(H.TAB)&&(ve.deleteAt(De+se,H.TAB.length),se-=H.TAB.length,Se===0?ie-=H.TAB.length:de-=H.TAB.length),se+=Me.length+1}),this.quill.update(_.default.sources.USER),this.quill.setSelection(ie,de,_.default.sources.SILENT)}}}}function G(Q){return{key:Q[0].toUpperCase(),shortKey:!0,handler:function(re,H){this.quill.format(Q,!H.format[Q],_.default.sources.USER)}}}function U(Q){if(typeof Q=="string"||typeof Q=="number")return U({key:Q});if((typeof Q>"u"?"undefined":a(Q))==="object"&&(Q=(0,u.default)(Q,!1)),typeof Q.key=="string")if(X.keys[Q.key.toUpperCase()]!=null)Q.key=X.keys[Q.key.toUpperCase()];else if(Q.key.length===1)Q.key=Q.key.toUpperCase().charCodeAt(0);else return null;return Q.shortKey&&(Q[Y]=Q.shortKey,delete Q.shortKey),Q}n.default=X,n.SHORTKEY=Y}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function x(w,k){var j=[],_=!0,T=!1,A=void 0;try{for(var P=w[Symbol.iterator](),N;!(_=(N=P.next()).done)&&(j.push(N.value),!(k&&j.length===k));_=!0);}catch(O){T=!0,A=O}finally{try{!_&&P.return&&P.return()}finally{if(T)throw A}}return j}return function(w,k){if(Array.isArray(w))return w;if(Symbol.iterator in Object(w))return x(w,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=function x(w,k,j){w===null&&(w=Function.prototype);var _=Object.getOwnPropertyDescriptor(w,k);if(_===void 0){var T=Object.getPrototypeOf(w);return T===null?void 0:x(T,k,j)}else{if("value"in _)return _.value;var A=_.get;return A===void 0?void 0:A.call(j)}},l=(function(){function x(w,k){for(var j=0;j<k.length;j++){var _=k[j];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(w,_.key,_)}}return function(w,k,j){return k&&x(w.prototype,k),j&&x(w,j),w}})(),c=o(0),u=h(c),d=o(7),f=h(d);function h(x){return x&&x.__esModule?x:{default:x}}function p(x,w){if(!(x instanceof w))throw new TypeError("Cannot call a class as a function")}function v(x,w){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w&&(typeof w=="object"||typeof w=="function")?w:x}function m(x,w){if(typeof w!="function"&&w!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof w);x.prototype=Object.create(w&&w.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),w&&(Object.setPrototypeOf?Object.setPrototypeOf(x,w):x.__proto__=w)}var b=(function(x){m(w,x),l(w,null,[{key:"value",value:function(){}}]);function w(k,j){p(this,w);var _=v(this,(w.__proto__||Object.getPrototypeOf(w)).call(this,k));return _.selection=j,_.textNode=document.createTextNode(w.CONTENTS),_.domNode.appendChild(_.textNode),_._length=0,_}return l(w,[{key:"detach",value:function(){this.parent!=null&&this.parent.removeChild(this)}},{key:"format",value:function(j,_){if(this._length!==0)return s(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"format",this).call(this,j,_);for(var T=this,A=0;T!=null&&T.statics.scope!==u.default.Scope.BLOCK_BLOT;)A+=T.offset(T.parent),T=T.parent;T!=null&&(this._length=w.CONTENTS.length,T.optimize(),T.formatAt(A,w.CONTENTS.length,j,_),this._length=0)}},{key:"index",value:function(j,_){return j===this.textNode?0:s(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"index",this).call(this,j,_)}},{key:"length",value:function(){return this._length}},{key:"position",value:function(){return[this.textNode,this.textNode.data.length]}},{key:"remove",value:function(){s(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"remove",this).call(this),this.parent=null}},{key:"restore",value:function(){if(!(this.selection.composing||this.parent==null)){var j=this.textNode,_=this.selection.getNativeRange(),T=void 0,A=void 0,P=void 0;if(_!=null&&_.start.node===j&&_.end.node===j){var N=[j,_.start.offset,_.end.offset];T=N[0],A=N[1],P=N[2]}for(;this.domNode.lastChild!=null&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==w.CONTENTS){var O=this.textNode.data.split(w.CONTENTS).join("");this.next instanceof f.default?(T=this.next.domNode,this.next.insertAt(0,O),this.textNode.data=w.CONTENTS):(this.textNode.data=O,this.parent.insertBefore(u.default.create(this.textNode),this),this.textNode=document.createTextNode(w.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),A!=null){var C=[A,P].map(function(R){return Math.max(0,Math.min(T.data.length,R-1))}),I=a(C,2);return A=I[0],P=I[1],{startNode:T,startOffset:A,endNode:T,endOffset:P}}}}},{key:"update",value:function(j,_){var T=this;if(j.some(function(P){return P.type==="characterData"&&P.target===T.textNode})){var A=this.restore();A&&(_.range=A)}}},{key:"value",value:function(){return""}}]),w})(u.default.Embed);b.blotName="cursor",b.className="ql-cursor",b.tagName="span",b.CONTENTS="\uFEFF",n.default=b}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(0),s=u(a),l=o(4),c=u(l);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function f(v,m){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:v}function h(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(v,m):v.__proto__=m)}var p=(function(v){h(m,v);function m(){return d(this,m),f(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return m})(s.default.Container);p.allowedChildren=[c.default,l.BlockEmbed,p],n.default=p}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.ColorStyle=n.ColorClass=n.ColorAttributor=void 0;var a=(function(){function b(x,w){for(var k=0;k<w.length;k++){var j=w[k];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(x,j.key,j)}}return function(x,w,k){return w&&b(x.prototype,w),k&&b(x,k),x}})(),s=function b(x,w,k){x===null&&(x=Function.prototype);var j=Object.getOwnPropertyDescriptor(x,w);if(j===void 0){var _=Object.getPrototypeOf(x);return _===null?void 0:b(_,w,k)}else{if("value"in j)return j.value;var T=j.get;return T===void 0?void 0:T.call(k)}},l=o(0),c=u(l);function u(b){return b&&b.__esModule?b:{default:b}}function d(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function f(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function h(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var p=(function(b){h(x,b);function x(){return d(this,x),f(this,(x.__proto__||Object.getPrototypeOf(x)).apply(this,arguments))}return a(x,[{key:"value",value:function(k){var j=s(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"value",this).call(this,k);return j.startsWith("rgb(")?(j=j.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),"#"+j.split(",").map(function(_){return("00"+parseInt(_).toString(16)).slice(-2)}).join("")):j}}]),x})(c.default.Attributor.Style),v=new c.default.Attributor.Class("color","ql-color",{scope:c.default.Scope.INLINE}),m=new p("color","color",{scope:c.default.Scope.INLINE});n.ColorAttributor=p,n.ColorClass=v,n.ColorStyle=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.sanitize=n.default=void 0;var a=(function(){function m(b,x){for(var w=0;w<x.length;w++){var k=x[w];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(b,k.key,k)}}return function(b,x,w){return x&&m(b.prototype,x),w&&m(b,w),b}})(),s=function m(b,x,w){b===null&&(b=Function.prototype);var k=Object.getOwnPropertyDescriptor(b,x);if(k===void 0){var j=Object.getPrototypeOf(b);return j===null?void 0:m(j,x,w)}else{if("value"in k)return k.value;var _=k.get;return _===void 0?void 0:_.call(w)}},l=o(6),c=u(l);function u(m){return m&&m.__esModule?m:{default:m}}function d(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function f(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function h(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var p=(function(m){h(b,m);function b(){return d(this,b),f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return a(b,[{key:"format",value:function(w,k){if(w!==this.statics.blotName||!k)return s(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"format",this).call(this,w,k);k=this.constructor.sanitize(k),this.domNode.setAttribute("href",k)}}],[{key:"create",value:function(w){var k=s(b.__proto__||Object.getPrototypeOf(b),"create",this).call(this,w);return w=this.sanitize(w),k.setAttribute("href",w),k.setAttribute("rel","noopener noreferrer"),k.setAttribute("target","_blank"),k}},{key:"formats",value:function(w){return w.getAttribute("href")}},{key:"sanitize",value:function(w){return v(w,this.PROTOCOL_WHITELIST)?w:this.SANITIZED_URL}}]),b})(c.default);p.blotName="link",p.tagName="A",p.SANITIZED_URL="about:blank",p.PROTOCOL_WHITELIST=["http","https","mailto","tel"];function v(m,b){var x=document.createElement("a");x.href=m;var w=x.href.slice(0,x.href.indexOf(":"));return b.indexOf(w)>-1}n.default=p,n.sanitize=v}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(b){return typeof b}:function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},s=(function(){function b(x,w){for(var k=0;k<w.length;k++){var j=w[k];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(x,j.key,j)}}return function(x,w,k){return w&&b(x.prototype,w),k&&b(x,k),x}})(),l=o(23),c=f(l),u=o(107),d=f(u);function f(b){return b&&b.__esModule?b:{default:b}}function h(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}var p=0;function v(b,x){b.setAttribute(x,b.getAttribute(x)!=="true")}var m=(function(){function b(x){var w=this;h(this,b),this.select=x,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",function(){w.togglePicker()}),this.label.addEventListener("keydown",function(k){switch(k.keyCode){case c.default.keys.ENTER:w.togglePicker();break;case c.default.keys.ESCAPE:w.escape(),k.preventDefault();break}}),this.select.addEventListener("change",this.update.bind(this))}return s(b,[{key:"togglePicker",value:function(){this.container.classList.toggle("ql-expanded"),v(this.label,"aria-expanded"),v(this.options,"aria-hidden")}},{key:"buildItem",value:function(w){var k=this,j=document.createElement("span");return j.tabIndex="0",j.setAttribute("role","button"),j.classList.add("ql-picker-item"),w.hasAttribute("value")&&j.setAttribute("data-value",w.getAttribute("value")),w.textContent&&j.setAttribute("data-label",w.textContent),j.addEventListener("click",function(){k.selectItem(j,!0)}),j.addEventListener("keydown",function(_){switch(_.keyCode){case c.default.keys.ENTER:k.selectItem(j,!0),_.preventDefault();break;case c.default.keys.ESCAPE:k.escape(),_.preventDefault();break}}),j}},{key:"buildLabel",value:function(){var w=document.createElement("span");return w.classList.add("ql-picker-label"),w.innerHTML=d.default,w.tabIndex="0",w.setAttribute("role","button"),w.setAttribute("aria-expanded","false"),this.container.appendChild(w),w}},{key:"buildOptions",value:function(){var w=this,k=document.createElement("span");k.classList.add("ql-picker-options"),k.setAttribute("aria-hidden","true"),k.tabIndex="-1",k.id="ql-picker-options-"+p,p+=1,this.label.setAttribute("aria-controls",k.id),this.options=k,[].slice.call(this.select.options).forEach(function(j){var _=w.buildItem(j);k.appendChild(_),j.selected===!0&&w.selectItem(_)}),this.container.appendChild(k)}},{key:"buildPicker",value:function(){var w=this;[].slice.call(this.select.attributes).forEach(function(k){w.container.setAttribute(k.name,k.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}},{key:"escape",value:function(){var w=this;this.close(),setTimeout(function(){return w.label.focus()},1)}},{key:"close",value:function(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}},{key:"selectItem",value:function(w){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,j=this.container.querySelector(".ql-selected");if(w!==j&&(j!=null&&j.classList.remove("ql-selected"),w!=null&&(w.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(w.parentNode.children,w),w.hasAttribute("data-value")?this.label.setAttribute("data-value",w.getAttribute("data-value")):this.label.removeAttribute("data-value"),w.hasAttribute("data-label")?this.label.setAttribute("data-label",w.getAttribute("data-label")):this.label.removeAttribute("data-label"),k))){if(typeof Event=="function")this.select.dispatchEvent(new Event("change"));else if((typeof Event>"u"?"undefined":a(Event))==="object"){var _=document.createEvent("Event");_.initEvent("change",!0,!0),this.select.dispatchEvent(_)}this.close()}}},{key:"update",value:function(){var w=void 0;if(this.select.selectedIndex>-1){var k=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];w=this.select.options[this.select.selectedIndex],this.selectItem(k)}else this.selectItem(null);var j=w!=null&&w!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",j)}}]),b})();n.default=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(0),s=M(a),l=o(5),c=M(l),u=o(4),d=M(u),f=o(16),h=M(f),p=o(25),v=M(p),m=o(24),b=M(m),x=o(35),w=M(x),k=o(6),j=M(k),_=o(22),T=M(_),A=o(7),P=M(A),N=o(55),O=M(N),C=o(42),I=M(C),R=o(23),F=M(R);function M(Y){return Y&&Y.__esModule?Y:{default:Y}}c.default.register({"blots/block":d.default,"blots/block/embed":u.BlockEmbed,"blots/break":h.default,"blots/container":v.default,"blots/cursor":b.default,"blots/embed":w.default,"blots/inline":j.default,"blots/scroll":T.default,"blots/text":P.default,"modules/clipboard":O.default,"modules/history":I.default,"modules/keyboard":F.default}),s.default.register(d.default,h.default,b.default,j.default,T.default,P.default),n.default=c.default}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(1),s=(function(){function l(c){this.domNode=c,this.domNode[a.DATA_KEY]={blot:this}}return Object.defineProperty(l.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),l.create=function(c){if(this.tagName==null)throw new a.ParchmentError("Blot definition missing tagName");var u;return Array.isArray(this.tagName)?(typeof c=="string"&&(c=c.toUpperCase(),parseInt(c).toString()===c&&(c=parseInt(c))),typeof c=="number"?u=document.createElement(this.tagName[c-1]):this.tagName.indexOf(c)>-1?u=document.createElement(c):u=document.createElement(this.tagName[0])):u=document.createElement(this.tagName),this.className&&u.classList.add(this.className),u},l.prototype.attach=function(){this.parent!=null&&(this.scroll=this.parent.scroll)},l.prototype.clone=function(){var c=this.domNode.cloneNode(!1);return a.create(c)},l.prototype.detach=function(){this.parent!=null&&this.parent.removeChild(this),delete this.domNode[a.DATA_KEY]},l.prototype.deleteAt=function(c,u){var d=this.isolate(c,u);d.remove()},l.prototype.formatAt=function(c,u,d,f){var h=this.isolate(c,u);if(a.query(d,a.Scope.BLOT)!=null&&f)h.wrap(d,f);else if(a.query(d,a.Scope.ATTRIBUTE)!=null){var p=a.create(this.statics.scope);h.wrap(p),p.format(d,f)}},l.prototype.insertAt=function(c,u,d){var f=d==null?a.create("text",u):a.create(u,d),h=this.split(c);this.parent.insertBefore(f,h)},l.prototype.insertInto=function(c,u){u===void 0&&(u=null),this.parent!=null&&this.parent.children.remove(this);var d=null;c.children.insertBefore(this,u),u!=null&&(d=u.domNode),(this.domNode.parentNode!=c.domNode||this.domNode.nextSibling!=d)&&c.domNode.insertBefore(this.domNode,d),this.parent=c,this.attach()},l.prototype.isolate=function(c,u){var d=this.split(c);return d.split(u),d},l.prototype.length=function(){return 1},l.prototype.offset=function(c){return c===void 0&&(c=this.parent),this.parent==null||this==c?0:this.parent.children.offset(this)+this.parent.offset(c)},l.prototype.optimize=function(c){this.domNode[a.DATA_KEY]!=null&&delete this.domNode[a.DATA_KEY].mutations},l.prototype.remove=function(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},l.prototype.replace=function(c){c.parent!=null&&(c.parent.insertBefore(this,c.next),c.remove())},l.prototype.replaceWith=function(c,u){var d=typeof c=="string"?a.create(c,u):c;return d.replace(this),d},l.prototype.split=function(c,u){return c===0?this:this.next},l.prototype.update=function(c,u){},l.prototype.wrap=function(c,u){var d=typeof c=="string"?a.create(c,u):c;return this.parent!=null&&this.parent.insertBefore(d,this.next),d.appendChild(this),d},l.blotName="abstract",l})();n.default=s}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(12),s=o(32),l=o(33),c=o(1),u=(function(){function d(f){this.attributes={},this.domNode=f,this.build()}return d.prototype.attribute=function(f,h){h?f.add(this.domNode,h)&&(f.value(this.domNode)!=null?this.attributes[f.attrName]=f:delete this.attributes[f.attrName]):(f.remove(this.domNode),delete this.attributes[f.attrName])},d.prototype.build=function(){var f=this;this.attributes={};var h=a.default.keys(this.domNode),p=s.default.keys(this.domNode),v=l.default.keys(this.domNode);h.concat(p).concat(v).forEach(function(m){var b=c.query(m,c.Scope.ATTRIBUTE);b instanceof a.default&&(f.attributes[b.attrName]=b)})},d.prototype.copy=function(f){var h=this;Object.keys(this.attributes).forEach(function(p){var v=h.attributes[p].value(h.domNode);f.format(p,v)})},d.prototype.move=function(f){var h=this;this.copy(f),Object.keys(this.attributes).forEach(function(p){h.attributes[p].remove(h.domNode)}),this.attributes={}},d.prototype.values=function(){var f=this;return Object.keys(this.attributes).reduce(function(h,p){return h[p]=f.attributes[p].value(f.domNode),h},{})},d})();n.default=u}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(12);function l(u,d){var f=u.getAttribute("class")||"";return f.split(/\s+/).filter(function(h){return h.indexOf(d+"-")===0})}var c=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.keys=function(f){return(f.getAttribute("class")||"").split(/\s+/).map(function(h){return h.split("-").slice(0,-1).join("-")})},d.prototype.add=function(f,h){return this.canAdd(f,h)?(this.remove(f),f.classList.add(this.keyName+"-"+h),!0):!1},d.prototype.remove=function(f){var h=l(f,this.keyName);h.forEach(function(p){f.classList.remove(p)}),f.classList.length===0&&f.removeAttribute("class")},d.prototype.value=function(f){var h=l(f,this.keyName)[0]||"",p=h.slice(this.keyName.length+1);return this.canAdd(f,p)?p:""},d})(s.default);n.default=c}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(12);function l(u){var d=u.split("-"),f=d.slice(1).map(function(h){return h[0].toUpperCase()+h.slice(1)}).join("");return d[0]+f}var c=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.keys=function(f){return(f.getAttribute("style")||"").split(";").map(function(h){var p=h.split(":");return p[0].trim()})},d.prototype.add=function(f,h){return this.canAdd(f,h)?(f.style[l(this.keyName)]=h,!0):!1},d.prototype.remove=function(f){f.style[l(this.keyName)]="",f.getAttribute("style")||f.removeAttribute("style")},d.prototype.value=function(f){var h=f.style[l(this.keyName)];return this.canAdd(f,h)?h:""},d})(s.default);n.default=c}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function c(u,d){for(var f=0;f<d.length;f++){var h=d[f];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(u,h.key,h)}}return function(u,d,f){return d&&c(u.prototype,d),f&&c(u,f),u}})();function s(c,u){if(!(c instanceof u))throw new TypeError("Cannot call a class as a function")}var l=(function(){function c(u,d){s(this,c),this.quill=u,this.options=d,this.modules={}}return a(c,[{key:"init",value:function(){var d=this;Object.keys(this.options.modules).forEach(function(f){d.modules[f]==null&&d.addModule(f)})}},{key:"addModule",value:function(d){var f=this.quill.constructor.import("modules/"+d);return this.modules[d]=new f(this.quill,this.options.modules[d]||{}),this.modules[d]}}]),c})();l.DEFAULTS={modules:{}},l.themes={default:l},n.default=l}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function x(w,k){for(var j=0;j<k.length;j++){var _=k[j];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(w,_.key,_)}}return function(w,k,j){return k&&x(w.prototype,k),j&&x(w,j),w}})(),s=function x(w,k,j){w===null&&(w=Function.prototype);var _=Object.getOwnPropertyDescriptor(w,k);if(_===void 0){var T=Object.getPrototypeOf(w);return T===null?void 0:x(T,k,j)}else{if("value"in _)return _.value;var A=_.get;return A===void 0?void 0:A.call(j)}},l=o(0),c=f(l),u=o(7),d=f(u);function f(x){return x&&x.__esModule?x:{default:x}}function h(x,w){if(!(x instanceof w))throw new TypeError("Cannot call a class as a function")}function p(x,w){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w&&(typeof w=="object"||typeof w=="function")?w:x}function v(x,w){if(typeof w!="function"&&w!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof w);x.prototype=Object.create(w&&w.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),w&&(Object.setPrototypeOf?Object.setPrototypeOf(x,w):x.__proto__=w)}var m="\uFEFF",b=(function(x){v(w,x);function w(k){h(this,w);var j=p(this,(w.__proto__||Object.getPrototypeOf(w)).call(this,k));return j.contentNode=document.createElement("span"),j.contentNode.setAttribute("contenteditable",!1),[].slice.call(j.domNode.childNodes).forEach(function(_){j.contentNode.appendChild(_)}),j.leftGuard=document.createTextNode(m),j.rightGuard=document.createTextNode(m),j.domNode.appendChild(j.leftGuard),j.domNode.appendChild(j.contentNode),j.domNode.appendChild(j.rightGuard),j}return a(w,[{key:"index",value:function(j,_){return j===this.leftGuard?0:j===this.rightGuard?1:s(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"index",this).call(this,j,_)}},{key:"restore",value:function(j){var _=void 0,T=void 0,A=j.data.split(m).join("");if(j===this.leftGuard)if(this.prev instanceof d.default){var P=this.prev.length();this.prev.insertAt(P,A),_={startNode:this.prev.domNode,startOffset:P+A.length}}else T=document.createTextNode(A),this.parent.insertBefore(c.default.create(T),this),_={startNode:T,startOffset:A.length};else j===this.rightGuard&&(this.next instanceof d.default?(this.next.insertAt(0,A),_={startNode:this.next.domNode,startOffset:A.length}):(T=document.createTextNode(A),this.parent.insertBefore(c.default.create(T),this.next),_={startNode:T,startOffset:A.length}));return j.data=m,_}},{key:"update",value:function(j,_){var T=this;j.forEach(function(A){if(A.type==="characterData"&&(A.target===T.leftGuard||A.target===T.rightGuard)){var P=T.restore(A.target);P&&(_.range=P)}})}}]),w})(c.default.Embed);n.default=b}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.AlignStyle=n.AlignClass=n.AlignAttribute=void 0;var a=o(0),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}var c={scope:s.default.Scope.BLOCK,whitelist:["right","center","justify"]},u=new s.default.Attributor.Attribute("align","align",c),d=new s.default.Attributor.Class("align","ql-align",c),f=new s.default.Attributor.Style("align","text-align",c);n.AlignAttribute=u,n.AlignClass=d,n.AlignStyle=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.BackgroundStyle=n.BackgroundClass=void 0;var a=o(0),s=c(a),l=o(26);function c(f){return f&&f.__esModule?f:{default:f}}var u=new s.default.Attributor.Class("background","ql-bg",{scope:s.default.Scope.INLINE}),d=new l.ColorAttributor("background","background-color",{scope:s.default.Scope.INLINE});n.BackgroundClass=u,n.BackgroundStyle=d}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.DirectionStyle=n.DirectionClass=n.DirectionAttribute=void 0;var a=o(0),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}var c={scope:s.default.Scope.BLOCK,whitelist:["rtl"]},u=new s.default.Attributor.Attribute("direction","dir",c),d=new s.default.Attributor.Class("direction","ql-direction",c),f=new s.default.Attributor.Style("direction","direction",c);n.DirectionAttribute=u,n.DirectionClass=d,n.DirectionStyle=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.FontClass=n.FontStyle=void 0;var a=(function(){function x(w,k){for(var j=0;j<k.length;j++){var _=k[j];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(w,_.key,_)}}return function(w,k,j){return k&&x(w.prototype,k),j&&x(w,j),w}})(),s=function x(w,k,j){w===null&&(w=Function.prototype);var _=Object.getOwnPropertyDescriptor(w,k);if(_===void 0){var T=Object.getPrototypeOf(w);return T===null?void 0:x(T,k,j)}else{if("value"in _)return _.value;var A=_.get;return A===void 0?void 0:A.call(j)}},l=o(0),c=u(l);function u(x){return x&&x.__esModule?x:{default:x}}function d(x,w){if(!(x instanceof w))throw new TypeError("Cannot call a class as a function")}function f(x,w){if(!x)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w&&(typeof w=="object"||typeof w=="function")?w:x}function h(x,w){if(typeof w!="function"&&w!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof w);x.prototype=Object.create(w&&w.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),w&&(Object.setPrototypeOf?Object.setPrototypeOf(x,w):x.__proto__=w)}var p={scope:c.default.Scope.INLINE,whitelist:["serif","monospace"]},v=new c.default.Attributor.Class("font","ql-font",p),m=(function(x){h(w,x);function w(){return d(this,w),f(this,(w.__proto__||Object.getPrototypeOf(w)).apply(this,arguments))}return a(w,[{key:"value",value:function(j){return s(w.prototype.__proto__||Object.getPrototypeOf(w.prototype),"value",this).call(this,j).replace(/["']/g,"")}}]),w})(c.default.Attributor.Style),b=new m("font","font-family",p);n.FontStyle=b,n.FontClass=v}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.SizeStyle=n.SizeClass=void 0;var a=o(0),s=l(a);function l(d){return d&&d.__esModule?d:{default:d}}var c=new s.default.Attributor.Class("size","ql-size",{scope:s.default.Scope.INLINE,whitelist:["small","large","huge"]}),u=new s.default.Attributor.Style("size","font-size",{scope:s.default.Scope.INLINE,whitelist:["10px","18px","32px"]});n.SizeClass=c,n.SizeStyle=u}),(function(r,n,o){r.exports={align:{"":o(76),center:o(77),right:o(78),justify:o(79)},background:o(80),blockquote:o(81),bold:o(82),clean:o(83),code:o(58),"code-block":o(58),color:o(84),direction:{"":o(85),rtl:o(86)},float:{center:o(87),full:o(88),left:o(89),right:o(90)},formula:o(91),header:{1:o(92),2:o(93)},italic:o(94),image:o(95),indent:{"+1":o(96),"-1":o(97)},link:o(98),list:{ordered:o(99),bullet:o(100),check:o(101)},script:{sub:o(102),super:o(103)},strike:o(104),underline:o(105),video:o(106)}}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.getLastChangeIndex=n.default=void 0;var a=(function(){function k(j,_){for(var T=0;T<_.length;T++){var A=_[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(j,A.key,A)}}return function(j,_,T){return _&&k(j.prototype,_),T&&k(j,T),j}})(),s=o(0),l=h(s),c=o(5),u=h(c),d=o(9),f=h(d);function h(k){return k&&k.__esModule?k:{default:k}}function p(k,j){if(!(k instanceof j))throw new TypeError("Cannot call a class as a function")}function v(k,j){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j&&(typeof j=="object"||typeof j=="function")?j:k}function m(k,j){if(typeof j!="function"&&j!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof j);k.prototype=Object.create(j&&j.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),j&&(Object.setPrototypeOf?Object.setPrototypeOf(k,j):k.__proto__=j)}var b=(function(k){m(j,k);function j(_,T){p(this,j);var A=v(this,(j.__proto__||Object.getPrototypeOf(j)).call(this,_,T));return A.lastRecorded=0,A.ignoreChange=!1,A.clear(),A.quill.on(u.default.events.EDITOR_CHANGE,function(P,N,O,C){P!==u.default.events.TEXT_CHANGE||A.ignoreChange||(!A.options.userOnly||C===u.default.sources.USER?A.record(N,O):A.transform(N))}),A.quill.keyboard.addBinding({key:"Z",shortKey:!0},A.undo.bind(A)),A.quill.keyboard.addBinding({key:"Z",shortKey:!0,shiftKey:!0},A.redo.bind(A)),/Win/i.test(navigator.platform)&&A.quill.keyboard.addBinding({key:"Y",shortKey:!0},A.redo.bind(A)),A}return a(j,[{key:"change",value:function(T,A){if(this.stack[T].length!==0){var P=this.stack[T].pop();this.stack[A].push(P),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(P[T],u.default.sources.USER),this.ignoreChange=!1;var N=w(P[T]);this.quill.setSelection(N)}}},{key:"clear",value:function(){this.stack={undo:[],redo:[]}}},{key:"cutoff",value:function(){this.lastRecorded=0}},{key:"record",value:function(T,A){if(T.ops.length!==0){this.stack.redo=[];var P=this.quill.getContents().diff(A),N=Date.now();if(this.lastRecorded+this.options.delay>N&&this.stack.undo.length>0){var O=this.stack.undo.pop();P=P.compose(O.undo),T=O.redo.compose(T)}else this.lastRecorded=N;this.stack.undo.push({redo:T,undo:P}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(T){this.stack.undo.forEach(function(A){A.undo=T.transform(A.undo,!0),A.redo=T.transform(A.redo,!0)}),this.stack.redo.forEach(function(A){A.undo=T.transform(A.undo,!0),A.redo=T.transform(A.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),j})(f.default);b.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1};function x(k){var j=k.ops[k.ops.length-1];return j==null?!1:j.insert!=null?typeof j.insert=="string"&&j.insert.endsWith(`
`):j.attributes!=null?Object.keys(j.attributes).some(function(_){return l.default.query(_,l.default.Scope.BLOCK)!=null}):!1}function w(k){var j=k.reduce(function(T,A){return T+=A.delete||0,T},0),_=k.length()-j;return x(k)&&(_-=1),_}n.default=b,n.getLastChangeIndex=w}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BaseTooltip=void 0;var a=(function(){function z(q,G){for(var U=0;U<G.length;U++){var Q=G[U];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(q,Q.key,Q)}}return function(q,G,U){return G&&z(q.prototype,G),U&&z(q,U),q}})(),s=function z(q,G,U){q===null&&(q=Function.prototype);var Q=Object.getOwnPropertyDescriptor(q,G);if(Q===void 0){var K=Object.getPrototypeOf(q);return K===null?void 0:z(K,G,U)}else{if("value"in Q)return Q.value;var re=Q.get;return re===void 0?void 0:re.call(U)}},l=o(3),c=N(l),u=o(2),d=N(u),f=o(8),h=N(f),p=o(23),v=N(p),m=o(34),b=N(m),x=o(59),w=N(x),k=o(60),j=N(k),_=o(28),T=N(_),A=o(61),P=N(A);function N(z){return z&&z.__esModule?z:{default:z}}function O(z,q){if(!(z instanceof q))throw new TypeError("Cannot call a class as a function")}function C(z,q){if(!z)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return q&&(typeof q=="object"||typeof q=="function")?q:z}function I(z,q){if(typeof q!="function"&&q!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof q);z.prototype=Object.create(q&&q.prototype,{constructor:{value:z,enumerable:!1,writable:!0,configurable:!0}}),q&&(Object.setPrototypeOf?Object.setPrototypeOf(z,q):z.__proto__=q)}var R=[!1,"center","right","justify"],F=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],M=[!1,"serif","monospace"],Y=["1","2","3",!1],X=["small",!1,"large","huge"],$=(function(z){I(q,z);function q(G,U){O(this,q);var Q=C(this,(q.__proto__||Object.getPrototypeOf(q)).call(this,G,U)),K=function re(H){if(!document.body.contains(G.root))return document.body.removeEventListener("click",re);Q.tooltip!=null&&!Q.tooltip.root.contains(H.target)&&document.activeElement!==Q.tooltip.textbox&&!Q.quill.hasFocus()&&Q.tooltip.hide(),Q.pickers!=null&&Q.pickers.forEach(function(ie){ie.container.contains(H.target)||ie.close()})};return G.emitter.listenDOM("click",document.body,K),Q}return a(q,[{key:"addModule",value:function(U){var Q=s(q.prototype.__proto__||Object.getPrototypeOf(q.prototype),"addModule",this).call(this,U);return U==="toolbar"&&this.extendToolbar(Q),Q}},{key:"buildButtons",value:function(U,Q){U.forEach(function(K){var re=K.getAttribute("class")||"";re.split(/\s+/).forEach(function(H){if(H.startsWith("ql-")&&(H=H.slice(3),Q[H]!=null))if(H==="direction")K.innerHTML=Q[H][""]+Q[H].rtl;else if(typeof Q[H]=="string")K.innerHTML=Q[H];else{var ie=K.value||"";ie!=null&&Q[H][ie]&&(K.innerHTML=Q[H][ie])}})})}},{key:"buildPickers",value:function(U,Q){var K=this;this.pickers=U.map(function(H){if(H.classList.contains("ql-align"))return H.querySelector("option")==null&&D(H,R),new j.default(H,Q.align);if(H.classList.contains("ql-background")||H.classList.contains("ql-color")){var ie=H.classList.contains("ql-background")?"background":"color";return H.querySelector("option")==null&&D(H,F,ie==="background"?"#ffffff":"#000000"),new w.default(H,Q[ie])}else return H.querySelector("option")==null&&(H.classList.contains("ql-font")?D(H,M):H.classList.contains("ql-header")?D(H,Y):H.classList.contains("ql-size")&&D(H,X)),new T.default(H)});var re=function(){K.pickers.forEach(function(ie){ie.update()})};this.quill.on(h.default.events.EDITOR_CHANGE,re)}}]),q})(b.default);$.DEFAULTS=(0,c.default)(!0,{},b.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var q=this,G=this.container.querySelector("input.ql-image[type=file]");G==null&&(G=document.createElement("input"),G.setAttribute("type","file"),G.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),G.classList.add("ql-image"),G.addEventListener("change",function(){if(G.files!=null&&G.files[0]!=null){var U=new FileReader;U.onload=function(Q){var K=q.quill.getSelection(!0);q.quill.updateContents(new d.default().retain(K.index).delete(K.length).insert({image:Q.target.result}),h.default.sources.USER),q.quill.setSelection(K.index+1,h.default.sources.SILENT),G.value=""},U.readAsDataURL(G.files[0])}}),this.container.appendChild(G)),G.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}});var ee=(function(z){I(q,z);function q(G,U){O(this,q);var Q=C(this,(q.__proto__||Object.getPrototypeOf(q)).call(this,G,U));return Q.textbox=Q.root.querySelector('input[type="text"]'),Q.listen(),Q}return a(q,[{key:"listen",value:function(){var U=this;this.textbox.addEventListener("keydown",function(Q){v.default.match(Q,"enter")?(U.save(),Q.preventDefault()):v.default.match(Q,"escape")&&(U.cancel(),Q.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"link",Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),Q!=null?this.textbox.value=Q:U!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+U)||""),this.root.setAttribute("data-mode",U)}},{key:"restoreFocus",value:function(){var U=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=U}},{key:"save",value:function(){var U=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":{var Q=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",U,h.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",U,h.default.sources.USER)),this.quill.root.scrollTop=Q;break}case"video":U=V(U);case"formula":{if(!U)break;var K=this.quill.getSelection(!0);if(K!=null){var re=K.index+K.length;this.quill.insertEmbed(re,this.root.getAttribute("data-mode"),U,h.default.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(re+1," ",h.default.sources.USER),this.quill.setSelection(re+2,h.default.sources.USER)}break}}this.textbox.value="",this.hide()}}]),q})(P.default);function V(z){var q=z.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||z.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return q?(q[1]||"https")+"://www.youtube.com/embed/"+q[2]+"?showinfo=0":(q=z.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(q[1]||"https")+"://player.vimeo.com/video/"+q[2]+"/":z}function D(z,q){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;q.forEach(function(U){var Q=document.createElement("option");U===G?Q.setAttribute("selected","selected"):Q.setAttribute("value",U),z.appendChild(Q)})}n.BaseTooltip=ee,n.default=$}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function s(){this.head=this.tail=null,this.length=0}return s.prototype.append=function(){for(var l=[],c=0;c<arguments.length;c++)l[c]=arguments[c];this.insertBefore(l[0],null),l.length>1&&this.append.apply(this,l.slice(1))},s.prototype.contains=function(l){for(var c,u=this.iterator();c=u();)if(c===l)return!0;return!1},s.prototype.insertBefore=function(l,c){l&&(l.next=c,c!=null?(l.prev=c.prev,c.prev!=null&&(c.prev.next=l),c.prev=l,c===this.head&&(this.head=l)):this.tail!=null?(this.tail.next=l,l.prev=this.tail,this.tail=l):(l.prev=null,this.head=this.tail=l),this.length+=1)},s.prototype.offset=function(l){for(var c=0,u=this.head;u!=null;){if(u===l)return c;c+=u.length(),u=u.next}return-1},s.prototype.remove=function(l){this.contains(l)&&(l.prev!=null&&(l.prev.next=l.next),l.next!=null&&(l.next.prev=l.prev),l===this.head&&(this.head=l.next),l===this.tail&&(this.tail=l.prev),this.length-=1)},s.prototype.iterator=function(l){return l===void 0&&(l=this.head),function(){var c=l;return l!=null&&(l=l.next),c}},s.prototype.find=function(l,c){c===void 0&&(c=!1);for(var u,d=this.iterator();u=d();){var f=u.length();if(l<f||c&&l===f&&(u.next==null||u.next.length()!==0))return[u,l];l-=f}return[null,0]},s.prototype.forEach=function(l){for(var c,u=this.iterator();c=u();)l(c)},s.prototype.forEachAt=function(l,c,u){if(!(c<=0))for(var d=this.find(l),f=d[0],h=d[1],p,v=l-h,m=this.iterator(f);(p=m())&&v<l+c;){var b=p.length();l>v?u(p,l-v,Math.min(c,v+b-l)):u(p,0,Math.min(b,l+c-v)),v+=b}},s.prototype.map=function(l){return this.reduce(function(c,u){return c.push(l(u)),c},[])},s.prototype.reduce=function(l,c){for(var u,d=this.iterator();u=d();)c=l(c,u);return c},s})();n.default=a}),(function(r,n,o){var a=this&&this.__extends||(function(){var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,p){h.__proto__=p}||function(h,p){for(var v in p)p.hasOwnProperty(v)&&(h[v]=p[v])};return function(h,p){f(h,p);function v(){this.constructor=h}h.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(17),l=o(1),c={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},u=100,d=(function(f){a(h,f);function h(p){var v=f.call(this,p)||this;return v.scroll=v,v.observer=new MutationObserver(function(m){v.update(m)}),v.observer.observe(v.domNode,c),v.attach(),v}return h.prototype.detach=function(){f.prototype.detach.call(this),this.observer.disconnect()},h.prototype.deleteAt=function(p,v){this.update(),p===0&&v===this.length()?this.children.forEach(function(m){m.remove()}):f.prototype.deleteAt.call(this,p,v)},h.prototype.formatAt=function(p,v,m,b){this.update(),f.prototype.formatAt.call(this,p,v,m,b)},h.prototype.insertAt=function(p,v,m){this.update(),f.prototype.insertAt.call(this,p,v,m)},h.prototype.optimize=function(p,v){var m=this;p===void 0&&(p=[]),v===void 0&&(v={}),f.prototype.optimize.call(this,v);for(var b=[].slice.call(this.observer.takeRecords());b.length>0;)p.push(b.pop());for(var x=function(_,T){T===void 0&&(T=!0),!(_==null||_===m)&&_.domNode.parentNode!=null&&(_.domNode[l.DATA_KEY].mutations==null&&(_.domNode[l.DATA_KEY].mutations=[]),T&&x(_.parent))},w=function(_){_.domNode[l.DATA_KEY]==null||_.domNode[l.DATA_KEY].mutations==null||(_ instanceof s.default&&_.children.forEach(w),_.optimize(v))},k=p,j=0;k.length>0;j+=1){if(j>=u)throw new Error("[Parchment] Maximum optimize iterations reached");for(k.forEach(function(_){var T=l.find(_.target,!0);T!=null&&(T.domNode===_.target&&(_.type==="childList"?(x(l.find(_.previousSibling,!1)),[].forEach.call(_.addedNodes,function(A){var P=l.find(A,!1);x(P,!1),P instanceof s.default&&P.children.forEach(function(N){x(N,!1)})})):_.type==="attributes"&&x(T.prev)),x(T))}),this.children.forEach(w),k=[].slice.call(this.observer.takeRecords()),b=k.slice();b.length>0;)p.push(b.pop())}},h.prototype.update=function(p,v){var m=this;v===void 0&&(v={}),p=p||this.observer.takeRecords(),p.map(function(b){var x=l.find(b.target,!0);return x==null?null:x.domNode[l.DATA_KEY].mutations==null?(x.domNode[l.DATA_KEY].mutations=[b],x):(x.domNode[l.DATA_KEY].mutations.push(b),null)}).forEach(function(b){b==null||b===m||b.domNode[l.DATA_KEY]==null||b.update(b.domNode[l.DATA_KEY].mutations||[],v)}),this.domNode[l.DATA_KEY].mutations!=null&&f.prototype.update.call(this,this.domNode[l.DATA_KEY].mutations,v),this.optimize(p,v)},h.blotName="scroll",h.defaultChild="block",h.scope=l.Scope.BLOCK_BLOT,h.tagName="DIV",h})(s.default);n.default=d}),(function(r,n,o){var a=this&&this.__extends||(function(){var d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var p in h)h.hasOwnProperty(p)&&(f[p]=h[p])};return function(f,h){d(f,h);function p(){this.constructor=f}f.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(18),l=o(1);function c(d,f){if(Object.keys(d).length!==Object.keys(f).length)return!1;for(var h in d)if(d[h]!==f[h])return!1;return!0}var u=(function(d){a(f,d);function f(){return d!==null&&d.apply(this,arguments)||this}return f.formats=function(h){if(h.tagName!==f.tagName)return d.formats.call(this,h)},f.prototype.format=function(h,p){var v=this;h===this.statics.blotName&&!p?(this.children.forEach(function(m){m instanceof s.default||(m=m.wrap(f.blotName,!0)),v.attributes.copy(m)}),this.unwrap()):d.prototype.format.call(this,h,p)},f.prototype.formatAt=function(h,p,v,m){if(this.formats()[v]!=null||l.query(v,l.Scope.ATTRIBUTE)){var b=this.isolate(h,p);b.format(v,m)}else d.prototype.formatAt.call(this,h,p,v,m)},f.prototype.optimize=function(h){d.prototype.optimize.call(this,h);var p=this.formats();if(Object.keys(p).length===0)return this.unwrap();var v=this.next;v instanceof f&&v.prev===this&&c(p,v.formats())&&(v.moveChildren(this),v.remove())},f.blotName="inline",f.scope=l.Scope.INLINE_BLOT,f.tagName="SPAN",f})(s.default);n.default=u}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(18),l=o(1),c=(function(u){a(d,u);function d(){return u!==null&&u.apply(this,arguments)||this}return d.formats=function(f){var h=l.query(d.blotName).tagName;if(f.tagName!==h)return u.formats.call(this,f)},d.prototype.format=function(f,h){l.query(f,l.Scope.BLOCK)!=null&&(f===this.statics.blotName&&!h?this.replaceWith(d.blotName):u.prototype.format.call(this,f,h))},d.prototype.formatAt=function(f,h,p,v){l.query(p,l.Scope.BLOCK)!=null?this.format(p,v):u.prototype.formatAt.call(this,f,h,p,v)},d.prototype.insertAt=function(f,h,p){if(p==null||l.query(h,l.Scope.INLINE)!=null)u.prototype.insertAt.call(this,f,h,p);else{var v=this.split(f),m=l.create(h,p);v.parent.insertBefore(m,v)}},d.prototype.update=function(f,h){navigator.userAgent.match(/Trident/)?this.build():u.prototype.update.call(this,f,h)},d.blotName="block",d.scope=l.Scope.BLOCK_BLOT,d.tagName="P",d})(s.default);n.default=c}),(function(r,n,o){var a=this&&this.__extends||(function(){var c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,d){u.__proto__=d}||function(u,d){for(var f in d)d.hasOwnProperty(f)&&(u[f]=d[f])};return function(u,d){c(u,d);function f(){this.constructor=u}u.prototype=d===null?Object.create(d):(f.prototype=d.prototype,new f)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(19),l=(function(c){a(u,c);function u(){return c!==null&&c.apply(this,arguments)||this}return u.formats=function(d){},u.prototype.format=function(d,f){c.prototype.formatAt.call(this,0,this.length(),d,f)},u.prototype.formatAt=function(d,f,h,p){d===0&&f===this.length()?this.format(h,p):c.prototype.formatAt.call(this,d,f,h,p)},u.prototype.formats=function(){return this.statics.formats(this.domNode)},u})(s.default);n.default=l}),(function(r,n,o){var a=this&&this.__extends||(function(){var u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var h in f)f.hasOwnProperty(h)&&(d[h]=f[h])};return function(d,f){u(d,f);function h(){this.constructor=d}d.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)}})();Object.defineProperty(n,"__esModule",{value:!0});var s=o(19),l=o(1),c=(function(u){a(d,u);function d(f){var h=u.call(this,f)||this;return h.text=h.statics.value(h.domNode),h}return d.create=function(f){return document.createTextNode(f)},d.value=function(f){var h=f.data;return h.normalize&&(h=h.normalize()),h},d.prototype.deleteAt=function(f,h){this.domNode.data=this.text=this.text.slice(0,f)+this.text.slice(f+h)},d.prototype.index=function(f,h){return this.domNode===f?h:-1},d.prototype.insertAt=function(f,h,p){p==null?(this.text=this.text.slice(0,f)+h+this.text.slice(f),this.domNode.data=this.text):u.prototype.insertAt.call(this,f,h,p)},d.prototype.length=function(){return this.text.length},d.prototype.optimize=function(f){u.prototype.optimize.call(this,f),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof d&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},d.prototype.position=function(f,h){return[this.domNode,f]},d.prototype.split=function(f,h){if(h===void 0&&(h=!1),!h){if(f===0)return this;if(f===this.length())return this.next}var p=l.create(this.domNode.splitText(f));return this.parent.insertBefore(p,this.next),this.text=this.statics.value(this.domNode),p},d.prototype.update=function(f,h){var p=this;f.some(function(v){return v.type==="characterData"&&v.target===p.domNode})&&(this.text=this.statics.value(this.domNode))},d.prototype.value=function(){return this.text},d.blotName="text",d.scope=l.Scope.INLINE_BLOT,d})(s.default);n.default=c}),(function(r,n,o){var a=document.createElement("div");if(a.classList.toggle("test-class",!1),a.classList.contains("test-class")){var s=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(l,c){return arguments.length>1&&!this.contains(l)==!c?c:s.call(this,l)}}String.prototype.startsWith||(String.prototype.startsWith=function(l,c){return c=c||0,this.substr(c,l.length)===l}),String.prototype.endsWith||(String.prototype.endsWith=function(l,c){var u=this.toString();(typeof c!="number"||!isFinite(c)||Math.floor(c)!==c||c>u.length)&&(c=u.length),c-=l.length;var d=u.indexOf(l,c);return d!==-1&&d===c}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(c){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof c!="function")throw new TypeError("predicate must be a function");for(var u=Object(this),d=u.length>>>0,f=arguments[1],h,p=0;p<d;p++)if(h=u[p],c.call(f,h,p,u))return h}}),document.addEventListener("DOMContentLoaded",function(){document.execCommand("enableObjectResizing",!1,!1),document.execCommand("autoUrlDetect",!1,!1)})}),(function(r,n){var o=-1,a=1,s=0;function l(j,_,T){if(j==_)return j?[[s,j]]:[];(T<0||j.length<T)&&(T=null);var A=f(j,_),P=j.substring(0,A);j=j.substring(A),_=_.substring(A),A=h(j,_);var N=j.substring(j.length-A);j=j.substring(0,j.length-A),_=_.substring(0,_.length-A);var O=c(j,_);return P&&O.unshift([s,P]),N&&O.push([s,N]),v(O),T!=null&&(O=x(O,T)),O=w(O),O}function c(j,_){var T;if(!j)return[[a,_]];if(!_)return[[o,j]];var A=j.length>_.length?j:_,P=j.length>_.length?_:j,N=A.indexOf(P);if(N!=-1)return T=[[a,A.substring(0,N)],[s,P],[a,A.substring(N+P.length)]],j.length>_.length&&(T[0][0]=T[2][0]=o),T;if(P.length==1)return[[o,j],[a,_]];var O=p(j,_);if(O){var C=O[0],I=O[1],R=O[2],F=O[3],M=O[4],Y=l(C,R),X=l(I,F);return Y.concat([[s,M]],X)}return u(j,_)}function u(j,_){for(var T=j.length,A=_.length,P=Math.ceil((T+A)/2),N=P,O=2*P,C=new Array(O),I=new Array(O),R=0;R<O;R++)C[R]=-1,I[R]=-1;C[N+1]=0,I[N+1]=0;for(var F=T-A,M=F%2!=0,Y=0,X=0,$=0,ee=0,V=0;V<P;V++){for(var D=-V+Y;D<=V-X;D+=2){var z=N+D,q;D==-V||D!=V&&C[z-1]<C[z+1]?q=C[z+1]:q=C[z-1]+1;for(var G=q-D;q<T&&G<A&&j.charAt(q)==_.charAt(G);)q++,G++;if(C[z]=q,q>T)X+=2;else if(G>A)Y+=2;else if(M){var U=N+F-D;if(U>=0&&U<O&&I[U]!=-1){var Q=T-I[U];if(q>=Q)return d(j,_,q,G)}}}for(var K=-V+$;K<=V-ee;K+=2){var U=N+K,Q;K==-V||K!=V&&I[U-1]<I[U+1]?Q=I[U+1]:Q=I[U-1]+1;for(var re=Q-K;Q<T&&re<A&&j.charAt(T-Q-1)==_.charAt(A-re-1);)Q++,re++;if(I[U]=Q,Q>T)ee+=2;else if(re>A)$+=2;else if(!M){var z=N+F-K;if(z>=0&&z<O&&C[z]!=-1){var q=C[z],G=N+q-z;if(Q=T-Q,q>=Q)return d(j,_,q,G)}}}}return[[o,j],[a,_]]}function d(j,_,T,A){var P=j.substring(0,T),N=_.substring(0,A),O=j.substring(T),C=_.substring(A),I=l(P,N),R=l(O,C);return I.concat(R)}function f(j,_){if(!j||!_||j.charAt(0)!=_.charAt(0))return 0;for(var T=0,A=Math.min(j.length,_.length),P=A,N=0;T<P;)j.substring(N,P)==_.substring(N,P)?(T=P,N=T):A=P,P=Math.floor((A-T)/2+T);return P}function h(j,_){if(!j||!_||j.charAt(j.length-1)!=_.charAt(_.length-1))return 0;for(var T=0,A=Math.min(j.length,_.length),P=A,N=0;T<P;)j.substring(j.length-P,j.length-N)==_.substring(_.length-P,_.length-N)?(T=P,N=T):A=P,P=Math.floor((A-T)/2+T);return P}function p(j,_){var T=j.length>_.length?j:_,A=j.length>_.length?_:j;if(T.length<4||A.length*2<T.length)return null;function P(X,$,ee){for(var V=X.substring(ee,ee+Math.floor(X.length/4)),D=-1,z="",q,G,U,Q;(D=$.indexOf(V,D+1))!=-1;){var K=f(X.substring(ee),$.substring(D)),re=h(X.substring(0,ee),$.substring(0,D));z.length<re+K&&(z=$.substring(D-re,D)+$.substring(D,D+K),q=X.substring(0,ee-re),G=X.substring(ee+K),U=$.substring(0,D-re),Q=$.substring(D+K))}return z.length*2>=X.length?[q,G,U,Q,z]:null}var N=P(T,A,Math.ceil(T.length/4)),O=P(T,A,Math.ceil(T.length/2)),C;if(!N&&!O)return null;O?N?C=N[4].length>O[4].length?N:O:C=O:C=N;var I,R,F,M;j.length>_.length?(I=C[0],R=C[1],F=C[2],M=C[3]):(F=C[0],M=C[1],I=C[2],R=C[3]);var Y=C[4];return[I,R,F,M,Y]}function v(j){j.push([s,""]);for(var _=0,T=0,A=0,P="",N="",O;_<j.length;)switch(j[_][0]){case a:A++,N+=j[_][1],_++;break;case o:T++,P+=j[_][1],_++;break;case s:T+A>1?(T!==0&&A!==0&&(O=f(N,P),O!==0&&(_-T-A>0&&j[_-T-A-1][0]==s?j[_-T-A-1][1]+=N.substring(0,O):(j.splice(0,0,[s,N.substring(0,O)]),_++),N=N.substring(O),P=P.substring(O)),O=h(N,P),O!==0&&(j[_][1]=N.substring(N.length-O)+j[_][1],N=N.substring(0,N.length-O),P=P.substring(0,P.length-O))),T===0?j.splice(_-A,T+A,[a,N]):A===0?j.splice(_-T,T+A,[o,P]):j.splice(_-T-A,T+A,[o,P],[a,N]),_=_-T-A+(T?1:0)+(A?1:0)+1):_!==0&&j[_-1][0]==s?(j[_-1][1]+=j[_][1],j.splice(_,1)):_++,A=0,T=0,P="",N="";break}j[j.length-1][1]===""&&j.pop();var C=!1;for(_=1;_<j.length-1;)j[_-1][0]==s&&j[_+1][0]==s&&(j[_][1].substring(j[_][1].length-j[_-1][1].length)==j[_-1][1]?(j[_][1]=j[_-1][1]+j[_][1].substring(0,j[_][1].length-j[_-1][1].length),j[_+1][1]=j[_-1][1]+j[_+1][1],j.splice(_-1,1),C=!0):j[_][1].substring(0,j[_+1][1].length)==j[_+1][1]&&(j[_-1][1]+=j[_+1][1],j[_][1]=j[_][1].substring(j[_+1][1].length)+j[_+1][1],j.splice(_+1,1),C=!0)),_++;C&&v(j)}var m=l;m.INSERT=a,m.DELETE=o,m.EQUAL=s,r.exports=m;function b(j,_){if(_===0)return[s,j];for(var T=0,A=0;A<j.length;A++){var P=j[A];if(P[0]===o||P[0]===s){var N=T+P[1].length;if(_===N)return[A+1,j];if(_<N){j=j.slice();var O=_-T,C=[P[0],P[1].slice(0,O)],I=[P[0],P[1].slice(O)];return j.splice(A,1,C,I),[A+1,j]}else T=N}}throw new Error("cursor_pos is out of bounds!")}function x(j,_){var T=b(j,_),A=T[1],P=T[0],N=A[P],O=A[P+1];if(N==null)return j;if(N[0]!==s)return j;if(O!=null&&N[1]+O[1]===O[1]+N[1])return A.splice(P,2,O,N),k(A,P,2);if(O!=null&&O[1].indexOf(N[1])===0){A.splice(P,2,[O[0],N[1]],[0,N[1]]);var C=O[1].slice(N[1].length);return C.length>0&&A.splice(P+2,0,[O[0],C]),k(A,P,3)}else return j}function w(j){for(var _=!1,T=function(O){return O.charCodeAt(0)>=56320&&O.charCodeAt(0)<=57343},A=function(O){return O.charCodeAt(O.length-1)>=55296&&O.charCodeAt(O.length-1)<=56319},P=2;P<j.length;P+=1)j[P-2][0]===s&&A(j[P-2][1])&&j[P-1][0]===o&&T(j[P-1][1])&&j[P][0]===a&&T(j[P][1])&&(_=!0,j[P-1][1]=j[P-2][1].slice(-1)+j[P-1][1],j[P][1]=j[P-2][1].slice(-1)+j[P][1],j[P-2][1]=j[P-2][1].slice(0,-1));if(!_)return j;for(var N=[],P=0;P<j.length;P+=1)j[P][1].length>0&&N.push(j[P]);return N}function k(j,_,T){for(var A=_+T-1;A>=0&&A>=_-1;A--)if(A+1<j.length){var P=j[A],N=j[A+1];P[0]===N[1]&&j.splice(A,2,[P[0],P[1]+N[1]])}return j}}),(function(r,n){n=r.exports=typeof Object.keys=="function"?Object.keys:o,n.shim=o;function o(a){var s=[];for(var l in a)s.push(l);return s}}),(function(r,n){var o=(function(){return Object.prototype.toString.call(arguments)})()=="[object Arguments]";n=r.exports=o?a:s,n.supported=a;function a(l){return Object.prototype.toString.call(l)=="[object Arguments]"}n.unsupported=s;function s(l){return l&&typeof l=="object"&&typeof l.length=="number"&&Object.prototype.hasOwnProperty.call(l,"callee")&&!Object.prototype.propertyIsEnumerable.call(l,"callee")||!1}}),(function(r,n){var o=Object.prototype.hasOwnProperty,a="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(a=!1));function l(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function c(){this._events=new s,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],f,h;if(this._eventsCount===0)return d;for(h in f=this._events)o.call(f,h)&&d.push(a?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},c.prototype.listeners=function(d,f){var h=a?a+d:d,p=this._events[h];if(f)return!!p;if(!p)return[];if(p.fn)return[p.fn];for(var v=0,m=p.length,b=new Array(m);v<m;v++)b[v]=p[v].fn;return b},c.prototype.emit=function(d,f,h,p,v,m){var b=a?a+d:d;if(!this._events[b])return!1;var x=this._events[b],w=arguments.length,k,j;if(x.fn){switch(x.once&&this.removeListener(d,x.fn,void 0,!0),w){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,f),!0;case 3:return x.fn.call(x.context,f,h),!0;case 4:return x.fn.call(x.context,f,h,p),!0;case 5:return x.fn.call(x.context,f,h,p,v),!0;case 6:return x.fn.call(x.context,f,h,p,v,m),!0}for(j=1,k=new Array(w-1);j<w;j++)k[j-1]=arguments[j];x.fn.apply(x.context,k)}else{var _=x.length,T;for(j=0;j<_;j++)switch(x[j].once&&this.removeListener(d,x[j].fn,void 0,!0),w){case 1:x[j].fn.call(x[j].context);break;case 2:x[j].fn.call(x[j].context,f);break;case 3:x[j].fn.call(x[j].context,f,h);break;case 4:x[j].fn.call(x[j].context,f,h,p);break;default:if(!k)for(T=1,k=new Array(w-1);T<w;T++)k[T-1]=arguments[T];x[j].fn.apply(x[j].context,k)}}return!0},c.prototype.on=function(d,f,h){var p=new l(f,h||this),v=a?a+d:d;return this._events[v]?this._events[v].fn?this._events[v]=[this._events[v],p]:this._events[v].push(p):(this._events[v]=p,this._eventsCount++),this},c.prototype.once=function(d,f,h){var p=new l(f,h||this,!0),v=a?a+d:d;return this._events[v]?this._events[v].fn?this._events[v]=[this._events[v],p]:this._events[v].push(p):(this._events[v]=p,this._eventsCount++),this},c.prototype.removeListener=function(d,f,h,p){var v=a?a+d:d;if(!this._events[v])return this;if(!f)return--this._eventsCount===0?this._events=new s:delete this._events[v],this;var m=this._events[v];if(m.fn)m.fn===f&&(!p||m.once)&&(!h||m.context===h)&&(--this._eventsCount===0?this._events=new s:delete this._events[v]);else{for(var b=0,x=[],w=m.length;b<w;b++)(m[b].fn!==f||p&&!m[b].once||h&&m[b].context!==h)&&x.push(m[b]);x.length?this._events[v]=x.length===1?x[0]:x:--this._eventsCount===0?this._events=new s:delete this._events[v]}return this},c.prototype.removeAllListeners=function(d){var f;return d?(f=a?a+d:d,this._events[f]&&(--this._eventsCount===0?this._events=new s:delete this._events[f])):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prototype.setMaxListeners=function(){return this},c.prefixed=a,c.EventEmitter=c,typeof r<"u"&&(r.exports=c)}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.matchText=n.matchSpacing=n.matchNewline=n.matchBlot=n.matchAttributor=n.default=void 0;var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(ae){return typeof ae}:function(ae){return ae&&typeof Symbol=="function"&&ae.constructor===Symbol&&ae!==Symbol.prototype?"symbol":typeof ae},s=(function(){function ae(ue,Me){var Se=[],Pe=!0,Ee=!1,Ae=void 0;try{for(var Ye=ue[Symbol.iterator](),rt;!(Pe=(rt=Ye.next()).done)&&(Se.push(rt.value),!(Me&&Se.length===Me));Pe=!0);}catch(He){Ee=!0,Ae=He}finally{try{!Pe&&Ye.return&&Ye.return()}finally{if(Ee)throw Ae}}return Se}return function(ue,Me){if(Array.isArray(ue))return ue;if(Symbol.iterator in Object(ue))return ae(ue,Me);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=(function(){function ae(ue,Me){for(var Se=0;Se<Me.length;Se++){var Pe=Me[Se];Pe.enumerable=Pe.enumerable||!1,Pe.configurable=!0,"value"in Pe&&(Pe.writable=!0),Object.defineProperty(ue,Pe.key,Pe)}}return function(ue,Me,Se){return Me&&ae(ue.prototype,Me),Se&&ae(ue,Se),ue}})(),c=o(3),u=I(c),d=o(2),f=I(d),h=o(0),p=I(h),v=o(5),m=I(v),b=o(10),x=I(b),w=o(9),k=I(w),j=o(36),_=o(37),T=o(13),A=I(T),P=o(26),N=o(38),O=o(39),C=o(40);function I(ae){return ae&&ae.__esModule?ae:{default:ae}}function R(ae,ue,Me){return ue in ae?Object.defineProperty(ae,ue,{value:Me,enumerable:!0,configurable:!0,writable:!0}):ae[ue]=Me,ae}function F(ae,ue){if(!(ae instanceof ue))throw new TypeError("Cannot call a class as a function")}function M(ae,ue){if(!ae)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ue&&(typeof ue=="object"||typeof ue=="function")?ue:ae}function Y(ae,ue){if(typeof ue!="function"&&ue!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof ue);ae.prototype=Object.create(ue&&ue.prototype,{constructor:{value:ae,enumerable:!1,writable:!0,configurable:!0}}),ue&&(Object.setPrototypeOf?Object.setPrototypeOf(ae,ue):ae.__proto__=ue)}var X=(0,x.default)("quill:clipboard"),$="__ql-matcher",ee=[[Node.TEXT_NODE,De],[Node.TEXT_NODE,ve],["br",de],[Node.ELEMENT_NODE,ve],[Node.ELEMENT_NODE,ie],[Node.ELEMENT_NODE,se],[Node.ELEMENT_NODE,H],[Node.ELEMENT_NODE,be],["li",ke],["b",re.bind(re,"bold")],["i",re.bind(re,"italic")],["style",le]],V=[j.AlignAttribute,N.DirectionAttribute].reduce(function(ae,ue){return ae[ue.keyName]=ue,ae},{}),D=[j.AlignStyle,_.BackgroundStyle,P.ColorStyle,N.DirectionStyle,O.FontStyle,C.SizeStyle].reduce(function(ae,ue){return ae[ue.keyName]=ue,ae},{}),z=(function(ae){Y(ue,ae);function ue(Me,Se){F(this,ue);var Pe=M(this,(ue.__proto__||Object.getPrototypeOf(ue)).call(this,Me,Se));return Pe.quill.root.addEventListener("paste",Pe.onPaste.bind(Pe)),Pe.container=Pe.quill.addContainer("ql-clipboard"),Pe.container.setAttribute("contenteditable",!0),Pe.container.setAttribute("tabindex",-1),Pe.matchers=[],ee.concat(Pe.options.matchers).forEach(function(Ee){var Ae=s(Ee,2),Ye=Ae[0],rt=Ae[1];!Se.matchVisual&&rt===se||Pe.addMatcher(Ye,rt)}),Pe}return l(ue,[{key:"addMatcher",value:function(Se,Pe){this.matchers.push([Se,Pe])}},{key:"convert",value:function(Se){if(typeof Se=="string")return this.container.innerHTML=Se.replace(/\>\r?\n +\</g,"><"),this.convert();var Pe=this.quill.getFormat(this.quill.selection.savedRange.index);if(Pe[A.default.blotName]){var Ee=this.container.innerText;return this.container.innerHTML="",new f.default().insert(Ee,R({},A.default.blotName,Pe[A.default.blotName]))}var Ae=this.prepareMatching(),Ye=s(Ae,2),rt=Ye[0],He=Ye[1],xt=K(this.container,rt,He);return U(xt,`
`)&&xt.ops[xt.ops.length-1].attributes==null&&(xt=xt.compose(new f.default().retain(xt.length()-1).delete(1))),X.log("convert",this.container.innerHTML,xt),this.container.innerHTML="",xt}},{key:"dangerouslyPasteHTML",value:function(Se,Pe){var Ee=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.default.sources.API;if(typeof Se=="string")this.quill.setContents(this.convert(Se),Pe),this.quill.setSelection(0,m.default.sources.SILENT);else{var Ae=this.convert(Pe);this.quill.updateContents(new f.default().retain(Se).concat(Ae),Ee),this.quill.setSelection(Se+Ae.length(),m.default.sources.SILENT)}}},{key:"onPaste",value:function(Se){var Pe=this;if(!(Se.defaultPrevented||!this.quill.isEnabled())){var Ee=this.quill.getSelection(),Ae=new f.default().retain(Ee.index),Ye=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(m.default.sources.SILENT),setTimeout(function(){Ae=Ae.concat(Pe.convert()).delete(Ee.length),Pe.quill.updateContents(Ae,m.default.sources.USER),Pe.quill.setSelection(Ae.length()-Ee.length,m.default.sources.SILENT),Pe.quill.scrollingContainer.scrollTop=Ye,Pe.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var Se=this,Pe=[],Ee=[];return this.matchers.forEach(function(Ae){var Ye=s(Ae,2),rt=Ye[0],He=Ye[1];switch(rt){case Node.TEXT_NODE:Ee.push(He);break;case Node.ELEMENT_NODE:Pe.push(He);break;default:[].forEach.call(Se.container.querySelectorAll(rt),function(xt){xt[$]=xt[$]||[],xt[$].push(He)});break}}),[Pe,Ee]}}]),ue})(k.default);z.DEFAULTS={matchers:[],matchVisual:!0};function q(ae,ue,Me){return(typeof ue>"u"?"undefined":a(ue))==="object"?Object.keys(ue).reduce(function(Se,Pe){return q(Se,Pe,ue[Pe])},ae):ae.reduce(function(Se,Pe){return Pe.attributes&&Pe.attributes[ue]?Se.push(Pe):Se.insert(Pe.insert,(0,u.default)({},R({},ue,Me),Pe.attributes))},new f.default)}function G(ae){if(ae.nodeType!==Node.ELEMENT_NODE)return{};var ue="__ql-computed-style";return ae[ue]||(ae[ue]=window.getComputedStyle(ae))}function U(ae,ue){for(var Me="",Se=ae.ops.length-1;Se>=0&&Me.length<ue.length;--Se){var Pe=ae.ops[Se];if(typeof Pe.insert!="string")break;Me=Pe.insert+Me}return Me.slice(-1*ue.length)===ue}function Q(ae){if(ae.childNodes.length===0)return!1;var ue=G(ae);return["block","list-item"].indexOf(ue.display)>-1}function K(ae,ue,Me){return ae.nodeType===ae.TEXT_NODE?Me.reduce(function(Se,Pe){return Pe(ae,Se)},new f.default):ae.nodeType===ae.ELEMENT_NODE?[].reduce.call(ae.childNodes||[],function(Se,Pe){var Ee=K(Pe,ue,Me);return Pe.nodeType===ae.ELEMENT_NODE&&(Ee=ue.reduce(function(Ae,Ye){return Ye(Pe,Ae)},Ee),Ee=(Pe[$]||[]).reduce(function(Ae,Ye){return Ye(Pe,Ae)},Ee)),Se.concat(Ee)},new f.default):new f.default}function re(ae,ue,Me){return q(Me,ae,!0)}function H(ae,ue){var Me=p.default.Attributor.Attribute.keys(ae),Se=p.default.Attributor.Class.keys(ae),Pe=p.default.Attributor.Style.keys(ae),Ee={};return Me.concat(Se).concat(Pe).forEach(function(Ae){var Ye=p.default.query(Ae,p.default.Scope.ATTRIBUTE);Ye!=null&&(Ee[Ye.attrName]=Ye.value(ae),Ee[Ye.attrName])||(Ye=V[Ae],Ye!=null&&(Ye.attrName===Ae||Ye.keyName===Ae)&&(Ee[Ye.attrName]=Ye.value(ae)||void 0),Ye=D[Ae],Ye!=null&&(Ye.attrName===Ae||Ye.keyName===Ae)&&(Ye=D[Ae],Ee[Ye.attrName]=Ye.value(ae)||void 0))}),Object.keys(Ee).length>0&&(ue=q(ue,Ee)),ue}function ie(ae,ue){var Me=p.default.query(ae);if(Me==null)return ue;if(Me.prototype instanceof p.default.Embed){var Se={},Pe=Me.value(ae);Pe!=null&&(Se[Me.blotName]=Pe,ue=new f.default().insert(Se,Me.formats(ae)))}else typeof Me.formats=="function"&&(ue=q(ue,Me.blotName,Me.formats(ae)));return ue}function de(ae,ue){return U(ue,`
`)||ue.insert(`
`),ue}function le(){return new f.default}function ke(ae,ue){var Me=p.default.query(ae);if(Me==null||Me.blotName!=="list-item"||!U(ue,`
`))return ue;for(var Se=-1,Pe=ae.parentNode;!Pe.classList.contains("ql-clipboard");)(p.default.query(Pe)||{}).blotName==="list"&&(Se+=1),Pe=Pe.parentNode;return Se<=0?ue:ue.compose(new f.default().retain(ue.length()-1).retain(1,{indent:Se}))}function ve(ae,ue){return U(ue,`
`)||(Q(ae)||ue.length()>0&&ae.nextSibling&&Q(ae.nextSibling))&&ue.insert(`
`),ue}function se(ae,ue){if(Q(ae)&&ae.nextElementSibling!=null&&!U(ue,`
`)){var Me=ae.offsetHeight+parseFloat(G(ae).marginTop)+parseFloat(G(ae).marginBottom);ae.nextElementSibling.offsetTop>ae.offsetTop+Me*1.5&&ue.insert(`
`)}return ue}function be(ae,ue){var Me={},Se=ae.style||{};return Se.fontStyle&&G(ae).fontStyle==="italic"&&(Me.italic=!0),Se.fontWeight&&(G(ae).fontWeight.startsWith("bold")||parseInt(G(ae).fontWeight)>=700)&&(Me.bold=!0),Object.keys(Me).length>0&&(ue=q(ue,Me)),parseFloat(Se.textIndent||0)>0&&(ue=new f.default().insert(" ").concat(ue)),ue}function De(ae,ue){var Me=ae.data;if(ae.parentNode.tagName==="O:P")return ue.insert(Me.trim());if(Me.trim().length===0&&ae.parentNode.classList.contains("ql-clipboard"))return ue;if(!G(ae.parentNode).whiteSpace.startsWith("pre")){var Se=function(Ee,Ae){return Ae=Ae.replace(/[^\u00a0]/g,""),Ae.length<1&&Ee?" ":Ae};Me=Me.replace(/\r\n/g," ").replace(/\n/g," "),Me=Me.replace(/\s\s+/g,Se.bind(Se,!0)),(ae.previousSibling==null&&Q(ae.parentNode)||ae.previousSibling!=null&&Q(ae.previousSibling))&&(Me=Me.replace(/^\s+/,Se.bind(Se,!1))),(ae.nextSibling==null&&Q(ae.parentNode)||ae.nextSibling!=null&&Q(ae.nextSibling))&&(Me=Me.replace(/\s+$/,Se.bind(Se,!1)))}return ue.insert(Me)}n.default=z,n.matchAttributor=H,n.matchBlot=ie,n.matchNewline=ve,n.matchSpacing=se,n.matchText=De}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(m,b){for(var x=0;x<b.length;x++){var w=b[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(m,w.key,w)}}return function(m,b,x){return b&&v(m.prototype,b),x&&v(m,x),m}})(),s=function v(m,b,x){m===null&&(m=Function.prototype);var w=Object.getOwnPropertyDescriptor(m,b);if(w===void 0){var k=Object.getPrototypeOf(m);return k===null?void 0:v(k,b,x)}else{if("value"in w)return w.value;var j=w.get;return j===void 0?void 0:j.call(x)}},l=o(6),c=u(l);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function f(v,m){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:v}function h(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(v,m):v.__proto__=m)}var p=(function(v){h(m,v);function m(){return d(this,m),f(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return a(m,[{key:"optimize",value:function(x){s(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"optimize",this).call(this,x),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:"create",value:function(){return s(m.__proto__||Object.getPrototypeOf(m),"create",this).call(this)}},{key:"formats",value:function(){return!0}}]),m})(c.default);p.blotName="bold",p.tagName=["STRONG","B"],n.default=p}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.addControls=n.default=void 0;var a=(function(){function C(I,R){var F=[],M=!0,Y=!1,X=void 0;try{for(var $=I[Symbol.iterator](),ee;!(M=(ee=$.next()).done)&&(F.push(ee.value),!(R&&F.length===R));M=!0);}catch(V){Y=!0,X=V}finally{try{!M&&$.return&&$.return()}finally{if(Y)throw X}}return F}return function(I,R){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return C(I,R);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=(function(){function C(I,R){for(var F=0;F<R.length;F++){var M=R[F];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(I,M.key,M)}}return function(I,R,F){return R&&C(I.prototype,R),F&&C(I,F),I}})(),l=o(2),c=x(l),u=o(0),d=x(u),f=o(5),h=x(f),p=o(10),v=x(p),m=o(9),b=x(m);function x(C){return C&&C.__esModule?C:{default:C}}function w(C,I,R){return I in C?Object.defineProperty(C,I,{value:R,enumerable:!0,configurable:!0,writable:!0}):C[I]=R,C}function k(C,I){if(!(C instanceof I))throw new TypeError("Cannot call a class as a function")}function j(C,I){if(!C)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:C}function _(C,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);C.prototype=Object.create(I&&I.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(C,I):C.__proto__=I)}var T=(0,v.default)("quill:toolbar"),A=(function(C){_(I,C);function I(R,F){k(this,I);var M=j(this,(I.__proto__||Object.getPrototypeOf(I)).call(this,R,F));if(Array.isArray(M.options.container)){var Y=document.createElement("div");N(Y,M.options.container),R.container.parentNode.insertBefore(Y,R.container),M.container=Y}else typeof M.options.container=="string"?M.container=document.querySelector(M.options.container):M.container=M.options.container;if(!(M.container instanceof HTMLElement)){var X;return X=T.error("Container required for toolbar",M.options),j(M,X)}return M.container.classList.add("ql-toolbar"),M.controls=[],M.handlers={},Object.keys(M.options.handlers).forEach(function($){M.addHandler($,M.options.handlers[$])}),[].forEach.call(M.container.querySelectorAll("button, select"),function($){M.attach($)}),M.quill.on(h.default.events.EDITOR_CHANGE,function($,ee){$===h.default.events.SELECTION_CHANGE&&M.update(ee)}),M.quill.on(h.default.events.SCROLL_OPTIMIZE,function(){var $=M.quill.selection.getRange(),ee=a($,1),V=ee[0];M.update(V)}),M}return s(I,[{key:"addHandler",value:function(F,M){this.handlers[F]=M}},{key:"attach",value:function(F){var M=this,Y=[].find.call(F.classList,function($){return $.indexOf("ql-")===0});if(Y){if(Y=Y.slice(3),F.tagName==="BUTTON"&&F.setAttribute("type","button"),this.handlers[Y]==null){if(this.quill.scroll.whitelist!=null&&this.quill.scroll.whitelist[Y]==null){T.warn("ignoring attaching to disabled format",Y,F);return}if(d.default.query(Y)==null){T.warn("ignoring attaching to nonexistent format",Y,F);return}}var X=F.tagName==="SELECT"?"change":"click";F.addEventListener(X,function($){var ee=void 0;if(F.tagName==="SELECT"){if(F.selectedIndex<0)return;var V=F.options[F.selectedIndex];V.hasAttribute("selected")?ee=!1:ee=V.value||!1}else F.classList.contains("ql-active")?ee=!1:ee=F.value||!F.hasAttribute("value"),$.preventDefault();M.quill.focus();var D=M.quill.selection.getRange(),z=a(D,1),q=z[0];if(M.handlers[Y]!=null)M.handlers[Y].call(M,ee);else if(d.default.query(Y).prototype instanceof d.default.Embed){if(ee=prompt("Enter "+Y),!ee)return;M.quill.updateContents(new c.default().retain(q.index).delete(q.length).insert(w({},Y,ee)),h.default.sources.USER)}else M.quill.format(Y,ee,h.default.sources.USER);M.update(q)}),this.controls.push([Y,F])}}},{key:"update",value:function(F){var M=F==null?{}:this.quill.getFormat(F);this.controls.forEach(function(Y){var X=a(Y,2),$=X[0],ee=X[1];if(ee.tagName==="SELECT"){var V=void 0;if(F==null)V=null;else if(M[$]==null)V=ee.querySelector("option[selected]");else if(!Array.isArray(M[$])){var D=M[$];typeof D=="string"&&(D=D.replace(/\"/g,'\\"')),V=ee.querySelector('option[value="'+D+'"]')}V==null?(ee.value="",ee.selectedIndex=-1):V.selected=!0}else if(F==null)ee.classList.remove("ql-active");else if(ee.hasAttribute("value")){var z=M[$]===ee.getAttribute("value")||M[$]!=null&&M[$].toString()===ee.getAttribute("value")||M[$]==null&&!ee.getAttribute("value");ee.classList.toggle("ql-active",z)}else ee.classList.toggle("ql-active",M[$]!=null)})}}]),I})(b.default);A.DEFAULTS={};function P(C,I,R){var F=document.createElement("button");F.setAttribute("type","button"),F.classList.add("ql-"+I),R!=null&&(F.value=R),C.appendChild(F)}function N(C,I){Array.isArray(I[0])||(I=[I]),I.forEach(function(R){var F=document.createElement("span");F.classList.add("ql-formats"),R.forEach(function(M){if(typeof M=="string")P(F,M);else{var Y=Object.keys(M)[0],X=M[Y];Array.isArray(X)?O(F,Y,X):P(F,Y,X)}}),C.appendChild(F)})}function O(C,I,R){var F=document.createElement("select");F.classList.add("ql-"+I),R.forEach(function(M){var Y=document.createElement("option");M!==!1?Y.setAttribute("value",M):Y.setAttribute("selected","selected"),F.appendChild(Y)}),C.appendChild(F)}A.DEFAULTS={container:null,handlers:{clean:function(){var I=this,R=this.quill.getSelection();if(R!=null)if(R.length==0){var F=this.quill.getFormat();Object.keys(F).forEach(function(M){d.default.query(M,d.default.Scope.INLINE)!=null&&I.quill.format(M,!1)})}else this.quill.removeFormat(R,h.default.sources.USER)},direction:function(I){var R=this.quill.getFormat().align;I==="rtl"&&R==null?this.quill.format("align","right",h.default.sources.USER):!I&&R==="right"&&this.quill.format("align",!1,h.default.sources.USER),this.quill.format("direction",I,h.default.sources.USER)},indent:function(I){var R=this.quill.getSelection(),F=this.quill.getFormat(R),M=parseInt(F.indent||0);if(I==="+1"||I==="-1"){var Y=I==="+1"?1:-1;F.direction==="rtl"&&(Y*=-1),this.quill.format("indent",M+Y,h.default.sources.USER)}},link:function(I){I===!0&&(I=prompt("Enter link URL:")),this.quill.format("link",I,h.default.sources.USER)},list:function(I){var R=this.quill.getSelection(),F=this.quill.getFormat(R);I==="check"?F.list==="checked"||F.list==="unchecked"?this.quill.format("list",!1,h.default.sources.USER):this.quill.format("list","unchecked",h.default.sources.USER):this.quill.format("list",I,h.default.sources.USER)}}},n.default=A,n.addControls=N}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>'}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(m,b){for(var x=0;x<b.length;x++){var w=b[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(m,w.key,w)}}return function(m,b,x){return b&&v(m.prototype,b),x&&v(m,x),m}})(),s=function v(m,b,x){m===null&&(m=Function.prototype);var w=Object.getOwnPropertyDescriptor(m,b);if(w===void 0){var k=Object.getPrototypeOf(m);return k===null?void 0:v(k,b,x)}else{if("value"in w)return w.value;var j=w.get;return j===void 0?void 0:j.call(x)}},l=o(28),c=u(l);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function f(v,m){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:v}function h(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(v,m):v.__proto__=m)}var p=(function(v){h(m,v);function m(b,x){d(this,m);var w=f(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b));return w.label.innerHTML=x,w.container.classList.add("ql-color-picker"),[].slice.call(w.container.querySelectorAll(".ql-picker-item"),0,7).forEach(function(k){k.classList.add("ql-primary")}),w}return a(m,[{key:"buildItem",value:function(x){var w=s(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"buildItem",this).call(this,x);return w.style.backgroundColor=x.getAttribute("value")||"",w}},{key:"selectItem",value:function(x,w){s(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"selectItem",this).call(this,x,w);var k=this.label.querySelector(".ql-color-label"),j=x&&x.getAttribute("data-value")||"";k&&(k.tagName==="line"?k.style.stroke=j:k.style.fill=j)}}]),m})(c.default);n.default=p}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(m,b){for(var x=0;x<b.length;x++){var w=b[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(m,w.key,w)}}return function(m,b,x){return b&&v(m.prototype,b),x&&v(m,x),m}})(),s=function v(m,b,x){m===null&&(m=Function.prototype);var w=Object.getOwnPropertyDescriptor(m,b);if(w===void 0){var k=Object.getPrototypeOf(m);return k===null?void 0:v(k,b,x)}else{if("value"in w)return w.value;var j=w.get;return j===void 0?void 0:j.call(x)}},l=o(28),c=u(l);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function f(v,m){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:v}function h(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(v,m):v.__proto__=m)}var p=(function(v){h(m,v);function m(b,x){d(this,m);var w=f(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,b));return w.container.classList.add("ql-icon-picker"),[].forEach.call(w.container.querySelectorAll(".ql-picker-item"),function(k){k.innerHTML=x[k.getAttribute("data-value")||""]}),w.defaultItem=w.container.querySelector(".ql-selected"),w.selectItem(w.defaultItem),w}return a(m,[{key:"selectItem",value:function(x,w){s(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"selectItem",this).call(this,x,w),x=x||this.defaultItem,this.label.innerHTML=x.innerHTML}}]),m})(c.default);n.default=p}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function c(u,d){for(var f=0;f<d.length;f++){var h=d[f];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(u,h.key,h)}}return function(u,d,f){return d&&c(u.prototype,d),f&&c(u,f),u}})();function s(c,u){if(!(c instanceof u))throw new TypeError("Cannot call a class as a function")}var l=(function(){function c(u,d){var f=this;s(this,c),this.quill=u,this.boundsContainer=d||document.body,this.root=u.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){f.root.style.marginTop=-1*f.quill.root.scrollTop+"px"}),this.hide()}return a(c,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(d){var f=d.left+d.width/2-this.root.offsetWidth/2,h=d.bottom+this.quill.root.scrollTop;this.root.style.left=f+"px",this.root.style.top=h+"px",this.root.classList.remove("ql-flip");var p=this.boundsContainer.getBoundingClientRect(),v=this.root.getBoundingClientRect(),m=0;if(v.right>p.right&&(m=p.right-v.right,this.root.style.left=f+m+"px"),v.left<p.left&&(m=p.left-v.left,this.root.style.left=f+m+"px"),v.bottom>p.bottom){var b=v.bottom-v.top,x=d.bottom-d.top+b;this.root.style.top=h-x+"px",this.root.classList.add("ql-flip")}return m}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),c})();n.default=l}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function O(C,I){var R=[],F=!0,M=!1,Y=void 0;try{for(var X=C[Symbol.iterator](),$;!(F=($=X.next()).done)&&(R.push($.value),!(I&&R.length===I));F=!0);}catch(ee){M=!0,Y=ee}finally{try{!F&&X.return&&X.return()}finally{if(M)throw Y}}return R}return function(C,I){if(Array.isArray(C))return C;if(Symbol.iterator in Object(C))return O(C,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),s=function O(C,I,R){C===null&&(C=Function.prototype);var F=Object.getOwnPropertyDescriptor(C,I);if(F===void 0){var M=Object.getPrototypeOf(C);return M===null?void 0:O(M,I,R)}else{if("value"in F)return F.value;var Y=F.get;return Y===void 0?void 0:Y.call(R)}},l=(function(){function O(C,I){for(var R=0;R<I.length;R++){var F=I[R];F.enumerable=F.enumerable||!1,F.configurable=!0,"value"in F&&(F.writable=!0),Object.defineProperty(C,F.key,F)}}return function(C,I,R){return I&&O(C.prototype,I),R&&O(C,R),C}})(),c=o(3),u=k(c),d=o(8),f=k(d),h=o(43),p=k(h),v=o(27),m=k(v),b=o(15),x=o(41),w=k(x);function k(O){return O&&O.__esModule?O:{default:O}}function j(O,C){if(!(O instanceof C))throw new TypeError("Cannot call a class as a function")}function _(O,C){if(!O)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return C&&(typeof C=="object"||typeof C=="function")?C:O}function T(O,C){if(typeof C!="function"&&C!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof C);O.prototype=Object.create(C&&C.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),C&&(Object.setPrototypeOf?Object.setPrototypeOf(O,C):O.__proto__=C)}var A=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],P=(function(O){T(C,O);function C(I,R){j(this,C),R.modules.toolbar!=null&&R.modules.toolbar.container==null&&(R.modules.toolbar.container=A);var F=_(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,I,R));return F.quill.container.classList.add("ql-snow"),F}return l(C,[{key:"extendToolbar",value:function(R){R.container.classList.add("ql-snow"),this.buildButtons([].slice.call(R.container.querySelectorAll("button")),w.default),this.buildPickers([].slice.call(R.container.querySelectorAll("select")),w.default),this.tooltip=new N(this.quill,this.options.bounds),R.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function(F,M){R.handlers.link.call(R,!M.format.link)})}}]),C})(p.default);P.DEFAULTS=(0,u.default)(!0,{},p.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(C){if(C){var I=this.quill.getSelection();if(I==null||I.length==0)return;var R=this.quill.getText(I);/^\S+@\S+\.\S+$/.test(R)&&R.indexOf("mailto:")!==0&&(R="mailto:"+R);var F=this.quill.theme.tooltip;F.edit("link",R)}else this.quill.format("link",!1)}}}}});var N=(function(O){T(C,O);function C(I,R){j(this,C);var F=_(this,(C.__proto__||Object.getPrototypeOf(C)).call(this,I,R));return F.preview=F.root.querySelector("a.ql-preview"),F}return l(C,[{key:"listen",value:function(){var R=this;s(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function(F){R.root.classList.contains("ql-editing")?R.save():R.edit("link",R.preview.textContent),F.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function(F){if(R.linkRange!=null){var M=R.linkRange;R.restoreFocus(),R.quill.formatText(M,"link",!1,f.default.sources.USER),delete R.linkRange}F.preventDefault(),R.hide()}),this.quill.on(f.default.events.SELECTION_CHANGE,function(F,M,Y){if(F!=null){if(F.length===0&&Y===f.default.sources.USER){var X=R.quill.scroll.descendant(m.default,F.index),$=a(X,2),ee=$[0],V=$[1];if(ee!=null){R.linkRange=new b.Range(F.index-V,ee.length());var D=m.default.formats(ee.domNode);R.preview.textContent=D,R.preview.setAttribute("href",D),R.show(),R.position(R.quill.getBounds(R.linkRange));return}}else delete R.linkRange;R.hide()}})}},{key:"show",value:function(){s(C.prototype.__proto__||Object.getPrototypeOf(C.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),C})(h.BaseTooltip);N.TEMPLATE=['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""),n.default=P}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(29),s=Pe(a),l=o(36),c=o(38),u=o(64),d=o(65),f=Pe(d),h=o(66),p=Pe(h),v=o(67),m=Pe(v),b=o(37),x=o(26),w=o(39),k=o(40),j=o(56),_=Pe(j),T=o(68),A=Pe(T),P=o(27),N=Pe(P),O=o(69),C=Pe(O),I=o(70),R=Pe(I),F=o(71),M=Pe(F),Y=o(72),X=Pe(Y),$=o(73),ee=Pe($),V=o(13),D=Pe(V),z=o(74),q=Pe(z),G=o(75),U=Pe(G),Q=o(57),K=Pe(Q),re=o(41),H=Pe(re),ie=o(28),de=Pe(ie),le=o(59),ke=Pe(le),ve=o(60),se=Pe(ve),be=o(61),De=Pe(be),ae=o(108),ue=Pe(ae),Me=o(62),Se=Pe(Me);function Pe(Ee){return Ee&&Ee.__esModule?Ee:{default:Ee}}s.default.register({"attributors/attribute/direction":c.DirectionAttribute,"attributors/class/align":l.AlignClass,"attributors/class/background":b.BackgroundClass,"attributors/class/color":x.ColorClass,"attributors/class/direction":c.DirectionClass,"attributors/class/font":w.FontClass,"attributors/class/size":k.SizeClass,"attributors/style/align":l.AlignStyle,"attributors/style/background":b.BackgroundStyle,"attributors/style/color":x.ColorStyle,"attributors/style/direction":c.DirectionStyle,"attributors/style/font":w.FontStyle,"attributors/style/size":k.SizeStyle},!0),s.default.register({"formats/align":l.AlignClass,"formats/direction":c.DirectionClass,"formats/indent":u.IndentClass,"formats/background":b.BackgroundStyle,"formats/color":x.ColorStyle,"formats/font":w.FontClass,"formats/size":k.SizeClass,"formats/blockquote":f.default,"formats/code-block":D.default,"formats/header":p.default,"formats/list":m.default,"formats/bold":_.default,"formats/code":V.Code,"formats/italic":A.default,"formats/link":N.default,"formats/script":C.default,"formats/strike":R.default,"formats/underline":M.default,"formats/image":X.default,"formats/video":ee.default,"formats/list/item":v.ListItem,"modules/formula":q.default,"modules/syntax":U.default,"modules/toolbar":K.default,"themes/bubble":ue.default,"themes/snow":Se.default,"ui/icons":H.default,"ui/picker":de.default,"ui/icon-picker":se.default,"ui/color-picker":ke.default,"ui/tooltip":De.default},!0),n.default=s.default}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.IndentClass=void 0;var a=(function(){function m(b,x){for(var w=0;w<x.length;w++){var k=x[w];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(b,k.key,k)}}return function(b,x,w){return x&&m(b.prototype,x),w&&m(b,w),b}})(),s=function m(b,x,w){b===null&&(b=Function.prototype);var k=Object.getOwnPropertyDescriptor(b,x);if(k===void 0){var j=Object.getPrototypeOf(b);return j===null?void 0:m(j,x,w)}else{if("value"in k)return k.value;var _=k.get;return _===void 0?void 0:_.call(w)}},l=o(0),c=u(l);function u(m){return m&&m.__esModule?m:{default:m}}function d(m,b){if(!(m instanceof b))throw new TypeError("Cannot call a class as a function")}function f(m,b){if(!m)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return b&&(typeof b=="object"||typeof b=="function")?b:m}function h(m,b){if(typeof b!="function"&&b!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof b);m.prototype=Object.create(b&&b.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(m,b):m.__proto__=b)}var p=(function(m){h(b,m);function b(){return d(this,b),f(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return a(b,[{key:"add",value:function(w,k){if(k==="+1"||k==="-1"){var j=this.value(w)||0;k=k==="+1"?j+1:j-1}return k===0?(this.remove(w),!0):s(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"add",this).call(this,w,k)}},{key:"canAdd",value:function(w,k){return s(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"canAdd",this).call(this,w,k)||s(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"canAdd",this).call(this,w,parseInt(k))}},{key:"value",value:function(w){return parseInt(s(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"value",this).call(this,w))||void 0}}]),b})(c.default.Attributor.Class),v=new p("indent","ql-indent",{scope:c.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});n.IndentClass=v}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(4),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}function c(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function u(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function d(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var f=(function(h){d(p,h);function p(){return c(this,p),u(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return p})(s.default);f.blotName="blockquote",f.tagName="blockquote",n.default=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function p(v,m){for(var b=0;b<m.length;b++){var x=m[b];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,x.key,x)}}return function(v,m,b){return m&&p(v.prototype,m),b&&p(v,b),v}})(),s=o(4),l=c(s);function c(p){return p&&p.__esModule?p:{default:p}}function u(p,v){if(!(p instanceof v))throw new TypeError("Cannot call a class as a function")}function d(p,v){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v&&(typeof v=="object"||typeof v=="function")?v:p}function f(p,v){if(typeof v!="function"&&v!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof v);p.prototype=Object.create(v&&v.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),v&&(Object.setPrototypeOf?Object.setPrototypeOf(p,v):p.__proto__=v)}var h=(function(p){f(v,p);function v(){return u(this,v),d(this,(v.__proto__||Object.getPrototypeOf(v)).apply(this,arguments))}return a(v,null,[{key:"formats",value:function(b){return this.tagName.indexOf(b.tagName)+1}}]),v})(l.default);h.blotName="header",h.tagName=["H1","H2","H3","H4","H5","H6"],n.default=h}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.ListItem=void 0;var a=(function(){function j(_,T){for(var A=0;A<T.length;A++){var P=T[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(_,P.key,P)}}return function(_,T,A){return T&&j(_.prototype,T),A&&j(_,A),_}})(),s=function j(_,T,A){_===null&&(_=Function.prototype);var P=Object.getOwnPropertyDescriptor(_,T);if(P===void 0){var N=Object.getPrototypeOf(_);return N===null?void 0:j(N,T,A)}else{if("value"in P)return P.value;var O=P.get;return O===void 0?void 0:O.call(A)}},l=o(0),c=p(l),u=o(4),d=p(u),f=o(25),h=p(f);function p(j){return j&&j.__esModule?j:{default:j}}function v(j,_,T){return _ in j?Object.defineProperty(j,_,{value:T,enumerable:!0,configurable:!0,writable:!0}):j[_]=T,j}function m(j,_){if(!(j instanceof _))throw new TypeError("Cannot call a class as a function")}function b(j,_){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:j}function x(j,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);j.prototype=Object.create(_&&_.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(j,_):j.__proto__=_)}var w=(function(j){x(_,j);function _(){return m(this,_),b(this,(_.__proto__||Object.getPrototypeOf(_)).apply(this,arguments))}return a(_,[{key:"format",value:function(A,P){A===k.blotName&&!P?this.replaceWith(c.default.create(this.statics.scope)):s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"format",this).call(this,A,P)}},{key:"remove",value:function(){this.prev==null&&this.next==null?this.parent.remove():s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"remove",this).call(this)}},{key:"replaceWith",value:function(A,P){return this.parent.isolate(this.offset(this.parent),this.length()),A===this.parent.statics.blotName?(this.parent.replaceWith(A,P),this):(this.parent.unwrap(),s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"replaceWith",this).call(this,A,P))}}],[{key:"formats",value:function(A){return A.tagName===this.tagName?void 0:s(_.__proto__||Object.getPrototypeOf(_),"formats",this).call(this,A)}}]),_})(d.default);w.blotName="list-item",w.tagName="LI";var k=(function(j){x(_,j),a(_,null,[{key:"create",value:function(A){var P=A==="ordered"?"OL":"UL",N=s(_.__proto__||Object.getPrototypeOf(_),"create",this).call(this,P);return(A==="checked"||A==="unchecked")&&N.setAttribute("data-checked",A==="checked"),N}},{key:"formats",value:function(A){if(A.tagName==="OL")return"ordered";if(A.tagName==="UL")return A.hasAttribute("data-checked")?A.getAttribute("data-checked")==="true"?"checked":"unchecked":"bullet"}}]);function _(T){m(this,_);var A=b(this,(_.__proto__||Object.getPrototypeOf(_)).call(this,T)),P=function(O){if(O.target.parentNode===T){var C=A.statics.formats(T),I=c.default.find(O.target);C==="checked"?I.format("list","unchecked"):C==="unchecked"&&I.format("list","checked")}};return T.addEventListener("touchstart",P),T.addEventListener("mousedown",P),A}return a(_,[{key:"format",value:function(A,P){this.children.length>0&&this.children.tail.format(A,P)}},{key:"formats",value:function(){return v({},this.statics.blotName,this.statics.formats(this.domNode))}},{key:"insertBefore",value:function(A,P){if(A instanceof w)s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"insertBefore",this).call(this,A,P);else{var N=P==null?this.length():P.offset(this),O=this.split(N);O.parent.insertBefore(A,O)}}},{key:"optimize",value:function(A){s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"optimize",this).call(this,A);var P=this.next;P!=null&&P.prev===this&&P.statics.blotName===this.statics.blotName&&P.domNode.tagName===this.domNode.tagName&&P.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(P.moveChildren(this),P.remove())}},{key:"replace",value:function(A){if(A.statics.blotName!==this.statics.blotName){var P=c.default.create(this.statics.defaultChild);A.moveChildren(P),this.appendChild(P)}s(_.prototype.__proto__||Object.getPrototypeOf(_.prototype),"replace",this).call(this,A)}}]),_})(h.default);k.blotName="list",k.scope=c.default.Scope.BLOCK_BLOT,k.tagName=["OL","UL"],k.defaultChild="list-item",k.allowedChildren=[w],n.ListItem=w,n.default=k}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(56),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}function c(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function u(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function d(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var f=(function(h){d(p,h);function p(){return c(this,p),u(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return p})(s.default);f.blotName="italic",f.tagName=["EM","I"],n.default=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function v(m,b){for(var x=0;x<b.length;x++){var w=b[x];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(m,w.key,w)}}return function(m,b,x){return b&&v(m.prototype,b),x&&v(m,x),m}})(),s=function v(m,b,x){m===null&&(m=Function.prototype);var w=Object.getOwnPropertyDescriptor(m,b);if(w===void 0){var k=Object.getPrototypeOf(m);return k===null?void 0:v(k,b,x)}else{if("value"in w)return w.value;var j=w.get;return j===void 0?void 0:j.call(x)}},l=o(6),c=u(l);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function f(v,m){if(!v)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m&&(typeof m=="object"||typeof m=="function")?m:v}function h(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(v,m):v.__proto__=m)}var p=(function(v){h(m,v);function m(){return d(this,m),f(this,(m.__proto__||Object.getPrototypeOf(m)).apply(this,arguments))}return a(m,null,[{key:"create",value:function(x){return x==="super"?document.createElement("sup"):x==="sub"?document.createElement("sub"):s(m.__proto__||Object.getPrototypeOf(m),"create",this).call(this,x)}},{key:"formats",value:function(x){if(x.tagName==="SUB")return"sub";if(x.tagName==="SUP")return"super"}}]),m})(c.default);p.blotName="script",p.tagName=["SUB","SUP"],n.default=p}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(6),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}function c(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function u(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function d(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var f=(function(h){d(p,h);function p(){return c(this,p),u(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return p})(s.default);f.blotName="strike",f.tagName="S",n.default=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=o(6),s=l(a);function l(h){return h&&h.__esModule?h:{default:h}}function c(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function u(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function d(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var f=(function(h){d(p,h);function p(){return c(this,p),u(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments))}return p})(s.default);f.blotName="underline",f.tagName="U",n.default=f}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function b(x,w){for(var k=0;k<w.length;k++){var j=w[k];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(x,j.key,j)}}return function(x,w,k){return w&&b(x.prototype,w),k&&b(x,k),x}})(),s=function b(x,w,k){x===null&&(x=Function.prototype);var j=Object.getOwnPropertyDescriptor(x,w);if(j===void 0){var _=Object.getPrototypeOf(x);return _===null?void 0:b(_,w,k)}else{if("value"in j)return j.value;var T=j.get;return T===void 0?void 0:T.call(k)}},l=o(0),c=d(l),u=o(27);function d(b){return b&&b.__esModule?b:{default:b}}function f(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function h(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function p(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var v=["alt","height","width"],m=(function(b){p(x,b);function x(){return f(this,x),h(this,(x.__proto__||Object.getPrototypeOf(x)).apply(this,arguments))}return a(x,[{key:"format",value:function(k,j){v.indexOf(k)>-1?j?this.domNode.setAttribute(k,j):this.domNode.removeAttribute(k):s(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"format",this).call(this,k,j)}}],[{key:"create",value:function(k){var j=s(x.__proto__||Object.getPrototypeOf(x),"create",this).call(this,k);return typeof k=="string"&&j.setAttribute("src",this.sanitize(k)),j}},{key:"formats",value:function(k){return v.reduce(function(j,_){return k.hasAttribute(_)&&(j[_]=k.getAttribute(_)),j},{})}},{key:"match",value:function(k){return/\.(jpe?g|gif|png)$/.test(k)||/^data:image\/.+;base64/.test(k)}},{key:"sanitize",value:function(k){return(0,u.sanitize)(k,["http","https","data"])?k:"//:0"}},{key:"value",value:function(k){return k.getAttribute("src")}}]),x})(c.default.Embed);m.blotName="image",m.tagName="IMG",n.default=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0});var a=(function(){function b(x,w){for(var k=0;k<w.length;k++){var j=w[k];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(x,j.key,j)}}return function(x,w,k){return w&&b(x.prototype,w),k&&b(x,k),x}})(),s=function b(x,w,k){x===null&&(x=Function.prototype);var j=Object.getOwnPropertyDescriptor(x,w);if(j===void 0){var _=Object.getPrototypeOf(x);return _===null?void 0:b(_,w,k)}else{if("value"in j)return j.value;var T=j.get;return T===void 0?void 0:T.call(k)}},l=o(4),c=o(27),u=d(c);function d(b){return b&&b.__esModule?b:{default:b}}function f(b,x){if(!(b instanceof x))throw new TypeError("Cannot call a class as a function")}function h(b,x){if(!b)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x&&(typeof x=="object"||typeof x=="function")?x:b}function p(b,x){if(typeof x!="function"&&x!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof x);b.prototype=Object.create(x&&x.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}}),x&&(Object.setPrototypeOf?Object.setPrototypeOf(b,x):b.__proto__=x)}var v=["height","width"],m=(function(b){p(x,b);function x(){return f(this,x),h(this,(x.__proto__||Object.getPrototypeOf(x)).apply(this,arguments))}return a(x,[{key:"format",value:function(k,j){v.indexOf(k)>-1?j?this.domNode.setAttribute(k,j):this.domNode.removeAttribute(k):s(x.prototype.__proto__||Object.getPrototypeOf(x.prototype),"format",this).call(this,k,j)}}],[{key:"create",value:function(k){var j=s(x.__proto__||Object.getPrototypeOf(x),"create",this).call(this,k);return j.setAttribute("frameborder","0"),j.setAttribute("allowfullscreen",!0),j.setAttribute("src",this.sanitize(k)),j}},{key:"formats",value:function(k){return v.reduce(function(j,_){return k.hasAttribute(_)&&(j[_]=k.getAttribute(_)),j},{})}},{key:"sanitize",value:function(k){return u.default.sanitize(k)}},{key:"value",value:function(k){return k.getAttribute("src")}}]),x})(l.BlockEmbed);m.blotName="video",m.className="ql-video",m.tagName="IFRAME",n.default=m}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.FormulaBlot=void 0;var a=(function(){function k(j,_){for(var T=0;T<_.length;T++){var A=_[T];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(j,A.key,A)}}return function(j,_,T){return _&&k(j.prototype,_),T&&k(j,T),j}})(),s=function k(j,_,T){j===null&&(j=Function.prototype);var A=Object.getOwnPropertyDescriptor(j,_);if(A===void 0){var P=Object.getPrototypeOf(j);return P===null?void 0:k(P,_,T)}else{if("value"in A)return A.value;var N=A.get;return N===void 0?void 0:N.call(T)}},l=o(35),c=p(l),u=o(5),d=p(u),f=o(9),h=p(f);function p(k){return k&&k.__esModule?k:{default:k}}function v(k,j){if(!(k instanceof j))throw new TypeError("Cannot call a class as a function")}function m(k,j){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j&&(typeof j=="object"||typeof j=="function")?j:k}function b(k,j){if(typeof j!="function"&&j!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof j);k.prototype=Object.create(j&&j.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),j&&(Object.setPrototypeOf?Object.setPrototypeOf(k,j):k.__proto__=j)}var x=(function(k){b(j,k);function j(){return v(this,j),m(this,(j.__proto__||Object.getPrototypeOf(j)).apply(this,arguments))}return a(j,null,[{key:"create",value:function(T){var A=s(j.__proto__||Object.getPrototypeOf(j),"create",this).call(this,T);return typeof T=="string"&&(window.katex.render(T,A,{throwOnError:!1,errorColor:"#f00"}),A.setAttribute("data-value",T)),A}},{key:"value",value:function(T){return T.getAttribute("data-value")}}]),j})(c.default);x.blotName="formula",x.className="ql-formula",x.tagName="SPAN";var w=(function(k){b(j,k),a(j,null,[{key:"register",value:function(){d.default.register(x,!0)}}]);function j(){v(this,j);var _=m(this,(j.__proto__||Object.getPrototypeOf(j)).call(this));if(window.katex==null)throw new Error("Formula module requires KaTeX.");return _}return j})(h.default);n.FormulaBlot=x,n.default=w}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.CodeToken=n.CodeBlock=void 0;var a=(function(){function T(A,P){for(var N=0;N<P.length;N++){var O=P[N];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(A,O.key,O)}}return function(A,P,N){return P&&T(A.prototype,P),N&&T(A,N),A}})(),s=function T(A,P,N){A===null&&(A=Function.prototype);var O=Object.getOwnPropertyDescriptor(A,P);if(O===void 0){var C=Object.getPrototypeOf(A);return C===null?void 0:T(C,P,N)}else{if("value"in O)return O.value;var I=O.get;return I===void 0?void 0:I.call(N)}},l=o(0),c=m(l),u=o(5),d=m(u),f=o(9),h=m(f),p=o(13),v=m(p);function m(T){return T&&T.__esModule?T:{default:T}}function b(T,A){if(!(T instanceof A))throw new TypeError("Cannot call a class as a function")}function x(T,A){if(!T)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return A&&(typeof A=="object"||typeof A=="function")?A:T}function w(T,A){if(typeof A!="function"&&A!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof A);T.prototype=Object.create(A&&A.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),A&&(Object.setPrototypeOf?Object.setPrototypeOf(T,A):T.__proto__=A)}var k=(function(T){w(A,T);function A(){return b(this,A),x(this,(A.__proto__||Object.getPrototypeOf(A)).apply(this,arguments))}return a(A,[{key:"replaceWith",value:function(N){this.domNode.textContent=this.domNode.textContent,this.attach(),s(A.prototype.__proto__||Object.getPrototypeOf(A.prototype),"replaceWith",this).call(this,N)}},{key:"highlight",value:function(N){var O=this.domNode.textContent;this.cachedText!==O&&((O.trim().length>0||this.cachedText==null)&&(this.domNode.innerHTML=N(O),this.domNode.normalize(),this.attach()),this.cachedText=O)}}]),A})(v.default);k.className="ql-syntax";var j=new c.default.Attributor.Class("token","hljs",{scope:c.default.Scope.INLINE}),_=(function(T){w(A,T),a(A,null,[{key:"register",value:function(){d.default.register(j,!0),d.default.register(k,!0)}}]);function A(P,N){b(this,A);var O=x(this,(A.__proto__||Object.getPrototypeOf(A)).call(this,P,N));if(typeof O.options.highlight!="function")throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var C=null;return O.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(C),C=setTimeout(function(){O.highlight(),C=null},O.options.interval)}),O.highlight(),O}return a(A,[{key:"highlight",value:function(){var N=this;if(!this.quill.selection.composing){this.quill.update(d.default.sources.USER);var O=this.quill.getSelection();this.quill.scroll.descendants(k).forEach(function(C){C.highlight(N.options.highlight)}),this.quill.update(d.default.sources.SILENT),O!=null&&this.quill.setSelection(O,d.default.sources.SILENT)}}}]),A})(h.default);_.DEFAULTS={highlight:(function(){return window.hljs==null?null:function(T){var A=window.hljs.highlightAuto(T);return A.value}})(),interval:1e3},n.CodeBlock=k,n.CodeToken=j,n.default=_}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <g class="ql-fill ql-color-label"> <polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>'}),(function(r,n){r.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>'}),(function(r,n){r.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>'}),(function(r,n){r.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class="ql-even ql-stroke" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class="ql-even ql-stroke" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class="ql-stroke ql-thin" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class="ql-stroke ql-thin" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>'}),(function(r,n){r.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>'}),(function(r,n){r.exports='<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>'}),(function(r,n,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.BubbleTooltip=void 0;var a=function A(P,N,O){P===null&&(P=Function.prototype);var C=Object.getOwnPropertyDescriptor(P,N);if(C===void 0){var I=Object.getPrototypeOf(P);return I===null?void 0:A(I,N,O)}else{if("value"in C)return C.value;var R=C.get;return R===void 0?void 0:R.call(O)}},s=(function(){function A(P,N){for(var O=0;O<N.length;O++){var C=N[O];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(P,C.key,C)}}return function(P,N,O){return N&&A(P.prototype,N),O&&A(P,O),P}})(),l=o(3),c=b(l),u=o(8),d=b(u),f=o(43),h=b(f),p=o(15),v=o(41),m=b(v);function b(A){return A&&A.__esModule?A:{default:A}}function x(A,P){if(!(A instanceof P))throw new TypeError("Cannot call a class as a function")}function w(A,P){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:A}function k(A,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);A.prototype=Object.create(P&&P.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(A,P):A.__proto__=P)}var j=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],_=(function(A){k(P,A);function P(N,O){x(this,P),O.modules.toolbar!=null&&O.modules.toolbar.container==null&&(O.modules.toolbar.container=j);var C=w(this,(P.__proto__||Object.getPrototypeOf(P)).call(this,N,O));return C.quill.container.classList.add("ql-bubble"),C}return s(P,[{key:"extendToolbar",value:function(O){this.tooltip=new T(this.quill,this.options.bounds),this.tooltip.root.appendChild(O.container),this.buildButtons([].slice.call(O.container.querySelectorAll("button")),m.default),this.buildPickers([].slice.call(O.container.querySelectorAll("select")),m.default)}}]),P})(h.default);_.DEFAULTS=(0,c.default)(!0,{},h.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(P){P?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var T=(function(A){k(P,A);function P(N,O){x(this,P);var C=w(this,(P.__proto__||Object.getPrototypeOf(P)).call(this,N,O));return C.quill.on(d.default.events.EDITOR_CHANGE,function(I,R,F,M){if(I===d.default.events.SELECTION_CHANGE)if(R!=null&&R.length>0&&M===d.default.sources.USER){C.show(),C.root.style.left="0px",C.root.style.width="",C.root.style.width=C.root.offsetWidth+"px";var Y=C.quill.getLines(R.index,R.length);if(Y.length===1)C.position(C.quill.getBounds(R));else{var X=Y[Y.length-1],$=C.quill.getIndex(X),ee=Math.min(X.length()-1,R.index+R.length-$),V=C.quill.getBounds(new p.Range($,ee));C.position(V)}}else document.activeElement!==C.textbox&&C.quill.hasFocus()&&C.hide()}),C}return s(P,[{key:"listen",value:function(){var O=this;a(P.prototype.__proto__||Object.getPrototypeOf(P.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){O.root.classList.remove("ql-editing")}),this.quill.on(d.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!O.root.classList.contains("ql-hidden")){var C=O.quill.getSelection();C!=null&&O.position(O.quill.getBounds(C))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(O){var C=a(P.prototype.__proto__||Object.getPrototypeOf(P.prototype),"position",this).call(this,O),I=this.root.querySelector(".ql-tooltip-arrow");if(I.style.marginLeft="",C===0)return C;I.style.marginLeft=-1*C-I.offsetWidth/2+"px"}}]),P})(f.BaseTooltip);T.TEMPLATE=['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""),n.BubbleTooltip=T,n.default=_}),(function(r,n,o){r.exports=o(63)})]).default})})(H1)),H1.exports}var ec,aW;function K8e(){if(aW)return ec;aW=1;var e=ec&&ec.__extends||(function(){var d=function(f,h){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,v){p.__proto__=v}||function(p,v){for(var m in v)v.hasOwnProperty(m)&&(p[m]=v[m])},d(f,h)};return function(f,h){d(f,h);function p(){this.constructor=f}f.prototype=h===null?Object.create(h):(p.prototype=h.prototype,new p)}})(),t=ec&&ec.__assign||function(){return t=Object.assign||function(d){for(var f,h=1,p=arguments.length;h<p;h++){f=arguments[h];for(var v in f)Object.prototype.hasOwnProperty.call(f,v)&&(d[v]=f[v])}return d},t.apply(this,arguments)},r=ec&&ec.__spreadArrays||function(){for(var d=0,f=0,h=arguments.length;f<h;f++)d+=arguments[f].length;for(var p=Array(d),v=0,f=0;f<h;f++)for(var m=arguments[f],b=0,x=m.length;b<x;b++,v++)p[v]=m[b];return p},n=ec&&ec.__importDefault||function(d){return d&&d.__esModule?d:{default:d}},o=n(Qw()),a=n(nT()),s=n(KV()),l=n(G8e()),c=(function(d){e(f,d);function f(h){var p=d.call(this,h)||this;p.dirtyProps=["modules","formats","bounds","theme","children"],p.cleanProps=["id","className","style","placeholder","tabIndex","onChange","onChangeSelection","onFocus","onBlur","onKeyPress","onKeyDown","onKeyUp"],p.state={generation:0},p.selection=null,p.onEditorChange=function(m,b,x,w){var k,j,_,T;m==="text-change"?(j=(k=p).onEditorChangeText)===null||j===void 0||j.call(k,p.editor.root.innerHTML,b,w,p.unprivilegedEditor):m==="selection-change"&&((T=(_=p).onEditorChangeSelection)===null||T===void 0||T.call(_,b,w,p.unprivilegedEditor))};var v=p.isControlled()?h.value:h.defaultValue;return p.value=v??"",p}return f.prototype.validateProps=function(h){var p;if(o.default.Children.count(h.children)>1)throw new Error("The Quill editing area can only be composed of a single React element.");if(o.default.Children.count(h.children)){var v=o.default.Children.only(h.children);if(((p=v)===null||p===void 0?void 0:p.type)==="textarea")throw new Error("Quill does not support editing on a <textarea>. Use a <div> instead.")}if(this.lastDeltaChangeSet&&h.value===this.lastDeltaChangeSet)throw new Error("You are passing the `delta` object from the `onChange` event back as `value`. You most probably want `editor.getContents()` instead. See: https://github.com/zenoamaro/react-quill#using-deltas")},f.prototype.shouldComponentUpdate=function(h,p){var v=this,m;if(this.validateProps(h),!this.editor||this.state.generation!==p.generation)return!0;if("value"in h){var b=this.getEditorContents(),x=(m=h.value,m??"");this.isEqualValue(x,b)||this.setEditorContents(this.editor,x)}return h.readOnly!==this.props.readOnly&&this.setEditorReadOnly(this.editor,h.readOnly),r(this.cleanProps,this.dirtyProps).some(function(w){return!s.default(h[w],v.props[w])})},f.prototype.shouldComponentRegenerate=function(h){var p=this;return this.dirtyProps.some(function(v){return!s.default(h[v],p.props[v])})},f.prototype.componentDidMount=function(){this.instantiateEditor(),this.setEditorContents(this.editor,this.getEditorContents())},f.prototype.componentWillUnmount=function(){this.destroyEditor()},f.prototype.componentDidUpdate=function(h,p){var v=this;if(this.editor&&this.shouldComponentRegenerate(h)){var m=this.editor.getContents(),b=this.editor.getSelection();this.regenerationSnapshot={delta:m,selection:b},this.setState({generation:this.state.generation+1}),this.destroyEditor()}if(this.state.generation!==p.generation){var x=this.regenerationSnapshot,m=x.delta,w=x.selection;delete this.regenerationSnapshot,this.instantiateEditor();var k=this.editor;k.setContents(m),u(function(){return v.setEditorSelection(k,w)})}},f.prototype.instantiateEditor=function(){this.editor?this.hookEditor(this.editor):this.editor=this.createEditor(this.getEditingArea(),this.getEditorConfig())},f.prototype.destroyEditor=function(){this.editor&&this.unhookEditor(this.editor)},f.prototype.isControlled=function(){return"value"in this.props},f.prototype.getEditorConfig=function(){return{bounds:this.props.bounds,formats:this.props.formats,modules:this.props.modules,placeholder:this.props.placeholder,readOnly:this.props.readOnly,scrollingContainer:this.props.scrollingContainer,tabIndex:this.props.tabIndex,theme:this.props.theme}},f.prototype.getEditor=function(){if(!this.editor)throw new Error("Accessing non-instantiated editor");return this.editor},f.prototype.createEditor=function(h,p){var v=new l.default(h,p);return p.tabIndex!=null&&this.setEditorTabIndex(v,p.tabIndex),this.hookEditor(v),v},f.prototype.hookEditor=function(h){this.unprivilegedEditor=this.makeUnprivilegedEditor(h),h.on("editor-change",this.onEditorChange)},f.prototype.unhookEditor=function(h){h.off("editor-change",this.onEditorChange)},f.prototype.getEditorContents=function(){return this.value},f.prototype.getEditorSelection=function(){return this.selection},f.prototype.isDelta=function(h){return h&&h.ops},f.prototype.isEqualValue=function(h,p){return this.isDelta(h)&&this.isDelta(p)?s.default(h.ops,p.ops):s.default(h,p)},f.prototype.setEditorContents=function(h,p){var v=this;this.value=p;var m=this.getEditorSelection();typeof p=="string"?h.setContents(h.clipboard.convert(p)):h.setContents(p),u(function(){return v.setEditorSelection(h,m)})},f.prototype.setEditorSelection=function(h,p){if(this.selection=p,p){var v=h.getLength();p.index=Math.max(0,Math.min(p.index,v-1)),p.length=Math.max(0,Math.min(p.length,v-1-p.index)),h.setSelection(p)}},f.prototype.setEditorTabIndex=function(h,p){var v,m;!((m=(v=h)===null||v===void 0?void 0:v.scroll)===null||m===void 0)&&m.domNode&&(h.scroll.domNode.tabIndex=p)},f.prototype.setEditorReadOnly=function(h,p){p?h.disable():h.enable()},f.prototype.makeUnprivilegedEditor=function(h){var p=h;return{getHTML:function(){return p.root.innerHTML},getLength:p.getLength.bind(p),getText:p.getText.bind(p),getContents:p.getContents.bind(p),getSelection:p.getSelection.bind(p),getBounds:p.getBounds.bind(p)}},f.prototype.getEditingArea=function(){if(!this.editingArea)throw new Error("Instantiating on missing editing area");var h=a.default.findDOMNode(this.editingArea);if(!h)throw new Error("Cannot find element for editing area");if(h.nodeType===3)throw new Error("Editing area cannot be a text node");return h},f.prototype.renderEditingArea=function(){var h=this,p=this.props,v=p.children,m=p.preserveWhitespace,b=this.state.generation,x={key:b,ref:function(w){h.editingArea=w}};return o.default.Children.count(v)?o.default.cloneElement(o.default.Children.only(v),x):m?o.default.createElement("pre",t({},x)):o.default.createElement("div",t({},x))},f.prototype.render=function(){var h;return o.default.createElement("div",{id:this.props.id,style:this.props.style,key:this.state.generation,className:"quill "+(h=this.props.className,h??""),onKeyPress:this.props.onKeyPress,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp},this.renderEditingArea())},f.prototype.onEditorChangeText=function(h,p,v,m){var b,x;if(this.editor){var w=this.isDelta(this.value)?m.getContents():m.getHTML();w!==this.getEditorContents()&&(this.lastDeltaChangeSet=p,this.value=w,(x=(b=this.props).onChange)===null||x===void 0||x.call(b,h,p,v,m))}},f.prototype.onEditorChangeSelection=function(h,p,v){var m,b,x,w,k,j;if(this.editor){var _=this.getEditorSelection(),T=!_&&h,A=_&&!h;s.default(h,_)||(this.selection=h,(b=(m=this.props).onChangeSelection)===null||b===void 0||b.call(m,h,p,v),T?(w=(x=this.props).onFocus)===null||w===void 0||w.call(x,h,p,v):A&&((j=(k=this.props).onBlur)===null||j===void 0||j.call(k,_,p,v)))}},f.prototype.focus=function(){this.editor&&this.editor.focus()},f.prototype.blur=function(){this.editor&&(this.selection=null,this.editor.blur())},f.displayName="React Quill",f.Quill=l.default,f.defaultProps={theme:"snow",modules:{},readOnly:!1},f})(o.default.Component);function u(d){Promise.resolve().then(d)}return ec=c,ec}var Q8e=K8e();const X8e=dn(Q8e),Z8e={toolbar:[[{header:[1,2,3,!1]}],["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],[{align:[]}],["link"],["clean"]]},J8e=["header","bold","italic","underline","strike","list","bullet","align","link"];function KX({value:e,onChange:t,placeholder:r}){const n=S.useMemo(()=>Z8e,[]);return i.jsxs("div",{className:"rich-email-editor",style:{background:"var(--card)"},children:[i.jsx(X8e,{theme:"snow",value:e,onChange:t,modules:n,formats:J8e,placeholder:r,style:{minHeight:220}}),i.jsx("style",{children:`
.rich-email-editor .ql-container { min-height: 180px; font-family: var(--font-noto-sans), sans-serif; font-size: var(--text-sm); }
.rich-email-editor .ql-toolbar { border-color: var(--border); background: var(--secondary); }
.rich-email-editor .ql-container { border-color: var(--border); }
`})]})}const $w=[{token:"{{contact.firstName}}",label:"First name"},{token:"{{contact.lastName}}",label:"Last name"},{token:"{{contact.name}}",label:"Full name"},{token:"{{contact.email}}",label:"Email"},{token:"{{contact.organization}}",label:"Company"},{token:"{{contact.phone}}",label:"Phone"},{token:"{{event.name}}",label:"Event name"},{token:"{{event.startDate}}",label:"Event start"},{token:"{{event.endDate}}",label:"Event end"},{token:"{{event.venue}}",label:"Venue"},{token:"{{event.virtualLink}}",label:"Virtual link"}],km=[{mergeKey:"",label:"— None (manual sample only) —"},...$w.map(({token:e,label:t})=>({mergeKey:e.replace(/^\{\{|\}\}$/g,"").trim(),label:t}))],ME={"contact.firstName":"Jane","contact.lastName":"Doe","contact.name":"Jane Doe","contact.email":"jane@example.com","contact.organization":"Acme Inc.","contact.phone":"+91 98765 43210","event.name":"Annual Conference 2026","event.startDate":"15 Mar 2026, 9:00 am","event.endDate":"17 Mar 2026, 6:00 pm","event.venue":"Grand Hall, Mumbai","event.virtualLink":"https://meet.example.com/room/abc"},Hg={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function eIe(e){const t=e.event;return t&&typeof t=="object"&&"name"in t&&t.name||"—"}function sW(){var se,be,De;const{user:e}=Mr(),{setActiveNav:t,setSettingsInitialSection:r}=Li(),n=Nn(e),[o,a]=S.useState([]),[s,l]=S.useState(!0),[c,u]=S.useState([]),[d,f]=S.useState([]),[h,p]=S.useState([]),[v,m]=S.useState(!1),[b,x]=S.useState(null),[w,k]=S.useState(""),[j,_]=S.useState(""),[T,A]=S.useState(""),[P,N]=S.useState("template"),[O,C]=S.useState(""),[I,R]=S.useState(""),[F,M]=S.useState(""),[Y,X]=S.useState(""),[$,ee]=S.useState(!1),[V,D]=S.useState(null),[z,q]=S.useState(""),G=S.useCallback(async()=>{var ue;l(!0);const ae=await fo.listByOrg({channel:"email"});l(!1),(ue=ae.data)!=null&&ue.campaigns&&a(ae.data.campaigns)},[]);S.useEffect(()=>{G()},[G]),S.useEffect(()=>{n&&(Lr.list({limit:200,organization:n}).then(ae=>{var ue;(ue=ae.data)!=null&&ue.events&&u(ae.data.events)}),qa.list({organization:n}).then(ae=>{var ue;(ue=ae.data)!=null&&ue.lists&&f(ae.data.lists)}),Vs.list({type:"emailer",organization:n,limit:100}).then(ae=>{var ue;(ue=ae.data)!=null&&ue.templates&&p(ae.data.templates)}))},[n]),S.useEffect(()=>{var ue;if(!v||b||P!=="template"||O)return;const ae=(ue=h[0])==null?void 0:ue._id;ae&&C(ae)},[v,b,P,O,h]);const U=()=>{var ae,ue,Me;x(null),k(((ae=c[0])==null?void 0:ae._id)||""),_(""),A(((ue=d[0])==null?void 0:ue._id)||""),N("template"),C(((Me=h[0])==null?void 0:Me._id)||""),R(""),M("<p>Hello {{contact.name}},</p><p>…</p>"),X(""),q(""),m(!0)},Q=ae=>{var Se,Pe,Ee,Ae,Ye,rt;if(ae.status!=="draft")return;x(ae);const ue=typeof ae.event=="string"?ae.event:(Se=ae.event)==null?void 0:Se._id;k(ue||""),_(ae.name),A(((Pe=ae.recipients)==null?void 0:Pe.participantList)||"");const Me=!!((Ee=ae.content)!=null&&Ee.template);N(Me?"template":"manual"),C(((Ae=ae.content)==null?void 0:Ae.template)||""),R(((Ye=ae.content)==null?void 0:Ye.subject)||""),M(((rt=ae.content)==null?void 0:rt.body)||"<p></p>"),X(""),q(""),m(!0)},K=async()=>{if(!w||!j.trim())return q("Event and campaign name are required."),null;if(!T)return q("Select a contact list."),null;if(ee(!0),q(""),P==="template"&&!O)return q("Select an emailer template."),ee(!1),null;if(P==="manual"){const Se=F.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();if(!I.trim()||!Se)return q("Subject and message body are required for a manual message."),ee(!1),null}const ae={type:"participant_list",participantList:T},ue=P==="template"?{subject:"",body:"",template:O}:{subject:I,body:F,template:""};if(b){const Se=await fo.update(b._id,{name:j,recipients:ae,content:ue});return ee(!1),Se.error?(q(Se.error),null):b._id}const Me=await fo.create(w,{name:j,channel:"email",type:"broadcast",recipients:ae,content:ue});return ee(!1),Me.error?(q(Me.error),null):Me.data?(x(Me.data),Me.data._id):null},re=async()=>{await K()&&(m(!1),await G())},H=async()=>{if(b){if(!w||!j.trim()){q("Event and campaign name are required.");return}if(!T){q("Select a contact list.");return}if(P==="template"&&!O){q("Select an emailer template.");return}if(P==="manual"){const Ee=F.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();if(!I.trim()||!Ee){q("Subject and message body are required for a manual message.");return}}ee(!0),q("");const Me={type:"participant_list",participantList:T},Se=P==="template"?{subject:"",body:"",template:O}:{subject:I,body:F,template:""},Pe=await fo.send(b._id,{name:j,recipients:Me,content:Se});ee(!1),Pe.error?q(Pe.error):m(!1),await G();return}const ae=await K();if(!ae)return;const ue=await fo.send(ae,{});ue.error?q(ue.error):m(!1),await G()},ie=async()=>{if(!Y){q("Pick a date and time to schedule.");return}const ae=await K();if(!ae)return;const ue=new Date(Y).toISOString(),Me=await fo.schedule(ae,ue);Me.error?q(Me.error):m(!1),await G()},de=async ae=>{await fo.stop(ae),await G()},le=async ae=>{const ue=await fo.analytics(ae._id);ue.data&&typeof ue.data=="object"&&"stats"in ue.data&&D(ue.data)},ke=async ae=>{await fo.cancel(ae),await G()},ve=ae=>{M(ue=>ue+ae)};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:"Portfolio · Messaging"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"4px 0 0"},children:"Email campaigns"})]}),i.jsxs("button",{type:"button",onClick:U,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(k$,{size:13})," New campaign"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px 16px",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(Xf,{size:18,style:{color:"var(--primary)",flexShrink:0,marginTop:2}}),i.jsx("div",{style:{flex:1},children:i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:"Send from your own domain by configuring SMTP in Settings. When set, campaign emails use your provider; otherwise the platform default is used."})}),i.jsxs("button",{type:"button",onClick:()=>{r("email"),t("settings")},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",whiteSpace:"nowrap"},children:[i.jsx(hc,{size:14})," Email delivery"]})]}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 120px 100px 140px 1fr",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)",gap:"8px"},children:["Campaign","Event","Status","Scheduled","Actions"].map(ae=>i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase"},children:ae},ae))}),s?i.jsx("p",{style:{padding:24,fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Loading…"}):o.length===0?i.jsx("p",{style:{padding:24,fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No email campaigns yet. Create one to get started."}):o.map(ae=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 120px 100px 140px 1fr",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:ae.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:eIe(ae)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--card-foreground)"},children:ae.status}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:ae.scheduledFor?new Date(ae.scheduledFor).toLocaleString():"—"}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:[ae.status==="draft"&&i.jsxs("button",{type:"button",onClick:()=>Q(ae),style:th,children:[i.jsx(wi,{size:12})," Edit"]}),["sending","sent","failed","stopped"].includes(ae.status)&&i.jsxs("button",{type:"button",onClick:()=>void le(ae),style:th,children:[i.jsx(Ad,{size:12})," Stats"]}),ae.status==="scheduled"&&i.jsx("button",{type:"button",onClick:()=>void ke(ae._id),style:th,children:"Unschedule"}),ae.status!=="stopped"&&i.jsxs("button",{type:"button",onClick:()=>void de(ae._id),style:tIe,children:[i.jsx(C$,{size:12})," Stop"]})]})]},ae._id))]}),V&&i.jsx("div",{role:"dialog","aria-modal":!0,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:400,display:"flex",alignItems:"center",justifyContent:"center",padding:20},onClick:()=>D(null),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:24,maxWidth:420,width:"100%",border:"1px solid var(--border)"},onClick:ae=>ae.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[i.jsx("h2",{style:{margin:0,fontSize:"var(--text-lg)"},children:"Campaign stats"}),i.jsx("button",{type:"button","aria-label":"Close",onClick:()=>D(null),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:18})})]}),i.jsx("p",{style:{fontSize:"var(--text-sm)",margin:"0 0 8px"},children:V.name}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px"},children:["Status: ",V.status]}),i.jsxs("ul",{style:{margin:0,paddingLeft:18,fontSize:"var(--text-sm)"},children:[i.jsxs("li",{children:["Total queued: ",((se=V.stats)==null?void 0:se.total)??"—"]}),i.jsxs("li",{children:["Sent: ",((be=V.stats)==null?void 0:be.sent)??"—"]}),i.jsxs("li",{children:["Failed: ",((De=V.stats)==null?void 0:De.failed)??"—"]})]}),V.sentAt&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:12},children:["Sent: ",new Date(V.sentAt).toLocaleString()]})]})}),v&&i.jsx(ra,{onClose:()=>m(!1),title:b?"Edit campaign":"New email campaign",breadcrumb:"Messaging · Email",description:"Create an email campaign, choose recipients, then save, send, or schedule.",completedCount:0,totalSections:1,ctaLabel:"",showProgress:!1,hidePrimaryCta:!0,panelWidth:"min(720px, 100vw)",children:i.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",gap:14},children:[z&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:z}),!b&&i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Event"}),i.jsxs("select",{style:Hg,value:w,onChange:ae=>k(ae.target.value),children:[i.jsx("option",{value:"",children:"Select…"}),c.map(ae=>i.jsx("option",{value:ae._id,children:ae.name},ae._id))]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Campaign name"}),i.jsx("input",{style:Hg,value:j,onChange:ae=>_(ae.target.value),placeholder:"e.g. Registration reminder"})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Contact list"}),i.jsxs("select",{style:Hg,value:T,onChange:ae=>A(ae.target.value),children:[i.jsx("option",{value:"",children:"Select…"}),d.map(ae=>i.jsx("option",{value:ae._id,children:ae.name},ae._id))]})]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("button",{type:"button",onClick:()=>N("template"),style:P==="template"?Jy:th,children:"Design template"}),i.jsx("button",{type:"button",onClick:()=>N("manual"),style:P==="manual"?Jy:th,children:"Manual message"})]}),P==="template"&&i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Emailer template"}),i.jsxs("select",{style:Hg,value:O,onChange:ae=>C(ae.target.value),children:[i.jsx("option",{value:"",children:"Select…"}),h.map(ae=>i.jsx("option",{value:ae._id,children:ae.name},ae._id))]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"Subject and body come from this template. The email subject defaults to your campaign name if the template does not set one."})]}),P==="manual"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Subject"}),i.jsx("input",{style:Hg,value:I,onChange:ae=>R(ae.target.value),placeholder:"Subject line (placeholders ok)"})]}),i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,display:"block",marginBottom:8},children:"Message body"}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:$w.map(ae=>i.jsx("button",{type:"button",onClick:()=>ve(ae.token),style:rIe,children:ae.label},ae.token))}),i.jsx(KX,{value:F,onChange:M,placeholder:"Compose your email…"})]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Schedule (optional)"}),i.jsx("input",{type:"datetime-local",style:Hg,value:Y,onChange:ae=>X(ae.target.value)})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:8},children:[i.jsx("button",{type:"button",disabled:$,onClick:()=>void re(),style:th,children:"Save draft"}),i.jsx("button",{type:"button",disabled:$,onClick:()=>void H(),style:Jy,children:"Send now"}),i.jsx("button",{type:"button",disabled:$||!Y,onClick:()=>void ie(),style:Jy,children:"Schedule"})]})]})})]})}const Jy={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},th={...Jy,background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)"},tIe={...th,color:"var(--destructive)",borderColor:"var(--destructive)"},rIe={fontSize:"10px",padding:"4px 8px",borderRadius:99,border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",fontFamily:"var(--font-noto-sans)"},Ku={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},q6={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},Xg={...q6,background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)"},nIe={...Xg,color:"var(--destructive)",borderColor:"var(--destructive)"};function iIe(e){const t=e.event;return t&&typeof t=="object"&&"name"in t&&t.name||"—"}function DE(){return{mode:"default"}}function BE(e,t,r,n){var s;const o=(s=r==null?void 0:r.waOverrides)==null?void 0:s[t],a=[];for(let l=0;l<e;l+=1){const c=String(l+1),u=o==null?void 0:o[c];if(!u){a.push({mode:"default"});continue}if(u.kind==="fixed")a.push({mode:"fixed",fixed:u.value||""});else{const d=String((n==null?void 0:n[l])||"").trim();d&&u.key===d?a.push({mode:"default"}):a.push({mode:"merge",mergeKey:u.key||""})}}return a}function WE(e,t){const r={};for(let n=0;n<e.length;n+=1){const o=e[n],a=String((t==null?void 0:t[n])||"").trim();if(o.mode!=="default"){if(o.mode==="fixed")r[String(n+1)]={kind:"fixed",value:String(o.fixed||"")};else if(o.mode==="merge"){const s=String(o.mergeKey||"").trim();s&&s!==a&&(r[String(n+1)]={kind:"merge",key:s})}}}return Object.keys(r).length?r:void 0}function oIe(e){return e.some(t=>String(t.type||"").toUpperCase()==="HEADER"&&String(t.format||"").toUpperCase()==="IMAGE")}function aIe(){var qe,Et,vt,Ft,Ce,lt,Xe;const{user:e}=Mr(),{setActiveNav:t,setSettingsInitialSection:r}=Li(),n=Nn(e),[o,a]=S.useState([]),[s,l]=S.useState(!0),[c,u]=S.useState([]),[d,f]=S.useState([]),[h,p]=S.useState([]),[v,m]=S.useState(null),[b,x]=S.useState(null),[w,k]=S.useState(!1),[j,_]=S.useState(!1),[T,A]=S.useState(null),[P,N]=S.useState(null),[O,C]=S.useState(""),[I,R]=S.useState(""),[F,M]=S.useState(""),[Y,X]=S.useState(""),[$,ee]=S.useState(""),[V,D]=S.useState([]),[z,q]=S.useState([]),[G,U]=S.useState([]),[Q,K]=S.useState(!1),[re,H]=S.useState(""),[ie,de]=S.useState(!1),[le,ke]=S.useState(!1),[ve,se]=S.useState(null),[be,De]=S.useState(""),ae=S.useRef(null),ue=S.useCallback(async()=>{var ct;l(!0);const Be=await fo.listByOrg({channel:"whatsapp"});l(!1),(ct=Be.data)!=null&&ct.campaigns&&a(Be.data.campaigns)},[]);S.useEffect(()=>{ue()},[ue]),S.useEffect(()=>{n&&(Lr.list({limit:200,organization:n}).then(Be=>{var ct;(ct=Be.data)!=null&&ct.events&&u(Be.data.events)}),qa.list({organization:n}).then(Be=>{var ct;(ct=Be.data)!=null&&ct.lists&&f(Be.data.lists)}),em.list({}).then(Be=>{var ct;(ct=Be.data)!=null&&ct.templates&&p(Be.data.templates)}),cs.getWhatsAppSettings().then(Be=>{if(Be.error||!Be.data){m(null),x(null),k(!1);return}const ct=Be.data;m(ct.graphAccess),x(ct.canSendMessages),k(!!ct.usingServerDefaults)}))},[n]);const Me=S.useCallback((Be,ct)=>{const Tt=Array.isArray(Be.components)?Be.components:[],We=oIe(Tt);K(We);const ce=Be.variableBindings||{header:[],body:[],url:[]},he=(ce.header||[]).length,je=(ce.body||[]).length,xe=(ce.url||[]).length;D(ct?BE(he,"header",ct,ce.header):Array(he).fill(0).map(()=>DE())),q(ct?BE(je,"body",ct,ce.body):Array(je).fill(0).map(()=>DE())),U(ct?BE(xe,"url",ct,ce.url):Array(xe).fill(0).map(()=>DE())),ct!=null&&ct.waHeaderImageUrl?ee(ct.waHeaderImageUrl):We&&ee("")},[]);S.useEffect(()=>{if(!Y){N(null),K(!1),D([]),q([]),U([]);return}em.get(Y).then(Be=>{Be.data&&(N(Be.data),Me(Be.data,T?T.content:void 0))})},[Y,T==null?void 0:T._id,Me,T]);const Se=()=>{var Be,ct,Tt;A(null),C(((Be=c[0])==null?void 0:Be._id)||""),R(""),M(((ct=d[0])==null?void 0:ct._id)||""),X(((Tt=h[0])==null?void 0:Tt._id)||""),ee(""),H(""),De(""),N(null),D([]),q([]),U([]),_(!0)},Pe=Be=>{var Tt,We,ce,he;if(Be.status!=="draft")return;A(Be);const ct=typeof Be.event=="string"?Be.event:(Tt=Be.event)==null?void 0:Tt._id;C(ct||""),R(Be.name),M(((We=Be.recipients)==null?void 0:We.participantList)||""),X(((ce=Be.content)==null?void 0:ce.whatsappTemplateId)||""),ee(((he=Be.content)==null?void 0:he.waHeaderImageUrl)||""),H(""),De(""),_(!0)},Ee=()=>{const Be=(P==null?void 0:P.variableBindings)||{header:[],body:[],url:[]},ct={},Tt=WE(V,Be.header),We=WE(z,Be.body),ce=WE(G,Be.url);return Tt&&(ct.header=Tt),We&&(ct.body=We),ce&&(ct.url=ce),{whatsappTemplateId:Y,waHeaderImageUrl:Q?$.trim():"",...Object.keys(ct).length?{waOverrides:ct}:{}}},Ae=async()=>{if(!O||!I.trim())return De("Event and campaign name are required."),null;if(!F)return De("Select a contact list."),null;if(!Y)return De("Select a WhatsApp template."),null;if(Q&&!$.trim())return De("This template uses an image header. Add a public https image URL (or upload)."),null;de(!0),De("");const Be={type:"participant_list",participantList:F},ct=Ee();if(T){const We=await fo.update(T._id,{name:I,recipients:Be,content:ct});return de(!1),We.error?(De(typeof We.error=="string"?We.error:"Save failed"),null):T._id}const Tt=await fo.create(O,{name:I,channel:"whatsapp",type:"broadcast",recipients:Be,content:ct});return de(!1),Tt.error?(De(typeof Tt.error=="string"?Tt.error:"Save failed"),null):Tt.data?(A(Tt.data),Tt.data._id):null},Ye=async()=>{await Ae()&&(_(!1),await ue())},rt=async()=>{if(T){if(!I.trim()){De("Campaign name is required.");return}if(!F){De("Select a contact list.");return}if(!Y){De("Select a WhatsApp template.");return}if(Q&&!$.trim()){De("This template uses an image header. Add a public https image URL (or upload).");return}de(!0),De("");const Tt={type:"participant_list",participantList:F},We=Ee(),ce=await fo.send(T._id,{name:I,recipients:Tt,content:We});de(!1),ce.error?De(typeof ce.error=="string"?ce.error:"Send failed"):_(!1),await ue();return}const Be=await Ae();if(!Be)return;const ct=await fo.send(Be,{});ct.error?De(typeof ct.error=="string"?ct.error:"Send failed"):_(!1),await ue()},He=async()=>{if(!re){De("Pick a date and time to schedule.");return}const Be=await Ae();if(!Be)return;const ct=new Date(re).toISOString(),Tt=await fo.schedule(Be,ct);Tt.error?De(typeof Tt.error=="string"?Tt.error:"Schedule failed"):_(!1),await ue()},xt=async Be=>{await fo.stop(Be),await ue()},st=async Be=>{const ct=await fo.analytics(Be._id);ct.data&&typeof ct.data=="object"&&"stats"in ct.data&&se(ct.data)},Te=async Be=>{await fo.cancel(Be),await ue()},et=async Be=>{if(Be){if(!Be.type.startsWith("image/")){De("Choose an image file.");return}ke(!0),De("");try{const ct=await Sa(Be,{eventId:"portfolio",module:"whatsapp/campaign-header"});ct.url&&ee(ct.url)}catch(ct){De(ct instanceof Error?ct.message:"Upload failed")}finally{ke(!1),ae.current&&(ae.current.value="")}}},Pt=(Be,ct,Tt,We)=>i.jsxs("div",{style:{marginTop:8},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,display:"block",marginBottom:6},children:Be}),ct.length===0?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:0},children:"No variables in this section."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:ct.map((ce,he)=>i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,fontSize:"var(--text-xs)"},children:[i.jsxs("span",{children:[`{{${he+1}}}`," ",i.jsxs("span",{style:{color:"var(--muted)"},children:["(",We[he]||"—",")"]})]}),i.jsxs("select",{style:Ku,value:ce.mode,onChange:je=>{var ze;const xe=je.target.value,Re=[...ct];xe==="default"?Re[he]={mode:"default"}:xe==="merge"?Re[he]={mode:"merge",mergeKey:((ze=km.find(Le=>Le.mergeKey))==null?void 0:ze.mergeKey)||"contact.firstName"}:Re[he]={mode:"fixed",fixed:""},Tt(Re)},children:[i.jsx("option",{value:"default",children:"Default (from template design)"}),i.jsx("option",{value:"merge",children:"Map to field"}),i.jsx("option",{value:"fixed",children:"Fixed text"})]}),ce.mode==="merge"&&i.jsx("select",{style:Ku,value:ce.mergeKey||"",onChange:je=>{const xe=[...ct];xe[he]={mode:"merge",mergeKey:je.target.value},Tt(xe)},children:km.filter(je=>je.mergeKey).map(je=>i.jsx("option",{value:je.mergeKey,children:je.label},je.mergeKey))}),ce.mode==="fixed"&&i.jsx("input",{style:Ku,value:ce.fixed||"",onChange:je=>{const xe=[...ct];xe[he]={mode:"fixed",fixed:je.target.value},Tt(xe)},placeholder:"Literal value for this send"}),ce.mode==="default"&&i.jsx("span",{style:{color:"var(--muted)"},children:"Uses template merge mapping"})]},`${Be}-${he}`))})]});return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:"Portfolio · Messaging"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"4px 0 0"},children:"WhatsApp campaigns"})]}),i.jsxs("button",{type:"button",onClick:Se,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(k$,{size:13})," New campaign"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px 16px",background:"var(--secondary)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx($h,{size:18,style:{color:"var(--primary)",flexShrink:0,marginTop:2}}),i.jsxs("div",{style:{flex:1},children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:"Create approved message templates under Design, then run campaigns. Sending uses the organisation's WhatsApp Cloud settings in Settings, or the server's default Meta credentials (env) when the org has not added its own. Recipients need phone numbers. A queue worker (rate-limited) delivers messages."}),w&&i.jsx("p",{style:{margin:"8px 0 0",fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"This organisation is using the platform default WhatsApp credentials from the server (no WABA saved under Settings)."})]}),i.jsxs("button",{type:"button",onClick:()=>{r("whatsapp"),t("settings")},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",whiteSpace:"nowrap"},children:[i.jsx(hc,{size:14})," WhatsApp"]})]}),v===!1&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",margin:0},children:"WhatsApp is not available: no WABA and access token for this organisation, and no server defaults (e.g. META_WHATSAPP_DEFAULT_WABA_ID and META_WHATSAPP_ACCESS_TOKEN). Add credentials under Settings or in server env."}),v===!0&&b===!1&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"#a16207",margin:0,background:"rgba(234,179,8,0.1)",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid rgba(234,179,8,0.35)"},children:["WABA and token are set, but a phone number ID is required to send. Set ",i.jsx("code",{style:{fontSize:12},children:"META_WHATSAPP_DEFAULT_PHONE_NUMBER_ID"})," on the server, or add it in Settings (WhatsApp Cloud)."]}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 120px 100px 140px 1fr",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)",gap:"8px"},children:["Campaign","Event","Status","Scheduled","Actions"].map(Be=>i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:600,color:"var(--muted)",textTransform:"uppercase"},children:Be},Be))}),s?i.jsx("p",{style:{padding:24,fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Loading…"}):o.length===0?i.jsx("p",{style:{padding:24,fontSize:"var(--text-sm)",color:"var(--muted)"},children:"No WhatsApp campaigns yet. Create one to get started."}):o.map(Be=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 120px 100px 140px 1fr",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,color:"var(--foreground)"},children:Be.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:iIe(Be)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--card-foreground)"},children:Be.status}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:Be.scheduledFor?new Date(Be.scheduledFor).toLocaleString():"—"}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:[Be.status==="draft"&&i.jsxs("button",{type:"button",onClick:()=>Pe(Be),style:Xg,children:[i.jsx(wi,{size:12})," Edit"]}),["sending","sent","failed","stopped"].includes(Be.status)&&i.jsxs("button",{type:"button",onClick:()=>void st(Be),style:Xg,children:[i.jsx(Ad,{size:12})," Stats"]}),Be.status==="scheduled"&&i.jsx("button",{type:"button",onClick:()=>void Te(Be._id),style:Xg,children:"Unschedule"}),Be.status!=="stopped"&&i.jsxs("button",{type:"button",onClick:()=>void xt(Be._id),style:nIe,children:[i.jsx(C$,{size:12})," Stop"]})]})]},Be._id))]}),ve&&i.jsx("div",{role:"dialog","aria-modal":!0,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",zIndex:400,display:"flex",alignItems:"center",justifyContent:"center",padding:20},onClick:()=>se(null),children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",padding:24,maxWidth:(qe=ve.whatsappQueue)!=null&&qe.length?640:420,width:"100%",maxHeight:"90vh",overflow:"auto",border:"1px solid var(--border)"},onClick:Be=>Be.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[i.jsx("h2",{style:{margin:0,fontSize:"var(--text-lg)"},children:"Campaign stats"}),i.jsx("button",{type:"button","aria-label":"Close",onClick:()=>se(null),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:18})})]}),i.jsx("p",{style:{fontSize:"var(--text-sm)",margin:"0 0 8px"},children:ve.name}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 12px"},children:["Status: ",ve.status]}),i.jsxs("ul",{style:{margin:0,paddingLeft:18,fontSize:"var(--text-sm)"},children:[i.jsxs("li",{children:["Total queued: ",((Et=ve.stats)==null?void 0:Et.total)??"—"]}),i.jsxs("li",{children:["Sent: ",((vt=ve.stats)==null?void 0:vt.sent)??"—"]}),i.jsxs("li",{children:["Failed: ",((Ft=ve.stats)==null?void 0:Ft.failed)??"—"]})]}),ve.sentAt&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:12},children:["Sent: ",new Date(ve.sentAt).toLocaleString()]}),ve.whatsappQueue&&ve.whatsappQueue.length>0&&i.jsxs("div",{style:{marginTop:16},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:600,color:"var(--muted)",margin:"0 0 8px",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Message IDs (webhook correlation)"}),i.jsx("div",{style:{overflowX:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-xs)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--secondary)",textAlign:"left"},children:[i.jsx("th",{style:{padding:"8px 10px",fontWeight:600},children:"To"}),i.jsx("th",{style:{padding:"8px 10px",fontWeight:600},children:"Status"}),i.jsx("th",{style:{padding:"8px 10px",fontWeight:600},children:"wamid"})]})}),i.jsx("tbody",{children:ve.whatsappQueue.map(Be=>i.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[i.jsx("td",{style:{padding:"8px 10px",fontFamily:"var(--font-noto-sans)",wordBreak:"break-all"},children:Be.to}),i.jsx("td",{style:{padding:"8px 10px"},children:Be.status}),i.jsx("td",{style:{padding:"8px 10px",wordBreak:"break-all",color:Be.whatsappMessageId?"var(--card-foreground)":"var(--muted)"},children:Be.whatsappMessageId||"—"})]},Be._id))})]})})]})]})}),j&&i.jsx(ra,{onClose:()=>_(!1),title:T?"Edit WhatsApp campaign":"New WhatsApp campaign",breadcrumb:"Messaging · WhatsApp",description:"Choose an approved template, optional per-send overrides, and a list with phone numbers. Run npm run whatsapp-worker on the server to deliver.",completedCount:0,totalSections:1,ctaLabel:"",showProgress:!1,hidePrimaryCta:!0,panelWidth:"min(720px, 100vw)",children:i.jsxs("div",{style:{padding:"20px 24px",display:"flex",flexDirection:"column",gap:14,maxHeight:"85vh",overflow:"auto"},children:[be&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:be}),!T&&i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Event"}),i.jsxs("select",{style:Ku,value:O,onChange:Be=>C(Be.target.value),children:[i.jsx("option",{value:"",children:"Select…"}),c.map(Be=>i.jsx("option",{value:Be._id,children:Be.name},Be._id))]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Campaign name"}),i.jsx("input",{style:Ku,value:I,onChange:Be=>R(Be.target.value),placeholder:"e.g. Reminder – registered guests"})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Contact list"}),i.jsxs("select",{style:Ku,value:F,onChange:Be=>M(Be.target.value),children:[i.jsx("option",{value:"",children:"Select…"}),d.map(Be=>i.jsx("option",{value:Be._id,children:Be.name},Be._id))]})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Message template (APPROVED)"}),i.jsxs("select",{style:Ku,value:Y,onChange:Be=>X(Be.target.value),children:[i.jsx("option",{value:"",children:"Select…"}),h.map(Be=>i.jsxs("option",{value:Be._id,children:[Be.name," (",Be.language,") ",Be.status?`· ${Be.status}`:""]},Be._id))]})]}),Q&&i.jsxs("div",{children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500,display:"block",marginBottom:6},children:"Header image (https)"}),i.jsx("input",{style:Ku,value:$,onChange:Be=>ee(Be.target.value),placeholder:"https://…"}),i.jsxs("div",{style:{marginTop:8,display:"flex",alignItems:"center",gap:8},children:[i.jsx("input",{ref:ae,type:"file",accept:"image/*",style:{display:"none"},onChange:Be=>{var ct;return void et((ct=Be.target.files)==null?void 0:ct[0])}}),i.jsx("button",{type:"button",style:Xg,disabled:le,onClick:()=>{var Be;return(Be=ae.current)==null?void 0:Be.click()},children:le?"Uploading…":"Upload image"})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"6px 0 0"},children:"Meta fetches this URL at send time; it must be publicly accessible."})]}),P&&i.jsxs(i.Fragment,{children:[Pt("Header variables",V,D,((Ce=P.variableBindings)==null?void 0:Ce.header)||[]),Pt("Body variables",z,q,((lt=P.variableBindings)==null?void 0:lt.body)||[]),Pt("URL button variables",G,U,((Xe=P.variableBindings)==null?void 0:Xe.url)||[])]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:6},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontWeight:500},children:"Schedule (optional)"}),i.jsx("input",{type:"datetime-local",style:Ku,value:re,onChange:Be=>H(Be.target.value)})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:8},children:[i.jsx("button",{type:"button",disabled:ie,onClick:()=>void Ye(),style:Xg,children:"Save draft"}),i.jsx("button",{type:"button",disabled:ie,onClick:()=>void rt(),style:q6,children:"Send now"}),i.jsx("button",{type:"button",disabled:ie||!re,onClick:()=>void He(),style:q6,children:"Schedule"})]})]})})]})}const lW=[{value:"admin",label:"Admin",desc:"Full access to all events and settings."},{value:"moderator",label:"Moderator",desc:"Can manage sessions, participants, and messaging."},{value:"viewer",label:"Viewer",desc:"Can view events and dashboards only."}],sIe={firstName:"",lastName:"",email:"",password:"",role:"moderator",assignedEvents:[],sendInviteNow:"Yes",personalMessage:""};function cW(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim())}function lIe({editUser:e,onClose:t,onSuccess:r}){const{user:n}=Mr(),o=Nn(n),a=!!e,s=3,l=wc(s),[c,u]=S.useState(()=>e?{firstName:e.firstName??"",lastName:e.lastName??"",email:e.email??"",password:"",role:e.role??"moderator",assignedEvents:[],sendInviteNow:"Yes",personalMessage:""}:sIe),[d,f]=S.useState({}),[h,p]=S.useState(!1),[v,m]=S.useState([]),[b,x]=S.useState(!0);S.useEffect(()=>{e&&u({firstName:e.firstName??"",lastName:e.lastName??"",email:e.email??"",password:"",role:e.role??"moderator",assignedEvents:[],sendInviteNow:"Yes",personalMessage:""})},[e==null?void 0:e._id]),S.useEffect(()=>{let O=!1;return(async()=>{var C;x(!0);try{if(!o){O||m([]);return}const I=await Lr.list({organization:o});O||m(((C=I.data)==null?void 0:C.events)??[])}catch{O||m([])}finally{O||x(!1)}})(),()=>{O=!0}},[o]);const w=(O,C)=>u(I=>({...I,[O]:C})),k=O=>u(C=>({...C,assignedEvents:C.assignedEvents.includes(O)?C.assignedEvents.filter(I=>I!==O):[...C.assignedEvents,O]})),j=S.useCallback((O,C)=>C===1?!(!O.firstName.trim()||!O.lastName.trim()||!O.email.trim()||!cW(O.email)||!a&&(!O.password||O.password.length<6)||a&&O.password.length>0&&O.password.length<6):!0,[a]),_=S.useCallback(O=>{const C=j(c,O);f(I=>({...I,[O]:C?"":"Please complete all required fields before continuing."})),C&&l.advance(O)},[c,j,l]),T=S.useCallback(async()=>{if(!j(c,1)){f(O=>({...O,1:"Please complete all required fields."}));return}if(p(!0),f({}),a&&e){const O=await Sx.update(e._id,{email:c.email.trim(),firstName:c.firstName.trim()||void 0,lastName:c.lastName.trim()||void 0,role:c.role,...c.password?{password:c.password}:{},assignedEvents:c.assignedEvents.length?c.assignedEvents:void 0});if(p(!1),O.error){f(C=>({...C,1:O.error||"Failed to update user. Please try again."}));return}}else{const O=await Sx.create({email:c.email.trim(),password:c.password,firstName:c.firstName.trim()||void 0,lastName:c.lastName.trim()||void 0,role:c.role,assignedEvents:c.assignedEvents.length?c.assignedEvents:void 0});if(p(!1),O.error){f(C=>({...C,1:O.error||"Failed to invite user. Please try again."}));return}}r==null||r(),t()},[c,j,a,e,r,t]),A=S.useCallback(()=>{if(!j(c,3)){f(O=>({...O,3:"Please complete required fields."}));return}f(O=>({...O,3:""})),T()},[c,j,T]),P=c.firstName.trim()&&c.lastName.trim()&&c.email.trim()&&cW(c.email)&&!h&&(a&&c.password.length===0||c.password.length>=6),N=lW.find(O=>O.value===c.role);return i.jsxs(ra,{onClose:t,title:a?"Edit User":"Invite User",breadcrumb:"User Management",description:"Send an invitation to a new team member. They'll receive an email to set up their account.",completedCount:l.done.size,totalSections:s,ctaLabel:"Save",ctaDisabled:!P,onCtaClick:T,children:[i.jsx(Ur,{n:1,title:"User Details",subtitle:"Enter the new team member's information",open:l.open===1,completed:l.done.has(1),onToggle:()=>l.toggle(1),onSave:()=>_(1),nextLabel:"Role & Permissions",sectionError:d[1],children:i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"First Name",required:!0}),i.jsx("input",{style:Ht,placeholder:"First name",value:c.firstName,onChange:O=>w("firstName",O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Last Name",required:!0}),i.jsx("input",{style:Ht,placeholder:"Last name",value:c.lastName,onChange:O=>w("lastName",O.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{span2:!0,children:[i.jsx(ht,{text:"Email Address",required:!0}),i.jsx("input",{type:"email",style:Ht,placeholder:"name@organisation.com",value:c.email,onChange:O=>w("email",O.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"An invitation link will be sent to this address."})]}),i.jsxs(dt,{span2:!0,children:[i.jsx(ht,{text:"Initial password",required:!0}),i.jsx("input",{type:"password",style:Ht,placeholder:"Min 6 characters",value:c.password,onChange:O=>w("password",O.target.value),onFocus:St,onBlur:jt,minLength:6}),i.jsx(Vt,{text:"User will need this to sign in. They can change it later."})]})]})}),i.jsxs(Ur,{n:2,title:"Role & Permissions",subtitle:"Choose the access level for this team member",open:l.open===2,completed:l.done.has(2),onToggle:()=>l.toggle(2),onSave:()=>_(2),nextLabel:"Event Access",sectionError:d[2],children:[i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:lW.map(O=>i.jsxs("button",{type:"button",onClick:()=>w("role",O.value),style:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"12px 14px",borderRadius:"var(--radius-button)",border:`2px solid ${c.role===O.value?"var(--primary)":"var(--border)"}`,background:c.role===O.value?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left",transition:"all .12s"},children:[i.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"50%",border:`2px solid ${c.role===O.value?"var(--primary)":"var(--border)"}`,background:c.role===O.value?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",marginTop:"1px",flexShrink:0},children:c.role===O.value&&i.jsx("div",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"#fff"}})}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:c.role===O.value?"var(--primary)":"var(--foreground)",margin:"0 0 2px"},children:O.label}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:O.desc})]})]},O.value))}),N&&i.jsx("div",{style:{padding:"10px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)"},children:i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:[i.jsxs("strong",{style:{color:"var(--foreground)"},children:[N.label,":"]})," ",N.desc]})})]}),i.jsxs(Ur,{n:3,title:"Event Access & Invite",subtitle:"Assign events and configure the invitation",open:l.open===3,completed:l.done.has(3),onToggle:()=>l.toggle(3),onSave:A,nextLabel:"Save",sectionError:d[3],children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Assign to Events"}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"8px"},children:c.assignedEvents.map(O=>{const C=v.find(I=>I._id===O);return i.jsx(u2,{text:(C==null?void 0:C.name)??O,onRemove:()=>k(O)},O)})}),b?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:"Loading events…"}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px",maxHeight:"160px",overflowY:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden"},children:[v.map(O=>{const C=c.assignedEvents.includes(O._id);return i.jsxs("button",{type:"button",onClick:()=>k(O._id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"9px 14px",background:C?"var(--accent)":"transparent",border:"none",borderBottom:"1px solid var(--border)",cursor:"pointer",textAlign:"left"},children:[i.jsx("input",{type:"checkbox",readOnly:!0,checked:C,style:{accentColor:"var(--primary)",width:"14px",height:"14px",cursor:"pointer"}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:C?"var(--primary)":"var(--card-foreground)"},children:O.name})]},O._id)}),v.length===0&&i.jsx("div",{style:{padding:"12px 14px",fontSize:"var(--text-xs)",color:"var(--muted)"},children:"No events found. Create events first."})]}),i.jsx(Vt,{text:"Leave empty to grant access to all events based on their role."})]}),i.jsxs(ro,{cols:1,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Send Invite Now",required:!0}),i.jsx(Hi,{name:"sendNow",value:c.sendInviteNow,onChange:O=>w("sendInviteNow",O),options:[{label:"Yes, send immediately",value:"Yes"},{label:"No, save as draft",value:"No"}]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Personal Message"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},placeholder:"Optional: Add a personal note to the invitation email…",value:c.personalMessage,onChange:O=>w("personalMessage",O.target.value),onFocus:St,onBlur:jt,maxLength:300}),i.jsx(Vt,{text:`${c.personalMessage.length}/300 characters.`})]})]})]})]})}const cIe=["Cover Page","About the Event","Agenda / Programme","Speakers & Faculty","Sponsors & Partners","Venue & Directions","Registration Info","Contact Details"],uIe=["A4","A5","US Letter","US Legal","Custom"],dIe=["Portrait","Landscape"],fIe=[{id:"brand",label:"Brand Blue",colors:["#0B4DD1","#E8EFFC","#FFFFFF"]},{id:"dark",label:"Bold Dark",colors:["#1A1A2E","#16213E","#E2E8F0"]},{id:"minimal",label:"Minimal",colors:["#FFFFFF","#F8FAFC","#1E293B"]},{id:"warm",label:"Warm Amber",colors:["#D97706","#FEF3C7","#1E293B"]},{id:"emerald",label:"Emerald",colors:["#059669","#ECFDF5","#1E293B"]}],pIe=["Inter + Noto Sans","Playfair + Source Sans","Montserrat + Open Sans","Merriweather + Lato"],hIe=["PDF (Print-ready)","PDF (Screen)","PNG (High-res)","All formats"],gIe=[...uIe],mIe=[...dIe],vIe=[...fIe],uW=[...pIe],yIe=[...cIe],xIe=[...hIe],bIe=[{id:"tpl1",label:"Classic",thumb:"#CBD5E1"},{id:"tpl2",label:"Modern",thumb:"#93C5FD"},{id:"tpl3",label:"Bold",thumb:"#6D28D9"},{id:"tpl4",label:"Minimal",thumb:"#F1F5F9"},{id:"tpl5",label:"Vibrant",thumb:"#10B981"},{id:"tpl6",label:"Corporate",thumb:"#1E3A5F"}];function wIe({onClose:e,templateId:t,onSuccess:r}){const{user:n}=Mr(),o=Nn(n),a=!!t,s=4,l=wc(s),[c,u]=S.useState([]),[d,f]=S.useState({name:"",description:"",event:"",pageSize:"A4",customW:"",customH:"",orientation:"Portrait",templateId:"tpl1",colorScheme:"brand",fontPair:uW[0],coverTitle:"",coverSubtitle:"",coverDate:"",sections:["Cover Page","About the Event","Agenda / Programme"],outputFormat:"PDF (Print-ready)",bleed:!1,cropMarks:!1}),[h,p]=S.useState(!1),v=(x,w)=>f(k=>({...k,[x]:w}));S.useEffect(()=>{o&&Lr.list({limit:100,organization:o}).then(x=>{var w;(w=x.data)!=null&&w.events&&(u(x.data.events),f(k=>{var j;return{...k,event:k.event||((j=x.data.events[0])==null?void 0:j._id)||""}}))})},[o]),S.useEffect(()=>{t&&Vs.get(t).then(x=>{if(!x.data)return;const w=x.data;f(k=>{var T;const j={...k,name:w.name,description:w.category||""};if(!g$(w.content))return j;const _=w.content;return{...j,event:_.eventId||j.event,pageSize:_.pageSize,customW:_.customW??"",customH:_.customH??"",orientation:_.orientation,templateId:_.layoutId||"tpl1",colorScheme:_.colorScheme,fontPair:_.fontPair,coverTitle:_.coverTitle,coverSubtitle:_.coverSubtitle,coverDate:_.coverDate,sections:(T=_.sections)!=null&&T.length?_.sections:k.sections,outputFormat:_.outputFormat,bleed:_.bleed,cropMarks:_.cropMarks}})})},[t]);const m=async()=>{p(!0);const x={version:1,eventId:d.event,pageSize:d.pageSize,customW:d.pageSize==="Custom"?d.customW:void 0,customH:d.pageSize==="Custom"?d.customH:void 0,orientation:d.orientation,layoutId:d.templateId,colorScheme:d.colorScheme,fontPair:d.fontPair,coverTitle:d.coverTitle,coverSubtitle:d.coverSubtitle,coverDate:d.coverDate,sections:d.sections,outputFormat:d.outputFormat,bleed:d.bleed,cropMarks:d.cropMarks},w={name:d.name,type:"brochure",category:d.description||void 0,content:x},k=a?await Vs.update(t,w):await Vs.create(w);if(p(!1),k.error||!k.data)return;const j=k.data._id;d.event.trim()&&await Vs.useForEvent(j,d.event),r==null||r(),e()},b=x=>v("sections",d.sections.includes(x)?d.sections.filter(w=>w!==x):[...d.sections,x]);return i.jsxs(ra,{onClose:e,title:a?"Edit Brochure":"Create Brochure",breadcrumb:"Design · Brochure",description:"Design a print-ready or digital brochure for your event.",completedCount:l.done.size,totalSections:s,ctaLabel:a?"Save changes":"Create Brochure",ctaDisabled:h||!d.name.trim(),onCtaClick:m,children:[i.jsxs(Ur,{n:1,title:"Brochure Details",subtitle:"Name, event and page setup",open:l.open===1,completed:l.done.has(1),onToggle:()=>l.toggle(1),onSave:()=>l.advance(1),nextLabel:"Layout & Design",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Brochure Name",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. NAPCON 2026 Event Brochure",value:d.name,onChange:x=>v("name",x.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"64px"},placeholder:"Brief description of this brochure…",value:d.description,onChange:x=>v("description",x.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Associated Event",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:d.event,onChange:x=>v("event",x.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select event…"}),c.map(x=>i.jsx("option",{value:x._id,children:x.name},x._id))]})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Page Size",required:!0}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:d.pageSize,onChange:x=>v("pageSize",x.target.value),onFocus:St,onBlur:jt,children:gIe.map(x=>i.jsx("option",{children:x},x))})})]}),d.pageSize==="Custom"&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Width (mm)",required:!0}),i.jsx("input",{style:Ht,placeholder:"210",value:d.customW,onChange:x=>v("customW",x.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Height (mm)",required:!0}),i.jsx("input",{style:Ht,placeholder:"297",value:d.customH,onChange:x=>v("customH",x.target.value),onFocus:St,onBlur:jt})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Orientation"}),i.jsx(Hi,{name:"brOrientation",value:d.orientation,onChange:x=>v("orientation",x),options:mIe.map(x=>({label:x,value:x}))})]})]})]}),i.jsxs(Ur,{n:2,title:"Layout & Design",subtitle:"Choose a template, colour scheme and fonts",open:l.open===2,completed:l.done.has(2),onToggle:()=>l.toggle(2),onSave:()=>l.advance(2),nextLabel:"Content",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Template",required:!0}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3,1fr)",gap:"8px"},children:bIe.map(x=>i.jsxs("button",{onClick:()=>v("templateId",x.id),style:{borderRadius:"var(--radius-button)",border:`2px solid ${d.templateId===x.id?"var(--primary)":"var(--border)"}`,overflow:"hidden",cursor:"pointer",background:"none",padding:0,transition:"border-color .12s"},children:[i.jsx("div",{style:{height:"72px",background:x.thumb}}),i.jsx("p",{style:{margin:"6px 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:d.templateId===x.id?"var(--primary)":"var(--card-foreground)"},children:x.label})]},x.id))})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Colour Scheme"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:vIe.map(x=>i.jsxs("button",{onClick:()=>v("colorScheme",x.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"var(--radius-button)",border:`1.5px solid ${d.colorScheme===x.id?"var(--primary)":"var(--border)"}`,background:d.colorScheme===x.id?"var(--accent)":"var(--card)",cursor:"pointer",transition:"all .12s"},children:[i.jsx("div",{style:{display:"flex",gap:"3px",flexShrink:0},children:x.colors.map((w,k)=>i.jsx("div",{style:{width:"14px",height:"14px",borderRadius:"50%",background:w,border:"1px solid rgba(0,0,0,0.1)"}},k))}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:x.label}),d.colorScheme===x.id&&i.jsx(bi,{size:12,style:{color:"var(--primary)",marginLeft:"auto"}})]},x.id))})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Font Pairing"}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:d.fontPair,onChange:x=>v("fontPair",x.target.value),onFocus:St,onBlur:jt,children:uW.map(x=>i.jsx("option",{children:x},x))})})]})]}),i.jsxs(Ur,{n:3,title:"Content",subtitle:"Set cover details and choose sections to include",open:l.open===3,completed:l.done.has(3),onToggle:()=>l.toggle(3),onSave:()=>l.advance(3),nextLabel:"Output Settings",children:[i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Cover Title",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. NAPCON 2026",value:d.coverTitle,onChange:x=>v("coverTitle",x.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Event Date on Cover"}),i.jsx("input",{style:Ht,placeholder:"e.g. Nov 14–16, 2026",value:d.coverDate,onChange:x=>v("coverDate",x.target.value),onFocus:St,onBlur:jt})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Cover Subtitle / Tagline"}),i.jsx("input",{style:Ht,placeholder:"e.g. National Pulmonology Conference",value:d.coverSubtitle,onChange:x=>v("coverSubtitle",x.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Sections to Include",required:!0}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:yIe.map(x=>{const w=d.sections.includes(x);return i.jsxs("button",{onClick:()=>b(x),style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${w?"var(--primary)":"var(--border)"}`,background:w?"var(--accent)":"var(--card)",cursor:"pointer",textAlign:"left",transition:"all .12s"},children:[i.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"4px",border:`2px solid ${w?"var(--primary)":"var(--border)"}`,background:w?"var(--primary)":"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all .12s"},children:w&&i.jsx(bi,{size:10,style:{color:"#fff"}})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:x})]},x)})}),i.jsx(Vt,{text:`${d.sections.length} section${d.sections.length!==1?"s":""} selected.`})]})]}),i.jsxs(Ur,{n:4,title:"Output Settings",subtitle:"Format and print-production options",open:l.open===4,completed:l.done.has(4),onToggle:()=>l.toggle(4),onSave:()=>l.advance(4),nextLabel:"Create Brochure",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Output Format",required:!0}),i.jsx(Hi,{name:"brOutput",value:d.outputFormat,onChange:x=>v("outputFormat",x),options:xIe.map(x=>({label:x,value:x}))})]}),i.jsx(Nm,{text:"Print Production"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[["bleed","Include Bleed (3 mm)","Adds bleed area around the page for professional printing."],["cropMarks","Crop Marks","Adds trim guides for print vendors."]].map(([x,w,k])=>i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:w}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:k})]}),i.jsx(SIe,{value:d[x],onChange:j=>v(x,j)})]},x))}),i.jsx(Vt,{text:"Print-ready PDFs include embedded fonts and CMYK colour profiles."})]})]})}function SIe({value:e,onChange:t}){return i.jsx("button",{onClick:()=>t(!e),style:{width:"36px",height:"20px",borderRadius:"99px",border:"none",cursor:"pointer",flexShrink:0,background:e?"var(--primary)":"var(--border)",position:"relative",transition:"background .2s"},children:i.jsx("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"14px",height:"14px",borderRadius:"50%",background:"#fff",transition:"left .2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})}async function jIe(e){var a,s,l;if(e.type!=="brochure"||!g$(e.content))return{ok:!1,error:"This brochure has no saved layout. Edit it and save again."};const t=e.content;let r=null,n=[],o=[];if((a=t.eventId)!=null&&a.trim()){const c=await Lr.get(t.eventId);c.data&&(r=c.data);const u=await ta.list(t.eventId);(s=u.data)!=null&&s.sessions&&(n=u.data.sessions);const d=await Lf.byEvent(t.eventId);(l=d.data)!=null&&l.speakers&&(o=d.data.speakers)}return{ok:!0,ctx:{templateName:e.name,content:t,event:r,sessions:n,speakers:o}}}const kIe=[{name:"PharmaCorp India",tier:"Platinum"},{name:"MedTech Solutions",tier:"Gold"},{name:"Healthcare Systems Ltd",tier:"Silver"}];function _Ie(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}catch{return""}}function CIe(e){const t=e.speakers;return t!=null&&t.length?t.map(r=>typeof r=="string"?"":[r.firstName,r.lastName].filter(Boolean).join(" ").trim()).filter(Boolean).join(", "):""}function EIe(e){return e.map(t=>{var r;return{name:[t.firstName,t.lastName].filter(Boolean).join(" ").trim()||"—",title:t.title||t.organizationName||"",specialty:t.speakerRole||((r=t.expertise)==null?void 0:r[0])||"Speaker"}})}function AIe(e){const t=e.event;return!(t!=null&&t.startDate)||!(t!=null&&t.endDate)?"":`${new Date(t.startDate).toLocaleDateString()} – ${new Date(t.endDate).toLocaleDateString()}`}function QX(e){var f,h,p,v,m,b,x,w;const{content:t,event:r,sessions:n,speakers:o,templateName:a}=e,s=r,l=[...n].sort((k,j)=>new Date(k.startTime).getTime()-new Date(j.startTime).getTime()).map(k=>({time:_Ie(k.startTime),title:k.title,speaker:CIe(k)})),c=EIe(o),u=(h=(f=s==null?void 0:s.website)==null?void 0:f.registrationUrl)==null?void 0:h.trim(),d=u?`Register at: ${u}. Early bird and group rates may apply — see the registration page for details.`:s!=null&&s.joinCode?`Join the event hub with code ${s.joinCode} on EventBuzz. Conference materials and updates are shared with registered attendees.`:"Registration details will be published on the event website. Contact the organiser for group bookings and delegate passes.";return{templateName:a,coverTitle:((p=t.coverTitle)==null?void 0:p.trim())||(s==null?void 0:s.name)||a,coverSubtitle:((v=t.coverSubtitle)==null?void 0:v.trim())||(s==null?void 0:s.subtitle)||"",coverDate:((m=t.coverDate)==null?void 0:m.trim())||AIe(e)||"—",eventName:(s==null?void 0:s.name)||t.coverTitle||a,eventSubtitle:(s==null?void 0:s.subtitle)||t.coverSubtitle||"",description:((b=s==null?void 0:s.description)==null?void 0:b.trim())||"Add a description on the event record to show a full overview in this brochure.",venue:((x=s==null?void 0:s.location)==null?void 0:x.trim())||"Venue to be announced",venueNote:"Conveniently located with access from major transport links. See the event website for maps and parking.",virtualLink:((w=s==null?void 0:s.virtualLink)==null?void 0:w.trim())||"",expectedAttendees:"500+",sessionCount:n.length,speakerCount:o.length||c.length,logoEmoji:"🫁",agenda:l.length?l:[{time:"09:00 AM",title:"Registration & Welcome Coffee",speaker:""},{time:"10:00 AM",title:"Opening Session",speaker:""},{time:"12:30 PM",title:"Lunch",speaker:""}],speakers:c.length?c:[{name:"Featured speaker",title:"To be announced",specialty:"Programme"}],sponsors:kIe,registrationBlurb:d,contactEmail:"info@event.example",contactPhone:"—",website:u||(s!=null&&s.joinCode?`eventbuzz.live/code/${s.joinCode}`:"—"),sections:[...t.sections]}}const jr={cover:"Cover Page",about:"About the Event",agenda:"Agenda / Programme",speakers:"Speakers & Faculty",sponsors:"Sponsors & Partners",venue:"Venue & Directions",registration:"Registration Info",contact:"Contact Details"};function TIe(e){return{tpl1:"Classic",tpl2:"Modern",tpl3:"Bold",tpl4:"Minimal",tpl5:"Vibrant",tpl6:"Corporate"}[e]||"Brochure"}function XX({templateId:e,data:t}){return i.jsxs("div",{style:{width:"100%",maxWidth:680,margin:"0 auto",background:"#fff",boxSizing:"border-box"},children:[e==="tpl1"&&i.jsx(PIe,{data:t}),e==="tpl2"&&i.jsx(IIe,{data:t}),e==="tpl3"&&i.jsx(OIe,{data:t}),e==="tpl4"&&i.jsx(NIe,{data:t}),e==="tpl5"&&i.jsx(RIe,{data:t}),e==="tpl6"&&i.jsx(LIe,{data:t})]})}function PIe({data:e}){const t=n=>e.sections.includes(n),r=e;return i.jsxs("div",{style:{padding:"40px 50px",fontFamily:"Georgia, serif"},children:[t(jr.cover)&&i.jsx("div",{style:{borderWidth:2,borderStyle:"solid",borderColor:"#CBD5E1",padding:40,marginBottom:40,position:"relative"},children:i.jsxs("div",{style:{borderWidth:1,borderStyle:"solid",borderColor:"#CBD5E1",padding:30,textAlign:"center"},children:[i.jsx("div",{style:{fontSize:48,marginBottom:16},children:r.logoEmoji}),i.jsx("h1",{style:{fontFamily:"Georgia, serif",fontSize:36,fontWeight:700,color:"#1E293B",margin:"0 0 12px",lineHeight:1.2},children:r.coverTitle}),i.jsx("p",{style:{fontSize:18,color:"#64748B",margin:"0 0 24px",fontStyle:"italic"},children:r.coverSubtitle||r.eventSubtitle}),i.jsx("div",{style:{borderTop:"1px solid #CBD5E1",borderBottom:"1px solid #CBD5E1",padding:"16px 0",margin:"24px 0"},children:i.jsx("p",{style:{fontSize:16,color:"#475569",margin:0},children:r.coverDate})}),i.jsx("p",{style:{fontSize:14,color:"#94A3B8",margin:0},children:r.venue})]})}),t(jr.about)&&i.jsxs($p,{title:"About the Event",children:[i.jsx("p",{style:{fontSize:14,lineHeight:1.8,color:"#475569",margin:"0 0 16px"},children:r.description}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:16,marginTop:20},children:[i.jsx(qE,{icon:i.jsx(Ri,{size:20}),label:"Expected Attendees",value:r.expectedAttendees}),i.jsx(qE,{icon:i.jsx(Vi,{size:20}),label:"Sessions",value:String(r.sessionCount)}),i.jsx(qE,{icon:i.jsx(Ri,{size:20}),label:"Speakers",value:String(r.speakerCount)})]})]}),t(jr.agenda)&&i.jsx($p,{title:"Event Agenda",children:i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:r.agenda.map((n,o)=>i.jsxs("div",{style:{display:"flex",gap:16,padding:12,background:"#F8FAFC",borderLeft:"3px solid #0B4DD1"},children:[i.jsx("span",{style:{fontSize:13,fontWeight:700,color:"#0B4DD1",minWidth:70,fontFamily:"sans-serif"},children:n.time}),i.jsxs("div",{style:{flex:1},children:[i.jsx("p",{style:{fontSize:14,fontWeight:600,color:"#1E293B",margin:"0 0 2px"},children:n.title}),n.speaker?i.jsx("p",{style:{fontSize:12,color:"#64748B",margin:0},children:n.speaker}):null]})]},o))})}),t(jr.speakers)&&i.jsx($p,{title:"Featured Speakers",children:i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},children:r.speakers.map((n,o)=>i.jsxs("div",{style:{padding:16,border:"1px solid #E2E8F0",borderRadius:4},children:[i.jsx("h4",{style:{fontSize:15,fontWeight:700,color:"#1E293B",margin:"0 0 4px"},children:n.name}),i.jsx("p",{style:{fontSize:12,color:"#64748B",margin:"0 0 6px"},children:n.title}),i.jsx("p",{style:{fontSize:12,color:"#0B4DD1",margin:0,fontWeight:600},children:n.specialty})]},o))})}),t(jr.sponsors)&&i.jsx($p,{title:"Sponsors & Partners",children:r.sponsors.map((n,o)=>i.jsxs("div",{style:{padding:"12px 16px",background:"#F8FAFC",marginBottom:8,borderRadius:4,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i.jsx("span",{style:{fontSize:14,color:"#1E293B",fontWeight:600},children:n.name}),i.jsx("span",{style:{fontSize:11,color:"#fff",background:"#0B4DD1",padding:"3px 10px",borderRadius:12,fontWeight:700,textTransform:"uppercase"},children:n.tier})]},o))}),t(jr.venue)&&i.jsx($p,{title:"Venue & Directions",children:i.jsx("div",{style:{padding:16,background:"#F8FAFC",borderRadius:4},children:i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10,marginBottom:10},children:[i.jsx(Ab,{size:16,style:{color:"#0B4DD1",marginTop:2}}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:14,fontWeight:600,color:"#1E293B",margin:"0 0 4px"},children:r.venue}),r.virtualLink?i.jsxs("p",{style:{fontSize:13,color:"#64748B",margin:"0 0 8px"},children:["Virtual: ",r.virtualLink]}):null,i.jsx("p",{style:{fontSize:13,color:"#64748B",margin:0},children:r.venueNote})]})]})})}),t(jr.registration)&&i.jsx($p,{title:"Registration Information",children:i.jsx("p",{style:{fontSize:14,lineHeight:1.7,color:"#475569",margin:0},children:r.registrationBlurb})}),t(jr.contact)&&i.jsx($p,{title:"Contact Us",children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[i.jsx(_m,{icon:i.jsx(Xf,{size:16}),label:"Email",value:r.contactEmail}),i.jsx(_m,{icon:i.jsx(aS,{size:16}),label:"Phone",value:r.contactPhone}),i.jsx(_m,{icon:i.jsx(Wf,{size:16}),label:"Website",value:r.website})]})})]})}function IIe({data:e}){const t=n=>e.sections.includes(n),r=e;return i.jsxs("div",{style:{fontFamily:"sans-serif"},children:[t(jr.cover)&&i.jsxs("div",{style:{background:"linear-gradient(135deg, #0B4DD1 0%, #2563EB 100%)",padding:"60px 40px",color:"#fff",position:"relative"},children:[i.jsx("div",{style:{position:"absolute",top:30,right:40,width:80,height:80,borderRadius:"50%",background:"rgba(255,255,255,0.15)"}}),i.jsx("div",{style:{fontSize:56,marginBottom:20},children:r.logoEmoji}),i.jsx("h1",{style:{fontSize:42,fontWeight:700,margin:"0 0 12px",lineHeight:1.1,maxWidth:500},children:r.coverTitle}),i.jsx("p",{style:{fontSize:18,margin:"0 0 30px",opacity:.9},children:r.coverSubtitle||r.eventSubtitle}),i.jsx("div",{style:{display:"inline-block",background:"rgba(255,255,255,0.2)",padding:"12px 24px",borderRadius:4},children:i.jsx("p",{style:{fontSize:16,margin:0,fontWeight:600},children:r.coverDate})})]}),i.jsxs("div",{style:{padding:40},children:[t(jr.about)&&i.jsxs(Up,{title:"About the Conference",children:[i.jsx("p",{style:{fontSize:15,lineHeight:1.7,color:"#475569",margin:0},children:r.description}),i.jsx("div",{style:{display:"flex",gap:20,marginTop:24},children:[{label:"Attendees",value:r.expectedAttendees},{label:"Sessions",value:r.sessionCount},{label:"Speakers",value:r.speakerCount}].map((n,o)=>i.jsxs("div",{style:{flex:1,padding:20,background:"#E8EFFC",borderRadius:8,textAlign:"center"},children:[i.jsx("div",{style:{fontSize:32,fontWeight:700,color:"#0B4DD1",marginBottom:6},children:n.value}),i.jsx("div",{style:{fontSize:13,color:"#64748B",textTransform:"uppercase",letterSpacing:"0.5px"},children:n.label})]},o))})]}),t(jr.agenda)&&i.jsx(Up,{title:"Conference Agenda",children:i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:r.agenda.map((n,o)=>i.jsxs("div",{style:{display:"flex",gap:20,padding:16,background:"#F8FAFC",borderRadius:6,borderLeft:"4px solid #0B4DD1"},children:[i.jsx("div",{style:{minWidth:80},children:i.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#0B4DD1"},children:n.time})}),i.jsxs("div",{style:{flex:1},children:[i.jsx("div",{style:{fontSize:15,fontWeight:600,color:"#1E293B",marginBottom:4},children:n.title}),n.speaker?i.jsx("div",{style:{fontSize:13,color:"#64748B"},children:n.speaker}):null]})]},o))})}),t(jr.speakers)&&i.jsx(Up,{title:"Keynote Speakers",children:i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:20},children:r.speakers.map((n,o)=>i.jsxs("div",{style:{padding:20,border:"1px solid #E2E8F0",borderRadius:8,background:"#fff"},children:[i.jsx("div",{style:{width:50,height:50,borderRadius:"50%",background:"#E8EFFC",marginBottom:12}}),i.jsx("h4",{style:{fontSize:16,fontWeight:700,color:"#1E293B",margin:"0 0 6px"},children:n.name}),i.jsx("p",{style:{fontSize:13,color:"#64748B",margin:"0 0 8px"},children:n.title}),i.jsx("p",{style:{fontSize:12,color:"#0B4DD1",margin:0,fontWeight:600},children:n.specialty})]},o))})}),t(jr.sponsors)&&i.jsx(Up,{title:"Sponsors & Partners",children:r.sponsors.map((n,o)=>i.jsxs("div",{style:{padding:"14px 18px",background:"#F8FAFC",marginBottom:8,borderRadius:6,borderLeft:"4px solid #0B4DD1",display:"flex",justifyContent:"space-between"},children:[i.jsx("span",{style:{fontWeight:600,color:"#1E293B"},children:n.name}),i.jsx("span",{style:{fontSize:12,color:"#0B4DD1",fontWeight:700},children:n.tier})]},o))}),t(jr.venue)&&i.jsxs(Up,{title:"Venue",children:[i.jsx("p",{style:{color:"#475569",margin:0},children:r.venue}),r.virtualLink?i.jsx("p",{style:{color:"#64748B",margin:"8px 0 0"},children:r.virtualLink}):null]}),t(jr.registration)&&i.jsx(Up,{title:"Registration",children:i.jsx("p",{style:{color:"#475569",margin:0},children:r.registrationBlurb})}),t(jr.contact)?i.jsx(Up,{title:"Get in Touch",children:i.jsx("div",{style:{background:"#F8FAFC",padding:24,borderRadius:8},children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.jsx(_m,{icon:i.jsx(Xf,{size:16}),label:"Email",value:r.contactEmail}),i.jsx(_m,{icon:i.jsx(aS,{size:16}),label:"Phone",value:r.contactPhone}),i.jsx(_m,{icon:i.jsx(Wf,{size:16}),label:"Website",value:r.website})]})})}):null]})]})}function OIe({data:e}){const t=n=>e.sections.includes(n),r=e;return i.jsxs("div",{style:{background:"#1A1A2E",color:"#E2E8F0",fontFamily:"sans-serif"},children:[t(jr.cover)&&i.jsxs("div",{style:{background:"linear-gradient(135deg, #6D28D9 0%, #8B5CF6 100%)",padding:"60px 40px",position:"relative",overflow:"hidden"},children:[i.jsx("div",{style:{fontSize:64,marginBottom:24,filter:"drop-shadow(0 4px 8px rgba(0,0,0,0.3))"},children:r.logoEmoji}),i.jsx("h1",{style:{fontSize:48,fontWeight:900,margin:"0 0 16px",lineHeight:1,textTransform:"uppercase",letterSpacing:"-1px"},children:r.coverTitle}),i.jsx("p",{style:{fontSize:20,margin:"0 0 30px",color:"#C4B5FD"},children:r.coverSubtitle||r.eventSubtitle}),i.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:"rgba(255,255,255,0.15)",padding:"12px 20px",borderRadius:6},children:[i.jsx(Vi,{size:18}),i.jsx("span",{style:{fontSize:16,fontWeight:700},children:r.coverDate})]})]}),i.jsxs("div",{style:{padding:40},children:[t(jr.about)&&i.jsx(Hp,{title:"About",children:i.jsx("p",{style:{fontSize:15,lineHeight:1.8,color:"#CBD5E1",margin:0},children:r.description})}),t(jr.agenda)&&i.jsx(Hp,{title:"Schedule",children:r.agenda.map((n,o)=>i.jsx("div",{style:{background:"#312E81",padding:"16px 20px",marginBottom:10,borderRadius:4,borderLeft:"4px solid #A78BFA"},children:i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:16},children:[i.jsxs("div",{style:{flex:1},children:[i.jsx("div",{style:{fontSize:15,fontWeight:700,color:"#fff",marginBottom:4},children:n.title}),n.speaker?i.jsx("div",{style:{fontSize:13,color:"#A78BFA"},children:n.speaker}):null]}),i.jsx("div",{style:{fontSize:13,fontWeight:700,color:"#C4B5FD",minWidth:70,textAlign:"right"},children:n.time})]})},o))}),t(jr.speakers)&&i.jsx(Hp,{title:"Speakers",children:i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},children:r.speakers.map((n,o)=>i.jsxs("div",{style:{background:"#312E81",padding:20,borderRadius:6},children:[i.jsx("h4",{style:{fontSize:16,fontWeight:700,color:"#fff",margin:"0 0 8px"},children:n.name}),i.jsx("p",{style:{fontSize:13,color:"#A78BFA",margin:"0 0 6px"},children:n.title}),i.jsx("p",{style:{fontSize:12,color:"#C4B5FD",margin:0},children:n.specialty})]},o))})}),t(jr.sponsors)&&i.jsx(Hp,{title:"Sponsors",children:r.sponsors.map((n,o)=>i.jsxs("div",{style:{background:"#312E81",padding:16,marginBottom:8,borderRadius:4,display:"flex",justifyContent:"space-between"},children:[i.jsx("span",{style:{fontWeight:700},children:n.name}),i.jsx("span",{style:{color:"#A78BFA",fontSize:12},children:n.tier})]},o))}),t(jr.venue)&&i.jsx(Hp,{title:"Venue",children:i.jsx("p",{style:{color:"#CBD5E1",margin:0},children:r.venue})}),t(jr.registration)&&i.jsx(Hp,{title:"Registration",children:i.jsx("p",{style:{color:"#CBD5E1",margin:0},children:r.registrationBlurb})}),t(jr.contact)&&i.jsx(Hp,{title:"Contact",children:i.jsx("div",{style:{background:"#312E81",padding:20,borderRadius:6},children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(Xf,{size:16,style:{color:"#A78BFA"}}),i.jsx("span",{style:{fontSize:14,color:"#E2E8F0"},children:r.contactEmail})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx(Wf,{size:16,style:{color:"#A78BFA"}}),i.jsx("span",{style:{fontSize:14,color:"#E2E8F0"},children:r.website})]})]})})})]})]})}function NIe({data:e}){const t=n=>e.sections.includes(n),r=e;return i.jsxs("div",{style:{padding:60,fontFamily:"sans-serif",color:"#0F172A"},children:[t(jr.cover)&&i.jsxs("div",{style:{textAlign:"center",marginBottom:60},children:[i.jsx("h1",{style:{fontSize:40,fontWeight:300,margin:"0 0 16px",letterSpacing:"-0.5px"},children:r.coverTitle}),i.jsx("p",{style:{fontSize:16,color:"#94A3B8",margin:"0 0 8px"},children:r.coverSubtitle||r.eventSubtitle}),i.jsx("p",{style:{fontSize:14,color:"#CBD5E1"},children:r.coverDate})]}),t(jr.about)&&i.jsx(Vp,{title:"About",children:r.description}),t(jr.agenda)&&i.jsx(Vp,{title:"Agenda",children:r.agenda.map((n,o)=>i.jsxs("div",{style:{marginBottom:10},children:[i.jsx("div",{style:{fontSize:13,fontWeight:600},children:n.time}),i.jsxs("div",{style:{fontSize:14,color:"#475569"},children:[n.title,n.speaker?` · ${n.speaker}`:""]})]},o))}),t(jr.speakers)&&i.jsx(Vp,{title:"Speakers",children:r.speakers.map((n,o)=>i.jsxs("div",{style:{marginBottom:12},children:[i.jsx("div",{style:{fontSize:15,fontWeight:600,color:"#0F172A"},children:n.name}),i.jsxs("div",{style:{fontSize:13,color:"#64748B"},children:[n.title," • ",n.specialty]})]},o))}),t(jr.sponsors)&&i.jsx(Vp,{title:"Sponsors",children:r.sponsors.map((n,o)=>i.jsxs("div",{style:{marginBottom:8,fontSize:14},children:[n.name," ",i.jsxs("span",{style:{color:"#94A3B8"},children:["(",n.tier,")"]})]},o))}),t(jr.venue)&&i.jsx(Vp,{title:"Venue",children:r.venue}),t(jr.registration)&&i.jsx(Vp,{title:"Registration",children:r.registrationBlurb}),t(jr.contact)&&i.jsx(Vp,{title:"Contact",children:i.jsxs("div",{style:{fontSize:14,color:"#475569"},children:[r.contactEmail," • ",r.website]})})]})}function RIe({data:e}){const t=n=>e.sections.includes(n),r=e;return i.jsxs("div",{style:{background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",color:"#fff",fontFamily:"sans-serif"},children:[t(jr.cover)&&i.jsxs("div",{style:{padding:"60px 40px",position:"relative"},children:[i.jsx("div",{style:{position:"absolute",top:40,right:60,width:120,height:120,borderRadius:"50%",background:"rgba(255,255,255,0.2)"}}),i.jsx("h1",{style:{fontSize:48,fontWeight:800,margin:"0 0 16px"},children:r.coverTitle}),i.jsx("p",{style:{fontSize:20,margin:"0 0 30px",opacity:.9},children:r.coverSubtitle||r.eventSubtitle}),i.jsx("p",{style:{fontSize:16,fontWeight:600},children:r.coverDate})]}),i.jsxs("div",{style:{background:"#fff",color:"#1E293B",padding:40},children:[t(jr.about)&&i.jsx(Yp,{title:"About",children:r.description}),t(jr.agenda)&&i.jsx(Yp,{title:"Agenda",children:r.agenda.map((n,o)=>i.jsxs("div",{style:{padding:12,background:"#F0F9FF",marginBottom:8,borderRadius:6},children:[i.jsx("div",{style:{fontWeight:700,fontSize:13,color:"#0369A1"},children:n.time}),i.jsx("div",{style:{fontWeight:600},children:n.title}),n.speaker?i.jsx("div",{style:{fontSize:13,color:"#64748B"},children:n.speaker}):null]},o))}),t(jr.speakers)&&i.jsx(Yp,{title:"Speakers",children:r.speakers.map((n,o)=>i.jsxs("div",{style:{padding:16,background:"#F0FDF4",marginBottom:8,borderRadius:6},children:[i.jsx("div",{style:{fontWeight:700,fontSize:15},children:n.name}),i.jsx("div",{style:{fontSize:13,color:"#64748B"},children:n.specialty})]},o))}),t(jr.sponsors)&&i.jsx(Yp,{title:"Sponsors",children:r.sponsors.map((n,o)=>i.jsxs("div",{style:{marginBottom:8,fontSize:14},children:[i.jsx("strong",{children:n.name})," — ",n.tier]},o))}),t(jr.venue)&&i.jsx(Yp,{title:"Venue",children:r.venue}),t(jr.registration)&&i.jsx(Yp,{title:"Registration",children:r.registrationBlurb}),t(jr.contact)&&i.jsxs(Yp,{title:"Contact",children:[r.contactEmail," • ",r.website]})]})]})}function LIe({data:e}){const t=n=>e.sections.includes(n),r=e;return i.jsxs("div",{style:{background:"#1E3A5F",color:"#E2E8F0",fontFamily:"sans-serif"},children:[t(jr.cover)&&i.jsx("div",{style:{borderTop:"4px solid #D4AF37",borderBottom:"4px solid #D4AF37",padding:"50px 40px",background:"#1E3A5F"},children:i.jsxs("div",{style:{textAlign:"center"},children:[i.jsx("div",{style:{fontSize:56,marginBottom:20},children:r.logoEmoji}),i.jsx("h1",{style:{fontSize:40,fontWeight:700,margin:"0 0 16px",color:"#fff"},children:r.coverTitle}),i.jsx("p",{style:{fontSize:18,color:"#94A3B8",margin:"0 0 24px"},children:r.coverSubtitle||r.eventSubtitle}),i.jsx("div",{style:{borderTop:"1px solid #D4AF37",borderBottom:"1px solid #D4AF37",padding:"12px 0",display:"inline-block"},children:i.jsx("p",{style:{fontSize:16,margin:0},children:r.coverDate})})]})}),i.jsxs("div",{style:{padding:40},children:[t(jr.about)&&i.jsx(Gp,{title:"About",children:r.description}),t(jr.agenda)&&i.jsx(Gp,{title:"Programme",children:r.agenda.map((n,o)=>i.jsxs("div",{style:{padding:14,background:"#334155",marginBottom:8,borderRadius:4,borderLeft:"3px solid #D4AF37"},children:[i.jsx("div",{style:{fontSize:12,color:"#D4AF37",fontWeight:700},children:n.time}),i.jsx("div",{style:{fontWeight:600,color:"#fff"},children:n.title}),n.speaker?i.jsx("div",{style:{fontSize:13,color:"#94A3B8"},children:n.speaker}):null]},o))}),t(jr.speakers)&&i.jsx(Gp,{title:"Distinguished Speakers",children:r.speakers.map((n,o)=>i.jsxs("div",{style:{padding:16,background:"#334155",marginBottom:10,borderRadius:4,border:"1px solid #D4AF37"},children:[i.jsx("div",{style:{fontWeight:700,fontSize:15,color:"#fff"},children:n.name}),i.jsx("div",{style:{fontSize:13,color:"#94A3B8"},children:n.title})]},o))}),t(jr.sponsors)&&i.jsx(Gp,{title:"Partners",children:r.sponsors.map((n,o)=>i.jsxs("div",{style:{padding:12,background:"#334155",marginBottom:8,borderRadius:4},children:[n.name," — ",i.jsx("span",{style:{color:"#D4AF37"},children:n.tier})]},o))}),t(jr.venue)&&i.jsx(Gp,{title:"Venue",children:r.venue}),t(jr.registration)&&i.jsx(Gp,{title:"Registration",children:r.registrationBlurb}),t(jr.contact)&&i.jsx(Gp,{title:"Contact Information",children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,fontSize:14},children:[i.jsx("div",{children:r.contactEmail}),i.jsx("div",{children:r.website})]})})]}),i.jsxs("div",{style:{borderTop:"4px solid #D4AF37",padding:"20px 40px",textAlign:"center",fontSize:12,color:"#64748B"},children:["© ",new Date().getFullYear()," ",r.eventName,". All rights reserved."]})]})}function $p({title:e,children:t}){return i.jsxs("div",{style:{marginBottom:32},children:[i.jsx("h2",{style:{fontSize:22,fontWeight:700,color:"#1E293B",margin:"0 0 16px",borderBottom:"2px solid #CBD5E1",paddingBottom:8},children:e}),t]})}function Up({title:e,children:t}){return i.jsxs("div",{style:{marginBottom:40},children:[i.jsxs("h2",{style:{fontSize:24,fontWeight:700,color:"#0B4DD1",margin:"0 0 20px",position:"relative",paddingLeft:16},children:[i.jsx("div",{style:{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",width:4,height:24,background:"#0B4DD1",borderRadius:2}}),e]}),t]})}function Hp({title:e,children:t}){return i.jsxs("div",{style:{marginBottom:36},children:[i.jsx("h2",{style:{fontSize:26,fontWeight:900,color:"#A78BFA",margin:"0 0 20px",textTransform:"uppercase",letterSpacing:"1px"},children:e}),t]})}function Vp({title:e,children:t}){return i.jsxs("div",{style:{marginBottom:48},children:[i.jsx("h2",{style:{fontSize:18,fontWeight:600,color:"#0F172A",margin:"0 0 20px",letterSpacing:"0.5px"},children:e}),i.jsx("div",{style:{fontSize:14,lineHeight:1.8,color:"#475569"},children:t})]})}function Yp({title:e,children:t}){return i.jsxs("div",{style:{marginBottom:32},children:[i.jsx("h2",{style:{fontSize:24,fontWeight:800,color:"#10B981",margin:"0 0 16px"},children:e}),i.jsx("div",{style:{fontSize:14,lineHeight:1.7,color:"#475569"},children:t})]})}function Gp({title:e,children:t}){return i.jsxs("div",{style:{marginBottom:36},children:[i.jsx("h2",{style:{fontSize:22,fontWeight:700,color:"#D4AF37",margin:"0 0 16px",borderBottom:"2px solid #D4AF37",paddingBottom:8},children:e}),t]})}function qE({icon:e,label:t,value:r}){return i.jsxs("div",{style:{padding:16,background:"#F8FAFC",borderRadius:4,textAlign:"center",border:"1px solid #E2E8F0"},children:[i.jsx("div",{style:{color:"#0B4DD1",marginBottom:8,display:"flex",justifyContent:"center"},children:e}),i.jsx("div",{style:{fontSize:20,fontWeight:700,color:"#1E293B",marginBottom:4},children:r}),i.jsx("div",{style:{fontSize:11,color:"#64748B",textTransform:"uppercase",letterSpacing:"0.5px"},children:t})]})}function _m({icon:e,label:t,value:r}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i.jsx("div",{style:{color:"#0B4DD1"},children:e}),i.jsxs("div",{children:[i.jsx("div",{style:{fontSize:11,color:"#94A3B8",textTransform:"uppercase",letterSpacing:"0.5px"},children:t}),i.jsx("div",{style:{fontSize:14,color:"#1E293B",fontWeight:500},children:r})]})]})}const FIe="modulepreload",zIe=function(e){return"/"+e},dW={},$E=function(t,r,n){let o=Promise.resolve();if(r&&r.length>0){let s=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=s(r.map(u=>{if(u=zIe(u),u in dW)return;dW[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":FIe,d||(h.as="script"),h.crossOrigin="",h.href=u,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((p,v)=>{h.addEventListener("load",p),h.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return o.then(s=>{for(const l of s||[])l.status==="rejected"&&a(l.reason);return t().catch(a)})};function On(e){"@babel/helpers - typeof";return On=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},On(e)}var xc=Uint8Array,Ys=Uint16Array,cI=Int32Array,uI=new xc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),dI=new xc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),fW=new xc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ZX=function(e,t){for(var r=new Ys(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new cI(r[30]),n=1;n<30;++n)for(var a=r[n];a<r[n+1];++a)o[a]=a-r[n]<<5|n;return{b:r,r:o}},JX=ZX(uI,2),MIe=JX.b,$6=JX.r;MIe[28]=258,$6[258]=28;var DIe=ZX(dI,0),pW=DIe.r,U6=new Ys(32768);for(var si=0;si<32768;++si){var wf=(si&43690)>>1|(si&21845)<<1;wf=(wf&52428)>>2|(wf&13107)<<2,wf=(wf&61680)>>4|(wf&3855)<<4,U6[si]=((wf&65280)>>8|(wf&255)<<8)>>1}var vx=(function(e,t,r){for(var n=e.length,o=0,a=new Ys(t);o<n;++o)e[o]&&++a[e[o]-1];var s=new Ys(t);for(o=1;o<t;++o)s[o]=s[o-1]+a[o-1]<<1;var l;if(r){l=new Ys(1<<t);var c=15-t;for(o=0;o<n;++o)if(e[o])for(var u=o<<4|e[o],d=t-e[o],f=s[e[o]-1]++<<d,h=f|(1<<d)-1;f<=h;++f)l[U6[f]>>c]=u}else for(l=new Ys(n),o=0;o<n;++o)e[o]&&(l[o]=U6[s[e[o]-1]++]>>15-e[o]);return l}),Mh=new xc(288);for(var si=0;si<144;++si)Mh[si]=8;for(var si=144;si<256;++si)Mh[si]=9;for(var si=256;si<280;++si)Mh[si]=7;for(var si=280;si<288;++si)Mh[si]=8;var Uw=new xc(32);for(var si=0;si<32;++si)Uw[si]=5;var BIe=vx(Mh,9,0),WIe=vx(Uw,5,0),eZ=function(e){return(e+7)/8|0},qIe=function(e,t,r){return(r==null||r>e.length)&&(r=e.length),new xc(e.subarray(t,r))},Qu=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},Yy=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},UE=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var o=r.length,a=r.slice();if(!o)return{t:rZ,l:0};if(o==1){var s=new xc(r[0].s+1);return s[r[0].s]=1,{t:s,l:1}}r.sort(function(_,T){return _.f-T.f}),r.push({s:-1,f:25001});var l=r[0],c=r[1],u=0,d=1,f=2;for(r[0]={s:-1,f:l.f+c.f,l,r:c};d!=o-1;)l=r[r[u].f<r[f].f?u++:f++],c=r[u!=d&&r[u].f<r[f].f?u++:f++],r[d++]={s:-1,f:l.f+c.f,l,r:c};for(var h=a[0].s,n=1;n<o;++n)a[n].s>h&&(h=a[n].s);var p=new Ys(h+1),v=H6(r[d-1],p,0);if(v>t){var n=0,m=0,b=v-t,x=1<<b;for(a.sort(function(T,A){return p[A.s]-p[T.s]||T.f-A.f});n<o;++n){var w=a[n].s;if(p[w]>t)m+=x-(1<<v-p[w]),p[w]=t;else break}for(m>>=b;m>0;){var k=a[n].s;p[k]<t?m-=1<<t-p[k]++-1:++n}for(;n>=0&&m;--n){var j=a[n].s;p[j]==t&&(--p[j],++m)}v=t}return{t:new xc(p),l:v}},H6=function(e,t,r){return e.s==-1?Math.max(H6(e.l,t,r+1),H6(e.r,t,r+1)):t[e.s]=r},hW=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Ys(++t),n=0,o=e[0],a=1,s=function(c){r[n++]=c},l=1;l<=t;++l)if(e[l]==o&&l!=t)++a;else{if(!o&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(o),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(o);a=1,o=e[l]}return{c:r.subarray(0,n),n:t}},Gy=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},tZ=function(e,t,r){var n=r.length,o=eZ(t+2);e[o]=n&255,e[o+1]=n>>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var a=0;a<n;++a)e[o+a+4]=r[a];return(o+4+n)*8},gW=function(e,t,r,n,o,a,s,l,c,u,d){Qu(t,d++,r),++o[256];for(var f=UE(o,15),h=f.t,p=f.l,v=UE(a,15),m=v.t,b=v.l,x=hW(h),w=x.c,k=x.n,j=hW(m),_=j.c,T=j.n,A=new Ys(19),P=0;P<w.length;++P)++A[w[P]&31];for(var P=0;P<_.length;++P)++A[_[P]&31];for(var N=UE(A,7),O=N.t,C=N.l,I=19;I>4&&!O[fW[I-1]];--I);var R=u+5<<3,F=Gy(o,Mh)+Gy(a,Uw)+s,M=Gy(o,h)+Gy(a,m)+s+14+3*I+Gy(A,O)+2*A[16]+3*A[17]+7*A[18];if(c>=0&&R<=F&&R<=M)return tZ(t,d,e.subarray(c,c+u));var Y,X,$,ee;if(Qu(t,d,1+(M<F)),d+=2,M<F){Y=vx(h,p,0),X=h,$=vx(m,b,0),ee=m;var V=vx(O,C,0);Qu(t,d,k-257),Qu(t,d+5,T-1),Qu(t,d+10,I-4),d+=14;for(var P=0;P<I;++P)Qu(t,d+3*P,O[fW[P]]);d+=3*I;for(var D=[w,_],z=0;z<2;++z)for(var q=D[z],P=0;P<q.length;++P){var G=q[P]&31;Qu(t,d,V[G]),d+=O[G],G>15&&(Qu(t,d,q[P]>>5&127),d+=q[P]>>12)}}else Y=BIe,X=Mh,$=WIe,ee=Uw;for(var P=0;P<l;++P){var U=n[P];if(U>255){var G=U>>18&31;Yy(t,d,Y[G+257]),d+=X[G+257],G>7&&(Qu(t,d,U>>23&31),d+=uI[G]);var Q=U&31;Yy(t,d,$[Q]),d+=ee[Q],Q>3&&(Yy(t,d,U>>5&8191),d+=dI[Q])}else Yy(t,d,Y[U]),d+=X[U]}return Yy(t,d,Y[256]),d+X[256]},$Ie=new cI([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rZ=new xc(0),UIe=function(e,t,r,n,o,a){var s=a.z||e.length,l=new xc(n+s+5*(1+Math.ceil(s/7e3))+o),c=l.subarray(n,l.length-o),u=a.l,d=(a.r||0)&7;if(t){d&&(c[0]=a.r>>3);for(var f=$Ie[t-1],h=f>>13,p=f&8191,v=(1<<r)-1,m=a.p||new Ys(32768),b=a.h||new Ys(v+1),x=Math.ceil(r/3),w=2*x,k=function(ve){return(e[ve]^e[ve+1]<<x^e[ve+2]<<w)&v},j=new cI(25e3),_=new Ys(288),T=new Ys(32),A=0,P=0,N=a.i||0,O=0,C=a.w||0,I=0;N+2<s;++N){var R=k(N),F=N&32767,M=b[R];if(m[F]=M,b[R]=F,C<=N){var Y=s-N;if((A>7e3||O>24576)&&(Y>423||!u)){d=gW(e,c,0,j,_,T,P,O,I,N-I,d),O=A=P=0,I=N;for(var X=0;X<286;++X)_[X]=0;for(var X=0;X<30;++X)T[X]=0}var $=2,ee=0,V=p,D=F-M&32767;if(Y>2&&R==k(N-D))for(var z=Math.min(h,Y)-1,q=Math.min(32767,N),G=Math.min(258,Y);D<=q&&--V&&F!=M;){if(e[N+$]==e[N+$-D]){for(var U=0;U<G&&e[N+U]==e[N+U-D];++U);if(U>$){if($=U,ee=D,U>z)break;for(var Q=Math.min(D,U-2),K=0,X=0;X<Q;++X){var re=N-D+X&32767,H=m[re],ie=re-H&32767;ie>K&&(K=ie,M=re)}}}F=M,M=m[F],D+=F-M&32767}if(ee){j[O++]=268435456|$6[$]<<18|pW[ee];var de=$6[$]&31,le=pW[ee]&31;P+=uI[de]+dI[le],++_[257+de],++T[le],C=N+$,++A}else j[O++]=e[N],++_[e[N]]}}for(N=Math.max(N,C);N<s;++N)j[O++]=e[N],++_[e[N]];d=gW(e,c,u,j,_,T,P,O,I,N-I,d),u||(a.r=d&7|c[d/8|0]<<3,d-=7,a.h=b,a.p=m,a.i=N,a.w=C)}else{for(var N=a.w||0;N<s+u;N+=65535){var ke=N+65535;ke>=s&&(c[d/8|0]=u,ke=s),d=tZ(c,d+1,e.subarray(N,ke))}a.i=s}return qIe(l,0,n+eZ(d)+o)},nZ=function(){var e=1,t=0;return{p:function(r){for(var n=e,o=t,a=r.length|0,s=0;s!=a;){for(var l=Math.min(s+2655,a);s<l;++s)o+=n+=r[s];n=(n&65535)+15*(n>>16),o=(o&65535)+15*(o>>16)}e=n,t=o},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},HIe=function(e,t,r,n,o){if(!o&&(o={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),s=new xc(a.length+e.length);s.set(a),s.set(e,a.length),e=s,o.w=a.length}return UIe(e,t.level==null?6:t.level,t.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,o)},iZ=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},VIe=function(e,t){var r=t.level,n=r==0?0:r<6?1:r==9?3:2;if(e[0]=120,e[1]=n<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var o=nZ();o.p(t.dictionary),iZ(e,2,o.d())}};function V6(e,t){t||(t={});var r=nZ();r.p(e);var n=HIe(e,t,t.dictionary?6:2,4);return VIe(n,t),iZ(n,n.length-4,r.d()),n}var YIe=typeof TextDecoder<"u"&&new TextDecoder,GIe=0;try{YIe.decode(rZ,{stream:!0}),GIe=1}catch{}function KIe(e){if(Array.isArray(e))return e}function QIe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,s,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,o=d}finally{try{if(!c&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function mW(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function XIe(e,t){if(e){if(typeof e=="string")return mW(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mW(e,t):void 0}}function ZIe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vW(e,t){return KIe(e)||QIe(e,t)||XIe(e,t)||ZIe()}function yW(e,t="utf8"){return new TextDecoder(t).decode(e)}const JIe=new TextEncoder;function eOe(e){return JIe.encode(e)}const tOe=1024*8,rOe=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),HE={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class fI{constructor(t=tOe,r={}){yn(this,"buffer");yn(this,"byteLength");yn(this,"byteOffset");yn(this,"length");yn(this,"offset");yn(this,"lastWrittenByte");yn(this,"littleEndian");yn(this,"_data");yn(this,"_mark");yn(this,"_marks");let n=!1;typeof t=="number"?t=new ArrayBuffer(t):(n=!0,this.lastWrittenByte=t.byteLength);const o=r.offset?r.offset>>>0:0,a=t.byteLength-o;let s=o;(ArrayBuffer.isView(t)||t instanceof fI)&&(t.byteLength!==t.buffer.byteLength&&(s=t.byteOffset+o),t=t.buffer),n?this.lastWrittenByte=a:this.lastWrittenByte=0,this.buffer=t,this.length=a,this.byteLength=a,this.byteOffset=s,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,s,a),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(t===void 0)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const n=(this.offset+t)*2,o=new Uint8Array(n);o.set(new Uint8Array(this.buffer)),this.buffer=o.buffer,this.length=n,this.byteLength=n,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,r){const n=HE[r].BYTES_PER_ELEMENT*t,o=this.byteOffset+this.offset,a=this.buffer.slice(o,o+n);if(this.littleEndian===rOe&&r!=="uint8"&&r!=="int8"){const l=new Uint8Array(this.buffer.slice(o,o+n));l.reverse();const c=new HE[r](l.buffer);return this.offset+=n,c.reverse(),c}const s=new HE[r](a);return this.offset+=n,s}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let r="";for(let n=0;n<t;n++)r+=this.readChar();return r}readUtf8(t=1){return yW(this.readBytes(t))}decodeText(t=1,r="utf8"){return yW(this.readBytes(t),r)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let r=0;r<t.length;r++)this._data.setUint8(this.offset++,t[r]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let r=0;r<t.length;r++)this.writeUint8(t.charCodeAt(r));return this}writeUtf8(t){return this.writeBytes(eOe(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function Dv(e){let t=e.length;for(;--t>=0;)e[t]=0}const nOe=3,iOe=258,oZ=29,oOe=256,aOe=oOe+1+oZ,aZ=30,sOe=512,lOe=new Array((aOe+2)*2);Dv(lOe);const cOe=new Array(aZ*2);Dv(cOe);const uOe=new Array(sOe);Dv(uOe);const dOe=new Array(iOe-nOe+1);Dv(dOe);const fOe=new Array(oZ);Dv(fOe);const pOe=new Array(aZ);Dv(pOe);const hOe=(e,t,r,n)=>{let o=e&65535|0,a=e>>>16&65535|0,s=0;for(;r!==0;){s=r>2e3?2e3:r,r-=s;do o=o+t[n++]|0,a=a+o|0;while(--s);o%=65521,a%=65521}return o|a<<16|0};var Y6=hOe;const gOe=()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t},mOe=new Uint32Array(gOe()),vOe=(e,t,r,n)=>{const o=mOe,a=n+r;e^=-1;for(let s=n;s<a;s++)e=e>>>8^o[(e^t[s])&255];return e^-1};var Uc=vOe,G6={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},sZ={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const yOe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var xOe=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(const n in r)yOe(r,n)&&(e[n]=r[n])}}return e},bOe=e=>{let t=0;for(let n=0,o=e.length;n<o;n++)t+=e[n].length;const r=new Uint8Array(t);for(let n=0,o=0,a=e.length;n<a;n++){let s=e[n];r.set(s,o),o+=s.length}return r},lZ={assign:xOe,flattenChunks:bOe};let cZ=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{cZ=!1}const Sb=new Uint8Array(256);for(let e=0;e<256;e++)Sb[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Sb[254]=Sb[254]=1;var wOe=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,r,n,o,a,s=e.length,l=0;for(o=0;o<s;o++)r=e.charCodeAt(o),(r&64512)===55296&&o+1<s&&(n=e.charCodeAt(o+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),o++)),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(l),a=0,o=0;a<l;o++)r=e.charCodeAt(o),(r&64512)===55296&&o+1<s&&(n=e.charCodeAt(o+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),o++)),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};const SOe=(e,t)=>{if(t<65534&&e.subarray&&cZ)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r};var jOe=(e,t)=>{const r=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let n,o;const a=new Array(r*2);for(o=0,n=0;n<r;){let s=e[n++];if(s<128){a[o++]=s;continue}let l=Sb[s];if(l>4){a[o++]=65533,n+=l-1;continue}for(s&=l===2?31:l===3?15:7;l>1&&n<r;)s=s<<6|e[n++]&63,l--;if(l>1){a[o++]=65533;continue}s<65536?a[o++]=s:(s-=65536,a[o++]=55296|s>>10&1023,a[o++]=56320|s&1023)}return SOe(a,o)},kOe=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let r=t-1;for(;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Sb[e[r]]>t?r:t},K6={string2buf:wOe,buf2string:jOe,utf8border:kOe};function _Oe(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var COe=_Oe;const _1=16209,EOe=16191;var AOe=function(t,r){let n,o,a,s,l,c,u,d,f,h,p,v,m,b,x,w,k,j,_,T,A,P,N,O;const C=t.state;n=t.next_in,N=t.input,o=n+(t.avail_in-5),a=t.next_out,O=t.output,s=a-(r-t.avail_out),l=a+(t.avail_out-257),c=C.dmax,u=C.wsize,d=C.whave,f=C.wnext,h=C.window,p=C.hold,v=C.bits,m=C.lencode,b=C.distcode,x=(1<<C.lenbits)-1,w=(1<<C.distbits)-1;e:do{v<15&&(p+=N[n++]<<v,v+=8,p+=N[n++]<<v,v+=8),k=m[p&x];t:for(;;){if(j=k>>>24,p>>>=j,v-=j,j=k>>>16&255,j===0)O[a++]=k&65535;else if(j&16){_=k&65535,j&=15,j&&(v<j&&(p+=N[n++]<<v,v+=8),_+=p&(1<<j)-1,p>>>=j,v-=j),v<15&&(p+=N[n++]<<v,v+=8,p+=N[n++]<<v,v+=8),k=b[p&w];r:for(;;){if(j=k>>>24,p>>>=j,v-=j,j=k>>>16&255,j&16){if(T=k&65535,j&=15,v<j&&(p+=N[n++]<<v,v+=8,v<j&&(p+=N[n++]<<v,v+=8)),T+=p&(1<<j)-1,T>c){t.msg="invalid distance too far back",C.mode=_1;break e}if(p>>>=j,v-=j,j=a-s,T>j){if(j=T-j,j>d&&C.sane){t.msg="invalid distance too far back",C.mode=_1;break e}if(A=0,P=h,f===0){if(A+=u-j,j<_){_-=j;do O[a++]=h[A++];while(--j);A=a-T,P=O}}else if(f<j){if(A+=u+f-j,j-=f,j<_){_-=j;do O[a++]=h[A++];while(--j);if(A=0,f<_){j=f,_-=j;do O[a++]=h[A++];while(--j);A=a-T,P=O}}}else if(A+=f-j,j<_){_-=j;do O[a++]=h[A++];while(--j);A=a-T,P=O}for(;_>2;)O[a++]=P[A++],O[a++]=P[A++],O[a++]=P[A++],_-=3;_&&(O[a++]=P[A++],_>1&&(O[a++]=P[A++]))}else{A=a-T;do O[a++]=O[A++],O[a++]=O[A++],O[a++]=O[A++],_-=3;while(_>2);_&&(O[a++]=O[A++],_>1&&(O[a++]=O[A++]))}}else if((j&64)===0){k=b[(k&65535)+(p&(1<<j)-1)];continue r}else{t.msg="invalid distance code",C.mode=_1;break e}break}}else if((j&64)===0){k=m[(k&65535)+(p&(1<<j)-1)];continue t}else if(j&32){C.mode=EOe;break e}else{t.msg="invalid literal/length code",C.mode=_1;break e}break}}while(n<o&&a<l);_=v>>3,n-=_,v-=_<<3,p&=(1<<v)-1,t.next_in=n,t.next_out=a,t.avail_in=n<o?5+(o-n):5-(n-o),t.avail_out=a<l?257+(l-a):257-(a-l),C.hold=p,C.bits=v};const Vg=15,xW=852,bW=592,wW=0,VE=1,SW=2,TOe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),POe=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),IOe=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),OOe=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),NOe=(e,t,r,n,o,a,s,l)=>{const c=l.bits;let u=0,d=0,f=0,h=0,p=0,v=0,m=0,b=0,x=0,w=0,k,j,_,T,A,P=null,N;const O=new Uint16Array(Vg+1),C=new Uint16Array(Vg+1);let I=null,R,F,M;for(u=0;u<=Vg;u++)O[u]=0;for(d=0;d<n;d++)O[t[r+d]]++;for(p=c,h=Vg;h>=1&&O[h]===0;h--);if(p>h&&(p=h),h===0)return o[a++]=1<<24|64<<16|0,o[a++]=1<<24|64<<16|0,l.bits=1,0;for(f=1;f<h&&O[f]===0;f++);for(p<f&&(p=f),b=1,u=1;u<=Vg;u++)if(b<<=1,b-=O[u],b<0)return-1;if(b>0&&(e===wW||h!==1))return-1;for(C[1]=0,u=1;u<Vg;u++)C[u+1]=C[u]+O[u];for(d=0;d<n;d++)t[r+d]!==0&&(s[C[t[r+d]]++]=d);if(e===wW?(P=I=s,N=20):e===VE?(P=TOe,I=POe,N=257):(P=IOe,I=OOe,N=0),w=0,d=0,u=f,A=a,v=p,m=0,_=-1,x=1<<p,T=x-1,e===VE&&x>xW||e===SW&&x>bW)return 1;for(;;){R=u-m,s[d]+1<N?(F=0,M=s[d]):s[d]>=N?(F=I[s[d]-N],M=P[s[d]-N]):(F=96,M=0),k=1<<u-m,j=1<<v,f=j;do j-=k,o[A+(w>>m)+j]=R<<24|F<<16|M|0;while(j!==0);for(k=1<<u-1;w&k;)k>>=1;if(k!==0?(w&=k-1,w+=k):w=0,d++,--O[u]===0){if(u===h)break;u=t[r+s[d]]}if(u>p&&(w&T)!==_){for(m===0&&(m=p),A+=f,v=u-m,b=1<<v;v+m<h&&(b-=O[v+m],!(b<=0));)v++,b<<=1;if(x+=1<<v,e===VE&&x>xW||e===SW&&x>bW)return 1;_=w&T,o[_]=p<<24|v<<16|A-a|0}}return w!==0&&(o[A+w]=u-m<<24|64<<16|0),l.bits=p,0};var yx=NOe;const ROe=0,uZ=1,dZ=2,{Z_FINISH:jW,Z_BLOCK:LOe,Z_TREES:C1,Z_OK:Dh,Z_STREAM_END:FOe,Z_NEED_DICT:zOe,Z_STREAM_ERROR:Ll,Z_DATA_ERROR:fZ,Z_MEM_ERROR:pZ,Z_BUF_ERROR:MOe,Z_DEFLATED:kW}=sZ,hj=16180,_W=16181,CW=16182,EW=16183,AW=16184,TW=16185,PW=16186,IW=16187,OW=16188,NW=16189,Hw=16190,Xu=16191,YE=16192,RW=16193,GE=16194,LW=16195,FW=16196,zW=16197,MW=16198,E1=16199,A1=16200,DW=16201,BW=16202,WW=16203,qW=16204,$W=16205,KE=16206,UW=16207,HW=16208,di=16209,hZ=16210,gZ=16211,DOe=852,BOe=592,WOe=15,qOe=WOe,VW=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function $Oe(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const eg=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<hj||t.mode>gZ?1:0},mZ=e=>{if(eg(e))return Ll;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=hj,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(DOe),t.distcode=t.distdyn=new Int32Array(BOe),t.sane=1,t.back=-1,Dh},vZ=e=>{if(eg(e))return Ll;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,mZ(e)},yZ=(e,t)=>{let r;if(eg(e))return Ll;const n=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Ll:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,vZ(e))},xZ=(e,t)=>{if(!e)return Ll;const r=new $Oe;e.state=r,r.strm=e,r.window=null,r.mode=hj;const n=yZ(e,t);return n!==Dh&&(e.state=null),n},UOe=e=>xZ(e,qOe);let YW=!0,QE,XE;const HOe=e=>{if(YW){QE=new Int32Array(512),XE=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(yx(uZ,e.lens,0,288,QE,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;yx(dZ,e.lens,0,32,XE,0,e.work,{bits:5}),YW=!1}e.lencode=QE,e.lenbits=9,e.distcode=XE,e.distbits=5},bZ=(e,t,r,n)=>{let o;const a=e.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(t.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(o=a.wsize-a.wnext,o>n&&(o=n),a.window.set(t.subarray(r-n,r-n+o),a.wnext),n-=o,n?(a.window.set(t.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0},VOe=(e,t)=>{let r,n,o,a,s,l,c,u,d,f,h,p,v,m,b=0,x,w,k,j,_,T,A,P;const N=new Uint8Array(4);let O,C;const I=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(eg(e)||!e.output||!e.input&&e.avail_in!==0)return Ll;r=e.state,r.mode===Xu&&(r.mode=YE),s=e.next_out,o=e.output,c=e.avail_out,a=e.next_in,n=e.input,l=e.avail_in,u=r.hold,d=r.bits,f=l,h=c,P=Dh;e:for(;;)switch(r.mode){case hj:if(r.wrap===0){r.mode=YE;break}for(;d<16;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(r.wrap&2&&u===35615){r.wbits===0&&(r.wbits=15),r.check=0,N[0]=u&255,N[1]=u>>>8&255,r.check=Uc(r.check,N,2,0),u=0,d=0,r.mode=_W;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=di;break}if((u&15)!==kW){e.msg="unknown compression method",r.mode=di;break}if(u>>>=4,d-=4,A=(u&15)+8,r.wbits===0&&(r.wbits=A),A>15||A>r.wbits){e.msg="invalid window size",r.mode=di;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=u&512?NW:Xu,u=0,d=0;break;case _W:for(;d<16;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(r.flags=u,(r.flags&255)!==kW){e.msg="unknown compression method",r.mode=di;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=di;break}r.head&&(r.head.text=u>>8&1),r.flags&512&&r.wrap&4&&(N[0]=u&255,N[1]=u>>>8&255,r.check=Uc(r.check,N,2,0)),u=0,d=0,r.mode=CW;case CW:for(;d<32;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}r.head&&(r.head.time=u),r.flags&512&&r.wrap&4&&(N[0]=u&255,N[1]=u>>>8&255,N[2]=u>>>16&255,N[3]=u>>>24&255,r.check=Uc(r.check,N,4,0)),u=0,d=0,r.mode=EW;case EW:for(;d<16;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}r.head&&(r.head.xflags=u&255,r.head.os=u>>8),r.flags&512&&r.wrap&4&&(N[0]=u&255,N[1]=u>>>8&255,r.check=Uc(r.check,N,2,0)),u=0,d=0,r.mode=AW;case AW:if(r.flags&1024){for(;d<16;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),r.flags&512&&r.wrap&4&&(N[0]=u&255,N[1]=u>>>8&255,r.check=Uc(r.check,N,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=TW;case TW:if(r.flags&1024&&(p=r.length,p>l&&(p=l),p&&(r.head&&(A=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+p),A)),r.flags&512&&r.wrap&4&&(r.check=Uc(r.check,n,p,a)),l-=p,a+=p,r.length-=p),r.length))break e;r.length=0,r.mode=PW;case PW:if(r.flags&2048){if(l===0)break e;p=0;do A=n[a+p++],r.head&&A&&r.length<65536&&(r.head.name+=String.fromCharCode(A));while(A&&p<l);if(r.flags&512&&r.wrap&4&&(r.check=Uc(r.check,n,p,a)),l-=p,a+=p,A)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=IW;case IW:if(r.flags&4096){if(l===0)break e;p=0;do A=n[a+p++],r.head&&A&&r.length<65536&&(r.head.comment+=String.fromCharCode(A));while(A&&p<l);if(r.flags&512&&r.wrap&4&&(r.check=Uc(r.check,n,p,a)),l-=p,a+=p,A)break e}else r.head&&(r.head.comment=null);r.mode=OW;case OW:if(r.flags&512){for(;d<16;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(r.wrap&4&&u!==(r.check&65535)){e.msg="header crc mismatch",r.mode=di;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Xu;break;case NW:for(;d<32;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}e.adler=r.check=VW(u),u=0,d=0,r.mode=Hw;case Hw:if(r.havedict===0)return e.next_out=s,e.avail_out=c,e.next_in=a,e.avail_in=l,r.hold=u,r.bits=d,zOe;e.adler=r.check=1,r.mode=Xu;case Xu:if(t===LOe||t===C1)break e;case YE:if(r.last){u>>>=d&7,d-=d&7,r.mode=KE;break}for(;d<3;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}switch(r.last=u&1,u>>>=1,d-=1,u&3){case 0:r.mode=RW;break;case 1:if(HOe(r),r.mode=E1,t===C1){u>>>=2,d-=2;break e}break;case 2:r.mode=FW;break;case 3:e.msg="invalid block type",r.mode=di}u>>>=2,d-=2;break;case RW:for(u>>>=d&7,d-=d&7;d<32;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if((u&65535)!==(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=di;break}if(r.length=u&65535,u=0,d=0,r.mode=GE,t===C1)break e;case GE:r.mode=LW;case LW:if(p=r.length,p){if(p>l&&(p=l),p>c&&(p=c),p===0)break e;o.set(n.subarray(a,a+p),s),l-=p,a+=p,c-=p,s+=p,r.length-=p;break}r.mode=Xu;break;case FW:for(;d<14;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(r.nlen=(u&31)+257,u>>>=5,d-=5,r.ndist=(u&31)+1,u>>>=5,d-=5,r.ncode=(u&15)+4,u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=di;break}r.have=0,r.mode=zW;case zW:for(;r.have<r.ncode;){for(;d<3;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}r.lens[I[r.have++]]=u&7,u>>>=3,d-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},P=yx(ROe,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,P){e.msg="invalid code lengths set",r.mode=di;break}r.have=0,r.mode=MW;case MW:for(;r.have<r.nlen+r.ndist;){for(;b=r.lencode[u&(1<<r.lenbits)-1],x=b>>>24,w=b>>>16&255,k=b&65535,!(x<=d);){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(k<16)u>>>=x,d-=x,r.lens[r.have++]=k;else{if(k===16){for(C=x+2;d<C;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(u>>>=x,d-=x,r.have===0){e.msg="invalid bit length repeat",r.mode=di;break}A=r.lens[r.have-1],p=3+(u&3),u>>>=2,d-=2}else if(k===17){for(C=x+3;d<C;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}u>>>=x,d-=x,A=0,p=3+(u&7),u>>>=3,d-=3}else{for(C=x+7;d<C;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}u>>>=x,d-=x,A=0,p=11+(u&127),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=di;break}for(;p--;)r.lens[r.have++]=A}}if(r.mode===di)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=di;break}if(r.lenbits=9,O={bits:r.lenbits},P=yx(uZ,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,P){e.msg="invalid literal/lengths set",r.mode=di;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},P=yx(dZ,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,P){e.msg="invalid distances set",r.mode=di;break}if(r.mode=E1,t===C1)break e;case E1:r.mode=A1;case A1:if(l>=6&&c>=258){e.next_out=s,e.avail_out=c,e.next_in=a,e.avail_in=l,r.hold=u,r.bits=d,AOe(e,h),s=e.next_out,o=e.output,c=e.avail_out,a=e.next_in,n=e.input,l=e.avail_in,u=r.hold,d=r.bits,r.mode===Xu&&(r.back=-1);break}for(r.back=0;b=r.lencode[u&(1<<r.lenbits)-1],x=b>>>24,w=b>>>16&255,k=b&65535,!(x<=d);){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(w&&(w&240)===0){for(j=x,_=w,T=k;b=r.lencode[T+((u&(1<<j+_)-1)>>j)],x=b>>>24,w=b>>>16&255,k=b&65535,!(j+x<=d);){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}u>>>=j,d-=j,r.back+=j}if(u>>>=x,d-=x,r.back+=x,r.length=k,w===0){r.mode=$W;break}if(w&32){r.back=-1,r.mode=Xu;break}if(w&64){e.msg="invalid literal/length code",r.mode=di;break}r.extra=w&15,r.mode=DW;case DW:if(r.extra){for(C=r.extra;d<C;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=BW;case BW:for(;b=r.distcode[u&(1<<r.distbits)-1],x=b>>>24,w=b>>>16&255,k=b&65535,!(x<=d);){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if((w&240)===0){for(j=x,_=w,T=k;b=r.distcode[T+((u&(1<<j+_)-1)>>j)],x=b>>>24,w=b>>>16&255,k=b&65535,!(j+x<=d);){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}u>>>=j,d-=j,r.back+=j}if(u>>>=x,d-=x,r.back+=x,w&64){e.msg="invalid distance code",r.mode=di;break}r.offset=k,r.extra=w&15,r.mode=WW;case WW:if(r.extra){for(C=r.extra;d<C;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=di;break}r.mode=qW;case qW:if(c===0)break e;if(p=h-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=di;break}p>r.wnext?(p-=r.wnext,v=r.wsize-p):v=r.wnext-p,p>r.length&&(p=r.length),m=r.window}else m=o,v=s-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do o[s++]=m[v++];while(--p);r.length===0&&(r.mode=A1);break;case $W:if(c===0)break e;o[s++]=r.length,c--,r.mode=A1;break;case KE:if(r.wrap){for(;d<32;){if(l===0)break e;l--,u|=n[a++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,r.wrap&4&&h&&(e.adler=r.check=r.flags?Uc(r.check,o,h,s-h):Y6(r.check,o,h,s-h)),h=c,r.wrap&4&&(r.flags?u:VW(u))!==r.check){e.msg="incorrect data check",r.mode=di;break}u=0,d=0}r.mode=UW;case UW:if(r.wrap&&r.flags){for(;d<32;){if(l===0)break e;l--,u+=n[a++]<<d,d+=8}if(r.wrap&4&&u!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=di;break}u=0,d=0}r.mode=HW;case HW:P=FOe;break e;case di:P=fZ;break e;case hZ:return pZ;case gZ:default:return Ll}return e.next_out=s,e.avail_out=c,e.next_in=a,e.avail_in=l,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<di&&(r.mode<KE||t!==jW))&&bZ(e,e.output,e.next_out,h-e.avail_out),f-=e.avail_in,h-=e.avail_out,e.total_in+=f,e.total_out+=h,r.total+=h,r.wrap&4&&h&&(e.adler=r.check=r.flags?Uc(r.check,o,h,e.next_out-h):Y6(r.check,o,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Xu?128:0)+(r.mode===E1||r.mode===GE?256:0),(f===0&&h===0||t===jW)&&P===Dh&&(P=MOe),P},YOe=e=>{if(eg(e))return Ll;let t=e.state;return t.window&&(t.window=null),e.state=null,Dh},GOe=(e,t)=>{if(eg(e))return Ll;const r=e.state;return(r.wrap&2)===0?Ll:(r.head=t,t.done=!1,Dh)},KOe=(e,t)=>{const r=t.length;let n,o,a;return eg(e)||(n=e.state,n.wrap!==0&&n.mode!==Hw)?Ll:n.mode===Hw&&(o=1,o=Y6(o,t,r,0),o!==n.check)?fZ:(a=bZ(e,t,r,r),a?(n.mode=hZ,pZ):(n.havedict=1,Dh))};var QOe=vZ,XOe=yZ,ZOe=mZ,JOe=UOe,eNe=xZ,tNe=VOe,rNe=YOe,nNe=GOe,iNe=KOe,oNe="pako inflate (from Nodeca project)",rd={inflateReset:QOe,inflateReset2:XOe,inflateResetKeep:ZOe,inflateInit:JOe,inflateInit2:eNe,inflate:tNe,inflateEnd:rNe,inflateGetHeader:nNe,inflateSetDictionary:iNe,inflateInfo:oNe};function aNe(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var sNe=aNe;const wZ=Object.prototype.toString,{Z_NO_FLUSH:lNe,Z_FINISH:cNe,Z_OK:jb,Z_STREAM_END:ZE,Z_NEED_DICT:JE,Z_STREAM_ERROR:uNe,Z_DATA_ERROR:GW,Z_MEM_ERROR:dNe}=sZ;function e0(e){this.options=lZ.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new COe,this.strm.avail_out=0;let r=rd.inflateInit2(this.strm,t.windowBits);if(r!==jb)throw new Error(G6[r]);if(this.header=new sNe,rd.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=K6.string2buf(t.dictionary):wZ.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=rd.inflateSetDictionary(this.strm,t.dictionary),r!==jb)))throw new Error(G6[r])}e0.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,o=this.options.dictionary;let a,s,l;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?cNe:lNe,wZ.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),a=rd.inflate(r,s),a===JE&&o&&(a=rd.inflateSetDictionary(r,o),a===jb?a=rd.inflate(r,s):a===GW&&(a=JE));r.avail_in>0&&a===ZE&&r.state.wrap>0&&e[r.next_in]!==0;)rd.inflateReset(r),a=rd.inflate(r,s);switch(a){case uNe:case GW:case JE:case dNe:return this.onEnd(a),this.ended=!0,!1}if(l=r.avail_out,r.next_out&&(r.avail_out===0||a===ZE))if(this.options.to==="string"){let c=K6.utf8border(r.output,r.next_out),u=r.next_out-c,d=K6.buf2string(r.output,c);r.next_out=u,r.avail_out=n-u,u&&r.output.set(r.output.subarray(c,c+u),0),this.onData(d)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===jb&&l===0)){if(a===ZE)return a=rd.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};e0.prototype.onData=function(e){this.chunks.push(e)};e0.prototype.onEnd=function(e){e===jb&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=lZ.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function fNe(e,t){const r=new e0(t);if(r.push(e),r.err)throw r.msg||G6[r.err];return r.result}var pNe=e0,hNe=fNe,gNe={Inflate:pNe,inflate:hNe};const{Inflate:mNe,inflate:vNe}=gNe;var KW=mNe,yNe=vNe;const SZ=[];for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t&1?t=3988292384^t>>>1:t=t>>>1;SZ[e]=t}const QW=4294967295;function xNe(e,t,r){let n=e;for(let o=0;o<r;o++)n=SZ[(n^t[o])&255]^n>>>8;return n}function bNe(e,t){return(xNe(QW,e,t)^QW)>>>0}function XW(e,t,r){const n=e.readUint32(),o=bNe(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(o!==n)throw new Error(`CRC mismatch for chunk ${r}. Expected ${n}, found ${o}`)}function jZ(e,t,r){for(let n=0;n<r;n++)t[n]=e[n]}function kZ(e,t,r,n){let o=0;for(;o<n;o++)t[o]=e[o];for(;o<r;o++)t[o]=e[o]+t[o-n]&255}function _Z(e,t,r,n){let o=0;if(r.length===0)for(;o<n;o++)t[o]=e[o];else for(;o<n;o++)t[o]=e[o]+r[o]&255}function CZ(e,t,r,n,o){let a=0;if(r.length===0){for(;a<o;a++)t[a]=e[a];for(;a<n;a++)t[a]=e[a]+(t[a-o]>>1)&255}else{for(;a<o;a++)t[a]=e[a]+(r[a]>>1)&255;for(;a<n;a++)t[a]=e[a]+(t[a-o]+r[a]>>1)&255}}function EZ(e,t,r,n,o){let a=0;if(r.length===0){for(;a<o;a++)t[a]=e[a];for(;a<n;a++)t[a]=e[a]+t[a-o]&255}else{for(;a<o;a++)t[a]=e[a]+r[a]&255;for(;a<n;a++)t[a]=e[a]+wNe(t[a-o],r[a],r[a-o])&255}}function wNe(e,t,r){const n=e+t-r,o=Math.abs(n-e),a=Math.abs(n-t),s=Math.abs(n-r);return o<=a&&o<=s?e:a<=s?t:r}function SNe(e,t,r,n,o,a){switch(e){case 0:jZ(t,r,o);break;case 1:kZ(t,r,o,a);break;case 2:_Z(t,r,n,o);break;case 3:CZ(t,r,n,o,a);break;case 4:EZ(t,r,n,o,a);break;default:throw new Error(`Unsupported filter: ${e}`)}}const jNe=new Uint16Array([255]),kNe=new Uint8Array(jNe.buffer),_Ne=kNe[0]===255;function CNe(e){const{data:t,width:r,height:n,channels:o,depth:a}=e,s=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],l=Math.ceil(a/8)*o,c=new Uint8Array(n*r*l);let u=0;for(let d=0;d<7;d++){const f=s[d],h=Math.ceil((r-f.x)/f.xStep),p=Math.ceil((n-f.y)/f.yStep);if(h<=0||p<=0)continue;const v=h*l,m=new Uint8Array(v);for(let b=0;b<p;b++){const x=t[u++],w=t.subarray(u,u+v);u+=v;const k=new Uint8Array(v);SNe(x,w,k,m,v,l),m.set(k);for(let j=0;j<h;j++){const _=f.x+j*f.xStep,T=f.y+b*f.yStep;if(!(_>=r||T>=n))for(let A=0;A<l;A++)c[(T*r+_)*l+A]=k[j*l+A]}}}if(a===16){const d=new Uint16Array(c.buffer);if(_Ne)for(let f=0;f<d.length;f++)d[f]=ENe(d[f]);return d}else return c}function ENe(e){return(e&255)<<8|e>>8&255}const ANe=new Uint16Array([255]),TNe=new Uint8Array(ANe.buffer),PNe=TNe[0]===255,INe=new Uint8Array(0);function ZW(e){const{data:t,width:r,height:n,channels:o,depth:a}=e,s=Math.ceil(a/8)*o,l=Math.ceil(a/8*o*r),c=new Uint8Array(n*l);let u=INe,d=0,f,h;for(let p=0;p<n;p++){switch(f=t.subarray(d+1,d+1+l),h=c.subarray(p*l,(p+1)*l),t[d]){case 0:jZ(f,h,l);break;case 1:kZ(f,h,l,s);break;case 2:_Z(f,h,u,l);break;case 3:CZ(f,h,u,l,s);break;case 4:EZ(f,h,u,l,s);break;default:throw new Error(`Unsupported filter: ${t[d]}`)}u=h,d+=l+1}if(a===16){const p=new Uint16Array(c.buffer);if(PNe)for(let v=0;v<p.length;v++)p[v]=ONe(p[v]);return p}else return c}function ONe(e){return(e&255)<<8|e>>8&255}const V1=Uint8Array.of(137,80,78,71,13,10,26,10);function JW(e){if(!NNe(e.readBytes(V1.length)))throw new Error("wrong PNG signature")}function NNe(e){if(e.length<V1.length)return!1;for(let t=0;t<V1.length;t++)if(e[t]!==V1[t])return!1;return!0}const RNe="tEXt",LNe=0,AZ=new TextDecoder("latin1");function FNe(e){if(MNe(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const zNe=/^[\u0000-\u00FF]*$/;function MNe(e){if(!zNe.test(e))throw new Error("invalid latin1 text")}function DNe(e,t,r){const n=TZ(t);e[n]=BNe(t,r-n.length-1)}function TZ(e){for(e.mark();e.readByte()!==LNe;);const t=e.offset;e.reset();const r=AZ.decode(e.readBytes(t-e.offset-1));return e.skip(1),FNe(r),r}function BNe(e,t){return AZ.decode(e.readBytes(t))}const zs={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},e3={UNKNOWN:-1,DEFLATE:0},eq={UNKNOWN:-1,ADAPTIVE:0},t3={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},T1={NONE:0,BACKGROUND:1,PREVIOUS:2},r3={SOURCE:0,OVER:1};class WNe extends fI{constructor(r,n={}){super(r);yn(this,"_checkCrc");yn(this,"_inflator");yn(this,"_png");yn(this,"_apng");yn(this,"_end");yn(this,"_hasPalette");yn(this,"_palette");yn(this,"_hasTransparency");yn(this,"_transparency");yn(this,"_compressionMethod");yn(this,"_filterMethod");yn(this,"_interlaceMethod");yn(this,"_colorType");yn(this,"_isAnimated");yn(this,"_numberOfFrames");yn(this,"_numberOfPlays");yn(this,"_frames");yn(this,"_writingDataChunks");const{checkCrc:o=!1}=n;this._checkCrc=o,this._inflator=new KW,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=e3.UNKNOWN,this._filterMethod=eq.UNKNOWN,this._interlaceMethod=t3.UNKNOWN,this._colorType=zs.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(JW(this);!this._end;){const r=this.readUint32(),n=this.readChars(4);this.decodeChunk(r,n)}return this.decodeImage(),this._png}decodeApng(){for(JW(this);!this._end;){const r=this.readUint32(),n=this.readChars(4);this.decodeApngChunk(r,n)}return this.decodeApngImage(),this._apng}decodeChunk(r,n){const o=this.offset;switch(n){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(r);break;case"IDAT":this.decodeIDAT(r);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(r);break;case"iCCP":this.decodeiCCP(r);break;case RNe:DNe(this._png.text,this,r);break;case"pHYs":this.decodepHYs();break;default:this.skip(r);break}if(this.offset-o!==r)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?XW(this,r+4,n):this.skip(4)}decodeApngChunk(r,n){const o=this.offset;switch(n!=="fdAT"&&n!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),n){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(r);break;default:this.decodeChunk(r,n),this.offset=o+r;break}if(this.offset-o!==r)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?XW(this,r+4,n):this.skip(4)}decodeIHDR(){const r=this._png;r.width=this.readUint32(),r.height=this.readUint32(),r.depth=qNe(this.readUint8());const n=this.readUint8();this._colorType=n;let o;switch(n){case zs.GREYSCALE:o=1;break;case zs.TRUECOLOUR:o=3;break;case zs.INDEXED_COLOUR:o=1;break;case zs.GREYSCALE_ALPHA:o=2;break;case zs.TRUECOLOUR_ALPHA:o=4;break;case zs.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=o,this._compressionMethod=this.readUint8(),this._compressionMethod!==e3.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const r={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(r)}decodePLTE(r){if(r%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${r}`);const n=r/3;this._hasPalette=!0;const o=[];this._palette=o;for(let a=0;a<n;a++)o.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(r){this._writingDataChunks=!0;const n=r,o=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,o,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodeFDAT(r){this._writingDataChunks=!0;let n=r,o=this.offset+this.byteOffset;if(o+=4,n-=4,this._inflator.push(new Uint8Array(this.buffer,o,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodetRNS(r){switch(this._colorType){case zs.GREYSCALE:case zs.TRUECOLOUR:{if(r%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${r}`);if(r/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${r/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(r/2);for(let n=0;n<r/2;n++)this._transparency[n]=this.readUint16();break}case zs.INDEXED_COLOUR:{if(r>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${r} vs ${this._palette.length})`);let n=0;for(;n<r;n++){const o=this.readByte();this._palette[n].push(o)}for(;n<this._palette.length;n++)this._palette[n].push(255);break}case zs.UNKNOWN:case zs.GREYSCALE_ALPHA:case zs.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(r){const n=TZ(this),o=this.readUint8();if(o!==e3.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${o}`);const a=this.readBytes(r-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:yNe(a)}}decodepHYs(){const r=this.readUint32(),n=this.readUint32(),o=this.readByte();this._png.resolution={x:r,y:n,unit:o}}decodeApngImage(){this._apng.width=this._png.width,this._apng.height=this._png.height,this._apng.channels=this._png.channels,this._apng.depth=this._png.depth,this._apng.numberOfFrames=this._numberOfFrames,this._apng.numberOfPlays=this._numberOfPlays,this._apng.text=this._png.text,this._apng.resolution=this._png.resolution;for(let r=0;r<this._numberOfFrames;r++){const n={sequenceNumber:this._frames[r].sequenceNumber,delayNumber:this._frames[r].delayNumber,delayDenominator:this._frames[r].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},o=this._frames.at(r);if(o){if(o.data=ZW({data:o.data,width:o.width,height:o.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),r===0||o.xOffset===0&&o.yOffset===0&&o.width===this._png.width&&o.height===this._png.height)n.data=o.data;else{const a=this._apng.frames.at(r-1);this.disposeFrame(o,a,n),this.addFrameDataToCanvas(n,o)}this._apng.frames.push(n)}}return this._apng}disposeFrame(r,n,o){switch(r.disposeOp){case T1.NONE:break;case T1.BACKGROUND:for(let a=0;a<this._png.height;a++)for(let s=0;s<this._png.width;s++){const l=(a*r.width+s)*this._png.channels;for(let c=0;c<this._png.channels;c++)o.data[l+c]=0}break;case T1.PREVIOUS:o.data.set(n.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(r,n){const o=1<<this._png.depth,a=(s,l)=>{const c=((s+n.yOffset)*this._png.width+n.xOffset+l)*this._png.channels,u=(s*n.width+l)*this._png.channels;return{index:c,frameIndex:u}};switch(n.blendOp){case r3.SOURCE:for(let s=0;s<n.height;s++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:u}=a(s,l);for(let d=0;d<this._png.channels;d++)r.data[c+d]=n.data[u+d]}break;case r3.OVER:for(let s=0;s<n.height;s++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:u}=a(s,l);for(let d=0;d<this._png.channels;d++){const f=n.data[u+this._png.channels-1]/o,h=d%(this._png.channels-1)===0?1:n.data[u+d],p=Math.floor(f*h+(1-f)*r.data[c+d]);r.data[c+d]+=p}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var n;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const r=this._isAnimated?((n=this._frames)==null?void 0:n.at(0)).data:this._inflator.result;if(this._filterMethod!==eq.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===t3.NO_INTERLACE)this._png.data=ZW({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===t3.ADAM7)this._png.data=CNe({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const r=this._inflator.result,n=this._frames.at(-1);n?n.data=r:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:T1.NONE,blendOp:r3.SOURCE,data:r}),this._inflator=new KW,this._writingDataChunks=!1}}function qNe(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var tq;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(tq||(tq={}));function $Ne(e,t){return new WNe(e,t).decode()}var Er=(function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this})();function n3(){Er.console&&typeof Er.console.log=="function"&&Er.console.log.apply(Er.console,arguments)}var Bn={log:n3,warn:function(e){Er.console&&(typeof Er.console.warn=="function"?Er.console.warn.apply(Er.console,arguments):n3.call(null,arguments))},error:function(e){Er.console&&(typeof Er.console.error=="function"?Er.console.error.apply(Er.console,arguments):n3(e))}};function i3(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){rh(n.response,t,r)},n.onerror=function(){Bn.error("could not download file")},n.send()}function rq(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function P1(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var rh=Er.saveAs||((typeof window>"u"?"undefined":On(window))!=="object"||window!==Er?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,r){var n=Er.URL||Er.webkitURL,o=document.createElement("a");t=t||e.name||"download",o.download=t,o.rel="noopener",typeof e=="string"?(o.href=e,o.origin!==location.origin?rq(o.href)?i3(e,t,r):P1(o,o.target="_blank"):P1(o)):(o.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(o.href)},4e4),setTimeout(function(){P1(o)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,r){if(t=t||e.name||"download",typeof e=="string")if(rq(e))i3(e,t,r);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){P1(n)})}else navigator.msSaveOrOpenBlob((function(o,a){return a===void 0?a={autoBom:!1}:On(a)!=="object"&&(Bn.warn("Deprecated: Expected third argument to be a object"),a={autoBom:!a}),a.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(o.type)?new Blob(["\uFEFF",o],{type:o.type}):o})(e,r),t)}:function(e,t,r,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return i3(e,t,r);var o=e.type==="application/octet-stream",a=/constructor/i.test(Er.HTMLElement)||Er.safari,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&a)&&(typeof FileReader>"u"?"undefined":On(FileReader))==="object"){var l=new FileReader;l.onloadend=function(){var d=l.result;d=s?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=d:location=d,n=null},l.readAsDataURL(e)}else{var c=Er.URL||Er.webkitURL,u=c.createObjectURL(e);n?n.location=u:location.href=u,n=null,setTimeout(function(){c.revokeObjectURL(u)},4e4)}});/**
* A class to parse color values
* @author Stoyan Stefanov <sstoo@gmail.com>
* {@link http://www.phpied.com/rgb-color-parser-in-javascript/}
* @license Use it if you like it
*/function PZ(e){var t;e=e||"",this.ok=!1,e.charAt(0)=="#"&&(e=e.substr(1,6)),e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var r=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(l){return[parseInt(l[1]),parseInt(l[2]),parseInt(l[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(l){return[parseInt(l[1],16),parseInt(l[2],16),parseInt(l[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(l){return[parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16),parseInt(l[3]+l[3],16)]}}],n=0;n<r.length;n++){var o=r[n].re,a=r[n].process,s=o.exec(e);s&&(t=a(s),this.r=t[0],this.g=t[1],this.b=t[2],this.ok=!0)}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var l=this.r.toString(16),c=this.g.toString(16),u=this.b.toString(16);return l.length==1&&(l="0"+l),c.length==1&&(c="0"+c),u.length==1&&(u="0"+u),"#"+l+c+u}}var Y1=Er.atob.bind(Er),nq=Er.btoa.bind(Er);/**
* @license
* Joseph Myers does not specify a particular license for his work.
*
* Author: Joseph Myers
* Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js
*
* Modified by: Owen Leong
*/function o3(e,t){var r=e[0],n=e[1],o=e[2],a=e[3];r=ua(r,n,o,a,t[0],7,-680876936),a=ua(a,r,n,o,t[1],12,-389564586),o=ua(o,a,r,n,t[2],17,606105819),n=ua(n,o,a,r,t[3],22,-1044525330),r=ua(r,n,o,a,t[4],7,-176418897),a=ua(a,r,n,o,t[5],12,1200080426),o=ua(o,a,r,n,t[6],17,-1473231341),n=ua(n,o,a,r,t[7],22,-45705983),r=ua(r,n,o,a,t[8],7,1770035416),a=ua(a,r,n,o,t[9],12,-1958414417),o=ua(o,a,r,n,t[10],17,-42063),n=ua(n,o,a,r,t[11],22,-1990404162),r=ua(r,n,o,a,t[12],7,1804603682),a=ua(a,r,n,o,t[13],12,-40341101),o=ua(o,a,r,n,t[14],17,-1502002290),r=da(r,n=ua(n,o,a,r,t[15],22,1236535329),o,a,t[1],5,-165796510),a=da(a,r,n,o,t[6],9,-1069501632),o=da(o,a,r,n,t[11],14,643717713),n=da(n,o,a,r,t[0],20,-373897302),r=da(r,n,o,a,t[5],5,-701558691),a=da(a,r,n,o,t[10],9,38016083),o=da(o,a,r,n,t[15],14,-660478335),n=da(n,o,a,r,t[4],20,-405537848),r=da(r,n,o,a,t[9],5,568446438),a=da(a,r,n,o,t[14],9,-1019803690),o=da(o,a,r,n,t[3],14,-187363961),n=da(n,o,a,r,t[8],20,1163531501),r=da(r,n,o,a,t[13],5,-1444681467),a=da(a,r,n,o,t[2],9,-51403784),o=da(o,a,r,n,t[7],14,1735328473),r=fa(r,n=da(n,o,a,r,t[12],20,-1926607734),o,a,t[5],4,-378558),a=fa(a,r,n,o,t[8],11,-2022574463),o=fa(o,a,r,n,t[11],16,1839030562),n=fa(n,o,a,r,t[14],23,-35309556),r=fa(r,n,o,a,t[1],4,-1530992060),a=fa(a,r,n,o,t[4],11,1272893353),o=fa(o,a,r,n,t[7],16,-155497632),n=fa(n,o,a,r,t[10],23,-1094730640),r=fa(r,n,o,a,t[13],4,681279174),a=fa(a,r,n,o,t[0],11,-358537222),o=fa(o,a,r,n,t[3],16,-722521979),n=fa(n,o,a,r,t[6],23,76029189),r=fa(r,n,o,a,t[9],4,-640364487),a=fa(a,r,n,o,t[12],11,-421815835),o=fa(o,a,r,n,t[15],16,530742520),r=pa(r,n=fa(n,o,a,r,t[2],23,-995338651),o,a,t[0],6,-198630844),a=pa(a,r,n,o,t[7],10,1126891415),o=pa(o,a,r,n,t[14],15,-1416354905),n=pa(n,o,a,r,t[5],21,-57434055),r=pa(r,n,o,a,t[12],6,1700485571),a=pa(a,r,n,o,t[3],10,-1894986606),o=pa(o,a,r,n,t[10],15,-1051523),n=pa(n,o,a,r,t[1],21,-2054922799),r=pa(r,n,o,a,t[8],6,1873313359),a=pa(a,r,n,o,t[15],10,-30611744),o=pa(o,a,r,n,t[6],15,-1560198380),n=pa(n,o,a,r,t[13],21,1309151649),r=pa(r,n,o,a,t[4],6,-145523070),a=pa(a,r,n,o,t[11],10,-1120210379),o=pa(o,a,r,n,t[2],15,718787259),n=pa(n,o,a,r,t[9],21,-343485551),e[0]=Nf(r,e[0]),e[1]=Nf(n,e[1]),e[2]=Nf(o,e[2]),e[3]=Nf(a,e[3])}function gj(e,t,r,n,o,a){return t=Nf(Nf(t,e),Nf(n,a)),Nf(t<<o|t>>>32-o,r)}function ua(e,t,r,n,o,a,s){return gj(t&r|~t&n,e,t,o,a,s)}function da(e,t,r,n,o,a,s){return gj(t&n|r&~n,e,t,o,a,s)}function fa(e,t,r,n,o,a,s){return gj(t^r^n,e,t,o,a,s)}function pa(e,t,r,n,o,a,s){return gj(r^(t|~n),e,t,o,a,s)}function IZ(e){var t,r=e.length,n=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)o3(n,UNe(e.substring(t-64,t)));e=e.substring(t-64);var o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)o[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(o[t>>2]|=128<<(t%4<<3),t>55)for(o3(n,o),t=0;t<16;t++)o[t]=0;return o[14]=8*r,o3(n,o),n}function UNe(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}var iq="0123456789abcdef".split("");function HNe(e){for(var t="",r=0;r<4;r++)t+=iq[e>>8*r+4&15]+iq[e>>8*r&15];return t}function VNe(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function Q6(e){return IZ(e).map(VNe).join("")}var YNe=(function(e){for(var t=0;t<e.length;t++)e[t]=HNe(e[t]);return e.join("")})(IZ("hello"))!="5d41402abc4b2a76b9719d911017c592";function Nf(e,t){if(YNe){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}return e+t&4294967295}/**
* @license
* FPDF is released under a permissive license: there is no usage restriction.
* You may embed it freely in your application (commercial or not), with or
* without modifications.
*
* Reference: http://www.fpdf.org/en/script/script37.php
*/function X6(e,t){var r,n,o,a;if(e!==r){for(var s=(o=e,a=1+(256/e.length|0),new Array(a+1).join(o)),l=[],c=0;c<256;c++)l[c]=c;var u=0;for(c=0;c<256;c++){var d=l[c];u=(u+d+s.charCodeAt(c))%256,l[c]=l[u],l[u]=d}r=e,n=l}else l=n;var f=t.length,h=0,p=0,v="";for(c=0;c<f;c++)p=(p+(d=l[h=(h+1)%256]))%256,l[h]=l[p],l[p]=d,s=l[(l[h]+l[p])%256],v+=String.fromCharCode(t.charCodeAt(c)^s);return v}/**
* @license
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
* Author: Owen Leong (@owenl131)
* Date: 15 Oct 2020
* References:
* https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt
* https://github.com/foliojs/pdfkit/blob/master/lib/security.js
* http://www.fpdf.org/en/script/script37.php
*/var oq={print:4,modify:8,copy:16,"annot-forms":32};function Zg(e,t,r,n){this.v=1,this.r=2;var o=192;e.forEach(function(l){if(oq.perm!==void 0)throw new Error("Invalid permission: "+l);o+=oq[l]}),this.padding="(¿N^NuŠAd\0NVÿú\b..\0¶Ðh>€/\f©þdSiz";var a=(t+this.padding).substr(0,32),s=(r+this.padding).substr(0,32);this.O=this.processOwnerPassword(a,s),this.P=-(1+(255^o)),this.encryptionKey=Q6(a+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(n)).substr(0,5),this.U=X6(this.encryptionKey,this.padding)}function Jg(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",r=e.length,n=0;n<r;n++){var o=e.charCodeAt(n);t+=o<33||o===35||o===37||o===40||o===41||o===47||o===60||o===62||o===91||o===93||o===123||o===125||o>126?"#"+("0"+o.toString(16)).slice(-2):e[n]}return t}function aq(e){if(On(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(r,n,o){if(o=o||!1,typeof r!="string"||typeof n!="function"||typeof o!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(r)||(t[r]={});var a=Math.random().toString(35);return t[r][a]=[n,!!o],a},this.unsubscribe=function(r){for(var n in t)if(t[n][r])return delete t[n][r],Object.keys(t[n]).length===0&&delete t[n],!0;return!1},this.publish=function(r){if(t.hasOwnProperty(r)){var n=Array.prototype.slice.call(arguments,1),o=[];for(var a in t[r]){var s=t[r][a];try{s[0].apply(e,n)}catch(l){Er.console&&Bn.error("jsPDF PubSub Error",l.message,l)}s[1]&&o.push(a)}o.length&&o.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function Vw(e){if(!(this instanceof Vw))return new Vw(e);var t="opacity,stroke-opacity".split(",");for(var r in e)e.hasOwnProperty(r)&&t.indexOf(r)>=0&&(this[r]=e[r]);this.id="",this.objectNumber=-1}function OZ(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function ah(e,t,r,n,o){if(!(this instanceof ah))return new ah(e,t,r,n,o);this.type=e==="axial"?2:3,this.coords=t,this.colors=r,OZ.call(this,n,o)}function um(e,t,r,n,o){if(!(this instanceof um))return new um(e,t,r,n,o);this.boundingBox=e,this.xStep=t,this.yStep=r,this.stream="",this.cloneIndex=0,OZ.call(this,n,o)}function fr(e){var t,r=typeof arguments[0]=="string"?arguments[0]:"p",n=arguments[1],o=arguments[2],a=arguments[3],s=[],l=1,c=16,u="S",d=null;On(e=e||{})==="object"&&(r=e.orientation,n=e.unit||n,o=e.format||o,a=e.compress||e.compressPdf||a,(d=e.encryption||null)!==null&&(d.userPassword=d.userPassword||"",d.ownerPassword=d.ownerPassword||"",d.userPermissions=d.userPermissions||[]),l=typeof e.userUnit=="number"?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(c=e.floatPrecision),u=e.defaultPathOperation||"S"),s=e.filters||(a===!0?["FlateEncode"]:s),n=n||"mm",r=(""+(r||"P")).toLowerCase();var f=e.putOnlyUsedFonts||!1,h={},p={internal:{},__private__:{}};p.__private__.PubSub=aq;var v="1.3",m=p.__private__.getPdfVersion=function(){return v};p.__private__.setPdfVersion=function(Z){v=Z};var b={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};p.__private__.getPageFormats=function(){return b};var x=p.__private__.getPageFormat=function(Z){return b[Z]};o=o||"a4";var w="compat",k="advanced",j=w;function _(){this.saveGraphicsState(),se(new ze(Te,0,0,-Te,0,_s()*Te).toString()+" cm"),this.setFontSize(this.getFontSize()/Te),u="n",j=k}function T(){this.restoreGraphicsState(),u="S",j=w}var A=p.__private__.combineFontStyleAndFontWeight=function(Z,fe){if(Z=="bold"&&fe=="normal"||Z=="bold"&&fe==400||Z=="normal"&&fe=="italic"||Z=="bold"&&fe=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return fe&&(Z=fe==400||fe==="normal"?Z==="italic"?"italic":"normal":fe!=700&&fe!=="bold"||Z!=="normal"?(fe==700?"bold":fe)+""+Z:"bold"),Z};p.advancedAPI=function(Z){var fe=j===w;return fe&&_.call(this),typeof Z!="function"||(Z(this),fe&&T.call(this)),this},p.compatAPI=function(Z){var fe=j===k;return fe&&T.call(this),typeof Z!="function"||(Z(this),fe&&_.call(this)),this},p.isAdvancedAPI=function(){return j===k};var P,N=function(Z){if(j!==k)throw new Error(Z+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},O=p.roundToPrecision=p.__private__.roundToPrecision=function(Z,fe){var Ie=t||fe;if(isNaN(Z)||isNaN(Ie))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return Z.toFixed(Ie).replace(/0+$/,"")};P=p.hpf=p.__private__.hpf=typeof c=="number"?function(Z){if(isNaN(Z))throw new Error("Invalid argument passed to jsPDF.hpf");return O(Z,c)}:c==="smart"?function(Z){if(isNaN(Z))throw new Error("Invalid argument passed to jsPDF.hpf");return O(Z,Z>-1&&Z<1?16:5)}:function(Z){if(isNaN(Z))throw new Error("Invalid argument passed to jsPDF.hpf");return O(Z,16)};var C=p.f2=p.__private__.f2=function(Z){if(isNaN(Z))throw new Error("Invalid argument passed to jsPDF.f2");return O(Z,2)},I=p.__private__.f3=function(Z){if(isNaN(Z))throw new Error("Invalid argument passed to jsPDF.f3");return O(Z,3)},R=p.scale=p.__private__.scale=function(Z){if(isNaN(Z))throw new Error("Invalid argument passed to jsPDF.scale");return j===w?Z*Te:j===k?Z:void 0},F=function(Z){return R((function(fe){return j===w?_s()-fe:j===k?fe:void 0})(Z))};p.__private__.setPrecision=p.setPrecision=function(Z){typeof parseInt(Z,10)=="number"&&(t=parseInt(Z,10))};var M,Y="00000000000000000000000000000000",X=p.__private__.getFileId=function(){return Y},$=p.__private__.setFileId=function(Z){return Y=Z!==void 0&&/^[a-fA-F0-9]{32}$/.test(Z)?Z.toUpperCase():Y.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),d!==null&&(Gi=new Zg(d.userPermissions,d.userPassword,d.ownerPassword,Y)),Y};p.setFileId=function(Z){return $(Z),this},p.getFileId=function(){return X()};var ee=p.__private__.convertDateToPDFDate=function(Z){var fe=Z.getTimezoneOffset(),Ie=fe<0?"+":"-",Ue=Math.floor(Math.abs(fe/60)),tt=Math.abs(fe%60),wt=[Ie,G(Ue),"'",G(tt),"'"].join("");return["D:",Z.getFullYear(),G(Z.getMonth()+1),G(Z.getDate()),G(Z.getHours()),G(Z.getMinutes()),G(Z.getSeconds()),wt].join("")},V=p.__private__.convertPDFDateToDate=function(Z){var fe=parseInt(Z.substr(2,4),10),Ie=parseInt(Z.substr(6,2),10)-1,Ue=parseInt(Z.substr(8,2),10),tt=parseInt(Z.substr(10,2),10),wt=parseInt(Z.substr(12,2),10),Ot=parseInt(Z.substr(14,2),10);return new Date(fe,Ie,Ue,tt,wt,Ot,0)},D=p.__private__.setCreationDate=function(Z){var fe;if(Z===void 0&&(Z=new Date),Z instanceof Date)fe=ee(Z);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(Z))throw new Error("Invalid argument passed to jsPDF.setCreationDate");fe=Z}return M=fe},z=p.__private__.getCreationDate=function(Z){var fe=M;return Z==="jsDate"&&(fe=V(M)),fe};p.setCreationDate=function(Z){return D(Z),this},p.getCreationDate=function(Z){return z(Z)};var q,G=p.__private__.padd2=function(Z){return("0"+parseInt(Z)).slice(-2)},U=p.__private__.padd2Hex=function(Z){return("00"+(Z=Z.toString())).substr(Z.length)},Q=0,K=[],re=[],H=0,ie=[],de=[],le=!1,ke=re;p.__private__.setCustomOutputDestination=function(Z){le=!0,ke=Z};var ve=function(Z){le||(ke=Z)};p.__private__.resetCustomOutputDestination=function(){le=!1,ke=re};var se=p.__private__.out=function(Z){return Z=Z.toString(),H+=Z.length+1,ke.push(Z),ke},be=p.__private__.write=function(Z){return se(arguments.length===1?Z.toString():Array.prototype.join.call(arguments," "))},De=p.__private__.getArrayBuffer=function(Z){for(var fe=Z.length,Ie=new ArrayBuffer(fe),Ue=new Uint8Array(Ie);fe--;)Ue[fe]=Z.charCodeAt(fe);return Ie},ae=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];p.__private__.getStandardFonts=function(){return ae};var ue=e.fontSize||16;p.__private__.setFontSize=p.setFontSize=function(Z){return ue=j===k?Z/Te:Z,this};var Me,Se=p.__private__.getFontSize=p.getFontSize=function(){return j===w?ue:ue*Te},Pe=e.R2L||!1;p.__private__.setR2L=p.setR2L=function(Z){return Pe=Z,this},p.__private__.getR2L=p.getR2L=function(){return Pe};var Ee,Ae=p.__private__.setZoomMode=function(Z){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(Z))Me=Z;else if(isNaN(Z)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(Z)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+Z+'" is not recognized.');Me=Z}else Me=parseInt(Z,10)};p.__private__.getZoomMode=function(){return Me};var Ye,rt=p.__private__.setPageMode=function(Z){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(Z)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+Z+'" is not recognized.');Ee=Z};p.__private__.getPageMode=function(){return Ee};var He=p.__private__.setLayoutMode=function(Z){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(Z)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+Z+'" is not recognized.');Ye=Z};p.__private__.getLayoutMode=function(){return Ye},p.__private__.setDisplayMode=p.setDisplayMode=function(Z,fe,Ie){return Ae(Z),He(fe),rt(Ie),this};var xt={title:"",subject:"",author:"",keywords:"",creator:""};p.__private__.getDocumentProperty=function(Z){if(Object.keys(xt).indexOf(Z)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return xt[Z]},p.__private__.getDocumentProperties=function(){return xt},p.__private__.setDocumentProperties=p.setProperties=p.setDocumentProperties=function(Z){for(var fe in xt)xt.hasOwnProperty(fe)&&Z[fe]&&(xt[fe]=Z[fe]);return this},p.__private__.setDocumentProperty=function(Z,fe){if(Object.keys(xt).indexOf(Z)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return xt[Z]=fe};var st,Te,et,Pt,qe,Et={},vt={},Ft=[],Ce={},lt={},Xe={},Be={},ct=null,Tt=0,We=[],ce=new aq(p),he=e.hotfixes||[],je={},xe={},Re=[],ze=function Z(fe,Ie,Ue,tt,wt,Ot){if(!(this instanceof Z))return new Z(fe,Ie,Ue,tt,wt,Ot);isNaN(fe)&&(fe=1),isNaN(Ie)&&(Ie=0),isNaN(Ue)&&(Ue=0),isNaN(tt)&&(tt=1),isNaN(wt)&&(wt=0),isNaN(Ot)&&(Ot=0),this._matrix=[fe,Ie,Ue,tt,wt,Ot]};Object.defineProperty(ze.prototype,"sx",{get:function(){return this._matrix[0]},set:function(Z){this._matrix[0]=Z}}),Object.defineProperty(ze.prototype,"shy",{get:function(){return this._matrix[1]},set:function(Z){this._matrix[1]=Z}}),Object.defineProperty(ze.prototype,"shx",{get:function(){return this._matrix[2]},set:function(Z){this._matrix[2]=Z}}),Object.defineProperty(ze.prototype,"sy",{get:function(){return this._matrix[3]},set:function(Z){this._matrix[3]=Z}}),Object.defineProperty(ze.prototype,"tx",{get:function(){return this._matrix[4]},set:function(Z){this._matrix[4]=Z}}),Object.defineProperty(ze.prototype,"ty",{get:function(){return this._matrix[5]},set:function(Z){this._matrix[5]=Z}}),Object.defineProperty(ze.prototype,"a",{get:function(){return this._matrix[0]},set:function(Z){this._matrix[0]=Z}}),Object.defineProperty(ze.prototype,"b",{get:function(){return this._matrix[1]},set:function(Z){this._matrix[1]=Z}}),Object.defineProperty(ze.prototype,"c",{get:function(){return this._matrix[2]},set:function(Z){this._matrix[2]=Z}}),Object.defineProperty(ze.prototype,"d",{get:function(){return this._matrix[3]},set:function(Z){this._matrix[3]=Z}}),Object.defineProperty(ze.prototype,"e",{get:function(){return this._matrix[4]},set:function(Z){this._matrix[4]=Z}}),Object.defineProperty(ze.prototype,"f",{get:function(){return this._matrix[5]},set:function(Z){this._matrix[5]=Z}}),Object.defineProperty(ze.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(ze.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(ze.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(ze.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),ze.prototype.join=function(Z){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(P).join(Z)},ze.prototype.multiply=function(Z){var fe=Z.sx*this.sx+Z.shy*this.shx,Ie=Z.sx*this.shy+Z.shy*this.sy,Ue=Z.shx*this.sx+Z.sy*this.shx,tt=Z.shx*this.shy+Z.sy*this.sy,wt=Z.tx*this.sx+Z.ty*this.shx+this.tx,Ot=Z.tx*this.shy+Z.ty*this.sy+this.ty;return new ze(fe,Ie,Ue,tt,wt,Ot)},ze.prototype.decompose=function(){var Z=this.sx,fe=this.shy,Ie=this.shx,Ue=this.sy,tt=this.tx,wt=this.ty,Ot=Math.sqrt(Z*Z+fe*fe),tr=(Z/=Ot)*Ie+(fe/=Ot)*Ue;Ie-=Z*tr,Ue-=fe*tr;var Xt=Math.sqrt(Ie*Ie+Ue*Ue);return tr/=Xt,Z*(Ue/=Xt)<fe*(Ie/=Xt)&&(Z=-Z,fe=-fe,tr=-tr,Ot=-Ot),{scale:new ze(Ot,0,0,Xt,0,0),translate:new ze(1,0,0,1,tt,wt),rotate:new ze(Z,fe,-fe,Z,0,0),skew:new ze(1,0,tr,1,0,0)}},ze.prototype.toString=function(Z){return this.join(" ")},ze.prototype.inversed=function(){var Z=this.sx,fe=this.shy,Ie=this.shx,Ue=this.sy,tt=this.tx,wt=this.ty,Ot=1/(Z*Ue-fe*Ie),tr=Ue*Ot,Xt=-fe*Ot,_r=-Ie*Ot,Pr=Z*Ot;return new ze(tr,Xt,_r,Pr,-tr*tt-_r*wt,-Xt*tt-Pr*wt)},ze.prototype.applyToPoint=function(Z){var fe=Z.x*this.sx+Z.y*this.shx+this.tx,Ie=Z.x*this.shy+Z.y*this.sy+this.ty;return new Ec(fe,Ie)},ze.prototype.applyToRectangle=function(Z){var fe=this.applyToPoint(Z),Ie=this.applyToPoint(new Ec(Z.x+Z.w,Z.y+Z.h));return new Ya(fe.x,fe.y,Ie.x-fe.x,Ie.y-fe.y)},ze.prototype.clone=function(){var Z=this.sx,fe=this.shy,Ie=this.shx,Ue=this.sy,tt=this.tx,wt=this.ty;return new ze(Z,fe,Ie,Ue,tt,wt)},p.Matrix=ze;var Le=p.matrixMult=function(Z,fe){return fe.multiply(Z)},Qe=new ze(1,0,0,1,0,0);p.unitMatrix=p.identityMatrix=Qe;var mt=function(Z,fe){if(!lt[Z]){var Ie=(fe instanceof ah?"Sh":"P")+(Object.keys(Ce).length+1).toString(10);fe.id=Ie,lt[Z]=Ie,Ce[Ie]=fe,ce.publish("addPattern",fe)}};p.ShadingPattern=ah,p.TilingPattern=um,p.addShadingPattern=function(Z,fe){return N("addShadingPattern()"),mt(Z,fe),this},p.beginTilingPattern=function(Z){N("beginTilingPattern()"),Tc(Z.boundingBox[0],Z.boundingBox[1],Z.boundingBox[2]-Z.boundingBox[0],Z.boundingBox[3]-Z.boundingBox[1],Z.matrix)},p.endTilingPattern=function(Z,fe){N("endTilingPattern()"),fe.stream=de[q].join(`
`),mt(Z,fe),ce.publish("endTilingPattern",fe),Re.pop().restore()};var ft,It=p.__private__.newObject=function(){var Z=Bt();return dr(Z,!0),Z},Bt=p.__private__.newObjectDeferred=function(){return Q++,K[Q]=function(){return H},Q},dr=function(Z,fe){return fe=typeof fe=="boolean"&&fe,K[Z]=H,fe&&se(Z+" 0 obj"),Z},pr=p.__private__.newAdditionalObject=function(){var Z={objId:Bt(),content:""};return ie.push(Z),Z},an=Bt(),Jn=Bt(),Fi=p.__private__.decodeColorString=function(Z){var fe=Z.split(" ");if(fe.length!==2||fe[1]!=="g"&&fe[1]!=="G")fe.length!==5||fe[4]!=="k"&&fe[4]!=="K"||(fe=[(1-fe[0])*(1-fe[3]),(1-fe[1])*(1-fe[3]),(1-fe[2])*(1-fe[3]),"r"]);else{var Ie=parseFloat(fe[0]);fe=[Ie,Ie,Ie,"r"]}for(var Ue="#",tt=0;tt<3;tt++)Ue+=("0"+Math.floor(255*parseFloat(fe[tt])).toString(16)).slice(-2);return Ue},Fn=p.__private__.encodeColorString=function(Z){var fe;typeof Z=="string"&&(Z={ch1:Z});var Ie=Z.ch1,Ue=Z.ch2,tt=Z.ch3,wt=Z.ch4,Ot=Z.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof Ie=="string"&&Ie.charAt(0)!=="#"){var tr=new PZ(Ie);if(tr.ok)Ie=tr.toHex();else if(!/^\d*\.?\d*$/.test(Ie))throw new Error('Invalid color "'+Ie+'" passed to jsPDF.encodeColorString.')}if(typeof Ie=="string"&&/^#[0-9A-Fa-f]{3}$/.test(Ie)&&(Ie="#"+Ie[1]+Ie[1]+Ie[2]+Ie[2]+Ie[3]+Ie[3]),typeof Ie=="string"&&/^#[0-9A-Fa-f]{6}$/.test(Ie)){var Xt=parseInt(Ie.substr(1),16);Ie=Xt>>16&255,Ue=Xt>>8&255,tt=255&Xt}if(Ue===void 0||wt===void 0&&Ie===Ue&&Ue===tt)fe=typeof Ie=="string"?Ie+" "+Ot[0]:Z.precision===2?C(Ie/255)+" "+Ot[0]:I(Ie/255)+" "+Ot[0];else if(wt===void 0||On(wt)==="object"){if(wt&&!isNaN(wt.a)&&wt.a===0)return["1.","1.","1.",Ot[1]].join(" ");fe=typeof Ie=="string"?[Ie,Ue,tt,Ot[1]].join(" "):Z.precision===2?[C(Ie/255),C(Ue/255),C(tt/255),Ot[1]].join(" "):[I(Ie/255),I(Ue/255),I(tt/255),Ot[1]].join(" ")}else fe=typeof Ie=="string"?[Ie,Ue,tt,wt,Ot[2]].join(" "):Z.precision===2?[C(Ie),C(Ue),C(tt),C(wt),Ot[2]].join(" "):[I(Ie),I(Ue),I(tt),I(wt),Ot[2]].join(" ");return fe},Bo=p.__private__.getFilters=function(){return s},io=p.__private__.putStream=function(Z){var fe=(Z=Z||{}).data||"",Ie=Z.filters||Bo(),Ue=Z.alreadyAppliedFilters||[],tt=Z.addLength1||!1,wt=fe.length,Ot=Z.objectId,tr=function(Mn){return Mn};if(d!==null&&Ot===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");d!==null&&(tr=Gi.encryptor(Ot,0));var Xt={};Ie===!0&&(Ie=["FlateEncode"]);var _r=Z.additionalKeyValues||[],Pr=(Xt=fr.API.processDataByFilters!==void 0?fr.API.processDataByFilters(fe,Ie):{data:fe,reverseChain:[]}).reverseChain+(Array.isArray(Ue)?Ue.join(" "):Ue.toString());if(Xt.data.length!==0&&(_r.push({key:"Length",value:Xt.data.length}),tt===!0&&_r.push({key:"Length1",value:wt})),Pr.length!=0)if(Pr.split("/").length-1==1)_r.push({key:"Filter",value:Pr});else{_r.push({key:"Filter",value:"["+Pr+"]"});for(var Kr=0;Kr<_r.length;Kr+=1)if(_r[Kr].key==="DecodeParms"){for(var ki=[],kn=0;kn<Xt.reverseChain.split("/").length-1;kn+=1)ki.push("null");ki.push(_r[Kr].value),_r[Kr].value="["+ki.join(" ")+"]"}}se("<<");for(var fn=0;fn<_r.length;fn++)se("/"+_r[fn].key+" "+_r[fn].value);se(">>"),Xt.data.length!==0&&(se("stream"),se(tr(Xt.data)),se("endstream"))},Wo=p.__private__.putPage=function(Z){var fe=Z.number,Ie=Z.data,Ue=Z.objId,tt=Z.contentsObjId;dr(Ue,!0),se("<</Type /Page"),se("/Parent "+Z.rootDictionaryObjId+" 0 R"),se("/Resources "+Z.resourceDictionaryObjId+" 0 R"),se("/MediaBox ["+parseFloat(P(Z.mediaBox.bottomLeftX))+" "+parseFloat(P(Z.mediaBox.bottomLeftY))+" "+P(Z.mediaBox.topRightX)+" "+P(Z.mediaBox.topRightY)+"]"),Z.cropBox!==null&&se("/CropBox ["+P(Z.cropBox.bottomLeftX)+" "+P(Z.cropBox.bottomLeftY)+" "+P(Z.cropBox.topRightX)+" "+P(Z.cropBox.topRightY)+"]"),Z.bleedBox!==null&&se("/BleedBox ["+P(Z.bleedBox.bottomLeftX)+" "+P(Z.bleedBox.bottomLeftY)+" "+P(Z.bleedBox.topRightX)+" "+P(Z.bleedBox.topRightY)+"]"),Z.trimBox!==null&&se("/TrimBox ["+P(Z.trimBox.bottomLeftX)+" "+P(Z.trimBox.bottomLeftY)+" "+P(Z.trimBox.topRightX)+" "+P(Z.trimBox.topRightY)+"]"),Z.artBox!==null&&se("/ArtBox ["+P(Z.artBox.bottomLeftX)+" "+P(Z.artBox.bottomLeftY)+" "+P(Z.artBox.topRightX)+" "+P(Z.artBox.topRightY)+"]"),typeof Z.userUnit=="number"&&Z.userUnit!==1&&se("/UserUnit "+Z.userUnit),ce.publish("putPage",{objId:Ue,pageContext:We[fe],pageNumber:fe,page:Ie}),se("/Contents "+tt+" 0 R"),se(">>"),se("endobj");var wt=Ie.join(`
`);return j===k&&(wt+=`
Q`),dr(tt,!0),io({data:wt,filters:Bo(),objectId:tt}),se("endobj"),Ue},Yi=p.__private__.putPages=function(){var Z,fe,Ie=[];for(Z=1;Z<=Tt;Z++)We[Z].objId=Bt(),We[Z].contentsObjId=Bt();for(Z=1;Z<=Tt;Z++)Ie.push(Wo({number:Z,data:de[Z],objId:We[Z].objId,contentsObjId:We[Z].contentsObjId,mediaBox:We[Z].mediaBox,cropBox:We[Z].cropBox,bleedBox:We[Z].bleedBox,trimBox:We[Z].trimBox,artBox:We[Z].artBox,userUnit:We[Z].userUnit,rootDictionaryObjId:an,resourceDictionaryObjId:Jn}));dr(an,!0),se("<</Type /Pages");var Ue="/Kids [";for(fe=0;fe<Tt;fe++)Ue+=Ie[fe]+" 0 R ";se(Ue+"]"),se("/Count "+Tt),se(">>"),se("endobj"),ce.publish("postPutPages")},qo=function(Z){ce.publish("putFont",{font:Z,out:se,newObject:It,putStream:io}),Z.isAlreadyPutted!==!0&&(Z.objectNumber=It(),se("<<"),se("/Type /Font"),se("/BaseFont /"+Jg(Z.postScriptName)),se("/Subtype /Type1"),typeof Z.encoding=="string"&&se("/Encoding /"+Z.encoding),se("/FirstChar 32"),se("/LastChar 255"),se(">>"),se("endobj"))},Ca=function(Z){Z.objectNumber=It();var fe=[];fe.push({key:"Type",value:"/XObject"}),fe.push({key:"Subtype",value:"/Form"}),fe.push({key:"BBox",value:"["+[P(Z.x),P(Z.y),P(Z.x+Z.width),P(Z.y+Z.height)].join(" ")+"]"}),fe.push({key:"Matrix",value:"["+Z.matrix.toString()+"]"});var Ie=Z.pages[1].join(`
`);io({data:Ie,additionalKeyValues:fe,objectId:Z.objectNumber}),se("endobj")},xs=function(Z,fe){fe||(fe=21);var Ie=It(),Ue=(function(Ot,tr){var Xt,_r=[],Pr=1/(tr-1);for(Xt=0;Xt<1;Xt+=Pr)_r.push(Xt);if(_r.push(1),Ot[0].offset!=0){var Kr={offset:0,color:Ot[0].color};Ot.unshift(Kr)}if(Ot[Ot.length-1].offset!=1){var ki={offset:1,color:Ot[Ot.length-1].color};Ot.push(ki)}for(var kn="",fn=0,Mn=0;Mn<_r.length;Mn++){for(Xt=_r[Mn];Xt>Ot[fn+1].offset;)fn++;var ei=Ot[fn].offset,ti=(Xt-ei)/(Ot[fn+1].offset-ei),bo=Ot[fn].color,Cs=Ot[fn+1].color;kn+=U(Math.round((1-ti)*bo[0]+ti*Cs[0]).toString(16))+U(Math.round((1-ti)*bo[1]+ti*Cs[1]).toString(16))+U(Math.round((1-ti)*bo[2]+ti*Cs[2]).toString(16))}return kn.trim()})(Z.colors,fe),tt=[];tt.push({key:"FunctionType",value:"0"}),tt.push({key:"Domain",value:"[0.0 1.0]"}),tt.push({key:"Size",value:"["+fe+"]"}),tt.push({key:"BitsPerSample",value:"8"}),tt.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),tt.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),io({data:Ue,additionalKeyValues:tt,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:Ie}),se("endobj"),Z.objectNumber=It(),se("<< /ShadingType "+Z.type),se("/ColorSpace /DeviceRGB");var wt="/Coords ["+P(parseFloat(Z.coords[0]))+" "+P(parseFloat(Z.coords[1]))+" ";Z.type===2?wt+=P(parseFloat(Z.coords[2]))+" "+P(parseFloat(Z.coords[3])):wt+=P(parseFloat(Z.coords[2]))+" "+P(parseFloat(Z.coords[3]))+" "+P(parseFloat(Z.coords[4]))+" "+P(parseFloat(Z.coords[5])),se(wt+="]"),Z.matrix&&se("/Matrix ["+Z.matrix.toString()+"]"),se("/Function "+Ie+" 0 R"),se("/Extend [true true]"),se(">>"),se("endobj")},el=function(Z,fe){var Ie=Bt(),Ue=It();fe.push({resourcesOid:Ie,objectOid:Ue}),Z.objectNumber=Ue;var tt=[];tt.push({key:"Type",value:"/Pattern"}),tt.push({key:"PatternType",value:"1"}),tt.push({key:"PaintType",value:"1"}),tt.push({key:"TilingType",value:"1"}),tt.push({key:"BBox",value:"["+Z.boundingBox.map(P).join(" ")+"]"}),tt.push({key:"XStep",value:P(Z.xStep)}),tt.push({key:"YStep",value:P(Z.yStep)}),tt.push({key:"Resources",value:Ie+" 0 R"}),Z.matrix&&tt.push({key:"Matrix",value:"["+Z.matrix.toString()+"]"}),io({data:Z.stream,additionalKeyValues:tt,objectId:Z.objectNumber}),se("endobj")},op=function(Z){for(var fe in Z.objectNumber=It(),se("<<"),Z)switch(fe){case"opacity":se("/ca "+C(Z[fe]));break;case"stroke-opacity":se("/CA "+C(Z[fe]))}se(">>"),se("endobj")},jn=function(Z){dr(Z.resourcesOid,!0),se("<<"),se("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),(function(){for(var fe in se("/Font <<"),Et)Et.hasOwnProperty(fe)&&(f===!1||f===!0&&h.hasOwnProperty(fe))&&se("/"+fe+" "+Et[fe].objectNumber+" 0 R");se(">>")})(),(function(){if(Object.keys(Ce).length>0){for(var fe in se("/Shading <<"),Ce)Ce.hasOwnProperty(fe)&&Ce[fe]instanceof ah&&Ce[fe].objectNumber>=0&&se("/"+fe+" "+Ce[fe].objectNumber+" 0 R");ce.publish("putShadingPatternDict"),se(">>")}})(),(function(fe){if(Object.keys(Ce).length>0){for(var Ie in se("/Pattern <<"),Ce)Ce.hasOwnProperty(Ie)&&Ce[Ie]instanceof p.TilingPattern&&Ce[Ie].objectNumber>=0&&Ce[Ie].objectNumber<fe&&se("/"+Ie+" "+Ce[Ie].objectNumber+" 0 R");ce.publish("putTilingPatternDict"),se(">>")}})(Z.objectOid),(function(){if(Object.keys(Xe).length>0){var fe;for(fe in se("/ExtGState <<"),Xe)Xe.hasOwnProperty(fe)&&Xe[fe].objectNumber>=0&&se("/"+fe+" "+Xe[fe].objectNumber+" 0 R");ce.publish("putGStateDict"),se(">>")}})(),(function(){for(var fe in se("/XObject <<"),je)je.hasOwnProperty(fe)&&je[fe].objectNumber>=0&&se("/"+fe+" "+je[fe].objectNumber+" 0 R");ce.publish("putXobjectDict"),se(">>")})(),se(">>"),se("endobj")},Ld=function(Z){vt[Z.fontName]=vt[Z.fontName]||{},vt[Z.fontName][Z.fontStyle]=Z.id},tl=function(Z,fe,Ie,Ue,tt){var wt={id:"F"+(Object.keys(Et).length+1).toString(10),postScriptName:Z,fontName:fe,fontStyle:Ie,encoding:Ue,isStandardFont:tt||!1,metadata:{}};return ce.publish("addFont",{font:wt,instance:this}),Et[wt.id]=wt,Ld(wt),wt.id},Mt=p.__private__.pdfEscape=p.pdfEscape=function(Z,fe){return(function(Ie,Ue){var tt,wt,Ot,tr,Xt,_r,Pr,Kr,ki;if(Ot=(Ue=Ue||{}).sourceEncoding||"Unicode",Xt=Ue.outputEncoding,(Ue.autoencode||Xt)&&Et[st].metadata&&Et[st].metadata[Ot]&&Et[st].metadata[Ot].encoding&&(tr=Et[st].metadata[Ot].encoding,!Xt&&Et[st].encoding&&(Xt=Et[st].encoding),!Xt&&tr.codePages&&(Xt=tr.codePages[0]),typeof Xt=="string"&&(Xt=tr[Xt]),Xt)){for(Pr=!1,_r=[],tt=0,wt=Ie.length;tt<wt;tt++)(Kr=Xt[Ie.charCodeAt(tt)])?_r.push(String.fromCharCode(Kr)):_r.push(Ie[tt]),_r[tt].charCodeAt(0)>>8&&(Pr=!0);Ie=_r.join("")}for(tt=Ie.length;Pr===void 0&&tt!==0;)Ie.charCodeAt(tt-1)>>8&&(Pr=!0),tt--;if(!Pr)return Ie;for(_r=Ue.noBOM?[]:[254,255],tt=0,wt=Ie.length;tt<wt;tt++){if((ki=(Kr=Ie.charCodeAt(tt))>>8)>>8)throw new Error("Character at position "+tt+" of string '"+Ie+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");_r.push(ki),_r.push(Kr-(ki<<8))}return String.fromCharCode.apply(void 0,_r)})(Z,fe).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},xr=p.__private__.beginPage=function(Z){de[++Tt]=[],We[Tt]={objId:0,contentsObjId:0,userUnit:Number(l),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(Z[0]),topRightY:Number(Z[1])}},Wt(Tt),ve(de[q])},$n=function(Z,fe){var Ie,Ue,tt;switch(r=fe||r,typeof Z=="string"&&(Ie=x(Z.toLowerCase()),Array.isArray(Ie)&&(Ue=Ie[0],tt=Ie[1])),Array.isArray(Z)&&(Ue=Z[0]*Te,tt=Z[1]*Te),isNaN(Ue)&&(Ue=o[0],tt=o[1]),(Ue>14400||tt>14400)&&(Bn.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Ue=Math.min(14400,Ue),tt=Math.min(14400,tt)),o=[Ue,tt],r.substr(0,1)){case"l":tt>Ue&&(o=[tt,Ue]);break;case"p":Ue>tt&&(o=[tt,Ue])}xr(o),qv(hr),se(sl),bu!==0&&se(bu+" J"),ks!==0&&se(ks+" j"),ce.publish("addPage",{pageNumber:Tt})},yo=function(Z){Z>0&&Z<=Tt&&(de.splice(Z,1),We.splice(Z,1),Tt--,q>Tt&&(q=Tt),this.setPage(q))},Wt=function(Z){Z>0&&Z<=Tt&&(q=Z)},zn=p.__private__.getNumberOfPages=p.getNumberOfPages=function(){return de.length-1},gu=function(Z,fe,Ie){var Ue,tt=void 0;return Ie=Ie||{},Z=Z!==void 0?Z:Et[st].fontName,fe=fe!==void 0?fe:Et[st].fontStyle,Ue=Z.toLowerCase(),vt[Ue]!==void 0&&vt[Ue][fe]!==void 0?tt=vt[Ue][fe]:vt[Z]!==void 0&&vt[Z][fe]!==void 0?tt=vt[Z][fe]:Ie.disableWarning===!1&&Bn.warn("Unable to look up font label for font '"+Z+"', '"+fe+"'. Refer to getFontList() for available fonts."),tt||Ie.noFallback||(tt=vt.times[fe])==null&&(tt=vt.times.normal),tt},Gr=p.__private__.putInfo=function(){var Z=It(),fe=function(Ue){return Ue};for(var Ie in d!==null&&(fe=Gi.encryptor(Z,0)),se("<<"),se("/Producer ("+Mt(fe("jsPDF "+fr.version))+")"),xt)xt.hasOwnProperty(Ie)&&xt[Ie]&&se("/"+Ie.substr(0,1).toUpperCase()+Ie.substr(1)+" ("+Mt(fe(xt[Ie]))+")");se("/CreationDate ("+Mt(fe(M))+")"),se(">>"),se("endobj")},rl=p.__private__.putCatalog=function(Z){var fe=(Z=Z||{}).rootDictionaryObjId||an;switch(It(),se("<<"),se("/Type /Catalog"),se("/Pages "+fe+" 0 R"),Me||(Me="fullwidth"),Me){case"fullwidth":se("/OpenAction [3 0 R /FitH null]");break;case"fullheight":se("/OpenAction [3 0 R /FitV null]");break;case"fullpage":se("/OpenAction [3 0 R /Fit]");break;case"original":se("/OpenAction [3 0 R /XYZ null null 1]");break;default:var Ie=""+Me;Ie.substr(Ie.length-1)==="%"&&(Me=parseInt(Me)/100),typeof Me=="number"&&se("/OpenAction [3 0 R /XYZ null null "+C(Me)+"]")}switch(Ye||(Ye="continuous"),Ye){case"continuous":se("/PageLayout /OneColumn");break;case"single":se("/PageLayout /SinglePage");break;case"two":case"twoleft":se("/PageLayout /TwoColumnLeft");break;case"tworight":se("/PageLayout /TwoColumnRight")}Ee&&se("/PageMode /"+Ee),ce.publish("putCatalog"),se(">>"),se("endobj")},Bv=p.__private__.putTrailer=function(){se("trailer"),se("<<"),se("/Size "+(Q+1)),se("/Root "+Q+" 0 R"),se("/Info "+(Q-1)+" 0 R"),d!==null&&se("/Encrypt "+Gi.oid+" 0 R"),se("/ID [ <"+Y+"> <"+Y+"> ]"),se(">>")},ji=p.__private__.putHeader=function(){se("%PDF-"+v),se("%ºß¬à")},mu=p.__private__.putXRef=function(){var Z="0000000000";se("xref"),se("0 "+(Q+1)),se("0000000000 65535 f ");for(var fe=1;fe<=Q;fe++)typeof K[fe]=="function"?se((Z+K[fe]()).slice(-10)+" 00000 n "):K[fe]!==void 0?se((Z+K[fe]).slice(-10)+" 00000 n "):se("0000000000 00000 n ")},Ea=p.__private__.buildDocument=function(){var Z;Q=0,H=0,re=[],K=[],ie=[],an=Bt(),Jn=Bt(),ve(re),ce.publish("buildDocument"),ji(),Yi(),(function(){ce.publish("putAdditionalObjects");for(var Ie=0;Ie<ie.length;Ie++){var Ue=ie[Ie];dr(Ue.objId,!0),se(Ue.content),se("endobj")}ce.publish("postPutAdditionalObjects")})(),Z=[],(function(){for(var Ie in Et)Et.hasOwnProperty(Ie)&&(f===!1||f===!0&&h.hasOwnProperty(Ie))&&qo(Et[Ie])})(),(function(){var Ie;for(Ie in Xe)Xe.hasOwnProperty(Ie)&&op(Xe[Ie])})(),(function(){for(var Ie in je)je.hasOwnProperty(Ie)&&Ca(je[Ie])})(),(function(Ie){var Ue;for(Ue in Ce)Ce.hasOwnProperty(Ue)&&(Ce[Ue]instanceof ah?xs(Ce[Ue]):Ce[Ue]instanceof um&&el(Ce[Ue],Ie))})(Z),ce.publish("putResources"),Z.forEach(jn),jn({resourcesOid:Jn,objectOid:Number.MAX_SAFE_INTEGER}),ce.publish("postPutResources"),d!==null&&(Gi.oid=It(),se("<<"),se("/Filter /Standard"),se("/V "+Gi.v),se("/R "+Gi.r),se("/U <"+Gi.toHexString(Gi.U)+">"),se("/O <"+Gi.toHexString(Gi.O)+">"),se("/P "+Gi.P),se(">>"),se("endobj")),Gr(),rl();var fe=H;return mu(),Bv(),se("startxref"),se(""+fe),se("%%EOF"),ve(de[q]),re.join(`
`)},nl=p.__private__.getBlob=function(Z){return new Blob([De(Z)],{type:"application/pdf"})},_c=function(Z){for(;Z.firstChild;)Z.removeChild(Z.firstChild)},Aa=function(Z){var fe,Ie=Z.document,Ue=Ie.documentElement,tt=Ie.head,wt=Ie.body;return tt||(tt=Ie.createElement("head"),Ue.appendChild(tt)),wt||(wt=Ie.createElement("body"),Ue.appendChild(wt)),_c(tt),_c(wt),(fe=Ie.createElement("style")).appendChild(Ie.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),tt.appendChild(fe),{document:Ie,body:wt}},Fd=p.output=p.__private__.output=(ft=function(Z,fe){switch(typeof(fe=fe||{})=="string"?fe={filename:fe}:fe.filename=fe.filename||"generated.pdf",Z){case void 0:return Ea();case"save":p.save(fe.filename);break;case"arraybuffer":return De(Ea());case"blob":return nl(Ea());case"bloburi":case"bloburl":if(Er.URL!==void 0&&typeof Er.URL.createObjectURL=="function")return Er.URL&&Er.URL.createObjectURL(nl(Ea()))||void 0;Bn.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var Ie="",Ue=Ea();try{Ie=nq(Ue)}catch{Ie=nq(unescape(encodeURIComponent(Ue)))}return"data:application/pdf;filename="+encodeURIComponent(fe.filename)+";base64,"+Ie;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Er)==="[object Window]"){var tt="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",wt=!fe.pdfObjectUrl;wt||(tt=fe.pdfObjectUrl);var Ot=Er.open();if(Ot!==null){var tr=Aa(Ot),Xt=tr.document.createElement("script"),_r=this;Xt.src=tt,wt&&(Xt.integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==",Xt.crossOrigin="anonymous"),Xt.onload=function(){Ot.PDFObject.embed(_r.output("dataurlstring"),fe)},tr.body.appendChild(Xt)}return Ot}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(Er)==="[object Window]"){var Pr=fe.pdfJsUrl||"examples/PDF.js/web/viewer.html",Kr=Er.open();if(Kr!==null){var ki=Aa(Kr),kn=ki.document.createElement("iframe"),fn=Pr.indexOf("?")===-1?"?":"&";_r=this,kn.id="pdfViewer",kn.width="500px",kn.height="400px",kn.src=Pr+fn+"file=&downloadName="+encodeURIComponent(fe.filename),kn.onload=function(){Kr.document.title=fe.filename,kn.contentWindow.PDFViewerApplication.open(_r.output("bloburl"))},ki.body.appendChild(kn)}return Kr}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(Er)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var Mn=Er.open();if(Mn!==null){var ei=Aa(Mn),ti=ei.document.createElement("iframe");ti.src=this.output("datauristring",fe),ei.body.appendChild(ti),Mn.document.title=fe.filename}if(Mn||typeof safari>"u")return Mn;break;case"datauri":case"dataurl":return Er.document.location.href=this.output("datauristring",fe);default:return null}},ft.foo=function(){try{return ft.apply(this,arguments)}catch(Ie){var Z=Ie.stack||"";~Z.indexOf(" at ")&&(Z=Z.split(" at ")[1]);var fe="Error in function "+Z.split(`
`)[0].split("<")[0]+": "+Ie.message;if(!Er.console)throw new Error(fe);Er.console.error(fe,Ie),Er.alert&&alert(fe)}},ft.foo.bar=ft,ft.foo),bs=function(Z){return Array.isArray(he)===!0&&he.indexOf(Z)>-1};switch(n){case"pt":Te=1;break;case"mm":Te=72/25.4;break;case"cm":Te=72/2.54;break;case"in":Te=72;break;case"px":Te=bs("px_scaling")==1?.75:96/72;break;case"pc":case"em":Te=12;break;case"ex":Te=6;break;default:if(typeof n!="number")throw new Error("Invalid unit: "+n);Te=n}var Gi=null;D(),$();var zd=p.__private__.getPageInfo=p.getPageInfo=function(Z){if(isNaN(Z)||Z%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:We[Z].objId,pageNumber:Z,pageContext:We[Z]}},vu=p.__private__.getPageInfoByObjId=function(Z){if(isNaN(Z)||Z%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var fe in We)if(We[fe].objId===Z)break;return zd(fe)},Wv=p.__private__.getCurrentPageInfo=p.getCurrentPageInfo=function(){return{objId:We[q].objId,pageNumber:q,pageContext:We[q]}};p.addPage=function(){return $n.apply(this,arguments),this},p.setPage=function(){return Wt.apply(this,arguments),ve.call(this,de[q]),this},p.insertPage=function(Z){return this.addPage(),this.movePage(q,Z),this},p.movePage=function(Z,fe){var Ie,Ue;if(Z>fe){Ie=de[Z],Ue=We[Z];for(var tt=Z;tt>fe;tt--)de[tt]=de[tt-1],We[tt]=We[tt-1];de[fe]=Ie,We[fe]=Ue,this.setPage(fe)}else if(Z<fe){Ie=de[Z],Ue=We[Z];for(var wt=Z;wt<fe;wt++)de[wt]=de[wt+1],We[wt]=We[wt+1];de[fe]=Ie,We[fe]=Ue,this.setPage(fe)}return this},p.deletePage=function(){return yo.apply(this,arguments),this},p.__private__.text=p.text=function(Z,fe,Ie,Ue,tt){var wt,Ot,tr,Xt,_r,Pr,Kr,ki,kn,fn=(Ue=Ue||{}).scope||this;if(typeof Z=="number"&&typeof fe=="number"&&(typeof Ie=="string"||Array.isArray(Ie))){var Mn=Ie;Ie=fe,fe=Z,Z=Mn}if(arguments[3]instanceof ze==0?(tr=arguments[4],Xt=arguments[5],On(Kr=arguments[3])==="object"&&Kr!==null||(typeof tr=="string"&&(Xt=tr,tr=null),typeof Kr=="string"&&(Xt=Kr,Kr=null),typeof Kr=="number"&&(tr=Kr,Kr=null),Ue={flags:Kr,angle:tr,align:Xt})):(N("The transform parameter of text() with a Matrix value"),kn=tt),isNaN(fe)||isNaN(Ie)||Z==null)throw new Error("Invalid arguments passed to jsPDF.text");if(Z.length===0)return fn;var ei,ti="",bo=typeof Ue.lineHeightFactor=="number"?Ue.lineHeightFactor:js,Cs=fn.internal.scaleFactor;function cp(_n){return _n=_n.split(" ").join(Array(Ue.TabLen||9).join(" ")),Mt(_n,Kr)}function ku(_n){for(var Cn,ri=_n.concat(),Mi=[],$l=ri.length;$l--;)typeof(Cn=ri.shift())=="string"?Mi.push(Cn):Array.isArray(_n)&&(Cn.length===1||Cn[1]===void 0&&Cn[2]===void 0)?Mi.push(Cn[0]):Mi.push([Cn[0],Cn[1],Cn[2]]);return Mi}function _u(_n,Cn){var ri;if(typeof _n=="string")ri=Cn(_n)[0];else if(Array.isArray(_n)){for(var Mi,$l,dl=_n.concat(),Nc=[],Rc=dl.length;Rc--;)typeof(Mi=dl.shift())=="string"?Nc.push(Cn(Mi)[0]):Array.isArray(Mi)&&typeof Mi[0]=="string"&&($l=Cn(Mi[0],Mi[1],Mi[2]),Nc.push([$l[0],$l[1],$l[2]]));ri=Nc}return ri}var Wl=!1,Cu=!0;if(typeof Z=="string")Wl=!0;else if(Array.isArray(Z)){var qd=Z.concat();Ot=[];for(var $d,wo=qd.length;wo--;)(typeof($d=qd.shift())!="string"||Array.isArray($d)&&typeof $d[0]!="string")&&(Cu=!1);Wl=Cu}if(Wl===!1)throw new Error('Type of text must be string or Array. "'+Z+'" is not recognized.');typeof Z=="string"&&(Z=Z.match(/[\r?\n]/)?Z.split(/\r\n|\r|\n/g):[Z]);var Eu=ue/fn.internal.scaleFactor,Au=Eu*(bo-1);switch(Ue.baseline){case"bottom":Ie-=Au;break;case"top":Ie+=Eu-Au;break;case"hanging":Ie+=Eu-2*Au;break;case"middle":Ie+=Eu/2-Au}if((Pr=Ue.maxWidth||0)>0&&(typeof Z=="string"?Z=fn.splitTextToSize(Z,Pr):Object.prototype.toString.call(Z)==="[object Array]"&&(Z=Z.reduce(function(_n,Cn){return _n.concat(fn.splitTextToSize(Cn,Pr))},[]))),wt={text:Z,x:fe,y:Ie,options:Ue,mutex:{pdfEscape:Mt,activeFontKey:st,fonts:Et,activeFontSize:ue}},ce.publish("preProcessText",wt),Z=wt.text,tr=(Ue=wt.options).angle,kn instanceof ze==0&&tr&&typeof tr=="number"){tr*=Math.PI/180,Ue.rotationDirection===0&&(tr=-tr),j===k&&(tr=-tr);var up=Math.cos(tr),Ka=Math.sin(tr);kn=new ze(up,Ka,-Ka,up,0,0)}else tr&&tr instanceof ze&&(kn=tr);j!==k||kn||(kn=Qe),(_r=Ue.charSpace||Bd)!==void 0&&(ti+=P(R(_r))+` Tc
`,this.setCharSpace(this.getCharSpace()||0)),(ki=Ue.horizontalScale)!==void 0&&(ti+=P(100*ki)+` Tz
`),Ue.lang;var zi=-1,cg=Ue.renderingMode!==void 0?Ue.renderingMode:Ue.stroke,Tu=fn.internal.getCurrentPageInfo().pageContext;switch(cg){case 0:case!1:case"fill":zi=0;break;case 1:case!0:case"stroke":zi=1;break;case 2:case"fillThenStroke":zi=2;break;case 3:case"invisible":zi=3;break;case 4:case"fillAndAddForClipping":zi=4;break;case 5:case"strokeAndAddPathForClipping":zi=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":zi=6;break;case 7:case"addToPathForClipping":zi=7}var dp=Tu.usedRenderingMode!==void 0?Tu.usedRenderingMode:-1;zi!==-1?ti+=zi+` Tr
`:dp!==-1&&(ti+=`0 Tr
`),zi!==-1&&(Tu.usedRenderingMode=zi),Xt=Ue.align||"left";var Ta,Pc=ue*bo,Ud=fn.internal.pageSize.getWidth(),Es=Et[st];_r=Ue.charSpace||Bd,Pr=Ue.maxWidth||0,Kr=Object.assign({autoencode:!0,noBOM:!0},Ue.flags);var Pu=[],fp=function(_n){return fn.getStringUnitWidth(_n,{font:Es,charSpace:_r,fontSize:ue,doKerning:!1})*ue/Cs};if(Object.prototype.toString.call(Z)==="[object Array]"){var Ho;Ot=ku(Z),Xt!=="left"&&(Ta=Ot.map(fp));var Vo,Iu=0;if(Xt==="right"){fe-=Ta[0],Z=[],wo=Ot.length;for(var Qa=0;Qa<wo;Qa++)Qa===0?(Vo=al(fe),Ho=Va(Ie)):(Vo=R(Iu-Ta[Qa]),Ho=-Pc),Z.push([Ot[Qa],Vo,Ho]),Iu=Ta[Qa]}else if(Xt==="center"){fe-=Ta[0]/2,Z=[],wo=Ot.length;for(var Xa=0;Xa<wo;Xa++)Xa===0?(Vo=al(fe),Ho=Va(Ie)):(Vo=R((Iu-Ta[Xa])/2),Ho=-Pc),Z.push([Ot[Xa],Vo,Ho]),Iu=Ta[Xa]}else if(Xt==="left"){Z=[],wo=Ot.length;for(var Hd=0;Hd<wo;Hd++)Z.push(Ot[Hd])}else if(Xt==="justify"&&Es.encoding==="Identity-H"){Z=[],wo=Ot.length,Pr=Pr!==0?Pr:Ud;for(var cl=0,_i=0;_i<wo;_i++)if(Ho=_i===0?Va(Ie):-Pc,Vo=_i===0?al(fe):cl,_i<wo-1){var ug=R((Pr-Ta[_i])/(Ot[_i].split(" ").length-1)),Za=Ot[_i].split(" ");Z.push([Za[0]+" ",Vo,Ho]),cl=0;for(var Pa=1;Pa<Za.length;Pa++){var Ic=(fp(Za[Pa-1]+" "+Za[Pa])-fp(Za[Pa]))*Cs+ug;Pa==Za.length-1?Z.push([Za[Pa],Ic,0]):Z.push([Za[Pa]+" ",Ic,0]),cl-=Ic}}else Z.push([Ot[_i],Vo,Ho]);Z.push(["",cl,0])}else{if(Xt!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(Z=[],wo=Ot.length,Pr=Pr!==0?Pr:Ud,_i=0;_i<wo;_i++){Ho=_i===0?Va(Ie):-Pc,Vo=_i===0?al(fe):0;var Vd=Ot[_i].split(" ").length-1,Yd=Vd>0?(Pr-Ta[_i])/Vd:0;_i<wo-1?Pu.push(P(R(Yd))):Pu.push(0),Z.push([Ot[_i],Vo,Ho])}}}(typeof Ue.R2L=="boolean"?Ue.R2L:Pe)===!0&&(Z=_u(Z,function(_n,Cn,ri){return[_n.split("").reverse().join(""),Cn,ri]})),wt={text:Z,x:fe,y:Ie,options:Ue,mutex:{pdfEscape:Mt,activeFontKey:st,fonts:Et,activeFontSize:ue}},ce.publish("postProcessText",wt),Z=wt.text,ei=wt.mutex.isHex||!1;var Gd=Et[st].encoding;Gd!=="WinAnsiEncoding"&&Gd!=="StandardEncoding"||(Z=_u(Z,function(_n,Cn,ri){return[cp(_n),Cn,ri]})),Ot=ku(Z),Z=[];for(var Ou,Nu,Oc,ql=Array.isArray(Ot[0])?1:0,Ki="",ul=function(_n,Cn,ri){var Mi="";return ri instanceof ze?(ri=typeof Ue.angle=="number"?Le(ri,new ze(1,0,0,1,_n,Cn)):Le(new ze(1,0,0,1,_n,Cn),ri),j===k&&(ri=Le(new ze(1,0,0,-1,0,0),ri)),Mi=ri.join(" ")+` Tm
`):Mi=P(_n)+" "+P(Cn)+` Td
`,Mi},oo=0;oo<Ot.length;oo++){switch(Ki="",ql){case 1:Oc=(ei?"<":"(")+Ot[oo][0]+(ei?">":")"),Ou=parseFloat(Ot[oo][1]),Nu=parseFloat(Ot[oo][2]);break;case 0:Oc=(ei?"<":"(")+Ot[oo]+(ei?">":")"),Ou=al(fe),Nu=Va(Ie)}Pu!==void 0&&Pu[oo]!==void 0&&(Ki=Pu[oo]+` Tw
`),oo===0?Z.push(Ki+ul(Ou,Nu,kn)+Oc):ql===0?Z.push(Ki+Oc):ql===1&&Z.push(Ki+ul(Ou,Nu,kn)+Oc)}Z=ql===0?Z.join(` Tj
T* `):Z.join(` Tj
`),Z+=` Tj
`;var As=`BT
/`;return As+=st+" "+ue+` Tf
`,As+=P(ue*bo)+` TL
`,As+=Uo+`
`,As+=ti,As+=Z,se(As+="ET"),h[st]=!0,fn};var ap=p.__private__.clip=p.clip=function(Z){return se(Z==="evenodd"?"W*":"W"),this};p.clipEvenOdd=function(){return ap("evenodd")},p.__private__.discardPath=p.discardPath=function(){return se("n"),this};var zr=p.__private__.isValidStyle=function(Z){var fe=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(Z)!==-1&&(fe=!0),fe};p.__private__.setDefaultPathOperation=p.setDefaultPathOperation=function(Z){return zr(Z)&&(u=Z),this};var sp=p.__private__.getStyle=p.getStyle=function(Z){var fe=u;switch(Z){case"D":case"S":fe="S";break;case"F":fe="f";break;case"FD":case"DF":fe="B";break;case"f":case"f*":case"B":case"B*":fe=Z}return fe},yu=p.close=function(){return se("h"),this};p.stroke=function(){return se("S"),this},p.fill=function(Z){return Cc("f",Z),this},p.fillEvenOdd=function(Z){return Cc("f*",Z),this},p.fillStroke=function(Z){return Cc("B",Z),this},p.fillStrokeEvenOdd=function(Z){return Cc("B*",Z),this};var Cc=function(Z,fe){On(fe)==="object"?og(fe,Z):se(Z)},Md=function(Z){Z===null||j===k&&Z===void 0||(Z=sp(Z),se(Z))};function ig(Z,fe,Ie,Ue,tt){var wt=new um(fe||this.boundingBox,Ie||this.xStep,Ue||this.yStep,this.gState,tt||this.matrix);wt.stream=this.stream;var Ot=Z+"$$"+this.cloneIndex+++"$$";return mt(Ot,wt),wt}var og=function(Z,fe){var Ie=lt[Z.key],Ue=Ce[Ie];if(Ue instanceof ah)se("q"),se(lp(fe)),Ue.gState&&p.setGState(Ue.gState),se(Z.matrix.toString()+" cm"),se("/"+Ie+" sh"),se("Q");else if(Ue instanceof um){var tt=new ze(1,0,0,-1,0,_s());Z.matrix&&(tt=tt.multiply(Z.matrix||Qe),Ie=ig.call(Ue,Z.key,Z.boundingBox,Z.xStep,Z.yStep,tt).id),se("q"),se("/Pattern cs"),se("/"+Ie+" scn"),Ue.gState&&p.setGState(Ue.gState),se(fe),se("Q")}},lp=function(Z){switch(Z){case"f":case"F":case"n":return"W n";case"f*":return"W* n";case"B":case"S":return"W S";case"B*":return"W* S"}},ws=p.moveTo=function(Z,fe){return se(P(R(Z))+" "+P(F(fe))+" m"),this},Ss=p.lineTo=function(Z,fe){return se(P(R(Z))+" "+P(F(fe))+" l"),this},$o=p.curveTo=function(Z,fe,Ie,Ue,tt,wt){return se([P(R(Z)),P(F(fe)),P(R(Ie)),P(F(Ue)),P(R(tt)),P(F(wt)),"c"].join(" ")),this};p.__private__.line=p.line=function(Z,fe,Ie,Ue,tt){if(isNaN(Z)||isNaN(fe)||isNaN(Ie)||isNaN(Ue)||!zr(tt))throw new Error("Invalid arguments passed to jsPDF.line");return j===w?this.lines([[Ie-Z,Ue-fe]],Z,fe,[1,1],tt||"S"):this.lines([[Ie-Z,Ue-fe]],Z,fe,[1,1]).stroke()},p.__private__.lines=p.lines=function(Z,fe,Ie,Ue,tt,wt){var Ot,tr,Xt,_r,Pr,Kr,ki,kn,fn,Mn,ei,ti;if(typeof Z=="number"&&(ti=Ie,Ie=fe,fe=Z,Z=ti),Ue=Ue||[1,1],wt=wt||!1,isNaN(fe)||isNaN(Ie)||!Array.isArray(Z)||!Array.isArray(Ue)||!zr(tt)||typeof wt!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(ws(fe,Ie),Ot=Ue[0],tr=Ue[1],_r=Z.length,Mn=fe,ei=Ie,Xt=0;Xt<_r;Xt++)(Pr=Z[Xt]).length===2?(Mn=Pr[0]*Ot+Mn,ei=Pr[1]*tr+ei,Ss(Mn,ei)):(Kr=Pr[0]*Ot+Mn,ki=Pr[1]*tr+ei,kn=Pr[2]*Ot+Mn,fn=Pr[3]*tr+ei,Mn=Pr[4]*Ot+Mn,ei=Pr[5]*tr+ei,$o(Kr,ki,kn,fn,Mn,ei));return wt&&yu(),Md(tt),this},p.path=function(Z){for(var fe=0;fe<Z.length;fe++){var Ie=Z[fe],Ue=Ie.c;switch(Ie.op){case"m":ws(Ue[0],Ue[1]);break;case"l":Ss(Ue[0],Ue[1]);break;case"c":$o.apply(this,Ue);break;case"h":yu()}}return this},p.__private__.rect=p.rect=function(Z,fe,Ie,Ue,tt){if(isNaN(Z)||isNaN(fe)||isNaN(Ie)||isNaN(Ue)||!zr(tt))throw new Error("Invalid arguments passed to jsPDF.rect");return j===w&&(Ue=-Ue),se([P(R(Z)),P(F(fe)),P(R(Ie)),P(R(Ue)),"re"].join(" ")),Md(tt),this},p.__private__.triangle=p.triangle=function(Z,fe,Ie,Ue,tt,wt,Ot){if(isNaN(Z)||isNaN(fe)||isNaN(Ie)||isNaN(Ue)||isNaN(tt)||isNaN(wt)||!zr(Ot))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[Ie-Z,Ue-fe],[tt-Ie,wt-Ue],[Z-tt,fe-wt]],Z,fe,[1,1],Ot,!0),this},p.__private__.roundedRect=p.roundedRect=function(Z,fe,Ie,Ue,tt,wt,Ot){if(isNaN(Z)||isNaN(fe)||isNaN(Ie)||isNaN(Ue)||isNaN(tt)||isNaN(wt)||!zr(Ot))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var tr=4/3*(Math.SQRT2-1);return tt=Math.min(tt,.5*Ie),wt=Math.min(wt,.5*Ue),this.lines([[Ie-2*tt,0],[tt*tr,0,tt,wt-wt*tr,tt,wt],[0,Ue-2*wt],[0,wt*tr,-tt*tr,wt,-tt,wt],[2*tt-Ie,0],[-tt*tr,0,-tt,-wt*tr,-tt,-wt],[0,2*wt-Ue],[0,-wt*tr,tt*tr,-wt,tt,-wt]],Z+tt,fe,[1,1],Ot,!0),this},p.__private__.ellipse=p.ellipse=function(Z,fe,Ie,Ue,tt){if(isNaN(Z)||isNaN(fe)||isNaN(Ie)||isNaN(Ue)||!zr(tt))throw new Error("Invalid arguments passed to jsPDF.ellipse");var wt=4/3*(Math.SQRT2-1)*Ie,Ot=4/3*(Math.SQRT2-1)*Ue;return ws(Z+Ie,fe),$o(Z+Ie,fe-Ot,Z+wt,fe-Ue,Z,fe-Ue),$o(Z-wt,fe-Ue,Z-Ie,fe-Ot,Z-Ie,fe),$o(Z-Ie,fe+Ot,Z-wt,fe+Ue,Z,fe+Ue),$o(Z+wt,fe+Ue,Z+Ie,fe+Ot,Z+Ie,fe),Md(tt),this},p.__private__.circle=p.circle=function(Z,fe,Ie,Ue){if(isNaN(Z)||isNaN(fe)||isNaN(Ie)||!zr(Ue))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(Z,fe,Ie,Ie,Ue)},p.setFont=function(Z,fe,Ie){return Ie&&(fe=A(fe,Ie)),st=gu(Z,fe,{disableWarning:!1}),this};var il=p.__private__.getFont=p.getFont=function(){return Et[gu.apply(p,arguments)]};p.__private__.getFontList=p.getFontList=function(){var Z,fe,Ie={};for(Z in vt)if(vt.hasOwnProperty(Z))for(fe in Ie[Z]=[],vt[Z])vt[Z].hasOwnProperty(fe)&&Ie[Z].push(fe);return Ie},p.addFont=function(Z,fe,Ie,Ue,tt){var wt=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&wt.indexOf(arguments[3])!==-1?tt=arguments[3]:arguments[3]&&wt.indexOf(arguments[3])==-1&&(Ie=A(Ie,Ue)),tl.call(this,Z,fe,Ie,tt=tt||"Identity-H")};var js,hr=e.lineWidth||.200025,ol=p.__private__.getLineWidth=p.getLineWidth=function(){return hr},qv=p.__private__.setLineWidth=p.setLineWidth=function(Z){return hr=Z,se(P(R(Z))+" w"),this};p.__private__.setLineDash=fr.API.setLineDash=fr.API.setLineDashPattern=function(Z,fe){if(Z=Z||[],fe=fe||0,isNaN(fe)||!Array.isArray(Z))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return Z=Z.map(function(Ie){return P(R(Ie))}).join(" "),fe=P(R(fe)),se("["+Z+"] "+fe+" d"),this};var ag=p.__private__.getLineHeight=p.getLineHeight=function(){return ue*js};p.__private__.getLineHeight=p.getLineHeight=function(){return ue*js};var xu=p.__private__.setLineHeightFactor=p.setLineHeightFactor=function(Z){return typeof(Z=Z||1.15)=="number"&&(js=Z),this},$v=p.__private__.getLineHeightFactor=p.getLineHeightFactor=function(){return js};xu(e.lineHeight);var al=p.__private__.getHorizontalCoordinate=function(Z){return R(Z)},Va=p.__private__.getVerticalCoordinate=function(Z){return j===k?Z:We[q].mediaBox.topRightY-We[q].mediaBox.bottomLeftY-R(Z)},sg=p.__private__.getHorizontalCoordinateString=p.getHorizontalCoordinateString=function(Z){return P(al(Z))},Uv=p.__private__.getVerticalCoordinateString=p.getVerticalCoordinateString=function(Z){return P(Va(Z))},sl=e.strokeColor||"0 G";p.__private__.getStrokeColor=p.getDrawColor=function(){return Fi(sl)},p.__private__.setStrokeColor=p.setDrawColor=function(Z,fe,Ie,Ue){return sl=Fn({ch1:Z,ch2:fe,ch3:Ie,ch4:Ue,pdfColorType:"draw",precision:2}),se(sl),this};var Dl=e.fillColor||"0 g";p.__private__.getFillColor=p.getFillColor=function(){return Fi(Dl)},p.__private__.setFillColor=p.setFillColor=function(Z,fe,Ie,Ue){return Dl=Fn({ch1:Z,ch2:fe,ch3:Ie,ch4:Ue,pdfColorType:"fill",precision:2}),se(Dl),this};var Uo=e.textColor||"0 g",Dd=p.__private__.getTextColor=p.getTextColor=function(){return Fi(Uo)};p.__private__.setTextColor=p.setTextColor=function(Z,fe,Ie,Ue){return Uo=Fn({ch1:Z,ch2:fe,ch3:Ie,ch4:Ue,pdfColorType:"text",precision:3}),this};var Bd=e.charSpace,Hv=p.__private__.getCharSpace=p.getCharSpace=function(){return parseFloat(Bd||0)};p.__private__.setCharSpace=p.setCharSpace=function(Z){if(isNaN(Z))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return Bd=Z,this};var bu=0;p.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},p.__private__.setLineCap=p.setLineCap=function(Z){var fe=p.CapJoinStyles[Z];if(fe===void 0)throw new Error("Line cap style of '"+Z+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return bu=fe,se(fe+" J"),this};var ks=0;p.__private__.setLineJoin=p.setLineJoin=function(Z){var fe=p.CapJoinStyles[Z];if(fe===void 0)throw new Error("Line join style of '"+Z+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return ks=fe,se(fe+" j"),this},p.__private__.setLineMiterLimit=p.__private__.setMiterLimit=p.setLineMiterLimit=p.setMiterLimit=function(Z){if(Z=Z||0,isNaN(Z))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return se(P(R(Z))+" M"),this},p.GState=Vw,p.setGState=function(Z){(Z=typeof Z=="string"?Xe[Be[Z]]:wu(null,Z)).equals(ct)||(se("/"+Z.id+" gs"),ct=Z)};var wu=function(Z,fe){if(!Z||!Be[Z]){var Ie=!1;for(var Ue in Xe)if(Xe.hasOwnProperty(Ue)&&Xe[Ue].equals(fe)){Ie=!0;break}if(Ie)fe=Xe[Ue];else{var tt="GS"+(Object.keys(Xe).length+1).toString(10);Xe[tt]=fe,fe.id=tt}return Z&&(Be[Z]=fe.id),ce.publish("addGState",fe),fe}};p.addGState=function(Z,fe){return wu(Z,fe),this},p.saveGraphicsState=function(){return se("q"),Ft.push({key:st,size:ue,color:Uo}),this},p.restoreGraphicsState=function(){se("Q");var Z=Ft.pop();return st=Z.key,ue=Z.size,Uo=Z.color,ct=null,this},p.setCurrentTransformationMatrix=function(Z){return se(Z.toString()+" cm"),this},p.comment=function(Z){return se("#"+Z),this};var Ec=function(Z,fe){var Ie=Z||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return Ie},set:function(wt){isNaN(wt)||(Ie=parseFloat(wt))}});var Ue=fe||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return Ue},set:function(wt){isNaN(wt)||(Ue=parseFloat(wt))}});var tt="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return tt},set:function(wt){tt=wt.toString()}}),this},Ya=function(Z,fe,Ie,Ue){Ec.call(this,Z,fe),this.type="rect";var tt=Ie||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return tt},set:function(Ot){isNaN(Ot)||(tt=parseFloat(Ot))}});var wt=Ue||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return wt},set:function(Ot){isNaN(Ot)||(wt=parseFloat(Ot))}}),this},Ac=function(){this.page=Tt,this.currentPage=q,this.pages=de.slice(0),this.pagesContext=We.slice(0),this.x=et,this.y=Pt,this.matrix=qe,this.width=ju(q),this.height=ll(q),this.outputDestination=ke,this.id="",this.objectNumber=-1};Ac.prototype.restore=function(){Tt=this.page,q=this.currentPage,We=this.pagesContext,de=this.pages,et=this.x,Pt=this.y,qe=this.matrix,Ga(q,this.width),xo(q,this.height),ke=this.outputDestination};var Tc=function(Z,fe,Ie,Ue,tt){Re.push(new Ac),Tt=q=0,de=[],et=Z,Pt=fe,qe=tt,xr([Ie,Ue])};for(var Su in p.beginFormObject=function(Z,fe,Ie,Ue,tt){return Tc(Z,fe,Ie,Ue,tt),this},p.endFormObject=function(Z){return(function(fe){if(xe[fe])Re.pop().restore();else{var Ie=new Ac,Ue="Xo"+(Object.keys(je).length+1).toString(10);Ie.id=Ue,xe[fe]=Ue,je[Ue]=Ie,ce.publish("addFormObject",Ie),Re.pop().restore()}})(Z),this},p.doFormObject=function(Z,fe){var Ie=je[xe[Z]];return se("q"),se(fe.toString()+" cm"),se("/"+Ie.id+" Do"),se("Q"),this},p.getFormObject=function(Z){var fe=je[xe[Z]];return{x:fe.x,y:fe.y,width:fe.width,height:fe.height,matrix:fe.matrix}},p.save=function(Z,fe){return Z=Z||"generated.pdf",(fe=fe||{}).returnPromise=fe.returnPromise||!1,fe.returnPromise===!1?(rh(nl(Ea()),Z),typeof rh.unload=="function"&&Er.setTimeout&&setTimeout(rh.unload,911),this):new Promise(function(Ie,Ue){try{var tt=rh(nl(Ea()),Z);typeof rh.unload=="function"&&Er.setTimeout&&setTimeout(rh.unload,911),Ie(tt)}catch(wt){Ue(wt.message)}})},fr.API)fr.API.hasOwnProperty(Su)&&(Su==="events"&&fr.API.events.length?(function(Z,fe){var Ie,Ue,tt;for(tt=fe.length-1;tt!==-1;tt--)Ie=fe[tt][0],Ue=fe[tt][1],Z.subscribe.apply(Z,[Ie].concat(typeof Ue=="function"?[Ue]:Ue))})(ce,fr.API.events):p[Su]=fr.API[Su]);function ju(Z){return We[Z].mediaBox.topRightX-We[Z].mediaBox.bottomLeftX}function Ga(Z,fe){We[Z].mediaBox.topRightX=fe+We[Z].mediaBox.bottomLeftX}function ll(Z){return We[Z].mediaBox.topRightY-We[Z].mediaBox.bottomLeftY}function xo(Z,fe){We[Z].mediaBox.topRightY=fe+We[Z].mediaBox.bottomLeftY}var Bl=p.getPageWidth=function(Z){return ju(Z=Z||q)/Te},Wd=p.setPageWidth=function(Z,fe){Ga(Z,fe*Te)},_s=p.getPageHeight=function(Z){return ll(Z=Z||q)/Te},lg=p.setPageHeight=function(Z,fe){xo(Z,fe*Te)};return p.internal={pdfEscape:Mt,getStyle:sp,getFont:il,getFontSize:Se,getCharSpace:Hv,getTextColor:Dd,getLineHeight:ag,getLineHeightFactor:$v,getLineWidth:ol,write:be,getHorizontalCoordinate:al,getVerticalCoordinate:Va,getCoordinateString:sg,getVerticalCoordinateString:Uv,collections:{},newObject:It,newAdditionalObject:pr,newObjectDeferred:Bt,newObjectDeferredBegin:dr,getFilters:Bo,putStream:io,events:ce,scaleFactor:Te,pageSize:{getWidth:function(){return Bl(q)},setWidth:function(Z){Wd(q,Z)},getHeight:function(){return _s(q)},setHeight:function(Z){lg(q,Z)}},encryptionOptions:d,encryption:Gi,getEncryptor:function(Z){return d!==null?Gi.encryptor(Z,0):function(fe){return fe}},output:Fd,getNumberOfPages:zn,get pages(){return de},out:se,f2:C,f3:I,getPageInfo:zd,getPageInfoByObjId:vu,getCurrentPageInfo:Wv,getPDFVersion:m,Point:Ec,Rectangle:Ya,Matrix:ze,hasHotfix:bs},Object.defineProperty(p.internal.pageSize,"width",{get:function(){return Bl(q)},set:function(Z){Wd(q,Z)},enumerable:!0,configurable:!0}),Object.defineProperty(p.internal.pageSize,"height",{get:function(){return _s(q)},set:function(Z){lg(q,Z)},enumerable:!0,configurable:!0}),(function(Z){for(var fe=0,Ie=ae.length;fe<Ie;fe++){var Ue=tl.call(this,Z[fe][0],Z[fe][1],Z[fe][2],ae[fe][3],!0);f===!1&&(h[Ue]=!0);var tt=Z[fe][0].split("-");Ld({id:Ue,fontName:tt[0],fontStyle:tt[1]||""})}ce.publish("addFonts",{fonts:Et,dictionary:vt})}).call(p,ae),st="F1",$n(o,r),ce.publish("initialized"),p}Zg.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},Zg.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Zg.prototype.hexToBytes=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(String.fromCharCode(parseInt(e.substr(r,2),16)));return t.join("")},Zg.prototype.processOwnerPassword=function(e,t){return X6(Q6(t).substr(0,5),e)},Zg.prototype.encryptor=function(e,t){var r=Q6(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(n){return X6(r,n)}},Vw.prototype.equals=function(e){var t,r="id,objectNumber,equals";if(!e||On(e)!==On(this))return!1;var n=0;for(t in this)if(!(r.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;n++}for(t in e)e.hasOwnProperty(t)&&r.indexOf(t)<0&&n--;return n===0},fr.API={events:[]},fr.version="4.2.1";var Ii=fr.API,pI=1,tg=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Yg=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Bh=function(e){return e.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var r=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(r.length===1?"0"+r:r)})},Nr=function(e){return e.toFixed(2)},Sf=function(e){return e.toFixed(5)};Ii.__acroform__={};var ys=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},sq=function(e){return e*pI},Vc=function(e){var t=new RZ,r=or.internal.getHeight(e)||0,n=or.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Nr(n)),Number(Nr(r))],t},GNe=Ii.__acroform__.setBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return e|1<<t},KNe=Ii.__acroform__.clearBit=function(e,t){if(e=e||0,t=t||0,isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return e&~(1<<t)},QNe=Ii.__acroform__.getBit=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return e&1<<t?1:0},qi=Ii.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return QNe(e,t-1)},$i=Ii.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return GNe(e,t-1)},Ui=Ii.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return KNe(e,t-1)},XNe=Ii.__acroform__.calculateCoordinates=function(e,t){var r=t.internal.getHorizontalCoordinate,n=t.internal.getVerticalCoordinate,o=e[0],a=e[1],s=e[2],l=e[3],c={};return c.lowerLeft_X=r(o)||0,c.lowerLeft_Y=n(a+l)||0,c.upperRight_X=r(o+s)||0,c.upperRight_Y=n(a)||0,[Number(Nr(c.lowerLeft_X)),Number(Nr(c.lowerLeft_Y)),Number(Nr(c.upperRight_X)),Number(Nr(c.upperRight_Y))]},ZNe=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],r=e._V||e.DV,n=Z6(e,r),o=e.scope.internal.getFont(e.fontName,e.fontStyle).id;t.push("/Tx BMC"),t.push("q"),t.push("BT"),t.push(e.scope.__private__.encodeColorString(e.color)),t.push("/"+o+" "+Nr(n.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(n.text),t.push("ET"),t.push("Q"),t.push("EMC");var a=Vc(e);return a.scope=e.scope,a.stream=t.join(`
`),a}},Z6=function(e,t){var r=e.fontSize===0?e.maxFontSize:e.fontSize,n={text:"",fontSize:""},o=(t=(t=t.substr(0,1)=="("?t.substr(1):t).substr(t.length-1)==")"?t.substr(0,t.length-1):t).split(" ");o=e.multiline?o.map(function(C){return C.split(`
`)}):o.map(function(C){return[C]});var a=r,s=or.internal.getHeight(e)||0;s=s<0?-s:s;var l=or.internal.getWidth(e)||0;l=l<0?-l:l;var c=function(C,I,R){if(C+1<o.length){var F=I+" "+o[C+1][0];return I1(F,e,R).width<=l-4}return!1};a++;e:for(;a>0;){t="",a--;var u,d,f=I1("3",e,a).height,h=e.multiline?s-a:(s-f)/2,p=h+=2,v=0,m=0,b=0;if(a<=0){t=`(...) Tj
`,t+="% Width of Text: "+I1(t,e,a=12).width+", FieldWidth:"+l+`
`;break}for(var x="",w=0,k=0;k<o.length;k++)if(o.hasOwnProperty(k)){var j=!1;if(o[k].length!==1&&b!==o[k].length-1){if((f+2)*(w+2)+2>s)continue e;x+=o[k][b],j=!0,m=k,k--}else{x=(x+=o[k][b]+" ").substr(x.length-1)==" "?x.substr(0,x.length-1):x;var _=parseInt(k),T=c(_,x,a),A=k>=o.length-1;if(T&&!A){x+=" ",b=0;continue}if(T||A){if(A)m=_;else if(e.multiline&&(f+2)*(w+2)+2>s)continue e}else{if(!e.multiline||(f+2)*(w+2)+2>s)continue e;m=_}}for(var P="",N=v;N<=m;N++){var O=o[N];if(e.multiline){if(N===m){P+=O[b]+" ",b=(b+1)%O.length;continue}if(N===v){P+=O[O.length-1]+" ";continue}}P+=O[0]+" "}switch(P=P.substr(P.length-1)==" "?P.substr(0,P.length-1):P,d=I1(P,e,a).width,e.textAlign){case"right":u=l-d-2;break;case"center":u=(l-d)/2;break;default:u=2}t+=Nr(u)+" "+Nr(p)+` Td
`,t+="("+tg(P)+`) Tj
`,t+=-Nr(u)+` 0 Td
`,p=-(a+2),d=0,v=j?m:m+1,w++,x=""}break}return n.text=t,n.fontSize=a,n},I1=function(e,t,r){var n=t.scope.internal.getFont(t.fontName,t.fontStyle),o=t.scope.getStringUnitWidth(e,{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r);return{height:t.scope.getStringUnitWidth("3",{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r)*1.5,width:o}},JNe={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},eRe=function(e,t){var r={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(n){return n.type===r.type&&n.object===r.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(r)},tRe=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(jc.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(JNe)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");pI=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new LZ,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(r){r.internal.events.unsubscribe(r.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete r.internal.acroformPlugin.acroFormDictionaryRoot._eventID,r.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(r){r.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var n=r.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];a.objId=void 0,a.hasAnnotation&&eRe(a,r)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(r){if(r.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");r.internal.write("/AcroForm "+r.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(r){(function(n,o){var a=!n;for(var s in n||(o.internal.newObjectDeferredBegin(o.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),o.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),n=n||o.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(n.hasOwnProperty(s)){var l=n[s],c=[],u=l.Rect;if(l.Rect&&(l.Rect=XNe(l.Rect,o)),o.internal.newObjectDeferredBegin(l.objId,!0),l.DA=or.createDefaultAppearanceStream(l),On(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(c=l.getKeyValueListForStream()),l.Rect=u,l.hasAppearanceStream&&!l.appearanceStreamContent){var d=ZNe(l);c.push({key:"AP",value:"<</N "+d+">>"}),o.internal.acroformPlugin.xForms.push(d)}if(l.appearanceStreamContent){var f="";for(var h in l.appearanceStreamContent)if(l.appearanceStreamContent.hasOwnProperty(h)){var p=l.appearanceStreamContent[h];if(f+="/"+h+" ",f+="<<",Object.keys(p).length>=1||Array.isArray(p)){for(var s in p)if(p.hasOwnProperty(s)){var v=p[s];typeof v=="function"&&(v=v.call(o,l)),f+="/"+s+" "+v+" ",o.internal.acroformPlugin.xForms.indexOf(v)>=0||o.internal.acroformPlugin.xForms.push(v)}}else typeof(v=p)=="function"&&(v=v.call(o,l)),f+="/"+s+" "+v,o.internal.acroformPlugin.xForms.indexOf(v)>=0||o.internal.acroformPlugin.xForms.push(v);f+=">>"}c.push({key:"AP",value:`<<
`+f+">>"})}o.internal.putStream({additionalKeyValues:c,objectId:l.objId}),o.internal.out("endobj")}a&&(function(m,b){for(var x in m)if(m.hasOwnProperty(x)){var w=x,k=m[x];b.internal.newObjectDeferredBegin(k.objId,!0),On(k)==="object"&&typeof k.putStream=="function"&&k.putStream(),delete m[w]}})(o.internal.acroformPlugin.xForms,o)})(r,e)}),e.internal.acroformPlugin.isInitialized=!0}},NZ=Ii.__acroform__.arrayToPdfArray=function(e,t,r){var n=function(s){return s};if(Array.isArray(e)){for(var o="[",a=0;a<e.length;a++)switch(a!==0&&(o+=" "),On(e[a])){case"boolean":case"number":case"object":o+=e[a].toString();break;case"string":e[a].substr(0,1)==="/"?o+="/"+Bh(e[a].substr(1)):(t!==void 0&&r&&(n=r.internal.getEncryptor(t)),o+="("+tg(n(e[a].toString()))+")")}return o+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},a3=function(e,t,r){var n=function(o){return o};return t!==void 0&&r&&(n=r.internal.getEncryptor(t)),(e=e||"").toString(),"("+tg(n(e))+")"},ru=function(){this._objId=void 0,this._scope=void 0,Object.defineProperty(this,"objId",{get:function(){if(this._objId===void 0){if(this.scope===void 0)return;this._objId=this.scope.internal.newObjectDeferred()}return this._objId},set:function(e){this._objId=e}}),Object.defineProperty(this,"scope",{value:this._scope,writable:!0})};ru.prototype.toString=function(){return this.objId+" 0 R"},ru.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},ru.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(a){return a!="content"&&a!="appearanceStreamContent"&&a!="scope"&&a!="objId"&&a.substring(0,1)!="_"});for(var r in t)if(Object.getOwnPropertyDescriptor(this,t[r]).configurable===!1){var n=t[r],o=this[n];o&&(Array.isArray(o)?e.push({key:n,value:NZ(o,this.objId,this.scope)}):o instanceof ru?(o.scope=this.scope,e.push({key:n,value:o.objId+" 0 R"})):typeof o!="function"&&e.push({key:n,value:o}))}return e};var RZ=function(){ru.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(r){t=r}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(r){e=r.trim()},get:function(){return e||null}})};ys(RZ,ru);var LZ=function(){ru.call(this);var e,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(e){var r=function(n){return n};return this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),"("+tg(r(e))+")"}},set:function(r){e=r}})};ys(LZ,ru);var jc=function e(){ru.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(x){if(isNaN(x))throw new Error('Invalid value "'+x+'" for attribute F supplied.');t=x}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!qi(t,3)},set:function(x){x?this.F=$i(t,3):this.F=Ui(t,3)}});var r=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return r},set:function(x){if(isNaN(x))throw new Error('Invalid value "'+x+'" for attribute Ff supplied.');r=x}});var n=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(n.length!==0)return n},set:function(x){n=x!==void 0?x:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[0])?0:n[0]},set:function(x){n[0]=x}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[1])?0:n[1]},set:function(x){n[1]=x}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[2])?0:n[2]},set:function(x){n[2]=x}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[3])?0:n[3]},set:function(x){n[3]=x}});var o="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return o},set:function(x){switch(x){case"/Btn":case"/Tx":case"/Ch":case"/Sig":o=x;break;default:throw new Error('Invalid value "'+x+'" for attribute FT supplied.')}}});var a=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!a||a.length<1){if(this instanceof Yw)return;a="FieldObject"+e.FieldNum++}var x=function(w){return w};return this.scope&&(x=this.scope.internal.getEncryptor(this.objId)),"("+tg(x(a))+")"},set:function(x){a=x.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return a},set:function(x){a=x}});var s="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return s},set:function(x){s=x}});var l="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return l},set:function(x){l=x}});var c=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return c},set:function(x){c=x}});var u=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return u===void 0?50/pI:u},set:function(x){u=x}});var d="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return d},set:function(x){d=x}});var f="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!f||this instanceof Yw||this instanceof xh))return a3(f,this.objId,this.scope)},set:function(x){x=x.toString(),f=x}});var h=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(h)return this instanceof Lo==0?a3(h,this.objId,this.scope):h},set:function(x){x=x.toString(),h=this instanceof Lo==0?x.substr(0,1)==="("?Yg(x.substr(1,x.length-2)):Yg(x):x}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof Lo==1?Yg(h.substr(1,h.length-1)):h},set:function(x){x=x.toString(),h=this instanceof Lo==1?"/"+Bh(x):x}});var p=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(p)return p},set:function(x){this.V=x}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(p)return this instanceof Lo==0?a3(p,this.objId,this.scope):p},set:function(x){x=x.toString(),p=this instanceof Lo==0?x.substr(0,1)==="("?Yg(x.substr(1,x.length-2)):Yg(x):x}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof Lo==1?Yg(p.substr(1,p.length-1)):p},set:function(x){x=x.toString(),p=this instanceof Lo==1?"/"+Bh(x):x}}),Object.defineProperty(this,"hasAnnotation",{enumerable:!0,configurable:!0,get:function(){return this.Rect}}),Object.defineProperty(this,"Type",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,configurable:!1,get:function(){return this.hasAnnotation?"/Widget":null}});var v,m=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return m},set:function(x){x=!!x,m=x}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(v)return v},set:function(x){v=x}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,1)},set:function(x){x?this.Ff=$i(this.Ff,1):this.Ff=Ui(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,2)},set:function(x){x?this.Ff=$i(this.Ff,2):this.Ff=Ui(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,3)},set:function(x){x?this.Ff=$i(this.Ff,3):this.Ff=Ui(this.Ff,3)}});var b=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(b!==null)return b},set:function(x){if([0,1,2].indexOf(x)===-1)throw new Error('Invalid value "'+x+'" for attribute Q supplied.');b=x}}),Object.defineProperty(this,"textAlign",{get:function(){var x;switch(b){case 0:default:x="left";break;case 1:x="center";break;case 2:x="right"}return x},configurable:!0,enumerable:!0,set:function(x){switch(x){case"right":case 2:b=2;break;case"center":case 1:b=1;break;default:b=0}}})};ys(jc,ru);var Cm=function(){jc.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(r){e=r}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(r){e=r}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return NZ(t,this.objId,this.scope)},set:function(r){var n,o;o=[],typeof(n=r)=="string"&&(o=(function(a,s,l){l||(l=1);for(var c,u=[];c=s.exec(a);)u.push(c[l]);return u})(n,/\((.*?)\)/g)),t=o}}),this.getOptions=function(){return t},this.setOptions=function(r){t=r,this.sort&&t.sort()},this.addOption=function(r){r=(r=r||"").toString(),t.push(r),this.sort&&t.sort()},this.removeOption=function(r,n){for(n=n||!1,r=(r=r||"").toString();t.indexOf(r)!==-1&&(t.splice(t.indexOf(r),1),n!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,18)},set:function(r){r?this.Ff=$i(this.Ff,18):this.Ff=Ui(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,19)},set:function(r){this.combo===!0&&(r?this.Ff=$i(this.Ff,19):this.Ff=Ui(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,20)},set:function(r){r?(this.Ff=$i(this.Ff,20),t.sort()):this.Ff=Ui(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,22)},set:function(r){r?this.Ff=$i(this.Ff,22):this.Ff=Ui(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,23)},set:function(r){r?this.Ff=$i(this.Ff,23):this.Ff=Ui(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,27)},set:function(r){r?this.Ff=$i(this.Ff,27):this.Ff=Ui(this.Ff,27)}}),this.hasAppearanceStream=!1};ys(Cm,jc);var Em=function(){Cm.call(this),this.fontName="helvetica",this.combo=!1};ys(Em,Cm);var Am=function(){Em.call(this),this.combo=!0};ys(Am,Em);var G1=function(){Am.call(this),this.edit=!0};ys(G1,Am);var Lo=function(){jc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,15)},set:function(r){r?this.Ff=$i(this.Ff,15):this.Ff=Ui(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,16)},set:function(r){r?this.Ff=$i(this.Ff,16):this.Ff=Ui(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,17)},set:function(r){r?this.Ff=$i(this.Ff,17):this.Ff=Ui(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,26)},set:function(r){r?this.Ff=$i(this.Ff,26):this.Ff=Ui(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var r=function(a){return a};if(this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var n,o=[];for(n in o.push("<<"),t)o.push("/"+n+" ("+tg(r(t[n]))+")");return o.push(">>"),o.join(`
`)}},set:function(r){On(r)==="object"&&(t=r)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(r){typeof r=="string"&&(t.CA=r)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(r){var n=r==null?"":r.toString();n.substr(0,1)==="/"&&(n=n.substr(1)),e="/"+Bh(n)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(r){e="/"+Bh(r)}})};ys(Lo,jc);var K1=function(){Lo.call(this),this.pushButton=!0};ys(K1,Lo);var Tm=function(){Lo.call(this),this.radio=!0,this.pushButton=!1;var e=[];Object.defineProperty(this,"Kids",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t!==void 0?t:[]}})};ys(Tm,Lo);var Yw=function(){var e,t;jc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(o){e=o}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(o){t=o}});var r,n={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var o=function(l){return l};this.scope&&(o=this.scope.internal.getEncryptor(this.objId));var a,s=[];for(a in s.push("<<"),n)s.push("/"+a+" ("+tg(o(n[a]))+")");return s.push(">>"),s.join(`
`)},set:function(o){On(o)==="object"&&(n=o)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return n.CA||""},set:function(o){typeof o=="string"&&(n.CA=o)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return r},set:function(o){var a=o==null?"":o.toString();a.substr(0,1)==="/"&&(a=a.substr(1)),r="/"+Bh(a)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return r.substr(1,r.length-1)},set:function(o){var a=o==null?"":o.toString();a.substr(0,1)==="/"&&(a=a.substr(1)),r="/"+Bh(a)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=or.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};ys(Yw,jc),Tm.prototype.setAppearance=function(e){if(!("createAppearanceStream"in e)||!("getCA"in e))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var r=this.Kids[t];r.appearanceStreamContent=e.createAppearanceStream(r.optionName),r.caption=e.getCA()}},Tm.prototype.createOption=function(e){var t=new Yw;return t.Parent=this,t.optionName=e,this.Kids.push(t),rRe.call(this.scope,t),t};var Q1=function(){Lo.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=or.CheckBox.createAppearanceStream()};ys(Q1,Lo);var xh=function(){jc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,13)},set:function(t){t?this.Ff=$i(this.Ff,13):this.Ff=Ui(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,21)},set:function(t){t?this.Ff=$i(this.Ff,21):this.Ff=Ui(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,23)},set:function(t){t?this.Ff=$i(this.Ff,23):this.Ff=Ui(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,24)},set:function(t){t?this.Ff=$i(this.Ff,24):this.Ff=Ui(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,25)},set:function(t){t?this.Ff=$i(this.Ff,25):this.Ff=Ui(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,26)},set:function(t){t?this.Ff=$i(this.Ff,26):this.Ff=Ui(this.Ff,26)}});var e=null;Object.defineProperty(this,"MaxLen",{enumerable:!0,configurable:!1,get:function(){return e},set:function(t){e=t}}),Object.defineProperty(this,"maxLength",{enumerable:!0,configurable:!0,get:function(){return e},set:function(t){Number.isInteger(t)&&(e=t)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return this.V||this.DV}})};ys(xh,jc);var X1=function(){xh.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!qi(this.Ff,14)},set:function(e){e?this.Ff=$i(this.Ff,14):this.Ff=Ui(this.Ff,14)}}),this.password=!0};ys(X1,xh);var or={CheckBox:{createAppearanceStream:function(){return{N:{On:or.CheckBox.YesNormal},D:{On:or.CheckBox.YesPushDown,Off:or.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Vc(e);t.scope=e.scope;var r=[],n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,o=e.scope.__private__.encodeColorString(e.color),a=Z6(e,e.caption);return r.push("0.749023 g"),r.push("0 0 "+Nr(or.internal.getWidth(e))+" "+Nr(or.internal.getHeight(e))+" re"),r.push("f"),r.push("BMC"),r.push("q"),r.push("0 0 1 rg"),r.push("/"+n+" "+Nr(a.fontSize)+" Tf "+o),r.push("BT"),r.push(a.text),r.push("ET"),r.push("Q"),r.push("EMC"),t.stream=r.join(`
`),t},YesNormal:function(e){var t=Vc(e);t.scope=e.scope;var r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color),o=[],a=or.internal.getHeight(e),s=or.internal.getWidth(e),l=Z6(e,e.caption);return o.push("1 g"),o.push("0 0 "+Nr(s)+" "+Nr(a)+" re"),o.push("f"),o.push("q"),o.push("0 0 1 rg"),o.push("0 0 "+Nr(s-1)+" "+Nr(a-1)+" re"),o.push("W"),o.push("n"),o.push("0 g"),o.push("BT"),o.push("/"+r+" "+Nr(l.fontSize)+" Tf "+n),o.push(l.text),o.push("ET"),o.push("Q"),t.stream=o.join(`
`),t},OffPushDown:function(e){var t=Vc(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Nr(or.internal.getWidth(e))+" "+Nr(or.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:or.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=or.RadioButton.Circle.YesNormal,t.D[e]=or.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Vc(e);t.scope=e.scope;var r=[],n=or.internal.getWidth(e)<=or.internal.getHeight(e)?or.internal.getWidth(e)/4:or.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var o=or.internal.Bezier_C,a=Number((n*o).toFixed(5));return r.push("q"),r.push("1 0 0 1 "+Sf(or.internal.getWidth(e)/2)+" "+Sf(or.internal.getHeight(e)/2)+" cm"),r.push(n+" 0 m"),r.push(n+" "+a+" "+a+" "+n+" 0 "+n+" c"),r.push("-"+a+" "+n+" -"+n+" "+a+" -"+n+" 0 c"),r.push("-"+n+" -"+a+" -"+a+" -"+n+" 0 -"+n+" c"),r.push(a+" -"+n+" "+n+" -"+a+" "+n+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t},YesPushDown:function(e){var t=Vc(e);t.scope=e.scope;var r=[],n=or.internal.getWidth(e)<=or.internal.getHeight(e)?or.internal.getWidth(e)/4:or.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var o=Number((2*n).toFixed(5)),a=Number((o*or.internal.Bezier_C).toFixed(5)),s=Number((n*or.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+Sf(or.internal.getWidth(e)/2)+" "+Sf(or.internal.getHeight(e)/2)+" cm"),r.push(o+" 0 m"),r.push(o+" "+a+" "+a+" "+o+" 0 "+o+" c"),r.push("-"+a+" "+o+" -"+o+" "+a+" -"+o+" 0 c"),r.push("-"+o+" -"+a+" -"+a+" -"+o+" 0 -"+o+" c"),r.push(a+" -"+o+" "+o+" -"+a+" "+o+" 0 c"),r.push("f"),r.push("Q"),r.push("0 g"),r.push("q"),r.push("1 0 0 1 "+Sf(or.internal.getWidth(e)/2)+" "+Sf(or.internal.getHeight(e)/2)+" cm"),r.push(n+" 0 m"),r.push(n+" "+s+" "+s+" "+n+" 0 "+n+" c"),r.push("-"+s+" "+n+" -"+n+" "+s+" -"+n+" 0 c"),r.push("-"+n+" -"+s+" -"+s+" -"+n+" 0 -"+n+" c"),r.push(s+" -"+n+" "+n+" -"+s+" "+n+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t},OffPushDown:function(e){var t=Vc(e);t.scope=e.scope;var r=[],n=or.internal.getWidth(e)<=or.internal.getHeight(e)?or.internal.getWidth(e)/4:or.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var o=Number((2*n).toFixed(5)),a=Number((o*or.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+Sf(or.internal.getWidth(e)/2)+" "+Sf(or.internal.getHeight(e)/2)+" cm"),r.push(o+" 0 m"),r.push(o+" "+a+" "+a+" "+o+" 0 "+o+" c"),r.push("-"+a+" "+o+" -"+o+" "+a+" -"+o+" 0 c"),r.push("-"+o+" -"+a+" -"+a+" -"+o+" 0 -"+o+" c"),r.push(a+" -"+o+" "+o+" -"+a+" "+o+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:or.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=or.RadioButton.Cross.YesNormal,t.D[e]=or.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Vc(e);t.scope=e.scope;var r=[],n=or.internal.calculateCross(e);return r.push("q"),r.push("1 1 "+Nr(or.internal.getWidth(e)-2)+" "+Nr(or.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(Nr(n.x1.x)+" "+Nr(n.x1.y)+" m"),r.push(Nr(n.x2.x)+" "+Nr(n.x2.y)+" l"),r.push(Nr(n.x4.x)+" "+Nr(n.x4.y)+" m"),r.push(Nr(n.x3.x)+" "+Nr(n.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
`),t},YesPushDown:function(e){var t=Vc(e);t.scope=e.scope;var r=or.internal.calculateCross(e),n=[];return n.push("0.749023 g"),n.push("0 0 "+Nr(or.internal.getWidth(e))+" "+Nr(or.internal.getHeight(e))+" re"),n.push("f"),n.push("q"),n.push("1 1 "+Nr(or.internal.getWidth(e)-2)+" "+Nr(or.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(Nr(r.x1.x)+" "+Nr(r.x1.y)+" m"),n.push(Nr(r.x2.x)+" "+Nr(r.x2.y)+" l"),n.push(Nr(r.x4.x)+" "+Nr(r.x4.y)+" m"),n.push(Nr(r.x3.x)+" "+Nr(r.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(`
`),t},OffPushDown:function(e){var t=Vc(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Nr(or.internal.getWidth(e))+" "+Nr(or.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
`),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+r}};or.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=or.internal.getWidth(e),r=or.internal.getHeight(e),n=Math.min(t,r);return{x1:{x:(t-n)/2,y:(r-n)/2+n},x2:{x:(t-n)/2+n,y:(r-n)/2},x3:{x:(t-n)/2,y:(r-n)/2},x4:{x:(t-n)/2+n,y:(r-n)/2+n}}}},or.internal.getWidth=function(e){var t=0;return On(e)==="object"&&(t=sq(e.Rect[2])),t},or.internal.getHeight=function(e){var t=0;return On(e)==="object"&&(t=sq(e.Rect[3])),t};var rRe=Ii.addField=function(e){if(tRe(this,e),!(e instanceof jc))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};Ii.AcroFormChoiceField=Cm,Ii.AcroFormListBox=Em,Ii.AcroFormComboBox=Am,Ii.AcroFormEditBox=G1,Ii.AcroFormButton=Lo,Ii.AcroFormPushButton=K1,Ii.AcroFormRadioButton=Tm,Ii.AcroFormCheckBox=Q1,Ii.AcroFormTextField=xh,Ii.AcroFormPasswordField=X1,Ii.AcroFormAppearance=or,Ii.AcroForm={ChoiceField:Cm,ListBox:Em,ComboBox:Am,EditBox:G1,Button:Lo,PushButton:K1,RadioButton:Tm,CheckBox:Q1,TextField:xh,PasswordField:X1,Appearance:or},fr.AcroForm={ChoiceField:Cm,ListBox:Em,ComboBox:Am,EditBox:G1,Button:Lo,PushButton:K1,RadioButton:Tm,CheckBox:Q1,TextField:xh,PasswordField:X1,Appearance:or};fr.AcroForm;function FZ(e){return e.reduce(function(t,r,n){return t[r]=n,t},{})}(function(e){var t="addImage_";e.__addimage__={};var r="UNKNOWN",n={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},o=e.__addimage__.getImageFileTypeByImageData=function(C,I){var R,F,M,Y,X,$=r;if((I=I||r)==="RGBA"||C.data!==void 0&&C.data instanceof Uint8ClampedArray&&"height"in C&&"width"in C)return"RGBA";if(T(C))for(X in n)for(M=n[X],R=0;R<M.length;R+=1){for(Y=!0,F=0;F<M[R].length;F+=1)if(M[R][F]!==void 0&&M[R][F]!==C[F]){Y=!1;break}if(Y===!0){$=X;break}}else for(X in n)for(M=n[X],R=0;R<M.length;R+=1){for(Y=!0,F=0;F<M[R].length;F+=1)if(M[R][F]!==void 0&&M[R][F]!==C.charCodeAt(F)){Y=!1;break}if(Y===!0){$=X;break}}return $===r&&I!==r&&($=I),$},a=function C(I){for(var R=this.internal.write,F=this.internal.putStream,M=(0,this.internal.getFilters)();M.indexOf("FlateEncode")!==-1;)M.splice(M.indexOf("FlateEncode"),1);I.objectId=this.internal.newObject();var Y=[];if(Y.push({key:"Type",value:"/XObject"}),Y.push({key:"Subtype",value:"/Image"}),Y.push({key:"Width",value:I.width}),Y.push({key:"Height",value:I.height}),I.colorSpace===x.INDEXED?Y.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(I.palette.length/3-1)+" "+("sMask"in I&&I.sMask!==void 0?I.objectId+2:I.objectId+1)+" 0 R]"}):(Y.push({key:"ColorSpace",value:"/"+I.colorSpace}),I.colorSpace===x.DEVICE_CMYK&&Y.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),Y.push({key:"BitsPerComponent",value:I.bitsPerComponent}),"decodeParameters"in I&&I.decodeParameters!==void 0&&Y.push({key:"DecodeParms",value:"<<"+I.decodeParameters+">>"}),"transparency"in I&&Array.isArray(I.transparency)&&I.transparency.length>0){for(var X="",$=0,ee=I.transparency.length;$<ee;$++)X+=I.transparency[$]+" "+I.transparency[$]+" ";Y.push({key:"Mask",value:"["+X+"]"})}I.sMask!==void 0&&Y.push({key:"SMask",value:I.objectId+1+" 0 R"});var V=I.filter!==void 0?["/"+I.filter]:void 0;if(F({data:I.data,additionalKeyValues:Y,alreadyAppliedFilters:V,objectId:I.objectId}),R("endobj"),"sMask"in I&&I.sMask!==void 0){var D,z=(D=I.sMaskBitsPerComponent)!==null&&D!==void 0?D:I.bitsPerComponent,q={width:I.width,height:I.height,colorSpace:"DeviceGray",bitsPerComponent:z,data:I.sMask};"filter"in I&&(q.decodeParameters="/Predictor ".concat(I.predictor," /Colors 1 /BitsPerComponent ").concat(z," /Columns ").concat(I.width),q.filter=I.filter),C.call(this,q)}if(I.colorSpace===x.INDEXED){var G=this.internal.newObject();F({data:P(new Uint8Array(I.palette)),objectId:G}),R("endobj")}},s=function(){var C=this.internal.collections[t+"images"];for(var I in C)a.call(this,C[I])},l=function(){var C,I=this.internal.collections[t+"images"],R=this.internal.write;for(var F in I)R("/I"+(C=I[F]).index,C.objectId,"0","R")},c=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",s),this.internal.events.subscribe("putXobjectDict",l))},u=function(){var C=this.internal.collections[t+"images"];return c.call(this),C},d=function(){return Object.keys(this.internal.collections[t+"images"]).length},f=function(C){return typeof e["process"+C.toUpperCase()]=="function"},h=function(C){return On(C)==="object"&&C.nodeType===1},p=function(C,I){if(C.nodeName==="IMG"&&C.hasAttribute("src")){var R=""+C.getAttribute("src");if(R.indexOf("data:image/")===0)return Y1(unescape(R).split("base64,").pop());var F=e.loadFile(R,!0);if(F!==void 0)return F}if(C.nodeName==="CANVAS"){if(C.width===0||C.height===0)throw new Error("Given canvas must have data. Canvas width: "+C.width+", height: "+C.height);var M;switch(I){case"PNG":M="image/png";break;case"WEBP":M="image/webp";break;default:M="image/jpeg"}return Y1(C.toDataURL(M,1).split("base64,").pop())}},v=function(C){var I=this.internal.collections[t+"images"];if(I){for(var R in I)if(C===I[R].alias)return I[R]}},m=function(C,I,R){return C||I||(C=-96,I=-96),C<0&&(C=-1*R.width*72/C/this.internal.scaleFactor),I<0&&(I=-1*R.height*72/I/this.internal.scaleFactor),C===0&&(C=I*R.width/R.height),I===0&&(I=C*R.height/R.width),[C,I]},b=function(C,I,R,F,M,Y){var X=m.call(this,R,F,M),$=this.internal.getCoordinateString,ee=this.internal.getVerticalCoordinateString,V=u.call(this);if(R=X[0],F=X[1],V[M.index]=M,Y){Y*=Math.PI/180;var D=Math.cos(Y),z=Math.sin(Y),q=function(U){return U.toFixed(4)},G=[q(D),q(z),q(-1*z),q(D),0,0,"cm"]}this.internal.write("q"),Y?(this.internal.write([1,"0","0",1,$(C),ee(I+F),"cm"].join(" ")),this.internal.write(G.join(" ")),this.internal.write([$(R),"0","0",$(F),"0","0","cm"].join(" "))):this.internal.write([$(R),"0","0",$(F),$(C),ee(I+F),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+M.index+" Do"),this.internal.write("Q")},x=e.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"};e.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"};var w=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},k=e.__addimage__.sHashCode=function(C){var I,R,F=0;if(typeof C=="string")for(R=C.length,I=0;I<R;I++)F=(F<<5)-F+C.charCodeAt(I),F|=0;else if(T(C))for(R=C.byteLength/2,I=0;I<R;I++)F=(F<<5)-F+C[I],F|=0;return F},j=e.__addimage__.validateStringAsBase64=function(C){(C=C||"").toString().trim();var I=!0;return C.length===0&&(I=!1),C.length%4!=0&&(I=!1),/^[A-Za-z0-9+/]+$/.test(C.substr(0,C.length-2))===!1&&(I=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(C.substr(-2))===!1&&(I=!1),I},_=e.__addimage__.extractImageFromDataUrl=function(C){if(C==null||!(C=C.trim()).startsWith("data:"))return null;var I=C.indexOf(",");return I<0?null:C.substring(0,I).trim().endsWith("base64")?C.substring(I+1):null};e.__addimage__.isArrayBuffer=function(C){return C instanceof ArrayBuffer};var T=e.__addimage__.isArrayBufferView=function(C){return C instanceof Int8Array||C instanceof Uint8Array||C instanceof Uint8ClampedArray||C instanceof Int16Array||C instanceof Uint16Array||C instanceof Int32Array||C instanceof Uint32Array||C instanceof Float32Array||C instanceof Float64Array},A=e.__addimage__.binaryStringToUint8Array=function(C){for(var I=C.length,R=new Uint8Array(I),F=0;F<I;F++)R[F]=C.charCodeAt(F);return R},P=e.__addimage__.arrayBufferToBinaryString=function(C){for(var I="",R=T(C)?C:new Uint8Array(C),F=0;F<R.length;F+=8192)I+=String.fromCharCode.apply(null,R.subarray(F,F+8192));return I};e.addImage=function(){var C,I,R,F,M,Y,X,$,ee;if(typeof arguments[1]=="number"?(I=r,R=arguments[1],F=arguments[2],M=arguments[3],Y=arguments[4],X=arguments[5],$=arguments[6],ee=arguments[7]):(I=arguments[1],R=arguments[2],F=arguments[3],M=arguments[4],Y=arguments[5],X=arguments[6],$=arguments[7],ee=arguments[8]),On(C=arguments[0])==="object"&&!h(C)&&"imageData"in C){var V=C;C=V.imageData,I=V.format||I||r,R=V.x||R||0,F=V.y||F||0,M=V.w||V.width||M,Y=V.h||V.height||Y,X=V.alias||X,$=V.compression||$,ee=V.rotation||V.angle||ee}var D=this.internal.getFilters();if($===void 0&&D.indexOf("FlateEncode")!==-1&&($="SLOW"),isNaN(R)||isNaN(F))throw new Error("Invalid coordinates passed to jsPDF.addImage");c.call(this);var z=N.call(this,C,I,X,$);return b.call(this,R,F,M,Y,z,ee),this};var N=function(C,I,R,F){var M,Y,X;if(typeof C=="string"&&o(C)===r){C=unescape(C);var $=O(C,!1);($!==""||($=e.loadFile(C,!0))!==void 0)&&(C=$)}if(h(C)&&(C=p(C,I)),I=o(C,I),!f(I))throw new Error("addImage does not support files of type '"+I+"', please ensure that a plugin for '"+I+"' support is added.");if(((X=R)==null||X.length===0)&&(R=(function(ee){return typeof ee=="string"||T(ee)?k(ee):T(ee.data)?k(ee.data):null})(C)),(M=v.call(this,R))||(C instanceof Uint8Array||I==="RGBA"||(Y=C,C=A(C)),M=this["process"+I.toUpperCase()](C,d.call(this),R,(function(ee){return ee&&typeof ee=="string"&&(ee=ee.toUpperCase()),ee in e.image_compression?ee:w.NONE})(F),Y)),!M)throw new Error("An unknown error occurred whilst processing the image.");return M},O=e.__addimage__.convertBase64ToBinaryString=function(C,I){I=typeof I!="boolean"||I;var R,F="";if(typeof C=="string"){var M;R=(M=_(C))!==null&&M!==void 0?M:C;try{F=Y1(R)}catch(Y){if(I)throw j(R)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+Y.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return F};e.getImageProperties=function(C){var I,R,F="";if(h(C)&&(C=p(C)),typeof C=="string"&&o(C)===r&&((F=O(C,!1))===""&&(F=e.loadFile(C)||""),C=F),R=o(C),!f(R))throw new Error("addImage does not support files of type '"+R+"', please ensure that a plugin for '"+R+"' support is added.");if(C instanceof Uint8Array||(C=A(C)),!(I=this["process"+R.toUpperCase()](C)))throw new Error("An unknown error occurred whilst processing the image");return I.fileType=R,I}})(fr.API),(function(e){var t=function(r){if(r!==void 0&&r!="")return!0};fr.API.events.push(["addPage",function(r){this.internal.getPageInfo(r.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(r){for(var n,o,a,s=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,c=this.internal.getPageInfoByObjId(r.objId),u=r.pageContext.annotations,d=!1,f=0;f<u.length&&!d;f++)switch((n=u[f]).type){case"link":(t(n.options.url)||t(n.options.pageNumber))&&(d=!0);break;case"reference":case"text":case"freetext":d=!0}if(d!=0){this.internal.write("/Annots [");for(var h=0;h<u.length;h++){n=u[h];var p=this.internal.pdfEscape,v=this.internal.getEncryptor(r.objId);switch(n.type){case"reference":this.internal.write(" "+n.object.objId+" 0 R ");break;case"text":var m=this.internal.newAdditionalObject(),b=this.internal.newAdditionalObject(),x=this.internal.getEncryptor(m.objId),w=n.title||"Note";a="<</Type /Annot /Subtype /Text "+(o="/Rect ["+s(n.bounds.x)+" "+l(n.bounds.y+n.bounds.h)+" "+s(n.bounds.x+n.bounds.w)+" "+l(n.bounds.y)+"] ")+"/Contents ("+p(x(n.contents))+")",a+=" /Popup "+b.objId+" 0 R",a+=" /P "+c.objId+" 0 R",a+=" /T ("+p(x(w))+") >>",m.content=a;var k=m.objId+" 0 R";a="<</Type /Annot /Subtype /Popup "+(o="/Rect ["+s(n.bounds.x+30)+" "+l(n.bounds.y+n.bounds.h)+" "+s(n.bounds.x+n.bounds.w+30)+" "+l(n.bounds.y)+"] ")+" /Parent "+k,n.open&&(a+=" /Open true"),a+=" >>",b.content=a,this.internal.write(m.objId,"0 R",b.objId,"0 R");break;case"freetext":o="/Rect ["+s(n.bounds.x)+" "+l(n.bounds.y)+" "+s(n.bounds.x+n.bounds.w)+" "+l(n.bounds.y+n.bounds.h)+"] ";var j="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(n.color||"#000000");a="<</Type /Annot /Subtype /FreeText "+o+"/Contents ("+p(v(n.contents))+")",a+=" /DS("+p(v(j))+")",a+=" /Border [0 0 0]",a+=" >>",this.internal.write(a);break;case"link":if(n.options.name){var _=this.annotations._nameMap[n.options.name];n.options.pageNumber=_.page,n.options.top=_.y}else n.options.top||(n.options.top=0);if(o="/Rect ["+n.finalBounds.x+" "+n.finalBounds.y+" "+n.finalBounds.w+" "+n.finalBounds.h+"] ",a="",n.options.url)a="<</Type /Annot /Subtype /Link "+o+"/Border [0 0 0] /A <</S /URI /URI ("+p(v(n.options.url))+") >>";else if(n.options.pageNumber)switch(a="<</Type /Annot /Subtype /Link "+o+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(n.options.pageNumber).objId+" 0 R",n.options.magFactor=n.options.magFactor||"XYZ",n.options.magFactor){case"Fit":a+=" /Fit]";break;case"FitH":a+=" /FitH "+n.options.top+"]";break;case"FitV":n.options.left=n.options.left||0,a+=" /FitV "+n.options.left+"]";break;default:var T=l(n.options.top);n.options.left=n.options.left||0,n.options.zoom===void 0&&(n.options.zoom=0),a+=" /XYZ "+n.options.left+" "+T+" "+n.options.zoom+"]"}a!=""&&(a+=" >>",this.internal.write(a))}}this.internal.write("]")}}]),e.createAnnotation=function(r){var n=this.internal.getCurrentPageInfo();switch(r.type){case"link":this.link(r.bounds.x,r.bounds.y,r.bounds.w,r.bounds.h,r);break;case"text":case"freetext":n.pageContext.annotations.push(r)}},e.link=function(r,n,o,a,s){var l=this.internal.getCurrentPageInfo(),c=this.internal.getCoordinateString,u=this.internal.getVerticalCoordinateString;l.pageContext.annotations.push({finalBounds:{x:c(r),y:u(n),w:c(r+o),h:u(n+a)},options:s,type:"link"})},e.textWithLink=function(r,n,o,a){var s,l,c=this.getTextWidth(r),u=this.internal.getLineHeight()/this.internal.scaleFactor;if(a.maxWidth!==void 0){l=a.maxWidth;var d=this.splitTextToSize(r,l).length;s=Math.ceil(u*d)}else l=c,s=u;return this.text(r,n,o,a),o+=.2*u,a.align==="center"&&(n-=c/2),a.align==="right"&&(n-=c),this.link(n,o-u,l,s,a),c},e.getTextWidth=function(r){var n=this.internal.getFontSize();return this.getStringUnitWidth(r)*n/this.internal.scaleFactor}})(fr.API),(function(e){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},r={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},n={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},o=[1570,1571,1573,1575];e.__arabicParser__={};var a=e.__arabicParser__.isInArabicSubstitutionA=function(m){return t[m.charCodeAt(0)]!==void 0},s=e.__arabicParser__.isArabicLetter=function(m){return typeof m=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(m)},l=e.__arabicParser__.isArabicEndLetter=function(m){return s(m)&&a(m)&&t[m.charCodeAt(0)].length<=2},c=e.__arabicParser__.isArabicAlfLetter=function(m){return s(m)&&o.indexOf(m.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(m){return s(m)&&a(m)&&t[m.charCodeAt(0)].length>=1};var u=e.__arabicParser__.arabicLetterHasFinalForm=function(m){return s(m)&&a(m)&&t[m.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(m){return s(m)&&a(m)&&t[m.charCodeAt(0)].length>=3};var d=e.__arabicParser__.arabicLetterHasMedialForm=function(m){return s(m)&&a(m)&&t[m.charCodeAt(0)].length==4},f=e.__arabicParser__.resolveLigatures=function(m){var b=0,x=r,w="",k=0;for(b=0;b<m.length;b+=1)x[m.charCodeAt(b)]!==void 0?(k++,typeof(x=x[m.charCodeAt(b)])=="number"&&(w+=String.fromCharCode(x),x=r,k=0),b===m.length-1&&(x=r,w+=m.charAt(b-(k-1)),b-=k-1,k=0)):(x=r,w+=m.charAt(b-k),b-=k,k=0);return w};e.__arabicParser__.isArabicDiacritic=function(m){return m!==void 0&&n[m.charCodeAt(0)]!==void 0};var h=e.__arabicParser__.getCorrectForm=function(m,b,x){return s(m)?a(m)===!1?-1:!u(m)||!s(b)&&!s(x)||!s(x)&&l(b)||l(m)&&!s(b)||l(m)&&c(b)||l(m)&&l(b)?0:d(m)&&s(b)&&!l(b)&&s(x)&&u(x)?3:l(m)||!s(x)?1:2:-1},p=function(m){var b=0,x=0,w=0,k="",j="",_="",T=(m=m||"").split("\\s+"),A=[];for(b=0;b<T.length;b+=1){for(A.push(""),x=0;x<T[b].length;x+=1)k=T[b][x],j=T[b][x-1],_=T[b][x+1],s(k)?(w=h(k,j,_),A[b]+=w!==-1?String.fromCharCode(t[k.charCodeAt(0)][w]):k):A[b]+=k;A[b]=f(A[b])}return A.join(" ")},v=e.__arabicParser__.processArabic=e.processArabic=function(){var m,b=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,x=[];if(Array.isArray(b)){var w=0;for(x=[],w=0;w<b.length;w+=1)Array.isArray(b[w])?x.push([p(b[w][0]),b[w][1],b[w][2]]):x.push([p(b[w])]);m=x}else m=p(b);return typeof arguments[0]=="string"?m:(arguments[0].text=m,arguments[0])};e.events.push(["preProcessText",v])})(fr.API),fr.API.autoPrint=function(e){var t;return(e=e||{}).variant=e.variant||"non-conform",e.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+t+" 0 R")})),this},(function(e){var t=function(){var r=void 0;Object.defineProperty(this,"pdf",{get:function(){return r},set:function(l){r=l}});var n=150;Object.defineProperty(this,"width",{get:function(){return n},set:function(l){n=isNaN(l)||Number.isInteger(l)===!1||l<0?150:l,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=n+1)}});var o=300;Object.defineProperty(this,"height",{get:function(){return o},set:function(l){o=isNaN(l)||Number.isInteger(l)===!1||l<0?300:l,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=o+1)}});var a=[];Object.defineProperty(this,"childNodes",{get:function(){return a},set:function(l){a=l}});var s={};Object.defineProperty(this,"style",{get:function(){return s},set:function(l){s=l}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(r,n){var o;if((r=r||"2d")!=="2d")return null;for(o in n)this.pdf.context2d.hasOwnProperty(o)&&(this.pdf.context2d[o]=n[o]);return this.pdf.context2d._canvas=this,this.pdf.context2d},t.prototype.toDataURL=function(){throw new Error("toDataURL is not implemented.")},e.events.push(["initialized",function(){this.canvas=new t,this.canvas.pdf=this}])})(fr.API),(function(e){var t={left:0,top:0,bottom:0,right:0},r=!1,n=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),o.call(this))},o=function(){this.internal.__cell__.lastCell=new a,this.internal.__cell__.pages=1},a=function(){var c=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return c},set:function(m){c=m}});var u=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return u},set:function(m){u=m}});var d=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return d},set:function(m){d=m}});var f=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return f},set:function(m){f=m}});var h=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return h},set:function(m){h=m}});var p=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return p},set:function(m){p=m}});var v=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return v},set:function(m){v=m}}),this};a.prototype.clone=function(){return new a(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},a.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(c){return n.call(this),this.internal.__cell__.headerFunction=typeof c=="function"?c:void 0,this},e.getTextDimensions=function(c,u){n.call(this);var d=(u=u||{}).fontSize||this.getFontSize(),f=u.font||this.getFont(),h=u.scaleFactor||this.internal.scaleFactor,p=0,v=0,m=0,b=this;if(!Array.isArray(c)&&typeof c!="string"){if(typeof c!="number")throw new Error("getTextDimensions expects text-parameter to be of type String or type Number or an Array of Strings.");c=String(c)}var x=u.maxWidth;x>0?typeof c=="string"?c=this.splitTextToSize(c,x):Object.prototype.toString.call(c)==="[object Array]"&&(c=c.reduce(function(k,j){return k.concat(b.splitTextToSize(j,x))},[])):c=Array.isArray(c)?c:[c];for(var w=0;w<c.length;w++)p<(m=this.getStringUnitWidth(c[w],{font:f})*d)&&(p=m);return p!==0&&(v=c.length),{w:p/=h,h:Math.max((v*d*this.getLineHeightFactor()-d*(this.getLineHeightFactor()-1))/h,0)}},e.cellAddPage=function(){n.call(this),this.addPage();var c=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new a(c.left,c.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var s=e.cell=function(){var c;c=arguments[0]instanceof a?arguments[0]:new a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),n.call(this);var u=this.internal.__cell__.lastCell,d=this.internal.__cell__.padding,f=this.internal.__cell__.margins||t,h=this.internal.__cell__.tableHeaderRow,p=this.internal.__cell__.printHeaders;return u.lineNumber!==void 0&&(u.lineNumber===c.lineNumber?(c.x=(u.x||0)+(u.width||0),c.y=u.y||0):u.y+u.height+c.height+f.bottom>this.getPageHeight()?(this.cellAddPage(),c.y=f.top,p&&h&&(this.printHeaderRow(c.lineNumber,!0),c.y+=h[0].height)):c.y=u.y+u.height||c.y),c.text[0]!==void 0&&(this.rect(c.x,c.y,c.width,c.height,r===!0?"FD":void 0),c.align==="right"?this.text(c.text,c.x+c.width-d,c.y+d,{align:"right",baseline:"top"}):c.align==="center"?this.text(c.text,c.x+c.width/2,c.y+d,{align:"center",baseline:"top",maxWidth:c.width-d-d}):this.text(c.text,c.x+d,c.y+d,{align:"left",baseline:"top",maxWidth:c.width-d-d})),this.internal.__cell__.lastCell=c,this};e.table=function(c,u,d,f,h){if(n.call(this),!d)throw new Error("No data for PDF table.");var p,v,m,b,x=[],w=[],k=[],j={},_={},T=[],A=[],P=(h=h||{}).autoSize||!1,N=h.printHeaders!==!1,O=h.css&&h.css["font-size"]!==void 0?16*h.css["font-size"]:h.fontSize||12,C=h.margins||Object.assign({width:this.getPageWidth()},t),I=typeof h.padding=="number"?h.padding:3,R=h.headerBackgroundColor||"#c8c8c8",F=h.headerTextColor||"#000";if(o.call(this),this.internal.__cell__.printHeaders=N,this.internal.__cell__.margins=C,this.internal.__cell__.table_font_size=O,this.internal.__cell__.padding=I,this.internal.__cell__.headerBackgroundColor=R,this.internal.__cell__.headerTextColor=F,this.setFontSize(O),f==null)w=x=Object.keys(d[0]),k=x.map(function(){return"left"});else if(Array.isArray(f)&&On(f[0])==="object")for(x=f.map(function(V){return V.name}),w=f.map(function(V){return V.prompt||V.name||""}),k=f.map(function(V){return V.align||"left"}),p=0;p<f.length;p+=1)_[f[p].name]=.7499990551181103*f[p].width;else Array.isArray(f)&&typeof f[0]=="string"&&(w=x=f,k=x.map(function(){return"left"}));if(P||Array.isArray(f)&&typeof f[0]=="string")for(p=0;p<x.length;p+=1){for(j[b=x[p]]=d.map(function(V){return V[b]}),this.setFont(void 0,"bold"),T.push(this.getTextDimensions(w[p],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),v=j[b],this.setFont(void 0,"normal"),m=0;m<v.length;m+=1)T.push(this.getTextDimensions(v[m],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);_[b]=Math.max.apply(null,T)+I+I,T=[]}if(N){var M={};for(p=0;p<x.length;p+=1)M[x[p]]={},M[x[p]].text=w[p],M[x[p]].align=k[p];var Y=l.call(this,M,_);A=x.map(function(V){return new a(c,u,_[V],Y,M[V].text,void 0,M[V].align)}),this.setTableHeaderRow(A),this.printHeaderRow(1,!1)}var X=f.reduce(function(V,D){return V[D.name]=D.align,V},{});for(p=0;p<d.length;p+=1){"rowStart"in h&&h.rowStart instanceof Function&&h.rowStart({row:p,data:d[p]},this);var $=l.call(this,d[p],_);for(m=0;m<x.length;m+=1){var ee=d[p][x[m]];"cellStart"in h&&h.cellStart instanceof Function&&h.cellStart({row:p,col:m,data:ee},this),s.call(this,new a(c,u,_[x[m]],$,ee,p+2,X[x[m]]))}}return this.internal.__cell__.table_x=c,this.internal.__cell__.table_y=u,this};var l=function(c,u){var d=this.internal.__cell__.padding,f=this.internal.__cell__.table_font_size,h=this.internal.scaleFactor;return Object.keys(c).map(function(p){var v=c[p];return this.splitTextToSize(v.hasOwnProperty("text")?v.text:v,u[p]-d-d)},this).map(function(p){return this.getLineHeightFactor()*p.length*f/h+d+d},this).reduce(function(p,v){return Math.max(p,v)},0)};e.setTableHeaderRow=function(c){n.call(this),this.internal.__cell__.tableHeaderRow=c},e.printHeaderRow=function(c,u){if(n.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var d;if(r=!0,typeof this.internal.__cell__.headerFunction=="function"){var f=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new a(f[0],f[1],f[2],f[3],void 0,-1)}this.setFont(void 0,"bold");for(var h=[],p=0;p<this.internal.__cell__.tableHeaderRow.length;p+=1){d=this.internal.__cell__.tableHeaderRow[p].clone(),u&&(d.y=this.internal.__cell__.margins.top||0,h.push(d)),d.lineNumber=c;var v=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),s.call(this,d),this.setTextColor(v)}h.length>0&&this.setTableHeaderRow(h),this.setFont(void 0,"normal"),r=!1}})(fr.API);var zZ={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},MZ=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],J6=FZ(MZ),DZ=[100,200,300,400,500,600,700,800,900],nRe=FZ(DZ);function s3(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),r=(function(a){return zZ[a=a||"normal"]?a:"normal"})(e.style),n=(function(a){return a?typeof a=="number"?a>=100&&a<=900&&a%100==0?a:400:/^\d00$/.test(a)?parseInt(a):a==="bold"?700:400:400})(e.weight),o=(function(a){return typeof J6[a=a||"normal"]=="number"?a:"normal"})(e.stretch);return{family:t,style:r,weight:n,stretch:o,src:e.src||[],ref:e.ref||{name:t,style:[o,r,n].join(" ")}}}function lq(e,t,r,n){var o;for(o=r;o>=0&&o<t.length;o+=n)if(e[t[o]])return e[t[o]];for(o=r;o>=0&&o<t.length;o-=n)if(e[t[o]])return e[t[o]]}var iRe={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},cq={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function uq(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function dq(e){return e.trimLeft()}function oRe(e,t){for(var r=0;r<e.length;){if(e.charAt(r)===t)return[e.substring(0,r),e.substring(r+1)];r+=1}return null}function aRe(e){var t=e.match(/^(-[a-z_]|[a-z_])[a-z0-9_-]*/i);return t===null?null:[t[0],e.substring(t[0].length)]}var Gg,O1,fq,pq,hq,l3=["times"];function gq(e,t,r,n,o){var a=4,s=vq;switch(o){case fr.API.image_compression.FAST:a=1,s=mq;break;case fr.API.image_compression.MEDIUM:a=6,s=yq;break;case fr.API.image_compression.SLOW:a=9,s=xq}e=(function(c,u,d,f){for(var h,p=c.length/u,v=new Uint8Array(c.length+p),m=[sRe,mq,vq,yq,xq],b=0;b<p;b+=1){var x=b*u,w=c.subarray(x,x+u);if(f)v.set(f(w,d,h),x+b);else{for(var k=m.length,j=[],_=0;_<k;_+=1)j[_]=m[_](w,d,h);var T=cRe(j.concat());v.set(j[T],x+b)}h=w}return v})(e,t,Math.ceil(r*n/8),s);var l=V6(e,{level:a});return fr.API.__addimage__.arrayBufferToBinaryString(l)}function sRe(e){var t=Array.apply([],e);return t.unshift(0),t}function mq(e,t){var r=e.length,n=[];n[0]=1;for(var o=0;o<r;o+=1){var a=e[o-t]||0;n[o+1]=e[o]-a+256&255}return n}function vq(e,t,r){var n=e.length,o=[];o[0]=2;for(var a=0;a<n;a+=1){var s=r&&r[a]||0;o[a+1]=e[a]-s+256&255}return o}function yq(e,t,r){var n=e.length,o=[];o[0]=3;for(var a=0;a<n;a+=1){var s=e[a-t]||0,l=r&&r[a]||0;o[a+1]=e[a]+256-(s+l>>>1)&255}return o}function xq(e,t,r){var n=e.length,o=[];o[0]=4;for(var a=0;a<n;a+=1){var s=lRe(e[a-t]||0,r&&r[a]||0,r&&r[a-t]||0);o[a+1]=e[a]-s+256&255}return o}function lRe(e,t,r){if(e===t&&t===r)return e;var n=Math.abs(t-r),o=Math.abs(e-r),a=Math.abs(e+t-r-r);return n<=o&&n<=a?e:o<=a?t:r}function cRe(e){var t=e.map(function(r){return r.reduce(function(n,o){return n+Math.abs(o)},0)});return t.indexOf(Math.min.apply(null,t))}function c3(e,t,r){var n=t*r,o=Math.floor(n/8),a=16-(n-8*o+r),s=(1<<r)-1;return BZ(e,o)>>a&s}function bq(e,t,r,n){var o=r*n,a=Math.floor(o/8),s=16-(o-8*a+n),l=(1<<n)-1,c=(t&l)<<s;(function(u,d,f){if(d+1<u.byteLength)u.setUint16(d,f,!1);else{var h=f>>8&255;u.setUint8(d,h)}})(e,a,BZ(e,a)&~(l<<s)&65535|c)}function BZ(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function uRe(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var r=e[t++]|e[t++]<<8,n=e[t++]|e[t++]<<8,o=e[t++],a=o>>7,s=1<<1+(7&o);e[t++],e[t++];var l=null,c=null;a&&(l=t,c=s,t+=3*s);var u=!0,d=[],f=0,h=null,p=0,v=null;for(this.width=r,this.height=n;u&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,v=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((C=e[t++])>=0))throw Error("Invalid block size");if(C===0)break;t+=C}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var m=e[t++];f=e[t++]|e[t++]<<8,h=e[t++],1&m||(h=null),p=m>>2&7,t++;break;case 254:for(;;){if(!((C=e[t++])>=0))throw Error("Invalid block size");if(C===0)break;t+=C}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var b=e[t++]|e[t++]<<8,x=e[t++]|e[t++]<<8,w=e[t++]|e[t++]<<8,k=e[t++]|e[t++]<<8,j=e[t++],_=j>>6&1,T=1<<1+(7&j),A=l,P=c,N=!1;j>>7&&(N=!0,A=t,P=T,t+=3*T);var O=t;for(t++;;){var C;if(!((C=e[t++])>=0))throw Error("Invalid block size");if(C===0)break;t+=C}d.push({x:b,y:x,width:w,height:k,has_local_palette:N,palette_offset:A,palette_size:P,data_offset:O,data_length:t-O,transparent_index:h,interlaced:!!_,delay:f,disposal:p});break;case 59:u=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return d.length},this.loopCount=function(){return v},this.frameInfo=function(I){if(I<0||I>=d.length)throw new Error("Frame index out of range.");return d[I]},this.decodeAndBlitFrameBGRA=function(I,R){var F=this.frameInfo(I),M=F.width*F.height;if(M>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var Y=new Uint8Array(M);wq(e,F.data_offset,Y,M);var X=F.palette_offset,$=F.transparent_index;$===null&&($=256);var ee=F.width,V=r-ee,D=ee,z=4*(F.y*r+F.x),q=4*((F.y+F.height)*r+F.x),G=z,U=4*V;F.interlaced===!0&&(U+=4*r*7);for(var Q=8,K=0,re=Y.length;K<re;++K){var H=Y[K];if(D===0&&(D=ee,(G+=U)>=q&&(U=4*V+4*r*(Q-1),G=z+(ee+V)*(Q<<1),Q>>=1)),H===$)G+=4;else{var ie=e[X+3*H],de=e[X+3*H+1],le=e[X+3*H+2];R[G++]=le,R[G++]=de,R[G++]=ie,R[G++]=255}--D}},this.decodeAndBlitFrameRGBA=function(I,R){var F=this.frameInfo(I),M=F.width*F.height;if(M>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var Y=new Uint8Array(M);wq(e,F.data_offset,Y,M);var X=F.palette_offset,$=F.transparent_index;$===null&&($=256);var ee=F.width,V=r-ee,D=ee,z=4*(F.y*r+F.x),q=4*((F.y+F.height)*r+F.x),G=z,U=4*V;F.interlaced===!0&&(U+=4*r*7);for(var Q=8,K=0,re=Y.length;K<re;++K){var H=Y[K];if(D===0&&(D=ee,(G+=U)>=q&&(U=4*V+4*r*(Q-1),G=z+(ee+V)*(Q<<1),Q>>=1)),H===$)G+=4;else{var ie=e[X+3*H],de=e[X+3*H+1],le=e[X+3*H+2];R[G++]=ie,R[G++]=de,R[G++]=le,R[G++]=255}--D}}}function wq(e,t,r,n){for(var o=e[t++],a=1<<o,s=a+1,l=s+1,c=o+1,u=(1<<c)-1,d=0,f=0,h=0,p=e[t++],v=new Int32Array(4096),m=null;;){for(;d<16&&p!==0;)f|=e[t++]<<d,d+=8,p===1?p=e[t++]:--p;if(d<c)break;var b=f&u;if(f>>=c,d-=c,b!==a){if(b===s)break;for(var x=b<l?b:m,w=0,k=x;k>a;)k=v[k]>>8,++w;var j=k;if(h+w+(x!==b?1:0)>n)return void Bn.log("Warning, gif stream longer than expected.");r[h++]=j;var _=h+=w;for(x!==b&&(r[h++]=j),k=x;w--;)k=v[k],r[--_]=255&k,k>>=8;m!==null&&l<4096&&(v[l++]=m<<8|j,l>=u+1&&c<12&&(++c,u=u<<1|1)),m=b}else l=s+1,u=(1<<(c=o+1))-1,m=null}return h!==n&&Bn.log("Warning, gif stream shorter than expected."),r}/**
* @license
Copyright (c) 2008, Adobe Systems Incorporated
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Adobe Systems Incorporated nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/function u3(e){var t,r,n,o,a,s=Math.floor,l=new Array(64),c=new Array(64),u=new Array(64),d=new Array(64),f=new Array(65535),h=new Array(65535),p=new Array(64),v=new Array(64),m=[],b=0,x=7,w=new Array(64),k=new Array(64),j=new Array(64),_=new Array(256),T=new Array(2048),A=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],P=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],N=[0,1,2,3,4,5,6,7,8,9,10,11],O=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],C=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],I=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],F=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],M=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function Y(z,q){for(var G=0,U=0,Q=new Array,K=1;K<=16;K++){for(var re=1;re<=z[K];re++)Q[q[U]]=[],Q[q[U]][0]=G,Q[q[U]][1]=K,U++,G++;G*=2}return Q}function X(z){for(var q=z[0],G=z[1]-1;G>=0;)q&1<<G&&(b|=1<<x),G--,--x<0&&(b==255?($(255),$(0)):$(b),x=7,b=0)}function $(z){m.push(z)}function ee(z){$(z>>8&255),$(255&z)}function V(z,q,G,U,Q){for(var K,re=Q[0],H=Q[240],ie=(function(ue,Me){var Se,Pe,Ee,Ae,Ye,rt,He,xt,st,Te,et=0;for(st=0;st<8;++st){Se=ue[et],Pe=ue[et+1],Ee=ue[et+2],Ae=ue[et+3],Ye=ue[et+4],rt=ue[et+5],He=ue[et+6];var Pt=Se+(xt=ue[et+7]),qe=Se-xt,Et=Pe+He,vt=Pe-He,Ft=Ee+rt,Ce=Ee-rt,lt=Ae+Ye,Xe=Ae-Ye,Be=Pt+lt,ct=Pt-lt,Tt=Et+Ft,We=Et-Ft;ue[et]=Be+Tt,ue[et+4]=Be-Tt;var ce=.707106781*(We+ct);ue[et+2]=ct+ce,ue[et+6]=ct-ce;var he=.382683433*((Be=Xe+Ce)-(We=vt+qe)),je=.5411961*Be+he,xe=1.306562965*We+he,Re=.707106781*(Tt=Ce+vt),ze=qe+Re,Le=qe-Re;ue[et+5]=Le+je,ue[et+3]=Le-je,ue[et+1]=ze+xe,ue[et+7]=ze-xe,et+=8}for(et=0,st=0;st<8;++st){Se=ue[et],Pe=ue[et+8],Ee=ue[et+16],Ae=ue[et+24],Ye=ue[et+32],rt=ue[et+40],He=ue[et+48];var Qe=Se+(xt=ue[et+56]),mt=Se-xt,ft=Pe+He,It=Pe-He,Bt=Ee+rt,dr=Ee-rt,pr=Ae+Ye,an=Ae-Ye,Jn=Qe+pr,Fi=Qe-pr,Fn=ft+Bt,Bo=ft-Bt;ue[et]=Jn+Fn,ue[et+32]=Jn-Fn;var io=.707106781*(Bo+Fi);ue[et+16]=Fi+io,ue[et+48]=Fi-io;var Wo=.382683433*((Jn=an+dr)-(Bo=It+mt)),Yi=.5411961*Jn+Wo,qo=1.306562965*Bo+Wo,Ca=.707106781*(Fn=dr+It),xs=mt+Ca,el=mt-Ca;ue[et+40]=el+Yi,ue[et+24]=el-Yi,ue[et+8]=xs+qo,ue[et+56]=xs-qo,et++}for(st=0;st<64;++st)Te=ue[st]*Me[st],p[st]=Te>0?Te+.5|0:Te-.5|0;return p})(z,q),de=0;de<64;++de)v[A[de]]=ie[de];var le=v[0]-G;G=v[0],le==0?X(U[0]):(X(U[h[K=32767+le]]),X(f[K]));for(var ke=63;ke>0&&v[ke]==0;)ke--;if(ke==0)return X(re),G;for(var ve,se=1;se<=ke;){for(var be=se;v[se]==0&&se<=ke;)++se;var De=se-be;if(De>=16){ve=De>>4;for(var ae=1;ae<=ve;++ae)X(H);De&=15}K=32767+v[se],X(Q[(De<<4)+h[K]]),X(f[K]),se++}return ke!=63&&X(re),G}function D(z){z=Math.min(Math.max(z,1),100),a!=z&&((function(q){for(var G=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],U=0;U<64;U++){var Q=s((G[U]*q+50)/100);Q=Math.min(Math.max(Q,1),255),l[A[U]]=Q}for(var K=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],re=0;re<64;re++){var H=s((K[re]*q+50)/100);H=Math.min(Math.max(H,1),255),c[A[re]]=H}for(var ie=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],de=0,le=0;le<8;le++)for(var ke=0;ke<8;ke++)u[de]=1/(l[A[de]]*ie[le]*ie[ke]*8),d[de]=1/(c[A[de]]*ie[le]*ie[ke]*8),de++})(z<50?Math.floor(5e3/z):Math.floor(200-2*z)),a=z)}this.encode=function(z,q){q&&D(q),m=new Array,b=0,x=7,ee(65496),ee(65504),ee(16),$(74),$(70),$(73),$(70),$(0),$(1),$(1),$(0),ee(1),ee(1),$(0),$(0),(function(){ee(65499),ee(132),$(0);for(var Pe=0;Pe<64;Pe++)$(l[Pe]);$(1);for(var Ee=0;Ee<64;Ee++)$(c[Ee])})(),(function(Pe,Ee){ee(65472),ee(17),$(8),ee(Ee),ee(Pe),$(3),$(1),$(17),$(0),$(2),$(17),$(1),$(3),$(17),$(1)})(z.width,z.height),(function(){ee(65476),ee(418),$(0);for(var Pe=0;Pe<16;Pe++)$(P[Pe+1]);for(var Ee=0;Ee<=11;Ee++)$(N[Ee]);$(16);for(var Ae=0;Ae<16;Ae++)$(O[Ae+1]);for(var Ye=0;Ye<=161;Ye++)$(C[Ye]);$(1);for(var rt=0;rt<16;rt++)$(I[rt+1]);for(var He=0;He<=11;He++)$(R[He]);$(17);for(var xt=0;xt<16;xt++)$(F[xt+1]);for(var st=0;st<=161;st++)$(M[st])})(),ee(65498),ee(12),$(3),$(1),$(0),$(2),$(17),$(3),$(17),$(0),$(63),$(0);var G=0,U=0,Q=0;b=0,x=7,this.encode.displayName="_encode_";for(var K,re,H,ie,de,le,ke,ve,se,be=z.data,De=z.width,ae=z.height,ue=4*De,Me=0;Me<ae;){for(K=0;K<ue;){for(de=ue*Me+K,ke=-1,ve=0,se=0;se<64;se++)le=de+(ve=se>>3)*ue+(ke=4*(7&se)),Me+ve>=ae&&(le-=ue*(Me+1+ve-ae)),K+ke>=ue&&(le-=K+ke-ue+4),re=be[le++],H=be[le++],ie=be[le++],w[se]=(T[re]+T[H+256|0]+T[ie+512|0]>>16)-128,k[se]=(T[re+768|0]+T[H+1024|0]+T[ie+1280|0]>>16)-128,j[se]=(T[re+1280|0]+T[H+1536|0]+T[ie+1792|0]>>16)-128;G=V(w,u,G,t,n),U=V(k,d,U,r,o),Q=V(j,d,Q,r,o),K+=32}Me+=8}if(x>=0){var Se=[];Se[1]=x+1,Se[0]=(1<<x+1)-1,X(Se)}return ee(65497),new Uint8Array(m)},e=e||50,(function(){for(var z=String.fromCharCode,q=0;q<256;q++)_[q]=z(q)})(),t=Y(P,N),r=Y(I,R),n=Y(O,C),o=Y(F,M),(function(){for(var z=1,q=2,G=1;G<=15;G++){for(var U=z;U<q;U++)h[32767+U]=G,f[32767+U]=[],f[32767+U][1]=G,f[32767+U][0]=U;for(var Q=-(q-1);Q<=-z;Q++)h[32767+Q]=G,f[32767+Q]=[],f[32767+Q][1]=G,f[32767+Q][0]=q-1+Q;z<<=1,q<<=1}})(),(function(){for(var z=0;z<256;z++)T[z]=19595*z,T[z+256|0]=38470*z,T[z+512|0]=7471*z+32768,T[z+768|0]=-11059*z,T[z+1024|0]=-21709*z,T[z+1280|0]=32768*z+8421375,T[z+1536|0]=-27439*z,T[z+1792|0]=-5329*z})(),D(e)}/**
* @license
* Copyright (c) 2017 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/function tc(e,t){if(this.pos=0,this.buffer=e,this.datav=new DataView(e.buffer),this.is_with_alpha=!!t,this.bottom_up=!0,this.flag=String.fromCharCode(this.buffer[0])+String.fromCharCode(this.buffer[1]),this.pos+=2,["BM","BA","CI","CP","IC","PT"].indexOf(this.flag)===-1)throw new Error("Invalid BMP File");this.parseHeader(),this.parseBGR()}function Sq(e){function t(N){if(!N)throw Error("assert :P")}function r(N,O,C){for(var I=0;4>I;I++)if(N[O+I]!=C.charCodeAt(I))return!0;return!1}function n(N,O,C,I,R){for(var F=0;F<R;F++)N[O+F]=C[I+F]}function o(N,O,C,I){for(var R=0;R<I;R++)N[O+R]=C}function a(N){return new Int32Array(N)}function s(N,O){for(var C=[],I=0;I<N;I++)C.push(new O);return C}function l(N,O){var C=[];return(function I(R,F,M){for(var Y=M[F],X=0;X<Y&&(R.push(M.length>F+1?[]:new O),!(M.length<F+1));X++)I(R[X],F+1,M)})(C,0,N),C}var c=function(){var N=this;function O(L,W){for(var te=1<<W-1>>>0;L&te;)te>>>=1;return te?(L&te-1)+te:L}function C(L,W,te,oe,pe){t(!(oe%te));do L[W+(oe-=te)]=pe;while(0<oe)}function I(L,W,te,oe,pe){if(t(2328>=pe),512>=pe)var me=a(512);else if((me=a(pe))==null)return 0;return(function(ye,we,_e,Oe,Ge,it){var Ne,Ze,nt=we,bt=1<<_e,at=a(16),gt=a(16);for(t(Ge!=0),t(Oe!=null),t(ye!=null),t(0<_e),Ze=0;Ze<Ge;++Ze){if(15<Oe[Ze])return 0;++at[Oe[Ze]]}if(at[0]==Ge)return 0;for(gt[1]=0,Ne=1;15>Ne;++Ne){if(at[Ne]>1<<Ne)return 0;gt[Ne+1]=gt[Ne]+at[Ne]}for(Ze=0;Ze<Ge;++Ze)Ne=Oe[Ze],0<Oe[Ze]&&(it[gt[Ne]++]=Ze);if(gt[15]==1)return(Oe=new R).g=0,Oe.value=it[0],C(ye,nt,1,bt,Oe),bt;var yt,_t=-1,At=bt-1,sr=0,Kt=1,Ir=1,er=1<<_e;for(Ze=0,Ne=1,Ge=2;Ne<=_e;++Ne,Ge<<=1){if(Kt+=Ir<<=1,0>(Ir-=at[Ne]))return 0;for(;0<at[Ne];--at[Ne])(Oe=new R).g=Ne,Oe.value=it[Ze++],C(ye,nt+sr,Ge,er,Oe),sr=O(sr,Ne)}for(Ne=_e+1,Ge=2;15>=Ne;++Ne,Ge<<=1){if(Kt+=Ir<<=1,0>(Ir-=at[Ne]))return 0;for(;0<at[Ne];--at[Ne]){if(Oe=new R,(sr&At)!=_t){for(nt+=er,yt=1<<(_t=Ne)-_e;15>_t&&!(0>=(yt-=at[_t]));)++_t,yt<<=1;bt+=er=1<<(yt=_t-_e),ye[we+(_t=sr&At)].g=yt+_e,ye[we+_t].value=nt-we-_t}Oe.g=Ne-_e,Oe.value=it[Ze++],C(ye,nt+(sr>>_e),Ge,er,Oe),sr=O(sr,Ne)}}return Kt!=2*gt[15]-1?0:bt})(L,W,te,oe,pe,me)}function R(){this.value=this.g=0}function F(){this.value=this.g=0}function M(){this.G=s(5,R),this.H=a(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=s(Es,F)}function Y(L,W,te,oe){t(L!=null),t(W!=null),t(2147483648>oe),L.Ca=254,L.I=0,L.b=-8,L.Ka=0,L.oa=W,L.pa=te,L.Jd=W,L.Yc=te+oe,L.Zc=4<=oe?te+oe-4+1:te,re(L)}function X(L,W){for(var te=0;0<W--;)te|=ie(L,128)<<W;return te}function $(L,W){var te=X(L,W);return H(L)?-te:te}function ee(L,W,te,oe){var pe,me=0;for(t(L!=null),t(W!=null),t(4294967288>oe),L.Sb=oe,L.Ra=0,L.u=0,L.h=0,4<oe&&(oe=4),pe=0;pe<oe;++pe)me+=W[te+pe]<<8*pe;L.Ra=me,L.bb=oe,L.oa=W,L.pa=te}function V(L){for(;8<=L.u&&L.bb<L.Sb;)L.Ra>>>=8,L.Ra+=L.oa[L.pa+L.bb]<<Ho-8>>>0,++L.bb,L.u-=8;U(L)&&(L.h=1,L.u=0)}function D(L,W){if(t(0<=W),!L.h&&W<=fp){var te=G(L)&Pu[W];return L.u+=W,V(L),te}return L.h=1,L.u=0}function z(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function q(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function G(L){return L.Ra>>>(L.u&Ho-1)>>>0}function U(L){return t(L.bb<=L.Sb),L.h||L.bb==L.Sb&&L.u>Ho}function Q(L,W){L.u=W,L.h=U(L)}function K(L){L.u>=Vo&&(t(L.u>=Vo),V(L))}function re(L){t(L!=null&&L.oa!=null),L.pa<L.Zc?(L.I=(L.oa[L.pa++]|L.I<<8)>>>0,L.b+=8):(t(L!=null&&L.oa!=null),L.pa<L.Yc?(L.b+=8,L.I=L.oa[L.pa++]|L.I<<8):L.Ka?L.b=0:(L.I<<=8,L.b+=8,L.Ka=1))}function H(L){return X(L,1)}function ie(L,W){var te=L.Ca;0>L.b&&re(L);var oe=L.b,pe=te*W>>>8,me=(L.I>>>oe>pe)+0;for(me?(te-=pe,L.I-=pe+1<<oe>>>0):te=pe+1,oe=te,pe=0;256<=oe;)pe+=8,oe>>=8;return oe=7^pe+Iu[oe],L.b-=oe,L.Ca=(te<<oe)-1,me}function de(L,W,te){L[W+0]=te>>24&255,L[W+1]=te>>16&255,L[W+2]=te>>8&255,L[W+3]=255&te}function le(L,W){return L[W+0]|L[W+1]<<8}function ke(L,W){return le(L,W)|L[W+2]<<16}function ve(L,W){return le(L,W)|le(L,W+2)<<16}function se(L,W){var te=1<<W;return t(L!=null),t(0<W),L.X=a(te),L.X==null?0:(L.Mb=32-W,L.Xa=W,1)}function be(L,W){t(L!=null),t(W!=null),t(L.Xa==W.Xa),n(W.X,0,L.X,0,1<<W.Xa)}function De(){this.X=[],this.Xa=this.Mb=0}function ae(L,W,te,oe){t(te!=null),t(oe!=null);var pe=te[0],me=oe[0];return pe==0&&(pe=(L*me+W/2)/W),me==0&&(me=(W*pe+L/2)/L),0>=pe||0>=me?0:(te[0]=pe,oe[0]=me,1)}function ue(L,W){return L+(1<<W)-1>>>W}function Me(L,W){return((4278255360&L)+(4278255360&W)>>>0&4278255360)+((16711935&L)+(16711935&W)>>>0&16711935)>>>0}function Se(L,W){N[W]=function(te,oe,pe,me,ye,we,_e){var Oe;for(Oe=0;Oe<ye;++Oe){var Ge=N[L](we[_e+Oe-1],pe,me+Oe);we[_e+Oe]=Me(te[oe+Oe],Ge)}}}function Pe(){this.ud=this.hd=this.jd=0}function Ee(L,W){return((4278124286&(L^W))>>>1)+(L&W)>>>0}function Ae(L){return 0<=L&&256>L?L:0>L?0:255<L?255:void 0}function Ye(L,W){return Ae(L+(L-W+.5>>1))}function rt(L,W,te){return Math.abs(W-te)-Math.abs(L-te)}function He(L,W,te,oe,pe,me,ye){for(oe=me[ye-1],te=0;te<pe;++te)me[ye+te]=oe=Me(L[W+te],oe)}function xt(L,W,te,oe,pe){var me;for(me=0;me<te;++me){var ye=L[W+me],we=ye>>8&255,_e=16711935&(_e=(_e=16711935&ye)+((we<<16)+we));oe[pe+me]=(4278255360&ye)+_e>>>0}}function st(L,W){W.jd=255&L,W.hd=L>>8&255,W.ud=L>>16&255}function Te(L,W,te,oe,pe,me){var ye;for(ye=0;ye<oe;++ye){var we=W[te+ye],_e=we>>>8,Oe=we,Ge=255&(Ge=(Ge=we>>>16)+((L.jd<<24>>24)*(_e<<24>>24)>>>5));Oe=255&(Oe=(Oe+=(L.hd<<24>>24)*(_e<<24>>24)>>>5)+((L.ud<<24>>24)*(Ge<<24>>24)>>>5)),pe[me+ye]=(4278255360&we)+(Ge<<16)+Oe}}function et(L,W,te,oe,pe){N[W]=function(me,ye,we,_e,Oe,Ge,it,Ne,Ze){for(_e=it;_e<Ne;++_e)for(it=0;it<Ze;++it)Oe[Ge++]=pe(we[oe(me[ye++])])},N[L]=function(me,ye,we,_e,Oe,Ge,it){var Ne=8>>me.b,Ze=me.Ea,nt=me.K[0],bt=me.w;if(8>Ne)for(me=(1<<me.b)-1,bt=(1<<Ne)-1;ye<we;++ye){var at,gt=0;for(at=0;at<Ze;++at)at&me||(gt=oe(_e[Oe++])),Ge[it++]=pe(nt[gt&bt]),gt>>=Ne}else N["VP8LMapColor"+te](_e,Oe,nt,bt,Ge,it,ye,we,Ze)}}function Pt(L,W,te,oe,pe){for(te=W+te;W<te;){var me=L[W++];oe[pe++]=me>>16&255,oe[pe++]=me>>8&255,oe[pe++]=255&me}}function qe(L,W,te,oe,pe){for(te=W+te;W<te;){var me=L[W++];oe[pe++]=me>>16&255,oe[pe++]=me>>8&255,oe[pe++]=255&me,oe[pe++]=me>>24&255}}function Et(L,W,te,oe,pe){for(te=W+te;W<te;){var me=(ye=L[W++])>>16&240|ye>>12&15,ye=240&ye|ye>>28&15;oe[pe++]=me,oe[pe++]=ye}}function vt(L,W,te,oe,pe){for(te=W+te;W<te;){var me=(ye=L[W++])>>16&248|ye>>13&7,ye=ye>>5&224|ye>>3&31;oe[pe++]=me,oe[pe++]=ye}}function Ft(L,W,te,oe,pe){for(te=W+te;W<te;){var me=L[W++];oe[pe++]=255&me,oe[pe++]=me>>8&255,oe[pe++]=me>>16&255}}function Ce(L,W,te,oe,pe,me){if(me==0)for(te=W+te;W<te;)de(oe,((me=L[W++])[0]>>24|me[1]>>8&65280|me[2]<<8&16711680|me[3]<<24)>>>0),pe+=32;else n(oe,pe,L,W,te)}function lt(L,W){N[W][0]=N[L+"0"],N[W][1]=N[L+"1"],N[W][2]=N[L+"2"],N[W][3]=N[L+"3"],N[W][4]=N[L+"4"],N[W][5]=N[L+"5"],N[W][6]=N[L+"6"],N[W][7]=N[L+"7"],N[W][8]=N[L+"8"],N[W][9]=N[L+"9"],N[W][10]=N[L+"10"],N[W][11]=N[L+"11"],N[W][12]=N[L+"12"],N[W][13]=N[L+"13"],N[W][14]=N[L+"0"],N[W][15]=N[L+"0"]}function Xe(L){return L==Qd||L==Fu||L==vp||L==yp}function Be(){this.eb=[],this.size=this.A=this.fb=0}function ct(){this.y=[],this.f=[],this.ea=[],this.F=[],this.Tc=this.Ed=this.Cd=this.Fd=this.lb=this.Db=this.Ab=this.fa=this.J=this.W=this.N=this.O=0}function Tt(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new Be,this.f.kb=new ct,this.sd=null}function We(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function ce(){this.Id=this.fd=this.Md=this.hb=this.ib=this.da=this.bd=this.cd=this.j=this.v=this.Da=this.Sd=this.ob=0}function he(L){return alert("todo:WebPSamplerProcessPlane"),L.T}function je(L,W){var te=L.T,oe=W.ba.f.RGBA,pe=oe.eb,me=oe.fb+L.ka*oe.A,ye=ia[W.ba.S],we=L.y,_e=L.O,Oe=L.f,Ge=L.N,it=L.ea,Ne=L.W,Ze=W.cc,nt=W.dc,bt=W.Mc,at=W.Nc,gt=L.ka,yt=L.ka+L.T,_t=L.U,At=_t+1>>1;for(gt==0?ye(we,_e,null,null,Oe,Ge,it,Ne,Oe,Ge,it,Ne,pe,me,null,null,_t):(ye(W.ec,W.fc,we,_e,Ze,nt,bt,at,Oe,Ge,it,Ne,pe,me-oe.A,pe,me,_t),++te);gt+2<yt;gt+=2)Ze=Oe,nt=Ge,bt=it,at=Ne,Ge+=L.Rc,Ne+=L.Rc,me+=2*oe.A,ye(we,(_e+=2*L.fa)-L.fa,we,_e,Ze,nt,bt,at,Oe,Ge,it,Ne,pe,me-oe.A,pe,me,_t);return _e+=L.fa,L.j+yt<L.o?(n(W.ec,W.fc,we,_e,_t),n(W.cc,W.dc,Oe,Ge,At),n(W.Mc,W.Nc,it,Ne,At),te--):1&yt||ye(we,_e,null,null,Oe,Ge,it,Ne,Oe,Ge,it,Ne,pe,me+oe.A,null,null,_t),te}function xe(L,W,te){var oe=L.F,pe=[L.J];if(oe!=null){var me=L.U,ye=W.ba.S,we=ye==mp||ye==vp;W=W.ba.f.RGBA;var _e=[0],Oe=L.ka;_e[0]=L.T,L.Kb&&(Oe==0?--_e[0]:(--Oe,pe[0]-=L.width),L.j+L.ka+L.T==L.o&&(_e[0]=L.o-L.j-Oe));var Ge=W.eb;Oe=W.fb+Oe*W.A,L=hp(oe,pe[0],L.width,me,_e,Ge,Oe+(we?0:3),W.A),t(te==_e),L&&Xe(ye)&&Lu(Ge,Oe,we,me,_e,W.A)}return 0}function Re(L){var W=L.ma,te=W.ba.S,oe=11>te,pe=te==Lc||te==gp||te==mp||te==En||te==12||Xe(te);if(W.memory=null,W.Ib=null,W.Jb=null,W.Nd=null,!Ta(W.Oa,L,pe?11:12))return 0;if(pe&&Xe(te)&&Cs(),L.da)alert("todo:use_scaling");else{if(oe){if(W.Ib=he,L.Kb){if(te=L.U+1>>1,W.memory=a(L.U+2*te),W.memory==null)return 0;W.ec=W.memory,W.fc=0,W.cc=W.ec,W.dc=W.fc+L.U,W.Mc=W.cc,W.Nc=W.dc+te,W.Ib=je,Cs()}}else alert("todo:EmitYUV");pe&&(W.Jb=xe,oe&&ti())}if(oe&&!ao){for(L=0;256>L;++L)oa[L]=89858*(L-128)+Ts>>Ul,aa[L]=-22014*(L-128)+Ts,ef[L]=-45773*(L-128),Bu[L]=113618*(L-128)+Ts>>Ul;for(L=pn;L<mn;++L)W=76283*(L-16)+Ts>>Ul,mg[L-pn]=Gr(W,255),a0[L-pn]=Gr(W+8>>4,15);ao=1}return 1}function ze(L){var W=L.ma,te=L.U,oe=L.T;return t(!(1&L.ka)),0>=te||0>=oe?0:(te=W.Ib(L,W),W.Jb!=null&&W.Jb(L,W,te),W.Dc+=te,1)}function Le(L){L.ma.memory=null}function Qe(L,W,te,oe){return D(L,8)!=47?0:(W[0]=D(L,14)+1,te[0]=D(L,14)+1,oe[0]=D(L,1),D(L,3)!=0?0:!L.h)}function mt(L,W){if(4>L)return L+1;var te=L-2>>1;return(2+(1&L)<<te)+D(W,te)+1}function ft(L,W){return 120<W?W-120:1<=(te=((te=vj[W-1])>>4)*L+(8-(15&te)))?te:1;var te}function It(L,W,te){var oe=G(te),pe=L[W+=255&oe].g-8;return 0<pe&&(Q(te,te.u+8),oe=G(te),W+=L[W].value,W+=oe&(1<<pe)-1),Q(te,te.u+L[W].g),L[W].value}function Bt(L,W,te){return te.g+=L.g,te.value+=L.value<<W>>>0,t(8>=te.g),L.g}function dr(L,W,te){var oe=L.xc;return t((W=oe==0?0:L.vc[L.md*(te>>oe)+(W>>oe)])<L.Wb),L.Ya[W]}function pr(L,W,te,oe){var pe=L.ab,me=L.c*W,ye=L.C;W=ye+W;var we=te,_e=oe;for(oe=L.Ta,te=L.Ua;0<pe--;){var Oe=L.gc[pe],Ge=ye,it=W,Ne=we,Ze=_e,nt=(_e=oe,we=te,Oe.Ea);switch(t(Ge<it),t(it<=Oe.nc),Oe.hc){case 2:Hd(Ne,Ze,(it-Ge)*nt,_e,we);break;case 0:var bt=Ge,at=it,gt=_e,yt=we,_t=(er=Oe).Ea;bt==0&&(Qa(Ne,Ze,null,null,1,gt,yt),He(Ne,Ze+1,0,0,_t-1,gt,yt+1),Ze+=_t,yt+=_t,++bt);for(var At=1<<er.b,sr=At-1,Kt=ue(_t,er.b),Ir=er.K,er=er.w+(bt>>er.b)*Kt;bt<at;){var Wr=Ir,li=er,Or=1;for(Xa(Ne,Ze,gt,yt-_t,1,gt,yt);Or<_t;){var Qt=(Or&~sr)+At;Qt>_t&&(Qt=_t),(0,Pa[Wr[li++]>>8&15])(Ne,Ze+ +Or,gt,yt+Or-_t,Qt-Or,gt,yt+Or),Or=Qt}Ze+=_t,yt+=_t,++bt&sr||(er+=Kt)}it!=Oe.nc&&n(_e,we-nt,_e,we+(it-Ge-1)*nt,nt);break;case 1:for(nt=Ne,at=Ze,_t=(Ne=Oe.Ea)-(yt=Ne&~(gt=(Ze=1<<Oe.b)-1)),bt=ue(Ne,Oe.b),At=Oe.K,Oe=Oe.w+(Ge>>Oe.b)*bt;Ge<it;){for(sr=At,Kt=Oe,Ir=new Pe,er=at+yt,Wr=at+Ne;at<er;)st(sr[Kt++],Ir),Ic(Ir,nt,at,Ze,_e,we),at+=Ze,we+=Ze;at<Wr&&(st(sr[Kt++],Ir),Ic(Ir,nt,at,_t,_e,we),at+=_t,we+=_t),++Ge&gt||(Oe+=bt)}break;case 3:if(Ne==_e&&Ze==we&&0<Oe.b){for(at=_e,Ne=nt=we+(it-Ge)*nt-(yt=(it-Ge)*ue(Oe.Ea,Oe.b)),Ze=_e,gt=we,bt=[],yt=(_t=yt)-1;0<=yt;--yt)bt[yt]=Ze[gt+yt];for(yt=_t-1;0<=yt;--yt)at[Ne+yt]=bt[yt];cl(Oe,Ge,it,_e,nt,_e,we)}else cl(Oe,Ge,it,Ne,Ze,_e,we)}we=oe,_e=te}_e!=te&&n(oe,te,we,_e,me)}function an(L,W){var te=L.V,oe=L.Ba+L.c*L.C,pe=W-L.C;if(t(W<=L.l.o),t(16>=pe),0<pe){var me=L.l,ye=L.Ta,we=L.Ua,_e=me.width;if(pr(L,pe,te,oe),pe=we=[we],t((te=L.C)<(oe=W)),t(me.v<me.va),oe>me.o&&(oe=me.o),te<me.j){var Oe=me.j-te;te=me.j,pe[0]+=Oe*_e}if(te>=oe?te=0:(pe[0]+=4*me.v,me.ka=te-me.j,me.U=me.va-me.v,me.T=oe-te,te=1),te){if(we=we[0],11>(te=L.ca).S){var Ge=te.f.RGBA,it=(oe=te.S,pe=me.U,me=me.T,Oe=Ge.eb,Ge.A),Ne=me;for(Ge=Ge.fb+L.Ma*Ge.A;0<Ne--;){var Ze=ye,nt=we,bt=pe,at=Oe,gt=Ge;switch(oe){case fg:Vd(Ze,nt,bt,at,gt);break;case Lc:Yd(Ze,nt,bt,at,gt);break;case Qd:Yd(Ze,nt,bt,at,gt),Lu(at,gt,0,bt,1,0);break;case t0:Nu(Ze,nt,bt,at,gt);break;case gp:Ce(Ze,nt,bt,at,gt,1);break;case Fu:Ce(Ze,nt,bt,at,gt,1),Lu(at,gt,0,bt,1,0);break;case mp:Ce(Ze,nt,bt,at,gt,0);break;case vp:Ce(Ze,nt,bt,at,gt,0),Lu(at,gt,1,bt,1,0);break;case En:Gd(Ze,nt,bt,at,gt);break;case yp:Gd(Ze,nt,bt,at,gt),Yv(at,gt,bt,1,0);break;case pg:Ou(Ze,nt,bt,at,gt);break;default:t(0)}we+=_e,Ge+=it}L.Ma+=me}else alert("todo:EmitRescaledRowsYUVA");t(L.Ma<=te.height)}}L.C=W,t(L.C<=L.i)}function Jn(L){var W;if(0<L.ua)return 0;for(W=0;W<L.Wb;++W){var te=L.Ya[W].G,oe=L.Ya[W].H;if(0<te[1][oe[1]+0].g||0<te[2][oe[2]+0].g||0<te[3][oe[3]+0].g)return 0}return 1}function Fi(L,W,te,oe,pe,me){if(L.Z!=0){var ye=L.qd,we=L.rd;for(t(So[L.Z]!=null);W<te;++W)So[L.Z](ye,we,oe,pe,oe,pe,me),ye=oe,we=pe,pe+=me;L.qd=ye,L.rd=we}}function Fn(L,W){var te=L.l.ma,oe=te.Z==0||te.Z==1?L.l.j:L.C;if(oe=L.C<oe?oe:L.C,t(W<=L.l.o),W>oe){var pe=L.l.width,me=te.ca,ye=te.tb+pe*oe,we=L.V,_e=L.Ba+L.c*oe,Oe=L.gc;t(L.ab==1),t(Oe[0].hc==3),ug(Oe[0],oe,W,we,_e,me,ye),Fi(te,oe,W,me,ye,pe)}L.C=L.Ma=W}function Bo(L,W,te,oe,pe,me,ye){var we=L.$/oe,_e=L.$%oe,Oe=L.m,Ge=L.s,it=te+L.$,Ne=it;pe=te+oe*pe;var Ze=te+oe*me,nt=280+Ge.ua,bt=L.Pb?we:16777216,at=0<Ge.ua?Ge.Wa:null,gt=Ge.wc,yt=it<Ze?dr(Ge,_e,we):null;t(L.C<me),t(Ze<=pe);var _t=!1;e:for(;;){for(;_t||it<Ze;){var At=0;if(we>=bt){var sr=it-te;t((bt=L).Pb),bt.wd=bt.m,bt.xd=sr,0<bt.s.ua&&be(bt.s.Wa,bt.s.vb),bt=we+gg}if(_e&gt||(yt=dr(Ge,_e,we)),t(yt!=null),yt.Qb&&(W[it]=yt.qb,_t=!0),!_t)if(K(Oe),yt.jc){At=Oe,sr=W;var Kt=it,Ir=yt.pd[G(At)&Es-1];t(yt.jc),256>Ir.g?(Q(At,At.u+Ir.g),sr[Kt]=Ir.value,At=0):(Q(At,At.u+Ir.g-256),t(256<=Ir.value),At=Ir.value),At==0&&(_t=!0)}else At=It(yt.G[0],yt.H[0],Oe);if(Oe.h)break;if(_t||256>At){if(!_t)if(yt.nd)W[it]=(yt.qb|At<<8)>>>0;else{if(K(Oe),_t=It(yt.G[1],yt.H[1],Oe),K(Oe),sr=It(yt.G[2],yt.H[2],Oe),Kt=It(yt.G[3],yt.H[3],Oe),Oe.h)break;W[it]=(Kt<<24|_t<<16|At<<8|sr)>>>0}if(_t=!1,++it,++_e>=oe&&(_e=0,++we,ye!=null&&we<=me&&!(we%16)&&ye(L,we),at!=null))for(;Ne<it;)At=W[Ne++],at.X[(506832829*At&4294967295)>>>at.Mb]=At}else if(280>At){if(At=mt(At-256,Oe),sr=It(yt.G[4],yt.H[4],Oe),K(Oe),sr=ft(oe,sr=mt(sr,Oe)),Oe.h)break;if(it-te<sr||pe-it<At)break e;for(Kt=0;Kt<At;++Kt)W[it+Kt]=W[it+Kt-sr];for(it+=At,_e+=At;_e>=oe;)_e-=oe,++we,ye!=null&&we<=me&&!(we%16)&&ye(L,we);if(t(it<=pe),_e&gt&&(yt=dr(Ge,_e,we)),at!=null)for(;Ne<it;)At=W[Ne++],at.X[(506832829*At&4294967295)>>>at.Mb]=At}else{if(!(At<nt))break e;for(_t=At-280,t(at!=null);Ne<it;)At=W[Ne++],at.X[(506832829*At&4294967295)>>>at.Mb]=At;At=it,t(!(_t>>>(sr=at).Xa)),W[At]=sr.X[_t],_t=!0}_t||t(Oe.h==U(Oe))}if(L.Pb&&Oe.h&&it<pe)t(L.m.h),L.a=5,L.m=L.wd,L.$=L.xd,0<L.s.ua&&be(L.s.vb,L.s.Wa);else{if(Oe.h)break e;ye!=null&&ye(L,we>me?me:we),L.a=0,L.$=it-te}return 1}return L.a=3,0}function io(L){t(L!=null),L.vc=null,L.yc=null,L.Ya=null;var W=L.Wa;W!=null&&(W.X=null),L.vb=null,t(L!=null)}function Wo(){var L=new tr;return L==null?null:(L.a=0,L.xb=Zd,lt("Predictor","VP8LPredictors"),lt("Predictor","VP8LPredictors_C"),lt("PredictorAdd","VP8LPredictorsAdd"),lt("PredictorAdd","VP8LPredictorsAdd_C"),Hd=xt,Ic=Te,Vd=Pt,Yd=qe,Gd=Et,Ou=vt,Nu=Ft,N.VP8LMapColor32b=_i,N.VP8LMapColor8b=Za,L)}function Yi(L,W,te,oe,pe){var me=1,ye=[L],we=[W],_e=oe.m,Oe=oe.s,Ge=null,it=0;e:for(;;){if(te)for(;me&&D(_e,1);){var Ne=ye,Ze=we,nt=oe,bt=1,at=nt.m,gt=nt.gc[nt.ab],yt=D(at,2);if(nt.Oc&1<<yt)me=0;else{switch(nt.Oc|=1<<yt,gt.hc=yt,gt.Ea=Ne[0],gt.nc=Ze[0],gt.K=[null],++nt.ab,t(4>=nt.ab),yt){case 0:case 1:gt.b=D(at,3)+2,bt=Yi(ue(gt.Ea,gt.b),ue(gt.nc,gt.b),0,nt,gt.K),gt.K=gt.K[0];break;case 3:var _t,At=D(at,8)+1,sr=16<At?0:4<At?1:2<At?2:3;if(Ne[0]=ue(gt.Ea,sr),gt.b=sr,_t=bt=Yi(At,1,0,nt,gt.K)){var Kt,Ir=At,er=gt,Wr=1<<(8>>er.b),li=a(Wr);if(li==null)_t=0;else{var Or=er.K[0],Qt=er.w;for(li[0]=er.K[0][0],Kt=1;Kt<1*Ir;++Kt)li[Kt]=Me(Or[Qt+Kt],li[Kt-1]);for(;Kt<4*Wr;++Kt)li[Kt]=0;er.K[0]=null,er.K[0]=li,_t=1}}bt=_t;break;case 2:break;default:t(0)}me=bt}}if(ye=ye[0],we=we[0],me&&D(_e,1)&&!(me=1<=(it=D(_e,4))&&11>=it)){oe.a=3;break e}var Ut;if(Ut=me)t:{var hi,wr,Dr,Rn=oe,Qi=ye,Ci=we,ni=it,Di=te,Xi=Rn.m,Un=Rn.s,Hr=[null],tn=1,Hn=0,rn=n0[ni];r:for(;;){if(Di&&D(Xi,1)){var ci=D(Xi,3)+2,ui=ue(Qi,ci),An=ue(Ci,ci),jo=ui*An;if(!Yi(ui,An,0,Rn,Hr))break r;for(Hr=Hr[0],Un.xc=ci,hi=0;hi<jo;++hi){var vn=Hr[hi]>>8&65535;Hr[hi]=vn,vn>=tn&&(tn=vn+1)}}if(Xi.h)break r;for(wr=0;5>wr;++wr){var Tn=zu[wr];!wr&&0<ni&&(Tn+=1<<ni),Hn<Tn&&(Hn=Tn)}var Ei=s(tn*rn,R),so=tn,sa=s(so,M);if(sa==null)var gi=null;else t(65536>=so),gi=sa;var mi=a(Hn);if(gi==null||mi==null||Ei==null){Rn.a=1;break r}var ko=Ei;for(hi=Dr=0;hi<tn;++hi){var Pn=gi[hi],_o=Pn.G,ts=Pn.H,Ps=0,Zi=1,vi=0;for(wr=0;5>wr;++wr){Tn=zu[wr],_o[wr]=ko,ts[wr]=Dr,!wr&&0<ni&&(Tn+=1<<ni);i:{var Mc,Vl=Tn,tf=Rn,hl=mi,l0=ko,oy=Dr,Dn=0,Is=tf.m,ay=D(Is,1);if(o(hl,0,0,Vl),ay){var sy=D(Is,1)+1,vg=D(Is,1),yg=D(Is,vg==0?1:8);hl[yg]=1,sy==2&&(hl[yg=D(Is,8)]=1);var gl=1}else{var Vn=a(19),Ai=D(Is,4)+4;if(19<Ai){tf.a=3;var yi=0;break i}for(Mc=0;Mc<Ai;++Mc)Vn[mj[Mc]]=D(Is,3);var rf=void 0,Yl=void 0,nf=tf,Sj=Vn,Bi=Vl,xg=hl,jp=0,ml=nf.m,Os=8,Ia=s(128,R);n:for(;I(Ia,0,7,Sj,19);){if(D(ml,1)){var kp=2+2*D(ml,3);if((rf=2+D(ml,kp))>Bi)break n}else rf=Bi;for(Yl=0;Yl<Bi&&rf--;){K(ml);var bg=Ia[0+(127&G(ml))];Q(ml,ml.u+bg.g);var Dc=bg.value;if(16>Dc)xg[Yl++]=Dc,Dc!=0&&(Os=Dc);else{var c0=Dc==16,ly=Dc-16,u0=hg[ly],cy=D(ml,xp[ly])+u0;if(Yl+cy>Bi)break n;for(var d0=c0?Os:0;0<cy--;)xg[Yl++]=d0}}jp=1;break n}jp||(nf.a=3),gl=jp}(gl=gl&&!Is.h)&&(Dn=I(l0,oy,8,hl,Vl)),gl&&Dn!=0?yi=Dn:(tf.a=3,yi=0)}if(yi==0)break r;if(Zi&&r0[wr]==1&&(Zi=ko[Dr].g==0),Ps+=ko[Dr].g,Dr+=yi,3>=wr){var of,wg=mi[0];for(of=1;of<Tn;++of)mi[of]>wg&&(wg=mi[of]);vi+=wg}}if(Pn.nd=Zi,Pn.Qb=0,Zi&&(Pn.qb=(_o[3][ts[3]+0].value<<24|_o[1][ts[1]+0].value<<16|_o[2][ts[2]+0].value)>>>0,Ps==0&&256>_o[0][ts[0]+0].value&&(Pn.Qb=1,Pn.qb+=_o[0][ts[0]+0].value<<8)),Pn.jc=!Pn.Qb&&6>vi,Pn.jc){var _p,Oa=Pn;for(_p=0;_p<Es;++_p){var Gl=_p,Ns=Oa.pd[Gl],qu=Oa.G[0][Oa.H[0]+Gl];256<=qu.value?(Ns.g=qu.g+256,Ns.value=qu.value):(Ns.g=0,Ns.value=0,Gl>>=Bt(qu,8,Ns),Gl>>=Bt(Oa.G[1][Oa.H[1]+Gl],16,Ns),Gl>>=Bt(Oa.G[2][Oa.H[2]+Gl],0,Ns),Bt(Oa.G[3][Oa.H[3]+Gl],24,Ns))}}}Un.vc=Hr,Un.Wb=tn,Un.Ya=gi,Un.yc=Ei,Ut=1;break t}Ut=0}if(!(me=Ut)){oe.a=3;break e}if(0<it){if(Oe.ua=1<<it,!se(Oe.Wa,it)){oe.a=1,me=0;break e}}else Oe.ua=0;var Sg=oe,jg=ye,f0=we,kg=Sg.s,_g=kg.xc;if(Sg.c=jg,Sg.i=f0,kg.md=ue(jg,_g),kg.wc=_g==0?-1:(1<<_g)-1,te){oe.xb=pl;break e}if((Ge=a(ye*we))==null){oe.a=1,me=0;break e}me=(me=Bo(oe,Ge,0,ye,we,we,null))&&!_e.h;break e}return me?(pe!=null?pe[0]=Ge:(t(Ge==null),t(te)),oe.$=0,te||io(Oe)):io(Oe),me}function qo(L,W){var te=L.c*L.i,oe=te+W+16*W;return t(L.c<=W),L.V=a(oe),L.V==null?(L.Ta=null,L.Ua=0,L.a=1,0):(L.Ta=L.V,L.Ua=L.Ba+te+W,1)}function Ca(L,W){var te=L.C,oe=W-te,pe=L.V,me=L.Ba+L.c*te;for(t(W<=L.l.o);0<oe;){var ye=16<oe?16:oe,we=L.l.ma,_e=L.l.width,Oe=_e*ye,Ge=we.ca,it=we.tb+_e*te,Ne=L.Ta,Ze=L.Ua;pr(L,ye,pe,me),Gv(Ne,Ze,Ge,it,Oe),Fi(we,te,te+ye,Ge,it,_e),oe-=ye,pe+=ye*L.c,te+=ye}t(te==W),L.C=L.Ma=W}function xs(){this.ub=this.yd=this.td=this.Rb=0}function el(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function op(){this.Fb=this.Bb=this.Cb=0,this.Zb=a(4),this.Lb=a(4)}function jn(){this.Yb=(function(){var L=[];return(function W(te,oe,pe){for(var me=pe[oe],ye=0;ye<me&&(te.push(pe.length>oe+1?[]:0),!(pe.length<oe+1));ye++)W(te[ye],oe+1,pe)})(L,0,[3,11]),L})()}function Ld(){this.jb=a(3),this.Wc=l([4,8],jn),this.Xc=l([4,17],jn)}function tl(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new a(4),this.od=new a(4)}function Mt(){this.ld=this.La=this.dd=this.tc=0}function xr(){this.Na=this.la=0}function $n(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function yo(){this.ad=a(384),this.Za=0,this.Ob=a(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function Wt(){this.uc=this.M=this.Nb=0,this.wa=Array(new Mt),this.Y=0,this.ya=Array(new yo),this.aa=0,this.l=new rl}function zn(){this.y=a(16),this.f=a(8),this.ea=a(8)}function gu(){this.cb=this.a=0,this.sc="",this.m=new z,this.Od=new xs,this.Kc=new el,this.ed=new tl,this.Qa=new op,this.Ic=this.$c=this.Aa=0,this.D=new Wt,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=s(8,z),this.ia=0,this.pb=s(4,$n),this.Pa=new Ld,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new zn),this.Hd=0,this.rb=Array(new xr),this.sb=0,this.wa=Array(new Mt),this.Y=0,this.oc=[],this.pc=0,this.sa=[],this.ta=0,this.qa=[],this.ra=0,this.Ha=[],this.B=this.R=this.Ia=0,this.Ec=[],this.M=this.ja=this.Vb=this.Fc=0,this.ya=Array(new yo),this.L=this.aa=0,this.gd=l([4,2],Mt),this.ga=null,this.Fa=[],this.Cc=this.qc=this.P=0,this.Gb=[],this.Uc=0,this.mb=[],this.nb=0,this.rc=[],this.Ga=this.Vc=0}function Gr(L,W){return 0>L?0:L>W?W:L}function rl(){this.T=this.U=this.ka=this.height=this.width=0,this.y=[],this.f=[],this.ea=[],this.Rc=this.fa=this.W=this.N=this.O=0,this.ma="void",this.put="VP8IoPutHook",this.ac="VP8IoSetupHook",this.bc="VP8IoTeardownHook",this.ha=this.Kb=0,this.data=[],this.hb=this.ib=this.da=this.o=this.j=this.va=this.v=this.Da=this.ob=this.w=0,this.F=[],this.J=0}function Bv(){var L=new gu;return L!=null&&(L.a=0,L.sc="OK",L.cb=0,L.Xb=0,Mu||(Mu=nl)),L}function ji(L,W,te){return L.a==0&&(L.a=W,L.sc=te,L.cb=0),0}function mu(L,W,te){return 3<=te&&L[W+0]==157&&L[W+1]==1&&L[W+2]==42}function Ea(L,W){if(L==null)return 0;if(L.a=0,L.sc="OK",W==null)return ji(L,2,"null VP8Io passed to VP8GetHeaders()");var te=W.data,oe=W.w,pe=W.ha;if(4>pe)return ji(L,7,"Truncated header.");var me=te[oe+0]|te[oe+1]<<8|te[oe+2]<<16,ye=L.Od;if(ye.Rb=!(1&me),ye.td=me>>1&7,ye.yd=me>>4&1,ye.ub=me>>5,3<ye.td)return ji(L,3,"Incorrect keyframe parameters.");if(!ye.yd)return ji(L,4,"Frame not displayable.");oe+=3,pe-=3;var we=L.Kc;if(ye.Rb){if(7>pe)return ji(L,7,"cannot parse picture header");if(!mu(te,oe,pe))return ji(L,3,"Bad code word");we.c=16383&(te[oe+4]<<8|te[oe+3]),we.Td=te[oe+4]>>6,we.i=16383&(te[oe+6]<<8|te[oe+5]),we.Ud=te[oe+6]>>6,oe+=7,pe-=7,L.za=we.c+15>>4,L.Ub=we.i+15>>4,W.width=we.c,W.height=we.i,W.Da=0,W.j=0,W.v=0,W.va=W.width,W.o=W.height,W.da=0,W.ib=W.width,W.hb=W.height,W.U=W.width,W.T=W.height,o((me=L.Pa).jb,0,255,me.jb.length),t((me=L.Qa)!=null),me.Cb=0,me.Bb=0,me.Fb=1,o(me.Zb,0,0,me.Zb.length),o(me.Lb,0,0,me.Lb)}if(ye.ub>pe)return ji(L,7,"bad partition length");Y(me=L.m,te,oe,ye.ub),oe+=ye.ub,pe-=ye.ub,ye.Rb&&(we.Ld=H(me),we.Kd=H(me)),we=L.Qa;var _e,Oe=L.Pa;if(t(me!=null),t(we!=null),we.Cb=H(me),we.Cb){if(we.Bb=H(me),H(me)){for(we.Fb=H(me),_e=0;4>_e;++_e)we.Zb[_e]=H(me)?$(me,7):0;for(_e=0;4>_e;++_e)we.Lb[_e]=H(me)?$(me,6):0}if(we.Bb)for(_e=0;3>_e;++_e)Oe.jb[_e]=H(me)?X(me,8):255}else we.Bb=0;if(me.Ka)return ji(L,3,"cannot parse segment header");if((we=L.ed).zd=H(me),we.Tb=X(me,6),we.wb=X(me,3),we.Pc=H(me),we.Pc&&H(me)){for(Oe=0;4>Oe;++Oe)H(me)&&(we.vd[Oe]=$(me,6));for(Oe=0;4>Oe;++Oe)H(me)&&(we.od[Oe]=$(me,6))}if(L.L=we.Tb==0?0:we.zd?1:2,me.Ka)return ji(L,3,"cannot parse filter header");var Ge=pe;if(pe=_e=oe,oe=_e+Ge,we=Ge,L.Xb=(1<<X(L.m,2))-1,Ge<3*(Oe=L.Xb))te=7;else{for(_e+=3*Oe,we-=3*Oe,Ge=0;Ge<Oe;++Ge){var it=te[pe+0]|te[pe+1]<<8|te[pe+2]<<16;it>we&&(it=we),Y(L.Jc[+Ge],te,_e,it),_e+=it,we-=it,pe+=3}Y(L.Jc[+Oe],te,_e,we),te=_e<oe?0:5}if(te!=0)return ji(L,te,"cannot parse partitions");for(te=X(_e=L.m,7),pe=H(_e)?$(_e,4):0,oe=H(_e)?$(_e,4):0,we=H(_e)?$(_e,4):0,Oe=H(_e)?$(_e,4):0,_e=H(_e)?$(_e,4):0,Ge=L.Qa,it=0;4>it;++it){if(Ge.Cb){var Ne=Ge.Zb[it];Ge.Fb||(Ne+=te)}else{if(0<it){L.pb[it]=L.pb[0];continue}Ne=te}var Ze=L.pb[it];Ze.Sc[0]=Xd[Gr(Ne+pe,127)],Ze.Sc[1]=bp[Gr(Ne+0,127)],Ze.Eb[0]=2*Xd[Gr(Ne+oe,127)],Ze.Eb[1]=101581*bp[Gr(Ne+we,127)]>>16,8>Ze.Eb[1]&&(Ze.Eb[1]=8),Ze.Qc[0]=Xd[Gr(Ne+Oe,117)],Ze.Qc[1]=bp[Gr(Ne+_e,127)],Ze.lc=Ne+_e}if(!ye.Rb)return ji(L,4,"Not a key frame.");for(H(me),ye=L.Pa,te=0;4>te;++te){for(pe=0;8>pe;++pe)for(oe=0;3>oe;++oe)for(we=0;11>we;++we)Oe=ie(me,xj[te][pe][oe][we])?X(me,8):o0[te][pe][oe][we],ye.Wc[te][pe].Yb[oe][we]=Oe;for(pe=0;17>pe;++pe)ye.Xc[te][pe]=ye.Wc[te][ry[pe]]}return L.kc=H(me),L.kc&&(L.Bd=X(me,8)),L.cb=1}function nl(L,W,te,oe,pe,me,ye){var we=W[pe].Yb[te];for(te=0;16>pe;++pe){if(!ie(L,we[te+0]))return pe;for(;!ie(L,we[te+1]);)if(we=W[++pe].Yb[0],te=0,pe==16)return 16;var _e=W[pe+1].Yb;if(ie(L,we[te+2])){var Oe=L,Ge=0;if(ie(Oe,(Ne=we)[(it=te)+3]))if(ie(Oe,Ne[it+6])){for(we=0,it=2*(Ge=ie(Oe,Ne[it+8]))+(Ne=ie(Oe,Ne[it+9+Ge])),Ge=0,Ne=ey[it];Ne[we];++we)Ge+=Ge+ie(Oe,Ne[we]);Ge+=3+(8<<it)}else ie(Oe,Ne[it+7])?(Ge=7+2*ie(Oe,165),Ge+=ie(Oe,145)):Ge=5+ie(Oe,159);else Ge=ie(Oe,Ne[it+4])?3+ie(Oe,Ne[it+5]):2;we=_e[2]}else Ge=1,we=_e[1];_e=ye+ty[pe],0>(Oe=L).b&&re(Oe);var it,Ne=Oe.b,Ze=(it=Oe.Ca>>1)-(Oe.I>>Ne)>>31;--Oe.b,Oe.Ca+=Ze,Oe.Ca|=1,Oe.I-=(it+1&Ze)<<Ne,me[_e]=((Ge^Ze)-Ze)*oe[(0<pe)+0]}return 16}function _c(L){var W=L.rb[L.sb-1];W.la=0,W.Na=0,o(L.zc,0,0,L.zc.length),L.ja=0}function Aa(L,W,te,oe,pe){pe=L[W+te+32*oe]+(pe>>3),L[W+te+32*oe]=-256&pe?0>pe?0:255:pe}function Fd(L,W,te,oe,pe,me){Aa(L,W,0,te,oe+pe),Aa(L,W,1,te,oe+me),Aa(L,W,2,te,oe-me),Aa(L,W,3,te,oe-pe)}function bs(L){return(20091*L>>16)+L}function Gi(L,W,te,oe){var pe,me=0,ye=a(16);for(pe=0;4>pe;++pe){var we=L[W+0]+L[W+8],_e=L[W+0]-L[W+8],Oe=(35468*L[W+4]>>16)-bs(L[W+12]),Ge=bs(L[W+4])+(35468*L[W+12]>>16);ye[me+0]=we+Ge,ye[me+1]=_e+Oe,ye[me+2]=_e-Oe,ye[me+3]=we-Ge,me+=4,W++}for(pe=me=0;4>pe;++pe)we=(L=ye[me+0]+4)+ye[me+8],_e=L-ye[me+8],Oe=(35468*ye[me+4]>>16)-bs(ye[me+12]),Aa(te,oe,0,0,we+(Ge=bs(ye[me+4])+(35468*ye[me+12]>>16))),Aa(te,oe,1,0,_e+Oe),Aa(te,oe,2,0,_e-Oe),Aa(te,oe,3,0,we-Ge),me++,oe+=32}function zd(L,W,te,oe){var pe=L[W+0]+4,me=35468*L[W+4]>>16,ye=bs(L[W+4]),we=35468*L[W+1]>>16;Fd(te,oe,0,pe+ye,L=bs(L[W+1]),we),Fd(te,oe,1,pe+me,L,we),Fd(te,oe,2,pe-me,L,we),Fd(te,oe,3,pe-ye,L,we)}function vu(L,W,te,oe,pe){Gi(L,W,te,oe),pe&&Gi(L,W+16,te,oe+4)}function Wv(L,W,te,oe){ql(L,W+0,te,oe,1),ql(L,W+32,te,oe+128,1)}function ap(L,W,te,oe){var pe;for(L=L[W+0]+4,pe=0;4>pe;++pe)for(W=0;4>W;++W)Aa(te,oe,W,pe,L)}function zr(L,W,te,oe){L[W+0]&&oo(L,W+0,te,oe),L[W+16]&&oo(L,W+16,te,oe+4),L[W+32]&&oo(L,W+32,te,oe+128),L[W+48]&&oo(L,W+48,te,oe+128+4)}function sp(L,W,te,oe){var pe,me=a(16);for(pe=0;4>pe;++pe){var ye=L[W+0+pe]+L[W+12+pe],we=L[W+4+pe]+L[W+8+pe],_e=L[W+4+pe]-L[W+8+pe],Oe=L[W+0+pe]-L[W+12+pe];me[0+pe]=ye+we,me[8+pe]=ye-we,me[4+pe]=Oe+_e,me[12+pe]=Oe-_e}for(pe=0;4>pe;++pe)ye=(L=me[0+4*pe]+3)+me[3+4*pe],we=me[1+4*pe]+me[2+4*pe],_e=me[1+4*pe]-me[2+4*pe],Oe=L-me[3+4*pe],te[oe+0]=ye+we>>3,te[oe+16]=Oe+_e>>3,te[oe+32]=ye-we>>3,te[oe+48]=Oe-_e>>3,oe+=64}function yu(L,W,te){var oe,pe=W-32,me=Yo,ye=255-L[pe-1];for(oe=0;oe<te;++oe){var we,_e=me,Oe=ye+L[W-1];for(we=0;we<te;++we)L[W+we]=_e[Oe+L[pe+we]];W+=32}}function Cc(L,W){yu(L,W,4)}function Md(L,W){yu(L,W,8)}function ig(L,W){yu(L,W,16)}function og(L,W){var te;for(te=0;16>te;++te)n(L,W+32*te,L,W-32,16)}function lp(L,W){var te;for(te=16;0<te;--te)o(L,W,L[W-1],16),W+=32}function ws(L,W,te){var oe;for(oe=0;16>oe;++oe)o(W,te+32*oe,L,16)}function Ss(L,W){var te,oe=16;for(te=0;16>te;++te)oe+=L[W-1+32*te]+L[W+te-32];ws(oe>>5,L,W)}function $o(L,W){var te,oe=8;for(te=0;16>te;++te)oe+=L[W-1+32*te];ws(oe>>4,L,W)}function il(L,W){var te,oe=8;for(te=0;16>te;++te)oe+=L[W+te-32];ws(oe>>4,L,W)}function js(L,W){ws(128,L,W)}function hr(L,W,te){return L+2*W+te+2>>2}function ol(L,W){var te,oe=W-32;for(oe=new Uint8Array([hr(L[oe-1],L[oe+0],L[oe+1]),hr(L[oe+0],L[oe+1],L[oe+2]),hr(L[oe+1],L[oe+2],L[oe+3]),hr(L[oe+2],L[oe+3],L[oe+4])]),te=0;4>te;++te)n(L,W+32*te,oe,0,oe.length)}function qv(L,W){var te=L[W-1],oe=L[W-1+32],pe=L[W-1+64],me=L[W-1+96];de(L,W+0,16843009*hr(L[W-1-32],te,oe)),de(L,W+32,16843009*hr(te,oe,pe)),de(L,W+64,16843009*hr(oe,pe,me)),de(L,W+96,16843009*hr(pe,me,me))}function ag(L,W){var te,oe=4;for(te=0;4>te;++te)oe+=L[W+te-32]+L[W-1+32*te];for(oe>>=3,te=0;4>te;++te)o(L,W+32*te,oe,4)}function xu(L,W){var te=L[W-1+0],oe=L[W-1+32],pe=L[W-1+64],me=L[W-1-32],ye=L[W+0-32],we=L[W+1-32],_e=L[W+2-32],Oe=L[W+3-32];L[W+0+96]=hr(oe,pe,L[W-1+96]),L[W+1+96]=L[W+0+64]=hr(te,oe,pe),L[W+2+96]=L[W+1+64]=L[W+0+32]=hr(me,te,oe),L[W+3+96]=L[W+2+64]=L[W+1+32]=L[W+0+0]=hr(ye,me,te),L[W+3+64]=L[W+2+32]=L[W+1+0]=hr(we,ye,me),L[W+3+32]=L[W+2+0]=hr(_e,we,ye),L[W+3+0]=hr(Oe,_e,we)}function $v(L,W){var te=L[W+1-32],oe=L[W+2-32],pe=L[W+3-32],me=L[W+4-32],ye=L[W+5-32],we=L[W+6-32],_e=L[W+7-32];L[W+0+0]=hr(L[W+0-32],te,oe),L[W+1+0]=L[W+0+32]=hr(te,oe,pe),L[W+2+0]=L[W+1+32]=L[W+0+64]=hr(oe,pe,me),L[W+3+0]=L[W+2+32]=L[W+1+64]=L[W+0+96]=hr(pe,me,ye),L[W+3+32]=L[W+2+64]=L[W+1+96]=hr(me,ye,we),L[W+3+64]=L[W+2+96]=hr(ye,we,_e),L[W+3+96]=hr(we,_e,_e)}function al(L,W){var te=L[W-1+0],oe=L[W-1+32],pe=L[W-1+64],me=L[W-1-32],ye=L[W+0-32],we=L[W+1-32],_e=L[W+2-32],Oe=L[W+3-32];L[W+0+0]=L[W+1+64]=me+ye+1>>1,L[W+1+0]=L[W+2+64]=ye+we+1>>1,L[W+2+0]=L[W+3+64]=we+_e+1>>1,L[W+3+0]=_e+Oe+1>>1,L[W+0+96]=hr(pe,oe,te),L[W+0+64]=hr(oe,te,me),L[W+0+32]=L[W+1+96]=hr(te,me,ye),L[W+1+32]=L[W+2+96]=hr(me,ye,we),L[W+2+32]=L[W+3+96]=hr(ye,we,_e),L[W+3+32]=hr(we,_e,Oe)}function Va(L,W){var te=L[W+0-32],oe=L[W+1-32],pe=L[W+2-32],me=L[W+3-32],ye=L[W+4-32],we=L[W+5-32],_e=L[W+6-32],Oe=L[W+7-32];L[W+0+0]=te+oe+1>>1,L[W+1+0]=L[W+0+64]=oe+pe+1>>1,L[W+2+0]=L[W+1+64]=pe+me+1>>1,L[W+3+0]=L[W+2+64]=me+ye+1>>1,L[W+0+32]=hr(te,oe,pe),L[W+1+32]=L[W+0+96]=hr(oe,pe,me),L[W+2+32]=L[W+1+96]=hr(pe,me,ye),L[W+3+32]=L[W+2+96]=hr(me,ye,we),L[W+3+64]=hr(ye,we,_e),L[W+3+96]=hr(we,_e,Oe)}function sg(L,W){var te=L[W-1+0],oe=L[W-1+32],pe=L[W-1+64],me=L[W-1+96];L[W+0+0]=te+oe+1>>1,L[W+2+0]=L[W+0+32]=oe+pe+1>>1,L[W+2+32]=L[W+0+64]=pe+me+1>>1,L[W+1+0]=hr(te,oe,pe),L[W+3+0]=L[W+1+32]=hr(oe,pe,me),L[W+3+32]=L[W+1+64]=hr(pe,me,me),L[W+3+64]=L[W+2+64]=L[W+0+96]=L[W+1+96]=L[W+2+96]=L[W+3+96]=me}function Uv(L,W){var te=L[W-1+0],oe=L[W-1+32],pe=L[W-1+64],me=L[W-1+96],ye=L[W-1-32],we=L[W+0-32],_e=L[W+1-32],Oe=L[W+2-32];L[W+0+0]=L[W+2+32]=te+ye+1>>1,L[W+0+32]=L[W+2+64]=oe+te+1>>1,L[W+0+64]=L[W+2+96]=pe+oe+1>>1,L[W+0+96]=me+pe+1>>1,L[W+3+0]=hr(we,_e,Oe),L[W+2+0]=hr(ye,we,_e),L[W+1+0]=L[W+3+32]=hr(te,ye,we),L[W+1+32]=L[W+3+64]=hr(oe,te,ye),L[W+1+64]=L[W+3+96]=hr(pe,oe,te),L[W+1+96]=hr(me,pe,oe)}function sl(L,W){var te;for(te=0;8>te;++te)n(L,W+32*te,L,W-32,8)}function Dl(L,W){var te;for(te=0;8>te;++te)o(L,W,L[W-1],8),W+=32}function Uo(L,W,te){var oe;for(oe=0;8>oe;++oe)o(W,te+32*oe,L,8)}function Dd(L,W){var te,oe=8;for(te=0;8>te;++te)oe+=L[W+te-32]+L[W-1+32*te];Uo(oe>>4,L,W)}function Bd(L,W){var te,oe=4;for(te=0;8>te;++te)oe+=L[W+te-32];Uo(oe>>3,L,W)}function Hv(L,W){var te,oe=4;for(te=0;8>te;++te)oe+=L[W-1+32*te];Uo(oe>>3,L,W)}function bu(L,W){Uo(128,L,W)}function ks(L,W,te){var oe=L[W-te],pe=L[W+0],me=3*(pe-oe)+fl[1020+L[W-2*te]-L[W+te]],ye=Kd[112+(me+4>>3)];L[W-te]=Yo[255+oe+Kd[112+(me+3>>3)]],L[W+0]=Yo[255+pe-ye]}function wu(L,W,te,oe){var pe=L[W+0],me=L[W+te];return Ja[255+L[W-2*te]-L[W-te]]>oe||Ja[255+me-pe]>oe}function Ec(L,W,te,oe){return 4*Ja[255+L[W-te]-L[W+0]]+Ja[255+L[W-2*te]-L[W+te]]<=oe}function Ya(L,W,te,oe,pe){var me=L[W-3*te],ye=L[W-2*te],we=L[W-te],_e=L[W+0],Oe=L[W+te],Ge=L[W+2*te],it=L[W+3*te];return 4*Ja[255+we-_e]+Ja[255+ye-Oe]>oe?0:Ja[255+L[W-4*te]-me]<=pe&&Ja[255+me-ye]<=pe&&Ja[255+ye-we]<=pe&&Ja[255+it-Ge]<=pe&&Ja[255+Ge-Oe]<=pe&&Ja[255+Oe-_e]<=pe}function Ac(L,W,te,oe){var pe=2*oe+1;for(oe=0;16>oe;++oe)Ec(L,W+oe,te,pe)&&ks(L,W+oe,te)}function Tc(L,W,te,oe){var pe=2*oe+1;for(oe=0;16>oe;++oe)Ec(L,W+oe*te,1,pe)&&ks(L,W+oe*te,1)}function Su(L,W,te,oe){var pe;for(pe=3;0<pe;--pe)Ac(L,W+=4*te,te,oe)}function ju(L,W,te,oe){var pe;for(pe=3;0<pe;--pe)Tc(L,W+=4,te,oe)}function Ga(L,W,te,oe,pe,me,ye,we){for(me=2*me+1;0<pe--;){if(Ya(L,W,te,me,ye))if(wu(L,W,te,we))ks(L,W,te);else{var _e=L,Oe=W,Ge=te,it=_e[Oe-2*Ge],Ne=_e[Oe-Ge],Ze=_e[Oe+0],nt=_e[Oe+Ge],bt=_e[Oe+2*Ge],at=27*(yt=fl[1020+3*(Ze-Ne)+fl[1020+it-nt]])+63>>7,gt=18*yt+63>>7,yt=9*yt+63>>7;_e[Oe-3*Ge]=Yo[255+_e[Oe-3*Ge]+yt],_e[Oe-2*Ge]=Yo[255+it+gt],_e[Oe-Ge]=Yo[255+Ne+at],_e[Oe+0]=Yo[255+Ze-at],_e[Oe+Ge]=Yo[255+nt-gt],_e[Oe+2*Ge]=Yo[255+bt-yt]}W+=oe}}function ll(L,W,te,oe,pe,me,ye,we){for(me=2*me+1;0<pe--;){if(Ya(L,W,te,me,ye))if(wu(L,W,te,we))ks(L,W,te);else{var _e=L,Oe=W,Ge=te,it=_e[Oe-Ge],Ne=_e[Oe+0],Ze=_e[Oe+Ge],nt=Kd[112+(4+(bt=3*(Ne-it))>>3)],bt=Kd[112+(bt+3>>3)],at=nt+1>>1;_e[Oe-2*Ge]=Yo[255+_e[Oe-2*Ge]+at],_e[Oe-Ge]=Yo[255+it+bt],_e[Oe+0]=Yo[255+Ne-nt],_e[Oe+Ge]=Yo[255+Ze-at]}W+=oe}}function xo(L,W,te,oe,pe,me){Ga(L,W,te,1,16,oe,pe,me)}function Bl(L,W,te,oe,pe,me){Ga(L,W,1,te,16,oe,pe,me)}function Wd(L,W,te,oe,pe,me){var ye;for(ye=3;0<ye;--ye)ll(L,W+=4*te,te,1,16,oe,pe,me)}function _s(L,W,te,oe,pe,me){var ye;for(ye=3;0<ye;--ye)ll(L,W+=4,1,te,16,oe,pe,me)}function lg(L,W,te,oe,pe,me,ye,we){Ga(L,W,pe,1,8,me,ye,we),Ga(te,oe,pe,1,8,me,ye,we)}function Z(L,W,te,oe,pe,me,ye,we){Ga(L,W,1,pe,8,me,ye,we),Ga(te,oe,1,pe,8,me,ye,we)}function fe(L,W,te,oe,pe,me,ye,we){ll(L,W+4*pe,pe,1,8,me,ye,we),ll(te,oe+4*pe,pe,1,8,me,ye,we)}function Ie(L,W,te,oe,pe,me,ye,we){ll(L,W+4,1,pe,8,me,ye,we),ll(te,oe+4,1,pe,8,me,ye,we)}function Ue(){this.ba=new Tt,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new ce,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function tt(){this.data=[],this.offset=this.kd=this.ha=this.w=0,this.na=[],this.xa=this.gb=this.Ja=this.Sa=this.P=0}function wt(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function Ot(){this.ua=0,this.Wa=new De,this.vb=new De,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new M,this.yc=new R}function tr(){this.xb=this.a=0,this.l=new rl,this.ca=new Tt,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new q,this.Pb=0,this.wd=new q,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new Ot,this.ab=0,this.gc=s(4,wt),this.Oc=0}function Xt(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new rl,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function _r(L,W,te,oe,pe,me,ye){for(L=L==null?0:L[W+0],W=0;W<ye;++W)pe[me+W]=L+te[oe+W]&255,L=pe[me+W]}function Pr(L,W,te,oe,pe,me,ye){var we;if(L==null)_r(null,null,te,oe,pe,me,ye);else for(we=0;we<ye;++we)pe[me+we]=L[W+we]+te[oe+we]&255}function Kr(L,W,te,oe,pe,me,ye){if(L==null)_r(null,null,te,oe,pe,me,ye);else{var we,_e=L[W+0],Oe=_e,Ge=_e;for(we=0;we<ye;++we)Oe=Ge+(_e=L[W+we])-Oe,Ge=te[oe+we]+(-256&Oe?0>Oe?0:255:Oe)&255,Oe=_e,pe[me+we]=Ge}}function ki(L,W,te,oe){var pe=W.width,me=W.o;if(t(L!=null&&W!=null),0>te||0>=oe||te+oe>me)return null;if(!L.Cc){if(L.ga==null){var ye;if(L.ga=new Xt,(ye=L.ga==null)||(ye=W.width*W.o,t(L.Gb.length==0),L.Gb=a(ye),L.Uc=0,L.Gb==null?ye=0:(L.mb=L.Gb,L.nb=L.Uc,L.rc=null,ye=1),ye=!ye),!ye){ye=L.ga;var we=L.Fa,_e=L.P,Oe=L.qc,Ge=L.mb,it=L.nb,Ne=_e+1,Ze=Oe-1,nt=ye.l;if(t(we!=null&&Ge!=null&&W!=null),So[0]=null,So[1]=_r,So[2]=Pr,So[3]=Kr,ye.ca=Ge,ye.tb=it,ye.c=W.width,ye.i=W.height,t(0<ye.c&&0<ye.i),1>=Oe)W=0;else if(ye.$a=3&we[_e+0],ye.Z=we[_e+0]>>2&3,ye.Lc=we[_e+0]>>4&3,_e=we[_e+0]>>6&3,0>ye.$a||1<ye.$a||4<=ye.Z||1<ye.Lc||_e)W=0;else if(nt.put=ze,nt.ac=Re,nt.bc=Le,nt.ma=ye,nt.width=W.width,nt.height=W.height,nt.Da=W.Da,nt.v=W.v,nt.va=W.va,nt.j=W.j,nt.o=W.o,ye.$a)e:{t(ye.$a==1),W=Wo();t:for(;;){if(W==null){W=0;break e}if(t(ye!=null),ye.mc=W,W.c=ye.c,W.i=ye.i,W.l=ye.l,W.l.ma=ye,W.l.width=ye.c,W.l.height=ye.i,W.a=0,ee(W.m,we,Ne,Ze),!Yi(ye.c,ye.i,1,W,null)||(W.ab==1&&W.gc[0].hc==3&&Jn(W.s)?(ye.ic=1,we=W.c*W.i,W.Ta=null,W.Ua=0,W.V=a(we),W.Ba=0,W.V==null?(W.a=1,W=0):W=1):(ye.ic=0,W=qo(W,ye.c)),!W))break t;W=1;break e}ye.mc=null,W=0}else W=Ze>=ye.c*ye.i;ye=!W}if(ye)return null;L.ga.Lc!=1?L.Ga=0:oe=me-te}t(L.ga!=null),t(te+oe<=me);e:{if(W=(we=L.ga).c,me=we.l.o,we.$a==0){if(Ne=L.rc,Ze=L.Vc,nt=L.Fa,_e=L.P+1+te*W,Oe=L.mb,Ge=L.nb+te*W,t(_e<=L.P+L.qc),we.Z!=0)for(t(So[we.Z]!=null),ye=0;ye<oe;++ye)So[we.Z](Ne,Ze,nt,_e,Oe,Ge,W),Ne=Oe,Ze=Ge,Ge+=W,_e+=W;else for(ye=0;ye<oe;++ye)n(Oe,Ge,nt,_e,W),Ne=Oe,Ze=Ge,Ge+=W,_e+=W;L.rc=Ne,L.Vc=Ze}else{if(t(we.mc!=null),W=te+oe,t((ye=we.mc)!=null),t(W<=ye.i),ye.C>=W)W=1;else if(we.ic||ti(),we.ic){we=ye.V,Ne=ye.Ba,Ze=ye.c;var bt=ye.i,at=(nt=1,_e=ye.$/Ze,Oe=ye.$%Ze,Ge=ye.m,it=ye.s,ye.$),gt=Ze*bt,yt=Ze*W,_t=it.wc,At=at<yt?dr(it,Oe,_e):null;t(at<=gt),t(W<=bt),t(Jn(it));t:for(;;){for(;!Ge.h&&at<yt;){if(Oe&_t||(At=dr(it,Oe,_e)),t(At!=null),K(Ge),256>(bt=It(At.G[0],At.H[0],Ge)))we[Ne+at]=bt,++at,++Oe>=Ze&&(Oe=0,++_e<=W&&!(_e%16)&&Fn(ye,_e));else{if(!(280>bt)){nt=0;break t}bt=mt(bt-256,Ge);var sr,Kt=It(At.G[4],At.H[4],Ge);if(K(Ge),!(at>=(Kt=ft(Ze,Kt=mt(Kt,Ge)))&&gt-at>=bt)){nt=0;break t}for(sr=0;sr<bt;++sr)we[Ne+at+sr]=we[Ne+at+sr-Kt];for(at+=bt,Oe+=bt;Oe>=Ze;)Oe-=Ze,++_e<=W&&!(_e%16)&&Fn(ye,_e);at<yt&&Oe&_t&&(At=dr(it,Oe,_e))}t(Ge.h==U(Ge))}Fn(ye,_e>W?W:_e);break t}!nt||Ge.h&&at<gt?(nt=0,ye.a=Ge.h?5:3):ye.$=at,W=nt}else W=Bo(ye,ye.V,ye.Ba,ye.c,ye.i,W,Ca);if(!W){oe=0;break e}}te+oe>=me&&(L.Cc=1),oe=1}if(!oe)return null;if(L.Cc&&((oe=L.ga)!=null&&(oe.mc=null),L.ga=null,0<L.Ga))return alert("todo:WebPDequantizeLevels"),null}return L.nb+te*pe}function kn(L,W,te,oe,pe,me){for(;0<pe--;){var ye,we=L,_e=W+(te?1:0),Oe=L,Ge=W+(te?0:3);for(ye=0;ye<oe;++ye){var it=Oe[Ge+4*ye];it!=255&&(it*=32897,we[_e+4*ye+0]=we[_e+4*ye+0]*it>>23,we[_e+4*ye+1]=we[_e+4*ye+1]*it>>23,we[_e+4*ye+2]=we[_e+4*ye+2]*it>>23)}W+=me}}function fn(L,W,te,oe,pe){for(;0<oe--;){var me;for(me=0;me<te;++me){var ye=L[W+2*me+0],we=15&(Oe=L[W+2*me+1]),_e=4369*we,Oe=(240&Oe|Oe>>4)*_e>>16;L[W+2*me+0]=(240&ye|ye>>4)*_e>>16&240|(15&ye|ye<<4)*_e>>16>>4&15,L[W+2*me+1]=240&Oe|we}W+=pe}}function Mn(L,W,te,oe,pe,me,ye,we){var _e,Oe,Ge=255;for(Oe=0;Oe<pe;++Oe){for(_e=0;_e<oe;++_e){var it=L[W+_e];me[ye+4*_e]=it,Ge&=it}W+=te,ye+=we}return Ge!=255}function ei(L,W,te,oe,pe){var me;for(me=0;me<pe;++me)te[oe+me]=L[W+me]>>8}function ti(){Lu=kn,Yv=fn,hp=Mn,Gv=ei}function bo(L,W,te){N[L]=function(oe,pe,me,ye,we,_e,Oe,Ge,it,Ne,Ze,nt,bt,at,gt,yt,_t){var At,sr=_t-1>>1,Kt=we[_e+0]|Oe[Ge+0]<<16,Ir=it[Ne+0]|Ze[nt+0]<<16;t(oe!=null);var er=3*Kt+Ir+131074>>2;for(W(oe[pe+0],255&er,er>>16,bt,at),me!=null&&(er=3*Ir+Kt+131074>>2,W(me[ye+0],255&er,er>>16,gt,yt)),At=1;At<=sr;++At){var Wr=we[_e+At]|Oe[Ge+At]<<16,li=it[Ne+At]|Ze[nt+At]<<16,Or=Kt+Wr+Ir+li+524296,Qt=Or+2*(Wr+Ir)>>3;er=Qt+Kt>>1,Kt=(Or=Or+2*(Kt+li)>>3)+Wr>>1,W(oe[pe+2*At-1],255&er,er>>16,bt,at+(2*At-1)*te),W(oe[pe+2*At-0],255&Kt,Kt>>16,bt,at+(2*At-0)*te),me!=null&&(er=Or+Ir>>1,Kt=Qt+li>>1,W(me[ye+2*At-1],255&er,er>>16,gt,yt+(2*At-1)*te),W(me[ye+2*At+0],255&Kt,Kt>>16,gt,yt+(2*At+0)*te)),Kt=Wr,Ir=li}1&_t||(er=3*Kt+Ir+131074>>2,W(oe[pe+_t-1],255&er,er>>16,bt,at+(_t-1)*te),me!=null&&(er=3*Ir+Kt+131074>>2,W(me[ye+_t-1],255&er,er>>16,gt,yt+(_t-1)*te)))}}function Cs(){ia[fg]=bj,ia[Lc]=Fc,ia[t0]=wj,ia[gp]=Jd,ia[mp]=Du,ia[En]=wp,ia[pg]=ny,ia[Qd]=Fc,ia[Fu]=Jd,ia[vp]=Du,ia[yp]=wp}function cp(L){return L&-16384?0>L?0:255:L>>zc}function ku(L,W){return cp((19077*L>>8)+(26149*W>>8)-14234)}function _u(L,W,te){return cp((19077*L>>8)-(6419*W>>8)-(13320*te>>8)+8708)}function Wl(L,W){return cp((19077*L>>8)+(33050*W>>8)-17685)}function Cu(L,W,te,oe,pe){oe[pe+0]=ku(L,te),oe[pe+1]=_u(L,W,te),oe[pe+2]=Wl(L,W)}function qd(L,W,te,oe,pe){oe[pe+0]=Wl(L,W),oe[pe+1]=_u(L,W,te),oe[pe+2]=ku(L,te)}function $d(L,W,te,oe,pe){var me=_u(L,W,te);W=me<<3&224|Wl(L,W)>>3,oe[pe+0]=248&ku(L,te)|me>>5,oe[pe+1]=W}function wo(L,W,te,oe,pe){var me=240&Wl(L,W)|15;oe[pe+0]=240&ku(L,te)|_u(L,W,te)>>4,oe[pe+1]=me}function Eu(L,W,te,oe,pe){oe[pe+0]=255,Cu(L,W,te,oe,pe+1)}function Au(L,W,te,oe,pe){qd(L,W,te,oe,pe),oe[pe+3]=255}function up(L,W,te,oe,pe){Cu(L,W,te,oe,pe),oe[pe+3]=255}function Ka(L,W,te){N[L]=function(oe,pe,me,ye,we,_e,Oe,Ge,it){for(var Ne=Ge+(-2&it)*te;Ge!=Ne;)W(oe[pe+0],me[ye+0],we[_e+0],Oe,Ge),W(oe[pe+1],me[ye+0],we[_e+0],Oe,Ge+te),pe+=2,++ye,++_e,Ge+=2*te;1&it&&W(oe[pe+0],me[ye+0],we[_e+0],Oe,Ge)}}function zi(L,W,te){return te==0?L==0?W==0?6:5:W==0?4:0:te}function cg(L,W,te,oe,pe){switch(L>>>30){case 3:ql(W,te,oe,pe,0);break;case 2:Ki(W,te,oe,pe);break;case 1:oo(W,te,oe,pe)}}function Tu(L,W){var te,oe,pe=W.M,me=W.Nb,ye=L.oc,we=L.pc+40,_e=L.oc,Oe=L.pc+584,Ge=L.oc,it=L.pc+600;for(te=0;16>te;++te)ye[we+32*te-1]=129;for(te=0;8>te;++te)_e[Oe+32*te-1]=129,Ge[it+32*te-1]=129;for(0<pe?ye[we-1-32]=_e[Oe-1-32]=Ge[it-1-32]=129:(o(ye,we-32-1,127,21),o(_e,Oe-32-1,127,9),o(Ge,it-32-1,127,9)),oe=0;oe<L.za;++oe){var Ne=W.ya[W.aa+oe];if(0<oe){for(te=-1;16>te;++te)n(ye,we+32*te-4,ye,we+32*te+12,4);for(te=-1;8>te;++te)n(_e,Oe+32*te-4,_e,Oe+32*te+4,4),n(Ge,it+32*te-4,Ge,it+32*te+4,4)}var Ze=L.Gd,nt=L.Hd+oe,bt=Ne.ad,at=Ne.Hc;if(0<pe&&(n(ye,we-32,Ze[nt].y,0,16),n(_e,Oe-32,Ze[nt].f,0,8),n(Ge,it-32,Ze[nt].ea,0,8)),Ne.Za){var gt=ye,yt=we-32+16;for(0<pe&&(oe>=L.za-1?o(gt,yt,Ze[nt].y[15],4):n(gt,yt,Ze[nt+1].y,0,4)),te=0;4>te;te++)gt[yt+128+te]=gt[yt+256+te]=gt[yt+384+te]=gt[yt+0+te];for(te=0;16>te;++te,at<<=2)gt=ye,yt=we+iy[te],es[Ne.Ob[te]](gt,yt),cg(at,bt,16*+te,gt,yt)}else if(gt=zi(oe,pe,Ne.Ob[0]),Go[gt](ye,we),at!=0)for(te=0;16>te;++te,at<<=2)cg(at,bt,16*+te,ye,we+iy[te]);for(te=Ne.Gc,gt=zi(oe,pe,Ne.Dd),na[gt](_e,Oe),na[gt](Ge,it),at=bt,gt=_e,yt=Oe,255&(Ne=0|te)&&(170&Ne?ul(at,256,gt,yt):As(at,256,gt,yt)),Ne=Ge,at=it,255&(te>>=8)&&(170&te?ul(bt,320,Ne,at):As(bt,320,Ne,at)),pe<L.Ub-1&&(n(Ze[nt].y,0,ye,we+480,16),n(Ze[nt].f,0,_e,Oe+224,8),n(Ze[nt].ea,0,Ge,it+224,8)),te=8*me*L.B,Ze=L.sa,nt=L.ta+16*oe+16*me*L.R,bt=L.qa,Ne=L.ra+8*oe+te,at=L.Ha,gt=L.Ia+8*oe+te,te=0;16>te;++te)n(Ze,nt+te*L.R,ye,we+32*te,16);for(te=0;8>te;++te)n(bt,Ne+te*L.B,_e,Oe+32*te,8),n(at,gt+te*L.B,Ge,it+32*te,8)}}function dp(L,W,te,oe,pe,me,ye,we,_e){var Oe=[0],Ge=[0],it=0,Ne=_e!=null?_e.kd:0,Ze=_e??new tt;if(L==null||12>te)return 7;Ze.data=L,Ze.w=W,Ze.ha=te,W=[W],te=[te],Ze.gb=[Ze.gb];e:{var nt=W,bt=te,at=Ze.gb;if(t(L!=null),t(bt!=null),t(at!=null),at[0]=0,12<=bt[0]&&!r(L,nt[0],"RIFF")){if(r(L,nt[0]+8,"WEBP")){at=3;break e}var gt=ve(L,nt[0]+4);if(12>gt||4294967286<gt){at=3;break e}if(Ne&&gt>bt[0]-8){at=7;break e}at[0]=gt,nt[0]+=12,bt[0]-=12}at=0}if(at!=0)return at;for(gt=0<Ze.gb[0],te=te[0];;){e:{var yt=L;bt=W,at=te;var _t=Oe,At=Ge,sr=nt=[0];if((er=it=[it])[0]=0,8>at[0])at=7;else{if(!r(yt,bt[0],"VP8X")){if(ve(yt,bt[0]+4)!=10){at=3;break e}if(18>at[0]){at=7;break e}var Kt=ve(yt,bt[0]+8),Ir=1+ke(yt,bt[0]+12);if(2147483648<=Ir*(yt=1+ke(yt,bt[0]+15))){at=3;break e}sr!=null&&(sr[0]=Kt),_t!=null&&(_t[0]=Ir),At!=null&&(At[0]=yt),bt[0]+=18,at[0]-=18,er[0]=1}at=0}}if(it=it[0],nt=nt[0],at!=0)return at;if(bt=!!(2&nt),!gt&&it)return 3;if(me!=null&&(me[0]=!!(16&nt)),ye!=null&&(ye[0]=bt),we!=null&&(we[0]=0),ye=Oe[0],nt=Ge[0],it&&bt&&_e==null){at=0;break}if(4>te){at=7;break}if(gt&&it||!gt&&!it&&!r(L,W[0],"ALPH")){te=[te],Ze.na=[Ze.na],Ze.P=[Ze.P],Ze.Sa=[Ze.Sa];e:{Kt=L,at=W,gt=te;var er=Ze.gb;_t=Ze.na,At=Ze.P,sr=Ze.Sa,Ir=22,t(Kt!=null),t(gt!=null),yt=at[0];var Wr=gt[0];for(t(_t!=null),t(sr!=null),_t[0]=null,At[0]=null,sr[0]=0;;){if(at[0]=yt,gt[0]=Wr,8>Wr){at=7;break e}var li=ve(Kt,yt+4);if(4294967286<li){at=3;break e}var Or=8+li+1&-2;if(Ir+=Or,0<er&&Ir>er){at=3;break e}if(!r(Kt,yt,"VP8 ")||!r(Kt,yt,"VP8L")){at=0;break e}if(Wr[0]<Or){at=7;break e}r(Kt,yt,"ALPH")||(_t[0]=Kt,At[0]=yt+8,sr[0]=li),yt+=Or,Wr-=Or}}if(te=te[0],Ze.na=Ze.na[0],Ze.P=Ze.P[0],Ze.Sa=Ze.Sa[0],at!=0)break}te=[te],Ze.Ja=[Ze.Ja],Ze.xa=[Ze.xa];e:if(er=L,at=W,gt=te,_t=Ze.gb[0],At=Ze.Ja,sr=Ze.xa,Kt=at[0],yt=!r(er,Kt,"VP8 "),Ir=!r(er,Kt,"VP8L"),t(er!=null),t(gt!=null),t(At!=null),t(sr!=null),8>gt[0])at=7;else{if(yt||Ir){if(er=ve(er,Kt+4),12<=_t&&er>_t-12){at=3;break e}if(Ne&&er>gt[0]-8){at=7;break e}At[0]=er,at[0]+=8,gt[0]-=8,sr[0]=Ir}else sr[0]=5<=gt[0]&&er[Kt+0]==47&&!(er[Kt+4]>>5),At[0]=gt[0];at=0}if(te=te[0],Ze.Ja=Ze.Ja[0],Ze.xa=Ze.xa[0],W=W[0],at!=0)break;if(4294967286<Ze.Ja)return 3;if(we==null||bt||(we[0]=Ze.xa?2:1),ye=[ye],nt=[nt],Ze.xa){if(5>te){at=7;break}we=ye,Ne=nt,bt=me,L==null||5>te?L=0:5<=te&&L[W+0]==47&&!(L[W+4]>>5)?(gt=[0],er=[0],_t=[0],ee(At=new q,L,W,te),Qe(At,gt,er,_t)?(we!=null&&(we[0]=gt[0]),Ne!=null&&(Ne[0]=er[0]),bt!=null&&(bt[0]=_t[0]),L=1):L=0):L=0}else{if(10>te){at=7;break}we=nt,L==null||10>te||!mu(L,W+3,te-3)?L=0:(Ne=L[W+0]|L[W+1]<<8|L[W+2]<<16,bt=16383&(L[W+7]<<8|L[W+6]),L=16383&(L[W+9]<<8|L[W+8]),1&Ne||3<(Ne>>1&7)||!(Ne>>4&1)||Ne>>5>=Ze.Ja||!bt||!L?L=0:(ye&&(ye[0]=bt),we&&(we[0]=L),L=1))}if(!L||(ye=ye[0],nt=nt[0],it&&(Oe[0]!=ye||Ge[0]!=nt)))return 3;_e!=null&&(_e[0]=Ze,_e.offset=W-_e.w,t(4294967286>W-_e.w),t(_e.offset==_e.ha-te));break}return at==0||at==7&&it&&_e==null?(me!=null&&(me[0]|=Ze.na!=null&&0<Ze.na.length),oe!=null&&(oe[0]=ye),pe!=null&&(pe[0]=nt),0):at}function Ta(L,W,te){var oe=W.width,pe=W.height,me=0,ye=0,we=oe,_e=pe;if(W.Da=L!=null&&0<L.Da,W.Da&&(we=L.cd,_e=L.bd,me=L.v,ye=L.j,11>te||(me&=-2,ye&=-2),0>me||0>ye||0>=we||0>=_e||me+we>oe||ye+_e>pe))return 0;if(W.v=me,W.j=ye,W.va=me+we,W.o=ye+_e,W.U=we,W.T=_e,W.da=L!=null&&0<L.da,W.da){if(!ae(we,_e,te=[L.ib],me=[L.hb]))return 0;W.ib=te[0],W.hb=me[0]}return W.ob=L!=null&&L.ob,W.Kb=L==null||!L.Sd,W.da&&(W.ob=W.ib<3*oe/4&&W.hb<3*pe/4,W.Kb=0),1}function Pc(L){if(L==null)return 2;if(11>L.S){var W=L.f.RGBA;W.fb+=(L.height-1)*W.A,W.A=-W.A}else W=L.f.kb,L=L.height,W.O+=(L-1)*W.fa,W.fa=-W.fa,W.N+=(L-1>>1)*W.Ab,W.Ab=-W.Ab,W.W+=(L-1>>1)*W.Db,W.Db=-W.Db,W.F!=null&&(W.J+=(L-1)*W.lb,W.lb=-W.lb);return 0}function Ud(L,W,te,oe){if(oe==null||0>=L||0>=W)return 2;if(te!=null){if(te.Da){var pe=te.cd,me=te.bd,ye=-2&te.v,we=-2&te.j;if(0>ye||0>we||0>=pe||0>=me||ye+pe>L||we+me>W)return 2;L=pe,W=me}if(te.da){if(!ae(L,W,pe=[te.ib],me=[te.hb]))return 2;L=pe[0],W=me[0]}}oe.width=L,oe.height=W;e:{var _e=oe.width,Oe=oe.height;if(L=oe.S,0>=_e||0>=Oe||!(L>=fg&&13>L))L=2;else{if(0>=oe.Rd&&oe.sd==null){ye=me=pe=W=0;var Ge=(we=_e*Sp[L])*Oe;if(11>L||(me=(Oe+1)/2*(W=(_e+1)/2),L==12&&(ye=(pe=_e)*Oe)),(Oe=a(Ge+2*me+ye))==null){L=1;break e}oe.sd=Oe,11>L?((_e=oe.f.RGBA).eb=Oe,_e.fb=0,_e.A=we,_e.size=Ge):((_e=oe.f.kb).y=Oe,_e.O=0,_e.fa=we,_e.Fd=Ge,_e.f=Oe,_e.N=0+Ge,_e.Ab=W,_e.Cd=me,_e.ea=Oe,_e.W=0+Ge+me,_e.Db=W,_e.Ed=me,L==12&&(_e.F=Oe,_e.J=0+Ge+2*me),_e.Tc=ye,_e.lb=pe)}if(W=1,pe=oe.S,me=oe.width,ye=oe.height,pe>=fg&&13>pe)if(11>pe)L=oe.f.RGBA,W&=(we=Math.abs(L.A))*(ye-1)+me<=L.size,W&=we>=me*Sp[pe],W&=L.eb!=null;else{L=oe.f.kb,we=(me+1)/2,Ge=(ye+1)/2,_e=Math.abs(L.fa),Oe=Math.abs(L.Ab);var it=Math.abs(L.Db),Ne=Math.abs(L.lb),Ze=Ne*(ye-1)+me;W&=_e*(ye-1)+me<=L.Fd,W&=Oe*(Ge-1)+we<=L.Cd,W=(W&=it*(Ge-1)+we<=L.Ed)&_e>=me&Oe>=we&it>=we,W&=L.y!=null,W&=L.f!=null,W&=L.ea!=null,pe==12&&(W&=Ne>=me,W&=Ze<=L.Tc,W&=L.F!=null)}else W=0;L=W?0:2}}return L!=0||te!=null&&te.fd&&(L=Pc(oe)),L}var Es=64,Pu=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215],fp=24,Ho=32,Vo=8,Iu=[0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7];Se("Predictor0","PredictorAdd0"),N.Predictor0=function(){return 4278190080},N.Predictor1=function(L){return L},N.Predictor2=function(L,W,te){return W[te+0]},N.Predictor3=function(L,W,te){return W[te+1]},N.Predictor4=function(L,W,te){return W[te-1]},N.Predictor5=function(L,W,te){return Ee(Ee(L,W[te+1]),W[te+0])},N.Predictor6=function(L,W,te){return Ee(L,W[te-1])},N.Predictor7=function(L,W,te){return Ee(L,W[te+0])},N.Predictor8=function(L,W,te){return Ee(W[te-1],W[te+0])},N.Predictor9=function(L,W,te){return Ee(W[te+0],W[te+1])},N.Predictor10=function(L,W,te){return Ee(Ee(L,W[te-1]),Ee(W[te+0],W[te+1]))},N.Predictor11=function(L,W,te){var oe=W[te+0];return 0>=rt(oe>>24&255,L>>24&255,(W=W[te-1])>>24&255)+rt(oe>>16&255,L>>16&255,W>>16&255)+rt(oe>>8&255,L>>8&255,W>>8&255)+rt(255&oe,255&L,255&W)?oe:L},N.Predictor12=function(L,W,te){var oe=W[te+0];return(Ae((L>>24&255)+(oe>>24&255)-((W=W[te-1])>>24&255))<<24|Ae((L>>16&255)+(oe>>16&255)-(W>>16&255))<<16|Ae((L>>8&255)+(oe>>8&255)-(W>>8&255))<<8|Ae((255&L)+(255&oe)-(255&W)))>>>0},N.Predictor13=function(L,W,te){var oe=W[te-1];return(Ye((L=Ee(L,W[te+0]))>>24&255,oe>>24&255)<<24|Ye(L>>16&255,oe>>16&255)<<16|Ye(L>>8&255,oe>>8&255)<<8|Ye(255&L,255&oe))>>>0};var Qa=N.PredictorAdd0;N.PredictorAdd1=He,Se("Predictor2","PredictorAdd2"),Se("Predictor3","PredictorAdd3"),Se("Predictor4","PredictorAdd4"),Se("Predictor5","PredictorAdd5"),Se("Predictor6","PredictorAdd6"),Se("Predictor7","PredictorAdd7"),Se("Predictor8","PredictorAdd8"),Se("Predictor9","PredictorAdd9"),Se("Predictor10","PredictorAdd10"),Se("Predictor11","PredictorAdd11"),Se("Predictor12","PredictorAdd12"),Se("Predictor13","PredictorAdd13");var Xa=N.PredictorAdd2;et("ColorIndexInverseTransform","MapARGB","32b",function(L){return L>>8&255},function(L){return L}),et("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(L){return L},function(L){return L>>8&255});var Hd,cl=N.ColorIndexInverseTransform,_i=N.MapARGB,ug=N.VP8LColorIndexInverseTransformAlpha,Za=N.MapAlpha,Pa=N.VP8LPredictorsAdd=[];Pa.length=16,(N.VP8LPredictors=[]).length=16,(N.VP8LPredictorsAdd_C=[]).length=16,(N.VP8LPredictors_C=[]).length=16;var Ic,Vd,Yd,Gd,Ou,Nu,Oc,ql,Ki,ul,oo,As,_n,Cn,ri,Mi,$l,dl,Nc,Rc,dg,Vv,pp,Ru,Lu,Yv,hp,Gv,Kv=a(511),Qv=a(2041),Xv=a(225),Zv=a(767),Jv=0,fl=Qv,Kd=Xv,Yo=Zv,Ja=Kv,fg=0,Lc=1,t0=2,gp=3,mp=4,En=5,pg=6,Qd=7,Fu=8,vp=9,yp=10,xp=[2,3,7],hg=[3,3,11],zu=[280,256,256,256,40],r0=[0,1,1,1,0],mj=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],vj=[24,7,23,25,40,6,39,41,22,26,38,42,56,5,55,57,21,27,54,58,37,43,72,4,71,73,20,28,53,59,70,74,36,44,88,69,75,52,60,3,87,89,19,29,86,90,35,45,68,76,85,91,51,61,104,2,103,105,18,30,102,106,34,46,84,92,67,77,101,107,50,62,120,1,119,121,83,93,17,31,100,108,66,78,118,122,33,47,117,123,49,63,99,109,82,94,0,116,124,65,79,16,32,98,110,48,115,125,81,95,64,114,126,97,111,80,113,127,96,112],n0=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],gg=8,Xd=[4,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,20,21,21,22,22,23,23,24,25,25,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,76,77,78,79,80,81,82,83,84,85,86,87,88,89,91,93,95,96,98,100,101,102,104,106,108,110,112,114,116,118,122,124,126,128,130,132,134,136,138,140,143,145,148,151,154,157],bp=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,177,181,185,189,193,197,201,205,209,213,217,221,225,229,234,239,245,249,254,259,264,269,274,279,284],Mu=null,ey=[[173,148,140,0],[176,155,140,135,0],[180,157,141,134,130,0],[254,254,243,230,196,177,153,140,133,130,129,0]],ty=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],i0=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],o0=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],yj=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],xj=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],ry=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],Go=[],es=[],na=[],pl=1,Zd=2,So=[],ia=[];bo("UpsampleRgbLinePair",Cu,3),bo("UpsampleBgrLinePair",qd,3),bo("UpsampleRgbaLinePair",up,4),bo("UpsampleBgraLinePair",Au,4),bo("UpsampleArgbLinePair",Eu,4),bo("UpsampleRgba4444LinePair",wo,2),bo("UpsampleRgb565LinePair",$d,2);var bj=N.UpsampleRgbLinePair,wj=N.UpsampleBgrLinePair,Fc=N.UpsampleRgbaLinePair,Jd=N.UpsampleBgraLinePair,Du=N.UpsampleArgbLinePair,wp=N.UpsampleRgba4444LinePair,ny=N.UpsampleRgb565LinePair,Ul=16,Ts=1<<Ul-1,pn=-227,mn=482,zc=6,ao=0,oa=a(256),Bu=a(256),ef=a(256),aa=a(256),mg=a(mn-pn),a0=a(mn-pn);Ka("YuvToRgbRow",Cu,3),Ka("YuvToBgrRow",qd,3),Ka("YuvToRgbaRow",up,4),Ka("YuvToBgraRow",Au,4),Ka("YuvToArgbRow",Eu,4),Ka("YuvToRgba4444Row",wo,2),Ka("YuvToRgb565Row",$d,2);var iy=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],Wu=[0,2,8],s0=[8,7,6,4,4,2,2,2,1,1,1,1],Hl=1;this.WebPDecodeRGBA=function(L,W,te,oe,pe){var me=Lc,ye=new Ue,we=new Tt;ye.ba=we,we.S=me,we.width=[we.width],we.height=[we.height];var _e=we.width,Oe=we.height,Ge=new We;if(Ge==null||L==null)var it=2;else t(Ge!=null),it=dp(L,W,te,Ge.width,Ge.height,Ge.Pd,Ge.Qd,Ge.format,null);if(it!=0?_e=0:(_e!=null&&(_e[0]=Ge.width[0]),Oe!=null&&(Oe[0]=Ge.height[0]),_e=1),_e){we.width=we.width[0],we.height=we.height[0],oe!=null&&(oe[0]=we.width),pe!=null&&(pe[0]=we.height);e:{if(oe=new rl,(pe=new tt).data=L,pe.w=W,pe.ha=te,pe.kd=1,W=[0],t(pe!=null),((L=dp(pe.data,pe.w,pe.ha,null,null,null,W,null,pe))==0||L==7)&&W[0]&&(L=4),(W=L)==0){if(t(ye!=null),oe.data=pe.data,oe.w=pe.w+pe.offset,oe.ha=pe.ha-pe.offset,oe.put=ze,oe.ac=Re,oe.bc=Le,oe.ma=ye,pe.xa){if((L=Wo())==null){ye=1;break e}if((function(Ne,Ze){var nt=[0],bt=[0],at=[0];t:for(;;){if(Ne==null)return 0;if(Ze==null)return Ne.a=2,0;if(Ne.l=Ze,Ne.a=0,ee(Ne.m,Ze.data,Ze.w,Ze.ha),!Qe(Ne.m,nt,bt,at)){Ne.a=3;break t}if(Ne.xb=Zd,Ze.width=nt[0],Ze.height=bt[0],!Yi(nt[0],bt[0],1,Ne,null))break t;return 1}return t(Ne.a!=0),0})(L,oe)){if(oe=(W=Ud(oe.width,oe.height,ye.Oa,ye.ba))==0){t:{oe=L;r:for(;;){if(oe==null){oe=0;break t}if(t(oe.s.yc!=null),t(oe.s.Ya!=null),t(0<oe.s.Wb),t((te=oe.l)!=null),t((pe=te.ma)!=null),oe.xb!=0){if(oe.ca=pe.ba,oe.tb=pe.tb,t(oe.ca!=null),!Ta(pe.Oa,te,gp)){oe.a=2;break r}if(!qo(oe,te.width)||te.da)break r;if((te.da||Xe(oe.ca.S))&&ti(),11>oe.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),oe.ca.f.kb.F!=null&&ti()),oe.Pb&&0<oe.s.ua&&oe.s.vb.X==null&&!se(oe.s.vb,oe.s.Wa.Xa)){oe.a=1;break r}oe.xb=0}if(!Bo(oe,oe.V,oe.Ba,oe.c,oe.i,te.o,an))break r;pe.Dc=oe.Ma,oe=1;break t}t(oe.a!=0),oe=0}oe=!oe}oe&&(W=L.a)}else W=L.a}else{if((L=new Bv)==null){ye=1;break e}if(L.Fa=pe.na,L.P=pe.P,L.qc=pe.Sa,Ea(L,oe)){if((W=Ud(oe.width,oe.height,ye.Oa,ye.ba))==0){if(L.Aa=0,te=ye.Oa,t((pe=L)!=null),te!=null){if(0<(_e=0>(_e=te.Md)?0:100<_e?255:255*_e/100)){for(Oe=Ge=0;4>Oe;++Oe)12>(it=pe.pb[Oe]).lc&&(it.ia=_e*s0[0>it.lc?0:it.lc]>>3),Ge|=it.ia;Ge&&(alert("todo:VP8InitRandom"),pe.ia=1)}pe.Ga=te.Id,100<pe.Ga?pe.Ga=100:0>pe.Ga&&(pe.Ga=0)}(function(Ne,Ze){if(Ne==null)return 0;if(Ze==null)return ji(Ne,2,"NULL VP8Io parameter in VP8Decode().");if(!Ne.cb&&!Ea(Ne,Ze))return 0;if(t(Ne.cb),Ze.ac==null||Ze.ac(Ze)){Ze.ob&&(Ne.L=0);var nt=Wu[Ne.L];if(Ne.L==2?(Ne.yb=0,Ne.zb=0):(Ne.yb=Ze.v-nt>>4,Ne.zb=Ze.j-nt>>4,0>Ne.yb&&(Ne.yb=0),0>Ne.zb&&(Ne.zb=0)),Ne.Va=Ze.o+15+nt>>4,Ne.Hb=Ze.va+15+nt>>4,Ne.Hb>Ne.za&&(Ne.Hb=Ne.za),Ne.Va>Ne.Ub&&(Ne.Va=Ne.Ub),0<Ne.L){var bt=Ne.ed;for(nt=0;4>nt;++nt){var at;if(Ne.Qa.Cb){var gt=Ne.Qa.Lb[nt];Ne.Qa.Fb||(gt+=bt.Tb)}else gt=bt.Tb;for(at=0;1>=at;++at){var yt=Ne.gd[nt][at],_t=gt;if(bt.Pc&&(_t+=bt.vd[0],at&&(_t+=bt.od[0])),0<(_t=0>_t?0:63<_t?63:_t)){var At=_t;0<bt.wb&&(At=4<bt.wb?At>>2:At>>1)>9-bt.wb&&(At=9-bt.wb),1>At&&(At=1),yt.dd=At,yt.tc=2*_t+At,yt.ld=40<=_t?2:15<=_t?1:0}else yt.tc=0;yt.La=at}}}nt=0}else ji(Ne,6,"Frame setup failed"),nt=Ne.a;if(nt=nt==0){if(nt){Ne.$c=0,0<Ne.Aa||(Ne.Ic=Hl);t:{nt=Ne.Ic,bt=4*(At=Ne.za);var sr=32*At,Kt=At+1,Ir=0<Ne.L?At*(0<Ne.Aa?2:1):0,er=(Ne.Aa==2?2:1)*At;if((yt=bt+832+(at=3*(16*nt+Wu[Ne.L])/2*sr)+(gt=Ne.Fa!=null&&0<Ne.Fa.length?Ne.Kc.c*Ne.Kc.i:0))!=yt)nt=0;else{if(yt>Ne.Vb){if(Ne.Vb=0,Ne.Ec=a(yt),Ne.Fc=0,Ne.Ec==null){nt=ji(Ne,1,"no memory during frame initialization.");break t}Ne.Vb=yt}yt=Ne.Ec,_t=Ne.Fc,Ne.Ac=yt,Ne.Bc=_t,_t+=bt,Ne.Gd=s(sr,zn),Ne.Hd=0,Ne.rb=s(Kt+1,xr),Ne.sb=1,Ne.wa=Ir?s(Ir,Mt):null,Ne.Y=0,Ne.D.Nb=0,Ne.D.wa=Ne.wa,Ne.D.Y=Ne.Y,0<Ne.Aa&&(Ne.D.Y+=At),t(!0),Ne.oc=yt,Ne.pc=_t,_t+=832,Ne.ya=s(er,yo),Ne.aa=0,Ne.D.ya=Ne.ya,Ne.D.aa=Ne.aa,Ne.Aa==2&&(Ne.D.aa+=At),Ne.R=16*At,Ne.B=8*At,At=(sr=Wu[Ne.L])*Ne.R,sr=sr/2*Ne.B,Ne.sa=yt,Ne.ta=_t+At,Ne.qa=Ne.sa,Ne.ra=Ne.ta+16*nt*Ne.R+sr,Ne.Ha=Ne.qa,Ne.Ia=Ne.ra+8*nt*Ne.B+sr,Ne.$c=0,_t+=at,Ne.mb=gt?yt:null,Ne.nb=gt?_t:null,t(_t+gt<=Ne.Fc+Ne.Vb),_c(Ne),o(Ne.Ac,Ne.Bc,0,bt),nt=1}}if(nt){if(Ze.ka=0,Ze.y=Ne.sa,Ze.O=Ne.ta,Ze.f=Ne.qa,Ze.N=Ne.ra,Ze.ea=Ne.Ha,Ze.Vd=Ne.Ia,Ze.fa=Ne.R,Ze.Rc=Ne.B,Ze.F=null,Ze.J=0,!Jv){for(nt=-255;255>=nt;++nt)Kv[255+nt]=0>nt?-nt:nt;for(nt=-1020;1020>=nt;++nt)Qv[1020+nt]=-128>nt?-128:127<nt?127:nt;for(nt=-112;112>=nt;++nt)Xv[112+nt]=-16>nt?-16:15<nt?15:nt;for(nt=-255;510>=nt;++nt)Zv[255+nt]=0>nt?0:255<nt?255:nt;Jv=1}Oc=sp,ql=vu,ul=Wv,oo=ap,As=zr,Ki=zd,_n=xo,Cn=Bl,ri=lg,Mi=Z,$l=Wd,dl=_s,Nc=fe,Rc=Ie,dg=Ac,Vv=Tc,pp=Su,Ru=ju,es[0]=ag,es[1]=Cc,es[2]=ol,es[3]=qv,es[4]=xu,es[5]=al,es[6]=$v,es[7]=Va,es[8]=Uv,es[9]=sg,Go[0]=Ss,Go[1]=ig,Go[2]=og,Go[3]=lp,Go[4]=$o,Go[5]=il,Go[6]=js,na[0]=Dd,na[1]=Md,na[2]=sl,na[3]=Dl,na[4]=Hv,na[5]=Bd,na[6]=bu,nt=1}else nt=0}nt&&(nt=(function(Wr,li){for(Wr.M=0;Wr.M<Wr.Va;++Wr.M){var Or,Qt=Wr.Jc[Wr.M&Wr.Xb],Ut=Wr.m,hi=Wr;for(Or=0;Or<hi.za;++Or){var wr=Ut,Dr=hi,Rn=Dr.Ac,Qi=Dr.Bc+4*Or,Ci=Dr.zc,ni=Dr.ya[Dr.aa+Or];if(Dr.Qa.Bb?ni.$b=ie(wr,Dr.Pa.jb[0])?2+ie(wr,Dr.Pa.jb[2]):ie(wr,Dr.Pa.jb[1]):ni.$b=0,Dr.kc&&(ni.Ad=ie(wr,Dr.Bd)),ni.Za=!ie(wr,145)+0,ni.Za){var Di=ni.Ob,Xi=0;for(Dr=0;4>Dr;++Dr){var Un,Hr=Ci[0+Dr];for(Un=0;4>Un;++Un){Hr=yj[Rn[Qi+Un]][Hr];for(var tn=i0[ie(wr,Hr[0])];0<tn;)tn=i0[2*tn+ie(wr,Hr[tn])];Hr=-tn,Rn[Qi+Un]=Hr}n(Di,Xi,Rn,Qi,4),Xi+=4,Ci[0+Dr]=Hr}}else Hr=ie(wr,156)?ie(wr,128)?1:3:ie(wr,163)?2:0,ni.Ob[0]=Hr,o(Rn,Qi,Hr,4),o(Ci,0,Hr,4);ni.Dd=ie(wr,142)?ie(wr,114)?ie(wr,183)?1:3:2:0}if(hi.m.Ka)return ji(Wr,7,"Premature end-of-partition0 encountered.");for(;Wr.ja<Wr.za;++Wr.ja){if(hi=Qt,wr=(Ut=Wr).rb[Ut.sb-1],Rn=Ut.rb[Ut.sb+Ut.ja],Or=Ut.ya[Ut.aa+Ut.ja],Qi=Ut.kc?Or.Ad:0)wr.la=Rn.la=0,Or.Za||(wr.Na=Rn.Na=0),Or.Hc=0,Or.Gc=0,Or.ia=0;else{var Hn,rn;if(wr=Rn,Rn=hi,Qi=Ut.Pa.Xc,Ci=Ut.ya[Ut.aa+Ut.ja],ni=Ut.pb[Ci.$b],Dr=Ci.ad,Di=0,Xi=Ut.rb[Ut.sb-1],Hr=Un=0,o(Dr,Di,0,384),Ci.Za)var ci=0,ui=Qi[3];else{tn=a(16);var An=wr.Na+Xi.Na;if(An=Mu(Rn,Qi[1],An,ni.Eb,0,tn,0),wr.Na=Xi.Na=(0<An)+0,1<An)Oc(tn,0,Dr,Di);else{var jo=tn[0]+3>>3;for(tn=0;256>tn;tn+=16)Dr[Di+tn]=jo}ci=1,ui=Qi[0]}var vn=15&wr.la,Tn=15&Xi.la;for(tn=0;4>tn;++tn){var Ei=1&Tn;for(jo=rn=0;4>jo;++jo)vn=vn>>1|(Ei=(An=Mu(Rn,ui,An=Ei+(1&vn),ni.Sc,ci,Dr,Di))>ci)<<7,rn=rn<<2|(3<An?3:1<An?2:Dr[Di+0]!=0),Di+=16;vn>>=4,Tn=Tn>>1|Ei<<7,Un=(Un<<8|rn)>>>0}for(ui=vn,ci=Tn>>4,Hn=0;4>Hn;Hn+=2){for(rn=0,vn=wr.la>>4+Hn,Tn=Xi.la>>4+Hn,tn=0;2>tn;++tn){for(Ei=1&Tn,jo=0;2>jo;++jo)An=Ei+(1&vn),vn=vn>>1|(Ei=0<(An=Mu(Rn,Qi[2],An,ni.Qc,0,Dr,Di)))<<3,rn=rn<<2|(3<An?3:1<An?2:Dr[Di+0]!=0),Di+=16;vn>>=2,Tn=Tn>>1|Ei<<5}Hr|=rn<<4*Hn,ui|=vn<<4<<Hn,ci|=(240&Tn)<<Hn}wr.la=ui,Xi.la=ci,Ci.Hc=Un,Ci.Gc=Hr,Ci.ia=43690&Hr?0:ni.ia,Qi=!(Un|Hr)}if(0<Ut.L&&(Ut.wa[Ut.Y+Ut.ja]=Ut.gd[Or.$b][Or.Za],Ut.wa[Ut.Y+Ut.ja].La|=!Qi),hi.Ka)return ji(Wr,7,"Premature end-of-file encountered.")}if(_c(Wr),Ut=li,hi=1,Or=(Qt=Wr).D,wr=0<Qt.L&&Qt.M>=Qt.zb&&Qt.M<=Qt.Va,Qt.Aa==0)t:{if(Or.M=Qt.M,Or.uc=wr,Tu(Qt,Or),hi=1,Or=(rn=Qt.D).Nb,wr=(Hr=Wu[Qt.L])*Qt.R,Rn=Hr/2*Qt.B,tn=16*Or*Qt.R,jo=8*Or*Qt.B,Qi=Qt.sa,Ci=Qt.ta-wr+tn,ni=Qt.qa,Dr=Qt.ra-Rn+jo,Di=Qt.Ha,Xi=Qt.Ia-Rn+jo,Tn=(vn=rn.M)==0,Un=vn>=Qt.Va-1,Qt.Aa==2&&Tu(Qt,rn),rn.uc)for(Ei=(An=Qt).D.M,t(An.D.uc),rn=An.yb;rn<An.Hb;++rn){ci=rn,ui=Ei;var so=(sa=(vi=An).D).Nb;Hn=vi.R;var sa=sa.wa[sa.Y+ci],gi=vi.sa,mi=vi.ta+16*so*Hn+16*ci,ko=sa.dd,Pn=sa.tc;if(Pn!=0)if(t(3<=Pn),vi.L==1)0<ci&&Vv(gi,mi,Hn,Pn+4),sa.La&&Ru(gi,mi,Hn,Pn),0<ui&&dg(gi,mi,Hn,Pn+4),sa.La&&pp(gi,mi,Hn,Pn);else{var _o=vi.B,ts=vi.qa,Ps=vi.ra+8*so*_o+8*ci,Zi=vi.Ha,vi=vi.Ia+8*so*_o+8*ci;so=sa.ld,0<ci&&(Cn(gi,mi,Hn,Pn+4,ko,so),Mi(ts,Ps,Zi,vi,_o,Pn+4,ko,so)),sa.La&&(dl(gi,mi,Hn,Pn,ko,so),Rc(ts,Ps,Zi,vi,_o,Pn,ko,so)),0<ui&&(_n(gi,mi,Hn,Pn+4,ko,so),ri(ts,Ps,Zi,vi,_o,Pn+4,ko,so)),sa.La&&($l(gi,mi,Hn,Pn,ko,so),Nc(ts,Ps,Zi,vi,_o,Pn,ko,so))}}if(Qt.ia&&alert("todo:DitherRow"),Ut.put!=null){if(rn=16*vn,vn=16*(vn+1),Tn?(Ut.y=Qt.sa,Ut.O=Qt.ta+tn,Ut.f=Qt.qa,Ut.N=Qt.ra+jo,Ut.ea=Qt.Ha,Ut.W=Qt.Ia+jo):(rn-=Hr,Ut.y=Qi,Ut.O=Ci,Ut.f=ni,Ut.N=Dr,Ut.ea=Di,Ut.W=Xi),Un||(vn-=Hr),vn>Ut.o&&(vn=Ut.o),Ut.F=null,Ut.J=null,Qt.Fa!=null&&0<Qt.Fa.length&&rn<vn&&(Ut.J=ki(Qt,Ut,rn,vn-rn),Ut.F=Qt.mb,Ut.F==null&&Ut.F.length==0)){hi=ji(Qt,3,"Could not decode alpha data.");break t}rn<Ut.j&&(Hr=Ut.j-rn,rn=Ut.j,t(!(1&Hr)),Ut.O+=Qt.R*Hr,Ut.N+=Qt.B*(Hr>>1),Ut.W+=Qt.B*(Hr>>1),Ut.F!=null&&(Ut.J+=Ut.width*Hr)),rn<vn&&(Ut.O+=Ut.v,Ut.N+=Ut.v>>1,Ut.W+=Ut.v>>1,Ut.F!=null&&(Ut.J+=Ut.v),Ut.ka=rn-Ut.j,Ut.U=Ut.va-Ut.v,Ut.T=vn-rn,hi=Ut.put(Ut))}Or+1!=Qt.Ic||Un||(n(Qt.sa,Qt.ta-wr,Qi,Ci+16*Qt.R,wr),n(Qt.qa,Qt.ra-Rn,ni,Dr+8*Qt.B,Rn),n(Qt.Ha,Qt.Ia-Rn,Di,Xi+8*Qt.B,Rn))}if(!hi)return ji(Wr,6,"Output aborted.")}return 1})(Ne,Ze)),Ze.bc!=null&&Ze.bc(Ze),nt&=1}return nt?(Ne.cb=0,nt):0})(L,oe)||(W=L.a)}}else W=L.a}W==0&&ye.Oa!=null&&ye.Oa.fd&&(W=Pc(ye.ba))}ye=W}me=ye!=0?null:11>me?we.f.RGBA.eb:we.f.kb.y}else me=null;return me};var Sp=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function u(N,O){for(var C="",I=0;I<4;I++)C+=String.fromCharCode(N[O++]);return C}function d(N,O){return N[O+0]|N[O+1]<<8}function f(N,O){return(N[O+0]|N[O+1]<<8|N[O+2]<<16)>>>0}function h(N,O){return(N[O+0]|N[O+1]<<8|N[O+2]<<16|N[O+3]<<24)>>>0}new c;var p=[0],v=[0],m=[],b=new c,x=e,w=(function(N,O){var C={},I=0,R=!1,F=0,M=0;if(C.frames=[],!(function(z,q){for(var G=0;G<4;G++)if(z[q+G]!="RIFF".charCodeAt(G))return!0;return!1})(N,O)){for(h(N,O+=4),O+=8;O<N.length;){var Y=u(N,O),X=h(N,O+=4);O+=4;var $=X+(1&X);switch(Y){case"VP8 ":case"VP8L":C.frames[I]===void 0&&(C.frames[I]={}),(D=C.frames[I]).src_off=R?M:O-8,D.src_size=F+X+8,I++,R&&(R=!1,F=0,M=0);break;case"VP8X":(D=C.header={}).feature_flags=N[O];var ee=O+4;D.canvas_width=1+f(N,ee),ee+=3,D.canvas_height=1+f(N,ee),ee+=3;break;case"ALPH":R=!0,F=$+8,M=O-8;break;case"ANIM":(D=C.header).bgcolor=h(N,O),ee=O+4,D.loop_count=d(N,ee),ee+=2;break;case"ANMF":var V,D;(D=C.frames[I]={}).offset_x=2*f(N,O),O+=3,D.offset_y=2*f(N,O),O+=3,D.width=1+f(N,O),O+=3,D.height=1+f(N,O),O+=3,D.duration=f(N,O),O+=3,V=N[O++],D.dispose=1&V,D.blend=V>>1&1}Y!="ANMF"&&(O+=$)}return C}})(x,0);w.response=x,w.rgbaoutput=!0,w.dataurl=!1;var k=w.header?w.header:null,j=w.frames?w.frames:null;if(k){k.loop_counter=k.loop_count,p=[k.canvas_height],v=[k.canvas_width];for(var _=0;_<j.length&&j[_].blend!=0;_++);}var T=j[0],A=b.WebPDecodeRGBA(x,T.src_off,T.src_size,v,p);T.rgba=A,T.imgwidth=v[0],T.imgheight=p[0];for(var P=0;P<v[0]*p[0]*4;P++)m[P]=A[P];return this.width=v,this.height=p,this.data=m,this}/** ====================================================================
* @license
* jsPDF XMP metadata plugin
* Copyright (c) 2016 Jussi Utunen, u-jussi@suomi24.fi
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/function dRe(){var e,t=this.internal.__metadata__.metadata,r=unescape(encodeURIComponent(t));e=this.internal.__metadata__.rawXml?r:'<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:jspdf="'+this.internal.__metadata__.namespaceUri+'"><jspdf:metadata>'+r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+"</jspdf:metadata></rdf:Description></rdf:RDF></x:xmpmeta>",this.internal.__metadata__.metadataObjectNumber=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+e.length+" >>"),this.internal.write("stream"),this.internal.write(e),this.internal.write("endstream"),this.internal.write("endobj")}function fRe(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(e){var t,r,n,o,a,s,l,c,u,d=function(z){return z=z||{},this.isStrokeTransparent=z.isStrokeTransparent||!1,this.strokeOpacity=z.strokeOpacity||1,this.strokeStyle=z.strokeStyle||"#000000",this.fillStyle=z.fillStyle||"#000000",this.isFillTransparent=z.isFillTransparent||!1,this.fillOpacity=z.fillOpacity||1,this.font=z.font||"10px sans-serif",this.textBaseline=z.textBaseline||"alphabetic",this.textAlign=z.textAlign||"left",this.lineWidth=z.lineWidth||1,this.lineJoin=z.lineJoin||"miter",this.lineCap=z.lineCap||"butt",this.path=z.path||[],this.transform=z.transform!==void 0?z.transform.clone():new c,this.globalCompositeOperation=z.globalCompositeOperation||"normal",this.globalAlpha=z.globalAlpha||1,this.clip_path=z.clip_path||[],this.currentPoint=z.currentPoint||new s,this.miterLimit=z.miterLimit||10,this.lastPoint=z.lastPoint||new s,this.lineDashOffset=z.lineDashOffset||0,this.lineDash=z.lineDash||[],this.margin=z.margin||[0,0,0,0],this.prevPageLastElemOffset=z.prevPageLastElemOffset||0,this.ignoreClearRect=typeof z.ignoreClearRect!="boolean"||z.ignoreClearRect,this};e.events.push(["initialized",function(){this.context2d=new f(this),t=this.internal.f2,r=this.internal.getCoordinateString,n=this.internal.getVerticalCoordinateString,o=this.internal.getHorizontalCoordinate,a=this.internal.getVerticalCoordinate,s=this.internal.Point,l=this.internal.Rectangle,c=this.internal.Matrix,u=new d}]);var f=function(z){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var q=z;Object.defineProperty(this,"pdf",{get:function(){return q}});var G=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return G},set:function(se){G=!!se}});var U=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return U},set:function(se){U=!!se}});var Q=0;Object.defineProperty(this,"posX",{get:function(){return Q},set:function(se){isNaN(se)||(Q=se)}});var K=0;Object.defineProperty(this,"posY",{get:function(){return K},set:function(se){isNaN(se)||(K=se)}}),Object.defineProperty(this,"margin",{get:function(){return u.margin},set:function(se){var be;typeof se=="number"?be=[se,se,se,se]:((be=new Array(4))[0]=se[0],be[1]=se.length>=2?se[1]:be[0],be[2]=se.length>=3?se[2]:be[0],be[3]=se.length>=4?se[3]:be[1]),u.margin=be}});var re=!1;Object.defineProperty(this,"autoPaging",{get:function(){return re},set:function(se){re=se}});var H=0;Object.defineProperty(this,"lastBreak",{get:function(){return H},set:function(se){H=se}});var ie=[];Object.defineProperty(this,"pageBreaks",{get:function(){return ie},set:function(se){ie=se}}),Object.defineProperty(this,"ctx",{get:function(){return u},set:function(se){se instanceof d&&(u=se)}}),Object.defineProperty(this,"path",{get:function(){return u.path},set:function(se){u.path=se}});var de=[];Object.defineProperty(this,"ctxStack",{get:function(){return de},set:function(se){de=se}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(se){var be;be=h(se),this.ctx.fillStyle=be.style,this.ctx.isFillTransparent=be.a===0,this.ctx.fillOpacity=be.a,this.pdf.setFillColor(be.r,be.g,be.b,{a:be.a}),this.pdf.setTextColor(be.r,be.g,be.b,{a:be.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(se){var be=h(se);this.ctx.strokeStyle=be.style,this.ctx.isStrokeTransparent=be.a===0,this.ctx.strokeOpacity=be.a,be.a===0?this.pdf.setDrawColor(255,255,255):(be.a,this.pdf.setDrawColor(be.r,be.g,be.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(se){["butt","round","square"].indexOf(se)!==-1&&(this.ctx.lineCap=se,this.pdf.setLineCap(se))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(se){isNaN(se)||(this.ctx.lineWidth=se,this.pdf.setLineWidth(se))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(se){["bevel","round","miter"].indexOf(se)!==-1&&(this.ctx.lineJoin=se,this.pdf.setLineJoin(se))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(se){isNaN(se)||(this.ctx.miterLimit=se,this.pdf.setMiterLimit(se))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(se){this.ctx.textBaseline=se}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(se){["right","end","center","left","start"].indexOf(se)!==-1&&(this.ctx.textAlign=se)}});var le=null,ke=null,ve=null;Object.defineProperty(this,"fontFaces",{get:function(){return ve},set:function(se){le=null,ke=null,ve=se}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(se){var be;if(this.ctx.font=se,(be=/^\s*(?=(?:(?:[-a-z]+\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\1|\2|\3)\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\d]+(?:\%|in|[cem]m|ex|p[ctx]))(?:\s*\/\s*(normal|[.\d]+(?:\%|in|[cem]m|ex|p[ctx])))?\s*([-_,\"\'\sa-z0-9]+?)\s*$/i.exec(se))!==null){var De=be[1];be[2];var ae=be[3],ue=be[4];be[5];var Me=be[6],Se=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(ue)[2];ue=Math.floor(Se==="px"?parseFloat(ue)*this.pdf.internal.scaleFactor:Se==="em"?parseFloat(ue)*this.pdf.getFontSize():parseFloat(ue)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(ue);var Pe=(function(et){var Pt,qe,Et=[],vt=et.trim();if(vt==="")return l3;if(vt in cq)return[cq[vt]];for(;vt!=="";){switch(qe=null,Pt=(vt=dq(vt)).charAt(0)){case'"':case"'":qe=oRe(vt.substring(1),Pt);break;default:qe=aRe(vt)}if(qe===null||(Et.push(qe[0]),(vt=dq(qe[1]))!==""&&vt.charAt(0)!==","))return l3;vt=vt.replace(/^,/,"")}return Et})(Me);if(this.fontFaces){var Ee=(function(et,Pt){var qe=et.getFontList(),Et=JSON.stringify(qe);if(le===null||ke!==Et){var vt=(function(Ft){var Ce=[];return Object.keys(Ft).forEach(function(lt){Ft[lt].forEach(function(Xe){var Be=null;switch(Xe){case"bold":Be={family:lt,weight:"bold"};break;case"italic":Be={family:lt,style:"italic"};break;case"bolditalic":Be={family:lt,weight:"bold",style:"italic"};break;case"":case"normal":Be={family:lt}}Be!==null&&(Be.ref={name:lt,style:Xe},Ce.push(Be))})}),Ce})(qe);le=(function(Ft){for(var Ce={},lt=0;lt<Ft.length;++lt){var Xe=s3(Ft[lt]),Be=Xe.family,ct=Xe.stretch,Tt=Xe.style,We=Xe.weight;Ce[Be]=Ce[Be]||{},Ce[Be][ct]=Ce[Be][ct]||{},Ce[Be][ct][Tt]=Ce[Be][ct][Tt]||{},Ce[Be][ct][Tt][We]=Xe}return Ce})(vt.concat(Pt)),ke=Et}return le})(this.pdf,this.fontFaces),Ae=Pe.map(function(et){return{family:et,stretch:"normal",weight:ae,style:De}}),Ye=(function(et,Pt,qe){for(var Et=(qe=qe||{}).defaultFontFamily||"times",vt=Object.assign({},iRe,qe.genericFontFamilies||{}),Ft=null,Ce=null,lt=0;lt<Pt.length;++lt)if(vt[(Ft=s3(Pt[lt])).family]&&(Ft.family=vt[Ft.family]),et.hasOwnProperty(Ft.family)){Ce=et[Ft.family];break}if(!(Ce=Ce||et[Et]))throw new Error("Could not find a font-family for the rule '"+uq(Ft)+"' and default family '"+Et+"'.");if(Ce=(function(Xe,Be){if(Be[Xe])return Be[Xe];var ct=J6[Xe],Tt=ct<=J6.normal?-1:1,We=lq(Be,MZ,ct,Tt);if(!We)throw new Error("Could not find a matching font-stretch value for "+Xe);return We})(Ft.stretch,Ce),Ce=(function(Xe,Be){if(Be[Xe])return Be[Xe];for(var ct=zZ[Xe],Tt=0;Tt<ct.length;++Tt)if(Be[ct[Tt]])return Be[ct[Tt]];throw new Error("Could not find a matching font-style for "+Xe)})(Ft.style,Ce),!(Ce=(function(Xe,Be){if(Be[Xe])return Be[Xe];if(Xe===400&&Be[500])return Be[500];if(Xe===500&&Be[400])return Be[400];var ct=nRe[Xe],Tt=lq(Be,DZ,ct,Xe<400?-1:1);if(!Tt)throw new Error("Could not find a matching font-weight for value "+Xe);return Tt})(Ft.weight,Ce)))throw new Error("Failed to resolve a font for the rule '"+uq(Ft)+"'.");return Ce})(Ee,Ae);this.pdf.setFont(Ye.ref.name,Ye.ref.style)}else{var rt="";(ae==="bold"||parseInt(ae,10)>=700||De==="bold")&&(rt="bold"),De==="italic"&&(rt+="italic"),rt.length===0&&(rt="normal");for(var He="",xt={arial:"Helvetica",Arial:"Helvetica",verdana:"Helvetica",Verdana:"Helvetica",helvetica:"Helvetica",Helvetica:"Helvetica","sans-serif":"Helvetica",fixed:"Courier",monospace:"Courier",terminal:"Courier",cursive:"Times",fantasy:"Times",serif:"Times"},st=0;st<Pe.length;st++){if(this.pdf.internal.getFont(Pe[st],rt,{noFallback:!0,disableWarning:!0})!==void 0){He=Pe[st];break}if(rt==="bolditalic"&&this.pdf.internal.getFont(Pe[st],"bold",{noFallback:!0,disableWarning:!0})!==void 0)He=Pe[st],rt="bold";else if(this.pdf.internal.getFont(Pe[st],"normal",{noFallback:!0,disableWarning:!0})!==void 0){He=Pe[st],rt="normal";break}}if(He===""){for(var Te=0;Te<Pe.length;Te++)if(xt[Pe[Te]]){He=xt[Pe[Te]];break}}He=He===""?"Times":He,this.pdf.setFont(He,rt)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(se){this.ctx.globalCompositeOperation=se}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(se){this.ctx.globalAlpha=se}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(se){this.ctx.lineDashOffset=se,D.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(se){this.ctx.lineDash=se,D.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(se){this.ctx.ignoreClearRect=!!se}})};f.prototype.setLineDash=function(z){this.lineDash=z},f.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},f.prototype.fill=function(){j.call(this,"fill",!1)},f.prototype.stroke=function(){j.call(this,"stroke",!1)},f.prototype.beginPath=function(){this.path=[{type:"begin"}]},f.prototype.moveTo=function(z,q){if(isNaN(z)||isNaN(q))throw Bn.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var G=this.ctx.transform.applyToPoint(new s(z,q));this.path.push({type:"mt",x:G.x,y:G.y}),this.ctx.lastPoint=new s(z,q)},f.prototype.closePath=function(){var z=new s(0,0),q=0;for(q=this.path.length-1;q!==-1;q--)if(this.path[q].type==="begin"&&On(this.path[q+1])==="object"&&typeof this.path[q+1].x=="number"){z=new s(this.path[q+1].x,this.path[q+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new s(z.x,z.y)},f.prototype.lineTo=function(z,q){if(isNaN(z)||isNaN(q))throw Bn.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var G=this.ctx.transform.applyToPoint(new s(z,q));this.path.push({type:"lt",x:G.x,y:G.y}),this.ctx.lastPoint=new s(G.x,G.y)},f.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),j.call(this,null,!0)},f.prototype.quadraticCurveTo=function(z,q,G,U){if(isNaN(G)||isNaN(U)||isNaN(z)||isNaN(q))throw Bn.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var Q=this.ctx.transform.applyToPoint(new s(G,U)),K=this.ctx.transform.applyToPoint(new s(z,q));this.path.push({type:"qct",x1:K.x,y1:K.y,x:Q.x,y:Q.y}),this.ctx.lastPoint=new s(Q.x,Q.y)},f.prototype.bezierCurveTo=function(z,q,G,U,Q,K){if(isNaN(Q)||isNaN(K)||isNaN(z)||isNaN(q)||isNaN(G)||isNaN(U))throw Bn.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var re=this.ctx.transform.applyToPoint(new s(Q,K)),H=this.ctx.transform.applyToPoint(new s(z,q)),ie=this.ctx.transform.applyToPoint(new s(G,U));this.path.push({type:"bct",x1:H.x,y1:H.y,x2:ie.x,y2:ie.y,x:re.x,y:re.y}),this.ctx.lastPoint=new s(re.x,re.y)},f.prototype.arc=function(z,q,G,U,Q,K){if(isNaN(z)||isNaN(q)||isNaN(G)||isNaN(U)||isNaN(Q))throw Bn.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(K=!!K,!this.ctx.transform.isIdentity){var re=this.ctx.transform.applyToPoint(new s(z,q));z=re.x,q=re.y;var H=this.ctx.transform.applyToPoint(new s(0,G)),ie=this.ctx.transform.applyToPoint(new s(0,0));G=Math.sqrt(Math.pow(H.x-ie.x,2)+Math.pow(H.y-ie.y,2))}Math.abs(Q-U)>=2*Math.PI&&(U=0,Q=2*Math.PI),this.path.push({type:"arc",x:z,y:q,radius:G,startAngle:U,endAngle:Q,counterclockwise:K})},f.prototype.arcTo=function(z,q,G,U,Q){throw new Error("arcTo not implemented.")},f.prototype.rect=function(z,q,G,U){if(isNaN(z)||isNaN(q)||isNaN(G)||isNaN(U))throw Bn.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(z,q),this.lineTo(z+G,q),this.lineTo(z+G,q+U),this.lineTo(z,q+U),this.lineTo(z,q),this.lineTo(z+G,q),this.lineTo(z,q)},f.prototype.fillRect=function(z,q,G,U){if(isNaN(z)||isNaN(q)||isNaN(G)||isNaN(U))throw Bn.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!p.call(this)){var Q={};this.lineCap!=="butt"&&(Q.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(Q.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(z,q,G,U),this.fill(),Q.hasOwnProperty("lineCap")&&(this.lineCap=Q.lineCap),Q.hasOwnProperty("lineJoin")&&(this.lineJoin=Q.lineJoin)}},f.prototype.strokeRect=function(z,q,G,U){if(isNaN(z)||isNaN(q)||isNaN(G)||isNaN(U))throw Bn.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");v.call(this)||(this.beginPath(),this.rect(z,q,G,U),this.stroke())},f.prototype.clearRect=function(z,q,G,U){if(isNaN(z)||isNaN(q)||isNaN(G)||isNaN(U))throw Bn.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(z,q,G,U))},f.prototype.save=function(z){z=typeof z!="boolean"||z;for(var q=this.pdf.internal.getCurrentPageInfo().pageNumber,G=0;G<this.pdf.internal.getNumberOfPages();G++)this.pdf.setPage(G+1),this.pdf.internal.out("q");if(this.pdf.setPage(q),z){this.ctx.fontSize=this.pdf.internal.getFontSize();var U=new d(this.ctx);this.ctxStack.push(this.ctx),this.ctx=U}},f.prototype.restore=function(z){z=typeof z!="boolean"||z;for(var q=this.pdf.internal.getCurrentPageInfo().pageNumber,G=0;G<this.pdf.internal.getNumberOfPages();G++)this.pdf.setPage(G+1),this.pdf.internal.out("Q");this.pdf.setPage(q),z&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},f.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var h=function(z){var q,G,U,Q;if(z.isCanvasGradient===!0&&(z=z.getColor()),!z)return{r:0,g:0,b:0,a:0,style:z};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(z))q=0,G=0,U=0,Q=0;else{var K=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(z);if(K!==null)q=parseInt(K[1]),G=parseInt(K[2]),U=parseInt(K[3]),Q=1;else if((K=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(z))!==null)q=parseInt(K[1]),G=parseInt(K[2]),U=parseInt(K[3]),Q=parseFloat(K[4]);else{if(Q=1,typeof z=="string"&&z.charAt(0)!=="#"){var re=new PZ(z);z=re.ok?re.toHex():"#000000"}z.length===4?(q=z.substring(1,2),q+=q,G=z.substring(2,3),G+=G,U=z.substring(3,4),U+=U):(q=z.substring(1,3),G=z.substring(3,5),U=z.substring(5,7)),q=parseInt(q,16),G=parseInt(G,16),U=parseInt(U,16)}}return{r:q,g:G,b:U,a:Q,style:z}},p=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},v=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};f.prototype.fillText=function(z,q,G,U){if(isNaN(q)||isNaN(G)||typeof z!="string")throw Bn.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(U=isNaN(U)?void 0:U,!p.call(this)){var Q=$(this.ctx.transform.rotation),K=this.ctx.transform.scaleX;I.call(this,{text:z,x:q,y:G,scale:K,angle:Q,align:this.textAlign,maxWidth:U})}},f.prototype.strokeText=function(z,q,G,U){if(isNaN(q)||isNaN(G)||typeof z!="string")throw Bn.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!v.call(this)){U=isNaN(U)?void 0:U;var Q=$(this.ctx.transform.rotation),K=this.ctx.transform.scaleX;I.call(this,{text:z,x:q,y:G,scale:K,renderingMode:"stroke",angle:Q,align:this.textAlign,maxWidth:U})}},f.prototype.measureText=function(z){if(typeof z!="string")throw Bn.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var q=this.pdf,G=this.pdf.internal.scaleFactor,U=q.internal.getFontSize(),Q=q.getStringUnitWidth(z)*U/q.internal.scaleFactor;return new function(K){var re=(K=K||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return re}}),this}({width:Q*=Math.round(96*G/72*1e4)/1e4})},f.prototype.scale=function(z,q){if(isNaN(z)||isNaN(q))throw Bn.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var G=new c(z,0,0,q,0,0);this.ctx.transform=this.ctx.transform.multiply(G)},f.prototype.rotate=function(z){if(isNaN(z))throw Bn.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var q=new c(Math.cos(z),Math.sin(z),-Math.sin(z),Math.cos(z),0,0);this.ctx.transform=this.ctx.transform.multiply(q)},f.prototype.translate=function(z,q){if(isNaN(z)||isNaN(q))throw Bn.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var G=new c(1,0,0,1,z,q);this.ctx.transform=this.ctx.transform.multiply(G)},f.prototype.transform=function(z,q,G,U,Q,K){if(isNaN(z)||isNaN(q)||isNaN(G)||isNaN(U)||isNaN(Q)||isNaN(K))throw Bn.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var re=new c(z,q,G,U,Q,K);this.ctx.transform=this.ctx.transform.multiply(re)},f.prototype.setTransform=function(z,q,G,U,Q,K){z=isNaN(z)?1:z,q=isNaN(q)?0:q,G=isNaN(G)?0:G,U=isNaN(U)?1:U,Q=isNaN(Q)?0:Q,K=isNaN(K)?0:K,this.ctx.transform=new c(z,q,G,U,Q,K)};var m=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};f.prototype.drawImage=function(z,q,G,U,Q,K,re,H,ie){var de=this.pdf.getImageProperties(z),le=1,ke=1,ve=1,se=1;U!==void 0&&H!==void 0&&(ve=H/U,se=ie/Q,le=de.width/U*H/U,ke=de.height/Q*ie/Q),K===void 0&&(K=q,re=G,q=0,G=0),U!==void 0&&H===void 0&&(H=U,ie=Q),U===void 0&&H===void 0&&(H=de.width,ie=de.height);var be=this.ctx.transform.decompose(),De=$(be.rotate.shx),ae=new c,ue=(ae=(ae=(ae=ae.multiply(be.translate)).multiply(be.skew)).multiply(be.scale)).applyToRectangle(new l(K-q*ve,re-G*se,U*le,Q*ke));if(this.autoPaging){for(var Me,Se=b.call(this,ue),Pe=[],Ee=0;Ee<Se.length;Ee+=1)Pe.indexOf(Se[Ee])===-1&&Pe.push(Se[Ee]);k(Pe);for(var Ae=Pe[0],Ye=Pe[Pe.length-1],rt=Ae;rt<Ye+1;rt++){this.pdf.setPage(rt);var He=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],xt=rt===1?this.posY+this.margin[0]:this.margin[0],st=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Te=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],et=rt===1?0:st+(rt-2)*Te;if(this.ctx.clip_path.length!==0){var Pt=this.path;Me=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=w(Me,this.posX+this.margin[3],-et+xt+this.ctx.prevPageLastElemOffset),_.call(this,"fill",!0),this.path=Pt}var qe=JSON.parse(JSON.stringify(ue));qe=w([qe],this.posX+this.margin[3],-et+xt+this.ctx.prevPageLastElemOffset)[0];var Et=(rt>Ae||rt<Ye)&&m.call(this);Et&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],He,Te,null).clip().discardPath()),this.pdf.addImage(z,"JPEG",qe.x,qe.y,qe.w,qe.h,null,null,De),Et&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(z,"JPEG",ue.x,ue.y,ue.w,ue.h,null,null,De)};var b=function(z,q,G){var U=[];q=q||this.pdf.internal.pageSize.width,G=G||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var Q=this.posY+this.ctx.prevPageLastElemOffset;switch(z.type){default:case"mt":case"lt":U.push(Math.floor((z.y+Q)/G)+1);break;case"arc":U.push(Math.floor((z.y+Q-z.radius)/G)+1),U.push(Math.floor((z.y+Q+z.radius)/G)+1);break;case"qct":var K=ee(this.ctx.lastPoint.x,this.ctx.lastPoint.y,z.x1,z.y1,z.x,z.y);U.push(Math.floor((K.y+Q)/G)+1),U.push(Math.floor((K.y+K.h+Q)/G)+1);break;case"bct":var re=V(this.ctx.lastPoint.x,this.ctx.lastPoint.y,z.x1,z.y1,z.x2,z.y2,z.x,z.y);U.push(Math.floor((re.y+Q)/G)+1),U.push(Math.floor((re.y+re.h+Q)/G)+1);break;case"rect":U.push(Math.floor((z.y+Q)/G)+1),U.push(Math.floor((z.y+z.h+Q)/G)+1)}for(var H=0;H<U.length;H+=1)for(;this.pdf.internal.getNumberOfPages()<U[H];)x.call(this);return U},x=function(){var z=this.fillStyle,q=this.strokeStyle,G=this.font,U=this.lineCap,Q=this.lineWidth,K=this.lineJoin;this.pdf.addPage(),this.fillStyle=z,this.strokeStyle=q,this.font=G,this.lineCap=U,this.lineWidth=Q,this.lineJoin=K},w=function(z,q,G){for(var U=0;U<z.length;U++)switch(z[U].type){case"bct":z[U].x2+=q,z[U].y2+=G;case"qct":z[U].x1+=q,z[U].y1+=G;default:z[U].x+=q,z[U].y+=G}return z},k=function(z){return z.sort(function(q,G){return q-G})},j=function(z,q){var G=this.fillStyle,U=this.strokeStyle,Q=this.lineCap,K=this.lineWidth,re=Math.abs(K*this.ctx.transform.scaleX),H=this.lineJoin;if(this.autoPaging){for(var ie,de,le=JSON.parse(JSON.stringify(this.path)),ke=JSON.parse(JSON.stringify(this.path)),ve=[],se=0;se<ke.length;se++)if(ke[se].x!==void 0)for(var be=b.call(this,ke[se]),De=0;De<be.length;De+=1)ve.indexOf(be[De])===-1&&ve.push(be[De]);for(var ae=0;ae<ve.length;ae++)for(;this.pdf.internal.getNumberOfPages()<ve[ae];)x.call(this);k(ve);for(var ue=ve[0],Me=ve[ve.length-1],Se=ue;Se<Me+1;Se++){this.pdf.setPage(Se),this.fillStyle=G,this.strokeStyle=U,this.lineCap=Q,this.lineWidth=re,this.lineJoin=H;var Pe=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Ee=Se===1?this.posY+this.margin[0]:this.margin[0],Ae=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ye=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],rt=Se===1?0:Ae+(Se-2)*Ye;if(this.ctx.clip_path.length!==0){var He=this.path;ie=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=w(ie,this.posX+this.margin[3],-rt+Ee+this.ctx.prevPageLastElemOffset),_.call(this,z,!0),this.path=He}if(de=JSON.parse(JSON.stringify(le)),this.path=w(de,this.posX+this.margin[3],-rt+Ee+this.ctx.prevPageLastElemOffset),q===!1||Se===0){var xt=(Se>ue||Se<Me)&&m.call(this);xt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Pe,Ye,null).clip().discardPath()),_.call(this,z,q),xt&&this.pdf.restoreGraphicsState()}this.lineWidth=K}this.path=le}else this.lineWidth=re,_.call(this,z,q),this.lineWidth=K},_=function(z,q){if((z!=="stroke"||q||!v.call(this))&&(z==="stroke"||q||!p.call(this))){for(var G,U,Q=[],K=this.path,re=0;re<K.length;re++){var H=K[re];switch(H.type){case"begin":Q.push({begin:!0});break;case"close":Q.push({close:!0});break;case"mt":Q.push({start:H,deltas:[],abs:[]});break;case"lt":var ie=Q.length;if(K[re-1]&&!isNaN(K[re-1].x)&&(G=[H.x-K[re-1].x,H.y-K[re-1].y],ie>0)){for(;ie>=0;ie--)if(Q[ie-1].close!==!0&&Q[ie-1].begin!==!0){Q[ie-1].deltas.push(G),Q[ie-1].abs.push(H);break}}break;case"bct":G=[H.x1-K[re-1].x,H.y1-K[re-1].y,H.x2-K[re-1].x,H.y2-K[re-1].y,H.x-K[re-1].x,H.y-K[re-1].y],Q[Q.length-1].deltas.push(G);break;case"qct":var de=K[re-1].x+2/3*(H.x1-K[re-1].x),le=K[re-1].y+2/3*(H.y1-K[re-1].y),ke=H.x+2/3*(H.x1-H.x),ve=H.y+2/3*(H.y1-H.y),se=H.x,be=H.y;G=[de-K[re-1].x,le-K[re-1].y,ke-K[re-1].x,ve-K[re-1].y,se-K[re-1].x,be-K[re-1].y],Q[Q.length-1].deltas.push(G);break;case"arc":Q.push({deltas:[],abs:[],arc:!0}),Array.isArray(Q[Q.length-1].abs)&&Q[Q.length-1].abs.push(H)}}U=q?null:z==="stroke"?"stroke":"fill";for(var De=!1,ae=0;ae<Q.length;ae++)if(Q[ae].arc)for(var ue=Q[ae].abs,Me=0;Me<ue.length;Me++){var Se=ue[Me];Se.type==="arc"?P.call(this,Se.x,Se.y,Se.radius,Se.startAngle,Se.endAngle,Se.counterclockwise,void 0,q,!De):R.call(this,Se.x,Se.y),De=!0}else if(Q[ae].close===!0)this.pdf.internal.out("h"),De=!1;else if(Q[ae].begin!==!0){var Pe=Q[ae].start.x,Ee=Q[ae].start.y;F.call(this,Q[ae].deltas,Pe,Ee),De=!0}U&&N.call(this,U),q&&O.call(this)}},T=function(z){var q=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,G=q*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return z-G;case"top":return z+q-G;case"hanging":return z+q-2*G;case"middle":return z+q/2-G;default:return z}},A=function(z){return z+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};f.prototype.createLinearGradient=function(){var z=function(){};return z.colorStops=[],z.addColorStop=function(q,G){this.colorStops.push([q,G])},z.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},z.isCanvasGradient=!0,z},f.prototype.createPattern=function(){return this.createLinearGradient()},f.prototype.createRadialGradient=function(){return this.createLinearGradient()};var P=function(z,q,G,U,Q,K,re,H,ie){for(var de=Y.call(this,G,U,Q,K),le=0;le<de.length;le++){var ke=de[le];le===0&&(ie?C.call(this,ke.x1+z,ke.y1+q):R.call(this,ke.x1+z,ke.y1+q)),M.call(this,z,q,ke.x2,ke.y2,ke.x3,ke.y3,ke.x4,ke.y4)}H?O.call(this):N.call(this,re)},N=function(z){switch(z){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},O=function(){this.pdf.clip(),this.pdf.discardPath()},C=function(z,q){this.pdf.internal.out(r(z)+" "+n(q)+" m")},I=function(z){var q;switch(z.align){case"right":case"end":q="right";break;case"center":q="center";break;default:q="left"}var G,U,Q,K=this.pdf.getTextDimensions(z.text),re=T.call(this,z.y),H=A.call(this,re)-K.h,ie=this.ctx.transform.applyToPoint(new s(z.x,re));if(this.autoPaging){var de=this.ctx.transform.decompose(),le=new c;le=(le=(le=le.multiply(de.translate)).multiply(de.skew)).multiply(de.scale);for(var ke=this.ctx.transform.applyToRectangle(new l(z.x,re,K.w,K.h)),ve=le.applyToRectangle(new l(z.x,H,K.w,K.h)),se=b.call(this,ve),be=[],De=0;De<se.length;De+=1)be.indexOf(se[De])===-1&&be.push(se[De]);k(be);for(var ae=be[0],ue=be[be.length-1],Me=ae;Me<ue+1;Me++){this.pdf.setPage(Me);var Se=Me===1?this.posY+this.margin[0]:this.margin[0],Pe=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ee=this.pdf.internal.pageSize.height-this.margin[2],Ae=Ee-this.margin[0],Ye=this.pdf.internal.pageSize.width-this.margin[1],rt=Ye-this.margin[3],He=Me===1?0:Pe+(Me-2)*Ae;if(this.ctx.clip_path.length!==0){var xt=this.path;G=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=w(G,this.posX+this.margin[3],-1*He+Se),_.call(this,"fill",!0),this.path=xt}var st=w([JSON.parse(JSON.stringify(ve))],this.posX+this.margin[3],-He+Se+this.ctx.prevPageLastElemOffset)[0];z.scale>=.01&&(U=this.pdf.internal.getFontSize(),this.pdf.setFontSize(U*z.scale),Q=this.lineWidth,this.lineWidth=Q*z.scale);var Te=this.autoPaging!=="text";if(Te||st.y+st.h<=Ee){if(Te||st.y>=Se&&st.x<=Ye){var et=Te?z.text:this.pdf.splitTextToSize(z.text,z.maxWidth||Ye-st.x)[0],Pt=w([JSON.parse(JSON.stringify(ke))],this.posX+this.margin[3],-He+Se+this.ctx.prevPageLastElemOffset)[0],qe=Te&&(Me>ae||Me<ue)&&m.call(this);qe&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],rt,Ae,null).clip().discardPath()),this.pdf.text(et,Pt.x,Pt.y,{angle:z.angle,align:q,renderingMode:z.renderingMode}),qe&&this.pdf.restoreGraphicsState()}}else st.y<Ee&&(this.ctx.prevPageLastElemOffset+=Ee-st.y);z.scale>=.01&&(this.pdf.setFontSize(U),this.lineWidth=Q)}}else z.scale>=.01&&(U=this.pdf.internal.getFontSize(),this.pdf.setFontSize(U*z.scale),Q=this.lineWidth,this.lineWidth=Q*z.scale),this.pdf.text(z.text,ie.x+this.posX,ie.y+this.posY,{angle:z.angle,align:q,renderingMode:z.renderingMode,maxWidth:z.maxWidth}),z.scale>=.01&&(this.pdf.setFontSize(U),this.lineWidth=Q)},R=function(z,q,G,U){G=G||0,U=U||0,this.pdf.internal.out(r(z+G)+" "+n(q+U)+" l")},F=function(z,q,G){return this.pdf.lines(z,q,G,null,null)},M=function(z,q,G,U,Q,K,re,H){this.pdf.internal.out([t(o(G+z)),t(a(U+q)),t(o(Q+z)),t(a(K+q)),t(o(re+z)),t(a(H+q)),"c"].join(" "))},Y=function(z,q,G,U){for(var Q=2*Math.PI,K=Math.PI/2;q>G;)q-=Q;var re=Math.abs(G-q);re<Q&&U&&(re=Q-re);for(var H=[],ie=U?-1:1,de=q;re>1e-5;){var le=de+ie*Math.min(re,K);H.push(X.call(this,z,de,le)),re-=Math.abs(le-de),de=le}return H},X=function(z,q,G){var U=(G-q)/2,Q=z*Math.cos(U),K=z*Math.sin(U),re=Q,H=-K,ie=re*re+H*H,de=ie+re*Q+H*K,le=4/3*(Math.sqrt(2*ie*de)-de)/(re*K-H*Q),ke=re-le*H,ve=H+le*re,se=ke,be=-ve,De=U+q,ae=Math.cos(De),ue=Math.sin(De);return{x1:z*Math.cos(q),y1:z*Math.sin(q),x2:ke*ae-ve*ue,y2:ke*ue+ve*ae,x3:se*ae-be*ue,y3:se*ue+be*ae,x4:z*Math.cos(G),y4:z*Math.sin(G)}},$=function(z){return 180*z/Math.PI},ee=function(z,q,G,U,Q,K){var re=z+.5*(G-z),H=q+.5*(U-q),ie=Q+.5*(G-Q),de=K+.5*(U-K),le=Math.min(z,Q,re,ie),ke=Math.max(z,Q,re,ie),ve=Math.min(q,K,H,de),se=Math.max(q,K,H,de);return new l(le,ve,ke-le,se-ve)},V=function(z,q,G,U,Q,K,re,H){var ie,de,le,ke,ve,se,be,De,ae,ue,Me,Se,Pe,Ee,Ae=G-z,Ye=U-q,rt=Q-G,He=K-U,xt=re-Q,st=H-K;for(de=0;de<41;de++)ae=(be=(le=z+(ie=de/40)*Ae)+ie*((ve=G+ie*rt)-le))+ie*(ve+ie*(Q+ie*xt-ve)-be),ue=(De=(ke=q+ie*Ye)+ie*((se=U+ie*He)-ke))+ie*(se+ie*(K+ie*st-se)-De),de==0?(Me=ae,Se=ue,Pe=ae,Ee=ue):(Me=Math.min(Me,ae),Se=Math.min(Se,ue),Pe=Math.max(Pe,ae),Ee=Math.max(Ee,ue));return new l(Math.round(Me),Math.round(Se),Math.round(Pe-Me),Math.round(Ee-Se))},D=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var z,q,G=(z=this.ctx.lineDash,q=this.ctx.lineDashOffset,JSON.stringify({lineDash:z,lineDashOffset:q}));this.prevLineDash!==G&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=G)}}})(fr.API),(function(e){var t=function(s){var l,c,u,d,f,h,p,v,m,b;for(c=[],u=0,d=(s+=l="\0\0\0\0".slice(s.length%4||4)).length;d>u;u+=4)(f=(s.charCodeAt(u)<<24)+(s.charCodeAt(u+1)<<16)+(s.charCodeAt(u+2)<<8)+s.charCodeAt(u+3))!==0?(h=(f=((f=((f=((f=(f-(b=f%85))/85)-(m=f%85))/85)-(v=f%85))/85)-(p=f%85))/85)%85,c.push(h+33,p+33,v+33,m+33,b+33)):c.push(122);return(function(x,w){for(var k=w;k>0;k--)x.pop()})(c,l.length),String.fromCharCode.apply(String,c)+"~>"},r=function(s){var l,c,u,d,f,h=String,p="length",v=255,m="charCodeAt",b="slice",x="replace";for(s[b](-2),s=s[b](0,-2)[x](/\s/g,"")[x]("z","!!!!!"),u=[],d=0,f=(s+=l="uuuuu"[b](s[p]%5||5))[p];f>d;d+=5)c=52200625*(s[m](d)-33)+614125*(s[m](d+1)-33)+7225*(s[m](d+2)-33)+85*(s[m](d+3)-33)+(s[m](d+4)-33),u.push(v&c>>24,v&c>>16,v&c>>8,v&c);return(function(w,k){for(var j=k;j>0;j--)w.pop()})(u,l[p]),h.fromCharCode.apply(h,u)},n=function(s){return s.split("").map(function(l){return("0"+l.charCodeAt().toString(16)).slice(-2)}).join("")+">"},o=function(s){var l=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((s=s.replace(/\s/g,"")).indexOf(">")!==-1&&(s=s.substr(0,s.indexOf(">"))),s.length%2&&(s+="0"),l.test(s)===!1)return"";for(var c="",u=0;u<s.length;u+=2)c+=String.fromCharCode("0x"+(s[u]+s[u+1]));return c},a=function(s){for(var l=new Uint8Array(s.length),c=s.length;c--;)l[c]=s.charCodeAt(c);return(l=V6(l)).reduce(function(u,d){return u+String.fromCharCode(d)},"")};e.processDataByFilters=function(s,l){var c=0,u=s||"",d=[];for(typeof(l=l||[])=="string"&&(l=[l]),c=0;c<l.length;c+=1)switch(l[c]){case"ASCII85Decode":case"/ASCII85Decode":u=r(u),d.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":u=t(u),d.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":u=o(u),d.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":u=n(u),d.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":u=a(u),d.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[c]+'" is not implemented')}return{data:u,reverseChain:d.reverse().join(" ")}}})(fr.API),(function(e){e.loadFile=function(t,r,n){return(function(o,a,s){a=a!==!1,s=typeof s=="function"?s:function(){};var l=void 0;try{l=(function(c,u,d){var f=new XMLHttpRequest,h=0,p=function(v){var m=v.length,b=[],x=String.fromCharCode;for(h=0;h<m;h+=1)b.push(x(255&v.charCodeAt(h)));return b.join("")};if(f.open("GET",c,!u),f.overrideMimeType("text/plain; charset=x-user-defined"),u===!1&&(f.onload=function(){f.status===200?d(p(this.responseText)):d(void 0)}),f.send(null),u&&f.status===200)return p(f.responseText)})(o,a,s)}catch{}return l})(t,r,n)},e.allowFsRead=void 0,e.loadImageFile=e.loadFile})(fr.API),(function(e){function t(){return(Er.html2canvas?Promise.resolve(Er.html2canvas):$E(()=>import("./html2canvas.esm-QH1iLAAe.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load html2canvas: "+l))}).then(function(l){return l.default?l.default:l})}function r(){return(Er.DOMPurify?Promise.resolve(Er.DOMPurify):$E(()=>import("./purify.es-B5CD4DQe.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load dompurify: "+l))}).then(function(l){return l.default?l.default:l})}var n=function(l){var c=On(l);return c==="undefined"?"undefined":c==="string"||l instanceof String?"string":c==="number"||l instanceof Number?"number":c==="function"||l instanceof Function?"function":l&&l.constructor===Array?"array":l&&l.nodeType===1?"element":c==="object"?"object":"unknown"},o=function(l,c){var u=document.createElement(l);for(var d in c.className&&(u.className=c.className),c.innerHTML&&c.dompurify&&(u.innerHTML=c.dompurify.sanitize(c.innerHTML)),c.style)u.style[d]=c.style[d];return u},a=function l(c,u){for(var d=c.nodeType===3?document.createTextNode(c.nodeValue):c.cloneNode(!1),f=c.firstChild;f;f=f.nextSibling)u!==!0&&f.nodeType===1&&f.nodeName==="SCRIPT"||d.appendChild(l(f,u));return c.nodeType===1&&(c.nodeName==="CANVAS"?(d.width=c.width,d.height=c.height,d.getContext("2d").drawImage(c,0,0)):c.nodeName!=="TEXTAREA"&&c.nodeName!=="SELECT"||(d.value=c.value),d.addEventListener("load",function(){d.scrollTop=c.scrollTop,d.scrollLeft=c.scrollLeft},!0)),d},s=function l(c){var u=Object.assign(l.convert(Promise.resolve()),JSON.parse(JSON.stringify(l.template))),d=l.convert(Promise.resolve(),u);return(d=d.setProgress(1,l,1,[l])).set(c)};(s.prototype=Object.create(Promise.prototype)).constructor=s,s.convert=function(l,c){return l.__proto__=c||s.prototype,l},s.template={prop:{src:null,container:null,overlay:null,canvas:null,img:null,pdf:null,pageSize:null,callback:function(){}},progress:{val:0,state:null,n:0,stack:[]},opt:{filename:"file.pdf",margin:[0,0,0,0],enableLinks:!0,x:0,y:0,html2canvas:{},jsPDF:{},backgroundColor:"transparent"}},s.prototype.from=function(l,c){return this.then(function(){switch(c=c||(function(u){switch(n(u)){case"string":return"string";case"element":return u.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}})(l),c){case"string":return this.then(r).then(function(u){return this.set({src:o("div",{innerHTML:l,dompurify:u})})});case"element":return this.set({src:l});case"canvas":return this.set({canvas:l});case"img":return this.set({img:l});default:return this.error("Unknown source type.")}})},s.prototype.to=function(l){switch(l){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},s.prototype.toContainer=function(){return this.thenList([function(){return this.prop.src||this.error("Cannot duplicate - no source HTML.")},function(){return this.prop.pageSize||this.setPageSize()}]).then(function(){var l={position:"relative",display:"inline-block",width:(typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?Math.max(this.prop.src.clientWidth,this.prop.src.scrollWidth,this.prop.src.offsetWidth):this.opt.windowWidth)+"px",left:0,right:0,top:0,margin:"auto",backgroundColor:this.opt.backgroundColor},c=a(this.prop.src,this.opt.html2canvas.javascriptEnabled);c.tagName==="BODY"&&(l.height=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)+"px"),this.prop.overlay=o("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=o("div",{className:"html2pdf__container",style:l}),this.prop.container.appendChild(c),this.prop.container.firstChild.appendChild(o("div",{style:{clear:"both",border:"0 none transparent",margin:0,padding:0,height:0}})),this.prop.container.style.float="none",this.prop.overlay.appendChild(this.prop.container),document.body.appendChild(this.prop.overlay),this.prop.container.firstChild.style.position="relative",this.prop.container.height=Math.max(this.prop.container.firstChild.clientHeight,this.prop.container.firstChild.scrollHeight,this.prop.container.firstChild.offsetHeight)+"px"})},s.prototype.toCanvas=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(c){var u=Object.assign({},this.opt.html2canvas);return delete u.onrendered,c(this.prop.container,u)}).then(function(c){(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},s.prototype.toContext2d=function(){var l=[function(){return document.body.contains(this.prop.container)||this.toContainer()}];return this.thenList(l).then(t).then(function(c){var u=this.opt.jsPDF,d=this.opt.fontFaces,f=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,h=Object.assign({async:!0,allowTaint:!0,scale:f,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete h.onrendered,u.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,u.context2d.posX=this.opt.x,u.context2d.posY=this.opt.y,u.context2d.margin=this.opt.margin,u.context2d.fontFaces=d,d)for(var p=0;p<d.length;++p){var v=d[p],m=v.src.find(function(b){return b.format==="truetype"});m&&u.addFont(m.url,v.ref.name,v.ref.style)}return h.windowHeight=h.windowHeight||0,h.windowHeight=h.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):h.windowHeight,u.context2d.save(!0),c(this.prop.container,h)}).then(function(c){this.opt.jsPDF.context2d.restore(!0),(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},s.prototype.toImg=function(){return this.thenList([function(){return this.prop.canvas||this.toCanvas()}]).then(function(){var l=this.prop.canvas.toDataURL("image/"+this.opt.image.type,this.opt.image.quality);this.prop.img=document.createElement("img"),this.prop.img.src=l})},s.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},s.prototype.output=function(l,c,u){return(u=u||"pdf").toLowerCase()==="img"||u.toLowerCase()==="image"?this.outputImg(l,c):this.outputPdf(l,c)},s.prototype.outputPdf=function(l,c){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(l,c)})},s.prototype.outputImg=function(l){return this.thenList([function(){return this.prop.img||this.toImg()}]).then(function(){switch(l){case void 0:case"img":return this.prop.img;case"datauristring":case"dataurlstring":return this.prop.img.src;case"datauri":case"dataurl":return document.location.href=this.prop.img.src;default:throw'Image output type "'+l+'" is not supported.'}})},s.prototype.save=function(l){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).set(l?{filename:l}:null).then(function(){this.prop.pdf.save(this.opt.filename)})},s.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},s.prototype.set=function(l){if(n(l)!=="object")return this;var c=Object.keys(l||{}).map(function(u){if(u in s.template.prop)return function(){this.prop[u]=l[u]};switch(u){case"margin":return this.setMargin.bind(this,l.margin);case"jsPDF":return function(){return this.opt.jsPDF=l.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,l.pageSize);default:return function(){this.opt[u]=l[u]}}},this);return this.then(function(){return this.thenList(c)})},s.prototype.get=function(l,c){return this.then(function(){var u=l in s.template.prop?this.prop[l]:this.opt[l];return c?c(u):u})},s.prototype.setMargin=function(l){return this.then(function(){switch(n(l)){case"number":l=[l,l,l,l];case"array":if(l.length===2&&(l=[l[0],l[1],l[0],l[1]]),l.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=l}).then(this.setPageSize)},s.prototype.setPageSize=function(l){function c(u,d){return Math.floor(u*d/72*96)}return this.then(function(){(l=l||fr.getPageSize(this.opt.jsPDF)).hasOwnProperty("inner")||(l.inner={width:l.width-this.opt.margin[1]-this.opt.margin[3],height:l.height-this.opt.margin[0]-this.opt.margin[2]},l.inner.px={width:c(l.inner.width,l.k),height:c(l.inner.height,l.k)},l.inner.ratio=l.inner.height/l.inner.width),this.prop.pageSize=l})},s.prototype.setProgress=function(l,c,u,d){return l!=null&&(this.progress.val=l),c!=null&&(this.progress.state=c),u!=null&&(this.progress.n=u),d!=null&&(this.progress.stack=d),this.progress.ratio=this.progress.val/this.progress.state,this},s.prototype.updateProgress=function(l,c,u,d){return this.setProgress(l?this.progress.val+l:null,c||null,u?this.progress.n+u:null,d?this.progress.stack.concat(d):null)},s.prototype.then=function(l,c){var u=this;return this.thenCore(l,c,function(d,f){return u.updateProgress(null,null,1,[d]),Promise.prototype.then.call(this,function(h){return u.updateProgress(null,d),h}).then(d,f).then(function(h){return u.updateProgress(1),h})})},s.prototype.thenCore=function(l,c,u){u=u||Promise.prototype.then;var d=this;l&&(l=l.bind(d)),c&&(c=c.bind(d));var f=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?d:s.convert(Object.assign({},d),Promise.prototype),h=u.call(f,l,c);return s.convert(h,d.__proto__)},s.prototype.thenExternal=function(l,c){return Promise.prototype.then.call(this,l,c)},s.prototype.thenList=function(l){var c=this;return l.forEach(function(u){c=c.thenCore(u)}),c},s.prototype.catch=function(l){l&&(l=l.bind(this));var c=Promise.prototype.catch.call(this,l);return s.convert(c,this)},s.prototype.catchExternal=function(l){return Promise.prototype.catch.call(this,l)},s.prototype.error=function(l){return this.then(function(){throw new Error(l)})},s.prototype.using=s.prototype.set,s.prototype.saveAs=s.prototype.save,s.prototype.export=s.prototype.output,s.prototype.run=s.prototype.then,fr.getPageSize=function(l,c,u){if(On(l)==="object"){var d=l;l=d.orientation,c=d.unit||c,u=d.format||u}c=c||"mm",u=u||"a4",l=(""+(l||"P")).toLowerCase();var f,h=(""+u).toLowerCase(),p={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(c){case"pt":f=1;break;case"mm":f=72/25.4;break;case"cm":f=72/2.54;break;case"in":f=72;break;case"px":f=.75;break;case"pc":case"em":f=12;break;case"ex":f=6;break;default:throw"Invalid unit: "+c}var v,m=0,b=0;if(p.hasOwnProperty(h))m=p[h][1]/f,b=p[h][0]/f;else try{m=u[1],b=u[0]}catch{throw new Error("Invalid format: "+u)}if(l==="p"||l==="portrait")l="p",b>m&&(v=b,b=m,m=v);else{if(l!=="l"&&l!=="landscape")throw"Invalid orientation: "+l;l="l",m>b&&(v=b,b=m,m=v)}return{width:b,height:m,unit:c,k:f,orientation:l}},e.html=function(l,c){(c=c||{}).callback=c.callback||function(){},c.html2canvas=c.html2canvas||{},c.html2canvas.canvas=c.html2canvas.canvas||this.canvas,c.jsPDF=c.jsPDF||this,c.fontFaces=c.fontFaces?c.fontFaces.map(s3):null;var u=new s(c);return c.worker?u:u.from(l).doCallback()}})(fr.API),fr.API.addJS=function(e){var t,r,n=(function(o){for(var a="",s=0;s<o.length;s++){var l=o[s];if(l==="("||l===")"){for(var c=0,u=s-1;u>=0&&o[u]==="\\";u--)c++;a+=c%2==0?"\\"+l:l}else a+=l}return a})(e);return this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(t+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),r=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+n+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){t!==void 0&&r!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},(function(e){var t;e.events.push(["postPutResources",function(){var r=this,n=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var o=r.outline.render().split(/\r\n/),a=0;a<o.length;a++){var s=o[a],l=n.exec(s);if(l!=null){var c=l[1];r.internal.newObjectDeferredBegin(c,!1)}r.internal.write(s)}if(this.outline.createNamedDestinations){var u=this.internal.pages.length,d=[];for(a=0;a<u;a++){var f=r.internal.newObject();d.push(f);var h=r.internal.getPageInfo(a+1);r.internal.write("<< /D["+h.objId+" 0 R /XYZ null null null]>> endobj")}var p=r.internal.newObject();for(r.internal.write("<< /Names [ "),a=0;a<d.length;a++)r.internal.write("(page_"+(a+1)+")"+d[a]+" 0 R");r.internal.write(" ] >>","endobj"),t=r.internal.newObject(),r.internal.write("<< /Dests "+p+" 0 R"),r.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var r=this;r.outline.root.children.length>0&&(r.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&r.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var r=this;r.outline={createNamedDestinations:!1,root:{children:[]}},r.outline.add=function(n,o,a){var s={title:o,options:a,children:[]};return n==null&&(n=this.root),n.children.push(s),s},r.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=r,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},r.outline.genIds_r=function(n){n.id=r.internal.newObjectDeferred();for(var o=0;o<n.children.length;o++)this.genIds_r(n.children[o])},r.outline.renderRoot=function(n){this.objStart(n),this.line("/Type /Outlines"),n.children.length>0&&(this.line("/First "+this.makeRef(n.children[0])),this.line("/Last "+this.makeRef(n.children[n.children.length-1]))),this.line("/Count "+this.count_r({count:0},n)),this.objEnd()},r.outline.renderItems=function(n){for(var o=this.ctx.pdf.internal.getVerticalCoordinateString,a=0;a<n.children.length;a++){var s=n.children[a];this.objStart(s),this.line("/Title "+this.makeString(s.title)),this.line("/Parent "+this.makeRef(n)),a>0&&this.line("/Prev "+this.makeRef(n.children[a-1])),a<n.children.length-1&&this.line("/Next "+this.makeRef(n.children[a+1])),s.children.length>0&&(this.line("/First "+this.makeRef(s.children[0])),this.line("/Last "+this.makeRef(s.children[s.children.length-1])));var l=this.count=this.count_r({count:0},s);if(l>0&&this.line("/Count "+l),s.options&&s.options.pageNumber){var c=r.internal.getPageInfo(s.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+o(0)+" 0]")}this.objEnd()}for(var u=0;u<n.children.length;u++)this.renderItems(n.children[u])},r.outline.line=function(n){this.ctx.val+=n+`\r
`},r.outline.makeRef=function(n){return n.id+" 0 R"},r.outline.makeString=function(n){return"("+r.internal.pdfEscape(n)+")"},r.outline.objStart=function(n){this.ctx.val+=`\r
`+n.id+` 0 obj\r
<<\r
`},r.outline.objEnd=function(){this.ctx.val+=`>> \r
endobj\r
`},r.outline.count_r=function(n,o){for(var a=0;a<o.children.length;a++)n.count++,this.count_r(n,o.children[a]);return n.count}}])})(fr.API),(function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(r,n,o,a,s,l){var c,u=this.decode.DCT_DECODE,d=null;if(typeof r=="string"||this.__addimage__.isArrayBuffer(r)||this.__addimage__.isArrayBufferView(r)){switch(r=s||r,r=this.__addimage__.isArrayBuffer(r)?new Uint8Array(r):r,c=(function(f){for(var h,p=256*f.charCodeAt(4)+f.charCodeAt(5),v=f.length,m={width:0,height:0,numcomponents:1},b=4;b<v;b+=2){if(b+=p,t.indexOf(f.charCodeAt(b+1))!==-1){h=256*f.charCodeAt(b+5)+f.charCodeAt(b+6),m={width:256*f.charCodeAt(b+7)+f.charCodeAt(b+8),height:h,numcomponents:f.charCodeAt(b+9)};break}p=256*f.charCodeAt(b+2)+f.charCodeAt(b+3)}return m})(r=this.__addimage__.isArrayBufferView(r)?this.__addimage__.arrayBufferToBinaryString(r):r),c.numcomponents){case 1:l=this.color_spaces.DEVICE_GRAY;break;case 4:l=this.color_spaces.DEVICE_CMYK;break;case 3:l=this.color_spaces.DEVICE_RGB}d={data:r,width:c.width,height:c.height,colorSpace:l,bitsPerComponent:8,filter:u,index:n,alias:o}}return d}})(fr.API),fr.API.processPNG=function(e,t,r,n){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var o,a=$Ne(e,{checkCrc:!0}),s=a.width,l=a.height,c=a.channels,u=a.palette,d=a.depth;o=u&&c===1?(function(P){for(var N=P.width,O=P.height,C=P.data,I=P.palette,R=P.depth,F=!1,M=[],Y=[],X=void 0,$=!1,ee=0,V=0;V<I.length;V++){var D=vW(I[V],4),z=D[0],q=D[1],G=D[2],U=D[3];M.push(z,q,G),U!=null&&(U===0?(ee++,Y.length<1&&Y.push(V)):U<255&&($=!0))}if($||ee>1){F=!0,Y=void 0;var Q=N*O;X=new Uint8Array(Q);for(var K=new DataView(C.buffer),re=0;re<Q;re++){var H=c3(K,re,R),ie=vW(I[H],4)[3];X[re]=ie}}else ee===0&&(Y=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:F?8:void 0,colorBytes:C,alphaBytes:X,needSMask:F,palette:M,mask:Y}})(a):c===2||c===4?(function(P){for(var N=P.data,O=P.width,C=P.height,I=P.channels,R=P.depth,F=I===2?"DeviceGray":"DeviceRGB",M=I-1,Y=O*C,X=M,$=Y*X,ee=1*Y,V=Math.ceil($*R/8),D=Math.ceil(ee*R/8),z=new Uint8Array(V),q=new Uint8Array(D),G=new DataView(N.buffer),U=new DataView(z.buffer),Q=new DataView(q.buffer),K=!1,re=0;re<Y;re++){for(var H=re*I,ie=0;ie<X;ie++)bq(U,c3(G,H+ie,R),re*X+ie,R);var de=c3(G,H+X,R);de<(1<<R)-1&&(K=!0),bq(Q,de,1*re,R)}return{colorSpace:F,colorsPerPixel:M,sMaskBitsPerComponent:K?R:void 0,colorBytes:z,alphaBytes:q,needSMask:K}})(a):(function(P){var N=P.data,O=P.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:O,colorsPerPixel:O==="DeviceGray"?1:3,colorBytes:N instanceof Uint16Array?(function(C){for(var I=C.length,R=new Uint8Array(2*I),F=new DataView(R.buffer,R.byteOffset,R.byteLength),M=0;M<I;M++)F.setUint16(2*M,C[M],!1);return R})(N):N,needSMask:!1}})(a);var f,h,p,v=o,m=v.colorSpace,b=v.colorsPerPixel,x=v.sMaskBitsPerComponent,w=v.colorBytes,k=v.alphaBytes,j=v.needSMask,_=v.palette,T=v.mask,A=null;return n!==fr.API.image_compression.NONE&&typeof V6=="function"?(A=(function(P){var N;switch(P){case fr.API.image_compression.FAST:N=11;break;case fr.API.image_compression.MEDIUM:N=13;break;case fr.API.image_compression.SLOW:N=14;break;default:N=12}return N})(n),f=this.decode.FLATE_DECODE,h="/Predictor ".concat(A," /Colors ").concat(b," /BitsPerComponent ").concat(d," /Columns ").concat(s),e=gq(w,Math.ceil(s*b*d/8),b,d,n),j&&(p=gq(k,Math.ceil(s*x/8),1,x,n))):(f=void 0,h=void 0,e=w,j&&(p=k)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(p&&this.__addimage__.isArrayBuffer(p)||this.__addimage__.isArrayBufferView(p))&&(p=this.__addimage__.arrayBufferToBinaryString(p)),{alias:r,data:e,index:t,filter:f,decodeParameters:h,transparency:T,palette:_,sMask:p,predictor:A,width:s,height:l,bitsPerComponent:d,sMaskBitsPerComponent:x,colorSpace:m}}},(function(e){e.processGIF89A=function(t,r,n,o){var a=new uRe(t),s=a.width,l=a.height,c=[];a.decodeAndBlitFrameRGBA(0,c);var u={data:c,width:s,height:l},d=new u3(100).encode(u,100);return e.processJPEG.call(this,d,r,n,o)},e.processGIF87A=e.processGIF89A})(fr.API),tc.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var r=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:o,green:n,blue:r,quad:a}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},tc.prototype.parseBGR=function(){this.pos=this.offset;var e="bit"+this.bitPP,t=this.width*this.height*4;if(t>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");this.data=new Uint8Array(t);try{this[e]()}catch(r){Bn.log("bit decode error:"+r)}},tc.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),r=t%4;for(e=this.height-1;e>=0;e--){for(var n=this.bottom_up?e:this.height-1-e,o=0;o<t;o++)for(var a=this.datav.getUint8(this.pos++,!0),s=n*this.width*4+8*o*4,l=0;l<8&&8*o+l<this.width;l++){var c=this.palette[a>>7-l&1];this.data[s+4*l]=c.blue,this.data[s+4*l+1]=c.green,this.data[s+4*l+2]=c.red,this.data[s+4*l+3]=255}r!==0&&(this.pos+=4-r)}},tc.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,o=0;o<e;o++){var a=this.datav.getUint8(this.pos++,!0),s=n*this.width*4+2*o*4,l=a>>4,c=15&a,u=this.palette[l];if(this.data[s]=u.blue,this.data[s+1]=u.green,this.data[s+2]=u.red,this.data[s+3]=255,2*o+1>=this.width)break;u=this.palette[c],this.data[s+4]=u.blue,this.data[s+4+1]=u.green,this.data[s+4+2]=u.red,this.data[s+4+3]=255}t!==0&&(this.pos+=4-t)}},tc.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var r=this.bottom_up?t:this.height-1-t,n=0;n<this.width;n++){var o=this.datav.getUint8(this.pos++,!0),a=r*this.width*4+4*n;if(o<this.palette.length){var s=this.palette[o];this.data[a]=s.red,this.data[a+1]=s.green,this.data[a+2]=s.blue,this.data[a+3]=255}else this.data[a]=255,this.data[a+1]=255,this.data[a+2]=255,this.data[a+3]=255}e!==0&&(this.pos+=4-e)}},tc.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,o=0;o<this.width;o++){var a=this.datav.getUint16(this.pos,!0);this.pos+=2;var s=(a&t)/t*255|0,l=(a>>5&t)/t*255|0,c=(a>>10&t)/t*255|0,u=a>>15?255:0,d=n*this.width*4+4*o;this.data[d]=c,this.data[d+1]=l,this.data[d+2]=s,this.data[d+3]=u}this.pos+=e}},tc.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),r=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var o=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var s=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(s&t)/t*255|0,c=(s>>5&r)/r*255|0,u=(s>>11)/t*255|0,d=o*this.width*4+4*a;this.data[d]=u,this.data[d+1]=c,this.data[d+2]=l,this.data[d+3]=255}this.pos+=e}},tc.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),s=t*this.width*4+4*r;this.data[s]=a,this.data[s+1]=o,this.data[s+2]=n,this.data[s+3]=255}this.pos+=this.width%4}},tc.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*r;this.data[l]=a,this.data[l+1]=o,this.data[l+2]=n,this.data[l+3]=s}},tc.prototype.getData=function(){return this.data},(function(e){e.processBMP=function(t,r,n,o){var a=new tc(t,!1),s=a.width,l=a.height,c={data:a.getData(),width:s,height:l},u=new u3(100).encode(c,100);return e.processJPEG.call(this,u,r,n,o)}})(fr.API),Sq.prototype.getData=function(){return this.data},(function(e){e.processWEBP=function(t,r,n,o){var a=new Sq(t),s=a.width,l=a.height,c={data:a.getData(),width:s,height:l},u=new u3(100).encode(c,100);return e.processJPEG.call(this,u,r,n,o)}})(fr.API),fr.API.processRGBA=function(e,t,r){for(var n=e.data,o=n.length,a=new Uint8Array(o/4*3),s=new Uint8Array(o/4),l=0,c=0,u=0;u<o;u+=4){var d=n[u],f=n[u+1],h=n[u+2],p=n[u+3];a[l++]=d,a[l++]=f,a[l++]=h,s[c++]=p}var v=this.__addimage__.arrayBufferToBinaryString(a);return{alpha:this.__addimage__.arrayBufferToBinaryString(s),data:v,index:t,alias:r,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},fr.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},Gg=fr.API,O1=Gg.getCharWidthsArray=function(e,t){var r,n,o=(t=t||{}).font||this.internal.getFont(),a=t.fontSize||this.internal.getFontSize(),s=t.charSpace||this.internal.getCharSpace(),l=t.widths?t.widths:o.metadata.Unicode.widths,c=l.fof?l.fof:1,u=t.kerning?t.kerning:o.metadata.Unicode.kerning,d=u.fof?u.fof:1,f=t.doKerning!==!1,h=0,p=e.length,v=0,m=l[0]||c,b=[];for(r=0;r<p;r++)n=e.charCodeAt(r),typeof o.metadata.widthOfString=="function"?b.push((o.metadata.widthOfGlyph(o.metadata.characterToGlyph(n))+s*(1e3/a)||0)/1e3):(h=f&&On(u[n])==="object"&&!isNaN(parseInt(u[n][v],10))?u[n][v]/d:0,b.push((l[n]||m)/c+h)),v=n;return b},fq=Gg.getStringUnitWidth=function(e,t){var r=(t=t||{}).fontSize||this.internal.getFontSize(),n=t.font||this.internal.getFont(),o=t.charSpace||this.internal.getCharSpace();return Gg.processArabic&&(e=Gg.processArabic(e)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(e,r,o)/r:O1.apply(this,arguments).reduce(function(a,s){return a+s},0)},pq=function(e,t,r,n){for(var o=[],a=0,s=e.length,l=0;a!==s&&l+t[a]<r;)l+=t[a],a++;o.push(e.slice(0,a));var c=a;for(l=0;a!==s;)l+t[a]>n&&(o.push(e.slice(c,a)),l=0,c=a),l+=t[a],a++;return c!==a&&o.push(e.slice(c,a)),o},hq=function(e,t,r){r||(r={});var n,o,a,s,l,c,u,d=[],f=[d],h=r.textIndent||0,p=0,v=0,m=e.split(" "),b=O1.apply(this,[" ",r])[0];if(c=r.lineIndent===-1?m[0].length+2:r.lineIndent||0){var x=Array(c).join(" "),w=[];m.map(function(j){(j=j.split(/\s*\n/)).length>1?w=w.concat(j.map(function(_,T){return(T&&_.length?`
`:"")+_})):w.push(j[0])}),m=w,c=fq.apply(this,[x,r])}for(a=0,s=m.length;a<s;a++){var k=0;if(n=m[a],c&&n[0]==`
`&&(n=n.substr(1),k=1),h+p+(v=(o=O1.apply(this,[n,r])).reduce(function(j,_){return j+_},0))>t||k){if(v>t){for(l=pq.apply(this,[n,o,t-(h+p),t]),d.push(l.shift()),d=[l.pop()];l.length;)f.push([l.shift()]);v=o.slice(n.length-(d[0]?d[0].length:0)).reduce(function(j,_){return j+_},0)}else d=[n];f.push(d),h=v+c,p=b}else d.push(n),h+=p+v,p=b}return u=c?function(j,_){return(_?x:"")+j.join(" ")}:function(j){return j.join(" ")},f.map(u)},Gg.splitTextToSize=function(e,t,r){var n,o=(r=r||{}).fontSize||this.internal.getFontSize(),a=(function(d){if(d.widths&&d.kerning)return{widths:d.widths,kerning:d.kerning};var f=this.internal.getFont(d.fontName,d.fontStyle),h="Unicode";return f.metadata[h]?{widths:f.metadata[h].widths||{0:1},kerning:f.metadata[h].kerning||{}}:{font:f.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);n=Array.isArray(e)?e:String(e).split(/\r?\n/);var s=1*this.internal.scaleFactor*t/o;a.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/o:0,a.lineIndent=r.lineIndent;var l,c,u=[];for(l=0,c=n.length;l<c;l++)u=u.concat(hq.apply(this,[n[l],s,a]));return u},(function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",r="klmnopqrstuvwxyz",n={},o={},a=0;a<16;a++)n[r[a]]=t[a],o[t[a]]=r[a];var s=function(h){return"0x"+parseInt(h,10).toString(16)},l=e.__fontmetrics__.compress=function(h){var p,v,m,b,x=["{"];for(var w in h){if(p=h[w],isNaN(parseInt(w,10))?v="'"+w+"'":(w=parseInt(w,10),v=(v=s(w).slice(2)).slice(0,-1)+o[v.slice(-1)]),typeof p=="number")p<0?(m=s(p).slice(3),b="-"):(m=s(p).slice(2),b=""),m=b+m.slice(0,-1)+o[m.slice(-1)];else{if(On(p)!=="object")throw new Error("Don't know what to do with value type "+On(p)+".");m=l(p)}x.push(v+m)}return x.push("}"),x.join("")},c=e.__fontmetrics__.uncompress=function(h){if(typeof h!="string")throw new Error("Invalid argument passed to uncompress.");for(var p,v,m,b,x={},w=1,k=x,j=[],_="",T="",A=h.length-1,P=1;P<A;P+=1)(b=h[P])=="'"?p?(m=p.join(""),p=void 0):p=[]:p?p.push(b):b=="{"?(j.push([k,m]),k={},m=void 0):b=="}"?((v=j.pop())[0][v[1]]=k,m=void 0,k=v[0]):b=="-"?w=-1:m===void 0?n.hasOwnProperty(b)?(_+=n[b],m=parseInt(_,16)*w,w=1,_=""):_+=b:n.hasOwnProperty(b)?(T+=n[b],k[m]=parseInt(T,16)*w,w=1,m=void 0,T=""):T+=b;return x},u={codePages:["WinAnsiEncoding"],WinAnsiEncoding:c("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},d={Unicode:{Courier:u,"Courier-Bold":u,"Courier-BoldOblique":u,"Courier-Oblique":u,Helvetica:u,"Helvetica-Bold":u,"Helvetica-BoldOblique":u,"Helvetica-Oblique":u,"Times-Roman":u,"Times-Bold":u,"Times-BoldItalic":u,"Times-Italic":u}},f={Unicode:{"Courier-Oblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":c("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":c("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:c("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:c("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":c("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":c("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(h){var p=h.font,v=f.Unicode[p.postScriptName];v&&(p.metadata.Unicode={},p.metadata.Unicode.widths=v.widths,p.metadata.Unicode.kerning=v.kerning);var m=d.Unicode[p.postScriptName];m&&(p.metadata.Unicode.encoding=m,p.encoding=m.codePages[0])}])})(fr.API),(function(e){var t=function(r){for(var n=r.length,o=new Uint8Array(n),a=0;a<n;a++)o[a]=r.charCodeAt(a);return o};e.API.events.push(["addFont",function(r){var n=void 0,o=r.font,a=r.instance;if(!o.isStandardFont){if(a===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+o.postScriptName+"').");if(typeof(n=a.existsFileInVFS(o.postScriptName)===!1?a.loadFile(o.postScriptName):a.getFileFromVFS(o.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+o.postScriptName+"').");(function(s,l){l=/^\x00\x01\x00\x00/.test(l)?t(l):t(Y1(l)),s.metadata=e.API.TTFFont.open(l),s.metadata.Unicode=s.metadata.Unicode||{encoding:{},kerning:{},widths:[]},s.metadata.glyIdsUsed=[0]})(o,n)}}])})(fr),fr.API.addSvgAsImage=function(e,t,r,n,o,a,s,l){if(isNaN(t)||isNaN(r))throw Bn.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(o))throw Bn.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=n,c.height=o;var u=c.getContext("2d");u.fillStyle="#fff",u.fillRect(0,0,c.width,c.height);var d={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},f=this;return(Er.canvg?Promise.resolve(Er.canvg):$E(()=>import("./index.es-D7LZE7Yc.js"),[])).catch(function(h){return Promise.reject(new Error("Could not load canvg: "+h))}).then(function(h){return h.default?h.default:h}).then(function(h){return h.fromString(u,e,d)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(h){return h.render(d)}).then(function(){f.addImage(c.toDataURL("image/jpeg",1),t,r,n,o,s,l)})},fr.API.putTotalPages=function(e){var t,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),r=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var o=0;o<this.internal.pages[n].length;o++)this.internal.pages[n][o]=this.internal.pages[n][o].replace(t,r);return this},fr.API.viewerPreferences=function(e,t){var r;e=e||{},t=t||!1;var n,o,a,s={HideToolbar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideMenubar:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},HideWindowUI:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},FitWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},CenterWindow:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.3},DisplayDocTitle:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.4},NonFullScreenPageMode:{defaultValue:"UseNone",value:"UseNone",type:"name",explicitSet:!1,valueSet:["UseNone","UseOutlines","UseThumbs","UseOC"],pdfVersion:1.3},Direction:{defaultValue:"L2R",value:"L2R",type:"name",explicitSet:!1,valueSet:["L2R","R2L"],pdfVersion:1.3},ViewArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},ViewClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintArea:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintClip:{defaultValue:"CropBox",value:"CropBox",type:"name",explicitSet:!1,valueSet:["MediaBox","CropBox","TrimBox","BleedBox","ArtBox"],pdfVersion:1.4},PrintScaling:{defaultValue:"AppDefault",value:"AppDefault",type:"name",explicitSet:!1,valueSet:["AppDefault","None"],pdfVersion:1.6},Duplex:{defaultValue:"",value:"none",type:"name",explicitSet:!1,valueSet:["Simplex","DuplexFlipShortEdge","DuplexFlipLongEdge","none"],pdfVersion:1.7},PickTrayByPDFSize:{defaultValue:!1,value:!1,type:"boolean",explicitSet:!1,valueSet:[!0,!1],pdfVersion:1.7},PrintPageRange:{defaultValue:"",value:"",type:"array",explicitSet:!1,valueSet:null,pdfVersion:1.7},NumCopies:{defaultValue:1,value:1,type:"integer",explicitSet:!1,valueSet:null,pdfVersion:1.7}},l=Object.keys(s),c=[],u=0,d=0,f=0;function h(v,m){var b,x=!1;for(b=0;b<v.length;b+=1)v[b]===m&&(x=!0);return x}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(s)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var p=l.length;for(f=0;f<p;f+=1)r[l[f]].value=r[l[f]].defaultValue,r[l[f]].explicitSet=!1}if(On(e)==="object"){for(o in e)if(a=e[o],h(l,o)&&a!==void 0){if(r[o].type==="boolean"&&typeof a=="boolean")r[o].value=a;else if(r[o].type==="name"&&h(r[o].valueSet,a))r[o].value=a;else if(r[o].type==="integer"&&Number.isInteger(a))r[o].value=a;else if(r[o].type==="array"){for(u=0;u<a.length;u+=1)if(n=!0,a[u].length===1&&typeof a[u][0]=="number")c.push(String(a[u]-1));else if(a[u].length>1){for(d=0;d<a[u].length;d+=1)typeof a[u][d]!="number"&&(n=!1);n===!0&&c.push([a[u][0]-1,a[u][1]-1].join(" "))}r[o].value="["+c.join(" ")+"]"}else r[o].value=r[o].defaultValue;r[o].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var v,m=[];for(v in r)r[v].explicitSet===!0&&(r[v].type==="name"?m.push("/"+v+" /"+r[v].value):m.push("/"+v+" "+r[v].value));m.length!==0&&this.internal.write(`/ViewerPreferences
<<
`+m.join(`
`)+`
>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=r,this},fr.API.addMetadata=function(e,t){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:e,namespaceUri:t??"http://jspdf.default.namespaceuri/",rawXml:typeof t=="boolean"&&t},this.internal.events.subscribe("putCatalog",fRe),this.internal.events.subscribe("postPutResources",dRe)),this},(function(e){var t=e.API,r=t.pdfEscape16=function(a,s){for(var l,c=s.metadata.Unicode.widths,u=["","0","00","000","0000"],d=[""],f=0,h=a.length;f<h;++f){if(l=s.metadata.characterToGlyph(a.charCodeAt(f)),s.metadata.glyIdsUsed.push(l),s.metadata.toUnicode[l]=a.charCodeAt(f),c.indexOf(l)==-1&&(c.push(l),c.push([parseInt(s.metadata.widthOfGlyph(l),10)])),l=="0")return d.join("");l=l.toString(16),d.push(u[4-l.length],l)}return d.join("")},n=function(a){var s,l,c,u,d,f,h;for(d=`/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo <<
/Registry (Adobe)
/Ordering (UCS)
/Supplement 0
>> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000><ffff>
endcodespacerange`,c=[],f=0,h=(l=Object.keys(a).sort(function(p,v){return p-v})).length;f<h;f++)s=l[f],c.length>=100&&(d+=`
`+c.length+` beginbfchar
`+c.join(`
`)+`
endbfchar`,c=[]),a[s]!==void 0&&a[s]!==null&&typeof a[s].toString=="function"&&(u=("0000"+a[s].toString(16)).slice(-4),s=("0000"+(+s).toString(16)).slice(-4),c.push("<"+s+"><"+u+">"));return c.length&&(d+=`
`+c.length+` beginbfchar
`+c.join(`
`)+`
endbfchar
`),d+`endcmap
CMapName currentdict /CMap defineresource pop
end
end`};t.events.push(["putFont",function(a){(function(s){var l=s.font,c=s.out,u=s.newObject,d=s.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="Identity-H"){for(var f=l.metadata.Unicode.widths,h=l.metadata.subset.encode(l.metadata.glyIdsUsed,1),p="",v=0;v<h.length;v++)p+=String.fromCharCode(h[v]);var m=u();d({data:p,addLength1:!0,objectId:m}),c("endobj");var b=u();d({data:n(l.metadata.toUnicode),addLength1:!0,objectId:b}),c("endobj");var x=u();c("<<"),c("/Type /FontDescriptor"),c("/FontName /"+Jg(l.fontName)),c("/FontFile2 "+m+" 0 R"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/Flags "+l.metadata.flags),c("/StemV "+l.metadata.stemV),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c(">>"),c("endobj");var w=u();c("<<"),c("/Type /Font"),c("/BaseFont /"+Jg(l.fontName)),c("/FontDescriptor "+x+" 0 R"),c("/W "+e.API.PDFObject.convert(f)),c("/CIDToGIDMap /Identity"),c("/DW 1000"),c("/Subtype /CIDFontType2"),c("/CIDSystemInfo"),c("<<"),c("/Supplement 0"),c("/Registry (Adobe)"),c("/Ordering ("+l.encoding+")"),c(">>"),c(">>"),c("endobj"),l.objectNumber=u(),c("<<"),c("/Type /Font"),c("/Subtype /Type0"),c("/ToUnicode "+b+" 0 R"),c("/BaseFont /"+Jg(l.fontName)),c("/Encoding /"+l.encoding),c("/DescendantFonts ["+w+" 0 R]"),c(">>"),c("endobj"),l.isAlreadyPutted=!0}})(a)}]),t.events.push(["putFont",function(a){(function(s){var l=s.font,c=s.out,u=s.newObject,d=s.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="WinAnsiEncoding"){for(var f=l.metadata.rawData,h="",p=0;p<f.length;p++)h+=String.fromCharCode(f[p]);var v=u();d({data:h,addLength1:!0,objectId:v}),c("endobj");var m=u();d({data:n(l.metadata.toUnicode),addLength1:!0,objectId:m}),c("endobj");var b=u();c("<<"),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c("/StemV "+l.metadata.stemV),c("/Type /FontDescriptor"),c("/FontFile2 "+v+" 0 R"),c("/Flags 96"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/FontName /"+Jg(l.fontName)),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c(">>"),c("endobj"),l.objectNumber=u();for(var x=0;x<l.metadata.hmtx.widths.length;x++)l.metadata.hmtx.widths[x]=parseInt(l.metadata.hmtx.widths[x]*(1e3/l.metadata.head.unitsPerEm));c("<</Subtype/TrueType/Type/Font/ToUnicode "+m+" 0 R/BaseFont/"+Jg(l.fontName)+"/FontDescriptor "+b+" 0 R/Encoding/"+l.encoding+" /FirstChar 29 /LastChar 255 /Widths "+e.API.PDFObject.convert(l.metadata.hmtx.widths)+">>"),c("endobj"),l.isAlreadyPutted=!0}})(a)}]);var o=function(a){var s,l=a.text||"",c=a.x,u=a.y,d=a.options||{},f=a.mutex||{},h=f.pdfEscape,p=f.activeFontKey,v=f.fonts,m=p,b="",x=0,w="",k=v[m].encoding;if(v[m].encoding!=="Identity-H")return{text:l,x:c,y:u,options:d,mutex:f};for(w=l,m=p,Array.isArray(l)&&(w=l[0]),x=0;x<w.length;x+=1)v[m].metadata.hasOwnProperty("cmap")&&(s=v[m].metadata.cmap.unicode.codeMap[w[x].charCodeAt(0)]),s||w[x].charCodeAt(0)<256&&v[m].metadata.hasOwnProperty("Unicode")?b+=w[x]:b+="";var j="";return parseInt(m.slice(1))<14||k==="WinAnsiEncoding"?j=h(b,m).split("").map(function(_){return _.charCodeAt(0).toString(16)}).join(""):k==="Identity-H"&&(j=r(b,v[m])),f.isHex=!0,{text:j,x:c,y:u,options:d,mutex:f}};t.events.push(["postProcessText",function(a){var s=a.text||"",l=[],c={text:s,x:a.x,y:a.y,options:a.options,mutex:a.mutex};if(Array.isArray(s)){var u=0;for(u=0;u<s.length;u+=1)Array.isArray(s[u])&&s[u].length===3?l.push([o(Object.assign({},c,{text:s[u][0]})).text,s[u][1],s[u][2]]):l.push(o(Object.assign({},c,{text:s[u]})).text);a.text=l}else a.text=o(Object.assign({},c,{text:s})).text}])})(fr),(function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0},e.addFileToVFS=function(r,n){return t.call(this),this.internal.vFS[r]=n,this},e.getFileFromVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0?this.internal.vFS[r]:null}})(fr.API),(function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(n){var o,a,s,l,c,u,d,f=t,h=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],p=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],v={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},m={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},b=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],x=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),w=!1,k=0;this.__bidiEngine__={};var j=function(C){var I=C.charCodeAt(),R=I>>8,F=m[R];return F!==void 0?f[256*F+(255&I)]:R===252||R===253?"AL":x.test(R)?"L":R===8?"R":"N"},_=function(C){for(var I,R=0;R<C.length;R++){if((I=j(C.charAt(R)))==="L")return!1;if(I==="R")return!0}return!1},T=function(C,I,R,F){var M,Y,X,$,ee=I[F];switch(ee){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":w=!1;break;case"N":case"AN":break;case"EN":w&&(ee="AN");break;case"AL":w=!0,ee="R";break;case"WS":case"BN":ee="N";break;case"CS":F<1||F+1>=I.length||(M=R[F-1])!=="EN"&&M!=="AN"||(Y=I[F+1])!=="EN"&&Y!=="AN"?ee="N":w&&(Y="AN"),ee=Y===M?Y:"N";break;case"ES":ee=(M=F>0?R[F-1]:"B")==="EN"&&F+1<I.length&&I[F+1]==="EN"?"EN":"N";break;case"ET":if(F>0&&R[F-1]==="EN"){ee="EN";break}if(w){ee="N";break}for(X=F+1,$=I.length;X<$&&I[X]==="ET";)X++;ee=X<$&&I[X]==="EN"?"EN":"N";break;case"NSM":if(s&&!l){for($=I.length,X=F+1;X<$&&I[X]==="NSM";)X++;if(X<$){var V=C[F],D=V>=1425&&V<=2303||V===64286;if(M=I[X],D&&(M==="R"||M==="AL")){ee="R";break}}}ee=F<1||(M=I[F-1])==="B"?"N":R[F-1];break;case"B":w=!1,o=!0,ee=k;break;case"S":a=!0,ee="N"}return ee},A=function(C,I,R){var F=C.split("");return R&&P(F,R,{hiLevel:k}),F.reverse(),I&&I.reverse(),F.join("")},P=function(C,I,R){var F,M,Y,X,$,ee=-1,V=C.length,D=0,z=[],q=k?p:h,G=[];for(w=!1,o=!1,a=!1,M=0;M<V;M++)G[M]=j(C[M]);for(Y=0;Y<V;Y++){if($=D,z[Y]=T(C,G,z,Y),F=240&(D=q[$][v[z[Y]]]),D&=15,I[Y]=X=q[D][5],F>0)if(F===16){for(M=ee;M<Y;M++)I[M]=1;ee=-1}else ee=-1;if(q[D][6])ee===-1&&(ee=Y);else if(ee>-1){for(M=ee;M<Y;M++)I[M]=X;ee=-1}G[Y]==="B"&&(I[Y]=0),R.hiLevel|=X}a&&(function(U,Q,K){for(var re=0;re<K;re++)if(U[re]==="S"){Q[re]=k;for(var H=re-1;H>=0&&U[H]==="WS";H--)Q[H]=k}})(G,I,V)},N=function(C,I,R,F,M){if(!(M.hiLevel<C)){if(C===1&&k===1&&!o)return I.reverse(),void(R&&R.reverse());for(var Y,X,$,ee,V=I.length,D=0;D<V;){if(F[D]>=C){for($=D+1;$<V&&F[$]>=C;)$++;for(ee=D,X=$-1;ee<X;ee++,X--)Y=I[ee],I[ee]=I[X],I[X]=Y,R&&(Y=R[ee],R[ee]=R[X],R[X]=Y);D=$}D++}}},O=function(C,I,R){var F=C.split(""),M={hiLevel:k};return R||(R=[]),P(F,R,M),(function(Y,X,$){if($.hiLevel!==0&&d)for(var ee,V=0;V<Y.length;V++)X[V]===1&&(ee=b.indexOf(Y[V]))>=0&&(Y[V]=b[ee+1])})(F,R,M),N(2,F,I,R,M),N(1,F,I,R,M),F.join("")};return this.__bidiEngine__.doBidiReorder=function(C,I,R){if((function(M,Y){if(Y)for(var X=0;X<M.length;X++)Y[X]=X;l===void 0&&(l=_(M)),u===void 0&&(u=_(M))})(C,I),s||!c||u)if(s&&c&&l^u)k=l?1:0,C=A(C,I,R);else if(!s&&c&&u)k=l?1:0,C=O(C,I,R),C=A(C,I);else if(!s||l||c||u){if(s&&!c&&l^u)C=A(C,I),l?(k=0,C=O(C,I,R)):(k=1,C=O(C,I,R),C=A(C,I));else if(s&&l&&!c&&u)k=1,C=O(C,I,R),C=A(C,I);else if(!s&&!c&&l^u){var F=d;l?(k=1,C=O(C,I,R),k=0,d=!1,C=O(C,I,R),d=F):(k=0,C=O(C,I,R),C=A(C,I),k=1,d=!1,C=O(C,I,R),d=F,C=A(C,I))}}else k=0,C=O(C,I,R);else k=l?1:0,C=O(C,I,R);return C},this.__bidiEngine__.setOptions=function(C){C&&(s=C.isInputVisual,c=C.isOutputVisual,l=C.isInputRtl,u=C.isOutputRtl,d=C.isSymmetricSwapping)},this.__bidiEngine__.setOptions(n),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],r=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push(["postProcessText",function(n){var o=n.text;n.x,n.y;var a=n.options||{};n.mutex,a.lang;var s=[];if(a.isInputVisual=typeof a.isInputVisual!="boolean"||a.isInputVisual,r.setOptions(a),Object.prototype.toString.call(o)==="[object Array]"){var l=0;for(s=[],l=0;l<o.length;l+=1)Object.prototype.toString.call(o[l])==="[object Array]"?s.push([r.doBidiReorder(o[l][0]),o[l][1],o[l][2]]):s.push([r.doBidiReorder(o[l])]);n.text=s}else n.text=r.doBidiReorder(o);r.setOptions({isInputVisual:!0})}])})(fr),fr.API.TTFFont=(function(){function e(t){var r;if(this.rawData=t,r=this.contents=new Kf(t),this.contents.pos=4,r.readString(4)==="ttcf")throw new Error("TTCF not supported.");r.pos=0,this.parse(),this.subset=new ERe(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new pRe(this.contents),this.head=new gRe(this),this.name=new bRe(this),this.cmap=new WZ(this),this.toUnicode={},this.hhea=new mRe(this),this.maxp=new wRe(this),this.hmtx=new SRe(this),this.post=new yRe(this),this.os2=new vRe(this),this.loca=new CRe(this),this.glyf=new jRe(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},e.prototype.registerTTF=function(){var t,r,n,o,a;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var s,l,c,u;for(u=[],s=0,l=(c=this.bbox).length;s<l;s++)t=c[s],u.push(Math.round(t*this.scaleFactor));return u}).call(this),this.stemV=0,this.post.exists?(n=255&(o=this.post.italic_angle),32768&(r=o>>16)&&(r=-(1+(65535^r))),this.italicAngle=+(r+"."+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(a=this.familyClass)===1||a===2||a===3||a===4||a===5||a===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},e.prototype.characterToGlyph=function(t){var r;return((r=this.cmap.unicode)!=null?r.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var r;return r=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*r},e.prototype.widthOfString=function(t,r,n){var o,a,s,l;for(s=0,a=0,l=(t=""+t).length;0<=l?a<l:a>l;a=0<=l?++a:--a)o=t.charCodeAt(a),s+=this.widthOfGlyph(this.characterToGlyph(o))+n*(1e3/r)||0;return s*(r/1e3)},e.prototype.lineHeight=function(t,r){var n;return r==null&&(r=!1),n=r?this.lineGap:0,(this.ascender+n-this.decender)/1e3*t},e})();var kc,Kf=(function(){function e(t){this.data=t??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(t){return this.data[this.pos++]=t},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},e.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},e.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},e.prototype.readString=function(t){var r,n;for(n=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)n[r]=String.fromCharCode(this.readByte());return n.join("")},e.prototype.writeString=function(t){var r,n,o;for(o=[],r=0,n=t.length;0<=n?r<n:r>n;r=0<=n?++r:--r)o.push(this.writeByte(t.charCodeAt(r)));return o},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,r,n,o,a,s,l,c;return t=this.readByte(),r=this.readByte(),n=this.readByte(),o=this.readByte(),a=this.readByte(),s=this.readByte(),l=this.readByte(),c=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^r)+1099511627776*(255^n)+4294967296*(255^o)+16777216*(255^a)+65536*(255^s)+256*(255^l)+(255^c)+1):72057594037927940*t+281474976710656*r+1099511627776*n+4294967296*o+16777216*a+65536*s+256*l+c},e.prototype.writeLongLong=function(t){var r,n;return r=Math.floor(t/4294967296),n=4294967295&t,this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var r,n;for(r=[],n=0;0<=t?n<t:n>t;n=0<=t?++n:--n)r.push(this.readByte());return r},e.prototype.write=function(t){var r,n,o,a;for(a=[],n=0,o=t.length;n<o;n++)r=t[n],a.push(this.writeByte(r));return a},e})(),pRe=(function(){var e;function t(r){var n,o,a;for(this.scalarType=r.readInt(),this.tableCount=r.readShort(),this.searchRange=r.readShort(),this.entrySelector=r.readShort(),this.rangeShift=r.readShort(),this.tables={},o=0,a=this.tableCount;0<=a?o<a:o>a;o=0<=a?++o:--o)n={tag:r.readString(4),checksum:r.readInt(),offset:r.readInt(),length:r.readInt()},this.tables[n.tag]=n}return t.prototype.encode=function(r){var n,o,a,s,l,c,u,d,f,h,p,v,m;for(m in p=Object.keys(r).length,c=Math.log(2),f=16*Math.floor(Math.log(p)/c),s=Math.floor(f/c),d=16*p-f,(o=new Kf).writeInt(this.scalarType),o.writeShort(p),o.writeShort(f),o.writeShort(s),o.writeShort(d),a=16*p,u=o.pos+a,l=null,v=[],r)for(h=r[m],o.writeString(m),o.writeInt(e(h)),o.writeInt(u),o.writeInt(h.length),v=v.concat(h),m==="head"&&(l=u),u+=h.length;u%4;)v.push(0),u++;return o.write(v),n=2981146554-e(o.data),o.pos=l+8,o.writeUInt32(n),o.data},e=function(r){var n,o,a,s;for(r=qZ.call(r);r.length%4;)r.push(0);for(a=new Kf(r),o=0,n=0,s=r.length;n<s;n=n+=4)o+=a.readUInt32();return 4294967295&o},t})(),hRe={}.hasOwnProperty,hu=function(e,t){for(var r in t)hRe.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e};kc=(function(){function e(t){var r;this.file=t,r=this.file.directory.tables[this.tag],this.exists=!!r,r&&(this.offset=r.offset,this.length=r.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e})();var gRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="head",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},e.prototype.encode=function(t){var r;return(r=new Kf).writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(t),r.writeShort(this.glyphDataFormat),r.data},e})(),jq=(function(){function e(t,r){var n,o,a,s,l,c,u,d,f,h,p,v,m,b,x,w,k;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=r+t.readInt(),f=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(c=0;c<256;++c)this.codeMap[c]=t.readByte();break;case 4:for(p=t.readUInt16(),h=p/2,t.pos+=6,a=(function(){var j,_;for(_=[],c=j=0;0<=h?j<h:j>h;c=0<=h?++j:--j)_.push(t.readUInt16());return _})(),t.pos+=2,m=(function(){var j,_;for(_=[],c=j=0;0<=h?j<h:j>h;c=0<=h?++j:--j)_.push(t.readUInt16());return _})(),u=(function(){var j,_;for(_=[],c=j=0;0<=h?j<h:j>h;c=0<=h?++j:--j)_.push(t.readUInt16());return _})(),d=(function(){var j,_;for(_=[],c=j=0;0<=h?j<h:j>h;c=0<=h?++j:--j)_.push(t.readUInt16());return _})(),o=(this.length-t.pos+this.offset)/2,l=(function(){var j,_;for(_=[],c=j=0;0<=o?j<o:j>o;c=0<=o?++j:--j)_.push(t.readUInt16());return _})(),c=x=0,k=a.length;x<k;c=++x)for(b=a[c],n=w=v=m[c];v<=b?w<=b:w>=b;n=v<=b?++w:--w)d[c]===0?s=n+u[c]:(s=l[d[c]/2+(n-v)-(h-c)]||0)!==0&&(s+=u[c]),this.codeMap[n]=65535&s}t.pos=f}return e.encode=function(t,r){var n,o,a,s,l,c,u,d,f,h,p,v,m,b,x,w,k,j,_,T,A,P,N,O,C,I,R,F,M,Y,X,$,ee,V,D,z,q,G,U,Q,K,re,H,ie,de,le;switch(F=new Kf,s=Object.keys(t).sort(function(ke,ve){return ke-ve}),r){case"macroman":for(m=0,b=(function(){var ke=[];for(v=0;v<256;++v)ke.push(0);return ke})(),w={0:0},a={},M=0,ee=s.length;M<ee;M++)w[H=t[o=s[M]]]==null&&(w[H]=++m),a[o]={old:t[o],new:w[t[o]]},b[o]=w[t[o]];return F.writeUInt16(1),F.writeUInt16(0),F.writeUInt32(12),F.writeUInt16(0),F.writeUInt16(262),F.writeUInt16(0),F.write(b),{charMap:a,subtable:F.data,maxGlyphID:m+1};case"unicode":for(I=[],f=[],k=0,w={},n={},x=u=null,Y=0,V=s.length;Y<V;Y++)w[_=t[o=s[Y]]]==null&&(w[_]=++k),n[o]={old:_,new:w[_]},l=w[_]-o,x!=null&&l===u||(x&&f.push(x),I.push(o),u=l),x=o;for(x&&f.push(x),f.push(65535),I.push(65535),O=2*(N=I.length),P=2*Math.pow(Math.log(N)/Math.LN2,2),h=Math.log(P/2)/Math.LN2,A=2*N-P,c=[],T=[],p=[],v=X=0,D=I.length;X<D;v=++X){if(C=I[v],d=f[v],C===65535){c.push(0),T.push(0);break}if(C-(R=n[C].new)>=32768)for(c.push(0),T.push(2*(p.length+N-v)),o=$=C;C<=d?$<=d:$>=d;o=C<=d?++$:--$)p.push(n[o].new);else c.push(R-C),T.push(0)}for(F.writeUInt16(3),F.writeUInt16(1),F.writeUInt32(12),F.writeUInt16(4),F.writeUInt16(16+8*N+2*p.length),F.writeUInt16(0),F.writeUInt16(O),F.writeUInt16(P),F.writeUInt16(h),F.writeUInt16(A),K=0,z=f.length;K<z;K++)o=f[K],F.writeUInt16(o);for(F.writeUInt16(0),re=0,q=I.length;re<q;re++)o=I[re],F.writeUInt16(o);for(ie=0,G=c.length;ie<G;ie++)l=c[ie],F.writeUInt16(l);for(de=0,U=T.length;de<U;de++)j=T[de],F.writeUInt16(j);for(le=0,Q=p.length;le<Q;le++)m=p[le],F.writeUInt16(m);return{charMap:n,subtable:F.data,maxGlyphID:k+1}}},e})(),WZ=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="cmap",e.prototype.parse=function(t){var r,n,o;for(t.pos=this.offset,this.version=t.readUInt16(),o=t.readUInt16(),this.tables=[],this.unicode=null,n=0;0<=o?n<o:n>o;n=0<=o?++n:--n)r=new jq(t,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},e.encode=function(t,r){var n,o;return r==null&&(r="macroman"),n=jq.encode(t,r),(o=new Kf).writeUInt16(0),o.writeUInt16(1),n.table=o.data.concat(n.subtable),n},e})(),mRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="hhea",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.ascender=t.readShort(),this.decender=t.readShort(),this.lineGap=t.readShort(),this.advanceWidthMax=t.readShort(),this.minLeftSideBearing=t.readShort(),this.minRightSideBearing=t.readShort(),this.xMaxExtent=t.readShort(),this.caretSlopeRise=t.readShort(),this.caretSlopeRun=t.readShort(),this.caretOffset=t.readShort(),t.pos+=8,this.metricDataFormat=t.readShort(),this.numberOfMetrics=t.readUInt16()},e})(),vRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="OS/2",e.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=(function(){var r,n;for(n=[],r=0;r<10;++r)n.push(t.readByte());return n})(),this.charRange=(function(){var r,n;for(n=[],r=0;r<4;++r)n.push(t.readInt());return n})(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=(function(){var r,n;for(n=[],r=0;r<2;r=++r)n.push(t.readInt());return n})(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},e})(),yRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="post",e.prototype.parse=function(t){var r,n,o;switch(t.pos=this.offset,this.format=t.readInt(),this.italicAngle=t.readInt(),this.underlinePosition=t.readShort(),this.underlineThickness=t.readShort(),this.isFixedPitch=t.readInt(),this.minMemType42=t.readInt(),this.maxMemType42=t.readInt(),this.minMemType1=t.readInt(),this.maxMemType1=t.readInt(),this.format){case 65536:case 196608:break;case 131072:var a;for(n=t.readUInt16(),this.glyphNameIndex=[],a=0;0<=n?a<n:a>n;a=0<=n?++a:--a)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],o=[];t.pos<this.offset+this.length;)r=t.readByte(),o.push(this.names.push(t.readString(r)));return o;case 151552:return n=t.readUInt16(),this.offsets=t.read(n);case 262144:return this.map=(function(){var s,l,c;for(c=[],a=s=0,l=this.file.maxp.numGlyphs;0<=l?s<l:s>l;a=0<=l?++s:--s)c.push(t.readUInt32());return c}).call(this)}},e})(),xRe=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},bRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="name",e.prototype.parse=function(t){var r,n,o,a,s,l,c,u,d,f,h;for(t.pos=this.offset,t.readShort(),r=t.readShort(),l=t.readShort(),n=[],a=0;0<=r?a<r:a>r;a=0<=r?++a:--a)n.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+l+t.readShort()});for(c={},a=d=0,f=n.length;d<f;a=++d)o=n[a],t.pos=o.offset,u=t.readString(o.length),s=new xRe(u,o),c[h=o.nameID]==null&&(c[h]=[]),c[o.nameID].push(s);this.strings=c,this.copyright=c[0],this.fontFamily=c[1],this.fontSubfamily=c[2],this.uniqueSubfamily=c[3],this.fontName=c[4],this.version=c[5];try{this.postscriptName=c[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=c[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=c[7],this.manufacturer=c[8],this.designer=c[9],this.description=c[10],this.vendorUrl=c[11],this.designerUrl=c[12],this.license=c[13],this.licenseUrl=c[14],this.preferredFamily=c[15],this.preferredSubfamily=c[17],this.compatibleFull=c[18],this.sampleText=c[19]},e})(),wRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="maxp",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.numGlyphs=t.readUInt16(),this.maxPoints=t.readUInt16(),this.maxContours=t.readUInt16(),this.maxCompositePoints=t.readUInt16(),this.maxComponentContours=t.readUInt16(),this.maxZones=t.readUInt16(),this.maxTwilightPoints=t.readUInt16(),this.maxStorage=t.readUInt16(),this.maxFunctionDefs=t.readUInt16(),this.maxInstructionDefs=t.readUInt16(),this.maxStackElements=t.readUInt16(),this.maxSizeOfInstructions=t.readUInt16(),this.maxComponentElements=t.readUInt16(),this.maxComponentDepth=t.readUInt16()},e})(),SRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="hmtx",e.prototype.parse=function(t){var r,n,o,a,s,l,c;for(t.pos=this.offset,this.metrics=[],r=0,l=this.file.hhea.numberOfMetrics;0<=l?r<l:r>l;r=0<=l?++r:--r)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(o=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var u,d;for(d=[],r=u=0;0<=o?u<o:u>o;r=0<=o?++u:--u)d.push(t.readInt16());return d})(),this.widths=(function(){var u,d,f,h;for(h=[],u=0,d=(f=this.metrics).length;u<d;u++)a=f[u],h.push(a.advance);return h}).call(this),n=this.widths[this.widths.length-1],c=[],r=s=0;0<=o?s<o:s>o;r=0<=o?++s:--s)c.push(this.widths.push(n));return c},e.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},e})(),qZ=[].slice,jRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var r,n,o,a,s,l,c,u,d,f;return t in this.cache?this.cache[t]:(a=this.file.loca,r=this.file.contents,n=a.indexOf(t),(o=a.lengthOf(t))===0?this.cache[t]=null:(r.pos=this.offset+n,s=(l=new Kf(r.read(o))).readShort(),u=l.readShort(),f=l.readShort(),c=l.readShort(),d=l.readShort(),this.cache[t]=s===-1?new _Re(l,u,f,c,d):new kRe(l,s,u,f,c,d),this.cache[t]))},e.prototype.encode=function(t,r,n){var o,a,s,l,c;for(s=[],a=[],l=0,c=r.length;l<c;l++)o=t[r[l]],a.push(s.length),o&&(s=s.concat(o.encode(n)));return a.push(s.length),{table:s,offsets:a}},e})(),kRe=(function(){function e(t,r,n,o,a,s){this.raw=t,this.numberOfContours=r,this.xMin=n,this.yMin=o,this.xMax=a,this.yMax=s,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e})(),_Re=(function(){function e(t,r,n,o,a){var s,l;for(this.raw=t,this.xMin=r,this.yMin=n,this.xMax=o,this.yMax=a,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],s=this.raw;l=s.readShort(),this.glyphOffsets.push(s.pos),this.glyphIDs.push(s.readUInt16()),32&l;)s.pos+=1&l?4:2,128&l?s.pos+=8:64&l?s.pos+=4:8&l&&(s.pos+=2)}return e.prototype.encode=function(){var t,r,n;for(r=new Kf(qZ.call(this.raw.data)),t=0,n=this.glyphIDs.length;t<n;++t)r.pos=this.glyphOffsets[t];return r.data},e})(),CRe=(function(){function e(){return e.__super__.constructor.apply(this,arguments)}return hu(e,kc),e.prototype.tag="loca",e.prototype.parse=function(t){var r,n;return t.pos=this.offset,r=this.file.head.indexToLocFormat,this.offsets=r===0?(function(){var o,a;for(a=[],n=0,o=this.length;n<o;n+=2)a.push(2*t.readUInt16());return a}).call(this):(function(){var o,a;for(a=[],n=0,o=this.length;n<o;n+=4)a.push(t.readUInt32());return a}).call(this)},e.prototype.indexOf=function(t){return this.offsets[t]},e.prototype.lengthOf=function(t){return this.offsets[t+1]-this.offsets[t]},e.prototype.encode=function(t,r){for(var n=new Uint32Array(this.offsets.length),o=0,a=0,s=0;s<n.length;++s)if(n[s]=o,a<r.length&&r[a]==s){++a,n[s]=o;var l=this.offsets[s],c=this.offsets[s+1]-l;c>0&&(o+=c)}for(var u=new Array(4*n.length),d=0;d<n.length;++d)u[4*d+3]=255&n[d],u[4*d+2]=(65280&n[d])>>8,u[4*d+1]=(16711680&n[d])>>16,u[4*d]=(4278190080&n[d])>>24;return u},e})(),ERe=(function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,r,n,o,a;for(r in o=this.font.cmap.tables[0].codeMap,t={},a=this.subset)n=a[r],t[r]=o[n];return t},e.prototype.glyphsFor=function(t){var r,n,o,a,s,l,c;for(o={},s=0,l=t.length;s<l;s++)o[a=t[s]]=this.font.glyf.glyphFor(a);for(a in r=[],o)(n=o[a])!=null&&n.compound&&r.push.apply(r,n.glyphIDs);if(r.length>0)for(a in c=this.glyphsFor(r))n=c[a],o[a]=n;return o},e.prototype.encode=function(t,r){var n,o,a,s,l,c,u,d,f,h,p,v,m,b,x;for(o in n=WZ.encode(this.generateCmap(),"unicode"),s=this.glyphsFor(t),p={0:0},x=n.charMap)p[(c=x[o]).old]=c.new;for(v in h=n.maxGlyphID,s)v in p||(p[v]=h++);return d=(function(w){var k,j;for(k in j={},w)j[w[k]]=k;return j})(p),f=Object.keys(d).sort(function(w,k){return w-k}),m=(function(){var w,k,j;for(j=[],w=0,k=f.length;w<k;w++)l=f[w],j.push(d[l]);return j})(),a=this.font.glyf.encode(s,m,p),u=this.font.loca.encode(a.offsets,m),b={cmap:this.font.cmap.raw(),glyf:a.table,loca:u,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(r)},this.font.os2.exists&&(b["OS/2"]=this.font.os2.raw()),this.font.directory.encode(b)},e})();fr.API.PDFObject=(function(){var e;function t(){}return e=function(r,n){return(Array(n+1).join("0")+r).slice(-n)},t.convert=function(r){var n,o,a,s;if(Array.isArray(r))return"["+(function(){var l,c,u;for(u=[],l=0,c=r.length;l<c;l++)n=r[l],u.push(t.convert(n));return u})().join(" ")+"]";if(typeof r=="string")return"/"+r;if(r!=null&&r.isString)return"("+r+")";if(r instanceof Date)return"(D:"+e(r.getUTCFullYear(),4)+e(r.getUTCMonth(),2)+e(r.getUTCDate(),2)+e(r.getUTCHours(),2)+e(r.getUTCMinutes(),2)+e(r.getUTCSeconds(),2)+"Z)";if({}.toString.call(r)==="[object Object]"){for(o in a=["<<"],r)s=r[o],a.push("/"+o+" "+t.convert(s));return a.push(">>"),a.join(`
`)}return""+r},t})();async function $Z(e,t){const r=new fr({orientation:"portrait",unit:"mm",format:"a4"});await r.html(e,{margin:[6,6,6,6],autoPaging:"slice",html2canvas:{scale:.22,useCORS:!0,logging:!1,backgroundColor:"#ffffff"},width:190,windowWidth:680});const n=t.endsWith(".pdf")?t:`${t}.pdf`;r.save(n)}function ARe({ctx:e,onClose:t}){const r=S.useRef(null),[n,o]=S.useState(!1),[a,s]=S.useState(null),l=e.content.layoutId||"tpl1",c=QX(e),u=(e.templateName||"brochure").replace(/[^a-z0-9-_]+/gi,"-").replace(/^-|-$/g,"")||"brochure",d=async()=>{if(!(!r.current||n)){s(null),o(!0);try{await $Z(r.current,`${u}.pdf`)}catch(f){s(f instanceof Error?f.message:"PDF export failed")}finally{o(!1)}}};return i.jsx(i.Fragment,{children:i.jsx("div",{role:"presentation",onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",zIndex:300,display:"flex",alignItems:"center",justifyContent:"center",padding:20},children:i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"brochure-preview-title",onClick:f=>f.stopPropagation(),style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"min(900px, 100%)",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"var(--elevation-sm)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsxs("div",{children:[i.jsx("h3",{id:"brochure-preview-title",style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 4px"},children:"Brochure Preview"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:[c.eventName," • ",TIe(l)]}),a?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",margin:"6px 0 0"},children:a}):null]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsxs("button",{type:"button",disabled:n,onClick:()=>void d(),style:{display:"flex",alignItems:"center",gap:6,padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:n?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:n?.75:1},children:[i.jsx(ja,{size:14})," ",n?"Generating…":"Download PDF"]}),i.jsx("button",{type:"button",onClick:t,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:"var(--radius-button)",borderWidth:1,borderStyle:"solid",borderColor:"var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:16})})]})]}),i.jsx("div",{style:{flex:1,overflowY:"auto",padding:20,background:"#F8FAFC"},children:i.jsx("div",{ref:r,style:{maxWidth:680,margin:"0 auto",background:"#fff",boxShadow:"0 4px 20px rgba(0,0,0,0.1)"},children:i.jsx(XX,{templateId:l,data:c})})})]})})})}async function TRe(e,t,r){const n=document.createElement("div");n.setAttribute("data-brochure-pdf-export","1"),n.style.cssText="position:fixed;left:-12000px;top:0;width:680px;background:#fff;z-index:-1;pointer-events:none;",document.body.appendChild(n);const o=Hq.createRoot(n);o.render(i.jsx("div",{style:{width:680,background:"#fff"},children:i.jsx(XX,{templateId:e,data:t})})),await new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(()=>a()))),await new Promise(a=>setTimeout(a,450));try{const a=n.firstElementChild;if(!a)throw new Error("Brochure render failed");await $Z(a,r)}finally{o.unmount(),n.remove()}}const d3=["header","banner","countdown","about","agenda","speakers","register_links","sponsors"],UZ=[{id:"header",label:"Navigation header",desc:"Top nav with event name and links."},{id:"banner",label:"Hero / banner",desc:"Full-width headline and CTAs."},{id:"countdown",label:"Countdown strip",desc:"Countdown to event start."},{id:"gallery",label:"Gallery",desc:"Image grid strip."},{id:"about",label:"About",desc:"Headline, bullets, and CTA."},{id:"contact_form",label:"Contact form",desc:"Visitor message form."},{id:"agenda",label:"Schedule",desc:"Sessions from your event (timeline layout)."},{id:"register_links",label:"Registration block",desc:"Register CTAs."},{id:"speakers",label:"Speakers",desc:"Speaker cards from linked sessions."},{id:"tickets",label:"Tickets / pricing",desc:"Pricing tiers (demo-style cards)."},{id:"venue",label:"Venue",desc:"Venue copy and map embed."},{id:"sponsors",label:"Sponsors",desc:"Sponsor row and partner CTA."},{id:"faq",label:"FAQ",desc:"Accordion questions."},{id:"cta",label:"Call to action",desc:"Highlighted CTA band."},{id:"footer",label:"Footer (optional)",desc:"Extra footer row (shell already has EventBuzz footer)."},{id:"custom_html",label:"Custom HTML",desc:"Rich text / HTML block."}],PRe=Object.fromEntries(UZ.map(e=>[e.id,e])),IRe=[{id:"violet",label:"Violet",primary:"#5c6ac4",accent:"#00c2d1"},{id:"ocean",label:"Ocean",primary:"#0e7490",accent:"#22d3ee"},{id:"forest",label:"Forest",primary:"#15803d",accent:"#84cc16"},{id:"ember",label:"Ember",primary:"#c2410c",accent:"#fbbf24"}],Kg=["Montserrat + Roboto","Inter + Noto Sans","Playfair + Source Sans","Poppins + Open Sans","Raleway + Lato"],ORe=[{label:"Draft (not published to URL)",value:"Draft"},{label:"Live (public site enabled)",value:"Live"}];function kq(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function NRe(e){return e==null?"":typeof e=="object"&&e&&"_id"in e?String(e._id):String(e)}function RRe({onClose:e,onSuccess:t,initialEventId:r}){var st;const{user:n}=Mr(),o=Nn(n),[a,s]=S.useState(!1),[l,c]=S.useState(null),[u,d]=S.useState(0),[f,h]=S.useState(null),[p,v]=S.useState(!1),m=S.useRef(null),[b,x]=S.useState(!1),[w,k]=S.useState(null),j=4,_=wc(j),[T,A]=S.useState([]),[P,N]=S.useState({event:"",templateName:"",slug:"",description:"",layoutTemplate:"conference",micrositeSections:[...d3],primaryColor:"#5c6ac4",accentColor:"#00c2d1",fontPair:Kg[0],status:"Draft",customDomain:"",passwordProtect:!1,password:"",seoTitle:"",seoDescription:"",registrationFormId:"",sourcePageId:""}),[O,C]=S.useState([]),[I,R]=S.useState(null),[F,M]=S.useState(!1),[Y,X]=S.useState([]),[$,ee]=S.useState([]),[V,D]=S.useState(!1),[z,q]=S.useState(!1),[G,U]=S.useState(null),[Q,K]=S.useState(null),[re,H]=S.useState(null),[ie,de]=S.useState(null),le=S.useRef(P.micrositeSections);le.current=P.micrositeSections;const ke=S.useRef(null),ve=S.useMemo(()=>{const Te=P.micrositeSections.map(qe=>PRe[qe]).filter(Boolean),et=new Set(P.micrositeSections),Pt=UZ.filter(qe=>!et.has(qe.id));return[...Te,...Pt]},[P.micrositeSections]),se=(Te,et)=>N(Pt=>({...Pt,[Te]:et}));S.useEffect(()=>()=>{var Te;(Te=ke.current)==null||Te.call(ke),ke.current=null},[]);const be=S.useCallback((Te,et)=>{var Tt;if(Te.pointerType==="mouse"&&Te.button!==0||!le.current.includes(et))return;(Tt=ke.current)==null||Tt.call(ke),ke.current=null,Te.preventDefault(),Te.stopPropagation();const Pt=Te.currentTarget,qe=Te.pointerId;let Et=null,vt=!1;de(et);try{Pt.setPointerCapture(qe)}catch{}const Ft={capture:!0},Ce=We=>{!We||We===et||N(ce=>{const he=[...ce.micrositeSections];if(!he.includes(et)||!he.includes(We))return ce;const je=he.indexOf(et),xe=he.indexOf(We);if(je<0||xe<0)return ce;const Re=[...he];return Re.splice(je,1),Re.splice(xe,0,et),{...ce,micrositeSections:Re}})},lt=We=>{var xe;if(We.pointerId!==qe)return;const ce=document.elementFromPoint(We.clientX,We.clientY),he=(xe=ce==null?void 0:ce.closest)==null?void 0:xe.call(ce,"[data-microsite-section-id]"),je=he==null?void 0:he.getAttribute("data-microsite-section-id");je&&le.current.includes(je)&&(Et=je)};let Xe;const Be=We=>{We.pointerId===qe&&Xe(!0)},ct=We=>{We.pointerId===qe&&Xe(!0)};Xe=We=>{if(!vt){vt=!0,document.removeEventListener("pointermove",lt,Ft),document.removeEventListener("pointerup",Be,Ft),document.removeEventListener("pointercancel",Be,Ft),Pt.removeEventListener("lostpointercapture",ct),ke.current=null,de(null);try{Pt.releasePointerCapture(qe)}catch{}We&&Ce(Et)}},ke.current=()=>Xe(!1),document.addEventListener("pointermove",lt,Ft),document.addEventListener("pointerup",Be,Ft),document.addEventListener("pointercancel",Be,Ft),Pt.addEventListener("lostpointercapture",ct)},[]);S.useEffect(()=>{r&&N(Te=>({...Te,event:r}))},[r]),S.useEffect(()=>{o&&Lr.list({limit:100,organization:o}).then(Te=>{var et;(et=Te.data)!=null&&et.events&&(A(Te.data.events),N(Pt=>{var qe;return{...Pt,event:Pt.event||r||((qe=Te.data.events[0])==null?void 0:qe._id)||""}}))})},[o,r]);const De=S.useCallback(Te=>{const et=Te.sourcePageId,Pt=et==null?"":typeof et=="object"&&et&&"_id"in et?String(et._id):String(et);N(qe=>{var Et,vt;return{...qe,templateName:Te.name??"",slug:Te.publishFolder??"",description:Te.description??"",layoutTemplate:"conference",micrositeSections:Te.micrositeSections&&Te.micrositeSections.length>0?[...Te.micrositeSections]:[...d3],status:Te.enabled?"Live":"Draft",seoTitle:Te.title??"",primaryColor:((Et=Te.primaryColor)==null?void 0:Et.trim())||"#5c6ac4",accentColor:((vt=Te.accentColor)==null?void 0:vt.trim())||"#00c2d1",fontPair:Te.fontPair&&Kg.includes(Te.fontPair)?Te.fontPair:Kg[0],registrationFormId:Te.registrationFormId!=null?String(Te.registrationFormId):"",seoDescription:Te.seoDescription??"",sourcePageId:Pt}})},[]),ae=S.useCallback(Te=>{N(et=>{var Pt,qe;return{...et,templateName:"Default",slug:Te.folder??et.slug,description:Te.description??"",layoutTemplate:"conference",micrositeSections:Te.micrositeSections&&Te.micrositeSections.length>0?[...Te.micrositeSections]:[...d3],status:Te.enabled?"Live":"Draft",seoTitle:Te.title??"",primaryColor:((Pt=Te.primaryColor)==null?void 0:Pt.trim())||"#5c6ac4",accentColor:((qe=Te.accentColor)==null?void 0:qe.trim())||"#00c2d1",fontPair:Te.fontPair&&Kg.includes(Te.fontPair)?Te.fontPair:Kg[0],registrationFormId:Te.registrationFormId??"",seoDescription:Te.seoDescription??"",sourcePageId:""}})},[]);S.useEffect(()=>{if(!P.event){C([]),R(null),X([]);return}let Te=!1;return(async()=>{var Et;M(!0);const[et,Pt]=await Promise.all([ha.list(P.event),Yc.list(P.event)]);if(Te)return;if(M(!1),X(((Et=Pt.data)==null?void 0:Et.pages)??[]),et.error||!et.data){C([]),R(null);const vt=await Xc.get(P.event);if(Te||vt.error||!vt.data)return;ae(vt.data);return}const qe=et.data;if(C(qe),qe.length===0){R(null);const vt=await Xc.get(P.event);if(Te||vt.error||!vt.data)return;ae(vt.data);return}R(qe[0]._id),De(qe[0])})(),()=>{Te=!0}},[P.event,ae,De]),S.useEffect(()=>{if(!P.event){ee([]);return}Mo.listForEvent(P.event).then(Te=>ee(Te.filter(et=>et.type==="registration"))).catch(()=>ee([]))},[P.event]);const ue=((st=T.find(Te=>Te._id===P.event))==null?void 0:st.name)??"",Me=()=>({publishFolder:P.slug.trim(),name:P.templateName.trim()||void 0,description:P.description||void 0,title:P.seoTitle.trim()||void 0,layoutTemplate:"conference",micrositeSections:P.micrositeSections,enabled:P.status==="Live",primaryColor:P.primaryColor||void 0,accentColor:P.accentColor||void 0,fontPair:P.fontPair||void 0,registrationFormId:P.registrationFormId.trim()||void 0,seoDescription:P.seoDescription.trim()||void 0,sourcePageId:P.sourcePageId.trim()||null}),Se=async()=>{if(U(null),!P.event)return U("Select an event."),!1;if(!P.slug.trim())return U("URL slug is required."),!1;if(D(!0),I){const et=await ha.update(P.event,I,Me());return D(!1),et.error?(U(et.error),!1):(et.data&&(C(Pt=>Pt.map(qe=>qe._id===et.data._id?{...qe,...et.data}:qe)),De(et.data)),t==null||t(),!0)}const Te=await ha.create(P.event,{...Me(),publishFolder:P.slug.trim(),name:P.templateName.trim()||"Default"});return D(!1),Te.error?(U(Te.error),!1):(Te.data&&(C(et=>[...et,Te.data]),R(Te.data._id),De(Te.data)),t==null||t(),!0)},Pe=async()=>{await Se()},Ee=async()=>{var Pt;if(K(null),!P.event){K("Select an event.");return}if(!P.slug.trim()){K("Set a URL slug before publishing.");return}if(!I){K("Save the microsite as a template first, then publish.");return}q(!0);const Te=await ha.update(P.event,I,Me());if(Te.error){q(!1),K(Te.error);return}const et=await ha.publish(P.event,I);if(q(!1),et.error){K(et.error);return}(Pt=et.data)!=null&&Pt.publicUrl&&H(et.data.publicUrl),t==null||t()},Ae=async()=>{var et;if(!P.event)return;if(!I){h("Create or select a microsite template and save it before opening the visual builder.");return}h(null),v(!0);let Te=null;try{const Pt=await ha.get(P.event,I);if(Pt.error||!Pt.data){v(!1),h(Pt.error||"Could not load this microsite template.");return}let qe=[];try{qe=((et=(await Yc.list(P.event)).data)==null?void 0:et.pages)??[]}catch{qe=[]}const Et=NRe(Pt.data.sourcePageId),vt=P.sourcePageId.trim();if(qe.length===0)Te=null;else{const Ft=Ce=>Ce&&qe.some(lt=>lt._id===Ce)?(Te=Ce,!0):!1;if(!Ft(vt)&&!Ft(Et)){const Ce=qe.find(lt=>lt.type==="home")??qe[0];Te=(Ce==null?void 0:Ce._id)??null}}}catch{v(!1),h("Could not load pages or microsite. Check your connection and try again.");return}v(!1),c(Te??""),d(Pt=>Pt+1),k(null),s(!0)},Ye=()=>{s(!1),c(null),k(null),x(!1)},rt=async()=>{var Te;if(k(null),!P.event||!P.slug.trim()||!I){k("Select an event, save a microsite template, and set a URL slug.");return}x(!0);try{const et=await qw(m.current),Pt=await ha.update(P.event,I,{micrositeHtml:et});if(Pt.error)throw new Error(Pt.error);const qe=await ha.publish(P.event,I,{targets:"draft"});if(qe.error)throw new Error(qe.error);(Te=qe.data)!=null&&Te.publicUrl&&H(qe.data.publicUrl),t==null||t()}catch(et){k(et instanceof Error?et.message:"Could not save or publish draft.")}finally{x(!1)}},He=async()=>{var Te;if(k(null),!P.event||!P.slug.trim()||!I){k("Select an event, save a microsite template, and set a URL slug.");return}x(!0);try{const et=await qw(m.current),Pt=await ha.update(P.event,I,{micrositeHtml:et});if(Pt.error)throw new Error(Pt.error);const qe=await ha.publish(P.event,I,{targets:"both"});if(qe.error)throw new Error(qe.error);(Te=qe.data)!=null&&Te.publicUrl&&H(qe.data.publicUrl),t==null||t()}catch(et){k(et instanceof Error?et.message:"Could not publish.")}finally{x(!1)}},xt=(Te,et)=>{if(et){if(P.micrositeSections.includes(Te))return;se("micrositeSections",[...P.micrositeSections,Te])}else se("micrositeSections",P.micrositeSections.filter(Pt=>Pt!==Te))};return i.jsxs(i.Fragment,{children:[i.jsxs(ra,{onClose:e,title:"Configure event microsite",breadcrumb:"Design · Microsite Templates",description:"Set URL slug, layout shell, sections, and publish static HTML to your web host.",completedCount:_.done.size,totalSections:j,ctaLabel:"Save microsite",ctaDisabled:V||!P.event||!P.slug.trim(),onCtaClick:Pe,children:[G&&i.jsx("div",{style:{padding:"8px 12px",borderRadius:"var(--radius-button)",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",marginBottom:"8px"},children:G}),i.jsxs(Ur,{n:1,title:"Event & URL",subtitle:"Associate an event and public folder slug",open:_.open===1,completed:_.done.has(1),onToggle:()=>_.toggle(1),onSave:async()=>{await Se()&&_.advance(1)},nextDisabled:V,nextLabel:"Save & next",children:[i.jsx(ro,{cols:2,children:i.jsxs(dt,{span2:!1,children:[i.jsx(ht,{text:"Event",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:P.event,onChange:Te=>se("event",Te.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select event…"}),T.map(Te=>i.jsx("option",{value:Te._id,children:Te.name},Te._id))]})}),ue&&i.jsx(Vt,{text:`Editing: ${ue}`})]})}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Microsite template"}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,disabled:!P.event||F,value:I??"__new__",onChange:Te=>{const et=Te.target.value;if(et==="__new__"){R(null);const qe=T.find(Et=>Et._id===P.event);N(Et=>({...Et,templateName:"",slug:qe?kq(qe.name):Et.slug,sourcePageId:""}));return}R(et);const Pt=O.find(qe=>qe._id===et);Pt&&De(Pt)},onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"__new__",children:"+ New template…"}),O.map(Te=>i.jsxs("option",{value:Te._id,children:[(Te.name||Te.publishFolder||"Untitled").trim(),Te.publishFolder?` · /${Te.publishFolder}`:""]},Te._id))]})}),F?i.jsx(Vt,{text:"Loading templates…"}):i.jsx(Vt,{text:"Each template has its own URL slug and static output folder."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Template label"}),i.jsx("input",{style:Ht,placeholder:"e.g. Main site, Sponsor landing",value:P.templateName,onChange:Te=>se("templateName",Te.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Admin use only; not shown on the public site."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Section source page"}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:P.sourcePageId,onChange:Te=>se("sourcePageId",Te.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Default (Home or first page)"}),Y.map(Te=>i.jsxs("option",{value:Te._id,children:[Te.title," (",Te.type,")"]},Te._id))]})}),i.jsx(Vt,{text:"Website Builder page whose sections drive generated blocks for publish and preview."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"URL slug",required:!0}),i.jsxs("div",{style:{display:"flex",alignItems:"center",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--input-background)"},children:[i.jsx("span",{style:{padding:"8px 10px",background:"var(--secondary)",borderRight:"1px solid var(--border)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",whiteSpace:"nowrap"},children:"https://web.eventbuzz.live/"}),i.jsx("input",{style:{...Ht,border:"none",borderRadius:0},placeholder:"your-event-2026",value:P.slug,onChange:Te=>se("slug",kq(Te.target.value)),onFocus:St,onBlur:jt})]}),i.jsx(Vt,{text:"Slug becomes the folder name for the published site."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description (LLM / generation brief)"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"80px"},placeholder:"Describe the event and microsite goals for future AI-generated customisation…",value:P.description,onChange:Te=>se("description",Te.target.value),onFocus:St,onBlur:jt})]})]}),i.jsxs(Ur,{n:2,title:"Layout & sections",subtitle:"Conference template sections and order",open:_.open===2,completed:_.done.has(2),onToggle:()=>_.toggle(2),onSave:async()=>{await Se()&&_.advance(2)},nextDisabled:V,nextLabel:"Save & next",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Color preset"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 8px",fontFamily:"var(--font-noto-sans)"},children:"Conference microsite only. Presets set Primary and Accent; you can fine-tune them under Branding. Published CSS uses those colours plus your font pairing."}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"8px"},children:IRe.map(Te=>{const et=P.primaryColor===Te.primary&&P.accentColor===Te.accent;return i.jsxs("button",{type:"button",onClick:()=>{se("primaryColor",Te.primary),se("accentColor",Te.accent)},style:{borderRadius:"var(--radius-button)",border:`2px solid ${et?"var(--primary)":"var(--border)"}`,overflow:"hidden",cursor:"pointer",background:"none",padding:0,transition:"border-color .12s"},children:[i.jsx("div",{style:{height:"36px",background:`linear-gradient(135deg, ${Te.primary} 0%, ${Te.accent} 100%)`}}),i.jsx("p",{style:{margin:"5px 0",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:et?"var(--primary)":"var(--muted)"},children:Te.label})]},Te.id)})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Sections"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 8px",fontFamily:"var(--font-noto-sans)"},children:["If you have a ",i.jsx("strong",{children:"Home"})," page in Website Builder with sections, publish uses that page's sections and order (and your edits). Otherwise these checkboxes define what goes out. Included sections are listed first; drag the grip to reorder."]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:ve.map(Te=>{const et=P.micrositeSections.includes(Te.id),Pt=P.micrositeSections.indexOf(Te.id),qe=ie===Te.id;return i.jsxs("div",{"data-microsite-section-id":Te.id,style:{display:"flex",alignItems:"center",gap:"10px",padding:"9px 12px",borderRadius:"var(--radius-button)",border:`1px solid ${et?"var(--primary)":"var(--border)"}`,background:et?"var(--accent)":"var(--card)",transition:"opacity .12s, border-color .12s",opacity:qe?.55:1},children:[i.jsx("input",{type:"checkbox",checked:et,onChange:Et=>xt(Te.id,Et.target.checked),style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"var(--primary)",flexShrink:0},"aria-label":`Include ${Te.label}`}),i.jsx("button",{type:"button",disabled:!et,onPointerDown:et?Et=>be(Et,Te.id):void 0,title:et?"Drag to reorder":void 0,"aria-label":et?`Reorder section ${Te.label}`:"Enable section to reorder",style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:et?qe?"grabbing":"grab":"default",padding:"6px",minWidth:"36px",minHeight:"36px",borderRadius:"4px",border:"none",background:"transparent",color:"var(--muted)",opacity:et?1:.35},children:i.jsx(wv,{size:16,"aria-hidden":!0})}),i.jsxs("div",{style:{flex:1},children:[i.jsxs("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:[Te.label,et&&i.jsxs("span",{style:{marginLeft:"8px",fontSize:"10px",fontWeight:"normal",color:"var(--muted)"},children:["Order ",Pt+1]})]}),i.jsx("p",{style:{margin:"1px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:Te.desc})]})]},Te.id)})}),i.jsx(Vt,{text:`Publish order: ${P.micrositeSections.length} section${P.micrositeSections.length!==1?"s":""} (saved checklist). Matching blocks on the section source page (or Home) supply custom content; others use event defaults.`})]})]}),i.jsxs(Ur,{n:3,title:"Branding",subtitle:"Colours and fonts used for the Conference layout published microsite",open:_.open===3,completed:_.done.has(3),onToggle:()=>_.toggle(3),onSave:async()=>{await Se()&&_.advance(3)},nextDisabled:V,nextLabel:"Save & next",children:[i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Primary colour"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)"},children:[i.jsx("input",{type:"color",value:P.primaryColor,onChange:Te=>se("primaryColor",Te.target.value),style:{width:"24px",height:"24px",border:"none",background:"none",cursor:"pointer",padding:0}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:P.primaryColor})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Accent colour"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)"},children:[i.jsx("input",{type:"color",value:P.accentColor,onChange:Te=>se("accentColor",Te.target.value),style:{width:"24px",height:"24px",border:"none",background:"none",cursor:"pointer",padding:0}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:P.accentColor})]})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Font pairing"}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:P.fontPair,onChange:Te=>se("fontPair",Te.target.value),onFocus:St,onBlur:jt,children:Kg.map(Te=>i.jsx("option",{value:Te,children:Te},Te))})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Registration form"}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:P.registrationFormId,onChange:Te=>se("registrationFormId",Te.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"None (use #register on page)"}),$.map(Te=>i.jsx("option",{value:Te._id,children:Te.name},Te._id))]})}),i.jsx(Vt,{text:"Register links use MICROSITE_REGISTRATION_URL_TEMPLATE on the server with {eventId} and {formId} when a form is selected."})]}),i.jsx(Vt,{text:"Static site uses the conference shell, conference-layout.css, conference-static.css, and inline theme variables."})]}),i.jsxs(Ur,{n:4,title:"Publishing",subtitle:"Enable site and write static files",open:_.open===4,completed:_.done.has(4),onToggle:()=>_.toggle(4),onSave:async()=>{await Se()&&_.advance(4)},nextDisabled:V,nextLabel:"Save microsite",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Status",required:!0}),i.jsx(Hi,{name:"msStatus",value:P.status,onChange:Te=>se("status",Te),options:ORe}),i.jsx(Vt,{text:"Draft writes files to {slug}_draft; Live writes to {slug}. The event’s canonical slug is unchanged."})]}),i.jsx(Nm,{text:"SEO"}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Page title (HTML <title>)"}),i.jsx("input",{style:Ht,placeholder:"e.g. NAPCON 2026",value:P.seoTitle,onChange:Te=>se("seoTitle",Te.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"SEO description (meta)"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"64px"},placeholder:"Search snippet for published index.html.",value:P.seoDescription,onChange:Te=>se("seoDescription",Te.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Visual editor"}),i.jsxs("button",{type:"button",disabled:!P.event||p,onClick:()=>void Ae(),style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"10px 18px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:!P.event||p?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:!P.event||p?.5:1},children:[i.jsx(T3,{size:18})," ",p?"Opening…":"Edit page with Microsite Builder"]}),f&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)",margin:"8px 0 0"},children:f}),i.jsx(Vt,{text:"Opens the GrapesJS Microsite Builder full screen on top of this panel (same event: Home page, or first page if there is no Home)."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Custom domain (optional)"}),i.jsx("input",{style:Ht,placeholder:"e.g. conference.example.com",value:P.customDomain,onChange:Te=>se("customDomain",Te.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"DNS setup is separate from this publish step."})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:"Password protection"}),i.jsx("p",{style:{margin:"2px 0 0",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Not applied to static export yet."})]}),i.jsx(LRe,{value:P.passwordProtect,onChange:Te=>se("passwordProtect",Te)})]}),P.passwordProtect&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Access password",required:!0}),i.jsx("input",{type:"password",style:Ht,placeholder:"Set password…",value:P.password,onChange:Te=>se("password",Te.target.value),onFocus:St,onBlur:jt})]}),Q&&i.jsx("div",{style:{padding:"8px 12px",borderRadius:"var(--radius-button)",background:"#fef2f2",color:"#b91c1c",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",marginBottom:"8px"},children:Q}),re&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:0},children:["Last published:"," ",i.jsx("a",{href:re,target:"_blank",rel:"noopener noreferrer",children:re})]}),i.jsx("button",{type:"button",disabled:z||!P.event||!P.slug.trim(),onClick:()=>void Ee(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"10px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:z?"wait":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",marginTop:"8px"},children:z?"Publishing…":"Publish microsite"}),i.jsx(Vt,{text:"Saves settings first, then writes to MICROSITE_STATIC_ROOT. Set MICROSITE_REGISTRATION_URL_TEMPLATE for registration form links."})]})]}),a&&I&&i.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Microsite visual editor",style:{position:"fixed",inset:0,zIndex:1e3,background:"var(--background)",display:"flex",flexDirection:"column"},children:[i.jsxs("div",{style:{flexShrink:0,borderBottom:"1px solid var(--border)",background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"12px 16px",flexWrap:"wrap"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",disabled:b||!P.slug.trim(),onClick:()=>void rt(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",cursor:b||!P.slug.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:b?.75:1},children:[i.jsx(sS,{size:16,"aria-hidden":!0})," ",b?"Working…":"Save (draft site)"]}),i.jsxs("button",{type:"button",disabled:b||!P.slug.trim(),onClick:()=>void He(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:b||!P.slug.trim()?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:b?.75:1},children:[i.jsx(j$,{size:16,"aria-hidden":!0})," Publish"]})]}),i.jsxs("button",{type:"button",onClick:Ye,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:[i.jsx(Gt,{size:16})," Close builder"]})]}),w?i.jsx("p",{style:{margin:0,padding:"0 16px 12px",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)"},children:w}):null]}),i.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:i.jsx(YX,{ref:m,pageId:l??"",eventId:P.event,micrositeId:I??void 0,variant:"fullscreen",mountNonce:u})})]})]})}function LRe({value:e,onChange:t}){return i.jsx("button",{type:"button",onClick:()=>t(!e),style:{width:"36px",height:"20px",borderRadius:"99px",border:"none",cursor:"pointer",flexShrink:0,background:e?"var(--primary)":"var(--border)",position:"relative",transition:"background .2s"},children:i.jsx("span",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"14px",height:"14px",borderRadius:"50%",background:"#fff",transition:"left .2s",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})}const f3=["Invitation","Save the Date","Registration Confirmation","Reminder","Post-Event Thank You","Newsletter","Custom"],ex=["Inter + Noto Sans","Merriweather + Open Sans","Poppins + Lato","Georgia + Source Sans"],eT=[{id:"e1",label:"Classic",accent:"#0B4DD1"},{id:"e2",label:"Bold Hero",accent:"#1E293B"},{id:"e3",label:"Minimal",accent:"#F1F5F9"},{id:"e4",label:"Magazine",accent:"#D97706"}],_q={"Inter + Noto Sans":"system-ui, -apple-system, 'Segoe UI', sans-serif","Merriweather + Open Sans":"Georgia, 'Merriweather', serif","Poppins + Lato":"'Poppins', 'Lato', system-ui, sans-serif","Georgia + Source Sans":"Georgia, 'Source Sans Pro', sans-serif"},p3=[{type:"text",icon:i.jsx(nte,{size:13}),label:"Text"},{type:"image",icon:i.jsx(jx,{size:13}),label:"Image"},{type:"cta",icon:i.jsx(Fre,{size:13}),label:"CTA Button"},{type:"divider",icon:i.jsx(oS,{size:13}),label:"Divider"}];let tT=0;function hh(e){const t=`blk-${++tT}`;return e==="text"?{id:t,type:"text",html:"<p><br></p>"}:e==="cta"?{id:t,type:"cta",label:"Register Now",linkKind:"custom",customUrl:""}:e==="image"?{id:t,type:"image",src:""}:{id:t,type:"divider"}}function Gc(e){return String(e||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function FRe(e,t){const r=String(e||"").trim();return r?`${("https://web.eventbuzz.live".trim()||!1||(typeof window<"u"?window.location.origin:"http://localhost:5173")).replace(/\/$/,"")}/form/${r}`:""}function zRe(e,t){if(e.linkKind==="custom")return String(e.customUrl||"").trim()||"#";if(e.linkKind==="form"){const r=t.forms.find(o=>o.id===e.formId);return(r==null?void 0:r.href)&&r.href.trim()||(e.formId?FRe(e.formId):"")||"#"}if(e.linkKind==="microsite"){const r=t.microsites.find(n=>n.id===e.micrositeId);return(r==null?void 0:r.href)&&r.href.trim()||"#"}return"#"}function Cq(e,t){var c,u,d,f;const r=((c=e.primaryColor)==null?void 0:c.trim())||((u=eT.find(h=>h.id===e.layoutTemplateId))==null?void 0:u.accent)||"#0B4DD1",n=_q[e.fontPair]||_q[ex[0]],o=(d=e.headerImageUrl)==null?void 0:d.trim(),a=e.blocks.map(h=>{var p,v;if(h.type==="text")return`<div style="margin:12px 0;font-size:15px;line-height:1.55;color:#334155;">${(p=h.html)!=null&&p.trim()?h.html:""}</div>`;if(h.type==="image"&&((v=h.src)!=null&&v.trim()))return`<p style="text-align:center;margin:16px 0;"><img src="${Gc(h.src.trim())}" alt="" style="max-width:100%;border-radius:8px;" /></p>`;if(h.type==="cta"){const m=Gc(zRe(h,t)),b=Gc(h.label||"Register");return`<p style="text-align:center;margin:20px 0;"><a href="${m}" style="display:inline-block;padding:12px 24px;background:${Gc(r)};color:#fff;text-decoration:none;border-radius:8px;font-weight:600;">${b}</a></p>`}return h.type==="divider"?'<hr style="border:none;border-top:1px solid #e2e8f0;margin:20px 0;" />':""}).join(`
`),s=(f=e.previewText)==null?void 0:f.trim(),l=s?`<div style="display:none;font-size:1px;color:#fff;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;">${Gc(s)}</div>`:"";return`<!DOCTYPE html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/></head>
<body style="margin:0;padding:0;background:#f8fafc;font-family:${n};">
${l}
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background:#f8fafc;padding:24px 12px;">
<tr><td align="center">
<table role="presentation" width="600" cellspacing="0" cellpadding="0" style="max-width:600px;background:#ffffff;border-radius:12px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.08);">
${o?`<tr><td><img src="${Gc(o)}" alt="" width="600" style="display:block;width:100%;height:auto;"/></td></tr>`:""}
<tr><td style="padding:24px 28px 8px;">
${s?`<p style="margin:0 0 8px;font-size:12px;color:#64748b;">${Gc(s)}</p>`:""}
</td></tr>
<tr><td style="padding:0 28px 24px;">${a}</td></tr>
<tr><td style="padding:16px 28px 24px;border-top:1px solid #f1f5f9;">
<p style="margin:0;font-size:12px;color:#94a3b8;">${Gc(e.footerText)}</p>
</td></tr>
</table>
</td></tr></table>
</body></html>`}function MRe(e){const t=e.blocks,r=typeof e.ctaUrl=="string"?e.ctaUrl:"";let n="";if(typeof e.headerText=="string"&&e.headerText.trim()&&(n=`<h1 style="margin:0 0 16px;font-size:22px;color:#0f172a;">${Gc(e.headerText.trim())}</h1>`),!Array.isArray(t)||t.length===0){const s=hh("text");return[s.type==="text"?{...s,html:n+s.html}:s,hh("cta")]}const o=[];for(let s=0;s<t.length;s++){const l=t[s],c=typeof l.id=="string"?l.id:`blk-${s}-${Date.now()}`;if(l.type==="text"){let u=typeof l.html=="string"?l.html:"";!u&&typeof l.text=="string"&&(u=`<p style="margin:12px 0;font-size:15px;line-height:1.5;color:#334155;">${Gc(String(l.text)).replace(/\n/g,"<br/>")}</p>`),s===0&&n&&(u=n+(u||"")),o.push({id:c,type:"text",html:u||"<p><br></p>"})}else if(l.type==="cta")o.push({id:c,type:"cta",label:String(l.label??l.text??"Register"),linkKind:["form","microsite","custom"].includes(String(l.linkKind))?l.linkKind:"custom",formId:typeof l.formId=="string"?l.formId:void 0,micrositeId:typeof l.micrositeId=="string"?l.micrositeId:void 0,customUrl:String(l.customUrl??r??"")});else if(l.type==="image"){const u=typeof l.src=="string"?l.src:String(l.text??"");o.push({id:c,type:"image",src:u})}else l.type==="divider"&&o.push({id:c,type:"divider"})}const a=o.map(s=>parseInt(String(s.id).replace(/\D/g,""),10)||0);return tT=Math.max(tT,...a,0),o.length?o:[hh("text"),hh("cta")]}function DRe({onClose:e,templateId:t,onSuccess:r}){const{user:n}=Mr(),o=Nn(n),a=!!t,s=3,l=wc(s),[c,u]=S.useState([]),[d,f]=S.useState({forms:[],microsites:[]}),[h,p]=S.useState([]),[v,m]=S.useState({name:"",emailerType:f3[0],associatedEvent:"",description:"",layoutTemplateId:"e1",headerImageUrl:"",primaryColor:"#0B4DD1",fontPair:ex[0],previewText:"",subjectLine:"",blocks:[hh("text"),hh("cta")],footerText:"© 2026 EventBuzz · Unsubscribe"}),[b,x]=S.useState(!1),[w,k]=S.useState(!1),[j,_]=S.useState(null),[T,A]=S.useState(!1),[P,N]=S.useState(""),[O,C]=S.useState(!1),[I,R]=S.useState(""),[F,M]=S.useState(""),[Y,X]=S.useState(""),$=S.useCallback((K,re)=>{m(H=>({...H,[K]:re}))},[]);S.useEffect(()=>{o&&(Lr.list({limit:200,organization:o}).then(K=>{var re;(re=K.data)!=null&&re.events&&u(K.data.events)}),qa.list({organization:o}).then(K=>{var re;(re=K.data)!=null&&re.lists&&p(K.data.lists)}))},[o]),S.useEffect(()=>{var re;const K=(re=v.associatedEvent)==null?void 0:re.trim();if(!K){f({forms:[],microsites:[]});return}Lr.emailerLinkTargets(K).then(H=>{H.data&&f(H.data)})},[v.associatedEvent]),S.useEffect(()=>{v.associatedEvent&&!I&&R(v.associatedEvent)},[v.associatedEvent,I]),S.useEffect(()=>{t&&Vs.get(t).then(K=>{if(!K.data)return;const re=K.data,H=re.content||{},ie=MRe(H),de=re.associatedEvent,le=typeof de=="string"?de:(de==null?void 0:de._id)??"";m(ke=>{var ve;return{...ke,name:re.name,emailerType:re.category||f3[0],associatedEvent:le,description:typeof H.description=="string"?H.description:"",layoutTemplateId:String(H.layoutTemplateId||H.templateId||"e1"),headerImageUrl:String(H.headerImageUrl||""),primaryColor:String(H.primaryColor||((ve=eT.find(se=>se.id===H.templateId))==null?void 0:ve.accent)||"#0B4DD1"),fontPair:ex.includes(String(H.fontPair))?String(H.fontPair):ex[0],previewText:String(H.previewText||""),subjectLine:String(H.subjectLine||H.subject||H.headerText||""),footerText:String(H.footerText||ke.footerText),blocks:ie}})})},[t]);const ee=S.useCallback((K,re)=>{m(H=>({...H,blocks:H.blocks.map(ie=>ie.id===K?{...ie,...re}:ie)}))},[]),V=S.useCallback(K=>{m(re=>({...re,blocks:[...re.blocks,hh(K)]}))},[]),D=S.useCallback(K=>{m(re=>({...re,blocks:re.blocks.filter(H=>H.id!==K)}))},[]),z=S.useCallback(()=>{N(Cq(v,d)),A(!0)},[v,d]),q=async K=>{var re;if(!(!K||!o)){k(!0);try{const H=await Sa(K,{eventId:((re=v.associatedEvent)==null?void 0:re.trim())||void 0,module:"emailer"});H.url&&$("headerImageUrl",H.url)}finally{k(!1)}}},G=async(K,re)=>{var H;if(!(!re||!o)){_(K);try{const ie=await Sa(re,{eventId:((H=v.associatedEvent)==null?void 0:H.trim())||void 0,module:"emailer"});ie.url&&ee(K,{src:ie.url})}finally{_(null)}}},U=(K,re)=>{const H=v.blocks.find(de=>de.id===K);if(!H||H.type!=="text")return;const ie=(H.html||"")+re;ee(K,{html:ie})},Q=async()=>{if(X(""),O&&!a){if(!(I.trim()||v.associatedEvent.trim())){X("Select an event for the draft campaign.");return}if(!F.trim()){X("Select a contact list.");return}}x(!0);const re={html:Cq(v,d),version:2,blocks:v.blocks,subjectLine:v.subjectLine,previewText:v.previewText,footerText:v.footerText,primaryColor:v.primaryColor,fontPair:v.fontPair,headerImageUrl:v.headerImageUrl,layoutTemplateId:v.layoutTemplateId,description:v.description||void 0},H={name:v.name,type:"emailer",category:v.emailerType||void 0,content:re,associatedEvent:v.associatedEvent.trim()||null},ie=a?await Vs.update(t,H):await Vs.create(H);if(x(!1),ie.error)return;const de=ie.data,le=(de==null?void 0:de._id)||t;if(O&&!a&&le){const ke=I.trim()||v.associatedEvent.trim(),ve=await fo.create(ke,{name:v.name.trim(),channel:"email",type:"broadcast",recipients:{type:"participant_list",participantList:F.trim()},content:{template:le,subject:v.subjectLine.trim(),body:""}});if(ve.error){const se=typeof ve.error=="string"?ve.error:"Template saved but campaign could not be created.";X(se),r==null||r();return}}r==null||r(),e()};return i.jsxs(i.Fragment,{children:[i.jsxs(ra,{onClose:e,title:a?"Edit Emailer":"Create Emailer",breadcrumb:"Design · Emailers",description:"Design a branded HTML emailer and optional draft campaign.",completedCount:l.done.size,totalSections:s,ctaLabel:a?"Save changes":"Save emailer",ctaDisabled:b||!v.name.trim(),onCtaClick:Q,children:[i.jsxs(Ur,{n:1,title:"Emailer details",subtitle:"Name, type, optional event",open:l.open===1,completed:l.done.has(1),onToggle:()=>l.toggle(1),onSave:()=>l.advance(1),nextLabel:"Design",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Emailer name",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. NAPCON 2026 — Registration invite",value:v.name,onChange:K=>$("name",K.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Internal name — not shown to recipients."})]}),i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Type",required:!0}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:v.emailerType,onChange:K=>$("emailerType",K.target.value),onFocus:St,onBlur:jt,children:f3.map(K=>i.jsx("option",{value:K,children:K},K))})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Associated event"}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:v.associatedEvent,onChange:K=>$("associatedEvent",K.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"None"}),c.map(K=>i.jsx("option",{value:K._id,children:K.name},K._id))]})}),i.jsx(Vt,{text:"Used for media uploads, form/microsite CTAs, and default campaign event."})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"60px"},placeholder:"Optional notes (stored in template content)…",value:v.description,onChange:K=>$("description",K.target.value),onFocus:St,onBlur:jt})]})]}),i.jsxs(Ur,{n:2,title:"Design",subtitle:"Layout, colour, font, header image",open:l.open===2,completed:l.done.has(2),onToggle:()=>l.toggle(2),onSave:()=>l.advance(2),nextLabel:"Content",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Base template",required:!0}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"8px"},children:eT.map(K=>i.jsxs("button",{type:"button",onClick:()=>{$("layoutTemplateId",K.id),$("primaryColor",K.accent)},style:{borderRadius:"var(--radius-button)",border:`2px solid ${v.layoutTemplateId===K.id?"var(--primary)":"var(--border)"}`,overflow:"hidden",cursor:"pointer",background:"none",padding:0},children:[i.jsxs("div",{style:{height:"56px",background:K.accent,display:"flex",flexDirection:"column",justifyContent:"flex-end",padding:"6px"},children:[i.jsx("div",{style:{height:"4px",borderRadius:"2px",background:"rgba(255,255,255,0.5)",marginBottom:"3px"}}),i.jsx("div",{style:{height:"3px",borderRadius:"2px",background:"rgba(255,255,255,0.3)"}})]}),i.jsx("p",{style:{margin:"5px 0",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:v.layoutTemplateId===K.id?"var(--primary)":"var(--muted)"},children:K.label})]},K.id))})]}),i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Primary colour"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)"},children:[i.jsx("input",{type:"color",value:v.primaryColor,onChange:K=>$("primaryColor",K.target.value),style:{width:"24px",height:"24px",border:"none",background:"none",cursor:"pointer",padding:0}}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:v.primaryColor})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Font"}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:v.fontPair,onChange:K=>$("fontPair",K.target.value),onFocus:St,onBlur:jt,children:ex.map(K=>i.jsx("option",{value:K,children:K},K))})})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Header image"}),i.jsx("input",{style:Ht,placeholder:"https://…",value:v.headerImageUrl,onChange:K=>$("headerImageUrl",K.target.value),onFocus:St,onBlur:jt}),i.jsxs("div",{style:{marginTop:8},children:[i.jsx("input",{type:"file",accept:"image/*",disabled:w||!o,onChange:K=>{var re;return void q(((re=K.target.files)==null?void 0:re[0])??null)}}),w&&i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginLeft:8},children:"Uploading…"})]}),i.jsx(Vt,{text:"Recommended: 600×200px. Uses org library upload."})]})]}),i.jsxs(Ur,{n:3,title:"Content blocks",subtitle:"Preview text, subject, body",open:l.open===3,completed:l.done.has(3),onToggle:()=>l.toggle(3),onSave:()=>l.advance(3),nextLabel:"Done",children:[i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{span2:!0,children:[i.jsx(ht,{text:"Preview text"}),i.jsx("input",{style:Ht,placeholder:"Short preview shown in inbox…",value:v.previewText,onChange:K=>$("previewText",K.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:`${v.previewText.length}/90 chars`})]}),i.jsxs(dt,{span2:!0,children:[i.jsx(ht,{text:"Subject line"}),i.jsx("input",{style:Ht,placeholder:"Supports {{event.name}} etc.",value:v.subjectLine,onChange:K=>$("subjectLine",K.target.value),onFocus:St,onBlur:jt})]})]}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:10},children:$w.map(K=>i.jsx("button",{type:"button",onClick:()=>$("subjectLine",v.subjectLine+K.token),style:Eq,children:K.label},K.token))}),i.jsx(Qae,{}),i.jsx(Nm,{text:"Body blocks"}),!v.associatedEvent.trim()&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 8px"},children:"Select an associated event to load forms and microsites for CTA buttons."}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:v.blocks.map((K,re)=>{var H,ie;return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-button)",overflow:"hidden",background:"var(--card)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",background:"var(--secondary)",borderBottom:K.type!=="divider"?"1px solid var(--border)":"transparent"},children:[i.jsx("span",{style:{color:"var(--muted)",display:"flex"},children:(H=p3.find(de=>de.type===K.type))==null?void 0:H.icon}),i.jsxs("span",{style:{flex:1,fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)"},children:[(ie=p3.find(de=>de.type===K.type))==null?void 0:ie.label," #",re+1]}),i.jsx("button",{type:"button",onClick:()=>D(K.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"2px"},children:i.jsx(Gt,{size:12})})]}),K.type==="text"&&i.jsxs("div",{style:{padding:"10px 12px"},children:[i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginBottom:8},children:$w.map(de=>i.jsx("button",{type:"button",onClick:()=>U(K.id,de.token),style:Eq,children:de.label},de.token))}),i.jsx(KX,{value:K.html,onChange:de=>ee(K.id,{html:de}),placeholder:"Compose…"})]}),K.type==="cta"&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"10px 12px"},children:[i.jsx("input",{style:Ht,placeholder:"Button label",value:K.label,onChange:de=>ee(K.id,{label:de.target.value}),onFocus:St,onBlur:jt}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:K.linkKind,onChange:de=>ee(K.id,{linkKind:de.target.value,formId:void 0,micrositeId:void 0}),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"form",children:"Form"}),i.jsx("option",{value:"microsite",children:"Event microsite"}),i.jsx("option",{value:"custom",children:"Custom URL"})]})}),K.linkKind==="form"&&i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:K.formId||"",onChange:de=>ee(K.id,{formId:de.target.value||void 0}),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select form…"}),d.forms.map(de=>i.jsxs("option",{value:de.id,children:[de.name,de.href?"":" (configure registration URL)"]},de.id))]})}),K.linkKind==="microsite"&&i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:K.micrositeId||"",onChange:de=>ee(K.id,{micrositeId:de.target.value||void 0}),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select microsite…"}),d.microsites.map(de=>i.jsx("option",{value:de.id,children:de.name},de.id))]})}),K.linkKind==="custom"&&i.jsx("input",{style:Ht,placeholder:"https://…",value:K.customUrl||"",onChange:de=>ee(K.id,{customUrl:de.target.value}),onFocus:St,onBlur:jt})]}),K.type==="image"&&i.jsxs("div",{style:{padding:"10px 12px"},children:[i.jsx("input",{style:Ht,placeholder:"Image URL",value:K.src,onChange:de=>ee(K.id,{src:de.target.value}),onFocus:St,onBlur:jt}),i.jsx("div",{style:{marginTop:8},children:i.jsx("input",{type:"file",accept:"image/*",disabled:j===K.id||!o,onChange:de=>{var le;return void G(K.id,((le=de.target.files)==null?void 0:le[0])??null)}})})]}),K.type==="divider"&&i.jsx("div",{style:{padding:"10px 12px"},children:i.jsx("div",{style:{height:"1px",background:"var(--border)"}})})]},K.id)})}),i.jsx("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",marginTop:8},children:p3.map(K=>i.jsxs("button",{type:"button",onClick:()=>V(K.type),style:BRe,children:[i.jsx(gr,{size:11})," ",K.label]},K.type))}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Footer text"}),i.jsx("input",{style:Ht,value:v.footerText,onChange:K=>$("footerText",K.target.value),onFocus:St,onBlur:jt})]})]}),i.jsxs("div",{style:{padding:"16px 20px 24px",borderTop:"1px solid var(--border)",display:"flex",flexDirection:"column",gap:12},children:[Y&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:Y}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:i.jsx("button",{type:"button",onClick:z,style:WRe,children:"Preview emailer"})}),!a&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("input",{type:"checkbox",checked:O,onChange:K=>C(K.target.checked)}),"Create a campaign (draft)"]}),O&&i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Campaign event",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:I,onChange:K=>R(K.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select…"}),c.map(K=>i.jsx("option",{value:K._id,children:K.name},K._id))]})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Contact list",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:F,onChange:K=>M(K.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select…"}),h.map(K=>i.jsx("option",{value:K._id,children:K.name},K._id))]})})]})]})]})]})]}),T&&i.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",zIndex:400,display:"flex",alignItems:"center",justifyContent:"center",padding:24},onClick:()=>A(!1),children:i.jsxs("div",{role:"dialog","aria-label":"Email preview",style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:720,maxHeight:"90vh",display:"flex",flexDirection:"column",border:"1px solid var(--border)",boxShadow:"0 20px 40px rgba(0,0,0,0.2)"},onClick:K=>K.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)"},children:[i.jsx("span",{style:{fontWeight:600},children:"Preview"}),i.jsx("button",{type:"button","aria-label":"Close",onClick:()=>A(!1),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:18})})]}),i.jsx("iframe",{title:"Email preview",srcDoc:P,sandbox:"allow-same-origin",style:{flex:1,minHeight:420,border:"none",width:"100%"}})]})})]})}const Eq={fontSize:"10px",padding:"4px 8px",borderRadius:99,border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",fontFamily:"var(--font-noto-sans)"},BRe={display:"flex",alignItems:"center",gap:5,padding:"5px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},WRe={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},Aq=["Brochure","Microsite Template","Badge","Emailer","Other"],Tq=["None (Design Library only)","NAPCON 2026 Media Kit","Sponsor Assets","Speaker Bios & Photos"],qRe=[{label:"Private (team only)",value:"Private"},{label:"Shared (all admins)",value:"Shared"}],$Re=[{label:"Create new copy",value:"new"},{label:"Overwrite existing",value:"overwrite"}],h3=[".fig",".pdf",".pptx",".ai",".eps",".zip",".png",".jpg",".jpeg",".svg",".html"],Pq={".fig":"Figma",".pdf":"PDF",".pptx":"PowerPoint",".ai":"Illustrator",".eps":"EPS",".zip":"Archive",".png":"PNG",".jpg":"JPEG",".jpeg":"JPEG",".svg":"SVG",".html":"HTML"};function URe(e){return e<1024?e+" B":e<1048576?(e/1024).toFixed(1)+" KB":(e/1048576).toFixed(1)+" MB"}function HRe({onClose:e,defaultType:t}){var j;const{user:r}=Mr(),n=Nn(r),o=3,a=wc(o),s=S.useRef(null),[l,c]=S.useState([]),[u,d]=S.useState(!1),[f,h]=S.useState([]),[p,v]=S.useState({importType:t??Aq[0],name:"",event:"",collection:Tq[0],tags:"",visibility:"Private",conflictMode:"new"}),m=(_,T)=>v(A=>({...A,[_]:T}));S.useEffect(()=>{n&&Lr.list({limit:100,organization:n}).then(_=>{var T;(T=_.data)!=null&&T.events&&(c(_.data.events),v(A=>{var P;return{...A,event:A.event||((P=_.data.events[0])==null?void 0:P._id)||""}}))})},[n]);const b=_=>{const T=Array.from(_).map(A=>{const P="."+A.name.split(".").pop().toLowerCase(),N=h3.includes(P);return{id:Math.random().toString(36).slice(2),name:A.name,size:URe(A.size),ext:P,progress:0,error:N?void 0:`Unsupported format: ${P}`}});if(h(A=>[...A,...T]),T.filter(A=>!A.error).forEach(A=>{let P=0;const N=setInterval(()=>{P=Math.min(100,P+Math.random()*30+10),h(O=>O.map(C=>C.id===A.id?{...C,progress:Math.round(P)}:C)),P>=100&&clearInterval(N)},180)}),T.length>0&&!p.name){const A=T[0].name.replace(/\.[^.]+$/,"").replace(/[-_]/g," ");m("name",A)}},x=_=>h(T=>T.filter(A=>A.id!==_)),w=f.filter(_=>!_.error),k=f.filter(_=>_.error);return i.jsxs(ra,{onClose:e,title:"Import Design",breadcrumb:"Design · Import",description:"Import design files from Figma, PDF, PowerPoint, Illustrator and more.",completedCount:a.done.size,totalSections:o,ctaLabel:"Import",children:[i.jsxs(Ur,{n:1,title:"Upload Files",subtitle:"Drag and drop or select files to import",open:a.open===1,completed:a.done.has(1),onToggle:()=>a.toggle(1),onSave:()=>a.advance(1),nextLabel:"Import Settings",children:[i.jsxs("div",{onClick:()=>{var _;return(_=s.current)==null?void 0:_.click()},onDragOver:_=>{_.preventDefault(),d(!0)},onDragLeave:()=>d(!1),onDrop:_=>{_.preventDefault(),d(!1),b(_.dataTransfer.files)},style:{border:`2px dashed ${u?"var(--primary)":"var(--border)"}`,borderRadius:"var(--radius-card)",background:u?"var(--accent)":"var(--secondary)",padding:"32px 20px",display:"flex",flexDirection:"column",alignItems:"center",gap:"10px",cursor:"pointer",transition:"all .15s"},children:[i.jsx("input",{ref:s,type:"file",multiple:!0,style:{display:"none"},accept:h3.join(","),onChange:_=>_.target.files&&b(_.target.files)}),i.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"var(--card)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(Fl,{size:22,style:{color:"var(--primary)"}})}),i.jsxs("div",{style:{textAlign:"center"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",margin:"0 0 4px"},children:"Drag and drop design files here"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:["or ",i.jsx("span",{style:{color:"var(--primary)",textDecoration:"underline"},children:"select files"})]})]})]}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:h3.map(_=>i.jsx("span",{style:{padding:"2px 7px",borderRadius:"99px",border:"1px solid var(--border)",background:"var(--secondary)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:Pq[_]},_))}),f.length>0&&i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:f.map(_=>i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:_.error?"var(--destructive-foreground, #FEF2F2)":"var(--secondary)",borderRadius:"var(--radius-button)",border:`1px solid ${_.error?"var(--destructive)":"var(--border)"}`},children:[_.error?i.jsx(Wh,{size:16,style:{color:"var(--destructive)",flexShrink:0}}):i.jsx(mT,{size:16,style:{color:"var(--primary)",flexShrink:0}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:_.name}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:_.error?"var(--destructive)":"var(--muted)",margin:"2px 0 0"},children:_.error??_.size}),!_.error&&_.progress<100&&i.jsx("div",{style:{height:"3px",background:"var(--border)",borderRadius:"99px",marginTop:"4px"},children:i.jsx("div",{style:{height:"100%",width:`${_.progress}%`,background:"var(--primary)",borderRadius:"99px",transition:"width .3s"}})})]}),!_.error&&_.progress===100&&i.jsx(yv,{size:14,style:{color:"#22c55e",flexShrink:0}}),i.jsx("button",{onClick:()=>x(_.id),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",flexShrink:0},children:i.jsx(Gt,{size:13})})]},_.id))}),k.length>0&&i.jsx(Vt,{text:`${k.length} file${k.length!==1?"s":""} skipped — unsupported format.`})]}),i.jsxs(Ur,{n:2,title:"Import Settings",subtitle:"What type of asset is this and which event does it belong to?",open:a.open===2,completed:a.done.has(2),onToggle:()=>a.toggle(2),onSave:()=>a.advance(2),nextLabel:"Organise & Tags",children:[i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Import As",required:!0}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:p.importType,onChange:_=>m("importType",_.target.value),onFocus:St,onBlur:jt,children:Aq.map(_=>i.jsx("option",{children:_},_))})}),i.jsx(Vt,{text:"Sets the category in your Design library."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Associated Event",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:p.event,onChange:_=>m("event",_.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:"Select event…"}),l.map(_=>i.jsx("option",{value:_._id,children:_.name},_._id))]})})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Display Name",required:!0}),i.jsx("input",{style:Ht,placeholder:"e.g. NAPCON 2026 Official Brochure",value:p.name,onChange:_=>m("name",_.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Name shown in the Design library."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"If Asset Already Exists"}),i.jsx(Hi,{name:"importConflict",value:p.conflictMode,onChange:_=>m("conflictMode",_),options:$Re})]}),w.length>0&&i.jsxs("div",{style:{background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",padding:"10px 14px"},children:[i.jsx(Nm,{text:"Detected Format"}),i.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:[...new Set(w.map(_=>Pq[_.ext]??_.ext))].map(_=>i.jsx(u2,{text:_},_))})]})]}),i.jsxs(Ur,{n:3,title:"Organise & Tags",subtitle:"Add to a collection, tag and set visibility",open:a.open===3,completed:a.done.has(3),onToggle:()=>a.toggle(3),onSave:()=>a.advance(3),nextLabel:"Import",children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Add to Collection"}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:p.collection,onChange:_=>m("collection",_.target.value),onFocus:St,onBlur:jt,children:Tq.map(_=>i.jsx("option",{children:_},_))})}),i.jsx(Vt,{text:"You can add to more collections later from the Content tab."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Tags"}),i.jsx("input",{style:Ht,placeholder:"e.g. brochure, 2026, print — separate with commas",value:p.tags,onChange:_=>m("tags",_.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Visibility",required:!0}),i.jsx(Hi,{name:"importVis",value:p.visibility,onChange:_=>m("visibility",_),options:qRe}),i.jsx(Vt,{text:"Shared assets are visible to all admins and editors."})]}),i.jsxs("div",{style:{background:"var(--secondary)",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",padding:"12px 14px"},children:[i.jsx(Nm,{text:"Import Summary"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"3px"},children:[["Files",`${w.length} file${w.length!==1?"s":""}`],["Import As",p.importType],["Event",((j=l.find(_=>_._id===p.event))==null?void 0:j.name)??"—"],["Collection",p.collection.replace("None (Design Library only)","None")],["Visibility",p.visibility]].map(([_,T])=>i.jsxs("div",{style:{display:"flex",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",minWidth:"90px"},children:_}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:T})]},_))})]})]})]})}const rg={fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"};function hI({minWidth:e,children:t}){return i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:i.jsx("div",{style:{overflowX:"auto"},children:i.jsx("div",{style:{minWidth:e??500},children:t})})})}function Iq({icon:e,title:t,description:r,cta:n,onCta:o}){return i.jsxs("div",{style:{textAlign:"center",padding:"72px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx("div",{style:{color:"var(--border)",marginBottom:"14px",display:"flex",justifyContent:"center"},children:e}),i.jsx("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:t}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:n?"20px":"0"},children:r}),n&&o&&i.jsxs("button",{onClick:o,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," ",n]})]})}const VRe={"design-brochure":"brochure","design-microsite":"microsite","design-badges":"badge","design-emailers":"emailer"},YRe={Brochure:i.jsx(jx,{size:22,style:{color:"var(--muted)"}}),"Microsite Templates":i.jsx(w$,{size:22,style:{color:"var(--muted)"}}),Badges:i.jsx(Cx,{size:22,style:{color:"var(--muted)"}}),Emailers:i.jsx(Xf,{size:22,style:{color:"var(--muted)"}})};function Oq(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),o=Math.floor(n/(1440*60*1e3));return o===0?"Today":o===1?"Yesterday":o<7?`${o} days ago`:o<30?`${Math.floor(o/7)} week(s) ago`:o<365?`${Math.floor(o/30)} month(s) ago`:t.toLocaleDateString()}function GRe({subPage:e}){const{user:t}=Mr(),n=Si()==="mobile",o=e==="design-brochure"?"Brochure":e==="design-microsite"?"Microsite Templates":e==="design-badges"?"Badges":e==="design-emailers"?"Emailers":"Brochure",a=e&&VRe[e]||"brochure",s=(t==null?void 0:t.role)==="super_admin",l=a==="microsite"&&t&&["super_admin","admin","moderator"].includes(t.role),c=!!(t&&["super_admin","admin","moderator"].includes(t.role)),[u,d]=S.useState([]),[f,h]=S.useState([]),[p,v]=S.useState(!1),[m,b]=S.useState(!0),[x,w]=S.useState(null),[k,j]=S.useState([]),[_,T]=S.useState([]),[A,P]=S.useState(!1),[N,O]=S.useState(null),[C,I]=S.useState(null),[R,F]=S.useState(!1),[M,Y]=S.useState(!1),[X,$]=S.useState(!1),[ee,V]=S.useState(null),[D,z]=S.useState(!1),[q,G]=S.useState(!1),[U,Q]=S.useState(null),[K,re]=S.useState(null),[H,ie]=S.useState(null),[de,le]=S.useState(null),[ke,ve]=S.useState(null),[se,be]=S.useState(null),[De,ae]=S.useState(null),[ue,Me]=S.useState(null),Se=S.useCallback(qe=>{const Et=(qe==null?void 0:qe.badgeSoftRefresh)===!0;if(a==="microsite"){b(!1),d([]),P(!0),O(null),T([]);const Ft=Nn(t);if(!Ft){j([]),O(s?"Assign an organisation to your account to load events.":"Your profile has no organisation."),P(!1);return}Promise.all([Lr.list({limit:100,organization:Ft}),ha.listForOrganization(Ft)]).then(([Ce,lt])=>{var Xe;((Xe=Ce.data)==null?void 0:Xe.events)!=null?j(Ce.data.events):(j([]),O(Ce.error||"Failed to load events")),lt.error||!lt.data?T([]):T(lt.data)}).catch(()=>{j([]),T([]),O("Failed to load events")}).finally(()=>P(!1));return}if(a==="badge"){P(!1),Et?v(!0):b(!0),w(null),d([]);const Ft=Nn(t);if(!Ft){h([]),w(s?"Assign an organisation to your account to load badge exports.":"Your profile has no organisation."),Et?v(!1):b(!1);return}wx.list({organization:Ft,limit:100}).then(Ce=>{var lt;((lt=Ce.data)==null?void 0:lt.batches)!=null?h(Ce.data.batches):w(Ce.error||"Failed to load badge exports")}).catch(()=>w("Failed to load badge exports")).finally(()=>{Et?v(!1):b(!1)});return}P(!1),b(!0),w(null);const vt=Nn(t);if(!vt){d([]),w(s?"Assign an organisation to your account (or use an org-scoped user) to load design templates.":"Your profile has no organisation."),b(!1);return}Vs.list({type:a,limit:100,organization:vt}).then(Ft=>{var Ce;((Ce=Ft.data)==null?void 0:Ce.templates)!=null?d(Ft.data.templates):w(Ft.error||"Failed to load templates")}).catch(()=>w("Failed to load templates")).finally(()=>b(!1))},[a,t,s]);S.useEffect(()=>{Se()},[Se]);const Pe=()=>{Q(null),re(null),o==="Brochure"?F(!0):o==="Microsite Templates"?Y(!0):o==="Badges"?(V(null),$(!0)):o==="Emailers"&&z(!0)},Ee=qe=>{Q(qe._id),a==="brochure"?F(!0):a==="emailer"&&z(!0)},Ae=qe=>{re(qe._id),Y(!0)},Ye=qe=>{Q(null),re(null),qe==="brochure"?F(!1):qe==="microsite"?Y(!1):qe==="badge"?($(!1),V(null)):qe==="emailer"&&z(!1),Se()},rt=async()=>{if(!H)return;const qe=H._id;ie(null),(await Vs.remove(qe)).error||Se()},He=async(qe,Et)=>{if(a==="brochure"){le(qe._id),ve(null);try{const vt=await Vs.get(qe._id);if(vt.error||!vt.data)throw new Error(vt.error||"Failed to load brochure");const Ft=await jIe(vt.data);if(!Ft.ok)throw new Error(Ft.error);const Ce=(vt.data.name||"brochure").replace(/[^a-z0-9-_]+/gi,"-").replace(/^-|-$/g,"")||"brochure";if(Et==="preview")be(Ft.ctx);else{const lt=QX(Ft.ctx),Xe=Ft.ctx.content.layoutId||"tpl1";await TRe(Xe,lt,`${Ce}.pdf`)}}catch(vt){ve(vt instanceof Error?vt.message:"Could not generate PDF")}finally{le(null)}}},xt=async qe=>{Me(qe._id);try{const Et=await Vs.get(qe._id);if(Et.error||!Et.data)return;const vt=Et.data.content;let Ft="";vt!=null&&typeof vt=="object"&&"html"in vt&&typeof vt.html=="string"&&(Ft=String(vt.html||"")),Ft.trim()||(Ft='<p style="font-family:system-ui,sans-serif;padding:24px;color:#64748b">No HTML saved for this template yet. Use Edit to build the emailer.</p>'),ae({html:Ft,title:Et.data.name||"Email preview"})}finally{Me(null)}},st=o==="Brochure"?"Create Brochure":o==="Badges"?"Create Badge":o==="Emailers"?"Create Emailer":o==="Microsite Templates"?"Configure microsite":"Create Template",Te=a==="microsite"?l:a==="badge"?c:s;function et(qe){const Et=qe.event;return Et&&typeof Et=="object"&&"name"in Et&&Et.name||"—"}const Pt=Nn(t);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:n?"stretch":"flex-start",flexDirection:n?"column":"row",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:rg,children:"Portfolio · Design"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:n?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:o}),!m&&!x&&a!=="microsite"&&a!=="badge"&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:[u.length," template",u.length!==1?"s":""]}),!m&&!x&&a==="badge"&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:[f.length," export job",f.length!==1?"s":""]}),!A&&!N&&a==="microsite"&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:[k.length," event",k.length!==1?"s":""," · ",_.length," microsite template",_.length!==1?"s":""]})]}),i.jsxs("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap",justifyContent:n?"stretch":"flex-end"},children:[a==="badge"&&Pt&&i.jsxs("button",{type:"button",disabled:m||p,onClick:()=>void Se({badgeSoftRefresh:!0}),style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:m||p?"wait":"pointer",opacity:m||p?.65:1,flex:n?1:"none",justifyContent:n?"center":"flex-start"},children:[i.jsx(_x,{size:13}),p?"Refreshing…":"Refresh"]}),Te&&i.jsxs(i.Fragment,{children:[s&&o!=="Emailers"&&o!=="Badges"&&i.jsxs("button",{onClick:()=>G(!0),style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer",transition:"opacity 0.15s",flex:n?1:"none",justifyContent:n?"center":"flex-start"},onMouseEnter:qe=>{qe.currentTarget.style.opacity="0.88"},onMouseLeave:qe=>{qe.currentTarget.style.opacity="1"},children:[i.jsx(Fl,{size:13})," Import"]}),(a==="microsite"?l:a==="badge"?c:s)&&i.jsxs("button",{onClick:Pe,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"opacity 0.15s",flex:n?1:"none",justifyContent:n?"center":"flex-start"},onMouseEnter:qe=>{qe.currentTarget.style.opacity="0.88"},onMouseLeave:qe=>{qe.currentTarget.style.opacity="1"},children:[i.jsx(gr,{size:13})," ",n?o==="Brochure"?"Brochure":o==="Badges"?"Badge":o==="Emailers"?"Emailer":o==="Microsite Templates"?"Microsite":"Template":st]})]})]})]}),m&&a!=="microsite"&&i.jsx(_h,{message:a==="badge"?"Loading badge exports…":"Loading templates…"}),A&&a==="microsite"&&i.jsx(_h,{message:"Loading events…"}),x&&a!=="microsite"&&i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--destructive)"},children:x}),ke&&a==="brochure"&&i.jsxs("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--destructive)"},children:[ke," ",i.jsx("button",{type:"button",onClick:()=>ve(null),style:{marginLeft:"8px",fontSize:"var(--text-xs)",textDecoration:"underline",background:"none",border:"none",cursor:"pointer",color:"inherit"},children:"Dismiss"})]}),N&&a==="microsite"&&i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--destructive)"},children:N}),!m&&!x&&a!=="microsite"&&a!=="badge"&&i.jsxs("div",{style:{display:"grid",gridTemplateColumns:n?"repeat(2, 1fr)":"repeat(auto-fill, minmax(200px, 1fr))",gap:n?"10px":"14px"},children:[u.map(qe=>i.jsxs("div",{onMouseEnter:()=>I(qe._id),onMouseLeave:()=>I(null),style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",cursor:"pointer",boxShadow:C===qe._id?"var(--elevation-sm)":"none",transition:"box-shadow 0.15s"},children:[i.jsxs("div",{style:{height:"120px",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",borderBottom:"1px solid var(--border)",position:"relative"},children:[YRe[o],C===qe._id&&i.jsxs("div",{style:{position:"absolute",inset:0,background:"rgba(11,77,209,0.08)",display:"flex",alignItems:"center",justifyContent:"center",gap:"6px",flexWrap:"wrap"},children:[s&&i.jsx("button",{onClick:Et=>{Et.stopPropagation(),Ee(qe)},style:{padding:"5px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"#fff",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:"Edit"}),a==="brochure"?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",disabled:de===qe._id,onClick:Et=>{Et.stopPropagation(),He(qe,"preview")},style:{padding:"5px 12px",borderRadius:"var(--radius-button)",background:"var(--card)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:de===qe._id?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",opacity:de===qe._id?.7:1},children:de===qe._id?"…":"Preview"}),i.jsxs("button",{type:"button",disabled:de===qe._id,onClick:Et=>{Et.stopPropagation(),He(qe,"download")},style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"5px 12px",borderRadius:"var(--radius-button)",background:"var(--card)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:de===qe._id?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",opacity:de===qe._id?.7:1},children:[i.jsx(ja,{size:12})," ",de===qe._id?"…":"PDF"]})]}):a==="emailer"?i.jsx("button",{type:"button",disabled:ue===qe._id,onClick:Et=>{Et.stopPropagation(),xt(qe)},style:{padding:"5px 12px",borderRadius:"var(--radius-button)",background:"var(--card)",color:"var(--foreground)",border:"1px solid var(--border)",cursor:ue===qe._id?"wait":"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",opacity:ue===qe._id?.7:1},children:ue===qe._id?"…":"Preview"}):null,s&&i.jsx("button",{onClick:Et=>{Et.stopPropagation(),ie(qe)},style:{padding:"5px 12px",borderRadius:"var(--radius-button)",background:"var(--destructive)",color:"#fff",border:"none",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:"Delete"})]})]}),i.jsxs("div",{style:{padding:"10px 12px"},children:[i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"2px"},children:qe.name}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"4px"},children:[i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"var(--secondary)",padding:"1px 6px",borderRadius:"3px"},children:qe.category||"—"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:Oq(qe.updatedAt)})]})]})]},qe._id)),s&&i.jsxs("div",{onClick:Pe,style:{border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",minHeight:"170px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",cursor:"pointer",transition:"border-color 0.12s, background 0.12s"},onMouseEnter:qe=>{qe.currentTarget.style.borderColor="var(--primary)",qe.currentTarget.style.background="var(--accent)"},onMouseLeave:qe=>{qe.currentTarget.style.borderColor="var(--border)",qe.currentTarget.style.background="transparent"},children:[i.jsx(gr,{size:24,style:{color:"var(--muted)"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:st})]})]}),!m&&!x&&a==="badge"&&i.jsxs("div",{style:{display:"grid",gridTemplateColumns:n?"1fr":"repeat(auto-fill, minmax(260px, 1fr))",gap:n?"10px":"14px"},children:[f.map(qe=>i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(Cx,{size:20,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:qe.name})]}),i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:et(qe)}),i.jsxs("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Status: ",i.jsx("strong",{style:{color:"var(--foreground)"},children:qe.status}),qe.itemCount!=null?` · ${qe.itemCount} badge${qe.itemCount!==1?"s":""}`:""]}),qe.lastError&&qe.status==="failed"&&i.jsx("span",{style:{fontSize:"10px",color:"var(--destructive)"},children:qe.lastError}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",marginTop:"4px"},children:[c&&i.jsxs("button",{type:"button",title:"Duplicate — copy settings and edit",onClick:()=>{V(qe._id),$(!0)},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--foreground)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:[i.jsx(Js,{size:13})," Duplicate"]}),qe.status==="ready"&&qe.zipUrl?i.jsxs("a",{href:qe.zipUrl,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",textDecoration:"none",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(ja,{size:13})," Download zip"]}):i.jsxs("button",{type:"button",disabled:!0,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--secondary)",color:"var(--muted)",border:"1px solid var(--border)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",cursor:"not-allowed"},children:[i.jsx(ja,{size:13})," Download zip"]})]}),qe.createdAt&&i.jsxs("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:["Requested ",Oq(qe.createdAt)]})]},qe._id)),c&&i.jsxs("div",{onClick:Pe,style:{border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",minHeight:"170px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",cursor:"pointer",transition:"border-color 0.12s, background 0.12s"},onMouseEnter:qe=>{qe.currentTarget.style.borderColor="var(--primary)",qe.currentTarget.style.background="var(--accent)"},onMouseLeave:qe=>{qe.currentTarget.style.borderColor="var(--border)",qe.currentTarget.style.background="transparent"},children:[i.jsx(gr,{size:24,style:{color:"var(--muted)"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:st})]})]}),!A&&!N&&a==="microsite"&&i.jsxs("div",{style:{display:"grid",gridTemplateColumns:n?"1fr":"repeat(auto-fill, minmax(240px, 1fr))",gap:n?"10px":"14px"},children:[k.map(qe=>{const Et=_.filter(Be=>String(Be.event)===String(qe._id)),vt=Et.length,Ft=Et.map(Be=>(Be.publishFolder||"").trim()).filter(Boolean),Ce=Ft.length===0?"—":Ft.length<=2?Ft.join(", "):`${Ft.slice(0,2).join(", ")} +${Ft.length-2}`,lt=Et.filter(Be=>Be.enabled).length,Xe=vt===0?"":lt===vt?" · all live":lt===0?" · all draft":` · ${lt} live, ${vt-lt} draft`;return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",padding:"14px 16px",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:qe.name}),i.jsx("span",{style:{fontSize:"11px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:vt===0?"0 microsite templates":`${vt} microsite template${vt!==1?"s":""} · slug(s): ${Ce}${Xe}`}),l&&i.jsx("button",{type:"button",onClick:()=>Ae(qe),style:{padding:"6px 12px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",alignSelf:"flex-start"},children:"Configure microsite"})]},qe._id)}),l&&i.jsxs("div",{onClick:Pe,style:{border:"2px dashed var(--border)",borderRadius:"var(--radius-card)",minHeight:"120px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px",cursor:"pointer",transition:"border-color 0.12s, background 0.12s"},onMouseEnter:qe=>{qe.currentTarget.style.borderColor="var(--primary)",qe.currentTarget.style.background="var(--accent)"},onMouseLeave:qe=>{qe.currentTarget.style.borderColor="var(--border)",qe.currentTarget.style.background="transparent"},children:[i.jsx(gr,{size:24,style:{color:"var(--muted)"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:st})]})]}),i.jsx(ng,{})]}),R&&i.jsx(wIe,{templateId:U??void 0,onClose:()=>Ye("brochure"),onSuccess:Se}),se&&i.jsx(ARe,{ctx:se,onClose:()=>be(null)}),De&&i.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",zIndex:400,display:"flex",alignItems:"center",justifyContent:"center",padding:24},onClick:()=>ae(null),children:i.jsxs("div",{role:"dialog","aria-label":"Email preview",style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"100%",maxWidth:720,maxHeight:"90vh",display:"flex",flexDirection:"column",border:"1px solid var(--border)",boxShadow:"0 20px 40px rgba(0,0,0,0.2)"},onClick:qe=>qe.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)"},children:[i.jsx("span",{style:{fontWeight:600,fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:De.title}),i.jsx("button",{type:"button","aria-label":"Close",onClick:()=>ae(null),style:{background:"none",border:"none",cursor:"pointer",color:"var(--foreground)"},children:i.jsx(Gt,{size:18})})]}),i.jsx("iframe",{title:"Email preview",srcDoc:De.html,sandbox:"allow-same-origin",style:{flex:1,minHeight:420,border:"none",width:"100%"}})]})}),M&&i.jsx(RRe,{initialEventId:K??void 0,onClose:()=>Ye("microsite"),onSuccess:Se}),X&&i.jsx(lH,{duplicateFromBatchId:ee,onClose:()=>Ye("badge"),onSuccess:Se},ee??"create"),D&&i.jsx(DRe,{templateId:U??void 0,onClose:()=>Ye("emailer"),onSuccess:Se}),q&&i.jsx(HRe,{onClose:()=>G(!1),defaultType:o==="Brochure"?"Brochure":o==="Microsite Templates"?"Microsite Template":o==="Badges"?"Badge":o==="Emailers"?"Emailer":"Other"}),H&&i.jsx(Tb,{title:"Delete template?",message:`Delete "${H.name}"? This cannot be undone.`,confirmLabel:"Delete",onConfirm:rt,onCancel:()=>ie(null),variant:"danger"})]})}const Gw=["#2563eb","#16a34a","#d97706","#7c3aed","#0891b2","#be185d","#0d9488","#b45309"];function KRe(e){let t=0;for(let r=0;r<e.length;r++)t+=e.charCodeAt(r);return Gw[t%Gw.length]}function QRe(){const{user:e}=Mr(),{selectedEventId:t}=Li(),[r,n]=S.useState([]),[o,a]=S.useState(!0),[s,l]=S.useState(null),[c,u]=S.useState(""),[d,f]=S.useState(null),[h,p]=S.useState(!1),[v,m]=S.useState(!1),[b,x]=S.useState(null),[w,k]=S.useState(null),j=(e==null?void 0:e.role)==="super_admin",_=e!=null&&e.organization&&typeof e.organization=="object"&&"_id"in e.organization?String(e.organization._id):e!=null&&e.organization?String(e.organization):void 0,T=S.useCallback(()=>{if(a(!0),l(null),!_){l(j?"Your profile has no organisation — assign one in settings or add ?organization= to the API. Faculty list is scoped by organisation.":"Your profile has no organisation."),n([]),a(!1);return}Lf.list({limit:200,organization:_}).then(C=>{var I;((I=C.data)==null?void 0:I.speakers)!=null?n(C.data.speakers):l(C.error??"Failed to load speakers")}).catch(()=>l("Failed to load speakers")).finally(()=>a(!1))},[j,_]);S.useEffect(()=>{T()},[T]);const A=r.filter(C=>{const I=`${C.firstName} ${C.lastName}`.toLowerCase(),R=(C.title??"").toLowerCase(),F=(C.organizationName??"").toLowerCase(),M=c.toLowerCase();return!M||I.includes(M)||R.includes(M)||F.includes(M)}),P=C=>{x(C._id),m(!0)},N=()=>{x(null),m(!1),T()},O=async()=>{if(!w)return;const C=w._id;k(null),(await Lf.remove(C)).error||T()};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:rg,children:"Portfolio"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Faculty & Speakers"}),!o&&!s&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:[r.length," speaker",r.length!==1?"s":""," across all events"]})]}),j&&i.jsxs("button",{onClick:()=>{x(null),m(!0)},style:{display:"flex",alignItems:"center",gap:"5px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Add Speaker"]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 10px",height:"36px",maxWidth:"320px",background:"var(--card)",border:`1px solid ${h?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",transition:"border-color 0.12s"},children:[i.jsx(pi,{size:13,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:c,onChange:C=>u(C.target.value),placeholder:"Search speakers…",onFocus:()=>p(!0),onBlur:()=>p(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),c&&i.jsx("button",{onClick:()=>u(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{size:12})})]}),o&&i.jsx(_h,{message:"Loading speakers…"}),s&&i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--destructive)"},children:s}),!o&&!s&&i.jsxs(hI,{children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 80px 60px",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["Speaker","Title","Organisation","Sessions",""].map(C=>i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:C},C))}),A.map(C=>{var M;const I=`${C.firstName} ${C.lastName}`.trim()||"—",R=((M=C.sessions)==null?void 0:M.length)??0,F=I.split(/\s+/).map(Y=>Y[0]).join("").slice(0,2).toUpperCase()||"?";return i.jsxs("div",{onMouseEnter:()=>f(C._id),onMouseLeave:()=>f(null),style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 80px 60px",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)",background:d===C._id?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"50%",background:KRe(C._id),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:F})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:I})]}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:C.title??"—"}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:C.organizationName??"—"}),i.jsxs("span",{style:{display:"inline-flex",width:"fit-content",padding:"2px 8px",borderRadius:"999px",background:"var(--accent)",color:"var(--primary)",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:[R," ",R===1?"session":"sessions"]}),i.jsx("div",{style:{display:"flex",gap:"4px",opacity:d===C._id?1:.3,transition:"opacity 0.15s"},children:j&&i.jsxs(i.Fragment,{children:[i.jsx("button",{title:"Edit speaker",onClick:()=>P(C),style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},onMouseEnter:Y=>{Y.currentTarget.style.borderColor="var(--primary)",Y.currentTarget.style.color="var(--primary)"},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border)",Y.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:11})}),i.jsx("button",{title:"Delete speaker",onClick:()=>k(C),style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},onMouseEnter:Y=>{Y.currentTarget.style.borderColor="var(--destructive)",Y.currentTarget.style.color="var(--destructive)"},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border)",Y.currentTarget.style.color="var(--muted)"},children:i.jsx(Xr,{size:11})})]})})]},C._id)}),A.length===0&&i.jsxs("div",{style:{padding:"48px 20px",textAlign:"center"},children:[i.jsx(pi,{size:24,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:"No speakers found"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"14px"},children:c?`No results for "${c}". Try a different name or title.`:"Add a speaker to get started."}),c&&i.jsxs("button",{onClick:()=>u(""),style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"5px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(Gt,{size:11})," Clear search"]})]})]}),i.jsx(ng,{}),v&&i.jsx(N8e,{speakerId:b??void 0,eventId:t,onClose:N,onSuccess:T}),w&&i.jsx(Tb,{title:"Delete speaker?",message:`Remove "${w.firstName} ${w.lastName}"? This cannot be undone.`,confirmLabel:"Delete",onConfirm:O,onCancel:()=>k(null),variant:"danger"})]})}function XRe(e){const t=[e.firstName,e.lastName].filter(Boolean).join(" ").trim()||"—",r=e.status,n=r==null||r===""?"—":r==="cancelled"?"Cancelled":r==="checked_in"?"Checked In":r==="confirmed"?"Confirmed":"Pending",o=e.event,a=(o==null?void 0:o.name)??"—",s=String(e._id);return{rowKey:s,id:s,name:t,email:e.email??"",tags:e.tags??[],eventName:a,status:n}}function ZRe(){const{user:e}=Mr(),t=Nn(e),r=(e==null?void 0:e.role)==="super_admin",{setActiveNav:n}=Li(),[o,a]=S.useState([]),[s,l]=S.useState(0),[c,u]=S.useState(1),[d]=S.useState(50),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(null),[x,w]=S.useState(null),[k,j]=S.useState(!1),[_,T]=S.useState(!0),[A,P]=S.useState(!1),[N,O]=S.useState(!1),[C,I]=S.useState(!1),[R,F]=S.useState(null),[M,Y]=S.useState(0),[X,$]=S.useState([]),[ee,V]=S.useState(null),[D,z]=S.useState(null),q=S.useRef(void 0),{selectedIds:G,setSelectedIds:U,selectAllMatchingActive:Q,setSelectAllMatchingActive:K,headerSelectRef:re,toggleRow:H,toggleAllVisible:ie,clearSelection:de}=FG(o.map(ae=>ae.id),[p,m]),le=S.useCallback(()=>Y(ae=>ae+1),[]),ke=zG({selectedIds:G,listOrgId:t,onMessage:F,onClearSelection:de,onRefresh:le});S.useEffect(()=>(q.current=setTimeout(()=>v(f.trim()),300),()=>{q.current&&clearTimeout(q.current)}),[f]),S.useEffect(()=>{u(1)},[p,m]),S.useEffect(()=>{if(!t){$([]);return}ai.listDistinctTags({organization:t}).then(ae=>{var ue,Me;(Me=(ue=ae.data)==null?void 0:ue.tags)!=null&&Me.length&&$(ae.data.tags)})},[t,M]),S.useEffect(()=>{if(!t){a([]),l(0),T(!1);return}T(!0),ai.listAll({organization:t,page:c,limit:d,q:p||void 0,tag:m??void 0}).then(ae=>{var ue;T(!1),(ue=ae.data)!=null&&ue.participants&&(a(ae.data.participants.map(XRe)),l(ae.data.total??0))}).catch(()=>T(!1))},[t,c,d,p,m,M]);const ve=()=>{h(""),v(""),b(null),u(1)},se=async()=>{N||(O(!0),t&&(await ai.downloadExportAll({organization:t,q:p||void 0,tag:m??void 0}),O(!1)))},be=async()=>{var Me,Se;if(!t){F(r?"Organisation required for this action.":"Your profile has no organisation."),K(!1);return}const ae=await ai.matchingIds({organization:t,q:p||void 0,tag:m??void 0});if(ae.error){F(ae.error),K(!1);return}const ue=((Me=ae.data)==null?void 0:Me.ids)??[];(Se=ae.data)!=null&&Se.capped&&F(`Note: only the first ${ue.length} matching people are selected (limit). Refine filters if needed.`),U(ue),K(ue.length>0)},De=async()=>{if(!D)return;const{id:ae,name:ue}=D;z(null);const Me=await ai.deleteOne(ae);if(Me.error){F(Me.error);return}F(`Removed ${ue}.`),K(!1),U(Se=>Se.filter(Pe=>Pe!==ae)),Y(Se=>Se+1)};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[R&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{children:R}),i.jsx("button",{type:"button",onClick:()=>F(null),style:{background:"none",border:"none",cursor:"pointer"},children:i.jsx(Gt,{size:16})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:rg,children:"Portfolio"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Participants"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:[s," in your organization (Including people not yet assigned to an event) · Page ",c," of ",Math.max(1,Math.ceil(s/d))]})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px"},children:[i.jsxs("button",{type:"button",disabled:N,onClick:se,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:N?"wait":"pointer",opacity:N?.7:1},children:[i.jsx(ja,{size:13})," ",N?"Exporting…":"Export"]}),i.jsxs("button",{type:"button",onClick:()=>{F(null),I(!0)},style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:[i.jsx(Fl,{size:13})," Import"]}),i.jsx("button",{type:"button",onClick:()=>n("participant-lists"),style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",cursor:"pointer"},children:"Custom lists"}),i.jsxs("button",{type:"button",onClick:()=>P(!0),style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Create Custom List"]})]})]}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx(DG,{total:s,loading:_,busy:ke.bulkBusy,checked:Q,onChange:ae=>{ae?be():de()}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"7px",padding:"0 10px",height:"34px",background:"var(--card)",border:`1px solid ${k?"var(--ring)":"var(--border)"}`,borderRadius:"var(--radius-button)",maxWidth:"280px",flex:"1 1 200px",transition:"border-color 0.12s"},children:[i.jsx(pi,{size:12,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{value:f,onChange:ae=>h(ae.target.value),placeholder:"Search participants…",onFocus:()=>j(!0),onBlur:()=>j(!1),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"}}),f&&i.jsx("button",{type:"button",onClick:()=>h(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:0},children:i.jsx(Gt,{size:11})})]}),X.length===0?i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"No tags yet — add tags when editing or importing."}):i.jsx(MG,{tagOptions:X,activeTag:m,onChange:b})]}),i.jsx(BG,{selectedCount:G.length,busy:ke.bulkBusy,variant:"portfolio",onAddTags:()=>void ke.openBulkDialog("addTags"),onRemoveTags:()=>void ke.openBulkDialog("removeTags"),onAssignEvents:()=>void ke.openBulkDialog("assignEvents"),onNewList:()=>void ke.openBulkDialog("newList"),onAddToList:()=>void ke.openBulkDialog("addToList"),onDeleteSelected:()=>{window.confirm(`Delete ${G.length} participant(s) permanently?`)&&ke.runBulkDelete()},onClearSelection:de}),i.jsxs(hI,{minWidth:720,children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"38px 1.1fr 1.35fr minmax(100px,1fr) 1fr 92px",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)",alignItems:"center"},children:[i.jsx("input",{ref:re,type:"checkbox",title:"Select visible rows",onChange:ie,style:{width:"16px",height:"16px",cursor:"pointer"}}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Name"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Email"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Tags"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Event"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Actions"})]}),_?i.jsx("div",{style:{padding:"40px",textAlign:"center",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Loading…"}):o.length===0?i.jsxs("div",{style:{padding:"40px",textAlign:"center"},children:[i.jsx(pi,{size:22,style:{color:"var(--border)",margin:"0 auto 10px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"4px"},children:"No participants found"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"14px"},children:p||m?"Try adjusting your filters or import participants.":"No one in your organization yet. Import a CSV or add people from an event."}),(p||m)&&i.jsxs("button",{type:"button",onClick:ve,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"5px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",color:"var(--card-foreground)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(Gt,{size:11})," Clear filters"]})]}):o.map(ae=>i.jsxs("div",{onMouseEnter:()=>w(ae.rowKey),onMouseLeave:()=>w(null),style:{display:"grid",gridTemplateColumns:"38px 1.1fr 1.35fr minmax(100px,1fr) 1fr 92px",alignItems:"center",padding:"11px 16px",borderBottom:"1px solid var(--border)",background:x===ae.rowKey?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx("input",{type:"checkbox",checked:G.includes(ae.id),onChange:()=>H(ae.id),style:{width:"16px",height:"16px",cursor:"pointer"}}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",minWidth:0},children:[i.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"9px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:(ae.name.slice(0,2)||"?").toUpperCase()})}),i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:ae.name}),i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:ae.status==="—"||ae.status==="Cancelled"?"var(--muted)":"#15803d"},children:ae.status})]})]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ae.email}),i.jsxs("div",{style:{display:"flex",gap:"3px",flexWrap:"wrap"},children:[ae.tags.map(ue=>{const Me=GP(ue);return i.jsx("span",{style:{padding:"1px 6px",borderRadius:"999px",background:Me.bg,color:Me.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:ue},ue)}),ae.tags.length===0&&i.jsx("span",{style:{fontSize:"10px",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"—"})]}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ae.eventName}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",title:"Edit",onClick:()=>V(ae.id),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(wi,{size:13})}),i.jsx("button",{type:"button",title:"Delete",onClick:()=>z({id:ae.id,name:ae.name}),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer"},children:i.jsx(Xr,{size:13})})]})]},ae.rowKey))]}),!_&&s>d&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"8px 0"},children:[i.jsxs("button",{type:"button",disabled:c<=1,onClick:()=>u(ae=>Math.max(1,ae-1)),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:c<=1?"not-allowed":"pointer",opacity:c<=1?.5:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(vd,{size:16})," Previous"]}),i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c," / ",Math.max(1,Math.ceil(s/d))]}),i.jsxs("button",{type:"button",disabled:c>=Math.ceil(s/d),onClick:()=>u(ae=>ae+1),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:c>=Math.ceil(s/d)?"not-allowed":"pointer",opacity:c>=Math.ceil(s/d)?.5:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:["Next ",i.jsx(ka,{size:16})]})]}),ee&&i.jsx(F8e,{participantId:ee,onClose:()=>V(null),onSaved:()=>{Y(ae=>ae+1),t&&ai.listDistinctTags({organization:t}).then(ae=>{var ue,Me;(Me=(ue=ae.data)==null?void 0:ue.tags)!=null&&Me.length&&$(ae.data.tags)})}}),D&&i.jsx(Tb,{title:"Delete participant?",message:`Remove ${D.name} from your organization? This cannot be undone.`,confirmLabel:"Delete",onConfirm:()=>void De(),onCancel:()=>z(null),variant:"danger"}),i.jsx(WG,{bulkDialog:ke.bulkDialog,bulkBusy:ke.bulkBusy,selectedCount:G.length,tagBulkInput:ke.tagBulkInput,onTagBulkInputChange:ke.setTagBulkInput,newListName:ke.newListName,onNewListNameChange:ke.setNewListName,newListDesc:ke.newListDesc,onNewListDescChange:ke.setNewListDesc,eventsPick:ke.eventsPick,eventPickIds:ke.eventPickIds,onToggleEventPick:ke.toggleEventPick,fixedLists:ke.fixedLists,addToListId:ke.addToListId,onAddToListIdChange:ke.setAddToListId,onClose:()=>ke.setBulkDialog(null),onApplyTags:ae=>void ke.runBulkTags(ae),onAssignEvents:()=>void ke.runBulkAssignEvents(),onCreateList:()=>void ke.runBulkNewList(),onAddToList:()=>void ke.runBulkAddToList()}),i.jsx(ng,{}),C&&i.jsx(R8e,{onClose:()=>I(!1),onSuccess:ae=>{F(ae),Y(ue=>ue+1)}}),A&&i.jsx(YP,{onClose:()=>P(!1),onCreated:()=>Y(ae=>ae+1)})]})}function JRe(e){if(e==null||e==="")return"—";const t=String(e).toLowerCase();return t==="cancelled"||t==="canceled"?"Cancelled":t==="checked_in"?"Checked In":t==="confirmed"?"Confirmed":t==="pending"?"Pending":String(e)}function eLe(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function tLe(){const{user:e}=Mr(),t=Nn(e),{setActiveNav:r}=Li(),[n,o]=S.useState([]),[a,s]=S.useState(!0),[l,c]=S.useState(!1),[u,d]=S.useState(null),[f,h]=S.useState(null),[p,v]=S.useState(null),[m,b]=S.useState([]),[x,w]=S.useState(!1),[k,j]=S.useState(1),[_,T]=S.useState(0),A=50,[P,N]=S.useState(null),[O,C]=S.useState(""),[I,R]=S.useState(""),[F,M]=S.useState("Private"),[Y,X]=S.useState(!1),[$,ee]=S.useState(null),[V,D]=S.useState(null),[z,q]=S.useState(null),G=S.useCallback(()=>{if(s(!0),!t){o([]),s(!1);return}qa.list({organization:t}).then(ie=>{var de;s(!1),(de=ie.data)!=null&&de.lists&&o(ie.data.lists)}).catch(()=>s(!1))},[t]);S.useEffect(()=>{G()},[G]),S.useEffect(()=>{if(!p){b([]),T(0),j(1);return}if(!t){b([]),T(0);return}w(!0),qa.members(p._id,{organization:t,page:k,limit:A}).then(ie=>{var de,le;w(!1),(de=ie.data)!=null&&de.members&&b(ie.data.members),T(((le=ie.data)==null?void 0:le.total)??0)}).catch(()=>w(!1))},[p==null?void 0:p._id,k,t]);const U=Math.max(1,Math.ceil(_/A)),Q=ie=>{if(ie.type==="rule_based"){q(null),d(ie),c(!0);return}ee(null),N(ie),C(ie.name),R(ie.description??""),M(ie.visibility==="shared"?"Shared":"Private")},K=()=>{N(null),ee(null)},re=async()=>{if(!P||!O.trim()){ee("Name is required.");return}X(!0),ee(null);const ie={name:O.trim(),description:I.trim(),visibility:F==="Shared"?"shared":"private"},de=await qa.update(P._id,ie);if(X(!1),de.error){ee(de.error);return}q(`Updated “${O.trim()}”.`),K(),G(),(p==null?void 0:p._id)===P._id&&de.data&&v(de.data)},H=async()=>{if(!V)return;const{id:ie,name:de}=V;D(null);const le=await qa.remove(ie);if(le.error){q(le.error);return}q(`Deleted “${de}”.`),(p==null?void 0:p._id)===ie&&v(null),G()};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[z&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"10px 14px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("span",{children:z}),i.jsx("button",{type:"button",onClick:()=>q(null),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:16})})]}),i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:rg,children:"Portfolio"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"Participant lists"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:"Fixed lists and rule-based lists. Open a list to see who is included."})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px"},children:[i.jsx("button",{type:"button",onClick:()=>{q(null),r("all-participants")},style:{padding:"7px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"All participants"}),i.jsxs("button",{type:"button",onClick:()=>{q(null),d(null),c(!0)},style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Create Custom List"]})]})]}),i.jsxs(hI,{minWidth:780,children:[i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(160px,1.4fr) 110px 88px 100px minmax(260px,1fr)",padding:"10px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"List"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Type"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Visibility"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase"},children:"Updated"}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",textAlign:"right"},children:"Actions"})]}),a?i.jsx("div",{style:{padding:"40px",textAlign:"center",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"Loading…"}):n.length===0?i.jsxs("div",{style:{padding:"48px 20px",textAlign:"center"},children:[i.jsx(Ri,{size:28,style:{color:"var(--border)",margin:"0 auto 12px"}}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:"No lists yet"}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"16px"},children:"Create a custom list from here or from All participants."}),i.jsxs("button",{type:"button",onClick:()=>{d(null),c(!0)},style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 18px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:14})," Create Custom List"]})]}):n.map(ie=>i.jsxs("div",{onMouseEnter:()=>h(ie._id),onMouseLeave:()=>h(null),style:{display:"grid",gridTemplateColumns:"minmax(160px,1.4fr) 110px 88px 100px minmax(260px,1fr)",padding:"12px 16px",borderBottom:"1px solid var(--border)",alignItems:"center",gap:"8px",background:f===ie._id?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:ie.name}),ie.description?i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ie.description}):null]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:ie.type==="rule_based"?"Rule-based":"Fixed"}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:ie.visibility==="shared"?"Shared":"Private"}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:eLe(ie.updatedAt)}),i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"6px",flexWrap:"wrap"},children:[i.jsxs("button",{type:"button",onClick:()=>{j(1),v(ie)},style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"5px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(Ri,{size:12})," View participants"]}),i.jsx("button",{type:"button",title:"Edit list",onClick:()=>Q(ie),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},children:i.jsx(wi,{size:13})}),i.jsx("button",{type:"button",title:"Delete list",onClick:()=>D({id:ie._id,name:ie.name}),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"30px",height:"30px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:"pointer"},children:i.jsx(Xr,{size:13})})]})]},ie._id))]}),p&&i.jsxs(i.Fragment,{children:[i.jsx("div",{onClick:()=>v(null),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.50)",zIndex:200}}),i.jsxs("div",{style:{position:"fixed",top:0,right:0,height:"100%",width:"min(520px,100vw)",background:"var(--card)",zIndex:201,display:"flex",flexDirection:"column",boxShadow:"-4px 0 40px rgba(0,0,0,0.20)"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 4px"},children:"Participants in list"}),i.jsx("h2",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:p.name}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"6px 0 0"},children:[p.type==="rule_based"?"Rule-based":"Fixed"," · ",_," ",_===1?"person":"people"]})]}),i.jsx("button",{type:"button",onClick:()=>v(null),title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},children:i.jsx(Gt,{size:14})})]}),i.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[x?i.jsx("p",{style:{padding:"24px",fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Loading…"}):i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("thead",{children:i.jsx("tr",{style:{background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["Name","Email","Organization","Status"].map(ie=>i.jsx("th",{style:{textAlign:"left",padding:"10px 14px",fontWeight:"600",color:"var(--muted)",fontSize:"10px",textTransform:"uppercase"},children:ie},ie))})}),i.jsx("tbody",{children:m.map((ie,de)=>i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:{padding:"10px 14px"},children:ie.name}),i.jsx("td",{style:{padding:"10px 14px",color:"var(--muted)",wordBreak:"break-word"},children:ie.email||"—"}),i.jsx("td",{style:{padding:"10px 14px",color:"var(--muted)"},children:ie.organization||"—"}),i.jsx("td",{style:{padding:"10px 14px"},children:JRe(ie.status)})]},`${ie.participantId??"s"}-${de}`))})]}),!x&&m.length===0&&i.jsx("p",{style:{padding:"20px",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"No participants in this list."})]}),p&&!x&&_>A&&i.jsxs("div",{style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"14px 16px",borderTop:"1px solid var(--border)"},children:[i.jsxs("button",{type:"button",disabled:k<=1,onClick:()=>j(ie=>Math.max(1,ie-1)),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:k<=1?"not-allowed":"pointer",opacity:k<=1?.5:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(vd,{size:16})," Previous"]}),i.jsxs("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[k," / ",U," · ",_," total"]}),i.jsxs("button",{type:"button",disabled:k>=U,onClick:()=>j(ie=>ie+1),style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:k>=U?"not-allowed":"pointer",opacity:k>=U?.5:1,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:["Next ",i.jsx(ka,{size:16})]})]})]})]}),P&&i.jsx("div",{role:"dialog","aria-modal":"true",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:210,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px"},onClick:K,children:i.jsxs("div",{style:{width:"100%",maxWidth:"420px",background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",boxShadow:"var(--shadow-xl)",padding:"22px"},onClick:ie=>ie.stopPropagation(),children:[i.jsx("h3",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-lg)",fontWeight:"var(--font-weight-medium)",margin:"0 0 16px",color:"var(--foreground)"},children:"Edit list"}),$&&i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--destructive)",fontFamily:"var(--font-noto-sans)",margin:"0 0 12px"},children:$}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Name",required:!0}),i.jsx("input",{style:Ht,value:O,onChange:ie=>C(ie.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Description"}),i.jsx("textarea",{style:{...Ht,resize:"vertical",minHeight:"72px"},value:I,onChange:ie=>R(ie.target.value),onFocus:St,onBlur:jt})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Visibility",required:!0}),i.jsx(Hi,{name:"plEditVis",value:F,onChange:ie=>M(ie),options:[{label:"Private",value:"Private"},{label:"Shared",value:"Shared"}]})]})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"10px",marginTop:"22px",paddingTop:"16px",borderTop:"1px solid var(--border)"},children:[i.jsx("button",{type:"button",onClick:K,disabled:Y,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:Y?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:()=>void re(),disabled:Y,style:{padding:"7px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:Y?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:Y?"Saving…":"Save"})]})]})}),V&&i.jsx(Tb,{title:"Delete list",message:`Delete “${V.name}”? Participants in your database are not removed—only this list is deleted.`,confirmLabel:"Delete",variant:"danger",onConfirm:()=>void H(),onCancel:()=>D(null)}),l&&i.jsx(YP,{editList:u,onClose:()=>{c(!1),d(null)},onCreated:()=>{G(),q("Custom list created.")},onSaved:ie=>{G(),q(`Updated “${ie.name}”.`),(p==null?void 0:p._id)===ie._id&&v(ie)}},(u==null?void 0:u._id)??"new-list-panel"),i.jsx(ng,{})]})}function rLe(e){return e==="feedback"?"Feedback":e==="registration"?"Registration":e==="other"||e==="survey"||e==="custom"?"Other":e}function Nq(e){var r;const t=e.event;return!t||typeof t=="string"?"—":((r=t.name)==null?void 0:r.trim())||"—"}function nLe(e){const t=e.event;if(!t)return null;if(typeof t=="string")return t.trim().length===24?t.trim():null;const r=t._id;return r&&String(r).trim().length===24?String(r).trim():null}function iLe(e){if(Array.isArray(e))return e.map(t=>{if(!t||typeof t!="object")return t;const{_id:r,__v:n,...o}=t;return o})}function oLe(e){if(!e||typeof e!="object")return e;const{_id:t,__v:r,...n}=e;return n}function aLe({subPage:e}){const{user:t}=Mr(),r=Nn(t),n=!!r||(t==null?void 0:t.role)==="super_admin",o=e==="forms-feedback"?"Feedback":e==="forms-registration"?"Registration":e==="forms-other"?"Other":null,[a,s]=S.useState([]),[l,c]=S.useState(!1),[u,d]=S.useState(null),[f,h]=S.useState(!1),[p,v]=S.useState(!1),[m,b]=S.useState(!1),[x,w]=S.useState(null),[k,j]=S.useState(null),[_,T]=S.useState(null),[A,P]=S.useState(null),[N,O]=S.useState(null),[C,I]=S.useState(null),R=G=>{const U="https://web.eventbuzz.live".trim()||window.location.origin.replace(/\/$/,""),Q=nLe(G),K=G._id;return Q?`${U.replace(/\/$/,"")}/event/${Q}/form/${K}`:`${U.replace(/\/$/,"")}/form/${K}`},F="Public form link copied to clipboard.",M=G=>{const U=R(G);navigator.clipboard.writeText(U).then(()=>{I(id),P(F),window.setTimeout(()=>{I(null),P(Q=>Q===F?null:Q)},4e3)}).catch(()=>{P("Could not copy to clipboard. Check browser permissions or copy the link manually.")})},Y=S.useCallback(async()=>{if(!n){s([]);return}if(!r){s([]);return}c(!0);try{const G=await Mo.list({organization:r});s(G)}catch{s([])}finally{c(!1)}},[n,r]);S.useEffect(()=>{Y()},[Y]);const X=o==="Feedback"?a.filter(G=>G.type==="feedback"):o==="Registration"?a.filter(G=>G.type==="registration"):o==="Other"?a.filter(G=>G.type==="other"||G.type==="survey"||G.type==="custom"):a,$=()=>{w(null),o==="Registration"?v(!0):o==="Other"?b(!0):h(!0)},ee=G=>{w(G);const U=a.find(Q=>Q._id===G);(U==null?void 0:U.type)==="registration"?v(!0):(U==null?void 0:U.type)==="other"||(U==null?void 0:U.type)==="survey"||(U==null?void 0:U.type)==="custom"?b(!0):h(!0)},V=()=>{Y(),h(!1),v(!1),b(!1),w(null),P("Form saved.")},D=async()=>{if(!k)return;const G=k._id,U=k.name;T(G);try{await Mo.remove(G),j(null),P(`Deleted “${U}”.`),await Y()}catch{P("Could not delete the form. Try again.")}finally{T(null)}},z=async G=>{T(G._id),P(null);try{const U=await Mo.get(G._id),Q=U.event?typeof U.event=="string"?U.event:U.event._id:null;if(!Q){P("This form has no event. Edit it to attach an event, then duplicate.");return}const K=(U.name||"Form").trim(),re=K.toLowerCase().endsWith(" (copy)")?`${K} (2)`:`${K} (Copy)`;await Mo.create({name:re,type:U.type,description:U.description??"",fields:iLe(U.fields),settings:oLe(U.settings),event:String(Q)}),P(`Duplicated as “${re}”.`),await Y()}catch(U){const Q=U instanceof Error?U.message:"Could not duplicate the form. Try again.";P(Q)}finally{T(null)}},q=e==="forms-add"?"Add New Form":o??"All Forms";return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:rg,children:"Portfolio · Forms & Workflow"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:q})]}),n?i.jsxs("button",{onClick:$,style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Create Form"]}):null]}),A?i.jsx("p",{role:"status","aria-live":"polite",style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)",margin:0,padding:"10px 14px",borderRadius:"var(--radius-card)",background:A===F?"#dcfce7":"var(--secondary)",border:A===F?"1px solid #86efac":"1px solid var(--border)"},children:A}):null,n?e==="forms-add"?i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"32px"},children:i.jsx(Iq,{icon:i.jsx(Sh,{size:40}),title:"Form Builder",description:"Drag and drop fields to build your custom form. Choose from registration, feedback, other forms, and more.",cta:"Start Building",onCta:()=>{}})}):i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr) 100px 90px 80px minmax(200px, 1.1fr)",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)",gap:"6px"},children:["Form Name","Event","Type","Submissions","Status",""].map(G=>i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:G},G))}),l?i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading forms…"}):X.map(G=>{var re;const U=((re=G.settings)==null?void 0:re.isActive)!==!1?"Active":"Draft",Q=U==="Active"?{bg:"#dcfce7",color:"#15803d"}:U==="Draft"?{bg:"var(--secondary)",color:"var(--muted)"}:{bg:"#f1f5f9",color:"#475569"},K=G._id;return i.jsxs("div",{onMouseEnter:()=>d(K),onMouseLeave:()=>d(null),style:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr) 100px 90px 80px minmax(200px, 1.1fr)",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)",background:u===K?"var(--secondary)":"var(--card)",transition:"background 0.12s",gap:"6px"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:G.name,children:G.name}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:Nq(G),children:Nq(G)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:rLe(G.type)}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",color:"var(--foreground)"},children:(G.submissionCount??0).toLocaleString()}),i.jsx("span",{style:{display:"inline-flex",width:"fit-content",padding:"2px 8px",borderRadius:"999px",background:Q.bg,color:Q.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:U}),i.jsxs("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",title:C===K?"Copied to clipboard":"Copy public form link",onClick:()=>M(G),disabled:_===K,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:C===K?"#dcfce7":"var(--card)",color:C===K?"#15803d":"var(--muted)",cursor:_===K?"not-allowed":"pointer",opacity:_===K?.6:1},onMouseEnter:H=>{C!==K&&(H.currentTarget.style.borderColor="var(--primary)",H.currentTarget.style.color="var(--primary)")},onMouseLeave:H=>{C!==K&&(H.currentTarget.style.borderColor="var(--border)",H.currentTarget.style.color="var(--muted)")},children:C===K?i.jsx(bi,{size:12,strokeWidth:3}):i.jsx(i2,{size:12})}),i.jsx("button",{type:"button",title:"Submissions",onClick:()=>O(G),disabled:_===K,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:_===K?"not-allowed":"pointer",opacity:_===K?.6:1},onMouseEnter:H=>{H.currentTarget.style.borderColor="var(--primary)",H.currentTarget.style.color="var(--primary)"},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border)",H.currentTarget.style.color="var(--muted)"},children:i.jsx(Eb,{size:12})}),i.jsx("button",{type:"button",title:"Edit",onClick:()=>ee(K),disabled:_===K,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:_===K?"not-allowed":"pointer",opacity:_===K?.6:1},onMouseEnter:H=>{H.currentTarget.style.borderColor="var(--primary)",H.currentTarget.style.color="var(--primary)"},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border)",H.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:12})}),i.jsx("button",{type:"button",title:"Duplicate",onClick:()=>void z(G),disabled:_===K,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:_===K?"not-allowed":"pointer",opacity:_===K?.6:1},onMouseEnter:H=>{H.currentTarget.style.borderColor="var(--primary)",H.currentTarget.style.color="var(--primary)"},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border)",H.currentTarget.style.color="var(--muted)"},children:i.jsx(Js,{size:12})}),i.jsx("button",{type:"button",title:"Delete",onClick:()=>{P(null),j(G)},disabled:_===K,style:{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--destructive)",cursor:_===K?"not-allowed":"pointer",opacity:_===K?.6:1},onMouseEnter:H=>{H.currentTarget.style.borderColor="var(--destructive)",H.currentTarget.style.color="var(--destructive)"},onMouseLeave:H=>{H.currentTarget.style.borderColor="var(--border)",H.currentTarget.style.color="var(--destructive)"},children:i.jsx(Xr,{size:12})})]})]},K)})]}):i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"32px"},children:i.jsx(Iq,{icon:i.jsx(Sh,{size:40}),title:"Organization required",description:"Forms are managed at the organization level. Your account needs to be linked to an organization."})}),k?i.jsx(Tb,{title:"Delete form",message:`Delete “${k.name}”? Submissions stored for this form will no longer be linked to a form definition.`,confirmLabel:"Delete",variant:"danger",onConfirm:()=>void D(),onCancel:()=>j(null)}):null,i.jsx(ng,{}),f&&n&&i.jsx(tx,{formId:x??void 0,mode:"feedback",onClose:()=>{h(!1),w(null)},onSuccess:V}),p&&n&&i.jsx(tx,{formId:x??void 0,mode:"registration",onClose:()=>{v(!1),w(null)},onSuccess:V}),m&&n&&i.jsx(tx,{formId:x??void 0,mode:"other",onClose:()=>{b(!1),w(null)},onSuccess:V}),N?i.jsx(D3,{formId:N._id,formName:N.name,onClose:()=>O(null)}):null]})}function sLe(e){return e==null||Number.isNaN(e)?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function lLe(e){const t=e.type;return t==="image"?"Image":t==="pdf"?"PDF":t==="video"?"Video":"Other"}function Rq(e){if(!e)return"—";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return"—"}}function cLe({subPage:e}){const{user:t}=Mr(),r=Nn(t),n=!!r||(t==null?void 0:t.role)==="super_admin",o=e==="content-collections",[a,s]=S.useState(null),[l,c]=S.useState(!1),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState([]),[m,b]=S.useState([]),[x,w]=S.useState(!1),k=S.useCallback(async()=>{if(n){if(!r){v([]);return}w(!0);try{const{media:T}=await h$({limit:400,organization:r});v(T)}catch{v([])}finally{w(!1)}}},[n,r]),j=S.useCallback(async()=>{if(n){if(!r){b([]);return}w(!0);try{const T=await r2.list({organization:r});b(T)}catch{b([])}finally{w(!1)}}},[n,r]);S.useEffect(()=>{o?j():k()},[o,j,k]);const _=()=>{o?j():k()};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:rg,children:"Portfolio · Content"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:o?"Collections":"Library"})]}),n&&i.jsx("div",{style:{display:"flex",gap:"8px"},children:i.jsxs("button",{type:"button",onClick:()=>{o?(h(null),d(!0)):c(!0)},style:{display:"flex",alignItems:"center",gap:"5px",padding:"7px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"opacity 0.15s"},onMouseEnter:T=>{T.currentTarget.style.opacity="0.88"},onMouseLeave:T=>{T.currentTarget.style.opacity="1"},children:[i.jsx(gr,{size:13})," ",o?"New Collection":"Add Files"]})})]}),n?i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:x?i.jsx("div",{style:{padding:"20px",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"Loading…"}):o?i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 80px 100px 56px",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["Collection","Items","Created",""].map(T=>i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:T},T))}),m.length===0?i.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"No collections yet."}):m.map(T=>{var A;return i.jsxs("div",{onMouseEnter:()=>s(T._id),onMouseLeave:()=>s(null),style:{display:"grid",gridTemplateColumns:"1fr 80px 100px 56px",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)",background:a===T._id?"var(--secondary)":"var(--card)",transition:"background 0.12s",cursor:"default"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",background:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(n2,{size:14,style:{color:"var(--primary)"}})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:T.name})]}),i.jsx("span",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-sm)",color:"var(--foreground)"},children:((A=T.contentIds)==null?void 0:A.length)??0}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:Rq(T.createdAt)}),i.jsx("div",{style:{display:"flex",justifyContent:"flex-end",opacity:a===T._id?1:0,transition:"opacity 0.15s"},children:i.jsx("button",{type:"button",title:"Edit collection",onClick:P=>{P.stopPropagation(),h(T),d(!0)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",color:"var(--muted)"},onMouseEnter:P=>{P.currentTarget.style.borderColor="var(--primary)",P.currentTarget.style.color="var(--primary)"},onMouseLeave:P=>{P.currentTarget.style.borderColor="var(--border)",P.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:14})})})]},T._id)})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 80px 80px 80px 50px",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["File","Type","Size","Added",""].map(T=>i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:T},T))}),p.length===0?i.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"No files yet. Use Add Files to upload."}):p.map(T=>i.jsxs("div",{onMouseEnter:()=>s(T._id),onMouseLeave:()=>s(null),style:{display:"grid",gridTemplateColumns:"1fr 80px 80px 80px 50px",alignItems:"center",padding:"11px 16px",borderBottom:"1px solid var(--border)",background:a===T._id?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--foreground)"},children:T.name}),i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"var(--secondary)",padding:"1px 6px",borderRadius:"3px",width:"fit-content"},children:lLe(T)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:sLe(T.size)}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:Rq(T.createdAt)}),i.jsx("div",{style:{opacity:a===T._id?1:0,transition:"opacity 0.15s"},children:T.url&&i.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",title:"Open / download",style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex"},onClick:A=>A.stopPropagation(),children:i.jsx(ja,{size:13})})})]},T._id))]})}):i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:"Associate your account with an organization to manage content."}),i.jsx(ng,{})]}),l&&n&&i.jsx(M8e,{onClose:()=>c(!1),onSuccess:()=>{_(),c(!1)}}),u&&n&&i.jsx(V8e,{editing:f,onClose:()=>{d(!1),h(null)},onSuccess:()=>{_(),d(!1),h(null)}},f?`edit-${f._id}`:"create")]})}function uLe({subPage:e}){return e==="messaging-email"?i.jsx(sW,{}):e==="messaging-whatsapp"?i.jsx(aIe,{}):i.jsx(sW,{})}const dLe={super_admin:"Super Admin",admin:"Admin",moderator:"Moderator",viewer:"Viewer"},fLe={super_admin:{bg:"#fef3c7",color:"#92400e"},admin:{bg:"var(--accent)",color:"var(--accent-foreground)"},moderator:{bg:"#dcfce7",color:"#15803d"},viewer:{bg:"var(--secondary)",color:"var(--muted)"}};function HZ(e){var t;return e.firstName||e.lastName?[e.firstName,e.lastName].filter(Boolean).join(" ").trim():((t=e.email)==null?void 0:t.split("@")[0])??"User"}function pLe(e){return HZ(e).slice(0,2).toUpperCase()||"?"}function hLe(){const[e,t]=S.useState([]),[r,n]=S.useState(!0),[o,a]=S.useState(null),[s,l]=S.useState(!1),[c,u]=S.useState(null),d=S.useCallback(async()=>{var f;n(!0);try{const h=await Sx.list();t(((f=h.data)==null?void 0:f.users)??[])}catch{t([])}finally{n(!1)}},[]);return S.useEffect(()=>{d()},[d]),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[i.jsxs("div",{children:[i.jsx("p",{style:rg,children:"Portfolio"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:"User Management"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:[e.length," users across the platform"]})]}),i.jsxs("button",{onClick:()=>{u(null),l(!0)},style:{display:"flex",alignItems:"center",gap:"5px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:13})," Invite User"]})]}),i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 120px 80px 60px",padding:"8px 16px",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:["User","Email","Role","Events",""].map(f=>i.jsx("span",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em"},children:f},f))}),r?i.jsx("div",{style:{padding:"24px",color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading users…"}):e.map((f,h)=>{const p=fLe[f.role]??{bg:"var(--secondary)",color:"var(--muted)"},v=Gw[h%Gw.length],m=f.role==="super_admin"||f.role==="admin"?"All":"—";return i.jsxs("div",{onMouseEnter:()=>a(f._id),onMouseLeave:()=>a(null),style:{display:"grid",gridTemplateColumns:"1fr 1.6fr 120px 80px 60px",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--border)",background:o===f._id?"var(--secondary)":"var(--card)",transition:"background 0.12s"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx("div",{style:{width:"30px",height:"30px",borderRadius:"50%",background:v,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx("span",{style:{color:"#fff",fontSize:"10px",fontFamily:"var(--font-inter)",fontWeight:"600"},children:pLe(f)})}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:HZ(f)})]}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:f.email}),i.jsx("span",{style:{display:"inline-flex",width:"fit-content",padding:"2px 8px",borderRadius:"999px",background:p.bg,color:p.color,fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:dLe[f.role]??f.role}),i.jsx("span",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--foreground)"},children:m}),i.jsx("div",{style:{display:"flex",gap:"4px",opacity:o===f._id?1:0,transition:"opacity 0.15s"},children:i.jsx("button",{type:"button",onClick:()=>{u(f),l(!0)},style:{width:"26px",height:"26px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--muted)",cursor:"pointer"},onMouseEnter:b=>{b.currentTarget.style.borderColor="var(--primary)",b.currentTarget.style.color="var(--primary)"},onMouseLeave:b=>{b.currentTarget.style.borderColor="var(--border)",b.currentTarget.style.color="var(--muted)"},children:i.jsx(wi,{size:11})})})]},f._id)})]}),i.jsx(ng,{}),s&&i.jsx(lIe,{editUser:c,onClose:()=>{l(!1),u(null)},onSuccess:d})]})}function ng(){return i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})})}const gLe=[{id:"razorpay",label:"Razorpay"},{id:"payu",label:"PayU"},{id:"ccavenue",label:"CCAvenue"},{id:"cashfree",label:"Cashfree"},{id:"stripe",label:"Stripe"},{id:"paytm",label:"Paytm"}],Ms={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"};function N1({active:e,children:t,onClick:r}){return i.jsx("button",{type:"button",onClick:r,style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:e?"var(--accent)":"var(--card)",color:e?"var(--primary)":"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer",fontFamily:"var(--font-noto-sans)"},children:t})}function mLe(){const{user:e}=Mr(),t=(e==null?void 0:e.role)==="super_admin",[r,n]=S.useState("checkout"),[o,a]=S.useState(null),[s,l]=S.useState(null),[c,u]=S.useState([]),[d,f]=S.useState(0),[h,p]=S.useState(1),[v,m]=S.useState(""),[b,x]=S.useState(!0),[w,k]=S.useState(""),[j,_]=S.useState("razorpay"),[T,A]=S.useState(""),[P,N]=S.useState(""),[O,C]=S.useState(""),[I,R]=S.useState(""),[F,M]=S.useState(""),[Y,X]=S.useState(""),[$,ee]=S.useState(""),V=S.useCallback(async()=>{const re=await Hu.getOrgProfile();re.data?(a(re.data),ee(re.data.platformCommissionBps??"")):a(null)},[]),D=S.useCallback(async()=>{if(!t)return;const re=await Hu.getPlatformConfig();re.data&&l(re.data)},[t]),z=S.useCallback(async()=>{const re=await Hu.listTransactions({q:v||void 0,page:h,limit:20});re.data&&(u(re.data.transactions),f(re.data.total))},[v,h]);S.useEffect(()=>{let re=!1;return(async()=>{x(!0),k("");try{await V(),t&&await D()}catch{re||k("Failed to load payment settings")}finally{re||x(!1)}})(),()=>{re=!0}},[V,D,t]),S.useEffect(()=>{r==="ledger"&&z()},[r,z]),S.useEffect(()=>{r==="platform"&&t&&!s&&D()},[r,t,s,D]);const q=async()=>{if(!t||!o)return;k("");const re=await Hu.updateOrgProfile({checkoutMode:o.checkoutMode,platformCommissionBps:$===""?null:Number($),defaultCurrency:o.defaultCurrency,taxRate:o.taxRate,taxType:o.taxType||""});if(re.error){k(re.error);return}re.data&&a(re.data)},G=async()=>{if(!t)return;k("");const re=await Hu.updatePlatformConfig({enabled:s==null?void 0:s.enabled,testMode:s==null?void 0:s.testMode,defaultCommissionBps:s==null?void 0:s.defaultCommissionBps,razorpayKeyId:I||void 0,razorpayKeySecret:F||void 0,webhookSecret:Y||void 0});if(re.error){k(re.error);return}re.data&&l(re.data),R(""),M(""),X("")},U=async()=>{var ie;if(!t)return;k("");const re=j==="razorpay"?{keyId:P.trim(),keySecret:O.trim()}:{},H=await Hu.addGateway({provider:j,label:T||j,credentials:re,isPrimary:((ie=o==null?void 0:o.gateways)==null?void 0:ie.length)===0});if(H.error){k(H.error);return}H.data&&a(H.data),N(""),C(""),A("")},Q=async re=>{if(!t)return;const H=await Hu.patchGateway(re,{isPrimary:!0});H.data&&a(H.data)},K=async re=>{if(!t||!confirm("Remove this gateway?"))return;const H=await Hu.deleteGateway(re);H.data&&a(H.data)};return e?b?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):!o&&!t?i.jsx("p",{style:{color:"var(--muted)"},children:"No organisation linked to your account."}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"18px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"4px"},children:"Portfolio"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",margin:0},children:"Payment Settings"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",marginTop:"6px"},children:"Platform Razorpay with commission, or your own gateways. Bookings use the active configuration."})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px"},children:[i.jsx(N1,{active:r==="checkout",onClick:()=>n("checkout"),children:"Checkout"}),i.jsx(N1,{active:r==="gateways",onClick:()=>n("gateways"),children:"Gateways"}),i.jsx(N1,{active:r==="ledger",onClick:()=>n("ledger"),children:"Transactions"}),t&&i.jsx(N1,{active:r==="platform",onClick:()=>n("platform"),children:"Platform Razorpay"})]}),w&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:w}),r==="checkout"&&!o&&t&&i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:["Organisation checkout settings need an account linked to an organisation. You can still configure ",i.jsx("strong",{children:"Platform Razorpay"})," for all orgs using platform checkout."]})}),r==="checkout"&&o&&i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsx("h3",{style:{fontSize:"var(--text-sm)",margin:"0 0 12px"},children:"Checkout mode"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"12px"},children:[i.jsx("strong",{children:"Platform"}),": charges use EventBuzz Razorpay; commission (basis points) is added to the ticket subtotal. ",i.jsx("strong",{children:"Custom"}),": your primary active gateway (Razorpay fully supported; others coming soon)."]}),i.jsxs("select",{disabled:!t,style:{...Ms,maxWidth:"280px",marginBottom:"12px"},value:o.checkoutMode,onChange:re=>a({...o,checkoutMode:re.target.value}),children:[i.jsx("option",{value:"platform_razorpay",children:"Platform Razorpay (+ commission)"}),i.jsx("option",{value:"custom",children:"My gateways"})]}),i.jsxs("div",{style:{marginBottom:"12px"},children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Commission override (basis points, 200 = 2%). Blank = platform default."}),i.jsx("input",{disabled:!t,type:"number",style:{...Ms,maxWidth:"200px",marginTop:"4px"},value:$,onChange:re=>ee(re.target.value===""?"":Number(re.target.value))})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",marginBottom:"12px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Default currency"}),i.jsx("input",{disabled:!t,style:{...Ms,marginTop:"4px"},value:o.defaultCurrency,onChange:re=>a({...o,defaultCurrency:re.target.value})})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Tax type"}),i.jsx("input",{disabled:!t,style:{...Ms,marginTop:"4px"},value:o.taxType||"",onChange:re=>a({...o,taxType:re.target.value})})]})]}),t&&i.jsx("button",{type:"button",onClick:()=>void q(),style:{padding:"8px 16px",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer"},children:"Save checkout settings"}),!t&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Only super administrators can change checkout settings."})]}),r==="gateways"&&!o&&t&&i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:"Add an organisation to your account to manage custom payment gateways."})}),r==="gateways"&&o&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:[i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsx("h3",{style:{fontSize:"var(--text-sm)",margin:"0 0 12px"},children:"Configured gateways"}),o.gateways.length===0?i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No custom gateways yet."}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:o.gateways.map(re=>i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)"},children:[i.jsxs("div",{children:[i.jsx("strong",{style:{fontSize:"var(--text-sm)"},children:re.label||re.provider}),i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginLeft:"8px"},children:re.provider}),re.isPrimary&&i.jsx("span",{style:{fontSize:"10px",marginLeft:"8px",padding:"2px 6px",background:"var(--accent)",borderRadius:"4px"},children:"Primary"}),re.credentialsPublic&&re.credentialsPublic.keyId&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"4px 0 0"},children:["Key: ",re.credentialsPublic.keyId]})]}),t&&i.jsxs("div",{style:{display:"flex",gap:"6px"},children:[!re.isPrimary&&i.jsx("button",{type:"button",onClick:()=>void Q(re._id),style:{fontSize:"var(--text-xs)",padding:"6px 10px",cursor:"pointer"},children:"Set primary"}),i.jsx("button",{type:"button",onClick:()=>void K(re._id),style:{color:"var(--destructive)",background:"none",border:"none",cursor:"pointer"},children:i.jsx(Xr,{size:16})})]})]},re._id))})]}),t&&i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsx("h3",{style:{fontSize:"var(--text-sm)",margin:"0 0 12px"},children:"Add gateway"}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",maxWidth:"520px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Provider"}),i.jsx("select",{style:{...Ms,marginTop:"4px"},value:j,onChange:re=>_(re.target.value),children:gLe.map(re=>i.jsx("option",{value:re.id,children:re.label},re.id))})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Label"}),i.jsx("input",{style:{...Ms,marginTop:"4px"},value:T,onChange:re=>A(re.target.value),placeholder:"Display name"})]})]}),j==="razorpay"&&i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",marginTop:"12px",maxWidth:"520px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Key ID"}),i.jsx("input",{style:{...Ms,marginTop:"4px"},value:P,onChange:re=>N(re.target.value)})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Key secret"}),i.jsx("input",{type:"password",style:{...Ms,marginTop:"4px"},value:O,onChange:re=>C(re.target.value)})]})]}),j!=="razorpay"&&i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"12px"},children:["Gateway setup for ",j," is a stub until SDK wiring is complete. Razorpay is supported for live orders."]}),i.jsxs("button",{type:"button",onClick:()=>void U(),style:{marginTop:"14px",display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer"},children:[i.jsx(gr,{size:14})," Add"]})]})]}),r==="ledger"&&i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px",alignItems:"center",marginBottom:"14px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flex:"1 1 200px"},children:[i.jsx(pi,{size:16,style:{color:"var(--muted)"}}),i.jsx("input",{style:Ms,placeholder:"Search order / payment id",value:v,onChange:re=>m(re.target.value),onKeyDown:re=>{re.key==="Enter"&&(p(1),z())}})]}),i.jsx("button",{type:"button",onClick:()=>{p(1),z()},style:{padding:"8px 14px",cursor:"pointer",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)"},children:"Search"}),i.jsxs("button",{type:"button",onClick:()=>void Hu.downloadTransactionsCsv({q:v}),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",cursor:"pointer",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)"},children:[i.jsx(ja,{size:14})," Export CSV"]})]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"8px"},children:["Amounts in smallest currency unit (e.g. paise). ",d," total."]}),i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-xs)"},children:[i.jsx("thead",{children:i.jsx("tr",{style:{textAlign:"left",borderBottom:"1px solid var(--border)"},children:["Date","Status","Gross","Commission","Net","Gateway","Event","Participant","Order","Payment"].map(re=>i.jsx("th",{style:{padding:"8px 6px",color:"var(--muted)",fontWeight:600},children:re},re))})}),i.jsx("tbody",{children:c.map(re=>{var H,ie;return i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:{padding:"8px 6px"},children:re.createdAt?new Date(re.createdAt).toLocaleString():"—"}),i.jsx("td",{style:{padding:"8px 6px"},children:re.status}),i.jsx("td",{style:{padding:"8px 6px"},children:re.amountGross}),i.jsx("td",{style:{padding:"8px 6px"},children:re.commissionAmount}),i.jsx("td",{style:{padding:"8px 6px"},children:re.amountNet}),i.jsx("td",{style:{padding:"8px 6px"},children:re.gatewayProvider}),i.jsx("td",{style:{padding:"8px 6px"},children:typeof re.event=="object"&&((H=re.event)!=null&&H.name)?re.event.name:"—"}),i.jsx("td",{style:{padding:"8px 6px"},children:typeof re.participant=="object"&&((ie=re.participant)!=null&&ie.email)?re.participant.email:"—"}),i.jsx("td",{style:{padding:"8px 6px",fontFamily:"monospace",fontSize:"10px"},children:re.externalOrderId||"—"}),i.jsx("td",{style:{padding:"8px 6px",fontFamily:"monospace",fontSize:"10px"},children:re.externalPaymentId||"—"})]},re._id)})})]})}),d>20&&i.jsxs("div",{style:{display:"flex",gap:"8px",marginTop:"12px"},children:[i.jsx("button",{type:"button",disabled:h<=1,onClick:()=>p(re=>Math.max(1,re-1)),style:{padding:"6px 12px",cursor:"pointer"},children:"Previous"}),i.jsxs("span",{style:{fontSize:"var(--text-sm)"},children:["Page ",h]}),i.jsx("button",{type:"button",disabled:h*20>=d,onClick:()=>p(re=>re+1),style:{padding:"6px 12px",cursor:"pointer"},children:"Next"})]})]}),r==="platform"&&t&&!s&&i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Could not load platform payment configuration. Try again or check your session."}),r==="platform"&&t&&s&&i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"20px"},children:[i.jsxs("h3",{style:{fontSize:"var(--text-sm)",margin:"0 0 8px",display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx(xv,{size:16})," System-wide Razorpay"]}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"14px"},children:["Used when organisations choose platform checkout. Masked key: ",s.razorpayKeyIdMasked||"—"," · Webhook: ",s.webhookConfigured?"configured":"not set"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[i.jsx("input",{type:"checkbox",checked:s.enabled,onChange:re=>l({...s,enabled:re.target.checked})})," Enabled"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px"},children:[i.jsx("input",{type:"checkbox",checked:s.testMode,onChange:re=>l({...s,testMode:re.target.checked})})," Test mode"]}),i.jsxs("div",{style:{marginBottom:"12px"},children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Default commission (bps)"}),i.jsx("input",{type:"number",style:{...Ms,maxWidth:"200px",marginTop:"4px"},value:s.defaultCommissionBps,onChange:re=>l({...s,defaultCommissionBps:Number(re.target.value)})})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",maxWidth:"560px"},children:[i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Key ID (update)"}),i.jsx("input",{style:{...Ms,marginTop:"4px"},value:I,onChange:re=>R(re.target.value),placeholder:"rzp_…"})]}),i.jsxs("div",{children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Key secret"}),i.jsx("input",{type:"password",style:{...Ms,marginTop:"4px"},value:F,onChange:re=>M(re.target.value)})]}),i.jsxs("div",{style:{gridColumn:"1 / -1"},children:[i.jsx("label",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Webhook secret"}),i.jsx("input",{type:"password",style:{...Ms,marginTop:"4px"},value:Y,onChange:re=>X(re.target.value)})]})]}),i.jsx("button",{type:"button",onClick:()=>void G(),style:{marginTop:"14px",padding:"8px 16px",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer"},children:"Save platform config"})]}),i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Public checkout: POST /api/public/events/:eventId/payment/create-order"})})]}):i.jsx("p",{style:{color:"var(--muted)"},children:"Sign in to manage payments."})}const vLe=["participants","event_website","customise_event_website","custom_domain","invites_rsvp","registration_forms_with_custom_fields","custom_registration_workflow","email_confirmation_reminders","email_outreach_campaigns","custom_badge_and_print_file_creation","whatsapp_confirmation_reminders","bring_your_wa_number","custom_template_for_wa_messaging","agenda_builder","multi_track_agenda","speaker_management","abstract_management","ticketing_free_and_paid","collect_payment_using_your_upi_qr","payment_gateway_integration"],yLe=["qna_with_moderation","live_polls","multiple_quiz_modes","word_cloud","custom_theme","ai_summarization","ai_engagement_insights","content_management","ratings_for_sessions_and_speakers","feedback_forms_and_surveys","gamification","push_notifications"],VZ=[{title:"MANAGE",keys:vLe},{title:"ENGAGE",keys:yLe}],ln={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",outline:"none",boxSizing:"border-box"},wn=e=>{e.currentTarget.style.borderColor="var(--primary)",e.currentTarget.style.boxShadow="0 0 0 2px rgba(11,77,209,.10)"},Sn=e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"};function Jr({text:e,required:t}){return i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--card-foreground)",marginBottom:"5px"},children:[t&&i.jsx("span",{style:{color:"var(--destructive)",marginRight:"3px"},children:"*"}),e]})}function Kw({text:e}){return i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"4px 0 0"},children:e})}function en({children:e}){return i.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e})}function kb({children:e}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"14px"},children:e})}function Nl({children:e,title:t,subtitle:r,action:n}){return i.jsxs("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:[i.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:t}),r&&i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"3px 0 0"},children:r})]}),n]}),i.jsx("div",{style:{padding:"20px"},children:e})]})}function pc({onSave:e,disabled:t}){const[r,n]=S.useState(!1),[o,a]=S.useState(""),[s,l]=S.useState(!1),c=async()=>{a(""),l(!0);try{await e(),n(!0),setTimeout(()=>n(!1),2e3)}catch(u){a(u instanceof Error?u.message:"Save failed")}finally{l(!1)}};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"6px"},children:[o&&i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)"},children:o}),i.jsx("button",{type:"button",disabled:t||s,onClick:()=>void c(),style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 16px",borderRadius:"var(--radius-button)",background:r?"#22c55e":"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:t||s?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",opacity:t||s?.6:1,transition:"background .2s"},children:r?i.jsxs(i.Fragment,{children:[i.jsx(bi,{size:13})," Saved!"]}):i.jsxs(i.Fragment,{children:[i.jsx(sS,{size:13})," ",s?"Saving…":"Save Changes"]})})]})}function Qc({value:e,onChange:t,label:r}){return i.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",padding:"10px 0",borderBottom:"1px solid var(--border)"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:r}),i.jsx("div",{onClick:()=>t(!e),style:{width:"36px",height:"20px",borderRadius:"99px",background:e?"var(--primary)":"var(--border)",position:"relative",transition:"background .2s",flexShrink:0,cursor:"pointer"},children:i.jsx("div",{style:{position:"absolute",top:"3px",left:e?"19px":"3px",width:"14px",height:"14px",borderRadius:"50%",background:"#fff",transition:"left .2s"}})})]})}const xLe=[{value:"en-IN",label:"English (India)"},{value:"en-US",label:"English (US)"},{value:"hi",label:"Hindi"},{value:"mr",label:"Marathi"}],bLe=[{id:"org",label:"Organisation",icon:i.jsx(_b,{size:15}),superOnly:!1},{id:"profile",label:"My Profile",icon:i.jsx(Om,{size:15}),superOnly:!1},{id:"notifications",label:"Notifications",icon:i.jsx(fT,{size:15}),superOnly:!1},{id:"email",label:"Email delivery",icon:i.jsx(Xf,{size:15}),superOnly:!1},{id:"whatsapp",label:"WhatsApp Cloud",icon:i.jsx($h,{size:15}),superOnly:!1},{id:"integrations",label:"Integrations",icon:i.jsx(S$,{size:15}),superOnly:!0},{id:"security",label:"Security & Privacy",icon:i.jsx(fd,{size:15}),superOnly:!1},{id:"billing",label:"Billing",icon:i.jsx(xv,{size:15}),superOnly:!1}];function Lq(){return{emailRegistration:!0,emailFeedback:!0,emailPayment:!0,emailSummary:!1,pushRegistration:!0,pushSession:!0,pushMessage:!1,digestFrequency:"Daily"}}function wLe({canEdit:e}){const[t,r]=S.useState(!0),[n,o]=S.useState(null),[a,s]=S.useState(!1),l=S.useCallback(async()=>{r(!0);try{const v=await cs.get();o(v)}catch{o(null)}finally{r(!1)}},[]);S.useEffect(()=>{l()},[l]);const c=v=>{o(m=>m&&{...m,...v})},u=async()=>{if(!n||!e)return;const v=await cs.update({name:n.name,description:n.description,email:n.email,phone:n.phone,website:n.website,address:n.address,logo:n.logo,timezone:n.timezone,dateFormat:n.dateFormat,language:n.language});o(v)},d=async()=>{if(!n||!e)return;const v=await cs.update({timezone:n.timezone,dateFormat:n.dateFormat,language:n.language});o(v)},f=async v=>{if(!(!v||!e||!n)){s(!0);try{const m=await Sa(v,{eventId:"portfolio",module:"org/logo"});if(m!=null&&m.url){const b=await cs.update({logo:m.url});o(b)}}finally{s(!1)}}};if(t)return i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Loading organisation…"});if(!n)return i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"No organisation linked to your account."});const h=(n.name||"O").charAt(0).toUpperCase(),p=!e;return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsx(Nl,{title:"Organisation Profile",subtitle:"Basic information about your organisation",action:e?i.jsx(pc,{onSave:u}):void 0,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(en,{children:[i.jsx(Jr,{text:"Organisation Logo"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"14px"},children:[n.logo?i.jsx("img",{src:n.logo,alt:"",style:{width:56,height:56,borderRadius:"var(--radius-card)",objectFit:"cover",border:"1px solid var(--border)"}}):i.jsx("div",{style:{width:"56px",height:"56px",borderRadius:"var(--radius-card)",background:"var(--accent)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"var(--font-inter)",fontWeight:"700",fontSize:"18px",color:"var(--primary)",flexShrink:0},children:h}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:p||a?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",opacity:p?.5:1},children:[i.jsx(Fl,{size:13})," ",a?"Uploading…":"Upload Logo",i.jsx("input",{type:"file",accept:"image/*",disabled:p||a,style:{display:"none"},onChange:v=>{var m;return void f((m=v.target.files)==null?void 0:m[0])}})]})]})]}),i.jsxs(kb,{children:[i.jsxs(en,{children:[i.jsx(Jr,{text:"Organisation Name",required:!0}),i.jsx("input",{style:ln,value:n.name??"",readOnly:p,onChange:v=>c({name:v.target.value}),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Contact Email",required:!0}),i.jsx("input",{type:"email",style:ln,value:n.email??"",readOnly:p,onChange:v=>c({email:v.target.value}),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Phone Number"}),i.jsx("input",{type:"tel",style:ln,value:n.phone??"",readOnly:p,onChange:v=>c({phone:v.target.value}),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Website"}),i.jsx("input",{style:ln,value:n.website??"",readOnly:p,onChange:v=>c({website:v.target.value}),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Address"}),i.jsx("input",{style:ln,value:n.address??"",readOnly:p,onChange:v=>c({address:v.target.value}),onFocus:wn,onBlur:Sn})]})]}),!e&&i.jsx(Kw,{text:"Only super administrators can edit organisation settings."})]})}),i.jsx(Nl,{title:"Regional Settings",subtitle:"Configure timezone, date format, and language",action:e?i.jsx(pc,{onSave:d}):void 0,children:i.jsxs(kb,{children:[i.jsxs(en,{children:[i.jsx(Jr,{text:"Timezone"}),i.jsx("select",{style:{...ln,cursor:p?"default":"pointer",appearance:"none",paddingRight:"32px"},disabled:p,value:n.timezone??"Asia/Kolkata",onChange:v=>c({timezone:v.target.value}),onFocus:wn,onBlur:Sn,children:["Asia/Kolkata","Asia/Dubai","UTC","US/Eastern","Europe/London"].map(v=>i.jsx("option",{value:v,children:v},v))})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Date Format"}),i.jsx("select",{style:{...ln,cursor:p?"default":"pointer",appearance:"none",paddingRight:"32px"},disabled:p,value:n.dateFormat??"DD/MM/YYYY",onChange:v=>c({dateFormat:v.target.value}),onFocus:wn,onBlur:Sn,children:["DD/MM/YYYY","MM/DD/YYYY","YYYY-MM-DD"].map(v=>i.jsx("option",{value:v,children:v},v))})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Language"}),i.jsx("select",{style:{...ln,cursor:p?"default":"pointer",appearance:"none",paddingRight:"32px"},disabled:p,value:n.language??"en-IN",onChange:v=>c({language:v.target.value}),onFocus:wn,onBlur:Sn,children:xLe.map(v=>i.jsx("option",{value:v.value,children:v.label},v.value))})]})]})})]})}function SLe({user:e,refreshUser:t}){const[r,n]=S.useState(e.firstName??""),[o,a]=S.useState(e.lastName??""),[s,l]=S.useState(e.phone??""),[c,u]=S.useState(e.bio??""),[d,f]=S.useState(!1),[h,p]=S.useState(""),[v,m]=S.useState(""),[b,x]=S.useState("");S.useEffect(()=>{n(e.firstName??""),a(e.lastName??""),l(e.phone??""),u(e.bio??"")},[e._id,e.firstName,e.lastName,e.phone,e.bio]);const w=[e.firstName,e.lastName].filter(Boolean).map(_=>_.charAt(0)).join("").slice(0,2).toUpperCase()||"U",k=async()=>{const _=await Ma.updateMe({firstName:r,lastName:o,phone:s,bio:c});if(_.error)throw new Error(_.error);await t()},j=async()=>{if(v!==b)throw new Error("New passwords do not match");if(v.length<8)throw new Error("New password must be at least 8 characters");const _=await Ma.changePassword(h,v);if(_.error)throw new Error(_.error);p(""),m(""),x("")};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs(Nl,{title:"Personal Information",subtitle:"Your profile details visible to the team",action:i.jsx(pc,{onSave:k}),children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"14px",marginBottom:"18px"},children:[i.jsx("div",{style:{width:"56px",height:"56px",borderRadius:"50%",background:"var(--primary)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontFamily:"var(--font-inter)",fontWeight:"700",fontSize:"18px",flexShrink:0},children:e.profileImage?i.jsx("img",{src:e.profileImage,alt:"",style:{width:56,height:56,borderRadius:"50%",objectFit:"cover"}}):w}),i.jsx(Kw,{text:"Profile photo upload can be added to /auth/me with profileImage URL later."})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(kb,{children:[i.jsxs(en,{children:[i.jsx(Jr,{text:"First Name",required:!0}),i.jsx("input",{style:ln,value:r,onChange:_=>n(_.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Last Name",required:!0}),i.jsx("input",{style:ln,value:o,onChange:_=>a(_.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Email",required:!0}),i.jsx("input",{type:"email",style:{...ln,background:"var(--secondary)",color:"var(--muted)"},value:e.email,readOnly:!0})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Phone"}),i.jsx("input",{type:"tel",style:ln,value:s,onChange:_=>l(_.target.value),onFocus:wn,onBlur:Sn})]})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Role"}),i.jsx("input",{style:{...ln,background:"var(--secondary)",color:"var(--muted)"},value:e.role,readOnly:!0})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Bio"}),i.jsx("textarea",{style:{...ln,resize:"vertical",minHeight:"72px"},placeholder:"Short bio visible to your team…",value:c,onChange:_=>u(_.target.value),onFocus:wn,onBlur:Sn})]})]})]}),i.jsx(Nl,{title:"Change Password",subtitle:"Update your account password",children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(en,{children:[i.jsx(Jr,{text:"Current Password"}),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("input",{type:d?"text":"password",style:{...ln,paddingRight:"40px"},placeholder:"Enter current password",value:h,onChange:_=>p(_.target.value),onFocus:wn,onBlur:Sn}),i.jsx("button",{type:"button",onClick:()=>f(_=>!_),style:{position:"absolute",right:10,top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex"},children:d?i.jsx(gT,{size:14}):i.jsx(qh,{size:14})})]})]}),i.jsxs(kb,{children:[i.jsxs(en,{children:[i.jsx(Jr,{text:"New Password"}),i.jsx("input",{type:"password",style:ln,placeholder:"Min. 8 characters",value:v,onChange:_=>m(_.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Confirm Password"}),i.jsx("input",{type:"password",style:ln,placeholder:"Repeat new password",value:b,onChange:_=>x(_.target.value),onFocus:wn,onBlur:Sn})]})]}),i.jsx(pc,{onSave:j})]})})]})}function jLe({user:e,refreshUser:t}){const r={...Lq(),...e.notificationSettings},[n,o]=S.useState(r);S.useEffect(()=>{o({...Lq(),...e.notificationSettings})},[e._id,e.notificationSettings]);const a=c=>{const u=n[c];typeof u=="boolean"&&o(d=>({...d,[c]:!u}))},s=async()=>{const c=await Ma.updateMe({notificationSettings:n});if(c.error)throw new Error(c.error);await t()},l=n.digestFrequency??"Daily";return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs(Nl,{title:"Email Notifications",subtitle:"Choose which events trigger an email to you",action:i.jsx(pc,{onSave:s}),children:[i.jsx(Qc,{value:!!n.emailRegistration,onChange:()=>a("emailRegistration"),label:"New registration received"}),i.jsx(Qc,{value:!!n.emailFeedback,onChange:()=>a("emailFeedback"),label:"New feedback submission"}),i.jsx(Qc,{value:!!n.emailPayment,onChange:()=>a("emailPayment"),label:"Payment received or failed"}),i.jsx(Qc,{value:!!n.emailSummary,onChange:()=>a("emailSummary"),label:"Daily event summary report"})]}),i.jsxs(Nl,{title:"In-App Notifications",subtitle:"Push notifications within the platform",action:i.jsx(pc,{onSave:s}),children:[i.jsx(Qc,{value:!!n.pushRegistration,onChange:()=>a("pushRegistration"),label:"New attendee registration"}),i.jsx(Qc,{value:!!n.pushSession,onChange:()=>a("pushSession"),label:"Session status changes"}),i.jsx(Qc,{value:!!n.pushMessage,onChange:()=>a("pushMessage"),label:"New messages and replies"})]}),i.jsx(Nl,{title:"Digest Settings",subtitle:"How often to receive summary reports",action:i.jsx(pc,{onSave:s}),children:i.jsxs(en,{children:[i.jsx(Jr,{text:"Report Frequency"}),i.jsx("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:["None","Daily","Weekly","Monthly"].map(c=>i.jsx("button",{type:"button",onClick:()=>o(u=>({...u,digestFrequency:c})),style:{padding:"6px 16px",borderRadius:"var(--radius-button)",border:`1px solid ${l===c?"var(--primary)":"var(--border)"}`,background:l===c?"var(--accent)":"transparent",color:l===c?"var(--primary)":"var(--muted)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",transition:"all .12s"},children:c},c))})]})})]})}function kLe(){return i.jsxs("div",{style:{padding:"48px 24px",textAlign:"center",background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx(S$,{size:32,style:{color:"var(--muted)",marginBottom:"12px"}}),i.jsx("p",{style:{fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:"Coming soon"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0,maxWidth:"400px",marginLeft:"auto",marginRight:"auto"},children:"Third-party integrations will be available here in a future release."})]})}function _Le({user:e,refreshUser:t,isSuperAdmin:r}){var X;const[n,o]=S.useState(""),[a,s]=S.useState(""),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(""),[p,v]=S.useState(""),[m,b]=S.useState(!1),[x,w]=S.useState(""),[k,j]=S.useState(""),[_,T]=S.useState(null),[A,P]=S.useState(!1);S.useEffect(()=>{if(!n){T(null),P(!1);return}let $=!1;return P(!1),_v.toDataURL(n,{width:220,margin:2,errorCorrectionLevel:"M",color:{dark:"#111111",light:"#ffffff"}}).then(ee=>{$||T(ee)}).catch(()=>{$||(T(null),P(!0))}),()=>{$=!0}},[n]);const N=async()=>{if(a)try{await navigator.clipboard.writeText(a.replace(/\s/g,""))}catch{}},O=a?((X=a.replace(/\s/g,"").toUpperCase().match(/.{1,4}/g))==null?void 0:X.join(" "))??a:"",C=async()=>{const $=await Ma.setup2fa();if($.error||!$.data)throw new Error($.error??"Setup failed");o($.data.otpauthUrl),s($.data.manualEntryKey)},I=async()=>{const $=await Ma.verify2faSetup(l);if($.error)throw new Error($.error);o(""),s(""),c(""),await t()},R=async()=>{const $=await Ma.disable2fa(u,f||void 0);if($.error)throw new Error($.error);d(""),h(""),await t()},F=async()=>{v("");try{await zO.create({type:"data_export",message:"Data export requested from Settings"})}catch($){v($ instanceof Error?$.message:"Failed")}},M=async()=>{if(k.trim().toUpperCase()!=="DELETE")throw new Error("Type DELETE to confirm this request.");await zO.create({type:"account_deletion",message:x.trim()||"Account deletion requested from Settings",metadata:{source:"settings"}}),b(!1),w(""),j("")},Y=()=>{b(!1),w(""),j("")};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs(Nl,{title:"Two-Factor Authentication",subtitle:"Google Authenticator (TOTP). Sign-in will ask for a code when this is enabled.",action:e.twoFactorEnabled?i.jsx(pc,{onSave:R}):void 0,children:[!e.twoFactorEnabled&&i.jsx(i.Fragment,{children:n?i.jsxs("div",{style:{marginTop:"14px",display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--card-foreground)",margin:0},children:["Open Google Authenticator (or another TOTP app), choose ",i.jsx("strong",{children:"Add account"})," → ",i.jsx("strong",{children:"Scan a QR code"}),", then enter the code the app shows below."]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-start",gap:"20px"},children:[i.jsx("div",{style:{padding:"12px",background:"#fff",borderRadius:"var(--radius-card)",border:"1px solid var(--border)"},children:_?i.jsx("img",{src:_,alt:"QR code for two-factor setup",width:220,height:220,style:{display:"block"}}):A?i.jsx("div",{style:{width:220,height:220,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"var(--text-xs)",color:"var(--muted)",textAlign:"center",padding:"12px"},children:"Could not render QR. Use the manual key below."}):i.jsx("div",{style:{width:220,height:220,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Generating QR…"})}),i.jsxs("div",{style:{flex:"1 1 200px",minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:"var(--font-weight-medium)",color:"var(--muted)",margin:"0 0 6px"},children:"Can’t scan the code?"}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",color:"var(--card-foreground)",margin:"0 0 8px"},children:["In your app, choose ",i.jsx("strong",{children:"Enter a setup key"})," and type this secret (spaces optional):"]}),a?i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[i.jsx("code",{style:{fontSize:"13px",letterSpacing:"0.04em",wordBreak:"break-all",background:"var(--secondary)",padding:"10px 12px",borderRadius:"var(--radius-button)",fontFamily:"ui-monospace, monospace",flex:"1 1 160px"},children:O}),i.jsxs("button",{type:"button",onClick:()=>void N(),title:"Copy secret",style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-xs)",color:"var(--card-foreground)"},children:[i.jsx(Js,{size:14})," Copy"]})]}):i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"No manual key returned — try generating setup again."})]})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"6-digit code"}),i.jsx("input",{style:ln,value:l,onChange:$=>c($.target.value),placeholder:"000000",onFocus:wn,onBlur:Sn})]}),i.jsx(pc,{onSave:I,disabled:l.length<6})]}):i.jsxs("div",{style:{marginTop:"10px"},children:[i.jsx(Kw,{text:"Generate a secret to show a QR code. Scan it with your authenticator app, then enter the 6-digit code below to verify."}),i.jsx("button",{type:"button",onClick:()=>void C().catch($=>alert($ instanceof Error?$.message:"Error")),style:{marginTop:"10px",padding:"8px 16px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Generate setup"})]})}),e.twoFactorEnabled&&i.jsxs("div",{style:{marginTop:"14px",display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--card-foreground)",margin:0},children:"Two-factor authentication is enabled."}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Current password"}),i.jsx("input",{type:"password",style:ln,value:u,onChange:$=>d($.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Authenticator code"}),i.jsx("input",{style:ln,value:f,onChange:$=>h($.target.value),onFocus:wn,onBlur:Sn})]}),i.jsx(Kw,{text:"Save Changes above to disable 2FA."})]})]}),r&&i.jsxs(Nl,{title:"Data & Privacy",subtitle:"Requests are stored for administrator review",children:[p&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-xs)"},children:p}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[i.jsxs("button",{type:"button",onClick:()=>void F(),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:"Download My Data (request)"}),i.jsx(ka,{size:14,style:{color:"var(--muted)"}})]}),i.jsxs("button",{type:"button",onClick:()=>b(!0),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 14px",borderRadius:"var(--radius-button)",border:"1px solid rgba(163,17,19,0.3)",background:"rgba(163,17,19,0.04)",cursor:"pointer"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--destructive)"},children:"Delete Account (request)"}),i.jsx(ka,{size:14,style:{color:"var(--destructive)"}})]})]})]}),m&&i.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"delete-request-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:110,display:"flex",alignItems:"center",justifyContent:"center"},onClick:Y,children:i.jsxs("div",{style:{background:"var(--card)",borderRadius:"var(--radius-card)",width:"400px",maxWidth:"92vw",padding:"20px",boxShadow:"var(--shadow-xl)"},onClick:$=>$.stopPropagation(),children:[i.jsx("p",{id:"delete-request-title",style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 8px"},children:"Request account deletion"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",margin:"0 0 12px"},children:"This submits a request for administrator review. It does not immediately delete your account."}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Reason (optional)"}),i.jsx("textarea",{style:{...ln,width:"100%",minHeight:"72px",boxSizing:"border-box"},placeholder:"Why are you requesting deletion?",value:x,onChange:$=>w($.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Type DELETE to confirm",required:!0}),i.jsx("input",{style:{...ln,width:"100%",boxSizing:"border-box"},autoComplete:"off",value:k,onChange:$=>j($.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"16px"},children:[i.jsx("button",{type:"button",onClick:Y,style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",color:"var(--card-foreground)",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Cancel"}),i.jsx("button",{type:"button",onClick:()=>void M().catch($=>alert($ instanceof Error?$.message:"Error")),style:{padding:"6px 14px",borderRadius:"var(--radius-button)",border:"none",background:"var(--destructive)",color:"#fff",fontSize:"var(--text-sm)",fontWeight:"var(--font-weight-medium)",cursor:"pointer"},children:"Submit request"})]})]})})]})}function CLe(e,t,r){var a,s,l,c,u;const n="var(--primary)",o="var(--muted)";if(t==="participants"){const d=(a=e.defaultLimits)==null?void 0:a.maxParticipants;return{kind:"text",text:d==null?"Unlimited":Number(d).toLocaleString("en-IN"),color:n}}if(t==="event_website"){const d=(s=e.featureValues)==null?void 0:s.event_website,f=(l=r==null?void 0:r.options)==null?void 0:l.find(p=>p.value===d),h=(f==null?void 0:f.label)??d??"—";return h==="—"?{kind:"text",text:h,color:o}:{kind:"text",text:h,color:n}}if(t==="email_outreach_campaigns"){const d=(u=(c=e.featureValues)==null?void 0:c.email_outreach_campaigns)==null?void 0:u.maxEmails;return{kind:"text",text:d==null?"Unlimited":`Up to ${Number(d).toLocaleString("en-IN")} emails`,color:n}}return{kind:"boolean",included:e.featureKeys.includes(t)}}function ELe({org:e,plans:t,featureMetaList:r,refreshOrg:n,user:o}){const s=(e.subscription??{plan:"free"}).plan??"free",l=o.role==="super_admin"||o.role==="admin",[c,u]=S.useState([]),[d,f]=S.useState(!1),[h,p]=S.useState(null),[v,m]=S.useState(!1),[b,x]=S.useState(null),[w,k]=S.useState(""),[j,_]=S.useState(!1),T=S.useMemo(()=>{var O;return((O=t.find(C=>C.id===s))==null?void 0:O.tierIndex)??0},[t,s]),A=S.useMemo(()=>new Map(r.map(O=>[O.key,O])),[r]);S.useEffect(()=>{l&&(f(!0),ed.listInvoices().then(O=>u(O.invoices)).catch(()=>u([])).finally(()=>f(!1)))},[l,e._id]);const P=async O=>{if(l&&O.id!==s){if(O.id==="free"||!O.pricing||O.pricing.amount==null||O.pricing.amount<=0){window.alert("Use Upgrade only for paid plans.");return}p(O.id);try{await cT();const C=await ed.checkoutOrder(O.id),I=window.Razorpay;await new Promise((F,M)=>{let Y=!1;const X=new I({key:C.keyId,amount:C.amount,currency:C.currency,order_id:C.orderId,name:"EventBuzz",description:`Subscription: ${O.name}`,handler:$=>{Y=!0,ed.checkoutVerify({orderId:$.razorpay_order_id,paymentId:$.razorpay_payment_id,signature:$.razorpay_signature}).then(()=>{F()}).catch(ee=>{M(ee instanceof Error?ee:new Error("Verification failed"))})},modal:{ondismiss:()=>{Y||F()}},theme:{color:"#0B4DD1"},prefill:o.email?{email:o.email}:void 0});X.on("payment.failed",$=>{var ee;M(new Error(((ee=$.error)==null?void 0:ee.description)||"Payment failed"))}),X.open()}),await n({cacheBust:!0}),window.dispatchEvent(new CustomEvent(F3));const R=await ed.listInvoices();u(R.invoices)}catch(C){const I=C instanceof Error?C.message:"Upgrade failed";I&&window.alert(I)}finally{p(null)}}},N=async()=>{if(!(!b||w.trim().length<10)){_(!0);try{await ed.contactSalesRequest({targetPlanId:b.id,requirements:w.trim()}),window.alert("Thank you. Our team will reach out shortly."),x(null),k("")}catch(O){window.alert(O instanceof Error?O.message:"Failed to send your request.")}finally{_(!1)}}};return l?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:"12px",marginBottom:"12px"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Plans"}),i.jsx("button",{type:"button",onClick:()=>m(!0),disabled:t.length===0,style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",color:"var(--foreground)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:600,cursor:t.length===0?"not-allowed":"pointer",opacity:t.length===0?.5:1},children:"Compare plans"})]}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"},children:t.map(O=>{var $;const C=O.id===s,I=!!(($=O.pricing)!=null&&$.contactSales),R=O.tierIndex??0,F=!C&&R<T,M=!C&&!I&&O.id!=="free"&&O.pricing&&O.pricing.amount!=null&&O.pricing.amount>0&&R>T,Y=!C&&!F&&I,X={display:"block",width:"100%",marginTop:"10px",padding:"6px 0",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"};return i.jsxs("div",{style:{background:"var(--card)",border:`2px solid ${C?"var(--primary)":"var(--border)"}`,borderRadius:"var(--radius-card)",padding:"16px",position:"relative"},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"8px"},children:O.name}),O.tagline?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--foreground)",margin:"0 0 8px",whiteSpace:"pre-line",lineHeight:1.45},children:O.tagline}):null,O.pricing?i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",margin:"0 0 8px"},children:O.pricing.contactSales?"Contact sales":O.pricing.amount===0?`${O.pricing.currency} 0`:O.pricing.amount==null?"—":`${O.pricing.currency} ${Number(O.pricing.amount).toLocaleString("en-IN")} / ${O.pricing.interval}`}):null,i.jsx("p",{style:{fontSize:"10px",color:"var(--muted)",margin:"0 0 12px"},children:O.id}),C?i.jsx("button",{type:"button",disabled:!0,style:{...X,border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"default"},children:"Current plan"}):F?i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"10px 0 0",lineHeight:1.45},children:"Your subscription is on a higher tier — upgrade isn't needed for this plan."}):Y?i.jsx("button",{type:"button",onClick:()=>{x(O),k("")},style:X,children:"Contact sales"}):M?i.jsx("button",{type:"button",disabled:h!==null,onClick:()=>void P(O),style:{...X,cursor:h?"default":"pointer",opacity:h===O.id?.7:1},children:h===O.id?"Processing…":"Upgrade"}):null]},O.id)})})]}),b&&i.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:410,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",boxSizing:"border-box"},onClick:()=>!j&&x(null),children:i.jsxs("div",{role:"dialog","aria-labelledby":"contact-sales-title",style:{width:"min(100%, 480px)",background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",padding:"20px",boxShadow:"var(--elevation-sm)"},onClick:O=>O.stopPropagation(),children:[i.jsxs("h2",{id:"contact-sales-title",style:{margin:"0 0 8px",fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:600},children:["Contact sales — ",b.name]}),i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:"0 0 16px"},children:"Tell us what you need (volume, integrations, SLA, etc.). We'll email the EventBuzz platform team."}),i.jsx("label",{style:{display:"block",fontSize:"var(--text-sm)",fontWeight:600,marginBottom:"8px",color:"var(--foreground)"},children:"Requirements"}),i.jsx("textarea",{value:w,onChange:O=>k(O.target.value),rows:6,placeholder:"Minimum 10 characters…",style:{width:"100%",boxSizing:"border-box",padding:"10px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--input-background)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)",resize:"vertical",marginBottom:"16px"}}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px",justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",disabled:j,onClick:()=>x(null),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",cursor:j?"not-allowed":"pointer",fontSize:"var(--text-sm)"},children:"Cancel"}),i.jsx("button",{type:"button",disabled:j||w.trim().length<10,onClick:()=>void N(),style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:j||w.trim().length<10?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontWeight:600,opacity:w.trim().length<10?.6:1},children:j?"Sending…":"Send request"})]})]})}),v&&t.length>0&&i.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:400,background:"rgba(0,0,0,0.55)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",boxSizing:"border-box"},onClick:()=>m(!1),children:i.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"compare-plans-title",style:{width:"min(100%, 1200px)",height:"min(100vh - 32px, 900px)",maxHeight:"calc(100vh - 32px)",background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 25px 50px rgba(0,0,0,0.25)"},onClick:O=>O.stopPropagation(),children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"16px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[i.jsx("h2",{id:"compare-plans-title",style:{margin:0,fontSize:"var(--text-lg)",fontFamily:"var(--font-inter)",fontWeight:600},children:"Compare plans"}),i.jsx("button",{type:"button",onClick:()=>m(!1),style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",cursor:"pointer",fontSize:"var(--text-sm)"},children:"Close"})]}),i.jsx("div",{style:{flex:1,overflow:"auto",padding:"0 12px 16px"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:0,fontSize:"var(--text-xs)",minWidth:Math.max(480,t.length*100+200)},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{style:{position:"sticky",left:0,zIndex:2,background:"var(--card)",textAlign:"left",padding:"10px 12px",borderBottom:"2px solid var(--border)",borderRight:"1px solid var(--border)",minWidth:"200px",fontFamily:"var(--font-inter)",fontWeight:600},children:"Feature"}),t.map(O=>i.jsxs("th",{style:{padding:"10px 8px",borderBottom:"2px solid var(--border)",textAlign:"center",minWidth:"96px",fontFamily:"var(--font-inter)",fontWeight:600,color:O.id===s?"var(--primary)":"var(--foreground)",background:O.id===s?"var(--accent)":"var(--card)"},children:[O.name,O.id===s?i.jsx("span",{style:{display:"block",fontSize:"10px",fontWeight:500,opacity:.85},children:"Current"}):null]},O.id))]})}),i.jsx("tbody",{children:VZ.map(({title:O,keys:C})=>i.jsxs($e.Fragment,{children:[i.jsx("tr",{children:i.jsx("td",{colSpan:t.length+1,style:{padding:"12px 8px 6px",fontSize:"11px",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--primary)",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:O})}),C.map(I=>{const R=A.get(I),F=(R==null?void 0:R.label)??I;return i.jsxs("tr",{children:[i.jsx("td",{style:{position:"sticky",left:0,zIndex:1,background:"var(--card)",padding:"8px 12px",borderBottom:"1px solid var(--border)",borderRight:"1px solid var(--border)",color:"var(--primary)",verticalAlign:"top"},children:F}),t.map(M=>{const Y=CLe(M,I,R);return i.jsx("td",{style:{padding:"8px 8px",borderBottom:"1px solid var(--border)",textAlign:"center",verticalAlign:"middle",fontFamily:"var(--font-noto-sans)"},children:Y.kind==="boolean"?i.jsx("span",{role:"img","aria-label":Y.included?"Included":"Not included",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",color:Y.included?"var(--success-fg)":"var(--destructive)"},children:Y.included?i.jsx(bi,{size:18,strokeWidth:2.5,"aria-hidden":!0}):i.jsx(Gt,{size:18,strokeWidth:2.5,"aria-hidden":!0})}):i.jsx("span",{style:{color:Y.color,fontWeight:600},children:Y.text})},`${M.id}-${I}`)})]},I)})]},O))})]})})]})}),i.jsx(Nl,{title:"Invoices",subtitle:"Paid receipts — SaaS subscription and manual UPI enablement (Razorpay)",children:d?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:"Loading…"}):c.length===0?i.jsx("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:"No invoices yet."}):i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-xs)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{textAlign:"left",borderBottom:"1px solid var(--border)"},children:[i.jsx("th",{style:{padding:"8px 6px"},children:"Date"}),i.jsx("th",{style:{padding:"8px 6px"},children:"Description"}),i.jsx("th",{style:{padding:"8px 6px"},children:"Amount"}),i.jsx("th",{style:{padding:"8px 6px"}})]})}),i.jsx("tbody",{children:c.map(O=>i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsx("td",{style:{padding:"8px 6px",color:"var(--foreground)"},children:new Date(O.createdAt).toLocaleString()}),i.jsx("td",{style:{padding:"8px 6px"},children:O.invoiceLabel??O.planId}),i.jsxs("td",{style:{padding:"8px 6px"},children:[O.currency," ",Number(O.amountMajor).toLocaleString("en-IN",{minimumFractionDigits:2})]}),i.jsx("td",{style:{padding:"8px 6px"},children:i.jsx("button",{type:"button",onClick:()=>void ed.downloadInvoice(O.id).catch(C=>alert(C instanceof Error?C.message:"Download failed")),style:{padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--primary)",background:"transparent",color:"var(--primary)",cursor:"pointer",fontSize:"var(--text-xs)"},children:"Download"})})]},O.id))})]})})})]}):i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:["Only organisation ",i.jsx("strong",{children:"super administrators"})," and ",i.jsx("strong",{children:"administrators"})," can manage plans and billing. Ask an admin to upgrade or view invoices."]})}function ALe(){const{user:e}=Mr(),t=(e==null?void 0:e.role)==="super_admin"||(e==null?void 0:e.role)==="admin",[r,n]=S.useState(!0),[o,a]=S.useState(!1),[s,l]=S.useState(""),[c,u]=S.useState(587),[d,f]=S.useState(!1),[h,p]=S.useState(""),[v,m]=S.useState(""),[b,x]=S.useState(!1),[w,k]=S.useState(""),[j,_]=S.useState(""),[T,A]=S.useState(""),[P,N]=S.useState(""),[O,C]=S.useState(""),I=S.useCallback(async()=>{n(!0),C("");try{const M=await cs.getEmailSettings();if(M.error)throw new Error(M.error);const Y=M.data;Y&&(a(Y.enabled),l(Y.host),u(Y.port||587),f(Y.secure),p(Y.user||""),x(Y.hasPassword),k(Y.fromName||""),_(Y.fromAddress||""))}catch(M){C(M instanceof Error?M.message:"Failed to load")}finally{n(!1)}},[]);S.useEffect(()=>{I()},[I]);const R=async()=>{N(""),C("");try{const M=await cs.updateEmailSettings({enabled:o,host:s,port:c,secure:d,user:h,password:v||void 0,fromName:w,fromAddress:j});if(M.error)throw new Error(M.error);m(""),N("Saved."),await I()}catch(M){C(M instanceof Error?M.message:"Save failed")}},F=async()=>{N(""),C("");try{const M=await cs.testEmailSettings(T.trim());if(M.error)throw new Error(M.error);N("Test email sent.")}catch(M){C(M instanceof Error?M.message:"Test failed")}};return t?r?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px",maxWidth:520},children:i.jsxs(Nl,{title:"SMTP (bring your own)",subtitle:"Campaign and system emails use this server when enabled. Password is stored encrypted on the server.",children:[O&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:O}),P&&i.jsx("p",{style:{color:"#15803d",fontSize:"var(--text-sm)",margin:0},children:P}),i.jsx(Qc,{value:o,onChange:a,label:"Use custom SMTP"}),i.jsxs(en,{children:[i.jsx(Jr,{text:"SMTP host"}),i.jsx("input",{style:ln,value:s,onChange:M=>l(M.target.value),placeholder:"smtp.example.com",onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Port"}),i.jsx("input",{style:ln,type:"number",value:c,onChange:M=>u(parseInt(M.target.value,10)||587),onFocus:wn,onBlur:Sn})]}),i.jsx(Qc,{value:d,onChange:f,label:"Use SSL/TLS (e.g. port 465)"}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Username"}),i.jsx("input",{style:ln,value:h,onChange:M=>p(M.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:b?"Password (leave blank to keep existing)":"Password"}),i.jsx("input",{style:ln,type:"password",value:v,onChange:M=>m(M.target.value),autoComplete:"new-password",onFocus:wn,onBlur:Sn})]}),i.jsxs(kb,{children:[i.jsxs(en,{children:[i.jsx(Jr,{text:"From name"}),i.jsx("input",{style:ln,value:w,onChange:M=>k(M.target.value),onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"From email",required:!0}),i.jsx("input",{style:ln,value:j,onChange:M=>_(M.target.value),placeholder:"hello@yourdomain.com",onFocus:wn,onBlur:Sn})]})]}),i.jsx(pc,{onSave:R,disabled:o&&(!s.trim()||!j.trim())}),i.jsx(PLe,{}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Send test email to"}),i.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[i.jsx("input",{style:{...ln,flex:1},value:T,onChange:M=>A(M.target.value),placeholder:"you@example.com",onFocus:wn,onBlur:Sn}),i.jsx("button",{type:"button",onClick:()=>void F(),disabled:!T.trim(),style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:T.trim()?"pointer":"not-allowed",fontSize:"var(--text-sm)",whiteSpace:"nowrap"},children:"Send test"})]})]})]})}):i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Only administrators can change email delivery settings."})}function TLe(){const{user:e}=Mr(),t=(e==null?void 0:e.role)==="super_admin"||(e==null?void 0:e.role)==="admin",[r,n]=S.useState(!0),[o,a]=S.useState(!1),[s,l]=S.useState(""),[c,u]=S.useState(""),[d,f]=S.useState(""),[h,p]=S.useState(!1),[v,m]=S.useState(""),[b,x]=S.useState(""),w=S.useCallback(async()=>{n(!0),x("");try{const j=await cs.getWhatsAppSettings();if(j.error)throw new Error(j.error);const _=j.data;_&&(a(_.enabled),l(_.wabaId||""),u(_.phoneNumberId||""),p(_.hasAccessToken))}catch(j){x(j instanceof Error?j.message:"Failed to load")}finally{n(!1)}},[]);S.useEffect(()=>{w()},[w]);const k=async()=>{m(""),x("");try{const j=await cs.updateWhatsAppSettings({enabled:o,wabaId:s,phoneNumberId:c,accessToken:d||void 0});if(j.error)throw new Error(j.error);f(""),m("Saved."),await w()}catch(j){x(j instanceof Error?j.message:"Save failed")}};return t?r?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px",maxWidth:520},children:i.jsxs(Nl,{title:"WhatsApp Business Cloud",subtitle:"Connect your WABA and system user access token (encrypted at rest). Used to submit templates from Design → WhatsApp Templates. For single-tenant dev, the server can use META_WHATSAPP_DEFAULT_WABA_ID and META_WHATSAPP_ACCESS_TOKEN instead.",children:[b&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:b}),v&&i.jsx("p",{style:{color:"#15803d",fontSize:"var(--text-sm)",margin:0},children:v}),i.jsx(Qc,{value:o,onChange:a,label:"Enable WhatsApp Cloud"}),i.jsxs(en,{children:[i.jsx(Jr,{text:"WhatsApp Business Account ID (WABA)"}),i.jsx("input",{style:ln,value:s,onChange:j=>l(j.target.value),placeholder:"Numeric WABA ID from Meta",onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:"Phone number ID (optional)"}),i.jsx("input",{style:ln,value:c,onChange:j=>u(j.target.value),placeholder:"For future send path",onFocus:wn,onBlur:Sn})]}),i.jsxs(en,{children:[i.jsx(Jr,{text:h?"Access token (leave blank to keep existing)":"System user access token"}),i.jsx("input",{style:ln,type:"password",value:d,onChange:j=>f(j.target.value),autoComplete:"new-password",onFocus:wn,onBlur:Sn})]}),i.jsx(pc,{onSave:k,disabled:o&&!s.trim()})]})}):i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)"},children:"Only administrators can change WhatsApp Cloud settings."})}function PLe(){return i.jsx("div",{style:{height:1,background:"var(--border)",margin:"8px 0"}})}function ILe({settingsInitialSection:e,setSettingsInitialSection:t}){var w;const{user:r,refreshUser:n}=Mr(),[o,a]=S.useState([]),[s,l]=S.useState([]),[c,u]=S.useState(null),d=(r==null?void 0:r.role)==="super_admin",f=!!((w=r==null?void 0:r.organization)!=null&&w._id||r!=null&&r.organization),h=S.useMemo(()=>bLe.filter(k=>!k.superOnly||d).filter(k=>k.id!=="org"||f).filter(k=>k.id!=="email"||f).filter(k=>k.id!=="whatsapp"||f),[d,f]),[p,v]=S.useState("profile");S.useEffect(()=>{var k;h.find(j=>j.id===p)||v(((k=h[0])==null?void 0:k.id)??"profile")},[h,p]),S.useEffect(()=>{if(!e)return;const k=h.find(j=>j.id===e);k&&v(k.id),t(null)},[e,h,t]);const m=S.useCallback(async k=>{try{const j=await cs.get(k);u(j)}catch{u(null)}},[]);if(S.useEffect(()=>{const k=(r==null?void 0:r.role)==="super_admin"||(r==null?void 0:r.role)==="admin";if(!f||!k){a([]),l([]);return}p==="billing"&&ed.catalog().then(j=>{a(j.plans),l(j.features)}).catch(()=>{a([]),l([])})},[f,p,r==null?void 0:r.role]),S.useEffect(()=>{f&&(p==="org"||p==="billing")&&m()},[f,p,m]),!r)return i.jsx("p",{style:{color:"var(--muted)"},children:"Sign in to manage settings."});const b=h.find(k=>k.id===p),x=()=>p==="org"?i.jsx(wLe,{canEdit:d}):p==="profile"?i.jsx(SLe,{user:r,refreshUser:n}):p==="notifications"?i.jsx(jLe,{user:r,refreshUser:n}):p==="email"?i.jsx(ALe,{}):p==="whatsapp"?i.jsx(TLe,{}):p==="integrations"?i.jsx(kLe,{}):p==="security"?i.jsx(_Le,{user:r,refreshUser:n,isSuperAdmin:d}):p==="billing"&&c?i.jsx(ELe,{org:c,plans:o,featureMetaList:s,refreshOrg:m,user:r}):p==="billing"?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):null;return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Portfolio"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"Settings"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"4px"},children:"Manage your organisation, profile, and platform preferences."})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"200px 1fr",gap:"20px",alignItems:"start"},children:[i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden",position:"sticky",top:0},children:h.map((k,j)=>i.jsxs("button",{type:"button",onClick:()=>v(k.id),style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"11px 14px",background:p===k.id?"var(--accent)":"transparent",border:"none",borderBottom:j<h.length-1?"1px solid var(--border)":"none",cursor:"pointer",textAlign:"left",color:p===k.id?"var(--primary)":"var(--card-foreground)",transition:"background .12s"},onMouseEnter:_=>{p!==k.id&&(_.currentTarget.style.background="var(--secondary)")},onMouseLeave:_=>{p!==k.id&&(_.currentTarget.style.background="transparent")},children:[i.jsx("span",{style:{color:p===k.id?"var(--primary)":"var(--muted)",flexShrink:0},children:k.icon}),i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:p===k.id?"var(--font-weight-medium)":"var(--font-weight-normal)",whiteSpace:"nowrap"},children:k.label})]},k.id))}),i.jsxs("div",{children:[b&&i.jsx("p",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginBottom:"12px"},children:b.label}),x()]})]}),i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 EventBuzz"})})]})}const OLe=[{value:"en_US",label:"English (US)"},{value:"en_GB",label:"English (UK)"},{value:"en_IN",label:"English (India)"},{value:"hi_IN",label:"Hindi (India)"}];function ss(e){const t=/\{\{(\d+)\}\}/g,r=new Set;let n;for(;(n=t.exec(e))!==null;)r.add(parseInt(n[1],10));if(r.size===0)return{count:0};const o=Math.max(...r);for(let a=1;a<=o;a++)if(!r.has(a))return{count:0,error:`Variables must be sequential ({{1}}, {{2}}, …). Missing {{${a}}}.`};return{count:o}}function R1(e){const t=/\{\{(\d+)\}\}/g;let r=0,n;for(;(n=t.exec(e))!==null;)r=Math.max(r,parseInt(n[1],10));return r+1}const NLe=/^[.,;:!?…'"«»""''()[\]\s\u2013\u2014-]+/u,RLe=/[.,;:!?…'"«»""''()[\]\s\u2013\u2014-]+$/u;function g3(e,t){const r=String(e||"").trim();if(!r||!/\{\{\s*\d+\s*\}\}/.test(r))return null;const n=r.replace(NLe,"");if(/^\{\{\s*\d+\s*\}\}/.test(n))return`${t}: add real words before the first variable (not only punctuation).`;const o=r.replace(RLe,"");return/\{\{\s*\d+\s*\}\}$/.test(o)?`${t}: add words after the last variable—a trailing period alone is not enough (e.g. end with "…{{2}} See you there." not "…{{2}}.").`:null}function LLe(e){return String(e||"").trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"")}function Fq(e){const t=(e||"").toUpperCase();return t==="APPROVED"?{background:"rgba(34,197,94,0.15)",color:"#15803d",border:"1px solid rgba(34,197,94,0.35)"}:t==="PENDING"||t==="IN_APPEAL"||t==="PENDING_DELETION"?{background:"rgba(234,179,8,0.15)",color:"#a16207",border:"1px solid rgba(234,179,8,0.4)"}:t==="REJECTED"?{background:"rgba(239,68,68,0.12)",color:"#b91c1c",border:"1px solid rgba(239,68,68,0.35)"}:t==="PAUSED"||t==="DISABLED"?{background:"var(--secondary)",color:"var(--muted)",border:"1px solid var(--border)"}:{background:"var(--accent)",color:"var(--accent-foreground)",border:"1px solid var(--border)"}}function FLe(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return e}}function zLe(e){const t=e.find(n=>String(n.type||"").toUpperCase()==="BODY"),r=(t==null?void 0:t.text)||"";return r.length>80?`${r.slice(0,80)}…`:r||"—"}function L1(e,t){return String(e||"").replace(/\{\{\s*(\d+)\s*\}\}/g,(r,n)=>{const o=parseInt(n,10)-1,a=t[o];return a!==void 0&&String(a).length>0?String(a):`{{${n}}}`})}function MLe(e){var h,p;const t=Array.isArray(e)?e:[];let r=null,n=!1,o="",a=[],s="",l=[],c=null;const u=[];for(const v of t){if(!v||typeof v!="object")continue;const m=String(v.type||"").toUpperCase();if(m==="HEADER"){const b=String(v.format||"").toUpperCase();if(b==="IMAGE"){const x=v.example,w=(h=x==null?void 0:x.header_handle)==null?void 0:h[0],k=w!=null?String(w).trim():"";k&&/^https?:\/\//i.test(k)?r=k:k&&(n=!0)}else if(b==="TEXT"){o=String(v.text||"");const x=v.example;a=Array.isArray(x==null?void 0:x.header_text)?x.header_text.map(w=>String(w??"")):[]}}if(m==="BODY"){s=String(v.text||"");const b=v.example,x=(p=b==null?void 0:b.body_text)==null?void 0:p[0];l=Array.isArray(x)?x.map(w=>String(w??"")):[]}if(m==="FOOTER"&&(c=String(v.text||"").trim()||null),m==="BUTTONS"&&Array.isArray(v.buttons))for(const b of v.buttons){if(!b||typeof b!="object")continue;const x=String(b.type||"").toUpperCase(),w=String(b.text||"").trim();if(x==="QUICK_REPLY"&&w&&u.push({kind:"QUICK_REPLY",label:w}),x==="URL"&&w){const k=String(b.url||""),j=b.example,_=Array.isArray(j)&&j.length>0&&j[0]!=null?String(j[0]).trim():L1(k,[]);u.push({kind:"URL",label:w,url:_||L1(k,[])})}}}const d=o.trim()&&L1(o,a).trim()||null,f=L1(s,l);return{headerImageUrl:r,headerImageUnavailable:n,headerText:d,bodyText:f,footerText:c,buttons:u}}function DLe({model:e}){const t={background:"#fff",borderRadius:"8px",boxShadow:"0 1px 2px rgba(0,0,0,0.12)",overflow:"hidden",maxWidth:"100%",fontFamily:"var(--font-noto-sans), system-ui, sans-serif"},r={background:"linear-gradient(180deg, #efeae2 0%, #e5ddd5 100%)",borderRadius:"12px",padding:"16px 12px",border:"1px solid var(--border)"};return i.jsxs("div",{style:r,children:[i.jsx("p",{style:{margin:"0 0 10px",fontSize:"11px",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"Approximate WhatsApp preview"}),i.jsxs("div",{style:t,children:[e.headerImageUrl?i.jsx("img",{src:e.headerImageUrl,alt:"",style:{display:"block",width:"100%",maxHeight:"200px",objectFit:"cover",background:"#f0f0f0"}}):null,e.headerImageUnavailable?i.jsx("div",{style:{padding:"24px 12px",textAlign:"center",fontSize:"13px",color:"var(--muted)",background:"var(--secondary)",borderBottom:"1px solid var(--border)"},children:"Image header (sample is on Meta; preview not available)"}):null,i.jsxs("div",{style:{padding:"10px 12px 8px"},children:[e.headerText?i.jsx("p",{style:{margin:"0 0 8px",fontWeight:700,fontSize:"15px",lineHeight:1.35,color:"#111"},children:e.headerText}):null,i.jsx("p",{style:{margin:0,fontSize:"14px",lineHeight:1.45,color:"#111",whiteSpace:"pre-wrap"},children:e.bodyText||"—"}),e.footerText?i.jsx("p",{style:{margin:"10px 0 0",fontSize:"12px",lineHeight:1.35,color:"rgba(0,0,0,0.45)"},children:e.footerText}):null]}),e.buttons.length>0?i.jsx("div",{style:{borderTop:"1px solid rgba(0,0,0,0.06)"},children:e.buttons.map((n,o)=>i.jsx("div",{style:{padding:"11px 12px",textAlign:"center",fontSize:"14px",fontWeight:500,color:"#027eb5",borderTop:o>0?"1px solid rgba(0,0,0,0.06)":void 0,cursor:"default"},children:n.kind==="URL"?i.jsxs("span",{children:[n.label,i.jsx("span",{style:{display:"block",fontSize:"11px",fontWeight:400,color:"rgba(2,126,181,0.75)",marginTop:"4px",wordBreak:"break-all"},children:n.url})]}):n.label},`pv-btn-${o}`))}):null]})]})}const m3={padding:"4px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:"pointer",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)"};function v3(e){var t;return e?((t=km.find(r=>r.mergeKey===e))==null?void 0:t.label)??e:"—"}function BLe(){var he,je,xe,Re,ze;const{user:e}=Mr(),{setActiveNav:t,setSettingsInitialSection:r}=Li(),n=Nn(e),o=(e==null?void 0:e.role)==="super_admin"||(e==null?void 0:e.role)==="admin",[a,s]=S.useState([]),[l,c]=S.useState(!0),[u,d]=S.useState(""),[f,h]=S.useState(null),[p,v]=S.useState(!1),[m,b]=S.useState(null),[x,w]=S.useState(null),[k,j]=S.useState(!1),[_,T]=S.useState(""),[A,P]=S.useState("en_US"),[N,O]=S.useState("none"),[C,I]=S.useState(""),[R,F]=S.useState([]),[M,Y]=S.useState([]),[X,$]=S.useState(""),[ee,V]=S.useState("Hello {{1}}, thanks for registering."),[D,z]=S.useState(["Alex"]),[q,G]=S.useState([""]),[U,Q]=S.useState(""),[K,re]=S.useState("none"),[H,ie]=S.useState("Open link"),[de,le]=S.useState("custom"),[ke,ve]=S.useState(""),[se,be]=S.useState(""),[De,ae]=S.useState([]),[ue,Me]=S.useState({forms:[],microsites:[]}),[Se,Pe]=S.useState(!1),[Ee,Ae]=S.useState(""),[Ye,rt]=S.useState(!1),[He,xt]=S.useState(!1),st=S.useRef(null),Te=S.useCallback(async Le=>{var ft;d(""),c(!0);const Qe=await em.list({sync:Le==null?void 0:Le.sync});if(c(!1),Qe.error){d(typeof Qe.error=="string"?Qe.error:"Failed to load templates"),s([]);return}const mt=(ft=Qe.data)==null?void 0:ft.templates;s(Array.isArray(mt)?mt:[])},[]),et=S.useCallback(async()=>{const Le=await cs.getWhatsAppSettings();if(Le.error||!Le.data){h(null);return}const Qe=Le.data;h(Qe.graphAccess)},[]),Pt=S.useCallback(async()=>{var Le;if(n){Pe(!0);try{const mt=((Le=(await Lr.list({organization:n,limit:300})).data)==null?void 0:Le.events)??[],ft=[],It=[];await Promise.all(mt.map(async Bt=>{const dr=await Lr.emailerLinkTargets(Bt._id);if(dr.error||!dr.data)return;const pr=Bt.name?`${Bt.name} — `:"";for(const an of dr.data.forms)an.href&&ft.push({id:an.id,name:`${pr}${an.name}`,href:an.href});for(const an of dr.data.microsites)an.href&&It.push({id:an.id,name:`${pr}${an.name}`,href:an.href})})),ft.sort((Bt,dr)=>Bt.name.localeCompare(dr.name)),It.sort((Bt,dr)=>Bt.name.localeCompare(dr.name)),Me({forms:ft,microsites:It})}finally{Pe(!1)}}},[n]);S.useEffect(()=>{Te()},[Te]),S.useEffect(()=>{n&&et()},[n,et]),S.useEffect(()=>{p&&n&&Pt()},[p,n,Pt]),S.useEffect(()=>{!p||K!=="URL"||(de==="form"&&!ke.trim()&&ue.forms[0]&&ve(ue.forms[0].href),de==="microsite"&&!ke.trim()&&ue.microsites[0]&&ve(ue.microsites[0].href))},[p,K,de,ue,ke]),S.useEffect(()=>{const{count:Le,error:Qe}=ss(C);Qe||(F(mt=>{const ft=mt.slice(0,Le);for(;ft.length<Le;)ft.push("");return ft}),Y(mt=>{const ft=mt.slice(0,Le);for(;ft.length<Le;)ft.push("");return ft}))},[C]),S.useEffect(()=>{const{count:Le,error:Qe}=ss(ee);Qe||(z(mt=>{const ft=mt.slice(0,Le);for(;ft.length<Le;)ft.push("");return ft}),G(mt=>{const ft=mt.slice(0,Le);for(;ft.length<Le;)ft.push("");return ft}))},[ee]),S.useEffect(()=>{if(K!=="URL")return;const{count:Le,error:Qe}=ss(ke);Qe||ae(mt=>{const ft=mt.slice(0,Le);for(;ft.length<Le;)ft.push("");return ft})},[K,ke]);const qe=()=>{T(""),P("en_US"),O("none"),I(""),F([]),Y([]),$(""),V("Hello {{1}}, thanks for registering."),z(["Alex"]),G([""]),Q(""),re("none"),ie("Open link"),le("custom"),ve(""),be(""),ae([]),Ae(""),v(!0)},Et=async Le=>{if(Le){if(!Le.type.startsWith("image/")){Ae("Please choose an image file (JPEG, PNG, etc.).");return}Ae(""),xt(!0);try{const Qe=await Sa(Le,{eventId:"portfolio",module:"whatsapp/template-header"});Qe.url&&$(Qe.url)}catch(Qe){Ae(Qe instanceof Error?Qe.message:"Image upload failed")}finally{xt(!1),st.current&&(st.current.value="")}}},vt=(Le,Qe)=>{const mt=R1(Le),ft=Le.length===0||/\s$/.test(Le)?"":" ";Qe(Le+ft+`{{${mt}}}`)},Ft=()=>{const Le=[];if(N==="TEXT"&&C.trim()){const ft={type:"HEADER",format:"TEXT",text:C.trim()},{count:It}=ss(C);It>0&&(ft.example={header_text:R.slice(0,It).map(Bt=>Bt.trim()||"Sample")}),Le.push(ft)}N==="IMAGE"&&Le.push({type:"HEADER",format:"IMAGE",example:{header_handle:[X.trim()]}});const Qe={type:"BODY",text:ee.trim()},{count:mt}=ss(ee);if(mt>0&&(Qe.example={body_text:[D.slice(0,mt).map(ft=>ft.trim()||"Sample")]}),Le.push(Qe),U.trim()&&Le.push({type:"FOOTER",text:U.trim()}),K==="QUICK_REPLY"&&H.trim()&&Le.push({type:"BUTTONS",buttons:[{type:"QUICK_REPLY",text:H.trim()}]}),K==="URL"&&H.trim()&&ke.trim()){const ft=ke.trim(),It={type:"URL",text:H.trim(),url:ft},{count:Bt}=ss(ft);Bt>0&&(It.example=[se.trim()||ft.replace(/\{\{1\}\}/g,"sample")]),Le.push({type:"BUTTONS",buttons:[It]})}return Le},Ce=async()=>{const Le=LLe(_);if(!Le){Ae("Template name is required (lowercase letters, numbers, underscores).");return}if(!ee.trim()){Ae("Body text is required.");return}const Qe=g3(ee,"Body");if(Qe){Ae(Qe);return}if(U.trim()&&/\{\{\s*\d+\s*\}\}/.test(U)){Ae("Footer cannot contain variables. Use static text only or leave the footer empty.");return}if(N==="TEXT"&&C.trim()){const pr=g3(C,"Header");if(pr){Ae(pr);return}}if(H.trim()&&/\{\{\s*\d+\s*\}\}/.test(H)){const pr=g3(H,"Button label");if(pr){Ae(pr);return}}const mt=ss(ee);if(mt.error){Ae(mt.error);return}if(mt.count>0&&D.slice(0,mt.count).some(an=>!String(an||"").trim())){Ae("Enter sample text for each variable in the body (required by Meta).");return}if(N==="TEXT"&&C.trim()){const pr=ss(C);if(pr.error){Ae(`Header: ${pr.error}`);return}if(pr.count>0&&R.slice(0,pr.count).some(Jn=>!String(Jn||"").trim())){Ae("Enter sample text for each variable in the header (required by Meta).");return}}if(N==="IMAGE"&&!X.trim()){Ae("Provide a sample image URL for the image header (Meta requires an example).");return}if(K==="URL"){if(!H.trim()||!ke.trim()){Ae("URL buttons need a label and a URL.");return}const pr=ss(ke.trim());if(pr.error){Ae(`Button URL: ${pr.error}`);return}if(pr.count>0&&!se.trim()){Ae("Enter a full sample URL for the button (Meta needs an example when the URL contains {{1}}, etc.).");return}}rt(!0),Ae("");const ft=N==="TEXT"&&C.trim()?ss(C).count:0,It=mt.count,Bt=K==="URL"?ss(ke.trim()).count:0,dr=await em.create({name:Le,language:A,category:"MARKETING",components:Ft(),variableBindings:{header:ft>0?M.slice(0,ft).map(pr=>pr||""):[],body:It>0?q.slice(0,It).map(pr=>pr||""):[],url:Bt>0?De.slice(0,Bt).map(pr=>pr||""):[]}});if(rt(!1),dr.error){Ae(typeof dr.error=="string"?dr.error:"Create failed");return}v(!1),Te(),et()},lt=async()=>{j(!0),await Te({sync:!0}),j(!1)},Xe=async Le=>{w(Le);const Qe=await em.sync(Le);w(null),Qe.error||Te()},Be=async(Le,Qe)=>{if(!o||!window.confirm(`Remove template “${Qe}” from the dashboard? This does not delete it in Meta.`))return;w(Le);const mt=await em.remove(Le);w(null),mt.error||Te()},ct=()=>{r("whatsapp"),t("settings")},Tt=ss(ee),We=ss(C),ce=K==="URL"?ss(ke):{count:0};return n?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Design"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:0},children:"WhatsApp Templates"}),i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginTop:"6px",maxWidth:"640px"},children:"Create and submit message templates to your WhatsApp Business account via Meta. Status updates sync from Meta periodically or when you refresh."})]}),f===!1&&i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",flexWrap:"wrap",padding:"12px 16px",borderRadius:"var(--radius-card)",border:"1px solid rgba(234,179,8,0.45)",background:"rgba(234,179,8,0.08)"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[i.jsx($h,{size:18,style:{color:"#a16207",flexShrink:0}}),i.jsx("p",{style:{margin:0,fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"},children:"Connect WABA and access token under Settings, or set server defaults (META_WHATSAPP_DEFAULT_WABA_ID, META_WHATSAPP_ACCESS_TOKEN) to submit templates."})]}),i.jsxs("button",{type:"button",onClick:ct,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx(hc,{size:14})," WhatsApp settings"]})]}),u&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:u}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px",alignItems:"center"},children:[o&&i.jsxs("button",{type:"button",onClick:qe,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"var(--primary-foreground)",cursor:"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)"},children:[i.jsx(gr,{size:16})," Create template"]}),i.jsxs("button",{type:"button",disabled:k||l,onClick:()=>void lt(),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:k||l?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",opacity:k||l?.7:1},children:[i.jsx(_x,{size:16,style:{animation:k?"spin 0.8s linear infinite":void 0}}),"Sync from Meta"]})]}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:l?i.jsx("p",{style:{padding:"20px",color:"var(--muted)",margin:0},children:"Loading…"}):a.length===0?i.jsx("p",{style:{padding:"20px",color:"var(--muted)",margin:0},children:"No templates yet. Create one to submit it to Meta."}):i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--secondary)",textAlign:"left"},children:[i.jsx("th",{style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",fontWeight:"var(--font-weight-medium)"},children:"Name"}),i.jsx("th",{style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",fontWeight:"var(--font-weight-medium)"},children:"Language"}),i.jsx("th",{style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",fontWeight:"var(--font-weight-medium)"},children:"Category"}),i.jsx("th",{style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",fontWeight:"var(--font-weight-medium)"},children:"Status"}),i.jsx("th",{style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",fontWeight:"var(--font-weight-medium)"},children:"Last synced"}),i.jsx("th",{style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",fontWeight:"var(--font-weight-medium)",width:"200px"},children:"Actions"})]})}),i.jsx("tbody",{children:a.map(Le=>i.jsxs("tr",{style:{borderBottom:"1px solid var(--border)"},children:[i.jsxs("td",{style:{padding:"10px 14px",verticalAlign:"top"},children:[i.jsx("div",{style:{fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:Le.name}),i.jsx("div",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",marginTop:"4px"},children:zLe(Le.components||[])}),Le.rejectionReason?i.jsx("div",{style:{fontSize:"var(--text-xs)",color:"var(--destructive)",marginTop:"4px"},children:Le.rejectionReason}):null]}),i.jsx("td",{style:{padding:"10px 14px",verticalAlign:"top"},children:Le.language}),i.jsx("td",{style:{padding:"10px 14px",verticalAlign:"top"},children:Le.category}),i.jsx("td",{style:{padding:"10px 14px",verticalAlign:"top"},children:i.jsx("span",{style:{display:"inline-block",padding:"3px 8px",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)",fontWeight:"var(--font-weight-medium)",...Fq(Le.status)},children:Le.status||"—"})}),i.jsx("td",{style:{padding:"10px 14px",verticalAlign:"top",color:"var(--muted)",fontSize:"var(--text-xs)"},children:FLe(Le.lastSyncedAt)}),i.jsx("td",{style:{padding:"10px 14px",verticalAlign:"top"},children:i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px"},children:[i.jsxs("button",{type:"button",onClick:()=>b(Le),style:{padding:"5px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",cursor:"pointer",fontSize:"var(--text-xs)",display:"inline-flex",alignItems:"center",gap:"4px"},children:[i.jsx(qh,{size:12})," View"]}),o&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",disabled:x===Le._id,onClick:()=>void Xe(Le._id),style:{padding:"5px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:x===Le._id?"not-allowed":"pointer",fontSize:"var(--text-xs)",display:"inline-flex",alignItems:"center",gap:"4px"},children:[i.jsx(_x,{size:12})," Sync"]}),i.jsxs("button",{type:"button",disabled:x===Le._id,onClick:()=>void Be(Le._id,Le.name),style:{padding:"5px 10px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"transparent",cursor:x===Le._id?"not-allowed":"pointer",fontSize:"var(--text-xs)",color:"var(--destructive)",display:"inline-flex",alignItems:"center",gap:"4px"},children:[i.jsx(Xr,{size:12})," Remove"]})]})]})})]},Le._id))})]})})}),p&&i.jsx(ra,{onClose:()=>v(!1),title:"New WhatsApp template",breadcrumb:"Design · WhatsApp",description:"Category is Marketing. Use {{1}}, {{2}}… in header (text), body, or URL. Meta requires sample values for every variable. URL buttons can point to a form, microsite, or custom link.",completedCount:1,totalSections:1,showProgress:!1,ctaLabel:Ye?"Submitting…":"Submit to Meta",ctaDisabled:Ye,onCtaClick:()=>void Ce(),panelWidth:"min(720px, 100vw)",children:i.jsxs("div",{style:{padding:"20px",display:"flex",flexDirection:"column",gap:"14px"},children:[Ee&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",margin:0},children:Ee}),i.jsxs("p",{style:{margin:0,fontSize:"var(--text-xs)",color:"var(--muted)",fontFamily:"var(--font-noto-sans)"},children:[i.jsx("strong",{style:{color:"var(--card-foreground)"},children:"Category:"})," Marketing (fixed)"]}),i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Template name",required:!0}),i.jsx("input",{style:Ht,value:_,onChange:Le=>T(Le.target.value),placeholder:"welcome_message",onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Lowercase, numbers, underscores only (normalized on save)."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Language",required:!0}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:A,onChange:Le=>P(Le.target.value),onFocus:St,onBlur:jt,children:OLe.map(Le=>i.jsx("option",{value:Le.value,children:Le.label},Le.value))})})]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Header"}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:N,onChange:Le=>O(Le.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"none",children:"None"}),i.jsx("option",{value:"TEXT",children:"Text (optional variables {{1}}, …)"}),i.jsx("option",{value:"IMAGE",children:"Image"})]})})]}),N==="TEXT"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Insert variable in header:"}),i.jsxs("button",{type:"button",style:m3,onClick:()=>vt(C,I),children:["+ ",`{{${R1(C)}}}`]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Header text"}),i.jsx("input",{style:Ht,value:C,onChange:Le=>I(Le.target.value),onFocus:St,onBlur:jt}),We.error?i.jsx(Vt,{text:We.error}):We.count>0?i.jsx(Vt,{text:`${We.count} variable(s) — add sample text below for Meta review.`}):null]}),We.count>0&&!We.error&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:"For each {{1}}, {{2}}, … in the header — map to contact/event (like email) and enter the Meta sample (required)."}),Array.from({length:We.count},(Le,Qe)=>i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:`Maps to ({{${Qe+1}}} in header)`}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:M[Qe]??"",onChange:mt=>{const ft=mt.target.value,It=[...M];It[Qe]=ft,Y(It);const Bt=ft&&ME[ft];if(Bt){const dr=[...R];String(dr[Qe]??"").trim()||(dr[Qe]=Bt),F(dr)}},onFocus:St,onBlur:jt,children:km.map(mt=>i.jsx("option",{value:mt.mergeKey,children:mt.label},mt.mergeKey||"__none"))})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:`Meta sample for {{${Qe+1}}}`,required:!0}),i.jsx("input",{style:Ht,value:R[Qe]??"",onChange:mt=>{const ft=[...R];ft[Qe]=mt.target.value,F(ft)},onFocus:St,onBlur:jt})]})]},`hs-${Qe}`))]})]}),N==="IMAGE"&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"14px"},children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Sample image",required:!0}),i.jsx("input",{ref:st,type:"file",accept:"image/*",style:{display:"none"},onChange:Le=>{var Qe;return void Et((Qe=Le.target.files)==null?void 0:Qe[0])}}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"12px"},children:[i.jsx("button",{type:"button",disabled:He,onClick:()=>{var Le;return(Le=st.current)==null?void 0:Le.click()},style:{padding:"8px 14px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--secondary)",cursor:He?"not-allowed":"pointer",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",opacity:He?.7:1},children:He?"Uploading…":"Upload image"}),X.trim()?i.jsx("img",{src:X.trim(),alt:"",style:{maxHeight:"72px",maxWidth:"120px",objectFit:"cover",borderRadius:"var(--radius-button)",border:"1px solid var(--border)"}}):null]}),i.jsx(Vt,{text:"Upload stores the file and fills the URL below. Meta needs a public https URL it can fetch for the template example."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Image URL (from upload or paste)",required:!0}),i.jsx("input",{style:Ht,value:X,onChange:Le=>$(Le.target.value),placeholder:"https://…",onFocus:St,onBlur:jt})]})]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Insert variable in body:"}),i.jsxs("button",{type:"button",style:m3,onClick:()=>vt(ee,V),children:["+ ",`{{${R1(ee)}}}`]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Body",required:!0}),i.jsx("textarea",{style:{...Ht,minHeight:"100px",resize:"vertical"},value:ee,onChange:Le=>V(Le.target.value),onFocus:St,onBlur:jt}),Tt.error?i.jsx(Vt,{text:Tt.error}):Tt.count>0?i.jsx(Vt,{text:`${Tt.count} variable(s) — samples required below.`}):i.jsx(Vt,{text:"Meta: put real words before the first and after the last variable. Ending with only “.” or “!” after {{n}} is rejected (e.g. use “…{{2}} See you at the event.”). Footer must be static."})]}),Tt.count>0&&!Tt.error&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:"For each {{1}}, {{2}}, … in the body — map to contact/event (like email) and enter the Meta sample (required)."}),Array.from({length:Tt.count},(Le,Qe)=>i.jsxs(ro,{cols:2,children:[i.jsxs(dt,{children:[i.jsx(ht,{text:`Maps to ({{${Qe+1}}} in body)`}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:q[Qe]??"",onChange:mt=>{const ft=mt.target.value,It=[...q];It[Qe]=ft,G(It);const Bt=ft&&ME[ft];if(Bt){const dr=[...D];String(dr[Qe]??"").trim()||(dr[Qe]=Bt),z(dr)}},onFocus:St,onBlur:jt,children:km.map(mt=>i.jsx("option",{value:mt.mergeKey,children:mt.label},`b-${mt.mergeKey||"__none"}`))})})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:`Meta sample for {{${Qe+1}}}`,required:!0}),i.jsx("input",{style:Ht,value:D[Qe]??"",onChange:mt=>{const ft=[...D];ft[Qe]=mt.target.value,z(ft)},onFocus:St,onBlur:jt})]})]},`bs-${Qe}`))]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Footer (optional)"}),i.jsx("input",{style:Ht,value:U,onChange:Le=>Q(Le.target.value),onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Footer must be static text only—WhatsApp does not allow variables in the footer."})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Button (optional)"}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:K,onChange:Le=>re(Le.target.value),onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"none",children:"None"}),i.jsx("option",{value:"QUICK_REPLY",children:"Quick reply"}),i.jsx("option",{value:"URL",children:"URL"})]})})]}),K!=="none"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Button label",required:!0}),i.jsx("input",{style:Ht,value:H,onChange:Le=>ie(Le.target.value),onFocus:St,onBlur:jt})]}),K==="URL"&&i.jsxs(i.Fragment,{children:[i.jsxs(dt,{children:[i.jsx(ht,{text:"Link target"}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:de,onChange:Le=>{const Qe=Le.target.value;le(Qe),Qe==="custom"&&ve(""),Qe==="form"&&ue.forms[0]&&ve(ue.forms[0].href),Qe==="microsite"&&ue.microsites[0]&&ve(ue.microsites[0].href)},onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"custom",children:"Custom URL"}),i.jsx("option",{value:"form",children:"Form (published link)"}),i.jsx("option",{value:"microsite",children:"Event microsite"})]})}),Se&&i.jsx(Vt,{text:"Loading forms and microsites from your events…"})]}),de==="form"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Select form",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:((he=ue.forms.find(Le=>Le.href===ke))==null?void 0:he.id)??"",onChange:Le=>{const Qe=ue.forms.find(mt=>mt.id===Le.target.value);Qe&&ve(Qe.href)},onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:ue.forms.length?"Choose…":"No forms with links found"}),ue.forms.map(Le=>i.jsx("option",{value:Le.id,children:Le.name},Le.id))]})})]}),de==="microsite"&&i.jsxs(dt,{children:[i.jsx(ht,{text:"Select microsite",required:!0}),i.jsx(Zr,{children:i.jsxs("select",{style:Tr,value:((je=ue.microsites.find(Le=>Le.href===ke))==null?void 0:je.id)??"",onChange:Le=>{const Qe=ue.microsites.find(mt=>mt.id===Le.target.value);Qe&&ve(Qe.href)},onFocus:St,onBlur:jt,children:[i.jsx("option",{value:"",children:ue.microsites.length?"Choose…":"No microsites with publish folder found"}),ue.microsites.map(Le=>i.jsx("option",{value:Le.id,children:Le.name},Le.id))]})})]}),(de==="custom"||ce.count>0)&&i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Insert variable in URL:"}),i.jsxs("button",{type:"button",style:m3,onClick:()=>vt(ke,ve),children:["+ ",`{{${R1(ke)}}}`]})]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"URL",required:!0}),i.jsx("input",{style:Ht,value:ke,onChange:Le=>ve(Le.target.value),readOnly:de==="form"||de==="microsite",onFocus:St,onBlur:jt}),(de==="form"||de==="microsite")&&i.jsx(Vt,{text:"Filled from the selected form or microsite. Switch to Custom URL to edit or add {{1}} for dynamic paths."}),ce.error?i.jsx(Vt,{text:ce.error}):null]}),ce.count>0&&!ce.error&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",color:"var(--muted)",fontWeight:"var(--font-weight-medium)"},children:"Map each {{1}}, … in the button URL to contact/event (optional; used when sending)."}),Array.from({length:ce.count},(Le,Qe)=>i.jsxs(dt,{children:[i.jsx(ht,{text:`Maps to ({{${Qe+1}}} in URL)`}),i.jsx(Zr,{children:i.jsx("select",{style:Tr,value:De[Qe]??"",onChange:mt=>{const ft=mt.target.value,It=[...De];It[Qe]=ft,ae(It);const Bt=ft&&ME[ft];Bt&&(ce.count===1&&/\{\{1\}\}/.test(ke)&&!se.trim()?be(ke.replace(/\{\{1\}\}/g,Bt)):!se.trim()&&/^https?:\/\//i.test(Bt)&&be(Bt))},onFocus:St,onBlur:jt,children:km.map(mt=>i.jsx("option",{value:mt.mergeKey,children:mt.label},`u-${mt.mergeKey||"__none"}`))})})]},`ub-${Qe}`))]}),i.jsxs(dt,{children:[i.jsx(ht,{text:"Sample URL for button (required by Meta)",required:!0}),i.jsx("input",{style:Ht,value:se,onChange:Le=>be(Le.target.value),placeholder:ke.includes("{{1}}")?"Full URL with a real value instead of {{1}}":"Concrete URL Meta can verify",onFocus:St,onBlur:jt}),i.jsx(Vt,{text:"Meta needs one full example URL. If the template URL uses {{1}}, paste the final URL after substitution."})]})]})]})]})}),m&&i.jsx(ra,{onClose:()=>b(null),title:m.name,breadcrumb:"WhatsApp template",description:`${m.language} · ${m.category}${m.metaTemplateId?` · Meta ID ${m.metaTemplateId}`:""}`,completedCount:1,totalSections:1,showProgress:!1,hidePrimaryCta:!0,ctaLabel:"Close",ctaDisabled:!1,panelWidth:"min(520px, 100vw)",children:i.jsxs("div",{style:{padding:"20px",fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)"},children:[i.jsx("p",{style:{margin:"0 0 8px",color:"var(--muted)"},children:"Status"}),i.jsx("p",{style:{margin:"0 0 16px"},children:i.jsx("span",{style:{...Fq(m.status),padding:"4px 10px",borderRadius:"var(--radius-button)",fontSize:"var(--text-xs)"},children:m.status||"—"})}),m.rejectionReason?i.jsxs(i.Fragment,{children:[i.jsx("p",{style:{margin:"0 0 8px",color:"var(--muted)"},children:"Rejection reason"}),i.jsx("p",{style:{margin:"0 0 16px",color:"var(--destructive)"},children:m.rejectionReason})]}):null,m.variableBindings&&((((xe=m.variableBindings.header)==null?void 0:xe.length)??0)>0||(((Re=m.variableBindings.body)==null?void 0:Re.length)??0)>0||(((ze=m.variableBindings.url)==null?void 0:ze.length)??0)>0)?i.jsxs(i.Fragment,{children:[i.jsx("p",{style:{margin:"16px 0 8px",color:"var(--muted)"},children:"Variable → contact / event mapping"}),i.jsxs("ul",{style:{margin:"0 0 16px",paddingLeft:"18px",fontSize:"var(--text-xs)",color:"var(--card-foreground)",lineHeight:1.6},children:[(m.variableBindings.header??[]).map((Le,Qe)=>i.jsx("li",{children:`Header {{${Qe+1}}} → ${Le?v3(Le):"—"}`},`vh-${Qe}`)),(m.variableBindings.body??[]).map((Le,Qe)=>i.jsx("li",{children:`Body {{${Qe+1}}} → ${Le?v3(Le):"—"}`},`vb-${Qe}`)),(m.variableBindings.url??[]).map((Le,Qe)=>i.jsx("li",{children:`URL {{${Qe+1}}} → ${Le?v3(Le):"—"}`},`vu-${Qe}`))]})]}):null,i.jsx("p",{style:{margin:"16px 0 8px",color:"var(--muted)"},children:"Preview"}),i.jsx(DLe,{model:MLe(m.components)})]})}),i.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}):i.jsx("div",{style:{padding:"8px 0"},children:i.jsx("p",{style:{color:"var(--muted)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)"},children:"WhatsApp templates are available when your account is linked to an organisation."})})}const kl={width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",background:"var(--input-background)",fontSize:"var(--text-sm)",color:"var(--card-foreground)",boxSizing:"border-box"},nh={display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",border:"none",cursor:"pointer",fontSize:"var(--text-sm)"},Kp={...nh,background:"var(--secondary)",color:"var(--card-foreground)",border:"1px solid var(--border)"};function zq(e){const t=e.event;return t&&typeof t=="object"&&"name"in t&&t.name||"—"}function WLe(e){const t=e.event;return typeof t=="string"?t:t&&typeof t=="object"&&"_id"in t?String(t._id):""}function Mq(e){const t=cd,r=t.replace(/\/api\/?$/,"")+"/embed/concierge-widget.js";return`<script>
window.EB_CONCIERGE = { botId: "${e}", apiBase: "${t}" };
<\/script>
<script async src="${r}"><\/script>`}function qLe(){var de,le,ke,ve,se;const{user:e}=Mr(),[t,r]=S.useState([]),[n,o]=S.useState(null),[a,s]=S.useState(null),[l,c]=S.useState("settings"),[u,d]=S.useState([]),[f,h]=S.useState([]),[p,v]=S.useState(null),[m,b]=S.useState([]),[x,w]=S.useState(!0),[k,j]=S.useState(null),[_,T]=S.useState(!1),[A,P]=S.useState(""),[N,O]=S.useState(""),[C,I]=S.useState(""),[R,F]=S.useState(""),[M,Y]=S.useState(""),[X,$]=S.useState("auto"),[ee,V]=S.useState(null),D=Nn(e),z=S.useCallback(async()=>{var be;w(!0),V(null);try{const De=await Ls.list(D?{organization:D}:void 0);if(De.error){V(De.error),r([]);return}r(((be=De.data)==null?void 0:be.bots)||[])}finally{w(!1)}},[D]),q=S.useCallback(async be=>{var ue,Me;const De=await Ls.get(be);s(((ue=De.data)==null?void 0:ue.bot)||null);const ae=await Ls.listSources(be);d(((Me=ae.data)==null?void 0:Me.sources)||[])},[]);S.useEffect(()=>{z()},[z]),S.useEffect(()=>{if(!D){b([]);return}Lr.list({limit:300,organization:D}).then(be=>{var De;be.error||b(((De=be.data)==null?void 0:De.events)||[])})},[D]),S.useEffect(()=>{n?q(n):s(null)},[n,q]);const G=async()=>{if(!a)return;j(null);const be=await Ls.update(a._id,{name:a.name,wabaPhoneNumberId:a.wabaPhoneNumberId,enabled:!!a.enabled,greeting:a.greeting,registration:a.registration,knowledge:a.knowledge?{includeEventDetails:a.knowledge.includeEventDetails}:void 0});if(be.error){j(be.error);return}j("Settings saved"),await q(a._id),await z()},U=async()=>{var ae,ue;if(!A||!N){j("Select an event and enter a WhatsApp phone number ID.");return}j(null),V(null);let be;try{be=await Ls.create({eventId:A,wabaPhoneNumberId:N.trim(),name:C||void 0,enabled:!1})}catch(Me){j(Me instanceof Error?Me.message:"Request failed");return}if(be.error){j(be.error);return}if(be.status&&be.status>=400){j(`Server returned ${be.status}`);return}const De=(ae=be.data)==null?void 0:ae.bot;T(!1),P(""),O(""),I(""),await z(),De!=null&&De._id&&(o(De._id),c("settings"),j((ue=be.data)!=null&&ue.warning?`Chatbot created. Warning: ${be.data.warning}`:"Chatbot created successfully."))},Q=async()=>{!a||!confirm("Delete all knowledge sources and chunks for this bot?")||(await Ls.clearKnowledge(a._id),j("Knowledge cleared"),await q(a._id))},K=async()=>{a&&(await Ls.syncEventKnowledge(a._id),j("Event programme sync queued"),await q(a._id))},re=async()=>{!a||!R||!M||(await Ls.createSource(a._id,{type:"url",sourcePath:R,displayName:M,crawlScope:X}),F(""),Y(""),await q(a._id))},H=async be=>{if(!a)return;const De=WLe(a),ue=(await Sa(be,{eventId:De,module:"concierge",name:be.name})).s3Key;if(!ue){j("Upload failed — no S3 key");return}await Ls.createSource(a._id,{type:"pdf",sourcePath:ue,displayName:be.name}),await q(a._id)},ie=async be=>{var ae;if(!a)return;v(be);const De=await Ls.listChunks(a._id,be,!0);h(((ae=De.data)==null?void 0:ae.chunks)||[])};return e?i.jsxs("div",{style:{padding:24,maxWidth:1100,margin:"0 auto"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:20},children:[i.jsxs("h1",{style:{display:"flex",alignItems:"center",gap:10,margin:0,fontSize:22},children:[i.jsx(yte,{size:24})," WhatsApp Chatbots"]}),i.jsxs("button",{type:"button",style:nh,onClick:()=>T(!0),children:[i.jsx(gr,{size:16})," Create chatbot"]})]}),k&&i.jsxs("p",{style:{color:"var(--primary)",marginBottom:12},role:"status",children:[k,i.jsx("button",{type:"button",style:{marginLeft:8,background:"none",border:"none",cursor:"pointer"},onClick:()=>j(null),children:"×"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",gap:20},children:[i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:8,padding:12},children:[i.jsx("h2",{style:{fontSize:14,margin:"0 0 12px"},children:"Your bots"}),x&&i.jsx("p",{children:"Loading…"}),ee&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:13},children:ee}),!x&&!ee&&t.length===0&&i.jsx("p",{style:{color:"var(--muted-foreground)"},children:"No chatbots yet. Create one to get started."}),t.map(be=>i.jsxs("button",{type:"button",onClick:()=>{o(be._id),c("settings")},style:{display:"block",width:"100%",textAlign:"left",padding:"10px 12px",marginBottom:6,border:n===be._id?"2px solid var(--primary)":"1px solid var(--border)",borderRadius:6,background:"var(--card)",cursor:"pointer"},children:[i.jsx("div",{style:{fontWeight:600},children:be.name||zq(be)}),i.jsx("div",{style:{fontSize:12,color:"var(--muted-foreground)"},children:zq(be)}),i.jsxs("div",{style:{fontSize:11,marginTop:4},children:[be.enabled?"Active":"Draft"," · ",be.status]})]},be._id))]}),i.jsxs("div",{children:[!n&&i.jsx("p",{style:{color:"var(--muted-foreground)"},children:"Select a chatbot or create one."}),a&&i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{display:"flex",gap:8,marginBottom:16},children:["settings","knowledge","preview"].map(be=>i.jsx("button",{type:"button",style:l===be?nh:Kp,onClick:()=>c(be),children:be.charAt(0).toUpperCase()+be.slice(1)},be))}),l==="settings"&&i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[i.jsxs("label",{children:["Display name",i.jsx("input",{style:kl,value:a.name||"",onChange:be=>s({...a,name:be.target.value})})]}),i.jsxs("label",{children:["WhatsApp phone number ID",i.jsx("input",{style:kl,value:a.wabaPhoneNumberId,onChange:be=>s({...a,wabaPhoneNumberId:be.target.value})})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx("input",{type:"checkbox",checked:!!a.enabled,onChange:be=>s({...a,enabled:be.target.checked})}),"Enable chatbot"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx("input",{type:"checkbox",checked:((de=a.greeting)==null?void 0:de.enabled)!==!1,onChange:be=>s({...a,greeting:{...a.greeting,enabled:be.target.checked}})}),"Send greeting message"]}),i.jsxs("label",{children:["Greeting message",i.jsx("textarea",{style:{...kl,minHeight:80},value:((le=a.greeting)==null?void 0:le.message)||"",onChange:be=>s({...a,greeting:{...a.greeting,message:be.target.value}})}),i.jsxs("span",{style:{fontSize:11,color:"var(--muted-foreground)"},children:["Use ","{profileName}"," (default: Visitor) and ","{eventName}"," (default: Event)"]})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx("input",{type:"checkbox",checked:((ke=a.registration)==null?void 0:ke.promptIfUnregistered)!==!1,onChange:be=>s({...a,registration:{...a.registration,promptIfUnregistered:be.target.checked}})}),"Ask to register if number not registered"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx("input",{type:"checkbox",checked:((ve=a.registration)==null?void 0:ve.allowGuestSkip)!==!1,onChange:be=>s({...a,registration:{...a.registration,allowGuestSkip:be.target.checked}})}),"Allow skip registration (guest access)"]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8},children:[i.jsx("input",{type:"checkbox",checked:((se=a.knowledge)==null?void 0:se.includeEventDetails)!==!1,onChange:be=>s({...a,knowledge:{...a.knowledge,includeEventDetails:be.target.checked}})}),"Include event programme in knowledge base"]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[i.jsx("button",{type:"button",style:nh,onClick:G,children:"Save settings"}),i.jsxs("button",{type:"button",style:Kp,onClick:K,children:[i.jsx(_x,{size:14})," Sync event programme"]}),i.jsxs("button",{type:"button",style:{...Kp,color:"var(--destructive)"},onClick:Q,children:[i.jsx(Xr,{size:14})," Clear all knowledge"]})]}),i.jsxs("div",{style:{marginTop:14,padding:12,border:"1px solid var(--border)",borderRadius:8},children:[i.jsx("h3",{style:{margin:"0 0 8px",fontSize:14},children:"Website embed code"}),i.jsx("p",{style:{margin:"0 0 8px",fontSize:12,color:"var(--muted-foreground)"},children:"Paste this snippet into your website (one snippet per event chatbot)."}),i.jsx("textarea",{readOnly:!0,style:{...kl,minHeight:110,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},value:Mq(a._id)}),i.jsx("button",{type:"button",style:{...Kp,marginTop:8},onClick:()=>navigator.clipboard.writeText(Mq(a._id)).then(()=>j("Embed code copied")),children:"Copy embed code"})]})]}),l==="knowledge"&&i.jsxs("div",{children:[i.jsxs("div",{style:{marginBottom:16,padding:12,border:"1px solid var(--border)",borderRadius:8},children:[i.jsx("h3",{style:{margin:"0 0 8px",fontSize:14},children:"Add URL source"}),i.jsx("p",{style:{margin:"0 0 8px",fontSize:12,color:"var(--muted-foreground)"},children:"Indexes same-site pages; folder URLs limit to that path. PDFs and Word/PowerPoint links are included."}),i.jsx("input",{style:{...kl,marginBottom:8},placeholder:"https://…",value:R,onChange:be=>F(be.target.value)}),i.jsx("input",{style:{...kl,marginBottom:8},placeholder:"Display name",value:M,onChange:be=>Y(be.target.value)}),i.jsx("label",{style:{display:"block",fontSize:12,marginBottom:4},children:"Crawl scope"}),i.jsxs("select",{style:{...kl,marginBottom:8},value:X,onChange:be=>$(be.target.value),children:[i.jsx("option",{value:"auto",children:"Auto (detect from URL)"}),i.jsx("option",{value:"domain",children:"Whole site (same domain)"}),i.jsx("option",{value:"path",children:"This folder only"})]}),i.jsx("button",{type:"button",style:nh,onClick:re,children:"Add URL"})]}),i.jsxs("div",{style:{marginBottom:16},children:[i.jsx("label",{style:{fontSize:14,fontWeight:600},children:"Upload PDF"}),i.jsx("input",{type:"file",accept:"application/pdf",onChange:be=>{var ae;const De=(ae=be.target.files)==null?void 0:ae[0];De&&H(De)}})]}),i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{style:{textAlign:"left",padding:8},children:"Name"}),i.jsx("th",{children:"Type"}),i.jsx("th",{children:"Status"}),i.jsx("th",{})]})}),i.jsx("tbody",{children:u.map(be=>i.jsxs("tr",{children:[i.jsxs("td",{style:{padding:8},children:[be.displayName,be.type==="url"&&be.lastCrawlStats&&(be.status==="READY"||be.status==="PROCESSING")?i.jsxs("div",{style:{fontSize:11,color:"var(--muted-foreground)",marginTop:2},children:[be.lastCrawlStats.pages??0," pages, ",be.lastCrawlStats.assets??0," docs"]}):null]}),i.jsx("td",{children:be.type}),i.jsx("td",{children:be.status}),i.jsxs("td",{style:{padding:8},children:[i.jsx("button",{type:"button",style:Kp,onClick:()=>Ls.syncSource(a._id,be._id).then(()=>q(a._id)),children:"Sync"}),i.jsx("button",{type:"button",style:{...Kp,marginLeft:6},onClick:()=>{c("preview"),ie(be._id)},children:"Preview"})]})]},be._id))})]})]}),l==="preview"&&i.jsxs("div",{children:[i.jsxs("select",{style:kl,value:p||"",onChange:be=>ie(be.target.value),children:[i.jsx("option",{value:"",children:"Select source…"}),u.map(be=>i.jsxs("option",{value:be._id,children:[be.displayName," (",be.status,")"]},be._id))]}),p&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",style:{...nh,marginTop:12},onClick:()=>Ls.approveSource(a._id,p).then(()=>{j("Chunks approved for bot training"),ie(p)}),children:[i.jsx(Rte,{size:14})," Approve & train bot"]}),i.jsx("ul",{style:{listStyle:"none",padding:0,marginTop:16},children:f.map(be=>i.jsx("li",{style:{border:"1px solid var(--border)",padding:12,marginBottom:8,borderRadius:6},children:i.jsx("textarea",{style:{...kl,minHeight:60},defaultValue:be.rawText,onBlur:De=>Ls.patchChunk(a._id,be._id,De.target.value)})},be._id))})]})]})]})]})]}),_&&i.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:i.jsxs("div",{style:{background:"var(--card)",padding:24,borderRadius:12,width:400,maxWidth:"90vw"},children:[i.jsx("h2",{style:{marginTop:0},children:"Create chatbot"}),i.jsxs("label",{style:{display:"block",marginBottom:12},children:["Event",i.jsxs("select",{style:kl,value:A,onChange:be=>P(be.target.value),children:[i.jsx("option",{value:"",children:"Select event…"}),m.filter(be=>be.recordKind!=="activity").map(be=>i.jsx("option",{value:be._id,children:be.name},be._id))]}),!D&&i.jsx("span",{style:{fontSize:11,color:"var(--destructive)"},children:"Your account has no organisation — chatbots cannot be created."})]}),i.jsxs("label",{style:{display:"block",marginBottom:12},children:["Phone number ID",i.jsx("input",{style:kl,value:N,onChange:be=>O(be.target.value)})]}),i.jsxs("label",{style:{display:"block",marginBottom:12},children:["Name (optional)",i.jsx("input",{style:kl,value:C,onChange:be=>I(be.target.value)})]}),i.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",style:Kp,onClick:()=>T(!1),children:"Cancel"}),i.jsx("button",{type:"button",style:nh,onClick:U,children:"Create"})]})]})})]}):null}function bh({text:e,query:t}){if(!t.trim())return i.jsx(i.Fragment,{children:e});const r=e.toLowerCase().indexOf(t.toLowerCase());return r===-1?i.jsx(i.Fragment,{children:e}):i.jsxs(i.Fragment,{children:[e.slice(0,r),i.jsx("mark",{style:{background:"var(--accent)",color:"var(--accent-foreground)",borderRadius:"2px",padding:"0 1px"},children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}function Dq({event:e,query:t,onClick:r,isActive:n}){const o=z3[e.status];return i.jsxs("button",{onClick:r,style:{display:"flex",alignItems:"flex-start",gap:"14px",width:"100%",padding:"14px 16px",textAlign:"left",background:n?"var(--accent)":"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:a=>{a.currentTarget.style.background="var(--secondary)"},onMouseLeave:a=>{a.currentTarget.style.background=n?"var(--accent)":"var(--card)"},children:[i.jsx("div",{style:{width:"3px",alignSelf:"stretch",borderRadius:"2px",background:o.dot??o.color,flexShrink:0,minHeight:"40px"}}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginBottom:"4px"},children:[i.jsx("span",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-inter)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)"},children:i.jsx(bh,{text:e.title,query:t})}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"3px",padding:"1px 7px",borderRadius:"999px",background:o.bg,color:o.color,fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",whiteSpace:"nowrap"},children:[e.status==="Live"&&i.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"#16a34a"}}),e.status]}),i.jsx("span",{style:{padding:"1px 6px",borderRadius:"3px",background:"var(--secondary)",color:"var(--muted)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600"},children:e.type})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:"0 0 8px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(bh,{text:e.subtitle,query:t})}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"14px",flexWrap:"wrap"},children:[i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[i.jsx(Ab,{size:11,style:{flexShrink:0}}),i.jsx(bh,{text:e.location,query:t})]}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[i.jsx(Vi,{size:11,style:{flexShrink:0}}),e.startDate,e.startDate!==e.endDate?` – ${e.endDate}`:""]}),e.participants>0&&i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[i.jsx(Ri,{size:11,style:{flexShrink:0}}),e.participants," attended"]}),i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"3px",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[Koe[e.locationType],e.locationType]})]})]}),i.jsx(dT,{size:14,style:{color:"var(--muted)",flexShrink:0,marginTop:"2px"}})]})}function Bq({page:e,query:t,onClick:r,isActive:n}){return i.jsxs("button",{onClick:r,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"10px 14px",textAlign:"left",background:n?"var(--accent)":"transparent",border:"none",borderBottom:"1px solid var(--border)",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:o=>{o.currentTarget.style.background="var(--secondary)"},onMouseLeave:o=>{o.currentTarget.style.background=n?"var(--accent)":"transparent"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",background:"var(--secondary)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--primary)"},children:e.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 2px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.jsx(bh,{text:e.title,query:t})}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:[e.section," · ",i.jsx(bh,{text:e.description,query:t})]})]}),i.jsx(ka,{size:13,style:{color:"var(--muted)",flexShrink:0}})]})}function $Le({action:e,query:t,onClick:r,isActive:n}){return i.jsxs("button",{onClick:r,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"10px 14px",textAlign:"left",background:n?"var(--accent)":"transparent",border:"none",borderBottom:"1px solid var(--border)",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:o=>{o.currentTarget.style.background="var(--secondary)"},onMouseLeave:o=>{o.currentTarget.style.background=n?"var(--accent)":"transparent"},children:[i.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"var(--radius-button)",background:"var(--accent)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:"var(--accent-foreground)"},children:e.icon}),i.jsxs("div",{style:{flex:1,minWidth:0},children:[i.jsx("p",{style:{fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 2px"},children:i.jsx(bh,{text:e.title,query:t})}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",margin:0},children:i.jsx(bh,{text:e.description,query:t})})]}),i.jsx("span",{style:{padding:"3px 10px",borderRadius:"var(--radius-button)",background:"var(--primary)",color:"var(--primary-foreground)",fontSize:"11px",fontFamily:"var(--font-noto-sans)",fontWeight:"var(--font-weight-medium)",flexShrink:0},children:"Go →"})]})}function y3({label:e,count:t}){return i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 0 8px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em",margin:0},children:e}),i.jsx("span",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",background:"var(--secondary)",padding:"1px 7px",borderRadius:"999px"},children:t})]})}function ULe({query:e,onQueryChange:t,onNavigate:r,onEventSelect:n}){const[o,a]=S.useState("all"),l=Si()==="mobile",c=S.useMemo(()=>OU(e),[e]),u=e.trim(),d=[{id:"all",label:"All",count:c.total},{id:"events",label:"Events",count:c.events.length},{id:"pages",label:"Pages",count:c.pages.length},{id:"actions",label:"Actions",count:c.actions.length}],f=o==="all"||o==="events",h=o==="all"||o==="pages",p=o==="all"||o==="actions",v=x=>{n(x.id)},m=x=>{r(x.navId)},b=x=>{r(x.navTarget)};return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:"Portfolio"}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:l?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",margin:"0 0 16px"},children:"Search"}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"0 14px",height:"44px",background:"var(--card)",borderWidth:"1px",borderStyle:"solid",borderColor:"var(--border)",borderRadius:"var(--radius-card)",boxShadow:"var(--elevation-sm)",maxWidth:"680px"},children:[i.jsx(pi,{size:16,style:{color:"var(--muted)",flexShrink:0}}),i.jsx("input",{autoFocus:!0,type:"text",value:e,onChange:x=>{t(x.target.value),a("all")},placeholder:"Search events, pages, actions…",style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"var(--text-base)",fontFamily:"var(--font-noto-sans)",color:"var(--card-foreground)"}}),e&&i.jsx("button",{onClick:()=>t(""),style:{background:"none",border:"none",cursor:"pointer",color:"var(--muted)",display:"flex",padding:"2px"},children:i.jsx(Gt,{size:14})})]})]}),u?c.total===0?i.jsxs("div",{style:{textAlign:"center",padding:"60px 20px",border:"2px dashed var(--border)",borderRadius:"var(--radius-card)"},children:[i.jsx("div",{style:{width:"44px",height:"44px",borderRadius:"var(--radius-card)",background:"var(--secondary)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 14px"},children:i.jsx(pi,{size:20,style:{color:"var(--muted)"}})}),i.jsxs("p",{style:{fontFamily:"var(--font-inter)",fontSize:"var(--text-base)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",marginBottom:"6px"},children:['No results for "',u,'"']}),i.jsx("p",{style:{fontFamily:"var(--font-noto-sans)",fontSize:"var(--text-sm)",color:"var(--muted)",marginBottom:"20px"},children:"Try searching for event names, page names, or actions."}),i.jsx("div",{style:{display:"flex",gap:"8px",justifyContent:"center",flexWrap:"wrap"},children:["conference","workshop","settings","faculty","design","payments"].map(x=>i.jsx("button",{onClick:()=>{t(x)},style:{padding:"5px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--card)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",cursor:"pointer"},children:x},x))})]}):i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px",flexWrap:"wrap",gap:"10px"},children:[i.jsx("div",{style:{display:"flex",gap:"2px",background:"var(--secondary)",borderRadius:"var(--radius-button)",padding:"2px"},children:d.map(x=>i.jsxs("button",{onClick:()=>a(x.id),style:{display:"flex",alignItems:"center",gap:"5px",padding:"5px 12px",borderRadius:"var(--radius-button)",border:"none",cursor:"pointer",background:o===x.id?"var(--card)":"transparent",boxShadow:o===x.id?"var(--elevation-sm)":"none",color:o===x.id?"var(--foreground)":"var(--muted)",fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",fontWeight:o===x.id?"var(--font-weight-medium)":"var(--font-weight-normal)",transition:"all 0.12s"},children:[x.label,x.count>0&&i.jsx("span",{style:{minWidth:"16px",height:"16px",borderRadius:"999px",padding:"0 4px",background:o===x.id?"var(--primary)":"var(--border)",color:o===x.id?"var(--primary-foreground)":"var(--muted)",fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"600",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:x.count})]},x.id))}),i.jsxs("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:[c.total," result",c.total!==1?"s":""," for ",i.jsxs("strong",{style:{color:"var(--foreground)",fontFamily:"var(--font-inter)"},children:['"',u,'"']})]})]}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[f&&c.events.length>0&&i.jsxs("div",{children:[i.jsx(y3,{label:"Events",count:c.events.length}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:c.events.map(x=>i.jsx(Dq,{event:x,query:u,onClick:()=>v(x),isActive:!1},x.id))})]}),h&&c.pages.length>0&&i.jsxs("div",{children:[i.jsx(y3,{label:"Pages",count:c.pages.length}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:c.pages.map(x=>i.jsx(Bq,{page:x,query:u,onClick:()=>m(x),isActive:!1},x.id))})]}),p&&c.actions.length>0&&i.jsxs("div",{children:[i.jsx(y3,{label:"Quick Actions",count:c.actions.length}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:c.actions.map(x=>i.jsx($Le,{action:x,query:u,onClick:()=>b(x),isActive:!1},x.id))})]})]})]}):i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em",marginBottom:"10px"},children:"Recent Events"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:PT.slice(0,5).map(x=>i.jsx(Dq,{event:x,query:"",onClick:()=>v(x),isActive:!1},x.id))})]}),i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",fontWeight:"700",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.07em",marginBottom:"10px"},children:"Browse Pages"}),i.jsx("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:"var(--radius-card)",overflow:"hidden"},children:IU.slice(0,8).map(x=>i.jsx(Bq,{page:x,query:"",onClick:()=>m(x),isActive:!1},x.id))})]})]})]})}function HLe(){const{activeNav:e,setActiveNav:t,selectedEventId:r,setSelectedEventId:n,searchQuery:o,setSearchQuery:a,settingsInitialSection:s,setSettingsInitialSection:l}=Li(),[c,u]=S.useState(!1),d=Si(),[f,h]=S.useState(null),[p,v]=S.useState(!1),m=S.useCallback(async()=>{if(!r){h(null),v(!1);return}v(!0);try{const w=await Lr.get(r);h(w.data??null)}finally{v(!1)}},[r]);S.useEffect(()=>{e!=="dashboard"&&e!=="analytics"||m()},[e,m]);const b=w=>{n(w),t("dashboard")},x=()=>e==="search"?i.jsx(ULe,{query:o,onQueryChange:a,onNavigate:t,onEventSelect:b}):e==="home"?i.jsx(C5e,{}):e==="events"?i.jsx(cEe,{onNavigateToEvent:b}):e==="activities"?i.jsx(gEe,{onNavigateToActivity:w=>{n(w),t("activity-detail")}}):e==="activity-detail"?i.jsx(VPe,{}):e==="design-whatsapp-templates"?i.jsx(BLe,{}):e==="messaging-whatsapp-chatbots"?i.jsx(qLe,{}):["design-brochure","design-microsite","design-badges","design-emailers"].includes(e)?i.jsx(GRe,{subPage:e}):e==="faculty"?i.jsx(QRe,{}):e==="all-participants"?i.jsx(ZRe,{}):e==="participant-lists"?i.jsx(tLe,{}):["forms-feedback","forms-registration","forms-other","forms-add"].includes(e)?i.jsx(aLe,{subPage:e}):["content-library","content-collections"].includes(e)?i.jsx(cLe,{subPage:e}):["messaging-email","messaging-whatsapp"].includes(e)?i.jsx(uLe,{subPage:e}):e==="payment"?i.jsx(mLe,{}):e==="user-management"?i.jsx(hLe,{}):e==="settings"?i.jsx(ILe,{settingsInitialSection:s,setSettingsInitialSection:l}):e==="participants"?i.jsx(VG,{}):e==="attendance"?i.jsx(h5e,{}):e==="ticketing"?i.jsx(t8e,{}):e==="permissions"?i.jsx(QPe,{}):e==="event-activities"?i.jsx(zX,{}):e==="rewards"?i.jsx(JPe,{eventId:r}):e==="website"?i.jsx(C8e,{}):e==="analytics"?i.jsx(gje,{eventId:r,onNavigate:t}):e==="dashboard"?i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px",flexWrap:"wrap"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",marginBottom:"4px"},children:p&&r?"Loading…":(f==null?void 0:f.name)??(r?"Event":"Select an event")}),i.jsx("h1",{style:{fontFamily:"var(--font-inter)",fontSize:d==="mobile"?"var(--text-xl)":"var(--text-2xl)",fontWeight:"var(--font-weight-medium)",color:"var(--foreground)",lineHeight:"1.2"},children:"Event Home"})]}),i.jsx(Hae,{})]}),i.jsx(jje,{event:f,loading:p&&!!r,canEdit:!!r,onEditEvent:()=>r&&u(!0)}),c&&r&&i.jsx(bae,{eventId:r,onClose:()=>u(!1),onSuccess:()=>{u(!1),m()}}),i.jsx(_le,{}),i.jsx(lB,{embedInDashboard:!0}),i.jsx("div",{style:{paddingTop:"8px",borderTop:"1px solid var(--border)",textAlign:"center"},children:i.jsx("p",{style:{fontSize:"var(--text-xs)",fontFamily:"var(--font-noto-sans)",color:"var(--muted)"},children:"© 2026 Stratawiz Technologies Pvt Ltd · EventBuzz"})})]}):i.jsx(lB,{});return i.jsx(i.Fragment,{children:x()})}function VLe(){const{activeNav:e,setActiveNav:t,selectedEventId:r,setSelectedEventId:n,setSearchQuery:o,sidebarCollapsed:a,setSidebarCollapsed:s,drawerOpen:l,setDrawerOpen:c}=Li(),u=Si(),d=u==="mobile"||u==="tablet",f=p=>{n(p),t("dashboard")},h=p=>{o(p),t("search")};return S.useEffect(()=>{!r||e!=="agenda"||t("dashboard")},[r,e,t]),S.useEffect(()=>{r&&(e==="questions"||e==="quiz")&&t("event-activities")},[r,e,t]),i.jsxs("div",{style:{display:"flex",height:"100vh",overflow:"hidden",background:"var(--background)"},children:[!d&&i.jsx(fN,{activeItem:e,onItemClick:t,collapsed:a,onToggleCollapse:()=>s(p=>!p),selectedEventId:r,onEventSelect:f}),d&&i.jsx(fN,{activeItem:e,onItemClick:t,collapsed:!1,onToggleCollapse:()=>{},drawerOpen:l,onDrawerClose:()=>c(!1),selectedEventId:r,onEventSelect:f}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden",minWidth:0},children:[i.jsx(nae,{onMenuClick:()=>c(p=>!p),onNavigate:t,onEventSelect:f,onOpenSearchPage:h}),r!==null&&iae.has(e)&&i.jsx(oae,{activeItem:e,onNavigate:t}),i.jsx("main",{style:{flex:1,overflowY:"auto",background:"var(--background)"},children:i.jsx("div",{style:{padding:u==="mobile"?"16px 14px":u==="tablet"?"20px 20px":"24px 28px",maxWidth:"1280px"},children:i.jsx(HLe,{})})})]})]})}function rT(){const{user:e,loading:t,checked:r}=Mr(),n=Cd();return!r||t?i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(_h,{message:"Loading…"})}):e?i.jsx(r$,{}):i.jsx(gh,{to:"/login",state:{from:n},replace:!0})}function YLe(){const{navId:e}=Jw(),t=Ed(),r=e||"home",n=o=>t(`/${o}`);return i.jsx(Voe,{activeNavFromUrl:r,setActiveNavToUrl:n,children:i.jsx(VLe,{})})}rT.AppShellWithNav=YLe;const x3={display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",borderRadius:"var(--radius-button)",fontSize:"var(--text-sm)",fontFamily:"var(--font-noto-sans)",textDecoration:"none",color:"var(--sidebar-foreground)",border:"none",background:"transparent",cursor:"pointer"};function GLe(){const{user:e,loading:t,checked:r}=Mr(),n=Ed();return!r||t?i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:i.jsx(_h,{message:"Loading…"})}):!e||e.platform_admin!=="yes"?i.jsx(gh,{to:"/home",replace:!0}):i.jsxs("div",{style:{display:"flex",minHeight:"100vh",background:"var(--background)"},children:[i.jsxs("aside",{style:{width:"220px",flexShrink:0,borderRight:"1px solid var(--border)",background:"var(--card)",display:"flex",flexDirection:"column",padding:"16px 12px"},children:[i.jsx("p",{style:{fontSize:"10px",fontFamily:"var(--font-noto-sans)",color:"var(--muted)",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",margin:"0 8px 12px"},children:"Super Admin"}),i.jsxs(NO,{to:"/super-admin/clients",style:({isActive:o})=>({...x3,background:o?"var(--accent)":"transparent",fontWeight:o?600:400}),children:[i.jsx(_b,{size:16}),"Clients"]}),i.jsxs(NO,{to:"/super-admin/plans",style:({isActive:o})=>({...x3,marginTop:"4px",background:o?"var(--accent)":"transparent",fontWeight:o?600:400}),children:[i.jsx(nS,{size:16}),"Plans"]}),i.jsx("div",{style:{flex:1}}),i.jsxs("button",{type:"button",onClick:()=>n("/home"),style:{...x3,color:"var(--muted)",marginTop:"8px"},children:[i.jsx(uT,{size:16}),"Back to app"]})]}),i.jsx("main",{style:{flex:1,overflow:"auto",padding:"24px 28px"},children:i.jsx(r$,{})})]})}const _l={width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--input-background)",color:"var(--foreground)",fontSize:"var(--text-sm)",boxSizing:"border-box"};function KLe(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return e}}function QLe(){var Ye,rt;const[e,t]=S.useState([]),[r,n]=S.useState(0),[o,a]=S.useState(1),[s]=S.useState(20),[l,c]=S.useState(""),[u,d]=S.useState(""),[f,h]=S.useState(!0),[p,v]=S.useState(""),[m,b]=S.useState(null),[x,w]=S.useState("free"),[k,j]=S.useState([]),[_,T]=S.useState("active"),[A,P]=S.useState(!1),[N,O]=S.useState(!1),[C,I]=S.useState(!1),[R,F]=S.useState(""),[M,Y]=S.useState(""),[X,$]=S.useState(""),[ee,V]=S.useState(""),[D,z]=S.useState(""),[q,G]=S.useState(""),[U,Q]=S.useState("Asia/Kolkata"),[K,re]=S.useState("free"),[H,ie]=S.useState(""),[de,le]=S.useState(""),[ke,ve]=S.useState(""),[se,be]=S.useState(""),De=S.useCallback(async()=>{v(""),h(!0);try{const He=await nd.listOrganizations({page:o,limit:s,search:l||void 0});t(He.organizations),n(He.total)}catch(He){v(He instanceof Error?He.message:"Failed to load organizations. Check that you are logged in as a platform admin and the API is reachable.")}finally{h(!1)}},[o,s,l]);S.useEffect(()=>{De()},[De]),S.useEffect(()=>{nd.listPlans().then(He=>j(He.plans)).catch(()=>j([]))},[]);const ae=He=>{He.preventDefault(),a(1),c(u.trim())},ue=He=>{var st,Te,et;b(He);const xt=((st=He.subscription)==null?void 0:st.plan)||((Te=k[0])==null?void 0:Te.id)||"free";w(xt),T(((et=He.subscription)==null?void 0:et.status)||"active")},Me=async()=>{if(m){P(!0),v("");try{await nd.patchOrganizationSubscription(m._id,{plan:x,status:_}),b(null),await De()}catch(He){v(He instanceof Error?He.message:"Save failed")}finally{P(!1)}}},Se=()=>{var He;F(""),Y(""),$(""),V(""),z(""),G(""),Q("Asia/Kolkata"),re(((He=k[0])==null?void 0:He.id)??"free"),ie(""),le(""),ve(""),be("")},Pe=()=>{Se(),O(!0)},Ee=async He=>{if(He.preventDefault(),F(""),!M.trim()){F("Organization name is required.");return}if(!H.trim()||!de){F("Admin email and password are required.");return}if(de.length<8){F("Password must be at least 8 characters.");return}I(!0);try{await nd.createOrganization({organization:{name:M.trim(),description:X.trim()||void 0,email:ee.trim()||void 0,phone:D.trim()||void 0,website:q.trim()||void 0,timezone:U.trim()||void 0,subscription:{plan:K,status:"active"}},admin:{email:H.trim(),password:de,firstName:ke.trim()||void 0,lastName:se.trim()||void 0}}),O(!1),Se(),a(1),c(""),d(""),await De()}catch(xt){F(xt instanceof Error?xt.message:"Could not create organization")}finally{I(!1)}},Ae=Math.max(1,Math.ceil(r/s));return i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-start",justifyContent:"space-between",gap:"16px",marginBottom:"8px"},children:[i.jsxs("div",{children:[i.jsx("h1",{style:{fontSize:"var(--text-xl)",fontFamily:"var(--font-inter)",fontWeight:600,margin:"0 0 8px",color:"var(--foreground)"},children:"Clients"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:["All tenant organizations. The first user you add becomes the organization's ",i.jsx("strong",{children:"super_admin"})," (org role)."]})]}),i.jsxs("button",{type:"button",onClick:Pe,style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"#fff",fontSize:"var(--text-sm)",cursor:"pointer",fontWeight:600},children:[i.jsx(gr,{size:18}),"Add organization"]})]}),i.jsxs("form",{onSubmit:ae,style:{display:"flex",gap:"10px",marginBottom:"16px",flexWrap:"wrap"},children:[i.jsx("input",{value:u,onChange:He=>d(He.target.value),placeholder:"Search by name or email",style:{..._l,flex:"1 1 220px",maxWidth:"360px"}}),i.jsx("button",{type:"submit",style:{padding:"8px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"#fff",fontSize:"var(--text-sm)",cursor:"pointer"},children:"Search"})]}),p&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",marginBottom:"12px"},children:p}),f?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):i.jsxs(i.Fragment,{children:[i.jsx("div",{style:{overflowX:"auto",border:"1px solid var(--border)",borderRadius:"var(--radius-card)"},children:i.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"var(--text-sm)"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{background:"var(--accent)",textAlign:"left"},children:[i.jsx("th",{style:{padding:"10px 12px",fontWeight:600},children:"Name"}),i.jsx("th",{style:{padding:"10px 12px",fontWeight:600},children:"Email"}),i.jsx("th",{style:{padding:"10px 12px",fontWeight:600},children:"Plan"}),i.jsx("th",{style:{padding:"10px 12px",fontWeight:600},children:"Status"}),i.jsx("th",{style:{padding:"10px 12px",fontWeight:600},children:"Users"}),i.jsx("th",{style:{padding:"10px 12px",fontWeight:600},children:"Created"}),i.jsx("th",{style:{padding:"10px 12px",fontWeight:600}})]})}),i.jsx("tbody",{children:e.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:7,style:{padding:"24px 16px",color:"var(--muted)",textAlign:"center"},children:l?"No organizations match your search.":"No organizations yet. Use “Add organization” to create a tenant and its first super admin user."})}):e.map(He=>{var xt,st;return i.jsxs("tr",{style:{borderTop:"1px solid var(--border)"},children:[i.jsx("td",{style:{padding:"10px 12px",color:"var(--foreground)"},children:He.name}),i.jsx("td",{style:{padding:"10px 12px",color:"var(--muted)"},children:He.email||"—"}),i.jsx("td",{style:{padding:"10px 12px"},children:((xt=He.subscription)==null?void 0:xt.plan)??"free"}),i.jsx("td",{style:{padding:"10px 12px"},children:((st=He.subscription)==null?void 0:st.status)??"—"}),i.jsx("td",{style:{padding:"10px 12px"},children:He.userCount??"—"}),i.jsx("td",{style:{padding:"10px 12px",color:"var(--muted)"},children:KLe(He.createdAt)}),i.jsx("td",{style:{padding:"10px 12px"},children:i.jsx("button",{type:"button",onClick:()=>ue(He),style:{background:"transparent",border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"4px 10px",fontSize:"var(--text-xs)",cursor:"pointer",color:"var(--primary)"},children:"Edit sub"})})]},He._id)})})]})}),i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginTop:"16px"},children:[i.jsx("button",{type:"button",disabled:o<=1,onClick:()=>a(He=>Math.max(1,He-1)),style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",cursor:o<=1?"not-allowed":"pointer"},children:"Previous"}),i.jsxs("span",{style:{fontSize:"var(--text-sm)",color:"var(--muted)"},children:["Page ",o," of ",Ae," (",r," total)"]}),i.jsx("button",{type:"button",disabled:o>=Ae,onClick:()=>a(He=>He+1),style:{padding:"6px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",cursor:o>=Ae?"not-allowed":"pointer"},children:"Next"})]})]}),m&&i.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:"16px"},onClick:()=>!A&&b(null),children:i.jsxs("div",{role:"dialog",style:{background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",padding:"20px",maxWidth:"400px",width:"100%"},onClick:He=>He.stopPropagation(),children:[i.jsxs("h2",{style:{margin:"0 0 12px",fontSize:"var(--text-base)"},children:["Subscription — ",m.name]}),i.jsxs("label",{style:{display:"block",marginBottom:"8px",fontSize:"var(--text-sm)"},children:["Plan",i.jsx("select",{value:k.some(He=>He.id===x)?x:((Ye=k[0])==null?void 0:Ye.id)??x,onChange:He=>w(He.target.value),style:{display:"block",width:"100%",marginTop:"4px",padding:"8px"},children:(k.length?k:[{id:"free",name:"free"}]).map(He=>i.jsxs("option",{value:He.id,children:[He.name," (",He.id,")"]},He.id))})]}),i.jsxs("label",{style:{display:"block",marginBottom:"16px",fontSize:"var(--text-sm)"},children:["Status",i.jsxs("select",{value:_,onChange:He=>T(He.target.value),style:{display:"block",width:"100%",marginTop:"4px",padding:"8px"},children:[i.jsx("option",{value:"active",children:"active"}),i.jsx("option",{value:"trial",children:"trial"}),i.jsx("option",{value:"past_due",children:"past_due"}),i.jsx("option",{value:"cancelled",children:"cancelled"})]})]}),i.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",disabled:A,onClick:()=>b(null),style:{padding:"8px 14px"},children:"Cancel"}),i.jsx("button",{type:"button",disabled:A,onClick:()=>void Me(),style:{padding:"8px 14px",background:"var(--primary)",color:"#fff",border:"none",borderRadius:"var(--radius-button)",cursor:"pointer"},children:A?"Saving…":"Save"})]})]})}),N&&i.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:110,padding:"16px",overflowY:"auto"},onClick:()=>!C&&O(!1),children:i.jsxs("form",{onSubmit:Ee,style:{background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",padding:"20px",maxWidth:"480px",width:"100%",maxHeight:"90vh",overflowY:"auto"},onClick:He=>He.stopPropagation(),children:[i.jsx("h2",{style:{margin:"0 0 6px",fontSize:"var(--text-lg)"},children:"New organization"}),i.jsxs("p",{style:{margin:"0 0 16px",fontSize:"var(--text-xs)",color:"var(--muted)"},children:["Creates the tenant org and one user with org role ",i.jsx("code",{children:"super_admin"}),". They can sign in at the normal login page with the email and password below."]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--muted)",margin:"0 0 8px"},children:"Organization"}),i.jsxs("label",{style:{display:"block",marginBottom:"10px",fontSize:"var(--text-sm)"},children:["Name ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"}),i.jsx("input",{required:!0,value:M,onChange:He=>Y(He.target.value),style:{..._l,marginTop:"4px"}})]}),i.jsxs("label",{style:{display:"block",marginBottom:"10px",fontSize:"var(--text-sm)"},children:["Description",i.jsx("textarea",{value:X,onChange:He=>$(He.target.value),rows:2,style:{..._l,marginTop:"4px",resize:"vertical"}})]}),i.jsxs("label",{style:{display:"block",marginBottom:"10px",fontSize:"var(--text-sm)"},children:["Contact email",i.jsx("input",{type:"email",value:ee,onChange:He=>V(He.target.value),style:{..._l,marginTop:"4px"},placeholder:"billing@company.com"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px",marginBottom:"10px"},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Phone",i.jsx("input",{value:D,onChange:He=>z(He.target.value),style:{..._l,marginTop:"4px"}})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Timezone",i.jsx("input",{value:U,onChange:He=>Q(He.target.value),style:{..._l,marginTop:"4px"}})]})]}),i.jsxs("label",{style:{display:"block",marginBottom:"10px",fontSize:"var(--text-sm)"},children:["Website",i.jsx("input",{value:q,onChange:He=>G(He.target.value),style:{..._l,marginTop:"4px"},placeholder:"https://…"})]}),i.jsxs("label",{style:{display:"block",marginBottom:"16px",fontSize:"var(--text-sm)"},children:["Initial plan",i.jsx("select",{value:k.some(He=>He.id===K)?K:((rt=k[0])==null?void 0:rt.id)??K,onChange:He=>re(He.target.value),style:{..._l,marginTop:"4px"},children:(k.length?k:[{id:"free",name:"free"}]).map(He=>i.jsxs("option",{value:He.id,children:[He.name," (",He.id,")"]},He.id))})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--muted)",margin:"0 0 8px"},children:"First user (super admin)"}),i.jsxs("label",{style:{display:"block",marginBottom:"10px",fontSize:"var(--text-sm)"},children:["Email ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"}),i.jsx("input",{required:!0,type:"email",value:H,onChange:He=>ie(He.target.value),style:{..._l,marginTop:"4px"},autoComplete:"off"})]}),i.jsxs("label",{style:{display:"block",marginBottom:"10px",fontSize:"var(--text-sm)"},children:["Password ",i.jsx("span",{style:{color:"var(--destructive)"},children:"*"})," (min 8 characters)",i.jsx("input",{required:!0,type:"password",value:de,onChange:He=>le(He.target.value),style:{..._l,marginTop:"4px"},autoComplete:"new-password"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px",marginBottom:"16px"},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["First name",i.jsx("input",{value:ke,onChange:He=>ve(He.target.value),style:{..._l,marginTop:"4px"}})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Last name",i.jsx("input",{value:se,onChange:He=>be(He.target.value),style:{..._l,marginTop:"4px"}})]})]}),R&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",marginBottom:"12px"},children:R}),i.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",disabled:C,onClick:()=>O(!1),style:{padding:"8px 14px"},children:"Cancel"}),i.jsx("button",{type:"submit",disabled:C,style:{padding:"8px 14px",background:"var(--primary)",color:"#fff",border:"none",borderRadius:"var(--radius-button)",cursor:C?"not-allowed":"pointer"},children:C?"Creating…":"Create organization"})]})]})})]})}const XLe=/^[a-z][a-z0-9_]{0,62}$/;function ZLe(e){return e?e.contactSales?"Contact sales":e.amount===0?`${e.currency} 0`:e.amount==null?"—":`${e.currency} ${Number(e.amount).toLocaleString("en-IN")} / ${e.interval}`:"—"}const Wq={event_page:"Event Page",event_microsite:"Event microsite",custom_domain_microsite:"Custom domain event microsite",custom_website:"Custom Website"};function JLe(e){return e==null?"Unlimited outreach emails":`Up to ${Number(e).toLocaleString("en-IN")} outreach emails`}const Hc={width:"100%",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--input-background)",color:"var(--foreground)",fontSize:"var(--text-sm)",boxSizing:"border-box"};function eFe(){const[e,t]=S.useState([]),[r,n]=S.useState([]),[o,a]=S.useState(!0),[s,l]=S.useState(""),[c,u]=S.useState(!1),[d,f]=S.useState(null),[h,p]=S.useState(""),[v,m]=S.useState(""),[b,x]=S.useState(""),[w,k]=S.useState(""),[j,_]=S.useState(""),[T,A]=S.useState(""),[P,N]=S.useState("INR"),[O,C]=S.useState("month"),[I,R]=S.useState(!1),[F,M]=S.useState("event_page"),[Y,X]=S.useState("500"),[$,ee]=S.useState(new Set),[V,D]=S.useState(!1),[z,q]=S.useState(""),G=S.useMemo(()=>new Map(r.map(ve=>[ve.key,ve])),[r]),U=S.useMemo(()=>{var ve;return((ve=G.get("event_website"))==null?void 0:ve.options)??[]},[G]),Q=S.useCallback(async()=>{l(""),a(!0);try{const[ve,se]=await Promise.all([nd.listPermissions(),nd.listPlans()]);n(ve.features),t(se.plans)}catch(ve){l(ve instanceof Error?ve.message:"Failed to load")}finally{a(!1)}},[]);S.useEffect(()=>{Q()},[Q]);const K=()=>{f(null),p(""),m(""),x(""),k(""),_(""),A(""),N("INR"),C("month"),R(!1),M("event_page"),X("500"),ee(new Set),q(""),u(!0)},re=ve=>{var ae;f(ve.id),p(ve.id),m(ve.name),x(ve.tagline??""),k(ve.defaultLimits.maxEvents!=null?String(ve.defaultLimits.maxEvents):""),_(ve.defaultLimits.maxParticipants!=null?String(ve.defaultLimits.maxParticipants):"");const se=ve.pricing;R(!!(se!=null&&se.contactSales)),N((se==null?void 0:se.currency)??"INR"),C((se==null?void 0:se.interval)??"month"),se!=null&&se.contactSales?A(""):(se==null?void 0:se.amount)===0?A("0"):(se==null?void 0:se.amount)!=null&&Number.isFinite(se.amount)?A(String(se.amount)):A("");const be=ve.featureValues;M((be==null?void 0:be.event_website)??"event_page");const De=(ae=be==null?void 0:be.email_outreach_campaigns)==null?void 0:ae.maxEmails;X(De==null?"":String(De)),ee(new Set(ve.featureKeys)),q(""),u(!0)},H=ve=>{ee(se=>{const be=new Set(se);return be.has(ve)?be.delete(ve):be.add(ve),be})},ie=(ve,se)=>{ee(be=>{const De=new Set(be);for(const ae of ve)se?De.add(ae):De.delete(ae);return De})},de=ve=>{const se=ve.trim();if(se==="")return null;const be=Number(se);return Number.isFinite(be)?be:null},le=async ve=>{ve.preventDefault(),q("");const se=[...$].filter(Se=>r.some(Pe=>Pe.key===Se)),be={maxEvents:de(w),maxParticipants:de(j)};if(!v.trim()){q("Name is required.");return}let De;if(I)De={amount:null,currency:P.trim()||"INR",interval:O,contactSales:!0};else{const Se=T.trim(),Pe=Se===""?0:Number(Se);if(!Number.isFinite(Pe)||Pe<0){q("Price must be a non-negative number (or enable “Contact sales”).");return}De={amount:Pe,currency:P.trim()||"INR",interval:O,contactSales:!1}}const ae=Y.trim();let ue;if(ae==="")ue=null;else{const Se=Number(ae);if(!Number.isFinite(Se)||Se<0){q("Email outreach cap must be empty (unlimited) or a non-negative number.");return}ue=Se}const Me={event_website:F,email_outreach_campaigns:{maxEmails:ue}};if(!d){const Se=h.trim();if(!XLe.test(Se)){q("Plan id must be a lowercase slug: start with a letter, then letters, digits, or underscores (max 64 characters).");return}D(!0);try{const Pe=await nd.createPlan({planId:Se,name:v.trim(),tagline:b,featureKeys:se,defaultLimits:be,pricing:De,featureValues:Me});t(Pe.plans),u(!1)}catch(Pe){q(Pe instanceof Error?Pe.message:"Save failed")}finally{D(!1)}return}D(!0);try{const Se=await nd.updatePlan(d,{name:v.trim(),tagline:b,featureKeys:se,defaultLimits:be,pricing:De,featureValues:Me});t(Se.plans),u(!1)}catch(Se){q(Se instanceof Error?Se.message:"Save failed")}finally{D(!1)}},ke=async ve=>{const se=ve.organizationCount??0,be=se>0?`This plan is used by ${se} organization(s). Move them to another plan before deleting.`:`Delete plan “${ve.name}” (${ve.id})? This cannot be undone.`;if(se>0){window.alert(be);return}if(window.confirm(be))try{const De=await nd.deletePlan(ve.id);t(De.plans)}catch(De){window.alert(De instanceof Error?De.message:"Delete failed")}};return i.jsxs("div",{children:[i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-start",justifyContent:"space-between",gap:"16px",marginBottom:"8px"},children:[i.jsxs("div",{children:[i.jsx("h1",{style:{fontSize:"var(--text-xl)",fontFamily:"var(--font-inter)",fontWeight:600,margin:"0 0 8px",color:"var(--foreground)"},children:"Plans"}),i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:0},children:["Create and edit subscription tiers. Default feature sets follow ",i.jsx("strong",{children:"eventbuzz_plans.source.csv"})," (Manage / Engage rows). Tier caps for Participants, Event Website, and Email outreach are editable below the limits grid. Plan id is a permanent slug."]})]}),i.jsxs("button",{type:"button",onClick:K,style:{display:"inline-flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderRadius:"var(--radius-button)",border:"none",background:"var(--primary)",color:"#fff",fontSize:"var(--text-sm)",cursor:"pointer",fontWeight:600},children:[i.jsx(gr,{size:18}),"Add plan"]})]}),s&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",marginBottom:"12px"},children:s}),o?i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"}):i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:e.map(ve=>{var se;return i.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-card)",padding:"14px 16px",background:"var(--card)",display:"flex",flexWrap:"wrap",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[i.jsxs("div",{children:[i.jsx("p",{style:{margin:0,fontWeight:600,fontSize:"var(--text-base)"},children:ve.name}),ve.tagline?i.jsx("p",{style:{margin:"6px 0 0",fontSize:"var(--text-sm)",color:"var(--foreground)",whiteSpace:"pre-line",lineHeight:1.45},children:ve.tagline}):null,i.jsxs("p",{style:{margin:"8px 0 0",fontSize:"var(--text-xs)",color:"var(--muted)"},children:["id: ",i.jsx("code",{style:{fontSize:"11px"},children:ve.id}),ve.organizationCount!=null&&i.jsxs("span",{style:{marginLeft:"8px"},children:["· ",ve.organizationCount," org(s)"]})]}),i.jsx("p",{style:{margin:"6px 0 0",fontSize:"var(--text-sm)",color:"var(--foreground)"},children:ZLe(ve.pricing)}),ve.featureValues?i.jsxs("p",{style:{margin:"6px 0 0",fontSize:"var(--text-xs)",color:"var(--foreground)",lineHeight:1.45},children:[Wq[ve.featureValues.event_website]??ve.featureValues.event_website," · ",JLe((se=ve.featureValues.email_outreach_campaigns)==null?void 0:se.maxEmails)]}):null,i.jsxs("p",{style:{margin:"8px 0 0",fontSize:"var(--text-sm)",color:"var(--muted)"},children:[ve.featureKeys.length," features · max events: ",ve.defaultLimits.maxEvents??"∞"," · max participants:"," ",ve.defaultLimits.maxParticipants??"∞"]})]}),i.jsxs("div",{style:{display:"flex",gap:"8px"},children:[i.jsxs("button",{type:"button",onClick:()=>re(ve),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"var(--background)",cursor:"pointer",fontSize:"var(--text-xs)"},children:[i.jsx(wi,{size:14})," Edit"]}),i.jsxs("button",{type:"button",onClick:()=>void ke(ve),title:ve.organizationCount?"Plan in use":"Delete plan",disabled:!!(ve.organizationCount&&ve.organizationCount>0),style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 12px",borderRadius:"var(--radius-button)",border:"1px solid var(--border)",background:"transparent",color:"var(--destructive)",cursor:ve.organizationCount?"not-allowed":"pointer",fontSize:"var(--text-xs)",opacity:ve.organizationCount?.5:1},children:[i.jsx(Xr,{size:14})," Delete"]})]})]},ve.id)})}),c&&i.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.45)",zIndex:120,display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",overflowY:"auto"},onClick:()=>!V&&u(!1),children:i.jsxs("form",{onSubmit:le,style:{background:"var(--card)",borderRadius:"var(--radius-card)",border:"1px solid var(--border)",padding:"20px",maxWidth:"560px",width:"100%",maxHeight:"92vh",overflowY:"auto"},onClick:ve=>ve.stopPropagation(),children:[i.jsx("h2",{style:{margin:"0 0 16px",fontSize:"var(--text-lg)"},children:d?"Edit plan":"New plan"}),!d&&i.jsxs("label",{style:{display:"block",marginBottom:"12px",fontSize:"var(--text-sm)"},children:["Plan id (slug, cannot change later)",i.jsx("input",{value:h,onChange:ve=>p(ve.target.value),placeholder:"e.g. growth",style:{...Hc,marginTop:"4px"},autoComplete:"off"})]}),d&&i.jsxs("p",{style:{fontSize:"var(--text-sm)",color:"var(--muted)",margin:"0 0 12px"},children:["Plan id: ",i.jsx("code",{children:d})]}),i.jsxs("label",{style:{display:"block",marginBottom:"12px",fontSize:"var(--text-sm)"},children:["Display name",i.jsx("input",{required:!0,value:v,onChange:ve=>m(ve.target.value),style:{...Hc,marginTop:"4px"}})]}),i.jsxs("label",{style:{display:"block",marginBottom:"12px",fontSize:"var(--text-sm)"},children:["Pricing / subtitle (shown in catalog & billing — use line breaks as needed)",i.jsx("textarea",{value:b,onChange:ve=>x(ve.target.value),rows:4,style:{...Hc,marginTop:"4px",resize:"vertical",fontFamily:"var(--font-noto-sans)"},placeholder:`e.g. ₹0
forever · up to 50 participants/event`})]}),i.jsxs("fieldset",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"12px",marginBottom:"12px"},children:[i.jsx("legend",{style:{fontSize:"var(--text-xs)",fontWeight:700,color:"var(--muted)",padding:"0 6px"},children:"Structured price (for future checkout)"}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"var(--text-sm)",marginBottom:"10px",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:I,onChange:ve=>{R(ve.target.checked),ve.target.checked&&A("")}}),"Contact sales (no fixed amount)"]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"10px",opacity:I?.55:1,pointerEvents:I?"none":"auto"},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Amount (",P,")",i.jsx("input",{value:T,onChange:ve=>A(ve.target.value),disabled:I,placeholder:"0",style:{...Hc,marginTop:"4px"},inputMode:"decimal"})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Currency",i.jsx("input",{value:P,onChange:ve=>N(ve.target.value.toUpperCase()),style:{...Hc,marginTop:"4px"},maxLength:10})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Interval",i.jsxs("select",{value:O,onChange:ve=>C(ve.target.value),style:{...Hc,marginTop:"4px"},children:[i.jsx("option",{value:"none",children:"none"}),i.jsx("option",{value:"month",children:"month"}),i.jsx("option",{value:"year",children:"year"}),i.jsx("option",{value:"custom",children:"custom"})]})]})]}),i.jsx("p",{style:{margin:"8px 0 0",fontSize:"var(--text-xs)",color:"var(--muted)"},children:"Amount is in major units (e.g. INR rupees); payment gateways can multiply by 100 for smallest currency units."})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px",marginBottom:"12px"},children:[i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Max events (empty = unlimited)",i.jsx("input",{value:w,onChange:ve=>k(ve.target.value),style:{...Hc,marginTop:"4px"},inputMode:"numeric"})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Participants cap (CSV row “Participants”; empty = unlimited)",i.jsx("input",{value:j,onChange:ve=>_(ve.target.value),style:{...Hc,marginTop:"4px"},inputMode:"numeric"})]})]}),i.jsxs("fieldset",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"12px",marginBottom:"12px"},children:[i.jsx("legend",{style:{fontSize:"var(--text-xs)",fontWeight:700,color:"var(--muted)",padding:"0 6px"},children:"CSV-style values (eventbuzz_plans)"}),i.jsxs("label",{style:{display:"block",marginBottom:"10px",fontSize:"var(--text-sm)"},children:["Event Website (tier)",i.jsx("select",{value:F,onChange:ve=>M(ve.target.value),style:{...Hc,marginTop:"4px"},children:(U.length?U:Object.entries(Wq).map(([ve,se])=>({value:ve,label:se}))).map(ve=>i.jsx("option",{value:ve.value,children:ve.label},ve.value))})]}),i.jsxs("label",{style:{display:"block",fontSize:"var(--text-sm)"},children:["Email outreach campaigns — max emails (empty = unlimited)",i.jsx("input",{value:Y,onChange:ve=>X(ve.target.value),placeholder:"e.g. 5000",style:{...Hc,marginTop:"4px"},inputMode:"numeric"})]}),i.jsxs("p",{style:{margin:"8px 0 0",fontSize:"var(--text-xs)",color:"var(--muted)"},children:["Matches the “Event Website” and “Email outreach campaigns” columns in the spreadsheet; defaults are seeded from"," ",i.jsx("code",{style:{fontSize:"10px"},children:"eventbuzz_plans.source.csv"}),"."]})]}),i.jsx("p",{style:{fontSize:"var(--text-xs)",fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--muted)",margin:"0 0 8px"},children:"Features (Manage & Engage)"}),i.jsx("div",{style:{border:"1px solid var(--border)",borderRadius:"var(--radius-button)",padding:"12px",maxHeight:"280px",overflowY:"auto",marginBottom:"16px"},children:VZ.map(({title:ve,keys:se})=>{const be=se.map(ue=>G.get(ue)).filter(ue=>!!ue),De=be.map(ue=>ue.key),ae=De.length>0&&De.every(ue=>$.has(ue));return i.jsxs("div",{style:{marginBottom:"14px"},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[i.jsx("span",{style:{fontSize:"var(--text-xs)",fontWeight:700,color:"var(--primary)",letterSpacing:"0.04em"},children:ve}),i.jsx("button",{type:"button",onClick:()=>ie(De,!ae),style:{fontSize:"var(--text-xs)",background:"none",border:"none",color:"var(--primary)",cursor:"pointer",padding:0},children:ae?"Deselect all":"Select all"})]}),be.map(ue=>i.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"8px",fontSize:"var(--text-xs)",color:"var(--foreground)",marginBottom:"6px",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:$.has(ue.key),onChange:()=>H(ue.key),style:{marginTop:"2px"}}),i.jsxs("span",{children:[i.jsx("strong",{children:ue.label}),i.jsx("span",{style:{color:"var(--muted)",marginLeft:"6px",fontFamily:"monospace",fontSize:"10px"},children:ue.key})]})]},ue.key))]},ve)})}),z&&i.jsx("p",{style:{color:"var(--destructive)",fontSize:"var(--text-sm)",marginBottom:"12px"},children:z}),i.jsxs("div",{style:{display:"flex",gap:"10px",justifyContent:"flex-end"},children:[i.jsx("button",{type:"button",disabled:V,onClick:()=>u(!1),style:{padding:"8px 14px"},children:"Cancel"}),i.jsx("button",{type:"submit",disabled:V,style:{padding:"8px 14px",background:"var(--primary)",color:"#fff",border:"none",borderRadius:"var(--radius-button)",cursor:V?"not-allowed":"pointer"},children:V?"Saving…":d?"Save changes":"Create plan"})]})]})})]})}const tFe=[{code:"AN",name:"Andaman & Nicobar"},{code:"AP",name:"Andhra Pradesh"},{code:"AR",name:"Arunachal Pradesh"},{code:"AS",name:"Assam"},{code:"BR",name:"Bihar"},{code:"CH",name:"Chandigarh"},{code:"CT",name:"Chhattisgarh"},{code:"DL",name:"Delhi"},{code:"GA",name:"Goa"},{code:"GJ",name:"Gujarat"},{code:"HR",name:"Haryana"},{code:"HP",name:"Himachal Pradesh"},{code:"JK",name:"Jammu & Kashmir"},{code:"JH",name:"Jharkhand"},{code:"KA",name:"Karnataka"},{code:"KL",name:"Kerala"},{code:"LA",name:"Ladakh"},{code:"MP",name:"Madhya Pradesh"},{code:"MH",name:"Maharashtra"},{code:"MN",name:"Manipur"},{code:"ML",name:"Meghalaya"},{code:"MZ",name:"Mizoram"},{code:"NL",name:"Nagaland"},{code:"OR",name:"Odisha"},{code:"PY",name:"Puducherry"},{code:"PB",name:"Punjab"},{code:"RJ",name:"Rajasthan"},{code:"SK",name:"Sikkim"},{code:"TN",name:"Tamil Nadu"},{code:"TG",name:"Telangana"},{code:"TR",name:"Tripura"},{code:"UP",name:"Uttar Pradesh"},{code:"UT",name:"Uttarakhand"},{code:"WB",name:"West Bengal"}];function qq(){return{firstName:"",lastName:"",email:"",phone:"",organization:"",designation:"",displayName:"",formData:{}}}function rFe(e){return e.mapsTo==="email"||e.mapsTo==="firstName"||e.mapsTo==="lastName"}const $q="__eb_payment_cancelled__";function b3(e,t){return`${(e/100).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})} ${t}`}const Ct={ink:"#1a1a18",accent:"#c17d5c",body:"#5a5550",muted:"#7a7068",cream:"#ede8e0",pageBg:"#f8f4ef",card:"#ffffff",border:"rgba(26,26,24,0.12)",borderHairline:"rgba(26,26,24,0.08)",primary:"#7a2340",express:"#5a31f5",success:"#8a9e85",serif:'"Cormorant Garamond", "Georgia", serif',sans:'"Raleway", system-ui, sans-serif'};function nFe(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(String(n.result??"")),n.onerror=()=>r(n.error??new Error("read failed")),n.readAsDataURL(e)})}function iFe(){var Me;const{eventId:e}=Jw(),[t]=i$(),r=S.useMemo(()=>{var Ee,Ae;const Se=(Ee=t.get("ticket_id"))==null?void 0:Ee.trim(),Pe=(Ae=t.get("ticketId"))==null?void 0:Ae.trim();return Se||Pe||""},[t]),[n,o]=S.useState(null),[a,s]=S.useState([]),[l,c]=S.useState(!0),[u,d]=S.useState(null),[f,h]=S.useState(null),[p,v]=S.useState(""),[m,b]=S.useState(1),[x,w]=S.useState(""),[k,j]=S.useState(""),[_,T]=S.useState([qq()]),[A,P]=S.useState(null),[N,O]=S.useState(null),[C,I]=S.useState(!1),[R,F]=S.useState(!1),[M,Y]=S.useState(!1),[X,$]=S.useState("loading"),[ee,V]=S.useState("online"),[D,z]=S.useState(null),q=S.useMemo(()=>X==="manual"?!0:X==="both"?ee==="manual":!1,[X,ee]),[G,U]=S.useState(null),[Q,K]=S.useState(""),[re,H]=S.useState(!1),[ie,de]=S.useState(null),le=S.useMemo(()=>a.find(Se=>Se._id===p),[a,p]),ke=!!(r&&a.some(Se=>Se._id===r));S.useEffect(()=>{if(!e)return;let Se=!1;return c(!0),d(null),h(null),$("loading"),Promise.all([gf.getEventSummary(e),gf.listTickets(e),gf.checkoutOptions(e)]).then(([Pe,Ee,Ae])=>{if(Se)return;o(Pe),s(Ee),Ae.onlineAvailable&&Ae.manualUpi?($("both"),V("online"),z(Ae.manualUpi)):Ae.onlineAvailable?($("online"),z(null)):Ae.manualUpi?($("manual"),z(Ae.manualUpi)):($("none"),z(null));const Ye=r;Ye?Ee.some(He=>He._id===Ye)?v(Ye):(h("This ticket link is invalid or no longer available."),Ee[0]&&v(Ee[0]._id)):Ee[0]&&v(Ee[0]._id)}).catch(Pe=>{Se||d(Pe instanceof Error?Pe.message:"Failed to load")}).finally(()=>{Se||c(!1)}),()=>{Se=!0}},[e,r]),S.useEffect(()=>{T(Se=>{const Pe=[];for(let Ee=0;Ee<m;Ee++)Pe.push(Se[Ee]?{...Se[Ee],formData:{...Se[Ee].formData}}:qq());return Pe})},[m]),S.useEffect(()=>{if(!e||!p||X==="loading"||X==="none")return;let Se=!1;I(!0);const Pe=le,Ee=!!(Pe!=null&&Pe.requiresBillingState),Ae={ticketId:p,quantity:m,billingStateCode:Ee?x:x||void 0};return(q?gf.manualQuote(e,Ae):gf.quote(e,Ae)).then(rt=>{Se||(P(rt.totalMinor),O(rt))}).catch(()=>{Se||(P(null),O(null))}).finally(()=>{Se||I(!1)}),()=>{Se=!0}},[e,p,m,x,le,X,q]),S.useEffect(()=>{var He;if(!q||!D||D.manualQrMode!=="dynamic"){de(null);return}const Se=(He=D.upiId)==null?void 0:He.trim(),Pe=(D.eventName||(n==null?void 0:n.name)||"").trim();if(!Se||!(le!=null&&le.name)||!Pe||A==null){de(null);return}const Ee=`${le.name} · ${Pe}`.slice(0,99),Ae=(A/100).toFixed(2),Ye=DX({pa:Se,pn:Ee,am:Ae});if(!Ye){de(null);return}let rt=!1;return _v.toDataURL(Ye,{margin:1,width:280,errorCorrectionLevel:"M"}).then(xt=>{rt||de(xt)}),()=>{rt=!0}},[q,D,le==null?void 0:le.name,n==null?void 0:n.name,A]);const ve=(Se,Pe)=>{T(Ee=>{const Ae=[...Ee];return Ae[Se]={...Ae[Se],...Pe},Ae})},se=(Se,Pe,Ee)=>{T(Ae=>{const Ye=[...Ae],rt={...Ye[Se].formData,[Pe]:Ee};return Ye[Se]={...Ye[Se],formData:rt},Ye})},be=async()=>{if(!e||!p||A==null)return;const Se=k.trim();if(!Se){window.alert("Enter purchaser email (receipts).");return}for(let Ee=0;Ee<_.length;Ee++){const Ae=_[Ee];if(!Ae.firstName.trim()||!Ae.lastName.trim()||!Ae.email.trim()){window.alert(`Complete name and email for attendee ${Ee+1}.`);return}}const Pe=_.map(Ee=>Ee.email.trim().toLowerCase());if(new Set(Pe).size!==Pe.length){window.alert("Each attendee must have a unique email.");return}if(le!=null&&le.requiresBillingState&&!x){window.alert("Select billing state for tax.");return}F(!0);try{if(q){if(!G){window.alert("Attach a screenshot of your UPI payment."),F(!1);return}const rt=await nFe(G);await gf.manualSubmit(e,{ticketId:p,quantity:m,billingStateCode:x||void 0,purchaserEmail:Se,expectedTotalMinor:A,screenshotDataUrl:rt,buyerNote:Q.trim()||void 0,attendees:_.map(He=>({firstName:He.firstName.trim(),lastName:He.lastName.trim(),email:He.email.trim(),phone:He.phone.trim()||void 0,organization:He.organization.trim()||void 0,designation:He.designation.trim()||void 0,displayName:He.displayName.trim()||void 0,formData:He.formData}))}),H(!0);return}const Ee=`tix-${e}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,Ae=await gf.checkout(e,{ticketId:p,quantity:m,billingStateCode:x||void 0,purchaserEmail:Se,expectedTotalMinor:A,idempotencyKey:Ee,attendees:_.map(rt=>({firstName:rt.firstName.trim(),lastName:rt.lastName.trim(),email:rt.email.trim(),phone:rt.phone.trim()||void 0,organization:rt.organization.trim()||void 0,designation:rt.designation.trim()||void 0,displayName:rt.displayName.trim()||void 0,formData:rt.formData}))});await cT();const Ye=window.Razorpay;await new Promise((rt,He)=>{var Te,et;let xt=!1;const st=new Ye({key:Ae.keyId,amount:Ae.amount,currency:Ae.currency,order_id:Ae.orderId,name:(n==null?void 0:n.name)||"Event",description:(le==null?void 0:le.name)||"Ticket",handler:Pt=>{xt=!0,gf.verifyPayment(e,{orderId:Pt.razorpay_order_id,paymentId:Pt.razorpay_payment_id,signature:Pt.razorpay_signature}).then(()=>rt()).catch(qe=>He(qe instanceof Error?qe:new Error("Verification failed")))},modal:{ondismiss:()=>{xt||He(new Error($q))}},theme:{color:Ct.primary},prefill:{email:Se,name:`${((Te=_[0])==null?void 0:Te.firstName)||""} ${((et=_[0])==null?void 0:et.lastName)||""}`.trim()||void 0}});st.on("payment.failed",Pt=>{var qe;He(new Error(((qe=Pt.error)==null?void 0:qe.description)||"Payment failed"))}),st.open()}),Y(!0)}catch(Ee){const Ae=Ee instanceof Error?Ee.message:"Checkout failed";Ae!==$q&&window.alert(Ae)}finally{F(!1)}};if(!e)return i.jsx("p",{style:{padding:24,fontFamily:"system-ui"},children:"Invalid link."});if(l)return i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:Ct.sans,background:Ct.pageBg,color:Ct.muted,letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"},children:"Loading…"});if(u||!a.length)return i.jsxs("div",{style:{minHeight:"100vh",padding:"48px 24px",fontFamily:Ct.sans,maxWidth:560,margin:"0 auto",background:Ct.pageBg,color:Ct.body},children:[i.jsx("p",{style:{fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.18em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 12px"},children:"Tickets"}),i.jsx("h1",{style:{fontFamily:Ct.serif,fontSize:"2.25rem",fontWeight:400,color:Ct.ink,margin:"0 0 16px",lineHeight:1.15},children:"Unavailable"}),i.jsx("p",{style:{margin:0,lineHeight:1.6},children:u||"There are no active tickets for this event."})]});if(!l&&X==="none")return i.jsxs("div",{style:{minHeight:"100vh",padding:"48px 24px",fontFamily:Ct.sans,maxWidth:560,margin:"0 auto",background:Ct.pageBg,color:Ct.body},children:[i.jsx("p",{style:{fontSize:"0.75rem",fontWeight:600,letterSpacing:"0.18em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 12px"},children:"Event"}),i.jsx("h1",{style:{fontFamily:Ct.serif,fontSize:"2.5rem",fontWeight:400,color:Ct.ink,margin:"0 0 16px",lineHeight:1.1},children:(n==null?void 0:n.name)||"Event"}),i.jsx("p",{style:{margin:0,lineHeight:1.65},children:"Ticketing is not available yet: the organiser has not connected their Razorpay account for tickets or enabled UPI checkout for this event."})]});const De=Se=>(Se||[]).filter(Pe=>Pe.label&&!rFe(Pe)),ae={width:"100%",padding:"12px 14px",borderRadius:0,border:`1px solid ${Ct.border}`,fontFamily:Ct.sans,fontSize:"0.9375rem",color:Ct.ink,background:Ct.card,boxSizing:"border-box"},ue={display:"block",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.14em",textTransform:"uppercase",color:Ct.muted,marginBottom:8};return i.jsx("div",{style:{minHeight:"100vh",background:Ct.pageBg,color:Ct.ink,fontFamily:Ct.sans,padding:"clamp(24px, 4vw, 51px) clamp(16px, 4vw, 51px) 64px"},children:i.jsxs("div",{style:{maxWidth:720,margin:"0 auto"},children:[i.jsxs("header",{style:{marginBottom:36},children:[i.jsx("p",{style:{fontSize:"0.76rem",fontWeight:500,letterSpacing:"0.2em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 10px"},children:"Event tickets"}),i.jsx("h1",{style:{fontFamily:Ct.serif,fontSize:"clamp(2.25rem, 6vw, 3.25rem)",fontWeight:300,lineHeight:1.08,letterSpacing:"-0.02em",margin:"0 0 14px"},children:(n==null?void 0:n.name)||"Event"}),n!=null&&n.subtitle?i.jsx("p",{style:{margin:0,color:Ct.body,fontSize:"1rem",fontWeight:500,lineHeight:1.55,maxWidth:540},children:n.subtitle}):null,((n==null?void 0:n.startDate)||(n==null?void 0:n.location))&&i.jsxs("p",{style:{margin:"14px 0 0",fontSize:"0.9rem",color:Ct.muted,fontWeight:400},children:[n!=null&&n.startDate?new Date(n.startDate).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):"",n!=null&&n.location?` · ${n.location}`:""]})]}),re?i.jsxs("div",{style:{background:Ct.cream,padding:"40px 28px",borderLeft:`3px solid ${Ct.accent}`,textAlign:"center"},children:[i.jsx("p",{style:{fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.2em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 12px"},children:"Submitted"}),i.jsx("h2",{style:{fontFamily:Ct.serif,fontSize:"2rem",fontWeight:400,margin:"0 0 16px",color:Ct.ink},children:"We received your proof"}),i.jsx("p",{style:{color:Ct.body,margin:0,lineHeight:1.65,maxWidth:420,marginLeft:"auto",marginRight:"auto"},children:"The organiser will review your payment and confirm your registration. You will get an email when your ticket is approved."})]}):M?i.jsxs("div",{style:{background:Ct.cream,padding:"40px 28px",borderLeft:`3px solid ${Ct.success}`,textAlign:"center"},children:[i.jsx("p",{style:{fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.2em",textTransform:"uppercase",color:Ct.success,margin:"0 0 12px"},children:"Confirmed"}),i.jsx("h2",{style:{fontFamily:Ct.serif,fontSize:"2rem",fontWeight:400,margin:"0 0 16px",color:Ct.ink},children:"Thank you"}),i.jsx("p",{style:{color:Ct.body,margin:0,lineHeight:1.65},children:"Your payment was successful. You should receive a confirmation email shortly."})]}):i.jsxs(i.Fragment,{children:[f&&i.jsx("div",{style:{marginBottom:20,padding:"16px 20px",background:Ct.card,border:`1px solid ${Ct.accent}`,color:Ct.ink,fontSize:"0.875rem",lineHeight:1.5},children:f}),(X==="both"||X==="online")&&i.jsxs("section",{style:{background:Ct.card,padding:"24px 22px",border:`1px solid ${Ct.borderHairline}`,marginBottom:24},children:[i.jsx("h2",{style:{fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.22em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 14px"},children:"Payment method"}),X==="both"?i.jsxs(i.Fragment,{children:[i.jsx("p",{style:{fontSize:"0.9375rem",color:Ct.body,margin:"0 0 16px",lineHeight:1.55,fontWeight:500},children:"Pay with the organiser's Razorpay checkout, or use the UPI details they set up for this event."}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:10},children:[i.jsx("button",{type:"button",onClick:()=>V("online"),style:{padding:"12px 20px",borderRadius:0,border:"none",background:ee==="online"?Ct.primary:Ct.cream,color:ee==="online"?"#fff":Ct.ink,fontWeight:600,cursor:"pointer",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",fontFamily:Ct.sans},children:"Card / UPI (Razorpay)"}),i.jsx("button",{type:"button",onClick:()=>V("manual"),style:{padding:"12px 20px",borderRadius:0,border:"none",background:ee==="manual"?Ct.express:Ct.cream,color:ee==="manual"?"#fff":Ct.ink,fontWeight:600,cursor:"pointer",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",fontFamily:Ct.sans},children:"UPI (organiser QR)"})]})]}):i.jsx("p",{style:{fontSize:"0.9375rem",color:Ct.body,margin:0,lineHeight:1.55,fontWeight:500},children:"You will pay through the organiser's connected Razorpay account (not a platform wallet)."})]}),!ke&&i.jsxs("section",{style:{marginBottom:28},children:[i.jsx("h2",{style:{fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.22em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 8px"},children:"Choose a ticket"}),i.jsx("p",{style:{fontSize:"0.9375rem",color:Ct.body,margin:"0 0 20px",lineHeight:1.55,fontWeight:500},children:"Select one option. You can change your choice before paying."}),i.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:14},children:a.map(Se=>{var Ee;const Pe=p===Se._id;return i.jsxs("button",{type:"button",onClick:()=>v(Se._id),style:{textAlign:"left",cursor:"pointer",padding:"20px 18px",borderRadius:0,border:Pe?`2px solid ${Ct.primary}`:`1px solid ${Ct.border}`,background:Pe?Ct.cream:Ct.card,transition:"border-color 0.15s, background 0.15s",display:"flex",flexDirection:"column",gap:12,minHeight:140,fontFamily:Ct.sans},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8},children:[i.jsx("span",{style:{fontFamily:Ct.serif,fontSize:"1.35rem",fontWeight:600,color:Ct.ink,lineHeight:1.25},children:Se.name}),Pe&&i.jsx("span",{style:{flexShrink:0,fontSize:"0.625rem",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.12em",color:"#fff",background:Ct.primary,padding:"6px 10px"},children:"Selected"})]}),i.jsxs("div",{style:{fontFamily:Ct.serif,fontSize:"1.75rem",fontWeight:400,color:Ct.ink,borderBottom:`1px solid ${Ct.borderHairline}`,paddingBottom:12},children:[(Se.basePriceMinor/100).toLocaleString("en-IN",{minimumFractionDigits:2})," ",i.jsx("span",{style:{fontSize:"1rem",fontFamily:Ct.sans,fontWeight:500},children:Se.currency}),i.jsx("span",{style:{fontSize:"0.75rem",fontFamily:Ct.sans,fontWeight:500,color:Ct.muted,display:"block",marginTop:6},children:Se.requiresBillingState?"Tax depends on billing state":"Tax per rules below"})]}),Se.description?i.jsx("p",{style:{fontSize:"0.875rem",color:Ct.body,margin:0,lineHeight:1.5,fontWeight:500,display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:Se.description}):null,(Ee=Se.keyPoints)!=null&&Ee.length?i.jsxs("ul",{style:{fontSize:"0.75rem",color:Ct.ink,margin:0,paddingLeft:16,lineHeight:1.45,fontWeight:500},children:[Se.keyPoints.slice(0,4).map((Ae,Ye)=>i.jsx("li",{children:Ae},Ye)),Se.keyPoints.length>4?i.jsxs("li",{style:{color:Ct.muted},children:["+",Se.keyPoints.length-4," more…"]}):null]}):null]},Se._id)})})]}),i.jsxs("section",{style:{background:Ct.card,padding:"24px 22px",border:`1px solid ${Ct.borderHairline}`,marginBottom:20},children:[le&&i.jsxs(i.Fragment,{children:[i.jsx("h3",{style:{fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.22em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 12px"},children:"Your selection"}),i.jsx("p",{style:{fontFamily:Ct.serif,fontSize:"1.85rem",fontWeight:400,color:Ct.ink,margin:"0 0 12px",lineHeight:1.15},children:le.name}),le.description&&i.jsx("p",{style:{fontSize:"0.9375rem",color:Ct.body,margin:"0 0 20px",lineHeight:1.55,fontWeight:500},children:le.description}),(Me=le.keyPoints)!=null&&Me.length?i.jsxs("div",{style:{background:Ct.cream,borderLeft:`3px solid ${Ct.accent}`,padding:"20px 20px 20px 22px",marginBottom:24},children:[i.jsx("p",{style:{fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.2em",textTransform:"uppercase",color:Ct.accent,margin:"0 0 14px"},children:"Key details"}),i.jsx("ul",{style:{fontSize:"0.875rem",color:Ct.body,margin:0,paddingLeft:18,lineHeight:1.55,fontWeight:500},children:le.keyPoints.map((Se,Pe)=>i.jsx("li",{style:{marginBottom:6},children:Se},Pe))})]}):null]}),i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-end",gap:16,marginBottom:20},children:[i.jsxs("div",{children:[i.jsx("span",{style:ue,children:"Quantity"}),i.jsxs("div",{style:{display:"flex",alignItems:"stretch",border:`1px solid ${Ct.border}`,height:52,maxWidth:140},children:[i.jsx("button",{type:"button","aria-label":"Decrease quantity",onClick:()=>b(Se=>Math.max(1,Se-1)),style:{width:44,border:"none",background:Ct.card,cursor:"pointer",fontSize:"1.25rem",color:Ct.ink,fontFamily:Ct.sans},children:"−"}),i.jsx("span",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:"1rem",borderLeft:`1px solid ${Ct.border}`,borderRight:`1px solid ${Ct.border}`},children:m}),i.jsx("button",{type:"button","aria-label":"Increase quantity",onClick:()=>b(Se=>Math.min((le==null?void 0:le.maxPerOrder)||100,Se+1)),style:{width:44,border:"none",background:Ct.card,cursor:"pointer",fontSize:"1.25rem",color:Ct.ink,fontFamily:Ct.sans},children:"+"})]})]}),i.jsxs("div",{style:{flex:"1 1 200px",minWidth:0},children:[i.jsxs("span",{style:{...ue,display:"flex",alignItems:"center",gap:8},children:[i.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:Ct.success,flexShrink:0}}),"Tickets available"]}),i.jsx("p",{style:{margin:0,fontSize:"0.875rem",color:Ct.success,fontWeight:500},children:"Complete checkout to secure your spot."})]})]}),(le==null?void 0:le.requiresBillingState)&&i.jsxs(i.Fragment,{children:[i.jsx("label",{style:ue,children:"Billing state (tax)"}),i.jsxs("select",{value:x,onChange:Se=>w(Se.target.value),style:{...ae,marginBottom:18},children:[i.jsx("option",{value:"",children:"Select state…"}),tFe.map(Se=>i.jsxs("option",{value:Se.code,children:[Se.name," (",Se.code,")"]},Se.code))]})]}),i.jsx("label",{style:ue,children:"Purchaser email (receipts)"}),i.jsx("input",{type:"email",value:k,onChange:Se=>j(Se.target.value),placeholder:"you@example.com",style:{...ae,marginBottom:0}})]}),_.map((Se,Pe)=>i.jsxs("section",{style:{background:Ct.card,padding:"22px 22px",border:`1px solid ${Ct.borderHairline}`,marginBottom:16},children:[i.jsxs("h3",{style:{fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.18em",textTransform:"uppercase",color:Ct.muted,margin:"0 0 16px"},children:["Attendee ",Pe+1]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[i.jsx("input",{placeholder:"First name",value:Se.firstName,onChange:Ee=>ve(Pe,{firstName:Ee.target.value}),style:{...ae}}),i.jsx("input",{placeholder:"Last name",value:Se.lastName,onChange:Ee=>ve(Pe,{lastName:Ee.target.value}),style:{...ae}}),i.jsx("input",{type:"email",placeholder:"Email",value:Se.email,onChange:Ee=>ve(Pe,{email:Ee.target.value}),style:{...ae,gridColumn:"1 / -1"}})]}),De(le==null?void 0:le.registrationFormFields).map(Ee=>i.jsxs("div",{style:{marginTop:14},children:[i.jsxs("label",{style:{...ue,textTransform:"none",letterSpacing:"0.04em",color:Ct.body},children:[Ee.label,Ee.required?" *":""]}),Ee.type==="select"||Ee.type==="radio"?i.jsxs("select",{value:Se.formData[Ee.label]||"",onChange:Ae=>se(Pe,Ee.label,Ae.target.value),style:{...ae,marginTop:4},children:[i.jsx("option",{value:"",children:"Choose…"}),(Ee.options||[]).map(Ae=>i.jsx("option",{value:Ae,children:Ae},Ae))]}):i.jsx("input",{type:Ee.type==="email"?"email":Ee.type==="phone"?"tel":"text",value:Se.formData[Ee.label]||"",onChange:Ae=>se(Pe,Ee.label,Ae.target.value),style:{...ae,marginTop:4}})]},Ee.label))]},Pe)),i.jsxs("div",{style:{background:Ct.card,padding:"24px 22px",border:`1px solid ${Ct.borderHairline}`},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:16,paddingBottom:N&&A!=null?18:0,borderBottom:N&&A!=null?`1px solid ${Ct.borderHairline}`:"none"},children:[i.jsxs("div",{children:[i.jsxs("div",{style:{fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.16em",textTransform:"uppercase",color:Ct.muted},children:["Total ",C?"· updating…":""]}),i.jsx("div",{style:{fontFamily:Ct.serif,fontSize:"2.35rem",fontWeight:400,color:Ct.ink,lineHeight:1.1,marginTop:4},children:A!=null?b3(A,(le==null?void 0:le.currency)||(N==null?void 0:N.currency)||"INR"):"—"})]}),i.jsx("button",{type:"button",disabled:R||A==null||C,onClick:()=>void be(),style:{padding:"16px 36px",borderRadius:0,border:"none",background:Ct.primary,color:"#fff",fontWeight:700,fontSize:"0.8125rem",letterSpacing:"0.18em",textTransform:"uppercase",fontFamily:Ct.sans,cursor:R?"wait":"pointer",opacity:A==null?.45:1},children:R?"Processing…":q?"Submit proof":"Pay now"})]}),N&&A!=null?i.jsxs("div",{style:{marginTop:20},children:[i.jsx("div",{style:{fontSize:"0.6875rem",fontWeight:600,color:Ct.accent,textTransform:"uppercase",letterSpacing:"0.2em",marginBottom:12},children:"Line items"}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",fontSize:"0.9375rem",color:Ct.ink,fontWeight:500},children:[i.jsxs("span",{children:["Subtotal",N.quantity>1?i.jsxs("span",{style:{color:Ct.muted,fontWeight:400},children:[" (",N.quantity," tickets)"]}):null]}),i.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:b3(N.baseMinor,N.currency)})]}),N.taxLines.map((Se,Pe)=>i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",fontSize:"0.9375rem",color:Ct.ink,fontWeight:500},children:[i.jsxs("span",{children:[Se.label,Se.rateBps>0?i.jsxs("span",{style:{color:Ct.muted,fontWeight:400},children:[" ","(",(Se.rateBps/100).toLocaleString("en-IN",{maximumFractionDigits:2}),"%)"]}):null]}),i.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:b3(Se.amountMinor,N.currency)})]},`${Se.label}-${Pe}`))]})]}):null]}),q&&D&&i.jsxs("section",{style:{background:Ct.express,padding:"28px 24px",marginTop:20,borderRadius:24},children:[i.jsx("h2",{style:{fontSize:"0.7rem",fontWeight:700,margin:"0 0 10px",color:"rgba(255,255,255,0.92)",letterSpacing:"0.2em",textTransform:"uppercase"},children:"Pay with UPI"}),i.jsxs("p",{style:{fontSize:"0.9375rem",color:"rgba(255,255,255,0.95)",margin:"0 0 16px",lineHeight:1.55,fontWeight:500},children:["Pay the ",i.jsx("strong",{style:{fontWeight:700},children:"total amount above"})," in your UPI app (ticket and tax only). Then attach your payment screenshot below."]}),(D.manualQrMode==="dynamic"?D.upiId:D.payeeName||D.upiId)?i.jsxs("p",{style:{fontSize:"0.875rem",margin:"0 0 10px",color:"#fff"},children:[D.manualQrMode==="upload"&&D.payeeName?i.jsx("strong",{children:D.payeeName}):null,D.upiId?i.jsxs("span",{style:{opacity:.9},children:[D.manualQrMode==="upload"&&D.payeeName?" · ":"",D.upiId]}):null]}):null,D.instructions?i.jsx("p",{style:{fontSize:"0.8125rem",color:"rgba(255,255,255,0.88)",whiteSpace:"pre-wrap",margin:"0 0 16px",lineHeight:1.5},children:D.instructions}):null,i.jsx("div",{style:{background:"#fff",padding:16,display:"inline-block",borderRadius:8},children:D.manualQrMode==="dynamic"?ie?i.jsx("img",{src:ie,alt:"UPI QR",style:{maxWidth:280,width:"100%",height:"auto",display:"block"}}):i.jsx("p",{style:{fontSize:"0.875rem",color:Ct.muted,margin:0,maxWidth:260},children:"Choose ticket, quantity, and tax — your QR updates with the exact amount."}):D.upiQrImageUrl?i.jsx("img",{src:D.upiQrImageUrl,alt:"UPI QR",style:{maxWidth:280,width:"100%",height:"auto",display:"block"}}):null})]}),q&&i.jsxs("section",{style:{background:Ct.cream,padding:"24px 22px",borderLeft:`3px solid ${Ct.accent}`,marginTop:20},children:[i.jsx("label",{style:{...ue,color:Ct.accent},children:"Payment screenshot"}),i.jsx("input",{type:"file",accept:"image/*",onChange:Se=>{var Pe;return U(((Pe=Se.target.files)==null?void 0:Pe[0])??null)},style:{marginBottom:16,fontFamily:Ct.sans,fontSize:"0.875rem"}}),i.jsx("label",{style:ue,children:"Note to organiser (optional)"}),i.jsx("textarea",{value:Q,onChange:Se=>K(Se.target.value),rows:3,placeholder:"UPI ref, payer name, etc.",style:{...ae,fontFamily:Ct.sans,resize:"vertical"}})]})]})]})})}const oFe={conference:"Conference",workshop:"Workshop",summit:"Summit",cme:"CME",webinar:"Webinar"};function aFe(e){return e?oFe[e]||e.replace(/^\w/,t=>t.toUpperCase()):""}function sFe(e){return e==="virtual"?"Virtual":e==="hybrid"?"Hybrid":"In person"}function lFe(e){const{startDate:t,endDate:r}=e;if(!t)return"—";const n=new Date(t),o=r?new Date(r):n;if(Number.isNaN(n.getTime()))return"—";const a=!Number.isNaN(o.getTime())&&n.toDateString()===o.toDateString(),s={month:"short",day:"numeric",year:"numeric"};return a?n.toLocaleDateString(void 0,{weekday:"short",...s}):`${n.toLocaleDateString(void 0,s)} – ${o.toLocaleDateString(void 0,s)}`}function cFe(e){var r;return((r=e.location)==null?void 0:r.trim())?e.locationType==="physical"||e.locationType==="hybrid":!1}function Uq({event:e,variant:t="default"}){const r=aFe(e.eventType),n=lFe(e),o=sFe(e.locationType),a=cFe(e),s=t==="embedded";return i.jsxs("div",{style:{marginBottom:s?18:28,paddingBottom:s?0:22,borderBottom:s?"none":"1px solid var(--border, #e2e8f0)"},children:[e.imageUrl&&!e.logoUrl?i.jsx("div",{style:{marginBottom:16,borderRadius:10,overflow:"hidden",maxHeight:160},children:i.jsx("img",{src:e.imageUrl,alt:"",style:{width:"100%",height:"100%",maxHeight:160,objectFit:"cover",display:"block"}})}):null,i.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:16,flexWrap:"wrap"},children:[e.logoUrl?i.jsx("img",{src:e.logoUrl,alt:e.name,style:{maxHeight:64,maxWidth:220,width:"auto",height:"auto",objectFit:"contain",flexShrink:0}}):null,i.jsxs("div",{style:{minWidth:0,flex:"1 1 200px"},children:[i.jsx("h1",{style:{fontFamily:"var(--font-inter, system-ui, sans-serif)",fontSize:"1.375rem",fontWeight:600,margin:"0 0 6px",lineHeight:1.25,color:"var(--foreground, #0f172a)"},children:e.name}),e.subtitle?i.jsx("p",{style:{margin:"0 0 10px",fontSize:"0.95rem",color:"var(--muted, #64748b)",lineHeight:1.45},children:e.subtitle}):null,i.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 10px",fontSize:"0.8125rem",color:"var(--muted, #64748b)",fontFamily:"var(--font-noto-sans, system-ui, sans-serif)"},children:[i.jsx("span",{style:{color:"var(--foreground, #334155)",fontWeight:500},children:n}),r?i.jsxs(i.Fragment,{children:[i.jsx("span",{"aria-hidden":"true",style:{opacity:.5},children:"·"}),i.jsx("span",{children:r})]}):null,i.jsx("span",{"aria-hidden":"true",style:{opacity:.5},children:"·"}),i.jsx("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",borderRadius:999,background:e.locationType==="virtual"?"rgba(59, 130, 246, 0.12)":e.locationType==="hybrid"?"rgba(147, 51, 234, 0.12)":"rgba(22, 163, 74, 0.12)",color:e.locationType==="virtual"?"#1d4ed8":e.locationType==="hybrid"?"#7e22ce":"#15803d",fontWeight:600,fontSize:"0.75rem"},children:o}),a?i.jsxs(i.Fragment,{children:[i.jsx("span",{"aria-hidden":"true",style:{opacity:.5},children:"·"}),i.jsx("span",{style:{color:"var(--foreground, #475569)"},children:e.location.trim()})]}):null]})]})]})]})}function Z1(e){return(e||"").trim()}function uFe(e,t){const r=Z1(e.label);return r?e.type==="checkboxes"&&Array.isArray(t)?{[r]:t}:e.type==="checkbox"?{[r]:t===!0||t==="true"?"Yes":""}:{[r]:t}:{}}function dFe(e){var r;if(e.type==="stars")return!0;if(e.type!=="select"||!((r=e.options)!=null&&r.length))return!1;const t=e.options.map(n=>String(n));return t.length===5&&t.every((n,o)=>n===String(o+1))}function fFe(e){var t;if(e.type==="stars"){const r=(t=e.options)==null?void 0:t.length;return r&&r>0?r:5}return 5}function pFe(){var T,A;const{formId:e=""}=Jw(),[t,r]=S.useState(null),[n,o]=S.useState(null),[a,s]=S.useState({}),[l,c]=S.useState({}),[u,d]=S.useState(!1),[f,h]=S.useState(null),[p,v]=S.useState(!1),m=S.useCallback(async()=>{if(e){o(null);try{const P=await Mo.getPublic(e);r(P)}catch(P){o(P instanceof Error?P.message:"Could not load form.")}}},[e]);S.useEffect(()=>{m()},[m]);const b=(P,N)=>{s(O=>({...O,[P]:N}))},x=S.useCallback(()=>{var P;if(!((P=t==null?void 0:t.fields)!=null&&P.length))return null;for(const N of t.fields){const O=Z1(N.label);if(!O||!N.required)continue;const C=N.type;if(C==="checkboxes"){const R=a[O];if(!Array.isArray(R)||R.length===0)return`“${O}” is required.`;continue}if(C==="checkbox"){if(!a[O])return`“${O}” is required.`;continue}const I=a[O];if(I==null||typeof I=="string"&&I.trim()==="")return`“${O}” is required.`}return null},[t,a]),w=async P=>{if(P.preventDefault(),!e||!t)return;h(null);const N=x();if(N){h(N);return}const O={};for(const C of t.fields||[]){const I=Z1(C.label);I&&Object.assign(O,uFe(C,a[I]))}d(!0);try{await Mo.submit(e,{data:O}),v(!0)}catch(C){h(C instanceof Error?C.message:"Submit failed.")}finally{d(!1)}};if(n)return i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--background, #f8fafc)",color:"var(--foreground, #0f172a)",fontFamily:"var(--font-noto-sans, system-ui, sans-serif)"},children:i.jsx("p",{style:{margin:0,fontSize:"0.95rem"},children:n})});if(!t)return i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--background, #f8fafc)",color:"var(--muted, #64748b)"},children:"Loading…"});if(p){const P=((A=(T=t.settings)==null?void 0:T.thankYouMessage)==null?void 0:A.trim())||"Thank you for your response.",N=t.event;return i.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--background, #f8fafc)",color:"var(--foreground, #0f172a)",fontFamily:"var(--font-noto-sans, system-ui, sans-serif)"},children:i.jsxs("div",{style:{maxWidth:520,width:"100%",textAlign:N?"left":"center",padding:32,background:"var(--card, #fff)",border:"1px solid var(--border, #e2e8f0)",borderRadius:"var(--radius-card, 12px)",boxShadow:"0 1px 3px rgba(0,0,0,0.08)"},children:[N?i.jsx(Uq,{event:N,variant:"embedded"}):null,i.jsx("h1",{style:{fontFamily:"var(--font-inter, system-ui, sans-serif)",fontSize:"1.2rem",fontWeight:600,margin:"0 0 8px"},children:t.name}),i.jsx("p",{style:{margin:0,fontSize:"0.95rem",lineHeight:1.5,color:"var(--foreground)"},children:P})]})})}const k={display:"block",fontSize:"0.75rem",fontWeight:600,color:"var(--muted, #64748b)",marginBottom:6,textTransform:"uppercase",letterSpacing:"0.04em"},j={width:"100%",padding:"10px 12px",fontSize:"0.9rem",borderRadius:8,border:"1px solid var(--border, #e2e8f0)",background:"var(--card, #fff)",color:"var(--foreground, #0f172a)",boxSizing:"border-box"},_=t.event;return i.jsx("div",{style:{minHeight:"100vh",padding:"32px 16px 48px",background:"var(--background, #f8fafc)",color:"var(--foreground, #0f172a)",fontFamily:"var(--font-noto-sans, system-ui, sans-serif)"},children:i.jsxs("div",{style:{maxWidth:520,margin:"0 auto"},children:[_?i.jsx(Uq,{event:_}):null,i.jsx("h1",{style:{fontFamily:"var(--font-inter, system-ui, sans-serif)",fontSize:_?"1.25rem":"1.5rem",fontWeight:600,margin:"0 0 8px",lineHeight:1.3,color:"var(--foreground, #0f172a)"},children:t.name}),t.description?i.jsx("p",{style:{margin:"0 0 24px",color:"var(--muted, #64748b)",fontSize:"0.9rem",lineHeight:1.5},children:t.description}):i.jsx("div",{style:{marginBottom:24}}),i.jsxs("form",{onSubmit:P=>void w(P),style:{padding:24,background:"var(--card, #fff)",border:"1px solid var(--border, #e2e8f0)",borderRadius:"var(--radius-card, 12px)",display:"flex",flexDirection:"column",gap:16,boxShadow:"0 1px 3px rgba(0,0,0,0.06)"},children:[(t.fields||[]).map(P=>{var C,I,R;const N=Z1(P.label);if(!N)return null;const O=P.required;if(P.type==="textarea")return i.jsxs("div",{children:[i.jsxs("label",{style:k,children:[N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]}),i.jsx("textarea",{value:String(a[N]??""),onChange:F=>b(N,F.target.value),placeholder:P.placeholder,required:!!O,rows:4,style:{...j,resize:"vertical",minHeight:96}})]},N);if(P.type==="text"||P.type==="email"||P.type==="phone")return i.jsxs("div",{children:[i.jsxs("label",{style:k,children:[N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]}),i.jsx("input",{type:P.type==="email"?"email":P.type==="phone"?"tel":"text",value:String(a[N]??""),onChange:F=>b(N,F.target.value),placeholder:P.placeholder,required:!!O,style:j})]},N);if(dFe(P)){const F=fFe(P),M=a[N],Y=M!=null&&M!==""?parseInt(String(M),10):0,X=!Number.isNaN(Y)&&Y>=1&&Y<=F?Y:0;return i.jsxs("div",{children:[i.jsxs("div",{style:k,id:`star-legend-${N}`,children:[N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]}),i.jsx("div",{role:"radiogroup","aria-labelledby":`star-legend-${N}`,style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4},children:Array.from({length:F},($,ee)=>{const V=ee+1,D=X>=V;return i.jsx("button",{type:"button",role:"radio","aria-checked":X===V,"aria-label":`${V} of ${F} stars`,onClick:()=>b(N,String(V)),style:{fontSize:"2rem",lineHeight:1,width:44,height:44,border:"none",background:"transparent",cursor:"pointer",padding:0,color:D?"#ca8a04":"var(--border, #e2e8f0)",transition:"color 0.12s, transform 0.12s"},children:"★"},V)})})]},N)}if(P.type==="select"&&(((C=P.options)==null?void 0:C.length)??0)>0)return i.jsxs("div",{children:[i.jsxs("label",{style:k,children:[N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]}),i.jsxs("select",{value:String(a[N]??""),onChange:F=>b(N,F.target.value),required:!!O,style:{...j,cursor:"pointer"},children:[i.jsx("option",{value:"",children:"Select…"}),P.options.map(F=>i.jsx("option",{value:F,children:F},F))]})]},N);if(P.type==="radio"&&(((I=P.options)==null?void 0:I.length)??0)>0)return i.jsxs("fieldset",{style:{border:"none",padding:0,margin:0},children:[i.jsxs("legend",{style:{...k,marginBottom:8},children:[N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:P.options.map(F=>i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.9rem",cursor:"pointer"},children:[i.jsx("input",{type:"radio",name:N,value:F,checked:a[N]===F,onChange:()=>b(N,F)}),F]},F))})]},N);if(P.type==="checkboxes"&&(((R=P.options)==null?void 0:R.length)??0)>0){const F=a[N]||[];return i.jsxs("fieldset",{style:{border:"none",padding:0,margin:0},children:[i.jsxs("legend",{style:{...k,marginBottom:8},children:[N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:P.options.map(M=>{const Y=F.includes(M);return i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.9rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:Y,onChange:()=>{b(N,Y?F.filter(X=>X!==M):[...F,M])}}),M]},M)})})]},N)}return P.type==="checkbox"?i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,fontSize:"0.9rem",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:!!a[N],onChange:F=>b(N,F.target.checked)}),N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]},N):P.type==="file"?i.jsxs("div",{children:[i.jsxs("span",{style:k,children:[N,O?i.jsx("span",{style:{color:"var(--destructive, #dc2626)"},children:" *"}):null]}),i.jsx("input",{type:"file",onChange:async F=>{var X;const M=(X=F.target.files)==null?void 0:X[0];if(!M){b(N,""),c($=>({...$,[N]:""}));return}c($=>({...$,[N]:M.name}));const Y=new FileReader;Y.onload=()=>b(N,String(Y.result||"")),Y.onerror=()=>b(N,""),Y.readAsDataURL(M)},style:{fontSize:"0.85rem"}}),l[N]?i.jsx("p",{style:{margin:"6px 0 0",fontSize:"0.8rem",color:"var(--muted)"},children:l[N]}):null]},N):i.jsxs("div",{children:[i.jsx("label",{style:k,children:N}),i.jsx("input",{type:"text",value:String(a[N]??""),onChange:F=>b(N,F.target.value),style:j})]},N)}),f?i.jsx("p",{style:{margin:0,fontSize:"0.85rem",color:"var(--destructive, #dc2626)"},children:f}):null,i.jsx("button",{type:"submit",disabled:u,style:{marginTop:8,padding:"12px 20px",borderRadius:"var(--radius-button, 8px)",border:"none",background:"var(--primary, #0f3072)",color:"var(--primary-foreground, #fff)",fontSize:"0.9rem",fontWeight:600,cursor:u?"not-allowed":"pointer",opacity:u?.75:1},children:u?"Submitting…":"Submit"})]})]})})}function hFe(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function gFe(e,t){const r=t.trim().toLowerCase();return r?[e.displayName,e.firstName,e.lastName,e.email,e.phone].filter(Boolean).join(" ").toLowerCase().includes(r):!0}function mFe(){var N;const{token:e}=Jw(),[t,r]=S.useState(null),[n,o]=S.useState(null),[a,s]=S.useState(!0),[l,c]=S.useState(""),[u,d]=S.useState([]),[f,h]=S.useState(!1),[p,v]=S.useState(null),[m,b]=S.useState(null),[x,w]=S.useState(null),[k,j]=S.useState(null),_=S.useCallback(async()=>{var C;if(!e)return;h(!0),v(null);const O=await u5.search(e);if(h(!1),O.error){v(O.error),d([]);return}d(((C=O.data)==null?void 0:C.participants)??[])},[e]);S.useEffect(()=>{if(!e){o("Invalid link"),s(!1);return}(async()=>{var C;s(!0);const O=await u5.getSession(e);if(s(!1),O.error||!O.data){o(O.error||"Session not found");return}if(O.data.status!=="active"){o("This attendance session is closed");return}if(!((C=O.data.settings)!=null&&C.publicLinkEnabled)){o("Public check-in is disabled for this session");return}r(O.data)})()},[e]),S.useEffect(()=>{t&&e&&_()},[t,e,_]);const T=S.useMemo(()=>u.filter(O=>gFe(O,l)),[u,l]),A=S.useCallback(async O=>{if(!e)return;b(O),j(null),w(null);const C=await u5.checkIn(e,O);if(b(null),C.error){j(C.error);return}w(O),await _(),setTimeout(()=>w(null),3e3)},[e,_]);if(a)return i.jsx("div",{style:w3,children:i.jsx("p",{style:{color:"var(--muted)"},children:"Loading…"})});if(n||!t)return i.jsx("div",{style:w3,children:i.jsxs("div",{style:vFe,children:[i.jsx(Wh,{size:24,color:"#b91c1c"}),i.jsx("p",{style:{margin:"12px 0 0",fontWeight:500},children:n||"Unavailable"})]})});const P=!!((N=t.settings)!=null&&N.allowDuplicateCheckIn);return i.jsx("div",{style:w3,children:i.jsxs("div",{style:{width:"100%",maxWidth:520},children:[i.jsxs("div",{style:{textAlign:"center",marginBottom:28},children:[i.jsx("div",{style:{width:48,height:48,borderRadius:12,background:"var(--primary)",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",marginBottom:12},children:i.jsx(hT,{size:24})}),i.jsx("h1",{style:{margin:"0 0 6px",fontSize:"1.35rem",fontWeight:600},children:t.name}),i.jsx("p",{style:{margin:0,fontSize:"0.9rem",color:"var(--muted)"},children:t.event.name}),t.description&&i.jsx("p",{style:{margin:"10px 0 0",fontSize:"0.85rem",color:"var(--muted)"},children:t.description})]}),i.jsx("label",{style:{display:"block",fontSize:"0.9rem",fontWeight:500,marginBottom:8},children:"Search by name, email, or phone"}),i.jsxs("div",{style:{position:"relative",marginBottom:16},children:[i.jsx(pi,{size:18,style:{position:"absolute",left:12,top:"50%",transform:"translateY(-50%)",color:"var(--muted)"}}),i.jsx("input",{type:"search",value:l,onChange:O=>c(O.target.value),placeholder:"Filter participants…",autoComplete:"off",style:{width:"100%",height:48,paddingLeft:40,paddingRight:12,borderRadius:10,border:"1px solid var(--border)",fontSize:"1rem",boxSizing:"border-box"}})]}),f&&i.jsx("p",{style:{fontSize:"0.85rem",color:"var(--muted)",marginBottom:12},children:"Loading participants…"}),p&&i.jsx("p",{style:{fontSize:"0.85rem",color:"#b91c1c",marginBottom:12},children:p}),k&&i.jsx("p",{style:{fontSize:"0.85rem",color:"#b91c1c",marginBottom:12},children:k}),!f&&u.length>0&&i.jsx("p",{style:{fontSize:"0.8rem",color:"var(--muted)",marginBottom:12},children:l.trim()?`${T.length} of ${u.length} participants`:`${u.length} participants`}),i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[T.map(O=>{const C=!O.alreadyCheckedIn||P,I=x===O._id;return i.jsx("div",{style:{padding:"14px 16px",border:"1px solid var(--border)",borderRadius:10,background:"#fff",boxShadow:"0 1px 2px rgba(0,0,0,0.04)"},children:i.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("div",{style:{fontWeight:600,fontSize:"0.95rem"},children:O.displayName}),i.jsx("div",{style:{fontSize:"0.8rem",color:"var(--muted)",marginTop:4},children:[O.email,O.phone].filter(Boolean).join(" · ")||"—"}),O.alreadyCheckedIn&&i.jsxs("div",{style:{fontSize:"0.75rem",color:"#15803d",marginTop:6},children:["Already checked in",O.lastCheckedInAt?` · ${hFe(O.lastCheckedInAt)}`:""]})]}),I?i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,color:"#15803d",fontSize:"0.85rem"},children:[i.jsx(yv,{size:18})," Done"]}):i.jsxs("button",{type:"button",disabled:!C||m===O._id,onClick:()=>A(O._id),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"10px 14px",background:C?"var(--primary)":"#e5e7eb",color:C?"#fff":"#9ca3af",border:"none",borderRadius:8,cursor:C?"pointer":"not-allowed",fontSize:"0.9rem",fontWeight:500,flexShrink:0},children:[i.jsx(lS,{size:16}),O.alreadyCheckedIn&&P?"Again":"Check in"]})]})},O._id)}),!f&&l.trim()&&T.length===0&&i.jsx("p",{style:{textAlign:"center",color:"var(--muted)",fontSize:"0.9rem"},children:"No participants match your search."}),!f&&!l.trim()&&u.length===0&&!p&&i.jsx("p",{style:{textAlign:"center",color:"var(--muted)",fontSize:"0.9rem"},children:"No participants registered for this event."})]})]})})}const w3={minHeight:"100vh",display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"32px 20px 48px",background:"var(--background, #f8fafc)",fontFamily:"var(--font-inter, system-ui, sans-serif)"},vFe={textAlign:"center",padding:32,background:"#fff",borderRadius:12,border:"1px solid var(--border)",maxWidth:400};function yFe(){return i.jsx(zoe,{children:i.jsx($ee,{children:i.jsx(Xee,{children:i.jsxs(Fee,{children:[i.jsx(Moe,{}),i.jsxs(Eee,{children:[i.jsx(za,{path:"/login",element:i.jsx(qoe,{})}),i.jsx(za,{path:"/register",element:i.jsx($oe,{})}),i.jsx(za,{path:"/invite/event",element:i.jsx(Uoe,{})}),i.jsx(za,{path:"/event/:eventId/tickets",element:i.jsx(iFe,{})}),i.jsx(za,{path:"/form/:formId",element:i.jsx(pFe,{})}),i.jsx(za,{path:"/attendance/:token",element:i.jsx(mFe,{})}),i.jsxs(za,{path:"/",element:i.jsx(rT,{}),children:[i.jsx(za,{index:!0,element:i.jsx(gh,{to:"/home",replace:!0})}),i.jsxs(za,{path:"super-admin",element:i.jsx(GLe,{}),children:[i.jsx(za,{index:!0,element:i.jsx(gh,{to:"clients",replace:!0})}),i.jsx(za,{path:"clients",element:i.jsx(QLe,{})}),i.jsx(za,{path:"plans",element:i.jsx(eFe,{})})]}),i.jsx(za,{path:":navId",element:i.jsx(rT.AppShellWithNav,{})})]}),i.jsx(za,{path:"*",element:i.jsx(gh,{to:"/home",replace:!0})})]})]})})})})}Hq.createRoot(document.getElementById("root")).render(i.jsx(yFe,{}));export{On as _,L0 as c,dn as g};