vendor: 4,086 bytes, lines 1-9
1var Gre=Object.defineProperty;var NI=e=>{throw TypeError(e)};var Yre=(e,t,n)=>t in e?Gre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var An=(e,t,n)=>Yre(e,typeof t!="symbol"?t+"":t,n),m4=(e,t,n)=>t.has(e)||NI("Cannot "+n);var Pe=(e,t,n)=>(m4(e,t,"read from private field"),n?n.call(e):t.get(e)),vr=(e,t,n)=>t.has(e)?NI("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),qt=(e,t,n,s)=>(m4(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),rn=(e,t,n)=>(m4(e,t,"access private method"),n);var Ew=(e,t,n,s)=>({set _(a){qt(e,t,a,n)},get _(){return Pe(e,t,s)}});function Kre(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(s,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>s[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();var oi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Xre(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}),n}var eU={exports:{}},S2={},tU={exports:{}},Qr={};/** 2 * @license React 3 * react.production.min.js 4 * 5 * Copyright (c) Facebook, Inc. and its affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var Gb=Symbol.for("react.element"),Zre=Symbol.for("react.portal"),Jre=Symbol.for("react.fragment"),Qre=Symbol.for("react.strict_mode"),ene=Symbol.for("react.profiler"),tne=Symbol.for("react.provider"),rne=Symbol.for("react.context"),nne=Symbol.for("react.forward_ref"),sne=Symbol.for("react.suspense"),ane=Symbol.for("react.memo"),ine=Symbol.for("react.lazy"),_I=Symbol.iterator;function one(e){return e===null||typeof e!="object"?null:(e=_I&&e[_I]||e["@@iterator"],typeof e=="function"?e:null)}var rU={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nU=Object.assign,sU={};function Xx(e,t,n){this.props=e,this.context=t,this.refs=sU,this.updater=n||rU}Xx.prototype.isReactComponent={};Xx.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Xx.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function aU(){}aU.prototype=Xx.prototype;function PE(e,t,n){this.props=e,this.context=t,this.refs=sU,this.updater=n||rU}var EE=PE.prototype=new aU;EE.constructor=PE;nU(EE,Xx.prototype);EE.isPureReactComponent=!0;var SI=Array.isArray,iU=Object.prototype.hasOwnProperty,TE={current:null},oU={key:!0,ref:!0,__self:!0,__source:!0};
vendor: 2,363 bytes, line 9
9function lU(e,t,n){var s,a={},i=null,o=null;if(t!=null)for(s in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)iU.call(t,s)&&!oU.hasOwnProperty(s)&&(a[s]=t[s]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];a.children=c}if(e&&e.defaultProps)for(s in l=e.defaultProps,l)a[s]===void 0&&(a[s]=l[s]);return{$$typeof:Gb,type:e,key:i,ref:o,props:a,_owner:TE.current}}function lne(e,t){return{$$typeof:Gb,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function OE(e){return typeof e=="object"&&e!==null&&e.$$typeof===Gb}function cne(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var kI=/\/+/g;function p4(e,t){return typeof e=="object"&&e!==null&&e.key!=null?cne(""+e.key):t.toString(36)}function F1(e,t,n,s,a){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Gb:case Zre:o=!0}}if(o)return o=e,a=a(o),e=s===""?"."+p4(o,0):s,SI(a)?(n="",e!=null&&(n=e.replace(kI,"$&/")+"/"),F1(a,t,n,"",function(d){return d})):a!=null&&(OE(a)&&(a=lne(a,n+(!a.key||o&&o.key===a.key?"":(""+a.key).replace(kI,"$&/")+"/")+e)),t.push(a)),1;if(o=0,s=s===""?".":s+":",SI(e))for(var l=0;l<e.length;l++){i=e[l];var c=s+p4(i,l);o+=F1(i,t,n,c,a)}else if(c=one(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=s+p4(i,l++),o+=F1(i,t,n,c,a);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Tw(e,t,n){if(e==null)return e;var s=[],a=0;return F1(e,s,"","",function(i){return t.call(n,i,a++)}),s}function dne(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Li={current:null},B1={transition:null},une={ReactCurrentDispatcher:Li,ReactCurrentBatchConfig:B1,ReactCurrentOwner:TE};function cU(){throw Error("act(...) is not supported in production builds of React.")}
vendor: 9,534 bytes, lines 9-33
9Qr.Children={map:Tw,forEach:function(e,t,n){Tw(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Tw(e,function(){t++}),t},toArray:function(e){return Tw(e,function(t){return t})||[]},only:function(e){if(!OE(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Qr.Component=Xx;Qr.Fragment=Jre;Qr.Profiler=ene;Qr.PureComponent=PE;Qr.StrictMode=Qre;Qr.Suspense=sne;Qr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=une;Qr.act=cU;Qr.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=nU({},e.props),a=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=TE.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)iU.call(t,c)&&!oU.hasOwnProperty(c)&&(s[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)s.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];s.children=l}return{$$typeof:Gb,type:e.type,key:a,ref:i,props:s,_owner:o}};Qr.createContext=function(e){return e={$$typeof:rne,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:tne,_context:e},e.Consumer=e};Qr.createElement=lU;Qr.createFactory=function(e){var t=lU.bind(null,e);return t.type=e,t};Qr.createRef=function(){return{current:null}};Qr.forwardRef=function(e){return{$$typeof:nne,render:e}};Qr.isValidElement=OE;Qr.lazy=function(e){return{$$typeof:ine,_payload:{_status:-1,_result:e},_init:dne}};Qr.memo=function(e,t){return{$$typeof:ane,type:e,compare:t===void 0?null:t}};Qr.startTransition=function(e){var t=B1.transition;B1.transition={};try{e()}finally{B1.transition=t}};Qr.unstable_act=cU;Qr.useCallback=function(e,t){return Li.current.useCallback(e,t)};Qr.useContext=function(e){return Li.current.useContext(e)};Qr.useDebugValue=function(){};Qr.useDeferredValue=function(e){return Li.current.useDeferredValue(e)};Qr.useEffect=function(e,t){return Li.current.useEffect(e,t)};Qr.useId=function(){return Li.current.useId()};Qr.useImperativeHandle=function(e,t,n){return Li.current.useImperativeHandle(e,t,n)};Qr.useInsertionEffect=function(e,t){return Li.current.useInsertionEffect(e,t)};Qr.useLayoutEffect=function(e,t){return Li.current.useLayoutEffect(e,t)};Qr.useMemo=function(e,t){return Li.current.useMemo(e,t)};Qr.useReducer=function(e,t,n){return Li.current.useReducer(e,t,n)};Qr.useRef=function(e){return Li.current.useRef(e)};Qr.useState=function(e){return Li.current.useState(e)};Qr.useSyncExternalStore=function(e,t,n){return Li.current.useSyncExternalStore(e,t,n)};Qr.useTransition=function(){return Li.current.useTransition()};Qr.version="18.3.1";tU.exports=Qr;var j=tU.exports;const ee=_n(j),LE=Kre({__proto__:null,default:ee},[j]);/** 10 * @license React 11 * react-jsx-runtime.production.min.js 12 * 13 * Copyright (c) Facebook, Inc. and its affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var hne=j,fne=Symbol.for("react.element"),mne=Symbol.for("react.fragment"),pne=Object.prototype.hasOwnProperty,gne=hne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,xne={key:!0,ref:!0,__self:!0,__source:!0};function dU(e,t,n){var s,a={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(s in t)pne.call(t,s)&&!xne.hasOwnProperty(s)&&(a[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)a[s]===void 0&&(a[s]=t[s]);return{$$typeof:fne,type:e,key:i,ref:o,props:a,_owner:gne.current}}S2.Fragment=mne;S2.jsx=dU;S2.jsxs=dU;eU.exports=S2;var r=eU.exports,uU={exports:{}},qo={},hU={exports:{}},fU={};/** 18 * @license React 19 * scheduler.production.min.js 20 * 21 * Copyright (c) Facebook, Inc. and its affiliates. 22 * 23 * This source code is licensed under the MIT license found in the 24 * LICENSE file in the root directory of this source tree. 25 */(function(e){function t($,q){var ne=$.length;$.push(q);e:for(;0<ne;){var se=ne-1>>>1,F=$[se];if(0<a(F,q))$[se]=q,$[ne]=F,ne=se;else break e}}function n($){return $.length===0?null:$[0]}function s($){if($.length===0)return null;var q=$[0],ne=$.pop();if(ne!==q){$[0]=ne;e:for(var se=0,F=$.length,V=F>>>1;se<V;){var Z=2*(se+1)-1,de=$[Z],ve=Z+1,pe=$[ve];if(0>a(de,ne))ve<F&&0>a(pe,de)?($[se]=pe,$[ve]=ne,se=ve):($[se]=de,$[Z]=ne,se=Z);else if(ve<F&&0>a(pe,ne))$[se]=pe,$[ve]=ne,se=ve;else break e}}return q}function a($,q){var ne=$.sortIndex-q.sortIndex;return ne!==0?ne:$.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,h=null,f=3,m=!1,x=!1,p=!1,v=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b($){for(var q=n(d);q!==null;){if(q.callback===null)s(d);else if(q.startTime<=$)s(d),q.sortIndex=q.expirationTime,t(c,q);else break;q=n(d)}}function w($){if(p=!1,b($),!x)if(n(c)!==null)x=!0,z(_);else{var q=n(d);q!==null&&U(w,q.startTime-$)}}function _($,q){x=!1,p&&(p=!1,g(N),N=-1),m=!0;var ne=f;try{for(b(q),h=n(c);h!==null&&(!(h.expirationTime>q)||$&&!P());){var se=h.callback;if(typeof se=="function"){h.callback=null,f=h.priorityLevel;var F=se(h.expirationTime<=q);q=e.unstable_now(),typeof F=="function"?h.callback=F:h===n(c)&&s(c),b(q)}else s(c);h=n(c)}if(h!==null)var V=!0;else{var Z=n(d);Z!==null&&U(w,Z.startTime-q),V=!1}return V}finally{h=null,f=ne,m=!1}}var C=!1,E=null,N=-1,k=5,I=-1;function P(){return!(e.unstable_now()-I<k)}function O(){if(E!==null){var $=e.unstable_now();I=$;var q=!0;try{q=E(!0,$)}finally{q?A():(C=!1,E=null)}}else C=!1}var A;if(typeof y=="function")A=function(){y(O)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,L=R.port2;R.port1.onmessage=O,A=function(){L.postMessage(null)}}else A=function(){v(O,0)};function z($){E=$,C||(C=!0,A())}function U($,q){N=v(function(){$(e.unstable_now())},q)}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(){x||m||(x=!0,z(_))},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"):k=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(f){case 1:case 2:case 3:var q=3;break;default:q=f}var ne=f;f=q;try{return $()}finally{f=ne}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,q){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ne=f;f=$;try{return q()}finally{f=ne}},e.unstable_scheduleCallback=function($,q,ne){var se=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?se+ne:se):ne=se,$){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=ne+F,$={id:u++,callback:q,priorityLevel:$,startTime:ne,expirationTime:F,sortIndex:-1},ne>se?($.sortIndex=ne,t(d,$),n(c)===null&&$===n(d)&&(p?(g(N),N=-1):p=!0,U(w,ne-se))):($.sortIndex=F,t(c,$),x||m||(x=!0,z(_))),$},e.unstable_shouldYield=P,e.unstable_wrapCallback=function($){var q=f;return function(){var ne=f;f=q;try{return $.apply(this,arguments)}finally{f=ne}}}})(fU);hU.exports=fU;var vne=hU.exports;/** 26 * @license React 27 * react-dom.production.min.js 28 * 29 * Copyright (c) Facebook, Inc. and its affiliates. 30 * 31 * This source code is licensed under the MIT license found in the 32 * LICENSE file in the root directory of this source tree. 33 */var yne=j,$o=vne;function ft(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var mU=new Set,b0={};function Wm(e,t){Jg(e,t),Jg(e+"Capture",t)}function Jg(e,t){for(b0[e]=t,e=0;e<t.length;e++)mU.add(t[e])}var Kd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),MC=Object.prototype.hasOwnProperty,bne=/^[: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]*$/,CI={},AI={};function jne(e){return MC.call(AI,e)?!0:MC.call(CI,e)?!1:bne.test(e)?AI[e]=!0:(CI[e]=!0,!1)}function wne(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Nne(e,t,n,s){if(t===null||typeof t>"u"||wne(e,t,n,s))return!0;
vendor: 5,203 bytes, lines 33-34
33if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ii(e,t,n,s,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var qa={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){qa[e]=new Ii(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];qa[t]=new Ii(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){qa[e]=new Ii(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){qa[e]=new Ii(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){qa[e]=new Ii(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){qa[e]=new Ii(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){qa[e]=new Ii(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){qa[e]=new Ii(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){qa[e]=new Ii(e,5,!1,e.toLowerCase(),null,!1,!1)});var IE=/[\-:]([a-z])/g;function RE(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(IE,RE);qa[t]=new Ii(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(IE,RE);qa[t]=new Ii(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(IE,RE);qa[t]=new Ii(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){qa[e]=new Ii(e,1,!1,e.toLowerCase(),null,!1,!1)});qa.xlinkHref=new Ii("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){qa[e]=new Ii(e,1,!1,e.toLowerCase(),null,!0,!0)});function ME(e,t,n,s){var a=qa.hasOwnProperty(t)?qa[t]:null;(a!==null?a.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Nne(t,n,a,s)&&(n=null),s||a===null?jne(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,s=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,s?e.setAttributeNS(s,t,n):e.setAttribute(t,n))))}var iu=yne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ow=Symbol.for("react.element"),rg=Symbol.for("react.portal"),ng=Symbol.for("react.fragment"),DE=Symbol.for("react.strict_mode"),DC=Symbol.for("react.profiler"),pU=Symbol.for("react.provider"),gU=Symbol.for("react.context"),$E=Symbol.for("react.forward_ref"),$C=Symbol.for("react.suspense"),FC=Symbol.for("react.suspense_list"),FE=Symbol.for("react.memo"),Fu=Symbol.for("react.lazy"),xU=Symbol.for("react.offscreen"),PI=Symbol.iterator;function ey(e){return e===null||typeof e!="object"?null:(e=PI&&e[PI]||e["@@iterator"],typeof e=="function"?e:null)}var Ss=Object.assign,g4;function Ly(e){if(g4===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);g4=t&&t[1]||""}return` 34`+g4+e}var x4=!1;function v4(e,t){if(!e||x4)return"";x4=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var s=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){s=d}e.call(t.prototype)}else{try{throw Error()}catch(d){s=d}e()}}
vendor: 16,803 bytes, lines 34-37
34catch(d){if(d&&s&&typeof d.stack=="string"){for(var a=d.stack.split(` 35`),i=s.stack.split(` 36`),o=a.length-1,l=i.length-1;1<=o&&0<=l&&a[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(a[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||a[o]!==i[l]){var c=` 37`+a[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{x4=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ly(e):""}function _ne(e){switch(e.tag){case 5:return Ly(e.type);case 16:return Ly("Lazy");case 13:return Ly("Suspense");case 19:return Ly("SuspenseList");case 0:case 2:case 15:return e=v4(e.type,!1),e;case 11:return e=v4(e.type.render,!1),e;case 1:return e=v4(e.type,!0),e;default:return""}}function BC(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ng:return"Fragment";case rg:return"Portal";case DC:return"Profiler";case DE:return"StrictMode";case $C:return"Suspense";case FC:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gU:return(e.displayName||"Context")+".Consumer";case pU:return(e._context.displayName||"Context")+".Provider";case $E:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case FE:return t=e.displayName||null,t!==null?t:BC(e.type)||"Memo";case Fu:t=e._payload,e=e._init;try{return BC(e(t))}catch{}}return null}function Sne(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return BC(t);case 8:return t===DE?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ah(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vU(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kne(e){var t=vU(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){s=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(o){s=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Lw(e){e._valueTracker||(e._valueTracker=kne(e))}function yU(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=vU(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function mN(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function UC(e,t){var n=t.checked;return Ss({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function EI(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=Ah(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function bU(e,t){t=t.checked,t!=null&&ME(e,"checked",t,!1)}function zC(e,t){bU(e,t);var n=Ah(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?qC(e,t.type,n):t.hasOwnProperty("defaultValue")&&qC(e,t.type,Ah(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function TI(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function qC(e,t,n){(t!=="number"||mN(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Iy=Array.isArray;function bg(e,t,n,s){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Ah(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,s&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function VC(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ft(91));return Ss({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function OI(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ft(92));if(Iy(n)){if(1<n.length)throw Error(ft(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ah(n)}}function jU(e,t){var n=Ah(t.value),s=Ah(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),s!=null&&(e.defaultValue=""+s)}function LI(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function wU(e){switch(e){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 WC(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?wU(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Iw,NU=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,s,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,s,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Iw=Iw||document.createElement("div"),Iw.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Iw.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function j0(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hy={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},Cne=["Webkit","ms","Moz","O"];Object.keys(Hy).forEach(function(e){Cne.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hy[t]=Hy[e]})});function _U(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hy.hasOwnProperty(e)&&Hy[e]?(""+t).trim():t+"px"}function SU(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,a=_U(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,a):e[n]=a}}var Ane=Ss({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 HC(e,t){if(t){if(Ane[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ft(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ft(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ft(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ft(62))}}function GC(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var YC=null;function BE(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var KC=null,jg=null,wg=null;function II(e){if(e=Xb(e)){if(typeof KC!="function")throw Error(ft(280));var t=e.stateNode;t&&(t=E2(t),KC(e.stateNode,e.type,t))}}function kU(e){jg?wg?wg.push(e):wg=[e]:jg=e}function CU(){if(jg){var e=jg,t=wg;if(wg=jg=null,II(e),t)for(e=0;e<t.length;e++)II(t[e])}}function AU(e,t){return e(t)}function PU(){}var y4=!1;function EU(e,t,n){if(y4)return e(t,n);y4=!0;try{return AU(e,t,n)}finally{y4=!1,(jg!==null||wg!==null)&&(PU(),CU())}}function w0(e,t){var n=e.stateNode;if(n===null)return null;var s=E2(n);if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ft(231,t,typeof n));return n}var XC=!1;if(Kd)try{var ty={};Object.defineProperty(ty,"passive",{get:function(){XC=!0}}),window.addEventListener("test",ty,ty),window.removeEventListener("test",ty,ty)}catch{XC=!1}function Pne(e,t,n,s,a,i,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var Gy=!1,pN=null,gN=!1,ZC=null,Ene={onError:function(e){Gy=!0,pN=e}};function Tne(e,t,n,s,a,i,o,l,c){Gy=!1,pN=null,Pne.apply(Ene,arguments)}function One(e,t,n,s,a,i,o,l,c){if(Tne.apply(this,arguments),Gy){if(Gy){var d=pN;Gy=!1,pN=null}else throw Error(ft(198));gN||(gN=!0,ZC=d)}}function Hm(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function TU(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function RI(e){if(Hm(e)!==e)throw Error(ft(188))}function Lne(e){var t=e.alternate;if(!t){if(t=Hm(e),t===null)throw Error(ft(188));return t!==e?null:e}for(var n=e,s=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(s=a.return,s!==null){n=s;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return RI(a),e;if(i===s)return RI(a),t;i=i.sibling}throw Error(ft(188))}if(n.return!==s.return)n=a,s=i;else{for(var o=!1,l=a.child;l;){if(l===n){o=!0,n=a,s=i;break}if(l===s){o=!0,s=a,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,s=a;break}if(l===s){o=!0,s=i,n=a;break}l=l.sibling}if(!o)throw Error(ft(189))}}if(n.alternate!==s)throw Error(ft(190))}if(n.tag!==3)throw Error(ft(188));return n.stateNode.current===n?e:t}function OU(e){return e=Lne(e),e!==null?LU(e):null}function LU(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=LU(e);if(t!==null)return t;e=e.sibling}return null}var IU=$o.unstable_scheduleCallback,MI=$o.unstable_cancelCallback,Ine=$o.unstable_shouldYield,Rne=$o.unstable_requestPaint,Bs=$o.unstable_now,Mne=$o.unstable_getCurrentPriorityLevel,UE=$o.unstable_ImmediatePriority,RU=$o.unstable_UserBlockingPriority,xN=$o.unstable_NormalPriority,Dne=$o.unstable_LowPriority,MU=$o.unstable_IdlePriority,k2=null,Uc=null;function $ne(e){if(Uc&&typeof Uc.onCommitFiberRoot=="function")try{Uc.onCommitFiberRoot(k2,e,void 0,(e.current.flags&128)===128)}catch{}}var Yl=Math.clz32?Math.clz32:Une,Fne=Math.log,Bne=Math.LN2;function Une(e){return e>>>=0,e===0?32:31-(Fne(e)/Bne|0)|0}var Rw=64,Mw=4194304;function Ry(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function vN(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,a=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~a;l!==0?s=Ry(l):(i&=o,i!==0&&(s=Ry(i)))}else o=n&~a,o!==0?s=Ry(o):i!==0&&(s=Ry(i));if(s===0)return 0;if(t!==0&&t!==s&&!(t&a)&&(a=s&-s,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)n=31-Yl(t),a=1<<n,s|=e[n],t&=~a;return s}function zne(e,t){switch(e){case 1:case 2:case 4:return t+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 t+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 qne(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Yl(i),l=1<<o,c=a[o];c===-1?(!(l&n)||l&s)&&(a[o]=zne(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function JC(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function DU(){var e=Rw;return Rw<<=1,!(Rw&4194240)&&(Rw=64),e}function b4(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yb(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Yl(t),e[t]=n}function Vne(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-Yl(n),i=1<<a;t[a]=0,s[a]=-1,e[a]=-1,n&=~i}}function zE(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Yl(n),a=1<<s;a&t|e[s]&t&&(e[s]|=t),n&=~a}}var Ln=0;function $U(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var FU,qE,BU,UU,zU,QC=!1,Dw=[],uh=null,hh=null,fh=null,N0=new Map,_0=new Map,Vu=[],Wne="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 DI(e,t){switch(e){case"focusin":case"focusout":uh=null;break;case"dragenter":case"dragleave":hh=null;break;case"mouseover":case"mouseout":fh=null;break;case"pointerover":case"pointerout":N0.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_0.delete(t.pointerId)}}function ry(e,t,n,s,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[a]},t!==null&&(t=Xb(t),t!==null&&qE(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Hne(e,t,n,s,a){switch(t){case"focusin":return uh=ry(uh,e,t,n,s,a),!0;case"dragenter":return hh=ry(hh,e,t,n,s,a),!0;case"mouseover":return fh=ry(fh,e,t,n,s,a),!0;case"pointerover":var i=a.pointerId;return N0.set(i,ry(N0.get(i)||null,e,t,n,s,a)),!0;case"gotpointercapture":return i=a.pointerId,_0.set(i,ry(_0.get(i)||null,e,t,n,s,a)),!0}return!1}function qU(e){var t=Wf(e.target);if(t!==null){var n=Hm(t);if(n!==null){if(t=n.tag,t===13){if(t=TU(n),t!==null){e.blockedOn=t,zU(e.priority,function(){BU(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function U1(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=eA(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);YC=s,n.target.dispatchEvent(s),YC=null}else return t=Xb(n),t!==null&&qE(t),e.blockedOn=n,!1;t.shift()}return!0}function $I(e,t,n){U1(e)&&n.delete(t)}function Gne(){QC=!1,uh!==null&&U1(uh)&&(uh=null),hh!==null&&U1(hh)&&(hh=null),fh!==null&&U1(fh)&&(fh=null),N0.forEach($I),_0.forEac
vendor: 11,887 bytes, line 37
37h($I)}function ny(e,t){e.blockedOn===t&&(e.blockedOn=null,QC||(QC=!0,$o.unstable_scheduleCallback($o.unstable_NormalPriority,Gne)))}function S0(e){function t(a){return ny(a,e)}if(0<Dw.length){ny(Dw[0],e);for(var n=1;n<Dw.length;n++){var s=Dw[n];s.blockedOn===e&&(s.blockedOn=null)}}for(uh!==null&&ny(uh,e),hh!==null&&ny(hh,e),fh!==null&&ny(fh,e),N0.forEach(t),_0.forEach(t),n=0;n<Vu.length;n++)s=Vu[n],s.blockedOn===e&&(s.blockedOn=null);for(;0<Vu.length&&(n=Vu[0],n.blockedOn===null);)qU(n),n.blockedOn===null&&Vu.shift()}var Ng=iu.ReactCurrentBatchConfig,yN=!0;function Yne(e,t,n,s){var a=Ln,i=Ng.transition;Ng.transition=null;try{Ln=1,VE(e,t,n,s)}finally{Ln=a,Ng.transition=i}}function Kne(e,t,n,s){var a=Ln,i=Ng.transition;Ng.transition=null;try{Ln=4,VE(e,t,n,s)}finally{Ln=a,Ng.transition=i}}function VE(e,t,n,s){if(yN){var a=eA(e,t,n,s);if(a===null)E4(e,t,s,bN,n),DI(e,s);else if(Hne(a,e,t,n,s))s.stopPropagation();else if(DI(e,s),t&4&&-1<Wne.indexOf(e)){for(;a!==null;){var i=Xb(a);if(i!==null&&FU(i),i=eA(e,t,n,s),i===null&&E4(e,t,s,bN,n),i===a)break;a=i}a!==null&&s.stopPropagation()}else E4(e,t,s,null,n)}}var bN=null;function eA(e,t,n,s){if(bN=null,e=BE(s),e=Wf(e),e!==null)if(t=Hm(e),t===null)e=null;else if(n=t.tag,n===13){if(e=TU(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return bN=e,null}function VU(e){switch(e){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(Mne()){case UE:return 1;case RU:return 4;case xN:case Dne:return 16;case MU:return 536870912;default:return 16}default:return 16}}var nh=null,WE=null,z1=null;function WU(){if(z1)return z1;var e,t=WE,n=t.length,s,a="value"in nh?nh.value:nh.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===a[i-s];s++);return z1=a.slice(e,1<s?1-s:void 0)}function q1(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function $w(){return!0}function FI(){return!1}function Vo(e){function t(n,s,a,i,o){this._reactName=n,this._targetInst=a,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?$w:FI,this.isPropagationStopped=FI,this}return Ss(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=$w)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=$w)},persist:function(){},isPersistent:$w}),t}var Zx={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},HE=Vo(Zx),Kb=Ss({},Zx,{view:0,detail:0}),Xne=Vo(Kb),j4,w4,sy,C2=Ss({},Kb,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:GE,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==sy&&(sy&&e.type==="mousemove"?(j4=e.screenX-sy.screenX,w4=e.screenY-sy.screenY):w4=j4=0,sy=e),j4)},movementY:function(e){return"movementY"in e?e.movementY:w4}}),BI=Vo(C2),Zne=Ss({},C2,{dataTransfer:0}),Jne=Vo(Zne),Qne=Ss({},Kb,{relatedTarget:0}),N4=Vo(Qne),ese=Ss({},Zx,{animationName:0,elapsedTime:0,pseudoElement:0}),tse=Vo(ese),rse=Ss({},Zx,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),nse=Vo(rse),sse=Ss({},Zx,{data:0}),UI=Vo(sse),ase={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ise={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"},ose={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lse(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ose[e])?!!t[e]:!1}function GE(){return lse}var cse=Ss({},Kb,{key:function(e){if(e.key){var t=ase[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=q1(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ise[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:GE,charCode:function(e){return e.type==="keypress"?q1(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?q1(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),dse=Vo(cse),use=Ss({},C2,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zI=Vo(use),hse=Ss({},Kb,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:GE}),fse=Vo(hse),mse=Ss({},Zx,{propertyName:0,elapsedTime:0,pseudoElement:0}),pse=Vo(mse),gse=Ss({},C2,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),xse=Vo(gse),vse=[9,13,27,32],YE=Kd&&"CompositionEvent"in window,Yy=null;Kd&&"documentMode"in document&&(Yy=document.documentMode);var yse=Kd&&"TextEvent"in window&&!Yy,HU=Kd&&(!YE||Yy&&8<Yy&&11>=Yy),qI=" ",VI=!1;function GU(e,t){switch(e){case"keyup":return vse.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function YU(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var sg=!1;function bse(e,t){switch(e){case"compositionend":return YU(t);case"keypress":return t.which!==32?null:(VI=!0,qI);case"textInput":return e=t.data,e===qI&&VI?null:e;default:return null}}function jse(e,t){if(sg)return e==="compositionend"||!YE&&GU(e,t)?(e=WU(),z1=WE=nh=null,sg=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return HU&&t.locale!=="ko"?null:t.data;default:return null}}var wse={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 WI(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!wse[e.type]:t==="textarea"}function KU(e,t,n,s){kU(s),t=jN(t,"onChange"),0<t.length&&(n=new HE("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Ky=null,k0=null;function Nse(e){iz(e,0)}function A2(e){var t=og(e);if(yU(t))return e}function _se(e,t){if(e==="change")return t}var XU=!1;if(Kd){var _4;if(Kd){var S4="oninput"in document;if(!S4){var HI=document.createElement("div");HI.setAttribute("oninput","return;"),S4=typeof HI.oninput=="function"}_4=S4}else _4=!1;XU=_4&&(!document.documentMode||9<document.documentMode)}function GI(){Ky&&(Ky.detachEvent("onpropertychange",ZU),k0=Ky=null)}function ZU(e){if(e.propertyName==="value"&&A2(k0)){var t=[];KU(t,k0,e,BE(e)),EU(Nse,t)}}function Sse(e,t,n){e==="focusin"?(GI(),Ky=t,k0=n,Ky.attachEvent("onpropertychange",ZU)):e==="focusout"&&GI()}function kse(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return A2(k0)}function Cse(e,t){if(e==="click")return A2(t)}function Ase(e,t){if(e==="input"||e==="change")return A2(t)}function Pse(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ql=typeof Object.is=="function"?Object.is:Pse;function C0(e,t){if(Ql(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var a=n[s];if(!MC.call(t,a)||!Ql(e[a],t[a]))return!1}return!0}function YI(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function KI(e,t){var n=YI(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=YI(n)}}function JU(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?JU(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function QU(){for(var e=window,t=mN();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=mN(e.document)}return t}function KE(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ese(e){var t=QU(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&JU(n.ownerDocument.documentElement,n)){if(s!==null&&KE(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(s.start,a);s=s.end===void 0?i:Math.min(s.end,a),!e.extend&&i>s&&(a=s,s=i,i=a),a=KI(n,i);var o=KI(n,s);a&&o&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Tse=Kd&&"documentMode"in document&&11>=document.documentMode,ag=null,tA=null,Xy=null,rA=!1;function XI(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;rA||ag==null||ag!==mN(s)||(s=ag,"selectionStart"in s&&KE(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focu
vendor: 4,392 bytes, line 37
37sNode:s.focusNode,focusOffset:s.focusOffset}),Xy&&C0(Xy,s)||(Xy=s,s=jN(tA,"onSelect"),0<s.length&&(t=new HE("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=ag)))}function Fw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ig={animationend:Fw("Animation","AnimationEnd"),animationiteration:Fw("Animation","AnimationIteration"),animationstart:Fw("Animation","AnimationStart"),transitionend:Fw("Transition","TransitionEnd")},k4={},ez={};Kd&&(ez=document.createElement("div").style,"AnimationEvent"in window||(delete ig.animationend.animation,delete ig.animationiteration.animation,delete ig.animationstart.animation),"TransitionEvent"in window||delete ig.transitionend.transition);function P2(e){if(k4[e])return k4[e];if(!ig[e])return e;var t=ig[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ez)return k4[e]=t[n];return e}var tz=P2("animationend"),rz=P2("animationiteration"),nz=P2("animationstart"),sz=P2("transitionend"),az=new Map,ZI="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 Bh(e,t){az.set(e,t),Wm(t,[e])}for(var C4=0;C4<ZI.length;C4++){var A4=ZI[C4],Ose=A4.toLowerCase(),Lse=A4[0].toUpperCase()+A4.slice(1);Bh(Ose,"on"+Lse)}Bh(tz,"onAnimationEnd");Bh(rz,"onAnimationIteration");Bh(nz,"onAnimationStart");Bh("dblclick","onDoubleClick");Bh("focusin","onFocus");Bh("focusout","onBlur");Bh(sz,"onTransitionEnd");Jg("onMouseEnter",["mouseout","mouseover"]);Jg("onMouseLeave",["mouseout","mouseover"]);Jg("onPointerEnter",["pointerout","pointerover"]);Jg("onPointerLeave",["pointerout","pointerover"]);Wm("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Wm("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Wm("onBeforeInput",["compositionend","keypress","textInput","paste"]);Wm("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Wm("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Wm("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var My="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(" "),Ise=new Set("cancel close invalid load scroll toggle".split(" ").concat(My));function JI(e,t,n){var s=e.type||"unknown-event";e.currentTarget=n,One(s,t,void 0,e),e.currentTarget=null}function iz(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],a=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var o=s.length-1;0<=o;o--){var l=s[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&a.isPropagationStopped())break e;JI(a,l,d),i=c}else for(o=0;o<s.length;o++){if(l=s[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&a.isPropagationStopped())break e;JI(a,l,d),i=c}}}if(gN)throw e=ZC,gN=!1,ZC=null,e}function as(e,t){var n=t[oA];n===void 0&&(n=t[oA]=new Set);var s=e+"__bubble";n.has(s)||(oz(t,e,2,!1),n.add(s))}function P4(e,t,n){var s=0;t&&(s|=4),oz(n,e,s,t)}var Bw="_reactListening"+Math.random().toString(36).slice(2);function A0(e){if(!e[Bw]){e[Bw]=!0,mU.forEach(function(n){n!=="selectionchange"&&(Ise.has(n)||P4(n,!1,e),P4(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Bw]||(t[Bw]=!0,P4("selectionchange",!1,t))}}function oz(e,t,n,s){switch(VU(t)){case 1:var a=Yne;break;case 4:a=Kne;break;default:a=VE}n=a.bind(null,t,n,e),a=void 0,!XC||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),s?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function E4(e,t,n,s,a){var i=s;
vendor: 4,086 bytes, line 37
37if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var l=s.stateNode.containerInfo;if(l===a||l.nodeType===8&&l.parentNode===a)break;if(o===4)for(o=s.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;o=o.return}for(;l!==null;){if(o=Wf(l),o===null)return;if(c=o.tag,c===5||c===6){s=i=o;continue e}l=l.parentNode}}s=s.return}EU(function(){var d=i,u=BE(n),h=[];e:{var f=az.get(e);if(f!==void 0){var m=HE,x=e;switch(e){case"keypress":if(q1(n)===0)break e;case"keydown":case"keyup":m=dse;break;case"focusin":x="focus",m=N4;break;case"focusout":x="blur",m=N4;break;case"beforeblur":case"afterblur":m=N4;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=BI;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=Jne;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=fse;break;case tz:case rz:case nz:m=tse;break;case sz:m=pse;break;case"scroll":m=Xne;break;case"wheel":m=xse;break;case"copy":case"cut":case"paste":m=nse;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=zI}var p=(t&4)!==0,v=!p&&e==="scroll",g=p?f!==null?f+"Capture":null:f;p=[];for(var y=d,b;y!==null;){b=y;var w=b.stateNode;if(b.tag===5&&w!==null&&(b=w,g!==null&&(w=w0(y,g),w!=null&&p.push(P0(y,w,b)))),v)break;y=y.return}0<p.length&&(f=new m(f,x,null,n,u),h.push({event:f,listeners:p}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==YC&&(x=n.relatedTarget||n.fromElement)&&(Wf(x)||x[Xd]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(x=n.relatedTarget||n.toElement,m=d,x=x?Wf(x):null,x!==null&&(v=Hm(x),x!==v||x.tag!==5&&x.tag!==6)&&(x=null)):(m=null,x=d),m!==x)){if(p=BI,w="onMouseLeave",g="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(p=zI,w="onPointerLeave",g="onPointerEnter",y="pointer"),v=m==null?f:og(m),b=x==null?f:og(x),f=new p(w,y+"leave",m,n,u),f.target=v,f.relatedTarget=b,w=null,Wf(u)===d&&(p=new p(g,y+"enter",x,n,u),p.target=b,p.relatedTarget=v,w=p),v=w,m&&x)t:{for(p=m,g=x,y=0,b=p;b;b=Ep(b))y++;for(b=0,w=g;w;w=Ep(w))b++;for(;0<y-b;)p=Ep(p),y--;for(;0<b-y;)g=Ep(g),b--;for(;y--;){if(p===g||g!==null&&p===g.alternate)break t;p=Ep(p),g=Ep(g)}p=null}else p=null;m!==null&&QI(h,f,m,p,!1),x!==null&&v!==null&&QI(h,v,x,p,!0)}}e:{if(f=d?og(d):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var _=_se;else if(WI(f))if(XU)_=Ase;else{_=kse;var C=Sse}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(_=Cse);if(_&&(_=_(e,d))){KU(h,_,n,u);break e}C&&C(e,f,d),e==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&qC(f,"number",f.value)}switch(C=d?og(d):window,e){case"focusin":(WI(C)||C.contentEditable==="true")&&(ag=C,tA=d,Xy=null);break;case"focusout":Xy=tA=ag=null;break;case"mousedown":rA=!0;break;case"contextmenu":case"mouseup":case"dragend":rA=!1,XI(h,n,u);break;case"selectionchange":if(Tse)break;case"keydown":case"keyup":XI(h,n,u)}var E;if(YE)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else sg?GU(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(HU&&n.locale!=="ko"&&(sg||N!=="onCompositionStart"?N==="onCompositionEnd"&&sg&&(E=WU()):(nh=u,WE="value"in nh?nh.value:nh.textContent,sg=!0)),C=jN(d,N),0<C.length&&(N=new UI(N,e,null,n,u),h.push({event:N,listeners:C}),E?N.data=E:(E=YU(n),E!==null&&(N.data=E)))),(E=yse?bse(e,n):jse(e,n))&&(d=jN(d,"onBeforeInput"),0<d.length&&(u=new UI("onBeforeInput","beforeinput",null,n,u),h.push({event:u,listeners:d}),u.data=E))}iz(h,t)})}
vendor: 4,274 bytes, lines 37-38
37function P0(e,t,n){return{instance:e,listener:t,currentTarget:n}}function jN(e,t){for(var n=t+"Capture",s=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=w0(e,n),i!=null&&s.unshift(P0(e,i,a)),i=w0(e,t),i!=null&&s.push(P0(e,i,a))),e=e.return}return s}function Ep(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function QI(e,t,n,s,a){for(var i=t._reactName,o=[];n!==null&&n!==s;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===s)break;l.tag===5&&d!==null&&(l=d,a?(c=w0(n,i),c!=null&&o.unshift(P0(n,c,l))):a||(c=w0(n,i),c!=null&&o.push(P0(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Rse=/\r\n?/g,Mse=/\u0000|\uFFFD/g;function eR(e){return(typeof e=="string"?e:""+e).replace(Rse,` 38`).replace(Mse,"")}function Uw(e,t,n){if(t=eR(t),eR(e)!==t&&n)throw Error(ft(425))}function wN(){}var nA=null,sA=null;function aA(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var iA=typeof setTimeout=="function"?setTimeout:void 0,Dse=typeof clearTimeout=="function"?clearTimeout:void 0,tR=typeof Promise=="function"?Promise:void 0,$se=typeof queueMicrotask=="function"?queueMicrotask:typeof tR<"u"?function(e){return tR.resolve(null).then(e).catch(Fse)}:iA;function Fse(e){setTimeout(function(){throw e})}function T4(e,t){var n=t,s=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(s===0){e.removeChild(a),S0(t);return}s--}else n!=="$"&&n!=="$?"&&n!=="$!"||s++;n=a}while(n);S0(t)}function mh(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function rR(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Jx=Math.random().toString(36).slice(2),Lc="__reactFiber$"+Jx,E0="__reactProps$"+Jx,Xd="__reactContainer$"+Jx,oA="__reactEvents$"+Jx,Bse="__reactListeners$"+Jx,Use="__reactHandles$"+Jx;function Wf(e){var t=e[Lc];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Xd]||n[Lc]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=rR(e);e!==null;){if(n=e[Lc])return n;e=rR(e)}return t}e=n,n=e.parentNode}return null}function Xb(e){return e=e[Lc]||e[Xd],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function og(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ft(33))}function E2(e){return e[E0]||null}var lA=[],lg=-1;function Uh(e){return{current:e}}function cs(e){0>lg||(e.current=lA[lg],lA[lg]=null,lg--)}function Zn(e,t){lg++,lA[lg]=e.current,e.current=t}var Ph={},di=Uh(Ph),Qi=Uh(!1),ym=Ph;function Qg(e,t){var n=e.type.contextTypes;if(!n)return Ph;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function eo(e){return e=e.childContextTypes,e!=null}function NN(){cs(Qi),cs(di)}function nR(e,t,n){if(di.current!==Ph)throw Error(ft(168));Zn(di,t),Zn(Qi,n)}function lz(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var a in s)if(!(a in t))throw Error(ft(108,Sne(e)||"Unknown",a));return Ss({},n,s)}function _N(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ph,ym=di.current,Zn(di,e),Zn(Qi,Qi.current),!0}function sR(e,t,n){var s=e.stateNode;if(!s)throw Error(ft(169));n?(e=lz(e,t,ym),s.__reactInternalMemoizedMergedChildContext=e,cs(Qi),cs(di),Zn(di,e)):cs(Qi),Zn(Qi,n)}var Td=null,T2=!1,O4=!1;function cz(e){Td===null?Td=[e]:Td.push(e)}function zse(e){T2=!0,cz(e)}function zh(){if(!O4&&Td!==null){O4=!0;var e=0,t=Ln;try{var n=Td;for(Ln=1;e<n.length;e++){var s=n[e];do s=s(!0);while(s!==null)}Td=null,T2=!1}catch(a){throw Td!==null&&(Td=Td.slice(e+1)),IU(UE,zh),a}finally{Ln=t,O4=!1}}return null}var cg=[],dg=0,SN=null,kN=0,rl=[],nl=0,bm=null,$d=1,Fd="";function Tf(e,t){cg[dg++]=kN,cg[dg++]=SN,SN=e,kN=t}
vendor: 25,872 bytes, lines 38-40
38function dz(e,t,n){rl[nl++]=$d,rl[nl++]=Fd,rl[nl++]=bm,bm=e;var s=$d;e=Fd;var a=32-Yl(s)-1;s&=~(1<<a),n+=1;var i=32-Yl(t)+a;if(30<i){var o=a-a%5;i=(s&(1<<o)-1).toString(32),s>>=o,a-=o,$d=1<<32-Yl(t)+a|n<<a|s,Fd=i+e}else $d=1<<i|n<<a|s,Fd=e}function XE(e){e.return!==null&&(Tf(e,1),dz(e,1,0))}function ZE(e){for(;e===SN;)SN=cg[--dg],cg[dg]=null,kN=cg[--dg],cg[dg]=null;for(;e===bm;)bm=rl[--nl],rl[nl]=null,Fd=rl[--nl],rl[nl]=null,$d=rl[--nl],rl[nl]=null}var To=null,Ao=null,ps=!1,zl=null;function uz(e,t){var n=ol(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function aR(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,To=e,Ao=mh(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,To=e,Ao=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=bm!==null?{id:$d,overflow:Fd}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ol(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,To=e,Ao=null,!0):!1;default:return!1}}function cA(e){return(e.mode&1)!==0&&(e.flags&128)===0}function dA(e){if(ps){var t=Ao;if(t){var n=t;if(!aR(e,t)){if(cA(e))throw Error(ft(418));t=mh(n.nextSibling);var s=To;t&&aR(e,t)?uz(s,n):(e.flags=e.flags&-4097|2,ps=!1,To=e)}}else{if(cA(e))throw Error(ft(418));e.flags=e.flags&-4097|2,ps=!1,To=e}}}function iR(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;To=e}function zw(e){if(e!==To)return!1;if(!ps)return iR(e),ps=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!aA(e.type,e.memoizedProps)),t&&(t=Ao)){if(cA(e))throw hz(),Error(ft(418));for(;t;)uz(e,t),t=mh(t.nextSibling)}if(iR(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ft(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ao=mh(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ao=null}}else Ao=To?mh(e.stateNode.nextSibling):null;return!0}function hz(){for(var e=Ao;e;)e=mh(e.nextSibling)}function ex(){Ao=To=null,ps=!1}function JE(e){zl===null?zl=[e]:zl.push(e)}var qse=iu.ReactCurrentBatchConfig;function ay(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ft(309));var s=n.stateNode}if(!s)throw Error(ft(147,e));var a=s,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(o){var l=a.refs;o===null?delete l[i]:l[i]=o},t._stringRef=i,t)}if(typeof e!="string")throw Error(ft(284));if(!n._owner)throw Error(ft(290,e))}return e}function qw(e,t){throw e=Object.prototype.toString.call(t),Error(ft(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function oR(e){var t=e._init;return t(e._payload)}function fz(e){function t(g,y){if(e){var b=g.deletions;b===null?(g.deletions=[y],g.flags|=16):b.push(y)}}function n(g,y){if(!e)return null;for(;y!==null;)t(g,y),y=y.sibling;return null}function s(g,y){for(g=new Map;y!==null;)y.key!==null?g.set(y.key,y):g.set(y.index,y),y=y.sibling;return g}function a(g,y){return g=vh(g,y),g.index=0,g.sibling=null,g}function i(g,y,b){return g.index=b,e?(b=g.alternate,b!==null?(b=b.index,b<y?(g.flags|=2,y):b):(g.flags|=2,y)):(g.flags|=1048576,y)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,y,b,w){return y===null||y.tag!==6?(y=F4(b,g.mode,w),y.return=g,y):(y=a(y,b),y.return=g,y)}function c(g,y,b,w){var _=b.type;return _===ng?u(g,y,b.props.children,w,b.key):y!==null&&(y.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Fu&&oR(_)===y.type)?(w=a(y,b.props),w.ref=ay(g,y,b),w.return=g,w):(w=X1(b.type,b.key,b.props,null,g.mode,w),w.ref=ay(g,y,b),w.return=g,w)}function d(g,y,b,w){return y===null||y.tag!==4||y.stateNode.containerInfo!==b.containerInfo||y.stateNode.implementation!==b.implementation?(y=B4(b,g.mode,w),y.return=g,y):(y=a(y,b.children||[]),y.return=g,y)}function u(g,y,b,w,_){return y===null||y.tag!==7?(y=hm(b,g.mode,w,_),y.return=g,y):(y=a(y,b),y.return=g,y)}function h(g,y,b){if(typeof y=="string"&&y!==""||typeof y=="number")return y=F4(""+y,g.mode,b),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ow:return b=X1(y.type,y.key,y.props,null,g.mode,b),b.ref=ay(g,null,y),b.return=g,b;case rg:return y=B4(y,g.mode,b),y.return=g,y;case Fu:var w=y._init;return h(g,w(y._payload),b)}if(Iy(y)||ey(y))return y=hm(y,g.mode,b,null),y.return=g,y;qw(g,y)}return null}function f(g,y,b,w){var _=y!==null?y.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return _!==null?null:l(g,y,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ow:return b.key===_?c(g,y,b,w):null;case rg:return b.key===_?d(g,y,b,w):null;case Fu:return _=b._init,f(g,y,_(b._payload),w)}if(Iy(b)||ey(b))return _!==null?null:u(g,y,b,w,null);qw(g,b)}return null}function m(g,y,b,w,_){if(typeof w=="string"&&w!==""||typeof w=="number")return g=g.get(b)||null,l(y,g,""+w,_);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ow:return g=g.get(w.key===null?b:w.key)||null,c(y,g,w,_);case rg:return g=g.get(w.key===null?b:w.key)||null,d(y,g,w,_);case Fu:var C=w._init;return m(g,y,b,C(w._payload),_)}if(Iy(w)||ey(w))return g=g.get(b)||null,u(y,g,w,_,null);qw(y,w)}return null}function x(g,y,b,w){for(var _=null,C=null,E=y,N=y=0,k=null;E!==null&&N<b.length;N++){E.index>N?(k=E,E=null):k=E.sibling;var I=f(g,E,b[N],w);if(I===null){E===null&&(E=k);break}e&&E&&I.alternate===null&&t(g,E),y=i(I,y,N),C===null?_=I:C.sibling=I,C=I,E=k}if(N===b.length)return n(g,E),ps&&Tf(g,N),_;if(E===null){for(;N<b.length;N++)E=h(g,b[N],w),E!==null&&(y=i(E,y,N),C===null?_=E:C.sibling=E,C=E);return ps&&Tf(g,N),_}for(E=s(g,E);N<b.length;N++)k=m(E,g,N,b[N],w),k!==null&&(e&&k.alternate!==null&&E.delete(k.key===null?N:k.key),y=i(k,y,N),C===null?_=k:C.sibling=k,C=k);return e&&E.forEach(function(P){return t(g,P)}),ps&&Tf(g,N),_}function p(g,y,b,w){var _=ey(b);if(typeof _!="function")throw Error(ft(150));if(b=_.call(b),b==null)throw Error(ft(151));for(var C=_=null,E=y,N=y=0,k=null,I=b.next();E!==null&&!I.done;N++,I=b.next()){E.index>N?(k=E,E=null):k=E.sibling;var P=f(g,E,I.value,w);if(P===null){E===null&&(E=k);break}e&&E&&P.alternate===null&&t(g,E),y=i(P,y,N),C===null?_=P:C.sibling=P,C=P,E=k}if(I.done)return n(g,E),ps&&Tf(g,N),_;if(E===null){for(;!I.done;N++,I=b.next())I=h(g,I.value,w),I!==null&&(y=i(I,y,N),C===null?_=I:C.sibling=I,C=I);return ps&&Tf(g,N),_}for(E=s(g,E);!I.done;N++,I=b.next())I=m(E,g,N,I.value,w),I!==null&&(e&&I.alternate!==null&&E.delete(I.key===null?N:I.key),y=i(I,y,N),C===null?_=I:C.sibling=I,C=I);return e&&E.forEach(function(O){return t(g,O)}),ps&&Tf(g,N),_}function v(g,y,b,w){if(typeof b=="object"&&b!==null&&b.type===ng&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Ow:e:{for(var _=b.key,C=y;C!==null;){if(C.key===_){if(_=b.type,_===ng){if(C.tag===7){n(g,C.sibling),y=a(C,b.props.children),y.return=g,g=y;break e}}else if(C.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Fu&&oR(_)===C.type){n(g,C.sibling),y=a(C,b.props),y.ref=ay(g,C,b),y.return=g,g=y;break e}n(g,C);break}else t(g,C);C=C.sibling}b.type===ng?(y=hm(b.props.children,g.mode,w,b.key),y.return=g,g=y):(w=X1(b.type,b.key,b.props,null,g.mode,w),w.ref=ay(g,y,b),w.return=g,g=w)}return o(g);case rg:e:{for(C=b.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===b.containerInfo&&y.stateNode.implementation===b.implementation){n(g,y.sibling),y=a(y,b.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else t(g,y);y=y.sibling}y=B4(b,g.mode,w),y.return=g,g=y}return o(g);case Fu:return C=b._init,v(g,y,C(b._payload),w)}if(Iy(b))return x(g,y,b,w);if(ey(b))return p(g,y,b,w);qw(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,y!==null&&y.tag===6?(n(g,y.sibling),y=a(y,b),y.return=g,g=y):(n(g,y),y=F4(b,g.mode,w),y.return=g,g=y),o(g)):n(g,y)}return v}var tx=fz(!0),mz=fz(!1),CN=Uh(null),AN=null,ug=null,QE=null;function eT(){QE=ug=AN=null}function tT(e){var t=CN.current;cs(CN),e._currentValue=t}function uA(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function _g(e,t){AN=e,QE=ug=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Xi=!0),e.firstContext=null)}function fl(e){var t=e._currentValue;if(QE!==e)if(e={context:e,memoizedValue:t,next:null},ug===null){if(AN===null)throw Error(ft(308));ug=e,AN.dependencies={lanes:0,firstContext:e}}else ug=ug.next=e;return t}var Hf=null;function rT(e){Hf===null?Hf=[e]:Hf.push(e)}function pz(e,t,n,s){var a=t.interleaved;return a===null?(n.next=n,rT(t)):(n.next=a.next,a.next=n),t.interleaved=n,Zd(e,s)}function Zd(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Bu=!1;function nT(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gz(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function qd(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ph(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,un&2){var a=s.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t,Zd(e,n)}return a=s.interleaved,a===null?(t.next=t,rT(s)):(t.next=a.next,a.next=t),s.interleaved=t,Zd(e,n)}function V1(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zE(e,n)}}function lR(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:s.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function PN(e,t,n,s){var a=e.updateQueue;Bu=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?i=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(i!==null){var h=a.baseState;o=0,u=d=c=null,l=i;do{var f=l.lane,m=l.eventTime;if((s&f)===f){u!==null&&(u=u.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,p=l;switch(f=t,m=n,p.tag){case 1:if(x=p.payload,typeof x=="function"){h=x.call(m,h,f);break e}h=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=p.payload,f=typeof x=="function"?x.call(m,h,f):x,f==null)break e;h=Ss({},h,f);break e;case 2:Bu=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=a.effects,f===null?a.effects=[l]:f.push(l))}else m={eventTime:m,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=m,c=h):u=u.next=m,o|=f;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;f=l,l=f.next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}while(!0);if(u===null&&(c=h),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=u,t=a.shared.interleaved,t!==null){a=t;do o|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);wm|=o,e.lanes=o,e.memoizedState=h}}function cR(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],a=s.callback;if(a!==null){if(s.callback=null,s=n,typeof a!="function")throw Error(ft(191,a));a.call(s)}}}var Zb={},zc=Uh(Zb),T0=Uh(Zb),O0=Uh(Zb);function Gf(e){if(e===Zb)throw Error(ft(174));return e}function sT(e,t){switch(Zn(O0,t),Zn(T0,e),Zn(zc,Zb),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:WC(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=WC(t,e)}cs(zc),Zn(zc,t)}function rx(){cs(zc),cs(T0),cs(O0)}function xz(e){Gf(O0.current);var t=Gf(zc.current),n=WC(t,e.type);t!==n&&(Zn(T0,e),Zn(zc,n))}function aT(e){T0.current===e&&(cs(zc),cs(T0))}var ws=Uh(0);function EN(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var L4=[];function iT(){for(var e=0;e<L4.length;e++)L4[e]._workInProgressVersionPrimary=null;L4.length=0}var W1=iu.ReactCurrentDispatcher,I4=iu.ReactCurrentBatchConfig,jm=0,_s=null,fa=null,_a=null,TN=!1,Zy=!1,L0=0,Vse=0;function Ka(){throw Error(ft(321))}function oT(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ql(e[n],t[n]))return!1;return!0}function lT(e,t,n,s,a,i){if(jm=i,_s=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,W1.current=e===null||e.memoizedState===null?Yse:Kse,e=n(s,a),Zy){i=0;do{if(Zy=!1,L0=0,25<=i)throw Error(ft(301));i+=1,_a=fa=null,t.updateQueue=null,W1.current=Xse,e=n(s,a)}while(Zy)}if(W1.current=ON,t=fa!==null&&fa.next!==null,jm=0,_a=fa=_s=null,TN=!1,t)throw Error(ft(300));return e}function cT(){var e=L0!==0;return L0=0,e}function Ac(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _a===null?_s.memoizedState=_a=e:_a=_a.next=e,_a}function ml(){if(fa===null){var e=_s.alternate;e=e!==null?e.memoizedState:null}else e=fa.next;var t=_a===null?_s.memoizedState:_a.next;if(t!==null)_a=t,fa=e;else{if(e===null)throw Error(ft(310));fa=e,e={memoizedState:fa.memoizedState,baseState:fa.baseState,baseQueue:fa.baseQueue,queue:fa.queue,next:null},_a===null?_s.memoizedState=_a=e:_a=_a.next=e}return _a}function I0(e,t){return typeof t=="function"?t(e):t}function R4(e){var t=ml(),n=t.queue;if(n===null)throw Error(ft(311));n.lastRenderedReducer=e;var s=fa,a=s.baseQueue,i=n.pending;if(i!==null){if(a!==null){var o=a.next;a.next=i.next,i.next=o}s.baseQueue=a=i,n.pending=null}if(a!==null){i=a.next,s=s.baseState;var l=o=null,c=null,d=i;do{var u=d.lane;if((jm&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),s=d.hasEagerState?d.eagerState:e(s,d.action);else{var h={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=h,o=s):c=c.next=h,_s.lanes|=u,wm|=u}d=d.next}while(d!==null&&d!==i);c===null?o=s:c.next=l,Ql(s,t.memoizedState)||(Xi=!0),t.memoizedState=s,t.baseState=o,t.baseQueue=c,n.lastRenderedState=s}if(e=n.interleaved,e!==null){a=e;do i=a.lane,_s.lanes|=i,wm|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function M4(e){var t=ml(),n=t.queue;if(n===null)throw Error(ft(311));n.lastRenderedReducer=e;var s=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var o=a=a.next;do i=e(i,o.action),o=o.next;while(o!==a);Ql(i,t.memoizedState)||(Xi=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function vz(){}function yz(e,t){var n=_s,s=ml(),a=t(),i=!Ql(s.memoizedState,a);if(i&&(s.memoizedState=a,Xi=!0),s=s.queue,dT(wz.bind(null,n,s,e),[e]),s.getSnapshot!==t||i||_a!==null&&_a.memoizedState.tag&1){if(n.flags|=2048,R0(9,jz.bind(null,n,s,a,t),void 0,null),Aa===null)throw Error(ft(349));jm&30||bz(n,t,a)}return a}function bz(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=_s.updateQueue,t===null?(t={lastEffect:null,stores:null},_s.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function jz(e,t,n,s){t.value=n,t.getSnapshot=s,Nz(t)&&_z(e)}function wz(e,t,n){return n(function(){Nz(t)&&_z(e)})}function Nz(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ql(e,n)}catch{return!0}}function _z(e){var t=Zd(e,1);t!==null&&Kl(t,e,1,-1)}function dR(e){var t=Ac();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:I0,lastRenderedState:e},t.queue=e,e=e.dispatch=Gse.bind(null,_s,e),[t.memoizedState,e]}function R0(e,t,n,s){return e={tag:e,create:t,destroy:n,deps:s,next:null},t=_s.updateQueue,t===null?(t={lastEffect:null,stores:null},_s.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e)),e}function Sz(){return ml().memoizedState}function H1(e,t,n,s){var a=Ac();_s.flags|=e,a.memoizedState=R0(1|t,n,void 0,s===void 0?null:s)}function O2(e,t,n,s){var a=ml();s=s===void 0?null:s;var i=void 0;if(fa!==null){var o=fa.memoizedState;if(i=o.destroy,s!==null&&oT(s,o.deps)){a.memoizedState=R0(t,n,i,s);return}}_s.flags|=e,a.memoizedState=R0(1|t,n,i,s)}function uR(e,t){return H1(8390656,8,e,t)}function dT(e,t){return O2(2048,8,e,t)}function kz(e,t){return O2(4,2,e,t)}function Cz(e,t){return O2(4,4,e,t)}function Az(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Pz(e,t,n){return n=n!=null?n.concat([e]):null,O2(4,4,Az.bind(null,t,e),n)}function uT(){}function Ez(e,t){var n=ml();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&oT(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Tz(e,t){var n=ml();t=t===void 0?null:t;var s=n.memoizedState;return s!==null&&t!==null&&oT(t,s[1])?s[0]:(e=e(),n.memoizedState=[e,t],e)}function Oz(e,t,n){return jm&21?(Ql(n,t)||(n=DU(),_s.lanes|=n,wm|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Xi=!0),e.memoizedState=n)}function Wse(e,t){var n=Ln;Ln=n!==0&&4>n?n:4,e(!0);var s=I4.transition;I4.transition={};try{e(!1),t()}finally{Ln=n,I4.transition=s}}function Lz(){return ml().memoizedState}function Hse(e,t,n){var s=xh(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},Iz(e))Rz(t,n);else if(n=pz(e,t,n,s),n!==null){var a=Ci();Kl(n,e,s,a),Mz(n,t,s)}}function Gse(e,t,n){var s=xh(e),a={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(Iz(e))Rz(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(a.hasEagerState=!0,a.eagerState=l,Ql(l,o)){var c=t.interleaved;c===null?(a.next=a,rT(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=pz(e,t,a,s),n!==null&&(a=Ci(),Kl(n,e,s,a),Mz(n,t,s))}}function Iz(e){var t=e.alternate;return e===_s||t!==null&&t===_s}function Rz(e,t){Zy=TN=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Mz(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,zE(e,n)}}var ON={readContext:fl,useCallback:Ka,useContext:Ka,useEffect:Ka,useImperativeHandle:Ka,useInsertionEffect:Ka,useLayoutEffect:Ka,useMemo:Ka,useReducer:Ka,useRef:Ka,useState:Ka,useDebugValue:Ka,useDeferredValue:Ka,useTransition:Ka,useMutableSource:Ka,useSyncExternalStore:Ka,useId:Ka,unstable_isNewReconciler:!1},Yse={readContext:fl,useCallback:function(e,t){return Ac().memoizedState=[e,t===void 0?null:t],e},useContext:fl,useEffect:uR,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,H1(4194308,4,Az.bind(null,t,e),n)},useLayoutEffect:function(e,t){return H1(4194308,4,e,t)},useInsertionEffect:function(e,t){return H1(4,2,e,t)},useMemo:function(e,t){var n=Ac();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=Ac();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=Hse.bind(null,_s,e),[s.memoizedState,e]},useRef:function(e){var t=Ac();return e={current:e},t.memoizedState=e},useState:dR,useDebugValue:uT,useDeferredValue:function(e){return Ac().memoizedState=e},useTransition:function(){var e=dR(!1),t=e[0];return e=Wse.bind(null,e[1]),Ac().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=_s,a=Ac();if(ps){if(n===void 0)throw Error(ft(407));n=n()}else{if(n=t(),Aa===null)throw Error(ft(349));jm&30||bz(s,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,uR(wz.bind(null,s,i,e),[e]),s.flags|=2048,R0(9,jz.bind(null,s,i,n,t),void 0,null),n},useId:function(){var e=Ac(),t=Aa.identifierPrefix;if(ps){var n=Fd,s=$d;n=(s&~(1<<32-Yl(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=L0++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Vse++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Kse={readContext:fl,useCallback:Ez,useContext:fl,useEffect:dT,useImperativeHandle:Pz,useInsertionEffect:kz,useLayoutEffect:Cz,useMemo:Tz,useReducer:R4,useRef:Sz,useState:function(){return R4(I0)},useDebugValue:uT,useDeferredValue:function(e){var t=ml();return Oz(t,fa.memoizedState,e)},useTransition:function(){var e=R4(I0)[0],t=ml().memoizedState;return[e,t]},useMutableSource:vz,useSyncExternalStore:yz,useId:Lz,unstable_isNewReconciler:!1},Xse={readContext:fl,useCallback:Ez,useContext:fl,useEffect:dT,useImperativeHandle:Pz,useInsertionEffect:kz,useLayoutEffect:Cz,useMemo:Tz,useReducer:M4,useRef:Sz,useState:function(){return M4(I0)},useDebugValue:uT,useDeferredValue:function(e){var t=ml();return fa===null?t.memoizedState=e:Oz(t,fa.memoizedState,e)},useTransition:function(){var e=M4(I0)[0],t=ml().memoizedState;return[e,t]},useMutableSource:vz,useSyncExternalStore:yz,useId:Lz,unstable_isNewReconciler:!1};function Il(e,t){if(e&&e.defaultProps){t=Ss({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function hA(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Ss({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var L2={isMounted:function(e){return(e=e._reactInternals)?Hm(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Ci(),a=xh(e),i=qd(s,a);i.payload=t,n!=null&&(i.callback=n),t=ph(e,i,a),t!==null&&(Kl(t,e,a,s),V1(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Ci(),a=xh(e),i=qd(s,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ph(e,i,a),t!==null&&(Kl(t,e,a,s),V1(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ci(),s=xh(e),a=qd(n,s);a.tag=2,t!=null&&(a.callback=t),t=ph(e,a,s),t!==null&&(Kl(t,e,s,n),V1(t,e,s))}};function hR(e,t,n,s,a,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,o):t.prototype&&t.prototype.isPureReactComponent?!C0(n,s)||!C0(a,i):!0}function Dz(e,t,n){var s=!1,a=Ph,i=t.contextType;return typeof i=="object"&&i!==null?i=fl(i):(a=eo(t)?ym:di.current,s=t.contextTypes,i=(s=s!=null)?Qg(e,a):Ph),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=L2,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function fR(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&L2.enqueueReplaceState(t,t.state,null)}function fA(e,t,n,s){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},nT(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=fl(i):(i=eo(t)?ym:di.current,a.context=Qg(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(hA(e,t,i,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&L2.enqueueReplaceState(a,a.state,null),PN(e,n,a,s),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function nx(e,t){try{var n="",s=t;do n+=_ne(s),s=s.return;while(s);var a=n}catch(i){a=` 39Error generating stack: `+i.message+` 40`+i.stack}return{value:e,source:t,stack:a,digest:null}}function D4(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function mA(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Zse=typeof WeakMap=="function"?WeakMap:Map;function $z(e,t,n){n=qd(-1,n),n.tag=3,n.payload={element:null};var s=t.value;return n.callback=function(){IN||(IN=!0,_A=s),mA(e,t)},n}function Fz(e,t,n){n=qd(-1,n),n.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var a=t.value;n.payload=function(){return s(a)},n.callback=function(){mA(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){mA(e,t),typeof s!="function"&&(gh===null?gh=new Set([this]):gh.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function mR(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Zse;var a=new Set;s.set(t,a)}else a=s.get(t),a===void 0&&(a=new Set,s.set(t,a));a.has(n)||(a.add(n),e=uae.bind(null,e,t,n),t.then(e,e))}function pR(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function gR(e,t,n,s,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=qd(-1,
vendor: 8,265 bytes, line 40
401),t.tag=2,ph(n,t,1))),n.lanes|=1),e)}var Jse=iu.ReactCurrentOwner,Xi=!1;function ji(e,t,n,s){t.child=e===null?mz(t,null,n,s):tx(t,e.child,n,s)}function xR(e,t,n,s,a){n=n.render;var i=t.ref;return _g(t,a),s=lT(e,t,n,s,i,a),n=cT(),e!==null&&!Xi?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Jd(e,t,a)):(ps&&n&&XE(t),t.flags|=1,ji(e,t,s,a),t.child)}function vR(e,t,n,s,a){if(e===null){var i=n.type;return typeof i=="function"&&!yT(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Bz(e,t,i,s,a)):(e=X1(n.type,null,s,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:C0,n(o,s)&&e.ref===t.ref)return Jd(e,t,a)}return t.flags|=1,e=vh(i,s),e.ref=t.ref,e.return=t,t.child=e}function Bz(e,t,n,s,a){if(e!==null){var i=e.memoizedProps;if(C0(i,s)&&e.ref===t.ref)if(Xi=!1,t.pendingProps=s=i,(e.lanes&a)!==0)e.flags&131072&&(Xi=!0);else return t.lanes=e.lanes,Jd(e,t,a)}return pA(e,t,n,s,a)}function Uz(e,t,n){var s=t.pendingProps,a=s.children,i=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Zn(fg,wo),wo|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Zn(fg,wo),wo|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:n,Zn(fg,wo),wo|=s}else i!==null?(s=i.baseLanes|n,t.memoizedState=null):s=n,Zn(fg,wo),wo|=s;return ji(e,t,a,n),t.child}function zz(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function pA(e,t,n,s,a){var i=eo(n)?ym:di.current;return i=Qg(t,i),_g(t,a),n=lT(e,t,n,s,i,a),s=cT(),e!==null&&!Xi?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Jd(e,t,a)):(ps&&s&&XE(t),t.flags|=1,ji(e,t,n,a),t.child)}function yR(e,t,n,s,a){if(eo(n)){var i=!0;_N(t)}else i=!1;if(_g(t,a),t.stateNode===null)G1(e,t),Dz(t,n,s),fA(t,n,s,a),s=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=fl(d):(d=eo(n)?ym:di.current,d=Qg(t,d));var u=n.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==s||c!==d)&&fR(t,o,s,d),Bu=!1;var f=t.memoizedState;o.state=f,PN(t,s,o,a),c=t.memoizedState,l!==s||f!==c||Qi.current||Bu?(typeof u=="function"&&(hA(t,n,u,s),c=t.memoizedState),(l=Bu||hR(t,n,l,s,f,c,d))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),o.props=s,o.state=c,o.context=d,s=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{o=t.stateNode,gz(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Il(t.type,l),o.props=d,h=t.pendingProps,f=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=fl(c):(c=eo(n)?ym:di.current,c=Qg(t,c));var m=n.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==c)&&fR(t,o,s,c),Bu=!1,f=t.memoizedState,o.state=f,PN(t,s,o,a);var x=t.memoizedState;l!==h||f!==x||Qi.current||Bu?(typeof m=="function"&&(hA(t,n,m,s),x=t.memoizedState),(d=Bu||hR(t,n,d,s,f,x,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(s,x,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(s,x,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=x),o.props=s,o.state=x,o.context=c,s=d):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return gA(e,t,n,s,i,a)}function gA(e,t,n,s,a,i){zz(e,t);var o=(t.flags&128)!==0;if(!s&&!o)return a&&sR(t,n,!1),Jd(e,t,i);s=t.stateNode,Jse.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&o?(t.child=tx(t,e.child,null,i),t.child=tx(t,null,l,i)):ji(e,t,l,i),t.memoizedState=s.state,a&&sR(t,n,!0),t.child}function qz(e){var t=e.stateNode;t.pendingContext?nR(e,t.pendingContext,t.pendingContext!==t.context):t.context&&nR(e,t.context,!1),sT(e,t.containerInfo)}function bR(e,t,n,s,a){return ex(),JE(a),t.flags|=256,ji(e,t,n,s),t.child}var xA={dehydrated:null,treeContext:null,retryLane:0};function vA(e){return{baseLanes:e,cachePool:null,transitions:null}}function Vz(e,t,n){var s=t.pendingProps,a=ws.current,i=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),Zn(ws,a&1),e===null)return dA(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=s.children,e=s.fallback,i?(s=t.mode,i=t.child,o={mode:"hidden",children:o},!(s&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=M2(o,s,0,null),e=hm(e,s,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=vA(n),t.memoizedState=xA,e):hT(t,o));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return Qse(e,t,o,s,l,a,n);if(i){i=s.fallback,o=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:s.children};return!(o&1)&&t.child!==a?(s=t.child,s.childLanes=0,s.pendingProps=c,t.deletions=null):(s=vh(a,c),s.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=vh(l,i):(i=hm(i,o,n,null),i.flags|=2),i.return=t,s.return=t,s.sibling=i,t.child=s,s=i,i=t.child,o=e.child.memoizedState,o=o===null?vA(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=xA,s}return i=e.child,e=i.sibling,s=vh(i,{mode:"visible",children:s.children}),!(t.mode&1)&&(s.lanes=n),s.return=t,s.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=s,t.memoizedState=null,s}function hT(e,t){return t=M2({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Vw(e,t,n,s){return s!==null&&JE(s),tx(t,e.child,null,n),e=hT(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qse(e,t,n,s,a,i,o){if(n)return t.flags&256?(t.flags&=-257,s=D4(Error(ft(422))),Vw(e,t,o,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,a=t.mode,s=M2({mode:"visible",children:s.children},a,0,null),i=hm(i,a,o,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,t.mode&1&&tx(t,e.child,null,o),t.child.memoizedState=vA(o),t.memoizedState=xA,i);if(!(t.mode&1))return Vw(e,t,o,null);if(a.data==="$!"){if(s=a.nextSibling&&a.nextSibling.dataset,s)var l=s.dgst;return s=l,i=Error(ft(419)),s=D4(i,s,void 0),Vw(e,t,o,s)}if(l=(o&e.childLanes)!==0,Xi||l){if(s=Aa,s!==null){switch(o&-o){case 4:a=2;break;case 16:a=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:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(s.suspendedLanes|o)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,Zd(e,a),Kl(s,e,a,-1))}return vT(),s=D4(Error(ft(421))),Vw(e,t,o,s)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=hae.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,Ao=mh(a.nextSibling),To=t,ps=!0,zl=null,e!==null&&(rl[nl++]=$d,rl[nl++]=
vendor: 5,652 bytes, line 40
40Fd,rl[nl++]=bm,$d=e.id,Fd=e.overflow,bm=t),t=hT(t,s.children),t.flags|=4096,t)}function jR(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),uA(e.return,t,n)}function $4(e,t,n,s,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=n,i.tailMode=a)}function Wz(e,t,n){var s=t.pendingProps,a=s.revealOrder,i=s.tail;if(ji(e,t,s.children,n),s=ws.current,s&2)s=s&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jR(e,n,t);else if(e.tag===19)jR(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(Zn(ws,s),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&EN(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),$4(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&EN(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}$4(t,!0,n,null,i);break;case"together":$4(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function G1(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Jd(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),wm|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ft(153));if(t.child!==null){for(e=t.child,n=vh(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=vh(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function eae(e,t,n){switch(t.tag){case 3:qz(t),ex();break;case 5:xz(t);break;case 1:eo(t.type)&&_N(t);break;case 4:sT(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,a=t.memoizedProps.value;Zn(CN,s._currentValue),s._currentValue=a;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(Zn(ws,ws.current&1),t.flags|=128,null):n&t.child.childLanes?Vz(e,t,n):(Zn(ws,ws.current&1),e=Jd(e,t,n),e!==null?e.sibling:null);Zn(ws,ws.current&1);break;case 19:if(s=(n&t.childLanes)!==0,e.flags&128){if(s)return Wz(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Zn(ws,ws.current),s)break;return null;case 22:case 23:return t.lanes=0,Uz(e,t,n)}return Jd(e,t,n)}var Hz,yA,Gz,Yz;Hz=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};yA=function(){};Gz=function(e,t,n,s){var a=e.memoizedProps;if(a!==s){e=t.stateNode,Gf(zc.current);var i=null;switch(n){case"input":a=UC(e,a),s=UC(e,s),i=[];break;case"select":a=Ss({},a,{value:void 0}),s=Ss({},s,{value:void 0}),i=[];break;case"textarea":a=VC(e,a),s=VC(e,s),i=[];break;default:typeof a.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=wN)}HC(n,s);var o;n=null;for(d in a)if(!s.hasOwnProperty(d)&&a.hasOwnProperty(d)&&a[d]!=null)if(d==="style"){var l=a[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(b0.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in s){var c=s[d];if(l=a!=null?a[d]:void 0,s.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(b0.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&as("scroll",e),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};Yz=function(e,t,n,s){n!==s&&(t.flags|=4)};function iy(e,t){if(!ps)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Xa(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,s|=a.subtreeFlags&14680064,s|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,s|=a.subtreeFlags,s|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function tae(e,t,n){var s=t.pendingProps;switch(ZE(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xa(t),null;case 1:return eo(t.type)&&NN(),Xa(t),null;case 3:return s=t.stateNode,rx(),cs(Qi),cs(di),iT(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(zw(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,zl!==null&&(CA(zl),zl=null))),yA(e,t),Xa(t),null;case 5:aT(t);var a=Gf(O0.current);if(n=t.type,e!==null&&t.stateNode!=null)Gz(e,t,n,s,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);
vendor: 31,218 bytes, line 40
40else{if(!s){if(t.stateNode===null)throw Error(ft(166));return Xa(t),null}if(e=Gf(zc.current),zw(t)){s=t.stateNode,n=t.type;var i=t.memoizedProps;switch(s[Lc]=t,s[E0]=i,e=(t.mode&1)!==0,n){case"dialog":as("cancel",s),as("close",s);break;case"iframe":case"object":case"embed":as("load",s);break;case"video":case"audio":for(a=0;a<My.length;a++)as(My[a],s);break;case"source":as("error",s);break;case"img":case"image":case"link":as("error",s),as("load",s);break;case"details":as("toggle",s);break;case"input":EI(s,i),as("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},as("invalid",s);break;case"textarea":OI(s,i),as("invalid",s)}HC(n,i),a=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?s.textContent!==l&&(i.suppressHydrationWarning!==!0&&Uw(s.textContent,l,e),a=["children",l]):typeof l=="number"&&s.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Uw(s.textContent,l,e),a=["children",""+l]):b0.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&as("scroll",s)}switch(n){case"input":Lw(s),TI(s,i,!0);break;case"textarea":Lw(s),LI(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=wN)}s=a,t.updateQueue=s,s!==null&&(t.flags|=4)}else{o=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=wU(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=o.createElement(n,{is:s.is}):(e=o.createElement(n),n==="select"&&(o=e,s.multiple?o.multiple=!0:s.size&&(o.size=s.size))):e=o.createElementNS(e,n),e[Lc]=t,e[E0]=s,Hz(e,t,!1,!1),t.stateNode=e;e:{switch(o=GC(n,s),n){case"dialog":as("cancel",e),as("close",e),a=s;break;case"iframe":case"object":case"embed":as("load",e),a=s;break;case"video":case"audio":for(a=0;a<My.length;a++)as(My[a],e);a=s;break;case"source":as("error",e),a=s;break;case"img":case"image":case"link":as("error",e),as("load",e),a=s;break;case"details":as("toggle",e),a=s;break;case"input":EI(e,s),a=UC(e,s),as("invalid",e);break;case"option":a=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},a=Ss({},s,{value:void 0}),as("invalid",e);break;case"textarea":OI(e,s),a=VC(e,s),as("invalid",e);break;default:a=s}HC(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?SU(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&NU(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&j0(e,c):typeof c=="number"&&j0(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(b0.hasOwnProperty(i)?c!=null&&i==="onScroll"&&as("scroll",e):c!=null&&ME(e,i,c,o))}switch(n){case"input":Lw(e),TI(e,s,!1);break;case"textarea":Lw(e),LI(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Ah(s.value));break;case"select":e.multiple=!!s.multiple,i=s.value,i!=null?bg(e,!!s.multiple,i,!1):s.defaultValue!=null&&bg(e,!!s.multiple,s.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=wN)}switch(n){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Xa(t),null;case 6:if(e&&t.stateNode!=null)Yz(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(ft(166));if(n=Gf(O0.current),Gf(zc.current),zw(t)){if(s=t.stateNode,n=t.memoizedProps,s[Lc]=t,(i=s.nodeValue!==n)&&(e=To,e!==null))switch(e.tag){case 3:Uw(s.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Uw(s.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else s=(n.nodeType===9?n:n.ownerDocument).createTextNode(s),s[Lc]=t,t.stateNode=s}return Xa(t),null;case 13:if(cs(ws),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ps&&Ao!==null&&t.mode&1&&!(t.flags&128))hz(),ex(),t.flags|=98560,i=!1;else if(i=zw(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(ft(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ft(317));i[Lc]=t}else ex(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Xa(t),i=!1}else zl!==null&&(CA(zl),zl=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,t.mode&1&&(e===null||ws.current&1?ga===0&&(ga=3):vT())),t.updateQueue!==null&&(t.flags|=4),Xa(t),null);case 4:return rx(),yA(e,t),e===null&&A0(t.stateNode.containerInfo),Xa(t),null;case 10:return tT(t.type._context),Xa(t),null;case 17:return eo(t.type)&&NN(),Xa(t),null;case 19:if(cs(ws),i=t.memoizedState,i===null)return Xa(t),null;if(s=(t.flags&128)!==0,o=i.rendering,o===null)if(s)iy(i,!1);else{if(ga!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=EN(e),o!==null){for(t.flags|=128,iy(i,!1),s=o.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=n,n=t.child;n!==null;)i=n,e=s,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,e=o.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Zn(ws,ws.current&1|2),t.child}e=e.sibling}i.tail!==null&&Bs()>sx&&(t.flags|=128,s=!0,iy(i,!1),t.lanes=4194304)}else{if(!s)if(e=EN(o),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),iy(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ps)return Xa(t),null}else 2*Bs()-i.renderingStartTime>sx&&n!==1073741824&&(t.flags|=128,s=!0,iy(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Bs(),t.sibling=null,n=ws.current,Zn(ws,s?n&1|2:n&1),t):(Xa(t),null);case 22:case 23:return xT(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?wo&1073741824&&(Xa(t),t.subtreeFlags&6&&(t.flags|=8192)):Xa(t),null;case 24:return null;case 25:return null}throw Error(ft(156,t.tag))}function rae(e,t){switch(ZE(t),t.tag){case 1:return eo(t.type)&&NN(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return rx(),cs(Qi),cs(di),iT(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return aT(t),null;case 13:if(cs(ws),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ft(340));ex()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return cs(ws),null;case 4:return rx(),null;case 10:return tT(t.type._context),null;case 22:case 23:return xT(),null;case 24:return null;default:return null}}var Ww=!1,si=!1,nae=typeof WeakSet=="function"?WeakSet:Set,$t=null;function hg(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Ls(e,t,s)}else n.current=null}function bA(e,t,n){try{n()}catch(s){Ls(e,t,s)}}var wR=!1;function sae(e,t){if(nA=yN,e=QU(),KE(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var a=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,u=0,h=e,f=null;t:for(;;){for(var m;h!==n||a!==0&&h.nodeType!==3||(l=o+a),h!==i||s!==0&&h.nodeType!==3||(c=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===e)break t;if(f===n&&++d===a&&(l=o),f===i&&++u===s&&(c=o),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(sA={focusedElem:e,selectionRange:n},yN=!1,$t=t;$t!==null;)if(t=$t,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,$t=e;else for(;$t!==null;){t=$t;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var p=x.memoizedProps,v=x.memoizedState,g=t.stateNode,y=g.getSnapshotBeforeUpdate(t.elementType===t.type?p:Il(t.type,p),v);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ft(163))}}catch(w){Ls(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,$t=e;break}$t=t.return}return x=wR,wR=!1,x}function Jy(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&bA(t,n,i)}a=a.next}while(a!==s)}}function I2(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function jA(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Kz(e){var t=e.alternate;t!==null&&(e.alternate=null,Kz(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Lc],delete t[E0],delete t[oA],delete t[Bse],delete t[Use])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Xz(e){return e.tag===5||e.tag===3||e.tag===4}function NR(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xz(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wA(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=wN));else if(s!==4&&(e=e.child,e!==null))for(wA(e,t,n),e=e.sibling;e!==null;)wA(e,t,n),e=e.sibling}function NA(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(NA(e,t,n),e=e.sibling;e!==null;)NA(e,t,n),e=e.sibling}var Da=null,Dl=!1;function Pu(e,t,n){for(n=n.child;n!==null;)Zz(e,t,n),n=n.sibling}function Zz(e,t,n){if(Uc&&typeof Uc.onCommitFiberUnmount=="function")try{Uc.onCommitFiberUnmount(k2,n)}catch{}switch(n.tag){case 5:si||hg(n,t);case 6:var s=Da,a=Dl;Da=null,Pu(e,t,n),Da=s,Dl=a,Da!==null&&(Dl?(e=Da,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Da.removeChild(n.stateNode));break;case 18:Da!==null&&(Dl?(e=Da,n=n.stateNode,e.nodeType===8?T4(e.parentNode,n):e.nodeType===1&&T4(e,n),S0(e)):T4(Da,n.stateNode));break;case 4:s=Da,a=Dl,Da=n.stateNode.containerInfo,Dl=!0,Pu(e,t,n),Da=s,Dl=a;break;case 0:case 11:case 14:case 15:if(!si&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){a=s=s.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&bA(n,t,o),a=a.next}while(a!==s)}Pu(e,t,n);break;case 1:if(!si&&(hg(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(l){Ls(n,t,l)}Pu(e,t,n);break;case 21:Pu(e,t,n);break;case 22:n.mode&1?(si=(s=si)||n.memoizedState!==null,Pu(e,t,n),si=s):Pu(e,t,n);break;default:Pu(e,t,n)}}function _R(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new nae),t.forEach(function(s){var a=fae.bind(null,e,s);n.has(s)||(n.add(s),s.then(a,a))})}}function Al(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var a=n[s];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Da=l.stateNode,Dl=!1;break e;case 3:Da=l.stateNode.containerInfo,Dl=!0;break e;case 4:Da=l.stateNode.containerInfo,Dl=!0;break e}l=l.return}if(Da===null)throw Error(ft(160));Zz(i,o,a),Da=null,Dl=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(d){Ls(a,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Jz(t,e),t=t.sibling}function Jz(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Al(t,e),_c(e),s&4){try{Jy(3,e,e.return),I2(3,e)}catch(p){Ls(e,e.return,p)}try{Jy(5,e,e.return)}catch(p){Ls(e,e.return,p)}}break;case 1:Al(t,e),_c(e),s&512&&n!==null&&hg(n,n.return);break;case 5:if(Al(t,e),_c(e),s&512&&n!==null&&hg(n,n.return),e.flags&32){var a=e.stateNode;try{j0(a,"")}catch(p){Ls(e,e.return,p)}}if(s&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,o=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&bU(a,i),GC(l,o);var d=GC(l,i);for(o=0;o<c.length;o+=2){var u=c[o],h=c[o+1];u==="style"?SU(a,h):u==="dangerouslySetInnerHTML"?NU(a,h):u==="children"?j0(a,h):ME(a,u,h,d)}switch(l){case"input":zC(a,i);break;case"textarea":jU(a,i);break;case"select":var f=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?bg(a,!!i.multiple,m,!1):f!==!!i.multiple&&(i.defaultValue!=null?bg(a,!!i.multiple,i.defaultValue,!0):bg(a,!!i.multiple,i.multiple?[]:"",!1))}a[E0]=i}catch(p){Ls(e,e.return,p)}}break;case 6:if(Al(t,e),_c(e),s&4){if(e.stateNode===null)throw Error(ft(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(p){Ls(e,e.return,p)}}break;case 3:if(Al(t,e),_c(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{S0(t.containerInfo)}catch(p){Ls(e,e.return,p)}break;case 4:Al(t,e),_c(e);break;case 13:Al(t,e),_c(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(pT=Bs())),s&4&&_R(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(si=(d=si)||u,Al(t,e),si=d):Al(t,e),_c(e),s&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for($t=e,u=e.child;u!==null;){for(h=$t=u;$t!==null;){switch(f=$t,m=f.child,f.tag){case 0:case 11:case 14:case 15:Jy(4,f,f.return);break;case 1:hg(f,f.return);var x=f.stateNode;if(typeof x.componentWillUnmount=="function"){s=f,n=f.return;try{t=s,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(p){Ls(s,n,p)}}break;case 5:hg(f,f.return);break;case 22:if(f.memoizedState!==null){kR(h);continue}}m!==null?(m.return=f,$t=m):kR(h)}u=u.sibling}e:for(u=null,h=e;;){if(h.tag===5){if(u===null){u=h;try{a=h.stateNode,d?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=_U("display",o))}catch(p){Ls(e,e.return,p)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=d?"":h.memoizedProps}catch(p){Ls(e,e.return,p)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:Al(t,e),_c(e),s&4&&_R(e);break;case 21:break;default:Al(t,e),_c(e)}}function _c(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Xz(n)){var s=n;break e}n=n.return}throw Error(ft(160))}switch(s.tag){case 5:var a=s.stateNode;s.flags&32&&(j0(a,""),s.flags&=-33);var i=NR(e);NA(e,i,a);break;case 3:case 4:var o=s.stateNode.containerInfo,l=NR(e);wA(e,l,o);break;default:throw Error(ft(161))}}catch(c){Ls(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function aae(e,t,n){$t=e,Qz(e)}function Qz(e,t,n){for(var s=(e.mode&1)!==0;$t!==null;){var a=$t,i=a.child;if(a.tag===22&&s){var o=a.memoizedState!==null||Ww;if(!o){var l=a.alternate,c=l!==null&&l.memoizedState!==null||si;l=Ww;var d=si;if(Ww=o,(si=c)&&!d)for($t=a;$t!==null;)o=$t,c=o.child,o.tag===22&&o.memoizedState!==null?CR(a):c!==null?(c.return=o,$t=c):CR(a);for(;i!==null;)$t=i,Qz(i),i=i.sibling;$t=a,Ww=l,si=d}SR(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,$t=i):SR(e)}}function SR(e){for(;$t!==null;){var t=$t;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:si||I2(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!si)if(n===null)s.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Il(t.type,n.memoizedProps);s.componentDidUpdate(a,n.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&cR(t,i,s);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}cR(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var h=u.dehydrated;h!==null&&S0(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ft(163))}si||t.flags&512&&jA(t)}catch(f){Ls(t,t.return,f)}}if(t===e){$t=null;break}if(n=t.sibling,n!==null){n.return=t.return,$t=n;break}$t=t.return}}function kR(e){for(;$t!==null;){var t=$t;if(t===e){$t=null;break}var n=t.sibling;if(n!==null){n.return=t.return,$t=n;break}$t=t.return}}function CR(e){for(;$t!==null;){var t=$t;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{I2(4,t)}catch(c){Ls(t,n,c)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var a=t.return;try{s.componentDidMount()}catch(c){Ls(t,a,c)}}var i=t.return;try{jA(t)}catch(c){Ls(t,i,c)}break;case 5:var o=t.return;try{jA(t)}catch(c){Ls(t,o,c)}}}catch(c){Ls(t,t.return,c)}if(t===e){$t=null;break}var l=t.sibling;if(l!==null){l.return=t.return,$t=l;break}$t=t.return}}var iae=Math.ceil,LN=iu.ReactCurrentDispatcher,fT=iu.ReactCurrentOwner,cl=iu.ReactCurrentBatchConfig,un=0,Aa=null,Js=null,za=0,wo=0,fg=Uh(0),ga=0,M0=null,wm=0,R2=0,mT=0,Qy=null,Yi=null,pT=0,sx=1/0,Ad=null,IN=!1,_A=null,gh=null,Hw=!1,sh=null,RN=0,e0=0,SA=null,Y1=-1,K1=0;function Ci(){return un&6?Bs():Y1!==-1?Y1:Y1=Bs()}function xh(e){return e.mode&1?un&2&&za!==0?za&-za:qse.transition!==null?(K1===0&&(K1=DU()),K1):(e=Ln,e!==0||(e=window.event,e=e===void 0?16:VU(e.type)),e):1}function Kl(e,t,n,s){if(50<e0)throw e0=0,SA=null,Error(ft(185));Yb(e,n,s),(!(un&2)||e!==Aa)&&(e===Aa&&(!(un&2)&&(R2|=n),ga===4&&Wu(e,za)),to(e,s),n===1&&un===0&&!(t.mode&1)&&(sx=Bs()+500,T2&&zh()))}function to(e,t){var n=e.callbackNode;qne(e,t);var s=vN(e,e===Aa?za:0);if(s===0)n!==null&&MI(n),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(n!=null&&MI(n),t===1)e.tag===0?zse(AR.bind(null,e)):cz(AR.bind(null,e)),$se(function(){!(un&6)&&zh()}),n=null;else{switch($U(s)){case 1:n=UE;break;case 4:n=RU;break;case 16:n=xN;break;case 536870912:n=MU;break;default:n=xN}n=oq(n,eq.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function eq(e,t){if(Y1=-1,K1=0,un&6)throw Error(ft(327));var n=e.callbackNode;if(Sg()&&e.callbackNode!==n)return null;var s=vN(e,e===Aa?za:0);if(s===0)return null;if(s&30||s&e.expiredLanes||t)t=MN(e,s);else{t=s;var a=un;un|=2;var i=rq();(Aa!==e||za!==t)&&(Ad=null,sx=Bs()+500,um(e,t));do try{cae();break}catch(l){tq(e,l)}while(!0);eT(),LN.current=i,un=a,Js!==null?t=0:(Aa=null,za=0,t=ga)}if(t!==0){if(t===2&&(a=JC(e),a!==0&&(s=a,t=kA(e,a))),t===1)throw n=M0,um(e,0),Wu(e,s),to(e,Bs()),n;if(t===6)Wu(e,s);else{if(a=e.current.alternate,!(s&30)&&!oae(a)&&(t=MN(e,s),t===2&&(i=JC(e),i!==0&&(s=i,t=kA(e,i))),t===1))throw n=M0,um(e,0),Wu(e,s),to(e,Bs()),n;switch(e.finishedWork=a,e.finishedLanes=s,t){case 0:case 1:throw Error(ft(345));case 2:Of(e,Yi,Ad);break;case 3:if(Wu(e,s),(s&130023424)===s&&(t=pT+500-Bs(),10<t)){if(vN(e,0)!==0)break;if(a=e.suspendedLanes,(a&s)!==s){Ci(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=iA(Of.bind(null,e,Yi,Ad),t);break}Of(e,Yi,Ad);break;case 4:if(Wu(e,s),(s&4194240)===s)break;for(t=e.eventTimes,a=-1;0<s;){var o=31-Yl(s);i=1<<o,o=t[o],o>a&&(a=o),s&=~i}if(s=a,s=Bs()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*iae(s/1960))-s,10<s){e.timeoutHandle=iA(Of.bind(null,e,Yi,Ad),s);break}Of(e,Yi,Ad);break;case 5:Of(e,Yi,Ad);break;default:throw Error(ft(329))}}}return to(e,Bs()),e.callbackNode===n?eq.bind(null,e):null}function kA(e,t){var n=Qy;return e.current.memoizedState.isDehydrated&&(um(e,t).flags|=256),e=MN(e,t),e!==2&&(t=Yi,Yi=n,t!==null&&CA(t)),e}function CA(e){Yi===null?Yi=e:Yi.push.apply(Yi,e)}function oae(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var s=0;s<n.length;s++){var a=n[s],i=a.getSnapshot;a=a.value;try{if(!Ql(i(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Wu(e,t){for(t&=~mT,t&=~R2,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Yl(t),s=1<<n;e[n]=-1,t&=~s}}function AR(e){if(un&6)throw Error(ft(327));Sg();var t=vN(e,0);if(!(t&1))return to(e,Bs()),null;var n=MN(e,t);if(e.tag!==0&&n===2){var s=JC(e);s!==0&&(t=s,n=kA(e,s))}if(n===1)throw n=M0,um(e,0),Wu(e,t),to(e,Bs()),n;if(n===6)throw Error(ft(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Of(e,Yi,Ad),to(e,Bs()),null}function gT(e,t){var n=un;un|=1;try{return e(t)}finally{un=n,un===0&&(sx=Bs()+500,T2&&zh())}}function Nm(e){sh!==null&&sh.tag===0&&!(un&6)&&Sg();var t=un;un|=1;var n=cl.transition,s=Ln;try{if(cl.transition=null,Ln=1,e)return e()}finally{Ln=s,cl.transition=n,un=t,!(un&6)&&zh()}}function xT(){wo=fg.current,cs(fg)}function um(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Dse(n)),Js!==null)for(n=Js.return;n!==null;){var s=n;switch(ZE(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&NN();break;case 3:rx(),cs(Qi),cs(di),iT();break;case 5:aT(s);break;case 4:rx();break;case 13:cs(ws);break;case 19:cs(ws);break;case 10:tT(s.type._context);break;case 22:case 23:xT()}n=n.return}if(Aa=e,Js=e=vh(e.current,null),za=wo=t,ga=0,M0=null,mT=R2=wm=0,Yi=Qy=null,Hf!==null){for(t=0;t<Hf.length;t++)if(n=Hf[t],s=n.interleaved,s!==null){n.interleaved=null;var a=s.next,i=n.pending;if(i!==null){var o=i.next;i.next=a,s.next=o}n.pending=s}Hf=null}return e}function tq(e,t){do{var n=Js;try{if(eT(),W1.current=ON,TN){for(var s=_s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}TN=!1}if(jm=0,_a=fa=_s=null,Zy=!1,L0=0,fT.current=null,n===null||n.return===null){ga=1,M0=t,Js=null;break}e:{var i=e,o=n.return,l=n,c=t;if(t=za,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var m=pR(o);if(m!==null){m.flags&=-257,gR(m,o,l,i,t),m.mode&1&&mR(i,d,t),t=m,c=d;var x=t.updateQueue;if(x===null){var p=new Set;p.add(c),t.updateQueue=p}else x.add(c);break e}else{if(!(t&1)){mR(i,d,t),vT();break e}c=Error(ft(426))}}else if(ps&&l.mode&1){var v=pR(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),gR(v,o,l,i,t),JE(nx(c,l));break e}}i=c=nx(c,l),ga!==4&&(ga=2),Qy===null?Qy=[i]:Qy.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=$z(i,c,t);lR(i,g);break e;case 1:l=c;var y=i.type,b=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(gh===null||!gh.has(b)))){i.flags|=65536,t&=-t,i.lanes|=t;var w=Fz(i,l,t);lR(i,w);break e}}i=i.return}while(i!==null)}sq(n)}catch(_){t=_,Js===n&&n!==null&&(Js=n=n.return);continue}break}while(!0)}function rq(){var e=LN.current;return LN.current=ON,e===null?ON:e}function vT(){(ga===0||ga===3||ga===2)&&(ga=4),Aa===null||!(wm&268435455)&&!(R2&268435455)||Wu(Aa,za)}function MN(e,t){var n=un;un|=2;var s=rq();(Aa!==e||za!==t)&&(Ad=null,um(e,t));do try{lae();break}catch(a){tq(e,a)}while(!0);if(eT(),un=n,LN.current=s,Js!==null)throw Error(ft(261));return Aa=null,za=0,ga}function lae(){for(;Js!==null;)nq(Js)}function cae(){for(;Js!==null&&!Ine();)nq(Js)}function nq(e){var t=iq(e.alternate,e,wo);e.memoizedProps=e.pendingProps,t===null?sq(e):Js=t,fT.current=null}function sq(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=rae(n,t),n!==null){n.flags&=32767,Js=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ga=6,Js=null;return}}else if(n=tae(n,t,wo),n!==null){Js=n;return}if(t=t.sibling,t!==null){Js=t;return}Js=t=e}while(t!==null);ga===0&&(ga=5)}function Of(e,t,n){var s=Ln,a=cl.transition;try{cl.transition=null,Ln=1,dae(e,t,n,s)}finally{cl.transition=a,Ln=s}return null}function dae(e,t,n,s){do Sg();while(sh!==null);if(un&6)throw Error(ft(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ft(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Vne(e,i),e===Aa&&(Js=Aa=null,za=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Hw||(Hw=!0,oq(xN,function(){return Sg(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=cl.transition,cl.transition=null;var o=Ln;Ln=1;var l=un;un|=4,fT.current=null,sae(e,n),Jz(n,e),Ese(sA),yN=!!nA,sA=nA=null,e.current=n,aae(n),Rne(),un=l,Ln=o,cl.transition=i}else e.current=n;if(Hw&&(Hw=!1,sh=e,RN=a),i=e.pendingLanes,i===0&&(gh=null),$ne(n.stateNode),to(e,Bs()),t!==null)for(s=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],s(a.value,{componentStack:a.stack,digest:a.digest});if(IN)throw IN=!1,e=_A,_A=null,e;return RN&1&&e.tag!==0&&Sg(),i=e.pendingLanes,i&1?e===SA?e0++:(e0=0,SA=e):e0=0,zh(),null}function Sg(){if(sh!==null){var e=$U(RN),t=cl.transition,n=Ln;try{if(cl.transition=null,Ln=16>e?16:e,sh===null)var s=!1;else{if(e=sh,sh=null,RN=0,un&6)throw Error(ft(331));var a=un;for(un|=4,$t=e.current;$t!==null;){var i=$t,o=i.child;if($t.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for($t=d;$t!==null;){var u=$t;switch(u.tag){case 0:case 11:case 15:Jy(8,u,i)}var h=u.child;if(h!==null)h.return=u,$t=h;else for(;$t!==null;){u=$t;var f=u.sibling,m=u.return;if(Kz(u),u===d){$t=null;break}if(f!==null){f.return=m,$t=f;break}$t=m}}}var x=i.alternate;if(x!==null){var p=x.child;if(p!==null){x.child=null;do{var v=p.sibling;p.sibling=null,p=v}while(p!==null)}}$t=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,$t=o;else e:for(;$t!==null;){if(i=$t,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Jy(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,$t=g;break e}$t=i.return}}var y=e.current;for($t=y;$t!==null;){o=$t;var b=o.child;if(o.subtreeFlags&2064&&b!==null)b.return=o,$t=b;else e:for(o=y;$t!==null;){if(l=$t,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:I2(9,l)}}catch(_){Ls(l,l.return,_)}if(l===o){$t=null;break e}var w=l.sibling;if(w!==null){w.return=l.return,$t=w;break e}$t=l.return}}if(un=a,zh(),Uc&&typeof Uc.onPostCommitFiberRoot=="function")try{Uc.onPostCommitFiberRoot(k2,e)}catch{}s=!0}return s}finally{Ln=n,cl.transition=t}}return!1}function PR(e,t,n){t=nx(n,t),t=$z(e,t,1),e=ph(e,t,1),t=Ci(),e!==null&&(Yb(e,1,t),to(e,t))}function Ls(e,t,n){if(e.tag===3)PR(e,e,n);else for(;t!==null;){if(t.tag===3){PR(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(gh===null||!gh.has(s))){e=nx(n,e),e=Fz(t,e,1),t=ph(t,e,1),e=Ci(),t!==null&&(Yb(t,1,e),to(t,e));break}}t=t.return}}function uae(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),t=Ci(),e.pingedLanes|=e.suspendedLanes&n,Aa===e&&(za&n)===n&&(ga===4||ga===3&&(za&130023424)===za&&500>Bs()-pT?um(e,0):mT|=n),to(e,t)}function aq(e,t){t===0&&(e.mode&1?(t=Mw,Mw<<=1,!(Mw&130023424)&&(Mw=4194304)):t=1);var n=Ci();e=Zd(e,t),e!==null&&(Yb(e,t,n),to(e,n))}function hae(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),aq(e,n)}function fae(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(ft(314))}s!==null&&s.delete(t),aq(e,n)}var iq;iq=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qi.current)Xi=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Xi=!1,eae(e,t,n);Xi=!!(e.flags&131072)}else Xi=!1,ps&&t.flags&1048576&&dz(t,kN,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;G1(e,t),e=t.pendingProps;var a=Qg(t,di.current);_g(t,n),a=lT(null,t,s,e,a,n);var i=cT();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,eo(s)?(i=!0,_N(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,nT(t),a.updater=L2,t.stateNode=a,a._reactInternals=t,fA(t,s,e,n),t=gA(null,t,s,!0,i,n)):(t.tag=0,ps&&i&&XE(t),ji(null,t,a,n),t=t.child),t;case 16:s=t.elementType;e:{switch(G1(e,t),e=t.pendingProps,a=s._init,s=a(s._payload),t.type=s,a=t.tag=pae(s),e=Il(s,e),a){case 0:t=pA(null,t,s,e,n);break e;case 1:t=yR(null,t,s,e,n);break e;case 11:t=xR(null,t,s,e,n);break e;case 14:t=vR(null,t,s,Il(s.type,e),n);break e}throw Error(ft(306,s,""))}return t;case 0:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Il(s,a),pA(e,t,s,a,n);case 1:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Il(s,a),yR(e,t,s,a,n);case 3:e:{if(qz(t),e===null)throw Error(ft(387));s=t.pendingProps,i=t.memoizedState,a=i.element,gz(e,t),PN(t,s,null,n);var o=t.memoizedState;if(s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=nx(Error(ft(423)),t),t=bR(e,t,s,n,a);break e}else if(s!==a){a=nx(Error(ft(424)),t),t=bR(e,t,s,n,a);break e}else for(Ao=mh(t.stateNode.containerInfo.firstChild),To=t,ps=!0,zl=null,n=mz(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ex(),s===a){t=Jd(e,t,n);break e}ji(e,t,s,n)}t=t.child}return t;case 5:return xz(t),e===null&&dA(t),s=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,aA(s,a)?o=null:i!==null&&aA(s,i)&&(t.flags|=32),zz(e,t),ji(e,t,o,n),t.child;case 6:return e===null&&dA(t),null;case 13:return Vz(e,t,n);case 4:return sT(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=tx(t,null,s,n):ji(e,t,s,n),t.child;case 11:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Il(s,a),xR(e,t,s,a,n);case 7:return ji(e,t,t.pendingProps,n),t.child;case 8:return ji(e,t,t.pendingProps.children,n),t.child;case 12:return ji(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,Zn(CN,s._currentValue),s._currentValue=o,i!==null)if(Ql(i.value,o)){if(i.children===a.children&&!Qi.current){t=Jd(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);
vendor: 6,628 bytes, line 40
40i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===s){if(i.tag===1){c=qd(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),uA(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(ft(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),uA(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ji(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,s=t.pendingProps.children,_g(t,n),a=fl(a),s=s(a),t.flags|=1,ji(e,t,s,n),t.child;case 14:return s=t.type,a=Il(s,t.pendingProps),a=Il(s.type,a),vR(e,t,s,a,n);case 15:return Bz(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Il(s,a),G1(e,t),t.tag=1,eo(s)?(e=!0,_N(t)):e=!1,_g(t,n),Dz(t,s,a),fA(t,s,a,n),gA(null,t,s,!0,e,n);case 19:return Wz(e,t,n);case 22:return Uz(e,t,n)}throw Error(ft(156,t.tag))};function oq(e,t){return IU(e,t)}function mae(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ol(e,t,n,s){return new mae(e,t,n,s)}function yT(e){return e=e.prototype,!(!e||!e.isReactComponent)}function pae(e){if(typeof e=="function")return yT(e)?1:0;if(e!=null){if(e=e.$$typeof,e===$E)return 11;if(e===FE)return 14}return 2}function vh(e,t){var n=e.alternate;return n===null?(n=ol(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function X1(e,t,n,s,a,i){var o=2;if(s=e,typeof e=="function")yT(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ng:return hm(n.children,a,i,t);case DE:o=8,a|=8;break;case DC:return e=ol(12,n,t,a|2),e.elementType=DC,e.lanes=i,e;case $C:return e=ol(13,n,t,a),e.elementType=$C,e.lanes=i,e;case FC:return e=ol(19,n,t,a),e.elementType=FC,e.lanes=i,e;case xU:return M2(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pU:o=10;break e;case gU:o=9;break e;case $E:o=11;break e;case FE:o=14;break e;case Fu:o=16,s=null;break e}throw Error(ft(130,e==null?e:typeof e,""))}return t=ol(o,n,t,a),t.elementType=e,t.type=s,t.lanes=i,t}function hm(e,t,n,s){return e=ol(7,e,s,t),e.lanes=n,e}function M2(e,t,n,s){return e=ol(22,e,s,t),e.elementType=xU,e.lanes=n,e.stateNode={isHidden:!1},e}function F4(e,t,n){return e=ol(6,e,null,t),e.lanes=n,e}function B4(e,t,n){return t=ol(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gae(e,t,n,s,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=b4(0),this.expirationTimes=b4(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=b4(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function bT(e,t,n,s,a,i,o,l,c){return e=new gae(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ol(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nT(i),e}function xae(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:rg,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}function lq(e){if(!e)return Ph;e=e._reactInternals;e:{if(Hm(e)!==e||e.tag!==1)throw Error(ft(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(eo(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ft(171))}if(e.tag===1){var n=e.type;if(eo(n))return lz(e,n,t)}return t}function cq(e,t,n,s,a,i,o,l,c){return e=bT(n,s,!0,e,a,i,o,l,c),e.context=lq(null),n=e.current,s=Ci(),a=xh(n),i=qd(s,a),i.callback=t??null,ph(n,i,a),e.current.lanes=a,Yb(e,a,s),to(e,s),e}function D2(e,t,n,s){var a=t.current,i=Ci(),o=xh(a);return n=lq(n),t.context===null?t.context=n:t.pendingContext=n,t=qd(i,o),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=ph(a,t,o),e!==null&&(Kl(e,a,o,i),V1(e,a,o)),o}function DN(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function ER(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function jT(e,t){ER(e,t),(e=e.alternate)&&ER(e,t)}function vae(){return null}var dq=typeof reportError=="function"?reportError:function(e){console.error(e)};function wT(e){this._internalRoot=e}$2.prototype.render=wT.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ft(409));D2(e,t,null,null)};$2.prototype.unmount=wT.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Nm(function(){D2(null,e,null,null)}),t[Xd]=null}};function $2(e){this._internalRoot=e}$2.prototype.unstable_scheduleHydration=function(e){if(e){var t=UU();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vu.length&&t!==0&&t<Vu[n].priority;n++);Vu.splice(n,0,e),n===0&&qU(e)}};function NT(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function F2(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function TR(){}function yae(e,t,n,s,a){if(a){if(typeof s=="function"){var i=s;s=function(){var d=DN(o);i.call(d)}}var o=cq(t,s,e,0,null,!1,!1,"",TR);return e._reactRootContainer=o,e[Xd]=o.current,A0(e.nodeType===8?e.parentNode:e),Nm(),o}for(;
vendor: 5,173 bytes, line 40
40a=e.lastChild;)e.removeChild(a);if(typeof s=="function"){var l=s;s=function(){var d=DN(c);l.call(d)}}var c=bT(e,0,!1,null,null,!1,!1,"",TR);return e._reactRootContainer=c,e[Xd]=c.current,A0(e.nodeType===8?e.parentNode:e),Nm(function(){D2(t,c,n,s)}),c}function B2(e,t,n,s,a){var i=n._reactRootContainer;if(i){var o=i;if(typeof a=="function"){var l=a;a=function(){var c=DN(o);l.call(c)}}D2(t,o,e,a)}else o=yae(n,t,e,a,s);return DN(o)}FU=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ry(t.pendingLanes);n!==0&&(zE(t,n|1),to(t,Bs()),!(un&6)&&(sx=Bs()+500,zh()))}break;case 13:Nm(function(){var s=Zd(e,1);if(s!==null){var a=Ci();Kl(s,e,1,a)}}),jT(e,1)}};qE=function(e){if(e.tag===13){var t=Zd(e,134217728);if(t!==null){var n=Ci();Kl(t,e,134217728,n)}jT(e,134217728)}};BU=function(e){if(e.tag===13){var t=xh(e),n=Zd(e,t);if(n!==null){var s=Ci();Kl(n,e,t,s)}jT(e,t)}};UU=function(){return Ln};zU=function(e,t){var n=Ln;try{return Ln=e,t()}finally{Ln=n}};KC=function(e,t,n){switch(t){case"input":if(zC(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var a=E2(s);if(!a)throw Error(ft(90));yU(s),zC(s,a)}}}break;case"textarea":jU(e,n);break;case"select":t=n.value,t!=null&&bg(e,!!n.multiple,t,!1)}};AU=gT;PU=Nm;var bae={usingClientEntryPoint:!1,Events:[Xb,og,E2,kU,CU,gT]},oy={findFiberByHostInstance:Wf,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jae={bundleType:oy.bundleType,version:oy.version,rendererPackageName:oy.rendererPackageName,rendererConfig:oy.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:iu.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=OU(e),e===null?null:e.stateNode},findFiberByHostInstance:oy.findFiberByHostInstance||vae,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 Gw=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gw.isDisabled&&Gw.supportsFiber)try{k2=Gw.inject(jae),Uc=Gw}catch{}}qo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bae;qo.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!NT(t))throw Error(ft(200));return xae(e,t,null,n)};qo.createRoot=function(e,t){if(!NT(e))throw Error(ft(299));var n=!1,s="",a=dq;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=bT(e,1,!1,null,null,n,!1,s,a),e[Xd]=t.current,A0(e.nodeType===8?e.parentNode:e),new wT(t)};qo.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ft(188)):(e=Object.keys(e).join(","),Error(ft(268,e)));return e=OU(t),e=e===null?null:e.stateNode,e};qo.flushSync=function(e){return Nm(e)};qo.hydrate=function(e,t,n){if(!F2(t))throw Error(ft(200));return B2(null,e,t,!0,n)};qo.hydrateRoot=function(e,t,n){if(!NT(e))throw Error(ft(405));var s=n!=null&&n.hydratedSources||null,a=!1,i="",o=dq;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=cq(t,null,e,1,n??null,a,!1,i,o),e[Xd]=t.current,A0(e),s)for(e=0;e<s.length;e++)n=s[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new $2(t)};qo.render=function(e,t,n){if(!F2(t))throw Error(ft(200));return B2(null,e,t,!1,n)};qo.unmountComponentAtNode=function(e){if(!F2(e))throw Error(ft(40));return e._reactRootContainer?(Nm(function(){B2(null,null,e,!1,function(){e._reactRootContainer=null,e[Xd]=null})}),!0):!1};qo.unstable_batchedUpdates=gT;qo.unstable_renderSubtreeIntoContainer=function(e,t,n,s){if(!F2(n))throw Error(ft(200));if(e==null||e._reactInternals===void 0)throw Error(ft(38));return B2(e,t,n,!1,s)};qo.version="18.3.1-next-f1338f8080-20240426";function uq(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uq)}catch(e){console.error(e)}}uq(),uU.exports=qo;var Gm=uU.exports;const hq=_n(Gm);var fq,OR=Gm;fq=OR.createRoot,OR.hydrateRoot;const wae=1,Nae=1e6;let U4=0;function _ae(){return U4=(U4+1)%Number.MAX_SAFE_INTEGER,U4.toString()}const z4=new Map,LR=e=>{if(z4.has(e))return;const t=setTimeout(()=>{z4.delete(e),t0({type:"REMOVE_TOAST",toastId:e})},Nae);z4.set(e,t)},Sae=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,wae)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;
vendor: 10,781 bytes, line 40
40return n?LR(n):e.toasts.forEach(s=>{LR(s.id)}),{...e,toasts:e.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},Z1=[];let J1={toasts:[]};function t0(e){J1=Sae(J1,e),Z1.forEach(t=>{t(J1)})}function be({...e}){const t=_ae(),n=a=>t0({type:"UPDATE_TOAST",toast:{...a,id:t}}),s=()=>t0({type:"DISMISS_TOAST",toastId:t});return t0({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||s()}}}),{id:t,dismiss:s,update:n}}function Sn(){const[e,t]=j.useState(J1);return j.useEffect(()=>(Z1.push(t),()=>{const n=Z1.indexOf(t);n>-1&&Z1.splice(n,1)}),[e]),{...e,toast:be,dismiss:n=>t0({type:"DISMISS_TOAST",toastId:n})}}function dt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function IR(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function U2(...e){return t=>{let n=!1;const s=e.map(a=>{const i=IR(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<s.length;a++){const i=s[a];typeof i=="function"?i():IR(e[a],null)}}}}function gr(...e){return j.useCallback(U2(...e),e)}function kae(e,t){const n=j.createContext(t),s=i=>{const{children:o,...l}=i,c=j.useMemo(()=>l,Object.values(l));return r.jsx(n.Provider,{value:c,children:o})};s.displayName=e+"Provider";function a(i){const o=j.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,a]}function ea(e,t=[]){let n=[];function s(i,o){const l=j.createContext(o),c=n.length;n=[...n,o];const d=h=>{var g;const{scope:f,children:m,...x}=h,p=((g=f==null?void 0:f[e])==null?void 0:g[c])||l,v=j.useMemo(()=>x,Object.values(x));return r.jsx(p.Provider,{value:v,children:m})};d.displayName=i+"Provider";function u(h,f){var p;const m=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,x=j.useContext(m);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[d,u]}const a=()=>{const i=n.map(o=>j.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return j.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[s,Cae(a,...t)]}function Cae(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=s.reduce((l,{useScope:c,scopeName:d})=>{const h=c(i)[`__scope${d}`];return{...l,...h}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Eh(e){const t=Aae(e),n=j.forwardRef((s,a)=>{const{children:i,...o}=s,l=j.Children.toArray(i),c=l.find(Pae);if(c){const d=c.props.children,u=l.map(h=>h===c?j.Children.count(d)>1?j.Children.only(null):j.isValidElement(d)?d.props.children:null:h);return r.jsx(t,{...o,ref:a,children:j.isValidElement(d)?j.cloneElement(d,void 0,u):null})}return r.jsx(t,{...o,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var mq=Eh("Slot");function Aae(e){const t=j.forwardRef((n,s)=>{const{children:a,...i}=n;if(j.isValidElement(a)){const o=Tae(a),l=Eae(i,a.props);return a.type!==j.Fragment&&(l.ref=s?U2(s,o):o),j.cloneElement(a,l)}return j.Children.count(a)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pq=Symbol("radix.slottable");function gq(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=pq,t}function Pae(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pq}function Eae(e,t){const n={...t};for(const s in t){const a=e[s],i=t[s];/^on[A-Z]/.test(s)?a&&i?n[s]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(n[s]=a):s==="style"?n[s]={...a,...i}:s==="className"&&(n[s]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function Tae(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Jb(e){const t=e+"CollectionProvider",[n,s]=ea(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:v,children:g}=p,y=ee.useRef(null),b=ee.useRef(new Map).current;return r.jsx(a,{scope:v,itemMap:b,collectionRef:y,children:g})};o.displayName=t;const l=e+"CollectionSlot",c=Eh(l),d=ee.forwardRef((p,v)=>{const{scope:g,children:y}=p,b=i(l,g),w=gr(v,b.collectionRef);return r.jsx(c,{ref:w,children:y})});d.displayName=l;const u=e+"CollectionItemSlot",h="data-radix-collection-item",f=Eh(u),m=ee.forwardRef((p,v)=>{const{scope:g,children:y,...b}=p,w=ee.useRef(null),_=gr(v,w),C=i(u,g);return ee.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>void C.itemMap.delete(w))),r.jsx(f,{[h]:"",ref:_,children:y})});m.displayName=u;function x(p){const v=i(e+"CollectionConsumer",p);return ee.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((C,E)=>b.indexOf(C.ref.current)-b.indexOf(E.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:d,ItemSlot:m},x,s]}var Oae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lt=Oae.reduce((e,t)=>{const n=Eh(`Primitive.${t}`),s=j.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function _T(e,t){e&&Gm.flushSync(()=>e.dispatchEvent(t))}function Ai(e){const t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function Lae(e,t=globalThis==null?void 0:globalThis.document){const n=Ai(e);j.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var Iae="DismissableLayer",AA="dismissableLayer.update",Rae="dismissableLayer.pointerDownOutside",Mae="dismissableLayer.focusOutside",RR,xq=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ym=j.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,d=j.useContext(xq),[u,h]=j.useState(null),f=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=j.useState({}),x=gr(t,E=>h(E)),p=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=p.indexOf(v),y=u?p.indexOf(u):-1,b=d.layersWithOutsidePointerEventsDisabled.size>0,w=y>=g,_=$ae(E=>{const N=E.target,k=[...d.branches].some(I=>I.contains(N));!w||k||(a==null||a(E),o==null||o(E),E.defaultPrevented||l==null||l())},f),C=Fae(E=>{const N=E.target;[...d.branches].some(I=>I.contains(N))||(i==null||i(E),o==null||o(E),E.defaultPrevented||l==null||l())},f);return Lae(E=>{y===d.layers.size-1&&(s==null||s(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},f),j.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(RR=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),MR(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=RR)}},[u,f,n,d]),j.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),MR())},[u,d]),j.useEffect(()=>{const E=()=>m({});return document.addEventListener(AA,E),()=>document.removeEventListener(AA,E)},[]),r.jsx(Lt.div,{...c,ref:x,style:{pointerEvents:b?w?"auto":"none":void 0,...e.style},onFocusCapture:dt(e.onFocusCapture,C.onFocusCapture),onBlurCapture:dt(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:dt(e.onPointerDownCapture,_.onPointerDownCapture)})});Ym.displayName=Iae;var Dae="DismissableLayerBranch",vq=j.forwardRef((e,t)=>{const n=j.useContext(xq),s=j.useRef(null),a=gr(t,s);return j.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(Lt.div,{...e,ref:a})});vq.displayName=Dae;function $ae(e,t=globalThis==null?void 0:globalThis.document){const n=Ai(e),s=j.useRef(!1),a=j.useRef(()=>{});return j.useEffect(()=>{const i=l=>{if(l.target&&!s.current){let c=function(){yq(Rae,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);s.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function Fae(e,t=globalThis==null?void 0:globalThis.document){const n=Ai(e),s=j.useRef(!1);return j.useEffect(()=>{const a=i=>{i.target&&!s.current&&yq(Mae,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function MR(){const e=new CustomEvent(AA);document.dispatchEvent(e)}function yq(e,t,n,{discrete:s}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?_T(a,i):a.dispatchEvent(i)}var Bae=Ym,Uae=vq,Hs=globalThis!=null&&globalThis.document?j.useLayoutEffect:()=>{},zae="Portal",Qx=j.forwardRef((e,t)=>{var l;const{container:n,...s}=e,[a,i]=j.useState(!1);Hs(()=>i(!0),[]);const o=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?hq.createPortal(r.jsx(Lt.div,{...s,ref:t}),o):null});Qx.displayName=zae;function qae(e,t){return j.useReducer((n,s)=>t[n][s]??n,e)}var hi=e=>{const{present:t,children:n}=e,s=Vae(t),a=typeof n=="function"?n({present:s.isPresent}):j.Children.only(n),i=gr(s.ref,Wae(a));return typeof n=="function"||s.isPresent?j.cloneElement(a,{ref:i}):null};hi.displayName="Presence";function Vae(e){const[t,n]=j.useState(),s=j.useRef(null),a=j.useRef(e),i=j.useRef("none"),o=e?"mounted":"unmounted",[l,c]=qae(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return j.useEffect(()=>{const d=Yw(s.current);i.current=l==="mounted"?d:"none"},[l]),Hs(()=>{const d=s.current,u=a.current;if(u!==e){const f=i.current,m=Yw(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&f!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),Hs(()=>
40{if(t){let d;const u=t.ownerDocument.defaultView??window,h=m=>{const p=Yw(s.current).includes(m.animationName);if(m.target===t&&p&&(c("ANIMATION_END"),!a.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},f=m=>{m.target===t&&(i.current=Yw(s.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:j.useCallback(d=>{s.current=d?getComputedStyle(d):null,n(d)},[])}}function Yw(e){return(e==null?void 0:e.animationName)||"none"}function Wae(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hae=LE[" useInsertionEffect ".trim().toString()]||Hs;function Fo({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,i,o]=Gae({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:a;{const u=j.useRef(e!==void 0);j.useEffect(()=>{const h=u.current;h!==l&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,s])}const d=j.useCallback(u=>{var h;if(l){const f=Yae(u)?u(e):u;f!==e&&((h=o.current)==null||h.call(o,f))}else i(u)},[l,e,i,o]);return[c,d]}function Gae({defaultProp:e,onChange:t}){const[n,s]=j.useState(e),a=j.useRef(n),i=j.useRef(t);return Hae(()=>{i.current=t},[t]),j.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,s,i]}function Yae(e){return typeof e=="function"}var bq=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Kae="VisuallyHidden",z2=j.forwardRef((e,t)=>r.jsx(Lt.span,{...e,ref:t,style:{...bq,...e.style}}));z2.displayName=Kae;var Xae=z2,ST="ToastProvider",[kT,Zae,Jae]=Jb("Toast"),[jq,bJe]=ea("Toast",[Jae]),[Qae,q2]=jq(ST),wq=e=>{const{__scopeToast:t,label:n="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:o}=e,[l,c]=j.useState(null),[d,u]=j.useState(0),h=j.useRef(!1),f=j.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${ST}\`. Expected non-empty \`string\`.`),r.jsx(kT.Provider,{scope:t,children:r.jsx(Qae,{scope:t,label:n,duration:s,swipeDirection:a,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:j.useCallback(()=>u(m=>m+1),[]),onToastRemove:j.useCallback(()=>u(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:o})})};wq.displayName=ST;var Nq="ToastViewport",eie=["F8"],PA="toast.viewportPause",EA="toast.viewportResume",_q=j.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:s=eie,label:a="Notifications ({hotkey})",...i}=e,o=q2(Nq,n),l=Zae(n),c=j.useRef(null),d=j.useRef(null),u=j.useRef(null),h=j.useRef(null),f=gr(t,h,o.onViewportChange),m=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=o.toastCount>0;j.useEffect(()=>{const v=g=>{var b;s.length!==0&&s.every(w=>g[w]||g.code===w)&&((b=h.current)==null||b.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[s]),j.useEffect(()=>{const v=c.current,g=h.current;if(x&&v&&g){const y=()=>{if(!o.isClosePausedRef.current){const C=new CustomEvent(PA);g.dispatchEvent(C),o.isClosePausedRef.current=!0}},b=()=>{if(o.isClosePausedRef.current){const C=new CustomEvent(EA);g.dispatchEvent(C),o.isClosePausedRef.current=!1}},w=C=>{!v.contains(C.relatedTarget)&&b()},_=()=>{v.contains(document.activeElement)||b()};return v.addEventListener("focusin",y),v.addEventListener("focusout",w),v.addEventListener("pointermove",y),v.addEventListener("pointerleave",_),window.addEventListener("blur",y),window.addEventListener("focus",b),()=>{v.removeEventListener("focusin",y),v.removeEventListener("focusout",w),v.removeEventListener("pointermove",y),v.removeEventListener("pointerleave",_),window.removeEventListener("blur",y),window.removeEventListener("focus",b)}}},[x,o.isClosePausedRef]);const p=j.useCallback(({tabbingDirection:v})=>{const y=l().map(b=>{const w=b.ref.current,_=[w,...fie(w)];return v==="forwards"?_:_.reverse()});return(v==="forwards"?y.reverse():y).flat()},[l]);return j.useEffect(()=>{const v=h.current;if(v){const g=y=>{var _,C,E;const b=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!b){const N=document.activeElement,k=y.shiftKey;if(y.target===v&&k){(_=d.current)==null||_.focus();return}const O=p({tabbingDirection:k?"backwards":"forwards"}),A=O.findIndex(R=>R===N);q4(O.slice(A+1))?y.preventDefault():k?(C=d.current)==null||C.focus():(E=u.current)==null||E.focus()}};return v.addEventListener("keydown",g),()=>v.removeEventListener("keydown",g)}},[l,p]),r.jsxs(Uae,{ref:c,role:"region","aria-label":a.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&r.jsx(TA,{ref:d,onFocusFromOutsideViewport:()=>{const v=p({tabbingDirection:"forwards"});q4(v)}}),r.jsx(kT.Slot,{scope:n,children:r.jsx(Lt.ol,{tabIndex:-1,...i,ref:f})}),x&&r.jsx(TA,{ref:u,onFocusFromOutsideViewport:()=>{const v=p({tabbingDirection:"backwards"});q4(v)}})]})});_q.displayName=Nq;var Sq="ToastFocusProxy",TA=j.forwardRef((e,t)=>
40{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=e,i=q2(Sq,n);return r.jsx(z2,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:o=>{var d;const l=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&s()}})});TA.displayName=Sq;var Qb="Toast",tie="toast.swipeStart",rie="toast.swipeMove",nie="toast.swipeCancel",sie="toast.swipeEnd",kq=j.forwardRef((e,t)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:i,...o}=e,[l,c]=Fo({prop:s,defaultProp:a??!0,onChange:i,caller:Qb});return r.jsx(hi,{present:n||l,children:r.jsx(oie,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:Ai(e.onPause),onResume:Ai(e.onResume),onSwipeStart:dt(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:dt(e.onSwipeMove,d=>{const{x:u,y:h}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:dt(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:dt(e.onSwipeEnd,d=>{const{x:u,y:h}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});kq.displayName=Qb;var[aie,iie]=jq(Qb,{onClose(){}}),oie=j.forwardRef((e,t)=>{const{__scopeToast:n,type:s="foreground",duration:a,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:u,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:m,...x}=e,p=q2(Qb,n),[v,g]=j.useState(null),y=gr(t,R=>g(R)),b=j.useRef(null),w=j.useRef(null),_=a||p.duration,C=j.useRef(0),E=j.useRef(_),N=j.useRef(0),{onToastAdd:k,onToastRemove:I}=p,P=Ai(()=>{var L;(v==null?void 0:v.contains(document.activeElement))&&((L=p.viewport)==null||L.focus()),o()}),O=j.useCallback(R=>{!R||R===1/0||(window.clearTimeout(N.current),C.current=new Date().getTime(),N.current=window.setTimeout(P,R))},[P]);j.useEffect(()=>{const R=p.viewport;if(R){const L=()=>{O(E.current),d==null||d()},z=()=>{const U=new Date().getTime()-C.current;E.current=E.current-U,window.clearTimeout(N.current),c==null||c()};return R.addEventListener(PA,z),R.addEventListener(EA,L),()=>{R.removeEventListener(PA,z),R.removeEventListener(EA,L)}}},[p.viewport,_,c,d,O]),j.useEffect(()=>{i&&!p.isClosePausedRef.current&&O(_)},[i,_,p.isClosePausedRef,O]),j.useEffect(()=>(k(),()=>I()),[k,I]);const A=j.useMemo(()=>v?Lq(v):null,[v]);return p.viewport?r.jsxs(r.Fragment,{children:[A&&r.jsx(lie,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:A}),r.jsx(aie,{scope:n,onClose:P,children:Gm.createPortal(r.jsx(kT.ItemSlot,{scope:n,children:r.jsx(Bae,{asChild:!0,onEscapeKeyDown:dt(l,()=>{p.isFocusedToastEscapeKeyDownRef.current||P(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Lt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...x,ref:y,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:dt(e.onKeyDown,R=>{R.key==="Escape"&&(l==null||l(R.nativeEvent),R.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,P()))}),onPointerDown:dt(e.onPointerDown,R=>{R.button===0&&(b.current={x:R.clientX,y:R.clientY})}),onPointerMove:dt(e.onPointerMove,R=>{if(!b.current)return;const L=R.clientX-b.current.x,z=R.clientY-b.current.y,U=!!w.current,$=["left","right"].includes(p.swipeDirection),q=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,ne=$?q(0,L):0,se=$?0:q(0,z),F=R.pointerType==="touch"?10:2,V={x:ne,y:se},Z={originalEvent:R,delta:V};U?(w.current=V,Kw(rie,h,Z,{discrete:!1})):DR(V,p.swipeDirection,F)?(w.current=V,Kw(tie,u,Z,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(L)>F||Math.abs(z)>F)&&(b.current=null)}),onPointerUp:dt(e.onPointerUp,R=>{const L=w.current,z=R.target;if(z.hasPointerCapture(R.pointerId)&&z.releasePointerCapture(R.pointerId),w.current=null,b.current=null,L){const U=R.currentTarget,$={originalEvent:R,delta:L};DR(L,p.swipeDirection,p.swipeThreshold)?Kw(sie,m,$,{discrete:!0}):Kw(nie,f,$,{discrete:!0}),U.addEventListener("click",q=>q.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),lie=e=>{const{__scopeToast:t,children:n,...s}=e,a=q2(Qb,t),[i,o]=j.useState(!1),[l,c]=j.useState(!1);return uie(()=>o(!0)),j.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:r.jsx(Qx,{asChild:!0,children:r.jsx(z2,{...s,children:i&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},cie="ToastTitle",Cq=j.forwardRef((e,t)=>
vendor: 4,755 bytes, lines 40-60
40{const{__scopeToast:n,...s}=e;return r.jsx(Lt.div,{...s,ref:t})});Cq.displayName=cie;var die="ToastDescription",Aq=j.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Lt.div,{...s,ref:t})});Aq.displayName=die;var Pq="ToastAction",Eq=j.forwardRef((e,t)=>{const{altText:n,...s}=e;return n.trim()?r.jsx(Oq,{altText:n,asChild:!0,children:r.jsx(CT,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Pq}\`. Expected non-empty \`string\`.`),null)});Eq.displayName=Pq;var Tq="ToastClose",CT=j.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e,a=iie(Tq,n);return r.jsx(Oq,{asChild:!0,children:r.jsx(Lt.button,{type:"button",...s,ref:t,onClick:dt(e.onClick,a.onClose)})})});CT.displayName=Tq;var Oq=j.forwardRef((e,t)=>{const{__scopeToast:n,altText:s,...a}=e;return r.jsx(Lt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...a,ref:t})});function Lq(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),hie(s)){const a=s.ariaHidden||s.hidden||s.style.display==="none",i=s.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const o=s.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...Lq(s))}}),t}function Kw(e,t,n,{discrete:s}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?_T(a,i):a.dispatchEvent(i)}var DR=(e,t,n=0)=>{const s=Math.abs(e.x),a=Math.abs(e.y),i=s>a;return t==="left"||t==="right"?i&&s>n:!i&&a>n};function uie(e=()=>{}){const t=Ai(e);Hs(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[t])}function hie(e){return e.nodeType===e.ELEMENT_NODE}function fie(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function q4(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var mie=wq,Iq=_q,Rq=kq,Mq=Cq,Dq=Aq,$q=Eq,Fq=CT;function Bq(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Bq(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function Mr(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Bq(e))&&(s&&(s+=" "),s+=t);return s}const $R=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,FR=Mr,ev=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return FR(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=n==null?void 0:n[d],h=i==null?void 0:i[d];if(u===null)return null;const f=$R(u)||$R(h);return a[d][f]}),l=n&&Object.entries(n).reduce((d,u)=>{let[h,f]=u;return f===void 0||(d[h]=f),d},{}),c=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((d,u)=>{let{class:h,className:f,...m}=u;return Object.entries(m).every(x=>{let[p,v]=x;return Array.isArray(v)?v.includes({...i,...l}[p]):{...i,...l}[p]===v})?[...d,h,f]:d},[]);return FR(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/** 41 * @license lucide-react v0.462.0 - ISC 42 * 43 * This source code is licensed under the ISC license. 44 * See the LICENSE file in the root directory of this source tree. 45 */const pie=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Uq=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/** 46 * @license lucide-react v0.462.0 - ISC 47 * 48 * This source code is licensed under the ISC license. 49 * See the LICENSE file in the root directory of this source tree. 50 */var gie={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"};/** 51 * @license lucide-react v0.462.0 - ISC 52 * 53 * This source code is licensed under the ISC license. 54 * See the LICENSE file in the root directory of this source tree. 55 */const xie=j.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:i,iconNode:o,...l},c)=>j.createElement("svg",{ref:c,...gie,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Uq("lucide",a),...l},[...o.map(([d,u])=>j.createElement(d,u)),...Array.isArray(i)?i:[i]]));/** 56 * @license lucide-react v0.462.0 - ISC 57 * 58 * This source code is licensed under the ISC license. 59 * See the LICENSE file in the root directory of this source tree. 60 */const ze=(e,t)=>
60{const n=j.forwardRef(({className:s,...a},i)=>j.createElement(xie,{ref:i,iconNode:t,className:Uq(`lucide-${pie(e)}`,s),...a}));return n.displayName=`${e}`,n};/** 61 * @license lucide-react v0.462.0 - ISC 62 * 63 * This source code is licensed under the ISC license. 64 * See the LICENSE file in the root directory of this source tree. 65 */const vie=ze("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/** 66 * @license lucide-react v0.462.0 - ISC 67 * 68 * This source code is licensed under the ISC license. 69 * See the LICENSE file in the root directory of this source tree. 70 */const yie=ze("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** 71 * @license lucide-react v0.462.0 - ISC 72 * 73 * This source code is licensed under the ISC license. 74 * See the LICENSE file in the root directory of this source tree. 75 */const ej=ze("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** 76 * @license lucide-react v0.462.0 - ISC 77 * 78 * This source code is licensed under the ISC license. 79 * See the LICENSE file in the root directory of this source tree. 80 */const kg=ze("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 81 * @license lucide-react v0.462.0 - ISC 82 * 83 * This source code is licensed under the ISC license. 84 * See the LICENSE file in the root directory of this source tree. 85 */const bie=ze("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** 86 * @license lucide-react v0.462.0 - ISC 87 * 88 * This source code is licensed under the ISC license. 89 * See the LICENSE file in the root directory of this source tree. 90 */const jie=ze("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** 91 * @license lucide-react v0.462.0 - ISC 92 * 93 * This source code is licensed under the ISC license. 94 * See the LICENSE file in the root directory of this source tree. 95 */const Vd=ze("Award",[["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"}]]);/** 96 * @license lucide-react v0.462.0 - ISC 97 * 98 * This source code is licensed under the ISC license. 99 * See the LICENSE file in the root directory of this source tree. 100 */const zq=ze("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** 101 * @license lucide-react v0.462.0 - ISC 102 * 103 * This source code is licensed under the ISC license. 104 * See the LICENSE file in the root directory of this source tree. 105 */const V2=ze("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** 106 * @license lucide-react v0.462.0 - ISC 107 * 108 * This source code is licensed under the ISC license. 109 * See the LICENSE file in the root directory of this source tree. 110 */const wie=ze("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** 111 * @license lucide-react v0.462.0 - ISC 112 * 113 * This source code is licensed under the ISC license. 114 * See the LICENSE file in the root directory of this source tree. 115 */const Nie=ze("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** 116 * @license lucide-react v0.462.0 - ISC 117 * 118 * This source code is licensed under the ISC license. 119 * See the LICENSE file in the root directory of this source tree. 120 */const Xw=ze("BookOpen",[["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"}]]);/** 121 * @license lucide-react v0.462.0 - ISC 122 * 123 * This source code is licensed under the ISC license. 124 * See the LICENSE file in the root directory of this source tree. 125 */const _ie=ze("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** 126 * @license lucide-react v0.462.0 - ISC 127 * 128 * This source code is licensed under the ISC license. 129 * See the LICENSE file in the root directory of this source tree. 130 */const fr=ze("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** 131 * @license lucide-react v0.462.0 - ISC 132 * 133 * This source code is licensed under the ISC license. 134 * See the LICENSE file in the root directory of this source tree. 135 */const W2=ze("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}
135],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** 136 * @license lucide-react v0.462.0 - ISC 137 * 138 * This source code is licensed under the ISC license. 139 * See the LICENSE file in the root directory of this source tree. 140 */const H2=ze("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** 141 * @license lucide-react v0.462.0 - ISC 142 * 143 * This source code is licensed under the ISC license. 144 * See the LICENSE file in the root directory of this source tree. 145 */const BR=ze("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** 146 * @license lucide-react v0.462.0 - ISC 147 * 148 * This source code is licensed under the ISC license. 149 * See the LICENSE file in the root directory of this source tree. 150 */const qq=ze("CalendarDays",[["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"}]]);/** 151 * @license lucide-react v0.462.0 - ISC 152 * 153 * This source code is licensed under the ISC license. 154 * See the LICENSE file in the root directory of this source tree. 155 */const Vq=ze("CalendarX",[["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:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/** 156 * @license lucide-react v0.462.0 - ISC 157 * 158 * This source code is licensed under the ISC license. 159 * See the LICENSE file in the root directory of this source tree. 160 */const Xt=ze("Calendar",[["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"}]]);/** 161 * @license lucide-react v0.462.0 - ISC 162 * 163 * This source code is licensed under the ISC license. 164 * See the LICENSE file in the root directory of this source tree. 165 */const G2=ze("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** 166 * @license lucide-react v0.462.0 - ISC 167 * 168 * This source code is licensed under the ISC license. 169 * See the LICENSE file in the root directory of this source tree. 170 */const xa=ze("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** 171 * @license lucide-react v0.462.0 - ISC 172 * 173 * This source code is licensed under the ISC license. 174 * See the LICENSE file in the root directory of this source tree. 175 */const Qd=ze("ChartColumn",[["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"}]]);/** 176 * @license lucide-react v0.462.0 - ISC 177 * 178 * This source code is licensed under the ISC license. 179 * See the LICENSE file in the root directory of this source tree. 180 */const Sie=ze("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}
180],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** 181 * @license lucide-react v0.462.0 - ISC 182 * 183 * This source code is licensed under the ISC license. 184 * See the LICENSE file in the root directory of this source tree. 185 */const ro=ze("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** 186 * @license lucide-react v0.462.0 - ISC 187 * 188 * This source code is licensed under the ISC license. 189 * See the LICENSE file in the root directory of this source tree. 190 */const tj=ze("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 191 * @license lucide-react v0.462.0 - ISC 192 * 193 * This source code is licensed under the ISC license. 194 * See the LICENSE file in the root directory of this source tree. 195 */const kie=ze("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 196 * @license lucide-react v0.462.0 - ISC 197 * 198 * This source code is licensed under the ISC license. 199 * See the LICENSE file in the root directory of this source tree. 200 */const ax=ze("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 201 * @license lucide-react v0.462.0 - ISC 202 * 203 * This source code is licensed under the ISC license. 204 * See the LICENSE file in the root directory of this source tree. 205 */const Wq=ze("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** 206 * @license lucide-react v0.462.0 - ISC 207 * 208 * This source code is licensed under the ISC license. 209 * See the LICENSE file in the root directory of this source tree. 210 */const vn=ze("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** 211 * @license lucide-react v0.462.0 - ISC 212 * 213 * This source code is licensed under the ISC license. 214 * See the LICENSE file in the root directory of this source tree. 215 */const er=ze("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** 216 * @license lucide-react v0.462.0 - ISC 217 * 218 * This source code is licensed under the ISC license. 219 * See the LICENSE file in the root directory of this source tree. 220 */const Rd=ze("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 221 * @license lucide-react v0.462.0 - ISC 222 * 223 * This source code is licensed under the ISC license. 224 * See the LICENSE file in the root directory of this source tree. 225 */const UR=ze("CircleHelp",[["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"}]]);/** 226 * @license lucide-react v0.462.0 - ISC 227 * 228 * This source code is licensed under the ISC license. 229 * See the LICENSE file in the root directory of this source tree. 230 */const Cie=ze("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** 231 * @license lucide-react v0.462.0 - ISC 232 * 233 * This source code is licensed under the ISC license. 234 * See the LICENSE file in the root directory of this source tree. 235 */const ya=ze("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** 236 * @license lucide-react v0.462.0 - ISC 237 * 238 * This source code is licensed under the ISC license. 239 * See the LICENSE file in the root directory of this source tree. 240 */const Hq=ze("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 241 * @license lucide-react v0.462.0 - ISC 242 * 243 * This source code is licensed under the ISC license. 244 * See the LICENSE file in the root directory of this source tree. 245 */const $r=ze("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** 246 * @license lucide-react v0.462.0 - ISC 247 * 248 * This source code is licensed under the ISC license. 249 * See the LICENSE file in the root directory of this source tree. 250 */const Aie=ze("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/** 251 * @license lucide-react v0.462.0 - ISC 252 * 253 * This source code is licensed under the ISC license. 254 * See the LICENSE file in the root directory of this source tree. 255 */const Pie=ze("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** 256 * @license lucide-react v0.462.0 - ISC 257 * 258 * This source code is licensed under the ISC license. 259 * See the LICENSE file in the root directory of this source tree. 260 */const Eie=ze("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** 261 * @license lucide-react v0.462.0 - ISC 262 * 263 * This source code is licensed under the ISC license. 264 * See the LICENSE file in the root directory of this source tree. 265 */const Tie=ze("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}
265],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** 266 * @license lucide-react v0.462.0 - ISC 267 * 268 * This source code is licensed under the ISC license. 269 * See the LICENSE file in the root directory of this source tree. 270 */const Oie=ze("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** 271 * @license lucide-react v0.462.0 - ISC 272 * 273 * This source code is licensed under the ISC license. 274 * See the LICENSE file in the root directory of this source tree. 275 */const Lie=ze("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/** 276 * @license lucide-react v0.462.0 - ISC 277 * 278 * This source code is licensed under the ISC license. 279 * See the LICENSE file in the root directory of this source tree. 280 */const rj=ze("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 281 * @license lucide-react v0.462.0 - ISC 282 * 283 * This source code is licensed under the ISC license. 284 * See the LICENSE file in the root directory of this source tree. 285 */const Iie=ze("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** 286 * @license lucide-react v0.462.0 - ISC 287 * 288 * This source code is licensed under the ISC license. 289 * See the LICENSE file in the root directory of this source tree. 290 */const ah=ze("Copy",[["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"}]]);/** 291 * @license lucide-react v0.462.0 - ISC 292 * 293 * This source code is licensed under the ISC license. 294 * See the LICENSE file in the root directory of this source tree. 295 */const ec=ze("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** 296 * @license lucide-react v0.462.0 - ISC 297 * 298 * This source code is licensed under the ISC license. 299 * See the LICENSE file in the root directory of this source tree. 300 */const yh=ze("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** 301 * @license lucide-react v0.462.0 - ISC 302 * 303 * This source code is licensed under the ISC license. 304 * See the LICENSE file in the root directory of this source tree. 305 */const AT=ze("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** 306 * @license lucide-react v0.462.0 - ISC 307 * 308 * This source code is licensed under the ISC license. 309 * See the LICENSE file in the root directory of this source tree. 310 */const Tn=ze("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** 311 * @license lucide-react v0.462.0 - ISC 312 * 313 * This source code is licensed under the ISC license. 314 * See the LICENSE file in the root directory of this source tree. 315 */const qh=ze("Download",[["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"}]]);/** 316 * @license lucide-react v0.462.0 - ISC 317 * 318 * This source code is licensed under the ISC license. 319 * See the LICENSE file in the root directory of this source tree. 320 */const ds=ze("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** 321 * @license lucide-react v0.462.0 - ISC 322 * 323 * This source code is licensed under the ISC license. 324 * See the LICENSE file in the root directory of this source tree. 325 */const Kp=ze("EyeOff",[["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"}]]);/** 326 * @license lucide-react v0.462.0 - ISC 327 * 328 * This source code is licensed under the ISC license. 329 * See the LICENSE file in the root directory of this source tree. 330 */const Cr=ze("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 331 * @license lucide-react v0.462.0 - ISC 332 * 333 * This source code is licensed under the ISC license. 334 * See the LICENSE file in the root directory of this source tree. 335 */const Rie=ze("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** 336 * @license lucide-react v0.462.0 - ISC 337 * 338 * This source code is licensed under the ISC license. 339 * See the LICENSE file in the root directory of this source tree. 340 */const Mie=ze("FileCheck",[["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:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** 341 * @license lucide-react v0.462.0 - ISC 342 * 343 * This source code is licensed under the ISC license. 344 * See the LICENSE file in the root directory of this source tree. 345 */const Die=ze("FileImage",[["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"}]]);/** 346 * @license lucide-react v0.462.0 - ISC 347 * 348 * This source code is licensed under the ISC license. 349 * See the LICENSE file in the root directory of this source tree. 350 */const Ca=ze("FileText",[["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"}]]);/** 351 * @license lucide-react v0.462.0 - ISC 352 * 353 * This source code is licensed under the ISC license. 354 * See the LICENSE file in the root directory of this source tree. 355 */const nj=ze("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** 356 * @license lucide-react v0.462.0 - ISC 357 * 358 * This source code is licensed under the ISC license. 359 * See the LICENSE file in the root directory of this source tree. 360 */const $N=ze("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** 361 * @license lucide-react v0.462.0 - ISC 362 * 363 * This source code is licensed under the ISC license. 364 * See the LICENSE file in the root directory of this source tree. 365 */const $ie=ze("FolderOpen",[["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"}]]);/** 366 * @license lucide-react v0.462.0 - ISC 367 * 368 * This source code is licensed under the ISC license. 369 * See the LICENSE file in the root directory of this source tree. 370 */const Fie=ze("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** 371 * @license lucide-react v0.462.0 - ISC 372 * 373 * This source code is licensed under the ISC license. 374 * See the LICENSE file in the root directory of this source tree. 375 */const hn=ze("Globe",[["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"}]]);/** 376 * @license lucide-react v0.462.0 - ISC 377 * 378 * This source code is licensed under the ISC license. 379 * See the LICENSE file in the root directory of this source tree. 380 */const Gq=ze("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** 381 * @license lucide-react v0.462.0 - ISC 382 * 383 * This source code is licensed under the ISC license. 384 * See the LICENSE file in the root directory of this source tree. 385 */const Th=ze("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** 386 * @license lucide-react v0.462.0 - ISC 387 * 388 * This source code is licensed under the ISC license. 389 * See the LICENSE file in the root directory of this source tree. 390 */const PT=ze("Hotel",[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]]);/** 391 * @license lucide-react v0.462.0 - ISC 392 * 393 * This source code is licensed under the ISC license. 394 * See the LICENSE file in the root directory of this source tree. 395 */const en=ze("House",[["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"}]]);/** 396 * @license lucide-react v0.462.0 - ISC 397 * 398 * This source code is licensed under the ISC license. 399 * See the LICENSE file in the root directory of this source tree. 400 */const no=ze("Image",[["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"}]]);/** 401 * @license lucide-react v0.462.0 - ISC 402 * 403 * This source code is licensed under the ISC license. 404 * See the LICENSE file in the root directory of this source tree. 405 */const tc=ze("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** 406 * @license lucide-react v0.462.0 - ISC 407 * 408 * This source code is licensed under the ISC license. 409 * See the LICENSE file in the root directory of this source tree. 410 */const Bie=ze("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** 411 * @license lucide-react v0.462.0 - ISC 412 * 413 * This source code is licensed under the ISC license. 414 * See the LICENSE file in the root directory of this source tree. 415 */const Uie=ze("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",ke
415y:"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"}]]);/** 416 * @license lucide-react v0.462.0 - ISC 417 * 418 * This source code is licensed under the ISC license. 419 * See the LICENSE file in the root directory of this source tree. 420 */const zie=ze("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** 421 * @license lucide-react v0.462.0 - ISC 422 * 423 * This source code is licensed under the ISC license. 424 * See the LICENSE file in the root directory of this source tree. 425 */const qie=ze("List",[["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"}]]);/** 426 * @license lucide-react v0.462.0 - ISC 427 * 428 * This source code is licensed under the ISC license. 429 * See the LICENSE file in the root directory of this source tree. 430 */const yt=ze("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 431 * @license lucide-react v0.462.0 - ISC 432 * 433 * This source code is licensed under the ISC license. 434 * See the LICENSE file in the root directory of this source tree. 435 */const Md=ze("Lock",[["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"}]]);/** 436 * @license lucide-react v0.462.0 - ISC 437 * 438 * This source code is licensed under the ISC license. 439 * See the LICENSE file in the root directory of this source tree. 440 */const V4=ze("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** 441 * @license lucide-react v0.462.0 - ISC 442 * 443 * This source code is licensed under the ISC license. 444 * See the LICENSE file in the root directory of this source tree. 445 */const Vie=ze("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** 446 * @license lucide-react v0.462.0 - ISC 447 * 448 * This source code is licensed under the ISC license. 449 * See the LICENSE file in the root directory of this source tree. 450 */const Dn=ze("Mail",[["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"}]]);/** 451 * @license lucide-react v0.462.0 - ISC 452 * 453 * This source code is licensed under the ISC license. 454 * See the LICENSE file in the root directory of this source tree. 455 */const At=ze("MapPin",[["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"}]]);/** 456 * @license lucide-react v0.462.0 - ISC 457 * 458 * This source code is licensed under the ISC license. 459 * See the LICENSE file in the root directory of this source tree. 460 */const Wie=ze("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** 461 * @license lucide-react v0.462.0 - ISC 462 * 463 * This source code is licensed under the ISC license. 464 * See the LICENSE file in the root directory of this source tree. 465 */const Hie=ze("Menu",[["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"}]]);/** 466 * @license lucide-react v0.462.0 - ISC 467 * 468 * This source code is licensed under the ISC license. 469 * See the LICENSE file in the root directory of this source tree. 470 */const dl=ze("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** 471 * @license lucide-react v0.462.0 - ISC 472 * 473 * This source code is licensed under the ISC license. 474 * See the LICENSE file in the root directory of this source tree. 475 */const Oh=ze("MessageSquare",[["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"}]]);/** 476 * @license lucide-react v0.462.0 - ISC 477 * 478 * This source code is licensed under the ISC license. 479 * See the LICENSE file in the root directory of this source tree. 480 */const Yq=ze("Monitor",[["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"}]]);/** 481 * @license lucide-react v0.462.0 - ISC 482 * 483 * This source code is licensed under the ISC license. 484 * See the LICENSE file in the root directory of this source tree. 485 */const Gie=ze("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** 486 * @license lucide-react v0.462.0 - ISC 487 * 488 * This source code is licensed under the ISC license. 489 * See the LICENSE file in the root directory of this source tree. 490 */const Yie=ze("MousePointer",[["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.5
49079a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/** 491 * @license lucide-react v0.462.0 - ISC 492 * 493 * This source code is licensed under the ISC license. 494 * See the LICENSE file in the root directory of this source tree. 495 */const ET=ze("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** 496 * @license lucide-react v0.462.0 - ISC 497 * 498 * This source code is licensed under the ISC license. 499 * See the LICENSE file in the root directory of this source tree. 500 */const _m=ze("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** 501 * @license lucide-react v0.462.0 - ISC 502 * 503 * This source code is licensed under the ISC license. 504 * See the LICENSE file in the root directory of this source tree. 505 */const Kie=ze("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** 506 * @license lucide-react v0.462.0 - ISC 507 * 508 * This source code is licensed under the ISC license. 509 * See the LICENSE file in the root directory of this source tree. 510 */const Xl=ze("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** 511 * @license lucide-react v0.462.0 - ISC 512 * 513 * This source code is licensed under the ISC license. 514 * See the LICENSE file in the root directory of this source tree. 515 */const Lh=ze("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** 516 * @license lucide-react v0.462.0 - ISC 517 * 518 * This source code is licensed under the ISC license. 519 * See the LICENSE file in the root directory of this source tree. 520 */const Xie=ze("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** 521 * @license lucide-react v0.462.0 - ISC 522 * 523 * This source code is licensed under the ISC license. 524 * See the LICENSE file in the root directory of this source tree. 525 */const an=ze("Phone",[["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"}]]);/** 526 * @license lucide-react v0.462.0 - ISC 527 * 528 * This source code is licensed under the ISC license. 529 * See the LICENSE file in the root directory of this source tree. 530 */const fm=ze("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/** 531 * @license lucide-react v0.462.0 - ISC 532 * 533 * This source code is licensed under the ISC license. 534 * See the LICENSE file in the root directory of this source tree. 535 */const OA=ze("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** 536 * @license lucide-react v0.462.0 - ISC 537 * 538 * This source code is licensed under the ISC license. 539 * See the LICENSE file in the root directory of this source tree. 540 */const xs=ze("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 541 * @license lucide-react v0.462.0 - ISC 542 * 543 * This source code is licensed under the ISC license. 544 * See the LICENSE file in the root directory of this source tree. 545 */const ms=ze("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** 546 * @license lucide-react v0.462.0 - ISC 547 * 548 * This source code is licensed under the ISC license. 549 * See the LICENSE file in the root directory of this source tree. 550 */const LA=ze("Rocket",[["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:"m3
550kijz"}],["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"}]]);/** 551 * @license lucide-react v0.462.0 - ISC 552 * 553 * This source code is licensed under the ISC license. 554 * See the LICENSE file in the root directory of this source tree. 555 */const zR=ze("RotateCcw",[["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"}]]);/** 556 * @license lucide-react v0.462.0 - ISC 557 * 558 * This source code is licensed under the ISC license. 559 * See the LICENSE file in the root directory of this source tree. 560 */const Sm=ze("Save",[["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"}]]);/** 561 * @license lucide-react v0.462.0 - ISC 562 * 563 * This source code is licensed under the ISC license. 564 * See the LICENSE file in the root directory of this source tree. 565 */const Zie=ze("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** 566 * @license lucide-react v0.462.0 - ISC 567 * 568 * This source code is licensed under the ISC license. 569 * See the LICENSE file in the root directory of this source tree. 570 */const Wr=ze("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** 571 * @license lucide-react v0.462.0 - ISC 572 * 573 * This source code is licensed under the ISC license. 574 * See the LICENSE file in the root directory of this source tree. 575 */const Jc=ze("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** 576 * @license lucide-react v0.462.0 - ISC 577 * 578 * This source code is licensed under the ISC license. 579 * See the LICENSE file in the root directory of this source tree. 580 */const FN=ze("Settings",[["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"}]]);/** 581 * @license lucide-react v0.462.0 - ISC 582 * 583 * This source code is licensed under the ISC license. 584 * See the LICENSE file in the root directory of this source tree. 585 */const sj=ze("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 586 * @license lucide-react v0.462.0 - ISC 587 * 588 * This source code is licensed under the ISC license. 589 * See the LICENSE file in the root directory of this source tree. 590 */const fn=ze("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** 591 * @license lucide-react v0.462.0 - ISC 592 * 593 * This source code is licensed under the ISC license. 594 * See the LICENSE file in the root directory of this source tree. 595 */const eu=ze("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** 596 * @license lucide-react v0.462.0 - ISC 597 * 598 * This source code is licensed under the ISC license. 599 * See the LICENSE file in the root directory of this source tree. 600 */const Kq=ze("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}
600],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** 601 * @license lucide-react v0.462.0 - ISC 602 * 603 * This source code is licensed under the ISC license. 604 * See the LICENSE file in the root directory of this source tree. 605 */const D0=ze("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** 606 * @license lucide-react v0.462.0 - ISC 607 * 608 * This source code is licensed under the ISC license. 609 * See the LICENSE file in the root directory of this source tree. 610 */const Jie=ze("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** 611 * @license lucide-react v0.462.0 - ISC 612 * 613 * This source code is licensed under the ISC license. 614 * See the LICENSE file in the root directory of this source tree. 615 */const Va=ze("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** 616 * @license lucide-react v0.462.0 - ISC 617 * 618 * This source code is licensed under the ISC license. 619 * See the LICENSE file in the root directory of this source tree. 620 */const W4=ze("SquareCheckBig",[["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"}]]);/** 621 * @license lucide-react v0.462.0 - ISC 622 * 623 * This source code is licensed under the ISC license. 624 * See the LICENSE file in the root directory of this source tree. 625 */const so=ze("SquarePen",[["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"}]]);/** 626 * @license lucide-react v0.462.0 - ISC 627 * 628 * This source code is licensed under the ISC license. 629 * See the LICENSE file in the root directory of this source tree. 630 */const mr=ze("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** 631 * @license lucide-react v0.462.0 - ISC 632 * 633 * This source code is licensed under the ISC license. 634 * See the LICENSE file in the root directory of this source tree. 635 */const Qc=ze("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** 636 * @license lucide-react v0.462.0 - ISC 637 * 638 * This source code is licensed under the ISC license. 639 * See the LICENSE file in the root directory of this source tree. 640 */const Qie=ze("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** 641 * @license lucide-react v0.462.0 - ISC 642 * 643 * This source code is licensed under the ISC license. 644 * See the LICENSE file in the root directory of this source tree.
645 */const eoe=ze("Tag",[["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"}]]);/** 646 * @license lucide-react v0.462.0 - ISC 647 * 648 * This source code is licensed under the ISC license. 649 * See the LICENSE file in the root directory of this source tree. 650 */const toe=ze("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** 651 * @license lucide-react v0.462.0 - ISC 652 * 653 * This source code is licensed under the ISC license. 654 * See the LICENSE file in the root directory of this source tree. 655 */const roe=ze("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/** 656 * @license lucide-react v0.462.0 - ISC 657 * 658 * This source code is licensed under the ISC license. 659 * See the LICENSE file in the root directory of this source tree. 660 */const aj=ze("Ticket",[["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"}]]);/** 661 * @license lucide-react v0.462.0 - ISC 662 * 663 * This source code is licensed under the ISC license. 664 * See the LICENSE file in the root directory of this source tree. 665 */const ao=ze("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** 666 * @license lucide-react v0.462.0 - ISC 667 * 668 * This source code is licensed under the ISC license. 669 * See the LICENSE file in the root directory of this source tree. 670 */const lr=ze("TrendingUp",[["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"}]]);/** 671 * @license lucide-react v0.462.0 - ISC 672 * 673 * This source code is licensed under the ISC license. 674 * See the LICENSE file in the root directory of this source tree. 675 */const Oo=ze("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 676 * @license lucide-react v0.462.0 - ISC 677 * 678 * This source code is licensed under the ISC license. 679 * See the LICENSE file in the root directory of this source tree. 680 */const BN=ze("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** 681 * @license lucide-react v0.462.0 - ISC 682 * 683 * This source code is licensed under the ISC license. 684 * See the LICENSE file in the root directory of this source tree. 685 */const noe=ze("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** 686 * @license lucide-react v0.462.0 - ISC 687 * 688 * This source code is licensed under the ISC license. 689 * See the LICENSE file in the root directory of this source tree. 690 */const soe=ze("Twitter",[["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"}]]);/** 691 * @license lucide-react v0.462.0 - ISC 692 * 693 * This source code is licensed under the ISC license. 694 * See the LICENSE file in the root directory of this source tree. 695 */const Jn=ze("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** 696 * @license lucide-react v0.462.0 - ISC 697 * 698 * This source code is licensed under the ISC license. 699 * See the LICENSE file in the root directory of this source tree. 700 */const aoe=ze("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** 701 * @license lucide-react v0.462.0 - ISC 702 * 703 * This source code is licensed under the ISC license. 704 * See the LICENSE file in the root directory of this source tree. 705 */const TT=ze("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** 706 * @license lucide-react v0.462.0 - ISC 707 * 708 * This source code is licensed under the ISC license. 709 * See the LICENSE file in the root directory of this source tree. 710 */const Yr=ze("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** 711 * @license lucide-react v0.462.0 - ISC 712 * 713 * This source code is licensed under the ISC license. 714 * See the LICENSE file in the root directory of this source tree. 715 */const Lo=ze("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);/** 716 * @license lucide-react v0.462.0 - ISC 717 * 718 * This source code is licensed under the ISC license. 719 * See the LICENSE file in the root directory of this source tree. 720 */const Vh=ze("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}
vendor: 4,048 bytes, lines 720-760
720],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** 721 * @license lucide-react v0.462.0 - ISC 722 * 723 * This source code is licensed under the ISC license. 724 * See the LICENSE file in the root directory of this source tree. 725 */const ij=ze("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** 726 * @license lucide-react v0.462.0 - ISC 727 * 728 * This source code is licensed under the ISC license. 729 * See the LICENSE file in the root directory of this source tree. 730 */const qR=ze("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** 731 * @license lucide-react v0.462.0 - ISC 732 * 733 * This source code is licensed under the ISC license. 734 * See the LICENSE file in the root directory of this source tree. 735 */const Zw=ze("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** 736 * @license lucide-react v0.462.0 - ISC 737 * 738 * This source code is licensed under the ISC license. 739 * See the LICENSE file in the root directory of this source tree. 740 */const ioe=ze("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** 741 * @license lucide-react v0.462.0 - ISC 742 * 743 * This source code is licensed under the ISC license. 744 * See the LICENSE file in the root directory of this source tree. 745 */const Pi=ze("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** 746 * @license lucide-react v0.462.0 - ISC 747 * 748 * This source code is licensed under the ISC license. 749 * See the LICENSE file in the root directory of this source tree. 750 */const ks=ze("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** 751 * @license lucide-react v0.462.0 - ISC 752 * 753 * This source code is licensed under the ISC license. 754 * See the LICENSE file in the root directory of this source tree. 755 */const ooe=ze("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** 756 * @license lucide-react v0.462.0 - ISC 757 * 758 * This source code is licensed under the ISC license. 759 * See the LICENSE file in the root directory of this source tree. 760 */const ui=ze("Zap",[["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"}]]),OT="-",loe=e=>{const t=doe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:o=>{const l=o.split(OT);return l[0]===""&&l.length!==1&&l.shift(),Xq(l,t)||coe(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&s[o]?[...c,...s[o]]:c}}},Xq=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?Xq(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(OT);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},VR=/^\[(.+)\]$/,coe=e=>{if(VR.test(e)){const t=VR.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},doe=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};
vendor: 5,173 bytes, line 760
760return hoe(Object.entries(e.classGroups),n).forEach(([i,o])=>{IA(o,s,i,t)}),s},IA=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:WR(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(uoe(a)){IA(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{IA(o,WR(t,i),n,s)})})},WR=(e,t)=>{let n=e;return t.split(OT).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},uoe=e=>e.isThemeGetter,hoe=(e,t)=>t?e.map(([n,s])=>{const a=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,a]}):e,foe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const a=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},Zq="!",moe=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,a=t[0],i=t.length,o=l=>{const c=[];let d=0,u=0,h;for(let v=0;v<l.length;v++){let g=l[v];if(d===0){if(g===a&&(s||l.slice(v,v+i)===t)){c.push(l.slice(u,v)),u=v+i;continue}if(g==="/"){h=v;continue}}g==="["?d++:g==="]"&&d--}const f=c.length===0?l:l.substring(u),m=f.startsWith(Zq),x=m?f.substring(1):f,p=h&&h>u?h-u:void 0;return{modifiers:c,hasImportantModifier:m,baseClassName:x,maybePostfixModifierPosition:p}};return n?l=>n({className:l,parseClassName:o}):o},poe=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},goe=e=>({cache:foe(e.cacheSize),parseClassName:moe(e),...loe(e)}),xoe=/\s+/,voe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(xoe);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:u,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:m}=n(d);let x=!!m,p=s(x?f.substring(0,m):f);if(!p){if(!x){l=d+(l.length>0?" "+l:l);continue}if(p=s(f),!p){l=d+(l.length>0?" "+l:l);continue}x=!1}const v=poe(u).join(":"),g=h?v+Zq:v,y=g+p;if(i.includes(y))continue;i.push(y);const b=a(p,x);for(let w=0;w<b.length;++w){const _=b[w];i.push(g+_)}l=d+(l.length>0?" "+l:l)}return l};function yoe(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Jq(t))&&(s&&(s+=" "),s+=n);return s}const Jq=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Jq(e[s]))&&(n&&(n+=" "),n+=t);return n};function boe(e,...t){let n,s,a,i=o;function o(c){const d=t.reduce((u,h)=>h(u),e());return n=goe(d),s=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=voe(c,n);return a(c,u),u}return function(){return i(yoe.apply(null,arguments))}}const ss=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Qq=/^\[(?:([a-z-]+):)?(.+)\]$/i,joe=/^\d+\/\d+$/,woe=new Set(["px","full","screen"]),Noe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_oe=/\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$/,Soe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,koe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Coe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bd=e=>Cg(e)||woe.has(e)||joe.test(e),Eu=e=>tv(e,"length",Roe),Cg=e=>!!e&&!Number.isNaN(Number(e)),H4=e=>tv(e,"number",Cg),ly=e=>!!e&&Number.isInteger(Number(e)),Aoe=e=>e.endsWith("%")&&Cg(e.slice(0,-1)),Vr=e=>Qq.test(e),Tu=e=>Noe.test(e),Poe=new Set(["length","size","percentage"]),Eoe=e=>tv(e,Poe,eV),Toe=e=>tv(e,"position",eV),Ooe=new Set(["image","url"]),Loe=e=>tv(e,Ooe,Doe),Ioe=e=>tv(e,"",Moe),cy=()=>!0,tv=(e,t,n)=>{const s=Qq.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},Roe=e=>_oe.test(e)&&!Soe.test(e),eV=()=>!1,Moe=e=>koe.test(e),Doe=e=>Coe.test(e),$oe=()=>{const e=ss("colors"),t=ss("spacing"),n=ss("blur"),s=ss("brightness"),a=ss("borderColor"),i=ss("borderRadius"),o=ss("borderSpacing"),l=ss("borderWidth"),c=ss("contrast"),d=ss("grayscale"),u=ss("hueRotate"),h=ss("invert"),f=ss("gap"),m=ss("gradientColorStops"),x=ss("gradientColorStopPositions"),p=ss("inset"),v=ss("margin"),g=ss("opacity"),y=ss("padding"),b=ss("saturate"),w=ss("scale"),_=ss("sepia"),C=ss("skew"),E=ss("space"),N=ss("translate"),k=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",Vr,t],O=()=>[Vr,t],A=()=>["",bd,Eu],R=()=>["auto",Cg,Vr],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],z=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","0",Vr],ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],se=()=>[Cg,Vr];return{cacheSize:500,separator:":",theme:{colors:[cy],spacing:[bd,Eu],blur:["none","",Tu,Vr],brightness:se(),borderColor:[e],borderRadius:["n
760one","","full",Tu,Vr],borderSpacing:O(),borderWidth:A(),contrast:se(),grayscale:q(),hueRotate:se(),invert:q(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Aoe,Eu],inset:P(),margin:P(),opacity:se(),padding:O(),saturate:se(),scale:se(),sepia:q(),skew:se(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Vr]}],container:["container"],columns:[{columns:[Tu]}],"break-after":[{"break-after":ne()}],"break-before":[{"break-before":ne()}],"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"],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:[...L(),Vr]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ly,Vr]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Vr]}],grow:[{grow:q()}],shrink:[{shrink:q()}],order:[{order:["first","last","none",ly,Vr]}],"grid-cols":[{"grid-cols":[cy]}],"col-start-end":[{col:["auto",{span:["full",ly,Vr]},Vr]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[cy]}],"row-start-end":[{row:["auto",{span:[ly,Vr]},Vr]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Vr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Vr]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...$()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...$(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...$(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Vr,t]}],"min-w":[{"min-w":[Vr,t,"min","max","fit"]}],"max-w":[{"max-w":[Vr,t,"none","full","min","max","fit","prose",{screen:[Tu]},Tu]}],h:[{h:[Vr,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Vr,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Vr,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Vr,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Tu,Eu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",H4]}],"font-family":[{font:[cy]}],"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:["tighter","tight","normal","wide","wider","widest",Vr]}],"line-clamp":[{"line-clamp":["none",Cg,H4]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bd,Vr]}],"list-image":[{"list-image":["none",Vr]}],"list-style-type":[{list:["none","disc","decimal",Vr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bd,Eu]}],"underline-offset":[{"underline-offset":["auto",bd,Vr]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Vr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Vr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),Toe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Eoe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Loe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}
vendor: 4,888 bytes, line 760
760],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[g]}],"border-style":[{border:[...z(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[g]}],"divide-style":[{divide:z()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...z()]}],"outline-offset":[{"outline-offset":[bd,Vr]}],"outline-w":[{outline:[bd,Eu]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:A()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[bd,Eu]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Tu,Ioe]}],"shadow-color":[{shadow:[cy]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Tu,Vr]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[b]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Vr]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",Vr]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",Vr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[ly,Vr]}],"translate-x":[{"translate-x":[N]}],"translate-y":[{"translate-y":[N]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Vr]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",Vr]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}
vendor: 4,952 bytes, line 760
760],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",Vr]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[bd,Eu,H4]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}},Foe=boe($oe);function Ge(...e){return Foe(Mr(e))}const Boe=mie,tV=j.forwardRef(({className:e,...t},n)=>r.jsx(Iq,{ref:n,className:Ge("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));tV.displayName=Iq.displayName;const Uoe=ev("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),rV=j.forwardRef(({className:e,variant:t,...n},s)=>r.jsx(Rq,{ref:s,className:Ge(Uoe({variant:t}),e),...n}));rV.displayName=Rq.displayName;const zoe=j.forwardRef(({className:e,...t},n)=>r.jsx($q,{ref:n,className:Ge("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));zoe.displayName=$q.displayName;const nV=j.forwardRef(({className:e,...t},n)=>r.jsx(Fq,{ref:n,className:Ge("absolute right-2 top-2 rounded-md p-1 text-foreground
760/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsx(ks,{className:"h-4 w-4"})}));nV.displayName=Fq.displayName;const sV=j.forwardRef(({className:e,...t},n)=>r.jsx(Mq,{ref:n,className:Ge("text-sm font-semibold",e),...t}));sV.displayName=Mq.displayName;const aV=j.forwardRef(({className:e,...t},n)=>r.jsx(Dq,{ref:n,className:Ge("text-sm opacity-90",e),...t}));aV.displayName=Dq.displayName;function qoe(){const{toasts:e}=Sn();return r.jsxs(Boe,{children:[e.map(function({id:t,title:n,description:s,action:a,...i}){return r.jsxs(rV,{...i,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(sV,{children:n}),s&&r.jsx(aV,{children:s})]}),a,r.jsx(nV,{})]},t)}),r.jsx(tV,{})]})}var HR=["light","dark"],Voe="(prefers-color-scheme: dark)",Woe=j.createContext(void 0),Hoe={setTheme:e=>{},themes:[]},Goe=()=>{var e;return(e=j.useContext(Woe))!=null?e:Hoe};j.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:s,enableColorScheme:a,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let d=i==="system",u=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(x=>`'${x}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,h=a?HR.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(x,p=!1,v=!0)=>{let g=o?o[x]:x,y=p?x+"|| ''":`'${g}'`,b="";return a&&v&&!p&&HR.includes(x)&&(b+=`d.style.colorScheme = '${x}';`),n==="class"?p||g?b+=`c.add(${y})`:b+="null":g&&(b+=`d[s](n,${y})`),b},m=e?`!function(){${u}${f(e)}}()`:s?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${Voe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${d?"":"else{"+f(i,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(i,!1,!1)};}${h}}catch(t){}}();`;return j.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:m}})});var Yoe=e=>{switch(e){case"success":return Zoe;case"info":return Qoe;case"warning":return Joe;case"error":return ele;default:return null}},Koe=Array(12).fill(0),Xoe=({visible:e,className:t})=>ee.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ee.createElement("div",{className:"sonner-spinner"},Koe.map((n,s)=>ee.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),Zoe=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Joe=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Qoe=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),ele=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ee.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),tle=ee.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ee.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ee.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),rle=()=>{let[e,t]=ee.useState(document.hidden);return ee.useEffect(()=>{let n=()=>{t(document.hidden)};
760return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},RA=1,nle=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:s,...a}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:RA++,o=this.toasts.find(c=>c.id===i),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:s}),{...c,...t,id:i,dismissible:l,title:s}):c):this.addToast({title:s,...a,dismissible:l,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(n=>{this.subscribers.forEach(s=>s({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let a=t instanceof Promise?t:t(),i=s!==void 0,o,l=a.then(async d=>{if(o=["resolve",d],ee.isValidElement(d))i=!1,this.create({id:s,type:"default",message:d});else if(ale(d)&&!d.ok){i=!1;let u=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,h=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description;this.create({id:s,type:"error",message:u,description:h})}else if(n.success!==void 0){i=!1;let u=typeof n.success=="function"?await n.success(d):n.success,h=typeof n.description=="function"?await n.description(d):n.description;this.create({id:s,type:"success",message:u,description:h})}}).catch(async d=>{if(o=["reject",d],n.error!==void 0){i=!1;let u=typeof n.error=="function"?await n.error(d):n.error,h=typeof n.description=="function"?await n.description(d):n.description;this.create({id:s,type:"error",message:u,description:h})}}).finally(()=>{var d;i&&(this.dismiss(s),s=void 0),(d=n.finally)==null||d.call(n)}),c=()=>new Promise((d,u)=>l.then(()=>o[0]==="reject"?u(o[1]):d(o[1])).catch(u));return typeof s!="string"&&typeof s!="number"?{unwrap:c}:Object.assign(s,{unwrap:c})},this.custom=(t,n)=>{let s=(n==null?void 0:n.id)||RA++;return this.create({jsx:t(s),id:s,...n}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Hi=new nle,sle=(e,t)=>{let n=(t==null?void 0:t.id)||RA++;return Hi.addToast({title:e,...t,id:n}),n},ale=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",ile=sle,ole=()=>Hi.toasts,lle=()=>Hi.getActiveToasts(),Et=Object.assign(ile,{success:Hi.success,info:Hi.info,warning:Hi.warning,error:Hi.error,custom:Hi.custom,message:Hi.message,promise:Hi.promise,dismiss:Hi.dismiss,loading:Hi.loading},{getHistory:ole,getToasts:lle});function cle(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}cle(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
760left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
760:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
760--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} 761`);function Jw(e){return e.label!==void 0}var dle=3,ule="32px",hle="16px",GR=4e3,fle=356,mle=14,ple=20,gle=200;function Pl(...e){return e.filter(Boolean).join(" ")}function xle(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var vle=e=>{var t,n,s,a,i,o,l,c,d,u,h;let{invert:f,toast:m,unstyled:x,interacting:p,setHeights:v,visibleToasts:g,heights:y,index:b,toasts:w,expanded:_,removeToast:C,defaultRichColors:E,closeButton:N,style:k,cancelButtonStyle:I,actionButtonStyle:P,className:O="",descriptionClassName:A="",duration:R,position:L,gap:z,loadingIcon:U,expandByDefault:$,classNames:q,icons:ne,closeButtonAriaLabel:se="Close toast",pauseWhenPageIsHidden:F}=e,[V,Z]=ee.useState(null),[de,ve]=ee.useState(null),[pe,_e]=ee.useState(!1),[xe,oe]=ee.useState(!1),[we,ce]=ee.useState(!1),[De,Ue]=ee.useState(!1),[re,et]=ee.useState(!1),[kt,St]=ee.useState(0),[Ve,he]=ee.useState(0),ye=ee.useRef(m.duration||R||GR),Ee=ee.useRef(null),Fe=ee.useRef(null),tt=b===0,qe=b+1<=g,st=m.type,Ct=m.dismissible!==!1,ke=m.className||"",Ie=m.descriptionClassName||"",at=ee.useMemo(()=>y.findIndex(sr=>sr.toastId===m.id)||0,[y,m.id]),rt=ee.useMemo(()=>{var sr;return(sr=m.closeButton)!=null?sr:N},[m.closeButton,N]),Gt=ee.useMemo(()=>m.duration||R||GR,[m.duration,R]),gt=ee.useRef(0),Zt=ee.useRef(0),dr=ee.useRef(0),Fr=ee.useRef(null),[Tt,Br]=L.split("-"),tr=ee.useMemo(()=>y.reduce((sr,ur,Gr)=>Gr>=at?sr:sr+ur.height,0),[y,at]),or=rle(),pn=m.invert||f,xr=st==="loading";Zt.current=ee.useMemo(()=>at*z+tr,[at,tr]),ee.useEffect(()=>{ye.current=Gt},[Gt]),ee.useEffect(()=>{_e(!0)},[]),ee.useEffect(()=>{let sr=Fe.current;if(sr){let ur=sr.getBoundingClientRect().height;return he(ur),v(Gr=>[{toastId:m.id,height:ur,position:m.position},...Gr]),()=>v(Gr=>Gr.filter(ts=>ts.toastId!==m.id))}},[v,m.id]),ee.useLayoutEffect(()=>{if(!pe)return;let sr=Fe.current,ur=sr.style.height;sr.style.height="auto";let Gr=sr.getBoundingClientRect().height;sr.style.height=ur,he(Gr),v(ts=>ts.find(Ut=>Ut.toastId===m.id)?ts.map(Ut=>Ut.toastId===m.id?{...Ut,height:Gr}:Ut):[{toastId:m.id,height:Gr,position:m.position},...ts])},[pe,m.title,m.description,v,m.id]);let Bt=ee.useCallback(()=>{oe(!0),St(Zt.current),v(sr=>sr.filter(ur=>ur.toastId!==m.id)),setTimeout(()=>{C(m)},gle)},[m,C,v,Zt]);ee.useEffect(()=>{if(m.promise&&st==="loading"||m.duration===1/0||m.type==="loading")return;let sr;return _||p||F&&or?(()=>{if(dr.current<gt.current){let ur=new Date().getTime()-gt.current;ye.current=ye.current-ur}
761dr.current=new Date().getTime()})():ye.current!==1/0&&(gt.current=new Date().getTime(),sr=setTimeout(()=>{var ur;(ur=m.onAutoClose)==null||ur.call(m,m),Bt()},ye.current)),()=>clearTimeout(sr)},[_,p,m,st,F,or,Bt]),ee.useEffect(()=>{m.delete&&Bt()},[Bt,m.delete]);function Zr(){var sr,ur,Gr;return ne!=null&&ne.loading?ee.createElement("div",{className:Pl(q==null?void 0:q.loader,(sr=m==null?void 0:m.classNames)==null?void 0:sr.loader,"sonner-loader"),"data-visible":st==="loading"},ne.loading):U?ee.createElement("div",{className:Pl(q==null?void 0:q.loader,(ur=m==null?void 0:m.classNames)==null?void 0:ur.loader,"sonner-loader"),"data-visible":st==="loading"},U):ee.createElement(Xoe,{className:Pl(q==null?void 0:q.loader,(Gr=m==null?void 0:m.classNames)==null?void 0:Gr.loader),visible:st==="loading"})}return ee.createElement("li",{tabIndex:0,ref:Fe,className:Pl(O,ke,q==null?void 0:q.toast,(t=m==null?void 0:m.classNames)==null?void 0:t.toast,q==null?void 0:q.default,q==null?void 0:q[st],(n=m==null?void 0:m.classNames)==null?void 0:n[st]),"data-sonner-toast":"","data-rich-colors":(s=m.richColors)!=null?s:E,"data-styled":!(m.jsx||m.unstyled||x),"data-mounted":pe,"data-promise":!!m.promise,"data-swiped":re,"data-removed":xe,"data-visible":qe,"data-y-position":Tt,"data-x-position":Br,"data-index":b,"data-front":tt,"data-swiping":we,"data-dismissible":Ct,"data-type":st,"data-invert":pn,"data-swipe-out":De,"data-swipe-direction":de,"data-expanded":!!(_||$&&pe),style:{"--index":b,"--toasts-before":b,"--z-index":w.length-b,"--offset":`${xe?kt:Zt.current}px`,"--initial-height":$?"auto":`${Ve}px`,...k,...m.style},onDragEnd:()=>{ce(!1),Z(null),Fr.current=null},onPointerDown:sr=>{xr||!Ct||(Ee.current=new Date,St(Zt.current),sr.target.setPointerCapture(sr.pointerId),sr.target.tagName!=="BUTTON"&&(ce(!0),Fr.current={x:sr.clientX,y:sr.clientY}))},onPointerUp:()=>{var sr,ur,Gr,ts;if(De||!Ct)return;Fr.current=null;let Ut=Number(((sr=Fe.current)==null?void 0:sr.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ur=Number(((ur=Fe.current)==null?void 0:ur.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),vs=new Date().getTime()-((Gr=Ee.current)==null?void 0:Gr.getTime()),us=V==="x"?Ut:Ur,Rs=Math.abs(us)/vs;if(Math.abs(us)>=ple||Rs>.11){St(Zt.current),(ts=m.onDismiss)==null||ts.call(m,m),ve(V==="x"?Ut>0?"right":"left":Ur>0?"down":"up"),Bt(),Ue(!0),et(!1);return}ce(!1),Z(null)},onPointerMove:sr=>{var ur,Gr,ts,Ut;if(!Fr.current||!Ct||((ur=window.getSelection())==null?void 0:ur.toString().length)>0)return;let Ur=sr.clientY-Fr.current.y,vs=sr.clientX-Fr.current.x,us=(Gr=e.swipeDirections)!=null?Gr:xle(L);!V&&(Math.abs(vs)>1||Math.abs(Ur)>1)&&Z(Math.abs(vs)>Math.abs(Ur)?"x":"y");let Rs={x:0,y:0};V==="y"?(us.includes("top")||us.includes("bottom"))&&(us.includes("top")&&Ur<0||us.includes("bottom")&&Ur>0)&&(Rs.y=Ur):V==="x"&&(us.includes("left")||us.includes("right"))&&(us.includes("left")&&vs<0||us.includes("right")&&vs>0)&&(Rs.x=vs),(Math.abs(Rs.x)>0||Math.abs(Rs.y)>0)&&et(!0),(ts=Fe.current)==null||ts.style.setProperty("--swipe-amount-x",`${Rs.x}px`),(Ut=Fe.current)==null||Ut.style.setProperty("--swipe-amount-y",`${Rs.y}px`)}},rt&&!m.jsx?ee.createElement("button",{"aria-label":se,"data-disabled":xr,"data-close-button":!0,onClick:xr||!Ct?()=>{}:()=>{var sr;Bt(),(sr=m.onDismiss)==null||sr.call(m,m)},className:Pl(q==null?void 0:q.closeButton,(a=m==null?void 0:m.classNames)==null?void 0:a.closeButton)},(i=ne==null?void 0:ne.close)!=null?i:tle):null,m.jsx||j.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:ee.createElement(ee.Fragment,null,st||m.icon||m.promise?ee.createElement("div",{"data-icon":"",className:Pl(q==null?void 0:q.icon,(o=m==null?void 0:m.classNames)==null?void 0:o.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||Zr():null,m.type!=="loading"?m.
761icon||(ne==null?void 0:ne[st])||Yoe(st):null):null,ee.createElement("div",{"data-content":"",className:Pl(q==null?void 0:q.content,(l=m==null?void 0:m.classNames)==null?void 0:l.content)},ee.createElement("div",{"data-title":"",className:Pl(q==null?void 0:q.title,(c=m==null?void 0:m.classNames)==null?void 0:c.title)},typeof m.title=="function"?m.title():m.title),m.description?ee.createElement("div",{"data-description":"",className:Pl(A,Ie,q==null?void 0:q.description,(d=m==null?void 0:m.classNames)==null?void 0:d.description)},typeof m.description=="function"?m.description():m.description):null),j.isValidElement(m.cancel)?m.cancel:m.cancel&&Jw(m.cancel)?ee.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||I,onClick:sr=>{var ur,Gr;Jw(m.cancel)&&Ct&&((Gr=(ur=m.cancel).onClick)==null||Gr.call(ur,sr),Bt())},className:Pl(q==null?void 0:q.cancelButton,(u=m==null?void 0:m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,j.isValidElement(m.action)?m.action:m.action&&Jw(m.action)?ee.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||P,onClick:sr=>{var ur,Gr;Jw(m.action)&&((Gr=(ur=m.action).onClick)==null||Gr.call(ur,sr),!sr.defaultPrevented&&Bt())},className:Pl(q==null?void 0:q.actionButton,(h=m==null?void 0:m.classNames)==null?void 0:h.actionButton)},m.action.label):null))};function YR(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function yle(e,t){let n={};return[e,t].forEach((s,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",l=i?hle:ule;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof s=="number"||typeof s=="string"?c(s):typeof s=="object"?["top","right","bottom","left"].forEach(d=>{s[d]===void 0?n[`${o}-${d}`]=l:n[`${o}-${d}`]=typeof s[d]=="number"?`${s[d]}px`:s[d]}):c(l)}),n}var ble=j.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:h,duration:f,style:m,visibleToasts:x=dle,toastOptions:p,dir:v=YR(),gap:g=mle,loadingIcon:y,icons:b,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:_}=e,[C,E]=ee.useState([]),N=ee.useMemo(()=>Array.from(new Set([s].concat(C.filter(F=>F.position).map(F=>F.position)))),[C,s]),[k,I]=ee.useState([]),[P,O]=ee.useState(!1),[A,R]=ee.useState(!1),[L,z]=ee.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),U=ee.useRef(null),$=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),q=ee.useRef(null),ne=ee.useRef(!1),se=ee.useCallback(F=>{E(V=>{var Z;return(Z=V.find(de=>de.id===F.id))!=null&&Z.delete||Hi.dismiss(F.id),V.filter(({id:de})=>de!==F.id)})},[]);return ee.useEffect(()=>Hi.subscribe(F=>{if(F.dismiss){E(V=>V.map(Z=>Z.id===F.id?{...Z,delete:!0}:Z));return}setTimeout(()=>{hq.flushSync(()=>{E(V=>{let Z=V.findIndex(de=>de.id===F.id);return Z!==-1?[...V.slice(0,Z),{...V[Z],...F},...V.slice(Z+1)]:[F,...V]})})})}),[]),ee.useEffect(()=>{if(u!=="system"){z(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;let F=window.matchMedia("(prefers-color-scheme: dark)");try{F.addEventListener("change",({matches:V})=>{z(V?"dark":"light")})}catch{F.addListener(({matches:Z})=>{try{z(Z?"dark":"light")}catch(de){console.error(de)}})}},[u]),ee.useEffect(()=>{C.length<=1&&O(!1)},[C]),ee.useEffect(()=>{let F=V=>{var Z,de;a.every(ve=>V[ve]||V.code===ve)&&(O(!0),(Z=U.current)==null||Z.focus()),V.code==="Escape"&&(document.activeElement===U.current||(de=U.current)!=null&&de.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[a]),ee.useEffect(()=>{if(U.current)return()=>{q.current&&(q.current.focus({preventScroll:!0}),q.current=null,ne.current=!1)}},[U.current]),ee.createElement("section",{ref:t,"aria-label":`${w} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((F,V)=>{var Z;let[de,ve]=F.split("-");return C.length?ee.createElement("ol",{key:F,dir:v==="auto"?YR():v,tabIndex:-1,ref:U,className:l,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":de,"data-lifted":P&&C.length>1&&!i,"data-x-position":ve,style:{"--front-toast-height":`${((Z=k[0])==null?void 0:Z.height)||0}px`,"--width":`${fle}px`,"--gap":`${g}px`,...m,...yle(c,d)},onBlur:pe=>{ne.current&&!pe.currentTarget.contains(pe.relatedTarget)&&(ne.current=!1,q.current&&(q.current.focus({preventScroll:!0}),q.current=null))},onFocus:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||ne.current||(ne.current=!0,q.current=pe.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{A||O(!1)},onDragEnd:()=>O(!1),onPointerDown:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},C.filter(pe=>!pe.position&&V===0||pe.position===F).map((pe,_e)=>{var xe,oe;return ee.createElement(vle,{key:pe.id,icons:b,index:_e,toast:pe,defaultRichColors:h,duration:(xe=p==null?void 0:p.duration)!=null?xe:f,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:n,visibleToasts:x,closeButton:(oe=p==null?void 0:p.closeButton)!=null?oe:o,interacting:A,position:F,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:se,toasts:C.filter(we=>we.position==pe.position),heights:k.filter(we=>we.position==pe.position),setHeights:I,expandByDefault:i,gap:g,loadingIcon:y,expanded:P,pauseWhenPageIsHidden:_,swipeDirections:e.swipeDirections})})):null}))});const jle=({...e})=>{const{theme:t="system"}=Goe();return r.jsx(ble,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var wle=LE[" useId ".trim().toString()]||(()=>{}),Nle=0;function ul(e){const[t,n]=j.useState(wle());return Hs(()=>{e||n(s=>s??String(Nle++))},[e]),e||(t?`radix-${t}`:"")}const _le=["top","right","bottom","left"],Ih=Math.min,So=Math.max,UN=Math.round,Qw=Math.floor,qc=e=>({x:e,y:e}
vendor: 11,838 bytes, line 761
761),Sle={left:"right",right:"left",bottom:"top",top:"bottom"},kle={start:"end",end:"start"};function MA(e,t,n){return So(e,Ih(t,n))}function tu(e,t){return typeof e=="function"?e(t):e}function ru(e){return e.split("-")[0]}function rv(e){return e.split("-")[1]}function LT(e){return e==="x"?"y":"x"}function IT(e){return e==="y"?"height":"width"}const Cle=new Set(["top","bottom"]);function Mc(e){return Cle.has(ru(e))?"y":"x"}function RT(e){return LT(Mc(e))}function Ale(e,t,n){n===void 0&&(n=!1);const s=rv(e),a=RT(e),i=IT(a);let o=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=zN(o)),[o,zN(o)]}function Ple(e){const t=zN(e);return[DA(e),t,DA(t)]}function DA(e){return e.replace(/start|end/g,t=>kle[t])}const KR=["left","right"],XR=["right","left"],Ele=["top","bottom"],Tle=["bottom","top"];function Ole(e,t,n){switch(e){case"top":case"bottom":return n?t?XR:KR:t?KR:XR;case"left":case"right":return t?Ele:Tle;default:return[]}}function Lle(e,t,n,s){const a=rv(e);let i=Ole(ru(e),n==="start",s);return a&&(i=i.map(o=>o+"-"+a),t&&(i=i.concat(i.map(DA)))),i}function zN(e){return e.replace(/left|right|bottom|top/g,t=>Sle[t])}function Ile(e){return{top:0,right:0,bottom:0,left:0,...e}}function iV(e){return typeof e!="number"?Ile(e):{top:e,right:e,bottom:e,left:e}}function qN(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function ZR(e,t,n){let{reference:s,floating:a}=e;const i=Mc(t),o=RT(t),l=IT(o),c=ru(t),d=i==="y",u=s.x+s.width/2-a.width/2,h=s.y+s.height/2-a.height/2,f=s[l]/2-a[l]/2;let m;switch(c){case"top":m={x:u,y:s.y-a.height};break;case"bottom":m={x:u,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:h};break;case"left":m={x:s.x-a.width,y:h};break;default:m={x:s.x,y:s.y}}switch(rv(t)){case"start":m[o]-=f*(n&&d?-1:1);break;case"end":m[o]+=f*(n&&d?-1:1);break}return m}const Rle=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:h}=ZR(d,s,c),f=s,m={},x=0;for(let p=0;p<l.length;p++){const{name:v,fn:g}=l[p],{x:y,y:b,data:w,reset:_}=await g({x:u,y:h,initialPlacement:s,placement:f,strategy:a,middlewareData:m,rects:d,platform:o,elements:{reference:e,floating:t}});u=y??u,h=b??h,m={...m,[v]:{...m[v],...w}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(f=_.placement),_.rects&&(d=_.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:a}):_.rects),{x:u,y:h}=ZR(d,f,c)),p=-1)}return{x:u,y:h,placement:f,strategy:a,middlewareData:m}};async function $0(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:m=0}=tu(t,e),x=iV(m),v=l[f?h==="floating"?"reference":"floating":h],g=qN(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),y=h==="floating"?{x:s,y:a,width:o.floating.width,height:o.floating.height}:o.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},_=qN(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:b,strategy:c}):y);return{top:(g.top-_.top+x.top)/w.y,bottom:(_.bottom-g.bottom+x.bottom)/w.y,left:(g.left-_.left+x.left)/w.x,right:(_.right-g.right+x.right)/w.x}}const Mle=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=tu(e,t)||{};if(d==null)return{};const h=iV(u),f={x:n,y:s},m=RT(a),x=IT(m),p=await o.getDimensions(d),v=m==="y",g=v?"top":"left",y=v?"bottom":"right",b=v?"clientHeight":"clientWidth",w=i.reference[x]+i.reference[m]-f[m]-i.floating[x],_=f[m]-i.reference[m],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let E=C?C[b]:0;(!E||!await(o.isElement==null?void 0:o.isElement(C)))&&(E=l.floating[b]||i.floating[x]);const N=w/2-_/2,k=E/2-p[x]/2-1,I=Ih(h[g],k),P=Ih(h[y],k),O=I,A=E-p[x]-P,R=E/2-p[x]/2+N,L=MA(O,R,A),z=!c.arrow&&rv(a)!=null&&R!==L&&i.reference[x]/2-(R<O?I:P)-p[x]/2<0,U=z?R<O?R-O:R-A:0;return{[m]:f[m]+U,data:{[m]:L,centerOffset:R-L-U,...z&&{alignmentOffset:U}},reset:z}}}),Dle=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:p=!0,...v}=tu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=ru(a),y=Mc(l),b=ru(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),_=f||(b||!p?[zN(l)]:Ple(l)),C=x!=="none";!f&&C&&_.push(...Lle(l,p,x,w));const E=[l,..._],N=await $0(t,v),k=[];let I=((s=i.flip)==null?void 0:s.overflows)||[];if(u&&k.push(N[g]),h){const R=Ale(a,o,w);k.push(N[R[0]],N[R[1]])}if(I=[...I,{placement:a,overflows:k}],!k.every(R=>R<=0)){var P,O;const R=(((P=i.flip)==null?void 0:P.index)||0)+1,L=E[R];if(L&&(!(h==="alignment"?y!==Mc(L):!1)||I.every($=>$.overflows[0]>0&&Mc($.placement)===y)))return{data:{index:R,overflows:I},reset:{placement:L}};let z=(O=I.filter(U=>U.overflows[0]<=0).sort((U,$)=>U.overflows[1]-$.overflows[1])[0])==null?void 0:O.placement;if(!z)switch(m){case"bestFit":{var A;const U=(A=I.filter($=>{if(C){const q=Mc($.placement);return q===y||q==="y"}return!0}).map($=>[$.placement,$.overflows.filter(q=>q>0).reduce((q,ne)=>q+ne,0)]).sort(($,q)=>$[1]-q[1])[0])==null?void 0:A[0];U&&(z=U);break}case"initialPlacement":z=l;break}if(a!==z)return{reset:{placement:z}}}return{}}}};function JR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function QR(e){return _le.some(t=>e[t]>=0)}const $le=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...a}=tu(e,t);switch(s){case"referenceHidden":{const i=await $0(t,{...a,elementContext:"reference"}),o=JR(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:QR(o)}}}case"escaped":{const i=await $0(t,{...a,altBoundary:!0}),o=JR(i,n.floating);return{data:{escapedOffsets:o,escaped:QR(o)}}}default:return{}}}}},oV=new Set(["left","top"]);async function Fle(e,t){const{placement:n,platform:s,elements:a}=e,i=await(s.isRTL==null?void 0:s.isRTL(a.floating)),o=ru(n),l=rv(n),c=Mc(n)==="y",d=oV.has(o)?-1:1,u=i&&c?-1:1,h=tu(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof x=="number"&&(m=l==="end"?x*-1:x),c?{x:m*u,y:f*d}:{x:f*d,y:m*u}}const Ble=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:i,placement:o,middlewareData:l}=t,c=await Fle(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:a+c.x,y:i+c.y,data:{...c,placement:o}}}}},Ule=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...c}=tu(e,t),d={x:n,y:s},u=await $0(t,c),h=Mc(ru(a)),f=LT(h);let m=d[f],x=d[h];if(i){const v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",y=m+u[v],b=m-u[g];m=MA(y,m,b)}if(o){const v=h==="y"?"top":"left",g=h==="y"?"bottom":"right",y=x+u[v],b=x-u[g];x=MA(y,x,b)}const p=l.fn({...t,[f]:m,[h]:x});return{...p,data:{x:p.x-n,y:p.y-s,enabled:{[f]:i,[h]:o}}}}}},zle=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=tu(e,t),u={x:n,y:s},h=Mc(a),f=LT(h);let m=u[f],x=u[h];const p=tu(l,t),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const b=f==="y"?"height":"width",w=i.reference[f]-i.floating[b]+v.mainAxis,_=i.reference[f]+i.reference[b]-v.mainAxis;m<w?m=w:m>_&&(m=_)}if(d){var g,y;const b=f==="y"?"width":"height",w=oV.has(ru(a)),_=i.reference[h]-i.floating[b]+(w&&((g=o.offset)==null?void 0:g[h])||0)+(w?0:v.crossAxis),C=i.reference[h]+i.reference[b]+(w?0:((y=o.offset)==null?void 0:y[h])||0)-(w?v.crossAxis:0);x<_?x=_:x>C&&(x=C)}return{[f]:m,[h]:x}}}},qle=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...d}=tu(e,t),u=await $0(t,d),h=ru(a),f=rv(a),m=Mc(a)==="y",{width:x,height:p}=i.floating;let v,g;h==="top"||h==="bottom"?(v=h,g=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(g=h,v=f==="end"?"top":"bottom");const y=p-u.top-u.bottom,b=x-u.left-u.right,w=Ih(p-u[v],y),_=Ih(x-u[g],b),C=!t.middlewareData.shift;let E=w,N=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=b),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(E=y),C&&!f){const I=So(u.left,0),P=So(u.right,0),O=So(u.top,0),A=So(u.bottom,0);m?N=x-2*(I!==0||P!==0?I+P:So(u.left,u.right)):E=p-2*(O!==0||A!==0?O+A:So(u.top,u.bottom))}await c({...t,availableWidth:N,availableHeight:E});const k=await o.getDimensions(l.floating);return x!==k.width||p!==k.height?{reset:{rects:!0}}:{}}}};function Y2(){return typeof window<"u"}function nv(e){return lV(e)?(e.nodeName||"").toLowerCase():"#document"}function Io(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ad(e){var t;return(t=(lV(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lV(e){return Y2()?e instanceof Node||e instanceof Io(e).Node:!1}function rc(e){return Y2()?e instanceof Element||e instanceof Io(e).Element:!1}function ed(e){return Y2()?e instanceof HTMLElement||e instanceof Io(e).HTMLElement:!1}function eM(e){return!Y2()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Io(e).ShadowRoot}const Vle=new Set(["inline","contents"]);function oj(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=nc(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!Vle.has(a)}const Wle=new Set(["table","td","th"]);function Hle(e){return Wle.has(nv(e))}const Gle=[":popover-open",":modal"];function K2(e){return Gle.some(t=>{try{return e.matches(t)}catch{return!1}})}const Yle=["transform","translate","scale","rotate","perspective"],Kle=["transform","translate","scale","rotate","perspective","filter"],Xle=["paint","layout","strict","content"];function MT(e){const t=DT(),n=rc(e)?nc(e):e;return Yle.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Kle.some(s=>(n.willChange||"").includes(s))||Xle.some(s=>(n.contain||"").includes(s))}function Zle(e){let t=Rh(e);for(;ed(t)&&!ix(t);){if(MT(t))return t;if(K2(t))return null;t=Rh(t)}return null}function DT(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Jle=new Set(["html","body","#document"]);function ix(e){return Jle.has(nv(e))}function nc(e){return Io(e).getComputedStyle(e)}function X2(e){return rc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rh(e){if(nv(e)==="html")return e;const t=e.assignedSlot||e.parentNode||eM(e)&&e.host||ad(e);return eM(t)?t.host:t}function cV(e){const t=Rh(e);return ix(t)?e.ownerDocument?e.ownerDocument.body:e.body:ed(t)&&oj(t)?t:cV(t)}function F0(e,t,n){var s;
vendor: 2,094 bytes, line 761
761t===void 0&&(t=[]),n===void 0&&(n=!0);const a=cV(e),i=a===((s=e.ownerDocument)==null?void 0:s.body),o=Io(a);if(i){const l=$A(o);return t.concat(o,o.visualViewport||[],oj(a)?a:[],l&&n?F0(l):[])}return t.concat(a,F0(a,[],n))}function $A(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dV(e){const t=nc(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=ed(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:s,l=UN(n)!==i||UN(s)!==o;return l&&(n=i,s=o),{width:n,height:s,$:l}}function $T(e){return rc(e)?e:e.contextElement}function Ag(e){const t=$T(e);if(!ed(t))return qc(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:i}=dV(t);let o=(i?UN(n.width):n.width)/s,l=(i?UN(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Qle=qc(0);function uV(e){const t=Io(e);return!DT()||!t.visualViewport?Qle:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ece(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Io(e)?!1:t}function km(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),i=$T(e);let o=qc(1);t&&(s?rc(s)&&(o=Ag(s)):o=Ag(e));const l=ece(i,n,s)?uV(i):qc(0);let c=(a.left+l.x)/o.x,d=(a.top+l.y)/o.y,u=a.width/o.x,h=a.height/o.y;if(i){const f=Io(i),m=s&&rc(s)?Io(s):s;let x=f,p=$A(x);for(;p&&s&&m!==x;){const v=Ag(p),g=p.getBoundingClientRect(),y=nc(p),b=g.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,w=g.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,d*=v.y,u*=v.x,h*=v.y,c+=b,d+=w,x=Io(p),p=$A(x)}}return qN({width:u,height:h,x:c,y:d})}function FT(e,t){const n=X2(e).scrollLeft;return t?t.left+n:km(ad(e)).left+n}function hV(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=s.left+t.scrollLeft-(n?0:FT(e,s)),i=s.top+t.scrollTop;return{x:a,y:i}}function tce(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const i=a==="fixed",o=ad(s),l=t?K2(t.floating):!1;if(s===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=qc(1);const u=qc(0),h=ed(s);if((h||!h&&!i)&&((nv(s)!=="body"||oj(o))&&(c=X2(s)),ed(s))){const m=km(s);
vendor: 5,484 bytes, line 761
761d=Ag(s),u.x=m.x+s.clientLeft,u.y=m.y+s.clientTop}const f=o&&!h&&!i?hV(o,c,!0):qc(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+f.x,y:n.y*d.y-c.scrollTop*d.y+u.y+f.y}}function rce(e){return Array.from(e.getClientRects())}function nce(e){const t=ad(e),n=X2(e),s=e.ownerDocument.body,a=So(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=So(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+FT(e);const l=-n.scrollTop;return nc(s).direction==="rtl"&&(o+=So(t.clientWidth,s.clientWidth)-a),{width:a,height:i,x:o,y:l}}function sce(e,t){const n=Io(e),s=ad(e),a=n.visualViewport;let i=s.clientWidth,o=s.clientHeight,l=0,c=0;if(a){i=a.width,o=a.height;const d=DT();(!d||d&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}return{width:i,height:o,x:l,y:c}}const ace=new Set(["absolute","fixed"]);function ice(e,t){const n=km(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,i=ed(e)?Ag(e):qc(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=a*i.x,d=s*i.y;return{width:o,height:l,x:c,y:d}}function tM(e,t,n){let s;if(t==="viewport")s=sce(e,n);else if(t==="document")s=nce(ad(e));else if(rc(t))s=ice(t,n);else{const a=uV(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return qN(s)}function fV(e,t){const n=Rh(e);return n===t||!rc(n)||ix(n)?!1:nc(n).position==="fixed"||fV(n,t)}function oce(e,t){const n=t.get(e);if(n)return n;let s=F0(e,[],!1).filter(l=>rc(l)&&nv(l)!=="body"),a=null;const i=nc(e).position==="fixed";let o=i?Rh(e):e;for(;rc(o)&&!ix(o);){const l=nc(o),c=MT(o);!c&&l.position==="fixed"&&(a=null),(i?!c&&!a:!c&&l.position==="static"&&!!a&&ace.has(a.position)||oj(o)&&!c&&fV(e,o))?s=s.filter(u=>u!==o):a=l,o=Rh(o)}return t.set(e,s),s}function lce(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const o=[...n==="clippingAncestors"?K2(t)?[]:oce(t,this._c):[].concat(n),s],l=o[0],c=o.reduce((d,u)=>{const h=tM(t,u,a);return d.top=So(h.top,d.top),d.right=Ih(h.right,d.right),d.bottom=Ih(h.bottom,d.bottom),d.left=So(h.left,d.left),d},tM(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function cce(e){const{width:t,height:n}=dV(e);return{width:t,height:n}}function dce(e,t,n){const s=ed(t),a=ad(t),i=n==="fixed",o=km(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=qc(0);function d(){c.x=FT(a)}if(s||!s&&!i)if((nv(t)!=="body"||oj(a))&&(l=X2(t)),s){const m=km(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else a&&d();i&&!s&&a&&d();const u=a&&!s&&!i?hV(a,l):qc(0),h=o.left+l.scrollLeft-c.x-u.x,f=o.top+l.scrollTop-c.y-u.y;return{x:h,y:f,width:o.width,height:o.height}}function G4(e){return nc(e).position==="static"}function rM(e,t){if(!ed(e)||nc(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ad(e)===n&&(n=n.ownerDocument.body),n}function mV(e,t){const n=Io(e);if(K2(e))return n;if(!ed(e)){let a=Rh(e);for(;a&&!ix(a);){if(rc(a)&&!G4(a))return a;a=Rh(a)}return n}let s=rM(e,t);for(;s&&Hle(s)&&G4(s);)s=rM(s,t);return s&&ix(s)&&G4(s)&&!MT(s)?n:s||Zle(e)||n}const uce=async function(e){const t=this.getOffsetParent||mV,n=this.getDimensions,s=await n(e.floating);return{reference:dce(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function hce(e){return nc(e).direction==="rtl"}const fce={convertOffsetParentRelativeRectToViewportRelativeRect:tce,getDocumentElement:ad,getClippingRect:lce,getOffsetParent:mV,getElementRects:uce,getClientRects:rce,getDimensions:cce,getScale:Ag,isElement:rc,isRTL:hce};function pV(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mce(e,t){let n=null,s;const a=ad(e);function i(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:u,top:h,width:f,height:m}=d;if(l||t(),!f||!m)return;const x=Qw(h),p=Qw(a.clientWidth-(u+f)),v=Qw(a.clientHeight-(h+m)),g=Qw(u),b={rootMargin:-x+"px "+-p+"px "+-v+"px "+-g+"px",threshold:So(0,Ih(1,c))||1};let w=!0;function _(C){const E=C[0].intersectionRatio;if(E!==c){if(!w)return o();E?o(!1,E):s=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!pV(d,e.getBoundingClientRect())&&o(),w=!1}try{n=new IntersectionObserver(_,{...b,root:a.ownerDocument})}catch{n=new IntersectionObserver(_,b)}n.observe(e)}return o(!0),i}function pce(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,d=$T(e),u=a||i?[...d?F0(d):[],...F0(t)]:[];u.forEach(g=>{a&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const h=d&&l?mce(d,n):null;let f=-1,m=null;o&&(m=new ResizeObserver(g=>{let[y]=g;y&&y.target===d&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),d&&!c&&m.observe(d),m.observe(t));let x,p=c?km(e):null;c&&v();function v(){const g=km(e);p&&!pV(p,g)&&n(),p=g,x=requestAnimationFrame(v)}return n(),()=>{var g;u.forEach(y=>{a&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),h==null||h(),(g=m)==null||g.disconnect(),m=null,c&&cancelAnimationFrame(x)}}const gce=Ble,xce=Ule,vce=Dle,yce=qle,bce=$le,nM=Mle,jce=zle,wce=(e,t,n)=>{const s=new Map,a={platform:fce,...n},i={...a.platform,_c:s};return Rle(e,t,{...a,platform:i})};var Nce=typeof document<"u",_ce=function(){},Q1=Nce?j.useLayoutEffect:_ce;function VN(e,t){if(e===t)return!0;
vendor: 4,174 bytes, line 761
761if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!VN(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const i=a[s];if(!(i==="_owner"&&e.$$typeof)&&!VN(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function gV(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sM(e,t){const n=gV(e);return Math.round(t*n)/n}function Y4(e){const t=j.useRef(e);return Q1(()=>{t.current=e}),t}function Sce(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,h]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=j.useState(s);VN(f,s)||m(s);const[x,p]=j.useState(null),[v,g]=j.useState(null),y=j.useCallback($=>{$!==C.current&&(C.current=$,p($))},[]),b=j.useCallback($=>{$!==E.current&&(E.current=$,g($))},[]),w=i||x,_=o||v,C=j.useRef(null),E=j.useRef(null),N=j.useRef(u),k=c!=null,I=Y4(c),P=Y4(a),O=Y4(d),A=j.useCallback(()=>{if(!C.current||!E.current)return;const $={placement:t,strategy:n,middleware:f};P.current&&($.platform=P.current),wce(C.current,E.current,$).then(q=>{const ne={...q,isPositioned:O.current!==!1};R.current&&!VN(N.current,ne)&&(N.current=ne,Gm.flushSync(()=>{h(ne)}))})},[f,t,n,P,O]);Q1(()=>{d===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,h($=>({...$,isPositioned:!1})))},[d]);const R=j.useRef(!1);Q1(()=>(R.current=!0,()=>{R.current=!1}),[]),Q1(()=>{if(w&&(C.current=w),_&&(E.current=_),w&&_){if(I.current)return I.current(w,_,A);A()}},[w,_,A,I,k]);const L=j.useMemo(()=>({reference:C,floating:E,setReference:y,setFloating:b}),[y,b]),z=j.useMemo(()=>({reference:w,floating:_}),[w,_]),U=j.useMemo(()=>{const $={position:n,left:0,top:0};if(!z.floating)return $;const q=sM(z.floating,u.x),ne=sM(z.floating,u.y);return l?{...$,transform:"translate("+q+"px, "+ne+"px)",...gV(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:q,top:ne}},[n,l,z.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:A,refs:L,elements:z,floatingStyles:U}),[u,A,L,z,U])}const kce=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?nM({element:s.current,padding:a}).fn(n):{}:s?nM({element:s,padding:a}).fn(n):{}}}},Cce=(e,t)=>({...gce(e),options:[e,t]}),Ace=(e,t)=>({...xce(e),options:[e,t]}),Pce=(e,t)=>({...jce(e),options:[e,t]}),Ece=(e,t)=>({...vce(e),options:[e,t]}),Tce=(e,t)=>({...yce(e),options:[e,t]}),Oce=(e,t)=>({...bce(e),options:[e,t]}),Lce=(e,t)=>({...kce(e),options:[e,t]});var Ice="Arrow",xV=j.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...i}=e;return r.jsx(Lt.svg,{...i,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});xV.displayName=Ice;var Rce=xV;function lj(e){const[t,n]=j.useState(void 0);return Hs(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var BT="Popper",[vV,Wh]=ea(BT),[Mce,yV]=vV(BT),bV=e=>{const{__scopePopper:t,children:n}=e,[s,a]=j.useState(null);return r.jsx(Mce,{scope:t,anchor:s,onAnchorChange:a,children:n})};bV.displayName=BT;var jV="PopperAnchor",wV=j.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,i=yV(jV,n),o=j.useRef(null),l=gr(t,o);return j.useEffect(()=>{i.onAnchorChange((s==null?void 0:s.current)||o.current)}),s?null:r.jsx(Lt.div,{...a,ref:l})});wV.displayName=jV;var UT="PopperContent",[Dce,$ce]=vV(UT),NV=j.forwardRef((e,t)=>
vendor: 2,457 bytes, line 761
761{var pe,_e,xe,oe,we,ce;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:x,...p}=e,v=yV(UT,n),[g,y]=j.useState(null),b=gr(t,De=>y(De)),[w,_]=j.useState(null),C=lj(w),E=(C==null?void 0:C.width)??0,N=(C==null?void 0:C.height)??0,k=s+(i!=="center"?"-"+i:""),I=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},P=Array.isArray(d)?d:[d],O=P.length>0,A={padding:I,boundary:P.filter(Bce),altBoundary:O},{refs:R,floatingStyles:L,placement:z,isPositioned:U,middlewareData:$}=Sce({strategy:"fixed",placement:k,whileElementsMounted:(...De)=>pce(...De,{animationFrame:m==="always"}),elements:{reference:v.anchor},middleware:[Cce({mainAxis:a+N,alignmentAxis:o}),c&&Ace({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Pce():void 0,...A}),c&&Ece({...A}),Tce({...A,apply:({elements:De,rects:Ue,availableWidth:re,availableHeight:et})=>{const{width:kt,height:St}=Ue.reference,Ve=De.floating.style;Ve.setProperty("--radix-popper-available-width",`${re}px`),Ve.setProperty("--radix-popper-available-height",`${et}px`),Ve.setProperty("--radix-popper-anchor-width",`${kt}px`),Ve.setProperty("--radix-popper-anchor-height",`${St}px`)}}),w&&Lce({element:w,padding:l}),Uce({arrowWidth:E,arrowHeight:N}),f&&Oce({strategy:"referenceHidden",...A})]}),[q,ne]=kV(z),se=Ai(x);Hs(()=>{U&&(se==null||se())},[U,se]);const F=(pe=$.arrow)==null?void 0:pe.x,V=(_e=$.arrow)==null?void 0:_e.y,Z=((xe=$.arrow)==null?void 0:xe.centerOffset)!==0,[de,ve]=j.useState();return Hs(()=>{g&&ve(window.getComputedStyle(g).zIndex)},[g]),r.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:U?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(oe=$.transformOrigin)==null?void 0:oe.x,(we=$.transformOrigin)==null?void 0:we.y].join(" "),...((ce=$.hide)==null?void 0:ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Dce,{scope:n,placedSide:q,onArrowChange:_,arrowX:F,arrowY:V,shouldHideArrow:Z,children:r.jsx(Lt.div,{"data-side":q,"data-align":ne,...p,ref:b,style:{...p.style,animation:U?void 0:"none"}})})})});NV.displayName=UT;var _V="PopperArrow",Fce={top:"bottom",right:"left",bottom:"top",left:"right"},SV=j.forwardRef(function(t,n){const{__scopePopper:s,...a}
vendor: 2,952 bytes, line 761
761=t,i=$ce(_V,s),o=Fce[i.placedSide];return r.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:r.jsx(Rce,{...a,ref:n,style:{...a.style,display:"block"}})})});SV.displayName=_V;function Bce(e){return e!==null}var Uce=e=>({name:"transformOrigin",options:e,fn(t){var v,g,y;const{placement:n,rects:s,middlewareData:a}=t,o=((v=a.arrow)==null?void 0:v.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,u]=kV(n),h={start:"0%",center:"50%",end:"100%"}[u],f=(((g=a.arrow)==null?void 0:g.x)??0)+l/2,m=(((y=a.arrow)==null?void 0:y.y)??0)+c/2;let x="",p="";return d==="bottom"?(x=o?h:`${f}px`,p=`${-c}px`):d==="top"?(x=o?h:`${f}px`,p=`${s.floating.height+c}px`):d==="right"?(x=`${-c}px`,p=o?h:`${m}px`):d==="left"&&(x=`${s.floating.width+c}px`,p=o?h:`${m}px`),{data:{x,y:p}}}});function kV(e){const[t,n="center"]=e.split("-");return[t,n]}var zT=bV,cj=wV,Z2=NV,J2=SV,[Q2,wJe]=ea("Tooltip",[Wh]),qT=Wh(),CV="TooltipProvider",zce=700,aM="tooltip.open",[qce,AV]=Q2(CV),PV=e=>{const{__scopeTooltip:t,delayDuration:n=zce,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:i}=e,o=j.useRef(!0),l=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),r.jsx(qce,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,s)},[s]),isPointerInTransitRef:l,onPointerInTransitChange:j.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:i})};PV.displayName=CV;var EV="Tooltip",[NJe,eS]=Q2(EV),FA="TooltipTrigger",Vce=j.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=eS(FA,n),i=AV(FA,n),o=qT(n),l=j.useRef(null),c=gr(t,l,a.onTriggerChange),d=j.useRef(!1),u=j.useRef(!1),h=j.useCallback(()=>d.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),r.jsx(cj,{asChild:!0,...o,children:r.jsx(Lt.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:c,onPointerMove:dt(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:dt(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:dt(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:dt(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:dt(e.onBlur,a.onClose),onClick:dt(e.onClick,a.onClose)})})});Vce.displayName=FA;var Wce="TooltipPortal",[_Je,Hce]=Q2(Wce,{forceMount:void 0}
vendor: 3,077 bytes, line 761
761),ox="TooltipContent",TV=j.forwardRef((e,t)=>{const n=Hce(ox,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...i}=e,o=eS(ox,e.__scopeTooltip);return r.jsx(hi,{present:s||o.open,children:o.disableHoverableContent?r.jsx(OV,{side:a,...i,ref:t}):r.jsx(Gce,{side:a,...i,ref:t})})}),Gce=j.forwardRef((e,t)=>{const n=eS(ox,e.__scopeTooltip),s=AV(ox,e.__scopeTooltip),a=j.useRef(null),i=gr(t,a),[o,l]=j.useState(null),{trigger:c,onClose:d}=n,u=a.current,{onPointerInTransitChange:h}=s,f=j.useCallback(()=>{l(null),h(!1)},[h]),m=j.useCallback((x,p)=>{const v=x.currentTarget,g={x:x.clientX,y:x.clientY},y=Jce(g,v.getBoundingClientRect()),b=Qce(g,y),w=ede(p.getBoundingClientRect()),_=rde([...b,...w]);l(_),h(!0)},[h]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){const x=v=>m(v,u),p=v=>m(v,c);return c.addEventListener("pointerleave",x),u.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",x),u.removeEventListener("pointerleave",p)}}},[c,u,m,f]),j.useEffect(()=>{if(o){const x=p=>{const v=p.target,g={x:p.clientX,y:p.clientY},y=(c==null?void 0:c.contains(v))||(u==null?void 0:u.contains(v)),b=!tde(g,o);y?f():b&&(f(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,u,o,d,f]),r.jsx(OV,{...e,ref:i})}),[Yce,Kce]=Q2(EV,{isInside:!1}),Xce=gq("TooltipContent"),OV=j.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=eS(ox,n),d=qT(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(aM,u),()=>document.removeEventListener(aM,u)),[u]),j.useEffect(()=>{if(c.trigger){const h=f=>{const m=f.target;m!=null&&m.contains(c.trigger)&&u()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,u]),r.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:u,children:r.jsxs(Z2,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(Xce,{children:s}),r.jsx(Yce,{scope:n,isInside:!0,children:r.jsx(Xae,{id:c.contentId,role:"tooltip",children:a||s})})]})})});TV.displayName=ox;var LV="TooltipArrow",Zce=j.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=qT(n);return Kce(LV,n).isInside?null:r.jsx(J2,{...a,...s,ref:t})});Zce.displayName=LV;function Jce(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,a,i)){case i:return"left";case a:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function Qce(e,t,n=5){const s=[];
761switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function ede(e){const{top:t,right:n,bottom:s,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:s},{x:a,y:s}]}function tde(e,t){const{x:n,y:s}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],d=l.x,u=l.y,h=c.x,f=c.y;u>s!=f>s&&n<(h-d)*(s-u)/(f-u)+d&&(a=!a)}return a}function rde(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),nde(t)}function nde(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const a=e[s];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const a=e[s];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var sde=PV,IV=TV;const ade=sde,ide=j.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(IV,{ref:s,sideOffset:t,className:Ge("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...n}));ide.displayName=IV.displayName;var dj=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Cm=typeof window>"u"||"Deno"in globalThis;function Gi(){}function ode(e,t){return typeof e=="function"?e(t):e}function BA(e){return typeof e=="number"&&e>=0&&e!==1/0}function RV(e,t){return Math.max(e+(t||0)-Date.now(),0)}function bh(e,t){return typeof e=="function"?e(t):e}function tl(e,t){return typeof e=="function"?e(t):e}function iM(e,t){const{type:n="all",exact:s,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(s){if(t.queryHash!==VT(o,t.options))return!1}else if(!U0(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function oM(e,t){const{exact:n,status:s,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(B0(t.options.mutationKey)!==B0(i))return!1}else if(!U0(t.options.mutationKey,i))return!1}return!(s&&t.state.status!==s||a&&!a(t))}function VT(e,t){return((t==null?void 0:t.queryKeyHashFn)||B0)(e)}function B0(e){return JSON.stringify(e,(t,n)=>zA(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function U0(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>U0(e[n],t[n])):!1}function MV(e,t){if(e===t)return e;const n=lM(e)&&lM(t);if(n||zA(e)&&zA(t)){const s=n?e:Object.keys(e),a=s.length,i=n?t:Object.keys(t),o=i.length,l=n?[]:{},c=new Set(s);let d=0;for(let u=0;u<o;u++){const h=n?u:i[u];(!n&&c.has(h)||n)&&e[h]===void 0&&t[h]===void 0?(l[h]=void 0,d++):(l[h]=MV(e[h],t[h]),l[h]===e[h]&&e[h]!==void 0&&d++)}return a===o&&d===a?e:l}return t}function UA(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function lM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function zA(e){if(!cM(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!cM(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function cM(e){return Object.prototype.toString.call(e)==="[object Object]"}function lde(e){return new Promise(t=>{setTimeout(t,e)})}function qA(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?MV(e,t):t}function cde(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function dde(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var WT=Symbol();function DV(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===WT?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ude(e,t){return typeof e=="function"?e(...t):!!e}var rm,Ku,Bg,W9,hde=(W9=class extends dj{constructor(){super();vr(this,rm);vr(this,Ku);vr(this,Bg);qt(this,Bg,t=>{if(!Cm&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Pe(this,Ku)||this.setEventListener(Pe(this,Bg))}onUnsubscribe(){var t;this.hasListeners()||((t=Pe(this,Ku))==null||t.call(this),qt(this,Ku,void 0))}setEventListener(t){var n;qt(this,Bg,t),(n=Pe(this,Ku))==null||n.call(this),qt(this,Ku,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){Pe(this,rm)!==t&&(qt(this,rm,t),this.onFocus())}onFocus(){const t=this.isFocused();
vendor: 4,954 bytes, line 761
761this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof Pe(this,rm)=="boolean"?Pe(this,rm):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},rm=new WeakMap,Ku=new WeakMap,Bg=new WeakMap,W9),HT=new hde,Ug,Xu,zg,H9,fde=(H9=class extends dj{constructor(){super();vr(this,Ug,!0);vr(this,Xu);vr(this,zg);qt(this,zg,t=>{if(!Cm&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){Pe(this,Xu)||this.setEventListener(Pe(this,zg))}onUnsubscribe(){var t;this.hasListeners()||((t=Pe(this,Xu))==null||t.call(this),qt(this,Xu,void 0))}setEventListener(t){var n;qt(this,zg,t),(n=Pe(this,Xu))==null||n.call(this),qt(this,Xu,t(this.setOnline.bind(this)))}setOnline(t){Pe(this,Ug)!==t&&(qt(this,Ug,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return Pe(this,Ug)}},Ug=new WeakMap,Xu=new WeakMap,zg=new WeakMap,H9),WN=new fde;function VA(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function s(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{s({status:"fulfilled",value:a}),e(a)},n.reject=a=>{s({status:"rejected",reason:a}),t(a)},n}function mde(e){return Math.min(1e3*2**e,3e4)}function $V(e){return(e??"online")==="online"?WN.isOnline():!0}var FV=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function K4(e){return e instanceof FV}function BV(e){let t=!1,n=0,s=!1,a;const i=VA(),o=p=>{var v;s||(f(new FV(p)),(v=e.abort)==null||v.call(e))},l=()=>{t=!0},c=()=>{t=!1},d=()=>HT.isFocused()&&(e.networkMode==="always"||WN.isOnline())&&e.canRun(),u=()=>$V(e.networkMode)&&e.canRun(),h=p=>{var v;s||(s=!0,(v=e.onSuccess)==null||v.call(e,p),a==null||a(),i.resolve(p))},f=p=>{var v;s||(s=!0,(v=e.onError)==null||v.call(e,p),a==null||a(),i.reject(p))},m=()=>new Promise(p=>{var v;a=g=>{(s||d())&&p(g)},(v=e.onPause)==null||v.call(e)}).then(()=>{var p;a=void 0,s||(p=e.onContinue)==null||p.call(e)}),x=()=>{if(s)return;let p;const v=n===0?e.initialPromise:void 0;try{p=v??e.fn()}catch(g){p=Promise.reject(g)}Promise.resolve(p).then(h).catch(g=>{var C;if(s)return;const y=e.retry??(Cm?0:3),b=e.retryDelay??mde,w=typeof b=="function"?b(n,g):b,_=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,g);if(t||!_){f(g);return}n++,(C=e.onFail)==null||C.call(e,n,g),lde(w).then(()=>d()?void 0:m()).then(()=>{t?f(g):x()})})};return{promise:i,cancel:o,continue:()=>(a==null||a(),i),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?x():m().then(x),i)}}var pde=e=>setTimeout(e,0);function gde(){let e=[],t=0,n=l=>{l()},s=l=>{l()},a=pde;const i=l=>{t?e.push(l):a(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&a(()=>{s(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{s=l},setScheduler:l=>{a=l}}}var Fa=gde(),nm,G9,UV=(G9=class{constructor(){vr(this,nm)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),BA(this.gcTime)&&qt(this,nm,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Cm?1/0:5*60*1e3))}clearGcTimeout(){Pe(this,nm)&&(clearTimeout(Pe(this,nm)),qt(this,nm,void 0))}},nm=new WeakMap,G9),qg,sm,el,am,ri,qb,im,Rl,kd,Y9,xde=(Y9=class extends UV{constructor(t){super();vr(this,Rl);vr(this,qg);vr(this,sm);vr(this,el);vr(this,am);vr(this,ri);vr(this,qb);vr(this,im);qt(this,im,!1),qt(this,qb,t.defaultOptions),this.setOptions(t.options),this.observers=[],qt(this,am,t.client),qt(this,el,Pe(this,am).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,qt(this,qg,vde(this.options)),this.state=t.state??Pe(this,qg),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Pe(this,ri))==null?void 0:t.promise}setOptions(t){this.options={...Pe(this,qb),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Pe(this,el).remove(this)}setData(t,n){const s=qA(this.state.data,t,this.options);return rn(this,Rl,kd).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){rn(this,Rl,kd).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,a;const n=(s=Pe(this,ri))==null?void 0:s.promise;return(a=Pe(this,ri))==null||a.cancel(t),n?n.then(Gi).catch(Gi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Pe(this,qg))}isActive(){return this.observers.some(t=>tl(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===WT||this.state.dataUpdateCount+this.state.errorUpdate
vendor: 1,282 bytes, line 761
761Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>bh(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!RV(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=Pe(this,ri))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=Pe(this,ri))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Pe(this,el).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(Pe(this,ri)&&(Pe(this,im)?Pe(this,ri).cancel({revert:!0}):Pe(this,ri).cancelRetry()),this.scheduleGc()),Pe(this,el).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||rn(this,Rl,kd).call(this,{type:"invalidate"})}
vendor: 6,424 bytes, line 761
761fetch(t,n){var d,u,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Pe(this,ri))return Pe(this,ri).continueRetry(),Pe(this,ri).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const s=new AbortController,a=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(qt(this,im,!0),s.signal)})},i=()=>{const f=DV(this.options,n),x=(()=>{const p={client:Pe(this,am),queryKey:this.queryKey,meta:this.meta};return a(p),p})();return qt(this,im,!1),this.options.persister?this.options.persister(f,x,this):f(x)},l=(()=>{const f={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Pe(this,am),state:this.state,fetchFn:i};return a(f),f})();(d=this.options.behavior)==null||d.onFetch(l,this),qt(this,sm,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&rn(this,Rl,kd).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=f=>{var m,x,p,v;K4(f)&&f.silent||rn(this,Rl,kd).call(this,{type:"error",error:f}),K4(f)||((x=(m=Pe(this,el).config).onError)==null||x.call(m,f,this),(v=(p=Pe(this,el).config).onSettled)==null||v.call(p,this.state.data,f,this)),this.scheduleGc()};return qt(this,ri,BV({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:s.abort.bind(s),onSuccess:f=>{var m,x,p,v;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(g){c(g);return}(x=(m=Pe(this,el).config).onSuccess)==null||x.call(m,f,this),(v=(p=Pe(this,el).config).onSettled)==null||v.call(p,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,m)=>{rn(this,Rl,kd).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{rn(this,Rl,kd).call(this,{type:"pause"})},onContinue:()=>{rn(this,Rl,kd).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),Pe(this,ri).start()}},qg=new WeakMap,sm=new WeakMap,el=new WeakMap,am=new WeakMap,ri=new WeakMap,qb=new WeakMap,im=new WeakMap,Rl=new WeakSet,kd=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...zV(s.data,this.options),fetchMeta:t.meta??null};case"success":return qt(this,sm,void 0),{...s,data:t.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=t.error;return K4(a)&&a.revert&&Pe(this,sm)?{...Pe(this,sm),fetchStatus:"idle"}:{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),Fa.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),Pe(this,el).notify({query:this,type:"updated",action:t})})},Y9);function zV(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$V(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function vde(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ec,K9,yde=(K9=class extends dj{constructor(t={}){super();vr(this,Ec);this.config=t,qt(this,Ec,new Map)}build(t,n,s){const a=n.queryKey,i=n.queryHash??VT(a,n);let o=this.get(i);return o||(o=new xde({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){Pe(this,Ec).has(t.queryHash)||(Pe(this,Ec).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=Pe(this,Ec).get(t.queryHash);n&&(t.destroy(),n===t&&Pe(this,Ec).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fa.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Pe(this,Ec).get(t)}getAll(){return[...Pe(this,Ec).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>iM(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>iM(t,s)):n}notify(t){Fa.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fa.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fa.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Ec=new WeakMap,K9),Tc,yi,om,Oc,Mu,X9,bde=(X9=class extends UV{constructor(t){super();vr(this,Oc);vr(this,Tc);vr(this,yi);vr(this,om);this.mutationId=t.mutationId,qt(this,yi,t.mutationCache),qt(this,Tc,[]),this.state=t.state||jde(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Pe(this,Tc).includes(t)||(Pe(this,Tc).push(t),this.clearGcTimeout(),Pe(this,yi).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){qt(this,Tc,Pe(this,Tc).filter(n=>n!==t)),this.scheduleGc(),Pe(this,yi).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Pe(this,Tc).length||(this.state.status==="pending"?this.scheduleGc():Pe(this,yi).remove(this))}continue(){var t;return((t=Pe(this,om))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,l,c,d,u,h,f,m,x,p,v,g,y,b,w,_,C,E,N;const n=()=>{rn(this,Oc,Mu).call(this,{type:"continue"})};qt(this,om,BV({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,I)=>{rn(this,Oc,Mu).call(this,{type:"failed",failureCount:k,error:I})},onPause:()=>{rn(this,Oc,Mu).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Pe(this,yi).canRun(this)}));const s=this.state.status==="pending",a=!Pe(this,om).canStart();try{if(s)n();
761else{rn(this,Oc,Mu).call(this,{type:"pending",variables:t,isPaused:a}),await((o=(i=Pe(this,yi).config).onMutate)==null?void 0:o.call(i,t,this));const I=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));I!==this.state.context&&rn(this,Oc,Mu).call(this,{type:"pending",context:I,variables:t,isPaused:a})}const k=await Pe(this,om).start();return await((u=(d=Pe(this,yi).config).onSuccess)==null?void 0:u.call(d,k,t,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,k,t,this.state.context)),await((x=(m=Pe(this,yi).config).onSettled)==null?void 0:x.call(m,k,null,this.state.variables,this.state.context,this)),await((v=(p=this.options).onSettled)==null?void 0:v.call(p,k,null,t,this.state.context)),rn(this,Oc,Mu).call(this,{type:"success",data:k}),k}catch(k){try{throw await((y=(g=Pe(this,yi).config).onError)==null?void 0:y.call(g,k,t,this.state.context,this)),await((w=(b=this.options).onError)==null?void 0:w.call(b,k,t,this.state.context)),await((C=(_=Pe(this,yi).config).onSettled)==null?void 0:C.call(_,void 0,k,this.state.variables,this.state.context,this)),await((N=(E=this.options).onSettled)==null?void 0:N.call(E,void 0,k,t,this.state.context)),k}finally{rn(this,Oc,Mu).call(this,{type:"error",error:k})}}finally{Pe(this,yi).runNext(this)}}},Tc=new WeakMap,yi=new WeakMap,om=new WeakMap,Oc=new WeakSet,Mu=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fa.batch(()=>{Pe(this,Tc).forEach(s=>{s.onMutationUpdate(t)}),Pe(this,yi).notify({mutation:this,type:"updated",action:t})})},X9);function jde(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Id,Ml,Vb,Z9,wde=(Z9=class extends dj{constructor(t={}){super();vr(this,Id);vr(this,Ml);vr(this,Vb);this.config=t,qt(this,Id,new Set),qt(this,Ml,new Map),qt(this,Vb,0)}build(t,n,s){const a=new bde({mutationCache:this,mutationId:++Ew(this,Vb)._,options:t.defaultMutationOptions(n),state:s});return this.add(a),a}add(t){Pe(this,Id).add(t);const n=e1(t);if(typeof n=="string"){const s=Pe(this,Ml).get(n);s?s.push(t):Pe(this,Ml).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Pe(this,Id).delete(t)){const n=e1(t);if(typeof n=="string"){const s=Pe(this,Ml).get(n);if(s)if(s.length>1){const a=s.indexOf(t);a!==-1&&s.splice(a,1)}else s[0]===t&&Pe(this,Ml).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=e1(t);if(typeof n=="string"){const s=Pe(this,Ml).get(n),a=s==null?void 0:s.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var s;const n=e1(t);if(typeof n=="string"){const a=(s=Pe(this,Ml).get(n))==null?void 0:s.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fa.batch(()=>{Pe(this,Id).forEach(t=>{this.notify({type:"removed",mutation:t})}),Pe(this,Id).clear(),Pe(this,Ml).clear()})}getAll(){return Array.from(Pe(this,Id))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>oM(n,s))}findAll(t={}){return this.getAll().filter(n=>oM(t,n))}notify(t){Fa.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fa.batch(()=>Promise.all(t.map(n=>n.continue().catch(Gi))))}},Id=new WeakMap,Ml=new WeakMap,Vb=new WeakMap,Z9);function e1(e){var t;return(t=e.options.scope)==null?void 0:t.id}function dM(e){return{onFetch:(t,n)=>{var u,h,f,m,x;const s=t.options,a=(f=(h=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],o=((x=t.state.data)==null?void 0:x.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let p=!1;const v=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)}
vendor: 14,231 bytes, line 761
761)},g=DV(t.options,t.fetchOptions),y=async(b,w,_)=>{if(p)return Promise.reject();if(w==null&&b.pages.length)return Promise.resolve(b);const E=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:w,direction:_?"backward":"forward",meta:t.options.meta};return v(P),P})(),N=await g(E),{maxPages:k}=t.options,I=_?dde:cde;return{pages:I(b.pages,N,k),pageParams:I(b.pageParams,w,k)}};if(a&&i.length){const b=a==="backward",w=b?Nde:uM,_={pages:i,pageParams:o},C=w(s,_);l=await y(_,C,b)}else{const b=e??i.length;do{const w=c===0?o[0]??s.initialPageParam:uM(s,l);if(c>0&&w==null)break;l=await y(l,w),c++}while(c<b)}return l};t.options.persister?t.fetchFn=()=>{var p,v;return(v=(p=t.options).persister)==null?void 0:v.call(p,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function uM(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function Nde(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var Es,Zu,Ju,Vg,Wg,Qu,Hg,Gg,J9,_de=(J9=class{constructor(e={}){vr(this,Es);vr(this,Zu);vr(this,Ju);vr(this,Vg);vr(this,Wg);vr(this,Qu);vr(this,Hg);vr(this,Gg);qt(this,Es,e.queryCache||new yde),qt(this,Zu,e.mutationCache||new wde),qt(this,Ju,e.defaultOptions||{}),qt(this,Vg,new Map),qt(this,Wg,new Map),qt(this,Qu,0)}mount(){Ew(this,Qu)._++,Pe(this,Qu)===1&&(qt(this,Hg,HT.subscribe(async e=>{e&&(await this.resumePausedMutations(),Pe(this,Es).onFocus())})),qt(this,Gg,WN.subscribe(async e=>{e&&(await this.resumePausedMutations(),Pe(this,Es).onOnline())})))}unmount(){var e,t;Ew(this,Qu)._--,Pe(this,Qu)===0&&((e=Pe(this,Hg))==null||e.call(this),qt(this,Hg,void 0),(t=Pe(this,Gg))==null||t.call(this),qt(this,Gg,void 0))}isFetching(e){return Pe(this,Es).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Pe(this,Zu).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Pe(this,Es).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=Pe(this,Es).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(bh(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return Pe(this,Es).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),a=Pe(this,Es).get(s.queryHash),i=a==null?void 0:a.state.data,o=ode(t,i);if(o!==void 0)return Pe(this,Es).build(this,s).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fa.batch(()=>Pe(this,Es).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Pe(this,Es).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=Pe(this,Es);Fa.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=Pe(this,Es);return Fa.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=Fa.batch(()=>Pe(this,Es).findAll(e).map(a=>a.cancel(n)));return Promise.all(s).then(Gi).catch(Gi)}invalidateQueries(e,t={}){return Fa.batch(()=>(Pe(this,Es).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=Fa.batch(()=>Pe(this,Es).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(Gi)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(Gi)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=Pe(this,Es).build(this,t);return n.isStaleByTime(bh(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Gi).catch(Gi)}fetchInfiniteQuery(e){return e.behavior=dM(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Gi).catch(Gi)}ensureInfiniteQueryData(e){return e.behavior=dM(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return WN.isOnline()?Pe(this,Zu).resumePausedMutations():Promise.resolve()}getQueryCache(){return Pe(this,Es)}getMutationCache(){return Pe(this,Zu)}getDefaultOptions(){return Pe(this,Ju)}setDefaultOptions(e){qt(this,Ju,e)}setQueryDefaults(e,t){Pe(this,Vg).set(B0(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Pe(this,Vg).values()],n={};return t.forEach(s=>{U0(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){Pe(this,Wg).set(B0(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Pe(this,Wg).values()],n={};return t.forEach(s=>{U0(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Pe(this,Ju).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=VT(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===WT&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Pe(this,Ju).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Pe(this,Es).clear(),Pe(this,Zu).clear()}},Es=new WeakMap,Zu=new WeakMap,Ju=new WeakMap,Vg=new WeakMap,Wg=new WeakMap,Qu=new WeakMap,Hg=new WeakMap,Gg=new WeakMap,J9),Vi,nn,Wb,bi,lm,Yg,eh,th,Hb,Kg,Xg,cm,dm,rh,Zg,Nn,Dy,WA,HA,GA,YA,KA,XA,ZA,qV,Q9,Sde=(Q9=class extends dj{constructor(t,n){super();vr(this,Nn);vr(this,Vi);vr(this,nn);vr(this,Wb);vr(this,bi);vr(this,lm);vr(this,Yg);vr(this,eh);vr(this,th);vr(this,Hb);vr(this,Kg);vr(this,Xg);vr(this,cm);vr(this,dm);vr(this,rh);vr(this,Zg,new Set);this.options=n,qt(this,Vi,t),qt(this,th,null),qt(this,eh,VA()),this.options.experimental_prefetchInRender||Pe(this,eh).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Pe(this,nn).addObserver(this),hM(Pe(this,nn),this.options)?rn(this,Nn,Dy).call(this):this.updateResult(),rn(this,Nn,YA).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return JA(Pe(this,nn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return JA(Pe(this,nn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,rn(this,Nn,KA).call(this),rn(this,Nn,XA).call(this),Pe(this,nn).removeObserver(this)}setOptions(t){const n=this.options,s=Pe(this,nn);if(this.options=Pe(this,Vi).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof tl(this.options.enabled,Pe(this,nn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");rn(this,Nn,ZA).call(this),Pe(this,nn).setOptions(this.options),n._defaulted&&!UA(this.options,n)&&Pe(this,Vi).getQueryCache().notify({type:"observerOptionsUpdated",query:Pe(this,nn),observer:this});const a=this.hasListeners();a&&fM(Pe(this,nn),s,this.options,n)&&rn(this,Nn,Dy).call(this),this.updateResult(),a&&(Pe(this,nn)!==s||tl(this.options.enabled,Pe(this,nn))!==tl(n.enabled,Pe(this,nn))||bh(this.options.staleTime,Pe(this,nn))!==bh(n.staleTime,Pe(this,nn)))&&rn(this,Nn,WA).call(this);const i=rn(this,Nn,HA).call(this);a&&(Pe(this,nn)!==s||tl(this.options.enabled,Pe(this,nn))!==tl(n.enabled,Pe(this,nn))||i!==Pe(this,rh))&&rn(this,Nn,GA).call(this,i)}getOptimisticResult(t){const n=Pe(this,Vi).getQueryCache().build(Pe(this,Vi),t),s=this.createResult(n,t);return Cde(this,s)&&(qt(this,bi,s),qt(this,Yg,this.options),qt(this,lm,Pe(this,nn).state)),s}getCurrentResult(){return Pe(this,bi)}trackResult(t,n){return new Proxy(t,{get:(s,a)=>(this.trackProp(a),n==null||n(a),Reflect.get(s,a))})}trackProp(t){Pe(this,Zg).add(t)}getCurrentQuery(){return Pe(this,nn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=Pe(this,Vi).defaultQueryOptions(t),s=Pe(this,Vi).getQueryCache().build(Pe(this,Vi),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return rn(this,Nn,Dy).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Pe(this,bi)))}createResult(t,n){var k;const s=Pe(this,nn),a=this.options,i=Pe(this,bi),o=Pe(this,lm),l=Pe(this,Yg),d=t!==s?t.state:Pe(this,Wb),{state:u}=t;let h={...u},f=!1,m;if(n._optimisticResults){const I=this.hasListeners(),P=!I&&hM(t,n),O=I&&fM(t,s,n,a);(P||O)&&(h={...h,...zV(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:x,errorUpdatedAt:p,status:v}=h;m=h.data;let g=!1;if(n.placeholderData!==void 0&&m===void 0&&v==="pending"){let I;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(I=i.data,g=!0):I=typeof n.placeholderData=="function"?n.placeholderData((k=Pe(this,Xg))==null?void 0:k.state.data,Pe(this,Xg)):n.placeholderData,I!==void 0&&(v="success",m=qA(i==null?void 0:i.data,I,n),f=!0)}if(n.select&&m!==void 0&&!g)if(i&&m===(o==null?void 0:o.data)&&n.select===Pe(this,Hb))m=Pe(this,Kg);else try{qt(this,Hb,n.select),m=n.select(m),m=qA(i==null?void 0:i.data,m,n),qt(this,Kg,m),qt(this,th,null)}catch(I){qt(this,th,I)}Pe(this,th)&&(x=Pe(this,th),m=Pe(this,Kg),p=Date.now(),v="error");const y=h.fetchStatus==="fetching",b=v==="pending",w=v==="error",_=b&&y,C=m!==void 0,N={status:v,fetchStatus:h.fetchStatus,isPending:b,isSuccess:v==="success",isError:w,isInitialLoading:_,isLoading:_,data:m,dataUpdatedAt:h.dataUpdatedAt,error:x,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>d.dataUpdateCount||h.errorUpdateCount>d.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:w&&!C,isPaused:h.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:w&&C,isStale:GT(t,n),refetch:this.refetch,promise:Pe(this,eh),isEnabled:tl(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const I=A=>{N.status==="error"?A.reject(N.error):N.data!==void 0&&A.resolve(N.data)},P=()=>{const A=qt(this,eh,N.promise=VA());I(A)},O=Pe(this,eh);switch(O.status){case"pending":t.queryHash===s.queryHash&&I(O);break;case"fulfilled":(N.status==="error"||N.data!==O.value)&&P();break;case"rejected":(N.status!=="error"||N.error!==O.reason)&&P();break}}return N}updateResult(){const t=Pe(this,bi),n=this.createResult(Pe(this,nn),this.options);if(qt(this,lm,Pe(this,nn).state),qt(this,Yg,this.options),Pe(this,lm).data!==void 0&&qt(this,Xg,Pe(this,nn)),UA(n,t))return;qt(this,bi,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!Pe(this,Zg).size)return!0;const o=new Set(i??Pe(this,Zg));return this.options.throwOnError&&o.add("error"),Object.keys(Pe(this,bi)).some(l=>{const c=l;return Pe(this,bi)[c]!==t[c]&&o.has(c)})};rn(this,Nn,qV).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&rn(this,Nn,YA).call(this)}},Vi=new WeakMap,nn=new WeakMap,Wb=new WeakMap,bi=new WeakMap,lm=new WeakMap,Yg=new WeakMap,eh=new WeakMap,th=new WeakMap,Hb=new WeakMap,Kg=new WeakMap,Xg=new WeakMap,cm=new WeakMap,dm=new WeakMap,rh=new WeakMap,Zg=new WeakMap,Nn=new WeakSet,Dy=function(t){rn(this,Nn,ZA).call(this);let n=Pe(this,nn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Gi)),n},WA=function(){rn(this,Nn,KA).call(this);const t=bh(this.options.staleTime,Pe(this,nn));if(Cm||Pe(this,bi).isStale||!BA(t))return;const s=RV(Pe(this,bi).dataUpdatedAt,t)+1;qt(this,cm,setTimeout(()=>{Pe(this,bi).isStale||this.updateResult()},s))},HA=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Pe(this,nn)):this.options.refetchInterval)??!1},GA=function(t){rn(this,Nn,XA).call(this),qt(this,rh,t),!(Cm||tl(this.options.enabled,Pe(this,nn))===!1||!BA(Pe(this,rh))||Pe(this,rh)===0)&&qt(this,dm,setInterval(()=>{(this.options.refetchIntervalInBackground||HT.isFocused())&&rn(this,Nn,Dy).call(this)},Pe(this,rh)))},YA=function(){rn(this,Nn,WA).call(this),rn(this,Nn,GA).call(this,rn(this,Nn,HA).call(this))},KA=function(){Pe(this,cm)&&(clearTimeout(Pe(this,cm)),qt(this,cm,void 0))},XA=function(){Pe(this,dm)&&(clearInterval(Pe(this,dm)),qt(this,dm,void 0))},ZA=function(){const t=Pe(this,Vi).getQueryCache().build(Pe(this,Vi),this.options);if(t===Pe(this,nn))return;const n=Pe(this,nn);qt(this,nn,t),qt(this,Wb,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},qV=function(t){Fa.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(Pe(this,bi))}),Pe(this,Vi).getQueryCache().notify({query:Pe(this,nn),type:"observerResultsUpdated"})})},Q9);function kde(e,t){return tl(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function hM(e,t){return kde(e,t)||e.state.data!==void 0&&JA(e,t,t.refetchOnMount)}function JA(e,t,n){if(tl(t.enabled,e)!==!1&&bh(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&>(e,t)}return!1}function fM(e,t,n,s){return(e!==t||tl(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&>(e,n)}function GT(e,t){return tl(t.enabled,e)!==!1&&e.isStaleByTime(bh(t.staleTime,e))}function Cde(e,t){return!UA(e.getCurrentResult(),t)}var VV=j.createContext(void 0),Ade=e=>{const t=j.useContext(VV);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Pde=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(VV.Provider,{value:e,children:t})),WV=j.createContext(!1),Ede=()=>j.useContext(WV);WV.Provider;function Tde(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}
761var Ode=j.createContext(Tde()),Lde=()=>j.useContext(Ode),Ide=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Rde=e=>{j.useEffect(()=>{e.clearReset()},[e])},Mde=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(a&&e.data===void 0||ude(n,[e.error,s])),Dde=e=>{if(e.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>t(n(...s)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},$de=(e,t)=>e.isLoading&&e.isFetching&&!t,Fde=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,mM=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Bde(e,t,n){var h,f,m,x,p;const s=Ede(),a=Lde(),i=Ade(),o=i.defaultQueryOptions(e);(f=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||f.call(h,o),o._optimisticResults=s?"isRestoring":"optimistic",Dde(o),Ide(o,a),Rde(a);const l=!i.getQueryCache().get(o.queryHash),[c]=j.useState(()=>new t(i,o)),d=c.getOptimisticResult(o),u=!s&&e.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(v=>{const g=u?c.subscribe(Fa.batchCalls(v)):Gi;return c.updateResult(),g},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),j.useEffect(()=>{c.setOptions(o)},[o,c]),Fde(o,d))throw mM(o,c,a);if(Mde({result:d,errorResetBoundary:a,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw d.error;if((x=(m=i.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||x.call(m,o,d),o.experimental_prefetchInRender&&!Cm&&$de(d,s)){const v=l?mM(o,c,a):(p=i.getQueryCache().get(o.queryHash))==null?void 0:p.promise;v==null||v.catch(Gi).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function Ude(e,t){return Bde(e,Sde)}/** 762 * @remix-run/router v1.23.0 763 * 764 * Copyright (c) Remix Software Inc. 765 * 766 * This source code is licensed under the MIT license found in the 767 * LICENSE.md file in the root directory of this source tree. 768 * 769 * @license MIT 770 */function z0(){return z0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},z0.apply(this,arguments)}var ih;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(ih||(ih={}));const pM="popstate";function zde(e){e===void 0&&(e={});function t(s,a){let{pathname:i,search:o,hash:l}=s.location;return QA("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(s,a){return typeof a=="string"?a:HN(a)}return Vde(t,n,null,e)}function Vs(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function HV(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function qde(){return Math.random().toString(36).substr(2,8)}function gM(e,t){return{usr:e.state,key:e.key,idx:t}}function QA(e,t,n,s){return n===void 0&&(n=null),z0({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?sv(t):t,{state:n,key:t&&t.key||s||qde()})}function HN(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function sv(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function Vde(e,t,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:i=!1}=s,o=a.history,l=ih.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(z0({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function h(){l=ih.Pop;let v=u(),g=v==null?null:v-d;d=v,c&&c({action:l,location:p.location,delta:g})}function f(v,g){l=ih.Push;let y=QA(p.location,v,g);d=u()+1;let b=gM(y,d),w=p.createHref(y);try{o.pushState(b,"",w)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;a.location.assign(w)}i&&c&&c({action:l,location:p.location,delta:1})}function m(v,g){l=ih.Replace;let y=QA(p.location,v,g);d=u();let b=gM(y,d),w=p.createHref(y);o.replaceState(b,"",w),i&&c&&c({action:l,location:p.location,delta:0})}function x(v){let g=a.location.origin!=="null"?a.location.origin:a.location.href,y=typeof v=="string"?v:HN(v);return y=y.replace(/ $/,"%20"),Vs(g,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,g)}let p={get action(){return l},get location(){return e(a,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(pM,h),c=v,()=>{a.removeEventListener(pM,h),c=null}},createHref(v){return t(a,v)},createURL:x,encodeLocation(v){let g=x(v);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:m,go(v){return o.go(v)}};return p}var xM;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(xM||(xM={}));function Wde(e,t,n){return n===void 0&&(n="/"),Hde(e,t,n,!1)}function Hde(e,t,n,s){let a=typeof t=="string"?sv(t):t,i=YT(a.pathname||"/",n);if(i==null)return null;let o=GV(e);Gde(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=sue(i);l=rue(o[c],d,s)}return l}function GV(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let a=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Vs(c.relativePath.startsWith(s),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+s+'" is not val
770id. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(s.length));let d=jh([s,c.relativePath]),u=n.concat(c);i.children&&i.children.length>0&&(Vs(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),GV(i.children,t,u,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:eue(d,i.index),routesMeta:u})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of YV(i.path))a(i,o,c)}),t}function YV(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return a?[i,""]:[i];let o=YV(s.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Gde(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:tue(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const Yde=/^:[\w-]+$/,Kde=3,Xde=2,Zde=1,Jde=10,Qde=-2,vM=e=>e==="*";function eue(e,t){let n=e.split("/"),s=n.length;return n.some(vM)&&(s+=Qde),t&&(s+=Xde),n.filter(a=>!vM(a)).reduce((a,i)=>a+(Yde.test(i)?Kde:i===""?Zde:Jde),s)}function tue(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function rue(e,t,n){let{routesMeta:s}=e,a={},i="/",o=[];for(let l=0;l<s.length;++l){let c=s[l],d=l===s.length-1,u=i==="/"?t:t.slice(i.length)||"/",h=yM({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),f=c.route;if(!h&&d&&n&&!s[s.length-1].route.index&&(h=yM({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!h)return null;
vendor: 9,301 bytes, lines 770-779
770Object.assign(a,h.params),o.push({params:a,pathname:jh([i,h.pathname]),pathnameBase:lue(jh([i,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(i=jh([i,h.pathnameBase]))}return o}function yM(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=nue(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:s.reduce((d,u,h)=>{let{paramName:f,isOptional:m}=u;if(f==="*"){let p=l[h]||"";o=i.slice(0,i.length-p.length).replace(/(.)\/+$/,"$1")}const x=l[h];return m&&!x?d[f]=void 0:d[f]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function nue(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),HV(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 s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(s.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function sue(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return HV(!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 YT(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}function aue(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?sv(e):e;return{pathname:n?n.startsWith("/")?n:iue(n,t):t,search:cue(s),hash:due(a)}}function iue(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function X4(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function oue(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function KT(e,t){let n=oue(e);return t?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function XT(e,t,n,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=sv(e):(a=z0({},e),Vs(!a.pathname||!a.pathname.includes("?"),X4("?","pathname","search",a)),Vs(!a.pathname||!a.pathname.includes("#"),X4("#","pathname","hash",a)),Vs(!a.search||!a.search.includes("#"),X4("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=n;else{let h=t.length-1;if(!s&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;a.pathname=f.join("/")}l=h>=0?t[h]:"/"}let c=aue(a,l),d=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const jh=e=>e.join("/").replace(/\/\/+/g,"/"),lue=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),cue=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,due=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function uue(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const KV=["post","put","patch","delete"];new Set(KV);const hue=["get",...KV];new Set(hue);/** 771 * React Router v6.30.1 772 * 773 * Copyright (c) Remix Software Inc. 774 * 775 * This source code is licensed under the MIT license found in the 776 * LICENSE.md file in the root directory of this source tree. 777 * 778 * @license MIT 779 */function q0(){return q0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},q0.apply(this,arguments)}const ZT=j.createContext(null),fue=j.createContext(null),Hh=j.createContext(null),tS=j.createContext(null),ou=j.createContext({outlet:null,matches:[],isDataRoute:!1}),XV=j.createContext(null);function mue(e,t){let{relative:n}=t===void 0?{}:t;av()||Vs(!1);let{basename:s,navigator:a}=j.useContext(Hh),{hash:i,pathname:o,search:l}=JV(e,{relative:n}),c=o;return s!=="/"&&(c=o==="/"?s:jh([s,o])),a.createHref({pathname:c,search:l,hash:i})}function av(){return j.useContext(tS)!=null}function Ri(){return av()||Vs(!1),j.useContext(tS).location}function ZV(e){j.useContext(Hh).static||j.useLayoutEffect(e)}function zn(){let{isDataRoute:e}=j.useContext(ou);return e?Cue():pue()}function pue(){av()||Vs(!1);let e=j.useContext(ZT),{basename:t,future:n,navigator:s}=j.useContext(Hh),{matches:a}=j.useContext(ou),{pathname:i}=Ri(),o=JSON.stringify(KT(a,n.v7_relativeSplatPath)),l=j.useRef(!1);return ZV(()=>{l.current=!0}),j.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){s.go(d);return}let h=XT(d,JSON.parse(o),i,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:jh([t,h.pathname])),(u.replace?s.replace:s.push)(h,u.state,u)},[t,s,o,i,e])}function iv(){let{matches:e}=j.useContext(ou),t=e[e.length-1];return t?t.params:{}}function JV(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=j.useContext(Hh),{matches:a}=j.useContext(ou),{pathname:i}=Ri(),o=JSON.stringify(KT(a,s.v7_relativeSplatPath));return j.useMemo(()=>XT(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function gue(e,t){return xue(e,t)}function xue(e,t,n,s){av()||Vs(!1);let{navigator:a}=j.useContext(Hh),{matches:i}=j.useContext(ou),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=Ri(),u;if(t){var h;let v=typeof t=="string"?sv(t):t;c==="/"||(h=v.pathname)!=null&&h.startsWith(c)||Vs(!1),u=v}else u=d;let f=u.pathname||"/",m=f;if(c!=="/"){let v=c.replace(/^\//,"").split("/");m="/"+f.replace(/^\//,"").split("/").slice(v.length).join("/")}let x=Wde(e,{pathname:m}),p=wue(x&&x.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:jh([c,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:jh([c,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,s);return t&&p?j.createElement(tS.Provider,{value:{location:q0({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:ih.Pop}},p):p}function vue(){let e=kue(),t=uue(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return j.createElement(j.Fragment,null,j.createElement("h2",null,"Unexpected Application Error!"),j.createElement("h3",{style:{fontStyle:"italic"}},t),n?j.createElement("pre",{style:a},n):null,null)}const yue=j.createElement(vue,null);class bue extends j.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,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?j.createElement(ou.Provider,{value:this.props.routeContext},j.createElement(XV.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function jue(e){let{routeContext:t,match:n,children:s}=e,a=j.useContext(ZT);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),j.createElement(ou.Provider,{value:t},s)}function wue(e,t,n,s){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=s)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(a=n)==null?void 0:a.errors;if(l!=null){let u=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);u>=0||Vs(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,d=-1;if(n&&s&&s.v7_partialHydration)for(let u=0;u<o.length;u++){let h=o[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(d=u),h.route.id){let{loaderData:f,errors:m}=n,x=h.route.loader&&f[h.route.id]===void 0&&(!m||m[h.route.id]===void 0);if(h.route.lazy||x){c=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((u,h,f)=>{let m,x=!1,p=null,v=null;n&&(m=l&&h.route.id?l[h.route.id]:void 0,p=h.route.errorElement||yue,c&&(d<0&&f===0?(x=!0,v=null):d===f&&(x=!0,v=h.route.hydrateFallbackElement||null)));let g=t.concat(o.slice(0,f+1)),y=()=>{let b;return m?b=p:x?b=v:h.route.Component?b=j.createElement(h.route.Component,null):h.route.element?b=h.route.element:b=u,j.createElement(jue,{match:h,routeC
779ontext:{outlet:u,matches:g,isDataRoute:n!=null},children:b})};return n&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?j.createElement(bue,{location:n.location,revalidation:n.revalidation,component:p,error:m,children:y(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):y()},null)}var QV=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(QV||{}),GN=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}(GN||{});function Nue(e){let t=j.useContext(ZT);return t||Vs(!1),t}function _ue(e){let t=j.useContext(fue);return t||Vs(!1),t}function Sue(e){let t=j.useContext(ou);return t||Vs(!1),t}function eW(e){let t=Sue(),n=t.matches[t.matches.length-1];return n.route.id||Vs(!1),n.route.id}function kue(){var e;let t=j.useContext(XV),n=_ue(GN.UseRouteError),s=eW(GN.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function Cue(){let{router:e}=Nue(QV.UseNavigateStable),t=eW(GN.UseNavigateStable),n=j.useRef(!1);return ZV(()=>{n.current=!0}),j.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,q0({fromRouteId:t},i)))},[e,t])}function Aue(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function V0(e){let{to:t,replace:n,state:s,relative:a}=e;av()||Vs(!1);let{future:i,static:o}=j.useContext(Hh),{matches:l}=j.useContext(ou),{pathname:c}=Ri(),d=zn(),u=XT(t,KT(l,i.v7_relativeSplatPath),c,a==="path"),h=JSON.stringify(u);return j.useEffect(()=>d(JSON.parse(h),{replace:n,state:s,relative:a}),[d,h,a,n,s]),null}function Rr(e){Vs(!1)}function Pue(e){let{basename:t="/",children:n=null,location:s,navigationType:a=ih.Pop,navigator:i,static:o=!1,future:l}=e;av()&&Vs(!1);let c=t.replace(/^\/*/,"/"),d=j.useMemo(()=>({basename:c,navigator:i,static:o,future:q0({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof s=="string"&&(s=sv(s));let{pathname:u="/",search:h="",hash:f="",state:m=null,key:x="default"}=s,p=j.useMemo(()=>{let v=YT(u,c);return v==null?null:{location:{pathname:v,search:h,hash:f,state:m,key:x},navigationType:a}},[c,u,h,f,m,x,a]);return p==null?null:j.createElement(Hh.Provider,{value:d},j.createElement(tS.Provider,{children:n,value:p}))}function Eue(e){let{children:t,location:n}=e;return gue(eP(t),n)}new Promise(()=>{});function eP(e,t){t===void 0&&(t=[]);let n=[];return j.Children.forEach(e,(s,a)=>{if(!j.isValidElement(s))return;let i=[...t,a];if(s.type===j.Fragment){n.push.apply(n,eP(s.props.children,i));return}s.type!==Rr&&Vs(!1),!s.props.index||!s.props.children||Vs(!1);let o={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(o.children=eP(s.props.children,i)),n.push(o)}),n}/** 780 * React Router DOM v6.30.1 781 * 782 * Copyright (c) Remix Software Inc. 783 * 784 * This source code is licensed under the MIT license found in the 785 * LICENSE.md file in the root directory of this source tree. 786 * 787 * @license MIT 788 */function tP(){return tP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},tP.apply(this,arguments)}function Tue(e,t){if(e==null)return{};var n={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Oue(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Lue(e,t){return e.button===0&&(!t||t==="_self")&&!Oue(e)}function rP(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function Iue(e,t){let n=rP(e);return t&&t.forEach((s,a)=>
788{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}const Rue=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Mue="6";try{window.__reactRouterVersion=Mue}catch{}const Due="startTransition",bM=LE[Due];function $ue(e){let{basename:t,children:n,future:s,window:a}=e,i=j.useRef();i.current==null&&(i.current=zde({window:a,v5Compat:!0}));let o=i.current,[l,c]=j.useState({action:o.action,location:o.location}),{v7_startTransition:d}=s||{},u=j.useCallback(h=>{d&&bM?bM(()=>c(h)):c(h)},[c,d]);return j.useLayoutEffect(()=>o.listen(u),[o,u]),j.useEffect(()=>Aue(s),[s]),j.createElement(Pue,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:s})}const Fue=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Bue=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Vt=j.forwardRef(function(t,n){let{onClick:s,relative:a,reloadDocument:i,replace:o,state:l,target:c,to:d,preventScrollReset:u,viewTransition:h}=t,f=Tue(t,Rue),{basename:m}=j.useContext(Hh),x,p=!1;if(typeof d=="string"&&Bue.test(d)&&(x=d,Fue))try{let b=new URL(window.location.href),w=d.startsWith("//")?new URL(b.protocol+d):new URL(d),_=YT(w.pathname,m);w.origin===b.origin&&_!=null?d=_+w.search+w.hash:p=!0}catch{}let v=mue(d,{relative:a}),g=Uue(d,{replace:o,state:l,target:c,preventScrollReset:u,relative:a,viewTransition:h});function y(b){s&&s(b),b.defaultPrevented||g(b)}return j.createElement("a",tP({},f,{href:x||v,onClick:p||i?s:y,ref:n,target:c}))});var jM;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(jM||(jM={}));var wM;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(wM||(wM={}));function Uue(e,t){let{target:n,replace:s,state:a,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=zn(),d=Ri(),u=JV(e,{relative:o});return j.useCallback(h=>{if(Lue(h,n)){h.preventDefault();let f=s!==void 0?s:HN(d)===HN(u);c(e,{replace:f,state:a,preventScrollReset:i,relative:o,viewTransition:l})}},[d,c,u,s,a,n,e,i,o,l])}function JT(e){let t=j.useRef(rP(e)),n=j.useRef(!1),s=Ri(),a=j.useMemo(()=>Iue(s.search,n.current?null:t.current),[s.search]),i=zn(),o=j.useCallback((l,c)=>{const d=rP(typeof l=="function"?l(a):l);n.current=!0,i("?"+d,c)},[i,a]);return[a,o]}const zue="modulepreload",que=function(e){return"/"+e},NM={},Vc=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));a=Promise.allSettled(n.map(c=>{if(c=que(c),c in NM)return;NM[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":zue,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((f,m)=>{h.addEventListener("load",f),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Vue=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Vc(async()=>{const{default:s}=await Promise.resolve().then(()=>ov);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)};class QT extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}}class Wue extends QT{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class _M extends QT{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class SM extends QT{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var nP;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(nP||(nP={}));var Hue=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}
788return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};class Gue{constructor(t,{headers:n={},customFetch:s,region:a=nP.Any}={}){this.url=t,this.headers=n,this.region=a,this.fetch=Vue(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t,n={}){var s;return Hue(this,void 0,void 0,function*(){try{const{headers:a,method:i,body:o}=n;let l={},{region:c}=n;c||(c=this.region);const d=new URL(`${this.url}/${t}`);c&&c!=="any"&&(l["x-region"]=c,d.searchParams.set("forceFunctionRegion",c));let u;o&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",u=o):typeof o=="string"?(l["Content-Type"]="text/plain",u=o):typeof FormData<"u"&&o instanceof FormData?u=o:(l["Content-Type"]="application/json",u=JSON.stringify(o)));const h=yield this.fetch(d.toString(),{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),a),body:u}).catch(p=>{throw new Wue(p)}),f=h.headers.get("x-relay-error");if(f&&f==="true")throw new _M(h);if(!h.ok)throw new SM(h);let m=((s=h.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return m==="application/json"?x=yield h.json():m==="application/octet-stream"?x=yield h.blob():m==="text/event-stream"?x=h:m==="multipart/form-data"?x=yield h.formData():x=yield h.text(),{data:x,error:null,response:h}}catch(a){return{data:null,error:a,response:a instanceof SM||a instanceof _M?a.context:void 0}}})}}var Ki={},eO={},rS={},uj={},nS={},sS={},Yue=function(){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")},lx=Yue();const Kue=lx.fetch,tW=lx.fetch.bind(lx),rW=lx.Headers,Xue=lx.Request,Zue=lx.Response,ov=Object.freeze(Object.defineProperty({__proto__:null,Headers:rW,Request:Xue,Response:Zue,default:tW,fetch:Kue},Symbol.toStringTag,{value:"Module"})),Jue=Xre(ov);var aS={};Object.defineProperty(aS,"__esModule",{value:!0});let Que=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.co
788de=t.code}};aS.default=Que;var nW=oi&&oi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sS,"__esModule",{value:!0});const ehe=nW(Jue),the=nW(aS);let rhe=class{constructor(t){var n,s;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(n=t.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=t.signal,this.isMaybeSingle=(s=t.isMaybeSingle)!==null&&s!==void 0?s:!1,t.fetch?this.fetch=t.fetch:typeof fetch>"u"?this.fetch=ehe.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,n){return this.headers=new Headers(this.headers),this.headers.set(t,n),this}then(t,n){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const s=this.fetch;let a=s(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,l,c,d;let u=null,h=null,f=null,m=i.status,x=i.statusText;if(i.ok){if(this.method!=="HEAD"){const y=await i.text();y===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?h=y:h=JSON.parse(y))}const v=(l=this.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),g=(c=i.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");v&&g&&g.length>1&&(f=parseInt(g[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(h)&&(h.length>1?(u={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,f=null,m=406,x="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{const v=await i.text();try{u=JSON.parse(v),Array.isArray(u)&&i.status===404&&(h=[],u=null,m=200,x="OK")}catch{i.status===404&&v===""?(m=204,x="No Content"):u={message:v}}if(u&&this.isMaybeSingle&&(!((d=u==null?void 0:u.details)===null||d===void 0)&&d.includes("0 rows"))&&(u=null,m=200,x="OK"),u&&this.shouldThrowOnError)throw new the.default(u)}return{error:u,data:h,count:f,status:m,statusText:x}});return this.shouldThrowOnError||(a=a.catch(i=>{var o,l,c;return{error:{message:`${(o=i==null?void 0:i.name)!==null&&o!==void 0?o:"FetchError"}: ${i==null?void 0:i.message}`,details:`${(l=i==null?void 0:i.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=i==null?void 0:i.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),a.then(t,n)}returns(){return this}overrideTypes(){return this}};sS.default=rhe;var nhe=oi&&oi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nS,"__esModule",{value:!0});const she=nhe(sS);let ahe=class extends she.default{select(t){let n=!1;const s=(t??"*").split("").map(a=>/\s/.test(a)&&!n?"":(a==='"'&&(n=!n),a)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:n=!0,nullsFirst:s,foreignTable:a,referencedTable:i=a}={}){const o=i?`${i}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${t}.${n?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:n,referencedTable:s=n}={}){const a=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(a,`${t}`),this}range(t,n,{foreignTable:s,referencedTable:a=s}={}){const i=typeof a>"u"?"offset":`${a}.offset`,o=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(o,`${n-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
788explain({analyze:t=!1,verbose:n=!1,settings:s=!1,buffers:a=!1,wal:i=!1,format:o="text"}={}){var l;const c=[t?"analyze":null,n?"verbose":null,s?"settings":null,a?"buffers":null,i?"wal":null].filter(Boolean).join("|"),d=(l=this.headers.get("Accept"))!==null&&l!==void 0?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${d}"; options=${c};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};nS.default=ahe;var ihe=oi&&oi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uj,"__esModule",{value:!0});const ohe=ihe(nS);let lhe=class extends ohe.default{eq(t,n){return this.url.searchParams.append(t,`eq.${n}`),this}neq(t,n){return this.url.searchParams.append(t,`neq.${n}`),this}gt(t,n){return this.url.searchParams.append(t,`gt.${n}`),this}gte(t,n){return this.url.searchParams.append(t,`gte.${n}`),this}lt(t,n){return this.url.searchParams.append(t,`lt.${n}`),this}lte(t,n){return this.url.searchParams.append(t,`lte.${n}`),this}like(t,n){return this.url.searchParams.append(t,`like.${n}`),this}likeAllOf(t,n){return this.url.searchParams.append(t,`like(all).{${n.join(",")}}`),this}likeAnyOf(t,n){return this.url.searchParams.append(t,`like(any).{${n.join(",")}}`),this}ilike(t,n){return this.url.searchParams.append(t,`ilike.${n}`),this}ilikeAllOf(t,n){return this.url.searchParams.append(t,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(t,n){return this.url.searchParams.append(t,`ilike(any).{${n.join(",")}}`),this}is(t,n){return this.url.searchParams.append(t,`is.${n}`),this}in(t,n){const s=Array.from(new Set(n)).map(a=>typeof a=="string"&&new RegExp("[,()]").test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(t,`in.(${s})`),this}contains(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cs.{${n.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(n)}`),this}containedBy(t,n){return typeof n=="string"?this.url.searchParams.append(t,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(t,`cd.{${n.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(n)}`),this}rangeGt(t,n){return this.url.searchParams.append(t,`sr.${n}`),this}rangeGte(t,n){return this.url.searchParams.append(t,`nxl.${n}`),this}rangeLt(t,n){return this.url.searchParams.append(t,`sl.${n}`),this}rangeLte(t,n){return this.url.searchParams.append(t,`nxr.${n}`),this}rangeAdjacent(t,n){return this.url.searchParams.append(t,`adj.${n}`),this}overlaps(t,n){return typeof n=="string"?this.url.searchParams.append(t,`ov.${n}`):this.url.searchParams.append(t,`ov.{${n.join(",")}}`),this}textSearch(t,n,{config:s,type:a}={}){let i="";a==="plain"?i="pl":a==="phrase"?i="ph":a==="websearch"&&(i="w");const o=s===void 0?"":`(${s})`;return this.url.searchParams.append(t,`${i}fts${o}.${n}`),this}match(t){return Object.entries(t).forEach(([n,s])=>{this.url.searchParams.append(n,`eq.${s}`)}),this}not(t,n,s){return this.url.searchParams.append(t,`not.${n}.${s}`),this}or(t,{foreignTable:n,referencedTable:s=n}={}){const a=s?`${s}.or`:"or";return this.url.searchParams.append(a,`(${t})`),this}filter(t,n,s){return this.url.searchParams.append(t,`${n}.${s}`),this}};uj.default=lhe;var che=oi&&oi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(rS,"__esModule",{value:!0});const dy=che(uj);let dhe=class{constructor(t,{headers:n={},schema:s,fetch:a}){this.url=t,this.headers=new Headers(n),this.schema=s,this.fetch=a}select(t,{head:n=!1,count:s}={}){const a=n?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",o),s&&this.headers.append("Prefer",`count=${s}`),new dy.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:n,defaultToNull:s=!0}={}){var a;const i="POST";if(n&&this.headers.append("Prefer",`count=${n}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const o=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new dy.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(t,{onConflict:n,ignoreDuplicates:s=!1,count:a,defaultToNull:i=!0}={}){var o;const l="POST";if(this.headers.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),a&&this.headers.append("Prefer",`count=${a}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((d,u)=>d.concat(Object.keys(u)),[]);if(c.length>0){const d=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",d.join(","))}}return new dy.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(t,{count:n}={}){var s;const a="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new dy.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}delete({count:t}={}){var n;const s="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new dy.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};rS.default=dhe;
788var sW=oi&&oi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(eO,"__esModule",{value:!0});const uhe=sW(rS),hhe=sW(uj);let fhe=class aW{constructor(t,{headers:n={},schema:s,fetch:a}={}){this.url=t,this.headers=new Headers(n),this.schemaName=s,this.fetch=a}from(t){const n=new URL(`${this.url}/${t}`);return new uhe.default(n,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new aW(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,n={},{head:s=!1,get:a=!1,count:i}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let d;s||a?(l=s?"HEAD":"GET",Object.entries(n).filter(([h,f])=>f!==void 0).map(([h,f])=>[h,Array.isArray(f)?`{${f.join(",")}}`:`${f}`]).forEach(([h,f])=>{c.searchParams.append(h,f)})):(l="POST",d=n);const u=new Headers(this.headers);return i&&u.set("Prefer",`count=${i}`),new hhe.default({method:l,url:c,headers:u,schema:this.schemaName,body:d,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};eO.default=fhe;var lv=oi&&oi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.PostgrestError=Ki.PostgrestBuilder=Ki.PostgrestTransformBuilder=Ki.PostgrestFilterBuilder=Ki.PostgrestQueryBuilder=Ki.PostgrestClient=void 0;const iW=lv(eO);Ki.PostgrestClient=iW.default;const oW=lv(rS);Ki.PostgrestQueryBuilder=oW.default;const lW=lv(uj);Ki.PostgrestFilterBuilder=lW.default;const cW=lv(nS);Ki.PostgrestTransformBuilder=cW.default;const dW=lv(sS);Ki.PostgrestBuilder=dW.default;const uW=lv(aS);Ki.PostgrestError=uW.default;var mhe=Ki.default={PostgrestClient:iW.default,PostgrestQueryBuilder:oW.default,PostgrestFilterBuilder:lW.default,PostgrestTransformBuilder:cW.default,PostgrestBuilder:dW.default,PostgrestError:uW.default};const{PostgrestClient:phe,PostgrestQueryBuilder:EJe,PostgrestFilterBuilder:TJe,PostgrestTransformBuilder:OJe,PostgrestBuilder:LJe,PostgrestError:IJe}=mhe;class ghe{static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"&&process.versions&&process.versions.node){const n=parseInt(process.versions.node.split(".")[0]);return n>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${n} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${n} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: 789import ws from "ws" 790new RealtimeClient(url, { transport: ws })`}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=` 791 792Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const s=this.getWebSocketConstructor();return new s(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const xhe="2.15.4",vhe=`realtime-js/${xhe}`,yhe="1.0.0",sP=1e4,bhe=1e3,jhe=100;var r0;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(r0||(r0={}));var da;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(da||(da={}));var $l;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})($l||($l={}));var aP;(function(e){e.websocket="websocket"})(aP||(aP={}));var Bf;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Bf||(Bf={}));class whe{constructor(){this.HEADER_LENGTH=1}decode(t,n){return t.constructor===ArrayBuffer?n(this._binaryDecode(t)):n(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const n=new DataView(t),s=new TextDecoder;return this._decodeBroadcast(t,n,s)}_decodeBroadcast(t,n,s){const a=n.getUint8(1),i=n.getUint8(2);let o=this.HEADER_LENGTH+2;const l=s.decode(t.slice(o,o+a));o=o+a;const c=s.decode(t.slice(o,o+i));o=o+i;const d=JSON.parse(s.decode(t.slice(o,t.byteLength)));return{ref:null,topic:l,event:c,payload:d}}}
792class hW{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Gn;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Gn||(Gn={}));const kM=(e,t,n={})=>{var s;const a=(s=n.skipTypes)!==null&&s!==void 0?s:[];return Object.keys(t).reduce((i,o)=>(i[o]=Nhe(o,e,t,a),i),{})},Nhe=(e,t,n,s)=>{const a=t.find(l=>l.name===e),i=a==null?void 0:a.type,o=n[e];return i&&!s.includes(i)?fW(i,o):iP(o)},fW=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Che(t,n)}switch(e){case Gn.bool:return _he(t);case Gn.float4:case Gn.float8:case Gn.int2:case Gn.int4:case Gn.int8:case Gn.numeric:case Gn.oid:return She(t);case Gn.json:case Gn.jsonb:return khe(t);case Gn.timestamp:return Ahe(t);case Gn.abstime:case Gn.date:case Gn.daterange:case Gn.int4range:case Gn.int8range:case Gn.money:case Gn.reltime:case Gn.text:case Gn.time:case Gn.timestamptz:case Gn.timetz:case Gn.tsrange:case Gn.tstzrange:return iP(t);default:return iP(t)}},iP=e=>e,_he=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},She=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},khe=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},Che=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,s=e[n];if(e[0]==="{"&&s==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>fW(t,l))}return e},Ahe=e=>typeof e=="string"?e.replace(" ","T"):e,mW=e=>{let t=e;return t=t.replace(/^ws/i,"http"),t=t.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),t.replace(/\/+$/,"")+"/api/broadcast"};class Z4{constructor(t,n,s={},a=sP){this.channel=t,this.event=n,this.payload=s,this.timeout=a,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var s;return this._hasReceived(t)&&n((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var CM;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(CM||(CM={}));class n0{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=n0.syncState(this.state,a,i,o),this.pendingDiffs.forEac
792h(c=>{this.state=n0.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(s.diff,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=n0.syncDiff(this.state,a,i,o),l())}),this.onJoin((a,i,o)=>{this.channel._trigger("presence",{event:"join",key:a,currentPresences:i,newPresences:o})}),this.onLeave((a,i,o)=>{this.channel._trigger("presence",{event:"leave",key:a,currentPresences:i,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,s,a){const i=this.cloneDeep(t),o=this.transformState(n),l={},c={};return this.map(i,(d,u)=>{o[d]||(c[d]=u)}),this.map(o,(d,u)=>{const h=i[d];if(h){const f=u.map(v=>v.presence_ref),m=h.map(v=>v.presence_ref),x=u.filter(v=>m.indexOf(v.presence_ref)<0),p=h.filter(v=>f.indexOf(v.presence_ref)<0);x.length>0&&(l[d]=x),p.length>0&&(c[d]=p)}else l[d]=u}),this.syncDiff(i,{joins:l,leaves:c},s,a)}static syncDiff(t,n,s,a){const{joins:i,leaves:o}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),a||(a=()=>{}),this.map(i,(l,c)=>{var d;const u=(d=t[l])!==null&&d!==void 0?d:[];if(t[l]=this.cloneDeep(c),u.length>0){const h=t[l].map(m=>m.presence_ref),f=u.filter(m=>h.indexOf(m.presence_ref)<0);t[l].unshift(...f)}s(l,u,c)}),this.map(o,(l,c)=>{let d=t[l];if(!d)return;const u=c.map(h=>h.presence_ref);d=d.filter(h=>u.indexOf(h.presence_ref)<0),t[l]=d,a(l,d,c),d.length===0&&delete t[l]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(s=>n(s,t[s]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,s)=>{const a=t[s];return"metas"in a?n[s]=a.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):n[s]=a,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var AM;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(AM||(AM={}));var s0;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(s0||(s0={}));var Pd;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Pd||(Pd={}));class tO{constructor(t,n={config:{}},s){this.topic=t,this.params=n,this.socket=s,this.bindings={},this.state=da.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new Z4(this,$l.join,this.params,this.timeout),this.rejoinTimer=new hW(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=da.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=da.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=da.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=da.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=da.errored,this.rejoinTimer.scheduleTimeout())}),this._on($l.reply,{},(a,i)=>{this._trigger(this._replyEventName(i),a)}),this.presence=new n0(this),this.broadcastEndpointURL=mW(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(t,n=this.timeout){var s,a,i;if(this.socket.isConnected()||this.socket.connect(),this.state==da.closed){const{config:{broadcast:o,presence:l,private:c}}=this.params,d=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(m=>m.filter))!==null&&a!==void 0?a:[],u=!!this.bindings[s0.PRESENCE]&&this.bindings[s0.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},f={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:u}),postgres_changes:d,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(m=>t==null?void 0:t(Pd.CHANNEL_ERROR,m)),this._onClose(()=>t==null?void 0:t(Pd.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:m})=>{var x;if(this.socket.setAuth(),m===void 0){t==null||t(Pd.SUBSCRIBED);return}else{const p=this.bindings.postgres_changes,v=(x=p==null?void 0:p.length)!==null&&x!==void 0?x:0,g=[];for(let y=0;y<v;y++){const b=p[y],{filter:{event:w,schema:_,table:C,filter:E}}=b,N=m&&m[y];if(N&&N.event===w&&N.schema===_&&N.table===C&&N.filter===E)g.push(Object.assign(Object.assign({},b),{id:N.id}));else{this.unsubscribe(),this.state=da.errored,t==null||t(Pd.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=g,t&&t(Pd.SUBSCRIBED);return}}).receive("error",m=>{this.state=da.errored,t==null||t(Pd.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(m).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Pd.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,s){return this.state===da.joined&&t===s0.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(t,n,s)}async send(t,n={}){var s,a;if(!this._canPush()&&t.type==="broadcast"){const{event:i,payload:o}=t,c={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((a=d.body)===null||a===void 0?void 0:a.cancel()),d.ok?"ok":"error"}catch(d){return d.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const d=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&i("ok"),d.receive("ok",()=>i("ok")),d.receive("error",()=>i("error")),d.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=da.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger($l.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>
792{s=new Z4(this,$l.leave,{},t),s.receive("ok",()=>{n(),a("ok")}).receive("timeout",()=>{n(),a("timed out")}).receive("error",()=>{a("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=da.closed,this.bindings={}}async _fetchWithTimeout(t,n,s){const a=new AbortController,i=setTimeout(()=>a.abort(),s),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:a.signal}));return clearTimeout(i),o}_push(t,n,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new Z4(this,t,n,s);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>jhe){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,s){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,s){var a,i;const o=t.toLocaleLowerCase(),{close:l,error:c,leave:d,join:u}=$l;if(s&&[l,c,d,u].indexOf(o)>=0&&s!==this._joinRef())return;let f=this._onMessage(o,n,s);if(n&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(m=>{var x,p,v;return((x=m.filter)===null||x===void 0?void 0:x.event)==="*"||((v=(p=m.filter)===null||p===void 0?void 0:p.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(m=>m.callback(f,s)):(i=this.bindings[o])===null||i===void 0||i.filter(m=>{var x,p,v,g,y,b;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in m){const w=m.id,_=(x=m.filter)===null||x===void 0?void 0:x.event;return w&&((p=n.ids)===null||p===void 0?void 0:p.includes(w))&&(_==="*"||(_==null?void 0:_.toLocaleLowerCase())===((v=n.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{const w=(y=(g=m==null?void 0:m.filter)===null||g===void 0?void 0:g.event)===null||y===void 0?void 0:y.toLocaleLowerCase();return w==="*"||w===((b=n==null?void 0:n.event)===null||b===void 0?void 0:b.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===o}).map(m=>{if(typeof f=="object"&&"ids"in f){const x=f.data,{schema:p,table:v,commit_timestamp:g,type:y,errors:b}=x;f=Object.assign(Object.assign({},{schema:p,table:v,commit_timestamp:g,eventType:y,new:{},old:{},errors:b}),this._getPayloadRecords(x))}m.callback(f,s)})}_isClosed(){return this.state===da.closed}_isJoined(){return this.state===da.joined}_isJoining(){return this.state===da.joining}_isLeaving(){return this.state===da.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,s){const a=t.toLocaleLowerCase(),i={type:a,filter:n,callback:s};return this.bindings[a]?this.bindings[a].push(i):this.bindings[a]=[i],this}_off(t,n){const s=t.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(a=>{var i;return!(((i=a.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===s&&tO.isEqual(a.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const s in t)if(t[s]!==n[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on($l.close,{},t)}_onError(t){this._on($l.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=da.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=kM(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=kM(t.columns,t.old_record)),n}}const J4=()=>{},t1={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Phe=[1e3,2e3,5e3,1e4],Ehe=1e4,The=` 793 addEventListener("message", (e) => { 794 if (e.data.event === "start") { 795 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 796 } 797 });`;class Ohe{constructor(t,n){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=sP,this.transport=null,this.heartbeatIntervalMs=t1.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=J4,this.ref=0,this.reconnectTimer=null,this.logger=J4,this.conn=null,this.sendBuffer=[],this.serializer
797=new whe,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=a=>{let i;return a?i=a:typeof fetch>"u"?i=(...o)=>Vc(async()=>{const{default:l}=await Promise.resolve().then(()=>ov);return{default:l}},void 0).then(({default:l})=>l(...o)).catch(l=>{throw new Error(`Failed to load @supabase/node-fetch: ${l.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):i=fetch,(...o)=>i(...o)},!(!((s=n==null?void 0:n.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${aP.websocket}`,this.httpEndpoint=mW(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=ghe.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n} 798 799To use Realtime in Node.js, you need to provide a WebSocket implementation: 800 801Option 1: Use Node.js 22+ which has native WebSocket support 802Option 2: Install and provide the "ws" package: 803 804 npm install ws 805 806 import ws from "ws" 807 const client = new RealtimeClient(url, { 808 ...options, 809 transport: ws 810 })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:yhe}))}disconnect(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},t?this.conn.close(t,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,s){this.logger(t,n,s)}connectionState(){switch(this.conn&&this.conn.readyState){case r0.connecting:return Bf.Connecting;case r0.open:return Bf.Open;case r0.closing:return Bf.Closing;default:return Bf.Closed}}isConnected(){return this.connectionState()===Bf.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const s=`realtime:${t}`,a=this.getChannels().find(i=>i.topic===s);if(a)return a;{const i=new tO(`realtime:${t}`,n,this);return this.channels.push(i),i}}push(t){const{topic:n,event:s,payload:a,ref:i}=t,o=()=>{this.encode(t,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${n} ${s} (${i})`,a),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(bhe,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},t1.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(s=>s.topic===t&&(s._isJoined()||s._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>
810{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(d){this.log("error","error in heartbeat callback",d)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:a,payload:i,ref:o}=n,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${s} ${a} ${l}`.trim(),i),this.channels.filter(d=>d._isMember(s)).forEach(d=>d._trigger(a,i,o)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger($l.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const s=t.match(/\?/)?"&":"?",a=new URLSearchParams(n);return`${t}${s}${a}`}_workerObjectUrl(t){let n;if(t)n=t;else{const s=new Blob([The],{type:"application/javascript"});n=URL.createObjectURL(s)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n;t?n=t:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const a={access_token:n,version:vhe};n&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push($l.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(s=>{try{s(n)}catch(a){this.log("error",`error in ${t} callback`,a)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new hW(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},t1.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,s,a,i,o,l,c,d,u;if(this.transport=(n=t==null?void 0:t.transport)!==null&&n!==void 0?n:null,this.timeout=(s=t==null?void 0:t.t
810imeout)!==null&&s!==void 0?s:sP,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:t1.HEARTBEAT_INTERVAL,this.worker=(i=t==null?void 0:t.worker)!==null&&i!==void 0?i:!1,this.accessToken=(o=t==null?void 0:t.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(l=t==null?void 0:t.heartbeatCallback)!==null&&l!==void 0?l:J4,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=t==null?void 0:t.reconnectAfterMs)!==null&&c!==void 0?c:h=>Phe[h-1]||Ehe,this.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:(h,f)=>f(JSON.stringify(h)),this.decode=(u=t==null?void 0:t.decode)!==null&&u!==void 0?u:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}class rO extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function ha(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class Lhe extends rO{constructor(t,n,s){super(t),this.name="StorageApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class oP extends rO{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}var Ihe=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};const pW=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Vc(async()=>{const{default:s}=await Promise.resolve().then(()=>ov);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},Rhe=()=>Ihe(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Vc(()=>Promise.resolve().then(()=>ov),void 0)).Response:Response}),lP=e=>{if(Array.isArray(e))return e.map(n=>lP(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,s])=>{const a=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[a]=lP(s)}),t},Mhe=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)};var Km=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};const Q4=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Dhe=(e,t,n)=>Km(void 0,void 0,void 0,function*(){const s=yield Rhe();e instanceof s&&!(n!=null&&n.noResolveJson)?e.json().then(a=>{const i=e.status||500,o=(a==null?void 0:a.statusCode)||i+"";t(new Lhe(Q4(a),i,o))}).catch(a=>{t(new oP(Q4(a),a))}):t(new oP(Q4(e),e))}),$he=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!s?a:(Mhe(s)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(s)):a.body=s,t!=null&&t.duplex&&(a.duplex=t.duplex),Object.assign(Object.assign({},a),n))};function hj(e,t,n,s,a,i){return Km(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(n,$he(t,s,a,i)).then(c=>{if(!c.ok)throw c;return s!=null&&s.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>Dhe(c,l,s))})})}function YN(e,t,n,s){return Km(this,void 0,void 0,function*(){return hj(e,"GET",t,n,s)})}function Pc(e,t,n,s,a){return Km(this,void 0,void 0,function*(){return hj(e,"POST",t,s,a,n)})}function cP(e,t,n,s,a){return Km(this,void 0,void 0,function*(){return hj(e,"PUT",t,s,a,n)})}function Fhe(e,t,n,s){return Km(this,void 0,void 0,function*(){return hj(e,"HEAD",t,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function gW(e,t,n,s,a){return Km(this,void 0,void 0,function*(){return hj(e,"DELETE",t,s,a,n)})}var vi=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}
810return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};const Bhe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},PM={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Uhe{constructor(t,n={},s,a){this.url=t,this.headers=n,this.bucketId=s,this.fetch=pW(a)}uploadOrUpdate(t,n,s,a){return vi(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},PM),a);let l=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c))):(i=s,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c)))),a!=null&&a.headers&&(l=Object.assign(Object.assign({},l),a.headers));const d=this._removeEmptyFolders(n),u=this._getFinalPath(d),h=yield(t=="PUT"?cP:Pc)(this.fetch,`${this.url}/object/${u}`,i,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:d,id:h.Id,fullPath:h.Key},error:null}}catch(i){if(ha(i))return{data:null,error:i};throw i}})}upload(t,n,s){return vi(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,s)})}uploadToSignedUrl(t,n,s,a){return vi(this,void 0,void 0,function*(){const i=this._removeEmptyFolders(t),o=this._getFinalPath(i),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",n);try{let c;const d=Object.assign({upsert:PM.upsert},a),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(d.upsert)});typeof Blob<"u"&&s instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),c.append("",s)):typeof FormData<"u"&&s instanceof FormData?(c=s,c.append("cacheControl",d.cacheControl)):(c=s,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType);const h=yield cP(this.fetch,l.toString(),c,{headers:u});return{data:{path:i,fullPath:h.Key},error:null}}catch(c){if(ha(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(t,n){return vi(this,void 0,void 0,function*(){try{let s=this._getFinalPath(t);const a=Object.assign({},this.headers);n!=null&&n.upsert&&(a["x-upsert"]="true");const i=yield Pc(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:a}),o=new URL(this.url+i.url),l=o.searchParams.get("token");if(!l)throw new rO("No token returned by API");return{data:{signedUrl:o.toString(),path:t,token:l},error:null}}catch(s){if(ha(s))return{data:null,error:s};throw s}})}update(t,n,s){return vi(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,s)})}move(t,n,s){return vi(this,void 0,void 0,function*(){try{return{data:yield Pc(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(a){if(ha(a))return{data:null,error:a};throw a}})}copy(t,n,s){return vi(this,void 0,void 0,function*(){try{return{data:{path:(yield Pc(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(a){if(ha(a))return{data:null,error:a};throw a}})}createSignedUrl(t,n,s){return vi(this,void 0,void 0,function*(){try{let a=this._getFinalPath(t),i=yield Pc(this.fetch,`${this.url}/object/sign/${a}`,Object.assign({expiresIn:n},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(a){if(ha(a))return{data:null,error:a};throw a}})}createSignedUrls(t,n,s){return vi(this,void 0,void 0,function*(){try{const a=yield Pc(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:t},{headers:this.headers}),i=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:a.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${i}`):null})),error:null}}catch(a){if(ha(a))return{data:null,error:a};throw a}})}download(t,n){return vi(this,void 0,void 0,function*(){const a=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),o=i?`?${i}`:"";try{const l=this._getFinalPath(t);return{data:yield(yield YN(this.fetch,`${this.url}/${a}/${l}${o}
810`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(l){if(ha(l))return{data:null,error:l};throw l}})}info(t){return vi(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{const s=yield YN(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:lP(s),error:null}}catch(s){if(ha(s))return{data:null,error:s};throw s}})}exists(t){return vi(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{return yield Fhe(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(ha(s)&&s instanceof oP){const a=s.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:s}}throw s}})}getPublicUrl(t,n){const s=this._getFinalPath(t),a=[],i=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";i!==""&&a.push(i);const l=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});c!==""&&a.push(c);let d=a.join("&");return d!==""&&(d=`?${d}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${s}${d}`)}}}remove(t){return vi(this,void 0,void 0,function*(){try{return{data:yield gW(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(ha(n))return{data:null,error:n};throw n}})}list(t,n,s){return vi(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},Bhe),n),{prefix:t||""});return{data:yield Pc(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},s),error:null}}catch(a){if(ha(a))return{data:null,error:a};throw a}})}listV2(t,n){return vi(this,void 0,void 0,function*(){try{const s=Object.assign({},t);return{data:yield Pc(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(ha(s))return{data:null,error:s};throw s}})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const n=[];return t.width&&n.push(`width=${t.width}`),t.height&&n.push(`height=${t.height}`),t.resize&&n.push(`resize=${t.resize}`),t.format&&n.push(`format=${t.format}`),t.quality&&n.push(`quality=${t.quality}`),n.join("&")}}const zhe="2.11.0",qhe={"X-Client-Info":`storage-js/${zhe}`};var Tp=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};class Vhe{constructor(t,n={},s,a){const i=new URL(t);a!=null&&a.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href,this.headers=Object.assign(Object.assign({},qhe),n),this.fetch=pW(s)}listBuckets(){return Tp(this,void 0,void 0,function*(){try{return{data:yield YN(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if(ha(t))return{data:null,error:t};throw t}})}getBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield YN(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(ha(n))return{data:null,error:n};throw n}})}createBucket(t,n={public:!1}){return Tp(this,void 0,void 0,function*(){try{return{data:yield Pc(this.fetch,`${this.url}/bucket`,{id:t,name:t,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(ha(s))return{data:null,error:s};throw s}})}updateBucket(t,n){return Tp(this,void 0,void 0,function*(){try{return{data:yield cP(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(ha(s))return{data:null,error:s};throw s}})}emptyBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield Pc(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(ha(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield gW(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(ha(n))return{data:null,error:n};throw n}})}}class Whe extends Vhe{constructor(t,n={},s,a){super(t,n,s,a)}from(t){return new Uhe(this.url,this.headers,t,this.fetch)}}const Hhe="2.56.1";let $y="";typeof Deno<"u"?$y="deno":typeof document<"u"?$y="web":typeof navigator<"u"&&navigator.product==="ReactNative"?$y="react-native":$y="node";const Ghe={"X-Client-Info":`supabase-js-${$y}/${Hhe}`},Yhe={headers:Ghe},Khe={schema:"public"},Xhe={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Zhe={};var Jhe=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}
810return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};const Qhe=e=>{let t;return e?t=e:typeof fetch>"u"?t=tW:t=fetch,(...n)=>t(...n)},efe=()=>typeof Headers>"u"?rW:Headers,tfe=(e,t,n)=>{const s=Qhe(n),a=efe();return(i,o)=>Jhe(void 0,void 0,void 0,function*(){var l;const c=(l=yield t())!==null&&l!==void 0?l:e;let d=new a(o==null?void 0:o.headers);return d.has("apikey")||d.set("apikey",e),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),s(i,Object.assign(Object.assign({},o),{headers:d}))})};var rfe=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};function nfe(e){return e.endsWith("/")?e:e+"/"}function sfe(e,t){var n,s;const{db:a,auth:i,realtime:o,global:l}=e,{db:c,auth:d,realtime:u,global:h}=t,f={db:Object.assign(Object.assign({},c),a),auth:Object.assign(Object.assign({},d),i),realtime:Object.assign(Object.assign({},u),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),l),{headers:Object.assign(Object.assign({},(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{}),(s=l==null?void 0:l.headers)!==null&&s!==void 0?s:{})}),accessToken:()=>rfe(this,void 0,void 0,function*(){return""})};return e.accessToken?f.accessToken=e.accessToken:delete f.accessToken,f}const xW="2.71.1",Xp=30*1e3,dP=3,ek=dP*Xp,afe="http://localhost:9999",ife="supabase.auth.token",ofe={"X-Client-Info":`gotrue-js/${xW}`},uP="X-Supabase-Api-Version",vW={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},lfe=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,cfe=10*60*1e3;class nO extends Error{constructor(t,n,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function Dr(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class dfe extends nO{constructor(t,n,s){super(t,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function ufe(e){return Dr(e)&&e.name==="AuthApiError"}class yW extends nO{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Gh extends nO{constructor(t,n,s,a){super(t,s,a),this.name=n,this.status=s}}class Du extends Gh{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function hfe(e){return Dr(e)&&e.name==="AuthSessionMissingError"}class r1 extends Gh{constructor(){super("Auth session or user missing","AuthInvalidToken
810ResponseError",500,void 0)}}class n1 extends Gh{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class s1 extends Gh{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function ffe(e){return Dr(e)&&e.name==="AuthImplicitGrantRedirectError"}class EM extends Gh{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class hP extends Gh{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function tk(e){return Dr(e)&&e.name==="AuthRetryableFetchError"}class TM extends Gh{constructor(t,n,s){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class fP extends Gh{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const KN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),OM=` 811\r=`.split(""),mfe=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<OM.length;t+=1)e[OM[t].charCodeAt(0)]=-2;for(let t=0;t<KN.length;t+=1)e[KN[t].charCodeAt(0)]=t;return e})();function LM(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;n(KN[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;n(KN[s]),t.queuedBits-=6}}function bW(e,t,n){const s=mfe[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function IM(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},i=o=>{xfe(o,s,n)};for(let o=0;o<e.length;o+=1)bW(e.charCodeAt(o),a,i);return t.join("")}function pfe(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function gfe(e,t){for(let n=0;n<e.length;n+=1){let s=e.charCodeAt(n);if(s>55295&&s<=56319){const a=(s-55296)*1024&65535;s=(e.charCodeAt(n+1)-56320&65535|a)+65536,n+=1}pfe(s,t)}}function xfe(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let s=1;s<6;s+=1)if(!(e>>7-s&1)){t.utf8seq=s;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function vfe(e){const t=[],n={queue:0,queuedBits:0},s=a=>{t.push(a)};for(let a=0;a<e.length;a+=1)bW(e.charCodeAt(a),n,s);return new Uint8Array(t)}function yfe(e){const t=[];return gfe(e,n=>t.push(n)),new Uint8Array(t)}function bfe(e){const t=[],n={queue:0,queuedBits:0},s=a=>{t.push(a)};return e.forEach(a=>LM(a,n,s)),LM(null,n,s),t.join("")}function jfe(e){return Math.round(Date.now()/1e3)+e}function wfe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const Ol=()=>typeof window<"u"&&typeof document<"u",Sf={tested:!1,writable:!1},jW=()=>{if(!Ol())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Sf.tested)return Sf.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Sf.tested=!0,Sf.writable=!0}catch{Sf.tested=!0,Sf.writable=!1}return Sf.writable};function Nfe(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((a,i)=>{t[i]=a})}catch{}return n.searchParams.forEach((s,a)=>{t[a]=s}),t}const wW=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>Vc(async()=>{const{default:s}=await Promise.resolve().then(()=>ov);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},_fe=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Zp=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},kf=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Ou=async(e,t)=>{await e.removeItem(t)};class iS{constructor(){this.promise=new iS.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}iS.promiseConstructor=Promise;function rk(e){const t=e.split(".");if(t.length!==3)throw new fP("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!lfe.test(t[s]))throw new fP("JWT not in base64url format");return{header:JSON.parse(IM(t[0])),payload:JSON.parse(IM(t[1])),signature:vfe(t[2]),raw:{header:t[0],payload:t[1]}}}async function Sfe(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function kfe(e,t){return new Promise((s,a)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){s(o);return}}catch(o){if(!t(i,o)){a(o);return}}})()})}function Cfe(e){return("0"+e.toString(16)).substr(-2)}function Afe(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let a="";for(let i=0;i<56;i++)a+=n.charAt(Math.floor(Math.random()*s));return a}return crypto.getRandomValues(t),Array.from(t,Cfe).join("")}async function Pfe(e){const n=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",
811n),a=new Uint8Array(s);return Array.from(a).map(i=>String.fromCharCode(i)).join("")}async function Efe(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await Pfe(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Op(e,t,n=!1){const s=Afe();let a=s;n&&(a+="/PASSWORD_RECOVERY"),await Zp(e,`${t}-code-verifier`,a);const i=await Efe(s);return[i,s===i?"plain":"s256"]}const Tfe=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Ofe(e){const t=e.headers.get(uP);if(!t||!t.match(Tfe))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Lfe(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Ife(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Rfe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Lp(e){if(!Rfe.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function nk(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function RM(e){return JSON.parse(JSON.stringify(e))}var Mfe=function(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n};const Lf=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Dfe=[502,503,504];async function MM(e){var t;if(!_fe(e))throw new hP(Lf(e),0);if(Dfe.includes(e.status))throw new hP(Lf(e),e.status);let n;try{n=await e.json()}catch(i){throw new yW(Lf(i),i)}let s;const a=Ofe(e);if(a&&a.getTime()>=vW["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?s=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(s=n.error_code),s){if(s==="weak_password")throw new TM(Lf(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new Du}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new TM(Lf(n),e.status,n.weak_password.reasons);throw new dfe(Lf(n),e.status||500,s)}const $fe=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),n))};async function Jr(e,t,n,s){var a;const i=Object.assign({},s==null?void 0:s.headers);i[uP]||(i[uP]=vW["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(a=s==null?void 0:s.query)!==null&&a!==void 0?a:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await Ffe(e,t,n+l,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(c):{data:Object.assign({},c),error:null}}async function Ffe(e,t,n,s,a,i){const o=$fe(t,s,a,i);let l;try{l=await e(n,Object.assign({},o))}
811catch(c){throw console.error(c),new hP(Lf(c),0)}if(l.ok||await MM(l),s!=null&&s.noResolveJson)return l;try{return await l.json()}catch(c){await MM(c)}}function Cd(e){var t;let n=null;qfe(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=jfe(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:s},error:null}}function DM(e){const t=Cd(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,s)=>n&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function Hu(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Bfe(e){return{data:e,error:null}}function Ufe(e){const{action_link:t,email_otp:n,hashed_token:s,redirect_to:a,verification_type:i}=e,o=Mfe(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:n,hashed_token:s,redirect_to:a,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function zfe(e){return e}function qfe(e){return e.access_token&&e.refresh_token&&e.expires_in}const sk=["global","local","others"];var Vfe=function(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n};class Wfe{constructor({url:t="",headers:n={},fetch:s}){this.url=t,this.headers=n,this.fetch=wW(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(t,n=sk[0]){if(sk.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${sk.join(", ")}`);try{return await Jr(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Dr(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,n={}){try{return await Jr(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:Hu})}catch(s){if(Dr(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:n}=t,s=Vfe(t,["options"]),a=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(a.new_email=s==null?void 0:s.newEmail,delete a.newEmail),await Jr(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:Ufe,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Dr(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Jr(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Hu})}catch(n){if(Dr(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,s,a,i,o,l,c;try{const d={nextPage:null,lastPage:0,total:0},u=await Jr(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(i=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:zfe});if(u.error)throw u.error;const h=await u.json(),f=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,m=(c=(l=u.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return m.length>0&&(m.forEach(x=>{const p=parseInt(x.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(x.split(";")[1].split("=")[1]);d[`${v}Page`]=p}),d.total=parseInt(f)),{data:Object.assign(Object.assign({},h),d),error:null}}catch(d){if(Dr(d))return{data:{users:[]},error:d};throw d}}async getUserById(t){Lp(t);try{return await Jr(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Hu})}catch(n){if(Dr(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Lp(t);try{return await Jr(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:Hu})}catch(s){if(Dr(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,n=!1){Lp(t);
811try{return await Jr(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:Hu})}catch(s){if(Dr(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){Lp(t.userId);try{const{data:n,error:s}=await Jr(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:n,error:s}}catch(n){if(Dr(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Lp(t.userId),Lp(t.id);try{return{data:await Jr(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Dr(n))return{data:null,error:n};throw n}}}function $M(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}function Hfe(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const Ip={debug:!!(globalThis&&jW()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class NW extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class Gfe extends NW{}async function Yfe(e,t,n){Ip.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;return t>0&&setTimeout(()=>{s.abort(),Ip.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async a=>{if(a){Ip.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await n()}finally{Ip.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw Ip.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new Gfe(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Ip.debug)try{const i=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(i,null," "))}catch(i){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",i)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}Hfe();const Kfe={url:afe,storageKey:ife,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ofe,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function FM(e,t,n){return await n()}const Rp={};class W0{constructor(t){var n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=W0.nextInstanceID,W0.nextInstanceID+=1,this.instanceID>0&&Ol()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const a=Object.assign(Object.assign({},Kfe),t);if(this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.persistSession=a.persistSession,this.storageKey=a.storageKey,this.autoRefreshToken=a.autoRefreshToken,this.admin=new Wfe({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=wW(a.fetch),this.lock=a.lock||FM,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:Ol()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=Yfe:this.lock=FM,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:jW()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=$M(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=$M(this.memoryStorage)),Ol()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async i=>{this._debug("received broadcast notification from other tab or client",i),await this._notifyAllSubscribers(i.data.event,i.data.session,!1)})}this.initialize()}get jwks(){var t,n;return(n=(t=Rp[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Rp[this.storageKey]=Object.assign(Object.assign({},Rp[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Rp[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Rp[this.storageKey]=Object.assign(Object.assign({},Rp[this.storageKey]),{cachedAt:t})}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${xW}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{const n=Nfe(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),Ol()&&this.detectSessionInUrl&&s!=="none"){const{data:a,error:i}=await this._getSessionFromURL(n,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),ffe(i)){const c=(t=i.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:i}}return await this._removeSession(),{error:i}}const{session:o,redirectType:l}=a;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Dr(n)?{error:n}:{error:new yW("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,s,a;try{const i=await Jr(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(a=t==null?void 0:t.options)===null||a===void 0?void 0:a.captchaToken}},xform:Cd}),{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(i){if(Dr(i))return{data:{user:null,session:null},error:i};throw i}}async signUp(t){var n,s,a;try{let i;if("email"in t){const{email:u,password:h,options:f}=t;let m=null,x=null;this.flowType==="pkce"&&([m,x]=await Op(this.storage,this.storageKey)),i=await Jr(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:u,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:m,code_challenge_method:x},xform:Cd})}else if("phone"in t){const{phone:u,password:h,options:f}=t;i=await Jr(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(s=f==null?void 0:f.data)!==null&&s!==void 0?s:{},channel:(a=f==null?void 0:f.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:Cd})}else throw new n1("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(i){if(Dr(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:l}=t;n=await Jr(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:DM})}else if("phone"in t){const{phone:i,password:o,options:l}=t;n=await Jr(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:DM})}else throw new n1("You must provide either an email or phone number and a password");const{data:s,error:a}=n;return a?{data:{user:null,session:null},error:a}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new r1}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:a})}catch(n){if(Dr(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,s,a,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.scopes,queryParams:(a=t.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;if(n==="solana")return await this.signInWithSolana(t);throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}async signInWithSolana(t){var n,s,a,i,o,l,c,d,u,h,f,m;let x,p;if("message"in t)x=t.message,p=t.signature;else{const{chain:v,wallet:g,statement:y,options:b}=t;let w;if(Ol())if(typeof g=="object")w=g;else{const C=window;if("solana"in C&&typeof C.solana=="object"&&("signIn"in C.solana&&typeof C.solana.signIn=="function"||"signMessage"in C.solana&&typeof C.solana.signMessage=="function"))w=C.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof g!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=g}const _=new URL((n=b==null?void 0:b.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in w&&w.signIn){const C=await w.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:_.host,uri:_.href}),y?{statement:y}:null));let E;if(Array.isArray(C)&&C[0]&&typeof C[0]=="object")E=C[0];else if(C&&typeof C=="object"&&"signedMessage"in C&&"signature"in C)E=C;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in E&&"signature"in E&&(typeof E.signedMessage=="string"||E.signedMessage instanceof Uint8Array)&&E.signature instanceof Uint8Array)x=typeof E.signedMessage=="string"?E.signedMessage:new TextDecoder().decode(E.signedMessage),p=E.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in w)||typeof w.signMessage!="function"||!("publicKey"in w)||typeof w!="object"||!w.publicKey||!("toBase58"in w.publicKey)||typeof w.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");x=[`${_.host} wants you to sign in with your Solana account:`,w.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${_.href}`,`Issued At: ${(a=(s=b==null?void 0:b.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((d=b==null?void 0:b.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(E=>`- ${E}`)]:[]].join(` 812`);const C=await w.signMessage(new TextEncoder().encode(x),"utf8");if(!C||!(C instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=C}}try{const{data:v,error:g}=await Jr(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:x,signature:bfe(p)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=t.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:Cd});if(g)throw g;return!v||!v.session||!v.user?{data:{user:null,session:null},error:new r1}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),{data:Object.assign({},v),error:g})}catch(v){if(Dr(v))return{data:{user:null,session:null},error:v};throw v}}async _exchangeCodeForSession(t){const n=await kf(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(n??"").split("/");try{const{data:i,error:o}=await Jr(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:Cd});if(await Ou(this.storage,`${this.storageKey}-code-verifier`),o)throw o;return!i||!i.session||!i.user?{data:{user:null,session:null,redirectType:null},error:new r1}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:a??null}),error:o})}catch(i){if(Dr(i))return{data:{user:null,session:null,redirectType:null},error:i};throw i}}async signInWithIdToken(t){try{const{options:n,provider:s,token:a,access_token:i,nonce:o}=t,l=await Jr(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:a,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Cd}),{data:c,error:d}=l;return d?{data:{user:null,session:null},error:d}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new r1}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:d})}catch(n){if(Dr(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,s,a,i,o;try{i
812f("email"in t){const{email:l,options:c}=t;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await Op(this.storage,this.storageKey));const{error:h}=await Jr(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(s=c==null?void 0:c.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:d,code_challenge_method:u},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in t){const{phone:l,options:c}=t,{data:d,error:u}=await Jr(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(a=c==null?void 0:c.data)!==null&&a!==void 0?a:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u}}throw new n1("You must provide either an email or phone number.")}catch(l){if(Dr(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(t){var n,s;try{let a,i;"options"in t&&(a=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:l}=await Jr(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:a,xform:Cd});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,d=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(a){if(Dr(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(t){var n,s,a;try{let i=null,o=null;return this.flowType==="pkce"&&([i,o]=await Op(this.storage,this.storageKey)),await Jr(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s:void 0}),!((a=t==null?void 0:t.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:o}),headers:this.headers,xform:Bfe})}catch(i){if(Dr(i))return{data:null,error:i};throw i}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:s}=t;if(s)throw s;if(!n)throw new Du;const{error:a}=await Jr(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:a}})}catch(t){if(Dr(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:s,type:a,options:i}=t,{error:o}=await Jr(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in t){const{phone:s,type:a,options:i}=t,{data:o,error:l}=await Jr(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new n1("You must provide either an email or phone number and a type")}catch(n){if(Dr(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=n();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await kf(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not val
812id"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()<ek:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const o=await kf(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=nk()}if(this.storage.isServer&&t.user){let o=this.suppressGetSessionWarning;t=new Proxy(t,{get:(c,d,u)=>(!o&&d==="user"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),o=!0,this.suppressGetSessionWarning=!0),Reflect.get(c,d,u))})}return{data:{session:t},error:null}}const{session:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?{data:{session:null},error:i}:{data:{session:a},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await Jr(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:Hu}):await this._useSession(async n=>{var s,a,i;const{data:o,error:l}=n;if(l)throw l;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Du}:await Jr(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(a=o.session)===null||a===void 0?void 0:a.access_token)!==null&&i!==void 0?i:void 0,xform:Hu})})}catch(n){if(Dr(n))return hfe(n)&&(await this._removeSession(),await Ou(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async s=>{const{data:a,error:i}=s;if(i)throw i;if(!a.session)throw new Du;const o=a.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await Op(this.storage,this.storageKey));const{data:d,error:u}=await Jr(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:Hu});if(u)throw u;return o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(s){if(Dr(s))return{data:{user:null},error:s};throw s}}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Du;const n=Date.now()/1e3;let s=n,a=!0,i=null;const{payload:o}=rk(t.access_token);if(o.exp&&(s=o.exp,a=s<=n),a){const{session:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!l)return{data:{user:null,session:null},error:null};i=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)throw c;i={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:s-n,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(n){if(Dr(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var s;if(!t){const{data:o,error:l}=n;if(l)throw l;t=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new Du;const{session:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?{data:{user:null,session:null},error:i}:a?{data:{user:a.user,session:a},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(Dr(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t,n){try{if(!Ol())throw new s1("No browser detected.");
812if(t.error||t.error_description||t.error_code)throw new s1(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new EM("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new s1("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new EM("No code detected.");const{data:y,error:b}=await this._exchangeCodeForSession(t.code);if(b)throw b;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:y.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:d}=t;if(!i||!l||!o||!d)throw new s1("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(l);let f=u+h;c&&(f=parseInt(c));const m=f-u;m*1e3<=Xp&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${h}s`);const x=f-h;u-x>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",x,f,u):u-x<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",x,f,u);const{data:p,error:v}=await this._getUser(i);if(v)throw v;const g={provider_token:s,provider_refresh_token:a,access_token:i,expires_in:h,expires_at:f,refresh_token:o,token_type:d,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:g,redirectType:t.type},error:null}}catch(s){if(Dr(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(t){return!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await kf(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var s;const{data:a,error:i}=n;if(i)return{error:i};const o=(s=a.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(ufe(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return t!=="others"&&(await this._removeSession(),await Ou(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(t){const n=wfe(),s={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:s}}}async _emitInitialSession(t){return await this._useSession(async n=>{var s,a;try{const{data:{session:i},error:o}=n;if(o)throw o;await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),console.error(i)}})}async resetPasswordForEmail(t,n={}){let s=null,a=null;this.flowType==="pkce"&&([s,a]=await Op(this.storage,this.storageKey,!0));try{return await Jr(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:a,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(Dr(i))return{data:null,error:i};throw i}}async getUserIdentities(){var t;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(n){if(Dr(n))return{data:null,error:n};throw n}}async linkIdentity(t){var n;try{const{data:s,error:a}=await this._useSession(async i=>{var o,l,c,d,u;const{data:h,error:f}=i;if(f)throw f;const m=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=t.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await Jr(this.fetch,"GET",m,{headers:this.headers,jwt:(u=(d=h.session)===null||d===void 0?void 0:d.access_token)!==null&&u!==void 0?u:void 0})});if(a)throw a;return Ol()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:t.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(Dr(s))return{data:{provider:t.provider,url:null},error:s};throw s}}async unlinkIdentity(t){try{return await this._useSession(async n=>{var s,a;const{data:i,error:o}=n;
812if(o)throw o;return await Jr(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0})})}catch(n){if(Dr(n))return{data:null,error:n};throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await kfe(async a=>(a>0&&await Sfe(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Jr(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Cd})),(a,i)=>{const o=200*Math.pow(2,a);return i&&tk(i)&&Date.now()+o-s<Xp})}catch(s){if(this._debug(n,"error",s),Dr(s))return{data:{session:null,user:null},error:s};throw s}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const s=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",s),Ol()&&!n.skipBrowserRedirect&&window.location.assign(s),{data:{provider:t,url:s},error:null}}async _recoverAndRefresh(){var t,n;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const a=await kf(this.storage,this.storageKey);if(a&&this.userStorage){let o=await kf(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:a.user},await Zp(this.userStorage,this.storageKey+"-user",o)),a.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:nk()}else if(a&&!a.user&&!a.user){const o=await kf(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(a.user=o.user,await Ou(this.storage,this.storageKey+"-user"),await Zp(this.storage,this.storageKey,a)):a.user=nk()}if(this._debug(s,"session from storage",a),!this._isValidSession(a)){this._debug(s,"session is not valid"),a!==null&&await this._removeSession();return}const i=((n=a.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<ek;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${ek}s`),i){if(this.autoRefreshToken&&a.refresh_token){const{error:o}=await this._callRefreshToken(a.refresh_token);o&&(console.error(o),tk(o)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(a.user&&a.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(a.access_token);!l&&(o!=null&&o.user)?(a.user=o.user,await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",a)}catch(a){this._debug(s,"error",a),console.error(a);return}finally{this._debug(s,"end")}}async _callRefreshToken(t){var n,s;if(!t)throw new Du;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new iS;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Du;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={session:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(a,"error",i),Dr(i)){const o={session:null,error:i};return tk(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(t,n,s=!0){const a=`#_notifyAllSubscribers(${t})`;this._debug(a,"begin",n,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,n)}catch(c){i.push(c)}});if(await Promise.all(o),i.length>0){for(let l=0;l<i.length;l+=1)console.error(i[l]);throw i[0]}}finally{this._debug(a,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0;const n=Object.assign({},t),s=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&n.user&&await Zp(this.userStorage,this.storageKey+"-user",{user:n.user});const a=Object.assign({},n);delete a.user;const i=RM(a);await Zp(this.storage,this.storageKey,i)}else{const a=RM(n);await Zp(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),await Ou(this.storage,this.storageKey),await Ou(this.storage,this.storageKey+"-code-verifier"),await Ou(this.storage,this.storageKey+"-user"),this.userStorage&&await Ou(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;
812try{t&&Ol()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Xp);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:s}}=n;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((s.expires_at*1e3-t)/Xp);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${Xp}ms, refresh threshold is ${dP} ticks`),a<=dP&&await this._callRefreshToken(s.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof NW)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ol()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,s){const a=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&a.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&a.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,o]=await Op(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});a.push(l.toString())}if(s!=null&&s.queryParams){const i=new URLSearchParams(s.queryParams);a.push(i.toString())}return s!=null&&s.skipBrowserRedirect&&a.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var s;const{data:a,error:i}=n;return i?{data:null,error:i}:await Jr(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Dr(n))return{data:null,error:n};throw n}}async _enroll(t){try{return await this._useSession(async n=>{var s,a;const{data:i,error:o}=n;if(o)return{data:null,error:o};const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:{issuer:t.issuer}),{data:c,error:d}=await Jr(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return d?{data:null,error:d}:(t.factorType==="totp"&&(!((a=c==null?void 0:c.totp)===null||a===void 0)&&a.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),{data:c,error:null})})}catch(n){if(Dr(n))return{data:null,error:n};throw n}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:a,error:i}=n;if(i)return{data:null,error:i};const{data:o,error:l}=await Jr(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:l})})}catch(n){if(Dr(n))return{data:null,error:n};throw n}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:a,error:i}=n;return i?{data:null,error:i}:await Jr(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:{channel:t.channel},headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Dr(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(t){const{data:n,error:s}=await this._challenge({factorId:t.factorId});return s?{data:null,error:s}:await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){const{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};const s=(t==null?void 0:t.factors)||[],a=s.filter(o=>o.factor_type==="totp"&&o.status==="verified"),i=s.filter(o=>o.factor_type==="phone"&&o.status==="verified");return{data:{all:s,totp:a,phone:i},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var n,s;const{data:{session:a},error:i}=t;if(i)return{data:null,error:i};if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=rk(a.access_token);let l=null;o.aal&&(l=o.aal);let c=l;((s=(n=a.user.factors)===null||n===void 0?void 0:n.filter(h=>h.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(c="aal2");const u=o.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:u},error:null}}))}async fetchJwk(t,n={keys:[]}){let s=n.keys.find(l=>l.kid===t);if(s)return s;const a=Date.now();if(s=this.jwks.keys.find(l=>l.kid===t),s&&this.jwks_cached_at+cfe>a)return s;const{data:i,error:o}=await Jr(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=a,s=i.keys.find(l=>l.kid===t),!s)?null:s}async getClaims(t,n={}){try{let s=t;if(!s){const{data:m,error:x}
812=await this.getSession();if(x||!m.session)return{data:null,error:x};s=m.session.access_token}const{header:a,payload:i,signature:o,raw:{header:l,payload:c}}=rk(s);n!=null&&n.allowExpired||Lfe(i.exp);const d=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!d){const{error:m}=await this.getUser(s);if(m)throw m;return{data:{claims:i,header:a,signature:o},error:null}}const u=Ife(a.alg),h=await crypto.subtle.importKey("jwk",d,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,yfe(`${l}.${c}`)))throw new fP("Invalid JWT signature");return{data:{claims:i,header:a,signature:o},error:null}}catch(s){if(Dr(s))return{data:null,error:s};throw s}}}W0.nextInstanceID=0;const Xfe=W0;class Zfe extends Xfe{constructor(t){super(t)}}var Jfe=function(e,t,n,s){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((s=s.apply(e,t||[])).next())})};class Qfe{constructor(t,n,s){var a,i,o;if(this.supabaseUrl=t,this.supabaseKey=n,!t)throw new Error("supabaseUrl is required.");if(!n)throw new Error("supabaseKey is required.");const l=nfe(t),c=new URL(l);this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const d=`sb-${c.hostname.split(".")[0]}-auth-token`,u={db:Khe,realtime:Zhe,auth:Object.assign(Object.assign({},Xhe),{storageKey:d}),global:Yhe},h=sfe(s??{},u);this.storageKey=(a=h.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(i=h.global.headers)!==null&&i!==void 0?i:{},h.accessToken?(this.accessToken=h.accessToken,this.auth=new Proxy({},{get:(f,m)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(m)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=h.auth)!==null&&o!==void 0?o:{},this.headers,h.global.fetch),this.fetch=tfe(n,this._getAccessToken.bind(this),h.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},h.realtime)),this.rest=new phe(new URL("rest/v1",c).href,{headers:this.headers,schema:h.db.schema,fetch:this.fetch}),this.storage=new Whe(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),h.accessToken||this._listenForAuthEvents()}get functions(){return new Gue(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,n={},s={}){return this.rest.rpc(t,n,s)}channel(t,n={config:{}}){return this.realtime.channel(t,n)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,n;return Jfe(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:s}=yield this.auth.getSession();return(n=(t=s.session)===null||t===void 0?void 0:t.access_token)!==null&&n!==void 0?n:this.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:a,storageKey:i,flowType:o,lock:l,debug:c},d,u){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Zfe({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:i,autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:a,flowType:o,lock:l,debug:c,fetch:u,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(t){return new Ohe(this.realtimeUrl.href,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,s)=>{this._handleTokenChanged(n,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(t,n,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?this.changedAccessToken=s:t==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}
812const eme=(e,t,n)=>new Qfe(e,t,n);function tme(){if(typeof window<"u"||typeof process>"u")return!1;const e=process.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}tme()&&console.warn("â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");function rme(){var v,g;if(typeof window>"u")return;const e=location.hostname,n=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(y=>e===y||e.endsWith("."+y)),s="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",a=n?((v=e.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+s+")(?:-dev)?(?=\\.|$)","i")))==null?void 0:v[1])??((g=e.match(new RegExp("^("+s+")(?=[.-])","i")))==null?void 0:g[1]):void 0,i=window.parent&&window.parent!==window;if(!a||!i)return localStorage;const o=e.endsWith(".lovableproject-dev.com")||e.endsWith(".gpt-eng.com"),l=o?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,c=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),d=c&&l.test(c)?[c]:o?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],u="lovable-preview-auth:result",h=2e3,f=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),m=(y,b,w)=>new Promise(_=>{const C=f();let E=!1,N;const k=O=>{E||(E=!0,clearTimeout(N),window.removeEventListener("message",I),_(O))},I=O=>{if(d.indexOf(O.origin)<0)return;const A=O.data;A&&A.type===u&&A.requestId===C&&k(A)};window.addEventListener("message",I);const P={type:y,requestId:C,projectId:a,key:b};w!==void 0&&(P.value=w);for(const O of d)window.parent.postMessage(P,O);N=setTimeout(()=>k(null),h)});let x=!0;const p=250;return{getItem:async y=>{let b=await m("lovable-preview-auth:get",y);return!b&&x&&(await new Promise(w=>setTimeout(w,p)),b=await m("lovable-preview-auth:get",y)),x=!1,b&&b.ok&&typeof b.value=="string"?b.value===""?(localStorage.removeItem(y),null):b.value:localStorage.getItem(y)},setItem:(y,b)=>(localStorage.setItem(y,b),m("lovable-preview-auth:set",y,b).then(()=>{})),removeItem:y=>(localStorage.removeItem(y),m("lovable-preview-auth:remove",y).then(()=>{}))}}const nme="https://ohnpqjnepckejxauztja.supabase.co",sme="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9obnBxam5lcGNrZWp4YXV6dGphIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTY3NDQzMDksImV4cCI6MjA3MjMyMDMwOX0.IwOW9-w9zJczcr57-W_Z2xkESL3AxYivOk7C7YeaGp4",H=eme(nme,sme,{auth:{storage:rme(),persistSession:!0,autoRefreshToken:!0}}),_W=Object.freeze(Object.defineProperty({__proto__:null,supabase:H},Symbol.toStringTag,{value:"Module"})),SW=j.createContext(void 0);function ame({children:e}){const[t,n]=j.useState(null),[s,a]=j.useState(null),[i,o]=j.useState(null),[l,c]=j.useState(!0);j.useEffect(()=>{const{data:{subscription:x}}=H.auth.onAuthStateChange((p,v)=>{a(v),n((v==null?void 0:v.user)??null),v!=null&&v.user?setTimeout(()=>{d(v.user.id)},0):o(null),c(!1),p==="SIGNED_IN"&&(v!=null&&v.user)&&be({title:"Welcome back!",description:"You have successfully signed in."})});return H.auth.getSession().then(({data:{session:p}})=>{a(p),n((p==null?void 0:p.user)??null),p!=null&&p.user&&d(p.user.id),c(!1)}),()=>x.unsubscribe()},[]);const d=async x=>{try{const{data:p,error:v}=await H.from("profiles").select("id, role, full_name, username").eq("id",x).single();if(v){console.error("Error fetching profile:",v);return}o(p)}catch(p){console.error("Error fetching user profile:",p)}},u=async(x,p)=>{const{error:v}=await H.auth.signInWithPassword({email:x,password:p});return{error:v}},h=async(x,p,v)=>{const g=`${window.location.origin}/`,{error:y}=await H.auth.signUp({email:x,password:p,options:{emailRedirectTo:g,data:{full_name:v}}});return{error:y}},f=async()=>{try{const{error:x}=await H.auth.signOut();x&&console.warn("Server logout warning:",x.message)}catch(x){console.warn("Logout error:",x)}n(null),a(null),o(null),localStorage.removeItem("sb-ohnpqjnepckejxauztja-auth-token"),be({title:"Signed out",description:"You have been successfully signed out."})},m=async x=>{const{error:p}=await H.auth.resetPasswordForEmail(x,{redirectTo:`${window.location.origin}/auth?mode=reset`});return{error:p}};return r.jsx(SW.Provider,{value:{user:t,session:s,profile:i,loading:l,signIn:u,signUp:h,signOut:f,resetPassword:m},children:e})}function bt(){const e=j.useContext(SW);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}const fj=()=>{const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(!0);j.useEffect(()=>{e?(a(!0),i()):(n([]),a(!1))},[e]);const i=async()=>
812{if(e)try{const{data:f,error:m}=await H.from("user_roles").select("role").eq("user_id",e.id);if(m)throw m;const x=(f==null?void 0:f.map(p=>p.role))||["viewer"];n(x)}catch(f){console.error("Error fetching user roles:",f),n(["viewer"])}finally{a(!1)}},o=f=>t.includes(f),l=f=>f.some(m=>t.includes(m)),c=t.includes("admin"),d=t.includes("admin")||t.includes("moderator"),u=d,h=t.find(f=>f!=="viewer")||t[0]||null;return{userRoles:t,hasRole:o,hasAnyRole:l,isAdmin:c,isModerator:d,canModerate:u,loading:s,primaryRole:h}},ime={legacy:{"/home":"/","/content-library":"/content","/content":"/creativity","/event-listings":"/events","/marketplace-items":"/marketplace","/marketplace":"/buy-sell","/booking":"/lodging","/booking-management":"/lodging","/user-dashboard":"/dashboard","/admin-panel":"/admin","/login":"/auth","/register":"/auth","/signup":"/auth","/profile":"/dashboard","/settings":"/dashboard","/search":"/diaspora"},trailingSlash:{enforce:"remove",exceptions:[]},canonical:{protocol:"https",domain:"www"},gone:["/old-blog","/deprecated-api","/legacy-admin"],protected:{"/dashboard":["viewer","creator","vendor","event_organizer","property_owner","artisan","restaurant_owner","tourism_operator","admin"],"/admin":["admin"],"/create":["viewer","creator","vendor","event_organizer","property_owner","artisan","restaurant_owner","admin"],"/payments":["viewer","creator","vendor","event_organizer","property_owner","artisan","restaurant_owner","tourism_operator","admin"]}},ome={sitemap:{static:["/","/creativity","/events","/buy-sell","/lodging","/restaurants","/artisans","/tourism","/diaspora","/about","/contact"],dynamic:{content:"/content/[slug]",events:"/events/[slug]",products:"/marketplace/[slug]",properties:"/lodging/[slug]"}},robots:{disallow:["/admin","/dashboard","/auth","/api","/_next","/private"],allow:["/","/content","/events","/marketplace","/lodging","/about","/contact"]}},Uf={redirects:ime,seo:ome},kW=()=>{const e=Ri(),t=zn();return j.useEffect(()=>{const i=e.pathname,o=Uf.redirects.legacy[i];if(o){t(o,{replace:!0});return}if(i!=="/"&&i.endsWith("/")){const l=i.slice(0,-1);t(l,{replace:!0});return}if(Uf.redirects.gone.includes(i)){t("/404",{replace:!0,state:{status:410}});return}},[e.pathname,t]),{checkCanonicalUrl:i=>{const o=new URL(i,window.location.origin);return o.protocol="https:",o.hostname.startsWith("www.")||(o.hostname=`www.${o.hostname}`),o.toString()},isProtectedRoute:i=>Object.keys(Uf.redirects.protected).some(o=>i.startsWith(o)),getRequiredRoles:i=>{const o=Object.keys(Uf.redirects.protected).find(l=>i.startsWith(l));return o?Uf.redirects.protected[o]:[]}}},lme={success:{general:{saved:"Na complete! Your changes don save successfully.",updated:"Update don complete! Everything sorted.",created:"New item don create successfully. You're good to go!",deleted:"Item don delete successfully. Clean slate!",submitted:"Your submission don go through. We go review am soon.",uploaded:"File don upload successfully. Nice one!",sent:"Message don send successfully. Dem go hear from you soon.",copied:"Don copy am to your clipboard!",downloaded:"Download complete! Check your downloads folder.",exported:"Export don complete successfully.",imported:"Import don complete. All data loaded.",synced:"Sync complete! Everything up to date.",confirmed:"Confirmation successful. You're all set!",verified:"Verification complete! You're verified."},auth:{signedIn:"Welcome back! You don sign in successfully.",signedOut:"You don sign out successfully. See you soon!",registered:"Welcome to Naija! Your account don create successfully.",passwordReset:"Password reset link don send to your email.",passwordChanged:"Your password don update successfully.",emailVerified:"Your email don verify successfully!",profileUpdated:"Your profile don update successfully."},content:{published:"Your content don publish successfully! People go see am now.",drafted:"Content don save as draft. You fit continue later.",approved:"Content don approve and go live!",featured:"Content don feature on homepage!",shared:"Content link don copy. Share am make people see!"},events:{created:"Event don create successfully! Start dey promote am.",published:"Event don publish! People fit register now.",ticketPurchased:"Ticket don buy successfully! Check your email for details.",checkedIn:"Attendee don check in successfully.",cancelled:"Event don cancel. Refunds go process automatically.",rescheduled:"Event don reschedule. Attendees go get notification."},marketplace:{productListed:"Product don list successfully! Buyers go see am now.",orderPlaced:"Order don place successfully! Seller go contact you soon.",orderShipped:"Order don ship! Track your package.",orderDelivered:"Order don deliver successfully!",paymentReceived:"Payment don receive successfully.",reviewSubmitted:"Your review don submit. Thank y
812ou for the feedback!"},bookings:{requested:"Booking request don send! Property owner go respond soon.",confirmed:"Booking don confirm! Check your email for details.",cancelled:"Booking don cancel successfully.",checkedIn:"Check-in successful! Enjoy your stay.",checkedOut:"Check-out complete! Thank you for staying with us.",reviewSubmitted:"Your review don submit. Thanks for the feedback!"},payment:{completed:"Payment successful! Transaction don complete.",refunded:"Refund don process successfully. Money go return to your account.",subscribed:"Subscription active! Welcome to premium features.",cancelled:"Subscription don cancel. You still get access till period end."}},errors:{general:{unknown:"Something don happen. Please try again.",network:"Network problem. Check your connection try again.",server:"Server get small issue. We dey fix am. Try again later.",validation:"Please check your information and try again.",unauthorized:"You no get permission for this action.",forbidden:"Access denied. You no fit do this action.",notFound:"Wetin you dey find no dey here. Check again.",timeout:"Request don timeout. Internet too slow, try again.",fileSize:"File too big. Try upload smaller file.",fileType:"File type no correct. Check the requirements.",rateLimited:"Too many requests. Wait small try again."},auth:{signInFailed:"Sign in no work. Check your email and password.",signUpFailed:"Account creation no work. Try again.",emailExists:"Email don already dey use. Try sign in instead.",weakPassword:"Password too weak. Use strong password with numbers and symbols.",invalidEmail:"Email address no correct. Check am well.",emailNotVerified:"Please verify your email before you continue.",sessionExpired:"Your session don expire. Please sign in again.",accountLocked:"Account don lock due to too many failed attempts."},content:{uploadFailed:"Content upload no work. Try again.",publishFailed:"Content no fit publish now. Try again later.",notFound:"Content wey you dey find no dey here.",editFailed:"Content edit no work. Try again.",deleteFailed:"Content no fit delete now. Try again later."},events:{createFailed:"Event creation no work. Check your details try again.",ticketUnavailable:"Ticket no dey available again. Check other options.",paymentFailed:"Payment no work. Check your payment method.",eventFull:"Event don full. No more tickets available.",eventCancelled:"Event don cancel. Check your email for refund details.",checkinFailed:"Check-in no work. Contact event organizer."},marketplace:{outOfStock:"Product don finish. Check back later.",orderFailed:"Order no work. Try again.",paymentDeclined:"Payment decline. Check your payment method.",shippingError:"Shipping address get problem. Update am try again.",sellerUnavailable:"Seller no available now. Try contact am later."},bookings:{unavailable:"Property no available for those dates. Check other dates.",bookingFailed:"Booking no work. Try again.",paymentRequired:"Payment needed to confirm booking.",cancelled:"Booking don cancel by property owner.",checkinFailed:"Check-in no work. Contact property owner."},payment:{failed:"Payment no successful. Check your card details.",declined:"Card decline. Contact your bank or use another card.",expired:"Card don expire. Use valid card.",insufficientFunds:"No enough money for this transaction.",invalidCard:"Card details no correct. Check am again.",processingError:"Payment processing get problem. Try again later."}},confirmations:{delete:{title:"You sure you wan delete this?",description:"This action no fit reverse. Everything go delete permanently.",confirm:"Yes, delete am",cancel:"No, keep am"},cancel:{title:"You sure you wan cancel?",description:"If you cancel now, your changes no go save.",confirm:"Yes, cancel",cancel:"No, continue"},leave:{title:"You wan leave this page?",description:"You get unsaved changes. If you leave, dem go lost.",confirm:"Yes, leave",cancel:"No, stay here"},logout:{title:"You wan sign out?",description:"You go need sign in again to access your account.",confirm:"Yes, sign out",cancel:"No, stay logged in"},publish:{title:"Ready to publish?",description:"Once you publish, everyone go fit see this content.",confirm:"Yes, publish",cancel:"No, save as draft"},payment:{title:"Complete payment?",description:"You go charge ${amount} for this transaction.",confirm:"Yes, pay now",cancel:"No, cancel"}},emptyStates:{general:{noData:"Nothing dey here yet",noResults:"No results for your search",noContent:"No content available"},content:{title:"No content yet",description:"Be the first to share something interesting with the community!",action:"Create Content"},events:{title:"No events happening",description:"No events scheduled. Check back later or create your own event!",action:"Create Event"},marketplace:{title:"No products available",description:"Marketplace empty now. Check back later or list your own products!",action:"List Product"},bookings:{title:"No bookings yet",description:"You never book anything yet. Explore properties and make your first booking!",action:"Browse Properties"},notifications:{title:"No notifications",description:"You're all caught up! No new notifications.",action:null},search:{title:"No results found",description:"Try adjust your search terms or check the spelling.",action:"Clear Search"},favorites:{title:"No favorites yet",description:"Start adding items to your favorites to see them here.",action:"Explore"},messages:{title:"No messages",description:"No messages in your inbox. Start a conversation!",action:"Send Message"}}
812,loading:{general:"Loading...",saving:"Dey save...",uploading:"Dey upload...",processing:"Dey process...",authenticating:"Dey sign in...",searching:"Dey search...",loading:"Dey load...",connecting:"Dey connect...",syncing:"Dey sync..."},validation:{required:"This field na must-fill",email:"Please enter correct email address",password:"Password must get at least 8 characters",passwordMatch:"Passwords no match",phoneNumber:"Please enter correct phone number",url:"Please enter correct URL",minLength:"Must get at least {min} characters",maxLength:"No fit pass {max} characters",numeric:"Only numbers allowed",alphanumeric:"Only letters and numbers allowed",fileSize:"File size no fit pass {maxSize}MB",fileType:"Only {types} files allowed"},actions:{save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",create:"Create",update:"Update",submit:"Submit",confirm:"Confirm",continue:"Continue",back:"Back",next:"Next",finish:"Finish",retry:"Try Again",refresh:"Refresh",upload:"Upload",download:"Download",share:"Share",copy:"Copy",view:"View",preview:"Preview",publish:"Publish",unpublish:"Unpublish",archive:"Archive",restore:"Restore",approve:"Approve",reject:"Reject",accept:"Accept",decline:"Decline"}},cme={version:"1.0.0",language:"Nigerian English",lastUpdated:"2024-03-01"},ak={messages:lme,meta:cme},CW=(e,t,n,s)=>{var i;let a;try{return n?a=ak.messages[e][t][n]||((i=ak.messages[e].general)==null?void 0:i[n])||"Something happened. Please try again.":a=ak.messages[e][t]||"Something happened. Please try again.",a}catch{return console.warn("Copy library message not found:",{type:e,category:t,key:n}),"Something happened. Please try again."}},dme=(e,t,n)=>{const s=CW("success",e,t);be({title:"Success!",description:s,variant:"default",duration:3e3,...n})},XN=(e,t,n)=>{const s=CW("errors",e,t);be({title:"Error",description:s,variant:"destructive",duration:5e3,...n})},ume=(e,t="general")=>{console.error("Error occurred:",e);let n=t,s="unknown";if(e!=null&&e.message){const a=e.message.toLowerCase();a.includes("network")||a.includes("fetch")?s="network":a.includes("unauthorized")||a.includes("401")?(n="auth",s="unauthorized"):a.includes("forbidden")||a.includes("403")?s="forbidden":a.includes("not found")||a.includes("404")?s="notFound":a.includes("timeout")?s="timeout":a.includes("file")&&a.includes("size")?s="fileSize":a.includes("file")&&a.includes("type")&&(s="fileType")}XN(n,s)},hme=({children:e})=>{const{user:t,loading:n}=bt(),{hasAnyRole:s,loading:a}=fj(),i=zn(),o=Ri(),{isProtectedRoute:l,getRequiredRoles:c}=kW(),d=j.useRef(!0),u=j.useRef(!1);j.useEffect(()=>{if(d.current&&t&&a||n||a)return;d.current&&(d.current=!1);const f=o.pathname;if(l(f)){if(!t){sessionStorage.setItem("redirectAfterLogin",f),sessionStorage.setItem("loginPromptMessage",h(f)),i("/auth",{replace:!0});return}const m=c(f);if(m.length>0&&!s(m)){u.current&&XN("general","forbidden"),i("/",{replace:!0});return}}u.current=!0},[t,s,n,a,o.pathname,i,l,c]);const h=f=>f.startsWith("/admin")?"Please log in to access the admin dashboard":f.startsWith("/create")?"Please log in to create content, events, products, or properties":f.startsWith("/dashboard")?"Please log in to access your dashboard":f.startsWith("/payments")?"Please log in to view your payments and earnings":"Please log in to access this feature";return j.useEffect(()=>{if(t&&o.pathname==="/auth"){const f=sessionStorage.getItem("redirectAfterLogin");f?(sessionStorage.removeItem("redirectAfterLogin"),i(f,{replace:!0})):i("/",{replace:!0})}},[t,o.pathname,i]),n||a?r.jsx("div",{className:"min-h-screen flex items-center justify-center",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):r.jsx(r.Fragment,{children:e})};function fme(){const[e,t]=JT(),[n,s]=j.useState(!1),{toast:a}=Sn();j.useEffect(()=>{const l=e.get("payment_reference"),c=e.get("payment");(l||c==="success")&&i(l)},[e]);const i=async l=>{if(!l&&(l=localStorage.getItem("pending_payment_reference"),!l))return;s(!0);let c=0;const d=15,u=async()=>{c++;try{const{data:h,error:f}=await H.from("airtime_transactions").select("*").eq("payment_reference",l).single();if(h&&!f){if(h.status==="completed")return a({title:"â
Airtime Delivered!",description:`â¦${h.amount} airtime has been sent to ${h.phone_number}`}),o(),!0;if(h.status==="failed")return a({title:"Payment Failed",description:h.error_message||"Unable to deliver airtime. Please contact support.",variant:"destructive"}),o(),!0}const{data:m,error:x}=await H.from("payment_transactions").select("*").eq("payment_reference",l).single();if(m&&!x){if(m.payment_status==="completed")return a({title:"Payment Successful",description:"Your payment has been confirmed."}),o(),!0;if(m.payment_status==="failed")return a({title:"Payment Failed",description:"Your payment could not be processed.",variant:"destructive"}),o(),!0}c<d?setTimeout(()=>u(),2e3):(a({title:"Processing...",description:"Your payment is being processed. You will receive a confirmation shortly."}),o())}catch(h){console.error("Error checking payment status:",h),c<d?setTimeout(()=>u(),2e3):o()}};await u()},o=()=>{s(!1),localStorage.removeItem("pending_payment_reference");const l=new URLSearchParams(e);l.delete("payment_reference"),l.delete("payment"),t(l)};return n?r.jsx("div",{className:"fixed bottom-4 right-4 z-50 bg-background border rounded-lg shadow-lg p-4 max-w-sm animate-in slide-in-from-bottom",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(yt,{className:"h-5 w-5 animate-spin text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Processing Payment"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking payment status..."})]})]})}):null}const H0=ev("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),W=j.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...a},i)=>{const o=s?mq:"button";return r.jsx(o,{className:Ge(H0({variant:t,size:n,className:e})),ref:i,...a})});W.displayName="Button";var ik="focusScope.autoFocusOnMount",ok="focusScope.autoFocusOnUnmount",BM={bubbles:!1,cancelable:!0},mme="FocusScope",mj=j.forwardRef((e,t)=>
vendor: 5,068 bytes, line 812
812{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=j.useState(null),d=Ai(a),u=Ai(i),h=j.useRef(null),f=gr(t,p=>c(p)),m=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(s){let p=function(b){if(m.paused||!l)return;const w=b.target;l.contains(w)?h.current=w:$u(h.current,{select:!0})},v=function(b){if(m.paused||!l)return;const w=b.relatedTarget;w!==null&&(l.contains(w)||$u(h.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const _ of b)_.removedNodes.length>0&&$u(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const y=new MutationObserver(g);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),y.disconnect()}}},[s,l,m.paused]),j.useEffect(()=>{if(l){zM.add(m);const p=document.activeElement;if(!l.contains(p)){const g=new CustomEvent(ik,BM);l.addEventListener(ik,d),l.dispatchEvent(g),g.defaultPrevented||(pme(bme(AW(l)),{select:!0}),document.activeElement===p&&$u(l))}return()=>{l.removeEventListener(ik,d),setTimeout(()=>{const g=new CustomEvent(ok,BM);l.addEventListener(ok,u),l.dispatchEvent(g),g.defaultPrevented||$u(p??document.body,{select:!0}),l.removeEventListener(ok,u),zM.remove(m)},0)}}},[l,d,u,m]);const x=j.useCallback(p=>{if(!n&&!s||m.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,g=document.activeElement;if(v&&g){const y=p.currentTarget,[b,w]=gme(y);b&&w?!p.shiftKey&&g===w?(p.preventDefault(),n&&$u(b,{select:!0})):p.shiftKey&&g===b&&(p.preventDefault(),n&&$u(w,{select:!0})):g===y&&p.preventDefault()}},[n,s,m.paused]);return r.jsx(Lt.div,{tabIndex:-1,...o,ref:f,onKeyDown:x})});mj.displayName=mme;function pme(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if($u(s,{select:t}),document.activeElement!==n)return}function gme(e){const t=AW(e),n=UM(t,e),s=UM(t.reverse(),e);return[n,s]}function AW(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function UM(e,t){for(const n of e)if(!xme(n,{upTo:t}))return n}function xme(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 vme(e){return e instanceof HTMLInputElement&&"select"in e}function $u(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vme(e)&&t&&e.select()}}var zM=yme();function yme(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=qM(e,t),e.unshift(t)},remove(t){var n;e=qM(e,t),(n=e[0])==null||n.resume()}}}function qM(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function bme(e){return e.filter(t=>t.tagName!=="A")}var lk=0;function oS(){j.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??VM()),document.body.insertAdjacentElement("beforeend",e[1]??VM()),lk++,()=>{lk===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),lk--}},[])}function VM(){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 Ic=function(){return Ic=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ic.apply(this,arguments)};function PW(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n}function jme(e,t,n){if(n||arguments.length===2)for(var s=0,a=t.length,i;s<a;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var eN="right-scroll-bar-position",tN="width-before-scroll-bar",wme="with-scroll-bars-hidden",Nme="--removed-body-scroll-bar-size";function ck(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function _me(e,t){var n=j.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var a=n.value;a!==s&&(n.value=s,n.callback(s,a))}}}})[0];return n.callback=t,n.facade}var Sme=typeof window<"u"?j.useLayoutEffect:j.useEffect,WM=new WeakMap;function kme(e,t){var n=_me(null,function(s){return e.forEach(function(a){return ck(a,s)})});return Sme(function(){var s=WM.get(n);if(s){var a=new Set(s),i=new Set(e),o=n.current;a.forEach(function(l){i.has(l)||ck(l,null)}
vendor: 4,181 bytes, lines 812-827
812),i.forEach(function(l){a.has(l)||ck(l,o)})}WM.set(n,e)},[e]),n}function Cme(e){return e}function Ame(e,t){t===void 0&&(t=Cme);var n=[],s=!1,a={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,s);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(s=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){s=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return a}function Pme(e){e===void 0&&(e={});var t=Ame(null);return t.options=Ic({async:!0,ssr:!1},e),t}var EW=function(e){var t=e.sideCar,n=PW(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return j.createElement(s,Ic({},n))};EW.isSideCarExport=!0;function Eme(e,t){return e.useMedium(t),EW}var TW=Pme(),dk=function(){},lS=j.forwardRef(function(e,t){var n=j.useRef(null),s=j.useState({onScrollCapture:dk,onWheelCapture:dk,onTouchMoveCapture:dk}),a=s[0],i=s[1],o=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,h=e.shards,f=e.sideCar,m=e.noRelative,x=e.noIsolation,p=e.inert,v=e.allowPinchZoom,g=e.as,y=g===void 0?"div":g,b=e.gapMode,w=PW(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=f,C=kme([n,t]),E=Ic(Ic({},w),a);return j.createElement(j.Fragment,null,u&&j.createElement(_,{sideCar:TW,removeScrollBar:d,shards:h,noRelative:m,noIsolation:x,inert:p,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:b}),o?j.cloneElement(j.Children.only(l),Ic(Ic({},E),{ref:C})):j.createElement(y,Ic({},E,{className:c,ref:C}),l))});lS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};lS.classNames={fullWidth:tN,zeroRight:eN};var Tme=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ome(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Tme();return t&&e.setAttribute("nonce",t),e}function Lme(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ime(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Rme=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ome())&&(Lme(t,n),Ime(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Mme=function(){var e=Rme();return function(t,n){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},OW=function(){var e=Mme(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},Dme={left:0,top:0,right:0,gap:0},uk=function(e){return parseInt(e||"",10)||0},$me=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[uk(n),uk(s),uk(a)]},Fme=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Dme;var t=$me(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},Bme=OW(),Pg="data-scroll-locked",Ume=function(e,t,n,s){var a=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` 813 .`.concat(wme,` { 814 overflow: hidden `).concat(s,`; 815 padding-right: `).concat(l,"px ").concat(s,`; 816 } 817 body[`).concat(Pg,`] { 818 overflow: hidden `).concat(s,`; 819 overscroll-behavior: contain; 820 `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&` 821 padding-left: `.concat(a,`px; 822 padding-top: `).concat(i,`px; 823 padding-right: `).concat(o,`px; 824 margin-left:0; 825 margin-top:0; 826 margin-right: `).concat(l,"px ").concat(s,`; 827 `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(s,";
827")].filter(Boolean).join(""),` 828 } 829 830 .`).concat(eN,` { 831 right: `).concat(l,"px ").concat(s,`; 832 } 833 834 .`).concat(tN,` { 835 margin-right: `).concat(l,"px ").concat(s,`; 836 } 837 838 .`).concat(eN," .").concat(eN,` { 839 right: 0 `).concat(s,`; 840 } 841 842 .`).concat(tN," .").concat(tN,` { 843 margin-right: 0 `).concat(s,`; 844 } 845 846 body[`).concat(Pg,`] { 847 `).concat(Nme,": ").concat(l,`px; 848 } 849`)},HM=function(){var e=parseInt(document.body.getAttribute(Pg)||"0",10);return isFinite(e)?e:0},zme=function(){j.useEffect(function(){return document.body.setAttribute(Pg,(HM()+1).toString()),function(){var e=HM()-1;e<=0?document.body.removeAttribute(Pg):document.body.setAttribute(Pg,e.toString())}},[])},qme=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;zme();var i=j.useMemo(function(){return Fme(a)},[a]);return j.createElement(Bme,{styles:Ume(i,!t,a,n?"":"!important")})},mP=!1;if(typeof window<"u")try{var a1=Object.defineProperty({},"passive",{get:function(){return mP=!0,!0}});window.addEventListener("test",a1,a1),window.removeEventListener("test",a1,a1)}catch{mP=!1}var Mp=mP?{passive:!1}:!1,Vme=function(e){return e.tagName==="TEXTAREA"},LW=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vme(e)&&n[t]==="visible")},Wme=function(e){return LW(e,"overflowY")},Hme=function(e){return LW(e,"overflowX")},GM=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=IW(e,s);if(a){var i=RW(e,s),o=i[1],l=i[2];if(o>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Gme=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Yme=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},IW=function(e,t){return e==="v"?Wme(t):Hme(t)},RW=function(e,t){return e==="v"?Gme(t):Yme(t)},Kme=function(e,t){return e==="h"&&t==="rtl"?-1:1},Xme=function(e,t,n,s,a){var i=Kme(e,window.getComputedStyle(t).direction),o=i*s,l=n.target,c=t.contains(l),d=!1,u=o>0,h=0,f=0;do{if(!l)break;var m=RW(e,l),x=m[0],p=m[1],v=m[2],g=p-v-i*x;(x||g)&&IW(e,l)&&(h+=g,f+=x);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&(Math.abs(h)<1||!a)||!u&&(Math.abs(f)<1||!a))&&(d=!0),d},i1=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},YM=function(e){return[e.deltaX,e.deltaY]},KM=function(e){return e&&"current"in e?e.current:e},Zme=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jme=function(e){return` 850 .block-interactivity-`.concat(e,` {pointer-events: none;} 851 .allow-interactivity-`).concat(e,` {pointer-events: all;} 852`)},Qme=0,Dp=[];function epe(e){var t=j.useRef([]),n=j.useRef([0,0]),s=j.useRef(),a=j.useState(Qme++)[0],i=j.useState(OW)[0],o=j.useRef(e);j.useEffect(function(){o.current=e},[e]),j.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var p=jme([e.lockRef.current],(e.shards||[]).map(KM),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=j.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var g=i1(p),y=n.current,b="deltaX"in p?p.deltaX:y[0]-g[0],w="deltaY"in p?p.deltaY:y[1]-g[1],_,C=p.target,E=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in p&&E==="h"&&C.type==="range")return!1;var N=GM(E,C);if(!N)return!0;if(N?_=E:(_=E==="v"?"h":"v",N=GM(E,C)),!N)return!1;if(!s.current&&"changedTouches"in p&&(b||w)&&(s.current=_),!_)return!0;var k=s.current||_;return Xme(k,v,p,k==="h"?b:w,!0)},[]),c=j.useCallback(function(p){var v=p;if(!(!Dp.length||Dp[Dp.length-1]!==i)){var g="deltaY"in v?YM(v):i1(v),y=t.current.filter(function(_){return _.name===v.type&&(_.target===v.target||v.target===_.shadowParent)&&Zme(_.delta,g)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}
vendor: 4,354 bytes, line 852
852if(!y){var b=(o.current.shards||[]).map(KM).filter(Boolean).filter(function(_){return _.contains(v.target)}),w=b.length>0?l(v,b[0]):!o.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),d=j.useCallback(function(p,v,g,y){var b={name:p,delta:v,target:g,should:y,shadowParent:tpe(g)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(w){return w!==b})},1)},[]),u=j.useCallback(function(p){n.current=i1(p),s.current=void 0},[]),h=j.useCallback(function(p){d(p.type,YM(p),p.target,l(p,e.lockRef.current))},[]),f=j.useCallback(function(p){d(p.type,i1(p),p.target,l(p,e.lockRef.current))},[]);j.useEffect(function(){return Dp.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",c,Mp),document.addEventListener("touchmove",c,Mp),document.addEventListener("touchstart",u,Mp),function(){Dp=Dp.filter(function(p){return p!==i}),document.removeEventListener("wheel",c,Mp),document.removeEventListener("touchmove",c,Mp),document.removeEventListener("touchstart",u,Mp)}},[]);var m=e.removeScrollBar,x=e.inert;return j.createElement(j.Fragment,null,x?j.createElement(i,{styles:Jme(a)}):null,m?j.createElement(qme,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tpe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rpe=Eme(TW,epe);var pj=j.forwardRef(function(e,t){return j.createElement(lS,Ic({},e,{ref:t,sideCar:rpe}))});pj.classNames=lS.classNames;var npe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$p=new WeakMap,o1=new WeakMap,l1={},hk=0,MW=function(e){return e&&(e.host||MW(e.parentNode))},spe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=MW(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},ape=function(e,t,n,s){var a=spe(t,Array.isArray(e)?e:[e]);l1[n]||(l1[n]=new WeakMap);var i=l1[n],o=[],l=new Set,c=new Set(a),d=function(h){!h||l.has(h)||(l.add(h),d(h.parentNode))};a.forEach(d);var u=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(f){if(l.has(f))u(f);else try{var m=f.getAttribute(s),x=m!==null&&m!=="false",p=($p.get(f)||0)+1,v=(i.get(f)||0)+1;$p.set(f,p),i.set(f,v),o.push(f),p===1&&x&&o1.set(f,!0),v===1&&f.setAttribute(n,"true"),x||f.setAttribute(s,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return u(t),l.clear(),hk++,function(){o.forEach(function(h){var f=$p.get(h)-1,m=i.get(h)-1;$p.set(h,f),i.set(h,m),f||(o1.has(h)||h.removeAttribute(s),o1.delete(h)),m||h.removeAttribute(n)}),hk--,hk||($p=new WeakMap,$p=new WeakMap,o1=new WeakMap,l1={})}},cS=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=npe(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),ape(s,a,n,"aria-hidden")):function(){return null}},dS="Dialog",[DW,$W]=ea(dS),[ipe,cc]=DW(dS),FW=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:i,modal:o=!0}=e,l=j.useRef(null),c=j.useRef(null),[d,u]=Fo({prop:s,defaultProp:a??!1,onChange:i,caller:dS});return r.jsx(ipe,{scope:t,triggerRef:l,contentRef:c,contentId:ul(),titleId:ul(),descriptionId:ul(),open:d,onOpenChange:u,onOpenToggle:j.useCallback(()=>u(h=>!h),[u]),modal:o,children:n})};FW.displayName=dS;var BW="DialogTrigger",UW=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=cc(BW,n),i=gr(t,a.triggerRef);return r.jsx(Lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":iO(a.open),...s,ref:i,onClick:dt(e.onClick,a.onOpenToggle)})});UW.displayName=BW;var sO="DialogPortal",[ope,zW]=DW(sO,{forceMount:void 0}),qW=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,i=cc(sO,t);return r.jsx(ope,{scope:t,forceMount:n,children:j.Children.map(s,o=>r.jsx(hi,{present:n||i.open,children:r.jsx(Qx,{asChild:!0,container:a,children:o})}))})};qW.displayName=sO;var ZN="DialogOverlay",VW=j.forwardRef((e,t)=>{const n=zW(ZN,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,i=cc(ZN,e.__scopeDialog);return i.modal?r.jsx(hi,{present:s||i.open,children:r.jsx(cpe,{...a,ref:t})}):null});VW.displayName=ZN;var lpe=Eh("DialogOverlay.RemoveScroll"),cpe=j.forwardRef((e,t)=>
vendor: 4,999 bytes, lines 852-856
852{const{__scopeDialog:n,...s}=e,a=cc(ZN,n);return r.jsx(pj,{as:lpe,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Lt.div,{"data-state":iO(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Am="DialogContent",WW=j.forwardRef((e,t)=>{const n=zW(Am,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,i=cc(Am,e.__scopeDialog);return r.jsx(hi,{present:s||i.open,children:i.modal?r.jsx(dpe,{...a,ref:t}):r.jsx(upe,{...a,ref:t})})});WW.displayName=Am;var dpe=j.forwardRef((e,t)=>{const n=cc(Am,e.__scopeDialog),s=j.useRef(null),a=gr(t,n.contentRef,s);return j.useEffect(()=>{const i=s.current;if(i)return cS(i)},[]),r.jsx(HW,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:dt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:dt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:dt(e.onFocusOutside,i=>i.preventDefault())})}),upe=j.forwardRef((e,t)=>{const n=cc(Am,e.__scopeDialog),s=j.useRef(!1),a=j.useRef(!1);return r.jsx(HW,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),HW=j.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=e,l=cc(Am,n),c=j.useRef(null),d=gr(t,c);return oS(),r.jsxs(r.Fragment,{children:[r.jsx(mj,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:i,children:r.jsx(Ym,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":iO(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(fpe,{titleId:l.titleId}),r.jsx(ppe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),aO="DialogTitle",GW=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=cc(aO,n);return r.jsx(Lt.h2,{id:a.titleId,...s,ref:t})});GW.displayName=aO;var YW="DialogDescription",KW=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=cc(YW,n);return r.jsx(Lt.p,{id:a.descriptionId,...s,ref:t})});KW.displayName=YW;var XW="DialogClose",ZW=j.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=cc(XW,n);return r.jsx(Lt.button,{type:"button",...s,ref:t,onClick:dt(e.onClick,()=>a.onOpenChange(!1))})});ZW.displayName=XW;function iO(e){return e?"open":"closed"}var JW="DialogTitleWarning",[hpe,QW]=kae(JW,{contentName:Am,titleName:aO,docsSlug:"dialog"}),fpe=({titleId:e})=>{const t=QW(JW),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 853 854If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 855 856For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},mpe="DialogDescriptionWarning",ppe=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${QW(mpe).contentName}}.`;return j.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},oO=FW,lO=UW,cO=qW,gj=VW,xj=WW,vj=GW,yj=KW,uS=ZW;const eH=oO,gpe=lO,xpe=cO,tH=j.forwardRef(({className:e,...t},n)=>r.jsx(gj,{className:Ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));tH.displayName=gj.displayName;const vpe=ev("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),dO=j.forwardRef(({side:e="right",className:t,children:n,...s},a)=>r.jsxs(xpe,{children:[r.jsx(tH,{}),r.jsxs(xj,{ref:a,className:Ge(vpe({side:e}),t),...s,children:[n,r.jsxs(uS,{className:"absolute right-4 top-4 roun
856ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[r.jsx(ks,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));dO.displayName=xj.displayName;const rH=({className:e,...t})=>r.jsx("div",{className:Ge("flex flex-col space-y-2 text-center sm:text-left",e),...t});rH.displayName="SheetHeader";const nH=j.forwardRef(({className:e,...t},n)=>r.jsx(vj,{ref:n,className:Ge("text-lg font-semibold text-foreground",e),...t}));nH.displayName=vj.displayName;const ype=j.forwardRef(({className:e,...t},n)=>r.jsx(yj,{ref:n,className:Ge("text-sm text-muted-foreground",e),...t}));ype.displayName=yj.displayName;var bpe=j.createContext(void 0);function cv(e){const t=j.useContext(bpe);return e||t||"ltr"}var fk="rovingFocusGroup.onEntryFocus",jpe={bubbles:!1,cancelable:!0},bj="RovingFocusGroup",[pP,sH,wpe]=Jb(bj),[Npe,dv]=ea(bj,[wpe]),[_pe,Spe]=Npe(bj),aH=j.forwardRef((e,t)=>r.jsx(pP.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(pP.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(kpe,{...e,ref:t})})}));aH.displayName=bj;var kpe=j.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...h}=e,f=j.useRef(null),m=gr(t,f),x=cv(i),[p,v]=Fo({prop:o,defaultProp:l??null,onChange:c,caller:bj}),[g,y]=j.useState(!1),b=Ai(d),w=sH(n),_=j.useRef(!1),[C,E]=j.useState(0);return j.useEffect(()=>{const N=f.current;if(N)return N.addEventListener(fk,b),()=>N.removeEventListener(fk,b)},[b]),r.jsx(_pe,{scope:n,orientation:s,dir:x,loop:a,currentTabStopId:p,onItemFocus:j.useCallback(N=>v(N),[v]),onItemShiftTab:j.useCallback(()=>y(!0),[]),onFocusableItemAdd:j.useCallback(()=>E(N=>N+1),[]),onFocusableItemRemove:j.useCallback(()=>E(N=>N-1),[]),children:r.jsx(Lt.div,{tabIndex:g||C===0?-1:0,"data-orientation":s,...h,ref:m,style:{outline:"none",...e.style},onMouseDown:dt(e.onMouseDown,()=>{_.current=!0}),onFocus:dt(e.onFocus,N=>{const k=!_.current;if(N.target===N.currentTarget&&k&&!g){const I=new CustomEvent(fk,jpe);if(N.currentTarget.dispatchEvent(I),!I.defaultPrevented){const P=w().filter(z=>z.focusable),O=P.find(z=>z.active),A=P.find(z=>z.id===p),L=[O,A,...P].filter(Boolean).map(z=>z.ref.current);lH(L,u)}}_.current=!1}),onBlur:dt(e.onBlur,()=>y(!1))})})}),iH="RovingFocusGroupItem",oH=j.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:i,children:o,...l}=e,c=ul(),d=i||c,u=Spe(iH,n),h=u.currentTabStopId===d,f=sH(n),{onFocusableItemAdd:m,onFocusableItemRemove:x,currentTabStopId:p}=u;return j.useEffect(()=>{if(s)return m(),()=>x()},[s,m,x]),r.jsx(pP.ItemSlot,{scope:n,id:d,focusable:s,active:a,children:r.jsx(Lt.span,{tabIndex:h?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:dt(e.onMouseDown,v=>{s?u.onItemFocus(d):v.preventDefault()}),onFocus:dt(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:dt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const g=Ppe(v,u.orientation,u.dir);if(g!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let b=f().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")b.reverse();else if(g==="prev"||g==="next"){g==="prev"&&b.reverse();const w=b.indexOf(v.currentTarget);b=u.loop?Epe(b,w+1):b.slice(w+1)}setTimeout(()=>lH(b))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:p!=null}):o})})});oH.displayName=iH;var Cpe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ape(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ppe(e,t,n){const s=Ape(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Cpe[s]}function lH(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function Epe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}
vendor: 16,532 bytes, line 856
856var uO=aH,hO=oH,gP=["Enter"," "],Tpe=["ArrowDown","PageUp","Home"],cH=["ArrowUp","PageDown","End"],Ope=[...Tpe,...cH],Lpe={ltr:[...gP,"ArrowRight"],rtl:[...gP,"ArrowLeft"]},Ipe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},jj="Menu",[G0,Rpe,Mpe]=Jb(jj),[Xm,dH]=ea(jj,[Mpe,Wh,dv]),hS=Wh(),uH=dv(),[Dpe,Zm]=Xm(jj),[$pe,wj]=Xm(jj),hH=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:a,onOpenChange:i,modal:o=!0}=e,l=hS(t),[c,d]=j.useState(null),u=j.useRef(!1),h=Ai(i),f=cv(a);return j.useEffect(()=>{const m=()=>{u.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>u.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),r.jsx(zT,{...l,children:r.jsx(Dpe,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:r.jsx($pe,{scope:t,onClose:j.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:u,dir:f,modal:o,children:s})})})};hH.displayName=jj;var Fpe="MenuAnchor",fO=j.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=hS(n);return r.jsx(cj,{...a,...s,ref:t})});fO.displayName=Fpe;var mO="MenuPortal",[Bpe,fH]=Xm(mO,{forceMount:void 0}),mH=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:a}=e,i=Zm(mO,t);return r.jsx(Bpe,{scope:t,forceMount:n,children:r.jsx(hi,{present:n||i.open,children:r.jsx(Qx,{asChild:!0,container:a,children:s})})})};mH.displayName=mO;var hl="MenuContent",[Upe,pO]=Xm(hl),pH=j.forwardRef((e,t)=>{const n=fH(hl,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,i=Zm(hl,e.__scopeMenu),o=wj(hl,e.__scopeMenu);return r.jsx(G0.Provider,{scope:e.__scopeMenu,children:r.jsx(hi,{present:s||i.open,children:r.jsx(G0.Slot,{scope:e.__scopeMenu,children:o.modal?r.jsx(zpe,{...a,ref:t}):r.jsx(qpe,{...a,ref:t})})})})}),zpe=j.forwardRef((e,t)=>{const n=Zm(hl,e.__scopeMenu),s=j.useRef(null),a=gr(t,s);return j.useEffect(()=>{const i=s.current;if(i)return cS(i)},[]),r.jsx(gO,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:dt(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),qpe=j.forwardRef((e,t)=>{const n=Zm(hl,e.__scopeMenu);return r.jsx(gO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Vpe=Eh("MenuContent.ScrollLock"),gO=j.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:f,onDismiss:m,disableOutsideScroll:x,...p}=e,v=Zm(hl,n),g=wj(hl,n),y=hS(n),b=uH(n),w=Rpe(n),[_,C]=j.useState(null),E=j.useRef(null),N=gr(t,E,v.onContentChange),k=j.useRef(0),I=j.useRef(""),P=j.useRef(0),O=j.useRef(null),A=j.useRef("right"),R=j.useRef(0),L=x?pj:j.Fragment,z=x?{as:Vpe,allowPinchZoom:!0}:void 0,U=q=>{var pe,_e;const ne=I.current+q,se=w().filter(xe=>!xe.disabled),F=document.activeElement,V=(pe=se.find(xe=>xe.ref.current===F))==null?void 0:pe.textValue,Z=se.map(xe=>xe.textValue),de=rge(Z,ne,V),ve=(_e=se.find(xe=>xe.textValue===de))==null?void 0:_e.ref.current;(function xe(oe){I.current=oe,window.clearTimeout(k.current),oe!==""&&(k.current=window.setTimeout(()=>xe(""),1e3))})(ne),ve&&setTimeout(()=>ve.focus())};j.useEffect(()=>()=>window.clearTimeout(k.current),[]),oS();const $=j.useCallback(q=>{var se,F;return A.current===((se=O.current)==null?void 0:se.side)&&sge(q,(F=O.current)==null?void 0:F.area)},[]);return r.jsx(Upe,{scope:n,searchRef:I,onItemEnter:j.useCallback(q=>{$(q)&&q.preventDefault()},[$]),onItemLeave:j.useCallback(q=>{var ne;$(q)||((ne=E.current)==null||ne.focus(),C(null))},[$]),onTriggerLeave:j.useCallback(q=>{$(q)&&q.preventDefault()},[$]),pointerGraceTimerRef:P,onPointerGraceIntentChange:j.useCallback(q=>{O.current=q},[]),children:r.jsx(L,{...z,children:r.jsx(mj,{asChild:!0,trapped:a,onMountAutoFocus:dt(i,q=>{var ne;q.preventDefault(),(ne=E.current)==null||ne.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:r.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:f,onDismiss:m,children:r.jsx(uO,{asChild:!0,...b,dir:g.dir,orientation:"vertical",loop:s,currentTabStopId:_,onCurrentTabStopIdChange:C,onEntryFocus:dt(c,q=>{g.isUsingKeyboardRef.current||q.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(Z2,{role:"menu","aria-orientation":"vertical","data-state":TH(v.open),"data-radix-menu-content":"",dir:g.dir,...y,...p,ref:N,style:{outline:"none",...p.style},onKeyDown:dt(p.onKeyDown,q=>{const se=q.target.closest("[data-radix-menu-content]")===q.currentTarget,F=q.ctrlKey||q.altKey||q.metaKey,V=q.key.length===1;se&&(q.key==="Tab"&&q.preventDefault(),!F&&V&&U(q.key));const Z=E.current;if(q.target!==Z||!Ope.includes(q.key))return;q.preventDefault();const ve=w().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);cH.includes(q.key)&&ve.reverse(),ege(ve)}),onBlur:dt(e.onBlur,q=>{q.currentTarget.contains(q.target)||(window.clearTimeout(k.current),I.current="")}),onPointerMove:dt(e.onPointerMove,Y0(q=>{const ne=q.target,se=R.current!==q.clientX;if(q.currentTarget.contains(ne)&&se){const F=q.clientX>R.current?"right":"left";A.current=F,R.current=q.clientX}}))})})})})})})});pH.displayName=hl;var Wpe="MenuGroup",xO=j.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Lt.div,{role:"group",...s,ref:t})});xO.displayName=Wpe;var Hpe="MenuLabel",gH=j.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Lt.div,{...s,ref:t})});gH.displayName=Hpe;var JN="MenuItem",XM="menu.itemSelect",fS=j.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...a}=e,i=j.useRef(null),o=wj(JN,e.__scopeMenu),l=pO(JN,e.__scopeMenu),c=gr(t,i),d=j.useRef(!1),u=()=>{const h=i.current;if(!n&&h){const f=new CustomEvent(XM,{bubbles:!0,cancelable:!0});h.addEventListener(XM,m=>s==null?void 0:s(m),{once:!0}),_T(h,f),f.defaultPrevented?d.current=!1:o.onClose()}};return r.jsx(xH,{...a,ref:c,disabled:n,onClick:dt(e.onClick,u),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),d.current=!0},onPointerUp:dt(e.onPointerUp,h=>{var f;d.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:dt(e.onKeyDown,h=>{const f=l.searchRef.current!=="";n||f&&h.key===" "||gP.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});fS.displayName=JN;var xH=j.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...i}=e,o=pO(JN,n),l=uH(n),c=j.useRef(null),d=gr(t,c),[u,h]=j.useState(!1),[f,m]=j.useState("");return j.useEffect(()=>{const x=c.current;x&&m((x.textContent??"").trim())},[i.children]),r.jsx(G0.ItemSlot,{scope:n,disabled:s,textValue:a??f,children:r.jsx(hO,{asChild:!0,...l,focusable:!s,children:r.jsx(Lt.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...i,ref:d,onPointerMove:dt(e.onPointerMove,Y0(x=>{s?o.onItemLeave(x):(o.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:dt(e.onPointerLeave,Y0(x=>o.onItemLeave(x))),onFocus:dt(e.onFocus,()=>h(!0)),onBlur:dt(e.onBlur,()=>h(!1))})})})}),Gpe="MenuCheckboxItem",vH=j.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...a}=e;return r.jsx(NH,{scope:e.__scopeMenu,checked:n,children:r.jsx(fS,{role:"menuitemcheckbox","aria-checked":QN(n)?"mixed":n,...a,ref:t,"data-state":yO(n),onSelect:dt(a.onSelect,()=>s==null?void 0:s(QN(n)?!0:!n),{checkForDefaultPrevented:!1})})})});vH.displayName=Gpe;var yH="MenuRadioGroup",[Ype,Kpe]=Xm(yH,{value:void 0,onValueChange:()=>{}}),bH=j.forwardRef((e,t)=>{const{value:n,onValueChange:s,...a}=e,i=Ai(s);return r.jsx(Ype,{scope:e.__scopeMenu,value:n,onValueChange:i,children:r.jsx(xO,{...a,ref:t})})});bH.displayName=yH;var jH="MenuRadioItem",wH=j.forwardRef((e,t)=>{const{value:n,...s}=e,a=Kpe(jH,e.__scopeMenu),i=n===a.value;return r.jsx(NH,{scope:e.__scopeMenu,checked:i,children:r.jsx(fS,{role:"menuitemradio","aria-checked":i,...s,ref:t,"data-state":yO(i),onSelect:dt(s.onSelect,()=>{var o;return(o=a.onValueChange)==null?void 0:o.call(a,n)},{checkForDefaultPrevented:!1})})})});wH.displayName=jH;var vO="MenuItemIndicator",[NH,Xpe]=Xm(vO,{checked:!1}),_H=j.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...a}=e,i=Xpe(vO,n);return r.jsx(hi,{present:s||QN(i.checked)||i.checked===!0,children:r.jsx(Lt.span,{...a,ref:t,"data-state":yO(i.checked)})})});_H.displayName=vO;var Zpe="MenuSeparator",SH=j.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Lt.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});SH.displayName=Zpe;var Jpe="MenuArrow",kH=j.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=hS(n);return r.jsx(J2,{...a,...s,ref:t})});kH.displayName=Jpe;var Qpe="MenuSub",[RJe,CH]=Xm(Qpe),Fy="MenuSubTrigger",AH=j.forwardRef((e,t)=>{const n=Zm(Fy,e.__scopeMenu),s=wj(Fy,e.__scopeMenu),a=CH(Fy,e.__scopeMenu),i=pO(Fy,e.__scopeMenu),o=j.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,d={__scopeMenu:e.__scopeMenu},u=j.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return j.useEffect(()=>u,[u]),j.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),r.jsx(fO,{asChild:!0,...d,children:r.jsx(xH,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":TH(n.open),...e,ref:U2(t,a.onTriggerChange),onClick:h=>{var f;(f=e.onClick)==null||f.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:dt(e.onPointerMove,Y0(h=>{i.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:dt(e.onPointerLeave,Y0(h=>{var m,x;u();const f=(m=n.content)==null?void 0:m.getBoundingClientRect();if(f){const p=(x=n.content)==null?void 0:x.dataset.side,v=p==="right",g=v?-5:5,y=f[v?"left":"right"],b=f[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:y,y:f.top},{x:b,y:f.top},{x:b,y:f.bottom},{x:y,y:f.bottom}],side:p}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:dt(e.onKeyDown,h=>{var m;const f=i.searchRef.current!=="";e.disabled||f&&h.key===" "||Lpe[s.dir].includes(h.key)&&(n.onOpenChange(!0),(m=n.content)==null||m.focus(),h.preventDefault())})})})});AH.displayName=Fy;var PH="MenuSubContent",EH=j.forwardRef((e,t)=>{const n=fH(hl,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,i=Zm(hl,e.__scopeMenu),o=wj(hl,e.__scopeMenu),l=CH(PH,e.__scopeMenu),c=j.useRef(null),d=gr(t,c);return r.jsx(G0.Provider,{scope:e.__scopeMenu,children:r.jsx(hi,{present:s||i.open,children:r.jsx(G0.Slot,{scope:e.__scopeMenu,children:r.jsx(gO,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:dt(e.onFocusOutside,u=>{u.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:dt(e.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:dt(e.onKeyDown,u=>{var m;const h=u.currentTarget.contains(u.target),f=Ipe[o.dir].includes(u.key);h&&f&&(i.onOpenChange(!1),(m=l.trigger)==null||m.focus(),u.preventDefault())})})})})})});EH.displayName=PH;function TH(e){return e?"open":"closed"}function QN(e){return e==="indeterminate"}function yO(e){return QN(e)?"indeterminate":e?"checked":"unchecked"}function ege(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function tge(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function rge(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=tge(e,Math.max(i,0));a.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function nge(e,t){const{x:n,y:s}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],d=l.x,u=l.y,h=c.x,f=c.y;u>s!=f>s&&n<(h-d)*(s-u)/(f-u)+d&&(a=!a)}return a}function sge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return nge(n,t)}function Y0(e){return t=>t.pointerType==="mouse"?e(t):void 0}var age=hH,ige=fO,oge=mH,lge=pH,cge=xO,dge=gH,uge=fS,hge=vH,fge=bH,mge=wH,pge=_H,gge=SH,xge=kH,vge=AH,yge=EH,mS="DropdownMenu",[bge,MJe]=ea(mS,[dH]),Mi=dH(),[jge,OH]=bge(mS),LH=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:a,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=Mi(t),d=j.useRef(null),[u,h]=Fo({prop:a,defaultProp:i??!1,onChange:o,caller:mS});return r.jsx(jge,{scope:t,triggerId:ul(),triggerRef:d,contentId:ul(),open:u,onOpenChange:h,onOpenToggle:j.useCallback(()=>h(f=>!f),[h]),modal:l,children:r.jsx(age,{...c,open:u,onOpenChange:h,dir:s,modal:l,children:n})})};LH.displayName=mS;var IH="DropdownMenuTrigger",RH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=e,i=OH(IH,n),o=Mi(n);return r.jsx(ige,{asChild:!0,...o,children:r.jsx(Lt.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...a,ref:U2(t,i.triggerRef),onPointerDown:dt(e.onPointerDown,l=>{!s&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:dt(e.onKeyDown,l=>{s||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});RH.displayName=IH;var wge="DropdownMenuPortal",MH=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Mi(t);return r.jsx(oge,{...s,...n})};MH.displayName=wge;var DH="DropdownMenuContent",$H=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=OH(DH,n),i=Mi(n),o=j.useRef(!1);return r.jsx(lge,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...s,ref:t,onCloseAutoFocus:dt(e.onCloseAutoFocus,l=>{var c;o.current||(c=a.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:dt(e.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,u=c.button===2||d;(!a.modal||u)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$H.displayName=DH;var Nge="DropdownMenuGroup",FH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(cge,{...a,...s,ref:t})});FH.displayName=Nge;var _ge="DropdownMenuLabel",BH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(dge,{...a,...s,ref:t})});BH.displayName=_ge;var Sge="DropdownMenuItem",UH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(uge,{...a,...s,ref:t})});UH.displayName=Sge;var kge="DropdownMenuCheckboxItem",zH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(hge,{...a,...s,ref:t})});zH.displayName=kge;var Cge="DropdownMenuRadioGroup",Age=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(fge,{...a,...s,ref:t})});Age.displayName=Cge;var Pge="DropdownMenuRadioItem",qH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(mge,{...a,...s,ref:t})});qH.displayName=Pge;var Ege="DropdownMenuItemIndicator",VH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(pge,{...a,...s,ref:t})});VH.displayName=Ege;var Tge="DropdownMenuSeparator",WH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(gge,{...a,...s,ref:t})});WH.displayName=Tge;var Oge="DropdownMenuArrow",Lge=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(xge,{...a,...s,ref:t})});Lge.displayName=Oge;var Ige="DropdownMenuSubTrigger",HH=j.forwardRef((e,t)=>
856{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(vge,{...a,...s,ref:t})});HH.displayName=Ige;var Rge="DropdownMenuSubContent",GH=j.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=Mi(n);return r.jsx(yge,{...a,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});GH.displayName=Rge;var Mge=LH,Dge=RH,$ge=MH,YH=$H,Fge=FH,KH=BH,XH=UH,ZH=zH,JH=qH,QH=VH,eG=WH,tG=HH,rG=GH;const nG=Mge,sG=Dge,uy=Fge,Bge=j.forwardRef(({className:e,inset:t,children:n,...s},a)=>r.jsxs(tG,{ref:a,className:Ge("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...s,children:[n,r.jsx(ax,{className:"ml-auto h-4 w-4"})]}));Bge.displayName=tG.displayName;const Uge=j.forwardRef(({className:e,...t},n)=>r.jsx(rG,{ref:n,className:Ge("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",e),...t}));Uge.displayName=rG.displayName;const bO=j.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx($ge,{children:r.jsx(YH,{ref:s,sideOffset:t,className:Ge("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",e),...n})}));bO.displayName=YH.displayName;const ql=j.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(XH,{ref:s,className:Ge("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));ql.displayName=XH.displayName;const zge=j.forwardRef(({className:e,children:t,checked:n,...s},a)=>r.jsxs(ZH,{ref:a,className:Ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(QH,{children:r.jsx(ro,{className:"h-4 w-4"})})}),t]}));zge.displayName=ZH.displayName;const qge=j.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(JH,{ref:s,className:Ge("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(QH,{children:r.jsx(Hq,{className:"h-2 w-2 fill-current"})})}),t]}));qge.displayName=JH.displayName;const zf=j.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(KH,{ref:s,className:Ge("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));zf.displayName=KH.displayName;const xP=j.forwardRef(({className:e,...t},n)=>r.jsx(eG,{ref:n,className:Ge("-mx-1 my-1 h-px bg-muted",e),...t}));xP.displayName=eG.displayName;function ZM(){const e=zn(),[t,n]=j.useState(!1),s=[{title:"News & Media",items:[{name:"News",path:"/news",description:"Latest Nigerian headlines",icon:Ca}]},{title:"Marketplace",items:[{name:"Buy & Sell",path:"/buy-sell",description:"Shop Nigerian products",icon:eu},{name:"Jobs in Nigeria",path:"/jobs",description:"Latest vacancies & hiring",icon:fr},{name:"Classifieds",path:"/classifieds",description:"Domestic help & services",icon:fr}
856,{name:"Artisans",path:"/artisans",description:"Find skilled workers",icon:Pi}]},{title:"Experiences",items:[{name:"Events",path:"/events",description:"Discover events near you",icon:Xt},{name:"Restaurants",path:"/restaurants",description:"Find great food",icon:Vh},{name:"Tourism",path:"/tourism",description:"Explore Nigeria",icon:rj},{name:"Rentals",path:"/rentals",description:"Properties & Vehicles",icon:en}]},{title:"Creative",items:[{name:"Creativity Hub",path:"/creativity",description:"Nigerian arts & culture",icon:Lh}]},{title:"Diaspora",items:[{name:"Diaspora Hub",path:"/diaspora",description:"Services for Nigerians abroad",icon:hn},{name:"Send Money to Nigeria",path:"/send-money",description:"Compare remittance providers",icon:Jc}]}],a=i=>{n(!1),e(i)};return r.jsxs(nG,{open:t,onOpenChange:n,children:[r.jsx(sG,{asChild:!0,children:r.jsxs(W,{variant:"ghost",className:"gap-1 font-medium hover:bg-accent hover:scale-105 transition-all duration-200",children:["Explore Naija",r.jsx(tj,{className:"h-4 w-4 transition-transform duration-200"})]})}),r.jsxs(bO,{className:"w-[680px] p-6",align:"start",sideOffset:8,children:[r.jsxs("div",{className:"mb-4 pb-3 border-b",children:[r.jsx("h3",{className:"text-lg font-bold text-foreground",children:"Explore Naija"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Discover Nigerian services and experiences"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsxs(zf,{className:"text-primary font-semibold mb-3 px-0 flex items-center gap-2",children:[r.jsx(Ca,{className:"h-4 w-4"}),"News & Media"]}),r.jsx(uy,{className:"space-y-1",children:s[0].items.map(i=>{const o=i.icon;return r.jsx(ql,{onClick:()=>a(i.path),className:"cursor-pointer group py-2.5 px-3 rounded-md hover:bg-accent transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2.5 w-full",children:[r.jsx(o,{className:"h-4 w-4 text-primary mt-0.5 group-hover:scale-110 transition-transform flex-shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"font-medium text-sm leading-tight",children:i.name}),r.jsx("span",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:i.description})]})]})},i.path)})})]}),r.jsxs("div",{children:[r.jsxs(zf,{className:"text-primary font-semibold mb-3 px-0 flex items-center gap-2",children:[r.jsx(Lh,{className:"h-4 w-4"}),"Creative"]}),r.jsx(uy,{className:"space-y-1",children:s[3].items.map(i=>{const o=i.icon;return r.jsx(ql,{onClick:()=>a(i.path),className:"cursor-pointer group py-2.5 px-3 rounded-md hover:bg-accent transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2.5 w-full",children:[r.jsx(o,{className:"h-4 w-4 text-primary mt-0.5 group-hover:scale-110 transition-transform flex-shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"font-medium text-sm leading-tight",children:i.name}),r.jsx("span",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:i.description})]})]})},i.path)})})]}),r.jsxs("div",{children:[r.jsxs(zf,{className:"text-primary font-semibold mb-3 px-0 flex items-center gap-2",children:[r.jsx(hn,{className:"h-4 w-4"}),"Diaspora"]}),r.jsx(uy,{className:"space-y-1",children:s[4].items.map(i=>{const o=i.icon;return r.jsx(ql,{onClick:()=>a(i.path),className:"cursor-pointer group py-2.5 px-3 rounded-md hover:bg-accent transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2.5 w-full",children:[r.jsx(o,{className:"h-4 w-4 text-primary mt-0.5 group-hover:scale-110 transition-transform flex-shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"font-medium text-sm leading-tight",children:i.name}),r.jsx("span",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:i.description})]})]})},i.path)})})]})]}),r.jsxs("div",{children:[r.jsxs(zf,{className:"text-primary font-semibold mb-3 px-0 flex items-center gap-2",children:[r.jsx(eu,{className:"h-4 w-4"}),"Marketplace"]}),r.jsx(uy,{className:"space-y-1",children:s[1].items.map(i=>{const o=i.icon;return r.jsx(ql,{onClick:()=>a(i.path),className:"cursor-pointer group py-2.5 px-3 rounded-md hover:bg-accent transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2.5 w-full",children:[r.jsx(o,{className:"h-4 w-4 text-primary mt-0.5 group-hover:scale-110 transition-transform flex-shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"font-medium text-sm leading-tight",children:i.name}),r.jsx("span",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:i.description})]})]})},i.path)})})]}),r.jsxs("div",{children:[r.jsxs(zf,{className:"text-primary font-semibold mb-3 px-0 flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4"}),"Experiences"]}
vendor: 4,175 bytes, lines 856-864
856),r.jsx(uy,{className:"space-y-1",children:s[2].items.map(i=>{const o=i.icon;return r.jsx(ql,{onClick:()=>a(i.path),className:"cursor-pointer group py-2.5 px-3 rounded-md hover:bg-accent transition-colors",children:r.jsxs("div",{className:"flex items-start gap-2.5 w-full",children:[r.jsx(o,{className:"h-4 w-4 text-primary mt-0.5 group-hover:scale-110 transition-transform flex-shrink-0"}),r.jsxs("div",{className:"flex flex-col min-w-0",children:[r.jsx("span",{className:"font-medium text-sm leading-tight",children:i.name}),r.jsx("span",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:i.description})]})]})},i.path)})})]})]}),r.jsx("div",{className:"mt-6 pt-4 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Can't find what you need?"}),r.jsx(W,{variant:"ghost",size:"sm",onClick:()=>{n(!1),e("/contact")},className:"text-xs h-8",children:"Contact Us"})]})})]})]})}var aG={exports:{}},iG={};/** 857 * @license React 858 * use-sync-external-store-shim.production.js 859 * 860 * Copyright (c) Meta Platforms, Inc. and affiliates. 861 * 862 * This source code is licensed under the MIT license found in the 863 * LICENSE file in the root directory of this source tree. 864 */var cx=j;function Vge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wge=typeof Object.is=="function"?Object.is:Vge,Hge=cx.useState,Gge=cx.useEffect,Yge=cx.useLayoutEffect,Kge=cx.useDebugValue;function Xge(e,t){var n=t(),s=Hge({inst:{value:n,getSnapshot:t}}),a=s[0].inst,i=s[1];return Yge(function(){a.value=n,a.getSnapshot=t,mk(a)&&i({inst:a})},[e,n,t]),Gge(function(){return mk(a)&&i({inst:a}),e(function(){mk(a)&&i({inst:a})})},[e]),Kge(n),n}function mk(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Wge(e,n)}catch{return!0}}function Zge(e,t){return t()}var Jge=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Zge:Xge;iG.useSyncExternalStore=cx.useSyncExternalStore!==void 0?cx.useSyncExternalStore:Jge;aG.exports=iG;var Qge=aG.exports;function exe(){return Qge.useSyncExternalStore(txe,()=>!0,()=>!1)}function txe(){return()=>{}}var jO="Avatar",[rxe,DJe]=ea(jO),[nxe,oG]=rxe(jO),lG=j.forwardRef((e,t)=>{const{__scopeAvatar:n,...s}=e,[a,i]=j.useState("idle");return r.jsx(nxe,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:r.jsx(Lt.span,{...s,ref:t})})});lG.displayName=jO;var cG="AvatarImage",dG=j.forwardRef((e,t)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:a=()=>{},...i}=e,o=oG(cG,n),l=sxe(s,i),c=Ai(d=>{a(d),o.onImageLoadingStatusChange(d)});return Hs(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?r.jsx(Lt.img,{...i,ref:t,src:s}):null});dG.displayName=cG;var uG="AvatarFallback",hG=j.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:s,...a}=e,i=oG(uG,n),[o,l]=j.useState(s===void 0);return j.useEffect(()=>{if(s!==void 0){const c=window.setTimeout(()=>l(!0),s);return()=>window.clearTimeout(c)}},[s]),o&&i.imageLoadingStatus!=="loaded"?r.jsx(Lt.span,{...a,ref:t}):null});hG.displayName=uG;function JM(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function sxe(e,{referrerPolicy:t,crossOrigin:n}){const s=exe(),a=j.useRef(null),i=s?(a.current||(a.current=new window.Image),a.current):null,[o,l]=j.useState(()=>JM(i,e));return Hs(()=>{l(JM(i,e))},[i,e]),Hs(()=>{const c=h=>()=>{l(h)};if(!i)return;const d=c("loaded"),u=c("error");return i.addEventListener("load",d),i.addEventListener("error",u),t&&(i.referrerPolicy=t),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",d),i.removeEventListener("error",u)}},[i,n,t]),o}var fG=lG,mG=dG,pG=hG;const wO=j.forwardRef(({className:e,...t},n)=>r.jsx(fG,{ref:n,className:Ge("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));wO.displayName=fG.displayName;const gG=j.forwardRef(({className:e,...t},n)=>r.jsx(mG,{ref:n,className:Ge("aspect-square h-full w-full",e),...t}));gG.displayName=mG.displayName;const NO=j.forwardRef(({className:e,...t},n)=>r.jsx(pG,{ref:n,className:Ge("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));
864NO.displayName=pG.displayName;function QM(){var l;const{user:e,signOut:t}=bt(),[n,s]=j.useState(null);j.useEffect(()=>{e&&a()},[e]);const a=async()=>{if(!e)return;const{data:c,error:d}=await H.from("profiles").select("full_name, username, avatar_url, role").eq("id",e.id).single();!d&&c&&s(c)};if(!e)return r.jsx(Vt,{to:"/auth",children:r.jsx(W,{variant:"outline",children:"Sign In"})});const i=(n==null?void 0:n.full_name)||(n==null?void 0:n.username)||((l=e.email)==null?void 0:l.split("@")[0])||"User",o=i.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2);return r.jsxs(nG,{children:[r.jsx(sG,{asChild:!0,children:r.jsx(W,{variant:"ghost",className:"relative h-8 w-8 rounded-full",children:r.jsxs(wO,{className:"h-8 w-8",children:[r.jsx(gG,{src:(n==null?void 0:n.avatar_url)||"",alt:i}),r.jsx(NO,{children:o})]})})}),r.jsxs(bO,{className:"w-56",align:"end",forceMount:!0,children:[r.jsx(zf,{className:"font-normal",children:r.jsxs("div",{className:"flex flex-col space-y-1",children:[r.jsx("p",{className:"text-sm font-medium leading-none",children:i}),r.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:e.email}),(n==null?void 0:n.role)&&r.jsx("p",{className:"text-xs leading-none text-secondary capitalize",children:n.role.replace("_"," ")})]})}),r.jsx(xP,{}),r.jsx(ql,{asChild:!0,children:r.jsxs(Vt,{to:"/profile",className:"cursor-pointer",children:[r.jsx(TT,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Profile"})]})}),r.jsx(ql,{asChild:!0,children:r.jsxs(Vt,{to:"/dashboard",className:"cursor-pointer",children:[r.jsx(FN,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Dashboard"})]})}),r.jsx(ql,{asChild:!0,children:r.jsxs(Vt,{to:"/settings/location",className:"cursor-pointer",children:[r.jsx(At,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Location Settings"})]})}),(n==null?void 0:n.role)==="admin"&&r.jsx(ql,{asChild:!0,children:r.jsxs(Vt,{to:"/admin",className:"cursor-pointer",children:[r.jsx(fn,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Admin Panel"})]})}),r.jsx(xP,{}),r.jsxs(ql,{onClick:async()=>{try{await t()}catch{localStorage.clear(),window.location.href="/auth"}},className:"cursor-pointer",children:[r.jsx(Vie,{className:"mr-2 h-4 w-4"}),r.jsx("span",{children:"Sign out"})]})]})]})}const axe=["wise.com","lemfi.com","sendwave.com","remitly.com","worldremit.com","taptapsend.com","booking.com","viator.com","getyourguide.com","amazon.com","amzn.to","nordvpn.com","paystack.com","flutterwave.com"],ixe=e=>{try{const t=window.location.origin;return new URL(e,t).origin!==t}catch{return!1}},eD=e=>{try{const t=new URL(e);return axe.some(n=>t.hostname.includes(n)||t.hostname.endsWith(n))}catch{return!1}},oxe=(e,t={})=>{try{const n=new URL(e),s={source:"naija",medium:"referral",...t};return Object.entries(s).forEach(([a,i])=>{i&&n.searchParams.set(`utm_${a}`,String(i))}),n.toString()}catch(n){return console.warn("Failed to add UTM parameters:",n),e}},lxe=(e,t={})=>{const{utm:n={},trackClick:s=!0}=t;let a=e;return eD(e)&&(a=oxe(e,n)),{href:a,target:"_blank",rel:"noopener noreferrer",onClick:s?o=>{var l;window.gtag&&window.gtag("event","external_link_click",{link_url:a,link_domain:new URL(a).hostname}),(l=window.analytics)!=null&&l.track&&window.analytics.track("External Link Clicked",{url:a,domain:new URL(a).hostname,utm_params:eD(e)?n:null})}:void 0}},cxe=e=>{try{const t=new URL(e);if(!["http:","https:"].includes(t.protocol))return null;const n=t.hostname.toLowerCase();return["localhost","127.0.0.1","0.0.0.0","::1","file://","data:","javascript:","vbscript:"].some(a=>n.includes(a)||e.toLowerCase().startsWith(a))?null:t.toString()}catch{return console.warn("Invalid URL provided:",e),null}},ai=({to:e,external:t=!1,utm:n,children:s,...a})=>{if(t||ixe(e)||e.startsWith("mailto:")||e.startsWith("tel:")){if(e.startsWith("mailto:")||e.startsWith("tel:"))return r.jsx("a",{href:e,...a,children:s});const d=cxe(e);if(!d)return r.jsx("span",{className:"text-muted-foreground cursor-not-allowed",title:"Unsafe link blocked",...a,children:s});const u=lxe(d,{utm:n,trackClick:!0});return r.jsx("a",{...u,...a,children:s})}const o=Uf.redirects.legacy[e]||e;return Uf.redirects.gone.includes(o)?r.jsx("span",{className:"text-muted-foreground cursor-not-allowed",title:"This page is no longer available",children:s}):(["/","/content","/creativity","/events","/marketplace","/bookings","/lodging","/restaurants","/buy-sell","/artisans","/tourism","/diaspora","/submit","/about","/contact","/donate","/create","/payments","/auth","/dashboard","/admin","/advertise","/privacy-policy","/terms-of-service","/community-guidelines","/cookie-policy","/403","/events/dashboard","/news","/classifieds","/explore","/rentals","/refund-policy","/location-settings","/forbidden"].includes(o)||o.startsWith("/content/")||o.startsWith("/events/")||o.startsWith("/marketplace/")||o.startsWith("/bookings/")||console.warn(`Invalid route detected: ${o}`),r.jsx(Vt,{to:o,...a,children:s}))},dxe=ev("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function te({className:e,variant:t,...n}){return r.jsx("div",{className:Ge(dxe({variant:t}),e),...n})}const uxe=()=>{const{user:e}=bt(),{primaryRole:t,hasRole:n,hasAnyRole:s,isAdmin:a}=fj();return e?((()=>{const o=[];return(n("event_organizer")||a)&&o.push({label:"Create Event",href:"/create",icon:Xt}),(n("vendor")||a)&&o.push({label:"Add Product",href:"/create",icon:Qc}),(n("property_owner")||a)&&o.push({label:"List Property",href:"/create",icon:en}),o})(),r.jsx("div",{className:"flex items-center gap-3",children:r.jsxs(te,{variant:"secondary",className:"text-xs font-medium",children:[r.jsx(aoe,{className:"h-3 w-3 mr-1"}),t==null?void 0:t.replace("_"," ")]})})):null},Rt=oO,li=lO,hxe=cO,xG=j.forwardRef(({className:e,...t},n)=>r.jsx(gj,{ref:n,className:Ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));xG.displayName=gj.displayName;const Ot=j.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(hxe,{children:[r.jsx(xG,{}),r.jsxs(xj,{ref:s,className:Ge("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
864nded-lg",e),...n,children:[t,r.jsxs(uS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx(ks,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ot.displayName=xj.displayName;const Mt=({className:e,...t})=>r.jsx("div",{className:Ge("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Mt.displayName="DialogHeader";const Yh=({className:e,...t})=>r.jsx("div",{className:Ge("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Yh.displayName="DialogFooter";const Dt=j.forwardRef(({className:e,...t},n)=>r.jsx(vj,{ref:n,className:Ge("text-lg font-semibold leading-none tracking-tight",e),...t}));Dt.displayName=vj.displayName;const on=j.forwardRef(({className:e,...t},n)=>r.jsx(yj,{ref:n,className:Ge("text-sm text-muted-foreground",e),...t}));on.displayName=yj.displayName;const ge=j.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:Ge("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));ge.displayName="Input";var fxe="Label",vG=j.forwardRef((e,t)=>r.jsx(Lt.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));vG.displayName=fxe;var yG=vG;const mxe=ev("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),le=j.forwardRef(({className:e,...t},n)=>r.jsx(yG,{ref:n,className:Ge(mxe(),e),...t}));le.displayName=yG.displayName;function Nj(e){const t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var _O="Radio",[pxe,bG]=ea(_O),[gxe,xxe]=pxe(_O),jG=j.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:a=!1,required:i,disabled:o,value:l="on",onCheck:c,form:d,...u}=e,[h,f]=j.useState(null),m=gr(t,v=>f(v)),x=j.useRef(!1),p=h?d||!!h.closest("form"):!0;return r.jsxs(gxe,{scope:n,checked:a,disabled:o,children:[r.jsx(Lt.button,{type:"button",role:"radio","aria-checked":a,"data-state":SG(a),"data-disabled":o?"":void 0,disabled:o,value:l,...u,ref:m,onClick:dt(e.onClick,v=>{a||c==null||c(),p&&(x.current=v.isPropagationStopped(),x.current||v.stopPropagation())})}),p&&r.jsx(_G,{control:h,bubbles:!x.current,name:s,value:l,checked:a,required:i,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});jG.displayName=_O;var wG="RadioIndicator",NG=j.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...a}=e,i=xxe(wG,n);return r.jsx(hi,{present:s||i.checked,children:r.jsx(Lt.span,{"data-state":SG(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});NG.displayName=wG;var vxe="RadioBubbleInput",_G=j.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:s=!0,...a},i)=>{const o=j.useRef(null),l=gr(o,i),c=Nj(n),d=lj(t);return j.useEffect(()=>{const u=o.current;if(!u)return;const h=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&m){const x=new Event("click",{bubbles:s});m.call(u,n),u.dispatchEvent(x)}},[c,n,s]),r.jsx(Lt.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_G.displayName=vxe;function SG(e){return e?"checked":"unchecked"}var yxe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],pS="RadioGroup",[bxe,$Je]=ea(pS,[dv,bG]),kG=dv(),CG=bG(),[jxe,wxe]=bxe(pS),AG=j.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,defaultValue:a,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:h,...f}=e,m=kG(n),x=cv(d),[p,v]=Fo({prop:i,defaultProp:a??null,onChange:h,caller:pS});return r.jsx(jxe,{scope:n,name:s,required:o,disabled:l,value:p,onValueChange:v,children:r.jsx(uO,{asChild:!0,...m,orientation:c,dir:x,loop:u,children:r.jsx(Lt.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:x,...f,ref:t})})})});AG.displayName=pS;var PG="RadioGroupItem",EG=j.forwardRef((e,t)=>
vendor: 3,926 bytes, line 864
864{const{__scopeRadioGroup:n,disabled:s,...a}=e,i=wxe(PG,n),o=i.disabled||s,l=kG(n),c=CG(n),d=j.useRef(null),u=gr(t,d),h=i.value===a.value,f=j.useRef(!1);return j.useEffect(()=>{const m=p=>{yxe.includes(p.key)&&(f.current=!0)},x=()=>f.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",x)}},[]),r.jsx(hO,{asChild:!0,...l,focusable:!o,active:h,children:r.jsx(jG,{disabled:o,required:i.required,checked:h,...c,...a,name:i.name,ref:u,onCheck:()=>i.onValueChange(a.value),onKeyDown:dt(m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:dt(a.onFocus,()=>{var m;f.current&&((m=d.current)==null||m.click())})})})});EG.displayName=PG;var Nxe="RadioGroupIndicator",TG=j.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,a=CG(n);return r.jsx(NG,{...a,...s,ref:t})});TG.displayName=Nxe;var OG=AG,LG=EG,_xe=TG;const IG=j.forwardRef(({className:e,...t},n)=>r.jsx(OG,{className:Ge("grid gap-2",e),...t,ref:n}));IG.displayName=OG.displayName;const RG=j.forwardRef(({className:e,...t},n)=>r.jsx(LG,{ref:n,className:Ge("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:r.jsx(_xe,{className:"flex items-center justify-center",children:r.jsx(Hq,{className:"h-2.5 w-2.5 fill-current text-current"})})}));RG.displayName=LG.displayName;var gS="Switch",[Sxe,FJe]=ea(gS),[kxe,Cxe]=Sxe(gS),MG=j.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...h}=e,[f,m]=j.useState(null),x=gr(t,b=>m(b)),p=j.useRef(!1),v=f?u||!!f.closest("form"):!0,[g,y]=Fo({prop:a,defaultProp:i??!1,onChange:d,caller:gS});return r.jsxs(kxe,{scope:n,checked:g,disabled:l,children:[r.jsx(Lt.button,{type:"button",role:"switch","aria-checked":g,"aria-required":o,"data-state":BG(g),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:x,onClick:dt(e.onClick,b=>{y(w=>!w),v&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})}),v&&r.jsx(FG,{control:f,bubbles:!p.current,name:s,value:c,checked:g,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});MG.displayName=gS;var DG="SwitchThumb",$G=j.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,a=Cxe(DG,n);return r.jsx(Lt.span,{"data-state":BG(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})});$G.displayName=DG;var Axe="SwitchBubbleInput",FG=j.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...a},i)=>{const o=j.useRef(null),l=gr(o,i),c=Nj(n),d=lj(t);return j.useEffect(()=>{const u=o.current;if(!u)return;const h=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&m){const x=new Event("click",{bubbles:s});m.call(u,n),u.dispatchEvent(x)}},[c,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});FG.displayName=Axe;function BG(e){return e?"checked":"unchecked"}var UG=MG,Pxe=$G;const Ro=j.forwardRef(({className:e,...t},n)=>r.jsx(UG,{className:Ge("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:r.jsx(Pxe,{className:Ge("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ro.displayName=UG.displayName;
vendor: 4,674 bytes, line 864
864var xS="Tabs",[Exe,BJe]=ea(xS,[dv]),zG=dv(),[Txe,SO]=Exe(xS),qG=j.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...d}=e,u=cv(l),[h,f]=Fo({prop:s,onChange:a,defaultProp:i??"",caller:xS});return r.jsx(Txe,{scope:n,baseId:ul(),value:h,onValueChange:f,orientation:o,dir:u,activationMode:c,children:r.jsx(Lt.div,{dir:u,"data-orientation":o,...d,ref:t})})});qG.displayName=xS;var VG="TabsList",WG=j.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,i=SO(VG,n),o=zG(n);return r.jsx(uO,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(Lt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});WG.displayName=VG;var HG="TabsTrigger",GG=j.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...i}=e,o=SO(HG,n),l=zG(n),c=XG(o.baseId,s),d=ZG(o.baseId,s),u=s===o.value;return r.jsx(hO,{asChild:!0,...l,focusable:!a,active:u,children:r.jsx(Lt.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:dt(e.onMouseDown,h=>{!a&&h.button===0&&h.ctrlKey===!1?o.onValueChange(s):h.preventDefault()}),onKeyDown:dt(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(s)}),onFocus:dt(e.onFocus,()=>{const h=o.activationMode!=="manual";!u&&!a&&h&&o.onValueChange(s)})})})});GG.displayName=HG;var YG="TabsContent",KG=j.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:i,...o}=e,l=SO(YG,n),c=XG(l.baseId,s),d=ZG(l.baseId,s),u=s===l.value,h=j.useRef(u);return j.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),r.jsx(hi,{present:a||u,children:({present:f})=>r.jsx(Lt.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:f&&i})})});KG.displayName=YG;function XG(e,t){return`${e}-trigger-${t}`}function ZG(e,t){return`${e}-content-${t}`}var Oxe=qG,JG=WG,QG=GG,eY=KG;const Kr=Oxe,Hr=j.forwardRef(({className:e,...t},n)=>r.jsx(JG,{ref:n,className:Ge("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Hr.displayName=JG.displayName;const Re=j.forwardRef(({className:e,...t},n)=>r.jsx(QG,{ref:n,className:Ge("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-4 py-2.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm hover:bg-accent hover:text-accent-foreground",e),...t}));Re.displayName=QG.displayName;const Be=j.forwardRef(({className:e,...t},n)=>r.jsx(eY,{ref:n,className:Ge("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Be.displayName=eY.displayName;function e_(e,[t,n]){return Math.min(n,Math.max(t,e))}var Lxe=[" ","Enter","ArrowUp","ArrowDown"],Ixe=[" ","Enter"],Pm="Select",[vS,yS,Rxe]=Jb(Pm),[uv,UJe]=ea(Pm,[Rxe,Wh]),bS=Wh(),[Mxe,Kh]=uv(Pm),[Dxe,$xe]=uv(Pm),tY=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:a,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:h,disabled:f,required:m,form:x}=e,p=bS(t),[v,g]=j.useState(null),[y,b]=j.useState(null),[w,_]=j.useState(!1),C=cv(d),[E,N]=Fo({prop:s,defaultProp:a??!1,onChange:i,caller:Pm}),[k,I]=Fo({prop:o,defaultProp:l,onChange:c,caller:Pm}),P=j.useRef(null),O=v?x||!!v.closest("form"):!0,[A,R]=j.useState(new Set),L=Array.from(A).map(z=>z.props.value).join(";");return r.jsx(zT,{...p,children:r.jsxs(Mxe,{required:m,scope:t,trigger:v,onTriggerChange:g,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:_,contentId:ul(),value:k,onValueChange:I,open:E,onOpenChange:N,dir:C,triggerPointerDownPosRef:P,disabled:f,children:[r.jsx(vS.Provider,{scope:t,children:r.jsx(Dxe,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(z=>{R(U=>new Set(U).add(z))},[]),onNativeOptionRemove:j.useCallback(z=>{R(U=>{const $=new Set(U);return $.delete(z),$})},[]),children:n})}),O?r.jsxs(SY,{"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:h,value:k,onChange:z=>I(z.target.value),disabled:f,form:x,children:[k===void 0?r.jsx("option",{value:""}):null,Array.from(A)]},L):null]})})};tY.displayName=Pm;var rY="SelectTrigger",nY=j.forwardRef((e,t)=>
vendor: 16,905 bytes, line 864
864{const{__scopeSelect:n,disabled:s=!1,...a}=e,i=bS(n),o=Kh(rY,n),l=o.disabled||s,c=gr(t,o.onTriggerChange),d=yS(n),u=j.useRef("touch"),[h,f,m]=CY(p=>{const v=d().filter(b=>!b.disabled),g=v.find(b=>b.value===o.value),y=AY(v,p,g);y!==void 0&&o.onValueChange(y.value)}),x=p=>{l||(o.onOpenChange(!0),m()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return r.jsx(cj,{asChild:!0,...i,children:r.jsx(Lt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":kY(o.value)?"":void 0,...a,ref:c,onClick:dt(a.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&x(p)}),onPointerDown:dt(a.onPointerDown,p=>{u.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(x(p),p.preventDefault())}),onKeyDown:dt(a.onKeyDown,p=>{const v=h.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&f(p.key),!(v&&p.key===" ")&&Lxe.includes(p.key)&&(x(),p.preventDefault())})})})});nY.displayName=rY;var sY="SelectValue",aY=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,children:i,placeholder:o="",...l}=e,c=Kh(sY,n),{onValueNodeHasChildrenChange:d}=c,u=i!==void 0,h=gr(t,c.onValueNodeChange);return Hs(()=>{d(u)},[d,u]),r.jsx(Lt.span,{...l,ref:h,style:{pointerEvents:"none"},children:kY(c.value)?r.jsx(r.Fragment,{children:o}):i})});aY.displayName=sY;var Fxe="SelectIcon",iY=j.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...a}=e;return r.jsx(Lt.span,{"aria-hidden":!0,...a,ref:t,children:s||"â¼"})});iY.displayName=Fxe;var Bxe="SelectPortal",oY=e=>r.jsx(Qx,{asChild:!0,...e});oY.displayName=Bxe;var Em="SelectContent",lY=j.forwardRef((e,t)=>{const n=Kh(Em,e.__scopeSelect),[s,a]=j.useState();if(Hs(()=>{a(new DocumentFragment)},[]),!n.open){const i=s;return i?Gm.createPortal(r.jsx(cY,{scope:e.__scopeSelect,children:r.jsx(vS.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),i):null}return r.jsx(dY,{...e,ref:t})});lY.displayName=Em;var Ll=10,[cY,Xh]=uv(Em),Uxe="SelectContentImpl",zxe=Eh("SelectContent.RemoveScroll"),dY=j.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:f,collisionPadding:m,sticky:x,hideWhenDetached:p,avoidCollisions:v,...g}=e,y=Kh(Em,n),[b,w]=j.useState(null),[_,C]=j.useState(null),E=gr(t,pe=>w(pe)),[N,k]=j.useState(null),[I,P]=j.useState(null),O=yS(n),[A,R]=j.useState(!1),L=j.useRef(!1);j.useEffect(()=>{if(b)return cS(b)},[b]),oS();const z=j.useCallback(pe=>{const[_e,...xe]=O().map(ce=>ce.ref.current),[oe]=xe.slice(-1),we=document.activeElement;for(const ce of pe)if(ce===we||(ce==null||ce.scrollIntoView({block:"nearest"}),ce===_e&&_&&(_.scrollTop=0),ce===oe&&_&&(_.scrollTop=_.scrollHeight),ce==null||ce.focus(),document.activeElement!==we))return},[O,_]),U=j.useCallback(()=>z([N,b]),[z,N,b]);j.useEffect(()=>{A&&U()},[A,U]);const{onOpenChange:$,triggerPointerDownPosRef:q}=y;j.useEffect(()=>{if(b){let pe={x:0,y:0};const _e=oe=>{var we,ce;pe={x:Math.abs(Math.round(oe.pageX)-(((we=q.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(oe.pageY)-(((ce=q.current)==null?void 0:ce.y)??0))}},xe=oe=>{pe.x<=10&&pe.y<=10?oe.preventDefault():b.contains(oe.target)||$(!1),document.removeEventListener("pointermove",_e),q.current=null};return q.current!==null&&(document.addEventListener("pointermove",_e),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_e),document.removeEventListener("pointerup",xe,{capture:!0})}}},[b,$,q]),j.useEffect(()=>{const pe=()=>$(!1);return window.addEventListener("blur",pe),window.addEventListener("resize",pe),()=>{window.removeEventListener("blur",pe),window.removeEventListener("resize",pe)}},[$]);const[ne,se]=CY(pe=>{const _e=O().filter(we=>!we.disabled),xe=_e.find(we=>we.ref.current===document.activeElement),oe=AY(_e,pe,xe);oe&&setTimeout(()=>oe.ref.current.focus())}),F=j.useCallback((pe,_e,xe)=>{const oe=!L.current&&!xe;(y.value!==void 0&&y.value===_e||oe)&&(k(pe),oe&&(L.current=!0))},[y.value]),V=j.useCallback(()=>b==null?void 0:b.focus(),[b]),Z=j.useCallback((pe,_e,xe)=>{const oe=!L.current&&!xe;(y.value!==void 0&&y.value===_e||oe)&&P(pe)},[y.value]),de=s==="popper"?vP:uY,ve=de===vP?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:f,collisionPadding:m,sticky:x,hideWhenDetached:p,avoidCollisions:v}:{};return r.jsx(cY,{scope:n,content:b,viewport:_,onViewportChange:C,itemRefCallback:F,selectedItem:N,onItemLeave:V,itemTextRefCallback:Z,focusSelectedItem:U,selectedItemText:I,position:s,isPositioned:A,searchRef:ne,children:r.jsx(pj,{as:zxe,allowPinchZoom:!0,children:r.jsx(mj,{asChild:!0,trapped:y.open,onMountAutoFocus:pe=>{pe.preventDefault()},onUnmountAutoFocus:dt(a,pe=>{var _e;(_e=y.trigger)==null||_e.focus({preventScroll:!0}),pe.preventDefault()}),children:r.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:pe=>pe.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:r.jsx(de,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:pe=>pe.preventDefault(),...g,...ve,onPlaced:()=>R(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:dt(g.onKeyDown,pe=>{const _e=pe.ctrlKey||pe.altKey||pe.metaKey;if(pe.key==="Tab"&&pe.preventDefault(),!_e&&pe.key.length===1&&se(pe.key),["ArrowUp","ArrowDown","Home","End"].includes(pe.key)){let oe=O().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(pe.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(pe.key)){const we=pe.target,ce=oe.indexOf(we);oe=oe.slice(ce+1)}setTimeout(()=>z(oe)),pe.preventDefault()}})})})})})})});dY.displayName=Uxe;var qxe="SelectItemAlignedPosition",uY=j.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...a}=e,i=Kh(Em,n),o=Xh(Em,n),[l,c]=j.useState(null),[d,u]=j.useState(null),h=gr(t,E=>u(E)),f=yS(n),m=j.useRef(!1),x=j.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:g,focusSelectedItem:y}=o,b=j.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&p&&v&&g){const E=i.trigger.getBoundingClientRect(),N=d.getBoundingClientRect(),k=i.valueNode.getBoundingClientRect(),I=g.getBoundingClientRect();if(i.dir!=="rtl"){const we=I.left-N.left,ce=k.left-we,De=E.left-ce,Ue=E.width+De,re=Math.max(Ue,N.width),et=window.innerWidth-Ll,kt=e_(ce,[Ll,Math.max(Ll,et-re)]);l.style.minWidth=Ue+"px",l.style.left=kt+"px"}else{const we=N.right-I.right,ce=window.innerWidth-k.right-we,De=window.innerWidth-E.right-ce,Ue=E.width+De,re=Math.max(Ue,N.width),et=window.innerWidth-Ll,kt=e_(ce,[Ll,Math.max(Ll,et-re)]);l.style.minWidth=Ue+"px",l.style.right=kt+"px"}const P=f(),O=window.innerHeight-Ll*2,A=p.scrollHeight,R=window.getComputedStyle(d),L=parseInt(R.borderTopWidth,10),z=parseInt(R.paddingTop,10),U=parseInt(R.borderBottomWidth,10),$=parseInt(R.paddingBottom,10),q=L+z+A+$+U,ne=Math.min(v.offsetHeight*5,q),se=window.getComputedStyle(p),F=parseInt(se.paddingTop,10),V=parseInt(se.paddingBottom,10),Z=E.top+E.height/2-Ll,de=O-Z,ve=v.offsetHeight/2,pe=v.offsetTop+ve,_e=L+z+pe,xe=q-_e;if(_e<=Z){const we=P.length>0&&v===P[P.length-1].ref.current;l.style.bottom="0px";const ce=d.clientHeight-p.offsetTop-p.offsetHeight,De=Math.max(de,ve+(we?V:0)+ce+U),Ue=_e+De;l.style.height=Ue+"px"}else{const we=P.length>0&&v===P[0].ref.current;l.style.top="0px";const De=Math.max(Z,L+p.offsetTop+(we?F:0)+ve)+xe;l.style.height=De+"px",p.scrollTop=_e-Z+p.offsetTop}l.style.margin=`${Ll}px 0`,l.style.minHeight=ne+"px",l.style.maxHeight=O+"px",s==null||s(),requestAnimationFrame(()=>m.current=!0)}},[f,i.trigger,i.valueNode,l,d,p,v,g,i.dir,s]);Hs(()=>b(),[b]);const[w,_]=j.useState();Hs(()=>{d&&_(window.getComputedStyle(d).zIndex)},[d]);const C=j.useCallback(E=>{E&&x.current===!0&&(b(),y==null||y(),x.current=!1)},[b,y]);return r.jsx(Wxe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:m,onScrollButtonChange:C,children:r.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:r.jsx(Lt.div,{...a,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});uY.displayName=qxe;var Vxe="SelectPopperPosition",vP=j.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=Ll,...i}=e,o=bS(n);return r.jsx(Z2,{...o,...i,ref:t,align:s,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});vP.displayName=Vxe;var[Wxe,kO]=uv(Em,{}),yP="SelectViewport",hY=j.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...a}=e,i=Xh(yP,n),o=kO(yP,n),l=gr(t,i.onViewportChange),c=j.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(vS.Slot,{scope:n,children:r.jsx(Lt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:dt(a.onScroll,d=>{const u=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&h){const m=Math.abs(c.current-u.scrollTop);if(m>0){const x=window.innerHeight-Ll*2,p=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),g=Math.max(p,v);if(g<x){const y=g+m,b=Math.min(x,y),w=y-b;h.style.height=b+"px",h.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});hY.displayName=yP;var fY="SelectGroup",[Hxe,Gxe]=uv(fY),Yxe=j.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=ul();return r.jsx(Hxe,{scope:n,id:a,children:r.jsx(Lt.div,{role:"group","aria-labelledby":a,...s,ref:t})})});Yxe.displayName=fY;var mY="SelectLabel",pY=j.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=Gxe(mY,n);return r.jsx(Lt.div,{id:a.id,...s,ref:t})});pY.displayName=mY;var t_="SelectItem",[Kxe,gY]=uv(t_),xY=j.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:i,...o}=e,l=Kh(t_,n),c=Xh(t_,n),d=l.value===s,[u,h]=j.useState(i??""),[f,m]=j.useState(!1),x=gr(t,y=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,y,s,a)}),p=ul(),v=j.useRef("touch"),g=()=>{a||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(Kxe,{scope:n,value:s,disabled:a,textId:p,isSelected:d,onItemTextChange:j.useCallback(y=>{h(b=>b||((y==null?void 0:y.textContent)??"").trim())},[]),children:r.jsx(vS.ItemSlot,{scope:n,value:s,disabled:a,textValue:u,children:r.jsx(Lt.div,{role:"option","aria-labelledby":p,"data-highlighted":f?"":void 0,"aria-selected":d&&f,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:x,onFocus:dt(o.onFocus,()=>m(!0)),onBlur:dt(o.onBlur,()=>m(!1)),onClick:dt(o.onClick,()=>{v.current!=="mouse"&&g()}),onPointerUp:dt(o.onPointerUp,()=>{v.current==="mouse"&&g()}),onPointerDown:dt(o.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:dt(o.onPointerMove,y=>{var b;v.current=y.pointerType,a?(b=c.onItemLeave)==null||b.call(c):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:dt(o.onPointerLeave,y=>{var b;y.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:dt(o.onKeyDown,y=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&y.key===" "||(Ixe.includes(y.key)&&g(),y.key===" "&&y.preventDefault())})})})})});xY.displayName=t_;var By="SelectItemText",vY=j.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,...i}=e,o=Kh(By,n),l=Xh(By,n),c=gY(By,n),d=$xe(By,n),[u,h]=j.useState(null),f=gr(t,g=>h(g),c.onItemTextChange,g=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,g,c.value,c.disabled)}),m=u==null?void 0:u.textContent,x=j.useMemo(()=>r.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=d;return Hs(()=>(p(x),()=>v(x)),[p,v,x]),r.jsxs(r.Fragment,{children:[r.jsx(Lt.span,{id:c.textId,...i,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gm.createPortal(i.children,o.valueNode):null]})});vY.displayName=By;var yY="SelectItemIndicator",bY=j.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return gY(yY,n).isSelected?r.jsx(Lt.span,{"aria-hidden":!0,...s,ref:t}):null});bY.displayName=yY;var bP="SelectScrollUpButton",jY=j.forwardRef((e,t)=>{const n=Xh(bP,e.__scopeSelect),s=kO(bP,e.__scopeSelect),[a,i]=j.useState(!1),o=gr(t,s.onScrollButtonChange);return Hs(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?r.jsx(NY,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});jY.displayName=bP;var jP="SelectScrollDownButton",wY=j.forwardRef((e,t)=>{const n=Xh(jP,e.__scopeSelect),s=kO(jP,e.__scopeSelect),[a,i]=j.useState(!1),o=gr(t,s.onScrollButtonChange);return Hs(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),a?r.jsx(NY,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});wY.displayName=jP;var NY=j.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=e,i=Xh("SelectScrollButton",n),o=j.useRef(null),l=yS(n),c=j.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return j.useEffect(()=>()=>c(),[c]),Hs(()=>{var u;const d=l().find(h=>h.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[l]),r.jsx(Lt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:dt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(s,50))}),onPointerMove:dt(a.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(s,50))}),onPointerLeave:dt(a.onPointerLeave,()=>{c()})})}),Xxe="SelectSeparator",_Y=j.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Lt.div,{"aria-hidden":!0,...s,ref:t})});_Y.displayName=Xxe;var wP="SelectArrow",Zxe=j.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=bS(n),i=Kh(wP,n),o=Xh(wP,n);return i.open&&o.position==="popper"?r.jsx(J2,{...a,...s,ref:t}):null});Zxe.displayName=wP;var Jxe="SelectBubbleInput",SY=j.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const a=j.useRef(null),i=gr(s,a),o=Nj(t);return j.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&u){const h=new Event("change",{bubbles:!0});u.call(l,t),l.dispatchEvent(h)}},[o,t]),r.jsx(Lt.select,{...n,style:{...bq,...n.style},ref:i,defaultValue:t})});SY.displayName=Jxe;function kY(e){return e===""||e===void 0}function CY(e){const t=Ai(e),n=j.useRef(""),s=j.useRef(0),a=j.useCallback(o=>{const l=n.current+o;t(l),function c(d){n.current=d,window.clearTimeout(s.current),d!==""&&(s.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=j.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,i]}function AY(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=Qxe(e,Math.max(i,0));a.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function Qxe(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var eve=tY,PY=nY,tve=aY,rve=iY,nve=oY,EY=lY,sve=hY,TY=pY,OY=xY,ave=vY,ive=bY,LY=jY,IY=wY,RY=_Y;const mt=eve,pt=tve,ut=j.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(PY,{ref:s,className:Ge("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
864ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(rve,{asChild:!0,children:r.jsx(tj,{className:"h-4 w-4 opacity-50"})})]}));ut.displayName=PY.displayName;const MY=j.forwardRef(({className:e,...t},n)=>r.jsx(LY,{ref:n,className:Ge("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Wq,{className:"h-4 w-4"})}));MY.displayName=LY.displayName;const DY=j.forwardRef(({className:e,...t},n)=>r.jsx(IY,{ref:n,className:Ge("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(tj,{className:"h-4 w-4"})}));DY.displayName=IY.displayName;const ht=j.forwardRef(({className:e,children:t,position:n="popper",...s},a)=>r.jsx(nve,{children:r.jsxs(EY,{ref:a,className:Ge("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(MY,{}),r.jsx(sve,{className:Ge("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(DY,{})]})}));ht.displayName=EY.displayName;const ove=j.forwardRef(({className:e,...t},n)=>r.jsx(TY,{ref:n,className:Ge("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ove.displayName=TY.displayName;const Ne=j.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(OY,{ref:s,className:Ge("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(ive,{children:r.jsx(ro,{className:"h-4 w-4"})})}),r.jsx(ave,{children:t})]}));Ne.displayName=OY.displayName;const lve=j.forwardRef(({className:e,...t},n)=>r.jsx(RY,{ref:n,className:Ge("-mx-1 my-1 h-px bg-muted",e),...t}));lve.displayName=RY.displayName;const cve={NG:{currency:"NGN",provider:"paystack",alternativeProviders:["flutterwave"]},US:{currency:"USD",provider:"stripe",alternativeProviders:["flutterwave"]},GB:{currency:"GBP",provider:"stripe",alternativeProviders:["flutterwave"]},CA:{currency:"CAD",provider:"stripe"},AU:{currency:"AUD",provider:"stripe"},DE:{currency:"EUR",provider:"stripe"},FR:{currency:"EUR",provider:"stripe"},NL:{currency:"EUR",provider:"stripe"},IE:{currency:"EUR",provider:"stripe"},IT:{currency:"EUR",provider:"stripe"},ES:{currency:"EUR",provider:"stripe"},AT:{currency:"EUR",provider:"stripe"},BE:{currency:"EUR",provider:"stripe"},GH:{currency:"USD",provider:"flutterwave"},KE:{currency:"USD",provider:"flutterwave"},ZA:{currency:"USD",provider:"flutterwave"},TZ:{currency:"USD",provider:"flutterwave"},UG:{currency:"USD",provider:"flutterwave"},RW:{currency:"USD",provider:"flutterwave"},CM:{currency:"USD",provider:"flutterwave"}};async function dve(){try{return(await(await fetch("https://ipapi.co/json/")).json()).country_code||"NG"}catch(e){return console.error("Failed to detect country:",e),"NG"}}function $Y(e){return cve[e]||{currency:"USD",provider:"stripe"}}function uve(e){return $Y(e).provider}async function hve(e){try{const{data:t,error:n}=await H.from("diaspora_payment_settings").select("*").eq("user_id",e).single();if(t&&!n)return{provider:t.payment_provider,currency:t.currency,countryCode:t.country_code,stripeCustomerId:t.stripe_customer_id};const s=await dve(),a=$Y(s),{data:i,error:o}=await H.from("diaspora_payment_settings").insert({user_id:e,country_code:s,currency:a.currency,payment_provider:a.provider}).select().single();return o?(console.error("Failed to create payment settings:",o),{provider:a.provider,currency:a.currency,countryCode:s,stripeCustomerId:null}):{provider:i.payment_provider,currency:i.currency,countryCode:i.country_code,stripeCustomerId:i.stripe_customer_id}}catch(t){return console.error("Error getting payment settings:",t),{provider:"paystack",currency:"NGN",countryCode:"NG",stripeCustomerId:null}}}function fve(e,t){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}const c1=["paystack","flutterwave","stripe"];function _j(){const{user:e}=bt(),[t,n]=j.useState({provider:"paystack",currency:"NGN",countryCode:"NG",stripeCustomerId:null,loading:!0,isDiaspora:!1,availableProviders:c1,recommendedProvider:"paystack"});return j.useEffect(()=>{async function s(){if(!e){n({provider:"paystack",currency:"NGN",countryCode:"NG",stripeCustomerId:null,loading:!1,isDiaspora:!1,availableProviders:c1,recommendedProvider:"paystack"});return}
vendor: 6,605 bytes, line 864
864try{const a=await hve(e.id),i=uve(a.countryCode);n({provider:a.provider,currency:a.currency,countryCode:a.countryCode,stripeCustomerId:a.stripeCustomerId||null,loading:!1,isDiaspora:a.countryCode!=="NG",availableProviders:c1,recommendedProvider:i})}catch(a){console.error("Failed to load payment provider settings:",a),n({provider:"paystack",currency:"NGN",countryCode:"NG",stripeCustomerId:null,loading:!1,isDiaspora:!1,availableProviders:c1,recommendedProvider:"paystack"})}}s()},[e]),t}var gn;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const i={};for(const o of a)i[o]=o;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),o={};for(const l of i)o[l]=a[l];return e.objectValues(o)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},e.find=(a,i)=>{for(const o of a)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=s,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(gn||(gn={}));var tD;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(tD||(tD={}));const Kt=gn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Uu=e=>{switch(typeof e){case"undefined":return Kt.undefined;case"string":return Kt.string;case"number":return Number.isNaN(e)?Kt.nan:Kt.number;case"boolean":return Kt.boolean;case"function":return Kt.function;case"bigint":return Kt.bigint;case"symbol":return Kt.symbol;case"object":return Array.isArray(e)?Kt.array:e===null?Kt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Kt.promise:typeof Map<"u"&&e instanceof Map?Kt.map:typeof Set<"u"&&e instanceof Set?Kt.set:typeof Date<"u"&&e instanceof Date?Kt.date:Kt.object;default:return Kt.unknown}},xt=gn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class td extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},s={_errors:[]},a=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)s._errors.push(n(o));else{let l=s,c=0;for(;c<o.path.length;){const d=o.path[c];c===o.path.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(n(o))):l[d]=l[d]||{_errors:[]},l=l[d],c++}}};return a(this),s}static assert(t){if(!(t instanceof td))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,gn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},s=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];n[i]=n[i]||[],n[i].push(t(a))}else s.push(t(a));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}td.create=e=>new td(e);const NP=(e,t)=>{let n;switch(e.code){case xt.invalid_type:e.received===Kt.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case xt.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,gn.jsonStringifyReplacer)}`;break;case xt.unrecognized_keys:n=`Unrecognized key(s) in object: ${gn.joinValues(e.keys,", ")}`;break;case xt.invalid_union:n="Invalid input";break;case xt.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${gn.joinValues(e.options)}`;break;case xt.invalid_enum_value:n=`Invalid enum value. Expected ${gn.joinValues(e.options)}, received '${e.received}'`;break;case xt.invalid_arguments:n="Invalid function arguments";break;case xt.invalid_return_type:n="Invalid function return type";break;case xt.invalid_date:n="Invalid date";break;case xt.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:gn.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case xt.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case xt.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case xt.custom:n="Invalid input";break;
vendor: 7,542 bytes, line 864
864case xt.invalid_intersection_types:n="Intersection results could not be merged";break;case xt.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case xt.not_finite:n="Number must be finite";break;default:n=t.defaultError,gn.assertNever(e)}return{message:n}};let mve=NP;function pve(){return mve}const gve=e=>{const{data:t,path:n,errorMaps:s,issueData:a}=e,i=[...n,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let l="";const c=s.filter(d=>!!d).slice().reverse();for(const d of c)l=d(o,{data:t,defaultError:l}).message;return{...a,path:i,message:l}};function It(e,t){const n=pve(),s=gve({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===NP?void 0:NP].filter(a=>!!a)});e.common.issues.push(s)}class Bo{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const s=[];for(const a of n){if(a.status==="aborted")return Er;a.status==="dirty"&&t.dirty(),s.push(a.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){const s=[];for(const a of n){const i=await a.key,o=await a.value;s.push({key:i,value:o})}return Bo.mergeObjectSync(t,s)}static mergeObjectSync(t,n){const s={};for(const a of n){const{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return Er;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(s[i.value]=o.value)}return{status:t.value,value:s}}}const Er=Object.freeze({status:"aborted"}),Uy=e=>({status:"dirty",value:e}),xl=e=>({status:"valid",value:e}),rD=e=>e.status==="aborted",nD=e=>e.status==="dirty",dx=e=>e.status==="valid",r_=e=>typeof Promise<"u"&&e instanceof Promise;var rr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(rr||(rr={}));class Mh{constructor(t,n,s,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const sD=(e,t)=>{if(dx(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new td(e.common.issues);return this._error=n,this._error}}};function Xr(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:a}=e;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(o,l)=>{const{message:c}=e;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??s??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??n??l.defaultError}},description:a}}class mn{get description(){return this._def.description}_getType(t){return Uu(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Uu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Bo,ctx:{common:t.parent.common,data:t.data,parsedType:Uu(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(r_(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,n){const s={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Uu(t)},a=this._parseSync({data:t,path:s.path,parent:s});return sD(s,a)}"~validate"(t){var s,a;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Uu(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return dx(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(a=(s=i==null?void 0:i.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>dx(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,n){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Uu(t)},a=this._parse({data:t,path:s.path,parent:s}),i=await(r_(a)?a:Promise.resolve(a));return sD(s,i)}refine(t,n){const s=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{const o=t(a),l=()=>i.addIssue({code:xt.custom,...s(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((s,a)=>t(s)?!0:(a.addIssue(typeof n=="function"?n(s,a):n),!1))}_refinement(t){return new fx({schema:this,typeName:Tr.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return wh.create(this,this._def)}nullable(){return mx.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Wc.create(this)}promise(){return i_.create(this,this._def)}or(t){return s_.create([this,t],this._def)}and(t){return a_.create(this,t,this._def)}transform(t){return new fx({...Xr(this._def),schema:this,typeName:Tr.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new SP({...Xr(this._def),innerType:this,defaultValue:n,typeName:Tr.ZodDefault})}brand(){return new Fve({typeName:Tr.ZodBranded,type:this,...Xr(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new kP({...Xr(this._def),innerType:this,catchValue:n,typeName:Tr.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return CO.create(this,t)}readonly(){return CP.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xve=/^c[^\s-]{8,}
vendor: 4,644 bytes, line 864
864$/i,vve=/^[0-9a-z]+$/,yve=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bve=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,jve=/^[a-z0-9_-]{21}$/i,wve=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nve=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_ve=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Sve="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let pk;const kve=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Cve=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ave=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Pve=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Eve=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Tve=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,FY="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ove=new RegExp(`^${FY}$`);function BY(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Lve(e){return new RegExp(`^${BY(e)}$`)}function Ive(e){let t=`${FY}T${BY(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Rve(e,t){return!!((t==="v4"||!t)&&kve.test(e)||(t==="v6"||!t)&&Ave.test(e))}function Mve(e,t){if(!wve.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function Dve(e,t){return!!((t==="v4"||!t)&&Cve.test(e)||(t==="v6"||!t)&&Pve.test(e))}class oh extends mn{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Kt.string){const i=this._getOrReturnCtx(t);return It(i,{code:xt.invalid_type,expected:Kt.string,received:i.parsedType}),Er}const s=new Bo;let a;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),It(a,{code:xt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),It(a,{code:xt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,l=t.data.length<i.value;(o||l)&&(a=this._getOrReturnCtx(t,a),o?It(a,{code:xt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&It(a,{code:xt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")_ve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"email",code:xt.invali
vendor: 6,043 bytes, line 864
864d_string,message:i.message}),s.dirty());else if(i.kind==="emoji")pk||(pk=new RegExp(Sve,"u")),pk.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"emoji",code:xt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")bve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"uuid",code:xt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")jve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"nanoid",code:xt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")xve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"cuid",code:xt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")vve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"cuid2",code:xt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")yve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"ulid",code:xt.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),It(a,{validation:"url",code:xt.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"regex",code:xt.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),It(a,{code:xt.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),It(a,{code:xt.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),It(a,{code:xt.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?Ive(i).test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{code:xt.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?Ove.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{code:xt.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?Lve(i).test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{code:xt.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?Nve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"duration",code:xt.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?Rve(t.data,i.version)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"ip",code:xt.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?Mve(t.data,i.alg)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"jwt",code:xt.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?Dve(t.data,i.version)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"cidr",code:xt.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Eve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"base64",code:xt.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?Tve.test(t.data)||(a=this._getOrReturnCtx(t,a),It(a,{validation:"base64url",code:xt.invalid_string,message:i.message}),s.dirty()):gn.assertNever(i);return{status:s.value,value:t.data}}_regex(t,n,s){return this.refinement(a=>t.test(a),{validation:n,code:xt.invalid_string,...rr.errToObj(s)})}_addCheck(t){return new oh({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...rr.errToObj(t)})}url(t){return this._addCheck({kind:"url",...rr.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...rr.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...rr.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...rr.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...rr.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...rr.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...rr.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...rr.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...rr.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...rr.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...rr.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...rr.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...rr.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...rr.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...rr.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...rr.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...rr.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...rr.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...rr.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...rr.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...rr.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...rr.errToObj(n)})}nonempty(t){return this.min(1,rr.errToObj(t))}trim(){return new oh({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new oh({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new oh({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}
vendor: 4,672 bytes, line 864
864get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}oh.create=e=>new oh({checks:[],typeName:Tr.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Xr(e)});function $ve(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,a=n>s?n:s,i=Number.parseInt(e.toFixed(a).replace(".","")),o=Number.parseInt(t.toFixed(a).replace(".",""));return i%o/10**a}class ux extends mn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Kt.number){const i=this._getOrReturnCtx(t);return It(i,{code:xt.invalid_type,expected:Kt.number,received:i.parsedType}),Er}let s;const a=new Bo;for(const i of this._def.checks)i.kind==="int"?gn.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),It(s,{code:xt.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),It(s,{code:xt.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),It(s,{code:xt.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?$ve(t.data,i.value)!==0&&(s=this._getOrReturnCtx(t,s),It(s,{code:xt.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),It(s,{code:xt.not_finite,message:i.message}),a.dirty()):gn.assertNever(i);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,rr.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rr.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rr.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rr.toString(n))}setLimit(t,n,s,a){return new ux({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:rr.toString(a)}]})}_addCheck(t){return new ux({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:rr.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rr.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rr.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:rr.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rr.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rr.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&gn.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(t===null||s.value<t)&&(t=s.value)}return Number.isFinite(n)&&Number.isFinite(t)}
vendor: 7,865 bytes, line 864
864}ux.create=e=>new ux({checks:[],typeName:Tr.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Xr(e)});class K0 extends mn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Kt.bigint)return this._getInvalidInput(t);let s;const a=new Bo;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(s=this._getOrReturnCtx(t,s),It(s,{code:xt.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(s=this._getOrReturnCtx(t,s),It(s,{code:xt.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),It(s,{code:xt.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):gn.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return It(n,{code:xt.invalid_type,expected:Kt.bigint,received:n.parsedType}),Er}gte(t,n){return this.setLimit("min",t,!0,rr.toString(n))}gt(t,n){return this.setLimit("min",t,!1,rr.toString(n))}lte(t,n){return this.setLimit("max",t,!0,rr.toString(n))}lt(t,n){return this.setLimit("max",t,!1,rr.toString(n))}setLimit(t,n,s,a){return new K0({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:rr.toString(a)}]})}_addCheck(t){return new K0({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rr.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rr.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rr.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rr.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:rr.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}K0.create=e=>new K0({checks:[],typeName:Tr.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Xr(e)});class aD extends mn{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Kt.boolean){const s=this._getOrReturnCtx(t);return It(s,{code:xt.invalid_type,expected:Kt.boolean,received:s.parsedType}),Er}return xl(t.data)}}aD.create=e=>new aD({typeName:Tr.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Xr(e)});class n_ extends mn{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Kt.date){const i=this._getOrReturnCtx(t);return It(i,{code:xt.invalid_type,expected:Kt.date,received:i.parsedType}),Er}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return It(i,{code:xt.invalid_date}),Er}const s=new Bo;let a;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),It(a,{code:xt.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),It(a,{code:xt.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):gn.assertNever(i);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new n_({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:rr.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:rr.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}n_.create=e=>new n_({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Tr.ZodDate,...Xr(e)});class iD extends mn{_parse(t){if(this._getType(t)!==Kt.symbol){const s=this._getOrReturnCtx(t);return It(s,{code:xt.invalid_type,expected:Kt.symbol,received:s.parsedType}),Er}return xl(t.data)}}iD.create=e=>new iD({typeName:Tr.ZodSymbol,...Xr(e)});class oD extends mn{_parse(t){if(this._getType(t)!==Kt.undefined){const s=this._getOrReturnCtx(t);return It(s,{code:xt.invalid_type,expected:Kt.undefined,received:s.parsedType}),Er}return xl(t.data)}}oD.create=e=>new oD({typeName:Tr.ZodUndefined,...Xr(e)});class lD extends mn{_parse(t){if(this._getType(t)!==Kt.null){const s=this._getOrReturnCtx(t);return It(s,{code:xt.invalid_type,expected:Kt.null,received:s.parsedType}),Er}return xl(t.data)}}lD.create=e=>new lD({typeName:Tr.ZodNull,...Xr(e)});class cD extends mn{constructor(){super(...arguments),this._any=!0}_parse(t){return xl(t.data)}}cD.create=e=>new cD({typeName:Tr.ZodAny,...Xr(e)});class dD extends mn{constructor(){super(...arguments),this._unknown=!0}_parse(t){return xl(t.data)}}dD.create=e=>new dD({typeName:Tr.ZodUnknown,...Xr(e)});class Dh extends mn{_parse(t){const n=this._getOrReturnCtx(t);return It(n,{code:xt.invalid_type,expected:Kt.never,received:n.parsedType}),Er}}Dh.create=e=>new Dh({typeName:Tr.ZodNever,...Xr(e)});class uD extends mn{_parse(t){if(this._getType(t)!==Kt.undefined){const s=this._getOrReturnCtx(t);return It(s,{code:xt.invalid_type,expected:Kt.void,received:s.parsedType}),Er}return xl(t.data)}}uD.create=e=>new uD({typeName:Tr.ZodVoid,...Xr(e)});class Wc extends mn{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),a=this._def;if(n.parsedType!==Kt.array)return It(n,{code:xt.invalid_type,expected:Kt.array,received:n.parsedType}),Er;if(a.exactLength!==null){const o=n.data.length>a.exactLength.value,l=n.data.length<a.exactLength.value;(o||l)&&(It(n,{code:o?xt.too_big:xt.too_small,minimum:l?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(It(n,{code:xt.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(It(n,{code:xt.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>a.type._parseAsync(new Mh(n,o,n.path,l)))).then(o=>Bo.mergeArray(s,o));const i=[...n.data].map((o,l)=>a.type._parseSync(new Mh(n,o,n.path,l)));return Bo.mergeArray(s,i)}get element(){return this._def.type}min(t,n){return new Wc({...this._def,minLength:{value:t,message:rr.toString(n)}})}max(t,n){return new Wc({...this._def,maxLength:{value:t,message:rr.toString(n)}})}length(t,n){return new Wc({...this._def,exactLength:{value:t,message:rr.toString(n)}})}nonempty(t){return this.min(1,t)}}Wc.create=(e,t)=>new Wc({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tr.ZodArray,...Xr(t)});function Jp(e){if(e instanceof Os){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=wh.create(Jp(s))}return new Os({...e._def,shape:()=>t})}else return e instanceof Wc?new Wc({...e._def,type:Jp(e.element)}):e instanceof wh?wh.create(Jp(e.unwrap())):e instanceof mx?mx.create(Jp(e.unwrap())):e instanceof Tm?Tm.create(e.items.map(t=>Jp(t))):e}class Os extends mn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=gn.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Kt.object){const d=this._getOrReturnCtx(t);
vendor: 4,812 bytes, line 864
864return It(d,{code:xt.invalid_type,expected:Kt.object,received:d.parsedType}),Er}const{status:s,ctx:a}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Dh&&this._def.unknownKeys==="strip"))for(const d in a.data)o.includes(d)||l.push(d);const c=[];for(const d of o){const u=i[d],h=a.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Mh(a,h,a.path,d)),alwaysSet:d in a.data})}if(this._def.catchall instanceof Dh){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of l)c.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(d==="strict")l.length>0&&(It(a,{code:xt.unrecognized_keys,keys:l}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of l){const h=a.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Mh(a,h,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of c){const h=await u.key,f=await u.value;d.push({key:h,value:f,alwaysSet:u.alwaysSet})}return d}).then(d=>Bo.mergeObjectSync(s,d)):Bo.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(t){return rr.errToObj,new Os({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{var i,o;const a=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:rr.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new Os({...this._def,unknownKeys:"strip"})}passthrough(){return new Os({...this._def,unknownKeys:"passthrough"})}extend(t){return new Os({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Os({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Tr.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Os({...this._def,catchall:t})}pick(t){const n={};for(const s of gn.objectKeys(t))t[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new Os({...this._def,shape:()=>n})}omit(t){const n={};for(const s of gn.objectKeys(this.shape))t[s]||(n[s]=this.shape[s]);return new Os({...this._def,shape:()=>n})}deepPartial(){return Jp(this)}partial(t){const n={};for(const s of gn.objectKeys(this.shape)){const a=this.shape[s];t&&!t[s]?n[s]=a:n[s]=a.optional()}return new Os({...this._def,shape:()=>n})}required(t){const n={};for(const s of gn.objectKeys(this.shape))if(t&&!t[s])n[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof wh;)i=i._def.innerType;n[s]=i}return new Os({...this._def,shape:()=>n})}keyof(){return UY(gn.objectKeys(this.shape))}}Os.create=(e,t)=>new Os({shape:()=>e,unknownKeys:"strip",catchall:Dh.create(),typeName:Tr.ZodObject,...Xr(t)});Os.strictCreate=(e,t)=>new Os({shape:()=>e,unknownKeys:"strict",catchall:Dh.create(),typeName:Tr.ZodObject,...Xr(t)});Os.lazycreate=(e,t)=>new Os({shape:e,unknownKeys:"strip",catchall:Dh.create(),typeName:Tr.ZodObject,...Xr(t)});class s_ extends mn{_parse(t){const{ctx:n}=this._processInputParams(t),s=this._def.options;function a(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new td(l.ctx.common.issues));return It(n,{code:xt.invalid_union,unionErrors:o}),Er}if(n.common.async)return Promise.all(s.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(a);{let i;const o=[];for(const c of s){const d={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new td(c));return It(n,{code:xt.invalid_union,unionErrors:l}),Er}}get options(){return this._def.options}}s_.create=(e,t)=>new s_({options:e,typeName:Tr.ZodUnion,...Xr(t)});function _P(e,t){const n=Uu(e),s=Uu(t);if(e===t)return{valid:!0,data:e};if(n===Kt.object&&s===Kt.object){const a=gn.objectKeys(t),i=gn.objectKeys(e).filter(l=>a.indexOf(l)!==-1),o={...e,...t};for(const l of i){const c=_P(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===Kt.array&&s===Kt.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const o=e[i],l=t[i],c=_P(o,l);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return n===Kt.date&&s===Kt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class a_ extends mn{_parse(t){const{status:n,ctx:s}=this._processInputParams(t),a=(i,o)=>
vendor: 4,098 bytes, line 864
864{if(rD(i)||rD(o))return Er;const l=_P(i.value,o.value);return l.valid?((nD(i)||nD(o))&&n.dirty(),{status:n.value,value:l.data}):(It(s,{code:xt.invalid_intersection_types}),Er)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}a_.create=(e,t,n)=>new a_({left:e,right:t,typeName:Tr.ZodIntersection,...Xr(n)});class Tm extends mn{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Kt.array)return It(s,{code:xt.invalid_type,expected:Kt.array,received:s.parsedType}),Er;if(s.data.length<this._def.items.length)return It(s,{code:xt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Er;!this._def.rest&&s.data.length>this._def.items.length&&(It(s,{code:xt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...s.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Mh(s,o,s.path,l)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>Bo.mergeArray(n,o)):Bo.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Tm({...this._def,rest:t})}}Tm.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Tm({items:e,typeName:Tr.ZodTuple,rest:null,...Xr(t)})};class hD extends mn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Kt.map)return It(s,{code:xt.invalid_type,expected:Kt.map,received:s.parsedType}),Er;const a=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([l,c],d)=>({key:a._parse(new Mh(s,l,s.path,[d,"key"])),value:i._parse(new Mh(s,c,s.path,[d,"value"]))}));if(s.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const d=await c.key,u=await c.value;if(d.status==="aborted"||u.status==="aborted")return Er;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),l.set(d.value,u.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const d=c.key,u=c.value;if(d.status==="aborted"||u.status==="aborted")return Er;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),l.set(d.value,u.value)}return{status:n.value,value:l}}}}hD.create=(e,t,n)=>new hD({valueType:t,keyType:e,typeName:Tr.ZodMap,...Xr(n)});class X0 extends mn{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Kt.set)return It(s,{code:xt.invalid_type,expected:Kt.set,received:s.parsedType}),Er;const a=this._def;a.minSize!==null&&s.data.size<a.minSize.value&&(It(s,{code:xt.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&s.data.size>a.maxSize.value&&(It(s,{code:xt.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const i=this._def.valueType;function o(c){const d=new Set;for(const u of c){if(u.status==="aborted")return Er;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const l=[...s.data.values()].map((c,d)=>i._parse(new Mh(s,c,s.path,d)));return s.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new X0({...this._def,minSize:{value:t,message:rr.toString(n)}})}max(t,n){return new X0({...this._def,maxSize:{value:t,message:rr.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}X0.create=(e,t)=>new X0({valueType:e,minSize:null,maxSize:null,typeName:Tr.ZodSet,...Xr(t)});class fD extends mn{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}fD.create=(e,t)=>new fD({getter:e,typeName:Tr.ZodLazy,...Xr(t)});class mD extends mn{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);
vendor: 4,243 bytes, line 864
864return It(n,{received:n.data,code:xt.invalid_literal,expected:this._def.value}),Er}return{status:"valid",value:t.data}}get value(){return this._def.value}}mD.create=(e,t)=>new mD({value:e,typeName:Tr.ZodLiteral,...Xr(t)});function UY(e,t){return new hx({values:e,typeName:Tr.ZodEnum,...Xr(t)})}class hx extends mn{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return It(n,{expected:gn.joinValues(s),received:n.parsedType,code:xt.invalid_type}),Er}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),s=this._def.values;return It(n,{received:n.data,code:xt.invalid_enum_value,options:s}),Er}return xl(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return hx.create(t,{...this._def,...n})}exclude(t,n=this._def){return hx.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}hx.create=UY;class pD extends mn{_parse(t){const n=gn.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Kt.string&&s.parsedType!==Kt.number){const a=gn.objectValues(n);return It(s,{expected:gn.joinValues(a),received:s.parsedType,code:xt.invalid_type}),Er}if(this._cache||(this._cache=new Set(gn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=gn.objectValues(n);return It(s,{received:s.data,code:xt.invalid_enum_value,options:a}),Er}return xl(t.data)}get enum(){return this._def.values}}pD.create=(e,t)=>new pD({values:e,typeName:Tr.ZodNativeEnum,...Xr(t)});class i_ extends mn{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Kt.promise&&n.common.async===!1)return It(n,{code:xt.invalid_type,expected:Kt.promise,received:n.parsedType}),Er;const s=n.parsedType===Kt.promise?n.data:Promise.resolve(n.data);return xl(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}i_.create=(e,t)=>new i_({type:e,typeName:Tr.ZodPromise,...Xr(t)});class fx extends mn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Tr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:o=>{It(s,o),o.fatal?n.abort():n.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const o=a.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return Er;const c=await this._def.schema._parseAsync({data:l,path:s.path,parent:s});return c.status==="aborted"?Er:c.status==="dirty"||n.value==="dirty"?Uy(c.value):c});{if(n.value==="aborted")return Er;const l=this._def.schema._parseSync({data:o,path:s.path,parent:s});return l.status==="aborted"?Er:l.status==="dirty"||n.value==="dirty"?Uy(l.value):l}}if(a.type==="refinement"){const o=l=>{const c=a.refinement(l,i);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(s.common.async===!1){const l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return l.status==="aborted"?Er:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>l.status==="aborted"?Er:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(a.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!dx(o))return Er;const l=a.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>dx(o)?Promise.resolve(a.transform(o.value,i)).then(l=>({status:n.value,value:l})):Er);gn.assertNever(a)}}
vendor: 3,993 bytes, line 864
864fx.create=(e,t,n)=>new fx({schema:e,typeName:Tr.ZodEffects,effect:t,...Xr(n)});fx.createWithPreprocess=(e,t,n)=>new fx({schema:t,effect:{type:"preprocess",transform:e},typeName:Tr.ZodEffects,...Xr(n)});class wh extends mn{_parse(t){return this._getType(t)===Kt.undefined?xl(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}wh.create=(e,t)=>new wh({innerType:e,typeName:Tr.ZodOptional,...Xr(t)});class mx extends mn{_parse(t){return this._getType(t)===Kt.null?xl(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}mx.create=(e,t)=>new mx({innerType:e,typeName:Tr.ZodNullable,...Xr(t)});class SP extends mn{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===Kt.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}SP.create=(e,t)=>new SP({innerType:e,typeName:Tr.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Xr(t)});class kP extends mn{_parse(t){const{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return r_(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new td(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new td(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}kP.create=(e,t)=>new kP({innerType:e,typeName:Tr.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Xr(t)});class gD extends mn{_parse(t){if(this._getType(t)!==Kt.nan){const s=this._getOrReturnCtx(t);return It(s,{code:xt.invalid_type,expected:Kt.nan,received:s.parsedType}),Er}return{status:"valid",value:t.data}}}gD.create=e=>new gD({typeName:Tr.ZodNaN,...Xr(e)});class Fve extends mn{_parse(t){const{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class CO extends mn{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Er:i.status==="dirty"?(n.dirty(),Uy(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Er:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(t,n){return new CO({in:t,out:n,typeName:Tr.ZodPipeline})}}class CP extends mn{_parse(t){const n=this._def.innerType._parse(t),s=a=>(dx(a)&&(a.value=Object.freeze(a.value)),a);return r_(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}}CP.create=(e,t)=>new CP({innerType:e,typeName:Tr.ZodReadonly,...Xr(t)});Os.lazycreate;var Tr;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Tr||(Tr={}));const gk=oh.create,Bve=ux.create;Dh.create;Wc.create;const Uve=Os.create;
vendor: 4,831 bytes, line 864
864Os.strictCreate;s_.create;a_.create;Tm.create;const zve=hx.create;i_.create;wh.create;mx.create;var jS="Checkbox",[qve,zJe]=ea(jS),[Vve,AO]=qve(jS);function Wve(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:h}=e,[f,m]=Fo({prop:n,defaultProp:a??!1,onChange:c,caller:jS}),[x,p]=j.useState(null),[v,g]=j.useState(null),y=j.useRef(!1),b=x?!!o||!!x.closest("form"):!0,w={checked:f,disabled:i,setChecked:m,control:x,setControl:p,name:l,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:d,defaultChecked:Nh(a)?!1:a,isFormControl:b,bubbleInput:v,setBubbleInput:g};return r.jsx(Vve,{scope:t,...w,children:Hve(h)?h(w):s})}var zY="CheckboxTrigger",qY=j.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},a)=>{const{control:i,value:o,disabled:l,checked:c,required:d,setControl:u,setChecked:h,hasConsumerStoppedPropagationRef:f,isFormControl:m,bubbleInput:x}=AO(zY,e),p=gr(a,u),v=j.useRef(c);return j.useEffect(()=>{const g=i==null?void 0:i.form;if(g){const y=()=>h(v.current);return g.addEventListener("reset",y),()=>g.removeEventListener("reset",y)}},[i,h]),r.jsx(Lt.button,{type:"button",role:"checkbox","aria-checked":Nh(c)?"mixed":c,"aria-required":d,"data-state":YY(c),"data-disabled":l?"":void 0,disabled:l,value:o,...s,ref:p,onKeyDown:dt(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:dt(n,g=>{h(y=>Nh(y)?!0:!y),x&&m&&(f.current=g.isPropagationStopped(),f.current||g.stopPropagation())})})});qY.displayName=zY;var PO=j.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:d,form:u,...h}=e;return r.jsx(Wve,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:d,name:s,form:u,value:c,internal_do_not_use_render:({isFormControl:f})=>r.jsxs(r.Fragment,{children:[r.jsx(qY,{...h,ref:t,__scopeCheckbox:n}),f&&r.jsx(GY,{__scopeCheckbox:n})]})})});PO.displayName=jS;var VY="CheckboxIndicator",WY=j.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...a}=e,i=AO(VY,n);return r.jsx(hi,{present:s||Nh(i.checked)||i.checked===!0,children:r.jsx(Lt.span,{"data-state":YY(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});WY.displayName=VY;var HY="CheckboxBubbleInput",GY=j.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:o,required:l,disabled:c,name:d,value:u,form:h,bubbleInput:f,setBubbleInput:m}=AO(HY,e),x=gr(n,m),p=Nj(i),v=lj(s);j.useEffect(()=>{const y=f;if(!y)return;const b=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(b,"checked").set,C=!a.current;if(p!==i&&_){const E=new Event("click",{bubbles:C});y.indeterminate=Nh(i),_.call(y,Nh(i)?!1:i),y.dispatchEvent(E)}},[f,p,i,a]);const g=j.useRef(Nh(i)?!1:i);return r.jsx(Lt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??g.current,required:l,disabled:c,name:d,value:u,form:h,...t,tabIndex:-1,ref:x,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});GY.displayName=HY;function Hve(e){return typeof e=="function"}function Nh(e){return e==="indeterminate"}function YY(e){return Nh(e)?"indeterminate":e?"checked":"unchecked"}const Uo=j.forwardRef(({className:e,...t},n)=>r.jsx(PO,{ref:n,className:Ge("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(WY,{className:Ge("flex items-center justify-center text-current"),children:r.jsx(ro,{className:"h-4 w-4"})})}));Uo.displayName=PO.displayName;function EO({checked:e,onCheckedChange:t,purchaseType:n,amount:s,currency:a,className:i,compact:o=!1}){const l=()=>a==="NGN"?`â¦${s.toLocaleString()}`:`${a} ${s.toLocaleString()}`,c=()=>{switch(n){case"subscription":return"subscription";case"boost":return"boost";case"feature":return"featured listing";case"airtime":return"airtime purchase";case"event_boost":return"event boost";default:return"purchase"}};return r.jsxs("div",{className:Ge("rounded-lg border border-orange-200 bg-orange-50 dark:bg-orange-950/20",o?"p-2":"p-4",i),children:[r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx(Uo,{id:"terms-checkbox",checked:e,onCheckedChange:t,className:"mt-0.5"}),r.jsxs(le,{htmlFor:"terms-checkbox",className:Ge("leading-relaxed cursor-pointer text-gray-900 dark:text-gray-100",o?"text-xs":"text-sm"),children:[r.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:"I understand that this purchase is final and n
864on-refundable."})," ",r.jsxs("span",{className:"text-gray-800 dark:text-gray-200",children:["I agree to the"," ",r.jsx("a",{href:"/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"text-green-700 hover:text-green-800 dark:text-green-400 dark:hover:text-green-300 underline font-medium",children:"Terms"})," ","and"," ",r.jsx("a",{href:"/refund-policy",target:"_blank",rel:"noopener noreferrer",className:"text-green-700 hover:text-green-800 dark:text-green-400 dark:hover:text-green-300 underline font-medium",children:"Refund Policy"}),"."]})]})]}),!o&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-orange-200 dark:border-orange-800",children:[r.jsxs("p",{className:"text-xs text-gray-700 dark:text-gray-300 leading-relaxed",children:[r.jsx("strong",{className:"text-gray-900 dark:text-gray-100",children:"Important:"})," By proceeding with this ",l()," payment for ",c(),", you acknowledge that:"]}),r.jsxs("ul",{className:"mt-2 space-y-1 text-xs text-gray-700 dark:text-gray-300",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"text-orange-600 dark:text-orange-400 mt-0.5",children:"â¢"}),r.jsx("span",{children:"All sales are final with no refunds or cancellations"})]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"text-orange-600 dark:text-orange-400 mt-0.5",children:"â¢"}),r.jsx("span",{children:"Payment will be processed immediately upon confirmation"})]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"text-orange-600 dark:text-orange-400 mt-0.5",children:"â¢"}),r.jsx("span",{children:"You have reviewed the pricing and terms before proceeding"})]})]})]})]})}const Gve=Uve({phoneNumber:gk().regex(/^(234|0)[789][01]\d{8}$/,"Invalid Nigerian phone number (e.g., 08012345678)").transform(e=>e.startsWith("0")?"234"+e.slice(1):e),amount:Bve().min(50,"Minimum amount is â¦50").max(5e4,"Maximum amount is â¦50,000"),network:zve(["MTN","Airtel","Glo","9mobile"]),recipientPhone:gk().regex(/^(234|0)[789][01]\d{8}$/,"Invalid recipient phone number").transform(e=>e.startsWith("0")?"234"+e.slice(1):e).optional(),recipientName:gk().max(100).optional()}),Yve=["MTN","Airtel","Glo","9mobile"],Kve=[100,500,1e3,2e3,5e3];function KY({open:e,onOpenChange:t}){const[n,s]=j.useState("MTN"),[a,i]=j.useState("1000"),[o,l]=j.useState(""),[c,d]=j.useState(!1),[u,h]=j.useState(""),[f,m]=j.useState(""),[x,p]=j.useState(!1),[v,g]=j.useState(!1),{toast:y}=Sn(),{user:b}=bt(),{provider:w,currency:_}=_j(),[C,E]=j.useState(w),N=async()=>{if(!b){y({title:"Authentication Required",description:"Please log in to purchase airtime",variant:"destructive"});return}p(!0);try{const k={phoneNumber:c?u:o,amount:parseFloat(a||"0"),network:n,recipientPhone:c?u:void 0,recipientName:f||void 0},I=Gve.parse(k),P=`airtime_${Date.now()}_${Math.random().toString(36).substring(7)}`,{error:O}=await H.from("airtime_transactions").insert({user_id:b==null?void 0:b.id,phone_number:I.phoneNumber,network:I.network,amount:I.amount,payment_reference:P,status:"pending",is_gift:c,recipient_name:I.recipientName,recipient_phone:c?I.recipientPhone:null,payment_method:C,payment_provider:C});if(O)throw console.error("Failed to create pending airtime transaction:",O),O;console.log("â
Created pending airtime transaction with reference:",P);const A=C==="flutterwave"?"initialize-flutterwave-payment":"purchase-airtime",{data:R,error:L}=await H.functions.invoke(A,{body:{type:"airtime",reference:P,network:I.network,amount:I.amount,phone_number:I.phoneNumber,is_gift:c,recipient_name:I.recipientName,currency:"NGN",metadata:{network:I.network,phone_number:I.phoneNumber,is_gift:c,purchase_type:"airtime"},callback_url:`${window.location.origin}/dashboard?payment=success`}});if(L)throw L;if(R.payment_url)R.reference&&localStorage.setItem("pending_payment_reference",R.reference),window.open(R.payment_url,"_blank"),y({title:"Payment Initiated",description:"Complete payment in the new tab. We'll notify you when your airtime is delivered.",duration:8e3}),setTimeout(()=>
864{y({title:"ð¡ Tip",description:"Keep this tab open. We'll automatically check your payment status.",duration:5e3})},2e3),i("1000"),l(""),h(""),m(""),d(!1),g(!1),t(!1);else throw new Error("No payment URL received")}catch(k){console.error("Airtime purchase error:",k),k instanceof td?y({title:"Validation Error",description:k.errors[0].message,variant:"destructive"}):y({title:"Purchase Failed",description:k.message||"Failed to process airtime purchase",variant:"destructive"})}finally{p(!1)}};return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"sm:max-w-[500px] max-h-[85vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{className:"flex items-center gap-2",children:[r.jsx(D0,{className:"h-5 w-5 text-primary"}),"Buy or Send Airtime"]}),r.jsx(on,{children:"Purchase airtime for yourself or send as a gift"})]}),r.jsxs(Kr,{defaultValue:"airtime",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-2",children:[r.jsx(Re,{value:"airtime",children:"Airtime"}),r.jsx(Re,{value:"data",disabled:!0,children:"Data Bundles (Soon)"})]}),r.jsxs(Be,{value:"airtime",className:"space-y-4 py-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Select Network"}),r.jsx(IG,{value:n,onValueChange:s,className:"grid grid-cols-4 gap-2",children:Yve.map(k=>r.jsxs("div",{children:[r.jsx(RG,{value:k,id:k,className:"sr-only peer"}),r.jsx(le,{htmlFor:k,className:"flex items-center justify-center rounded-md border-2 border-muted bg-background p-2 hover:bg-accent hover:text-accent-foreground peer-data-[state=checked]:border-primary cursor-pointer text-sm",children:k})]},k))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Select Amount"}),r.jsx("div",{className:"grid grid-cols-5 gap-1",children:Kve.map(k=>r.jsxs(W,{variant:a===k.toString()?"default":"outline",size:"sm",className:"text-xs px-1",onClick:()=>i(k.toString()),children:["â¦",k]},k))}),r.jsx(ge,{type:"number",placeholder:"Custom amount",value:a,onChange:k=>i(k.target.value),min:"50",max:"50000",className:"h-9"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(le,{htmlFor:"gift-mode",children:"Send as Gift"}),r.jsx(Ro,{id:"gift-mode",checked:c,onCheckedChange:d})]}),c?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"recipient-phone",children:"Recipient's Phone Number"}),r.jsx(ge,{id:"recipient-phone",type:"tel",placeholder:"08012345678",value:u,onChange:k=>h(k.target.value)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Format: 08012345678 or 2348012345678"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"recipient-name",children:"Recipient's Name (Optional)"}),r.jsx(ge,{id:"recipient-name",type:"text",placeholder:"John Doe",value:f,onChange:k=>m(k.target.value)})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"phone",children:"Your Phone Number"}),r.jsx(ge,{id:"phone",type:"tel",placeholder:"08012345678",value:o,onChange:k=>l(k.target.value)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Format: 08012345678 or 2348012345678"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(le,{className:"text-sm font-bold text-green-800 dark:text-green-100",children:"Payment Method"}),r.jsxs(mt,{value:C,onValueChange:k=>E(k),children:[r.jsx(ut,{className:"w-full h-9",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"paystack",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ec,{className:"h-4 w-4 text-green-600"}),"Paystack"]})}),r.jsx(Ne,{value:"flutterwave",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-4 w-4 text-orange-500"}),"Flutterwave"]})})]})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground bg-muted p-2 rounded-md",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Airtime:"}),r.jsxs("span",{children:["â¦",parseFloat(a||"0").toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Service fee (3.5%):"}),r.jsxs("span",{children:["â¦",(parseFloat(a||"0")*.035).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between font-semibold border-t pt-1 mt-1",children:[r.jsx("span",{children:"Total:"}),r.jsxs("span",{children:["â¦",(parseFloat(a||"0")*1.035).toFixed(2)]})]})]}),r.jsx(EO,{checked:v,onCheckedChange:g,compact:!0,purchaseType:"airtime",amount:parseFloat(a||"0")*1.035,currency:"NGN"}),r.jsx(W,{onClick:N,disabled:x||!a||!o&&!c||c&&!u||!v,className:"w-full",size:"lg",children:x?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):`Continue to Payment (${C==="flutterwave"?"Flutterwave":"Paystack"})`})]}),r.jsx(Be,{value:"data",className:"py-8 text-center text-muted-foreground",children:r.jsx("p",{children:"Data bundle purchases coming soon!"})})]})]})})}var wS="Popover",[XY,qJe]=ea(wS,[Wh]),Sj=Wh(),[Xve,Zh]=XY(wS),ZY=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:a,onOpenChange:i,modal:o=!1}=e,l=Sj(t),c=j.useRef(null),[d,u]=j.useState(!1),[h,f]=Fo({prop:s,defaultProp:a??!1,onChange:i,caller:wS});return r.jsx(zT,{...l,children:r.jsx(Xve,{scope:t,contentId:ul(),triggerRef:c,open:h,onOpenChange:f,onOpenToggle:j.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:d,onCustomAnchorAdd:j.useCallback(()=>u(!0),[]),onCustomAnchorRemove:j.useCallback(()=>u(!1),[]),modal:o,children:n})})};ZY.displayName=wS;var JY="PopoverAnchor",Zve=j.forwardRef((e,t)=>
vendor: 4,474 bytes, line 864
864{const{__scopePopover:n,...s}=e,a=Zh(JY,n),i=Sj(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=a;return j.useEffect(()=>(o(),()=>l()),[o,l]),r.jsx(cj,{...i,...s,ref:t})});Zve.displayName=JY;var QY="PopoverTrigger",eK=j.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Zh(QY,n),i=Sj(n),o=gr(t,a.triggerRef),l=r.jsx(Lt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":aK(a.open),...s,ref:o,onClick:dt(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:r.jsx(cj,{asChild:!0,...i,children:l})});eK.displayName=QY;var TO="PopoverPortal",[Jve,Qve]=XY(TO,{forceMount:void 0}),tK=e=>{const{__scopePopover:t,forceMount:n,children:s,container:a}=e,i=Zh(TO,t);return r.jsx(Jve,{scope:t,forceMount:n,children:r.jsx(hi,{present:n||i.open,children:r.jsx(Qx,{asChild:!0,container:a,children:s})})})};tK.displayName=TO;var px="PopoverContent",rK=j.forwardRef((e,t)=>{const n=Qve(px,e.__scopePopover),{forceMount:s=n.forceMount,...a}=e,i=Zh(px,e.__scopePopover);return r.jsx(hi,{present:s||i.open,children:i.modal?r.jsx(tye,{...a,ref:t}):r.jsx(rye,{...a,ref:t})})});rK.displayName=px;var eye=Eh("PopoverContent.RemoveScroll"),tye=j.forwardRef((e,t)=>{const n=Zh(px,e.__scopePopover),s=j.useRef(null),a=gr(t,s),i=j.useRef(!1);return j.useEffect(()=>{const o=s.current;if(o)return cS(o)},[]),r.jsx(pj,{as:eye,allowPinchZoom:!0,children:r.jsx(nK,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:dt(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:dt(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:dt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),rye=j.forwardRef((e,t)=>{const n=Zh(px,e.__scopePopover),s=j.useRef(!1),a=j.useRef(!1);return r.jsx(nK,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(s.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:i=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),nK=j.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...h}=e,f=Zh(px,n),m=Sj(n);return oS(),r.jsx(mj,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:i,children:r.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>f.onOpenChange(!1),children:r.jsx(Z2,{"data-state":aK(f.open),role:"dialog",id:f.contentId,...m,...h,ref:t,style:{...h.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)"}})})})}),sK="PopoverClose",nye=j.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Zh(sK,n);return r.jsx(Lt.button,{type:"button",...s,ref:t,onClick:dt(e.onClick,()=>a.onOpenChange(!1))})});nye.displayName=sK;var sye="PopoverArrow",aye=j.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Sj(n);return r.jsx(J2,{...a,...s,ref:t})});aye.displayName=sye;function aK(e){return e?"open":"closed"}var iye=ZY,oye=eK,lye=tK,iK=rK;const cye=iye,dye=oye,oK=j.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(lye,{children:r.jsx(iK,{ref:a,align:t,sideOffset:n,className:Ge("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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]:sli
864de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));oK.displayName=iK.displayName;const Di=()=>{const{user:e}=bt(),[t,n]=j.useState({country:"NG",state:"",city:""}),[s,a]=j.useState(!0);return j.useEffect(()=>{(async()=>{if(!e){n({country:"NG",state:"",city:""}),a(!1);return}try{const{data:o,error:l}=await H.from("profiles").select("preferred_country, preferred_state, preferred_city").eq("id",e.id).single();n(o&&!l?{country:o.preferred_country||"NG",state:o.preferred_state||"",city:o.preferred_city||""}:{country:"NG",state:"",city:""})}catch(o){console.error("Error fetching location preferences:",o),n({country:"NG",state:"",city:""})}finally{a(!1)}})()},[e]),{preferences:t,isLoading:s}},Dc={NG:{code:"NG",name:"Nigeria",flag:"ð³ð¬",currency:"NGN"},US:{code:"US",name:"United States",flag:"ðºð¸",currency:"USD"},GB:{code:"GB",name:"United Kingdom",flag:"ð¬ð§",currency:"GBP"},CA:{code:"CA",name:"Canada",flag:"ð¨ð¦",currency:"CAD"},GH:{code:"GH",name:"Ghana",flag:"ð¬ð",currency:"GHS"},KE:{code:"KE",name:"Kenya",flag:"ð°ðª",currency:"KES"},ZA:{code:"ZA",name:"South Africa",flag:"ð¿ð¦",currency:"ZAR"},DE:{code:"DE",name:"Germany",flag:"ð©ðª",currency:"EUR"},FR:{code:"FR",name:"France",flag:"ð«ð·",currency:"EUR"},AU:{code:"AU",name:"Australia",flag:"ð¦ðº",currency:"AUD"},AE:{code:"AE",name:"United Arab Emirates",flag:"ð¦ðª",currency:"AED"},SA:{code:"SA",name:"Saudi Arabia",flag:"ð¸ð¦",currency:"SAR"},IN:{code:"IN",name:"India",flag:"ð®ð³",currency:"INR"},CN:{code:"CN",name:"China",flag:"ð¨ð³",currency:"CNY"},BR:{code:"BR",name:"Brazil",flag:"ð§ð·",currency:"BRL"}},lK=["Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara","FCT"],uye=["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"],hye=["Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland and Labrador","Nova Scotia","Ontario","Prince Edward Island","Quebec","Saskatchewan","Northwest Territories","Nunavut","Yukon"],fye=["England - East Midlands","England - East of England","England - London","England - North East","England - North West","England - South East","England - South West","England - West Midlands","England - Yorkshire and the Humber","Scotland","Wales","Northern Ireland"],mye=["Greater Accra","Ashanti","Western","Central","Eastern","Volta","Northern","Upper East","Upper West","Brong-Ahafo","Bono East","Ahafo","Oti","Savannah","North East","Western North"],pye=["Nairobi","Mombasa","Kisumu","Nakuru","Eldoret","Kiambu","Machakos","Meru","Nyeri","Kakamega","Bungoma","Kericho","Uasin Gishu","Kilifi","Kwale","Kajiado","Laikipia","Nyandarua","Murang'a","Kirinyaga","Embu","Tharaka-Nithi","Kitui","Makueni","Nandi","Baringo","Bomet","Trans Nzoia","West Pokot","Elgeyo-Marakwet","Samburu","Turkana","Garissa","Wajir","Mandera","Marsabit","Isiolo","Lamu","Taita-Taveta","Homabay","Migori","Kisii","Nyamira","Narok","Siaya","Vihiga","Busia"],gye=["Eastern Cape","Free State","Gauteng","KwaZulu-Natal","Limpopo","Mpumalanga","Northern Cape","North West","Western Cape"],xye={NG:lK,US:uye,CA:hye,GB:fye,GH:mye,KE:pye,ZA:gye},vye=e=>({NG:"State",US:"State",CA:"Province",GB:"Region",GH:"Region",KE:"County",ZA:"Province"})[e]||"State/Province",xD=e=>{if(lK.some(n=>e.toLowerCase().includes(n.toLowerCase()))||e.toLowerCase().includes("nigeria"))return Dc.NG;for(const[n,s]of Object.entries(Dc))if(e.toLowerCase().includes(s.name.toLowerCase()))return s;return Dc.NG},vD=e=>Dc[e.toUpperCase()]||Dc.NG,yye=e=>{const t=Dc[e.toUpperCase()];return t?t.flag:"ð³ð¬"},bye=(e,t,n)=>
864[e,t,n].filter(Boolean).join(", "),dc=({value:e="NG",onValueChange:t,label:n="Country",required:s=!1,disabled:a=!1})=>{const i=Object.entries(Dc).sort(([o,l],[c,d])=>o==="NG"?-1:c==="NG"?1:l.name.localeCompare(d.name));return r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"country-selector",children:[n,s&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(mt,{value:e,onValueChange:t,disabled:a,children:[r.jsx(ut,{id:"country-selector",className:"w-full",children:r.jsx(pt,{placeholder:"Select a country",children:e&&Dc[e]&&r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-lg",children:Dc[e].flag}),r.jsx("span",{children:Dc[e].name})]})})}),r.jsx(ht,{children:i.map(([o,l])=>r.jsx(Ne,{value:o,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-lg",children:l.flag}),r.jsx("span",{children:l.name}),r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:l.currency})]})},o))})]})]})},uc=({countryCode:e,value:t,onChange:n,error:s,required:a=!1,disabled:i=!1})=>{const o=xye[e]||[],l=vye(e),c=o.length>0;return r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{children:[l,a&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),c?r.jsxs(mt,{value:t,onValueChange:n,disabled:i,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:`Select ${l.toLowerCase()}`})}),r.jsx(ht,{children:o.map(d=>r.jsx(Ne,{value:d,children:d},d))})]}):r.jsx(ge,{value:t,onChange:d=>n(d.target.value),placeholder:`Enter ${l.toLowerCase()}`,disabled:i}),s&&r.jsx("p",{className:"text-sm text-destructive",children:s})]})};function yD(){const{user:e}=bt(),{preferences:t,isLoading:n}=Di(),[s,a]=j.useState(!1),[i,o]=j.useState({country:"",state:"",city:""}),l=u=>{u&&t&&o({country:t.country,state:t.state,city:t.city}),a(u)},c=async()=>{if(!e){be({title:"Sign in required",description:"Please sign in to save location preferences",variant:"destructive"});return}try{const{error:u}=await H.from("profiles").update({preferred_country:i.country,preferred_state:i.state,preferred_city:i.city}).eq("id",e.id);if(u)throw u;be({title:"Location updated",description:"Your location preferences have been saved successfully."}),a(!1)}catch(u){be({title:"Update failed",description:u.message,variant:"destructive"})}};if(n)return r.jsxs(te,{variant:"outline",className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),r.jsx("span",{className:"text-xs",children:"Loading..."})]});const d=()=>!t.country||t.country==="NG"?"Nigeria":[t.city,t.state,yye(t.country)].filter(Boolean).join(", ")||"Set Location";return r.jsxs(cye,{open:s,onOpenChange:l,children:[r.jsx(dye,{asChild:!0,children:r.jsxs(W,{variant:"outline",size:"sm",className:"flex items-center gap-2 hover:bg-accent",children:[r.jsx(At,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm max-w-[120px] truncate",children:d()})]})}),r.jsx(oK,{className:"w-80",align:"end",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("h4",{className:"font-semibold text-sm flex items-center gap-2",children:[r.jsx(At,{className:"h-4 w-4"}),"Quick Location Switch"]}),r.jsx(Vt,{to:"/settings/location",children:r.jsx(W,{variant:"ghost",size:"sm",children:r.jsx(FN,{className:"h-4 w-4"})})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx(le,{className:"text-xs",children:"Country"}),r.jsx(dc,{value:i.country,onValueChange:u=>o({...i,country:u,state:"",city:""}),label:""})]}),r.jsx("div",{children:r.jsx(uc,{countryCode:i.country,value:i.state,onChange:u=>o({...i,state:u})})}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"quick-city",className:"text-xs",children:"City (Optional)"}),r.jsxs("div",{className:"relative",children:[r.jsx(At,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-3 w-3 text-muted-foreground"}),r.jsx(ge,{id:"quick-city",value:i.city,onChange:u=>o({...i,city:u.target.value}),placeholder:"Enter city",className:"pl-9 h-9"})]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{onClick:c,className:"flex-1",size:"sm",children:"Update & Refresh"}),r.jsx(W,{variant:"outline",onClick:()=>a(!1),size:"sm",children:"Cancel"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Tip: Visit Location Settings for more options"})]})})]})}const bD=[{name:"News",path:"/news",icon:Ca},{name:"Diaspora",path:"/diaspora",icon:hn},{name:"Events",path:"/events",icon:Xt},{name:"Jobs",path:"/jobs",icon:fr}],jye=()=>{const[e,t]=j.useState(!1),n=zn(),[s,a]=j.useState(!1),i=Ri(),{user:o}=bt(),l=d=>i.pathname===d||i.pathname.startsWith(d+"/"),c=[{name:"News",path:"/news",icon:Ca},{name:"Diaspora",path:"/diaspora",icon:hn},{name:"Send Money",path:"/send-money",icon:Jc},{name:"Jobs",path:"/jobs",icon:fr},{name:"Buy & Sell",path:"/buy-sell",icon:eu},{name:"Classifieds",path:"/classifieds",icon:fr},{name:"Events",path:"/events",icon:Xt}
864,{name:"Rentals",path:"/rentals",icon:en},{name:"Restaurants",path:"/restaurants",icon:Vh},{name:"Artisans",path:"/artisans",icon:Pi},{name:"Tourism",path:"/tourism",icon:rj},{name:"Creativity",path:"/creativity",icon:Lh}];return r.jsxs("nav",{className:"sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[r.jsxs("div",{className:"container flex h-16 items-center justify-between px-4",children:[r.jsxs(ai,{to:"/",className:"group flex items-center space-x-2 transition-all duration-300 hover:scale-105",children:[r.jsx("img",{src:"/naija-logo-n.svg",alt:"Naija.com",className:"h-10 w-auto transition-all duration-300 group-hover:shadow-glow",loading:"eager",decoding:"async"}),r.jsxs("span",{className:"hidden sm:inline-block font-bold text-lg bg-gradient-to-r from-naija-green to-naija-gold bg-clip-text text-transparent",children:["Naija",r.jsx("span",{className:"text-foreground",children:".com"})]})]}),r.jsxs("div",{className:"hidden lg:flex items-center gap-1 flex-1 justify-center",children:[bD.map(d=>{const u=d.icon,h=l(d.path);return r.jsxs(ai,{to:d.path,className:Ge("group relative flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all duration-300","hover:bg-accent hover:scale-105",h?"bg-gradient-to-r from-naija-green/10 to-naija-gold/10 text-naija-green":"text-muted-foreground hover:text-foreground"),children:[r.jsx(u,{className:Ge("h-4 w-4 transition-all duration-300",h?"text-naija-green":"group-hover:text-naija-gold")}),r.jsx("span",{children:d.name}),h&&r.jsx("span",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-8 h-0.5 bg-gradient-to-r from-naija-green to-naija-gold rounded-full"}),r.jsx("span",{className:"absolute inset-0 rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-gradient-to-r from-naija-green/5 to-naija-gold/5"})]},d.path)}),r.jsx(ZM,{})]}),r.jsxs("div",{className:"hidden md:flex lg:hidden items-center gap-1 flex-1 justify-center",children:[bD.map(d=>{const u=d.icon,h=l(d.path);return r.jsxs(ai,{to:d.path,title:d.name,className:Ge("group relative flex items-center justify-center w-10 h-10 rounded-full transition-all duration-300","hover:bg-accent hover:scale-110",h?"bg-gradient-to-r from-naija-green/15 to-naija-gold/15":""),children:[r.jsx(u,{className:Ge("h-5 w-5 transition-all duration-300",h?"text-naija-green":"text-muted-foreground group-hover:text-naija-gold")}),h&&r.jsx("span",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 w-6 h-0.5 bg-gradient-to-r from-naija-green to-naija-gold rounded-full"})]},d.path)}),r.jsx(ZM,{})]}),r.jsxs("div",{className:"hidden md:flex items-center gap-2",children:[r.jsx(yD,{}),r.jsx(ai,{to:"/send-money",children:r.jsxs(W,{size:"sm",variant:"outline",className:"gap-2 border-naija-gold/60 hover:bg-naija-gold/10 hover:border-naija-gold text-naija-gold hover:text-naija-gold",title:"Send money to Nigeria",children:[r.jsx(Jc,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden lg:inline",children:"Send Money"})]})}),r.jsxs(W,{size:"sm",variant:"ghost",onClick:()=>a(!0),className:"gap-2 hover:bg-accent",children:[r.jsx(D0,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden lg:inline",children:"Airtime"})]}),r.jsxs(W,{size:"sm",className:"gap-2 bg-gradient-hero hover:opacity-90",onClick:()=>{if(o){n("/create");return}try{sessionStorage.setItem("redirectAfterLogin","/create"),sessionStorage.setItem("loginPromptMessage","Sign in to post your listing")}catch{}n("/auth")},children:[r.jsx(xs,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden lg:inline",children:"Post Listing"})]}),o&&r.jsx(uxe,{}),r.jsx(QM,{})]}),r.jsxs(eH,{open:e,onOpenChange:t,children:[r.jsx(gpe,{asChild:!0,className:"md:hidden",children:r.jsx(W,{variant:"ghost",size:"icon",children:r.jsx(Hie,{className:"h-6 w-6"})})}),r.jsx(dO,{side:"right",className:"w-full sm:w-80 overflow-y-auto",children:r.jsxs("div",{className:"flex flex-col space-y-4 mt-6",children:[r.jsx("div",{className:"pb-2 border-b border-border",children:r.jsx(yD,{})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>{a(!0),t(!1)},className:"gap-2",children:[r.jsx(D0,{className:"h-4 w-4"}),"Airtime"]}),o&&r.jsx(ai,{to:"/create",onClick:()=>t(!1),children:r.jsxs(W,{size:"sm",className:"w-full gap-2 bg-gradient-hero",children:[r.jsx(xs,{className:"h-4 w-4"}),"Create"]})})]}),r.jsx("div",{className:"space-y-1",children:c.map(d=>{const u=d.icon;return r.jsx(ai,{to:d.path,onClick:()=>t(!1),children:r.jsxs(W,{variant:l(d.path)?"default":"ghost",className:Ge("w-full justify-start transition-all duration-200",l(d.path)?"bg-gradient-hero text-white":"hover:bg-accent"),children:[r.jsx(u,{className:"h-4 w-4 mr-3"}),d.name]})},d.path)})}),r.jsx("div",{className:"pt-4 border-t border-border",children:r.jsx(QM,{})})]})})]})]}),r.jsx(KY,{open:s,onOpenChange:a})]})},wye=()=>r.jsx("footer",{className:"bg-naija-dark border-t border-border/50",children:r.jsxs("div",{className:"container mx-auto px-4 py-12",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("div",{className:"w-8 h-8 bg-gradient-hero rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-sm font-bold text-background",children:"N"})}),r.jsx("span",{className:"text-xl font-bold bg-gradient-hero bg-clip-text text-transparent",children:"Naija.com"})]}),r.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"Nigeria's premier platform for creators, events, marketplace, and property rentals. Connecting Nigerians worldwide through authentic content and experiences."}),r.jsxs("div",{className:"flex space-x-3",children:[r.jsx(W,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-primary/20 hover:bg-primary/10",children:r.jsx(Rie,{className:"h-4 w-4"})}),r.jsx(W,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-primary/20 hover:bg-primary/10",children:r.jsx(soe,{className:"h-4 w-4"})}),r.jsx(W,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-primary/20 hover:bg-primary/10",children:r.jsx(Bie,{className:"h-4 w-4"})}),r.jsx(W,{size:"sm",variant:"outline",className:"h-8 w-8 p-0 border-primary/20 hover:bg-primary/10",children:r.jsx(ooe,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Qu
864ick Links"}),r.jsxs("ul",{className:"space-y-2 text-sm",children:[r.jsx("li",{children:r.jsx(Vt,{to:"/news",className:"text-muted-foreground hover:text-primary transition-colors",children:"Nigerian News & Gossips"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/content",className:"text-muted-foreground hover:text-primary transition-colors",children:"Nigerian Entertainment"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/events",className:"text-muted-foreground hover:text-primary transition-colors",children:"Events"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/marketplace",className:"text-muted-foreground hover:text-primary transition-colors",children:"Marketplace"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/bookings",className:"text-muted-foreground hover:text-primary transition-colors",children:"Property Rentals"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/submit",className:"text-muted-foreground hover:text-primary transition-colors",children:"Submit Content"})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Support & Tools"}),r.jsxs("ul",{className:"space-y-2 text-sm",children:[r.jsx("li",{children:r.jsx(Vt,{to:"/about",className:"text-muted-foreground hover:text-primary transition-colors",children:"About Us"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/advertise",className:"text-muted-foreground hover:text-primary transition-colors flex items-center gap-1",children:"ð¢ Advertise With Us"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/donate",className:"text-muted-foreground hover:text-primary transition-colors",children:"Donate: Support Our Mission"})}),r.jsx("li",{children:r.jsx("a",{href:"#",className:"text-muted-foreground hover:text-primary transition-colors",children:"Help Center"})}),r.jsx("li",{children:r.jsx("a",{href:"/community-guidelines",className:"text-muted-foreground hover:text-primary transition-colors",children:"Community Guidelines"})}),r.jsx("li",{children:r.jsx(Vt,{to:"/contact",className:"text-muted-foreground hover:text-primary transition-colors",children:"Contact Us"})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Get In Touch"}),r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[r.jsx(Dn,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:"[email protected]"})]}),r.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[r.jsx(an,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:"+234-07076095380"})]}),r.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[r.jsx(At,{className:"h-4 w-4 text-primary"}),r.jsx("span",{children:"12B Sapele Rd, Benin City, Edo State Nigeria"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium text-foreground text-sm",children:"Join the Naija.com Community"}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx("input",{type:"email",placeholder:"Your email",className:"flex-1 min-w-0 h-8 px-3 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50"}),r.jsx(W,{size:"sm",className:"h-8 bg-gradient-hero hover:opacity-90",children:"Subscribe"})]})]})]})]}),r.jsx("div",{className:"mt-12 pt-8 border-t border-border/50",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center space-y-4 md:space-y-0",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"© 2024 Naija.com. All rights reserved. Made with ð in Nigeria. Quality product of NJCABS Limited."}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"A quality product by NJCABS Limited. ð"}),r.jsxs("div",{className:"flex space-x-6 text-sm",children:[r.jsx("a",{href:"/privacy-policy",className:"text-muted-foreground hover:text-primary transition-colors",children:"Privacy Policy"}),r.jsx("a",{href:"/terms-of-service",className:"text-muted-foreground hover:text-primary transition-colors",children:"Terms of Service"}),r.jsx("a",{href:"/cookie-policy",className:"text-muted-foreground hover:text-primary transition-colors",children:"Cookie Policy"})]})]})})]})}),Nye=[{name:"News",path:"/news",icon:Kie,description:"Latest Nigerian headlines",category:"News & Media"},{name:"Buy & Sell",path:"/buy-sell",icon:eu,description:"Browse and sell products",category:"Products & Services"},{name:"Classifieds",path:"/classifieds",icon:fr,description:"Jobs, services, and more",category:"Products & Services"},{name:"Artisans",path:"/artisans",icon:Pi,description:"Local professionals",category:"Products & Services"},{name:"Events",path:"/events",icon:Xt,description:"Concerts, meetups, shows",category:"Experiences"},{name:"Restaurants",path:"/restaurants",icon:Lo,description:"Dining experiences",category:"Experiences"},{name:"Tourism",path:"/tourism",icon:fm,description:"Tour packages",category:"Experiences"},{name:"Lodging",path:"/lodging",icon:PT,description:"Properties and stays",category:"Experiences"},{name:"Creativity Hub",path:"/creativity",icon:Lh,description:"Art, music, film, crafts",category:"Creative"}],_ye=({open:e,onOpenChange:t})=>{const n=["News & Media","Products & Services","Experiences","Creative"];return r.jsx(eH,{open:e,onOpenChange:t,children:r.jsxs(dO,{side:"bottom",className:"h-[85vh] overflow-y-auto",children:[r.jsx(rH,{children:r.jsx(nH,{className:"text-2xl font-bold",children:"Explore"})}),r.jsx("div",{className:"mt-6 space-y-8",children:n.map(s=>r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wide",children:s}),r.jsx("div",{className:"grid grid-cols-2 gap-3",children:Nye.filter(a=>a.category===s).map(a=>{const i=a.icon;return r.jsx(ai,{to:a.path,onClick:()=>t(!1),children:r.jsxs("div",{className:"flex flex-col items-center space-y-2 p-4 rounded-lg border border-border bg-card hover:bg-accent transition-colors",children:[r.jsx("div",{className:"flex items-center justify-center h-12 w-12 rounded-full bg-primary/10",children:r.jsx(i,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{className:"text-center space-y-1",children:[r.jsx("p",{className:"text-sm font-medium",children:a.name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:a.description})]})]})},a.path)})})]},s))})]})})},Sye=()=>{const e=Ri(),[t,n]=j.useState(!1),s=[{name:"Home",path:"/",icon:en},{name:"News",path:"/news",icon:Ca},{name:"Send",path:"/send-money",icon:Jc},{name:"Diaspora",path:"/diaspora",icon:hn},{name:"Jobs",path:"/classifieds",icon:fr},{name:"More",path:null,icon:Gq,onClick:()=>n(!0)}],a=i=>i==="/"?e.pathname==="/":e.pathname.startsWith(i);return r.jsxs(r.Fragment,{children:[r.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-40 md:hidden bg-background/95 backdrop-blur border-t border-border",children:r.jsx("div",{className:"flex items-center justify-around h-16 px-1",children:s.map(i=>{const o=i.icon,l=i.path?a(i.path):!1,c=r.jsxs("div",{className:"relative flex flex-col items-center justify-center gap-0.5",children:[r.jsx("div",{className:Ge("relative p-1.5 rounded-xl transition-all duration-300",l&&"bg-gradient-to-r from-naija-green/15 to-naija-gold/15"),children:r.jsx(o,{className:Ge("h-5 w-5 transition-all duration-300",l?"text-naija-green scale-110":"text-muted-foreground")})}),r.jsx("span",{className:Ge("text-[10px] font-medium transition-all duration-300",l?"text-naija-green font-semibold":"text-muted-foreground"),children:i.name}),l&&r.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 w-8 h-0.5 bg-gradient-to-r from-naija-green to-naija-gold rounded-full"})]});return i.onClick?r.jsx("button",{onClick:i.onClick,className:Ge("flex flex-col items-center justify-center flex-1 h-full transition-all duration-200","active:scale-95"),children:c},i.name):r.jsx(ai,{to:i.path,className:Ge("flex flex-col items-center justify-center flex-1 h-full transition-all duration-200","active:scale-95"),children:c},i.path)})})}),r.jsx(_ye,{open:t,onOpenChange:n})]})},Y=j.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ge("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));
864Y.displayName="Card";const Se=j.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ge("flex flex-col space-y-1.5 p-6",e),...t}));Se.displayName="CardHeader";const Ae=j.forwardRef(({className:e,...t},n)=>r.jsx("h3",{ref:n,className:Ge("text-2xl font-semibold leading-none tracking-tight",e),...t}));Ae.displayName="CardTitle";const Nt=j.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:Ge("text-sm text-muted-foreground",e),...t}));Nt.displayName="CardDescription";const X=j.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ge("p-6 pt-0",e),...t}));X.displayName="CardContent";const kj=j.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ge("flex items-center p-6 pt-0",e),...t}));kj.displayName="CardFooter";const qn=({title:e="Naija.com - Nigerian Creator Platform",description:t="Enjoy Freely. Use Proudly. Naija.com is the homegrown platform for bold Nigerian content, events, commerce, and stays.",image:n="https://naija.com/og-image.png",type:s="website",canonical:a,noindex:i=!1,structuredData:o})=>{const l=Ri();return j.useEffect(()=>{document.title=e;const c=(u,h,f=!1)=>{const m=f?`meta[property="${u}"]`:`meta[name="${u}"]`;let x=document.querySelector(m);x||(x=document.createElement("meta"),f?x.setAttribute("property",u):x.setAttribute("name",u),document.head.appendChild(x)),x.setAttribute("content",h)};c("description",t),c("author","Naija.com"),c("og:title",e,!0),c("og:description",t,!0),c("og:type",s,!0),c("og:image",n,!0),c("og:url",`https://naija.com${l.pathname}`,!0),c("og:site_name","Naija.com",!0),c("og:locale","en_NG",!0),c("twitter:card","summary_large_image"),c("twitter:site","@naija_com"),c("twitter:title",e),c("twitter:description",t),c("twitter:image",n),i?c("robots","noindex, nofollow"):c("robots","index, follow, max-image-preview:large");let d=document.querySelector('link[rel="canonical"]');if(d||(d=document.createElement("link"),d.rel="canonical",document.head.appendChild(d)),d.href=a||`https://naija.com${l.pathname}`,o){let u=document.querySelector('script[type="application/ld+json"]');u||(u=document.createElement("script"),u.type="application/ld+json",document.head.appendChild(u)),u.textContent=JSON.stringify(o)}return()=>{if(o){const u=document.querySelector('script[type="application/ld+json"]');u&&document.head.removeChild(u)}}},[e,t,n,s,a,i,o,l.pathname]),null},Qp="/assets/content-music-BwWkPqIU.jpg",If="/assets/content-crafts-D1sPg2J1.jpg",kye={thumb:{width:160,quality:65,resize:"cover"},card:{width:480,quality:70,resize:"cover"},detail:{width:1200,quality:75,resize:"cover"},hero:{width:1600,quality:80,resize:"cover"}},jD="/storage/v1/object/public/",Cye="/storage/v1/render/image/public/";function cK(e,t="card"){if(!e)return"";if(e.startsWith("data:")||e.startsWith("blob:"))return e;const n=e.indexOf(jD);if(n===-1)return e;const s=typeof t=="string"?kye[t]:t,a=e.slice(0,n)+Cye+e.slice(n+jD.length),i=new URLSearchParams;s.width&&i.set("width",String(s.width)),s.height&&i.set("height",String(s.height)),s.quality&&i.set("quality",String(s.quality)),s.resize&&i.set("resize",s.resize);const o=i.toString();return o?`${a}?${o}`:a}const Aye=e=>cK(e,"thumb"),vl=e=>cK(e,"card"),Pye=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(!0);j.useEffect(()=>{a()},[]);const a=async()=>{try{const{data:l,error:c}=await H.from("advertisements").select("*").eq("advertisement_type","top_providers").eq("status","active").order("display_order",{ascending:!0}).limit(10);if(c)throw c;t(l||[])}catch(l){console.error("Error fetching top providers:",l)}finally{s(!1)}},i=async l=>{try{await H.rpc("update_advertisement_metrics",{ad_id:l.id,metric_type:"click"}),await H.from("advertisement_analytics").insert([{advertisement_id:l.id,event_type:"click",page_url:window.location.href,user_agent:navigator.userAgent}])}catch(c){console.error("Error tracking click:",c)}(l.target_url||l.business_website)&&window.open(l.target_url||l.business_website,"_blank")},o=async l=>{try{await H.rpc("update_advertisement_metrics",{ad_id:l,metric_type:"impression"}),await H.from("advertisement_analytics").insert([{advertisement_id:l,event_type:"view",page_url:window.location.href,user_agent:navigator.userAgent}])}catch(c){console.error("Error tracking impression:",c)}};return j.useEffect(()=>{e.forEach(l=>{o(l.id)})},[e]),n?r.jsx("section",{className:"py-10 md:py-14 bg-accent/30",children:r.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[r.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Top 10 Naija.com Providers"}),r.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((l,c)=>r.jsx("div",{className:"h-64 bg-muted animate-pulse rounded-lg"},c))})]})}):e.length===0?null:r.jsx("section",{className:"py-10 md:py-14 bg-accent/30",children:r.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold text-foreground mb-4",children:"Top 10 Naija.com Providers & Businesses"}),r.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Discover Nigeria's most trusted providers and businesses, carefully selected for their quality, reliability, and excellent customer service."})]}),r.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map((l,c)=>r.jsxs(Y,{className:"group hover:shadow-lg transition-all duration-300 cursor-pointer overflow-hidden",onClick:()=>i(l),children:[l.banner_image_url&&r.jsxs("div",{className:"h-32 bg-gradient-to-r from-primary/10 to-primary/5 relative overflow-hidden",children:[r.jsx("img",{src:vl(l.banner_image_url),alt:`${l.business_name} banner`,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(te,{variant:"secondary",className:"bg-background/90",children:["#",c+1]})})]}),r.jsxs(X,{className:"p-6",children:[r.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[l.logo_url?r.jsx("img",{src:Aye(l.logo_url),alt:`${l.business_name} logo`,loading:"lazy",decoding:"async",className:"w-12 h-12 rounded-full object-cover flex-shrink-0"}):r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx("span",{className:"font-bold text-primary",children:l.business_name.charAt(0)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-bold text-lg text-foreground mb-1 truncate",children:l.business_name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:l.title}),l.pricing_plan&&r.jsx(te,{variant:l.pricing_plan==="enterprise"?"default":"secondary",className:"text-xs",children:l.pricing_plan==="enterprise"?"Premium Partner":l.pricing_plan==="premium"?"Verified":"Trusted"})]})]}),l.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-4 line-clamp-3",children:l.description}),r.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[l.business_address&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate max-w-20",children:l.business_address})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(mr,{className:"h-3 w-3 fill-current text-yellow-500"}),r.jsx("span",{children:"Verified"})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-xs text-primary",children:[r.jsx(hn,{className:"h-3 w-3"}),r.jsx("span",{children:"Visit"}),r.jsx(ds,{className:"h-3 w-3"})]})]})]})]},l.id))}),r.jsxs("div",{className:"text-center mt-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"Want to showcase your business to thousands of Nigerians?"}),r.jsx(W,{onClick:()=>window.location.href="/advertise",className:"bg-primary hover:bg-primary/90",children:"Become a Top Provider"})]})]})})};function Eye(e=!1){const[t,n]=j.useState(null),[s,a]=j.useState(!1),[i,o]=j.useState(null),l=()=>{if(!navigator.geolocation){o("Geolocation is not supported by your browser");return}a(!0),o(null),navigator.geolocation.getCurrentPosition(c=>{n({latitude:c.coords.latitude,longitude:c.coords.longitude,accuracy:c.coords.accuracy}),a(!1),console.log("Location detected:",c.coords.latitude,c.coords.longitude)},c=>{let d="Failed to get your location";switch(c.code){case c.PERMISSION_DENIED:d="Location permission denied. Please enable location access.";break;case c.POSITION_UNAVAILABLE:d="Location information unavailable.";break;case c.TIMEOUT:d="Location request timed out.";break}o(d),a(!1),console.error("Geolocation error:",c)},{enableHighAccuracy:!0,timeout:1e4,maximumAge:3e5})};return j.useEffect(()=>{e&&l()},[e]),{location:t,loading:s,error:i,requestLocation:l}}const Tye=[{value:5,label:"5 km"},{value:10,label:"10 km"},{value:25,label:"25 km"},{value:50,label:"50 km"},{value:100,label:"100 km"}],Oye=({onLocationChange:e,className:t})=>{const{location:n,loading:s,error:a,requestLocation:i}=Eye(!1),[o,l]=j.useState(!1),[c,d]=j.useState(25),u=()=>{o?(l(!1),e(null),Et.success("Near me search disabled")):n?(l(!0),e({lat:n.latitude,lng:n.longitude,radiu
864s:c}),Et.success("Showing results near you")):i()};j.useState(()=>{n&&!o&&s===!1&&(l(!0),e({lat:n.latitude,lng:n.longitude,radius:c}))});const h=f=>{const m=parseInt(f);d(m),o&&n&&(e({lat:n.latitude,lng:n.longitude,radius:m}),Et.success(`Radius updated to ${m} km`))};return r.jsxs("div",{className:`flex items-center gap-2 ${t}`,children:[r.jsx(W,{variant:o?"default":"outline",size:"sm",onClick:u,disabled:s,className:"gap-2",children:s?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"h-4 w-4 animate-spin"}),"Detecting..."]}):o?r.jsxs(r.Fragment,{children:[r.jsx(_m,{className:"h-4 w-4"}),"Near Me"]}):r.jsxs(r.Fragment,{children:[r.jsx(At,{className:"h-4 w-4"}),"Near Me"]})}),o&&n&&r.jsxs(mt,{value:c.toString(),onValueChange:h,children:[r.jsx(ut,{className:"w-28 h-9",children:r.jsx(pt,{})}),r.jsx(ht,{children:Tye.map(f=>r.jsx(Ne,{value:f.value.toString(),children:f.label},f.value))})]}),o&&n&&r.jsxs(te,{variant:"secondary",className:"gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),n.latitude.toFixed(4),", ",n.longitude.toFixed(4)]}),a&&!o&&r.jsx(te,{variant:"destructive",className:"text-xs",children:a})]})};function zu(e,t,n,s){const i=d1(n-e),o=d1(s-t),l=Math.sin(i/2)*Math.sin(i/2)+Math.cos(d1(e))*Math.cos(d1(n))*Math.sin(o/2)*Math.sin(o/2);return 6371*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}function d1(e){return e*(Math.PI/180)}const Lye={"new york":{lat:40.7128,lng:-74.006},nyc:{lat:40.7128,lng:-74.006},"los angeles":{lat:34.0522,lng:-118.2437},chicago:{lat:41.8781,lng:-87.6298},houston:{lat:29.7604,lng:-95.3698},washington:{lat:38.9072,lng:-77.0369},dc:{lat:38.9072,lng:-77.0369},atlanta:{lat:33.749,lng:-84.388},london:{lat:51.5074,lng:-.1278},manchester:{lat:53.4808,lng:-2.2426},birmingham:{lat:52.4862,lng:-1.8904},toronto:{lat:43.6532,lng:-79.3832},vancouver:{lat:49.2827,lng:-123.1207},lagos:{lat:6.5244,lng:3.3792},abuja:{lat:9.0765,lng:7.3986}};function Iye(e){const t=e.toLowerCase().trim();return Lye[t]||null}async function Rye(e){const{userLat:t,userLng:n,radius:s,contentType:a="all",limit:i=50}=e,o=[];console.log(`Performing geo search near ${t}, ${n} within ${s}km`);try{if(a==="all"||a==="products"){const{data:l}=await H.from("products").select("id, title, description, price, latitude, longitude, location, tags, images, created_at").eq("status","active").not("latitude","is",null).not("longitude","is",null).limit(i);l==null||l.forEach(c=>{const d=zu(t,n,c.latitude,c.longitude);d<=s&&o.push({id:c.id,title:c.title,description:c.description,type:"product",latitude:c.latitude,longitude:c.longitude,distance:d,location:c.location,price:c.price,tags:c.tags,images:c.images,created_at:c.created_at})})}if(a==="all"||a==="events"){const{data:l}=await H.from("events").select("id, title, description, latitude, longitude, city, tags, cover_image, created_at, start_datetime").eq("status","published").not("latitude","is",null).not("longitude","is",null).limit(i);l==null||l.forEach(c=>{const d=zu(t,n,c.latitude,c.longitude);d<=s&&o.push({id:c.id,title:c.title,description:c.description,type:"event",latitude:c.latitude,longitude:c.longitude,distance:d,location:c.city,tags:c.tags,images:c.cover_image?[c.cover_image]:[],created_at:c.start_datetime||c.created_at})})}if(a==="all"||a==="properties"){const{data:l}=await H.from("properties").select("id, title, description, base_price_per_night, latitude, longitude, city, photos, created_at").eq("status","active").not("latitude","is",null).not("longitude","is",null).limit(i);l==null||l.forEach(c=>{const d=zu(t,n,c.latitude,c.longitude);d<=s&&o.push({id:c.id,title:c.title,description:c.description,type:"property",latitude:c.latitude,longitude:c.longitude,distance:d,location:c.city,price:c.base_price_per_night,images:c.photos,created_at:c.created_at})})}if(a==="all"||a==="restaurants"){const{data:l}=await H.from("restaurants").select("id, name, description, latitude, longitude, city, state, images, created_at").eq("status","active").not("latitude","is",null).not("longitude","is",null).limit(i);l==null||l.forEach(c=>{const d=zu(t,n,c.latitude,c.longitude);d<=s&&o.push({id:c.id,title:c.name,description:c.description,type:"restaurant",latitude:c.latitude,longitude:c.longitude,distance:d,location:`${c.city}, ${c.state}`,images:c.images,created_at:c.created_at})})}if(a==="all"||a==="artisans"){const{data:l}=await H.from("artisans").select("id, business_name, description, latitude, longitude, city, state, skills, portfolio_images, created_at, average_rating, service_category").eq("status","active").not("latitude","is",null).not("longitude","is",null).limit(i);l==null||l.forEach(c=>{const d=zu(t,n,c.latitude,c.longitude);d<=s&&o.push({id:c.id,title:c.business_name,description:c.description,type:"artisan",latitude:c.latitude,longitude:c.longitude,distance:d,location:`${c.city}, ${c.state}`,tags:c.skills||(c.service_category?[c.service_category]:[]),rating:c.average_rating,images:c.portfolio_images,created_at:c.created_at})})}if(a==="all"||a==="classifieds"){const{data:l}=await H.from("classifieds").select("id, title, description, latitude, longitude, location_city, location_state, skills, created_at").eq("status","active").not("latitude","is",null).not("longitude","is",null).limit(i);l==null||l.forEach(c=>{const d=zu(t,n,c.latitude,c.longitude);
864d<=s&&o.push({id:c.id,title:c.title,description:c.description,type:"classified",latitude:c.latitude,longitude:c.longitude,distance:d,location:`${c.location_city}, ${c.location_state}`,tags:c.skills,created_at:c.created_at})})}return o.sort((l,c)=>l.distance-c.distance),console.log(`Found ${o.length} results within ${s}km`),o}catch(l){return console.error("Geo search error:",l),[]}}function Mye(e){return e<1?`${Math.round(e*1e3)}m away`:`${e.toFixed(1)} km away`}const Dye=()=>{const[e,t]=j.useState(""),[n,s]=j.useState([]),[a,i]=j.useState([]),[o,l]=j.useState(!1),[c,d]=j.useState("all"),[u,h]=j.useState("relevance"),[f,m]=j.useState(""),[x,p]=j.useState(""),[v,g]=j.useState(null),[y,b]=j.useState("text"),w=async N=>{if(g(N),N){b("geo"),l(!0);try{const k=c==="all"?"all":c,I=await Rye({userLat:N.lat,userLng:N.lng,radius:N.radius,contentType:k,limit:50});i(I)}catch(k){console.error("Geo search error:",k)}finally{l(!1)}}else b("text"),i([])},_=async()=>{if(!e.trim()){s([]);return}l(!0);try{const N=[];if(c==="all"||c==="event"){const{data:I}=await H.from("events").select("id, title, description, city, start_datetime, tags, cover_image").eq("status","published").textSearch("title",e.trim()).limit(10);I==null||I.forEach(P=>{N.push({id:P.id,title:P.title,description:P.description||"",type:"event",location:P.city,date:P.start_datetime,tags:P.tags,image:P.cover_image})})}if(c==="all"||c==="product"){const{data:I}=await H.from("products").select("id, title, description, price, location, tags, images").eq("status","active").textSearch("title",e.trim()).limit(10);I==null||I.forEach(P=>{var O;N.push({id:P.id,title:P.title,description:P.description||"",type:"product",location:P.location,price:P.price,tags:P.tags,image:(O=P.images)==null?void 0:O[0]})})}if(c==="all"||c==="property"){const{data:I}=await H.from("properties").select("id, title, description, base_price_per_night, city, photos").eq("status","active").textSearch("title",e.trim()).limit(10);I==null||I.forEach(P=>{var O;N.push({id:P.id,title:P.title,description:P.description||"",type:"property",location:P.city,price:P.base_price_per_night,image:(O=P.photos)==null?void 0:O[0]})})}if(c==="all"||c==="content"){const{data:I}=await H.from("content").select("id, title, description, category, tags, thumbnail_url").eq("status","published").textSearch("title",e.trim()).limit(10);I==null||I.forEach(P=>{N.push({id:P.id,title:P.title,description:P.description||"",type:"content",tags:P.tags,image:P.thumbnail_url})})}let k=N;if(f&&(k=k.filter(I=>{var P;return(P=I.location)==null?void 0:P.toLowerCase().includes(f.toLowerCase())})),x){const[I,P]=x.split("-").map(Number);k=k.filter(O=>O.price?O.price>=I&&(P?O.price<=P:!0):!0)}switch(u){case"price_low":k.sort((I,P)=>(I.price||0)-(P.price||0));break;case"price_high":k.sort((I,P)=>(P.price||0)-(I.price||0));break;case"date":k.sort((I,P)=>!I.date||!P.date?0:new Date(I.date).getTime()-new Date(P.date).getTime());break;default:break}s(k)}catch(N){console.error("Search error:",N)}finally{l(!1)}};j.useEffect(()=>{if(y==="geo"&&v)w(v);else if(y==="text"){const N=setTimeout(()=>{_()},300);return()=>clearTimeout(N)}},[e,c,u,f,x,y]);const C=N=>{switch(N.type){case"event":return`/events/${N.id}`;case"product":return`/marketplace/${N.id}`;case"property":return`/properties/${N.id}`;case"content":return`/content/${N.id}`;default:return"#"}},E=N=>{switch(N){case"event":return"bg-blue-100 text-blue-800";case"product":return"bg-green-100 text-green-800";case"property":return"bg-purple-100 text-purple-800";case"content":return"bg-orange-100 text-orange-800";default:return"bg-gray-100 text-gray-800"}};return r.jsxs("div",{className:"w-full max-w-6xl mx-auto space-y-6",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),r.jsx(ge,{placeholder:"Search events, products, properties, content...",value:e,onChange:N=>t(N.target.value),className:"pl-10 pr-4 py-3 text-lg"})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(Oye,{onLocationChange:w}),r.jsx("div",{className:"h-6 w-px bg-border"}),r.jsxs(mt,{value:c,onValueChange:d,children:[r.jsx(ut,{className:"w-40",children:r.jsx(pt,{placeholder:"All types"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All types"}),r.jsx(Ne,{value:"events",children:"Events"}),r.jsx(Ne,{value:"products",children:"Products"}),r.jsx(Ne,{value:"properties",children:"Properties"}),r.jsx(Ne,{value:"restaurants",children:"Restaurants"}),r.jsx(Ne,{value:"artisans",children:"Artisans"}),r.jsx(Ne,{value:"classifieds",children:"Classifieds"})]})]}),r.jsxs(mt,{value:u,onValueChange:h,children:[r.jsx(ut,{className:"w-40",children:r.jsx(pt,{placeholder:"Sort by"})}),r.jsxs(ht,{children:[y==="geo"&&r.jsx(Ne,{value:"distance",children:"Distance"}),r.jsx(Ne,{value:"relevance",children:"Relevance"}),r.jsx(Ne,{value:"date",children:"Date"}),r.jsx(Ne,{value:"price_low",children:"Price (Low to High)"}),r.jsx(Ne,{value:"price_high",children:"Price (High to Low)"})]})]}),r.jsx(ge,{placeholder:"Filter by location...",value:f,onChange:N=>m(N.target.value),className:"w-40"}),r.jsxs(mt,{value:x,onValueChange:p,children:[r.jsx(ut,{className:"w-40",children:r.jsx(pt,{placeholder:"Price range"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"any",children:"Any price"}),r.jsx(Ne,{value:"0-10000",children:"Under â¦10k"}),r.jsx(Ne,{value:"10000-50000",children:"â¦10k - â¦50k"}),r.jsx(Ne,{value:"50000-100000",children:"â¦50k - â¦100k"}),r.jsx(Ne,{value:"100000-",children:"Above â¦100k"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[o&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),r.jsx("p",{className:"mt-2 text-muted-foreground",children:y==="geo"?"Finding nearby results...":"Searching..."})]}),!o&&y==="geo"&&a.length===0&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(At,{className:"h-12 w-12 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground",children:"No results found near your location"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Try increasing the search radius"})]}),!o&&y==="text"&&n.length===0&&e&&r.jsx("div",{className:"text-center py-8",children:r.jsxs("p",{className:"text-muted-foreground",children:['No results found for "',e,'"']})}),y==="geo"&&a.map(N=>r.jsx(Y,{className:"hover:shadow-md transition-shadow",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[N.images&&N.images[0]&&r.jsx("img",{src:N.images[0],alt:N.title,className:"w-20 h-20 object-cover rounded-lg flex-shrink-0"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg",children:N.title}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:N.description})]}),r.jsx(te,{className:E(N.type),children:N.type})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1 font-semibold text-primary",children:[r.jsx(_m,{className:"h-3 w-3"}),Mye(N.distance)]}),N.location&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),N.location]}),N.price&&r.jsxs("div",{className:"font-semibold text-primary",children:["â¦",N.price.toLocaleStr
864ing(),N.type==="property"&&"/night"]})]}),N.tags&&N.tags.length>0&&r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[N.tags.slice(0,3).map((k,I)=>r.jsx(te,{variant:"outline",className:"text-xs",children:k},I)),N.tags.length>3&&r.jsxs(te,{variant:"outline",className:"text-xs",children:["+",N.tags.length-3," more"]})]})]})]})})},`${N.type}-${N.id}`)),y==="text"&&n.map(N=>r.jsx(Y,{className:"hover:shadow-md transition-shadow",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[N.image&&r.jsx("img",{src:N.image,alt:N.title,className:"w-20 h-20 object-cover rounded-lg flex-shrink-0"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx(ai,{to:C(N),children:r.jsx("h3",{className:"font-semibold text-lg hover:text-primary",children:N.title})}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:N.description})]}),r.jsx(te,{className:E(N.type),children:N.type})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[N.location&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),N.location]}),N.price&&r.jsxs("div",{className:"font-semibold text-primary",children:["â¦",N.price.toLocaleString(),N.type==="property"&&"/night"]}),N.date&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Xt,{className:"h-3 w-3"}),new Date(N.date).toLocaleDateString()]})]}),N.tags&&N.tags.length>0&&r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[N.tags.slice(0,3).map((k,I)=>r.jsx(te,{variant:"outline",className:"text-xs",children:k},I)),N.tags.length>3&&r.jsxs(te,{variant:"outline",className:"text-xs",children:["+",N.tags.length-3," more"]})]})]})]})})},`${N.type}-${N.id}`))]})]})},$ye=({stats:e})=>{const[t,n]=j.useState(e.map(()=>0));return j.useEffect(()=>{const i=33.333333333333336,o=e.map((l,c)=>{const d=l.value/60;let u=0;return setInterval(()=>{u++,u<=60&&n(h=>{const f=[...h];return f[c]=Math.min(Math.round(d*u),l.value),f})},i)});return()=>o.forEach(clearInterval)},[e]),r.jsx("div",{className:"flex flex-wrap items-center justify-center gap-4 md:gap-8 mb-4 text-white",children:e.map((s,a)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-2xl md:text-3xl font-bold bg-gradient-to-r from-naija-green to-naija-gold bg-clip-text text-transparent",children:[t[a].toLocaleString(),s.suffix||""]}),r.jsxs("span",{className:"text-sm md:text-base text-gray-300",children:["⢠",s.label]})]},s.label))})},wD=["Discover, Create & Connect with All Things Nigerian","Stream Bold African Content ⢠Host Events ⢠Sell Products","Your Gateway to Nigerian Culture & Commerce","Connect with 15K+ Creators & Vendors Nationwide","Own a Business? List Your Profile Free â Get Found by Nigerians Near You"],Fye=()=>{const[e,t]=j.useState(0),[n,s]=j.useState(!1);return j.useEffect(()=>{const a=setInterval(()=>{s(!0),setTimeout(()=>{t(i=>(i+1)%wD.length),s(!1)},300)},1e4);return()=>clearInterval(a)},[]),r.jsx("p",{className:`text-2xl md:text-3xl text-gray-200 mb-8 max-w-4xl mx-auto drop-shadow-lg min-h-[4rem] md:whitespace-nowrap transition-all duration-300 ${n?"opacity-0 transform translate-y-2":"opacity-100 transform translate-y-0"}`,children:wD[e]})},Bye=()=>{const e=[{icon:fn,text:"100% Nigerian-Owned"},{icon:Vd,text:"Verified Creators"},{icon:Th,text:"Supporting Local Talent"}];return r.jsx("div",{className:"flex flex-wrap items-center justify-center gap-4 md:gap-6 mt-6",children:e.map(t=>r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 backdrop-blur-sm px-4 py-2 rounded-full border border-white/20 hover:bg-white/20 transition-all duration-300",children:[r.jsx(t.icon,{className:"h-4 w-4 text-naija-gold"}),r.jsx("span",{className:"text-sm text-white font-medium",children:t.text})]},t.text))})},Uye=()=>{const[e,t]=j.useState(""),[n,s]=j.useState(!1);return j.useEffect(()=>{(async()=>{try{const o=await(await fetch("https://ipapi.co/json/")).json();t(o.country_name||""),s(o.country_code!=="NG")}catch{console.log("Location detection skipped")}})()},[]),n?r.jsx("div",{className:"bg-gradient-to-r from-naija-green/10 to-naija-gold/10 border border-primary/20 rounded-lg p-4 mb-6 backdrop-blur-sm",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(hn,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsxs("h3",{className:"font-semibold text-foreground",children:["Welcome from ",e,"!"]}),r.jsxs(te,{variant:"outline",className:"border-naija-gold text-naija-gold",children:[r.jsx(Th,{className:"h-3 w-3 mr-1 fill-current"}),"Diaspora"]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect with home. Support Nigerian creators, discover events, and shop authentic products from anywhere in the world."})]})]})}):null};function zye(e){return Object.prototype.toString.call(e)==="[object Object]"}function ND(e){return zye(e)||Array.isArray(e)}function qye(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function OO(e,t){const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;const a=JSON.stringify(Object.keys(e.breakpoints||{})),i=JSON.stringify(Object.keys(t.breakpoints||{}));return a!==i?!1:n.every(o=>{const l=e[o],c=t[o];return typeof l=="function"?`${l}`==`${c}`:!ND(l)||!ND(c)?l===c:OO(l,c)})}function _D(e){return e.concat().sort((t,n)=>t.name>n.name?1:-1).map(t=>t.options)}function Vye(e,t){if(e.length!==t.length)return!1;const n=_D(e),s=_D(t);return n.every((a,i)=>{const o=s[i];return OO(a,o)})}function LO(e){return typeof e=="number"}function AP(e){return typeof e=="string"}function NS(e){return typeof e=="boolean"}function SD(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ns(e){return Math.abs(e)}function IO(e){return Math.sign(e)}function a0(e,t){return Ns(e-t)}function Wye(e,t){if(e===0||t===0||Ns(e)<=Ns(t))return 0;const n=a0(Ns(e),Ns(t));return Ns(n/e)}function Hye(e){return Math.round(e*100)/100}function Z0(e){return J0(e).map(Number)}function Zl(e){return e[Cj(e)]}function Cj(e){return Math.max(0,e.length-1)}function RO(e,t){return t===Cj(e)}function kD(e,t=0){return Array.from(Array(e),(n,s)=>t+s)}function J0(e){return Object.keys(e)}function dK(e,t){return[e,t].reduce((n,s)=>
vendor: 16,332 bytes, line 864
864(J0(s).forEach(a=>{const i=n[a],o=s[a],l=SD(i)&&SD(o);n[a]=l?dK(i,o):o}),n),{})}function PP(e,t){return typeof t.MouseEvent<"u"&&e instanceof t.MouseEvent}function Gye(e,t){const n={start:s,center:a,end:i};function s(){return 0}function a(c){return i(c)/2}function i(c){return t-c}function o(c,d){return AP(e)?n[e](c):e(t,c,d)}return{measure:o}}function Q0(){let e=[];function t(a,i,o,l={passive:!0}){let c;if("addEventListener"in a)a.addEventListener(i,o,l),c=()=>a.removeEventListener(i,o,l);else{const d=a;d.addListener(o),c=()=>d.removeListener(o)}return e.push(c),s}function n(){e=e.filter(a=>a())}const s={add:t,clear:n};return s}function Yye(e,t,n,s){const a=Q0(),i=1e3/60;let o=null,l=0,c=0;function d(){a.add(e,"visibilitychange",()=>{e.hidden&&x()})}function u(){m(),a.clear()}function h(v){if(!c)return;o||(o=v,n(),n());const g=v-o;for(o=v,l+=g;l>=i;)n(),l-=i;const y=l/i;s(y),c&&(c=t.requestAnimationFrame(h))}function f(){c||(c=t.requestAnimationFrame(h))}function m(){t.cancelAnimationFrame(c),o=null,l=0,c=0}function x(){o=null,l=0}return{init:d,destroy:u,start:f,stop:m,update:n,render:s}}function Kye(e,t){const n=t==="rtl",s=e==="y",a=s?"y":"x",i=s?"x":"y",o=!s&&n?-1:1,l=u(),c=h();function d(x){const{height:p,width:v}=x;return s?p:v}function u(){return s?"top":n?"right":"left"}function h(){return s?"bottom":n?"left":"right"}function f(x){return x*o}return{scroll:a,cross:i,startEdge:l,endEdge:c,measureSize:d,direction:f}}function Om(e=0,t=0){const n=Ns(e-t);function s(d){return d<e}function a(d){return d>t}function i(d){return s(d)||a(d)}function o(d){return i(d)?s(d)?e:t:d}function l(d){return n?d-n*Math.ceil((d-t)/n):d}return{length:n,max:t,min:e,constrain:o,reachedAny:i,reachedMax:a,reachedMin:s,removeOffset:l}}function uK(e,t,n){const{constrain:s}=Om(0,e),a=e+1;let i=o(t);function o(f){return n?Ns((a+f)%a):s(f)}function l(){return i}function c(f){return i=o(f),h}function d(f){return u().set(l()+f)}function u(){return uK(e,l(),n)}const h={get:l,set:c,add:d,clone:u};return h}function Xye(e,t,n,s,a,i,o,l,c,d,u,h,f,m,x,p,v,g,y){const{cross:b,direction:w}=e,_=["INPUT","SELECT","TEXTAREA"],C={passive:!1},E=Q0(),N=Q0(),k=Om(50,225).constrain(m.measure(20)),I={mouse:300,touch:400},P={mouse:500,touch:600},O=x?43:25;let A=!1,R=0,L=0,z=!1,U=!1,$=!1,q=!1;function ne(ce){if(!y)return;function De(re){(NS(y)||y(ce,re))&&ve(re)}const Ue=t;E.add(Ue,"dragstart",re=>re.preventDefault(),C).add(Ue,"touchmove",()=>{},C).add(Ue,"touchend",()=>{}).add(Ue,"touchstart",De).add(Ue,"mousedown",De).add(Ue,"touchcancel",_e).add(Ue,"contextmenu",_e).add(Ue,"click",xe,!0)}function se(){E.clear(),N.clear()}function F(){const ce=q?n:t;N.add(ce,"touchmove",pe,C).add(ce,"touchend",_e).add(ce,"mousemove",pe,C).add(ce,"mouseup",_e)}function V(ce){const De=ce.nodeName||"";return _.includes(De)}function Z(){return(x?P:I)[q?"mouse":"touch"]}function de(ce,De){const Ue=h.add(IO(ce)*-1),re=u.byDistance(ce,!x).distance;return x||Ns(ce)<k?re:v&&De?re*.5:u.byIndex(Ue.get(),0).distance}function ve(ce){const De=PP(ce,s);q=De,$=x&&De&&!ce.buttons&&A,A=a0(a.get(),o.get())>=2,!(De&&ce.button!==0)&&(V(ce.target)||(z=!0,i.pointerDown(ce),d.useFriction(0).useDuration(0),a.set(o),F(),R=i.readPoint(ce),L=i.readPoint(ce,b),f.emit("pointerDown")))}function pe(ce){if(!PP(ce,s)&&ce.touches.length>=2)return _e(ce);const Ue=i.readPoint(ce),re=i.readPoint(ce,b),et=a0(Ue,R),kt=a0(re,L);if(!U&&!q&&(!ce.cancelable||(U=et>kt,!U)))return _e(ce);const St=i.pointerMove(ce);et>p&&($=!0),d.useFriction(.3).useDuration(.75),l.start(),a.add(w(St)),ce.preventDefault()}function _e(ce){const Ue=u.byDistance(0,!1).index!==h.get(),re=i.pointerUp(ce)*Z(),et=de(w(re),Ue),kt=Wye(re,et),St=O-10*kt,Ve=g+kt/50;U=!1,z=!1,N.clear(),d.useDuration(St).useFriction(Ve),c.distance(et,!x),q=!1,f.emit("pointerUp")}function xe(ce){$&&(ce.stopPropagation(),ce.preventDefault(),$=!1)}function oe(){return z}return{init:ne,destroy:se,pointerDown:oe}}function Zye(e,t){let s,a;function i(h){return h.timeStamp}function o(h,f){const x=`client${(f||e.scroll)==="x"?"X":"Y"}`;return(PP(h,t)?h:h.touches[0])[x]}function l(h){return s=h,a=h,o(h)}function c(h){const f=o(h)-o(a),m=i(h)-i(s)>170;return a=h,m&&(s=h),f}function d(h){if(!s||!a)return 0;const f=o(a)-o(s),m=i(h)-i(s),x=i(h)-i(a)>170,p=f/m;return m&&!x&&Ns(p)>.1?p:0}return{pointerDown:l,pointerMove:c,pointerUp:d,readPoint:o}}function Jye(){function e(n){const{offsetTop:s,offsetLeft:a,offsetWidth:i,offsetHeight:o}=n;return{top:s,right:a+i,bottom:s+o,left:a,width:i,height:o}}return{measure:e}}function Qye(e){function t(s){return e*(s/100)}return{measure:t}}function e0e(e,t,n,s,a,i,o){const l=[e].concat(s);let c,d,u=[],h=!1;function f(v){return a.measureSize(o.measure(v))}function m(v){if(!i)return;d=f(e),u=s.map(f);function g(y){for(const b of y){if(h)return;const w=b.target===e,_=s.indexOf(b.target),C=w?d:u[_],E=f(w?e:s[_]);if(Ns(E-C)>=.5){v.reInit(),t.emit("resize");break}}}c=new ResizeObserver(y=>{(NS(i)||i(v,y))&&g(y)}),n.requestAnimationFrame(()=>{l.forEach(y=>c.observe(y))})}function x(){h=!0,c&&c.disconnect()}return{init:m,destroy:x}}function t0e(e,t,n,s,a,i){let o=0,l=0,c=a,d=i,u=e.get(),h=0;function f(){const C=s.get()-e.get(),E=!c;let N=0;return E?(o=0,n.set(s),e.set(s),N=C):(n.set(e),o+=C/c,o*=d,u+=o,e.add(o),N=u-h),l=IO(N),h=u,_}function m(){const C=s.get()-t.get();return Ns(C)<.001}function x(){return c}function p(){return l}function v(){return o}function g(){return b(a)}function y(){return w(i)}function b(C){return c=C,_}function w(C){return d=C,_}const _={direction:p,duration:x,velocity:v,seek:f,settled:m,useBaseFriction:y,useBaseDuration:g,useFriction:w,useDuration:b};return _}function r0e(e,t,n,s,a){const i=a.measure(10),o=a.measure(50),l=Om(.1,.99);let c=!1;function d(){return!(c||!e.reachedAny(n.get())||!e.reachedAny(t.get()))}function u(m){if(!d())return;const x=e.reachedMin(t.get())?"min":"max",p=Ns(e[x]-t.get()),v=n.get()-t.get(),g=l.constrain(p/o);n.subtract(v*g),!m&&Ns(v)<i&&(n.set(e.constrain(n.get())),s.useDuration(25).useBaseFriction())}function h(m){c=!m}return{shouldConstrain:d,constrain:u,toggleActive:h}}function n0e(e,t,n,s,a){const i=Om(-t+e,0),o=h(),l=u(),c=f();function d(x,p){return a0(x,p)<=1}function u(){const x=o[0],p=Zl(o),v=o.lastIndexOf(x),g=o.indexOf(p)+1;return Om(v,g)}function h(){return n.map((x,p)=>{const{min:v,max:g}=i,y=i.constrain(x),b=!p,w=RO(n,p);return b?g:w||d(v,y)?v:d(g,y)?g:y}).map(x=>parseFloat(x.toFixed(3)))}function f(){if(t<=e+a)return[i.max];if(s==="keepSnaps")return o;const{min:x,max:p}=l;return o.slice(x,p)}return{snapsContained:c,scrollContainLimit:l}}function s0e(e,t,n){const s=t[0],a=n?s-e:Zl(t);return{limit:Om(a,s)}}function a0e(e,t,n,s){const i=t.min+.1,o=t.max+.1,{reachedMin:l,reachedMax:c}=Om(i,o);function d(f){return f===1?c(n.get()):f===-1?l(n.get()):!1}function u(f){if(!d(f))return;const m=e*(f*-1);s.forEach(x=>x.add(m))}return{loop:u}}function i0e(e){const{max:t,length:n}=e;function s(i){const o=i-t;return n?o/-n:0}return{get:s}}function o0e(e,t,n,s,a){const{startEdge:i,endEdge:o}=e,{groupSlides:l}=a,c=h().map(t.measure),d=f(),u=m();function h(){return l(s).map(p=>Zl(p)[o]-p[0][i]).map(Ns)}function f(){return s.map(p=>n[i]-p[i]).map(p=>-Ns(p))}function m(){return l(d).map(p=>p[0]).map((p,v)=>p+c[v])}return{snaps:d,snapsAligned:u}}function l0e(e,t,n,s,a,i){const{groupSlides:o}=a,{min:l,max:c}=s,d=u();function u(){const f=o(i),m=!e||t==="keepSnaps";return n.length===1?[i]:m?f:f.slice(l,c).map((x,p,v)=>{const g=!p,y=RO(v,p);if(g){const b=Zl(v[0])+1;return kD(b)}if(y){const b=Cj(i)-Zl(v)[0]+1;return kD(b,Zl(v)[0])}return x})}return{slideRegistry:d}}function c0e(e,t,n,s,a){const{reachedAny:i,removeOffset:o,constrain:l}=s;function c(x){return x.concat().sort((p,v)=>Ns(p)-Ns(v))[0]}function d(x){const p=e?o(x):l(x),v=t.map((y,b)=>({diff:u(y-p,0),index:b})).sort((y,b)=>Ns(y.diff)-Ns(b.diff)),{index:g}=v[0];return{index:g,distance:p}}function u(x,p){const v=[x,x+n,x-n];if(!e)return x;if(!p)return c(v);const g=v.filter(y=>IO(y)===p);return g.length?c(g):Zl(v)-n}function h(x,p){const v=t[x]-a.get(),g=u(v,p);return{index:x,distance:g}}function f(x,p){const v=a.get()+x,{index:g,distance:y}=d(v),b=!e&&i(v);if(!p||b)return{index:g,distance:x};const w=t[g]-y,_=x+u(w,0);return{index:g,distance:_}}return{byDistance:f,byIndex:h,shortcut:u}}function d0e(e,t,n,s,a,i,o){function l(h){const f=h.distance,m=h.index!==t.get();i.add(f),f&&(s.duration()?e.start():(e.update(),e.render(1),e.update())),m&&(n.set(t.get()),t.set(h.index),o.emit("select"))}function c(h,f){const m=a.byDistance(h,f);l(m)}function d(h,f){const m=t.clone().set(h),x=a.byIndex(m.get(),f);l(x)}return{distance:c,index:d}}function u0e(e,t,n,s,a,i,o,l){const c={passive:!0,capture:!0};let d=0;function u(m){if(!l)return;function x(p){if(new Date().getTime()-d>10)return;o.emit("slideFocusStart"),e.scrollLeft=0;const y=n.findIndex(b=>b.includes(p));LO(y)&&(a.useDuration(0),s.index(y,0),o.emit("slideFocus"))}i.add(document,"keydown",h,!1),t.forEach((p,v)=>{i.add(p,"focus",g=>{(NS(l)||l(m,g))&&x(v)},c)})}function h(m){m.code==="Tab"&&(d=new Date().getTime())}return{init:u}}function zy(e){let t=e;function n(){return t}function s(c){t=o(c)}function a(c){t+=o(c)}function i(c){t-=o(c)}function o(c){return LO(c)?c:c.get()}return{get:n,set:s,add:a,subtract:i}}function hK(e,t){const n=e.scroll==="x"?o:l,s=t.style;let a=null,i=!1;function o(f){return`translate3d(${f}px,0px,0px)`}function l(f){return`translate3d(0px,${f}px,0px)`}function c(f){if(i)return;const m=Hye(e.direction(f));m!==a&&(s.transform=n(m),a=m)}function d(f){i=!f}function u(){i||(s.transform="",t.getAttribute("style")||t.removeAttribute("style"))}return{clear:u,to:c,toggleActive:d}}function h0e(e,t,n,s,a,i,o,l,c){const u=Z0(a),h=Z0(a).reverse(),f=g().concat(y());function m(E,N){return E.reduce((k,I)=>k-a[I],N)}function x(E,N){return E.reduce((k,I)=>m(k,N)>0?k.concat([I]):k,[])}function p(E){return i.map((N,k)=>({start:N-s[k]+.5+E,end:N+t-.5+E}))}function v(E,N,k){const I=p(N);return E.map(P=>{const O=k?0:-n,A=k?n:0,R=k?"end":"start",L=I[P][R];return{index:P,loopPoint:L,slideLocation:zy(-1),translate:hK(e,c[P]),target:()=>l.get()>L?O:A}})}function g(){const E=o[0],N=x(h,E);return v(N,n,!1)}function y(){const E=t-o[0]-1,N=x(u,E);return v(N,-n,!0)}function b(){return f.every(({index:E})=>{const N=u.filter(k=>k!==E);return m(N,t)<=.1})}function w(){f.forEach(E=>{const{target:N,translate:k,slideLocation:I}=E,P=N();P!==I.get()&&(k.to(P),I.set(P))})}function _(){f.forEach(E=>E.translate.clear())}return{canLoop:b,clear:_,loop:w,loopPoints:f}}function f0e(e,t,n){let s,a=!1;function i(c){if(!n)return;function d(u){for(const h of u)if(h.type==="childList"){c.reInit(),t.emit("slidesChanged");break}}s=new MutationObserver(u=>{a||(NS(n)||n(c,u))&&d(u)}),s.observe(e,{childList:!0})}function o(){s&&s.disconnect(),a=!0}return{init:i,destroy:o}}function m0e(e,t,n,s){const a={};let i=null,o=null,l,c=!1;function d(){l=new IntersectionObserver(x=>{c||(x.forEach(p=>{const v=t.indexOf(p.target);a[v]=p}),i=null,o=null,n.emit("slidesInView"))},{root:e.parentElement,threshold:s}),t.forEach(x=>l.observe(x))}function u(){l&&l.disconnect(),c=!0}function h(x){return J0(a).reduce((p,v)=>{const g=parseInt(v),{isIntersecting:y}=a[g];return(x&&y||!x&&!y)&&p.push(g),p},[])}function f(x=!0){if(x&&i)return i;if(!x&&o)return o;const p=h(x);return x&&(i=p),x||(o=p),p}return{init:d,destroy:u,get:f}}function p0e(e,t,n,s,a,i){const{measureSize:o,startEdge:l,endEdge:c}=e,d=n[0]&&a,u=x(),h=p(),f=n.map(o),m=v();function x(){if(!d)return 0;const y=n[0];return Ns(t[l]-y[l])}function p(){if(!d)return 0;const y=i.getComputedStyle(Zl(s));return parseFloat(y.getPropertyValue(`margin-${c}`))}function v(){return n.map((y,b,w)=>{const _=!b,C=RO(w,b);return _?f[b]+u:C?f[b]+h:w[b+1][l]-y[l]}).map(Ns)}return{slideSizes:f,slideSizesWithGaps:m,startGap:u,endGap:h}}function g0e(e,t,n,s,a,i,o,l,c){const{startEdge:d,endEdge:u,direction:h}=e,f=LO(n);function m(g,y){return Z0(g).filter(b=>b%y===0).map(b=>g.slice(b,b+y))}function x(g){return g.length?Z0(g).reduce((y,b,w)=>{const _=Zl(y)||0,C=_===0,E=b===Cj(g),N=a[d]-i[_][d],k=a[d]-i[b][u],I=!s&&C?h(o):0,P=!s&&E?h(l):0,O=Ns(k-P-(N+I));return w&&O>t+c&&y.push(b),E&&y.push(g.length),y},[]).map((y,b,w)=>{const _=Math.max(w[b-1]||0);return g.slice(_,y)}):[]}function p(g){return f?m(g,n):x(g)}return{groupSlides:p}}function x0e(e,t,n,s,a,i,o){const{align:l,axis:c,direction:d,startIndex:u,loop:h,duration:f,dragFree:m,dragThreshold:x,inViewThreshold:p,slidesToScroll:v,skipSnaps:g,containScroll:y,watchResize:b,watchSlides:w,watchDrag:_,watchFocus:C}=i,E=2,N=Jye(),k=N.measure(t),I=n.map(N.measure),P=Kye(c,d),O=P.measureSize(k),A=Qye(O),R=Gye(l,O),L=!h&&!!y,z=h||!!y,{slideSizes:U,slideSizesWithGaps:$,startGap:q,endGap:ne}=p0e(P,k,I,n,z,a),se=g0e(P,O,v,h,k,I,q,ne,E),{snaps:F,snapsAligned:V}=o0e(P,R,k,I,se),Z=-Zl(F)+Zl($),{snapsContained:de,scrollContainLimit:ve}=n0e(O,Z,V,y,E),pe=L?de:V,{limit:_e}=s0e(Z,pe,h),xe=uK(Cj(pe),u,h),oe=xe.clone(),we=Z0(n),ce=({dragHandler:at,scrollBody:rt,scrollBounds:Gt,options:{loop:gt}})=>{gt||Gt.constrain(at.pointerDown()),rt.seek()},De=({scrollBody:at,translate:rt,location:Gt,offsetLocation:gt,previousLocation:Zt,scrollLooper:dr,slideLooper:Fr,dragHandler:Tt,animation:Br,eventHandler:tr,scrollBounds:or,options:{loop:pn}},xr)=>{const Bt=at.settled(),Zr=!or.shouldConstrain(),sr=pn?Bt:Bt&&Zr,ur=sr&&!Tt.pointerDown();ur&&Br.stop();const Gr=Gt.get()*xr+Zt.get()*(1-xr);gt.set(Gr),pn&&(dr.loop(at.direction()),Fr.loop()),rt.to(gt.get()),ur&&tr.emit("settle"),sr||tr.emit("scroll")},Ue=Yye(s,a,()=>ce(Ie),at=>De(Ie,at)),re=.68,et=pe[xe.get()],kt=zy(et),St=zy(et),Ve=zy(et),he=zy(et),ye=t0e(kt,Ve,St,he,f,re),Ee=c0e(h,pe,Z,_e,he),Fe=d0e(Ue,xe,oe,ye,Ee,he,o),tt=i0e(_e),qe=Q0(),st=m0e(t,n,o,p),{slideRegistry:Ct}=l0e(L,y,pe,ve,se,we),ke=u0e(e,n,Ct,Fe,ye,qe,o,C),Ie={ownerDocument:s,ownerWindow:a,eventHandler:o,containerRect:k,slideRects:I,animation:Ue,axis:P,dragHandler:Xye(P,e,s,a,he,Zye(P,a),kt,Ue,Fe,ye,Ee,xe,o,A,m,x,g,re,_),eventStore:qe,percentOfView:A,index:xe,indexPrevious:oe,limit:_e,location:kt,offsetLocation:Ve,previousLocation:St,options:i,resizeHandler:e0e(t,o,a,n,P,b,N),scrollBody:ye,scrollBounds:r0e(_e,Ve,he,ye,A),scrollLooper:a0e(Z,_e,Ve,[kt,Ve,St,he]),scrollProgress:tt,scrollSnapList:pe.map(tt.get),scrollSnaps:pe,scrollTarget:Ee,scrollTo:Fe,slideLooper:h0e(P,O,Z,U,$,F,pe,Ve,n),slideFocus:ke,slidesHandler:f0e(t,o,w),slidesInView:st,slideIndexes:we,slideRegistry:Ct,slidesToScroll:se,target:he,translate:hK(P,t)};return Ie}function v0e(){let e={},t;function n(d){t=d}function s(d){return e[d]||[]}function a(d){return s(d).forEach(u=>u(t,d)),c}function i(d,u){return e[d]=s(d).concat([u]),c}function o(d,u){return e[d]=s(d).filter(h=>h!==u),c}function l(){e={}}const c={init:n,emit:a,off:o,on:i,clear:l};return c}const y0e={align:"center",axis:"x",container:null,slides:null,containScroll:"trimSnaps",direction:"ltr",slidesToScroll:1,inViewThreshold:0,breakpoints:{},dragFree:!1,dragThreshold:10,loop:!1,skipSnaps:!1,duration:25,startIndex:0,active:!0,watchDrag:!0,watchResize:!0,watchSlides:!0,watchFocus:!0};function b0e(e){function t(i,o){return dK(i,o||{})}function n(i){const o=i.breakpoints||{},l=J0(o).filter(c=>e.matchMedia(c).matches).map(c=>o[c]).reduce((c,d)=>t(c,d),{});return t(i,l)}function s(i){return i.map(o=>J0(o.breakpoints||{})).reduce((o,l)=>o.concat(l),[]).map(e.matchMedia)}return{mergeOptions:t,optionsAtMedia:n,optionsMediaQueries:s}}function j0e(e){let t=[];function n(i,o){return t=o.filter(({options:l})=>e.optionsAtMedia(l).active!==!1),t.forEach(l=>l.init(i,e)),o.reduce((l,c)=>Object.assign(l,{[c.name]:c}),{})}function s(){t=t.filter(i=>i.destroy())}return{init:n,destroy:s}}function o_(e,t,n){const s=e.ownerDocument,a=s.defaultView,i=b0e(a),o=j0e(i),l=Q0(),c=v0e(),{mergeOptions:d,optionsAtMedia:u,optionsMediaQueries:h}=i,{on:f,off:m,emit:x}=c,p=P;let v=!1,g,y=d(y0e,o_.globalOptions),b=d(y),w=[],_,C,E;function N(){const{container:we,slides:ce}=b;C=(AP(we)?e.querySelector(we):we)||e.children[0];const Ue=AP(ce)?C.querySelectorAll(ce):ce;E=[].slice.call(Ue||C.children)}function k(we){const ce=x0e(e,C,E,s,a,we,c);if(we.loop&&!ce.slideLooper.canLoop()){const De=Object.assign({},we,{loop:!1});return k(De)}return ce}function I(we,ce){v||(y=d(y,we),b=u(y),w=ce||w,N(),g=k(b),h([y,...w.map(({options:De})=>
864De)]).forEach(De=>l.add(De,"change",P)),b.active&&(g.translate.to(g.location.get()),g.animation.init(),g.slidesInView.init(),g.slideFocus.init(oe),g.eventHandler.init(oe),g.resizeHandler.init(oe),g.slidesHandler.init(oe),g.options.loop&&g.slideLooper.loop(),C.offsetParent&&E.length&&g.dragHandler.init(oe),_=o.init(oe,w)))}function P(we,ce){const De=se();O(),I(d({startIndex:De},we),ce),c.emit("reInit")}function O(){g.dragHandler.destroy(),g.eventStore.clear(),g.translate.clear(),g.slideLooper.clear(),g.resizeHandler.destroy(),g.slidesHandler.destroy(),g.slidesInView.destroy(),g.animation.destroy(),o.destroy(),l.clear()}function A(){v||(v=!0,l.clear(),O(),c.emit("destroy"),c.clear())}function R(we,ce,De){!b.active||v||(g.scrollBody.useBaseFriction().useDuration(ce===!0?0:b.duration),g.scrollTo.index(we,De||0))}function L(we){const ce=g.index.add(1).get();R(ce,we,-1)}function z(we){const ce=g.index.add(-1).get();R(ce,we,1)}function U(){return g.index.add(1).get()!==se()}function $(){return g.index.add(-1).get()!==se()}function q(){return g.scrollSnapList}function ne(){return g.scrollProgress.get(g.offsetLocation.get())}function se(){return g.index.get()}function F(){return g.indexPrevious.get()}function V(){return g.slidesInView.get()}function Z(){return g.slidesInView.get(!1)}function de(){return _}function ve(){return g}function pe(){return e}function _e(){return C}function xe(){return E}const oe={canScrollNext:U,canScrollPrev:$,containerNode:_e,internalEngine:ve,destroy:A,off:m,on:f,emit:x,plugins:de,previousScrollSnap:F,reInit:p,rootNode:pe,scrollNext:L,scrollPrev:z,scrollProgress:ne,scrollSnapList:q,scrollTo:R,selectedScrollSnap:se,slideNodes:xe,slidesInView:V,slidesNotInView:Z};return I(t,n),setTimeout(()=>c.emit("init"),0),oe}o_.globalOptions=void 0;function MO(e={},t=[]){const n=j.useRef(e),s=j.useRef(t),[a,i]=j.useState(),[o,l]=j.useState(),c=j.useCallback(()=>{a&&a.reInit(n.current,s.current)},[a]);return j.useEffect(()=>{OO(n.current,e)||(n.current=e,c())},[e,c]),j.useEffect(()=>{Vye(s.current,t)||(s.current=t,c())},[t,c]),j.useEffect(()=>{if(qye()&&o){o_.globalOptions=MO.globalOptions;const d=o_(o,n.current,s.current);return i(d),()=>d.destroy()}else i(void 0)},[o,i]),[l,a]}MO.globalOptions=void 0;const fK=j.createContext(null);function _S(){const e=j.useContext(fK);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}const Jh=j.forwardRef(({orientation:e="horizontal",opts:t,setApi:n,plugins:s,className:a,children:i,...o},l)=>{const[c,d]=MO({...t,axis:e==="horizontal"?"x":"y"},s),[u,h]=j.useState(!1),[f,m]=j.useState(!1),x=j.useCallback(y=>{y&&(h(y.canScrollPrev()),m(y.canScrollNext()))},[]),p=j.useCallback(()=>{d==null||d.scrollPrev()},[d]),v=j.useCallback(()=>{d==null||d.scrollNext()},[d]),g=j.useCallback(y=>{y.key==="ArrowLeft"?(y.preventDefault(),p()):y.key==="ArrowRight"&&(y.preventDefault(),v())},[p,v]);return j.useEffect(()=>{!d||!n||n(d)},[d,n]),j.useEffect(()=>{if(d)return x(d),d.on("reInit",x),d.on("select",x),()=>{d==null||d.off("select",x)}},[d,x]),r.jsx(fK.Provider,{value:{carouselRef:c,api:d,opts:t,orientation:e||((t==null?void 0:t.axis)==="y"?"vertical":"horizontal"),scrollPrev:p,scrollNext:v,canScrollPrev:u,canScrollNext:f},children:r.jsx("div",{ref:l,onKeyDownCapture:g,className:Ge("relative",a),role:"region","aria-roledescription":"carousel",...o,children:i})})});Jh.displayName="Carousel";const Qh=j.forwardRef(({className:e,...t},n)=>{const{carouselRef:s,orientation:a}=_S();return r.jsx("div",{ref:s,className:"overflow-hidden",children:r.jsx("div",{ref:n,className:Ge("flex",a==="horizontal"?"-ml-4":"-mt-4 flex-col",e),...t})})});Qh.displayName="CarouselContent";const ef=j.forwardRef(({className:e,...t},n)=>{const{orientation:s}=_S();return r.jsx("div",{ref:n,role:"group","aria-roledescription":"slide",className:Ge("min-w-0 shrink-0 grow-0 basis-full",s==="horizontal"?"pl-4":"pt-4",e),...t})});ef.displayName="CarouselItem";const Jm=j.forwardRef(({className:e,variant:t="outline",size:n="icon",...s},a)=>{const{orientation:i,scrollPrev:o,canScrollPrev:l}=_S();return r.jsxs(W,{ref:a,variant:t,size:n,className:Ge("absolute h-8 w-8 rounded-full",i==="horizontal"?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:o,...s,children:[r.jsx(ej,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Previous slide"})]})});
864Jm.displayName="CarouselPrevious";const Qm=j.forwardRef(({className:e,variant:t="outline",size:n="icon",...s},a)=>{const{orientation:i,scrollNext:o,canScrollNext:l}=_S();return r.jsxs(W,{ref:a,variant:t,size:n,className:Ge("absolute h-8 w-8 rounded-full",i==="horizontal"?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!l,onClick:o,...s,children:[r.jsx(kg,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Next slide"})]})});Qm.displayName="CarouselNext";var w0e="Separator",CD="horizontal",N0e=["horizontal","vertical"],mK=j.forwardRef((e,t)=>{const{decorative:n,orientation:s=CD,...a}=e,i=_0e(s)?s:CD,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return r.jsx(Lt.div,{"data-orientation":i,...l,...a,ref:t})});mK.displayName=w0e;function _0e(e){return N0e.includes(e)}var pK=mK;const sl=j.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...s},a)=>r.jsx(pK,{ref:a,decorative:n,orientation:t,className:Ge("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));sl.displayName=pK.displayName;const S0e=ev("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),_r=j.forwardRef(({className:e,variant:t,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:Ge(S0e({variant:t}),e),...n}));_r.displayName="Alert";const gK=j.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:Ge("mb-1 font-medium leading-none tracking-tight",e),...t}));gK.displayName="AlertTitle";const Sr=j.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ge("text-sm [&_p]:leading-relaxed",e),...t}));Sr.displayName="AlertDescription";function DO({product:e,vendor:t,variant:n="default",className:s=""}){const{user:a}=bt(),[i,o]=j.useState(!1),[l,c]=j.useState(!1),d=t.business_name||t.store_name||"Seller",u=async x=>{c(!0);try{const p=sessionStorage.getItem("naija_session_id")||`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;sessionStorage.setItem("naija_session_id",p);const{error:v}=await H.from("product_inquiries").insert({product_id:e.id,buyer_id:(a==null?void 0:a.id)||null,vendor_id:e.vendor_id,inquiry_type:x,session_id:p,user_agent:navigator.userAgent,referrer:document.referrer||null,metadata:{product_title:e.title,vendor_name:d,timestamp:new Date().toISOString()}});v?console.error("Error tracking inquiry:",v):console.log("â Inquiry tracked successfully")}catch(p){console.error("Error tracking inquiry:",p)}finally{c(!1)}},h=async()=>{if(!t.business_phone){be({title:"Contact Info Missing",description:"WhatsApp number not available for this seller",variant:"destructive"});return}await u("whatsapp");let x=t.business_phone.replace(/\D/g,"");!x.startsWith("234")&&x.startsWith("0")?x="234"+x.substring(1):x.startsWith("234")||(x="234"+x);const p=encodeURIComponent(`Hi ${d}! I'm interested in your product "${e.title}" on Naija.com. Is it still available?`),v=`https://wa.me/${x}?text=${p}`;window.open(v,"_blank"),be({title:"Opening WhatsApp...",description:"Redirecting you to WhatsApp"}),o(!1)},f=async()=>{if(!t.business_phone){be({title:"Contact Info Missing",description:"Phone number not available for this seller",variant:"destructive"});return}await u("phone"),window.location.href=`tel:${t.business_phone}`,be({title:"Calling seller...",description:"Your phone app should open shortly"}),o(!1)},m=async()=>{if(!t.business_email){be({title:"Contact Info Missing",description:"Email not available for this seller",variant:"destructive"});return}await u("email");const x=encodeURIComponent(`Inquiry about: ${e.title}`),p=encodeURIComponent(`Hi ${d}, 865 866I'm interested in your product "${e.title}" on Naija.com. 867 868Could you please provide more information? 869 870Thank you!`);window.location.href=`mailto:${t.business_email}?subject=${x}&body=${p}`,be({title:"Opening email...",description:"Your email app should open shortly"}),o(!1)};return n==="compact"?r.jsxs(W,{size:"sm",className:"bg-green-600 hover:bg-green-700",onClick:h,disabled:l||!t.business_phone,children:[r.jsx(dl,{className:"h-4 w-4 mr-2"}),"WhatsApp Seller"]}):n==="modal"?r.jsxs(r.Fragment,{children:[r.jsxs(W,{onClick:()=>o(!0),className:s,disabled:l,children:[r.jsx(an,{className:"h-4 w-4 mr-2"}),"Contact Seller"]}),r.jsx(Rt,{open:i,onOpenChange:o,children:r.jsxs(Ot,{children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{children:["Contact ",d]}),r.jsxs(on,{children:[`Choose how you'd like to contact the seller about "`,e.title,'"']})]}),r.jsxs("div",{className:"space-y-3 py-4",children:[t.business_phone&&r.jsxs(r.Fragment,{children:[r.jsxs(W,{className:"w-full justify-start h-auto py-4 bg-green-600 hover:bg-green-700",onClick:h,disabled:l,children:[r.jsx(dl,{className:"mr-3 h-6 w-6"}),r.jsxs("div",{className:"text-left flex-1",children:[r.jsx("div",{className:"font-semibold",children:"WhatsApp"}),r.jsx("div",{className:"text-xs opacity-90",children:"Instant messaging - Recommended"})]}),r.jsx(ds,{className:"h-4 w-4 opacity-50"})]}),r.jsxs(W,{variant:"outline",className:"w-full justify-start h-auto py-4",onClick:f,disabled:l,children:[r.jsx(an,{className:"mr-3 h-6 w-6"}),r.jsxs("div",{className:"text-left flex-1",children:[r.jsx("div",{className:"font-semibold",children:"Phone Call"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:t.business_phone})]}),r.jsx(ds,{className:"h-4 w-4 opacity-50"})]})]}),t.business_email&&r.jsxs(W,{variant:"outline",className:"w-full justify-start h-auto py-4",onClick:m,disabled:l,children:[r.jsx(Dn,{className:"mr-3 h-6 w-6"}),r.jsxs("div",{className:"text-left flex-1",children:[r.jsx("div",{className:"font-semibold",children:"Email"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:t.business_email})]}),r.jsx(ds,{className:"h-4 w-4 opacity-50"})]}),!t.business_phone&&!t.business_email&&r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsx(Sr,{children:"Contact information not available for this seller. Please try again later."})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground text-center pb-2",children:[r.jsx(er,{className:"h-3 w-3 inline mr-1"}),"Safe contact - Your information is never shared with third parties"]})]})})]}):r.jsxs("div",{className:`space-y-2 ${s}`,children:[r.jsx("div",{className:"flex gap-2",children:t.business_phone&&r.jsxs(r.Fragment,{children:[r.jsxs(W,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:h,disabled:l,children:[r.jsx(dl,{className:"mr-2 h-4 w-4"}),"WhatsApp"]}),r.jsxs(W,{variant:"outline",className:"flex-1",onClick:f,disabled:l,children:[r.jsx(an,{className:"mr-2 h-4 w-4"}),"Call"]})]})}),t.business_email&&r.jsxs(W,{variant:"ghost",className:"w-full",onClick:m,disabled:l,children:[r.jsx(Dn,{className:"mr-2 h-4 w-4"}),"Send Email"]}),!t.business_phone&&!t.business_email&&r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsx(Sr,{className:"text-xs",children:"Contact information not available"})]}),l&&r.jsx("div",{className:"text-xs text-center text-muted-foreground",children:"Connecting..."})]})}const xK=({moduleType:e,entityId:t})=>{const[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState(0);j.useEffect(()=>{c()},[e,t]);const c=async()=>{try{const{data:h,error:f}=await H.from("universal_reviews").select("*").eq("module_type",e).eq("entity_id",t).eq("is_approved",!0).order("created_at",{ascending:!1});if(f)throw f;const m=[...new Set(h==null?void 0:h.map(g=>
870g.reviewer_id).filter(Boolean))],{data:x}=await H.from("profiles").select("id, full_name").in("id",m),p=new Map((x==null?void 0:x.map(g=>[g.id,g.full_name]))||[]),v=(h||[]).map(g=>({...g,reviewer_name:g.reviewer_id?p.get(g.reviewer_id):void 0}));if(s(v),h&&h.length>0){const g=h.reduce((y,b)=>y+(b.rating||0),0)/h.length;l(g)}}catch{be({title:"Error",description:"Failed to fetch reviews",variant:"destructive"})}finally{i(!1)}},d=h=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(f=>r.jsx(mr,{className:`h-4 w-4 ${f<=h?"fill-yellow-400 text-yellow-400":"text-gray-300"}`},f))}),u=h=>new Date(h).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"});return a?r.jsx("div",{className:"space-y-4",children:[1,2,3].map(h=>r.jsx(Y,{className:"animate-pulse",children:r.jsx(X,{className:"p-4",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})},h))}):n.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No reviews yet. Be the first to review!"})})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-4xl font-bold",children:o.toFixed(1)}),d(Math.round(o))]}),r.jsx("div",{className:"flex-1",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Based on ",n.length," ",n.length===1?"review":"reviews"]})})]})})}),r.jsx("div",{className:"space-y-4",children:n.map(h=>{var f;return r.jsx(Y,{children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(wO,{children:r.jsx(NO,{children:((f=h.reviewer_name)==null?void 0:f.charAt(0).toUpperCase())||"U"})}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:h.reviewer_name||"Anonymous"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:u(h.created_at)})]}),r.jsxs("div",{className:"flex gap-2",children:[h.is_verified_customer&&r.jsx(te,{variant:"secondary",children:"Verified Customer"}),h.is_verified_guest&&r.jsxs(te,{variant:"secondary",className:"bg-green-100",children:[r.jsx(er,{className:"h-3 w-3 mr-1"}),"Verified Guest"]})]})]}),d(h.rating||0),h.title&&r.jsx("h4",{className:"font-semibold",children:h.title}),h.comment&&r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:h.comment}),h.helpful_count>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[h.helpful_count," ",h.helpful_count===1?"person":"people"," found this helpful"]})]})]})})},h.id)})})]})},ir=j.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:Ge("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
870ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ir.displayName="Textarea";const vK=({moduleType:e,entityId:t,entityTitle:n,isVerifiedBooking:s=!1,onSuccess:a})=>{const{user:i}=bt(),[o,l]=j.useState(0),[c,d]=j.useState(0),[u,h]=j.useState(""),[f,m]=j.useState(""),[x,p]=j.useState(!1),v=async g=>{if(g.preventDefault(),!i){be({title:"Authentication Required",description:"Please sign in to leave a review",variant:"destructive"});return}if(o===0){be({title:"Rating Required",description:"Please select a rating",variant:"destructive"});return}p(!0);try{const{error:y}=await H.from("universal_reviews").insert({module_type:e,entity_id:t,reviewer_id:i.id,rating:o,title:u.trim()||null,comment:f.trim()||null,is_approved:!1});if(y)throw y;be({title:"Review Submitted",description:"Your review will be published after moderation"}),l(0),h(""),m(""),a&&a()}catch(y){be({title:"Error",description:y.message||"Failed to submit review",variant:"destructive"})}finally{p(!1)}};return r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Write a Review"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Share your experience with ",n]})]}),r.jsxs(X,{children:[s&&r.jsxs("div",{className:"mb-4 p-3 bg-green-50 border border-green-200 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 text-green-800",children:[r.jsx(mr,{className:"h-5 w-5 fill-green-600"}),r.jsx("span",{className:"font-medium",children:"You're a verified guest!"})]}),r.jsx("p",{className:"text-sm text-green-700 mt-1",children:"Your review will be marked as from a verified stay."})]}),r.jsxs("form",{onSubmit:v,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(le,{children:"Rating"}),r.jsx("div",{className:"flex gap-1 mt-2",children:[1,2,3,4,5].map(g=>r.jsx("button",{type:"button",onClick:()=>l(g),onMouseEnter:()=>d(g),onMouseLeave:()=>d(0),className:"focus:outline-none",children:r.jsx(mr,{className:`h-8 w-8 transition-colors ${(c||o)>=g?"fill-yellow-400 text-yellow-400":"text-gray-300"}`})},g))})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"title",children:"Title (Optional)"}),r.jsx(ge,{id:"title",placeholder:"Sum up your experience",value:u,onChange:g=>h(g.target.value),maxLength:100})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"comment",children:"Review (Optional)"}),r.jsx(ir,{id:"comment",placeholder:"Tell others about your experience...",value:f,onChange:g=>m(g.target.value),rows:4,maxLength:1e3}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[f.length,"/1000 characters"]})]}),r.jsx(W,{type:"submit",disabled:x||o===0,className:"w-full",children:x?"Submitting...":"Submit Review"})]})]})]})};function yK({productId:e,productTitle:t,currentlyFeatured:n=!1,featureEndsAt:s=null,variant:a="default",size:i="default",className:o="",showModal:l=!0,onFeatureStatusChange:c}){const{user:d}=bt(),[u,h]=j.useState(!1),[f,m]=j.useState(!0),[x,p]=j.useState(!1),[v,g]=j.useState(n),[y,b]=j.useState(s),[w,_]=j.useState(!1),[C,E]=j.useState(0),N=2e3,k=7;j.useEffect(()=>{d&&(I(),P())},[d,e]);const I=async()=>{m(!0);try{const{data:U,error:$}=await H.from("product_features").select("status, end_date").eq("product_id",e).eq("status","active").gt("end_date",new Date().toISOString()).maybeSingle();if($&&$.code!=="PGRST116")throw $;g(!!U),U&&b(U.end_date)}catch(U){console.error("Error checking feature status:",U)}finally{m(!1)}},P=async()=>{if(d)try{const{data:U,error:$}=await H.from("vendor_subscriptions").select("featured_credits_remaining").eq("user_id",d.id).eq("status","active").single();if(!$&&U){const q=U.featured_credits_remaining||0;E(q),_(q>0)}}catch(U){console.error("Error checking credits:",U)}},O=()=>{if(!d){be({title:"Authentication Required",description:"Please log in to feature your product",variant:"destructive"});return}if(v){be({title:"Already Featured",description:`This product is featured until ${L(y||"")}`});return}l?p(!0):A()},A=async()=>
870{if(d){h(!0);try{if(w&&C>0){await R();return}const{data:{session:U}}=await H.auth.getSession();if(!U)throw new Error("No active session");const $={productId:e,amount:N,paymentType:"feature",duration:k};console.log("ð Sending payload:",$);const q=await fetch("https://ohnpqjnepckejxauztja.supabase.co/functions/v1/initialize-product-payment",{method:"POST",headers:{Authorization:`Bearer ${U.access_token}`,"Content-Type":"application/json"},body:JSON.stringify($)}),ne=await q.json();if(console.log("ð³ Response:",ne),!q.ok||ne.error)throw new Error(ne.error||"Payment failed");ne.authorization_url&&(window.location.href=ne.authorization_url)}catch(U){console.error("â Error:",U),be({title:"Payment Failed",description:U.message,variant:"destructive"})}finally{h(!1)}}},R=async()=>{try{const U=new Date;U.setDate(U.getDate()+k);const{error:$}=await H.from("product_features").insert({product_id:e,vendor_id:d.id,status:"active",payment_status:"completed",start_date:new Date().toISOString(),end_date:U.toISOString(),amount:0});if($)throw $;const{error:q}=await H.from("products").update({is_featured:!0}).eq("id",e);if(q)throw q;const{data:ne}=await H.from("vendor_subscriptions").select("featured_credits_remaining").eq("user_id",d.id).eq("status","active").single();ne&&ne.featured_credits_remaining>0&&await H.from("vendor_subscriptions").update({featured_credits_remaining:ne.featured_credits_remaining-1}).eq("user_id",d.id).eq("status","active"),be({title:"Product Featured! â¨",description:`Your product is now featured for ${k} days using 1 subscription credit`}),g(!0),p(!1),await P(),c==null||c()}catch(U){console.error("Error using credit:",U),be({title:"Error",description:U.message||"Failed to feature product",variant:"destructive"})}},L=U=>U?new Date(U).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):"",z=()=>{if(!y)return 0;const U=new Date(y),$=new Date,q=U.getTime()-$.getTime();return Math.max(0,Math.ceil(q/(1e3*60*60*24)))};return v?r.jsxs(te,{className:"gap-1 bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(mr,{className:"h-3 w-3"}),"Featured (",z(),"d left)"]}):f?r.jsx(W,{variant:a,size:i,className:o,disabled:!0,children:r.jsx(yt,{className:"h-4 w-4 animate-spin"})}):r.jsxs(r.Fragment,{children:[r.jsx(W,{variant:a,size:i,className:o,onClick:O,disabled:u||f,children:u?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(lr,{className:"mr-2 h-4 w-4"}),"Feature This Product"]})}),r.jsx(Rt,{open:x,onOpenChange:p,children:r.jsxs(Ot,{children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{className:"flex items-center gap-2",children:[r.jsx(Va,{className:"h-5 w-5 text-yellow-500"}),"Feature Your Product"]}),r.jsx(on,{children:"Boost your product visibility and get more inquiries"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs(_r,{children:[r.jsx(lr,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("p",{className:"font-semibold mb-1",children:t}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be featured for ",k," days"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"font-semibold text-sm",children:"What you get:"}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mr,{className:"h-4 w-4 text-yellow-500"}),r.jsx("span",{children:"Featured badge on your product"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cr,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{children:"Top placement in search results"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{children:"Homepage carousel visibility"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($r,{className:"h-4 w-4 text-orange-500"}),r.jsxs("span",{children:[k," days of featured placement"]})]})]})]}),w&&C>0&&r.jsxs(_r,{className:"border-green-500 bg-green-50",children:[r.jsx(er,{className:"h-4 w-4 text-green-600"}),r.jsxs(Sr,{children:[r.jsx("p",{className:"font-semibold text-green-800",children:"Use Subscription Credit"}),r.jsxs("p",{className:"text-xs text-green-700",children:["You have ",C," featured credit",C>1?"s":""," remaining. This will use 1 credit (no payment required)."]})]})]}),(!w||C===0)&&r.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[r.jsxs("div",{className:"flex justify-between items-center mb-2",children:[r.jsxs("span",{className:"text-sm",children:["Featured Listing (",k," days)"]}),r.jsxs("span",{className:"font-semibold",children:["â¦",N.toLocaleStr
870ing()]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"One-time payment ⢠Secure payment via Paystack"})]}),r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsxs(Sr,{className:"text-xs",children:[r.jsx("strong",{children:"Pro tip:"})," Featured products get 3-5x more views on average. Best time to feature: New product launches or price reductions."]})]})]}),r.jsxs(Yh,{className:"gap-2",children:[r.jsx(W,{variant:"outline",onClick:()=>p(!1),disabled:u,children:"Cancel"}),r.jsx(W,{onClick:A,disabled:u,className:"bg-gradient-to-r from-yellow-500 to-orange-500",children:u?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):w&&C>0?r.jsxs(r.Fragment,{children:[r.jsx(Va,{className:"mr-2 h-4 w-4"}),"Use Credit & Feature"]}):r.jsxs(r.Fragment,{children:[r.jsx(ec,{className:"mr-2 h-4 w-4"}),"Pay â¦",N.toLocaleString()," & Feature"]})})]})]})})]})}function bK({open:e,onOpenChange:t,product:n,vendorName:s}){const{user:a}=bt(),[i,o]=j.useState(null),[l,c]=j.useState(null),d=(a==null?void 0:a.id)===(n==null?void 0:n.vendor_id);j.useEffect(()=>{n!=null&&n.vendor_id&&(u(),h())},[n==null?void 0:n.vendor_id,n==null?void 0:n.id]);const u=async()=>{const{data:p}=await H.from("public_vendor_profiles").select("*").eq("user_id",n.vendor_id).single();p&&o(p)},h=async()=>{const{data:p}=await H.rpc("get_product_inquiry_stats",{p_product_id:n.id});p&&p.length>0&&c(p[0])};if(!n)return null;const f=n.compare_at_price&&n.compare_at_price>n.price,m=f?Math.round((n.compare_at_price-n.price)/n.compare_at_price*100):0,x=Math.floor((Date.now()-new Date(n.created_at).getTime())/(1e3*60*60*24));return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-5xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs(Dt,{className:"flex items-center gap-2",children:[n.title,n.is_featured&&r.jsxs(te,{className:"gap-1 bg-yellow-600",children:[r.jsx(lr,{className:"h-3 w-3"}),"Featured"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[r.jsxs("div",{children:[n.images&&n.images.length>0?r.jsxs(Jh,{className:"w-full",children:[r.jsx(Qh,{children:n.images.map((p,v)=>r.jsx(ef,{children:r.jsx("div",{className:"relative aspect-square rounded-lg overflow-hidden",children:r.jsx("img",{src:p,alt:`${n.title} ${v+1}`,className:"w-full h-full object-cover"})})},v))}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(Jm,{}),r.jsx(Qm,{})]})]}):r.jsx("div",{className:"aspect-square rounded-lg bg-gradient-to-br from-primary/10 to-accent/10 flex items-center justify-center",children:r.jsx(Xl,{className:"h-24 w-24 text-muted-foreground"})}),n.images&&n.images.length>1&&r.jsx("div",{className:"grid grid-cols-4 gap-2 mt-4",children:n.images.slice(0,4).map((p,v)=>r.jsx("div",{className:"relative aspect-square rounded overflow-hidden cursor-pointer hover:opacity-80 transition-opacity",children:r.jsx("img",{src:p,alt:`Thumb ${v+1}`,className:"w-full h-full object-cover"})},v))}),l&&l.total_inquiries>0&&r.jsx("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg",children:r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cr,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"font-medium",children:[l.total_inquiries," inquiries"]})]}),r.jsxs("div",{className:"text-muted-foreground",children:[l.unique_buyers," interested buyers"]})]})})]}),r.jsxs("div",{className:"space-y-6",children:[(s||(i==null?void 0:i.business_name))&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Sold by ",r.jsx("span",{className:"font-semibold text-foreground",children:s||(i==null?void 0:i.business_name)||(i==null?void 0:i.store_name)}),(i==null?void 0:i.is_verified)&&r.jsxs(te,{variant:"secondary",className:"ml-2",children:[r.jsx(fn,{className:"h-3 w-3 mr-1"}),"Verified"]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-baseline gap-3 mb-2",children:[r.jsxs("span",{className:"text-4xl font-bold",children:["â¦",n.price.toLocaleString()]}),f&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-xl text-muted-foreground line-through",children:["â¦",n.compare_at_price.toLocaleStr
870ing()]}),r.jsxs(te,{className:"bg-destructive",children:["Save ",m,"%"]})]})]}),n.stock>0?r.jsxs(te,{variant:"default",className:"gap-1",children:[r.jsx(Xl,{className:"h-3 w-3"}),n.stock," in stock"]}):r.jsx(te,{variant:"destructive",children:"Out of stock"})]}),r.jsx(sl,{}),n.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Description"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:n.description})]}),r.jsxs("div",{className:"space-y-3",children:[n.category&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Category:"}),r.jsx(te,{variant:"outline",children:n.category})]}),n.location&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Ships from ",n.location]})]}),n.is_digital&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Xl,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:"Digital product - instant download"})]}),!n.is_digital&&n.weight&&r.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:r.jsxs("span",{children:["Weight: ",n.weight,"kg"]})}),n.delivery_options&&n.delivery_options.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium mb-1",children:[r.jsx(BN,{className:"h-4 w-4"}),r.jsx("span",{children:"Delivery Options:"})]}),r.jsx("div",{className:"flex flex-wrap gap-2 ml-6",children:n.delivery_options.map(p=>r.jsx(te,{variant:"secondary",className:"text-xs",children:p},p))})]}),x<=7&&r.jsxs(te,{variant:"secondary",className:"gap-1",children:[r.jsx(Xt,{className:"h-3 w-3"}),"New listing (",x," days ago)"]})]}),n.tags&&n.tags.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2 text-sm",children:"Tags"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.tags.map(p=>r.jsx(te,{variant:"outline",className:"text-xs",children:p},p))})]}),r.jsx(sl,{}),i&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"Contact Seller"}),r.jsx(DO,{product:{id:n.id,title:n.title,vendor_id:n.vendor_id},vendor:i,variant:"default"}),d&&!n.is_featured&&r.jsxs("div",{className:"mt-4 p-4 bg-orange-50 dark:bg-orange-950/20 border border-orange-200 dark:border-orange-800 rounded-lg",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsx(Va,{className:"h-5 w-5 text-orange-600 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h4",{className:"font-semibold text-sm mb-1",children:"Boost Your Sales"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Featured products get 10x more views and appear at the top of search results"})]})]}),r.jsx(yK,{productId:n.id,productTitle:n.title,currentlyFeatured:!1,variant:"default",size:"default",className:"w-full bg-orange-600 hover:bg-orange-700"})]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4 pt-4 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(fn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs",children:"Secure Contact"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(BN,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs",children:"Direct Shipping"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(fn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs",children:"Buyer Info Protected"})]})]})]})]}),r.jsxs(Kr,{defaultValue:"reviews",className:"mt-6",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-2",children:[r.jsx(Re,{value:"reviews",children:"Reviews"}),r.jsx(Re,{value:"write-review",children:"Write a Review"})]}),r.jsx(Be,{value:"reviews",className:"space-y-4 mt-4",children:r.jsx(xK,{moduleType:"product",entityId:n.id})}),r.jsx(Be,{value:"write-review",className:"mt-4",children:r.jsx(vK,{moduleType:"product",entityId:n.id,entityTitle:n.title,onSuccess:()=>{}})})]})]})})}function k0e({maxProducts:e=10,showTitle:t=!0,autoPlay:n=!0,className:s=""}){const[a,i]=j.useState([]),[o,l]=j.useState({}),[c,d]=j.useState(!0),[u,h]=j.useState(null);j.useEffect(()=>{f()},[e]);const f=async()=>{d(!0);try{const{data:g,error:y}=await H.from("product_features").select("product_id").eq("status","active").gt("end_date",new Date().toISOString()).limit(e);
870if(y)throw y;if(!g||g.length===0){i([]);return}const b=g.map(C=>C.product_id),{data:w,error:_}=await H.from("products").select("*").in("id",b).eq("status","active");if(_)throw _;if(i(w||[]),w&&w.length>0){const C=[...new Set(w.map(k=>k.vendor_id))],{data:E}=await H.from("public_vendor_profiles").select("user_id, store_name").in("user_id",C),N={};E==null||E.forEach(k=>{N[k.user_id]={business_name:k.store_name,store_name:k.store_name}}),l(N)}}catch(g){console.error("Error fetching featured products:",g),be({title:"Error",description:"Failed to load featured products",variant:"destructive"})}finally{d(!1)}},m=g=>{const y=o[g];return(y==null?void 0:y.business_name)||(y==null?void 0:y.store_name)||"Vendor"},x=g=>g.compare_at_price&&g.compare_at_price>g.price,p=g=>x(g)?Math.round((g.compare_at_price-g.price)/g.compare_at_price*100):0,v=g=>g.images&&g.images.length>0?g.images[0]:null;return c?r.jsxs("div",{className:`space-y-4 ${s}`,children:[t&&r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("h2",{className:"text-2xl md:text-3xl font-bold flex items-center gap-2",children:[r.jsx(mr,{className:"h-6 w-6 text-yellow-500"}),"Featured Products"]})}),r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})})]}):a.length===0?null:r.jsxs("div",{className:`space-y-4 ${s}`,children:[t&&r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("h2",{className:"text-2xl md:text-3xl font-bold flex items-center gap-2",children:[r.jsx(mr,{className:"h-6 w-6 text-yellow-500"}),"Featured Products"]}),r.jsx(W,{variant:"ghost",size:"sm",onClick:()=>window.location.href="/buy-sell",children:"View All"})]}),r.jsxs(Jh,{opts:{align:"start",loop:!0},className:"w-full",children:[r.jsx(Qh,{className:"-ml-2 md:-ml-4",children:a.map(g=>r.jsx(ef,{className:"pl-2 md:pl-4 basis-full sm:basis-1/2 lg:basis-1/3 xl:basis-1/4",children:r.jsxs(Y,{className:"overflow-hidden hover:shadow-lg transition-all duration-300 cursor-pointer group",onClick:()=>h(g),children:[r.jsxs("div",{className:"relative aspect-square overflow-hidden",children:[v(g)?r.jsx("img",{src:vl(v(g)),alt:g.title,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full bg-gradient-to-br from-primary/10 to-accent/10 flex items-center justify-center",children:r.jsx(Xl,{className:"h-16 w-16 text-muted-foreground"})}),r.jsxs("div",{className:"absolute top-2 left-2 flex flex-col gap-2",children:[r.jsxs(te,{className:"gap-1 bg-yellow-600 shadow-lg",children:[r.jsx(lr,{className:"h-3 w-3"}),"Featured"]}),x(g)&&r.jsxs(te,{className:"bg-destructive shadow-lg",children:["Save ",p(g),"%"]})]}),g.stock===0&&r.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:r.jsx(te,{variant:"destructive",className:"text-lg py-2 px-4",children:"Out of Stock"})})]}),r.jsxs(X,{className:"p-4 space-y-2",children:[r.jsxs("p",{className:"text-xs text-muted-foreground",children:["by ",m(g.vendor_id)]}),r.jsx("h3",{className:"font-semibold text-sm line-clamp-2 group-hover:text-primary transition-colors min-h-[2.5rem]",children:g.title}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-xl font-bold",children:["â¦",g.price.toLocaleString()]}),x(g)&&r.jsxs("span",{className:"text-xs text-muted-foreground line-through",children:["â¦",g.compare_at_price.toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground pt-2 border-t",children:[g.location&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:g.location})]}),g.view_count&&g.view_count>0&&r.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[r.jsx(Cr,{className:"h-3 w-3"}),r.jsx("span",{children:g.view_count})]})]}),r.jsxs(W,{size:"sm",className:"w-full mt-2",onClick:y=>{y.stopPropagation(),h(g)},children:[r.jsx(Kq,{className:"h-4 w-4 mr-2"}),"View Details"]}
870)]})]})},g.id))}),r.jsx(Jm,{className:"hidden md:flex"}),r.jsx(Qm,{className:"hidden md:flex"})]}),r.jsx("div",{className:"text-center pt-4",children:r.jsx(W,{variant:"outline",onClick:()=>window.location.href="/buy-sell",children:"Browse All Featured Products"})}),u&&r.jsx(bK,{open:!!u,onOpenChange:g=>!g&&h(null),product:u,vendorName:m(u.vendor_id)})]})}const jK="ca-pub-6269405272459506",C0e="6294778706",A0e="3264301007",P0e="6927484890",E0e="2410384330",T0e="7496179730",O0e={leaderboard:C0e,rectangle:A0e,skyscraper:P0e,mobile:E0e,infeed:T0e},wK={"homepage-leaderboard":"leaderboard","news-top-leaderboard":"leaderboard","news-leaderboard":"leaderboard","news-post-article":"leaderboard","events-top-leaderboard":"leaderboard","events-banner":"leaderboard","lodging-top-leaderboard":"leaderboard","lodging-banner":"leaderboard","restaurants-top-leaderboard":"leaderboard","artisans-top-leaderboard":"leaderboard","classifieds-top-leaderboard":"leaderboard","marketplace-leaderboard":"leaderboard","diaspora-leaderboard":"leaderboard","diaspora-footer-leaderboard":"leaderboard","footer-leaderboard":"leaderboard","homepage-hero":"leaderboard","sidebar-square":"rectangle","news-sidebar":"rectangle","news-in-feed":"infeed","homepage-sidebar-top":"rectangle","marketplace-in-grid":"rectangle","post-match-billboard":"rectangle","mobile-in-feed":"rectangle","homepage-sidebar-bottom":"skyscraper","sidebar-skyscraper":"skyscraper","homepage-mobile":"mobile","mobile-banner-top":"mobile"},L0e=new Set(["email-newsletter","newsletter-banner","newsletter-sponsor-read","modal-interstitial","token-modal-banner"]),I0e=["/auth","/admin","/payments","/checkout","/donate","/dashboard","/go"],R0e=e=>!I0e.some(t=>e===t||e.startsWith(`${t}/`)),$O=(e,t=typeof window<"u"?window.location.pathname:"/")=>{if(L0e.has(e)||!R0e(t))return;const n=wK[e]??"leaderboard";return O0e[n]},M0e=e=>{const t=wK[e]??"leaderboard";return t==="leaderboard"||t==="mobile"?"horizontal":t==="skyscraper"?"vertical":t==="infeed"?"fluid":"rectangle"};let u1=null;const D0e=()=>u1||(u1=new Promise((e,t)=>{if(document.querySelector("script[data-adsense-loader]")){e();return}const s=document.createElement("script");s.async=!0,s.crossOrigin="anonymous",s.dataset.adsenseLoader="true",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${jK}`,s.onload=()=>e(),s.onerror=()=>t(new Error("AdSense script failed to load")),document.head.appendChild(s)}),u1),NK=({slot:e,format:t="auto",width:n,height:s,className:a,responsive:i=!0})=>{const o=jK,l=j.useRef(null),c=j.useRef(!1),[d,u]=j.useState(!1);return j.useEffect(()=>{if(!l.current||d)return;const h=new IntersectionObserver(([f])=>{f.isIntersecting&&(u(!0),h.disconnect())},{rootMargin:"200px"});return h.observe(l.current),()=>h.disconnect()},[d]),j.useEffect(()=>{!d||!o||!e||c.current||(c.current=!0,D0e().then(()=>{(window.adsbygoogle=window.adsbygoogle||[]).push({})}).catch(h=>console.warn("AdSense unavailable",h)))},[d,o,e]),e?r.jsx("div",{ref:l,className:Ge("overflow-hidden",a),style:{width:n||"100%",height:s||"auto",maxWidth:"100%"},children:d&&r.jsx("ins",{className:"adsbygoogle",style:{display:"block",width:"100%",height:s||"auto"},"data-ad-client":o,"data-ad-slot":e,"data-ad-format":t,"data-full-width-responsive":i?"true":"false"})}):null},zo=({placementSlug:e,className:t,fallbackContent:n})=>{const[s,a]=j.useState(null),[i,o]=j.useState(null),[l,c]=j.useState(!0);j.useEffect(()=>{d()},[e]);const d=async()=>{try{const{data:f}=await H.from("ad_placements").select("*").eq("slug",e).eq("is_active",!0).maybeSingle();if(!f){c(!1);return}o(f);const m=new Date().toISOString().split("T")[0],{data:x}=await H.from("advertisements").select("*").eq("placement_id",f.id).eq("status","active").eq("payment_status","paid").lte("start_date",m).gte("end_date",m).order("display_order",{ascending:!0}).order("created_at",{ascending:!1}).limit(1).maybeSingle();x&&(a(x),u(x.id))}catch(f){console.error("Error fetching ad:",f)}finally{c(!1)}},u=async f=>{try{await H.rpc("increment_ad_impressions",{ad_id:f}),await H.from("advertisement_analytics").insert({advertisement_id:f,event_type:"impression",page_url:window.location.href,referrer:document.referrer||null})}catch(m){console.error("Error tracking impression:",m)}
870},h=async()=>{if(s)try{await H.rpc("increment_ad_clicks",{ad_id:s.id}),await H.from("advertisement_analytics").insert({advertisement_id:s.id,event_type:"click",page_url:window.location.href}),s.target_url&&window.open(s.target_url,"_blank","noopener,noreferrer")}catch(f){console.error("Error tracking click:",f)}};if(l)return r.jsx("div",{className:Ge("bg-muted/30 animate-pulse rounded-lg",t),style:{width:(i==null?void 0:i.width)||"100%",height:(i==null?void 0:i.height)||90,maxWidth:"100%"}});if(!s){if(n)return r.jsx(r.Fragment,{children:n});const f=$O(e);return f?r.jsx("div",{className:Ge("flex items-center justify-center",t),style:{width:(i==null?void 0:i.width)||"100%",height:(i==null?void 0:i.height)||90,maxWidth:"100%"},children:r.jsx(NK,{slot:f,format:M0e(e),height:(i==null?void 0:i.height)||90,className:"w-full h-full"})}):r.jsx("a",{href:"/advertise",className:Ge("block bg-gradient-to-r from-muted/50 to-muted/30 border border-dashed border-border rounded-lg flex items-center justify-center hover:border-primary/50 transition-colors group",t),style:{width:(i==null?void 0:i.width)||"100%",height:(i==null?void 0:i.height)||90,maxWidth:"100%"},children:r.jsxs("div",{className:"text-center p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground group-hover:text-primary transition-colors",children:"ð¢ Advertise Here"}),r.jsx("p",{className:"text-xs text-muted-foreground/70",children:(i==null?void 0:i.size_label)||"Premium Placement"})]})})}return r.jsxs("div",{className:Ge("relative rounded-lg overflow-hidden cursor-pointer group",t),style:{width:(i==null?void 0:i.width)||"100%",height:(i==null?void 0:i.height)||90,maxWidth:"100%"},onClick:h,children:[s.banner_image_url?r.jsx("img",{src:vl(s.banner_image_url),alt:s.title,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full bg-gradient-to-r from-primary/20 to-secondary/20 flex items-center justify-center",children:r.jsxs("div",{className:"text-center p-4",children:[r.jsx("p",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:s.business_name})]})}),r.jsx("div",{className:"absolute top-1 right-1 bg-black/50 text-white text-[10px] px-1.5 py-0.5 rounded",children:"Ad"})]})},Hc=({className:e,variant:t="card"})=>{const[n,s]=j.useState(null),[a,i]=j.useState(!0);j.useEffect(()=>{o()},[]);const o=async()=>{try{const{data:d}=await H.from("ad_placements").select("id").eq("slug","news-in-feed").eq("is_active",!0).single();if(!d){i(!1);return}const u=new Date().toISOString().split("T")[0],{data:h}=await H.from("advertisements").select("*").eq("placement_id",d.id).eq("status","active").eq("payment_status","paid").lte("start_date",u).gte("end_date",u).order("display_order",{ascending:!0}).limit(1).single();h&&(s(h),l(h.id))}catch(d){console.error("Error fetching in-feed ad:",d)}finally{i(!1)}},l=async d=>{try{await H.rpc("increment_ad_impressions",{ad_id:d}),await H.from("advertisement_analytics").insert({advertisement_id:d,event_type:"impression",page_url:window.location.href})}catch(u){console.error("Error tracking impression:",u)}},c=async()=>{if(n)try{await H.rpc("increment_ad_clicks",{ad_id:n.id}),await H.from("advertisement_analytics").insert({advertisement_id:n.id,event_type:"click",page_url:window.location.href}),n.target_url&&window.open(n.target_url,"_blank","noopener,noreferrer")}catch(d){console.error("Error tracking click:",d)}};if(a)return r.jsx(Y,{className:Ge("animate-pulse",e),children:r.jsx(X,{className:"p-4",children:r.jsx("div",{className:"h-[200px] bg-muted rounded-lg"})})});if(!n){const d=$O("news-in-feed");return d?r.jsx("div",{className:Ge("w-full",e),children:r.jsx(NK,{slot:d,format:"fluid",className:"w-full"})}):r.jsx("a",{href:"/advertise",className:Ge("block",e),children:r.jsx(Y,{className:"border-dashed hover:border-primary/50 transition-colors group",children:r.jsx(X,{className:"p-4 flex items-center justify-center min-h-[150px]",children:r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground group-hover:text-primary transition-colors",children:"ð¢ Advertise Your Business Here"}
870),r.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"Reach thousands of Nigerian readers"})]})})})})}return t==="inline"?r.jsx("div",{className:Ge("bg-gradient-to-r from-muted/30 to-muted/10 border border-border rounded-lg p-4 cursor-pointer hover:border-primary/50 transition-colors",e),onClick:c,children:r.jsxs("div",{className:"flex items-center gap-4",children:[n.logo_url&&r.jsx("img",{src:n.logo_url,alt:n.business_name,className:"w-12 h-12 rounded-lg object-cover"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"flex items-center gap-2 mb-1",children:r.jsx("span",{className:"text-[10px] bg-primary/10 text-primary px-1.5 py-0.5 rounded",children:"Sponsored"})}),r.jsx("p",{className:"font-medium text-foreground truncate",children:n.title}),r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:n.description})]}),r.jsx(ds,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"})]})}):r.jsxs(Y,{className:Ge("overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group",e),onClick:c,children:[n.banner_image_url&&r.jsxs("div",{className:"relative aspect-video overflow-hidden",children:[r.jsx("img",{src:n.banner_image_url,alt:n.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute top-2 left-2 bg-black/60 text-white text-[10px] px-2 py-0.5 rounded",children:"Sponsored"})]}),r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[n.logo_url&&r.jsx("img",{src:n.logo_url,alt:n.business_name,className:"w-10 h-10 rounded-lg object-cover flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-semibold text-foreground line-clamp-2",children:n.title}),n.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:n.description}),r.jsxs("p",{className:"text-xs text-primary mt-2",children:[n.business_name," ⢠Learn More â"]})]})]})})]})},Sc={MAX_FILE_SIZE:5*1024*1024,MAX_TOTAL_SIZE:20*1024*1024,ALLOWED_TYPES:["image/jpeg","image/jpg","image/png","image/webp","image/gif"],ALLOWED_EXTENSIONS:["jpg","jpeg","png","webp","gif"],MAX_FILENAME_LENGTH:255,BLOCKED_PATTERNS:[/\.php$/i,/\.exe$/i,/\.sh$/i,/\.bat$/i,/\.cmd$/i,/\.js$/i,/\.html$/i,/\.svg$/i,/\.\./,/[<>:"|?*]/]},Wd=({images:e,onImagesChange:t,maxImages:n=5,bucket:s="product-images"})=>{const{user:a}=bt(),[i,o]=j.useState(!1),{toast:l}=Sn(),c=m=>{var p;if(!a)return{valid:!1,error:"User not authenticated"};if(m.size>Sc.MAX_FILE_SIZE)return{valid:!1,error:`File "${m.name}" is too large. Maximum size is ${Sc.MAX_FILE_SIZE/(1024*1024)}MB`};if(m.size===0)return{valid:!1,error:"File is empty"};if(!Sc.ALLOWED_TYPES.includes(m.type))return{valid:!1,error:`Invalid file type "${m.type}". Allowed types: JPEG, PNG, WebP, GIF`};const x=(p=m.name.split(".").pop())==null?void 0:p.toLowerCase();if(!x||!Sc.ALLOWED_EXTENSIONS.includes(x))return{valid:!1,error:`Invalid file extension ".${x}". Allowed: .jpg, .jpeg, .png, .webp, .gif`};if(m.name.length>Sc.MAX_FILENAME_LENGTH)return{valid:!1,error:"Filename is too long (max 255 characters)"};for(const v of Sc.BLOCKED_PATTERNS)if(v.test(m.name))return{valid:!1,error:"Filename contains invalid characters or patterns"};return{valid:!0}},d=m=>m.replace(/[^a-zA-Z0-9._-]/g,"_").replace(/\.+/g,".").replace(/^\.+/,"").substring(0,100),u=async m=>{var p;const x=c(m);if(!x.valid)throw new Error(x.error);try{const v=(p=m.name.split(".").pop())==null?void 0:p.toLowerCase(),g=Date.now(),y=Math.random().toString(36).substring(2,15),b=d(m.name.split(".")[0]),w=`${g}-${y}-${b}.${v}`,_=`${a.id}/${w}`,{error:C,data:E}=await H.storage.from(s).upload(_,m,{cacheControl:"3600",upsert:!1});if(C)throw C.message.includes("duplicate")?new Error("File already exists. Please try again."):new Error(`Upload failed: ${C.message}`);const{data:{publicUrl:N}}=H.storage.from(s).getPublicUrl(_);return N}catch(v){throw console.error("Error uploading image:",v),v}},h=async m=>{const x=m.target.files;if(!x||x.length===0)return;if(!a){l({title:"Authentication Required",description:"Please log in to upload images",variant:"destructive"});return}if(e.length+x.length>n){l({title:"Too many images",description:`Maximum ${n} images allowed. You can upload ${n-e.length} more.`,variant:"destructive"});return}if(Array.from(x).reduce((y,b)=>y+b.size,0)>Sc.MAX_TOTAL_SIZE){l({title:"Total file size too large",description:`Maximum ${Sc.MAX_TOTAL_SIZE/(1024*1024)}MB total for all files`,variant:"destructive"});return}const v=[];
870if(Array.from(x).forEach((y,b)=>{const w=c(y);w.valid||v.push(`File ${b+1} (${y.name}): ${w.error}`)}),v.length>0){l({title:"Invalid files detected",description:v[0],variant:"destructive"});return}o(!0);const g=Array.from(x).map(y=>u(y));try{const b=(await Promise.all(g)).filter(w=>{try{return new URL(w),!0}catch{return!1}});t([...e,...b]),l({title:"Success",description:`${b.length} image(s) uploaded successfully`})}catch(y){console.error("Upload error:",y),l({title:"Upload failed",description:y.message||"Failed to upload one or more images",variant:"destructive"})}finally{o(!1),m.target.value=""}},f=async m=>{const x=e[m];try{const v=x.split("/"),g=v.findIndex(y=>y===s);if(g!==-1&&g<v.length-1){const y=v.slice(g+1).join("/");if(y.startsWith(a.id+"/")){const{error:b}=await H.storage.from(s).remove([y]);b&&console.warn("Failed to delete file from storage:",b)}}}catch(v){console.error("Error deleting image:",v)}const p=e.filter((v,g)=>g!==m);t(p)};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(W,{type:"button",variant:"outline",disabled:i||e.length>=n||!a,onClick:()=>{var m;return(m=document.getElementById("image-upload"))==null?void 0:m.click()},children:i?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"w-4 h-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Jn,{className:"w-4 h-4 mr-2"}),"Upload Images"]})}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.length,"/",n," images (",Sc.MAX_FILE_SIZE/(1024*1024),"MB max each)"]})]}),r.jsx("input",{id:"image-upload",type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp,image/gif",multiple:!0,className:"hidden",onChange:h,disabled:i||e.length>=n}),e.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:e.map((m,x)=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:m,alt:`Product ${x+1}`,className:"w-full h-32 object-cover rounded-lg border",loading:"lazy",onError:p=>{p.currentTarget.src='data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="200" height="200"%3E%3Crect fill="%23ddd" width="200" height="200"/%3E%3Ctext fill="%23999" font-size="16" x="50%25" y="50%25" dominant-baseline="middle" text-anchor="middle"%3EImage Error%3C/text%3E%3C/svg%3E'}}),r.jsx(W,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>f(x),disabled:i,children:r.jsx(ks,{className:"h-4 w-4"})}),x===0&&r.jsx("span",{className:"absolute bottom-2 left-2 bg-primary text-primary-foreground text-xs px-2 py-1 rounded",children:"Main"})]},x))}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsx("p",{children:"⢠Supported formats: JPEG, PNG, WebP, GIF"}),r.jsxs("p",{children:["⢠Maximum ",Sc.MAX_FILE_SIZE/(1024*1024),"MB per image"]}),r.jsxs("p",{children:["⢠Maximum ",n," images total"]})]})]})},$0e=({onSuccess:e})=>{const{user:t}=bt(),{toast:n}=Sn(),[s,a]=j.useState([]),[i,o]=j.useState([]),[l,c]=j.useState(!0),[d,u]=j.useState(!1),[h,f]=j.useState({business_name:"",business_email:"",business_phone:"",whatsapp:"",business_website:"",contact_person:"",placement_id:"",pricing_id:"",title:"",description:"",target_url:"",banner_image_url:"",logo_url:""}),[m,x]=j.useState(null),[p,v]=j.useState(null);j.useEffect(()=>{g()},[]);const g=async()=>{try{const[N,k]=await Promise.all([H.from("ad_placements").select("*").eq("is_active",!0).order("name"),H.from("ad_pricing").select("*").eq("is_active",!0).order("duration_days")]);N.data&&a(N.data),k.data&&o(k.data)}catch(N){console.error("Error fetching data:",N)}finally{c(!1)}},y=(N,k)=>{f(I=>({...I,[N]:k}))},b=N=>{const k=s.find(I=>I.id===N);x(k||null),f(I=>({...I,placement_id:N,pricing_id:""})),v(null)},w=N=>{const k=i.find(I=>I.id===N);v(k||null),f(I=>({...I,pricing_id:N}))},_=()=>h.placement_id?i.filter(N=>N.placement_id===h.placement_id):[],C=()=>p?p.price:0,E=async N=>{if(N.preventDefault(),!t){n({title:"Authentication Required",description:"Please sign in to purchase an advertisement.",variant:"destructive"});return}if(!m||!p){n({title:"Selection Required",description:"Please select a placement and duration.",variant:"destructive"});return}if(!h.banner_image_url){n({title:"Banner Required",description:"Please upload your advertisement banner image.",variant:"destructive"});return}u(!0);try{const k=new Date,I=new Date;I.setDate(I.getDate()+p.duration_days);const{data:P,error:O}=await H.functions.invoke("initialize-ad-payment",{body:{user_id:t.id,placement_id:h.placement_id,pricing_id:h.pricing_id,amount:C(),duration_days:p.duration_days,start_date:k.toISOString().split("T")[0],end_date:I.toISOString().split("T")[0],ad_data:{business_name:h.business_name,business_email:h.business_email,business_phone:h.business_phone,whatsapp:h.whatsapp,business_website:h.business_website,contact_person:h.contact_person,title:h.title,de
870scription:h.description,target_url:h.target_url,banner_image_url:h.banner_image_url,logo_url:h.logo_url,placement_location:m.slug,pricing_plan:p.duration_label,advertisement_type:"banner"},callback_url:`${window.location.origin}/dashboard?ad_payment=success`}});if(O)throw O;P!=null&&P.authorization_url||P!=null&&P.payment_url?window.location.href=P.authorization_url||P.payment_url:(n({title:"Submission Successful",description:"Your ad has been submitted. Please complete payment to proceed."}),e==null||e())}catch(k){console.error("Error submitting ad:",k),n({title:"Submission Failed",description:"There was an error processing your request. Please try again.",variant:"destructive"})}finally{u(!1)}};return l?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Jn,{className:"h-5 w-5"}),"Self-Serve Advertisement"]}),r.jsx(Nt,{children:"Create and launch your ad campaign in minutes. Pay now, get reviewed within 24 hours."})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:E,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"1. Select Ad Placement"}),r.jsxs(mt,{value:h.placement_id,onValueChange:b,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Choose where your ad will appear"})}),r.jsx(ht,{children:s.map(N=>r.jsx(Ne,{value:N.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:N.name}),r.jsx(te,{variant:"outline",className:"text-xs",children:N.size_label}),N.is_mobile&&r.jsx(te,{variant:"secondary",className:"text-xs",children:"Mobile"})]})},N.id))})]}),m&&r.jsxs("div",{className:"bg-muted/50 p-4 rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:m.description}),r.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm",children:[r.jsxs("span",{className:"font-medium",children:["Size: ",m.width,"x",m.height,"px"]}),r.jsxs("span",{className:"text-muted-foreground",children:["Location: ",m.location]})]})]})]}),h.placement_id&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"2. Select Duration & Budget"}),r.jsx("div",{className:"grid md:grid-cols-3 gap-4",children:_().map(N=>r.jsxs("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${h.pricing_id===N.id?"border-primary bg-primary/5 ring-2 ring-primary":"hover:border-primary/50"}`,onClick:()=>w(N.id),children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"font-semibold",children:N.duration_label}),N.discount_percentage>0&&r.jsxs(te,{variant:"secondary",className:"text-xs",children:["Save ",N.discount_percentage,"%"]})]}),r.jsxs("p",{className:"text-2xl font-bold text-primary",children:["â¦",N.price.toLocaleString()]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["â¦",Math.round(N.price/N.duration_days).toLocaleString(),"/day"]})]},N.id))})]}),r.jsx(sl,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"3. Business Information"}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{children:"Business Name *"}),r.jsx(ge,{required:!0,value:h.business_name,onChange:N=>y("business_name",N.target.value),placeholder:"Your business name"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Contact Person *"}),r.jsx(ge,{required:!0,value:h.contact_person,onChange:N=>y("contact_person",N.target.value),placeholder:"Contact name"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Email *"}),r.jsx(ge,{type:"email",required:!0,value:h.business_email,onChange:N=>y("business_email",N.target.value),placeholder:"[email protected]"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Phone"}),r.jsx(ge,{value:h.business_phone,onChange:N=>y("business_phone",N.target.value),placeholder:"+234 xxx xxx xxxx"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"WhatsApp"}),r.jsx(ge,{value:h.whatsapp,onChange:N=>y("whatsapp",N.target.value),placeholder:"+234 xxx xxx xxxx"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Website"}),r.jsx(ge,{value:h.business_website,onChange:N=>y("business_website",N.target.value),placeholder:"https://yourbusiness.com"})]})]})]}),r.jsx(sl,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"4. Ad Content"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(le,{children:"Ad Title *"}),r.jsx(ge,{required:!0,value:h.title,onChange:N=>y("title",N.target.value),placeholder:"Catchy headline for your ad",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Description"}),r.jsx(ir,{value:h.description,onChange:N=>y("description",N.target.value),placeholder:"Brief description of your offer",rows:3,maxLength:300})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Target URL *"}),r.jsx(ge,{required:!0,value:h.target_url,onChange:N=>y("target_url",N.target.value),placeholder:"https://yourbusiness.com/landing-page"})]})]})]}),r.jsx(sl,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"5. Upload Ad Banner"}),m&&r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-primary/10 rounded-lg text-sm",children:[r.jsx(tc,{
870className:"h-4 w-4 text-primary"}),r.jsxs("span",{children:["Required size: ",r.jsxs("strong",{children:[m.width,"x",m.height,"px"]})," (",m.size_label,")"]})]}),r.jsx(Wd,{images:h.banner_image_url?[h.banner_image_url]:[],onImagesChange:N=>y("banner_image_url",N[0]||""),maxImages:1,bucket:"advertisements"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(le,{children:"Business Logo (Optional)"}),r.jsx(Wd,{images:h.logo_url?[h.logo_url]:[],onImagesChange:N=>y("logo_url",N[0]||""),maxImages:1,bucket:"advertisements"})]}),r.jsx(sl,{}),m&&p&&r.jsxs("div",{className:"bg-muted/50 p-6 rounded-lg space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Order Summary"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Placement:"}),r.jsx("span",{className:"font-medium",children:m.name})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Size:"}),r.jsx("span",{children:m.size_label})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Duration:"}),r.jsx("span",{children:p.duration_label})]}),r.jsx(sl,{}),r.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[r.jsx("span",{children:"Total:"}),r.jsxs("span",{className:"text-primary",children:["â¦",C().toLocaleString()]})]})]}),r.jsxs("div",{className:"pt-4",children:[r.jsx(W,{type:"submit",className:"w-full",size:"lg",disabled:d||!h.banner_image_url,children:d?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(er,{className:"h-4 w-4 mr-2"}),"Pay â¦",C().toLocaleString()," & Submit"]})}),r.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"Your ad will be reviewed within 24 hours after payment"})]})]})]})})]})},_K=({className:e,showAdvertiseLink:t=!0})=>r.jsxs("div",{className:Ge("space-y-4",e),children:[r.jsx(zo,{placementSlug:"sidebar-square",className:"w-full"}),r.jsx(zo,{placementSlug:"sidebar-skyscraper",className:"w-full"}),t&&r.jsxs(Vt,{to:"/advertise",className:"block p-4 bg-gradient-to-br from-primary/10 to-secondary/10 rounded-lg border border-primary/20 hover:border-primary/40 transition-colors text-center",children:[r.jsx("p",{className:"font-semibold text-primary mb-1",children:"ð¢ Grow Your Business"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Advertise on Naija.com"})]})]}),F0e=[{region:"Nigeria (Residents)",percentage:65,color:"bg-primary"},{region:"United States",percentage:12,color:"bg-secondary"},{region:"United Kingdom",percentage:8,color:"bg-accent"},{region:"Canada",percentage:5,color:"bg-primary/70"},{region:"Europe (Other)",percentage:4,color:"bg-secondary/70"},{region:"Rest of World",percentage:6,color:"bg-muted-foreground"}],B0e=[{icon:fr,label:"Business Owners & Entrepreneurs",percentage:"28%"},{icon:eu,label:"Online Shoppers",percentage:"24%"},{icon:Xt,label:"Event-Goers & Social Enthusiasts",percentage:"18%"},{icon:fm,label:"Travelers & Diaspora",percentage:"15%"},{icon:Vh,label:"Food & Lifestyle Enthusiasts",percentage:"15%"}],U0e=()=>r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto max-w-7xl",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsxs(te,{variant:"outline",className:"mb-4 border-primary/30 text-primary",children:[r.jsx(Yr,{className:"h-3 w-3 mr-1"})," Audience Insights"]}),r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Know Our Audience"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Naija.com reaches a highly engaged Nigerian and Diaspora audience with strong purchasing intent across commerce, events, travel, and lifestyle."})]}),r.jsxs("div",{className:"grid lg:grid-cols-2 gap-8",children:[r.jsxs(Y,{className:"border-border/50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2 text-lg",children:[r.jsx(hn,{className:"h-5 w-5 text-primary"}),"Geographic Reach"]})}),r.jsx(X,{className:"space-y-4",children:F0e.map(e=>r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-foreground font-medium",children:e.region}),r.jsxs("span",{className:"text-muted-foreground",children:[e.percentage,"%"]})]}),r.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full ${e.color} transition-all duration-500`,style:{width:`${e.percentage}%`}})})]}
870,e.region))})]}),r.jsxs(Y,{className:"border-border/50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2 text-lg",children:[r.jsx(At,{className:"h-5 w-5 text-secondary"}),"Audience Segments"]})}),r.jsx(X,{className:"space-y-4",children:B0e.map(e=>r.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-muted/30 hover:bg-muted/50 transition-colors",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:r.jsx(e.icon,{className:"h-5 w-5 text-primary"})}),r.jsx("div",{className:"flex-1",children:r.jsx("p",{className:"text-sm font-medium text-foreground",children:e.label})}),r.jsx(te,{variant:"secondary",className:"font-bold",children:e.percentage})]},e.label))})]})]}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-6 mt-8",children:[r.jsx(Y,{className:"border-border/50",children:r.jsxs(X,{className:"p-6 flex items-center gap-4",children:[r.jsx("div",{className:"h-14 w-14 rounded-xl bg-primary/10 flex items-center justify-center",children:r.jsx(D0,{className:"h-7 w-7 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-3xl font-bold text-foreground",children:"68%"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Mobile Users"})]})]})}),r.jsx(Y,{className:"border-border/50",children:r.jsxs(X,{className:"p-6 flex items-center gap-4",children:[r.jsx("div",{className:"h-14 w-14 rounded-xl bg-secondary/10 flex items-center justify-center",children:r.jsx(Yq,{className:"h-7 w-7 text-secondary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-3xl font-bold text-foreground",children:"32%"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Desktop Users"})]})]})})]})]})}),Ei=j.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:Ge("w-full caption-bottom text-sm",e),...t})}));Ei.displayName="Table";const Ti=j.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:Ge("[&_tr]:border-b",e),...t}));Ti.displayName="TableHeader";const Oi=j.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:Ge("[&_tr:last-child]:border-0",e),...t}));Oi.displayName="TableBody";const z0e=j.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:Ge("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));z0e.displayName="TableFooter";const On=j.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:Ge("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));On.displayName="TableRow";const jt=j.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:Ge("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));jt.displayName="TableHead";const wt=j.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:Ge("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));wt.displayName="TableCell";const q0e=j.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:Ge("mt-4 text-sm text-muted-foreground",e),...t}));q0e.displayName="TableCaption";function jn({className:e,...t}){return r.jsx("div",{className:Ge("animate-pulse rounded-md bg-muted",e),...t})}const AD=["1 Week","2 Weeks","1 Month","3 Months"],V0e=e=>new Intl.NumberFormat("en-NG",{style:"currency",currency:"NGN",minimumFractionDigits:0}).format(e),PD={homepage:"Homepage",news:"News & Headlines",events:"Events",marketplace:"Marketplace",diaspora:"Diaspora",lodging:"Lodging & Properties",restaurants:"Restaurants & Food",artisans:"Artisans & Services",classifieds:"Classifieds",sidebar:"Sidebar (All Pages)",mobile:"Mobile-Only",modal:"Modal & Overlay",email:"Email & Newsletter",footer:"Footer"},W0e=()=>{const[e,t]=j.useState({}),[n,s]=j.useState(!0);if(j.useEffect(()=>{(async()=>{const[{data:o},{data:l}]=await Promise.all([H.from("ad_placements").select("*").eq("is_active",!0).order("location").order("name"),H.from("ad_pricing").select("*").eq("is_active",!0).order("duration_days")]);if(!o||!l){s(!1);return}const c={};o.forEach(d=>{const u=d.location||"other";c[u]||(c[u]=[]),c[u].push({placement:d,pricing:l.filter(h=>h.placement_id===d.id)})}),t(c),s(!1)})()},[]),n)return r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto max-w-7xl space-y-6",children:[r.jsx(jn,{className:"h-10 w-64 mx-auto"}),r.jsx(jn,{className:"h-64 w-full"}),r.jsx(jn,{className:"h-64 w-full"})]})});const a=Object.keys(e).sort((i,o)=>{const l=Object.keys(PD);return l.indexOf(i)-l.indexOf(o)});return r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto max-w-7xl",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsxs(te,{variant:"outline",className:"mb-4 border-secondary/30 text-secondary",children:[r.jsx(ec,{className:"h-3 w-3 mr-1"})," Rate Card 2025"]}),r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Advertising Rates"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"All prices in Nigerian Naira (â¦). Discounts applied automatically for longer durations. Approximate rate: â¦1,600 = $1 USD."})]}),r.jsx("div",{className:"space-y-8",children:a.map(i=>r.jsxs(Y,{className:"border-border/50 overflow-hidden",children:[r.jsx(Se,{className:"bg-muted/30 border-b border-border/30 py-4",children:r.jsxs(Ae,{className:"text-lg flex items-center gap-2",children:[PD[i]||i,r.jsxs(te,{variant:"outline",className:"text-xs font-normal",children:[e[i].length," placement",e[i].length>
8701?"s":""]})]})}),r.jsx(X,{className:"p-0",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{className:"border-border/30",children:[r.jsx(jt,{className:"text-foreground font-semibold min-w-[200px]",children:"Placement"}),r.jsx(jt,{className:"text-foreground font-semibold",children:"Size"}),r.jsx(jt,{className:"text-foreground font-semibold",children:"Position"}),AD.map(o=>r.jsx(jt,{className:"text-foreground font-semibold text-right min-w-[120px]",children:o},o))]})}),r.jsx(Oi,{children:e[i].map(({placement:o,pricing:l})=>r.jsxs(On,{className:"border-border/20 hover:bg-muted/20",children:[r.jsx(wt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-foreground text-sm",children:o.name}),o.is_mobile&&r.jsx(te,{variant:"secondary",className:"text-[10px] mt-1",children:"Mobile"})]})}),r.jsx(wt,{className:"text-muted-foreground text-sm",children:o.size_label}),r.jsx(wt,{className:"text-muted-foreground text-sm capitalize",children:o.position}),AD.map(c=>{const d=l.find(u=>u.duration_label===c);return r.jsx(wt,{className:"text-right",children:d?r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold text-foreground text-sm",children:V0e(d.price)}),d.discount_percentage&&d.discount_percentage>0&&r.jsxs(te,{variant:"destructive",className:"ml-1 text-[10px] px-1 py-0",children:[r.jsx(Xie,{className:"h-2 w-2 mr-0.5"}),d.discount_percentage,"% off"]})]}):r.jsx("span",{className:"text-muted-foreground text-xs",children:"â"})},c)})]},o.id))})]})})})]},i))}),r.jsxs("div",{className:"mt-8 p-4 rounded-lg bg-muted/30 border border-border/30 flex items-start gap-3",children:[r.jsx(tc,{className:"h-5 w-5 text-primary mt-0.5 shrink-0"}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground mb-1",children:"Rate Card Notes"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1",children:[r.jsx("li",{children:"All prices are in Nigerian Naira (â¦). International clients may pay in USD equivalent."}),r.jsx("li",{children:"Self-serve ads go live within 24 hours of approval. Custom campaigns may take 48-72 hours."}),r.jsx("li",{children:"Volume discounts available for 3+ placements. Contact us for enterprise pricing."}),r.jsx("li",{children:"Rates are subject to change. Current rates locked at time of purchase."})]})]})]})]})})},H0e=[{format:"JPG / JPEG",maxSize:"200 KB",notes:"Preferred for photos"},{format:"PNG",maxSize:"300 KB",notes:"Preferred for graphics with transparency"},{format:"GIF (Animated)",maxSize:"500 KB",notes:"Max 15 seconds, 3 loops"},{format:"HTML5",maxSize:"150 KB (zip)",notes:"Must be SSL-compatible, no auto-audio"},{format:"MP4 (Video)",maxSize:"2 MB",notes:"For interstitial/modal placements only"}],G0e=[{name:"Billboard",dimensions:"970 à 250 px",type:"Desktop"},{name:"Leaderboard",dimensions:"728 à 90 px",type:"Desktop"},{name:"Medium Rectangle",dimensions:"300 à 250 px",type:"Both"},{name:"Half Page",dimensions:"300 à 600 px",type:"Desktop"},{name:"Wide Skyscraper",dimensions:"160 à 600 px",type:"Desktop"},{name:"Mobile Banner",dimensions:"320 à 100 px",type:"Mobile"},{name:"Mobile Rectangle",dimensions:"320 à 250 px",type:"Mobile"},{name:"Interstitial",dimensions:"640 à 480 px",type:"Both"},{name:"Native Card",dimensions:"1200 à 628 px",type:"Both"},{name:"Email Banner",dimensions:"600 à 200 px",type:"Email"},{name:"Instagram Square",dimensions:"1024 à 1024 px",type:"Social"},{name:"Facebook Landscape",dimensions:"1536 à 1024 px",type:"Social"}],Y0e=["Ads must not contain misleading claims, offensive content, or illegal products.","All landing page URLs must use HTTPS and be functional at time of submission.","Text should not exceed 20% of the ad creative area for optimal engagement.","Ads promoting financial services, health products, or gambling require additional verification.","Naija.com reserves the right to reject or remove ads that violate our community guidelines.","Animated ads must have a clear start/stop and not exceed 15 seconds per loop."],K0e=()=>r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto max-w-7xl",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsxs(te,{variant:"outline",className:"mb-4 border-accent/30 text-accent",children:[r.jsx(Die,{className:"h-3 w-3 mr-1"})," Technical Specs"]}),r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Ad Specifications & Guidelines"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Ensure your creatives meet our specifications for the best performance and fastest approval."})]}),r.jsxs("div",{className:"grid lg:grid-cols-2 gap-8",children:[r.jsxs(Y,{className:"border-border/50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2 text-lg",children:[r.jsx(Mie,{className:"h-5 w-5 text-primary"}),"Accepted Formats"]})}),r.jsx(X,{className:"p-0",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{className:"border-border/30",children:[r.jsx(jt,{className:"text-foreground font-semibold",children:"Format"}),r.jsx(jt,{className:"text-foreground font-semibold",children:"Max Size"}),r.jsx(jt,{className:"text-foreground font-semibold",children:"Notes"})]})}),r.jsx(Oi,{children:H0e.map(e=>r.jsxs(On,{className:"border-border/20",children:[r.jsx(wt,{className:"font-medium text-foreground text-sm",children:e.format}),r.jsx(wt,{className:"text-muted-foreground text-sm",children:e.maxSize}),r.jsx(wt,{className:"text-muted-foreground text-sm",children:e.notes})]},e.format))})]})})]}),r.jsxs(Y,{className:"border-border/50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2 text-lg",children:[r.jsx(Lh,{className:"h-5 w-5 text-secondary"}),"Standard Ad Sizes"]})}),r.jsx(X,{className:"p-0",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{className:"border-border/30",children:[r.jsx(jt,{className:"text-foreground font-semibold",children:"Name"}),r.jsx(jt,{className:"text-foreground font-semibold",children:"Dimensions"}),r.jsx(jt,{className:"text-foreground font-semibold",children:"Type"})]})}),r.jsx(Oi,{children:G0e.map(e=>r.jsxs(On,{className:"border-border/20",children:[r.jsx(wt,{className:"font-medium text-foreground text-sm",children:e.name}),r.jsx(wt,{className:"text-muted-foreground text-sm font-mono",children:e.dimensions}),r.jsx(wt,{children:r.jsx(te,{variant:e.type==="Mobile"?"secondary":"outline",className:"text-xs",children:e.type})})]},e.name))})]})})]})]}),r.jsxs(Y,{className:"mt-8 border-border/50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2 text-lg",children:[r.jsx(Oo,{className:"h-5 w-5 text-secondary"}),"Content Policies & Design Guidelines"]})}),r.jsx(X,{children:r.jsx("ul",{className:"space-y-3",children:Y0e.map((e,t)=>r.jsxs("li",{className:"flex items-start gap-3 text-sm text-muted-foreground",children:[r.jsx("span",{className:"h-5 w-5 rounded-full bg-primary/10 text-primary flex items-center justify-center text-xs font-bold shrink-0 mt-0.5",children:t+1}),e]},t))})})]})]})}),X0e=[{name:"Starter",icon:LA,price:"â¦15,000",period:"/ week",description:"Perfect for small businesses testing the waters.",features:["1 Leaderboard placement (728Ã90)","Choice of any section page","Basic performance report","Standard support"],cta:"Get Started"},{name:"Growth",icon:lr,price:"â¦85,000",period:"/ month",description:"Expand your reach across multiple placements.",features:["1 Leaderboard + 1 Sidebar placement","Homepage or section page of choice","In-feed native ad card","Weekly performance reports","Priority support"],highlight:!0,badge:"Most Popular",cta:"Choose Growth"},{name:"Premium",icon:yh,price:"â¦250,000",period:"/ month",description:"Maximum visibility across desktop and mobile.",features:["Homepage Hero Billboard (970Ã250)","2 Sidebar placements","In-feed native ads (all sections)","Mobile banner inclusion","Real-time analytics dashboard","Dedicated account manager"],cta:"Go Premium"},{name:"Enterprise",icon:W2,price:"Custom",period:"",description:"Full platform takeover and custom integrations.",features:["All placement positions","Sponsored content articles","Email newsletter banners","Custom landing pages","API integration support","Monthly strategy calls","First-party data insights"],cta:"Contact Sales"}],Z0e=({onSelectPackage:e})=>r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto max-w-7xl",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsxs(te,{variant:"outline",className:"mb-4 border-primary/30 text-primary",children:[r.jsx(mr,{className:"h-3 w-3 mr-1"})," Packages"]}),r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Advertising Packages"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Choose a pre-built package or build a custom campaign. All packages include ad creative review and optimization recommendations."})]}),r.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6",children:X0e.map(t=>r.jsxs(Y,{className:`relative flex flex-col border-border/50 transition-all hover:border-primary/30 ${t.highlight?"ring-2 ring-primary border-primary/50":""}`,children:[t.badge&&r.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:r.jsx(te,{className:"bg-primary text-primary-foreground shadow-lg",children:t.badge})}),r.jsxs(Se,{className:"pb-4",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center mb-3",children:r.jsx(t.icon,{className:"h-5 w-5 text-primary"})}),r.jsx(Ae,{className:"text-xl",children:t.name}),r.jsx(Nt,{className:"text-sm",children:t.description})]}),r.jsxs(X,{className:"flex-1",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("span",{className:"text-3xl font-bold text-foreground",children:t.price}),r.jsx("span",{className:"text-muted-foreground text-sm",children:t.period})]}),r.jsx("ul",{className:"space-y-2.5",children:t.features.map((n,s)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(er,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),n]},s))})]}),r.jsx(kj,{className:"pt-4",children:r.jsx(W,{className:"w-full",variant:t.highlight?"default":"outline",onClick:()=>e==null?void 0:e(t.name),children:t.cta})})]},t.name))})]})}),J0e={USD:1550,GBP:1980,EUR:1680},Q0e={temp:28,description:"Partly cloudy"},ebe=30*60*1e3,xk=e=>
870`â¦${e.toLocaleString()}`,tbe=e=>{const t=e.toLowerCase();return t.includes("storm")?Pie:t.includes("rain")?Eie:t.includes("snow")?Jie:t.includes("fog")?Aie:t.includes("cloud")||t.includes("partly")?Tie:t.includes("overcast")?Oie:Qie},rbe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(""),[a,i]=j.useState(!1),[o,l]=j.useState(J0e),[c,d]=j.useState(Q0e);if(j.useEffect(()=>{(async()=>{const f=[{id:"fallback-1",title:"Welcome to Naija.com â Your gateway to Nigeria"},{id:"fallback-2",title:"Discover events, marketplace, lodging and more across Nigeria"},{id:"fallback-3",title:"Connect with the Nigerian diaspora worldwide"}];try{const{data:m,error:x}=await H.from("curated_headlines").select("id, title").eq("approved",!0).order("published_at",{ascending:!1}).limit(10);if(x)throw x;t(m&&m.length>0?m:f)}catch(m){console.warn("Headlines fetch failed, using fallback:",m),t(f)}})()},[]),j.useEffect(()=>{(async()=>{try{const{data:f}=await H.from("ticker_cache").select("*").eq("id","current").maybeSingle();if(f){const m=f.updated_at?Date.now()-new Date(f.updated_at).getTime():1/0;f.forex_data&&l(f.forex_data),f.weather_data&&d(f.weather_data),m>ebe&&(H.functions.invoke("fetch-ticker-data").catch(()=>{}),setTimeout(async()=>{const{data:x}=await H.from("ticker_cache").select("*").eq("id","current").maybeSingle();x!=null&&x.forex_data&&l(x.forex_data),x!=null&&x.weather_data&&d(x.weather_data)},5e3))}else H.functions.invoke("fetch-ticker-data").catch(()=>{})}catch(f){console.error("Failed to fetch ticker data:",f)}})()},[]),j.useEffect(()=>{const h=()=>{s(new Date().toLocaleTimeString("en-NG",{timeZone:"Africa/Lagos",hour:"numeric",minute:"2-digit",hour12:!0}))};h();const f=setInterval(h,6e4);return()=>clearInterval(f)},[]),e.length===0)return null;const u=e.map(h=>h.title).join(" ⢠");return r.jsxs("div",{className:"w-full bg-[hsl(var(--naija-dark))] border-b border-border/30 text-foreground text-xs select-none z-50 relative",children:[r.jsxs("div",{className:"flex flex-col md:flex-row md:items-center",children:[r.jsxs(Vt,{to:"/news",className:"flex items-center flex-1 min-w-0 overflow-hidden h-10 md:h-11 group",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[r.jsxs("span",{className:"flex items-center gap-1.5 px-3 md:px-4 shrink-0 bg-destructive/90 h-full font-bold tracking-wide text-destructive-foreground uppercase text-[10px] md:text-[11px]",children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-destructive-foreground/75 opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-destructive-foreground"})]}),"Latest News"]}),r.jsx("div",{className:"flex-1 overflow-hidden relative h-full flex items-center",children:r.jsxs("div",{className:"ticker-track whitespace-nowrap",style:{animationPlayState:a?"paused":"running"},children:[r.jsx("span",{className:"inline-block px-4 text-muted-foreground group-hover:text-foreground transition-colors",children:u}),r.jsx("span",{className:"inline-block px-4 text-muted-foreground group-hover:text-foreground transition-colors",children:u})]})})]}),r.jsxs("div",{className:"flex items-center gap-0 shrink-0 border-t md:border-t-0 md:border-l border-border/20 h-9 md:h-11 bg-[hsl(var(--naija-dark))]",children:[r.jsxs("div",{className:"flex items-center gap-1 px-3 text-muted-foreground",children:[r.jsx($r,{className:"h-3 w-3 text-primary"}),r.jsxs("span",{className:"text-[10px] md:text-[11px] font-medium text-foreground",children:["Lagos ",n]})]}),r.jsx("div",{className:"w-px h-4 bg-border/30"}),(()=>{const h=tbe(c.description);return r.jsxs("div",{className:"flex items-center gap-1 px-3 text-muted-foreground",title:c.description,children:[r.jsx(h,{className:"h-3 w-3 text-secondary"}),r.jsxs("span",{className:"text-[10px] md:text-[11px]",children:[c.temp,"°C"]})]})})(),r.jsx("div",{className:"w-px h-4 bg-border/30"}),r.jsxs("div",{className:"flex items-center gap-2 px-3",children:[r.jsx(lr,{className:"h-3 w-3 text-primary hidden md:block"}),[{symbol:"$",label:"USD",rate:xk(o.USD)},{symbol:"£",label:"GBP",rate:xk(o.GBP)},{symbol:"â¬",label:"EUR",rate:xk(o.EUR)}].map((h,f)=>r.jsxs("span",{className:"flex items-center gap-0",children:[f>0&&r.jsx("span",{className:"mx-1 text-border/50 hidden sm:inline",children:"|"}),r.jsxs("span",{className:"text-[10px] md:text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-semibold text-foreground",children:h.symbol})," ",h.rate]})]},h.label))]})]})]}),r.jsx("style",{children:` 871 .ticker-track { 872 display: inline-flex; 873 animation: marquee 80s linear infinite; 874 } 875 @keyframes marquee { 876 0% { transform: translateX(0%); } 877 100% { transform: translateX(-50%); } 878 } 879 `})]})},nbe=[{icon:Vh,label:"Restaurants"},{icon:Pi,label:"Artisans"},{icon:en,label:"Lodging"},{icon:xa,label:"Car Rentals"},{icon:Xt,label:"Events"},{icon:Qc,label:"Shops"}],sbe=()=>r.jsx("section",{className:"py-10 md:py-14 px-4",children:r.jsx("div",{className:"container mx-auto",children:r.jsx("div",{className:"rounded-2xl overflow-hidden bg-gradient-to-br from-primary/90 via-primary to-accent border border-primary/30 shadow-[var(--shadow-hero)]",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-0",children:[r.jsxs("div",{className:"p-6 md:p-8 flex flex-col justify-center",children:[r.jsx("p",{className:"text-secondary font-semibold text-xs uppercase tracking-wider mb-2",children:"Free for All Businesses"}),r.jsxs("h2",{className:"text-2xl md:text-3xl font-bold text-primary-foreground mb-3 leading-tight",children:["Own a Business?"," ",r.jsx("span",{className:"text-secondary",children:"List It Free"})," ","on Naija.com"]}
879),r.jsx("p",{className:"text-primary-foreground/80 text-base mb-6 max-w-lg",children:"Restaurants, artisan services, rental properties, event venues â get discovered by thousands of Nigerians searching near them every day."}),r.jsx("div",{children:r.jsx(W,{asChild:!0,className:"bg-secondary text-secondary-foreground hover:bg-secondary/90 font-bold px-6 shadow-lg border-2 border-secondary/50 hover:border-secondary",children:r.jsx(Vt,{to:"/dashboard",children:"List Your Business â It's Free"})})})]}),r.jsx("div",{className:"p-6 md:p-8 flex items-center justify-center bg-primary/20",children:r.jsx("div",{className:"grid grid-cols-3 gap-4",children:nbe.map(({icon:e,label:t})=>r.jsxs("div",{className:"flex flex-col items-center gap-1.5 p-3 rounded-xl bg-background/10 backdrop-blur-sm border border-primary-foreground/10 hover:bg-background/20 transition-colors",children:[r.jsx(e,{className:"h-6 w-6 text-secondary"}),r.jsx("span",{className:"text-primary-foreground text-xs font-medium text-center",children:t})]},t))})})]})})})}),abe="/assets/hero-nigerian-creators-hd-Ckajm46T.jpg",ED=[{image:abe,alt:"Nigerian creators collaborating",headline:"Discover, Create & Connect",sub:"Stream bold Naija stories, host events, and grow your community."},{image:If,alt:"Handcrafted Nigerian goods",headline:"Buy from 15,000+ vendors",sub:"Authentic Nigerian fashion, crafts, food and services â delivered."},{image:Qp,alt:"Diaspora staying connected",headline:"Send money home in minutes",sub:"Compare top remittance providers and stay connected from anywhere."}],ibe=9e3;function obe({className:e}){const[t,n]=j.useState(0),[s,a]=j.useState(!1);return j.useEffect(()=>{const i=window.matchMedia("(prefers-reduced-motion: reduce)");a(i.matches);const o=l=>a(l.matches);return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[]),j.useEffect(()=>{if(s)return;const i=setInterval(()=>n(o=>(o+1)%ED.length),ibe);return()=>clearInterval(i)},[s]),r.jsx("div",{className:Ge("absolute inset-0 overflow-hidden",e),"aria-hidden":"true",children:ED.map((i,o)=>r.jsx("img",{src:i.image,alt:i.alt,width:1920,height:1080,loading:o===0?"eager":"lazy",decoding:"async",fetchpriority:o===0?"high":"low",className:Ge("absolute inset-0 w-full h-full object-cover transition-opacity duration-[1500ms]",o===t?"opacity-100":"opacity-0",!s&&o===t&&"animate-hero-kenburns")},i.image))})}const lbe=[{to:"/news",title:"News",desc:"Latest Naija headlines, updated daily",icon:Ca,span:"md:col-span-2 md:row-span-2",accent:"from-emerald-600/90 to-emerald-800/90",badge:"Updated daily"},{to:"/send-money",title:"Send Money",desc:"Compare top remittance providers",icon:Jc,span:"md:col-span-2",accent:"from-amber-500/90 to-orange-600/90",badge:"New"},{to:"/jobs",title:"Jobs",desc:"Vacancies across Nigeria",icon:fr,span:"",accent:"from-sky-600/90 to-blue-700/90",countKey:"jobs",countLabel:e=>`${e.toLocaleString()} listings`},{to:"/buy-sell",title:"Buy & Sell",desc:"Shop Nigerian products",icon:eu,span:"",accent:"from-rose-600/90 to-pink-700/90"},{to:"/events",title:"Events",desc:"Concerts, weddings, festivals",icon:Xt,span:"",accent:"from-fuchsia-600/90 to-purple-700/90",countKey:"events",countLabel:e=>`${e}+ upcoming`},{to:"/restaurants",title:"Restaurants",desc:"Naija Eats â find great food",icon:Vh,span:"",accent:"from-red-600/90 to-orange-700/90",countKey:"restaurants",countLabel:e=>`${e}+ restaurants`},{to:"/rentals",title:"Stays",desc:"Naija Stays â hotels & apartments",icon:en,span:"",accent:"from-indigo-600/90 to-blue-800/90",countKey:"stays",countLabel:e=>`${e}+ stays`},{to:"/creativity",title:"Creativity",desc:"Nigerian arts & culture",icon:Lh,span:"",accent:"from-violet-600/90 to-purple-800/90"},{to:"/artisans",title:"Artisans",desc:"Hire skilled workers",icon:Pi,span:"",accent:"from-teal-600/90 to-cyan-800/90"},{to:"/diaspora",title:"Diaspora Hub",desc:"Resources, near-me & embassies",icon:hn,span:"md:col-span-2",accent:"from-green-700/90 to-emerald-900/90",badge:"Worldwide"}];function cbe(){const[e,t]=j.useState({});return j.useEffect(()=>{(async()=>{try{const[n,s,a,i]=await Promise.all([H.from("classifieds").select("*",{count:"exact",head:!0}).eq("category","jobs").eq("moderation_status","approved"),H.from("events").select("*",{count:"exact",head:!0}).eq("status","published").eq("moderation_status","approved"),H.from("restaurants").select("*",{count:"exact",head:!0}).eq("status","active").eq("moderation_status","approved"),H.from("properties").select("*",{count:"exact",head:!0}).eq("status","active").eq("moderation_status","approved")]);t({jobs:n.count??0,events:s.count??0,restaurants:a.count??0,stays:i.count??0})}catch{}})()},[]),r.jsx("section",{className:"py-10 md:py-14 px-4 bg-muted/10",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsx("div",{className:"flex items-end justify-between mb-6 flex-wrap gap-2",children:r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl md:text-3xl font-bold",children:"Explore Naija.com"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Everything Naija â in one place."})]})}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 auto-rows-[140px] md:auto-rows-[160px] gap-3",children:lbe.map(n=>{const s=n.icon,a=n.countKey?e[n.countKey]:void 0;return r.jsxs(ai,{to:n.to,className:Ge("group relative overflow-hidden rounded-2xl p-4 md:p-5 text-white shadow-md hover:shadow-xl transition-all duration-300 hover:-translate-y-0.5","bg-gradient-to-br",n.accent,n.span),children:[r.jsxs("div",{className:"relative z-10 flex flex-col h-full justify-between",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("span",{className:"inline-flex items-center justify-center h-10 w-10 rounded-xl bg-white/20 backdrop-blur-sm",children:r.jsx(s,{className:"h-5 w-5 drop-shadow"})}),n.badge&&r.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-white/20 backdrop-blur px-2 py-0.5 rounded-full",children:n.badge})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg md:text-xl font-bold drop-shadow",children:n.title}),r.jsx("p",{className:"text-xs md:text-sm text-white/85 line-clamp-2",children:n.desc}),a!==void 0&&a>0&&n.countLabel&&r.jsx("p",{className:"text-[11px] mt-1 text-white/80 font-medium",children:n.countLabel(a)})]})]}),r.jsx("div",{className:"absolute -right-6 -bottom-6 opacity-10 group-hover:opacity-20 transition-opacity",children:r.jsx(s,{className:"h-32 w-32"})})]},n.to)})})]})})}const SK=e=>e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,""),EP=e=>`/events/listing/${SK(e.title)||"event"}-${e.id}`,kK=e=>`/jobs/listing/${SK(e.title)||"job"}-${e.id}`,dbe=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,CK=e=>{const t=e.match(dbe);if(t)return t[0];const n=e.lastIndexOf("-");return n===-1?e:e.slice(n+1)},SS=[{slug:"lagos",name:"Lagos",match:"lagos",intro:"Discover events in Lagos updated daily from top listing sites â concerts, Afrobeats nights, tech meetups, food festivals and more. Naija.com gathers the listings; you buy tickets at the source."},{slug:"abuja",name:"Abuja",match:"abuja",intro:"Whatâs on in Abuja â refreshed every day from external event listings. Concerts, networking, worship nights and family outings across the FCT."}
879,{slug:"port-harcourt",name:"Port Harcourt",match:"port harcourt",intro:"Events in Port Harcourt and Rivers State, discovered daily from external listing sites and updated continuously."},{slug:"ibadan",name:"Ibadan",match:"ibadan",intro:"Gigs, shows and community events in Ibadan â pulled in daily from external event sources so you never miss out."},{slug:"online",name:"Online",match:"online|virtual|webinar",online:!0,intro:"Online and virtual events Nigerians can join from anywhere â webinars, remote conferences and live streams, refreshed daily."}],ube=e=>SS.find(t=>t.slug===e),hbe=(e,t)=>`${t.title} ${t.city??""} ${t.state??""} ${t.venue_name??""}`.toLowerCase().includes(e.match),TD=e=>e?new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short"}):"Date TBA",fbe=e=>e?Date.now()-new Date(e).getTime()<48*60*60*1e3:!1,mbe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState([]);if(j.useEffect(()=>{(async()=>{const c=new Date().toISOString(),[d,u,h]=await Promise.all([H.from("imported_events").select("id, title, city, venue_name, image_url, source_name, start_datetime").eq("is_active",!0).gte("start_datetime",c).order("start_datetime",{ascending:!0,nullsFirst:!1}).limit(5),H.from("imported_jobs").select("id, title, company, location, salary_text, published_at").eq("is_active",!0).order("published_at",{ascending:!1,nullsFirst:!1}).limit(5),H.from("events").select("id, title, city, cover_image, start_datetime, is_featured").eq("status","published").eq("moderation_status","approved").gte("start_datetime",c).order("is_featured",{ascending:!1}).order("start_datetime",{ascending:!0}).limit(3)]);t(d.data||[]),s(u.data||[]),i(h.data||[])})()},[]),e.length===0&&n.length===0&&a.length===0)return null;const o=e.slice(0,3),l=e.slice(3);return r.jsx("section",{className:"py-10 md:py-14 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsxs("div",{className:"mb-8",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-primary mb-2",children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),"Live · updated daily"]}),r.jsx("h2",{className:"text-3xl font-bold",children:"Happening Now"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Events and jobs across Nigeria and the diaspora, refreshed every day."})]}),a.length>0&&r.jsxs("div",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(aj,{className:"h-4 w-4 text-primary"})," Featured & ticketed"]}),r.jsx(Vt,{to:"/events",className:"text-sm text-primary hover:underline",children:"All events"})]}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:a.map(c=>r.jsxs(Vt,{to:"/events",className:"group flex gap-3 rounded-xl border border-primary/20 bg-gradient-card p-3 hover:shadow-glow transition-all duration-300",children:[r.jsx("div",{className:"h-20 w-20 shrink-0 overflow-hidden rounded-lg bg-primary/10 flex items-center justify-center",children:c.cover_image?r.jsx("img",{src:vl(c.cover_image),alt:c.title,loading:"lazy",decoding:"async",className:"h-full w-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx(Xt,{className:"h-7 w-7 text-primary/50"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(te,{variant:"secondary",className:"text-[10px]",children:TD(c.start_datetime)}),c.is_featured&&r.jsx(te,{className:"text-[10px]",children:"Featured"})]}),r.jsx("p",{className:"font-medium text-sm line-clamp-2 group-hover:text-primary transition-colors",children:c.title}),c.city&&r.jsxs("span",{className:"mt-1 flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(At,{className:"h-3 w-3"})," ",c.city]})]})]},c.id))})]}),r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[e.length>0&&r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(qq,{className:"h-4 w-4 text-primary"})," Discovered events"]}),r.jsx(Vt,{to:"/events",className:"text-sm text-primary hover:underline",children:"Browse all"})]}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:o.map(c=>r.jsxs(Vt,{to:EP(c),className:"group rounded-xl overflow-hidden border border-primary/20 bg-gradient-card hover:shadow-glow transition-all duration-300",children:[r.jsxs("div",{className:"relative h-28 bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center overflow-hidden",children:[c.image_url?r.jsx("img",{src:c.image_url,alt:c.title,loading:"lazy",decoding:"async",className:"h-full w-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx(Xt,{className:"h-8 w-8 text-primary/40"}),r.jsx(te,{variant:"secondary",className:"absolute top-2 left-2 text-[10px] bg-background/90 text-foreground",children:TD(c.start_datetime)})]}),r.jsxs("div",{className:"p-3",children:[r.jsx("p",{className:"text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors",children:c.title}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-1",children:[c.city,c.source_name].filter(
879Boolean).join(" · ")})]})]},c.id))}),l.length>0&&r.jsx("ul",{className:"space-y-1.5 mt-3",children:l.map(c=>r.jsx("li",{children:r.jsxs(Vt,{to:EP(c),className:"group flex items-center justify-between gap-3 rounded-lg border px-4 py-2.5 text-sm hover:bg-accent transition-colors",children:[r.jsxs("span",{className:"truncate",children:[c.title,c.city?r.jsxs("span",{className:"text-muted-foreground",children:[" · ",c.city]}):null]}),r.jsx(ax,{className:"h-4 w-4 shrink-0 text-muted-foreground group-hover:text-primary"})]})},c.id))}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-4",children:SS.map(c=>r.jsxs(Vt,{to:`/events/${c.slug}`,className:"text-xs rounded-full border px-3 py-1 hover:bg-accent transition-colors",children:["Events in ",c.name]},c.slug))})]}),n.length>0&&r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(fr,{className:"h-4 w-4 text-primary"})," Fresh jobs"]}),r.jsx(Vt,{to:"/jobs",className:"text-sm text-primary hover:underline",children:"All jobs"})]}),r.jsx("ul",{className:"space-y-2",children:n.map(c=>r.jsx("li",{children:r.jsxs(Vt,{to:kK(c),className:"group flex items-center gap-3 rounded-xl border border-primary/20 bg-gradient-card px-3 py-2.5 hover:shadow-glow transition-all duration-300",children:[r.jsx("span",{className:"h-9 w-9 shrink-0 rounded-full bg-primary/10 text-primary font-semibold flex items-center justify-center text-sm",children:(c.company||c.title||"?").charAt(0).toUpperCase()}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"truncate text-sm font-medium group-hover:text-primary transition-colors",children:c.title}),fbe(c.published_at)&&r.jsx(te,{className:"text-[10px] shrink-0",children:"New"})]}),r.jsxs("span",{className:"mt-0.5 flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[c.company&&r.jsx("span",{className:"truncate",children:c.company}),c.location&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"})," ",c.location]}),c.salary_text&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(V2,{className:"h-3 w-3"})," ",c.salary_text]})]})]}),r.jsx(ax,{className:"h-4 w-4 shrink-0 text-muted-foreground group-hover:text-primary"})]})},c.id))}),r.jsxs("div",{className:"flex flex-wrap gap-2 mt-4",children:[r.jsx(Vt,{to:"/jobs/remote",className:"text-xs rounded-full border px-3 py-1 hover:bg-accent transition-colors",children:"Remote jobs"}),r.jsx(Vt,{to:"/jobs/lagos",className:"text-xs rounded-full border px-3 py-1 hover:bg-accent transition-colors",children:"Jobs in Lagos"}),r.jsx(Vt,{to:"/jobs/abuja",className:"text-xs rounded-full border px-3 py-1 hover:bg-accent transition-colors",children:"Jobs in Abuja"}),r.jsx(Vt,{to:"/jobs",className:"text-xs rounded-full border px-3 py-1 hover:bg-accent transition-colors",children:"Post a job"})]})]})]})]})})},OD=[{to:"/news",label:"News",icon:Ca},{to:"/jobs",label:"Jobs",icon:fr},{to:"/send-money",label:"Send Money",icon:Jc},{to:"/rentals",label:"Stays",icon:en},{to:"/events",label:"Events",icon:Xt},{to:"/restaurants",label:"Restaurants",icon:Vh},{to:"/buy-sell",label:"Marketplace",icon:eu},{to:"/artisans",label:"Artisans",icon:Pi},{to:"/tourism",label:"Tourism",icon:rj},{to:"/diaspora",label:"Diaspora",icon:hn}];function pbe(){const e=[...OD,...OD];return r.jsx("div",{className:"relative overflow-hidden border-y border-border bg-background/80 backdrop-blur",children:r.jsx("div",{className:"flex gap-2 py-2 animate-marquee whitespace-nowrap",children:e.map((t,n)=>{const s=t.icon;return r.jsxs(ai,{to:t.to,className:"inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-medium bg-muted/60 hover:bg-accent text-foreground/80 hover:text-foreground transition-colors",children:[r.jsx(s,{className:"h-3.5 w-3.5 text-naija-green"}),t.label]},`${t.to}-${n}`)})})})}const gbe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState([]),[o,l]=j.useState([]),[c,d]=j.useState(!0),u=[{id:"seed-1",title:"Afrobeats Festival Lagos 2024",creator:"Event by Lagos Events Co",thumbnail:Qp,type:"Event",duration:"Dec 15",views:"2.3K interested",category:"events",isSeed:!0},{id:"seed-2",title:"Handwoven Adire Textile Collection",creator:"Sold by Adunni Textiles",thumbnail:If,type:"Product",duration:"â¦25,000",views:"350 sold",category:"marketplace",isSeed:!0},{id:"seed-3",title:"Luxury Penthouse - Victoria Island",creator:"Property by Lagos Estates",thumbnail:"https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?w=300",type:"Lodging",duration:"â¦45,000/night",views:"4.8â
",category:"lodging",isSeed:!0}];j.useEffect(()=>{h()},[]);const h=async()=>{d(!0);try{const f=[],{data:m}=await H.from("product_features").select("*, products(*)").eq("status","active").gt("end_date",new Date().toISOString()).order("created_at",{ascending:!1}).limit(2);m&&m.length>0&&m.forEach(P=>{var O,A;P.products&&f.push({id:P.products.id,title:P.products.title,creator:"Sold by Vendor",thumbnail:((O=P.products.images)==null?void 0:O[0])||If,type:"Product",duration:`â¦${(A=P.products.price)==null?void 0:A.toLocaleStr
879ing()}`,views:`${P.products.view_count||0} views`,category:"marketplace"})});const{data:x}=await H.from("events").select("*").eq("status","published").eq("moderation_status","approved").or("is_featured.eq.true,boost_expires_at.gt."+new Date().toISOString()).gte("end_datetime",new Date().toISOString()).order("created_at",{ascending:!1}).limit(2);x&&x.length>0&&x.forEach(P=>{f.push({id:P.id,title:P.title,creator:`Event in ${P.city||"Nigeria"}`,thumbnail:P.cover_image||Qp,type:"Event",duration:new Date(P.start_datetime).toLocaleDateString(),views:`${P.view_count||0} interested`,category:"events"})});const{data:p}=await H.from("properties").select("*").eq("status","active").eq("moderation_status","approved").eq("is_boosted",!0).gt("boost_expires_at",new Date().toISOString()).order("created_at",{ascending:!1}).limit(2);p&&p.length>0&&p.forEach(P=>{var O,A;f.push({id:P.id,title:P.title,creator:`Property in ${P.city}`,thumbnail:((O=P.photos)==null?void 0:O[0])||"https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?w=300",type:"Lodging",duration:`â¦${(A=P.base_price_per_night)==null?void 0:A.toLocaleString()}/night`,views:"4.5â
",category:"lodging"})});const{data:v}=await H.from("restaurants").select("*").eq("status","active").eq("moderation_status","approved").eq("is_boosted",!0).gt("boost_expires_at",new Date().toISOString()).order("created_at",{ascending:!1}).limit(2);v&&v.length>0&&v.forEach(P=>{var O,A;f.push({id:P.id,title:P.name,creator:`Restaurant in ${P.city}`,thumbnail:((O=P.images)==null?void 0:O[0])||"https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?w=300",type:"Restaurant",duration:P.price_range||"$$",views:`${((A=P.average_rating)==null?void 0:A.toFixed(1))||"4.5"}â
`,category:"restaurants"})});const{data:g}=await H.from("artisans").select("*").eq("status","active").eq("moderation_status","approved").eq("is_boosted",!0).gt("boost_expires_at",new Date().toISOString()).order("created_at",{ascending:!1}).limit(2);if(g&&g.length>0&&g.forEach(P=>{var O,A;f.push({id:P.id,title:P.business_name,creator:`${P.service_category} in ${P.city}`,thumbnail:((O=P.portfolio_images)==null?void 0:O[0])||"https://images.unsplash.com/photo-1507679799987-c73779587ccf?w=300",type:"Artisan",duration:P.hourly_rate?`â¦${P.hourly_rate.toLocaleString()}/hr`:"Contact",views:`${((A=P.average_rating)==null?void 0:A.toFixed(1))||"4.5"}â
`,category:"artisans"})}),f.length<3){const{data:P}=await H.from("products").select("*").eq("status","active").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3-f.length);if(P&&P.forEach(O=>{var A,R;f.push({id:O.id,title:O.title,creator:"Sold by Vendor",thumbnail:((A=O.images)==null?void 0:A[0])||If,type:"Product",duration:`â¦${(R=O.price)==null?void 0:R.toLocaleString()}`,views:`${O.view_count||0} views`,category:"marketplace"})}),f.length<3){const{data:O}=await H.from("properties").select("*").eq("status","active").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3-f.length);O&&O.forEach(A=>{var R,L;f.push({id:A.id,title:A.title,creator:`Property in ${A.city}`,thumbnail:((R=A.photos)==null?void 0:R[0])||"https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?w=300",type:"Lodging",duration:`â¦${(L=A.base_price_per_night)==null?void 0:L.toLocaleString()}/night`,views:"4.5â
",category:"lodging"})})}}f.length>0?t(f.slice(0,6)):t(u);const{data:y}=await H.from("product_features").select("*, products(*)").eq("status","active").gt("end_date",new Date().toISOString()).order("created_at",{ascending:!1}).limit(2);y&&y.length>0?i(y.map(P=>{var O,A;return{id:P.products.id,title:P.products.title,vendor:"Vendor",image:((O=P.products.images)==null?void 0:O[0])||If,price:`â¦${(A=P.products.price)==null?void 0:A.toLocaleString()}`,rating:4.8}})):i([{id:"seed-p1",title:"Handwoven Adire Dress",vendor:"Adunni Textiles",image:If,price:"â¦25,000",rating:4.8,isSeed:!0}]);const{data:b}=await H.from("properties").select("*").eq("status","active").eq("moderation_status","approved").eq("is_boosted",!0).gt("boost_expires_at",new Date().toISOString()).order("created_at",{ascending:!1}).limit(2);b&&b.length>0?l(b.map(P=>{var O,A;return{id:P.id,title:P.title,location:P.city,image:((O=P.photos)==null?void 0:O[0])||"https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?w=300",price:`â¦${(A=P.base_price_per_night)==null?void 0:A.toLocaleStr
879ing()}`,rating:4.5}})):l([{id:"seed-s1",title:"Luxury Penthouse - Victoria Island",location:"Lagos",image:"https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?w=300",price:"â¦45,000",rating:4.9,isSeed:!0}]);const w=[],{data:_}=await H.from("events").select("*").eq("status","published").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3);_&&_.forEach(P=>{w.push({id:P.id,title:P.title,creator:`Event in ${P.city||"Nigeria"}`,thumbnail:P.cover_image||Qp,type:"Event",duration:new Date(P.start_datetime).toLocaleDateString(),created_at:P.created_at})});const{data:C}=await H.from("products").select("*").eq("status","active").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3);C&&C.forEach(P=>{var O,A;w.push({id:P.id,title:P.title,creator:"By Vendor",thumbnail:((O=P.images)==null?void 0:O[0])||If,type:"Product",duration:`â¦${(A=P.price)==null?void 0:A.toLocaleString()}`,created_at:P.created_at})});const{data:E}=await H.from("restaurants").select("*").eq("status","active").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3);E&&E.forEach(P=>{var O;w.push({id:P.id,title:P.name,creator:`Restaurant in ${P.city||"Nigeria"}`,thumbnail:((O=P.images)==null?void 0:O[0])||"https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?w=300",type:"Restaurant",duration:P.price_range||"$$",created_at:P.created_at})});const{data:N}=await H.from("properties").select("*").eq("status","active").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3);
879N&&N.forEach(P=>{var O,A;w.push({id:P.id,title:P.title,creator:`Property in ${P.city||"Nigeria"}`,thumbnail:((O=P.photos)==null?void 0:O[0])||"https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?w=300",type:"Lodging",duration:`â¦${(A=P.base_price_per_night)==null?void 0:A.toLocaleString()}/night`,created_at:P.created_at})});const{data:k}=await H.from("content").select("*").eq("status","published").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3);k&&k.forEach(P=>{w.push({id:P.id,title:P.title,creator:"Creator",thumbnail:P.thumbnail_url||Qp,type:"Creativity",duration:P.duration?`${Math.floor(P.duration/60)}:${String(P.duration%60).padStart(2,"0")}`:"View",created_at:P.created_at})});const{data:I}=await H.from("artisans").select("*").eq("status","active").eq("moderation_status","approved").order("created_at",{ascending:!1}).limit(3);I&&I.forEach(P=>{var O;w.push({id:P.id,title:P.business_name,creator:`${P.service_category} in ${P.city||"Nigeria"}`,thumbnail:((O=P.portfolio_images)==null?void 0:O[0])||"https://images.unsplash.com/photo-1507679799987-c73779587ccf?w=300",type:"Artisan",duration:P.hourly_rate?`â¦${P.hourly_rate.toLocaleString()}/hr`:"Contact for rates",created_at:P.created_at})}),w.length>0?(w.sort((P,O)=>new Date(O.created_at).getTime()-new Date(P.created_at).getTime()),s(w.slice(0,6))):s([{id:"seed-l1",title:"Traditional Yoruba Drumming Workshop",creator:"By Culture Keeper",thumbnail:Qp,type:"Creativity",duration:"15:20",isSeed:!0}])}catch(f){console.error("Error fetching featured content:",f),t(u)}finally{d(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Naija.com - Nigeria's Creator & Marketplace Platform",description:"Enjoy Freely. Use Proudly. Naija.com is Nigeria's homegrown platform for events, marketplace, lodging, restaurants, artisans, and creative content.",structuredData:{"@context":"https://schema.org","@graph":[{"@type":"WebSite",name:"Naija.com",url:"https://naija.com",potentialAction:{"@type":"SearchAction",target:"https://naija.com/explore?q={search_term_string}","query-input":"required name=search_term_string"}},{"@type":"Organization",name:"Naija.com",url:"https://naija.com",logo:"https://naija.com/naija-logo-n.svg",sameAs:["https://twitter.com/naija_com"]}]}}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(rbe,{}),r.jsxs("section",{className:"relative py-24 md:py-32 px-4 overflow-hidden",children:[r.jsx(obe,{}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-black/60 via-black/50 to-black/60"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-naija-green/20 via-transparent to-naija-gold/20"}),r.jsx("div",{className:"absolute top-20 left-10 animate-float opacity-40",children:r.jsx(ET,{className:"h-8 w-8 text-naija-gold drop-shadow-lg"})}),r.jsx("div",{className:"absolute top-32 right-16 animate-float opacity-40",style:{animationDelay:"2s"},children:r.jsx(ij,{className:"h-6 w-6 text-naija-green drop-shadow-lg"})}),r.jsx("div",{className:"absolute bottom-32 left-20 animate-float opacity-30",style:{animationDelay:"4s"},children:r.jsx(no,{className:"h-10 w-10 text-naija-gold drop-shadow-lg"})}),r.jsxs("div",{className:"container mx-auto relative z-10 text-center text-white",children:[r.jsx($ye,{stats:[{value:15e3,label:"Creators",suffix:"+"},{value:500,label:"Events",suffix:"+"},{value:2e3,label:"Products",suffix:"+"}]}),r.jsxs("h1",{className:"text-4xl md:text-7xl font-bold mb-6 drop-shadow-2xl animate-fade-in",children:["Naija.com â"," ",r.jsx("span",{className:"bg-gradient-to-r from-naija-green via-naija-gold to-naija-green bg-clip-text text-transparent animate-gradient-shift",style:{backgroundSize:"200% auto"},children:"Discover, Create & Connect"})]}),r.jsx(Fye,{}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center mb-6 animate-fade-in",style:{animationDelay:"0.2s"},children:[r.jsx(Vt,{to:"/explore",children:r.jsx(W,{size:"lg",className:"bg-gradient-hero hover:opacity-90 hover:shadow-glow-hover text-lg px-8 py-4 h-auto shadow-hero transition-all duration-300 hover:scale-105",children:"Explore Content"})}),r.jsx(Vt,{to:"/create",children:r.jsxs(W,{size:"lg",variant:"outline",className:"text-lg px-8 py-4 h-auto border-2 border-white/80 bg-white/10 backdrop-blur-sm text-white hover:bg-white hover:text-black transition-all duration-300 hover:scale-105",children:[r.jsx(Jn,{className:"h-5 w-5 mr-2"}),"Submit Content"]})})]}),r.jsx(Bye,{})]})]}),r.jsx(pbe,{}),r.jsx(cbe,{}),r.jsx("section",{className:"py-10 px-4 bg-muted/20",children:r.jsx("div",{className:"container-mobile mx-auto",children:r.jsx(Uye,{})})}),r.jsx(mbe,{}),r.jsx(k0e,{maxProducts:10,className:"container mx-auto px-4 py-10"}),r.jsx(sbe,{}),r.jsx("section",{className:"py-10 md:py-14 px-4",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsx("div",{className:"mb-8",children:r.jsx(zo,{placementSlug:"homepage-leaderboard",className:"mx-auto"})}),r.jsxs("div",{className:"flex items-center justify-between mb-8",children:[r.jsx("h2",{className:"text-3xl font-bold",children:"Featured Highlights"}),r.jsx("p",{className:"text-muted-foreground",children:"Discover the best from every category"})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:e.map(f=>r.jsxs(Y,{className:"group hover:shadow-glow transition-all duration-300 bg-gradient-card border-primary/20",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-t-lg",children:[r.jsx("img",{src:f.thumbnail,alt:f.title,loading:"lazy",className:"w-full h-40 md:h-48 object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute inset-0 bg-black/40 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:r.jsx(W,{size:"icon",className:"bg-primary/80 hover:bg-primary",children:r.jsx(OA,{className:"h-5 w-5"})})}),r.jsx(te,{className:"absolute top-2 right-2 bg-secondary text-secondary-foreground",children:f.duration}),r.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1 bg-black/70 text-white px-2 py-1 rounded text-sm",children:[r.jsx(Yr,{className:"h-3 w-3"}),r.jsx("span",{children:f.views})]})]}),r.jsxs(Se,{className:"pb-2",children:[r.jsx(Ae,{className:"text-lg line-clamp-2",children:f.title}),r.jsxs(Nt,{children:["by ",f.creator]})]})]},f.id))})]})}),r.jsx("section",{className:"py-10 md:py-14 px-4 bg-muted/20",children:r.jsx("div",{className:"container mx-auto",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Marketplace"}),r.jsx(Vt,{to:"/marketplace",children:r.jsxs(W,{variant:"outline",size:"sm",children:["View All ",r.jsx(kg,{className:"h-4 w-4 ml-2"})]})})]}),r.jsx("div",{className:"space-y-4",children:a.map(f=>r.jsx(Y,{className:"group hover:shadow-card transition-all duration-300 bg-gradient-card border-primary/10",children:r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"relative overflow-hidden w-24 h-24 flex-shrink-0",children:r.jsx("img",{src:f.image,alt:f.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),r.jsxs("div",{className:"flex-1 p-3",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:f.title}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["by ",f.vendor]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-bold text-primary",children:f.price}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(mr,{className:"h-3 w-3 fill-secondary text-secondary"}),r.jsx("span",{className:"text-sm",children:f.rating})]})]})]})]})},f.id))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Featured Stays"}),r.jsx(Vt,{to:"/lodging",children:r.jsxs(W,{variant:"outline",size:"sm",children:["View All ",r.jsx(kg,{className:"h-4 w-4 ml-2"})]})})]}),r.jsx("div",{className:"space-y-4",children:o.map(f=>r.jsx(Y,{className:"group hover:shadow-card transition-all duration-300 bg-gradient-card border-primary/10",children:r.jsxs("div",{className:"flex",children:[r.jsx("div",{className:"relative overflow-hidden w-24 h-24 flex-shrink-0",children:r.jsx("img",{src:f.image,alt:f.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})}),r.jsxs("div",{className:"flex-1 p-3",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:f.title}),r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground mb-2",children:[r.jsx(At,{className:"h-3 w-3 mr-1"}),f.location]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-bold text-primary",children:f.price}),r.jsx("span",{className:"text-xs text-muted-foreground",children:" / night"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(mr,{className:"h-3 w-3 fill-secondary text-secondary"}),r.jsx("span",{className:"text-sm",children:f.rating})]})]})]})]})},f.id))})]}),r.jsx("div",{className:"hidden lg:block",children:r.jsx(_K,{showAdvertiseLink:!1})})]})})}),r.jsx("section",{className:"py-10 md:py-14 px-4",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-8",children:[r.jsx("h2",{className:"text-3xl font-bold",children:"Latest Content"}),r.jsx(Vt,{to:"/explore",children:r.jsxs(W,{variant:"outline",children:["View All ",r.jsx(kg,{className:"h-4 w-4 ml-2"})]})})]}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6",children:n.map(f=>r.jsxs(Y,{className:"group hover:shadow-card transition-all duration-300 bg-gradient-card border-primary/10",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-t-lg",children:[r.jsx("img",{src:f.thumbnail,alt:f.title,loading:"lazy",className:"w-full h-28 md:h-32 object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute inset-0 bg-black/40 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:r.jsx(W,{size:"sm",className:"bg-primary/80 hover:bg-primary",children:r.jsx(OA,{className:"h-4 w-4"})})}),r.jsx(te,{className:"absolute top-2 right-2 bg-secondary text-secondary-foreground text-xs",children:f.duration})]}),r.jsxs(Se,{className:"pb-1",children:[r.jsx(Ae,{className:"text-base line-clamp-1",children:f.title}),r.jsxs(Nt,{className:"text-sm",children:["by ",f.creator]})]})]},f.id))})]})}),r.jsx("section",{className:"py-10 md:py-14 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold tracking-tight mb-4",children:"Discover Everything You Need"}),r.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Search across events, products, properties, and content to find exactly what you're looking for"})]}),r.jsx(Dye,{})]})}),r.jsx(Pye,{})]})]})},xbe={creativity:Lh,event:Xt,product:eu,lodging:en,restaurant:Vh,artisan:Pi,tourism:rj,classified:fr},LD={creativity:"bg-primary/10 text-primary",event:"bg-secondary/10 text-secondary",product:"bg-
879accent/10 text-accent-foreground",lodging:"bg-primary/10 text-primary",restaurant:"bg-secondary/10 text-secondary",artisan:"bg-accent/10 text-accent-foreground",tourism:"bg-primary/10 text-primary",classified:"bg-secondary/10 text-secondary"};function vbe(){const[e,t]=j.useState(""),[n,s]=j.useState("all"),[a,i]=j.useState("all"),[o,l]=j.useState("newest"),[c,d]=j.useState("grid");j.useState(!1);const{data:u,isLoading:h}=Ude({queryKey:["explore-all",n,a,o],queryFn:async()=>{const p=[];if(n==="all"||n==="creativity"){const v=H.from("content").select("id, title, description, category, tags, thumbnail_url, created_at").eq("status","published").limit(20),{data:g}=await v;g==null||g.forEach(y=>{p.push({id:y.id,title:y.title,description:y.description||"",type:"creativity",image:y.thumbnail_url||void 0,tags:y.tags,category:y.category||"",created_at:y.created_at})})}if(n==="all"||n==="event"){const v=H.from("events").select("id, title, description, city, state, cover_image, start_datetime, tags, created_at").eq("status","published").limit(20);a!=="all"&&v.eq("state",a);const{data:g}=await v;g==null||g.forEach(y=>{p.push({id:y.id,title:y.title,description:y.description||"",type:"event",image:y.cover_image||void 0,location:`${y.city}, ${y.state}`,city:y.city||"",state:y.state||"",tags:y.tags,created_at:y.created_at})})}if(n==="all"||n==="product"){const v=H.from("products").select("id, title, description, price, location, images, tags, created_at").eq("status","active").limit(20),{data:g}=await v;g==null||g.forEach(y=>{var b;p.push({id:y.id,title:y.title,description:y.description||"",type:"product",image:(b=y.images)==null?void 0:b[0],location:y.location||"",price:y.price,tags:y.tags,created_at:y.created_at})})}if(n==="all"||n==="lodging"){const v=H.from("properties").select("id, title, description, base_price_per_night, city, state, photos, created_at").eq("status","active").limit(20);a!=="all"&&v.eq("state",a);const{data:g}=await v;g==null||g.forEach(y=>{var b;p.push({id:y.id,title:y.title,description:y.description||"",type:"lodging",image:(b=y.photos)==null?void 0:b[0],location:`${y.city}, ${y.state}`,city:y.city||"",state:y.state||"",price:y.base_price_per_night,created_at:y.created_at})})}if(n==="all"||n==="restaurant"){const v=H.from("restaurants").select("id, name, description, city, state, images, created_at, average_rating").eq("status","active").limit(20);a!=="all"&&v.eq("state",a);const{data:g}=await v;g==null||g.forEach(y=>{var b;p.push({id:y.id,title:y.name,description:y.description||"",type:"restaurant",image:(b=y.images)==null?void 0:b[0],location:`${y.city}, ${y.state}`,city:y.city||"",state:y.state||"",rating:y.average_rating,created_at:y.created_at})})}if(n==="all"||n==="artisan"){const v=H.from("artisans").select("id, business_name, description, city, state, portfolio_images, service_category, created_at, average_rating, hourly_rate").eq("status","active").limit(20);a!=="all"&&v.eq("state",a);const{data:g}=await v;g==null||g.forEach(y=>{var b;p.push({id:y.id,title:y.business_name,description:y.description||"",type:"artisan",image:(b=y.portfolio_images)==null?void 0:b[0],location:`${y.city}, ${y.state}`,city:y.city||"",state:y.state||"",category:y.service_category,rating:y.average_rating,price:y.hourly_rate,created_at:y.created_at})})}if(n==="all"||n==="classified"){const v=H.from("classifieds").select("id, title, description, location_city, location_state, created_at, category").eq("status","active").limit(20);a!=="all"&&v.eq("location_state",a);const{data:g}=await v;g==null||g.forEach(y=>{p.push({id:y.id,title:y.title,description:y.description||"",type:"classified",location:`${y.location_city}, ${y.location_state}`,city:y.location_city||"",state:y.location_state||"",category:y.category,created_at:y.created_at})})}return o==="newest"?p.sort((v,g)=>new Date(g.created_at).getTime()-new Date(v.created_at).getTime()):o==="oldest"?p.sort((v,g)=>new Date(v.created_at).getTime()-new Date(g.created_at).getTime()):o==="price_low"?p.sort((v,g)=>(v.price||0)-(g.price||0)):o==="price_high"?p.sort((v,g)=>(g.price||0)-(v.price||0)):o==="rating"&&p.sort((v,g)=>(g.rating||0)-(v.rating||0)),p}}),f=u==null?void 0:u.filter(p=>{var g,y,b,w;if(!e)return!0;const v=e.toLowerCase();return p.title.toLowerCase().includes(v)||((g=p.description)==null?void 0:g.toLowerCase().includes(v))||((y=p.location)==null?void 0:y.toLowerCase().includes(v))||((b=p.category)==null?void 0:b.toLowerCase().includes(v))||((w=p.tags)==null?void 0:w.some(_=>_.toLowerCase().includes(v)))}),m=p=>{switch(p.type){case"creativity":return"/creativity";case"event":return"/events";case"product":return"/marketplace";case"lodging":return"/lodging";case"restaurant":return"/restaurants";case"artisan":return"/artisans";case"tourism":return"/tourism";case"classified":return"/classifieds";default:return"#"}},x={total:(f==null?void 0:f.length)||0,byCategory:(f==null?void 0:f.reduce((p,v)=>(p[v.type]=(p[v.type]||0)+1,p),{}))||{}};return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Explore Nigeria - Discover Events, Products, Services & More | Naija.com",description:"Explore everything Nigeria has to offer - events, marketplace products, lodging, restaurants, artisan services, tourism packages, creative works and classifieds all in one place.",type:"website",noindex:!0}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-12 px-4 border-b",children:r.jsxs("div",{className:"container mx-auto max-w-6xl",children:[r.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4 text-foreground",children:"Explore Everything Naija"}),r.jsx("p",{className:"text-lg text-muted-foreground mb-8",children:"Discover events, products, services, lodging, food, and creativity across Nigeria"}),r.jsxs("div",{className:"relative mb-6",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 text-muted-foreground h-5 w-5"}),r.jsx(ge,{placeholder:"Search across all categories...",value:e,onCh
879ange:p=>t(p.target.value),className:"pl-12 pr-4 py-6 text-lg"})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 items-center text-sm",children:[r.jsxs(te,{variant:"secondary",className:"px-3 py-1",children:[x.total," Results"]}),Object.entries(x.byCategory).map(([p,v])=>r.jsxs(te,{variant:"outline",className:"px-3 py-1",children:[p,": ",v]},p))]})]})}),r.jsx("section",{className:"border-b bg-muted/20 sticky top-0 z-10 backdrop-blur-sm",children:r.jsx("div",{className:"container mx-auto max-w-6xl px-4 py-4",children:r.jsxs("div",{className:"flex flex-wrap gap-3 items-center justify-between",children:[r.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[r.jsxs(mt,{value:n,onValueChange:s,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{placeholder:"All Categories"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Categories"}),r.jsx(Ne,{value:"creativity",children:"Creativity"}),r.jsx(Ne,{value:"event",children:"Events"}),r.jsx(Ne,{value:"product",children:"Marketplace"}),r.jsx(Ne,{value:"lodging",children:"Lodging"}),r.jsx(Ne,{value:"restaurant",children:"Restaurants"}),r.jsx(Ne,{value:"artisan",children:"Artisans"}),r.jsx(Ne,{value:"tourism",children:"Tourism"}),r.jsx(Ne,{value:"classified",children:"Classifieds"})]})]}),r.jsxs(mt,{value:a,onValueChange:i,children:[r.jsx(ut,{className:"w-[150px]",children:r.jsx(pt,{placeholder:"All States"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All States"}),r.jsx(Ne,{value:"Lagos",children:"Lagos"}),r.jsx(Ne,{value:"Abuja",children:"Abuja"}),r.jsx(Ne,{value:"Rivers",children:"Rivers"}),r.jsx(Ne,{value:"Kano",children:"Kano"}),r.jsx(Ne,{value:"Oyo",children:"Oyo"})]})]}),r.jsxs(mt,{value:o,onValueChange:l,children:[r.jsx(ut,{className:"w-[150px]",children:r.jsx(pt,{placeholder:"Sort by"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"newest",children:"Newest First"}),r.jsx(Ne,{value:"oldest",children:"Oldest First"}),r.jsx(Ne,{value:"rating",children:"Highest Rated"}),r.jsx(Ne,{value:"price_low",children:"Price: Low to High"}),r.jsx(Ne,{value:"price_high",children:"Price: High to Low"})]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{variant:c==="grid"?"default":"outline",size:"icon",onClick:()=>d("grid"),children:r.jsx(Gq,{className:"h-4 w-4"})}),r.jsx(W,{variant:c==="list"?"default":"outline",size:"icon",onClick:()=>d("list"),children:r.jsx(qie,{className:"h-4 w-4"})})]})]})})}),r.jsx("section",{className:"py-8 px-4",children:r.jsx("div",{className:"container mx-auto max-w-6xl",children:h?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading amazing content..."})]}):f&&f.length>0?r.jsx("div",{className:c==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:f.map(p=>{const v=xbe[p.type];return r.jsx(Vt,{to:m(p),children:r.jsx(Y,{className:"group hover:shadow-lg transition-all duration-300 h-full",children:r.jsx(X,{className:"p-0",children:c==="grid"?r.jsxs(r.Fragment,{children:[p.image&&r.jsxs("div",{className:"relative overflow-hidden rounded-t-lg h-48",children:[r.jsx("img",{src:p.image,alt:p.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"}),r.jsxs(te,{className:`absolute top-3 right-3 ${LD[p.type]}`,children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),p.type]})]}),r.jsxs("div",{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-lg mb-2 line-clamp-2 group-hover:text-primary transition-colors",children:p.title}),p.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:p.description}),r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground flex-wrap",children:[p.location&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),p.location]}),p.rating&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(mr,{className:"h-3 w-3 fill-yellow-400 text-yellow-400"}),p.rating.toFixed(1)]}),p.price&&r.jsxs("div",{className:"font-semibold text-primary",children:["â¦",p.price.toLocaleStr
879ing(),p.type==="lodging"&&"/night",p.type==="artisan"&&"/hr"]})]}),p.tags&&p.tags.length>0&&r.jsx("div",{className:"flex gap-1 mt-3 flex-wrap",children:p.tags.slice(0,3).map((g,y)=>r.jsx(te,{variant:"outline",className:"text-xs",children:g},y))})]})]}):r.jsxs("div",{className:"flex gap-4 p-4",children:[p.image&&r.jsx("img",{src:p.image,alt:p.title,className:"w-24 h-24 object-cover rounded-lg flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-1 group-hover:text-primary transition-colors",children:p.title}),r.jsxs(te,{className:`flex-shrink-0 ${LD[p.type]}`,children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),p.type]})]}),p.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:p.description}),r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[p.location&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),p.location]}),p.rating&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(mr,{className:"h-3 w-3 fill-yellow-400 text-yellow-400"}),p.rating.toFixed(1)]}),p.price&&r.jsxs("div",{className:"font-semibold text-primary",children:["â¦",p.price.toLocaleString()]})]})]})]})})})},`${p.type}-${p.id}`)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Wr,{className:"h-16 w-16 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No results found"}),r.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your filters or search query"})]})})})]})]})}const ID=({content:e,onSelect:t})=>{const n=a=>{if(!a)return null;const i=Math.floor(a/60),o=a%60;return`${i}:${o.toString().padStart(2,"0")}`},s=()=>{switch(e.content_type){case"video":return r.jsx(OA,{className:"h-4 w-4"});case"audio":return r.jsx($r,{className:"h-4 w-4"});default:return r.jsx(Cr,{className:"h-4 w-4"})}};return r.jsxs(Y,{className:"group hover:shadow-glow transition-all duration-300 bg-gradient-card border-primary/20 cursor-pointer",onClick:t,children:[r.jsxs("div",{className:"relative overflow-hidden rounded-t-lg",children:[e.thumbnail_url&&r.jsx("img",{src:vl(e.thumbnail_url),alt:e.title,loading:"lazy",decoding:"async",className:"w-full h-48 object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute inset-0 bg-black/40 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:r.jsx(W,{size:"icon",className:"bg-primary/80 hover:bg-primary",children:s()})}),e.duration&&r.jsx(te,{className:"absolute top-2 right-2 bg-secondary text-secondary-foreground",children:n(e.duration)}),e.category&&r.jsx(te,{className:"absolute top-2 left-2 bg-primary text-primary-foreground",children:e.category})]}),r.jsxs(Se,{className:"pb-2",children:[r.jsx(Ae,{className:"text-lg line-clamp-2",children:e.title}),r.jsx(Nt,{children:e.creator_name?`by ${e.creator_name}`:"Anonymous Creator"})]}),r.jsxs(X,{children:[e.view_count>0&&r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground mb-2",children:[r.jsx(Cr,{className:"h-4 w-4 mr-1"}),e.view_count.toLocaleString()," views"]}),e.tags&&e.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.slice(0,3).map(a=>r.jsx(te,{variant:"outline",className:"text-xs",children:a},a))})]})]})},ybe=({content:e,isOpen:t,onClose:n})=>{const{user:s}=bt(),[a,i]=j.useState(!1),[o,l]=j.useState(!1),[c,d]=j.useState(!1);j.useEffect(()=>{t&&(u(),h())},[t,e.id,s]);const u=async()=>{if(!s||!e.is_premium){i(!e.is_premium);return}d(!0);try{const{data:v,error:g}=await H.from("content_purchases").select("id").eq("content_id",e.id).eq("buyer_id",s.id).maybeSingle();i(!!v)}catch(v){console.error("Error checking purchase status:",v)}finally{d(!1)}},h=async()=>{await H.from("content_views").insert({content_id:e.id,user_id:(s==null?void 0:s.id)||null}),await H.from("content").update({view_count:(e.view_count||0)+1}).eq("id",e.id)},f=async()=>
879{if(!s){be({title:"Login Required",description:"Please login to purchase premium content",variant:"destructive"});return}l(!0);try{const{data:v,error:g}=await H.functions.invoke("purchase-content",{body:{contentId:e.id}});if(g)throw g;v.authorization_url&&(window.location.href=v.authorization_url)}catch(v){console.error("Error purchasing content:",v),be({title:"Purchase Failed",description:v.message||"Failed to initialize payment",variant:"destructive"})}finally{l(!1)}},m=v=>{if(!v)return null;const g=Math.floor(v/60),y=v%60;return`${g}:${y.toString().padStart(2,"0")}`},x=v=>new Date(v).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),p=()=>{var v;return e.is_premium&&!a?r.jsx("div",{className:"relative w-full pt-[56.25%] rounded-lg overflow-hidden bg-muted",children:r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-8 text-center bg-gradient-to-br from-primary/10 to-background backdrop-blur-sm",children:[r.jsx(Md,{className:"h-16 w-16 text-primary mb-4"}),r.jsx("h3",{className:"text-2xl font-bold mb-2",children:"Premium Content"}),r.jsx("p",{className:"text-muted-foreground mb-6 max-w-md",children:"This content is premium. Purchase access to enjoy unlimited viewing."}),r.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[r.jsx(Tn,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"text-3xl font-bold",children:["â¦",(v=e.price)==null?void 0:v.toLocaleString()]})]}),r.jsx(W,{onClick:f,disabled:o||c,size:"lg",className:"gap-2",children:o?r.jsx(r.Fragment,{children:"Processing..."}):r.jsxs(r.Fragment,{children:[r.jsx(Md,{className:"h-4 w-4"}),"Purchase Access"]})})]})}):e.embed_url?r.jsx("div",{className:"relative w-full pt-[56.25%] rounded-lg overflow-hidden",children:r.jsx("iframe",{src:e.embed_url,className:"absolute top-0 left-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}):e.content_type==="video"&&e.content_url?r.jsxs("video",{controls:!0,className:"w-full rounded-lg",poster:e.thumbnail_url||void 0,children:[r.jsx("source",{src:e.content_url,type:"video/mp4"}),"Your browser does not support the video tag."]}):e.content_type==="audio"&&e.content_url?r.jsx("div",{className:"w-full p-8 bg-muted rounded-lg",children:r.jsxs("audio",{controls:!0,className:"w-full",children:[r.jsx("source",{src:e.content_url,type:"audio/mpeg"}),"Your browser does not support the audio tag."]})}):e.thumbnail_url?r.jsx("img",{src:e.thumbnail_url,alt:e.title,className:"w-full rounded-lg"}):null};return r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx(Dt,{className:"text-2xl",children:e.title}),r.jsx(on,{children:e.creator_name?`by ${e.creator_name}`:"Anonymous Creator"})]}),e.is_premium&&r.jsxs(te,{className:"gap-1",children:[r.jsx(Md,{className:"h-3 w-3"}),"Premium"]})]})}),r.jsxs("div",{className:"space-y-6",children:[p(),r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[e.view_count>0&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsxs("span",{children:[e.view_count.toLocaleString()," views"]})]}),e.duration&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($r,{className:"h-4 w-4"}),r.jsx("span",{children:m(e.duration)})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4"}),r.jsx("span",{children:x(e.created_at)})]})]}),e.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Description"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.description})]}),e.tags&&e.tags.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Tags"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(v=>r.jsx(te,{variant:"outline",children:v},v))})]}),e.category&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-semibold",children:"Category:"}),r.jsx(te,{children:e.category})]})]})]})})};var Aj=e=>e.type==="checkbox",Yf=e=>e instanceof Date,wi=e=>e==null;const AK=e=>typeof e=="object";var Ws=e=>!wi(e)&&!Array.isArray(e)&&AK(e)&&!Yf(e),PK=e=>Ws(e)&&e.target?Aj(e.target)?e.target.checked:e.target.value:e,bbe=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,EK=(e,t)=>e.has(bbe(t)),jbe=e=>{const t=e.constructor&&e.constructor.prototype;return Ws(t)&&t.hasOwnProperty("isPrototypeOf")},FO=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ua(e){let t;const n=Array.isArray(e),s=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(FO&&(e instanceof Blob||s))&&(n||Ws(e)))if(t=n?[]:{},!n&&!jbe(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=ua(e[a]));else return e;return t}var kS=e=>/^\w*$/.test(e),Fs=e=>e===void 0,BO=e=>Array.isArray(e)?e.filter(Boolean):[],UO=e=>BO(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Pt=(e,t,n)=>{if(!t||!Ws(e))return n;const s=(kS(t)?[t]:UO(t)).reduce((a,i)=>wi(a)?a:a[i],e);return Fs(s)||s===e?Fs(e[t])?n:e[t]:s},_o=e=>typeof e=="boolean",Yn=(e,t,n)=>{let s=-1;const a=kS(t)?[t]:UO(t),i=a.length,o=i-1;for(;++s<i;){const l=a[s];let c=n;if(s!==o){const d=e[l];c=Ws(d)||Array.isArray(d)?d:isNaN(+a[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const l_={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Vl={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},jd={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},zO=ee.createContext(null);zO.displayName="HookFormContext";const CS=()=>ee.useContext(zO),wbe=e=>{const{children:t,...n}=e;return ee.createElement(zO.Provider,{value:n},t)};var TK=(e,t,n,s=!0)=>{const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Vl.all&&(t._proxyFormState[o]=!s||Vl.all),n&&(n[o]=!0),e[o]}});return a};const qO=typeof window<"u"?ee.useLayoutEffect:ee.useEffect;function Nbe(e){const t=CS(),{control:n=t.control,disabled:s,name:a,exact:i}=e||{},[o,l]=ee.useState(n._formState),c=ee.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return qO(()=>n._subscribe({name:a,formState:c.current,exact:i,callback:d=>{!s&&l({...n._formState,...d})}}),[a,s,i]),ee.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),ee.useMemo(()=>TK(o,n,c.current,!1),[o,n])}var $c=e=>typeof e=="string",OK=(e,t,n,s,a)=>$c(e)?(s&&t.watch.add(e),Pt(n,e,a)):Array.isArray(e)?e.map(i=>(s&&t.watch.add(i),Pt(n,i))):(s&&(t.watchAll=!0),n),TP=e=>wi(e)||!AK(e);function Dd(e,t,n=new WeakSet){if(TP(e)||TP(t))return e===t;if(Yf(e)&&Yf(t))return e.getTime()===t.getTime();const s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const i of s){const o=e[i];if(!a.includes(i))return!1;if(i!=="ref"){const l=t[i];if(Yf(o)&&Yf(l)||Ws(o)&&Ws(l)||Array.isArray(o)&&Array.isArray(l)?!Dd(o,l,n):o!==l)return!1}}return!0}function _be(e){const t=CS(),{control:n=t.control,name:s,defaultValue:a,disabled:i,exact:o,c
879ompute:l}=e||{},c=ee.useRef(a),d=ee.useRef(l),u=ee.useRef(void 0);d.current=l;const h=ee.useMemo(()=>n._getWatch(s,c.current),[n,s]),[f,m]=ee.useState(d.current?d.current(h):h);return qO(()=>n._subscribe({name:s,formState:{values:!0},exact:o,callback:x=>{if(!i){const p=OK(s,n._names,x.values||n._formValues,!1,c.current);if(d.current){const v=d.current(p);Dd(v,u.current)||(m(v),u.current=v)}else m(p)}}}),[n,i,s,o]),ee.useEffect(()=>n._removeUnmounted()),f}function Sbe(e){const t=CS(),{name:n,disabled:s,control:a=t.control,shouldUnregister:i,defaultValue:o}=e,l=EK(a._names.array,n),c=ee.useMemo(()=>Pt(a._formValues,n,Pt(a._defaultValues,n,o)),[a,n,o]),d=_be({control:a,name:n,defaultValue:c,exact:!0}),u=Nbe({control:a,name:n,exact:!0}),h=ee.useRef(e),f=ee.useRef(a.register(n,{...e.rules,value:d,..._o(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const m=ee.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Pt(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!Pt(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Pt(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Pt(u.validatingFields,n)},error:{enumerable:!0,get:()=>Pt(u.errors,n)}}),[u,n]),x=ee.useCallback(y=>f.current.onChange({target:{value:PK(y),name:n},type:l_.CHANGE}),[n]),p=ee.useCallback(()=>f.current.onBlur({target:{value:Pt(a._formValues,n),name:n},type:l_.BLUR}),[n,a._formValues]),v=ee.useCallback(y=>{const b=Pt(a._fields,n);b&&y&&(b._f.ref={focus:()=>y.focus&&y.focus(),select:()=>y.select&&y.select(),setCustomValidity:w=>y.setCustomValidity(w),reportValidity:()=>y.reportValidity()})},[a._fields,n]),g=ee.useMemo(()=>({name:n,value:d,..._o(s)||u.disabled?{disabled:u.disabled||s}:{},onChange:x,onBlur:p,ref:v}),[n,s,u.disabled,x,p,v,d]);return ee.useEffect(()=>{const y=a._options.shouldUnregister||i;a.register(n,{...h.current.rules,..._o(h.current.disabled)?{disabled:h.current.disabled}:{}});const b=(w,_)=>{const C=Pt(a._fields,w);C&&C._f&&(C._f.mount=_)};if(b(n,!0),y){const w=ua(Pt(a._options.defaultValues,n));Yn(a._defaultValues,n,w),Fs(Pt(a._formValues,n))&&Yn(a._formValues,n,w)}return!l&&a.register(n),()=>{(l?y&&!a._state.action:y)?a.unregister(n):b(n,!1)}},[n,a,l,i]),ee.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),ee.useMemo(()=>({field:g,formState:u,fieldState:m}),[g,u,m])}const kbe=e=>e.render(Sbe(e));var Cbe=(e,t,n,s,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:a||!0}}:{},i0=e=>Array.isArray(e)?e:[e],RD=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}},Wi=e=>Ws(e)&&!Object.keys(e).length,VO=e=>e.type==="file",Wl=e=>typeof e=="function",c_=e=>{if(!FO)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},LK=e=>e.type==="select-multiple",WO=e=>e.type==="radio",Abe=e=>WO(e)||Aj(e),vk=e=>c_(e)&&e.isConnected;function Pbe(e,t){const n=t.slice(0,-1).length;let s=0;for(;s<n;)e=Fs(e)?s++:e[t[s++]];return e}function Ebe(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fs(e[t]))return!1;return!0}function Xs(e,t){const n=Array.isArray(t)?t:kS(t)?[t]:UO(t),s=n.length===1?e:Pbe(e,n),a=n.length-1,i=n[a];return s&&delete s[i],a!==0&&(Ws(s)&&Wi(s)||Array.isArray(s)&&Ebe(s))&&Xs(e,n.slice(0,-1)),e}var IK=e=>{for(const t in e)if(Wl(e[t]))return!0;return!1};function d_(e,t={}){const n=Array.isArray(e);if(Ws(e)||n)for(const s in e)Array.isArray(e[s])||Ws(e[s])&&!IK(e[s])?(t[s]=Array.isArray(e[s])?[]:{},d_(e[s],t[s])):wi(e[s])||(t[s]=!0);return t}function RK(e,t,n){const s=Array.isArray(e);if(Ws(e)||s)for(const a in e)Array.isArray(e[a])||Ws(e[a])&&!IK(e[a])?Fs(t)||TP(n[a])?n[a]=Array.isArray(e[a])?d_(e[a],[]):{...d_(e[a])}:RK(e[a],wi(t)?{}:t[a],n[a]):n[a]=!Dd(e[a],t[a]);return n}var hy=(e,t)=>RK(e,t,d_(t));const MD={value:!1,isValid:!1},DD={value:!0,isValid:!0};var MK=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Fs(e[0].attributes.value)?Fs(e[0].value)||e[0].value===""?DD:{value:e[0].value,isValid:!0}:DD:MD}return MD},DK=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:s})=>
vendor: 5,441 bytes, line 879
879Fs(e)?e:t?e===""?NaN:e&&+e:n&&$c(e)?new Date(e):s?s(e):e;const $D={isValid:!1,value:null};var $K=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,$D):$D;function FD(e){const t=e.ref;return VO(t)?t.files:WO(t)?$K(e.refs).value:LK(t)?[...t.selectedOptions].map(({value:n})=>n):Aj(t)?MK(e.refs).value:DK(Fs(t.value)?e.ref.value:t.value,e)}var Tbe=(e,t,n,s)=>{const a={};for(const i of e){const o=Pt(t,i);o&&Yn(a,i,o._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:s}},u_=e=>e instanceof RegExp,fy=e=>Fs(e)?e:u_(e)?e.source:Ws(e)?u_(e.value)?e.value.source:e.value:e,BD=e=>({isOnSubmit:!e||e===Vl.onSubmit,isOnBlur:e===Vl.onBlur,isOnChange:e===Vl.onChange,isOnAll:e===Vl.all,isOnTouch:e===Vl.onTouched});const UD="AsyncFunction";var Obe=e=>!!e&&!!e.validate&&!!(Wl(e.validate)&&e.validate.constructor.name===UD||Ws(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===UD)),Lbe=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),zD=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const o0=(e,t,n,s)=>{for(const a of n||Object.keys(e)){const i=Pt(e,a);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],a)&&!s)return!0;if(o.ref&&t(o.ref,o.name)&&!s)return!0;if(o0(l,t))break}else if(Ws(l)&&o0(l,t))break}}};function qD(e,t,n){const s=Pt(e,n);if(s||kS(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const i=a.join("."),o=Pt(t,i),l=Pt(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};a.pop()}return{name:n}}var Ibe=(e,t,n,s)=>{n(e);const{name:a,...i}=e;return Wi(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!s||Vl.all))},Rbe=(e,t,n)=>!e||!t||e===t||i0(e).some(s=>s&&(n?s===t:s.startsWith(t)||t.startsWith(s))),Mbe=(e,t,n,s,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?s.isOnBlur:a.isOnBlur)?!e:(n?s.isOnChange:a.isOnChange)?e:!0,Dbe=(e,t)=>!BO(Pt(e,t)).length&&Xs(e,t),$be=(e,t,n)=>{const s=i0(Pt(e,n));return Yn(s,"root",t[n]),Yn(e,n,s),e},rN=e=>$c(e);function VD(e,t,n="validate"){if(rN(e)||Array.isArray(e)&&e.every(rN)||_o(e)&&!e)return{type:n,message:rN(e)?e:"",ref:t}}var Fp=e=>Ws(e)&&!u_(e)?e:{value:e,message:""},WD=async(e,t,n,s,a,i)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:u,min:h,max:f,pattern:m,validate:x,name:p,valueAsNumber:v,mount:g}=e._f,y=Pt(n,p);if(!g||t.has(p))return{};const b=l?l[0]:o,w=O=>{a&&b.reportValidity&&(b.setCustomValidity(_o(O)?"":O||""),b.reportValidity())},_={},C=WO(o),E=Aj(o),N=C||E,k=(v||VO(o))&&Fs(o.value)&&Fs(y)||c_(o)&&o.value===""||y===""||Array.isArray(y)&&!y.length,I=Cbe.bind(null,p,s,_),P=(O,A,R,L=jd.maxLength,z=jd.minLength)=>{const U=O?A:R;_[p]={type:O?L:z,message:U,ref:o,...I(O?L:z,U)}};if(i?!Array.isArray(y)||!y.length:c&&(!N&&(k||wi(y))||_o(y)&&!y||E&&!MK(l).isValid||C&&!$K(l).isValid)){const{value:O,message:A}=rN(c)?{value:!!c,message:c}:Fp(c);if(O&&(_[p]={type:jd.required,message:A,ref:b,...I(jd.required,A)},!s))return w(A),_}if(!k&&(!wi(h)||!wi(f))){let O,A;const R=Fp(f),L=Fp(h);if(!wi(y)&&!isNaN(y)){const z=o.valueAsNumber||y&&+y;wi(R.value)||(O=z>R.value),wi(L.value)||(A=z<L.value)}else{const z=o.valueAsDate||new Date(y),U=ne=>new Date(new Date().toDateString()+" "+ne),$=o.type=="time",q=o.type=="week";$c(R.value)&&y&&(O=$?U(y)>U(R.value):q?y>R.value:z>new Date(R.value)),$c(L.value)&&y&&(A=$?U(y)<U(L.value):q?y<L.value:z<new Date(L.value))}if((O||A)&&(P(!!O,R.message,L.message,jd.max,jd.min),!s))return w(_[p].message),_}if((d||u)&&!k&&($c(y)||i&&Array.isArray(y))){const O=Fp(d),A=Fp(u),R=!wi(O.value)&&y.length>+O.value,L=!wi(A.value)&&y.length<+A.value;if((R||L)&&(P(R,O.message,A.message),!s))return w(_[p].message),_}if(m&&!k&&$c(y)){const{value:O,message:A}=Fp(m);if(u_(O)&&!y.match(O)&&(_[p]={type:jd.pattern,message:A,ref:o,...I(jd.pattern,A)},!s))return w(A),_}if(x){if(Wl(x)){const O=await x(y,n),A=VD(O,b);if(A&&(_[p]={...A,...I(jd.validate,A.message)},!s))return w(A.message),_}else if(Ws(x)){let O={};for(const A in x){if(!Wi(O)&&!s)break;const R=VD(await x[A](y,n),b,A);R&&(O={...R,...I(A,R.message)},w(R.message),s&&(_[p]=O))}if(!Wi(O)&&(_[p]={ref:b,...O},!s))return _}}return w(!0),_};const Fbe={mode:Vl.onSubmit,reValidateMode:Vl.onChange,shouldFocusError:!0};function Bbe(e={}){let t={...Fbe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Wl(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},a=Ws(t.defaultValues)||Ws(t.values)?ua(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:ua(a),o={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let h={...u};const f={array:RD(),state:RD()},m=t.criteriaMode===Vl.all,x=he=>ye=>{clearTimeout(d),d=setTimeout(he,ye)},p=async he=>{if(!t.disabled&&(u.isValid||h.isValid||he)){const ye=t.resolver?Wi((await E()).errors):await k(s,!0);ye!==n.isValid&&f.state.next({isValid:ye})}},v=(he,ye)=>{!t.disabled&&(u.isValidating||u.validatingFields||h.isValidating||h.validatingFields)&&((he||Array.from(l.mount)).forEac
vendor: 4,329 bytes, line 879
879h(Ee=>{Ee&&(ye?Yn(n.validatingFields,Ee,ye):Xs(n.validatingFields,Ee))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Wi(n.validatingFields)}))},g=(he,ye=[],Ee,Fe,tt=!0,qe=!0)=>{if(Fe&&Ee&&!t.disabled){if(o.action=!0,qe&&Array.isArray(Pt(s,he))){const st=Ee(Pt(s,he),Fe.argA,Fe.argB);tt&&Yn(s,he,st)}if(qe&&Array.isArray(Pt(n.errors,he))){const st=Ee(Pt(n.errors,he),Fe.argA,Fe.argB);tt&&Yn(n.errors,he,st),Dbe(n.errors,he)}if((u.touchedFields||h.touchedFields)&&qe&&Array.isArray(Pt(n.touchedFields,he))){const st=Ee(Pt(n.touchedFields,he),Fe.argA,Fe.argB);tt&&Yn(n.touchedFields,he,st)}(u.dirtyFields||h.dirtyFields)&&(n.dirtyFields=hy(a,i)),f.state.next({name:he,isDirty:P(he,ye),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Yn(i,he,ye)},y=(he,ye)=>{Yn(n.errors,he,ye),f.state.next({errors:n.errors})},b=he=>{n.errors=he,f.state.next({errors:n.errors,isValid:!1})},w=(he,ye,Ee,Fe)=>{const tt=Pt(s,he);if(tt){const qe=Pt(i,he,Fs(Ee)?Pt(a,he):Ee);Fs(qe)||Fe&&Fe.defaultChecked||ye?Yn(i,he,ye?qe:FD(tt._f)):R(he,qe),o.mount&&p()}},_=(he,ye,Ee,Fe,tt)=>{let qe=!1,st=!1;const Ct={name:he};if(!t.disabled){if(!Ee||Fe){(u.isDirty||h.isDirty)&&(st=n.isDirty,n.isDirty=Ct.isDirty=P(),qe=st!==Ct.isDirty);const ke=Dd(Pt(a,he),ye);st=!!Pt(n.dirtyFields,he),ke?Xs(n.dirtyFields,he):Yn(n.dirtyFields,he,!0),Ct.dirtyFields=n.dirtyFields,qe=qe||(u.dirtyFields||h.dirtyFields)&&st!==!ke}if(Ee){const ke=Pt(n.touchedFields,he);ke||(Yn(n.touchedFields,he,Ee),Ct.touchedFields=n.touchedFields,qe=qe||(u.touchedFields||h.touchedFields)&&ke!==Ee)}qe&&tt&&f.state.next(Ct)}return qe?Ct:{}},C=(he,ye,Ee,Fe)=>{const tt=Pt(n.errors,he),qe=(u.isValid||h.isValid)&&_o(ye)&&n.isValid!==ye;if(t.delayError&&Ee?(c=x(()=>y(he,Ee)),c(t.delayError)):(clearTimeout(d),c=null,Ee?Yn(n.errors,he,Ee):Xs(n.errors,he)),(Ee?!Dd(tt,Ee):tt)||!Wi(Fe)||qe){const st={...Fe,...qe&&_o(ye)?{isValid:ye}:{},errors:n.errors,name:he};n={...n,...st},f.state.next(st)}},E=async he=>{v(he,!0);const ye=await t.resolver(i,t.context,Tbe(he||l.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return v(he),ye},N=async he=>{const{errors:ye}=await E(he);if(he)for(const Ee of he){const Fe=Pt(ye,Ee);Fe?Yn(n.errors,Ee,Fe):Xs(n.errors,Ee)}else n.errors=ye;return ye},k=async(he,ye,Ee={valid:!0})=>{for(const Fe in he){const tt=he[Fe];if(tt){const{_f:qe,...st}=tt;if(qe){const Ct=l.array.has(qe.name),ke=tt._f&&Obe(tt._f);ke&&u.validatingFields&&v([Fe],!0);const Ie=await WD(tt,l.disabled,i,m,t.shouldUseNativeValidation&&!ye,Ct);if(ke&&u.validatingFields&&v([Fe]),Ie[qe.name]&&(Ee.valid=!1,ye))break;!ye&&(Pt(Ie,qe.name)?Ct?$be(n.errors,Ie,qe.name):Yn(n.errors,qe.name,Ie[qe.name]):Xs(n.errors,qe.name))}!Wi(st)&&await k(st,ye,Ee)}}return Ee.valid},I=()=>{for(const he of l.unMount){const ye=Pt(s,he);ye&&(ye._f.refs?ye._f.refs.every(Ee=>!vk(Ee)):!vk(ye._f.ref))&&pe(he)}l.unMount=new Set},P=(he,ye)=>!t.disabled&&(he&&ye&&Yn(i,he,ye),!Dd(ne(),a)),O=(he,ye,Ee)=>OK(he,l,{...o.mount?i:Fs(ye)?a:$c(he)?{[he]:ye}:ye},Ee,ye),A=he=>BO(Pt(o.mount?i:a,he,t.shouldUnregister?Pt(a,he,[]):[])),R=(he,ye,Ee={})=>{const Fe=Pt(s,he);let tt=ye;if(Fe){const qe=Fe._f;qe&&(!qe.disabled&&Yn(i,he,DK(ye,qe)),tt=c_(qe.ref)&&wi(ye)?"":ye,LK(qe.ref)?[...qe.ref.options].forEach(st=>st.selected=tt.includes(st.value)):qe.refs?Aj(qe.ref)?qe.refs.forEach(st=>{(!st.defaultChecked||!st.disabled)&&(Array.isArray(tt)?st.checked=!!tt.find(Ct=>Ct===st.value):st.checked=tt===st.value||!!tt)}):qe.refs.forEach(st=>st.checked=st.value===tt):VO(qe.ref)?qe.ref.value="":(qe.ref.value=tt,qe.ref.type||f.state.next({name:he,values:ua(i)})))}(Ee.shouldDirty||Ee.shouldTouch)&&_(he,tt,Ee.shouldTouch,Ee.shouldDirty,!0),Ee.shouldValidate&&q(he)},L=(he,ye,Ee)=>{for(const Fe in ye){if(!ye.hasOwnProperty(Fe))return;const tt=ye[Fe],qe=he+"."+Fe,st=Pt(s,qe);(l.array.has(he)||Ws(tt)||st&&!st._f)&&!Yf(tt)?L(qe,tt,Ee):R(qe,tt,Ee)}},z=(he,ye,Ee={})=>{const Fe=Pt(s,he),tt=l.array.has(he),qe=ua(ye);Yn(i,he,qe),tt?(f.array.next({name:he,values:ua(i)}),(u.isDirty||u.dirtyFields||h.isDirty||h.dirtyFields)&&Ee.shouldDirty&&f.state.next({name:he,dirtyFields:hy(a,i),isDirty:P(he,qe)})):Fe&&!Fe._f&&!wi(qe)?L(he,qe,Ee):R(he,qe,Ee),zD(he,l)&&f.state.next({...n,name:he}),f.state.next({name:o.mount?he:void 0,values:ua(i)})},U=async he=>{o.mount=!0;const ye=he.target;let Ee=ye.name,Fe=!0;
vendor: 4,284 bytes, line 879
879const tt=Pt(s,Ee),qe=ke=>{Fe=Number.isNaN(ke)||Yf(ke)&&isNaN(ke.getTime())||Dd(ke,Pt(i,Ee,ke))},st=BD(t.mode),Ct=BD(t.reValidateMode);if(tt){let ke,Ie;const at=ye.type?FD(tt._f):PK(he),rt=he.type===l_.BLUR||he.type===l_.FOCUS_OUT,Gt=!Lbe(tt._f)&&!t.resolver&&!Pt(n.errors,Ee)&&!tt._f.deps||Mbe(rt,Pt(n.touchedFields,Ee),n.isSubmitted,Ct,st),gt=zD(Ee,l,rt);Yn(i,Ee,at),rt?(tt._f.onBlur&&tt._f.onBlur(he),c&&c(0)):tt._f.onChange&&tt._f.onChange(he);const Zt=_(Ee,at,rt),dr=!Wi(Zt)||gt;if(!rt&&f.state.next({name:Ee,type:he.type,values:ua(i)}),Gt)return(u.isValid||h.isValid)&&(t.mode==="onBlur"?rt&&p():rt||p()),dr&&f.state.next({name:Ee,...gt?{}:Zt});if(!rt&>&&f.state.next({...n}),t.resolver){const{errors:Fr}=await E([Ee]);if(qe(at),Fe){const Tt=qD(n.errors,s,Ee),Br=qD(Fr,s,Tt.name||Ee);ke=Br.error,Ee=Br.name,Ie=Wi(Fr)}}else v([Ee],!0),ke=(await WD(tt,l.disabled,i,m,t.shouldUseNativeValidation))[Ee],v([Ee]),qe(at),Fe&&(ke?Ie=!1:(u.isValid||h.isValid)&&(Ie=await k(s,!0)));Fe&&(tt._f.deps&&q(tt._f.deps),C(Ee,Ie,ke,Zt))}},$=(he,ye)=>{if(Pt(n.errors,ye)&&he.focus)return he.focus(),1},q=async(he,ye={})=>{let Ee,Fe;const tt=i0(he);if(t.resolver){const qe=await N(Fs(he)?he:tt);Ee=Wi(qe),Fe=he?!tt.some(st=>Pt(qe,st)):Ee}else he?(Fe=(await Promise.all(tt.map(async qe=>{const st=Pt(s,qe);return await k(st&&st._f?{[qe]:st}:st)}))).every(Boolean),!(!Fe&&!n.isValid)&&p()):Fe=Ee=await k(s);return f.state.next({...!$c(he)||(u.isValid||h.isValid)&&Ee!==n.isValid?{}:{name:he},...t.resolver||!he?{isValid:Ee}:{},errors:n.errors}),ye.shouldFocus&&!Fe&&o0(s,$,he?tt:l.mount),Fe},ne=he=>{const ye={...o.mount?i:a};return Fs(he)?ye:$c(he)?Pt(ye,he):he.map(Ee=>Pt(ye,Ee))},se=(he,ye)=>({invalid:!!Pt((ye||n).errors,he),isDirty:!!Pt((ye||n).dirtyFields,he),error:Pt((ye||n).errors,he),isValidating:!!Pt(n.validatingFields,he),isTouched:!!Pt((ye||n).touchedFields,he)}),F=he=>{he&&i0(he).forEach(ye=>Xs(n.errors,ye)),f.state.next({errors:he?n.errors:{}})},V=(he,ye,Ee)=>{const Fe=(Pt(s,he,{_f:{}})._f||{}).ref,tt=Pt(n.errors,he)||{},{ref:qe,message:st,type:Ct,...ke}=tt;Yn(n.errors,he,{...ke,...ye,ref:Fe}),f.state.next({name:he,errors:n.errors,isValid:!1}),Ee&&Ee.shouldFocus&&Fe&&Fe.focus&&Fe.focus()},Z=(he,ye)=>Wl(he)?f.state.subscribe({next:Ee=>"values"in Ee&&he(O(void 0,ye),Ee)}):O(he,ye,!0),de=he=>f.state.subscribe({next:ye=>{Rbe(he.name,ye.name,he.exact)&&Ibe(ye,he.formState||u,kt,he.reRenderRoot)&&he.callback({values:{...i},...n,...ye,defaultValues:a})}}).unsubscribe,ve=he=>(o.mount=!0,h={...h,...he.formState},de({...he,formState:h})),pe=(he,ye={})=>{for(const Ee of he?i0(he):l.mount)l.mount.delete(Ee),l.array.delete(Ee),ye.keepValue||(Xs(s,Ee),Xs(i,Ee)),!ye.keepError&&Xs(n.errors,Ee),!ye.keepDirty&&Xs(n.dirtyFields,Ee),!ye.keepTouched&&Xs(n.touchedFields,Ee),!ye.keepIsValidating&&Xs(n.validatingFields,Ee),!t.shouldUnregister&&!ye.keepDefaultValue&&Xs(a,Ee);f.state.next({values:ua(i)}),f.state.next({...n,...ye.keepDirty?{isDirty:P()}:{}}),!ye.keepIsValid&&p()},_e=({disabled:he,name:ye})=>{(_o(he)&&o.mount||he||l.disabled.has(ye))&&(he?l.disabled.add(ye):l.disabled.delete(ye))},xe=(he,ye={})=>{let Ee=Pt(s,he);const Fe=_o(ye.disabled)||_o(t.disabled);return Yn(s,he,{...Ee||{},_f:{...Ee&&Ee._f?Ee._f:{ref:{name:he}},name:he,mount:!0,...ye}}),l.mount.add(he),Ee?_e({disabled:_o(ye.disabled)?ye.disabled:t.disabled,name:he}):w(he,!0,ye.value),{...Fe?{disabled:ye.disabled||t.disabled}:{},...t.progressive?{required:!!ye.required,min:fy(ye.min),max:fy(ye.max),minLength:fy(ye.minLength),maxLength:fy(ye.maxLength),pattern:fy(ye.pattern)}:{},name:he,onChange:U,onBlur:U,ref:tt=>{if(tt){xe(he,ye),Ee=Pt(s,he);const qe=Fs(tt.value)&&tt.querySelectorAll&&tt.querySelectorAll("input,select,textarea")[0]||tt,st=Abe(qe),Ct=Ee._f.refs||[];if(st?Ct.find(ke=>ke===qe):qe===Ee._f.ref)return;Yn(s,he,{_f:{...Ee._f,...st?{refs:[...Ct.filter(vk),qe,...Array.isArray(Pt(a,he))?[{}]:[]],ref:{type:qe.type,name:he}}:{ref:qe}}}),w(he,!1,void 0,qe)}else Ee=Pt(s,he,{}),Ee._f&&(Ee._f.mount=!1),(t.shouldUnregister||ye.shouldUnregister)&&!(EK(l.array,he)&&o.action)&&l.unMount.add(he)}}},oe=()=>t.shouldFocusError&&o0(s,$,l.mount),we=he=>{_o(he)&&(f.state.next({disabled:he}),o0(s,(ye,Ee)=>{const Fe=Pt(s,Ee);Fe&&(ye.disabled=Fe._f.disabled||he,Array.isArray(Fe._f.refs)&&Fe._f.refs.forEac
vendor: 4,198 bytes, line 879
879h(tt=>{tt.disabled=Fe._f.disabled||he}))},0,!1))},ce=(he,ye)=>async Ee=>{let Fe;Ee&&(Ee.preventDefault&&Ee.preventDefault(),Ee.persist&&Ee.persist());let tt=ua(i);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:qe,values:st}=await E();n.errors=qe,tt=ua(st)}else await k(s);if(l.disabled.size)for(const qe of l.disabled)Xs(tt,qe);if(Xs(n.errors,"root"),Wi(n.errors)){f.state.next({errors:{}});try{await he(tt,Ee)}catch(qe){Fe=qe}}else ye&&await ye({...n.errors},Ee),oe(),setTimeout(oe);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Wi(n.errors)&&!Fe,submitCount:n.submitCount+1,errors:n.errors}),Fe)throw Fe},De=(he,ye={})=>{Pt(s,he)&&(Fs(ye.defaultValue)?z(he,ua(Pt(a,he))):(z(he,ye.defaultValue),Yn(a,he,ua(ye.defaultValue))),ye.keepTouched||Xs(n.touchedFields,he),ye.keepDirty||(Xs(n.dirtyFields,he),n.isDirty=ye.defaultValue?P(he,ua(Pt(a,he))):P()),ye.keepError||(Xs(n.errors,he),u.isValid&&p()),f.state.next({...n}))},Ue=(he,ye={})=>{const Ee=he?ua(he):a,Fe=ua(Ee),tt=Wi(he),qe=tt?a:Fe;if(ye.keepDefaultValues||(a=Ee),!ye.keepValues){if(ye.keepDirtyValues){const st=new Set([...l.mount,...Object.keys(hy(a,i))]);for(const Ct of Array.from(st))Pt(n.dirtyFields,Ct)?Yn(qe,Ct,Pt(i,Ct)):z(Ct,Pt(qe,Ct))}else{if(FO&&Fs(he))for(const st of l.mount){const Ct=Pt(s,st);if(Ct&&Ct._f){const ke=Array.isArray(Ct._f.refs)?Ct._f.refs[0]:Ct._f.ref;if(c_(ke)){const Ie=ke.closest("form");if(Ie){Ie.reset();break}}}}if(ye.keepFieldsRef)for(const st of l.mount)z(st,Pt(qe,st));else s={}}i=t.shouldUnregister?ye.keepDefaultValues?ua(a):{}:ua(qe),f.array.next({values:{...qe}}),f.state.next({values:{...qe}})}l={mount:ye.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!ye.keepIsValid||!!ye.keepDirtyValues,o.watch=!!t.shouldUnregister,f.state.next({submitCount:ye.keepSubmitCount?n.submitCount:0,isDirty:tt?!1:ye.keepDirty?n.isDirty:!!(ye.keepDefaultValues&&!Dd(he,a)),isSubmitted:ye.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:tt?{}:ye.keepDirtyValues?ye.keepDefaultValues&&i?hy(a,i):n.dirtyFields:ye.keepDefaultValues&&he?hy(a,he):ye.keepDirty?n.dirtyFields:{},touchedFields:ye.keepTouched?n.touchedFields:{},errors:ye.keepErrors?n.errors:{},isSubmitSuccessful:ye.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},re=(he,ye)=>Ue(Wl(he)?he(i):he,ye),et=(he,ye={})=>{const Ee=Pt(s,he),Fe=Ee&&Ee._f;if(Fe){const tt=Fe.refs?Fe.refs[0]:Fe.ref;tt.focus&&(tt.focus(),ye.shouldSelect&&Wl(tt.select)&&tt.select())}},kt=he=>{n={...n,...he}},Ve={control:{register:xe,unregister:pe,getFieldState:se,handleSubmit:ce,setError:V,_subscribe:de,_runSchema:E,_focusError:oe,_getWatch:O,_getDirty:P,_setValid:p,_setFieldArray:g,_setDisabledField:_e,_setErrors:b,_getFieldArray:A,_reset:Ue,_resetDefaultValues:()=>Wl(t.defaultValues)&&t.defaultValues().then(he=>{re(he,t.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:we,_subjects:f,_proxyFormState:u,get _fields(){return s},get _formValues(){return i},get _state(){return o},set _state(he){o=he},get _defaultValues(){return a},get _names(){return l},set _names(he){l=he},get _formState(){return n},get _options(){return t},set _options(he){t={...t,...he}}},subscribe:ve,trigger:q,register:xe,handleSubmit:ce,watch:Z,setValue:z,getValues:ne,reset:re,resetField:De,clearErrors:F,unregister:pe,setError:V,setFocus:et,getFieldState:se};return{...Ve,formControl:Ve}}function lu(e={}){const t=ee.useRef(void 0),n=ee.useRef(void 0),[s,a]=ee.useState({isDirty:!1,isValidating:!1,isLoading:Wl(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Wl(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!Wl(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=Bbe(e);t.current={...l,formState:s}}const i=t.current.control;return i._options=e,qO(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>a({...i._formState}
879),reRenderRoot:!0});return a(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),ee.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),ee.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),ee.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),ee.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),ee.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==s.isDirty&&i._subjects.state.next({isDirty:o})}},[i,s.isDirty]),ee.useEffect(()=>{e.values&&!Dd(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),n.current=e.values,a(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),ee.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=TK(s,i),t.current}const tf=wbe,FK=j.createContext({}),Ze=({...e})=>r.jsx(FK.Provider,{value:{name:e.name},children:r.jsx(kbe,{...e})}),AS=()=>{const e=j.useContext(FK),t=j.useContext(BK),{getFieldState:n,formState:s}=CS(),a=n(e.name,s);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...a}},BK=j.createContext({}),Ke=j.forwardRef(({className:e,...t},n)=>{const s=j.useId();return r.jsx(BK.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:Ge("space-y-2",e),...t})})});Ke.displayName="FormItem";const nt=j.forwardRef(({className:e,...t},n)=>{const{error:s,formItemId:a}=AS();return r.jsx(le,{ref:n,className:Ge(s&&"text-destructive",e),htmlFor:a,...t})});nt.displayName="FormLabel";const it=j.forwardRef(({...e},t)=>{const{error:n,formItemId:s,formDescriptionId:a,formMessageId:i}=AS();return r.jsx(mq,{ref:t,id:s,"aria-describedby":n?`${a} ${i}`:`${a}`,"aria-invalid":!!n,...e})});it.displayName="FormControl";const Pr=j.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:s}=AS();return r.jsx("p",{ref:n,id:s,className:Ge("text-sm text-muted-foreground",e),...t})});Pr.displayName="FormDescription";const Qe=j.forwardRef(({className:e,children:t,...n},s)=>{const{error:a,formMessageId:i}=AS(),o=a?String(a==null?void 0:a.message):t;return o?r.jsx("p",{ref:s,id:i,className:Ge("text-sm font-medium text-destructive",e),...n,children:o}):null});Qe.displayName="FormMessage";var HO="Progress",GO=100,[Ube,VJe]=ea(HO),[zbe,qbe]=Ube(HO),UK=j.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:i=Vbe,...o}=e;(a||a===0)&&!HD(a)&&console.error(Wbe(`${a}`,"Progress"));const l=HD(a)?a:GO;s!==null&&!GD(s,l)&&console.error(Hbe(`${s}`,"Progress"));const c=GD(s,l)?s:null,d=h_(c)?i(c,l):void 0;return r.jsx(zbe,{scope:n,value:c,max:l,children:r.jsx(Lt.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":h_(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":VK(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});UK.displayName=HO;var zK="ProgressIndicator",qK=j.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,a=qbe(zK,n);return r.jsx(Lt.div,{"data-state":VK(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:t})});qK.displayName=zK;function Vbe(e,t){return`${Math.round(e/t*100)}%`}function VK(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function h_(e){return typeof e=="number"}function HD(e){return h_(e)&&!isNaN(e)&&e>0}function GD(e,t){return h_(e)&&!isNaN(e)&&e<=t&&e>=0}function Wbe(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${GO}\`.`}function Hbe(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: 880 - a positive number 881 - less than the value passed to \`max\` (or ${GO} if no \`max\` prop is set) 882 - \`null\` or \`undefined\` if the progress is indeterminate. 883 884Defaulting to \`null\`.`}var WK=UK,Gbe=qK;const gx=j.forwardRef(({className:e,value:t,...n},s)=>r.jsx(WK,{ref:s,className:Ge("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:r.jsx(Gbe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));gx.displayName=WK.displayName;const Xo={TITLE:50,DESCRIPTION:500,TAGS:50},Eg=({onSuccess:e})=>{var C,E;const{user:t}=bt(),{toast:n}=Sn(),s=lu({defaultValues:{is_premium:!1}}),[a,i]=j.useState(!1),[o,l]=j.useState(0),[c,d]=j.useState(null),[u,h]=j.useState(!1),[f,m]=j.useState(null);j.useEffect(()=>{(async()=>
884{if(!t)return;const{data:k}=await H.rpc("check_content_limits",{user_id:t.id});m(k)})()},[t]);const x=[{value:"video",label:"Video",icon:r.jsx(ij,{className:"h-4 w-4"}),bucket:"content-videos",accept:".mp4,.mov,.avi,.mkv"},{value:"audio",label:"Audio",icon:r.jsx(ET,{className:"h-4 w-4"}),bucket:"content-audio",accept:".mp3,.wav,.m4a,.flac"},{value:"image",label:"Image",icon:r.jsx(no,{className:"h-4 w-4"}),bucket:"content-images",accept:".jpg,.jpeg,.png,.gif,.webp"},{value:"document",label:"Document",icon:r.jsx(Ca,{className:"h-4 w-4"}),bucket:"content-documents",accept:".pdf,.doc,.docx,.txt"}],p=["Music","Film","Art","Comedy","Education","News","Sports","Technology","Fashion","Food","Travel","Culture","Literature","Others"],v=N=>{var I;const k=(I=N.target.files)==null?void 0:I[0];k&&d(k)},g=async(N,k)=>{const I=x.find(U=>U.value===k);if(!I)throw new Error("Invalid content type");const P=N.name.split(".").pop(),O=`${t==null?void 0:t.id}/${Date.now()}.${P}`,A=I.bucket,R=setInterval(()=>{l(U=>Math.min(U+10,90))},100),{error:L}=await H.storage.from(A).upload(O,N);if(clearInterval(R),l(100),L)throw L;const{data:z}=H.storage.from(A).getPublicUrl(O);return z.publicUrl},y=async N=>{if(!t){n({title:"Please login to submit content",variant:"destructive"});return}if(f&&!f.can_create_listing){n({title:"Listing limit reached. Please upgrade your plan.",variant:"destructive"});return}if(!c){n({title:"Please select a file to upload",variant:"destructive"});return}if(N.title.length>Xo.TITLE){n({title:"Title too long",description:`Title must be ${Xo.TITLE} characters or less`,variant:"destructive"});return}if(N.description.length>Xo.DESCRIPTION){n({title:"Description too long",description:`Description must be ${Xo.DESCRIPTION} characters or less`,variant:"destructive"});return}if(N.tags.length>Xo.TAGS){n({title:"Tags too long",description:`Tags must be ${Xo.TAGS} characters or less`,variant:"destructive"});return}i(!0),l(0);try{const k=await g(c,N.content_type);let I=null;N.content_type==="image"&&(I=k);const{error:P}=await H.from("content").insert([{...N,creator_id:t.id,content_url:k,thumbnail_url:I,tags:N.tags.split(",").map(O=>O.trim()).filter(Boolean).slice(0,30),status:"draft",moderation_status:"pending",is_premium:u,price:u?N.price:null,currency:"NGN"}]);if(P)throw P;n({title:"Content submitted successfully!",description:"Your content is now under review."}),s.reset(),d(null),l(0),e&&e()}catch(k){console.error("Upload error:",k),n({title:"Upload failed",description:k.message||"Please try again",variant:"destructive"})}finally{i(!1),l(0)}},b=()=>{d(null),l(0)},w=s.watch("content_type"),_=((C=x.find(N=>N.value===w))==null?void 0:C.accept)||"";return r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(Jn,{className:"h-6 w-6 text-primary"}),"Submit Your Content"]}),r.jsx(Nt,{children:"Share your creativity with the Nigerian community"})]}),r.jsx(X,{children:r.jsx(tf,{...s,children:r.jsxs("form",{onSubmit:s.handleSubmit(y),className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:s.control,name:"title",render:({field:N})=>{var k;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Content Title"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Enter content title",maxLength:Xo.TITLE,...N})}),r.jsxs(Pr,{children:[((k=N.value)==null?void 0:k.length)||0," / ",Xo.TITLE," characters"]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:s.control,name:"content_type",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Content Type"}),r.jsxs(mt,{onValueChange:N.onChange,defaultValue:N.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select content type"})})}),r.jsx(ht,{children:x.map(k=>r.jsx(Ne,{value:k.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[k.icon,k.label]})},k.value))})]}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:s.control,name:"description",render:({field:N})=>{var k;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Description"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Describe your content...",className:"min-h-[120px]",maxLength:Xo.DESCRIPTION,...N})}),r.jsxs(Pr,{children:[((k=N.value)==null?void 0:k.length)||0," / ",Xo.DESCRIPTION," characters"]}),r.jsx(Qe,{})]})}}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:s.control,name:"category",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Category"}),r.jsxs(mt,{onValueChange:N.onChange,defaultValue:N.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select category"})})}),r.jsx(ht,{children:p.map(k=>r.jsx(Ne,{value:k,children:k},k))})]}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:s.control,name:"tags",render:({field:N})=>{var k;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Tags"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"music, lagos, afrobeats (comma separated)",maxLength:Xo.TAGS,...N})}),r.jsxs(Pr,{children:[((k=N.value)==null?void 0:k.length)||0," / ",Xo.TAGS," characters (max 30 tags)"]}),r.jsx(Qe,{})]})}})]}),w==="video"||w==="audio"?r.jsx(Ze,{control:s.control,name:"duration",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Duration (seconds)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"120",min:"0",max:"86400",...N,onChange:k=>N.onChange(Number(k.target.value))})}),r.jsxs(Pr,{children:["Duration of your ",w," content in seconds (max 24 hours)"]}),r.jsx(Qe,{})]})}):null,r.jsxs("div",{className:"space-y-4 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"text-base font-semibold flex items-center gap-2",children:[r.jsx(Tn,{className:"h-5 w-5"}),"Premium Content"]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Charge viewers to access this content. You earn 85% of each sale."})]}),r.jsx(Ro,{checked:u,onCheckedChange:h})]}),u&&r.jsx(Ze,{control:s.control,name:"price",render:({field:N})=>r.jsxs(Ke,{className:"pt-2",children:[r.jsx(nt,{children:"Price (â¦)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"e.g., 500",min:"50",max:"1000000",step:"50",...N,onChange:k=>N.onChange(Number(k.target.value))})}),r.jsxs(Pr,{children:["Platform fee: 15% | You receive: â¦",N.value?(N.value*.85).toFixed(2):"0"]}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(nt,{children:"Upload File"}),c?r.jsxs("div",{className:"border border-primary/20 rounded-lg p-4 bg-muted/20",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[(E=x.find(N=>N.value===w))==null?void 0:E.icon,r.jsx("span",{className:"font-medium",children:c.name})]}),r.jsx(W,{type:"button",variant:"ghost",size:"sm",onClick:b,disabled:a,children:r.jsx(ks,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Size: ",(c.size/(1024*1024)).toFixed(2)," MB"]}),a&&r.jsxs("div",{className:"mt-4",children:[r.jsx(gx,{value:o,className:"w-full"}),r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Uploading... ",Math.round(o),"%"]})]})]}):r.jsxs("div",{className:"relative border-2 border-dashed border-primary/20 rounded-lg p-8 text-center hover:border-primary/40 transition-colors",children:[r.jsx(Jn,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-lg font-medium",children:"Select a file to upload"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:w?`Accepted formats: ${_}`:"Select content type first"})]}
884),r.jsx("input",{type:"file",accept:_,onChange:v,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!w||a})]})]}),r.jsxs(W,{type:"submit",className:"w-full bg-gradient-hero hover:opacity-90",size:"lg",disabled:a||!c,children:[r.jsx(Jn,{className:"h-5 w-5 mr-2"}),a?"Uploading...":"Submit Content"]})]})})})]})},Ybe=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,YO=({title:e="Stay Connected",description:t="Get the latest updates on Nigerian content, events, and marketplace deals.",className:n="",tag:s="naija-weekly"})=>{const[a,i]=j.useState(""),[o,l]=j.useState("idle"),[c,d]=j.useState(""),u=async h=>{var m,x;h.preventDefault();const f=a.trim().toLowerCase();if(!Ybe.test(f)){l("error"),d("That email address does not look right. Please check it and try again.");return}l("submitting"),d("");try{const{supabase:p}=await Vc(async()=>{const{supabase:y}=await Promise.resolve().then(()=>_W);return{supabase:y}},void 0),{data:v,error:g}=await p.functions.invoke("newsletter-subscribe",{body:{email:f,source:typeof window<"u"?window.location.href:"website",tag:s}});if(g){const y=await((x=(m=g.context)==null?void 0:m.text)==null?void 0:x.call(m).catch(()=>null)),b=y?JSON.parse(y):null;throw new Error((b==null?void 0:b.error)||"Could not reach the sign-up service.")}if(v!=null&&v.ok)l("success"),d("You are on the list. The next digest lands in your inbox s
884oon."),i("");else throw new Error("The sign-up was not accepted. Please try again.")}catch(p){console.error("newsletter sign-up failed",p),l("error"),d(p instanceof Error&&p.message?p.message:"Something went wrong. Please try again in a moment.")}};return r.jsxs(Y,{className:`bg-gradient-card border-primary/20 ${n}`,children:[r.jsxs(Se,{className:"text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary",children:r.jsx(Dn,{className:"h-6 w-6 text-primary-foreground"})}),r.jsx(Ae,{className:"text-xl font-bold",children:e}),r.jsx(Nt,{className:"text-muted-foreground",children:t})]}),r.jsx(X,{children:o==="success"?r.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-primary/30 bg-primary/5 p-3 text-sm",children:[r.jsx(Rd,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),r.jsx("span",{children:c})]}):r.jsxs("form",{onSubmit:u,className:"flex flex-col space-y-3",children:[r.jsx(ge,{type:"email",placeholder:"Enter your email",value:a,onChange:h=>i(h.target.value),required:!0,className:"w-full",disabled:o==="submitting"}),r.jsx(W,{type:"submit",disabled:o==="submitting"||!a,className:"w-full bg-gradient-hero hover:opacity-90",children:o==="submitting"?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Subscribing..."]}):"Subscribe"}),o==="error"?r.jsxs("p",{className:"flex items-start gap-2 text-xs text-destructive",children:[r.jsx(vn,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),c]}):r.jsx("p",{className:"text-[11px] text-muted-foreground text-center",children:"One digest a week. Unsubscribe any time."})]})})]})},OP="pendingListingIntent";function Ba({label:e,intentKey:t,onOpen:n,icon:s=xs,size:a="lg",variant:i="secondary",className:o}){const{user:l}=bt(),c=zn(),d=Ri(),u=()=>{if(l){n();return}try{sessionStorage.setItem("redirectAfterLogin",d.pathname+d.search),sessionStorage.setItem(OP,t),sessionStorage.setItem("loginPromptMessage",`Sign in to continue: ${e}`)}catch{}c("/auth")};return r.jsxs(W,{size:a,variant:i,className:`gap-2 ${o??""}`,onClick:u,children:[r.jsx(s,{className:"h-5 w-5"}),e]})}function sc(e,t){const{user:n}=bt();j.useEffect(()=>{if(n)try{sessionStorage.getItem(OP)===e&&(sessionStorage.removeItem(OP),t())}catch{}},[n,e])}function ac({className:e}){const{user:t}=bt();return t?null:r.jsx("p",{className:e?`text-xs ${e}`:"text-xs text-white/80",children:"Free to list â sign in or create an account to continue."})}const Kbe={news:"https://images.unsplash.com/photo-1504711434969-e33886168f5c?w=1920&q=80&auto=format&fit=crop",events:"https://images.unsplash.com/photo-1492684223066-81342ee5ff30?w=1920&q=80&auto=format&fit=crop",marketplace:"https://images.unsplash.com/photo-1555529669-e69e7aa0ba9a?w=1920&q=80&auto=format&fit=crop",classifieds:"https://images.unsplash.com/photo-1521737711867-e3b97375f902?w=1920&q=80&auto=format&fit=crop",artisans:"https://images.unsplash.com/photo-1452860606245-08befc0ff44b?w=1920&q=80&auto=format&fit=crop",restaurants:"https://images.unsplash.com/photo-1414235077428-338989a2e8c0?w=1920&q=80&auto=format&fit=crop",tourism:"https://images.unsplash.com/photo-1523805009345-7448845a9e53?w=1920&q=80&auto=format&fit=crop",lodging:"https://images.unsplash.com/photo-1566073771259-6a8506099945?w=1920&q=80&auto=format&fit=crop",rentals:"https://images.unsplash.com/photo-1449965408869-eaa3f722e40d?w=1920&q=80&auto=format&fit=crop",creativity:"https://images.unsplash.com/photo-1460661419201-fd4cecdf8a8b?w=1920&q=80&auto=format&fit=crop",diaspora:"https://images.unsplash.com/photo-1526778548025-fa2f459cd5c1?w=1920&q=80&auto=format&fit=crop"},Xbe={news:"from-emerald-900/80 via-emerald-800/60 to-amber-900/40",events:"from-purple-900/80 via-fuchsia-800/60 to-pink-900/40",marketplace:"from-orange-900/80 via-amber-800/60 to-yellow-900/40",classifieds:"from-blue-900/80 via-cyan-800/60 to-teal-900/40",artisans:"from-emerald-900/80 via-green-800/60 to-teal-900/40",restaurants:"from-red-900/80 via-orange-800/60 to-amber-900/40",tourism:"from-teal-900/80 via-emerald-800/60 to-green-900/40",lodging:"from-indigo-900/80 via-blue-800/60 to-cyan-900/40",rentals:"from-slate-900/80 via-zinc-800/60 to-neutral-900/40",creativity:"from-fuchsia-900/80 via-purple-800/60 to-violet-900/40",diaspora:"from-green-900/80 via-emerald-800/60 to-amber-900/40"};
884function oo({title:e,subtitle:t,variant:n,icon:s,badge:a,searchComponent:i,actionButtons:o,children:l,className:c}){const d=Kbe[n],u=Xbe[n];return r.jsxs("section",{className:Ge("relative min-h-[400px] md:min-h-[450px] lg:min-h-[500px] flex items-center overflow-hidden",c),children:[r.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat scale-105 transform transition-transform duration-700",style:{backgroundImage:`url(${d})`}}),r.jsx("div",{className:"absolute inset-0 bg-black/50"}),r.jsx("div",{className:Ge("absolute inset-0 bg-gradient-to-br mix-blend-multiply",u)}),r.jsx("div",{className:"absolute inset-0 opacity-20 bg-[url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii43NSIgc3RpdGNoVGlsZXM9InN0aXRjaCIgdHlwZT0iZnJhY3RhbE5vaXNlIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNhKSIvPjwvc3ZnPg==')]"}),r.jsx("div",{className:"container relative z-10 max-w-6xl mx-auto px-4 py-16 md:py-20 lg:py-24",children:r.jsxs("div",{className:"text-center",children:[a&&r.jsx("div",{className:"flex justify-center mb-6",children:r.jsxs(te,{variant:"outline",className:"bg-white/10 backdrop-blur-md border-white/30 text-white px-4 py-2 text-sm font-medium",children:[a.icon&&r.jsx(a.icon,{className:"h-4 w-4 mr-2"}),a.text]})}),s&&r.jsx("div",{className:"flex justify-center mb-6",children:r.jsx("div",{className:"p-4 rounded-2xl bg-white/10 backdrop-blur-sm border border-white/20",children:r.jsx(s,{className:"h-12 w-12 md:h-16 md:w-16 text-white"})})}),r.jsx("h1",{className:Ge("text-3xl md:text-4xl lg:text-5xl xl:text-6xl font-extrabold text-white mb-4","drop-shadow-2xl","[text-shadow:_0_4px_12px_rgb(0_0_0_/_40%),_0_2px_4px_rgb(0_0_0_/_30%)]"),children:e}),r.jsx("p",{className:Ge("text-lg md:text-xl lg:text-2xl text-white/90 max-w-2xl mx-auto mb-8","[text-shadow:_0_2px_8px_rgb(0_0_0_/_30%)]"),children:t}),i&&r.jsx("div",{className:"max-w-2xl mx-auto mb-6",children:i}),o&&r.jsx("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:o}),l]})}),r.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-24 bg-gradient-to-t from-background to-transparent"})]})}const yk=12,Zbe=()=>{bt(),zn();const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState([]),[o,l]=j.useState(null),[c,d]=j.useState(!0),[u,h]=j.useState(""),[f,m]=j.useState("all"),[x,p]=j.useState(1),[v,g]=j.useState(1),[y,b]=j.useState(!1);sc("creativity",()=>b(!0)),j.useEffect(()=>{w(),_()},[x]),j.useEffect(()=>{C()},[e,u,f]);const w=async()=>{d(!0);try{const N=(x-1)*yk,k=N+yk-1,{data:I,error:P,count:O}=await H.from("content").select("*",{count:"exact"}).eq("status","published").eq("moderation_status","approved").order("created_at",{ascending:!1}).range(N,k);if(P)throw P;const A=[...new Set((I==null?void 0:I.map(U=>U.creator_id).filter(Boolean))||[])],{data:R}=await H.from("profiles").select("id, full_name, username").in("id",A),L=new Map((R==null?void 0:R.map(U=>[U.id,U.full_name||U.username||"Anonymous"]))||[]),z=(I||[]).map(U=>({...U,creator_name:U.creator_id?L.get(U.creator_id):"Anonymous"}));t(z),g(Math.ceil((O||0)/yk))}catch(N){console.error("Error fetching content:",N)}finally{d(!1)}},_=async()=>{try{const{data:N,error:k}=await H.from("content").select("*").eq("status","published").eq("moderation_status","approved").order("view_count",{ascending:!1}).limit(6);if(k)throw k;const I=[...new Set((N==null?void 0:N.map(R=>R.creator_id).filter(Boolean))||[])],{data:P}=await H.from("profiles").select("id, full_name, username").in("id",I),O=new Map((P==null?void 0:P.map(R=>[R.id,R.full_name||R.username||"Anonymous"]))||[]),A=(N||[]).map(R=>({...R,creator_name:R.creator_id?O.get(R.creator_id):"Anonymous"}));s(A)}catch(N){console.error("Error fetching trending content:",N)}},C=()=>{let N=e;u&&(N=N.filter(k=>{var I,P;return k.title.toLowerCase().includes(u.toLowerCase())||((I=k.description)==null?void 0:I.toLowerCase().includes(u.toLowerCase()))||((P=k.tags)==null?void 0:P.some(O=>O.toLowerCase().includes(u.toLowerCase())))}
884)),f!=="all"&&(N=N.filter(k=>k.category===f)),i(N)},E=()=>{b(!1),w()};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Nigerian Creativity Hub | Discover Creative Content",description:"Discover amazing content from talented Nigerian creators - music, art, films, and more. Connect with Nigerian creators and discover premium content."}),r.jsx(oo,{variant:"creativity",title:"Nigerian Creativity Hub",subtitle:"Connect with Nigerian creators and discover premium content",icon:Lh,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:"Search content, creators, or categories...",value:u,onChange:N=>h(N.target.value),className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dark:bg-background/95 backdrop-blur-sm"}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"Submit Your Content",intentKey:"creativity",onOpen:()=>b(!0)}),r.jsx(ac,{})]}),r.jsx(Rt,{open:y,onOpenChange:b,children:r.jsxs(Ot,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Submit Your Content"})}),r.jsx(Eg,{onSuccess:E})]})}),r.jsx(W,{size:"lg",className:"gap-2 bg-white/20 hover:bg-white/30 text-white border border-white/30",asChild:!0,children:r.jsxs(Vt,{to:"/submit",children:[r.jsx(tc,{className:"h-5 w-5"}),"Creator Guidelines"]})})]})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsxs(Kr,{defaultValue:"trending",className:"space-y-6",children:[r.jsxs(Hr,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(Re,{value:"trending",className:"flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"}),"Trending"]}),r.jsx(Re,{value:"all",children:"All Content"})]}),r.jsx(Be,{value:"trending",className:"space-y-6",children:c?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((N,k)=>r.jsxs("div",{className:"space-y-3",children:[r.jsx(jn,{className:"h-48 w-full rounded-lg"}),r.jsx(jn,{className:"h-4 w-3/4"}),r.jsx(jn,{className:"h-4 w-1/2"})]},k))}):n.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-center mb-6",children:r.jsxs(te,{variant:"secondary",className:"text-lg px-4 py-2",children:[r.jsx(lr,{className:"h-4 w-4 mr-2 inline"}),"Most Viewed This Week"]})}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:n.map(N=>r.jsx(ID,{content:N,onSelect:()=>l(N)},N.id))})]}):r.jsx("div",{className:"text-center py-12",children:r.jsx("p",{className:"text-muted-foreground text-lg",children:"No trending content available yet."})})}),r.jsxs(Be,{value:"all",className:"space-y-6",children:[r.jsx("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:r.jsxs(mt,{value:f,onValueChange:m,children:[r.jsx(ut,{className:"w-full sm:w-[200px]",children:r.jsx(pt,{placeholder:"All Categories"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Categories"}),r.jsx(Ne,{value:"Music",children:"Music"}),r.jsx(Ne,{value:"Film",children:"Film"}),r.jsx(Ne,{value:"Art",children:"Art"}),r.jsx(Ne,{value:"Crafts",children:"Crafts"})]})]})}),c?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(12)].map((N,k)=>r.jsxs("div",{className:"space-y-3",children:[r.jsx(jn,{className:"h-48 w-full rounded-lg"}),r.jsx(jn,{className:"h-4 w-3/4"}),r.jsx(jn,{className:"h-4 w-1/2"})]},k))}):a.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(N=>r.jsx(ID,{content:N,onSelect:()=>l(N)},N.id))}),v>1&&r.jsxs("div",{className:"flex justify-center gap-2 mt-8",children:[r.jsx(W,{variant:"outline",onClick:()=>p(N=>Math.max(1,N-1)),disabled:x===1,children:"Previous"}),r.jsx("div",{className:"flex items-center gap-2",children:[...Array(v)].map((N,k)=>r.jsx(W,{variant:x===k+1?"default":"outline",onClick:()=>p(k+1),size:"icon",children:k+1},k))}),r.jsx(W,{variant:"outline",onClick:()=>p(N=>
884Math.min(v,N+1)),disabled:x===v,children:"Next"})]})]}):r.jsx("div",{className:"text-center py-12",children:r.jsx("p",{className:"text-muted-foreground text-lg",children:"No content found. Try adjusting your filters."})})]})]}),r.jsx("div",{className:"mt-16 max-w-2xl mx-auto",children:r.jsx(YO,{title:"Stay Updated on Content",description:"Get notified when new Nigerian creators join the platform and fresh content drops."})})]}),o&&r.jsx(ybe,{content:o,isOpen:!!o,onClose:()=>l(null)})]})};var HK=["PageUp","PageDown"],GK=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],YK={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hv="Slider",[LP,Jbe,Qbe]=Jb(hv),[KK,WJe]=ea(hv,[Qbe]),[eje,PS]=KK(hv),XK=j.forwardRef((e,t)=>{const{name:n,min:s=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[s],value:u,onValueChange:h=()=>{},onValueCommit:f=()=>{},inverted:m=!1,form:x,...p}=e,v=j.useRef(new Set),g=j.useRef(0),b=o==="horizontal"?tje:rje,[w=[],_]=Fo({prop:u,defaultProp:d,onChange:P=>{var A;(A=[...v.current][g.current])==null||A.focus(),h(P)}}),C=j.useRef(w);function E(P){const O=oje(w,P);I(P,O)}function N(P){I(P,g.current)}function k(){const P=C.current[g.current];w[g.current]!==P&&f(w)}function I(P,O,{commit:A}={commit:!1}){const R=uje(i),L=hje(Math.round((P-s)/i)*i+s,R),z=e_(L,[s,a]);_((U=[])=>{const $=aje(U,z,O);if(dje($,c*i)){g.current=$.indexOf(z);const q=String($)!==String(U);return q&&A&&f($),q?$:U}else return U})}return r.jsx(eje,{scope:e.__scopeSlider,name:n,disabled:l,min:s,max:a,valueIndexToChangeRef:g,thumbs:v.current,values:w,orientation:o,form:x,children:r.jsx(LP.Provider,{scope:e.__scopeSlider,children:r.jsx(LP.Slot,{scope:e.__scopeSlider,children:r.jsx(b,{"aria-disabled":l,"data-disabled":l?"":void 0,...p,ref:t,onPointerDown:dt(p.onPointerDown,()=>{l||(C.current=w)}),min:s,max:a,inverted:m,onSlideStart:l?void 0:E,onSlideMove:l?void 0:N,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>!l&&I(s,0,{commit:!0}),onEndKeyDown:()=>!l&&I(a,w.length-1,{commit:!0}),onStepKeyDown:({event:P,direction:O})=>{if(!l){const L=HK.includes(P.key)||P.shiftKey&&GK.includes(P.key)?10:1,z=g.current,U=w[z],$=i*L*O;I(U+$,z,{commit:!0})}}})})})})});XK.displayName=hv;var[ZK,JK]=KK(hv,{startEdge:"left",endEdge:"right",size:"width",direction:1}),tje=j.forwardRef((e,t)=>{const{min:n,max:s,dir:a,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[h,f]=j.useState(null),m=gr(t,b=>f(b)),x=j.useRef(void 0),p=cv(a),v=p==="ltr",g=v&&!i||!v&&i;function y(b){const w=x.current||h.getBoundingClientRect(),_=[0,w.width],E=KO(_,g?[n,s]:[s,n]);return x.current=w,E(b-w.left)}return r.jsx(ZK,{scope:e.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:r.jsx(QK,{dir:p,"data-orientation":"horizontal",...u,ref:m,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const w=y(b.clientX);o==null||o(w)},onSlideMove:b=>{const w=y(b.clientX);l==null||l(w)},onSlideEnd:()=>{x.current=void 0,c==null||c()},onStepKeyDown:b=>{const _=YK[g?"from-left":"from-right"].includes(b.key);d==null||d({event:b,direction:_?-1:1})}})})}),rje=j.forwardRef((e,t)=>{const{min:n,max:s,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=j.useRef(null),h=gr(t,u),f=j.useRef(void 0),m=!a;function x(p){const v=f.current||u.current.getBoundingClientRect(),g=[0,v.height],b=KO(g,m?[s,n]:[n,s]);return f.current=v,b(p-v.top)}return r.jsx(ZK,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:r.jsx(QK,{"data-orientation":"vertical",...d,ref:h,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:p=>{const v=x(p.clientY);i==null||i(v)},onSlideMove:p=>{const v=x(p.clientY);o==null||o(v)},onSlideEnd:()=>{f.current=void 0,l==null||l()},onStepKeyDown:p=>{const g=YK[m?"from-bottom":"from-top"].includes(p.key);c==null||c({event:p,direction:g?-1:1})}})})}),QK=j.forwardRef((e,t)=>
884{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=PS(hv,n);return r.jsx(Lt.span,{...d,ref:t,onKeyDown:dt(e.onKeyDown,h=>{h.key==="Home"?(o(h),h.preventDefault()):h.key==="End"?(l(h),h.preventDefault()):HK.concat(GK).includes(h.key)&&(c(h),h.preventDefault())}),onPointerDown:dt(e.onPointerDown,h=>{const f=h.target;f.setPointerCapture(h.pointerId),h.preventDefault(),u.thumbs.has(f)?f.focus():s(h)}),onPointerMove:dt(e.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&a(h)}),onPointerUp:dt(e.onPointerUp,h=>{const f=h.target;f.hasPointerCapture(h.pointerId)&&(f.releasePointerCapture(h.pointerId),i(h))})})}),eX="SliderTrack",tX=j.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=PS(eX,n);return r.jsx(Lt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:t})});tX.displayName=eX;var IP="SliderRange",rX=j.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=PS(IP,n),i=JK(IP,n),o=j.useRef(null),l=gr(t,o),c=a.values.length,d=a.values.map(f=>aX(f,a.min,a.max)),u=c>1?Math.min(...d):0,h=100-Math.max(...d);return r.jsx(Lt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:l,style:{...e.style,[i.startEdge]:u+"%",[i.endEdge]:h+"%"}})});rX.displayName=IP;var RP="SliderThumb",nX=j.forwardRef((e,t)=>{const n=Jbe(e.__scopeSlider),[s,a]=j.useState(null),i=gr(t,l=>a(l)),o=j.useMemo(()=>s?n().findIndex(l=>l.ref.current===s):-1,[n,s]);return r.jsx(nje,{...e,ref:i,index:o})}),nje=j.forwardRef((e,t)=>{const{__scopeSlider:n,index:s,name:a,...i}=e,o=PS(RP,n),l=JK(RP,n),[c,d]=j.useState(null),u=gr(t,y=>d(y)),h=c?o.form||!!c.closest("form"):!0,f=lj(c),m=o.values[s],x=m===void 0?0:aX(m,o.min,o.max),p=ije(s,o.values.length),v=f==null?void 0:f[l.size],g=v?lje(v,x,l.direction):0;return j.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${x}% + ${g}px)`},children:[r.jsx(LP.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Lt.span,{role:"slider","aria-label":e["aria-label"]||p,"aria-valuemin":o.min,"aria-valuenow":m,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:u,style:m===void 0?{display:"none"}:e.style,onFocus:dt(e.onFocus,()=>{o.valueIndexToChangeRef.current=s})})}),h&&r.jsx(sX,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:m},s)]})});nX.displayName=RP;var sje="RadioBubbleInput",sX=j.forwardRef(({__scopeSlider:e,value:t,...n},s)=>{const a=j.useRef(null),i=gr(a,s),o=Nj(t);return j.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&u){const h=new Event("input",{bubbles:!0});u.call(l,t),l.dispatchEvent(h)}},[o,t]),r.jsx(Lt.input,{style:{display:"none"},...n,ref:i,defaultValue:t})});sX.displayName=sje;function aje(e=[],t,n){const s=[...e];return s[n]=t,s.sort((a,i)=>a-i)}function aX(e,t,n){const i=100/(n-t)*(e-t);return e_(i,[0,100])}function ije(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function oje(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),s=Math.min(...n);return n.indexOf(s)}function lje(e,t,n){const s=e/2,i=KO([0,50],[0,s]);return(s-i(t)*n)*n}function cje(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function dje(e,t){if(t>0){const n=cje(e);return Math.min(...n)>=t}return!0}function KO(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function uje(e){return(String(e).split(".")[1]||"").length}function hje(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var iX=XK,fje=tX,mje=rX,pje=nX;const oX=j.forwardRef(({className:e,...t},n)=>r.jsxs(iX,{ref:n,className:Ge("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(fje,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(mje,{className:"absolute h-full bg-primary"})}),r.jsx(pje,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));oX.displayName=iX.displayName;const gje=["Inappropriate content","Spam or misleading","Copyright violation","Harassment or abuse","Fraudulent activity","Other violation"],xje=({itemType:e,itemId:t,itemTitle:n="item",className:s,size:a="sm",variant:i="ghost"})=>{const{user:o}=bt(),[l,c]=j.useState(!1),[d,u]=j.useState(""),[h,f]=j.useState(""),[m,x]=j.useState(!1),p=async()=>
884{if(!o){XN("auth","unauthorized");return}if(!d){XN("general","validation");return}x(!0);try{const{error:v}=await H.from("notifications").insert({user_id:o.id,type:"report",title:`New Report: ${e}`,message:`User reported ${e}: ${n}. Reason: ${d}`,data:{item_type:e,item_id:t,reason:d,description:h||null}});if(v)throw v;dme("general","submitted"),c(!1),u(""),f("")}catch(v){ume(v,"general")}finally{x(!1)}};return r.jsxs(Rt,{open:l,onOpenChange:c,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{variant:i,size:a,className:s,"aria-label":`Report ${e}`,children:[r.jsx($N,{className:"h-4 w-4"}),r.jsx("span",{className:"ml-1 hidden sm:inline",children:"Report"})]})}),r.jsxs(Ot,{className:"sm:max-w-md",children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-5 w-5 text-orange-500"}),"Report ",e]}),r.jsx(on,{children:"Help us maintain a safe community by reporting inappropriate content."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"reason",children:"Reason for reporting"}),r.jsxs(mt,{value:d,onValueChange:u,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select a reason"})}),r.jsx(ht,{children:gje.map(v=>r.jsx(Ne,{value:v,children:v},v))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Additional details (optional)"}),r.jsx(ir,{id:"description",value:h,onChange:v=>f(v.target.value),placeholder:"Provide more context about the issue...",rows:3})]})]}),r.jsxs(Yh,{children:[r.jsx(W,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),r.jsx(W,{onClick:p,disabled:!d||m,className:"bg-red-600 hover:bg-red-700",children:m?"Submitting...":"Submit Report"})]})]})]})},XO=({values:e,onChange:t,className:n="",showLabels:s=!0,compact:a=!1})=>{const i=d=>{t({...e,country:d,state:"",city:""})},o=d=>{t({...e,state:d})},l=d=>{t({...e,city:d.target.value})},c=a?"grid grid-cols-1 sm:grid-cols-3 gap-3":"grid grid-cols-1 md:grid-cols-3 gap-4";return r.jsxs("div",{className:`${c} ${n}`,children:[r.jsxs("div",{children:[s&&r.jsx(le,{className:"mb-2 block",children:"Country"}),r.jsx(dc,{value:e.country,onValueChange:i,label:s?void 0:""})]}),r.jsxs("div",{children:[s&&r.jsx(le,{className:"mb-2 block",children:"State/Province"}),r.jsx(uc,{countryCode:e.country||"NG",value:e.state,onChange:o})]}),r.jsxs("div",{children:[s&&r.jsx(le,{htmlFor:"city-filter",className:"mb-2 block",children:"City"}),r.jsxs("div",{className:"relative",children:[r.jsx(At,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"city-filter",type:"text",placeholder:"Enter city",value:e.city,onChange:l,className:"pl-10"})]})]})]})};function $h({active:e,onToggle:t}){const{preferences:n,isLoading:s}=Di(),a=()=>{if(s)return"Loading...";const o=[n.city,n.state].filter(Boolean);return o.length>0?o.join(", "):"Your Location"},i=()=>{e?t():t({country:n.country,state:n.state,city:n.city})};return r.jsxs(W,{variant:e?"default":"outline",size:"sm",onClick:i,className:`flex items-center gap-2 ${e?"bg-primary text-primary-foreground shadow-md":""}`,disabled:s,children:[r.jsx(At,{className:`h-4 w-4 ${e?"animate-pulse":""}`}),r.jsx("span",{children:"Near Me"}),e&&r.jsx(te,{variant:"secondary",className:"ml-1 px-1 py-0 text-xs",children:a()})]})}const vje=()=>{const{preferences:e}=Di(),[t,n]=j.useState([]),[s,a]=j.useState([]),[i,o]=j.useState(!0),[l,c]=j.useState(!1),[d,u]=j.useState({search:"",country:"",city:"",state:"",dateRange:"",priceRange:[0,1e5],category:"",sortBy:"date_asc"}),h=["Music","Technology","Art","Film","Business","Sports","Education","Culture","Others"],f=()=>{!l&&e?(u(g=>({...g,country:e.country,state:e.state,city:e.city})),c(!0)):(u(g=>({...g,country:"",state:"",city:""})),c(!1))};j.useEffect(()=>{m()},[]),j.useEffect(()=>{x()},[t,d]);const m=async()=>{try{const{data:g,error:y}=await H.from("events").select(` 885 *, 886 ticket_types (*) 887 `).eq("status","published").eq("moderation_status","approved").gte("end_datetime",new Date().toISOString()).order("is_featured",{ascending:!1,nullsFirst:!1}).order("start_datetime",{ascending:!0});if(y)throw y;const b=await Promise.all((g||[]).map(async w=>{const C=(w.ticket_types||[]).map(k=>k.price).filter(k=>k>0),{data:E}=await H.from("tickets").select("created_at").eq("event_id",w.id).eq("payment_status","completed").gte("created_at",new Date(Date.now()-7*24*60*60*1e3).toISOString()),N=(E==null?void 0:E.length)||0;
887return{...w,min_price:Math.min(...C)||0,max_price:Math.max(...C)||0,tickets_sold:N,is_trending:N>=10}}));n(b)}catch{be({title:"Error",description:"Failed to fetch events",variant:"destructive"})}finally{o(!1)}},x=()=>{let g=[...t];if(d.search){const y=d.search.toLowerCase();g=g.filter(b=>{var I;const w=`${b.title} ${b.description} ${b.venue_name} ${b.city} ${(I=b.tags)==null?void 0:I.join(" ")}`.toLowerCase(),_=y.split("");let C=0,E=0;for(const P of _){const O=w.indexOf(P,C);O!==-1&&(C=O+1,E++)}const N=E/_.length>=.8;return w.includes(y)||N})}if(d.country&&(g=g.filter(y=>y.country_code===d.country)),d.city&&(g=g.filter(y=>{var b;return(b=y.city)==null?void 0:b.toLowerCase().includes(d.city.toLowerCase())})),d.state&&d.state!=="all"&&(g=g.filter(y=>{var b;return((b=y.state)==null?void 0:b.toLowerCase())===d.state.toLowerCase()})),d.dateRange&&d.dateRange!=="all"){const y=new Date,b=new Date(y);switch(d.dateRange){case"today":b.setHours(0,0,0,0);const w=new Date(b);w.setHours(23,59,59,999),g=g.filter(E=>{const N=new Date(E.start_datetime);return N>=b&&N<=w});break;case"this_week":const _=new Date(y.getTime()+7*24*60*60*1e3);g=g.filter(E=>{const N=new Date(E.start_datetime);return N>=y&&N<=_});break;case"this_month":const C=new Date(y.getFullYear(),y.getMonth()+1,0);g=g.filter(E=>{const N=new Date(E.start_datetime);return N>=y&&N<=C});break}}switch((d.priceRange[0]>0||d.priceRange[1]<1e5)&&(g=g.filter(y=>{const b=y.min_price||0,w=y.max_price||0;return b>=d.priceRange[0]&&b<=d.priceRange[1]||w>=d.priceRange[0]&&w<=d.priceRange[1]})),d.category&&d.category!=="all"&&(g=g.filter(y=>{var b;return(b=y.tags)==null?void 0:b.some(w=>w.toLowerCase().includes(d.category.toLowerCase()))})),d.sortBy){case"date_asc":g.sort((y,b)=>new Date(y.start_datetime).getTime()-new Date(b.start_datetime).getTime());break;case"date_desc":g.sort((y,b)=>new Date(b.start_datetime).getTime()-new Date(y.start_datetime).getTime());break;case"price_asc":g.sort((y,b)=>(y.min_price||0)-(b.min_price||0));break;case"price_desc":g.sort((y,b)=>(b.min_price||0)-(y.min_price||0));break;case"trending":g.sort((y,b)=>(b.tickets_sold||0)-(y.tickets_sold||0));break}a(g)},p=()=>{u({search:"",country:"",city:"",state:"",dateRange:"",priceRange:[0,1e5],category:"",sortBy:"date_asc"})},v=t.filter(g=>g.is_trending).sort((g,y)=>(y.tickets_sold||0)-(g.tickets_sold||0)).slice(0,5);return i?r.jsx("div",{className:"space-y-6",children:r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[1,2,3].map(g=>r.jsxs(Y,{className:"animate-pulse",children:[r.jsx("div",{className:"h-48 bg-muted rounded-t-lg"}),r.jsxs(X,{className:"p-4",children:[r.jsx("div",{className:"h-4 bg-muted rounded w-3/4 mb-2"}),r.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]})]},g))})}):r.jsxs("div",{className:"space-y-6",children:[v.length>0&&r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(lr,{className:"h-5 w-5 text-orange-500"}),"Trending Events",r.jsx(te,{variant:"secondary",children:"Hot"})]})}),r.jsx(X,{children:r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:v.map(g=>{var y;return r.jsxs(Y,{className:"group hover:shadow-lg transition-all",children:[r.jsxs("div",{className:"relative",children:[g.cover_image&&r.jsx("img",{src:g.cover_image,alt:g.title,className:"w-full h-32 object-cover rounded-t-lg"}),r.jsxs(te,{className:"absolute top-2 right-2 bg-orange-500",children:[r.jsx(lr,{className:"h-3 w-3 mr-1"}),"Hot"]})]}),r.jsxs(X,{className:"p-3",children:[r.jsx("h3",{className:"font-semibold text-sm line-clamp-2 mb-1",children:g.title}),r.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:[g.city,", ",g.state]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-xs font-medium text-primary",children:["â¦",(y=g.min_price)==null?void 0:y.toLocaleString(),"+"]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[g.tickets_sold," sold"]})]})]})]},g.id)})})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(nj,{className:"h-5 w-5"}),"Search & Filter Events"]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search events, venues, or keywords...",value:d.search,onChange:g=>u({...d,search:g.target.value}),className:"pl-10"})]}),r.jsx($h,{active:l,onToggle:f})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(XO,{values:{country:d.country,state:d.state,city:d.city},onChange:g=>u({...d,country:g.country,state:g.state,city:g.city}),showLabels:!0}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"date",children:"Date Range"}),r.jsxs(mt,{value:d.dateRange,onValueChange:g=>u({...d,dateRange:g}),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Any time"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"Any time"}),r.jsx(Ne,{value:"today",children:"Today"}),r.jsx(Ne,{value:"this_week",children:"This Week"}),r.jsx(Ne,{value:"this_month",children:"This Month"})]})]})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"category",children:"Category"}),r.jsxs(mt,{value:d.category,onValueChange:g=>u({...d,category:g}),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"All categories"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Categories"}),h.map(g=>r.jsx(Ne,{value:g,children:g},g))]})]})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"sort",children:"Sort By"}),r.jsxs(mt,{value:d.sortBy,onValueChange:g=>u({...d,sortBy:g}),children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"date_asc",children:"Date (Earliest)"}),r.jsx(Ne,{value:"date_desc",children:"Date (Latest)"}),r.jsx(Ne,{value:"price_asc",children:"Price (Low to High)"}),r.jsx(Ne,{value:"price_desc",children:"Price (High to Low)"}),r.jsx(Ne,{value:"trending",children:"Trending"})]})]})]}),r.jsx("div",{className:"flex items-end",children:r.jsx(W,{variant:"outline",onClick:p,children:"Reset Filters"})})]})]}),r.jsxs("div",{children:[r.jsxs(le,{children:["Price Range: â¦",d.priceRange[0].toLocaleStr
887ing()," - â¦",d.priceRange[1].toLocaleString()]}),r.jsx(oX,{value:d.priceRange,onValueChange:g=>u({...d,priceRange:g}),max:1e5,step:1e3,className:"mt-2"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{children:[s.length," Events Found"]})}),r.jsx(X,{children:s.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Wr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No events found"}),r.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search or filter criteria"})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map((g,y)=>{var b,w,_;return r.jsxs(r.Fragment,{children:[r.jsxs(Y,{className:"group hover:shadow-lg transition-all",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-t-lg",children:[g.cover_image&&r.jsx("img",{src:g.cover_image,alt:g.title,className:"w-full h-48 object-cover group-hover:scale-105 transition-transform duration-300"}),g.is_trending&&r.jsxs(te,{className:"absolute top-2 left-2 bg-orange-500",children:[r.jsx(lr,{className:"h-3 w-3 mr-1"}),"Trending"]}),r.jsx("div",{className:"absolute top-2 right-2",children:r.jsx(xje,{itemType:"event",itemId:g.id,itemTitle:g.title,variant:"ghost",size:"sm",className:"bg-black/50 text-white hover:bg-black/70"})})]}),r.jsxs(X,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold line-clamp-2 mb-1",children:g.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:g.description})]}),r.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4"}),r.jsx("span",{children:new Date(g.start_datetime).toLocaleDateString()}),r.jsx($r,{className:"h-4 w-4 ml-2"}),r.jsx("span",{children:new Date(g.start_datetime).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(At,{className:"h-4 w-4"}),r.jsxs("span",{children:[g.venue_name,", ",g.city]})]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx("div",{children:g.min_price===g.max_price?r.jsxs("span",{className:"font-semibold text-primary",children:["â¦",((b=g.min_price)==null?void 0:b.toLocaleString())||"Free"]}):r.jsxs("span",{className:"font-semibold text-primary",children:["â¦",((w=g.min_price)==null?void 0:w.toLocaleString())||"0"," - â¦",((_=g.max_price)==null?void 0:_.toLocaleString())||"0"]})}),r.jsxs(W,{size:"sm",className:"bg-gradient-hero hover:opacity-90",children:[r.jsx(aj,{className:"h-4 w-4 mr-1"}),"Get Tickets"]})]}),g.tags&&g.tags.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-1 pt-2",children:[g.tags.slice(0,3).map(C=>r.jsx(te,{variant:"outline",className:"text-xs",children:C},C)),g.tags.length>3&&r.jsxs(te,{variant:"outline",className:"text-xs",children:["+",g.tags.length-3," more"]})]})]})]},g.id),(y+1)%6===0&&y<s.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${y}`)]})})})})]})]})};function pr(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 io(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function ma(e,t){const n=pr(e);return isNaN(t)?io(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function ic(e,t){const n=pr(e);if(isNaN(t))return io(e,NaN);if(!t)return n;const s=n.getDate(),a=io(e,n.getTime());a.setMonth(n.getMonth()+t+1,0);const i=a.getDate();return s>=i?a:(n.setFullYear(a.getFullYear(),a.getMonth(),s),n)}const ZO=6048e5,yje=864e5,lX=6e4,cX=36e5,h1=43200,YD=1440;let bje={};function fv(){return bje}function rd(e,t){var l,c,d,u;const n=fv(),s=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,a=pr(e),i=a.getDay(),o=(i<s?7:0)+i-s;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function Lm(e){return rd(e,{weekStartsOn:1}
887)}function dX(e){const t=pr(e),n=t.getFullYear(),s=io(e,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const a=Lm(s),i=io(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=Lm(i);return t.getTime()>=a.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function xx(e){const t=pr(e);return t.setHours(0,0,0,0),t}function vx(e){const t=pr(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Gl(e,t){const n=xx(e),s=xx(t),a=+n-vx(n),i=+s-vx(s);return Math.round((a-i)/yje)}function jje(e){const t=dX(e),n=io(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Lm(n)}function MP(e,t){const n=t*7;return ma(e,n)}function wje(e,t){return ic(e,t*12)}function Nje(e){let t;return e.forEach(function(n){const s=pr(n);(t===void 0||t<s||isNaN(Number(s)))&&(t=s)}),t||new Date(NaN)}function _je(e){let t;return e.forEach(n=>{const s=pr(n);(!t||t>s||isNaN(+s))&&(t=s)}),t||new Date(NaN)}function nN(e,t){const n=pr(e),s=pr(t),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function JO(e){return io(e,Date.now())}function Ua(e,t){const n=xx(e),s=xx(t);return+n==+s}function QO(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Sje(e){if(!QO(e)&&typeof e!="number")return!1;const t=pr(e);return!isNaN(Number(t))}function yx(e,t){const n=pr(e),s=pr(t),a=n.getFullYear()-s.getFullYear(),i=n.getMonth()-s.getMonth();return a*12+i}function kje(e,t,n){const s=rd(e,n),a=rd(t,n),i=+s-vx(s),o=+a-vx(a);return Math.round((i-o)/ZO)}function f_(e,t){const n=pr(e),s=pr(t),a=KD(n,s),i=Math.abs(Gl(n,s));n.setDate(n.getDate()-a*i);const o=+(KD(n,s)===-a),l=a*(i-o);return l===0?0:l}function KD(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Cje(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function Aje(e,t){return+pr(e)-+pr(t)}function Pje(e){const t=pr(e);return t.setHours(23,59,59,999),t}function bx(e){const t=pr(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Eje(e){const t=pr(e);return+Pje(t)==+bx(t)}function Tje(e,t){const n=pr(e),s=pr(t),a=nN(n,s),i=Math.abs(yx(n,s));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*i);let l=nN(n,s)===-a;Eje(pr(e))&&i===1&&nN(e,s)===1&&(l=!1),o=a*(i-Number(l))}return o===0?0:o}function Oje(e,t,n){const s=Aje(e,t)/1e3;return Cje(n==null?void 0:n.roundingMethod)(s)}function ci(e){const t=pr(e);return t.setDate(1),t.setHours(0,0,0,0),t}function uX(e){const t=pr(e),n=io(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function e6(e,t){var l,c,d,u;const n=fv(),s=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,a=pr(e),i=a.getDay(),o=(i<s?-7:0)+6-(i-s);return a.setDate(a.getDate()+o),a.setHours(23,59,59,999),a}function hX(e){return e6(e,{weekStartsOn:1})}const Lje={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"}},Ije=(e,t,n)=>{let s;const a=Lje[e];
vendor: 6,249 bytes, line 887
887return typeof a=="string"?s=a:t===1?s=a.one:s=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function bk(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Rje={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Mje={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Dje={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$je={date:bk({formats:Rje,defaultWidth:"full"}),time:bk({formats:Mje,defaultWidth:"full"}),dateTime:bk({formats:Dje,defaultWidth:"full"})},Fje={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Bje=(e,t,n,s)=>Fje[e];function my(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let a;if(s==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):o;a=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const Uje={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},zje={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qje={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"]},Vje={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"]},Wje={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"}},Hje={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"}},Gje=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Yje={ordinalNumber:Gje,era:my({values:Uje,defaultWidth:"wide"}),quarter:my({values:zje,defaultWidth:"wide",argumentCallback:e=>e-1}),month:my({values:qje,defaultWidth:"wide"}),day:my({values:Vje,defaultWidth:"wide"}),dayPeriod:my({values:Wje,defaultWidth:"wide",formattingValues:Hje,defaultFormattingWidth:"wide"})};function py(e){return(t,n={})=>{const s=n.width,a=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],l=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?Xje(l,h=>h.test(o)):Kje(l,h=>h.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const u=t.slice(o.length);return{value:d,rest:u}}}function Kje(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Xje(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Zje(e){return(t,n={})=>{const s=t.match(e.matchPattern);if(!s)return null;const a=s[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=t.slice(a.length);return{value:o,rest:l}}}const Jje=/^(\d+)(th|st|nd|rd)?/i,Qje=/\d+/i,ewe={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},twe={any:[/^b/i,/^(a|c)/i]},rwe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},nwe={any:[/1/i,/2/i,/3/i,/4/i]},swe={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},awe={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]},iwe={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},owe={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]},lwe={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},cwe={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}},dwe={ordinalNumber:Zje({matchPattern:Jje,parsePattern:Qje,valueCallback:e=>parseInt(e,10)}),era:py({matchPatterns:ewe,defaultMatchWidth:"wide",parsePatterns:twe,defaultParseWidth:"any"}),quarter:py({matchPatterns:rwe,defaultMatchWidth:"wide",parsePatterns:nwe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:py({matchPatterns:swe,defaultMatchWidth:"wide",parsePatterns:awe,defaultParseWidth:"any"}),day:py({matchPatterns:iwe,defaultMatchWidth:"wide",parsePatterns:owe,defaultParseWidth:"any"}),dayPeriod:py({matchPatterns:lwe,defaultMatchWidth:"any",parsePatterns:cwe,defaultParseWidth:"any"})},t6={code:"en-US",formatDistance:Ije,formatLong:$je,formatRelative:Bje,localize:Yje,match:dwe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function uwe(e){const t=pr(e);
vendor: 6,590 bytes, line 887
887return Gl(t,uX(t))+1}function fX(e){const t=pr(e),n=+Lm(t)-+jje(t);return Math.round(n/ZO)+1}function mX(e,t){var u,h,f,m;const n=pr(e),s=n.getFullYear(),a=fv(),i=(t==null?void 0:t.firstWeekContainsDate)??((h=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??a.firstWeekContainsDate??((m=(f=a.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=io(e,0);o.setFullYear(s+1,0,i),o.setHours(0,0,0,0);const l=rd(o,t),c=io(e,0);c.setFullYear(s,0,i),c.setHours(0,0,0,0);const d=rd(c,t);return n.getTime()>=l.getTime()?s+1:n.getTime()>=d.getTime()?s:s-1}function hwe(e,t){var l,c,d,u;const n=fv(),s=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,a=mX(e,t),i=io(e,0);return i.setFullYear(a,0,s),i.setHours(0,0,0,0),rd(i,t)}function pX(e,t){const n=pr(e),s=+rd(n,t)-+hwe(n,t);return Math.round(s/ZO)+1}function Pn(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const Lu={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return Pn(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Pn(n+1,2)},d(e,t){return Pn(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Pn(e.getHours()%12||12,t.length)},H(e,t){return Pn(e.getHours(),t.length)},m(e,t){return Pn(e.getMinutes(),t.length)},s(e,t){return Pn(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return Pn(a,t.length)}},Bp={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},XD={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return Lu.y(e,t)},Y:function(e,t,n,s){const a=mX(e,s),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return Pn(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):Pn(i,t.length)},R:function(e,t){const n=dX(e);return Pn(n,t.length)},u:function(e,t){const n=e.getFullYear();return Pn(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return Pn(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return Pn(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return Lu.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return Pn(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const a=pX(e,s);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):Pn(a,t.length)},I:function(e,t,n){const s=fX(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):Pn(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Lu.d(e,t)},D:function(e,t,n){const s=uwe(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):Pn(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const a=e.getDay(),i=(a-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Pn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const a=e.getDay(),i=(a-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Pn(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),a=s===0?7:s;switch(t){case"i":return String(a);case"ii":return Pn(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let a;switch(s===12?a=Bp.noon:s===0?a=Bp.midnight:a=s/12>
vendor: 4,717 bytes, line 887
887=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let a;switch(s>=17?a=Bp.evening:s>=12?a=Bp.afternoon:s>=4?a=Bp.morning:a=Bp.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return Lu.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Lu.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):Pn(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):Pn(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Lu.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Lu.s(e,t)},S:function(e,t){return Lu.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return JD(s);case"XXXX":case"XX":return Rf(s);case"XXXXX":case"XXX":default:return Rf(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return JD(s);case"xxxx":case"xx":return Rf(s);case"xxxxx":case"xxx":default:return Rf(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ZD(s,":");case"OOOO":default:return"GMT"+Rf(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ZD(s,":");case"zzzz":default:return"GMT"+Rf(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return Pn(s,t.length)},T:function(e,t,n){const s=e.getTime();return Pn(s,t.length)}};function ZD(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Math.trunc(s/60),i=s%60;return i===0?n+String(a):n+String(a)+t+Pn(i,2)}function JD(e,t){return e%60===0?(e>0?"-":"+")+Pn(Math.abs(e)/60,2):Rf(e,t)}function Rf(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Pn(Math.trunc(s/60),2),i=Pn(s%60,2);return n+a+t+i}const QD=(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"})}},gX=(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"})}},fwe=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return QD(e,t);let i;switch(s){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",QD(s,t)).replace("{{time}}",gX(a,t))},mwe={p:gX,P:fwe},pwe=/^D+$/,gwe=/^Y+$/,xwe=["D","DD","YY","YYYY"];function vwe(e){return pwe.test(e)}function ywe(e){return gwe.test(e)}function bwe(e,t,n){const s=jwe(e,t,n);if(console.warn(s),xwe.includes(e))throw new RangeError(s)}function jwe(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const wwe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Nwe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,_we=/^'([^]*?)'?$/,Swe=/''/g,kwe=/[a-zA-Z]/;function wr(e,t,n){var u,h,f,m,x,p,v,g;const s=fv(),a=(n==null?void 0:n.locale)??s.locale??t6,i=(n==null?void 0:n.firstWeekContainsDate)??((h=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((m=(f=s.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((p=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:p.weekStartsOn)??s.weekStartsOn??((g=(v=s.locale)==null?void 0:v.options)==null?void 0:g.weekStartsOn)??0,l=pr(e);if(!Sje(l))throw new RangeError("Invalid time value");let c=t.match(Nwe).map(y=>{const b=y[0];if(b==="p"||b==="P"){const w=mwe[b];return w(y,a.formatLong)}return y}).join("").match(wwe).map(y=>{if(y==="''")return{isToken:!1,value:"'"};const b=y[0];if(b==="'")return{isToken:!1,value:Cwe(y)};if(XD[b])return{isToken:!0,value:y};
887if(b.match(kwe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:y}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(y=>{if(!y.isToken)return y.value;const b=y.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&ywe(b)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&vwe(b))&&bwe(b,t,String(e));const w=XD[b[0]];return w(l,b,a.localize,d)}).join("")}function Cwe(e){const t=e.match(_we);return t?t[1].replace(Swe,"'"):e}function Awe(e,t,n){const s=fv(),a=(n==null?void 0:n.locale)??s.locale??t6,i=2520,o=nN(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let c,d;o>0?(c=pr(t),d=pr(e)):(c=pr(e),d=pr(t));const u=Oje(d,c),h=(vx(d)-vx(c))/1e3,f=Math.round((u-h)/60);let m;if(f<2)return n!=null&&n.includeSeconds?u<5?a.formatDistance("lessThanXSeconds",5,l):u<10?a.formatDistance("lessThanXSeconds",10,l):u<20?a.formatDistance("lessThanXSeconds",20,l):u<40?a.formatDistance("halfAMinute",0,l):u<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):f===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",f,l);if(f<45)return a.formatDistance("xMinutes",f,l);if(f<90)return a.formatDistance("aboutXHours",1,l);if(f<YD){const x=Math.round(f/60);return a.formatDistance("aboutXHours",x,l)}else{if(f<i)return a.formatDistance("xDays",1,l);if(f<h1){const x=Math.round(f/YD);return a.formatDistance("xDays",x,l)}else if(f<h1*2)return m=Math.round(f/h1),a.formatDistance("aboutXMonths",m,l)}if(m=Tje(d,c),m<12){const x=Math.round(f/h1);return a.formatDistance("xMonths",x,l)}else{const x=m%12,p=Math.trunc(m/12);return x<3?a.formatDistance("aboutXYears",p,l):x<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}function Im(e,t){return Awe(e,JO(e),t)}function Pwe(e){const t=pr(e),n=t.getFullYear(),s=t.getMonth(),a=io(e,0);return a.setFullYear(n,s+1,0),a.setHours(0,0,0,0),a.getDate()}function Ewe(e){return Math.trunc(+pr(e)/1e3)}function Twe(e){const t=pr(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}function Owe(e,t){return kje(Twe(e),ci(e),t)+1}function DP(e,t){const n=pr(e),s=pr(t);return n.getTime()>s.getTime()}function xX(e,t){const n=pr(e),s=pr(t);return+n<+s}function e8(e){return+pr(e)<Date.now()}function r6(e,t){const n=pr(e),s=pr(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function Lwe(e,t){const n=pr(e),s=pr(t);return n.getFullYear()===s.getFullYear()}function Iwe(e){return Ua(e,JO(e))}function Rwe(e){return Ua(e,ma(JO(e),1))}function l0(e,t){return ma(e,-t)}function mm(e,t){const s=Fwe(e);let a;if(s.date){const c=Bwe(s.date,2);a=Uwe(c.restDateString,c.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,l;if(s.time&&(o=zwe(s.time),isNaN(o)))return new Date(NaN);if(s.timezone){if(l=qwe(s.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(i+o),d=new Date(0);return d.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),d.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),d}return new Date(i+o+l)}const f1={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Mwe=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Dwe=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,$we=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Fwe(e){const t={},n=e.split(f1.dateTimeDelimiter);let s;if(n.length>2)return t;if(/:/.test(n[0])?s=n[0]:(t.date=n[0],s=n[1],f1.timeZoneDelimiter.test(t.date)&&(t.date=e.split(f1.timeZoneDelimiter)[0],s=e.substr(t.date.length,e.length))),s){const a=f1.timezone.exec(s);a?(t.time=s.replace(a[1],""),t.timezone=a[1]):t.time=s}return t}function Bwe(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),s=e.match(n);if(!s)return{year:NaN,restDateString:""};const a=s[1]?parseInt(s[1]):null,i=s[2]?parseInt(s[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((s[1]||s[2]).length)}}function Uwe(e,t){if(t===null)return new Date(NaN);const n=e.match(Mwe);if(!n)return new Date(NaN);const s=!!n[4],a=gy(n[1]),i=gy(n[2])-1,o=gy(n[3]),l=gy(n[4]),c=gy(n[5
887])-1;if(s)return Ywe(t,l,c)?Vwe(t,l,c):new Date(NaN);{const d=new Date(0);return!Hwe(t,i,o)||!Gwe(t,a)?new Date(NaN):(d.setUTCFullYear(t,i,Math.max(a,o)),d)}}function gy(e){return e?parseInt(e):1}function zwe(e){const t=e.match(Dwe);if(!t)return NaN;const n=jk(t[1]),s=jk(t[2]),a=jk(t[3]);return Kwe(n,s,a)?n*cX+s*lX+a*1e3:NaN}function jk(e){return e&&parseFloat(e.replace(",","."))||0}function qwe(e){if(e==="Z")return 0;const t=e.match($we);if(!t)return 0;const n=t[1]==="+"?-1:1,s=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return Xwe(s,a)?n*(s*cX+a*lX):NaN}function Vwe(e,t,n){const s=new Date(0);s.setUTCFullYear(e,0,4);const a=s.getUTCDay()||7,i=(t-1)*7+n+1-a;return s.setUTCDate(s.getUTCDate()+i),s}const Wwe=[31,null,31,30,31,30,31,31,30,31,30,31];function vX(e){return e%400===0||e%4===0&&e%100!==0}function Hwe(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Wwe[t]||(vX(e)?29:28))}function Gwe(e,t){return t>=1&&t<=(vX(e)?366:365)}function Ywe(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Kwe(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Xwe(e,t){return t>=0&&t<=59}function wk(e,t){const n=pr(e),s=n.getFullYear(),a=n.getDate(),i=io(e,0);i.setFullYear(s,t,15),i.setHours(0,0,0,0);const o=Pwe(i);return n.setMonth(t,Math.min(a,o)),n}function t8(e,t){const n=pr(e);return isNaN(+n)?io(e,NaN):(n.setFullYear(t),n)}const Zwe=e=>{if(!e)return"Date TBA";const t=mm(e);return Iwe(t)?`Today, ${wr(t,"h:mm a")}`:Rwe(t)?`Tomorrow, ${wr(t,"h:mm a")}`:wr(t,"EEE, MMM d ⢠h:mm a")},n6=({event:e})=>{const t=[e.venue_name,e.city,e.state,e.country].filter(Boolean).slice(0,3).join(", ");return r.jsxs(Y,{className:"overflow-hidden hover:shadow-lg transition-shadow h-full flex flex-col",children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[e.image_url?r.jsx("img",{src:e.image_url,alt:e.title,className:"w-full h-full object-cover",loading:"lazy"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",children:r.jsx(Xt,{className:"h-12 w-12 text-primary/40"})}),r.jsxs(te,{variant:"secondary",className:"absolute top-2 right-2 bg-background/90 text-foreground",children:["via ",e.source_name]})]}),r.jsxs(X,{className:"p-4 flex flex-col flex-1",children:[r.jsx("h3",{className:"font-semibold text-base line-clamp-2 mb-2",children:r.jsx(Vt,{to:EP(e),className:"hover:text-primary transition-colors",children:e.title})}),r.jsxs("div",{className:"space-y-1.5 text-sm text-muted-foreground mb-3",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx($r,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:Zwe(e.start_datetime)})]}),t&&r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(At,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"line-clamp-1",children:t})]})]}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.description}),r.jsx("div",{className:"mt-auto pt-2",children:r.jsx(W,{asChild:!0,variant:"outline",size:"sm",className:"w-full",children:r.jsxs("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer sponsored",children:["View on ",e.source_name,r.jsx(ds,{className:"h-3.5 w-3.5 ml-1.5"})]})})})]})]})},Jwe=["All","Lagos","Abuja","Port Harcourt","Ibadan","Online"],Qwe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState(""),[o,l]=j.useState("All");j.useEffect(()=>{(async()=>{s(!0);try{const u=new Date,h=new Date(u.getTime()-24*60*60*1e3).toISOString(),{data:f,error:m}=await H.from("imported_events").select("*").eq("is_active",!0).or(`start_datetime.is.null,start_datetime.gte.${h}`).order("start_datetime",{ascending:!0,nullsFirst:!1}).limit(120);if(m)throw m;t(f||[])}catch(u){console.error("imported events fetch",u)}finally{s(!1)}})()},[]);const c=j.useMemo(()=>{let d=e;if(o!=="All")if(o==="Online")d=d.filter(u=>/online|virtual|webinar/i.test(`${u.venue_name??""} ${u.city??""} ${u.title}`));else{const u=o.toLowerCase();d=d.filter(h=>`${h.city??""} ${h.state??""} ${h.venue_name??""}`.toLowerCase().includes(u))}
887if(a){const u=a.toLowerCase();d=d.filter(h=>`${h.title} ${h.description??""} ${h.venue_name??""} ${h.city??""}`.toLowerCase().includes(u))}return d},[e,o,a]);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center sm:justify-between",children:[r.jsxs("div",{className:"relative flex-1 max-w-md",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{type:"search",placeholder:"Search discovered eventsâ¦",value:a,onChange:d=>i(d.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Jwe.map(d=>r.jsx(te,{variant:o===d?"default":"outline",className:"cursor-pointer",onClick:()=>l(d),children:d},d))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Events gathered daily from external listing sites. âViewâ links take you to the source to buy tickets or RSVP â Naija.com does not sell tickets for these."}),n?r.jsx("div",{className:"flex justify-center py-16",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):c.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:c.map((d,u)=>r.jsxs("div",{className:"contents",children:[r.jsx(n6,{event:d}),(u+1)%9===0&&u<c.length-1&&r.jsx(Hc,{className:"md:col-span-2 lg:col-span-3"})]},d.id))}):r.jsxs(Y,{className:"p-10 text-center",children:[r.jsx(Vq,{className:"h-12 w-12 mx-auto mb-3 text-muted-foreground/60"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No discovered events found"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e.length===0?"The events feed is being populated â check back soon.":"Try a different search or city filter."})]})]})},mv=({city:e,state:t,country:n,countryCode:s,className:a,showIcon:i=!0,variant:o="secondary"})=>{let l;s?l=vD(s):n?l=xD(n):t?l=xD(t):l=vD("NG");const c=bye(e,t,l.code!=="NG"?l.name:void 0);return r.jsxs(te,{variant:o,className:Ge("flex items-center gap-1.5 text-xs font-medium",a),children:[r.jsx("span",{className:"text-base leading-none",children:l.flag}),i&&r.jsx(At,{className:"h-3 w-3"}),r.jsx("span",{children:c||l.name})]})},jx=({boostExpiresAt:e,isBoosted:t,className:n="",variant:s="default"})=>{if(!t)return null;const i=(()=>{if(!e)return null;const o=new Date,c=new Date(e).getTime()-o.getTime();if(c<=0)return null;const d=Math.floor(c/(1e3*60*60*24)),u=Math.floor(c%(1e3*60*60*24)/(1e3*60*60));return d>0?`${d}d`:u>0?`${u}h`:"<1h"})();return s==="compact"?r.jsxs(te,{className:`gap-1 bg-gradient-to-r from-green-600 to-emerald-600 text-white border-0 shadow-lg text-xs ${n}`,children:[r.jsx(lr,{className:"h-3 w-3"}),i&&r.jsx("span",{children:i})]}):r.jsxs(te,{className:`gap-1 bg-gradient-to-r from-green-600 to-emerald-600 text-white border-0 shadow-lg ${n}`,children:[r.jsx(lr,{className:"h-3 w-3"}),r.jsx("span",{className:"font-semibold",children:"Featured"}),i&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"mx-0.5 opacity-70",children:"â¢"}),r.jsx($r,{className:"h-3 w-3"}),r.jsx("span",{className:"text-xs",children:i})]})]})},e1e=({event:e,onSelect:t})=>{const n=i=>new Date(i).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}),s=i=>new Date(i).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),a=()=>{var i;return e.min_price?e.min_price===e.max_price?`â¦${e.min_price.toLocaleString()}`:`â¦${e.min_price.toLocaleString()} - â¦${(i=e.max_price)==null?void 0:i.toLocaleString()}`:"Free"};return r.jsxs(Y,{className:"group hover:shadow-glow transition-all duration-300 bg-gradient-card border-primary/20",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-t-lg",children:[e.cover_image&&r.jsx("img",{src:vl(e.cover_image),alt:e.title,loading:"lazy",decoding:"async",className:"w-full h-48 object-cover group-hover:scale-105 transition-transform duration-300"}),e.is_trending&&r.jsxs(te,{className:"absolute top-2 left-2 bg-orange-500",children:[r.jsx(lr,{className:"h-3 w-3 mr-1"}),"Trending"]}),r.jsxs("div",{className:"absolute top-2 right-2 flex flex-col gap-1",children:[e.tags&&e.tags[0]&&r.jsx(te,{className:"bg-secondary text-secondary-foreground",children:e.tags[0]}),r.jsx(jx,{isBoosted:e.is_featured,boostExpiresAt:e.feature_expires_at,variant:"compact"})]}),e.tickets_sold&&e.tickets_sold>0&&r.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1 bg-black/70 text-white px-2 py-1 rounded text-sm",children:[r.jsx(Yr,{className:"h-3 w-3"}),r.jsx("span",{children:e.tickets_sold})]})]}),r.jsxs(Se,{className:"pb-2",children:[r.jsx(Ae,{className:"text-lg line-clamp-2",children:e.title}),r.jsx(Nt,{className:"line-clamp-2",children:e.description})]}),r.jsxs(X,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[r.jsx(Xt,{className:"h-4 w-4 mr-2"}),n(e.start_datetime)," at ",s(e.start_datetime)]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(mv,{city:e.city,state:e.state||void 0,country:e.country,countryCode:e.country_code,variant:"outline"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:e.venue_name})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-semibold text-primary",children:a()}),r.jsxs(W,{size:"sm",className:"bg-gradient-hero hover:opacity-90",onClick:t,children:[r.jsx(aj,{className:"h-4 w-4 mr-1"}),"Get Tickets"]})]}),e.tags&&e.tags.length>1&&r.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.slice(0,3).map(i=>r.jsx(te,{variant:"outline",className:"text-xs",children:i},i))})]})]})},t1e=({event:e,isOpen:t,onClose:n})=>{var C,E;const{user:s}=bt(),[a,i]=j.useState(""),[o,l]=j.useState(1),[c,d]=j.useState(""),[u,h]=j.useState(""),[f,m]=j.useState(""),[x,p]=j.useState(!1),v=N=>new Date(N).toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"long",year:"numeric"}),g=N=>new Date(N).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),y=(C=e.ticket_types)==null?void 0:C.find(N=>N.id===a),b=y?y.price*o:0,w=async()=>
887{if(!a){be({title:"Error",description:"Please select a ticket type",variant:"destructive"});return}if(!c||!u||!f){be({title:"Error",description:"Please fill in all buyer details",variant:"destructive"});return}p(!0);try{const{data:N,error:k}=await H.functions.invoke("purchase-ticket",{body:{event_id:e.id,ticket_type_id:a,quantity:o,buyer_name:c,buyer_email:u,buyer_phone:f,buyer_id:s==null?void 0:s.id}});if(k)throw k;N!=null&&N.authorization_url?window.location.href=N.authorization_url:(be({title:"Success",description:"Ticket purchase initiated successfully"}),n())}catch(N){be({title:"Error",description:N.message||"Failed to purchase ticket",variant:"destructive"})}finally{p(!1)}},_=(E=e.ticket_types)==null?void 0:E.filter(N=>N.quantity-N.sold>0&&(!N.sales_end||new Date(N.sales_end)>new Date));return r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{className:"text-2xl",children:e.title}),r.jsx(on,{children:e.description})]}),r.jsxs("div",{className:"space-y-6",children:[e.cover_image&&r.jsx("div",{className:"relative w-full h-64 rounded-lg overflow-hidden",children:r.jsx("img",{src:e.cover_image,alt:e.title,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Xt,{className:"h-5 w-5 text-primary mt-1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Date"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:v(e.start_datetime)})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx($r,{className:"h-5 w-5 text-primary mt-1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Time"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[g(e.start_datetime)," - ",g(e.end_datetime)]})]})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(At,{className:"h-5 w-5 text-primary mt-1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Location"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.venue_name,r.jsx("br",{}),e.venue_address,r.jsx("br",{}),e.city,", ",e.state]})]})]})]}),r.jsxs("div",{className:"border rounded-lg p-4 space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Get Your Tickets"}),_&&_.length>0?r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"ticketType",children:"Ticket Type"}),r.jsxs(mt,{value:a,onValueChange:i,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select ticket type"})}),r.jsx(ht,{children:_.map(N=>r.jsxs(Ne,{value:N.id,children:[N.name," - â¦",N.price.toLocaleString(),"(",N.quantity-N.sold," left)"]},N.id))})]})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"quantity",children:"Quantity"}),r.jsx(ge,{id:"quantity",type:"number",min:"1",max:y?y.quantity-y.sold:1,value:o,onChange:N=>l(parseInt(N.target.value)||1)})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"buyerName",children:"Full Name"}),r.jsx(ge,{id:"buyerName",value:c,onChange:N=>d(N.target.value),placeholder:"Enter your full name"})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"buyerEmail",children:"Email"}),r.jsx(ge,{id:"buyerEmail",type:"email",value:u,onChange:N=>h(N.target.value),placeholder:"Enter your email"})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"buyerPhone",children:"Phone Number"}),r.jsx(ge,{id:"buyerPhone",type:"tel",value:f,onChange:N=>m(N.target.value),placeholder:"Enter your phone number"})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("span",{className:"font-semibold",children:"Total"}),r.jsxs("span",{className:"text-2xl font-bold text-primary",children:["â¦",b.toLocaleString()]})]}),r.jsx(W,{className:"w-full bg-gradient-hero",onClick:w,disabled:x||!a,children:x?"Processing...":"Purchase Tickets"})]})]}):r.jsxs("div",{className:"text-center py-8",children:[r.jsx(aj,{className:"h-12 w-12 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground",children:"No tickets available"})]})]})]}),e.tags&&e.tags.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Tags"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(N=>r.jsx(te,{variant:"outline",children:N},N))})]})]})]})})},yX=()=>{const{user:e}=bt(),[t,n]=j.useState(null),[s,a]=j.useState(null),[i,o]=j.useState(!0);j.useEffect(()=>{e?l():(n(null),a(null),o(!1))},[e]);const l=async()=>
887{if(e)try{const{data:g}=await H.from("vendor_subscriptions").select("*").eq("user_id",e.id).in("status",["active","trialing"]).order("created_at",{ascending:!1}).limit(1).maybeSingle(),y=(g==null?void 0:g.plan_type)||"free",{data:b}=await H.from("subscription_plans").select("*").eq("plan_type",y).maybeSingle();if(b){const w=typeof b.features=="object"&&b.features!==null?b.features:{},_={id:b.id,plan_type:b.plan_type,name:b.name,price:b.price||0,quarterly_price:b.quarterly_price,yearly_price:b.yearly_price,currency:"NGN",features:w,limits:{content_limit:b.max_listings||2,product_limit:b.max_listings||2,property_limit:b.max_listings||2,photo_limit:b.max_photos_per_listing||5},is_active:!0,max_listings:b.max_listings||2,max_photos_per_listing:b.max_photos_per_listing||5,featured_credits_per_month:b.featured_credits_per_month||0};a(_),n(g?{id:g.id,user_id:g.user_id,plan:y,is_active:["active","trialing"].includes(g.status),expires_at:g.current_period_end,created_at:g.created_at,updated_at:g.updated_at||g.created_at}:{id:"free-default",user_id:e.id,plan:"free",is_active:!0,expires_at:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString()})}else a({id:"free-plan",plan_type:"free",name:"Free Plan",price:0,quarterly_price:0,yearly_price:0,currency:"NGN",features:{basic_support:!0,advanced_analytics:!1,priority_support:!1},limits:{content_limit:2,product_limit:2,property_limit:2,photo_limit:5},is_active:!0,max_listings:2,max_photos_per_listing:5,featured_credits_per_month:0}),n({id:"default",user_id:e.id,plan:"free",is_active:!0,expires_at:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString()})}catch(g){console.error("Error fetching subscription:",g)}finally{o(!1)}};return{subscription:t,plan:s,loading:i,hasFeature:g=>{if(!s)return!1;const y=s.features;return(y==null?void 0:y[g])===!0},canCreateContent:g=>{if(!s)return!1;const y=s.max_listings||2;return y===-1||g<y},canCreateProduct:g=>{if(!s)return!1;const y=s.max_listings||2;return y===-1||g<y},canCreateProperty:g=>{if(!s)return!1;const y=s.max_listings||2;return y===-1||g<y},upgradeSubscription:async g=>{if(!e)return!1;try{const{data:y,error:b}=await H.functions.invoke("create-subscription",{body:{plan_type:g}});if(b)throw b;return y.authorization_url?(window.open(y.authorization_url,"_blank"),!0):!1}catch(y){return be({title:"Upgrade failed",description:y.message||"Failed to process subscription upgrade.",variant:"destructive"}),!1}},checkLimits:async()=>{if(!e)return{contentCount:0,productCount:0,propertyCount:0};try{const[g,y,b]=await Promise.all([H.from("content").select("id",{count:"exact"}).eq("creator_id",e.id),H.from("products").select("id",{count:"exact"}).eq("vendor_id",e.id),H.from("properties").select("id",{count:"exact"}).eq("owner_id",e.id)]);
887return{contentCount:g.count||0,productCount:y.count||0,propertyCount:b.count||0}}catch(g){return console.error("Error checking limits:",g),{contentCount:0,productCount:0,propertyCount:0}}},getProductLimit:()=>(s==null?void 0:s.max_listings)||2,getPhotoLimit:()=>(s==null?void 0:s.max_photos_per_listing)||5,getFeaturedCredits:()=>(s==null?void 0:s.featured_credits_per_month)||0}},r1e=({feature:e,currentCount:t=0,limit:n=0,trigger:s})=>{const{upgradeSubscription:a}=yX(),[i,o]=j.useState(!1),[l,c]=j.useState(null),d=async f=>{c(f),await a(f)&&o(!1),c(null)},u=[{type:"pro",name:"Vendor Pro",price:"â¦5,000",period:"/month",icon:r.jsx(mr,{className:"h-5 w-5"}),description:"Perfect for growing sellers",features:["10 product listings","10 photos per listing","2 free featured listings/month","Priority support","Advanced analytics"],recommended:!0},{type:"Enterprise",name:"Enterprise",price:"â¦15,000",period:"/month",icon:r.jsx(yh,{className:"h-5 w-5"}),description:"For high-volume sellers",features:["20 product listings","10 photos per listing","5 free featured listings/month","24/7 phone support","Everything in Pro"],recommended:!1}],h=r.jsxs(W,{variant:"outline",className:"border-orange-200 text-orange-700 hover:bg-orange-50",children:[r.jsx(ui,{className:"h-4 w-4 mr-2"}),"Upgrade to Pro"]});return r.jsxs(Rt,{open:i,onOpenChange:o,children:[r.jsx(li,{asChild:!0,children:s||h}),r.jsxs(Ot,{className:"sm:max-w-4xl",children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-5 w-5 text-orange-500"}),"Upgrade Required"]}),r.jsxs(on,{children:["You've reached the limit for ",e," (",t,"/",n,"). Upgrade to a Pro plan to unlock unlimited access and premium features."]})]}),r.jsx("div",{className:"grid md:grid-cols-2 gap-6 py-4",children:u.map(f=>r.jsxs(Y,{className:`relative ${f.recommended?"border-primary shadow-lg":""}`,children:[f.recommended&&r.jsx(te,{className:"absolute -top-2 left-1/2 transform -translate-x-1/2 bg-primary",children:"Recommended"}),r.jsxs(Se,{className:"text-center pb-2",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[f.icon,r.jsx(Ae,{className:"text-xl",children:f.name})]}),r.jsx(Nt,{children:f.description}),r.jsxs("div",{className:"flex items-baseline justify-center gap-1 mt-4",children:[r.jsx("span",{className:"text-3xl font-bold",children:f.price}),r.jsx("span",{className:"text-muted-foreground",children:f.period})]})]}),r.jsxs(X,{children:[r.jsx("ul",{className:"space-y-2 mb-6",children:f.features.map((m,x)=>r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-4 w-4 text-green-500 flex-shrink-0"}),r.jsx("span",{className:"text-sm",children:m})]},x))}),r.jsx(W,{className:"w-full",onClick:()=>d(f.type),disabled:l===f.type,variant:f.recommended?"default":"outline",children:l===f.type?"Processing...":`Upgrade to ${f.name}`})]})]},f.type))}),r.jsx(Yh,{children:r.jsx(W,{variant:"outline",onClick:()=>o(!1),children:"Maybe Later"})})]})]})},Pj=({planName:e,currentListings:t,maxListings:n,photosPerListing:s,canCreate:a,feature:i})=>{const[o,l]=j.useState(!1),c=e||"Free",d=c.toLowerCase().includes("enterprise")?yh:mr;return r.jsxs(r.Fragment,{children:[r.jsxs(_r,{variant:a?"default":"destructive",className:"border-primary/30 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsx(d,{className:"h-4 w-4"}),r.jsxs(Sr,{className:"flex items-center justify-between flex-wrap gap-2",children:[r.jsxs("div",{children:[r.jsxs("strong",{className:"text-foreground",children:[c.toUpperCase()," PLAN:"]}),r.jsxs("span",{className:"ml-2 text-muted-foreground",children:[t," of ",n," listings used | ",s," photos per listing"]})]}),!a&&r.jsx(W,{variant:"outline",size:"sm",className:"border-primary text-primary hover:bg-primary hover:text-primary-foreground",onClick:()=>l(!0),children:"Upgrade Plan â"})]})]}),o&&r.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(W,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2 z-10",onClick:()=>l(!1),children:"â"}
887),r.jsx(r1e,{feature:i,currentCount:t,limit:n})]})})]})},aa={TITLE:100,DESCRIPTION:1e3,VENUE_NAME:100,VENUE_ADDRESS:200,CITY:100,TAGS:500,CONTACT_PHONE:20,CONTACT_EMAIL:100,CONTACT_WHATSAPP:20},ES=({onSuccess:e})=>{const{user:t}=bt(),{toast:n}=Sn(),{preferences:s,isLoading:a}=Di(),[i,o]=j.useState(null),[l,c]=j.useState(null),[d,u]=j.useState(!1),h=j.useRef(null),[f,m]=j.useState(null),[x,p]=j.useState(!0),v=lu({defaultValues:{country_code:"NG",tags:""}});ee.useEffect(()=>{(async()=>{if(!t){p(!1);return}try{const{data:_,error:C}=await H.rpc("check_event_limits",{user_id:t.id});C?(console.error("Error checking limits:",C),m({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})):m(_)}catch(_){console.error("Error:",_),m({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})}finally{p(!1)}})()},[t]),ee.useEffect(()=>{!a&&s&&(v.setValue("country_code",s.country),v.setValue("state",s.state),v.setValue("city",s.city))},[s,a,v]),ee.useEffect(()=>{const w=v.watch((_,{name:C})=>{C==="country_code"&&v.setValue("state","")});return()=>w.unsubscribe()},[v]);const g=w=>{var E;const _=(E=w.target.files)==null?void 0:E[0];if(!_)return;if(_.size>5*1024*1024){n({title:"File too large",description:"Poster must be under 5MB",variant:"destructive"});return}if(!_.type.startsWith("image/")){n({title:"Invalid file type",description:"Please upload an image file",variant:"destructive"});return}o(_);const C=new FileReader;C.onloadend=()=>{c(C.result)},C.readAsDataURL(_)},y=async()=>{if(!i||!t)return null;const w=i.name.split(".").pop(),_=`${t.id}/${Date.now()}.${w}`;try{const{error:C}=await H.storage.from("event-posters").upload(_,i,{cacheControl:"3600",upsert:!1});if(C)throw C;const{data:{publicUrl:E}}=H.storage.from("event-posters").getPublicUrl(_);return E}catch(C){throw console.error("Error uploading poster:",C),C}},b=async w=>{var E,N,k;if(!t){n({title:"Authentication required",description:"Please login to create events",variant:"destructive"});return}if(f&&!f.can_create_listing){n({title:"Listing limit reached",description:`You've reached your ${f.current_plan} plan limit. Please upgrade to create more events.`,variant:"destructive"});return}if(!i){n({title:"Poster required",description:"Please upload an event poster",variant:"destructive"});return}const _=new Date(w.start_datetime),C=new Date(w.end_datetime);if(C<=_){n({title:"Invalid dates",description:"End date must be after start date",variant:"destructive"});return}if(!w.contact_phone&&!w.contact_email&&!w.contact_whatsapp){n({title:"Contact info required",description:"Please provide at least one contact method",variant:"destructive"});return}u(!0);try{const I=await y();if(!I)throw new Error("Failed to upload poster");const P=w.tags.split(",").map(A=>A.trim()).filter(Boolean).slice(0,20),{error:O}=await H.from("events").insert([{organizer_id:t.id,title:w.title.slice(0,aa.TITLE),description:w.description.slice(0,aa.DESCRIPTION),cover_image:I,venue_name:w.venue_name.slice(0,aa.VENUE_NAME),venue_address:w.venue_address.slice(0,aa.VENUE_ADDRESS),city:w.city.slice(0,aa.CITY),state:w.state,country_code:w.country_code,start_datetime:_.toISOString(),end_datetime:C.toISOString(),tags:P,contact_phone:((E=w.contact_phone)==null?void 0:E.slice(0,aa.CONTACT_PHONE))||null,contact_email:((N=w.contact_email)==null?void 0:N.slice(0,aa.CONTACT_EMAIL))||null,contact_whatsapp:((k=w.contact_whatsapp)==null?void 0:k.slice(0,aa.CONTACT_WHATSAPP))||null,status:"published",moderation_status:"pending",view_count:0,contact_clicks:0}]);if(O)throw O;n({title:"Event created!",description:"Your event has been submitted for review"}),v.reset(),o(null),c(null),e==null||e()}catch(I){console.error("Error creating event:",I),n({title:"Failed to create event",description:I.message,variant:"destructive"})}finally{u(!1)}};return r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(Xt,{className:"h-6 w-6 text-primary"}),"Create Event"]}),r.jsx(Nt,{children:"Share your event with the Nigerian community. Direct contact - no ticketing required."})]}),r.jsxs(X,{children:[f&&!x&&r.jsx(Pj,{planName:f.current_plan,currentListings:f.current_listings,maxListings:f.max_listings,photosPerListing:f.max_photos_per_listing,canCreate:f.can_create_listing,feature:"events"}),r.jsxs(_r,{className:"mb-6 mt-4 border-orange-200 bg-orange-50 dark:bg-orange-950/20",children:[r.jsx(Va,{className:"h-4 w-4 text-orange-600"}),r.jsx(Sr,{children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[r.jsxs("div",{children:[r.jsx("strong",{className:"text-orange-900 dark:text-orange-100",children:"Maximize event attendance!"}),r.jsxs("span",{className:"text-orange-700 dark:text-orange-300 ml-2",children:["Boosted events get ",r.jsx(te,{variant:"secondary",className:"mx-1 bg-orange-100 text-orange-700",children:"5x more visibility"}),"and reach thousands"]})]}),r.jsx(W,{variant:"outline",size:"sm",className:"border-orange-300 text-orange-700 hover:bg-orange-100",onClick:()=>window.open("/pricing","_blank"),children:"Boost Options â"})]})})]}),r.jsx(_r,{className:"mb-6",children:r.jsxs(Sr,{children:[r.jsx("strong",{children:"Note:"})," Events are posted as listings. Users will contact you directly via phone, email, or WhatsApp."]})}),r.jsx(tf,{...v,children:r.jsxs("form",{onSubmit:v.handleSubmit(b),className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(nt,{children:"Event Poster *"}),r.jsxs("div",{className:"border-2 border-dashed border-muted-foreground
887/25 rounded-lg p-6 text-center hover:border-primary/50 transition-colors",children:[l?r.jsxs("div",{className:"space-y-4",children:[r.jsx("img",{src:l,alt:"Event poster preview",className:"max-h-64 mx-auto rounded-lg"}),r.jsx(W,{type:"button",variant:"outline",onClick:()=>{o(null),c(null),h.current&&(h.current.value="")},children:"Remove Poster"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(no,{className:"h-12 w-12 mx-auto text-muted-foreground"}),r.jsx("div",{children:r.jsxs(W,{type:"button",variant:"outline",onClick:()=>{var w;return(w=h.current)==null?void 0:w.click()},children:[r.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Upload Poster"]})}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"PNG, JPG, WEBP up to 5MB"})]}),r.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:g,className:"hidden"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:v.control,name:"title",render:({field:w})=>{var _;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Event Title *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Enter event title",maxLength:aa.TITLE,...w})}),r.jsxs(Pr,{children:[((_=w.value)==null?void 0:_.length)||0," / ",aa.TITLE]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:v.control,name:"tags",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Tags"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"music, concert, lagos (comma separated)",maxLength:aa.TAGS,...w})}),r.jsx(Pr,{children:"Max 20 tags, comma separated"}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:v.control,name:"description",render:({field:w})=>{var _;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Description *"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Describe your event in detail...",className:"min-h-[120px]",maxLength:aa.DESCRIPTION,...w})}),r.jsxs(Pr,{children:[((_=w.value)==null?void 0:_.length)||0," / ",aa.DESCRIPTION]}),r.jsx(Qe,{})]})}}),r.jsxs("div",{className:"space-y-4 p-4 border rounded-lg",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(At,{className:"h-4 w-4"}),"Venue Information"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:v.control,name:"venue_name",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Venue Name *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Event venue",maxLength:aa.VENUE_NAME,...w})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:v.control,name:"venue_address",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Venue Address *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Full address",maxLength:aa.VENUE_ADDRESS,...w})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[r.jsx(Ze,{control:v.control,name:"country_code",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(dc,{value:w.value,onValueChange:w.onChange,label:"Country",required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:v.control,name:"state",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(uc,{countryCode:v.watch("country_code"),value:w.value,onChange:w.onChange,required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:v.control,name:"city",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"City *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"City",maxLength:aa.CITY,...w})}),r.jsx(Qe,{})]})})]})]}),r.jsxs("div",{className:"space-y-4 p-4 border rounded-lg",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx($r,{className:"h-4 w-4"}),"Date & Time"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:v.control,name:"start_datetime",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Start Date & Time *"}),r.jsx(it,{children:r.jsx(ge,{type:"datetime-local",...w})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:v.control,name:"end_datetime",render:({field:w})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"End Date & Time *"}),r.jsx(it,{children:r.jsx(ge,{type:"datetime-local",...w})}),r.jsx(Qe,{})]})})]})]}),r.jsxs("div",{className:"space-y-4 p-4 border rounded-lg bg-primary/5",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),"Contact Information (At least one required)"]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Users will contact you directly using these details"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[r.jsx(Ze,{control:v.control,name:"contact_phone",render:({field:w})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),"Phone Number"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"+234 xxx xxx xxxx",maxLength:aa.CONTACT_PHONE,...w})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:v.control,name:"contact_email",render:({field:w})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-4 w-4"}),"Email Address"]}),r.jsx(it,{children:r.jsx(ge,{type:"email",placeholder:"[email protected]",maxLength:aa.CONTACT_EMAIL,...w})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:v.control,name:"contact_whatsapp",render:({field:w})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Oh,{className:"h-4 w-4"}),"WhatsApp"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"+234 xxx xxx xxxx",maxLength:aa.CONTACT_WHATSAPP,...w})}),r.jsx(Qe,{})]})})]})]}),r.jsx(W,{type:"submit",className:"w-full bg-gradient-hero hover:opacity-90",size:"lg",disabled:d,children:d?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"h-5 w-5 mr-2 animate-spin"}),"Creating Event..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Xt,{className:"h-5 w-5 mr-2"}),"Create Event"]})})]})})]})]})},n1e=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(null),[a,i]=j.useState(!0),[o,l]=j.useState(!1);sc("events",()=>l(!0));const[c,d]=j.useState("");j.useEffect(()=>{u()},[]);const u=async()=>{try{const{data:h,error:f}=await H.from("events").select("*").eq("status","published").eq("moderation_status","approved").eq("is_featured",!0).gte("end_datetime",new Date().toISOString()).order("start_datetime",{ascending:!0}).limit(6);if(f)throw f;const m=(h==null?void 0:h.map(v=>v.id))||[],{data:x}=await H.from("ticket_types").select("*").in("event_id",m),p=(h||[]).map(v=>{const g=(x==null?void 0:x.filter(b=>b.event_id===v.id))||[],y=g.map(b=>b.price).filter(b=>b>0);return{...v,ticket_types:g,min_price:y.length>0?Math.min(...y):0,max_price:y.length>0?Math.max(...y):0}});t(p)}catch{be({title:"Error",description:"Failed to fetch featured events",variant:"destructive"})}finally{i(!1)}};return[...e],r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Nigerian Events: Concerts, Festivals & Culture",description:"From street shows to film premieresâdiscover what's on. Connect with Nigerian culture through live events across Nigeria."}),r.jsx(oo,{variant:"events",title:"Discover Nigerian Events",subtitle:"From street shows to film premieresâconnect with Nigerian culture through live events",icon:Xt,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:"Search events, venues, or categories...",value:c,onChange:h=>d(h.target.value),className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dar
887k:bg-background/95 backdrop-blur-sm"}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs(r.Fragment,{children:[r.jsxs(W,{size:"lg",className:"gap-2 bg-white/20 hover:bg-white/30 text-white border border-white/30",onClick:()=>{var h;return(h=document.getElementById("events-discovery"))==null?void 0:h.scrollIntoView({behavior:"smooth"})},children:[r.jsx(Wr,{className:"h-5 w-5"}),"Browse Events"]}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"List Your Event",intentKey:"events",onOpen:()=>l(!0)}),r.jsx(ac,{})]}),r.jsx(Rt,{open:o,onOpenChange:l,children:r.jsxs(Ot,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Create Your Event"})}),r.jsx(ES,{onSuccess:()=>l(!1)})]})})]})}),r.jsx("section",{className:"container mx-auto px-4 pt-10 max-w-6xl",children:r.jsxs("div",{className:"max-w-3xl",children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Your guide to Nigerian events, at home and abroad"}),r.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"We bring together community-listed events and hand-checked listings from trusted event sources so you can find concerts, owambe parties, cultural festivals, and business meetups in one place. Browse events shared directly by organisers on Naija.com under Discover, see what is happening in your city under Around You, or list your own event free to reach thousands of Nigerians."})]})}),r.jsx("div",{className:"container mx-auto px-4 pt-8",children:r.jsx(zo,{placementSlug:"events-top-leaderboard",className:"mx-auto mb-8"})}),r.jsx("section",{id:"events-discovery",className:"py-16 px-4",children:r.jsx("div",{className:"container mx-auto",children:r.jsxs(Kr,{defaultValue:"discover",className:"space-y-6",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-3",children:[r.jsx(Re,{value:"discover",children:"Discover Events"}),r.jsx(Re,{value:"imported",children:"Around You"}),r.jsx(Re,{value:"featured",children:"Featured Events"})]}),r.jsx(Be,{value:"discover",children:r.jsx(vje,{})}),r.jsx(Be,{value:"imported",children:r.jsx(Qwe,{})}),r.jsx(Be,{value:"featured",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx("h2",{className:"text-3xl font-bold",children:"Featured Events"})}),a?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3].map(h=>r.jsx("div",{className:"h-96 bg-muted rounded-lg animate-pulse"},h))}):e.length===0?r.jsx("div",{className:"text-center py-12",children:r.jsx("p",{className:"text-muted-foreground",children:"No featured events at the moment"})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map((h,f)=>r.jsxs(r.Fragment,{children:[r.jsx(e1e,{event:h,onSelect:()=>s(h)},h.id),(f+1)%6===0&&f<e.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${f}`)]}))})]})})]})})}),r.jsx("section",{className:"container mx-auto px-4 pb-10",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:"Events by city:"}),SS.map(h=>r.jsxs(Vt,{to:`/events/${h.slug}`,className:"rounded-full border px-4 py-1.5 text-sm hover:bg-accent transition-colors",children:["Events in ",h.name]},h.slug))]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsx("div",{className:"container mx-auto max-w-2xl",children:r.jsx(YO,{title:"Never Miss an Event",description:"Get notified about the hottest events, concerts, and cultural experiences happening across Nigeria."})})}),n&&r.jsx(t1e,{event:n,isOpen:!!n,onClose:()=>s(null)})]})},s1e=()=>{const{user:e}=bt(),{hasAnyRole:t}=fj(),[n,s]=j.useState([]),[a,i]=j.useState(!0);j.useState(null);const o=t(["event_organizer","admin"]);j.useEffect(()=>{e&&o&&l()},[e,o]);const l=async()=>{if(e)try{const{data:m,error:x}=await H.from("events").select(` 888 *, 889 ticket_types (*) 890 `).eq("organizer_id",e.id).order("created_at",{ascending:!1});if(x)throw x;const p=await Promise.all((m||[]).map(async v=>{const{data:g}=await H.from("tickets").select("ticket_type_id").eq("event_id",v.id).eq("payment_status","completed"),y=(g==null?void 0:g.length)||0,b=(g==null?void 0:g.reduce((w,_)=>{var E;const C=(E=v.ticket_types)==null?void 0:E.find(N=>N.id===_.ticket_type_id);return w+((C==null?void 0:C.price)||0)},0))||0;return{...v,tickets_sold:y,total_sales:b}}));s(p)}catch{be({title:"Error",description:"Failed to fetch events",variant:"destructive"})}finally{i(!1)}},c=async m=>{try{const{data:x,error:p}=await H.from("tickets").select(` 891 *, 892 ticket_types (name, price) 893 `).eq("event_id",m).eq("payment_status","completed");if(p)throw p;const v=["Name","Email","Phone","Ticket Type","Price","Purchase Date","Ticket Code"],g=(x==null?void 0:x.map(C=>{var E,N;return[C.buyer_name,C.buyer_email,C.buyer_phone||"",((E=C.ticket_types)==null?void 0:E.name)||"",`â¦${((N=C.ticket_types)==null?void 0:N.price)||0}`,new Date(C.created_at).toLocaleDateString(),C.ticket_code]}))||[],y=[v,...g].map(C=>C.map(E=>`"${E}"`).join(",")).join(` 894`),b=new Blob([y],{type:"text/csv"}),w=window.URL.createObjectURL(b),_=document.createElement("a");_.href=w,_.download=`attendees-${m}.csv`,_.click(),window.URL.revokeObjectURL(w),be({title:"Success",description:"Attendees list exported successfully"})}catch{be({title:"Error",description:"Failed to export attendees",variant:"destructive"})}};if(!o)return r.jsx(Y,{children:r.jsxs(X,{className:"p-6 text-center",children:[r.jsx(Xt,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Event Organizer Access Required"}),r.jsx("p",{className:"text-muted-foreground",children:"You need event organizer permissions to access this dashboard."})]})});if(a)return r.jsx("div",{className:"space-y-4",children:[1,2,3].map(m=>r.jsx(Y,{className:"animate-pulse",children:r.jsxs(X,{className:"p-4",children:[r.jsx("div",{className:"h-4 bg-muted rounded w-3/4 mb-2"}),r.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]})},m))});const d=n.length,u=n.reduce((m,x)=>m+(x.total_sales||0),0),h=n.reduce((m,x)=>m+(x.tickets_sold||0),0),f=n.filter(m=>new Date(m.end_datetime)>new Date).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h2",{className:"text-3xl font-bold",children:"Organizer Dashboard"}),r.jsxs(W,{className:"bg-gradient-hero hover:opacity-90",children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Create Event"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Total Events"}),r.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-2xl font-bold",children:d}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[f," active events"]})]})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Total Sales"}),r.jsx(Tn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:["â¦",u.toLocaleStr
894ing()]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[h," tickets sold"]})]})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Avg. Ticket Price"}),r.jsx(aj,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:["â¦",h>0?Math.round(u/h).toLocaleString():0]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Across all events"})]})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"This Month"}),r.jsx(lr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.filter(m=>new Date(m.created_at).getMonth()===new Date().getMonth()).length}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"New events created"})]})]})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Your Events"}),r.jsx(Nt,{children:"Manage your events and view performance metrics"})]}),r.jsx(X,{children:n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Xt,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No events yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Create your first event to get started"}),r.jsxs(W,{className:"bg-gradient-hero hover:opacity-90",children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Create Event"]})]}):r.jsx("div",{className:"space-y-4",children:n.map(m=>r.jsx(Y,{className:"border-l-4 border-l-primary",children:r.jsxs(X,{className:"p-6",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h3",{className:"text-lg font-semibold",children:m.title}),r.jsx(te,{variant:m.status==="published"?"default":"secondary",children:m.status}),r.jsx(te,{variant:m.moderation_status==="approved"?"default":"destructive",children:m.moderation_status})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Xt,{className:"h-4 w-4"}),new Date(m.start_datetime).toLocaleDateString()]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-4 w-4"}),m.city,", ",m.state]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Yr,{className:"h-4 w-4"}),m.tickets_sold||0," tickets sold"]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Tn,{className:"h-4 w-4"}),"â¦",(m.total_sales||0).toLocaleString()," revenue"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(W,{size:"sm",variant:"outline",children:[r.jsx(Cr,{className:"h-4 w-4 mr-1"}),"View"]}
894),r.jsxs(W,{size:"sm",variant:"outline",children:[r.jsx(so,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>c(m.id),children:[r.jsx(qh,{className:"h-4 w-4 mr-1"}),"Export CSV"]})]})]}),m.ticket_types&&m.ticket_types.length>0&&r.jsxs("div",{className:"mt-4 pt-4 border-t",children:[r.jsx("h4",{className:"text-sm font-semibold mb-2",children:"Ticket Types"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:m.ticket_types.map(x=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:x.name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["â¦",x.price.toLocaleString()]})]}),r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:[x.sold,"/",x.quantity]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"sold/total"})]})]},x.id))})]})]})},m.id))})})]})]})};function a1e(){const{user:e}=bt(),{hasAnyRole:t,loading:n}=fj();return e?n?r.jsx("div",{className:"min-h-screen flex items-center justify-center",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):t(["event_organizer","admin"])?r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"container mx-auto py-8",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[r.jsx(Xt,{className:"h-8 w-8 text-primary"}),r.jsx("h1",{className:"text-3xl font-bold",children:"Events Dashboard"})]}),r.jsxs(Kr,{defaultValue:"dashboard",className:"space-y-6",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-3",children:[r.jsxs(Re,{value:"dashboard",className:"flex items-center gap-2",children:[r.jsx(Qd,{className:"h-4 w-4"}),"Dashboard"]}),r.jsxs(Re,{value:"create",className:"flex items-center gap-2",children:[r.jsx(xs,{className:"h-4 w-4"}),"Create Event"]}),r.jsxs(Re,{value:"analytics",className:"flex items-center gap-2",children:[r.jsx(Yr,{className:"h-4 w-4"}),"Analytics"]})]}),r.jsx(Be,{value:"dashboard",children:r.jsx(s1e,{})}),r.jsx(Be,{value:"create",children:r.jsx("div",{className:"max-w-4xl",children:r.jsx(ES,{onSuccess:()=>{window.location.reload()}})})}),r.jsx(Be,{value:"analytics",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Analytics Overview"}),r.jsx(Nt,{children:"Detailed analytics and insights for your events"})]}),r.jsx(X,{children:r.jsxs("div",{className:"text-center py-8",children:[r.jsx(Qd,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Advanced Analytics Coming Soon"}),r.jsx("p",{className:"text-muted-foreground",children:"Detailed event performance metrics, audience insights, and revenue analytics will be available here."})]})})]})})]})]})}):r.jsx("div",{className:"min-h-screen bg-background",children:r.jsx("div",{className:"container mx-auto py-8",children:r.jsx(Y,{children:r.jsxs(X,{className:"p-8 text-center",children:[r.jsx(Xt,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Event Organizer Access Required"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"You need event organizer permissions to access this dashboard."}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Contact an administrator to upgrade your account to an Event Organizer."})]})})})}):r.jsx(V0,{to:"/auth",replace:!0})}const i1e=/^[a-z0-9][a-z0-9-]{0,63}$/,bX=e=>{const t=typeof window<"u"?window.location.pathname:"/";return`/go/${e}?from=${encodeURIComponent(t)}`},jX=()=>{try{const e="naija_aff_session",t=sessionStorage.getItem(e);if(t)return t;const n=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return sessionStorage.setItem(e,n),n}catch{return"no-session"}},o1e=async(e,t)=>{if(!i1e.test(e))return t;try{const n=typeof window<"u"?window.location.href:"";let s=null;try{s=n?new URL(n).searchParams.get("from"):null}catch{s=null}const a=s&&s.startsWith("/")?s:n,{supabase:i}=await Vc(async()=>{const{supabase:d}=await Promise.resolve().then(()=>_W);return{supabase:d}},void 0),{data:o,error:l}=await i.functions.invoke("affiliate-redirect",{body:{partner:e,page:a||void 0,referrer:typeof document<"u"&&document.referrer?document.referrer:void 0,session:jX()}});if(l||!o)return t;const c=o;return typeof c.url=="string"&&c.url.length>0?c.url:t}catch{return t}},l1e="Some links here are affiliate links. If you use them we may earn a commission, at no extra cost to you.",Ej=({category:e,title:t,blurb
894:n,ctaLabel:s="Open",className:a=""})=>{const[i,o]=j.useState([]);return j.useEffect(()=>{let l=!0;return(async()=>{const{data:d,error:u}=await H.from("affiliate_partners").select("slug, name, category, network, payout_model, payout_amount, payout_currency, payout_note, public_url, affiliate_url, disclosure, is_active, display_order").eq("is_active",!0).eq("category",e).order("display_order").limit(4);if(u){console.error("PartnerStrip load failed",u.message);return}l&&o(d??[])})(),()=>{l=!1}},[e]),i.length===0?null:r.jsxs("section",{className:`rounded-2xl border bg-muted/30 p-5 md:p-6 ${a}`,children:[r.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-2 mb-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base font-semibold",children:t}),n?r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:n}):null]}),r.jsx("span",{className:"text-[10px] text-muted-foreground/80",children:"Advertiser disclosure applies"})]}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:i.map(l=>r.jsxs("div",{className:"rounded-xl border bg-card p-4 flex flex-col justify-between gap-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("p",{className:"font-semibold text-sm leading-tight",children:l.name}),l.network?r.jsx(te,{variant:"outline",className:"text-[9px] px-1.5 py-0 shrink-0",children:l.network}):null]}),l.payout_note?r.jsx("p",{className:"text-xs text-muted-foreground mt-1.5 leading-relaxed",children:l.payout_note}):null]}),r.jsx(W,{asChild:!0,size:"sm",variant:"outline",className:"w-full text-xs",children:r.jsxs("a",{href:bX(l.slug),rel:"sponsored nofollow noopener",target:"_blank",children:[s," ",l.name.split(" ")[0],r.jsx(ds,{className:"ml-1.5 h-3.5 w-3.5"})]})})]},l.slug))}),r.jsx("p",{className:"mt-4 text-[11px] leading-relaxed text-muted-foreground",children:l1e})]})},s6=["Fashion & Clothing","Electronics","Home & Garden","Health & Beauty","Sports & Fitness","Arts & Crafts","Books & Media","Food & Beverages","Jewelry & Accessories","Baby & Kids","Automotive","Services","Others"],c1e=["Pickup","Local Delivery","Nationwide Shipping","International Shipping"],Ra={TITLE:50,DESCRIPTION:500,SKU:50,CITY:100,TAGS:500},a6=({onSuccess:e})=>{const{user:t}=bt(),{toast:n}=Sn(),{preferences:s,isLoading:a}=Di(),i=zn(),[o,l]=ee.useState(null),[c,d]=ee.useState(!0);ee.useEffect(()=>{(async()=>{if(!t){d(!1);return}try{const{data:m,error:x}=await H.rpc("check_product_limits",{user_id:t.id});x?(console.error("Error checking limits:",x),l({can_create_listing:!0,max_listings:3,current_listings:0,max_ph
894otos_per_listing:3,current_plan:"Free"})):l(m)}catch(m){console.error("Error:",m),l({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})}finally{d(!1)}})()},[t]);const u=lu({defaultValues:{delivery_options:[],images:[],country_code:"NG"}});ee.useEffect(()=>{!a&&s&&(u.setValue("country_code",s.country),u.setValue("state",s.state),u.setValue("city",s.city))},[s,a,u]),ee.useEffect(()=>{const f=u.watch((m,{name:x})=>{x==="country_code"&&u.setValue("state","")});return()=>f.unsubscribe()},[u]);const h=async f=>{var m,x;if(!t){n({title:"Please login to create products",variant:"destructive"});return}if(o&&!o.can_create_listing){n({title:"Listing limit reached",description:`You've reached your ${o.current_plan} plan limit. Please upgrade to create more products.`,variant:"destructive"});return}if(f.title.length>Ra.TITLE){n({title:`Title must be ${Ra.TITLE} characters or less`,variant:"destructive"});return}if(f.description.length>Ra.DESCRIPTION){n({title:`Description must be ${Ra.DESCRIPTION} characters or less`,variant:"destructive"});return}
894if(f.sku&&f.sku.length>Ra.SKU){n({title:`SKU must be ${Ra.SKU} characters or less`,variant:"destructive"});return}if(f.tags.length>Ra.TAGS){n({title:`Tags must be ${Ra.TAGS} characters or less`,variant:"destructive"});return}try{const{data:p}=await H.from("vendor_profiles").select("id").eq("user_id",t.id).single();if(!p){const g=((m=t.user_metadata)==null?void 0:m.full_name)||((x=t.email)==null?void 0:x.split("@")[0])||"My Store",{error:y}=await H.from("vendor_profiles").insert([{user_id:t.id,store_name:g,store_bio:"Welcome to my store!"}]);if(y)throw y}const{error:v}=await H.from("products").insert([{...f,vendor_id:t.id,location:`${f.city}, ${f.state}`,images:f.images.slice(0,(o==null?void 0:o.max_photos_per_listing)||3),tags:f.tags.split(",").map(g=>g.trim()).filter(g=>g).slice(0,20),delivery_options:f.delivery_options,country_code:f.country_code}]);if(v)throw v;n({title:"⨠Product Created!",description:"Your listing is now live on the marketplace! Feature it to get 10x more views.",duration:8e3}),u.reset(),e==null||e()}catch(p){n({title:"Failed to add product",description:p.message,variant:"destructive"})}};return r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(Qc,{className:"h-6 w-6 text-primary"}),"Add New Product"]}),r.jsx(Nt,{children:"List your product on the Nigerian marketplace"})]}),r.jsxs(X,{children:[o&&!c&&r.jsx(Pj,{planName:o.current_plan,currentListings:o.current_listings,maxListings:o.max_listings,photosPerListing:o.max_photos_per_listing,canCreate:o.can_create_listing,feature:"products"}),r.jsxs(_r,{className:"mb-6 mt-4 border-orange-200 bg-orange-50 dark:bg-orange-950/20",children:[r.jsx(Va,{className:"h-4 w-4 text-orange-600"}),r.jsx(Sr,{children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[r.jsxs("div",{children:[r.jsx("strong",{className:"text-orange-900 dark:text-orange-100",children:"Stand out from the crowd!"}),r.jsxs("span",{className:"text-orange-700 dark:text-orange-300 ml-2",children:["Featured products get ",r.jsx(te,{variant:"secondary",className:"mx-1 bg-orange-100 text-orange-700",children:"10x more views"}),"and sell faster"]})]}),r.jsx(W,{variant:"outline",size:"sm",className:"border-orange-300 text-orange-700 hover:bg-orange-100",onClick:()=>i("/dashboard",{state:{activeTab:"subscription"}}),children:"View Plans â"})]})})]}),r.jsx(tf,{...u,children:r.jsxs("form",{onSubmit:u.handleSubmit(h),className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:u.control,name:"title",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Xl,{className:"h-4 w-4"}),"Product Name"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Enter product name",maxLength:Ra.TITLE,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",Ra.TITLE," characters"]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:u.control,name:"sku",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"SKU (Product Code)"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"PROD-001",maxLength:Ra.SKU,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",Ra.SKU," characters"]}),r.jsx(Qe,{})]})}})]}),r.jsx(Ze,{control:u.control,name:"description",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Description"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Describe your product...",className:"min-h-[120px]",maxLength:Ra.DESCRIPTION,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",Ra.DESCRIPTION," characters"]}),r.jsx(Qe,{})]})}}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[r.jsx(Ze,{control:u.control,name:"price",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Tn,{className:"h-4 w-4"}),"Price (â¦)"]}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"10000",min:"0",max:"100000000",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"compare_at_price",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Compare Price (â¦)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"15000",min:"0",max:"100000000",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Pr,{children:"Original price (if on sale)"}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"stock",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Stock Quantity"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"50",min:"0",max:"1000000",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:u.control,name:"category",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(eoe,{className:"h-4 w-4"}),"Category"]}),r.jsxs(mt,{onValueChange:f.onChange,defaultValue:f.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select category"})})}),r.jsx(ht,{children:s6.map(m=>r.jsx(Ne,{value:m,children:m},m))})]}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"country_code",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(dc,{value:f.value,onValueChange:f.onChange,label:"Country",required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"state",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(uc,{countryCode:u.watch("country_code"),value:f.value,onChange:f.onChange,required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"city",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"City"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"e.g., Ikeja, Surulere",maxLength:Ra.CITY,...f})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:u.control,name:"is_digital",render:({field:f})=>r.jsxs(Ke,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(nt,{className:"text-base",children:"Digital Product"}),r.jsx(Pr,{children:"This is a digital product (downloadable)"})]}),r.jsx(it,{children:r.jsx(Ro,{checked:f.value,onCheckedChange:f.onChange})})]})}),r.jsx(Ze,{control:u.control,name:"weight",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Weight (kg)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",step:"0.1",placeholder:"0.5",min:"0",max:"10000",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Pr,{children:"For physical products only"}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:u.control,name:"images",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Product Images"}),r.jsx(it,{children:r.jsx(Wd,{images:f.value||[],onImagesChange:f.onChange,maxImages:(o==null?void 0:o.max_photos_per_listing)||3})}),r.jsxs(Pr,{children:["Upload up to ",(o==null?void 0:o.max_photos_per_listing)||3," images. First image will be the main product image."]}),r.jsx(Qe,{})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:u.control,name:"tags",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Tags"}
894),r.jsx(it,{children:r.jsx(ge,{placeholder:"handmade, quality, nigeria",maxLength:Ra.TAGS,...f})}),r.jsxs(Pr,{children:["Comma-separated tags (",((m=f.value)==null?void 0:m.length)||0," / ",Ra.TAGS,")"]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:u.control,name:"delivery_options",render:()=>r.jsxs(Ke,{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx(nt,{children:"Delivery Options"}),r.jsx(Pr,{children:"Select all that apply"})]}),r.jsx("div",{className:"space-y-2",children:c1e.map(f=>r.jsx(Ze,{control:u.control,name:"delivery_options",render:({field:m})=>{var x;return r.jsxs(Ke,{className:"flex flex-row items-start space-x-3 space-y-0",children:[r.jsx(it,{children:r.jsx(Uo,{checked:(x=m.value)==null?void 0:x.includes(f),onCheckedChange:p=>{var v;return p?m.onChange([...m.value||[],f]):m.onChange((v=m.value)==null?void 0:v.filter(g=>g!==f))}})}),r.jsx(nt,{className:"font-normal",children:f})]},f)}},f))}),r.jsx(Qe,{})]})})]}),r.jsxs(W,{type:"submit",className:"w-full bg-gradient-hero hover:opacity-90",size:"lg",children:[r.jsx(Qc,{className:"h-5 w-5 mr-2"}),"Add Product"]})]})})]})]})};function r8({product:e,vendorName:t,onClick:n}){const{user:s}=bt(),[a,i]=j.useState(null),[o,l]=j.useState(0),[c,d]=j.useState(!1);j.useEffect(()=>{s&&e.vendor_id&&d(s.id===e.vendor_id)},[s,e.vendor_id]),j.useEffect(()=>{const f=async()=>{const{data:m}=await H.from("public_vendor_profiles").select("store_name, business_phone, business_email").eq("user_id",e.vendor_id).single();m&&i(m)};e.vendor_id&&f()},[e.vendor_id]),j.useEffect(()=>{(async()=>{const{count:m}=await H.from("product_inquiries").select("*",{count:"exact",head:!0}).eq("product_id",e.id);m&&l(m)})()},[e.id]);const u=e.compare_at_price&&e.compare_at_price>e.price,h=u?Math.round((e.compare_at_price-e.price)/e.compare_at_price*100):0;return r.jsxs(Y,{className:"overflow-hidden hover:shadow-lg transition-shadow duration-300 cursor-pointer group",children:[r.jsxs("div",{className:"relative",onClick:n,children:[e.images&&e.images.length>0?r.jsx(Jh,{className:"w-full",children:r.jsx(Qh,{children:e.images.slice(0,3).map((f,m)=>r.jsx(ef,{children:r.jsx("div",{className:"relative aspect-square overflow-hidden",children:r.jsx("img",{src:vl(f),alt:`${e.title} ${m+1}`,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"})})},m))})}):r.jsx("div",{className:"aspect-square bg-gradient-to-br from-primary/10 to-accent/10 flex items-center justify-center",children:r.jsx(Xl,{className:"h-16 w-16 text-muted-foreground"})}),r.jsxs("div",{className:"absolute top-2 left-2 flex flex-col gap-2",children:[r.jsx(jx,{isBoosted:e.is_featured,boostExpiresAt:e.feature_expires_at}),u&&r.jsxs(te,{className:"bg-destructive",children:["Save ",h,"%"]})]}),e.stock===0&&r.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:r.jsx(te,{variant:"destructive",className:"text-lg py-2 px-4",children:"Out of Stock"})})]}),r.jsx(Se,{className:"pb-2",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-2 group-hover:text-primary transition-colors",children:e.title}),(t||(a==null?void 0:a.store_name))&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["by ",t||(a==null?void 0:a.store_name)]}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-2xl font-bold",children:["â¦",e.price.toLocaleString()]}),u&&r.jsxs("span",{className:"text-sm text-muted-foreground line-through",children:["â¦",e.compare_at_price.toLocaleString()]})]})]})}),r.jsxs(X,{className:"pb-2",children:[e.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.description}),r.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[e.location&&r.jsx(mv,{state:e.location,countryCode:e.country_code,variant:"outline",showIcon:!1}),o>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cr,{className:"h-3 w-3"}),r.jsxs("span",{children:[o," inquiries"]})]}),e.stock>0&&r.jsxs(te,{variant:"outline",className:"text-xs",children:[e.stock," in stock"]})]}),e.tags&&e.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:e.tags.slice(0,3).map(f=>r.jsx(te,{variant:"secondary",className:"text-xs",children:f},f))})]}),r.jsxs(kj,{className:"pt-2 flex-col gap-2",children:[!c&&a&&r.jsx(DO,{product:{id:e.id,title:e.title,vendor_id:e.vendor_id},vendor:a,variant:"default",className:"w-full"}),c&&r.jsx(yK,{productId:e.id,productTitle:e.title,currentlyFeatured:e.is_featured,variant:"default",size:"default",className:"w-full",onFeatureStatusChange:()=>{console.log("Product featured status changed")}})]})]})}function d1e(){return r.jsxs(Y,{className:"overflow-hidden",children:[r.jsx(jn,{className:"h-48 w-full"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(jn,{className:"h-4 w-3/4"}),r.jsx(jn,{className:"h-4 w-1/2"}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(jn,{className:"h-6 w-20"}),r.jsx(jn,{className:"h-8 w-24"})]})]})]})}function u1e({count:e=8}){return r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:Array.from({length:e}).map((t,n)=>r.jsx(d1e,{},n))})}function h1e(){return r.jsxs("tr",{children:[r.jsx("td",{className:"p-4",children:r.jsx(jn,{className:"h-4 w-full"})}),r.jsx("td",{className:"p-4",children:r.jsx(jn,{className:"h-4 w-full"})}),r.jsx("td",{className:"p-4",children:r.jsx(jn,{className:"h-4 w-full"})}),r.jsx("td",{className:"p-4",children:r.jsx(jn,{className:"h-4 w-20"})})]})}
894function f1e({rows:e=5}){return r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"bg-muted",children:r.jsxs("tr",{children:[r.jsx("th",{className:"p-4 text-left",children:r.jsx(jn,{className:"h-4 w-24"})}),r.jsx("th",{className:"p-4 text-left",children:r.jsx(jn,{className:"h-4 w-24"})}),r.jsx("th",{className:"p-4 text-left",children:r.jsx(jn,{className:"h-4 w-24"})}),r.jsx("th",{className:"p-4 text-left",children:r.jsx(jn,{className:"h-4 w-16"})})]})}),r.jsx("tbody",{children:Array.from({length:e}).map((t,n)=>r.jsx(h1e,{},n))})]})})}function wX({icon:e,title:t,description:n,action:s,secondaryAction:a}){return r.jsx(Y,{className:"p-12 text-center",children:r.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4",children:[e&&r.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center text-muted-foreground",children:e}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xl font-semibold",children:t}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:n})]}),(s||a)&&r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-4",children:[s&&r.jsx(W,{onClick:s.onClick,variant:s.variant||"default",size:"lg",children:s.label}),a&&r.jsx(W,{onClick:a.onClick,variant:"outline",size:"lg",children:a.label})]})]})})}function m1e({onCreateProduct:e}){return r.jsx(wX,{icon:r.jsx(Xl,{className:"h-8 w-8"}),title:"No Products Yet",description:"Start selling by creating your first product listing. It only takes a few minutes!",action:{label:"Create Your First Product",onClick:e}})}function p1e({query:e,onClearFilters:t}){return r.jsx(wX,{icon:r.jsx(Wr,{className:"h-8 w-8"}),title:`No results for "${e}"`,description:"Try adjusting your search or filters to find what you're looking for",action:{label:"Clear Filters",onClick:t,variant:"outline"}})}const g1e=["All Categories",...s6],x1e=()=>{bt(),Di();const[e,t]=j.useState(""),[n,s]=j.useState("All Categories"),[a,i]=j.useState("all"),[o,l]=j.useState([]),[c,d]=j.useState({}),[u,h]=j.useState(!0),[f,m]=j.useState(null),[x,p]=j.useState(!1);sc("buy-sell",()=>p(!0));const[v,g]=j.useState({country:"",state:"",city:""}),[y,b]=j.useState(!1),w=N=>{N?(g({country:N.country,state:N.state,city:N.city}),b(!0)):(g({country:"",state:"",city:""}),b(!1))};j.useEffect(()=>{_()},[]);const _=async()=>{try{const{data:N,error:k}=await H.from("products").select("*").eq("status","active").eq("moderation_status","approved").order("is_featured",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(k)throw k;const I=[...new Set(N==null?void 0:N.map(P=>P.vendor_id).filter(Boolean))];if(I.length>0){const{data:P}=await H.from("public_vendor_profiles").select("user_id, store_name").in("user_id",I),O={};P==null||P.forEach(A=>{O[A.user_id]=A.store_name}),d(O)}l(N||[])}catch{be({title:"Error",description:"Failed to load products",variant:"destructive"})}finally{h(!1)}},C=o.filter(N=>{var L,z,U,$;const k=N.title.toLowerCase().includes(e.toLowerCase())||((L=N.description)==null?void 0:L.toLowerCase().includes(e.toLowerCase()))||((z=N.category)==null?void 0:z.toLowerCase().includes(e.toLowerCase())),I=n==="All Categories"||N.category===n;let P=!0;a==="under-10k"?P=N.price<1e4:a==="10k-50k"?P=N.price>=1e4&&N.price<5e4:a==="over-50k"&&(P=N.price>=5e4);const O=!v.country||N.country_code===v.country,A=!v.state||((U=N.state)==null?void 0:U.toLowerCase())===v.state.toLowerCase(),R=!v.city||(($=N.city)==null?void 0:$.toLowerCase().includes(v.city.toLowerCase()));return k&&I&&P&&O&&A&&R}),E=C.filter(N=>N.is_featured).slice(0,6);return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Nigerian Marketplace | Shop Local Products & Services",description:"Shop from Nigerian creators and vendors. Find unique fashion, art, music, digital products and more. Support local businesses and discover authentic Nigerian products."}),r.jsx(oo,{variant:"marketplace",title:"Nigerian Marketplace",subtitle:"Shop Nigerian creatorsâfashion, art, music & more. Support local talent and discover unique products.",icon:Kq,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:"Search products, vendors, or categories...",value:e,onCh
894ange:N=>t(N.target.value),className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dark:bg-background/95 backdrop-blur-sm"}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs(r.Fragment,{children:[r.jsx($h,{active:y,onToggle:w}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"List Your Product",intentKey:"buy-sell",onOpen:()=>p(!0)}),r.jsx(ac,{})]}),r.jsx(Rt,{open:x,onOpenChange:p,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"List Your Product"})}),r.jsx(a6,{onSuccess:()=>{p(!1),_()}})]})}),r.jsx(Vt,{to:"/create",children:r.jsxs(W,{size:"lg",className:"gap-2 bg-white/20 hover:bg-white/30 text-white border border-white/30",children:[r.jsx(Qc,{className:"h-5 w-5"}),"Open a Shop"]})})]})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:r.jsxs("div",{className:"flex flex-col gap-6",children:[r.jsx("div",{className:"flex flex-col md:flex-row gap-4 items-center justify-between",children:r.jsxs("div",{className:"flex gap-4 w-full md:w-auto",children:[r.jsxs(mt,{value:n,onValueChange:s,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"Category"})}),r.jsx(ht,{children:g1e.map(N=>r.jsx(Ne,{value:N,children:N},N))})]}),r.jsxs(mt,{value:a,onValueChange:i,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"Price Range"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Prices"}),r.jsx(Ne,{value:"under-10k",children:"Under â¦10,000"}),r.jsx(Ne,{value:"10k-50k",children:"â¦10,000 - â¦50,000"}),r.jsx(Ne,{value:"over-50k",children:"Over â¦50,000"})]})]})]})}),r.jsxs(Y,{className:"p-4",children:[r.jsxs("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[r.jsx(nj,{className:"h-4 w-4"}),"Filter by Location"]}),r.jsx(XO,{values:v,onChange:g,compact:!0})]})]})}),E.length>0&&r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:[r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsx("h2",{className:"text-3xl font-bold",children:"Featured Products"})}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:E.map(N=>r.jsx(r8,{product:N,vendorName:c[N.vendor_id],onClick:()=>m(N)},N.id))})]}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:[r.jsx("div",{className:"mb-6",children:r.jsx(zo,{placementSlug:"marketplace-leaderboard",className:"mx-auto"})}),r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("h2",{className:"text-3xl font-bold",children:E.length>0?"All Products":"Products"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:u?"Loading...":`${C.length} products found`})]}),u?r.jsx(u1e,{count:8}):C.length===0?r.jsx(p1e,{query:e,onClearFilters:()=>{t(""),s("All Categories"),i("all"),g({country:"",state:"",city:""})}}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:C.map((N,k)=>r.jsxs(r.Fragment,{children:[r.jsx(r8,{product:N,vendorName:c[N.vendor_id],onClick:()=>m(N)},N.id),(k+1)%6===0&&k<C.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${k}`)]}))})]}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 pb-4",children:r.jsx(Ej,{category:"marketplace",title:"Everything else you need",blurb:"Gear and supplies that are easier to order than to hunt for locally.",ctaLabel:"Shop"})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-16",children:r.jsx(YO,{title:"Shop the Latest",description:"Get notified about new products, exclusive deals, and special collections from Nigerian creators."})}),r.jsx(bK,{open:!!f,onOpenChange:N=>!N&&m(null),product:f,vendorName:f?c[f.vendor_id]:void 0})]})},ia={NAME:50,DESCRIPTION:500,PHONE:20,EMAIL:54,ADDRESS:200,CITY:100,MENU_URL:1048},v1e=["Nigerian","Continental","Chinese","Indian","Italian","Fast Food","Seafood","Grills","Local Dishes","International","Vegetarian","Pastries"],y1e=["Local Cuisine","Fine Dining","Street Food","Fast Food","Cafe","Bar & Grill","Others"],b1e=["â¦","â¦â¦","â¦â¦â¦","â¦â¦â¦â¦"];function i6({onSuccess:e}){var k,I,P,O;const{user:t}=bt(),[n,s]=j.useState(!1),[a,i]=j.useState([]),[o,l]=j.useState([]),[c,d]=j.useState(null),[u,h]=j.useState(!0),{preferences:f,isLoading:m}=Di(),{register:x,handleSubmit:p,formState:{errors:v},setValue:g,watch:y}=lu({defaultValues:{country_code:"NG"}});j.useEffect(()=>{!m&&f&&(g("country_code",f.country),g("state",f.state),g("city",f.city))},[f,m,g]),j.useEffect(()=>{(async()=>
894{if(!t){h(!1);return}try{const{data:R,error:L}=await H.rpc("check_restaurant_limits",{user_id:t.id});L?(console.error("Error checking restaurant limits:",L),d({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})):d(R)}catch(R){console.error("Error:",R),d({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})}finally{h(!1)}})()},[t]);const b=y("country_code"),w=y("delivery_available");j.useEffect(()=>{g("state","")},[b,g]);const _=async A=>{const R=A.target.files;if(!R||!t)return;const L=(c==null?void 0:c.max_photos_per_listing)||3;if(a.length+R.length>L){be({title:"Too many images",description:`You can upload a maximum of ${L} images`,variant:"destructive"});return}s(!0);const z=[];for(let U=0;U<R.length;U++){const $=R[U],q=$.name.split(".").pop(),ne=`${t.id}/${Math.random()}.${q}`,{error:se,data:F}=await H.storage.from("restaurant-images").upload(ne,$);if(se)be({title:"Upload failed",description:se.message,variant:"destructive"});else{const{data:{publicUrl:V}}=H.storage.from("restaurant-images").getPublicUrl(ne);z.push(V)}}i([...a,...z]),s(!1)},C=A=>{i(a.filter((R,L)=>L!==A))},E=A=>{if(o.includes(A))l(o.filter(R=>R!==A));else{if(o.length>=10){be({title:"Maximum cuisines reached",description:"You can select up to 10 cuisine types",variant:"destructive"});return}l([...o,A])}},N=async A=>{if(!t){be({title:"Authentication required",description:"Please sign in to create a restaurant listing",variant:"destructive"});return}if(c&&!c.can_create_listing){be({title:"Listing limit reached",description:`You've reached your ${c.current_plan} plan limit. Please upgrade to create more restaurants.`,variant:"destructive"});return}if(A.name.length>ia.NAME){be({title:"Name too long",description:`Restaurant name must be ${ia.NAME} characters or less`,variant:"destructive"});return}if(A.description.length>ia.DESCRIPTION){be({title:"Description too long",description:`Description must be ${ia.DESCRIPTION} characters or less`,variant:"destructive"});return}if(A.address.length>ia.ADDRESS){be({title:"Address too long",description:`Address must be ${ia.ADDRESS} characters or less`,variant:"destructive"});return}if(A.menu_url&&A.menu_url.length>ia.MENU_URL){be({title:"Menu URL too long",description:`Menu URL must be ${ia.MENU_URL} characters or less`,variant:"destructive"});return}if(a.length===0){be({title:"Images required",description:"Please upload at least one image",variant:"destructive"});return}if(o.length===0){be({title:"Cuisine type required",description:"Please select at least one cuisine type",variant:"destructive"});return}s(!0);const{error:R}=await H.from("restaurants").insert({owner_id:t.id,name:A.name,description:A.description,category:A.category,cuisine_types:o.slice(0,10),phone:A.phone,email:A.email,address:A.address,city:A.city,state:A.state,country_code:A.country_code,price_range:A.price_range,opens_at:A.opens_at,closes_at:A.closes_at,delivery_available:A.delivery_available,delivery_radius_km:A.delivery_radius_km,menu_url:A.menu_url,images:a.slice(0,(c==null?void 0:c.max_photos_per_listing)||3),status:"draft",moderation_status:"pending"});s(!1),R?be({title:"Error",description:R.message,variant:"destructive"}):(be({title:"Success!",description:"Your restaurant has been submitted for review"}),e==null||e())};return r.jsxs("form",{onSubmit:p(N),className:"space-y-6",children:[c&&!u&&r.jsx(Pj,{planName:c.current_plan,currentListings:c.current_listings,maxListings:c.max_listings,photosPerListing:c.max_photos_per_listing,canCreate:c.can_create_listing,feature:"restaurants"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"name",children:"Restaurant Name *"}),r.jsx(ge,{id:"name",...x("name",{required:"Restaurant name is required"}),placeholder:"e.g., Yellow Chilli",maxLength:ia.NAME}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[((k=y("name"))==null?void 0:k.length)||0," / ",ia.NAME," characters"]}),v.name&&r.jsx("p",{className:"text-sm text-destructive mt-1",children:v.name.message})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"description",children:"Description *"}),r.jsx(ir,{id:"description",...x("description",{required:"Description is required"}),placeholder:"Tell us about your restaurant...",rows:4,maxLength:ia.DESCRIPTION}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[((I=y("description"))==null?void 0:I.length)||0," / ",ia.DESCRIPTION," characters"]}),v.description&&r.jsx("p",{className:"text-sm text-destructive mt-1",children:v.description.message})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"category",children:"Category *"}),r.jsxs(mt,{onValueChange:A=>g("category",A),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select category"})}),r.jsx(ht,{children:y1e.map(A=>r.jsx(Ne,{value:A,children:A},A))})]})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"price_range",children:"Price Range *"}),r.jsxs(mt,{onValueChange:A=>g("price_range",A),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select price range"})}),r.jsx(ht,{children:b1e.map(A=>r.jsx(Ne,{value:A,children:A},A))})]})]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Cuisine Types * (Max 10)"}),r.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:[o.length," / 10 selected"]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2 mt-2",children:v1e.map(A=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Uo,{id:A,checked:o.includes(A),onCheckedChange:()=>E(A),disabled:!o.includes(A)&&o.length>=10}),r.jsx("label",{htmlFor:A,className:"text-sm cursor-pointer",children:A})]},A))})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"phone",children:"Phone Number *"}),r.jsx(ge,{id:"phone",...x("phone",{required:"Phone number is required"}),placeholder:"e.g., 08012345678",maxLength:ia.PHONE})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"email",children:"Email *"}),r.jsx(ge,{id:"email",type:"email",...x("email",{required:"Email is required"}),placeholder:"[email protected]",maxLength:ia.EMAIL})]})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"address",children:"Address *"}),r.jsx(ge,{id:"address",...x("address",{required:"Address is required"}),placeholder:"Street address",maxLength:ia.ADDRESS}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[((P=y("address"))==null?void 0:P.length)||0," / ",ia.ADDRESS," characters"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{children:r.jsx(dc,{value:y("country_code"),onValueChange:A=>g("country_code",A),label:"Country",required:!0})}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"city",children:"City *"}),r.jsx(ge,{id:"city",...x("city",{required:"City is required"}),placeholder:"e.g., Lagos",maxLength:ia.CITY})]}),r.jsx("div",{children:r.jsx(uc,{countryCode:y("country_code"),value:y("state")||"",onChange:A=>g("state",A),required:!0})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"opens_at",children:"Opens At *"}),r.jsx(ge,{id:"opens_at",type:"time",...x("opens_at",{required:"Opening time is required"})})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"closes_at",children:"Closes At *"}),r.jsx(ge,{id:"closes_at",type:"time",...x("closes_at",{required:"Closing time is required"})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Uo,{id:"delivery_available",...x("delivery_available")}),r.jsx(le,{htmlFor:"delivery_available",children:"Delivery Available"})]}
894),w&&r.jsxs("div",{children:[r.jsx(le,{htmlFor:"delivery_radius_km",children:"Delivery Radius (km)"}),r.jsx(ge,{id:"delivery_radius_km",type:"number",...x("delivery_radius_km"),placeholder:"e.g., 5",min:"0",max:"100"})]})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"menu_url",children:"Menu URL (optional)"}),r.jsx(ge,{id:"menu_url",...x("menu_url"),placeholder:"https://your-menu-link.com",maxLength:ia.MENU_URL}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[((O=y("menu_url"))==null?void 0:O.length)||0," / ",ia.MENU_URL," characters"]})]}),r.jsxs("div",{children:[r.jsxs(le,{children:["Restaurant Images * (Max ",(c==null?void 0:c.max_photos_per_listing)||3,")"]}),r.jsx("div",{className:"mt-2",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(W,{type:"button",variant:"outline",disabled:n||a.length>=((c==null?void 0:c.max_photos_per_listing)||3),onClick:()=>{var A;return(A=document.getElementById("image-upload"))==null?void 0:A.click()},children:[r.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Upload Images"]}),r.jsx("input",{id:"image-upload",type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:_}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[a.length,"/5 uploaded"]})]})}),a.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-4 mt-4",children:a.map((A,R)=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:A,alt:`Upload ${R+1}`,className:"w-full h-32 object-cover rounded-lg"}),r.jsx(W,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>C(R),children:r.jsx(ks,{className:"h-4 w-4"})})]},R))})]})]}),r.jsxs(W,{type:"submit",disabled:n,className:"w-full",children:[n&&r.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}),"Submit Restaurant"]})]})}function NX({restaurantId:e,restaurantName:t,variant:n="card"}){const{user:s}=bt(),a=zn(),[i,o]=j.useState(!1),[l,c]=j.useState(!1),[d,u]=j.useState({businessEmail:"",businessPhone:"",message:""}),h=()=>{if(!s){a("/auth");return}o(!0)},f=async x=>{if(x.preventDefault(),!!s){c(!0);try{const{error:p}=await H.from("restaurants").update({is_claimed:!0,claimed_by:s.id,claimed_at:new Date().toISOString(),owner_id:s.id}).eq("id",e).eq("is_claimed",!1);if(p)throw p;be({title:"Claim submitted!",description:`Your claim for "${t}" has been submitted. You can now manage this listing from your dashboard.`}),o(!1)}catch(p){be({title:"Error",description:p.message||"Failed to submit claim",variant:"destructive"})}finally{c(!1)}}},m=r.jsx(Rt,{open:i,onOpenChange:o,children:r.jsxs(Ot,{children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{children:['Claim "',t,'"']}),r.jsx(on,{children:"Verify that you own or manage this restaurant to take control of the listing."})]}),r.jsxs("form",{onSubmit:f,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"businessEmail",children:"Business Email"}),r.jsx(ge,{id:"businessEmail",type:"email",required:!0,value:d.businessEmail,onChange:x=>u({...d,businessEmail:x.target.value}),placeholder:"[email protected]"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"businessPhone",children:"Business Phone"}),r.jsx(ge,{id:"businessPhone",type:"tel",required:!0,value:d.businessPhone,onChange:x=>u({...d,businessPhone:x.target.value}),placeholder:"+234..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"message",children:"Additional Info (optional)"}),r.jsx(ir,{id:"message",value:d.message,onChange:x=>u({...d,message:x.target.value}),placeholder:"Tell us how you're connected to this business..."})]}),r.jsx(W,{type:"submit",className:"w-full",disabled:l,children:l?"Submitting...":"Submit Claim"})]})]})});return n==="card"?r.jsxs(r.Fragment,{children:[r.jsxs(W,{variant:"outline",size:"sm",className:"text-xs gap-1",onClick:x=>{x.stopPropagation(),h()},children:[r.jsx(Qc,{className:"h-3 w-3"}),"Claim"]}),m]}):r.jsxs(r.Fragment,{children:[r.jsxs(W,{className:"w-full gap-2",variant:"default",onClick:h,children:[r.jsx(sj,{className:"h-4 w-4"}),"Own this restaurant? Claim it"]}),m]})}function j1e({restaurant:e,onClick:t}){const n=s=>{if(!s)return"";const[a,i]=s.split(":"),o=parseInt(a),l=o>=12?"PM":"AM";return`${o%12||12}:${i} ${l}`};return r.jsxs(Y,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:t,children:[r.jsxs("div",{className:"relative h-48 overflow-hidden",children:[r.jsx("img",{src:vl(e.images[0])||"/placeholder.svg",alt:e.name,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsx(jx,{isBoosted:e.is_boosted,boostExpiresAt:e.boost_expires_at})}),r.jsxs("div",{className:"absolute top-2 right-2 flex flex-col gap-1",children:[r.jsx(te,{variant:"secondary",className:"bg-white/90 backdrop-blur text-gray-900",children:e.category}),e.delivery_available&&r.jsxs(te,{variant:"secondary",className:"bg-white/90 backdrop-blur text-gray-900",children:[r.jsx(BN,{className:"h-3 w-3 mr-1"}),"Delivery"]})]}),r.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1",children:[r.jsx(te,{variant:"secondary",className:"bg-white/90 backdrop-blur text-gray-900 text-lg",children:e.price_range}),e.is_claimed===!1&&r.jsx(te,{variant:"outline",className:"bg-background/90 backdrop-blur text-xs border-amber-500 text-amber-600",children:"Unclaimed"})]})]}),r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-bold text-lg mb-1 line-clamp-1",children:e.name}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:e.description})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.cuisine_types.slice(0,3).map(s=>r.jsx(te,{variant:"outline",className:"text-xs",children:s},s)),e.cuisine_types.length>3&&r.jsxs(te,{variant:"outline",className:"text-xs",children:["+",e.cuisine_types.length-3," more"]})]}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsx(mv,{city:e.city,state:e.state,countryCode:e.country_code,variant:"outline"}),r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx($r,{className:"h-4 w-4 shrink-0"}),r.jsxs("span",{children:[n(e.opens_at)," - ",n(e.closes_at)]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(an,{className:"h-4 w-4 shrink-0"}),r.jsx("span",{children:e.phone})]}),e.total_reviews>0&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(mr,{className:"h-4 w-4 fill-primary text-primary"}),r.jsx("span",{className:"font-medium",children:e.average_rating.toFixed(1)}),r.jsxs("span",{className:"text-muted-foreground",children:["(",e.total_reviews," reviews)"]})]})]}),e.is_claimed===!1&&r.jsx("div",{className:"pt-1",children:r.jsx(NX,{restaurantId:e.id,restaurantName:e.name,variant:"card"})})]})})]})}function w1e({restaurant:e,open:t,onOpenChange:n}){const[s,a]=j.useState(0);if(!e)return null;const i=l=>{if(!l)return"";const[c,d]=l.split(":"),u=parseInt(c),h=u>=12?"PM":"AM";return`${u%12||12}:${d} ${h}`},o=()=>
894{if(e.latitude&&e.longitude)window.open(`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,"_blank");else{const l=encodeURIComponent(`${e.name} ${e.address} ${e.city} ${e.state}`);window.open(`https://www.google.com/maps/search/?api=1&query=${l}`,"_blank")}};return r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{className:"text-2xl",children:e.name})}),r.jsxs(Kr,{defaultValue:"overview",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-3",children:[r.jsx(Re,{value:"overview",children:"Overview"}),r.jsx(Re,{value:"photos",children:"Photos"}),r.jsx(Re,{value:"reviews",children:"Reviews"})]}),r.jsxs(Be,{value:"overview",className:"space-y-6",children:[r.jsxs("div",{className:"relative h-64 rounded-lg overflow-hidden",children:[r.jsx("img",{src:e.images[s]||"/placeholder.svg",alt:e.name,className:"w-full h-full object-cover"}),r.jsxs("div",{className:"absolute top-4 right-4 flex gap-2",children:[r.jsx(te,{className:"text-lg",children:e.price_range}),r.jsx(te,{children:e.category})]})]}),e.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto",children:e.images.map((l,c)=>r.jsx("img",{src:l,alt:`${e.name} ${c+1}`,className:`h-16 w-20 object-cover rounded cursor-pointer ${c===s?"ring-2 ring-primary":""}`,onClick:()=>a(c)},c))}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"About"}),r.jsx("p",{className:"text-muted-foreground",children:e.description})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"Cuisine Types"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.cuisine_types.map(l=>r.jsx(te,{variant:"secondary",children:l},l))})]}),r.jsx(sl,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Contact & Location"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(At,{className:"h-5 w-5 mt-0.5 text-muted-foreground shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Address"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.address,", ",e.city,", ",e.state]}),r.jsxs(W,{variant:"link",size:"sm",className:"p-0 h-auto mt-1",onClick:o,children:[r.jsx(_m,{className:"h-3 w-3 mr-1"}),"Get Directions"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(an,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Phone"}),r.jsx("a",{href:`tel:${e.phone}`,className:"text-sm text-primary hover:underline",children:e.phone})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Dn,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Email"}),r.jsx("a",{href:`mailto:${e.email}`,className:"text-sm text-primary hover:underline",children:e.email})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx($r,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Hours"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[i(e.opens_at)," - ",i(e.closes_at)]})]})]}),e.delivery_available&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(BN,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Delivery"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Available",e.delivery_radius_km&&` (${e.delivery_radius_km}km radius)`]})]})]}),e.total_reviews>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(mr,{className:"h-5 w-5 text-primary fill-primary shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Rating"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.average_rating.toFixed(1)," (",e.total_reviews," reviews)"]})]})]})]})]}),e.menu_url&&r.jsx(W,{asChild:!0,className:"w-full mt-4",children:r.jsxs("a",{href:e.menu_url,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(ds,{className:"h-4 w-4 mr-2"}),"View Full Menu"]})}),e.website_url&&r.jsx(W,{asChild:!0,variant:"outline",className:"w-full mt-2",children:r.jsxs("a",{href:e.website_url,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(hn,{className:"h-4 w-4 mr-2"}),"Visit Website"]})}
894),e.is_claimed===!1&&r.jsx("div",{className:"mt-4",children:r.jsx(NX,{restaurantId:e.id,restaurantName:e.name,variant:"detail"})})]})]}),r.jsx(Be,{value:"photos",children:r.jsxs(Jh,{className:"w-full",children:[r.jsx(Qh,{children:e.images.map((l,c)=>r.jsx(ef,{children:r.jsx("div",{className:"h-96 rounded-lg overflow-hidden",children:r.jsx("img",{src:l,alt:`${e.name} ${c+1}`,className:"w-full h-full object-cover"})})},c))}),r.jsx(Jm,{}),r.jsx(Qm,{})]})}),r.jsx(Be,{value:"reviews",children:r.jsxs("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-muted-foreground",children:"Reviews coming soon"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Integration with universal_reviews table will be added next"})]})})]})]})})}function o6({brand:e,className:t}){return r.jsx("div",{className:Ge("w-full border-b border-border bg-muted/30",t),children:r.jsxs("div",{className:"container max-w-6xl mx-auto px-4 py-2 flex items-center justify-between gap-3 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsxs("span",{className:Ge("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-bold tracking-wider uppercase shrink-0",e.accentClass),children:[r.jsx("span",{children:"Naija"}),r.jsx("span",{className:"opacity-90",children:e.suffix})]}),r.jsx("span",{className:"hidden sm:inline text-muted-foreground truncate",children:e.tagline})]}),r.jsxs(ai,{to:"/",className:"text-xs text-muted-foreground hover:text-foreground shrink-0",children:["part of ",r.jsx("span",{className:"font-semibold",children:e.parent})]})]})})}const N1e={stays:{key:"stays",name:"Naija Stays",parent:"Naija.com",suffix:"STAYS",path:"/rentals",tagline:"Hotels, apartments & short-term rentals across Nigeria.",seoTitle:"Naija Stays â Hotels, Apartments & Short-Term Rentals in Nigeria",seoDescription:"Book hotels, apartments, villas, and short-term rentals across Nigeria on Naija Stays â part of the Naija.com network.",accentClass:"bg-naija-green text-white",jsonLdType:"LodgingBusiness",defaultUtm:{source:"naija-stays",medium:"sub-brand",campaign:"stays-landing"},social:{},vanityDomain:"naijastays.com"},eats:{key:"eats",name:"Naija Eats",parent:"Naija.com",suffix:"EATS",path:"/restaurants",tagline:"Discover Nigerian restaurants, street food & fine dining.",seoTitle:"Naija Eats â Nigerian Restaurants, Local Cuisine & Delivery",seoDescription:"Find Nigerian restaurants, local cuisine, street food and fine dining on Naija Eats â part of the Naija.com network.",accentClass:"bg-naija-gold text-foreground",jsonLdType:"Restaurant",defaultUtm:{source:"naija-eats",medium:"sub-brand",campaign:"eats-landing"},social:{},vanityDomain:"naijaeats.com"},wheels:{key:"wheels",name:"Naija Wheels",parent:"Naija.com",suffix:"WHEELS",path:"/rental-cars",tagline:"Rent a car, truck or equipment â with or without driver.",seoTitle:"Naija Wheels â Car, Truck & Equipment Rentals in Nigeria",seoDescription:"Rent cars, SUVs, trucks, and equipment across Nigeria on Naija Wheels â part of the Naija.com network. Driver optional.",accentClass:"bg-primary text-primary-foreground",jsonLdType:"AutoRental",defaultUtm:{source:"naija-wheels",medium:"sub-brand",campaign:"wheels-landing"},social:{},vanityDomain:"naijawheels.com"},explore:{key:"explore",name:"Naija Explore",parent:"Naija.com",suffix:"EXPLORE",path:"/tourism",tagline:"Tours, attractions & travel services across Nigeria.",seoTitle:"Naija Explore â Tourism, Attractions & Travel Services in Nigeria",seoDescription:"Discover Nigerian attractions, tour operators, and travel services on Naija Explore â part of the Naija.com network.",accentClass:"bg-accent text-accent-foreground",jsonLdType:"TouristAttraction",defaultUtm:{source:"naija-explore",medium:"sub-brand",campaign:"explore-landing"},social:{},vanityDomain:"naijaexplore.com"}},l6=e=>N1e[e],Nk="naija_utm";function c6(e){j.useEffect(()=>{if(!(typeof window>"u"))try{const t=new URLSearchParams(window.location.search),n=t.get("utm_source"),s=t.get("utm_medium"),a=t.get("utm_campaign");n||s||a?sessionStorage.setItem(Nk,JSON.stringify({source:n??(e==null?void 0:e.source)??"",medium:s??(e==null?void 0:e.medium)??"",campaign:a??(e==null?void 0:e.campaign)??"",ts:Date.now()})):e&&!sessionStorage.getItem(Nk)&&sessionStorage.setItem(Nk,JSON.stringify({...e,ts:Date.now()}))}catch{}},[e==null?void 0:e.source,e==null?void 0:e.medium,e==null?void 0:e.campaign])}const _1e=["All States","Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"],S1e=["All Categories","Local Cuisine","Fine Dining","Street Food","Fast Food","Cafe","Bar & Grill","Others"],k1e=["All Prices","â¦","â¦â¦","â¦â¦â¦","â¦â¦â¦â¦"];function C1e(){const e=l6("eats");c6(e.defaultUtm),bt(),Di();const[t,n]=j.useState(""),[s,a]=j.useState("All States"),[i,o]=j.useState("All Categories"),[l,c]=j.useState("All Prices"),[d,u]=j.useState(!1),[h,f]=j.useState([]),[m,x]=j.useState(!0),[p,v]=j.useState(!1);sc("restaurants",()=>v(!0));const[g,y]=j.useState(null),[b,w]=j.useState(!1),[_,C]=j.useState(!1),[E,N]=j.useState(""),[k,I]=j.useState(""),P=L=>
894{L?(a(L.state||"All States"),N(L.country||""),I(L.city||""),C(!0)):(a("All States"),N(""),I(""),C(!1))};j.useEffect(()=>{O()},[s,i,l,d,E,k]);const O=async()=>{x(!0);let L=H.from("restaurants").select("*").eq("status","active").eq("moderation_status","approved").order("is_boosted",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});E&&(L=L.eq("country_code",E)),s!=="All States"&&(L=L.eq("state",s)),k&&(L=L.ilike("city",`%${k}%`)),i!=="All Categories"&&(L=L.eq("category",i)),l!=="All Prices"&&(L=L.eq("price_range",l)),d&&(L=L.eq("delivery_available",!0));const{data:z,error:U}=await L;U?be({title:"Error loading restaurants",description:U.message,variant:"destructive"}):f(z||[]),x(!1)},A=h.filter(L=>{var U,$;return L.name.toLowerCase().includes(t.toLowerCase())||((U=L.description)==null?void 0:U.toLowerCase().includes(t.toLowerCase()))||(($=L.cuisine_types)==null?void 0:$.some(q=>q.toLowerCase().includes(t.toLowerCase())))}),R=L=>{y(L),w(!0)};return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:e.seoTitle,description:e.seoDescription,structuredData:{"@context":"https://schema.org","@type":"CollectionPage",name:e.name,description:e.seoDescription,url:`https://naija-connect-platform.lovable.app${e.path}`,about:{"@type":e.jsonLdType,name:"Nigerian Restaurants"},isPartOf:{"@type":"Organization",name:e.parent}}}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(o6,{brand:e}),r.jsx(oo,{variant:"restaurants",title:e.name,subtitle:e.tagline,icon:Lo,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:"Search restaurants, cuisines, or locations...",value:t,onChange:L=>n(L.target.value),className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dark:bg-background/95 backdrop-blur-sm"}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs(r.Fragment,{children:[r.jsx($h,{active:_,onToggle:P}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"List Your Restaurant",intentKey:"restaurants",onOpen:()=>v(!0)}),r.jsx(ac,{})]}),r.jsx(Rt,{open:p,onOpenChange:v,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"List Your Restaurant"})}),r.jsx(i6,{onSuccess:()=>{v(!1),O()}})]})})]})}),r.jsx("div",{className:"container max-w-6xl mx-auto px-4 pt-8",children:r.jsx(zo,{placementSlug:"restaurants-top-leaderboard",className:"mx-auto mb-8"})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(mt,{value:s,onValueChange:a,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{})}),r.jsx(ht,{children:_1e.map(L=>r.jsx(Ne,{value:L,children:L},L))})]}),r.jsxs(mt,{value:i,onValueChange:o,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{})}),r.jsx(ht,{children:S1e.map(L=>r.jsx(Ne,{value:L,children:L},L))})]}),r.jsxs(mt,{value:l,onValueChange:c,children:[r.jsx(ut,{className:"w-[150px]",children:r.jsx(pt,{})}),r.jsx(ht,{children:k1e.map(L=>r.jsx(Ne,{value:L,children:L},L))})]}),r.jsx(W,{variant:d?"default":"outline",size:"sm",onClick:()=>u(!d),children:"Delivery Available"}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>{a("All States"),o("All Categories"),c("All Prices"),u(!1),n("")},children:"Clear Filters"})]})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:m?r.jsx("div",{className:"flex justify-center items-center py-16",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):A.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex justify-between items-center mb-6",children:r.jsxs("p",{className:"text-muted-foreground",children:[A.length," restaurant",A.length!==1?"s":""," found"]})}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:A.map((L,z)=>r.jsxs(r.Fragment,{children:[r.jsx(j1e,{restaurant:L,onClick:()=>R(L)},L.id),(z+1)%6===0&&z<A.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${z}`)]}))})]}):r.jsxs("div",{className:"text-center py-16",children:[r.jsx(Lo,{className:"h-24 w-24 mx-auto mb-6 text-muted-foreground opacity-50"}),r.jsx("h2",{className:"text-2xl font-bold mb-4",children:"No restaurants found"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mb-8",children:t||s!=="All States"||i!=="All Categories"?"Try adjusting your search or filters":"Be the first to list a restaurant in this area!"}),r.jsx(Ba,{label:"List Your Restaurant",intentKey:"restaurants",onOpen:()=>v(!0),size:"default",variant:"default"})]})}),r.jsx(w1e,{restaurant:g,open:b,onOpenChange:w})]})]})}const A1e=["Fashion Designers","Tailors","Chefs","Drivers","Mechanics","Event Coordinators","Security","Cleaners","Electricians","Plumbers","Gatemen","Carpenters","Painters","Welders","Hair Stylists","Barbers","Photographers","Videographers","Others"],P1e=["Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"],Ui={BUSINESS_NAME:100,DESCRIPTION:1e3,SKILLS:500,CONTACT_PHONE:20,CONTACT_EMAIL:100,CONTACT_WHATSAPP:20,CITY:50,STATE:50};function m_({onSuccess:e}){const{user:t}=bt(),[n,s]=j.useState(!1),[a,i]=j.useState(!0),[o,l]=j.useState(null),[c,d]=j.useState(!1),[u,h]=j.useState([]),[f,m]=j.useState([]),[x,p]=j.useState({service_category:"",business_name:"",description:"",skills:"",experience_years:"",hourly_rate:"",daily_rate:"",contact_phone:"",contact_email:"",contact_whatsapp:"",city:"",state:"",available_for_travel:!1}),[v,g]=j.useState({business_name:0,description:0,skills:0,contact_phone:0,contact_email:0,contact_whatsapp:0,city:0});j.useEffect(()=>{y()},[t]),j.useEffect(()=>{g({business_name:x.business_name.length,description:x.description.length,skills:x.skills.length,contact_phone:x.contact_phone.length,contact_email:x.contact_email.length,contact_whatsapp:x.contact_whatsapp.length,city:x.city.length})},[x]);const y=async()=>
894{if(t)try{const{data:E,error:N}=await H.rpc("check_artisan_limits",{user_id:t.id});if(N){console.error("Error checking limits:",N),l({can_create_listing:!0,max_listings:3,current_listings:0,max_photos:3,current_plan:"Free"}),i(!1);return}l(E);const k=E;k!=null&&k.can_create_listing||be({title:"Listing limit reached",description:`You've reached your ${(k==null?void 0:k.current_plan)||"free"} plan limit. Upgrade to create more listings!`,variant:"destructive"})}catch(E){console.error("Error checking limits:",E),l({can_create_listing:!0,max_listings:3,current_listings:0,max_photos:3,current_plan:"Free"})}finally{i(!1)}},b=E=>{const N=Array.from(E.target.files||[]);if(!o)return;const k=u.length,I=o.max_photos||3,P=I-k;if(N.length>P){be({title:"Photo limit exceeded",description:`You can only upload ${P} more photo(s) on your ${o.current_plan} plan. Current limit: ${I} photos.`,variant:"destructive"});return}const O=N.filter(R=>R.size>5*1024*1024?(be({title:"File too large",description:`${R.name} exceeds 5MB limit`,variant:"destructive"}),!1):["image/jpeg","image/png","image/webp"].includes(R.type)?!0:(be({title:"Invalid file type",description:`${R.name} must be JPEG, PNG, or WebP`,variant:"destructive"}),!1));if(O.length===0)return;const A=[];O.forEach(R=>{const L=new FileReader;L.onloadend=()=>{A.push(L.result),A.length===O.length&&m([...f,...A])},L.readAsDataURL(R)}),h([...u,...O])},w=E=>{h(u.filter((N,k)=>k!==E)),m(f.filter((N,k)=>k!==E))},_=async E=>{if(u.length===0)return[];const N=[];for(const k of u){const I=k.name.split(".").pop(),P=`${t.id}/${E}/${Math.random()}.${I}`,{data:O,error:A}=await H.storage.from("artisan-photos").upload(P,k,{cacheControl:"3600",upsert:!1});if(A)throw console.error("Photo upload error:",A),A;const{data:{publicUrl:R}}=H.storage.from("artisan-photos").getPublicUrl(P);N.push(R)}return N},C=async E=>{if(E.preventDefault(),!t){be({title:"Authentication required",description:"Please sign in to create an artisan listing",variant:"destructive"});return}if(!(o!=null&&o.can_create_listing)){be({title:"Listing limit reached",description:"Please upgrade your subscription to create more listings",variant:"destructive"});return}if(!x.service_category||!x.business_name||!x.city||!x.state){be({title:"Missing required fields",description:"Please fill in all required fields",variant:"destructive"});return}if(!x.contact_phone&&!x.contact_email&&!x.contact_whatsapp){be({title:"Contact information required",description:"Please provide at least one contact method",variant:"destructive"});return}s(!0);try{const N={user_id:t.id,service_category:x.service_category,business_name:x.business_name.trim(),description:x.description.trim()||null,skills:x.skills?x.skills.split(",").map(O=>O.trim()).filter(Boolean):null,experience_years:x.experience_years?parseInt(x.experience_years):null,hourly_rate:x.hourly_rate?parseFloat(x.hourly_rate):null,daily_rate:x.daily_rate?parseFloat(x.daily_rate):null,contact_phone:x.contact_phone.trim()||null,contact_email:x.contact_email.trim()||null,contact_whatsapp:x.contact_whatsapp.trim()||null,city:x.city.trim(),state:x.state,country_code:"NG",available_for_travel:x.available_for_travel,status:"draft",moderation_status:"pending",portfolio_images:[]},{data:k,error:I}=await H.from("artisans").insert([N]).select().single();if(I)throw I;let P=[];if(u.length>0){d(!0),P=await _(k.id);const{error:O}=await H.from("artisans").update({portfolio_images:P}).eq("id",k.id);if(O)throw O}be({title:"Success!",description:"Your artisan profile has been submitted for review"}),p({service_category:"",business_name:"",description:"",skills:"",experience_years:"",hourly_rate:"",daily_rate:"",contact_phone:"",contact_email:"",contact_whatsapp:"",city:"",state:"",available_for_travel:!1}),h([]),m([]),e&&e()}catch(N){console.error("Error creating artisan:",N),be({title:"Error",description:N.message||"Failed to create artisan listing",variant:"destructive"})}finally{s(!1),d(!1)}};return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}
894):o&&!o.can_create_listing?r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsxs(Sr,{children:["You've reached your ",o.current_plan," plan limit of ",o.max_listings," listing(s).",r.jsx("br",{}),r.jsx("strong",{children:"Upgrade to Pro"})," for 10 listings or ",r.jsx("strong",{children:"Enterprise"})," for unlimited listings."]})]}):r.jsxs("form",{onSubmit:C,className:"space-y-6",children:[o&&r.jsxs(_r,{children:[r.jsx(mr,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsxs("strong",{children:[o.current_plan.toUpperCase()," Plan:"]})," ",o.current_listings," of ",o.max_listings," listings used | ",o.max_photos," photos per listing"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"service_category",children:["Service Category ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs(mt,{value:x.service_category,onValueChange:E=>p({...x,service_category:E}),required:!0,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select your service category"})}),r.jsx(ht,{children:A1e.map(E=>r.jsx(Ne,{value:E,children:E},E))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"business_name",children:["Business Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ge,{id:"business_name",value:x.business_name,onChange:E=>{const N=E.target.value.slice(0,Ui.BUSINESS_NAME);p({...x,business_name:N})},placeholder:"E.g., Elite Fashion Designs",required:!0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.business_name,"/",Ui.BUSINESS_NAME," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Description"}),r.jsx(ir,{id:"description",value:x.description,onChange:E=>{const N=E.target.value.slice(0,Ui.DESCRIPTION);p({...x,description:N})},placeholder:"Describe your services, specialties, and what makes you unique...",rows:4}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.description,"/",Ui.DESCRIPTION," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"skills",children:"Skills (comma-separated)"}),r.jsx(ge,{id:"skills",value:x.skills,onChange:E=>{const N=E.target.value.slice(0,Ui.SKILLS);p({...x,skills:N})},placeholder:"E.g., Wedding dresses, Ankara designs, Alterations"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.skills,"/",Ui.SKILLS," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"experience_years",children:"Years of Experience"}),r.jsx(ge,{id:"experience_years",type:"number",min:"0",max:"70",value:x.experience_years,onChange:E=>p({...x,experience_years:E.target.value}),placeholder:"E.g., 5"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"hourly_rate",children:"Hourly Rate (â¦)"}),r.jsx(ge,{id:"hourly_rate",type:"number",min:"0",step:"0.01",value:x.hourly_rate,onChange:E=>p({...x,hourly_rate:E.target.value}),placeholder:"E.g., 5000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"daily_rate",children:"Daily Rate (â¦)"}),r.jsx(ge,{id:"daily_rate",type:"number",min:"0",step:"0.01",value:x.daily_rate,onChange:E=>p({...x,daily_rate:E.target.value}),placeholder:"E.g., 30000"})]})]}),r.jsxs("div",{className:"space-y-4 p-4 border rounded-lg bg-accent/5",children:[r.jsx("h3",{className:"font-semibold",children:"Contact Information"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Provide at least one contact method"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_phone",children:"Phone Number"}),r.jsx(ge,{id:"contact_phone",type:"tel",value:x.contact_phone,onChange:E=>{const N=E.target.value.slice(0,Ui.CONTACT_PHONE);p({...x,contact_phone:N})},placeholder:"E.g., 08012345678"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.contact_phone,"/",Ui.CONTACT_PHONE," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_email",children:"Email Address"}),r.jsx(ge,{id:"contact_email",type:"email",value:x.contact_email,onChange:E=>{const N=E.target.value.slice(0,Ui.CONTACT_EMAIL);p({...x,contact_email:N})},placeholder:"E.g., [email protected]"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.contact_email,"/",Ui.CONTACT_EMAIL," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_whatsapp",children:"WhatsApp Number"}),r.jsx(ge,{id:"contact_whatsapp",type:"tel",value:x.contact_whatsapp,onChange:E=>{const N=E.target.value.slice(0,Ui.CONTACT_WHATSAPP);p({...x,contact_whatsapp:N})},placeholder:"E.g., 2348012345678"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Include country code (234 for Nigeria) | ",v.contact_whatsapp,"/",Ui.CONTACT_WHATSAPP," characters"]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"city",children:["City ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ge,{id:"city",value:x.city,onChange:E=>{const N=E.target.value.slice(0,Ui.CITY);p({...x,city:N})},placeholder:"E.g., Lagos",required:!0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.city,"/",Ui.CITY," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"state",children:["State ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs(mt,{value:x.state,onValueChange:E=>p({...x,state:E}),required:!0,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select state"})}),r.jsx(ht,{children:P1e.map(E=>
894r.jsx(Ne,{value:E,children:E},E))})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Uo,{id:"available_for_travel",checked:x.available_for_travel,onCheckedChange:E=>p({...x,available_for_travel:E})}),r.jsx(le,{htmlFor:"available_for_travel",className:"cursor-pointer",children:"Available to travel for jobs"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(le,{children:"Portfolio Photos (Optional)"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.length,"/",(o==null?void 0:o.max_photos)||3," photos"]})]}),f.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:f.map((E,N)=>r.jsx(Y,{className:"relative group",children:r.jsxs(X,{className:"p-2",children:[r.jsx("img",{src:E,alt:`Preview ${N+1}`,className:"w-full h-32 object-cover rounded"}),r.jsx(W,{type:"button",variant:"destructive",size:"sm",className:"absolute top-3 right-3 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>w(N),children:r.jsx(ks,{className:"h-4 w-4"})})]})},N))}),u.length<((o==null?void 0:o.max_photos)||3)&&r.jsxs("div",{children:[r.jsx(ge,{type:"file",accept:"image/jpeg,image/png,image/webp",multiple:!0,onChange:b,className:"hidden",id:"photo-upload"}),r.jsxs(le,{htmlFor:"photo-upload",className:"flex items-center justify-center gap-2 p-6 border-2 border-dashed rounded-lg cursor-pointer hover:bg-accent/5 transition-colors",children:[r.jsx(Jn,{className:"h-5 w-5"}),r.jsx("span",{children:"Upload Portfolio Photos"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Max 5MB per photo. Formats: JPEG, PNG, WebP"})]})]}),r.jsx(W,{type:"submit",disabled:n||c,className:"w-full",children:n?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),c?"Uploading photos...":"Creating listing..."]}):"Submit for Review"}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Your listing will be reviewed by our team before going live"})]})}function Tj({tableName:e,listingId:t,listingName:n,ownerColumn:s,variant:a="card"}){const{user:i}=bt(),o=zn(),[l,c]=j.useState(!1),[d,u]=j.useState(!1),[h,f]=j.useState({businessEmail:"",businessPhone:"",message:""}),m=()=>{if(!i){o("/auth");return}c(!0)},x=async v=>{if(v.preventDefault(),!!i){u(!0);try{const g={is_claimed:!0,claimed_by:i.id,claimed_at:new Date().toISOString(),[s]:i.id},{error:y}=await H.from(e).update(g).eq("id",t).eq("is_claimed",!1);if(y)throw y;be({title:"Claim submitted!",description:`Your claim for "${n}" has been submitted. You can now manage this listing from your dashboard.`}),c(!1)}catch(g){be({title:"Error",description:g.message||"Failed to submit claim",variant:"destructive"})}finally{u(!1)}}},p=r.jsx(Rt,{open:l,onOpenChange:c,children:r.jsxs(Ot,{children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{children:['Claim "',n,'"']}),r.jsx(on,{children:"Verify that you own or manage this business to take control of the listing."})]}),r.jsxs("form",{onSubmit:x,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"businessEmail",children:"Business Email"}),r.jsx(ge,{id:"businessEmail",type:"email",required:!0,value:h.businessEmail,onChange:v=>f({...h,businessEmail:v.target.value}),placeholder:"[email protected]"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"businessPhone",children:"Business Phone"}),r.jsx(ge,{id:"businessPhone",type:"tel",required:!0,value:h.businessPhone,onChange:v=>f({...h,businessPhone:v.target.value}),placeholder:"+234..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"message",children:"Additional Info (optional)"}),r.jsx(ir,{id:"message",value:h.message,onChange:v=>f({...h,message:v.target.value}),placeholder:"Tell us how you're connected to this business..."})]}),r.jsx(W,{type:"submit",className:"w-full",disabled:d,children:d?"Submitting...":"Submit Claim"})]})]})});return a==="card"?r.jsxs(r.Fragment,{children:[r.jsxs(W,{variant:"outline",size:"sm",className:"text-xs gap-1",onClick:v=>{v.stopPropagation(),m()},children:[r.jsx(Qc,{className:"h-3 w-3"}),"Claim"]}),p]}):r.jsxs(r.Fragment,{children:[r.jsxs(W,{className:"w-full gap-2",variant:"default",onClick:m,children:[r.jsx(sj,{className:"h-4 w-4"}),"Own this business? Claim it"]}),p]})}function E1e({artisan:e,onClick:t}){var s,a;const n=e.source==="platform_seeded"&&!e.is_claimed;return r.jsx(Y,{className:"hover:shadow-lg transition-all cursor-pointer group",onClick:t,children:r.jsxs(X,{className:"p-0",children:[r.jsxs("div",{className:"relative h-48 bg-gradient-to-br from-primary/10 to-accent/10 overflow-hidden",children:[(s=e.portfolio_images)!=null&&s[0]?r.jsx("img",{src:vl(e.portfolio_images[0]),alt:e.business_name,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(fr,{className:"h-16 w-16 text-muted-foreground"})}),r.jsxs("div",{className:"absolute top-2 right-2 flex flex-col gap-1",children:[e.is_verified&&r.jsxs(te,{className:"gap-1 bg-green-600",children:[r.jsx(er,{className:"h-3 w-3"}),"Verified"]}),n&&r.jsx(te,{variant:"outline",className:"bg-white/90 text-gray-900 backdrop-blur text-xs",children:"Unclaimed"}),r.jsx(jx,{isBoosted:e.is_boosted,boostExpiresAt:e.boost_expires_at,variant:"compact"})]})]}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-1",children:e.business_name}),r.jsx(te,{variant:"outline",className:"mt-1",children:e.service_category})]}),e.bio&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:e.bio}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[(a=e.specialties)==null?void 0:a.slice(0,3).map(i=>r.jsx(te,{variant:"secondary",className:"text-xs",children:i},i)),e.specialties&&e.specialties.length>3&&r.jsxs(te,{variant:"secondary",className:"text-xs",children:["+",e.specialties.length-3]})]}),r.jsx("div",{className:"pt-2 border-t",children:r.jsx(mv,{city:e.city,state:e.state,countryCode:e.country_code,variant:"outline"})}),r.jsxs("div",{className:"flex items-center justify-between",children:[e.years_experience&&r.jsxs("div",{className:"text-sm",children:[r.jsxs("span",{className:"font-semibold",children:[e.years_experience,"+"]})," years exp."]}),e.total_reviews>0?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(mr,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{className:"font-semibold",children:e.average_rating.toFixed(1)}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",e.total_reviews,")"]})]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No reviews yet"})]}),e.hourly_rate&&r.jsxs("div",{className:"pt-2 border-t",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"From "}),r.jsxs("span",{className:"font-semibold text-lg",children:["â¦",e.hourly_rate.toLocaleStr
894ing()]}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"/hr"})]}),n&&r.jsxs("div",{className:"pt-2 border-t flex items-center gap-2",children:[r.jsx(Tj,{tableName:"artisans",listingId:e.id,listingName:e.business_name,ownerColumn:"user_id",variant:"card"}),e.website_url&&r.jsxs("a",{href:e.website_url,target:"_blank",rel:"noopener noreferrer",onClick:i=>i.stopPropagation(),className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[r.jsx(hn,{className:"h-3 w-3"}),"Website"]})]})]})]})})}function T1e({open:e,onOpenChange:t,artisan:n}){var a,i;if(!n)return null;const s=n.source==="platform_seeded"&&!n.is_claimed;return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs(Dt,{className:"flex items-center gap-2",children:[n.business_name,n.is_verified&&r.jsxs(te,{className:"gap-1 bg-green-600",children:[r.jsx(er,{className:"h-3 w-3"}),"Verified"]}),s&&r.jsx(te,{variant:"outline",className:"text-xs",children:"Unclaimed"})]})}),r.jsxs(Kr,{defaultValue:"overview",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-3",children:[r.jsx(Re,{value:"overview",children:"Overview"}),r.jsx(Re,{value:"portfolio",children:"Portfolio"}),r.jsx(Re,{value:"reviews",children:"Reviews"})]}),r.jsxs(Be,{value:"overview",className:"space-y-6",children:[((a=n.portfolio_images)==null?void 0:a[0])&&r.jsx("div",{className:"relative h-64 rounded-lg overflow-hidden",children:r.jsx("img",{src:n.portfolio_images[0],alt:n.business_name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(fr,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:n.service_category})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:n.address||`${n.city}, ${n.state}`})]}),n.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(an,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:n.phone})]}),n.email&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Dn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:n.contact_email})]}),n.website_url&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(hn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:n.website_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Visit Website"})]})]}),r.jsxs("div",{className:"space-y-2",children:[n.years_experience&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx($r,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[n.years_experience,"+ years experience"]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Vd,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[n.total_jobs," completed jobs"]})]}),n.total_reviews>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(mr,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{className:"font-semibold",children:n.average_rating.toFixed(1)}),r.jsxs("span",{className:"text-muted-foreground",children:["(",n.total_reviews," reviews)"]})]}),n.hourly_rate&&r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Rate: "}),r.jsxs("span",{className:"font-semibold text-lg",children:["â¦",n.hourly_rate.toLocaleString()]}),r.jsx("span",{className:"text-muted-foreground",children:"/hr"})]})]})]}),n.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Service Description"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]}),n.bio&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"About"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.bio})]}),n.specialties&&n.specialties.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.specialties.map(o=>r.jsx(te,{variant:"secondary",children:o},o))})]}),s&&r.jsx(Tj,{tableName:"artisans",listingId:n.id,listingName:n.business_name,ownerColumn:"user_id",variant:"detail"}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(W,{className:"flex-1",asChild:!0,children:r.jsxs("a",{href:`tel:${n.contact_phone}`,children:[r.jsx(an,{className:"mr-2 h-4 w-4"}),"Call Now"]})}),r.jsx(W,{variant:"outline",className:"flex-1",asChild:!0,children:r.jsxs("a",{href:`https://wa.me/${(i=n.contact_whatsapp)==null?void 0:i.replace(/[^0-9]/g,"")}`,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(dl,{className:"mr-2 h-4 w-4"}),"WhatsApp"]})}),r.jsxs(W,{variant:"outline",className:"flex-1",children:[r.jsx(Xt,{className:"mr-2 h-4 w-4"}),"Request Booking"]})]})]}),r.jsx(Be,{value:"portfolio",className:"space-y-4",children:n.portfolio_images&&n.portfolio_images.length>0?r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:n.portfolio_images.map((o,l)=>r.jsx("div",{className:"relative aspect-square rounded-lg overflow-hidden",children:r.jsx("img",{src:o,alt:`Portfolio ${l+1}`,className:"w-full h-full object-cover hover:scale-105 transition-transform"})},l))}):r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No portfolio images available yet"})}),r.jsx(Be,{value:"reviews",className:"space-y-4",children:r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Reviews feature coming soon"})})]})]})})}const O1e=["All Categories","Fashion Designers","Tailors","Chefs","Drivers","Mechanics","Event Coordinators","Security","Cleaners","Electricians","Plumbers","Gatemen","Carpenters","Others"],L1e=["All States","Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"];function I1e(){bt(),Di();const[e,t]=j.useState(""),[n,s]=j.useState("All Categories"),[a,i]=j.useState("All States"),[o,l]=j.useState([]),[c,d]=j.useState(!0),[u,h]=j.useState(null),[f,m]=j.useState(!1);sc("artisans",()=>m(!0));const[x,p]=j.useState(!1),[v,g]=j.useState(""),[y,b]=j.useState(""),w=E=>{E?(i(E.state||"All States"),g(E.country||""),b(E.city||""),p(!0)):(i("All States"),g(""),b(""),p(!1))};j.useEffect(()=>{_()},[]);const _=async()=>{try{const{data:E,error:N}=await H.from("artisans").select("*").eq("status","active").eq("moderation_status","approved").order("is_boosted",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(N)throw N;l(E||[])}catch{be({title:"Error",description:"Failed to load artisans",variant:"destructive"})}finally{d(!1)}},C=o.filter(E=>{var A,R;const N=E.business_name.toLowerCase().includes(e.toLowerCase())||((A=E.description)==null?void 0:A.toLowerCase().includes(e.toLowerCase()))||E.city.toLowerCase().includes(e.toLowerCase()),k=n==="All Categories"||E.service_category===n,I=a==="All States"||E.state===a,P=!v||E.country_code===v,O=!y||((R=E.city)==null?void 0:R.toLowerCase().includes(y.toLowerCase()));return N&&k&&I&&P&&O});return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Nigerian Artisans & Service Providers Directory",description:"Connect with verified Nigerian artisans and service providers. Find tailors, chefs, mechanics, electricians, and more skilled professionals across Nigeria."}),r.jsx(oo,{variant:"artisans",title:"Nigerian Artisans & Service Providers",subtitle:"Connect with skilled professionals for all your service needs",icon:Pi,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:"Search for artisans, services, or skills...",value:e,onCh
894ange:E=>t(E.target.value),className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dark:bg-background/95 backdrop-blur-sm"}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs(r.Fragment,{children:[r.jsx($h,{active:x,onToggle:w}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"Register Your Service",intentKey:"artisans",onOpen:()=>m(!0)}),r.jsx(ac,{})]}),r.jsx(Rt,{open:f,onOpenChange:m,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Register Your Professional Services"})}),r.jsx(m_,{onSuccess:()=>{m(!1),_()}})]})})]})}),r.jsx("div",{className:"container max-w-6xl mx-auto px-4 pt-8",children:r.jsx(zo,{placementSlug:"artisans-top-leaderboard",className:"mx-auto mb-8"})}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:[r.jsx("div",{className:"flex flex-col md:flex-row gap-4 items-center justify-between mb-6",children:r.jsxs("div",{className:"flex gap-4 w-full md:w-auto",children:[r.jsxs(mt,{value:n,onValueChange:s,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"Category"})}),r.jsx(ht,{children:O1e.map(E=>r.jsx(Ne,{value:E,children:E},E))})]}),r.jsxs(mt,{value:a,onValueChange:i,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"State"})}),r.jsx(ht,{children:L1e.map(E=>r.jsx(Ne,{value:E,children:E},E))})]})]})}),r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:c?"Loading...":`${C.length} service providers found`})}),c?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):C.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:C.map((E,N)=>r.jsxs(r.Fragment,{children:[r.jsx(E1e,{artisan:E,onClick:()=>h(E)},E.id),(N+1)%6===0&&N<C.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${N}`)]}))}):r.jsxs("div",{className:"text-center py-20",children:[r.jsx(Pi,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No artisans foun
894d"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:e||n!=="All Categories"||a!=="All States"?"Try adjusting your filters":"Be the first to register your services!"}),r.jsx(Ba,{label:"Register Your Service",intentKey:"artisans",onOpen:()=>m(!0),size:"default",variant:"default"})]})]}),r.jsx(T1e,{open:!!u,onOpenChange:E=>!E&&h(null),artisan:u})]})}const R1e=["Tour Operators","Travel Agencies","Local Airlines","Ground Transportation","Others"],M1e=["Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"];function D1e({onSuccess:e}){const{user:t}=bt(),[n,s]=j.useState(!1),[a,i]=j.useState(!1),[o,l]=j.useState("free"),[c,d]=j.useState(1),[u,h]=j.useState([]),[f,m]=j.useState({business_name:"",description:"",service_type:"",city:"",state:"",address:"",contact_phone:"",contact_email:"",contact_whatsapp:"",website_url:"",services_offered:"",destinations_served:""});j.useEffect(()=>{(async()=>{if(t)try{const{data:y,error:b}=await H.from("vendor_subscriptions").select("plan").eq("user_id",t.id).eq("status","active").maybeSingle();if(b)throw b;const _=(y==null?void 0:y.plan)||"free";l(_==="Enterprise"?"enterprise":_),_==="free"?d(1):_==="pro"||_==="Enterprise"?d(5):_==="enterprise"&&d(10)}catch(y){console.error("Error fetching subscription:",y)}})()},[t]);const x=async g=>{if(!g.target.files||g.target.files.length===0)return;if(u.length>=c){be({title:"Photo Limit Reached",description:`Your ${o} plan allows up to ${c} photo(s). Upgrade to add more.`,variant:"destructive"});return}const y=g.target.files[0],b=y.name.split(".").pop(),_=`travel-services/${`${t==null?void 0:t.id}-${Date.now()}.${b}`}`;try{i(!0);const{error:C}=await H.storage.from("business-images").upload(_,y);if(C)throw C;const{data:{publicUrl:E}}=H.storage.from("business-images").getPublicUrl(_);h([...u,E]),be({title:"Success",description:"Photo uploaded successfully"})}catch(C){be({title:"Upload Failed",description:C.message,variant:"destructive"})}finally{i(!1)}},p=g=>{h(u.filter((y,b)=>b!==g))},v=async g=>{if(g.preventDefault(),!!t){if(!f.business_name||!f.service_type||!f.city||!f.state){be({title:"Required Fields Missing",description:"Please fill in all required fields",variant:"destructive"});return}if(f.business_name.length>200){be({title:"Validation Error",description:"Business name must be 200 characters or less",variant:"destructive"});return}if(f.description&&f.description.length>2e3){be({title:"Validation Error",description:"Description must be 2000 characters or less",variant:"destructive"});return}try{s(!0);const y={user_id:t.id,business_name:f.business_name.trim(),description:f.description.trim()||null,service_type:f.service_type,service_category:f.service_type,city:f.city.trim(),state:f.state,country_code:"NG",address:f.address.trim()||null,contact_phone:f.contact_phone.trim()||null,contact_email:f.contact_email.trim()||null,contact_whatsapp:f.contact_whatsapp.trim()||null,website_url:f.website_url.trim()||null,photos:u.length>0?u:null,services_offered:f.services_offered?f.services_offered.split(",").map(w=>w.trim()).filter(Boolean):null,destinations_served:f.destinations_served?f.destinations_served.split(",").map(w=>w.trim()).filter(Boolean):null,subscription_tier:o,status:"active",moderation_status:"pending"},{error:b}=await H.from("travel_services").insert([y]);if(b)throw b;be({title:"Success!",description:"Your travel service has been submitted for review"}),e()}catch(y){be({title:"Submission Failed",description:y.message,variant:"destructive"})}finally{s(!1)}}};return r.jsxs("form",{onSubmit:v,className:"space-y-6",children:[r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsxs(Sr,{children:["Your ",r.jsx("span",{className:"font-semibold capitalize",children:o})," plan allows up to"," ",r.jsxs("span",{className:"font-semibold",children:[c," photo(s)"]}),".",o==="enterprise"&&' You also get the "Verified by Naija.com" badge!']})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"md:col-span-2",children:[r.jsxs(le,{htmlFor:"business_name",children:["Business N
894ame ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(ge,{id:"business_name",value:f.business_name,onChange:g=>m({...f,business_name:g.target.value}),placeholder:"e.g., Lagos Travel Tours",maxLength:200,required:!0}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[f.business_name.length,"/200 characters"]})]}),r.jsxs("div",{children:[r.jsxs(le,{htmlFor:"service_type",children:["Service Type ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsxs(mt,{value:f.service_type,onValueChange:g=>m({...f,service_type:g}),required:!0,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select service type"})}),r.jsx(ht,{children:R1e.map(g=>r.jsx(Ne,{value:g,children:g},g))})]})]}),r.jsxs("div",{children:[r.jsxs(le,{htmlFor:"state",children:["State ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsxs(mt,{value:f.state,onValueChange:g=>m({...f,state:g}),required:!0,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select state"})}),r.jsx(ht,{children:M1e.map(g=>r.jsx(Ne,{value:g,children:g},g))})]})]}),r.jsxs("div",{children:[r.jsxs(le,{htmlFor:"city",children:["City ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(ge,{id:"city",value:f.city,onChange:g=>m({...f,city:g.target.value}),placeholder:"e.g., Ikeja",maxLength:100,required:!0})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"address",children:"Office Address"}),r.jsx(ge,{id:"address",value:f.address,onChange:g=>m({...f,address:g.target.value}),placeholder:"Street address",maxLength:300})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsx(le,{htmlFor:"description",children:"Description"}),r.jsx(ir,{id:"description",value:f.description,onChange:g=>m({...f,description:g.target.value}),placeholder:"Tell clients about your travel services...",maxLength:2e3,rows:4}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[f.description.length,"/2000 characters"]})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsx(le,{htmlFor:"services_offered",children:"Services Offered"}),r.jsx(ge,{id:"services_offered",value:f.services_offered,onChange:g=>m({...f,services_offered:g.target.value}),placeholder:"e.g., Hotel Booking, Flight Tickets, Tour Packages (comma-separated)"})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsx(le,{htmlFor:"destinations_served",children:"Destinations Served"}),r.jsx(ge,{id:"destinations_served",value:f.destinations_served,onChange:g=>m({...f,destinations_served:g.target.value}),placeholder:"e.g., Lagos, Abuja, Port Harcourt (comma-separated)"})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"contact_phone",children:"Contact Phone"}),r.jsx(ge,{id:"contact_phone",type:"tel",value:f.contact_phone,onChange:g=>m({...f,contact_phone:g.target.value}),placeholder:"+234 XXX XXX XXXX",maxLength:20})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"contact_email",children:"Contact Email"}),r.jsx(ge,{id:"contact_email",type:"email",value:f.contact_email,onChange:g=>m({...f,contact_email:g.target.value}),placeholder:"[email protected]",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"contact_whatsapp",children:"WhatsApp Number"}),r.jsx(ge,{id:"contact_whatsapp",type:"tel",value:f.contact_whatsapp,onChange:g=>m({...f,contact_whatsapp:g.target.value}),placeholder:"+234 XXX XXX XXXX",maxLength:20})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"website_url",children:"Website URL"}),r.jsx(ge,{id:"website_url",type:"url",value:f.website_url,onChange:g=>m({...f,website_url:g.target.value}),placeholder:"https://example.com",maxLength:200})]}),r.jsxs("div",{className:"md:col-span-2",children:[r.jsxs(le,{children:["Business Photos (",u.length,"/",c,")"]}),r.jsxs("div",{className:"mt-2 space-y-4",children:[u.length<c&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ge,{type:"file",accept:"image/*",onChange:x,disabled:a,className:"flex-1"}),a&&r.jsx(yt,{className:"h-5 w-5 animate-spin"})]}),u.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:u.map((g,y)=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:g,alt:`Upload ${y+1}`,className:"w-full h-32 object-cover rounded-lg"}),r.jsx("button",{type:"button",onClick:()=>p(y),className:"absolute top-2 right-2 bg-destructive text-destructive-foreground rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(ks,{className:"h-4 w-4"})})]},y))})]})]})]}),r.jsx("div",{className:"flex justify-end gap-4",children:r.jsxs(W,{type:"submit",disabled:n,size:"lg",children:[n&&r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Submit for Review"]})})]})}function $1e({service:e,onClick:t}){const n=e.source==="platform_seeded"&&!e.is_claimed;return r.jsx(Y,{className:"hover:shadow-lg transition-all cursor-pointer group",onClick:t,children:r.jsxs(X,{className:"p-0",children:[r.jsxs("div",{className:"relative h-48 bg-gradient-to-br from-primary/10 to-accent/10 overflow-hidden",children:[e.photos&&e.photos.length>0?r.jsx("img",{src:vl(e.photos[0]),alt:e.business_name,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(At,{className:"h-16 w-16 text-muted-foreground"})}),r.jsxs("div",{className:"absolute top-2 right-2 flex flex-col gap-1",children:[e.is_featured&&r.jsxs(te,{className:"gap-1 bg-yellow-600",children:[r.jsx(lr,{className:"h-3 w-3"}),"Featured"]}),n&&r.jsx(te,{variant:"outline",className:"bg-white/90 text-gray-900 backdrop-blur text-xs",children:"Unclaimed"})]}),e.is_verified&&r.jsxs(te,{className:"absolute top-2 left-2 gap-1 bg-green-600",children:[r.jsx(er,{className:"h-3 w-3"}),"Verified by Naija.com"]})]}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-1",children:e.business_name}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:e.description})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.jsx(te,{variant:"secondary",className:"text-xs",children:e.service_type}),e.subscription_tier==="enterprise"&&e.is_verified&&r.jsx(te,{variant:"outline",className:"text-xs border-green-600 text-green-600",children:"Verified"})]}),e.services_offered&&e.services_offered.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.services_offered.slice(0,2).map((s,a)=>r.jsx(te,{variant:"outline",className:"text-xs",children:s},a)),e.services_offered.length>2&&r.jsxs(te,{variant:"outline",className:"text-xs",children:["+",e.services_offered.length-2," more"]})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsx(mv,{state:e.state,countryCode:e.country_code,variant:"outline"})}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.contact_phone&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(an,{className:"h-3 w-3"}),r.jsx("span",{className:"text-xs",children:"Phone"})]}),e.contact_email&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Dn,{className:"h-3 w-3"}),r.jsx("span",{className:"text-xs",children:"Email"})]})]}),e.total_reviews>0?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(mr,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{className:"font-semibold",children:e.average_rating.toFixed(1)}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",e.total_reviews,")"]})]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No reviews"})]}),n&&r.jsxs("div",{className:"pt-2 border-t flex items-center gap-2",children:[r.jsx(Tj,{tableName:"travel_services",listingId:e.id,listingName:e.business_name,ownerColumn:"user_id",variant:"card"}),e.website_url&&r.jsxs("a",{href:e.website_url,target:"_blank",rel:"noopener noreferrer",onClick:s=>s.stopPropagation(),className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[r.jsx(hn,{className:"h-3 w-3"}),"Website"]})]})]})]})})}function F1e({open:e,onOpenChange:t,service:n}){if(!n)return null;const s=n.source==="platform_seeded"&&!n.is_claimed,a=i=>{i==="phone"&&n.contact_phone?window.location.href=`tel:${n.contact_phone}`:i==="email"&&n.contact_email?window.location.href=`mailto:${n.contact_email}`:i==="whatsapp"&&n.contact_whatsapp&&window.open(`https://wa.me/${n.contact_whatsapp.replace(/\D/g,"")}`,"_blank")};return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs(Dt,{className:"flex items-center gap-2 flex-wrap",children:[n.business_name,n.is_verified&&r.jsxs(te,{className:"gap-1 bg-green-600",children:[r.jsx(er,{className:"h-3 w-3"}),"Verified by Naija.com"]}),n.is_featured&&r.jsxs(te,{className:"gap-1 bg-yellow-600",children:[r.jsx(lr,{className:"h-3 w-3"}),"Featured"]})]})}),r.jsxs(Kr,{defaultValue:"overview",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-3",children:[r.jsx(Re,{value:"overview",children:"Overview"}),r.jsx(Re,{value:"gallery",children:"Gallery"}),r.jsx(Re,{value:"reviews",children:"Reviews"})]}),r.jsxs(Be,{value:"overview",className:"space-y-6",children:[n.photos&&n.photos.length>
8940&&r.jsx("div",{className:"relative h-64 rounded-lg overflow-hidden",children:r.jsx("img",{src:n.photos[0],alt:n.business_name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold",children:n.service_type}),r.jsx("div",{className:"text-muted-foreground text-xs",children:"Service Type"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold",children:n.state}),r.jsx("div",{className:"text-muted-foreground text-xs",children:"Location"})]})]}),n.total_reviews>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(mr,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsxs("div",{children:[r.jsxs("div",{className:"font-semibold",children:[n.average_rating.toFixed(1),"/5"]}),r.jsxs("div",{className:"text-muted-foreground text-xs",children:[n.total_reviews," reviews"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(er,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold",children:n.total_bookings}),r.jsx("div",{className:"text-muted-foreground text-xs",children:"Bookings"})]})]})]}),n.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"About This Service"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:n.description})]}),n.services_offered&&n.services_offered.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Services Offered"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.services_offered.map((i,o)=>r.jsxs(te,{variant:"secondary",className:"gap-1",children:[r.jsx(er,{className:"h-3 w-3"}),i]},o))})]}),n.destinations_served&&n.destinations_served.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Destinations Served"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.destinations_served.map((i,o)=>r.jsxs(te,{variant:"outline",className:"gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),i]},o))})]}),n.operating_hours&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Operating Hours"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 text-sm",children:Object.entries(n.operating_hours).map(([i,o])=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($r,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"font-medium capitalize",children:[i,":"]}),r.jsx("span",{className:"text-muted-foreground",children:o.closed?"Closed":`${o.open} - ${o.close}`})]},i))})]}),n.address&&r.jsxs("div",{className:"flex items-center gap-2 text-sm pt-4 border-t",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-muted-foreground",children:"Address: "}),r.jsxs("span",{className:"font-semibold",children:[n.address,", ",n.city,", ",n.state]})]}),n.website_url&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(hn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:n.website_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Visit Website"})]}),s&&r.jsx(Tj,{tableName:"travel_services",listingId:n.id,listingName:n.business_name,ownerColumn:"user_id",variant:"detail"}),r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx("h3",{className:"font-semibold mb-3",children:"Contact Information"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[n.contact_phone&&r.jsxs(W,{className:"flex-1",onClick:()=>a("phone"),children:[r.jsx(an,{className:"mr-2 h-4 w-4"}),"Call Now"]}),n.contact_whatsapp&&r.jsxs(W,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:()=>a("whatsapp"),children:[r.jsx(Oh,{className:"mr-2 h-4 w-4"}),"WhatsApp"]}),n.contact_email&&r.jsxs(W,{variant:"outline",className:"flex-1",onClick:()=>a("email"),children:[r.jsx(Dn,{className:"mr-2 h-4 w-4"}),"Email"]})]})]}),r.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg text-xs text-muted-foreground border",children:[r.jsx("p",{className:"font-semibold mb-1",children:"Disclaimer:"}),r.jsx("p",{children:"These resources are provided for informational purposes only. Naija.com is not affiliated with or endorsed by any of the listed services. Always verify information directly with the service provider."})]})]}),r.jsx(Be,{value:"gallery",className:"space-y-4",children:n.photos&&n.photos.length>0?r.jsxs(Jh,{className:"w-full",children:[r.jsx(Qh,{children:n.photos.map((i,o)=>r.jsx(ef,{children:r.jsx("div",{className:"relative aspect-video rounded-lg overflow-hidden",children:r.jsx("img",{src:i,alt:`${n.business_name} ${o+1}`,className:"w-full h-full object-cover"})})},o))}),r.jsx(Jm,{}),r.jsx(Qm,{})]}):r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No photos available"})}),r.jsx(Be,{value:"reviews",className:"space-y-4",children:r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Reviews feature coming soon"})})]})]})})}function B1e({attraction:e,onClick:t}){return r.jsx(Y,{className:"hover:shadow-lg transition-all cursor-pointer group",onClick:t,children:r.jsxs(X,{className:"p-0",children:[r.jsxs("div",{className:"relative h-56 bg-gradient-to-br from-primary/10 to-accent/10 overflow-hidden",children:[e.images&&e.images.length>0?r.jsx("img",{src:vl(e.images[0]),alt:e.name,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(G2,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(te,{className:"absolute top-2 right-2",variant:"secondary",children:e.category})]}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-1",children:e.name}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:e.description})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[e.city,", ",e.state]})]}),e.entrance_fee!==null&&e.entrance_fee!==void 0&&r.jsxs("div",{className:"flex items-center gap-1 text-sm font-semibold",children:[r.jsx(Tn,{className:"h-4 w-4"}),e.entrance_fee===0?r.jsx("span",{className:"text-green-600",children:"Free"}):r.jsxs("span",{children:[e.entrance_fee_currency==="USD"?"$":"â¦",e.entrance_fee.toLocaleStr
894ing()]})]})]})]})]})})}function U1e({open:e,onOpenChange:t,attraction:n}){if(!n)return null;const s=a=>{a==="phone"&&n.contact_phone?window.location.href=`tel:${n.contact_phone}`:a==="email"&&n.contact_email?window.location.href=`mailto:${n.contact_email}`:a==="website"&&n.website&&window.open(n.website,"_blank")};return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs(Dt,{className:"flex items-center gap-2 flex-wrap",children:[n.name,r.jsx(te,{variant:"secondary",children:n.category})]})}),r.jsxs("div",{className:"space-y-6",children:[n.images&&n.images.length>0&&r.jsxs(Jh,{className:"w-full",children:[r.jsx(Qh,{children:n.images.map((a,i)=>r.jsx(ef,{children:r.jsx("div",{className:"relative aspect-video rounded-lg overflow-hidden",children:r.jsx("img",{src:a,alt:`${n.name} ${i+1}`,className:"w-full h-full object-cover"})})},i))}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(Jm,{}),r.jsx(Qm,{})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold",children:n.state}),r.jsx("div",{className:"text-muted-foreground text-xs",children:"Location"})]})]}),n.entrance_fee!==null&&n.entrance_fee!==void 0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Tn,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold",children:n.entrance_fee===0?r.jsx("span",{className:"text-green-600",children:"Free Entry"}):r.jsxs(r.Fragment,{children:[n.entrance_fee_currency==="USD"?"$":"â¦",n.entrance_fee.toLocaleString()]})}),r.jsx("div",{className:"text-muted-foreground text-xs",children:"Entrance Fee"})]})]}),n.best_time_to_visit&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx($r,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold",children:n.best_time_to_visit}),r.jsx("div",{className:"text-muted-foreground text-xs",children:"Best Time"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(G2,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-semibold",children:n.category}),r.jsx("div",{className:"text-muted-foreground text-xs",children:"Category"})]})]})]}),n.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"About"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:n.description})]}),n.facilities&&n.facilities.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Facilities & Amenities"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.facilities.map((a,i)=>r.jsx(te,{variant:"outline",children:a},i))})]}),n.opening_hours&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Opening Hours"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 text-sm",children:Object.entries(n.opening_hours).map(([a,i])=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($r,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"font-medium capitalize",children:[a,":"]}),r.jsx("span",{className:"text-muted-foreground",children:i.closed?"Closed":`${i.open} - ${i.close}`})]},a))})]}),n.location&&r.jsxs("div",{className:"flex items-start gap-2 text-sm pt-4 border-t",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:"Location: "}),r.jsx("span",{className:"text-muted-foreground",children:n.location})]})]}),(n.contact_phone||n.contact_email||n.website)&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx("h3",{className:"font-semibold mb-3",children:"Contact Information"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[n.contact_phone&&r.jsxs(W,{className:"flex-1",onClick:()=>s("phone"),children:[r.jsx(an,{className:"mr-2 h-4 w-4"}),"Call"]}),n.contact_email&&r.jsxs(W,{variant:"outline",className:"flex-1",onClick:()=>s("email"),children:[r.jsx(Dn,{className:"mr-2 h-4 w-4"}),"Email"]}),n.website&&r.jsxs(W,{variant:"outline",className:"flex-1",onClick:()=>s("website"),children:[r.jsx(hn,{className:"mr-2 h-4 w-4"}),"Website"]})]})]}),r.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg text-xs text-muted-foreground border",children:[r.jsx("p",{className:"font-semibold mb-1",children:"Disclaimer:"}),r.jsx("p",{children:"Information provided is for reference only. Naija.com is not affiliated with this attraction. Please verify opening hours, fees, and other details directly before visiting."})]})]})]})})}const z1e=["All Types","Tour Operators","Travel Agencies","Local Airlines","Ground Transportation","Others"],q1e=["All Categories","Natural Wonders","Historical Sites","Cultural Centers","Wildlife & Nature","Beach & Coastal"],n8=["All States","Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"],V1e=[{name:"Natural Wonders",icon:Gie},{name:"Historical Sites",icon:H2},{name:"Cultural Centers",icon:Yr},{name:"Wildlife & Nature",icon:G2}];function W1e(){const e=l6("explore");c6(e.defaultUtm),bt(),Di();const[t,n]=j.useState(""),[s,a]=j.useState("All Types"),[i,o]=j.useState("All Categories"),[l,c]=j.useState("All States"),[d,u]=j.useState([]),[h,f]=j.useState([]),[m,x]=j.useState(!0),[p,v]=j.useState(null),[g,y]=j.useState(null),[b,w]=j.useState(!1);sc("tourism",()=>w(!0));const[_,C]=j.useState(!1),[E,N]=j.useState(""),[k,I]=j.useState(""),P=L=>
894{L?(c(L.state||"All States"),N(L.country||""),I(L.city||""),C(!0)):(c("All States"),N(""),I(""),C(!1))};j.useEffect(()=>{O()},[]);const O=async()=>{try{x(!0);const[L,z]=await Promise.all([H.from("travel_services").select("*").eq("status","active").eq("moderation_status","approved").order("created_at",{ascending:!1}),H.from("attractions").select("*").eq("status","active").order("created_at",{ascending:!1})]);if(L.error)throw L.error;if(z.error)throw z.error;u(L.data||[]),f(z.data||[])}catch{be({title:"Error",description:"Failed to load tourism data",variant:"destructive"})}finally{x(!1)}},A=d.filter(L=>{var se,F;const z=L.business_name.toLowerCase().includes(t.toLowerCase())||((se=L.description)==null?void 0:se.toLowerCase().includes(t.toLowerCase()))||L.city.toLowerCase().includes(t.toLowerCase()),U=s==="All Types"||L.service_type===s,$=l==="All States"||L.state===l,q=!E||L.country_code===E,ne=!k||((F=L.city)==null?void 0:F.toLowerCase().includes(k.toLowerCase()));return z&&U&&$&&q&&ne}),R=h.filter(L=>{var se,F;const z=L.name.toLowerCase().includes(t.toLowerCase())||((se=L.description)==null?void 0:se.toLowerCase().includes(t.toLowerCase()))||L.city.toLowerCase().includes(t.toLowerCase()),U=i==="All Categories"||L.category===i,$=l==="All States"||L.state===l,q=!E||L.country_code===E,ne=!k||((F=L.city)==null?void 0:F.toLowerCase().includes(k.toLowerCase()));return z&&U&&$&&q&&ne});return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:e.seoTitle,description:e.seoDescription,structuredData:{"@context":"https://schema.org","@type":"CollectionPage",name:e.name,description:e.seoDescription,url:`https://naija-connect-platform.lovable.app${e.path}`,about:{"@type":e.jsonLdType,name:"Nigerian Attractions"},isPartOf:{"@type":"Organization",name:e.parent}}}),r.jsx(o6,{brand:e}),r.jsx(oo,{variant:"tourism",title:e.name,subtitle:e.tagline,icon:fm,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:"Search destinations, attractions, or travel services...",value:t,onChange:L=>n(L.target.value),className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dark:bg-background/95 backdrop-blur-sm"}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs(r.Fragment,{children:[r.jsx($h,{active:_,onToggle:P}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"Register Your Service",intentKey:"tourism",onOpen:()=>w(!0)}),r.jsx(ac,{})]}),r.jsx(Rt,{open:b,onOpenChange:w,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Register Your Travel Service"})}),r.jsx(D1e,{onSuccess:()=>{w(!1),O()}})]})})]})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-4",children:r.jsxs(_r,{children:[r.jsx(tc,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Disclaimer:"})," These resources are provided for informational purposes only. Naija.com is not affiliated with or endorsed by any of the listed services. Always verify information directly with the service provider."]})]})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:r.jsxs(Kr,{defaultValue:"attractions",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full max-w-md mx-auto grid-cols-2",children:[r.jsx(Re,{value:"attractions",children:"Attractions"}),r.jsx(Re,{value:"services",children:"Travel Services"})]}),r.jsxs(Be,{value:"services",className:"mt-8",children:[r.jsx("div",{className:"flex flex-col md:flex-row gap-4 items-center justify-between mb-6",children:r.jsxs("div",{className:"flex gap-4 w-full md:w-auto",children:[r.jsxs(mt,{value:s,onValueChange:a,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"Service Type"})}),r.jsx(ht,{children:z1e.map(L=>r.jsx(Ne,{value:L,children:L},L))})]}),r.jsxs(mt,{value:l,onValueChange:c,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"State"})}),r.jsx(ht,{children:n8.map(L=>r.jsx(Ne,{value:L,children:L},L))})]})]})}),r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:m?"Loading...":`${A.length} travel services found`})}),m?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):A.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:A.map(L=>r.jsx($1e,{service:L,onClick:()=>v(L)},L.id))}):r.jsxs("div",{className:"text-center py-20",children:[r.jsx(fm,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No travel services found"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:t||s!=="All Types"||l!=="All States"?"Try adjusting your filters":"Be the first to register your travel service!"}),r.jsx(Ba,{label:"Register Your Service",intentKey:"tourism",onOpen:()=>w(!0),size:"default",variant:"default"})]})]}),r.jsxs(Be,{value:"attractions",className:"mt-8",children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:V1e.map(({name:L,icon:z})=>r.jsx(Y,{className:`hover:shadow-lg transition-shadow cursor-pointer ${i===L?"ring-2 ring-primary":""}`,onClick:()=>o(i===L?"All Categories":L),children:r.jsxs(X,{className:"p-4 md:p-6 flex flex-col items-center text-center",children:[r.jsx(z,{className:"h-8 w-8 md:h-12 md:w-12 mb-2 md:mb-3 text-primary"}),r.jsx("h3",{className:"font-semibold text-sm md:text-base",children:L})]})},L))}),r.jsx("div",{className:"flex flex-col md:flex-row gap-4 items-center justify-between mb-6",children:r.jsxs("div",{className:"flex gap-4 w-full md:w-auto",children:[r.jsxs(mt,{value:i,onValueChange:o,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"Category"})}),r.jsx(ht,{children:q1e.map(L=>r.jsx(Ne,{value:L,children:L},L))})]}),r.jsxs(mt,{value:l,onValueChange:c,children:[r.jsx(ut,{className:"w-full md:w-[200px]",children:r.jsx(pt,{placeholder:"State"})}),r.jsx(ht,{children:n8.map(L=>r.jsx(Ne,{value:L,children:L},L))})]})]})}),r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:m?"Loading...":`${R.length}
894 attractions found`})}),m?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):R.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:R.map(L=>r.jsx(B1e,{attraction:L,onClick:()=>y(L)},L.id))}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(G2,{className:"h-20 w-20 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-bold mb-2",children:t||i!=="All Categories"||l!=="All States"?"No attractions found":"Discover Nigerian Attractions"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:t||i!=="All Categories"||l!=="All States"?"Try adjusting your filters to find attractions":"Browse through Nigeria's beautiful historical sites, natural wonders, and cultural centers"})]})]})]})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 pb-10",children:r.jsx(Ej,{category:"travel",title:"Plan the trip end to end",blurb:"Where to stay, what to do, and how to get around â the partners we use ourselves.",ctaLabel:"Open"})}),r.jsx(F1e,{open:!!p,onOpenChange:L=>!L&&v(null),service:p}),r.jsx(U1e,{open:!!g,onOpenChange:L=>!L&&y(null),attraction:g})]})}function H1e({open:e,onOpenChange:t,classifiedId:n,classifiedTitle:s}){const{user:a}=bt(),[i,o]=j.useState(!1),[l,c]=j.useState(!1),[d,u]=j.useState(null),h=async()=>{if(!a){Et.error("Please log in to request contact info");return}if(!i){Et.error("Please agree to keep contact info private");return}c(!0);try{const{data:{session:m},error:x}=await H.auth.getSession();if(x||!m)throw new Error("Please log in again");console.log("ð Calling reveal-classified-contact...");const{data:p,error:v}=await H.functions.invoke("reveal-classified-contact",{headers:{Authorization:`Bearer ${m.access_token}`},body:{classified_id:n}});if(v)throw console.error("Function error:",v),v;console.log("â
Contact info received:",p),u(p),Et.success("Contact info revealed! ð")}catch(m){console.error("Error revealing contact:",m),Et.error(m.message||"Failed to reveal contact info")}finally{c(!1)}},f=()=>{u(null),o(!1),t(!1)};return r.jsx(Rt,{open:e,onOpenChange:f,children:r.jsxs(Ot,{className:"sm:max-w-md",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Contact Employer"}),r.jsx(on,{children:s})]}),d?r.jsxs("div",{className:"space-y-4",children:[r.jsx(_r,{className:"bg-green-500/10 border-green-500/50",children:r.jsx(Sr,{className:"text-foreground",children:"Contact request logged â here's how to reach the employer:"})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(an,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Phone"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:d.maskedPhone})]})]}),d.maskedEmail&&d.maskedEmail!=="Not provided"&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Dn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Email"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:d.maskedEmail})]})]}),d.whatsappLink&&d.whatsappLink!=="#"&&r.jsxs(W,{className:"w-full gap-2",onClick:()=>window.open(d.whatsappLink,"_blank"),children:[r.jsx(dl,{className:"h-4 w-4"}),"Contact on WhatsApp"]})]}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Remember to keep this information private and use it responsibly."})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(_r,{children:r.jsx(Sr,{children:"To protect privacy, contact information is only shared with serious candidates who agree to our terms."})}),r.jsxs("div",{className:"flex items-start space-x-2",children:[r.jsx(Uo,{id:"consent",checked:i,onCheckedChange:m=>o(m===!0)}),r.jsx(le,{htmlFor:"consent",className:"text-sm font-normal leading-snug cursor-pointer",children:"I agree to keep contact information private and will only use it for this job inquiry. I will not share, resell, or misuse this data."})]}),r.jsxs(W,{onClick:h,disabled:!i||l,className:"w-full",children:[l&&r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Reveal Contact Info"]})]})]})})}function sN({classified:e}){const[t,n]=j.useState(!1),[s,a]=j.useState(!1),i=e.category==="domestic_help"?"Domestic Help":"Professional",o=e.is_featured&&e.featured_until&&new Date(e.featured_until)>new Date;return r.jsxs(r.Fragment,{children:[r.jsxs(Y,{className:`group hover:shadow-lg transition-shadow relative ${o?"border-yellow-500 border-2 bg-yellow-50/50 dark:bg-yellow-900/10":""}`,children:[o&&r.jsx("div",{className:"absolute -top-3 -right-3 z-10",children:r.jsxs(te,{className:"bg-yellow-600 hover:bg-yellow-700 flex items-center gap-1 px-3 py-1 shadow-lg",children:[r.jsx(mr,{className:"h-3 w-3 fill-white"}),"Featured"]})}),r.jsxs(Se,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Ae,{className:"text-xl",children:e.title}),r.jsx(te,{variant:e.category==="domestic_help"?"default":"secondary",children:i})]}),r.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[r.jsx(te,{variant:"outline",children:e.subcategory}),e.inquiry_count&&e.inquiry_count>0&&r.jsxs(te,{variant:"outline",className:"bg-primary/10",children:[e.inquiry_count," inquiries"]})]})]}),r.jsxs(X,{className:"space-y-3",children:[r.jsx(mv,{city:e.location_city,state:e.location_state,countryCode:e.country_code,variant:"outline"}),e.experience_years&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(fr,{className:"h-4 w-4"}),r.jsxs("span",{children:[e.experience_years," years experience required"]})]}),e.availability&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx($r,{className:"h-4 w-4"}),r.jsx("span",{children:e.availability})]}),e.salary_range&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Tn,{className:"h-4 w-4"}),r.jsx("span",{children:e.salary_range})]}),e.skills&&e.skills.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:e.skills.map((l,c)=>r.jsx(te,{variant:"secondary",className:"text-xs",children:l},c))}),r.jsxs("div",{className:"pt-2",children:[r.jsx("p",{className:`text-sm ${!s&&"line-clamp-3"}`,children:e.description}),e.description.length>150&&r.jsx(W,{variant:"link",size:"sm",className:"p-0 h-auto",onClick:()=>a(!s),children:s?"Show less":"Read more"})]})]}),r.jsx(kj,{children:r.jsx(W,{className:"w-full",onClick:()=>n(!0),children:"Request Contact"})})]}),r.jsx(H1e,{open:t,onOpenChange:n,classifiedId:e.id,classifiedTitle:e.title})]})}const hs={TITLE:50,DESCRIPTION:500,SKILLS:500,AVAILABILITY:200,SALARY_RANGE:100,CITY:100,PHONE:20,EMAIL:54},G1e=["House Help","Gatemen","Drivers","Security","Cleaners","Chefs/Cooks","Others"],Y1e=["Event Organizers","Plumbers","Builders","Electricians","Store Clerks","Office Managers","Lawyers","Doctors","Fashion Designers","Tailors","Mechanics","Others"];function TS(){const{user:e}=bt(),t=zn(),[n,s]=j.useState(!1),[a,i]=j.useState("domestic_help"),{preferences:o,isLoading:l}=Di(),[c,d]=j.useState(null),[u,h]=j.useState(!0),[f,m]=j.useState({title:"",subcategory:"",location_city:"",location_state:"",country_code:"NG",description:"",skills:"",availability:"",salary_range:"",experience_years:"",phone:"",whatsapp:"",email:""});j.useEffect(()=>{!l&&o&&m(v=>({...v,country_code:o.country,location_state:o.state,location_city:o.city}))},[o,l]),j.useEffect(()=>{(async()=>
894{if(!e){h(!1);return}try{const{data:g,error:y}=await H.rpc("check_classified_limits",{user_id:e.id});y?(console.error("Error checking classified limits:",y),d({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})):d(g)}catch(g){console.error("Error:",g),d({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})}finally{h(!1)}})()},[e]),j.useEffect(()=>{m(v=>({...v,location_state:""}))},[f.country_code]);const x=async v=>{if(v.preventDefault(),!e){Et.error("Please log in to post a listing");return}if(c&&!c.can_create_listing){Et.error("You have reached your listing limit. Please upgrade your plan.");return}if(f.title.length>hs.TITLE){Et.error(`Title must be ${hs.TITLE} characters or less`);return}if(f.description.length>hs.DESCRIPTION){Et.error(`Description must be ${hs.DESCRIPTION} characters or less`);return}if(f.skills.length>hs.SKILLS){Et.error(`Skills must be ${hs.SKILLS} characters or less`);return}if(f.availability.length>hs.AVAILABILITY){Et.error(`Availability must be ${hs.AVAILABILITY} characters or less`);return}
894if(f.salary_range.length>hs.SALARY_RANGE){Et.error(`Salary range must be ${hs.SALARY_RANGE} characters or less`);return}s(!0);try{const{data:g,error:y}=await H.from("classifieds").insert({user_id:e.id,title:f.title,category:a,subcategory:f.subcategory,location_city:f.location_city,location_state:f.location_state,country_code:f.country_code,description:f.description,skills:f.skills?f.skills.split(",").map(w=>w.trim()).slice(0,30):[],availability:f.availability,salary_range:f.salary_range,experience_years:f.experience_years?parseInt(f.experience_years):null,status:"draft",moderation_status:"pending"}).select().single();if(y)throw y;const{error:b}=await H.from("classified_contacts").insert({classified_id:g.id,phone:f.phone,whatsapp:f.whatsapp||f.phone,email:f.email||e.email});if(b)throw b;Et.success("Listing submitted for review! ð"),t("/classifieds")}catch(g){console.error("Error creating classified:",g),Et.error(g.message||"Failed to create listing")}finally{s(!1)}},p=a==="domestic_help"?G1e:Y1e;return r.jsxs("div",{className:"max-w-2xl mx-auto",children:[c&&r.jsx("div",{className:"mb-6",children:r.jsx(Pj,{planName:c.current_plan,currentListings:c.current_listings,maxListings:c.max_listings,photosPerListing:c.max_photos_per_listing,canCreate:c.can_create_listing,feature:"classified"})}),r.jsxs("form",{onSubmit:x,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"category",children:"Category *"}),r.jsxs(mt,{value:a,onValueChange:v=>i(v),children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"domestic_help",children:"Domestic Help"}),r.jsx(Ne,{value:"other_professions",children:"Other Professions"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"subcategory",children:"Position *"}),r.jsxs(mt,{value:f.subcategory,onValueChange:v=>m({...f,subcategory:v}),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select position"})}),r.jsx(ht,{children:p.map(v=>r.jsx(Ne,{value:v,children:v},v))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"title",children:"Job Title *"}),r.jsx(ge,{id:"title",value:f.title,onChange:v=>m({...f,title:v.target.value}),placeholder:"e.g., Experienced House Help Needed",maxLength:hs.TITLE,required:!0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.title.length," / ",hs.TITLE," characters"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx(dc,{value:f.country_code,onValueChange:v=>m({...f,country_code:v}),label:"Country",required:!0})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"city",children:"City *"}),r.jsx(ge,{id:"city",value:f.location_city,onChange:v=>m({...f,location_city:v.target.value}),placeholder:"e.g., Lekki",maxLength:hs.CITY,required:!0})]}),r.jsx("div",{children:r.jsx(uc,{countryCode:f.country_code,value:f.location_state,onChange:v=>m({...f,location_state:v}),required:!0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Description *"}),r.jsx(ir,{id:"description",value:f.description,onChange:v=>m({...f,description:v.target.value}),placeholder:"Describe the role, responsibilities, and requirements...",rows:5,maxLength:hs.DESCRIPTION,required:!0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.description.length," / ",hs.DESCRIPTION," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"skills",children:"Skills (comma-separated)"}),r.jsx(ge,{id:"skills",value:f.skills,onChange:v=>m({...f,skills:v.target.value}),placeholder:"e.g., Cooking, Cleaning, Childcare",maxLength:hs.SKILLS}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.skills.length," / ",hs.SKILLS," characters (max 30 skills)"]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"availability",children:"Availability"}),r.jsx(ge,{id:"availability",value:f.availability,onChange:v=>m({...f,availability:v.target.value}),placeholder:"e.g., Live-in, Monday-Friday",maxLength:hs.AVAILABILITY}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.availability.length," / ",hs.AVAILABILITY," characters"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"salary",children:"Salary Range"}),r.jsx(ge,{id:"salary",value:f.salary_range,onChange:v=>m({...f,salary_range:v.target.value}),placeholder:"e.g., â¦30,000 - â¦50,000/month",maxLength:hs.SALARY_RANGE}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[f.s
894alary_range.length," / ",hs.SALARY_RANGE," characters"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"experience",children:"Years of Experience Required"}),r.jsx(ge,{id:"experience",type:"number",value:f.experience_years,onChange:v=>m({...f,experience_years:v.target.value}),placeholder:"e.g., 2",min:"0",max:"50"})]}),r.jsxs("div",{className:"border-t pt-6",children:[r.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Contact Information"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Your contact info is protected. It will only be revealed to serious inquirers who consent to privacy terms."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"phone",children:"Phone Number * (Nigerian format)"}),r.jsx(ge,{id:"phone",type:"tel",value:f.phone,onChange:v=>m({...f,phone:v.target.value}),placeholder:"e.g., 08012345678 or 2348012345678",pattern:"^(234|0)[789][01]\\d{8}$",maxLength:hs.PHONE,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"whatsapp",children:"WhatsApp Number (optional, defaults to phone)"}),r.jsx(ge,{id:"whatsapp",type:"tel",value:f.whatsapp,onChange:v=>m({...f,whatsapp:v.target.value}),placeholder:"e.g., 08012345678",maxLength:hs.PHONE})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"email",children:"Email (optional, defaults to account email)"}),r.jsx(ge,{id:"email",type:"email",value:f.email,onChange:v=>m({...f,email:v.target.value}),placeholder:"[email protected]",maxLength:hs.EMAIL})]})]})]}),r.jsxs(W,{type:"submit",disabled:n,className:"w-full",children:[n&&r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Submit Listing for Review"]})]})]})}function K1e(){bt(),zn(),Di();const[e,t]=j.useState(""),[n,s]=j.useState("all"),[a,i]=j.useState(!0),[o,l]=j.useState([]),[c,d]=j.useState(!1),[u,h]=j.useState(0);sc("classifieds",()=>d(!0));const[f,m]=j.useState({country:"",state:"",city:""}),[x,p]=j.useState(!1),v=y=>{y?(m({country:y.country,state:y.state,city:y.city}),p(!0)):(m({country:"",state:"",city:""}),p(!1))};j.useEffect(()=>{g()},[n,e,f]);const g=async()=>{i(!0);try{let y=H.from("classifieds").select(` 895 *, 896 inquiry_count:classified_inquiries(count) 897 `).eq("status","active").eq("moderation_status","approved");n==="domestic"?y=y.eq("category","domestic_help"):n==="other"&&(y=y.eq("category","other_professions")),f.country&&(y=y.eq("country_code",f.country)),f.state&&(y=y.ilike("location_state",f.state)),f.city&&(y=y.ilike("location_city",`%${f.city}%`)),e&&(y=y.or(`title.ilike.%${e}%,description.ilike.%${e}%,location_city.ilike.%${e}%`));const{data:b,error:w}=await y;if(w)throw w;const _=(b==null?void 0:b.map(k=>{var I,P;return{...k,inquiry_count:((P=(I=k.inquiry_count)==null?void 0:I[0])==null?void 0:P.count)||0}}))||[],C=new Date().toISOString(),E=_.sort((k,I)=>{const P=k.is_featured&&k.featured_until&&k.featured_until>C?1:0,O=I.is_featured&&I.featured_until&&I.featured_until>C?1:0;return P!==O?O-P:new Date(I.created_at).getTime()-new Date(k.created_at).getTime()});l(E);const N=E.filter(k=>k.is_featured&&k.featured_until&&k.featured_until>C).length;h(N)}catch(y){console.error("Error fetching classifieds:",y)}finally{i(!1)}};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Classifieds - Find Help Wanted | Domestic Help & Professionals",description:"Find trusted domestic help, drivers, gatemen, security, chefs, and other professionals in Nigeria. Post job listings and connect with skilled workers."}),r.jsx(oo,{variant:"classifieds",title:"Classifieds - Help Wanted",subtitle:"Find trusted domestic help and skilled professionals across Nigeria",icon:fr,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:"Search for jobs, skills, or location...",value:e,onChange:y=>t(y.target.value),className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dar
897k:bg-background/95 backdrop-blur-sm"}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs(r.Fragment,{children:[r.jsx($h,{active:x,onToggle:v}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"Post Your Job",intentKey:"classifieds",onOpen:()=>d(!0)}),r.jsx(ac,{})]})]})}),u>0&&r.jsx("section",{className:"container max-w-6xl mx-auto px-4 pt-6",children:r.jsxs(_r,{className:"bg-yellow-500/10 border-yellow-500/50",children:[r.jsx(mr,{className:"h-4 w-4 text-yellow-500"}),r.jsxs(Sr,{children:[r.jsxs("strong",{children:[u," Featured Listing",u>1?"s":""]})," - Premium listings get priority placement and more visibility!"]})]})}),r.jsx("div",{className:"container max-w-6xl mx-auto px-4 pt-8",children:r.jsx(zo,{placementSlug:"classifieds-top-leaderboard",className:"mx-auto mb-8"})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:r.jsxs(Kr,{value:n,onValueChange:y=>s(y),className:"w-full",children:[r.jsx("div",{className:"flex flex-col md:flex-row gap-4 items-center justify-between mb-8",children:r.jsxs(Hr,{className:"w-full md:w-auto",children:[r.jsxs(Re,{value:"all",className:"gap-2",children:[r.jsx(fr,{className:"h-4 w-4"}),"All Jobs"]}),r.jsxs(Re,{value:"domestic",className:"gap-2",children:[r.jsx(en,{className:"h-4 w-4"}),"Domestic Help"]}),r.jsxs(Re,{value:"other",className:"gap-2",children:[r.jsx(Pi,{className:"h-4 w-4"}),"Other Professions"]})]})}),r.jsxs(Y,{className:"p-4",children:[r.jsxs("h3",{className:"text-sm font-semibold mb-3 flex items-center gap-2",children:[r.jsx(nj,{className:"h-4 w-4"}),"Advanced Location Filters"]}),r.jsx(XO,{values:f,onChange:m,compact:!0})]}),r.jsx(Be,{value:"all",className:"mt-0",children:a?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):o.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:o.map((y,b)=>r.jsxs(r.Fragment,{children:[r.jsx(sN,{classified:y},y.id),(b+1)%6===0&&b<o.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${b}`)]}))}):r.jsxs("div",{className:"text-center py-20",children:[r.jsx(Pi,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No openings yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Be the first to post!"}),r.jsx(Ba,{label:"Post Your Job",intentKey:"classifieds",onOpen:()=>d(!0),size:"default",variant:"default"})]})}),r.jsx(Be,{value:"domestic",className:"mt-0",children:a?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):o.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:o.map((y,b)=>r.jsxs(r.Fragment,{children:[r.jsx(sN,{classified:y},y.id),(b+1)%6===0&&b<o.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${b}`)]}))}):r.jsxs("div",{className:"text-center py-20",children:[r.jsx(en,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No domestic help listings yet"}),r.jsx("p",{className:"text-muted-foreground",children:"Post your opening to find qualified candidates"})]})}),r.jsx(Be,{value:"other",className:"mt-0",children:a?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):o.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:o.map((y,b)=>r.jsxs(r.Fragment,{children:[r.jsx(sN,{classified:y},y.id),(b+1)%6===0&&b<o.length-1&&r.jsx("div",{className:"md:col-span-2 lg:col-span-3",children:r.jsx(Hc,{variant:"inline"})},`ad-${b}`)]}))}):r.jsxs("div",{className:"text-center py-20",children:[r.jsx(fr,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No professional listings yet"}),r.jsx("p",{className:"text-muted-foreground",children:"Post your opening to find skilled professionals"})]})})]})}),r.jsx(Rt,{open:c,onOpenChange:d,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Post a New Job Listing"})}),r.jsx(TS,{})]})})]})}const d6=[{slug:"houston",name:"Houston",region:"Texas",countryCode:"US",countryName:"United States",lat:29.7604,lng:-95.3698,radiusKm:40,population:"150,000+"},{slug:"atlanta",name:"Atlanta",region:"Georgia",countryCode:"US",countryName:"United States",lat:33.749,lng:-84.388,radiusKm:40,population:"100,000+"},{slug:"dallas",name:"Dallas",region:"Texas",countryCode:"US",countryName:"United States",lat:32.7767,lng:-96.797,radiusKm:40,population:"80,000+"}
897,{slug:"new-york",name:"New York",region:"New York",countryCode:"US",countryName:"United States",lat:40.7128,lng:-74.006,radiusKm:50,population:"100,000+"},{slug:"washington-dc",name:"Washington DC",region:"DMV",countryCode:"US",countryName:"United States",lat:38.9072,lng:-77.0369,radiusKm:50,population:"120,000+"},{slug:"chicago",name:"Chicago",region:"Illinois",countryCode:"US",countryName:"United States",lat:41.8781,lng:-87.6298,radiusKm:40,population:"50,000+"},{slug:"london",name:"London",region:"England",countryCode:"GB",countryName:"United Kingdom",lat:51.5074,lng:-.1278,radiusKm:40,population:"300,000+"},{slug:"manchester",name:"Manchester",region:"England",countryCode:"GB",countryName:"United Kingdom",lat:53.4808,lng:-2.2426,radiusKm:30,population:"40,000+"},{slug:"birmingham",name:"Birmingham",region:"England",countryCode:"GB",countryName:"United Kingdom",lat:52.4862,lng:-1.8904,radiusKm:30,population:"30,000+"},{slug:"dublin",name:"Dublin",region:"Leinster",countryCode:"IE",countryName:"Ireland",lat:53.3498,lng:-6.2603,radiusKm:30,population:"20,000+"},{slug:"toronto",name:"Toronto",region:"Ontario",countryCode:"CA",countryName:"Canada",lat:43.6532,lng:-79.3832,radiusKm:45,population:"70,000+"},{slug:"calgary",name:"Calgary",region:"Alberta",countryCode:"CA",countryName:"Canada",lat:51.0447,lng:-114.0719,radiusKm:35,population:"25,000+"},{slug:"montreal",name:"Montreal",region:"Quebec",countryCode:"CA",countryName:"Canada",lat:45.5017,lng:-73.5673,radiusKm:35,population:"20,000+"},{slug:"sydney",name:"Sydney",region:"NSW",countryCode:"AU",countryName:"Australia",lat:-33.8688,lng:151.2093,radiusKm:45,population:"15,000+"},{slug:"melbourne",name:"Melbourne",region:"Victoria",countryCode:"AU",countryName:"Australia",lat:-37.8136,lng:144.9631,radiusKm:45,population:"15,000+"},{slug:"berlin",name:"Berlin",region:"Berlin",countryCode:"DE",countryName:"Germany",lat:52.52,lng:13.405,radiusKm:35,population:"20,000+"},{slug:"paris",name:"Paris",region:"Ãle-de-France",countryCode:"FR",countryName:"France",lat:48.8566,lng:2.3522,radiusKm:35,population:"15,000+"},{slug:"amsterdam",name:"Amsterdam",region:"North Holland",countryCode:"NL",countryName:"Netherlands",lat:52.3676,lng:4.9041,radiusKm:30,population:"12,000+"},{slug:"johannesburg",name:"Johannesburg",region:"Gauteng",countryCode:"ZA",countryName:"South Africa",lat:-26.2041,lng:28.0473,radiusKm:40,population:"25,000+"},{slug:"dubai",name:"Dubai",region:"UAE",countryCode:"AE",countryName:"United Arab Emirates",lat:25.2048,lng:55.2708,radiusKm:40,population:"20,000+"}],_X={restaurants:{slug:"restaurants",label:"Nigerian Restaurants",singular:"restaurant",intro:e=>`Discover authentic Nigerian and West African restaurants in ${e}. From jollof rice and egusi to suya joints and pepper soup spots, find Naija food near you with addresses, hours and reviews.`},events:{slug:"events",label:"Nigerian Events",singular:"event",intro:e=>`Upcoming Nigerian and African community events in ${e} â Afrobeats nights, owambe parties, cultural festivals, business meetups and church gatherings.`},lodging:{slug:"lodging",label:"Lodging & Short Stays",singular:"stay",intro:e=>`Short-term rentals and lodging options trusted by the Nigerian community in ${e}. Great for diaspora visitors, family trips home and business stays.`},artisans:{slug:"artisans",label:"Nigerian Services & Artisans",singular:"service",intro:e=>`Find Nigerian service providers in ${e} â hair stylists, tailors, photographers, event planners, mechanics and more. Support diaspora-owned businesses.`},groceries:{slug:"groceries",label:"African & Nigerian Grocery Stores",singular:"grocery store",intro:e=>`African and Nigerian grocery stores in ${e} stocking yam, garri, palm oil, dried fish, plantain, suya spice and more. Shop the foods of home.`},churches:{slug:"churches",label:"Nigerian Churches & Faith Communities",singular:"church",intro:e=>`Nigerian-led churches and faith communities in ${e}. Sunday services, midweek fellowships and praise nights for the diaspora community.`}},X1e=e=>d6.find(t=>t.slug===e),Z1e=e=>e?_X[e]:void 0;function J1e(){const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState(""),[c,d]=j.useState("all"),[u,h]=j.useState("all"),[f,m]=j.useState("country"),[x,p]=j.useState(null),[v,g]=j.useState(!1),[y,b]=j.useState([]);j.useEffect(()=>{w()},[]),j.useEffect(()=>{C()},[o,c,u,f,e,x]);const w=async()=>{try{i(!0);const{data:k,error:I}=await H.from("embassies").select("*").eq("is_active",!0).order("country",{ascending:!0});if(I)throw I;const P=k;t(P);const O=Array.from(new Set(P.map(A=>A.country))).sort();b(O)}catch(k){console.error("Error fetching embassies:",k),Et.error("Failed to load embassies")}finally{i(!1)}},_=()=>{if(!navigator.geolocation){Et.error("Geolocation is not supported by your browser");return}g(!0),navigator.geolocation.getCurrentPosition(k=>{p({lat:k.coords.latitude,lng:k.coords.longitude}),m("distance"),Et.success("Location detected"),g(!1)},k=>{console.error("Error getting location:",k),Et.error("Could not get your location"),g(!1)})},C=()=>{let k=[...e];if(x&&(k=k.map(I=>({...I,distance:zu(x.lat,x.lng,I.latitude,I.longitude)}))),o.trim()){const I=o.toLowerCase();k=k.filter(P=>P.name.toLowerCase().includes(I)||P.city.toLowerCase().includes(I)||P.country.toLowerCase().includes(I)||P.services&&P.services.some(O=>O.toLowerCase().includes(I)))}c!=="all"&&(k=k.filter(I=>I.type===c)),u!=="all"&&(k=k.filter(I=>
897I.country===u)),k.sort((I,P)=>{switch(f){case"name":return I.name.localeCompare(P.name);case"country":return I.country.localeCompare(P.country);case"distance":return I.distance!==void 0&&P.distance!==void 0?I.distance-P.distance:0;default:return 0}}),s(k)},E=k=>{switch(k){case"embassy":return"Embassy";case"consulate":return"Consulate";case"high_commission":return"High Commission";default:return k}},N=k=>{switch(k){case"embassy":return"bg-green-100 text-green-800";case"consulate":return"bg-blue-100 text-blue-800";case"high_commission":return"bg-purple-100 text-purple-800";default:return"bg-gray-100 text-gray-800"}};return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-green-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-gradient-to-r from-green-600 to-green-700 rounded-lg p-6 text-white",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Nigerian Embassies & Consulates"}),r.jsx("p",{className:"text-green-100",children:"Find Nigerian diplomatic missions worldwide for passport services, visa assistance, and citizen support"})]}),r.jsxs("div",{className:"bg-white rounded-lg shadow-sm border p-4 space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-5 w-5"}),r.jsx("input",{type:"text",placeholder:"Search by location, country, or service...",value:o,onChange:k=>l(k.target.value),className:"w-full pl-10 pr-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[r.jsx(nj,{className:"inline h-4 w-4 mr-1"}),"Type"]}),r.jsxs("select",{value:c,onChange:k=>d(k.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Types"}),r.jsx("option",{value:"embassy",children:"Embassies"}),r.jsx("option",{value:"consulate",children:"Consulates"}),r.jsx("option",{value:"high_commission",children:"High Commissions"})]})]}),r.jsxs("div",{children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[r.jsx(At,{className:"inline h-4 w-4 mr-1"}),"Country"]}),r.jsxs("select",{value:u,onChange:k=>h(k.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",children:[r.jsx("option",{value:"all",children:"All Countries"}),y.map(k=>r.jsx("option",{value:k,children:k},k))]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Sort By"}),r.jsxs("select",{value:f,onChange:k=>m(k.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-transparent",children:[r.jsx("option",{value:"country",children:"Country"}),r.jsx("option",{value:"name",children:"Name"}),r.jsxs("option",{value:"distance",disabled:!x,children:["Distance ",!x&&"(Enable location)"]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Location"}),r.jsxs("button",{onClick:_,disabled:v,className:`w-full px-4 py-2 rounded-lg font-medium transition-colors ${x?"bg-green-100 text-green-700 hover:bg-green-200":"bg-gray-100 text-gray-700 hover:bg-gray-200"} disabled:opacity-50`,children:[r.jsx(_m,{className:"inline h-4 w-4 mr-2"}),v?"Getting...":x?"Located":"Use My Location"]})]})]})]}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600",children:[r.jsxs("span",{children:["Showing ",n.length," of ",e.length," embassies"]}),x&&f==="distance"&&r.jsx("span",{className:"text-green-600 font-medium",children:"Sorted by distance from you"})]}),n.length===0?r.jsxs("div",{className:"bg-white rounded-lg shadow-sm border p-12 text-center",children:[r.jsx(At,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No embassies found"}),r.jsx("p",{className:"text-gray-600",children:"Try adjusting your search criteria"})]}):r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:n.map(k=>r.jsxs("div",{className:"bg-white rounded-lg shadow-sm border hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"p-6 border-b",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:k.name}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600 mb-2",children:[r.jsx(At,{className:"h-4 w-4"}),r.jsxs("span",{children:[k.city,", ",k.country]})]})]}),r.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${N(k.type)}`,children:E(k.type)})]}),k.distance!==void 0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 font-medium",children:[r.jsx(_m,{className:"h-4 w-4"}),r.jsxs("span",{children:[k.distance.toFixed(1)," km away"]})]})]}),r.jsxs("div",{className:"p-6 space-y-3",children:[k.address&&r.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[r.jsx(At,{className:"h-4 w-4 text-gray-400 mt-0.5 flex-shrink-0"}),r.jsx("span",{className:"text-gray-700",children:k.address})]}),k.phone&&r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsx(an,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),r.jsx("a",{href:`tel:${k.phone}`,className:"text-green-600 hover:text-green-700 font-medium",children:k.phone})]}),k.emergency_phone&&r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsx(vn,{className:"h-4 w-4 text-red-500 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"text-gray-600 mr-2",children:"Emergency:"}),r.jsx("a",{href:`tel:${k.emergency_phone}`,className:"text-red-600 hover:text-red-700 font-medium",children:k.emergency_phone})]})]}),k.email&&r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsx(Dn,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),r.jsx("a",{href:`mailto:${k.email}`,className:"text-green-600 hover:text-green-700 break-all",children:k.email})]}),k.website&&r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsx(hn,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}),r.jsx("a",{href:k.website,target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-700 break-all",children:k.website.replace(/^https?:\/\//,"")})]}),k.operating_hours&&r.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[r.jsx($r,{className:"h-4 w-4 text-gray-400 mt-0.5 flex-shrink-0"}),r.jsx("span",{className:"text-gray-700",children:k.operating_hours})]})]}),k.services&&k.services.length>0&&r.jsxs("div",{className:"px-6 pb-6",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-2",children:"Services Offered:"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:k.services.map((I,P)=>r.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-xs",children:I},P))})]}),r.jsxs("div",{className:"px-6 pb-6 flex gap-3",children:[r.jsxs("a",{href:`https://www.google.com/maps?q=${k.latitude},${k.longitude}`,target:"_blank",rel:"noopener noreferrer",className:`px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors text-center font-medium text-sm ${k.phone?"flex-1":"w-full"}`,children:[r.jsx(At,{className:"inline h-4 w-4 mr-2"}),"Get Directions"]}),k.phone&&r.jsxs("a",{href:`tel:${k.phone}`,className:"flex-1 px-4 py-2 border border-green-600 text-green-600 rounded-lg hover:bg-green-50 transition-colors text-center font-medium text-sm",children:[r.jsx(an,{className:"inline h-4 w-4 mr-2"}),"Call Now"]})]})]},k.id))}),r.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(vn,{className:"h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium text-blue-900 mb-1",children:"Important Notice"}),r.jsx("p",{className:"text-blue-800",children:"Always verify operating hours and service availability before visiting. Some services may require appointments. Keep emergency contact numbers saved for urgent situations."})]})]})})]})}function Q1e(){const e=[{name:"Government & Legal",icon:fn,color:"blue",resources:[{title:"Nigerian Immigration Service",description:"Passport applications, visa information, and immigration services",url:"https://immigration.gov.ng",icon:Ca,category:"Government & Legal"},{title:"Nigerians in Diaspora Commission (NiDCOM)",description:"Official support and resources for Nigerians abroad",url:"https://nidcom.gov.ng",icon:fn,category:"Government & Legal"},{title:"Nigeria High Commission UK",description:"Consular services for Nigerians in the United Kingdom",url:"https://www.nhcuk.org",icon:hn,category:"Government & Legal"},{title:"Nigerian Embassy USA",description:"Consular services for Nigerians in the United States",url:"https://www.nigeriaembassyusa.org",icon:hn,category:"Government & Legal"},{title:"Corporate Affairs Commission (CAC)",description:"Business registration and incorporation in Nigeria",url:"https://www.cac.gov.ng",icon:fr,category:"Government & Legal"}]},{name:"Financial Services",icon:Tn,color:"green",resources:[{title:"Central Bank of Nigeria",description:"Official monetary policy, exch
897ange rates, and banking regulations",url:"https://www.cbn.gov.ng",icon:Tn,category:"Financial Services"},{title:"Remitly",description:"Fast and affordable money transfers to Nigeria",url:"https://www.remitly.com",icon:Tn,category:"Financial Services"},{title:"WorldRemit",description:"Send money to Nigeria with low fees",url:"https://www.worldremit.com",icon:Tn,category:"Financial Services"},{title:"Western Union",description:"Global money transfer services to Nigeria",url:"https://www.westernunion.com",icon:Tn,category:"Financial Services"},{title:"Flutterwave",description:"Digital payment solutions and diaspora banking",url:"https://flutterwave.com",icon:Tn,category:"Financial Services"}]},{name:"Business & Investment",icon:fr,color:"purple",resources:[{title:"Nigerian Investment Promotion Commission",description:"Investment opportunities and business climate information",url:"https://www.nipc.gov.ng",icon:fr,category:"Business & Investment"},{title:"Lagos Chamber of Commerce",description:"Business networking and trade information",url:"https://www.lagoschamber.com",icon:fr,category:"Business & Investment"},{title:"Export Promotion Council",description:"Support for Nigerian exporters and trade promotion",url:"https://www.nepc.gov.ng",icon:fr,category:"Business & Investment"},{title:"SME Development Agency",description:"Support for small and medium enterprises",url:"https://www.smedan.gov.ng",icon:fr,category:"Business & Investment"},{title:"Nigeria Diaspora Investment Summit",description:"Annual investment opportunities for diaspora",url:"https://nidcom.gov.ng/ndis",icon:fr,category:"Business & Investment"}]},{name:"Education & Culture",icon:Xw,color:"orange",resources:[{title:"National Universities Commission",description:"Accreditation and recognition of Nigerian degrees",url:"https://www.nuc.edu.ng",icon:Xw,category:"Education & Culture"},{title:"Nigerian Educational Research Council",description:"Educational standards and curriculum information",url:"https://www.nercng.org",icon:Xw,category:"Education & Culture"},{title:"National Commission for Museums",description:"Nigerian cultural heritage and history",url:"https://www.ncmm.gov.ng",icon:Xw,category:"Education & Culture"},{title:"Nigerian Language Resources",description:"Learn and preserve Nigerian languages",url:"https://www.ethnologue.com/country/NG",icon:dl,category:"Education & Culture"},{title:"Centre for Black Culture",description:"African diaspora cultural events and programs",url:"https://www.centreforblackculture.org",icon:Yr,category:"Education & Culture"}]},{name:"Community & Support",icon:Yr,color:"pink",resources:[{title:"Nigerians in Diaspora Organisation",description:"Global network of Nigerian diaspora communities",url:"https://nidoeurope.org",icon:Yr,category:"Community & Support"},{title:"Nigerian American Chamber",description:"Business and professional networking in North America",url:"https://www.nigerianamericanchamber.org",icon:fr,category:"Community & Support"},{title:"Nigerian UK Diaspora",description:"Community events and support in the United Kingdom",url:"https://www.nigerianukdiaspora.com",icon:Yr,category:"Community & Support"},{title:"African Diaspora Network",description:"Connecting African professionals worldwide",url:"https://www.africandiasporanetwork.org",icon:hn,category:"Community & Support"},{title:"Nigeria Social Club",description:"Diaspora Meetup and social gatherings",url:"https://www.arrangi.com",icon:Th,category:"Community & Support"}]},{name:"Property & Real Estate",icon:en,color:"indigo",resources:[{title:"Federal Ministry of Housing",description:"Government housing programs and property information",url:"https://www.housing.gov.ng",icon:en,category:"Property & Real Estate"},{title:"Property Pro",description:"Real estate listings and property investment",url:"https://www.propertypro.ng",icon:en,category:"Property & Real Estate"},{title:"Nigeria Property Centre",description:"Property search and real estate services",url:"https://www.nigeriapropertycentre.com",icon:en,category:"Property & Real Estate"},{title:"Lagos State Land Registry",description:"Property documentation and land registration",url:"https://landsbureau.lagosstate.gov.ng",icon:Ca,category:"Property & Real Estate"},{title:"Diaspora Housing Scheme",description:"Affordable housing for Nigerians abroad",url:"https://www.fmhud.gov.ng/diaspora-housing",icon:en,category:"Property & Real Estate"}]}],t=[{title:"NiDCOM Emergency Hotline",number:"+234-809-847-4857",description:"For Nigerians in distress abroad"},{title:"NEMA (National Emergency)",number:"112 or 767",description:"National emergency response in Nigeria"},{title:"Nigerian Police Force",number:"112",description:"Emergency police services"}],n=s=>{const a={blue:{bg:"bg-blue-50",text:"text-blue-600",border:"border-blue-200",iconBg:"bg-blue-100"},green:{bg:"bg-green-50",text:"text-green-600",border:"border-green-200",iconBg:"bg-green-100"},purple:{bg:"bg-purple-50",text:"text-purple-600",border:"border-purple-200",iconBg:"bg-purple-100"},orange:{bg:"bg-orange-50",text:"text-orange-600",border:"border-orange-200",iconBg:"bg-orange-100"},pink:{bg:"bg-pink-50",text:"text-pink-600",border:"border-pink-200",iconBg:"bg-pink-100"},indigo:{bg:"bg-indigo-50",text:"text-indigo-600",border:"border-indigo-200",iconBg:"bg-indigo-100"}};return a[s]||a.blue};return r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"bg-gradient-to-r from-green-600 to-green-700 rounded-lg p-6 text-white",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Diaspora Resources"}),r.jsx("p",{className:"text-green-100",children:"Essential links, services, and support for Nigerians living abroad"})]}),r.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx(an,{className:"h-6 w-6 text-red-600"}),r.jsx("h3",{className:"text-lg font-bold text-red-900",children:"Emergency Contacts"})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:t.map((s,a)=>r.jsxs("div",{className:"bg-white rounded-lg p-4 border border-red-200",children:[r.jsx("p",{className:"font-semibold text-gray-900 mb-1",children:s.title}),r.jsx("a",{href:`tel:${s.number.replace(/\s+/g,"")}`,className:"text-red-600 hover:text-red-700 font-bold text-lg block mb-1",children:s.number}),r.jsx("p",{className:"text-sm text-gray-600",children:s.description})]},a))})]}),e.map(s=>{const a=n(s.color),i=s.icon;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`${a.iconBg} p-3 rounded-lg`,children:r.jsx(i,{className:`h-6 w-6 ${a.text}`})}),r.jsx("h3",{className:"text-xl font-bold text-gray-900",children:s.name})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:s.resources.map((o,l)=>{const c=o.icon;return r.jsxs("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:`${a.bg} border ${a.border} rounded-lg p-5 hover:shadow-md transition-all group`,children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsx("div",{className:`${a.iconBg} p-2 rounded-lg`,children:r.jsx(c,{className:`h-5 w-5 ${a.text}`})}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-semibold text-gray-900 mb-1 group-hover:text-green-600 transition-colors",children:o.title})}),r.jsx(ds,{className:"h-4 w-4 text-gray-400 group-hover:text-green-600 transition-colors flex-shrink-0"})]}),r.jsx("p",{className:"text-sm text-gray-600 line-clamp-2",children:o.description})]},l)})})]},s.name)}),r.jsxs("div",{className:"bg-gradient-to-r from-gray-50 to-gray-100 rounded-lg p-6 border border-gray-200",children:[r.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-4",children:"Need More Help?"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Contact Your Nearest Embassy"}),r.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Find contact information for Nigerian diplomatic missions worldwide in the Embassy Directory section above."}),r.jsx("button",{onClick:()=>{const s=document.getElementById("embassy-directory");s==null||s.scrollIntoView({behavior:"smooth"})},className:"text-green-600 hover:text-green-700 font-medium text-sm",children:"View Embassy Directory â"})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Join the Community"}),r.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Connect with other Nigerians in your area through our Events and Community features. Find cultural events, networking opportunities, and local support groups."}),r.jsx("button",{onClick:()=>{const s=document.getElementById("diaspora-search");s==null||s.scrollIntoView({behavior:"smooth"})},className:"text-green-600 hover:text-green-700 font-medium text-sm",children:"Search Community Resources â"})]})]})]}),r.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:r.jsxs("p",{className:"text-sm text-yellow-800",children:[r.jsx("strong",{children:"Disclaimer:"}
897)," These resources are provided for informational purposes only. Naija.com is not affiliated with or endorsed by any of the listed organizations. Always verify information directly with official sources. Links to external websites are provided for convenience and do not constitute endorsement."]})})]})}const s8=[{value:"all",label:"All Categories",tables:["restaurants","events","properties","artisans","embassies"]},{value:"restaurants",label:"ð½ï¸ Restaurants",tables:["restaurants"]},{value:"events",label:"ð Events",tables:["events"]},{value:"lodging",label:"ð¨ Lodging",tables:["properties"]},{value:"artisans",label:"ð§ Services",tables:["artisans"]},{value:"embassies",label:"ðï¸ Embassies",tables:["embassies"]}],eNe=[{value:"10",label:"10 km"},{value:"25",label:"25 km"},{value:"50",label:"50 km"},{value:"100",label:"100 km"},{value:"500",label:"500 km"}];function tNe({onSearch:e,onSearchStart:t}){const[n,s]=j.useState("all"),[a,i]=j.useState(""),[o,l]=j.useState("25"),[c,d]=j.useState(!1),[u,h]=j.useState(!1),[f,m]=j.useState(null),x=()=>{h(!0),"geolocation"in navigator?navigator.geolocation.getCurrentPosition(v=>{const{latitude:g,longitude:y}=v.coords;m({lat:g,lng:y}),i(`${g.toFixed(4)}, ${y.toFixed(4)}`),h(!1),be({title:"Location found",description:"Using your current location"})},v=>{console.error("Geolocation error:",v),h(!1),be({title:"Location unavailable",description:"Please enter a city or address manually",variant:"destructive"})}):(h(!1),be({title:"Geolocation not supported",description:"Please enter a city or address manually",variant:"destructive"}))},p=async()=>{if(!a){be({title:"Location required",description:"Please enter a location or use your current location",variant:"destructive"});return}d(!0),t();try{let v=f;if(!v&&(v=Iye(a),!v)){be({title:"Location not found",description:"Try entering coordinates (lat, lng) or a major city name",variant:"destructive"}),d(!1);return}const g=s8.find(w=>w.value===n);if(!g)return;const y=[],b=parseInt(o);for(const w of g.tables)try{let _=H.from(w).select("*").eq("status","active");w!=="embassies"&&(_=_.eq("moderation_status","approved"));const{data:C,error:E}=await _;if(E){console.error(`Error querying ${w}:`,E);continue}if(C&&C.length>0){const N=C.map(k=>{if(!k.latitude||!k.longitude||!v)return null;const I=zu(v.lat,v.lng,k.latitude,k.longitude);let P="";return w==="restaurants"?P=k.name:w==="events"?P=k.title:w==="properties"?P=k.name:w==="artisans"?P=k.business_name:w==="embassies"&&(P=k.name),{...k,type:w.slice(0,-1),title:P,distance:I}}).filter(k=>k!==null&&k.distance<=b);y.push(...N)}}catch(_){console.error(`Error processing ${w}:`,_);continue}y.sort((w,_)=>w.distance-_.distance),e(y,n),y.length===0?be({title:"No results found",description:"Try expanding your search radius or changing the category"}):be({title:`Found ${y.length} result${y.length!==1?"s":""}`,description:`Within ${o}km of your location`})}catch(v){console.error("Search error:",v),be({title:"Search failed",description:"Please try again",variant:"destructive"})}finally{d(!1)}};return r.jsxs("div",{className:"w-full max-w-4xl mx-auto space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(mt,{value:n,onValueChange:s,children:[r.jsx(ut,{className:"flex-1 bg-background text-foreground border-border",children:r.jsx(pt,{})}),r.jsx(ht,{children:s8.map(v=>r.jsx(Ne,{value:v.value,children:v.label},v.value))})]}),r.jsxs(mt,{value:o,onValueChange:l,children:[r.jsx(ut,{className:"w-full sm:w-[150px] bg-background text-foreground border-border",children:r.jsx(pt,{})}),r.jsx(ht,{children:eNe.map(v=>r.jsxs(Ne,{value:v.value,children:["Within ",v.label]},v.value))})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(At,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-5 w-5 text-muted-foreground"}),r.jsx(ge,{type:"text",placeholder:"Enter city, address, or coordinates...",value:a,onChange:v=>i(v.target.value),className:"pl-11 bg-background text-foreground border-border",onKeyDown:v=>v.key==="Enter"&&p()})]}),r.jsx(W,{variant:"outline",onClick:x,disabled:u,className:"bg-background text-foreground border-border hover:bg-muted",children:u?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Getting..."]}):r.jsxs(r.Fragment,{children:[r.jsx(toe,{className:"mr-2 h-4 w-4"}),"Use My Location"]})})]}),r.jsx(W,{onClick:p,disabled:c||!a,size:"lg",className:"w-full bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700",children:c?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-5 w-5 animate-spin"}),"Searching..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"mr-2 h-5 w-5"}),"Find Services Near You"]})}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:'Try: "New York", "London", "40.7128, -74.0060", or use your current location'})]})}function rNe({results:e,category:t}){const n=u=>u<1?`${Math.round(u*1e3)}m away`:`${u.toFixed(1)}km away`,s=u=>({Restaurant:Lo,Event:Xt,Lodging:PT,Service:Pi,Embassy:H2})[u]||At,a=u=>({Restaurant:"bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-300",Event:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",Lo
897dging:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",Service:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",Embassy:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900 dark:text-indigo-300"})[u]||"bg-gray-100 text-gray-700",i=u=>({phone:u.contact_phone||u.phone,email:u.contact_email||u.email,website:u.website||u.contact_website}),o=u=>u.name||u.business_name||u.title||"Untitled",l=u=>u.city&&u.state?`${u.city}, ${u.state}`:u.city&&u.country?`${u.city}, ${u.country}`:u.address||u.location||"Location not specified",c=u=>u.description||u.bio||u.details||"",d=u=>u.images&&u.images.length>0?u.images[0]:u.photos&&u.photos.length>0?u.photos[0]:u.portfolio_images&&u.portfolio_images.length>0?u.portfolio_images[0]:u.image_url?u.image_url:u.poster_url?u.poster_url:null;return e.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(_m,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No results found"}),r.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search or expanding the radius"})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("h2",{className:"text-2xl font-bold",children:["Found ",e.length," result",e.length!==1?"s":""]}),r.jsx(te,{variant:"outline",children:t==="all"?"All Categories":t})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map((u,h)=>{const f=s(u._category),m=i(u),x=d(u);return r.jsxs(Y,{className:"hover:shadow-xl transition-all cursor-pointer overflow-hidden group",children:[x&&r.jsxs("div",{className:"relative h-48 overflow-hidden",children:[r.jsx("img",{src:x,alt:o(u),className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(te,{className:a(u._category),children:[r.jsx(f,{className:"h-3 w-3 mr-1"}),u._category]})})]}),r.jsxs(X,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-2 group-hover:text-green-600 transition-colors",children:o(u)}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsxs(te,{variant:"outline",className:"text-xs",children:[r.jsx(_m,{className:"h-3 w-3 mr-1"}),n(u.distance)]}),u.average_rating>0&&r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(mr,{className:"h-3 w-3 fill-yellow-400 text-yellow-400"}),r.jsx("span",{children:u.average_rating.toFixed(1)})]})]})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(At,{className:"h-4 w-4 flex-shrink-0 mt-0.5"}),r.jsx("span",{className:"line-clamp-2",children:l(u)})]}),c(u)&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:c(u)}),r.jsxs("div",{className:"flex gap-2 pt-2",children:[m.phone&&r.jsx(W,{variant:"outline",size:"sm",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${m.phone}`,children:[r.jsx(an,{className:"h-4 w-4 mr-1"}),"Call"]})}),m.email&&r.jsx(W,{variant:"outline",size:"sm",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`mailto:${m.email}`,children:[r.jsx(Dn,{className:"h-4 w-4 mr-1"}),"Email"]})}),m.website&&r.jsx(W,{variant:"outline",size:"sm",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:m.website,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(hn,{className:"h-4 w-4 mr-1"}),"Web"]})})]}),r.jsx(W,{variant:"ghost",className:"w-full",size:"sm",asChild:!0,children:r.jsxs("a",{href:`/${u._table}/${u.id}`,children:[r.jsx(ds,{className:"h-4 w-4 mr-2"}),"View Full Details"]})})]})]},`${u._table}-${u.id}-${h}`)})})]})}const nNe=[{id:"send-money",title:"Send Money to Nigeria",icon:Jc,description:"Compare Wise, LemFi, Remitly & more",color:"from-emerald-500 to-green-600",href:"/send-money"},{id:"restaurants",title:"Nigerian Restaurants",icon:Lo,description:"Authentic Nigerian cuisine near you",color:"from-orange-500 to-red-500"},{id:"events",title:"Cultural Events",icon:Xt,description:"Nigerian & African events in your area",color:"from-purple-500 to-pink-500"},{id:"lodging",title:"Lodging & Rentals",icon:PT,description:"Find places to
897stay",color:"from-blue-500 to-cyan-500"},{id:"artisans",title:"Services & Artisans",icon:Pi,description:"Professional services and artisans",color:"from-green-500 to-emerald-500"},{id:"embassies",title:"Embassies & Consulates",icon:H2,description:"Nigerian diplomatic missions worldwide",color:"from-indigo-500 to-blue-500"},{id:"groceries",title:"African Groceries",icon:Xl,description:"Nigerian & African food stores",color:"from-yellow-500 to-orange-500"}];function sNe(){const e=zn(),[t,n]=j.useState("all"),[s,a]=j.useState([]),[i,o]=j.useState(!1);return r.jsxs("div",{className:"min-h-screen dark:bg-background",children:[r.jsx(qn,{title:"Nigerian Diaspora Hub | Connect with Home",description:"Find Nigerian restaurants, events, services, embassies and more in your area. Your connection to home, wherever you are."}),r.jsx(oo,{variant:"diaspora",title:"Your Connection to Home",subtitle:"Discover Nigerian & African businesses, services, events, and embassies near you",icon:hn,badge:{text:"Nigerian Diaspora Hub",icon:hn},searchComponent:r.jsx(tNe,{onSearch:a,onSearchStart:()=>o(!0)})}),s.length>0&&r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-12",children:r.jsx(rNe,{results:s,category:t})}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 py-12",children:[r.jsx("div",{className:"mb-8",children:r.jsx(zo,{placementSlug:"diaspora-leaderboard",className:"mx-auto"})}),r.jsx("h2",{className:"text-3xl font-bold mb-8 text-center",children:"Explore by Category"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:nNe.map(l=>{const c=l.icon;return r.jsxs(Y,{className:"group cursor-pointer hover:shadow-xl transition-all duration-300 overflow-hidden",onClick:()=>{l.href?e(l.href):n(l.id)},children:[r.jsx("div",{className:`h-2 bg-gradient-to-r ${l.color}`}),r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:`p-3 rounded-lg bg-gradient-to-r ${l.color} text-white group-hover:scale-110 transition-transform`,children:r.jsx(c,{className:"h-6 w-6"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold mb-2 group-hover:text-green-600 transition-colors",children:l.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]})]})})]},l.id)})})]}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 py-12 bg-accent/5 rounded-lg",children:[r.jsxs("div",{className:"mb-10",children:[r.jsxs("h2",{className:"text-2xl font-bold mb-2 flex items-center gap-2",children:[r.jsx(At,{className:"h-6 w-6 text-primary"}),"Naija near me â by city"]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Find Nigerian restaurants, events, services and churches in your diaspora city."}),r.jsx("div",{className:"flex flex-wrap gap-2",children:d6.map(l=>r.jsxs(Vt,{to:`/diaspora/${l.slug}/restaurants`,className:"px-3 py-1.5 rounded-full text-sm border bg-background hover:bg-accent transition-colors",children:[l.name,", ",l.countryCode]},l.slug))})]}),r.jsxs(Kr,{defaultValue:"resources",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-1 md:grid-cols-2 h-auto",children:[r.jsxs(Re,{value:"resources",className:"flex items-center gap-2",children:[r.jsx(Th,{className:"h-4 w-4"}),"Useful Naija Resources"]}),r.jsxs(Re,{value:"embassies",className:"flex items-center gap-2",children:[r.jsx(H2,{className:"h-4 w-4"}),"Embassies & Consulates"]})]}),r.jsx(Be,{value:"resources",className:"mt-6",children:r.jsx(Q1e,{})}),r.jsx(Be,{value:"embassies",className:"mt-6",children:r.jsx(J1e,{})})]})]}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-12",children:r.jsx(Y,{className:"bg-gradient-to-r from-green-600 to-emerald-600 text-white",children:r.jsxs(X,{className:"p-8 md:p-12 text-center",children:[r.jsx(Th,{className:"h-12 w-12 mx-auto mb-4 fill-current"}),r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Build Stronger Community Connections"}),r.jsx("p",{className:"text-lg mb-6 opacity-90 max-w-2xl mx-auto",children:"Connect with fellow Nigerians, support local businesses, and stay connected to your roots no matter where you are in the world."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsx(W,{size:"lg",variant:"secondary",asChild:!0,children:r.jsx(Vt,{to:"/auth",children:"Join the Community"})}),r.jsx(W,{size:"lg",variant:"outline",className:"bg-white/10 border-white text-white hover:bg-white/20",asChild:!0,children:r.jsx(Vt,{to:"/create",children:"List Your Business"})})]})]})})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-12",children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-4xl font-bold text-green-600 mb-2",children:"195+"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Countries"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-4xl font-bold text-green-600 mb-2",children:"30+"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Embassies"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-4xl font-bold text-green-600 mb-2",children:"1000+"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Businesses"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-4xl font-bold text-green-600 mb-2",children:"24/7"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Support"})]})]})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 pb-8",children:r.jsx(Ej,{category:"tools",title:"Keep your account and connection safe",blurb:"Banking, privacy and staying-in-touch tools our readers already use.",ctaLabel:"Open"})}),r.jsx("div",{className:"container max-w-6xl mx-auto px-4 pb-8",children:r.jsx(zo,{placementSlug:"diaspora-footer-leaderboard",className:"mx-auto"})})]})}const aNe=()=>{const{user:e}
897=bt(),[t,n]=j.useState(!1),s=[{type:"Video Content",icon:r.jsx(ij,{className:"h-8 w-8"}),description:"Upload your films, documentaries, music videos, vlogs, or educational content.",formats:["MP4","MOV","AVI"],maxSize:"2GB",color:"text-blue-500"},{type:"Music & Audio",icon:r.jsx(ET,{className:"h-8 w-8"}),description:"Share your original music, podcasts, audio stories, or traditional recordings.",formats:["MP3","WAV","M4A"],maxSize:"500MB",color:"text-green-500"},{type:"Visual Arts",icon:r.jsx(no,{className:"h-8 w-8"}),description:"Showcase your photography, digital art, traditional paintings, or design work.",formats:["JPG","PNG","GIF"],maxSize:"50MB",color:"text-purple-500"},{type:"Written Content",icon:r.jsx(Ca,{className:"h-8 w-8"}),description:"Submit your stories, poetry, articles, or educational materials.",formats:["PDF","DOC","TXT"],maxSize:"25MB",color:"text-orange-500"}],a=[{icon:r.jsx(Yr,{className:"h-6 w-6"}),title:"Reach Your Audience",description:"Connect with Nigerians worldwide who appreciate authentic content."},{icon:r.jsx(mr,{className:"h-6 w-6"}),title:"Get Featured",description:"Quality content gets highlighted on our homepage and social media."},{icon:r.jsx(lr,{className:"h-6 w-6"}),title:"Grow Your Brand",description:"Build your following and establish yourself as a creator in Nigeria."}];return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("section",{className:"relative py-20 px-4 bg-gradient-to-br from-background via-background to-primary/5",children:r.jsxs("div",{className:"container mx-auto text-center",children:[r.jsx("h1",{className:"text-4xl md:text-6xl font-bold mb-6 bg-gradient-hero bg-clip-text text-transparent",children:"Submit Your Content"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8 max-w-2xl mx-auto",children:"Share your creativity with the world. Upload your original content and join Nigeria's premier creator platform."}),e?r.jsxs(Rt,{open:t,onOpenChange:n,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{size:"lg",className:"bg-gradient-hero hover:opacity-90",children:[r.jsx(Jn,{className:"h-5 w-5 mr-2"}),"Start Upload"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Upload Your Content"}),r.jsx(on,{children:"Share your creativity with the world"})]}),r.jsx(Eg,{onSuccess:()=>n(!1)})]})]}):r.jsx(W,{asChild:!0,size:"lg",className:"bg-gradient-hero hover:opacity-90",children:r.jsxs(Vt,{to:"/auth",children:[r.jsx(Jn,{className:"h-5 w-5 mr-2"}),"Sign In to Upload"]})})]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"What Can You Submit?"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"We welcome all forms of authentic Nigerian content. Choose your content type to get started."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:s.map((i,o)=>r.jsxs(Y,{className:"group hover:shadow-glow transition-all duration-300 bg-gradient-card border-primary/20 text-center",children:[r.jsxs(Se,{children:[r.jsx("div",{className:`mx-auto mb-4 ${i.color}`,children:i.icon}),r.jsx(Ae,{className:"text-xl",children:i.type})]}),r.jsxs(X,{className:"space-y-4",children:[r.jsx(Nt,{className:"text-sm leading-relaxed",children:i.description}),r.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("div",{children:[r.jsx("strong",{children:"Formats:"})," ",i.formats.join(", ")]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Max Size:"})," ",i.maxSize]})]}),e?r.jsxs(Rt,{open:t,onOpenChange:n,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{className:"w-full bg-gradient-hero hover:opacity-90",children:["Upload ",i.type]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Upload Your Content"}),r.jsx(on,{children:"Share your creativity with the world"})]}),r.jsx(Eg,{onSuccess:()=>n(!1)})]})]}):r.jsx(W,{asChild:!0,className:"w-full bg-gradient-hero hover:opacity-90",children:r.jsx(Vt,{to:"/auth",children:"Sign In to Upload"})})]})]},o))})]})}),r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Why Submit to Naija.com?"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Join thousands of creators who have found their audience on Nigeria's fastest-growing platform."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:a.map((i,o)=>r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"mx-auto mb-6 h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:i.icon}),r.jsx("h3",{className:"text-xl font-semibold mb-4",children:i.title}),r.jsx("p",{className:"text-muted-foreground",children:i.description})]},o))})]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto max-w-4xl",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Submission Guidelines"}),r.jsx("p",{className:"text-muted-foreground",children:"To ensure quality and compliance, please review our content guidelines before submitting."})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-green-500",children:"â What We Accept"})}),r.jsx(X,{className:"space-y-2",children:r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm",children:[r.jsx("li",{children:"Original content created by you"}),r.jsx("li",{children:"High-quality audio and video"}),r.jsx("li",{children:"Nigerian culture and lifestyle content"}),r.jsx("li",{children:"Educational and informative material"}),r.jsx("li",{children:"Music and creative performances"}),r.jsx("li",{children:"Documentary and storytelling content"}),r.jsx("li",{children:"Art and visual creativity"})]})})]}),r.jsxs(Y,{className:"bg-gradient-card border-destructive/20",children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-red-500",children:"â What We Don't Accept"})}),r.jsx(X,{className:"space-y-2",children:r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm",children:[r.jsx("li",{children:"Copyrighted material without permission"}),r.jsx("li",{children:"Hate speech or discriminatory content"}),r.jsx("li",{children:"Explicit or inappropriate material"}),r.jsx("li",{children:"Spam or promotional content"}),r.jsx("li",{children:"Low-quality or corrupted files"}),r.jsx("li",{children:"Content that violates Nigerian laws"}),r.jsx("li",{children:"Misleading or false information"})]})})]})]}),r.jsxs("div",{className:"text-center mt-12",children:[r.jsx("p",{className:"text-muted-foreground mb-6",children:"Ready to share your creativity with the world?"}),e?r.jsxs(Rt,{open:t,onOpenChange:n,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{size:"lg",className:"bg-gradient-hero hover:opacity-90",children:[r.jsx(Jn,{className:"h-5 w-5 mr-2"}),"Submit Content Now"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Upload Your Content"}),r.jsx(on,{children:"Share your creativity with the world"})]}),r.jsx(Eg,{onSuccess:()=>n(!1)})]})]}):r.jsx(W,{asChild:!0,size:"lg",className:"bg-gradient-hero hover:opacity-90",children:r.jsxs(Vt,{to:"/auth",children:[r.jsx(Jn,{className:"h-5 w-5 mr-2"}),"Sign In to Submit Content"]})})]})]})}),r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto text-center max-w-2xl",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Need Help?"}),r.jsx("p",{className:"text-muted-foreground mb-8",children:"Our team is here to help you get your content online. Contact us for technical support or content guidance."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsx(W,{variant:"outline",children:"Contact Support"}),r.jsx(W,{variant:"outline",children:"View FAQ"})]})]})})]})},iNe=()=>{const e=[{icon:r.jsx(Th,{className:"h-8 w-8"}),title:"Authentic Nigerian Culture",description:"We celebrate and preserve the rich diversity of Nigerian creativity, from traditional arts to modern digital content."},{icon:r.jsx(Yr,{className:"h-8 w-8"}),title:"Community First",description:"Our platform is built by Nigerians, for Nigerians. We prioritize community needs and creator success."},{icon:r.jsx(hn,{className:"h-8 w-8"}),title:"Global Reach",description:"Connect Nigerian creators with audie
897nces worldwide while keeping our roots firmly planted in Nigerian soil."},{icon:r.jsx(ui,{className:"h-8 w-8"}),title:"Innovation",description:"We leverage cutting-edge technology to provide the best experience for creators and audiences alike."},{icon:r.jsx(fn,{className:"h-8 w-8"}),title:"Trust & Safety",description:"We maintain the highest standards of content moderation and user safety across all our platforms."},{icon:r.jsx(Vd,{className:"h-8 w-8"}),title:"Creator Success",description:"Your success is our success. We provide tools, resources, and opportunities for creators to thrive."}],t=[{number:"50,000+",label:"Active Creators"},{number:"2M+",label:"Monthly Viewers"},{number:"100,000+",label:"Content Pieces"},{number:"36",label:"States Represented"}],n=[{name:"Peter Oseghale",role:"Founder & CEO",image:"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=300",bio:"Former tech executive with 15 years in media and technology, passionate about elevating Nigerian content."},{name:"Akin Andrew Akinola",role:"Head of Content",image:"",bio:"Award-winning filmmaker and content strategist who has worked with top Nigerian entertainment companies."},{name:"Anthony Owugo",role:"CTO",image:"",bio:"Software engineer with expertise in scalable platforms, formerly with major tech companies in Lagos."}];return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"About Naija.com - Nigeria's Premier Creator Platform",description:"Learn about Naija.com's mission to empower Nigerian creators with tools for content, events, commerce, and stays. Built by Nigerians, for Nigerians."}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("section",{className:"relative py-20 px-4 bg-gradient-to-br from-background via-background to-primary/5",children:r.jsxs("div",{className:"container mx-auto text-center",children:[r.jsx("h1",{className:"text-4xl md:text-6xl font-bold mb-6 bg-gradient-hero bg-clip-text text-transparent",children:"About Naija.com"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8 max-w-3xl mx-auto",children:"We're building the premier platform for Nigerian creators to share their stories, connect with audiences, and build sustainable creative careers. Our mission is to amplify Nigerian voices on the global stage."}),r.jsx(te,{className:"text-lg px-6 py-2 bg-gradient-hero",children:"Proudly Nigerian ð³ð¬"})]})}),r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsx("div",{className:"container mx-auto",children:r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8",children:t.map((s,a)=>r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-3xl md:text-4xl font-bold text-primary mb-2",children:s.number}),r.jsx("div",{className:"text-muted-foreground font-medium",children:s.label})]},a))})})}),r.jsx("section",{className:"py-16 px-4",children:r.jsx("div",{className:"container mx-auto max-w-4xl",children:r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-6",children:"Our Story"}),r.jsxs("div",{className:"prose prose-lg mx-auto text-muted-foreground leading-relaxed",children:[r.jsx("p",{className:"mb-6",children:"Naija.com was born from a simple observation: Nigerian creativity is boundless, but creators often lack the platform and tools to reach their full potential. In 2023, we set out to change that."}),r.jsx("p",{className:"mb-6",children:"Starting in Lagos with a small team of passionate Nigerians, we built more than just a content platform. We created an ecosystem where creators can not only share their work but also sell products, organize events, and build communities around their art."}),r.jsx("p",{children:"Today, Naija.com serves creators from all 36 states, connecting them with millions of viewers worldwide while keeping Nigerian culture and values at the heart of everything we do."})]})]})})}),r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Our Values"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"These principles guide every decision we make and every feature we build."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:e.map((s,a)=>r.jsxs(Y,{className:"text-center bg-gradient-card border-primary/20 hover:shadow-glow transition-all duration-300",children:[r.jsxs(Se,{children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:s.icon}),r.jsx(Ae,{className:"text-xl",children:s.title})]}),r.jsx(X,{children:r.jsx(Nt,{className:"leading-relaxed",children:s.description})})]},a))})]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Meet Our Team"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"The passionate Nigerians building the future of African content creation."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:n.map((s,a)=>r.jsxs(Y,{className:"text-center bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsx("div",{className:"mx-auto mb-4",children:r.jsx("img",{src:s.image,alt:s.name,className:"w-24 h-24 rounded-full object-cover mx-auto"})}),r.jsx(Ae,{className:"text-xl",children:s.name}),r.jsx(Nt,{className:"text-primary font-medium",children:s.role})]}),r.jsx(X,{children:r.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:s.bio})})]},a))})]})}),r.jsx("section",{className:"py-16 px-4 bg-gradient-to-br from-primary/5 via-background to-secondary/5",children:r.jsxs("div",{className:"container mx-auto text-center max-w-4xl",children:[r.jsx("h2",{className:"text-3xl font-bold mb-6",children:"Our Mission"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8 leading-relaxed",children:"To empower every Nigerian creator with the tools, platform, and community they need to share their unique voice with the world, while building sustainable creative careers that celebrate and preserve our rich cultural heritage."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsx(W,{size:"lg",className:"bg-gradient-hero hover:opacity-90",children:"Join Our Community"}),r.jsx(W,{size:"lg",variant:"outline",children:"Partner With Us"})]})]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto text-center max-w-2xl",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Get In Touch"}),r.jsx("p",{className:"text-muted-foreground mb-8",children:"Have questions, feedback, or partnership opportunities? We'd love to hear from you."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm",children:[r.jsx("strong",{children:"Email:"})," [email protected]"]}),r.jsxs("div",{className:"text-sm",children:[r.jsx("strong",{children:"Address:"})," Victoria Island, Lagos, Nigeria"]}),r.jsxs("div",{className:"text-sm",children:[r.jsx("strong",{children:"Phone:"})," +234 (0) 123 456 7890"]})]})]})})]})]})},oNe=()=>{const{toast:e}=Sn(),t=lu(),s={"@context":"https://schema.org","@graph":[{"@type":"FAQPage",mainEntity:[{q:"How do I submit c
897ontent?",a:"Visit our Submit page and choose the type of content you'd like to share. We support videos, music, art, and written content."},{q:"How do I create an event?",a:"Go to the Events section and click 'Create Event'. You can set up ticketing, venue details, and promote your event to our community."},{q:"Can I sell products on Naija.com?",a:"Yes! Our Marketplace allows you to list and sell your products. Create your vendor profile and start selling to Nigerians worldwide."}].map(o=>({"@type":"Question",name:o.q,acceptedAnswer:{"@type":"Answer",text:o.a}}))},{"@type":"LocalBusiness",name:"Naija.com",email:"[email protected]",telephone:"+234 800 624 52",address:{"@type":"PostalAddress",addressLocality:"Victoria Island, Lagos",addressRegion:"Lagos State",addressCountry:"NG"},openingHoursSpecification:[{"@type":"OpeningHoursSpecification",dayOfWeek:["Monday","Tuesday","Wednesday","Thursday","Friday"],opens:"09:00",closes:"18:00"}],url:"https://naija-connect-platform.lovable.app/contact"}]},a=async o=>{try{console.log("Contact form submitted:",o),e({title:"Message sent successfully!",description:"We'll get back to you within 24 hours."}),t.reset()}catch(l){e({title:"Failed to send message",description:l.message,variant:"destructive"})}},i=[{icon:r.jsx(Dn,{className:"h-6 w-6"}),title:"Email Us",description:"[email protected]",details:"We typically respond within 24 hours"},{icon:r.jsx(an,{className:"h-6 w-6"}),title:"Call Us",description:"+234 800 NAIJA (62452)",details:"Mon-Fri, 9AM-6PM WAT"},{icon:r.jsx(At,{className:"h-6 w-6"}),title:"Visit Us",description:"Lagos, Nigeria",details:"Victoria Island, Lagos State"},{icon:r.jsx($r,{className:"h-6 w-6"}),title:"Business Hours",description:"Mon - Fri: 9AM - 6PM",details:"Weekend support available"}];return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Contact Naija.com - Get in Touch with Our Team",description:"Have questions or need support? Contact the Naija.com team via email, phone, or our contact form. Lagos-based with 24-hour response.",canonical:"/contact",structuredData:s}),r.jsx("section",{className:"py-20 px-4 bg-gradient-to-br from-background via-background to-primary/5",children:r.jsxs("div",{className:"container mx-auto text-center",children:[r.jsx("h1",{className:"text-4xl md:text-6xl font-bold mb-6 bg-gradient-hero bg-clip-text text-transparent",children:"Contact Us"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8 max-w-2xl mx-auto",children:"Have questions, suggestions, or need support? We'd love to hear from you. Get in touch with the Naija.com team."})]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-16",children:i.map((o,l)=>r.jsx(Y,{className:"bg-gradient-card border-primary/20 text-center group hover:shadow-glow transition-all duration-300",children:r.jsxs(X,{className:"pt-6",children:[r.jsx("div",{className:"mx-auto mb-4 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center text-primary group-hover:bg-primary group-hover:text-background transition-colors",children:o.icon}),r.jsx("h3",{className:"font-semibold mb-2",children:o.title}),r.jsx("p",{className:"text-primary font-medium mb-1",children:o.description}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o.details})]})},l))}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12",children:[r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(Oh,{className:"h-6 w-6 text-primary"}),"Send us a Message"]}),r.jsx(Nt,{children:"Fill out the form below and we'll get back to you as soon as possible."})]}),r.jsx(X,{children:r.jsx(tf,{...t,children:r.jsxs("form",{onSubmit:t.handleSubmit(a),className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:t.control,name:"name",render:({field:o})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Full Name"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Your full name",...o})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:t.control,name:"email",render:({field:o})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Email Address"}),r.jsx(it,{children:r.jsx(ge,{type:"email",placeholder:"[email protected]",...o})}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:t.control,name:"subject",render:({field:o})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Subject"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"What is this regarding?",...o})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:t.control,name:"message",render:({field:o})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Message"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Tell us more about your inquiry...",className:"min-h-[150px]",...o}
897)}),r.jsx(Qe,{})]})}),r.jsxs(W,{type:"submit",className:"w-full bg-gradient-hero hover:opacity-90",size:"lg",children:[r.jsx(Dn,{className:"h-5 w-5 mr-2"}),"Send Message"]})]})})})]}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Frequently Asked Questions"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"How do I submit content?"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Visit our Submit page and choose the type of content you'd like to share. We support videos, music, art, and written content."})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"How do I create an event?"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:'Go to the Events section and click "Create Event". You can set up ticketing, venue details, and promote your event to our community.'})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Can I sell products on Naija.com?"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Yes! Our Marketplace allows you to list and sell your products. Create your vendor profile and start selling to Nigerians worldwide."})]})]})]}),r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Join Our Community"})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Stay connected with the latest updates, featured content, and community news."}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx(W,{variant:"outline",className:"flex-1",children:"Follow on Twitter"}),r.jsx(W,{variant:"outline",className:"flex-1",children:"Join Discord"})]})]})]})]})]})]})})]})},lNe=({title:e,amount:t,platformFee:n,netAmount:s,currency:a="NGN",onPaystackPayment:i,onPaypalPayment:o,isProcessing:l,className:c,showFeeBredown:d=!0})=>{const u=h=>new Intl.NumberFormat("en-NG",{style:"currency",currency:a,minimumFractionDigits:0}).format(h);return r.jsxs(Y,{className:Ge("w-full max-w-md mx-auto",c),children:[r.jsxs(Se,{className:"text-center",children:[r.jsx(Ae,{className:"text-2xl font-bold",children:e}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:u(t)}),d&&r.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{children:"Platform fee:"}),r.jsx("span",{children:u(n)})]}),r.jsxs("div",{className:"flex justify-between items-center font-medium",children:[r.jsx("span",{children:"You receive:"}),r.jsx("span",{className:"text-foreground",children:u(s)})]})]})]})]}),r.jsxs(X,{className:"space-y-4",children:[d&&r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted/50 rounded-lg",children:[r.jsx(tc,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Platform fees help us maintain and improve our services"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold text-center",children:"Choose Payment Method"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(W,{onClick:i,disabled:l,className:"h-14 justify-start bg-gradient-hero hover:opacity-90 disabled:opacity-50",size:"lg",children:[r.jsx(ec,{className:"h-5 w-5 mr-3"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-semibold",children:"Pay with Paystack"}),r.jsx("div",{className:"text-xs opacity-90",children:"Card, Bank Transfer, USSD"})]}),r.jsx(te,{variant:"secondary",className:"ml-auto",children:"Recommended"})]}),r.jsxs(W,{onClick:o,disabled:l,variant:"outline",className:"h-14 justify-start hover:bg-accent",size:"lg",children:[r.jsx(ui,{className:"h-5 w-5 mr-3 text-orange-500"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-semibold",children:"Pay with Flutterwave"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"International payments"})]})]})]})]}),r.jsxs("div",{className:"text-xs text-center text-muted-foreground space-y-1",children:[r.jsx("p",{children:"Your payment is secured with industry-standard encryption"}),r.jsx("p",{children:"You will be redirected to complete your payment"})]})]})]})},u6=()=>{const[e,t]=j.useState(!1),[n,s]=j.useState({}),{user:a}=bt(),{provider:i,currency:o,isDiaspora:l}=_j(),c=async()=>{try{const{data:p,error:v}=await H.from("platform_fee_settings").select("*").eq("is_active",!0);if(v)throw v;const g=p.reduce((y,b)=>(y[b.category]=b,y),{});return s(g),g}catch(p){return console.error("Error fetching platform fees:",p),{}}},d=(p,v)=>{const g=n[v];if(!g){const w={events:12,products:15,properties:12,donations:5}[v]||10;return Math.max(p*(w/100),50)}let y=0;return g.fee_type==="percentage"?y=p*(g.fee_value/100):y=g.fee_value,g.minimum_fee&&y<g.minimum_fee&&(y=g.minimum_fee),g.maximum_fee&&y>g.maximum_fee&&(y=g.maximum_fee),Math.round(y)},u=async p=>{if(!a)return be({title:"Authentication required",description:"Please log in to continue with payment",variant:"destructive"}),null;t(!0);try{const v=p.payment_method||i,g=p.currency||o;switch(console.log(`Processing payment via ${v} in ${g}`),v){case"stripe":return await h(p,g);case"flutterwave":return await f(p,g);case"paystack":default:return await m(p,g)}}catch(v){return console.error("Payment error:",v),be({title:"Payment failed",description:v.message||"An error occurred while processing payment",variant:"destructive"}),null}finally{t(!1)}},h=async(p,v)=>{var g,y;try{const{data:b,error:w}=await H.functions.invoke("create-stripe-payment",{body:{amount:p.amount,currency:v,metadata:{...p.metadata,type:p.type,reference_id:p.reference_id,product_name:((g=p.metadata)==null?void 0:g.product_name)||p.type,description:(y=p.metadata)==null?void 0:y.description},success_url:p.success_url||`${window.location.origin}/dashboard?payment=success`,cancel_url:p.cancel_url||`${window.location.origin}/dashboard?payment=cancelled`}});if(w)throw w;if(b!=null&&b.url)return window.open(b.url,"_blank"),be({title:"Payment initiated",description:"You've been redirected to complete your payment via Stripe"}),{success:!0,payment_url:b.url,reference:b.session_id,session_id:b.session_id,platform_fee:0,net_amount:p.amount};throw new Error("Failed to create Stripe checkout session")}catch(b){throw console.error("Stripe payment error:",b),b}},f=async(p,v)=>{try{const{data:g,error:y}=await H.functions.invoke("initialize-flutterwave-payment",{body:{amount:p.amount,currency:v,type:p.type,metadata:{...p.metadata,type:p.type,reference_id:p.reference_id},callback_url:p.callback_url||`${window.location.origin}/dashboard?payment=success`,reference:`FLW_${p.type}_${Date.now()}_${Math.random().toString(36).substring(7)}`}});if(y)throw y;if(g!=null&&g.payment_url)return window.open(g.payment_url,"_blank"),be({title:"Payment initiated",description:"You've been redirected to complete your payment via Flutterwave"}),{success:!0,payment_url:g.payment_url,reference:g.reference,platform_fee:0,net_amount:p.amount};throw new Error("Failed to create Flutterwave payment")}catch(g){throw console.error("Flutterwave payment error:",g),g}},m=async(p,v)=>{try{const{data:g,error:y}=await H.functions.invoke("process-payment",{body:{...p,currency:v,email:a==null?void 0:a.email}});if(y)throw y;if(g.success)return window.open(g.payment_url,"_blank"),be({title:"Payment initiated",description:"You've been redirected to complete your payment via Paystack"}),g;throw new Error("Payment initialization failed")}catch(g){throw console.error("Paystack payment error:",g),g}};return{isProcessing:e,platformFees:n,fetchPlatformFees:c,calculateDisplayFee:d,processPayment:u,fetchPaymentHistory:async()=>
897{if(!a)return[];try{const{data:p,error:v}=await H.from("payment_transactions").select("*").eq("user_id",a.id).order("created_at",{ascending:!1});if(v)throw v;return p||[]}catch(p){return console.error("Error fetching payment history:",p),[]}},paymentProvider:i,currency:o,isDiaspora:l,formatAmount:p=>fve(p,o)}},cNe=()=>{const{toast:e}=Sn(),[t,n]=j.useState(null),[s,a]=j.useState(""),{isProcessing:i,processPayment:o,calculateDisplayFee:l}=u6(),c=[1e3,2500,5e3,1e4,25e3,5e4],d=async h=>{const f=t||parseInt(s);if(!f||f<100){e({title:"Invalid amount",description:"Please enter a valid donation amount (minimum â¦100)",variant:"destructive"});return}await o({amount:f,payment_method:h,type:"donation",metadata:{purpose:"Platform Support Donation",amount_display:`â¦${f.toLocaleString()}`}})},u=[{icon:r.jsx(Yr,{className:"h-8 w-8"}),number:"50,000+",label:"Creators Supported",description:"Nigerian artists, musicians, and storytellers"},{icon:r.jsx(ui,{className:"h-8 w-8"}),number:"1M+",label:"Content Views",description:"Monthly views on authentic Nigerian content"},{icon:r.jsx(hn,{className:"h-8 w-8"}),number:"36",label:"States Reached",description:"Connecting Nigerians across all states"}];return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("section",{className:"py-20 px-4 bg-gradient-to-br from-background via-background to-primary/5",children:r.jsxs("div",{className:"container mx-auto text-center",children:[r.jsx("div",{className:"mx-auto mb-6 h-16 w-16 rounded-full bg-gradient-hero flex items-center justify-center",children:r.jsx(Th,{className:"h-8 w-8 text-background"})}),r.jsx("h1",{className:"text-4xl md:text-6xl font-bold mb-6 bg-gradient-hero bg-clip-text text-transparent",children:"Support Our Mission"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8 max-w-3xl mx-auto",children:"Help us build Nigeria's premier content platform. Your donation supports exceptional Nigerian students, artists, storytellers, and entrepreneurs in need to further their education, skills and technical craft in Nigeria and in the diaspora."})]})}),r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Your Impact"}),r.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"See how your support is making a difference in the Nigerian communities at home and in the diaspora."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:u.map((h,f)=>r.jsx(Y,{className:"bg-gradient-card border-primary/20 text-center",children:r.jsxs(X,{className:"pt-6",children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:h.icon}),r.jsx("div",{className:"text-3xl font-bold text-primary mb-2",children:h.number}),r.jsx("h3",{className:"font-semibold mb-2",children:h.label}),r.jsx("p",{className:"text-sm text-muted-foreground",children:h.description})]})},f))})]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsxs("div",{className:"container mx-auto max-w-4xl",children:[r.jsxs("div",{className:"text-center mb-12",children:[r.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Make a Donation"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose an amount that works for you. Every contribution helps us grow and support more needy Nigerians"})]}),r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsx(Ae,{className:"text-center",children:"Choose Your Contribution"}),r.jsx(Nt,{className:"text-center",children:"All donations go directly to platform development and student support programs"})]}),r.jsxs(X,{className:"space-y-8",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-4",children:"Quick Amounts"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:c.map(h=>r.jsxs(W,{variant:t===h?"default":"outline",onClick:()=>{n(h),a("")},className:t===h?"bg-gradient-hero":"",children:["â¦",h.toLocaleStr
897ing()]},h))})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-4",children:"Custom Amount"}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"â¦"}),r.jsx("input",{type:"number",placeholder:"Enter custom amount",value:s,onChange:h=>{a(h.target.value),n(null)},className:"flex-1 h-10 px-3 bg-background border border-border rounded-md focus:outline-none focus:ring-2 focus:ring-primary/50",min:"100"})]})]}),(t||s)&&r.jsx(lNe,{title:"Support Our Platform",amount:t||parseInt(s)||0,platformFee:l(t||parseInt(s)||0,"donations"),netAmount:(t||parseInt(s)||0)-l(t||parseInt(s)||0,"donations"),onPaystackPayment:()=>d("paystack"),onPaypalPayment:()=>d("flutterwave"),isProcessing:i,showFeeBredown:!1})]})]}),r.jsxs("div",{className:"mt-12 grid grid-cols-1 md:grid-cols-2 gap-8",children:[r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-lg",children:"Why Your Support Matters"})}),r.jsxs(X,{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-primary rounded-full mt-2"}),r.jsx("p",{children:"Fund the education of exception students in Science, Technology & Engineering"})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-primary rounded-full mt-2"}),r.jsx("p",{children:"Support stranded Nigerians in the diaspora and those in need"})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-primary rounded-full mt-2"}),r.jsx("p",{children:"Fund platform development to maintain free access for all users"})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-primary rounded-full mt-2"}),r.jsx("p",{children:"Promote Nigerian culture globally"})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-primary rounded-full mt-2"}),r.jsx("p",{children:"Appreciate us @naija.com"})]})]})]}),r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-lg",children:"Other Ways to Support"})}),r.jsxs(X,{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-secondary rounded-full mt-2"}),r.jsx("p",{children:"Share our platform with fellow Nigerians"})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-secondary rounded-full mt-2"}),r.jsx("p",{children:"Create and submit your own content"})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-secondary rounded-full mt-2"}),r.jsx("p",{children:"Engage with creators on the platform"})]}),r.jsxs("div",{className:"flex items-start space-x-3",children:[r.jsx("div",{className:"w-2 h-2 bg-secondary rounded-full mt-2"}),r.jsx("p",{children:"Provide feedback and suggestions"})]})]})]})]})]})})]})},js={TITLE:50,SUMMARY:300,DESCRIPTION:500,ADDRESS:200,PHONE:20,EMAIL:54,AMENITIES:1e3,HOUSE_RULES:1e3,CANCELLATION_POLICY:1e3,PHOTOS:2e3},p_=({onSuccess:e})=>{const{user:t}=bt(),{toast:n}=Sn(),{preferences:s,isLoading:a}=Di(),[i,o]=ee.useState(null),[l,c]=ee.useState(!0);ee.useEffect(()=>{(async()=>{if(!t){c(!1);return}try{const{data:m,error:x}=await H.rpc("check_property_limits",{user_id:t.id});x?(console.error("Error checking limits:",x),o({can_create_listing:!0,max_listings:3,current_listings:0,max_ph
897otos_per_listing:3,current_plan:"Free"})):o(m)}catch(m){console.error("Error:",m),o({can_create_listing:!0,max_listings:3,current_listings:0,max_photos_per_listing:3,current_plan:"Free"})}finally{c(!1)}})()},[t]);const d=lu({defaultValues:{country_code:"NG"}});ee.useEffect(()=>{!a&&s&&(d.setValue("country_code",s.country),d.setValue("state",s.state),d.setValue("city",s.city))},[s,a,d]),ee.useEffect(()=>{const f=d.watch((m,{name:x})=>{x==="country_code"&&d.setValue("state","")});return()=>f.unsubscribe()},[d]);const u=async f=>{if(!t){n({title:"Please login to list properties",variant:"destructive"});return}if(i&&!i.can_create_listing){n({title:"Listing limit reached",description:`You've reached your ${i.current_plan} plan limit. Please upgrade to create more properties.`,variant:"destructive"});return}if(f.title.length>js.TITLE){n({title:`Title must be ${js.TITLE} characters or less`,variant:"destructive"});return}if(f.summary.length>js.SUMMARY){n({title:`Summary must be ${js.SUMMARY} characters or less`,variant:"destructive"});return}if(f.description.length>js.DESCRIPTION){n({title:`Description must be ${js.DESCRIPTION} characters or less`,variant:"destructive"});return}try{const{error:m}=await H.from("properties").insert([{...f,owner_id:t.id,property_type:f.property_type,amenities:f.amenities.split(",").map(x=>x.trim()).slice(0,50),photos:f.photos.split(",").map(x=>x.trim()).slice(0,10)}]);if(m)throw m;n({title:"Property listed successfully!"}),d.reset(),e==null||e()}catch(m){n({title:"Failed to list property",description:m.message,variant:"destructive"})}},h=["apartment","hotel","room","studio"];return r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(en,{className:"h-6 w-6 text-primary"}),"List Your Property"]}),r.jsx(Nt,{children:"Welcome guests to your Nigerian property"})]}),r.jsxs(X,{children:[i&&!l&&r.jsx(Pj,{planName:i.current_plan,currentListings:i.current_listings,maxListings:i.max_listings,photosPerListing:i.max_photos_per_listing,canCreate:i.can_create_listing,feature:"properties"}),r.jsx(tf,{...d,children:r.jsxs("form",{onSubmit:d.handleSubmit(u),className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:d.control,name:"title",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Property Title"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Beautiful 2-bedroom apartment",maxLength:js.TITLE,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",js.TITLE," characters"]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:d.control,name:"property_type",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Property Type"}),r.jsxs(mt,{onValueChange:f.onChange,defaultValue:f.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select property type"})})}),r.jsx(ht,{children:h.map(m=>r.jsx(Ne,{value:m,children:m.charAt(0).toUpperCase()+m.slice(1)},m))})]}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:d.control,name:"summary",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Summary"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Short description of your property",maxLength:js.SUMMARY,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",js.SUMMARY," characters"]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:d.control,name:"description",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Description"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Detailed description of your property...",className:"min-h-[120px]",maxLength:js.DESCRIPTION,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",js.DESCRIPTION," characters"]}),r.jsx(Qe,{})]})}}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[r.jsx(Ze,{control:d.control,name:"base_price_per_night",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Tn,{className:"h-4 w-4"}),"Price per Night (â¦)"]}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"15000",min:"0",max:"10000000",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"cleaning_fee",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Cleaning Fee (â¦)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"2000",min:"0",max:"1000000",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"max_guests",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Yr,{className:"h-4 w-4"}),"Max Guests"]}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"4",min:"1",max:"50",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[r.jsx(Ze,{control:d.control,name:"bedrooms",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Nie,{className:"h-4 w-4"}),"Bedrooms"]}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"2",min:"0",max:"20",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"beds",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Beds"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"3",min:"0",max:"50",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"baths",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(wie,{className:"h-4 w-4"}),"Bathrooms"]}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"2",min:"0",max:"20",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"min_nights",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Min Nights"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"1",min:"1",max:"365",...f,onChange:m=>f.onChange(Number(m.target.value))})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6",children:[r.jsx(Ze,{control:d.control,name:"country_code",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(dc,{value:f.value,onValueChange:f.onChange,label:"Country",required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"address",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(At,{className:"h-4 w-4"}),"Address"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Full address",maxLength:js.ADDRESS,...f})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"city",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"City"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Lagos",maxLength:100,...f})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"state",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(uc,{countryCode:d.watch("country_code"),value:f.value,onChange:f.onChange,required:!0}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:d.control,name:"amenities",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Amenities"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"wifi, air conditioning, kitchen, parking",maxLength:js.AMENITIES,...f})}),r.jsxs(Pr,{children:["Comma-separated amenities (",((m=f.value)==null?void 0:m.length)||0," / ",js.AMENITIES,")"]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:d.control,name:"house_rules",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"House Rules"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"No smoking, no pets, quiet hours 10pm-7am",maxLength:js.HOUSE_RULES,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",js.HOUSE_RULES," characters"]}),r.jsx(Qe,{})]})}})]}),r.jsx(Ze,{control:d.control,name:"photos",render:({field:f})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Photos (URLs)"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"https://example.com/photo1.jpg, https://example.com/photo2.jpg",maxLength:js.PHOTOS,...f})}),r.jsx(Pr,{children:"Comma-separated photo URLs (max 10 photos)"}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"cancellation_policy",render:({field:f})=>{var m;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Cancellation Policy"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Free cancellation up to 24 hours before check-in",maxLength:js.CANCELLATION_POLICY,...f})}),r.jsxs(Pr,{children:[((m=f.value)==null?void 0:m.length)||0," / ",js.CANCELLATION_POLICY," characters"]}),r.jsx(Qe,{})]})}}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsx(Ze,{control:d.control,name:"contact_phone",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),"Contact Phone *"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"+234 803 456 7890",maxLength:js.PHONE,...f,required:!0})}),r.jsx(Pr,{children:"Guests will use this to contact you"}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:d.control,name:"contact_email",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-4 w-4"}),"Contact Email *"]}),r.jsx(it,{children:r.jsx(ge,{type:"email",placeholder:"[email protected]",maxLength:js.EMAIL,...f,required:!0})}),r.jsx(Pr,{children:"For booking inquiries and confirmations"}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:d.control,name:"contact_whatsapp",render:({field:f})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(dl,{className:"h-4 w-4"}),"WhatsApp Number (Optional)"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"+234 803 456 7890",maxLength:js.PHONE,...f})}),r.jsx(Pr,{children:"If different from contact phone. Guests can message directly via WhatsApp."}),r.jsx(Qe,{})]})}),r.jsxs(W,{type:"submit",className:"w-full bg-gradient-hero hover:opacity-90",size:"lg",children:[r.jsx(en,{className:"h-5 w-5 mr-2"}),"List Property"]})]})})]})]})},zi={TITLE:100,DESCRIPTION:1e3,MAKE:50,MODEL:50,SPECIFICATIONS:500,RENTAL_TERMS:1e3,PICKUP_LOCATION:200,PHONE:20,EMAIL:100},dNe=[{value:"car",label:"Car"},{value:"truck",label:"Truck"},{value:"van",label:"Van"},{value:"suv",label:"SUV"},{value:"motorcycle",label:"Motorcycle"},{value:"bicycle",label:"Bicycle"},{value:"equipment",label:"Equipment"}],uNe=[{value:"automatic",label:"Automatic"},{value:"manual",label:"Manual"}],hNe=[{value:"petrol",label:"Petrol"},{value:"diesel",label:"Diesel"},{value:"electric",label:"Electric"},{value:"hybrid",label:"Hybrid"}],a8=[{value:"excellent",label:"Excellent"},{value:"good",label:"Good"},{value:"fair",label:"Fair"}];function g_({onSuccess:e}){const{user:t}=bt(),{toast:n}=Sn(),{preferences:s,isLoading:a}=Di(),[i,o]=j.useState(!1),[l,c]=j.useState(!1),[d,u]=j.useState([]),[h,f]=j.useState(null),m=lu({defaultValues:{country_code:"NG",listing_type:"car",condition:"excellent",transmission:"automatic",fuel_type:"petrol",driver_included:!1,security_personnel_included:!1,insurance_included:!1,minimum_rental_days:1,seats:5}});j.useEffect(()=>{!a&&s&&(m.setValue("country_code",s.country),m.setValue("state",s.state),m.setValue("city",s.city))},[s,a,m]),j.useEffect(()=>{t&&x()},[t]);const x=async()=>
897{if(t)try{const{data:N,error:k}=await H.rpc("check_rental_car_limits",{user_id:t.id}).single();if(k)throw k;f(N)}catch(N){console.error("Error fetching limits:",N)}},p=async N=>{const k=N.target.files;if(!k||k.length===0)return;const I=(h==null?void 0:h.max_photos_per_listing)||3,P=I-d.length;if(P<=0){n({title:"Photo limit reached",description:`You can upload maximum ${I} photos with your current subscription.`,variant:"destructive"});return}if(k.length>P){n({title:"Too many photos",description:`You can only upload ${P} more photo(s).`,variant:"destructive"});return}c(!0);try{const O=[];for(let A=0;A<k.length;A++){const R=k[A];if(R.size>5*1024*1024){n({title:"File too large",description:`${R.name} exceeds 5MB limit`,variant:"destructive"});continue}const L=R.name.split(".").pop(),z=`${t.id}/${Date.now()}-${Math.random()}.${L}`,{error:U,data:$}=await H.storage.from("rental-car-photos").upload(z,R);if(U)throw U;const{data:{publicUrl:q}}=H.storage.from("rental-car-photos").getPublicUrl(z);O.push(q)}u([...d,...O]),n({title:"Photos uploaded successfully!"})}catch(O){console.error("Error uploading photos:",O),n({title:"Upload failed",description:O.message,variant:"destructive"})}finally{c(!1)}},v=async N=>{try{const k=N.split("/rental-car-photos/");if(k.length>1){const I=k[1];await H.storage.from("rental-car-photos").remove([I])}u(d.filter(I=>I!==N)),n({title:"Photo removed"})}catch(k){console.error("Error removing photo:",k)}},g=async N=>{if(!t){n({title:"Please login to create a listing",variant:"destructive"});return}if(h&&!h.can_create_listing){n({title:"Listing limit reached",description:`You've reached your limit of ${h.max_listings} listing(s). Please upgrade your subscription.`,variant:"destructive"});return}if(d.length===0){n({title:"Photos required",description:"Please upload at least one photo of your vehicle/equipment.",variant:"destructive"});return}o(!0);try{const{error:k}=await H.from("rental_cars").insert([{...N,owner_id:t.id,photos:d,features:N.features.split(",").map(I=>I.trim()).filter(I=>I.length>0),status:"active",moderation_status:"pending"}]);if(k)throw k;n({title:"Listing created successfully!",description:"Your listing is pending admin approval."}),m.reset(),u([]),e==null||e()}catch(k){console.error("Error creating listing:",k),n({title:"Failed to create listing",description:k.message,variant:"destructive"})}finally{o(!1)}},b=m.watch("listing_type")==="equipment",w=m.watch("driver_included"),_=m.watch("security_personnel_included"),C=(h==null?void 0:h.max_photos_per_listing)||3,E=d.length/C*100;return r.jsxs(Y,{className:"bg-gradient-card border-primary/20",children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(xa,{className:"h-6 w-6 text-primary"}),"List Your ",b?"Equipment":"Vehicle"," for Rent"]}),r.jsx(Nt,{children:"Fill in the details to create your rental listing"}),h&&r.jsxs("div",{className:"mt-4 p-4 bg-muted rounded-lg",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:["Listings: ",h.current_listings," / ",h.max_listings]}),r.jsx(te,{variant:h.can_create_listing?"default":"destructive",children:h.subscription_tier})]}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:["Photos: ",d.length," / ",C]}),r.jsxs("span",{children:[C," per listing"]})]}),r.jsx(gx,{value:E,className:"h-2 mt-2"})]})]}),r.jsx(X,{children:r.jsx(tf,{...m,children:r.jsxs("form",{onSubmit:m.handleSubmit(g),className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:m.control,name:"title",render:({field:N})=>{var k;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Listing Title *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"e.g., 2020 Toyota Camry - Airport Pickup",maxLength:zi.TITLE,...N,required:!0})}),r.jsxs(Pr,{children:[((k=N.value)==null?void 0:k.length)||0," / ",zi.TITLE]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:m.control,name:"listing_type",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Type *"}),r.jsxs(mt,{onValueChange:N.onChange,defaultValue:N.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{})})}),r.jsx(ht,{children:dNe.map(k=>r.jsx(Ne,{value:k.value,children:k.label},k.value))})]}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:m.control,name:"description",render:({field:N})=>{var k;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Description *"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Describe your vehicle/equipment, its features, and rental conditions...",className:"min-h-[120px]",maxLength:zi.DESCRIPTION,...N,required:!0})}),r.jsxs(Pr,{children:[((k=N.value)==null?void 0:k.length)||0," / ",zi.DESCRIPTION]}),r.jsx(Qe,{})]})}})]}),b?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Equipment Details"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:m.control,name:"equipment_category",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Category"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"e.g., Construction, Farming, Industrial",...N})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"condition",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Condition *"}),r.jsxs(mt,{onValueChange:N.onChange,defaultValue:N.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{})})}),r.jsx(ht,{children:a8.map(k=>r.jsx(Ne,{value:k.value,children:k.label},k.value))})]}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:m.control,name:"specifications",render:({field:N})=>{var k;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Specifications"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Technical specifications, capacity, power, etc.",maxLength:zi.SPECIFICATIONS,...
897N})}),r.jsxs(Pr,{children:[((k=N.value)==null?void 0:k.length)||0," / ",zi.SPECIFICATIONS]}),r.jsx(Qe,{})]})}})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Vehicle Details"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{control:m.control,name:"make",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Make *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Toyota",maxLength:zi.MAKE,...N,required:!0})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"model",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Model *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Camry",maxLength:zi.MODEL,...N,required:!0})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"year",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Year *"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"2020",min:"1990",max:new Date().getFullYear()+1,...N,onChange:k=>N.onChange(Number(k.target.value)),required:!0})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"seats",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Seats *"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"5",min:"1",max:"50",...N,onChange:k=>N.onChange(Number(k.target.value)),required:!0})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{control:m.control,name:"transmission",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Transmission *"}),r.jsxs(mt,{onValueChange:N.onChange,defaultValue:N.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{})})}),r.jsx(ht,{children:uNe.map(k=>r.jsx(Ne,{value:k.value,children:k.label},k.value))})]}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"fuel_type",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Fuel Type *"}),r.jsxs(mt,{onValueChange:N.onChange,defaultValue:N.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{})})}),r.jsx(ht,{children:hNe.map(k=>r.jsx(Ne,{value:k.value,children:k.label},k.value))})]}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"condition",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Condition *"}),r.jsxs(mt,{onValueChange:N.onChange,defaultValue:N.value,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{})})}),r.jsx(ht,{children:a8.map(k=>r.jsx(Ne,{value:k.value,children:k.label},k.value))})]}),r.jsx(Qe,{})]})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(Tn,{className:"h-5 w-5"}),"Pricing (in Naira)"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{control:m.control,name:"daily_rate",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Daily Rate *"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"25000",min:"0",...N,onChange:k=>N.onChange(Number(k.target.value)),required:!0})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"weekly_rate",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Weekly Rate"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"150000",min:"0",...N,onChange:k=>N.onChange(Number(k.target.value)||void 0)})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"monthly_rate",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Monthly Rate"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"500000",min:"0",...N,onChange:k=>N.onChange(Number(k.target.value)||void 0)})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"security_deposit",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Security Deposit"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"50000",min:"0",...N,onChange:k=>N.onChange(Number(k.target.value)||void 0)})}),r.jsx(Qe,{})]})})]})]}),r.jsxs("div",{className:"space-y-4 p-4 bg-muted rounded-lg",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(fn,{className:"h-5 w-5"}),"Nigerian Rental Options"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ze,{control:m.control,name:"driver_included",render:({field:N})=>r.jsxs(Ke,{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs(nt,{className:"text-base flex items-center gap-2",children:[r.jsx(Yr,{className:"h-4 w-4"}),"Include Driver"]}),r.jsx(Pr,{children:"Offer rental with professional driver"})]}),r.jsx(it,{children:r.jsx(Ro,{checked:N.value,onCheckedChange:N.onChange})})]})}),w&&r.jsx(Ze,{control:m.control,name:"driver_daily_rate",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Driver Daily Rate (â¦)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"5000",min:"0",...N,onChange:k=>N.onChange(Number(k.target.value)||void 0)})}),r.jsx(Pr,{children:"Additional daily charge for driver"}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ze,{control:m.control,name:"security_personnel_included",render:({field:N})=>r.jsxs(Ke,{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs(nt,{className:"text-base flex items-center gap-2",children:[r.jsx(fn,{className:"h-4 w-4"}),"Security Personnel"]}),r.jsx(Pr,{children:"Offer rental with security escort"})]}),r.jsx(it,{children:r.jsx(Ro,{checked:N.value,onCheckedChange:N.onChange})})]})}),_&&r.jsx(Ze,{control:m.control,name:"security_personnel_daily_rate",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Security Daily Rate (â¦)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"3000",min:"0",...N,onChange:k=>N.onChange(Number(k.target.value)||void 0)})}),r.jsx(Pr,{children:"Additional daily charge for security"}),r.jsx(Qe,{})]})})]})]}),r.jsx(Ze,{control:m.control,name:"insurance_included",render:({field:N})=>r.jsxs(Ke,{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(nt,{className:"text-base",children:"Insurance Included"}),r.jsx(Pr,{children:"Comprehensive insurance coverage included in price"})]}),r.jsx(it,{children:r.jsx(Ro,{checked:N.value,onCheckedChange:N.onChange})})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(no,{className:"h-5 w-5"}),"Photos (",d.length," / ",C,")"]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[d.map((N,k)=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:N,alt:`Photo ${k+1}`,className:"w-full h-32 object-cover rounded-lg"}),r.jsx(W,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>v(N),children:"â"}),k===0&&r.jsx(te,{className:"absolute bottom-2 left-2",children:"Cover"})]},k)),d.length<C&&r.jsxs("label",{className:"border-2 border-dashed rounded-lg p-4 hover:border-primary transition-colors cursor-pointer flex flex-col items-center justify-center h-32",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:p,disabled:l}),l?r.jsx(yt,{className:"h-8 w-8 animate-spin text-muted-foreground"}):r.jsxs(r.Fragment,{children:[r.jsx(Jn,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground text-center",children:"Upload Photos"})]})]})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground bg-muted p-3 rounded-lg",children:[r.jsx(tc,{
897className:"h-4 w-4 mt-0.5 flex-shrink-0"}),r.jsxs("p",{children:["First photo will be the cover image. Maximum ",C," photos allowed with your ",(h==null?void 0:h.subscription_tier)||"free"," plan. Upgrade for more!"]})]})]}),r.jsx(Ze,{control:m.control,name:"features",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Features & Amenities"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"air conditioning, gps, bluetooth, backup camera, usb charging",...N})}),r.jsx(Pr,{children:"Comma-separated list of features"}),r.jsx(Qe,{})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(At,{className:"h-5 w-5"}),"Location & Pickup"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{control:m.control,name:"country_code",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(dc,{value:N.value,onValueChange:N.onChange,label:"Country",required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"state",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(uc,{countryCode:m.watch("country_code"),value:N.value,onChange:N.onChange,required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"city",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"City *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Lagos",maxLength:100,...N,required:!0})}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:m.control,name:"pickup_location",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Pickup Location *"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"e.g., Murtala Muhammed Airport, Ikeja, Lagos",maxLength:zi.PICKUP_LOCATION,...N,required:!0})}),r.jsx(Pr,{children:"Where customers can pick up the vehicle/equipment"}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Contact Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{control:m.control,name:"contact_phone",render:({field:N})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),"Phone *"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"+234 803 456 7890",maxLength:zi.PHONE,...N,required:!0})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"contact_whatsapp",render:({field:N})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(dl,{className:"h-4 w-4"}),"WhatsApp"]}),r.jsx(it,{children:r.jsx(ge,{placeholder:"+234 803 456 7890",maxLength:zi.PHONE,...N})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"contact_email",render:({field:N})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-4 w-4"}),"Email"]}),r.jsx(it,{children:r.jsx(ge,{type:"email",placeholder:"[email protected]",maxLength:zi.EMAIL,...N})}),r.jsx(Qe,{})]})})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Rental Terms"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:m.control,name:"minimum_rental_days",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Minimum Rental Days *"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"1",min:"1",...N,onChange:k=>N.onChange(Number(k.target.value)),required:!0})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:m.control,name:"maximum_rental_days",render:({field:N})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Maximum Rental Days"}),r.jsx(it,{children:r.jsx(ge,{type:"number",placeholder:"30",min:"1",...N,onChange:k=>N.onChange(Number(k.target.value)||void 0)})}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:m.control,name:"rental_terms",render:({field:N})=>{var k;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Rental Terms & Conditions"}),r.jsx(it,{children:r.jsx(ir,{placeholder:"Age requirements, license requirements, fuel policy, damage policy, etc.",className:"min-h-[100px]",maxLength:zi.RENTAL_TERMS,...N})}),r.jsxs(Pr,{children:[((k=N.value)==null?void 0:k.length)||0," / ",zi.RENTAL_TERMS]}),r.jsx(Qe,{})]})}})]}),r.jsx(W,{type:"submit",className:"w-full bg-gradient-hero hover:opacity-90",size:"lg",disabled:i||d.length===0,children:i?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Listing..."]}
897):r.jsxs(r.Fragment,{children:[r.jsx(xa,{className:"mr-2 h-5 w-5"}),"Create Listing"]})}),d.length===0&&r.jsx("p",{className:"text-sm text-center text-destructive",children:"Please upload at least one photo to continue"})]})})})]})}const fNe=()=>{const{user:e}=bt(),[t,n]=j.useState("event");return e?r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("section",{className:"py-20 px-4 bg-gradient-to-br from-background via-background to-primary/5",children:r.jsxs("div",{className:"container mx-auto text-center",children:[r.jsx("h1",{className:"text-4xl md:text-6xl font-bold mb-6 bg-gradient-hero bg-clip-text text-transparent",children:"Create & Share"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8 max-w-2xl mx-auto",children:"Bring your ideas to life on Nigeria's premier content platform. Create events, list products, properties, cars, restaurants, artisans, or post jobs for the community."})]})}),r.jsx("section",{className:"py-16 px-4",children:r.jsx("div",{className:"container mx-auto max-w-4xl",children:r.jsxs(Kr,{value:t,onValueChange:n,className:"space-y-8",children:[r.jsxs(Hr,{className:"w-full grid grid-cols-2 md:grid-cols-4 gap-2 bg-gradient-card border border-primary/20 p-2 h-auto",children:[r.jsxs(Re,{value:"event",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(Xt,{className:"h-4 w-4"}),"Create Event"]}),r.jsxs(Re,{value:"product",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(Qc,{className:"h-4 w-4"}),"Add Product"]}),r.jsxs(Re,{value:"property",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(en,{className:"h-4 w-4"}),"List Property"]}),r.jsxs(Re,{value:"content",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(Jn,{className:"h-4 w-4"}),"Submit Content"]}),r.jsxs(Re,{value:"restaurant",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(Vh,{className:"h-4 w-4"}),"Restaurant"]}),r.jsxs(Re,{value:"rentalcar",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(xa,{className:"h-4 w-4"}),"Rental Car"]}),r.jsxs(Re,{value:"artisan",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(Pi,{className:"h-4 w-4"}),"Artisan"]}),r.jsxs(Re,{value:"classified",className:"flex items-center justify-center gap-2 px-3 py-3 text-sm font-medium data-[state=active]:bg-gradient-hero data-[state=active]:text-background hover:bg-primary/10 transition-colors",children:[r.jsx(fr,{className:"h-4 w-4"}),"Post Job"]})]}),r.jsx(Be,{value:"event",className:"space-y-6",children:r.jsx(ES,{onSuccess:()=>{}})}),r.jsx(Be,{value:"product",className:"space-y-6",children:r.jsx(a6,{onSuccess:()=>{}})}),r.jsx(Be,{value:"property",className:"space-y-6",children:r.jsx(p_,{onSuccess:()=>{}})}),r.jsx(Be,{value:"content",className:"space-y-6",children:r.jsx(Eg,{onSuccess:()=>{}})}),r.jsx(Be,{value:"restaurant",className:"space-y-6",children:r.jsx(i6,{onSuccess:()=>{}})}),r.jsx(Be,{value:"rentalcar",className:"space-y-6",children:r.jsx(g_,{onSuccess:()=>{}})}),r.jsx(Be,{value:"artisan",className:"space-y-6",children:r.jsx(m_,{onSuccess:()=>{}})}),r.jsx(Be,{value:"classified",className:"space-y-6",children:r.jsx(TS,{})})]})})})]}):r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"text-center space-y-6 max-w-md mx-auto px-4",children:[r.jsx("div",{className:"mx-auto h-16 w-16 bg-gradient-hero rounded-full flex items-center justify-center",children:r.jsx(xs,{className:"h-8 w-8 text-background"})}),r.jsx("h1",{className:"text-2xl font-bold",children:"Login Required"}),r.jsx("p",{className:"text-muted-foreground",children:"You need to be logged in to create content on Naija.com"}),r.jsx(Vt,{to:"/auth",children:r.jsx(W,{className:"bg-gradient-hero hover:opacity-90",children:"Sign In"})})]})})};function mNe(){return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Privacy Policy -
897Naija.com",description:"Learn how Naija.com protects your privacy and handles your personal data. Our comprehensive privacy policy explains data collection, usage, and your rights.",canonical:"/privacy-policy",structuredData:{"@context":"https://schema.org","@type":"WebPage",name:"Privacy Policy",description:"Naija.com Privacy Policy - Data Protection and User Privacy Rights",url:`${window.location.origin}/privacy-policy`,lastReviewed:"2024-12-05",inLanguage:"en-NG"}}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"container mx-auto py-8 px-4 max-w-4xl",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[r.jsx(fn,{className:"h-8 w-8 text-primary"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl md:text-4xl font-bold",children:"Privacy Policy"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Last updated: December 5, 2024"})]})]}),r.jsx(Y,{className:"mb-6",children:r.jsx(X,{className:"p-6",children:r.jsx("p",{className:"text-lg leading-relaxed",children:"At Naija.com, we respect your privacy and are committed to protecting your personal data. This privacy policy explains how we collect, use, and safeguard your information when you use our platform."})})}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx($r,{className:"h-5 w-5"}),"Information We Collect"]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Personal Information"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Name, email address, and contact information"}),r.jsx("li",{children:"Profile information and biographical details"}),r.jsx("li",{children:"Payment information for transactions"}),r.jsx("li",{children:"Identity verification documents (KYC)"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Usage Information"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Content you create, upload, or share"}),r.jsx("li",{children:"Interaction data and engagement metrics"}),r.jsx("li",{children:"Device information and IP addresses"}),r.jsx("li",{children:"Cookies and similar tracking technologies"})]})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"How We Use Your Information"})}),r.jsx(X,{children:r.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[r.jsx("li",{children:"To provide and improve our platform services"}),r.jsx("li",{children:"To process payments and transactions securely"}),r.jsx("li",{children:"To verify identity and prevent fraud"}),r.jsx("li",{children:"To send important updates and marketing communications"}),r.jsx("li",{children:"To personalize your experience and content recommendations"}),r.jsx("li",{children:"To comply with legal obligations and resolve disputes"})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Data Sharing and Disclosure"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsx("p",{children:"We do not sell your personal data. We may share information in these circumstances:"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"With service providers who help operate our platform"}),r.jsx("li",{children:"When required by law or to protect our legal rights"}),r.jsx("li",{children:"In connection with business transfers or acquisitions"}),r.jsx("li",{children:"With your explicit consent for specific purposes"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Your Rights and Choices"})}),r.jsx(X,{children:r.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[r.jsx("li",{children:"Access and review your personal data"}),r.jsx("li",{children:"Request corrections to inaccurate information"}),r.jsx("li",{children:"Delete your account and associated data"}),r.jsx("li",{children:"Opt-out of marketing communications"}),r.jsx("li",{children:"Data portability and export options"}),r.jsx("li",{children:"Object to certain processing activities"})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Data Security"})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"We implement industry-standard security measures to protect your data, including:"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Encryption of data in transit and at rest"}),r.jsx("li",{children:"Regular security audits and vulnerability assessments"}),r.jsx("li",{children:"Access controls and authentication protocols"}),r.jsx("li",{children:"Incident response and breach notification procedures"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"International Data Transfers"})}),r.jsx(X,{children:r.jsx("p",{className:"text-muted-foreground",children:"Your data may be processed in Nigeria and other countries where our service providers operate. We ensure appropriate safeguards are in place for international transfers in accordance with applicable data protection laws."})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-5 w-5"}),"Contact Us"]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"If you have questions about this privacy policy or wish to exercise your rights, contact us:"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-4 w-4"}),r.jsx("span",{children:"[email protected]"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),r.jsx("span",{children:"+234 (0) 800-NAIJA-01"})]})]})]})]})]})]})})]})}function pNe(){return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Terms of Service - Naija.com",description:"Read Naija.com's Terms of Service covering user agreements, content policies, and platform rules for Nigerian creators, vendors, and users.",canonical:"/terms-of-service",structuredData:{"@context":"https://schema.org","@type":"WebPage",name:"Terms of Service",description:"Naija.com Terms of Service - User Agreement and Platform Rules",url:`${window.location.origin}/terms-of-service`,lastReviewed:"2024-12-05",inLanguage:"en-NG"}}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"container mx-auto py-8 px-4 max-w-4xl",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[r.jsx(Zie,{className:"h-8 w-8 text-primary"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl md:text-4xl font-bold",children:"Terms of Service"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Last updated: December 5, 2024"})]})]}),r.jsx(Y,{className:"mb-6",children:r.jsx(X,{className:"p-6",children:r.jsx("p",{className:"text-lg leading-relaxed",children:"Welcome to Naija.com! By using our platform, you agree to these Terms of Service. Please read them carefully as they govern your use of our services."})})}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Yr,{className:"h-5 w-5"}),"Acceptance of Terms"]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"By accessing or using Naija.com, you agree to be bound by these Terms of Service and our Privacy Policy. If you do not agree to these terms, you may
897not use our services."}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"You must be at least 18 years old to use our platform"}),r.jsx("li",{children:"You represent that you have the legal authority to enter into this agreement"}),r.jsx("li",{children:"These terms may be updated from time to time with notice"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Platform Services"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Content Platform"}),r.jsx("p",{className:"text-muted-foreground",children:"Create, share, and discover Nigerian content including videos, articles, music, and educational materials."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Event Management"}),r.jsx("p",{className:"text-muted-foreground",children:"List, promote, and sell tickets for events across Nigeria."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Marketplace"}),r.jsx("p",{className:"text-muted-foreground",children:"Buy and sell products, with support for both physical and digital goods."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Property Bookings"}),r.jsx("p",{className:"text-muted-foreground",children:"List and book accommodations across Nigerian cities."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"User Responsibilities"})}),r.jsx(X,{children:r.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[r.jsx("li",{children:"Provide accurate and complete account information"}),r.jsx("li",{children:"Maintain the security of your account credentials"}),r.jsx("li",{children:"Comply with all applicable laws and regulations"}),r.jsx("li",{children:"Respect intellectual property rights of others"}),r.jsx("li",{children:"Use the platform in good faith and not for fraudulent purposes"}),r.jsx("li",{children:"Report violations of these terms or illegal activities"})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Content Policies"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Prohibited Content"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Hate speech, harassment, or discriminatory content"}),r.jsx("li",{children:"Violence, explicit sexual content, or illegal activities"}),r.jsx("li",{children:"Spam, misleading information, or fraudulent content"}),r.jsx("li",{children:"Content that infringes intellectual property rights"}),r.jsx("li",{children:"Personal information without consent"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Content Ownership"}),r.jsx("p",{className:"text-muted-foreground",children:"You retain ownership of content you create, but grant Naija.com a license to host, display, and distribute your content as necessary to provide our services."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Financial Terms"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Platform Fees"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Transaction fees apply to sales and bookings"}),r.jsx("li",{children:"Fee structure varies by service type (content, events, marketplace, bookings)"}),r.jsx("li",{children:"Fees are clearly displayed before transaction completion"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Payment Processing"}),r.jsx("p",{className:"text-muted-foreground",children:"All payments are processed securely through our payment partners. You authorize us to charge your payment method for applicable fees."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Refund Policy"}),r.jsx("p",{className:"text-muted-foreground",children:"Refunds are subject to the specific policies of each service category and seller/organizer policies."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(fn,{className:"h-5 w-5"}),"Liability and Disclaimers"]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Platform Disclaimer"}),r.jsx("p",{className:"text-muted-foreground",children:"Naija.com provides a platform for users to interact but is not responsible for the content, quality, or legality of listings, or the ability of users to fulfill transactions."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Limitation of Liability"}),r.jsx("p",{className:"text-muted-foreground",children:"Our liability is limited to the maximum extent permitted by law. We are not liable for indirect, incidental, or consequential damages."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Dispute Resolution"})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"Disputes should first be reported through our platform. For legal disputes:"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Nigerian law governs these terms"}),r.jsx("li",{children:"Lagos State courts have jurisdiction over disputes"}),r.jsx("li",{children:"Mediation is encouraged before formal legal proceedings"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Account Termination"})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"We may suspend or terminate accounts for violations of these terms. You may also delete your account at any time."}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"We will provide notice when possible"}),r.jsx("li",{children:"Outstanding financial obligations must be resolved"}),r.jsx("li",{children:"Data deletion follows our Privacy Policy"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Ca,{className:"h-5 w-5"}),"Contact Information"]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"Questions about these Terms of Service? Contact us:"}),r.jsxs("div",{className:"space-y-1 text-sm",children:[r.jsx("p",{children:"Email: [email protected]"}),r.jsx("p",{children:"Phone: +234 (0) 800-NAIJA-01"}),r.jsx("p",{children:"Address: Lagos, Nigeria"})]})]})]})]})]})})]})}function gNe(){return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Community Guidelines - Naija.com",description:"Learn about Naija.com's community standards for respectful interaction, content creation, and building a positive Nigerian creative community.",canonical:"/community-guidelines",structuredData:{"@context":"https://schema.org","@type":"WebPage",name:"Community Guidelines",description:"Naija.com Community Guidelines - Standards for Respectful Community Interaction",url:`${window.location.origin}/community-guidelines`,lastReviewed:"2024-12-05",inLanguage:"en-NG"}}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"container mx-auto py-8 px-4 max-w-4xl",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[r.jsx(Th,{className:"h-8 w-8 text-primary"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl md:text-4xl font-bold",children:"Community Guidelines"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Building a respectful and vibrant Nigerian creative community"})]})]}),r.jsx(Y,{className:"mb-6 bg-gradient-to-r from-primary/10 to-secondary/10 border-primary/20",children:r.jsx(X,{className:"p-6",children:r.jsx("p",{className:"text-lg leading-relaxed",children:"Naija.com is a platform for all Nigerians to share their creativity, culture, and stories. These guidelines help us maintain a safe, inclusive, and inspiring community for everyone."})})}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Yr,{className:"h-5 w-5"}),"Our Core Values"]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-2 flex items-center gap-2",children:[r.jsx(er,{className:"h-4 w-4 text-green-600"}),"Unity in Diversity"]}),r.jsx("p",{className:"text-muted-foreground",children:"We celebrate Nigeria's rich cultural diversity. All ethnicities, religions, and regions are welcome."})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-2 flex items-center gap-2",children:[r.jsx(er,{className:"h-4 w-4 text-green-600"}),"Creative Excellence"]}),r.jsx("p",{className:"text-muted-foreground",children:"We encourage high-quality, original content that showcases Nigerian talent and creativity."})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-2 flex items-center gap-2",children:[r.jsx(er,{className:"h-4 w-4 text-green-600"}),"Mutual Respect"]}),r.jsx("p",{className:"text-muted-foreground",children:"Treat all community members with dignity and respect, regardless of background or beliefs."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(er,{className:"h-5 w-5 text-green-600"}),"Encouraged Content"]})}),r.jsx(X,{children:r.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[r.jsx("li",{children:"Original Nigerian music, art, literature, and performances"}),r.jsx("li",{children:"Educational content about Nigerian history, culture, and languages"}),r.jsx("li",{children:"Positive representation of Nigerian communities and achievements"}),r.jsx("li",{children:"Helpful tutorials, guides, and how-to content"}),r.jsx("li",{children:"Constructive discussions about social and cultural issues"}),r.jsx("li",{children:"Authentic products and services from Nigerian entrepreneurs"}),r.jsx("li",{children:"Events that bring communities together"}),r.jsx("li",{children:"Inspirational stories and success journeys"})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-5 w-5 text-red-500"}),"Prohibited Content"]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2 text-red-700",children:"Hate Speech and Discrimination"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Ethnic, religious, or regional discrimination"}),r.jsx("li",{children:"Gender-based harassment or discrimination"}),r.jsx("li",{children:"Hate speech targeting any group or individual"}),r.jsx("li",{children:"Content promoting violence or harm"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2 text-red-700",children:"Inappropriate Content"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Explicit sexual content or nudity"}),r.jsx("li",{children:"Graphic violence or disturbing imagery"}),r.jsx("li",{children:"Content glamorizing illegal drug use"}),r.jsx("li",{children:"Self-harm or suicide-related content"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2 text-red-700",children:"Fraudulent Activities"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Scams, fraudulent schemes, or get-rich-quick schemes"}),r.jsx("li",{children:"Selling counterfeit or stolen goods"}),r.jsx("li",{children:"Misleading information about products or services"}),r.jsx("li",{children:"Impersonation of others or fake accounts"})]})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Respectful Communication"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"In Comments and Messages"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Be constructive in criticism and feedback"}),r.jsx("li",{children:"Avoid personal attacks or insults"}),r.jsx("li",{children:"Respect different opinions and perspectives"}),r.jsx("li",{children:"Use appropriate language in all interactions"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Business Interactions"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Be honest in product descriptions and pricing"}),r.jsx("li",{children:"Fulfill commitments and deliver as promised"}),r.jsx("li",{children:"Respond promptly to customer inquiries"}),r.jsx("li",{children:"Handle disputes professionally and fairly"})]})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Content Quality Standards"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Original Content"}),r.jsx("p",{className:"text-muted-foreground",children:"Share content you've created or have permission to use. Always credit original creators when sharing their work."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Accurate Information"}),r.jsx("p",{className:"text-muted-foreground",children:"Verify facts before sharing news or educational content. Clearly label opinions and personal experiences."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Appropriate Categorization"}),r.jsx("p",{className:"text-muted-foreground",children:"Use correct categories and tags to help users discover your content appropriately."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(fn,{className:"h-5 w-5"}),"Reporting and Moderation"]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"How to Report"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"Use the report button on any content that violates guidelines"}),r.jsx("li",{children:"Provide specific details about the violation"}),r.jsx("li",{children:"Report harassment or threats immediately"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Our Response"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"All reports are reviewed within 24 hours"}),r.jsx("li",{children:"Violations may result in content removal or account suspension"}),r.jsx("li",{children:"Serious violations may lead to permanent bans"}),r.jsx("li",{children:"Appeals process available for disputed actions"})]})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Supporting Nigerian Creators"})}),r.jsx(X,{children:r.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[r.jsx("li",{children:"Engage meaningfully with content through likes, comments, and shares"}),r.jsx("li",{children:"Support local businesses and entrepreneurs on the marketplace"}),r.jsx("li",{children:"Attend events and promote positive community activities"}),r.jsx("li",{children:"Collaborate with fellow creators for mutual growth"}),r.jsx("li",{children:"Provide constructive feedback to help creators improve"}),r.jsx("li",{children:"Share resources and opportunities within the community"})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Consequences for Violations"})}),r.jsx(X,{className:"space-y-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"text-center p-4 border rounded-lg",children:[r.jsx(Oo,{className:"h-8 w-8 text-yellow-500 mx-auto mb-2"}),r.jsx("h3",{className:"font-semibold text-yellow-700",children:"Warning"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"First-time minor violations"})]}),r.jsxs("div",{className:"text-center p-4 border rounded-lg",children:[r.jsx(fn,{clas
897sName:"h-8 w-8 text-orange-500 mx-auto mb-2"}),r.jsx("h3",{className:"font-semibold text-orange-700",children:"Suspension"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Repeated or serious violations"})]}),r.jsxs("div",{className:"text-center p-4 border rounded-lg",children:[r.jsx(Oo,{className:"h-8 w-8 text-red-500 mx-auto mb-2"}),r.jsx("h3",{className:"font-semibold text-red-700",children:"Permanent Ban"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Severe or repeated violations"})]})]})})]}),r.jsx(Y,{className:"bg-gradient-to-r from-green-50 to-blue-50 border-green-200",children:r.jsxs(X,{className:"p-6",children:[r.jsx("h3",{className:"font-semibold text-lg mb-3 text-green-800",children:"Questions or Concerns?"}),r.jsx("p",{className:"text-green-700 mb-4",children:"We're here to help! If you have questions about these guidelines or need to report an issue:"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsx("p",{children:"Email: [email protected]"}),r.jsx("p",{children:"Report through the platform's report feature"}),r.jsx("p",{children:"Contact our support team via the help center"})]})]})})]})]})})]})}function xNe(){return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Cookie Policy - Naija.com",description:"Learn about how Naija.com uses cookies and similar technologies to enhance your experience on our Nigerian creative platform.",canonical:"/cookie-policy",structuredData:{"@context":"https://schema.org","@type":"WebPage",name:"Cookie Policy",description:"Naija.com Cookie Policy - How We Use Cookies and Tracking Technologies",url:`${window.location.origin}/cookie-policy`,lastReviewed:"2024-12-05",inLanguage:"en-NG"}}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"container mx-auto py-8 px-4 max-w-4xl",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[r.jsx(Iie,{className:"h-8 w-8 text-primary"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl md:text-4xl font-bold",children:"Cookie Policy"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Last updated: December 5, 2024"})]})]}),r.jsx(Y,{className:"mb-6",children:r.jsx(X,{className:"p-6",children:r.jsx("p",{className:"text-lg leading-relaxed",children:"This Cookie Policy explains how Naija.com uses cookies and similar technologies to recognize you when you visit our platform. It explains what these technologies are and why we use them, as well as your rights to control our use of them."})})}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"What Are Cookies?"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Cookies are small data files that are placed on your computer or mobile device when you visit a website. Cookies are widely used by website owners to make their websites work, or to work more efficiently, as well as to provide reporting information."}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Types of Cookies"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Session Cookies:"})," Temporary cookies that expire when you close your browser"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Persistent Cookies:"})," Cookies that remain on your device for a set period"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"First-party Cookies:"})," Set directly by Naija.com"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Third-party Cookies:"})," Set by external services we use"]})]})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"How We Use Cookies"})}),r.jsx(X,{className:"space-y-6",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[r.jsxs(Y,{className:"border border-blue-200 bg-blue-50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"text-base flex items-center gap-2",children:[r.jsx(FN,{className:"h-5 w-5"}),"Essential Cookies"]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Necessary for the website to function properly. Cannot be disabled."}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-muted-foreground",children:[r.jsx("li",{children:"Authentication and security"}),r.jsx("li",{children:"Shopping cart and checkout"}),r.jsx("li",{children:"User preferences"}),r.jsx("li",{children:"Load balancing"})]})]})]}),r.jsxs(Y,{className:"border border-green-200 bg-green-50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"text-base flex items-center gap-2",children:[r.jsx(Sie,{className:"h-5 w-5"}
897),"Analytics Cookies"]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Help us understand how visitors interact with our website."}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-muted-foreground",children:[r.jsx("li",{children:"Page views and traffic patterns"}),r.jsx("li",{children:"User behavior analysis"}),r.jsx("li",{children:"Performance monitoring"}),r.jsx("li",{children:"Error tracking"})]})]})]}),r.jsxs(Y,{className:"border border-purple-200 bg-purple-50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"text-base flex items-center gap-2",children:[r.jsx(Cr,{className:"h-5 w-5"}),"Marketing Cookies"]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Used to track visitors across websites for marketing purposes."}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-muted-foreground",children:[r.jsx("li",{children:"Personalized advertisements"}),r.jsx("li",{children:"Social media integration"}),r.jsx("li",{children:"Marketing campaign tracking"}),r.jsx("li",{children:"Retargeting"})]})]})]}),r.jsxs(Y,{className:"border border-orange-200 bg-orange-50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"text-base flex items-center gap-2",children:[r.jsx(FN,{className:"h-5 w-5"}),"Functional Cookies"]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Enable enhanced functionality and personalization."}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-muted-foreground",children:[r.jsx("li",{children:"Language preferences"}),r.jsx("li",{children:"Region selection"}),r.jsx("li",{children:"Theme preferences"}),r.jsx("li",{children:"Accessibility settings"})]})]})]})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Specific Cookies We Use"})}),r.jsx(X,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-2",children:"Cookie Name"}),r.jsx("th",{className:"text-left p-2",children:"Purpose"}),r.jsx("th",{className:"text-left p-2",children:"Duration"}),r.jsx("th",{className:"text-left p-2",children:"Type"})]})}),r.jsxs("tbody",{children:[r.jsxs("tr",{className:"border-b",children:[r.jsx("td",{className:"p-2 font-mono text-xs",children:"naija_session"}),r.jsx("td",{className:"p-2",children:"User authentication"}),r.jsx("td",{className:"p-2",children:"Session"}),r.jsx("td",{className:"p-2",children:"Essential"})]}),r.jsxs("tr",{className:"border-b",children:[r.jsx("td",{className:"p-2 font-mono text-xs",children:"user_preferences"}),r.jsx("td",{className:"p-2",children:"Store user settings"}),r.jsx("td",{className:"p-2",children:"1 year"}),r.jsx("td",{className:"p-2",children:"Functional"})]}),r.jsxs("tr",{className:"border-b",children:[r.jsx("td",{className:"p-2 font-mono text-xs",children:"analytics_id"}),r.jsx("td",{className:"p-2",children:"Track user behavior"}),r.jsx("td",{className:"p-2",children:"2 years"}),r.jsx("td",{className:"p-2",children:"Analytics"})]}),r.jsxs("tr",{className:"border-b",children:[r.jsx("td",{className:"p-2 font-mono text-xs",children:"marketing_consent"}),r.jsx("td",{className:"p-2",children:"Marketing permissions"}),r.jsx("td",{className:"p-2",children:"1 year"}),r.jsx("td",{className:"p-2",children:"Marketing"})]})]})]})})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Third-Party Services"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Google Analytics"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"We use Google Analytics to understand how users interact with our site. Google may collect data about your visits to this and other websites."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Payment Processors"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Paystack and Stripe may set cookies during the payment process to ensure secure transactions."})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Social Media Plugins"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Social media buttons may place cookies to enable sharing and track engagement."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Your Cookie Choices"})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Browser Settings"}),r.jsx("p",{className:"text-muted-foreground mb-2",children:"Most browsers allow you to control cookies through their settings:"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground text-sm",children:[r.jsx("li",{children:"Block all cookies"}),r.jsx("li",{children:"Block third-party cookies only"}),r.jsx("li",{children:"Clear cookies when you close your browser"}),r.jsx("li",{children:"Receive notifications when cookies are set"})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Opt-Out Links"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground text-sm",children:[r.jsxs("li",{children:["Google Analytics: ",r.jsx("a",{href:"https://tools.google.com/dlpage/gaoptout",className:"text-primary hover:underline",children:"Opt-out"})]}),r.jsxs("li",{children:["Facebook Pixel: ",r.jsx("a",{href:"https://www.facebook.com/help/568137493302217",className:"text-primary hover:underline",children:"Opt-out"})]})]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Cookie Consent Manager"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"You can manage your cookie preferences through our consent banner or in your account settings."})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Impact of Disabling Cookies"})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"Disabling certain cookies may affect your experience on Naija.com:"}),r.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[r.jsx("li",{children:"You may need to log in repeatedly"}),r.jsx("li",{children:"Your preferences may not be saved"}),r.jsx("li",{children:"Some features may not work properly"}),r.jsx("li",{children:"Content may not be personalized"}),r.jsx("li",{children:"Analytics may not track your usage"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Updates to This Policy"})}),r.jsx(X,{children:r.jsx("p",{className:"text-muted-foreground",children:'We may update this Cookie Policy from time to time to reflect changes in technology, legislation, or our practices. We will notify you of any significant changes by posting the new policy on this page and updating the "Last Updated" date.'})})]}),r.jsx(Y,{className:"bg-gradient-to-r from-blue-50 to-indigo-50 border-blue-200",children:r.jsxs(X,{className:"p-6",children:[r.jsx("h3",{className:"font-semibold text-lg mb-3 text-blue-800",children:"Questions About Cookies?"}),r.jsx("p",{className:"text-blue-700 mb-4",children:"If you have questions about our use of cookies or this Cookie Policy:"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsx("p",{children:"Email: [email protected]"}),r.jsx("p",{children:"Phone: +234 (0) 800-NAIJA-01"}),r.jsx("p",{children:"Visit our Help Center for more information"})]})]})})]})]})})]})}const i8=[{value:"events",label:"Event Tickets",description:"Concert, conference, or event tickets"},{value:"products",label:"Products",description:"Physical or digital products"},{value:"properties",label:"Property Bookings",description:"Hotel, apartment, or property rentals"},{value:"donations",label:"Donations",description:"Charitable or support donations"}],vNe=()=>{var h;const[e,t]=j.useState(1e4),[n,s]=j.useState("events"),{platformFees:a,fetchPlatformFees:i,calculateDisplayFee:o}=u6();j.useEffect(()=>{i()},[]);const l=o(e,n),c=e-l,d=e>0?(l/e*100).toFixed(2):"0",u=f=>new Intl.NumberFormat("en-NG",{style:"currency",currency:"NGN",minimumFractionDigits:0}).format(f);return r.jsxs(Y,{className:"w-full max-w-2xl mx-auto",children:[r.jsxs(Se,{className:"text-center",children:[r.jsxs(Ae,{className:"flex items-center justify-center gap-2",children:[r.jsx(BR,{className:"h-5 w-5"}),"Platform Fee Calculator"]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Calculate platform fees for different transaction types"})]}),r.jsxs(X,{className:"space-y-6",children:[r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"amount",children:"Transaction Amount (â¦)"}
897),r.jsx(ge,{id:"amount",type:"number",value:e,onChange:f=>t(Number(f.target.value)||0),min:"0",step:"100",placeholder:"Enter amount"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"category",children:"Category"}),r.jsxs(mt,{value:n,onValueChange:s,children:[r.jsx(ut,{id:"category",children:r.jsx(pt,{})}),r.jsx(ht,{children:i8.map(f=>r.jsx(Ne,{value:f.value,children:r.jsxs("div",{className:"flex flex-col items-start",children:[r.jsx("span",{children:f.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:f.description})]})},f.value))})]})]})]}),e>0&&r.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[r.jsxs(Y,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1",children:[r.jsx(Tn,{className:"h-4 w-4"}),"Platform Fee"]}),r.jsx("div",{className:"text-2xl font-bold text-destructive",children:u(l)}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[d,"% of transaction"]})]}),r.jsxs(Y,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1",children:[r.jsx(lr,{className:"h-4 w-4"}),"You Receive"]}),r.jsx("div",{className:"text-2xl font-bold text-success",children:u(c)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"After platform fee"})]}),r.jsxs(Y,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1",children:[r.jsx(BR,{className:"h-4 w-4"}),"Total Amount"]}),r.jsx("div",{className:"text-2xl font-bold",children:u(e)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Customer pays"})]})]}),a[n]&&r.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[r.jsxs("h4",{className:"font-semibold mb-2",children:["Fee Structure for ",(h=i8.find(f=>f.value===n))==null?void 0:h.label]}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:"Fee Type:"})," ",a[n].fee_type==="percentage"?"Percentage":"Fixed Amount"]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:"Fee Value:"})," ",a[n].fee_value,a[n].fee_type==="percentage"?"%":""]}),a[n].minimum_fee&&r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:"Minimum Fee:"})," ",u(a[n].minimum_fee)]}),a[n].maximum_fee&&r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:"Maximum Fee:"})," ",u(a[n].maximum_fee)]})]})]})]})]})},yNe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(!0),{fetchPaymentHistory:a}=u6(),{user:i}=bt();j.useEffect(()=>{i&&o()},[i]);const o=async()=>{s(!0);const h=await a();t(h),s(!1)},l=h=>{switch(h){case"paid":case"completed":return r.jsx(er,{className:"h-4 w-4 text-success"});case"failed":case"cancelled":return r.jsx(ya,{className:"h-4 w-4 text-destructive"});case"pending":return r.jsx($r,{className:"h-4 w-4 text-warning"});default:return r.jsx($r,{className:"h-4 w-4 text-muted-foreground"})}},c=h=>{switch(h){case"paid":case"completed":return"bg-success/10 text-success border-success/20";case"failed":case"cancelled":return"bg-destructive/10 text-destructive border-destructive/20";case"pending":return"bg-warning/10 text-warning border-warning/20";default:return"bg-muted/10 text-muted-foreground border-muted/20"}},d=(h,f="NGN")=>new Intl.NumberFormat("en-NG",{style:"currency",currency:f,minimumFractionDigits:0}).format(h),u=h=>new Date(h).toLocaleDateString("en-NG",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return r.jsx("div",{className:"min-h-screen bg-background p-4",children:r.jsxs("div",{className:"container mx-auto max-w-6xl",children:[r.jsxs("div",{className:"mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Payment Center"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage your payments, view transaction history, and understand platform fees"})]}),r.jsxs(Kr,{defaultValue:"calculator",className:"space-y-6",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-3",children:[r.jsx(Re,{value:"calculator",children:"Fee Calculator"}),r.jsx(Re,{value:"transactions",children:"Transaction History"}),r.jsx(Re,{value:"analytics",children:"Payment Analytics"})]}),r.jsx(Be,{value:"calculator",children:r.jsx(vNe,{})}),r.jsx(Be,{value:"transactions",children:r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ae,{children:"Transaction History"}),r.jsx(Nt,{children:"Your recent payment transactions and their status"})]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:o,disabled:n,children:[r.jsx(ms,{className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]})]}),r.jsx(X,{children:n?r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading transactions..."})]}):e.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(ec,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No transactions foun
897d"})]}):r.jsx("div",{className:"space-y-4",children:e.map(h=>r.jsx(Y,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[l(h.payment_status),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:h.transaction_type.replace("_"," ").replace(/\b\w/g,f=>f.toUpperCase())}),r.jsx("p",{className:"text-sm text-muted-foreground",children:h.payment_reference}),r.jsx("p",{className:"text-xs text-muted-foreground",children:u(h.created_at)})]})]}),r.jsxs("div",{className:"text-right",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-semibold",children:d(h.total_amount,h.currency)}),r.jsx(te,{className:c(h.payment_status),children:h.payment_status})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Fee: ",d(h.platform_fee,h.currency)]}),r.jsxs("div",{className:"text-sm font-medium",children:["Net: ",d(h.net_amount,h.currency)]})]})]})},h.id))})})]})}),r.jsx(Be,{value:"analytics",children:r.jsxs("div",{className:"grid gap-6",children:[r.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[r.jsx(Y,{children:r.jsxs(X,{className:"p-6",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1",children:[r.jsx(Tn,{className:"h-4 w-4"}),"Total Spent"]}),r.jsx("div",{className:"text-2xl font-bold",children:d(e.filter(h=>h.payment_status==="paid").reduce((h,f)=>h+Number(f.total_amount),0))})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-6",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1",children:[r.jsx(lr,{className:"h-4 w-4"}),"Platform Fees Paid"]}),r.jsx("div",{className:"text-2xl font-bold",children:d(e.filter(h=>h.payment_status==="paid").reduce((h,f)=>h+Number(f.platform_fee),0))})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-6",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground mb-1",children:[r.jsx(ec,{className:"h-4 w-4"}),"Total Transactions"]}),r.jsx("div",{className:"text-2xl font-bold",children:e.length})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Payment Methods Used"})}),r.jsx(X,{children:r.jsx("div",{className:"space-y-3",children:Object.entries(e.reduce((h,f)=>(h[f.payment_method]=(h[f.payment_method]||0)+1,h),{})).map(([h,f])=>r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"capitalize",children:h}),r.jsxs(te,{variant:"secondary",children:[f," transactions"]})]},h))})})]})]})})]})]})})};function bNe(){const[e,t]=j.useState(!1),[n,s]=j.useState({email:"",password:""}),[a,i]=j.useState({email:"",password:"",fullName:"",confirmPassword:""}),[o,l]=j.useState(""),[c,d]=j.useState(!1),{signIn:u,signUp:h,resetPassword:f,user:m}=bt(),x=zn(),[p]=JT(),v=p.get("mode")==="reset",[g,y]=j.useState(""),[b,w]=j.useState(""),[_,C]=j.useState(!1),[E,N]=j.useState(!1),[k,I]=j.useState(!1),[P,O]=j.useState(!1),[A,R]=j.useState(!1);j.useEffect(()=>{if(m){if(v)return;const se=sessionStorage.getItem("redirectAfterLogin"),F=sessionStorage.getItem("loginPromptMessage");se?(sessionStorage.removeItem("redirectAfterLogin"),sessionStorage.removeItem("loginPromptMessage"),x(se)):x("/"),F&&be({title:"Welcome back!",description:"You've been successfully logged in."})}},[m,x,v]);const L=async se=>{se.preventDefault(),t(!0);try{const{error:F}=await u(n.email,n.password);F&&be({title:"Sign in failed",description:F.message,variant:"destructive"})}finally{t(!1)}},z=async se=>{if(se.preventDefault(),a.password!==a.confirmPassword){be({title:"Passwords don't match",description:"Please make sure your passwords match.",variant:"destructive"});return}t(!0);try{const{error:F}=await h(a.email,a.password,a.fullName);F?F.message.includes("already registered")?be({title:"Account already exists",description:"An account with this email already exists. Please sign in instead.",variant:"destructive"}):be({title:"Sign up failed",description:F.message,variant:"destructive"}):be({title:"Welcome to Naija.com!",description:"Please check your email to verify your account."})}finally{t(!1)}},U=async se=>{se.preventDefault(),t(!0);try{await f(o),be({title:"Password reset email sent! ð§",description:"Please check your email for the password reset link."}),d(!1),l("")}catch(F){be({title:"Error",description:F.message,variant:"destructive"})}finally{t(!1)}},q=(se=>{const F=se.length>=8,V=/[A-Z]/.test(se),Z=/[a-z]/.test(se),de=/[0-9]/.test(se);return{minLength:F,hasUppercase:V,hasLowercase:Z,hasNumber:de,isValid:F&&V&&Z&&de}})(g),ne=async se=>{if(se.preventDefault(),g!==b){be({title:"Passwords don't match",description:"Please make sure both passwords are identical.",variant:"destructive"});return}if(!q.isValid){be({title:"Password too weak",description:"Please meet all password requirements.",variant:"destructive"});return}t(!0);try{const{error:F}=await H.auth.updateUser({password:g});if(F)throw F;be({title:"Password Updated Successfully! ð",description:"Redirecting to your dashboard..."}),setTimeout(()=>x("/dashboard"),1e3)}catch(F){be({title:"Failed to update password",description:F.message,variant:"destructive"})}finally{t(!1)}};return v&&m?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Y,{className:"w-full max-w-md",children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Set Your New Password"}),r.jsx(Nt,{children:"You've verified your email. Please enter a new password."})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"newPassword",children:"New Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(Md,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"newPassword",type:P?"text":"password",value:g,onChange:se=>y(se.target.value),placeholder:"Enter new password",className:"pl-10 pr-10",required:!0}),r.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>O(!P),children:P?r.jsx(Kp,{className:"h-4 w-4"}):r.jsx(Cr,{className:"h-4 w-4"})})]}),g&&r.jsxs("div",{className:"space-y-2 mt-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[q.minLength?r.jsx(er,{className:"h-4 w-4 text-green-500"}):r.jsx(vn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:q.minLength?"text-green-500":"text-muted-foreground",children:"At least 8 characters"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[q.hasUppercase?r.jsx(er,{className:"h-4 w-4 text-green-500"}):r.jsx(vn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:q.hasUppercase?"text-green-500":"text-muted-foreground",children:"One uppercase letter"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[q.hasLowercase?r.jsx(er,{className:"h-4 w-4 text-green-500"}):r.jsx(vn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:q.hasLowercase?"text-green-500":"text-muted-foreground",children:"One lowercase letter"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[q.hasNumber?r.jsx(er,{className:"h-4 w-4 text-green-500"}):r.jsx(vn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:q.hasNumber?"text-green-500":"text-muted-foreground",children:"One number"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"confirmNewPassword",children:"Confirm New Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(Md,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"confirmNewPassword",type:A?"text":"password",value:b,onChange:se=>w(se.target.value),placeholder:"Confirm new password",className:"pl-10 pr-10",required:!0}),r.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>R(!A),children:A?r.jsx(Kp,{className:"h-4 w-4"}):r.jsx(Cr,{className:"h-4 w-4"})})]})]}),r.jsx(W,{type:"submit",className:"w-full",disabled:e,children:e?"Updating Password...":"Update Password"})]})})]})}):r.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:[r.jsxs(Y,{className:"w-full max-w-md",children:[r.jsxs(Se,{className:"text-center",children:[r.jsx(Ae,{className:"text-2xl font-bold text-primary",children:"Welcome to Naija.com"}),r.jsx(Nt,{children:"Create freely. Stream proudly."})]}),r.jsx(X,{children:r.jsxs(Kr,{defaultValue:"signin",className:"space-y-4",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-2",children:[r.jsx(Re,{value:"signin",children:"Sign In"}),r.jsx(Re,{value:"signup",children:"Sign Up"})]}),r.jsx(Be,{value:"signin",className:"space-y-4",children:r.jsxs("form",{onSubmit:L,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"signin-email",children:"Email"}),r.jsxs("div",{className:"relative",children:[r.jsx(Dn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"signin-email",type:"email",placeholder:"[email protected]",value:n.email,onChange:se=>s({...n,email:se.target.value}),className:"pl-10",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"signin-password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(Md,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"signin-password",type:_?"text":"password",placeholder:"Enter your password",value:n.password,onChange:se=>s({...n,password:se.target.value}),className:"pl-10 pr-10",required:!0}),r.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>C(!_),children:_?r.jsx(Kp,{className:"h-4 w-4"}):r.jsx(Cr,{className:"h-4 w-4"})})]})]}),r.jsx(W,{type:"submit",className:"w-full",disabled:e,children:e?"Signing in...":"Sign In"}),r.jsx("div",{className:"text-center",children:r.jsx("button",{type:"button",onClick:()=>d(!0),className:"text-sm text-primary hover:underline",children:"Forgot your password?"})})]})}),r.jsx(Be,{value:"signup",className:"space-y-4",children:r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"signup-name",children:"Full Name"}),r.jsxs("div",{className:"relative",children:[r.jsx(TT,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"signup-name",type:"text",placeholder:"Enter your full name",value:a.fullName,onChange:se=>i({...a,fullName:se.target.value}),className:"pl-10",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"signup-email",children:"Email"}),r.jsxs("div",{className:"relative",children:[r.jsx(Dn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"signup-email",type:"email",placeholder:"[email protected]",value:a.email,onChange:se=>i({...a,email:se.target.value}),className:"pl-10",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"signup-password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(Md,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"signup-password",type:E?"text":"password",placeholder:"Create a password",value:a.password,onChange:se=>i({...a,password:se.target.value}),className:"pl-10 pr-10",required:!0}),r.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>N(!E),children:E?r.jsx(Kp,{className:"h-4 w-4"}):r.jsx(Cr,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"signup-confirm",children:"Confirm Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(Md,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"signup-confirm",type:k?"text":"password",placeholder:"Confirm your password",value:a.confirmPassword,onChange:se=>i({...a,confirmPassword:se.target.value}),className:"pl-10 pr-10",required:!0}),r.jsx(W,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>I(!k),children:k?r.jsx(Kp,{className:"h-4 w-4"}):r.jsx(Cr,{className:"h-4 w-4"})})]})]}),r.jsx(W,{type:"submit",className:"w-full",disabled:e,children:e?"Creating account...":"Create Account"})]})})]})})]}),c&&r.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50",children:r.jsxs(Y,{className:"w-full max-w-md",children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Reset Password"}),r.jsx(Nt,{children:"Enter your email to receive password reset instructions."})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:U,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"reset-email",children:"Email"}),r.jsxs("div",{className:"relative",children:[r.jsx(Dn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"reset-email",type:"email",placeholder:"[email protected]",value:o,onChange:se=>l(se.target.value),className:"pl-10",required:!0})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{type:"submit",disabled:e,className:"flex-1",children:e?"Sending...":"Send Reset Email"}),r.jsx(W,{type:"button",variant:"outline",onClick:()=>d(!1),disabled:e,children:"Cancel"})]})]})})]})})]})}function jNe(){const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(!0);j.useEffect(()=>{if(e){i();const l=H.channel("airtime-transactions-changes").on("postgres_changes",{event:"*",schema:"public",table:"airtime_transactions",filter:`user_id=eq.${e.id}`},c=>{console.log("Airtime transaction updated:",c),i()}).subscribe();return()=>{H.removeChannel(l)}}},[e]);const i=async()=>
897{if(e)try{const{data:l,error:c}=await H.from("airtime_transactions").select("*").eq("user_id",e.id).order("created_at",{ascending:!1}).limit(20);if(c)throw c;n(l||[])}catch(l){console.error("Error fetching transactions:",l)}finally{a(!1)}},o=l=>{switch(l){case"completed":return r.jsxs(te,{variant:"default",className:"flex items-center gap-1",children:[r.jsx(er,{className:"h-3 w-3"}),"Completed"]});case"pending":return r.jsxs(te,{variant:"secondary",className:"flex items-center gap-1",children:[r.jsx($r,{className:"h-3 w-3"}),"Pending"]});case"failed":return r.jsxs(te,{variant:"destructive",className:"flex items-center gap-1",children:[r.jsx(ya,{className:"h-3 w-3"}),"Failed"]});default:return r.jsx(te,{variant:"outline",children:l})}};return s?r.jsx(Y,{children:r.jsx(X,{className:"p-6",children:r.jsx("div",{className:"flex items-center justify-center",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})})}):r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Airtime Purchase History"}),r.jsx(Nt,{children:"View your recent airtime transactions"})]}),r.jsx(X,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(an,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No airtime purchases yet"})]}):r.jsx("div",{className:"space-y-3",children:t.map(l=>r.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg hover:bg-muted/50 transition-colors",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[l.is_gift?r.jsx(Fie,{className:"h-5 w-5 text-primary mt-1"}):r.jsx(an,{className:"h-5 w-5 text-primary mt-1"}),r.jsxs("div",{children:[r.jsxs("div",{className:"font-medium",children:[l.network," - ",l.phone_number]}),l.is_gift&&l.recipient_name&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Gift for ",l.recipient_name]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Im(new Date(l.created_at),{addSuffix:!0})})]})]}),r.jsxs("div",{className:"text-right space-y-1",children:[r.jsxs("div",{className:"font-semibold",children:["â¦",l.amount.toFixed(2)]}),o(l.status)]})]},l.id))})})]})}const wNe=()=>{const{provider:e,currency:t,countryCode:n,loading:s}=_j();if(s)return null;const a=i=>{const o=i.toUpperCase().split("").map(l=>127397+l.charCodeAt(0));return String.fromCodePoint(...o)};return r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(te,{variant:"outline",className:"gap-1",children:e==="flutterwave"?r.jsxs(r.Fragment,{children:[r.jsx(ui,{className:"h-3 w-3 text-orange-500"}),r.jsxs("span",{children:["Flutterwave (",t,")"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(ec,{className:"h-3 w-3 text-green-600"}),r.jsxs("span",{children:["Paystack (",t,")"]})]})}),r.jsxs("span",{className:"text-muted-foreground",children:[a(n)," ",n]})]})};function NNe(){var P,O;const{user:e}=bt(),{provider:t,currency:n,isDiaspora:s,availableProviders:a}=_j(),[i,o]=j.useState(null),[l,c]=j.useState([]),[d,u]=j.useState(!0),[h,f]=j.useState(null),[m,x]=j.useState(t),[p,v]=j.useState({});j.useEffect(()=>{x(t)},[t]),j.useEffect(()=>{e&&(g(),y())},[e]);const g=async()=>{if(e)try{const{data:A,error:R}=await H.from("vendor_subscriptions").select("*").eq("user_id",e.id).in("status",["active","trialing"]).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(R&&R.code!=="PGRST116"){console.error("Error fetching subscription:",R);return}if(A){const L=new Date(A.current_period_end),z=new Date,U=Math.ceil((L.getTime()-z.getTime())/(1e3*60*60*24));o({has_subscription:!0,subscription_id:A.id,plan_type:A.plan_type,plan_name:A.plan_type.charAt(0).toUpperCase()+A.plan_type.slice(1),billing_cycle:A.billing_cycle||"monthly",status:A.status,start_date:A.started_at,end_date:A.current_period_end,days_remaining:Math.max(0,U),auto_renew:A.auto_renew||!1,featured_credits:A.featured_credits_remaining||0,is_trial:!1,cancelled_at:A.cancelled_at})}else o(null)}catch(A){console.error("Error fetching subscription:",A)}},y=async()=>{u(!0);try{const{data:A,error:R}=await H.from("subscription_plans").select("*").order("price",{ascending:!0});if(R)throw R;const L=(A||[]).map(z=>({...z,quarterly_price:z.quarterly_price||z.price*3*.9,yearly_price:z.yearly_price||z.price*12*.8,features:z.features||[]}));c(L)}catch(A){console.error("Error fetching plans:",A),be({title:"Error",description:"Failed to load subscription plans",variant:"destructive"})}finally{u(!1)}},b=async(A,R)=>
897{if(!e||!e.id){be({title:"Authentication Error",description:"I beg log in to subscribe",variant:"destructive"});return}if(console.log("ð Subscribing user:",e.id,"with provider:",m),i&&i.plan_type===A.plan_type){be({title:" You don already Subscribe",description:`You already have an active ${A.name} subscription until ${i.end_date?new Date(i.end_date).toLocaleDateString():"N/A"}.`,variant:"destructive"});return}f(A.id);try{const L=R==="monthly"?A.price:R==="quarterly"?A.quarterly_price||A.price*3:A.yearly_price||A.price*12,z=`SUB_${A.plan_type}_${Date.now()}_${Math.random().toString(36).substring(7)}`;if(m==="stripe"){const{data:ne,error:se}=await H.functions.invoke("create-stripe-payment",{body:{amount:L,currency:n,metadata:{type:"subscription",plan_type:A.plan_type,billing_cycle:R,user_id:e.id},success_url:`${window.location.origin}/dashboard?tab=subscription&payment=success`,cancel_url:`${window.location.origin}/dashboard?tab=subscription&payment=cancelled`}});if(se)throw se;ne!=null&&ne.url&&(sessionStorage.setItem("pending_subscription",JSON.stringify({plan_type:A.plan_type,billing_cycle:R,amount:L})),window.open(ne.url,"_blank"),be({title:"Redirecting to Stripe",description:"Complete your payment in the new tab"}));return}if(m==="flutterwave"){const ne=new Date,se=new Date(ne);R==="monthly"?se.setMonth(se.getMonth()+1):R==="quarterly"?se.setMonth(se.getMonth()+3):se.setFullYear(se.getFullYear()+1);const F={user_id:e.id,plan:A.plan_type.toLowerCase(),plan_type:A.plan_type.toLowerCase(),billing_cycle:R,status:"trialing",amount:L,currency:"NGN",metadata:{payment_reference:z},started_at:ne.toISOString(),current_period_start:ne.toISOString(),current_period_end:se.toISOString(),auto_renew:!1},{error:V}=await H.from("vendor_subscriptions").insert(F);if(V)throw console.error("Failed to create pending subscription:",V),V;console.log("â
Created pending subscription with reference:",z)}const U=m==="flutterwave"?"initialize-flutterwave-payment":"initialize-subscription",{data:$,error:q}=await H.functions.invoke(U,{body:{user_id:e.id,type:"subscription",plan_type:A.plan_type,billing_cycle:R,amount:L,currency:"NGN",callback_url:`${window.location.origin}/dashboard?tab=subscription&payment=success`,metadata:{plan_type:A.plan_type,billing_cycle:R,payment_type:"subscription"},reference:z}});if(q)throw q;if($.scheduled){be({title:"Downgrade Scheduled",description:$.message||`Your plan will change on ${new Date($.effective_date).toLocaleDateString()}`}),g();return}if($.authorization_url||$.payment_url){sessionStorage.setItem("pending_subscription",JSON.stringify({plan_type:A.plan_type,billing_cycle:R,amount:L}));const ne=$.authorization_url||$.payment_url;ne&&(window.location.href=ne)}}catch(L){console.error("Error subscribing:",L),be({title:"Subscription Failed",description:L.message||"Failed to initialize subscription",variant:"destructive"})}finally{f(null)}},w=async()=>{if(!(!i||!i.subscription_id)&&confirm("Are you sure you want to cancel? Your subscription will remain active until the end of the billing period."))try{const{error:A}=await H.rpc("cancel_subscription",{p_subscription_id:i.subscription_id});if(A)throw A;be({title:"Subscription Cancelled",description:`Your subscription will remain active until ${i.end_date?new Date(i.end_date).toLocaleDateString():"the end of the billing period"}`}),g()}catch(A){console.error("Error cancelling:",A),be({title:"Cancellation Failed",description:A.message,variant:"destructive"})}},_=A=>`${{NGN:"â¦",USD:"$",GBP:"£",EUR:"â¬",CAD:"CA$"}[n]||n}${A.toLocaleString()}`,C=A=>{switch(A){case"basic":return mr;case"professional":return ui;case"enterprise":return yh;default:return mr}},E=A=>({basic:1,professional:2,enterprise:3})[A]||0,N=A=>{if(!i)return!0;const R=E(i.plan_type||"");return E(A)>R},k=()=>i?i.cancelled_at?"cancelled":i.days_remaining<=7?"expiring":"active":"none",I=()=>{if(!i||!i.start_date||!i.end_date)return 0;const A=new Date(i.start_date).getTime(),R=new Date(i.end_date).getTime(),L=Date.now(),z=R-A,U=L-A;return Math.min(100,Math.max(0,U/z*100))};return d?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(ms,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[i&&r.jsxs(Y,{className:`border-2 ${k()==="active"?"border-green-500":k()==="expiring"?"border-orange-500":k()==="cancelled"?"border-red-500":"border-border"}`,children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:`p-3 rounded-full ${k()==="active"?"bg-green-100 text-green-600":k()==="expiring"?"bg-orange-100 text-orange-600":"bg-red-100 text-red-600"}`,children:ee.createElement(C(i.plan_type||"basic"),{className:"h-6 w-6"})}),r.jsx("div",{className:"mb-4",children:r.jsx(wNe,{})}),r.jsxs("div",{children:[r.jsx(Ae,{className:"text-xl",children:i.plan_name}),r.jsxs(Nt,{children:[(P=i.billing_cycle)==null?void 0:P.charAt(0).toUpperCase(),(O=i.billing_cycle)==null?void 0:O.slice(1)," Billing"]})]})]}),r.jsx(te,{className:k()==="active"?"bg-green-600":k()==="expiring"?"bg-orange-600":"bg-red-600",children:i.cancelled_at?"Cancelling":"Active"})]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Billing Perio
897d"}),r.jsxs("span",{className:"font-medium",children:[i.start_date?new Date(i.start_date).toLocaleDateString():"N/A"," - ",i.end_date?new Date(i.end_date).toLocaleDateString():"N/A"]})]}),r.jsx(gx,{value:I(),className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx($r,{className:"h-3 w-3"}),i.days_remaining," days remaining"]}),r.jsxs("span",{className:"text-muted-foreground",children:["Renews: ",i.end_date?new Date(i.end_date).toLocaleDateString():"N/A"]})]})]}),k()==="expiring"&&!i.cancelled_at&&r.jsxs(_r,{className:"border-orange-500 bg-orange-50",children:[r.jsx(Oo,{className:"h-4 w-4 text-orange-600"}),r.jsxs(Sr,{children:["Your subscription expires in ",i.days_remaining," days. Renew your subscription to continue enjoying your benefits."]})]}),i.cancelled_at&&r.jsxs(_r,{className:"border-red-500 bg-red-50",children:[r.jsx(ks,{className:"h-4 w-4 text-red-600"}),r.jsxs(Sr,{children:["Your subscription will end on ",i.end_date?new Date(i.end_date).toLocaleDateString():"N/A",". You can resubscribe anytime before it expires."]})]}),r.jsx("div",{className:"grid grid-cols-1 gap-4 p-4 bg-muted rounded-lg",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Featured Credits"}),r.jsx("p",{className:"text-2xl font-bold",children:i.featured_credits})]})}),i.status==="trialing"&&r.jsxs(_r,{className:"border-blue-500 bg-blue-50",children:[r.jsx(ms,{className:"h-4 w-4 text-blue-600 animate-spin"}),r.jsx(Sr,{children:`Your payment is being processed. This usually takes a few seconds. Click "Refresh Status" if your subscription hasn't activated yet.`})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{variant:"outline",onClick:()=>{g(),be({title:"Status Refreshed",description:"Checking your subscription status..."})},className:"flex items-center gap-2",children:[r.jsx(ms,{className:"h-4 w-4"}),"Refresh Status"]}),!i.cancelled_at&&r.jsx(W,{variant:"outline",onClick:w,className:"flex-1",children:"Cancel Subscription"}),r.jsx(W,{variant:"default",className:"flex-1",onClick:()=>{var A;(A=document.getElementById("subscription-plans"))==null||A.scrollIntoView({behavior:"smooth"})},children:i.cancelled_at?"Resubscribe":"Upgrade Plan"})]})]})]}),!i&&r.jsxs(_r,{children:[r.jsx(lr,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Start boosting your listings!"})," Subscribe to get featured listings, priority placement, and more visibility."]})]}),r.jsxs("div",{id:"subscription-plans",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-2xl font-bold",children:i?"Upgrade Your Plan":"Choose Your Plan"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Payment Method:"}),r.jsxs(mt,{value:m,onValueChange:A=>x(A),children:[r.jsx(ut,{className:"w-[220px]",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"paystack",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ec,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Paystack"}),r.jsx(te,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 bg-green-50 text-green-700 border-green-200",children:"Nigeria"})]})}),r.jsx(Ne,{value:"flutterwave",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Flutterwave"}),r.jsx(te,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 bg-orange-50 text-orange-700 border-orange-200",children:"Nigeria & Africa"})]})}),r.jsx(Ne,{value:"stripe",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hn,{className:"h-4 w-4 text-indigo-600"}),r.jsx("span",{children:"Stripe"}),r.jsx(te,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 bg-indigo-50 text-indigo-700 border-indigo-200",children:"Diaspora"})]})})]})]})]})]}),r.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:l.map(A=>{const R=C(A.plan_type),L=(i==null?void 0:i.plan_type)===A.plan_type;N(A.plan_type);const z=i&&E(A.plan_type)<E(i.plan_type||""),U=A.price||0,$=A.quarterly_price||U*3,q=A.yearly_price||U*12,
897ne=U*3-$,se=U*12-q;return r.jsxs(Y,{className:`relative ${L?"border-2 border-primary shadow-lg":""} ${z?"opacity-50":""}`,children:[L&&r.jsx(te,{className:"absolute -top-3 left-1/2 -translate-x-1/2 bg-primary",children:"Current Plan"}),r.jsxs(Se,{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(R,{className:"h-6 w-6 text-primary"}),r.jsx(Ae,{children:A.name})]}),r.jsx(Nt,{children:A.description})]}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"text-center p-4 bg-muted rounded-lg",children:[r.jsx("div",{className:"text-3xl font-bold",children:_(U)}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"per month"})]}),$>0&&r.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[r.jsx("div",{className:"text-xl font-bold",children:_($)}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Quarterly ",ne>0&&`(Save ${_(ne)})`]})]}),q>0&&r.jsxs("div",{className:"text-center p-3 bg-primary/10 rounded-lg border-2 border-primary",children:[r.jsx(te,{className:"mb-1 bg-green-600",children:"Best Value"}),r.jsx("div",{className:"text-xl font-bold",children:_(q)}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Yearly ",se>0&&`(Save ${_(se)})`]})]})]}),r.jsx("div",{className:"space-y-2",children:A.features&&A.features.length>0?A.features.map((F,V)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Rd,{className:"h-4 w-4 text-green-600 mt-0.5 flex-shrink-0"}),r.jsx("span",{className:"text-sm",children:F})]},V)):r.jsx("div",{className:"text-sm text-muted-foreground",children:"No features listed"})}),!L&&!z&&r.jsx(EO,{checked:p[A.id]||!1,onCheckedChange:F=>v(V=>({...V,[A.id]:F})),purchaseType:"subscription",amount:U,currency:n}),r.jsx("div",{className:"space-y-2 pt-4",children:L?r.jsx(W,{disabled:!0,className:"w-full",children:"Current Plan"}):z?r.jsx(W,{disabled:!0,variant:"outline",className:"w-full",children:"Cannot Downgrade"}):r.jsxs(r.Fragment,{children:[r.jsx(W,{onClick:()=>b(A,"monthly"),disabled:!!h||!p[A.id],variant:"outline",className:"w-full",children:h===A.id?"Processing...":"Monthly"}),$>0&&r.jsx(W,{onClick:()=>b(A,"quarterly"),disabled:!!h||!p[A.id],variant:"outline",className:"w-full",children:h===A.id?"Processing...":"Quarterly (10% off)"}),q>0&&r.jsx(W,{onClick:()=>b(A,"yearly"),disabled:!!h||!p[A.id],className:"w-full bg-gradient-to-r from-primary to-primary/80",children:h===A.id?"Processing...":"Yearly (20% off)"})]})})]})]},A.id)})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-lg",children:"Subscription Notes"})}),r.jsxs(X,{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("p",{className:"flex items-start gap-2",children:[r.jsx(Rd,{className:"h-4 w-4 text-green-600 mt-0.5"}),r.jsxs("span",{children:[r.jsx("strong",{children:"Immediate Activation:"})," Your perks take effect immediately after payment"]})]}),r.jsxs("p",{className:"flex items-start gap-2",children:[r.jsx(Rd,{className:"h-4 w-4 text-green-600 mt-0.5"}),r.jsxs("span",{children:[r.jsx("strong",{children:"Upgrade Anytime:"})," Upgrade to a higher tier at any time. All payments are final with no prorating."]})]}),r.jsxs("p",{className:"flex items-start gap-2",children:[r.jsx(Rd,{className:"h-4 w-4 text-green-600 mt-0.5"}),r.jsxs("span",{children:[r.jsx("strong",{children:"Cancel Anytime:"})," Cancel your subscription and keep access until period ends"]})]}),r.jsxs("p",{className:"flex items-start gap-2",children:[r.jsx(Rd,{className:"h-4 w-4 text-green-600 mt-0.5"}),r.jsxs("span",{children:[r.jsx("strong",{children:"Manual Renewal:"})," Subscriptions do not auto-renew. We'll remind you when it's time to renew."]})]})]})]})]})}const xy={property:{icon:en,label:"Property",color:"text-blue-500",table:"property_boosts",entityTable:"properties",titleField:"name",imageField:"images",route:"/properties"},restaurant:{icon:Lo,label:"Restaurant",color:"text-orange-500",table:"restaurant_boosts",entityTable:"restaurants",titleField:"title",imageField:"images",route:"/restaurants"},event:{icon:qq,label:"Event",color:"text-purple-500",table:"event_boosts",entityTable:"events",titleField:"title",imageField:"images",route:"/events"}
897,rental_car:{icon:xa,label:"Rental Car",color:"text-green-500",table:"rental_car_boosts",entityTable:"rental_cars",titleField:"title",imageField:"photos",route:"/rentals"},classified:{icon:fr,label:"Classified",color:"text-yellow-500",table:"classified_boosts",entityTable:"classifieds",titleField:"title",imageField:"images",route:"/classifieds"},artisan:{icon:Pi,label:"Artisan",color:"text-red-500",table:"artisan_boosts",entityTable:"artisans",titleField:"business_name",imageField:"images",route:"/artisans"},product:{icon:Xl,label:"Product",color:"text-pink-500",table:"product_boosts",entityTable:"products",titleField:"title",imageField:"images",route:"/buy-sell"}};function _Ne(){const{user:e}=bt(),t=zn(),[n,s]=j.useState([]),[a,i]=j.useState(null),[o,l]=j.useState(!0),[c,d]=j.useState("all");j.useEffect(()=>{e&&u()},[e]);const u=async()=>{if(e){l(!0);try{const b=[];for(const[w,_]of Object.entries(xy))try{const C=w==="rental_car"?"rental_car_id":`${w}_id`,{data:E,error:N}=await H.from(_.table).select(` 898 id, 899 ${C}, 900 duration_days, 901 amount, 902 payment_status, 903 boost_start, 904 boost_end, 905 ${_.entityTable} ( 906 id, 907 ${_.titleField}, 908 ${_.imageField} 909 ) 910 `).eq("vendor_id",e.id).eq("payment_status","completed").gt("boost_end",new Date().toISOString()).order("boost_end",{ascending:!0});if(N){console.warn(`Error fetching ${w} boosts:`,N);continue}if(E&&E.length>0){const k=E.map(I=>{const P=I[_.entityTable],O=P==null?void 0:P[_.titleField],A=P==null?void 0:P[_.imageField];return{id:I.id,entity_id:I[C],entity_type:w,title:O||"Untitled",image:Array.isArray(A)&&A.length>0?A[0]:void 0,boost_start:I.boost_start,boost_end:I.boost_end,amount:parseFloat(I.amount||"0"),duration_days:I.duration_days,payment_status:I.payment_status}});b.push(...k)}}catch(C){console.error(`Failed to fetch ${w}:`,C)}b.sort((w,_)=>new Date(w.boost_end).getTime()-new Date(_.boost_end).getTime()),s(b),h(b)}catch(b){console.error("Error fetching boosted entities:",b),be({title:"Error",description:"Failed to load boosted listings",variant:"destructive"})}finally{l(!1)}}},h=b=>{const w=new Date;w.setDate(w.getDate()+3);const _={totalBoosted:b.length,totalSpent:b.reduce((C,E)=>C+E.amount,0),avgDuration:b.length>0?Math.round(b.reduce((C,E)=>C+E.duration_days,0)/b.length):0,expiringCount:b.filter(C=>new Date(C.boost_end)<=w).length};i(_)},f=b=>new Date(b).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}),m=b=>{const w=Math.ceil((new Date(b).getTime()-Date.now())/864e5);return Math.max(0,w)},x=b=>{const w=xy[b];if(!w)return r.jsx(Xl,{className:"h-4 w-4"});const _=w.icon;return r.jsx(_,{className:`h-4 w-4 ${w.color}`})},p=b=>{var w;return((w=xy[b])==null?void 0:w.label)||b},v=b=>c==="all"?b:b.filter(w=>w.entity_type===c),g=b=>b==="all"?n.length:n.filter(w=>w.entity_type===b).length,y=b=>{const w=xy[b.entity_type];w&&t(w.route)};return o?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):n.length===0?r.jsx(Y,{children:r.jsx(X,{className:"py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(mr,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No Boosted Listings Yet"}),r.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:"Boost your listings to get 10x more visibility and inquiries!"}),r.jsxs(W,{onClick:()=>t("/dashboard"),className:"gap-2",children:[r.jsx(lr,{className:"h-4 w-4"}),"Start Boosting"]})]})})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(mr,{className:"h-6 w-6 text-yellow-500"}),"Boosted Listings"]}),r.jsx("p",{className:"text-muted-foreground",children:"All your featured listings across modules"})]}),r.jsxs(W,{onClick:u,variant:"outline",size:"sm",children:[r.jsx(ms,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),a&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Boosted"}),r.jsx("p",{className:"text-2xl font-bold",children:a.totalBoosted})]}),r.jsx(mr,{className:"h-8 w-8 text-yellow-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Spent"}),r.jsxs("p",{className:"text-2xl font-bold",children:["â¦",a.totalSpent.toLocaleStr
910ing()]})]}),r.jsx(lr,{className:"h-8 w-8 text-green-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Avg. Duration"}),r.jsxs("p",{className:"text-2xl font-bold",children:[a.avgDuration," days"]})]}),r.jsx(Xt,{className:"h-8 w-8 text-blue-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Expiring Soon"}),r.jsx("p",{className:"text-2xl font-bold",children:a.expiringCount})]}),r.jsx(vn,{className:"h-8 w-8 text-orange-500"})]})})})]}),a&&a.expiringCount>0&&r.jsxs(_r,{className:"border-orange-500 bg-orange-50 dark:bg-orange-950/20",children:[r.jsx(vn,{className:"h-4 w-4 text-orange-600"}),r.jsxs(Sr,{children:[r.jsxs("strong",{children:[a.expiringCount," listing",a.expiringCount>1?"s":""]})," will expire within 3 days!"]})]}),r.jsxs(Kr,{value:c,onValueChange:d,className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-4 lg:grid-cols-8",children:[r.jsxs(Re,{value:"all",children:["All (",g("all"),")"]}),Object.keys(xy).map(b=>g(b)>0&&r.jsxs(Re,{value:b,className:"gap-1",children:[r.jsx("span",{className:"h-4 w-4",children:ee.createElement(x(b),{className:"h-4 w-4"})}),r.jsx("span",{className:"hidden sm:inline",children:p(b)})," (",g(b),")"]},b))]}),r.jsx(Be,{value:c,className:"space-y-4 mt-4",children:r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(mr,{className:"h-5 w-5 text-yellow-500"}),"Active Boosts (",v(n).length,")"]})}),r.jsx(X,{children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Type"}),r.jsx(jt,{children:"Listing"}),r.jsx(jt,{children:"Duration"}),r.jsx(jt,{children:"Expires"}),r.jsx(jt,{children:"Amount"}),r.jsx(jt,{className:"text-right",children:"Actions"})]})}),r.jsx(Oi,{children:v(n).map(b=>{const w=m(b.boost_end);return r.jsxs(On,{children:[r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[x(b.entity_type),r.jsx("span",{className:"text-sm",children:p(b.entity_type)})]})}),r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[b.image&&r.jsx("img",{src:b.image,alt:b.title,className:"w-12 h-12 object-cover rounded"}),r.jsx("div",{children:r.jsx("p",{className:"font-medium",children:b.title})})]})}),r.jsx(wt,{children:r.jsxs(te,{variant:"secondary",children:[b.duration_days," days"]})}),r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:f(b.boost_end)}),r.jsxs("p",{className:`text-xs ${w<=3?"text-orange-500 font-semibold":"text-muted-foreground"}`,children:[w," day",w!==1?"s":""," left"]})]})]})}),r.jsx(wt,{children:r.jsxs("span",{className:"font-semibold",children:["â¦",b.amount.toLocaleString()]})}),r.jsx(wt,{children:r.jsx("div",{className:"flex items-center justify-end gap-2",children:r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>y(b),children:[r.jsx(Cr,{className:"h-4 w-4 mr-2"}),"View"]})})})]},b.id)})})]})})]})})]})]})}function SNe(){const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(!0);j.useEffect(()=>{e&&i()},[e]);const i=async()=>{const{data:l}=await H.from("vendor_subscriptions").select("*").eq("user_id",e.id).order("created_at",{ascending:!1}),{data:c}=await H.from("product_features").select("*, products(title)").eq("vendor_id",e.id).order("created_at",{ascending:!1}),d=[...(l||[]).map(u=>({id:u.id,type:"subscription",description:`${u.plan} Subscription`,amount:u.amount,status:u.status,date:u.created_at})),...(c||[]).map(u=>{var h;return{id:u.id,type:"featured",description:`Featured: ${(h=u.products)==null?void 0:h.title}`,amount:u.amount,status:u.payment_status,date:u.created_at}})].sort((u,h)=>new Date(h.date).getTime()-new Date(u.date).getTime());n(d),a(!1)},o=l=>{const c={active:"bg-green-600",completed:"bg-green-600",success:"bg-green-600",pending:"bg-yellow-600",failed:"bg-red-600",cancelled:"bg-gray-600"};return r.jsx(te,{className:c[l]||"bg-gray-600",children:l.toUpperCase()})};return r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(ec,{className:"h-5 w-5"}),"Payment History"]}),r.jsx(Nt,{children:"View all your transactions and invoices"})]}),r.jsx(X,{children:s?r.jsx("div",{className:"text-center py-8",children:"Loading..."}):t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ec,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No payment history yet"})]}):r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Date"}),r.jsx(jt,{children:"Description"}),r.jsx(jt,{children:"Type"}),r.jsx(jt,{children:"Amount"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{children:"Action"})]})}),r.jsx(Oi,{children:t.map(l=>r.jsxs(On,{children:[r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm",children:new Date(l.date).toLocaleDateString("en-GB")})]})}),r.jsx(wt,{className:"font-medium",children:l.description}),r.jsx(wt,{children:r.jsx(te,{variant:"outline",className:"capitalize",children:l.type})}),r.jsxs(wt,{className:"font-semibold",children:["â¦",l.amount.toLocaleStr
910ing()]}),r.jsx(wt,{children:o(l.status)}),r.jsx(wt,{children:r.jsx(W,{variant:"ghost",size:"sm",children:r.jsx(qh,{className:"h-4 w-4"})})})]},l.id))})]})})]})}function kNe({open:e,onOpenChange:t,productId:n,onSuccess:s}){const{getPhotoLimit:a}=yX(),[i,o]=j.useState(!1),[l,c]=j.useState(!0),[d,u]=j.useState({title:"",description:"",price:"",compare_at_price:"",category:"",stock:"",location:"",is_digital:!1,weight:"",tags:[],images:[],delivery_options:[],status:"draft"}),[h,f]=j.useState(""),[m,x]=j.useState([]);j.useEffect(()=>{e&&n&&p()},[e,n]);const p=async()=>{var b,w,_,C;c(!0);try{const{data:E,error:N}=await H.from("products").select("*").eq("id",n).single();if(N)throw N;u({title:E.title||"",description:E.description||"",price:((b=E.price)==null?void 0:b.toString())||"",compare_at_price:((w=E.compare_at_price)==null?void 0:w.toString())||"",category:E.category||"",stock:((_=E.stock)==null?void 0:_.toString())||"",location:E.location||"",is_digital:E.is_digital||!1,weight:((C=E.weight)==null?void 0:C.toString())||"",tags:E.tags||[],images:E.images||[],delivery_options:E.delivery_options||[],status:E.status||"draft"}),x(E.images||[])}catch(E){console.error("Error fetching product:",E),be({title:"Error",description:"Failed to load product details",variant:"destructive"})}finally{c(!1)}},v=async b=>{if(b.preventDefault(),!d.title||!d.price||!d.category){be({title:"Missing Information",description:"Please fill in all required fields",variant:"destructive"});return}o(!0);try{const{error:w}=await H.from("products").update({title:d.title,description:d.description||null,price:parseFloat(d.price),compare_at_price:d.compare_at_price?parseFloat(d.compare_at_price):null,category:d.category,stock:parseInt(d.stock)||0,location:d.location||null,is_digital:d.is_digital,weight:d.weight?parseFloat(d.weight):null,tags:d.tags,images:m,delivery_options:d.delivery_options,status:d.status,updated_at:new Date().toISOString()}).eq("id",n);if(w)throw w;be({title:"Product Updated! â",description:"Your product has been successfully updated"}),s(),t(!1)}catch(w){console.error("Error updating product:",w),be({title:"Update Failed",description:w.message||"Failed to update product",variant:"destructive"})}finally{o(!1)}},g=()=>{h.trim()&&!d.tags.includes(h.trim())&&(u({...d,tags:[...d.tags,h.trim()]}),f(""))},y=b=>{u({...d,tags:d.tags.filter(w=>w!==b)})};return l?r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsx(Ot,{children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})})})}):r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Edit Product"})}),r.jsxs("form",{onSubmit:v,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"title",children:["Product Title ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ge,{id:"title",value:d.title,onChange:b=>u({...d,title:b.target.value}),placeholder:"e.g., Samsung 55-inch Smart TV",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Description"}),r.jsx(ir,{id:"description",value:d.description,onChange:b=>u({...d,description:b.target.value}),placeholder:"Describe your product...",rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"category",children:["Category ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs(mt,{value:d.category,onValueChange:b=>u({...d,category:b}),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select category"})}),r.jsx(ht,{children:s6.map(b=>r.jsx(Ne,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"status",children:["Status ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsxs(mt,{value:d.status,onValueChange:b=>u({...d,status:b}),children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"draft",children:"Draft"}),r.jsx(Ne,{value:"active",children:"Active"}),r.jsx(Ne,{value:"inactive",children:"Inactive"})]})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Pricing & Inventory"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"price",children:["Price (â¦) ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ge,{id:"price",type:"number",value:d.price,onChange:b=>u({...d,price:b.target.value}),placeholder:"0",required:!0,min:"0",step:"0.01"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"compare_at_price",children:"Compare at Price (â¦)"}),r.jsx(ge,{id:"compare_at_price",type:"number",value:d.compare_at_price,onChange:b=>u({...d,compare_at_price:b.target.value}),placeholder:"Original price (optional)",min:"0",step:"0.01"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"stock",children:["Stock Quantity ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(ge,{id:"stock",type:"number",value:d.stock,onChange:b=>u({...d,stock:b.target.value}),placeholder:"0",required:!0,min:"0"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"location",children:"Location"}),r.jsx(ge,{id:"location",value:d.location,onChange:b=>u({...d,location:b.target.value}),placeholder:"e.g., Lagos, Nigeria"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold",children:["Product Images (max ",a(),")"]}),r.jsx(Wd,{images:m,onImagesChange:x,maxImages:a(),bucket:"product-images"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Tags"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ge,{value:h,onChange:b=>f(b.target.value),placeholder:"Add a tag...",onKeyPress:b=>b.key==="Enter"&&(b.preventDefault(),g())}),r.jsx(W,{type:"button",onClick:g,children:"Add"})]}),d.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:d.tags.map(b=>r.jsxs(te,{variant:"secondary",children:[b,r.jsx("button",{type:"button",onClick:()=>y(b),className:"ml-2 hover:text-destructive",children:r.jsx(ks,{className:"h-3 w-3"})})]},b))})]}),r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsx(Sr,{className:"text-sm",children:"Changes will be saved immediately. Make sure all information is correct before updating."})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[r.jsx(W,{type:"button",variant:"outline",onClick:()=>t(!1),disabled:i,children:"Cancel"}),r.jsx(W,{type:"submit",disabled:i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update Product"})]})]})]})})}function ep({onBoostClick:e,onViewPlansClick:t}
910){return r.jsxs(Y,{className:"border-2 border-orange-600 dark:bg-green-600 text-white",children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lr,{className:"h-5 w-5 text-green-600"}),r.jsx(Ae,{className:"text-lg font-bold",children:"Boost Your Visibility"})]}),r.jsx(te,{variant:"secondary",className:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-100 font-bold",children:"10x More Views"})]})}),r.jsxs(X,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:r.jsx("strong",{className:"text-orange-600 font-bold",children:"Boosted listings get 10x more views and appear at the top of search results, leading to more inquiries and bookings."})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{variant:"default",className:"bg-orange-600 hover:bg-green-700 font-bold",onClick:e,children:[r.jsx(ui,{className:"h-4 w-4 mr-2"}),"Boost a Listing"]}),r.jsx(W,{variant:"outline",className:"border-green-600 text-green-600 hover:bg-orange-600:hover:bg-green-700 font-bold",onClick:t,children:"View Plans â"})]})]})]})}const CNe=[{duration_days:7,price:2e3,label:"1 Week"},{duration_days:14,price:3500,label:"2 Weeks",savings:"Save â¦500"},{duration_days:30,price:6e3,label:"1 Month",popular:!0,savings:"Save â¦2,000"},{duration_days:90,price:15e3,label:"3 Months",savings:"Save â¦3,000"}],ANe={product:{table:"product_boosts",foreignKey:"product_id",amountColumn:"amount",durationColumn:"duration_days",durationValue:e=>e,expiryColumn:"boost_end",userColumn:"vendor_id"},property:{table:"property_boosts",foreignKey:"property_id",amountColumn:"amount",durationColumn:"duration_days",durationValue:e=>e,expiryColumn:"boost_expires_at",userColumn:"user_id"},restaurant:{table:"restaurant_boosts",foreignKey:"restaurant_id",amountColumn:"amount_paid",durationColumn:"duration_hours",durationValue:e=>e*24,expiryColumn:"end_date",userColumn:"user_id"},artisan:{table:"artisan_boosts",foreignKey:"artisan_id",amountColumn:"amount_paid",durationColumn:"duration_hours",durationValue:e=>e*24,expiryColumn:"end_date",userColumn:"user_id"},rental_car:{table:"rental_car_boosts",foreignKey:"rental_car_id",amountColumn:"amount",durationColumn:"duration_days",durationValue:e=>e,expiryColumn:"boost_expires_at",userColumn:"user_id"},event:{table:"event_boosts",foreignKey:"event_id",amountColumn:"amount",durationColumn:"duration_days",durationValue:e=>e,expiryColumn:"boost_expires_at",userColumn:"user_id"},classified:{table:"classified_boosts",foreignKey:"classified_id",amountColumn:"amount",durationColumn:"duration_days",durationValue:e=>e,expiryColumn:"boost_expires_at",userColumn:"user_id"}},PNe={product:"products",property:"properties",restaurant:"restaurants",artisan:"artisans",rental_car:"rental_cars",event:"events",classified:"classifieds"};function tp({open:e,onOpenChange:t,entityId:n,entityType:s,entityTitle:a}){const{user:i}=bt(),{toast:o}=Sn(),{provider:l,currency:c,isDiaspora:d,availableProviders:u}=_j(),[h,f]=j.useState(null),[m,x]=j.useState(!1),[p,v]=j.useState(!1),[g,y]=j.useState(l);j.useEffect(()=>{y(l)},[l]);const[b,w]=j.useState(null),[_,C]=j.useState(!1);j.useEffect(()=>{e&&n&&E()},[e,n,s]);const E=async()=>{C(!0);try{const O=PNe[s];if(!O)return;const{data:A,error:R}=await H.from(O).select("is_boosted, boost_expires_at").eq("id",n).single();!R&&A&&w(A)}catch(O){console.error("Error checking boost status:",O)}finally{C(!1)}},N=(b==null?void 0:b.is_boosted)&&(b==null?void 0:b.boost_expires_at)&&new Date(b.boost_expires_at)>new Date,k=N?new Date(b.boost_expires_at):null,I=O=>`${{NGN:"â¦",USD:"$",GBP:"£",EUR:"â¬",CAD:"CA$"}[c]||c}${O.toLocaleString()}`,P=async()=>{if(!h||!m){o({title:"Required",description:"Please select a duration and accept the terms",variant:"destructive"});return}v(!0);try{const{data:{session:O}}=await H.auth.getSession();if(!O)throw new Error("No active session");console.log("ð Initializing boost:",{entity_id:n,entity_type:s,duration_days:h.duration_days,amount:h.price,provider:g});const A=`boost_${s}_${n}_${Date.now()}_${Math.random().toString(36).substring(7)}`,R=ANe[s];if(g==="stripe"){if(R){const se=new Date;se.setDate(se.getDate()+h.duration_days);const F={[R.userColumn]:i.id,[R.foreignKey]:n,[R.durationColumn]:R.durationValue(h.duration_days),[R.amountColumn]:h.price,payment_reference:A,payment_status:"pending",payment_provider:"stripe",[R.expiryColumn]:se.toISOString()};console.log(`Creating pending Stripe ${s} boost:`,F);const{error:V}=await H.from(R.table).insert(F);V?console.error("Failed to create pending boost:",V):console.log("â
Created pending Stripe boost with reference:",A)}const{data:q,error:ne}=await H.functions.invoke("create-stripe-payment",{body:{amount:h.price,currency:c,metadata:{type:"boost",entity_id:n,entity_type:s,duration_days:h.duration_days,user_id:i.id,reference:A},success_url:`${window.location.origin}/dashboard?payment=success&boost=true`,cancel_url:`${window.location.origin}/dashboard?payment=cancelled`}});if(ne)throw ne;q!=null&&q.url&&(sessionStorage.setItem("pending_boost",JSON.stringify({entity_id:n,entity_type:s,duration_days:h.duration_days,amount:h.price,reference:A,timestamp:Date.now()})),o({title:"Redirecting to Stripe",description:"Complete your payment in the new tab"}),window.open(q.url,"_blank"));return}if(g==="flutterwave"&&R){const q=new Date;q.setDate(q.getDate()+h.duration_days);const ne={[R.userColumn]:i.id,[R.foreignKey]:n,[R.durationColumn]:R.durationValue(h.duration_days),[R.amountColumn]:h.price,payment_reference:A,payment_status:"pending",[R.expiryColumn]:q.toISOString()};console.log(`Creating ${s} boost in ${R.table}:`,ne);const{error:se}=await H.from(R.table).insert(ne);se?console.error("Failed to create pending boost:",se):console.log("â
Created pending boost with reference:",A)}const L=g==="flutterwave"?"initialize-flutterwave-payment":"initialize-boost",{data:z,error:U}=await H.functions.invoke(L,{headers:{Authorization:`Bearer ${O.access_token}`},body:{user_id:i.id,entity_id:n,entity_type:s,type:"boost",reference:A,duration_days:h.duration_days,amount:h.price,currency:c,metadata:{entity_id:n,entity_type:s,duration_days:h.duration_days,purchase_type:"boost"},callback_url:`${window.location.origin}/dashboard?payment=success`}});if(console.log("ð³ Boost response:",{data:z,error:U}),U)throw U;const $=z.authorization_url||z.payment_url||z.link;if(!$)throw new Error("No payment URL received");z.reference&&sessionStorage.setItem("pending_boost",JSON.stringify({entity_id:n,entity_type:s,duration_days:h.duration_days,amount:h.price,reference:z.reference,timestamp:Date.now()})),o({title:"Redirecting to Payment",description:"Complete your payment to activate boost"}),window.location.href=$}catch(O){console.error("â Boost error:",O),o({title:"Boost Failed",description:O.message||"Failed to initialize boost payment",variant:"destructive"})}finally{v(!1)}};return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{className:"flex items-center gap-2.5 text-2xl font-extrabold tracking-tight",children:[r.jsx(lr,{className:"h-7 w-7 text-orange-600"}),r.jsx("span",{className:"text-gray-900 dark:text-white",children:"Boost Your Listing"})]}),r.jsxs(on,{className:"text-base leading-relaxed pt-1",children:["Get ",r.jsx("span",{className:"font-extrabold text-gray-900 dark:text-white text-lg",children:"10x more views"})," by featuring:",r.jsxs("span",{className:"font-bold text-gray-900 dark:text-white block mt-1",children:['"',a,'"']})]})]}),N&&r.jsxs(_r,{className:"border-2 border-amber-500 bg-amber-50 dark:bg-amber-950/30",children:[r.jsx(Oo,{className:"h-5 w-5 text-amber-600"}),r.jsx(gK,{className:"font-bold text-amber-800 dark:text-amber-200",children:"Already Boosted!"}),r.jsxs(Sr,{className:"text-amber-700 dark:text-amber-300",children:[r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx($r,{className:"h-4 w-4"}),r.jsxs("span",{children:["This listing is already boosted until"," ",r.jsx("strong",{children:k==null?void 0:k.toLocaleDateString("en-NG",{weekday:"long",year:"numeric",month:"long",day:"numeric"})})]})]}),r.jsx("p",{className:"mt-2 text-sm",children:"Wait until your current boost expires before purchasing a new one."})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Y,{className:"border-2 border-green-600 bg-gradient-to-br from-green-50 via-green-50 to-emerald-50 dark:from-green-950/30 dark:via-green-950/20 dark:to-emerald-950/30 shadow-sm",children:r.jsxs(X,{className:"p-6",children:[r.jsxs("h3",{className:"font-black text-gray-900 dark:text-white mb-5 flex items-center gap-2.5 text-lg tracking-tight",children:[r.jsx(mr,{className:"h-6 w-6 text-green-600 fill-green-600"}),"Why Boost Your Listing?"]}),r.jsxs("ul",{className:"space-y-4",children:[r.jsxs("li",{className:"flex items-start gap-3.5",children:[r.jsx(er,{className:"h-6 w-6 text-green-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"leading-relaxed",children:[r.jsx("span",{className:"font-extrabold text-gray-900 dark:text-white text-base block mb-0.5",children:"10x More Visibility"}),r.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium text-sm",children:"Appear at the very top of all search results and category listings"})]})]}),r.jsxs("li",{className:"flex items-start gap-3.5",children:[r.jsx(er,{className:"h-6 w-6 text-green-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"leading-relaxed",children:[r.jsx("span",{className:"font-extrabold text-gray-900 dark:text-white text-base block mb-0.5",children:'Premium "Featured" Badge'}),r.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium text-sm",children:"Stand out with exclusive highlighting and branding that catches attention"})]})]}),r.jsxs("li",{className:"flex items-start gap-3.5",children:[r.jsx(er,{className:"h-6 w-6 text-green-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"leading-relaxed",children:[r.jsx("span",{className:"font-extrabold text-gray-900 dark:text-white text-base block mb-0.5",children:"Priority Placement"}),r.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium text-sm",children:"Always displayed before non-boosted listings in all views"})]})]}),r.jsxs("li",{className:"flex items-start gap-3.5",children:[r.jsx(er,{className:"h-6 w-6 text-green-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"leading-relaxed",children:[r.jsx("span",{className:"font-extrabold text-gray-900 dark:text-white text-base block mb-0.5",children:"More Customer Inquiries"}),r.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium text-sm",children:"Significantly increased engagement and direct customer contact"})]})]}),r.jsxs("li",{className:"flex items-start gap-3.5",children:[r.jsx(er,{className:"h-6 w-6 text-green-600 mt-0.5 flex-shrink-0"}),r.jsxs("div",{className:"leading-relaxed",children:[r.jsx("span",{className:"font-extrabold text-gray-900 dark:text-white text-base block mb-0.5",children:"Instant Activation"}),r.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium text-sm",children:"Your boost starts working immediately after payment confirmation"})]})]})]})]})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-black text-gray-900 dark:text-white mb-4 text-lg tracking-tight",children:"Select Boost Duration"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:CNe.map(O=>
910r.jsxs(Y,{className:`cursor-pointer transition-all relative hover:shadow-lg ${(h==null?void 0:h.duration_days)===O.duration_days?"border-3 border-primary ring-4 ring-primary/30 shadow-xl bg-primary/5":"border-2 hover:border-primary/60 hover:shadow-md bg-white dark:bg-gray-900"} ${O.popular?"border-3 border-orange-600":""}`,onClick:()=>f(O),children:[O.popular&&r.jsx(te,{className:"absolute -top-2.5 left-1/2 transform -translate-x-1/2 bg-orange-600 font-black text-xs px-3 py-1 shadow-md",children:"Most Popular"}),r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-black mb-1.5 text-gray-900 dark:text-white tracking-tight",children:I(O.price)}),r.jsx("div",{className:"text-sm font-bold text-gray-700 dark:text-gray-300 mb-1.5",children:O.label}),O.savings&&r.jsx(te,{variant:"secondary",className:"text-xs font-black bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100 px-2.5 py-1",children:O.savings})]})]},O.duration_days))})]}),r.jsx(Y,{className:"border-2 border-green-200 bg-green-50 dark:bg-green-950/30",children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[r.jsx("label",{className:"text-sm font-bold text-green-800 dark:text-green-100",children:"Payment Method:"}),r.jsxs(mt,{value:g,onValueChange:O=>y(O),children:[r.jsx(ut,{className:"w-[220px]",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"paystack",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ec,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Paystack"}),r.jsx(te,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 bg-green-50 text-green-700 border-green-200",children:"Nigeria"})]})}),r.jsx(Ne,{value:"flutterwave",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ui,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Flutterwave"}),r.jsx(te,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 bg-orange-50 text-orange-700 border-orange-200",children:"Nigeria & Africa"})]})}),r.jsx(Ne,{value:"stripe",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hn,{className:"h-4 w-4 text-indigo-600"}),r.jsx("span",{children:"Stripe"}),r.jsx(te,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 bg-indigo-50 text-indigo-700 border-indigo-200",children:"Diaspora"})]})})]})]})]})})}),h&&r.jsx(EO,{checked:m,onCheckedChange:x,purchaseType:"boost",amount:h.price,currency:c}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx(W,{variant:"outline",className:"flex-1 font-bold text-base border-2",onClick:()=>t(!1),disabled:p,children:"Cancel"}),r.jsx(W,{className:"flex-1 bg-orange-600 hover:bg-orange-700 font-black text-base shadow-lg hover:shadow-xl transition-all text-white border-0",onClick:P,disabled:!h||!m||p||N,children:p?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-5 w-5 animate-spin"}),r.jsx("span",{className:"font-bold",children:"Processing..."})]}):N?r.jsx("span",{className:"font-black",children:"Already Boosted"}):r.jsxs(r.Fragment,{children:[r.jsx(ui,{className:"mr-2 h-5 w-5"}),r.jsxs("span",{className:"font-black",children:["Boost Now - ",I((h==null?void 0:h.price)||0)]})]})})]})]})]})})}function ENe(){const{user:e}=bt(),t=zn(),[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState(!1),[c,d]=j.useState(!1),[u,h]=j.useState(!1),[f,m]=j.useState(null),[x,p]=j.useState(null),[v,g]=j.useState(null),y=()=>{t("/dashboard",{state:{activeTab:"subscription"}})};j.useEffect(()=>{e&&b()},[e]);const b=async()=>{if(e){i(!0);try{const{data:P,error:O}=await H.from("products").select("*").eq("vendor_id",e.id).order("created_at",{ascending:!1});if(O)throw O;s(P||[])}catch(P){console.error("Error fetching products:",P),be({title:"Error",description:"Failed to load products",variant:"destructive"})}finally{i(!1)}}},w=async P=>{if(confirm("Are you sure you want to delete this product? This action cannot be undone.")){g(P);try{const{error:O}=await H.from("products").delete().eq("id",P);if(O)throw O;be({title:"Product Deleted",description:"Your product has been removed"}),b()}catch(O){be({title:"Error",description:O.message||"Failed to delete product",variant:"destructive"})}finally{g(null)}}},_=P=>{console.log("âï¸ Opening edit modal for:",P),m(P),d(!0)},C=()=>{console.log("â Product updated successfully"),d(!1),m(null),b(),be({title:"Product Updated! â",description:"Your changes have been saved"})},E=P=>{p(P),h(!0)},N=()=>{h(!1),p(null),b(),be({title:"Product Boosted! ð",description:"Your product is now featured"})},k=P=>{if(!P)return 0;const O=Math.ceil((new Date(P).getTime()-Date.now())/(1e3*60*60*24));return Math.max(0,O)},I=P=>{const O={active:"bg-green-600",draft:"bg-gray-600",inactive:"bg-red-600",pending:"bg-yellow-600"};return r.jsx(te,{className:O[P]||"bg-gray-600",children:P.toUpperCase()})};return a?r.jsx(f1e,{rows:10}):n.length===0?r.jsx(m1e,{onCreateProduct:()=>l(!0)}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(ep,{onBoostClick:()=>{n.length===1?E(n[0]):n.length>
9100?be({title:"Select a Product",description:'Click the "Boost" button on any product to feature it'}):be({title:"No Products",description:"Create a product first",variant:"destructive"})},onViewPlansClick:y}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg font-semibold",children:["Your Products (",n.length,")"]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage your marketplace listings"})]}),r.jsxs(Rt,{open:o,onOpenChange:l,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{children:[r.jsx(xs,{className:"mr-2 h-4 w-4"}),"New Product"]})}),r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Create New Product"})}),r.jsx(a6,{onSuccess:()=>{l(!1),b(),be({title:"Product Created! ð",description:"Your product is now live on the marketplace",duration:5e3})}})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"p-4 border rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Products"}),r.jsx("p",{className:"text-2xl font-bold",children:n.length})]}),r.jsxs("div",{className:"p-4 border rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Active"}),r.jsx("p",{className:"text-2xl font-bold",children:n.filter(P=>P.status==="active").length})]}),r.jsxs("div",{className:"p-4 border rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Boosted"}),r.jsx("p",{className:"text-2xl font-bold",children:n.filter(P=>P.is_featured).length})]}),r.jsxs("div",{className:"p-4 border rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Views"}),r.jsx("p",{className:"text-2xl font-bold",children:n.reduce((P,O)=>P+(O.view_count||0),0)})]})]}),r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Product"}),r.jsx(jt,{children:"Price"}),r.jsx(jt,{children:"Stock"}),r.jsx(jt,{children:"Views"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{className:"text-right",children:"Actions"})]})}),r.jsx(Oi,{children:n.map(P=>r.jsxs(On,{children:[r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[P.images&&P.images.length>0?r.jsx("img",{src:P.images[0],alt:P.title,className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Xl,{className:"h-6 w-6 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:P.title}),P.is_featured&&P.boost_expires_at&&r.jsxs(te,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(mr,{className:"h-3 w-3"}),"Boosted (",k(P.boost_expires_at),"d left)"]})]})]})}),r.jsxs(wt,{children:["â¦",P.price.toLocaleString()]}),r.jsx(wt,{children:r.jsxs(te,{variant:P.stock>0?"default":"destructive",children:[P.stock," in stock"]})}),r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cr,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:P.view_count||0})]})}),r.jsx(wt,{children:I(P.status)}),r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center justify-end gap-2",onClick:O=>O.stopPropagation(),children:[!P.is_featured&&r.jsxs(W,{variant:"ghost",size:"sm",onClick:O=>{O.preventDefault(),O.stopPropagation(),E(P)},className:"gap-2 border-green-600 text-green-600 hover:bg-green-50",children:[r.jsx(lr,{className:"h-4 w-4"}),"Boost"]}),r.jsxs("button",{type:"button",className:"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-9 w-9",onClick:O=>(O.preventDefault(),O.stopPropagation(),_(P.id),!1),children:[r.jsx(so,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Edit product"})]}),r.jsxs("button",{type:"button",className:"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-9 w-9",onClick:O=>(O.preventDefault(),O.stopPropagation(),w(P.id),!1),disabled:v===P.id,children:[v===P.id?r.jsx(yt,{className:"h-4 w-4 animate-spin"}):r.jsx(ao,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"sr-only",children:"Delete product"})]})]})})]},P.id))})]})}),r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Tip:"})," Boosted products get 10x more views and appear at the top of search results!"]})]}),f&&r.jsx(kNe,{open:c,onOpenChange:d,productId:f,onSuccess:C}),x&&r.jsx(tp,{open:u,onOpenChange:h,entityId:x.id,entityType:"product",entityTitle:x.title,onSuccess:N})]})}function TNe(){const{user:e}=bt(),[t,n]=j.useState(!0),[s,a]=j.useState(!1),[i,o]=j.useState(!1),[l,c]=j.useState({business_phone:"",business_email:"",business_address:"",store_name:""}),[d,u]=j.useState({currentPassword:"",newPassword:"",confirmPassword:""});j.useEffect(()=>{e&&h()},[e]);const h=async()=>
910{if(e)try{let{data:x,error:p}=await H.from("vendor_profiles").select("*").eq("user_id",e.id).single();if(p&&p.code==="PGRST116"){const{data:v}=await H.from("profiles").select("full_name, username, email").eq("id",e.id).single(),{data:g,error:y}=await H.from("vendor_profiles").insert({user_id:e.id,store_name:(v==null?void 0:v.full_name)||(v==null?void 0:v.username)||"My Store",business_email:(v==null?void 0:v.email)||e.email||""}).select().single();if(y)throw y;x=g}else if(p)throw p;x&&c({business_phone:x.business_phone||"",business_email:x.business_email||e.email||"",business_address:x.business_address||"",store_name:x.store_name||""})}catch(x){console.error("Error fetching vendor profile:",x),be({title:"Error",description:"Failed to load contact information",variant:"destructive"})}finally{n(!1)}},f=async x=>{if(x.preventDefault(),!!e){a(!0);try{const{error:p}=await H.from("vendor_profiles").upsert({user_id:e.id,...l,updated_at:new Date().toISOString()},{onConflict:"user_id",ignoreDuplicates:!1});if(p)throw p;be({title:"Contact Info Updated! â
",description:"Your contact information has been saved"})}catch(p){console.error("Update error:",p),be({title:"Update Failed",description:p.message||"Failed to update contact info",variant:"destructive"})}finally{a(!1)}}},m=async x=>{if(x.preventDefault(),d.newPassword!==d.confirmPassword){be({title:"Passwords Do Not Match",description:"Please make sure your passwords match",variant:"destructive"});return}if(d.newPassword.length<6){be({title:"Password Too Short",description:"Password must be at least 6 characters",variant:"destructive"});return}o(!0);try{const{error:p}=await H.auth.updateUser({password:d.newPassword});if(p)throw p;be({title:"Password Changed! ð",description:"Your password has been updated successfully"}),u({currentPassword:"",newPassword:"",confirmPassword:""})}catch(p){be({title:"Password Change Failed",description:p.message||"Failed to change password",variant:"destructive"})}finally{o(!1)}};return t?r.jsx("div",{children:"Loading..."}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-5 w-5"}),"Contact Information"]}),r.jsx(Nt,{children:"This information will be shown to buyers when they want to contact you"})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:f,className:"space-y-4",children:[r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"store_name",children:"Store Name"}),r.jsx(ge,{id:"store_name",value:l.store_name,onChange:x=>c({...l,store_name:x.target.value}),placeholder:"My Amazing Store"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"business_phone",className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),"Phone Number"]}),r.jsx(ge,{id:"business_phone",type:"tel",value:l.business_phone,onChange:x=>c({...l,business_phone:x.target.value}),placeholder:"0803 456 7890"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"business_email",className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-4 w-4"}),"Business Email"]}),r.jsx(ge,{id:"business_email",type:"email",value:l.business_email,onChange:x=>c({...l,business_email:x.target.value}),placeholder:"[email protected]"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"business_address",className:"flex items-center gap-2",children:[r.jsx(At,{className:"h-4 w-4"}),"Business Address"]}),r.jsx(ir,{id:"business_address",value:l.business_address,onChange:x=>c({...l,business_address:x.target.value}),placeholder:"123 Main Street, Ikeja, Lagos",rows:3})]}),r.jsxs(_r,{children:[r.jsx(er,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Privacy:"}),' Your contact info is only shared with serious buyers who click "Contact Seller" on your products.']})]}),r.jsx(W,{type:"submit",disabled:s,children:s?"Saving...":"Save Contact Info"})]})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Md,{className:"h-5 w-5"}),"Change Password"]}),r.jsx(Nt,{children:"Update your account password"})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:m,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"newPassword",children:"New Password"}),r.jsx(ge,{id:"newPassword",type:"password",value:d.newPassword,onChange:x=>u({...d,newPassword:x.target.value}),placeholder:"Enter new password"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"confirmPassword",children:"Confirm New Password"}),r.jsx(ge,{id:"confirmPassword",type:"password",value:d.confirmPassword,onChange:x=>u({...d,confirmPassword:x.target.value}),placeholder:"Confirm new password"})]}),r.jsx(W,{type:"submit",disabled:i,children:i?"Changing Password...":"Change Password"})]})})]})]})}function ONe(){const{user:e}=bt(),t=zn(),[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState(!1),[c,d]=j.useState(!1),[u,h]=j.useState(null),[f,m]=j.useState({total:0,active:0,featured:0,total_views:0,total_inquiries:0}),x=()=>{t("/dashboard",{state:{activeTab:"subscription"}})};j.useEffect(()=>{e&&p()},[e]);const p=async()=>
910{if(e){i(!0);try{const{data:w,error:_}=await H.from("classifieds").select("*").eq("user_id",e.id).order("created_at",{ascending:!1});if(_)throw _;const C=(w==null?void 0:w.map(O=>O.id))||[];let E={};if(C.length>0){const{data:O}=await H.from("classified_inquiries").select("classified_id").in("classified_id",C);E=(O||[]).reduce((A,R)=>(A[R.classified_id]=(A[R.classified_id]||0)+1,A),{})}const N=(w||[]).map(O=>({...O,views:0,inquiries:E[O.id]||0}));s(N);const k=N.filter(O=>O.status==="active").length,I=N.filter(O=>O.is_featured).length,P=N.reduce((O,A)=>O+(A.inquiries||0),0);m({total:N.length,active:k,featured:I,total_views:0,total_inquiries:P})}catch(w){console.error("Error fetching classifieds:",w),Et.error("Failed to load classifieds")}finally{i(!1)}}},v=async w=>{if(confirm("Are you sure you want to delete this listing?"))try{const{error:_}=await H.from("classifieds").delete().eq("id",w).eq("user_id",e==null?void 0:e.id);if(_)throw _;Et.success("Listing deleted successfully"),p()}catch{Et.error("Failed to delete listing")}},g=async(w,_)=>{const C=_==="active"?"inactive":"active";try{const{error:E}=await H.from("classifieds").update({status:C}).eq("id",w).eq("user_id",e==null?void 0:e.id);if(E)throw E;Et.success(`Listing ${C==="active"?"activated":"deactivated"}`),p()}catch{Et.error("Failed to update status")}},y=(w,_)=>_==="pending"?r.jsx(te,{variant:"outline",className:"bg-yellow-500/10",children:"Pending Review"}):_==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):w==="active"?r.jsx(te,{className:"bg-green-600",children:"Active"}):r.jsx(te,{variant:"outline",children:"Inactive"}),b=w=>new Date(w).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"});return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(fr,{className:"h-6 w-6"}),"My Classifieds"]}),r.jsx("p",{className:"text-muted-foreground",children:"Manage your job listings and track inquiries"})]}),r.jsxs(W,{onClick:()=>l(!0),className:"gap-2",children:[r.jsx(xs,{className:"h-4 w-4"}),"Post New Listing"]})]}),r.jsx(ep,{onBoostClick:()=>{n.length>0?n.length===1?(h(n[0]),d(!0)):Et.error('Select a classified to boost by clicking the "Boost" button on the listing card'):Et.error("Create a classified listing first")},onViewPlansClick:x}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Listings"}),r.jsx("p",{className:"text-2xl font-bold",children:f.total})]}),r.jsx(fr,{className:"h-8 w-8 text-primary opacity-50"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Active"}),r.jsx("p",{className:"text-2xl font-bold",children:f.active})]}),r.jsx(er,{className:"h-8 w-8 text-green-500 opacity-50"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Featured"}),r.jsx("p",{className:"text-2xl font-bold",children:f.featured})]}),r.jsx(mr,{className:"h-8 w-8 text-yellow-500 opacity-50"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Views"}),r.jsx("p",{className:"text-2xl font-bold",children:f.total_views})]}),r.jsx(Cr,{className:"h-8 w-8 text-blue-500 opacity-50"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Inquiries"}),r.jsx("p",{className:"text-2xl font-bold",children:f.total_inquiries})]}
910),r.jsx(dl,{className:"h-8 w-8 text-purple-500 opacity-50"})]})})})]}),n.length===0&&r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("p",{className:"font-semibold mb-2",children:"You haven't posted any listings yet"}),r.jsx("p",{className:"text-sm mb-3",children:"Start posting job listings to find domestic help or skilled professionals"}),r.jsxs(W,{onClick:()=>l(!0),size:"sm",children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Post Your First Listing"]})]})]}),n.length>0&&r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Your Listings"}),r.jsx(Nt,{children:"Manage and track performance of your classifieds"})]}),r.jsx(X,{children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Title"}),r.jsx(jt,{children:"Category"}),r.jsx(jt,{children:"Location"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{className:"text-center",children:"Inquiries"}),r.jsx(jt,{children:"Posted"}),r.jsx(jt,{children:"Actions"})]})}),r.jsx(Oi,{children:n.map(w=>r.jsxs(On,{children:[r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[w.is_featured&&r.jsx(mr,{className:"h-4 w-4 fill-yellow-500 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:w.title}),r.jsx("p",{className:"text-xs text-muted-foreground",children:w.subcategory})]})]})}),r.jsx(wt,{children:r.jsx(te,{variant:"outline",children:w.category==="domestic_help"?"Domestic":"Professional"})}),r.jsxs(wt,{className:"text-sm",children:[w.location_city,", ",w.location_state]}),r.jsx(wt,{children:y(w.status,w.moderation_status)}),r.jsx(wt,{className:"text-center",children:r.jsx(te,{variant:"outline",children:w.inquiries||0})}),r.jsx(wt,{className:"text-sm",children:b(w.created_at)}),r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[!w.is_featured&&w.status==="active"&&r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>{h(w),d(!0)},className:"gap-1",children:[r.jsx(lr,{className:"h-3 w-3"}),"Boost"]}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>g(w.id,w.status),children:w.status==="active"?"Deactivate":"Activate"}),r.jsx(W,{variant:"ghost",size:"sm",onClick:()=>v(w.id),children:r.jsx(ao,{className:"h-4 w-4 text-red-500"})})]})})]},w.id))})]})})]}),r.jsx(Rt,{open:o,onOpenChange:l,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Post a New Job Listing"})}),r.jsx(TS,{})]})}),u&&r.jsx(tp,{open:c,onOpenChange:d,entityId:u.id,entityType:"classified",entityTitle:u.title})]})}const LNe=()=>{const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(!0),[i,o]=j.useState(!1),[l,c]=j.useState("all"),[d,u]=j.useState({totalViews:0,totalEarnings:0});j.useEffect(()=>{e&&(h(),f())},[e]);const h=async()=>{if(e){a(!0);try{const{data:v,error:g}=await H.from("content").select("*").eq("creator_id",e.id).order("created_at",{ascending:!1});if(g)throw g;n(v||[])}catch(v){console.error("Error fetching content:",v),be({title:"Error",description:"Failed to fetch content",variant:"destructive"})}finally{a(!1)}}},f=async()=>{if(e)try{const{data:v}=await H.from("content").select("view_count, creator_earnings").eq("creator_id",e.id);if(v){const g=v.reduce((b,w)=>b+(w.view_count||0),0),y=v.reduce((b,w)=>{var _;return b+parseFloat(((_=w.creator_earnings)==null?void 0:_.toString())||"0")},0);u({totalViews:g,totalEarnings:y})}}catch(v){console.error("Error fetching stats:",v)}},m=async v=>{if(confirm("Are you sure you want to delete this content?"))try{const{error:g}=await H.from("content").delete().eq("id",v);if(g)throw g;be({title:"Success",description:"Content deleted successfully"}),h()}catch(g){console.error("Error deleting content:",g),be({title:"Error",description:"Failed to delete content",variant:"destructive"})}},x=v=>v.status==="published"&&v.moderation_status==="approved"?r.jsx(te,{className:"bg-green-500",children:"Published"}):v.moderation_status==="pending"?r.jsx(te,{variant:"secondary",children:"Pending Review"}):v.moderation_status==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):r.jsx(te,{variant:"outline",children:"Draft"}),p=t.filter(v=>l==="all"?!0:l==="published"?v.status==="published"&&v.moderation_status==="approved":l==="pending"?v.moderation_status==="pending":l==="rejected"?v.moderation_status==="rejected":!0);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 bg-primary/10 rounded-full",children:r.jsx(Cr,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Views"}),r.jsx("p",{className:"text-2xl font-bold",children:d.totalViews.toLocaleStr
910ing()})]})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 bg-green-500/10 rounded-full",children:r.jsx(Tn,{className:"h-6 w-6 text-green-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Earnings"}),r.jsxs("p",{className:"text-2xl font-bold",children:["â¦",d.totalEarnings.toLocaleString()]})]})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 bg-blue-500/10 rounded-full",children:r.jsx(Jn,{className:"h-6 w-6 text-blue-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Content"}),r.jsx("p",{className:"text-2xl font-bold",children:t.length})]})]})})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between gap-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{variant:l==="all"?"default":"outline",onClick:()=>c("all"),size:"sm",children:["All (",t.length,")"]}),r.jsxs(W,{variant:l==="published"?"default":"outline",onClick:()=>c("published"),size:"sm",children:["Published (",t.filter(v=>v.status==="published"&&v.moderation_status==="approved").length,")"]}),r.jsxs(W,{variant:l==="pending"?"default":"outline",onClick:()=>c("pending"),size:"sm",children:["Pending (",t.filter(v=>v.moderation_status==="pending").length,")"]}),r.jsxs(W,{variant:l==="rejected"?"default":"outline",onClick:()=>c("rejected"),size:"sm",children:["Rejected (",t.filter(v=>v.moderation_status==="rejected").length,")"]})]}),r.jsxs(W,{onClick:()=>o(!0),children:[r.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Upload New"]})]}),s?r.jsx("div",{className:"text-center py-12",children:r.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"})}):p.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:p.map(v=>r.jsxs(Y,{children:[r.jsxs(Se,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Ae,{className:"text-lg line-clamp-2",children:v.title}),x(v)]}),v.is_premium&&r.jsxs(te,{variant:"outline",className:"w-fit mt-2",children:["Premium - â¦",v.price]})]}),r.jsxs(X,{className:"space-y-3",children:[v.thumbnail_url&&r.jsx("img",{src:v.thumbnail_url,alt:v.title,className:"w-full h-40 object-cover rounded-md"}),r.jsx(Nt,{className:"line-clamp-2",children:v.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsx("span",{children:v.view_count||0})]}),v.is_premium&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Tn,{className:"h-4 w-4"}),r.jsxs("span",{children:[v.purchase_count||0," sales"]})]})]}),v.moderation_status==="rejected"&&v.rejection_reason&&r.jsxs(_r,{variant:"destructive",children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsx(Sr,{className:"text-xs",children:v.rejection_reason})]}),r.jsx("div",{className:"flex gap-2 pt-2",children:r.jsxs(W,{variant:"destructive",size:"sm",onClick:()=>m(v.id),children:[r.jsx(ao,{className:"h-4 w-4 mr-1"}),"Delete"]})})]})]},v.id))}):r.jsx(Y,{children:r.jsxs(X,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground",children:"No content found. Upload your first content to get started!"}),r.jsxs(W,{onClick:()=>o(!0),className:"mt-4",children:[r.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Upload Content"]})]})}),r.jsx(Rt,{open:i,onOpenChange:o,children:r.jsxs(Ot,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Upload New Content"})}),r.jsx(Eg,{onSuccess:()=>{o(!1),h(),f()}})]})})]})},INe=["Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"],RNe=[{value:"hotel",label:"Hotel"},{value:"apartment",label:"Apartment"},{value:"room",label:"Room/Villa"},{value:"studio",label:"Studio"}],MNe=[{id:"wifi",label:"WiFi",icon:Zw},{id:"parking",label:"Parking",icon:xa},{id:"security",label:"24/7 Security",icon:fn},{id:"tv",label:"TV",icon:noe},{id:"kitchen",label:"Kitchen",icon:Lie},{id:"ac",label:"Air Conditioning",icon:ioe},{id:"generator",label:"Generator",icon:ui},{id:"swimming_pool",label:"Swimming Pool",icon:Zw},{id:"gym",label:"Gym",icon:Zw},{id:"laundry",label:"Laundry",icon:Zw}],DNe=({open:e,onOpenChange:t,property:n,onSuccess:s})=>{const{toast:a}=Sn(),[i,o]=j.useState(!1),[l,c]=j.useState(!1),[d,u]=j.useState({title:n.title,summary:n.summary,description:n.description||"",base_price_per_night:n.base_price_per_night,cleaning_fee:n.cleaning_fee||0,max_guests:n.max_guests,bedrooms:n.bedrooms,beds:n.beds||n.bedrooms,baths:n.baths,property_type:n.property_type,state:n.state,city:n.city,address:n.address||"",house_rules:n.house_rules||"",cancellation_policy:n.cancellation_policy||"",contact_phone:n.contact_phone||"",contact_email:n.contact_email||"",contact_whatsapp:n.contact_whatsapp||""}),[h,f]=j.useState(n.photos||[]),[m,x]=j.useState(n.amenities||[]),p=async b=>{const w=b.target.files;if(!(!w||w.length===0)){c(!0);try{const _=[];for(let C=0;C<w.length;C++){const E=w[C],N=E.name.split(".").pop(),k=`${n.id}/${Math.random()}.${N}`,{error:I,data:P}=await H.storage.from("property-photos").upload(k,E);if(I)throw I;const{data:{publicUrl:O}}=H.storage.from("property-photos").getPublicUrl(k);_.push(O)}f([...h,..._]),a({title:"Photos uploaded successfully!"})}catch(_){console.error("Error uploading photos:",_),a({title:"Error uploading photos",variant:"destructive"})}finally{c(!1)}}},v=async b=>{try{const w=b.split("/property-photos/");if(w.length>1){const _=w[1];await H.storage.from("property-photos").remove([_])}f(h.filter(_=>_!==b)),a({title:"Photo removed"})}catch(w){console.error("Error removing photo:",w),a({title:"Error removing photo",variant:"destructive"})}},g=b=>{x(w=>
910w.includes(b)?w.filter(_=>_!==b):[...w,b])},y=async b=>{if(b.preventDefault(),h.length===0){a({title:"At least one photo is required",variant:"destructive"});return}o(!0);try{const{error:w}=await H.from("properties").update({...d,property_type:d.property_type,photos:h,amenities:m,updated_at:new Date().toISOString()}).eq("id",n.id);if(w)throw w;a({title:"Property updated successfully!"}),s()}catch(w){console.error("Error updating property:",w),a({title:"Error updating property",description:w.message,variant:"destructive"})}finally{o(!1)}};return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Edit Property"})}),r.jsxs("form",{onSubmit:y,children:[r.jsxs(Kr,{defaultValue:"basic",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-4",children:[r.jsx(Re,{value:"basic",children:"Basic Info"}),r.jsxs(Re,{value:"photos",children:["Photos (",h.length,")"]}),r.jsx(Re,{value:"amenities",children:"Amenities"}),r.jsx(Re,{value:"policies",children:"Policies"})]}),r.jsxs(Be,{value:"basic",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"title",children:"Property Title *"}),r.jsx(ge,{id:"title",value:d.title,onChange:b=>u({...d,title:b.target.value}),placeholder:"e.g. Luxury 3BR Apartment in Victoria Island",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"summary",children:"Short Summary *"}),r.jsx(ir,{id:"summary",value:d.summary,onChange:b=>u({...d,summary:b.target.value}),placeholder:"Brief description of your property...",rows:2,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Full Description"}),r.jsx(ir,{id:"description",value:d.description,onChange:b=>u({...d,description:b.target.value}),placeholder:"Detailed description of your property, neighborhood, and what makes it special...",rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"property_type",children:"Property Type *"}),r.jsxs(mt,{value:d.property_type,onValueChange:b=>u({...d,property_type:b}),children:[r.jsx(ut,{id:"property_type",children:r.jsx(pt,{})}),r.jsx(ht,{children:RNe.map(b=>r.jsx(Ne,{value:b.value,children:b.label},b.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"max_guests",children:"Max Guests *"}),r.jsx(ge,{id:"max_guests",type:"number",min:"1",value:d.max_guests,onChange:b=>u({...d,max_guests:Number(b.target.value)}),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"bedrooms",children:"Bedrooms *"}),r.jsx(ge,{id:"bedrooms",type:"number",min:"0",value:d.bedrooms,onChange:b=>u({...d,bedrooms:Number(b.target.value)}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"beds",children:"Beds"}),r.jsx(ge,{id:"beds",type:"number",min:"0",value:d.beds,onChange:b=>u({...d,beds:Number(b.target.value)})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"baths",children:"Bathrooms *"}),r.jsx(ge,{id:"baths",type:"number",min:"1",step:"0.5",value:d.baths,onChange:b=>u({...d,baths:Number(b.target.value)}),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"state",children:"State *"}),r.jsxs(mt,{value:d.state,onValueChange:b=>u({...d,state:b}),children:[r.jsx(ut,{id:"state",children:r.jsx(pt,{})}),r.jsx(ht,{children:INe.map(b=>r.jsx(Ne,{value:b,children:b},b))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"city",children:"City *"}),r.jsx(ge,{id:"city",value:d.city,onChange:b=>u({...d,city:b.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"address",children:"Full Address (Optional)"}),r.jsx(ge,{id:"address",value:d.address,onChange:b=>u({...d,address:b.target.value}),placeholder:"Will be shared after booking"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"base_price_per_night",children:"Price Per Night (â¦) *"}),r.jsx(ge,{id:"base_price_per_night",type:"number",min:"1000",value:d.base_price_per_night,onChange:b=>u({...d,base_price_per_night:Number(b.target.value)}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"cleaning_fee",children:"Cleaning Fee (â¦)"}),r.jsx(ge,{id:"cleaning_fee",type:"number",min:"0",value:d.cleaning_fee,onChange:b=>u({...d,cleaning_fee:Number(b.target.value)})})]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_phone",children:"Contact Phone"}),r.jsx(ge,{id:"contact_phone",value:d.contact_phone,onChange:b=>u({...d,contact_phone:b.target.value}),placeholder:"+234..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_whatsapp",children:"WhatsApp"}),r.jsx(ge,{id:"contact_whatsapp",value:d.contact_whatsapp,onChange:b=>u({...d,contact_whatsapp:b.target.value}),placeholder:"+234..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_email",children:"Email"}),r.jsx(ge,{id:"contact_email",type:"email",value:d.contact_email,onChange:b=>u({...d,contact_email:b.target.value})})]})]})]}
910),r.jsx(Be,{value:"photos",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Property Photos *"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[h.map((b,w)=>r.jsx(Y,{className:"relative group",children:r.jsxs(X,{className:"p-2",children:[r.jsx("img",{src:b,alt:`Property ${w+1}`,className:"w-full h-32 object-cover rounded"}),r.jsx(W,{type:"button",variant:"destructive",size:"icon",className:"absolute top-4 right-4 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>v(b),children:r.jsx(ks,{className:"h-4 w-4"})}),w===0&&r.jsx(te,{className:"absolute bottom-4 left-4",children:"Cover Photo"})]})},w)),r.jsxs("label",{className:"border-2 border-dashed rounded-lg p-4 hover:border-primary transition-colors cursor-pointer flex flex-col items-center justify-center h-40",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:p,disabled:l}),l?r.jsx(yt,{className:"h-8 w-8 animate-spin text-muted-foreground"}):r.jsxs(r.Fragment,{children:[r.jsx(Jn,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Upload Photos"})]})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"First photo will be used as cover. Max 20 photos."})]})}),r.jsx(Be,{value:"amenities",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Select Amenities"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:MNe.map(b=>{const w=b.icon;return r.jsx(Y,{className:`cursor-pointer transition-all ${m.includes(b.id)?"border-primary bg-primary/5":"hover:border-primary/50"}`,onClick:()=>g(b.id),children:r.jsxs(X,{className:"p-4 flex items-center gap-3",children:[r.jsx(Uo,{checked:m.includes(b.id),onCheckedChange:()=>g(b.id)}),r.jsx(w,{className:"h-5 w-5 text-muted-foreground"}),r.jsx("span",{className:"text-sm",children:b.label}),m.includes(b.id)&&r.jsx(er,{className:"h-4 w-4 ml-auto text-primary"})]})},b.id)})})]})}),r.jsxs(Be,{value:"policies",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"house_rules",children:"House Rules"}),r.jsx(ir,{id:"house_rules",value:d.house_rules,onChange:b=>u({...d,house_rules:b.target.value}),placeholder:"E.g., No smoking, No pets, Check-in after 2pm...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"cancellation_policy",children:"Cancellation Policy"}),r.jsx(ir,{id:"cancellation_policy",value:d.cancellation_policy,onChange:b=>u({...d,cancellation_policy:b.target.value}),placeholder:"E.g., Free cancellation up to 48 hours before check-in...",rows:4})]})]})]}),r.jsxs("div",{className:"flex gap-2 justify-end mt-6 pt-6 border-t",children:[r.jsx(W,{type:"button",variant:"outline",onClick:()=>t(!1),disabled:i,children:"Cancel"}),r.jsx(W,{type:"submit",disabled:i||h.length===0,children:i?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})]})})},$Ne=({propertyId:e})=>{bt();const{toast:t}=Sn(),[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState(null),[c,d]=j.useState(null),[u,h]=j.useState("");j.useEffect(()=>{f()},[e]);const f=async()=>{i(!0);try{const{data:C,error:E}=await H.from("bookings").select(` 911 *, 912 guest:profiles!bookings_guest_id_fkey(full_name, email, avatar_url) 913 `).eq("property_id",e).order("created_at",{ascending:!1});if(E)throw E;s(C||[])}catch(C){console.error("Error fetching bookings:",C),t({title:"Error loading bookings",variant:"destructive"})}finally{i(!1)}},m=async C=>{l(C);try{const{error:E}=await H.from("bookings").update({status:"confirmed",host_response:u||"Booking approved! Looking forward to hosting you.",responded_at:new Date().toISOString()}).eq("id",C);if(E)throw E;t({title:"Booking approved!",description:"Guest has been notified."}),h(""),d(null),f()}catch(E){console.error("Error approving booking:",E),t({title:"Error approving booking",variant:"destructive"})}finally{l(null)}},x=async C=>{l(C);try{const{error:E}=await H.from("bookings").update({status:"cancelled",host_response:u||"Sorry, these dates are no longer available.",responded_at:new Date().toISOString()}).eq("id",C);if(E)throw E;t({title:"Booking declined",description:"Guest has been notified."}),h(""),d(null),f()}catch(E){console.error("Error declining booking:",E),t({title:"Error declining booking",variant:"destructive"})}finally{l(null)}},p=C=>{switch(C){case"confirmed":return r.jsx(er,{className:"h-4 w-4 text-green-600"});case"completed":return r.jsx(er,{className:"h-4 w-4 text-blue-600"});case"cancelled":return r.jsx(ya,{className:"h-4 w-4 text-red-600"});default:return r.jsx($r,{className:"h-4 w-4 text-yellow-600"})}},v=C=>{const E={pending:{variant:"outline",label:"Pending"},confirmed:{variant:"default",label:"Confirmed"},completed:{variant:"secondary",label:"Completed"},cancelled:{variant:"destructive",label:"Cancelled"}},N=E[C]||E.pending;return r.jsxs(te,{variant:N.variant,className:"gap-1",children:[p(C),N.label]})},g=C=>{var k;const E=f_(new Date(C.check_out),new Date(C.check_in)),N=C.status==="pending";return r.jsxs(Y,{className:N?"border-yellow-500/30 bg-yellow-50/50 dark:bg-yellow-950/20":"",children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs(Ae,{className:"text-base flex items-center gap-2 mb-1",children:[((k=C.guest)==null?void 0:k.full_name)||"Guest",v(C.status)]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:wr(new Date(C.requested_at),"MMM dd, yyyy 'at' h:mm a")})]}),r.jsxs("div",{className:"text-right",children:[r.jsxs("div",{className:"text-lg font-bold text-primary",children:["â¦",C.total_amount.toLocaleStr
913ing()]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[E," night",E>1?"s":""]})]})]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Check-in"}),r.jsx("p",{className:"text-muted-foreground",children:wr(new Date(C.check_in),"MMM dd, yyyy")})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Check-out"}),r.jsx("p",{className:"text-muted-foreground",children:wr(new Date(C.check_out),"MMM dd, yyyy")})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yr,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[C.guests," guest",C.guests>1?"s":""]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Tn,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["â¦",C.total_amount.toLocaleString()]})]})]}),C.guest_message&&r.jsxs(_r,{children:[r.jsx(Oh,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("p",{className:"text-sm font-medium mb-1",children:"Guest's message:"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:C.guest_message})]})]}),C.host_response&&r.jsxs(_r,{children:[r.jsx(tc,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("p",{className:"text-sm font-medium mb-1",children:"Your response:"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:C.host_response}),C.responded_at&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:wr(new Date(C.responded_at),"MMM dd, yyyy 'at' h:mm a")})]})]}),N&&r.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:`response-${C.id}`,children:"Response to guest (optional)"}),r.jsx(ir,{id:`response-${C.id}`,placeholder:"Add a personal message...",value:(c==null?void 0:c.id)===C.id?u:"",onChange:I=>{d(C),h(I.target.value)},rows:3})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{className:"flex-1 gap-2",onClick:()=>m(C.id),disabled:o===C.id,children:[o===C.id?r.jsx(yt,{className:"h-4 w-4 animate-spin"}):r.jsx(er,{className:"h-4 w-4"}),"Approve"]}),r.jsxs(W,{variant:"destructive",className:"flex-1 gap-2",onClick:()=>x(C.id),disabled:o===C.id,children:[r.jsx(ya,{className:"h-4 w-4"}),"Decline"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Guest will be notified of your decision via email"})]}),C.status==="confirmed"&&r.jsxs(_r,{children:[r.jsx(er,{className:"h-4 w-4 text-green-600"}),r.jsxs(Sr,{children:["Booking confirmed! Make sure you're prepared for check-in on ",wr(new Date(C.check_in),"MMM dd, yyyy"),"."]})]}),C.status==="completed"&&r.jsxs(_r,{children:[r.jsx(tc,{className:"h-4 w-4"}),r.jsx(Sr,{children:r.jsx("p",{className:"text-sm",children:"This booking has been completed. Consider leaving a review for your guest!"})})]})]})]},C.id)};if(a)return r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})});if(n.length===0)return r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Xt,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Bookings Yet"}),r.jsx("p",{className:"text-muted-foreground max-w-sm mx-auto",children:"When guests request to book your property, you'll see their requests here."})]});const y=n.filter(C=>C.status==="pending"),b=n.filter(C=>C.status==="confirmed"),w=n.filter(C=>C.status==="completed"),_=n.filter(C=>C.status==="cancelled");return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:y.length}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Pending"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-green-600",children:b.length}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Confirmed"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-blue-600",children:w.length}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Completed"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-red-600",children:_.length}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Cancelled"})]})})]}),r.jsxs(Kr,{defaultValue:y.length>0?"pending":"all",className:"w-full",children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"all",children:["All (",n.length,")"]}),r.jsxs(Re,{value:"pending",children:["Pending (",y.length,")"]}),r.jsxs(Re,{value:"confirmed",children:["Confirmed (",b.length,")"]}),r.jsxs(Re,{value:"completed",children:["Completed (",w.length,")"]})]}
913),r.jsx(Be,{value:"all",className:"space-y-4 mt-4",children:n.map(g)}),r.jsx(Be,{value:"pending",className:"space-y-4 mt-4",children:y.length>0?y.map(g):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx($r,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No pending booking requests"})]})}),r.jsx(Be,{value:"confirmed",className:"space-y-4 mt-4",children:b.length>0?b.map(g):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(er,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No confirmed bookings"})]})}),r.jsx(Be,{value:"completed",className:"space-y-4 mt-4",children:w.length>0?w.map(g):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(er,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No completed bookings yet"})]})})]})]})},FNe=({propertyId:e})=>{const[t,n]=j.useState(null),[s,a]=j.useState(!0);j.useEffect(()=>{i()},[e]);const i=async()=>{a(!0);try{const l=new Date,c=ci(l),d=bx(l),u=ci(l0(l,30)),h=bx(l0(l,30)),{data:f}=await H.from("properties").select("view_count").eq("id",e).single(),{data:m}=await H.from("bookings").select("*").eq("property_id",e),x=(m==null?void 0:m.filter(L=>L.status==="completed"))||[],p=(m==null?void 0:m.filter(L=>{const z=new Date(L.created_at);return z>=c&&z<=d}))||[],v=(m==null?void 0:m.filter(L=>{const z=new Date(L.created_at);return z>=u&&z<=h}))||[],g=(m==null?void 0:m.filter(L=>L.status==="confirmed"&&new Date(L.check_in)>l))||[],y=x.reduce((L,z)=>L+(z.total_amount||0),0),b=p.filter(L=>L.status==="completed").reduce((L,z)=>L+(z.total_amount||0),0),w=v.filter(L=>L.status==="completed").reduce((L,z)=>L+(z.total_amount||0),0),{data:_}=await H.from("universal_reviews").select("rating").eq("module_type","property").eq("entity_id",e).eq("is_approved",!0),C=_&&_.length>0?_.reduce((L,z)=>L+z.rating,0)/_.length:0,E=v.length>0?(p.length-v.length)/v.length*100:0,N=w>0?(b-w)/w*100:0,k=0,I=0,P=x.length>0?y/x.length:0,O=d.getDate(),R=p.reduce((L,z)=>{const U=new Date(z.check_in),$=new Date(z.check_out),q=Math.ceil(($.getTime()-U.getTime())/(1e3*60*60*24));return L+q},0)/O*100;n({totalViews:k,viewsThisMonth:0,viewsTrend:0,totalBookings:(m==null?void 0:m.length)||0,bookingsThisMonth:p.length,bookingsTrend:E,totalRevenue:y,revenueThisMonth:b,revenueTrend:N,avgRating:Number(C.toFixed(1)),totalReviews:(_==null?void 0:_.length)||0,occupancyRate:Number(R.toFixed(1)),avgBookingValue:Number(P.toFixed(0)),conversionRate:Number(I.toFixed(2)),upcomingBookings:g.length})}catch(l){console.error("Error fetching analytics:",l)}finally{a(!1)}},o=l=>l>0?r.jsxs(te,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(bie,{className:"h-3 w-3"}),"+",l.toFixed(1),"%"]}):l<0?r.jsxs(te,{variant:"destructive",className:"gap-1",children:[r.jsx(vie,{className:"h-3 w-3"}),l.toFixed(1),"%"]}):r.jsx(te,{variant:"secondary",className:"gap-1",children:"0%"});return s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):t?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-3",children:r.jsx(Ae,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(X,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-3xl font-bold",children:t.totalViews}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"All-time property views"})]}),r.jsx(Cr,{className:"h-8 w-8 text-blue-500"})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-3",children:r.jsx(Ae,{className:"text-sm font-medium text-muted-foreground",children:"Total Bookings"})}),r.jsx(X,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-3xl font-bold",children:t.totalBookings}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.bookingsThisMonth," this month"]}),o(t.bookingsTrend)]})]}),r.jsx(Xt,{className:"h-8 w-8 text-green-500"})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-3",children:r.jsx(Ae,{className:"text-sm font-medium text-muted-foreground",children:"Total Revenue"})}),r.jsx(X,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"text-3xl font-bold",children:["â¦",t.totalRevenue.toLocaleStr
913ing()]}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsxs("p",{className:"text-xs text-muted-foreground",children:["â¦",t.revenueThisMonth.toLocaleString()," this month"]}),o(t.revenueTrend)]})]}),r.jsx(Tn,{className:"h-8 w-8 text-yellow-500"})]})})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-3",children:r.jsxs(Ae,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(mr,{className:"h-4 w-4"}),"Average Rating"]})}),r.jsxs(X,{children:[r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsx("div",{className:"text-2xl font-bold",children:t.avgRating}),r.jsx(mr,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[t.totalReviews," review",t.totalReviews!==1?"s":""]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-3",children:r.jsxs(Ae,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(lr,{className:"h-4 w-4"}),"Occupancy Rate"]})}),r.jsxs(X,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[t.occupancyRate,"%"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This month"})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-3",children:r.jsxs(Ae,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Tn,{className:"h-4 w-4"}),"Avg Booking Value"]})}),r.jsxs(X,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:["â¦",t.avgBookingValue.toLocaleString()]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Per booking"})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-3",children:r.jsxs(Ae,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Yr,{className:"h-4 w-4"}),"Conversion Rate"]})}),r.jsxs(X,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[t.conversionRate,"%"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Views to bookings"})]})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-5 w-5"}),"Upcoming Bookings"]})}),r.jsx(X,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-3xl font-bold",children:t.upcomingBookings}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Confirmed bookings ahead"})]}),r.jsxs(te,{variant:"default",className:"text-lg px-4 py-2",children:[t.upcomingBookings," scheduled"]})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(lr,{className:"h-5 w-5"}),"Performance Insights"]})}),r.jsxs(X,{className:"space-y-3",children:[t.conversionRate<5&&r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-yellow-50 dark:bg-yellow-950/20 rounded-lg",children:[r.jsx(lr,{className:"h-5 w-5 text-yellow-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:"Low Conversion Rate"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Consider adding more photos, updating your description, or featuring your property to increase bookings."})]})]}),t.avgRating>0&&t.avgRating<4&&r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-orange-50 dark:bg-orange-950/20 rounded-lg",children:[r.jsx(mr,{className:"h-5 w-5 text-orange-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:"Rating Below Average"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Review guest feedback and consider improvements to amenities, cleanliness, or communication."})]})]}),t.occupancyRate<30&&r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-950/20 rounded-lg",children:[r.jsx(Xt,{className:"h-5 w-5 text-blue-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:"Low Occupancy Rate"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Try adjusting your pricing, enabling instant booking, or promoting your property during peak seasons."})]})]}),t.avgRating>=4.5&&t.totalReviews>=10&&r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-50 dark:bg-green-950/20 rounded-lg",children:[r.jsx(mr,{className:"h-5 w-5 text-green-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:"Great Performance! ð"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"You're eligible for Superhost status! Apply from your property dashboard to boost visibility."})]})]}),t.totalViews===0||t.totalViews>0&&t.totalBookings===0?r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-gray-50 dark:bg-gray-950/20 rounded-lg",children:[r.jsx(Cr,{className:"h-5 w-5 text-gray-600 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:"Getting Started"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t.totalViews===0?"Your property is new! Share your listing on social media and consider featuring it to get more views.":"You're getting views! Add more photos, improve your description, and respond quickly to inquiries."})]})]}):null]})]})]}):r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(Qd,{className:"h-16 w-16 mx-auto mb-4 opacity-50"}
913),r.jsx("p",{children:"Unable to load analytics"})]})};var yr=function(){return yr=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},yr.apply(this,arguments)};function BNe(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n}function SX(e,t,n){for(var s=0,a=t.length,i;s<a;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}function Oj(e){return e.mode==="multiple"}function Lj(e){return e.mode==="range"}function OS(e){return e.mode==="single"}var UNe={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 zNe(e,t){return wr(e,"LLLL y",t)}function qNe(e,t){return wr(e,"d",t)}function VNe(e,t){return wr(e,"LLLL",t)}function WNe(e){return"".concat(e)}function HNe(e,t){return wr(e,"cccccc",t)}function GNe(e,t){return wr(e,"yyyy",t)}var YNe=Object.freeze({__proto__:null,formatCaption:zNe,formatDay:qNe,formatMonthCaption:VNe,formatWeekNumber:WNe,formatWeekdayName:HNe,formatYearCaption:GNe}),KNe=function(e,t,n){return wr(e,"do MMMM (EEEE)",n)},XNe=function(){return"Month: "},ZNe=function(){return"Go to next month"},JNe=function(){return"Go to previous month"},QNe=function(e,t){return wr(e,"cccc",t)},e_e=function(e){return"Week n. ".concat(e)},t_e=function(){return"Year: "},r_e=Object.freeze({__proto__:null,labelDay:KNe,labelMonthDropdown:XNe,labelNext:ZNe,labelPrevious:JNe,labelWeekNumber:e_e,labelWeekday:QNe,labelYearDropdown:t_e});function n_e(){var e="buttons",t=UNe,n=t6,s={},a={},i=1,o={},l=new Date;return{captionLayout:e,classNames:t,formatters:YNe,labels:r_e,locale:n,modifiersClassNames:s,modifiers:a,numberOfMonths:i,styles:o,today:l,mode:"default"}}function s_e(e){var t=e.fromYear,n=e.toYear,s=e.fromMonth,a=e.toMonth,i=e.fromDate,o=e.toDate;return s?i=ci(s):t&&(i=new Date(t,0,1)),a?o=bx(a):n&&(o=new Date(n,11,31)),{fromDate:i?xx(i):void 0,toDate:o?xx(o):void 0}}var kX=j.createContext(void 0);function a_e(e){var t,n=e.initialProps,s=n_e(),a=s_e(n),i=a.fromDate,o=a.toDate,l=(t=n.captionLayout)!==null&&t!==void 0?t:s.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var c;(OS(n)||Oj(n)||Lj(n))&&(c=n.onSelect);var d=yr(yr(yr({},s),n),{captionLayout:l,classNames:yr(yr({},s.classNames),n.classNames),components:yr({},n.components),formatters:yr(yr({},s.formatters),n.formatters),fromDate:i,labels:yr(yr({},s.labels),n.labels),mode:n.mode||s.mode,modifiers:yr(yr({},s.modifiers),n.modifiers),modifiersClassNames:yr(yr({},s.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:yr(yr({},s.styles),n.styles),toDate:o});return r.jsx(kX.Provider,{value:d,children:e.children})}function es(){var e=j.useContext(kX);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function CX(e){var t=es(),n=t.locale,s=t.classNames,a=t.styles,i=t.formatters.formatCaption;return r.jsx("div",{className:s.caption_label,style:a.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:n})})}function i_e(e){return r.jsx("svg",yr({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:r.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.7
91378175,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 AX(e){var t,n,s=e.onChange,a=e.value,i=e.children,o=e.caption,l=e.className,c=e.style,d=es(),u=(n=(t=d.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&n!==void 0?n:i_e;return r.jsxs("div",{className:l,style:c,children:[r.jsx("span",{className:d.classNames.vhidden,children:e["aria-label"]}),r.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:d.classNames.dropdown,style:d.styles.dropdown,value:a,onChange:s,children:i}),r.jsxs("div",{className:d.classNames.caption_label,style:d.styles.caption_label,"aria-hidden":"true",children:[o,r.jsx(u,{className:d.classNames.dropdown_icon,style:d.styles.dropdown_icon})]})]})}function o_e(e){var t,n=es(),s=n.fromDate,a=n.toDate,i=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,d=n.components,u=n.labels.labelMonthDropdown;if(!s)return r.jsx(r.Fragment,{});if(!a)return r.jsx(r.Fragment,{});var h=[];if(Lwe(s,a))for(var f=ci(s),m=s.getMonth();m<=a.getMonth();m++)h.push(wk(f,m));else for(var f=ci(new Date),m=0;m<=11;m++)h.push(wk(f,m));var x=function(v){var g=Number(v.target.value),y=wk(ci(e.displayMonth),g);e.onChange(y)},p=(t=d==null?void 0:d.Dropdown)!==null&&t!==void 0?t:AX;return r.jsx(p,{name:"months","aria-label":u(),className:c.dropdown_month,style:i.dropdown_month,onChange:x,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:o}),children:h.map(function(v){return r.jsx("option",{value:v.getMonth(),children:l(v,{locale:o})},v.getMonth())})})}function l_e(e){var t,n=e.displayMonth,s=es(),a=s.fromDate,i=s.toDate,o=s.locale,l=s.styles,c=s.classNames,d=s.components,u=s.formatters.formatYearCaption,h=s.labels.labelYearDropdown,f=[];if(!a)return r.jsx(r.Fragment,{});if(!i)return r.jsx(r.Fragment,{});for(var m=a.getFullYear(),x=i.getFullYear(),p=m;p<=x;p++)f.push(t8(uX(new Date),p));var v=function(y){var b=t8(ci(n),Number(y.target.value));e.onChange(b)},g=(t=d==null?void 0:d.Dropdown)!==null&&t!==void 0?t:AX;return r.jsx(g,{name:"years","aria-label":h(),className:c.dropdown_year,style:l.dropdown_year,onChange:v,value:n.getFullYear(),caption:u(n,{locale:o}),children:f.map(function(y){return r.jsx("option",{value:y.getFullYear(),children:u(y,{locale:o})},y.getFullYear())})})}function c_e(e,t){var n=j.useState(e),s=n[0],a=n[1],i=t===void 0?s:t;return[i,a]}function d_e(e){var t=e.month,n=e.defaultMonth,s=e.today,a=t||n||s||new Date,i=e.toDate,o=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(i&&yx(i,a)<0){var d=-1*(c-1);a=ic(i,d)}return o&&yx(a,o)<0&&(a=o),ci(a)}function u_e(){var e=es(),t=d_e(e),n=c_e(t,e.month),s=n[0],a=n[1],i=function(o){var l;if(!e.disableNavigation){var c=ci(o);a(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[s,i]}function h_e(e,t){for(var n=t.reverseMonths,s=t.numberOfMonths,a=ci(e),i=ci(ic(a,s)),o=yx(i,a),l=[],c=0;c<o;c++){var d=ic(a,c);l.push(d)}return n&&(l=l.reverse()),l}function f_e(e,t){if(!t.disableNavigation){var n=t.toDate,s=t.pagedNavigation,a=t.numberOfMonths,i=a===void 0?1:a,o=s?i:1,l=ci(e);if(!n)return ic(l,o);var c=yx(n,e);if(!(c<i))return ic(l,o)}}function m_e(e,t){if(!t.disableNavigation){var n=t.fromDate,s=t.pagedNavigation,a=t.numberOfMonths,i=a===void 0?1:a,o=s?i:1,l=ci(e);if(!n)return ic(l,-o);var c=yx(l,n);if(!(c<=0))return ic(l,-o)}}var PX=j.createContext(void 0);function p_e(e){var t=es(),n=u_e(),s=n[0],a=n[1],i=h_e(s,t),o=f_e(s,t),l=m_e(s,t),c=function(h){return i.some(function(f){return r6(h,f)})},d=function(h,f){c(h)||(f&&xX(h,f)?a(ic(h,1+t.numberOfMonths*-1)):a(h))},u={currentMonth:s,displayMonths:i,goToMonth:a,goToDate:d,previousMonth:l,nextMonth:o,isDateDisplayed:c};return r.jsx(PX.Provider,{value:u,children:e.children})}function Ij(){var e=j.useContext(PX);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function o8(e){var t,n=es(),s=n.classNames,a=n.styles,i=n.components,o=Ij().goToMonth,l=function(u){o(ic(u,e.displayIndex?-e.dis
913playIndex:0))},c=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:CX,d=r.jsx(c,{id:e.id,displayMonth:e.displayMonth});return r.jsxs("div",{className:s.caption_dropdowns,style:a.caption_dropdowns,children:[r.jsx("div",{className:s.vhidden,children:d}),r.jsx(o_e,{onChange:l,displayMonth:e.displayMonth}),r.jsx(l_e,{onChange:l,displayMonth:e.displayMonth})]})}function g_e(e){return r.jsx("svg",yr({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:r.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 x_e(e){return r.jsx("svg",yr({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:r.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 x_=j.forwardRef(function(e,t){var n=es(),s=n.classNames,a=n.styles,i=[s.button_reset,s.button];e.className&&i.push(e.className);var o=i.join(" "),l=yr(yr({},a.button_reset),a.button);return e.style&&Object.assign(l,e.style),r.jsx("button",yr({},e,{ref:t,type:"button",className:o,style:l}))});function v_e(e){var t,n,s=es(),a=s.dir,i=s.locale,o=s.classNames,l=s.styles,c=s.labels,d=c.labelPrevious,u=c.labelNext,h=s.components;if(!e.nextMonth&&!e.previousMonth)return r.jsx(r.Fragment,{});var f=d(e.previousMonth,{locale:i}),m=[o.nav_button,o.nav_button_previous].join(" "),x=u(e.nextMonth,{locale:i}),p=[o.nav_button,o.nav_button_next].join(" "),v=(t=h==null?void 0:h.IconRight)!==null&&t!==void 0?t:x_e,g=(n=h==null?void 0:h.IconLeft)!==null&&n!==void 0?n:g_e;return r.jsxs("div",{className:o.nav,style:l.nav,children:[!e.hidePrevious&&r.jsx(x_,{name:"previous-month","aria-label":f,className:m,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:a==="rtl"?r.jsx(v,{className:o.nav_icon,style:l.nav_icon}):r.jsx(g,{className:o.nav_icon,style:l.nav_icon})}),!e.hideNext&&r.jsx(x_,{name:"next-month","aria-label":x,className:p,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:a==="rtl"?r.jsx(g,{className:o.nav_icon,style:l.nav_icon}):r.jsx(v,{className:o.nav_icon,style:l.nav_icon})})]})}function l8(e){var t=es().numberOfMonths,n=Ij(),s=n.previousMonth,a=n.nextMonth,i=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(x){return r6(e.displayMonth,x)}),c=l===0,d=l===o.length-1,u=t>1&&(c||!d),h=t>1&&(d||!c),f=function(){s&&i(s)},m=function(){a&&i(a)};return r.jsx(v_e,{displayMonth:e.displayMonth,hideNext:u,hidePrevious:h,nextMonth:a,previousMonth:s,onPreviousClick:f,onNextClick:m})}function y_e(e){var t,n=es(),s=n.classNames,a=n.disableNavigation,i=n.styles,o=n.captionLayout,l=n.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:CX,d;return a?d=r.jsx(c,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?d=r.jsx(o8,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?d=r.jsxs(r.Fragment,{children:[r.jsx(o8,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),r.jsx(l8,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):d=r.jsxs(r.Fragment,{children:[r.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(l8,{displayMonth:e.displayMonth,id:e.id})]}),r.jsx("div",{className:s.caption,style:i.caption,children:d})}function b_e(e){var t=es(),n=t.footer,s=t.styles,a=t.classNames.tfoot;return n?r.jsx("tfoot",{className:a,style:s.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:n})})}):r.jsx(r.Fragment,{})}function j_e(e,t,n){for(var s=n?Lm(new Date):rd(new Date,{locale:e,weekStartsOn:t}),a=[],i=0;i<7;i++){var o=ma(s,i);a.push(o)}return a}function w_e(){var e=es(),t=e.classNames,n=e.styles,s=e.showWeekNumber,a=e.locale,i=e.weekStartsOn,o=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,d=j_e(a,i,o);return r.jsxs("tr",{style:n.head_row,className:t.head_row,children:[s&&r.jsx("td",{style:n.head_cell,className:t.head_cell}),d.map(function(u,h){return r.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":c(u,{locale:a}),children:l(u,{locale:a})},h)})]})}function N_e(){var e,t=es(),n=t.classNames,s=t.styles,a=t.components,i=(e=a==null?void 0:a.HeadRow)!==null&&e!==void 0?e:w_e;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(i,{})})}function __e(e){var t=es(),n=t.locale,s=t.formatters.formatDay;return r.jsx(r.Fragment,{children:s(e.date,{locale:n})})}var h6=j.createContext(void 0);function S_e(e){if(!Oj(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return r.jsx(h6.Provider,{value:t,children:e.children})}return r.jsx(k_e,{initialProps:e.initialProps,children:e.children})}function k_e(e){var t=e.initialProps,n=e.children,s=t.selected,a=t.min,i=t.max,o=function(d,u,h){var f,m;(f=t.onDayClick)===null||f===void 0||f.call(t,d,u,h);var x=!!(u.selected&&a&&(s==null?void 0:s.length)===a);if(!x){var p=!!(!u.selected&&i&&(s==null?void 0:s.length)===i);if(!p){var v=s?SX([],s):[];if(u.selected){var g=v.findIndex(function(y){return Ua(d,y)});v.splice(g,1)}else v.push(d);(m=t.onSelect)===null||m===void 0||m.call(t,v,d,u,h)}}},l={disabled:[]};s&&l.disabled.push(function(d){var u=i&&s.length>i-1,h=s.some(function(f){return Ua(f,d)});return!!(u&&!h)});
913var c={selected:s,onDayClick:o,modifiers:l};return r.jsx(h6.Provider,{value:c,children:n})}function f6(){var e=j.useContext(h6);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function C_e(e,t){var n=t||{},s=n.from,a=n.to;return s&&a?Ua(a,e)&&Ua(s,e)?void 0:Ua(a,e)?{from:a,to:void 0}:Ua(s,e)?void 0:DP(s,e)?{from:e,to:a}:{from:s,to:e}:a?DP(e,a)?{from:a,to:e}:{from:e,to:a}:s?xX(e,s)?{from:e,to:s}:{from:s,to:e}:{from:e,to:void 0}}var m6=j.createContext(void 0);function A_e(e){if(!Lj(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(m6.Provider,{value:t,children:e.children})}return r.jsx(P_e,{initialProps:e.initialProps,children:e.children})}function P_e(e){var t=e.initialProps,n=e.children,s=t.selected,a=s||{},i=a.from,o=a.to,l=t.min,c=t.max,d=function(m,x,p){var v,g;(v=t.onDayClick)===null||v===void 0||v.call(t,m,x,p);var y=C_e(m,s);(g=t.onSelect)===null||g===void 0||g.call(t,y,m,x,p)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],o?(u.range_end=[o],Ua(i,o)||(u.range_middle=[{after:i,before:o}])):u.range_end=[i]):o&&(u.range_start=[o],u.range_end=[o]),l&&(i&&!o&&u.disabled.push({after:l0(i,l-1),before:ma(i,l-1)}),i&&o&&u.disabled.push({after:i,before:ma(i,l-1)}),!i&&o&&u.disabled.push({after:l0(o,l-1),before:ma(o,l-1)})),c){if(i&&!o&&(u.disabled.push({before:ma(i,-c+1)}),u.disabled.push({after:ma(i,c-1)})),i&&o){var h=Gl(o,i)+1,f=c-h;u.disabled.push({before:l0(i,f)}),u.disabled.push({after:ma(o,f)})}!i&&o&&(u.disabled.push({before:ma(o,-c+1)}),u.disabled.push({after:ma(o,c-1)}))}return r.jsx(m6.Provider,{value:{selected:s,onDayClick:d,modifiers:u},children:n})}function p6(){var e=j.useContext(m6);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function aN(e){return Array.isArray(e)?SX([],e):e!==void 0?[e]:[]}function E_e(e){var t={};return Object.entries(e).forEach(function(n){var s=n[0],a=n[1];t[s]=aN(a)}),t}var oc;(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"})(oc||(oc={}));var T_e=oc.Selected,wd=oc.Disabled,O_e=oc.Hidden,L_e=oc.Today,_k=oc.RangeEnd,Sk=oc.RangeMiddle,kk=oc.RangeStart,I_e=oc.Outside;function R_e(e,t,n){var s,a=(s={},s[T_e]=aN(e.selected),s[wd]=aN(e.disabled),s[O_e]=aN(e.hidden),s[L_e]=[e.today],s[_k]=[],s[Sk]=[],s[kk]=[],s[I_e]=[],s);return e.fromDate&&a[wd].push({before:e.fromDate}),e.toDate&&a[wd].push({after:e.toDate}),Oj(e)?a[wd]=a[wd].concat(t.modifiers[wd]):Lj(e)&&(a[wd]=a[wd].concat(n.modifiers[wd]),a[kk]=n.modifiers[kk],a[Sk]=n.modifiers[Sk],a[_k]=n.modifiers[_k]),a}var EX=j.createContext(void 0);function M_e(e){var t=es(),n=f6(),s=p6(),a=R_e(t,n,s),i=E_e(t.modifiers),o=yr(yr({},a),i);return r.jsx(EX.Provider,{value:o,children:e.children})}function TX(){var e=j.useContext(EX);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function D_e(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function $_e(e){return!!(e&&typeof e=="object"&&"from"in e)}function F_e(e){return!!(e&&typeof e=="object"&&"after"in e)}function B_e(e){return!!(e&&typeof e=="object"&&"before"in e)}function U_e(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function z_e(e,t){var n,s=t.from,a=t.to;if(s&&a){var i=Gl(a,s)<0;i&&(n=[a,s],s=n[0],a=n[1]);var o=Gl(e,s)>=0&&Gl(a,e)>=0;return o}return a?Ua(a,e):s?Ua(s,e):!1}function q_e(e){return QO(e)}function V_e(e){return Array.isArray(e)&&e.every(QO)}function W_e(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(q_e(n))return Ua(e,n);if(V_e(n))return n.includes(e);if($_e(n))return z_e(e,n);if(U_e(n))return n.dayOfWeek.includes(e.getDay());if(D_e(n)){var s=Gl(n.before,e),a=Gl(n.after,e),i=s>0,o=a<0,l=DP(n.before,n.after);return l?o&&i:i||o}return F_e(n)?Gl(e,n.after)>0:B_e(n)?Gl(n.before,e)>0:typeof n=="function"?n(e):!1})}function g6(e,t,n){var s=Object.keys(t).reduce(function(i,o){var l=t[o];return W_e(e,l)&&i.push(o),i},[]),a={};
913return s.forEach(function(i){return a[i]=!0}),n&&!r6(e,n)&&(a.outside=!0),a}function H_e(e,t){for(var n=ci(e[0]),s=bx(e[e.length-1]),a,i,o=n;o<=s;){var l=g6(o,t),c=!l.disabled&&!l.hidden;if(!c){o=ma(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),a||(a=o),o=ma(o,1)}return i||a}var G_e=365;function OX(e,t){var n=t.moveBy,s=t.direction,a=t.context,i=t.modifiers,o=t.retry,l=o===void 0?{count:0,lastFocused:e}:o,c=a.weekStartsOn,d=a.fromDate,u=a.toDate,h=a.locale,f={day:ma,week:MP,month:ic,year:wje,startOfWeek:function(v){return a.ISOWeek?Lm(v):rd(v,{locale:h,weekStartsOn:c})},endOfWeek:function(v){return a.ISOWeek?hX(v):e6(v,{locale:h,weekStartsOn:c})}},m=f[n](e,s==="after"?1:-1);s==="before"&&d?m=Nje([d,m]):s==="after"&&u&&(m=_je([u,m]));var x=!0;if(i){var p=g6(m,i);x=!p.disabled&&!p.hidden}return x?m:l.count>G_e?l.lastFocused:OX(m,{moveBy:n,direction:s,context:a,modifiers:i,retry:yr(yr({},l),{count:l.count+1})})}var LX=j.createContext(void 0);function Y_e(e){var t=Ij(),n=TX(),s=j.useState(),a=s[0],i=s[1],o=j.useState(),l=o[0],c=o[1],d=H_e(t.displayMonths,n),u=a??(l&&t.isDateDisplayed(l))?l:d,h=function(){c(a),i(void 0)},f=function(v){i(v)},m=es(),x=function(v,g){if(a){var y=OX(a,{moveBy:v,direction:g,context:m,modifiers:n});Ua(a,y)||(t.goToDate(y,a),f(y))}},p={focusedDay:a,focusTarget:u,blur:h,focus:f,focusDayAfter:function(){return x("day","after")},focusDayBefore:function(){return x("day","before")},focusWeekAfter:function(){return x("week","after")},focusWeekBefore:function(){return x("week","before")},focusMonthBefore:function(){return x("month","before")},focusMonthAfter:function(){return x("month","after")},focusYearBefore:function(){return x("year","before")},focusYearAfter:function(){return x("year","after")},focusStartOfWeek:function(){return x("startOfWeek","before")},focusEndOfWeek:function(){return x("endOfWeek","after")}};return r.jsx(LX.Provider,{value:p,children:e.children})}function x6(){var e=j.useContext(LX);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function K_e(e,t){var n=TX(),s=g6(e,n,t);return s}var v6=j.createContext(void 0);function X_e(e){if(!OS(e.initialProps)){var t={selected:void 0};return r.jsx(v6.Provider,{value:t,children:e.children})}return r.jsx(Z_e,{initialProps:e.initialProps,children:e.children})}function Z_e(e){var t=e.initialProps,n=e.children,s=function(i,o,l){var c,d,u;if((c=t.onDayClick)===null||c===void 0||c.call(t,i,o,l),o.selected&&!t.required){(d=t.onSelect)===null||d===void 0||d.call(t,void 0,i,o,l);return}(u=t.onSelect)===null||u===void 0||u.call(t,i,i,o,l)},a={selected:t.selected,onDayClick:s};return r.jsx(v6.Provider,{value:a,children:n})}function IX(){var e=j.useContext(v6);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function J_e(e,t){var n=es(),s=IX(),a=f6(),i=p6(),o=x6(),l=o.focusDayAfter,c=o.focusDayBefore,d=o.focusWeekAfter,u=o.focusWeekBefore,h=o.blur,f=o.focus,m=o.focusMonthBefore,x=o.focusMonthAfter,p=o.focusYearBefore,v=o.focusYearAfter,g=o.focusStartOfWeek,y=o.focusEndOfWeek,b=function(U){var $,q,ne,se;OS(n)?($=s.onDayClick)===null||$===void 0||$.call(s,e,t,U):Oj(n)?(q=a.onDayClick)===null||q===void 0||q.call(a,e,t,U):Lj(n)?(ne=i.onDayClick)===null||ne===void 0||ne.call(i,e,t,U):(se=n.onDayClick)===null||se===void 0||se.call(n,e,t,U)},w=function(U){var $;f(e),($=n.onDayFocus)===null||$===void 0||$.call(n,e,t,U)},_=function(U){var $;h(),($=n.onDayBlur)===null||$===void 0||$.call(n,e,t,U)},C=function(U){var $;($=n.onDayMouseEnter)===null||$===void 0||$.call(n,e,t,U)},E=function(U){var $;($=n.onDayMouseLeave)===null||$===void 0||$.call(n,e,t,U)},N=function(U){var $;($=n.onDayPointerEnter)===null||$===void 0||$.call(n,e,t,U)},k=function(U){var $;($=n.onDayPointerLeave)===null||$===void 0||$.call(n,e,t,U)},I=function(U){var $;($=n.onDayTouchCancel)===null||$===void 0||$.call(n,e,t,U)},P=function(U){var $;($=n.onDayTouchEnd)===null||$===void 0||$.call(n,e,t,U)},O=function(U){var $;($=n.onDayTouchMove)===null||$===void 0||$.call(n,e,t,U)},A=function(U){var $;($=n.onDayTouchStart)===null||$===void 0||$.call(n,e,t,U)},R=function(U){var $;($=n.onDayKeyUp)===null||$===void 0||$.call(n,e,t,U)},L=function(U){var $;switch(U.key){case"ArrowLeft":U.preventDefault(),U.stopPropagation(),n.dir==="rtl"?l(
913):c();break;case"ArrowRight":U.preventDefault(),U.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":U.preventDefault(),U.stopPropagation(),d();break;case"ArrowUp":U.preventDefault(),U.stopPropagation(),u();break;case"PageUp":U.preventDefault(),U.stopPropagation(),U.shiftKey?p():m();break;case"PageDown":U.preventDefault(),U.stopPropagation(),U.shiftKey?v():x();break;case"Home":U.preventDefault(),U.stopPropagation(),g();break;case"End":U.preventDefault(),U.stopPropagation(),y();break}($=n.onDayKeyDown)===null||$===void 0||$.call(n,e,t,U)},z={onClick:b,onFocus:w,onBlur:_,onKeyDown:L,onKeyUp:R,onMouseEnter:C,onMouseLeave:E,onPointerEnter:N,onPointerLeave:k,onTouchCancel:I,onTouchEnd:P,onTouchMove:O,onTouchStart:A};return z}function Q_e(){var e=es(),t=IX(),n=f6(),s=p6(),a=OS(e)?t.selected:Oj(e)?n.selected:Lj(e)?s.selected:void 0;return a}function e2e(e){return Object.values(oc).includes(e)}function t2e(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(s){var a=e.modifiersClassNames[s];if(a)n.push(a);else if(e2e(s)){var i=e.classNames["day_".concat(s)];i&&n.push(i)}}),n}function r2e(e,t){var n=yr({},e.styles.day);return Object.keys(t).forEach(function(s){var a;n=yr(yr({},n),(a=e.modifiersStyles)===null||a===void 0?void 0:a[s])}),n}function n2e(e,t,n){var s,a,i,o=es(),l=x6(),c=K_e(e,t),d=J_e(e,c),u=Q_e(),h=!!(o.onDayCl
913ick||o.mode!=="default");j.useEffect(function(){var C;c.outside||l.focusedDay&&h&&Ua(l.focusedDay,e)&&((C=n.current)===null||C===void 0||C.focus())},[l.focusedDay,e,n,h,c.outside]);var f=t2e(o,c).join(" "),m=r2e(o,c),x=!!(c.outside&&!o.showOutsideDays||c.hidden),p=(i=(a=o.components)===null||a===void 0?void 0:a.DayContent)!==null&&i!==void 0?i:__e,v=r.jsx(p,{date:e,displayMonth:t,activeModifiers:c}),g={style:m,className:f,children:v,role:"gridcell"},y=l.focusTarget&&Ua(l.focusTarget,e)&&!c.outside,b=l.focusedDay&&Ua(l.focusedDay,e),w=yr(yr(yr({},g),(s={disabled:c.disabled,role:"gridcell"},s["aria-selected"]=c.selected,s.tabIndex=b||y?0:-1,s)),d),_={isButton:h,isHidden:x,activeModifiers:c,selectedDays:u,buttonProps:w,divProps:g};return _}function s2e(e){var t=j.useRef(null),n=n2e(e.date,e.displayMonth,t);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(x_,yr({name:"day",ref:t},n.buttonProps)):r.jsx("div",yr({},n.divProps))}function a2e(e){var t=e.number,n=e.dates,s=es(),a=s.onWeekNumberClick,i=s.styles,o=s.classNames,l=s.locale,c=s.labels.labelWeekNumber,d=s.formatters.formatWeekNumber,u=d(Number(t),{locale:l});if(!a)return r.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:u});var h=c(Number(t),{locale:l}),f=function(m){a(t,n,m)};return r.jsx(x_,{name:"week-number","aria-label":h,className:o.weeknumber,style:i.weeknumber,onClick:f,children:u})}function i2e(e){var t,n,s=es(),a=s.styles,i=s.classNames,o=s.showWeekNumber,l=s.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:s2e,d=(n=l
913==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:a2e,u;return o&&(u=r.jsx("td",{className:i.cell,style:a.cell,children:r.jsx(d,{number:e.weekNumber,dates:e.dates})})),r.jsxs("tr",{className:i.row,style:a.row,children:[u,e.dates.map(function(h){return r.jsx("td",{className:i.cell,style:a.cell,role:"presentation",children:r.jsx(c,{displayMonth:e.displayMonth,date:h})},Ewe(h))})]})}function c8(e,t,n){for(var s=n!=null&&n.ISOWeek?hX(t):e6(t,n),a=n!=null&&n.ISOWeek?Lm(e):rd(e,n),i=Gl(s,a),o=[],l=0;l<=i;l++)o.push(ma(a,l));var c=o.reduce(function(d,u){var h=n!=null&&n.ISOWeek?fX(u):pX(u,n),f=d.find(function(m){return m.weekNumber===h});return f?(f.dates.push(u),d):(d.push({weekNumber:h,dates:[u]}),d)},[]);return c}function o2e(e,t){var n=c8(ci(e),bx(e),t);if(t!=null&&t.useFixedWeeks){var s=Owe(e,t);if(s<6){var a=n[n.length-1],i=a.dates[a.dates.length-1],o=MP(i,6-s),l=c8(MP(i,1),o,t);n.push.apply(n,l)}}return n}function l2e(e){var t,n,s,a=es(),i=a.locale,o=a.classNames,l=a.styles,c=a.hideHead,d=a.fixedWeeks,u=a.components,h=a.weekStartsOn,f=a.firstWeekContainsDate,m=a.ISOWeek,x=o2e(e.displayMonth,{useFixedWeeks:!!d,ISOWeek:m,locale:i,weekStartsOn:h,firstWeekContainsDate:f}),p=(t=u==null?void 0:u.Head)!==null&&t!==void 0?t:N_e,v=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:i2e,g=(s=u==null?void 0:u.Footer)!==null&&s!==void 0?s:b_e;return r.jsxs("table",{id:e.id,className:o.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&r.jsx(p,{}),r.jsx("tbody",{className:o.tbody,style:l.tbody,children:x.map(function(y){return r.jsx(v,{displayMonth:e.displayMonth,dates:y.dates,weekNumber:y.weekNumber},y.weekNumber)})}),r.jsx(g,{displayMonth:e.displayMonth})]})}function c2e(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var d2e=c2e()?j.useLayoutEffect:j.useEffect,Ck=!1,u2e=0;function d8(){return"react-day-picker-".concat(++u2e)}function h2e(e){var t,n=e??(Ck?d8():null),s=j.useState(n),a=s[0],i=s[1];return d2e(function(){a===null&&i(d8())},[]),j.useEffect(function(){Ck===!1&&(Ck=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function f2e(e){var t,n,s=es(),a=s.dir,i=s.classNames,o=s.styles,l=s.components,c=Ij().displayMonths,d=h2e(s.id?"".concat(s.id,"-").concat(e.displayIndex):void 0),u=s.id?"".concat(s.id,"-grid-").concat(e.displayIndex):void 0,h=[i.month],f=o.month,m=e.displayIndex===0,x=e.displayIndex===c.length-1,p=!m&&!x;a==="rtl"&&(t=[m,x],x=t[0],m=t[1]),m&&(h.push(i.caption_start),f=yr(yr({},f),o.caption_start)),x&&(h.push(i.caption_end),f=yr(yr({},f),o.caption_end)),p&&(h.push(i.caption_between),f=yr(yr({},f),o.caption_between));var v=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:y_e;return r.jsxs("div",{className:h.join(" "),style:f,children:[r.jsx(v,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(l2e,{id:u,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function m2e(e){var t=es(),n=t.classNames,s=t.styles;return r.jsx("div",{className:n.months,style:s.months,children:e.children})}function p2e(e){var t,n,s=e.initialProps,a=es(),i=x6(),o=Ij(),l=j.useState(!1),c=l[0],d=l[1];j.useEffect(function(){a.initialFocus&&i.focusTarget&&(c||(i.focus(i.focusTarget),d(!0)))},[a.initialFocus,c,i.focus,i.focusTarget,i]);var u=[a.classNames.root,a.className];a.numberOfMonths>1&&u.push(a.classNames.multiple_months),a.showWeekNumber&&u.push(a.classNames.with_weeknumber);var h=yr(yr({},a.styles.root),a.style),f=Object.keys(s).filter(function(x){return x.startsWith("data-")}).reduce(function(x,p){var v;return yr(yr({},x),(v={},v[p]=s[p],v))},{}),m=(n=(t=s.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:m2e;return r.jsx("div",yr({className:u.join(" "),style:h,dir:a.dir,id:a.id,nonce:s.nonce,title:s.title,lang:s.lang},f,{children:r.jsx(m,{children:o.displayMonths.map(function(x,p){return r.jsx(f2e,{displayIndex:p,displayMonth:x},p)})})}))}function g2e(e){var t=e.children,n=BNe(e,["children"]);return r.jsx(a_e,{initialProps:n,children:r.jsx(p_e,{children:r.jsx(X_e,{initialProps:n,children:r.jsx(S_e,{initialProps:n,children:r.jsx(A_e,{initialProps:n,children:r.jsx(M_e,{children:r.jsx(Y_e,{children:t})})})})})})})}function x2e(e){return r.jsx(g2e,yr({},e,{children:r.jsx(p2e,{initialProps:e})}))}function RX({className:e,classNames:t,showOutsideDays:n=!0,...s}){return r.jsx(x2e,{showOutsideDays:n,className:Ge("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:sp
913ace-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Ge(H0({variant:"outline"}),"h-7 w-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-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Ge(H0({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",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 opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",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:({...a})=>r.jsx(kie,{className:"h-4 w-4"}),IconRight:({...a})=>r.jsx(ax,{className:"h-4 w-4"})},...s})}RX.displayName="Calendar";const v2e=({propertyId:e,basePrice:t,isOwner:n=!1})=>{var _,C;const[s,a]=j.useState([]),[i,o]=j.useState(),[l,c]=j.useState(!1),[d,u]=j.useState(null),[h,f]=j.useState(!1),{toast:m}=Sn();j.useEffect(()=>{x()},[e]);const x=async()=>{try{const E=new Date,N=ma(E,365),{data:k,error:I}=await H.from("property_availability").select("*").eq("property_id",e).gte("date",wr(E,"yyyy-MM-dd")).lte("date",wr(N,"yyyy-MM-dd")).order("date");if(I)throw I;const P=new Map((k==null?void 0:k.map(A=>[A.date,A]))||[]),O=[];for(let A=new Date(E);A<=N;A=ma(A,1)){const R=wr(A,"yyyy-MM-dd"),L=P.get(R);O.push({date:new Date(A),isAvailable:(L==null?void 0:L.is_available)??!0,priceOverride:(L==null?void 0:L.price_override)||void 0,minNights:(L==null?void 0:L.min_nights)||void 0,maxNights:(L==null?void 0:L.max_nights)||void 0})}a(O)}catch(E){console.error("Error fetching availability:",E)}},p=async E=>{if(n){f(!0);try{const{error:N}=await H.from("property_availability").upsert({property_id:e,date:wr(E.date,"yyyy-MM-dd"),is_available:E.isAvailable,price_override:E.priceOverride||null,min_nights:E.minNights||null,max_nights:E.maxNights||null});if(N)throw N;await x(),m({title:"Availability updated successfully"}),c(!1)}catch(N){console.error("Error updating availability:",N),m({title:"Error updating availability",variant:"destructive"})}finally{f(!1)}}},v=E=>s.find(N=>Ua(N.date,E)),g=E=>{if(!n)return;const N=v(E)||{date:E,isAvailable:!0,priceOverride:void 0,minNights:void 0,maxNights:void 0};u(N),c(!0)},y={unavailable:E=>{const N=v(E);return!(N!=null&&N.isAvailable)},priceOverride:E=>{const N=v(E);return!!(N!=null&&N.priceOverride)}},b={unavailable:{backgroundColor:"hsl(var(--destructive))",color:"hsl(var(--destructive-foreground))"},priceOverride:{backgroundColor:"hsl(var(--primary))",color:"hsl(var(--primary-foreground))"}},w=E=>{const N=v(E);return(N==null?void 0:N.priceOverride)||t};return r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-5 w-5"}),n?"Manage Availability":"Availability & Pricing"]})}),r.jsxs(X,{children:[r.jsxs("div",{className:"space-y-4",children:[!n&&r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 bg-primary rounded"}),r.jsx("span",{children:"Custom Price"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 bg-destructive rounded"}),r.jsx("span",{children:"Unavailable"})]})]}
913),r.jsx(RX,{mode:"single",selected:i,onSelect:o,onDayClick:g,modifiers:y,modifiersStyles:b,className:"rounded-md border pointer-events-auto",disabled:!n}),i&&r.jsx(Y,{children:r.jsx(X,{className:"pt-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Date:"}),r.jsx("span",{children:wr(i,"PPP")})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Price:"}),r.jsxs("span",{className:"font-semibold",children:["â¦",w(i).toLocaleString(),"/night"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Status:"}),r.jsx(te,{variant:(_=v(i))!=null&&_.isAvailable?"default":"destructive",children:(C=v(i))!=null&&C.isAvailable?"Available":"Unavailable"})]})]})})})]}),r.jsx(Rt,{open:l,onOpenChange:c,children:r.jsxs(Ot,{children:[r.jsx(Mt,{children:r.jsxs(Dt,{children:["Edit Availability - ",d&&wr(d.date,"PPP")]})}),d&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("input",{type:"checkbox",id:"available",checked:d.isAvailable,onChange:E=>u({...d,isAvailable:E.target.checked})}),r.jsx(le,{htmlFor:"available",children:"Available for booking"})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"priceOverride",children:"Custom Price (â¦)"}),r.jsx(ge,{id:"priceOverride",type:"number",placeholder:`Default: â¦${t}`,value:d.priceOverride||"",onChange:E=>u({...d,priceOverride:E.target.value?Number(E.target.value):void 0})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"minNights",children:"Min Nights"}),r.jsx(ge,{id:"minNights",type:"number",placeholder:"Default",value:d.minNights||"",onChange:E=>u({...d,minNights:E.target.value?Number(E.target.value):void 0})})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"maxNights",children:"Max Nights"}),r.jsx(ge,{id:"maxNights",type:"number",placeholder:"Default",value:d.maxNights||"",onChange:E=>u({...d,maxNights:E.target.value?Number(E.target.value):void 0})})]})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(W,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),r.jsx(W,{onClick:()=>p(d),disabled:h,children:h?"Saving...":"Save Changes"})]})]})]})})]})]})},y2e=({onUpgradeNeeded:e,showUpgradeDialog:t=!1,onCloseUpgrade:n})=>{const{user:s}=bt(),{toast:a}=Sn(),[i,o]=j.useState(null),[l,c]=j.useState(!1);j.useEffect(()=>{s&&d()},[s]);const d=async()=>{if(s)try{const{data:x,error:p}=await H.rpc("check_property_limits",{user_id:s.id}).single();if(p)throw p;o(x)}catch(x){console.error("Error fetching limits:",x)}},u=()=>i?i.can_create_listing?!0:(e==null||e(),a({title:"Listing limit reached",description:`You've reached your limit of ${i.max_listings} listing${i.max_listings===1?"":"s"}. Upgrade to Pro for more!`,variant:"destructive"}),!1):!1,h=()=>i?i.can_feature_listing?!0:(e==null||e(),a({title:"Featured listing limit reached",description:"Upgrade to Pro to feature listings and get more visibility!",variant:"destructive"}),!1):!1;j.useLayoutEffect(()=>(window.checkCanCreateListing=u,window.checkCanFeatureListing=h,()=>{delete window.checkCanCreateListing,delete window.checkCanFeatureListing}),[i]);const f=async()=>{c(!0);try{const{data:x,error:p}=await H.functions.invoke("create-subscription",{body:{plan_type:"pro"}});if(p)throw p;x.authorization_url&&window.open(x.authorization_url,"_blank")}catch(x){console.error("Error creating subscription:",x),a({title:"Error starting subscription",variant:"destructive"})}finally{c(!1)}};if(!i)return null;const m=i.max_listings>1;return r.jsxs(r.Fragment,{children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"flex items-center gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(yh,{className:"h-5 w-5 text-yellow-600"}),"Pro Plan"]}):r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-5 w-5"}),"Free Plan"]})})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Property Listings"}),r.jsxs("span",{children:[i.current_listings," / ",i.max_listings]})]}),r.jsx(gx,{value:i.current_listings/i.max_listings*100,className:"h-2"})]}),m&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Featured Listings"}),r.jsxs("span",{children:[i.current_featured," / ",i.featured_allowed]})]}),r.jsx(gx,{value:i.featured_allowed>0?i.current_featured/i.featured_allowed*100:0,className:"h-2"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[r.jsxs("div",{className:"text-center p-3 bg-muted rounded-lg",children:[r.jsx(en,{className:"h-6 w-6 mx-auto mb-2"}),r.jsx("div",{className:"text-sm font-medium",children:"Max Listings"}),r.jsx("div",{className:"text-lg font-bold",children:i.max_listings})]}),r.jsxs("div",{className:"text-center p-3 bg-muted rounded-lg",children:[r.jsx(no,{className:"h-6 w-6 mx-auto mb-2"}),r.jsx("div",{className:"text-sm font-medium",children:"Photos per Listing"}),r.jsx("div",{className:"text-lg font-bold",children:m?"20":"3"})]})]}),!m&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(ui,{className:"h-4 w-4 text-yellow-600"}),"Upgrade to Pro"]}),r.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:"â"})," 10 property listings"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:"â"})," 20 photos per listing"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:"â"})," 2 featured listings"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:"â"})," Priority support"]})]}),r.jsxs(W,{className:"w-full",onClick:()=>e==null?void 0:e(),variant:"outline",children:[r.jsx(yh,{className:"mr-2 h-4 w-4"}),"Upgrade to Pro"]})]})]})]}),r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-md",children:[r.jsx(Mt,{children:r.jsxs(Dt,{className:"flex items-center gap-2",children:[r.jsx(yh,{className:"h-5 w-5 text-yellow-600"}),"Upgrade to Pro"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-3xl font-bold",children:"â¦7,999"}),r.jsx("div",{className:"text-muted-foreground",children:"per month"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-5 h-5 bg-green-100 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-green-600 text-xs",children:"â"})}),r.jsx("span",{children:"10 property listings"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-5 h-5 bg-green-100 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-green-600 text-xs",children:"â"})}),r.jsx("span",{children:"20 photos per listing"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-5 h-5 bg-green-100 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-green-600 text-xs",children:"â"})}),r.jsx("span",{children:"2 featured listings"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-5 h-5 bg-green-100 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-green-600 text-xs",children:"â"})}),r.jsx("span",{children:"Priority support"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-5 h-5 bg-green-100 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-green-600 text-xs",children:"â"})}),r.jsx("span",{children:"Advanced analytics"})]})]}),r.jsx(W,{className:"w-full",onClick:f,disabled:l,children:l?"Processing...":"Upgrade Now"}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Cancel anytime. Changes take effect immediately."})]})]})})]})},b2e=()=>{const{user:e}=bt(),{toast:t}=Sn(),n=zn(),[s,a]=j.useState([]),[i,o]=j.useState(null),[l,c]=j.useState(!0),[d,u]=j.useState(null),[h,f]=j.useState(!1),[m,x]=j.useState(!1),[p,v]=j.useState(!1),[g,y]=j.useState(!1),[b,w]=j.useState(!1),[_,C]=j.useState(!1),[E,N]=j.useState(!1),[k,I]=j.useState(null);j.useEffect(()=>{e&&P()},[e]);const P=async()=>{c(!0);try{await Promise.all([O(),A()])}finally{c(!1)}},O=async()=>
913{if(e)try{const{data:V,error:Z}=await H.from("properties").select("*").eq("owner_id",e.id).order("created_at",{ascending:!1});if(Z)throw Z;a(V||[])}catch(V){console.error("Error fetching properties:",V),t({title:"Error loading properties",variant:"destructive"})}},A=async()=>{if(e)try{const V=s.map(ce=>ce.id),{data:Z,count:de}=await H.from("bookings").select("*",{count:"exact"}).in("property_id",V),ve=(Z==null?void 0:Z.filter(ce=>ce.status==="pending").length)||0,_e=((Z==null?void 0:Z.filter(ce=>ce.status==="completed"))||[]).reduce((ce,De)=>ce+(De.total_amount||0),0),{data:xe}=await H.from("universal_reviews").select("rating").eq("module_type","property").in("entity_id",V).eq("is_approved",!0),oe=xe&&xe.length>0?xe.reduce((ce,De)=>ce+De.rating,0)/xe.length:0,{count:we}=await H.from("property_inquiries").select("*",{count:"exact",head:!0}).in("property_id",V);o({totalProperties:s.length,activeProperties:s.filter(ce=>ce.status==="active").length,totalBookings:de||0,pendingBookings:ve,totalRevenue:_e,avgRating:Number(oe.toFixed(1)),totalReviews:(xe==null?void 0:xe.length)||0,totalInquiries:we||0})}catch(V){console.error("Error fetching stats:",V)}},R=()=>{f(!1),P(),t({title:"Property created successfully!"})},L=()=>{x(!1),P(),t({title:"Property updated successfully!"})},z=async(V,Z)=>{try{const de=Z==="active"?"inactive":"active",{error:ve}=await H.from("properties").update({status:de}).eq("id",V);if(ve)throw ve;t({title:`Property ${de==="active"?"activated":"deactivated"}`}),O()}catch(de){console.error("Error toggling status:",de),t({title:"Error updating property",variant:"destructive"})}},U=V=>{u(V),x(!0)},$=V=>{u(V),v(!0)},q=V=>{u(V),w(!0)},ne=V=>{u(V),y(!0)},se=V=>V.status!=="active"?r.jsx(te,{variant:"secondary",children:"Inactive"}):V.moderation_status==="pending"?r.jsxs(te,{variant:"outline",className:"gap-1",children:[r.jsx($r,{className:"h-3 w-3"}),"Pending Review"]}):V.moderation_status==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):r.jsxs(te,{variant:"default",className:"gap-1",children:[r.jsx(er,{className:"h-3 w-3"}),"Active"]}),F=V=>r.jsxs("div",{className:"flex flex-wrap gap-1",children:[V.superhost_status&&r.jsxs(te,{className:"gap-1 bg-gradient-to-r from-yellow-500 to-amber-600 text-white border-0",children:[r.jsx(Vd,{className:"h-3 w-3"}),"Superhost"]}),V.is_verified_by_naija&&r.jsxs(te,{className:"gap-1 bg-gradient-to-r from-blue-600 to-blue-700 text-white border-0",children:[r.jsx(fn,{className:"h-3 w-3"}),"Verified"]}),V.is_boosted&&r.jsxs(te,{className:"gap-1 bg-gradient-to-r from-green-600 to-emerald-600 text-white border-0",children:[r.jsx(lr,{className:"h-3 w-3"}),"Featured"]})]});return l?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):s.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(en,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No Properties Yet"}),r.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:"Start earning by listing your first property. It takes just a few minutes to create a listing!"}),r.jsxs(Rt,{open:h,onOpenChange:f,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{size:"lg",className:"gap-2",children:[r.jsx(xs,{className:"h-5 w-5"}),"List Your First Property"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"List Your Property"})}),r.jsx(p_,{onSuccess:R})]})]}),r.jsxs(_r,{className:"mt-8 max-w-md mx-auto",children:[r.jsx(tc,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Pro Tip:"})," Properties with great photos and detailed descriptions get 3x more bookings!"]})]})]}):r.jsxs("div",{className:"container mx-auto py-8 space-y-6",children:[r.jsx(ep,{onBoostClick:()=>{s.length>0?s.length===1?(I(s[0]),N(!0)):t({title:"Select a Property",description:'Click the "Boost" button on the property card you want to feature'}):t({title:"No Properties",description:"Create a property listing first before boosting",variant:"destructive"})},onViewPlansClick:()=>{n("/dashboard",{state:{activeTab:"subscription"}})}}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Rt,{open:h,onOpenChange:f,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{className:"gap-2",children:[r.jsx(xs,{className:"h-4 w-4"}),"New Property"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"List Your Property"})}),r.jsx(p_,{onSuccess:R})]})]}),r.jsxs(W,{variant:"outline",onClick:()=>n("/lodging"),children:[r.jsx(Cr,{className:"mr-2 h-4 w-4"}),"View Public Listings"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Properties"}),r.jsx("p",{className:"text-2xl font-bold",children:(i==null?void 0:i.totalProperties)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[(i==null?void 0:i.activeProperties)||0," active"]})]}),r.jsx(en,{className:"h-8 w-8 text-primary"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Bookings"}),r.jsx("p",{className:"text-2xl font-bold",children:(i==null?void 0:i.totalBookings)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[(i==null?void 0:i.pendingBookings)||0," pending"]})]}),r.jsx(Xt,{className:"h-8 w-8 text-blue-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Revenue"}),r.jsxs("p",{className:"text-2xl font-bold",children:["â¦",((i==null?void 0:i.totalRevenue)||0).toLocaleStr
913ing()]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"All-time earnings"})]}),r.jsx(Tn,{className:"h-8 w-8 text-green-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Avg Rating"}),r.jsxs("p",{className:"text-2xl font-bold flex items-center gap-1",children:[(i==null?void 0:i.avgRating)||0,r.jsx(mr,{className:"h-5 w-5 fill-yellow-400 text-yellow-400"})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[(i==null?void 0:i.totalReviews)||0," reviews"]})]}),r.jsx(mr,{className:"h-8 w-8 text-yellow-500"})]})})})]}),r.jsx(y2e,{onUpgradeNeeded:()=>C(!0),showUpgradeDialog:_,onCloseUpgrade:()=>C(!1)}),r.jsxs(Kr,{defaultValue:"all",className:"w-full",children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"all",children:["All Properties (",s.length,")"]}),r.jsxs(Re,{value:"active",children:["Active (",s.filter(V=>V.status==="active").length,")"]}),r.jsxs(Re,{value:"boosted",children:["Featured (",s.filter(V=>V.is_boosted).length,")"]}),r.jsxs(Re,{value:"inactive",children:["Inactive (",s.filter(V=>V.status!=="active").length,")"]})]}),r.jsx(Be,{value:"all",className:"space-y-4 mt-4",children:s.map(V=>{var Z;return r.jsx(Y,{className:"overflow-hidden",children:r.jsx(X,{className:"p-0",children:r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsxs("div",{className:"md:w-48 h-48 relative flex-shrink-0",children:[(Z=V.photos)!=null&&Z[0]?r.jsx("img",{src:V.photos[0],alt:V.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:r.jsx(no,{className:"h-12 w-12 text-muted-foreground"})}),V.photos&&V.photos.length>1&&r.jsxs(te,{className:"absolute bottom-2 right-2 bg-black/70",children:[V.photos.length," photos"]})]}),r.jsxs("div",{className:"flex-1 p-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold mb-1",children:V.title}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:[V.city,", ",V.state]}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[se(V),F(V)]})]}),r.jsxs("div",{className:"text-right ml-4",children:[r.jsxs("div",{className:"text-2xl font-bold text-primary",children:["â¦",V.base_price_per_night.toLocaleString()]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"per night"})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4 line-clamp-2",children:V.summary}),r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground mb-4",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(en,{className:"h-4 w-4"}),V.bedrooms," bed ⢠",V.baths," bath"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Cr,{className:"h-4 w-4"}),V.view_count||0," views"]}),V.is_boosted&&V.boost_expires_at&&r.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(Va,{className:"h-4 w-4"}),"Featured until ",new Date(V.boost_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>U(V),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>$(V),children:[r.jsx(Xt,{className:"h-4 w-4 mr-2"}),"Bookings"]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>q(V),children:[r.jsx(Xt,{className:"h-4 w-4 mr-2"}),"Availability"]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>ne(V),children:[r.jsx(Qd,{className:"h-4 w-4 mr-2"}),"Analytics"]}),!V.is_boosted&&r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>{I(V),N(!0)},className:"gap-2 border-green-600 text-green-600 hover:bg-green-50",children:[r.jsx(lr,{className:"h-4 w-4"}),"Boost"]}),r.jsx(W,{variant:V.status==="active"?"outline":"default",size:"sm",onClick:()=>z(V.id,V.status),children:V.status==="active"?"Deactivate":"Activate"})]})]})]})})},V.id)})}
913),r.jsxs(Be,{value:"active",className:"space-y-4 mt-4",children:[s.filter(V=>V.status==="active").map(V=>{var Z;return r.jsx(Y,{className:"overflow-hidden",children:r.jsx(X,{className:"p-0",children:r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-48 h-48 relative flex-shrink-0",children:(Z=V.photos)!=null&&Z[0]?r.jsx("img",{src:V.photos[0],alt:V.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:r.jsx(no,{className:"h-12 w-12 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 p-6",children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:V.title}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[se(V),F(V)]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>U(V),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>$(V),children:[r.jsx(Xt,{className:"h-4 w-4 mr-2"}),"Bookings"]})]})]})]})})},V.id)}),s.filter(V=>V.status==="active").length===0&&r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(vn,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No active properties"})]})]}),r.jsxs(Be,{value:"boosted",className:"space-y-4 mt-4",children:[s.filter(V=>V.is_boosted).map(V=>r.jsx(Y,{className:"border-green-600/30 bg-green-50/50 dark:bg-green-950/20",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:V.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Featured until ",new Date(V.boost_expires_at).toLocaleDateString()]})]}),r.jsxs(te,{className:"bg-green-600",children:[r.jsx(lr,{className:"h-3 w-3 mr-1"}),"Featured"]})]})})},V.id)),s.filter(V=>V.is_boosted).length===0&&r.jsxs("div",{className:"text-center py-8",children:[r.jsx(lr,{className:"h-12 w-12 mx-auto mb-2 text-muted-foreground opacity-50"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No featured properties"}),r.jsx(W,{variant:"outline",onClick:()=>C(!0),children:"Learn About Featured Listings"})]})]}),r.jsxs(Be,{value:"inactive",className:"space-y-4 mt-4",children:[s.filter(V=>V.status!=="active").map(V=>r.jsx(Y,{className:"opacity-60",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:V.title}),r.jsx(te,{variant:"secondary",children:"Inactive"})]}),r.jsx(W,{size:"sm",onClick:()=>z(V.id,V.status),children:"Activate"})]})})},V.id)),s.filter(V=>V.status!=="active").length===0&&r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(er,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"All properties are active!"})]})]})]}),d&&r.jsxs(r.Fragment,{children:[r.jsx(DNe,{open:m,onOpenChange:x,property:d,onSuccess:L}),r.jsx(Rt,{open:p,onOpenChange:v,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs(Dt,{children:["Bookings - ",d.title]})}),r.jsx($Ne,{propertyId:d.id})]})}),r.jsx(Rt,{open:b,onOpenChange:w,children:r.jsxs(Ot,{className:"max-w-3xl",children:[r.jsx(Mt,{children:r.jsxs(Dt,{children:["Manage Availability - ",d.title]})}),r.jsx(v2e,{propertyId:d.id,basePrice:d.base_price_per_night,isOwner:!0})]})}),r.jsx(Rt,{open:g,onOpenChange:y,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs(Dt,{children:["Analytics - ",d.title]})}),r.jsx(FNe,{propertyId:d.id})]})})]}),i&&i.totalBookings===0&&s.length>0&&r.jsxs(_r,{children:[r.jsx(Va,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Get your first booking:"})," Add more photos, enable instant booking, and consider featuring your property for more visibility!"]})]}),k&&r.jsx(tp,{open:E,onOpenChange:N,entityId:k.id,entityType:"property",entityTitle:k.title})]})},oa={TITLE:100,DESCRIPTION:1e3,VENUE_NAME:100,VENUE_ADDRESS:200,CITY:100,TAGS:500,CONTACT_PHONE:20,CONTACT_EMAIL:100,CONTACT_WHATSAPP:20},j2e=({event:e,isOpen:t,onClose:n})=>{var x;const[s,a]=j.useState(!1),[i,o]=j.useState(null),[l,c]=j.useState(e.cover_image),d=j.useRef(null),u=lu({defaultValues:{title:e.title,de
913scription:e.description||"",venue_name:e.venue_name||"",venue_address:e.venue_address||"",city:e.city||"",state:e.state||"",country_code:e.country_code||"NG",start_datetime:e.start_datetime.slice(0,16),end_datetime:e.end_datetime.slice(0,16),tags:((x=e.tags)==null?void 0:x.join(", "))||"",contact_phone:e.contact_phone||"",contact_email:e.contact_email||"",contact_whatsapp:e.contact_whatsapp||""}});j.useEffect(()=>{var p;t&&(c(e.cover_image),u.reset({title:e.title,description:e.description||"",venue_name:e.venue_name||"",venue_address:e.venue_address||"",city:e.city||"",state:e.state||"",country_code:e.country_code||"NG",start_datetime:e.start_datetime.slice(0,16),end_datetime:e.end_datetime.slice(0,16),tags:((p=e.tags)==null?void 0:p.join(", "))||"",contact_phone:e.contact_phone||"",contact_email:e.contact_email||"",contact_whatsapp:e.contact_whatsapp||""}))},[t,e]);const h=p=>{var y;const v=(y=p.target.files)==null?void 0:y[0];if(!v)return;if(v.size>5*1024*1024){be({title:"File too large",description:"Poster must be under 5MB",variant:"destructive"});return}if(!v.type.startsWith("image/")){be({title:"Invalid file type",description:"Please upload an image file",variant:"destructive"});return}o(v);const g=new FileReader;g.onloadend=()=>{c(g.result)},g.readAsDataURL(v)},f=async()=>{if(!i)return null;const p=i.name.split(".").pop(),v=`${e.id}/${Date.now()}.${p}`;try{const{error:g}=await H.storage.from("event-posters").upload(v,i,{cacheControl:"3600",upsert:!1});if(g)throw g;const{data:{publicUrl:y}}=H.storage.from("event-posters").getPublicUrl(v);return y}catch(g){throw console.error("Error uploading poster:",g),g}},m=async p=>{var v,g,y;a(!0);try{let b=e.cover_image;if(i){const N=await f();N&&(b=N)}const w=new Date(p.start_datetime),_=new Date(p.end_datetime);if(_<=w){be({title:"Invalid dates",description:"End date must be after start date",variant:"destructive"});return}const C=p.tags.split(",").map(N=>N.trim()).filter(Boolean).slice(0,20),{error:E}=await H.from("events").update({title:p.title.slice(0,oa.TITLE),description:p.description.slice(0,oa.DESCRIPTION),cover_image:b,venue_name:p.venue_name.slice(0,oa.VENUE_NAME),venue_address:p.venue_address.slice(0,oa.VENUE_ADDRESS),city:p.city.slice(0,oa.CITY),state:p.state,country_code:p.country_code,start_datetime:w.toISOString(),end_datetime:_.toISOString(),tags:C,contact_phone:((v=p.contact_phone)==null?void 0:v.slice(0,oa.CONTACT_PHONE))||null,contact_email:((g=p.contact_email)==null?void 0:g.slice(0,oa.CONTACT_EMAIL))||null,contact_whatsapp:((y=p.contact_whatsapp)==null?void 0:y.slice(0,oa.CONTACT_WHATSAPP))||null}).eq("id",e.id);if(E)throw E;be({title:"Event updated",description:"Your event has been updated successfully"}),n()}catch(b){console.error("Error updating event:",b),be({title:"Update failed",description:b.message,variant:"destructive"})}finally{a(!1)}};return r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Edit Event"}),r.jsx(on,{children:"Update your event details and contact information"})]}),r.jsx(tf,{...u,children:r.jsxs("form",{onSubmit:u.handleSubmit(m),className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(nt,{children:"Event Poster"}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4",children:[l?r.jsxs("div",{className:"space-y-4",children:[r.jsx("img",{src:l,alt:"Event poster",className:"max-h-64 mx-auto rounded-lg"}),r.jsx("div",{className:"flex gap-2 justify-center",children:r.jsxs(W,{type:"button",variant:"outline",size:"sm",onClick:()=>{var p;return(p=d.current)==null?void 0:p.click()},children:[r.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Change Poster"]})})]}):r.jsxs("div",{className:"text-center space-y-2",children:[r.jsx(no,{className:"h-12 w-12 mx-auto text-muted-foreground"}),r.jsxs(W,{type:"button",variant:"outline",onClick:()=>{var p;return(p=d.current)==null?void 0:p.click()},children:[r.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Upload Poster"]})]}),r.jsx("input",{ref:d,type:"file",accept:"image/*",onChange:h,className:"hidden"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:u.control,name:"title",render:({field:p})=>{var v;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Event Title *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:oa.TITLE,...p})}
913),r.jsxs(Pr,{children:[((v=p.value)==null?void 0:v.length)||0," / ",oa.TITLE]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:u.control,name:"tags",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Tags"}),r.jsx(it,{children:r.jsx(ge,{maxLength:oa.TAGS,...p})}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:u.control,name:"description",render:({field:p})=>{var v;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Description *"}),r.jsx(it,{children:r.jsx(ir,{className:"min-h-[100px]",maxLength:oa.DESCRIPTION,...p})}),r.jsxs(Pr,{children:[((v=p.value)==null?void 0:v.length)||0," / ",oa.DESCRIPTION]}),r.jsx(Qe,{})]})}}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:u.control,name:"venue_name",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Venue Name *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:oa.VENUE_NAME,...p})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"venue_address",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Venue Address *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:oa.VENUE_ADDRESS,...p})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{control:u.control,name:"country_code",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(dc,{value:p.value,onValueChange:p.onChange,label:"Country",required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"state",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(uc,{countryCode:u.watch("country_code"),value:p.value,onChange:p.onChange,required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"city",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"City *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:oa.CITY,...p})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:u.control,name:"start_datetime",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Start Date & Time *"}),r.jsx(it,{children:r.jsx(ge,{type:"datetime-local",...p})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"end_datetime",render:({field:p})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"End Date & Time *"}),r.jsx(it,{children:r.jsx(ge,{type:"datetime-local",...p})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"space-y-4 p-4 border rounded-lg bg-primary/5",children:[r.jsx("h3",{className:"font-semibold",children:"Contact Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{control:u.control,name:"contact_phone",render:({field:p})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),"Phone"]}),r.jsx(it,{children:r.jsx(ge,{maxLength:oa.CONTACT_PHONE,...p})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"contact_email",render:({field:p})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-4 w-4"}),"Email"]}),r.jsx(it,{children:r.jsx(ge,{type:"email",maxLength:oa.CONTACT_EMAIL,...p})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:u.control,name:"contact_whatsapp",render:({field:p})=>r.jsxs(Ke,{children:[r.jsxs(nt,{className:"flex items-center gap-2",children:[r.jsx(Oh,{className:"h-4 w-4"}),"WhatsApp"]}),r.jsx(it,{children:r.jsx(ge,{maxLength:oa.CONTACT_WHATSAPP,...p})}),r.jsx(Qe,{})]})})]})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(W,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),r.jsx(W,{type:"submit",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}),"Updating..."]}):"Update Event"})]})]})})]})})},w2e=()=>{const{user:e}=bt(),t=zn(),[n,s]=j.useState([]),[a,i]=j.useState({total_events:0,active_events:0,past_events:0,featured_events:0,total_views:0,total_contact_clicks:0,pending_moderation:0}),[o,l]=j.useState(!0),[c,d]=j.useState(null),[u,h]=j.useState(!1),[f,m]=j.useState(!1),[x,p]=j.useState(!1),[v,g]=j.useState(null),[y,b]=j.useState(null);j.useEffect(()=>{e&&w()},[e]);const w=async()=>{if(e){l(!0);try{const{data:L,error:z}=await H.from("events").select("*").eq("organizer_id",e.id).order("created_at",{ascending:!1});if(z)throw z;s(L||[]),_(L||[])}catch{be({title:"Error",description:"Failed to fetch events",variant:"destructive"})}finally{l(!1)}}},_=L=>{const z=new Date;i({total_events:L.length,active_events:L.filter(U=>new Date(U.end_datetime)>z).length,past_events:L.filter(U=>new Date(U.end_datetime)<=z).length,featured_events:L.filter(U=>U.is_featured&&U.boost_expires_at&&new Date(U.boost_expires_at)>z).length,total_views:L.reduce((U,$)=>U+($.view_count||0),0),total_contact_clicks:L.reduce((U,$)=>U+($.contact_clicks||0),0),pending_moderation:L.filter(U=>U.moderation_status==="pending").length})},C=async L=>{if(confirm("Are you sure you want to delete this event? This action cannot be undone.")){g(L);try{const{error:z}=await H.from("events").delete().eq("id",L);if(z)throw z;be({title:"Event deleted",description:"Your event has been deleted successfully"}),w()}catch{be({title:"Error",description:"Failed to delete event",variant:"destructive"})}finally{g(null)}}},E=L=>{const z=new Date;return new Date(L.end_datetime)<z?r.jsx(te,{variant:"secondary",children:"Past"}):L.status==="draft"?r.jsx(te,{variant:"outline",children:"Draft"}):L.moderation_status==="pending"?r.jsx(te,{variant:"outline",className:"bg-yellow-100 text-yellow-800",children:"Pending Review"}):L.moderation_status==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):r.jsx(te,{variant:"default",className:"bg-green-600",children:"Active"})},N=L=>!L.is_featured||!L.boost_expires_at?!1:new Date(L.boost_expires_at)>new Date,k=L=>new Date(L).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),I=L=>new Date(L).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),P=n.filter(L=>new Date(L.end_datetime)>new Date&&L.moderation_status==="approved"),O=n.filter(L=>L.moderation_status==="pending"),A=n.filter(L=>new Date(L.end_datetime)<=new Date),R=n.filter(L=>L.status==="draft");return o?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(ep,{onBoostClick:()=>{n.length>0?n.length===1?(b(n[0]),m(!0)):be({title:"Select an Event",description:'Click the "Boost" button on any event card to feature it'}):be({title:"No Events",description:"Create an event first",variant:"destructive"})},onViewPlansClick:()=>{t("/dashboard",{state:{activeTab:"subscription"}})}}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(Xt,{className:"h-6 w-6 text-primary"}),"My Events"]}),r.jsx("p",{className:"text-muted-foreground",children:"Manage your event listings and boost visibility"})]}),r.jsxs(Rt,{open:x,onOpenChange:p,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{className:"bg-gradient-hero hover:opacity-90",children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Create Event"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Create New Event"})}),r.jsx(ES,{onSuccess:()=>{p(!1),w()}})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Events"}),r.jsx("p",{className:"text-2xl font-bold",children:a.total_events})]}),r.jsx(Xt,{className:"h-8 w-8 text-blue-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Active Events"}),r.jsx("p",{className:"text-2xl font-bold",children:a.active_events})]}),r.jsx(lr,{className:"h-8 w-8 text-green-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Views"}),r.jsx("p",{className:"text-2xl font-bold",children:a.total_views})]}),r.jsx(Cr,{className:"h-8 w-8 text-purple-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Contact Clicks"}),r.jsx("p",{className:"text-2xl font-bold",children:a.total_contact_clicks})]}),r.jsx(an,{className:"h-8 w-8 text-orange-500"})]})})})]}),n.length===0?r.jsx(Y,{children:r.jsxs(X,{className:"p-12 text-center",children:[r.jsx(Xt,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No events yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Create your first event to start sharing with the community"}),r.jsxs(W,{className:"bg-gradient-hero hover:opacity-90",onClick:()=>p(!0),children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Create Your First Event"]})]})}):r.jsxs(Kr,{defaultValue:"active",className:"space-y-4",children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"active",children:["Active (",P.length,")"]}),r.jsxs(Re,{value:"pending",children:["Pending Review (",O.length,")"]}),r.jsxs(Re,{value:"past",children:["Past (",A.length,")"]}),R.length>0&&r.jsxs(Re,{value:"drafts",children:["Drafts (",R.length,")"]})]}),r.jsx(Be,{value:"active",className:"space-y-4",children:P.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No active events"})})}):P.map(L=>r.jsx(Y,{className:"border-l-4 border-l-primary",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[L.cover_image&&r.jsx("img",{src:L.cover_image,alt:L.title,className:"w-32 h-32 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:L.title}),E(L),N(L)&&r.jsxs(te,{className:"bg-gradient-hero",children:[r.jsx(Va,{className:"h-3 w-3 mr-1"}),"Boosted"]})]}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:L.description})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{size:"sm",variant:"outline",onClick:()=>{d(L),h(!0)},children:r.jsx(so,{className:"h-4 w-4"})}),!N(L)&&r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>{b(L),m(!0)},className:"gap-2 border-green-600 text-green-600 hover:bg-green-50",children:[r.jsx(Va,{className:"h-4 w-4"}),"Boost"]}),r.jsx(W,{size:"sm",variant:"outline",onClick:()=>C(L.id),disabled:v===L.id,children:v===L.id?r.jsx(yt,{className:"h-4 w-4 animate-spin"}):r.jsx(ao,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Xt,{className:"h-4 w-4"}),k(L.start_datetime)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx($r,{className:"h-4 w-4"}),I(L.start_datetime)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-4 w-4"}),L.city,", ",L.state]})]}),r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cr,{className:"h-4 w-4 text-blue-500"}),r.jsxs("span",{children:[L.view_count||0," views"]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(an,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[L.contact_clicks||0," contacts"]})]})]}),N(L)&&L.boost_expires_at&&r.jsxs("div",{className:"text-sm text-primary",children:["Boosted until ",k(L.boost_expires_at)]})]})]})})},L.id))}),r.jsx(Be,{value:"pending",className:"space-y-4",children:O.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No events pending review"})})}):O.map(L=>r.jsx(Y,{className:"border-l-4 border-l-yellow-500",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[L.cover_image&&r.jsx("img",{src:L.cover_image,alt:L.title,className:"w-32 h-32 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"flex items-start justify-between mb-2",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:L.title}),E(L)]}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:L.description})]})}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsx("span",{children:"Awaiting moderation approval"})]})]})]})})},L.id))}),r.jsx(Be,{value:"past",className:"space-y-4",children:A.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No past events"})})}):A.map(L=>r.jsx(Y,{className:"border-l-4 border-l-gray-300 opacity-75",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[L.cover_image&&r.jsx("img",{src:L.cover_image,alt:L.title,className:"w-32 h-32 object-cover rounded-lg grayscale"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:L.title}),E(L)]}),r.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[r.jsx("span",{children:k(L.start_datetime)}),r.jsxs("span",{children:[L.city,", ",L.state]})]}),r.jsxs("div",{className:"flex gap-4 text-sm mt-2",children:[r.jsxs("span",{children:[L.view_count||0," views"]}),r.jsxs("span",{children:[L.contact_clicks||0," contacts"]})]})]})]})})},L.id))}),R.length>0&&r.jsx(Be,{value:"drafts",className:"space-y-4",children:R.map(L=>r.jsx(Y,{className:"border-l-4 border-l-gray-400",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[L.cover_image&&r.jsx("img",{src:L.cover_image,alt:L.title,className:"w-32 h-32 object-cover rounded-lg opacity-50"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:L.title}),E(L)]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:L.description}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>{d(L),h(!0)},children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Edit & Publish"]})]})]})})},L.id))})]}),c&&r.jsx(j2e,{event:c,isOpen:u,onClose:()=>{h(!1),d(null),w()}}),y&&r.jsx(tp,{open:f,onOpenChange:m,entityId:y.id,entityType:"event",entityTitle:y.title})]})},Za={NAME:100,DESCRIPTION:500,ADDRESS:200,CITY:100,PHONE:20,EMAIL:100,MENU_URL:500},N2e=["Local Cuisine","Fine Dining","Street Food","Fast Food","Cafe","Bar & Grill","Others"],_2e=["â¦","â¦â¦","â¦â¦â¦","â¦â¦â¦â¦"],S2e=({restaurant:e,isOpen:t,onClose:n})=>{var l,c;const[s,a]=j.useState(!1),i=lu({defaultValues:{name:e.name,description:e.description||"",category:e.category||"",cuisine_types:((l=e.cuisine_types)==null?void 0:l.join(", "))||"",phone:e.phone||"",email:e.email||"",address:e.address||"",city:e.city,state:e.state,country_code:e.country_code||"NG",opens_at:e.opens_at||"",closes_at:e.closes_at||"",delivery_available:e.delivery_available,delivery_radiu
913s_km:((c=e.delivery_radius_km)==null?void 0:c.toString())||"",price_range:e.price_range||"",menu_url:e.menu_url||""}});j.useEffect(()=>{var d,u;t&&i.reset({name:e.name,description:e.description||"",category:e.category||"",cuisine_types:((d=e.cuisine_types)==null?void 0:d.join(", "))||"",phone:e.phone||"",email:e.email||"",address:e.address||"",city:e.city,state:e.state,country_code:e.country_code||"NG",opens_at:e.opens_at||"",closes_at:e.closes_at||"",delivery_available:e.delivery_available,delivery_radius_km:((u=e.delivery_radius_km)==null?void 0:u.toString())||"",price_range:e.price_range||"",menu_url:e.menu_url||""})},[t,e]);const o=async d=>{a(!0);try{const u=d.cuisine_types.split(",").map(f=>f.trim()).filter(Boolean).slice(0,10),{error:h}=await H.from("restaurants").update({name:d.name.slice(0,Za.NAME),description:d.description.slice(0,Za.DESCRIPTION),category:d.category,cuisine_types:u,phone:d.phone.slice(0,Za.PHONE),email:d.email.slice(0,Za.EMAIL),address:d.address.slice(0,Za.ADDRESS),city:d.city.slice(0,Za.CITY),state:d.state,country_code:d.country_code,opens_at:d.opens_at||null,closes_at:d.closes_at||null,delivery_available:d.delivery_available,delivery_radius_km:d.delivery_radius_km?parseFloat(d.delivery_radius_km):null,price_range:d.price_range,menu_url:d.menu_url.slice(0,Za.MENU_URL)||null}).eq("id",e.id);if(h)throw h;be({title:"Restaurant updated",description:"Your restaurant has been updated successfully"}),n()}catch(u){console.error("Error updating restaurant:",u),be({title:"Update failed",description:u.message,variant:"destructive"})}finally{a(!1)}};return r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Edit Restaurant"}),r.jsx(on,{children:"Update your restaurant details"})]}),r.jsx(tf,{...i,children:r.jsxs("form",{onSubmit:i.handleSubmit(o),className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:i.control,name:"name",render:({field:d})=>{var u;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Restaurant Name *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:Za.NAME,...d})}),r.jsxs(Pr,{children:[((u=d.value)==null?void 0:u.length)||0," / ",Za.NAME]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:i.control,name:"category",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Category *"}),r.jsxs(mt,{value:d.value,onValueChange:d.onChange,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select category"})})}),r.jsx(ht,{children:N2e.map(u=>r.jsx(Ne,{value:u,children:u},u))})]}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:i.control,name:"description",render:({field:d})=>{var u;return r.jsxs(Ke,{children:[r.jsx(nt,{children:"Description *"}),r.jsx(it,{children:r.jsx(ir,{className:"min-h-[100px]",maxLength:Za.DESCRIPTION,...d})}),r.jsxs(Pr,{children:[((u=d.value)==null?void 0:u.length)||0," / ",Za.DESCRIPTION]}),r.jsx(Qe,{})]})}}),r.jsx(Ze,{control:i.control,name:"cuisine_types",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Cuisine Types"}),r.jsx(it,{children:r.jsx(ge,{placeholder:"Nigerian, Continental, Chinese (comma separated)",...d})}),r.jsx(Pr,{children:"Max 10 cuisines, comma separated"}),r.jsx(Qe,{})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{control:i.control,name:"price_range",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Price Range *"}),r.jsxs(mt,{value:d.value,onValueChange:d.onChange,children:[r.jsx(it,{children:r.jsx(ut,{children:r.jsx(pt,{})})}),r.jsx(ht,{children:_2e.map(u=>r.jsx(Ne,{value:u,children:u},u))})]}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:i.control,name:"opens_at",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Opening Time"}),r.jsx(it,{children:r.jsx(ge,{type:"time",...d})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:i.control,name:"closes_at",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Closing Time"}),r.jsx(it,{children:r.jsx(ge,{type:"time",...d})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ze,{control:i.control,name:"country_code",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(dc,{value:d.value,onValueChange:d.onChange,label:"Country",required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:i.control,name:"state",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(uc,{countryCode:i.watch("country_code"),value:d.value,onChange:d.onChange,required:!0}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:i.control,name:"city",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"City *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:Za.CITY,...d})}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:i.control,name:"address",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Address *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:Za.ADDRESS,...d})}),r.jsx(Qe,{})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsx(Ze,{control:i.control,name:"phone",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Phone *"}),r.jsx(it,{children:r.jsx(ge,{maxLength:Za.PHONE,...d})}),r.jsx(Qe,{})]})}),r.jsx(Ze,{control:i.control,name:"email",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Email *"}),r.jsx(it,{children:r.jsx(ge,{type:"email",maxLength:Za.EMAIL,...d})}),r.jsx(Qe,{})]})})]}),r.jsx(Ze,{control:i.control,name:"menu_url",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Menu URL"}),r.jsx(it,{children:r.jsx(ge,{type:"url",placeholder:"https://your-menu-link.com",maxLength:Za.MENU_URL,...d})}),r.jsx(Qe,{})]})}),r.jsxs("div",{className:"space-y-4 p-4 border rounded-lg",children:[r.jsx(Ze,{control:i.control,name:"delivery_available",render:({field:d})=>r.jsxs(Ke,{className:"flex items-center gap-2 space-y-0",children:[r.jsx(it,{children:r.jsx(Uo,{checked:d.value,onCheckedChange:d.onChange})}),r.jsx(nt,{className:"cursor-pointer",children:"Delivery Available"})]})}),i.watch("delivery_available")&&r.jsx(Ze,{control:i.control,name:"delivery_radiu
913s_km",render:({field:d})=>r.jsxs(Ke,{children:[r.jsx(nt,{children:"Delivery Radius (km)"}),r.jsx(it,{children:r.jsx(ge,{type:"number",step:"0.1",...d})}),r.jsx(Qe,{})]})})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(W,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),r.jsx(W,{type:"submit",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}),"Updating..."]}):"Update Restaurant"})]})]})})]})})},k2e=()=>{const{user:e}=bt(),t=zn(),[n,s]=j.useState([]),[a,i]=j.useState({total_restaurants:0,active_restaurants:0,pending_moderation:0,featured_restaurants:0,total_reviews:0,average_rating:0}),[o,l]=j.useState(!0),[c,d]=j.useState(null),[u,h]=j.useState(!1),[f,m]=j.useState(!1),[x,p]=j.useState(null),[v,g]=j.useState(!1),[y,b]=j.useState(null);j.useEffect(()=>{e&&w()},[e]);const w=async()=>{if(e){l(!0);try{const{data:A,error:R}=await H.from("restaurants").select("*").eq("owner_id",e.id).order("created_at",{ascending:!1});if(R)throw R;s(A||[]),_(A||[])}catch{be({title:"Error",description:"Failed to fetch restaurants",variant:"destructive"})}finally{l(!1)}}},_=A=>{i({total_restaurants:A.length,active_restaurants:A.filter(R=>R.status==="active"&&R.moderation_status==="approved").length,pending_moderation:A.filter(R=>R.moderation_status==="pending").length,featured_restaurants:A.filter(R=>R.is_featured).length,total_reviews:A.reduce((R,L)=>R+(L.total_reviews||0),0),average_rating:A.length>0?A.reduce((R,L)=>R+(L.average_rating||0),0)/A.length:0})},C=async A=>{if(confirm("Are you sure you want to delete this restaurant? This action cannot be undone.")){p(A);try{const{error:R}=await H.from("restaurants").delete().eq("id",A);if(R)throw R;be({title:"Restaurant deleted",description:"Your restaurant has been deleted successfully"}),w()}catch{be({title:"Error",description:"Failed to delete restaurant",variant:"destructive"})}finally{p(null)}}},E=A=>A.moderation_status==="pending"?r.jsx(te,{variant:"outline",className:"bg-yellow-100 text-yellow-800",children:"Pending Review"}):A.moderation_status==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):A.status==="active"?r.jsx(te,{variant:"default",className:"bg-green-600",children:"Active"}):r.jsx(te,{variant:"secondary",children:"Draft"}),N=A=>{if(!A)return"N/A";const[R,L]=A.split(":"),z=parseInt(R),U=z>=12?"PM":"AM";return`${z%12||12}:${L} ${U}`},k=n.filter(A=>A.status==="active"&&A.moderation_status==="approved"),I=n.filter(A=>A.moderation_status==="pending"),P=n.filter(A=>A.moderation_status==="rejected"),O=n.filter(A=>A.status==="draft");return o?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(ep,{onBoostClick:()=>{n.length>0?n.length===1?(b(n[0]),g(!0)):be({title:"Select a Restaurant",description:'Click the "Boost" button on any restaurant card to feature it'}):be({title:"No Restaurants",description:"Create a restaurant listing first",variant:"destructive"})},onViewPlansClick:()=>{t("/dashboard",{state:{activeTab:"subscription"}})}}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(Lo,{className:"h-6 w-6 text-primary"}),"My Restaurants"]}),r.jsx("p",{className:"text-muted-foreground",children:"Manage your restaurant listings"})]}),r.jsxs(Rt,{open:f,onOpenChange:m,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{className:"bg-gradient-hero hover:opacity-90",children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Add Restaurant"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Add New Restaurant"})}),r.jsx(i6,{onSuccess:()=>{m(!1),w()}})]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Restaurants"}),r.jsx("p",{className:"text-2xl font-bold",children:a.total_restaurants})]}),r.jsx(Lo,{className:"h-8 w-8 text-blue-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Active"}),r.jsx("p",{className:"text-2xl font-bold",children:a.active_restaurants})]}),r.jsx(Cr,{className:"h-8 w-8 text-green-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Reviews"}),r.jsx("p",{className:"text-2xl font-bold",children:a.total_reviews})]}),r.jsx(mr,{className:"h-8 w-8 text-yellow-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Avg. Rating"}),r.jsx("p",{className:"text-2xl font-bold",children:a.average_rating.toFixed(1)})]}),r.jsx(mr,{className:"h-8 w-8 text-orange-500 fill-orange-500"})]})})})]}),n.length===0?r.jsx(Y,{children:r.jsxs(X,{className:"p-12 text-center",children:[r.jsx(Lo,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No restaurants yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Add your first restaurant to start building your presence"}),r.jsxs(W,{className:"bg-gradient-hero hover:opacity-90",onClick:()=>m(!0),children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Add Your First Restaurant"]})]})}):r.jsxs(Kr,{defaultValue:"active",className:"space-y-4",children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"active",children:["Active (",k.length,")"]}),r.jsxs(Re,{value:"pending",children:["Pending Review (",I.length,")"]}),P.length>0&&r.jsxs(Re,{value:"rejected",children:["Rejected (",P.length,")"]}),O.length>0&&r.jsxs(Re,{value:"drafts",children:["Drafts (",O.length,")"]})]}),r.jsx(Be,{value:"active",className:"space-y-4",children:k.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No active restaurants"})})}):k.map(A=>r.jsx(Y,{className:"border-l-4 border-l-green-500",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[A.images&&A.
913images[0]&&r.jsx("img",{src:A.images[0],alt:A.name,className:"w-32 h-32 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:A.name}),E(A),A.is_featured&&r.jsxs(te,{className:"bg-gradient-hero",children:[r.jsx(Va,{className:"h-3 w-3 mr-1"}),"Featured"]}),A.category&&r.jsx(te,{variant:"outline",children:A.category})]}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:A.description})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{size:"sm",variant:"outline",onClick:()=>{d(A),h(!0)},children:r.jsx(so,{className:"h-4 w-4"})}),!A.is_featured&&r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>{b(A),g(!0)},className:"gap-2 border-green-600 text-green-600 hover:bg-green-50",children:[r.jsx(lr,{className:"h-4 w-4"}),"Boost"]}),r.jsx(W,{size:"sm",variant:"outline",onClick:()=>C(A.id),disabled:x===A.id,children:x===A.id?r.jsx(yt,{className:"h-4 w-4 animate-spin"}):r.jsx(ao,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-4 w-4"}),A.city,", ",A.state]}),A.opens_at&&A.closes_at&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx($r,{className:"h-4 w-4"}),N(A.opens_at)," - ",N(A.closes_at)]}),A.phone&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(an,{className:"h-4 w-4"}),A.phone]}),A.price_range&&r.jsx(te,{variant:"secondary",children:A.price_range})]}),A.cuisine_types&&A.cuisine_types.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:A.cuisine_types.slice(0,5).map(R=>r.jsx(te,{variant:"outline",className:"text-xs",children:R},R))}),A.total_reviews>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(mr,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),r.jsx("span",{className:"font-medium",children:A.average_rating.toFixed(1)}),r.jsxs("span",{className:"text-muted-foreground",children:["(",A.total_reviews," reviews)"]})]})]})]})})},A.id))}),r.jsx(Be,{value:"pending",className:"space-y-4",children:I.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No restaurants pending review"})})}):I.map(A=>r.jsx(Y,{className:"border-l-4 border-l-yellow-500",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[A.images&&A.images[0]&&r.jsx("img",{src:A.images[0],alt:A.name,className:"w-32 h-32 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"flex items-start justify-between mb-2",children:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:A.name}),E(A)]}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:A.description})]})}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsx("span",{children:"Awaiting moderation approval"})]})]})]})})},A.id))}),P.length>0&&r.jsx(Be,{value:"rejected",className:"space-y-4",children:P.map(A=>r.jsx(Y,{className:"border-l-4 border-l-red-500",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[A.images&&A.images[0]&&r.jsx("img",{src:A.images[0],alt:A.name,className:"w-32 h-32 object-cover rounded-lg opacity-50"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:A.name}),E(A)]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:A.description}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>{d(A),h(!0)},children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Edit & Resubmit"]})]})]})})},A.id))})]}),c&&r.jsx(S2e,{restaurant:c,isOpen:u,onClose:()=>{h(!1),d(null),w()}}),y&&r.jsx(tp,{open:v,onOpenChange:g,entityId:y.id,entityType:"restaurant",entityTitle:y.name})]})},C2e=["Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"],A2e=[{value:"car",label:"Car"},{value:"truck",label:"Truck"},{value:"van",label:"Van"},{value:"suv",label:"SUV"},{value:"motorcycle",label:"Motorcycle"},{value:"bicycle",label:"Bicycle"},{value:"equipment",label:"Equipment"}],P2e=[{value:"automatic",label:"Automatic"},{value:"manual",label:"Manual"}],E2e=[{value:"petrol",label:"Petrol"},{value:"diesel",label:"Diesel"},{value:"electric",label:"Electric"},{value:"hybrid",label:"Hybrid"}],T2e=[{value:"excellent",label:"Excellent"},{value:"good",label:"Good"},{value:"fair",label:"Fair"}],O2e=({open:e,onOpenChange:t,listing:n,onSuccess:s})=>{var b;const{toast:a}=Sn(),[i,o]=j.useState(!1),[l,c]=j.useState(!1),[d,u]=j.useState({title:n.title,de
913scription:n.description||"",listing_type:n.listing_type,make:n.make||"",model:n.model||"",year:n.year||new Date().getFullYear(),transmission:n.transmission||"automatic",fuel_type:n.fuel_type||"petrol",seats:n.seats||5,daily_rate:n.daily_rate,weekly_rate:n.weekly_rate||0,monthly_rate:n.monthly_rate||0,security_deposit:n.security_deposit||0,driver_included:n.driver_included,driver_daily_rate:n.driver_daily_rate||0,security_personnel_included:n.security_personnel_included,security_personnel_daily_rate:n.security_personnel_daily_rate||0,condition:n.condition,state:n.state,city:n.city,pickup_location:n.pickup_location||"",contact_phone:n.contact_phone,contact_email:n.contact_email||"",contact_whatsapp:n.contact_whatsapp||"",rental_terms:n.rental_terms||"",insurance_included:n.insurance_included,minimum_rental_days:n.minimum_rental_days,maximum_rental_days:n.maximum_rental_days||0}),[h,f]=j.useState(n.photos||[]),[m,x]=j.useState(((b=n.features)==null?void 0:b.join(", "))||""),p=async w=>{const _=w.target.files;if(!(!_||_.length===0)){c(!0);try{const C=[];for(let E=0;E<_.length;E++){const N=_[E];if(N.size>5*1024*1024){a({title:"File too large",description:`${N.name} exceeds 5MB limit`,variant:"destructive"});continue}const k=N.name.split(".").pop(),I=`${n.id}/${Math.random()}.${k}`,{error:P,data:O}=await H.storage.from("rental-car-photos").upload(I,N);if(P)throw P;const{data:{publicUrl:A}}=H.storage.from("rental-car-photos").getPublicUrl(I);C.push(A)}f([...h,...C]),a({title:"Photos uploaded successfully!"})}catch(C){console.error("Error uploading photos:",C),a({title:"Error uploading photos",variant:"destructive"})}finally{c(!1)}}},v=async w=>{try{const _=w.split("/rental-car-photos/");if(_.length>1){const C=_[1];await H.storage.from("rental-car-photos").remove([C])}f(h.filter(C=>C!==w)),a({title:"Photo removed"})}catch(_){console.error("Error removing photo:",_),a({title:"Error removing photo",variant:"destructive"})}},g=async w=>{if(w.preventDefault(),h.length===0){a({title:"At least one photo is required",variant:"destructive"});return}o(!0);try{const{error:_}=await H.from("rental_cars").update({...d,photos:h,features:m.split(",").map(C=>C.trim()).filter(C=>C.length>0),updated_at:new Date().toISOString()}).eq("id",n.id);if(_)throw _;a({title:"Listing updated successfully!"}),s()}catch(_){console.error("Error updating listing:",_),a({title:"Error updating listing",description:_.message,variant:"destructive"})}finally{o(!1)}},y=d.listing_type==="equipment";return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Edit Rental Listing"})}),r.jsxs("form",{onSubmit:g,children:[r.jsxs(Kr,{defaultValue:"basic",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-4",children:[r.jsx(Re,{value:"basic",children:"Basic Info"}),r.jsxs(Re,{value:"photos",children:["Photos (",h.length,")"]}),r.jsx(Re,{value:"pricing",children:"Pricing"}),r.jsx(Re,{value:"extras",children:"Extras"})]}),r.jsxs(Be,{value:"basic",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"title",children:"Listing Title *"}),r.jsx(ge,{id:"title",value:d.title,onChange:w=>u({...d,title:w.target.value}),required:!0,maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Description"}),r.jsx(ir,{id:"description",value:d.description,onChange:w=>u({...d,description:w.target.value}),rows:4,maxLength:1e3})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"listing_type",children:"Type *"}),r.jsxs(mt,{value:d.listing_type,onValueChange:w=>u({...d,listing_type:w}),children:[r.jsx(ut,{id:"listing_type",children:r.jsx(pt,{})}),r.jsx(ht,{children:A2e.map(w=>r.jsx(Ne,{value:w.value,children:w.label},w.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"condition",children:"Condition *"}),r.jsxs(mt,{value:d.condition,onValueChange:w=>u({...d,condition:w}),children:[r.jsx(ut,{id:"condition",children:r.jsx(pt,{})}),r.jsx(ht,{children:T2e.map(w=>r.jsx(Ne,{value:w.value,children:w.label},w.value))})]})]})]}),!y&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"make",children:"Make"}),r.jsx(ge,{id:"make",value:d.make,onChange:w=>u({...d,make:w.target.value}),maxLength:50})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"model",children:"Model"}),r.jsx(ge,{id:"model",value:d.model,onChange:w=>u({...d,model:w.target.value}),maxLength:50})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"year",children:"Year"}),r.jsx(ge,{id:"year",type:"number",min:"1990",max:new Date().getFullYear()+1,value:d.year,onChange:w=>u({...d,year:Number(w.target.value)})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"seats",children:"Seats"}),r.jsx(ge,{id:"seats",type:"number",min:"1",max:"50",value:d.seats,onChange:w=>u({...d,seats:Number(w.target.value)})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"transmission",children:"Transmission"}),r.jsxs(mt,{value:d.transmission,onValueChange:w=>u({...d,transmission:w}),children:[r.jsx(ut,{id:"transmission",children:r.jsx(pt,{})}),r.jsx(ht,{children:P2e.map(w=>r.jsx(Ne,{value:w.value,children:w.label},w.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"fuel_type",children:"Fuel Type"}),r.jsxs(mt,{value:d.fuel_type,onValueChange:w=>u({...d,fuel_type:w}),children:[r.jsx(ut,{id:"fuel_type",children:r.jsx(pt,{})}),r.jsx(ht,{children:E2e.map(w=>r.jsx(Ne,{value:w.value,children:w.label},w.value))})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"state",children:"State *"}),r.jsxs(mt,{value:d.state,onValueChange:w=>u({...d,state:w}),children:[r.jsx(ut,{id:"state",children:r.jsx(pt,{})}),r.jsx(ht,{children:C2e.map(w=>r.jsx(Ne,{value:w,children:w}
913,w))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"city",children:"City *"}),r.jsx(ge,{id:"city",value:d.city,onChange:w=>u({...d,city:w.target.value}),required:!0,maxLength:100})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"pickup_location",children:"Pickup Location"}),r.jsx(ge,{id:"pickup_location",value:d.pickup_location,onChange:w=>u({...d,pickup_location:w.target.value}),maxLength:200})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"features",children:"Features & Amenities"}),r.jsx(ir,{id:"features",value:m,onChange:w=>x(w.target.value),placeholder:"air conditioning, gps, bluetooth, backup camera",rows:2}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Comma-separated list"})]})]}),r.jsx(Be,{value:"photos",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Photos *"}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[h.map((w,_)=>r.jsx(Y,{className:"relative group",children:r.jsxs(X,{className:"p-2",children:[r.jsx("img",{src:w,alt:`Photo ${_
913+1}`,className:"w-full h-32 object-cover rounded"}),r.jsx(W,{type:"button",variant:"destructive",size:"icon",className:"absolute top-4 right-4 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>v(w),children:r.jsx(ks,{className:"h-4 w-4"})}),_===0&&r.jsx(te,{className:"absolute bottom-4 left-4",children:"Cover Photo"})]})},_)),r.jsxs("label",{className:"border-2 border-dashed rounded-lg p-4 hover:border-primary transition-colors cursor-pointer flex flex-col items-center justify-center h-40",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:p,disabled:l}),l?r.jsx(yt,{className:"h-8 w-8 animate-spin text-muted-foreground"}):r.jsxs(r.Fragment,{children:[r.jsx(Jn,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Upload Photos"})]})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"First photo will be used as cover. Max 20 photos."})]})}),r.jsxs(Be,{value:"pricing",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"daily_rate",children:"Daily Rate (â¦) *"}),r.jsx(ge,{id:"daily_rate",type:"number",min:"0",value:d.daily_rate,onChange:w=>u({...d,daily_rate:Number(w.target.value)}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"weekly_rate",children:"Weekly Rate (â¦)"}),r.jsx(ge,{id:"weekly_rate",type:"number",min:"0",value:d.weekly_rate,onChange:w=>u({...d,weekly_rate:Number(w.target.value)})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"monthly_rate",children:"Monthly Rate (â¦)"}),r.jsx(ge,{id:"monthly_rate",type:"number",min:"0",value:d.monthly_rate,onChange:w=>u({...d,monthly_rate:Number(w.target.value)})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"security_deposit",children:"Security Deposit (â¦)"}),r.jsx(ge,{id:"security_deposit",type:"number",min:"0",value:d.security_deposit,onChange:w=>u({...d,security_deposit:Number(w.target.value)})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"minimum_rental_days",children:"Min Rental Days *"}),r.jsx(ge,{id:"minimum_rental_days",type:"number",min:"1",value:d.minimum_rental_days,onChange:w=>u({...d,minimum_rental_days:Number(w.target.value)}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"maximum_rental_days",children:"Max Rental Days"}),r.jsx(ge,{id:"maximum_rental_days",type:"number",min:"1",value:d.maximum_rental_days,onChange:w=>u({...d,maximum_rental_days:Number(w.target.value)})})]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_phone",children:"Phone *"}),r.jsx(ge,{id:"contact_phone",value:d.contact_phone,onChange:w=>u({...d,contact_phone:w.target.value}),required:!0,maxLength:20})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_whatsapp",children:"WhatsApp"}),r.jsx(ge,{id:"contact_whatsapp",value:d.contact_whatsapp,onChange:w=>u({...d,contact_whatsapp:w.target.value}),maxLength:20})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_email",children:"Email"}),r.jsx(ge,{id:"contact_email",type:"email",value:d.contact_email,onChange:w=>u({...d,contact_email:w.target.value}),maxLength:100})]})]})]}),r.jsx(Be,{value:"extras",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(le,{className:"text-base",children:"Driver Included"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Offer rental with professional driver"})]}),r.jsx(Ro,{checked:d.driver_included,onCheckedChange:w=>u({...d,driver_included:w})})]}),d.driver_included&&r.jsxs("div",{className:"space-y-2 ml-4",children:[r.jsx(le,{htmlFor:"driver_daily_rate",children:"Driver Daily Rate (â¦)"}),r.jsx(ge,{id:"driver_daily_rate",type:"number",min:"0",value:d.driver_daily_rate,onChange:w=>u({...d,driver_daily_rate:Number(w.target.value)})})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(le,{className:"text-base",children:"Security Personnel"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Offer rental with security escort"})]}),r.jsx(Ro,{checked:d.security_personnel_included,onCheckedChange:w=>u({...d,security_personnel_included:w})})]}),d.security_personnel_included&&r.jsxs("div",{className:"space-y-2 ml-4",children:[r.jsx(le,{htmlFor:"security_personnel_daily_rate",children:"Security Daily Rate (â¦)"}),r.jsx(ge,{id:"security_personnel_daily_rate",type:"number",min:"0",value:d.security_personnel_daily_rate,onChange:w=>u({...d,security_personnel_daily_rate:Number(w.target.value)})})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(le,{className:"text-base",children:"Insurance Included"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Comprehensive insurance in price"})]}),r.jsx(Ro,{checked:d.insurance_included,onCheckedChange:w=>u({...d,insurance_included:w})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"rental_terms",children:"Rental Terms & Conditions"}),r.jsx(ir,{id:"rental_terms",value:d.rental_terms,onChange:w=>u({...d,rental_terms:w.target.value}),rows:4,maxLength:1e3,placeholder:"Age requirements, license requirements, fuel policy, damage policy, etc."})]})]})})]}),r.jsxs("div",{className:"flex gap-2 justify-end mt-6 pt-6 border-t",children:[r.jsx(W,{type:"button",variant:"outline",onClick:()=>t(!1),disabled:i,children:"Cancel"}),r.jsx(W,{type:"submit",disabled:i||h.length===0,children:i?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})]})})},L2e=()=>{const{user:e}=bt(),{toast:t}=Sn(),n=zn(),[s,a]=j.useState([]),[i,o]=j.useState(null),[l,c]=j.useState(!0),[d,u]=j.useState(null),[h,f]=j.useState(!1),[m,x]=j.useState(!1),[p,v]=j.useState(!1),[g,y]=j.useState(null);j.useEffect(()=>{e&&b()},[e]);const b=async()=>{c(!0);try{await Promise.all([w(),_()])}finally{c(!1)}},w=async()=>
913{if(e)try{const{data:A,error:R}=await H.from("rental_cars").select("*").eq("owner_id",e.id).order("created_at",{ascending:!1});if(R)throw R;a(A||[])}catch(A){console.error("Error fetching listings:",A),t({title:"Error loading listings",variant:"destructive"})}},_=async()=>{if(e)try{const A=s.filter($=>$.status==="active").length,R=s.filter($=>$.moderation_status==="pending").length,L=s.filter($=>$.is_featured).length,z=s.reduce(($,q)=>$+(q.view_count||0),0),{count:U}=await H.from("rental_car_inquiries").select("*",{count:"exact",head:!0}).in("rental_car_id",s.map($=>$.id));o({totalListings:s.length,activeListings:A,totalInquiries:U||0,pendingModeration:R,featuredListings:L,totalViews:z})}catch(A){console.error("Error fetching stats:",A)}},C=()=>{f(!1),b(),t({title:"Listing created successfully!"})},E=()=>{x(!1),b(),t({title:"Listing updated successfully!"})},N=async(A,R)=>{try{const L=R==="active"?"inactive":"active",{error:z}=await H.from("rental_cars").update({status:L}).eq("id",A);if(z)throw z;t({title:`Listing ${L==="active"?"activated":"deactivated"}`}),w()}catch(L){console.error("Error toggling status:",L),t({title:"Error updating listing",variant:"destructive"})}},k=async A=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{const{error:R}=await H.from("rental_cars").delete().eq("id",A);if(R)throw R;t({title:"Listing deleted successfully"}),w()}catch(R){console.error("Error deleting listing:",R),t({title:"Error deleting listing",variant:"destructive"})}},I=A=>{u(A),x(!0)},P=A=>A.status!=="active"?r.jsx(te,{variant:"secondary",children:"Inactive"}):A.moderation_status==="pending"?r.jsxs(te,{variant:"outline",className:"gap-1",children:[r.jsx($r,{className:"h-3 w-3"}),"Pending Review"]}):A.moderation_status==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):r.jsxs(te,{variant:"default",className:"gap-1",children:[r.jsx(er,{className:"h-3 w-3"}),"Active"]}),O=A=>r.jsxs("div",{className:"flex flex-wrap gap-1",children:[A.is_featured&&r.jsxs(te,{className:"gap-1 bg-gradient-to-r from-green-600 to-emerald-600 text-white border-0",children:[r.jsx(lr,{className:"h-3 w-3"}),"Featured"]}),A.driver_included&&r.jsxs(te,{className:"gap-1 bg-blue-600 text-white border-0",children:[r.jsx(Yr,{className:"h-3 w-3"}),"Driver"]}),A.security_personnel_included&&r.jsxs(te,{className:"gap-1 bg-purple-600 text-white border-0",children:[r.jsx(fn,{className:"h-3 w-3"}),"Security"]})]});return l?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):s.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(xa,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No Rental Listings Yet"}),r.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:"Start earning by listing your vehicles or equipment for rent. It takes just a few minutes!"}),r.jsxs(Rt,{open:h,onOpenChange:f,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{size:"lg",className:"gap-2",children:[r.jsx(xs,{className:"h-5 w-5"}),"List Your First Vehicle"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"List Vehicle or Equipment"})}),r.jsx(g_,{onSuccess:C})]})]}),r.jsxs(_r,{className:"mt-8 max-w-md mx-auto",children:[r.jsx(tc,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Pro Tip:"})," Listings with clear photos and detailed descriptions get 5x more inquiries!"]})]})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(ep,{onBoostClick:()=>{s.length>0?s.length===1?(y(s[0]),v(!0)):t({title:"Select a Listing",description:'Click the "Boost" button on any rental card to feature it'}):t({title:"No Listings",description:"Create a rental listing first",variant:"destructive"})},onViewPlansClick:()=>{n("/dashboard",{state:{activeTab:"subscription"}})}}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Rt,{open:h,onOpenChange:f,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{className:"gap-2",children:[r.jsx(xs,{className:"h-4 w-4"}),"New Listing"]})}),r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"List Vehicle or Equipment"})}),r.jsx(g_,{onSuccess:C})]})]}),r.jsxs(W,{variant:"outline",onClick:()=>n("/rentals"),children:[r.jsx(Cr,{className:"mr-2 h-4 w-4"}),"View Public Listings"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Listings"}),r.jsx("p",{className:"text-2xl font-bold",children:(i==null?void 0:i.totalListings)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[(i==null?void 0:i.activeListings)||0," active"]})]}
913),r.jsx(xa,{className:"h-8 w-8 text-primary"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Inquiries"}),r.jsx("p",{className:"text-2xl font-bold",children:(i==null?void 0:i.totalInquiries)||0}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Total contacts"})]}),r.jsx(Yr,{className:"h-8 w-8 text-blue-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Featured"}),r.jsx("p",{className:"text-2xl font-bold",children:(i==null?void 0:i.featuredListings)||0}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Boosted listings"})]}),r.jsx(lr,{className:"h-8 w-8 text-green-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Views"}),r.jsx("p",{className:"text-2xl font-bold",children:(i==null?void 0:i.totalViews)||0}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"All-time"})]}),r.jsx(Cr,{className:"h-8 w-8 text-yellow-500"})]})})})]}),r.jsxs(Kr,{defaultValue:"all",className:"w-full",children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"all",children:["All Listings (",s.length,")"]}),r.jsxs(Re,{value:"active",children:["Active (",s.filter(A=>A.status==="active"&&A.moderation_status==="approved").length,")"]}),r.jsxs(Re,{value:"pending",children:["Pending (",s.filter(A=>A.moderation_status==="pending").length,")"]}),r.jsxs(Re,{value:"rejected",children:["Rejected (",s.filter(A=>A.moderation_status==="rejected").length,")"]}),r.jsxs(Re,{value:"inactive",children:["Inactive (",s.filter(A=>A.status==="inactive").length,")"]})]}),r.jsx(Be,{value:"all",className:"space-y-4 mt-4",children:s.map(A=>{var R;return r.jsx(Y,{className:"overflow-hidden",children:r.jsx(X,{className:"p-0",children:r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsxs("div",{className:"md:w-48 h-48 relative flex-shrink-0",children:[(R=A.photos)!=null&&R[0]?r.jsx("img",{src:A.photos[0],alt:A.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:r.jsx(no,{className:"h-12 w-12 text-muted-foreground"})}),A.photos&&A.photos.length>1&&r.jsxs(te,{className:"absolute bottom-2 right-2 bg-black/70",children:[A.photos.length," photos"]})]}),r.jsxs("div",{className:"flex-1 p-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-semibold mb-1",children:A.title}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:A.make&&A.model?`${A.year} ${A.make} ${A.model}`:A.listing_type.charAt(0).toUpperCase()+A.listing_type.slice(1)}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:[A.city,", ",A.state]}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[P(A),O(A)]})]}),r.jsxs("div",{className:"text-right ml-4",children:[r.jsxs("div",{className:"text-2xl font-bold text-primary",children:["â¦",A.daily_rate.toLocaleString()]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"per day"}),A.weekly_rate&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["â¦",A.weekly_rate.toLocaleString(),"/week"]})]})]}),A.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-4 line-clamp-2",children:A.description}),r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground mb-4",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Cr,{className:"h-4 w-4"}),A.view_count||0," views"]}),A.is_featured&&A.feature_expires_at&&r.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(Va,{className:"h-4 w-4"}),"Featured until ",new Date(A.feature_expires_at).toLocaleDateString()]}),A.transmission&&r.jsx("span",{children:A.transmission}),A.seats&&r.jsxs("span",{children:[A.seats," seats"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>I(A),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Edit"]}),!A.is_featured&&r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>{y(A),v(!0)},className:"gap-2 border-green-600 text-green-600 hover:bg-green-50",children:[r.jsx(lr,{className:"h-4 w-4"}),"Boost"]}),r.jsx(W,{variant:A.status==="active"?"outline":"default",size:"sm",onClick:()=>N(A.id,A.status),children:A.status==="active"?"Deactivate":"Activate"}),r.jsx(W,{variant:"destructive",size:"sm",onClick:()=>k(A.id),children:"Delete"})]})]})]})})},A.id)})}
913),r.jsxs(Be,{value:"active",className:"space-y-4 mt-4",children:[s.filter(A=>A.status==="active"&&A.moderation_status==="approved").map(A=>{var R;return r.jsx(Y,{className:"overflow-hidden",children:r.jsx(X,{className:"p-0",children:r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-48 h-48 relative flex-shrink-0",children:(R=A.photos)!=null&&R[0]?r.jsx("img",{src:A.photos[0],alt:A.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:r.jsx(no,{className:"h-12 w-12 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 p-6",children:[r.jsx("h3",{className:"text-lg font-semibold mb-2",children:A.title}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[P(A),O(A)]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>I(A),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>N(A.id,A.status),children:"Deactivate"})]})]})]})})},A.id)}),s.filter(A=>A.status==="active"&&A.moderation_status==="approved").length===0&&r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(vn,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No active listings"})]})]}),r.jsxs(Be,{value:"pending",className:"space-y-4 mt-4",children:[s.filter(A=>A.moderation_status==="pending").map(A=>r.jsx(Y,{className:"border-yellow-600/30 bg-yellow-50/50 dark:bg-yellow-950/20",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:A.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Awaiting admin approval"})]}),r.jsxs(te,{variant:"outline",className:"gap-1",children:[r.jsx($r,{className:"h-3 w-3"}),"Pending"]})]})})},A.id)),s.filter(A=>A.moderation_status==="pending").length===0&&r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(er,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No pending listings"})]})]}),r.jsxs(Be,{value:"rejected",className:"space-y-4 mt-4",children:[s.filter(A=>A.moderation_status==="rejected").map(A=>r.jsx(Y,{className:"border-red-600/30 bg-red-50/50 dark:bg-red-950/20",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:A.title}),r.jsx("p",{className:"text-sm text-destructive",children:"Rejected by admin"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{size:"sm",onClick:()=>I(A),children:"Edit & Resubmit"}),r.jsx(W,{size:"sm",variant:"destructive",onClick:()=>k(A.id),children:"Delete"})]})]})})},A.id)),s.filter(A=>A.moderation_status==="rejected").length===0&&r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(er,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No rejected listings"})]})]}),r.jsxs(Be,{value:"inactive",className:"space-y-4 mt-4",children:[s.filter(A=>A.status==="inactive").map(A=>r.jsx(Y,{className:"opacity-60",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:A.title}),r.jsx(te,{variant:"secondary",children:"Inactive"})]}),r.jsx(W,{size:"sm",onClick:()=>N(A.id,A.status),children:"Activate"})]})})},A.id)),s.filter(A=>A.status==="inactive").length===0&&r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(er,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"All listings are active!"})]})]})]}),d&&r.jsx(O2e,{open:m,onOpenChange:x,listing:d,onSuccess:E}),g&&r.jsx(tp,{open:p,onOpenChange:v,entityId:g.id,entityType:"rental_car",entityTitle:g.title}),i&&i.totalInquiries===0&&s.length>0&&r.jsxs(_r,{children:[r.jsx(Va,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Get your first inquiry:"})," Add more photos, competitive pricing, and consider featuring your listing for more visibility!"]})]})]})};var MX="AlertDialog",[I2e,HJe]=ea(MX,[$W]),cu=$W(),DX=e=>{const{__scopeAlertDialog:t,...n}=e,s=cu(t);return r.jsx(oO,{...s,...n,modal:!0})};DX.displayName=MX;var R2e="AlertDialogTrigger",M2e=j.forwardRef((e,t)=>
913{const{__scopeAlertDialog:n,...s}=e,a=cu(n);return r.jsx(lO,{...a,...s,ref:t})});M2e.displayName=R2e;var D2e="AlertDialogPortal",$X=e=>{const{__scopeAlertDialog:t,...n}=e,s=cu(t);return r.jsx(cO,{...s,...n})};$X.displayName=D2e;var $2e="AlertDialogOverlay",FX=j.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=cu(n);return r.jsx(gj,{...a,...s,ref:t})});FX.displayName=$2e;var Tg="AlertDialogContent",[F2e,B2e]=I2e(Tg),U2e=gq("AlertDialogContent"),BX=j.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,i=cu(n),o=j.useRef(null),l=gr(t,o),c=j.useRef(null);return r.jsx(hpe,{contentName:Tg,titleName:UX,docsSlug:"alert-dialog",children:r.jsx(F2e,{scope:n,cancelRef:c,children:r.jsxs(xj,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:dt(a.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[r.jsx(U2e,{children:s}),r.jsx(q2e,{contentRef:o})]})})})});BX.displayName=Tg;var UX="AlertDialogTitle",zX=j.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=cu(n);return r.jsx(vj,{...a,...s,ref:t})});zX.displayName=UX;var qX="AlertDialogDescription",VX=j.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=cu(n);return r.jsx(yj,{...a,...s,ref:t})});VX.displayName=qX;var z2e="AlertDialogAction",WX=j.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=cu(n);return r.jsx(uS,{...a,...s,ref:t})});WX.displayName=z2e;var HX="AlertDialogCancel",GX=j.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=B2e(HX,n),i=cu(n),o=gr(t,a);return r.jsx(uS,{...i,...s,ref:o})});GX.displayName=HX;var q2e=({contentRef:e})=>{const t=`\`${Tg}\` requires a description for the component to be accessible for screen reader users. 914 915You can add a description to the \`${Tg}\` by passing a \`${qX}\` component as a child, which also benefits sighted users by adding visible context to the dialog. 916 917Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Tg}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. 918 919For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return j.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},V2e=DX,W2e=$X,YX=FX,KX=BX,XX=WX,ZX=GX,JX=zX,QX=VX;const H2e=V2e,G2e=W2e,eZ=j.forwardRef(({className:e,...t},n)=>r.jsx(YX,{className:Ge("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));eZ.displayName=YX.displayName;const tZ=j.forwardRef(({className:e,...t},n)=>r.jsxs(G2e,{children:[r.jsx(eZ,{}),r.jsx(KX,{ref:n,className:Ge("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));tZ.displayName=KX.displayName;const rZ=({className:e,...t})=>r.jsx("div",{className:Ge("flex flex-col space-y-2 text-center sm:text-left",e),...t});rZ.displayName="AlertDialogHeader";const nZ=({className:e,...t})=>r.jsx("div",{className:Ge("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});nZ.displayName="AlertDialogFooter";const sZ=j.forwardRef(({className:e,...t},n)=>r.jsx(JX,{ref:n,className:Ge("text-lg font-semibold",e),...t}));sZ.displayName=JX.displayName;const aZ=j.forwardRef(({className:e,...t},n)=>r.jsx(QX,{ref:n,className:Ge("text-sm text-muted-foreground",e),...t}));aZ.displayName=QX.displayName;const iZ=j.forwardRef(({className:e,...t},n)=>r.jsx(XX,{ref:n,className:Ge(H0(),e),...t}));iZ.displayName=XX.displayName;const oZ=j.forwardRef(({className:e,...t},n)=>r.jsx(ZX,{ref:n,className:Ge(H0({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));oZ.displayName=ZX.displayName;const Y2e=["Fashion Designers","Tailors","Chefs","Drivers","Mechanics","Event Coordinators","Security","Cleaners","Electricians","Plumbers","Gatemen","Carpenters","Painters","Welders","Hair Stylists","Barbers","Photographers","Videographers","Others"],K2e=["Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"],qi={BUSINESS_NAME:100,DESCRIPTION:1e3,SKILLS:500,CONTACT_PHONE:20,CONTACT_EMAIL:100,CONTACT_WHATSAPP:20,CITY:50};function X2e({artisan:e,open:t,onOpenChange:n,onSuccess:s}){const{user:a}=bt(),[i,o]=j.useState(!1),[l,c]=j.useState(!1),[d,u]=j.useState([]),[h,f]=j.useState([]),[m,x]=j.useState([]),[p,v]=j.useState([]),[g,y]=j.useState(null),[b,w]=j.useState({service_category:"",business_name:"",description:"",skills:"",experience_years:"",hourly_rate:"",daily_rate:"",contact_phone:"",contact_email:"",contact_whatsapp:"",city:"",state:"",available_for_travel:!1});j.useEffect(()=>{var A,R,L;e&&(w({service_category:e.service_category||"",business_name:e.business_name||"",description:e.description||"",skills:e.skills?e.skills.join(", "):"",experience_years:((A=e.experience_years)==null?void 0:A.toString())||"",hourly_rate:((R=e.hourly_rate)==null?void 0:R.toString())||"",daily_rate:((L=e.daily_rate)==null?void 0:L.toString())||"",contact_phone:e.contact_phone||"",contact_email:e.contact_email||"",contact_whatsapp:e.contact_whatsapp||"",city:e.city||"",state:e.state||"",available_for_travel:e.available_for_travel||!1}),x(e.portfolio_images||[]))},[e]),j.useEffect(()=>
919{a&&_()},[a]);const _=async()=>{if(a)try{const{data:A,error:R}=await H.rpc("check_artisan_limits",{user_id:a.id});if(R)throw R;y(A)}catch(A){console.error("Error checking limits:",A)}},C=A=>{const R=Array.from(A.target.files||[]);if(!g)return;const L=m.length-p.length+d.length,z=g.max_photos||3,U=z-L;if(R.length>U){be({title:"Photo limit exceeded",description:`You can only upload ${U} more photo(s). Current limit: ${z} photos.`,variant:"destructive"});return}const $=R.filter(ne=>ne.size>5*1024*1024?(be({title:"File too large",description:`${ne.name} exceeds 5MB limit`,variant:"destructive"}),!1):["image/jpeg","image/png","image/webp"].includes(ne.type)?!0:(be({title:"Invalid file type",description:`${ne.name} must be JPEG, PNG, or WebP`,variant:"destructive"}),!1));if($.length===0)return;const q=[];$.forEach(ne=>{const se=new FileReader;se.onloadend=()=>{q.push(se.result),q.length===$.length&&f([...h,...q])},se.readAsDataURL(ne)}),u([...d,...$])},E=A=>{v([...p,A])},N=A=>{v(p.filter(R=>R!==A))},k=A=>{u(d.filter((R,L)=>L!==A)),f(h.filter((R,L)=>L!==A))},I=async()=>{if(d.length===0)return[];const A=[];for(const R of d){const L=R.name.split(".").pop(),z=`${a.id}/${e.id}/${Math.random()}.${L}`,{data:U,error:$}=await H.storage.from("artisan-photos").upload(z,R,{cacheControl:"3600",upsert:!1});if($)throw console.error("Photo upload error:",$),$;const{data:{publicUrl:q}}=H.storage.from("artisan-photos").getPublicUrl(z);A.push(q)}return A},P=async()=>{if(p.length===0)return;const A=p.map(R=>{const L=R.split("/");return`${a.id}/${e.id}/${L[L.length-1]}`});await H.storage.from("artisan-photos").remove(A)},O=async()=>{if(!(!a||!e)){if(!b.service_category||!b.business_name||!b.city||!b.state){be({title:"Missing required fields",description:"Please fill in all required fields",variant:"destructive"});return}if(!b.contact_phone&&!b.contact_email&&!b.contact_whatsapp){be({title:"Contact information required",description:"Please provide at least one contact method",variant:"destructive"});return}o(!0);try{let A=[];d.length>0&&(c(!0),A=await I()),p.length>0&&await P();const R=[...m.filter(U=>!p.includes(U)),...A],L={service_category:b.service_category,business_name:b.business_name.trim(),description:b.description.trim()||null,skills:b.skills?b.skills.split(",").map(U=>U.trim()).filter(Boolean):null,experience_years:b.experience_years?parseInt(b.experience_years):null,hourly_rate:b.hourly_rate?parseFloat(b.hourly_rate):null,daily_rate:b.daily_rate?parseFloat(b.daily_rate):null,contact_phone:b.contact_phone.trim()||null,contact_email:b.contact_email.trim()||null,contact_whatsapp:b.contact_whatsapp.trim()||null,city:b.city.trim(),state:b.state,available_for_travel:b.available_for_travel,portfolio_images:R,updated_at:new Date().toISOString()},{error:z}=await H.from("artisans").update(L).eq("id",e.id);if(z)throw z;be({title:"Success",description:"Artisan listing updated successfully"}),s()}catch(A){console.error("Error updating artisan:",A),be({title:"Error",description:A.message||"Failed to update artisan listing",variant:"destructive"})}finally{o(!1),c(!1)}}};return r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Edit Artisan Profile"}),r.jsx(on,{children:"Update your service provider information"})]}),r.jsxs(Kr,{defaultValue:"basic",className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-4",children:[r.jsx(Re,{value:"basic",children:"Basic Info"}),r.jsx(Re,{value:"rates",children:"Rates & Location"}),r.jsx(Re,{value:"contact",children:"Contact"}),r.jsx(Re,{value:"photos",children:"Photos"})]}),r.jsxs(Be,{value:"basic",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"service_category",children:"Service Category *"}),r.jsxs(mt,{value:b.service_category,onValueChange:A=>w({...b,service_category:A}),children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsx(ht,{children:Y2e.map(A=>r.jsx(Ne,{value:A,children:A},A))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"business_name",children:"Business N
919ame *"}),r.jsx(ge,{id:"business_name",value:b.business_name,onChange:A=>w({...b,business_name:A.target.value.slice(0,qi.BUSINESS_NAME)})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.business_name.length,"/",qi.BUSINESS_NAME]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Description"}),r.jsx(ir,{id:"description",value:b.description,onChange:A=>w({...b,description:A.target.value.slice(0,qi.DESCRIPTION)}),rows:4}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.description.length,"/",qi.DESCRIPTION]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"skills",children:"Skills (comma-separated)"}),r.jsx(ge,{id:"skills",value:b.skills,onChange:A=>w({...b,skills:A.target.value.slice(0,qi.SKILLS)}),placeholder:"E.g., Wedding dresses, Ankara designs, Alterations"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.skills.length,"/",qi.SKILLS]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"experience_years",children:"Years of Experience"}),r.jsx(ge,{id:"experience_years",type:"number",min:"0",max:"70",value:b.experience_years,onChange:A=>w({...b,experience_years:A.target.value})})]})]}),r.jsxs(Be,{value:"rates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"hourly_rate",children:"Hourly Rate (â¦)"}),r.jsx(ge,{id:"hourly_rate",type:"number",min:"0",step:"0.01",value:b.hourly_rate,onChange:A=>w({...b,hourly_rate:A.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"daily_rate",children:"Daily Rate (â¦)"}),r.jsx(ge,{id:"daily_rate",type:"number",min:"0",step:"0.01",value:b.daily_rate,onChange:A=>w({...b,daily_rate:A.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"city",children:"City *"}),r.jsx(ge,{id:"city",value:b.city,onChange:A=>w({...b,city:A.target.value.slice(0,qi.CITY)})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.city.length,"/",qi.CITY]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"state",children:"State *"}),r.jsxs(mt,{value:b.state,onValueChange:A=>w({...b,state:A}),children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsx(ht,{children:K2e.map(A=>r.jsx(Ne,{value:A,children:A},A))})]})]})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Uo,{id:"available_for_travel",checked:b.available_for_travel,onCheckedChange:A=>w({...b,available_for_travel:A})}),r.jsx(le,{htmlFor:"available_for_travel",className:"cursor-pointer",children:"Available to travel for jobs"})]})]}),r.jsxs(Be,{value:"contact",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_phone",children:"Phone Number"}),r.jsx(ge,{id:"contact_phone",type:"tel",value:b.contact_phone,onChange:A=>w({...b,contact_phone:A.target.value.slice(0,qi.CONTACT_PHONE)})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.contact_phone.length,"/",qi.CONTACT_PHONE]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_email",children:"Email Address"}),r.jsx(ge,{id:"contact_email",type:"email",value:b.contact_email,onChange:A=>w({...b,contact_email:A.target.value.slice(0,qi.CONTACT_EMAIL)})}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.contact_email.length,"/",qi.CONTACT_EMAIL]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"contact_whatsapp",children:"WhatsApp Number"}),r.jsx(ge,{id:"contact_whatsapp",type:"tel",value:b.contact_whatsapp,onChange:A=>w({...b,contact_whatsapp:A.target.value.slice(0,qi.CONTACT_WHATSAPP)}),placeholder:"Include country code (234 for Nigeria)"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.contact_whatsapp.length,"/",qi.CONTACT_WHATSAPP]})]})]}),r.jsxs(Be,{value:"photos",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(le,{children:"Portfolio Photos"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length-p.length+d.length,"/",(g==null?void 0:g.max_photos)||3," photos"]})]}),m.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Current Photos"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:m.map((A,R)=>r.jsx(Y,{className:`relative group ${p.includes(A)?"opacity-50":""}`,children:r.jsxs(X,{className:"p-2",children:[r.jsx("img",{src:A,alt:`Photo ${R+1}`,className:"w-full h-32 object-cover rounded"}),p.includes(A)?r.jsx(W,{type:"button",variant:"secondary",size:"sm",className:"absolute top-3 right-3",onClick:()=>N(A),children:"Restore"}):r.jsx(W,{type:"button",variant:"destructive",size:"sm",className:"absolute top-3 right-3 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>E(A),children:r.jsx(ks,{className:"h-4 w-4"})})]})},R))})]}),h.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"New Photos"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:h.map((A,R)=>r.jsx(Y,{className:"relative group",children:r.jsxs(X,{className:"p-2",children:[r.jsx("img",{src:A,alt:`New ${R+1}`,className:"w-full h-32 object-cover rounded"}),r.jsx(W,{type:"button",variant:"destructive",size:"sm",className:"absolute top-3 right-3 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>k(R),children:r.jsx(ks,{className:"h-4 w-4"})})]})},R))})]}),m.length-p.length+d.length<((g==null?void 0:g.max_photos)||3)&&r.jsxs("div",{children:[r.jsx(ge,{type:"file",accept:"image/jpeg,image/png,image/webp",multiple:!0,onChange:C,className:"hidden",id:"photo-upload-edit"}),r.jsxs(le,{htmlFor:"photo-upload-edit",className:"flex items-center justify-center gap-2 p-6 border-2 border-dashed rounded-lg cursor-pointer hover:bg-accent/5",children:[r.jsx(Jn,{className:"h-5 w-5"}),r.jsx("span",{children:"Upload More Photos"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Max 5MB per photo. Formats: JPEG, PNG, WebP"})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[r.jsx(W,{variant:"outline",onClick:()=>n(!1),disabled:i,children:"Cancel"}),r.jsx(W,{onClick:O,disabled:i||l,children:i?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),l?"Uploading...":"Saving..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Sm,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})})}function Z2e(){const{user:e}=bt(),t=zn(),[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState({total:0,active:0,pending:0,views:0}),[c,d]=j.useState(!1),[u,h]=j.useState(null),[f,m]=j.useState(null),[x,p]=j.useState("all"),[v,g]=j.useState(!1),[y,b]=j.useState(null);j.useEffect(()=>{e&&w()},[e]);const w=async()=>
919{if(e){i(!0);try{const{data:P,error:O}=await H.from("artisans").select("*").eq("user_id",e.id).order("created_at",{ascending:!1});if(O)throw O;s(P||[]),_(P||[])}catch(P){console.error("Error fetching artisans:",P),be({title:"Error",description:"Failed to load your artisan listings",variant:"destructive"})}finally{i(!1)}}},_=P=>{const O=P.length,A=P.filter(z=>z.status==="active"&&z.moderation_status==="approved").length,R=P.filter(z=>z.moderation_status==="pending").length,L=P.reduce((z,U)=>z+(U.view_count||0),0);l({total:O,active:A,pending:R,views:L})},C=async P=>{try{const{data:O}=await H.from("artisans").select("portfolio_images").eq("id",P).single();if(O!=null&&O.portfolio_images&&O.portfolio_images.length>0){const R=O.portfolio_images.map(L=>{const z=L.split("/");return`${e.id}/${P}/${z[z.length-1]}`});await H.storage.from("artisan-photos").remove(R)}const{error:A}=await H.from("artisans").delete().eq("id",P);if(A)throw A;be({title:"Success",description:"Artisan listing deleted successfully"}),w()}catch(O){console.error("Error deleting artisan:",O),be({title:"Error",description:O.message||"Failed to delete artisan listing",variant:"destructive"})}finally{m(null)}},E=async(P,O)=>{const A=O==="active"?"suspended":"active";try{const{error:R}=await H.from("artisans").update({status:A}).eq("id",P);if(R)throw R;be({title:"Success",description:`Listing ${A==="active"?"activated":"deactivated"}`}),w()}catch(R){console.error("Error toggling status:",R),be({title:"Error",description:"Failed to update status",variant:"destructive"})}},N=P=>P.moderation_status==="pending"?r.jsx(te,{variant:"outline",className:"bg-yellow-50",children:"Pending Review"}):P.moderation_status==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):P.status==="inactive"?r.jsx(te,{variant:"secondary",children:"Inactive"}):P.status==="active"&&P.moderation_status==="approved"?r.jsx(te,{variant:"default",className:"bg-green-600",children:"Active"}):r.jsx(te,{variant:"outline",children:"Draft"}),k=n.filter(P=>x==="all"?!0:x==="active"?P.status==="active"&&P.moderation_status==="approved":x==="pending"?P.moderation_status==="pending":x==="rejected"?P.moderation_status==="rejected":x==="inactive"?P.status==="inactive":!0),I=()=>r.jsxs("div",{className:"text-center py-12",children:[r.jsx(fr,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:x==="all"?"No artisan listings yet":`No ${x} listings`}),r.jsx("p",{className:"text-muted-foreground mb-6",children:x==="all"?"Start earning by creating your first artisan profile!":`You don't have any ${x} listings at the moment.`}),x==="all"&&r.jsxs(Rt,{open:c,onOpenChange:d,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{children:[r.jsx(xs,{className:"mr-2 h-5 w-5"}),"Create First Listing"]})}),r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Create Artisan Profile"}),r.jsx(on,{children:"Showcase your skills and connect with potential clients"})]}),r.jsx(m_,{onSuccess:()=>{d(!1),w()}})]})]})]});return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(ep,{onBoostClick:()=>{n.length>0?n.length===1?(b(n[0]),g(!0)):be({title:"Select an Artisan",description:'Click the "Boost" button on any artisan card to feature it'}):be({title:"No Artisan Listings",description:"Create an artisan listing first",variant:"destructive"})},onViewPlansClick:()=>{t("/dashboard",{state:{activeTab:"subscription"}})}}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Total Listings"}),r.jsx(fr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:o.total})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Active Listings"}),r.jsx(mr,{className:"h-4 w-4 text-green-600"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:o.active})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Pending Review"}),r.jsx(lr,{className:"h-4 w-4 text-yellow-600"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:o.pending})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Total Views"}),r.jsx(Cr,{className:"h-4 w-4 text-blue-600"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:o.views})})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Rt,{open:c,onOpenChange:d,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{children:[r.jsx(xs,{className:"mr-2 h-5 w-5"}),"Create New Listing"]})}),r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Create Artisan Profile"}),r.jsx(on,{children:"Showcase your skills and connect with potential clients"})]}),r.jsx(m_,{onSuccess:()=>{d(!1),w()}})]})]}),r.jsx(W,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:"/artisans",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Cr,{className:"mr-2 h-5 w-5"}),"View Public Page"]})})]}),r.jsxs(Kr,{value:x,onValueChange:p,children:[r.jsxs(Hr,{className:"grid w-full grid-cols-5",children:[r.jsxs(Re,{value:"all",children:["All (",n.length,")"]}),r.jsxs(Re,{value:"active",children:["Active (",n.filter(P=>P.status==="active"&&P.moderation_status==="approved").length,")"]}),r.jsxs(Re,{value:"pending",children:["Pending (",n.filter(P=>P.moderation_status==="pending").length,")"]}),r.jsxs(Re,{value:"rejected",children:["Rejected (",n.filter(P=>P.moderation_status==="rejected").length,")"]}),r.jsxs(Re,{value:"inactive",children:["Inactive (",n.filter(P=>P.status==="inactive").length,")"]})]}
919),r.jsx(Be,{value:x,className:"space-y-4 mt-6",children:k.length===0?I():r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:k.map(P=>r.jsxs(Y,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative h-48 bg-gradient-to-br from-primary/10 to-accent/10",children:[P.portfolio_images&&P.portfolio_images.length>0?r.jsx("img",{src:P.portfolio_images[0],alt:P.business_name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(fr,{className:"h-16 w-16 text-muted-foreground opacity-30"})}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-2",children:[N(P),P.is_featured&&r.jsx(te,{className:"bg-gradient-to-r from-green-600 to-emerald-600",children:"Featured"})]})]}),r.jsxs(X,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-1",children:P.business_name}),r.jsx(te,{variant:"outline",className:"mt-1",children:P.service_category})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(At,{className:"h-4 w-4"}),r.jsxs("span",{children:[P.city,", ",P.state]})]}),r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cr,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[P.view_count||0," views"]})]}),P.hourly_rate&&r.jsxs("span",{className:"font-semibold",children:["â¦",P.hourly_rate.toLocaleString(),"/hr"]})]}),P.moderation_status==="rejected"&&P.moderation_notes&&r.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm",children:[r.jsx("p",{className:"font-semibold text-red-800 mb-1",children:"Rejection Reason:"}),r.jsx("p",{className:"text-red-700",children:P.moderation_notes})]}),r.jsxs("div",{className:"flex gap-2 pt-2",children:[r.jsxs(W,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>h(P),children:[r.jsx(so,{className:"mr-2 h-4 w-4"}),"Edit"]}),!P.is_featured&&r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>{b(P),g(!0)},className:"gap-2 border-green-600 text-green-600 hover:bg-green-50",children:[r.jsx(lr,{className:"h-4 w-4"}),"Boost"]}),P.moderation_status==="approved"&&r.jsx(W,{variant:"outline",size:"sm",onClick:()=>E(P.id,P.status),children:P.status==="active"?r.jsx(Kp,{className:"h-4 w-4"}):r.jsx(Cr,{className:"h-4 w-4"})}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>m(P.id),children:r.jsx(ao,{className:"h-4 w-4"})})]})]})]},P.id))})})]}),u&&r.jsx(X2e,{artisan:u,open:!!u,onOpenChange:P=>!P&&h(null),onSuccess:()=>{h(null),w()}}),r.jsx(H2e,{open:!!f,onOpenChange:()=>m(null),children:r.jsxs(tZ,{children:[r.jsxs(rZ,{children:[r.jsx(sZ,{children:"Are you sure?"}),r.jsx(aZ,{children:"This will permanently delete your artisan listing and all associated photos. This action cannot be undone."})]}),r.jsxs(nZ,{children:[r.jsx(oZ,{children:"Cancel"}),r.jsx(iZ,{onClick:()=>f&&C(f),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),y&&r.jsx(tp,{open:v,onOpenChange:g,entityId:y.id,entityType:"artisan",entityTitle:y.business_name})]})}function J2e({onSuccess:e}){const{user:t}=bt(),[n,s]=j.useState(!1),[a,i]=j.useState("paystack"),[o,l]=j.useState(!1),[c,d]=j.useState({owner_name:"",owner_phone:"",business_description:"",website_or_social_url:"",nin_number:"",bvn_number:"",cac_registration_number:""}),[u,h]=j.useState({address_proof:[],cac_status_report:[],business_license:[]}),f=async m=>{if(m.preventDefault(),!t){be({title:"Please log in to continue",variant:"destructive"});return}if(!o){be({title:"Please accept the terms and conditions",variant:"destructive"});return}if(!c.owner_name||!c.owner_phone||!c.business_description){be({title:"Please fill in all required fields",variant:"destructive"});return}s(!0);try{const{data:x,error:p}=await H.functions.invoke("initialize-vendor-badge",{body:{...c,address_proof_url:u.address_proof[0]||null,cac_status_report_url:u.cac_status_report[0]||null,business_license_url:u.business_license[0]||null,payment_provider:a}});if(p)throw p;(x.payment_url||x.authorization_url)&&(be({title:"Redirecting to payment...",description:"Complete the payment to submit your application."}),window.location.href=x.payment_url||x.authorization_url),e==null||e()}catch(x){console.error("Error submitting badge application:",x),be({title:"Submission Failed",description:x.message||"Failed to submit badge application",variant:"destructive"})}finally{s(!1)}};return r.jsxs(Y,{className:"border-primary/20",children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(fn,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:["Get Verified by Naija.com",r.jsx(te,{variant:"secondary",className:"bg-green-100 text-green-700",children:"â¦150,000/year"})]}),r.jsx(Nt,{children:"Increase trust and credibility with a verified business badge"})]})]})}),r.jsxs(X,{children:[r.jsxs(_r,{className:"mb-6 border-blue-200 bg-blue-50",children:[r.jsx(tc,{
919className:"h-4 w-4 text-blue-600"}),r.jsxs(Sr,{className:"text-blue-700",children:[r.jsx("strong",{children:"What you get:"})," A verified badge displayed on your store and all product listings, increased visibility in search results, and enhanced trust from buyers."]})]}),r.jsxs("form",{onSubmit:f,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold text-lg flex items-center gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"1"}),"Business Owner Information"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"owner_name",children:["Owner Full Name ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(ge,{id:"owner_name",value:c.owner_name,onChange:m=>d({...c,owner_name:m.target.value}),placeholder:"Enter full legal name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"owner_phone",children:["Owner Phone Number ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(ge,{id:"owner_phone",type:"tel",value:c.owner_phone,onChange:m=>d({...c,owner_phone:m.target.value}),placeholder:"+234 XXX XXX XXXX",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(le,{htmlFor:"business_description",children:["Detailed Business Description ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx(ir,{id:"business_description",value:c.business_description,onChange:m=>d({...c,business_description:m.target.value}),placeholder:"Describe your business nature, products, and services in detail...",rows:4,required:!0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Include: business nature, products/services offered, years in operation"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"website_or_social_url",children:"Website or Social Media URL"}),r.jsx(ge,{id:"website_or_social_url",type:"url",value:c.website_or_social_url,onChange:m=>d({...c,website_or_social_url:m.target.value}),placeholder:"https://www.yourbusiness.com or Instagram/Facebook page"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Ensure full business address, email, and phone number are visible on your page"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold text-lg flex items-center gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"2"}),"Verification Documents"]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"cac_registration_number",children:"CAC Registration Number"}),r.jsx(ge,{id:"cac_registration_number",value:c.cac_registration_number,onChange:m=>d({...c,cac_registration_number:m.target.value}),placeholder:"RC XXXXXXX or BN XXXXXXX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Proof of Operating Business Address"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Upload: Signed tenancy/lease agreement, utility bill (â¤3 months), or bank statement (â¤90 days)"}),r.jsx(Wd,{images:u.address_proof,onImagesChange:m=>h({...u,address_proof:m}),maxImages:1,bucket:"verification-documents"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"CAC Status Report"}),r.jsx(Wd,{images:u.cac_status_report,onImagesChange:m=>h({...u,cac_status_report:m}),maxImages:1,bucket:"verification-documents"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Business Operating License (if applicable)"}),r.jsx(Wd,{images:u.business_license,onImagesChange:m=>h({...u,business_license:m}),maxImages:1,bucket:"verification-documents"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold text-lg flex items-center gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"3"}),"Identity Verification"]}),r.jsxs(_r,{className:"border-amber-200 bg-amber-50",children:[r.jsx(Oo,{className:"h-4 w-4 text-amber-600"}),r.jsx(Sr,{className:"text-amber-700",children:"Your NIN and BVN are securely encrypted and only used for verification purposes."})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"nin_number",children:"National Identity Number (NIN)"}),r.jsx(ge,{id:"nin_number",type:"password",value:c.nin_number,onChange:m=>d({...c,nin_number:m.target.value}),placeholder:"Enter 11-digit NIN",maxLength:11})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"bvn_number",children:"Bank Verification Number (BVN)"}),r.jsx(ge,{id:"bvn_number",type:"password",value:c.bvn_number,onChange:m=>d({...c,bvn_number:m.target.value}),placeholder:"Enter 11-digit BVN",maxLength:11})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold text-lg flex items-center gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-6 h-6 flex items-center justify-center text-sm",children:"4"}),"Payment Method"]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Select Payment Provider"}),r.jsxs(mt,{value:a,onValueChange:m=>i(m),children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"paystack",children:"Paystack"}),r.jsx(Ne,{value:"flutterwave",children:"Flutterwave"})]})]})]})]}),r.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Uo,{id:"terms",checked:o,onCheckedChange:m=>l(m===!0)}),r.jsxs(le,{htmlFor:"terms",className:"text-sm leading-relaxed",children:["I confirm that all information provided is accurate. I understand that providing false information may result in badge revocation without refund. I agree to the"," ",r.jsx("a",{href:"/terms-of-service",className:"text-primary underline",children:"Terms of Service"})," and"," ",r.jsx("a",{href:"/privacy-policy",className:"text-primary underline",children:"Privacy Policy"}),"."]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Total: â¦150,000"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Valid for 1 year from approval date"})]}),r.jsx(W,{type:"submit",size:"lg",disabled:n||!o,className:"min-w-[200px]",children:n?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(fn,{className:"mr-2 h-4 w-4"}),"Pay & Submit Application"]})})]})})]})]})]})]})}function Q2e({onApply:e}){var l;const{user:t}=bt(),[n,s]=j.useState(null),[a,i]=j.useState(!0);j.useEffect(()=>{t&&o()},[t]);const o=async()=>
919{if(t)try{const{data:c}=await H.from("vendor_profiles").select("is_verified_by_naija, verified_badge_expires_at, verification_status").eq("user_id",t.id).maybeSingle(),{data:d}=await H.from("vendor_badge_applications").select("id, status, created_at, admin_notes").eq("user_id",t.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();s({is_verified:(c==null?void 0:c.is_verified_by_naija)||!1,expires_at:(c==null?void 0:c.verified_badge_expires_at)||null,status:(c==null?void 0:c.verification_status)||null,application:d||null})}catch(c){console.error("Error fetching badge status:",c)}finally{i(!1)}};if(a)return r.jsx(Y,{children:r.jsx(X,{className:"py-8 flex items-center justify-center",children:r.jsx(ms,{className:"h-6 w-6 animate-spin text-muted-foreground"})})});if(!(n!=null&&n.is_verified)&&!(n!=null&&n.application))return r.jsx(Y,{className:"border-dashed border-2 border-muted",children:r.jsxs(X,{className:"py-8 text-center",children:[r.jsx(fn,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"Get Verified by Naija.com"}),r.jsx("p",{className:"text-muted-foreground mb-4 max-w-md mx-auto",children:"Stand out from competitors with a verified business badge. Increase trust and boost your sales."}),r.jsxs(W,{onClick:e,className:"gap-2",children:[r.jsx(fn,{className:"h-4 w-4"}),"Apply for Verification (â¦150,000/year)"]})]})});if(n!=null&&n.application&&["pending_payment","pending_review"].includes(n.application.status))return r.jsxs(Y,{className:"border-amber-200 bg-amber-50/50",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2 text-amber-700",children:[r.jsx($r,{className:"h-5 w-5"}),"Verification In Progress"]})}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Application Status"}),r.jsx(te,{variant:"secondary",className:"bg-amber-100 text-amber-700",children:n.application.status==="pending_payment"?"Awaiting Payment":"Under Review"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Submitted"}),r.jsx("span",{className:"text-sm",children:wr(new Date(n.application.created_at),"PPP")})]}),n.application.status==="pending_review"&&r.jsx(_r,{className:"border-blue-200 bg-blue-50",children:r.jsx(Sr,{className:"text-blue-700",children:"Our team is reviewing your documents. This typically takes 3-5 business days."})})]})})]});if(((l=n==null?void 0:n.application)==null?void 0:l.status)==="rejected")return r.jsxs(Y,{className:"border-destructive/50 bg-destructive/5",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(ya,{className:"h-5 w-5"}),"Application Rejected"]})}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-3",children:[n.application.admin_notes&&r.jsxs(_r,{className:"border-destructive/20",children:[r.jsx(Oo,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Reason:"})," ",n.application.admin_notes]})]}),r.jsxs(W,{onClick:e,variant:"outline",className:"w-full gap-2",children:[r.jsx(ms,{className:"h-4 w-4"}),"Reapply for Verification"]})]})})]});if(n!=null&&n.is_verified&&n.expires_at){const c=new Date(n.expires_at),d=f_(c,new Date),u=d<=30,h=d<0;return r.jsxs(Y,{className:`border-2 ${h?"border-destructive":u?"border-amber-500":"border-green-500"}`,children:[r.jsxs(Se,{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ae,{className:"flex items-center gap-2 text-green-700",children:[r.jsx(Rd,{className:"h-5 w-5"}),"Verified by Naija.com"]}),r.jsx(te,{className:h?"bg-destructive":u?"bg-amber-500":"bg-green-600",children:h?"Expired":u?"Expiring Soon":"Active"})]}),r.jsx(Nt,{children:"Your business is verified and trusted by Naija.com"})]}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Valid Until"}),r.jsx("span",{className:"text-sm font-medium",children:wr(c,"PPP")})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Days Remaining"}),r.jsx("span",{className:`text-sm font-medium ${h?"text-destructive":u?"text-amber-600":"text-green-600"}`,children:h?"Expired":`${d} days`})]}),(u||h)&&r.jsxs(_r,{className:h?"border-destructive/20 bg-destructive/5":"border-amber-200 bg-amber-50",children:[r.jsx(Oo,{className:"h-4 w-4"}),r.jsx(Sr,{children:h?"Your verification badge has expired. Renew now to maintain your verified status.":`Your badge expires in ${d} days. Renew early to maintain uninterrupted verification.`})]}),(u||h)&&r.jsxs(W,{onClick:e,className:"w-full gap-2",children:[r.jsx(ms,{className:"h-4 w-4"}),"Renew Verification (â¦150,000)"]})]})})]})}return null}function eSe({advertisement:e,open:t,onOpenChange:n,onSuccess:s}
919){const[a,i]=j.useState(!1),[o,l]=j.useState({title:e.title,description:e.description||"",target_url:e.target_url||"",banner_image_url:e.banner_image_url||"",logo_url:e.logo_url||"",business_name:e.business_name,business_email:e.business_email,business_phone:e.business_phone||"",business_website:e.business_website||""}),c=async d=>{d.preventDefault(),i(!0);try{const{error:u}=await H.from("advertisements").update({title:o.title,description:o.description||null,target_url:o.target_url||null,banner_image_url:o.banner_image_url||null,logo_url:o.logo_url||null,business_name:o.business_name,business_email:o.business_email,business_phone:o.business_phone||null,business_website:o.business_website||null,updated_at:new Date().toISOString()}).eq("id",e.id);if(u)throw u;be({title:"Ad Updated",description:"Your advertisement has been updated successfully."}),s()}catch(u){console.error("Error updating advertisement:",u),be({title:"Update Failed",description:u.message||"Failed to update advertisement",variant:"destructive"})}finally{i(!1)}};return r.jsx(Rt,{open:t,onOpenChange:n,children:r.jsxs(Ot,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Edit Advertisement"}),r.jsx(on,{children:"Update your advertisement details. Changes will take effect immediately."})]}),r.jsxs("div",{className:"bg-muted p-3 rounded-md space-y-2 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx(te,{variant:"outline",children:e.status}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(At,{className:"h-4 w-4"}),r.jsx("span",{children:e.placement_location.replace(/-/g," ")})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Xt,{className:"h-4 w-4"}),r.jsxs("span",{children:[wr(new Date(e.start_date),"MMM d, yyyy")," - ",wr(new Date(e.end_date),"MMM d, yyyy")]})]})]}),r.jsxs("form",{onSubmit:c,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"title",children:"Ad Title *"}),r.jsx(ge,{id:"title",value:o.title,onChange:d=>l({...o,title:d.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"description",children:"Description"}),r.jsx(ir,{id:"description",value:o.description,onChange:d=>l({...o,description:d.target.value}),rows:3,placeholder:"Brief description of your ad..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"target_url",children:"Target URL (where clicks go)"}),r.jsx(ge,{id:"target_url",type:"url",value:o.target_url,onChange:d=>l({...o,target_url:d.target.value}),placeholder:"https://your-website.com"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Banner Image"}),r.jsx(Wd,{images:o.banner_image_url?[o.banner_image_url]:[],onImagesChange:d=>l({...o,banner_image_url:d[0]||""}),maxImages:1,bucket:"advertisements"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Logo (optional)"}),r.jsx(Wd,{images:o.logo_url?[o.logo_url]:[],onImagesChange:d=>l({...o,logo_url:d[0]||""}),maxImages:1,bucket:"advertisements"})]}),r.jsxs("div",{className:"border-t pt-4 space-y-4",children:[r.jsx("h4",{className:"font-medium",children:"Business Information"}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"business_name",children:"Business Name *"}),r.jsx(ge,{id:"business_name",value:o.business_name,onChange:d=>l({...o,business_name:d.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"business_email",children:"Business Email *"}),r.jsx(ge,{id:"business_email",type:"email",value:o.business_email,onChange:d=>l({...o,business_email:d.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"business_phone",children:"Business Phone"}),r.jsx(ge,{id:"business_phone",value:o.business_phone,onChange:d=>l({...o,business_phone:d.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"business_website",children:"Business Website"}),r.jsx(ge,{id:"business_website",type:"url",value:o.business_website,onChange:d=>l({...o,business_website:d.target.value}),placeholder:"https://your-business.com"})]})]})]}),r.jsxs(Yh,{children:[r.jsx(W,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(W,{type:"submit",disabled:a,children:a?"Saving...":"Save Changes"})]})]})]})})}function tSe(){const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(!0),[i,o]=j.useState(null),l=async()=>
919{if(e)try{const{data:u,error:h}=await H.from("advertisements").select("*").eq("user_id",e.id).order("created_at",{ascending:!1});if(h)throw h;n(u||[])}catch(u){console.error("Error fetching advertisements:",u),be({title:"Error",description:"Failed to load your advertisements",variant:"destructive"})}finally{a(!1)}};j.useEffect(()=>{l()},[e]);const c=u=>{if(e8(new Date(u.end_date)))return r.jsx(te,{variant:"secondary",children:"Expired"});switch(u.status){case"active":return r.jsx(te,{className:"bg-green-500/10 text-green-600 border-green-500/20",children:"Active"});case"pending":return r.jsx(te,{variant:"outline",children:"Pending Payment"});case"pending_review":return r.jsx(te,{className:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20",children:"Under Review"});case"rejected":return r.jsx(te,{variant:"destructive",children:"Rejected"});default:return r.jsx(te,{variant:"outline",children:u.status})}},d=(u,h)=>!u||u===0?"0.00":((h||0)/u*100).toFixed(2);return s?r.jsx("div",{className:"space-y-4",children:[1,2].map(u=>r.jsx(jn,{className:"h-32 w-full"},u))}):t.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(vn,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Advertisements Yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"You haven't created any advertisements. Visit our advertising page to get started."}),r.jsx(W,{variant:"outline",asChild:!0,children:r.jsx("a",{href:"/advertise",children:"Create an Ad"})})]}):r.jsxs("div",{className:"space-y-4",children:[t.map(u=>{const h=e8(new Date(u.end_date)),f=u.status==="active"&&!h;return r.jsx(Y,{className:h?"opacity-60":"",children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[u.banner_image_url&&r.jsx("div",{className:"w-full md:w-48 h-24 flex-shrink-0",children:r.jsx("img",{src:u.banner_image_url,alt:u.title,className:"w-full h-full object-cover rounded-md"})}),r.jsxs("div",{className:"flex-grow space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg",children:u.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:u.placement_location.replace(/-/g," ").replace(/\b\w/g,m=>m.toUpperCase())})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[c(u),r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>o(u),children:[r.jsx(so,{className:"h-4 w-4 mr-1"}),"Edit"]})]})]}),f&&r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Cr,{className:"h-4 w-4"}),r.jsxs("span",{children:[u.impression_count||0," impressions"]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Yie,{className:"h-4 w-4"}),r.jsxs("span",{children:[u.click_count||0," clicks"]})]}),r.jsx("div",{className:"flex items-center gap-1 text-muted-foreground",children:r.jsxs("span",{className:"font-medium",children:[d(u.impression_count,u.click_count),"% CTR"]})})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Xt,{className:"h-4 w-4"}),r.jsxs("span",{children:[wr(new Date(u.start_date),"MMM d")," - ",wr(new Date(u.end_date),"MMM d, yyyy")]})]}),f&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx($r,{className:"h-4 w-4"}),r.jsxs("span",{children:["Expires ",Im(new Date(u.end_date),{addSuffix:!0})]})]}),u.target_url&&r.jsxs("a",{href:u.target_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(ds,{className:"h-4 w-4"}),r.jsx("span",{children:"Target URL"})]})]})]})]})})},u.id)}),i&&r.jsx(eSe,{advertisement:i,open:!!i,onOpenChange:u=>!u&&o(null),onSuccess:()=>{o(null),l()}})]})}const rSe=()=>{const{user:e}=bt(),[t,n]=j.useState({products:0,events:0,properties:0,restaurants:0,rentalCars:0,classifieds:0,content:0,artisans:0,advertisements:0}),[s,a]=j.useState(!0);j.useEffect(()=>{(async()=>
919{if(!e){a(!1);return}try{const{data:c}=await H.from("products").select("id").eq("vendor_id",e.id),{data:d}=await H.from("events").select("id").eq("organizer_id",e.id),{data:u}=await H.from("properties").select("id").eq("host_id",e.id),{data:h}=await H.from("restaurants").select("id").eq("owner_id",e.id),{data:f}=await H.from("rental_cars").select("id").eq("owner_id",e.id),{data:m}=await H.from("classifieds").select("id").eq("user_id",e.id),{data:x}=await H.from("content").select("id").eq("creator_id",e.id),{data:p}=await H.from("artisans").select("id").eq("user_id",e.id),{data:v}=await H.from("advertisements").select("id").eq("user_id",e.id);n({products:(c==null?void 0:c.length)??0,events:(d==null?void 0:d.length)??0,properties:(u==null?void 0:u.length)??0,restaurants:(h==null?void 0:h.length)??0,rentalCars:(f==null?void 0:f.length)??0,classifieds:(m==null?void 0:m.length)??0,content:(x==null?void 0:x.length)??0,artisans:(p==null?void 0:p.length)??0,advertisements:(v==null?void 0:v.length)??0})}catch(c){console.error("Error fetching listing counts:",c)}finally{a(!1)}})()},[e]);const i=Object.values(t).some(l=>l>0),o=["profile"];return t.products>0&&o.push("products"),t.properties>0&&o.push("properties"),t.rentalCars>0&&o.push("rental-cars"),t.classifieds>0&&o.push("classifieds"),t.content>0&&o.push("content"),t.restaurants>0&&o.push("restaurants"),t.events>0&&o.push("events"),t.artisans>0&&o.push("artisans"),t.advertisements>0&&o.push("ads"),o.push("airtime","subscription","featured","payments"),i&&o.push("analytics"),{visibleTabs:o,listingCounts:t,loading:s,hasAnyListings:i}};function nSe(){const{user:e}=bt(),t=zn(),{visibleTabs:n,listingCounts:s,loading:a,hasAnyListings:i}=rSe(),[o,l]=j.useState(null),[c,d]=j.useState(!0),[u,h]=j.useState(!1),[f,m]=j.useState({full_name:"",username:"",bio:""}),[x,p]=j.useState(!1);j.useEffect(()=>{e&&w()},[e]);const v=Ri(),[g]=JT(),[y,b]=j.useState("profile");j.useEffect(()=>{var E;(E=v.state)!=null&&E.activeTab?(b(v.state.activeTab),window.history.replaceState({},document.title)):g.get("tab")&&b(g.get("tab")||"profile")},[v.state,g]),j.useEffect(()=>{g.get("payment")==="success"&&(be({title:"Payment Processing",description:"Your payment is being verified. This may take a few moments."}),window.history.replaceState({},"","/dashboard?tab=subscription"),b("subscription"))},[g]);const w=async()=>{if(e)try{const{data:E,error:N}=await H.from("profiles").select("*").eq("id",e.id).maybeSingle();if(N)throw N;l(E),m({full_name:E.full_name||"",username:E.username||"",bio:E.bio||""})}catch(E){console.error("Error fetching profile:",E)}finally{d(!1)}},_=async E=>{if(E.preventDefault(),!!e){h(!0);try{const{error:N}=await H.from("profiles").update(f).eq("id",e.id);if(N)throw N;be({title:"Profile updated",description:"Your profile has been successfully updated."}),w()}catch(N){be({title:"Update failed",description:N.message,variant:"destructive"})}finally{h(!1)}}};if(c||a)return r.jsx("div",{className:"container mx-auto p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-primary"})})});if(!o)return r.jsx("div",{className:"container mx-auto p-6",children:r.jsx(Y,{children:r.jsx(X,{className:"p-6",children:r.jsx("p",{children:"Profile not found. Please try refreshing the page."})})})});const C=E=>{switch(E){case"vendor":return r.jsx(Qc,{className:"h-4 w-4"});case"event_organizer":return r.jsx(Xt,{className:"h-4 w-4"});case"property_owner":return r.jsx(en,{className:"h-4 w-4"});case"creator":return r.jsx(Jn,{className:"h-4 w-4"});default:return r.jsx(TT,{className:"h-4 w-4"})}};return r.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:"Dashboard"}),r.jsxs("p",{className:"text-muted-foreground",children:["Welcome back, ",o.full_name||o.username||"User"]})]}),r.jsxs(te,{variant:"secondary",className:"flex items-center gap-2",children:[C(o.role),o.role.replace("_"," ").replace(/\b\w/g,E=>E.toUpperCase())]})]}),r.jsxs(Kr,{value:y,onValueChange:b,className:"space-y-4",children:[r.jsxs(Hr,{className:"flex flex-wrap h-auto",children:[n.includes("profile")&&r.jsx(Re,{value:"profile",children:"Profile"}),n.includes("products")&&r.jsxs(Re,{value:"products",children:["Products (",s.products,")"]}),n.includes("properties")&&r.jsxs(Re,{value:"properties",children:["Properties (",s.properties,")"]}),n.includes("rental-cars")&&r.jsxs(Re,{value:"rental-cars",children:["Rental Cars (",s.rentalCars,")"]}),n.includes("restaurants")&&r.jsxs(Re,{value:"restaurants",children:["Restaurants (",s.restaurants,")"]}),n.includes("classifieds")&&r.jsxs(Re,{value:"classifieds",children:["Classifieds (",s.classifieds,")"]}),n.includes("content")&&r.jsxs(Re,{value:"content",children:["My Content (",s.content,")"]}),n.includes("events")&&r.jsxs(Re,{value:"events",children:["My Events (",s.events,")"]}),n.includes("artisans")&&r.jsxs(Re,{value:"artisans",children:["My Artisans (",s.artisans,")"]}),n.includes("ads")&&r.jsxs(Re,{value:"ads",children:["My Ads (",s.advertisements,")"]}),n.includes("airtime")&&r.jsx(Re,{value:"airtime",children:"Airtime"}),n.includes("subscription")&&r.jsx(Re,{value:"subscription",children:"Subscription"}),n.includes("featured")&&r.jsx(Re,{value:"featured",children:"Featured"}),n.includes("payments")&&r.jsx(Re,{value:"payments",children:"Payments"}),n.includes("analytics")&&r.jsx(Re,{value:"analytics",children:"Analytics"})]}),!i&&r.jsx(Y,{className:"border-dashed",children:r.jsxs(X,{className:"flex flex-col items-center justify-center p-8 text-center",children:[r.jsx(Jn,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Start Creating!"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"You don't have any listings yet. Create your first listing to start showcasing your offerings."}),r.jsxs(W,{onClick:()=>t("/create"),children:[r.jsx(xs,{className:"mr-2 h-4 w-4"}),"Create Your First Listing"]})]})}),r.jsxs(Be,{value:"profile",children:[r.jsx(TNe,{}),r.jsxs(Y,{className:"mt-6",children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Basic Information"}),r.jsx(Nt,{children:"Update your basic account information"})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:_,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"full_name",children:"Full Name"}),r.jsx(ge,{id:"full_name",value:f.full_name,onChange:E=>m({...f,full_name:E.target.value}),placeholder:"Enter your full name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"username",children:"Username"}),r.jsx(ge,{id:"username",value:f.username,onChange:E=>m({...f,username:E.target.value}),placeholder:"Enter your username"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"bio",children:"Bio"}),r.jsx(ir,{id:"bio",value:f.bio,onChange:E=>m({...f,bio:E.target.value}),placeholder:"Tell us about yourself...",rows:3})]}),r.jsx(W,{type:"submit",disabled:u,children:u?"Updating...":"Update Profile"})]})})]})]}),r.jsx(Be,{value:"products",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"My Products"}),r.jsx(Nt,{children:"Manage your marketplace listings"})]}),r.jsx(X,{children:r.jsx(ENe,{})})]})}),r.jsx(Be,{value:"properties",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"My Properties"}),r.jsx(Nt,{children:"Manage your lodging listings and track performance"})]}),r.jsx(X,{children:r.jsx(b2e,{})})]})}),r.jsx(Be,{value:"rental-cars",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(xa,{
919className:"h-5 w-5"}),"My Rental Cars & Equipment"]}),r.jsx(Nt,{children:"Manage your vehicle and equipment rental listings"})]}),r.jsx(X,{children:r.jsx(L2e,{})})]})}),r.jsx(Be,{value:"classifieds",children:r.jsx(ONe,{})}),r.jsx(Be,{value:"content",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"My Content"}),r.jsx(Nt,{children:"Manage your creative content and track performance"})]}),r.jsx(X,{children:r.jsx(LNe,{})})]})}),r.jsx(Be,{value:"restaurants",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"My Restaurants"}),r.jsx(Nt,{children:"Manage your restaurant listings"})]}),r.jsx(X,{children:r.jsx(k2e,{})})]})}),r.jsx(Be,{value:"events",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"My Events"}),r.jsx(Nt,{children:"Manage your event listings"})]}),r.jsx(X,{children:r.jsx(w2e,{})})]})}),r.jsx(Be,{value:"artisans",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(fr,{className:"h-5 w-5"}),"My Artisan Services"]}),r.jsx(Nt,{children:"Manage your service provider listings"})]}),r.jsx(X,{children:r.jsx(Z2e,{})})]})}),r.jsx(Be,{value:"ads",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Wie,{className:"h-5 w-5"}),"My Advertisements"]}),r.jsx(Nt,{children:"Manage your site advertisements and track performance"})]}),r.jsx(X,{children:r.jsx(tSe,{})})]})}),r.jsx(Be,{value:"airtime",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-5 w-5"}),"Quick Airtime Recharge"]}),r.jsx(Nt,{children:"Buy airtime for yourself or send as a gift. Instant delivery."})]}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs(W,{onClick:()=>p(!0),className:"w-full sm:w-auto",children:[r.jsx(an,{className:"mr-2 h-4 w-4"}),"Buy Airtime"]}),r.jsx("div",{className:"text-sm text-muted-foreground bg-muted p-3 rounded-md",children:r.jsxs("p",{className:"flex items-center gap-2",children:[r.jsx(ms,{className:"h-4 w-4"}),r.jsx("strong",{children:"Auto-delivery:"})," Airtime is delivered automatically after payment confirmation"]})})]})]}),r.jsx(jNe,{})]})}),r.jsx(Be,{value:"subscription",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(NNe,{}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Qc,{className:"h-5 w-5 text-primary"}),"Verified by Naija.com Badge"]}),r.jsx(Nt,{children:"Get verified to build trust with customers. â¦150,000/year - includes CAC verification."})]}),r.jsxs(X,{className:"space-y-4",children:[r.jsx(Q2e,{}),r.jsx(J2e,{})]})]})]})}),r.jsx(Be,{value:"featured",children:r.jsx(_Ne,{})}),r.jsx(Be,{value:"payments",children:r.jsx(SNe,{})}),r.jsx(Be,{value:"analytics",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Qd,{className:"h-5 w-5"}),"Analytics Overview"]}),r.jsx(Nt,{children:"Track your performance and engagement metrics."})]}),r.jsx(X,{children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:"0"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Views"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:"0"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Sales"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:"0"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Earnings"})]})})]})})]})})]}),r.jsx(KY,{open:x,onOpenChange:p})]})}const sSe={content:"content",event:"events",product:"products",property:"properties"},Ak={content:e=>"/news",event:e=>"/events",product:e=>"/buy-sell",property:e=>"/lodging"},u8=["thumbnail_url","image_url","cover_image","featured_image","images","photos"],h8=["description","body","content","summary","details"],aSe=new Set(["id","user_id","creator_id","owner_id","created_at","updated_at","search_vector","moderation_status","moderation_notes","moderated_at","moderated_by","rejection_reason","status","embed_url"]),iSe=({item:e,onClose:t})=>{var x;const[n,s]=j.useState(!1),[a,i]=j.useState(null),[o,l]=j.useState(null),[c,d]=j.useState(null);j.useEffect(()=>{if(!e)return;i(null),l(null),d(null),s(!0);const p=sSe[e.item_type];if(!p){d(`Unknown item type: ${e.item_type}`),s(!1);return}(async()=>{const{data:v,error:g}=await H.from(p).select("*").eq("id",e.id).maybeSingle();if(g&&d(g.message),i(v),e.user_id){const{data:y}=await H.from("profiles").select("full_name, email").eq("id",e.user_id).maybeSingle();l(y)}s(!1)})()},[e==null?void 0:e.id,e==null?void 0:e.item_type]);const u=(()=>
919{if(!a)return null;for(const p of u8){const v=a[p];if(v){if(Array.isArray(v))return v[0]??null;if(typeof v=="string")return v}}return null})(),h=(()=>{if(!a)return null;for(const p of h8)if(typeof a[p]=="string"&&a[p].trim())return a[p];return null})(),f=a?Object.entries(a).filter(([p,v])=>!aSe.has(p)&&!u8.includes(p)&&!h8.includes(p)&&p!=="title"&&p!=="name"&&v!==null&&v!==""&&!(Array.isArray(v)&&v.length===0)&&typeof v!="object"):[],m=e?(x=Ak[e.item_type])==null?void 0:x.call(Ak,e.id):null;return r.jsx(Rt,{open:!!e,onOpenChange:p=>!p&&t(),children:r.jsxs(Ot,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{variant:"secondary",children:e==null?void 0:e.item_type}),r.jsx(Dt,{className:"text-xl",children:e==null?void 0:e.title})]}),o&&r.jsxs(on,{children:["Submitted by ",o.full_name||o.email||"Unknown user"]})]}),n&&r.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[r.jsx(yt,{className:"h-6 w-6 animate-spin mr-2"})," Loading previewâ¦"]}),c&&r.jsxs("div",{className:"text-sm text-destructive py-4",children:["Failed to load preview: ",c]}),a&&!n&&r.jsxs("div",{className:"space-y-4",children:[u&&r.jsx("img",{src:u,alt:e==null?void 0:e.title,className:"w-full max-h-72 object-cover rounded-md border"}),h&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold mb-1",children:"Description"}),r.jsx("p",{className:"text-sm whitespace-pre-wrap text-muted-foreground",children:h})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold mb-2",children:"Details"}),r.jsx("dl",{className:"grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1 text-sm",children:f.map(([p,v])=>r.jsxs(ee.Fragment,{children:[r.jsx("dt",{className:"text-muted-foreground capitalize",children:p.replace(/_/g," ")}),r.jsx("dd",{className:"break-words",children:String(v)})]},p))})]}),m&&r.jsx(W,{asChild:!0,variant:"outline",size:"sm",children:r.jsxs("a",{href:m,target:"_blank",rel:"noreferrer",children:["Open public page ",r.jsx(ds,{className:"h-3 w-3 ml-1"})]})})]})]})})},oSe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState({}),[o,l]=j.useState(null),[c,d]=j.useState(null),{user:u}=bt(),{toast:h}=Sn();j.useEffect(()=>{f()},[]);const f=async()=>{try{const{data:p,error:v}=await H.from("moderation_queue").select("*").order("created_at",{ascending:!1});if(v)throw v;t(p||[])}catch{h({title:"Error",description:"Failed to fetch moderation queue",variant:"destructive"})}finally{s(!1)}},m=async(p,v)=>{var g;d(p.id);try{const y=p.item_type==="content"?"content":p.item_type==="event"?"events":p.item_type==="product"?"products":"properties",{error:b}=await H.from(y).update({moderation_status:v,moderation_notes:a[p.id]||null,moderated_by:u==null?void 0:u.id,moderated_at:new Date().toISOString(),...v==="approved"&&{status:p.item_type==="content"||p.item_type==="event"?"published":(p.item_type==="product","active")}}).eq("id",p.id);if(b)throw b;const w=p.item_type==="content"?"/news":p.item_type==="event"?"/events":p.item_type==="product"?"/buy-sell":"/lodging",_=v==="approved"?w:"/dashboard",C=v==="approved"?`Your ${p.item_type} is live: ${p.title}`:`Your ${p.item_type} wasn't approved: ${p.title}`,E=(g=a[p.id])==null?void 0:g.trim(),N=v==="approved"?`Good news! Your ${p.item_type} "${p.title}" has been approved and is now visible on Naija.com.${E?` 920 921Reviewer notes: ${E}`:""}`:`Your ${p.item_type} "${p.title}" wasn't approved this time.${E?` 922 923Reason: ${E}`:""} 924 925You can edit and resubmit it from your dashboard.`;try{await H.functions.invoke("send-email-notifications",{body:{user_id:p.user_id,type:"moderation_decision",subject:C,message:N,data:{item_type:p.item_type,item_id:p.id,status:v,notes:E,url:_}}})}catch(k){console.warn("Notification email failed (non-fatal):",k)}await H.from("moderation_queue").delete().eq("id",p.id),h({title:"Success",description:`${p.item_type} ${v} successfully and ${v==="approved"?"published":"removed from queue"}`}),t(k=>k.filter(I=>!(I.id===p.id&&I.item_type===p.item_type)))}catch(y){console.error("Moderation error:",y),h({title:"Error",description:`Failed to moderate ${p.item_type}: ${y.message}`,variant:"destructive"})}finally{d(null)}},x=p=>{switch(p){case"content":return"bg-blue-500";case"event":return"bg-green-500";case"product":return"bg-yellow-500";case"property":return"bg-purple-500";default:return"bg-gray-500"}};return n?r.jsx("div",{className:"space-y-4",children:[1,2,3].map(p=>r.jsx(Y,{className:"animate-pulse",children:r.jsxs(X,{className:"p-4",children:[r.jsx("div",{className:"h-4 bg-muted rounded w-3/4 mb-2"}),r.jsx("div",{className:"h-3 bg-muted rounded w-1/2"})]})},p))}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Moderation Queue"}),r.jsxs(te,{variant:"outline",className:"text-sm",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),e.length," pending"]})]}),e.length===0?r.jsx(Y,{children:r.jsxs(X,{className:"p-8 text-center",children:[r.jsx(ro,{className:"h-12 w-12 mx-auto text-primary mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"All caught up!"}),r.jsx("p",{className:"text-muted-foreground",children:"No items pending moderation."})]})}):e.map(p=>r.jsxs(Y,{className:"border-l-4 border-l-primary",children:[r.jsx(Se,{className:"pb-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{className:x(p.item_type),children:p.item_type}),r.jsx("span",{className:"text-sm text-muted-foreground",children:new Date(p.created_at).toLocaleDateString()})]}),r.jsx(Ae,{className:"text-lg",children:p.title})]}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>l(p),children:[r.jsx(Cr,{className:"h-4 w-4 mr-1"}),"Preview"]})]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Moderation Notes"}),r.jsx(ir,{placeholder:"Add notes for the user (optional)",value:a[p.id]||"",onChange:v=>i(g=>({...g,[p.id]:v.target.value})),rows:2})]}),r.jsxs("div",{className:"flex gap-2 pt-2",children:[r.jsxs(W,{size:"sm",className:"bg-green-600 hover:bg-green-700",disabled:c===p.id,onClick:()=>m(p,"approved"),children:[r.jsx(ro,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(W,{size:"sm",variant:"destructive",disabled:c===p.id,onClick:()=>m(p,"rejected"),children:[r.jsx(ks,{className:"h-4 w-4 mr-1"}),"Reject"]})]})]})]},`${p.item_type}-${p.id}`)),r.jsx(iSe,{item:o,onClose:()=>l(null)})]})},lSe=()=>{const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(!0),[i,o]=j.useState("pending");j.useEffect(()=>{l()},[i]);const l=async()=>{a(!0);try{const f=[{name:"events",type:"event"},{name:"content",type:"content"},{name:"properties",type:"property"},{name:"restaurants",type:"restaurant"},{name:"service_providers",type:"service_provider"},{name:"tour_packages",type:"tour_package"},{name:"products",type:"product"}],m=[];for(const x of f){let p=H.from(x.name).select("id, title, moderation_status, created_at, owner_id, creator_id, vendor_id, user_id, operator_id").order("created_at",{ascending:!1});i!=="all"&&(p=p.eq("moderation_status",i));const{data:v,error:g}=await p;if(!g&&v){const y=v.map(_=>_.owner_id||_.creator_id||_.vendor_id||_.user_id||_.operator_id).filter(
925Boolean),{data:b}=await H.from("profiles").select("id, full_name").in("id",y),w=new Map((b==null?void 0:b.map(_=>[_.id,_.full_name]))||[]);v.forEach(_=>{const C=_.owner_id||_.creator_id||_.vendor_id||_.user_id||_.operator_id;m.push({id:_.id,title:_.title||_.name||"Untitled",type:x.type,status:_.moderation_status,created_at:_.created_at,submitter_name:C?w.get(C):void 0})})}}m.sort((x,p)=>new Date(p.created_at).getTime()-new Date(x.created_at).getTime()),n(m)}catch{be({title:"Error",description:"Failed to fetch moderation queue",variant:"destructive"})}finally{a(!1)}},c=async(f,m,x)=>{try{const p=m==="service_provider"?"service_providers":m==="tour_package"?"tour_packages":`${m}s`,{error:v}=await H.from(p).update({moderation_status:x,moderated_by:e==null?void 0:e.id,moderated_at:new Date().toISOString()}).eq("id",f);if(v)throw v;be({title:"Success",description:`Item ${x==="approved"?"approved":"rejected"} successfully`}),l()}catch(p){be({title:"Error",description:p.message||"Failed to moderate item",variant:"destructive"})}},d=f=>({event:"bg-purple-500",content:"bg-blue-500",property:"bg-green-500",restaurant:"bg-orange-500",service_provider:"bg-yellow-500",tour_package:"bg-pink-500",product:"bg-red-500"})[f]||"bg-gray-500",u=f=>{switch(f){case"approved":return r.jsxs(te,{className:"bg-green-500",children:[r.jsx(er,{className:"h-3 w-3 mr-1"}),"Approved"]});case"rejected":return r.jsxs(te,{className:"bg-red-500",children:[r.jsx(ya,{className:"h-3 w-3 mr-1"}),"Rejected"]});default:return r.jsxs(te,{variant:"secondary",children:[r.jsx($r,{className:"h-3 w-3 mr-1"}),"Pending"]})}},h=f=>new Date(f).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"});return r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ae,{children:"Moderation Queue"}),r.jsxs(mt,{value:i,onValueChange:f=>o(f),children:[r.jsx(ut,{className:"w-48",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Items"}),r.jsx(Ne,{value:"pending",children:"Pending"}),r.jsx(Ne,{value:"approved",children:"Approved"}),r.jsx(Ne,{value:"rejected",children:"Rejected"})]})]})]})}),r.jsx(X,{children:s?r.jsx("div",{className:"space-y-4",children:[1,2,3].map(f=>r.jsx("div",{className:"h-20 bg-muted rounded animate-pulse"},f))}):t.length===0?r.jsx("div",{className:"text-center py-8",children:r.jsx("p",{className:"text-muted-foreground",children:"No items in moderation queue"})}):r.jsx("div",{className:"space-y-4",children:t.map(f=>r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{className:d(f.type),children:f.type.replace("_"," ")}),u(f.status)]}),r.jsx("h3",{className:"font-semibold",children:f.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Submitted by ",f.submitter_name||"Unknown"," on ",h(f.created_at)]})]}),f.status==="pending"&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>c(f.id,f.type,"approved"),children:[r.jsx(er,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(W,{size:"sm",variant:"destructive",onClick:()=>c(f.id,f.type,"rejected"),children:[r.jsx(ya,{className:"h-4 w-4 mr-1"}),"Reject"]})]})]})})},`${f.type}-${f.id}`))})})]})},cSe=()=>{const{toast:e}=Sn(),[t,n]=j.useState([]),[s,a]=j.useState(!0),[i,o]=j.useState(""),[l,c]=j.useState("all"),[d,u]=j.useState(null),[h,f]=j.useState(!1);j.useEffect(()=>{m()},[]);const m=async()=>{try{const{data:w,error:_}=await H.from("advertisements").select("*").order("created_at",{ascending:!1});if(_)throw _;n(w||[])}catch(w){console.error("Error fetching advertisements:",w),e({title:"Error",description:"Failed to fetch advertisements",variant:"destructive"})}finally{a(!1)}},x=async(w,_,C)=>{try{const E={status:_,updated_at:new Date().toISOString()};C&&(E.notes=C),_==="approved"&&(E.status="active");const{error:N}=await H.from("advertisements").update(E).eq("id",w);if(N)throw N;
925e({title:"Advertisement Updated",description:`Advertisement ${_} successfully`}),m()}catch(E){console.error("Error updating advertisement:",E),e({title:"Update Failed",description:"Failed to update advertisement",variant:"destructive"})}},p=async w=>{if(confirm("Are you sure you want to delete this advertisement?"))try{const{error:_}=await H.from("advertisements").delete().eq("id",w);if(_)throw _;e({title:"Advertisement Deleted",description:"Advertisement deleted successfully"}),m()}catch(_){console.error("Error deleting advertisement:",_),e({title:"Delete Failed",description:"Failed to delete advertisement",variant:"destructive"})}},v=w=>{const _={pending:"secondary",pending_review:"outline",approved:"default",active:"default",expired:"outline",rejected:"destructive"},C={pending:"Pending",pending_review:"Paid - Review",approved:"Approved",active:"Active",expired:"Expired",rejected:"Rejected"};return r.jsx(te,{variant:_[w]||"secondary",children:C[w]||w})},g=w=>{const _={pending:"secondary",paid:"default",overdue:"destructive"};return r.jsx(te,{variant:_[w]||"secondary",children:w})},y=t.filter(w=>{const _=w.business_name.toLowerCase().includes(i.toLowerCase())||w.title.toLowerCase().includes(i.toLowerCase()),C=l==="all"||w.status===l;return _&&C}),b={total:t.length,pending:t.filter(w=>w.status==="pending"||w.status==="pending_review").length,active:t.filter(w=>w.status==="active").length,revenue:t.filter(w=>w.status==="active"||w.status==="approved").reduce((w,_)=>w+_.monthly_cost,0)};return s?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((w,_)=>r.jsx("div",{className:"h-16 bg-muted animate-pulse rounded-lg"},_))}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Total Ads"}),r.jsx("p",{className:"text-2xl font-bold",children:b.total})]}),r.jsx(Qd,{className:"h-8 w-8 text-muted-foreground"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Pending"}),r.jsx("p",{className:"text-2xl font-bold",children:b.pending})]}),r.jsx(Xt,{className:"h-8 w-8 text-muted-foreground"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Active"}),r.jsx("p",{className:"text-2xl font-bold",children:b.active})]}),r.jsx(lr,{className:"h-8 w-8 text-muted-foreground"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Revenue"}),r.jsxs("p",{className:"text-2xl font-bold",children:["â¦",b.revenue.toLocaleString()]})]}),r.jsx(Tn,{className:"h-8 w-8 text-muted-foreground"})]})})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Advertisement Management"}),r.jsx(Nt,{children:"Manage advertisement requests and track campaign performance"})]}),r.jsxs(X,{children:[r.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[r.jsx("div",{className:"flex-1",children:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search by business name or title...",value:i,onChange:w=>o(w.target.value),className:"pl-9"})]})}),r.jsxs(mt,{value:l,onValueChange:c,children:[r.jsx(ut,{className:"w-full md:w-48",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Status"}),r.jsx(Ne,{value:"pending",children:"Pending"}),r.jsx(Ne,{value:"pending_review",children:"Paid - Review"}),r.jsx(Ne,{value:"approved",children:"Approved"}),r.jsx(Ne,{value:"active",children:"Active"}),r.jsx(Ne,{value:"expired",children:"Expired"}),r.jsx(Ne,{value:"rejected",children:"Rejected"})]})]})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Business"}),r.jsx(jt,{children:"Type"}),r.jsx(jt,{children:"Plan"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{children:"Payment"}),r.jsx(jt,{children:"Performance"}),r.jsx(jt,{children:"Actions"})]})}),r.jsx(Oi,{children:y.map(w=>r.jsxs(On,{children:[r.jsx(wt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:w.business_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:w.business_email})]})}),r.jsx(wt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"capitalize",children:w.advertisement_type.replace("_"," ")}),r.jsx("p",{className:"text-sm text-muted-foreground",children:w.placement_location})]})}),r.jsx(wt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"capitalize",children:w.pricing_plan}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["â¦",w.monthly_cost.toLocaleStr
925ing()]})]})}),r.jsx(wt,{children:v(w.status)}),r.jsx(wt,{children:g(w.payment_status)}),r.jsx(wt,{children:r.jsxs("div",{className:"text-sm",children:[r.jsxs("p",{children:[w.click_count," clicks"]}),r.jsxs("p",{className:"text-muted-foreground",children:[w.impression_count," views"]})]})}),r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(W,{variant:"outline",size:"sm",onClick:()=>{u(w),f(!0)},children:r.jsx(Cr,{className:"h-4 w-4"})}),(w.status==="pending"||w.status==="pending_review")&&r.jsxs(r.Fragment,{children:[r.jsx(W,{variant:"outline",size:"sm",onClick:()=>x(w.id,"approved"),title:"Approve",children:r.jsx(ro,{className:"h-4 w-4"})}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>x(w.id,"rejected","Rejected by admin"),title:"Reject",children:r.jsx(ks,{className:"h-4 w-4"})})]}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>p(w.id),children:r.jsx(ao,{className:"h-4 w-4"})})]})})]},w.id))})]})}),y.length===0&&r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No advertisements found"})]})]}),r.jsx(Rt,{open:h,onOpenChange:f,children:r.jsxs(Ot,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Advertisement Details"})}),d&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Business Information"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Business:"})," ",d.business_name]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Contact:"})," ",d.contact_person]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Email:"})," ",d.business_email]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Phone:"})," ",d.business_phone]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Website:"})," ",d.business_website]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Address:"})," ",d.business_address]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Campaign Details"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Title:"})," ",d.title]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Type:"})," ",d.advertisement_type.replace("_"," ")]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Plan:"})," ",d.pricing_plan]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Location:"})," ",d.placement_location]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Cost:"})," â¦",d.monthly_cost.toLocaleString()]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Duration:"})," ",d.start_date," to ",d.end_date]})]})]})]}),d.description&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Description"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:d.description})]}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Status"}),r.jsxs("div",{className:"space-y-2",children:[v(d.status),g(d.payment_status)]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Performance"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("p",{children:["Clicks: ",d.click_count]}),r.jsxs("p",{children:["Impressions: ",d.impression_count]}),r.jsxs("p",{children:["CTR: ",d.impression_count>0?(d.click_count/d.impression_count*100).toFixed(2):0,"%"]})]})]})]}),d.notes&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold mb-2",children:"Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:d.notes})]}),r.jsxs("div",{className:"flex gap-2 pt-4 border-t",children:[(d.status==="pending"||d.status==="pending_review")&&r.jsxs(r.Fragment,{children:[r.jsx(W,{onClick:()=>{x(d.id,"approved"),f(!1)},children:"Approve"}),r.jsx(W,{variant:"destructive",onClick:()=>{x(d.id,"rejected","Rejected by admin"),f(!1)},children:"Reject"})]}),r.jsx(W,{variant:"outline",onClick:()=>f(!1),children:"Close"})]})]})]})})]})},vy={sold:{label:"Sold (direct)",variant:"default"},adsense:{label:"AdSense fill",variant:"secondary"},house:{label:"Unsold â house ad",variant:"outline"}},dSe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(!0);j.useEffect(()=>{(async()=>{try{const o=new Date().toISOString().split("T")[0],[{data:l},{data:c}]=await Promise.all([H.from("ad_placements").select("id, slug, name, size_label, is_active").order("slug"),H.from("advertisements").select("placement_id").eq("status","active").eq("payment_status","paid").lte("start_date",o).gte("end_date",o)]),d=new Set((c||[]).map(u=>u.placement_id));t((l||[]).map(u=>({...u,fill:d.has(u.id)?"sold":$O(u.slug,"/")?"adsense":"house"})))}catch(o){console.error("Error loading ad inventory status",o)}finally{s(!1)}})()},[]);const a=e.reduce((i,o)=>({...i,[o.fill]:(i[o.fill]||0)+1}),{});return r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Ad Inventory Fill"}),r.jsx(Nt,{children:"AdSense is enabled and fills every unsold slot below."})]}),r.jsx(X,{children:n?r.jsx("div",{className:"h-32 bg-muted/40 animate-pulse rounded-lg"}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:Object.keys(vy).map(i=>r.jsxs(te,{variant:vy[i].variant,children:[vy[i].label,": ",a[i]||0]},i))}),r.jsx("div",{className:"divide-y divide-border rounded-lg border border-border",children:e.map(i=>r.jsxs("div",{className:"flex items-center justify-between gap-3 p-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[i.slug," · ",i.size_label||"â",!i.is_active&&" · inactive"]})]}),r.jsx(te,{variant:vy[i.fill].variant,className:"flex-shrink-0",children:vy[i.fill].label})]},i.id))})]})})]})};function uSe(){const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState(null),[c,d]=j.useState(!1),[u,h]=j.useState(null),[f,m]=j.useState(null),[x,p]=j.useState(null),[v,g]=j.useState(!1),[y,b]=j.useState(!1),{toast:w}=Sn();j.useEffect(()=>{_()},[]);const _=async()=>{i(!0);try{const A=new Date(Date.now()-3e5).toISOString(),{data:R,error:L}=await H.from("airtime_transactions").select("*").eq("status","pen
925ding").lt("created_at",A).order("created_at",{ascending:!1});if(L)throw L;t(R||[]);const z=new Date(Date.now()-24*60*60*1e3).toISOString(),{data:U,error:$}=await H.from("airtime_transactions").select("*").eq("status","failed").gt("created_at",z).order("created_at",{ascending:!1});$||s(U||[])}catch(A){w({title:"Error",description:A.message,variant:"destructive"})}finally{i(!1)}},C=async A=>{p(A);try{const{data:R,error:L}=await H.functions.invoke("reconcile-payments",{body:{transaction_id:A,check_only:!0}});if(L)throw L;R.verified?w({title:"Payment Confirmed",description:'Payment was found in provider. Click "Deliver Airtime" to process.'}):w({title:"Payment Not Found",description:R.message||"Check provider dashboard manually, then Deliver or Mark Failed",variant:"destructive"})}catch(R){w({title:"Verification Error",description:R.message,variant:"destructive"})}finally{p(null)}},E=async A=>{m(A);try{const{error:R}=await H.from("airtime_transactions").update({status:"pending",error_message:null}).eq("id",A);if(R)throw R;w({title:"Transaction Restored",description:"Transaction moved back to pending for processing"}),_()}catch(R){w({title:"Error",description:R.message,variant:"destructive"})}finally{m(null)}},N=async()=>{if(e.length===0)return;g(!0);let A=0,R=0,L=0;try{for(const z of e)try{const{data:U,error:$}=await H.functions.invoke("reconcile-payments",{body:{transaction_id:z.id,check_only:!0}});$?L++:U.verified?A++:R++}catch{L++}w({title:"Verification Complete",description:`Confirmed: ${A}, Not found: ${R}, Errors: ${L}. Use buttons to process individually.`})}catch(z){w({title:"Error",description:z.message,variant:"destructive"})}finally{g(!1)}},k=async A=>{var R;l(A);try{const{data:L,error:z}=await H.functions.invoke("reconcile-airtime",{body:{transaction_ids:[A]}});if(z)throw z;const U=(R=L.results)==null?void 0:R[0];(U==null?void 0:U.status)==="success"?w({title:"Success",description:"Airtime delivered successfully"}):(U==null?void 0:U.status)==="failed"?w({title:"Delivery Failed",description:U.error||"Check Reloadly configuration",variant:"destructive"}):w({title:"Processed",description:(U==null?void 0:U.reason)||"Transaction processed"}),_()}catch(L){w({title:"Error",description:L.message,variant:"destructive"})}finally{l(null)}},I=async()=>{var A,R,L;if(e.length!==0){d(!0);try{const z=e.map(F=>F.id),{data:U,error:$}=await H.functions.invoke("reconcile-airtime",{body:{transaction_ids:z}});if($)throw $;const q=((A=U.results)==null?void 0:A.filter(F=>F.status==="success").length)||0,ne=((R=U.results)==null?void 0:R.filter(F=>F.status==="failed").length)||0,se=((L=U.results)==null?void 0:L.filter(F=>F.status==="skipped").length)||0;w({title:"Reconciliation Complete",description:`Processed: ${q} success, ${ne} failed, ${se} skipped`}),_()}catch(z){w({title:"Error",description:z.message,variant:"destructive"})}finally{d(!1)}}},P=async A=>{h(A);try{const{error:R}=await H.from("airtime_transactions").update({status:"failed",error_message:"Manually marked as failed - payment not completed"}).eq("id",A);if(R)throw R;w({title:"Marked as Failed",description:"Transaction has been marked as failed"}),_()}catch(R){w({title:"Error",description:R.message,variant:"destructive"})}finally{h(null)}},O=A=>o===A||u===A||x===A||f===A||c||v;return r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx(Ae,{children:"Airtime Reconciliation"}),r.jsx(Nt,{children:"Verify payment status and process pending airtime transactions"})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(W,{variant:"outline",size:"sm",onClick:_,disabled:a,children:[r.jsx(ms,{className:`h-4 w-4 mr-2 ${a?"animate-spin":""}`}),"Refresh"]}),e.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(W,{variant:"secondary",size:"sm",onClick:N,disabled:v||c||a,children:v?r.jsxs(r.Fragment,{children:[r.jsx(ms,{className:"h-4 w-4 mr-2 animate-spin"}),"Verifying..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 mr-2"}),"Verify All (",e.length,")"]})}),r.jsx(W,{size:"sm",onClick:I,disabled:c||v||a,children:c?r.jsxs(r.Fragment,{children:[r.jsx(ms,{className:"h-4 w-4 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Cie,{className:"h-4 w-4 mr-2"}),"Process All"]})})]})]})]})}),r.jsx(X,{children:a?r.jsx("div",{className:"text-center py-8",children:r.jsx(ms,{className:"h-8 w-8 animate-spin mx-auto text-muted-foreground"})}):e.length===0&&n.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(er,{className:"h-12 w-12 mx-auto mb-2 text-green-500"}
925),r.jsx("p",{children:"No pending transactions found"}),r.jsx("p",{className:"text-sm mt-1",children:"All airtime payments have been processed"})]}):r.jsxs("div",{className:"space-y-6",children:[e.length>0&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg text-sm",children:[r.jsx(Oo,{className:"h-4 w-4 text-amber-600 flex-shrink-0"}),r.jsxs("span",{className:"text-amber-800 dark:text-amber-200",children:[e.length,' pending transaction(s). Use "Verify Payment" to check status (non-destructive), then deliver or mark as failed.']})]}),e.map(A=>r.jsxs("div",{className:"flex flex-col p-4 border rounded-lg gap-3",children:[r.jsx("div",{className:"flex flex-col sm:flex-row sm:items-start justify-between gap-3",children:r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[r.jsx("span",{className:"font-semibold",children:A.network}),r.jsx(te,{variant:"outline",children:A.phone_number}),r.jsxs(te,{variant:"secondary",children:[A.currency," ",A.amount.toLocaleString()]}),A.payment_provider&&r.jsx(te,{variant:"outline",className:"text-xs capitalize",children:A.payment_provider})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Im(new Date(A.created_at))," ago"]}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 break-all",children:["Ref: ",A.payment_reference||"N/A"]}),A.error_message&&r.jsxs("div",{className:"text-xs text-destructive mt-1",children:["Error: ",A.error_message]}),A.retry_count>0&&r.jsxs("div",{className:"text-xs text-amber-600 mt-1",children:["Retries: ",A.retry_count]})]})}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(W,{variant:"secondary",onClick:()=>C(A.id),disabled:O(A.id),size:"sm",children:x===A.id?r.jsxs(r.Fragment,{children:[r.jsx(ms,{className:"h-4 w-4 mr-2 animate-spin"}),"Verifying..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Wr,{className:"h-4 w-4 mr-2"}),"Verify Payment"]})}),r.jsx(W,{onClick:()=>k(A.id),disabled:O(A.id),size:"sm",children:o===A.id?r.jsxs(r.Fragment,{children:[r.jsx(ms,{className:"h-4 w-4 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(er,{className:"h-4 w-4 mr-2"}),"Deliver Airtime"]})}),r.jsx(W,{variant:"outline",onClick:()=>P(A.id),disabled:O(A.id),size:"sm",className:"text-destructive hover:text-destructive",children:u===A.id?r.jsxs(r.Fragment,{children:[r.jsx(ms,{className:"h-4 w-4 mr-2 animate-spin"}),"Marking..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Mark Failed"]})})]})]},A.id))]}),n.length>0&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs(W,{variant:"ghost",size:"sm",onClick:()=>b(!y),className:"text-muted-foreground",children:[r.jsx(zR,{className:"h-4 w-4 mr-2"}),y?"Hide":"Show"," Recently Failed (",n.length,")"]})}),y&&r.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed transactions from the last 24 hours. Restore to pending if payment was actually successful."}),n.map(A=>r.jsxs("div",{className:"flex flex-col p-4 border border-destructive/30 rounded-lg gap-3 bg-destructive/5",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[r.jsx(te,{variant:"destructive",children:"Failed"}),r.jsx("span",{className:"font-semibold",children:A.network}),r.jsx(te,{variant:"outline",children:A.phone_number}),r.jsxs(te,{variant:"secondary",children:[A.currency," ",A.amount.toLocaleString()]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Im(new Date(A.created_at))," ago"]}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 break-all",children:["Ref: ",A.payment_reference||"N/A"]}),A.error_message&&r.jsxs("div",{className:"text-xs text-destructive mt-1",children:["Error: ",A.error_message]})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(W,{variant:"outline",onClick:()=>E(A.id),disabled:f===A.id,size:"sm",children:f===A.id?r.jsxs(r.Fragment,{children:[r.jsx(ms,{className:"h-4 w-4 mr-2 animate-spin"}),"Restoring..."]}):r.jsxs(r.Fragment,{children:[r.jsx(zR,{className:"h-4 w-4 mr-2"}),"Restore to Pending"]})})})]},A.id))]})]}),e.length===0&&n.length>0&&!y&&r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx(er,{className:"h-8 w-8 mx-auto mb-2 text-green-500"}),r.jsx("p",{children:"No pending transactions"})]})]})})]})}var hSe=Array.isArray,lo=hSe,fSe=typeof oi=="object"&&oi&&oi.Object===Object&&oi,lZ=fSe,mSe=lZ,pSe=typeof self=="object"&&self&&self.Object===Object&&self,gSe=mSe||pSe||Function("return this")(),id=gSe,xSe=id,vSe=xSe.Symbol,Rj=vSe,f8=Rj,cZ=Object.prototype,ySe=cZ.hasOwnProperty,bSe=cZ.toString,yy=f8?f8.toStringTag:void 0;function jSe(e){var t=ySe.call(e,yy),n=e[yy];try{e[yy]=void 0;var s=!0}catch{}var a=bSe.call(e);return s&&(t?e[yy]=n:delete e[yy]),a}var wSe=jSe,NSe=Object.prototype,_Se=NSe.toString;function SSe(e){return _Se.call(e)}var kSe=SSe,m8=Rj,CSe=wSe,ASe=kSe,PSe="[object Null]",ESe="[object Undef
925ined]",p8=m8?m8.toStringTag:void 0;function TSe(e){return e==null?e===void 0?ESe:PSe:p8&&p8 in Object(e)?CSe(e):ASe(e)}var du=TSe;function OSe(e){return e!=null&&typeof e=="object"}var uu=OSe,LSe=du,ISe=uu,RSe="[object Symbol]";function MSe(e){return typeof e=="symbol"||ISe(e)&&LSe(e)==RSe}var pv=MSe,DSe=lo,$Se=pv,FSe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,BSe=/^\w*$/;function USe(e,t){if(DSe(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||$Se(e)?!0:BSe.test(e)||!FSe.test(e)||t!=null&&e in Object(t)}var y6=USe;function zSe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var rf=zSe;const gv=_n(rf);var qSe=du,VSe=rf,WSe="[object AsyncFunction]",HSe="[object Function]",GSe="[object GeneratorFunction]",YSe="[object Proxy]";function KSe(e){if(!VSe(e))return!1;var t=qSe(e);return t==HSe||t==GSe||t==WSe||t==YSe}var b6=KSe;const Nr=_n(b6);var XSe=id,ZSe=XSe["__core-js_shared__"],JSe=ZSe,Pk=JSe,g8=function(){var e=/[^.]+$/.exec(Pk&&Pk.keys&&Pk.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function QSe(e){return!!g8&&g8 in e}var e5e=QSe,t5e=Function.prototype,r5e=t5e.toString;function n5e(e){if(e!=null){try{return r5e.call(e)}catch{}try{return e+""}catch{}}return""}var dZ=n5e,s5e=b6,a5e=e5e,i5e=rf,o5e=dZ,l5e=/[\\^$.*+?()[\]{}|]/g,c5e=/^\[object .+?Constructor\]$/,d5e=Function.prototype,u5e=Object.prototype,h5e=d5e.toString,f5e=u5e.hasOwnProperty,m5e=RegExp("^"+h5e.call(f5e).replace(l5e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p5e(e){if(!i5e(e)||a5e(e))return!1;var t=s5e(e)?m5e:c5e;return t.test(o5e(e))}var g5e=p5e;function x5e(e,t){return e==null?void 0:e[t]}var v5e=x5e,y5e=g5e,b5e=v5e;function j5e(e,t){var n=b5e(e,t);return y5e(n)?n:void 0}var rp=j5e,w5e=rp,N5e=w5e(Object,"create"),LS=N5e,x8=LS;function _5e(){this.__data__=x8?x8(null):{},this.size=0}var S5e=_5e;function k5e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var C5e=k5e,A5e=LS,P5e="__lodash_hash_undefined__",E5e=Object.prototype,T5e=E5e.hasOwnProperty;function O5e(e){var t=this.__data__;if(A5e){var n=t[e];return n===P5e?void 0:n}return T5e.call(t,e)?t[e]:void 0}var L5e=O5e,I5e=LS,R5e=Object.prototype,M5e=R5e.hasOwnProperty;function D5e(e){var t=this.__data__;return I5e?t[e]!==void 0:M5e.call(t,e)}var $5e=D5e,F5e=LS,B5e="__lodash_hash_undefined__";function U5e(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=F5e&&t===void 0?B5e:t,this}var z5e=U5e,q5e=S5e,V5e=C5e,W5e=L5e,H5e=$5e,G5e=z5e;function xv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}xv.prototype.clear=q5e;xv.prototype.delete=V5e;xv.prototype.get=W5e;xv.prototype.has=H5e;xv.prototype.set=G5e;var Y5e=xv;function K5e(){this.__data__=[],this.size=0}var X5e=K5e;function Z5e(e,t){return e===t||e!==e&&t!==t}var j6=Z5e,J5e=j6;function Q5e(e,t){for(var n=e.length;n--;)if(J5e(e[n][0],t))return n;return-1}var IS=Q5e,e4e=IS,t4e=Array.prototype,r4e=t4e.splice;function n4e(e){var t=this.__data__,n=e4e(t,e);if(n<0)return!1;var s=t.length-1;return n==s?t.pop():r4e.call(t,n,1),--this.size,!0}var s4e=n4e,a4e=IS;function i4e(e){var t=this.__data__,n=a4e(t,e);return n<0?void 0:t[n][1]}var o4e=i4e,l4e=IS;function c4e(e){return l4e(this.__data__,e)>-1}var d4e=c4e,u4e=IS;function h4e(e,t){var n=this.__data__,s=u4e(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}var f4e=h4e,m4e=X5e,p4e=s4e,g4e=o4e,x4e=d4e,v4e=f4e;function vv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}vv.prototype.clear=m4e;vv.prototype.delete=p4e;vv.prototype.get=g4e;vv.prototype.has=x4e;vv.prototype.set=v4e;var RS=vv,y4e=rp,b4e=id,j4e=y4e(b4e,"Map"),w6=j4e,v8=Y5e,w4e=RS,N4e=w6;function _4e(){this.size=0,this.__data__={hash:new v8,map:new(N4e||w4e),string:new v8}}var S4e=_4e;function k4e(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var C4e=k4e,A4e=C4e;function P4e(e,t){var n=e.__data__;return A4e(t)?n[typeof t=="string"?"string":"hash"]:n.map}var MS=P4e,E4e=MS;function T4e(e){var t=E4e(this,e).delete(e);return this.size-=t?1:0,t}var O4e=T4e,L4e=MS;function I4e(e){return L4e(this,e).get(e)}var R4e=I4e,M4e=MS;function D4e(e){return M4e(this,e).has(e)}var $4e=D4e,F4e=MS;function B4e(e,t){var n=F4e(this,e),s=n.size;return n.set(e,t),this.size+=n.size==s?0:1,this}var U4e=B4e,z4e=S4e,q4e=O4e,V4e=R4e,W4e=$4e,H4e=U4e;function yv(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}yv.prototype.clear=z4e;yv.prototype.delete=q4e;yv.prototype.get=V4e;yv.prototype.has=W4e;yv.prototype.set=H4e;var N6=yv,uZ=N6,G4e="Expected a function";function _6(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(G4e);var n=function(){var s=arguments,a=t?t.apply(this,s):s[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,s);return n.cache=i.set(a,o)||i,o};return n.cache=new(_6.Cache||uZ),n}_6.Cache=uZ;var hZ=_6;const Y4e=_n(hZ);var K4e=hZ,X4e=500;function Z4e(e){var t=K4e(e,function(s){return n.size===X4e&&n.clear(),s}),n=t.cache;return t}var J4e=Z4e,Q4e=J4e,eke=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tke=/\\(\\)?/g,rke=Q4e(function(e){var t=[];
925return e.charCodeAt(0)===46&&t.push(""),e.replace(eke,function(n,s,a,i){t.push(a?i.replace(tke,"$1"):s||n)}),t}),nke=rke;function ske(e,t){for(var n=-1,s=e==null?0:e.length,a=Array(s);++n<s;)a[n]=t(e[n],n,e);return a}var S6=ske,y8=Rj,ake=S6,ike=lo,oke=pv,lke=1/0,b8=y8?y8.prototype:void 0,j8=b8?b8.toString:void 0;function fZ(e){if(typeof e=="string")return e;if(ike(e))return ake(e,fZ)+"";if(oke(e))return j8?j8.call(e):"";var t=e+"";return t=="0"&&1/e==-lke?"-0":t}var cke=fZ,dke=cke;function uke(e){return e==null?"":dke(e)}var mZ=uke,hke=lo,fke=y6,mke=nke,pke=mZ;function gke(e,t){return hke(e)?e:fke(e,t)?[e]:mke(pke(e))}var pZ=gke,xke=pv,vke=1/0;function yke(e){if(typeof e=="string"||xke(e))return e;var t=e+"";return t=="0"&&1/e==-vke?"-0":t}var DS=yke,bke=pZ,jke=DS;function wke(e,t){t=bke(t,e);for(var n=0,s=t.length;e!=null&&n<s;)e=e[jke(t[n++])];return n&&n==s?e:void 0}var k6=wke,Nke=k6;function _ke(e,t,n){var s=e==null?void 0:Nke(e,t);return s===void 0?n:s}var gZ=_ke;const Mo=_n(gZ);function Ske(e){return e==null}var kke=Ske;const Or=_n(kke);var Cke=du,Ake=lo,Pke=uu,Eke="[object String]";function Tke(e){return typeof e=="string"||!Ake(e)&&Pke(e)&&Cke(e)==Eke}var Oke=Tke;const Rm=_n(Oke);var xZ={exports:{}},In={};/** 926 * @license React 927 * react-is.production.min.js 928 * 929 * Copyright (c) Facebook, Inc. and its affiliates. 930 * 931 * This source code is licensed under the MIT license found in the 932 * LICENSE file in the root directory of this source tree. 933 */var C6=Symbol.for("react.element"),A6=Symbol.for("react.portal"),$S=Symbol.for("react.fragment"),FS=Symbol.for("react.strict_mode"),BS=Symbol.for("react.profiler"),US=Symbol.for("react.provider"),zS=Symbol.for("react.context"),Lke=Symbol.for("react.server_context"),qS=Symbol.for("react.forward_ref"),VS=Symbol.for("react.suspense"),WS=Symbol.for("react.suspense_list"),HS=Symbol.for("react.memo"),GS=Symbol.for("react.lazy"),Ike=Symbol.for("react.offscreen"),vZ;vZ=Symbol.for("react.module.reference");function yl(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case C6:switch(e=e.type,e){case $S:case BS:case FS:case VS:case WS:return e;default:switch(e=e&&e.$$typeof,e){case Lke:case zS:case qS:case GS:case HS:case US:return e;default:return t}}case A6:return t}}}In.ContextConsumer=zS;In.ContextProvider=US;In.Element=C6;In.ForwardRef=qS;In.Fragment=$S;In.Lazy=GS;In.Memo=HS;In.Portal=A6;In.Profiler=BS;In.StrictMode=FS;In.Suspense=VS;In.SuspenseList=WS;In.isAsyncMode=function(){return!1};In.isConcurrentMode=function(){return!1};In.isContextConsumer=function(e){return yl(e)===zS};In.isContextProvider=function(e){return yl(e)===US};In.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===C6};In.isForwardRef=function(e){return yl(e)===qS};In.isFragment=function(e){return yl(e)===$S};In.isLazy=function(e){return yl(e)===GS};In.isMemo=function(e){return yl(e)===HS};In.isPortal=function(e){return yl(e)===A6};In.isProfiler=function(e){return yl(e)===BS};In.isStrictMode=function(e){return yl(e)===FS};In.isSuspense=function(e){return yl(e)===VS};In.isSuspenseList=function(e){return yl(e)===WS};In.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===$S||e===BS||e===FS||e===VS||e===WS||e===Ike||typeof e=="object"&&e!==null&&(e.$$typeof===GS||e.$$typeof===HS||e.$$typeof===US||e.$$typeof===zS||e.$$typeof===qS||e.$$typeof===vZ||e.getModuleId!==void 0)};In.typeOf=yl;xZ.exports=In;var Rke=xZ.exports,Mke=du,Dke=uu,$ke="[object Number]";function Fke(e){return typeof e=="number"||Dke(e)&&Mke(e)==$ke}var yZ=Fke;const Bke=_n(yZ);var Uke=yZ;function zke(e){return Uke(e)&&e!=+e}var qke=zke;const Mj=_n(qke);var Ni=function(t){return t===0?0:t>0?1:-1},Kf=function(t){return Rm(t)&&t.indexOf("%")===t.length-1},vt=function(t){return Bke(t)&&!Mj(t)},Vke=function(t){return Or(t)},va=function(t){return vt(t)||Rm(t)},Wke=0,bv=function(t){var n=++Wke;return"".concat(t||"").concat(n)},_i=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!vt(t)&&!Rm(t))return s;var i;if(Kf(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return Mj(i)&&(i=s),a&&i>n&&(i=n),i},Gu=function(t){if(!t)return null;var n=Object.keys(t);
vendor: 5,203 bytes, line 933
933return n&&n.length?t[n[0]]:null},Hke=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,s={},a=0;a<n;a++)if(!s[t[a]])s[t[a]]=!0;else return!0;return!1},ko=function(t,n){return vt(t)&&vt(n)?function(s){return t+s*(n-t)}:function(){return n}};function v_(e,t,n){return!e||!e.length?null:e.find(function(s){return s&&(typeof t=="function"?t(s):Mo(s,t))===n})}var Gke=function(t,n){return vt(t)&&vt(n)?t-n:Rm(t)&&Rm(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Og(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var s in t)if({}.hasOwnProperty.call(t,s)&&!{}.hasOwnProperty.call(e,s))return!1;return!0}function $P(e){"@babel/helpers - typeof";return $P=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},$P(e)}var Yke=["viewBox","children"],Kke=["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"],w8=["points","pathLength"],Ek={svg:Yke,polygon:w8,polyline:w8},P6=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onF
933ocus","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"],y_=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(j.isValidElement(t)&&(s=t.props),!gv(s))return null;var a={};return Object.keys(s).forEach(function(i){P6.includes(i)&&(a[i]=n||function(o){return s[i](s,o)})}),a},Xke=function(t,n,s){return function(a){return t(n,s,a),null}},Mm=function(t,n,s){if(!gv(t)||$P(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];P6.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=Xke(o,n,s))}),a},Zke=["children"],Jke=["children"];function N8(e,t){if(e==null)return{};var n=Qke(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Qke(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function FP(e){"@babel/helpers - typeof";return FP=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},FP(e)}var _8={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"}
933,Hd=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},S8=null,Tk=null,E6=function e(t){if(t===S8&&Array.isArray(Tk))return Tk;var n=[];return j.Children.forEach(t,function(s){Or(s)||(Rke.isFragment(s)?n=n.concat(e(s.props.children)):n.push(s))}),Tk=n,S8=t,n};function Do(e,t){var n=[],s=[];return Array.isArray(t)?s=t.map(function(a){return Hd(a)}):s=[Hd(t)],E6(e).forEach(function(a){var i=Mo(a,"type.displayName")||Mo(a,"type.name");s.indexOf(i)!==-1&&n.push(a)}),n}function No(e,t){var n=Do(e,t);return n&&n[0]}var k8=function(t){if(!t||!t.props)return!1;var n=t.props,s=n.width,a=n.height;return!(!vt(s)||s<=0||!vt(a)||a<=0)},eCe=["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"],tCe=function(t){return t&&t.type&&Rm(t.type)&&eCe.indexOf(t.type)>=0},rCe=function(t){return t&&FP(t)==="object"&&"clipDot"in t},nCe=function(t,n,s,a){var i,o=(i=Ek==null?void 0:Ek[a])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!Nr(t)&&(a&&o.includes(n)||Kke.includes(n))||s&&P6.includes(n)},cr=function(t,n,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(j.isValidElement(t)&&(a=t.props),!gv(a))return null;var i={};return Object.keys(a).forEach(function(o){var l;nCe((l=a)===null||l===void 0?void 0:l[o],o,n,s)&&(i[o]=a[o])}),i},BP=function e(t,n){if(t===n)return!0;var s=j.Children.count(t);if(s!==j.Children.count(n))return!1;if(s===0)return!0;if(s===1)return C8(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a<s;a++){var i=t[a],o=n[a];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!C8(i,o))return!1}return!0},C8=function(t,n){if(Or(t)&&Or(n))return!0;if(!Or(t)&&!Or(n)){var s=t.props||{},a=s.children,i=N8(s,Zke),o=n.props||{},l=o.children,c=N8(o,Jke);return a&&l?Og(i,c)&&BP(a,l):!a&&!l?Og(i,c):!1}return!1},A8=function(t,n){var s=[],a={};return E6(t).forEach(function(i,o){if(tCe(i))s.push(i);else if(i){var l=Hd(i.type),c=n[l]||{},d=c.handler,u=c.once;if(d&&(!u||!a[l])){var h=d(i,l,o);s.push(h),a[l]=!0}}}),s},sCe=function(t){var n=t&&t.type;return n&&_8[n]?_8[n]:null},aCe=function(t,n){return E6(n).indexOf(t)},iCe=["children","width","height","viewBox","className","style","title","desc"];function UP(){return UP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},UP.apply(this,arguments)}function oCe(e,t){if(e==null)return{};var n=lCe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function lCe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function zP(e){var t=e.children,n=e.width,s=e.height,a=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,d=oCe(e,iCe),u=a||{width:n,height:s,x:0,y:0},h=Mr("recharts-surface",i);return ee.createElement("svg",UP({},cr(d,!0,"svg"),{className:h,width:n,height:s,style:o,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height)}),ee.createElement("title",null,l),ee.createElement("desc",null,c),t)}var cCe=["children","className"];function qP(){return qP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},qP.apply(this,arguments)}function dCe(e,t){if(e==null)return{};var n=uCe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function uCe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var xn=ee.forwardRef(function(e,t){var n=e.children,s=e.className,a=dCe(e,cCe),i=Mr("recharts-layer",s);return ee.createElement("g",qP({className:i},cr(a,!0),{ref:t}),n)}),Jl=function(t,n){for(var s=arguments.length,a=new Array(s>2?s-2:0),i=2;i<s;i++)a[i-2]=arguments[i]};function hCe(e,t,n){var s=-1,a=e.length;t<0&&(t=-t>a?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(a);++s<a;)i[s]=e[s+t];return i}var fCe=hCe,mCe=fCe;function pCe(e,t,n){var s=e.length;return n=n===void 0?s:n,!t&&n>=s?e:mCe(e,t,n)}var gCe=pCe,xCe="\\ud800-\\udfff",vCe="\\u0300-\\u036f",yCe="\\ufe20-\\ufe2f",bCe="\\u20d0-\\u20ff",jCe=vCe+yCe+bCe,wCe="\\ufe0e\\ufe0f",NCe="\\u200d",_Ce=RegExp("["+NCe+xCe+jCe+wCe+"]");function SCe(e){return _Ce.test(e)}var bZ=SCe;function kCe(e){return e.split("")}var CCe=kCe,jZ="\\ud800-\\udfff",ACe="\\u0300-\\u036f",PCe="\\ufe20-\\ufe2f",ECe="\\u20d0-\\u20ff",TCe=ACe+PCe+ECe,OCe="\\ufe0e\\ufe0f",LCe="["+jZ+"]",VP="["+TCe+"]",WP="\\ud83c[\\udffb-\\udfff]",ICe="(?:"+VP+"|"+WP+")",wZ="[^"+jZ+"]",NZ="(?:\\ud83c[\\udde6-\\uddff]){2}",_Z="[\\ud800-\\udbff][\\udc00-\\udfff]",RCe="\\u200d",SZ=ICe+"?",kZ="["+OCe+"]?",MCe="(?:"+RCe+"(?:"+[wZ,NZ,_Z].join("|")+")"+kZ+SZ+")*",DCe=kZ+SZ+MCe,$Ce="(?:"+[wZ+VP+"?",VP,NZ,_Z,LCe].join("|")+")",FCe=RegExp(WP+"(?="+WP+")|"+$Ce+DCe,"g");function BCe(e){return e.match(FCe)||[]}var UCe=BCe,zCe=CCe,qCe=bZ,VCe=UCe;function WCe(e){return qCe(e)?VCe(e):zCe(e)}var HCe=WCe,GCe=gCe,YCe=bZ,KCe=HCe,XCe=mZ;function ZCe(e){return function(t){t=XCe(t);var n=YCe(t)?KCe(t):void 0,s=n?n[0]:t.charAt(0),a=n?GCe(n,1).join(""):t.slice(1);return s[e]()+a}}var JCe=ZCe,QCe=JCe,eAe=QCe("toUpperCase"),tAe=eAe;const YS=_n(tAe);function Xn(e){return function(){return e}}const CZ=Math.cos,b_=Math.sin,hc=Math.sqrt,j_=Math.PI,KS=2*j_,HP=Math.PI,GP=2*HP,Mf=1e-6,rAe=GP-Mf;function AZ(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function nAe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return AZ;const n=10**t;return function(s){this._+=s[0];for(let a=1,i=s.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+s[a]}}class sAe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?AZ:nAe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,s,a){this._append`Q${+t},${+n},${this._x1=+s},${this._y1=+a}`}bezierCurveTo(t,n,s,a,i,o){this._append`C${+t},${+n},${+s},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,s,a,i){if(t=+t,n=+n,s=+s,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=s-t,d=a-n,u=o-t,h=l-n,f=u*u+h*h;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(f>Mf)if(!(Math.abs(h*c-d*u)>Mf)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let m=s-o,x=a-l,p=c*c+d*d,v=m*m+x*x,g=Math.sqrt(p),y=Math.sqrt(f),b=i*Math.tan((HP-Math.acos((p+f-v)/(2*g*y)))/2),w=b/y,_=b/g;Math.abs(w-1)>Mf&&this._append`L${t+w*u},${n+w*h}`,this._append`A${i},${i},0,0,${+(h*m>u*x)},${this._x1=t+_*c},${this._y1=n+_*d}`}}arc(t,n,s,a,i,o){if(t=+t,n=+n,s=+s,o=!!o,s<0)throw new Error(`negative radius: ${s}`);let l=s*Math.cos(a),c=s*Math.sin(a),d=t+l,u=n+c,h=1^o,f=o?a-i:i-a;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>Mf||Math.abs(this._y1-u)>Mf)&&this._append`L${d},${u}`,s&&(f<0&&(f=f%GP+GP),f>rAe?this._append`A${s},${s},0,1,${h}
933,${t-l},${n-c}A${s},${s},0,1,${h},${this._x1=d},${this._y1=u}`:f>Mf&&this._append`A${s},${s},0,${+(f>=HP)},${h},${this._x1=t+s*Math.cos(i)},${this._y1=n+s*Math.sin(i)}`)}rect(t,n,s,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${s=+s}v${+a}h${-s}Z`}toString(){return this._}}function T6(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);t=s}return e},()=>new sAe(t)}function O6(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function PZ(e){this._context=e}PZ.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 XS(e){return new PZ(e)}function EZ(e){return e[0]}function TZ(e){return e[1]}function OZ(e,t){var n=Xn(!0),s=null,a=XS,i=null,o=T6(l);e=typeof e=="function"?e:e===void 0?EZ:Xn(e),t=typeof t=="function"?t:t===void 0?TZ:Xn(t);function l(c){var d,u=(c=O6(c)).length,h,f=!1,m;for(s==null&&(i=a(m=o())),d=0;d<=u;++d)!(d<u&&n(h=c[d],d,c))===f&&((f=!f)?i.lineStart():i.lineEnd()),f&&i.point(+e(h,d,c),+t(h,d,c));if(m)return i=null,m+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:Xn(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:Xn(+c),l):t},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Xn(!!c),l):n},l.curve=function(c){return arguments.length?(a=c,s!=null&&(i=a(s)),l):a},l.context=function(c){return arguments.length?(c==null?s=i=null:i=a(s=c),l):s},l}function m1(e,t,n){var s=null,a=Xn(!0),i=null,o=XS,l=null,c=T6(d);e=typeof e=="function"?e:e===void 0?EZ:Xn(+e),t=typeof t=="function"?t:Xn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?TZ:Xn(+n);function d(h){var f,m,x,p=(h=O6(h)).length,v,g=!1,y,b=new Array(p),w=new Array(p);for(i==null&&(l=o(y=c())),f=0;f<=p;++f){if(!(f<p&&a(v=h[f],f,h))===g)if(g=!g)m=f,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),x=f-1;x>=m;--x)l.point(b[x],w[x]);l.lineEnd(),l.areaEnd()}g&&(b[f]=+e(v,f,h),w[f]=+t(v,f,h),l.point(s?+s(v,f,h):b[f],n?+n(v,f,h):w[f]))}if(y)return l=null,y+""||null}function u(){return OZ().defined(a).curve(o).context(i)}return d.x=function(h){return arguments.length?(e=typeof h=="function"?h:Xn(+h),s=null,d):e},d.x0=function(h){return arguments.length?(e=typeof h=="function"?h:Xn(+h),d):e},d.x1=function(h){return arguments.length?(s=h==null?null:typeof h=="function"?h:Xn(+h),d):s},d.y=function(h){return arguments.length?(t=typeof h=="function"?h:Xn(+h),n=null,d):t},d.y0=function(h){return arguments.length?(t=typeof h=="function"?h:Xn(+h),d):t},d.y1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:Xn(+h),d):n},d.lineX0=d.lineY0=function(){return u().x(e).y(t)},d.lineY1=function(){return u().x(e).y(n)},d.lineX1=function(){return u().x(s).y(t)},d.defined=function(h){return arguments.length?(a=typeof h=="function"?h:Xn(!!h),d):a},d.curve=function(h){return arguments.length?(o=h,i!=null&&(l=o(i)),d):o},d.context=function(h){return arguments.length?(h==null?i=l=null:l=o(i=h),d):i},d}class LZ{constructor(t,n){this._context=t,this._x=n}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,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function aAe(e){return new LZ(e,!0)}function iAe(e){return new LZ(e,!1)}const L6={draw(e,t){const n=hc(t/j_);e.moveTo(n,0),e.arc(0,0,n,0,KS)}},oAe={draw(e,t){const n=hc(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},IZ=hc(1/3),lAe=IZ*2,cAe={draw(e,t){const n=hc(t/lAe),s=n*IZ;e.moveTo(0,-n),e.lineTo(s,0),e.lineTo(0,n),e.lineTo(-s,0),e.closePath()}},dAe={draw(e,t){const n=hc(t),s=-n/2;e.rect(s,s,n,n)}},uAe=.8908130915292852,RZ=b_(j_/10)/b_(7*j_/10),hAe=b_(KS/10)*RZ,fAe=-CZ(KS/10)*RZ,mAe={draw(e,t){const n=hc(t*uAe),s=hAe*n,a=fAe*n;e.moveTo(0,-n),e.lineTo(s,a);for(let i=1;i<5;++i){const o=KS*i/5,l=CZ(o),c=b_(o);e.lineTo(c*n,-l*n),e.lineTo(l*s-c*a,c*s+l*a)}e.closePath()}},Ok=hc(3),pAe={draw(e,t){const n=-hc(t/(Ok*3));e.moveTo(0,n*2),e.lineTo(-Ok*n,-n),e.lineTo(Ok*n,-n),e.closePath()}},Zo=-.5,Jo=hc(3)/2,YP=1/hc(12),gAe=(YP/2+1)*3,xAe={draw(e,t){const n=hc(t/gAe),s=n/2,a=n*YP,i=s,o=n*YP+n,l=-i,c=o;e.moveTo(s,a),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(Zo*s-Jo*a,Jo*s+Zo*a),e.lineTo(Zo*i-Jo*o,Jo*i+Zo*o),e.lineTo(Zo*l-Jo*c,Jo*l+Zo*c),e.lineTo(Zo*s+Jo*a,Zo*a-Jo*s),e.lineTo(Zo*i+Jo*o,Zo*o-Jo*i),e.lineTo(Zo*l+Jo*c,Zo*c-Jo*l),e.closePath()}};function vAe(e,t){let n=null,s=T6(a);e=typeof e=="function"?e:Xn(e||L6),t=typeof t=="function"?t:Xn(t===void 0?64:+t);function a(){let i;if(n||(n=i=s()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:Xn(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:Xn(+i),a):t},a.context=function(i){return arguments.length?(n=i??null,a):n},a}function w_(){}function N_(e,t,n){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+n)/6)}function MZ(e){this._context=e}MZ.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:N_(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:N_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yAe(e){return new MZ(e)}function DZ(e){this._context=e}DZ.prototype={areaStart:w_,areaEnd:w_,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:N_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function bAe(e){return new DZ(e)}function $Z(e){this._context=e}$Z.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 n=(this._x0+4*this._x1+e)/6,s=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:N_(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function jAe(e){return new $Z(e)}function FZ(e){this._context=e}FZ.prototype={areaStart:w_,areaEnd:w_,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 wAe(e){return new FZ(e)}function P8(e){return e<0?-1:1}function E8(e,t,n){var s=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(s||a<0&&-0),o=(n-e._y1)/(a||s<0&&-0),l=(i*a+o*s)/(s+a);return(P8(i)+P8(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function T8(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Lk(e,t,n){var s=e._x0,a=e._y0,i=e._x1,o=e._y1,l=(i-s)/3;e._context.bezierCurveTo(s+l,a+l*t,i-l,o-l*n,i,o)}function __(e){this._context=e}__.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:Lk(this,this._t0,T8(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 n=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,Lk(this,T8(this,n=E8(this,e,t)),n);break;default:Lk(this,this._t0,n=E8(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function BZ(e){this._context=new UZ(e)}(BZ.prototype=Object.create(__.prototype)).point=function(e,t){__.prototype.point.call(this,t,e)};function UZ(e){this._context=e}UZ.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,n,s,a,i){this._context.bezierCurveTo(t,e,s,n,i,a)}};function NAe(e){return new __(e)}function _Ae(e){return new BZ(e)}function zZ(e){this._context=e}zZ.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,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var s=O8(e),a=O8(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(s[0][i],a[0][i],s[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&n===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 O8(e){var t,n=e.length-1,s,a=new Array(n),i=new Array(n),o=new Array(n);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[n-1]=2,i[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)s=a[t]/i[t-1],i[t]-=s,o[t]-=s*o[t-1];for(a[n-1]=o[n-1]/i[n-1],t=n-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[n-1]=(e[n]+a[n-1])/2,t=0;t<n-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function SAe(e){return new zZ(e)}function ZS(e,t){this._context=e,this._t=t}ZS.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;
vendor: 9,194 bytes, lines 933-936
933default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function kAe(e){return new ZS(e,.5)}function CAe(e){return new ZS(e,0)}function AAe(e){return new ZS(e,1)}function wx(e,t){if((o=e.length)>1)for(var n=1,s,a,i=e[t[0]],o,l=i.length;n<o;++n)for(a=i,i=e[t[n]],s=0;s<l;++s)i[s][1]+=i[s][0]=isNaN(a[s][1])?a[s][0]:a[s][1]}function KP(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function PAe(e,t){return e[t]}function EAe(e){const t=[];return t.key=e,t}function TAe(){var e=Xn([]),t=KP,n=wx,s=PAe;function a(i){var o=Array.from(e.apply(this,arguments),EAe),l,c=o.length,d=-1,u;for(const h of i)for(l=0,++d;l<c;++l)(o[l][d]=[0,+s(h,o[l].key,d,i)]).data=h;for(l=0,u=O6(t(o));l<c;++l)o[u[l]].index=l;return n(o,u),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:Xn(Array.from(i)),a):e},a.value=function(i){return arguments.length?(s=typeof i=="function"?i:Xn(+i),a):s},a.order=function(i){return arguments.length?(t=i==null?KP:typeof i=="function"?i:Xn(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(n=i??wx,a):n},a}function OAe(e,t){if((s=e.length)>0){for(var n,s,a=0,i=e[0].length,o;a<i;++a){for(o=n=0;n<s;++n)o+=e[n][a][1]||0;if(o)for(n=0;n<s;++n)e[n][a][1]/=o}wx(e,t)}}function LAe(e,t){if((a=e.length)>0){for(var n=0,s=e[t[0]],a,i=s.length;n<i;++n){for(var o=0,l=0;o<a;++o)l+=e[o][n][1]||0;s[n][1]+=s[n][0]=-l/2}wx(e,t)}}function IAe(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var n=0,s=1,a,i,o;s<i;++s){for(var l=0,c=0,d=0;l<o;++l){for(var u=e[t[l]],h=u[s][1]||0,f=u[s-1][1]||0,m=(h-f)/2,x=0;x<l;++x){var p=e[t[x]],v=p[s][1]||0,g=p[s-1][1]||0;m+=v-g}c+=h,d+=m*h}a[s-1][1]+=a[s-1][0]=n,c&&(n-=d/c)}a[s-1][1]+=a[s-1][0]=n,wx(e,t)}}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 RAe=["type","size","sizeType"];function XP(){return XP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},XP.apply(this,arguments)}function L8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function I8(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?L8(Object(n),!0).forEach(function(s){MAe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L8(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function MAe(e,t,n){return t=DAe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DAe(e){var t=$Ae(e,"string");return eb(t)=="symbol"?t:t+""}function $Ae(e,t){if(eb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(eb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FAe(e,t){if(e==null)return{};var n=BAe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function BAe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var qZ={symbolCircle:L6,symbolCross:oAe,symbolDiamond:cAe,symbolSquare:dAe,symbolStar:mAe,symbolTriangle:pAe,symbolWye:xAe},UAe=Math.PI/180,zAe=function(t){var n="symbol".concat(YS(t));return qZ[n]||L6},qAe=function(t,n,s){if(n==="area")return t;switch(s){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*UAe;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),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}},VAe=function(t,n){qZ["symbol".concat(YS(t))]=n},I6=function(t){var n=t.type,s=n===void 0?"circle":n,a=t.size,i=a===void 0?64:a,o=t.sizeType,l=o===void 0?"area":o,c=FAe(t,RAe),d=I8(I8({},c),{},{type:s,size:i,sizeType:l}),u=function(){var v=zAe(s),g=vAe().type(v).size(qAe(i,l,s));return g()},h=d.className,f=d.cx,m=d.cy,x=cr(d,!0);return f===+f&&m===+m&&i===+i?ee.createElement("path",XP({},x,{className:Mr("recharts-symbols",h),transform:"translate(".concat(f,", ").concat(m,")"),d:u()})):null};I6.registerSymbol=VAe;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 ZP(){return ZP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ZP.apply(this,arguments)}function R8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function WAe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R8(Object(n),!0).forEach(function(s){tb(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R8(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function HAe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function GAe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,WZ(s.key),s)}}function YAe(e,t,n){return t&&GAe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function KAe(e,t,n){return t=S_(t),XAe(e,VZ()?Reflect.construct(t,n||[],S_(e).constructor):t.apply(e,n))}function XAe(e,t){if(t&&(Nx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ZAe(e)}function ZAe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function VZ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VZ=function(){return!!e})()}function S_(e){return S_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},S_(e)}function JAe(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&&JP(e,t)}function JP(e,t){return JP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},JP(e,t)}function tb(e,t,n){return t=WZ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WZ(e){var t=QAe(e,"string");return Nx(t)=="symbol"?t:t+""}function QAe(e,t){if(Nx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Nx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Qo=32,R6=function(e){function t(){return HAe(this,t),KAe(this,t,arguments)}return JAe(t,e),YAe(t,[{key:"renderIcon",value:function(s){var a=this.props.inactiveColor,i=Qo/2,o=Qo/6,l=Qo/3,c=s.inactive?a:s.color;if(s.type==="plainline")return ee.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:s.payload.strokeDasharray,x1:0,y1:i,x2:Qo,y2:i,className:"recharts-legend-icon"});if(s.type==="line")return ee.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,` 934 A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,` 935 H`).concat(Qo,"M").concat(2*l,",").concat(i,` 936 A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(s.type==="rect")return ee.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Qo/8,"h").concat(Qo,"v").concat(Qo*3/4,"h").concat(-Qo,"z"),className:"recharts-legend-icon"});if(ee.isValidElement(s.legendIcon)){var d=WAe({},s);return delete d.legendIcon,ee.cloneElement(s.legendIcon,d)}return ee.createElement(I6,{fill:c,cx:i,cy:i,size:Qo,sizeType:"diameter",type:s.type})}},{key:"renderItems",value:function(){var s=this,a=this.props,i=a.payload,o=a.iconSize,l=a.layout,c=a.formatter,d=a.inactiveColor,u={x:0,y:0,width:Qo,height:Qo}
936,h={display:l==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(m,x){var p=m.formatter||c,v=Mr(tb(tb({"recharts-legend-item":!0},"legend-item-".concat(x),!0),"inactive",m.inactive));if(m.type==="none")return null;var g=Nr(m.value)?null:m.value;Jl(!Nr(m.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 y=m.inactive?d:m.color;return ee.createElement("li",ZP({className:v,style:h,key:"legend-item-".concat(x)},Mm(s.props,m,x)),ee.createElement(zP,{width:o,height:o,viewBox:u,style:f},s.renderIcon(m)),ee.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},p?p(g,m,x):g))})}},{key:"render",value:function(){var s=this.props,a=s.payload,i=s.layout,o=s.align;if(!a||!a.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return ee.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(j.PureComponent);tb(R6,"displayName","Legend");tb(R6,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var ePe=RS;function tPe(){this.__data__=new ePe,this.size=0}var rPe=tPe;function nPe(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var sPe=nPe;function aPe(e){return this.__data__.get(e)}var iPe=aPe;function oPe(e){return this.__data__.has(e)}var lPe=oPe,cPe=RS,dPe=w6,uPe=N6,hPe=200;function fPe(e,t){var n=this.__data__;if(n instanceof cPe){var s=n.__data__;if(!dPe||s.length<hPe-1)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new uPe(s)}return n.set(e,t),this.size=n.size,this}var mPe=fPe,pPe=RS,gPe=rPe,xPe=sPe,vPe=iPe,yPe=lPe,bPe=mPe;function jv(e){var t=this.__data__=new pPe(e);this.size=t.size}jv.prototype.clear=gPe;jv.prototype.delete=xPe;jv.prototype.get=vPe;jv.prototype.has=yPe;jv.prototype.set=bPe;var HZ=jv,jPe="__lodash_hash_undefined__";function wPe(e){return this.__data__.set(e,jPe),this}var NPe=wPe;function _Pe(e){return this.__data__.has(e)}var SPe=_Pe,kPe=N6,CPe=NPe,APe=SPe;function k_(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new kPe;++t<n;)this.add(e[t])}k_.prototype.add=k_.prototype.push=CPe;k_.prototype.has=APe;var GZ=k_;function PPe(e,t){for(var n=-1,s=e==null?0:e.length;++n<s;)if(t(e[n],n,e))return!0;return!1}var YZ=PPe;function EPe(e,t){return e.has(t)}var KZ=EPe,TPe=GZ,OPe=YZ,LPe=KZ,IPe=1,RPe=2;function MPe(e,t,n,s,a,i){var o=n&IPe,l=e.length,c=t.length;if(l!=c&&!(o&&c>l))return!1;var d=i.get(e),u=i.get(t);if(d&&u)return d==t&&u==e;var h=-1,f=!0,m=n&RPe?new TPe:void 0;for(i.set(e,t),i.set(t,e);++h<l;){var x=e[h],p=t[h];if(s)var v=o?s(p,x,h,t,e,i):s(x,p,h,e,t,i);if(v!==void 0){if(v)continue;f=!1;break}if(m){if(!OPe(t,function(g,y){if(!LPe(m,y)&&(x===g||a(x,g,n,s,i)))return m.push(y)})){f=!1;break}}else if(!(x===p||a(x,p,n,s,i))){f=!1;break}}return i.delete(e),i.delete(t),f}var XZ=MPe,DPe=id,$Pe=DPe.Uint8Array,FPe=$Pe;function BPe(e){var t=-1,n=Array(e.size);return e.forEach(function(s,a){n[++t]=[a,s]}),n}var UPe=BPe;function zPe(e){var t=-1,n=Array(e.size);return e.forEach(function(s){n[++t]=s}),n}var M6=zPe,M8=Rj,D8=FPe,qPe=j6,VPe=XZ,WPe=UPe,HPe=M6,GPe=1,YPe=2,KPe="[object Boolean]",XPe="[object Date]",ZPe="[object Error]",JPe="[object Map]",QPe="[object Number]",e3e="[object RegExp]",t3e="[object Set]",r3e="[object String]",n3e="[object Symbol]",s3e="[object ArrayBuffer]",a3e="[object DataView]",$8=M8?M8.prototype:void 0,Ik=$8?$8.valueOf:void 0;function i3e(e,t,n,s,a,i,o){switch(n){case a3e:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case s3e:return!(e.byteLength!=t.byteLength||!i(new D8(e),new D8(t)));case KPe:case XPe:case QPe:return qPe(+e,+t);case ZPe:return e.name==t.name&&e.message==t.message;case e3e:case r3e:return e==t+"";case JPe:var l=WPe;case t3e:var c=s&GPe;if(l||(l=HPe),e.size!=t.size&&!c)return!1;var d=o.get(e);if(d)return d==t;s|=YPe,o.set(e,t);var u=VPe(l(e),l(t),s,a,i,o);return o.delete(e),u;case n3e:if(Ik)return Ik.call(e)==Ik.call(t)}return!1}var o3e=i3e;function l3e(e,t){for(var n=-1,s=t.length,a=e.length;++n<s;)e[a+n]=t[n];return e}var ZZ=l3e,c3e=ZZ,d3e=lo;function u3e(e,t,n){var s=t(e);return d3e(e)?s:c3e(s,n(e))}var h3e=u3e;function f3e(e,t){for(var n=-1,s=e==null?0:e.length,a=0,i=[];++n<s;){var o=e[n];t(o,n,e)&&(i[a++]=o)}return i}var m3e=f3e;function p3e(){return[]}var g3e=p3e,x3e=m3e,v3e=g3e,y3e=Object.prototype,b3e=y3e.propertyIsEnumerable,F8=Object.getOwnPropertySymbols,j3e=F8?function(e){return e==null?[]:(e=Object(e),x3e(F8(e),function(t){return b3e.call(e,t)}))}:v3e,w3e=j3e;function N3e(e,t){for(var n=-1,s=Array(e);++n<e;)s[n]=t(n);return s}var _3e=N3e,S3e=du,k3e=uu,C3e="[object Arguments]";function A3e(e){return k3e(e)&&S3e(e)==C3e}var P3e=A3e,B8=P3e,E3e=uu,JZ=Object.prototype,T3e=JZ.hasOwnProperty,O3e=JZ.propertyIsEnumerable,L3e=B8(function(){return arguments}())?B8:function(e){return E3e(e)&&T3e.call(e,"callee")&&!O3e.call(e,"callee")},D6=L3e,C_={exports:{}};function I3e(){return!1}var R3e=I3e;C_.exports;(function(e,t){var n=id,s=R3e,a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o?n.Buffer:void 0,c=l?l.isBuffer:void 0,d=c||s;e.exports=d}
vendor: 4,423 bytes, line 936
936)(C_,C_.exports);var QZ=C_.exports,M3e=9007199254740991,D3e=/^(?:0|[1-9]\d*)$/;function $3e(e,t){var n=typeof e;return t=t??M3e,!!t&&(n=="number"||n!="symbol"&&D3e.test(e))&&e>-1&&e%1==0&&e<t}var $6=$3e,F3e=9007199254740991;function B3e(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=F3e}var F6=B3e,U3e=du,z3e=F6,q3e=uu,V3e="[object Arguments]",W3e="[object Array]",H3e="[object Boolean]",G3e="[object Date]",Y3e="[object Error]",K3e="[object Function]",X3e="[object Map]",Z3e="[object Number]",J3e="[object Object]",Q3e="[object RegExp]",eEe="[object Set]",tEe="[object String]",rEe="[object WeakMap]",nEe="[object ArrayBuffer]",sEe="[object DataView]",aEe="[object Float32Array]",iEe="[object Float64Array]",oEe="[object Int8Array]",lEe="[object Int16Array]",cEe="[object Int32Array]",dEe="[object Uint8Array]",uEe="[object Uint8ClampedArray]",hEe="[object Uint16Array]",fEe="[object Uint32Array]",is={};is[aEe]=is[iEe]=is[oEe]=is[lEe]=is[cEe]=is[dEe]=is[uEe]=is[hEe]=is[fEe]=!0;is[V3e]=is[W3e]=is[nEe]=is[H3e]=is[sEe]=is[G3e]=is[Y3e]=is[K3e]=is[X3e]=is[Z3e]=is[J3e]=is[Q3e]=is[eEe]=is[tEe]=is[rEe]=!1;function mEe(e){return q3e(e)&&z3e(e.length)&&!!is[U3e(e)]}var pEe=mEe;function gEe(e){return function(t){return e(t)}}var eJ=gEe,A_={exports:{}};A_.exports;(function(e,t){var n=lZ,s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===s,o=i&&n.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(A_,A_.exports);var xEe=A_.exports,vEe=pEe,yEe=eJ,U8=xEe,z8=U8&&U8.isTypedArray,bEe=z8?yEe(z8):vEe,tJ=bEe,jEe=_3e,wEe=D6,NEe=lo,_Ee=QZ,SEe=$6,kEe=tJ,CEe=Object.prototype,AEe=CEe.hasOwnProperty;function PEe(e,t){var n=NEe(e),s=!n&&wEe(e),a=!n&&!s&&_Ee(e),i=!n&&!s&&!a&&kEe(e),o=n||s||a||i,l=o?jEe(e.length,String):[],c=l.length;for(var d in e)(t||AEe.call(e,d))&&!(o&&(d=="length"||a&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||SEe(d,c)))&&l.push(d);return l}var EEe=PEe,TEe=Object.prototype;function OEe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||TEe;return e===n}var LEe=OEe;function IEe(e,t){return function(n){return e(t(n))}}var rJ=IEe,REe=rJ,MEe=REe(Object.keys,Object),DEe=MEe,$Ee=LEe,FEe=DEe,BEe=Object.prototype,UEe=BEe.hasOwnProperty;function zEe(e){if(!$Ee(e))return FEe(e);var t=[];for(var n in Object(e))UEe.call(e,n)&&n!="constructor"&&t.push(n);return t}var qEe=zEe,VEe=b6,WEe=F6;function HEe(e){return e!=null&&WEe(e.length)&&!VEe(e)}var Dj=HEe,GEe=EEe,YEe=qEe,KEe=Dj;function XEe(e){return KEe(e)?GEe(e):YEe(e)}var JS=XEe,ZEe=h3e,JEe=w3e,QEe=JS;function eTe(e){return ZEe(e,QEe,JEe)}var tTe=eTe,q8=tTe,rTe=1,nTe=Object.prototype,sTe=nTe.hasOwnProperty;function aTe(e,t,n,s,a,i){var o=n&rTe,l=q8(e),c=l.length,d=q8(t),u=d.length;if(c!=u&&!o)return!1;for(var h=c;h--;){var f=l[h];if(!(o?f in t:sTe.call(t,f)))return!1}var m=i.get(e),x=i.get(t);if(m&&x)return m==t&&x==e;var p=!0;i.set(e,t),i.set(t,e);for(var v=o;++h<c;){f=l[h];var g=e[f],y=t[f];if(s)var b=o?s(y,g,f,t,e,i):s(g,y,f,e,t,i);if(!(b===void 0?g===y||a(g,y,n,s,i):b)){p=!1;break}v||(v=f=="constructor")}if(p&&!v){var w=e.constructor,_=t.constructor;w!=_&&"constructor"in e&&"constructor"in t&&!(typeof w=="function"&&w instanceof w&&typeof _=="function"&&_ instanceof _)&&(p=!1)}return i.delete(e),i.delete(t),p}var iTe=aTe,oTe=rp,lTe=id,cTe=oTe(lTe,"DataView"),dTe=cTe,uTe=rp,hTe=id,fTe=uTe(hTe,"Promise"),mTe=fTe,pTe=rp,gTe=id,xTe=pTe(gTe,"Set"),nJ=xTe,vTe=rp,yTe=id,bTe=vTe(yTe,"WeakMap"),jTe=bTe,QP=dTe,e3=w6,t3=mTe,r3=nJ,n3=jTe,sJ=du,wv=dZ,V8="[object Map]",wTe="[object Object]",W8="[object Promise]",H8="[object Set]",G8="[object WeakMap]",Y8="[object DataView]",NTe=wv(QP),_Te=wv(e3),STe=wv(t3),kTe=wv(r3),CTe=wv(n3),Df=sJ;(QP&&Df(new QP(new ArrayBuffer(1)))!=Y8||e3&&Df(new e3)!=V8||t3&&Df(t3.resolve())!=W8||r3&&Df(new r3)!=H8||n3&&Df(new n3)!=G8)&&(Df=function(e){var t=sJ(e),n=t==wTe?e.constructor:void 0,s=n?wv(n):"";if(s)switch(s){case NTe:return Y8;case _Te:return V8;case STe:return W8;case kTe:return H8;case CTe:return G8}return t});var ATe=Df,Rk=HZ,PTe=XZ,ETe=o3e,TTe=iTe,K8=ATe,X8=lo,Z8=QZ,OTe=tJ,LTe=1,J8="[object Arguments]",Q8="[object Array]",p1="[object Object]",ITe=Object.prototype,e$=ITe.hasOwnProperty;function RTe(e,t,n,s,a,i){var o=X8(e),l=X8(t),c=o?Q8:K8(e),d=l?Q8:K8(t);c=c==J8?p1:c,d=d==J8?p1:d;var u=c==p1,h=d==p1,f=c==d;if(f&&Z8(e)){if(!Z8(t))return!1;o=!0,u=!1}
vendor: 4,093 bytes, line 936
936if(f&&!u)return i||(i=new Rk),o||OTe(e)?PTe(e,t,n,s,a,i):ETe(e,t,c,n,s,a,i);if(!(n<e)){var m=u&&e$.call(e,"__wrapped__"),x=h&&e$.call(t,"__wrapped__");if(m||x){var p=m?e.value():e,v=x?t.value():t;return i||(i=new Rk),a(p,v,n,s,i)}}return f?(i||(i=new Rk),TTe(e,t,n,s,a,i)):!1}var MTe=RTe,DTe=MTe,t$=uu;function aJ(e,t,n,s,a){return e===t?!0:e==null||t==null||!t$(e)&&!t$(t)?e!==e&&t!==t:DTe(e,t,n,s,aJ,a)}var B6=aJ,$Te=HZ,FTe=B6,BTe=1,UTe=2;function zTe(e,t,n,s){var a=n.length,i=a,o=!s;if(e==null)return!i;for(e=Object(e);a--;){var l=n[a];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<i;){l=n[a];var c=l[0],d=e[c],u=l[1];if(o&&l[2]){if(d===void 0&&!(c in e))return!1}else{var h=new $Te;if(s)var f=s(d,u,c,e,t,h);if(!(f===void 0?FTe(u,d,BTe|UTe,s,h):f))return!1}}return!0}var qTe=zTe,VTe=rf;function WTe(e){return e===e&&!VTe(e)}var iJ=WTe,HTe=iJ,GTe=JS;function YTe(e){for(var t=GTe(e),n=t.length;n--;){var s=t[n],a=e[s];t[n]=[s,a,HTe(a)]}return t}var KTe=YTe;function XTe(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var oJ=XTe,ZTe=qTe,JTe=KTe,QTe=oJ;function eOe(e){var t=JTe(e);return t.length==1&&t[0][2]?QTe(t[0][0],t[0][1]):function(n){return n===e||ZTe(n,e,t)}}var tOe=eOe;function rOe(e,t){return e!=null&&t in Object(e)}var nOe=rOe,sOe=pZ,aOe=D6,iOe=lo,oOe=$6,lOe=F6,cOe=DS;function dOe(e,t,n){t=sOe(t,e);for(var s=-1,a=t.length,i=!1;++s<a;){var o=cOe(t[s]);if(!(i=e!=null&&n(e,o)))break;e=e[o]}return i||++s!=a?i:(a=e==null?0:e.length,!!a&&lOe(a)&&oOe(o,a)&&(iOe(e)||aOe(e)))}var uOe=dOe,hOe=nOe,fOe=uOe;function mOe(e,t){return e!=null&&fOe(e,t,hOe)}var pOe=mOe,gOe=B6,xOe=gZ,vOe=pOe,yOe=y6,bOe=iJ,jOe=oJ,wOe=DS,NOe=1,_Oe=2;function SOe(e,t){return yOe(e)&&bOe(t)?jOe(wOe(e),t):function(n){var s=xOe(n,e);return s===void 0&&s===t?vOe(n,e):gOe(t,s,NOe|_Oe)}}var kOe=SOe;function COe(e){return e}var Nv=COe;function AOe(e){return function(t){return t==null?void 0:t[e]}}var POe=AOe,EOe=k6;function TOe(e){return function(t){return EOe(t,e)}}var OOe=TOe,LOe=POe,IOe=OOe,ROe=y6,MOe=DS;function DOe(e){return ROe(e)?LOe(MOe(e)):IOe(e)}var $Oe=DOe,FOe=tOe,BOe=kOe,UOe=Nv,zOe=lo,qOe=$Oe;function VOe(e){return typeof e=="function"?e:e==null?UOe:typeof e=="object"?zOe(e)?BOe(e[0],e[1]):FOe(e):qOe(e)}var od=VOe;function WOe(e,t,n,s){for(var a=e.length,i=n+(s?1:-1);s?i--:++i<a;)if(t(e[i],i,e))return i;return-1}var lJ=WOe;function HOe(e){return e!==e}var GOe=HOe;function YOe(e,t,n){for(var s=n-1,a=e.length;++s<a;)if(e[s]===t)return s;return-1}var KOe=YOe,XOe=lJ,ZOe=GOe,JOe=KOe;function QOe(e,t,n){return t===t?JOe(e,t,n):XOe(e,ZOe,n)}var e6e=QOe,t6e=e6e;function r6e(e,t){var n=e==null?0:e.length;return!!n&&t6e(e,t,0)>-1}var n6e=r6e;function s6e(e,t,n){for(var s=-1,a=e==null?0:e.length;++s<a;)if(n(t,e[s]))return!0;return!1}var a6e=s6e;function i6e(){}var o6e=i6e,Mk=nJ,l6e=o6e,c6e=M6,d6e=1/0,u6e=Mk&&1/c6e(new Mk([,-0]))[1]==d6e?function(e){return new Mk(e)}:l6e,h6e=u6e,f6e=GZ,m6e=n6e,p6e=a6e,g6e=KZ,x6e=h6e,v6e=M6,y6e=200;function b6e(e,t,n){var s=-1,a=m6e,i=e.length,o=!0,l=[],c=l;if(n)o=!1,a=p6e;else if(i>=y6e){var d=t?null:x6e(e);if(d)return v6e(d);o=!1,a=g6e,c=new f6e}else c=t?[]:l;e:for(;++s<i;){var u=e[s],h=t?t(u):u;if(u=n||u!==0?u:0,o&&h===h){for(var f=c.length;f--;)if(c[f]===h)continue e;t&&c.push(h),l.push(u)}else a(c,h,n)||(c!==l&&c.push(h),l.push(u))}return l}var j6e=b6e,w6e=od,N6e=j6e;function _6e(e,t){return e&&e.length?N6e(e,w6e(t)):[]}var S6e=_6e;const r$=_n(S6e);function cJ(e,t,n){return t===!0?r$(e,n):Nr(t)?r$(e,t):e}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)}var k6e=["ref"];function n$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Nd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
vendor: 4,105 bytes, line 936
936t%2?n$(Object(n),!0).forEach(function(s){QS(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):n$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function C6e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s$(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,uJ(s.key),s)}}function A6e(e,t,n){return t&&s$(e.prototype,t),n&&s$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function P6e(e,t,n){return t=P_(t),E6e(e,dJ()?Reflect.construct(t,n||[],P_(e).constructor):t.apply(e,n))}function E6e(e,t){if(t&&(_x(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return T6e(e)}function T6e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dJ=function(){return!!e})()}function P_(e){return P_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},P_(e)}function O6e(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&&s3(e,t)}function s3(e,t){return s3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},s3(e,t)}function QS(e,t,n){return t=uJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uJ(e){var t=L6e(e,"string");return _x(t)=="symbol"?t:t+""}function L6e(e,t){if(_x(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(_x(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I6e(e,t){if(e==null)return{};var n=R6e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function R6e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function M6e(e){return e.value}function D6e(e,t){if(ee.isValidElement(e))return ee.cloneElement(e,t);if(typeof e=="function")return ee.createElement(e,t);t.ref;var n=I6e(t,k6e);return ee.createElement(R6,n)}var a$=1,pm=function(e){function t(){var n;C6e(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=P6e(this,t,[].concat(a)),QS(n,"lastBoundingBox",{width:-1,height:-1}),n}return O6e(t,e),A6e(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var s=this.wrapperNode.getBoundingClientRect();return s.height=this.wrapperNode.offsetHeight,s.width=this.wrapperNode.offsetWidth,s}return null}},{key:"updateBBox",value:function(){var s=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>a$||Math.abs(a.height-this.lastBoundingBox.height)>a$)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,s&&s(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,s&&s(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Nd({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,i=a.layout,o=a.align,l=a.verticalAlign,c=a.margin,d=a.chartWidth,u=a.chartHe
936ight,h,f;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(o==="center"&&i==="vertical"){var m=this.getBBoxSnapshot();h={left:((d||0)-m.width)/2}}else h=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(l==="middle"){var x=this.getBBoxSnapshot();f={top:((u||0)-x.height)/2}}else f=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Nd(Nd({},h),f)}},{key:"render",value:function(){var s=this,a=this.props,i=a.content,o=a.width,l=a.height,c=a.wrapperStyle,d=a.payloadUniqBy,u=a.payload,h=Nd(Nd({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return ee.createElement("div",{className:"recharts-legend-wrapper",style:h,ref:function(m){s.wrapperNode=m}},D6e(i,Nd(Nd({},this.props),{},{payload:cJ(u,d,M6e)})))}}],[{key:"getWithHeight",value:function(s,a){var i=Nd(Nd({},this.defaultProps),s.props),o=i.layout;return o==="vertical"&&vt(s.props.height)?{height:s.props.height}:o==="horizontal"?{width:s.props.width||a}:null}}])}(j.PureComponent);QS(pm,"displayName","Legend");QS(pm,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var i$=Rj,$6e=D6,F6e=lo,o$=i$?i$.isConcatSpreadable:void 0;function B6e(e){return F6e(e)||$6e(e)||!!(o$&&e&&e[o$])}var U6e=B6e,z6e=ZZ,q6e=U6e;function hJ(e,t,n,s,a){var i=-1,o=e.length;for(n||(n=q6e),a||(a=[]);++i<o;){var l=e[i];t>0&&n(l)?t>1?hJ(l,t-1,n,s,a):z6e(a,l):s||(a[a.length]=l)}return a}var fJ=hJ;function V6e(e){return function(t,n,s){for(var a=-1,i=Object(t),o=s(t),l=o.length;l--;){var c=o[e?l:++a];if(n(i[c],c,i)===!1)break}return t}}var W6e=V6e,H6e=W6e,G6e=H6e(),Y6e=G6e,K6e=Y6e,X6e=JS;function Z6e(e,t){return e&&K6e(e,t,X6e)}var mJ=Z6e,J6e=Dj;function Q6e(e,t){return function(n,s){if(n==null)return n;if(!J6e(n))return e(n,s);for(var a=n.length,i=t?a:-1,o=Object(n);(t?i--:++i<a)&&s(o[i],i,o)!==!1;);return n}}var eLe=Q6e,tLe=mJ,rLe=eLe,nLe=rLe(tLe),U6=nLe,sLe=U6,aLe=Dj;function iLe(e,t){var n=-1,s=aLe(e)?Array(e.length):[];return sLe(e,function(a,i,o){s[++n]=t(a,i,o)}),s}var pJ=iLe;function oLe(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var lLe=oLe,l$=pv;function cLe(e,t){if(e!==t){var n=e!==void 0,s=e===null,a=e===e,i=l$(e),o=t!==void 0,l=t===null,c=t===t,d=l$(t);if(!l&&!d&&!i&&e>t||i&&o&&c&&!l&&!d||s&&o&&c||!n&&c||!a)return 1;if(!s&&!i&&!d&&e<t||d&&n&&a&&!s&&!i||l&&n&&a||!o&&a||!c)return-1}return 0}var dLe=cLe,uLe=dLe;function hLe(e,t,n){for(var s=-1,a=e.criteria,i=t.criteria,o=a.length,l=n.length;++s<o;){var c=uLe(a[s],i[s]);if(c){if(s>=l)return c;var d=n[s];return c*(d=="desc"?-1:1)}}return e.index-t.index}var fLe=hLe,Dk=S6,mLe=k6,pLe=od,gLe=pJ,xLe=lLe,vLe=eJ,yLe=fLe,bLe=Nv,jLe=lo;function wLe(e,t,n){t.length?t=Dk(t,function(i){return jLe(i)?function(o){return mLe(o,i.length===1?i[0]:i)}:i}):t=[bLe];var s=-1;t=Dk(t,vLe(pLe));var a=gLe(e,function(i,o,l){var c=Dk(t,function(d){return d(i)});return{criteria:c,index:++s,value:i}});return xLe(a,function(i,o){return yLe(i,o,n)})}var NLe=wLe;function _Le(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var SLe=_Le,kLe=SLe,c$=Math.max;function CLe(e,t,n){return t=c$(t===void 0?e.length-1:t,0),function(){for(var s=arguments,a=-1,i=c$(s.length-t,0),o=Array(i);++a<i;)o[a]=s[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=s[a];return l[t]=n(o),kLe(e,this,l)}}var ALe=CLe;function PLe(e){return function(){return e}}var ELe=PLe,TLe=rp,OLe=function(){try{var e=TLe(Object,"defineProperty");return e({},"",{}),e}catch{}}(),gJ=OLe,LLe=ELe,d$=gJ,ILe=Nv,RLe=d$?function(e,t){return d$(e,"toString",{configurable:!0,enumerable:!1,value:LLe(t),writable:!0})}:ILe,MLe=RLe,DLe=800,$Le=16,FLe=Date.now;function BLe(e){var t=0,n=0;return function(){var s=FLe(),a=$Le-(s-n);if(n=s,a>0){if(++t>=DLe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var ULe=BLe,zLe=MLe,qLe=ULe,VLe=qLe(zLe),WLe=VLe,HLe=Nv,GLe=ALe,YLe=WLe;function KLe(e,t){return YLe(GLe(e,t,HLe),e+"")}var XLe=KLe,ZLe=j6,JLe=Dj,QLe=$6,eIe=rf;function tIe(e,t,n){if(!eIe(n))return!1;var s=typeof t;return(s=="number"?JLe(n)&&QLe(t,n.length):s=="string"&&t in n)?ZLe(n[t],e):!1}var e5=tIe,rIe=fJ,nIe=NLe,sIe=XLe,u$=e5,aIe=sIe(function(e,t){if(e==null)return[];var n=t.length;return n>1&&u$(e,t[0],t[1])?t=[]:n>2&&u$(t[0],t[1],t[2])&&(t=[t[0]]),nIe(e,rIe(t,1),[])}),iIe=aIe;const z6=_n(iIe);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 a3(){return a3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},a3.apply(this,arguments)}function oIe(e,t){return uIe(e)||dIe(e,t)||cIe(e,t)||lIe()}
vendor: 31,511 bytes, lines 936-944
936function lIe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 937In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cIe(e,t){if(e){if(typeof e=="string")return h$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h$(e,t)}}function h$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function dIe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function uIe(e){if(Array.isArray(e))return e}function f$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function $k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?f$(Object(n),!0).forEach(function(s){hIe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function hIe(e,t,n){return t=fIe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fIe(e){var t=mIe(e,"string");return rb(t)=="symbol"?t:t+""}function mIe(e,t){if(rb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(rb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pIe(e){return Array.isArray(e)&&va(e[0])&&va(e[1])?e.join(" ~ "):e}var gIe=function(t){var n=t.separator,s=n===void 0?" : ":n,a=t.contentStyle,i=a===void 0?{}:a,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,d=c===void 0?{}:c,u=t.payload,h=t.formatter,f=t.itemSorter,m=t.wrapperClassName,x=t.labelClassName,p=t.label,v=t.labelFormatter,g=t.accessibilityLayer,y=g===void 0?!1:g,b=function(){if(u&&u.length){var O={padding:0,margin:0},A=(f?z6(u,f):u).map(function(R,L){if(R.type==="none")return null;var z=$k({display:"block",paddingTop:4,paddingBottom:4,color:R.color||"#000"},l),U=R.formatter||h||pIe,$=R.value,q=R.name,ne=$,se=q;if(U&&ne!=null&&se!=null){var F=U($,q,R,L,u);if(Array.isArray(F)){var V=oIe(F,2);ne=V[0],se=V[1]}else ne=F}return ee.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(L),style:z},va(se)?ee.createElement("span",{className:"recharts-tooltip-item-name"},se):null,va(se)?ee.createElement("span",{className:"recharts-tooltip-item-separator"},s):null,ee.createElement("span",{className:"recharts-tooltip-item-value"},ne),ee.createElement("span",{className:"recharts-tooltip-item-unit"},R.unit||""))});return ee.createElement("ul",{className:"recharts-tooltip-item-list",style:O},A)}return null},w=$k({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),_=$k({margin:0},d),C=!Or(p),E=C?p:"",N=Mr("recharts-default-tooltip",m),k=Mr("recharts-tooltip-label",x);C&&v&&u!==void 0&&u!==null&&(E=v(p,u));var I=y?{role:"status","aria-live":"assertive"}:{};return ee.createElement("div",a3({className:N,style:w},I),ee.createElement("p",{className:k,style:_},ee.isValidElement(E)?E:"".concat(E)),b())};function nb(e){"@babel/helpers - typeof";return nb=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},nb(e)}function g1(e,t,n){return t=xIe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xIe(e){var t=vIe(e,"string");return nb(t)=="symbol"?t:t+""}function vIe(e,t){if(nb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(nb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var by="recharts-tooltip-wrapper",yIe={visibility:"hidden"};function bIe(e){var t=e.coordinate,n=e.translateX,s=e.translateY;return Mr(by,g1(g1(g1(g1({},"".concat(by,"-right"),vt(n)&&t&&vt(t.x)&&n>=t.x),"".concat(by,"-left"),vt(n)&&t&&vt(t.x)&&n<t.x),"".concat(by,"-bottom"),vt(s)&&t&&vt(t.y)&&s>=t.y),"".concat(by,"-top"),vt(s)&&t&&vt(t.y)&&s<t.y))}function m$(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.key,a=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,d=e.viewBoxDimension;if(i&&vt(i[s]))return i[s];var u=n[s]-l-a,h=n[s]+a;if(t[s])return o[s]?u:h;if(o[s]){var f=u,m=c[s];return f<m?Math.max(h,c[s]):Math.max(u,c[s])}var x=h+l,p=c[s]+d;return x>p?Math.max(u,c[s]):Math.max(h,c[s])}function jIe(e){var t=e.translateX,n=e.translateY,s=e.useTranslate3d;return{transform:s?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function wIe(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.offsetTopLeft,a=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,d,u,h;return o.height>0&&o.width>0&&n?(u=m$({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),h=m$({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=jIe({translateX:u,translateY:h,useTranslate3d:l})):d=yIe,{cssProperties:d,cssClasses:bIe({translateX:u,translateY:h,coordinate:n})}}function Sx(e){"@babel/helpers - typeof";return Sx=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},Sx(e)}function p$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function g$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p$(Object(n),!0).forEach(function(s){o3(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function NIe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _Ie(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,vJ(s.key),s)}}function SIe(e,t,n){return t&&_Ie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function kIe(e,t,n){return t=E_(t),CIe(e,xJ()?Reflect.construct(t,n||[],E_(e).constructor):t.apply(e,n))}function CIe(e,t){if(t&&(Sx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return AIe(e)}function AIe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xJ=function(){return!!e})()}function E_(e){return E_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},E_(e)}function PIe(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&&i3(e,t)}function i3(e,t){return i3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},i3(e,t)}function o3(e,t,n){return t=vJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vJ(e){var t=EIe(e,"string");return Sx(t)=="symbol"?t:t+""}function EIe(e,t){if(Sx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Sx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var x$=1,TIe=function(e){function t(){var n;NIe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=kIe(this,t,[].concat(a)),o3(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),o3(n,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,d,u;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(d=(u=n.props.coordinate)===null||u===void 0?void 0:u.y)!==null&&d!==void 0?d:0}})}}),n}return PIe(t,e),SIe(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var s=this.wrapperNode.getBoundingClientRect();(Math.abs(s.width-this.state.lastBoundingBox.width)>x$||Math.abs(s.height-this.state.lastBoundingBox.height)>x$)&&this.setState({lastBoundingBox:{width:s.width,height:s.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 s,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.children,u=a.coordinate,h=a.hasPayload,f=a.isAnimationActive,m=a.offset,x=a.position,p=a.reverseDirection,v=a.useTranslate3d,g=a.viewBox,y=a.wrapperStyle,b=wIe({allowEscapeViewBox:o,coordinate:u,offsetTopLeft:m,position:x,reverseDirection:p,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:g}),w=b.cssClasses,_=b.cssProperties,C=g$(g$({transition:f&&i?"transform ".concat(l,"ms ").concat(c):void 0},_),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&h?"visible":"hidden",position:"absolute",top:0,left:0},y);return ee.createElement("div",{tabIndex:-1,className:w,style:C,ref:function(N){s.wrapperNode=N}},d)}}])}(j.PureComponent),OIe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Gc={isSsr:OIe(),get:function(t){return Gc[t]},set:function(t,n){if(typeof t=="string")Gc[t]=n;else{var s=Object.keys(t);s&&s.length&&s.forEach(function(a){Gc[a]=t[a]})}}};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 v$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function y$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?v$(Object(n),!0).forEach(function(s){q6(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function LIe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function IIe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,bJ(s.key),s)}}function RIe(e,t,n){return t&&IIe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function MIe(e,t,n){return t=T_(t),DIe(e,yJ()?Reflect.construct(t,n||[],T_(e).constructor):t.apply(e,n))}function DIe(e,t){if(t&&(kx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $Ie(e)}function $Ie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yJ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yJ=function(){return!!e})()}function T_(e){return T_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},T_(e)}function FIe(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&&l3(e,t)}function l3(e,t){return l3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},l3(e,t)}function q6(e,t,n){return t=bJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bJ(e){var t=BIe(e,"string");return kx(t)=="symbol"?t:t+""}function BIe(e,t){if(kx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(kx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UIe(e){return e.dataKey}function zIe(e,t){return ee.isValidElement(e)?ee.cloneElement(e,t):typeof e=="function"?ee.createElement(e,t):ee.createElement(gIe,t)}var Fl=function(e){function t(){return LIe(this,t),MIe(this,t,arguments)}return FIe(t,e),RIe(t,[{key:"render",value:function(){var s=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,d=a.content,u=a.coordinate,h=a.filterNull,f=a.isAnimationActive,m=a.offset,x=a.payload,p=a.payloadUniqBy,v=a.position,g=a.reverseDirection,y=a.useTranslate3d,b=a.viewBox,w=a.wrapperStyle,_=x??[];h&&_.length&&(_=cJ(x.filter(function(E){return E.value!=null&&(E.hide!==!0||s.props.includeHidden)}),p,UIe));var C=_.length>0;return ee.createElement(TIe,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:f,active:i,coordinate:u,hasPayload:C,offset:m,position:v,reverseDirection:g,useTranslate3d:y,viewBox:b,wrapperStyle:w},zIe(d,y$(y$({},this.props),{},{payload:_})))}}])}(j.PureComponent);q6(Fl,"displayName","Tooltip");q6(Fl,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Gc.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 qIe=id,VIe=function(){return qIe.Date.now()},WIe=VIe,HIe=/\s/;function GIe(e){for(var t=e.length;t--&&HIe.test(e.charAt(t)););return t}var YIe=GIe,KIe=YIe,XIe=/^\s+/;function ZIe(e){return e&&e.slice(0,KIe(e)+1).replace(XIe,"")}var JIe=ZIe,QIe=JIe,b$=rf,eRe=pv,j$=NaN,tRe=/^[-+]0x[0-9a-f]+$/i,rRe=/^0b[01]+$/i,nRe=/^0o[0-7]+$/i,sRe=parseInt;function aRe(e){if(typeof e=="number")return e;if(eRe(e))return j$;if(b$(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=b$(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=QIe(e);var n=rRe.test(e);return n||nRe.test(e)?sRe(e.slice(2),n?2:8):tRe.test(e)?j$:+e}var jJ=aRe,iRe=rf,Fk=WIe,w$=jJ,oRe="Expected a function",lRe=Math.max,cRe=Math.min;function dRe(e,t,n){var s,a,i,o,l,c,d=0,u=!1,h=!1,f=!0;if(typeof e!="function")throw new TypeError(oRe);t=w$(t)||0,iRe(n)&&(u=!!n.leading,h="maxWait"in n,i=h?lRe(w$(n.maxWait)||0,t):i,f="trailing"in n?!!n.trailing:f);function m(C){var E=s,N=a;return s=a=void 0,d=C,o=e.apply(N,E),o}function x(C){return d=C,l=setTimeout(g,t),u?m(C):o}function p(C){var E=C-c,N=C-d,k=t-E;return h?cRe(k,i-N):k}function v(C){var E=C-c,N=C-d;return c===void 0||E>=t||E<0||h&&N>=i}function g(){var C=Fk();if(v(C))return y(C);l=setTimeout(g,p(C))}function y(C){return l=void 0,f&&s?m(C):(s=a=void 0,o)}function b(){l!==void 0&&clearTimeout(l),d=0,s=c=a=l=void 0}function w(){return l===void 0?o:y(Fk())}function _(){var C=Fk(),E=v(C);if(s=arguments,a=this,c=C,E){if(l===void 0)return x(c);if(h)return clearTimeout(l),l=setTimeout(g,t),m(c)}return l===void 0&&(l=setTimeout(g,t)),o}return _.cancel=b,_.flush=w,_}var uRe=dRe,hRe=uRe,fRe=rf,mRe="Expected a function";function pRe(e,t,n){var s=!0,a=!0;if(typeof e!="function")throw new TypeError(mRe);return fRe(n)&&(s="leading"in n?!!n.leading:s,a="trailing"in n?!!n.trailing:a),hRe(e,t,{leading:s,maxWait:t,trailing:a})}var gRe=pRe;const wJ=_n(gRe);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 N$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function x1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?N$(Object(n),!0).forEach(function(s){xRe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function xRe(e,t,n){return t=vRe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vRe(e){var t=yRe(e,"string");return sb(t)=="symbol"?t:t+""}function yRe(e,t){if(sb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(sb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bRe(e,t){return _Re(e)||NRe(e,t)||wRe(e,t)||jRe()}function jRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 938In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wRe(e,t){if(e){if(typeof e=="string")return _$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _$(e,t)}}function _$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function NRe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function _Re(e){if(Array.isArray(e))return e}var S$=j.forwardRef(function(e,t){var n=e.aspect,s=e.initialDimension,a=s===void 0?{width:-1,height:-1}:s,i=e.width,o=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,d=e.minWidth,u=d===void 0?0:d,h=e.minHeight,f=e.maxHeight,m=e.children,x=e.debounce,p=x===void 0?0:x,v=e.id,g=e.className,y=e.onResize,b=e.style,w=b===void 0?{}:b,_=j.useRef(null),C=j.useRef();C.current=y,j.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 E=j.useState({containerWidth:a.width,containerHeight:a.height}),N=bRe(E,2),k=N[0],I=N[1],P=j.useCallback(function(A,R){I(function(L){var z=Math.round(A),U=Math.round(R);return L.containerWidth===z&&L.containerHeight===U?L:{containerWidth:z,containerHeight:U}})},[]);j.useEffect(function(){var A=function(q){var ne,se=q[0].contentRect,F=se.width,V=se.height;P(F,V),(ne=C.current)===null||ne===void 0||ne.call(C,F,V)};p>0&&(A=wJ(A,p,{trailing:!0,leading:!1}));var R=new ResizeObserver(A),L=_.current.getBoundingClientRect(),z=L.width,U=L.height;return P(z,U),R.observe(_.current),function(){R.disconnect()}},[P,p]);var O=j.useMemo(function(){var A=k.containerWidth,R=k.containerHeight;if(A<0||R<0)return null;Jl(Kf(o)||Kf(c),`The width(%s) and height(%s) are both fixed numbers, 939 maybe you don't need to use a ResponsiveContainer.`,o,c),Jl(!n||n>0,"The aspect(%s) must be greater than zero.",n);var L=Kf(o)?A:o,z=Kf(c)?R:c;n&&n>0&&(L?z=L/n:z&&(L=z*n),f&&z>f&&(z=f)),Jl(L>0||z>0,`The width(%s) and height(%s) of chart should be greater than 0, 940 please check the style of container, or the props width(%s) and height(%s), 941 or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the 942 height and width.`,L,z,o,c,u,h,n);var U=!Array.isArray(m)&&Hd(m.type).endsWith("Chart");return ee.Children.map(m,function($){return ee.isValidElement($)?j.cloneElement($,x1({width:L,height:z},U?{style:x1({height:"100%",width:"100%",maxHeight:z,maxWidth:L},$.props.style)}:{})):$})},[n,m,c,f,h,u,k,o]);return ee.createElement("div",{id:v?"".concat(v):void 0,className:Mr("recharts-responsive-container",g),style:x1(x1({},w),{},{width:o,height:c,minWidth:u,minHeight:h,maxHeight:f}),ref:_},O)}),t5=function(t){return null};t5.displayName="Cell";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 k$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function c3(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?k$(Object(n),!0).forEach(function(s){SRe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k$(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function SRe(e,t,n){return t=kRe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kRe(e){var t=CRe(e,"string");return ab(t)=="symbol"?t:t+""}function CRe(e,t){if(ab(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(ab(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Up={widthCache:{},cacheCount:0},ARe=2e3,PRe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},C$="recharts_measurement_span";function ERe(e){var t=c3({},e);return Object.keys(t).forEach(function(n){t[n]||delete t[n]}),t}var c0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Gc.isSsr)return{width:0,height:0};var s=ERe(n),a=JSON.stringify({text:t,copyStyle:s});if(Up.widthCache[a])return Up.widthCache[a];try{var i=document.getElementById(C$);i||(i=document.createElement("span"),i.setAttribute("id",C$),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=c3(c3({},PRe),s);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Up.widthCache[a]=c,++Up.cacheCount>ARe&&(Up.cacheCount=0,Up.widthCache={}),c}catch{return{width:0,height:0}}},TRe=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};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 O_(e,t){return RRe(e)||IRe(e,t)||LRe(e,t)||ORe()}function ORe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 943In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LRe(e,t){if(e){if(typeof e=="string")return A$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A$(e,t)}}function A$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function IRe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function RRe(e){if(Array.isArray(e))return e}function MRe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P$(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,$Re(s.key),s)}}function DRe(e,t,n){return t&&P$(e.prototype,t),n&&P$(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $Re(e){var t=FRe(e,"string");return ib(t)=="symbol"?t:t+""}function FRe(e,t){if(ib(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(ib(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var E$=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,T$=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,BRe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,URe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,NJ={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},zRe=Object.keys(NJ),mg="NaN";function qRe(e,t){return e*NJ[t]}var v1=function(){function e(t,n){MRe(this,e),this.num=t,this.unit=n,this.num=t,this.unit=n,Number.isNaN(t)&&(this.unit=""),n!==""&&!BRe.test(n)&&(this.num=NaN,this.unit=""),zRe.includes(n)&&(this.num=qRe(t,n),this.unit="px")}return DRe(e,[{key:"add",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new e(NaN,""):new e(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new e(NaN,""):new e(this.num/n.num,this.unit||n.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(n){var s,a=(s=URe.exec(n))!==null&&s!==void 0?s:[],i=O_(a,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])}();function _J(e){if(e.includes(mg))return mg;for(var t=e;t.includes("*")||t.includes("/");){var n,s=(n=E$.exec(t))!==null&&n!==void 0?n:[],a=O_(s,4),i=a[1],o=a[2],l=a[3],c=v1.parse(i??""),d=v1.parse(l??""),u=o==="*"?c.multiply(d):c.divide(d);if(u.isNaN())return mg;t=t.replace(E$,u.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var h,f=(h=T$.exec(t))!==null&&h!==void 0?h:[],m=O_(f,4),x=m[1],p=m[2],v=m[3],g=v1.parse(x??""),y=v1.parse(v??""),b=p==="+"?g.add(y):g.subtract(y);if(b.isNaN())return mg;t=t.replace(T$,b.toString())}return t}var O$=/\(([^()]*)\)/;function VRe(e){for(var t=e;t.includes("(");){var n=O$.exec(t),s=O_(n,2),a=s[1];t=t.replace(O$,_J(a))}return t}function WRe(e){var t=e.replace(/\s+/g,"");return t=VRe(t),t=_J(t),t}function HRe(e){try{return WRe(e)}catch{return mg}}function Bk(e){var t=HRe(e.slice(5,-1));return t===mg?"":t}var GRe=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],YRe=["dx","dy","angle","className","breakAll"];function d3(){return d3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},d3.apply(this,arguments)}function L$(e,t){if(e==null)return{};var n=KRe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function KRe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function I$(e,t){return QRe(e)||JRe(e,t)||ZRe(e,t)||XRe()}function XRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 944In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZRe(e,t){if(e){if(typeof e=="string")return R$(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R$(e,t)}}function R$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function JRe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function QRe(e){if(Array.isArray(e))return e}var SJ=/[ \f\n\r\t\v\u2028\u2029]+/,kJ=function(t){var n=t.children,s=t.breakAll,a=t.style;try{var i=[];Or(n)||(s?i=n.toString().split(""):i=n.toString().split(SJ));var o=i.map(function(c){return{word:c,width:c0(c,a).width}}),l=s?0:c0(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},eMe=function(t,n,s,a,i){var o=t.maxLines,l=t.children,c=t.style,d=t.breakAll,u=vt(o),h=l,f=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return L.reduce(function(z,U){var $=U.word,q=U.width,ne=z[z.length-1];if(ne&&(a==null||i||ne.width+q+s<Number(a)))ne.words.push($),ne.width+=q+s;else{var se={words:[$],width:q};z.push(se)}return z},[])},m=f(n),x=function(L){return L.reduce(function(z,U){return z.width>U.width?z:U})};if(!u)return m;for(var p="â¦",v=function(L){var z=h.slice(0,L),U=kJ({breakAll:d,style:c,children:z+p}).wordsWithComputedWidth,$=f(U),q=$.length>
944o||x($).width>Number(a);return[q,$]},g=0,y=h.length-1,b=0,w;g<=y&&b<=h.length-1;){var _=Math.floor((g+y)/2),C=_-1,E=v(C),N=I$(E,2),k=N[0],I=N[1],P=v(_),O=I$(P,1),A=O[0];if(!k&&!A&&(g=_+1),k&&A&&(y=_-1),!k&&A){w=I;break}b++}return w||m},M$=function(t){var n=Or(t)?[]:t.toString().split(SJ);return[{words:n}]},tMe=function(t){var n=t.width,s=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((n||s)&&!Gc.isSsr){var c,d,u=kJ({breakAll:o,children:a,style:i});if(u){var h=u.wordsWithComputedWidth,f=u.spaceWidth;c=h,d=f}else return M$(a);return eMe({breakAll:o,children:a,maxLines:l,style:i},c,d,n,s)}return M$(a)},D$="#808080",Dm=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,d=c===void 0?"0.71em":c,u=t.scaleToFit,h=u===void 0?!1:u,f=t.textAnchor,m=f===void 0?"start":f,x=t.verticalAnchor,p=x===void 0?"end":x,v=t.fill,g=v===void 0?D$:v,y=L$(t,GRe),b=j.useMemo(function(){return tMe({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:h,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,h,y.style,y.width]),w=y.dx,_=y.dy,C=y.angle,E=y.className,N=y.breakAll,k=L$(y,YRe);if(!va(s)||!va(i))return null;var I=s+(vt(w)?w:0),P=i+(vt(_)?_:0),O;switch(p){case"start":O=Bk("calc(".concat(d,")"));break;case"middle":O=Bk("calc(".concat((b.length-1)/2," * -").concat(l," + (").concat(d," / 2))"));break;default:O=Bk("calc(".concat(b.length-1," * -").concat(l,")"));break}var A=[];if(h){var R=b[0].width,L=y.width;A.push("scale(".concat((vt(L)?L/R:1)/R,")"))}return C&&A.push("rotate(".concat(C,", ").concat(I,", ").concat(P,")")),A.length&&(k.transform=A.join(" ")),ee.createElement("text",d3({},cr(k,!0),{x:I,y:P,className:Mr("recharts-text",E),textAnchor:m,fill:g.includes("url")?D$:g}),b.map(function(z,U){var $=z.words.join(N?"":" ");return ee.createElement("tspan",{x:I,dy:U===0?O:l,key:"".concat($,"-").concat(U)},$)}))};function _h(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function rMe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function V6(e){let t,n,s;e.length!==2?(t=_h,n=(l,c)=>_h(e(l),c),s=(l,c)=>e(l)-c):(t=e===_h||e===rMe?e:nMe,n=e,s=e);function a(l,c,d=0,u=l.length){if(d<u){if(t(c,c)!==0)return u;do{const h=d+u>>>1;n(l[h],c)<0?d=h+1:u=h}while(d<u)}return d}function i(l,c,d=0,u=l.length){if(d<u){if(t(c,c)!==0)return u;do{const h=d+u>>>1;n(l[h],c)<=0?d=h+1:u=h}while(d<u)}return d}function o(l,c,d=0,u=l.length){const h=a(l,c,d,u-1);return h>d&&s(l[h-1],c)>-s(l[h],c)?h-1:h}return{left:a,center:o,right:i}}function nMe(){return 0}function CJ(e){return e===null?NaN:+e}function*sMe(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const aMe=V6(_h),$j=aMe.right;V6(CJ).center;class $$ extends Map{constructor(t,n=lMe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[s,a]of t)this.set(s,a)}get(t){return super.get(F$(this,t))}has(t){return super.has(F$(this,t))}set(t,n){return super.set(iMe(this,t),n)}delete(t){return super.delete(oMe(this,t))}}function F$({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function iMe({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function oMe({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function lMe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function cMe(e=_h){if(e===_h)return AJ;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const s=e(t,n);return s||s===0?s:(e(n,n)===0)-(e(t,t)===0)}}function AJ(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const dMe=Math.sqrt(50),uMe=Math.sqrt(10),hMe=Math.sqrt(2);function L_(e,t,n){const s=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(s)),i=s/Math.pow(10,a),o=i>=dMe?10:i>=uMe?5:i>=hMe?2:1;let l,c,d;return a<0?(d=Math.pow(10,-a)/o,l=Math.round(e*d),c=Math.round(t*d),l/d<e&&++l,c/d>t&&--c,d=-d):(d=Math.pow(10,a)*o,l=Math.round(e/d),c=Math.round(t/d),l*d<e&&++l,c*d>t&&--c),c<l&&.5<=n&&n<2?L_(e,t,n*2):[l,c,d]}function u3(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const s=t<e,[a,i,o]=s?L_(t,e,n):L_(e,t,n);if(!(i>=a))return[];const l=i-a+1,c=new Array(l);if(s)if(o<0)for(let d=0;d<l;++d)c[d]=(i-d)/-o;else for(let d=0;d<l;++d)c[d]=(i-d)*o;else if(o<0)for(let d=0;d<l;++d)c[d]=(a+d)/-o;else for(let d=0;d<l;++d)c[d]=(a+d)*o;return c}function h3(e,t,n){return t=+t,e=+e,n=+n,L_(e,t,n)[2]}function f3(e,t,n){t=+t,e=+e,n=+n;const s=t<e,a=s?h3(t,e,n):h3(e,t,n);return(s?-1:1)*(a<0?1/-a:a)}function B$(e,t){let n;for(const s of e)s!=null&&(n<s||n===void 0&&s>=s)&&(n=s);return n}function U$(e,t){let n;for(const s of e)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function PJ(e,t,n=0,s=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),s=Math.floor(Math.min(e.length-1,s)),!(n<=t&&t<=s))return e;for(a=a===void 0?AJ:cMe(a);s>n;){if(s-n>600){const c=s-n+1,d=t-n+1,u=Math.log(c),h=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*h*(c-h)/c)*(d-c/2<0?-1:1),m=Math.max(n,Math.floor(t-d*h/c+f)),x=Math.min(s,Math.floor(t+(c-d)*h/c+f));PJ(e,t,m,x,a)}const i=e[t];let o=n,l=s;for(jy(e,n,t),a(e[s],i)>0&&jy(e,n,s);o<l;){for(jy(e,o,l),++o,--l;a(e[o],i)<0;)++o;for(;a(e[l],i)>0;)--l}a(e[n],i)===0?jy(e,n,l):(++l,jy(e,l,s)),l<=t&&(n=l+1),t<=l&&(s=l-1)}return e}function jy(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function fMe(e,t,n){if(e=Float64Array.from(sMe(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return U$(e);
vendor: 10,868 bytes, line 944
944if(t>=1)return B$(e);var s,a=(s-1)*t,i=Math.floor(a),o=B$(PJ(e,i).subarray(0,i+1)),l=U$(e.subarray(i+1));return o+(l-o)*(a-i)}}function mMe(e,t,n=CJ){if(!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return+n(e[0],0,e);if(t>=1)return+n(e[s-1],s-1,e);var s,a=(s-1)*t,i=Math.floor(a),o=+n(e[i],i,e),l=+n(e[i+1],i+1,e);return o+(l-o)*(a-i)}}function pMe(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var s=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(a);++s<a;)i[s]=e+s*n;return i}function bl(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function hu(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 m3=Symbol("implicit");function W6(){var e=new $$,t=[],n=[],s=m3;function a(i){let o=e.get(i);if(o===void 0){if(s!==m3)return s;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new $$;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(n=Array.from(i),a):n.slice()},a.unknown=function(i){return arguments.length?(s=i,a):s},a.copy=function(){return W6(t,n).unknown(s)},bl.apply(a,arguments),a}function ob(){var e=W6().unknown(void 0),t=e.domain,n=e.range,s=0,a=1,i,o,l=!1,c=0,d=0,u=.5;delete e.unknown;function h(){var f=t().length,m=a<s,x=m?a:s,p=m?s:a;i=(p-x)/Math.max(1,f-c+d*2),l&&(i=Math.floor(i)),x+=(p-x-i*(f-c))*u,o=i*(1-c),l&&(x=Math.round(x),o=Math.round(o));var v=pMe(f).map(function(g){return x+i*g});return n(m?v.reverse():v)}return e.domain=function(f){return arguments.length?(t(f),h()):t()},e.range=function(f){return arguments.length?([s,a]=f,s=+s,a=+a,h()):[s,a]},e.rangeRound=function(f){return[s,a]=f,s=+s,a=+a,l=!0,h()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(f){return arguments.length?(l=!!f,h()):l},e.padding=function(f){return arguments.length?(c=Math.min(1,d=+f),h()):c},e.paddingInner=function(f){return arguments.length?(c=Math.min(1,f),h()):c},e.paddingOuter=function(f){return arguments.length?(d=+f,h()):d},e.align=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),h()):u},e.copy=function(){return ob(t(),[s,a]).round(l).paddingInner(c).paddingOuter(d).align(u)},bl.apply(h(),arguments)}function EJ(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return EJ(t())},e}function d0(){return EJ(ob.apply(null,arguments).paddingInner(1))}function H6(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function TJ(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Fj(){}var lb=.7,I_=1/lb,Lg="\\s*([+-]?\\d+)\\s*",cb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gMe=/^#([0-9a-f]{3,8})$/,xMe=new RegExp(`^rgb\\(${Lg},${Lg},${Lg}\\)$`),vMe=new RegExp(`^rgb\\(${Yc},${Yc},${Yc}\\)$`),yMe=new RegExp(`^rgba\\(${Lg},${Lg},${Lg},${cb}\\)$`),bMe=new RegExp(`^rgba\\(${Yc},${Yc},${Yc},${cb}\\)$`),jMe=new RegExp(`^hsl\\(${cb},${Yc},${Yc}\\)$`),wMe=new RegExp(`^hsla\\(${cb},${Yc},${Yc},${cb}\\)$`),z$={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};H6(Fj,db,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:q$,formatHex:q$,formatHex8:NMe,formatHsl:_Me,formatRgb:V$,toString:V$});function q$(){return this.rgb().formatHex()}function NMe(){return this.rgb().formatHex8()}function _Me(){return OJ(this).formatHsl()}function V$(){return this.rgb().formatRgb()}function db(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=gMe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?W$(t):n===3?new Zi(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?y1(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?y1(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=xMe.exec(e))?new Zi(t[1],t[2],t[3],1):(t=vMe.exec(e))?new Zi(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yMe.exec(e))?y1(t[1],t[2],t[3],t[4]):(t=bMe.exec(e))?y1(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jMe.exec(e))?Y$(t[1],t[2]/100,t[3]/100,1):(t=wMe.exec(e))?Y$(t[1],t[2]/100,t[3]/100,t[4]):z$.hasOwnProperty(e)?W$(z$[e]):e==="transparent"?new Zi(NaN,NaN,NaN,0):null}function W$(e){return new Zi(e>>16&255,e>>8&255,e&255,1)}function y1(e,t,n,s){return s<=0&&(e=t=n=NaN),new Zi(e,t,n,s)}function SMe(e){return e instanceof Fj||(e=db(e)),e?(e=e.rgb(),new Zi(e.r,e.g,e.b,e.opacity)):new Zi}function p3(e,t,n,s){return arguments.length===1?SMe(e):new Zi(e,t,n,s??1)}function Zi(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}H6(Zi,p3,TJ(Fj,{brighter(e){return e=e==null?I_:Math.pow(I_,e),new Zi(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?lb:Math.pow(lb,e),new Zi(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zi(gm(this.r),gm(this.g),gm(this.b),R_(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:H$,formatHex:H$,formatHex8:kMe,formatRgb:G$,toString:G$}));function H$(){return`#${Xf(this.r)}${Xf(this.g)}${Xf(this.b)}`}function kMe(){return`#${Xf(this.r)}${Xf(this.g)}${Xf(this.b)}${Xf((isNaN(this.opacity)?1:this.opacity)*255)}`}function G$(){const e=R_(this.opacity);return`${e===1?"rgb(":"rgba("}${gm(this.r)}, ${gm(this.g)}, ${gm(this.b)}${e===1?")":`, ${e})`}`}function R_(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gm(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xf(e){return e=gm(e),(e<16?"0":"")+e.toString(16)}function Y$(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hl(e,t,n,s)}function OJ(e){if(e instanceof Hl)return new Hl(e.h,e.s,e.l,e.opacity);if(e instanceof Fj||(e=db(e)),!e)return new Hl;if(e instanceof Hl)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),i=Math.max(t,n,s),o=NaN,l=i-a,c=(i+a)/2;return l?(t===i?o=(n-s)/l+(n<s)*6:n===i?o=(s-t)/l+2:o=(t-n)/l+4,l/=c<.5?i+a:2-i-a,o*=60):l=c>0&&c<1?0:o,new Hl(o,l,c,e.opacity)}function CMe(e,t,n,s){return arguments.length===1?OJ(e):new Hl(e,t,n,s??1)}function Hl(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}H6(Hl,CMe,TJ(Fj,{brighter(e){return e=e==null?I_:Math.pow(I_,e),new Hl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?lb:Math.pow(lb,e),new Hl(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,n=this.l,s=n+(n<.5?n:1-n)*t,a=2*n-s;return new Zi(Uk(e>=240?e-240:e+120,a,s),Uk(e,a,s),Uk(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new Hl(K$(this.h),b1(this.s),b1(this.l),R_(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=R_(this.opacity);return`${e===1?"hsl(":"hsla("}${K$(this.h)}, ${b1(this.s)*100}%, ${b1(this.l)*100}%${e===1?")":`, ${e})`}`}}));function K$(e){return e=(e||0)%360,e<0?e+360:e}function b1(e){return Math.max(0,Math.min(1,e||0))}function Uk(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const G6=e=>()=>e;function AMe(e,t){return function(n){return e+n*t}}function PMe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function EMe(e){return(e=+e)==1?LJ:function(t,n){return n-t?PMe(t,n,e):G6(isNaN(t)?n:t)}}function LJ(e,t){var n=t-e;return n?AMe(e,n):G6(isNaN(e)?t:e)}const X$=function e(t){var n=EMe(t);function s(a,i){var o=n((a=p3(a)).r,(i=p3(i)).r),l=n(a.g,i.g),c=n(a.b,i.b),d=LJ(a.opacity,i.opacity);return function(u){return a.r=o(u),a.g=l(u),a.b=c(u),a.opacity=d(u),a+""}}return s.gamma=e,s}(1);function TMe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),a;return function(i){for(a=0;a<n;++a)s[a]=e[a]*(1-i)+t[a]*i;return s}}function OMe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function LMe(e,t){var n=t?t.length:0,s=e?Math.min(n,e.length):0,a=new Array(s),i=new Array(n),o;for(o=0;o<s;++o)a[o]=_v(e[o],t[o]);for(;o<n;
vendor: 5,514 bytes, line 944
944++o)i[o]=t[o];return function(l){for(o=0;o<s;++o)i[o]=a[o](l);return i}}function IMe(e,t){var n=new Date;return e=+e,t=+t,function(s){return n.setTime(e*(1-s)+t*s),n}}function M_(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function RMe(e,t){var n={},s={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=_v(e[a],t[a]):s[a]=t[a];return function(i){for(a in n)s[a]=n[a](i);return s}}var g3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zk=new RegExp(g3.source,"g");function MMe(e){return function(){return e}}function DMe(e){return function(t){return e(t)+""}}function $Me(e,t){var n=g3.lastIndex=zk.lastIndex=0,s,a,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(s=g3.exec(e))&&(a=zk.exec(t));)(i=a.index)>n&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(s=s[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,c.push({i:o,x:M_(s,a)})),n=zk.lastIndex;return n<t.length&&(i=t.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?DMe(c[0].x):MMe(t):(t=c.length,function(d){for(var u=0,h;u<t;++u)l[(h=c[u]).i]=h.x(d);return l.join("")})}function _v(e,t){var n=typeof t,s;return t==null||n==="boolean"?G6(t):(n==="number"?M_:n==="string"?(s=db(t))?(t=s,X$):$Me:t instanceof db?X$:t instanceof Date?IMe:OMe(t)?TMe:Array.isArray(t)?LMe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?RMe:M_)(e,t)}function Y6(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function FMe(e,t){t===void 0&&(t=e,e=_v);for(var n=0,s=t.length-1,a=t[0],i=new Array(s<0?0:s);n<s;)i[n]=e(a,a=t[++n]);return function(o){var l=Math.max(0,Math.min(s-1,Math.floor(o*=s)));return i[l](o-l)}}function BMe(e){return function(){return e}}function D_(e){return+e}var Z$=[0,1];function Si(e){return e}function x3(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:BMe(isNaN(t)?NaN:.5)}function UMe(e,t){var n;return e>t&&(n=e,e=t,t=n),function(s){return Math.max(e,Math.min(t,s))}}function zMe(e,t,n){var s=e[0],a=e[1],i=t[0],o=t[1];return a<s?(s=x3(a,s),i=n(o,i)):(s=x3(s,a),i=n(i,o)),function(l){return i(s(l))}}function qMe(e,t,n){var s=Math.min(e.length,t.length)-1,a=new Array(s),i=new Array(s),o=-1;for(e[s]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<s;)a[o]=x3(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(l){var c=$j(e,l,1,s)-1;return i[c](a[c](l))}}function Bj(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function r5(){var e=Z$,t=Z$,n=_v,s,a,i,o=Si,l,c,d;function u(){var f=Math.min(e.length,t.length);return o!==Si&&(o=UMe(e[0],e[f-1])),l=f>2?qMe:zMe,c=d=null,h}function h(f){return f==null||isNaN(f=+f)?i:(c||(c=l(e.map(s),t,n)))(s(o(f)))}return h.invert=function(f){return o(a((d||(d=l(t,e.map(s),M_)))(f)))},h.domain=function(f){return arguments.length?(e=Array.from(f,D_),u()):e.slice()},h.range=function(f){return arguments.length?(t=Array.from(f),u()):t.slice()},h.rangeRound=function(f){return t=Array.from(f),n=Y6,u()},h.clamp=function(f){return arguments.length?(o=f?!0:Si,u()):o!==Si},h.interpolate=function(f){return arguments.length?(n=f,u()):n},h.unknown=function(f){return arguments.length?(i=f,h):i},function(f,m){return s=f,a=m,u()}}function K6(){return r5()(Si,Si)}function VMe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function $_(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,s=e.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+e.slice(n+1)]}function Cx(e){return e=$_(Math.abs(e)),e?e[1]:NaN}function WMe(e,t){return function(n,s){for(var a=n.length,i=[],o=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>s&&(l=Math.max(1,s-c)),i.push(n.substring(a-=l,a+l)),!((c+=l+1)>s));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function HMe(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var GMe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ub(e){if(!(t=GMe.exec(e)))throw new Error("invalid format: "+e);var t;return new X6({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]})}ub.prototype=X6.prototype;function X6(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+""}X6.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 YMe(e){e:for(var t=e.length,n=1,s=-1,a;n<t;++n)switch(e[n]){case".":s=a=n;break;case"0":s===0&&(s=n),a=n;break;default:if(!+e[n])break e;s>0&&(s=0);break}return s>0?e.slice(0,s)+e.slice(a+1):e}var IJ;function KMe(e,t){var n=$_(e,t);if(!n)return e+"";var s=n[0],a=n[1],i=a-(IJ=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=s.length;return i===o?s:i>o?s+new Array(i-o+1).join("0"):i>0?s.slice(0,i)+"."+s.slice(i):"0."+new Array(1-i).join("0")+$_(e,Math.max(0,t+i-1))[0]}function J$(e,t){var n=$_(e,t);if(!n)return e+"";var s=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+s:s.length>a+1?s.slice(0,a+1)+"."+s.slice(a+1):s+new Array(a-s.length+2).join("0")}const Q$={"%":(e,t)=>
vendor: 5,608 bytes, line 944
944(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:VMe,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)=>J$(e*100,t),r:J$,s:KMe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function eF(e){return e}var tF=Array.prototype.map,rF=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function XMe(e){var t=e.grouping===void 0||e.thousands===void 0?eF:WMe(tF.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",s=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?eF:HMe(tF.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"â":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function d(h){h=ub(h);var f=h.fill,m=h.align,x=h.sign,p=h.symbol,v=h.zero,g=h.width,y=h.comma,b=h.precision,w=h.trim,_=h.type;_==="n"?(y=!0,_="g"):Q$[_]||(b===void 0&&(b=12),w=!0,_="g"),(v||f==="0"&&m==="=")&&(v=!0,f="0",m="=");var C=p==="$"?n:p==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",E=p==="$"?s:/[%p]/.test(_)?o:"",N=Q$[_],k=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function I(P){var O=C,A=E,R,L,z;if(_==="c")A=N(P)+A,P="";else{P=+P;var U=P<0||1/P<0;if(P=isNaN(P)?c:N(Math.abs(P),b),w&&(P=YMe(P)),U&&+P==0&&x!=="+"&&(U=!1),O=(U?x==="("?x:l:x==="-"||x==="("?"":x)+O,A=(_==="s"?rF[8+IJ/3]:"")+A+(U&&x==="("?")":""),k){for(R=-1,L=P.length;++R<L;)if(z=P.charCodeAt(R),48>z||z>57){A=(z===46?a+P.slice(R+1):P.slice(R))+A,P=P.slice(0,R);break}}}y&&!v&&(P=t(P,1/0));var $=O.length+P.length+A.length,q=$<g?new Array(g-$+1).join(f):"";switch(y&&v&&(P=t(q+P,q.length?g-A.length:1/0),q=""),m){case"<":P=O+P+A+q;break;case"=":P=O+q+P+A;break;case"^":P=q.slice(0,$=q.length>>1)+O+P+A+q.slice($);break;default:P=q+O+P+A;break}return i(P)}return I.toString=function(){return h+""},I}function u(h,f){var m=d((h=ub(h),h.type="f",h)),x=Math.max(-8,Math.min(8,Math.floor(Cx(f)/3)))*3,p=Math.pow(10,-x),v=rF[8+x/3];return function(g){return m(p*g)+v}}return{format:d,formatPrefix:u}}var j1,Z6,RJ;ZMe({thousands:",",grouping:[3],currency:["$",""]});function ZMe(e){return j1=XMe(e),Z6=j1.format,RJ=j1.formatPrefix,j1}function JMe(e){return Math.max(0,-Cx(Math.abs(e)))}function QMe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Cx(t)/3)))*3-Cx(Math.abs(e)))}function eDe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Cx(t)-Cx(e))+1}function MJ(e,t,n,s){var a=f3(e,t,n),i;switch(s=ub(s??",f"),s.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(i=QMe(a,o))&&(s.precision=i),RJ(s,o)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(i=eDe(a,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=i-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(i=JMe(a))&&(s.precision=i-(s.type==="%")*2);break}}return Z6(s)}function nf(e){var t=e.domain;return e.ticks=function(n){var s=t();return u3(s[0],s[s.length-1],n??10)},e.tickFormat=function(n,s){var a=t();return MJ(a[0],a[a.length-1],n??10,s)},e.nice=function(n){n==null&&(n=10);var s=t(),a=0,i=s.length-1,o=s[a],l=s[i],c,d,u=10;for(l<o&&(d=o,o=l,l=d,d=a,a=i,i=d);u-- >0;){if(d=h3(o,l,n),d===c)return s[a]=o,s[i]=l,t(s);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return e},e}function F_(){var e=K6();return e.copy=function(){return Bj(e,F_())},bl.apply(e,arguments),nf(e)}function DJ(e){var t;function n(s){return s==null||isNaN(s=+s)?t:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(e=Array.from(s,D_),n):e.slice()},n.unknown=function(s){return arguments.length?(t=s,n):t},n.copy=function(){return DJ(e).unknown(t)},e=arguments.length?Array.from(e,D_):[0,1],nf(n)}function $J(e,t){e=e.slice();var n=0,s=e.length-1,a=e[n],i=e[s],o;return i<a&&(o=n,n=s,s=o,o=a,a=i,i=o),e[n]=t.floor(a),e[s]=t.ceil(i),e}function nF(e){return Math.log(e)}function sF(e){return Math.exp(e)}function tDe(e){return-Math.log(-e)}function rDe(e){return-Math.exp(-e)}function nDe(e){return isFinite(e)?+("1e"+e):e<0?0:e}function sDe(e){return e===10?nDe:e===Math.E?Math.exp:t=>Math.pow(e,t)}function aDe(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 aF(e){return(t,n)=>-e(-t,n)}function J6(e){const t=e(nF,sF),n=t.domain;let s=10,a,i;function o(){return a=aDe(s),i=sDe(s),n()[0]<0?(a=aF(a),i=aF(i),e(tDe,rDe)):e(nF,sF),t}return t.base=function(l){return arguments.length?(s=+l,o()):s},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let d=c[0],u=c[c.length-1];const h=u<d;h&&([d,u]=[u,d]);let f=a(d),m=a(u),x,p;const v=l==null?10:+l;let g=[];if(!(s%1)&&m-f<v){if(f=Math.floor(f),m=Math.ceil(m),d>0){for(;f<=m;++f)for(x=1;x<s;++x)if(p=f<0?x/i(-f):x*i(f),!(p<d)){if(p>u)break;g.push(p)}}else for(;f<=m;++f)for(x=s-1;x>=1;--x)if(p=f>0?x/i(-f):x*i(f),!(p<d)){if(p>u)break;g.push(p)}g.length*2<v&&(g=u3(d,u,v))}else g=u3(f,m,Math.min(m-f,v)).map(i);return h?g.reverse():g},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=s===10?"s":","),typeof c!="function"&&(!(s%1)&&(c=ub(c)).precision==null&&(c.trim=!0),c=Z6(c)),l===1/0)return c;const d=Math.max(1,s*l/t.ticks().length);return u=>{let h=u/i(Math.round(a(u)));return h*s<s-.5&&(h*=s),h<=d?c(u):""}},t.nice=()=>n($J(n(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function FJ(){const e=J6(r5()).domain([1,10]);return e.copy=()=>Bj(e,FJ()).base(e.base()),bl.apply(e,arguments),e}
944function iF(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function oF(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Q6(e){var t=1,n=e(iF(t),oF(t));return n.constant=function(s){return arguments.length?e(iF(t=+s),oF(t)):t},nf(n)}function BJ(){var e=Q6(r5());return e.copy=function(){return Bj(e,BJ()).constant(e.constant())},bl.apply(e,arguments)}function lF(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function iDe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function oDe(e){return e<0?-e*e:e*e}function eL(e){var t=e(Si,Si),n=1;function s(){return n===1?e(Si,Si):n===.5?e(iDe,oDe):e(lF(n),lF(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,s()):n},nf(t)}function tL(){var e=eL(r5());return e.copy=function(){return Bj(e,tL()).exponent(e.exponent())},bl.apply(e,arguments),e}function lDe(){return tL.apply(null,arguments).exponent(.5)}function cF(e){return Math.sign(e)*e*e}function cDe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function UJ(){var e=K6(),t=[0,1],n=!1,s;function a(i){var o=cDe(e(i));return isNaN(o)?s:n?Math.round(o):o}return a.invert=function(i){return e.invert(cF(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,D_)).map(cF)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(n=!!i,a):n},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(s=i,a):s},a.copy=function(){return UJ(e.domain(),t).round(n).clamp(e.clamp()).unknown(s)},bl.apply(a,arguments),nf(a)}function zJ(){var e=[],t=[],n=[],s;function a(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o<l;)n[o-1]=mMe(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?s:t[$j(n,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:e[0],l<n.length?n[l]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(_h),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(s=o,i):s},i.quantiles=function(){return n.slice()},i.copy=function(){return zJ().domain(e).range(t).unknown(s)},bl.apply(i,arguments)}function qJ(){var e=0,t=1,n=1,s=[.5],a=[0,1],i;function o(c){return c!=null&&c<=c?a[$j(s,c,0,n)]:i}function l(){var c=-1;for(s=new Array(n);++c<n;)s[c]=((c+1)*t-(c-n)*e)/(n+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(n=(a=Array.from(c)).length-1,l()):a.slice()},o.invertExtent=function(c){var d=a.indexOf(c);return d<0?[NaN,NaN]:d<1?[e,s[0]]:d>=n?[s[n-1],t]:[s[d-1],s[d]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return s.slice()},o.copy=function(){return qJ().domain([e,t]).range(a).unknown(i)},bl.apply(nf(o),arguments)}function VJ(){var e=[.5],t=[0,1],n,s=1;function a(i){return i!=null&&i<=i?t[$j(e,i,0,s)]:n}return a.domain=function(i){return arguments.length?(e=Array.from(i),s=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),s=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return VJ().domain(e).range(t).unknown(n)},bl.apply(a,arguments)}const qk=new Date,Vk=new Date;function ba(e,t,n,s){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const o=a(i),l=a.ceil(i);return i-o<l-i?o:l},a.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,l)=>{const c=[];if(i=a.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let d;do c.push(d=new Date(+i)),t(i,l),e(i);while(d<i&&i<o);return c},a.filter=i=>ba(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),n&&(a.count=(i,o)=>(qk.setTime(+i),Vk.setTime(+o),e(qk),e(Vk),Math.floor(n(qk,Vk))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(s?o=>s(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const B_=ba(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);B_.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ba(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):B_);B_.range;const Bd=1e3,ll=Bd*60,Ud=ll*60,nu=Ud*24,rL=nu*7,dF=nu*30,Wk=nu*365,Zf=ba(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Bd)},(e,t)=>(t-e)/Bd,e=>e.getUTCSeconds());Zf.range;const nL=ba(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Bd)},(e,t)=>{e.setTime(+e+t*ll)},(e,t)=>(t-e)/ll,e=>e.getMinutes());nL.range;const sL=ba(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*ll)},(e,t)=>(t-e)/ll,e=>e.getUTCMinutes());sL.range;const aL=ba(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Bd-e.getMinutes()*ll)},(e,t)=>{e.setTime(+e+t*Ud)},(e,t)=>(t-e)/Ud,e=>e.getHours());aL.range;const iL=ba(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Ud)},(e,t)=>(t-e)/Ud,e=>e.getUTCHours());iL.range;const Uj=ba(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*ll)/nu,e=>e.getDate()-1);Uj.range;const n5=ba(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/nu,e=>e.getUTCDate()-1);n5.range;const WJ=ba(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/nu,e=>Math.floor(e/nu));WJ.range;function np(e){return ba(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*ll)/rL)}const s5=np(0),U_=np(1),dDe=np(2),uDe=np(3),Ax=np(4),hDe=np(5),fDe=np(6);s5.range;U_.range;dDe.range;uDe.range;Ax.range;hDe.range;fDe.range;function sp(e){return ba(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/rL)}const a5=sp(0),z_=sp(1),mDe=sp(2),pDe=sp(3),Px=sp(4),gDe=sp(5),xDe=sp(6);a5.range;z_.range;mDe.range;pDe.range;Px.range;gDe.range;xDe.range;const oL=ba(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());oL.range;const lL=ba(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());lL.range;const su=ba(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());su.every=e=>
vendor: 9,398 bytes, line 944
944!isFinite(e=Math.floor(e))||!(e>0)?null:ba(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});su.range;const au=ba(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());au.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ba(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});au.range;function HJ(e,t,n,s,a,i){const o=[[Zf,1,Bd],[Zf,5,5*Bd],[Zf,15,15*Bd],[Zf,30,30*Bd],[i,1,ll],[i,5,5*ll],[i,15,15*ll],[i,30,30*ll],[a,1,Ud],[a,3,3*Ud],[a,6,6*Ud],[a,12,12*Ud],[s,1,nu],[s,2,2*nu],[n,1,rL],[t,1,dF],[t,3,3*dF],[e,1,Wk]];function l(d,u,h){const f=u<d;f&&([d,u]=[u,d]);const m=h&&typeof h.range=="function"?h:c(d,u,h),x=m?m.range(d,+u+1):[];return f?x.reverse():x}function c(d,u,h){const f=Math.abs(u-d)/h,m=V6(([,,v])=>v).right(o,f);if(m===o.length)return e.every(f3(d/Wk,u/Wk,h));if(m===0)return B_.every(Math.max(f3(d,u,h),1));const[x,p]=o[f/o[m-1][2]<o[m][2]/f?m-1:m];return x.every(p)}return[l,c]}const[vDe,yDe]=HJ(au,lL,a5,WJ,iL,sL),[bDe,jDe]=HJ(su,oL,s5,Uj,aL,nL);function Hk(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 Gk(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 wy(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function wDe(e){var t=e.dateTime,n=e.date,s=e.time,a=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,d=Ny(a),u=_y(a),h=Ny(i),f=_y(i),m=Ny(o),x=_y(o),p=Ny(l),v=_y(l),g=Ny(c),y=_y(c),b={a:U,A:$,b:q,B:ne,c:null,d:gF,e:gF,f:WDe,g:t8e,G:n8e,H:zDe,I:qDe,j:VDe,L:GJ,m:HDe,M:GDe,p:se,q:F,Q:yF,s:bF,S:YDe,u:KDe,U:XDe,V:ZDe,w:JDe,W:QDe,x:null,X:null,y:e8e,Y:r8e,Z:s8e,"%":vF},w={a:V,A:Z,b:de,B:ve,c:null,d:xF,e:xF,f:l8e,g:v8e,G:b8e,H:a8e,I:i8e,j:o8e,L:KJ,m:c8e,M:d8e,p:pe,q:_e,Q:yF,s:bF,S:u8e,u:h8e,U:f8e,V:m8e,w:p8e,W:g8e,x:null,X:null,y:x8e,Y:y8e,Z:j8e,"%":vF},_={a:I,A:P,b:O,B:A,c:R,d:mF,e:mF,f:$De,g:fF,G:hF,H:pF,I:pF,j:IDe,L:DDe,m:LDe,M:RDe,p:k,q:ODe,Q:BDe,s:UDe,S:MDe,u:CDe,U:ADe,V:PDe,w:kDe,W:EDe,x:L,X:z,y:fF,Y:hF,Z:TDe,"%":FDe};b.x=C(n,b),b.X=C(s,b),b.c=C(t,b),w.x=C(n,w),w.X=C(s,w),w.c=C(t,w);function C(xe,oe){return function(we){var ce=[],De=-1,Ue=0,re=xe.length,et,kt,St;for(we instanceof Date||(we=new Date(+we));++De<re;)xe.charCodeAt(De)===37&&(ce.push(xe.slice(Ue,De)),(kt=uF[et=xe.charAt(++De)])!=null?et=xe.charAt(++De):kt=et==="e"?" ":"0",(St=oe[et])&&(et=St(we,kt)),ce.push(et),Ue=De+1);return ce.push(xe.slice(Ue,De)),ce.join("")}}function E(xe,oe){return function(we){var ce=wy(1900,void 0,1),De=N(ce,xe,we+="",0),Ue,re;if(De!=we.length)return null;if("Q"in ce)return new Date(ce.Q);if("s"in ce)return new Date(ce.s*1e3+("L"in ce?ce.L:0));if(oe&&!("Z"in ce)&&(ce.Z=0),"p"in ce&&(ce.H=ce.H%12+ce.p*12),ce.m===void 0&&(ce.m="q"in ce?ce.q:0),"V"in ce){if(ce.V<1||ce.V>53)return null;"w"in ce||(ce.w=1),"Z"in ce?(Ue=Gk(wy(ce.y,0,1)),re=Ue.getUTCDay(),Ue=re>4||re===0?z_.ceil(Ue):z_(Ue),Ue=n5.offset(Ue,(ce.V-1)*7),ce.y=Ue.getUTCFullYear(),ce.m=Ue.getUTCMonth(),ce.d=Ue.getUTCDate()+(ce.w+6)%7):(Ue=Hk(wy(ce.y,0,1)),re=Ue.getDay(),Ue=re>4||re===0?U_.ceil(Ue):U_(Ue),Ue=Uj.offset(Ue,(ce.V-1)*7),ce.y=Ue.getFullYear(),ce.m=Ue.getMonth(),ce.d=Ue.getDate()+(ce.w+6)%7)}else("W"in ce||"U"in ce)&&("w"in ce||(ce.w="u"in ce?ce.u%7:"W"in ce?1:0),re="Z"in ce?Gk(wy(ce.y,0,1)).getUTCDay():Hk(wy(ce.y,0,1)).getDay(),ce.m=0,ce.d="W"in ce?(ce.w+6)%7+ce.W*7-(re+5)%7:ce.w+ce.U*7-(re+6)%7);return"Z"in ce?(ce.H+=ce.Z/100|0,ce.M+=ce.Z%100,Gk(ce)):Hk(ce)}}function N(xe,oe,we,ce){for(var De=0,Ue=oe.length,re=we.length,et,kt;De<Ue;){if(ce>=re)return-1;if(et=oe.charCodeAt(De++),et===37){if(et=oe.charAt(De++),kt=_[et in uF?oe.charAt(De++):et],!kt||(ce=kt(xe,we,ce))<0)return-1}else if(et!=we.charCodeAt(ce++))return-1}return ce}function k(xe,oe,we){var ce=d.exec(oe.slice(we));return ce?(xe.p=u.get(ce[0].toLowerCase()),we+ce[0].length):-1}function I(xe,oe,we){var ce=m.exec(oe.slice(we));return ce?(xe.w=x.get(ce[0].toLowerCase()),we+ce[0].length):-1}function P(xe,oe,we){var ce=h.exec(oe.slice(we));return ce?(xe.w=f.get(ce[0].toLowerCase()),we+ce[0].length):-1}function O(xe,oe,we){var ce=g.exec(oe.slice(we));return ce?(xe.m=y.get(ce[0].toLowerCase()),we+ce[0].length):-1}function A(xe,oe,we){var ce=p.exec(oe.slice(we));return ce?(xe.m=v.get(ce[0].toLowerCase()),we+ce[0].length):-1}function R(xe,oe,we){return N(xe,t,oe,we)}function L(xe,oe,we){return N(xe,n,oe,we)}function z(xe,oe,we){return N(xe,s,oe,we)}function U(xe){return o[xe.getDay()]}function $(xe){return i[xe.getDay()]}function q(xe){return c[xe.getMonth()]}function ne(xe){return l[xe.getMonth()]}function se(xe){return a[+(xe.getHours()>=12)]}function F(xe){return 1+~~(xe.getMonth()/3)}function V(xe){return o[xe.getUTCDay()]}function Z(xe){return i[xe.getUTCDay()]}function de(xe){return c[xe.getUTCMonth()]}function ve(xe){return l[xe.getUTCMonth()]}function pe(xe){return a[+(xe.getUTCHours()>=12)]}function _e(xe){return 1+~~(xe.getUTCMonth()/3)}return{format:function(xe){var oe=C(xe+="",b);return oe.toString=function(){return xe},oe},parse:function(xe){var oe=E(xe+="",!1);return oe.toString=function(){return xe},oe},utcFormat:function(xe){var oe=C(xe+="",w);return oe.toString=function(){return xe},oe},utcParse:function(xe){var oe=E(xe+="",!0);return oe.toString=function(){return xe},oe}}}var uF={"-":"",_:" ",0:"0"},Pa=/^\s*\d+/,NDe=/^%/,_De=/[\\^$*+?|[\]().{}]/g;function yn(e,t,n){var s=e<0?"-":"",a=(s?-e:e)+"",i=a.length;return s+(i<n?new Array(n-i+1).join(t)+a:a)}function SDe(e){return e.replace(_De,"\\$&")}function Ny(e){return new RegExp("^(?:"+e.map(SDe).join("|")+")","i")}function _y(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function kDe(e,t,n){var s=Pa.exec(t.slice(n,n+1));return s?(e.w=+s[0],n+s[0].length):-1}function CDe(e,t,n){var s=Pa.exec(t.slice(n,n+1));return s?(e.u=+s[0],n+s[0].length):-1}function ADe(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.U=+s[0],n+s[0].length):-1}function PDe(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.V=+s[0],n+s[0].length):-1}function EDe(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.W=+s[0],n+s[0].length):-1}function hF(e,t,n){var s=Pa.exec(t.slice(n,n+4));return s?(e.y=+s[0],n+s[0].length):-1}function fF(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function TDe(e,t,n){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return s?(e.Z=s[1]?0:-(s[2]+(s[3]||"00")),n+s[0].length):-1}function ODe(e,t,n){var s=Pa.exec(t.slice(n,n+1));return s?(e.q=s[0]*3-3,n+s[0].length):-1}function LDe(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.m=s[0]-1,n+s[0].length):-1}function mF(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.d=+s[0],n+s[0].length):-1}function IDe(e,t,n){var s=Pa.exec(t.slice(n,n+3));return s?(e.m=0,e.d=+s[0],n+s[0].length):-1}function pF(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.H=+s[0],n+s[0].length):-1}function RDe(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.M=+s[0],n+s[0].length):-1}function MDe(e,t,n){var s=Pa.exec(t.slice(n,n+2));return s?(e.S=+s[0],n+s[0].length):-1}function DDe(e,t,n){var s=Pa.exec(t.slice(n,n+3));return s?(e.L=+s[0],n+s[0].length):-1}function $De(e,t,n){var s=Pa.exec(t.slice(n,n+6));return s?(e.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function FDe(e,t,n){var s=NDe.exec(t.slice(n,n+1));return s?n+s[0].length:-1}function BDe(e,t,n){var s=Pa.exec(t.slice(n));return s?(e.Q=+s[0],n+s[0].length):-1}function UDe(e,t,n){var s=Pa.exec(t.slice(n));return s?(e.s=+s[0],n+s[0].length):-1}function gF(e,t){return yn(e.getDate(),t,2)}function zDe(e,t){return yn(e.getHours(),t,2)}function qDe(e,t){return yn(e.getHours()%12||12,t,2)}function VDe(e,t){return yn(1+Uj.count(su(e),e),t,3)}function GJ(e,t){return yn(e.getMilliseconds(),t,3)}function WDe(e,t){return GJ(e,t)+"000"}function HDe(e,t){return yn(e.getMonth()+1,t,2)}function GDe(e,t){return yn(e.getMinutes(),t,2)}function YDe(e,t){return yn(e.getSeconds(),t,2)}function KDe(e){var t=e.getDay();return t===0?7:t}function XDe(e,t){return yn(s5.count(su(e)-1,e),t,2)}function YJ(e){var t=e.getDay();return t>=4||t===0?Ax(e):Ax.ceil(e)}function ZDe(e,t){return e=YJ(e),yn(Ax.count(su(e),e)+(su(e).getDay()===4),t,2)}function JDe(e){return e.getDay()}function QDe(e,t){return yn(U_.count(su(e)-1,e),t,2)}function e8e(e,t){return yn(e.getFullYear()%100,t,2)}function t8e(e,t){return e=YJ(e),yn(e.getFullYear()%100,t,2)}function r8e(e,t){return yn(e.getFullYear()%1e4,t,4)}function n8e(e,t){var n=e.getDay();return e=n>=4||n===0?Ax(e):Ax.ceil(e),yn(e.getFullYear()%1e4,t,4)}function s8e(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+yn(t/60|0,"0",2)+yn(t%60,"0",2)}function xF(e,t){return yn(e.getUTCDate(),t,2)}function a8e(e,t){return yn(e.getUTCHours(),t,2)}function i8e(e,t){return yn(e.getUTCHours()%12||12,t,2)}function o8e(e,t){return yn(1+n5.count(au(e),e),t,3)}function KJ(e,t){return yn(e.getUTCMilliseconds(),t,3)}function l8e(e,t){return KJ(e,t)+"000"}function c8e(e,t){return yn(e.getUTCMonth()+1,t,2)}function d8e(e,t){return yn(e.getUTCMinutes(),t,2)}function u8e(e,t){return yn(e.getUTCSeconds(),t,2)}
944function h8e(e){var t=e.getUTCDay();return t===0?7:t}function f8e(e,t){return yn(a5.count(au(e)-1,e),t,2)}function XJ(e){var t=e.getUTCDay();return t>=4||t===0?Px(e):Px.ceil(e)}function m8e(e,t){return e=XJ(e),yn(Px.count(au(e),e)+(au(e).getUTCDay()===4),t,2)}function p8e(e){return e.getUTCDay()}function g8e(e,t){return yn(z_.count(au(e)-1,e),t,2)}function x8e(e,t){return yn(e.getUTCFullYear()%100,t,2)}function v8e(e,t){return e=XJ(e),yn(e.getUTCFullYear()%100,t,2)}function y8e(e,t){return yn(e.getUTCFullYear()%1e4,t,4)}function b8e(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Px(e):Px.ceil(e),yn(e.getUTCFullYear()%1e4,t,4)}function j8e(){return"+0000"}function vF(){return"%"}function yF(e){return+e}function bF(e){return Math.floor(+e/1e3)}var zp,ZJ,JJ;w8e({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 w8e(e){return zp=wDe(e),ZJ=zp.format,zp.parse,JJ=zp.utcFormat,zp.utcParse,zp}function N8e(e){return new Date(e)}function _8e(e){return e instanceof Date?+e:+new Date(+e)}function cL(e,t,n,s,a,i,o,l,c,d){var u=K6(),h=u.invert,f=u.domain,m=d(".%L"),x=d(":%S"),p=d("%I:%M"),v=d("%I %p"),g=d("%a %d"),y=d("%b %d"),b=d("%B"),w=d("%Y");function _(C){return(c(C)<C?m:l(C)<C?x:o(C)<C?p:i(C)<C?v:s(C)<C?a(C)<C?g:y:n(C)<C?b:w)(C)}return u.invert=function(C){return new Date(h(C))},u.domain=function(C){return arguments.length?f(Array.from(C,_8e)):f().map(N8e)},u.ticks=function(C){var E=f();return e(E[0],E[E.length-1],C??10)},u.tickFormat=function(C,E){return E==null?_:d(E)},u.nice=function(C){var E=f();return(!C||typeof C.range!="function")&&(C=t(E[0],E[E.length-1],C??10)),C?f($J(E,C)):u},u.copy=function(){return Bj(u,cL(e,t,n,s,a,i,o,l,c,d))},u}function S8e(){return bl.apply(cL(bDe,jDe,su,oL,s5,Uj,aL,nL,Zf,ZJ).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function k8e(){return bl.apply(cL(vDe,yDe,au,lL,a5,n5,iL,sL,Zf,JJ).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function i5(){var e=0,t=1,n,s,a,i,o=Si,l=!1,c;function d(h){return h==null||isNaN(h=+h)?c:o(a===0?.5:(h=(i(h)-n)*a,l?Math.max(0,Math.min(1,h)):h))}d.domain=function(h){return arguments.length?([e,t]=h,n=i(e=+e),s=i(t=+t),a=n===s?0:1/(s-n),d):[e,t]},d.clamp=function(h){return arguments.length?(l=!!h,d):l},d.interpolator=function(h){return arguments.length?(o=h,d):o};function u(h){return function(f){var m,x;return arguments.length?([m,x]=f,o=h(m,x),d):[o(0),o(1)]}}return d.range=u(_v),d.rangeRound=u(Y6),d.unknown=function(h){return arguments.length?(c=h,d):c},function(h){return i=h,n=h(e),s=h(t),a=n===s?0:1/(s-n),d}}function sf(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function QJ(){var e=nf(i5()(Si));return e.copy=function(){return sf(e,QJ())},hu.apply(e,arguments)}function eQ(){var e=J6(i5()).domain([1,10]);return e.copy=function(){return sf(e,eQ()).base(e.base())},hu.apply(e,arguments)}function tQ(){var e=Q6(i5());return e.copy=function(){return sf(e,tQ()).constant(e.constant())},hu.apply(e,arguments)}function dL(){var e=eL(i5());return e.copy=function(){return sf(e,dL()).exponent(e.exponent())},hu.apply(e,arguments)}function C8e(){return dL.apply(null,arguments).exponent(.5)}function rQ(){var e=[],t=Si;function n(s){if(s!=null&&!isNaN(s=+s))return t(($j(e,s,1)-1)/(e.length-1))}return n.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(_h),n},n.interpolator=function(s){return arguments.length?(t=s,n):t},n.range=function(){return e.map((s,a)=>t(a/(e.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(a,i)=>fMe(e,i/s))},n.copy=function(){return rQ(t).domain(e)},hu.apply(n,arguments)}function o5(){var e=0,t=.5,n=1,s=1,a,i,o,l,c,d=Si,u,h=!1,f;function m(p){return isNaN(p=+p)?f:(p=.5+((p=+u(p))-i)*(s*p<s*i?l:c),d(h?Math.max(0,Math.min(1,p)):p))}m.domain=function(p){return arguments.length?([e,t,n]=p,a=u(e=+e),i=u(t=+t),o=u(n=+n),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),s=i<a?-1:1,m):[e,t,n]},m.clamp=function(p){return arguments.length?(h=!!p,m):h},m.interpolator=function(p){return arguments.length?(d=p,m):d};function x(p){return function(v){var g,y,b;
vendor: 67,467 bytes, lines 944-971
944return arguments.length?([g,y,b]=v,d=FMe(p,[g,y,b]),m):[d(0),d(.5),d(1)]}}return m.range=x(_v),m.rangeRound=x(Y6),m.unknown=function(p){return arguments.length?(f=p,m):f},function(p){return u=p,a=p(e),i=p(t),o=p(n),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),s=i<a?-1:1,m}}function nQ(){var e=nf(o5()(Si));return e.copy=function(){return sf(e,nQ())},hu.apply(e,arguments)}function sQ(){var e=J6(o5()).domain([.1,1,10]);return e.copy=function(){return sf(e,sQ()).base(e.base())},hu.apply(e,arguments)}function aQ(){var e=Q6(o5());return e.copy=function(){return sf(e,aQ()).constant(e.constant())},hu.apply(e,arguments)}function uL(){var e=eL(o5());return e.copy=function(){return sf(e,uL()).exponent(e.exponent())},hu.apply(e,arguments)}function A8e(){return uL.apply(null,arguments).exponent(.5)}const jF=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:ob,scaleDiverging:nQ,scaleDivergingLog:sQ,scaleDivergingPow:uL,scaleDivergingSqrt:A8e,scaleDivergingSymlog:aQ,scaleIdentity:DJ,scaleImplicit:m3,scaleLinear:F_,scaleLog:FJ,scaleOrdinal:W6,scalePoint:d0,scalePow:tL,scaleQuantile:zJ,scaleQuantize:qJ,scaleRadial:UJ,scaleSequential:QJ,scaleSequentialLog:eQ,scaleSequentialPow:dL,scaleSequentialQuantile:rQ,scaleSequentialSqrt:C8e,scaleSequentialSymlog:tQ,scaleSqrt:lDe,scaleSymlog:BJ,scaleThreshold:VJ,scaleTime:S8e,scaleUtc:k8e,tickFormat:MJ},Symbol.toStringTag,{value:"Module"}));var P8e=pv;function E8e(e,t,n){for(var s=-1,a=e.length;++s<a;){var i=e[s],o=t(i);if(o!=null&&(l===void 0?o===o&&!P8e(o):n(o,l)))var l=o,c=i}return c}var l5=E8e;function T8e(e,t){return e>t}var iQ=T8e,O8e=l5,L8e=iQ,I8e=Nv;function R8e(e){return e&&e.length?O8e(e,I8e,L8e):void 0}var M8e=R8e;const c5=_n(M8e);function D8e(e,t){return e<t}var oQ=D8e,$8e=l5,F8e=oQ,B8e=Nv;function U8e(e){return e&&e.length?$8e(e,B8e,F8e):void 0}var z8e=U8e;const d5=_n(z8e);var q8e=S6,V8e=od,W8e=pJ,H8e=lo;function G8e(e,t){var n=H8e(e)?q8e:W8e;return n(e,V8e(t))}var Y8e=G8e,K8e=fJ,X8e=Y8e;function Z8e(e,t){return K8e(X8e(e,t),1)}var J8e=Z8e;const Q8e=_n(J8e);var e$e=B6;function t$e(e,t){return e$e(e,t)}var r$e=t$e;const zj=_n(r$e);var Sv=1e9,n$e={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},fL,gs=!0,pl="[DecimalError] ",xm=pl+"Invalid argument: ",hL=pl+"Exponent out of range: ",kv=Math.floor,$f=Math.pow,s$e=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Co,Na=1e7,os=7,lQ=9007199254740991,q_=kv(lQ/os),Ft={};Ft.absoluteValue=Ft.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};Ft.comparedTo=Ft.cmp=function(e){var t,n,s,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(s=i.d.length,a=e.d.length,t=0,n=s<a?s:a;t<n;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return s===a?0:s>a^i.s<0?1:-1};Ft.decimalPlaces=Ft.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*os;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ft.dividedBy=Ft.div=function(e){return Gd(this,new this.constructor(e))};Ft.dividedToIntegerBy=Ft.idiv=function(e){var t=this,n=t.constructor;return Un(Gd(t,new n(e),0,1),n.precision)};Ft.equals=Ft.eq=function(e){return!this.cmp(e)};Ft.exponent=function(){return Qs(this)};Ft.greaterThan=Ft.gt=function(e){return this.cmp(e)>0};Ft.greaterThanOrEqualTo=Ft.gte=function(e){return this.cmp(e)>=0};Ft.isInteger=Ft.isint=function(){return this.e>this.d.length-2};Ft.isNegative=Ft.isneg=function(){return this.s<0};Ft.isPositive=Ft.ispos=function(){return this.s>0};Ft.isZero=function(){return this.s===0};Ft.lessThan=Ft.lt=function(e){return this.cmp(e)<0};Ft.lessThanOrEqualTo=Ft.lte=function(e){return this.cmp(e)<1};Ft.logarithm=Ft.log=function(e){var t,n=this,s=n.constructor,a=s.precision,i=a+5;if(e===void 0)e=new s(10);else if(e=new s(e),e.s<1||e.eq(Co))throw Error(pl+"NaN");if(n.s<1)throw Error(pl+(n.s?"NaN":"-Infinity"));return n.eq(Co)?new s(0):(gs=!1,t=Gd(hb(n,i),hb(e,i),i),gs=!0,Un(t,a))};Ft.minus=Ft.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?uQ(t,e):cQ(t,(e.s=-e.s,e))};Ft.modulo=Ft.mod=function(e){var t,n=this,s=n.constructor,a=s.precision;if(e=new s(e),!e.s)throw Error(pl+"NaN");return n.s?(gs=!1,t=Gd(n,e,0,1).times(e),gs=!0,n.minus(t)):Un(new s(n),a)};Ft.naturalExponential=Ft.exp=function(){return dQ(this)};Ft.naturalLogarithm=Ft.ln=function(){return hb(this)};Ft.negated=Ft.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ft.plus=Ft.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?cQ(t,e):uQ(t,(e.s=-e.s,e))};Ft.precision=Ft.sd=function(e){var t,n,s,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(xm+e);if(t=Qs(a)+1,s=a.d.length-1,n=s*os+1,s=a.d[s],s){for(;s%10==0;s/=10)n--;for(s=a.d[0];s>=10;s/=10)n++}return e&&t>n?t:n};Ft.squareRoot=Ft.sqrt=function(){var e,t,n,s,a,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(pl+"NaN")}for(e=Qs(l),gs=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=Fc(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=kv((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),s=new c(t)):s=new c(a.toString()),n=c.precision,a=o=n+3;;)if(i=s,s=i.plus(Gd(l,i,o+2)).times(.5),Fc(i.d).slice(0,o)===(t=Fc(s.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(Un(i,n+1,0),i.times(i).eq(l)){s=i;break}}else if(t!="9999")break;o+=4}return gs=!0,Un(s,n)};Ft.times=Ft.mul=function(e){var t,n,s,a,i,o,l,c,d,u=this,h=u.constructor,f=u.d,m=(e=new h(e)).d;if(!u.s||!e.s)return new h(0);for(e.s*=u.s,n=u.e+e.e,c=f.length,d=m.length,c<d&&(i=f,f=m,m=i,o=c,c=d,d=o),i=[],o=c+d,s=o;s--;)i.push(0);for(s=d;--s>=0;){for(t=0,a=c+s;a>s;)l=i[a]+m[s]*f[a-s-1]+t,i[a--]=l%Na|0,t=l/Na|0;i[a]=(i[a]+t)%Na|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,gs?Un(e,h.precision):e};Ft.toDecimalPlaces=Ft.todp=function(e,t){var n=this,s=n.constructor;return n=new s(n),e===void 0?n:(nd(e,0,Sv),t===void 0?t=s.rounding:nd(t,0,8),Un(n,e+Qs(n)+1,t))};Ft.toExponential=function(e,t){var n,s=this,a=s.constructor;return e===void 0?n=$m(s,!0):(nd(e,0,Sv),t===void 0?t=a.rounding:nd(t,0,8),s=Un(new a(s),e+1,t),n=$m(s,!0,e+1)),n};Ft.toFixed=function(e,t){var n,s,a=this,i=a.constructor;return e===void 0?$m(a):(nd(e,0,Sv),t===void 0?t=i.rounding:nd(t,0,8),s=Un(new i(a),e+Qs(a)+1,t),n=$m(s.abs(),!1,e+Qs(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};Ft.toInteger=Ft.toint=function(){var e=this,t=e.constructor;return Un(new t(e),Qs(e)+1,t.rounding)};Ft.toNumber=function(){return+this};Ft.toPower=Ft.pow=function(e){var t,n,s,a,i,o,l=this,c=l.constructor,d=12,u=+(e=new c(e));if(!e.s)return new c(Co);if(l=new c(l),!l.s){if(e.s<1)throw Error(pl+"Infinity");return l}if(l.eq(Co))return l;if(s=c.precision,e.eq(Co))return Un(l,s);if(t=e.e,n=e.d.length-1,o=t>=n,i=l.s,o){if((n=u<0?-u:u)<=lQ){for(a=new c(Co),t=Math.ceil(s/os+4),gs=!1;n%2&&(a=a.times(l),NF(a.d,t)),n=kv(n/2),n!==0;)l=l.times(l),NF(l.d,t);return gs=!0,e.s<0?new c(Co).div(a):Un(a,s)}}else if(i<0)throw Error(pl+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,gs=!1,a=e.times(hb(l,s+d)),gs=!0,a=dQ(a),a.s=i,a};Ft.toPrecision=function(e,t){var n,s,a=this,i=a.constructor;return e===void 0?(n=Qs(a),s=$m(a,n<=i.toExpNeg||n>=i.toExpPos)):(nd(e,1,Sv),t===void 0?t=i.rounding:nd(t,0,8),a=Un(new i(a),e,t),n=Qs(a),s=$m(a,e<=n||n<=i.toExpNeg,e)),s};Ft.toSignificantDigits=Ft.tosd=function(e,t){var n=this,s=n.constructor;return e===void 0?(e=s.precision,t=s.rounding):(nd(e,1,Sv),t===void 0?t=s.rounding:nd(t,0,8)),Un(new s(n),e,t)};Ft.toString=Ft.valueOf=Ft.val=Ft.toJSON=Ft[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Qs(e),n=e.constructor;return $m(e,t<=n.toExpNeg||t>=n.toExpPos)};function cQ(e,t){var n,s,a,i,o,l,c,d,u=e.constructor,h=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),gs?Un(t,h):t;if(c=e.d,d=t.d,o=e.e,a=t.e,c=c.slice(),i=o-a,i){for(i<0?(s=c,i=-i,l=d.length):(s=d,a=o,l=c.length),o=Math.ceil(h/os),l=o>l?o+1:l+1,i>l&&(i=l,s.length=1),s.reverse();i--;)s.push(0);s.reverse()}for(l=c.length,i=d.length,l-i<0&&(i=l,s=d,d=c,c=s),n=0;i;)n=(c[--i]=c[i]+d[i]+n)/Na|0,c[i]%=Na;for(n&&(c.unshift(n),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,gs?Un(t,h):t}function nd(e,t,n){if(e!==~~e||e<t||e>n)throw Error(xm+e)}function Fc(e){var t,n,s,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)s=e[t]+"",n=os-s.length,n&&(i+=qu(n)),i+=s;o=e[t],s=o+"",n=os-s.length,n&&(i+=qu(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var Gd=function(){function e(s,a){var i,o=0,l=s.length;for(s=s.slice();l--;)i=s[l]*a+o,s[l]=i%Na|0,o=i/Na|0;return o&&s.unshift(o),s}function t(s,a,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(s[l]!=a[l]){c=s[l]>a[l]?1:-1;break}return c}function n(s,a,i){for(var o=0;i--;)s[i]-=o,o=s[i]<a[i]?1:0,s[i]=o*Na+s[i]-a[i];for(;!s[0]&&s.length>1;)s.shift()}return function(s,a,i,o){var l,c,d,u,h,f,m,x,p,v,g,y,b,w,_,C,E,N,k=s.constructor,I=s.s==a.s?1:-1,P=s.d,O=a.d;if(!s.s)return new k(s);if(!a.s)throw Error(pl+"Division by zero");for(c=s.e-a.e,E=O.length,_=P.length,m=new k(I),x=m.d=[],d=0;O[d]==(P[d]||0);)++d;if(O[d]>(P[d]||0)&&--c,i==null?y=i=k.precision:o?y=i+(Qs(s)-Qs(a))+1:y=i,y<0)return new k(0);if(y=y/os+2|0,d=0,E==1)for(u=0,O=O[0],y++;(d<_||u)&&y--;d++)b=u*Na+(P[d]||0),x[d]=b/O|0,u=b%O|0;else{for(u=Na/(O[0]+1)|0,u>1&&(O=e(O,u),P=e(P,u),E=O.length,_=P.length),w=E,p=P.slice(0,E),v=p.length;v<E;)p[v++]=0;N=O.slice(),N.unshift(0),C=O[0],O[1]>=Na/2&&++C;do u=0,l=t(O,p,E,v),l<0?(g=p[0],E!=v&&(g=g*Na+(p[1]||0)),u=g/C|0,u>1?(u>=Na&&(u=Na-1),h=e(O,u),f=h.length,v=p.length,l=t(h,p,f,v),l==1&&(u--,n(h,E<f?N:O,f))):(u==0&&(l=u=1),h=O.slice()),f=h.length,f<v&&h.unshift(0),n(p,h,v),l==-1&&(v=p.length,l=t(O,p,E,v),l<1&&(u++,n(p,E<v?N:O,v))),v=p.length):l===0&&(u++,p=[0]),x[d++]=u,l&&p[0]?p[v++]=P[w]||0:(p=[P[w]],v=1);while((w++<_||p[0]!==void 0)&&y--)}return x[0]||x.shift(),m.e=c,Un(m,o?i+Qs(m)+1:i)}}();function dQ(e,t){var n,s,a,i,o,l,c=0,d=0,u=e.constructor,h=u.precision;if(Qs(e)>16)throw Error(hL+Qs(e));if(!e.s)return new u(Co);for(t==null?(gs=!1,l=h):l=t,o=new u(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(s=Math.log($f(2,d))/Math.LN10*2+5|0,l+=s,n=a=i=new u(Co),u.precision=l;;){if(a=Un(a.times(e),l),n=n.times(++c),o=i.plus(Gd(a,n,l)),Fc(o.d).slice(0,l)===Fc(i.d).slice(0,l)){for(;d--;)i=Un(i.times(i),l);return u.precision=h,t==null?(gs=!0,Un(i,h)):i}i=o}}function Qs(e){for(var t=e.e*os,n=e.d[0];n>=10;n/=10)t++;return t}function Yk(e,t,n){if(t>e.LN10.sd())throw gs=!0,n&&(e.precision=n),Error(pl+"LN10 precision limit exceeded");return Un(new e(e.LN10),t)}function qu(e){for(var t="";e--;)t+="0";return t}function hb(e,t){var n,s,a,i,o,l,c,d,u,h=1,f=10,m=e,x=m.d,p=m.constructor,v=p.precision;if(m.s<1)throw Error(pl+(m.s?"NaN":"-Infinity"));if(m.eq(Co))return new p(0);if(t==null?(gs=!1,d=v):d=t,m.eq(10))return t==null&&(gs=!0),Yk(p,d);if(d+=f,p.precision=d,n=Fc(x),s=n.charAt(0),i=Qs(m),Math.abs(i)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)m=m.times(e),n=Fc(m.d),s=n.charAt(0),h++;i=Qs(m),s>1?(m=new p("0."+n),i++):m=new p(s+"."+n.slice(1))}else return c=Yk(p,d+2,v).times(i+""),m=hb(new p(s+"."+n.slice(1)),d-f).plus(c),p.precision=v,t==null?(gs=!0,Un(m,v)):m;for(l=o=m=Gd(m.minus(Co),m.plus(Co),d),u=Un(m.times(m),d),a=3;;){if(o=Un(o.times(u),d),c=l.plus(Gd(o,new p(a),d)),Fc(c.d).slice(0,d)===Fc(l.d).slice(0,d))return l=l.times(2),i!==0&&(l=l.plus(Yk(p,d+2,v).times(i+""))),l=Gd(l,new p(h),d),p.precision=v,t==null?(gs=!0,Un(l,v)):l;l=c,a+=2}}function wF(e,t){var n,s,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(n<0&&(n=s),n+=+t.slice(s+1),t=t.substring(0,s)):n<0&&(n=t.length),s=0;t.charCodeAt(s)===48;)++s;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(s,a),t){if(a-=s,n=n-s-1,e.e=kv(n/os),e.d=[],s=(n+1)%os,n<0&&(s+=os),s<a){for(s&&e.d.push(+t.slice(0,s)),a-=os;s<a;)e.d.push(+t.slice(s,s+=os));t=t.slice(s),s=os-t.length}else s-=a;for(;s--;)t+="0";if(e.d.push(+t),gs&&(e.e>q_||e.e<-q_))throw Error(hL+n)}else e.s=0,e.e=0,e.d=[0];return e}function Un(e,t,n){var s,a,i,o,l,c,d,u,h=e.d;for(o=1,i=h[0];i>=10;i/=10)o++;if(s=t-o,s<0)s+=os,a=t,d=h[u=0];else{if(u=Math.ceil((s+1)/os),i=h.length,u>=i)return e;for(d=i=h[u],o=1;i>=10;i/=10)o++;s%=os,a=s-os+o}if(n!==void 0&&(i=$f(10,o-a-1),l=d/i%10|0,c=t<0||h[u+1]!==void 0||d%i,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(s>0?a>0?d/$f(10,o-a):0:h[u-1])%10&1||n==(e.s<0?8:7))),t<1||!h[0])return c?(i=Qs(e),h.length=1,t=t-i-1,h[0]=$f(10,(os-t%os)%os),e.e=kv(-t/os)||0):(h.length=1,h[0]=e.e=e.s=0),e;if(s==0?(h.length=u,i=1,u--):(h.length=u+1,i=$f(10,os-s),h[u]=a>0?(d/$f(10,o-a)%$f(10,a)|0)*i:0),c)for(;;)if(u==0){(h[0]+=i)==Na&&(h[0]=1,++e.e);break}else{if(h[u]+=i,h[u]!=Na)break;h[u--]=0,i=1}for(s=h.length;h[--s]===0;)h.pop();if(gs&&(e.e>q_||e.e<-q_))throw Error(hL+Qs(e));return e}function uQ(e,t){var n,s,a,i,o,l,c,d,u,h,f=e.constructor,m=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),gs?Un(t,m):t;if(c=e.d,h=t.d,s=t.e,d=e.e,c=c.slice(),o=d-s,o){for(u=o<0,u?(n=c,o=-o,l=h.length):(n=h,s=d,l=c.length),a=Math.max(Math.ceil(m/os),l)+2,o>a&&(o=a,n.length=1),n.reverse(),a=o;a--;)n.push(0);n.reverse()}else{for(a=c.length,l=h.length,u=a<l,u&&(l=a),a=0;a<l;a++)if(c[a]!=h[a]){u=c[a]<h[a];break}o=0}for(u&&(n=c,c=h,h=n,t.s=-t.s),l=c.length,a=h.length-l;a>0;--a)c[l++]=0;for(a=h.length;a>o;){if(c[--a]<h[a]){for(i=a;i&&c[--i]===0;)c[i]=Na-1;--c[i],c[a]+=Na}c[a]-=h[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--s;return c[0]?(t.d=c,t.e=s,gs?Un(t,m):t):new f(0)}function $m(e,t,n){var s,a=Qs(e),i=Fc(e.d),o=i.length;return t?(n&&(s=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+qu(s):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+qu(-a-1)+i,n&&(s=n-o)>0&&(i+=qu(s))):a>=o?(i+=qu(a+1-o),n&&(s=n-a-1)>0&&(i=i+"."+qu(s))):((s=a+1)<o&&(i=i.slice(0,s)+"."+i.slice(s)),n&&(s=n-o)>0&&(a+1===o&&(i+="."),i+=qu(s))),e.s<0?"-"+i:i}function NF(e,t){if(e.length>t)return e.length=t,!0}function hQ(e){var t,n,s;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(xm+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return wF(o,i.toString())}else if(typeof i!="string")throw Error(xm+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,s$e.test(i))wF(o,i);else throw Error(xm+i)}if(a.prototype=Ft,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=hQ,a.config=a.set=a$e,e===void 0&&(e={}),e)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<s.length;)e.hasOwnProperty(n=s[t++])||(e[n]=this[n]);return a.config(e),a}function a$e(e){if(!e||typeof e!="object")throw Error(pl+"Object expected");var t,n,s,a=["precision",1,Sv,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((s=e[n=a[t]])!==void 0)if(kv(s)===s&&s>=a[t+1]&&s<=a[t+2])this[n]=s;else throw Error(xm+n+": "+s);if((s=e[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(xm+n+": "+s);return this}var fL=hQ(n$e);Co=new fL(1);const Mn=fL;function i$e(e){return d$e(e)||c$e(e)||l$e(e)||o$e()}function o$e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 945In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l$e(e,t){if(e){if(typeof e=="string")return v3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v3(e,t)}}function c$e(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function d$e(e){if(Array.isArray(e))return v3(e)}function v3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var u$e=function(t){return t},fQ={"@@functional/placeholder":!0},mQ=function(t){return t===fQ},_F=function(t){return function n(){return arguments.length===0||arguments.length===1&&mQ(arguments.length<=0?void 0:arguments[0])?n:t.apply(void 0,arguments)}},h$e=function e(t,n){return t===1?n:_F(function(){for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];var o=a.filter(function(l){return l!==fQ}).length;return o>=t?n.apply(void 0,a):e(t-o,_F(function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u=a.map(function(h){return mQ(h)?c.shift():h});return n.apply(void 0,i$e(u).concat(c))}))})},u5=function(t){return h$e(t.length,t)},y3=function(t,n){for(var s=[],a=t;a<n;++a)s[a-t]=a;return s},f$e=u5(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(n){return t[n]}).map(e)}),m$e=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];if(!n.length)return u$e;var a=n.reverse(),i=a[0],o=a.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},b3=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},pQ=function(t){var n=null,s=null;return function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return n&&i.every(function(l,c){return l===n[c]})||(n=i,s=t.apply(void 0,i)),s}};function p$e(e){var t;return e===0?t=1:t=Math.floor(new Mn(e).abs().log(10).toNumber())+1,t}function g$e(e,t,n){for(var s=new Mn(e),a=0,i=[];s.lt(t)&&a<1e5;)i.push(s.toNumber()),s=s.add(n),a++;return i}var x$e=u5(function(e,t,n){var s=+e,a=+t;return s+n*(a-s)}),v$e=u5(function(e,t,n){var s=t-+e;return s=s||1/0,(n-e)/s}),y$e=u5(function(e,t,n){var s=t-+e;return s=s||1/0,Math.max(0,Math.min(1,(n-e)/s))});const h5={rangeStep:g$e,getDigitCount:p$e,interpolateNumber:x$e,uninterpolateNumber:v$e,uninterpolateTruncation:y$e};function j3(e){return w$e(e)||j$e(e)||gQ(e)||b$e()}function b$e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 946In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j$e(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function w$e(e){if(Array.isArray(e))return w3(e)}function fb(e,t){return S$e(e)||_$e(e,t)||gQ(e,t)||N$e()}function N$e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 947In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gQ(e,t){if(e){if(typeof e=="string")return w3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w3(e,t)}}function w3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function _$e(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,a=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(s=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));s=!0);}catch(c){a=!0,i=c}finally{try{!s&&o.return!=null&&o.return()}finally{if(a)throw i}}return n}}function S$e(e){if(Array.isArray(e))return e}function xQ(e){var t=fb(e,2),n=t[0],s=t[1],a=n,i=s;return n>s&&(a=s,i=n),[a,i]}function vQ(e,t,n){if(e.lte(0))return new Mn(0);var s=h5.getDigitCount(e.toNumber()),a=new Mn(10).pow(s),i=e.div(a),o=s!==1?.05:.1,l=new Mn(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(a);return t?c:new Mn(Math.ceil(c))}function k$e(e,t,n){var s=1,a=new Mn(e);if(!a.isint()&&n){var i=Math.abs(e);i<1?(s=new Mn(10).pow(h5.getDigitCount(e)-1),a=new Mn(Math.floor(a.div(s).toNumber())).mul(s)):i>1&&(a=new Mn(Math.floor(e)))}else e===0?a=new Mn(Math.floor((t-1)/2)):n||(a=new Mn(Math.floor(e)));var o=Math.floor((t-1)/2),l=m$e(f$e(function(c){return a.add(new Mn(c-o).mul(s)).toNumber()}),y3);return l(0,t)}function yQ(e,t,n,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Mn(0),tickMin:new Mn(0),tickMax:new Mn(0)};var i=vQ(new Mn(t).sub(e).div(n-1),s,a),o;e<=0&&t>=0?o=new Mn(0):(o=new Mn(e).add(t).div(2),o=o.sub(new Mn(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Mn(t).sub(o).div(i).toNumber()),d=l+c+1;return d>n?yQ(e,t,n,s,a+1):(d<n&&(c=t>0?c+(n-d):c,l=t>0?l:l+(n-d)),{step:i,tickMin:o.sub(new Mn(l).mul(i)),tickMax:o.add(new Mn(c).mul(i))})}function C$e(e){var t=fb(e,2),n=t[0],s=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(a,2),l=xQ([n,s]),c=fb(l,2),d=c[0],u=c[1];if(d===-1/0||u===1/0){var h=u===1/0?[d].concat(j3(y3(0,a-1).map(function(){return 1/0}))):[].concat(j3(y3(0,a-1).map(function(){return-1/0})),[u]);return n>s?b3(h):h}if(d===u)return k$e(d,a,i);var f=yQ(d,u,o,i),m=f.step,x=f.tickMin,p=f.tickMax,v=h5.rangeStep(x,p.add(new Mn(.1).mul(m)),m);return n>s?b3(v):v}function A$e(e,t){var n=fb(e,2),s=n[0],a=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=xQ([s,a]),l=fb(o,2),c=l[0],d=l[1];if(c===-1/0||d===1/0)return[s,a];if(c===d)return[c];var u=Math.max(t,2),h=vQ(new Mn(d).sub(c).div(u-1),i,0),f=[].concat(j3(h5.rangeStep(new Mn(c),new Mn(d).sub(new Mn(.99).mul(h)),h)),[d]);return s>a?b3(f):f}var P$e=pQ(C$e),E$e=pQ(A$e),T$e="Invariant failed";function Fm(e,t){throw new Error(T$e)}var O$e=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Ex(e){"@babel/helpers - typeof";return Ex=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},Ex(e)}function V_(){return V_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},V_.apply(this,arguments)}function L$e(e,t){return D$e(e)||M$e(e,t)||R$e(e,t)||I$e()}function I$e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 948In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R$e(e,t){if(e){if(typeof e=="string")return SF(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return SF(e,t)}}function SF(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function M$e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function D$e(e){if(Array.isArray(e))return e}function $$e(e,t){if(e==null)return{};var n=F$e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function F$e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function B$e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U$e(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,wQ(s.key),s)}}function z$e(e,t,n){return t&&U$e(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function q$e(e,t,n){return t=W_(t),V$e(e,bQ()?Reflect.construct(t,n||[],W_(e).constructor):t.apply(e,n))}function V$e(e,t){if(t&&(Ex(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return W$e(e)}function W$e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bQ=function(){return!!e})()}function W_(e){return W_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},W_(e)}function H$e(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&&N3(e,t)}function N3(e,t){return N3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},N3(e,t)}function jQ(e,t,n){return t=wQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wQ(e){var t=G$e(e,"string");return Ex(t)=="symbol"?t:t+""}function G$e(e,t){if(Ex(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Ex(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qj=function(e){function t(){return B$e(this,t),q$e(this,t,arguments)}return H$e(t,e),z$e(t,[{key:"render",value:function(){var s=this.props,a=s.offset,i=s.layout,o=s.width,l=s.dataKey,c=s.data,d=s.dataPointFormatter,u=s.xAxis,h=s.yAxis,f=$$e(s,O$e),m=cr(f,!1);this.props.direction==="x"&&u.type!=="number"&&Fm();var x=c.map(function(p){var v=d(p,l),g=v.x,y=v.y,b=v.value,w=v.errorVal;if(!w)return null;var _=[],C,E;if(Array.isArray(w)){var N=L$e(w,2);C=N[0],E=N[1]}else C=E=w;if(i==="vertical"){var k=u.scale,I=y+a,P=I+o,O=I-o,A=k(b-C),R=k(b+E);_.push({x1:R,y1:P,x2:R,y2:O}),_.push({x1:A,y1:I,x2:R,y2:I}),_.push({x1:A,y1:P,x2:A,y2:O})}else if(i==="horizontal"){var L=h.scale,z=g+a,U=z-o,$=z+o,q=L(b-C),ne=L(b+E);_.push({x1:U,y1:ne,x2:$,y2:ne}),_.push({x1:z,y1:q,x2:z,y2:ne}),_.push({x1:U,y1:q,x2:$,y2:q})}return ee.createElement(xn,V_({className:"recharts-errorBar",key:"bar-".concat(_.map(function(se){return"".concat(se.x1,"-").concat(se.x2,"-").concat(se.y1,"-").concat(se.y2)}))},m),_.map(function(se){return ee.createElement("line",V_({},se,{key:"line-".concat(se.x1,"-").concat(se.x2,"-").concat(se.y1,"-").concat(se.y2)}))}))});return ee.createElement(xn,{className:"recharts-errorBars"},x)}}])}(ee.Component);jQ(qj,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});jQ(qj,"displayName","ErrorBar");function mb(e){"@babel/helpers - typeof";return mb=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},mb(e)}function kF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Cf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kF(Object(n),!0).forEach(function(s){Y$e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Y$e(e,t,n){return t=K$e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K$e(e){var t=X$e(e,"string");return mb(t)=="symbol"?t:t+""}function X$e(e,t){if(mb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(mb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var NQ=function(t){var n=t.children,s=t.formattedGraphicalItems,a=t.legendWidth,i=t.legendContent,o=No(n,pm);if(!o)return null;var l=pm.defaultProps,c=l!==void 0?Cf(Cf({},l),o.props):{},d;return o.props&&o.props.payload?d=o.props&&o.props.payload:i==="children"?d=(s||[]).reduce(function(u,h){var f=h.item,m=h.props,x=m.sectors||m.data||[];return u.concat(x.map(function(p){return{type:o.props.iconType||f.props.legendType,value:p.name,color:p.fill,payload:p}}))},[]):d=(s||[]).map(function(u){var h=u.item,f=h.type.defaultProps,m=f!==void 0?Cf(Cf({},f),h.props):{},x=m.dataKey,p=m.name,v=m.legendType,g=m.hide;return{inactive:g,dataKey:x,type:c.iconType||v||"square",color:mL(h),value:p||x,payload:m}}),Cf(Cf(Cf({},c),pm.getWithHeight(o,a)),{},{payload:d,item:o})};function pb(e){"@babel/helpers - typeof";return pb=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},pb(e)}function CF(e){return eFe(e)||Q$e(e)||J$e(e)||Z$e()}function Z$e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 949In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function J$e(e,t){if(e){if(typeof e=="string")return _3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _3(e,t)}}function Q$e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function eFe(e){if(Array.isArray(e))return _3(e)}function _3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function AF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Is(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AF(Object(n),!0).forEach(function(s){Ig(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Ig(e,t,n){return t=tFe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tFe(e){var t=rFe(e,"string");return pb(t)=="symbol"?t:t+""}function rFe(e,t){if(pb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(pb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pa(e,t,n){return Or(e)||Or(t)?n:va(t)?Mo(e,t,n):Nr(t)?t(e):n}function u0(e,t,n,s){var a=Q8e(e,function(l){return pa(l,t)});if(n==="number"){var i=a.filter(function(l){return vt(l)||parseFloat(l)});return i.length?[d5(i),c5(i)]:[1/0,-1/0]}var o=s?a.filter(function(l){return!Or(l)}):a;return o.map(function(l){return va(l)||l instanceof Date?l:""})}var nFe=function(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,d=0;d<l;d++){var u=d>0?a[d-1].coordinate:a[l-1].coordinate,h=a[d].coordinate,f=d>=l-1?a[0].coordinate:a[d+1].coordinate,m=void 0;if(Ni(h-u)!==Ni(f-h)){var x=[];if(Ni(f-h)===Ni(c[1]-c[0])){m=f;var p=h+c[1]-c[0];x[0]=Math.min(p,(p+u)/2),x[1]=Math.max(p,(p+u)/2)}else{m=u;var v=f+c[1]-c[0];x[0]=Math.min(h,(v+h)/2),x[1]=Math.max(h,(v+h)/2)}var g=[Math.min(h,(m+h)/2),Math.max(h,(m+h)/2)];if(t>g[0]&&t<=g[1]||t>=x[0]&&t<=x[1]){o=a[d].index;break}}else{var y=Math.min(u,f),b=Math.max(u,f);if(t>(y+h)/2&&t<=(b+h)/2){o=a[d].index;break}}}else for(var w=0;w<l;w++)if(w===0&&t<=(s[w].coordinate+s[w+1].coordinate)/2||w>0&&w<l-1&&t>(s[w].coordinate+s[w-1].coordinate)/2&&t<=(s[w].coordinate+s[w+1].coordinate)/2||w===l-1&&t>(s[w].coordinate+s[w-1].coordinate)/2){o=s[w].index;break}return o},mL=function(t){var n,s=t,a=s.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Is(Is({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(a){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},sFe=function(t){var n=t.barSize,s=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var o={},l=Object.keys(i),c=0,d=l.length;c<d;c++)for(var u=i[l[c]].stackGroups,h=Object.keys(u),f=0,m=h.length;f<m;f++){var x=u[h[f]],p=x.items,v=x.cateAxisId,g=p.filter(function(E){return Hd(E.type).indexOf("Bar")>=0});if(g&&g.length){var y=g[0].type.defaultProps,b=y!==void 0?Is(Is({},y),g[0].props):g[0].props,w=b.barSize,_=b[v];o[_]||(o[_]=[]);var C=Or(w)?n:w;o[_].push({item:g[0],stackList:g.slice(1),barSize:Or(C)?void 0:_i(C,s,0)})}}return o},aFe=function(t){var n=t.barGap,s=t.barCategoryGap,a=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var d=_i(n,a,0,!0),u,h=[];if(o[0].barSize===+o[0].barSize){var f=!1,m=a/c,x=o.reduce(function(w,_){return w+_.barSize||0},0);x+=(c-1)*d,x>=a&&(x-=(c-1)*d,d=0),x>=a&&m>0&&(f=!0,m*=.9,x=c*m);var p=(a-x)/2>>0,v={offset:p-d,size:0};u=o.reduce(function(w,_){var C={item:_.item,position:{offset:v.offset+v.size+d,size:f?m:_.barSize}},E=[].concat(CF(w),[C]);return v=E[E.length-1].position,_.stackList&&_.stackList.length&&_.stackList.forEach(function(N){E.push({item:N,position:v})}),E},h)}else{var g=_i(s,a,0,!0);a-2*g-(c-1)*d<=0&&(d=0);var y=(a-2*g-(c-1)*d)/c;y>1&&(y>>=0);var b=l===+l?Math.min(y,l):y;u=o.reduce(function(w,_,C){var E=[].concat(CF(w),[{item:_.item,position:{offset:g+(y+d)*C+(y-b)/2,size:b}}]);return _.stackList&&_.stackList.length&&_.stackList.forEach(function(N){E.push({item:N,position:E[E.length-1].position})}),E},h)}return u},iFe=function(t,n,s,a){var i=s.children,o=s.width,l=s.margin,c=o-(l.left||0)-(l.right||0),d=NQ({children:i,legendWidth:c});if(d){var u=a||{},h=u.width,f=u.height,m=d.align,x=d.verticalAlign,p=d.layout;if((p==="vertical"||p==="horizontal"&&x==="middle")&&m!=="center"&&vt(t[m]))return Is(Is({},t),{},Ig({},m,t[m]+(h||0)));if((p==="horizontal"||p==="vertical"&&m==="center")&&x!=="middle"&&vt(t[x]))return Is(Is({},t),{},Ig({},x,t[x]+(f||0)))}return t},oFe=function(t,n,s){return Or(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},_Q=function(t,n,s,a,i){var o=n.props.children,l=Do(o,qj).filter(function(d){return oFe(a,i,d.props.direction)});if(l&&l.length){var c=l.map(function(d){return d.props.dataKey});return t.reduce(function(d,u){var h=pa(u,s);if(Or(h))return d;var f=Array.isArray(h)?[d5(h),c5(h)]:[h,h],m=c.reduce(function(x,p){var v=pa(u,p,0),g=f[0]-Math.abs(Array.isArray(v)?v[0]:v),y=f[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(g,x[0]),Math.max(y,x[1])]},[1/0,-1/0]);return[Math.min(m[0],d[0]),Math.max(m[1],d[1])]},[1/0,-1/0])}return null},lFe=function(t,n,s,a,i){var o=n.map(function(l){return _Q(t,l,s,i,a)}).filter(function(l){return!Or(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},SQ=function(t,n,s,a,i){var o=n.map(function(c){var d=c.props.dataKey;return s==="number"&&d&&_Q(t,c,d,a)||u0(t,d,s,i)});if(s==="number")return o.reduce(function(c,d){return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,d){for(var u=0,h=d.length;u<h;u++)l[d[u]]||(l[d[u]]=!0,c.push(d[u]));return c},[])},kQ=function(t,n){return t==="horizontal"&&n==="xAxis"||t==="vertical"&&n==="yAxis"||t==="centric"&&n==="angleAxis"||t==="radial"&&n==="radiusAxis"},CQ=function(t,n,s,a){if(a)return t.map(function(c){return c.coordinate});var i,o,l=t.map(function(c){return c.coordinate===n&&(i=!0),c.coordinate===s&&(o=!0),c.coordinate});return i||l.push(n),o||l.push(s),l},zd=function(t,n,s){if(!t)return null;var a=t.scale,i=t.duplicateDomain,o=t.type,l=t.range,c=t.realScaleType==="scaleBand"?a.bandwidth()/2:2,d=(n||s)&&o==="category"&&a.bandwidth?a.bandwidth()/c:0;if(d=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?Ni(l[0]-l[1])*2*d:d,n&&(t.ticks||t.niceTicks)){var u=(t.ticks||t.niceTicks).map(function(h){var f=i?i.indexOf(h):h;return{coordinate:a(f)+d,value:h,offset:d}});return u.filter(function(h){return!Mj(h.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(h,f){return{coordinate:a(h)+d,value:h,index:f,offset:d}}):a.ticks&&!s?a.ticks(t.tickCount).map(function(h){return{coordinate:a(h)+d,value:h,offset:d}}):a.domain().map(function(h,f){return{coordinate:a(h)+d,value:i?i[h]:h,index:f,offset:d}})},Kk=new WeakMap,w1=function(t,n){if(typeof n!="function")return t;Kk.has(t)||Kk.set(t,new WeakMap);var s=Kk.get(t);if(s.has(n))return s.get(n);var a=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,a),a},AQ=function(t,n,s){var a=t.scale,i=t.type,o=t.layout,l=t.axisType;if(a==="auto")return o==="radial"&&l==="radiusAxis"?{scale:ob(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:F_(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:d0(),realScaleType:"point"}:i==="category"?{scale:ob(),realScaleType:"band"}:{scale:F_(),realScaleType:"linear"};if(Rm(a)){var c="scale".concat(YS(a));return{scale:(jF[c]||d0)(),realScaleType:jF[c]?c:"point"}}return Nr(a)?{scale:a}:{scale:d0(),realScaleType:"point"}},PF=1e-4,PQ=function(t){var n=t.domain();if(!(!n||n.length<=2)){var s=n.length,a=t.range(),i=Math.min(a[0],a[1])-PF,o=Math.max(a[0],a[1])+PF,l=t(n[0]),c=t(n[s-1]);(l<i||l>o||c<i||c>o)&&t.domain([n[0],n[s-1]])}},cFe=function(t,n){if(!t)return null;for(var s=0,a=t.length;s<a;s++)if(t[s].item===n)return t[s].position;return null},dFe=function(t,n){if(!n||n.length!==2||!vt(n[0])||!vt(n[1]))return t;var s=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]),i=[t[0],t[1]];return(!vt(t[0])||t[0]<s)&&(i[0]=s),(!vt(t[1])||t[1]>a)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]<s&&(i[1]=s),i},uFe=function(t){var n=t.length;if(!(n<=0))for(var s=0,a=t[0].length;s<a;++s)for(var i=0,o=0,l=0;l<n;++l){var c=Mj(t[l][s][1])?t[l][s][0]:t[l][s][1];c>=0?(t[l][s][0]=i,t[l][s][1]=i+c,i=t[l][s][1]):(t[l][s][0]=o,t[l][s][1]=o+c,o=t[l][s][1])}},hFe=function(t){var n=t.length;if(!(n<=0))for(var s=0,a=t[0].length;s<a;++s)for(var i=0,o=0;o<n;++o){var l=Mj(t[o][s][1])?t[o][s][0]:t[o][s][1];l>=0?(t[o][s][0]=i,t[o][s][1]=i+l,i=t[o][s][1]):(t[o][s][0]=0,t[o][s][1]=0)}},fFe={sign:uFe,expand:OAe,none:wx,silhouette:LAe,wiggle:IAe,positive:hFe},mFe=function(t,n,s){var a=n.map(function(l){return l.props.dataKey}),i=fFe[s],o=TAe().keys(a).value(function(l,c){return+pa(l,c,0)}).order(KP).offset(i);return o(t)},pFe=function(t,n,s,a,i,o){if(!t)return null;var l=o?n.reverse():n,c={},d=l.reduce(function(h,f){var m,x=(m=f.type)!==null&&m!==void 0&&m.defaultProps?Is(Is({},f.type.defaultProps),f.props):f.props,p=x.stackId,v=x.hide;if(v)return h;var g=x[s],y=h[g]||{hasStack:!1,stackGroups:{}};if(va(p)){var b=y.stackGroups[p]||{numericAxisId:s,cateAxisId:a,items:[]};b.items.push(f),y.hasStack=!0,y.stackGroups[p]=b}else y.stackGroups[bv("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[f]};return Is(Is({},h),{},Ig({},g,y))},c),u={};return Object.keys(d).reduce(function(h,f){var m=d[f];if(m.hasStack){var x={};m.stackGroups=Object.keys(m.stackGroups).reduce(function(p,v){var g=m.stackGroups[v];return Is(Is({},p),{},Ig({},v,{numericAxisId:s,cateAxisId:a,items:g.items,stackedData:mFe(t,g.items,i)}))},x)}return Is(Is({},h),{},Ig({},f,m))},u)},EQ=function(t,n){var s=n.realScaleType,a=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=s||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&a==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=t.domain();if(!d.length)return null;var u=P$e(d,i,l);return t.domain([d5(u),c5(u)]),{niceTicks:u}}if(i&&a==="number"){var h=t.domain(),f=E$e(h,i,l);return{niceTicks:f}}return null};function EF(e){var t=e.axis,n=e.ticks,s=e.bandSize,a=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Or(a[t.dataKey])){var l=v_(n,"value",a[t.dataKey]);if(l)return l.coordinate+s/2}return n[i]?n[i].coordinate+s/2:null}var c=pa(a,Or(o)?t.dataKey:o);return Or(c)?null:t.scale(c)}var TF=function(t){var n=t.axis,s=t.ticks,a=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return s[l]?s[l].coordinate+a:null;var c=pa(o,n.dataKey,n.domain[l]);return Or(c)?null:n.scale(c)-i/2+a},gFe=function(t){var n=t.numericAxis,s=n.scale.domain();if(n.type==="number"){var a=Math.min(s[0],s[1]),i=Math.max(s[0],s[1]);return a<=0&&i>=0?0:i<0?i:a}return s[0]},xFe=function(t,n){var s,a=(s=t.type)!==null&&s!==void 0&&s.defaultProps?Is(Is({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(va(i)){var o=n[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},vFe=function(t){return t.reduce(function(n,s){return[d5(s.concat([n[0]]).filter(vt)),c5(s.concat([n[1]]).filter(vt))]},[1/0,-1/0])},TQ=function(t,n,s){return Object.keys(t).reduce(function(a,i){var o=t[i],l=o.stackedData,c=l.reduce(function(d,u){var h=vFe(u.slice(n,s+1));return[Math.min(d[0],h[0]),Math.max(d[1],h[1])]},[1/0,-1/0]);return[Math.min(c[0],a[0]),Math.max(c[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},OF=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,LF=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,S3=function(t,n,s){if(Nr(t))return t(n,s);if(!Array.isArray(t))return n;var a=[];if(vt(t[0]))a[0]=s?t[0]:Math.min(t[0],n[0]);else if(OF.test(t[0])){var i=+OF.exec(t[0])[1];a[0]=n[0]-i}else Nr(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(vt(t[1]))a[1]=s?t[1]:Math.max(t[1],n[1]);else if(LF.test(t[1])){var o=+LF.exec(t[1])[1];a[1]=n[1]+o}else Nr(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},H_=function(t,n,s){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!s||a>0)return a}if(t&&n&&n.length>=2){for(var i=z6(n,function(h){return h.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var d=i[l],u=i[l-1];o=Math.min((d.coordinate||0)-(u.coordinate||0),o)}return o===1/0?0:o}return s?void 0:0},IF=function(t,n,s){return!t||!t.length||zj(t,Mo(s,"type.defaultProps.domain"))?n:t},OQ=function(t,n){var s=t.type.defaultProps?Is(Is({},t.type.defaultProps),t.props):t.props,a=s.dataKey,i=s.name,o=s.unit,l=s.formatter,c=s.tooltipType,d=s.chartType,u=s.hide;return Is(Is({},cr(t,!1)),{},{dataKey:a,unit:o,formatter:l,name:i||a,color:mL(t),value:pa(n,a),type:c,payload:n,chartType:d,hide:u})};function gb(e){"@babel/helpers - typeof";return gb=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},gb(e)}function RF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Ed(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RF(Object(n),!0).forEach(function(s){LQ(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function LQ(e,t,n){return t=yFe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yFe(e){var t=bFe(e,"string");return gb(t)=="symbol"?t:t+""}function bFe(e,t){if(gb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(gb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jFe(e,t){return SFe(e)||_Fe(e,t)||NFe(e,t)||wFe()}function wFe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 950In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NFe(e,t){if(e){if(typeof e=="string")return MF(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return MF(e,t)}}function MF(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function _Fe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function SFe(e){if(Array.isArray(e))return e}var G_=Math.PI/180,kFe=function(t){return t*180/Math.PI},Qn=function(t,n,s,a){return{x:t+Math.cos(-G_*a)*s,y:n+Math.sin(-G_*a)*s}},IQ=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(s.left||0)-(s.right||0)),Math.abs(n-(s.top||0)-(s.bottom||0)))/2},CFe=function(t,n,s,a,i){var o=t.width,l=t.height,c=t.startAngle,d=t.endAngle,u=_i(t.cx,o,o/2),h=_i(t.cy,l,l/2),f=IQ(o,l,s),m=_i(t.innerRadius,f,0),x=_i(t.outerRadius,f,f*.8),p=Object.keys(n);return p.reduce(function(v,g){var y=n[g],b=y.domain,w=y.reversed,_;if(Or(y.range))a==="angleAxis"?_=[c,d]:a==="radiusAxis"&&(_=[m,x]),w&&(_=[_[1],_[0]]);else{_=y.range;var C=_,E=jFe(C,2);c=E[0],d=E[1]}var N=AQ(y,i),k=N.realScaleType,I=N.scale;I.domain(b).range(_),PQ(I);var P=EQ(I,Ed(Ed({},y),{},{realScaleType:k})),O=Ed(Ed(Ed({},y),P),{},{range:_,radius:x,realScaleType:k,scale:I,cx:u,cy:h,innerRadius:m,outerRadius:x,startAngle:c,endAngle:d});return Ed(Ed({},v),{},LQ({},g,O))},{})},AFe=function(t,n){var s=t.x,a=t.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(s-i,2)+Math.pow(a-o,2))},PFe=function(t,n){var s=t.x,a=t.y,i=n.cx,o=n.cy,l=AFe({x:s,y:a},{x:i,y:o});if(l<=0)return{radius:l};var c=(s-i)/l,d=Math.acos(c);return a>o&&(d=2*Math.PI-d),{radius:l,angle:kFe(d),angleInRadian:d}},EFe=function(t){var n=t.startAngle,s=t.endAngle,a=Math.floor(n/360),i=Math.floor(s/360),o=Math.min(a,i);return{startAngle:n-o*360,endAngle:s-o*360}},TFe=function(t,n){var s=n.startAngle,a=n.endAngle,i=Math.floor(s/360),o=Math.floor(a/360),l=Math.min(i,o);return t+l*360},DF=function(t,n){var s=t.x,a=t.y,i=PFe({x:s,y:a},n),o=i.radius,l=i.angle,c=n.innerRadius,d=n.outerRadius;if(o<c||o>d)return!1;if(o===0)return!0;var u=EFe(n),h=u.startAngle,f=u.endAngle,m=l,x;if(h<=f){for(;m>f;)m-=360;for(;m<h;)m+=360;x=m>=h&&m<=f}else{for(;m>h;)m-=360;for(;m<f;)m+=360;x=m>=f&&m<=h}return x?Ed(Ed({},n),{},{radius:o,angle:TFe(m,n)}):null},RQ=function(t){return!j.isValidElement(t)&&!Nr(t)&&typeof t!="boolean"?t.className:""};function xb(e){"@babel/helpers - typeof";return xb=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},xb(e)}var OFe=["offset"];function LFe(e){return DFe(e)||MFe(e)||RFe(e)||IFe()}function IFe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 951In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RFe(e,t){if(e){if(typeof e=="string")return k3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k3(e,t)}}function MFe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function DFe(e){if(Array.isArray(e))return k3(e)}function k3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function $Fe(e,t){if(e==null)return{};var n=FFe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function FFe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function $F(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function ca(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$F(Object(n),!0).forEach(function(s){BFe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$F(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function BFe(e,t,n){return t=UFe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function UFe(e){var t=zFe(e,"string");return xb(t)=="symbol"?t:t+""}function zFe(e,t){if(xb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(xb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vb(){return vb=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},vb.apply(this,arguments)}var qFe=function(t){var n=t.value,s=t.formatter,a=Or(t.children)?n:t.children;return Nr(s)?s(a):a},VFe=function(t,n){var s=Ni(n-t),a=Math.min(Math.abs(n-t),360);return s*a},WFe=function(t,n,s){var a=t.position,i=t.viewBox,o=t.offset,l=t.className,c=i,d=c.cx,u=c.cy,h=c.innerRadius,f=c.outerRadius,m=c.startAngle,x=c.endAngle,p=c.clockWise,v=(h+f)/2,g=VFe(m,x),y=g>=0?1:-1,b,w;a==="insideStart"?(b=m+y*o,w=p):a==="insideEnd"?(b=x-y*o,w=!p):a==="end"&&(b=x+y*o,w=p),w=g<=0?w:!w;var _=Qn(d,u,v,b),C=Qn(d,u,v,b+(w?1:-1)*359),E="M".concat(_.x,",").concat(_.y,` 952 A`).concat(v,",").concat(v,",0,1,").concat(w?0:1,`, 953 `).concat(C.x,",").concat(C.y),N=Or(t.id)?bv("recharts-radial-line-"):t.id;return ee.createElement("text",vb({},s,{dominantBaseline:"central",className:Mr("recharts-radial-bar-label",l)}),ee.createElement("defs",null,ee.createElement("path",{id:N,d:E})),ee.createElement("textPath",{xlinkHref:"#".concat(N)},n))},HFe=function(t){var n=t.viewBox,s=t.offset,a=t.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,u=i.startAngle,h=i.endAngle,f=(u+h)/2;if(a==="outside"){var m=Qn(o,l,d+s,f),x=m.x,p=m.y;return{x,y:p,textAnchor:x>=o?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var v=(c+d)/2,g=Qn(o,l,v,f),y=g.x,b=g.y;return{x:y,y:b,textAnchor:"middle",verticalAnchor:"middle"}},GFe=function(t){var n=t.viewBox,s=t.parentViewBox,a=t.offset,i=t.position,o=n,l=o.x,c=o.y,d=o.width,u=o.height,h=u>=0?1:-1,f=h*a,m=h>0?"end":"start",x=h>0?"start":"end",p=d>=0?1:-1,v=p*a,g=p>0?"end":"start",y=p>0?"start":"end";if(i==="top"){var b={x:l+d/2,y:c-h*a,textAnchor:"middle",verticalAnchor:m};return ca(ca({},b),s?{height:Math.max(c-s.y,0),width:d}:{})}if(i==="bottom"){var w={x:l+d/2,y:c+u+f,textAnchor:"middle",verticalAnchor:x};return ca(ca({},w),s?{height:Math.max(s.y+s.height-(c+u),0),width:d}:{})}if(i==="left"){var _={x:l-v,y:c+u/2,textAnchor:g,verticalAnchor:"middle"};return ca(ca({},_),s?{width:Math.max(_.x-s.x,0),height:u}:{})}if(i==="right"){var C={x:l+d+v,y:c+u/2,textAnchor:y,verticalAnchor:"middle"};return ca(ca({},C),s?{width:Math.max(s.x+s.width-C.x,0),height:u}:{})}var E=s?{width:d,height:u}:{};return i==="insideLeft"?ca({x:l+v,y:c+u/2,textAnchor:y,verticalAnchor:"middle"},E):i==="insideRight"?ca({x:l+d-v,y:c+u/2,textAnchor:g,verticalAnchor:"middle"},E):i==="insideTop"?ca({x:l+d/2,y:c+f,textAnchor:"middle",verticalAnchor:x},E):i==="insideBottom"?ca({x:l+d/2,y:c+u-f,textAnchor:"middle",verticalAnchor:m},E):i==="insideTopLeft"?ca({x:l+v,y:c+f,textAnchor:y,verticalAnchor:x},E):i==="insideTopRight"?ca({x:l+d-v,y:c+f,textAnchor:g,verticalAnchor:x},E):i==="insideBottomLeft"?ca({x:l+v,y:c+u-f,textAnchor:y,verticalAnchor:m},E):i==="insideBottomRight"?ca({x:l+d-v,y:c+u-f,textAnchor:g,verticalAnchor:m},E):gv(i)&&(vt(i.x)||Kf(i.x))&&(vt(i.y)||Kf(i.y))?ca({x:l+_i(i.x,d),y:c+_i(i.y,u),textAnchor:"end",verticalAnchor:"end"},E):ca({x:l+d/2,y:c+u/2,textAnchor:"middle",verticalAnchor:"middle"},E)},YFe=function(t){return"cx"in t&&vt(t.cx)};function ka(e){var t=e.offset,n=t===void 0?5:t,s=$Fe(e,OFe),a=ca({offset:n},s),i=a.viewBox,o=a.position,l=a.value,c=a.children,d=a.content,u=a.className,h=u===void 0?"":u,f=a.textBreakAll;if(!i||Or(l)&&Or(c)&&!j.isValidElement(d)&&!Nr(d))return null;if(j.isValidElement(d))return j.cloneElement(d,a);var m;if(Nr(d)){if(m=j.createElement(d,a),j.isValidElement(m))return m}else m=qFe(a);var x=YFe(i),p=cr(a,!0);if(x&&(o==="insideStart"||o==="insideEnd"||o==="end"))return WFe(a,m,p);var v=x?HFe(a):GFe(a);return ee.createElement(Dm,vb({className:Mr("recharts-label",h)},p,v,{breakAll:f}),m)}ka.displayName="Label";var MQ=function(t){var n=t.cx,s=t.cy,a=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,d=t.innerRadius,u=t.outerRadius,h=t.x,f=t.y,m=t.top,x=t.left,p=t.width,v=t.height,g=t.clockWise,y=t.labelViewBox;if(y)return y;if(vt(p)&&vt(v)){if(vt(h)&&vt(f))return{x:h,y:f,width:p,height:v};if(vt(m)&&vt(x))return{x:m,y:x,width:p,height:v}}return vt(h)&&vt(f)?{x:h,y:f,width:0,height:0}:vt(n)&&vt(s)?{cx:n,cy:s,startAngle:i||a||0,endAngle:o||a||0,innerRadius:d||0,outerRadius:u||c||l||0,clockWise:g}:t.viewBox?t.viewBox:{}},KFe=function(t,n){return t?t===!0?ee.createElement(ka,{key:"label-implicit",viewBox:n}):va(t)?ee.createElement(ka,{key:"label-implicit",viewBox:n,value:t}):j.isValidElement(t)?t.type===ka?j.cloneElement(t,{key:"label-implicit",viewBox:n}):ee.createElement(ka,{key:"label-implicit",content:t,viewBox:n}):Nr(t)?ee.createElement(ka,{key:"label-implicit",content:t,viewBox:n}):gv(t)?ee.createElement(ka,vb({viewBox:n},t,{key:"label-implicit"})):null:null},XFe=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&s&&!t.label)return null;var a=t.children,i=MQ(t),o=Do(a,ka).map(function(c,d){return j.cloneElement(c,{viewBox:n||i,key:"label-".concat(d)})});if(!s)return o;var l=KFe(t.label,n||i);return[l].concat(LFe(o))};ka.parseViewBox=MQ;ka.renderCallByParent=XFe;function ZFe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var JFe=ZFe;const QFe=_n(JFe);function yb(e){"@babel/helpers - typeof";return yb=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},yb(e)}var e7e=["valueAccessor"],t7e=["data","dataKey","clockWise","id","textBreakAll"];function r7e(e){return i7e(e)||a7e(e)||s7e(e)||n7e()}function n7e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 954In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s7e(e,t){if(e){if(typeof e=="string")return C3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C3(e,t)}}function a7e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i7e(e){if(Array.isArray(e))return C3(e)}function C3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function Y_(){return Y_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Y_.apply(this,arguments)}function FF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function BF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FF(Object(n),!0).forEach(function(s){o7e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function o7e(e,t,n){return t=l7e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l7e(e){var t=c7e(e,"string");return yb(t)=="symbol"?t:t+""}function c7e(e,t){if(yb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(yb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UF(e,t){if(e==null)return{};var n=d7e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function d7e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var u7e=function(t){return Array.isArray(t.value)?QFe(t.value):t.value};function Yd(e){var t=e.valueAccessor,n=t===void 0?u7e:t,s=UF(e,e7e),a=s.data,i=s.dataKey,o=s.clockWise,l=s.id,c=s.textBreakAll,d=UF(s,t7e);return!a||!a.length?null:ee.createElement(xn,{className:"recharts-label-list"},a.map(function(u,h){var f=Or(i)?n(u,h):pa(u&&u.payload,i),m=Or(l)?{}:{id:"".concat(l,"-").concat(h)};return ee.createElement(ka,Y_({},cr(u,!0),d,m,{parentViewBox:u.parentViewBox,value:f,textBreakAll:c,viewBox:ka.parseViewBox(Or(o)?u:BF(BF({},u),{},{clockWise:o})),key:"label-".concat(h),index:h}))}))}Yd.displayName="LabelList";function h7e(e,t){return e?e===!0?ee.createElement(Yd,{key:"labelList-implicit",data:t}):ee.isValidElement(e)||Nr(e)?ee.createElement(Yd,{key:"labelList-implicit",data:t,content:e}):gv(e)?ee.createElement(Yd,Y_({data:t},e,{key:"labelList-implicit"})):null:null}function f7e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var s=e.children,a=Do(s,Yd).map(function(o,l){return j.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return a;var i=h7e(e.label,t);return[i].concat(r7e(a))}Yd.renderCallByParent=f7e;function bb(e){"@babel/helpers - typeof";return bb=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},bb(e)}function A3(){return A3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},A3.apply(this,arguments)}function zF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function qF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zF(Object(n),!0).forEach(function(s){m7e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function m7e(e,t,n){return t=p7e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p7e(e){var t=g7e(e,"string");return bb(t)=="symbol"?t:t+""}function g7e(e,t){if(bb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(bb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var x7e=function(t,n){var s=Ni(n-t),a=Math.min(Math.abs(n-t),359.999);return s*a},N1=function(t){var n=t.cx,s=t.cy,a=t.radius,i=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,d=t.cornerIsExternal,u=c*(l?1:-1)+a,h=Math.asin(c/u)/G_,f=d?i:i+o*h,m=Qn(n,s,u,f),x=Qn(n,s,a,f),p=d?i-o*h:i,v=Qn(n,s,u*Math.cos(h*G_),p);return{center:m,circleTangency:x,lineTangency:v,theta:h}},DQ=function(t){var n=t.cx,s=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=x7e(o,l),d=o+c,u=Qn(n,s,i,o),h=Qn(n,s,i,d),f="M ".concat(u.x,",").concat(u.y,` 955 A `).concat(i,",").concat(i,`,0, 956 `).concat(+(Math.abs(c)>180),",").concat(+(o>d),`, 957 `).concat(h.x,",").concat(h.y,` 958 `);if(a>0){var m=Qn(n,s,a,o),x=Qn(n,s,a,d);f+="L ".concat(x.x,",").concat(x.y,` 959 A `).concat(a,",").concat(a,`,0, 960 `).concat(+(Math.abs(c)>180),",").concat(+(o<=d),`, 961 `).concat(m.x,",").concat(m.y," Z")}else f+="L ".concat(n,",").concat(s," Z");return f},v7e=function(t){var n=t.cx,s=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,d=t.startAngle,u=t.endAngle,h=Ni(u-d),f=N1({cx:n,cy:s,radius:i,angle:d,sign:h,cornerRadius:o,cornerIsExternal:c}),m=f.circleTangency,x=f.lineTangency,p=f.theta,v=N1({cx:n,cy:s,radius:i,angle:u,sign:-h,cornerRadius:o,cornerIsExternal:c}),g=v.circleTangency,y=v.lineTangency,b=v.theta,w=c?Math.abs(d-u):Math.abs(d-u)-p-b;if(w<0)return l?"M ".concat(x.x,",").concat(x.y,` 962 a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 963 a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 964 `):DQ({cx:n,cy:s,innerRadius:a,outerRadius:i,startAngle:d,endAngle:u});var _="M ".concat(x.x,",").concat(x.y,` 965 A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(m.x,",").concat(m.y,` 966 A`).concat(i,",").concat(i,",0,").concat(+(w>180),",").concat(+(h<0),",").concat(g.x,",").concat(g.y,` 967 A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(y.x,",").concat(y.y,` 968 `);if(a>0){var C=N1({cx:n,cy:s,radius:a,angle:d,sign:h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),E=C.circleTangency,N=C.lineTangency,k=C.theta,I=N1({cx:n,cy:s,radius:a,angle:u,sign:-h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=I.circleTangency,O=I.lineTangency,A=I.theta,R=c?Math.abs(d-u):Math.abs(d-u)-k-A;if(R<0&&o===0)return"".concat(_,"L").concat(n,",").concat(s,"Z");_+="L".concat(O.x,",").concat(O.y,` 969 A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(P.x,",").concat(P.y,` 970 A`).concat(a,",").concat(a,",0,").concat(+(R>180),",").concat(+(h>0),",").concat(E.x,",").concat(E.y,` 971 A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(N.x,",").concat(N.y,"Z")}else _+="L".concat(n,",").concat(s,"Z");return _},y7e={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},$Q=function(t){var n=qF(qF({},y7e),t),s=n.cx,a=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,d=n.cornerIsExternal,u=n.startAngle,h=n.endAngle,f=n.className;if(o<i||u===h)return null;var m=Mr("recharts-sector",f),x=o-i,p=_i(l,x,0,!0),v;return p>0&&Math.abs(u-h)<360?v=v7e({cx:s,cy:a,innerRadius:i,outerRadius:o,cornerRadius:Math.min(p,x/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:u,endAngle:h}):v=DQ({cx:s,cy:a,innerRadius:i,outerRadius:o,startAngle:u,endAngle:h}),ee.createElement("path",A3({},cr(n,!0),{className:m,d:v,role:"img"}))};function jb(e){"@babel/helpers - typeof";return jb=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},jb(e)}function P3(){return P3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},P3.apply(this,arguments)}function VF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function WF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VF(Object(n),!0).forEach(function(s){b7e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function b7e(e,t,n){return t=j7e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j7e(e){var t=w7e(e,"string");return jb(t)=="symbol"?t:t+""}function w7e(e,t){if(jb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(jb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var HF={curveBasisClosed:bAe,curveBasisOpen:jAe,curveBasis:yAe,curveBumpX:aAe,curveBumpY:iAe,curveLinearClosed:wAe,curveLinear:XS,curveMonotoneX:NAe,curveMonotoneY:_Ae,curveNatural:SAe,curveStep:kAe,curveStepAfter:AAe,curveStepBefore:CAe},_1=function(t){return t.x===+t.x&&t.y===+t.y},Sy=function(t){return t.x},ky=function(t){return t.y},N7e=function(t,n){if(Nr(t))return t;var s="curve".concat(YS(t));return(s==="curveMonotone"||s==="curveBump")&&n?HF["".concat(s).concat(n==="vertical"?"Y":"X")]:HF[s]||XS},_7e=function(t){var n=t.type,s=n===void 0?"linear":n,a=t.points,i=a===void 0?[]:a,o=t.baseLine,l=t.layout,c=t.connectNulls,d=c===void 0?!1:c,u=N7e(s,l),h=d?i.filter(function(p){return _1(p)}):i,f;if(Array.isArray(o)){var m=d?o.filter(function(p){return _1(p)}):o,x=h.map(function(p,v){return WF(WF({},p),{},{base:m[v]})});return l==="vertical"?f=m1().y(ky).x1(Sy).x0(function(p){return p.base.x}):f=m1().x(Sy).y1(ky).y0(function(p){return p.base.y}),f.defined(_1).curve(u),f(x)}return l==="vertical"&&vt(o)?f=m1().y(ky).x1(Sy).x0(o):vt(o)?f=m1().x(Sy).y1(ky).y0(o):f=OZ().x(Sy).y(ky),f.defined(_1).curve(u),f(h)},K_=function(t){var n=t.className,s=t.points,a=t.path,i=t.pathRef;if((!s||!s.length)&&!a)return null;var o=s&&s.length?_7e(t):a;return j.createElement("path",P3({},cr(t,!1),y_(t),{className:Mr("recharts-curve",n),d:o,ref:i}))},FQ={exports:{}},S7e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",k7e=S7e,C7e=k7e;function BQ(){}function UQ(){}UQ.resetWarningCache=BQ;var A7e=function(){function e(s,a,i,o,l,c){if(c!==C7e){var d=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 d.name="Invariant Violation",d}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol
971:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:UQ,resetWarningCache:BQ};return n.PropTypes=n,n};FQ.exports=A7e();var P7e=FQ.exports;const wn=_n(P7e);var E7e=Object.getOwnPropertyNames,T7e=Object.getOwnPropertySymbols,O7e=Object.prototype.hasOwnProperty;function GF(e,t){return function(s,a,i){return e(s,a,i)&&t(s,a,i)}}function S1(e){return function(n,s,a){if(!n||!s||typeof n!="object"||typeof s!="object")return e(n,s,a);var i=a.cache,o=i.get(n),l=i.get(s);if(o&&l)return o===s&&l===n;i.set(n,s),i.set(s,n);var c=e(n,s,a);return i.delete(n),i.delete(s),c}}function YF(e){return E7e(e).concat(T7e(e))}var L7e=Object.hasOwn||function(e,t){return O7e.call(e,t)};function ap(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var I7e="__v",R7e="__o",M7e="_owner",KF=Object.getOwnPropertyDescriptor,XF=Object.keys;function D7e(e,t,n){var s=e.length;if(t.length!==s)return!1;for(;s-- >0;)if(!n.equals(e[s],t[s],s,s,e,t,n))return!1;return!0}function $7e(e,t){return ap(e.getTime(),t.getTime())}function F7e(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function B7e(e,t){return e===t}function ZF(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var a=new Array(s),i=e.entries(),o,l,c=0;(o=i.next())&&!o.done;){for(var d=t.entries(),u=!1,h=0;(l=d.next())&&!l.done;){if(a[h]){h++;continue}var f=o.value,m=l.value;if(n.equals(f[0],m[0],c,h,e,t,n)&&n.equals(f[1],m[1],f[0],m[0],e,t,n)){u=a[h]=!0;break}h++}if(!u)return!1;c++}return!0}var U7e=ap;function z7e(e,t,n){var s=XF(e),a=s.length;if(XF(t).length!==a)return!1;for(;a-- >0;)if(!zQ(e,t,n,s[a]))return!1;return!0}function Cy(e,t,n){var s=YF(e),a=s.length;if(YF(t).length!==a)return!1;for(var i,o,l;a-- >0;)if(i=s[a],!zQ(e,t,n,i)||(o=KF(e,i),l=KF(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function q7e(e,t){return ap(e.valueOf(),t.valueOf())}function V7e(e,t){return e.source===t.source&&e.flags===t.flags}function JF(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var a=new Array(s),i=e.values(),o,l;(o=i.next())&&!o.done;){for(var c=t.values(),d=!1,u=0;(l=c.next())&&!l.done;){if(!a[u]&&n.equals(o.value,l.value,o.value,l.value,e,t,n)){d=a[u]=!0;break}u++}if(!d)return!1}return!0}function W7e(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function H7e(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 zQ(e,t,n,s){return(s===M7e||s===R7e||s===I7e)&&(e.$$typeof||t.$$typeof)?!0:L7e(t,s)&&n.equals(e[s],t[s],s,s,e,t,n)}var G7e="[object Arguments]",Y7e="[object Boolean]",K7e="[object Date]",X7e="[object Error]",Z7e="[object Map]",J7e="[object Number]",Q7e="[object Object]",eBe="[object RegExp]",tBe="[object Set]",rBe="[object String]",nBe="[object URL]",sBe=Array.isArray,QF=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,e7=Object.assign,aBe=Object.prototype.toString.call.bind(Object.prototype.toString);function iBe(e){var t=e.areArraysEqual,n=e.areDatesEqual,s=e.areErrorsEqual,a=e.areFunctionsEqual,i=e.areMapsEqual,o=e.areNumbersEqual,l=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,d=e.areRegExpsEqual,u=e.areSetsEqual,h=e.areTypedArraysEqual,f=e.areUrlsEqual;return function(x,p,v){if(x===p)return!0;if(x==null||p==null)return!1;var g=typeof x;if(g!==typeof p)return!1;if(g!=="object")return g==="number"?o(x,p,v):g==="function"?a(x,p,v):!1;var y=x.constructor;if(y!==p.constructor)return!1;if(y===Object)return l(x,p,v);if(sBe(x))return t(x,p,v);if(QF!=null&&QF(x))return h(x,p,v);if(y===Date)return n(x,p,v);if(y===RegExp)return d(x,p,v);if(y===Map)return i(x,p,v);if(y===Set)return u(x,p,v);var b=aBe(x);return b===K7e?n(x,p,v):b===eBe?d(x,p,v):b===Z7e?i(x,p,v):b===tBe?u(x,p,v):b===Q7e?typeof x.then!="function"&&typeof p.then!="function"&&l(x,p,v):b===nBe?f(x,p,v):b===X7e?s(x,p,v):b===G7e?l(x,p,v):b===Y7e||b===J7e||b===rBe?c(x,p,v):!1}}
vendor: 62,647 bytes, lines 971-990
971function oBe(e){var t=e.circular,n=e.createCustomConfig,s=e.strict,a={areArraysEqual:s?Cy:D7e,areDatesEqual:$7e,areErrorsEqual:F7e,areFunctionsEqual:B7e,areMapsEqual:s?GF(ZF,Cy):ZF,areNumbersEqual:U7e,areObjectsEqual:s?Cy:z7e,arePrimitiveWrappersEqual:q7e,areRegExpsEqual:V7e,areSetsEqual:s?GF(JF,Cy):JF,areTypedArraysEqual:s?Cy:W7e,areUrlsEqual:H7e};if(n&&(a=e7({},a,n(a))),t){var i=S1(a.areArraysEqual),o=S1(a.areMapsEqual),l=S1(a.areObjectsEqual),c=S1(a.areSetsEqual);a=e7({},a,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return a}function lBe(e){return function(t,n,s,a,i,o,l){return e(t,n,l)}}function cBe(e){var t=e.circular,n=e.comparator,s=e.createState,a=e.equals,i=e.strict;if(s)return function(c,d){var u=s(),h=u.cache,f=h===void 0?t?new WeakMap:void 0:h,m=u.meta;return n(c,d,{cache:f,equals:a,meta:m,strict:i})};if(t)return function(c,d){return n(c,d,{cache:new WeakMap,equals:a,meta:void 0,strict:i})};var o={cache:void 0,equals:a,meta:void 0,strict:i};return function(c,d){return n(c,d,o)}}var dBe=af();af({strict:!0});af({circular:!0});af({circular:!0,strict:!0});af({createInternalComparator:function(){return ap}});af({strict:!0,createInternalComparator:function(){return ap}});af({circular:!0,createInternalComparator:function(){return ap}});af({circular:!0,createInternalComparator:function(){return ap},strict:!0});function af(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,s=e.createInternalComparator,a=e.createState,i=e.strict,o=i===void 0?!1:i,l=oBe(e),c=iBe(l),d=s?s(c):lBe(c);return cBe({circular:n,comparator:c,createState:a,equals:d,strict:o})}function uBe(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function t7(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function a(i){n<0&&(n=i),i-n>t?(e(i),n=-1):uBe(a)};requestAnimationFrame(s)}function E3(e){"@babel/helpers - typeof";return E3=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},E3(e)}function hBe(e){return gBe(e)||pBe(e)||mBe(e)||fBe()}function fBe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 972In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mBe(e,t){if(e){if(typeof e=="string")return r7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r7(e,t)}}function r7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function pBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function gBe(e){if(Array.isArray(e))return e}function xBe(){var e={},t=function(){return null},n=!1,s=function a(i){if(!n){if(Array.isArray(i)){if(!i.length)return;var o=i,l=hBe(o),c=l[0],d=l.slice(1);if(typeof c=="number"){t7(a.bind(null,d),c);return}a(c),t7(a.bind(null,d));return}E3(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){n=!0},start:function(i){n=!1,s(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function wb(e){"@babel/helpers - typeof";return wb=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},wb(e)}function n7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function s7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?n7(Object(n),!0).forEach(function(s){qQ(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):n7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function qQ(e,t,n){return t=vBe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vBe(e){var t=yBe(e,"string");return wb(t)==="symbol"?t:String(t)}function yBe(e,t){if(wb(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(wb(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var bBe=function(t,n){return[Object.keys(t),Object.keys(n)].reduce(function(s,a){return s.filter(function(i){return a.includes(i)})})},jBe=function(t){return t},wBe=function(t){return t.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},h0=function(t,n){return Object.keys(n).reduce(function(s,a){return s7(s7({},s),{},qQ({},a,t(a,n[a])))},{})},a7=function(t,n,s){return t.map(function(a){return"".concat(wBe(a)," ").concat(n,"ms ").concat(s)}).join(",")};function NBe(e,t){return kBe(e)||SBe(e,t)||VQ(e,t)||_Be()}function _Be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 973In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SBe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function kBe(e){if(Array.isArray(e))return e}function CBe(e){return EBe(e)||PBe(e)||VQ(e)||ABe()}function ABe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 974In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VQ(e,t){if(e){if(typeof e=="string")return T3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T3(e,t)}}function PBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EBe(e){if(Array.isArray(e))return T3(e)}function T3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var X_=1e-4,WQ=function(t,n){return[0,3*t,3*n-6*t,3*t-3*n+1]},HQ=function(t,n){return t.map(function(s,a){return s*Math.pow(n,a)}).reduce(function(s,a){return s+a})},i7=function(t,n){return function(s){var a=WQ(t,n);return HQ(a,s)}},TBe=function(t,n){return function(s){var a=WQ(t,n),i=[].concat(CBe(a.map(function(o,l){return o*l}).slice(1)),[0]);return HQ(i,s)}},o7=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];var a=n[0],i=n[1],o=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":a=0,i=0,o=1,l=1;break;case"ease":a=.25,i=.1,o=.25,l=1;break;case"ease-in":a=.42,i=0,o=1,l=1;break;case"ease-out":a=.42,i=0,o=.58,l=1;break;case"ease-in-out":a=0,i=0,o=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var d=c[1].split(")")[0].split(",").map(function(v){return parseFloat(v)}),u=NBe(d,4);a=u[0],i=u[1],o=u[2],l=u[3]}}}var h=i7(a,o),f=i7(i,l),m=TBe(a,o),x=function(g){return g>1?1:g<0?0:g},p=function(g){for(var y=g>1?1:g,b=y,w=0;w<8;++w){var _=h(b)-y,C=m(b);if(Math.abs(_-y)<X_||C<X_)return f(b);b=x(b-_/C)}return f(b)};return p.isStepper=!1,p},OBe=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,s=n===void 0?100:n,a=t.damping,i=a===void 0?8:a,o=t.dt,l=o===void 0?17:o,c=function(u,h,f){var m=-(u-h)*s,x=f*i,p=f+(m-x)*l/1e3,v=f*l/1e3+u;return Math.abs(v-h)<X_&&Math.abs(p)<X_?[h,0]:[v,p]};return c.isStepper=!0,c.dt=l,c},LBe=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];var a=n[0];if(typeof a=="string")switch(a){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return o7(a);case"spring":return OBe();default:if(a.split("(")[0]==="cubic-bezier")return o7(a)}return typeof a=="function"?a:null};function Nb(e){"@babel/helpers - typeof";return Nb=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},Nb(e)}function l7(e){return MBe(e)||RBe(e)||GQ(e)||IBe()}function IBe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 975In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function MBe(e){if(Array.isArray(e))return L3(e)}function c7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Ma(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?c7(Object(n),!0).forEach(function(s){O3(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function O3(e,t,n){return t=DBe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DBe(e){var t=$Be(e,"string");return Nb(t)==="symbol"?t:String(t)}function $Be(e,t){if(Nb(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Nb(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FBe(e,t){return zBe(e)||UBe(e,t)||GQ(e,t)||BBe()}function BBe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 976In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GQ(e,t){if(e){if(typeof e=="string")return L3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L3(e,t)}}function L3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function UBe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function zBe(e){if(Array.isArray(e))return e}var Z_=function(t,n,s){return t+(n-t)*s},I3=function(t){var n=t.from,s=t.to;return n!==s},qBe=function e(t,n,s){var a=h0(function(i,o){if(I3(o)){var l=t(o.from,o.to,o.velocity),c=FBe(l,2),d=c[0],u=c[1];return Ma(Ma({},o),{},{from:d,velocity:u})}return o},n);return s<1?h0(function(i,o){return I3(o)?Ma(Ma({},o),{},{velocity:Z_(o.velocity,a[i].velocity,s),from:Z_(o.from,a[i].from,s)}):o},n):e(t,a,s-1)};const VBe=function(e,t,n,s,a){var i=bBe(e,t),o=i.reduce(function(v,g){return Ma(Ma({},v),{},O3({},g,[e[g],t[g]]))},{}),l=i.reduce(function(v,g){return Ma(Ma({},v),{},O3({},g,{from:e[g],velocity:0,to:t[g]}))},{}),c=-1,d,u,h=function(){return null},f=function(){return h0(function(g,y){return y.from},l)},m=function(){return!Object.values(l).filter(I3).length},x=function(g){d||(d=g);var y=g-d,b=y/n.dt;l=qBe(n,l,b),a(Ma(Ma(Ma({},e),t),f())),d=g,m()||(c=requestAnimationFrame(h))},p=function(g){u||(u=g);var y=(g-u)/s,b=h0(function(_,C){return Z_.apply(void 0,l7(C).concat([n(y)]))},o);if(a(Ma(Ma(Ma({},e),t),b)),y<1)c=requestAnimationFrame(h);else{var w=h0(function(_,C){return Z_.apply(void 0,l7(C).concat([n(1)]))},o);a(Ma(Ma(Ma({},e),t),w))}};return h=n.isStepper?x:p,function(){return requestAnimationFrame(h),function(){cancelAnimationFrame(c)}}};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 WBe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function HBe(e,t){if(e==null)return{};var n=GBe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function GBe(e,t){if(e==null)return{};var n={},s=Object.keys(e),a,i;for(i=0;i<s.length;i++)a=s[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Xk(e){return ZBe(e)||XBe(e)||KBe(e)||YBe()}function YBe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 977In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KBe(e,t){if(e){if(typeof e=="string")return R3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return R3(e,t)}}function XBe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ZBe(e){if(Array.isArray(e))return R3(e)}function R3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function d7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function El(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?d7(Object(n),!0).forEach(function(s){qy(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function qy(e,t,n){return t=YQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JBe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QBe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,YQ(s.key),s)}}function e9e(e,t,n){return t&&QBe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function YQ(e){var t=t9e(e,"string");return Tx(t)==="symbol"?t:String(t)}function t9e(e,t){if(Tx(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Tx(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function r9e(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&&M3(e,t)}function M3(e,t){return M3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},M3(e,t)}function n9e(e){var t=s9e();return function(){var s=J_(e),a;if(t){var i=J_(this).constructor;a=Reflect.construct(s,arguments,i)}else a=s.apply(this,arguments);return D3(this,a)}}function D3(e,t){if(t&&(Tx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $3(e)}function $3(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s9e(){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 J_(e){return J_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},J_(e)}var sd=function(e){r9e(n,e);var t=n9e(n);function n(s,a){var i;JBe(this,n),i=t.call(this,s,a);var o=i.props,l=o.isActive,c=o.attributeName,d=o.from,u=o.to,h=o.steps,f=o.children,m=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind($3(i)),i.changeStyle=i.changeStyle.bind($3(i)),!l||m<=0)return i.state={style:{}},typeof f=="function"&&(i.state={style:u}),D3(i);if(h&&h.length)i.state={style:h[0].style};else if(d){if(typeof f=="function")return i.state={style:d},D3(i);i.state={style:c?qy({},c,d):d}}else i.state={style:{}};return i}return e9e(n,[{key:"componentDidMount",value:function(){var a=this.props,i=a.isActive,o=a.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,d=i.shouldReAnimate,u=i.to,h=i.from,f=this.state.style;if(l){if(!o){var m={style:c?qy({},c,u):u};this.state&&f&&(c&&f[c]!==u||!c&&f!==u)&&this.setState(m);return}if(!(dBe(a.to,u)&&a.canBegin&&a.isActive)){var x=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var p=x||d?h:a.to;if(this.state&&f){var v={style:c?qy({},c,p):p};(c&&f[c]!==p||!c&&f!==p)&&this.setState(v)}this.runAnimation(El(El({},this.props),{},{from:p,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var i=this,o=a.from,l=a.to,c=a.duration,d=a.easing,u=a.begin,h=a.onAnimationEnd,f=a.onAnimationStart,m=VBe(o,l,LBe(d),c,this.changeStyle),x=function(){i.stopJSAnimation=m()};this.manager.start([f,u,x,c,h])}},{key:"runStepAnimation",value:function(a){var i=this,o=a.steps,l=a.begin,c=a.onAnimationStart,d=o[0],u=d.style,h=d.duration,f=h===void 0?0:h,m=function(p,v,g){if(g===0)return p;var y=v.duration,b=v.easing,w=b===void 0?"ease":b,_=v.style,C=v.properties,E=v.onAnimationEnd,N=g>0?o[g-1]:v,k=C||Object.keys(_);if(typeof w=="function"||w==="spring")return[].concat(Xk(p),[i.runJSAnimation.bind(i,{from:N.style,to:_,duration:y,easing:w}),y]);var I=a7(k,y,w),P=El(El(El({},N.style),_),{},{transition:I});return[].concat(Xk(p),[P,y,E]).filter(jBe)};return this.manager.start([c].concat(Xk(o.reduce(m,[u,Math.max(f,l)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=xBe());var i=a.begin,o=a.duration,l=a.attributeName,c=a.to,d=a.easing,u=a.onAnimationStart,h=a.onAnimationEnd,f=a.steps,m=a.children,x=this.manager;if(this.unSubscribe=x.subscribe(this.handleStyleChange),typeof d=="function"||typeof m=="function"||d==="spring"){this.runJSAnimation(a);return}if(f.length>1){this.runStepAnimation(a);return}var p=l?qy({},l,c):c,v=a7(Object.keys(p),o,d);x.start([u,i,El(El({},p),{},{transition:v}),o,h])}},{key:"render",value:function(){var a=this.props,i=a.children;a.begin;var o=a.duration;a.attributeName,a.easing;var l=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var c=HBe(a,WBe),d=j.Children.count(i),u=this.state.style;if(typeof i=="function")return i(u);if(!l||d===0||o<=0)return i;var h=function(m){var x=m.props,p=x.style,v=p===void 0?{}:p,g=x.className,y=j.cloneElement(m,El(El({},c),{},{style:El(El({},v),u),className:g}));return y};return d===1?h(j.Children.only(i)):ee.createElement("div",null,j.Children.map(i,function(f){return h(f)}))}}]),n}(j.PureComponent);sd.displayName="Animate";sd.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};sd.propTypes={from:wn.oneOfType([wn.object,wn.string]),to:wn.oneOfType([wn.object,wn.string]),attributeName:wn.string,duration:wn.number,begin:wn.number,easing:wn.oneOfType([wn.string,wn.func]),steps:wn.arrayOf(wn.shape({duration:wn.number.isRequired,style:wn.object.isRequired,easing:wn.oneOfType([wn.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),wn.func]),properties:wn.arrayOf("string"),onAnimationEnd:wn.func})),children:wn.oneOfType([wn.node,wn.func]),isActive:wn.bool,canBegin:wn.bool,onAnimationEnd:wn.func,shouldReAnimate:wn.bool,onAnimationStart:wn.func,onAnimationReStart:wn.func};function _b(e){"@babel/helpers - typeof";return _b=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},_b(e)}function Q_(){return Q_=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Q_.apply(this,arguments)}function a9e(e,t){return c9e(e)||l9e(e,t)||o9e(e,t)||i9e()}function i9e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 978In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o9e(e,t){if(e){if(typeof e=="string")return u7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u7(e,t)}}function u7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function l9e(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function c9e(e){if(Array.isArray(e))return e}function h7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function f7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?h7(Object(n),!0).forEach(function(s){d9e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function d9e(e,t,n){return t=u9e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u9e(e){var t=h9e(e,"string");return _b(t)=="symbol"?t:t+""}function h9e(e,t){if(_b(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(_b(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var m7=function(t,n,s,a,i){var o=Math.min(Math.abs(s)/2,Math.abs(a)/2),l=a>=0?1:-1,c=s>=0?1:-1,d=a>=0&&s>=0||a<0&&s<0?1:0,u;if(o>0&&i instanceof Array){for(var h=[0,0,0,0],f=0,m=4;f<m;f++)h[f]=i[f]>o?o:i[f];u="M".concat(t,",").concat(n+l*h[0]),h[0]>0&&(u+="A ".concat(h[0],",").concat(h[0],",0,0,").concat(d,",").concat(t+c*h[0],",").concat(n)),u+="L ".concat(t+s-c*h[1],",").concat(n),h[1]>0&&(u+="A ".concat(h[1],",").concat(h[1],",0,0,").concat(d,`, 979 `).concat(t+s,",").concat(n+l*h[1])),u+="L ".concat(t+s,",").concat(n+a-l*h[2]),h[2]>0&&(u+="A ".concat(h[2],",").concat(h[2],",0,0,").concat(d,`, 980 `).concat(t+s-c*h[2],",").concat(n+a)),u+="L ".concat(t+c*h[3],",").concat(n+a),h[3]>0&&(u+="A ".concat(h[3],",").concat(h[3],",0,0,").concat(d,`, 981 `).concat(t,",").concat(n+a-l*h[3])),u+="Z"}else if(o>0&&i===+i&&i>0){var x=Math.min(o,i);u="M ".concat(t,",").concat(n+l*x,` 982 A `).concat(x,",").concat(x,",0,0,").concat(d,",").concat(t+c*x,",").concat(n,` 983 L `).concat(t+s-c*x,",").concat(n,` 984 A `).concat(x,",").concat(x,",0,0,").concat(d,",").concat(t+s,",").concat(n+l*x,` 985 L `).concat(t+s,",").concat(n+a-l*x,` 986 A `).concat(x,",").concat(x,",0,0,").concat(d,",").concat(t+s-c*x,",").concat(n+a,` 987 L `).concat(t+c*x,",").concat(n+a,` 988 A `).concat(x,",").concat(x,",0,0,").concat(d,",").concat(t,",").concat(n+a-l*x," Z")}else u="M ".concat(t,",").concat(n," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return u},f9e=function(t,n){if(!t||!n)return!1;var s=t.x,a=t.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var d=Math.min(i,i+l),u=Math.max(i,i+l),h=Math.min(o,o+c),f=Math.max(o,o+c);return s>=d&&s<=u&&a>=h&&a<=f}return!1},m9e={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},pL=function(t){var n=f7(f7({},m9e),t),s=j.useRef(),a=j.useState(-1),i=a9e(a,2),o=i[0],l=i[1];j.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var w=s.current.getTotalLength();w&&l(w)}catch{}},[]);var c=n.x,d=n.y,u=n.width,h=n.height,f=n.radius,m=n.className,x=n.animationEasing,p=n.animationDuration,v=n.animationBegin,g=n.isAnimationActive,y=n.isUpdateAnimationActive;if(c!==+c||d!==+d||u!==+u||h!==+h||u===0||h===0)return null;var b=Mr("recharts-rectangle",m);return y?ee.createElement(sd,{canBegin:o>0,from:{width:u,height:h,x:c,y:d},to:{width:u,height:h,x:c,y:d},duration:p,animationEasing:x,isActive:y},function(w){var _=w.width,C=w.height,E=w.x,N=w.y;return ee.createElement(sd,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:p,isActive:g,easing:x},ee.createElement("path",Q_({},cr(n,!0),{className:b,d:m7(E,N,_,C,f),ref:s})))}):ee.createElement("path",Q_({},cr(n,!0),{className:b,d:m7(c,d,u,h,f)}))},p9e=["points","className","baseLinePoints","connectNulls"];function pg(){return pg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},pg.apply(this,arguments)}function g9e(e,t){if(e==null)return{};var n=x9e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function x9e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function p7(e){return j9e(e)||b9e(e)||y9e(e)||v9e()}function v9e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 989In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y9e(e,t){if(e){if(typeof e=="string")return F3(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F3(e,t)}}function b9e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function j9e(e){if(Array.isArray(e))return F3(e)}function F3(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var g7=function(t){return t&&t.x===+t.x&&t.y===+t.y},w9e=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(s){g7(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),g7(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},f0=function(t,n){var s=w9e(t);n&&(s=[s.reduce(function(i,o){return[].concat(p7(i),p7(o))},[])]);var a=s.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return s.length===1?"".concat(a,"Z"):a},N9e=function(t,n,s){var a=f0(t,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(f0(n.reverse(),s).slice(1))},_9e=function(t){var n=t.points,s=t.className,a=t.baseLinePoints,i=t.connectNulls,o=g9e(t,p9e);if(!n||!n.length)return null;var l=Mr("recharts-polygon",s);if(a&&a.length){var c=o.stroke&&o.stroke!=="none",d=N9e(n,a,i);return ee.createElement("g",{className:l},ee.createElement("path",pg({},cr(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",stroke:"none",d})),c?ee.createElement("path",pg({},cr(o,!0),{fill:"none",d:f0(n,i)})):null,c?ee.createElement("path",pg({},cr(o,!0),{fill:"none",d:f0(a,i)})):null)}var u=f0(n,i);return ee.createElement("path",pg({},cr(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",className:l,d:u}))};function B3(){return B3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},B3.apply(this,arguments)}var f5=function(t){var n=t.cx,s=t.cy,a=t.r,i=t.className,o=Mr("recharts-dot",i);return n===+n&&s===+s&&a===+a?j.createElement("circle",B3({},cr(t,!1),y_(t),{className:o,cx:n,cy:s,r:a})):null};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)}var S9e=["x","y","top","left","width","height","className"];function U3(){return U3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},U3.apply(this,arguments)}function x7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function k9e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?x7(Object(n),!0).forEach(function(s){C9e(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function C9e(e,t,n){return t=A9e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A9e(e){var t=P9e(e,"string");return Sb(t)=="symbol"?t:t+""}function P9e(e,t){if(Sb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Sb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function E9e(e,t){if(e==null)return{};var n=T9e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function T9e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var O9e=function(t,n,s,a,i,o){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(o,",").concat(n,"h").concat(s)},L9e=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,i=a===void 0?0:a,o=t.top,l=o===void 0?0:o,c=t.left,d=c===void 0?0:c,u=t.width,h=u===void 0?0:u,f=t.height,m=f===void 0?0:f,x=t.className,p=E9e(t,S9e),v=k9e({x:s,y:i,top:l,left:d,width:h,height:m},p);return!vt(s)||!vt(i)||!vt(h)||!vt(m)||!vt(l)||!vt(d)?null:ee.createElement("path",U3({},cr(v,!0),{className:Mr("recharts-cross",x),d:O9e(s,i,h,m,l,d)}))},I9e=l5,R9e=iQ,M9e=od;function D9e(e,t){return e&&e.length?I9e(e,M9e(t),R9e):void 0}var $9e=D9e;const F9e=_n($9e);var B9e=l5,U9e=od,z9e=oQ;function q9e(e,t){return e&&e.length?B9e(e,U9e(t),z9e):void 0}var V9e=q9e;const W9e=_n(V9e);var H9e=["cx","cy","angle","ticks","axisLine"],G9e=["ticks","tick","angle","tickFormatter","stroke"];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 m0(){return m0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},m0.apply(this,arguments)}function v7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Af(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?v7(Object(n),!0).forEach(function(s){m5(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function y7(e,t){if(e==null)return{};var n=Y9e(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Y9e(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function K9e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b7(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,XQ(s.key),s)}}function X9e(e,t,n){return t&&b7(e.prototype,t),n&&b7(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Z9e(e,t,n){return t=e2(t),J9e(e,KQ()?Reflect.construct(t,n||[],e2(e).constructor):t.apply(e,n))}function J9e(e,t){if(t&&(Ox(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Q9e(e)}function Q9e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function KQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KQ=function(){return!!e})()}function e2(e){return e2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},e2(e)}function eUe(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&&z3(e,t)}function z3(e,t){return z3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},z3(e,t)}function m5(e,t,n){return t=XQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XQ(e){var t=tUe(e,"string");return Ox(t)=="symbol"?t:t+""}function tUe(e,t){if(Ox(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Ox(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var p5=function(e){function t(){return K9e(this,t),Z9e(this,t,arguments)}return eUe(t,e),X9e(t,[{key:"getTickValueCoord",value:function(s){var a=s.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return Qn(l,c,a,o)}},{key:"getTickTextAnchor",value:function(){var s=this.props.orientation,a;switch(s){case"left":a="end";break;case"right":a="start";break;default:a="middle";break}return a}},{key:"getViewBox",value:function(){var s=this.props,a=s.cx,i=s.cy,o=s.angle,l=s.ticks,c=F9e(l,function(u){return u.coordinate||0}),d=W9e(l,function(u){return u.coordinate||0});return{cx:a,cy:i,startAngle:o,endAngle:o,innerRadius:d.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,i=s.cy,o=s.angle,l=s.ticks,c=s.axisLine,d=y7(s,H9e),u=l.reduce(function(x,p){return[Math.min(x[0],p.coordinate),Math.max(x[1],p.coordinate)]},[1/0,-1/0]),h=Qn(a,i,u[0],o),f=Qn(a,i,u[1],o),m=Af(Af(Af({},cr(d,!1)),{},{fill:"none"},cr(c,!1)),{},{x1:h.x,y1:h.y,x2:f.x,y2:f.y});return ee.createElement("line",m0({className:"recharts-polar-radius-axis-line"},m))}},{key:"renderTicks",value:function(){var s=this,a=this.props,i=a.ticks,o=a.tick,l=a.angle,c=a.tickFormatter,d=a.stroke,u=y7(a,G9e),h=this.getTickTextAnchor(),f=cr(u,!1),m=cr(o,!1),x=i.map(function(p,v){var g=s.getTickValueCoord(p),y=Af(Af(Af(Af({textAnchor:h,transform:"rotate(".concat(90-l,", ").concat(g.x,", ").concat(g.y,")")},f),{},{stroke:"none",fill:d},m),{},{index:v},g),{},{payload:p});return ee.createElement(xn,m0({className:Mr("recharts-polar-radius-axis-tick",RQ(o)),key:"tick-".concat(p.coordinate)},Mm(s.props,p,v)),t.renderTickItem(o,y,c?c(p.value,v):p.value))});return ee.createElement(xn,{className:"recharts-polar-radius-axis-ticks"},x)}},{key:"render",value:function(){var s=this.props,a=s.ticks,i=s.axisLine,o=s.tick;return!a||!a.length?null:ee.createElement(xn,{className:Mr("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),ka.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(s,a,i){var o;return ee.isValidElement(s)?o=ee.cloneElement(s,a):Nr(s)?o=s(a):o=ee.createElement(Dm,m0({},a,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(j.PureComponent);m5(p5,"displayName","PolarRadiusAxis");m5(p5,"axisType","radiusAxis");m5(p5,"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 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 qf(){return qf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},qf.apply(this,arguments)}function j7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Pf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?j7(Object(n),!0).forEach(function(s){g5(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function rUe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w7(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,JQ(s.key),s)}}function nUe(e,t,n){return t&&w7(e.prototype,t),n&&w7(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function sUe(e,t,n){return t=t2(t),aUe(e,ZQ()?Reflect.construct(t,n||[],t2(e).constructor):t.apply(e,n))}function aUe(e,t){if(t&&(Lx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iUe(e)}function iUe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ZQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZQ=function(){return!!e})()}function t2(e){return t2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},t2(e)}function oUe(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&&q3(e,t)}function q3(e,t){return q3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},q3(e,t)}function g5(e,t,n){return t=JQ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function JQ(e){var t=lUe(e,"string");return Lx(t)=="symbol"?t:t+""}function lUe(e,t){if(Lx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Lx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var cUe=Math.PI/180,N7=1e-5,x5=function(e){function t(){return rUe(this,t),sUe(this,t,arguments)}return oUe(t,e),nUe(t,[{key:"getTickLineCoord",value:function(s){var a=this.props,i=a.cx,o=a.cy,l=a.radius,c=a.orientation,d=a.tickSize,u=d||8,h=Qn(i,o,l,s.coordinate),f=Qn(i,o,l+(c==="inner"?-1:1)*u,s.coordinate);return{x1:h.x,y1:h.y,x2:f.x,y2:f.y}}},{key:"getTickTextAnchor",value:function(s){var a=this.props.orientation,i=Math.cos(-s.coordinate*cUe),o;return i>N7?o=a==="outer"?"start":"end":i<-N7?o=a==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,i=s.cy,o=s.radius,l=s.axisLine,c=s.axisLineType,d=Pf(Pf({},cr(this.props,!1)),{},{fill:"none"},cr(l,!1));if(c==="circle")return ee.createElement(f5,qf({className:"recharts-polar-angle-axis-line"},d,{cx:a,cy:i,r:o}));var u=this.props.ticks,h=u.map(function(f){return Qn(a,i,o,f.coordinate)});return ee.createElement(_9e,qf({className:"recharts-polar-angle-axis-line"},d,{points:h}))}},{key:"renderTicks",value:function(){var s=this,a=this.props,i=a.ticks,o=a.tick,l=a.tickLine,c=a.tickFormatter,d=a.stroke,u=cr(this.props,!1),h=cr(o,!1),f=Pf(Pf({},u),{},{fill:"none"},cr(l,!1)),m=i.map(function(x,p){var v=s.getTickLineCoord(x),g=s.getTickTextAnchor(x),y=Pf(Pf(Pf({textAnchor:g},u),{},{stroke:"none",fill:d},h),{},{index:p,payload:x,x:v.x2,y:v.y2});return ee.createElement(xn,qf({className:Mr("recharts-polar-angle-axis-tick",RQ(o)),key:"tick-".concat(x.coordinate)},Mm(s.props,x,p)),l&&ee.createElement("line",qf({className:"recharts-polar-angle-axis-tick-line"},f,v)),o&&t.renderTickItem(o,y,c?c(x.value,p):x.value))});return ee.createElement(xn,{className:"recharts-polar-angle-axis-ticks"},m)}},{key:"render",value:function(){var s=this.props,a=s.ticks,i=s.radius,o=s.axisLine;return i<=0||!a||!a.length?null:ee.createElement(xn,{className:Mr("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,a,i){var o;return ee.isValidElement(s)?o=ee.cloneElement(s,a):Nr(s)?o=s(a):o=ee.createElement(Dm,qf({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(j.PureComponent);g5(x5,"displayName","PolarAngleAxis");g5(x5,"axisType","angleAxis");g5(x5,"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 dUe=rJ,uUe=dUe(Object.getPrototypeOf,Object),hUe=uUe,fUe=du,mUe=hUe,pUe=uu,gUe="[object Object]",xUe=Function.prototype,vUe=Object.prototype,QQ=xUe.toString,yUe=vUe.hasOwnProperty,bUe=QQ.call(Object);function jUe(e){if(!pUe(e)||fUe(e)!=gUe)return!1;var t=mUe(e);if(t===null)return!0;var n=yUe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&QQ.call(n)==bUe}var wUe=jUe;const NUe=_n(wUe);var _Ue=du,SUe=uu,kUe="[object Boolean]";function CUe(e){return e===!0||e===!1||SUe(e)&&_Ue(e)==kUe}var AUe=CUe;const PUe=_n(AUe);function kb(e){"@babel/helpers - typeof";return kb=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},kb(e)}function r2(){return r2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},r2.apply(this,arguments)}function EUe(e,t){return IUe(e)||LUe(e,t)||OUe(e,t)||TUe()}function TUe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 990In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function OUe(e,t){if(e){if(typeof e=="string")return _7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _7(e,t)}}function _7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function LUe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function IUe(e){if(Array.isArray(e))return e}function S7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function k7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?S7(Object(n),!0).forEach(function(s){RUe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function RUe(e,t,n){return t=MUe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function MUe(e){var t=DUe(e,"string");return kb(t)=="symbol"?t:t+""}function DUe(e,t){if(kb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(kb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var C7=function(t,n,s,a,i){var o=s-a,l;return l="M ".concat(t,",").concat(n),l+="L ".concat(t+s,",").concat(n),l+="L ".concat(t+s-o/2,",").concat(n+i),l+="L ".concat(t+s-o/2-a,",").concat(n+i),l+="L ".concat(t,",").concat(n," Z"),l},$Ue={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},FUe=function(t){var n=k7(k7({},$Ue),t),s=j.useRef(),a=j.useState(-1),i=EUe(a,2),o=i[0],l=i[1];j.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var b=s.current.getTotalLength();b&&l(b)}catch{}},[]);var c=n.x,d=n.y,u=n.upperWidth,h=n.lowerWidth,f=n.height,m=n.className,x=n.animationEasing,p=n.animationDuration,v=n.animationBegin,g=n.isUpdateAnimationActive;if(c!==+c||d!==+d||u!==+u||h!==+h||f!==+f||u===0&&h===0||f===0)return null;var y=Mr("recharts-trapezoid",m);return g?ee.createElement(sd,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:f,x:c,y:d},to:{upperWidth:u,lowerWidth:h,height:f,x:c,y:d},duration:p,animationEasing:x,isActive:g},function(b){var w=b.upperWidth,_=b.lowerWidth,C=b.height,E=b.x,N=b.y;return ee.createElement(sd,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:p,easing:x},ee.createElement("path",r2({},cr(n,!0),{className:y,d:C7(E,N,w,_,C),ref:s})))}):ee.createElement("g",null,ee.createElement("path",r2({},cr(n,!0),{className:y,d:C7(c,d,u,h,f)})))},BUe=["option","shapeType","propTransformer","activeClassName","isActive"];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 UUe(e,t){if(e==null)return{};var n=zUe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function zUe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function A7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function n2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?A7(Object(n),!0).forEach(function(s){qUe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function qUe(e,t,n){return t=VUe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VUe(e){var t=WUe(e,"string");return Cb(t)=="symbol"?t:t+""}function WUe(e,t){if(Cb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Cb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HUe(e,t){return n2(n2({},t),e)}function GUe(e,t){return e==="symbols"}function P7(e){var t=e.shapeType,n=e.elementProps;switch(t){case"rectangle":return ee.createElement(pL,n);case"trapezoid":return ee.createElement(FUe,n);case"sector":return ee.createElement($Q,n);case"symbols":if(GUe(t))return ee.createElement(I6,n);break;default:return null}}function YUe(e){return j.isValidElement(e)?e.props:e}function eee(e){var t=e.option,n=e.shapeType,s=e.propTransformer,a=s===void 0?HUe:s,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=UUe(e,BUe),d;if(j.isValidElement(t))d=j.cloneElement(t,n2(n2({},c),YUe(t)));else if(Nr(t))d=t(c);else if(NUe(t)&&!PUe(t)){var u=a(t,c);d=ee.createElement(P7,{shapeType:n,elementProps:u})}else{var h=c;d=ee.createElement(P7,{shapeType:n,elementProps:h})}return l?ee.createElement(xn,{className:o},d):d}function v5(e,t){return t!=null&&"trapezoids"in e.props}function y5(e,t){return t!=null&&"sectors"in e.props}function Ab(e,t){return t!=null&&"points"in e.props}function KUe(e,t){var n,s,a=e.x===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.x)||e.x===t.x,i=e.y===(t==null||(s=t.labelViewBox)===null||s===void 0?void 0:s.y)||e.y===t.y;return a&&i}function XUe(e,t){var n=e.endAngle===t.endAngle,s=e.startAngle===t.startAngle;return n&&s}function ZUe(e,t){var n=e.x===t.x,s=e.y===t.y,a=e.z===t.z;return n&&s&&a}function JUe(e,t){var n;return v5(e,t)?n=KUe:y5(e,t)?n=XUe:Ab(e,t)&&(n=ZUe),n}function QUe(e,t){var n;return v5(e,t)?n="trapezoids":y5(e,t)?n="sectors":Ab(e,t)&&(n="points"),n}function eze(e,t){if(v5(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}if(y5(e,t)){var s;return(s=t.tooltipPayload)===null||s===void 0||(s=s[0])===null||s===void 0||(s=s.payload)===null||s===void 0?void 0:s.payload}return Ab(e,t)?t.payload:{}}function tze(e){var t=e.activeTooltipItem,n=e.graphicalItem,s=e.itemData,a=QUe(n,t),i=eze(n,t),o=s.filter(function(c,d){var u=zj(i,c),h=n.props[a].filter(function(x){var p=JUe(n,t);return p(x,t)}),f=n.props[a].indexOf(h[h.length-1]),m=d===f;return u&&m}),l=s.indexOf(o[o.length-1]);return l}var iN;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 gg(){return gg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},gg.apply(this,arguments)}function E7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Kn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?E7(Object(n),!0).forEach(function(s){al(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function rze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T7(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,ree(s.key),s)}}function nze(e,t,n){return t&&T7(e.prototype,t),n&&T7(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function sze(e,t,n){return t=s2(t),aze(e,tee()?Reflect.construct(t,n||[],s2(e).constructor):t.apply(e,n))}function aze(e,t){if(t&&(Ix(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ize(e)}function ize(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tee=function(){return!!e})()}function s2(e){return s2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},s2(e)}function oze(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&&V3(e,t)}function V3(e,t){return V3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},V3(e,t)}function al(e,t,n){return t=ree(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ree(e){var t=lze(e,"string");return Ix(t)=="symbol"?t:t+""}function lze(e,t){if(Ix(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Ix(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fu=function(e){function t(n){var s;return rze(this,t),s=sze(this,t,[n]),al(s,"pieRef",null),al(s,"sectorRefs",[]),al(s,"id",bv("recharts-pie-")),al(s,"handleAnimationEnd",function(){var a=s.props.onAnimationEnd;s.setState({isAnimationFinished:!0}),Nr(a)&&a()}),al(s,"handleAnimationStart",function(){var a=s.props.onAnimationStart;s.setState({isAnimationFinished:!1}),Nr(a)&&a()}),s.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},s}return oze(t,e),nze(t,[{key:"isActiveIndex",value:function(s){var a=this.props.activeIndex;return Array.isArray(a)?a.indexOf(s)!==-1:s===a}},{key:"hasActiveIndex",value:function(){var s=this.props.activeIndex;return Array.isArray(s)?s.length!==0:s||s===0}},{key:"renderLabels",value:function(s){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.label,l=i.labelLine,c=i.dataKey,d=i.valueKey,u=cr(this.props,!1),h=cr(o,!1),f=cr(l,!1),m=o&&o.offsetRadius||20,x=s.map(function(p,v){var g=(p.startAngle+p.endAngle)/2,y=Qn(p.cx,p.cy,p.outerRadius+m,g),b=Kn(Kn(Kn(Kn({},u),p),{},{stroke:"none"},h),{},{index:v,textAnchor:t.getTextAnchor(y.x,p.cx)},y),w=Kn(Kn(Kn(Kn({},u),p),{},{fill:"none",stroke:p.fill},f),{},{index:v,points:[Qn(p.cx,p.cy,p.outerRadius,g),y]}),_=c;return Or(c)&&Or(d)?_="value":Or(c)&&(_=d),ee.createElement(xn,{key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(v)},l&&t.renderLabelLineItem(l,w,"line"),t.renderLabelItem(o,b,pa(p,_)))});return ee.createElement(xn,{className:"recharts-pie-labels"},x)}},{key:"renderSectorsStatically",value:function(s){var a=this,i=this.props,o=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return s.map(function(d,u){if((d==null?void 0:d.startAngle)===0&&(d==null?void 0:d.endAngle)===0&&s.length!==1)return null;var h=a.isActiveIndex(u),f=c&&a.hasActiveIndex()?c:null,m=h?o:f,x=Kn(Kn({},d),{},{stroke:l?d.fill:d.stroke,tabIndex:-1});return ee.createElement(xn,gg({ref:function(v){v&&!a.sectorRefs.includes(v)&&a.sectorRefs.push(v)},tabIndex:-1,className:"recharts-pie-sector"},Mm(a.props,d,u),{key:"sector-".concat(d==null?void 0:d.startAngle,"-").concat(d==null?void 0:d.endAngle,"-").concat(d.midAngle,"-").concat(u)}),ee.createElement(eee,gg({option:m,isActive:h,shapeType:"sector"},x)))})}},{key:"renderSectorsWithAnimation",value:function(){var s=this,a=this.props,i=a.sectors,o=a.isAnimationActive,l=a.animationBegin,c=a.animationDuration,d=a.animationEasing,u=a.animationId,h=this.state,f=h.prevSectors,m=h.prevIsAnimationActive;return ee.createElement(sd,{begin:l,duration:c,isActive:o,easing:d,from:{t:0},to:{t:1},key:"pie-".concat(u,"-").concat(m),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(x){var p=x.t,v=[],g=i&&i[0],y=g.startAngle;return i.forEach(function(b,w){var _=f&&f[w],C=w>0?Mo(b,"paddingAngle",0):0;if(_){var E=ko(_.endAngle-_.startAngle,b.endAngle-b.startAngle),N=Kn(Kn({},b),{},{startAngle:y+C,endAngle:y+E(p)+C});v.push(N),y=N.endAngle}else{var k=b.endAngle,I=b.startAngle,P=ko(0,k-I),O=P(p),A=Kn(Kn({},b),{},{startAngle:y+C,endAngle:y+O+C});v.push(A),y=A.endAngle}}),ee.createElement(xn,null,s.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(s){var a=this;s.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[o].focus(),a.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,a=s.sectors,i=s.isAnimationActive,o=this.state.prevSectors;return i&&a&&a.length&&(!o||!zj(o,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,a=this.props,i=a.hide,o=a.sectors,l=a.className,c=a.label,d=a.cx,u=a.cy,h=a.innerRadius,f=a.outerRadius,m=a.isAnimationActive,x=this.state.isAnimationFinished;if(i||!o||!o.length||!vt(d)||!vt(u)||!vt(h)||!vt(f))return null;var p=Mr("recharts-pie",l);return ee.createElement(xn,{tabIndex:this.props.rootTabIndex,className:p,ref:function(g){s.pieRef=g}},this.renderSectors(),c&&this.renderLabels(o),ka.renderCallByParent(this.props,null,!1),(!m||x)&&Yd.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return a.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:s.sectors!==a.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,a){return s>a?"start":s<a?"end":"middle"}},{key:"renderLabelLineItem",value:function(s,a,i){if(ee.isValidElement(s))return ee.cloneElement(s,a);if(Nr(s))return s(a);var o=Mr("recharts-pie-label-line",typeof s!="boolean"?s.className:"");return ee.createElement(K_,gg({},a,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(s,a,i){if(ee.isValidElement(s))return ee.cloneElement(s,a);var o=i;if(Nr(s)&&(o=s(a),ee.isValidElement(o)))return o;var l=Mr("recharts-pie-label-text",typeof s!="boolean"&&!Nr(s)?s.className:"");return ee.createElement(Dm,gg({},a,{alignmentBaseline:"middle",className:l}),o)}}])}(j.PureComponent);iN=fu;al(fu,"displayName","Pie");al(fu,"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:!Gc.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});al(fu,"parseDeltaAngle",function(e,t){var n=Ni(t-e),s=Math.min(Math.abs(t-e),360);return n*s});al(fu,"getRealPieData",function(e){var t=e.data,n=e.children,s=cr(e,!1),a=Do(n,t5);return t&&t.length?t.map(function(i,o){return Kn(Kn(Kn({payload:i},s),i),a&&a[o]&&a[o].props)}):a&&a.length?a.map(function(i){return Kn(Kn({},s),i.props)}):[]});al(fu,"parseCoordinateOfPie",function(e,t){var n=t.top,s=t.left,a=t.width,i=t.height,o=IQ(a,i),l=s+_i(e.cx,a,a/2),c=n+_i(e.cy,i,i/2),d=_i(e.innerRadius,o,0),u=_i(e.outerRadius,o,o*.8),h=e.maxRadius||Math.sqrt(a*a+i*i)/2;return{cx:l,cy:c,innerRadius:d,outerRadius:u,maxRadius:h}});al(fu,"getComposedData",function(e){var t=e.item,n=e.offset,s=t.type.defaultProps!==void 0?Kn(Kn({},t.type.defaultProps),t.props):t.props,a=iN.getRealPieData(s);if(!a||!a.length)return null;var i=s.cornerRadius,o=s.startAngle,l=s.endAngle,c=s.paddingAngle,d=s.dataKey,u=s.nameKey,h=s.valueKey,f=s.tooltipType,m=Math.abs(s.minAngle),x=iN.parseCoordinateOfPie(s,n),p=iN.parseDeltaAngle(o,l),v=Math.abs(p),g=d;Or(d)&&Or(h)?(Jl(!1,`Use "dataKey" to specify the value of pie,
991 the props "valueKey" will be deprecated in 1.1.0`),g="value"):Or(d)&&(Jl(!1,`Use "dataKey" to specify the value of pie, 992 the props "valueKey" will be deprecated in 1.1.0`),g=h);var y=a.filter(function(N){return pa(N,g,0)!==0}).length,b=(v>=360?y:y-1)*c,w=v-y*m-b,_=a.reduce(function(N,k){var I=pa(k,g,0);return N+(vt(I)?I:0)},0),C;if(_>0){var E;C=a.map(function(N,k){var I=pa(N,g,0),P=pa(N,u,k),O=(vt(I)?I:0)/_,A;k?A=E.endAngle+Ni(p)*c*(I!==0?1:0):A=o;var R=A+Ni(p)*((I!==0?m:0)+O*w),L=(A+R)/2,z=(x.innerRadius+x.outerRadius)/2,U=[{name:P,value:I,payload:N,dataKey:g,type:f}],$=Qn(x.cx,x.cy,z,L);return E=Kn(Kn(Kn({percent:O,cornerRadius:i,name:P,tooltipPayload:U,midAngle:L,middleRadius:z,tooltipPosition:$},N),x),{},{value:pa(N,g),startAngle:A,endAngle:R,payload:N,paddingAngle:Ni(p)*c}),E})}return Kn(Kn({},x),{},{sectors:C,data:a})});var cze=Math.ceil,dze=Math.max;function uze(e,t,n,s){for(var a=-1,i=dze(cze((t-e)/(n||1)),0),o=Array(i);i--;)o[s?i:++a]=e,e+=n;return o}var hze=uze,fze=jJ,O7=1/0,mze=17976931348623157e292;function pze(e){if(!e)return e===0?e:0;if(e=fze(e),e===O7||e===-O7){var t=e<0?-1:1;return t*mze}return e===e?e:0}var nee=pze,gze=hze,xze=e5,Zk=nee;function vze(e){return function(t,n,s){return s&&typeof s!="number"&&xze(t,n,s)&&(n=s=void 0),t=Zk(t),n===void 0?(n=t,t=0):n=Zk(n),s=s===void 0?t<n?1:-1:Zk(s),gze(t,n,s,e)}}var yze=vze,bze=yze,jze=bze(),wze=jze;const a2=_n(wze);function Pb(e){"@babel/helpers - typeof";return Pb=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},Pb(e)}function L7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function I7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?L7(Object(n),!0).forEach(function(s){see(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function see(e,t,n){return t=Nze(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nze(e){var t=_ze(e,"string");return Pb(t)=="symbol"?t:t+""}function _ze(e,t){if(Pb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Pb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Sze=["Webkit","Moz","O","ms"],kze=function(t,n){var s=t.replace(/(\w)/,function(i){return i.toUpperCase()}),a=Sze.reduce(function(i,o){return I7(I7({},i),{},see({},o+s,n))},{});return a[t]=n,a};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 i2(){return i2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},i2.apply(this,arguments)}function R7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Jk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R7(Object(n),!0).forEach(function(s){bo(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Cze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M7(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,iee(s.key),s)}}function Aze(e,t,n){return t&&M7(e.prototype,t),n&&M7(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pze(e,t,n){return t=o2(t),Eze(e,aee()?Reflect.construct(t,n||[],o2(e).constructor):t.apply(e,n))}function Eze(e,t){if(t&&(Rx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tze(e)}function Tze(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function aee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(aee=function(){return!!e})()}function o2(e){return o2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},o2(e)}function Oze(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&&W3(e,t)}function W3(e,t){return W3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},W3(e,t)}function bo(e,t,n){return t=iee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iee(e){var t=Lze(e,"string");return Rx(t)=="symbol"?t:t+""}function Lze(e,t){if(Rx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Rx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ize=function(t){var n=t.data,s=t.startIndex,a=t.endIndex,i=t.x,o=t.width,l=t.travellerWidth;if(!n||!n.length)return{};var c=n.length,d=d0().domain(a2(0,c)).range([i,i+o-l]),u=d.domain().map(function(h){return d(h)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:d(s),endX:d(a),scale:d,scaleValues:u}},D7=function(t){return t.changedTouches&&!!t.changedTouches.length},Mx=function(e){function t(n){var s;return Cze(this,t),s=Pze(this,t,[n]),bo(s,"handleDrag",function(a){s.leaveTimer&&(clearTimeout(s.leaveTimer),s.leaveTimer=null),s.state.isTravellerMoving?s.handleTravellerMove(a):s.state.isSlideMoving&&s.handleSlideDrag(a)}),bo(s,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&s.handleDrag(a.changedTouches[0])}),bo(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=s.props,i=a.endIndex,o=a.onDragEnd,l=a.startIndex;o==null||o({endIndex:i,startIndex:l})}),s.detachDragEndListener()}),bo(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),bo(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),bo(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),bo(s,"handleSlideDragStart",function(a){var i=D7(a)?a.changedTouches[0]:a;s.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),s.attachDragEndListener()}),s.travellerDragStartHandlers={startX:s.handleTravellerDragStart.bind(s,"startX"),endX:s.handleTravellerDragStart.bind(s,"endX")},s.state={},s}
vendor: 118,601 bytes, lines 992-997
992return Oze(t,e),Aze(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var a=s.startX,i=s.endX,o=this.state.scaleValues,l=this.props,c=l.gap,d=l.data,u=d.length-1,h=Math.min(a,i),f=Math.max(a,i),m=t.getIndexInRange(o,h),x=t.getIndexInRange(o,f);return{startIndex:m-m%c,endIndex:x===u?u:x-x%c}}},{key:"getTextOfTick",value:function(s){var a=this.props,i=a.data,o=a.tickFormatter,l=a.dataKey,c=pa(i[s],l,s);return Nr(o)?o(c,s):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(s){var a=this.state,i=a.slideMoveStartX,o=a.startX,l=a.endX,c=this.props,d=c.x,u=c.width,h=c.travellerWidth,f=c.startIndex,m=c.endIndex,x=c.onChange,p=s.pageX-i;p>0?p=Math.min(p,d+u-h-l,d+u-h-o):p<0&&(p=Math.max(p,d-o,d-l));var v=this.getIndex({startX:o+p,endX:l+p});(v.startIndex!==f||v.endIndex!==m)&&x&&x(v),this.setState({startX:o+p,endX:l+p,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var i=D7(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var a=this.state,i=a.brushMoveStartX,o=a.movingTravellerId,l=a.endX,c=a.startX,d=this.state[o],u=this.props,h=u.x,f=u.width,m=u.travellerWidth,x=u.onChange,p=u.gap,v=u.data,g={startX:this.state.startX,endX:this.state.endX},y=s.pageX-i;y>0?y=Math.min(y,h+f-m-d):y<0&&(y=Math.max(y,h-d)),g[o]=d+y;var b=this.getIndex(g),w=b.startIndex,_=b.endIndex,C=function(){var N=v.length-1;return o==="startX"&&(l>c?w%p===0:_%p===0)||l<c&&_===N||o==="endX"&&(l>c?_%p===0:w%p===0)||l>c&&_===N};this.setState(bo(bo({},o,d+y),"brushMoveStartX",s.pageX),function(){x&&C()&&x(b)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var i=this,o=this.state,l=o.scaleValues,c=o.startX,d=o.endX,u=this.state[a],h=l.indexOf(u);if(h!==-1){var f=h+s;if(!(f===-1||f>=l.length)){var m=l[f];a==="startX"&&m>=d||a==="endX"&&m<=c||this.setState(bo({},a,m),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.fill,d=s.stroke;return ee.createElement("rect",{stroke:d,fill:c,x:a,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.data,d=s.children,u=s.padding,h=j.Children.only(d);return h?ee.cloneElement(h,{x:a,y:i,width:o,height:l,margin:u,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(s,a){var i,o,l=this,c=this.props,d=c.y,u=c.travellerWidth,h=c.height,f=c.traveller,m=c.ariaLabel,x=c.data,p=c.startIndex,v=c.endIndex,g=Math.max(s,this.props.x),y=Jk(Jk({},cr(this.props,!1)),{},{x:g,y:d,width:u,height:h}),b=m||"Min value: ".concat((i=x[p])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=x[v])===null||o===void 0?void 0:o.name);return ee.createElement(xn,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(_){["ArrowLeft","ArrowRight"].includes(_.key)&&(_.preventDefault(),_.stopPropagation(),l.handleTravellerMoveKeyboard(_.key==="ArrowRight"?1:-1,a))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(f,y))}},{key:"renderSlide",value:function(s,a){var i=this.props,o=i.y,l=i.height,c=i.stroke,d=i.travellerWidth,u=Math.min(s,a)+d,h=Math.max(Math.abs(a-s)-d,0);return ee.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:u,y:o,width:h,height:l})}},{key:"renderText",value:function(){var s=this.props,a=s.startIndex,i=s.endIndex,o=s.y,l=s.height,c=s.travellerWidth,d=s.stroke,u=this.state,h=u.startX,f=u.endX,m=5,x={pointerEvents:"none",fill:d};return ee.createElement(xn,{className:"recharts-brush-texts"},ee.createElement(Dm,i2({textAnchor:"end",verticalAnchor:"middle",x:Math.min(h,f)-m,y:o+l/2},x),this.getTextOfTick(a)),ee.createElement(Dm,i2({textAnchor:"start",verticalAnchor:"middle",x:Math.max(h,f)+c+m,y:o+l/2},x),this.getTextOfTick(i)))}},{key:"render",value:function(){var s=this.props,a=s.data,i=s.className,o=s.children,l=s.x,c=s.y,d=s.width,u=s.height,h=s.alwaysShowText,f=this.state,m=f.startX,x=f.endX,p=f.isTextActive,v=f.isSlideMoving,g=f.isTravellerMoving,y=f.isTravellerFocused;if(!a||!a.length||!vt(l)||!vt(c)||!vt(d)||!vt(u)||d<=0||u<=0)return null;var b=Mr("recharts-brush",i),w=ee.Children.count(o)===1,_=kze("userSelect","none");return ee.createElement(xn,{className:b,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:_},this.renderBackground(),w&&this.renderPanorama(),this.renderSlide(m,x),this.renderTravellerLayer(m,"startX"),this.renderTravellerLayer(x,"endX"),(p||v||g||y||h)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,i=s.y,o=s.width,l=s.height,c=s.stroke,d=Math.floor(i+l/2)-1;return ee.createElement(ee.Fragment,null,ee.createElement("rect",{x:a,y:i,width:o,height:l,fill:c,stroke:"none"}),ee.createElement("line",{x1:a+1,y1:d,x2:a+o-1,y2:d,fill:"none",stroke:"#fff"}),ee.createElement("line",{x1:a+1,y1:d+2,x2:a+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,a){var i;return ee.isValidElement(s)?i=ee.cloneElement(s,a):Nr(s)?i=s(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(s,a){var i=s.data,o=s.width,l=s.x,c=s.travellerWidth,d=s.updateId,u=s.startIndex,h=s.endIndex;if(i!==a.prevData||d!==a.prevUpdateId)return Jk({prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o},i&&i.length?Ize({data:i,width:o,x:l,travellerWidth:c,startIndex:u,endIndex:h}):{scale:null,scaleValues:null});if(a.scale&&(o!==a.prevWidth||l!==a.prevX||c!==a.prevTravellerWidth)){a.scale.range([l,l+o-c]);var f=a.scale.domain().map(function(m){return a.scale(m)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o,startX:a.scale(s.startIndex),endX:a.scale(s.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(s,a){for(var i=s.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);s[c]>a?l=c:o=c}return a>=s[l]?l:o}}])}(j.PureComponent);bo(Mx,"displayName","Brush");bo(Mx,"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 Rze=U6;function Mze(e,t){var n;return Rze(e,function(s,a,i){return n=t(s,a,i),!n}),!!n}var Dze=Mze,$ze=YZ,Fze=od,Bze=Dze,Uze=lo,zze=e5;function qze(e,t,n){var s=Uze(e)?$ze:Bze;return n&&zze(e,t,n)&&(t=void 0),s(e,Fze(t))}var Vze=qze;const Wze=_n(Vze);var Kc=function(t,n){var s=t.alwaysShow,a=t.ifOverflow;return s&&(a="extendDomain"),a===n},$7=gJ;function Hze(e,t,n){t=="__proto__"&&$7?$7(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Gze=Hze,Yze=Gze,Kze=mJ,Xze=od;function Zze(e,t){var n={};return t=Xze(t),Kze(e,function(s,a,i){Yze(n,a,t(s,a,i))}),n}var Jze=Zze;const Qze=_n(Jze);function eqe(e,t){for(var n=-1,s=e==null?0:e.length;++n<s;)if(!t(e[n],n,e))return!1;return!0}var tqe=eqe,rqe=U6;function nqe(e,t){var n=!0;return rqe(e,function(s,a,i){return n=!!t(s,a,i),n}),n}var sqe=nqe,aqe=tqe,iqe=sqe,oqe=od,lqe=lo,cqe=e5;function dqe(e,t,n){var s=lqe(e)?aqe:iqe;return n&&cqe(e,t,n)&&(t=void 0),s(e,oqe(t))}var uqe=dqe;const oee=_n(uqe);var hqe=["x","y"];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)}function H3(){return H3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},H3.apply(this,arguments)}function F7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Ay(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?F7(Object(n),!0).forEach(function(s){fqe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function fqe(e,t,n){return t=mqe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mqe(e){var t=pqe(e,"string");return Eb(t)=="symbol"?t:t+""}function pqe(e,t){if(Eb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Eb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gqe(e,t){if(e==null)return{};var n=xqe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function xqe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function vqe(e,t){var n=e.x,s=e.y,a=gqe(e,hqe),i="".concat(n),o=parseInt(i,10),l="".concat(s),c=parseInt(l,10),d="".concat(t.height||a.height),u=parseInt(d,10),h="".concat(t.width||a.width),f=parseInt(h,10);return Ay(Ay(Ay(Ay(Ay({},t),a),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function B7(e){return ee.createElement(eee,H3({shapeType:"rectangle",propTransformer:vqe,activeClassName:"recharts-active-bar"},e))}var yqe=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,a){if(typeof t=="number")return t;var i=vt(s)||Vke(s);return i?t(s,a):(i||Fm(),n)}},bqe=["value","background"],lee;function Dx(e){"@babel/helpers - typeof";return Dx=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},Dx(e)}function jqe(e,t){if(e==null)return{};var n=wqe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function wqe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function l2(){return l2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},l2.apply(this,arguments)}function U7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Zs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?U7(Object(n),!0).forEach(function(s){lh(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Nqe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z7(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,dee(s.key),s)}}function _qe(e,t,n){return t&&z7(e.prototype,t),n&&z7(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sqe(e,t,n){return t=c2(t),kqe(e,cee()?Reflect.construct(t,n||[],c2(e).constructor):t.apply(e,n))}function kqe(e,t){if(t&&(Dx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cqe(e)}function Cqe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cee=function(){return!!e})()}function c2(e){return c2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},c2(e)}function Aqe(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&&G3(e,t)}function G3(e,t){return G3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},G3(e,t)}function lh(e,t,n){return t=dee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dee(e){var t=Pqe(e,"string");return Dx(t)=="symbol"?t:t+""}function Pqe(e,t){if(Dx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Dx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Vj=function(e){function t(){var n;Nqe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=Sqe(this,t,[].concat(a)),lh(n,"state",{isAnimationFinished:!1}),lh(n,"id",bv("recharts-bar-")),lh(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),lh(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return Aqe(t,e),_qe(t,[{key:"renderRectanglesStatically",value:function(s){var a=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,d=i.activeBar,u=cr(this.props,!1);return s&&s.map(function(h,f){var m=f===c,x=m?d:o,p=Zs(Zs(Zs({},u),h),{},{isActive:m,option:x,index:f,dataKey:l,onAnimationStart:a.handleAnimationStart,onAnimationEnd:a.handleAnimationEnd});return ee.createElement(xn,l2({className:"recharts-bar-rectangle"},Mm(a.props,h,f),{key:"rectangle-".concat(h==null?void 0:h.x,"-").concat(h==null?void 0:h.y,"-").concat(h==null?void 0:h.value,"-").concat(f)}),ee.createElement(B7,p))})}},{key:"renderRectanglesWithAnimation",value:function(){var s=this,a=this.props,i=a.data,o=a.layout,l=a.isAnimationActive,c=a.animationBegin,d=a.animationDuration,u=a.animationEasing,h=a.animationId,f=this.state.prevData;return ee.createElement(sd,{begin:c,duration:d,isActive:l,easing:u,from:{t:0},to:{t:1},key:"bar-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(m){var x=m.t,p=i.map(function(v,g){var y=f&&f[g];if(y){var b=ko(y.x,v.x),w=ko(y.y,v.y),_=ko(y.width,v.width),C=ko(y.height,v.height);return Zs(Zs({},v),{},{x:b(x),y:w(x),width:_(x),height:C(x)})}if(o==="horizontal"){var E=ko(0,v.height),N=E(x);return Zs(Zs({},v),{},{y:v.y+v.height-N,height:N})}var k=ko(0,v.width),I=k(x);return Zs(Zs({},v),{},{width:I})});return ee.createElement(xn,null,s.renderRectanglesStatically(p))})}},{key:"renderRectangles",value:function(){var s=this.props,a=s.data,i=s.isAnimationActive,o=this.state.prevData;return i&&a&&a.length&&(!o||!zj(o,a))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(a)}},{key:"renderBackground",value:function(){var s=this,a=this.props,i=a.data,o=a.dataKey,l=a.activeIndex,c=cr(this.props.background,!1);return i.map(function(d,u){d.value;var h=d.background,f=jqe(d,bqe);if(!h)return null;var m=Zs(Zs(Zs(Zs(Zs({},f),{},{fill:"#eee"},h),c),Mm(s.props,d,u)),{},{onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd,dataKey:o,index:u,className:"recharts-bar-background-rectangle"});return ee.createElement(B7,l2({key:"background-bar-".concat(u),option:s.props.background,isActive:u===l},m))})}},{key:"renderErrorBar",value:function(s,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,d=i.layout,u=i.children,h=Do(u,qj);if(!h)return null;var f=d==="vertical"?o[0].height/2:o[0].width/2,m=function(v,g){var y=Array.isArray(v.value)?v.value[1]:v.value;return{x:v.x,y:v.y,value:y,errorVal:pa(v,g)}},x={clipPath:s?"url(#clipPath-".concat(a,")"):null};return ee.createElement(xn,x,h.map(function(p){return ee.cloneElement(p,{key:"error-bar-".concat(a,"-").concat(p.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,offset:f,dataPointFormatter:m})}))}},{key:"render",value:function(){var s=this.props,a=s.hide,i=s.data,o=s.className,l=s.xAxis,c=s.yAxis,d=s.left,u=s.top,h=s.width,f=s.height,m=s.isAnimationActive,x=s.background,p=s.id;if(a||!i||!i.length)return null;var v=this.state.isAnimationFinished,g=Mr("recharts-bar",o),y=l&&l.allowDataOverflow,b=c&&c.allowDataOverflow,w=y||b,_=Or(p)?this.id:p;return ee.createElement(xn,{className:g},y||b?ee.createElement("defs",null,ee.createElement("clipPath",{id:"clipPath-".concat(_)},ee.createElement("rect",{x:y?d:d-h/2,y:b?u:u-f/2,width:y?h:h*2,height:b?f:f*2}))):null,ee.createElement(xn,{className:"recharts-bar-rectangles",clipPath:w?"url(#clipPath-".concat(_,")"):null},x?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(w,_),(!m||v)&&Yd.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curData:s.data,prevData:a.curData}:s.data!==a.curData?{curData:s.data}:null}}])}(j.PureComponent);lee=Vj;lh(Vj,"displayName","Bar");lh(Vj,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Gc.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});lh(Vj,"getComposedData",function(e){var t=e.props,n=e.item,s=e.barPosition,a=e.bandSize,i=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,d=e.stackedData,u=e.dataStartIndex,h=e.displayedData,f=e.offset,m=cFe(s,n);if(!m)return null;var x=t.layout,p=n.type.defaultProps,v=p!==void 0?Zs(Zs({},p),n.props):n.props,g=v.dataKey,y=v.children,b=v.minPointSize,w=x==="horizontal"?o:i,_=d?w.scale.domain():null,C=gFe({numericAxis:w}),E=Do(y,t5),N=h.map(function(k,I){var P,O,A,R,L,z;d?P=dFe(d[u+I],_):(P=pa(k,g),Array.isArray(P)||(P=[C,P]));var U=yqe(b,lee.defaultProps.minPointSize)(P[1],I);if(x==="horizontal"){var $,q=[o.scale(P[0]),o.scale(P[1])],ne=q[0],se=q[1];O=TF({axis:i,ticks:l,bandSize:a,offset:m.offset,entry:k,index:I}),A=($=se??ne)!==null&&$!==void 0?$:void 0,R=m.size;var F=ne-se;if(L=Number.isNaN(F)?0:F,z={x:O,y:o.y,width:R,height:o.height},Math.abs(U)>0&&Math.abs(L)<Math.abs(U)){var V=Ni(L||U)*(Math.abs(U)-Math.abs(L));A-=V,L+=V}}else{var Z=[i.scale(P[0]),i.scale(P[1])],de=Z[0],ve=Z[1];if(O=de,A=TF({axis:o,ticks:c,bandSize:a,offset:m.offset,entry:k,index:I}),R=ve-de,L=m.size,z={x:i.x,y:A,width:i.width,height:L},Math.abs(U)>0&&Math.abs(R)<Math.abs(U)){var pe=Ni(R||U)*(Math.abs(U)-Math.abs(R));R+=pe}}return Zs(Zs(Zs({},k),{},{x:O,y:A,width:R,height:L,value:d?P:P[1],payload:k,background:z},E&&E[I]&&E[I].props),{},{tooltipPayload:[OQ(n,k)],tooltipPosition:{x:O+R/2,y:A+L/2}})});return Zs({data:N,layout:x},f)});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 Eqe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q7(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,uee(s.key),s)}}function Tqe(e,t,n){return t&&q7(e.prototype,t),n&&q7(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function V7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?V7(Object(n),!0).forEach(function(s){b5(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function b5(e,t,n){return t=uee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uee(e){var t=Oqe(e,"string");return Tb(t)=="symbol"?t:t+""}function Oqe(e,t){if(Tb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Tb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Lqe=function(t,n,s,a,i){var o=t.width,l=t.height,c=t.layout,d=t.children,u=Object.keys(n),h={left:s.left,leftMirror:s.left,right:o-s.right,rightMirror:o-s.right,top:s.top,topMirror:s.top,bottom:l-s.bottom,bottomMirror:l-s.bottom},f=!!No(d,Vj);return u.reduce(function(m,x){var p=n[x],v=p.orientation,g=p.domain,y=p.padding,b=y===void 0?{}:y,w=p.mirror,_=p.reversed,C="".concat(v).concat(w?"Mirror":""),E,N,k,I,P;if(p.type==="number"&&(p.padding==="gap"||p.padding==="no-gap")){var O=g[1]-g[0],A=1/0,R=p.categoricalDomain.sort(Gke);if(R.forEach(function(Z,de){de>0&&(A=Math.min((Z||0)-(R[de-1]||0),A))}),Number.isFinite(A)){var L=A/O,z=p.layout==="vertical"?s.height:s.width;if(p.padding==="gap"&&(E=L*z/2),p.padding==="no-gap"){var U=_i(t.barCategoryGap,L*z),$=L*z/2;E=$-U-($-U)/z*U}}}a==="xAxis"?N=[s.left+(b.left||0)+(E||0),s.left+s.width-(b.right||0)-(E||0)]:a==="yAxis"?N=c==="horizontal"?[s.top+s.height-(b.bottom||0),s.top+(b.top||0)]:[s.top+(b.top||0)+(E||0),s.top+s.height-(b.bottom||0)-(E||0)]:N=p.range,_&&(N=[N[1],N[0]]);var q=AQ(p,i,f),ne=q.scale,se=q.realScaleType;ne.domain(g).range(N),PQ(ne);var F=EQ(ne,Bl(Bl({},p),{},{realScaleType:se}));a==="xAxis"?(P=v==="top"&&!w||v==="bottom"&&w,k=s.left,I=h[C]-P*p.height):a==="yAxis"&&(P=v==="left"&&!w||v==="right"&&w,k=h[C]-P*p.width,I=s.top);var V=Bl(Bl(Bl({},p),F),{},{realScaleType:se,x:k,y:I,scale:ne,width:a==="xAxis"?s.width:p.width,height:a==="yAxis"?s.height:p.height});return V.bandSize=H_(V,F),!p.hide&&a==="xAxis"?h[C]+=(P?-1:1)*V.height:p.hide||(h[C]+=(P?-1:1)*V.width),Bl(Bl({},m),{},b5({},x,V))},{})},hee=function(t,n){var s=t.x,a=t.y,i=n.x,o=n.y;return{x:Math.min(s,i),y:Math.min(a,o),width:Math.abs(i-s),height:Math.abs(o-a)}},Iqe=function(t){var n=t.x1,s=t.y1,a=t.x2,i=t.y2;return hee({x:n,y:s},{x:a,y:i})},fee=function(){function e(t){Eqe(this,e),this.scale=t}return Tqe(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(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.bandAware,i=s.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(a){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),a=s[0],i=s[s.length-1];return a<=i?n>=a&&n<=i:n>=i&&n<=a}}],[{key:"create",value:function(n){return new e(n)}}])}();b5(fee,"EPS",1e-4);var gL=function(t){var n=Object.keys(t).reduce(function(s,a){return Bl(Bl({},s),{},b5({},a,fee.create(t[a])))},{});return Bl(Bl({},n),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return Qze(a,function(c,d){return n[d].apply(c,{bandAware:o,position:l})})},isInRange:function(a){return oee(a,function(i,o){return n[o].isInRange(i)})}})};function Rqe(e){return(e%180+180)%180}var Mqe=function(t){var n=t.width,s=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=Rqe(a),o=i*Math.PI/180,l=Math.atan(s/n),c=o>l&&o<Math.PI-l?s/Math.sin(o):n/Math.cos(o);return Math.abs(c)},Dqe=od,$qe=Dj,Fqe=JS;function Bqe(e){return function(t,n,s){var a=Object(t);if(!$qe(t)){var i=Dqe(n);t=Fqe(t),n=function(l){return i(a[l],l,a)}}var o=e(t,n,s);return o>-1?a[i?t[o]:o]:void 0}}var Uqe=Bqe,zqe=nee;function qqe(e){var t=zqe(e),n=t%1;return t===t?n?t-n:t:0}var Vqe=qqe,Wqe=lJ,Hqe=od,Gqe=Vqe,Yqe=Math.max;function Kqe(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var a=n==null?0:Gqe(n);return a<0&&(a=Yqe(s+a,0)),Wqe(e,Hqe(t),a)}var Xqe=Kqe,Zqe=Uqe,Jqe=Xqe,Qqe=Zqe(Jqe),eVe=Qqe;const tVe=_n(eVe);var rVe=Y4e(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("")}),xL=j.createContext(void 0),vL=j.createContext(void 0),mee=j.createContext(void 0),pee=j.createContext({}),gee=j.createContext(void 0),xee=j.createContext(0),vee=j.createContext(0),W7=function(t){var n=t.state,s=n.xAxisMap,a=n.yAxisMap,i=n.offset,o=t.clipPathId,l=t.children,c=t.width,d=t.height,u=rVe(i);return ee.createElement(xL.Provider,{value:s},ee.createElement(vL.Provider,{value:a},ee.createElement(pee.Provider,{value:i},ee.createElement(mee.Provider,{value:u},ee.createElement(gee.Provider,{value:o},ee.createElement(xee.Provider,{value:d},ee.createElement(vee.Provider,{value:c},l)))))))},nVe=function(){return j.useContext(gee)},yee=function(t){var n=j.useContext(xL);n==null&&Fm();var s=n[t];return s==null&&Fm(),s},sVe=function(){var t=j.useContext(xL);return Gu(t)},aVe=function(){var t=j.useContext(vL),n=tVe(t,function(s){return oee(s.domain,Number.isFinite)});return n||Gu(t)},bee=function(t){var n=j.useContext(vL);n==null&&Fm();var s=n[t];return s==null&&Fm(),s},iVe=function(){var t=j.useContext(mee);return t},oVe=function(){return j.useContext(pee)},yL=function(){return j.useContext(vee)},bL=function(){return j.useContext(xee)};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 lVe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cVe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,wee(s.key),s)}}function dVe(e,t,n){return t&&cVe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function uVe(e,t,n){return t=d2(t),hVe(e,jee()?Reflect.construct(t,n||[],d2(e).constructor):t.apply(e,n))}function hVe(e,t){if(t&&($x(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fVe(e)}function fVe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jee=function(){return!!e})()}function d2(e){return d2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},d2(e)}function mVe(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&&Y3(e,t)}function Y3(e,t){return Y3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},Y3(e,t)}function H7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function G7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?H7(Object(n),!0).forEach(function(s){jL(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function jL(e,t,n){return t=wee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wee(e){var t=pVe(e,"string");return $x(t)=="symbol"?t:t+""}function pVe(e,t){if($x(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if($x(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gVe(e,t){return bVe(e)||yVe(e,t)||vVe(e,t)||xVe()}function xVe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 993In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vVe(e,t){if(e){if(typeof e=="string")return Y7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Y7(e,t)}}function Y7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function yVe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function bVe(e){if(Array.isArray(e))return e}function K3(){return K3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},K3.apply(this,arguments)}var jVe=function(t,n){var s;return ee.isValidElement(t)?s=ee.cloneElement(t,n):Nr(t)?s=t(n):s=ee.createElement("line",K3({},n,{className:"recharts-reference-line-line"})),s},wVe=function(t,n,s,a,i,o,l,c,d){var u=i.x,h=i.y,f=i.width,m=i.height;if(s){var x=d.y,p=t.y.apply(x,{position:o});if(Kc(d,"discard")&&!t.y.isInRange(p))return null;var v=[{x:u+f,y:p},{x:u,y:p}];return c==="left"?v.reverse():v}if(n){var g=d.x,y=t.x.apply(g,{position:o});if(Kc(d,"discard")&&!t.x.isInRange(y))return null;var b=[{x:y,y:h+m},{x:y,y:h}];return l==="top"?b.reverse():b}if(a){var w=d.segment,_=w.map(function(C){return t.apply(C,{position:o})});return Kc(d,"discard")&&Wze(_,function(C){return!t.isInRange(C)})?null:_}return null};function NVe(e){var t=e.x,n=e.y,s=e.segment,a=e.xAxisId,i=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,d=nVe(),u=yee(a),h=bee(i),f=iVe();if(!d||!f)return null;Jl(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var m=gL({x:u.scale,y:h.scale}),x=va(t),p=va(n),v=s&&s.length===2,g=wVe(m,x,p,v,f,e.position,u.orientation,h.orientation,e);if(!g)return null;var y=gVe(g,2),b=y[0],w=b.x,_=b.y,C=y[1],E=C.x,N=C.y,k=Kc(e,"hidden")?"url(#".concat(d,")"):void 0,I=G7(G7({clipPath:k},cr(e,!0)),{},{x1:w,y1:_,x2:E,y2:N});return ee.createElement(xn,{className:Mr("recharts-reference-line",l)},jVe(o,I),ka.renderCallByParent(e,Iqe({x1:w,y1:_,x2:E,y2:N})))}var wL=function(e){function t(){return lVe(this,t),uVe(this,t,arguments)}return mVe(t,e),dVe(t,[{key:"render",value:function(){return ee.createElement(NVe,this.props)}}])}(ee.Component);jL(wL,"displayName","ReferenceLine");jL(wL,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function X3(){return X3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},X3.apply(this,arguments)}function Fx(e){"@babel/helpers - typeof";return Fx=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},Fx(e)}function K7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function X7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?K7(Object(n),!0).forEach(function(s){j5(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function _Ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SVe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,_ee(s.key),s)}}function kVe(e,t,n){return t&&SVe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function CVe(e,t,n){return t=u2(t),AVe(e,Nee()?Reflect.construct(t,n||[],u2(e).constructor):t.apply(e,n))}function AVe(e,t){if(t&&(Fx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return PVe(e)}function PVe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Nee=function(){return!!e})()}function u2(e){return u2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},u2(e)}function EVe(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&&Z3(e,t)}function Z3(e,t){return Z3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},Z3(e,t)}function j5(e,t,n){return t=_ee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _ee(e){var t=TVe(e,"string");return Fx(t)=="symbol"?t:t+""}function TVe(e,t){if(Fx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Fx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var OVe=function(t){var n=t.x,s=t.y,a=t.xAxis,i=t.yAxis,o=gL({x:a.scale,y:i.scale}),l=o.apply({x:n,y:s},{bandAware:!0});return Kc(t,"discard")&&!o.isInRange(l)?null:l},w5=function(e){function t(){return _Ve(this,t),CVe(this,t,arguments)}return EVe(t,e),kVe(t,[{key:"render",value:function(){var s=this.props,a=s.x,i=s.y,o=s.r,l=s.alwaysShow,c=s.clipPathId,d=va(a),u=va(i);if(Jl(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!d||!u)return null;var h=OVe(this.props);if(!h)return null;var f=h.x,m=h.y,x=this.props,p=x.shape,v=x.className,g=Kc(this.props,"hidden")?"url(#".concat(c,")"):void 0,y=X7(X7({clipPath:g},cr(this.props,!0)),{},{cx:f,cy:m});return ee.createElement(xn,{className:Mr("recharts-reference-dot",v)},t.renderDot(p,y),ka.renderCallByParent(this.props,{x:f-o,y:m-o,width:2*o,height:2*o}))}}])}(ee.Component);j5(w5,"displayName","ReferenceDot");j5(w5,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});j5(w5,"renderDot",function(e,t){var n;return ee.isValidElement(e)?n=ee.cloneElement(e,t):Nr(e)?n=e(t):n=ee.createElement(f5,X3({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),n});function J3(){return J3=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},J3.apply(this,arguments)}function Bx(e){"@babel/helpers - typeof";return Bx=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},Bx(e)}function Z7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function J7(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Z7(Object(n),!0).forEach(function(s){N5(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function LVe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function IVe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,kee(s.key),s)}}function RVe(e,t,n){return t&&IVe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function MVe(e,t,n){return t=h2(t),DVe(e,See()?Reflect.construct(t,n||[],h2(e).constructor):t.apply(e,n))}function DVe(e,t){if(t&&(Bx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $Ve(e)}function $Ve(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function See(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(See=function(){return!!e})()}function h2(e){return h2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},h2(e)}function FVe(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&&Q3(e,t)}function Q3(e,t){return Q3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},Q3(e,t)}function N5(e,t,n){return t=kee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kee(e){var t=BVe(e,"string");return Bx(t)=="symbol"?t:t+""}function BVe(e,t){if(Bx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Bx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var UVe=function(t,n,s,a,i){var o=i.x1,l=i.x2,c=i.y1,d=i.y2,u=i.xAxis,h=i.yAxis;if(!u||!h)return null;var f=gL({x:u.scale,y:h.scale}),m={x:t?f.x.apply(o,{position:"start"}):f.x.rangeMin,y:s?f.y.apply(c,{position:"start"}):f.y.rangeMin},x={x:n?f.x.apply(l,{position:"end"}):f.x.rangeMax,y:a?f.y.apply(d,{position:"end"}):f.y.rangeMax};return Kc(i,"discard")&&(!f.isInRange(m)||!f.isInRange(x))?null:hee(m,x)},_5=function(e){function t(){return LVe(this,t),MVe(this,t,arguments)}return FVe(t,e),RVe(t,[{key:"render",value:function(){var s=this.props,a=s.x1,i=s.x2,o=s.y1,l=s.y2,c=s.className,d=s.alwaysShow,u=s.clipPathId;Jl(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=va(a),f=va(i),m=va(o),x=va(l),p=this.props.shape;if(!h&&!f&&!m&&!x&&!p)return null;var v=UVe(h,f,m,x,this.props);if(!v&&!p)return null;var g=Kc(this.props,"hidden")?"url(#".concat(u,")"):void 0;return ee.createElement(xn,{className:Mr("recharts-reference-area",c)},t.renderRect(p,J7(J7({clipPath:g},cr(this.props,!0)),v)),ka.renderCallByParent(this.props,v))}}])}(ee.Component);N5(_5,"displayName","ReferenceArea");N5(_5,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});N5(_5,"renderRect",function(e,t){var n;return ee.isValidElement(e)?n=ee.cloneElement(e,t):Nr(e)?n=e(t):n=ee.createElement(pL,J3({},t,{className:"recharts-reference-area-rect"})),n});function Cee(e,t,n){if(t<1)return[];if(t===1&&n===void 0)return e;for(var s=[],a=0;a<e.length;a+=t)s.push(e[a]);return s}function zVe(e,t,n){var s={width:e.width+t.width,height:e.height+t.height};return Mqe(s,n)}function qVe(e,t,n){var s=n==="width",a=e.x,i=e.y,o=e.width,l=e.height;return t===1?{start:s?a:i,end:s?a+o:i+l}:{start:s?a+o:i+l,end:s?a:i}}function f2(e,t,n,s,a){if(e*t<e*s||e*t>e*a)return!1;var i=n();return e*(t-e*i/2-s)>=0&&e*(t+e*i/2-a)<=0}function VVe(e,t){return Cee(e,t+1)}function WVe(e,t,n,s,a){for(var i=(s||[]).slice(),o=t.start,l=t.end,c=0,d=1,u=o,h=function(){var x=s==null?void 0:s[c];if(x===void 0)return{v:Cee(s,d)};var p=c,v,g=function(){return v===void 0&&(v=n(x,p)),v},y=x.coordinate,b=c===0||f2(e,y,g,u,l);b||(c=0,u=o,d+=1),b&&(u=y+e*(g()/2+a),c+=d)},f;d<=i.length;)if(f=h(),f)return f.v;return[]}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 Q7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function ni(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Q7(Object(n),!0).forEach(function(s){HVe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q7(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function HVe(e,t,n){return t=GVe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GVe(e){var t=YVe(e,"string");return Ob(t)=="symbol"?t:t+""}function YVe(e,t){if(Ob(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Ob(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KVe(e,t,n,s,a){for(var i=(s||[]).slice(),o=i.length,l=t.start,c=t.end,d=function(f){var m=i[f],x,p=function(){return x===void 0&&(x=n(m,f)),x};if(f===o-1){var v=e*(m.coordinate+e*p()/2-c);i[f]=m=ni(ni({},m),{},{tickCoord:v>0?m.coordinate-v*e:m.coordinate})}else i[f]=m=ni(ni({},m),{},{tickCoord:m.coordinate});var g=f2(e,m.tickCoord,p,l,c);g&&(c=m.tickCoord-e*(p()/2+a),i[f]=ni(ni({},m),{},{isShow:!0}))},u=o-1;u>=0;u--)d(u);return i}function XVe(e,t,n,s,a,i){var o=(s||[]).slice(),l=o.length,c=t.start,d=t.end;if(i){var u=s[l-1],h=n(u,l-1),f=e*(u.coordinate+e*h/2-d);o[l-1]=u=ni(ni({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate});var m=f2(e,u.tickCoord,function(){return h},c,d);m&&(d=u.tickCoord-e*(h/2+a),o[l-1]=ni(ni({},u),{},{isShow:!0}))}for(var x=i?l-1:l,p=function(y){var b=o[y],w,_=function(){return w===void 0&&(w=n(b,y)),w};if(y===0){var C=e*(b.coordinate-e*_()/2-c);o[y]=b=ni(ni({},b),{},{tickCoord:C<0?b.coordinate-C*e:b.coordinate})}else o[y]=b=ni(ni({},b),{},{tickCoord:b.coordinate});var E=f2(e,b.tickCoord,_,c,d);E&&(c=b.tickCoord+e*(_()/2+a),o[y]=ni(ni({},b),{},{isShow:!0}))},v=0;v<x;v++)p(v);return o}function NL(e,t,n){var s=e.tick,a=e.ticks,i=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,d=e.tickFormatter,u=e.unit,h=e.angle;if(!a||!a.length||!s)return[];if(vt(c)||Gc.isSsr)return VVe(a,typeof c=="number"&&vt(c)?c:0);var f=[],m=l==="top"||l==="bottom"?"width":"height",x=u&&m==="width"?c0(u,{fontSize:t,letterSpacing:n}):{width:0,height:0},p=function(b,w){var _=Nr(d)?d(b.value,w):b.value;return m==="width"?zVe(c0(_,{fontSize:t,letterSpacing:n}),x,h):c0(_,{fontSize:t,letterSpacing:n})[m]},v=a.length>=2?Ni(a[1].coordinate-a[0].coordinate):1,g=qVe(i,v,m);return c==="equidistantPreserveStart"?WVe(v,g,p,a,o):(c==="preserveStart"||c==="preserveStartEnd"?f=XVe(v,g,p,a,o,c==="preserveStartEnd"):f=KVe(v,g,p,a,o),f.filter(function(y){return y.isShow}))}var ZVe=["viewBox"],JVe=["viewBox"],QVe=["ticks"];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 xg(){return xg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},xg.apply(this,arguments)}function eB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function la(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eB(Object(n),!0).forEach(function(s){_L(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eB(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Qk(e,t){if(e==null)return{};var n=eWe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function eWe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function tWe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tB(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Pee(s.key),s)}}function rWe(e,t,n){return t&&tB(e.prototype,t),n&&tB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function nWe(e,t,n){return t=m2(t),sWe(e,Aee()?Reflect.construct(t,n||[],m2(e).constructor):t.apply(e,n))}function sWe(e,t){if(t&&(Ux(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aWe(e)}function aWe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Aee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Aee=function(){return!!e})()}function m2(e){return m2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},m2(e)}function iWe(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&&eE(e,t)}function eE(e,t){return eE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},eE(e,t)}function _L(e,t,n){return t=Pee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pee(e){var t=oWe(e,"string");return Ux(t)=="symbol"?t:t+""}function oWe(e,t){if(Ux(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Ux(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Cv=function(e){function t(n){var s;return tWe(this,t),s=nWe(this,t,[n]),s.state={fontSize:"",letterSpacing:""},s}return iWe(t,e),rWe(t,[{key:"shouldComponentUpdate",value:function(s,a){var i=s.viewBox,o=Qk(s,ZVe),l=this.props,c=l.viewBox,d=Qk(l,JVe);return!Og(i,c)||!Og(o,d)||!Og(a,this.state)}},{key:"componentDidMount",value:function(){var s=this.layerReference;if(s){var a=s.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];a&&this.setState({fontSize:window.getComputedStyle(a).fontSize,letterSpacing:window.getComputedStyle(a).letterSpacing})}}},{key:"getTickLineCoord",value:function(s){var a=this.props,i=a.x,o=a.y,l=a.width,c=a.height,d=a.orientation,u=a.tickSize,h=a.mirror,f=a.tickMargin,m,x,p,v,g,y,b=h?-1:1,w=s.tickSize||u,_=vt(s.tickCoord)?s.tickCoord:s.coordinate;switch(d){case"top":m=x=s.coordinate,v=o+ +!h*c,p=v-b*w,y=p-b*f,g=_;break;case"left":p=v=s.coordinate,x=i+ +!h*l,m=x-b*w,g=m-b*f,y=_;break;case"right":p=v=s.coordinate,x=i+ +h*l,m=x+b*w,g=m+b*f,y=_;break;default:m=x=s.coordinate,v=o+ +h*c,p=v+b*w,y=p+b*f,g=_;break}return{line:{x1:m,y1:p,x2:x,y2:v},tick:{x:g,y}}}},{key:"getTickTextAnchor",value:function(){var s=this.props,a=s.orientation,i=s.mirror,o;switch(a){case"left":o=i?"start":"end";break;case"right":o=i?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var s=this.props,a=s.orientation,i=s.mirror,o="end";switch(a){case"left":case"right":o="middle";break;case"top":o=i?"start":"end";break;default:o=i?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.x,i=s.y,o=s.width,l=s.height,c=s.orientation,d=s.mirror,u=s.axisLine,h=la(la(la({},cr(this.props,!1)),cr(u,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var f=+(c==="top"&&!d||c==="bottom"&&d);h=la(la({},h),{},{x1:a,y1:i+f*l,x2:a+o,y2:i+f*l})}else{var m=+(c==="left"&&!d||c==="right"&&d);h=la(la({},h),{},{x1:a+m*o,y1:i,x2:a+m*o,y2:i+l})}return ee.createElement("line",xg({},h,{className:Mr("recharts-cartesian-axis-line",Mo(u,"className"))}))}},{key:"renderTicks",value:function(s,a,i){var o=this,l=this.props,c=l.tickLine,d=l.stroke,u=l.tick,h=l.tickFormatter,f=l.unit,m=NL(la(la({},this.props),{},{ticks:s}),a,i),x=this.getTickTextAnchor(),p=this.getTickVerticalAnchor(),v=cr(this.props,!1),g=cr(u,!1),y=la(la({},v),{},{fill:"none"},cr(c,!1)),b=m.map(function(w,_){var C=o.getTickLineCoord(w),E=C.line,N=C.tick,k=la(la(la(la({textAnchor:x,verticalAnchor:p},v),{},{stroke:"none",fill:d},g),N),{},{index:_,payload:w,visibleTicksCount:m.length,tickFormatter:h});return ee.createElement(xn,xg({className:"recharts-cartesian-axis-tick",key:"tick-".concat(w.value,"-").concat(w.coordinate,"-").concat(w.tickCoord)},Mm(o.props,w,_)),c&&ee.createElement("line",xg({},y,E,{className:Mr("recharts-cartesian-axis-tick-line",Mo(c,"className"))})),u&&t.renderTickItem(u,k,"".concat(Nr(h)?h(w.value,_):w.value).concat(f||"")))});return ee.createElement("g",{className:"recharts-cartesian-axis-ticks"},b)}},{key:"render",value:function(){var s=this,a=this.props,i=a.axisLine,o=a.width,l=a.height,c=a.ticksGenerator,d=a.className,u=a.hide;if(u)return null;var h=this.props,f=h.ticks,m=Qk(h,QVe),x=f;return Nr(c)&&(x=f&&f.length>0?c(this.props):c(m)),o<=0||l<=0||!x||!x.length?null:ee.createElement(xn,{className:Mr("recharts-cartesian-axis",d),ref:function(v){s.layerReference=v}},i&&this.renderAxisLine(),this.renderTicks(x,this.state.fontSize,this.state.letterSpacing),ka.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,i){var o,l=Mr(a.className,"recharts-cartesian-axis-tick-value");return ee.isValidElement(s)?o=ee.cloneElement(s,la(la({},a),{},{className:l})):Nr(s)?o=s(la(la({},a),{},{className:l})):o=ee.createElement(Dm,xg({},a,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(j.Component);_L(Cv,"displayName","CartesianAxis");_L(Cv,"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 lWe=["x1","y1","x2","y2","key"],cWe=["offset"];function Bm(e){"@babel/helpers - typeof";return Bm=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},Bm(e)}function rB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function ii(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rB(Object(n),!0).forEach(function(s){dWe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rB(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function dWe(e,t,n){return t=uWe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uWe(e){var t=hWe(e,"string");return Bm(t)=="symbol"?t:t+""}function hWe(e,t){if(Bm(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Bm(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jf(){return Jf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Jf.apply(this,arguments)}function nB(e,t){if(e==null)return{};var n=fWe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function fWe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var mWe=function(t){var n=t.fill;if(!n||n==="none")return null;var s=t.fillOpacity,a=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return ee.createElement("rect",{x:a,y:i,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function Eee(e,t){var n;if(ee.isValidElement(e))n=ee.cloneElement(e,t);else if(Nr(e))n=e(t);else{var s=t.x1,a=t.y1,i=t.x2,o=t.y2,l=t.key,c=nB(t,lWe),d=cr(c,!1);d.offset;var u=nB(d,cWe);n=ee.createElement("line",Jf({},u,{x1:s,y1:a,x2:i,y2:o,fill:"none",key:l}))}return n}function pWe(e){var t=e.x,n=e.width,s=e.horizontal,a=s===void 0?!0:s,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var d=ii(ii({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return Eee(a,d)});return ee.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function gWe(e){var t=e.y,n=e.height,s=e.vertical,a=s===void 0?!0:s,i=e.verticalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var d=ii(ii({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return Eee(a,d)});return ee.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function xWe(e){var t=e.horizontalFill,n=e.fillOpacity,s=e.x,a=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,d=c===void 0?!0:c;if(!d||!t||!t.length)return null;var u=l.map(function(f){return Math.round(f+a-a)}).sort(function(f,m){return f-m});a!==u[0]&&u.unshift(0);var h=u.map(function(f,m){var x=!u[m+1],p=x?a+o-f:u[m+1]-f;if(p<=0)return null;var v=m%t.length;return ee.createElement("rect",{key:"react-".concat(m),y:f,x:s,height:p,width:i,stroke:"none",fill:t[v],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return ee.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},h)}function vWe(e){var t=e.vertical,n=t===void 0?!0:t,s=e.verticalFill,a=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,d=e.verticalPoints;if(!n||!s||!s.length)return null;var u=d.map(function(f){return Math.round(f+i-i)}).sort(function(f,m){return f-m});i!==u[0]&&u.unshift(0);var h=u.map(function(f,m){var x=!u[m+1],p=x?i+l-f:u[m+1]-f;if(p<=0)return null;var v=m%s.length;return ee.createElement("rect",{key:"react-".concat(m),x:f,y:o,width:p,height:c,stroke:"none",fill:s[v],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return ee.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},h)}var yWe=function(t,n){var s=t.xAxis,a=t.width,i=t.height,o=t.offset;return CQ(NL(ii(ii(ii({},Cv.defaultProps),s),{},{ticks:zd(s,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.left,o.left+o.width,n)},bWe=function(t,n){var s=t.yAxis,a=t.width,i=t.height,o=t.offset;return CQ(NL(ii(ii(ii({},Cv.defaultProps),s),{},{ticks:zd(s,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.top,o.top+o.height,n)},qp={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Tee(e){var t,n,s,a,i,o,l=yL(),c=bL(),d=oVe(),u=ii(ii({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:qp.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:qp.fill,horizontal:(s=e.horizontal)!==null&&s!==void 0?s:qp.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:qp.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:qp.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:qp.verticalFill,x:vt(e.x)?e.x:d.left,y:vt(e.y)?e.y:d.top,width:vt(e.width)?e.width:d.width,height:vt(e.height)?e.height:d.height}),h=u.x,f=u.y,m=u.width,x=u.height,p=u.syncWithTicks,v=u.horizontalValues,g=u.verticalValues,y=sVe(),b=aVe();if(!vt(m)||m<=0||!vt(x)||x<=0||!vt(h)||h!==+h||!vt(f)||f!==+f)return null;var w=u.verticalCoordinatesGenerator||yWe,_=u.horizontalCoordinatesGenerator||bWe,C=u.horizontalPoints,E=u.verticalPoints;if((!C||!C.length)&&Nr(_)){var N=v&&v.length,k=_({yAxis:b?ii(ii({},b),{},{ticks:N?v:b.ticks}):void 0,width:l,height:c,offset:d},N?!0:p);Jl(Array.isArray(k),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Bm(k),"]")),Array.isArray(k)&&(C=k)}if((!E||!E.length)&&Nr(w)){var I=g&&g.length,P=w({xAxis:y?ii(ii({},y),{},{ticks:I?g:y.ticks}):void 0,width:l,height:c,offset:d},I?!0:p);Jl(Array.isArray(P),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Bm(P),"]")),Array.isArray(P)&&(E=P)}return ee.createElement("g",{className:"recharts-cartesian-grid"},ee.createElement(mWe,{fill:u.fill,fillOpacity:u.fillOpacity,x:u.x,y:u.y,width:u.width,height:u.height,ry:u.ry}),ee.createElement(pWe,Jf({},u,{offset:d,horizontalPoints:C,xAxis:y,yAxis:b})),ee.createElement(gWe,Jf({},u,{offset:d,verticalPoints:E,xAxis:y,yAxis:b})),ee.createElement(xWe,Jf({},u,{horizontalPoints:C})),ee.createElement(vWe,Jf({},u,{verticalPoints:E})))}Tee.displayName="CartesianGrid";var jWe=["type","layout","connectNulls","ref"],wWe=["key"];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 sB(e,t){if(e==null)return{};var n=NWe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function NWe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function p0(){return p0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},p0.apply(this,arguments)}function aB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function yo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aB(Object(n),!0).forEach(function(s){Ul(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aB(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function Vp(e){return CWe(e)||kWe(e)||SWe(e)||_We()}function _We(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 994In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SWe(e,t){if(e){if(typeof e=="string")return tE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tE(e,t)}}function kWe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function CWe(e){if(Array.isArray(e))return tE(e)}function tE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function AWe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iB(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Lee(s.key),s)}}function PWe(e,t,n){return t&&iB(e.prototype,t),n&&iB(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function EWe(e,t,n){return t=p2(t),TWe(e,Oee()?Reflect.construct(t,n||[],p2(e).constructor):t.apply(e,n))}function TWe(e,t){if(t&&(zx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OWe(e)}function OWe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Oee=function(){return!!e})()}function p2(e){return p2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},p2(e)}function LWe(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&&rE(e,t)}function rE(e,t){return rE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},rE(e,t)}function Ul(e,t,n){return t=Lee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lee(e){var t=IWe(e,"string");return zx(t)=="symbol"?t:t+""}function IWe(e,t){if(zx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(zx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Wj=function(e){function t(){var n;AWe(this,t);for(var s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];return n=EWe(this,t,[].concat(a)),Ul(n,"state",{isAnimationFinished:!0,totalLength:0}),Ul(n,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),Ul(n,"getStrokeDasharray",function(o,l,c){var d=c.reduce(function(g,y){return g+y});if(!d)return n.generateSimpleStrokeDasharray(l,o);for(var u=Math.floor(o/d),h=o%d,f=l-o,m=[],x=0,p=0;x<c.length;p+=c[x],++x)if(p+c[x]>h){m=[].concat(Vp(c.slice(0,x)),[h-p]);break}var v=m.length%2===0?[0,f]:[f];return[].concat(Vp(t.repeat(c,u)),Vp(m),v).map(function(g){return"".concat(g,"px")}).join(", ")}),Ul(n,"id",bv("recharts-line-")),Ul(n,"pathRef",function(o){n.mainCurve=o}),Ul(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Ul(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return LWe(t,e),PWe(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var s=this.getTotalLength();this.setState({totalLength:s})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var s=this.getTotalLength();s!==this.state.totalLength&&this.setState({totalLength:s})}}},{key:"getTotalLength",value:function(){var s=this.mainCurve;try{return s&&s.getTotalLength&&s.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(s,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,d=i.layout,u=i.children,h=Do(u,qj);if(!h)return null;var f=function(p,v){return{x:p.x,y:p.y,value:p.value,errorVal:pa(p.payload,v)}},m={clipPath:s?"url(#clipPath-".concat(a,")"):null};return ee.createElement(xn,m,h.map(function(x){return ee.cloneElement(x,{key:"bar-".concat(x.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,dataPointFormatter:f})}))}},{key:"renderDots",value:function(s,a,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,d=l.points,u=l.dataKey,h=cr(this.props,!1),f=cr(c,!0),m=d.map(function(p,v){var g=yo(yo(yo({key:"dot-".concat(v),r:3},h),f),{},{index:v,cx:p.x,cy:p.y,value:p.value,dataKey:u,payload:p.payload,points:d});return t.renderDotItem(c,g)}),x={clipPath:s?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return ee.createElement(xn,p0({className:"recharts-line-dots",key:"dots"},x),m)}},{key:"renderCurveStatically",value:function(s,a,i,o){var l=this.props,c=l.type,d=l.layout,u=l.connectNulls;l.ref;var h=sB(l,jWe),f=yo(yo(yo({},cr(h,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:s},o),{},{type:c,layout:d,connectNulls:u});return ee.createElement(K_,p0({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(s,a){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,d=o.isAnimationActive,u=o.animationBegin,h=o.animationDuration,f=o.animationEasing,m=o.animationId,x=o.animateNewValues,p=o.width,v=o.height,g=this.state,y=g.prevPoints,b=g.totalLength;return ee.createElement(sd,{begin:u,duration:h,isActive:d,easing:f,from:{t:0},to:{t:1},key:"line-".concat(m),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(w){var _=w.t;if(y){var C=y.length/l.length,E=l.map(function(O,A){var R=Math.floor(A*C);if(y[R]){var L=y[R],z=ko(L.x,O.x),U=ko(L.y,O.y);return yo(yo({},O),{},{x:z(_),y:U(_)})}if(x){var $=ko(p*2,O.x),q=ko(v/2,O.y);return yo(yo({},O),{},{x:$(_),y:q(_)})}return yo(yo({},O),{},{x:O.x,y:O.y})});return i.renderCurveStatically(E,s,a)}var N=ko(0,b),k=N(_),I;if(c){var P="".concat(c).split(/[,\s]+/gim).map(function(O){return parseFloat(O)});I=i.getStrokeDasharray(k,b,P)}else I=i.generateSimpleStrokeDasharray(b,k);return i.renderCurveStatically(l,s,a,{strokeDasharray:I})})}},{key:"renderCurve",value:function(s,a){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,d=c.prevPoints,u=c.totalLength;return l&&o&&o.length&&(!d&&u>0||!zj(d,o))?this.renderCurveWithAnimation(s,a):this.renderCurveStatically(o,s,a)}},{key:"render",value:function(){var s,a=this.props,i=a.hide,o=a.dot,l=a.points,c=a.className,d=a.xAxis,u=a.yAxis,h=a.top,f=a.left,m=a.width,x=a.height,p=a.isAnimationActive,v=a.id;if(i||!l||!l.length)return null;var g=this.state.isAnimationFinished,y=l.length===1,b=Mr("recharts-line",c),w=d&&d.allowDataOverflow,_=u&&u.allowDataOverflow,C=w||_,E=Or(v)?this.id:v,N=(s=cr(o,!1))!==null&&s!==void 0?s:{r:3,strokeWidth:2},k=N.r,I=k===void 0?3:k,P=N.strokeWidth,O=P===void 0?2:P,A=rCe(o)?o:{},R=A.clipDot,L=R===void 0?!0:R,z=I*2+O;return ee.createElement(xn,{className:b},w||_?ee.createElement("defs",null,ee.createElement("clipPath",{id:"clipPath-".concat(E)},ee.createElement("rect",{x:w?f:f-m/2,y:_?h:h-x/2,width:w?m:m*2,height:_?x:x*2})),!L&&ee.createElement("clipPath",{id:"clipPath-dots-".concat(E)},ee.createElement("rect",{x:f-z/2,y:h-z/2,width:m+z,height:x+z}))):null,!y&&this.renderCurve(C,E),this.renderErrorBar(C,E),(y||o)&&this.renderDots(C,L,E),(!p||g)&&Yd.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curPoints:s.points,prevPoints:a.curPoints}:s.points!==a.curPoints?{curPoints:s.points}:null}},{key:"repeat",value:function(s,a){for(var i=s.length%2!==0?[].concat(Vp(s),[0]):s,o=[],l=0;l<a;++l)o=[].concat(Vp(o),Vp(i));return o}},{key:"renderDotItem",value:function(s,a){var i;if(ee.isValidElement(s))i=ee.cloneElement(s,a);else if(Nr(s))i=s(a);else{var o=a.key,l=sB(a,wWe),c=Mr("recharts-line-dot",typeof s!="boolean"?s.className:"");i=ee.createElement(f5,p0({key:o},l,{className:c}))}return i}}])}(j.PureComponent);Ul(Wj,"displayName","Line");Ul(Wj,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Gc.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Ul(Wj,"getComposedData",function(e){var t=e.props,n=e.xAxis,s=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,l=e.bandSize,c=e.displayedData,d=e.offset,u=t.layout,h=c.map(function(f,m){var x=pa(f,o);return u==="horizontal"?{x:EF({axis:n,ticks:a,bandSize:l,entry:f,index:m}),y:Or(x)?null:s.scale(x),value:x,payload:f}:{x:Or(x)?null:n.scale(x),y:EF({axis:s,ticks:i,bandSize:l,entry:f,index:m}),value:x,payload:f}});return yo({points:h,layout:u},d)});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 RWe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MWe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Mee(s.key),s)}}function DWe(e,t,n){return t&&MWe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $We(e,t,n){return t=g2(t),FWe(e,Iee()?Reflect.construct(t,n||[],g2(e).constructor):t.apply(e,n))}function FWe(e,t){if(t&&(qx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BWe(e)}function BWe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Iee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Iee=function(){return!!e})()}function g2(e){return g2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},g2(e)}function UWe(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&&nE(e,t)}function nE(e,t){return nE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},nE(e,t)}function Ree(e,t,n){return t=Mee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mee(e){var t=zWe(e,"string");return qx(t)=="symbol"?t:t+""}function zWe(e,t){if(qx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(qx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sE(){return sE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},sE.apply(this,arguments)}function qWe(e){var t=e.xAxisId,n=yL(),s=bL(),a=yee(t);return a==null?null:j.createElement(Cv,sE({},a,{className:Mr("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:s},ticksGenerator:function(o){return zd(o,!0)}}))}var S5=function(e){function t(){return RWe(this,t),$We(this,t,arguments)}return UWe(t,e),DWe(t,[{key:"render",value:function(){return j.createElement(qWe,this.props)}}])}(j.Component);Ree(S5,"displayName","XAxis");Ree(S5,"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 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)}function VWe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function WWe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Fee(s.key),s)}}function HWe(e,t,n){return t&&WWe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function GWe(e,t,n){return t=x2(t),YWe(e,Dee()?Reflect.construct(t,n||[],x2(e).constructor):t.apply(e,n))}function YWe(e,t){if(t&&(Vx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KWe(e)}function KWe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Dee=function(){return!!e})()}function x2(e){return x2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},x2(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&&aE(e,t)}function aE(e,t){return aE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},aE(e,t)}function $ee(e,t,n){return t=Fee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fee(e){var t=ZWe(e,"string");return Vx(t)=="symbol"?t:t+""}function ZWe(e,t){if(Vx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Vx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function iE(){return iE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},iE.apply(this,arguments)}var JWe=function(t){var n=t.yAxisId,s=yL(),a=bL(),i=bee(n);return i==null?null:j.createElement(Cv,iE({},i,{className:Mr("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:s,height:a},ticksGenerator:function(l){return zd(l,!0)}}))},k5=function(e){function t(){return VWe(this,t),GWe(this,t,arguments)}return XWe(t,e),HWe(t,[{key:"render",value:function(){return j.createElement(JWe,this.props)}}])}(j.Component);$ee(k5,"displayName","YAxis");$ee(k5,"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 oB(e){return rHe(e)||tHe(e)||eHe(e)||QWe()}function QWe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 995In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eHe(e,t){if(e){if(typeof e=="string")return oE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oE(e,t)}}function tHe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rHe(e){if(Array.isArray(e))return oE(e)}function oE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var lE=function(t,n,s,a,i){var o=Do(t,wL),l=Do(t,w5),c=[].concat(oB(o),oB(l)),d=Do(t,_5),u="".concat(a,"Id"),h=a[0],f=n;if(c.length&&(f=c.reduce(function(p,v){if(v.props[u]===s&&Kc(v.props,"extendDomain")&&vt(v.props[h])){var g=v.props[h];return[Math.min(p[0],g),Math.max(p[1],g)]}return p},f)),d.length){var m="".concat(h,"1"),x="".concat(h,"2");f=d.reduce(function(p,v){if(v.props[u]===s&&Kc(v.props,"extendDomain")&&vt(v.props[m])&&vt(v.props[x])){var g=v.props[m],y=v.props[x];return[Math.min(p[0],g,y),Math.max(p[1],g,y)]}return p},f)}return i&&i.length&&(f=i.reduce(function(p,v){return vt(v)?[Math.min(p[0],v),Math.max(p[1],v)]:p},f)),f},Bee={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function a(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function i(c,d,u,h,f){if(typeof u!="function")throw new TypeError("The listener must be a function");var m=new a(u,h||c,f),x=n?n+d:d;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],m]:c._events[x].push(m):(c._events[x]=m,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new s:delete c._events[d]}function l(){this._events=new s,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,h;if(this._eventsCount===0)return d;for(h in u=this._events)t.call(u,h)&&d.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=n?n+d:d,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,m=h.length,x=new Array(m);f<m;f++)x[f]=h[f].fn;return x},l.prototype.listenerCount=function(d){var u=n?n+d:d,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(d,u,h,f,m,x){var p=n?n+d:d;if(!this._events[p])return!1;var v=this._events[p],g=arguments.length,y,b;if(v.fn){switch(v.once&&this.removeListener(d,v.fn,void 0,!0),g){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,u),!0;case 3:return v.fn.call(v.context,u,h),!0;case 4:return v.fn.call(v.context,u,h,f),!0;case 5:return v.fn.call(v.context,u,h,f,m),!0;case 6:return v.fn.call(v.context,u,h,f,m,x),!0}for(b=1,y=new Array(g-1);b<g;b++)y[b-1]=arguments[b];v.fn.apply(v.context,y)}else{var w=v.length,_;for(b=0;b<w;b++)switch(v[b].once&&this.removeListener(d,v[b].fn,void 0,!0),g){case 1:v[b].fn.call(v[b].context);break;case 2:v[b].fn.call(v[b].context,u);break;case 3:v[b].fn.call(v[b].context,u,h);break;case 4:v[b].fn.call(v[b].context,u,h,f);break;default:if(!y)for(_=1,y=new Array(g-1);_<g;_++)y[_-1]=arguments[_];v[b].fn.apply(v[b].context,y)}}return!0},l.prototype.on=function(d,u,h){return i(this,d,u,h,!1)},l.prototype.once=function(d,u,h){return i(this,d,u,h,!0)},l.prototype.removeListener=function(d,u,h,f){var m=n?n+d:d;if(!this._events[m])return this;if(!u)return o(this,m),this;var x=this._events[m];if(x.fn)x.fn===u&&(!f||x.once)&&(!h||x.context===h)&&o(this,m);else{for(var p=0,v=[],g=x.length;p<g;p++)(x[p].fn!==u||f&&!x[p].once||h&&x[p].context!==h)&&v.push(x[p]);v.length?this._events[m]=v.length===1?v[0]:v:o(this,m)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=n?n+d:d,this._events[u]&&o(this,u)):(this._events=new s,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l})(Bee);var nHe=Bee.exports;const sHe=_n(nHe);var eC=new sHe,tC="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 aHe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iHe(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Uee(s.key),s)}}function oHe(e,t,n){return t&&iHe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rC(e,t,n){return t=Uee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uee(e){var t=lHe(e,"string");return Lb(t)=="symbol"?t:t+""}function lHe(e,t){if(Lb(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Lb(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var cHe=function(){function e(){aHe(this,e),rC(this,"activeIndex",0),rC(this,"coordinateList",[]),rC(this,"layout","horizontal")}return oHe(e,[{key:"setDetails",value:function(n){var s,a=n.coordinateList,i=a===void 0?null:a,o=n.container,l=o===void 0?null:o,c=n.layout,d=c===void 0?null:c,u=n.offset,h=u===void 0?null:u,f=n.mouseHandlerCallback,m=f===void 0?null:f;this.coordinateList=(s=i??this.coordinateList)!==null&&s!==void 0?s:[],this.container=l??this.container,this.layout=d??this.layout,this.offset=h??this.offset,this.mouseHandlerCallback=m??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(n){if(this.coordinateList.length!==0)switch(n.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(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,s;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var a=this.container.getBoundingClientRect(),i=a.x,o=a.y,l=a.height,c=this.coordinateList[this.activeIndex].coordinate,d=((n=window)===null||n===void 0?void 0:n.scrollX)||0,u=((s=window)===null||s===void 0?void 0:s.scrollY)||0,h=i+c+d,f=o+this.offset.top+l/2+u;this.mouseHandlerCallback({pageX:h,pageY:f})}}}])}();function dHe(e,t,n){if(n==="number"&&t===!0&&Array.isArray(e)){var s=e==null?void 0:e[0],a=e==null?void 0:e[1];if(s&&a&&vt(s)&&vt(a))return!0}return!1}function uHe(e,t,n,s){var a=s/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-a,width:e==="horizontal"?s:n.width-1,height:e==="horizontal"?n.height-1:s}}function zee(e){var t=e.cx,n=e.cy,s=e.radius,a=e.startAngle,i=e.endAngle,o=Qn(t,n,s,a),l=Qn(t,n,s,i);return{points:[o,l],cx:t,cy:n,radius:s,startAngle:a,endAngle:i}}function hHe(e,t,n){var s,a,i,o;if(e==="horizontal")s=t.x,i=s,a=n.top,o=n.top+n.height;else if(e==="vertical")a=t.y,o=a,s=n.left,i=n.left+n.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,d=t.innerRadius,u=t.outerRadius,h=t.angle,f=Qn(l,c,d,h),m=Qn(l,c,u,h);s=f.x,a=f.y,i=m.x,o=m.y}else return zee(t);return[{x:s,y:a},{x:i,y:o}]}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 lB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function k1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lB(Object(n),!0).forEach(function(s){fHe(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lB(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function fHe(e,t,n){return t=mHe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mHe(e){var t=pHe(e,"string");return Ib(t)=="symbol"?t:t+""}function pHe(e,t){if(Ib(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Ib(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gHe(e){var t,n,s=e.element,a=e.tooltipEventType,i=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,d=e.activeTooltipIndex,u=e.tooltipAxisBandSize,h=e.layout,f=e.chartName,m=(t=s.props.cursor)!==null&&t!==void 0?t:(n=s.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!s||!m||!i||!o||f!=="ScatterChart"&&a!=="axis")return null;var x,p=K_;if(f==="ScatterChart")x=o,p=L9e;else if(f==="BarChart")x=uHe(h,o,c,u),p=pL;else if(h==="radial"){var v=zee(o),g=v.cx,y=v.cy,b=v.radius,w=v.startAngle,_=v.endAngle;x={cx:g,cy:y,startAngle:w,endAngle:_,innerRadius:b,outerRadius:b},p=$Q}else x={points:hHe(h,o,c)},p=K_;var C=k1(k1(k1(k1({stroke:"#ccc",pointerEvents:"none"},c),x),cr(m,!1)),{},{payload:l,payloadIndex:d,className:Mr("recharts-tooltip-cursor",m.className)});return j.isValidElement(m)?j.cloneElement(m,C):j.createElement(p,C)}var xHe=["item"],vHe=["children","className","width","height","style","compact","title","desc"];function Wx(e){"@babel/helpers - typeof";return Wx=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},Wx(e)}function vg(){return vg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},vg.apply(this,arguments)}function cB(e,t){return jHe(e)||bHe(e,t)||Vee(e,t)||yHe()}function yHe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 996In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bHe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function jHe(e){if(Array.isArray(e))return e}function dB(e,t){if(e==null)return{};var n=wHe(e,t),s,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)s=i[a],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function wHe(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function NHe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _He(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Wee(s.key),s)}}function SHe(e,t,n){return t&&_He(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function kHe(e,t,n){return t=v2(t),CHe(e,qee()?Reflect.construct(t,n||[],v2(e).constructor):t.apply(e,n))}function CHe(e,t){if(t&&(Wx(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return AHe(e)}function AHe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qee=function(){return!!e})()}function v2(e){return v2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},v2(e)}function PHe(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&&cE(e,t)}function cE(e,t){return cE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},cE(e,t)}function Hx(e){return OHe(e)||THe(e)||Vee(e)||EHe()}function EHe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 997In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vee(e,t){if(e){if(typeof e=="string")return dE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dE(e,t)}}function THe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function OHe(e){if(Array.isArray(e))return dE(e)}function dE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function uB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uB(Object(n),!0).forEach(function(s){hr(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uB(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function hr(e,t,n){return t=Wee(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wee(e){var t=LHe(e,"string");return Wx(t)=="symbol"?t:t+""}function LHe(e,t){if(Wx(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t||"default");if(Wx(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var IHe={xAxis:["bottom","top"],yAxis:["left","right"]},RHe={width:"100%",height:"100%"},Hee={x:0,y:0};function C1(e){return e}var MHe=function(t,n){return n==="horizontal"?t.x:n==="vertical"?t.y:n==="centric"?t.angle:t.radius},DHe=function(t,n,s,a){var i=n.find(function(u){return u&&u.index===s});if(i){if(t==="horizontal")return{x:i.coordinate,y:a.y};if(t==="vertical")return{x:a.x,y:i.coordinate};if(t==="centric"){var o=i.coordinate,l=a.radius;return Ye(Ye(Ye({},a),Qn(a.cx,a.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,d=a.angle;return Ye(Ye(Ye({},a),Qn(a.cx,a.cy,c,d)),{},{angle:d,radius:c})}return Hee},C5=function(t,n){var s=n.graphicalItems,a=n.dataStartIndex,i=n.dataEndIndex,o=(s??[]).reduce(function(l,c){var d=c.props.data;return d&&d.length?[].concat(Hx(l),Hx(d)):l},[]);return o.length>0?o:t&&t.length&&vt(a)&&vt(i)?t.slice(a,i+1):[]};function Gee(e){return e==="number"?[0,"auto"]:void 0}var uE=function(t,n,s,a){var i=t.graphicalItems,o=t.tooltipAxis,l=C5(n,t);return s<0||!i||!i.length||s>=l.length?null:i.reduce(function(c,d){var u,h=(u=d.props.data)!==null&&u!==void 0?u:n;h&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=s&&(h=h.slice(t.dataStartIndex,t.dataEndIndex+1));var f;if(o.dataKey&&!o.allowDuplicatedCategory){var m=h===void 0?l:h;f=v_(m,o.dataKey,a)}else f=h&&h[s]||l[s];return f?[].concat(Hx(c),[OQ(d,f)]):c},[])},hB=function(t,n,s,a){var i=a||{x:t.chartX,y:t.chartY},o=MHe(i,s),l=t.orderedTooltipTicks,c=t.tooltipAxis,d=t.tooltipTicks,u=nFe(o,l,d,c);if(u>=0&&d){var h=d[u]&&d[u].value,f=uE(t,n,u,h),m=DHe(s,l,u,i);return{activeTooltipIndex:u,activeLabel:h,activePayload:f,activeCoordinate:m}}return null},$He=function(t,n){var s=n.axes,a=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,u=t.layout,h=t.children,f=t.stackOffset,m=kQ(u,i);return s.reduce(function(x,p){var v,g=p.type.defaultProps!==void 0?Ye(Ye({},p.type.defaultProps),p.props):p.props,y=g.type,b=g.dataKey,w=g.allowDataOverflow,_=g.allowDuplicatedCategory,C=g.scale,E=g.ticks,N=g.includeHidden,k=g[o];if(x[k])return x;var I=C5(t.data,{graphicalItems:a.filter(function(F){var V,Z=o in F.props?F.props[o]:(V=F.type.defaultProps)===null||V===void 0?void 0:V[o];return Z===k}),dataStartIndex:c,dataEndIndex:d}),P=I.length,O,A,R;dHe(g.domain,w,y)&&(O=S3(g.domain,null,w),m&&(y==="number"||C!=="auto")&&(R=u0(I,b,"category")));var L=Gee(y);if(!O||O.length===0){var z,U=(z=g.domain)!==null&&z!==void 0?z:L;if(b){if(O=u0(I,b,y),y==="category"&&m){var $=Hke(O);_&&$?(A=O,O=a2(0,P)):_||(O=IF(U,O,p).reduce(function(F,V){return F.indexOf(V)>=0?F:[].concat(Hx(F),[V])},[]))}else if(y==="category")_?O=O.filter(function(F){return F!==""&&!Or(F)}):O=IF(U,O,p).reduce(function(F,V){return F.indexOf(V)>=0||V===""||Or(V)?F:[].concat(Hx(F),[V])},[]);else if(y==="number"){var q=lFe(I,a.filter(function(F){var V,Z,de=o in F.props?F.props[o]:(V=F.type.defaultProps)===null||V===void 0?void 0:V[o],ve="hide"in F.props?F.props.hide:(Z=F.type.defaultProps)===null||Z===void 0?void 0:Z.hide;return de===k&&(N||!ve)}),b,i,u);q&&(O=q)}m&&(y==="number"||C!=="auto")&&(R=u0(I,b,"category"))}else m?O=a2(0,P):l&&l[k]&&l[k].hasStack&&y==="number"?O=f==="expand"?[0,1]:TQ(l[k].stackGroups,c,d):O=SQ(I,a.filter(function(F){var V=o in F.props?F.props[o]:F.type.defaultProps[o],Z="hide"in F.props?F.props.hide:F.type.defaultProps.hide;return V===k&&(N||!Z)}),y,u,!0);if(y==="number")O=lE(h,O,k,i,E),U&&(O=S3(U,O,w));else if(y==="category"&&U){var ne=U,se=O.every(function(F){return ne.indexOf(F)>=0});se&&(O=ne)}}return Ye(Ye({},x),{},hr({},k,Ye(Ye({},g),{},{axisType:i,domain:O,categoricalDomain:R,duplicateDomain:A,originalDomain:(v=g.domain)!==null&&v!==void 0?v:L,isCategorical:m,layout:u})))},{})},FHe=function(t,n){var s=n.graphicalItems,a=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,u=t.layout,h=t.children,f=C5(t.data,{graphicalItems:s,dataStartIndex:c,dataEndIndex:d}),m=f.length,x=kQ(u,i),p=-1;return s.reduce(function(v,g){var y=g.type.defaultProps!==void 0?Ye(Ye({},g.type.defaultProps),g.props):g.props,b=y[o],w=Gee("number");if(!v[b]){p++;var _;return x?_=a2(0,m):l&&l[b]&&l[b].hasStack?(_=TQ(l[b].stackGroups,c,d),_=lE(h,_,b,i)):(_=S3(w,SQ(f,s.filter(function(C){var E,N,k=o in C.props?C.props[o]:(E=C.type.defaultProps)===null||E===void 0?void 0:E[o],I="hide"in C.props?C.props.hide:(N=C.type.defaultProps)===null||N===void 0?void 0:N.hide;return k===b&&!I}),"number",u),a.defaultProps.allowDataOverflow),_=lE(h,_,b,i)),Ye(Ye({},v),{},hr({},b,Ye(Ye({axisType:i},a.defaultProps),{},{hide:!0,orientation:Mo(IHe,"".concat(i,".").concat(p%2),null),domain:_,originalDomain:w,isCategorical:x,layout:u})))}return v},{})},BHe=function(t,n){var s=n.axisType,a=s===void 0?"xAxis":s,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,u=t.children,h="".concat(a,"Id"),f=Do(u,i),m={};return f&&f.length?m=$He(t,{axes:f,graphicalItems:o,axisType:a,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:d}):o&&o.length&&(m=FHe(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:d})),m},UHe=function(t){var n=Gu(t),s=zd(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:z6(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:H_(n,s)}},fB=function(t){var n=t.children,s=t.defaultShowTooltip,a=No(n,Mx),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(i=a.props.startIndex),a.props.endIndex>=0&&(o=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!s}},zHe=function(t){return!t||!t.length?!1:t.some(function(n){var s=Hd(n&&n.type);return s&&s.indexOf("Bar")>=0})},mB=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"}},qHe=function(t,n){var s=t.props,a=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,d=s.width,u=s.height,h=s.children,f=s.margin||{},m=No(h,Mx),x=No(h,pm),p=Object.keys(c).reduce(function(_,C){var E=c[C],N=E.orientation;return!E.mirror&&!E.hide?Ye(Ye({},_),{},hr({},N,_[N]+E.width)):_},{left:f.left||0,right:f.right||0}),v=Object.keys(o).reduce(function(_,C){var E=o[C],N=E.orientation;return!E.mirror&&!E.hide?Ye(Ye({},_),{},hr({},N,Mo(_,"".concat(N))+E.height)):_},{top:f.top||0,bottom:f.bottom||0}),g=Ye(Ye({},v),p),y=g.bottom;m&&(g.bottom+=m.props.height||Mx.defaultProps.height),x&&n&&(g=iFe(g,a,s,n));var b=d-g.left-g.right,w=u-g.top-g.bottom;return Ye(Ye({brushBottom:y},g),{},{width:Math.max(b,0),height:Math.max(w,0)})},VHe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},Yee=function(t){var n=t.chartName,s=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,d=t.legendContent,u=t.formatAxisMap,h=t.defaultProps,f=function(g,y){var b=y.graphicalItems,w=y.stackGroups,_=y.offset,C=y.updateId,E=y.dataStartIndex,N=y.dataEndIndex,k=g.barSize,I=g.layout,P=g.barGap,O=g.barCategoryGap,A=g.maxBarSize,R=mB(I),L=R.numericAxisName,z=R.cateAxisName,U=zHe(b),$=[];return b.forEach(function(q,ne){var se=C5(g.data,{graphicalItems:[q],dataStartIndex:E,dataEndIndex:N}),F=q.type.defaultProps!==void 0?Ye(Ye({},q.type.defaultProps),q.props):q.props,V=F.dataKey,Z=F.maxBarSize,de=F["".concat(L,"Id")],ve=F["".concat(z,"Id")],pe={},_e=c.reduce(function(ye,Ee){var Fe=y["".concat(Ee.axisType,"Map")],tt=F["".concat(Ee.axisType,"Id")];Fe&&Fe[tt]||Ee.axisType==="zAxis"||Fm();var qe=Fe[tt];return Ye(Ye({},ye),{},hr(hr({},Ee.axisType,qe),"".concat(Ee.axisType,"Ticks"),zd(qe)))},pe),xe=_e[z],oe=_e["".concat(z,"Ticks")],we=w&&w[de]&&w[de].hasStack&&xFe(q,w[de].stackGroups),ce=Hd(q.type).indexOf("Bar")>=0,De=H_(xe,oe),Ue=[],re=U&&sFe({barSize:k,stackGroups:w,totalSize:VHe(_e,z)});if(ce){var et,kt,St=Or(Z)?A:Z,Ve=(et=(kt=H_(xe,oe,!0))!==null&&kt!==void 0?kt:St)!==null&&et!==void 0?et:0;Ue=aFe({barGap:P,barCategoryGap:O,bandSize:Ve!==De?Ve:De,sizeList:re[ve],maxBarSize:St}),Ve!==De&&(Ue=Ue.map(function(ye){return Ye(Ye({},ye),{},{position:Ye(Ye({},ye.position),{},{offset:ye.position.offset-Ve/2})})}))}var he=q&&q.type&&q.type.getComposedData;he&&$.push({props:Ye(Ye({},he(Ye(Ye({},_e),{},{displayedData:se,props:g,dataKey:V,item:q,bandSize:De,barPosition:Ue,offset:_,stackedData:we,layout:I,dataStartIndex:E,dataEndIndex:N}))),{},hr(hr(hr({key:q.key||"item-".concat(ne)},L,_e[L]),z,_e[z]),"animationId",C)),childIndex:aCe(q,g.children),item:q})}),$},m=function(g,y){var b=g.props,w=g.dataStartIndex,_=g.dataEndIndex,C=g.updateId;if(!k8({props:b}))return null;var E=b.children,N=b.layout,k=b.stackOffset,I=b.data,P=b.reverseStackOrder,O=mB(N),A=O.numericAxisName,R=O.cateAxisName,L=Do(E,s),z=pFe(I,L,"".concat(A,"Id"),"".concat(R,"Id"),k,P),U=c.reduce(function(F,V){var Z="".concat(V.axisType,"Map");return Ye(Ye({},F),{},hr({},Z,BHe(b,Ye(Ye({},V),{},{graphicalItems:L,stackGroups:V.axisType===A&&z,dataStartIndex:w,dataEndIndex:_}))))},{}),$=qHe(Ye(Ye({},U),{},{props:b,graphicalItems:L}),y==null?void 0:y.legendBBox);Object.keys(U).forEach(function(F){U[F]=u(b,U[F],$,F.replace("Map",""),n)});var q=U["".concat(R,"Map")],ne=UHe(q),se=f(b,Ye(Ye({},U),{},{dataStartIndex:w,dataEndIndex:_,updateId:C,graphicalItems:L,stackGroups:z,offset:$}));return Ye(Ye({formattedGraphicalItems:se,graphicalItems:L,offset:$,stackGroups:z},ne),U)},x=function(v){function g(y){var b,w,_;return NHe(this,g),_=kHe(this,g,[y]),hr(_,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),hr(_,"accessibilityManager",new cHe),hr(_,"handleLegendBBoxUpdate",function(C){if(C){var E=_.state,N=E.dataStartIndex,k=E.dataEndIndex,I=E.updateId;_.setState(Ye({legendBBox:C},m({props:_.props,dataStartIndex:N,dataEndIndex:k,updateId:I},Ye(Ye({},_.state),{},{legendBBox:C}))))}}),hr(_,"handleReceiveSyncEvent",function(C,E,N){if(_.props.syncId===C){if(N===_.eventEmitterSymbol&&typeof _.props.syncMethod!="function")return;_.applySyncEvent(E)}}),hr(_,"handleBrushChange",function(C){var E=C.startIndex,N=C.endIndex;if(E!==_.state.dataStartIndex||N!==_.state.dataEndIndex){var k=_.state.updateId;_.setState(function(){return Ye({dataStartIndex:E,dataEndIndex:N},m({props:_.props,dataStartIndex:E,dataEndIndex:N,updateId:k},_.state))}),_.triggerSyncEvent({dataStartIndex:E,dataEndIndex:N})}}),hr(_,"handleMouseEnter",function(C){var E=_.getMouseInfo(C);if(E){var N=Ye(Ye({},E),{},{isTooltipActive:!0});_.setState(N),_.triggerSyncEvent(N);var k=_.props.onMouseEnter;Nr(k)&&k(N,C)}}),hr(_,"triggeredAfterMouseMove",function(C){var E=_.getMouseInfo(C),N=E?Ye(Ye({},E),{},{isTooltipActive:!0}):{isTooltipActive:!1};_.setState(N),_.triggerSyncEvent(N);var k=_.props.onMouseMove;Nr(k)&&k(N,C)}),hr(_,"handleItemMouseEnter",function(C){_.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),hr(_,"handleItemMouseLeave",function(){_.setState(function(){return{isTooltipActive:!1}})}),hr(_,"handleMouseMove",function(C){C.persist(),_.throttleTriggeredAfterMouseMove(C)}),hr(_,"handleMouseLeave",function(C){_.throttleTriggeredAfterMouseMove.cancel();var E={isTooltipActive:!1};_.setState(E),_.triggerSyncEvent(E);var N=_.props.onMouseLeave;Nr(N)&&N(E,C)}),hr(_,"handleOuterEvent",function(C){var E=sCe(C),N=Mo(_.props,"".concat(E));if(E&&Nr(N)){var k,I;/.*touch.*/i.test(E)?I=_.getMouseInfo(C.changedTouches[0]):I=_.getMouseInfo(C),N((k=I)!==null&&k!==void 0?k:{},C)}}),hr(_,"handleClick",function(C){var E=_.getMouseInfo(C);if(E){var N=Ye(Ye({},E),{},{isTooltipActive:!0});_.setState(N),_.triggerSyncEvent(N);var k=_.props.onClick;Nr(k)&&k(N,C)}}),hr(_,"handleMouseDown",function(C){var E=_.props.onMouseDown;if(Nr(E)){var N=_.getMouseInfo(C);E(N,C)}}),hr(_,"handleMouseUp",function(C){var E=_.props.onMouseUp;if(Nr(E)){var N=_.getMouseInfo(C);E(N,C)}}),hr(_,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&_.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),hr(_,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&_.handleMouseDown(C.changedTouches[0])}),hr(_,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&_.handleMouseUp(C.changedTouches[0])}),hr(_,"handleDoubleClick",function(C){var E=_.props.onDoubleClick;if(Nr(E)){var N=_.getMouseInfo(C);E(N,C)}}),hr(_,"handleContextMenu",function(C){var E=_.props.onContextMenu;if(Nr(E)){var N=_.getMouseInfo(C);E(N,C)}}),hr(_,"triggerSyncEvent",function(C){_.props.syncId!==void 0&&eC.emit(tC,_.props.syncId,C,_.eventEmitterSymbol)}),hr(_,"applySyncEvent",function(C){var E=_.props,N=E.layout,k=E.syncMethod,I=_.state.updateId,P=C.dataStartIndex,O=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)_.setState(Ye({dataStartIndex:P,dataEndIndex:O},m({props:_.props,dataStartIndex:P,dataEndIndex:O,updateId:I},_.state)));else if(C.activeTooltipIndex!==void 0){var A=C.chartX,R=C.chartY,L=C.activeTooltipIndex,z=_.state,U=z.offset,$=z.tooltipTicks;if(!U)return;if(typeof k=="function")L=k($,C);else if(k==="value"){L=-1;for(var q=0;q<$.length;q++)if($[q].value===C.activeLabel){L=q;break}}var ne=Ye(Ye({},U),{},{x:U.left,y:U.top}),se=Math.min(A,ne.x+ne.width),F=Math.min(R,ne.y+ne.height),V=$[L]&&$[L].value,Z=uE(_.state,_.props.data,L),de=$[L]?{x:N==="horizontal"?$[L].coordinate:se,y:N==="horizontal"?F:$[L].coordinate}:Hee;_.setState(Ye(Ye({},C),{},{activeLabel:V,activeCoordinate:de,activePayload:Z,activeTooltipIndex:L}))}else _.setState(C)}),hr(_,"renderCursor",function(C){var E,N=_.state,k=N.isTooltipActive,I=N.activeCoordinate,P=N.activePayload,O=N.offset,A=N.activeTooltipIndex,R=N.tooltipAxisBandSize,L=_.getTooltipEventType(),z=(E=C.props.active)!==null&&E!==void 0?E:k,U=_.props.layout,$=C.key||"_recharts-cursor";return ee.createElement(gHe,{key:$,activeCoordinate:I,activePayload:P,activeTooltipIndex:A,chartName:n,element:C,isActive:z,layout:U,offset:O,tooltipAxisBandSize:R,tooltipEventType:L})}),hr(_,"renderPolarAxis",function(C,E,N){var k=Mo(C,"type.axisType"),I=Mo(_.state,"".concat(k,"Map")),P=C.type.defaultProps,O=P!==void 0?Ye(Ye({},P),C.props):C.props,A=I&&I[O["".concat(k,"Id")]];return j.cloneElement(C,Ye(Ye({},A),{},{className:Mr(k,A.className),key:C.key||"".concat(E,"-").concat(N),ticks:zd(A,!0)}))}),hr(_,"renderPolarGrid",function(C){var E=C.props,N=E.radialLines,k=E.polarAngles,I=E.polarRadius,P=_.state,O=P.radiusAxisMap,A=P.angleAxisMap,R=Gu(O),L=Gu(A),z=L.cx,U=L.cy,$=L.innerRadius,q=L.outerRadius;return j.cloneElement(C,{polarAngles:Array.isArray(k)?k:zd(L,!0).map(function(ne){return ne.coordinate}),polarRadius:Array.isArray(I)?I:zd(R,!0).map(function(ne){return ne.coordinate}),cx:z,cy:U,innerRadius:$,outerRadius:q,key:C.key||"polar-grid",radialLines:N})}),hr(_,"renderLegend",function(){var C=_.state.formattedGraphicalItems,E=_.props,N=E.children,k=E.width,I=E.height,P=_.props.margin||{},O=k-(P.left||0)-(P.right||0),A=NQ({children:N,formattedGraphicalItems:C,legendWidth:O,legendContent:d});if(!A)return null;var R=A.item,L=dB(A,xHe);return j.cloneElement(R,Ye(Ye({},L),{},{chartWidth:k,chartHeight:I,margin:P,onBBoxUpdate:_.handleLegendBBoxUpdate}))}),hr(_,"renderTooltip",function(){var C,E=_.props,N=E.children,k=E.accessibilityLayer,I=No(N,Fl);if(!I)return null;var P=_.state,O=P.isTooltipActive,A=P.activeCoordinate,R=P.activePayload,L=P.activeLabel,z=P.offset,U=(C=I.props.active)!==null&&C!==void 0?C:O;return j.cloneElement(I,{viewBox:Ye(Ye({},z),{},{x:z.left,y:z.top}),active:U,label:L,payload:U?R:[],coordinate:A,accessibilityLayer:k})}),hr(_,"renderBrush",function(C){var E=_.props,N=E.margin,k=E.data,I=_.state,P=I.offset,O=I.dataStartIndex,A=I.dataEndIndex,R=I.updateId;return j.cloneElement(C,{key:C.key||"_recharts-brush",onChange:w1(_.handleBrushChange,C.props.onChange),data:k,x:vt(C.props.x)?C.props.x:P.left,y:vt(C.props.y)?C.props.y:P.top+P.height+P.brushBottom-(N.bottom||0),width:vt(C.props.width)?C.props.width:P.width,startIndex:O,endIndex:A,updateId:"brush-".concat(R)})}),hr(_,"renderReferenceElement",function(C,E,N){if(!C)return null;var k=_,I=k.clipPathId,P=_.state,O=P.xAxisMap,A=P.yAxisMap,R=P.offset,L=C.type.defaultProps||{},z=C.props,U=z.xAxisId,$=U===void 0?L.xAxisId:U,q=z.yAxisId,ne=q===void 0?L.yAxisId:q;return j.cloneElement(C,{key:C.key||"".concat(E,"-").concat(N),xAxis:O[$],yAxis:A[ne],viewBox:{x:R.left,y:R.top,width:R.width,height:R.height},clipPathId:I})}),hr(_,"renderActivePoints",function(C){var E=C.item,N=C.activePoint,k=C.basePoint,I=C.childIndex,P=C.isRange,O=[],A=E.props.key,R=E.item.type.defaultProps!==void 0?Ye(Ye({},E.item.type.defaultProps),E.item.props):E.item.props,L=R.activeDot,z=R.dataKey,U=Ye(Ye({index:I,dataKey:z,cx:N.x,cy:N.y,r:4,fill:mL(E.item),strokeWidth:2,stroke:"#fff",payload:N.payload,value:N.value},cr(L,!1)),y_(L));return O.push(g.renderActiveDot(L,U,"".concat(A,"-activePoint-").concat(I))),k?O.push(g.renderActiveDot(L,Ye(Ye({},U),{},{cx:k.x,cy:k.y}),"".concat(A,"-basePoint-").concat(I))):P&&O.push(null),O}),hr(_,"renderGraphicChild",function(C,E,N){var k=_.filterFormatItem(C,E,N);if(!k)return null;var I=_.getTooltipEventType(),P=_.state,O=P.isTooltipActive,A=P.tooltipAxis,R=P.activeTooltipIndex,L=P.activeLabel,z=_.props.children,U=No(z,Fl),$=k.props,q=$.points,ne=$.isRange,se=$.baseLine,F=k.item.type.defaultProps!==void 0?Ye(Ye({},k.item.type.defaultProps),k.item.props):k.item.props,V=F.activeDot,Z=F.hide,de=F.activeBar,ve=F.activeShape,pe=!!(!Z&&O&&U&&(V||de||ve)),_e={};I!=="axis"&&U&&U.props.trigger==="click"?_e={onClick:w1(_.handleItemMouseEnter,C.props.onClick)}:I!=="axis"&&(_e={onMouseLeave:w1(_.handleItemMouseLeave,C.props.onMouseLeave),onMouseEnter:w1(_.handleItemMouseEnter,C.props.onMouseEnter)});var xe=j.cloneElement(C,Ye(Ye({},k.props),_e));function oe(Ee){return typeof A.dataKey=="function"?A.dataKey(Ee.payload):null}if(pe)if(R>=0){var we,ce;if(A.dataKey&&!A.allowDuplicatedCategory){var De=typeof A.dataKey=="function"?oe:"payload.".concat(A.dataKey.toString());we=v_(q,De,L),ce=ne&&se&&v_(se,De,L)}else we=q==null?void 0:q[R],ce=ne&&se&&se[R];if(ve||de){var Ue=C.props.activeIndex!==void 0?C.props.activeIndex:R;return[j.cloneElement(C,Ye(Ye(Ye({},k.props),_e),{},{activeIndex:Ue})),null,null]}if(!Or(we))return[xe].concat(Hx(_.renderActivePoints({item:k,activePoint:we,basePoint:ce,childIndex:R,isRange:ne})))}else{var re,et=(re=_.getItemByXY(_.state.activeCoordinate))!==null&&re!==void 0?re:{graphicalItem:xe},kt=et.graphicalItem,St=kt.item,Ve=St===void 0?C:St,he=kt.childIndex,ye=Ye(Ye(Ye({},k.props),_e),{},{activeIndex:he});return[j.cloneElement(Ve,ye),null,null]}return ne?[xe,null,null]:[xe,null]}),hr(_,"renderCustomized",function(C,E,N){return j.cloneElement(C,Ye(Ye({key:"recharts-customized-".concat(N)},_.props),_.state))}),hr(_,"renderMap",{CartesianGrid:{handler:C1,once:!0},ReferenceArea:{handler:_.renderReferenceElement},ReferenceLine:{handler:C1},ReferenceDot:{handler:_.renderReferenceElement},XAxis:{handler:C1},YAxis:{handler:C1},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((b=y.id)!==null&&b!==void 0?b:bv("recharts"),"-clip"),_.throttleTriggeredAfterMouseMove=wJ(_.triggeredAfterMouseMove,(w=y.throttleDelay)!==null&&w!==void 0?w:1e3/60),_.state={},_}return PHe(g,v),SHe(g,[{key:"componentDidMount",value:function(){var b,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(b=this.props.margin.left)!==null&&b!==void 0?b:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var b=this.props,w=b.children,_=b.data,C=b.height,E=b.layout,N=No(w,Fl);if(N){var k=N.props.defaultIndex;if(!(typeof k!="number"||k<0||k>this.state.tooltipTicks.length-1)){var I=this.state.tooltipTicks[k]&&this.state.tooltipTicks[k].value,P=uE(this.state,_,k,I),O=this.state.tooltipTicks[k].coordinate,A=(this.state.offset.top+C)/2,R=E==="horizontal",L=R?{x:O,y:A}:{y:O,x:A},z=this.state.formattedGraphicalItems.find(function($){var q=$.item;return q.type.name==="Scatter"});z&&(L=Ye(Ye({},L),z.props.points[k].tooltipPosition),P=z.props.points[k].tooltipPayload);var U={activeTooltipIndex:k,isTooltipActive:!0,activeLabel:I,activePayload:P,activeCoordinate:L};this.setState(U),this.renderCursor(N),this.accessibilityManager.setIndex(k)}}}},{key:"getSnapshotBeforeUpdate",value:function(b,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==b.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==b.margin){var _,C;this.accessibilityManager.setDetails({offset:{left:(_=this.props.margin.left)!==null&&_!==void 0?_:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(b){BP([No(b.children,Fl)],[No(this.props.children,Fl)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var b=No(this.props.children,Fl);if(b&&typeof b.props.shared=="boolean"){var w=b.props.shared?"axis":"item";return l.indexOf(w)>=0?w:i}return i}},{key:"getMouseInfo",value:function(b){if(!this.container)return null;var w=this.container,_=w.getBoundingClientRect(),C=TRe(_),E={chartX:Math.round(b.pageX-C.left),chartY:Math.round(b.pageY-C.top)},N=_.width/w.offsetWidth||1,k=this.inRange(E.chartX,E.chartY,N);if(!k)return null;var I=this.state,P=I.xAxisMap,O=I.yAxisMap,A=this.getTooltipEventType(),R=hB(this.state,this.props.data,this.props.layout,k);if(A!=="axis"&&P&&O){var L=Gu(P).scale,z=Gu(O).scale,U=L&&L.invert?L.invert(E.chartX):null,$=z&&z.invert?z.invert(E.chartY):null;return Ye(Ye({},E),{},{xValue:U,yValue:$},R)}return R?Ye(Ye({},E),R):null}},{key:"inRange",value:function(b,w){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,E=b/_,N=w/_;if(C==="horizontal"||C==="vertical"){var k=this.state.offset,I=E>=k.left&&E<=k.left+k.width&&N>=k.top&&N<=k.top+k.height;return I?{x:E,y:N}:null}var P=this.state,O=P.angleAxisMap,A=P.radiusAxisMap;if(O&&A){var R=Gu(O);return DF({x:E,y:N},R)}return null}},{key:"parseEventsOfWrapper",value:function(){var b=this.props.children,w=this.getTooltipEventType(),_=No(b,Fl),C={};_&&w==="axis"&&(_.props.trigger==="click"?C={onClick:this.handleClick}:C={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 E=y_(this.props,this.handleOuterEvent);return Ye(Ye({},E),C)}},{key:"addListener",value:function(){eC.on(tC,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){eC.removeListener(tC,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(b,w,_){for(var C=this.state.formattedGraphicalItems,E=0,N=C.length;E<N;E++){var k=C[E];if(k.item===b||k.props.key===b.key||w===Hd(k.item.type)&&_===k.childIndex)return k}return null}},{key:"renderClipPath",value:function(){var b=this.clipPathId,w=this.state.offset,_=w.left,C=w.top,E=w.height,N=w.width;return ee.createElement("defs",null,ee.createElement("clipPath",{id:b},ee.createElement("rect",{x:_,y:C,height:E,width:N})))}},{key:"getXScales",value:function(){var b=this.state.xAxisMap;return b?Object.entries(b).reduce(function(w,_){var C=cB(_,2),E=C[0],N=C[1];return Ye(Ye({},w),{},hr({},E,N.scale))},{}):null}},{key:"getYScales",value:function(){var b=this.state.yAxisMap;return b?Object.entries(b).reduce(function(w,_){var C=cB(_,2),E=C[0],N=C[1];return Ye(Ye({},w),{},hr({},E,N.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(b){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(b){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[b])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(b){var w=this.state,_=w.formattedGraphicalItems,C=w.activeItem;if(_&&_.length)for(var E=0,N=_.length;E<N;E++){var k=_[E],I=k.props,P=k.item,O=P.type.defaultProps!==void 0?Ye(Ye({},P.type.defaultProps),P.props):P.props,A=Hd(P.type);if(A==="Bar"){var R=(I.data||[]).find(function($){return f9e(b,$)});if(R)return{graphicalItem:k,payload:R}}else if(A==="RadialBar"){var L=(I.data||[]).find(function($){return DF(b,$)});if(L)return{graphicalItem:k,payload:L}}else if(v5(k,C)||y5(k,C)||Ab(k,C)){var z=tze({graphicalItem:k,activeTooltipItem:C,itemData:O.data}),U=O.activeIndex===void 0?z:O.activeIndex;return{graphicalItem:Ye(Ye({},k),{},{childIndex:U}),payload:Ab(k,C)?O.data[z]:k.props.data[z]}}}return null}},{key:"render",value:function(){var b=this;if(!k8(this))return null;var w=this.props,_=w.children,C=w.className,E=w.width,N=w.height,k=w.style,I=w.compact,P=w.title,O=w.desc,A=dB(w,vHe),R=cr(A,!1);if(I)return ee.createElement(W7,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ee.createElement(zP,vg({},R,{width:E,height:N,title:P,desc:O}),this.renderClipPath(),A8(_,this.renderMap)));if(this.props.accessibilityLayer){var L,z;R.tabIndex=(L=this.props.tabIndex)!==null&&L!==void 0?L:0,R.role=(z=this.props.role)!==null&&z!==void 0?z:"application",R.onKeyDown=function($){b.accessibilityManager.keyboardEvent($)},R.onFocus=function(){b.accessibilityManager.focus()}}var U=this.parseEventsOfWrapper();return ee.createElement(W7,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},ee.createElement("div",vg({className:Mr("recharts-wrapper",C),style:Ye
997({position:"relative",cursor:"default",width:E,height:N},k)},U,{ref:function(q){b.container=q}}),ee.createElement(zP,vg({},R,{width:E,height:N,title:P,desc:O,style:RHe}),this.renderClipPath(),A8(_,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(j.Component);hr(x,"displayName",n),hr(x,"defaultProps",Ye({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},h)),hr(x,"getDerivedStateFromProps",function(v,g){var y=v.dataKey,b=v.data,w=v.children,_=v.width,C=v.height,E=v.layout,N=v.stackOffset,k=v.margin,I=g.dataStartIndex,P=g.dataEndIndex;if(g.updateId===void 0){var O=fB(v);return Ye(Ye(Ye({},O),{},{updateId:0},m(Ye(Ye({props:v},O),{},{updateId:0}),g)),{},{prevDataKey:y,prevData:b,prevWidth:_,prevHeight:C,prevLayout:E,prevStackOffset:N,prevMargin:k,prevChildren:w})}if(y!==g.prevDataKey||b!==g.prevData||_!==g.prevWidth||C!==g.prevHeight||E!==g.prevLayout||N!==g.prevStackOffset||!Og(k,g.prevMargin)){var A=fB(v),R={chartX:g.chartX,chartY:g.chartY,isTooltipActive:g.isTooltipActive},L=Ye(Ye({},hB(g,b,E)),{},{updateId:g.updateId+1}),z=Ye(Ye(Ye({},A),R),L);return Ye(Ye(Ye({},z),m(Ye({props:v},z),g)),{},{prevDataKey:y,prevData:b,prevWidth:_,prevHeight:C,prevLayout:E,prevStackOffset:N,prevMargin:k,prevChildren:w})}if(!BP(w,g.prevChildren)){var U,$,q,ne,se=No(w,Mx),F=se&&(U=($=se.props)===null||$===void 0?void 0:$.startIndex)!==null&&U!==void 0?U:I,V=se&&(q=(ne=se.props)===null||ne===void 0?void 0:ne.endIndex)!==null&&q!==void 0?q:P,Z=F!==I||V!==P,de=!Or(b),ve=de&&!Z?g.updateId:g.updateId+1;return Ye(Ye({updateId:ve},m(Ye(Ye({props:v},g),{},{updateId:ve,dataStartIndex:F,dataEndIndex:V}),g)),{},{prevChildren:w,dataStartIndex:F,dataEndIndex:V})}return null}),hr(x,"renderActiveDot",function(v,g,y){var b;return j.isValidElement(v)?b=j.cloneElement(v,g):Nr(v)?b=v(g):b=ee.createElement(f5,g),ee.createElement(xn,{className:"recharts-active-dot",key:y},b)});var p=j.forwardRef(function(g,y){return ee.createElement(x,vg({},g,{ref:y}))});return p.displayName=x.displayName,p},WHe=Yee({chartName:"LineChart",GraphicalChild:Wj,axisComponents:[{axisType:"xAxis",AxisComp:S5},{axisType:"yAxis",AxisComp:k5}],formatAxisMap:Lqe}),HHe=Yee({chartName:"PieChart",GraphicalChild:fu,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:x5},{axisType:"radiusAxis",AxisComp:p5}],formatAxisMap:CFe,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const pB=["#10b981","#f59e0b","#8b5cf6"];function GHe(){var w;const[e,t]=j.useState(null),[n,s]=j.useState([]),[a,i]=j.useState([]),[o,l]=j.useState(!0),[c,d]=j.useState(!1);j.useEffect(()=>{u()},[]);const u=async()=>{l(!0);try{await Promise.all([h(),f(),m()])}finally{l(!1)}},h=async()=>{const{data:_,error:C}=await H.rpc("get_subscription_stats");if(C){console.error("Error fetching stats:",C);return}t(_[0]||{total_revenue:0,monthly_revenue:0,active_subscriptions:0,free_users:0,pro_users:0,enterprise_users:0,churn_rate:0})},f=async()=>{const{data:_,error:C}=await H.from("vendor_subscriptions").select(` 998 *, 999 profiles!inner(email) 1000 `).order("created_at",{ascending:!1}).limit(50);if(C){console.error("Error fetching subscriptions:",C);return}const E=(_==null?void 0:_.map(N=>{var k;return{id:N.id,user_email:((k=N.profiles)==null?void 0:k.email)||"Unknown",plan:N.plan,status:N.status,amount:N.amount,current_period_start:N.current_period_start,current_period_end:N.current_period_end,featured_credits_remaining:N.featured_credits_remaining,cancel_at_period_end:N.cancel_at_period_end}}))||[];s(E)},m=async()=>{const{data:_,error:C}=await H.rpc("get_monthly_revenue_chart");if(C){console.error("Error fetching revenue chart:",C);return}i(_||[])},x=async()=>{d(!0);try{const{error:_}=await H.rpc("reset_monthly_credits");if(_)throw _;be({title:"Credits Reset",description:"Monthly featured credits have been reset for all active subscriptions"}),u()}catch(_){be({title:"Reset Failed",description:_.message,variant:"destructive"})}finally{d(!1)}},p=async()=>{d(!0);try{const{error:_}=await H.rpc("expire_subscriptions");
1000if(_)throw _;be({title:"Subscriptions Expired",description:"Expired subscriptions have been processed"}),u()}catch(_){be({title:"Expiration Failed",description:_.message,variant:"destructive"})}finally{d(!1)}},v=()=>{const _=[["Email","Plan","Status","Amount","Period Start","Period End","Credits"],...n.map(k=>[k.user_email,k.plan,k.status,k.amount,new Date(k.current_period_start).toLocaleDateString(),new Date(k.current_period_end).toLocaleDateString(),k.featured_credits_remaining])].map(k=>k.join(",")).join(` 1001`),C=new Blob([_],{type:"text/csv"}),E=window.URL.createObjectURL(C),N=document.createElement("a");N.href=E,N.download=`subscriptions-${new Date().toISOString().split("T")[0]}.csv`,N.click()},g=_=>new Intl.NumberFormat("en-NG",{style:"currency",currency:"NGN",minimumFractionDigits:0}).format(_),y=_=>new Date(_).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"});if(o)return r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})});const b=[{name:"Free",value:(e==null?void 0:e.free_users)||0},{name:"Pro",value:(e==null?void 0:e.pro_users)||0},{name:"Enterprise",value:(e==null?void 0:e.enterprise_users)||0}].filter(_=>_.value>0);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-3xl font-bold",children:"Subscription Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Monitor revenue and manage subscriptions"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{variant:"outline",onClick:x,disabled:c,children:[c?r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(ms,{className:"mr-2 h-4 w-4"}),"Reset Credits"]}),r.jsxs(W,{variant:"outline",onClick:p,disabled:c,children:[r.jsx(Xt,{className:"mr-2 h-4 w-4"}),"Process Expirations"]}),r.jsxs(W,{onClick:v,children:[r.jsx(qh,{className:"mr-2 h-4 w-4"}),"Export CSV"]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Total Revenue"}),r.jsx(Tn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-2xl font-bold",children:g((e==null?void 0:e.total_revenue)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Monthly Revenue"}),r.jsx(lr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-2xl font-bold",children:g((e==null?void 0:e.monthly_revenue)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This month"})]})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Active Subscriptions"}),r.jsx(Yr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-2xl font-bold",children:(e==null?void 0:e.active_subscriptions)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(e==null?void 0:e.pro_users)||0," Pro, ",(e==null?void 0:e.enterprise_users)||0," Enterprise"]})]})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Churn Rate"}),r.jsx(vn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsxs("div",{className:"text-2xl font-bold",children:[((w=e==null?void 0:e.churn_rate)==null?void 0:w.toFixed(1))||0,"%"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]}),r.jsxs(Kr,{defaultValue:"overview",className:"space-y-4",children:[r.jsxs(Hr,{children:[r.jsx(Re,{value:"overview",children:"Overview"}),r.jsx(Re,{value:"subscriptions",children:"Subscriptions"}),r.jsx(Re,{value:"analytics",children:"Analytics"})]}),r.jsx(Be,{value:"overview",className:"space-y-4",children:r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Y,{className:"col-span-1",children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Monthly Revenue Trend"}),r.jsx(Nt,{children:"Last 6 months"})]}),r.jsx(X,{children:r.jsx(S$,{width:"100%",height:300,children:r.jsxs(WHe,{data:a,children:[r.jsx(Tee,{strokeDasharray:"3 3"}),r.jsx(S5,{dataKey:"month"}),r.jsx(k5,{}),r.jsx(Fl,{formatter:_=>g(Number(_))}),r.jsx(pm,{}),r.jsx(Wj,{type:"monotone",dataKey:"revenue",stroke:"#8884d8",strokeWidth:2})]})})})]}),r.jsxs(Y,{className:"col-span-1",children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Plan Distribution"}),r.jsx(Nt,{children:"Active users by plan"})]}),r.jsx(X,{children:r.jsx(S$,{width:"100%",height:300,children:r.jsxs(HHe,{children:[r.jsx(fu,{data:b,cx:"50%",cy:"50%",labelLine:!1,label:({name:_,percent:C})=>`${_} ${(C*100).toFixed(0)}%`,outerRadius:80,fill:"#8884d8",dataKey:"value",children:b.map((_,C)=>r.jsx(t5,{fill:pB[C%pB.length]},`cell-${C}`))}),r.jsx(Fl,{})]})})})]})]})}),r.jsx(Be,{value:"subscriptions",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"All Subscriptions"}),r.jsx(Nt,{children:"Manage and monitor active subscriptions"})]}),r.jsx(X,{children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"User"}),r.jsx(jt,{children:"Plan"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{children:"Amount"}),r.jsx(jt,{children:"Period End"}),r.jsx(jt,{children:"Credits"}),r.jsx(jt,{children:"Actions"})]})}),r.jsx(Oi,{children:n.map(_=>r.jsxs(On,{children:[r.jsx(wt,{className:"font-medium",children:_.user_email}),r.jsx(wt,{children:r.jsxs(te,{variant:_.plan==="enterprise"?"default":_.plan==="pro"?"secondary":"outline",children:[_.plan==="enterprise"&&r.jsx(yh,{className:"h-3 w-3 mr-1"}),_.plan.toUpperCase()]})}),r.jsx(wt,{children:r.jsxs(te,{variant:_.status==="active"?"default":_.status==="cancelled"?"destructive":"secondary",children:[_.status==="active"&&r.jsx(er,{className:"h-3 w-3 mr-1"}),_.status==="cancelled"&&r.jsx(ya,{className:"h-3 w-3 mr-1"}),_.status]})}),r.jsx(wt,{children:g(_.amount)}),r.jsxs(wt,{children:[y(_.current_period_end),_.cancel_at_period_end&&r.jsx(te,{variant:"outline",className:"ml-2 text-xs",children:"Ending"})]}),r.jsx(wt,{children:_.featured_credits_remaining}),r.jsx(wt,{children:r.jsx(W,{variant:"ghost",size:"sm",children:"View"})})]},_.id))})]})})]})}),r.jsx(Be,{value:"analytics",children:r.jsx("div",{className:"grid gap-4",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Subscription Analytics"}),r.jsx(Nt,{children:"Detailed metrics and insights"})]}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsxs(Sr,{children:[r.jsx("strong",{children:"Pro Tip:"})," Monitor churn rate monthly. A rate above 5% indicates issues with value proposition or pricing."]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Average Revenue per User"}),r.jsx("p",{className:"text-2xl font-bold",children:g(((e==null?void 0:e.total_revenue)||0)/((e==null?void 0:e.active_subscriptions)||1))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Pro Conversion Rate"}),r.jsxs("p",{className:"text-2xl font-bold",children:[(((e==null?void 0:e.pro_users)||0)/(((e==null?void 0:e.free_users)||1)+((e==null?void 0:e.pro_users)||0))*100).toFixed(1),"%"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enterprise Adoption"}),r.jsxs("p",{className:"text-2xl font-bold",children:[(((e==null?void 0:e.enterprise_users)||0)/((e==null?void 0:e.active_subscriptions)||1)*100).toFixed(1),"%"]})]})]})]})})]})})})]})]})}function YHe(){const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState(""),[o,l]=j.useState(null),[c,d]=j.useState(!1),[u,h]=j.useState(!1),[f,m]=j.useState({total:0,pending:0,approved:0,rejected:0});j.useEffect(()=>{x()},[]);const x=async()=>{s(!0);try{const{data:N,error:k}=await H.from("classifieds").select("*").order("created_at",{ascending:!1});if(k)throw k;const I=[...new Set((N==null?void 0:N.map(R=>
1001R.user_id))||[])],{data:P}=await H.from("profiles").select("id, email, full_name").in("id",I),O=new Map((P==null?void 0:P.map(R=>[R.id,R]))||[]),A=(N||[]).map(R=>{var L,z;return{...R,user_email:((L=O.get(R.user_id))==null?void 0:L.email)||"N/A",poster_name:((z=O.get(R.user_id))==null?void 0:z.full_name)||"Unknown"}});t(A),m({total:A.length,pending:A.filter(R=>R.moderation_status==="pending").length,approved:A.filter(R=>R.moderation_status==="approved").length,rejected:A.filter(R=>R.moderation_status==="rejected").length})}catch(N){console.error("Error fetching classifieds:",N),Et.error("Failed to load classifieds")}finally{s(!1)}},p=async N=>{h(!0);try{const{error:k}=await H.from("classifieds").update({moderation_status:"approved",status:"active"}).eq("id",N);if(k)throw k;Et.success("Classified approved"),x(),d(!1)}catch{Et.error("Failed to approve classified")}finally{h(!1)}},v=async N=>{if(confirm("Are you sure you want to reject this classified?")){h(!0);try{const{error:k}=await H.from("classifieds").update({moderation_status:"rejected",status:"inactive"}).eq("id",N);if(k)throw k;Et.success("Classified rejected"),x(),d(!1)}catch{Et.error("Failed to reject classified")}finally{h(!1)}}},g=async N=>{if(confirm("Are you sure you want to permanently delete this classified?")){h(!0);try{const{error:k}=await H.from("classifieds").delete().eq("id",N);if(k)throw k;Et.success("Classified deleted"),x(),d(!1)}catch{Et.error("Failed to delete classified")}finally{h(!1)}}},y=(N,k)=>k==="pending"?r.jsx(te,{className:"bg-yellow-600",children:"Pending Review"}):k==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):k==="approved"&&N==="active"?r.jsx(te,{className:"bg-green-600",children:"Active"}):r.jsx(te,{variant:"outline",children:"Inactive"}),b=N=>new Date(N).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}),w=e.filter(N=>{var k,I;return N.title.toLowerCase().includes(a.toLowerCase())||((k=N.poster_name)==null?void 0:k.toLowerCase().includes(a.toLowerCase()))||((I=N.user_email)==null?void 0:I.toLowerCase().includes(a.toLowerCase()))}),_=w.filter(N=>N.moderation_status==="pending"),C=w.filter(N=>N.moderation_status==="approved"),E=w.filter(N=>N.moderation_status==="rejected");return n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(fr,{className:"h-6 w-6"}),"Classifieds Management"]}),r.jsx("p",{className:"text-muted-foreground",children:"Review and moderate classified listings"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"}),r.jsx("p",{className:"text-2xl font-bold",children:f.total})]}),r.jsx(fr,{className:"h-8 w-8 text-primary opacity-50"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Pending"}),r.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:f.pending})]}),r.jsx($r,{className:"h-8 w-8 text-yellow-600 opacity-50"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Approved"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:f.approved})]}),r.jsx(er,{className:"h-8 w-8 text-green-600 opacity-50"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Rejected"}),r.jsx("p",{className:"text-2xl font-bold text-red-600",children:f.rejected})]}),r.jsx(vn,{className:"h-8 w-8 text-red-600 opacity-50"})]})})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search by title, poster name, or email...",value:a,onChange:N=>i(N.target.value),className:"pl-10"})]}),r.jsx(W,{variant:"outline",size:"icon",children:r.jsx(nj,{className:"h-4 w-4"})})]}),r.jsxs(Kr,{defaultValue:"pending",className:"space-y-4",children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"pending",children:["Pending (",f.pending,")"]}),r.jsxs(Re,{value:"approved",children:["Approved (",f.approved,")"]}),r.jsxs(Re,{value:"rejected",children:["Rejected (",f.rejected,")"]}),r.jsxs(Re,{value:"all",children:["All (",f.total,")"]})]}),r.jsx(Be,{value:"pending",children:r.jsx(A1,{classifieds:_,onView:N=>{l(N),d(!0)},onApprove:p,onReject:v,onDelete:g,actionLoading:u})}),r.jsx(Be,{value:"approved",children:r.jsx(A1,{classifieds:C,onView:N=>{l(N),d(!0)},onApprove:p,onReject:v,onDelete:g,actionLoading:u})}),r.jsx(Be,{value:"rejected",children:r.jsx(A1,{classifieds:E,onView:N=>{l(N),d(!0)},onApprove:p,onReject:v,onDelete:g,actionLoading:u})}),r.jsx(Be,{value:"all",children:r.jsx(A1,{classifieds:w,onView:N=>{l(N),d(!0)},onApprove:p,onReject:v,onDelete:g,actionLoading:u})})]}),o&&r.jsx(Rt,{open:c,onOpenChange:d,children:r.jsxs(Ot,{className:"max-w-2xl",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:o.title}
1001),r.jsxs(on,{children:["Posted by ",o.poster_name," (",o.user_email,")"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold",children:"Category"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o.category})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold",children:"Subcategory"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o.subcategory})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold",children:"Location"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.location_city,", ",o.location_state]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold",children:"Status"}),y(o.status,o.moderation_status)]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold mb-2",children:"Description"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:o.description})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold",children:"Posted"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:b(o.created_at)})]})]}),r.jsxs(Yh,{className:"flex gap-2",children:[r.jsxs(W,{variant:"outline",onClick:()=>g(o.id),disabled:u,children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Delete"]}),o.moderation_status!=="rejected"&&r.jsxs(W,{variant:"outline",onClick:()=>v(o.id),disabled:u,className:"border-red-500 text-red-500 hover:bg-red-50",children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Reject"]}),o.moderation_status!=="approved"&&r.jsxs(W,{onClick:()=>p(o.id),disabled:u,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(ro,{className:"h-4 w-4 mr-2"}),"Approve"]})]})]})})]})}function A1({classifieds:e,onView:t,onApprove:n,onReject:s,onDelete:a,actionLoading:i}){const o=(l,c)=>c==="pending"?r.jsx(te,{className:"bg-yellow-600",children:"Pending"}):c==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):c==="approved"&&l==="active"?r.jsx(te,{className:"bg-green-600",children:"Active"}):r.jsx(te,{variant:"outline",children:"Inactive"});return e.length===0?r.jsx(Y,{children:r.jsxs(X,{className:"p-12 text-center",children:[r.jsx(fr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("p",{className:"text-muted-foreground",children:"No classifieds found"})]})}):r.jsx(Y,{children:r.jsx(X,{className:"p-0",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Title"}),r.jsx(jt,{children:"Poster"}),r.jsx(jt,{children:"Category"}),r.jsx(jt,{children:"Location"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{children:"Posted"}),r.jsx(jt,{className:"text-right",children:"Actions"})]})}),r.jsx(Oi,{children:e.map(l=>r.jsxs(On,{children:[r.jsx(wt,{className:"font-medium",children:l.title}),r.jsx(wt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:l.poster_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:l.user_email})]})}),r.jsx(wt,{children:r.jsx(te,{variant:"outline",children:l.category})}),r.jsxs(wt,{className:"text-sm",children:[l.location_city,", ",l.location_state]}),r.jsx(wt,{children:o(l.status,l.moderation_status)}),r.jsx(wt,{className:"text-sm",children:new Date(l.created_at).toLocaleDateString()}),r.jsx(wt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(W,{variant:"ghost",size:"sm",onClick:()=>t(l),children:r.jsx(Cr,{className:"h-4 w-4"})}),l.moderation_status==="pending"&&r.jsxs(r.Fragment,{children:[r.jsx(W,{variant:"ghost",size:"sm",onClick:()=>n(l.id),disabled:i,className:"text-green-600",children:r.jsx(ro,{className:"h-4 w-4"})}),r.jsx(W,{variant:"ghost",size:"sm",onClick:()=>s(l.id),disabled:i,className:"text-red-600",children:r.jsx(ks,{className:"h-4 w-4"})})]})]})})]},l.id))})]})})})}const KHe=["viewer","vendor","event_organizer","property_owner","creator","admin","visitor"];function XHe(){const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState(""),[o,l]=j.useState(null),[c,d]=j.useState(!1),[u,h]=j.useState(""),[f,m]=j.useState(!1);j.useEffect(()=>{x()},[]);const x=async()=>{s(!0);try{const{data:w,error:_}=await H.from("profiles").select("id, email, full_name, role, created_at, is_blocked").order("created_at",{ascending:!1});if(_)throw _;t(w||[])}catch(w){console.error("Error fetching users:",w),Et.error("Failed to load users")}finally{s(!1)}},p=async(w,_)=>{m(!0);try{const{error:C}=await H.from("profiles").update({is_blocked:!_}).eq("id",w);if(C)throw C;Et.success(_?"User unblocked successfully":"User blocked successfully"),x()}catch(C){console.error("Block error:",C),Et.error("Failed to update user status")}finally{m(!1)}},v=async w=>{if(!(!confirm("Are you sure you want to permanently delete this user? This cannot be undone.")||!confirm("This will delete ALL data associated with this user. Are you absolutely sure?"))){m(!0);try{const{data:C,error:E}=await H.functions.invoke("admin-delete-user",{body:{userId:w}});if(E)throw E;if(C!=null&&C.error)throw new Error(C.error);Et.success("User deleted successfully"),x()}catch(C){console.error("Delete error:",C),Et.error(C.message||"Failed to delete user")}finally{m(!1)}}},g=async()=>
1001{if(!(!o||!u)){m(!0);try{const{error:w}=await H.from("profiles").update({role:u}).eq("id",o.id);if(w)throw w;Et.success("User role updated successfully"),d(!1),x()}catch{Et.error("Failed to update user role")}finally{m(!1)}}},y=w=>{const _={admin:"bg-purple-600",vendor:"bg-blue-600",event_organizer:"bg-green-600",property_owner:"bg-orange-600",creator:"bg-pink-600",viewer:"bg-gray-600"};return r.jsx(te,{className:_[w]||"bg-gray-600",children:w.replace("_"," ").toUpperCase()})},b=e.filter(w=>{var _;return w.email.toLowerCase().includes(a.toLowerCase())||((_=w.full_name)==null?void 0:_.toLowerCase().includes(a.toLowerCase()))||w.role.toLowerCase().includes(a.toLowerCase())});return n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(Yr,{className:"h-6 w-6"}),"User Role Management"]}),r.jsx("p",{className:"text-muted-foreground",children:"Manage user accounts and permissions"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," total users"]})]}),r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search users by email, name, or role...",value:a,onChange:w=>i(w.target.value),className:"pl-10"})]}),r.jsx("div",{className:"space-y-4",children:b.length===0?r.jsx(Y,{children:r.jsxs(X,{className:"p-12 text-center",children:[r.jsx(Yr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("p",{className:"text-muted-foreground",children:"No users found"})]})}):b.map(w=>r.jsx(Y,{className:`hover:shadow-md transition-shadow ${w.is_blocked?"border-destructive/50 bg-destructive/5":""}`,children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsx("div",{className:"flex items-start gap-4 flex-1 min-w-[200px]",children:r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2 flex-wrap",children:[r.jsx("p",{className:"font-semibold",children:w.full_name||"Unnamed User"}),y(w.role),w.is_blocked&&r.jsx(te,{variant:"destructive",className:"text-xs",children:"BLOCKED"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:w.email}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Joined ",new Date(w.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})]})]})}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>{l(w),h(w.role),d(!0)},disabled:f,children:[r.jsx(fn,{className:"h-4 w-4 mr-2"}),"Change Role"]}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>p(w.id,w.is_blocked??!1),disabled:f||w.role==="admin",className:w.is_blocked?"border-green-500 text-green-500 hover:bg-green-50 dark:hover:bg-green-950":"border-orange-500 text-orange-500 hover:bg-orange-50 dark:hover:bg-orange-950",children:w.is_blocked?r.jsxs(r.Fragment,{children:[r.jsx(er,{className:"h-4 w-4 mr-2"}),"Unblock"]}):r.jsxs(r.Fragment,{children:[r.jsx(zq,{className:"h-4 w-4 mr-2"}),"Block"]})}),r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>v(w.id),disabled:f||w.role==="admin",className:"border-red-500 text-red-500 hover:bg-red-50 dark:hover:bg-red-950",children:[r.jsx(ao,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})},w.id))}),r.jsx(Rt,{open:c,onOpenChange:d,children:r.jsxs(Ot,{children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Change User Role"}),r.jsxs(on,{children:["Update the role for ",o==null?void 0:o.email]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"Current Role"}),o&&y(o.role)]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"New Role"}),r.jsxs(mt,{value:u,onValueChange:h,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select new role"})}),r.jsx(ht,{children:KHe.map(w=>r.jsx(Ne,{value:w,children:w.replace("_"," ").replace(/\b\w/g,_=>_.toUpperCase())},w))})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsx("p",{children:r.jsx("strong",{children:"Role Permissions:"})}),r.jsxs("ul",{className:"list-disc ml-5 space-y-0.5",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Admin:"})," Full platform access & management"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Vendor:"})," Can sell products, manage listings"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Event Organizer:"})," Can create & manage events"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Property Owner:"})," Can list properties for rent/sale"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Creator:"})," Can upload content to creativity hub"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Viewer:"})," Basic access, can browse & purchase"]})]})]})]}),r.jsxs(Yh,{children:[r.jsx(W,{variant:"outline",onClick:()=>d(!1),disabled:f,children:"Cancel"}),r.jsx(W,{onClick:g,disabled:f||u===(o==null?void 0:o.role),children:f?r.jsxs(r.Fragment,{children:[r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating..."]}):"Update Role"})]})]})})]})}const ZHe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState("all"),[a,i]=j.useState(""),[o,l]=j.useState(!0);j.useEffect(()=>{c()},[n]);const c=async()=>
1001{l(!0);let f=H.from("properties").select("*, profiles:owner_id(full_name, username)").order("created_at",{ascending:!1});n==="pending"?f=f.eq("moderation_status","pending"):n==="superhost"?f=f.eq("superhost_status",!0):n==="boosted"&&(f=f.eq("is_boosted",!0));const{data:m,error:x}=await f;x&&(console.error("Error fetching properties:",x),be({title:"Error loading properties",variant:"destructive"})),t(m||[]),l(!1)},d=async f=>{const{error:m}=await H.from("properties").update({moderation_status:"approved",status:"active"}).eq("id",f);m?be({title:"Failed to approve",variant:"destructive"}):(be({title:"Property approved"}),c())},u=async f=>{const{error:m}=await H.from("properties").update({moderation_status:"rejected",status:"draft"}).eq("id",f);m?be({title:"Failed to reject",variant:"destructive"}):(be({title:"Property rejected"}),c())},h=e.filter(f=>f.title.toLowerCase().includes(a.toLowerCase())||f.city.toLowerCase().includes(a.toLowerCase()));return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search properties...",value:a,onChange:f=>i(f.target.value),className:"pl-10"})]}),r.jsxs(mt,{value:n,onValueChange:s,children:[r.jsx(ut,{className:"w-[200px]",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Properties"}),r.jsx(Ne,{value:"pending",children:"Pending Approval"}),r.jsx(Ne,{value:"superhost",children:"Superhosts"}),r.jsx(Ne,{value:"boosted",children:"Boosted"})]})]})]}),o?r.jsx("div",{className:"text-center py-8",children:"Loading properties..."}):r.jsxs("div",{className:"space-y-4",children:[h.map(f=>{var m,x,p;return r.jsx(Y,{children:r.jsxs(X,{className:"flex items-start justify-between p-6",children:[r.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[((m=f.photos)==null?void 0:m[0])&&r.jsx("img",{src:f.photos[0],alt:f.title,className:"w-32 h-24 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h3",{className:"font-semibold text-lg",children:f.title}),f.superhost_status&&r.jsxs(te,{className:"bg-gradient-to-r from-yellow-500 to-amber-600",children:[r.jsx(Vd,{className:"h-3 w-3 mr-1"}),"Superhost"]}),f.is_verified_by_naija&&r.jsxs(te,{className:"bg-blue-600",children:[r.jsx(fn,{className:"h-3 w-3 mr-1"}),"Verified"]}),f.is_boosted&&r.jsxs(te,{className:"bg-green-600",children:[r.jsx(lr,{className:"h-3 w-3 mr-1"}),"Boosted"]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[f.city,", ",f.state," ⢠â¦",f.base_price_per_night.toLocaleString(),"/night"]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Owner: ",((x=f.profiles)==null?void 0:x.full_name)||((p=f.profiles)==null?void 0:p.username)]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Listed ",new Date(f.created_at).toLocaleDateString()]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 ml-4",children:[r.jsx(te,{variant:f.status==="active"?"default":"secondary",children:f.status}),f.moderation_status==="pending"&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{size:"sm",variant:"default",onClick:()=>d(f.id),children:[r.jsx(er,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(W,{size:"sm",variant:"destructive",onClick:()=>u(f.id),children:[r.jsx(ya,{className:"h-4 w-4 mr-1"}),"Reject"]})]}),r.jsxs(W,{size:"sm",variant:"outline",children:[r.jsx(Cr,{className:"h-4 w-4 mr-1"}),"View Details"]})]})]})},f.id)}),h.length===0&&r.jsx(Y,{children:r.jsx(X,{className:"text-center py-8 text-muted-foreground",children:"No properties found"})})]})]})},JHe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState(new Set),[o,l]=j.useState({region:"all",status:"pending",sourceType:"all",search:""}),[c,d]=j.useState({total:0,pending:0,flagged:0,submissions24h:0}),[u,h]=j.useState(""),[f,m]=j.useState(null),{toast:x}=Sn();j.useEffect(()=>{p(),v()},[o]);const p=async()=>{try{s(!0);let C=H.from("curated_headlines").select(` 1002 *, 1003 profiles:user_id (username, email) 1004 `).order("published_at",{ascending:!1}).limit(100);o.region!=="all"&&(C=C.eq("region",o.region)),o.status==="pending"?C=C.is("approved",null):o.status==="approved"?C=C.eq("approved",!0):o.status==="rejected"?C=C.eq("approved",!1):o.status==="flagged"&&(C=C.eq("is_flagged",!0)),o.sourceType==="user"?C=C.eq("submission_type","user"):o.sourceType==="rss"&&(C=C.eq("submission_type","rss")),o.search&&(C=C.ilike("title",`%${o.search}%`));const{data:E,error:N}=await C;if(N)throw N;t(E||[])}catch{x({title:"Error",description:"Failed to fetch headlines",variant:"destructive"})}finally{s(!1)}},v=async()=>{try{const[C,E,N,k]=await Promise.all([H.from("curated_headlines").select("id",{count:"exact",head:!0}),H.from("curated_headlines").select("id",{count:"exact",head:!0}).is("approved",null),H.from("curated_headlines").select("id",{count:"exact",head:!0}).eq("is_flagged",!0),H.from("curated_headlines").select("id",{count:"exact",head:!0}).eq("submission_type","user").gte("published_at",new Date(Date.now()-864e5).toISOString())]);d({total:C.count||0,pending:E.count||0,flagged:N.count||0,submissions24h:k.count||0})}catch(C){console.error("Failed to fetch stats:",C)}},g=async(C,E)=>{try{if(E==="delete"){const{error:N}=await H.from("curated_headlines").delete().eq("id",C);if(N)throw N}else if(E==="flag"){const{error:N}=await H.from("curated_headlines").update({is_flagged:!0}).eq("id",C);if(N)throw N}else{const{error:N}=await H.from("curated_headlines").update({approved:E==="approve",is_flagged:!1,moderation_note:u||null}).eq("id",C);if(N)throw N;const k=e.find(I=>I.id===C);k!=null&&k.user_id&&await H.from("notifications").insert({user_id:k.user_id,type:"moderation",title:`Your submission was ${E}d`,message:`Your headline "${k.title}" has been ${E}d.${u?` Note: ${u}`:""}`})}x({title:"Success",description:`Headline ${E}${E==="approve"?"d":E==="reject"?"ed":E==="flag"?"ged":"d"} successfully`}),h(""),m(null),p(),v()}catch(N){x({title:"Error",description:N.message,variant:"destructive"})}},y=async C=>
1004{if(a.size!==0)try{const E=Array.from(a);if(C==="delete"){const{error:N}=await H.from("curated_headlines").delete().in("id",E);if(N)throw N}else{const{error:N}=await H.from("curated_headlines").update({approved:C==="approve"}).in("id",E);if(N)throw N}x({title:"Success",description:`${a.size} headlines ${C}d successfully`}),i(new Set),p(),v()}catch(E){x({title:"Error",description:E.message,variant:"destructive"})}},b=async C=>{var E;try{const{error:N}=await H.from("banned_users").insert({user_id:C,reason:"Spam or abusive submissions",banned_by:(E=(await H.auth.getUser()).data.user)==null?void 0:E.id});if(N)throw N;x({title:"User Banned",description:"User has been banned from submitting headlines"}),p()}catch(N){x({title:"Error",description:N.message,variant:"destructive"})}},w=C=>{i(E=>{const N=new Set(E);return N.has(C)?N.delete(C):N.add(C),N})},_=C=>C.is_flagged?r.jsxs(te,{variant:"destructive",className:"gap-1",children:[r.jsx($N,{className:"h-3 w-3"}),"Flagged"]}):C.approved===!0?r.jsx(te,{variant:"default",className:"bg-green-600",children:"Approved"}):C.approved===!1?r.jsx(te,{variant:"secondary",children:"Rejected"}):r.jsx(te,{variant:"outline",children:"Pending"});return n?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"h-8 bg-muted animate-pulse rounded"}),r.jsx("div",{className:"h-64 bg-muted animate-pulse rounded"})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsxs(X,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:c.total}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Headlines"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:c.pending}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Pending Review"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold text-red-600",children:c.flagged}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Flagged"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold text-blue-600",children:c.submissions24h}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"User Submissions (24h)"})]})})]}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search headlines...",value:o.search,onChange:C=>l({...o,search:C.target.value}),className:"pl-9"})]}),r.jsxs(mt,{value:o.region,onValueChange:C=>l({...o,region:C}),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Region"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Regions"}),r.jsx(Ne,{value:"Nigeria",children:"Nigeria"}),r.jsx(Ne,{value:"Diaspora",children:"Diaspora"}),r.jsx(Ne,{value:"Gossip",children:"Gossip"})]})]}),r.jsxs(mt,{value:o.status,onValueChange:C=>l({...o,status:C}),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Status"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Status"}),r.jsx(Ne,{value:"pending",children:"Pending"}),r.jsx(Ne,{value:"approved",children:"Approved"}),r.jsx(Ne,{value:"rejected",children:"Rejected"}),r.jsx(Ne,{value:"flagged",children:"Flagged"})]})]}),r.jsxs(mt,{value:o.sourceType,onValueChange:C=>l({...o,sourceType:C}),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Source Type"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Sources"}),r.jsx(Ne,{value:"rss",children:"RSS Feed"}),r.jsx(Ne,{value:"user",children:"User Submitted"})]})]})]})})}),a.size>0&&r.jsx(Y,{className:"border-primary",children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"text-sm font-medium",children:[a.size," headlines selected"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{size:"sm",variant:"default",onClick:()=>y("approve"),children:[r.jsx(ro,{className:"h-4 w-4 mr-1"}),"Approve All"]}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>y("reject"),children:[r.jsx(ks,{className:"h-4 w-4 mr-1"}),"Reject All"]}),r.jsxs(W,{size:"sm",variant:"destructive",onClick:()=>y("delete"),children:[r.jsx(ao,{className:"h-4 w-4 mr-1"}),"Delete All"]})]})]})})}),e.length===0?r.jsx(Y,{children:r.jsxs(X,{className:"p-8 text-center",children:[r.jsx(vn,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No headlines found"}),r.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your filters"})]})}):r.jsx("div",{className:"space-y-4",children:e.map(C=>{var E;return r.jsx(Y,{className:C.is_flagged?"border-red-500 border-2":"",children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx(Uo,{checked:a.has(C.id),onCheckedChange:()=>w(C.id)}),C.image_url&&r.jsx("img",{src:C.image_url,alt:C.title,className:"w-24 h-24 object-cover rounded"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-2",children:C.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:C.description})]}),_(C)]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground flex-wrap",children:[r.jsx(te,{variant:"outline",children:C.region}),r.jsx(te,{variant:"outline",children:C.category}),r.jsx("span",{children:"â¢"}),r.jsx("span",{children:C.source_name}),r.jsx("span",{children:"â¢"}),r.jsx("span",{children:new Date(C.published_at).toLocaleDateString()}),C.submission_type==="user"&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"â¢"}),r.jsxs("span",{className:"font-medium",children:["By: ",((E=C.profiles)==null?void 0:E.username)||"Unknown"]}),C.vote_score!==0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"â¢"}),r.jsxs("span",{className:C.vote_score>0?"text-green-600":"text-red-600",children:[C.vote_score>0?"+":"",C.vote_score," votes"]})]})]})]}),r.jsxs("div",{className:"flex gap-2 pt-2",children:[r.jsxs(W,{size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",onClick:()=>g(C.id,"approve"),children:[r.jsx(ro,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(W,{size:"sm",variant:"destructive",onClick:()=>g(C.id,"reject"),children:[r.jsx(ks,{className:"h-4 w-4 mr-1"}),"Reject"]}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>g(C.id,"flag"),children:[r.jsx($N,{className:"h-4 w-4 mr-1"}),"Flag"]}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>window.open(C.url,"_blank"),children:[r.jsx(Cr,{className:"h-4 w-4 mr-1"}),"View"]}
1004),r.jsxs(Rt,{children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>m(C),children:[r.jsx(ao,{className:"h-4 w-4 mr-1"}),"Delete"]})}),r.jsxs(Ot,{children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Delete Headline"}),r.jsx(on,{children:"Are you sure you want to permanently delete this headline?"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-sm font-medium",children:C.title}),r.jsx(W,{variant:"destructive",onClick:()=>g(C.id,"delete"),className:"w-full",children:"Confirm Delete"})]})]})]}),C.user_id&&C.submission_type==="user"&&r.jsxs(W,{size:"sm",variant:"destructive",onClick:()=>b(C.user_id),children:[r.jsx(zq,{className:"h-4 w-4 mr-1"}),"Ban User"]})]})]})]})})},C.id)})})]})},QHe=()=>{var R;const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState(!1),[o,l]=j.useState(null),[c,d]=j.useState(null),[u,h]=j.useState(!1),[f,m]=j.useState(null),[x,p]=j.useState("news"),[v,g]=j.useState({name:"",feed_url:"",region:"Nigeria",category:"General",source_type:"news",connector:"rss"}),{toast:y}=Sn();j.useEffect(()=>{b()},[]);const b=async()=>{try{s(!0);const{data:L,error:z}=await H.from("content_sources").select("*").order("name");if(z)throw z;t(L||[])}catch{y({title:"Error",description:"Failed to fetch sources",variant:"destructive"})}finally{s(!1)}},w=async L=>{var z;h(!0),d(null);try{const{data:U,error:$}=await H.functions.invoke("test-rss-feed",{body:{feed_url:L}});if($)throw $;d(U),U.success?y({title:"Feed Test Successful",description:`Found ${((z=U.items)==null?void 0:z.length)||0} items in feed`}):y({title:"Feed Test Failed",description:U.error||"Unknown error",variant:"destructive"})}catch(U){y({title:"Test Failed",description:U.message,variant:"destructive"}),d({success:!1,error:U.message})}finally{h(!1)}},_=async()=>{try{if(!v.name||!v.feed_url){y({title:"Validation Error",description:"Name and Feed URL are required",variant:"destructive"});return}try{new URL(v.feed_url)}catch{y({title:"Invalid URL",description:"Please enter a valid feed URL",variant:"destructive"});return}if(o){const{error:L}=await H.from("content_sources").update({name:v.name,feed_url:v.feed_url,region:v.region,category:v.category,source_type:v.source_type,connector:v.connector}).eq("id",o.id);if(L)throw L;y({title:"Success",description:"Source updated successfully"})}else{const{error:L}=await H.from("content_sources").insert({name:v.name,feed_url:v.feed_url,region:v.region,category:v.category,source_type:v.source_type,connector:v.connector,is_active:!0});if(L)throw L;y({title:"Success",description:"Source added successfully"})}i(!1),l(null),g({name:"",feed_url:"",region:"Nigeria",category:"General",source_type:x,connector:x==="news"?"rss":x==="jobs"?"api":"scrape"}),d(null),b()}catch(L){y({title:"Error",description:L.message,variant:"destructive"})}},C=async L=>{try{const{error:z}=await H.from("content_sources").delete().eq("id",L);if(z)throw z;y({title:"Success",description:"Source deleted successfully"}),b()}catch(z){y({title:"Error",description:z.message,variant:"destructive"})}},E=async(L,z)=>{try{const{error:U}=await H.from("content_sources").update({is_active:z}).eq("id",L);if(U)throw U;y({title:"Success",description:`Source ${z?"activated":"deactivated"}`}),b()}catch(U){y({title:"Error",description:U.message,variant:"destructive"})}},N=async L=>{var z;m(L);try{const U=e.find(se=>se.id===L),$=(U==null?void 0:U.source_type)==="events"?"ingest-event-sources":(U==null?void 0:U.source_type)==="jobs"?"ingest-job-sources":"ingest-rss-headlines",{data:q,error:ne}=await H.functions.invoke($,{body:{source_id:L}});if(ne)throw ne;y({title:"Ingestion Complete",description:`Ingested ${(q==null?void 0:q.ingested)||0} new items${(z=q==null?void 0:q.errors)!=null&&z.length?` (${q.errors.length} errors)`:""}`}),b()}catch(U){y({title:"Error",description:U.message,variant:"destructive"})}finally{m(null)}},k=L=>{l(L),g({name:L.name,feed_url:L.feed_url,region:L.region,category:L.category,source_type:L.source_type??"news",connector:L.connector??"rss"}),d(null),i(!0)},I=()=>{i(!1),l(null),g({name:"",feed_url:"",region:"Nigeria",category:"General",source_type:x,connector:x==="news"?"rss":x==="jobs"?"api":"scrape"}),d(null)},P=L=>L.is_active?L.last_fetched_at?(Date.now()-new Date(L.last_fetched_at).getTime())/(1e3*60*60)>24?r.jsxs(te,{variant:"destructive",className:"gap-1",children:[r.jsx(vn,{className:"h-3 w-3"}),"Stale"]}):r.jsxs(te,{variant:"default",className:"bg-green-600 gap-1",children:[r.jsx(ro,{className:"h-3 w-3"}),"Active"]}):r.jsx(te,{variant:"outline",children:"Never Fetched"}):r.jsx(te,{variant:"secondary",children:"Inactive"});if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"h-8 bg-muted animate-pulse rounded"}),r.jsx("div",{className:"h-64 bg-muted animate-pulse rounded"})]});const O=e.filter(L=>(L.source_type??"news")===x),A=L=>e.filter(z=>(z.source_type??"news")===L).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Content Source Manager"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[O.length," ",x," sources configured"]})]}),r.jsxs(W,{onClick:()=>{g({name:"",feed_url:"",region:"Nigeria",category:"General",source_type:x,connector:x==="news"?"rss":x==="jobs"?"api":"scrape"}),i(!0)},children:[r.jsx(xs,{className:"h-4 w-4 mr-2"}),"Add Source"]})]}),r.jsx("div",{className:"flex gap-2 border-b",children:["news","events","jobs"].map(L=>r.jsxs("button",{onClick:()=>p(L),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${x===L?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[L.charAt(0).toUpperCase()+L.slice(1)," (",A(L),")"]},L))}),r.jsx(Y,{children:r.jsx(X,{className:"p-0",children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{className:"border-b bg-muted/50",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left p-4 font-medium",children:"Name"}),r.jsx("th",{className:"text-left p-4 font-medium",children:"Region"}),r.jsx("th",{className:"text-left p-4 font-medium",children:"Category"}),r.jsx("th",{className:"text-left p-4 font-medium",children:"Status"}),r.jsx("th",{className:"text-left p-4 font-medium",children:"Last Fetched"}),r.jsx("th",{className:"text-left p-4 font-medium",children:"Feed URL"}),r.jsx("th",{className:"text-right p-4 font-medium",children:"Actions"})]})}),r.jsx("tbody",{children:O.length===0?r.jsx("tr",{children:r.jsxs("td",{colSpan:7,className:"text-center p-8 text-muted-foreground",children:["No ",x," sources configured. Add your first source to get started."]})}):O.map(L=>r.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[r.jsx("td",{className:"p-4 font-medium",children:L.name}),r.jsx("td",{className:"p-4",children:r.jsx(te,{variant:"outline",children:L.region})}),r.jsx("td",{className:"p-4",children:r.jsx(te,{variant:"outline",children:L.category})}),r.jsx("td",{className:"p-4",children:P(L)}),r.jsx("td",{className:"p-4 text-sm text-muted-foreground",children:L.last_fetched_at?new Date(L.last_fetched_at).toLocaleStr
1004ing():"Never"}),r.jsx("td",{className:"p-4",children:r.jsxs(W,{size:"sm",variant:"ghost",onClick:()=>window.open(L.feed_url,"_blank"),children:[r.jsx(ds,{className:"h-3 w-3 mr-1"}),"View"]})}),r.jsx("td",{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(Ro,{checked:L.is_active,onCheckedChange:z=>E(L.id,z)}),r.jsx(W,{size:"sm",variant:"outline",onClick:()=>N(L.id),disabled:f===L.id,children:r.jsx(ms,{className:`h-3 w-3 ${f===L.id?"animate-spin":""}`})}),r.jsx(W,{size:"sm",variant:"outline",onClick:()=>k(L),children:r.jsx(so,{className:"h-3 w-3"})}),r.jsx(W,{size:"sm",variant:"destructive",onClick:()=>C(L.id),children:r.jsx(ao,{className:"h-3 w-3"})})]})})]},L.id))})]})})})}),r.jsx(Rt,{open:a,onOpenChange:I,children:r.jsxs(Ot,{className:"max-w-2xl",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:o?"Edit Source":"Add RSS Source"}),r.jsx(on,{children:o?"Update the RSS feed details":"Add a new RSS feed to ingest headlines from"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"name",children:"Source Name"}),r.jsx(ge,{id:"name",placeholder:"e.g., Vanguard News",value:v.name,onChange:L=>g({...v,name:L.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"feed_url",children:"Feed URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ge,{id:"feed_url",placeholder:"https://example.com/rss.xml",value:v.feed_url,onChange:L=>g({...v,feed_url:L.target.value})}),r.jsxs(W,{type:"button",variant:"outline",onClick:()=>w(v.feed_url),disabled:u||!v.feed_url||v.connector!=="rss",title:v.connector!=="rss"?"Feed test only supports RSS sources":void 0,children:[r.jsx(roe,{className:`h-4 w-4 mr-2 ${u?"animate-pulse":""}`}),"Test"]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"source_type",children:"Source Type"}),r.jsxs(mt,{value:v.source_type,onValueChange:L=>g({...v,source_type:L}),children:[r.jsx(ut,{id:"source_type",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"news",children:"News (headlines)"}),r.jsx(Ne,{value:"events",children:"Events (discovery feed)"}),r.jsx(Ne,{value:"jobs",children:"Jobs (discovery feed)"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"connector",children:"Connector"}),r.jsxs(mt,{value:v.connector,onValueChange:L=>g({...v,connector:L}),children:[r.jsx(ut,{id:"connector",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"rss",children:"RSS Feed"}),r.jsx(Ne,{value:"api",children:"JSON API"}),r.jsx(Ne,{value:"scrape",children:"Web Scrape (Firecrawl)"})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"region",children:"Region"}),r.jsxs(mt,{value:v.region,onValueChange:L=>g({...v,region:L}),children:[r.jsx(ut,{id:"region",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"Nigeria",children:"Nigeria"}),r.jsx(Ne,{value:"Diaspora",children:"Diaspora"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"category",children:"Category"}),r.jsxs(mt,{value:v.category,onValueChange:L=>g({...v,category:L}),children:[r.jsx(ut,{id:"category",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"General",children:"General"}),r.jsx(Ne,{value:"Politics",children:"Politics"}),r.jsx(Ne,{value:"Business",children:"Business"}),r.jsx(Ne,{value:"Entertainment",children:"Entertainment"}),r.jsx(Ne,{value:"Sports",children:"Sports"}),r.jsx(Ne,{value:"Culture",children:"Culture"}),r.jsx(Ne,{value:"Lifestyle",children:"Lifestyle"})]})]})]})]}),c&&r.jsx(Y,{className:c.success?"border-green-500":"border-red-500",children:r.jsx(X,{className:"p-4",children:c.success?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-green-600 font-medium",children:[r.jsx(ro,{className:"h-4 w-4"}),"Feed Valid - Found ",((R=c.items)==null?void 0:R.length)||0," items"]}),c.items&&c.items.length>0&&r.jsxs("div",{className:"space-y-1 text-sm",children:[r.jsx("p",{className:"font-medium",children:"Preview:"}),c.items.slice(0,3).map((L,z)=>r.jsxs("p",{className:"text-muted-foreground truncate",children:["⢠",L.title]},z))]})]}):r.jsxs("div",{className:"flex items-center gap-2 text-red-600",children:[r.jsx(ks,{className:"h-4 w-4"}),c.error||"Failed to fetch feed"]})})}),r.jsxs("div",{className:"flex gap-2 justify-end pt-4",children:[r.jsx(W,{variant:"outline",onClick:I,children:"Cancel"}),r.jsx(W,{onClick:_,children:o?"Update Source":"Add Source"})]})]})]})})]})};function eGe(){var b;const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState(null),[o,l]=j.useState(null),[c,d]=j.useState(""),[u,h]=j.useState(""),[f,m]=j.useState("pending");j.useEffect(()=>{x()},[]);const x=async()=>{s(!0);try{const{data:w,error:_}=await H.from("vendor_badge_applications").select(` 1005 *, 1006 vendor_profiles (store_name) 1007 `).order("created_at",{ascending:!1});if(_)throw _;t(w||[])}catch(w){console.error("Error fetching applications:",w),be({title:"Failed to load applications",variant:"destructive"})}finally{s(!1)}},p=async w=>{if(o){i(o.id);try{const{data:_,error:C}=await H.functions.invoke("approve-vendor-badge",{body:{application_id:o.id,action:w,admin_notes:c}});if(C)throw C;be({title:`Application ${w}d`,description:`Badge application has been ${w}d successfully.`}),l(null),d(""),x()}catch(_){console.error("Error processing application:",_),be({title:"Action Failed",description:_.message||`Failed to ${w} application`,variant:"destructive"})}finally{i(null)}}},v=w=>
1007{switch(w){case"pending_payment":return r.jsx(te,{variant:"secondary",children:"Awaiting Payment"});case"pending_review":return r.jsx(te,{className:"bg-amber-500",children:"Pending Review"});case"approved":return r.jsx(te,{className:"bg-green-600",children:"Approved"});case"rejected":return r.jsx(te,{variant:"destructive",children:"Rejected"});default:return r.jsx(te,{variant:"outline",children:w})}},g=e.filter(w=>{var C,E,N;const _=w.owner_name.toLowerCase().includes(u.toLowerCase())||((C=w.cac_registration_number)==null?void 0:C.toLowerCase().includes(u.toLowerCase()))||((N=(E=w.vendor_profiles)==null?void 0:E.store_name)==null?void 0:N.toLowerCase().includes(u.toLowerCase()));return f==="all"?_:f==="pending"?_&&w.status==="pending_review":f==="approved"?_&&w.status==="approved":f==="rejected"?_&&w.status==="rejected":_}),y=e.filter(w=>w.status==="pending_review").length;return n?r.jsx(Y,{children:r.jsx(X,{className:"py-12 flex items-center justify-center",children:r.jsx(ms,{className:"h-8 w-8 animate-spin text-primary"})})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(fn,{className:"h-5 w-5"}),"Badge Verification Queue",y>0&&r.jsxs(te,{variant:"destructive",children:[y," pending"]})]}),r.jsx(Nt,{children:'Review and approve "Verified by Naija.com" badge applications'})]}),r.jsxs(W,{variant:"outline",onClick:x,children:[r.jsx(ms,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex gap-4",children:r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search by name, store, or CAC number...",value:u,onChange:w=>h(w.target.value),className:"pl-10"})]})}),r.jsxs(Kr,{value:f,onValueChange:m,children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"pending",children:["Pending Review ",y>0&&`(${y})`]}),r.jsx(Re,{value:"approved",children:"Approved"}),r.jsx(Re,{value:"rejected",children:"Rejected"}),r.jsx(Re,{value:"all",children:"All"})]}),r.jsx(Be,{value:f,className:"mt-4",children:g.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No applications found"}):r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Business"}),r.jsx(jt,{children:"Owner"}),r.jsx(jt,{children:"CAC"}),r.jsx(jt,{children:"Amount"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{children:"Date"}),r.jsx(jt,{children:"Actions"})]})}),r.jsx(Oi,{children:g.map(w=>{var _;return r.jsxs(On,{children:[r.jsx(wt,{className:"font-medium",children:((_=w.vendor_profiles)==null?void 0:_.store_name)||"N/A"}),r.jsx(wt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:w.owner_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:w.owner_phone})]})}),r.jsx(wt,{children:w.cac_registration_number||"-"}),r.jsxs(wt,{children:["â¦",w.amount.toLocaleString()]}),r.jsx(wt,{children:v(w.status)}),r.jsx(wt,{children:wr(new Date(w.created_at),"PP")}),r.jsx(wt,{children:r.jsxs(W,{variant:"ghost",size:"sm",onClick:()=>{l(w),d(w.admin_notes||"")},children:[r.jsx(Cr,{className:"h-4 w-4 mr-1"}),"Review"]})})]},w.id)})})]})})]})]})})]}),r.jsx(Rt,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Review Badge Application"}),r.jsx(on,{children:"Review the documents and information provided by the applicant"})]}),o&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Store Name"}),r.jsx("p",{className:"font-medium",children:((b=o.vendor_profiles)==null?void 0:b.store_name)||"N/A"})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Owner Name"}),r.jsx("p",{className:"font-medium",children:o.owner_name})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Phone"}),r.jsx("p",{className:"font-medium",children:o.owner_phone})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"CAC Number"}),r.jsx("p",{className:"font-medium",children:o.cac_registration_number||"Not provided"})]})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Business Description"}),r.jsx("p",{className:"mt-1 p-3 bg-muted rounded-md text-sm",children:o.business_description})]}),o.website_or_social_url&&r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Website/Social Media"}),r.jsxs("a",{href:o.website_or_social_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-primary hover:underline",children:[o.website_or_social_url,r.jsx(ds,{className:"h-3 w-3"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 p-4 bg-amber-50 rounded-lg border border-amber-200",children:[r.jsxs("div",{children:[r.jsx(le,{className:"text-amber-700",children:"NIN (Last 4 digits)"}),r.jsx("p",{className:"font-mono",children:o.nin_number?`****${o.nin_number.slice(-4)}`:"Not provided"})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-amber-700",children:"BVN (Last 4 digits)"}),r.jsx("p",{className:"font-mono",children:o.bvn_number?`****${o.bvn_number.slice(-4)}`:"Not provided"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(le,{children:"Uploaded Documents"}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.address_proof_url&&r.jsxs("a",{href:o.address_proof_url,target:"_blank",rel:"noopener noreferrer",className:"p-3 border rounded-lg hover:bg-muted flex items-center gap-2",children:[r.jsx(ds,{className:"h-4 w-4"}),"Address Proof"]}),o.cac_status_report_url&&r.jsxs("a",{href:o.cac_status_report_url,target:"_blank",rel:"noopener noreferrer",className:"p-3 border rounded-lg hover:bg-muted flex items-center gap-2",children:[r.jsx(ds,{className:"h-4 w-4"}),"CAC Report"]}),o.business_license_url&&r.jsxs("a",{href:o.business_license_url,target:"_blank",rel:"noopener noreferrer",className:"p-3 border rounded-lg hover:bg-muted flex items-center gap-2",children:[r.jsx(ds,{className:"h-4 w-4"}),"Business License"]})]})]}),r.jsx(_r,{children:r.jsxs(Sr,{children:[r.jsx("strong",{children:"Payment:"}
1007)," â¦",o.amount.toLocaleString()," - ",o.payment_status,o.payment_reference&&` (Ref: ${o.payment_reference})`]})}),o.status==="pending_review"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"admin_notes",children:"Admin Notes (Optional)"}),r.jsx(ir,{id:"admin_notes",value:c,onChange:w=>d(w.target.value),placeholder:"Add notes for approval/rejection reason...",rows:3})]}),o.admin_notes&&o.status!=="pending_review"&&r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Admin Notes"}),r.jsx("p",{className:"mt-1 p-3 bg-muted rounded-md text-sm",children:o.admin_notes})]})]}),r.jsxs(Yh,{children:[r.jsx(W,{variant:"outline",onClick:()=>l(null),children:"Close"}),(o==null?void 0:o.status)==="pending_review"&&r.jsxs(r.Fragment,{children:[r.jsxs(W,{variant:"destructive",onClick:()=>p("reject"),disabled:!!a,children:[a===(o==null?void 0:o.id)?r.jsx(yt,{className:"h-4 w-4 animate-spin mr-2"}):r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Reject"]}),r.jsxs(W,{onClick:()=>p("approve"),disabled:!!a,className:"bg-green-600 hover:bg-green-700",children:[a===(o==null?void 0:o.id)?r.jsx(yt,{className:"h-4 w-4 animate-spin mr-2"}):r.jsx(Rd,{className:"h-4 w-4 mr-2"}),"Approve"]})]})]})]})})]})}const tGe=[{name:"Buka Restaurant",description:"Authentic Nigerian cuisine featuring jollof rice, egusi soup, pounded yam, and grilled suya. A beloved spot for West African food lovers.",category:"Nigerian",cuisine_types:["Nigerian","West African","Jollof","Suya"],city:"Houston",state:"Texas",country_code:"US",address:"9625 Bissonnet St, Houston, TX 77036",price_range:"$$",phone:"+1 713-773-7672",opens_at:"11:00",closes_at:"22:00",delivery_available:!0,website_url:"https://bukarestaurant.com"},{name:"Suya Spot",description:"Specializing in authentic Nigerian suya, pepper soup, and grilled meats. A go-to for spicy West African street food flavors.",category:"Nigerian",cuisine_types:["Nigerian","Suya","Street Food","Grills"],city:"Houston",state:"Texas",country_code:"US",address:"12345 Westheimer Rd, Houston, TX 77077",price_range:"$",phone:"+1 832-555-0101",opens_at:"12:00",closes_at:"23:00",delivery_available:!0},{name:"Eko Kitchen",description:"Modern Nigerian dining experience blending traditional Lagos flavors with contemporary presentation. Known for their ofada rice and assorted meat platters.",category:"Nigerian",cuisine_types:["Nigerian","Contemporary African","Lagos Style"],city:"Atlanta",state:"Georgia",country_code:"US",address:"2140 Peachtree Rd NW, Atlanta, GA 30309",price_range:"$$$",phone:"+1 404-555-0234",opens_at:"11:00",closes_at:"22:00",delivery_available:!0},{name:"Calabar Kitchen",description:"Southern Nigerian cuisine at its finest. Specializing in afang soup, edikang ikong, and fresh seafood dishes from the Cross River region.",category:"Nigerian",cuisine_types:["Nigerian","Calabar","Seafood","Efik Cuisine"],city:"Atlanta",state:"Georgia",country_code:"US",address:"3456 Buford Hwy NE, Atlanta, GA 30329",price_range:"$$",phone:"+1 678-555-0345",opens_at:"10:00",closes_at:"21:00",delivery_available:!1},{name:"Agege Bread House & Grill",description:"Famous for freshly baked Agege bread, bean cakes (akara), and Nigerian breakfast favorites. Also serves lunch specials with rice and stew.",category:"Nigerian",cuisine_types:["Nigerian","Bakery","Breakfast","Street Food"],city:"Brooklyn",state:"New York",country_code:"US",address:"1234 Flatbush Ave, Brooklyn, NY 11226",price_range:"$",phone:"+1 718-555-0456",opens_at:"07:00",closes_at:"20:00",delivery_available:!0},{name:"Teranga NYC",description:"West African fine dining in the heart of Manhattan. Features Nigerian and Senegalese fusion dishes with a contemporary twist.",category:"West African",cuisine_types:["Nigerian","Senegalese","West African","Fine Dining"],city:"New York",state:"New York",country_code:"US",address:"1280 Fifth Ave, New York, NY 10029",price_range:"$$$",phone:"+1 212-555-0567",opens_at:"11:30",closes_at:"22:30",delivery_available:!1,website_url:"https://teranganyc.com"},{name:"Naija Bites DMV",description:"Serving the Nigerian community in the DMV area with home-style cooking. Famous for their party jollof rice and small chops platters.",category:"Nigerian",cuisine_types:["Nigerian","Party Food","Jollof","Small Chops"],city:"Silver Spring",state:"Maryland",country_code:"US",address:"8700 Georgia Ave, Silver Spring, MD 20910",price_range:"$$",phone:"+1 301-555-0678",opens_at:"11:00",closes_at:"21:00",delivery_available:!0},{name:"Aso Rock Restaurant",description:"Named after Nigeria's iconic presidential villa, serving premium Nigerian cuisine including pepper soup, amala, and ewedu.",category:"Nigerian",cuisine_types:["Nigerian","Yoruba","Amala","Pepper Soup"],city:"Lanham",state:"Maryland",country_code:"US",address:"5678 Annapolis Rd, Lanham, MD 20706",price_range:"$$",phone:"+1 240-555-0789",opens_at:"10:00",closes_at:"22:00",delivery_available:!0},{name:"Mama Chibuzor Kitchen",description:"Home-style Igbo cooking in the heart of Chicago. Known for ofe nsala (white soup), abacha, and nkwobi.",category:"Nigerian",cuisine_types:["Nigerian","Igbo","Traditional","Soups"],city:"Chicago",state:"Illinois",country_code:"US",address:"7890 S Halsted St, Chicago, IL 60620",price_range:"$$",phone:"+1 312-555-0890",opens_at:"10:00",closes_at:"21:00",delivery_available:!0},{name:"Lagos Grills",description:"Bringing the vibrant street food culture of Lagos to Dallas. Suya, asun, grilled fish, and plantain specials.",category:"Nigerian",cuisine_types:["Nigerian","Grills","Suya","Street Food"],city:"Dallas",state:"Texas",country_code:"US",address:"3456 Forest Ln, Dallas, TX 75234",price_range:"$",phone:"+1 469-555-0901",opens_at:"12:00",closes_at:"23:00",delivery_available:!0},{name:"Jollof Palace LA",description:"Los Angeles' premier Nigerian restaurant. Competing to settle the jollof rice debate with their award-worthy Nigerian jollof.",category:"Nigerian",cuisine_types:["Nigerian","Jollof","West African"],city:"Los Angeles",state:"California",country_code:"US",address:"5678 Crenshaw Blvd, Los Angeles, CA 90043",price_range:"$$",phone:"+1 323-555-0012",opens_at:"11:00",closes_at:"22:00",delivery_available:!0},{name:"Enish Restaurant",description:"Award-winning Nigerian restaurant known for its extensive menu of traditional dishes. A favorite for celebrations and family gatherings.",category:"Nigerian",cuisine_types:["Nigerian","Traditional","Yoruba","Igbo"],city:"London",state:"England",country_code:"GB",address:"325 Old Kent Rd, London SE1 5JE",price_range:"$$",phone:"+44 20 7277 1755",opens_at:"12:00",closes_at:"23:00",delivery_available:!0,website_url:"https://enish.com"},{name:"805 Restaurant",description:"Popular Nigerian restaurant in Peckham serving jollof rice, pounded yam, and a wide variety of Nigerian soups and stews.",category:"Nigerian",cuisine_types:["Nigerian","West African","Jollof","Soups"],city:"London",state:"England",country_code:"GB",address:"805 Old Kent Rd, London SE15 1NX",price_range:"$$",phone:"+44 20 7639 1805",opens_at:"11:00",closes_at:"23:00",delivery_available:!0,website_url:"https://805restaurants.com"},{name:"Chuku's",description:"Nigerian tapas restaurant offering a unique small plates concept. Features modern interpretations of classic Nigerian flavors.",category:"Nigerian Fusion",cuisine_types:["Nigerian","Tapas","Fusion","Contemporary"],city:"London",state:"England",country_code:"GB",address:"274 High Rd, London N15 4AJ",price_range:"$$$",phone:"+44 20 8365 0345",opens_at:"17:00",closes_at:"22:30",delivery_available:!1,website_url:"https://chukus.co.uk"}
1007,{name:"Ikoyi Restaurant",description:"Michelin-starred restaurant inspired by West African flavors. A fine dining destination celebrating Nigerian culinary heritage.",category:"Fine Dining",cuisine_types:["Nigerian","West African","Fine Dining","Michelin"],city:"London",state:"England",country_code:"GB",address:"1 St James's Market, London SW1Y 4AH",price_range:"$$$$",phone:"+44 20 3583 4660",opens_at:"12:00",closes_at:"22:00",delivery_available:!1,website_url:"https://ikoyilondon.com"},{name:"Mama's Kitchen Woolwich",description:"Homely Nigerian kitchen in Southeast London. Generous portions of amala, gbegiri, ewedu, and assorted meats at affordable prices.",category:"Nigerian",cuisine_types:["Nigerian","Yoruba","Amala","Home Cooking"],city:"London",state:"England",country_code:"GB",address:"45 Powis St, London SE18 6LQ",price_range:"$",phone:"+44 20 8317 0123",opens_at:"10:00",closes_at:"22:00",delivery_available:!0},{name:"Iya Ibadan Birmingham",description:"Bringing authentic Ibadan-style cooking to Birmingham. Renowned for their amala & gbegiri combination and goat meat pepper soup.",category:"Nigerian",cuisine_types:["Nigerian","Yoruba","Ibadan Style"],city:"Birmingham",state:"England",country_code:"GB",address:"123 Soho Rd, Birmingham B21 9SP",price_range:"$$",phone:"+44 121 555 0234",opens_at:"11:00",closes_at:"22:00",delivery_available:!0},{name:"Naija Jollof Manchester",description:"Manchester's favorite Nigerian spot. Famous for their smoky party jollof rice and perfectly grilled chicken.",category:"Nigerian",cuisine_types:["Nigerian","Jollof","Grills"],city:"Manchester",state:"England",country_code:"GB",address:"456 Wilmslow Rd, Manchester M14 6WR",price_range:"$$",phone:"+44 161 555 0345",opens_at:"11:00",closes_at:"22:30",delivery_available:!0},{name:"Afro Flavours Johannesburg",description:"Vibrant Nigerian and African fusion restaurant in Johannesburg. Serving jollof rice, suya, and South African-Nigerian fusion dishes.",category:"Nigerian Fusion",cuisine_types:["Nigerian","South African","Fusion","Jollof"],city:"Johannesburg",state:"Gauteng",country_code:"ZA",address:"123 Commissioner St, Johannesburg 2001",price_range:"$$",phone:"+27 11 555 0456",opens_at:"10:00",closes_at:"22:00",delivery_available:!0},{name:"Naija Pot Pretoria",description:"Nigerian home cooking in Pretoria. Specializing in egusi soup, bitter leaf soup, and authentic Nigerian rice dishes.",category:"Nigerian",cuisine_types:["Nigerian","Traditional","Soups","Rice Dishes"],city:"Pretoria",state:"Gauteng",country_code:"ZA",address:"456 Church St, Pretoria 0002",price_range:"$$",phone:"+27 12 555 0567",opens_at:"10:00",closes_at:"21:00",delivery_available:!0},{name:"Lagos Cafe Cape Town",description:"A taste of Lagos on the Cape. Offering Nigerian classics alongside fresh Cape Town seafood with a Nigerian twist.",category:"Nigerian",cuisine_types:["Nigerian","Seafood","Lagos Style"],city:"Cape Town",state:"Western Cape",country_code:"ZA",address:"78 Long St, Cape Town 8001",price_range:"$$$",phone:"+27 21 555 0678",opens_at:"11:00",closes_at:"22:00",delivery_available:!1},{name:"Suya Republic Sandton",description:"Premium suya and Nigerian grill house in Sandton. Known for their flame-grilled suya, asun, and nkwobi.",category:"Nigerian",cuisine_types:["Nigerian","Suya","Grills","BBQ"],city:"Sandton",state:"Gauteng",country_code:"ZA",address:"234 Rivonia Rd, Sandton 2196",price_range:"$$$",phone:"+27 11 555 0789",opens_at:"12:00",closes_at:"23:00",delivery_available:!0},{name:"Akara Express Toronto",description:"Fast-casual Nigerian eatery in Toronto. Famous for their fresh akara, moi moi, and Nigerian-style breakfast platters.",category:"Nigerian",cuisine_types:["Nigerian","Street Food","Breakfast","Fast Casual"],city:"Toronto",state:"Ontario",country_code:"CA",address:"1234 Jane St, Toronto, ON M6N 4A8",price_range:"$",phone:"+1 416-555-0890",opens_at:"07:00",closes_at:"20:00",delivery_available:!0},{name:"Ijebu Kitchen Toronto",description:"Ijebu-Ode inspired cuisine in Toronto. Renowned for their ofada rice with designer stew, ijebu garri, and amala.",category:"Nigerian",cuisine_types:["Nigerian","Ijebu","Yoruba","Ofada"],city:"Toronto",state:"Ontario",country_code:"CA",address:"5678 Finch Ave W, Toronto, ON M3N 1T6",price_range:"$$",phone:"+1 647-555-0901",opens_at:"10:00",closes_at:"22:00",delivery_available:!0},{name:"Naija Grills Calgary",description:"Calgary's Nigerian grill house offering suya, asun, grilled catfish, and plantain specials in a lively atmosphere.",category:"Nigerian",cuisine_types:["Nigerian","Grills","Suya","Catfish"],city:"Calgary",state:"Alberta",country_code:"CA",address:"3456 17 Ave SE, Calgary, AB T2A 0T3",price_range:"$$",phone:"+1 403-555-0012",opens_at:"11:00",closes_at:"22:00",delivery_available:!0}
1007,{name:"Obalende Suya Edmonton",description:"Named after the famous Lagos suya spot, serving authentic beef and chicken suya with all the traditional toppings.",category:"Nigerian",cuisine_types:["Nigerian","Suya","Street Food"],city:"Edmonton",state:"Alberta",country_code:"CA",address:"7890 118 Ave NW, Edmonton, AB T5B 0T3",price_range:"$",phone:"+1 780-555-0123",opens_at:"12:00",closes_at:"23:00",delivery_available:!0},{name:"Yellow Chilli by Olusola",description:"One of Lagos' most iconic restaurants, founded by Chef Olusola Adeyemo. Known for continental-Nigerian fusion and signature cocktails.",category:"Nigerian Fusion",cuisine_types:["Nigerian","Continental","Fusion","Fine Dining"],city:"Lagos",state:"Lagos",country_code:"NG",address:"27 Oju Olobun Close, Victoria Island, Lagos",price_range:"$$$",phone:"+234 1 271 5518",opens_at:"11:00",closes_at:"23:00",delivery_available:!0,website_url:"https://yellowchillirestaurant.com"},{name:"Nkoyo at Eko Hotel",description:"Award-winning restaurant at the iconic Eko Hotels. Serves refined Nigerian dishes with breathtaking Lagos lagoon views.",category:"Fine Dining",cuisine_types:["Nigerian","Fine Dining","Contemporary","Seafood"],city:"Lagos",state:"Lagos",country_code:"NG",address:"Eko Hotels, Plot 1415 Adetokunbo Ademola St, Victoria Island, Lagos",price_range:"$$$$",phone:"+234 1 277 1000",opens_at:"12:00",closes_at:"23:00",delivery_available:!1,website_url:"https://ekohotels.com"},{name:"Mama Cass",description:"Lagos institution serving generous portions of Nigerian favorites. A staple for locals and visitors alike since 2005.",category:"Nigerian",cuisine_types:["Nigerian","Traditional","Soups","Jollof"],city:"Lagos",state:"Lagos",country_code:"NG",address:"3 Adeyemo Alakija St, Victoria Island, Lagos",price_range:"$$",phone:"+234 802 300 0000",opens_at:"09:00",closes_at:"22:00",delivery_available:!0},{name:"Jevinik Restaurant",description:"Multi-branch Nigerian restaurant chain known for consistently excellent traditional cuisine and warm ambiance.",category:"Nigerian",cuisine_types:["Nigerian","Traditional","Cross River","Pan-Nigerian"],city:"Lagos",state:"Lagos",country_code:"NG",address:"6 Akin Adesola St, Victoria Island, Lagos",price_range:"$$",phone:"+234 1 461 6284",opens_at:"10:00",closes_at:"22:00",delivery_available:!0,website_url:"https://jevinik.com"},{name:"Bukka Hut",description:"Fast-casual Nigerian dining chain. Known for their tasty and affordable Nigerian meals served in a modern setting.",category:"Nigerian",cuisine_types:["Nigerian","Fast Casual","Jollof","Soups"],city:"Lagos",state:"Lagos",country_code:"NG",address:"12A Admiralty Way, Lekki Phase 1, Lagos",price_range:"$",phone:"+234 812 345 6789",opens_at:"08:00",closes_at:"22:00",delivery_available:!0,website_url:"https://bukkahut.com"},{name:"Woks & Koi",description:"Pan-Asian meets Nigerian flavors in Abuja. Features stir-fried suya, jollof fried rice, and creative fusion dishes.",category:"Fusion",cuisine_types:["Nigerian","Asian Fusion","Contemporary"],city:"Abuja",state:"FCT",country_code:"NG",address:"1234 Aminu Kano Crescent, Wuse 2, Abuja",price_range:"$$$",phone:"+234 809 555 0234",opens_at:"11:00",closes_at:"22:30",delivery_available:!0},{name:"Charcoal Grill Abuja",description:"Premium grill house in Abuja specializing in flame-grilled meats, suya, and Nigerian BBQ platters.",category:"Nigerian",cuisine_types:["Nigerian","Grills","BBQ","Suya"],city:"Abuja",state:"FCT",country_code:"NG",address:"5678 Herbert Macaulay Way, Zone 5, Abuja",price_range:"$$$",phone:"+234 802 555 0345",opens_at:"12:00",closes_at:"23:00",delivery_available:!0},{name:"Kilimanjaro Restaurant Abuja",description:"Multi-branch fast food and restaurant chain famous for Nigerian meals and continental dishes. A household name across Nigeria.",category:"Nigerian",cuisine_types:["Nigerian","Fast Food","Continental"],city:"Abuja",state:"FCT",country_code:"NG",address:"Plot 2, Wuse Zone 4, Abuja",price_range:"$$",phone:"+234 9 461 2345",opens_at:"07:00",closes_at:"22:00",delivery_available:!0,website_url:"https://kilimanjaro.ng"},{name:"Point Restaurant PH",description:"Port Harcourt's favorite dining destination. Serves a mix of Nigerian and continental dishes with excellent service.",category:"Nigerian",cuisine_types:["Nigerian","Continental","Rivers State","Seafood"],city:"Port Harcourt",state:"Rivers",country_code:"NG",address:"45 Aba Rd, Port Harcourt",price_range:"$$",phone:"+234 803 555 0456",opens_at:"09:00",closes_at:"22:00",delivery_available:!0},{name:"Bole & Fish Junction PH",description:"Authentic Port Harcourt bole (roasted plantain) and fish spot. The quintessential Rivers State street food experience elevated.",category:"Nigerian",cuisine_types:["Nigerian","Bole","Street Food","Rivers State"],city:"Port Harcourt",state:"Rivers",country_code:"NG",address:"78 Stadium Rd, Port Harcourt",price_range:"$",phone:"+234 812 555 0567",opens_at:"10:00",closes_at:"21:00",delivery_available:!0},{name:"Naija Kitchen Dublin",description:"Dublin's authentic Nigerian restaurant serving traditional dishes to Ireland's growing Nigerian community.",category:"Nigerian",cuisine_types:["Nigerian","West African","Traditional"],city:"Dublin",state:"Leinster",country_code:"IE",address:"123 Parnell St, Dublin D01",price_range:"$$",phone:"+353 1 555 0678",opens_at:"11:00",closes_at:"22:00",delivery_available:!0},{name:"Jollof Box Dubai",description:"Bringing Nigerian jollof to the UAE. A popular spot for West Africans and food adventurers in Dubai.",category:"Nigerian",cuisine_types:["Nigerian","Jollof","West African"],city:"Dubai",state:"Dubai",country_code:"AE",address:"Al Barsha South, Dubai",price_range:"$$$",phone:"+971 4 555 0789",opens_at:"11:00",closes_at:"23:00",delivery_available:!0},{name:"African Kitchen Berlin",description:"Nigerian and West African cuisine in the heart of Berlin. Popular with the African diaspora and adventurous foodies.",category:"Nigerian",cuisine_types:["Nigerian","West African","Ghanaian"],city:"Berlin",state:"Berlin",country_code:"DE",address:"Oranie
1007nstraÃe 45, 10969 Berlin",price_range:"$$",phone:"+49 30 555 0890",opens_at:"11:00",closes_at:"22:00",delivery_available:!0},{name:"Suya Junction Minneapolis",description:"Minnesota's go-to Nigerian restaurant. Beloved for their suya, egusi, and jollof rice in the Twin Cities area.",category:"Nigerian",cuisine_types:["Nigerian","Suya","Jollof","Traditional"],city:"Minneapolis",state:"Minnesota",country_code:"US",address:"2345 Nicollet Ave, Minneapolis, MN 55404",price_range:"$$",phone:"+1 612-555-0901",opens_at:"11:00",closes_at:"21:00",delivery_available:!0},{name:"9ja Flavors Philadelphia",description:"Philadelphia's Nigerian food destination. Specializing in party jollof, pepper soup, and Nigerian small chops.",category:"Nigerian",cuisine_types:["Nigerian","Party Food","Small Chops"],city:"Philadelphia",state:"Pennsylvania",country_code:"US",address:"6789 Woodland Ave, Philadelphia, PA 19142",price_range:"$$",phone:"+1 215-555-0012",opens_at:"10:00",closes_at:"22:00",delivery_available:!0},{name:"Afrikana Restaurant Glasgow",description:"Scottish-based Nigerian restaurant bringing the flavors of West Africa to Glasgow. Known for their ogbono soup and fried plantain.",category:"Nigerian",cuisine_types:["Nigerian","West African","Traditional"],city:"Glasgow",state:"Scotland",country_code:"GB",address:"234 Sauchiehall St, Glasgow G2 3EZ",price_range:"$$",phone:"+44 141 555 0123",opens_at:"11:00",closes_at:"22:00",delivery_available:!0},{name:"Owanbe Kitchen Leeds",description:"Party-style Nigerian food in Leeds. Named after Nigeria's famous party culture, serving celebration-worthy dishes daily.",category:"Nigerian",cuisine_types:["Nigerian","Party Food","Jollof","Small Chops"],city:"Leeds",state:"England",country_code:"GB",address:"567 Roundhay Rd, Leeds LS8 4AR",price_range:"$$",phone:"+44 113 555 0234",opens_at:"11:00",closes_at:"22:00",delivery_available:!0},{name:"Pepperz Nigerian Food Winnipeg",description:"Manitoba's only dedicated Nigerian restaurant. Serving homestyle Nigerian dishes to Winnipeg's West African community.",category:"Nigerian",cuisine_types:["Nigerian","West African","Home Cooking"],city:"Winnipeg",state:"Manitoba",country_code:"CA",address:"890 Ellice Ave, Winnipeg, MB R3G 0C2",price_range:"$",phone:"+1 204-555-0345",opens_at:"10:00",closes_at:"21:00",delivery_available:!0},{name:"Afang Republic Calabar",description:"Specializing in Calabar delicacies â afang soup, edikang ikong, ekpang nkukwo, and fresh periwinkle dishes.",category:"Nigerian",cuisine_types:["Nigerian","Calabar","Efik","Seafood"],city:"Calabar",state:"Cross River",country_code:"NG",address:"34 Marian Rd, Calabar",price_range:"$$",phone:"+234 803 555 0678",opens_at:"09:00",closes_at:"21:00",delivery_available:!0},{name:"Amala Zone Ibadan",description:"The amala capital delivers. Famous for their signature amala with gbegiri, ewedu, and assorted meat in Ibadan.",category:"Nigerian",cuisine_types:["Nigerian","Yoruba","Amala","Traditional"],city:"Ibadan",state:"Oyo",country_code:"NG",address:"56 Ring Road, Ibadan",price_range:"$",phone:"+234 802 555 0789",opens_at:"07:00",closes_at:"21:00",delivery_available:!0},{name:"Jabi Lake Restaurant Abuja",description:"Scenic lakeside dining in Abuja. Combines Nigerian and international cuisine with stunning views of Jabi Lake.",category:"Nigerian Fusion",cuisine_types:["Nigerian","Continental","Scenic Dining"],city:"Abuja",state:"FCT",country_code:"NG",address:"Jabi Lake Mall, Bala Shamaki Cres, Abuja",price_range:"$$$",phone:"+234 809 555 0890",opens_at:"10:00",closes_at:"23:00",delivery_available:!1},{name:"Yetunde's Kitchen Newark",description:"New Jersey's beloved Nigerian home cooking. Generous portions of pounded yam, egusi, and smoky party jollof.",category:"Nigerian",cuisine_types:["Nigerian","Home Cooking","Traditional"],city:"Newark",state:"New Jersey",country_code:"US",address:"1234 Broad St, Newark, NJ 07102",price_range:"$$",phone:"+1 973-555-0456",opens_at:"10:00",closes_at:"21:00",delivery_available:!0},{name:"Owambe Grill Sydney",description:"Sydney's Nigerian food pioneer. Introducing Australian food lovers to jollof rice, suya, and Nigerian party cuisine.",category:"Nigerian",cuisine_types:["Nigerian","Grills","Party Food"],city:"Sydney",state:"New South Wales",country_code:"AU",address:"456 Liverpool Rd, Strathfield NSW 2135",price_range:"$$",phone:"+61 2 5555 0567",opens_at:"11:00",closes_at:"22:00",delivery_available:!0}],rGe=()=>{var P;const{user:e}
1007=bt(),[t,n]=j.useState([]),[s,a]=j.useState({pending:0,approved:0,rejected:0,total:0}),[i,o]=j.useState(!0),[l,c]=j.useState(null),[d,u]=j.useState(!1),[h,f]=j.useState(""),[m,x]=j.useState(!1),[p,v]=j.useState(!1);j.useEffect(()=>{y()},[]);const g=async()=>{if(e){v(!0);try{const{data:O,error:A}=await H.functions.invoke("seed-restaurants",{body:{restaurants:tGe}});if(A)throw A;be({title:"Restaurants Seeded",description:`Successfully inserted ${(O==null?void 0:O.inserted)||0} restaurants`}),y()}catch(O){be({title:"Seed Failed",description:O.message||"Failed to seed restaurants",variant:"destructive"})}finally{v(!1)}}},y=async()=>{o(!0);try{const{data:O,error:A}=await H.from("restaurants").select("*").order("created_at",{ascending:!1});if(A)throw A;n(O||[]),b(O||[])}catch{be({title:"Error",description:"Failed to fetch restaurants",variant:"destructive"})}finally{o(!1)}},b=O=>{a({pending:O.filter(A=>A.moderation_status==="pending").length,approved:O.filter(A=>A.moderation_status==="approved").length,rejected:O.filter(A=>A.moderation_status==="rejected").length,total:O.length})},w=async(O,A)=>{if(e){if(A==="rejected"&&!h.trim()){be({title:"Notes required",description:"Please provide a reason for rejection",variant:"destructive"});return}x(!0);try{const{error:R}=await H.from("restaurants").update({moderation_status:A,moderated_by:e.id,moderated_at:new Date().toISOString(),moderation_notes:A==="rejected"?h:null,status:A==="approved"?"active":"draft"}).eq("id",O);if(R)throw R;be({title:`Restaurant ${A}`,description:`The restaurant has been ${A} successfully`}),u(!1),f(""),y()}catch{be({title:"Error",description:"Failed to update moderation status",variant:"destructive"})}finally{x(!1)}}},_=O=>{if(!O)return"N/A";const[A,R]=O.split(":"),L=parseInt(A),z=L>=12?"PM":"AM";return`${L%12||12}:${R} ${z}`},C=O=>new Date(O).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),E=O=>{switch(O){case"pending":return r.jsx(te,{variant:"outline",className:"bg-yellow-100 text-yellow-800",children:"Pending"});case"approved":return r.jsx(te,{variant:"default",className:"bg-green-600",children:"Approved"});case"rejected":return r.jsx(te,{variant:"destructive",children:"Rejected"});default:return r.jsx(te,{variant:"secondary",children:O})}},N=t.filter(O=>O.moderation_status==="pending"),k=t.filter(O=>O.moderation_status==="approved"),I=t.filter(O=>O.moderation_status==="rejected");return i?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(Lo,{className:"h-6 w-6 text-primary"}),"Restaurant Management"]}),r.jsx("p",{className:"text-muted-foreground",children:"Review and manage restaurant listings"})]}),r.jsxs(W,{onClick:g,disabled:p,variant:"outline",className:"gap-2",children:[p?r.jsx(yt,{className:"h-4 w-4 animate-spin"}):r.jsx(AT,{className:"h-4 w-4"}),p?"Seeding...":"Seed Restaurants"]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Pending Review"}),r.jsx("p",{className:"text-2xl font-bold",children:s.pending})]}),r.jsx($r,{className:"h-8 w-8 text-yellow-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Approved"}),r.jsx("p",{className:"text-2xl font-bold",children:s.approved})]}),r.jsx(er,{className:"h-8 w-8 text-green-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Rejected"}),r.jsx("p",{className:"text-2xl font-bold",children:s.rejected})]}),r.jsx(ya,{className:"h-8 w-8 text-red-500"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"}),r.jsx("p",{className:"text-2xl font-bold",children:s.total})]}),r.jsx(Lo,{className:"h-8 w-8 text-blue-500"})]})})})]}),r.jsxs(Kr,{defaultValue:"pending",className:"space-y-4",children:[r.jsxs(Hr,{children:[r.jsxs(Re,{value:"pending",children:["Pending (",N.length,")"]}),r.jsxs(Re,{value:"approved",children:["Approved (",k.length,")"]}),r.jsxs(Re,{value:"rejected",children:["Rejected (",I.length,")"]})]}),r.jsx(Be,{value:"pending",className:"space-y-4",children:N.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No restaurants pending review"})})}):N.map(O=>{var A,R;return r.jsx(Y,{className:"border-l-4 border-l-yellow-500",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[O.images&&O.images[0]&&r.jsx("img",{src:O.images[0],alt:O.name,className:"w-32 h-32 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"text-lg font-semibold",children:O.name}),E(O.moderation_status),O.category&&r.jsx(te,{variant:"outline",children:O.category})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Owner: ",((A=O.profiles)==null?void 0:A.full_name)||((R=O.profiles)==null?void 0:R.email)||"Unknown"]})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>{c(O),u(!0)},children:[r.jsx(Cr,{className:"h-4 w-4 mr-2"}),"Review"]})})]}),r.jsx("p",{className:"text-sm line-clamp-2",children:O.description}),r.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-4 w-4"}),O.city,", ",O.state]}
1007),O.phone&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(an,{className:"h-4 w-4"}),O.phone]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx($r,{className:"h-4 w-4"}),C(O.created_at)]})]})]})]})})},O.id)})}),r.jsx(Be,{value:"approved",className:"space-y-4",children:k.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No approved restaurants"})})}):k.map(O=>r.jsx(Y,{className:"border-l-4 border-l-green-500",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[O.images&&O.images[0]&&r.jsx("img",{src:O.images[0],alt:O.name,className:"w-32 h-32 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h3",{className:"text-lg font-semibold",children:O.name}),E(O.moderation_status)]}),r.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[r.jsxs("span",{children:[O.city,", ",O.state]}),r.jsx("span",{children:C(O.created_at)})]})]})]})})},O.id))}),r.jsx(Be,{value:"rejected",className:"space-y-4",children:I.length===0?r.jsx(Y,{children:r.jsx(X,{className:"p-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No rejected restaurants"})})}):I.map(O=>r.jsx(Y,{className:"border-l-4 border-l-red-500",children:r.jsx(X,{className:"p-6",children:r.jsxs("div",{className:"flex gap-4",children:[O.images&&O.images[0]&&r.jsx("img",{src:O.images[0],alt:O.name,className:"w-32 h-32 object-cover rounded-lg opacity-50"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h3",{className:"text-lg font-semibold",children:O.name}),E(O.moderation_status)]}),O.moderation_notes&&r.jsxs("p",{className:"text-sm text-red-600 mb-2",children:["Reason: ",O.moderation_notes]}),r.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[r.jsxs("span",{children:[O.city,", ",O.state]}),r.jsx("span",{children:C(O.created_at)})]})]})]})})},O.id))})]}),l&&r.jsx(Rt,{open:d,onOpenChange:u,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Review Restaurant"}),r.jsx(on,{children:"Review restaurant details and approve or reject"})]}),r.jsxs("div",{className:"space-y-6",children:[l.images&&l.images.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Images"}),r.jsx("div",{className:"grid grid-cols-3 gap-2",children:l.images.map((O,A)=>r.jsx("img",{src:O,alt:`${l.name} ${A+1}`,className:"w-full h-32 object-cover rounded-lg"},A))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx(le,{children:"Restaurant Name"}),r.jsx("p",{className:"mt-1",children:l.name})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Category"}),r.jsx("p",{className:"mt-1",children:l.category||"N/A"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Owner"}),r.jsx("p",{className:"mt-1",children:((P=l.profiles)==null?void 0:P.email)||"Unknown"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Price Range"}),r.jsx("p",{className:"mt-1",children:l.price_range||"N/A"})]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Description"}),r.jsx("p",{className:"mt-1 text-sm",children:l.description})]}),l.cuisine_types&&l.cuisine_types.length>0&&r.jsxs("div",{children:[r.jsx(le,{children:"Cuisine Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:l.cuisine_types.map(O=>r.jsx(te,{variant:"outline",children:O},O))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx(le,{children:"Location"}),r.jsxs("p",{className:"mt-1",children:[l.address,r.jsx("br",{}),l.city,", ",l.state]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Contact"}),r.jsxs("p",{className:"mt-1",children:[l.phone,r.jsx("br",{}),l.email]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Hours"}),r.jsxs("p",{className:"mt-1",children:[_(l.opens_at)," - ",_(l.closes_at)]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Delivery"}),r.jsx("p",{className:"mt-1",children:l.delivery_available?"Available":"Not available"})]})]}),l.moderation_status==="pending"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{children:"Rejection Notes (optional)"}),r.jsx(ir,{placeholder:"Provide a reason if rejecting...",value:h,onChange:O=>f(O.target.value),className:"min-h-[100px]"})]}),l.moderation_status==="pending"&&r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsxs(W,{variant:"outline",onClick:()=>w(l.id,"rejected"),disabled:m,children:[m?r.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Reject"]}),r.jsxs(W,{onClick:()=>w(l.id,"approved"),disabled:m,children:[m?r.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(er,{className:"h-4 w-4 mr-2"}),"Approve"]})]})]})]})})]})},nGe=()=>{var C,E;const{toast:e}=Sn(),[t,n]=j.useState([]),[s,a]=j.useState("pending"),[i,o]=j.useState(""),[l,c]=j.useState(!0),[d,u]=j.useState(null),[h,f]=j.useState(!1),[m,x]=j.useState("");j.useEffect(()=>{p()},[s]);const p=async()=>{c(!0);let N=H.from("rental_cars").select("*").order("created_at",{ascending:!1});
1007s==="pending"?N=N.eq("moderation_status","pending"):s==="approved"?N=N.eq("moderation_status","approved"):s==="rejected"?N=N.eq("moderation_status","rejected"):s==="featured"&&(N=N.eq("is_featured",!0));const{data:k}=await N;k&&n(k),c(!1)},v=async N=>{const{error:k}=await H.from("rental_cars").update({moderation_status:"approved",status:"active",moderation_notes:m||"Approved by admin"}).eq("id",N);k?e({title:"Failed to approve",variant:"destructive"}):(e({title:"Listing approved!"}),x(""),p())},g=async N=>{if(!m){e({title:"Rejection reason required",description:"Please provide notes explaining why this listing was rejected.",variant:"destructive"});return}const{error:k}=await H.from("rental_cars").update({moderation_status:"rejected",status:"draft",moderation_notes:m}).eq("id",N);k?e({title:"Failed to reject",variant:"destructive"}):(e({title:"Listing rejected"}),x(""),p())},y=async(N,k)=>{const{error:I}=await H.from("rental_cars").update({is_featured:!k,feature_expires_at:k?null:new Date(Date.now()+2592e6).toISOStr
1007ing()}).eq("id",N);I?e({title:"Failed to update feature status",variant:"destructive"}):(e({title:`Listing ${k?"unfeatured":"featured"}!`}),p())},b=N=>{u(N),f(!0)},w=t.filter(N=>{var k,I;return N.title.toLowerCase().includes(i.toLowerCase())||N.city.toLowerCase().includes(i.toLowerCase())||((k=N.make)==null?void 0:k.toLowerCase().includes(i.toLowerCase()))||((I=N.model)==null?void 0:I.toLowerCase().includes(i.toLowerCase()))}),_={pending:t.filter(N=>N.moderation_status==="pending").length,approved:t.filter(N=>N.moderation_status==="approved").length,rejected:t.filter(N=>N.moderation_status==="rejected").length,featured:t.filter(N=>N.is_featured).length};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Se,{className:"px-0",children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(xa,{className:"h-5 w-5"}),"Rental Cars & Equipment Management"]}),r.jsx(Nt,{children:"Review and moderate vehicle rental listings"})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Pending"}),r.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:_.pending})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Approved"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:_.approved})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Rejected"}),r.jsx("p",{className:"text-2xl font-bold text-red-600",children:_.rejected})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Featured"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:_.featured})]})})})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{placeholder:"Search by title, city, make, or model...",value:i,onChange:N=>o(N.target.value),className:"pl-10"})]}),r.jsxs(mt,{value:s,onValueChange:a,children:[r.jsx(ut,{className:"w-[200px]",children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Listings"}),r.jsx(Ne,{value:"pending",children:"Pending Approval"}),r.jsx(Ne,{value:"approved",children:"Approved"}),r.jsx(Ne,{value:"rejected",children:"Rejected"}),r.jsx(Ne,{value:"featured",children:"Featured"})]})]})]}),r.jsxs(Kr,{value:s,onValueChange:a,children:[r.jsxs(Hr,{className:"grid w-full grid-cols-5",children:[r.jsxs(Re,{value:"all",children:["All (",t.length,")"]}),r.jsxs(Re,{value:"pending",children:["Pending (",_.pending,")"]}),r.jsxs(Re,{value:"approved",children:["Approved (",_.approved,")"]}),r.jsxs(Re,{value:"rejected",children:["Rejected (",_.rejected,")"]}),r.jsxs(Re,{value:"featured",children:["Featured (",_.featured,")"]})]}),r.jsx(Be,{value:s,className:"space-y-4 mt-4",children:l?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(yt,{className:"h-8 w-8 animate-spin mx-auto text-primary"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Loading listings..."})]}):w.length>0?r.jsx("div",{className:"space-y-4",children:w.map(N=>{var k,I,P;return r.jsx(Y,{children:r.jsxs(X,{className:"flex items-start justify-between p-6",children:[r.jsxs("div",{className:"flex items-start gap-4 flex-1",children:[((k=N.photos)==null?void 0:k[0])&&r.jsx("img",{src:N.photos[0],alt:N.title,className:"w-32 h-24 object-cover rounded-lg"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h3",{className:"font-semibold text-lg",children:N.title}),N.is_featured&&r.jsxs(te,{className:"bg-gradient-to-r from-green-600 to-emerald-600",children:[r.jsx(lr,{className:"h-3 w-3 mr-1"}),"Featured"]}),N.driver_included&&r.jsxs(te,{className:"bg-blue-600",children:[r.jsx(Yr,{className:"h-3 w-3 mr-1"}),"Driver"]}),N.security_personnel_included&&r.jsxs(te,{className:"bg-purple-600",children:[r.jsx(fn,{className:"h-3 w-3 mr-1"}),"Security"]})]}),N.make&&N.model&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:[N.year," ",N.make," ",N.model]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-1 flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}
1007),N.city,", ",N.state," ⢠â¦",N.daily_rate.toLocaleString(),"/day"]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:["Owner: ",((I=N.profiles)==null?void 0:I.full_name)||((P=N.profiles)==null?void 0:P.username)||"Unknown"]}),N.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:N.description}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Listed ",new Date(N.created_at).toLocaleDateString()]}),N.transmission&&r.jsx("span",{children:N.transmission}),N.fuel_type&&r.jsx("span",{children:N.fuel_type}),N.seats&&r.jsxs("span",{children:[N.seats," seats"]})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 ml-4 min-w-[120px]",children:[r.jsx(te,{variant:N.moderation_status==="approved"?"default":N.moderation_status==="pending"?"outline":"destructive",children:N.moderation_status}),N.moderation_status==="pending"&&r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs(W,{size:"sm",variant:"default",onClick:()=>v(N.id),children:[r.jsx(er,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(W,{size:"sm",variant:"destructive",onClick:()=>g(N.id),children:[r.jsx(ya,{className:"h-4 w-4 mr-1"}),"Reject"]})]}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>b(N),children:[r.jsx(Cr,{className:"h-4 w-4 mr-1"}),"Details"]}),N.moderation_status==="approved"&&r.jsxs(W,{size:"sm",variant:N.is_featured?"secondary":"outline",onClick:()=>y(N.id,N.is_featured),children:[r.jsx(lr,{className:"h-4 w-4 mr-1"}),N.is_featured?"Unfeature":"Feature"]})]})]})},N.id)})}):r.jsx(Y,{children:r.jsxs(X,{className:"text-center py-12 text-muted-foreground",children:[r.jsx(xa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No listings found"}),r.jsx("p",{className:"text-sm mt-2",children:i?"Try adjusting your search term":`No ${s==="all"?"":s} listings at this time`})]})})})]}),s==="pending"&&w.length>0&&r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{className:"text-base",children:"Moderation Notes"}
1007),r.jsx(Nt,{children:"Add notes when approving or rejecting listings. Required for rejections."})]}),r.jsx(X,{children:r.jsx(ir,{placeholder:"Enter moderation notes (required for rejections)...",value:m,onChange:N=>x(N.target.value),rows:3})})]}),d&&r.jsx(Rt,{open:h,onOpenChange:f,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:d.title})}),r.jsxs("div",{className:"space-y-4",children:[d.photos&&d.photos.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:d.photos.map((N,k)=>r.jsx("img",{src:N,alt:`Photo ${k+1}`,className:"w-full h-32 object-cover rounded-lg"},k))}),d.make&&d.model&&r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Vehicle"}),r.jsxs("p",{className:"font-medium",children:[d.year," ",d.make," ",d.model]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Type"}),r.jsx("p",{className:"font-medium capitalize",children:d.listing_type})]})]}),r.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[d.transmission&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Transmission"}),r.jsx("p",{className:"font-medium capitalize",children:d.transmission})]}),d.fuel_type&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Fuel"}),r.jsx("p",{className:"font-medium capitalize",children:d.fuel_type})]}),d.seats&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Seats"}),r.jsx("p",{className:"font-medium",children:d.seats})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Condition"}),r.jsx("p",{className:"font-medium capitalize",children:d.condition})]})]}),d.description&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Description"}),r.jsx("p",{className:"text-sm",children:d.description})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Daily Rate"}),r.jsxs("p",{className:"font-bold text-lg",children:["â¦",d.daily_rate.toLocaleString()]})]}),d.weekly_rate&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Weekly Rate"}),r.jsxs("p",{className:"font-bold text-lg",children:["â¦",d.weekly_rate.toLocaleString()]})]}),d.monthly_rate&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Monthly Rate"}),r.jsxs("p",{className:"font-bold text-lg",children:["â¦",d.monthly_rate.toLocaleString()]})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.driver_included&&r.jsxs(te,{className:"bg-blue-600",children:[r.jsx(Yr,{className:"h-3 w-3 mr-1"}),"Driver Available",d.driver_daily_rate&&` (â¦${d.driver_daily_rate.toLocaleString()}/day)`]}),d.security_personnel_included&&r.jsxs(te,{className:"bg-purple-600",children:[r.jsx(fn,{className:"h-3 w-3 mr-1"}),"Security Available",d.security_personnel_daily_rate&&` (â¦${d.security_personnel_daily_rate.toLocaleString()}/day)`]})]}),d.features&&d.features.length>0&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Features"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:d.features.map((N,k)=>r.jsx(te,{variant:"outline",children:N},k))})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Location"}),r.jsxs("p",{className:"text-sm",children:[d.city,", ",d.state,d.pickup_location&&` ⢠${d.pickup_location}`]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Contact"}),r.jsxs("p",{className:"text-sm",children:["Phone: ",d.contact_phone]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Owner"}),r.jsx("p",{className:"text-sm",children:((C=d.profiles)==null?void 0:C.full_name)||((E=d.profiles)==null?void 0:E.username)||"Unknown"})]}),r.jsxs("div",{className:"flex gap-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),r.jsx(te,{variant:"outline",children:d.status})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Moderation"}),r.jsx(te,{variant:d.moderation_status==="approved"?"default":d.moderation_status==="pending"?"outline":"destructive",children:d.moderation_status})]})]})]}),r.jsxs("div",{className:"flex gap-2 pt-4 border-t",children:[d.moderation_status==="pending"&&r.jsxs(r.Fragment,{children:[r.jsxs(W,{onClick:()=>{v(d.id),f(!1)},children:[r.jsx(er,{className:"h-4 w-4 mr-2"}),"Approve"]}),r.jsxs(W,{variant:"destructive",onClick:()=>{g(d.id),f(!1)},children:[r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Reject"]})]}),d.moderation_status==="approved"&&r.jsxs(W,{variant:d.is_featured?"secondary":"default",onClick:()=>{y(d.id,d.is_featured),f(!1)},children:[r.jsx(lr,{className:"h-4 w-4 mr-2"}),d.is_featured?"Remove Feature":"Feature Listing"]}),r.jsx(W,{variant:"outline",onClick:()=>f(!1),children:"Close"})]})]})})]})};function sGe(){const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(!0),[i,o]=j.useState(null),[l,c]=j.useState(!1),[d,u]=j.useState(!1),[h,f]=j.useState(null),[m,x]=j.useState(""),[p,v]=j.useState("all"),[g,y]=j.useState(""),[b,w]=j.useState("all"),[_,C]=j.useState("all"),[E,N]=j.useState({total:0,pending:0,approvedToday:0,rejectedToday:0}),k=["All Categories","Fashion Designers","Tailors","Chefs","Drivers","Mechanics","Event Coordinators","Security","Cleaners","Electricians","Plumbers","Gatemen","Carpenters","Painters","Welders","Hair Stylists","Barbers","Photographers","Videographers","Others"],I=["All States","Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"];j.useEffect(()=>{P()},[]);const P=async()=>{a(!0);try{const{data:$,error:q}=await H.from("artisans").select(` 1008 *, 1009 profiles:user_id ( 1010 full_name, 1011 email 1012 ) 1013 `).order("created_at",{ascending:!1});if(q)throw q;n($||[]),O($||[])}catch($){console.error("Error fetching artisans:",$),be({title:"Error",description:"Failed to load artisan listings",variant:"destructive"})}finally{a(!1)}},O=$=>{const q=$.length,ne=$.filter(Z=>Z.moderation_status==="pending").length,se=new Date().toISOString().split("T")[0],F=$.filter(Z=>{var de;return Z.moderation_status==="approved"&&((de=Z.moderated_at)==null?void 0:de.startsWith(se))}).length,V=$.filter(Z=>{var de;return Z.moderation_status==="rejected"&&((de=Z.moderated_at)==null?void 0:de.startsWith(se))}).length;N({total:q,pending:ne,approvedToday:F,rejectedToday:V})},A=async $=>{if(e)try{const{error:q}=await H.from("artisans").update({moderation_status:"approved",status:"active",moderated_by:e.id,moderated_at:new Date().toISOString()}).eq("id",$);if(q)throw q;be({title:"Success",description:"Artisan listing approved successfully"}),P()}catch(q){console.error("Error approving artisan:",q),be({title:"Error",description:"Failed to approve artisan listing",variant:"destructive"})}},R=async()=>
1013{if(!(!e||!h)){if(!m.trim()){be({title:"Rejection reason required",description:"Please provide a reason for rejection",variant:"destructive"});return}try{const{error:$}=await H.from("artisans").update({moderation_status:"rejected",status:"draft",moderated_by:e.id,moderated_at:new Date().toISOString(),moderation_notes:m.trim()}).eq("id",h);if($)throw $;be({title:"Success",description:"Artisan listing rejected"}),u(!1),f(null),x(""),P()}catch($){console.error("Error rejecting artisan:",$),be({title:"Error",description:"Failed to reject artisan listing",variant:"destructive"})}}},L=async($,q)=>{try{const ne=!q,se={is_featured:ne};if(ne){const V=new Date;V.setDate(V.getDate()+30),se.feature_expires_at=V.toISOString()}else se.feature_expires_at=null;const{error:F}=await H.from("artisans").update(se).eq("id",$);if(F)throw F;be({title:"Success",description:`Artisan ${ne?"featured":"unfeatured"}`}),P()}catch(ne){console.error("Error toggling featured:",ne),be({title:"Error",description:"Failed to update featured status",variant:"destructive"})}},z=$=>$.moderation_status==="pending"?r.jsx(te,{variant:"outline",className:"bg-yellow-50",children:"Pending Review"}):$.moderation_status==="rejected"?r.jsx(te,{variant:"destructive",children:"Rejected"}):$.status==="active"&&$.moderation_status==="approved"?r.jsx(te,{variant:"default",className:"bg-green-600",children:"Active"}):r.jsx(te,{variant:"outline",children:"Draft"}),U=t.filter($=>{var q,ne,se;if(p==="pending"&&$.moderation_status!=="pending"||p==="approved"&&$.moderation_status!=="approved"||p==="rejected"&&$.moderation_status!=="rejected")return!1;if(g){const F=g.toLowerCase();if(!($.business_name.toLowerCase().includes(F)||$.city.toLowerCase().includes(F)||((q=$.skills)==null?void 0:q.some(Z=>Z.toLowerCase().includes(F)))||((se=(ne=$.profiles)==null?void 0:ne.full_name)==null?void 0:se.toLowerCase().includes(F))))return!1}return!(b!=="all"&&$.service_category!==b||_!=="all"&&$.state!==_)});return s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Total Artisans"}),r.jsx(fr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:E.total})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Pending Approval"}),r.jsx(yt,{className:"h-4 w-4 text-yellow-600"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:E.pending})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Approved Today"}),r.jsx(er,{className:"h-4 w-4 text-green-600"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:E.approvedToday})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Rejected Today"}),r.jsx(ya,{className:"h-4 w-4 text-red-600"})]}),r.jsx(X,{children:r.jsx("div",{className:"text-2xl font-bold",children:E.rejectedToday})})]})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-lg",children:"Filters"})}),r.jsx(X,{children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"search",children:"Search"}),r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"search",placeholder:"Business name, city, skills...",value:g,onChange:$=>y($.target.value),className:"pl-9"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"category",children:"Category"}),r.jsxs(mt,{value:b,onValueChange:w,children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsx(ht,{children:k.map($=>r.jsx(Ne,{value:$==="All Categories"?"all":$,children:$},$))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"state",children:"State"}),r.jsxs(mt,{value:_,onValueChange:C,children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsx(ht,{children:I.map($=>r.jsx(Ne,{value:$==="All States"?"all":$,children:$},$))})]})]})]})})]}),r.jsxs(Kr,{value:p,onValueChange:v,children:[r.jsxs(Hr,{className:"grid w-full grid-cols-4",children:[r.jsxs(Re,{value:"all",children:["All (",t.length,")"]}),r.jsxs(Re,{value:"pending",children:["Pending (",t.filter($=>$.moderation_status==="pending").length,")"]}),r.jsxs(Re,{value:"approved",children:["Approved (",t.filter($=>$.moderation_status==="approved").length,")"]}),r.jsxs(Re,{value:"rejected",children:["Rejected (",t.filter($=>$.moderation_status==="rejected").length,")"]})]}
1013),r.jsx(Be,{value:p,className:"space-y-4 mt-6",children:U.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(fr,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground opacity-50"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"No artisans found"}),r.jsx("p",{className:"text-muted-foreground",children:g||b!=="all"||_!=="all"?"Try adjusting your filters":`No ${p} listings at the moment`})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:U.map($=>r.jsxs(Y,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative h-48 bg-gradient-to-br from-primary/10 to-accent/10",children:[$.portfolio_images&&$.portfolio_images.length>0?r.jsx("img",{src:$.portfolio_images[0],alt:$.business_name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(fr,{className:"h-16 w-16 text-muted-foreground opacity-30"})}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-2",children:[z($),$.is_featured&&r.jsx(te,{className:"bg-gradient-to-r from-green-600 to-emerald-600",children:"Featured"})]})]}),r.jsxs(X,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-lg line-clamp-1",children:$.business_name}),r.jsx(te,{variant:"outline",className:"mt-1",children:$.service_category})]}),$.profiles&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Owner: ",$.profiles.full_name||$.profiles.email]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(At,{className:"h-4 w-4"}),r.jsxs("span",{children:[$.city,", ",$.state]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Created: ",new Date($.created_at).toLocaleDateString()]}),r.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[r.jsxs(W,{variant:"outline",size:"sm",className:"w-full",onClick:()=>{o($),c(!0)},children:[r.jsx(Cr,{className:"mr-2 h-4 w-4"}),"View Details"]}),$.moderation_status==="pending"&&r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(W,{size:"sm",className:"bg-green-600 hover:bg-green-700",onClick:()=>A($.id),children:[r.jsx(er,{className:"mr-2 h-4 w-4"}),"Approve"]}),r.jsxs(W,{size:"sm",variant:"destructive",onClick:()=>{f($.id),u(!0)},children:[r.jsx(ya,{className:"mr-2 h-4 w-4"}),"Reject"]})]}),$.moderation_status==="approved"&&r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>L($.id,$.is_featured),children:[r.jsx(mr,{className:`mr-2 h-4 w-4 ${$.is_featured?"fill-yellow-400 text-yellow-400":""}`}),$.is_featured?"Unfeature":"Feature"]})]})]})]},$.id))})})]}),r.jsx(Rt,{open:l,onOpenChange:c,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Artisan Details"})}),i&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Business Name"}),r.jsx("p",{className:"font-semibold",children:i.business_name})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Service Category"}),r.jsx("p",{className:"font-semibold",children:i.service_category})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"City, State"}),r.jsxs("p",{className:"font-semibold",children:[i.city,", ",i.state]})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Experience"}),r.jsxs("p",{className:"font-semibold",children:[i.experience_years||"N/A"," years"]})]})]}),i.description&&r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Description"}),r.jsx("p",{className:"text-sm mt-1",children:i.description})]}),i.skills&&i.skills.length>0&&r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Skills"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:i.skills.map(($,q)=>r.jsx(te,{variant:"secondary",children:$},q))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Contact Phone"}),r.jsx("p",{className:"font-semibold",children:i.contact_phone||"N/A"})]}),r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Contact Email"}),r.jsx("p",{className:"font-semibold",children:i.contact_email||"N/A"})]})]}),i.portfolio_images&&i.portfolio_images.length>0&&r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Portfolio Photos"}),r.jsx("div",{className:"grid grid-cols-3 gap-2 mt-2",children:i.portfolio_images.map(($,q)=>r.jsx("img",{src:$,alt:`Portfolio ${q+1}`,className:"w-full h-32 object-cover rounded"},q))})]}),i.moderation_notes&&r.jsxs("div",{children:[r.jsx(le,{className:"text-muted-foreground",children:"Moderation Notes"}),r.jsx("p",{className:"text-sm mt-1 p-3 bg-muted rounded",children:i.moderation_notes})]})]})]})}),r.jsx(Rt,{open:d,onOpenChange:u,children:r.jsxs(Ot,{children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"Reject Artisan Listing"}),r.jsx(on,{children:"Please provide a reason for rejection. This will be sent to the artisan."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(le,{htmlFor:"rejection_notes",children:"Rejection Reason *"}),r.jsx(ir,{id:"rejection_notes",value:m,onChange:$=>x($.target.value),placeholder:"E.g., Incomplete information, inappropriate content, etc.",rows:4})]}),r.jsxs("div",{className:"flex justify-end gap-3",children:[r.jsx(W,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(W,{variant:"destructive",onClick:R,children:"Reject Listing"})]})]})]})})]})}function aGe(){const[e,t]=j.useState([]),[n,s]=j.useState(!0),[a,i]=j.useState(null),[o,l]=j.useState(null),[c,d]=j.useState(""),[u,h]=j.useState("pending");j.useEffect(()=>{f()},[u]);const f=async()=>{try{s(!0);const{data:p,error:v}=await H.from("travel_services").select(` 1014 *, 1015 profiles:user_id ( 1016 full_name, 1017 email 1018 ) 1019 `).eq("moderation_status",u).order("created_at",{ascending:!1});if(v)throw v;t(p||[])}catch{be({title:"Error",description:"Failed to load travel services",variant:"destructive"})}finally{s(!1)}},m=async(p,v)=>{try{i(p);const{data:{user:g}}=await H.auth.getUser();if(!g)throw new Error("Not authenticated");const{error:y}=await H.from("travel_services").update({moderation_status:v,moderated_by:g.id,moderated_at:new Date().toISOString(),moderation_notes:c||null}).eq("id",p);if(y)throw y;be({title:"Success",description:`Travel service ${v==="approved"?"approved":"rejected"} successfully`}),l(null),d(""),f()}catch(g){be({title:"Error",description:g.message,variant:"destructive"})}finally{i(null)}},x=()=>{var p,v;return o?r.jsx(Rt,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{className:"flex items-center gap-2",children:[o.business_name,r.jsx(te,{variant:o.moderation_status==="approved"?"default":o.moderation_status==="rejected"?"destructive":"secondary",children:o.moderation_status})]}),r.jsx(on,{children:"Review and moderate this travel service listing"})]}),r.jsxs("div",{className:"space-y-6",children:[o.photos&&o.photos.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-2",children:["Photos (",o.photos.length,")"]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:o.photos.map((g,y)=>r.jsx("img",{src:g,alt:`Photo ${y+1}`,className:"w-full h-32 object-cover rounded-lg"},y))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:"Service Type"}),r.jsx("p",{children:o.service_type})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:"Location"}),r.jsxs("p",{children:[o.city,", ",o.state]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:"Subscription Tier"}),r.jsx(te,{variant:"outline",className:"capitalize",children:o.subscription_tier})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:"Submitted By"}),r.jsx("p",{children:((p=o.profiles)==null?void 0:p.full_name)||"N/A"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(v=o.profiles)==null?void 0:v.email})]})]}),o.description&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-1",children:"Description"}),r.jsx("p",{className:"text-sm whitespace-pre-line",children:o.description})]}),o.services_offered&&o.services_offered.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-2",children:"Services Offered"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:o.services_offered.map((g,y)=>r.jsx(te,{variant:"secondary",children:g},y))})]}),o.destinations_served&&o.destinations_served.length>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-2",children:"Destinations Served"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:o.destinations_served.map((g,y)=>r.jsx(te,{variant:"outline",children:g},y))})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-2",children:"Contact Information"}),r.jsxs("div",{className:"space-y-2 text-sm",children:[o.contact_phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),r.jsx("span",{children:o.contact_phone})]}),o.contact_email&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Dn,{className:"h-4 w-4"}),r.jsx("span",{children:o.contact_email})]}),o.contact_whatsapp&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(an,{className:"h-4 w-4"}),r.jsxs("span",{children:["WhatsApp: ",o.contact_whatsapp]})]}),o.website_url&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hn,{className:"h-4 w-4"}),r.jsx("a",{href:o.website_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:o.website_url})]})]})]}),o.address&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-1",children:"Address"}),r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[r.jsx(At,{className:"h-4 w-4 mt-0.5"}),r.jsx("span",{children:o.address})]})]}),o.moderation_status==="pending"&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-2",children:"Moderation Notes (Optional)"}),r.jsx(ir,{value:c,onChange:g=>d(g.target.value),placeholder:"Add notes about your moderation decision...",rows:3})]}),o.moderation_notes&&r.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[r.jsx("h4",{className:"text-sm font-semibold mb-1",children:"Previous Moderation Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:o.moderation_notes})]}),o.moderation_status==="pending"&&r.jsxs("div",{className:"flex gap-3 pt-4 border-t",children:[r.jsxs(W,{onClick:()=>m(o.id,"approved"),disabled:!!a,className:"flex-1",children:[a===o.id?r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(er,{className:"mr-2 h-4 w-4"}),"Approve"]}),r.jsxs(W,{onClick:()=>m(o.id,"rejected"),disabled:!!a,variant:"destructive",className:"flex-1",children:[a===o.id?r.jsx(yt,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(ya,{className:"mr-2 h-4 w-4"}),"Reject"]})]})]})]})}):null};return r.jsxs(r.Fragment,{children:[r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Travel Services Management"}),r.jsx(Nt,{children:"Review and moderate travel service listings"})]}),r.jsx(X,{children:r.jsxs(Kr,{value:u,onValueChange:p=>h(p),children:[r.jsxs(Hr,{className:"grid w-full grid-cols-3",children:[r.jsx(Re,{value:"pending",children:"Pending"}),r.jsx(Re,{value:"approved",children:"Approved"}),r.jsx(Re,{value:"rejected",children:"Rejected"})]}),r.jsx(Be,{value:u,className:"mt-6",children:n?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):e.length===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(vn,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsxs("p",{children:["No ",u," travel services found"]}
1019)]}):r.jsx("div",{className:"space-y-4",children:e.map(p=>{var v;return r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-semibold",children:p.business_name}),r.jsx(te,{variant:"outline",className:"text-xs",children:p.service_type}),r.jsx(te,{variant:"outline",className:"text-xs capitalize",children:p.subscription_tier})]}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:p.description||"No description provided"}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),p.city,", ",p.state]}),r.jsxs("span",{children:["By ",((v=p.profiles)==null?void 0:v.full_name)||"Unknown"]}),r.jsx("span",{children:new Date(p.created_at).toLocaleDateString()})]})]}),r.jsx("div",{className:"flex flex-col gap-2",children:r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>l(p),children:[r.jsx(Cr,{className:"mr-2 h-4 w-4"}),"Review"]})})]})})},p.id)})})})]})})]}),r.jsx(x,{})]})}const iGe=()=>{const{toast:e}=Sn(),[t,n]=j.useState([]),[s,a]=j.useState([]),[i,o]=j.useState(!0),[l,c]=j.useState(null),[d,u]=j.useState(!1);j.useEffect(()=>{h()},[]);const h=async()=>{try{const[g,y]=await Promise.all([H.from("ad_placements").select("*").order("location, name"),H.from("ad_pricing").select("*").order("placement_id, duration_days")]);g.data&&n(g.data),y.data&&a(y.data)}catch(g){console.error("Error fetching data:",g)}finally{o(!1)}},f=async g=>{try{const{error:y}=await H.from("ad_placements").update({is_active:!g.is_active}).eq("id",g.id);if(y)throw y;e({title:"Placement Updated",description:`${g.name} is now ${g.is_active?"inactive":"active"}`}),h()}catch(y){console.error("Error updating placement:",y),e({title:"Update Failed",description:"Failed to update placement status",variant:"destructive"})}},m=async()=>{if(l)try{const{error:g}=await H.from("ad_pricing").update({price:l.price,discount_percentage:l.discount_percentage,is_active:l.is_active}).eq("id",l.id);if(g)throw g;e({title:"Price Updated",description:"Ad pricing has been updated successfully"}),u(!1),c(null),h()}catch(g){console.error("Error updating price:",g),e({title:"Update Failed",description:"Failed to update pricing",variant:"destructive"})}},x=g=>s.filter(y=>y.placement_id===g),p=g=>{var y;return((y=t.find(b=>b.id===g))==null?void 0:y.name)||"Unknown"},v=s.filter(g=>g.duration_days===30&&g.is_active).reduce((g,y)=>g+y.price,0);return i?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((g,y)=>r.jsx("div",{className:"h-20 bg-muted animate-pulse rounded-lg"},y))}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid md:grid-cols-4 gap-4",children:[r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Placements"}),r.jsx("p",{className:"text-2xl font-bold",children:t.length})]}),r.jsx(Yq,{className:"h-8 w-8 text-muted-foreground"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Active"}),r.jsx("p",{className:"text-2xl font-bold",children:t.filter(g=>g.is_active).length})]}),r.jsx(te,{variant:"default",children:"Active"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Mobile Placements"}),r.jsx("p",{className:"text-2xl font-bold",children:t.filter(g=>g.is_mobile).length})]}),r.jsx(D0,{className:"h-8 w-8 text-muted-foreground"})]})})}),r.jsx(Y,{children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Max Monthly Revenue"}),r.jsxs("p",{className:"text-2xl font-bold",children:["â¦",v.toLocaleStr
1019ing()]})]}),r.jsx(Tn,{className:"h-8 w-8 text-muted-foreground"})]})})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Ad Placements"}),r.jsx(Nt,{children:"Manage ad placement slots and their status"})]}),r.jsx(X,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Placement"}),r.jsx(jt,{children:"Location"}),r.jsx(jt,{children:"Size"}),r.jsx(jt,{children:"Type"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{children:"Actions"})]})}),r.jsx(Oi,{children:t.map(g=>r.jsxs(On,{children:[r.jsx(wt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:g.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:g.description})]})}),r.jsx(wt,{children:r.jsx(te,{variant:"outline",children:g.location})}),r.jsx(wt,{children:r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{children:g.size_label}),r.jsxs("p",{className:"text-muted-foreground",children:[g.width,"x",g.height,"px"]})]})}),r.jsx(wt,{children:g.is_mobile?r.jsx(te,{variant:"secondary",children:"Mobile"}):r.jsx(te,{variant:"outline",children:"Desktop"})}),r.jsx(wt,{children:r.jsx(Ro,{checked:g.is_active,onCheckedChange:()=>f(g)})}),r.jsx(wt,{children:r.jsx("div",{className:"text-sm",children:x(g.id).map(y=>r.jsxs("span",{className:"block",children:[y.duration_label,": â¦",y.price.toLocaleString()]},y.id))})})]},g.id))})]})})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Pricing Management"}),r.jsx(Nt,{children:"Update prices for each placement and duration"})]}),r.jsx(X,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Placement"}),r.jsx(jt,{children:"Duration"}),r.jsx(jt,{children:"Price (â¦)"}),r.jsx(jt,{children:"Discount"}),r.jsx(jt,{children:"Daily Rate"}),r.jsx(jt,{children:"Status"}),r.jsx(jt,{children:"Actions"})]})}),r.jsx(Oi,{children:s.map(g=>r.jsxs(On,{children:[r.jsx(wt,{className:"font-medium",children:p(g.placement_id)}),r.jsx(wt,{children:g.duration_label}),r.jsxs(wt,{children:["â¦",g.price.toLocaleString()]}),r.jsx(wt,{children:g.discount_percentage>0&&r.jsxs(te,{variant:"secondary",children:[g.discount_percentage,"% off"]})}),r.jsxs(wt,{className:"text-muted-foreground",children:["â¦",Math.round(g.price/g.duration_days).toLocaleString(),"/day"]}),r.jsx(wt,{children:r.jsx(te,{variant:g.is_active?"default":"secondary",children:g.is_active?"Active":"Inactive"})}),r.jsx(wt,{children:r.jsx(W,{variant:"outline",size:"sm",onClick:()=>{c(g),u(!0)},children:r.jsx(so,{className:"h-4 w-4"})})})]},g.id))})]})})})]}),r.jsx(Rt,{open:d,onOpenChange:u,children:r.jsxs(Ot,{children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Edit Pricing"})}),l&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(le,{children:"Placement"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[p(l.placement_id)," - ",l.duration_label]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Price (â¦)"}),r.jsx(ge,{type:"number",value:l.price,onChange:g=>c({...l,price:parseFloat(g.target.value)||0})})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Discount Percentage"}),r.jsx(ge,{type:"number",min:"0",max:"100",value:l.discount_percentage,onChange:g=>c({...l,discount_percentage:parseFloat(g.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ro,{checked:l.is_active,onCheckedChange:g=>c({...l,is_active:g})}),r.jsx(le,{children:"Active"})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsxs(W,{onClick:m,className:"flex-1",children:[r.jsx(Sm,{className:"h-4 w-4 mr-2"}),"Save Changes"]}),r.jsxs(W,{variant:"outline",onClick:()=>u(!1),children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})]})]})})]})},nC=[{id:"hero-all-services",name:"Hero - All Services",headline:"Discover, Create & Connect",folder:"instagram",filename:"hero-all-services.png",nearYou:!1,size:{width:1024,height:1024}},{id:"marketplace",name:"Marketplace",headline:"Sell Your Products",folder:"instagram",filename:"marketplace.png",nearYou:!1,size:{width:1024,height:1024}},{id:"events-near-you",name:"Events Near You",headline:"Nigerian Music & Culture",folder:"instagram",filename:"events-near-you.png",nearYou:!0,size:{width:1024,height:1024}},{id:"diaspora-connection",name:"Diaspora Connection",headline:"Stay Connected to Home",folder:"stories",filename:"diaspora-connection.png",nearYou:!1,size:{width:1024,height:1792}},{id:"creativity",name:"Creativity Showcase",headline:"Showcase Your Art",folder:"twitter",filename:"creativity.png",nearYou:!1,size:{width:1024,height:1024}},{id:"lodging-near-you",name:"Lodging Near You",headline:"Book Unique Nigerian Stays",folder:"instagram",filename:"lodging-near-you.png",nearYou:!0,size:{width:1024,height:1024}},{id:"restaurants-near-you",name:"Restaurants Near You",headline:"Discover Nigerian Restaurants",folder:"instagram",filename:"restaurants-near-you.png",nearYou:!0,size:{width:1024,height:1024}},{id:"artisans-near-you",name:"Artisans Near You",headline:"Find Verified Craftsmen",folder:"instagram",filename:"artisans-near-you.png",nearYou:!0,size:{width:1024,height:1024}},{id:"tourism",name:"Tourism Nigeria",headline:"Explore Nigeria",folder:"linkedin",filename:"tourism.png",nearYou:!1,size:{width:1536,height:1024}},{id:"airtime",name:"Airtime Service",headline:"Instant Airtime Top-Up",folder:"instagram",filename:"airtime.png",nearYou:!1,size:{width:1024,height:1024}},{id:"classifieds-near-you",name:"Classifieds Near You",headline:"Buy, Sell & Trade",folder:"instagram",filename:"classifieds-near-you.png",nearYou:!0,size:{width:1024,height:1024}},{id:"trust-stats",name:"Trust & Stats",headline:"15K+ Creators",folder:"facebook",filename:"trust-stats-cover.png",nearYou:!1,size:{width:1536,height:1024}},{id:"diaspora-services",name:"Diaspora Services",headline:"Nigerian Services Wherever You Live",folder:"instagram",filename:"diaspora-services.png",nearYou:!0,size:{width:1024,height:1024}},{id:"community",name:"Community",headline:"Join 200K+ Nigerians",folder:"instagram",filename:"community.png",nearYou:!1,size:{width:1024,height:1024}},{id:"nigeria-news",name:"Nigeria News (Instagram)",headline:"Breaking News from Nigeria",folder:"instagram",filename:"nigeria-news.png",nearYou:!1,size:{width:300,height:250}},{id:"nigeria-news-facebook",name:"Nigeria News (Facebook)",headline:"Your Daily Dose of Nigerian News",folder:"facebook",filename:"nigeria-news.png",nearYou:!1,size:{width:1536,height:1024}},{id:"diaspora-news",name:"Diaspora News (Instagram)",headline:"News from Home, Wherever You Are",folder:"instagram",filename:"diaspora-news.png",nearYou:!1,size:{width:1024,height:1024}},{id:"diaspora-news-facebook",name:"Diaspora News (Facebook)",headline:"Nigerian News for the Global Community",folder:"facebook",filename:"diaspora-news.png",nearYou:!1,size:{width:1536,height:1024}},{id:"gossip-news",name:"Gossip News (Instagram)",headline:"Naija Gist & Gossip â What's Trending?",folder:"instagram",filename:"gossip-news.png",nearYou:!1,size:{width:1024,height:1024}},{id:"gossip-news-facebook",name:"Gossip News (Facebook)",headline:"Heard the Latest Gist? Share & Discover!",folder:"facebook",filename:"gossip-news.png",nearYou:!1,size:{width:1536,height:1024}},{id:"hero-all-services-news",name:"All Services + News (Instagram)",headline:"Discover, Create & Connect â All Things Nigerian",folder:"instagram",filename:"hero-all-services-news.png",nearYou:!1,size:{width:1024,height:1024}},{id:"hero-all-services-news-facebook",name:"All Services + News (Facebook)",headline:"Your One-Stop Nigerian Platform",folder:"facebook",filename:"hero-all-services-news.png",nearYou:!1,size:{width:1536,height:1024}},{id:"list-your-business",name:"List Your Business (Instagram)",headline:"List Your Business & Reach Customers Near You",folder:"instagram",filename:"list-your-business.png",nearYou:!0,size:{width:1024,height:1024}},{id:"list-your-business-facebook",name:"List Your Business (Facebook)",headline:"Grow Your Nigerian Business â Reach Local Customers",folder:"facebook",filename:"list-your-business.png",nearYou:!0,size:{width:1536,height:1024}}],sC=["instagram","stories","twitter","linkedin","facebook"];function oGe(){const[e,t]=j.useState({}),[n,s]=j.useState(!0),[a,i]=j.useState(!1),[o,l]=j.useState(null),[c,d]=j.useState(!1),[u,h]=j.useState("instagram"),[f,m]=j.useState([]),x=j.useCallback(async()=>{s(!0);try{const N={};for(const k of sC){const{data:I,error:P}=await H.storage.from("marketing").list(k,{sortBy:{column:"created_at",order:"desc"}});if(P){console.error(`Error fetching ${k}:`,P);continue}N[k]=I||[]}t(N)}catch(N){console.error("Error fetching assets:",N),Et.error("Failed to load marketing assets")}finally{s(!1)}},[]);j.useEffect(()=>{x()},[x]);const p=(N,k)=>{const{data:I}=H.storage.from("marketing").getPublicUrl(`${N}/${k}`);return I.publicUrl},v=async(N,k)=>{const I=p(N,k);await navigator.clipboard.writeText(I),Et.success("URL copied to clipboard")},g=async(N,k)=>{if(confirm("Are you sure you want to delete this asset?"))try{const{error:I}=await H.storage.from("marketing").remove([`${N}/${k}`]);
1019if(I)throw I;Et.success("Asset deleted"),x()}catch(I){console.error("Error deleting asset:",I),Et.error("Failed to delete asset")}},y=async N=>{var I;const k=(I=N.target.files)==null?void 0:I[0];if(k){if(!k.type.startsWith("image/")){Et.error("Please select an image file");return}d(!0);try{const{error:P}=await H.storage.from("marketing").upload(`${u}/${k.name}`,k,{upsert:!0});if(P)throw P;Et.success("Asset uploaded successfully"),x()}catch(P){console.error("Error uploading asset:",P),Et.error("Failed to upload asset")}finally{d(!1),N.target.value=""}}},b=async N=>{var k,I,P,O;l(N);try{const{data:{session:A}}=await H.auth.getSession();if(!A){Et.error("Please sign in to generate banners");return}const R=await H.functions.invoke("generate-marketing-banner",{body:{bannerId:N}});if(R.error)throw R.error;const L=R.data;if((I=(k=L.results)==null?void 0:k[0])!=null&&I.success)Et.success(`Banner "${N}" generated successfully!`),x();else throw new Error(((O=(P=L.results)==null?void 0:P[0])==null?void 0:O.error)||"Generation failed")}catch(A){console.error("Error generating banner:",A),Et.error(`Failed to generate banner: ${A instanceof Error?A.message:"Unknown error"}`)}finally{l(null)}},w=async()=>{if(confirm("This will generate all 22 banners using AI. This may take several minutes and use API credits. Continue?")){i(!0),m([]);try{const{data:{session:N}}=await H.auth.getSession();if(!N){Et.error("Please sign in to generate banners");return}const k=await H.functions.invoke("generate-marketing-banner",{body:{generateAll:!0}});if(k.error)throw k.error;const I=k.data;m(I.results||[]),Et.success(`Generated ${I.generated} banners successfully. ${I.failed} failed.`),x()}catch(N){console.error("Error generating banners:",N),Et.error(`Failed to generate banners: ${N instanceof Error?N.message:"Unknown error"}`)}finally{i(!1)}}},_=(N,k)=>{const I=p(N,k),P=document.createElement("a");P.href=I,P.download=k,P.target="_blank",document.body.appendChild(P),P.click(),document.body.removeChild(P)},C=N=>(e[N.folder]||[]).some(I=>I.name===N.filename),E=N=>N<1024?`${N} B`:N<1024*1024?`${(N/1024).toFixed(1)} KB`:`${(N/(1024*1024)).toFixed(1)} MB`;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Y,{children:r.jsx(Se,{children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(no,{className:"h-5 w-5"}),"Marketing Assets Manager"]}),r.jsx(Nt,{children:"Generate and manage social media marketing banners for Naija.com"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{variant:"outline",onClick:x,disabled:n,children:[r.jsx(ms,{className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"Refresh"]}),r.jsxs(W,{onClick:w,disabled:a,className:"bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700",children:[a?r.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(qR,{className:"h-4 w-4 mr-2"}),"Generate All Banners"]})]})]})})}),f.length>0&&r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-lg",children:"Generation Results"})}),r.jsx(X,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:f.map(N=>r.jsxs("div",{className:`p-3 rounded-lg border ${N.success?"bg-green-50 border-green-200":"bg-red-50 border-red-200"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[N.success?r.jsx(er,{className:"h-4 w-4 text-green-600"}):r.jsx(ya,{className:"h-4 w-4 text-red-600"}),r.jsx("span",{className:"font-medium text-sm",children:N.id})]}),N.error&&r.jsx("p",{className:"text-xs text-red-600 mt-1",children:N.error})]},N.id))})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{className:"text-lg",children:"Banner Templates"}),r.jsx(Nt,{children:"Click on any banner to generate it individually. Green checkmark = already generated."})]}),r.jsx(X,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:nC.map(N=>{const k=C(N),I=o===N.id;return r.jsxs("div",{className:`relative p-4 rounded-lg border-2 transition-all ${k?"border-green-300 bg-green-50/50":"border-dashed border-muted-foreground
1019/30 hover:border-primary/50 hover:bg-accent/50"}`,children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h4",{className:"font-medium text-sm flex items-center gap-1",children:[N.name,N.nearYou&&r.jsx(At,{className:"h-3 w-3 text-primary"})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:N.headline})]}),k&&r.jsx(er,{className:"h-5 w-5 text-green-600 flex-shrink-0"})]}),r.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[r.jsx(te,{variant:"outline",className:"text-xs",children:N.folder}),r.jsxs(te,{variant:"secondary",className:"text-xs",children:[N.size.width,"x",N.size.height]})]}),r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsx(W,{size:"sm",variant:k?"outline":"default",onClick:()=>b(N.id),disabled:I||a,className:"flex-1",children:I?r.jsx(yt,{className:"h-3 w-3 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(qR,{className:"h-3 w-3 mr-1"}),k?"Regenerate":"Generate"]})}),k&&r.jsxs(r.Fragment,{children:[r.jsx(W,{size:"sm",variant:"ghost",onClick:()=>v(N.folder,N.filename),children:r.jsx(ah,{className:"h-3 w-3"})}),r.jsx(W,{size:"sm",variant:"ghost",onClick:()=>window.open(p(N.folder,N.filename),"_blank"),children:r.jsx(ds,{className:"h-3 w-3"})})]})]})]},N.id)})})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx(Ae,{className:"text-lg",children:"Asset Browser"}),r.jsx(Nt,{children:"View and manage all marketing assets by folder"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ge,{type:"file",accept:"image/*",onChange:y,disabled:c,className:"max-w-[200px]",id:"upload-input"}),r.jsx(W,{variant:"outline",disabled:c,asChild:!0,children:r.jsx("label",{htmlFor:"upload-input",className:"cursor-pointer",children:c?r.jsx(yt,{className:"h-4 w-4 animate-spin"}):r.jsx(Jn,{className:"h-4 w-4"})})})]})]})}),r.jsx(X,{children:r.jsxs(Kr,{value:u,onValueChange:h,children:[r.jsx(Hr,{className:"mb-4",children:sC.map(N=>{var k;return r.jsxs(Re,{value:N,className:"capitalize",children:[r.jsx($ie,{className:"h-4 w-4 mr-2"}),N,((k=e[N])==null?void 0:k.length)>0&&r.jsx(te,{variant:"secondary",className:"ml-2",children:e[N].length})]},N)})}),sC.map(N=>{var k,I;return r.jsx(Be,{value:N,children:n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):((k=e[N])==null?void 0:k.length)===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(no,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No assets in this folder yet"}),r.jsx("p",{className:"text-sm",children:"Upload an image or generate banners"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:(I=e[N])==null?void 0:I.map(P=>{var O;return r.jsxs("div",{className:"group relative rounded-lg border overflow-hidden bg-muted/50",children:[r.jsxs("div",{className:"aspect-square relative",children:[r.jsx("img",{src:p(N,P.name),alt:P.name,className:"w-full h-full object-cover",loading:"lazy"}),r.jsxs("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[r.jsx(W,{size:"icon",variant:"secondary",onClick:()=>v(N,P.name),title:"Copy URL",children:r.jsx(ah,{className:"h-4 w-4"})}),r.jsx(W,{size:"icon",variant:"secondary",onClick:()=>_(N,P.name),title:"Download",children:r.jsx(qh,{className:"h-4 w-4"})}),r.jsx(W,{size:"icon",variant:"secondary",onClick:()=>window.open(p(N,P.name),"_blank"),title:"Open in new tab",children:r.jsx(ds,{className:"h-4 w-4"})}),r.jsx(W,{size:"icon",variant:"destructive",onClick:()=>g(N,P.name),title:"Delete",children:r.jsx(ao,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"p-3",children:[r.jsx("p",{className:"text-sm font-medium truncate",title:P.name,children:P.name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:E(((O=P.metadata)==null?void 0:O.size)||0)})]})]},P.id)})})},N)})]})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{className:"text-lg",children:"Qu
1019ick Copy URLs"}),r.jsx(Nt,{children:"Copy shareable URLs for all generated banners"})]}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:[nC.filter(N=>C(N)).map(N=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-muted/50 hover:bg-muted",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[N.nearYou&&r.jsx(At,{className:"h-3 w-3 text-primary flex-shrink-0"}),r.jsx("span",{className:"text-sm truncate",children:N.name})]}),r.jsxs(W,{size:"sm",variant:"ghost",onClick:()=>v(N.folder,N.filename),children:[r.jsx(ah,{className:"h-3 w-3 mr-1"}),"Copy URL"]})]},N.id)),nC.filter(N=>C(N)).length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:'No banners generated yet. Click "Generate All Banners" to create them.'})]})})]})]})}const lGe=[{business_name:"Ade's Tailoring",service_category:"Tailoring",description:"Bespoke agbada, senator styles & traditional attire",city:"Lagos",state:"Lagos",country_code:"NG",skills:["Agbada","Senator","Aso-Oke"],experience_years:15,hourly_rate:5e3},{business_name:"Nkechi Hair Studio",service_category:"Hair Styling",description:"Braids, locs, weaves & natural hair care",city:"Abuja",state:"FCT",country_code:"NG",skills:["Braids","Locs","Weaving"],experience_years:10,hourly_rate:3e3},{business_name:"Obi Woodcraft",service_category:"Carpentry",description:"Custom furniture, home décor & wood carving",city:"Benin City",state:"Edo",country_code:"NG",skills:["Furniture","Carving","Doors"],experience_years:20,hourly_rate:4e3},{business_name:"Mama Titi Beads",service_category:"Bead Making",description:"Traditional & contemporary bead jewelry",city:"Ibadan",state:"Oyo",country_code:"NG",skills:["Waist Beads","Necklaces","Bracelets"],experience_years:12,hourly_rate:2500},{business_name:"Kunle Leather Works",service_category:"Leather Work",description:"Handmade bags, belts, shoes & sandals",city:"Abeokuta",state:"Ogun",country_code:"NG",skills:["Bags","Shoes","Belts"],experience_years:8,hourly_rate:3500},{business_name:"Adire by Shade",service_category:"Textile Art",description:"Traditional adire & tie-dye fabric making",city:"Osogbo",state:"Osun",country_code:"NG",skills:["Adire","Tie-Dye","Batik"],experience_years:18,hourly_rate:4e3},{business_name:"Chidi Ironworks",service_category:"Welding & Fabrication",description:"Gates, railings, burglar-proofing & metal art",city:"Nnewi",state:"Anambra",country_code:"NG",skills:["Gates","Railings","Metal Art"],experience_years:14,hourly_rate:5e3},{business_name:"Amaka Makeup Artistry",service_category:"Makeup",description:"Bridal, editorial & everyday glam makeup",city:"Port Harcourt",state:"Rivers",country_code:"NG",skills:["Bridal","Editorial","Gele Tying"],experience_years:7,hourly_rate:15e3},{business_name:"Tunde Auto Upholstery",service_category:"Upholstery",description:"Car seat covers, furniture re-upholstery",city:"Ilorin",state:"Kwara",country_code:"NG",skills:["Car Seats","Sofas","Curtains"],experience_years:11,hourly_rate:3e3},{business_name:"Calabar Pottery Studio",service_category:"Pottery",description:"Handcrafted pots, vases & ceramic art",city:"Calabar",state:"Cross River",country_code:"NG",skills:["Pots","Vases","Tiles"],experience_years:16,hourly_rate:2e3},{business_name:"Naija Tailor Houston",service_category:"Tailoring",description:"Nigerian traditional wear specialist in Houston",city:"Houston",state:"Texas",country_code:"US",skills:["Agbada","Aso-Oke","Kaftan"],experience_years:12,hourly_rate:8e3},{business_name:"Ola Braids ATL",service_category:"Hair Styling",description:"African braiding & natural hair salon",city:"Atlanta",state:"Georgia",country_code:"US",skills:["Box Braids","Cornrows","Twists"],experience_years:9,hourly_rate:6e3},{business_name:"Afro Stitch NYC",service_category:"Tailoring",description:"Custom African fashion in New York",city:"New York",state:"New York",country_code:"US",skills:["Ankara","Kente","Modern African"],experience_years:11,hourly_rate:1e4},{business_name:"DMV African Tailors",service_category:"Tailoring",description:"Traditional & modern African outfits in DC area",city:"Silver Spring",state:"Maryland",country_code:"US",skills:["Agbada","Dashiki","Suits"],experience_years:14,hourly_rate:7500},{business_name:"Chi Beauty Dallas",service_category:"Makeup",de
1019scription:"Bridal makeup & gele tying specialist",city:"Dallas",state:"Texas",country_code:"US",skills:["Bridal","Gele","Party Makeup"],experience_years:6,hourly_rate:12e3},{business_name:"Lagos Styles London",service_category:"Tailoring",description:"Premium Nigerian fashion in Peckham",city:"London",state:"England",country_code:"GB",skills:["Agbada","Aso-Oke","Lace"],experience_years:17,hourly_rate:9e3},{business_name:"Naija Hair London",service_category:"Hair Styling",description:"African hair braiding salon in East London",city:"London",state:"England",country_code:"GB",skills:["Braids","Weaving","Locs"],experience_years:13,hourly_rate:7e3},{business_name:"African Couture Birmingham",service_category:"Tailoring",description:"Bespoke African attire in Birmingham",city:"Birmingham",state:"England",country_code:"GB",skills:["Wedding Outfits","Traditional","Contemporary"],experience_years:10,hourly_rate:8e3},{business_name:"Jollof Jewels Manchester",service_category:"Bead Making",description:"Nigerian bead jewelry & accessories",city:"Manchester",state:"England",country_code:"GB",skills:["Coral Beads","Waist Beads","Custom Jewelry"],experience_years:8,hourly_rate:5e3},{business_name:"Naija Fabrics Toronto",service_category:"Textile Art",description:"African fabric store & custom tailoring",city:"Toronto",state:"Ontario",country_code:"CA",skills:["Ankara","Aso-Oke","Adire"],experience_years:9,hourly_rate:7e3},{business_name:"Afro Braids Calgary",service_category:"Hair Styling",description:"All styles of African braiding",city:"Calgary",state:"Alberta",country_code:"CA",skills:["Knotless Braids","Goddess Locs","Passion Twists"],experience_years:7,hourly_rate:6500},{business_name:"Naija Glam Edmonton",service_category:"Makeup",description:"Glam makeup for all occasions",city:"Edmonton",state:"Alberta",country_code:"CA",skills:["Bridal","Party","Photoshoot"],experience_years:5,hourly_rate:8e3},{business_name:"Aso Rock Tailors Johannesburg",service_category:"Tailoring",description:"Nigerian & West African fashion",city:"Johannesburg",state:"Gauteng",country_code:"ZA",skills:["Agbada","Kaftan","Ankara"],experience_years:11,hourly_rate:4500},{business_name:"Abuja Hair Pretoria",service_category:"Hair Styling",description:"Nigerian-style braids and styling",city:"Pretoria",state:"Gauteng",country_code:"ZA",skills:["Braids","Extensions","Natural Hair"],experience_years:8,hourly_rate:3500},{business_name:"West African Welds Lagos",service_category:"Welding & Fabrication",description:"Premium metalwork and artistic fabrication",city:"Ikeja",state:"Lagos",country_code:"NG",skills:["Stainless Steel","Aluminium","Artistic Welding"],experience_years:15,hourly_rate:6e3},{business_name:"9ja Paint Masters",service_category:"Painting",description:"House painting, murals & artistic finishes",city:"Lekki",state:"Lagos",country_code:"NG",skills:["Interior","Exterior","Murals"],experience_years:10,hourly_rate:4e3},{business_name:"Igbo Craft House",service_category:"Bead Making",description:"Traditional Igbo coral & bead work",city:"Enugu",state:"Enugu",country_code:"NG",skills:["Coral Beads","Ivory Imitation","Cultural Jewelry"],experience_years:20,hourly_rate:3e3},{business_name:"Naija Nails Dublin",service_category:"Nail Art",description:"Acrylic, gel & nail art specialist",city:"Dublin",state:"Leinster",country_code:"IE",skills:["Acrylics","Gel","Nail Art"],experience_years:6,hourly_rate:5500},{business_name:"African Décor Dubai",service_category:"Interior Design",description:"African-inspired interior décor and styling",city:"Dubai",state:"Dubai",country_code:"AE",skills:["African Décor","Event Styling","Home Staging"],experience_years:9,hourly_rate:15e3},{business_name:"Iya Alaari Weaver",service_category:"Textile Art",description:"Traditional aso-oke weaving from Ilorin",city:"Ilorin",state:"Kwara",country_code:"NG",skills:["Aso-Oke","Sanyan","Etu"],experience_years:25,hourly_rate:3e3}],cGe=[{title:"Eko Atlantic Luxury Apartment",summary:"Modern 3-bed apartment with ocean views in Eko Atlantic",property_type:"apartment",city:"Lagos",state:"Lagos",country_code:"NG",base_price_per_night:85e3,max_guests:6,bedrooms:3,baths:2,amenities:["WiFi","AC","Pool","Gym","Parking"]},{title:"Lekki Phase 1 Shortlet",summary:"Cozy 2-bed shortlet in the heart of Lekki",property_type:"apartment",city:"Lagos",state:"Lagos",country_code:"NG",base_price_per_night:45e3,max_guests:4,bedrooms:2,baths:2,amenities:["WiFi","AC","Generator","Security"]},{title:"Victoria Island Executive Suite",summary:"Premium suite for business travelers on VI",property_type:"hotel",city:"Lagos",state:"Lagos",country_code:"NG",base_price_per_night:12e4,max_guests:2,bedrooms:1,baths:1,amenities:["WiFi","AC","Room Service","Concierge"]},{title:"Abuja Maitama Guest House",summary:"Elegant 4-bed guest house in Maitama district",property_type:"guest_house",city:"Abuja",state:"FCT",country_code:"NG",base_price_per_night:65e3,max_guests:8,bedrooms:4,baths:3,amenities:["WiFi","AC","Generator","Garden","Parking"]},{title:"Wuse 2 Modern Studio",summary:"Compact studio apartment near Wuse Market",property_type:"studio",city:"Abuja",state:"FCT",country_code:"NG",base_price_per_night:25e3,max_guests:2,bedrooms:1,baths:1,amenities:["WiFi","AC","Kitchen"]},{title:"Port Harcourt GRA Villa",summary:"Spacious 5-bed villa in GRA Phase 2",property_type:"villa",city:"Port Harcourt",state:"Rivers",country_code:"NG",base_price_per_night:95e3,max_guests:10,bedrooms:5,baths:4,amenities:["WiFi","AC","Pool","Garden","Security"]},{title:"Calabar Waterfront Lodge",summary:"Scenic lodge overlooking the Calabar River",property_type:"lodge",city:"Calabar",state:"Cross River",country_code:"NG",base_price_per_night:35e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","River View","Restaurant"]},{title:"Ibadan Heritage House",summary:"Traditional Yoruba-style guest house",property_type:"guest_house",city:"Ibadan",state:"Oyo",country_code:"NG",base_price_per_night:2e4,max_guests:6,bedrooms:3,baths:2,amenities:["WiFi","AC","Garden","Parking"]},{title:"Enugu Hilltop Retreat",summary:"Peaceful hillside retreat with panoramic views",property_type:"lodge",city:"Enugu",state:"Enugu",country_code:"NG",base_price_per_night:3e4,max_guests:4,bedrooms:2,baths:2,amenities:["WiFi","AC","View","Hiking Trail
1019s"]},{title:"Benin City Royal Suite",summary:"Luxury suite near Benin cultural sites",property_type:"hotel",city:"Benin City",state:"Edo",country_code:"NG",base_price_per_night:4e4,max_guests:2,bedrooms:1,baths:1,amenities:["WiFi","AC","Restaurant","Bar"]},{title:"Naija Home Houston",summary:"Nigerian-hosted Airbnb with jollof breakfast",property_type:"apartment",city:"Houston",state:"Texas",country_code:"US",base_price_per_night:55e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","Kitchen","Parking","Nigerian Breakfast"]},{title:"Lagos Vibes Atlanta",summary:"Afro-themed apartment in Decatur",property_type:"apartment",city:"Atlanta",state:"Georgia",country_code:"US",base_price_per_night:5e4,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","Kitchen","Parking"]},{title:"Naija Nest Brooklyn",summary:"Cozy apartment in Nigerian-friendly neighborhood",property_type:"apartment",city:"New York",state:"New York",country_code:"US",base_price_per_night:75e3,max_guests:3,bedrooms:1,baths:1,amenities:["WiFi","AC","Kitchen","Subway Access"]},{title:"African Comfort DMV",summary:"Family-friendly home near DC attractions",property_type:"house",city:"Silver Spring",state:"Maryland",country_code:"US",base_price_per_night:6e4,max_guests:6,bedrooms:3,baths:2,amenities:["WiFi","AC","Kitchen","Parking","Laundry"]},{title:"Naija Lodge London",summary:"Nigerian-owned B&B in Peckham",property_type:"guest_house",city:"London",state:"England",country_code:"GB",base_price_per_night:65e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","Breakfast","Kitchen"]},{title:"African House Birmingham",summary:"Welcoming guest house near city center",property_type:"guest_house",city:"Birmingham",state:"England",country_code:"GB",base_price_per_night:45e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","Breakfast","Parking"]},{title:"Naija Stay Manchester",summary:"Modern apartment with African décor",property_type:"apartment",city:"Manchester",state:"England",country_code:"GB",base_price_per_night:5e4,max_guests:3,bedrooms:1,baths:1,amenities:["WiFi","AC","Kitchen"]},{title:"Nigerian Homestay Toronto",summary:"Home-away-from-home in Scarborough",property_type:"house",city:"Toronto",state:"Ontario",country_code:"CA",base_price_per_night:55e3,max_guests:6,bedrooms:3,baths:2,amenities:["WiFi","Kitchen","Parking","Laundry"]},{title:"Naija Pad Calgary",summary:"Clean modern apartment near downtown",property_type:"apartment",city:"Calgary",state:"Alberta",country_code:"CA",base_price_per_night:45e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","Kitchen","Parking","Gym"]},{title:"Afro Lodge Johannesburg",summary:"Comfortable stay in Sandton area",property_type:"lodge",city:"Johannesburg",state:"Gauteng",country_code:"ZA",base_price_per_night:35e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","Pool","Security"]},{title:"Nigerian Guest House Pretoria",summary:"Warm hospitality with Nigerian cuisine available",property_type:"guest_house",city:"Pretoria",state:"Gauteng",country_code:"ZA",base_price_per_night:3e4,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","Meals Available","Parking"]},{title:"Naija Stay Dublin",summary:"Central apartment with African touches",property_type:"apartment",city:"Dublin",state:"Leinster",country_code:"IE",base_price_per_night:6e4,max_guests:3,bedrooms:1,baths:1,amenities:["WiFi","Kitchen","City Center"]},{title:"Jos Plateau Hilltop",summary:"Cool climate retreat on Jos Plateau",property_type:"lodge",city:"Jos",state:"Plateau",country_code:"NG",base_price_per_night:25e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","Cool Climate","Garden","Parking"]},{title:"Kaduna Modern Flat",summary:"Newly built apartment in Kaduna city center",property_type:"apartment",city:"Kaduna",state:"Kaduna",country_code:"NG",base_price_per_night:2e4,max_guests:3,bedrooms:1,baths:1,amenities:["WiFi","AC","Generator","Security"]},{title:"Uyo Paradise Suite",summary:"Premium suite in Akwa Ibom's capital",property_type:"hotel",city:"Uyo",state:"Akwa Ibom",country_code:"NG",base_price_per_night:35e3,max_guests:2,bedrooms:1,baths:1,amenities:["WiFi","AC","Restaurant","Pool"]},{title:"Warri Riverside Apartment",summary:"Affordable apartment near Warri city center",property_type:"apartment",city:"Warri",state:"Delta",country_code:"NG",base_price_per_night:18e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","Generator"]},{title:"Abeokuta Rock View Lodge",summary:"Scenic lodge near Olumo Rock",property_type:"lodge",city:"Abeokuta",state:"Ogun",country_code:"NG",base_price_per_night:22e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","Rock View","Restaurant"]},{title:"Kano Heritage Inn",summary:"Traditional inn in the ancient city of Kano",property_type:"guest_house",city:"Kano",state:"Kano",country_code:"NG",base_price_per_night:15e3,max_guests:4,bedrooms:2,baths:1,amenities:["WiFi","AC","Cultural Tours"]},{title:"Asaba Executive Shortlet",summary:"Executive shortlet apartment in Asaba",property_type:"apartment",city:"Asaba",state:"Delta",country_code:"NG",base_price_per_night:3e4,max_guests:4,bedrooms:2,baths:2,amenities:["WiFi","AC","Generator","Security","Parking"]},{title:"Owerri Garden Villa",summary:"Beautiful villa with lush gardens",property_type:"villa",city:"Owerri",state:"Imo",country_code:"NG",base_price_per_night:4e4,max_guests:8,bedrooms:4,baths:3,amenities:["WiFi","AC","Garden","Pool","Parking"]}],dGe=[{title:"Lagos City Explorer",description:"3-day tour of Lagos highlights: Lekki Conservation, Nike Art Gallery, Freedom Park & Makoko",duration_days:3,duration_nights:2,price_per_person:75e3,min_group_size:2,max_group_size:12,difficulty_level:"easy",de
1019stinations:["Lagos"],categories:["City Tour","Culture"],country_code:"NG",included_services:["Hotel","Transport","Guide","Meals"]},{title:"Calabar Carnival & Culture",description:"5-day immersive experience during Africa's biggest street party",duration_days:5,duration_nights:4,price_per_person:15e4,min_group_size:4,max_group_size:20,difficulty_level:"easy",destinations:["Calabar","Tinapa"],categories:["Festival","Culture"],country_code:"NG",included_services:["Hotel","Transport","Guide","Carnival Access","Meals"]},{title:"Yankari Wildlife Safari",description:"4-day safari at Yankari Game Reserve with warm springs visit",duration_days:4,duration_nights:3,price_per_person:12e4,min_group_size:4,max_group_size:15,difficulty_level:"moderate",destinations:["Bauchi","Yankari"],categories:["Wildlife","Adventure"],country_code:"NG",included_services:["Lodge","Transport","Safari Guide","Meals"]},{title:"Obudu Mountain Adventure",description:"3-day mountain retreat at Obudu Cattle Ranch",duration_days:3,duration_nights:2,price_per_person:95e3,min_group_size:2,max_group_size:10,difficulty_level:"moderate",destinations:["Obudu","Cross River"],categories:["Adventure","Nature"],country_code:"NG",included_services:["Ranch Accommodation","Cable Car","Hiking Guide","Meals"]},{title:"Benin Kingdom Heritage Tour",description:"2-day exploration of ancient Benin Kingdom artifacts and culture",duration_days:2,duration_nights:1,price_per_person:45e3,min_group_size:2,max_group_size:15,difficulty_level:"easy",destinations:["Benin City"],categories:["History","Culture"],country_code:"NG",included_services:["Hotel","Transport","Museum Access","Guide"]},{title:"Olumo Rock & Abeokuta Tour",description:"Day trip to Olumo Rock and traditional Adire textile markets",duration_days:1,duration_nights:0,price_per_person:25e3,min_group_size:4,max_group_size:20,difficulty_level:"easy",destinations:["Abeokuta"],categories:["History","Culture","Shopping"],country_code:"NG",included_services:["Transport","Guide","Rock Climbing","Lunch"]},{title:"Niger Delta Creek Tour",description:"3-day boat tour through Niger Delta creeks and fishing villages",duration_days:3,duration_nights:2,price_per_person:11e4,min_group_size:4,max_group_size:10,difficulty_level:"moderate",destinations:["Port Harcourt","Bonny Island"],categories:["Adventure","Nature","Culture"],country_code:"NG",included_services:["Boat","Accommodation","Guide","Meals","Safety Gear"]},{title:"Osun-Osogbo Sacred Grove",description:"2-day cultural tour of the UNESCO World Heritage sacred grove",duration_days:2,duration_nights:1,price_per_person:4e4,min_group_size:2,max_group_size:15,difficulty_level:"easy",destinations:["Osogbo"],categories:["UNESCO","Culture","Spirituality"],country_code:"NG",included_services:["Hotel","Transport","Guide","Grove Entry"]},{title:"Jos Plateau Cool Retreat",description:"4-day retreat on Jos Plateau with waterfalls and rock formations",duration_days:4,duration_nights:3,price_per_person:85e3,min_group_size:2,max_group_size:12,difficulty_level:"moderate",destinations:["Jos","Shere Hills"],categories:["Nature","Relaxation"],country_code:"NG",included_services:["Lodge","Transport","Guide","Meals"]},{title:"Abuja Capital Discovery",description:"2-day tour of Nigeria's capital: Aso Rock, National Mosque, Jabi Lake",duration_days:2,duration_nights:1,price_per_person:55e3,min_group_size:2,max_group_size:15,difficulty_level:"easy",destinations:["Abuja"],categories:["City Tour","Architecture"],country_code:"NG",included_services:["Hotel","Transport","Guide","Lunch"]},{title:"Kano Ancient City Tour",description:"3-day exploration of Kano's ancient walls, dye pits and markets",duration_days:3,duration_nights:2,price_per_person:65e3,min_group_size:4,max_group_size:15,difficulty_level:"easy",destinations:["Kano"],categories:["History","Culture","Shopping"],country_code:"NG",included_services:["Hotel","Transport","Guide","Meals"]},{title:"Idanre Hills Expedition",description:"2-day hiking expedition to Idanre Hills with cultural immersion",duration_days:2,duration_nights:1,price_per_person:5e4,min_group_size:4,max_group_size:12,difficulty_level:"challenging",destinations:["Idanre","Ondo"],categories:["Hiking","Adventure","Culture"],country_code:"NG",included_services:["Accommodation","Transport","Guide","Meals","S
1019afety Gear"]},{title:"Lekki-Epe Lagoon Tour",description:"Full day kayaking and nature tour on Lekki Lagoon",duration_days:1,duration_nights:0,price_per_person:2e4,min_group_size:2,max_group_size:10,difficulty_level:"easy",destinations:["Lekki","Epe"],categories:["Water Sports","Nature"],country_code:"NG",included_services:["Kayak","Guide","Lunch","Transport"]},{title:"Sukur Cultural Landscape",description:"3-day UNESCO site tour of Sukur Kingdom terraces",duration_days:3,duration_nights:2,price_per_person:9e4,min_group_size:4,max_group_size:10,difficulty_level:"moderate",destinations:["Madagali","Adamawa"],categories:["UNESCO","History","Hiking"],country_code:"NG",included_services:["Accommodation","Transport","Guide","Meals"]},{title:"Badagry Slave Route Tour",description:"Day trip tracing the historic slave route in Badagry",duration_days:1,duration_nights:0,price_per_person:15e3,min_group_size:4,max_group_size:20,difficulty_level:"easy",destinations:["Badagry"],categories:["History","Education"],country_code:"NG",included_services:["Transport","Guide","Museum Entry","Lunch"]},{title:"Ogbunike Caves Adventure",description:"Day trip to the ancient Ogbunike Caves in Anambra",duration_days:1,duration_nights:0,price_per_person:18e3,min_group_size:4,max_group_size:15,difficulty_level:"moderate",destinations:["Ogbunike"],categories:["Adventure","Nature","Caves"],country_code:"NG",included_services:["Transport","Guide","Cave Entry","Lunch"]},{title:"Erin Ijesha Waterfalls Trek",description:"Day trip to the seven-level Olumirin Waterfalls",duration_days:1,duration_nights:0,price_per_person:22e3,min_group_size:4,max_group_size:15,difficulty_level:"moderate",destinations:["Erin Ijesha","Osun"],categories:["Waterfalls","Hiking","Nature"],country_code:"NG",included_services:["Transport","Guide","Entry Fee","Lunch"]},{title:"Tarkwa Bay Beach Getaway",description:"Weekend beach retreat at Tarkwa Bay Island",duration_days:2,duration_nights:1,price_per_person:35e3,min_group_size:2,max_group_size:10,difficulty_level:"easy",destinations:["Tarkwa Bay","Lagos"],categories:["Beach","Relaxation"],country_code:"NG",included_services:["Boat Transfer","Camping","BBQ","Guide"]},{title:"Cross River Rainforest Expedition",description:"5-day deep forest exploration with primate tracking",duration_days:5,duration_nights:4,price_per_person:2e5,min_group_size:4,max_group_size:8,difficulty_level:"challenging",destinations:["Cross River National Park"],categories:["Wildlife","Adventure","Conservation"],country_code:"NG",included_services:["Forest Lodge","Transport","Expert Guide","Meals","Equipment"]},{title:"Nigerian Food Safari Lagos",description:"Full day food tour across Lagos neighborhoods",duration_days:1,duration_nights:0,price_per_person:3e4,min_group_size:2,max_group_size:8,difficulty_level:"easy",destinations:["Lagos"],categories:["Food","Culture"],country_code:"NG",included_services:["Transport","Guide","Food Tastings","Drinks"]}],uGe=[{business_name:"Wakanow Travel Agency",service_type:"Travel Agencies",description:"Full-service travel agency for flights, hotels & vacation packages",city:"Lagos",state:"Lagos",country_code:"NG",services_offered:["Flight Booking","Hotel Reservations","Visa Processing","Tour Packages"],website_url:"https://www.wakanow.com"},{business_name:"Konga Travel",service_type:"Travel Agencies",description:"Online travel booking platform for Nigerians",city:"Lagos",state:"Lagos",country_code:"NG",services_offered:["Flights","Hotels","Car Rental","Travel Insurance"],website_url:"https://travel.konga.com"},{business_name:"Finchglow Travels",service_type:"Travel Agencies",description:"Premium travel management company",city:"Lagos",state:"Lagos",country_code:"NG",services_offered:["Corporate Travel","Leisure Travel","Visa Services","MICE"],website_url:"https://www.finchglow.com"}
1019,{business_name:"Abuja Visa Services",service_type:"Others",description:"Expert visa processing for all countries",city:"Abuja",state:"FCT",country_code:"NG",services_offered:["US Visa","UK Visa","Schengen Visa","Canada Visa","Document Preparation"]},{business_name:"PH Express Travels",service_type:"Travel Agencies",description:"Port Harcourt's leading travel agency",city:"Port Harcourt",state:"Rivers",country_code:"NG",services_offered:["Flights","Hotels","Visa Processing","Travel Insurance"]},{business_name:"Naija Cargo Express",service_type:"Others",description:"Door-to-door cargo shipping Nigeria to worldwide",city:"Lagos",state:"Lagos",country_code:"NG",services_offered:["Sea Freight","Air Freight","Door-to-Door","Customs Clearance"]},{business_name:"Zenith Cargo Services",service_type:"Others",description:"Reliable cargo shipping between Nigeria and diaspora",city:"Lagos",state:"Lagos",country_code:"NG",services_offered:["UK Shipping","US Shipping","Canada Shipping","Warehouse"]},{business_name:"diaspora Travel Houston",service_type:"Travel Agencies",description:"Nigerian-owned travel agency serving the Houston diaspora",city:"Houston",state:"Texas",country_code:"US",services_offered:["Nigeria Flights","Group Travel","Visa Assistance","Hotel Booking"]},{business_name:"Naija Express Cargo Atlanta",service_type:"Others",description:"Ship goods from Atlanta to Nigeria quickly & safely",city:"Atlanta",state:"Georgia",country_code:"US",services_offered:["Door-to-Door","Sea Freight","Air Freight","Personal Effects"]},{business_name:"African Travel Bureau London",service_type:"Travel Agencies",description:"Specialist in Nigeria & West Africa travel",city:"London",state:"England",country_code:"GB",services_offered:["Nigeria Flights","West Africa Tours","Visa Services","Corporate Travel"]},{business_name:"Naija Barrel London",service_type:"Others",description:"Send barrels and cargo from UK to Nigeria",city:"London",state:"England",country_code:"GB",services_offered:["Barrel Shipping","Personal Effects","Commercial Cargo","Tracking"]},{business_name:"Toronto Naija Travel",service_type:"Travel Agencies",description:"Nigerian travel specialist in the GTA",city:"Toronto",state:"Ontario",country_code:"CA",services_offered:["Flights","Hotels","Visa Services","Group Tours"]},{business_name:"Naija Shipping Toronto",service_type:"Others",description:"Cargo shipping from Canada to Nigeria",city:"Toronto",state:"Ontario",country_code:"CA",services_offered:["Sea Freight","Air Freight","Personal Goods","Commercial Cargo"]},{business_name:"Safari Connections Johannesburg",service_type:"Tour Operators",description:"Nigerian-operated safari and tour company in South Africa",city:"Johannesburg",state:"Gauteng",country_code:"ZA",services_offered:["Safari Tours","City Tours","Airport Transfers","Hotel Booking"]},{business_name:"Ibadan Express Travels",service_type:"Travel Agencies",description:"Affordable travel services in Ibadan",city:"Ibadan",state:"Oyo",country_code:"NG",services_offered:["Flights","Hotels","Visa Processing","Road Transport"]},{business_name:"Calabar Tourism Services",service_type:"Tour Operators",description:"Local tour operator for Cross River State attractions",city:"Calabar",state:"Cross River",country_code:"NG",services_offered:["Carnival Packages","Obudu Tours","Tinapa Tours","Local Guides"]},{business_name:"Kano Travel Hub",service_type:"Travel Agencies",description:"Northern Nigeria's premier travel agency",city:"Kano",state:"Kano",country_code:"NG",services_offered:["Flights","Hajj & Umrah","Hotels","Visa Processing"]},{business_name:"DMV African Travel",service_type:"Travel Agencies",description:"DC-Maryland-Virginia African travel specialist",city:"Silver Spring",state:"Maryland",country_code:"US",services_offered:["Nigeria Flights","Ghana Flights","Group Travel","Visa Assistance"]},{business_name:"Naija Moves Dallas",service_type:"Travel Agencies",description:"Texas-based Nigerian travel agency",city:"Dallas",state:"Texas",country_code:"US",services_offered:["Flights","Hotels","Group Travel","Event Planning"]},{business_name:"African Cargo Manchester",service_type:"Others",description:"Cargo and personal effects shipping to West Africa",city:"Manchester",state:"England",country_code:"GB",services_offered:["Sea Freight","Air Freight","Barrel Shipping","Tracking"]}],hGe=[{title:"Lagos Executive Car Hire",description:"Premium car rental with driver for Lagos business travelers",city:"Lagos",state:"Lagos",country_code:"NG",listing_type:"sedan",make:"Toyota",model:"Camry",year:2023,daily_rate:35e3,features:["AC","Driver","GPS","Airport Pickup"]}
1019,{title:"Lekki SUV Rentals",description:"SUVs and luxury vehicles for Lekki & Island areas",city:"Lagos",state:"Lagos",country_code:"NG",listing_type:"suv",make:"Toyota",model:"Highlander",year:2022,daily_rate:55e3,features:["AC","Driver","GPS","Fuel Included"]},{title:"Abuja Government Area Rides",description:"Reliable car hire for Abuja city & surroundings",city:"Abuja",state:"FCT",country_code:"NG",listing_type:"sedan",make:"Honda",model:"Accord",year:2022,daily_rate:3e4,features:["AC","Driver","GPS"]},{title:"Abuja Luxury Fleet",description:"Luxury vehicles for VIP transport in the capital",city:"Abuja",state:"FCT",country_code:"NG",listing_type:"luxury",make:"Mercedes-Benz",model:"E-Class",year:2023,daily_rate:8e4,features:["AC","Chauffeur","WiFi","Refreshments"]},{title:"PH City Wheels",description:"Affordable car rentals in Port Harcourt",city:"Port Harcourt",state:"Rivers",country_code:"NG",listing_type:"sedan",make:"Toyota",model:"Corolla",year:2021,daily_rate:25e3,features:["AC","Driver","Airport Pickup"]},{title:"Ibadan Budget Rentals",description:"Budget-friendly car hire for Ibadan trips",city:"Ibadan",state:"Oyo",country_code:"NG",listing_type:"sedan",make:"Toyota",model:"Corolla",year:2020,daily_rate:18e3,features:["AC","GPS"]},{title:"Enugu Hills Car Rental",description:"Car rental service for Enugu and surrounding areas",city:"Enugu",state:"Enugu",country_code:"NG",listing_type:"suv",make:"Hyundai",model:"Santa Fe",year:2022,daily_rate:35e3,features:["AC","Driver","GPS","Hill Terrain"]},{title:"Calabar Tour Vehicles",description:"Vehicles for Calabar carnival and tourism",city:"Calabar",state:"Cross River",country_code:"NG",listing_type:"minibus",make:"Toyota",model:"HiAce",year:2021,daily_rate:45e3,features:["AC","Driver","12 Seats","Tour Guide Available"]},{title:"Lagos Airport Express",description:"Airport pickup and drop-off service at MMIA",city:"Lagos",state:"Lagos",country_code:"NG",listing_type:"sedan",make:"Toyota",model:"Camry",year:2023,daily_rate:2e4,features:["AC","Driver","Flight Tracking","Meet & Greet"]},{title:"Kano City Rides",description:"Car rental for Kano city exploration",city:"Kano",state:"Kano",country_code:"NG",listing_type:"sedan",make:"Toyota",model:"Corolla",year:2021,daily_rate:2e4,features:["AC","Driver","GPS"]},{title:"Benin City Auto Rental",description:"Reliable vehicles for Benin City and Edo State",city:"Benin City",state:"Edo",country_code:"NG",listing_type:"suv",make:"Toyota",model:"RAV4",year:2022,daily_rate:3e4,features:["AC","Driver","GPS"]},{title:"Jos Plateau Explorer",description:"Rugged vehicles for Jos Plateau adventures",city:"Jos",state:"Plateau",country_code:"NG",listing_type:"suv",make:"Mitsubishi",model:"Pajero",year:2021,daily_rate:4e4,features:["4WD","AC","Driver","Terrain Ready"]},{title:"Uyo City Car Hire",description:"Clean comfortable cars in Akwa Ibom capital",city:"Uyo",state:"Akwa Ibom",country_code:"NG",listing_type:"sedan",make:"Honda",model:"Civic",year:2022,daily_rate:22e3,features:["AC","Driver","GPS"]},{title:"Warri Delta Wheels",description:"Car rental for Warri and Delta State travel",city:"Warri",state:"Delta",country_code:"NG",listing_type:"sedan",make:"Toyota",model:"Camry",year:2021,daily_rate:22e3,features:["AC","Driver","Interstate Travel"]},{title:"Kaduna Express Rides",description:"Car hire for Kaduna city and northern travel",city:"Kaduna",state:"Kaduna",country_code:"NG",listing_type:"sedan",make:"Toyota",model:"Corolla",year:2021,daily_rate:2e4,features:["AC","Driver","GPS"]},{title:"Abeokuta Heritage Rides",description:"Tour vehicles near Olumo Rock attractions",city:"Abeokuta",state:"Ogun",country_code:"NG",listing_type:"minibus",make:"Toyota",model:"HiAce",year:2020,daily_rate:35e3,features:["AC","Driver","Tour Guide","10 Seats"]},{title:"Asaba Bridge City Cars",description:"Car rental connecting Asaba and Onitsha",city:"Asaba",state:"Delta",country_code:"NG",listing_type:"sedan",make:"Honda",model:"Accord",year:2022,daily_rate:25e3,features:["AC","Driver","Interstate"]},{title:"Owerri Event Cars",description:"Luxury and regular cars for Imo State events",city:"Owerri",state:"Imo",country_code:"NG",listing_type:"luxury",make:"Mercedes-Benz",model:"C-Class",year:2022,daily_rate:6e4,features:["AC","Chauffeur","Event Ready"]},{title:"Lagos Bus Charter",description:"Mini-bus and coaster charter for group travel",city:"Lagos",state:"Lagos",country_code:"NG",listing_type:"bus",make:"Toyota",model:"Coaster",year:2022,daily_rate:75e3,features:["AC","Driver","30 Seats","Long Distance"]},{title:"Sokoto Desert Cruiser",description:"Vehicles for Sokoto and northwest Nigeria travel",city:"Sokoto",state:"Sokoto",country_code:"NG",listing_type:"suv",make:"Toyota",model:"Land Cruiser",year:2021,daily_rate:5e4,features:["4WD","AC","Driver","Desert Ready"]}],fGe={artisans:{data:lGe,label:"Artisans"},properties:{data:cGe,label:"Properties"},tour_packages:{data:dGe,label:"Tour Packages"},travel_services:{data:uGe,label:"Travel Services"},rental_cars:{data:hGe,label:"Rental Cars"}};function Py({tableName:e}){const[t,n]=j.useState(!1),s=fGe[e],a=async()=>{n(!0);try{const{data:i,error:o}=await H.functions.invoke("seed-listings",{body:{table:e,listings:s.data}});if(o)throw o;be({title:`${s.label} seeded!`,description:`${i.inserted} listings added successfully.`})}catch(i){be({title:"Seeding failed",description:i.message||"Failed to seed listings",variant:"destructive"})}finally{n(!1)}};return r.jsxs(W,{variant:"outline",size:"sm",onClick:a,disabled:t,className:"gap-2",children:[t?r.jsx(yt,{className:"h-4 w-4 animate-spin"}):r.jsx(AT,{className:"h-4 w-4"}),"Seed ",s.label," (",s.data.length,")"]})}var A5="Collapsible",[mGe,GJe]=ea(A5),[pGe,SL]=mGe(A5),Kee=j.forwardRef((e,t)=>
1019{const{__scopeCollapsible:n,open:s,defaultOpen:a,disabled:i,onOpenChange:o,...l}=e,[c,d]=Fo({prop:s,defaultProp:a??!1,onChange:o,caller:A5});return r.jsx(pGe,{scope:n,disabled:i,contentId:ul(),open:c,onOpenToggle:j.useCallback(()=>d(u=>!u),[d]),children:r.jsx(Lt.div,{"data-state":CL(c),"data-disabled":i?"":void 0,...l,ref:t})})});Kee.displayName=A5;var Xee="CollapsibleTrigger",Zee=j.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,a=SL(Xee,n);return r.jsx(Lt.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":CL(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...s,ref:t,onClick:dt(e.onClick,a.onOpenToggle)})});Zee.displayName=Xee;var kL="CollapsibleContent",Jee=j.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=SL(kL,e.__scopeCollapsible);return r.jsx(hi,{present:n||a.open,children:({present:i})=>r.jsx(gGe,{...s,ref:t,present:i})})});Jee.displayName=kL;var gGe=j.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:a,...i}=e,o=SL(kL,n),[l,c]=j.useState(s),d=j.useRef(null),u=gr(t,d),h=j.useRef(0),f=h.current,m=j.useRef(0),x=m.current,p=o.open||l,v=j.useRef(p),g=j.useRef(void 0);return j.useEffect(()=>{const y=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(y)},[]),Hs(()=>{const y=d.current;if(y){g.current=g.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const b=y.getBoundingClientRect();h.current=b.height,m.current=b.width,v.current||(y.style.transitionDuration=g.current.transitionDuration,y.style.animationName=g.current.animationName),c(s)}},[o.open,s]),r.jsx(Lt.div,{"data-state":CL(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:p&&a})});function CL(e){return e?"open":"closed"}var xGe=Kee;const vGe=xGe,yGe=Zee,bGe=Jee,jGe={hello:"How far?",good_morning:"Morning o",good_afternoon:"Afternoon o",good_evening:"Evening o",how_are_you:"How you dey?",thank_you:"Thank you well well",welcome:"Welcome o!",yes:"Yes o",no:"No wahala",okay:"E don do",please:"Abeg",sorry:"Sorry o",buy:"Buy",sell:"Sell",price:"How much?",cheap:"E cheap",expensive:"E cost",bargain:"Make we settle",contact:"Call am",message:"Send message",view:"Check am",search:"Find am",filter:"Sort out",available:"E dey available",sold_out:"E don finish",featured:"Top seller",new:"Fresh",loading:"Wait small...",home:"Home",marketplace:"Market",dashboard:"Your space",profile:"Your details",settings:"Setup"};function En(e){"@babel/helpers - typeof";return En=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},En(e)}var lc=Uint8Array,Po=Uint16Array,AL=Int32Array,PL=new lc([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]),EL=new lc([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]),gB=new lc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qee=function(e,t){for(var n=new Po(31),s=0;s<31;++s)n[s]=t+=1<<e[s-1];for(var a=new AL(n[30]),s=1;s<30;++s)for(var i=n[s];i<n[s+1];++i)a[i]=i-n[s]<<5|s;return{b:n,r:a}},ete=Qee(PL,2),wGe=ete.b,hE=ete.r;wGe[28]=258,hE[258]=28;var NGe=Qee(EL,0),xB=NGe.r,fE=new Po(32768);for(var ls=0;ls<32768;++ls){var Iu=(ls&43690)>>1|(ls&21845)<<1;Iu=(Iu&52428)>>2|(Iu&13107)<<2,Iu=(Iu&61680)>>4|(Iu&3855)<<4,fE[ls]=((Iu&65280)>>8|(Iu&255)<<8)>>1}var g0=function(e,t,n){for(var s=e.length,a=0,i=new Po(t);a<s;++a)e[a]&&++i[e[a]-1];var o=new Po(t);for(a=1;a<t;++a)o[a]=o[a-1]+i[a-1]<<1;var l;if(n){l=new Po(1<<t);var c=15-t;for(a=0;a<s;++a)if(e[a])for(var d=a<<4|e[a],u=t-e[a],h=o[e[a]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)l[fE[h]>>c]=d}else for(l=new Po(s),a=0;a<s;++a)e[a]&&(l[a]=fE[o[e[a]-1]++]>>15-e[a]);return l},Um=new lc(288);for(var ls=0;ls<144;++ls)Um[ls]=8;for(var ls=144;ls<256;++ls)Um[ls]=9;for(var ls=256;ls<280;++ls)Um[ls]=7;for(var ls=280;ls<288;++ls)Um[ls]=8;var y2=new lc(32);for(var ls=0;ls<32;++ls)y2[ls]=5;var _Ge=g0(Um,9,0),SGe=g0(y2,5,0),tte=function(e){return(e+7)/8|0},kGe=function(e,t,n){return(n==null||n>e.length)&&(n=e.length),new lc(e.subarray(t,n))},_d=function(e,t,n){n<<=t&7;var s=t/8|0;e[s]|=n,e[s+1]|=n>>8},Ey=function(e,t,n){n<<=t&7;var s=t/8|0;e[s]|=n,e[s+1]|=n>>8,e[s+2]|=n>>16},aC=function(e,t){for(var n=[],s=0;s<e.length;++s)e[s]&&n.push({s,f:e[s]});var a=n.length,i=n.slice();if(!a)return{t:nte,l:0};if(a==1){var o=new lc(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(_,C){return _.f-C.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],d=0,u=1,h=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};u!=a-1;)l=n[n[d].f<n[h].f?d++:h++],c=n[d!=u&&n[d].f<n[h].f?d++:h++],n[u++]={s:-1,f:l.f+c.f,l,r:c};for(var f=i[0].s,s=1;s<a;++s)i[s].s>f&&(f=i[s].s);var m=new Po(f+1),x=mE(n[u-1],m,0);if(x>t){var s=0,p=0,v=x-t,g=1<<v;for(i.sort(function(C,E){return m[E.s]-m[C.s]||C.f-E.f});s<a;++s){var y=i[s].s;if(m[y]>t)p+=g-(1<<x-m[y]),m[y]=t;else break}for(p>>=v;p>0;){var b=i[s].s;m[b]<t?p-=1<<t-m[b]++-1:++s}for(;s>=0&&p;--s){var w=i[s].s;m[w]==t&&(--m[w],++p)}x=t}return{t:new lc(m),l:x}}
vendor: 12,339 bytes, lines 1019-1020
1019,mE=function(e,t,n){return e.s==-1?Math.max(mE(e.l,t,n+1),mE(e.r,t,n+1)):t[e.s]=n},vB=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Po(++t),s=0,a=e[0],i=1,o=function(c){n[s++]=c},l=1;l<=t;++l)if(e[l]==a&&l!=t)++i;else{if(!a&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(a),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(a);i=1,a=e[l]}return{c:n.subarray(0,s),n:t}},Ty=function(e,t){for(var n=0,s=0;s<t.length;++s)n+=e[s]*t[s];return n},rte=function(e,t,n){var s=n.length,a=tte(t+2);e[a]=s&255,e[a+1]=s>>8,e[a+2]=e[a]^255,e[a+3]=e[a+1]^255;for(var i=0;i<s;++i)e[a+i+4]=n[i];return(a+4+s)*8},yB=function(e,t,n,s,a,i,o,l,c,d,u){_d(t,u++,n),++a[256];for(var h=aC(a,15),f=h.t,m=h.l,x=aC(i,15),p=x.t,v=x.l,g=vB(f),y=g.c,b=g.n,w=vB(p),_=w.c,C=w.n,E=new Po(19),N=0;N<y.length;++N)++E[y[N]&31];for(var N=0;N<_.length;++N)++E[_[N]&31];for(var k=aC(E,7),I=k.t,P=k.l,O=19;O>4&&!I[gB[O-1]];--O);var A=d+5<<3,R=Ty(a,Um)+Ty(i,y2)+o,L=Ty(a,f)+Ty(i,p)+o+14+3*O+Ty(E,I)+2*E[16]+3*E[17]+7*E[18];if(c>=0&&A<=R&&A<=L)return rte(t,u,e.subarray(c,c+d));var z,U,$,q;if(_d(t,u,1+(L<R)),u+=2,L<R){z=g0(f,m,0),U=f,$=g0(p,v,0),q=p;var ne=g0(I,P,0);_d(t,u,b-257),_d(t,u+5,C-1),_d(t,u+10,O-4),u+=14;for(var N=0;N<O;++N)_d(t,u+3*N,I[gB[N]]);u+=3*O;for(var se=[y,_],F=0;F<2;++F)for(var V=se[F],N=0;N<V.length;++N){var Z=V[N]&31;_d(t,u,ne[Z]),u+=I[Z],Z>15&&(_d(t,u,V[N]>>5&127),u+=V[N]>>12)}}else z=_Ge,U=Um,$=SGe,q=y2;for(var N=0;N<l;++N){var de=s[N];if(de>255){var Z=de>>18&31;Ey(t,u,z[Z+257]),u+=U[Z+257],Z>7&&(_d(t,u,de>>23&31),u+=PL[Z]);var ve=de&31;Ey(t,u,$[ve]),u+=q[ve],ve>3&&(Ey(t,u,de>>5&8191),u+=EL[ve])}else Ey(t,u,z[de]),u+=U[de]}return Ey(t,u,z[256]),u+U[256]},CGe=new AL([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nte=new lc(0),AGe=function(e,t,n,s,a,i){var o=i.z||e.length,l=new lc(s+o+5*(1+Math.ceil(o/7e3))+a),c=l.subarray(s,l.length-a),d=i.l,u=(i.r||0)&7;if(t){u&&(c[0]=i.r>>3);for(var h=CGe[t-1],f=h>>13,m=h&8191,x=(1<<n)-1,p=i.p||new Po(32768),v=i.h||new Po(x+1),g=Math.ceil(n/3),y=2*g,b=function(Ue){return(e[Ue]^e[Ue+1]<<g^e[Ue+2]<<y)&x},w=new AL(25e3),_=new Po(288),C=new Po(32),E=0,N=0,k=i.i||0,I=0,P=i.w||0,O=0;k+2<o;++k){var A=b(k),R=k&32767,L=v[A];if(p[R]=L,v[A]=R,P<=k){var z=o-k;if((E>7e3||I>24576)&&(z>423||!d)){u=yB(e,c,0,w,_,C,N,I,O,k-O,u),I=E=N=0,O=k;for(var U=0;U<286;++U)_[U]=0;for(var U=0;U<30;++U)C[U]=0}var $=2,q=0,ne=m,se=R-L&32767;if(z>2&&A==b(k-se))for(var F=Math.min(f,z)-1,V=Math.min(32767,k),Z=Math.min(258,z);se<=V&&--ne&&R!=L;){if(e[k+$]==e[k+$-se]){for(var de=0;de<Z&&e[k+de]==e[k+de-se];++de);if(de>$){if($=de,q=se,de>F)break;for(var ve=Math.min(se,de-2),pe=0,U=0;U<ve;++U){var _e=k-se+U&32767,xe=p[_e],oe=_e-xe&32767;oe>pe&&(pe=oe,L=_e)}}}R=L,L=p[R],se+=R-L&32767}if(q){w[I++]=268435456|hE[$]<<18|xB[q];var we=hE[$]&31,ce=xB[q]&31;N+=PL[we]+EL[ce],++_[257+we],++C[ce],P=k+$,++E}else w[I++]=e[k],++_[e[k]]}}for(k=Math.max(k,P);k<o;++k)w[I++]=e[k],++_[e[k]];u=yB(e,c,d,w,_,C,N,I,O,k-O,u),d||(i.r=u&7|c[u/8|0]<<3,u-=7,i.h=v,i.p=p,i.i=k,i.w=P)}else{for(var k=i.w||0;k<o+d;k+=65535){var De=k+65535;De>=o&&(c[u/8|0]=d,De=o),u=rte(c,u+1,e.subarray(k,De))}i.i=o}return kGe(l,0,s+tte(u)+a)},ste=function(){var e=1,t=0;return{p:function(n){for(var s=e,a=t,i=n.length|0,o=0;o!=i;){for(var l=Math.min(o+2655,i);o<l;++o)a+=s+=n[o];s=(s&65535)+15*(s>>16),a=(a&65535)+15*(a>>16)}e=s,t=a},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},PGe=function(e,t,n,s,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new lc(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return AGe(e,t.level==null?6:t.level,t.mem==null?a.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,s,a)},ate=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},EGe=function(e,t){var n=t.level,s=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=s<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var a=ste();a.p(t.dictionary),ate(e,2,a.d())}};function pE(e,t){t||(t={});var n=ste();n.p(e);var s=PGe(e,t,t.dictionary?6:2,4);return EGe(s,t),ate(s,s.length-4,n.d()),s}var TGe=typeof TextDecoder<"u"&&new TextDecoder,OGe=0;try{TGe.decode(nte,{stream:!0}),OGe=1}catch{}function LGe(e){if(Array.isArray(e))return e}function IGe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var s,a,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(s=i.call(n)).done)&&(l.push(s.value),l.length!==t);c=!0);}catch(u){d=!0,a=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw a}}return l}}function bB(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function RGe(e,t){if(e){if(typeof e=="string")return bB(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bB(e,t):void 0}}function MGe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 1020In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jB(e,t){return LGe(e)||IGe(e,t)||RGe(e,t)||MGe()}function wB(e,t="utf8"){return new TextDecoder(t).decode(e)}const DGe=new TextEncoder;function $Ge(e){return DGe.encode(e)}const FGe=1024*8,BGe=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),iC={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 TL{constructor(t=FGe,n={}){An(this,"buffer");An(this,"byteLength");An(this,"byteOffset");An(this,"length");An(this,"offset");An(this,"lastWrittenByte");An(this,"littleEndian");An(this,"_data");An(this,"_mark");An(this,"_marks");let s=!1;typeof t=="number"?t=new ArrayBuffer(t):(s=!0,this.lastWrittenByte=t.byteLength);const a=n.offset?n.offset>>>0:0,i=t.byteLength-a;let o=a;(ArrayBuffer.isView(t)||t instanceof TL)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+a),t=t.buffer),s?this.lastWrittenByte=i:this.lastWrittenByte=0,this.buffer=t,this.length=i,this.byteLength=i,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,i),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 s=(this.offset+t)*2,a=new Uint8Array(s);a.set(new Uint8Array(this.buffer)),this.buffer=a.buffer,this.length=s,this.byteLength=s,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,n){const s=iC[n].BYTES_PER_ELEMENT*t,a=this.byteOffset+this.offset,i=this.buffer.slice(a,a+s);if(this.littleEndian===BGe&&n!=="uint8"&&n!=="int8"){const l=new Uint8Array(this.buffer.slice(a,a+s));l.reverse();const c=new iC[n](l.buffer);return this.offset+=s,c.reverse(),c}const o=new iC[n](i);return this.offset+=s,o}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 n="";for(let s=0;s<t;s++)n+=this.readChar();return n}readUtf8(t=1){return wB(this.readBytes(t))}decodeText(t=1,n="utf8"){return wB(this.readBytes(t),n)}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 n=0;n<t.length;n++)this._data.setUint8(this.offset++,t[n]);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 n=0;n<t.length;n++)this.writeUint8(t.charCodeAt(n));return this}writeUtf8(t){return this.writeBytes($Ge(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)}}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const UGe=4,NB=0,_B=1,zGe=2;function Av(e){let t=e.length;for(;--t>=0;)e[t]=0}const qGe=0,ite=1,VGe=2,WGe=3,HGe=258,OL=29,Hj=256,Rb=Hj+1+OL,Rg=30,LL=19,ote=2*Rb+1,Qf=15,oC=16,GGe=7,IL=256,lte=16,cte=17,dte=18,gE=new Uint8Array([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]),oN=new Uint8Array([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]),YGe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ute=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),KGe=512,Od=new Array((Rb+2)*2);Av(Od);const x0=new Array(Rg*2);Av(x0);const Mb=new Array(KGe);Av(Mb);const Db=new Array(HGe-WGe+1);Av(Db);const RL=new Array(OL);Av(RL);const b2=new Array(Rg);Av(b2);function lC(e,t,n,s,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=s,this.max_length=a,this.has_stree=e&&e.length}let hte,fte,mte;function cC(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const pte=e=>e<256?Mb[e]:Mb[256+(e>>>7)],$b=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},Ji=(e,t,n)=>{e.bi_valid>oC-n?(e.bi_buf|=t<<e.bi_valid&65535,$b(e,e.bi_buf),e.bi_buf=t>>oC-e.bi_valid,e.bi_valid+=n-oC):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Rc=(e,t,n)=>{Ji(e,n[t*2],n[t*2+1])},gte=(e,t)=>
vendor: 45,041 bytes, line 1020
1020{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},XGe=e=>{e.bi_valid===16?($b(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},ZGe=(e,t)=>{const n=t.dyn_tree,s=t.max_code,a=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,c=t.stat_desc.max_length;let d,u,h,f,m,x,p=0;for(f=0;f<=Qf;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,d=e.heap_max+1;d<ote;d++)u=e.heap[d],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,p++),n[u*2+1]=f,!(u>s)&&(e.bl_count[f]++,m=0,u>=l&&(m=o[u-l]),x=n[u*2],e.opt_len+=x*(f+m),i&&(e.static_len+=x*(a[u*2+1]+m)));if(p!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,p-=2}while(p>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)h=e.heap[--d],!(h>s)&&(n[h*2+1]!==f&&(e.opt_len+=(f-n[h*2+1])*n[h*2],n[h*2+1]=f),u--)}},xte=(e,t,n)=>{const s=new Array(Qf+1);let a=0,i,o;for(i=1;i<=Qf;i++)a=a+n[i-1]<<1,s[i]=a;for(o=0;o<=t;o++){let l=e[o*2+1];l!==0&&(e[o*2]=gte(s[l]++,l))}},JGe=()=>{let e,t,n,s,a;const i=new Array(Qf+1);for(n=0,s=0;s<OL-1;s++)for(RL[s]=n,e=0;e<1<<gE[s];e++)Db[n++]=s;for(Db[n-1]=s,a=0,s=0;s<16;s++)for(b2[s]=a,e=0;e<1<<oN[s];e++)Mb[a++]=s;for(a>>=7;s<Rg;s++)for(b2[s]=a<<7,e=0;e<1<<oN[s]-7;e++)Mb[256+a++]=s;for(t=0;t<=Qf;t++)i[t]=0;for(e=0;e<=143;)Od[e*2+1]=8,e++,i[8]++;for(;e<=255;)Od[e*2+1]=9,e++,i[9]++;for(;e<=279;)Od[e*2+1]=7,e++,i[7]++;for(;e<=287;)Od[e*2+1]=8,e++,i[8]++;for(xte(Od,Rb+1,i),e=0;e<Rg;e++)x0[e*2+1]=5,x0[e*2]=gte(e,5);hte=new lC(Od,gE,Hj+1,Rb,Qf),fte=new lC(x0,oN,0,Rg,Qf),mte=new lC(new Array(0),YGe,0,LL,GGe)},vte=e=>{let t;for(t=0;t<Rb;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Rg;t++)e.dyn_dtree[t*2]=0;for(t=0;t<LL;t++)e.bl_tree[t*2]=0;e.dyn_ltree[IL*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},yte=e=>{e.bi_valid>8?$b(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},SB=(e,t,n,s)=>{const a=t*2,i=n*2;return e[a]<e[i]||e[a]===e[i]&&s[t]<=s[n]},dC=(e,t,n)=>{const s=e.heap[n];let a=n<<1;for(;a<=e.heap_len&&(a<e.heap_len&&SB(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!SB(t,s,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=s},kB=(e,t,n)=>{let s,a,i=0,o,l;if(e.sym_next!==0)do s=e.pending_buf[e.sym_buf+i++]&255,s+=(e.pending_buf[e.sym_buf+i++]&255)<<8,a=e.pending_buf[e.sym_buf+i++],s===0?Rc(e,a,t):(o=Db[a],Rc(e,o+Hj+1,t),l=gE[o],l!==0&&(a-=RL[o],Ji(e,a,l)),s--,o=pte(s),Rc(e,o,n),l=oN[o],l!==0&&(s-=b2[o],Ji(e,s,l)));while(i<e.sym_next);Rc(e,IL,t)},xE=(e,t)=>{const n=t.dyn_tree,s=t.stat_desc.static_tree,a=t.stat_desc.has_stree,i=t.stat_desc.elems;let o,l,c=-1,d;for(e.heap_len=0,e.heap_max=ote,o=0;o<i;o++)n[o*2]!==0?(e.heap[++e.heap_len]=c=o,e.depth[o]=0):n[o*2+1]=0;for(;e.heap_len<2;)d=e.heap[++e.heap_len]=c<2?++c:0,n[d*2]=1,e.depth[d]=0,e.opt_len--,a&&(e.static_len-=s[d*2+1]);for(t.max_code=c,o=e.heap_len>>1;o>=1;o--)dC(e,n,o);d=i;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],dC(e,n,1),l=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=l,n[d*2]=n[o*2]+n[l*2],e.depth[d]=(e.depth[o]>=e.depth[l]?e.depth[o]:e.depth[l])+1,n[o*2+1]=n[l*2+1]=d,e.heap[1]=d++,dC(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ZGe(e,t),xte(n,c,e.bl_count)},CB=(e,t,n)=>{let s,a=-1,i,o=t[0*2+1],l=0,c=7,d=4;for(o===0&&(c=138,d=3),t[(n+1)*2+1]=65535,s=0;s<=n;s++)i=o,o=t[(s+1)*2+1],!(++l<c&&i===o)&&(l<d?e.bl_tree[i*2]+=l:i!==0?(i!==a&&e.bl_tree[i*2]++,e.bl_tree[lte*2]++):l<=10?e.bl_tree[cte*2]++:e.bl_tree[dte*2]++,l=0,a=i,o===0?(c=138,d=3):i===o?(c=6,d=3):(c=7,d=4))},AB=(e,t,n)=>{let s,a=-1,i,o=t[0*2+1],l=0,c=7,d=4;for(o===0&&(c=138,d=3),s=0;s<=n;s++)if(i=o,o=t[(s+1)*2+1],!(++l<c&&i===o)){if(l<d)do Rc(e,i,e.bl_tree);while(--l!==0);else i!==0?(i!==a&&(Rc(e,i,e.bl_tree),l--),Rc(e,lte,e.bl_tree),Ji(e,l-3,2)):l<=10?(Rc(e,cte,e.bl_tree),Ji(e,l-3,3)):(Rc(e,dte,e.bl_tree),Ji(e,l-11,7));l=0,a=i,o===0?(c=138,d=3):i===o?(c=6,d=3):(c=7,d=4)}},QGe=e=>{let t;for(CB(e,e.dyn_ltree,e.l_desc.max_code),CB(e,e.dyn_dtree,e.d_desc.max_code),xE(e,e.bl_desc),t=LL-1;t>=3&&e.bl_tree[ute[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},eYe=(e,t,n,s)=>{let a;for(Ji(e,t-257,5),Ji(e,n-1,5),Ji(e,s-4,4),a=0;a<s;a++)Ji(e,e.bl_tree[ute[a]*2+1],3);AB(e,e.dyn_ltree,t-1),AB(e,e.dyn_dtree,n-1)},tYe=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return NB;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return _B;for(n=32;n<Hj;n++)if(e.dyn_ltree[n*2]!==0)return _B;return NB};let PB=!1;const rYe=e=>{PB||(JGe(),PB=!0),e.l_desc=new cC(e.dyn_ltree,hte),e.d_desc=new cC(e.dyn_dtree,fte),e.bl_desc=new cC(e.bl_tree,mte),e.bi_buf=0,e.bi_valid=0,vte(e)},bte=(e,t,n,s)=>{Ji(e,(qGe<<1)+(s?1:0),3),yte(e),$b(e,n),$b(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},nYe=e=>{Ji(e,ite<<1,3),Rc(e,IL,Od),XGe(e)},sYe=(e,t,n,s)=>{let a,i,o=0;e.level>0?(e.strm.data_type===zGe&&(e.strm.data_type=tYe(e)),xE(e,e.l_desc),xE(e,e.d_desc),o=QGe(e),a=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=a&&(a=i)):a=i=n+5,n+4<=a&&t!==-1?bte(e,t,n,s):e.strategy===UGe||i===a?(Ji(e,(ite<<1)+(s?1:0),3),kB(e,Od,x0)):(Ji(e,(VGe<<1)+(s?1:0),3),eYe(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),kB(e,e.dyn_ltree,e.dyn_dtree)),vte(e),s&&yte(e)},aYe=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Db[n]+Hj+1)*2]++,e.dyn_dtree[pte(t)*2]++),e.sym_next===e.sym_end);var iYe=rYe,oYe=bte,lYe=sYe,cYe=aYe,dYe=nYe,uYe={_tr_init:iYe,_tr_stored_block:oYe,_tr_flush_block:lYe,_tr_tally:cYe,_tr_align:dYe};const hYe=(e,t,n,s)=>{let a=e&65535|0,i=e>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do a=a+t[s++]|0,i=i+a|0;while(--o);a%=65521,i%=65521}return a|i<<16|0};var Fb=hYe;const fYe=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var s=0;s<8;s++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},mYe=new Uint32Array(fYe()),pYe=(e,t,n,s)=>{const a=mYe,i=s+n;e^=-1;for(let o=s;o<i;o++)e=e>>>8^a[(e^t[o])&255];return e^-1};var wa=pYe,Gx={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"},Gj={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:gYe,_tr_stored_block:vE,_tr_flush_block:xYe,_tr_tally:Sh,_tr_align:vYe}=uYe,{Z_NO_FLUSH:kh,Z_PARTIAL_FLUSH:yYe,Z_FULL_FLUSH:bYe,Z_FINISH:il,Z_BLOCK:EB,Z_OK:$a,Z_STREAM_END:TB,Z_STREAM_ERROR:Xc,Z_DATA_ERROR:jYe,Z_BUF_ERROR:uC,Z_DEFAULT_COMPRESSION:wYe,Z_FILTERED:NYe,Z_HUFFMAN_ONLY:P1,Z_RLE:_Ye,Z_FIXED:SYe,Z_DEFAULT_STRATEGY:kYe,Z_UNKNOWN:CYe,Z_DEFLATED:P5}=Gj,AYe=9,PYe=15,EYe=8,TYe=29,OYe=256,yE=OYe+1+TYe,LYe=30,IYe=19,RYe=2*yE+1,MYe=15,sn=3,ch=258,Zc=ch+sn+1,DYe=32,Yx=42,ML=57,bE=69,jE=73,wE=91,NE=103,em=113,Vy=666,ki=1,Pv=2,zm=3,Ev=4,$Ye=3,tm=(e,t)=>(e.msg=Gx[t],t),OB=e=>e*2-(e>4?9:0),Yu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},FYe=e=>{let t,n,s,a=e.w_size;t=e.hash_size,s=t;do n=e.head[--s],e.head[s]=n>=a?n-a:0;while(--t);t=a,s=t;do n=e.prev[--s],e.prev[s]=n>=a?n-a:0;while(--t)};let BYe=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,Ch=BYe;const jo=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Eo=(e,t)=>{xYe(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,jo(e.strm)},bn=(e,t)=>{e.pending_buf[e.pending++]=t},Oy=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},_E=(e,t,n,s)=>{let a=e.avail_in;return a>s&&(a=s),a===0?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),e.state.wrap===1?e.adler=Fb(e.adler,t,a,n):e.state.wrap===2&&(e.adler=wa(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},jte=(e,t)=>{let n=e.max_chain_length,s=e.strstart,a,i,o=e.prev_length,l=e.nice_match;const c=e.strstart>e.w_size-Zc?e.strstart-(e.w_size-Zc):0,d=e.window,u=e.w_mask,h=e.prev,f=e.strstart+ch;let m=d[s+o-1],x=d[s+o];e.prev_length>=e.good_match&&(n>>=2),l>e.lookahead&&(l=e.lookahead);do if(a=t,!(d[a+o]!==x||d[a+o-1]!==m||d[a]!==d[s]||d[++a]!==d[s+1])){s+=2,a++;do;while(d[++s]===d[++a]&&d[++s]===d[++a]&&d[++s]===d[++a]&&d[++s]===d[++a]&&d[++s]===d[++a]&&d[++s]===d[++a]&&d[++s]===d[++a]&&d[++s]===d[++a]&&s<f);if(i=ch-(f-s),s=f-ch,i>o){if(e.match_start=t,o=i,i>=l)break;m=d[s+o-1],x=d[s+o]}}while((t=h[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead},Kx=e=>{const t=e.w_size;let n,s,a;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Zc)&&(e.window.set(e.window.subarray(t,t+t-s),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),FYe(e),s+=t),e.strm.avail_in===0)break;if(n=_E(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=n,e.lookahead+e.insert>=sn)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=Ch(e,e.ins_h,e.window[a+1]);e.insert&&(e.ins_h=Ch(e,e.ins_h,e.window[a+sn-1]),e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<sn)););}while(e.lookahead<Zc&&e.strm.avail_in!==0)},wte=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s,a,i,o=0,l=e.strm.avail_in;do{if(s=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i||(i=e.strm.avail_out-i,a=e.strstart-e.block_start,s>a+e.strm.avail_in&&(s=a+e.strm.avail_in),s>i&&(s=i),s<n&&(s===0&&t!==il||t===kh||s!==a+e.strm.avail_in)))break;o=t===il&&s===a+e.strm.avail_in?1:0,vE(e,0,0,o),e.pending_buf[e.pending-4]=s,e.pending_buf[e.pending-3]=s>>8,e.pending_buf[e.pending-2]=~s,e.pending_buf[e.pending-1]=~s>>8,jo(e.strm),a&&(a>s&&(a=s),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+a),e.strm.next_out),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a,e.block_start+=a,s-=a),s&&(_E(e.strm,e.strm.output,e.strm.next_out,s),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s)}while(o===0);return l-=e.strm.avail_in,l&&(l>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=l&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-l,e.strm.next_in),e.strstart),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?Ev:t!==kh&&t!==il&&e.strm.avail_in===0&&e.strstart===e.block_start?Pv:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(_E(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,n=i>e.w_size?e.w_size:i,a=e.strstart-e.block_start,(a>=n||(a||t===il)&&t!==kh&&e.strm.avail_in===0&&a<=i)&&(s=a>i?i:a,o=t===il&&e.strm.avail_in===0&&s===a?1:0,vE(e,e.block_start,s,o),e.block_start+=s,jo(e.strm)),o?zm:ki)},hC=(e,t)=>{let n,s;for(;;){if(e.lookahead<Zc){if(Kx(e),e.lookahead<Zc&&t===kh)return ki;if(e.lookahead===0)break}if(n=0,e.lookahead>=sn&&(e.ins_h=Ch(e,e.ins_h,e.window[e.strstart+sn-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Zc&&(e.match_length=jte(e,n)),e.match_length>=sn)if(s=Sh(e,e.strstart-e.match_start,e.match_length-sn),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=sn){e.match_length--;do e.strstart++,e.ins_h=Ch(e,e.ins_h,e.window[e.strstart+sn-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Ch(e,e.ins_h,e.window[e.strstart+1]);else s=Sh(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(Eo(e,!1),e.strm.avail_out===0))return ki}return e.insert=e.strstart<sn-1?e.strstart:sn-1,t===il?(Eo(e,!0),e.strm.avail_out===0?zm:Ev):e.sym_next&&(Eo(e,!1),e.strm.avail_out===0)?ki:Pv},Wp=(e,t)=>{let n,s,a;for(;;){if(e.lookahead<Zc){if(Kx(e),e.lookahead<Zc&&t===kh)return ki;if(e.lookahead===0)break}if(n=0,e.lookahead>=sn&&(e.ins_h=Ch(e,e.ins_h,e.window[e.strstart+sn-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=sn-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Zc&&(e.match_length=jte(e,n),e.match_length<=5&&(e.strategy===NYe||e.match_length===sn&&e.strstart-e.match_start>4096)&&(e.match_length=sn-1)),e.prev_length>=sn&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-sn,s=Sh(e,e.strstart-1-e.prev_match,e.prev_length-sn),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=a&&(e.ins_h=Ch(e,e.ins_h,e.window[e.strstart+sn-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=sn-1,e.strstart++,s&&(Eo(e,!1),e.strm.avail_out===0))return ki}else if(e.match_available){if(s=Sh(e,0,e.window[e.strstart-1]),s&&Eo(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ki}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=Sh(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<sn-1?e.strstart:sn-1,t===il?(Eo(e,!0),e.strm.avail_out===0?zm:Ev):e.sym_next&&(Eo(e,!1),e.strm.avail_out===0)?ki:Pv},UYe=(e,t)=>{let n,s,a,i;const o=e.window;for(;;){if(e.lookahead<=ch){if(Kx(e),e.lookahead<=ch&&t===kh)return ki;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=sn&&e.strstart>0&&(a=e.strstart-1,s=o[a],s===o[++a]&&s===o[++a]&&s===o[++a])){i=e.strstart+ch;do;while(s===o[++a]&&s===o[++a]&&s===o[++a]&&s===o[++a]&&s===o[++a]&&s===o[++a]&&s===o[++a]&&s===o[++a]&&a<i);e.match_length=ch-(i-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=sn?(n=Sh(e,1,e.match_length-sn),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Sh(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Eo(e,!1),e.strm.avail_out===0))return ki}return e.insert=0,t===il?(Eo(e,!0),e.strm.avail_out===0?zm:Ev):e.sym_next&&(Eo(e,!1),e.strm.avail_out===0)?ki:Pv},zYe=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Kx(e),e.lookahead===0)){if(t===kh)return ki;break}if(e.match_length=0,n=Sh(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Eo(e,!1),e.strm.avail_out===0))return ki}return e.insert=0,t===il?(Eo(e,!0),e.strm.avail_out===0?zm:Ev):e.sym_next&&(Eo(e,!1),e.strm.avail_out===0)?ki:Pv};function kc(e,t,n,s,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=s,this.func=a}const Wy=[new kc(0,0,0,0,wte),new kc(4,4,8,4,hC),new kc(4,5,16,8,hC),new kc(4,6,32,32,hC),new kc(4,4,16,16,Wp),new kc(8,16,32,32,Wp),new kc(8,16,128,128,Wp),new kc(8,32,128,256,Wp),new kc(32,128,258,1024,Wp),new kc(32,258,258,4096,Wp)],qYe=e=>{e.window_size=2*e.w_size,Yu(e.head),e.max_lazy_match=Wy[e.level].max_lazy,e.good_match=Wy[e.level].good_length,e.nice_match=Wy[e.level].nice_length,e.max_chain_length=Wy[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=sn-1,e.match_available=0,e.ins_h=0};function VYe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=P5,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(RYe*2),this.dyn_dtree=new Uint16Array((2*LYe+1)*2),this.bl_tree=new Uint16Array((2*IYe+1)*2),Yu(this.dyn_ltree),Yu(this.dyn_dtree),Yu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(MYe+1),this.heap=new Uint16Array(2*yE+1),Yu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*yE+1),Yu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Yj=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Yx&&t.status!==ML&&t.status!==bE&&t.status!==jE&&t.status!==wE&&t.status!==NE&&t.status!==em&&t.status!==Vy?1:0},Nte=e=>{if(Yj(e))return tm(e,Xc);e.total_in=e.total_out=0,e.data_type=CYe;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?ML:t.wrap?Yx:em,e.adler=t.wrap===2?0:1,t.last_flush=-2,gYe(t),$a},_te=e=>{const t=Nte(e);return t===$a&&qYe(e.state),t},WYe=(e,t)=>Yj(e)||e.state.wrap!==2?Xc:(e.state.gzhead=t,$a),Ste=(e,t,n,s,a,i)=>{if(!e)return Xc;let o=1;if(t===wYe&&(t=6),s<0?(o=0,s=-s):s>15&&(o=2,s-=16),a<1||a>AYe||n!==P5||s<8||s>15||t<0||t>9||i<0||i>SYe||s===8&&o!==1)return tm(e,Xc);s===8&&(s=9);const l=new VYe;return e.state=l,l.strm=e,l.status=Yx,l.wrap=o,l.gzhead=null,l.w_bits=s,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=a+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+sn-1)/sn),l.window=new Uint8Array(l.w_size*2),l.head=new Uint16Array(l.hash_size),l.prev=new Uint16Array(l.w_size),l.lit_bufsize=1<<a+6,l.pending_buf_size=l.lit_bufsize*4,l.pending_buf=new Uint8Array(l.pending_buf_size),l.sym_buf=l.lit_bufsize,l.sym_end=(l.lit_bufsize-1)*3,l.level=t,l.strategy=i,l.method=n,_te(e)},HYe=(e,t)=>Ste(e,t,P5,PYe,EYe,kYe),GYe=(e,t)=>{if(Yj(e)||t>EB||t<0)return e?tm(e,Xc):Xc;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Vy&&t!==il)return tm(e,e.avail_out===0?uC:Xc);const s=n.last_flush;if(n.last_flush=t,n.pending!==0){if(jo(e),e.avail_out===0)return n.last_flush=-1,$a}else if(e.avail_in===0&&OB(t)<=OB(s)&&t!==il)return tm(e,uC);if(n.status===Vy&&e.avail_in!==0)return tm(e,uC);if(n.status===Yx&&n.wrap===0&&(n.status=em),n.status===Yx){let a=P5+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=P1||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,a|=i<<6,n.strstart!==0&&(a|=DYe),a+=31-a%31,Oy(n,a),n.strstart!==0&&(Oy(n,e.adler>>>16),Oy(n,e.adler&65535)),e.adler=1,n.status=em,jo(e),n.pending!==0)return n.last_flush=-1,$a}if(n.status===ML){if(e.adler=0,bn(n,31),bn(n,139),bn(n,8),n.gzhead)bn(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),bn(n,n.gzhead.time&255),bn(n,n.gzhead.time>>8&255),bn(n,n.gzhead.time>>16&255),bn(n,n.gzhead.time>>24&255),bn(n,n.level===9?2:n.strategy>=P1||n.level<2?4:0),bn(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(bn(n,n.gzhead.extra.length&255),bn(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=wa(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=bE;else if(bn(n,0),bn(n,0),bn(n,0),bn(n,0),bn(n,0),bn(n,n.level===9?2:n.strategy>=P1||n.level<2?4:0),bn(n,$Ye),n.status=em,jo(e),n.pending!==0)return n.last_flush=-1,$a}if(n.status===bE){if(n.gzhead.extra){let a=n.pending,i=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let l=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>a&&(e.adler=wa(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex+=l,jo(e),n.pending!==0)return n.last_flush=-1,$a;a=0,i-=l}let o=new Uint8Array(n.gzhead.extra);n.pending_buf.set(o.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>a&&(e.adler=wa(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex=0}n.status=jE}if(n.status===jE){if(n.gzhead.name){let a=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>a&&(e.adler=wa(e.adler,n.pending_buf,n.pending-a,a)),jo(e),n.pending!==0)return n.last_flush=-1,$a;a=0}n.gzindex<n.gzhead.name.length?i=n.gzhead.name.charCodeAt(n.gzindex++)&255:i=0,bn(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>a&&(e.adler=wa(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex=0}n.status=wE}if(n.status===wE){if(n.gzhead.comment){let a=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>a&&(e.adler=wa(e.adler,n.pending_buf,n.pending-a,a)),jo(e),n.pending!==0)return n.last_flush=-1,$a;a=0}n.gzindex<n.gzhead.comment.length?i=n.gzhead.comment.charCodeAt(n.gzindex++)&255:i=0,bn(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>a&&(e.adler=wa(e.adler,n.pending_buf,n.pending-a,a))}n.status=NE}if(n.status===NE){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(jo(e),n.pending!==0))return n.last_flush=-1,$a;bn(n,e.adler&255),bn(n,e.adler>>8&255),e.adler=0}if(n.status=em,jo(e),n.pending!==0)return n.last_flush=-1,$a}if(e.avail_in!==0||n.lookahead!==0||t!==kh&&n.status!==Vy){let a=n.level===0?wte(n,t):n.strategy===P1?zYe(n,t):n.strategy===_Ye?UYe(n,t):Wy[n.level].func(n,t);if((a===zm||a===Ev)&&(n.status=Vy),a===ki||a===zm)return e.avail_out===0&&(n.last_flush=-1),$a;if(a===Pv&&(t===yYe?vYe(n):t!==EB&&(vE(n,0,0,!1),t===bYe&&(Yu(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),jo(e),e.avail_out===0))return n.last_flush=-1,$a}return t!==il?$a:n.wrap<=0?TB:(n.wrap===2?(bn(n,e.adler&255),bn(n,e.adler>>8&255),bn(n,e.adler>>16&255),bn(n,e.adler>>24&255),bn(n,e.total_in&255),bn(n,e.total_in>>8&255),bn(n,e.total_in>>16&255),bn(n,e.total_in>>24&255)):(Oy(n,e.adler>>>16),Oy(n,e.adler&65535)),jo(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?$a:TB)},YYe=e=>{if(Yj(e))return Xc;const t=e.state.status;return e.state=null,t===em?tm(e,jYe):$a},KYe=(e,t)=>{let n=t.length;if(Yj(e))return Xc;const s=e.state,a=s.wrap;if(a===2||a===1&&s.status!==Yx||s.lookahead)return Xc;if(a===1&&(e.adler=Fb(e.adler,t,n,0)),s.wrap=0,n>=s.w_size){a===0&&(Yu(s.head),s.strstart=0,s.block_start=0,s.insert=0);let c=new Uint8Array(s.w_size);c.set(t.subarray(n-s.w_size,n),0),t=c,n=s.w_size}const i=e.avail_in,o=e.next_in,l=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Kx(s);s.lookahead>=sn;){let c=s.strstart,d=s.lookahead-(sn-1);do s.ins_h=Ch(s,s.ins_h,s.window[c+sn-1]),s.prev[c&s.w_mask]=s.head[s.ins_h],s.head[s.ins_h]=c,c++;while(--d);s.strstart=c,s.lookahead=sn-1,Kx(s)}return s.strstart+=s.lookahead,s.block_start=s.strstart,s.insert=s.lookahead,s.lookahead=0,s.match_length=s.prev_length=sn-1,s.match_available=0,e.next_in=o,e.input=l,e.avail_in=i,s.wrap=a,$a};var XYe=HYe,ZYe=Ste,JYe=_te,QYe=Nte,eKe=WYe,tKe=GYe,rKe=YYe,nKe=KYe,sKe="pako deflate (from Nodeca project)",v0={deflateInit:XYe,deflateInit2:ZYe,deflateReset:JYe,deflateResetKeep:QYe,deflateSetHeader:eKe,deflate:tKe,deflateEnd:rKe,deflateSetDictionary:nKe,deflateInfo:sKe};const aKe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var iKe=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const s in n)aKe(n,s)&&(e[s]=n[s])}}return e},oKe=e=>{let t=0;for(let s=0,a=e.length;s<a;s++)t+=e[s].length;const n=new Uint8Array(t);for(let s=0,a=0,i=e.length;s<i;s++){let o=e[s];n.set(o,a),a+=o.length}return n},E5={assign:iKe,flattenChunks:oKe};let kte=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{kte=!1}const Bb=new Uint8Array(256);for(let e=0;e<256;e++)Bb[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Bb[254]=Bb[254]=1;var lKe=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,s,a,i,o=e.length,l=0;for(a=0;a<o;a++)n=e.charCodeAt(a),(n&64512)===55296&&a+1<o&&(s=e.charCodeAt(a+1),(s&64512)===56320&&(n=65536+(n-55296<<10)+(s-56320),a++)),l+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(l),i=0,a=0;i<l;a++)n=e.charCodeAt(a),(n&64512)===55296&&a+1<o&&(s=e.charCodeAt(a+1),(s&64512)===56320&&(n=65536+(n-55296<<10)+(s-56320),a++)),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|n&63):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|n&63):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|n&63);return t};const cKe=(e,t)=>{if(t<65534&&e.subarray&&kte)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let s=0;s<t;s++)n+=String.fromCharCode(e[s]);return n};var dKe=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let s,a;const i=new Array(n*2);for(a=0,s=0;s<n;){let o=e[s++];if(o<128){i[a++]=o;continue}let l=Bb[o];if(l>4){i[a++]=65533,s+=l-1;continue}for(o&=l===2?31:l===3?15:7;l>1&&s<n;)o=o<<6|e[s++]&63,l--;if(l>1){i[a++]=65533;continue}o<65536?i[a++]=o:(o-=65536,i[a++]=55296|o>>10&1023,i[a++]=56320|o&1023)}return cKe(i,a)},uKe=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+Bb[e[n]]>t?n:t},Ub={string2buf:lKe,buf2string:dKe,utf8border:uKe};function hKe(){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 Cte=hKe;const Ate=Object.prototype.toString,{Z_NO_FLUSH:fKe,Z_SYNC_FLUSH:mKe,Z_FULL_FLUSH:pKe,Z_FINISH:gKe,Z_OK:j2,Z_STREAM_END:xKe,Z_DEFAULT_COMPRESSION:vKe,Z_DEFAULT_STRATEGY:yKe,Z_DEFLATED:bKe}=Gj;function DL(e){this.options=E5.assign({level:vKe,method:bKe,chunkSize:16384,windowBits:15,memLevel:8,strategy:yKe},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Cte,this.strm.avail_out=0;let n=v0.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==j2)throw new Error(Gx[n]);if(t.header&&v0.deflateSetHeader(this.strm,t.header),t.dictionary){let s;if(typeof t.dictionary=="string"?s=Ub.string2buf(t.dictionary):Ate.call(t.dictionary)==="[object ArrayBuffer]"?s=new Uint8Array(t.dictionary):s=t.dictionary,n=v0.deflateSetDictionary(this.strm,s),n!==j2)throw new Error(Gx[n]);this._dict_set=!0}}DL.prototype.push=function(e,t){const n=this.strm,s=this.options.chunkSize;let a,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?gKe:fKe,typeof e=="string"?n.input=Ub.string2buf(e):Ate.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(s),n.next_out=0,n.avail_out=s),(i===mKe||i===pKe)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(a=v0.deflate(n,i),a===xKe)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),a=v0.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===j2;if(n.avail_out===0){this.onData(n.output);continue}if(i>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};DL.prototype.onData=function(e){this.chunks.push(e)};DL.prototype.onEnd=function(e){e===j2&&(this.result=E5.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const E1=16209,jKe=16191;var wKe=function(t,n){let s,a,i,o,l,c,d,u,h,f,m,x,p,v,g,y,b,w,_,C,E,N,k,I;const P=t.state;s=t.next_in,k=t.input,a=s+(t.avail_in-5),i=t.next_out,I=t.output,o=i-(n-t.avail_out),l=i+(t.avail_out-257),c=P.dmax,d=P.wsize,u=P.whave,h=P.wnext,f=P.window,m=P.hold,x=P.bits,p=P.lencode,v=P.distcode,g=(1<<P.lenbits)-1,y=(1<<P.distbits)-1;e:do{x<15&&(m+=k[s++]<<x,x+=8,m+=k[s++]<<x,x+=8),b=p[m&g];t:for(;;){if(w=b>>>24,m>>>=w,x-=w,w=b>>>16&255,w===0)I[i++]=b&65535;else if(w&16){_=b&65535,w&=15,w&&(x<w&&(m+=k[s++]<<x,x+=8),_+=m&(1<<w)-1,m>>>=w,x-=w),x<15&&(m+=k[s++]<<x,x+=8,m+=k[s++]<<x,x+=8),b=v[m&y];r:for(;;){if(w=b>>>24,m>>>=w,x-=w,w=b>>>16&255,w&16){if(C=b&65535,w&=15,x<w&&(m+=k[s++]<<x,x+=8,x<w&&(m+=k[s++]<<x,x+=8)),C+=m&(1<<w)-1,C>c){t.msg="invalid distance too far back",P.mode=E1;break e}if(m>>>=w,x-=w,w=i-o,C>w){if(w=C-w,w>u&&P.sane){t.msg="invalid distance too far back",P.mode=E1;break e}if(E=0,N=f,h===0){if(E+=d-w,w<_){_-=w;do I[i++]=f[E++];while(--w);E=i-C,N=I}}else if(h<w){if(E+=d+h-w,w-=h,w<_){_-=w;do I[i++]=f[E++];while(--w);if(E=0,h<_){w=h,_-=w;do I[i++]=f[E++];while(--w);E=i-C,N=I}}}else if(E+=h-w,w<_){_-=w;do I[i++]=f[E++];while(--w);E=i-C,N=I}for(;_>2;)I[i++]=N[E++],I[i++]=N[E++],I[i++]=N[E++],_-=3;_&&(I[i++]=N[E++],_>1&&(I[i++]=N[E++]))}else{E=i-C;do I[i++]=I[E++],I[i++]=I[E++],I[i++]=I[E++],_-=3;while(_>2);_&&(I[i++]=I[E++],_>1&&(I[i++]=I[E++]))}}else if(w&64){t.msg="invalid distance code",P.mode=E1;break e}else{b=v[(b&65535)+(m&(1<<w)-1)];continue r}break}}else if(w&64)if(w&32){P.mode=jKe;break e}else{t.msg="invalid literal/length code",P.mode=E1;break e}else{b=p[(b&65535)+(m&(1<<w)-1)];continue t}break}}while(s<a&&i<l);_=x>>3,s-=_,x-=_<<3,m&=(1<<x)-1,t.next_in=s,t.next_out=i,t.avail_in=s<a?5+(a-s):5-(s-a),t.avail_out=i<l?257+(l-i):257-(i-l),P.hold=m,P.bits=x};const Hp=15,LB=852,IB=592,RB=0,fC=1,MB=2,NKe=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]),_Ke=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]),SKe=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]),kKe=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]),CKe=(e,t,n,s,a,i,o,l)=>{const c=l.bits;let d=0,u=0,h=0,f=0,m=0,x=0,p=0,v=0,g=0,y=0,b,w,_,C,E,N=null,k;const I=new Uint16Array(Hp+1),P=new Uint16Array(Hp+1);let O=null,A,R,L;for(d=0;d<=Hp;d++)I[d]=0;for(u=0;u<s;u++)I[t[n+u]]++;for(m=c,f=Hp;f>=1&&I[f]===0;f--);if(m>f&&(m=f),f===0)return a[i++]=1<<24|64<<16|0,a[i++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h<f&&I[h]===0;h++);for(m<h&&(m=h),v=1,d=1;d<=Hp;d++)if(v<<=1,v-=I[d],v<0)return-1;if(v>0&&(e===RB||f!==1))return-1;for(P[1]=0,d=1;d<Hp;d++)P[d+1]=P[d]+I[d];for(u=0;u<s;u++)t[n+u]!==0&&(o[P[t[n+u]]++]=u);if(e===RB?(N=O=o,k=20):e===fC?(N=NKe,O=_Ke,k=257):(N=SKe,O=kKe,k=0),y=0,u=0,d=h,E=i,x=m,p=0,_=-1,g=1<<m,C=g-1,e===fC&&g>LB||e===MB&&g>IB)return 1;for(;;){A=d-p,o[u]+1<k?(R=0,L=o[u]):o[u]>=k?(R=O[o[u]-k],L=N[o[u]-k]):(R=96,L=0),b=1<<d-p,w=1<<x,h=w;do w-=b,a[E+(y>>p)+w]=A<<24|R<<16|L|0;while(w!==0);for(b=1<<d-1;y&b;)b>>=1;if(b!==0?(y&=b-1,y+=b):y=0,u++,--I[d]===0){if(d===f)break;d=t[n+o[u]]}if(d>m&&(y&C)!==_){for(p===0&&(p=m),E+=h,x=d-p,v=1<<x;x+p<f&&(v-=I[x+p],!(v<=0));)x++,v<<=1;if(g+=1<<x,e===fC&&g>LB||e===MB&&g>IB)return 1;_=y&C,a[_]=m<<24|x<<16|E-i|0}}return y!==0&&(a[E+y]=d-p<<24|64<<16|0),l.bits=m,0};var y0=CKe;const AKe=0,Pte=1,Ete=2,{Z_FINISH:DB,Z_BLOCK:PKe,Z_TREES:T1,Z_OK:qm,Z_STREAM_END:EKe,Z_NEED_DICT:TKe,Z_STREAM_ERROR:gl,Z_DATA_ERROR:Tte,Z_MEM_ERROR:Ote,Z_BUF_ERROR:OKe,Z_DEFLATED:$B}=Gj,T5=16180,FB=16181,BB=16182,UB=16183,zB=16184,qB=16185,VB=16186,WB=16187,HB=16188,GB=16189,w2=16190,Sd=16191,mC=16192,YB=16193,pC=16194,KB=16195,XB=16196,ZB=16197,JB=16198,O1=16199,L1=16200,QB=16201,e9=16202,t9=16203,r9=16204,n9=16205,gC=16206,s9=16207,a9=16208,fs=16209,Lte=16210,Ite=16211,LKe=852,IKe=592,RKe=15,MKe=RKe,i9=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function DKe(){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 ip=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<T5||t.mode>Ite?1:0},Rte=e=>{if(ip(e))return gl;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=T5,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(LKe),t.distcode=t.distdyn=new Int32Array(IKe),t.sane=1,t.back=-1,qm},Mte=e=>{if(ip(e))return gl;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Rte(e)},Dte=(e,t)=>{let n;if(ip(e))return gl;const s=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?gl:(s.window!==null&&s.wbits!==t&&(s.window=null),s.wrap=n,s.wbits=t,Mte(e))},$te=(e,t)=>{if(!e)return gl;const n=new DKe;e.state=n,n.strm=e,n.window=null,n.mode=T5;const s=Dte(e,t);return s!==qm&&(e.state=null),s},$Ke=e=>$te(e,MKe);let o9=!0,xC,vC;const FKe=e=>{if(o9){xC=new Int32Array(512),vC=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(y0(Pte,e.lens,0,288,xC,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;y0(Ete,e.lens,0,32,vC,0,e.work,{bits:5}),o9=!1}e.lencode=xC,e.lenbits=9,e.distcode=vC,e.distbits=5},Fte=(e,t,n,s)=>{let a;const i=e.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),s>=i.wsize?(i.window.set(t.subarray(n-i.wsize,n),0),i.wnext=0,i.whave=i.wsize):(a=i.wsize-i.wnext,a>s&&(a=s),i.window.set(t.subarray(n-s,n-s+a),i.wnext),s-=a,s?(i.window.set(t.subarray(n-s,n),0),i.wnext=s,i.whave=i.wsize):(i.wnext+=a,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=a))),0},BKe=(e,t)=>{let n,s,a,i,o,l,c,d,u,h,f,m,x,p,v=0,g,y,b,w,_,C,E,N;const k=new Uint8Array(4);let I,P;const O=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ip(e)||!e.output||!e.input&&e.avail_in!==0)return gl;n=e.state,n.mode===Sd&&(n.mode=mC),o=e.next_out,a=e.output,c=e.avail_out,i=e.next_in,s=e.input,l=e.avail_in,d=n.hold,u=n.bits,h=l,f=c,N=qm;e:for(;;)switch(n.mode){case T5:if(n.wrap===0){n.mode=mC;break}for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(n.wrap&2&&d===35615){n.wbits===0&&(n.wbits=15),n.check=0,k[0]=d&255,k[1]=d>>>8&255,n.check=wa(n.check,k,2,0),d=0,u=0,n.mode=FB;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((d&255)<<8)+(d>>8))%31){e.msg="incorrect header check",n.mode=fs;break}if((d&15)!==$B){e.msg="unknown compression method",n.mode=fs;break}if(d>>>=4,u-=4,E=(d&15)+8,n.wbits===0&&(n.wbits=E),E>15||E>n.wbits){e.msg="invalid window size",n.mode=fs;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=d&512?GB:Sd,d=0,u=0;break;case FB:for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(n.flags=d,(n.flags&255)!==$B){e.msg="unknown compression method",n.mode=fs;break}if(n.flags&57344){e.msg="unknown header flags set",n.mode=fs;break}n.head&&(n.head.text=d>>8&1),n.flags&512&&n.wrap&4&&(k[0]=d&255,k[1]=d>>>8&255,n.check=wa(n.check,k,2,0)),d=0,u=0,n.mode=BB;case BB:for(;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}n.head&&(n.head.time=d),n.flags&512&&n.wrap&4&&(k[0]=d&255,k[1]=d>>>8&255,k[2]=d>>>16&255,k[3]=d>>>24&255,n.check=wa(n.check,k,4,0)),d=0,u=0,n.mode=UB;case UB:for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}n.head&&(n.head.xflags=d&255,n.head.os=d>>8),n.flags&512&&n.wrap&4&&(k[0]=d&255,k[1]=d>>>8&255,n.check=wa(n.check,k,2,0)),d=0,u=0,n.mode=zB;case zB:if(n.flags&1024){for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}n.length=d,n.head&&(n.head.extra_len=d),n.flags&512&&n.wrap&4&&(k[0]=d&255,k[1]=d>>>8&255,n.check=wa(n.check,k,2,0)),d=0,u=0}else n.head&&(n.head.extra=null);n.mode=qB;case qB:if(n.flags&1024&&(m=n.length,m>l&&(m=l),m&&(n.head&&(E=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(s.subarray(i,i+m),E)),n.flags&512&&n.wrap&4&&(n.check=wa(n.check,s,m,i)),l-=m,i+=m,n.length-=m),n.length))break e;n.length=0,n.mode=VB;case VB:if(n.flags&2048){if(l===0)break e;m=0;do E=s[i+m++],n.head&&E&&n.length<65536&&(n.head.name+=String.fromCharCode(E));while(E&&m<l);if(n.flags&512&&n.wrap&4&&(n.check=wa(n.check,s,m,i)),l-=m,i+=m,E)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=WB;case WB:if(n.flags&4096){if(l===0)break e;m=0;do E=s[i+m++],n.head&&E&&n.length<65536&&(n.head.comment+=String.fromCharCode(E));while(E&&m<l);if(n.flags&512&&n.wrap&4&&(n.check=wa(n.check,s,m,i)),l-=m,i+=m,E)break e}else n.head&&(n.head.comment=null);n.mode=HB;case HB:if(n.flags&512){for(;u<16;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(n.wrap&4&&d!==(n.check&65535)){e.msg="header crc mismatch",n.mode=fs;break}d=0,u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Sd;break;case GB:for(;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}e.adler=n.check=i9(d),d=0,u=0,n.mode=w2;case w2:if(n.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,n.hold=d,n.bits=u,TKe;e.adler=n.check=1,n.mode=Sd;case Sd:if(t===PKe||t===T1)break e;case mC:if(n.last){d>>>=u&7,u-=u&7,n.mode=gC;break}for(;u<3;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}switch(n.last=d&1,d>>>=1,u-=1,d&3){case 0:n.mode=YB;break;case 1:if(FKe(n),n.mode=O1,t===T1){d>>>=2,u-=2;break e}break;case 2:n.mode=XB;break;case 3:e.msg="invalid block type",n.mode=fs}d>>>=2,u-=2;break;case YB:for(d>>>=u&7,u-=u&7;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if((d&65535)!==(d>>>16^65535)){e.msg="invalid stored block lengths",n.mode=fs;break}if(n.length=d&65535,d=0,u=0,n.mode=pC,t===T1)break e;case pC:n.mode=KB;case KB:if(m=n.length,m){if(m>l&&(m=l),m>c&&(m=c),m===0)break e;a.set(s.subarray(i,i+m),o),l-=m,i+=m,c-=m,o+=m,n.length-=m;break}n.mode=Sd;break;case XB:for(;u<14;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(n.nlen=(d&31)+257,d>>>=5,u-=5,n.ndist=(d&31)+1,d>>>=5,u-=5,n.ncode=(d&15)+4,d>>>=4,u-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=fs;break}n.have=0,n.mode=ZB;case ZB:for(;n.have<n.ncode;){for(;u<3;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}n.lens[O[n.have++]]=d&7,d>>>=3,u-=3}for(;n.have<19;)n.lens[O[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,I={bits:n.lenbits},N=y0(AKe,n.lens,0,19,n.lencode,0,n.work,I),n.lenbits=I.bits,N){e.msg="invalid code lengths set",n.mode=fs;break}n.have=0,n.mode=JB;case JB:for(;n.have<n.nlen+n.ndist;){for(;v=n.lencode[d&(1<<n.lenbits)-1],g=v>>>24,y=v>>>16&255,b=v&65535,!(g<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(b<16)d>>>=g,u-=g,n.lens[n.have++]=b;else{if(b===16){for(P=g+2;u<P;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(d>>>=g,u-=g,n.have===0){e.msg="invalid bit length repeat",n.mode=fs;break}E=n.lens[n.have-1],m=3+(d&3),d>>>=2,u-=2}else if(b===17){for(P=g+3;u<P;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=g,u-=g,E=0,m=3+(d&7),d>>>=3,u-=3}else{for(P=g+7;u<P;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=g,u-=g,E=0,m=11+(d&127),d>>>=7,u-=7}if(n.have+m>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=fs;break}for(;m--;)n.lens[n.have++]=E}}if(n.mode===fs)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=fs;break}if(n.lenbits=9,I={bits:n.lenbits},N=y0(Pte,n.lens,0,n.nlen,n.lencode,0,n.work,I),n.lenbits=I.bits,N){e.msg="invalid literal/lengths set",n.mode=fs;break}if(n.distbits=6,n.distcode=n.distdyn,I={bits:n.distbits},N=y0(Ete,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,I),n.distbits=I.bits,N){e.msg="invalid distances set",n.mode=fs;break}if(n.mode=O1,t===T1)break e;case O1:n.mode=L1;case L1:if(l>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,n.hold=d,n.bits=u,wKe(e,f),o=e.next_out,a=e.output,c=e.avail_out,i=e.next_in,s=e.input,l=e.avail_in,d=n.hold,u=n.bits,n.mode===Sd&&(n.back=-1);break}for(n.back=0;v=n.lencode[d&(1<<n.lenbits)-1],g=v>>>24,y=v>>>16&255,b=v&65535,!(g<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(y&&!(y&240)){for(w=g,_=y,C=b;v=n.lencode[C+((d&(1<<w+_)-1)>>w)],g=v>>>24,y=v>>>16&255,b=v&65535,!(w+g<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=w,u-=w,n.back+=w}if(d>>>=g,u-=g,n.back+=g,n.length=b,y===0){n.mode=n9;break}if(y&32){n.back=-1,n.mode=Sd;break}if(y&64){e.msg="invalid literal/length code",n.mode=fs;break}n.extra=y&15,n.mode=QB;case QB:if(n.extra){for(P=n.extra;u<P;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}n.length+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=e9;case e9:for(;v=n.distcode[d&(1<<n.distbits)-1],g=v>>>24,y=v>>>16&255,b=v&65535,!(g<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(!(y&240)){for(w=g,_=y,C=b;v=n.distcode[C+((d&(1<<w+_)-1)>>w)],g=v>>>24,y=v>>>16&255,b=v&65535,!(w+g<=u);){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}d>>>=w,u-=w,n.back+=w}if(d>>>=g,u-=g,n.back+=g,y&64){e.msg="invalid distance code",n.mode=fs;break}n.offset=b,n.extra=y&15,n.mode=t9;case t9:if(n.extra){for(P=n.extra;u<P;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}n.offset+=d&(1<<n.extra)-1,d>>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=fs;break}n.mode=r9;case r9:if(c===0)break e;if(m=f-c,n.offset>m){if(m=n.offset-m,m>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=fs;break}m>n.wnext?(m-=n.wnext,x=n.wsize-m):x=n.wnext-m,m>n.length&&(m=n.length),p=n.window}else p=a,x=o-n.offset,m=n.length;m>c&&(m=c),c-=m,n.length-=m;do a[o++]=p[x++];while(--m);n.length===0&&(n.mode=L1);break;case n9:if(c===0)break e;a[o++]=n.length,c--,n.mode=L1;break;case gC:if(n.wrap){for(;u<32;){if(l===0)break e;l--,d|=s[i++]<<u,u+=8}if(f-=c,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?wa(n.check,a,f,o-f):Fb(n.check,a,f,o-f)),f=c,n.wrap&4&&(n.flags?d:i9(d))!==n.check){e.msg="incorrect data check",n.mode=fs;break}d=0,u=0}n.mode=s9;case s9:if(n.wrap&&n.flags){for(;u<32;){if(l===0)break e;l--,d+=s[i++]<<u,u+=8}if(n.wrap&4&&d!==(n.total&4294967295)){e.msg="incorrect length check",n.mode=fs;break}d=0,u=0}n.mode=a9;case a9:N=EKe;break e;case fs:N=Tte;break e;case Lte:return Ote;case Ite:default:return gl}return e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,n.hold=d,n.bits=u,(n.wsize||f!==e.avail_out&&n.mode<fs&&(n.mode<gC||t!==DB))&&Fte(e,e.output,e.next_out,f-e.avail_out),h-=e.avail_in,f-=e.avail_out,e.total_in+=h,e.total_out+=f,n.total+=f,n.wrap&4&&f&&(e.adler=n.check=n.flags?wa(n.check,a,f,e.next_out-f):Fb(n.check,a,f,e.next_out-f)),e.data_type=n.bits+(n.last?64:0)+(n.mode===Sd?128:0)+(n.mode===O1||n.mode===pC?256:0),(h===0&&f===0||t===DB)&&N===qm&&(N=OKe),N},UKe=e=>{if(ip(e))return gl;let t=e.state;return t.window&&(t.window=null),e.state=null,qm},zKe=(e,t)=>{if(ip(e))return gl;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,qm):gl},qKe=(e,t)=>{const n=t.length;let s,a,i;return ip(e)||(s=e.state,s.wrap!==0&&s.mode!==w2)?gl:s.mode===w2&&(a=1,a=Fb(a,t,n,0),a!==s.check)?Tte:(i=Fte(e,t,n,n),i?(s.mode=Lte,Ote):(s.havedict=1,qm))};var VKe=Mte,WKe=Dte,HKe=Rte,GKe=$Ke,YKe=$te,KKe=BKe,XKe=UKe,ZKe=zKe,JKe=qKe,QKe="pako inflate (from Nodeca project)",Ld={inflateReset:VKe,inflateReset2:WKe,inflateResetKeep:HKe,inflateInit:GKe,inflateInit2:YKe,inflate:KKe,inflateEnd:XKe,inflateGetHeader:ZKe,inflateSetDictionary:JKe,inflateInfo:QKe};function eXe(){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 tXe=eXe;const Bte=Object.prototype.toString,{Z_NO_FLUSH:rXe,Z_FINISH:nXe,Z_OK:zb,Z_STREAM_END:yC,Z_NEED_DICT:bC,Z_STREAM_ERROR:sXe,Z_DATA_ERROR:l9,Z_MEM_ERROR:aXe}=Gj;function Kj(e){this.options=E5.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||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Cte,this.strm.avail_out=0;let n=Ld.inflateInit2(this.strm,t.windowBits);if(n!==zb)throw new Error(Gx[n]);if(this.header=new tXe,Ld.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Ub.string2buf(t.dictionary):Bte.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Ld.inflateSetDictionary(this.strm,t.dictionary),n!==zb)))throw new Error(Gx[n])}Kj.prototype.push=function(e,t){const n=this.strm,s=this.options.chunkSize,a=this.options.dictionary;let i,o,l;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?nXe:rXe,Bte.call(e)==="[object ArrayBuffer]"?n.input=new
vendor: 10,166 bytes, line 1020
1020Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(s),n.next_out=0,n.avail_out=s),i=Ld.inflate(n,o),i===bC&&a&&(i=Ld.inflateSetDictionary(n,a),i===zb?i=Ld.inflate(n,o):i===l9&&(i=bC));n.avail_in>0&&i===yC&&n.state.wrap>0&&e[n.next_in]!==0;)Ld.inflateReset(n),i=Ld.inflate(n,o);switch(i){case sXe:case l9:case bC:case aXe:return this.onEnd(i),this.ended=!0,!1}if(l=n.avail_out,n.next_out&&(n.avail_out===0||i===yC))if(this.options.to==="string"){let c=Ub.utf8border(n.output,n.next_out),d=n.next_out-c,u=Ub.buf2string(n.output,c);n.next_out=d,n.avail_out=s-d,d&&n.output.set(n.output.subarray(c,c+d),0),this.onData(u)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(i===zb&&l===0)){if(i===yC)return i=Ld.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Kj.prototype.onData=function(e){this.chunks.push(e)};Kj.prototype.onEnd=function(e){e===zb&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=E5.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $L(e,t){const n=new Kj(t);if(n.push(e),n.err)throw n.msg||Gx[n.err];return n.result}function iXe(e,t){return t=t||{},t.raw=!0,$L(e,t)}var oXe=Kj,lXe=$L,cXe=iXe,dXe=$L,uXe=Gj,hXe={Inflate:oXe,inflate:lXe,inflateRaw:cXe,ungzip:dXe,constants:uXe};const{Inflate:fXe,inflate:mXe,inflateRaw:YJe,ungzip:KJe}=hXe;var c9=fXe,pXe=mXe;const Ute=[];for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t&1?t=3988292384^t>>>1:t=t>>>1;Ute[e]=t}const d9=4294967295;function gXe(e,t,n){let s=e;for(let a=0;a<n;a++)s=Ute[(s^t[a])&255]^s>>>8;return s}function xXe(e,t){return(gXe(d9,e,t)^d9)>>>0}function u9(e,t,n){const s=e.readUint32(),a=xXe(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(a!==s)throw new Error(`CRC mismatch for chunk ${n}. Expected ${s}, found ${a}`)}function zte(e,t,n){for(let s=0;s<n;s++)t[s]=e[s]}function qte(e,t,n,s){let a=0;for(;a<s;a++)t[a]=e[a];for(;a<n;a++)t[a]=e[a]+t[a-s]&255}function Vte(e,t,n,s){let a=0;if(n.length===0)for(;a<s;a++)t[a]=e[a];else for(;a<s;a++)t[a]=e[a]+n[a]&255}function Wte(e,t,n,s,a){let i=0;if(n.length===0){for(;i<a;i++)t[i]=e[i];for(;i<s;i++)t[i]=e[i]+(t[i-a]>>1)&255}else{for(;i<a;i++)t[i]=e[i]+(n[i]>>1)&255;for(;i<s;i++)t[i]=e[i]+(t[i-a]+n[i]>>1)&255}}function Hte(e,t,n,s,a){let i=0;if(n.length===0){for(;i<a;i++)t[i]=e[i];for(;i<s;i++)t[i]=e[i]+t[i-a]&255}else{for(;i<a;i++)t[i]=e[i]+n[i]&255;for(;i<s;i++)t[i]=e[i]+vXe(t[i-a],n[i],n[i-a])&255}}function vXe(e,t,n){const s=e+t-n,a=Math.abs(s-e),i=Math.abs(s-t),o=Math.abs(s-n);return a<=i&&a<=o?e:i<=o?t:n}function yXe(e,t,n,s,a,i){switch(e){case 0:zte(t,n,a);break;case 1:qte(t,n,a,i);break;case 2:Vte(t,n,s,a);break;case 3:Wte(t,n,s,a,i);break;case 4:Hte(t,n,s,a,i);break;default:throw new Error(`Unsupported filter: ${e}`)}}const bXe=new Uint16Array([255]),jXe=new Uint8Array(bXe.buffer),wXe=jXe[0]===255;function NXe(e){const{data:t,width:n,height:s,channels:a,depth:i}=e,o=[{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(i/8)*a,c=new Uint8Array(s*n*l);let d=0;for(let u=0;u<7;u++){const h=o[u],f=Math.ceil((n-h.x)/h.xStep),m=Math.ceil((s-h.y)/h.yStep);if(f<=0||m<=0)continue;const x=f*l,p=new Uint8Array(x);for(let v=0;v<m;v++){const g=t[d++],y=t.subarray(d,d+x);d+=x;const b=new Uint8Array(x);yXe(g,y,b,p,x,l),p.set(b);for(let w=0;w<f;w++){const _=h.x+w*h.xStep,C=h.y+v*h.yStep;if(!(_>=n||C>=s))for(let E=0;E<l;E++)c[(C*n+_)*l+E]=b[w*l+E]}}}if(i===16){const u=new Uint16Array(c.buffer);if(wXe)for(let h=0;h<u.length;h++)u[h]=_Xe(u[h]);return u}else return c}function _Xe(e){return(e&255)<<8|e>>8&255}const SXe=new Uint16Array([255]),kXe=new Uint8Array(SXe.buffer),CXe=kXe[0]===255,AXe=new Uint8Array(0);function h9(e){const{data:t,width:n,height:s,channels:a,depth:i}=e,o=Math.ceil(i/8)*a,l=Math.ceil(i/8*a*n),c=new Uint8Array(s*l);let d=AXe,u=0,h,f;for(let m=0;m<s;m++){switch(h=t.subarray(u+1,u+1+l),f=c.subarray(m*l,(m+1)*l),t[u]){case 0:zte(h,f,l);break;case 1:qte(h,f,l,o);break;case 2:Vte(h,f,d,l);break;case 3:Wte(h,f,d,l,o);break;case 4:Hte(h,f,d,l,o);break;default:throw new Error(`Unsupported filter: ${t[u]}`)}d=f,u+=l+1}if(i===16){const m=new Uint16Array(c.buffer);if(CXe)for(let x=0;x<m.length;x++)m[x]=PXe(m[x]);return m}else return c}function PXe(e){return(e&255)<<8|e>>8&255}const lN=Uint8Array.of(137,80,78,71,13,10,26,10);function f9(e){if(!EXe(e.readBytes(lN.length)))throw new Error("wrong PNG signature")}function EXe(e){if(e.length<lN.length)return!1;for(let t=0;t<lN.length;t++)if(e[t]!==lN[t])return!1;return!0}const TXe="tEXt",OXe=0,Gte=new TextDecoder("latin1");function LXe(e){if(RXe(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const IXe=/^[\u0000-\u00FF]*$/;function RXe(e){if(!IXe.test(e))throw new Error("invalid latin1 text")}function MXe(e,t,n){const s=Yte(t);e[s]=DXe(t,n-s.length-1)}function Yte(e){for(e.mark();e.readByte()!==OXe;);const t=e.offset;e.reset();const n=Gte.decode(e.readBytes(t-e.offset-1));return e.skip(1),LXe(n),n}function DXe(e,t){return Gte.decode(e.readBytes(t))}const vo={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},jC={UNKNOWN:-1,DEFLATE:0},m9={UNKNOWN:-1,ADAPTIVE:0},wC={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},I1={NONE:0,BACKGROUND:1,PREVIOUS:2},NC={SOURCE:0,OVER:1};class $Xe extends TL{constructor(n,s={}){super(n);An(this,"_checkCrc");An(this,"_inflator");An(this,"_png");An(this,"_apng");An(this,"_end");An(this,"_hasPalette");An(this,"_palette");An(this,"_hasTransparency");An(this,"_transparency");An(this,"_compressionMethod");An(this,"_filterMethod");An(this,"_interlaceMethod");An(this,"_colorType");An(this,"_isAnimated");An(this,"_numberOfFrames");An(this,"_numberOfPlays");An(this,"_frames");An(this,"_writingDataChunks");const{checkCrc:a=!1}=s;this._checkCrc=a,this._inflator=new c9,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=jC.UNKNOWN,this._filterMethod=m9.UNKNOWN,this._interlaceMethod=wC.UNKNOWN,this._colorType=vo.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(f9(this);!this._end;){const n=this.readUint32(),s=this.readChars(4);this.decodeChunk(n,s)}return this.decodeImage(),this._png}decodeApng(){for(f9(this);!this._end;){const n=this.readUint32(),s=this.readChars(4);this.decodeApngChunk(n,s)}return this.decodeApngImage(),this._apng}decodeChunk(n,s){const a=this.offset;switch(s){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(n);break;case"IDAT":this.decodeIDAT(n);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(n);break;case"iCCP":this.decodeiCCP(n);break;case TXe:MXe(this._png.text,this,n);break;case"pHYs":this.decodepHYs();break;default:this.skip(n);break}if(this.offset-a!==n)throw new Error(`Length mismatch while decoding chunk ${s}`);this._checkCrc?u9(this,n+4,s):this.skip(4)}decodeApngChunk(n,s){const a=this.offset;switch(s!=="fdAT"&&s!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),s){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(n);break;default:this.decodeChunk(n,s),this.offset=a+n;break}if(this.offset-a!==n)throw new Error(`Length mismatch while decoding chunk ${s}`);this._checkCrc?u9(this,n+4,s):this.skip(4)}decodeIHDR(){const n=this._png;n.width=this.readUint32(),n.height=this.readUint32(),n.depth=FXe(this.readUint8());const s=this.readUint8();this._colorType=s;let a;switch(s){case vo.GREYSCALE:a=1;break;case vo.TRUECOLOUR:a=3;break;case vo.INDEXED_COLOUR:a=1;break;case vo.GREYSCALE_ALPHA:a=2;break;case vo.TRUECOLOUR_ALPHA:a=4;break;case vo.UNKNOWN:default:throw new Error(`Unknown color type: ${s}`)}if(this._png.channels=a,this._compressionMethod=this.readUint8(),this._compressionMethod!==jC.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 n={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(n)}decodePLTE(n){if(n%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${n}`);const s=n/3;this._hasPalette=!0;const a=[];this._palette=a;for(let i=0;i<s;i++)a.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(n){this._writingDataChunks=!0;const s=n,a=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,a,s)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(n)}decodeFDAT(n){this._writingDataChunks=!0;let s=n,a=this.offset+this.byteOffset;if(a+=4,s-=4,this._inflator.push(new Uint8Array(this.buffer,a,s)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(n)}decodetRNS(n){switch(this._colorType){case vo.GREYSCALE:case vo.TRUECOLOUR:{if(n%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${n}`);if(n/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${n/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(n/2);for(let s=0;s<n/2;s++)this._transparency[s]=this.readUint16();break}case vo.INDEXED_COLOUR:{if(n>this._palette.length)throw new Error(`tRNS chunk contains more alph
1020a values than there are palette colors (${n} vs ${this._palette.length})`);let s=0;for(;s<n;s++){const a=this.readByte();this._palette[s].push(a)}for(;s<this._palette.length;s++)this._palette[s].push(255);break}case vo.UNKNOWN:case vo.GREYSCALE_ALPHA:case vo.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(n){const s=Yte(this),a=this.readUint8();if(a!==jC.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${a}`);const i=this.readBytes(n-s.length-2);this._png.iccEmbeddedProfile={name:s,profile:pXe(i)}}decodepHYs(){const n=this.readUint32(),s=this.readUint32(),a=this.readByte();this._png.resolution={x:n,y:s,unit:a}}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 n=0;n<this._numberOfFrames;n++){const s={sequenceNumber:this._frames[n].sequenceNumber,delayNumber:this._frames[n].delayNumber,delayDenominator:this._frames[n].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)},a=this._frames.at(n);if(a){if(a.data=h9({data:a.data,width:a.width,height:a.height,channels:this._apng.channels,depth:this._apng.depth}),this._hasPalette&&(this._apng.palette=this._palette),this._hasTransparency&&(this._apng.transparency=this._transparency),n===0||a.xOffset===0&&a.yOffset===0&&a.width===this._png.width&&a.height===this._png.height)s.data=a.data;else{const i=this._apng.frames.at(n-1);this.disposeFrame(a,i,s),this.addFrameDataToCanvas(s,a)}this._apng.frames.push(s)}}return this._apng}disposeFrame(n,s,a){switch(n.disposeOp){case I1.NONE:break;case I1.BACKGROUND:for(let i=0;i<this._png.height;i++)for(let o=0;o<this._png.width;o++){const l=(i*n.width+o)*this._png.channels;for(let c=0;c<this._png.channels;c++)a.data[l+c]=0}break;case I1.PREVIOUS:a.data.set(s.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(n,s){const a=1<<this._png.depth,i=(o,l)=>{const c=((o+s.yOffset)*this._png.width+s.xOffset+l)*this._png.channels,d=(o*s.width+l)*this._png.channels;return{index:c,frameIndex:d}};switch(s.blendOp){case NC.SOURCE:for(let o=0;o<s.height;o++)for(let l=0;l<s.width;l++){const{index:c,frameIndex:d}=i(o,l);for(let u=0;u<this._png.channels;u++)n.data[c+u]=s.data[d+u]}break;case NC.OVER:for(let o=0;o<s.height;o++)for(let l=0;l<s.width;l++){const{index:c,frameIndex:d}=i(o,l);for(let u=0;u<this._png.channels;u++){const h=s.data[d+this._png.channels-1]/a,f=u%(this._png.channels-1)===0?1:s.data[d+u],m=Math.floor(h*f+(1-h)*n.data[c+u]);n.data[c+u]+=m}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var s;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const n=this._isAnimated?((s=this._frames)==null?void 0:s.at(0)).data:this._inflator.result;if(this._filterMethod!==m9.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===wC.NO_INTERLACE)this._png.data=h9({data:n,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===wC.ADAM7)this._png.data=NXe({data:n,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 n=this._inflator.result,s=this._frames.at(-1);s?s.data=n:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:I1.NONE,blendOp:NC.SOURCE,data:n}),this._inflator=new c9,this._writingDataChunks=!1}}function FXe(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var p9;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(p9||(p9={}));function BXe(e,t){return new $Xe(e,t).decode()}var jr=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function _C(){jr.console&&typeof jr.console.log=="function"&&jr.console.log.apply(jr.console,arguments)}var Bn={log:_C,warn:function(e){jr.console&&(typeof jr.console.warn=="function"?jr.console.warn.apply(jr.console,arguments):_C.call(null,arguments))},error:function(e){jr.console&&(typeof jr.console.error=="function"?jr.console.error.apply(jr.console,arguments):_C(e))}};function SC(e,t,n){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){Ff(s.response,t,n
vendor: 3,702 bytes, lines 1020-1025
1020)},s.onerror=function(){Bn.error("could not download file")},s.send()}function g9(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function R1(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 Ff=jr.saveAs||((typeof window>"u"?"undefined":En(window))!=="object"||window!==jr?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,n){var s=jr.URL||jr.webkitURL,a=document.createElement("a");t=t||e.name||"download",a.download=t,a.rel="noopener",typeof e=="string"?(a.href=e,a.origin!==location.origin?g9(a.href)?SC(e,t,n):R1(a,a.target="_blank"):R1(a)):(a.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(a.href)},4e4),setTimeout(function(){R1(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download",typeof e=="string")if(g9(e))SC(e,t,n);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){R1(s)})}else navigator.msSaveOrOpenBlob(function(a,i){return i===void 0?i={autoBom:!1}:En(i)!=="object"&&(Bn.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}(e,n),t)}:function(e,t,n,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),typeof e=="string")return SC(e,t,n);var a=e.type==="application/octet-stream",i=/constructor/i.test(jr.HTMLElement)||jr.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||a&&i)&&(typeof FileReader>"u"?"undefined":En(FileReader))==="object"){var l=new FileReader;l.onloadend=function(){var u=l.result;u=o?u:u.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=u:location=u,s=null},l.readAsDataURL(e)}else{var c=jr.URL||jr.webkitURL,d=c.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout(function(){c.revokeObjectURL(d)},4e4)}});/** 1021 * A class to parse color values 1022 * @author Stoyan Stefanov <[email protected]> 1023 * {@link http://www.phpied.com/rgb-color-parser-in-javascript/} 1024 * @license Use it if you like it 1025 */function Kte(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:"90ee9
10250",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 n=[{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)]}}],s=0;s<n.length;s++){var a=n[s].re,i=n[s].process,o=a.exec(e);o&&(t=i(o),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),d=this.b.toString(16);return l.length==1&&(l="0"+l),c.length==1&&(c="0"+c),d.length==1&&(d="0"+d),"#"+l+c+d}}var cN=jr.atob.bind(jr),x9=jr.btoa.bind(jr);/** 1026 * @license 1027 * Joseph Myers does not specify a particular license for his work. 1028 * 1029 * Author: Joseph Myers 1030 * Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js 1031 * 1032 * Modified by: Owen Leong 1033 */function kC(e,t){var n=e[0],s=e[1],a=e[2],i=e[3];n=Ja(n,s,a,i,t[0],7,-680876936),i=Ja(i,n,s,a,t[1],12,-389564586),a=Ja(a,i,n,s,t[2],17,606105819),s=Ja(s,a,i,n,t[3],22,-1044525330),n=Ja(n,s,a,i,t[4],7,-176418897),i=Ja(i,n,s,a,t[5],12,1200080426),a=Ja(a,i,n,s,t[6],17,-1473231341),s=Ja(s,a,i,n,t[7],22,-45705983),n=Ja(n,s,a,i,t[8],7,1770035416),i=Ja(i,n,s,a,t[9],12,-1958414417),a=Ja(a,i,n,s,t[10],17,-42063),s=Ja(s,a,i,n,t[11],22,-1990404162),n=Ja(n,s,a,i,t[12],7,1804603682),i=Ja(i,n,s,a,t[13],12,-40341101),a=Ja(a,i,n,s,t[14],17,-1502002290),n=Qa(n,s=Ja(s,a,i,n,t[15],22,1236535329),a,i,t[1],5,-165796510),i=Qa(i,n,s,a,t[6],9,-1069501632),a=Qa(a,i,n,s,t[11],14,643717713),s=Qa(s,a,i,n,t[0],20,-373897302),n=Qa(n,s,a,i,t[5],5,-701558691),i=Qa(i,n,s,a,t[10],9,38016083),a=Qa(a,i,n,s,t[15],14,-660478335),s=Qa(s,a,i,n,t[4],20,-405537848),n=Qa(n,s,a,i,t[9],5,568446438),i=Qa(i,n,s,a,t[14],9,-1019803690),a=Qa(a,i,n,s,t[3],14,-187363961),s=Qa(s,a,i,n,t[8],20,1163531501),n=Qa(n,s,a,i,t[13],5,-1444681467),i=Qa(i,n,s,a,t[2],9,-51403784),a=Qa(a,i,n,s,t[7],14,1735328473),n=ei(n,s=Qa(s,a,i,n,t[12],20,-1926607734),a,i,t[5],4,-378558),i=ei(i,n,s,a,t[8],11,-2022574463),a=ei(a,i,n,s,t[11],16,1839030562),s=ei(s,a,i,n,t[14],23,-35309556),n=ei(n,s,a,i,t[1],4,-1530992060),i=ei(i,n,s,a,t[4],11,1272893353),a=ei(a,i,n,s,t[7],16,-155497632),s=ei(s,a,i,n,t[10],23,-1094730640),n=ei(n,s,a,i,t[13],4,681279174),i=ei(i,n,s,a,t[0],11,-358537222),a=ei(a,i,n,s,t[3],16,-722521979),s=ei(s,a,i,n,t[6],23,76029189),n=ei(n,s,a,i,t[9],4,-640364487),i=e
vendor: 8,570 bytes, lines 1033-1050
1033i(i,n,s,a,t[12],11,-421815835),a=ei(a,i,n,s,t[15],16,530742520),n=ti(n,s=ei(s,a,i,n,t[2],23,-995338651),a,i,t[0],6,-198630844),i=ti(i,n,s,a,t[7],10,1126891415),a=ti(a,i,n,s,t[14],15,-1416354905),s=ti(s,a,i,n,t[5],21,-57434055),n=ti(n,s,a,i,t[12],6,1700485571),i=ti(i,n,s,a,t[3],10,-1894986606),a=ti(a,i,n,s,t[10],15,-1051523),s=ti(s,a,i,n,t[1],21,-2054922799),n=ti(n,s,a,i,t[8],6,1873313359),i=ti(i,n,s,a,t[15],10,-30611744),a=ti(a,i,n,s,t[6],15,-1560198380),s=ti(s,a,i,n,t[13],21,1309151649),n=ti(n,s,a,i,t[4],6,-145523070),i=ti(i,n,s,a,t[11],10,-1120210379),a=ti(a,i,n,s,t[2],15,718787259),s=ti(s,a,i,n,t[9],21,-343485551),e[0]=dh(n,e[0]),e[1]=dh(s,e[1]),e[2]=dh(a,e[2]),e[3]=dh(i,e[3])}function O5(e,t,n,s,a,i){return t=dh(dh(t,e),dh(s,i)),dh(t<<a|t>>>32-a,n)}function Ja(e,t,n,s,a,i,o){return O5(t&n|~t&s,e,t,a,i,o)}function Qa(e,t,n,s,a,i,o){return O5(t&s|n&~s,e,t,a,i,o)}function ei(e,t,n,s,a,i,o){return O5(t^n^s,e,t,a,i,o)}function ti(e,t,n,s,a,i,o){return O5(n^(t|~s),e,t,a,i,o)}function Xte(e){var t,n=e.length,s=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)kC(s,UXe(e.substring(t-64,t)));e=e.substring(t-64);var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<e.length;t++)a[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(kC(s,a),t=0;t<16;t++)a[t]=0;return a[14]=8*n,kC(s,a),s}function UXe(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}var v9="0123456789abcdef".split("");function zXe(e){for(var t="",n=0;n<4;n++)t+=v9[e>>8*n+4&15]+v9[e>>8*n&15];return t}function qXe(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function SE(e){return Xte(e).map(qXe).join("")}var VXe=function(e){for(var t=0;t<e.length;t++)e[t]=zXe(e[t]);return e.join("")}(Xte("hello"))!="5d41402abc4b2a76b9719d911017c592";function dh(e,t){if(VXe){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}return e+t&4294967295}/** 1034 * @license 1035 * FPDF is released under a permissive license: there is no usage restriction. 1036 * You may embed it freely in your application (commercial or not), with or 1037 * without modifications. 1038 * 1039 * Reference: http://www.fpdf.org/en/script/script37.php 1040 */function kE(e,t){var n,s,a,i;if(e!==n){for(var o=(a=e,i=1+(256/e.length|0),new Array(i+1).join(a)),l=[],c=0;c<256;c++)l[c]=c;var d=0;for(c=0;c<256;c++){var u=l[c];d=(d+u+o.charCodeAt(c))%256,l[c]=l[d],l[d]=u}n=e,s=l}else l=s;var h=t.length,f=0,m=0,x="";for(c=0;c<h;c++)m=(m+(u=l[f=(f+1)%256]))%256,l[f]=l[m],l[m]=u,o=l[(l[f]+l[m])%256],x+=String.fromCharCode(t.charCodeAt(c)^o);return x}/** 1041 * @license 1042 * Licensed under the MIT License. 1043 * http://opensource.org/licenses/mit-license 1044 * Author: Owen Leong (@owenl131) 1045 * Date: 15 Oct 2020 1046 * References: 1047 * https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt 1048 * https://github.com/foliojs/pdfkit/blob/master/lib/security.js 1049 * http://www.fpdf.org/en/script/script37.php 1050 */var y9={print:4,modify:8,copy:16,"annot-forms":32};function eg(e,t,n,s){this.v=1,this.r=2;var a=192;e.forEach(function(l){if(y9.perm!==void 0)throw new Error("Invalid permission: "+l);a+=y9[l]}),this.padding="(¿N^NuÂAd\0NVÿú�\b..\0¶Ãh>Â/\f©þdSiz";var i=(t+this.padding).substr(0,32),o=(n+this.padding).substr(0,32);this.O=this.processOwnerPassword(i,o),this.P=-(1+(255^a)),this.encryptionKey=SE(i+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(s)).substr(0,5),this.U=kE(this.encryptionKey,this.padding)}function tg(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",n=e.length,s=0;s<n;s++){var a=e.charCodeAt(s);t+=a<33||a===35||a===37||a===40||a===41||a===47||a===60||a===62||a===91||a===93||a===123||a===125||a>126?"#"+("0"+a.toString(16)).slice(-2):e[s]}return t}function b9(e){if(En(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(n,s,a){if(a=a||!1,typeof n!="string"||typeof s!="function"||typeof a!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(n)||(t[n]={});var i=Math.random().toString(35);return t[n][i]=[s,!!a],i},this.unsubscribe=function(n){for(var s in t)if(t[s][n])return delete t[s][n],Object.keys(t[s]).length===0&&delete t[s],!0;return!1},this.publish=function(n){if(t.hasOwnProperty(n)){var s=Array.prototype.slice.call(arguments,1),a=[];for(var i in t[n]){var o=t[n][i];try{o[0].apply(e,s)}catch(l){jr.console&&Bn.error("jsPDF PubSub Error",l.message,l)}o[1]&&a.push(i)}a.length&&a.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function N2(e){if(!(this instanceof N2))return new N2(e);var t="opacity,stroke-opacity".split(",");for(var n in e)e.hasOwnProperty(n)&&t.indexOf(n)>=0&&(this[n]=e[n]);this.id="",this.objectNumber=-1}function Zte(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function Vf(e,t,n,s,a){if(!(this instanceof Vf))return new Vf(e,t,n,s,a);this.type=e==="axial"?2:3,this.coords=t,this.colors=n,Zte.call(this,s,a)}function yg(e,t,n,s,a){if(!(this instanceof yg))return new yg(e,t,n,s,a);this.boundingBox=e,this.xStep=t,this.yStep=n,this.stream="",this.cloneIndex=0,Zte.call(this,s,a)}function ar(e){var t,n=typeof arguments[0]=="string"?arguments[0]:"p",s=arguments[1],a=arguments[2],i=arguments[3],o=[],l=1,c=16,d="S",u=null;En(e=e||{})==="object"&&(n=e.orientation,s=e.unit||s,a=e.format||a,i=e.compress||e.compressPdf||i,(u=e.encryption||null)!==null&&(u.userPassword=u.userPassword||"",u.ownerPassword=u.ownerPassword||"",u.userPermissions=u.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),d=e.defaultPathOperation||"S"),o=e.filters||(i===!0?["FlateEncode"]:o),s=s||"mm",n=(""+(n||"P")).toLowerCase();var h=e.putOnlyUsedFonts||!1,f={},m={internal:{},__private__:{}};m.__private__.PubSub=b9;var x="1.3",p=m.__private__.getPdfVersion=function(){return x};m.__private__.setPdfVersion=function(M){x=M};var v={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]};m.__private__.getPageFormats=function(){return v};var g=m.__private__.getPageFormat=function(M){return v[M]};a=a||"a4";var y="compat",b="advanced",w=y;function _(){this.saveGraphicsState(),re(new Ut(at,0,0,-at,0,hf()*at).toString()+" cm"),this.setFontSize(this.getFontSize()/at),d="n",w=b}function C(){this.restoreGraphicsState(),d="S",w=y}var E=m.__private__.combineFontStyleAndFontWeight=function(M,G){if(M=="bold"&&G=="normal"||M=="bold"&&G==400||M=="normal"&&G=="italic"||M=="bold"&&G=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return G&&(M=G==400||G==="normal"?M==="italic"?"italic":"normal":G!=700&&G!=="bold"||M!=="normal"?(G==700?"bold":G)+""+M:"bold"),M};m.advancedAPI=function(M){var G=w===y;return G&&_.call(this),typeof M!="function"||(M(this),G&&C.call(this)),this},m.compatAPI=function(M){var G=w===b;return G&&C.call(this),typeof M!="function"||(M(this),G&&_.call(this)),this},m.isAdvancedAPI=function(){return w===b};var N,k=function(M){if(w!==b)throw new Error(M+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},I=m.roundToPrecision=m.__private__.roundToPrecision=function(M,G){var ue=t||G;if(isNaN(M)||isNaN(ue))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return M.toFixed(ue).replace(/0+$/,"")};N=m.hpf=m.__private__.hpf=typeof c=="number"?function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.hpf");return I(M,c)}:c==="smart"?function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.hpf");return I(M,M>-1&&M<1?16:5)}:function(M){if(isNaN(M))throw new Error("Invalid argument passed to
1050jsPDF.hpf");return I(M,16)};var P=m.f2=m.__private__.f2=function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.f2");return I(M,2)},O=m.__private__.f3=function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.f3");return I(M,3)},A=m.scale=m.__private__.scale=function(M){if(isNaN(M))throw new Error("Invalid argument passed to jsPDF.scale");return w===y?M*at:w===b?M:void 0},R=function(M){return A(function(G){return w===y?hf()-G:w===b?G:void 0}(M))};m.__private__.setPrecision=m.setPrecision=function(M){typeof parseInt(M,10)=="number"&&(t=parseInt(M,10))};var L,z="00000000000000000000000000000000",U=m.__private__.getFileId=function(){return z},$=m.__private__.setFileId=function(M){return z=M!==void 0&&/^[a-fA-F0-9]{32}$/.test(M)?M.toUpperCase():z.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),u!==null&&(Ta=new eg(u.userPermissions,u.userPassword,u.ownerPassword,z)),z};m.setFileId=function(M){return $(M),this},m.getFileId=function(){return U()};var q=m.__private__.convertDateToPDFDate=function(M){var G=M.getTimezoneOffset(),ue=G<0?"+":"-",je=Math.floor(Math.abs(G/60)),Oe=Math.abs(G%60),We=[ue,Z(je),"'",Z(Oe),"'"].join("");return["D:",M.getFullYear(),Z(M.getMonth()+1),Z(M.getDate()),Z(M.getHours()),Z(M.getMinutes()),Z(M.getSeconds()),We].join("")},ne=m.__private__.convertPDFDateToDate=function(M){var G=parseInt(M.substr(2,4),10),ue=parseInt(M.substr(6,2),10)-1,je=parseInt(M.substr(8,2),10),Oe=parseInt(M.substr(10,2),10),We=parseInt(M.substr(12,2),10),ot=parseInt(M.substr(14,2),10);return new Date(G,ue,je,Oe,We,ot,0)},se=m.__private__.setCreationDate=function(M){var G;if(M===void 0&&(M=new Date),M instanceof Date)G=q(M);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(M))throw new Error("Invalid argument passed to jsPDF.setCreationDate");G=M}return L=G},F=m.__private__.getCreationDate=function(M){var G=L;return M==="jsDate"&&(G=ne(L)),G};m.setCreationDate=function(M){return se(M),this},m.getCreationDate=function(M){return F(M)};var V,Z=m.__private__.padd2=function(M){return("0"+parseInt(M)).slice(-2)},de=m.__private__.padd2Hex=function(M){return("00"+(M=M.toString())).substr(M.length)},ve=0,pe=[],_e=[],xe=0,oe=[],we=[],ce=!1,De=_e;m.__private__.setCustomOutputDestination=function(M){ce=!0,De=M};var Ue=function(M){ce||(De=M)};m.__private__.resetCustomOutputDestination=function(){ce=!1,De=_e};var re=m.__private__.out=function(M){return M=M.toString(),xe+=M.length+1,De.push(M),De},et=m.__private__.write=function(M){return re(arguments.length===1?M.toString():Array.prototype.join.call(arguments," "))},kt=m.__private__.getArrayBuffer=function(M){for(var G=M.length,ue=new ArrayBuffer(G),je=new Uint8Array(ue);G--;)je[G]=M.charCodeAt(G);return ue},St=[["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]];m.__private__.getStandardFonts=function(){return St};var Ve=e.fontSize||16;m.__private__.setFontSize=m.setFontSize=function(M){return Ve=w===b?M/at:M,this};var he,ye=m.__private__.getFontSize=m.getFontSize=function(){return w===y?Ve:Ve*at},Ee=e.R2L||!1;m.__private__.setR2L=m.setR2L=function(M){return Ee=M,this},m.__private__.getR2L=m.getR2L=function(){return Ee};var Fe,tt=m.__private__.setZoomMode=function(M){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(M))he=M;else if(isNaN(M)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(M)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+M+'" is not recognized.');he=M}else he=parseInt(M,10)};m.__private__.getZoomMode=function(){return he};var qe,st=m.__private__.setPageMode=function(M){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(M)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+M+'" is not recognized.');Fe=M};m.__private__.getPageMode=function(){return Fe};var Ct=m.__private__.setLayoutMode=function(M){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(M)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+M+'" is not recognized.');qe=M};m.__private__.getLayoutMode=function(){return qe},m.__private__.setDisplayMode=m.setDisplayMode=function(M,G,ue){return tt(M),Ct(G),st(ue),this};var ke={title:"",subject:"",author:"",keywords:"",creator:""};m.__private__.getDocumentProperty=function(M){if(Object.keys(ke).indexOf(M)===-1)throw new Error("Invalid argument passed to
1050jsPDF.getDocumentProperty");return ke[M]},m.__private__.getDocumentProperties=function(){return ke},m.__private__.setDocumentProperties=m.setProperties=m.setDocumentProperties=function(M){for(var G in ke)ke.hasOwnProperty(G)&&M[G]&&(ke[G]=M[G]);return this},m.__private__.setDocumentProperty=function(M,G){if(Object.keys(ke).indexOf(M)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return ke[M]=G};var Ie,at,rt,Gt,gt,Zt={},dr={},Fr=[],Tt={},Br={},tr={},or={},pn=null,xr=0,Bt=[],Zr=new b9(m),sr=e.hotfixes||[],ur={},Gr={},ts=[],Ut=function M(G,ue,je,Oe,We,ot){if(!(this instanceof M))return new M(G,ue,je,Oe,We,ot);isNaN(G)&&(G=1),isNaN(ue)&&(ue=0),isNaN(je)&&(je=0),isNaN(Oe)&&(Oe=1),isNaN(We)&&(We=0),isNaN(ot)&&(ot=0),this._matrix=[G,ue,je,Oe,We,ot]};Object.defineProperty(Ut.prototype,"sx",{get:function(){return this._matrix[0]},set:function(M){this._matrix[0]=M}}),Object.defineProperty(Ut.prototype,"shy",{get:function(){return this._matrix[1]},set:function(M){this._matrix[1]=M}}),Object.defineProperty(Ut.prototype,"shx",{get:function(){return this._matrix[2]},set:function(M){this._matrix[2]=M}}),Object.defineProperty(Ut.prototype,"sy",{get:function(){return this._matrix[3]},set:function(M){this._matrix[3]=M}}),Object.defineProperty(Ut.prototype,"tx",{get:function(){return this._matrix[4]},set:function(M){this._matrix[4]=M}}),Object.defineProperty(Ut.prototype,"ty",{get:function(){return this._matrix[5]},set:function(M){this._matrix[5]=M}}),Object.defineProperty(Ut.prototype,"a",{get:function(){return this._matrix[0]},set:function(M){this._matrix[0]=M}}),Object.defineProperty(Ut.prototype,"b",{get:function(){return this._matrix[1]},set:function(M){this._matrix[1]=M}}),Object.defineProperty(Ut.prototype,"c",{get:function(){return this._matrix[2]},set:function(M){this._matrix[2]=M}}),Object.defineProperty(Ut.prototype,"d",{get:function(){return this._matrix[3]},set:function(M){this._matrix[3]=M}}),Object.defineProperty(Ut.prototype,"e",{get:function(){return this._matrix[4]},set:function(M){this._matrix[4]=M}}),Object.defineProperty(Ut.prototype,"f",{get:function(){return this._matrix[5]},set:function(M){this._matrix[5]=M}}),Object.defineProperty(Ut.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ut.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ut.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ut.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Ut.prototype.join=function(M){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(N).join(M)},Ut.prototype.multiply=function(M){var G=M.sx*this.sx+M.shy*this.shx,ue=M.sx*this.shy+M.shy*this.sy,je=M.shx*this.sx+M.sy*this.shx,Oe=M.shx*this.shy+M.sy*this.sy,We=M.tx*this.sx+M.ty*this.shx+this.tx,ot=M.tx*this.shy+M.ty*this.sy+this.ty;return new Ut(G,ue,je,Oe,We,ot)},Ut.prototype.decompose=function(){var M=this.sx,G=this.shy,ue=this.shx,je=this.sy,Oe=this.tx,We=this.ty,ot=Math.sqrt(M*M+G*G),Yt=(M/=ot)*ue+(G/=ot)*je;ue-=M*Yt,je-=G*Yt;var Ht=Math.sqrt(ue*ue+je*je);return Yt/=Ht,M*(je/=Ht)<G*(ue/=Ht)&&(M=-M,G=-G,Yt=-Yt,ot=-ot),{scale:new Ut(ot,0,0,Ht,0,0),translate:new Ut(1,0,0,1,Oe,We),rotate:new Ut(M,G,-G,M,0,0),skew:new Ut(1,0,Yt,1,0,0)}},Ut.prototype.toString=function(M){return this.join(" ")},Ut.prototype.inversed=function(){var M=this.sx,G=this.shy,ue=this.shx,je=this.sy,Oe=this.tx,We=this.ty,ot=1/(M*je-G*ue),Yt=je*ot,Ht=-G*ot,kr=-ue*ot,Lr=M*ot;return new Ut(Yt,Ht,kr,Lr,-Yt*Oe-kr*We,-Ht*Oe-Lr*We)},Ut.prototype.applyToPoint=function(M){var G=M.x*this.sx+M.y*this.shx+this.tx,ue=M.x*this.shy+M.y*this.sy+this.ty;return new uf(G,ue)},Ut.prototype.applyToRectangle=function(M){var G=this.applyToPoint(M),ue=this.applyToPoint(new uf(M.x+M.w,M.y+M.h));return new Fv(G.x,G.y,ue.x-G.x,ue.y-G.y)},Ut.prototype.clone=function(){var M=this.sx,G=this.shy,ue=this.shx,je=this.sy,Oe=this.tx,We=this.ty;return new Ut(M,G,ue,je,Oe,We)},m.Matrix=Ut;var Ur=m.matrixMult=function(M,G){return G.multiply(M)},vs=new Ut(1,0,0,1,0,0);m.unitMatrix=m.identityMatrix=vs;var us=function(M,G){if(!Br[M]){var ue=(G instanceof Vf?"Sh":"P")+(Object.keys(Tt).length+1).toString(10);G.id=ue,Br[M]=ue,Tt[ue]=G,Zr.publish("addPattern",G)}};m.ShadingPattern=Vf,m.TilingPattern=yg,m.addShadingPattern=function(M,G){return k("addShadingPattern()"),us(M,G),this},m.beginTilingPattern=function(M){k("beginTilingPattern()"),Bv(M.boundingBox[0],M.boundingBox[1],M.boundingBox[2]-M.boundingBox[0],M.boundingBox[3]-M.boundingBox[1],M.matrix
vendor: 14,989 bytes, lines 1050-1055
1050)},m.endTilingPattern=function(M,G){k("endTilingPattern()"),G.stream=we[V].join(` 1051`),us(M,G),Zr.publish("endTilingPattern",G),ts.pop().restore()};var Rs,Cs=m.__private__.newObject=function(){var M=ja();return Ea(M,!0),M},ja=m.__private__.newObjectDeferred=function(){return ve++,pe[ve]=function(){return xe},ve},Ea=function(M,G){return G=typeof G=="boolean"&&G,pe[M]=xe,G&&re(M+" 0 obj"),M},of=m.__private__.newAdditionalObject=function(){var M={objId:ja(),content:""};return oe.push(M),M},mu=ja(),jl=ja(),pc=m.__private__.decodeColorString=function(M){var G=M.split(" ");if(G.length!==2||G[1]!=="g"&&G[1]!=="G")G.length!==5||G[4]!=="k"&&G[4]!=="K"||(G=[(1-G[0])*(1-G[3]),(1-G[1])*(1-G[3]),(1-G[2])*(1-G[3]),"r"]);else{var ue=parseFloat(G[0]);G=[ue,ue,ue,"r"]}for(var je="#",Oe=0;Oe<3;Oe++)je+=("0"+Math.floor(255*parseFloat(G[Oe])).toString(16)).slice(-2);return je},wl=m.__private__.encodeColorString=function(M){var G;typeof M=="string"&&(M={ch1:M});var ue=M.ch1,je=M.ch2,Oe=M.ch3,We=M.ch4,ot=M.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof ue=="string"&&ue.charAt(0)!=="#"){var Yt=new Kte(ue);if(Yt.ok)ue=Yt.toHex();else if(!/^\d*\.?\d*$/.test(ue))throw new Error('Invalid color "'+ue+'" passed to jsPDF.encodeColorString.')}if(typeof ue=="string"&&/^#[0-9A-Fa-f]{3}$/.test(ue)&&(ue="#"+ue[1]+ue[1]+ue[2]+ue[2]+ue[3]+ue[3]),typeof ue=="string"&&/^#[0-9A-Fa-f]{6}$/.test(ue)){var Ht=parseInt(ue.substr(1),16);ue=Ht>>16&255,je=Ht>>8&255,Oe=255&Ht}if(je===void 0||We===void 0&&ue===je&&je===Oe)G=typeof ue=="string"?ue+" "+ot[0]:M.precision===2?P(ue/255)+" "+ot[0]:O(ue/255)+" "+ot[0];else if(We===void 0||En(We)==="object"){if(We&&!isNaN(We.a)&&We.a===0)return["1.","1.","1.",ot[1]].join(" ");G=typeof ue=="string"?[ue,je,Oe,ot[1]].join(" "):M.precision===2?[P(ue/255),P(je/255),P(Oe/255),ot[1]].join(" "):[O(ue/255),O(je/255),O(Oe/255),ot[1]].join(" ")}else G=typeof ue=="string"?[ue,je,Oe,We,ot[2]].join(" "):M.precision===2?[P(ue),P(je),P(Oe),P(We),ot[2]].join(" "):[O(ue),O(je),O(Oe),O(We),ot[2]].join(" ");return G},Nl=m.__private__.getFilters=function(){return o},Wo=m.__private__.putStream=function(M){var G=(M=M||{}).data||"",ue=M.filters||Nl(),je=M.alreadyAppliedFilters||[],Oe=M.addLength1||!1,We=G.length,ot=M.objectId,Yt=function(rs){return rs};if(u!==null&&ot===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");u!==null&&(Yt=Ta.encryptor(ot,0));var Ht={};ue===!0&&(ue=["FlateEncode"]);var kr=M.additionalKeyValues||[],Lr=(Ht=ar.API.processDataByFilters!==void 0?ar.API.processDataByFilters(G,ue):{data:G,reverseChain:[]}).reverseChain+(Array.isArray(je)?je.join(" "):je.toString());if(Ht.data.length!==0&&(kr.push({key:"Length",value:Ht.data.length}),Oe===!0&&kr.push({key:"Length1",value:We})),Lr.length!=0)if(Lr.split("/").length-1==1)kr.push({key:"Filter",value:Lr});else{kr.push({key:"Filter",value:"["+Lr+"]"});for(var ln=0;ln<kr.length;ln+=1)if(kr[ln].key==="DecodeParms"){for(var Ys=[],$n=0;$n<Ht.reverseChain.split("/").length-1;$n+=1)Ys.push("null");Ys.push(kr[ln].value),kr[ln].value="["+Ys.join(" ")+"]"}}re("<<");for(var Rn=0;Rn<kr.length;Rn++)re("/"+kr[Rn].key+" "+kr[Rn].value);re(">>"),Ht.data.length!==0&&(re("stream"),re(Yt(Ht.data)),re("endstream"))},lf=m.__private__.putPage=function(M){var G=M.number,ue=M.data,je=M.objId,Oe=M.contentsObjId;Ea(je,!0),re("<</Type /Page"),re("/Parent "+M.rootDictionaryObjId+" 0 R"),re("/Resources "+M.resourceDictionaryObjId+" 0 R"),re("/MediaBox ["+parseFloat(N(M.mediaBox.bottomLeftX))+" "+parseFloat(N(M.mediaBox.bottomLeftY))+" "+N(M.mediaBox.topRightX)+" "+N(M.mediaBox.topRightY)+"]"),M.cropBox!==null&&re("/CropBox ["+N(M.cropBox.bottomLeftX)+" "+N(M.cropBox.bottomLeftY)+" "+N(M.cropBox.topRightX)+" "+N(M.cropBox.topRightY)+"]"),M.bleedBox!==null&&re("/BleedBox ["+N(M.bleedBox.bottomLeftX)+" "+N(M.bleedBox.bottomLeftY)+" "+N(M.bleedBox.topRightX)+" "+N(M.bleedBox.topRightY)+"]"),M.trimBox!==null&&re("/TrimBox ["+N(M.trimBox.bottomLeftX)+" "+N(M.trimBox.bottomLeftY)+" "+N(M.trimBox.topRightX)+" "+N(M.trimBox.topRightY)+"]"),M.artBox!==null&&re("/ArtBox ["+N(M.artBox.bottomLeftX)+" "+N(M.artBox.bottomLeftY)+" "+N(M.artBox.topRightX)+" "+N(M.artBox.topRightY)+"]"),typeof M.userUnit=="number"&&M.userUnit!==1&&re("/UserUnit "+M.userUnit),Zr.publish("putPage",{objId:je,pageContext:Bt[G],pageNumber:G,page:ue}),re("/Contents "+Oe+" 0 R"),re(">>"),re("endobj");var We=ue.join(` 1052`);return w===b&&(We+=` 1053Q`),Ea(Oe,!0),Wo({data:We,filters:Nl(),objectId:Oe}),re("endobj"),je},gc=m.__private__.putPages=function(){var M,G,ue=[];for(M=1;M<=xr;M++)Bt[M].objId=ja(),Bt[M].contentsObjId=ja();for(M=1;M<=xr;M++)ue.push(lf({number:M,data:we[M],objId:Bt[M].objId,contentsObjId:Bt[M].contentsObjId,mediaBox:Bt[M].mediaBox,cropBox:Bt[M].cropBox,bleedBox:Bt[M].bleedBox,trimBox:Bt[M].trimBox,artBox:Bt[M].artBox,userUnit:Bt[M].userUnit,rootDictionaryObjId:mu,resourceDictionaryObjId:jl}));Ea(mu,!0),re("<</Type /Pages");var je="/Kids [";for(G=0;G<xr;G++)je+=ue[G]+" 0 R ";re(je+"]"),re("/Count "+xr),re(">>"),re("endobj"),Zr.publish("postPutPages")},cf=function(M){Zr.publish("putFont",{font:M,out:re,newObject:Cs,putStream:Wo}),M.isAlreadyPutted!==!0&&(M.objectNumber=Cs(),re("<<"),re("/Type /Font"),re("/BaseFont /"+tg(M.postScriptName)),re("/Subtype /Type1"),typeof M.encoding=="string"&&re("/Encoding /"+M.encoding),re("/FirstChar 32"),re("/LastChar 255"),re(">>"),re("endobj"))},lp=function(M){M.objectNumber=Cs();var G=[];G.push({key:"Type",value:"/XObject"}),G.push({key:"Subtype",value:"/Form"}),G.push({key:"BBox",value:"["+[N(M.x),N(M.y),N(M.x+M.width),N(M.y+M.height)].join(" ")+"]"}),G.push({key:"Matrix",value:"["+M.matrix.toString()+"]"});var ue=M.pages[1].join(` 1054`);Wo({data:ue,additionalKeyValues:G,objectId:M.objectNumber}),re("endobj")},cp=function(M,G){G||(G=21);var ue=Cs(),je=function(ot,Yt){var Ht,kr=[],Lr=1/(Yt-1);for(Ht=0;Ht<1;Ht+=Lr)kr.push(Ht);if(kr.push(1),ot[0].offset!=0){var ln={offset:0,color:ot[0].color};ot.unshift(ln)}if(ot[ot.length-1].offset!=1){var Ys={offset:1,color:ot[ot.length-1].color};ot.push(Ys)}for(var $n="",Rn=0,rs=0;rs<kr.length;rs++){for(Ht=kr[rs];Ht>ot[Rn+1].offset;)Rn++;var ys=ot[Rn].offset,bs=(Ht-ys)/(ot[Rn+1].offset-ys),Wa=ot[Rn].color,md=ot[Rn+1].color;$n+=de(Math.round((1-bs)*Wa[0]+bs*md[0]).toString(16))+de(Math.round((1-bs)*Wa[1]+bs*md[1]).toString(16))+de(Math.round((1-bs)*Wa[2]+bs*md[2]).toString(16))}return $n.trim()}(M.colors,G),Oe=[];Oe.push({key:"FunctionType",value:"0"}),Oe.push({key:"Domain",value:"[0.0 1.0]"}),Oe.push({key:"Size",value:"["+G+"]"}),Oe.push({key:"BitsPerSample",value:"8"}),Oe.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Oe.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Wo({data:je,additionalKeyValues:Oe,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:ue}),re("endobj"),M.objectNumber=Cs(),re("<< /ShadingType "+M.type),re("/ColorSpace /DeviceRGB");var We="/Coords ["+N(parseFloat(M.coords[0]))+" "+N(parseFloat(M.coords[1]))+" ";M.type===2?We+=N(parseFloat(M.coords[2]))+" "+N(parseFloat(M.coords[3])):We+=N(parseFloat(M.coords[2]))+" "+N(parseFloat(M.coords[3]))+" "+N(parseFloat(M.coords[4]))+" "+N(parseFloat(M.coords[5])),re(We+="]"),M.matrix&&re("/Matrix ["+M.matrix.toString()+"]"),re("/Function "+ue+" 0 R"),re("/Extend [true true]"),re(">>"),re("endobj")},dp=function(M,G){var ue=ja(),je=Cs();G.push({resourcesOid:ue,objectOid:je}),M.objectNumber=je;var Oe=[];Oe.push({key:"Type",value:"/Pattern"}),Oe.push({key:"PatternType",value:"1"}),Oe.push({key:"PaintType",value:"1"}),Oe.push({key:"TilingType",value:"1"}),Oe.push({key:"BBox",value:"["+M.boundingBox.map(N).join(" ")+"]"}),Oe.push({key:"XStep",value:N(M.xStep)}),Oe.push({key:"YStep",value:N(M.yStep)}),Oe.push({key:"Resources",value:ue+" 0 R"}),M.matrix&&Oe.push({key:"Matrix",value:"["+M.matrix.toString()+"]"}),Wo({data:M.stream,additionalKeyValues:Oe,objectId:M.objectNumber}),re("endobj")},L5=function(M){for(var G in M.objectNumber=Cs(),re("<<"),M)switch(G){case"opacity":re("/ca "+P(M[G]));break;case"stroke-opacity":re("/CA "+P(M[G]))}re(">>"),re("endobj")},Tv=function(M){Ea(M.resourcesOid,!0),re("<<"),re("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var G in re("/Font <<"),Zt)Zt.hasOwnProperty(G)&&(h===!1||h===!0&&f.hasOwnProperty(G))&&re("/"+G+" "+Zt[G].objectNumber+" 0 R");re(">>")}(),function(){if(Object.keys(Tt).length>0){for(var G in re("/Shading <<"),Tt)Tt.hasOwnProperty(G)&&Tt[G]instanceof Vf&&Tt[G].objectNumber>=0&&re("/"+G+" "+Tt[G].objectNumber+" 0 R");Zr.publish("putShadingPatternDict"),re(">>")}}(),function(G){if(Object.keys(Tt).length>0){for(var ue in re("/Pattern <<"),Tt)Tt.hasOwnProperty(ue)&&Tt[ue]instanceof m.TilingPattern&&Tt[ue].objectNumber>=0&&Tt[ue].objectNumber<G&&re("/"+ue+" "+Tt[ue].objectNumber+" 0 R");Zr.publish("putTilingPatternDict"),re(">>")}}(M.objectOid),function(){if(Object.keys(tr).length>0){var G;for(G in re("/ExtGState <<"),tr)tr.hasOwnProperty(G)&&tr[G].objectNumber>=0&&re("/"+G+" "+tr[G].objectNumber+" 0 R");Zr.publish("putGStateDict"),re(">>")}}(),function(){for(var G in re("/XObject <<"),ur)ur.hasOwnProperty(G)&&ur[G].objectNumber>=0&&re("/"+G+" "+ur[G].objectNumber+" 0 R");Zr.publish("putXobjectDict"),re(">>")}(),re(">>"),re("endobj")},Xj=function(M){dr[M.fontName]=dr[M.fontName]||{},dr[M.fontName][M.fontStyle]=M.id},Zj=function(M,G,ue,je,Oe){var We={id:"F"+(Object.keys(Zt).length+1).toString(10),postScriptName:M,fontName:G,fontStyle:ue,encoding:je,isStandardFont:Oe||!1,metadata:{}};return Zr.publish("addFont",{font:We,instance:this}),Zt[We.id]=We,Xj(We),We.id},Ho=m.__private__.pdfEscape=m.pdfEscape=function(M,G){return function(ue,je){var Oe,We,ot,Yt,Ht,kr,Lr,ln,Ys;if(ot=(je=je||{}).sourceEncoding||"Unicode",Ht=je.outputEncoding,(je.autoencode||Ht)&&Zt[Ie].metadata&&Zt[Ie].metadata[ot]&&Zt[Ie].metadata[ot].encoding&&(Yt=Zt[Ie].metadata[ot].encoding,!Ht&&Zt[Ie].encoding&&(Ht=Zt[Ie].encoding),!Ht&&Yt.codePages&&(Ht=Yt.codePages[0]),typeof Ht=="string"&&(Ht=Yt[Ht]),Ht)){for(Lr=!1,kr=[],Oe=0,We=ue.length;Oe<We;Oe++)(ln=Ht[ue.charCodeAt(Oe)])?kr.push(String.fromCharCode(ln)):kr.push(ue[Oe]),kr[Oe].charCodeAt(0)>>8&&(Lr=!0);ue=kr.join("")}for(Oe=ue.length;Lr===void 0&&Oe!==0;)ue.charCodeAt(Oe-1)>>8&&(Lr=!0),Oe--;if(!Lr)return ue;for(kr=je.noBOM?[]:[254,255],Oe=0,We=ue.length;Oe<We;Oe++){if((Ys=(ln=ue.charCodeAt(Oe))>>8)>>8)throw new Error("Character at position "+Oe+" of string '"+ue+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");kr.push(Ys),kr.push(ln-(Ys<<8))}return String.fromCharCode.apply(void 0,kr)}(M,G).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Ov=m.__private__.beginPage=function(M){we[++xr]=[],Bt[xr]={objId:0,contentsObjId:0,userUnit:Number(l),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(M[0]),topRightY:Number(M[1])}},Qj(xr),Ue(we[V])},Jj=function(M,G){var ue,je,Oe;switch(n=G||n,typeof M=="string"&&(ue=g(M.toLowerCase()),Array.isArray(ue)&&(je=ue[0],Oe=ue[1])),Array.isArray(M)&&(je=M[0]*at,Oe=M[1]*at),isNaN(je)&&(je=a[0],Oe=a[1]),(je>14400||Oe>14400)&&(Bn.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),je=Math.min(14400,je),Oe=Math.min(14400,Oe)),a=[je,Oe],n.substr(0,1)){case"l":Oe>je&&(a=[Oe,je]);break;case"p":je>Oe&&(a=[Oe,je])}Ov(a),q5(br),re(gp),Dv!==0&&re(Dv+" J"),xu!==0&&re(xu+" j"),Zr.publish("addPage",{pageNumber:xr})},Lv=function(M){M>0&&M<=xr&&(we.splice(M,1),Bt.splice(M,1),xr--,V>xr&&(V=xr),this.setPage(V))},Qj=function(M){M>0&&M<=xr&&(V=M)},ew=m.__private__.getNumberOfPages=m.getNumberOfPages=function(){return we.length-1},tw=function(M,G,ue){var je,Oe=void 0;return ue=ue||{},M=M!==void 0?M:Zt[Ie].fontName,G=G!==void 0?G:Zt[Ie].fontStyle,je=M.toLowerCase(),dr[je]!==void 0&&dr[je][G]!==void 0?Oe=dr[je][G]:dr[M]!==void 0&&dr[M][G]!==void 0?Oe=dr[M][G]:ue.disableWarning===!1&&Bn.warn("Unable to look up font label for font '"+M+"', '"+G+"'. Refer to getFontList() for available fonts."),Oe||ue.noFallback||(Oe=dr.times[G])==null&&(Oe=dr.times.normal),Oe},xc=m.__private__.putInfo=function(){var M=Cs(),G=function(je){return je};for(var ue in u!==null&&(G=Ta.encryptor(M,0)),re("<<"),re("/Producer ("+Ho(G("jsPDF "+ar.version))+")"),ke)ke.hasOwnProperty(ue)&&ke[ue]&&re("/"+ue.substr(0,1).toUpperCase()+ue.substr(1)+" ("+Ho(G(ke[ue]))+")");re("/CreationDate ("+Ho(G(L))+")"),re(">>"),re("endobj")},up=m.__private__.putCatalog=function(M){var G=(M=M||{}).rootDictionaryObjId||mu;switch(Cs(),re("<<"),re("/Type /Catalog"),re("/Pages "+G+" 0 R"),he||(he="fullwidth"),he){case"fullwidth":re("/OpenAction [3 0 R /FitH null]");break;case"fullheight":re("/OpenAction [3 0 R /FitV null]");break;case"fullpage":re("/OpenAction [3 0 R /Fit]");break;case"original":re("/OpenAction [3 0 R /XYZ null null 1]");break;default:var ue=""+he;ue.substr(ue.length-1)==="%"&&(he=parseInt(he)/100),typeof he=="number"&&re("/OpenAction [3 0 R /XYZ null null "+P(he)+"]")}switch(qe||(qe="continuous"),qe){case"continuous":re("/PageLayout /OneColumn");break;case"single":re("/PageLayout /SinglePage");break;case"two":case"twoleft":re("/PageLayout /TwoColumnLeft");break;case"tworight":re("/PageLayout /TwoColumnRight")}Fe&&re("/PageMode /"+Fe),Zr.publish("putCatalog"),re(">>"),re("endobj")},I5=m.__private__.putTrailer=function(){re("trailer"),re("<<"),re("/Size "+(ve+1)),re("/Root "+ve+" 0 R"),re("/Info "+(ve-1)+" 0 R"),u!==null&&re("/Encrypt "+Ta.oid+" 0 R"),re("/ID [ <"+z+"> <"+z+"> ]"),re(">>")},Gs=m.__private__.putHeader=function(){re("%PDF-"+x),re("%ºÃˆ ")},rw=m.__private__.putXRef=function(){var M="0000000000";re("xref"),re("0 "+(ve+1)),re("0000000000 65535 f ");for(var G=1;G<=ve;G++)typeof pe[G]=="function"?re((M+pe[G]()).slice(-10)+" 00000 n "):pe[G]!==void 0?re((M+pe[G]).slice(-10)+" 00000 n "):re("0000000000 00000 n ")},vc=m.__private__.buildDocument=function(){var M;ve=0,xe=0,_e=[],pe=[],oe=[],mu=ja(),jl=ja(),Ue(_e),Zr.publish("buildDocument"),Gs(),gc(),function(){Zr.publish("putAdditionalObjects");for(var ue=0;ue<oe.length;ue++){var je=oe[ue];Ea(je.objId,!0),re(je.content),re("endobj")}Zr.publish("postPutAdditionalObjects")}(),M=[],function(){for(var ue in Zt)Zt.hasOwnProperty(ue)&&(h===!1||h===!0&&f.hasOwnProperty(ue))&&cf(Zt[ue])}(),function(){var ue;for(ue in tr)tr.hasOwnProperty(ue)&&L5(tr[ue])}(),function(){for(var ue in ur)ur.hasOwnProperty(ue)&&lp(ur[ue])}(),function(ue){var je;for(je in Tt)Tt.hasOwnProperty(je)&&(Tt[je]instanceof Vf?cp(Tt[je]):Tt[je]instanceof yg&&dp(Tt[je],ue))}(M),Zr.publish("putResources"),M.forEach(Tv),Tv({resourcesOid:jl,objectOid:Number.MAX_SAFE_INTEGER}),Zr.publish("postPutResources"),u!==null&&(Ta.oid=Cs(),re("<<"),re("/Filter /Standard"),re("/V "+Ta.v),re("/R "+Ta.r),re("/U <"+Ta.toHexString(Ta.U)+">"),re("/O <"+Ta.toHexString(Ta.O)+">"),re("/P "+Ta.P),re(">>"),re("endobj")),xc(),up();var G=xe;return rw(),I5(),re("startxref"),re(""+G),re("%%EOF"),Ue(we[V]),_e.join(` 1055`)},hp=m.__private__.getBlob=function(M){return new Blob([kt(M)],{t
1055ype:"application/pdf"})},Iv=function(M){for(;M.firstChild;)M.removeChild(M.firstChild)},uo=function(M){var G,ue=M.document,je=ue.documentElement,Oe=ue.head,We=ue.body;return Oe||(Oe=ue.createElement("head"),je.appendChild(Oe)),We||(We=ue.createElement("body"),je.appendChild(We)),Iv(Oe),Iv(We),(G=ue.createElement("style")).appendChild(ue.createTextNode("html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;}")),Oe.appendChild(G),{document:ue,body:We}},fp=m.output=m.__private__.output=(Rs=function(M,G){switch(typeof(G=G||{})=="string"?G={filename:G}:G.filename=G.filename||"generated.pdf",M){case void 0:return vc();case"save":m.save(G.filename);break;case"arraybuffer":return kt(vc());case"blob":return hp(vc());case"bloburi":case"bloburl":if(jr.URL!==void 0&&typeof jr.URL.createObjectURL=="function")return jr.URL&&jr.URL.createObjectURL(hp(vc()))||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 ue="",je=vc();try{ue=x9(je)}catch{ue=x9(unescape(encodeURIComponent(je)))}return"data:application/pdf;filename="+encodeURIComponent(G.filename)+";base64,"+ue;case"pdfobjectnewwindow":if(Object.prototype.toString.call(jr)==="[object Window]"){var Oe="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",We=!G.pdfObjectUrl;We||(Oe=G.pdfObjectUrl);var ot=jr.open();if(ot!==null){var Yt=uo(ot),Ht=Yt.document.createElement("script"),kr=this;Ht.src=Oe,We&&(Ht.integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==",Ht.crossOrigin="anonymous"),Ht.onload=function(){ot.PDFObject.embed(kr.output("dataurlstring"),G)},Yt.body.appendChild(Ht)}return ot}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(jr)==="[object Window]"){var Lr=G.pdfJsUrl||"examples/PDF.js/web/viewer.html",ln=jr.open();if(ln!==null){var Ys=uo(ln),$n=Ys.document.createElement("iframe"),Rn=Lr.indexOf("?")===-1?"?":"&";kr=this,$n.id="pdfViewer",$n.width="500px",$n.height="400px",$n.src=Lr+Rn+"file=&downloadName="+encodeURIComponent(G.filename),$n.onload=function(){ln.document.title=G.filename,$n.contentWindow.PDFViewerApplication.open(kr.output("bloburl"))},Ys.body.appendChild($n)}return ln}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(jr)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var rs=jr.open();if(rs!==null){var ys=uo(rs),bs=ys.document.createElement("iframe");bs.src=this.output("datauristring",G),ys.body.appendChild(bs),rs.document.title=G.filename}if(rs||typeof safari>"u")return rs;break;case"datauri":case"dataurl":return jr.document.location.href=this.output("datauristring",G);default:return null}},Rs.foo=function(){try{return Rs.apply(this,arguments)}catch(ue){var M=ue.stack||"";~M.indexOf(" at ")&&(M=M.split(" at ")[1]);var G="Error in function "+M.split(` 1056`)[0].split("<")[0]+": "+ue.message;if(!jr.console)throw new Error(G);jr.console.error(G,ue),jr.alert&&alert(G)}},Rs.foo.bar=Rs,Rs.foo),cd=function(M){return Array.isArray(sr)===!0&&sr.indexOf(M)>-1};switch(s){case"pt":at=1;break;case"mm":at=72/25.4;break;case"cm":at=72/2.54;break;case"in":at=72;break;case"px":at=cd("px_scaling")==1?.75:96/72;break;case"pc":case"em":at=12;break;case"ex":at=6;break;default:if(typeof s!="number")throw new Error("Invalid unit: "+s);at=s}var Ta=null;se(),$();var nw=m.__private__.getPageInfo=m.getPageInfo=function(M){if(isNaN(M)||M%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:Bt[M].objId,pageNumber:M,pageContext:Bt[M]}},R5=m.__private__.getPageInfoByObjId=function(M){if(isNaN(M)||M%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var G in Bt)if(Bt[G].objId===M)break;return nw(G)},M5=m.__private__.getCurrentPageInfo=m.getCurrentPageInfo=function(){return{objId:Bt[V].objId,pageNumber:V,pageContext:Bt[V]}};m.addPage=function(){return Jj.apply(this,arguments),this},m.setPage=function(){return Qj.apply(this,arguments),Ue.call(this,we[V]),this},m.insertPage=function(M){return this.addPage(),this.movePage(V,M),this},m.movePage=function(M,G){var ue,je;if(M>G){ue=we[M],je=Bt[M];for(var Oe=M;Oe>G;Oe--)we[Oe]=we[Oe-1],Bt[Oe]=Bt[Oe-1];we[G]=ue,Bt[G]=je,this.setPage(G)}else if(M<G){ue=we[M],je=Bt[M];for(var We=M;We<G;We++)we[We]=we[We+1],Bt[We]=Bt[We+1];we[G]=ue,Bt[G]=je,this.setPage(G)}return this},m.deletePage=function(){return Lv.apply(this,arguments),this},m.__private__.text=m.text=function(M,G,ue,je,Oe){var We,ot,Yt,Ht,kr,Lr,ln,Ys,$n,Rn=(je=je||{}).scope||this;if(typeof M=="number"&&typeof G=="number"&&(typeof ue=="string"||Array.isArray(ue))){var rs=ue;ue=G,G=M,M=rs}if(arguments[3]instanceof Ut==0?(Yt=arguments[4],Ht=arguments[5],En(ln=arguments[3])==="object"&&ln!==null||(typeof Yt=="string"&&(Ht=Yt,Yt=null),typeof ln=="string"&&(Ht=ln,ln=null),typeof ln=="number"&&(Yt=ln,ln=null),je={flags:ln,angle:Yt,align:Ht})):(k("The transform parameter of text() with a Matrix value"),$n=Oe),isNaN(G)||isNaN(ue)||M==null)throw new Error("Invalid arguments passed to
1056jsPDF.text");if(M.length===0)return Rn;var ys,bs="",Wa=typeof je.lineHeightFactor=="number"?je.lineHeightFactor:df,md=Rn.internal.scaleFactor;function Uv(Vn){return Vn=Vn.split(" ").join(Array(je.TabLen||9).join(" ")),Ho(Vn,ln)}function ff(Vn){for(var Wn,Ms=Vn.concat(),ta=[],gd=Ms.length;gd--;)typeof(Wn=Ms.shift())=="string"?ta.push(Wn):Array.isArray(Vn)&&(Wn.length===1||Wn[1]===void 0&&Wn[2]===void 0)?ta.push(Wn[0]):ta.push([Wn[0],Wn[1],Wn[2]]);return ta}function mf(Vn,Wn){var Ms;if(typeof Vn=="string")Ms=Wn(Vn)[0];else if(Array.isArray(Vn)){for(var ta,gd,Gv=Vn.concat(),Ap=[],fw=Gv.length;fw--;)typeof(ta=Gv.shift())=="string"?Ap.push(Wn(ta)[0]):Array.isArray(ta)&&typeof ta[0]=="string"&&(gd=Wn(ta[0],ta[1],ta[2]),Ap.push([gd[0],gd[1],gd[2]]));Ms=Ap}return Ms}var vu=!1,pf=!0;if(typeof M=="string")vu=!0;else if(Array.isArray(M)){var bp=M.concat();ot=[];for(var jp,Ha=bp.length;Ha--;)(typeof(jp=bp.shift())!="string"||Array.isArray(jp)&&typeof jp[0]!="string")&&(pf=!1);vu=pf}if(vu===!1)throw new Error('Type of text must be string or Array. "'+M+'" is not recognized.');typeof M=="string"&&(M=M.match(/[\r?\n]/)?M.split(/\r\n|\r|\n/g):[M]);var gf=Ve/Rn.internal.scaleFactor,xf=gf*(Wa-1);switch(je.baseline){case"bottom":ue-=xf;break;case"top":ue+=gf-xf;break;case"hanging":ue+=gf-2*xf;break;case"middle":ue+=gf/2-xf}if((Lr=je.maxWidth||0)>0&&(typeof M=="string"?M=Rn.splitTextToSize(M,Lr):Object.prototype.toString.call(M)==="[object Array]"&&(M=M.reduce(function(Vn,Wn){return Vn.concat(Rn.splitTextToSize(Wn,Lr))},[]))),We={text:M,x:G,y:ue,options:je,mutex:{pdfEscape:Ho,activeFontKey:Ie,fonts:Zt,activeFontSize:Ve}},Zr.publish("preProcessText",We),M=We.text,Yt=(je=We.options).angle,$n instanceof Ut==0&&Yt&&typeof Yt=="number"){Yt*=Math.PI/180,je.rotationDirection===0&&(Yt=-Yt),w===b&&(Yt=-Yt);var zv=Math.cos(Yt),jc=Math.sin(Yt);$n=new Ut(zv,jc,-jc,zv,0,0)}else Yt&&Yt instanceof Ut&&($n=Yt);w!==b||$n||($n=vs),(kr=je.charSpace||xp)!==void 0&&(bs+=N(A(kr))+` Tc 1057`,this.setCharSpace(this.getCharSpace()||0)),(Ys=je.horizontalScale)!==void 0&&(bs+=N(100*Ys)+` Tz 1058`),je.lang;var fi=-1,uw=je.renderingMode!==void 0?je.renderingMode:je.stroke,wp=Rn.internal.getCurrentPageInfo().pageContext;switch(uw){case 0:case!1:case"fill":fi=0;break;case 1:case!0:case"stroke":fi=1;break;case 2:case"fillThenStroke":fi=2;break;case 3:case"invisible":fi=3;break;case 4:case"fillAndAddForClipping":fi=4;break;case 5:case"strokeAndAddPathForClipping":fi=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":fi=6;break;case 7:case"addToPathForClipping":fi=7}var hw=wp.usedRenderingMode!==void 0?wp.usedRenderingMode:-1;fi!==-1?bs+=fi+` Tr 1059`:hw!==-1&&(bs+=`0 Tr 1060`),fi!==-1&&(wp.usedRenderingMode=fi),Ht=je.align||"left";var Go,vf=Ve*Wa,qv=Rn.internal.pageSize.getWidth(),Np=Zt[Ie];kr=je.charSpace||xp,Lr=je.maxWidth||0,ln=Object.assign({autoencode:!0,noBOM:!0},je.flags);var yf=[],Vv=function(Vn){return Rn.getStringUnitWidth(Vn,{font:Np,charSpace:kr,fontSize:Ve,doKerning:!1})*Ve/md};if(Object.prototype.toString.call(M)==="[object Array]"){var mi;ot=ff(M),Ht!=="left"&&(Go=ot.map(Vv));var $i,_p=0;if(Ht==="right"){G-=Go[0],M=[],Ha=ot.length;for(var yu=0;yu<Ha;yu++)yu===0?($i=dd(G),mi=ud(ue)):($i=A(_p-Go[yu]),mi=-vf),M.push([ot[yu],$i,mi]),_p=Go[yu]}else if(Ht==="center"){G-=Go[0]/2,M=[],Ha=ot.length;for(var bu=0;bu<Ha;bu++)bu===0?($i=dd(G),mi=ud(ue)):($i=A((_p-Go[bu])/2),mi=-vf),M.push([ot[bu],$i,mi]),_p=Go[bu]}else if(Ht==="left"){M=[],Ha=ot.length;for(var Sp=0;Sp<Ha;Sp++)M.push(ot[Sp])}else if(Ht==="justify"&&Np.encoding==="Identity-H"){M=[],Ha=ot.length,Lr=Lr!==0?Lr:qv;for(var bf=0,Ks=0;Ks<Ha;Ks++)if(mi=Ks===0?ud(ue):-vf,$i=Ks===0?dd(G):bf,Ks<Ha-1){var Z5=A((Lr-Go[Ks])/(ot[Ks].split(" ").length-1)),wc=ot[Ks].split(" ");M.push([wc[0]+" ",$i,mi]),bf=0;for(var _l=1;_l<wc.length;_l++){var jf=(Vv(wc[_l-1]+" "+wc[_l])-Vv(wc[_l]))*md+Z5;_l==wc.length-1?M.push([wc[_l],jf,0]):M.push([wc[_l]+" ",jf,0]),bf-=jf}}else M.push([ot[Ks],$i,mi]);M.push(["",bf,0])}else{if(Ht!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(M=[],Ha=ot.length,Lr=Lr!==0?Lr:qv,Ks=0;Ks<Ha;Ks++){mi=Ks===0?ud(ue):-vf,$i=Ks===0?dd(G):0;var Wv=ot[Ks].split(" ").length-1,Hv=Wv>
vendor: 4,554 bytes, lines 1060-1070
10600?(Lr-Go[Ks])/Wv:0;Ks<Ha-1?yf.push(N(A(Hv))):yf.push(0),M.push([ot[Ks],$i,mi])}}}(typeof je.R2L=="boolean"?je.R2L:Ee)===!0&&(M=mf(M,function(Vn,Wn,Ms){return[Vn.split("").reverse().join(""),Wn,Ms]})),We={text:M,x:G,y:ue,options:je,mutex:{pdfEscape:Ho,activeFontKey:Ie,fonts:Zt,activeFontSize:Ve}},Zr.publish("postProcessText",We),M=We.text,ys=We.mutex.isHex||!1;var kp=Zt[Ie].encoding;kp!=="WinAnsiEncoding"&&kp!=="StandardEncoding"||(M=mf(M,function(Vn,Wn,Ms){return[Uv(Vn),Wn,Ms]})),ot=ff(M),M=[];for(var wf,Nf,ju,pd=Array.isArray(ot[0])?1:0,wu="",Cp=function(Vn,Wn,Ms){var ta="";return Ms instanceof Ut?(Ms=typeof je.angle=="number"?Ur(Ms,new Ut(1,0,0,1,Vn,Wn)):Ur(new Ut(1,0,0,1,Vn,Wn),Ms),w===b&&(Ms=Ur(new Ut(1,0,0,-1,0,0),Ms)),ta=Ms.join(" ")+` Tm 1061`):ta=N(Vn)+" "+N(Wn)+` Td 1062`,ta},Ga=0;Ga<ot.length;Ga++){switch(wu="",pd){case 1:ju=(ys?"<":"(")+ot[Ga][0]+(ys?">":")"),wf=parseFloat(ot[Ga][1]),Nf=parseFloat(ot[Ga][2]);break;case 0:ju=(ys?"<":"(")+ot[Ga]+(ys?">":")"),wf=dd(G),Nf=ud(ue)}yf!==void 0&&yf[Ga]!==void 0&&(wu=yf[Ga]+` Tw 1063`),Ga===0?M.push(wu+Cp(wf,Nf,$n)+ju):pd===0?M.push(wu+ju):pd===1&&M.push(wu+Cp(wf,Nf,$n)+ju)}M=pd===0?M.join(` Tj 1064T* `):M.join(` Tj 1065`),M+=` Tj 1066`;var Nc=`BT 1067/`;return Nc+=Ie+" "+Ve+` Tf 1068`,Nc+=N(Ve*Wa)+` TL 1069`,Nc+=bc+` 1070`,Nc+=bs,Nc+=M,re(Nc+="ET"),f[Ie]=!0,Rn};var D5=m.__private__.clip=m.clip=function(M){return re(M==="evenodd"?"W*":"W"),this};m.clipEvenOdd=function(){return D5("evenodd")},m.__private__.discardPath=m.discardPath=function(){return re("n"),this};var yc=m.__private__.isValidStyle=function(M){var G=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(M)!==-1&&(G=!0),G};m.__private__.setDefaultPathOperation=m.setDefaultPathOperation=function(M){return yc(M)&&(d=M),this};var sw=m.__private__.getStyle=m.getStyle=function(M){var G=d;switch(M){case"D":case"S":G="S";break;case"F":G="f";break;case"FD":case"DF":G="B";break;case"f":case"f*":case"B":case"B*":G=M}return G},mp=m.close=function(){return re("h"),this};m.stroke=function(){return re("S"),this},m.fill=function(M){return pp("f",M),this},m.fillEvenOdd=function(M){return pp("f*",M),this},m.fillStroke=function(M){return pp("B",M),this},m.fillStrokeEvenOdd=function(M){return pp("B*",M),this};var pp=function(M,G){En(G)==="object"?F5(G,M):re(M)},Rv=function(M){M===null||w===b&&M===void 0||(M=sw(M),re(M))};function $5(M,G,ue,je,Oe){var We=new yg(G||this.boundingBox,ue||this.xStep,je||this.yStep,this.gState,Oe||this.matrix);We.stream=this.stream;var ot=M+"$$"+this.cloneIndex+++"$$";return us(ot,We),We}var F5=function(M,G){var ue=Br[M.key],je=Tt[ue];if(je instanceof Vf)re("q"),re(B5(G)),je.gState&&m.setGState(je.gState),re(M.matrix.toString()+" cm"),re("/"+ue+" sh"),re("Q");else if(je instanceof yg){var Oe=new Ut(1,0,0,-1,0,hf());M.matrix&&(Oe=Oe.multiply(M.matrix||vs),ue=$5.call(je,M.key,M.boundingBox,M.xStep,M.yStep,Oe).id),re("q"),re("/Pattern cs"),re("/"+ue+" scn"),je.gState&&m.setGState(je.gState),re(G),re("Q")}},B5=function(M){switch(M){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"}},pu=m.moveTo=function(M,G){return re(N(A(M))+" "+N(R(G))+" m"),this},aw=m.lineTo=function(M,G){return re(N(A(M))+" "+N(R(G))+" l"),this},gu=m.curveTo=function(M,G,ue,je,Oe,We){return re([N(A(M)),N(R(G)),N(A(ue)),N(R(je)),N(A(Oe)),N(R(We)),"c"].join(" ")),this};m.__private__.line=m.line=function(M,G,ue,je,Oe){if(isNaN(M)||isNaN(G)||isNaN(ue)||isNaN(je)||!yc(Oe))throw new Error("Invalid arguments passed to jsPDF.line");return w===y?this.lines([[ue-M,je-G]],M,G,[1,1],Oe||"S"):this.lines([[ue-M,je-G]],M,G,[1,1]).stroke()},m.__private__.lines=m.lines=function(M,G,ue,je,Oe,We){var ot,Yt,Ht,kr,Lr,ln,Ys,$n,Rn,rs,ys,bs;if(typeof M=="number"&&(bs=ue,ue=G,G=M,M=bs),je=je||[1,1],We=We||!1,isNaN(G)||isNaN(ue)||!Array.isArray(M)||!Array.isArray(je)||!yc(Oe)||typeof We!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(pu(G,ue),ot=je[0],Yt=je[1],kr=M.length,rs=G,ys=ue,Ht=0;Ht<kr;Ht++)(Lr=M[Ht]).length===2?(rs=Lr[0]*ot+rs,ys=Lr[1]*Yt+ys,aw(rs,ys)):(ln=Lr[0]*ot+rs,Ys=Lr[1]*Yt+ys,$n=Lr[2]*ot+rs,Rn=Lr[3]*Yt+ys,rs=Lr[4]*ot+rs,ys=Lr[5]*Yt+ys,gu(ln,Ys,$n,Rn,rs,ys));return We&&mp(),Rv(Oe),this},m.path=function(M){for(var G=0;G<M.length;G++){var ue=M[G],je=ue.c;switch(ue.op){case"m":pu(je[0],je[1]);break;case"l":aw(je[0],je[1]);break;case"c":gu.apply(this,je);break;case"h":mp()}}return this},m.__private__.rect=m.rect=function(M,G,ue,je,Oe){if(isNaN(M)||isNaN(G)||isNaN(ue)||isNaN(je)||!yc(Oe))throw new Error("Invalid arguments passed to
1070jsPDF.rect");return w===y&&(je=-je),re([N(A(M)),N(R(G)),N(A(ue)),N(A(je)),"re"].join(" ")),Rv(Oe),this},m.__private__.triangle=m.triangle=function(M,G,ue,je,Oe,We,ot){if(isNaN(M)||isNaN(G)||isNaN(ue)||isNaN(je)||isNaN(Oe)||isNaN(We)||!yc(ot))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[ue-M,je-G],[Oe-ue,We-je],[M-Oe,G-We]],M,G,[1,1],ot,!0),this},m.__private__.roundedRect=m.roundedRect=function(M,G,ue,je,Oe,We,ot){if(isNaN(M)||isNaN(G)||isNaN(ue)||isNaN(je)||isNaN(Oe)||isNaN(We)||!yc(ot))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var Yt=4/3*(Math.SQRT2-1);return Oe=Math.min(Oe,.5*ue),We=Math.min(We,.5*je),this.lines([[ue-2*Oe,0],[Oe*Yt,0,Oe,We-We*Yt,Oe,We],[0,je-2*We],[0,We*Yt,-Oe*Yt,We,-Oe,We],[2*Oe-ue,0],[-Oe*Yt,0,-Oe,-We*Yt,-Oe,-We],[0,2*We-je],[0,-We*Yt,Oe*Yt,-We,Oe,-We]],M+Oe,G,[1,1],ot,!0),this},m.__private__.ellipse=m.ellipse=function(M,G,ue,je,Oe){if(isNaN(M)||isNaN(G)||isNaN(ue)||isNaN(je)||!yc(Oe))throw new Error("Invalid arguments passed to jsPDF.ellipse");var We=4/3*(Math.SQRT2-1)*ue,ot=4/3*(Math.SQRT2-1)*je;return pu(M+ue,G),gu(M+ue,G-ot,M+We,G-je,M,G-je),gu(M-We,G-je,M-ue,G-ot,M-ue,G),gu(M-ue,G+ot,M-We,G+je,M,G+je),gu(M+We,G+je,M+ue,G+ot,M+ue,G),Rv(Oe),this},m.__private__.circle=m.circle=function(M,G,ue,je){if(isNaN(M)||isNaN(G)||isNaN(ue)||!yc(je))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(M,G,ue,ue,je)},m.setFont=function(M,G,ue){return ue&&(G=E(G,ue)),Ie=tw(M,G,{disableWarning:!1}),this};var U5=m.__private__.getFont=m.getFont=function(){return Zt[tw.apply(m,arguments)]};m.__private__.getFontList=m.getFontList=function(){var M,G,ue={};for(M in dr)if(dr.hasOwnProperty(M))for(G in ue[M]=[],dr[M])dr[M].hasOwnProperty(G)&&ue[M].push(G);return ue},m.addFont=function(M,G,ue,je,Oe){var We=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&We.indexOf(arguments[3])!==-1?Oe=arguments[3]:arguments[3]&&We.indexOf(arguments[3])==-1&&(ue=E(ue,je)),Zj.call(this,M,G,ue,Oe=Oe||"Identity-H")};var df,br=e.lineWidth||.200025,z5=m.__private__.getLineWidth=m.getLineWidth=function(){return br},q5=m.__private__.setLineWidth=m.setLineWidth=function(M){return br=M,re(N(A(M))+" w"),this};m.__private__.setLineDash=ar.API.setLineDash=ar.API.setLineDashPattern=function(M,G){if(M=M||[],G=G||0,isNaN(G)||!Array.isArray(M))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return M=M.map(function(ue){return N(A(ue))}).join(" "),G=N(A(G)),re("["+M+"] "+G+" d"),this};var V5=m.__private__.getLineHeight=m.getLineHeight=function(){return Ve*df};m.__private__.getLineHeight=m.getLineHeight=function(){return Ve*df};var W5=m.__private__.setLineHeightFactor=m.setLineHeightFactor=function(M){return typeof(M=M||1.15)=="number"&&(df=M),this},H5=m.__private__.getLineHeightFactor=m.getLineHeightFactor=function(){return df};W5(e.lineHeight);var dd=m.__private__.getHorizontalCoordinate=function(M){return A(M)},ud=m.__private__.getVerticalCoordinate=function(M){return w===b?M:Bt[V].mediaBox.topRightY-Bt[V].mediaBox.bottomLeftY-A(M)},G5=m.__private__.getHorizontalCoordinateString=m.getHorizontalCoordinateString=function(M){return N(dd(M))},Y5=m.__private__.getVerticalCoordinateString=m.getVerticalCoordinateString=function(M){return N(ud(M))},gp=e.strokeColor||"0 G";m.__private__.getStrokeColor=m.getDrawColor=function(){return pc(gp)},m.__private__.setStrokeColor=m.setDrawColor=function(M,G,ue,je){return gp=wl({ch1:M,ch2:G,ch3:ue,ch4:je,pdfColorType:"draw",precision:2}),re(gp),this};var Mv=e.fillColor||"0 g";m.__private__.getFillColor=m.getFillColor=function(){return pc(Mv)},m.__private__.setFillColor=m.setFillColor=function(M,G,ue,je){return Mv=wl({ch1:M,ch2:G,ch3:ue,ch4:je,pdfColorType:"fill",precision:2}),re(Mv),this};var bc=e.textColor||"0 g",K5=m.__private__.getTextColor=m.getTextColor=function(){return pc(bc)};m.__private__.setTextColor=m.setTextColor=function(M,G,ue,je){return bc=wl({ch1:M,ch2:G,ch3:ue,ch4:je,pdfColorType:"text",precision:3}),this};var xp=e.charSpace,X5=m.__private__.getCharSpace=m.getCharSpace=function(){return parseFloat(xp||0)};m.__private__.setCharSpace=m.setCharSpace=function(M){if(isNaN(M))throw new Error("Invalid argument passed to
1070jsPDF.setCharSpace");return xp=M,this};var Dv=0;m.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},m.__private__.setLineCap=m.setLineCap=function(M){var G=m.CapJoinStyles[M];if(G===void 0)throw new Error("Line cap style of '"+M+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return Dv=G,re(G+" J"),this};var xu=0;m.__private__.setLineJoin=m.setLineJoin=function(M){var G=m.CapJoinStyles[M];if(G===void 0)throw new Error("Line join style of '"+M+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return xu=G,re(G+" j"),this},m.__private__.setLineMiterLimit=m.__private__.setMiterLimit=m.setLineMiterLimit=m.setMiterLimit=function(M){if(M=M||0,isNaN(M))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return re(N(A(M))+" M"),this},m.GState=N2,m.setGState=function(M){(M=typeof M=="string"?tr[or[M]]:$v(null,M)).equals(pn)||(re("/"+M.id+" gs"),pn=M)};var $v=function(M,G){if(!M||!or[M]){var ue=!1;for(var je in tr)if(tr.hasOwnProperty(je)&&tr[je].equals(G)){ue=!0;break}if(ue)G=tr[je];else{var Oe="GS"+(Object.keys(tr).length+1).toString(10);tr[Oe]=G,G.id=Oe}return M&&(or[M]=G.id),Zr.publish("addGState",G),G}};m.addGState=function(M,G){return $v(M,G),this},m.saveGraphicsState=function(){return re("q"),Fr.push({key:Ie,size:Ve,color:bc}),this},m.restoreGraphicsState=function(){re("Q");var M=Fr.pop();return Ie=M.key,Ve=M.size,bc=M.color,pn=null,this},m.setCurrentTransformationMatrix=function(M){return re(M.toString()+" cm"),this},m.comment=function(M){return re("#"+M),this};var uf=function(M,G){var ue=M||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return ue},set:function(We){isNaN(We)||(ue=parseFloat(We))}});var je=G||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return je},set:function(We){isNaN(We)||(je=parseFloat(We))}});var Oe="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Oe},set:function(We){Oe=We.toString()}}),this},Fv=function(M,G,ue,je){uf.call(this,M,G),this.type="rect";var Oe=ue||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Oe},set:function(ot){isNaN(ot)||(Oe=parseFloat(ot))}});var We=je||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return We},set:function(ot){isNaN(ot)||(We=parseFloat(ot))}}),this},vp=function(){this.page=xr,this.currentPage=V,this.pages=we.slice(0),this.pagesContext=Bt.slice(0),this.x=rt,this.y=Gt,this.matrix=gt,this.width=iw(V),this.height=fd(V),this.outputDestination=De,this.id="",this.objectNumber=-1};vp.prototype.restore=function(){xr=this.page,V=this.currentPage,Bt=this.pagesContext,we=this.pages,rt=this.x,Gt=this.y,gt=this.matrix,hd(V,this.width),ow(V,this.height),De=this.outputDestination};var Bv=function(M,G,ue,je,Oe){ts.push(new vp),xr=V=0,we=[],rt=M,Gt=G,gt=Oe,Ov([ue,je])};for(var yp in m.beginFormObject=function(M,G,ue,je,Oe){return Bv(M,G,ue,je,Oe),this},m.endFormObject=function(M){return function(G){if(Gr[G])ts.pop().restore();else{var ue=new vp,je="Xo"+(Object.keys(ur).length+1).toString(10);ue.id=je,Gr[G]=je,ur[je]=ue,Zr.publish("addFormObject",ue),ts.pop().restore()}}(M),this},m.doFormObject=function(M,G){var ue=ur[Gr[M]];return re("q"),re(G.toString()+" cm"),re("/"+ue.id+" Do"),re("Q"),this},m.getFormObject=function(M){var G=ur[Gr[M]];return{x:G.x,y:G.y,width:G.width,height:G.height,matrix:G.matrix}},m.save=function(M,G){return M=M||"generated.pdf",(G=G||{}).returnPromise=G.returnPromise||!1,G.returnPromise===!1?(Ff(hp(vc()),M),typeof Ff.unload=="function"&&jr.setTimeout&&setTimeout(Ff.unload,911),this):new Promise(function(ue,je){try{var Oe=Ff(hp(vc()),M);typeof Ff.unload=="function"&&jr.setTimeout&&setTimeout(Ff.unload,911),ue(Oe)}catch(We){je(We.message)}})},ar.API)ar.API.hasOwnProperty(yp)&&(yp==="events"&&ar.API.events.length?function(M,G){var ue,je,Oe;for(Oe=G.length-1;Oe!==-1;Oe--)ue=G[Oe][0],je=G[Oe][1],M.subscribe.apply(M,[ue].concat(typeof je=="function"?[je]:je))}(Zr,ar.API.events):m[yp]=ar.API[yp]);function iw(M){return Bt[M].mediaBox.topRightX-Bt[M].mediaBox.bottomLeftX}function hd(M,G){Bt[M].mediaBox.topRightX=G+Bt[M].mediaBox.bottomLeftX}function fd(M){return Bt[M].mediaBox.topRightY-Bt[M].mediaBox.bottomLeftY}function ow(M,G){Bt[M].mediaBox.topRightY=G+Bt[M].mediaBox.bottomLeftY}var lw=m.getPageWidth=function(M){return iw(M=M||V)/at},cw=m.setPageWidth=function(M,G){hd(M,G*at)},hf=m.getPageHeight=function(M){return fd(M=M||V)/at},dw=m.setPageHeight=function(M,G){ow(M,G*at)};return m.internal={pdfEscape:Ho,getStyle:sw,getFont:U5,getFontSize:ye,getCharSpace:X5,getTextColor:K5,getLineHeight:V5,getLineHeightFactor:H5,getLineWidth:z5,write:et,getHorizontalCoordinate:dd,getVerticalCoordinate:ud,getCoordinateString:G5,getVerticalCoordinateString:Y5,collections:{},newObject:Cs,newAdditionalObject:of,newObjectDeferred:ja,newObjectDeferredBegin:Ea,getFilters:Nl,putStream:Wo,events:Zr,scaleFactor:at,pageSize:{getWidth:function(){return lw(V)},setWidth:function(M){cw(V,M)},getHeight:function(){return hf(V)},setHeight:function(M){dw(V,M)}},encryptionOptions:u,encryption:Ta,getEncryptor:function(M){return u!==null?Ta.encryptor(M,0):function(G){return G}},output:fp,getNumberOfPages:ew,get pages(){return we},out:re,f2:P,f3:O,getPageInfo:nw,getPageInfoByObjId:R5,getCurrentPageInfo:M5,getPDFVersion:p,Point:uf,Rectangle:Fv,Matrix:Ut,hasHotfix:cd},Object.defineProperty(m.internal.pageSize,"width",{get:function(){return lw(V)},set:function(M){cw(V,M)},enumerable:!0,configurable:!0}),Object.defineProperty(m.internal.pageSize,"height",{get:function(){return hf(V)},set:function(M){dw(V,M)},enumerable:!0,configurable:!0}),(function(M){for(var G=0,ue=St.length;G<ue;G++){var je=Zj.call(this,M[G][0],M[G][1],M[G][2],St[G][3],!0);h===!1&&(f[je]=!0);var Oe=M[G][0].split("-");Xj({id:je,fontName:Oe[0],fontStyle:Oe[1]||""})}Zr.publish("addFonts",{fonts:Zt,dictionary:dr})}).call(m,St),Ie="F1",Jj(a,n),Zr.publish("initialized"),m}eg.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},eg.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},eg.prototype.hexToBytes=function(e){for(var t=[],n=0;n<e.length;n+=2)t.push(String.fromCharCode(parseInt(e.substr(n,2),16)));return t.join("")},eg.prototype.processOwnerPassword=function(e,t){return kE(SE(t).substr(0,5),e)},eg.prototype.encryptor=function(e,t){var n=SE(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(s){return kE(n,s)}},N2.prototype.equals=function(e){var t,n="id,objectNumber,equals";if(!e||En(e)!==En(this))return!1;var s=0;for(t in this)if(!(n.indexOf(t)>
vendor: 30,277 bytes, lines 1070-1089
1070=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;s++}for(t in e)e.hasOwnProperty(t)&&n.indexOf(t)<0&&s--;return s===0},ar.API={events:[]},ar.version="4.2.1";var Ts=ar.API,FL=1,op=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},Gp=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Vm=function(e){return e.toString().replace(/#/g,"#23").replace(/[\s\n\r()<>[\]{}\/%]/g,function(t){var n=t.charCodeAt(0).toString(16).toUpperCase();return"#"+(n.length===1?"0"+n:n)})},Ar=function(e){return e.toFixed(2)},Ru=function(e){return e.toFixed(5)};Ts.__acroform__={};var co=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},j9=function(e){return e*FL},Cc=function(e){var t=new Qte,n=Wt.internal.getHeight(e)||0,s=Wt.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Ar(s)),Number(Ar(n))],t},WXe=Ts.__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},HXe=Ts.__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)},GXe=Ts.__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},Us=Ts.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return GXe(e,t-1)},zs=Ts.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return WXe(e,t-1)},qs=Ts.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return HXe(e,t-1)},YXe=Ts.__acroform__.calculateCoordinates=function(e,t){var n=t.internal.getHorizontalCoordinate,s=t.internal.getVerticalCoordinate,a=e[0],i=e[1],o=e[2],l=e[3],c={};return c.lowerLeft_X=n(a)||0,c.lowerLeft_Y=s(i+l)||0,c.upperRight_X=n(a+o)||0,c.upperRight_Y=s(i)||0,[Number(Ar(c.lowerLeft_X)),Number(Ar(c.lowerLeft_Y)),Number(Ar(c.upperRight_X)),Number(Ar(c.upperRight_Y))]},KXe=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],n=e._V||e.DV,s=CE(e,n),a=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("/"+a+" "+Ar(s.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(s.text),t.push("ET"),t.push("Q"),t.push("EMC");var i=Cc(e);return i.scope=e.scope,i.stream=t.join(` 1071`),i}},CE=function(e,t){var n=e.fontSize===0?e.maxFontSize:e.fontSize,s={text:"",fontSize:""},a=(t=(t=t.substr(0,1)=="("?t.substr(1):t).substr(t.length-1)==")"?t.substr(0,t.length-1):t).split(" ");a=e.multiline?a.map(function(P){return P.split(` 1072`)}):a.map(function(P){return[P]});var i=n,o=Wt.internal.getHeight(e)||0;o=o<0?-o:o;var l=Wt.internal.getWidth(e)||0;l=l<0?-l:l;var c=function(P,O,A){if(P+1<a.length){var R=O+" "+a[P+1][0];return M1(R,e,A).width<=l-4}return!1};i++;e:for(;i>0;){t="",i--;var d,u,h=M1("3",e,i).height,f=e.multiline?o-i:(o-h)/2,m=f+=2,x=0,p=0,v=0;if(i<=0){t=`(...) Tj 1073`,t+="% Width of Text: "+M1(t,e,i=12).width+", FieldWidth:"+l+` 1074`;break}for(var g="",y=0,b=0;b<a.length;b++)if(a.hasOwnProperty(b)){var w=!1;if(a[b].length!==1&&v!==a[b].length-1){if((h+2)*(y+2)+2>o)continue e;g+=a[b][v],w=!0,p=b,b--}else{g=(g+=a[b][v]+" ").substr(g.length-1)==" "?g.substr(0,g.length-1):g;var _=parseInt(b),C=c(_,g,i),E=b>=a.length-1;if(C&&!E){g+=" ",v=0;continue}if(C||E){if(E)p=_;else if(e.multiline&&(h+2)*(y+2)+2>o)continue e}else{if(!e.multiline||(h+2)*(y+2)+2>o)continue e;p=_}}for(var N="",k=x;k<=p;k++){var I=a[k];if(e.multiline){if(k===p){N+=I[v]+" ",v=(v+1)%I.length;continue}if(k===x){N+=I[I.length-1]+" ";continue}}N+=I[0]+" "}switch(N=N.substr(N.length-1)==" "?N.substr(0,N.length-1):N,u=M1(N,e,i).width,e.textAlign){case"right":d=l-u-2;break;case"center":d=(l-u)/2;break;default:d=2}t+=Ar(d)+" "+Ar(m)+` Td 1075`,t+="("+op(N)+`) Tj 1076`,t+=-Ar(d)+` 0 Td 1077`,m=-(i+2),u=0,x=w?p:p+1,y++,g=""}break}return s.text=t,s.fontSize=i,s},M1=function(e,t,n){var s=t.scope.internal.getFont(t.fontName,t.fontStyle),a=t.scope.getStringUnitWidth(e,{font:s,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:t.scope.getStringUnitWidth("3",{font:s,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:a}},XXe={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},ZXe=function(e,t){var n={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(s){return s.type===n.type&&s.object===n.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(n)},JXe=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(fc.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(XXe)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");FL=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new ere,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(n){n.internal.events.unsubscribe(n.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete n.internal.acroformPlugin.acroFormDictionaryRoot._eventID,n.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(n){n.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var s=n.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var a in s)if(s.hasOwnProperty(a)){var i=s[a];i.objId=void 0,i.hasAnnotation&&ZXe(i,n)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(n){if(n.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");n.internal.write("/AcroForm "+n.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(n){(function(s,a){var i=!s;for(var o in s||(a.internal.newObjectDeferredBegin(a.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),a.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),s=s||a.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(s.hasOwnProperty(o)){var l=s[o],c=[],d=l.Rect;if(l.Rect&&(l.Rect=YXe(l.Rect,a)),a.internal.newObjectDeferredBegin(l.objId,!0),l.DA=Wt.createDefaultAppearanceStream(l),En(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(c=l.getKeyValueListForStream()),l.Rect=d,l.hasAppearanceStream&&!l.appearanceStreamContent){var u=KXe(l);c.push({key:"AP",value:"<</N "+u+">>"}),a.internal.acroformPlugin.xForms.push(u)}if(l.appearanceStreamContent){var h="";for(var f in l.appearanceStreamContent)if(l.appearanceStreamContent.hasOwnProperty(f)){var m=l.appearanceStreamContent[f];if(h+="/"+f+" ",h+="<<",Object.keys(m).length>=1||Array.isArray(m)){for(var o in m)if(m.hasOwnProperty(o)){var x=m[o];typeof x=="function"&&(x=x.call(a,l)),h+="/"+o+" "+x+" ",a.internal.acroformPlugin.xForms.indexOf(x)>=0||a.internal.acroformPlugin.xForms.push(x)}}else typeof(x=m)=="function"&&(x=x.call(a,l)),h+="/"+o+" "+x,a.internal.acroformPlugin.xForms.indexOf(x)>=0||a.internal.acroformPlugin.xForms.push(x);h+=">>"}c.push({key:"AP",value:`<< 1078`+h+">>"})}a.internal.putStream({additionalKeyValues:c,objectId:l.objId}),a.internal.out("endobj")}i&&function(p,v){for(var g in p)if(p.hasOwnProperty(g)){var y=g,b=p[g];v.internal.newObjectDeferredBegin(b.objId,!0),En(b)==="object"&&typeof b.putStream=="function"&&b.putStream(),delete p[y]}}(a.internal.acroformPlugin.xForms,a)})(n,e)}),e.internal.acroformPlugin.isInitialized=!0}},Jte=Ts.__acroform__.arrayToPdfArray=function(e,t,n){var s=function(o){return o};if(Array.isArray(e)){for(var a="[",i=0;i<e.length;i++)switch(i!==0&&(a+=" "),En(e[i])){case"boolean":case"number":case"object":a+=e[i].toString();break;case"string":e[i].substr(0,1)==="/"?a+="/"+Vm(e[i].substr(1)):(t!==void 0&&n&&(s=n.internal.getEncryptor(t)),a+="("+op(s(e[i].toString()))+")")}return a+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},CC=function(e,t,n){var s=function(a){return a};return t!==void 0&&n&&(s=n.internal.getEncryptor(t)),(e=e||"").toString(),"("+op(s(e))+")"},Bc=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})};Bc.prototype.toString=function(){return this.objId+" 0 R"},Bc.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},Bc.prototype.getKeyValueListForStream=function(){var e=[],t=Object.getOwnPropertyNames(this).filter(function(i){return i!="content"&&i!="appearanceStreamContent"&&i!="scope"&&i!="objId"&&i.substring(0,1)!="_"});for(var n in t)if(Object.getOwnPropertyDescriptor(this,t[n]).configurable===!1){var s=t[n],a=this[s];a&&(Array.isArray(a)?e.push({key:s,value:Jte(a,this.objId,this.scope)}):a instanceof Bc?(a.scope=this.scope,e.push({key:s,value:a.objId+" 0 R"})):typeof a!="function"&&e.push({key:s,value:a}))}return e};var Qte=function(){Bc.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(n){t=n}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(n){e=n.trim()},get:function(){return e||null}})};co(Qte,Bc);var ere=function(){Bc.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 n=function(s){return s};return this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),"("+op(n(e))+")"}},set:function(n){e=n}})};co(ere,Bc);var fc=function e(){Bc.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(g){if(isNaN(g))throw new Error('Invalid value "'+g+'" for attribute F supplied.');t=g}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!Us(t,3)},set:function(g){g?this.F=zs(t,3):this.F=qs(t,3)}});var n=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return n},set:function(g){if(isNaN(g))throw new Error('Invalid value "'+g+'" for attribute Ff supplied.');n=g}});var s=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(s.length!==0)return s},set:function(g){s=g!==void 0?g:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[0])?0:s[0]},set:function(g){s[0]=g}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[1])?0:s[1]},set:function(g){s[1]=g}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[2])?0:s[2]},set:function(g){s[2]=g}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!s||isNaN(s[3])?0:s[3]},set:function(g){s[3]=g}});var a="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return a},set:function(g){switch(g){case"/Btn":case"/Tx":case"/Ch":case"/Sig":a=g;break;default:throw new Error('Invalid value "'+g+'" for attribute FT supplied.')}}});var i=null;Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,get:function(){if(!i||i.length<1){if(this instanceof _2)return;i="FieldObject"+e.FieldNum++}var g=function(y){return y};return this.scope&&(g=this.scope.internal.getEncryptor(this.objId)),"("+op(g(i))+")"},set:function(g){i=g.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return i},set:function(g){i=g}});var o="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(g){o=g}});var l="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return l},set:function(g){l=g}});var c=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return c},set:function(g){c=g}});var d=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return d===void 0?50/FL:d},set:function(g){d=g}});var u="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return u},set:function(g){u=g}});var h="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!h||this instanceof _2||this instanceof vm))return CC(h,this.objId,this.scope)},set:function(g){g=g.toString(),h=g}});var f=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(f)return this instanceof Sa==0?CC(f,this.objId,this.scope):f},set:function(g){g=g.toString(),f=this instanceof Sa==0?g.substr(0,1)==="("?Gp(g.substr(1,g.length-2)):Gp(g):g}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof Sa==1?Gp(f.substr(1,f.length-1)):f},set:function(g){g=g.toString(),f=this instanceof Sa==1?"/"+Vm(g):g}});var m=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(m)return m},set:function(g){this.V=g}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(m)return this instanceof Sa==0?CC(m,this.objId,this.scope):m},set:function(g){g=g.toString(),m=this instanceof Sa==0?g.substr(0,1)==="("?Gp(g.substr(1,g.length-2)):Gp(g):g}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof Sa==1?Gp(m.substr(1,m.length-1)):m},set:function(g){g=g.toString(),m=this instanceof Sa==1?"/"+Vm(g):g}}),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 x,p=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return p},set:function(g){g=!!g,p=g}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(x)return x},set:function(g){x=g}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,1)},set:function(g){g?this.Ff=zs(this.Ff,1):this.Ff=qs(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,2)},set:function(g){g?this.Ff=zs(this.Ff,2):this.Ff=qs(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,3)},set:function(g){g?this.Ff=zs(this.Ff,3):this.Ff=qs(this.Ff,3)}});var v=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(v!==null)return v},set:function(g){if([0,1,2].indexOf(g)===-1)throw new Error('Invalid value "'+g+'" for attribute Q supplied.');v=g}}),Object.defineProperty(this,"textAlign",{get:function(){var g;switch(v){case 0:default:g="left";break;case 1:g="center";break;case 2:g="right"}return g},configurable:!0,enumerable:!0,set:function(g){switch(g){case"right":case 2:v=2;break;case"center":case 1:v=1;break;default:v=0}}})};co(fc,Bc);var Mg=function(){fc.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(n){e=n}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(n){e=n}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return Jte(t,this.objId,this.scope)},set:function(n){var s,a;a=[],typeof(s=n)=="string"&&(a=function(i,o,l){l||(l=1);for(var c,d=[];c=o.exec(i);)d.push(c[l]);return d}(s,/\((.*?)\)/g)),t=a}}),this.getOptions=function(){return t},this.setOptions=function(n){t=n,this.sort&&t.sort()},this.addOption=function(n){n=(n=n||"").toString(),t.push(n),this.sort&&t.sort()},this.removeOption=function(n,s){for(s=s||!1,n=(n=n||"").toString();t.indexOf(n)!==-1&&(t.splice(t.indexOf(n),1),s!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,18)},set:function(n){n?this.Ff=zs(this.Ff,18):this.Ff=qs(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,19)},set:function(n){this.combo===!0&&(n?this.Ff=zs(this.Ff,19):this.Ff=qs(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,20)},set:function(n){n?(this.Ff=zs(this.Ff,20),t.sort()):this.Ff=qs(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,22)},set:function(n){n?this.Ff=zs(this.Ff,22):this.Ff=qs(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,23)},set:function(n){n?this.Ff=zs(this.Ff,23):this.Ff=qs(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,27)},set:function(n){n?this.Ff=zs(this.Ff,27):this.Ff=qs(this.Ff,27)}}),this.hasAppearanceStream=!1};co(Mg,fc);var Dg=function(){Mg.call(this),this.fontName="helvetica",this.combo=!1};co(Dg,Mg);var $g=function(){Dg.call(this),this.combo=!0};co($g,Dg);var dN=function(){$g.call(this),this.edit=!0};co(dN,$g);var Sa=function(){fc.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,15)},set:function(n){n?this.Ff=zs(this.Ff,15):this.Ff=qs(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,16)},set:function(n){n?this.Ff=zs(this.Ff,16):this.Ff=qs(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,17)},set:function(n){n?this.Ff=zs(this.Ff,17):this.Ff=qs(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,26)},set:function(n){n?this.Ff=zs(this.Ff,26):this.Ff=qs(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var n=function(i){return i};if(this.scope&&(n=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var s,a=[];for(s in a.push("<<"),t)a.push("/"+s+" ("+op(n(t[s]))+")");return a.push(">>"),a.join(` 1079`)}},set:function(n){En(n)==="object"&&(t=n)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(n){typeof n=="string"&&(t.CA=n)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(n){var s=n==null?"":n.toString();s.substr(0,1)==="/"&&(s=s.substr(1)),e="/"+Vm(s)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(n){e="/"+Vm(n)}})};co(Sa,fc);var uN=function(){Sa.call(this),this.pushButton=!0};co(uN,Sa);var Fg=function(){Sa.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:[]}})};co(Fg,Sa);var _2=function(){var e,t;fc.call(this),Object.defineProperty(this,"Parent",{enumerable:!1,configurable:!1,get:function(){return e},set:function(a){e=a}}),Object.defineProperty(this,"optionName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(a){t=a}});var n,s={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var a=function(l){return l};this.scope&&(a=this.scope.internal.getEncryptor(this.objId));var i,o=[];for(i in o.push("<<"),s)o.push("/"+i+" ("+op(a(s[i]))+")");return o.push(">>"),o.join(` 1080`)},set:function(a){En(a)==="object"&&(s=a)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return s.CA||""},set:function(a){typeof a=="string"&&(s.CA=a)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return n},set:function(a){var i=a==null?"":a.toString();i.substr(0,1)==="/"&&(i=i.substr(1)),n="/"+Vm(i)}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return n.substr(1,n.length-1)},set:function(a){var i=a==null?"":a.toString();i.substr(0,1)==="/"&&(i=i.substr(1)),n="/"+Vm(i)}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=Wt.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};co(_2,fc),Fg.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 n=this.Kids[t];n.appearanceStreamContent=e.createAppearanceStream(n.optionName),n.caption=e.getCA()}},Fg.prototype.createOption=function(e){var t=new _2;return t.Parent=this,t.optionName=e,this.Kids.push(t),QXe.call(this.scope,t),t};var hN=function(){Sa.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=Wt.CheckBox.createAppearanceStream()};co(hN,Sa);var vm=function(){fc.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,13)},set:function(t){t?this.Ff=zs(this.Ff,13):this.Ff=qs(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,21)},set:function(t){t?this.Ff=zs(this.Ff,21):this.Ff=qs(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,23)},set:function(t){t?this.Ff=zs(this.Ff,23):this.Ff=qs(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,24)},set:function(t){t?this.Ff=zs(this.Ff,24):this.Ff=qs(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,25)},set:function(t){t?this.Ff=zs(this.Ff,25):this.Ff=qs(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,26)},set:function(t){t?this.Ff=zs(this.Ff,26):this.Ff=qs(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}})};co(vm,fc);var fN=function(){vm.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!Us(this.Ff,14)},set:function(e){e?this.Ff=zs(this.Ff,14):this.Ff=qs(this.Ff,14)}}),this.password=!0};co(fN,vm);var Wt={CheckBox:{createAppearanceStream:function(){return{N:{On:Wt.CheckBox.YesNormal},D:{On:Wt.CheckBox.YesPushDown,Off:Wt.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=Cc(e);t.scope=e.scope;var n=[],s=e.scope.internal.getFont(e.fontName,e.fontStyle).id,a=e.scope.__private__.encodeColorString(e.color),i=CE(e,e.caption);return n.push("0.749023 g"),n.push("0 0 "+Ar(Wt.internal.getWidth(e))+" "+Ar(Wt.internal.getHeight(e))+" re"),n.push("f"),n.push("BMC"),n.push("q"),n.push("0 0 1 rg"),n.push("/"+s+" "+Ar(i.fontSize)+" Tf "+a),n.push("BT"),n.push(i.text),n.push("ET"),n.push("Q"),n.push("EMC"),t.stream=n.join(` 1081`),t},YesNormal:function(e){var t=Cc(e);t.scope=e.scope;var n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,s=e.scope.__private__.encodeColorString(e.color),a=[],i=Wt.internal.getHeight(e),o=Wt.internal.getWidth(e),l=CE(e,e.caption);return a.push("1 g"),a.push("0 0 "+Ar(o)+" "+Ar(i)+" re"),a.push("f"),a.push("q"),a.push("0 0 1 rg"),a.push("0 0 "+Ar(o-1)+" "+Ar(i-1)+" re"),a.push("W"),a.push("n"),a.push("0 g"),a.push("BT"),a.push("/"+n+" "+Ar(l.fontSize)+" Tf "+s),a.push(l.text),a.push("ET"),a.push("Q"),t.stream=a.join(` 1082`),t},OffPushDown:function(e){var t=Cc(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+Ar(Wt.internal.getWidth(e))+" "+Ar(Wt.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(` 1083`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:Wt.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=Wt.RadioButton.Circle.YesNormal,t.D[e]=Wt.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=Cc(e);t.scope=e.scope;var n=[],s=Wt.internal.getWidth(e)<=Wt.internal.getHeight(e)?Wt.internal.getWidth(e)/4:Wt.internal.getHeight(e)/4;s=Number((.9*s).toFixed(5));var a=Wt.internal.Bezier_C,i=Number((s*a).toFixed(5));return n.push("q"),n.push("1 0 0 1 "+Ru(Wt.internal.getWidth(e)/2)+" "+Ru(Wt.internal.getHeight(e)/2)+" cm"),n.push(s+" 0 m"),n.push(s+" "+i+" "+i+" "+s+" 0 "+s+" c"),n.push("-"+i+" "+s+" -"+s+" "+i+" -"+s+" 0 c"),n.push("-"+s+" -"+i+" -"+i+" -"+s+" 0 -"+s+" c"),n.push(i+" -"+s+" "+s+" -"+i+" "+s+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(` 1084`),t},YesPushDown:function(e){var t=Cc(e);t.scope=e.scope;var n=[],s=Wt.internal.getWidth(e)<=Wt.internal.getHeight(e)?Wt.internal.getWidth(e)/4:Wt.internal.getHeight(e)/4;s=Number((.9*s).toFixed(5));var a=Number((2*s).toFixed(5)),i=Number((a*Wt.internal.Bezier_C).toFixed(5)),o=Number((s*Wt.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Ru(Wt.internal.getWidth(e)/2)+" "+Ru(Wt.internal.getHeight(e)/2)+" cm"),n.push(a+" 0 m"),n.push(a+" "+i+" "+i+" "+a+" 0 "+a+" c"),n.push("-"+i+" "+a+" -"+a+" "+i+" -"+a+" 0 c"),n.push("-"+a+" -"+i+" -"+i+" -"+a+" 0 -"+a+" c"),n.push(i+" -"+a+" "+a+" -"+i+" "+a+" 0 c"),n.push("f"),n.push("Q"),n.push("0 g"),n.push("q"),n.push("1 0 0 1 "+Ru(Wt.internal.getWidth(e)/2)+" "+Ru(Wt.internal.getHeight(e)/2)+" cm"),n.push(s+" 0 m"),n.push(s+" "+o+" "+o+" "+s+" 0 "+s+" c"),n.push("-"+o+" "+s+" -"+s+" "+o+" -"+s+" 0 c"),n.push("-"+s+" -"+o+" -"+o+" -"+s+" 0 -"+s+" c"),n.push(o+" -"+s+" "+s+" -"+o+" "+s+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(` 1085`),t},OffPushDown:function(e){var t=Cc(e);t.scope=e.scope;var n=[],s=Wt.internal.getWidth(e)<=Wt.internal.getHeight(e)?Wt.internal.getWidth(e)/4:Wt.internal.getHeight(e)/4;s=Number((.9*s).toFixed(5));var a=Number((2*s).toFixed(5)),i=Number((a*Wt.internal.Bezier_C).toFixed(5));return n.push("0.749023 g"),n.push("q"),n.push("1 0 0 1 "+Ru(Wt.internal.getWidth(e)/2)+" "+Ru(Wt.internal.getHeight(e)/2)+" cm"),n.push(a+" 0 m"),n.push(a+" "+i+" "+i+" "+a+" 0 "+a+" c"),n.push("-"+i+" "+a+" -"+a+" "+i+" -"+a+" 0 c"),n.push("-"+a+" -"+i+" -"+i+" -"+a+" 0 -"+a+" c"),n.push(i+" -"+a+" "+a+" -"+i+" "+a+" 0 c"),n.push("f"),n.push("Q"),t.stream=n.join(` 1086`),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:Wt.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=Wt.RadioButton.Cross.YesNormal,t.D[e]=Wt.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=Cc(e);t.scope=e.scope;var n=[],s=Wt.internal.calculateCross(e);return n.push("q"),n.push("1 1 "+Ar(Wt.internal.getWidth(e)-2)+" "+Ar(Wt.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(Ar(s.x1.x)+" "+Ar(s.x1.y)+" m"),n.push(Ar(s.x2.x)+" "+Ar(s.x2.y)+" l"),n.push(Ar(s.x4.x)+" "+Ar(s.x4.y)+" m"),n.push(Ar(s.x3.x)+" "+Ar(s.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(` 1087`),t},YesPushDown:function(e){var t=Cc(e);t.scope=e.scope;var n=Wt.internal.calculateCross(e),s=[];return s.push("0.749023 g"),s.push("0 0 "+Ar(Wt.internal.getWidth(e))+" "+Ar(Wt.internal.getHeight(e))+" re"),s.push("f"),s.push("q"),s.push("1 1 "+Ar(Wt.internal.getWidth(e)-2)+" "+Ar(Wt.internal.getHeight(e)-2)+" re"),s.push("W"),s.push("n"),s.push(Ar(n.x1.x)+" "+Ar(n.x1.y)+" m"),s.push(Ar(n.x2.x)+" "+Ar(n.x2.y)+" l"),s.push(Ar(n.x4.x)+" "+Ar(n.x4.y)+" m"),s.push(Ar(n.x3.x)+" "+Ar(n.x3.y)+" l"),s.push("s"),s.push("Q"),t.stream=s.join(` 1088`),t},OffPushDown:function(e){var t=Cc(e);t.scope=e.scope;var n=[];return n.push("0.749023 g"),n.push("0 0 "+Ar(Wt.internal.getWidth(e))+" "+Ar(Wt.internal.getHeight(e))+" re"),n.push("f"),t.stream=n.join(` 1089`),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+n}};Wt.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=Wt.internal.getWidth(e),n=Wt.internal.getHeight(e),s=Math.min(t,n);return{x1:{x:(t-s)/2,y:(n-s)/2+s},x2:{x:(t-s)/2+s,y:(n-s)/2},x3:{x:(t-s)/2,y:(n-s)/2},x4:{x:(t-s)/2+s,y:(n-s)/2+s}}}},Wt.internal.getWidth=function(e){var t=0;return En(e)==="object"&&(t=j9(e.Rect[2])),t},Wt.internal.getHeight=function(e){var t=0;return En(e)==="object"&&(t=j9(e.Rect[3])),t};var QXe=Ts.addField=function(e){if(JXe(this,e),!(e instanceof fc))throw new Error("Invalid argument passed to
1089jsPDF.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};Ts.AcroFormChoiceField=Mg,Ts.AcroFormListBox=Dg,Ts.AcroFormComboBox=$g,Ts.AcroFormEditBox=dN,Ts.AcroFormButton=Sa,Ts.AcroFormPushButton=uN,Ts.AcroFormRadioButton=Fg,Ts.AcroFormCheckBox=hN,Ts.AcroFormTextField=vm,Ts.AcroFormPasswordField=fN,Ts.AcroFormAppearance=Wt,Ts.AcroForm={ChoiceField:Mg,ListBox:Dg,ComboBox:$g,EditBox:dN,Button:Sa,PushButton:uN,RadioButton:Fg,CheckBox:hN,TextField:vm,PasswordField:fN,Appearance:Wt},ar.AcroForm={ChoiceField:Mg,ListBox:Dg,ComboBox:$g,EditBox:dN,Button:Sa,PushButton:uN,RadioButton:Fg,CheckBox:hN,TextField:vm,PasswordField:fN,Appearance:Wt};function tre(e){return e.reduce(function(t,n,s){return t[n]=s,t},{})}(function(e){var t="addImage_";e.__addimage__={};var n="UNKNOWN",s={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]]},a=e.__addimage__.getImageFileTypeByImageData=function(P,O){var A,R,L,z,U,$=n;if((O=O||n)==="RGBA"||P.data!==void 0&&P.data instanceof Uint8ClampedArray&&"height"in P&&"width"in P)return"RGBA";if(C(P))for(U in s)for(L=s[U],A=0;A<L.length;A+=1){for(z=!0,R=0;R<L[A].length;R+=1)if(L[A][R]!==void 0&&L[A][R]!==P[R]){z=!1;break}if(z===!0){$=U;break}}else for(U in s)for(L=s[U],A=0;A<L.length;A+=1){for(z=!0,R=0;R<L[A].length;R+=1)if(L[A][R]!==void 0&&L[A][R]!==P.charCodeAt(R)){z=!1;break}if(z===!0){$=U;break}}return $===n&&O!==n&&($=O),$},i=function P(O){for(var A=this.internal.write,R=this.internal.putStream,L=(0,this.internal.getFilters)();L.indexOf("FlateEncode")!==-1;)L.splice(L.indexOf("FlateEncode"),1);O.objectId=this.internal.newObject();var z=[];if(z.push({key:"Type",value:"/XObject"}),z.push({key:"Subtype",value:"/Image"}),z.push({key:"Width",value:O.width}),z.push({key:"Height",value:O.height}),O.colorSpace===g.INDEXED?z.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(O.palette.length/3-1)+" "+("sMask"in O&&O.sMask!==void 0?O.objectId+2:O.objectId+1)+" 0 R]"}):(z.push({key:"ColorSpace",value:"/"+O.colorSpace}),O.colorSpace===g.DEVICE_CMYK&&z.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),z.push({key:"BitsPerComponent",value:O.bitsPerComponent}),"decodeParameters"in O&&O.decodeParameters!==void 0&&z.push({key:"DecodeParms",value:"<<"+O.decodeParameters+">>"}),"transparency"in O&&Array.isArray(O.transparency)&&O.transparency.length>0){for(var U="",$=0,q=O.transparency.length;$<q;$++)U+=O.transparency[$]+" "+O.transparency[$]+" ";z.push({key:"Mask",value:"["+U+"]"})}O.sMask!==void 0&&z.push({key:"SMask",value:O.objectId+1+" 0 R"});var ne=O.filter!==void 0?["/"+O.filter]:void 0;if(R({data:O.data,additionalKeyValues:z,alreadyAppliedFilters:ne,objectId:O.objectId}),A("endobj"),"sMask"in O&&O.sMask!==void 0){var se,F=(se=O.sMaskBitsPerComponent)!==null&&se!==void 0?se:O.bitsPerComponent,V={width:O.width,height:O.height,colorSpace:"DeviceGray",bitsPerComponent:F,data:O.sMask};"filter"in O&&(V.decodeParameters="/Predictor ".concat(O.predictor," /Colors 1 /BitsPerComponent ").concat(F," /Columns ").concat(O.width),V.filter=O.filter),P.call(this,V)}if(O.colorSpace===g.INDEXED){var Z=this.internal.newObject();R({data:N(new Uint8Array(O.palette)),objectId:Z}),A("endobj")}},o=function(){var P=this.internal.collections[t+"images"];for(var O in P)i.call(this,P[O])},l=function(){var P,O=this.internal.collections[t+"images"],A=this.internal.write;for(var R in O)A("/I"+(P=O[R]).index,P.objectId,"0","R")},c=function(){this.internal.collections[t+"images"]||(this.internal.collections[t+"images"]={},this.internal.events.subscribe("putResources",o),this.internal.events.subscribe("putXobjectDict",l))},d=function(){var P=this.internal.collections[t+"images"];return c.call(this),P},u=function(){return Object.keys(this.internal.collections[t+"images"]).length},h=function(P){return typeof e["process"+P.toUpperCase()]=="function"},f=function(P){return En(P)==="object"&&P.nodeType===1},m=function(P,O){if(P.nodeName==="IMG"&&P.hasAttribute("src")){var A=""+P.getAttribute("src");if(A.indexOf("data:image/")===0)return cN(unescape(A).split("base64,").pop());var R=e.loadFile(A,!0);if(R!==void 0)return R}if(P.nodeName==="CANVAS"){if(P.width===0||P.height===0)throw new Error("Given canvas must have data. Canvas width: "+P.width+", height: "+P.height);var L;switch(O){case"PNG":L="image/png";break;case"WEBP":L="image/webp";break;default:L="image/jpeg"}return cN(P.toDataURL(L,1).split("base64,").pop())}},x=function(P){var O=this.internal.collections[t+"images"];if(O){for(var A in O)if(P===O[A].alias)return O[A]}},p=function(P,O,A){return P||O||(P=-96,O=-96),P<0&&(P=-1*A.width*72/P/this.internal.scaleFactor),O<0&&(O=-1*A.height*72/O/this.internal.scaleFactor),P===0&&(P=O*A.width/A.height),O===0&&(O=P*A.height/A.width),[P,O]},v=function(P,O,A,R,L,z){var U=p.call(this,A,R,L),$=this.internal.getCoordinateString,q=this.internal.getVerticalCoordinateString,ne=d.call(this);if(A=U[0],R=U[1],ne[L.index]=L,z){z*=Math.PI/180;var se=Math.cos(z),F=Math.sin(z),V=function(de){return de.toFixed(4)},Z=[V(se),V(F),V(-1*F),V(se),0,0,"cm"]}this.internal.write("q"),z?(this.internal.write([1,"0","0",1,$(P),q(O+R),"cm"].join(" ")),this.internal.write(Z.join(" ")),this.internal.write([$(A),"0","0",$(R),"0","0","cm"].join(" "))):this.internal.write([$(A),"0","0",$(R),$(P),q(O+R),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+L.index+" Do"),this.internal.write("Q")},g=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 y=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},b=e.__addimage__.sHashCode=function(P){var O,A,R=0;if(typeof P=="string")for(A=P.length,O=0;O<A;O++)R=(R<<5)-R+P.charCodeAt(O),R|=0;else if(C(P))for(A=P.byteLength/2,O=0;O<A;O++)R=(R<<5)-R+P[O],R|=0;return R}
vendor: 61,231 bytes, lines 1089-1126
1089,w=e.__addimage__.validateStringAsBase64=function(P){(P=P||"").toString().trim();var O=!0;return P.length===0&&(O=!1),P.length%4!=0&&(O=!1),/^[A-Za-z0-9+/]+$/.test(P.substr(0,P.length-2))===!1&&(O=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(P.substr(-2))===!1&&(O=!1),O},_=e.__addimage__.extractImageFromDataUrl=function(P){if(P==null||!(P=P.trim()).startsWith("data:"))return null;var O=P.indexOf(",");return O<0?null:P.substring(0,O).trim().endsWith("base64")?P.substring(O+1):null};e.__addimage__.isArrayBuffer=function(P){return P instanceof ArrayBuffer};var C=e.__addimage__.isArrayBufferView=function(P){return P instanceof Int8Array||P instanceof Uint8Array||P instanceof Uint8ClampedArray||P instanceof Int16Array||P instanceof Uint16Array||P instanceof Int32Array||P instanceof Uint32Array||P instanceof Float32Array||P instanceof Float64Array},E=e.__addimage__.binaryStringToUint8Array=function(P){for(var O=P.length,A=new Uint8Array(O),R=0;R<O;R++)A[R]=P.charCodeAt(R);return A},N=e.__addimage__.arrayBufferToBinaryString=function(P){for(var O="",A=C(P)?P:new Uint8Array(P),R=0;R<A.length;R+=8192)O+=String.fromCharCode.apply(null,A.subarray(R,R+8192));return O};e.addImage=function(){var P,O,A,R,L,z,U,$,q;if(typeof arguments[1]=="number"?(O=n,A=arguments[1],R=arguments[2],L=arguments[3],z=arguments[4],U=arguments[5],$=arguments[6],q=arguments[7]):(O=arguments[1],A=arguments[2],R=arguments[3],L=arguments[4],z=arguments[5],U=arguments[6],$=arguments[7],q=arguments[8]),En(P=arguments[0])==="object"&&!f(P)&&"imageData"in P){var ne=P;P=ne.imageData,O=ne.format||O||n,A=ne.x||A||0,R=ne.y||R||0,L=ne.w||ne.width||L,z=ne.h||ne.height||z,U=ne.alias||U,$=ne.compression||$,q=ne.rotation||ne.angle||q}var se=this.internal.getFilters();if($===void 0&&se.indexOf("FlateEncode")!==-1&&($="SLOW"),isNaN(A)||isNaN(R))throw new Error("Invalid coordinates passed to jsPDF.addImage");c.call(this);var F=k.call(this,P,O,U,$);return v.call(this,A,R,L,z,F,q),this};var k=function(P,O,A,R){var L,z,U;if(typeof P=="string"&&a(P)===n){P=unescape(P);var $=I(P,!1);($!==""||($=e.loadFile(P,!0))!==void 0)&&(P=$)}if(f(P)&&(P=m(P,O)),O=a(P,O),!h(O))throw new Error("addImage does not support files of type '"+O+"', please ensure that a plugin for '"+O+"' support is added.");if(((U=A)==null||U.length===0)&&(A=function(q){return typeof q=="string"||C(q)?b(q):C(q.data)?b(q.data):null}(P)),(L=x.call(this,A))||(P instanceof Uint8Array||O==="RGBA"||(z=P,P=E(P)),L=this["process"+O.toUpperCase()](P,u.call(this),A,function(q){return q&&typeof q=="string"&&(q=q.toUpperCase()),q in e.image_compression?q:y.NONE}(R),z)),!L)throw new Error("An unknown error occurred whilst processing the image.");return L},I=e.__addimage__.convertBase64ToBinaryString=function(P,O){O=typeof O!="boolean"||O;var A,R="";if(typeof P=="string"){var L;A=(L=_(P))!==null&&L!==void 0?L:P;try{R=cN(A)}catch(z){if(O)throw w(A)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+z.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return R};e.getImageProperties=function(P){var O,A,R="";if(f(P)&&(P=m(P)),typeof P=="string"&&a(P)===n&&((R=I(P,!1))===""&&(R=e.loadFile(P)||""),P=R),A=a(P),!h(A))throw new Error("addImage does not support files of type '"+A+"', please ensure that a plugin for '"+A+"' support is added.");if(P instanceof Uint8Array||(P=E(P)),!(O=this["process"+A.toUpperCase()](P)))throw new Error("An unknown error occurred whilst processing the image");return O.fileType=A,O}})(ar.API),function(e){var t=function(n){if(n!==void 0&&n!="")return!0};ar.API.events.push(["addPage",function(n){this.internal.getPageInfo(n.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(n){for(var s,a,i,o=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,c=this.internal.getPageInfoByObjId(n.objId),d=n.pageContext.annotations,u=!1,h=0;h<d.length&&!u;h++)switch((s=d[h]).type){case"link":(t(s.options.url)||t(s.options.pageNumber))&&(u=!0);break;case"reference":case"text":case"freetext":u=!0}if(u!=0){this.internal.write("/Annots [");for(var f=0;f<d.length;f++){s=d[f];var m=this.internal.pdfEscape,x=this.internal.getEncryptor(n.objId);switch(s.type){case"reference":this.internal.write(" "+s.object.objId+" 0 R ");break;case"text":var p=this.internal.newAdditionalObject(),v=this.internal.newAdditionalObject(),g=this.internal.getEncryptor(p.objId),y=s.title||"Note";i="<</Type /Annot /Subtype /Text "+(a="/Rect ["+o(s.bounds.x)+" "+l(s.bounds.y+s.bounds.h)+" "+o(s.bounds.x+s.bounds.w)+" "+l(s.bounds.y)+"] ")+"/Contents ("+m(g(s.contents))+")",i+=" /Popup "+v.objId+" 0 R",i+=" /P "+c.objId+" 0 R",i+=" /T ("+m(g(y))+") >>",p.content=i;var b=p.objId+" 0 R";i="<</Type /Annot /Subtype /Popup "+(a="/Rect ["+o(s.bounds.x+30)+" "+l(s.bounds.y+s.bounds.h)+" "+o(s.bounds.x+s.bounds.w+30)+" "+l(s.bounds.y)+"] ")+" /Parent "+b,s.open&&(i+=" /Open true"),i+=" >>",v.content=i,this.internal.write(p.objId,"0 R",v.objId,"0 R");break;case"freetext":a="/Rect ["+o(s.bounds.x)+" "+l(s.bounds.y)+" "+o(s.bounds.x+s.bounds.w)+" "+l(s.bounds.y+s.bounds.h)+"] ";var w="font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+(s.color||"#000000");i="<</Type /Annot /Subtype /FreeText "+a+"/Contents ("+m(x(s.contents))+")",i+=" /DS("+m(x(w))+")",i+=" /Border [0 0 0]",i+=" >>",this.internal.write(i);break;case"link":if(s.options.name){var _=this.annotations._nameMap[s.options.name];s.options.pageNumber=_.page,s.options.top=_.y}else s.options.top||(s.options.top=0);if(a="/Rect ["+s.finalBounds.x+" "+s.finalBounds.y+" "+s.finalBounds.w+" "+s.finalBounds.h+"] ",i="",s.options.url)i="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /A <</S /URI /URI ("+m(x(s.options.url))+") >>";else if(s.options.pageNumber)switch(i="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(s.options.pageNumber).objId+" 0 R",s.options.magFactor=s.options.magFactor||"XYZ",s.options.magFactor){case"Fit":i+=" /Fit]";break;case"FitH":i+=" /FitH "+s.options.top+"]";break;case"FitV":s.options.left=s.options.left||0,i+=" /FitV "+s.options.left+"]";break;default:var C=l(s.options.top);s.options.left=s.options.left||0,s.options.zoom===void 0&&(s.options.zoom=0),i+=" /XYZ "+s.options.left+" "+C+" "+s.options.zoom+"]"}i!=""&&(i+=" >>",this.internal.write(i))}}this.internal.write("]")}}]),e.createAnnotation=function(n){var s=this.internal.getCurrentPageInfo();switch(n.type){case"link":this.link(n.bounds.x,n.bounds.y,n.bounds.w,n.bounds.h,n);break;case"text":case"freetext":s.pageContext.annotations.push(n)}},e.link=function(n,s,a,i,o){var l=this.internal.getCurrentPageInfo(),c=this.internal.getCoordinateString,d=this.internal.getVerticalCoordinateString;l.pageContext.annotations.push({finalBounds:{x:c(n),y:d(s),w:c(n+a),h:d(s+i)},options:o,type:"link"})},e.textWithLink=function(n,s,a,i){var o,l,c=this.getTextWidth(n),d=this.internal.getLineHeight()/this.internal.scaleFactor;if(i.maxWidth!==void 0){l=i.maxWidth;var u=this.splitTextToSize(n,l).length;o=Math.ceil(d*u)}else l=c,o=d;return this.text(n,s,a,i),a+=.2*d,i.align==="center"&&(s-=c/2),i.align==="right"&&(s-=c),this.link(s,a-d,l,o,i),c},e.getTextWidth=function(n){var s=this.internal.getFontSize();return this.getStringUnitWidth(n)*s/this.internal.scaleFactor}}(ar.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]},n={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}},s={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},a=[1570,1571,1573,1575];e.__arabicParser__={};var i=e.__arabicParser__.isInArabicSubstitutionA=function(p){return t[p.charCodeAt(0)]!==void 0},o=e.__arabicParser__.isArabicLetter=function(p){return typeof p=="string"&&/^[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]+$/.test(p)},l=e.__arabicParser__.isArabicEndLetter=function(p){return o(p)&&i(p)&&t[p.charCodeAt(0)].length<=2},c=e.__arabicParser__.isArabicAlfLetter=function(p){return o(p)&&a.indexOf(p.charCodeAt(0))>=0};e.__arabicParser__.arabicLetterHasIsolatedForm=function(p){return o(p)&&i(p)&&t[p.charCodeAt(0)].length>=1};var d=e.__arabicParser__.arabicLetterHasFinalForm=function(p){return o(p)&&i(p)&&t[p.charCodeAt(0)].length>=2};e.__arabicParser__.arabicLetterHasInitialForm=function(p){return o(p)&&i(p)&&t[p.charCodeAt(0)].length>=3};var u=e.__arabicParser__.arabicLetterHasMedialForm=function(p){return o(p)&&i(p)&&t[p.charCodeAt(0)].length==4},h=e.__arabicParser__.resolveLigatures=function(p){var v=0,g=n,y="",b=0;for(v=0;v<p.length;v+=1)g[p.charCodeAt(v)]!==void 0?(b++,typeof(g=g[p.charCodeAt(v)])=="number"&&(y+=String.fromCharCode(g),g=n,b=0),v===p.length-1&&(g=n,y+=p.charAt(v-(b-1)),v-=b-1,b=0)):(g=n,y+=p.charAt(v-b),v-=b,b=0);return y};e.__arabicParser__.isArabicDiacritic=function(p){return p!==void 0&&s[p.charCodeAt(0)]!==void 0};var f=e.__arabicParser__.getCorrectForm=function(p,v,g){return o(p)?i(p)===!1?-1:!d(p)||!o(v)&&!o(g)||!o(g)&&l(v)||l(p)&&!o(v)||l(p)&&c(v)||l(p)&&l(v)?0:u(p)&&o(v)&&!l(v)&&o(g)&&d(g)?3:l(p)||!o(g)?1:2:-1},m=function(p){var v=0,g=0,y=0,b="",w="",_="",C=(p=p||"").split("\\s+"),E=[];for(v=0;v<C.length;v+=1){for(E.push(""),g=0;g<C[v].length;g+=1)b=C[v][g],w=C[v][g-1],_=C[v][g+1],o(b)?(y=f(b,w,_),E[v]+=y!==-1?String.fromCharCode(t[b.charCodeAt(0)][y]):b):E[v]+=b;E[v]=h(E[v])}return E.join(" ")},x=e.__arabicParser__.processArabic=e.processArabic=function(){var p,v=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,g=[];if(Array.isArray(v)){var y=0;for(g=[],y=0;y<v.length;y+=1)Array.isArray(v[y])?g.push([m(v[y][0]),v[y][1],v[y][2]]):g.push([m(v[y])]);p=g}else p=m(v);return typeof arguments[0]=="string"?p:(arguments[0].text=p,arguments[0])};e.events.push(["preProcessText",x])}(ar.API),ar.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 n=void 0;Object.defineProperty(this,"pdf",{get:function(){return n},set:function(l){n=l}});var s=150;Object.defineProperty(this,"width",{get:function(){return s},set:function(l){s=isNaN(l)||Number.isInteger(l)===!1||l<0?150:l,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=s+1)}});var a=300;Object.defineProperty(this,"height",{get:function(){return a},set:function(l){a=isNaN(l)||Number.isInteger(l)===!1||l<0?300:l,this.getContext("2d").pageWrapYEnabled&&(this.getContext("2d").pageWrapY=a+1)}});var i=[];Object.defineProperty(this,"childNodes",{get:function(){return i},set:function(l){i=l}});var o={};Object.defineProperty(this,"style",{get:function(){return o},set:function(l){o=l}}),Object.defineProperty(this,"parentNode",{})};t.prototype.getContext=function(n,s){var a;if((n=n||"2d")!=="2d")return null;for(a in s)this.pdf.context2d.hasOwnProperty(a)&&(this.pdf.context2d[a]=s[a]);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}])}(ar.API),function(e){var t={left:0,top:0,bottom:0,right:0},n=!1,s=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(),a.call(this))},a=function(){this.internal.__cell__.lastCell=new i,this.internal.__cell__.pages=1},i=function(){var c=arguments[0];Object.defineProperty(this,"x",{enumerable:!0,get:function(){return c},set:function(p){c=p}});var d=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return d},set:function(p){d=p}});var u=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return u},set:function(p){u=p}});var h=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return h},set:function(p){h=p}});var f=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return f},set:function(p){f=p}});var m=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return m},set:function(p){m=p}});var x=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return x},set:function(p){x=p}}),this};i.prototype.clone=function(){return new i(this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align)},i.prototype.toArray=function(){return[this.x,this.y,this.width,this.height,this.text,this.lineNumber,this.align]},e.setHeaderFunction=function(c){return s.call(this),this.internal.__cell__.headerFunction=typeof c=="function"?c:void 0,this},e.getTextDimensions=function(c,d){s.call(this);var u=(d=d||{}).fontSize||this.getFontSize(),h=d.font||this.getFont(),f=d.scaleFactor||this.internal.scaleFactor,m=0,x=0,p=0,v=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 g=d.maxWidth;g>0?typeof c=="string"?c=this.splitTextToSize(c,g):Object.prototype.toString.call(c)==="[object Array]"&&(c=c.reduce(function(b,w){return b.concat(v.splitTextToSize(w,g))},[])):c=Array.isArray(c)?c:[c];for(var y=0;y<c.length;y++)m<(p=this.getStringUnitWidth(c[y],{font:h})*u)&&(m=p);return m!==0&&(x=c.length),{w:m/=f,h:Math.max((x*u*this.getLineHeightFactor()-u*(this.getLineHeightFactor()-1))/f,0)}},e.cellAddPage=function(){s.call(this),this.addPage();var c=this.internal.__cell__.margins||t;return this.internal.__cell__.lastCell=new i(c.left,c.top,void 0,void 0),this.internal.__cell__.pages+=1,this};var o=e.cell=function(){var c;c=arguments[0]instanceof i?arguments[0]:new i(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6]),s.call(this);var d=this.internal.__cell__.lastCell,u=this.internal.__cell__.padding,h=this.internal.__cell__.margins||t,f=this.internal.__cell__.tableHeaderRow,m=this.internal.__cell__.printHeaders;return d.lineNumber!==void 0&&(d.lineNumber===c.lineNumber?(c.x=(d.x||0)+(d.width||0),c.y=d.y||0):d.y+d.height+c.height+h.bottom>this.getPageHeight()?(this.cellAddPage(),c.y=h.top,m&&f&&(this.printHeaderRow(c.lineNumber,!0),c.y+=f[0].height)):c.y=d.y+d.height||c.y),c.text[0]!==void 0&&(this.rect(c.x,c.y,c.width,c.height,n===!0?"FD":void 0),c.align==="right"?this.text(c.text,c.x+c.width-u,c.y+u,{align:"right",baseline:"top"}):c.align==="center"?this.text(c.text,c.x+c.width/2,c.y+u,{align:"center",baseline:"top",maxWidth:c.width-u-u}):this.text(c.text,c.x+u,c.y+u,{align:"left",baseline:"top",maxWidth:c.width-u-u})),this.internal.__cell__.lastCell=c,this};e.table=function(c,d,u,h,f){if(s.call(this),!u)throw new Error("No data for PDF table.");var m,x,p,v,g=[],y=[],b=[],w={},_={},C=[],E=[],N=(f=f||{}).autoSize||!1,k=f.printHeaders!==!1,I=f.css&&f.css["font-size"]!==void 0?16*f.css["font-size"]:f.fontSize||12,P=f.margins||Object.assign({width:this.getPageWidth()},t),O=typeof f.padding=="number"?f.padding:3,A=f.headerBackgroundColor||"#c8c8c8",R=f.headerTextColor||"#000";if(a.call(this),this.internal.__cell__.printHeaders=k,this.internal.__cell__.margins=P,this.internal.__cell__.table_font_size=I,this.internal.__cell__.padding=O,this.internal.__cell__.headerBackgroundColor=A,this.internal.__cell__.headerTextColor=R,this.setFontSize(I),h==null)y=g=Object.keys(u[0]),b=g.map(function(){return"left"});else if(Array.isArray(h)&&En(h[0])==="object")for(g=h.map(function(ne){return ne.name}),y=h.map(function(ne){return ne.prompt||ne.name||""}),b=h.map(function(ne){return ne.align||"left"}),m=0;m<h.length;m+=1)_[h[m].name]=.7499990551181103*h[m].width;else Array.isArray(h)&&typeof h[0]=="string"&&(y=g=h,b=g.map(function(){return"left"}));if(N||Array.isArray(h)&&typeof h[0]=="string")for(m=0;m<g.length;m+=1){for(w[v=g[m]]=u.map(function(ne){return ne[v]}),this.setFont(void 0,"bold"),C.push(this.getTextDimensions(y[m],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),x=w[v],this.setFont(void 0,"normal"),p=0;p<x.length;p+=1)C.push(this.getTextDimensions(x[p],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);_[v]=Math.max.apply(null,C)+O+O,C=[]}if(k){var L={};for(m=0;m<g.length;m+=1)L[g[m]]={},L[g[m]].text=y[m],L[g[m]].align=b[m];var z=l.call(this,L,_);E=g.map(function(ne){return new i(c,d,_[ne],z,L[ne].text,void 0,L[ne].align)}),this.setTableHeaderRow(E),this.printHeaderRow(1,!1)}var U=h.reduce(function(ne,se){return ne[se.name]=se.align,ne},{});for(m=0;m<u.length;m+=1){"rowStart"in f&&f.rowStart instanceof Function&&f.rowStart({row:m,data:u[m]},this);var $=l.call(this,u[m],_);for(p=0;p<g.length;p+=1){var q=u[m][g[p]];"cellStart"in f&&f.cellStart instanceof Function&&f.cellStart({row:m,col:p,data:q},this),o.call(this,new i(c,d,_[g[p]],$,q,m+2,U[g[p]]))}}return this.internal.__cell__.table_x=c,this.internal.__cell__.table_y=d,this};var l=function(c,d){var u=this.internal.__cell__.padding,h=this.internal.__cell__.table_font_size,f=this.internal.scaleFactor;return Object.keys(c).map(function(m){var x=c[m];return this.splitTextToSize(x.hasOwnProperty("text")?x.text:x,d[m]-u-u)},this).map(function(m){return this.getLineHeightFactor()*m.length*h/f+u+u},this).reduce(function(m,x){return Math.max(m,x)},0)};e.setTableHeaderRow=function(c){s.call(this),this.internal.__cell__.tableHeaderRow=c},e.printHeaderRow=function(c,d){if(s.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var u;if(n=!0,typeof this.internal.__cell__.headerFunction=="function"){var h=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new i(h[0],h[1],h[2],h[3],void 0,-1)}this.setFont(void 0,"bold");for(var f=[],m=0;m<this.internal.__cell__.tableHeaderRow.length;m+=1){u=this.internal.__cell__.tableHeaderRow[m].clone(),d&&(u.y=this.internal.__cell__.margins.top||0,f.push(u)),u.lineNumber=c;var x=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,u),this.setTextColor(x)}f.length>0&&this.setTableHeaderRow(f),this.setFont(void 0,"normal"),n=!1}}(ar.API);var rre={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},nre=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],AE=tre(nre),sre=[100,200,300,400,500,600,700,800,900],eZe=tre(sre);function AC(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),n=function(i){return rre[i=i||"normal"]?i:"normal"}(e.style),s=function(i){return i?typeof i=="number"?i>=100&&i<=900&&i%100==0?i:400:/^\d00$/.test(i)?parseInt(i):i==="bold"?700:400:400}(e.weight),a=function(i){return typeof AE[i=i||"normal"]=="number"?i:"normal"}(e.stretch);return{family:t,style:n,weight:s,stretch:a,src:e.src||[],ref:e.ref||{name:t,style:[a,n,s].join(" ")}}}function w9(e,t,n,s){var a;for(a=n;a>=0&&a<t.length;a+=s)if(e[t[a]])return e[t[a]];for(a=n;a>=0&&a<t.length;a-=s)if(e[t[a]])return e[t[a]]}var tZe={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},N9={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function _9(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function S9(e){return e.trimLeft()}function rZe(e,t){for(var n=0;n<e.length;){if(e.charAt(n)===t)return[e.substring(0,n),e.substring(n+1)];n+=1}return null}function nZe(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 Yp,D1,k9,C9,A9,PC=["times"];function P9(e,t,n,s,a){var i=4,o=T9;switch(a){case ar.API.image_compression.FAST:i=1,o=E9;break;case ar.API.image_compression.MEDIUM:i=6,o=O9;break;case ar.API.image_compression.SLOW:i=9,o=L9}e=function(c,d,u,h){for(var f,m=c.length/d,x=new Uint8Array(c.length+m),p=[sZe,E9,T9,O9,L9],v=0;v<m;v+=1){var g=v*d,y=c.subarray(g,g+d);if(h)x.set(h(y,u,f),g+v);else{for(var b=p.length,w=[],_=0;_<b;_+=1)w[_]=p[_](y,u,f);var C=iZe(w.concat());x.set(w[C],g+v)}f=y}return x}(e,t,Math.ceil(n*s/8),o);var l=pE(e,{level:i});return ar.API.__addimage__.arrayBufferToBinaryString(l)}function sZe(e){var t=Array.apply([],e);return t.unshift(0),t}function E9(e,t){var n=e.length,s=[];s[0]=1;for(var a=0;a<n;a+=1){var i=e[a-t]||0;s[a+1]=e[a]-i+256&255}return s}function T9(e,t,n){var s=e.length,a=[];a[0]=2;for(var i=0;i<s;i+=1){var o=n&&n[i]||0;a[i+1]=e[i]-o+256&255}return a}function O9(e,t,n){var s=e.length,a=[];a[0]=3;for(var i=0;i<s;i+=1){var o=e[i-t]||0,l=n&&n[i]||0;a[i+1]=e[i]+256-(o+l>>>1)&255}return a}function L9(e,t,n){var s=e.length,a=[];a[0]=4;for(var i=0;i<s;i+=1){var o=aZe(e[i-t]||0,n&&n[i]||0,n&&n[i-t]||0);a[i+1]=e[i]-o+256&255}return a}function aZe(e,t,n){if(e===t&&t===n)return e;var s=Math.abs(t-n),a=Math.abs(e-n),i=Math.abs(e+t-n-n);return s<=a&&s<=i?e:a<=i?t:n}function iZe(e){var t=e.map(function(n){return n.reduce(function(s,a){return s+Math.abs(a)},0)});return t.indexOf(Math.min.apply(null,t))}function EC(e,t,n){var s=t*n,a=Math.floor(s/8),i=16-(s-8*a+n),o=(1<<n)-1;return are(e,a)>>i&o}function I9(e,t,n,s){var a=n*s,i=Math.floor(a/8),o=16-(a-8*i+s),l=(1<<s)-1,c=(t&l)<<o;(function(d,u,h){if(u+1<d.byteLength)d.setUint16(u,h,!1);else{var f=h>>8&255;d.setUint8(u,f)}})(e,i,are(e,i)&~(l<<o)&65535|c)}function are(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function oZe(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 n=e[t++]|e[t++]<<8,s=e[t++]|e[t++]<<8,a=e[t++],i=a>>7,o=1<<1+(7&a);e[t++],e[t++];var l=null,c=null;i&&(l=t,c=o,t+=3*o);var d=!0,u=[],h=0,f=null,m=0,x=null;for(this.width=n,this.height=s;d&&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,x=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((P=e[t++])>=0))throw Error("Invalid block size");if(P===0)break;t+=P}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var p=e[t++];h=e[t++]|e[t++]<<8,f=e[t++],1&p||(f=null),m=p>>2&7,t++;break;case 254:for(;;){if(!((P=e[t++])>=0))throw Error("Invalid block size");if(P===0)break;t+=P}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var v=e[t++]|e[t++]<<8,g=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,w=e[t++],_=w>>6&1,C=1<<1+(7&w),E=l,N=c,k=!1;w>>7&&(k=!0,E=t,N=C,t+=3*C);var I=t;for(t++;;){var P;if(!((P=e[t++])>=0))throw Error("Invalid block size");if(P===0)break;t+=P}u.push({x:v,y:g,width:y,height:b,has_local_palette:k,palette_offset:E,palette_size:N,data_offset:I,data_length:t-I,transparent_index:f,interlaced:!!_,delay:h,disposal:m});break;case 59:d=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return x},this.frameInfo=function(O){if(O<0||O>=u.length)throw new Error("Frame index out of range.");return u[O]},this.decodeAndBlitFrameBGRA=function(O,A){var R=this.frameInfo(O),L=R.width*R.height;if(L>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var z=new Uint8Array(L);R9(e,R.data_offset,z,L);var U=R.palette_offset,$=R.transparent_index;$===null&&($=256);var q=R.width,ne=n-q,se=q,F=4*(R.y*n+R.x),V=4*((R.y+R.height)*n+R.x),Z=F,de=4*ne;R.interlaced===!0&&(de+=4*n*7);for(var ve=8,pe=0,_e=z.length;pe<_e;++pe){var xe=z[pe];if(se===0&&(se=q,(Z+=de)>=V&&(de=4*ne+4*n*(ve-1),Z=F+(q+ne)*(ve<<1),ve>>=1)),xe===$)Z+=4;else{var oe=e[U+3*xe],we=e[U+3*xe+1],ce=e[U+3*xe+2];A[Z++]=ce,A[Z++]=we,A[Z++]=oe,A[Z++]=255}--se}},this.decodeAndBlitFrameRGBA=function(O,A){var R=this.frameInfo(O),L=R.width*R.height;if(L>536870912)throw new Error("Image dimensions exceed 512MB, which is too large.");var z=new Uint8Array(L);R9(e,R.data_offset,z,L);var U=R.palette_offset,$=R.transparent_index;$===null&&($=256);var q=R.width,ne=n-q,se=q,F=4*(R.y*n+R.x),V=4*((R.y+R.height)*n+R.x),Z=F,de=4*ne;R.interlaced===!0&&(de+=4*n*7);for(var ve=8,pe=0,_e=z.length;pe<_e;++pe){var xe=z[pe];if(se===0&&(se=q,(Z+=de)>=V&&(de=4*ne+4*n*(ve-1),Z=F+(q+ne)*(ve<<1),ve>>=1)),xe===$)Z+=4;else{var oe=e[U+3*xe],we=e[U+3*xe+1],ce=e[U+3*xe+2];A[Z++]=oe,A[Z++]=we,A[Z++]=ce,A[Z++]=255}--se}}}function R9(e,t,n,s){for(var a=e[t++],i=1<<a,o=i+1,l=o+1,c=a+1,d=(1<<c)-1,u=0,h=0,f=0,m=e[t++],x=new Int32Array(4096),p=null;;){for(;u<16&&m!==0;)h|=e[t++]<<u,u+=8,m===1?m=e[t++]:--m;if(u<c)break;var v=h&d;if(h>>=c,u-=c,v!==i){if(v===o)break;for(var g=v<l?v:p,y=0,b=g;b>i;)b=x[b]>>8,++y;var w=b;if(f+y+(g!==v?1:0)>s)return void Bn.log("Warning, gif stream longer than expected.");n[f++]=w;var _=f+=y;for(g!==v&&(n[f++]=w),b=g;y--;)b=x[b],n[--_]=255&b,b>>=8;p!==null&&l<4096&&(x[l++]=p<<8|w,l>=d+1&&c<12&&(++c,d=d<<1|1)),p=v}else l=o+1,d=(1<<(c=a+1))-1,p=null}return f!==s&&Bn.log("Warning, gif stream shorter than expected."),n}/** 1090 * @license 1091 Copyright (c) 2008, Adobe Systems Incorporated 1092 All rights reserved. 1093 1094 Redistribution and use in source and binary forms, with or without 1095 modification, are permitted provided that the following conditions are 1096 met: 1097 1098 * Redistributions of source code must retain the above copyright notice, 1099 this list of conditions and the following disclaimer. 1100 1101 * Redistributions in binary form must reproduce the above copyright 1102 notice, this list of conditions and the following disclaimer in the 1103 documentation and/or other materials provided with the distribution. 1104 1105 * Neither the name of Adobe Systems Incorporated nor the names of its 1106 contributors may be used to endorse or promote products derived from 1107 this software without specific prior written permission. 1108 1109 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 1110 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1111 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1112 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 1113 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 1114 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 1115 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 1116 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 1117 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 1118 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 1119 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1120*/function TC(e){var t,n,s,a,i,o=Math.floor,l=new Array(64),c=new Array(64),d=new Array(64),u=new Array(64),h=new Array(65535),f=new Array(65535),m=new Array(64),x=new Array(64),p=[],v=0,g=7,y=new Array(64),b=new Array(64),w=new Array(64),_=new Array(256),C=new Array(2048),E=[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],N=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],k=[0,1,2,3,4,5,6,7,8,9,10,11],I=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],P=[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],O=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],A=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],L=[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 z(F,V){for(var Z=0,de=0,ve=new Array,pe=1;pe<=16;pe++){for(var _e=1;_e<=F[pe];_e++)ve[V[de]]=[],ve[V[de]][0]=Z,ve[V[de]][1]=pe,de++,Z++;Z*=2}return ve}function U(F){for(var V=F[0],Z=F[1]-1;Z>=0;)V&1<<Z&&(v|=1<<g),Z--,--g<0&&(v==255?($(255),$(0)):$(v),g=7,v=0)}function $(F){p.push(F)}function q(F){$(F>>8&255),$(255&F)}function ne(F,V,Z,de,ve){for(var pe,_e=ve[0],xe=ve[240],oe=function(Ve,he){var ye,Ee,Fe,tt,qe,st,Ct,ke,Ie,at,rt=0;for(Ie=0;Ie<8;++Ie){ye=Ve[rt],Ee=Ve[rt+1],Fe=Ve[rt+2],tt=Ve[rt+3],qe=Ve[rt+4],st=Ve[rt+5],Ct=Ve[rt+6];var Gt=ye+(ke=Ve[rt+7]),gt=ye-ke,Zt=Ee+Ct,dr=Ee-Ct,Fr=Fe+st,Tt=Fe-st,Br=tt+qe,tr=tt-qe,or=Gt+Br,pn=Gt-Br,xr=Zt+Fr,Bt=Zt-Fr;Ve[rt]=or+xr,Ve[rt+4]=or-xr;var Zr=.707106781*(Bt+pn);Ve[rt+2]=pn+Zr,Ve[rt+6]=pn-Zr;var sr=.382683433*((or=tr+Tt)-(Bt=dr+gt)),ur=.5411961*or+sr,Gr=1.306562965*Bt+sr,ts=.707106781*(xr=Tt+dr),Ut=gt+ts,Ur=gt-ts;Ve[rt+5]=Ur+ur,Ve[rt+3]=Ur-ur,Ve[rt+1]=Ut+Gr,Ve[rt+7]=Ut-Gr,rt+=8}for(rt=0,Ie=0;Ie<8;++Ie){ye=Ve[rt],Ee=Ve[rt+8],Fe=Ve[rt+16],tt=Ve[rt+24],qe=Ve[rt+32],st=Ve[rt+40],Ct=Ve[rt+48];var vs=ye+(ke=Ve[rt+56]),us=ye-ke,Rs=Ee+Ct,Cs=Ee-Ct,ja=Fe+st,Ea=Fe-st,of=tt+qe,mu=tt-qe,jl=vs+of,pc=vs-of,wl=Rs+ja,Nl=Rs-ja;Ve[rt]=jl+wl,Ve[rt+32]=jl-wl;var Wo=.707106781*(Nl+pc);Ve[rt+16]=pc+Wo,Ve[rt+48]=pc-Wo;var lf=.382683433*((jl=mu+Ea)-(Nl=Cs+us)),gc=.5411961*jl+lf,cf=1.306562965*Nl+lf,lp=.707106781*(wl=Ea+Cs),cp=us+lp,dp=us-lp;Ve[rt+40]=dp+gc,Ve[rt+24]=dp-gc,Ve[rt+8]=cp+cf,Ve[rt+56]=cp-cf,rt++}for(Ie=0;Ie<64;++Ie)at=Ve[Ie]*he[Ie],m[Ie]=at>0?at+.5|0:at-.5|0;return m}(F,V),we=0;we<64;++we)x[E[we]]=oe[we];var ce=x[0]-Z;Z=x[0],ce==0?U(de[0]):(U(de[f[pe=32767+ce]]),U(h[pe]));for(var De=63;De>0&&x[De]==0;)De--;if(De==0)return U(_e),Z;for(var Ue,re=1;re<=De;){for(var et=re;x[re]==0&&re<=De;)++re;var kt=re-et;if(kt>=16){Ue=kt>>4;for(var St=1;St<=Ue;++St)U(xe);kt&=15}pe=32767+x[re],U(ve[(kt<<4)+f[pe]]),U(h[pe]),re++}return De!=63&&U(_e),Z}function se(F){F=Math.min(Math.max(F,1),100),i!=F&&(function(V){for(var Z=[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],de=0;de<64;de++){var ve=o((Z[de]*V+50)/100);ve=Math.min(Math.max(ve,1),255),l[E[de]]=ve}for(var pe=[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],_e=0;_e<64;_e++){var xe=o((pe[_e]*V+50)/100);xe=Math.min(Math.max(xe,1),255),c[E[_e]]=xe}for(var oe=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],we=0,ce=0;ce<8;ce++)for(var De=0;De<8;De++)d[we]=1/(l[E[we]]*oe[ce]*oe[De]*8),u[we]=1/(c[E[we]]*oe[ce]*oe[De]*8),we++}(F<50?Math.floor(5e3/F):Math.floor(200-2*F)),i=F)}this.encode=function(F,V){V&&se(V),p=new Array,v=0,g=7,q(65496),q(65504),q(16),$(74),$(70),$(73),$(70),$(0),$(1),$(1),$(0),q(1),q(1),$(0),$(0),function(){q(65499),q(132),$(0);for(var Ee=0;Ee<64;Ee++)$(l[Ee]);$(1);for(var Fe=0;Fe<64;Fe++)$(c[Fe])}(),function(Ee,Fe){q(65472),q(17),$(8),q(Fe),q(Ee),$(3),$(1),$(17),$(0),$(2),$(17),$(1),$(3),$(17),$(1)}(F.width,F.height),function(){q(65476),q(418),$(0);for(var Ee=0;Ee<16;Ee++)$(N[Ee+1]);for(var Fe=0;Fe<=11;Fe++)$(k[Fe]);$(16);for(var tt=0;tt<16;tt++)$(I[tt+1]);for(var qe=0;qe<=161;qe++)$(P[qe]);$(1);for(var st=0;st<16;st++)$(O[st+1]);for(var Ct=0;Ct<=11;Ct++)$(A[Ct]);$(17);for(var ke=0;ke<16;ke++)$(R[ke+1]);for(var Ie=0;Ie<=161;Ie++)$(L[Ie])}(),q(65498),q(12),$(3),$(1),$(0),$(2),$(17),$(3),$(17),$(0),$(63),$(0);var Z=0,de=0,ve=0;v=0,g=7,this.encode.displayName="_encode_";for(var pe,_e,xe,oe,we,ce,De,Ue,re,et=F.data,kt=F.width,St=F.height,Ve=4*kt,he=0;he<St;){for(pe=0;pe<Ve;){for(we=Ve*he+pe,De=-1,Ue=0,re=0;re<64;re++)ce=we+(Ue=re>>3)*Ve+(De=4*(7&re)),he+Ue>=St&&(ce-=Ve*(he+1+Ue-St)),pe+De>=Ve&&(ce-=pe+De-Ve+4),_e=et[ce++],xe=et[ce++],oe=et[ce++],y[re]=(C[_e]+C[xe+256|0]+C[oe+512|0]>>16)-128,b[re]=(C[_e+768|0]+C[xe+1024|0]+C[oe+1280|0]>>16)-128,w[re]=(C[_e+1280|0]+C[xe+1536|0]+C[oe+1792|0]>>16)-128;Z=ne(y,d,Z,t,s),de=ne(b,u,de,n,a),ve=ne(w,u,ve,n,a),pe+=32}he+=8}if(g>=0){var ye=[];ye[1]=g+1,ye[0]=(1<<g+1)-1,U(ye)}return q(65497),new Uint8Array(p)},e=e||50,function(){for(var F=String.fromCharCode,V=0;V<256;V++)_[V]=F(V)}(),t=z(N,k),n=z(O,A),s=z(I,P),a=z(R,L),function(){for(var F=1,V=2,Z=1;Z<=15;Z++){for(var de=F;de<V;de++)f[32767+de]=Z,h[32767+de]=[],h[32767+de][1]=Z,h[32767+de][0]=de;for(var ve=-(V-1);ve<=-F;ve++)f[32767+ve]=Z,h[32767+ve]=[],h[32767+ve][1]=Z,h[32767+ve][0]=V-1+ve;F<<=1,V<<=1}}(),function(){for(var F=0;F<256;F++)C[F]=19595*F,C[F+256|0]=38470*F,C[F+512|0]=7471*F+32768,C[F+768|0]=-11059*F,C[F+1024|0]=-21709*F,C[F+1280|0]=32768*F+8421375,C[F+1536|0]=-27439*F,C[F+1792|0]=-5329*F}(),se(e)}/** 1121 * @license 1122 * Copyright (c) 2017 Aras Abbasi 1123 * 1124 * Licensed under the MIT License. 1125 * http://opensource.org/licenses/mit-license 1126 */function Tl(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 M9(e){function t(k){if(!k)throw Error("assert :P")}function n(k,I,P){for(var O=0;4>O;O++)if(k[I+O]!=P.charCodeAt(O))return!0;return!1}function s(k,I,P,O,A){for(var R=0;R<A;R++)k[I+R]=P[O+R]}function a(k,I,P,O){for(var A=0;A<O;A++)k[I+A]=P}function i(k){return new Int32Array(k)}function o(k,I){for(var P=[],O=0;O<k;O++)P.push(new I);return P}function l(k,I){var P=[];return function O(A,R,L){for(var z=L[R],U=0;U<z&&(A.push(L.length>R+1?[]:new I),!(L.length<R+1));U++)O(A[U],R+1,L)}(P,0,k),P}var c=function(){var k=this;function I(S,T){for(var D=1<<T-1>>>0;S&D;)D>>>=1;return D?(S&D-1)+D:S}function P(S,T,D,B,K){t(!(B%D));do S[T+(B-=D)]=K;while(0<B)}function O(S,T,D,B,K){if(t(2328>=K),512>=K)var J=i(512);else if((J=i(K))==null)return 0;return function(Q,ae,ie,fe,Ce,$e){var me,Te,Le=ae,He=1<<ie,Me=i(16),Xe=i(16);for(t(Ce!=0),t(fe!=null),t(Q!=null),t(0<ie),Te=0;Te<Ce;++Te){if(15<fe[Te])return 0;++Me[fe[Te]]}if(Me[0]==Ce)return 0;for(Xe[1]=0,me=1;15>me;++me){if(Me[me]>1<<me)return 0;Xe[me+1]=Xe[me]+Me[me]}for(Te=0;Te<Ce;++Te)me=fe[Te],0<fe[Te]&&($e[Xe[me]++]=Te);if(Xe[15]==1)return(fe=new A).g=0,fe.value=$e[0],P(Q,Le,1,He,fe),He;var Je,ct=-1,lt=He-1,nr=0,zt=1,zr=1,Jt=1<<ie;for(Te=0,me=1,Ce=2;me<=ie;++me,Ce<<=1){if(zt+=zr<<=1,0>(zr-=Me[me]))return 0;for(;0<Me[me];--Me[me])(fe=new A).g=me,fe.value=$e[Te++],P(Q,Le+nr,Ce,Jt,fe),nr=I(nr,me)}for(me=ie+1,Ce=2;15>=me;++me,Ce<<=1){if(zt+=zr<<=1,0>(zr-=Me[me]))return 0;for(;0<Me[me];--Me[me]){if(fe=new A,(nr<)!=ct){for(Le+=Jt,Je=1<<(ct=me)-ie;15>ct&&!(0>=(Je-=Me[ct]));)++ct,Je<<=1;He+=Jt=1<<(Je=ct-ie),Q[ae+(ct=nr<)].g=Je+ie,Q[ae+ct].value=Le-ae-ct}fe.g=me-ie,fe.value=$e[Te++],P(Q,Le+(nr>>ie),Ce,Jt,fe),nr=I(nr,me)}}return zt!=2*Xe[15]-1?0:He}(S,T,D,B,K,J)}function A(){this.value=this.g=0}function R(){this.value=this.g=0}function L(){this.G=o(5,A),this.H=i(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(Np,R)}function z(S,T,D,B){t(S!=null),t(T!=null),t(2147483648>B),S.Ca=254,S.I=0,S.b=-8,S.Ka=0,S.oa=T,S.pa=D,S.Jd=T,S.Yc=D+B,S.Zc=4<=B?D+B-4+1:D,_e(S)}function U(S,T){for(var D=0;0<T--;)D|=oe(S,128)<<T;return D}function $(S,T){var D=U(S,T);return xe(S)?-D:D}function q(S,T,D,B){var K,J=0;for(t(S!=null),t(T!=null),t(4294967288>B),S.Sb=B,S.Ra=0,S.u=0,S.h=0,4<B&&(B=4),K=0;K<B;++K)J+=T[D+K]<<8*K;S.Ra=J,S.bb=B,S.oa=T,S.pa=D}function ne(S){for(;8<=S.u&&S.bb<S.Sb;)S.Ra>>>=8,S.Ra+=S.oa[S.pa+S.bb]<<mi-8>>>0,++S.bb,S.u-=8;de(S)&&(S.h=1,S.u=0)}function se(S,T){if(t(0<=T),!S.h&&T<=Vv){var D=Z(S)&yf[T];return S.u+=T,ne(S),D}return S.h=1,S.u=0}function F(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function V(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function Z(S){return S.Ra>>>(S.u&mi-1)>>>0}function de(S){return t(S.bb<=S.Sb),S.h||S.bb==S.Sb&&S.u>mi}function ve(S,T){S.u=T,S.h=de(S)}function pe(S){S.u>=$i&&(t(S.u>=$i),ne(S))}function _e(S){t(S!=null&&S.oa!=null),S.pa<S.Zc?(S.I=(S.oa[S.pa++]|S.I<<8)>>>0,S.b+=8):(t(S!=null&&S.oa!=null),S.pa<S.Yc?(S.b+=8,S.I=S.oa[S.pa++]|S.I<<8):S.Ka?S.b=0:(S.I<<=8,S.b+=8,S.Ka=1))}function xe(S){return U(S,1)}function oe(S,T){var D=S.Ca;0>S.b&&_e(S);var B=S.b,K=D*T>>>8,J=(S.I>>>B>K)+0;for(J?(D-=K,S.I-=K+1<<B>>>0):D=K+1,B=D,K=0;256<=B;)K+=8,B>>=8;return B=7^K+_p[B],S.b-=B,S.Ca=(D<<B)-1,J}function we(S,T,D){S[T+0]=D>>24&255,S[T+1]=D>>16&255,S[T+2]=D>>8&255,S[T+3]=255&D}function ce(S,T){return S[T+0]|S[T+1]<<8}function De(S,T){return ce(S,T)|S[T+2]<<16}function Ue(S,T){return ce(S,T)|ce(S,T+2)<<16}function re(S,T){var D=1<<T;return t(S!=null),t(0<T),S.X=i(D),S.X==null?0:(S.Mb=32-T,S.Xa=T,1)}function et(S,T){t(S!=null),t(T!=null),t(S.Xa==T.Xa),s(T.X,0,S.X,0,1<<T.Xa)}function kt(){this.X=[],this.Xa=this.Mb=0}function St(S,T,D,B){t(D!=null),t(B!=null);var K=D[0],J=B[0];return K==0&&(K=(S*J+T/2)/T),J==0&&(J=(T*K+S/2)/S),0>=K||0>=J?0:(D[0]=K,B[0]=J,1)}function Ve(S,T){return S+(1<<T)-1>>>T}function he(S,T){return((4278255360&S)+(4278255360&T)>>>0&4278255360)+((16711935&S)+(16711935&T)>>>0&16711935)>>>0}function ye(S,T){k[T]=function(D,B,K,J,Q,ae,ie){var fe;for(fe=0;fe<Q;++fe){var Ce=k[S](ae[ie+fe-1],K,J+fe);ae[ie+fe]=he(D[B+fe],Ce)}}}function Ee(){this.ud=this.hd=this.jd=0}function Fe(S,T){return((4278124286&(S^T))>>>1)+(S&T)>>>0}function tt(S){return 0<=S&&256>S?S:0>S?0:255<S?255:void 0}function qe(S,T){return tt(S+(S-T+.5>>1))}function st(S,T,D){return Math.abs(T-D)-Math.abs(S-D)}function Ct(S,T,D,B,K,J,Q){for(B=J[Q-1],D=0;D<K;++D)J[Q+D]=B=he(S[T+D],B)}function ke(S,T,D,B,K){var J;for(J=0;J<D;++J){var Q=S[T+J],ae=Q>>8&255,ie=16711935&(ie=(ie=16711935&Q)+((ae<<16)+ae));B[K+J]=(4278255360&Q)+ie>>>0}}function Ie(S,T){T.jd=255&S,T.hd=S>>8&255,T.ud=S>>16&255}function at(S,T,D,B,K,J){var Q;for(Q=0;Q<B;++Q){var ae=T[D+Q],ie=ae>>>8,fe=ae,Ce=255&(Ce=(Ce=ae>>>16)+((S.jd<<24>>24)*(ie<<24>>24)>>>5));fe=255&(fe=(fe+=(S.hd<<24>>24)*(ie<<24>>24)>>>5)+((S.ud<<24>>24)*(Ce<<24>>24)>>>5)),K[J+Q]=(4278255360&ae)+(Ce<<16)+fe}}function rt(S,T,D,B,K){k[T]=function(J,Q,ae,ie,fe,Ce,$e,me,Te){for(ie=$e;ie<me;++ie)for($e=0;$e<Te;++$e)fe[Ce++]=K(ae[B(J[Q++])])},k[S]=function(J,Q,ae,ie,fe,Ce,$e){var me=8>>J.b,Te=J.Ea,Le=J.K[0],He=J.w;if(8>me)for(J=(1<<J.b)-1,He=(1<<me)-1;Q<ae;++Q){var Me,Xe=0;for(Me=0;Me<Te;++Me)Me&J||(Xe=B(ie[fe++])),Ce[$e++]=K(Le[Xe&He]),Xe>>=me}else k["VP8LMapColor"+D](ie,fe,Le,He,Ce,$e,Q,ae,Te)}}function Gt(S,T,D,B,K){for(D=T+D;T<D;){var J=S[T++];B[K++]=J>>16&255,B[K++]=J>>8&255,B[K++]=255&J}}function gt(S,T,D,B,K){for(D=T+D;T<D;){var J=S[T++];B[K++]=J>>16&255,B[K++]=J>>8&255,B[K++]=255&J,B[K++]=J>>24&255}}function Zt(S,T,D,B,K){for(D=T+D;T<D;){var J=(Q=S[T++])>>16&240|Q>>12&15,Q=240&Q|Q>>28&15;B[K++]=J,B[K++]=Q}}function dr(S,T,D,B,K){for(D=T+D;T<D;){var J=(Q=S[T++])>>16&248|Q>>13&7,Q=Q>>5&224|Q>>3&31;B[K++]=J,B[K++]=Q}}function Fr(S,T,D,B,K){for(D=T+D;T<D;){var J=S[T++];B[K++]=255&J,B[K++]=J>>8&255,B[K++]=J>>16&255}}function Tt(S,T,D,B,K,J){if(J==0)for(D=T+D;T<D;)we(B,((J=S[T++])[0]>>24|J[1]>>8&65280|J[2]<<8&16711680|J[3]<<24)>>>0),K+=32;else s(B,K,S,T,D)}function Br(S,T){k[T][0]=k[S+"0"],k[T][1]=k[S+"1"],k[T][2]=k[S+"2"],k[T][3]=k[S+"3"],k[T][4]=k[S+"4"],k[T][5]=k[S+"5"],k[T][6]=k[S+"6"],k[T][7]=k[S+"7"],k[T][8]=k[S+"8"],k[T][9]=k[S+"9"],k[T][10]=k[S+"10"],k[T][11]=k[S+"11"],k[T][12]=k[S+"12"],k[T][13]=k[S+"13"],k[T][14]=k[S+"0"],k[T][15]=k[S+"0"]}function tr(S){return S==e4||S==t4||S==yw||S==r4}function or(){this.eb=[],this.size=this.A=this.fb=0}function pn(){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 xr(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new or,this.f.kb=new pn,this.sd=null}function Bt(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function Zr(){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 sr(S){return alert("todo:WebPSamplerProcessPlane"),S.T}function ur(S,T){var D=S.T,B=T.ba.f.RGBA,K=B.eb,J=B.fb+S.ka*B.A,Q=Ko[T.ba.S],ae=S.y,ie=S.O,fe=S.f,Ce=S.N,$e=S.ea,me=S.W,Te=T.cc,Le=T.dc,He=T.Mc,Me=T.Nc,Xe=S.ka,Je=S.ka+S.T,ct=S.U,lt=ct+1>>1;for(Xe==0?Q(ae,ie,null,null,fe,Ce,$e,me,fe,Ce,$e,me,K,J,null,null,ct):(Q(T.ec,T.fc,ae,ie,Te,Le,He,Me,fe,Ce,$e,me,K,J-B.A,K,J,ct),++D);Xe+2<Je;Xe+=2)Te=fe,Le=Ce,He=$e,Me=me,Ce+=S.Rc,me+=S.Rc,J+=2*B.A,Q(ae,(ie+=2*S.fa)-S.fa,ae,ie,Te,Le,He,Me,fe,Ce,$e,me,K,J-B.A,K,J,ct);return ie+=S.fa,S.j+Je<S.o?(s(T.ec,T.fc,ae,ie,ct),s(T.cc,T.dc,fe,Ce,lt),s(T.Mc,T.Nc,$e,me,lt),D--):1&Je||Q(ae,ie,null,null,fe,Ce,$e,me,fe,Ce,$e,me,K,J+B.A,null,null,ct),D}function Gr(S,T,D){var B=S.F,K=[S.J];if(B!=null){var J=S.U,Q=T.ba.S,ae=Q==vw||Q==yw;T=T.ba.f.RGBA;var ie=[0],fe=S.ka;ie[0]=S.T,S.Kb&&(fe==0?--ie[0]:(--fe,K[0]-=S.width),S.j+S.ka+S.T==S.o&&(ie[0]=S.o-S.j-fe));var Ce=T.eb;fe=T.fb+fe*T.A,S=HL(B,K[0],S.width,J,ie,Ce,fe+(ae?0:3),T.A),t(D==ie),S&&tr(Q)&&Yv(Ce,fe,ae,J,ie,T.A)}return 0}function ts(S){var T=S.ma,D=T.ba.S,B=11>D,K=D==gw||D==xw||D==vw||D==Q5||D==12||tr(D);if(T.memory=null,T.Ib=null,T.Jb=null,T.Nd=null,!Go(T.Oa,S,K?11:12))return 0;if(K&&tr(D)&&md(),S.da)alert("todo:use_scaling");else{if(B){if(T.Ib=sr,S.Kb){if(D=S.U+1>>1,T.memory=i(S.U+2*D),T.memory==null)return 0;T.ec=T.memory,T.fc=0,T.cc=T.ec,T.dc=T.fc+S.U,T.Mc=T.cc,T.Nc=T.dc+D,T.Ib=ur,md()}}else alert("todo:EmitYUV");K&&(T.Jb=Gr,B&&bs())}if(B&&!cI){for(S=0;256>S;++S)Are[S]=89858*(S-128)+jw>>bw,Tre[S]=-22014*(S-128)+jw,Ere[S]=-45773*(S-128),Pre[S]=113618*(S-128)+jw>>bw;for(S=Xv;S<a4;++S)T=76283*(S-16)+jw>>bw,Ore[S-Xv]=xc(T,255),Lre[S-Xv]=xc(T+8>>4,15);cI=1}return 1}function Ut(S){var T=S.ma,D=S.U,B=S.T;return t(!(1&S.ka)),0>=D||0>=B?0:(D=T.Ib(S,T),T.Jb!=null&&T.Jb(S,T,D),T.Dc+=D,1)}function Ur(S){S.ma.memory=null}function vs(S,T,D,B){return se(S,8)!=47?0:(T[0]=se(S,14)+1,D[0]=se(S,14)+1,B[0]=se(S,1),se(S,3)!=0?0:!S.h)}function us(S,T){if(4>S)return S+1;var D=S-2>>1;return(2+(1&S)<<D)+se(T,D)+1}function Rs(S,T){return 120<T?T-120:1<=(D=((D=mre[T-1])>>4)*S+(8-(15&D)))?D:1;var D}function Cs(S,T,D){var B=Z(D),K=S[T+=255&B].g-8;return 0<K&&(ve(D,D.u+8),B=Z(D),T+=S[T].value,T+=B&(1<<K)-1),ve(D,D.u+S[T].g),S[T].value}function ja(S,T,D){return D.g+=S.g,D.value+=S.value<<T>>>0,t(8>=D.g),S.g}function Ea(S,T,D){var B=S.xc;return t((T=B==0?0:S.vc[S.md*(D>>B)+(T>>B)])<S.Wb),S.Ya[T]}function of(S,T,D,B){var K=S.ab,J=S.c*T,Q=S.C;T=Q+T;var ae=D,ie=B;for(B=S.Ta,D=S.Ua;0<K--;){var fe=S.gc[K],Ce=Q,$e=T,me=ae,Te=ie,Le=(ie=B,ae=D,fe.Ea);switch(t(Ce<$e),t($e<=fe.nc),fe.hc){case 2:Sp(me,Te,($e-Ce)*Le,ie,ae);break;case 0:var He=Ce,Me=$e,Xe=ie,Je=ae,ct=(Jt=fe).Ea;He==0&&(yu(me,Te,null,null,1,Xe,Je),Ct(me,Te+1,0,0,ct-1,Xe,Je+1),Te+=ct,Je+=ct,++He);for(var lt=1<<Jt.b,nr=lt-1,zt=Ve(ct,Jt.b),zr=Jt.K,Jt=Jt.w+(He>>Jt.b)*zt;He<Me;){var tn=zr,ra=Jt,qr=1;for(bu(me,Te,Xe,Je-ct,1,Xe,Je);qr<ct;){var Qt=(qr&~nr)+lt;Qt>ct&&(Qt=ct),(0,_l[tn[ra++]>>8&15])(me,Te+ +qr,Xe,Je+qr-ct,Qt-qr,Xe,Je+qr),qr=Qt}Te+=ct,Je+=ct,++He&nr||(Jt+=zt)}$e!=fe.nc&&s(ie,ae-Le,ie,ae+($e-Ce-1)*Le,Le);break;case 1:for(Le=me,Me=Te,ct=(me=fe.Ea)-(Je=me&~(Xe=(Te=1<<fe.b)-1)),He=Ve(me,fe.b),lt=fe.K,fe=fe.w+(Ce>>fe.b)*He;Ce<$e;){for(nr=lt,zt=fe,zr=new Ee,Jt=Me+Je,tn=Me+me;Me<Jt;)Ie(nr[zt++],zr),jf(zr,Le,Me,Te,ie,ae),Me+=Te,ae+=Te;Me<tn&&(Ie(nr[zt++],zr),jf(zr,Le,Me,ct,ie,ae),Me+=ct,ae+=ct),++Ce&Xe||(fe+=He)}break;case 3:if(me==ie&&Te==ae&&0<fe.b){for(Me=ie,me=Le=ae+($e-Ce)*Le-(Je=($e-Ce)*Ve(fe.Ea,fe.b)),Te=ie,Xe=ae,He=[],Je=(ct=Je)-1;0<=Je;--Je)He[Je]=Te[Xe+Je];for(Je=ct-1;0<=Je;--Je)Me[me+Je]=He[Je];bf(fe,Ce,$e,ie,Le,ie,ae)}else bf(fe,Ce,$e,me,Te,ie,ae)}ae=B,ie=D}ie!=D&&s(B,D,ae,ie,J)}function mu(S,T){var D=S.V,B=S.Ba+S.c*S.C,K=T-S.C;if(t(T<=S.l.o),t(16>=K),0<K){var J=S.l,Q=S.Ta,ae=S.Ua,ie=J.width;if(of(S,K,D,B),K=ae=[ae],t((D=S.C)<(B=T)),t(J.v<J.va),B>J.o&&(B=J.o),D<J.j){var fe=J.j-D;D=J.j,K[0]+=fe*ie}if(D>=B?D=0:(K[0]+=4*J.v,J.ka=D-J.j,J.U=J.va-J.v,J.T=B-D,D=1),D){if(ae=ae[0],11>(D=S.ca).S){var Ce=D.f.RGBA,$e=(B=D.S,K=J.U,J=J.T,fe=Ce.eb,Ce.A),me=J;for(Ce=Ce.fb+S.Ma*Ce.A;0<me--;){var Te=Q,Le=ae,He=K,Me=fe,Xe=Ce;switch(B){case pw:Wv(Te,Le,He,Me,Xe);break;case gw:Hv(Te,Le,He,Me,Xe);break;case e4:Hv(Te,Le,He,Me,Xe),Yv(Me,Xe,0,He,1,0);break;case QL:Nf(Te,Le,He,Me,Xe);break;case xw:Tt(Te,Le,He,Me,Xe,1);break;case t4:Tt(Te,Le,He,Me,Xe,1),Yv(Me,Xe,0,He,1,0);break;case vw:Tt(Te,Le,He,Me,Xe,0);break;case yw:Tt(Te,Le,He,Me,Xe,0),Yv(Me,Xe,1,He,1,0);break;case Q5:kp(Te,Le,He,Me,Xe);break;case r4:kp(Te,Le,He,Me,Xe),WL(Me,Xe,He,1,0);break;case eI:wf(Te,Le,He,Me,Xe);break;default:t(0)}ae+=ie,Ce+=$e}S.Ma+=J}else alert("todo:EmitRescaledRowsYUVA");t(S.Ma<=D.height)}}S.C=T,t(S.C<=S.i)}function jl(S){var T;if(0<S.ua)return 0;for(T=0;T<S.Wb;++T){var D=S.Ya[T].G,B=S.Ya[T].H;if(0<D[1][B[1]+0].g||0<D[2][B[2]+0].g||0<D[3][B[3]+0].g)return 0}return 1}function pc(S,T,D,B,K,J){if(S.Z!=0){var Q=S.qd,ae=S.rd;for(t(_u[S.Z]!=null);T<D;++T)_u[S.Z](Q,ae,B,K,B,K,J),Q=B,ae=K,K+=J;S.qd=Q,S.rd=ae}}function wl(S,T){var D=S.l.ma,B=D.Z==0||D.Z==1?S.l.j:S.C;if(B=S.C<B?B:S.C,t(T<=S.l.o),T>B){var K=S.l.width,J=D.ca,Q=D.tb+K*B,ae=S.V,ie=S.Ba+S.c*B,fe=S.gc;t(S.ab==1),t(fe[0].hc==3),Z5(fe[0],B,T,ae,ie,J,Q),pc(D,B,T,J,Q,K)}S.C=S.Ma=T}function Nl(S,T,D,B,K,J,Q){var ae=S.$/B,ie=S.$%B,fe=S.m,Ce=S.s,$e=D+S.$,me=$e;K=D+B*K;var Te=D+B*J,Le=280+Ce.ua,He=S.Pb?ae:16777216,Me=0<Ce.ua?Ce.Wa:null,Xe=Ce.wc,Je=$e<Te?Ea(Ce,ie,ae):null;t(S.C<J),t(Te<=K);var ct=!1;e:for(;;){for(;ct||$e<Te;){var lt=0;if(ae>=He){var nr=$e-D;t((He=S).Pb),He.wd=He.m,He.xd=nr,0<He.s.ua&&et(He.s.Wa,He.s.vb),He=ae+gre}if(ie&Xe||(Je=Ea(Ce,ie,ae)),t(Je!=null),Je.Qb&&(T[$e]=Je.qb,ct=!0),!ct)if(pe(fe),Je.jc){lt=fe,nr=T;var zt=$e,zr=Je.pd[Z(lt)&Np-1];t(Je.jc),256>zr.g?(ve(lt,lt.u+zr.g),nr[zt]=zr.value,lt=0):(ve(lt,lt.u+zr.g-256),t(256<=zr.value),lt=zr.value),lt==0&&(ct=!0)}else lt=Cs(Je.G[0],Je.H[0],fe);if(fe.h)break;if(ct||256>lt){if(!ct)if(Je.nd)T[$e]=(Je.qb|lt<<8)>>>0;else{if(pe(fe),ct=Cs(Je.G[1],Je.H[1],fe),pe(fe),nr=Cs(Je.G[2],Je.H[2],fe),zt=Cs(Je.G[3],Je.H[3],fe),fe.h)break;T[$e]=(zt<<24|ct<<16|lt<<8|nr)>>>0}if(ct=!1,++$e,++ie>=B&&(ie=0,++ae,Q!=null&&ae<=J&&!(ae%16)&&Q(S,ae),Me!=null))for(;me<$e;)lt=T[me++],Me.X[(506832829*lt&4294967295)>>>Me.Mb]=lt}else if(280>lt){if(lt=us(lt-256,fe),nr=Cs(Je.G[4],Je.H[4],fe),pe(fe),nr=Rs(B,nr=us(nr,fe)),fe.h)break;if($e-D<nr||K-$e<lt)break e;for(zt=0;zt<lt;++zt)T[$e+zt]=T[$e+zt-nr];for($e+=lt,ie+=lt;ie>=B;)ie-=B,++ae,Q!=null&&ae<=J&&!(ae%16)&&Q(S,ae);if(t($e<=K),ie&Xe&&(Je=Ea(Ce,ie,ae)),Me!=null)for(;me<$e;)lt=T[me++],Me.X[(506832829*lt&4294967295)>>>Me.Mb]=lt}else{if(!(lt<Le))break e;for(ct=lt-280,t(Me!=null);me<$e;)lt=T[me++],Me.X[(506832829*lt&4294967295)>>>Me.Mb]=lt;lt=$e,t(!(ct>>>(nr=Me).Xa)),T[lt]=nr.X[ct],ct=!0}ct||t(fe.h==de(fe))}if(S.Pb&&fe.h&&$e<K)t(S.m.h),S.a=5,S.m=S.wd,S.$=S.xd,0<S.s.ua&&et(S.s.vb,S.s.Wa);else{if(fe.h)break e;Q!=null&&Q(S,ae>J?J:ae),S.a=0,S.$=$e-D}return 1}return S.a=3,0}function Wo(S){t(S!=null),S.vc=null,S.yc=null,S.Ya=null;var T=S.Wa;T!=null&&(T.X=null),S.vb=null,t(S!=null)}function lf(){var S=new Yt;return S==null?null:(S.a=0,S.xb=nI,Br("Predictor","VP8LPredictors"),Br("Predictor","VP8LPredictors_C"),Br("PredictorAdd","VP8LPredictorsAdd"),Br("PredictorAdd","VP8LPredictorsAdd_C"),Sp=ke,jf=at,Wv=Gt,Hv=gt,kp=Zt,wf=dr,Nf=Fr,k.VP8LMapColor32b=Ks,k.VP8LMapColor8b=wc,S)}function gc(S,T,D,B,K){var J=1,Q=[S],ae=[T],ie=B.m,fe=B.s,Ce=null,$e=0;e:for(;;){if(D)for(;J&&se(ie,1);){var me=Q,Te=ae,Le=B,He=1,Me=Le.m,Xe=Le.gc[Le.ab],Je=se(Me,2);if(Le.Oc&1<<Je)J=0;else{switch(Le.Oc|=1<<Je,Xe.hc=Je,Xe.Ea=me[0],Xe.nc=Te[0],Xe.K=[null],++Le.ab,t(4>=Le.ab),Je){case 0:case 1:Xe.b=se(Me,3)+2,He=gc(Ve(Xe.Ea,Xe.b),Ve(Xe.nc,Xe.b),0,Le,Xe.K),Xe.K=Xe.K[0];break;case 3:var ct,lt=se(Me,8)+1,nr=16<lt?0:4<lt?1:2<lt?2:3;if(me[0]=Ve(Xe.Ea,nr),Xe.b=nr,ct=He=gc(lt,1,0,Le,Xe.K)){var zt,zr=lt,Jt=Xe,tn=1<<(8>>Jt.b),ra=i(tn);if(ra==null)ct=0;else{var qr=Jt.K[0],Qt=Jt.w;for(ra[0]=Jt.K[0][0],zt=1;zt<1*zr;++zt)ra[zt]=he(qr[Qt+zt],ra[zt-1]);for(;zt<4*tn;++zt)ra[zt]=0;Jt.K[0]=null,Jt.K[0]=ra,ct=1}}He=ct;break;case 2:break;default:t(0)}J=He}}if(Q=Q[0],ae=ae[0],J&&se(ie,1)&&!(J=1<=($e=se(ie,4))&&11>=$e)){B.a=3;break e}var _t;if(_t=J)t:{var Ds,Ir,cn,ns=B,Oa=Q,pi=ae,As=$e,Ya=D,gi=ns.m,na=ns.s,dn=[null],kn=1,Ps=0,Cn=pre[As];r:for(;;){if(Ya&&se(gi,1)){var La=se(gi,3)+2,kl=Ve(Oa,La),$s=Ve(pi,La),Fi=kl*$s;if(!gc(kl,$s,0,ns,dn))break r;for(dn=dn[0],na.xc=La,Ds=0;Ds<Fi;++Ds){var Fn=dn[Ds]>>8&65535;dn[Ds]=Fn,Fn>=kn&&(kn=Fn+1)}}if(gi.h)break r;for(Ir=0;5>Ir;++Ir){var sa=tI[Ir];!Ir&&0<As&&(sa+=1<<As),Ps<sa&&(Ps=sa)}var fo=o(kn*Cn,A),xi=kn,mo=o(xi,L);if(mo==null)var po=null;else t(65536>=xi),po=mo;var Bi=i(Ps);if(po==null||Bi==null||fo==null){ns.a=1;break r}var go=fo;for(Ds=cn=0;Ds<kn;++Ds){var Hn=po[Ds],xo=Hn.G,Cl=Hn.H,_f=0,vd=1,Ia=0;for(Ir=0;5>Ir;++Ir){sa=tI[Ir],xo[Ir]=go,Cl[Ir]=cn,!Ir&&0<As&&(sa+=1<<As);s:{var Nw,i4=sa,_w=ns,Zv=Bi,Mre=go,Dre=cn,o4=0,Su=_w.m,$re=se(Su,1);if(a(Zv,0,0,i4),$re){var Fre=se(Su,1)+1,Bre=se(Su,1),hI=se(Su,Bre==0?1:8);Zv[hI]=1,Fre==2&&(Zv[hI=se(Su,8)]=1);var Sw=1}else{var fI=i(19),mI=se(Su,4)+4;if(19<mI){_w.a=3;var kw=0;break s}for(Nw=0;Nw<mI;++Nw)fI[fre[Nw]]=se(Su,3);var l4=void 0,Jv=void 0,pI=_w,Ure=fI,Cw=i4,gI=Zv,c4=0,ku=pI.m,xI=8,vI=o(128,A);n:for(;O(vI,0,7,Ure,19);){if(se(ku,1)){var zre=2+2*se(ku,3);if((l4=2+se(ku,zre))>Cw)break n}else l4=Cw;for(Jv=0;Jv<Cw&&l4--;){pe(ku);var yI=vI[0+(127&Z(ku))];ve(ku,ku.u+yI.g);var Pp=yI.value;if(16>Pp)gI[Jv++]=Pp,Pp!=0&&(xI=Pp);else{var qre=Pp==16,bI=Pp-16,Vre=ure[bI],jI=se(ku,dre[bI])+Vre;if(Jv+jI>Cw)break n;for(var Wre=qre?xI:0;0<jI--;)gI[Jv++]=Wre}}c4=1;break n}c4||(pI.a=3),Sw=c4}(Sw=Sw&&!Su.h)&&(o4=O(Mre,Dre,8,Zv,i4)),Sw&&o4!=0?kw=o4:(_w.a=3,kw=0)}if(kw==0)break r;if(vd&&hre[Ir]==1&&(vd=go[cn].g==0),_f+=go[cn].g,cn+=kw,3>=Ir){var Qv,d4=Bi[0];for(Qv=1;Qv<sa;++Qv)Bi[Qv]>d4&&(d4=Bi[Qv]);Ia+=d4}}if(Hn.nd=vd,Hn.Qb=0,vd&&(Hn.qb=(xo[3][Cl[3]+0].value<<24|xo[1][Cl[1]+0].value<<16|xo[2][Cl[2]+0].value)>>>0,_f==0&&256>xo[0][Cl[0]+0].value&&(Hn.Qb=1,Hn.qb+=xo[0][Cl[0]+0].value<<8)),Hn.jc=!Hn.Qb&&6>Ia,Hn.jc){var Aw,yd=Hn;for(Aw=0;Aw<Np;++Aw){var Cu=Aw,Au=yd.pd[Cu],Pw=yd.G[0][yd.H[0]+Cu];256<=Pw.value?(Au.g=Pw.g+256,Au.value=Pw.value):(Au.g=0,Au.value=0,Cu>>=ja(Pw,8,Au),Cu>>=ja(yd.G[1][yd.H[1]+Cu],16,Au),Cu>>=ja(yd.G[2][yd.H[2]+Cu],0,Au),ja(yd.G[3][yd.H[3]+Cu],24,Au))}}}na.vc=dn,na.Wb=kn,na.Ya=po,na.yc=fo,_t=1;break t}_t=0}if(!(J=_t)){B.a=3;break e}if(0<$e){if(fe.ua=1<<$e,!re(fe.Wa,$e)){B.a=1,J=0;break e}}else fe.ua=0;var u4=B,wI=Q,Hre=ae,h4=u4.s,f4=h4.xc;if(u4.c=wI,u4.i=Hre,h4.md=Ve(wI,f4),h4.wc=f4==0?-1:(1<<f4)-1,D){B.xb=Nre;break e}if((Ce=i(Q*ae))==null){B.a=1,J=0;break e}J=(J=Nl(B,Ce,0,Q,ae,ae,null))&&!ie.h;break e}return J?(K!=null?K[0]=Ce:(t(Ce==null),t(D)),B.$=0,D||Wo(fe)):Wo(fe),J}function cf(S,T){var D=S.c*S.i,B=D+T+16*T;return t(S.c<=T),S.V=i(B),S.V==null?(S.Ta=null,S.Ua=0,S.a=1,0):(S.Ta=S.V,S.Ua=S.Ba+D+T,1)}function lp(S,T){var D=S.C,B=T-D,K=S.V,J=S.Ba+S.c*D;for(t(T<=S.l.o);0<B;){var Q=16<B?16:B,ae=S.l.ma,ie=S.l.width,fe=ie*Q,Ce=ae.ca,$e=ae.tb+ie*D,me=S.Ta,Te=S.Ua;of(S,Q,K,J),GL(me,Te,Ce,$e,fe),pc(ae,D,D+Q,Ce,$e,ie),B-=Q,K+=Q*S.c,D+=Q}t(D==T),S.C=S.Ma=T}function cp(){this.ub=this.yd=this.td=this.Rb=0}function dp(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function L5(){this.Fb=this.Bb=this.Cb=0,this.Zb=i(4),this.Lb=i(4)}function Tv(){this.Yb=function(){var S=[];return function T(D,B,K){for(var J=K[B],Q=0;Q<J&&(D.push(K.length>B+1?[]:0),!(K.length<B+1));Q++)T(D[Q],B+1,K)}(S,0,[3,11]),S}()}function Xj(){this.jb=i(3),this.Wc=l([4,8],Tv),this.Xc=l([4,17],Tv)}function Zj(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new i(4),this.od=new i(4)}function Ho(){this.ld=this.La=this.dd=this.tc=0}function Ov(){this.Na=this.la=0}function Jj(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function Lv(){this.ad=i(384),this.Za=0,this.Ob=i(16),this.$b=this.Ad=this.ia=this.Gc=this.Hc=this.Dd=0}function Qj(){this.uc=this.M=this.Nb=0,this.wa=Array(new Ho),this.Y=0,this.ya=Array(new Lv),this.aa=0,this.l=new up}function ew(){this.y=i(16),this.f=i(8),this.ea=i(8)}function tw(){this.cb=this.a=0,this.sc="",this.m=new F,this.Od=new cp,this.Kc=new dp,this.ed=new Zj,this.Qa=new L5,this.Ic=this.$c=this.Aa=0,this.D=new Qj,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,F),this.ia=0,this.pb=o(4,Jj),this.Pa=new Xj,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new ew),this.Hd=0,this.rb=Array(new Ov),this.sb=0,this.wa=Array(new Ho),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 Lv),this.L=this.aa=0,this.gd=l([4,2],Ho),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 xc(S,T){return 0>S?0:S>T?T:S}function up(){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 I5(){var S=new tw;return S!=null&&(S.a=0,S.sc="OK",S.cb=0,S.Xb=0,Kv||(Kv=hp)),S}function Gs(S,T,D){return S.a==0&&(S.a=T,S.sc=D,S.cb=0),0}function rw(S,T,D){return 3<=D&&S[T+0]==157&&S[T+1]==1&&S[T+2]==42}function vc(S,T){if(S==null)return 0;if(S.a=0,S.sc="OK",T==null)return Gs(S,2,"null VP8Io passed to VP8GetHeaders()");var D=T.data,B=T.w,K=T.ha;if(4>K)return Gs(S,7,"Truncated header.");var J=D[B+0]|D[B+1]<<8|D[B+2]<<16,Q=S.Od;if(Q.Rb=!(1&J),Q.td=J>>1&7,Q.yd=J>>4&1,Q.ub=J>>5,3<Q.td)return Gs(S,3,"Incorrect keyframe parameters.");if(!Q.yd)return Gs(S,4,"Frame not displayable.");B+=3,K-=3;var ae=S.Kc;if(Q.Rb){if(7>K)return Gs(S,7,"cannot parse picture header");if(!rw(D,B,K))return Gs(S,3,"Bad code word");ae.c=16383&(D[B+4]<<8|D[B+3]),ae.Td=D[B+4]>>6,ae.i=16383&(D[B+6]<<8|D[B+5]),ae.Ud=D[B+6]>>6,B+=7,K-=7,S.za=ae.c+15>>4,S.Ub=ae.i+15>>4,T.width=ae.c,T.height=ae.i,T.Da=0,T.j=0,T.v=0,T.va=T.width,T.o=T.height,T.da=0,T.ib=T.width,T.hb=T.height,T.U=T.width,T.T=T.height,a((J=S.Pa).jb,0,255,J.jb.length),t((J=S.Qa)!=null),J.Cb=0,J.Bb=0,J.Fb=1,a(J.Zb,0,0,J.Zb.length),a(J.Lb,0,0,J.Lb)}if(Q.ub>K)return Gs(S,7,"bad partition length");z(J=S.m,D,B,Q.ub),B+=Q.ub,K-=Q.ub,Q.Rb&&(ae.Ld=xe(J),ae.Kd=xe(J)),ae=S.Qa;var ie,fe=S.Pa;if(t(J!=null),t(ae!=null),ae.Cb=xe(J),ae.Cb){if(ae.Bb=xe(J),xe(J)){for(ae.Fb=xe(J),ie=0;4>ie;++ie)ae.Zb[ie]=xe(J)?$(J,7):0;for(ie=0;4>ie;++ie)ae.Lb[ie]=xe(J)?$(J,6):0}if(ae.Bb)for(ie=0;3>ie;++ie)fe.jb[ie]=xe(J)?U(J,8):255}else ae.Bb=0;if(J.Ka)return Gs(S,3,"cannot parse segment header");if((ae=S.ed).zd=xe(J),ae.Tb=U(J,6),ae.wb=U(J,3),ae.Pc=xe(J),ae.Pc&&xe(J)){for(fe=0;4>fe;++fe)xe(J)&&(ae.vd[fe]=$(J,6));for(fe=0;4>fe;++fe)xe(J)&&(ae.od[fe]=$(J,6))}if(S.L=ae.Tb==0?0:ae.zd?1:2,J.Ka)return Gs(S,3,"cannot parse filter header");var Ce=K;if(K=ie=B,B=ie+Ce,ae=Ce,S.Xb=(1<<U(S.m,2))-1,Ce<3*(fe=S.Xb))D=7;else{for(ie+=3*fe,ae-=3*fe,Ce=0;Ce<fe;++Ce){var $e=D[K+0]|D[K+1]<<8|D[K+2]<<16;$e>ae&&($e=ae),z(S.Jc[+Ce],D,ie,$e),ie+=$e,ae-=$e,K+=3}z(S.Jc[+fe],D,ie,ae),D=ie<B?0:5}if(D!=0)return Gs(S,D,"cannot parse partitions");for(D=U(ie=S.m,7),K=xe(ie)?$(ie,4):0,B=xe(ie)?$(ie,4):0,ae=xe(ie)?$(ie,4):0,fe=xe(ie)?$(ie,4):0,ie=xe(ie)?$(ie,4):0,Ce=S.Qa,$e=0;4>$e;++$e){if(Ce.Cb){var me=Ce.Zb[$e];Ce.Fb||(me+=D)}else{if(0<$e){S.pb[$e]=S.pb[0];continue}me=D}var Te=S.pb[$e];Te.Sc[0]=n4[xc(me+K,127)],Te.Sc[1]=s4[xc(me+0,127)],Te.Eb[0]=2*n4[xc(me+B,127)],Te.Eb[1]=101581*s4[xc(me+ae,127)]>>16,8>Te.Eb[1]&&(Te.Eb[1]=8),Te.Qc[0]=n4[xc(me+fe,117)],Te.Qc[1]=s4[xc(me+ie,127)],Te.lc=me+ie}if(!Q.Rb)return Gs(S,4,"Not a key frame.");for(xe(J),Q=S.Pa,D=0;4>D;++D){for(K=0;8>K;++K)for(B=0;3>B;++B)for(ae=0;11>ae;++ae)fe=oe(J,jre[D][K][B][ae])?U(J,8):yre[D][K][B][ae],Q.Wc[D][K].Yb[B][ae]=fe;for(K=0;17>K;++K)Q.Xc[D][K]=Q.Wc[D][wre[K]]}return S.kc=xe(J),S.kc&&(S.Bd=U(J,8)),S.cb=1}function hp(S,T,D,B,K,J,Q){var ae=T[K].Yb[D];for(D=0;16>K;++K){if(!oe(S,ae[D+0]))return K;for(;!oe(S,ae[D+1]);)if(ae=T[++K].Yb[0],D=0,K==16)return 16;var ie=T[K+1].Yb;if(oe(S,ae[D+2])){var fe=S,Ce=0;if(oe(fe,(me=ae)[($e=D)+3]))if(oe(fe,me[$e+6])){for(ae=0,$e=2*(Ce=oe(fe,me[$e+8]))+(me=oe(fe,me[$e+9+Ce])),Ce=0,me=xre[$e];me[ae];++ae)Ce+=Ce+oe(fe,me[ae]);Ce+=3+(8<<$e)}else oe(fe,me[$e+7])?(Ce=7+2*oe(fe,165),Ce+=oe(fe,145)):Ce=5+oe(fe,159);else Ce=oe(fe,me[$e+4])?3+oe(fe,me[$e+5]):2;ae=ie[2]}else Ce=1,ae=ie[1];ie=Q+vre[K],0>(fe=S).b&&_e(fe);var $e,me=fe.b,Te=($e=fe.Ca>>1)-(fe.I>>me)>>31;--fe.b,fe.Ca+=Te,fe.Ca|=1,fe.I-=($e+1&Te)<<me,J[ie]=((Ce^Te)-Te)*B[(0<K)+0]}return 16}function Iv(S){var T=S.rb[S.sb-1];T.la=0,T.Na=0,a(S.zc,0,0,S.zc.length),S.ja=0}function uo(S,T,D,B,K){K=S[T+D+32*B]+(K>>3),S[T+D+32*B]=-256&K?0>K?0:255:K}function fp(S,T,D,B,K,J){uo(S,T,0,D,B+K),uo(S,T,1,D,B+J),uo(S,T,2,D,B-J),uo(S,T,3,D,B-K)}function cd(S){return(20091*S>>16)+S}function Ta(S,T,D,B){var K,J=0,Q=i(16);for(K=0;4>K;++K){var ae=S[T+0]+S[T+8],ie=S[T+0]-S[T+8],fe=(35468*S[T+4]>>16)-cd(S[T+12]),Ce=cd(S[T+4])+(35468*S[T+12]>>16);Q[J+0]=ae+Ce,Q[J+1]=ie+fe,Q[J+2]=ie-fe,Q[J+3]=ae-Ce,J+=4,T++}for(K=J=0;4>K;++K)ae=(S=Q[J+0]+4)+Q[J+8],ie=S-Q[J+8],fe=(35468*Q[J+4]>>16)-cd(Q[J+12]),uo(D,B,0,0,ae+(Ce=cd(Q[J+4])+(35468*Q[J+12]>>16))),uo(D,B,1,0,ie+fe),uo(D,B,2,0,ie-fe),uo(D,B,3,0,ae-Ce),J++,B+=32}function nw(S,T,D,B){var K=S[T+0]+4,J=35468*S[T+4]>>16,Q=cd(S[T+4]),ae=35468*S[T+1]>>16;fp(D,B,0,K+Q,S=cd(S[T+1]),ae),fp(D,B,1,K+J,S,ae),fp(D,B,2,K-J,S,ae),fp(D,B,3,K-Q,S,ae)}function R5(S,T,D,B,K){Ta(S,T,D,B),K&&Ta(S,T+16,D,B+4)}function M5(S,T,D,B){pd(S,T+0,D,B,1),pd(S,T+32,D,B+128,1)}function D5(S,T,D,B){var K;for(S=S[T+0]+4,K=0;4>K;++K)for(T=0;4>T;++T)uo(D,B,T,K,S)}function yc(S,T,D,B){S[T+0]&&Ga(S,T+0,D,B),S[T+16]&&Ga(S,T+16,D,B+4),S[T+32]&&Ga(S,T+32,D,B+128),S[T+48]&&Ga(S,T+48,D,B+128+4)}function sw(S,T,D,B){var K,J=i(16);for(K=0;4>K;++K){var Q=S[T+0+K]+S[T+12+K],ae=S[T+4+K]+S[T+8+K],ie=S[T+4+K]-S[T+8+K],fe=S[T+0+K]-S[T+12+K];
vendor: 4,054 bytes, line 1126
1126J[0+K]=Q+ae,J[8+K]=Q-ae,J[4+K]=fe+ie,J[12+K]=fe-ie}for(K=0;4>K;++K)Q=(S=J[0+4*K]+3)+J[3+4*K],ae=J[1+4*K]+J[2+4*K],ie=J[1+4*K]-J[2+4*K],fe=S-J[3+4*K],D[B+0]=Q+ae>>3,D[B+16]=fe+ie>>3,D[B+32]=Q-ae>>3,D[B+48]=fe-ie>>3,B+=64}function mp(S,T,D){var B,K=T-32,J=ho,Q=255-S[K-1];for(B=0;B<D;++B){var ae,ie=J,fe=Q+S[T-1];for(ae=0;ae<D;++ae)S[T+ae]=ie[fe+S[K+ae]];T+=32}}function pp(S,T){mp(S,T,4)}function Rv(S,T){mp(S,T,8)}function $5(S,T){mp(S,T,16)}function F5(S,T){var D;for(D=0;16>D;++D)s(S,T+32*D,S,T-32,16)}function B5(S,T){var D;for(D=16;0<D;--D)a(S,T,S[T-1],16),T+=32}function pu(S,T,D){var B;for(B=0;16>B;++B)a(T,D+32*B,S,16)}function aw(S,T){var D,B=16;for(D=0;16>D;++D)B+=S[T-1+32*D]+S[T+D-32];pu(B>>5,S,T)}function gu(S,T){var D,B=8;for(D=0;16>D;++D)B+=S[T-1+32*D];pu(B>>4,S,T)}function U5(S,T){var D,B=8;for(D=0;16>D;++D)B+=S[T+D-32];pu(B>>4,S,T)}function df(S,T){pu(128,S,T)}function br(S,T,D){return S+2*T+D+2>>2}function z5(S,T){var D,B=T-32;for(B=new Uint8Array([br(S[B-1],S[B+0],S[B+1]),br(S[B+0],S[B+1],S[B+2]),br(S[B+1],S[B+2],S[B+3]),br(S[B+2],S[B+3],S[B+4])]),D=0;4>D;++D)s(S,T+32*D,B,0,B.length)}function q5(S,T){var D=S[T-1],B=S[T-1+32],K=S[T-1+64],J=S[T-1+96];we(S,T+0,16843009*br(S[T-1-32],D,B)),we(S,T+32,16843009*br(D,B,K)),we(S,T+64,16843009*br(B,K,J)),we(S,T+96,16843009*br(K,J,J))}function V5(S,T){var D,B=4;for(D=0;4>D;++D)B+=S[T+D-32]+S[T-1+32*D];for(B>>=3,D=0;4>D;++D)a(S,T+32*D,B,4)}function W5(S,T){var D=S[T-1+0],B=S[T-1+32],K=S[T-1+64],J=S[T-1-32],Q=S[T+0-32],ae=S[T+1-32],ie=S[T+2-32],fe=S[T+3-32];S[T+0+96]=br(B,K,S[T-1+96]),S[T+1+96]=S[T+0+64]=br(D,B,K),S[T+2+96]=S[T+1+64]=S[T+0+32]=br(J,D,B),S[T+3+96]=S[T+2+64]=S[T+1+32]=S[T+0+0]=br(Q,J,D),S[T+3+64]=S[T+2+32]=S[T+1+0]=br(ae,Q,J),S[T+3+32]=S[T+2+0]=br(ie,ae,Q),S[T+3+0]=br(fe,ie,ae)}function H5(S,T){var D=S[T+1-32],B=S[T+2-32],K=S[T+3-32],J=S[T+4-32],Q=S[T+5-32],ae=S[T+6-32],ie=S[T+7-32];S[T+0+0]=br(S[T+0-32],D,B),S[T+1+0]=S[T+0+32]=br(D,B,K),S[T+2+0]=S[T+1+32]=S[T+0+64]=br(B,K,J),S[T+3+0]=S[T+2+32]=S[T+1+64]=S[T+0+96]=br(K,J,Q),S[T+3+32]=S[T+2+64]=S[T+1+96]=br(J,Q,ae),S[T+3+64]=S[T+2+96]=br(Q,ae,ie),S[T+3+96]=br(ae,ie,ie)}function dd(S,T){var D=S[T-1+0],B=S[T-1+32],K=S[T-1+64],J=S[T-1-32],Q=S[T+0-32],ae=S[T+1-32],ie=S[T+2-32],fe=S[T+3-32];S[T+0+0]=S[T+1+64]=J+Q+1>>1,S[T+1+0]=S[T+2+64]=Q+ae+1>>1,S[T+2+0]=S[T+3+64]=ae+ie+1>>1,S[T+3+0]=ie+fe+1>>1,S[T+0+96]=br(K,B,D),S[T+0+64]=br(B,D,J),S[T+0+32]=S[T+1+96]=br(D,J,Q),S[T+1+32]=S[T+2+96]=br(J,Q,ae),S[T+2+32]=S[T+3+96]=br(Q,ae,ie),S[T+3+32]=br(ae,ie,fe)}function ud(S,T){var D=S[T+0-32],B=S[T+1-32],K=S[T+2-32],J=S[T+3-32],Q=S[T+4-32],ae=S[T+5-32],ie=S[T+6-32],fe=S[T+7-32];S[T+0+0]=D+B+1>>1,S[T+1+0]=S[T+0+64]=B+K+1>>1,S[T+2+0]=S[T+1+64]=K+J+1>>1,S[T+3+0]=S[T+2+64]=J+Q+1>>1,S[T+0+32]=br(D,B,K),S[T+1+32]=S[T+0+96]=br(B,K,J),S[T+2+32]=S[T+1+96]=br(K,J,Q),S[T+3+32]=S[T+2+96]=br(J,Q,ae),S[T+3+64]=br(Q,ae,ie),S[T+3+96]=br(ae,ie,fe)}function G5(S,T){var D=S[T-1+0],B=S[T-1+32],K=S[T-1+64],J=S[T-1+96];S[T+0+0]=D+B+1>>1,S[T+2+0]=S[T+0+32]=B+K+1>>1,S[T+2+32]=S[T+0+64]=K+J+1>>1,S[T+1+0]=br(D,B,K),S[T+3+0]=S[T+1+32]=br(B,K,J),S[T+3+32]=S[T+1+64]=br(K,J,J),S[T+3+64]=S[T+2+64]=S[T+0+96]=S[T+1+96]=S[T+2+96]=S[T+3+96]=J}function Y5(S,T){var D=S[T-1+0],B=S[T-1+32],K=S[T-1+64],J=S[T-1+96],Q=S[T-1-32],ae=S[T+0-32],ie=S[T+1-32],fe=S[T+2-32];S[T+0+0]=S[T+2+32]=D+Q+1>>1,S[T+0+32]=S[T+2+64]=B+D+1>>1,S[T+0+64]=S[T+2+96]=K+B+1>>1,S[T+0+96]=J+K+1>>1,S[T+3+0]=br(ae,ie,fe),S[T+2+0]=br(Q,ae,ie),S[T+1+0]=S[T+3+32]=br(D,Q,ae),S[T+1+32]=S[T+3+64]=br(B,D,Q),S[T+1+64]=S[T+3+96]=br(K,B,D),S[T+1+96]=br(J,K,B)}function gp(S,T){var D;for(D=0;8>D;++D)s(S,T+32*D,S,T-32,8)}function Mv(S,T){var D;for(D=0;8>D;++D)a(S,T,S[T-1],8),T+=32}function bc(S,T,D){var B;for(B=0;8>B;++B)a(T,D+32*B,S,8)}function K5(S,T){var D,B=8;for(D=0;8>D;++D)B+=S[T+D-32]+S[T-1+32*D];bc(B>>4,S,T)}function xp(S,T){var D,B=4;for(D=0;8>D;++D)B+=S[T+D-32];bc(B>>3,S,T)}function X5(S,T){var D,B=4;for(D=0;8>D;++D)B+=S[T-1+32*D];bc(B>>3,S,T)}function Dv(S,T){bc(128,S,T)}function xu(S,T,D){var B=S[T-D],K=S[T+0],J=3*(K-B)+J5[1020+S[T-2*D]-S[T+D]],Q=mw[112+(J+4>>
vendor: 19,809 bytes, line 1126
11263)];S[T-D]=ho[255+B+mw[112+(J+3>>3)]],S[T+0]=ho[255+K-Q]}function $v(S,T,D,B){var K=S[T+0],J=S[T+D];return Yo[255+S[T-2*D]-S[T-D]]>B||Yo[255+J-K]>B}function uf(S,T,D,B){return 4*Yo[255+S[T-D]-S[T+0]]+Yo[255+S[T-2*D]-S[T+D]]<=B}function Fv(S,T,D,B,K){var J=S[T-3*D],Q=S[T-2*D],ae=S[T-D],ie=S[T+0],fe=S[T+D],Ce=S[T+2*D],$e=S[T+3*D];return 4*Yo[255+ae-ie]+Yo[255+Q-fe]>B?0:Yo[255+S[T-4*D]-J]<=K&&Yo[255+J-Q]<=K&&Yo[255+Q-ae]<=K&&Yo[255+$e-Ce]<=K&&Yo[255+Ce-fe]<=K&&Yo[255+fe-ie]<=K}function vp(S,T,D,B){var K=2*B+1;for(B=0;16>B;++B)uf(S,T+B,D,K)&&xu(S,T+B,D)}function Bv(S,T,D,B){var K=2*B+1;for(B=0;16>B;++B)uf(S,T+B*D,1,K)&&xu(S,T+B*D,1)}function yp(S,T,D,B){var K;for(K=3;0<K;--K)vp(S,T+=4*D,D,B)}function iw(S,T,D,B){var K;for(K=3;0<K;--K)Bv(S,T+=4,D,B)}function hd(S,T,D,B,K,J,Q,ae){for(J=2*J+1;0<K--;){if(Fv(S,T,D,J,Q))if($v(S,T,D,ae))xu(S,T,D);else{var ie=S,fe=T,Ce=D,$e=ie[fe-2*Ce],me=ie[fe-Ce],Te=ie[fe+0],Le=ie[fe+Ce],He=ie[fe+2*Ce],Me=27*(Je=J5[1020+3*(Te-me)+J5[1020+$e-Le]])+63>>7,Xe=18*Je+63>>7,Je=9*Je+63>>7;ie[fe-3*Ce]=ho[255+ie[fe-3*Ce]+Je],ie[fe-2*Ce]=ho[255+$e+Xe],ie[fe-Ce]=ho[255+me+Me],ie[fe+0]=ho[255+Te-Me],ie[fe+Ce]=ho[255+Le-Xe],ie[fe+2*Ce]=ho[255+He-Je]}T+=B}}function fd(S,T,D,B,K,J,Q,ae){for(J=2*J+1;0<K--;){if(Fv(S,T,D,J,Q))if($v(S,T,D,ae))xu(S,T,D);else{var ie=S,fe=T,Ce=D,$e=ie[fe-Ce],me=ie[fe+0],Te=ie[fe+Ce],Le=mw[112+(4+(He=3*(me-$e))>>3)],He=mw[112+(He+3>>3)],Me=Le+1>>1;ie[fe-2*Ce]=ho[255+ie[fe-2*Ce]+Me],ie[fe-Ce]=ho[255+$e+He],ie[fe+0]=ho[255+me-Le],ie[fe+Ce]=ho[255+Te-Me]}T+=B}}function ow(S,T,D,B,K,J){hd(S,T,D,1,16,B,K,J)}function lw(S,T,D,B,K,J){hd(S,T,1,D,16,B,K,J)}function cw(S,T,D,B,K,J){var Q;for(Q=3;0<Q;--Q)fd(S,T+=4*D,D,1,16,B,K,J)}function hf(S,T,D,B,K,J){var Q;for(Q=3;0<Q;--Q)fd(S,T+=4,1,D,16,B,K,J)}function dw(S,T,D,B,K,J,Q,ae){hd(S,T,K,1,8,J,Q,ae),hd(D,B,K,1,8,J,Q,ae)}function M(S,T,D,B,K,J,Q,ae){hd(S,T,1,K,8,J,Q,ae),hd(D,B,1,K,8,J,Q,ae)}function G(S,T,D,B,K,J,Q,ae){fd(S,T+4*K,K,1,8,J,Q,ae),fd(D,B+4*K,K,1,8,J,Q,ae)}function ue(S,T,D,B,K,J,Q,ae){fd(S,T+4,1,K,8,J,Q,ae),fd(D,B+4,1,K,8,J,Q,ae)}function je(){this.ba=new xr,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new Zr,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function Oe(){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 We(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function ot(){this.ua=0,this.Wa=new kt,this.vb=new kt,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new L,this.yc=new A}function Yt(){this.xb=this.a=0,this.l=new up,this.ca=new xr,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new V,this.Pb=0,this.wd=new V,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new ot,this.ab=0,this.gc=o(4,We),this.Oc=0}function Ht(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new up,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function kr(S,T,D,B,K,J,Q){for(S=S==null?0:S[T+0],T=0;T<Q;++T)K[J+T]=S+D[B+T]&255,S=K[J+T]}function Lr(S,T,D,B,K,J,Q){var ae;if(S==null)kr(null,null,D,B,K,J,Q);else for(ae=0;ae<Q;++ae)K[J+ae]=S[T+ae]+D[B+ae]&255}function ln(S,T,D,B,K,J,Q){if(S==null)kr(null,null,D,B,K,J,Q);else{var ae,ie=S[T+0],fe=ie,Ce=ie;for(ae=0;ae<Q;++ae)fe=Ce+(ie=S[T+ae])-fe,Ce=D[B+ae]+(-256&fe?0>fe?0:255:fe)&255,fe=ie,K[J+ae]=Ce}}function Ys(S,T,D,B){var K=T.width,J=T.o;if(t(S!=null&&T!=null),0>D||0>=B||D+B>J)return null;if(!S.Cc){if(S.ga==null){var Q;if(S.ga=new Ht,(Q=S.ga==null)||(Q=T.width*T.o,t(S.Gb.length==0),S.Gb=i(Q),S.Uc=0,S.Gb==null?Q=0:(S.mb=S.Gb,S.nb=S.Uc,S.rc=null,Q=1),Q=!Q),!Q){Q=S.ga;var ae=S.Fa,ie=S.P,fe=S.qc,Ce=S.mb,$e=S.nb,me=ie+1,Te=fe-1,Le=Q.l;if(t(ae!=null&&Ce!=null&&T!=null),_u[0]=null,_u[1]=kr,_u[2]=Lr,_u[3]=ln,Q.ca=Ce,Q.tb=$e,Q.c=T.width,Q.i=T.height,t(0<Q.c&&0<Q.i),1>=fe)T=0;else if(Q.$a=3&ae[ie+0],Q.Z=ae[ie+0]>>2&3,Q.Lc=ae[ie+0]>>4&3,ie=ae[ie+0]>>6&3,0>Q.$a||1<Q.$a||4<=Q.Z||1<Q.Lc||ie)T=0;else if(Le.put=Ut,Le.ac=ts,Le.bc=Ur,Le.ma=Q,Le.width=T.width,Le.height=T.height,Le.Da=T.Da,Le.v=T.v,Le.va=T.va,Le.j=T.j,Le.o=T.o,Q.$a)e:{t(Q.$a==1),T=lf();t:for(;;){if(T==null){T=0;break e}if(t(Q!=null),Q.mc=T,T.c=Q.c,T.i=Q.i,T.l=Q.l,T.l.ma=Q,T.l.width=Q.c,T.l.height=Q.i,T.a=0,q(T.m,ae,me,Te),!gc(Q.c,Q.i,1,T,null)||(T.ab==1&&T.gc[0].hc==3&&jl(T.s)?(Q.ic=1,ae=T.c*T.i,T.Ta=null,T.Ua=0,T.V=i(ae),T.Ba=0,T.V==null?(T.a=1,T=0):T=1):(Q.ic=0,T=cf(T,Q.c)),!T))break t;T=1;break e}Q.mc=null,T=0}else T=Te>=Q.c*Q.i;Q=!T}if(Q)return null;S.ga.Lc!=1?S.Ga=0:B=J-D}t(S.ga!=null),t(D+B<=J);e:{if(T=(ae=S.ga).c,J=ae.l.o,ae.$a==0){if(me=S.rc,Te=S.Vc,Le=S.Fa,ie=S.P+1+D*T,fe=S.mb,Ce=S.nb+D*T,t(ie<=S.P+S.qc),ae.Z!=0)for(t(_u[ae.Z]!=null),Q=0;Q<B;++Q)_u[ae.Z](me,Te,Le,ie,fe,Ce,T),me=fe,Te=Ce,Ce+=T,ie+=T;else for(Q=0;Q<B;++Q)s(fe,Ce,Le,ie,T),me=fe,Te=Ce,Ce+=T,ie+=T;S.rc=me,S.Vc=Te}else{if(t(ae.mc!=null),T=D+B,t((Q=ae.mc)!=null),t(T<=Q.i),Q.C>=T)T=1;else if(ae.ic||bs(),ae.ic){ae=Q.V,me=Q.Ba,Te=Q.c;var He=Q.i,Me=(Le=1,ie=Q.$/Te,fe=Q.$%Te,Ce=Q.m,$e=Q.s,Q.$),Xe=Te*He,Je=Te*T,ct=$e.wc,lt=Me<Je?Ea($e,fe,ie):null;t(Me<=Xe),t(T<=He),t(jl($e));t:for(;;){for(;!Ce.h&&Me<Je;){if(fe&ct||(lt=Ea($e,fe,ie)),t(lt!=null),pe(Ce),256>(He=Cs(lt.G[0],lt.H[0],Ce)))ae[me+Me]=He,++Me,++fe>=Te&&(fe=0,++ie<=T&&!(ie%16)&&wl(Q,ie));else{if(!(280>He)){Le=0;break t}He=us(He-256,Ce);var nr,zt=Cs(lt.G[4],lt.H[4],Ce);if(pe(Ce),!(Me>=(zt=Rs(Te,zt=us(zt,Ce)))&&Xe-Me>=He)){Le=0;break t}for(nr=0;nr<He;++nr)ae[me+Me+nr]=ae[me+Me+nr-zt];for(Me+=He,fe+=He;fe>=Te;)fe-=Te,++ie<=T&&!(ie%16)&&wl(Q,ie);Me<Je&&fe&ct&&(lt=Ea($e,fe,ie))}t(Ce.h==de(Ce))}wl(Q,ie>T?T:ie);break t}!Le||Ce.h&&Me<Xe?(Le=0,Q.a=Ce.h?5:3):Q.$=Me,T=Le}else T=Nl(Q,Q.V,Q.Ba,Q.c,Q.i,T,lp);if(!T){B=0;break e}}D+B>=J&&(S.Cc=1),B=1}if(!B)return null;if(S.Cc&&((B=S.ga)!=null&&(B.mc=null),S.ga=null,0<S.Ga))return alert("todo:WebPDequantizeLevels"),null}return S.nb+D*K}function $n(S,T,D,B,K,J){for(;0<K--;){var Q,ae=S,ie=T+(D?1:0),fe=S,Ce=T+(D?0:3);for(Q=0;Q<B;++Q){var $e=fe[Ce+4*Q];$e!=255&&($e*=32897,ae[ie+4*Q+0]=ae[ie+4*Q+0]*$e>>23,ae[ie+4*Q+1]=ae[ie+4*Q+1]*$e>>23,ae[ie+4*Q+2]=ae[ie+4*Q+2]*$e>>23)}T+=J}}function Rn(S,T,D,B,K){for(;0<B--;){var J;for(J=0;J<D;++J){var Q=S[T+2*J+0],ae=15&(fe=S[T+2*J+1]),ie=4369*ae,fe=(240&fe|fe>>4)*ie>>16;S[T+2*J+0]=(240&Q|Q>>4)*ie>>16&240|(15&Q|Q<<4)*ie>>16>>4&15,S[T+2*J+1]=240&fe|ae}T+=K}}function rs(S,T,D,B,K,J,Q,ae){var ie,fe,Ce=255;for(fe=0;fe<K;++fe){for(ie=0;ie<B;++ie){var $e=S[T+ie];J[Q+4*ie]=$e,Ce&=$e}T+=D,Q+=ae}return Ce!=255}function ys(S,T,D,B,K){var J;for(J=0;J<K;++J)D[B+J]=S[T+J]>>8}function bs(){Yv=$n,WL=Rn,HL=rs,GL=ys}function Wa(S,T,D){k[S]=function(B,K,J,Q,ae,ie,fe,Ce,$e,me,Te,Le,He,Me,Xe,Je,ct){var lt,nr=ct-1>>1,zt=ae[ie+0]|fe[Ce+0]<<16,zr=$e[me+0]|Te[Le+0]<<16;t(B!=null);var Jt=3*zt+zr+131074>>2;for(T(B[K+0],255&Jt,Jt>>16,He,Me),J!=null&&(Jt=3*zr+zt+131074>>2,T(J[Q+0],255&Jt,Jt>>16,Xe,Je)),lt=1;lt<=nr;++lt){var tn=ae[ie+lt]|fe[Ce+lt]<<16,ra=$e[me+lt]|Te[Le+lt]<<16,qr=zt+tn+zr+ra+524296,Qt=qr+2*(tn+zr)>>3;Jt=Qt+zt>>1,zt=(qr=qr+2*(zt+ra)>>3)+tn>>1,T(B[K+2*lt-1],255&Jt,Jt>>16,He,Me+(2*lt-1)*D),T(B[K+2*lt-0],255&zt,zt>>16,He,Me+(2*lt-0)*D),J!=null&&(Jt=qr+zr>>1,zt=Qt+ra>>1,T(J[Q+2*lt-1],255&Jt,Jt>>16,Xe,Je+(2*lt-1)*D),T(J[Q+2*lt+0],255&zt,zt>>16,Xe,Je+(2*lt+0)*D)),zt=tn,zr=ra}1&ct||(Jt=3*zt+zr+131074>>2,T(B[K+ct-1],255&Jt,Jt>>16,He,Me+(ct-1)*D),J!=null&&(Jt=3*zr+zt+131074>>2,T(J[Q+ct-1],255&Jt,Jt>>16,Xe,Je+(ct-1)*D)))}}function md(){Ko[pw]=_re,Ko[gw]=sI,Ko[QL]=Sre,Ko[xw]=aI,Ko[vw]=iI,Ko[Q5]=oI,Ko[eI]=kre,Ko[e4]=sI,Ko[t4]=aI,Ko[yw]=iI,Ko[r4]=oI}function Uv(S){return S&~Cre?0>S?0:255:S>>lI}function ff(S,T){return Uv((19077*S>>8)+(26149*T>>8)-14234)}function mf(S,T,D){return Uv((19077*S>>8)-(6419*T>>8)-(13320*D>>8)+8708)}function vu(S,T){return Uv((19077*S>>8)+(33050*T>>8)-17685)}function pf(S,T,D,B,K){B[K+0]=ff(S,D),B[K+1]=mf(S,T,D),B[K+2]=vu(S,T)}function bp(S,T,D,B,K){B[K+0]=vu(S,T),B[K+1]=mf(S,T,D),B[K+2]=ff(S,D)}function jp(S,T,D,B,K){var J=mf(S,T,D);T=J<<3&224|vu(S,T)>>3,B[K+0]=248&ff(S,D)|J>>5,B[K+1]=T}function Ha(S,T,D,B,K){var J=240&vu(S,T)|15;B[K+0]=240&ff(S,D)|mf(S,T,D)>>4,B[K+1]=J}function gf(S,T,D,B,K){B[K+0]=255,pf(S,T,D,B,K+1)}function xf(S,T,D,B,K){bp(S,T,D,B,K),B[K+3]=255}function zv(S,T,D,B,K){pf(S,T,D,B,K),B[K+3]=255}function jc(S,T,D){k[S]=function(B,K,J,Q,ae,ie,fe,Ce,$e){for(var me=Ce+(-2&$e)*D;Ce!=me;)T(B[K+0],J[Q+0],ae[ie+0],fe,Ce),T(B[K+1],J[Q+0],ae[ie+0],fe,Ce+D),K+=2,++Q,++ie,Ce+=2*D;1&$e&&T(B[K+0],J[Q+0],ae[ie+0],fe,Ce)}}function fi(S,T,D){return D==0?S==0?T==0?6:5:T==0?4:0:D}function uw(S,T,D,B,K){switch(S>>>30){case 3:pd(T,D,B,K,0);break;case 2:wu(T,D,B,K);break;case 1:Ga(T,D,B,K)}}function wp(S,T){var D,B,K=T.M,J=T.Nb,Q=S.oc,ae=S.pc+40,ie=S.oc,fe=S.pc+584,Ce=S.oc,$e=S.pc+600;for(D=0;16>D;++D)Q[ae+32*D-1]=129;for(D=0;8>D;++D)ie[fe+32*D-1]=129,Ce[$e+32*D-1]=129;for(0<K?Q[ae-1-32]=ie[fe-1-32]=Ce[$e-1-32]=129:(a(Q,ae-32-1,127,21),a(ie,fe-32-1,127,9),a(Ce,$e-32-1,127,9)),B=0;B<S.za;++B){var me=T.ya[T.aa+B];if(0<B){for(D=-1;16>D;++D)s(Q,ae+32*D-4,Q,ae+32*D+12,4);for(D=-1;8>D;++D)s(ie,fe+32*D-4,ie,fe+32*D+4,4),s(Ce,$e+32*D-4,Ce,$e+32*D+4,4)}var Te=S.Gd,Le=S.Hd+B,He=me.ad,Me=me.Hc;if(0<K&&(s(Q,ae-32,Te[Le].y,0,16),s(ie,fe-32,Te[Le].f,0,8),s(Ce,$e-32,Te[Le].ea,0,8)),me.Za){var Xe=Q,Je=ae-32+16;for(0<K&&(B>=S.za-1?a(Xe,Je,Te[Le].y[15],4):s(Xe,Je,Te[Le+1].y,0,4)),D=0;4>D;D++)Xe[Je+128+D]=Xe[Je+256+D]=Xe[Je+384+D]=Xe[Je+0+D];for(D=0;16>D;++D,Me<<=2)Xe=Q,Je=ae+dI[D],Sl[me.Ob[D]](Xe,Je),uw(Me,He,16*+D,Xe,Je)}else if(Xe=fi(B,K,me.Ob[0]),Nu[Xe](Q,ae),Me!=0)for(D=0;16>D;++D,Me<<=2)uw(Me,He,16*+D,Q,ae+dI[D]);for(D=me.Gc,Xe=fi(B,K,me.Dd),xd[Xe](ie,fe),xd[Xe](Ce,$e),Me=He,Xe=ie,Je=fe,255&(me=0|D)&&(170&me?Cp(Me,256,Xe,Je):Nc(Me,256,Xe,Je)),me=Ce,Me=$e,255&(D>>=8)&&(170&D?Cp(He,320,me,Me):Nc(He,320,me,Me)),K<S.Ub-1&&(s(Te[Le].y,0,Q,ae+480,16),s(Te[Le].f,0,ie,fe+224,8),s(Te[Le].ea,0,Ce,$e+224,8)),D=8*J*S.B,Te=S.sa,Le=S.ta+16*B+16*J*S.R,He=S.qa,me=S.ra+8*B+D,Me=S.Ha,Xe=S.Ia+8*B+D,D=0;16>D;++D)s(Te,Le+D*S.R,Q,ae+32*D,16);for(D=0;8>D;++D)s(He,me+D*S.B,ie,fe+32*D,8),s(Me,Xe+D*S.B,Ce,$e+32*D,8)}}function hw(S,T,D,B,K,J,Q,ae,ie){var fe=[0],Ce=[0],$e=0,me=ie!=null?ie.kd:0,Te=ie??new Oe;if(S==null||12>D)return 7;Te.data=S,Te.w=T,Te.ha=D,T=[T],D=[D],Te.gb=[Te.gb];e:{var Le=T,He=D,Me=Te.gb;if(t(S!=null),t(He!=null),t(Me!=null),Me[0]=0,12<=He[0]&&!n(S,Le[0],"RIFF")){if(n(S,Le[0]+8,"WEBP")){Me=3;break e}var Xe=Ue(S,Le[0]+4);if(12>Xe||4294967286<Xe){Me=3;break e}if(me&&Xe>He[0]-8){Me=7;break e}Me[0]=Xe,Le[0]+=12,He[0]-=12}Me=0}if(Me!=0)return Me;for(Xe=0<Te.gb[0],D=D[0];;){e:{var Je=S;He=T,Me=D;var ct=fe,lt=Ce,nr=Le=[0];if((Jt=$e=[$e])[0]=0,8>Me[0])Me=7;else{if(!n(Je,He[0],"VP8X")){if(Ue(Je,He[0]+4)!=10){Me=3;break e}if(18>Me[0]){Me=7;break e}var zt=Ue(Je,He[0]+8),zr=1+De(Je,He[0]+12);if(2147483648<=zr*(Je=1+De(Je,He[0]+15))){Me=3;break e}nr!=null&&(nr[0]=zt),ct!=null&&(ct[0]=zr),lt!=null&&(lt[0]=Je),He[0]+=18,Me[0]-=18,Jt[0]=1}Me=0}}if($e=$e[0],Le=Le[0],Me!=0)return Me;if(He=!!(2&Le),!Xe&&$e)return 3;if(J!=null&&(J[0]=!!(16&Le)),Q!=null&&(Q[0]=He),ae!=null&&(ae[0]=0),Q=fe[0],Le=Ce[0],$e&&He&&ie==null){Me=0;break}if(4>D){Me=7;break}if(Xe&&$e||!Xe&&!$e&&!n(S,T[0],"ALPH")){D=[D],Te.na=[Te.na],Te.P=[Te.P],Te.Sa=[Te.Sa];e:{zt=S,Me=T,Xe=D;var Jt=Te.gb;ct=Te.na,lt=Te.P,nr=Te.Sa,zr=22,t(zt!=null),t(Xe!=null),Je=Me[0];var tn=Xe[0];for(t(ct!=null),t(nr!=null),ct[0]=null,lt[0]=null,nr[0]=0;;){if(Me[0]=Je,Xe[0]=tn,8>tn){Me=7;break e}var ra=Ue(zt,Je+4);if(4294967286<ra){Me=3;break e}var qr=8+ra+1&-2;if(zr+=qr,0<Jt&&zr>Jt){Me=3;break e}if(!n(zt,Je,"VP8 ")||!n(zt,Je,"VP8L")){Me=0;break e}if(tn[0]<qr){Me=7;break e}n(zt,Je,"ALPH")||(ct[0]=zt,lt[0]=Je+8,nr[0]=ra),Je+=qr,tn-=qr}}if(D=D[0],Te.na=Te.na[0],Te.P=Te.P[0],Te.Sa=Te.Sa[0],Me!=0)break}D=[D],Te.Ja=[Te.Ja],Te.xa=[Te.xa];e:if(Jt=S,Me=T,Xe=D,ct=Te.gb[0],lt=Te.Ja,nr=Te.xa,zt=Me[0],Je=!n(Jt,zt,"VP8 "),zr=!n(Jt,zt,"VP8L"),t(Jt!=null),t(Xe!=null),t(lt!=null),t(nr!=null),8>Xe[0])Me=7;else{if(Je||zr){if(Jt=Ue(Jt,zt+4),12<=ct&&Jt>ct-12){Me=3;break e}if(me&&Jt>Xe[0]-8){Me=7;break e}lt[0]=Jt,Me[0]+=8,Xe[0]-=8,nr[0]=zr}else nr[0]=5<=Xe[0]&&Jt[zt+0]==47&&!(Jt[zt+4]>>5),lt[0]=Xe[0];Me=0}if(D=D[0],Te.Ja=Te.Ja[0],Te.xa=Te.xa[0],T=T[0],Me!=0)break;if(4294967286<Te.Ja)return 3;if(ae==null||He||(ae[0]=Te.xa?2:1),Q=[Q],Le=[Le],Te.xa){if(5>D){Me=7;break}ae=Q,me=Le,He=J,S==null||5>D?S=0:5<=D&&S[T+0]==47&&!(S[T+4]>>5)?(Xe=[0],Jt=[0],ct=[0],q(lt=new V,S,T,D),vs(lt,Xe,Jt,ct)?(ae!=null&&(ae[0]=Xe[0]),me!=null&&(me[0]=Jt[0]),He!=null&&(He[0]=ct[0]),S=1):S=0):S=0}else{if(10>D){Me=7;break}ae=Le,S==null||10>D||!rw(S,T+3,D-3)?S=0:(me=S[T+0]|S[T+1]<<8|S[T+2]<<16,He=16383&(S[T+7]<<8|S[T+6]),S=16383&(S[T+9]<<8|S[T+8]),1&me||3<(me>>1&7)||!(me>>4&1)||me>>5>=Te.Ja||!He||!S?S=0:(Q&&(Q[0]=He),ae&&(ae[0]=S),S=1))}if(!S||(Q=Q[0],Le=Le[0],$e&&(fe[0]!=Q||Ce[0]!=Le)))return 3;ie!=null&&(ie[0]=Te,ie.offset=T-ie.w,t(4294967286>T-ie.w),t(ie.offset==ie.ha-D));break}return Me==0||Me==7&&$e&&ie==null?(J!=null&&(J[0]|=Te.na!=null&&0<Te.na.length),B!=null&&(B[0]=Q),K!=null&&(K[0]=Le),0):Me}function Go(S,T,D){var B=T.width,K=T.height,J=0,Q=0,ae=B,ie=K;if(T.Da=S!=null&&0<S.Da,T.Da&&(ae=S.cd,ie=S.bd,J=S.v,Q=S.j,11>D||(J&=-2,Q&=-2),0>J||0>Q||0>=ae||0>=ie||J+ae>B||Q+ie>K))return 0;if(T.v=J,T.j=Q,T.va=J+ae,T.o=Q+ie,T.U=ae,T.T=ie,T.da=S!=null&&0<S.da,T.da){if(!St(ae,ie,D=[S.ib],J=[S.hb]))return 0;T.ib=D[0],T.hb=J[0]}return T.ob=S!=null&&S.ob,T.Kb=S==null||!S.Sd,T.da&&(T.ob=T.ib<3*B/4&&T.hb<3*K/4,T.Kb=0),1}function vf(S){if(S==null)return 2;if(11>S.S){var T=S.f.RGBA;T.fb+=(S.height-1)*T.A,T.A=-T.A}else T=S.f.kb,S=S.height,T.O+=(S-1)*T.fa,T.fa=-T.fa,T.N+=(S-1>>1)*T.Ab,T.Ab=-T.Ab,T.W+=(S-1>>1)*T.Db,T.Db=-T.Db,T.F!=null&&(T.J+=(S-1)*T.lb,T.lb=-T.lb);return 0}function qv(S,T,D,B){if(B==null||0>=S||0>=T)return 2;if(D!=null){if(D.Da){var K=D.cd,J=D.bd,Q=-2&D.v,ae=-2&D.j;if(0>Q||0>ae||0>=K||0>=J||Q+K>S||ae+J>T)return 2;S=K,T=J}if(D.da){if(!St(S,T,K=[D.ib],J=[D.hb]))return 2;S=K[0],T=J[0]}}B.width=S,B.height=T;e:{var ie=B.width,fe=B.height;if(S=B.S,0>=ie||0>=fe||!(S>=pw&&13>S))S=2;else{if(0>=B.Rd&&B.sd==null){Q=J=K=T=0;var Ce=(ae=ie*uI[S])*fe;if(11>S||(J=(fe+1)/2*(T=(ie+1)/2),S==12&&(Q=(K=ie)*fe)),(fe=i(Ce+2*J+Q))==null){S=1;break e}B.sd=fe,11>S?((ie=B.f.RGBA).eb=fe,ie.fb=0,ie.A=ae,ie.size=Ce):((ie=B.f.kb).y=fe,ie.O=0,ie.fa=ae,ie.Fd=Ce,ie.f=fe,ie.N=0+Ce,ie.Ab=T,ie.Cd=J,ie.ea=fe,ie.W=0+Ce+J,ie.Db=T,ie.Ed=J,S==12&&(ie.F=fe,ie.J=0+Ce+2*J),ie.Tc=Q,ie.lb=K)}if(T=1,K=B.S,J=B.width,Q=B.height,K>=pw&&13>K)if(11>K)S=B.f.RGBA,T&=(ae=Math.abs(S.A))*(Q-1)+J<=S.size,T&=ae>=J*uI[K],T&=S.eb!=null;else{S=B.f.kb,ae=(J+1)/2,Ce=(Q+1)/2,ie=Math.abs(S.fa),fe=Math.abs(S.Ab);var $e=Math.abs(S.Db),me=Math.abs(S.lb),Te=me*(Q-1)+J;T&=ie*(Q-1)+J<=S.Fd,T&=fe*(Ce-1)+ae<=S.Cd,T=(T&=$e*(Ce-1)+ae<=S.Ed)&ie>=J&fe>=ae&$e>=ae,T&=S.y!=null,T&=S.f!=null,T&=S.ea!=null,K==12&&(T&=me>=J,T&=Te<=S.Tc,T&=S.F!=null)}else T=0;S=T?0:2}}return S!=0||D!=null&&D.fd&&(S=vf(B)),S}var Np=64,yf=[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],Vv=24,mi=32,$i=8,_p=[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];ye("Predictor0","PredictorAdd0"),k.Predictor0=function(){return 4278190080},k.Predictor1=function(S){return S},k.Predictor2=function(S,T,D){return T[D+0]},k.Predictor3=function(S,T,D){return T[D+1]},k.Predictor4=function(S,T,D){return T[D-1]},k.Predictor5=function(S,T,D){return Fe(Fe(S,T[D+1]),T[D+0])},k.Predictor6=function(S,T,D){return Fe(S,T[D-1])},k.Predictor7=function(S,T,D){return Fe(S,T[D+0])},k.Predictor8=function(S,T,D){return Fe(T[D-1],T[D+0])},k.Predictor9=function(S,T,D){return Fe(T[D+0],T[D+1])},k.Predictor10=function(S,T,D){return Fe(Fe(S,T[D-1]),Fe(T[D+0],T[D+1]))},k.Predictor11=function(S,T,D){var B=T[D+0];return 0>=st(B>>24&255,S>>24&255,(T=T[D-1])>>24&255)+st(B>>16&255,S>>16&255,T>>16&255)+st(B>>8&255,S>>8&255,T>>8&255)+st(255&B,255&S,255&T)?B:S},k.Predictor12=function(S,T,D){var B=T[D+0];return(tt((S>>24&255)+(B>>24&255)-((T=T[D-1])>>24&255))<<24|tt((S>>16&255)+(B>>16&255)-(T>>16&255))<<16|tt((S>>8&255)+(B>>8&255)-(T>>8&255))<<8|tt((255&S)+(255&B)-(255&T)))>>>0},k.Predictor13=function(S,T,D){var B=T[D-1];return(qe((S=Fe(S,T[D+0]))>>24&255,B>>24&255)<<24|qe(S>>16&255,B>>16&255)<<16|qe(S>>8&255,B>>8&255)<<8|qe(255&S,255&B))>>>0};var yu=k.PredictorAdd0;k.PredictorAdd1=Ct,ye("Predictor2","PredictorAdd2"),ye("Predictor3","PredictorAdd3"),ye("Predictor4","PredictorAdd4"),ye("Predictor5","PredictorAdd5"),ye("Predictor6","PredictorAdd6"),ye("Predictor7","PredictorAdd7"),ye("Predictor8","PredictorAdd8"),ye("Predictor9","PredictorAdd9"),ye("Predictor10","PredictorAdd10"),ye("Predictor11","PredictorAdd11"),ye("Predictor12","PredictorAdd12"),ye("Predictor13","PredictorAdd13");var bu=k.PredictorAdd2;rt("ColorIndexInverseTransform","MapARGB","32b",function(S){return S>>8&255},function(S){return S}),rt("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(S){return S},function(S){return S>>8&255});var Sp,bf=k.ColorIndexInverseTransform,Ks=k.MapARGB,Z5=k.VP8LColorIndexInverseTransformAlpha,wc=k.MapAlpha,_l=k.VP8LPredictorsAdd=[];_l.length=16,(k.VP8LPredictors=[]).length=16,(k.VP8LPredictorsAdd_C=[]).length=16,(k.VP8LPredictors_C=[]).length=16;var jf,Wv,Hv,kp,wf,Nf,ju,pd,wu,Cp,Ga,Nc,Vn,Wn,Ms,ta,gd,Gv,Ap,fw,UL,zL,qL,VL,Yv,WL,HL,GL,YL=i(511),KL=i(2041),XL=i(225),ZL=i(767),JL=0,J5=KL,mw=XL,ho=ZL,Yo=YL,pw=0,gw=1,QL=2,xw=3,vw=4,Q5=5,eI=6,e4=7,t4=8,yw=9,r4=10,dre=[2,3,7],ure=[3,3,11],tI=[280,256,256,256,40],hre=[0,1,1,1,0],fre=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],mre=[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],pre=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],gre=8,n4=[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],s4=[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],Kv=null,xre=[[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]],vre=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],rI=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],yre=[[[[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,25
11265,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]]]],bre=[[[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,25
11265,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]]],jre=[[[[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,25
vendor: 26,034 bytes, lines 1126-1150
11265,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]]]],wre=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],Nu=[],Sl=[],xd=[],Nre=1,nI=2,_u=[],Ko=[];Wa("UpsampleRgbLinePair",pf,3),Wa("UpsampleBgrLinePair",bp,3),Wa("UpsampleRgbaLinePair",zv,4),Wa("UpsampleBgraLinePair",xf,4),Wa("UpsampleArgbLinePair",gf,4),Wa("UpsampleRgba4444LinePair",Ha,2),Wa("UpsampleRgb565LinePair",jp,2);var _re=k.UpsampleRgbLinePair,Sre=k.UpsampleBgrLinePair,sI=k.UpsampleRgbaLinePair,aI=k.UpsampleBgraLinePair,iI=k.UpsampleArgbLinePair,oI=k.UpsampleRgba4444LinePair,kre=k.UpsampleRgb565LinePair,bw=16,jw=1<<bw-1,Xv=-227,a4=482,lI=6,Cre=(256<<lI)-1,cI=0,Are=i(256),Pre=i(256),Ere=i(256),Tre=i(256),Ore=i(a4-Xv),Lre=i(a4-Xv);jc("YuvToRgbRow",pf,3),jc("YuvToBgrRow",bp,3),jc("YuvToRgbaRow",zv,4),jc("YuvToBgraRow",xf,4),jc("YuvToArgbRow",gf,4),jc("YuvToRgba4444Row",Ha,2),jc("YuvToRgb565Row",jp,2);var dI=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],ww=[0,2,8],Ire=[8,7,6,4,4,2,2,2,1,1,1,1],Rre=1;this.WebPDecodeRGBA=function(S,T,D,B,K){var J=gw,Q=new je,ae=new xr;Q.ba=ae,ae.S=J,ae.width=[ae.width],ae.height=[ae.height];var ie=ae.width,fe=ae.height,Ce=new Bt;if(Ce==null||S==null)var $e=2;else t(Ce!=null),$e=hw(S,T,D,Ce.width,Ce.height,Ce.Pd,Ce.Qd,Ce.format,null);if($e!=0?ie=0:(ie!=null&&(ie[0]=Ce.width[0]),fe!=null&&(fe[0]=Ce.height[0]),ie=1),ie){ae.width=ae.width[0],ae.height=ae.height[0],B!=null&&(B[0]=ae.width),K!=null&&(K[0]=ae.height);e:{if(B=new up,(K=new Oe).data=S,K.w=T,K.ha=D,K.kd=1,T=[0],t(K!=null),((S=hw(K.data,K.w,K.ha,null,null,null,T,null,K))==0||S==7)&&T[0]&&(S=4),(T=S)==0){if(t(Q!=null),B.data=K.data,B.w=K.w+K.offset,B.ha=K.ha-K.offset,B.put=Ut,B.ac=ts,B.bc=Ur,B.ma=Q,K.xa){if((S=lf())==null){Q=1;break e}if(function(me,Te){var Le=[0],He=[0],Me=[0];t:for(;;){if(me==null)return 0;if(Te==null)return me.a=2,0;if(me.l=Te,me.a=0,q(me.m,Te.data,Te.w,Te.ha),!vs(me.m,Le,He,Me)){me.a=3;break t}if(me.xb=nI,Te.width=Le[0],Te.height=He[0],!gc(Le[0],He[0],1,me,null))break t;return 1}return t(me.a!=0),0}(S,B)){if(B=(T=qv(B.width,B.height,Q.Oa,Q.ba))==0){t:{B=S;r:for(;;){if(B==null){B=0;break t}if(t(B.s.yc!=null),t(B.s.Ya!=null),t(0<B.s.Wb),t((D=B.l)!=null),t((K=D.ma)!=null),B.xb!=0){if(B.ca=K.ba,B.tb=K.tb,t(B.ca!=null),!Go(K.Oa,D,xw)){B.a=2;break r}if(!cf(B,D.width)||D.da)break r;if((D.da||tr(B.ca.S))&&bs(),11>B.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),B.ca.f.kb.F!=null&&bs()),B.Pb&&0<B.s.ua&&B.s.vb.X==null&&!re(B.s.vb,B.s.Wa.Xa)){B.a=1;break r}B.xb=0}if(!Nl(B,B.V,B.Ba,B.c,B.i,D.o,mu))break r;K.Dc=B.Ma,B=1;break t}t(B.a!=0),B=0}B=!B}B&&(T=S.a)}else T=S.a}else{if((S=new I5)==null){Q=1;break e}if(S.Fa=K.na,S.P=K.P,S.qc=K.Sa,vc(S,B)){if((T=qv(B.width,B.height,Q.Oa,Q.ba))==0){if(S.Aa=0,D=Q.Oa,t((K=S)!=null),D!=null){if(0<(ie=0>(ie=D.Md)?0:100<ie?255:255*ie/100)){for(fe=Ce=0;4>fe;++fe)12>($e=K.pb[fe]).lc&&($e.ia=ie*Ire[0>$e.lc?0:$e.lc]>>3),Ce|=$e.ia;Ce&&(alert("todo:VP8InitRandom"),K.ia=1)}K.Ga=D.Id,100<K.Ga?K.Ga=100:0>K.Ga&&(K.Ga=0)}(function(me,Te){if(me==null)return 0;if(Te==null)return Gs(me,2,"NULL VP8Io parameter in VP8Decode().");if(!me.cb&&!vc(me,Te))return 0;if(t(me.cb),Te.ac==null||Te.ac(Te)){Te.ob&&(me.L=0);var Le=ww[me.L];if(me.L==2?(me.yb=0,me.zb=0):(me.yb=Te.v-Le>>4,me.zb=Te.j-Le>>4,0>me.yb&&(me.yb=0),0>me.zb&&(me.zb=0)),me.Va=Te.o+15+Le>>4,me.Hb=Te.va+15+Le>>4,me.Hb>me.za&&(me.Hb=me.za),me.Va>me.Ub&&(me.Va=me.Ub),0<me.L){var He=me.ed;for(Le=0;4>Le;++Le){var Me;if(me.Qa.Cb){var Xe=me.Qa.Lb[Le];me.Qa.Fb||(Xe+=He.Tb)}else Xe=He.Tb;for(Me=0;1>=Me;++Me){var Je=me.gd[Le][Me],ct=Xe;if(He.Pc&&(ct+=He.vd[0],Me&&(ct+=He.od[0])),0<(ct=0>ct?0:63<ct?63:ct)){var lt=ct;0<He.wb&&(lt=4<He.wb?lt>>2:lt>>1)>9-He.wb&&(lt=9-He.wb),1>lt&&(lt=1),Je.dd=lt,Je.tc=2*ct+lt,Je.ld=40<=ct?2:15<=ct?1:0}else Je.tc=0;Je.La=Me}}}Le=0}else Gs(me,6,"Frame setup failed"),Le=me.a;if(Le=Le==0){if(Le){me.$c=0,0<me.Aa||(me.Ic=Rre);t:{Le=me.Ic,He=4*(lt=me.za);var nr=32*lt,zt=lt+1,zr=0<me.L?lt*(0<me.Aa?2:1):0,Jt=(me.Aa==2?2:1)*lt;if((Je=He+832+(Me=3*(16*Le+ww[me.L])/2*nr)+(Xe=me.Fa!=null&&0<me.Fa.length?me.Kc.c*me.Kc.i:0))!=Je)Le=0;else{if(Je>me.Vb){if(me.Vb=0,me.Ec=i(Je),me.Fc=0,me.Ec==null){Le=Gs(me,1,"no memory during frame initialization.");break t}me.Vb=Je}Je=me.Ec,ct=me.Fc,me.Ac=Je,me.Bc=ct,ct+=He,me.Gd=o(nr,ew),me.Hd=0,me.rb=o(zt+1,Ov),me.sb=1,me.wa=zr?o(zr,Ho):null,me.Y=0,me.D.Nb=0,me.D.wa=me.wa,me.D.Y=me.Y,0<me.Aa&&(me.D.Y+=lt),t(!0),me.oc=Je,me.pc=ct,ct+=832,me.ya=o(Jt,Lv),me.aa=0,me.D.ya=me.ya,me.D.aa=me.aa,me.Aa==2&&(me.D.aa+=lt),me.R=16*lt,me.B=8*lt,lt=(nr=ww[me.L])*me.R,nr=nr/2*me.B,me.sa=Je,me.ta=ct+lt,me.qa=me.sa,me.ra=me.ta+16*Le*me.R+nr,me.Ha=me.qa,me.Ia=me.ra+8*Le*me.B+nr,me.$c=0,ct+=Me,me.mb=Xe?Je:null,me.nb=Xe?ct:null,t(ct+Xe<=me.Fc+me.Vb),Iv(me),a(me.Ac,me.Bc,0,He),Le=1}}if(Le){if(Te.ka=0,Te.y=me.sa,Te.O=me.ta,Te.f=me.qa,Te.N=me.ra,Te.ea=me.Ha,Te.Vd=me.Ia,Te.fa=me.R,Te.Rc=me.B,Te.F=null,Te.J=0,!JL){for(Le=-255;255>=Le;++Le)YL[255+Le]=0>Le?-Le:Le;for(Le=-1020;1020>=Le;++Le)KL[1020+Le]=-128>Le?-128:127<Le?127:Le;for(Le=-112;112>=Le;++Le)XL[112+Le]=-16>Le?-16:15<Le?15:Le;for(Le=-255;510>=Le;++Le)ZL[255+Le]=0>Le?0:255<Le?255:Le;JL=1}ju=sw,pd=R5,Cp=M5,Ga=D5,Nc=yc,wu=nw,Vn=ow,Wn=lw,Ms=dw,ta=M,gd=cw,Gv=hf,Ap=G,fw=ue,UL=vp,zL=Bv,qL=yp,VL=iw,Sl[0]=V5,Sl[1]=pp,Sl[2]=z5,Sl[3]=q5,Sl[4]=W5,Sl[5]=dd,Sl[6]=H5,Sl[7]=ud,Sl[8]=Y5,Sl[9]=G5,Nu[0]=aw,Nu[1]=$5,Nu[2]=F5,Nu[3]=B5,Nu[4]=gu,Nu[5]=U5,Nu[6]=df,xd[0]=K5,xd[1]=Rv,xd[2]=gp,xd[3]=Mv,xd[4]=X5,xd[5]=xp,xd[6]=Dv,Le=1}else Le=0}Le&&(Le=function(tn,ra){for(tn.M=0;tn.M<tn.Va;++tn.M){var qr,Qt=tn.Jc[tn.M&tn.Xb],_t=tn.m,Ds=tn;for(qr=0;qr<Ds.za;++qr){var Ir=_t,cn=Ds,ns=cn.Ac,Oa=cn.Bc+4*qr,pi=cn.zc,As=cn.ya[cn.aa+qr];if(cn.Qa.Bb?As.$b=oe(Ir,cn.Pa.jb[0])?2+oe(Ir,cn.Pa.jb[2]):oe(Ir,cn.Pa.jb[1]):As.$b=0,cn.kc&&(As.Ad=oe(Ir,cn.Bd)),As.Za=!oe(Ir,145)+0,As.Za){var Ya=As.Ob,gi=0;for(cn=0;4>cn;++cn){var na,dn=pi[0+cn];for(na=0;4>na;++na){dn=bre[ns[Oa+na]][dn];for(var kn=rI[oe(Ir,dn[0])];0<kn;)kn=rI[2*kn+oe(Ir,dn[kn])];dn=-kn,ns[Oa+na]=dn}s(Ya,gi,ns,Oa,4),gi+=4,pi[0+cn]=dn}}else dn=oe(Ir,156)?oe(Ir,128)?1:3:oe(Ir,163)?2:0,As.Ob[0]=dn,a(ns,Oa,dn,4),a(pi,0,dn,4);As.Dd=oe(Ir,142)?oe(Ir,114)?oe(Ir,183)?1:3:2:0}if(Ds.m.Ka)return Gs(tn,7,"Premature end-of-partition0 encountered.");for(;tn.ja<tn.za;++tn.ja){if(Ds=Qt,Ir=(_t=tn).rb[_t.sb-1],ns=_t.rb[_t.sb+_t.ja],qr=_t.ya[_t.aa+_t.ja],Oa=_t.kc?qr.Ad:0)Ir.la=ns.la=0,qr.Za||(Ir.Na=ns.Na=0),qr.Hc=0,qr.Gc=0,qr.ia=0;else{var Ps,Cn;if(Ir=ns,ns=Ds,Oa=_t.Pa.Xc,pi=_t.ya[_t.aa+_t.ja],As=_t.pb[pi.$b],cn=pi.ad,Ya=0,gi=_t.rb[_t.sb-1],dn=na=0,a(cn,Ya,0,384),pi.Za)var La=0,kl=Oa[3];else{kn=i(16);var $s=Ir.Na+gi.Na;if($s=Kv(ns,Oa[1],$s,As.Eb,0,kn,0),Ir.Na=gi.Na=(0<$s)+0,1<$s)ju(kn,0,cn,Ya);else{var Fi=kn[0]+3>>3;for(kn=0;256>kn;kn+=16)cn[Ya+kn]=Fi}La=1,kl=Oa[0]}var Fn=15&Ir.la,sa=15&gi.la;for(kn=0;4>kn;++kn){var fo=1&sa;for(Fi=Cn=0;4>Fi;++Fi)Fn=Fn>>1|(fo=($s=Kv(ns,kl,$s=fo+(1&Fn),As.Sc,La,cn,Ya))>La)<<7,Cn=Cn<<2|(3<$s?3:1<$s?2:cn[Ya+0]!=0),Ya+=16;Fn>>=4,sa=sa>>1|fo<<7,na=(na<<8|Cn)>>>0}for(kl=Fn,La=sa>>4,Ps=0;4>Ps;Ps+=2){for(Cn=0,Fn=Ir.la>>4+Ps,sa=gi.la>>4+Ps,kn=0;2>kn;++kn){for(fo=1&sa,Fi=0;2>Fi;++Fi)$s=fo+(1&Fn),Fn=Fn>>1|(fo=0<($s=Kv(ns,Oa[2],$s,As.Qc,0,cn,Ya)))<<3,Cn=Cn<<2|(3<$s?3:1<$s?2:cn[Ya+0]!=0),Ya+=16;Fn>>=2,sa=sa>>1|fo<<5}dn|=Cn<<4*Ps,kl|=Fn<<4<<Ps,La|=(240&sa)<<Ps}Ir.la=kl,gi.la=La,pi.Hc=na,pi.Gc=dn,pi.ia=43690&dn?0:As.ia,Oa=!(na|dn)}if(0<_t.L&&(_t.wa[_t.Y+_t.ja]=_t.gd[qr.$b][qr.Za],_t.wa[_t.Y+_t.ja].La|=!Oa),Ds.Ka)return Gs(tn,7,"Premature end-of-file encountered.")}if(Iv(tn),_t=ra,Ds=1,qr=(Qt=tn).D,Ir=0<Qt.L&&Qt.M>=Qt.zb&&Qt.M<=Qt.Va,Qt.Aa==0)t:{if(qr.M=Qt.M,qr.uc=Ir,wp(Qt,qr),Ds=1,qr=(Cn=Qt.D).Nb,Ir=(dn=ww[Qt.L])*Qt.R,ns=dn/2*Qt.B,kn=16*qr*Qt.R,Fi=8*qr*Qt.B,Oa=Qt.sa,pi=Qt.ta-Ir+kn,As=Qt.qa,cn=Qt.ra-ns+Fi,Ya=Qt.Ha,gi=Qt.Ia-ns+Fi,sa=(Fn=Cn.M)==0,na=Fn>=Qt.Va-1,Qt.Aa==2&&wp(Qt,Cn),Cn.uc)for(fo=($s=Qt).D.M,t($s.D.uc),Cn=$s.yb;Cn<$s.Hb;++Cn){La=Cn,kl=fo;var xi=(mo=(Ia=$s).D).Nb;Ps=Ia.R;var mo=mo.wa[mo.Y+La],po=Ia.sa,Bi=Ia.ta+16*xi*Ps+16*La,go=mo.dd,Hn=mo.tc;if(Hn!=0)if(t(3<=Hn),Ia.L==1)0<La&&zL(po,Bi,Ps,Hn+4),mo.La&&VL(po,Bi,Ps,Hn),0<kl&&UL(po,Bi,Ps,Hn+4),mo.La&&qL(po,Bi,Ps,Hn);else{var xo=Ia.B,Cl=Ia.qa,_f=Ia.ra+8*xi*xo+8*La,vd=Ia.Ha,Ia=Ia.Ia+8*xi*xo+8*La;xi=mo.ld,0<La&&(Wn(po,Bi,Ps,Hn+4,go,xi),ta(Cl,_f,vd,Ia,xo,Hn+4,go,xi)),mo.La&&(Gv(po,Bi,Ps,Hn,go,xi),fw(Cl,_f,vd,Ia,xo,Hn,go,xi)),0<kl&&(Vn(po,Bi,Ps,Hn+4,go,xi),Ms(Cl,_f,vd,Ia,xo,Hn+4,go,xi)),mo.La&&(gd(po,Bi,Ps,Hn,go,xi),Ap(Cl,_f,vd,Ia,xo,Hn,go,xi))}}if(Qt.ia&&alert("todo:DitherRow"),_t.put!=null){if(Cn=16*Fn,Fn=16*(Fn+1),sa?(_t.y=Qt.sa,_t.O=Qt.ta+kn,_t.f=Qt.qa,_t.N=Qt.ra+Fi,_t.ea=Qt.Ha,_t.W=Qt.Ia+Fi):(Cn-=dn,_t.y=Oa,_t.O=pi,_t.f=As,_t.N=cn,_t.ea=Ya,_t.W=gi),na||(Fn-=dn),Fn>_t.o&&(Fn=_t.o),_t.F=null,_t.J=null,Qt.Fa!=null&&0<Qt.Fa.length&&Cn<Fn&&(_t.J=Ys(Qt,_t,Cn,Fn-Cn),_t.F=Qt.mb,_t.F==null&&_t.F.length==0)){Ds=Gs(Qt,3,"Could not decode alpha data.");break t}Cn<_t.j&&(dn=_t.j-Cn,Cn=_t.j,t(!(1&dn)),_t.O+=Qt.R*dn,_t.N+=Qt.B*(dn>>1),_t.W+=Qt.B*(dn>>1),_t.F!=null&&(_t.J+=_t.width*dn)),Cn<Fn&&(_t.O+=_t.v,_t.N+=_t.v>>1,_t.W+=_t.v>>1,_t.F!=null&&(_t.J+=_t.v),_t.ka=Cn-_t.j,_t.U=_t.va-_t.v,_t.T=Fn-Cn,Ds=_t.put(_t))}qr+1!=Qt.Ic||na||(s(Qt.sa,Qt.ta-Ir,Oa,pi+16*Qt.R,Ir),s(Qt.qa,Qt.ra-ns,As,cn+8*Qt.B,ns),s(Qt.Ha,Qt.Ia-ns,Ya,gi+8*Qt.B,ns))}if(!Ds)return Gs(tn,6,"Output aborted.")}return 1}(me,Te)),Te.bc!=null&&Te.bc(Te),Le&=1}return Le?(me.cb=0,Le):0})(S,B)||(T=S.a)}}else T=S.a}T==0&&Q.Oa!=null&&Q.Oa.fd&&(T=vf(Q.ba))}Q=T}J=Q!=0?null:11>J?ae.f.RGBA.eb:ae.f.kb.y}else J=null;return J};var uI=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function d(k,I){for(var P="",O=0;O<4;O++)P+=String.fromCharCode(k[I++]);return P}function u(k,I){return k[I+0]|k[I+1]<<8}function h(k,I){return(k[I+0]|k[I+1]<<8|k[I+2]<<16)>>>0}function f(k,I){return(k[I+0]|k[I+1]<<8|k[I+2]<<16|k[I+3]<<24)>>>0}new c;var m=[0],x=[0],p=[],v=new c,g=e,y=function(k,I){var P={},O=0,A=!1,R=0,L=0;if(P.frames=[],!function(F,V){for(var Z=0;Z<4;Z++)if(F[V+Z]!="RIFF".charCodeAt(Z))return!0;return!1}(k,I)){for(f(k,I+=4),I+=8;I<k.length;){var z=d(k,I),U=f(k,I+=4);I+=4;var $=U+(1&U);switch(z){case"VP8 ":case"VP8L":P.frames[O]===void 0&&(P.frames[O]={}),(se=P.frames[O]).src_off=A?L:I-8,se.src_size=R+U+8,O++,A&&(A=!1,R=0,L=0);break;case"VP8X":(se=P.header={}).feature_flags=k[I];var q=I+4;se.canvas_width=1+h(k,q),q+=3,se.canvas_height=1+h(k,q),q+=3;break;case"ALPH":A=!0,R=$+8,L=I-8;break;case"ANIM":(se=P.header).bgcolor=f(k,I),q=I+4,se.loop_count=u(k,q),q+=2;break;case"ANMF":var ne,se;(se=P.frames[O]={}).offset_x=2*h(k,I),I+=3,se.offset_y=2*h(k,I),I+=3,se.width=1+h(k,I),I+=3,se.height=1+h(k,I),I+=3,se.duration=h(k,I),I+=3,ne=k[I++],se.dispose=1&ne,se.blend=ne>>1&1}z!="ANMF"&&(I+=$)}return P}}(g,0);y.response=g,y.rgbaoutput=!0,y.dataurl=!1;var b=y.header?y.header:null,w=y.frames?y.frames:null;if(b){b.loop_counter=b.loop_count,m=[b.canvas_height],x=[b.canvas_width];for(var _=0;_<w.length&&w[_].blend!=0;_++);}var C=w[0],E=v.WebPDecodeRGBA(g,C.src_off,C.src_size,x,m);C.rgba=E,C.imgwidth=x[0],C.imgheight=m[0];for(var N=0;N<x[0]*m[0]*4;N++)p[N]=E[N];return this.width=x,this.height=m,this.data=p,this}/** ==================================================================== 1127 * @license 1128 * jsPDF XMP metadata plugin 1129 * Copyright (c) 2016 Jussi Utunen, [email protected] 1130 * 1131 * Permission is hereby granted, free of charge, to any person obtaining 1132 * a copy of this software and associated documentation files (the 1133 * "Software"), to deal in the Software without restriction, including 1134 * without limitation the rights to use, copy, modify, merge, publish, 1135 * distribute, sublicense, and/or sell copies of the Software, and to 1136 * permit persons to whom the Software is furnished to do so, subject to 1137 * the following conditions: 1138 * 1139 * The above copyright notice and this permission notice shall be 1140 * included in all copies or substantial portions of the Software. 1141 * 1142 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 1143 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1144 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 1145 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 1146 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 1147 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 1148 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 1149 * ==================================================================== 1150 */function lZe(){var e,t=this.internal.__metadata__.metadata,n=unescape(encodeURIComponent(t));e=this.internal.__metadata__.rawXml?n:'<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>'+n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")+"</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 cZe(){this.internal.__metadata__.metadataObjectNumber&&this.internal.write("/Metadata "+this.internal.__metadata__.metadataObjectNumber+" 0 R")}(function(e){var t,n,s,a,i,o,l,c,d,u=function(F){return F=F||{},this.isStrokeTransparent=F.isStrokeTransparent||!1,this.strokeOpacity=F.strokeOpacity||1,this.strokeStyle=F.strokeStyle||"#000000",this.fillStyle=F.fillStyle||"#000000",this.isFillTransparent=F.isFillTransparent||!1,this.fillOpacity=F.fillOpacity||1,this.font=F.font||"10px sans-serif",this.textBaseline=F.textBaseline||"alphabetic",this.textAlign=F.textAlign||"left",this.lineWidth=F.lineWidth||1,this.lineJoin=F.lineJoin||"miter",this.lineCap=F.lineCap||"butt",this.path=F.path||[],this.transform=F.transform!==void 0?F.transform.clone():new c,this.globalCompositeOperation=F.globalCompositeOperation||"normal",this.globalAlpha=F.globalAlpha||1,this.clip_path=F.clip_path||[],this.currentPoint=F.currentPoint||new o,this.miterLimit=F.miterLimit||10,this.lastPoint=F.lastPoint||new o,this.lineDashOffset=F.lineDashOffset||0,this.lineDash=F.lineDash||[],this.margin=F.margin||[0,0,0,0],this.prevPageLastElemOffset=F.prevPageLastElemOffset||0,this.ignoreClearRect=typeof F.ignoreClearRect!="boolean"||F.ignoreClearRect,this};e.events.push(["initialized",function(){this.context2d=new h(this),t=this.internal.f2,n=this.internal.getCoordinateString,s=this.internal.getVerticalCoordinateString,a=this.internal.getHorizontalCoordinate,i=this.internal.getVerticalCoordinate,o=this.internal.Point,l=this.internal.Rectangle,c=this.internal.Matrix,d=new u}]);var h=function(F){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var V=F;Object.defineProperty(this,"pdf",{get:function(){return V}});var Z=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return Z},set:function(re){Z=!!re}});var de=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return de},set:function(re){de=!!re}});var ve=0;Object.defineProperty(this,"posX",{get:function(){return ve},set:function(re){isNaN(re)||(ve=re)}});var pe=0;Object.defineProperty(this,"posY",{get:function(){return pe},set:function(re){isNaN(re)||(pe=re)}}),Object.defineProperty(this,"margin",{get:function(){return d.margin},set:function(re){var et;typeof re=="number"?et=[re,re,re,re]:((et=new Array(4))[0]=re[0],et[1]=re.length>=2?re[1]:et[0],et[2]=re.length>=3?re[2]:et[0],et[3]=re.length>=4?re[3]:et[1]),d.margin=et}});var _e=!1;Object.defineProperty(this,"autoPaging",{get:function(){return _e},set:function(re){_e=re}});var xe=0;Object.defineProperty(this,"lastBreak",{get:function(){return xe},set:function(re){xe=re}});var oe=[];Object.defineProperty(this,"pageBreaks",{get:function(){return oe},set:function(re){oe=re}}),Object.defineProperty(this,"ctx",{get:function(){return d},set:function(re){re instanceof u&&(d=re)}}),Object.defineProperty(this,"path",{get:function(){return d.path},set:function(re){d.path=re}});var we=[];Object.defineProperty(this,"ctxStack",{get:function(){return we},set:function(re){we=re}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(re){var et;et=f(re),this.ctx.fillStyle=et.style,this.ctx.isFillTransparent=et.a===0,this.ctx.fillOpacity=et.a,this.pdf.setFillColor(et.r,et.g,et.b,{a:et.a}),this.pdf.setTextColor(et.r,et.g,et.b,{a:et.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(re){var et=f(re);this.ctx.strokeStyle=et.style,this.ctx.isStrokeTransparent=et.a===0,this.ctx.strokeOpacity=et.a,et.a===0?this.pdf.setDrawColor(255,255,255):(et.a,this.pdf.setDrawColor(et.r,et.g,et.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(re){["butt","round","square"].indexOf(re)!==-1&&(this.ctx.lineCap=re,this.pdf.setLineCap(re))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(re){isNaN(re)||(this.ctx.lineWidth=re,this.pdf.setLineWidth(re))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(re){["bevel","round","miter"].indexOf(re)!==-1&&(this.ctx.lineJoin=re,this.pdf.setLineJoin(re))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(re){isNaN(re)||(this.ctx.miterLimit=re,this.pdf.setMiterLimit(re))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(re){this.ctx.textBaseline=re}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(re){["right","end","center","left","start"].indexOf(re)!==-1&&(this.ctx.textAlign=re)}});var ce=null,De=null,Ue=null;Object.defineProperty(this,"fontFaces",{get:function(){return Ue},set:function(re){ce=null,De=null,Ue=re}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(re){var et;if(this.ctx.font=re,(et=/^\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(re))!==null){var kt=et[1];et[2];var St=et[3],Ve=et[4];et[5];var he=et[6],ye=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(Ve)[2];Ve=Math.floor(ye==="px"?parseFloat(Ve)*this.pdf.internal.scaleFactor:ye==="em"?parseFloat(Ve)*this.pdf.getFontSize():parseFloat(Ve)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(Ve);var Ee=function(rt){var Gt,gt,Zt=[],dr=rt.trim();if(dr==="")return PC;if(dr in N9)return[N9[dr]];for(;dr!=="";){switch(gt=null,Gt=(dr=S9(dr)).charAt(0)){case'"':case"'":gt=rZe(dr.substring(1),Gt);break;default:gt=nZe(dr)}if(gt===null||(Zt.push(gt[0]),(dr=S9(gt[1]))!==""&&dr.charAt(0)!==","))return PC;dr=dr.replace(/^,/,"")}return Zt}(he);if(this.fontFaces){var Fe=function(rt,Gt){var gt=rt.getFontList(),Zt=JSON.stringify(gt);if(ce===null||De!==Zt){var dr=function(Fr){var Tt=[];return Object.keys(Fr).forEach(function(Br){Fr[Br].forEach(function(tr){var or=null;switch(tr){case"bold":or={family:Br,weight:"bold"};break;case"italic":or={family:Br,style:"italic"};break;case"bolditalic":or={family:Br,weight:"bold",style:"italic"};break;case"":case"normal":or={family:Br}}or!==null&&(or.ref={name:Br,style:tr},Tt.push(or))})}),Tt}(gt);ce=function(Fr){for(var Tt={},Br=0;Br<Fr.length;++Br){var tr=AC(Fr[Br]),or=tr.family,pn=tr.stretch,xr=tr.style,Bt=tr.weight;Tt[or]=Tt[or]||{},Tt[or][pn]=Tt[or][pn]||{},Tt[or][pn][xr]=Tt[or][pn][xr]||{},Tt[or][pn][xr][Bt]=tr}return Tt}(dr.concat(Gt)),De=Zt}return ce}(this.pdf,this.fontFaces),tt=Ee.map(function(rt){return{family:rt,stretch:"normal",weight:St,style:kt}}),qe=function(rt,Gt,gt){for(var Zt=(gt=gt||{}).defaultFontFamily||"times",dr=Object.assign({},tZe,gt.genericFontFamilies||{}),Fr=null,Tt=null,Br=0;Br<Gt.length;++Br)if(dr[(Fr=AC(Gt[Br])).family]&&(Fr.family=dr[Fr.family]),rt.hasOwnProperty(Fr.family)){Tt=rt[Fr.family];break}if(!(Tt=Tt||rt[Zt]))throw new Error("Could not find a font-family for the rule '"+_9(Fr)+"' and default family '"+Zt+"'.");if(Tt=function(tr,or){if(or[tr])return or[tr];var pn=AE[tr],xr=pn<=AE.normal?-1:1,Bt=w9(or,nre,pn,xr);if(!Bt)throw new Error("Could not find a matching font-stretch value for "+tr);return Bt}(Fr.stretch,Tt),Tt=function(tr,or){if(or[tr])return or[tr];for(var pn=rre[tr],xr=0;xr<pn.length;++xr)if(or[pn[xr]])return or[pn[xr]];throw new Error("Could not find a matching font-style for "+tr)}(Fr.style,Tt),!(Tt=function(tr,or){if(or[tr])return or[tr];if(tr===400&&or[500])return or[500];if(tr===500&&or[400])return or[400];var pn=eZe[tr],xr=w9(or,sre,pn,tr<400?-1:1);if(!xr)throw new Error("Could not find a matching font-weight for value "+tr);return xr}(Fr.weight,Tt)))throw new Error("Failed to resolve a font for the rule '"+_9(Fr)+"'.");return Tt}(Fe,tt);this.pdf.setFont(qe.ref.name,qe.ref.style)}else{var st="";(St==="bold"||parseInt(St,10)>=700||kt==="bold")&&(st="bold"),kt==="italic"&&(st+="italic"),st.length===0&&(st="normal");for(var Ct="",ke={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"},Ie=0;Ie<Ee.length;Ie++){if(this.pdf.internal.getFont(Ee[Ie],st,{noFallback:!0,disableWarning:!0})!==void 0){Ct=Ee[Ie];break}if(st==="bolditalic"&&this.pdf.internal.getFont(Ee[Ie],"bold",{noFallback:!0,disableWarning:!0})!==void 0)Ct=Ee[Ie],st="bold";else if(this.pdf.internal.getFont(Ee[Ie],"normal",{noFallback:!0,disableWarning:!0})!==void 0){Ct=Ee[Ie],st="normal";break}}if(Ct===""){for(var at=0;at<Ee.length;at++)if(ke[Ee[at]]){Ct=ke[Ee[at]];break}}Ct=Ct===""?"Times":Ct,this.pdf.setFont(Ct,st)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(re){this.ctx.globalCompositeOperation=re}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(re){this.ctx.globalAlpha=re}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(re){this.ctx.lineDashOffset=re,se.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(re){this.ctx.lineDash=re,se.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(re){this.ctx.ignoreClearRect=!!re}})};h.prototype.setLineDash=function(F){this.lineDash=F},h.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},h.prototype.fill=function(){w.call(this,"fill",!1)},h.prototype.stroke=function(){w.call(this,"stroke",!1)},h.prototype.beginPath=function(){this.path=[{type:"begin"}]},h.prototype.moveTo=function(F,V){if(isNaN(F)||isNaN(V))throw Bn.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var Z=this.ctx.transform.applyToPoint(new o(F,V));this.path.push({type:"mt",x:Z.x,y:Z.y}),this.ctx.lastPoint=new o(F,V)},h.prototype.closePath=function(){var F=new o(0,0),V=0;for(V=this.path.length-1;V!==-1;V--)if(this.path[V].type==="begin"&&En(this.path[V+1])==="object"&&typeof this.path[V+1].x=="number"){F=new o(this.path[V+1].x,this.path[V+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new o(F.x,F.y)},h.prototype.lineTo=function(F,V){if(isNaN(F)||isNaN(V))throw Bn.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var Z=this.ctx.transform.applyToPoint(new o(F,V));this.path.push({type:"lt",x:Z.x,y:Z.y}),this.ctx.lastPoint=new o(Z.x,Z.y)},h.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),w.call(this,null,!0)},h.prototype.quadraticCurveTo=function(F,V,Z,de){if(isNaN(Z)||isNaN(de)||isNaN(F)||isNaN(V))throw Bn.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var ve=this.ctx.transform.applyToPoint(new o(Z,de)),pe=this.ctx.transform.applyToPoint(new o(F,V));this.path.push({type:"qct",x1:pe.x,y1:pe.y,x:ve.x,y:ve.y}),this.ctx.lastPoint=new o(ve.x,ve.y)},h.prototype.bezierCurveTo=function(F,V,Z,de,ve,pe){if(isNaN(ve)||isNaN(pe)||isNaN(F)||isNaN(V)||isNaN(Z)||isNaN(de))throw Bn.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var _e=this.ctx.transform.applyToPoint(new o(ve,pe)),xe=this.ctx.transform.applyToPoint(new o(F,V)),oe=this.ctx.transform.applyToPoint(new o(Z,de));this.path.push({type:"bct",x1:xe.x,y1:xe.y,x2:oe.x,y2:oe.y,x:_e.x,y:_e.y}),this.ctx.lastPoint=new o(_e.x,_e.y)},h.prototype.arc=function(F,V,Z,de,ve,pe){if(isNaN(F)||isNaN(V)||isNaN(Z)||isNaN(de)||isNaN(ve))throw Bn.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to
1150jsPDF.context2d.arc");if(pe=!!pe,!this.ctx.transform.isIdentity){var _e=this.ctx.transform.applyToPoint(new o(F,V));F=_e.x,V=_e.y;var xe=this.ctx.transform.applyToPoint(new o(0,Z)),oe=this.ctx.transform.applyToPoint(new o(0,0));Z=Math.sqrt(Math.pow(xe.x-oe.x,2)+Math.pow(xe.y-oe.y,2))}Math.abs(ve-de)>=2*Math.PI&&(de=0,ve=2*Math.PI),this.path.push({type:"arc",x:F,y:V,radius:Z,startAngle:de,endAngle:ve,counterclockwise:pe})},h.prototype.arcTo=function(F,V,Z,de,ve){throw new Error("arcTo not implemented.")},h.prototype.rect=function(F,V,Z,de){if(isNaN(F)||isNaN(V)||isNaN(Z)||isNaN(de))throw Bn.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(F,V),this.lineTo(F+Z,V),this.lineTo(F+Z,V+de),this.lineTo(F,V+de),this.lineTo(F,V),this.lineTo(F+Z,V),this.lineTo(F,V)},h.prototype.fillRect=function(F,V,Z,de){if(isNaN(F)||isNaN(V)||isNaN(Z)||isNaN(de))throw Bn.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!m.call(this)){var ve={};this.lineCap!=="butt"&&(ve.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(ve.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(F,V,Z,de),this.fill(),ve.hasOwnProperty("lineCap")&&(this.lineCap=ve.lineCap),ve.hasOwnProperty("lineJoin")&&(this.lineJoin=ve.lineJoin)}},h.prototype.strokeRect=function(F,V,Z,de){if(isNaN(F)||isNaN(V)||isNaN(Z)||isNaN(de))throw Bn.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");x.call(this)||(this.beginPath(),this.rect(F,V,Z,de),this.stroke())},h.prototype.clearRect=function(F,V,Z,de){if(isNaN(F)||isNaN(V)||isNaN(Z)||isNaN(de))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(F,V,Z,de))},h.prototype.save=function(F){F=typeof F!="boolean"||F;for(var V=this.pdf.internal.getCurrentPageInfo().pageNumber,Z=0;Z<this.pdf.internal.getNumberOfPages();Z++)this.pdf.setPage(Z+1),this.pdf.internal.out("q");if(this.pdf.setPage(V),F){this.ctx.fontSize=this.pdf.internal.getFontSize();var de=new u(this.ctx);this.ctxStack.push(this.ctx),this.ctx=de}},h.prototype.restore=function(F){F=typeof F!="boolean"||F;for(var V=this.pdf.internal.getCurrentPageInfo().pageNumber,Z=0;Z<this.pdf.internal.getNumberOfPages();Z++)this.pdf.setPage(Z+1),this.pdf.internal.out("Q");this.pdf.setPage(V),F&&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)},h.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var f=function(F){var V,Z,de,ve;if(F.isCanvasGradient===!0&&(F=F.getColor()),!F)return{r:0,g:0,b:0,a:0,style:F};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(F))V=0,Z=0,de=0,ve=0;else{var pe=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(F);if(pe!==null)V=parseInt(pe[1]),Z=parseInt(pe[2]),de=parseInt(pe[3]),ve=1;else if((pe=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(F))!==null)V=parseInt(pe[1]),Z=parseInt(pe[2]),de=parseInt(pe[3]),ve=parseFloat(pe[4]);else{if(ve=1,typeof F=="string"&&F.charAt(0)!=="#"){var _e=new Kte(F);F=_e.ok?_e.toHex():"#000000"}F.length===4?(V=F.substring(1,2),V+=V,Z=F.substring(2,3),Z+=Z,de=F.substring(3,4),de+=de):(V=F.substring(1,3),Z=F.substring(3,5),de=F.substring(5,7)),V=parseInt(V,16),Z=parseInt(Z,16),de=parseInt(de,16)}}return{r:V,g:Z,b:de,a:ve,style:F}},m=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},x=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};h.prototype.fillText=function(F,V,Z,de){if(isNaN(V)||isNaN(Z)||typeof F!="string")throw Bn.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to
1150jsPDF.context2d.fillText");if(de=isNaN(de)?void 0:de,!m.call(this)){var ve=$(this.ctx.transform.rotation),pe=this.ctx.transform.scaleX;O.call(this,{text:F,x:V,y:Z,scale:pe,angle:ve,align:this.textAlign,maxWidth:de})}},h.prototype.strokeText=function(F,V,Z,de){if(isNaN(V)||isNaN(Z)||typeof F!="string")throw Bn.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!x.call(this)){de=isNaN(de)?void 0:de;var ve=$(this.ctx.transform.rotation),pe=this.ctx.transform.scaleX;O.call(this,{text:F,x:V,y:Z,scale:pe,renderingMode:"stroke",angle:ve,align:this.textAlign,maxWidth:de})}},h.prototype.measureText=function(F){if(typeof F!="string")throw Bn.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var V=this.pdf,Z=this.pdf.internal.scaleFactor,de=V.internal.getFontSize(),ve=V.getStringUnitWidth(F)*de/V.internal.scaleFactor;return new function(pe){var _e=(pe=pe||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return _e}}),this}({width:ve*=Math.round(96*Z/72*1e4)/1e4})},h.prototype.scale=function(F,V){if(isNaN(F)||isNaN(V))throw Bn.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var Z=new c(F,0,0,V,0,0);this.ctx.transform=this.ctx.transform.multiply(Z)},h.prototype.rotate=function(F){if(isNaN(F))throw Bn.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var V=new c(Math.cos(F),Math.sin(F),-Math.sin(F),Math.cos(F),0,0);this.ctx.transform=this.ctx.transform.multiply(V)},h.prototype.translate=function(F,V){if(isNaN(F)||isNaN(V))throw Bn.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var Z=new c(1,0,0,1,F,V);this.ctx.transform=this.ctx.transform.multiply(Z)},h.prototype.transform=function(F,V,Z,de,ve,pe){if(isNaN(F)||isNaN(V)||isNaN(Z)||isNaN(de)||isNaN(ve)||isNaN(pe))throw Bn.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var _e=new c(F,V,Z,de,ve,pe);this.ctx.transform=this.ctx.transform.multiply(_e)},h.prototype.setTransform=function(F,V,Z,de,ve,pe){F=isNaN(F)?1:F,V=isNaN(V)?0:V,Z=isNaN(Z)?0:Z,de=isNaN(de)?1:de,ve=isNaN(ve)?0:ve,pe=isNaN(pe)?0:pe,this.ctx.transform=new c(F,V,Z,de,ve,pe)};var p=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};h.prototype.drawImage=function(F,V,Z,de,ve,pe,_e,xe,oe){var we=this.pdf.getImageProperties(F),ce=1,De=1,Ue=1,re=1;de!==void 0&&xe!==void 0&&(Ue=xe/de,re=oe/ve,ce=we.width/de*xe/de,De=we.height/ve*oe/ve),pe===void 0&&(pe=V,_e=Z,V=0,Z=0),de!==void 0&&xe===void 0&&(xe=de,oe=ve),de===void 0&&xe===void 0&&(xe=we.width,oe=we.height);var et=this.ctx.transform.decompose(),kt=$(et.rotate.shx),St=new c,Ve=(St=(St=(St=St.multiply(et.translate)).multiply(et.skew)).multiply(et.scale)).applyToRectangle(new l(pe-V*Ue,_e-Z*re,de*ce,ve*De));if(this.autoPaging){for(var he,ye=v.call(this,Ve),Ee=[],Fe=0;Fe<ye.length;Fe+=1)Ee.indexOf(ye[Fe])===-1&&Ee.push(ye[Fe]);b(Ee);for(var tt=Ee[0],qe=Ee[Ee.length-1],st=tt;st<qe+1;st++){this.pdf.setPage(st);var Ct=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],ke=st===1?this.posY+this.margin[0]:this.margin[0],Ie=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],at=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],rt=st===1?0:Ie+(st-2)*at;if(this.ctx.clip_path.length!==0){var Gt=this.path;he=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=y(he,this.posX+this.margin[3],-rt+ke+this.ctx.prevPageLastElemOffset),_.call(this,"fill",!0),this.path=Gt}var gt=JSON.parse(JSON.stringify(Ve));gt=y([gt],this.posX+this.margin[3],-rt+ke+this.ctx.prevPageLastElemOffset)[0];var Zt=(st>tt||st<qe)&&p.call(this);Zt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Ct,at,null).clip().discardPath()),this.pdf.addImage(F,"JPEG",gt.x,gt.
vendor: 10,822 bytes, line 1150
1150y,gt.w,gt.h,null,null,kt),Zt&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(F,"JPEG",Ve.x,Ve.y,Ve.w,Ve.h,null,null,kt)};var v=function(F,V,Z){var de=[];V=V||this.pdf.internal.pageSize.width,Z=Z||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var ve=this.posY+this.ctx.prevPageLastElemOffset;switch(F.type){default:case"mt":case"lt":de.push(Math.floor((F.y+ve)/Z)+1);break;case"arc":de.push(Math.floor((F.y+ve-F.radius)/Z)+1),de.push(Math.floor((F.y+ve+F.radius)/Z)+1);break;case"qct":var pe=q(this.ctx.lastPoint.x,this.ctx.lastPoint.y,F.x1,F.y1,F.x,F.y);de.push(Math.floor((pe.y+ve)/Z)+1),de.push(Math.floor((pe.y+pe.h+ve)/Z)+1);break;case"bct":var _e=ne(this.ctx.lastPoint.x,this.ctx.lastPoint.y,F.x1,F.y1,F.x2,F.y2,F.x,F.y);de.push(Math.floor((_e.y+ve)/Z)+1),de.push(Math.floor((_e.y+_e.h+ve)/Z)+1);break;case"rect":de.push(Math.floor((F.y+ve)/Z)+1),de.push(Math.floor((F.y+F.h+ve)/Z)+1)}for(var xe=0;xe<de.length;xe+=1)for(;this.pdf.internal.getNumberOfPages()<de[xe];)g.call(this);return de},g=function(){var F=this.fillStyle,V=this.strokeStyle,Z=this.font,de=this.lineCap,ve=this.lineWidth,pe=this.lineJoin;this.pdf.addPage(),this.fillStyle=F,this.strokeStyle=V,this.font=Z,this.lineCap=de,this.lineWidth=ve,this.lineJoin=pe},y=function(F,V,Z){for(var de=0;de<F.length;de++)switch(F[de].type){case"bct":F[de].x2+=V,F[de].y2+=Z;case"qct":F[de].x1+=V,F[de].y1+=Z;default:F[de].x+=V,F[de].y+=Z}return F},b=function(F){return F.sort(function(V,Z){return V-Z})},w=function(F,V){var Z=this.fillStyle,de=this.strokeStyle,ve=this.lineCap,pe=this.lineWidth,_e=Math.abs(pe*this.ctx.transform.scaleX),xe=this.lineJoin;if(this.autoPaging){for(var oe,we,ce=JSON.parse(JSON.stringify(this.path)),De=JSON.parse(JSON.stringify(this.path)),Ue=[],re=0;re<De.length;re++)if(De[re].x!==void 0)for(var et=v.call(this,De[re]),kt=0;kt<et.length;kt+=1)Ue.indexOf(et[kt])===-1&&Ue.push(et[kt]);for(var St=0;St<Ue.length;St++)for(;this.pdf.internal.getNumberOfPages()<Ue[St];)g.call(this);b(Ue);for(var Ve=Ue[0],he=Ue[Ue.length-1],ye=Ve;ye<he+1;ye++){this.pdf.setPage(ye),this.fillStyle=Z,this.strokeStyle=de,this.lineCap=ve,this.lineWidth=_e,this.lineJoin=xe;var Ee=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Fe=ye===1?this.posY+this.margin[0]:this.margin[0],tt=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],qe=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],st=ye===1?0:tt+(ye-2)*qe;if(this.ctx.clip_path.length!==0){var Ct=this.path;oe=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=y(oe,this.posX+this.margin[3],-st+Fe+this.ctx.prevPageLastElemOffset),_.call(this,F,!0),this.path=Ct}if(we=JSON.parse(JSON.stringify(ce)),this.path=y(we,this.posX+this.margin[3],-st+Fe+this.ctx.prevPageLastElemOffset),V===!1||ye===0){var ke=(ye>Ve||ye<he)&&p.call(this);ke&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],Ee,qe,null).clip().discardPath()),_.call(this,F,V),ke&&this.pdf.restoreGraphicsState()}this.lineWidth=pe}this.path=ce}else this.lineWidth=_e,_.call(this,F,V),this.lineWidth=pe},_=function(F,V){if((F!=="stroke"||V||!x.call(this))&&(F==="stroke"||V||!m.call(this))){for(var Z,de,ve=[],pe=this.path,_e=0;_e<pe.length;_e++){var xe=pe[_e];switch(xe.type){case"begin":ve.push({begin:!0});break;case"close":ve.push({close:!0});break;case"mt":ve.push({start:xe,deltas:[],abs:[]});break;case"lt":var oe=ve.length;if(pe[_e-1]&&!isNaN(pe[_e-1].x)&&(Z=[xe.x-pe[_e-1].x,xe.y-pe[_e-1].y],oe>0)){for(;oe>=0;oe--)if(ve[oe-1].close!==!0&&ve[oe-1].begin!==!0){ve[oe-1].deltas.push(Z),ve[oe-1].abs.push(xe);break}}break;case"bct":Z=[xe.x1-pe[_e-1].x,xe.y1-pe[_e-1].y,xe.x2-pe[_e-1].x,xe.y2-pe[_e-1].y,xe.x-pe[_e-1].x,xe.y-pe[_e-1].y],ve[ve.length-1].deltas.push(Z);break;case"qct":var we=pe[_e-1].x+2/3*(xe.x1-pe[_e-1].x),ce=pe[_e-1].y+2/3*(xe.y1-pe[_e-1].y),De=xe.x+2/3*(xe.x1-xe.x),Ue=xe.y+2/3*(xe.y1-xe.y),re=xe.x,et=xe.y;Z=[we-pe[_e-1].x,ce-pe[_e-1].y,De-pe[_e-1].x,Ue-pe[_e-1].y,re-pe[_e-1].x,et-pe[_e-1].y],ve[ve.length-1].deltas.push(Z);break;case"arc":ve.push({deltas:[],abs:[],arc:!0}),Array.isArray(ve[ve.length-1].abs)&&ve[ve.length-1].abs.push(xe)}}de=V?null:F==="stroke"?"stroke":"fill";for(var kt=!1,St=0;St<ve.length;St++)if(ve[St].arc)for(var Ve=ve[St].abs,he=0;he<Ve.length;he++){var ye=Ve[he];ye.type==="arc"?N.call(this,ye.x,ye.y,ye.radius,ye.startAngle,ye.endAngle,ye.counterclockwise,void 0,V,!kt):A.call(this,ye.x,ye.y),kt=!0}else if(ve[St].close===!0)this.pdf.internal.out("h"),kt=!1;else if(ve[St].begin!==!0){var Ee=ve[St].start.x,Fe=ve[St].start.y;R.call(this,ve[St].deltas,Ee,Fe),kt=!0}de&&k.call(this,de),V&&I.call(this)}},C=function(F){var V=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,Z=V*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return F-Z;case"top":return F+V-Z;case"hanging":return F+V-2*Z;case"middle":return F+V/2-Z;default:return F}},E=function(F){return F+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};h.prototype.createLinearGradient=function(){var F=function(){};return F.colorStops=[],F.addColorStop=function(V,Z){this.colorStops.push([V,Z])},F.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},F.isCanvasGradient=!0,F},h.prototype.createPattern=function(){return this.createLinearGradient()},h.prototype.createRadialGradient=function(){return this.createLinearGradient()};var N=function(F,V,Z,de,ve,pe,_e,xe,oe){for(var we=z.call(this,Z,de,ve,pe),ce=0;ce<we.length;ce++){var De=we[ce];ce===0&&(oe?P.call(this,De.x1+F,De.y1+V):A.call(this,De.x1+F,De.y1+V)),L.call(this,F,V,De.x2,De.y2,De.x3,De.y3,De.x4,De.y4)}xe?I.call(this):k.call(this,_e)},k=function(F){switch(F){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},I=function(){this.pdf.clip(),this.pdf.discardPath()},P=function(F,V){this.pdf.internal.out(n(F)+" "+s(V)+" m")},O=function(F){var V;switch(F.align){case"right":case"end":V="right";break;case"center":V="center";break;default:V="left"}var Z,de,ve,pe=this.pdf.getTextDimensions(F.text),_e=C.call(this,F.y),xe=E.call(this,_e)-pe.h,oe=this.ctx.transform.applyToPoint(new o(F.x,_e));if(this.autoPaging){var we=this.ctx.transform.decompose(),ce=new c;ce=(ce=(ce=ce.multiply(we.translate)).multiply(we.skew)).multiply(we.scale);for(var De=this.ctx.transform.applyToRectangle(new l(F.x,_e,pe.w,pe.h)),Ue=ce.applyToRectangle(new l(F.x,xe,pe.w,pe.h)),re=v.call(this,Ue),et=[],kt=0;kt<re.length;kt+=1)et.indexOf(re[kt])===-1&&et.push(re[kt]);b(et);for(var St=et[0],Ve=et[et.length-1],he=St;he<Ve+1;he++){this.pdf.setPage(he);var ye=he===1?this.posY+this.margin[0]:this.margin[0],Ee=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Fe=this.pdf.internal.pageSize.height-this.margin[2],tt=Fe-this.margin[0],qe=this.pdf.internal.pageSize.width-this.margin[1],st=qe-this.margin[3],Ct=he===1?0:Ee+(he-2)*tt;if(this.ctx.clip_path.length!==0){var ke=this.path;Z=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=y(Z,this.posX+this.margin[3],-1*Ct+ye),_.call(this,"fill",!0),this.path=ke}var Ie=y([JSON.parse(JSON.stringify(Ue))],this.posX+this.margin[3],-Ct+ye+this.ctx.prevPageLastElemOffset)[0];F.scale>=.01&&(de=this.pdf.internal.getFontSize(),this.pdf.setFontSize(de*F.scale),ve=this.lineWidth,this.lineWidth=ve*F.scale);var at=this.autoPaging!=="text";if(at||Ie.y+Ie.h<=Fe){if(at||Ie.y>=ye&&Ie.x<=qe){var rt=at?F.text:this.pdf.splitTextToSize(F.text,F.maxWidth||qe-Ie.x)[0],Gt=y([JSON.parse(JSON.stringify(De))],this.posX+this.margin[3],-Ct+ye+this.ctx.prevPageLastElemOffset)[0],gt=at&&(he>St||he<Ve)&&p.call(this);gt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],st,tt,null).clip().discardPath()),this.pdf.text(rt,Gt.x,Gt.y,{angle:F.angle,align:V,renderingMode:F.renderingMode}),gt&&this.pdf.restoreGraphicsState()}}else Ie.y<Fe&&(this.ctx.prevPageLastElemOffset+=Fe-Ie.y);F.scale>=.01&&(this.pdf.setFontSize(de),this.lineWidth=ve)}}else F.scale>=.01&&(de=this.pdf.internal.getFontSize(),this.pdf.setFontSize(de*F.scale),ve=this.lineWidth,this.lineWidth=ve*F.scale),this.pdf.text(F.text,oe.x+this.posX,oe.y+this.posY,{angle:F.angle,align:V,renderingMode:F.renderingMode,maxWidth:F.maxWidth}),F.scale>=.01&&(this.pdf.setFontSize(de),this.lineWidth=ve)},A=function(F,V,Z,de){Z=Z||0,de=de||0,this.pdf.internal.out(n(F+Z)+" "+s(V+de)+" l")},R=function(F,V,Z){return this.pdf.lines(F,V,Z,null,null)},L=function(F,V,Z,de,ve,pe,_e,xe){this.pdf.internal.out([t(a(Z+F)),t(i(de+V)),t(a(ve+F)),t(i(pe+V)),t(a(_e+F)),t(i(xe+V)),"c"].join(" "))},z=function(F,V,Z,de){for(var ve=2*Math.PI,pe=Math.PI/2;V>Z;)V-=ve;var _e=Math.abs(Z-V);_e<ve&&de&&(_e=ve-_e);for(var xe=[],oe=de?-1:1,we=V;_e>1e-5;){var ce=we+oe*Math.min(_e,pe);xe.push(U.call(this,F,we,ce)),_e-=Math.abs(ce-we),we=ce}return xe},U=function(F,V,Z){var de=(Z-V)/2,ve=F*Math.cos(de),pe=F*Math.sin(de),_e=ve,xe=-pe,oe=_e*_e+xe*xe,we=oe+_e*ve+xe*pe,ce=4/3*(Math.sqrt(2*oe*we)-we)/(_e*pe-xe*ve),De=_e-ce*xe,Ue=xe+ce*_e,re=De,et=-Ue,kt=de+V,St=Math.cos(kt),Ve=Math.sin(kt);return{x1:F*Math.cos(V),y1:F*Math.sin(V),x2:De*St-Ue*Ve,y2:De*Ve+Ue*St,x3:re*St-et*Ve,y3:re*Ve+et*St,x4:F*Math.cos(Z),y4:F*Math.sin(Z)}},$=function(F){return 180*F/Math.PI},q=function(F,V,Z,de,ve,pe){var _e=F+.5*(Z-F),xe=V+.5*(de-V),oe=ve+.5*(Z-ve),we=pe+.5*(de-pe),ce=Math.min(F,ve,_e,oe),De=Math.max(F,ve,_e,oe),Ue=Math.min(V,pe,xe,we),re=Math.max(V,pe,xe,we);return new l(ce,Ue,De-ce,re-Ue)},ne=function(F,V,Z,de,ve,pe,_e,xe){var oe,we,ce,De,Ue,re,et,kt,St,Ve,he,ye,Ee,Fe,tt=Z-F,qe=de-V,st=ve-Z,Ct=pe-de,ke=_e-ve,Ie=xe-pe;for(we=0;we<41;we++)St=(et=(ce=F+(oe=we/40)*tt)+oe*((Ue=Z+oe*st)-ce))+oe*(Ue+oe*(ve+oe*ke-Ue)-et),Ve=(kt=(De=V+oe*qe)+oe*((re=de+oe*Ct)-De))+oe*(re+oe*(pe+oe*Ie-re)-kt),we==0?(he=St,ye=Ve,Ee=St,Fe=Ve):(he=Math.min(he,St),ye=Math.min(ye,Ve),Ee=Math.max(Ee,St),Fe=Math.max(Fe,Ve));return new l(Math.round(he),Math.round(ye),Math.round(Ee-he),Math.round(Fe-ye))},se=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var F,V,Z=(F=this.ctx.lineDash,V=this.ctx.lineDashOffset,JSON.stringify({lineDash:F,lineDashOffset:V}));this.prevLineDash!==Z&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=Z)}}})(ar.API),function(e){var t=function(o){var l,c,d,u,h,f,m,x,p,v;for(c=[],d=0,u=(o+=l="\0\0\0\0".slice(o.length%4||4)).length;u>d;d+=4)(h=(o.charCodeAt(d)<<24)+(o.charCodeAt(d+1)<<16)+(o.charCodeAt(d+2)<<8)+o.charCodeAt(d+3))!==0?(f=(h=((h=((h=((h=(h-(v=h%85))/85)-(p=h%85))/85)-(x=h%85))/85)-(m=h%85))/85)%85,c.push(f+33,m+33,x+33,p+33,v+33)):c.push(122);return function(g,y){for(var b=y;b>0;b--)g.pop()}(c,l.length),String.fromCharCode.apply(String,c)+"~>"},n=function(o){var l,c,d,u,h,f=String,m="length",x=255,p="charCo
1150deAt",v="slice",g="replace";for(o[v](-2),o=o[v](0,-2)[g](/\s/g,"")[g]("z","!!!!!"),d=[],u=0,h=(o+=l="uuuuu"[v](o[m]%5||5))[m];h>u;u+=5)c=52200625*(o[p](u)-33)+614125*(o[p](u+1)-33)+7225*(o[p](u+2)-33)+85*(o[p](u+3)-33)+(o[p](u+4)-33),d.push(x&c>>24,x&c>>16,x&c>>8,x&c);return function(y,b){for(var w=b;w>0;w--)y.pop()}(d,l[m]),f.fromCharCode.apply(f,d)},s=function(o){return o.split("").map(function(l){return("0"+l.charCodeAt().toString(16)).slice(-2)}).join("")+">"},a=function(o){var l=new RegExp(/^([0-9A-Fa-f]{2})+$/);if((o=o.replace(/\s/g,"")).indexOf(">")!==-1&&(o=o.substr(0,o.indexOf(">"))),o.length%2&&(o+="0"),l.test(o)===!1)return"";for(var c="",d=0;d<o.length;d+=2)c+=String.fromCharCode("0x"+(o[d]+o[d+1]));return c},i=function(o){for(var l=new Uint8Array(o.length),c=o.length;c--;)l[c]=o.charCodeAt(c);return(l=pE(l)).reduce(function(d,u){return d+String.fromCharCode(u)},"")};e.processDataByFilters=function(o,l){var c=0,d=o||"",u=[];for(typeof(l=l||[])=="string"&&(l=[l]),c=0;c<l.length;c+=1)switch(l[c]){case"ASCII85Decode":case"/ASCII85Decode":d=n(d),u.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":d=t(d),u.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":d=a(d),u.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":d=s(d),u.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":d=i(d),u.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[c]+'" is not implemented')}return{data:d,reverseChain:u.reverse().join(" ")}}}(ar.API),function(e){e.loadFile=function(t,n,s){return function(a,i,o){i=i!==!1,o=typeof o=="function"?o:function(){};var l=void 0;try{l=function(c,d,u){var h=new XMLHttpRequest,f=0,m=function(x){var p=x.length,v=[],g=String.fromCharCode;for(f=0;f<p;f+=1)v.push(g(255&x.charCodeAt(f)));return v.join("")};if(h.open("GET",c,!d),h.overrideMimeType("text/plain; charset=x-user-defined"),d===!1&&(h.onload=function(){h.status===200?u(m(this.responseText)):u(void 0)}),h.send(null),d&&h.status===200)return m(h.responseText)}(a,i,o)}catch{}return l}(t,n,s)},e.allowFsRead=void 0,e.loadImageFile=e.loadFile}(ar.API),function(e){function t(){return(jr.html2canvas?Promise.resolve(jr.html2canvas):Vc(()=>import("./html2canvas.esm-CBrSDip1.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load html2canvas: "+l))}).then(function(l){return l.default?l.default:l})}function n(){return(jr.DOMPurify?Promise.resolve(jr.DOMPurify):Vc(()=>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 s=function(l){var c=En(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"},a=function(l,c){var d=document.createElement(l);for(var u in c.className&&(d.className=c.className),c.innerHTML&&c.dompurify&&(d.innerHTML=c.dompurify.sanitize(c.innerHTML)),c.style)d.style[u]=c.style[u];return d},i=function l(c,d){for(var u=c.nodeType===3?document.createTextNode(c.nodeValue):c.cloneNode(!1),h=c.firstChild;h;h=h.nextSibling)d!==!0&&h.nodeType===1&&h.nodeName==="SCRIPT"||u.appendChild(l(h,d));return c.nodeType===1&&(c.nodeName==="CANVAS"?(u.width=c.width,u.height=c.height,u.getContext("2d").drawImage(c,0,0)):c.nodeName!=="TEXTAREA"&&c.nodeName!=="SELECT"||(u.value=c.value),u.addEventListener("load",function(){u.scrollTop=c.scrollTop,u.scrollLeft=c.scrollLeft},!0)),u},o=function l(c){var d=Object.assign(l.convert(Promise.resolve()),JSON.parse(JSON.stringify(l.template))),u=l.convert(Promise.resolve(),d);return(u=u.setProgress(1,l,1,[l])).set(c)};(o.prototype=Object.create(Promise.prototype)).constructor=o,o.convert=function(l,c){return l.__proto__=c||o.prototype,l},o.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"}},o.prototype.from=function(l,c){return this.then(function(){switch(c=c||function(d){switch(s(d)){case"string":return"string";case"element":return d.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}}(l),c){case"string":return this.then(n).then(function(d){return this.set({src:a("div",{innerHTML:l,dompurify:d})})});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.")}})},o.prototype.to=function(l){switch(l){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();
vendor: 24,007 bytes, lines 1150-1156
1150case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},o.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=i(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=a("div",{className:"html2pdf__overlay",style:{position:"fixed",overflow:"hidden",zIndex:1e3,left:"-100000px",right:0,bottom:0,top:0}}),this.prop.container=a("div",{className:"html2pdf__container",style:l}),this.prop.container.appendChild(c),this.prop.container.firstChild.appendChild(a("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"})},o.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 d=Object.assign({},this.opt.html2canvas);return delete d.onrendered,c(this.prop.container,d)}).then(function(c){(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},o.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 d=this.opt.jsPDF,u=this.opt.fontFaces,h=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,f=Object.assign({async:!0,allowTaint:!0,scale:h,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 f.onrendered,d.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,d.context2d.posX=this.opt.x,d.context2d.posY=this.opt.y,d.context2d.margin=this.opt.margin,d.context2d.fontFaces=u,u)for(var m=0;m<u.length;++m){var x=u[m],p=x.src.find(function(v){return v.format==="truetype"});p&&d.addFont(p.url,x.ref.name,x.ref.style)}return f.windowHeight=f.windowHeight||0,f.windowHeight=f.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):f.windowHeight,d.context2d.save(!0),c(this.prop.container,f)}).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)})},o.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})},o.prototype.toPdf=function(){return this.thenList([function(){return this.toContext2d()}]).then(function(){this.prop.pdf=this.prop.pdf||this.opt.jsPDF})},o.prototype.output=function(l,c,d){return(d=d||"pdf").toLowerCase()==="img"||d.toLowerCase()==="image"?this.outputImg(l,c):this.outputPdf(l,c)},o.prototype.outputPdf=function(l,c){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){return this.prop.pdf.output(l,c)})},o.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.'}})},o.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)})},o.prototype.doCallback=function(){return this.thenList([function(){return this.prop.pdf||this.toPdf()}]).then(function(){this.prop.callback(this.prop.pdf)})},o.prototype.set=function(l){if(s(l)!=="object")return this;var c=Object.keys(l||{}).map(function(d){if(d in o.template.prop)return function(){this.prop[d]=l[d]};switch(d){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[d]=l[d]}}},this);return this.then(function(){return this.thenList(c)})},o.prototype.get=function(l,c){return this.then(function(){var d=l in o.template.prop?this.prop[l]:this.opt[l];return c?c(d):d})},o.prototype.setMargin=function(l){return this.then(function(){switch(s(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)},o.prototype.setPageSize=function(l){function c(d,u){return Math.floor(d*u/72*96)}return this.then(function(){(l=l||ar.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})},o.prototype.setProgress=function(l,c,d,u){return l!=null&&(this.progress.val=l),c!=null&&(this.progress.state=c),d!=null&&(this.progress.n=d),u!=null&&(this.progress.stack=u),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(l,c,d,u){return this.setProgress(l?this.progress.val+l:null,c||null,d?this.progress.n+d:null,u?this.progress.stack.concat(u):null)},o.prototype.then=function(l,c){var d=this;return this.thenCore(l,c,function(u,h){return d.updateProgress(null,null,1,[u]),Promise.prototype.then.call(this,function(f){return d.updateProgress(null,u),f}).then(u,h).then(function(f){return d.updateProgress(1),f})})},o.prototype.thenCore=function(l,c,d){d=d||Promise.prototype.then;var u=this;l&&(l=l.bind(u)),c&&(c=c.bind(u));var h=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?u:o.convert(Object.assign({},u),Promise.prototype),f=d.call(h,l,c);return o.convert(f,u.__proto__)},o.prototype.thenExternal=function(l,c){return Promise.prototype.then.call(this,l,c)},o.prototype.thenList=function(l){var c=this;return l.forEach(function(d){c=c.thenCore(d)}),c},o.prototype.catch=function(l){l&&(l=l.bind(this));var c=Promise.prototype.catch.call(this,l);return o.convert(c,this)},o.prototype.catchExternal=function(l){return Promise.prototype.catch.call(this,l)},o.prototype.error=function(l){return this.then(function(){throw new Error(l)})},o.prototype.using=o.prototype.set,o.prototype.saveAs=o.prototype.save,o.prototype.export=o.prototype.output,o.prototype.run=o.prototype.then,ar.getPageSize=function(l,c,d){if(En(l)==="object"){var u=l;l=u.orientation,c=u.unit||c,d=u.format||d}c=c||"mm",d=d||"a4",l=(""+(l||"P")).toLowerCase();var h,f=(""+d).toLowerCase(),m={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":h=1;break;case"mm":h=72/25.4;break;case"cm":h=72/2.54;break;case"in":h=72;break;case"px":h=.75;break;case"pc":case"em":h=12;break;case"ex":h=6;break;default:throw"Invalid unit: "+c}var x,p=0,v=0;if(m.hasOwnProperty(f))p=m[f][1]/h,v=m[f][0]/h;else try{p=d[1],v=d[0]}catch{throw new Error("Invalid format: "+d)}if(l==="p"||l==="portrait")l="p",v>p&&(x=v,v=p,p=x);else{if(l!=="l"&&l!=="landscape")throw"Invalid orientation: "+l;l="l",p>v&&(x=v,v=p,p=x)}return{width:v,height:p,unit:c,k:h,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(AC):null;var d=new o(c);return c.worker?d:d.from(l).doCallback()}}(ar.API),ar.API.addJS=function(e){var t,n,s=function(a){for(var i="",o=0;o<a.length;o++){var l=a[o];if(l==="("||l===")"){for(var c=0,d=o-1;d>=0&&a[d]==="\\";d--)c++;i+=c%2==0?"\\"+l:l}else i+=l}return i}(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"),n=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+s+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){t!==void 0&&n!==void 0&&this.internal.out("/Names <</JavaScript "+t+" 0 R>>")}),this},function(e){var t;e.events.push(["postPutResources",function(){var n=this,s=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var a=n.outline.render().split(/\r\n/),i=0;i<a.length;i++){var o=a[i],l=s.exec(o);if(l!=null){var c=l[1];n.internal.newObjectDeferredBegin(c,!1)}n.internal.write(o)}if(this.outline.createNamedDestinations){var d=this.internal.pages.length,u=[];for(i=0;i<d;i++){var h=n.internal.newObject();u.push(h);var f=n.internal.getPageInfo(i+1);n.internal.write("<< /D["+f.objId+" 0 R /XYZ null null null]>> endobj")}var m=n.internal.newObject();for(n.internal.write("<< /Names [ "),i=0;i<u.length;i++)n.internal.write("(page_"+(i+1)+")"+u[i]+" 0 R");n.internal.write(" ] >>","endobj"),t=n.internal.newObject(),n.internal.write("<< /Dests "+m+" 0 R"),n.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var n=this;n.outline.root.children.length>0&&(n.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&n.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var n=this;n.outline={createNamedDestinations:!1,root:{children:[]}},n.outline.add=function(s,a,i){var o={title:a,options:i,children:[]};return s==null&&(s=this.root),s.children.push(o),o},n.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=n,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},n.outline.genIds_r=function(s){s.id=n.internal.newObjectDeferred();for(var a=0;a<s.children.length;a++)this.genIds_r(s.children[a])},n.outline.renderRoot=function(s){this.objStart(s),this.line("/Type /Outlines"),s.children.length>0&&(this.line("/First "+this.makeRef(s.children[0])),this.line("/Last "+this.makeRef(s.children[s.children.length-1]))),this.line("/Count "+this.count_r({count:0},s)),this.objEnd()},n.outline.renderItems=function(s){for(var a=this.ctx.pdf.internal.getVerticalCoordinateString,i=0;i<s.children.length;i++){var o=s.children[i];this.objStart(o),this.line("/Title "+this.makeString(o.title)),this.line("/Parent "+this.makeRef(s)),i>0&&this.line("/Prev "+this.makeRef(s.children[i-1])),i<s.children.length-1&&this.line("/Next "+this.makeRef(s.children[i+1])),o.children.length>0&&(this.line("/First "+this.makeRef(o.children[0])),this.line("/Last "+this.makeRef(o.children[o.children.length-1])));var l=this.count=this.count_r({count:0},o);if(l>0&&this.line("/Count "+l),o.options&&o.options.pageNumber){var c=n.internal.getPageInfo(o.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+a(0)+" 0]")}this.objEnd()}for(var d=0;d<s.children.length;d++)this.renderItems(s.children[d])},n.outline.line=function(s){this.ctx.val+=s+`\r 1151`},n.outline.makeRef=function(s){return s.id+" 0 R"},n.outline.makeString=function(s){return"("+n.internal.pdfEscape(s)+")"},n.outline.objStart=function(s){this.ctx.val+=`\r 1152`+s.id+` 0 obj\r 1153<<\r 1154`},n.outline.objEnd=function(){this.ctx.val+=`>> \r 1155endobj\r 1156`},n.outline.count_r=function(s,a){for(var i=0;i<a.children.length;i++)s.count++,this.count_r(s,a.children[i]);return s.count}}])}(ar.API),function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(n,s,a,i,o,l){var c,d=this.decode.DCT_DECODE,u=null;if(typeof n=="string"||this.__addimage__.isArrayBuffer(n)||this.__addimage__.isArrayBufferView(n)){switch(n=o||n,n=this.__addimage__.isArrayBuffer(n)?new Uint8Array(n):n,c=function(h){for(var f,m=256*h.charCodeAt(4)+h.charCodeAt(5),x=h.length,p={width:0,height:0,numcomponents:1},v=4;v<x;v+=2){if(v+=m,t.indexOf(h.charCodeAt(v+1))!==-1){f=256*h.charCodeAt(v+5)+h.charCodeAt(v+6),p={width:256*h.charCodeAt(v+7)+h.charCodeAt(v+8),height:f,numcomponents:h.charCodeAt(v+9)};break}m=256*h.charCodeAt(v+2)+h.charCodeAt(v+3)}return p}(n=this.__addimage__.isArrayBufferView(n)?this.__addimage__.arrayBufferToBinaryString(n):n),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}u={data:n,width:c.width,height:c.height,colorSpace:l,bitsPerComponent:8,filter:d,index:s,alias:a}}return u}}(ar.API),ar.API.processPNG=function(e,t,n,s){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var a,i=BXe(e,{checkCrc:!0}),o=i.width,l=i.height,c=i.channels,d=i.palette,u=i.depth;a=d&&c===1?function(N){for(var k=N.width,I=N.height,P=N.data,O=N.palette,A=N.depth,R=!1,L=[],z=[],U=void 0,$=!1,q=0,ne=0;ne<O.length;ne++){var se=jB(O[ne],4),F=se[0],V=se[1],Z=se[2],de=se[3];L.push(F,V,Z),de!=null&&(de===0?(q++,z.length<1&&z.push(ne)):de<255&&($=!0))}if($||q>1){R=!0,z=void 0;var ve=k*I;U=new Uint8Array(ve);for(var pe=new DataView(P.buffer),_e=0;_e<ve;_e++){var xe=EC(pe,_e,A),oe=jB(O[xe],4)[3];U[_e]=oe}}else q===0&&(z=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:R?8:void 0,colorBytes:P,alphaBytes:U,needSMask:R,palette:L,mask:z}}(i):c===2||c===4?function(N){for(var k=N.data,I=N.width,P=N.height,O=N.channels,A=N.depth,R=O===2?"DeviceGray":"DeviceRGB",L=O-1,z=I*P,U=L,$=z*U,q=1*z,ne=Math.ceil($*A/8),se=Math.ceil(q*A/8),F=new Uint8Array(ne),V=new Uint8Array(se),Z=new DataView(k.buffer),de=new DataView(F.buffer),ve=new DataView(V.buffer),pe=!1,_e=0;_e<z;_e++){for(var xe=_e*O,oe=0;oe<U;oe++)I9(de,EC(Z,xe+oe,A),_e*U+oe,A);var we=EC(Z,xe+U,A);we<(1<<A)-1&&(pe=!0),I9(ve,we,1*_e,A)}return{colorSpace:R,colorsPerPixel:L,sMaskBitsPerComponent:pe?A:void 0,colorBytes:F,alphaBytes:V,needSMask:pe}}(i):function(N){var k=N.data,I=N.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:I,colorsPerPixel:I==="DeviceGray"?1:3,colorBytes:k instanceof Uint16Array?function(P){for(var O=P.length,A=new Uint8Array(2*O),R=new DataView(A.buffer,A.byteOffset,A.byteLength),L=0;L<O;L++)R.setUint16(2*L,P[L],!1);return A}(k):k,needSMask:!1}}(i);var h,f,m,x=a,p=x.colorSpace,v=x.colorsPerPixel,g=x.sMaskBitsPerComponent,y=x.colorBytes,b=x.alphaBytes,w=x.needSMask,_=x.palette,C=x.mask,E=null;return s!==ar.API.image_compression.NONE&&typeof pE=="function"?(E=function(N){var k;switch(N){case ar.API.image_compression.FAST:k=11;break;case ar.API.image_compression.MEDIUM:k=13;break;case ar.API.image_compression.SLOW:k=14;break;default:k=12}return k}(s),h=this.decode.FLATE_DECODE,f="/Predictor ".concat(E," /Colors ").concat(v," /BitsPerComponent ").concat(u," /Columns ").concat(o),e=P9(y,Math.ceil(o*v*u/8),v,u,s),w&&(m=P9(b,Math.ceil(o*g/8),1,g,s))):(h=void 0,f=void 0,e=y,w&&(m=b)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(m&&this.__addimage__.isArrayBuffer(m)||this.__addimage__.isArrayBufferView(m))&&(m=this.__addimage__.arrayBufferToBinaryString(m)),{alias:n,data:e,index:t,filter:h,decodeParameters:f,transparency:C,palette:_,sMask:m,predictor:E,width:o,height:l,bitsPerComponent:u,sMaskBitsPerComponent:g,colorSpace:p}}},function(e){e.processGIF89A=function(t,n,s,a){var i=new oZe(t),o=i.width,l=i.height,c=[];i.decodeAndBlitFrameRGBA(0,c);var d={data:c,width:o,height:l},u=new TC(100).encode(d,100);return e.processJPEG.call(this,u,n,s,a)},e.processGIF87A=e.processGIF89A}(ar.API),Tl.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 n=this.datav.getUint8(this.pos++,!0),s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:a,green:s,blue:n,quad:i}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},Tl.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(n){Bn.log("bit decode error:"+n)}},Tl.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),n=t%4;for(e=this.height-1;e>=0;e--){for(var s=this.bottom_up?e:this.height-1-e,a=0;a<t;a++)for(var i=this.datav.getUint8(this.pos++,!0),o=s*this.width*4+8*a*4,l=0;l<8&&8*a+l<this.width;l++){var c=this.palette[i>>7-l&1];this.data[o+4*l]=c.blue,this.data[o+4*l+1]=c.green,this.data[o+4*l+2]=c.red,this.data[o+4*l+3]=255}n!==0&&(this.pos+=4-n)}},Tl.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,n=this.height-1;n>=0;n--){for(var s=this.bottom_up?n:this.height-1-n,a=0;a<e;a++){var i=this.datav.getUint8(this.pos++,!0),o=s*this.width*4+2*a*4,l=i>>4,c=15&i,d=this.palette[l];if(this.data[o]=d.blue,this.data[o+1]=d.green,this.data[o+2]=d.red,this.data[o+3]=255,2*a+1>=this.width)break;d=this.palette[c],this.data[o+4]=d.blue,this.data[o+4+1]=d.green,this.data[o+4+2]=d.red,this.data[o+4+3]=255}t!==0&&(this.pos+=4-t)}},Tl.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var n=this.bottom_up?t:this.height-1-t,s=0;s<this.width;s++){var a=this.datav.getUint8(this.pos++,!0),i=n*this.width*4+4*s;if(a<this.palette.length){var o=this.palette[a];this.data[i]=o.red,this.data[i+1]=o.green,this.data[i+2]=o.blue,this.data[i+3]=255}else this.data[i]=255,this.data[i+1]=255,this.data[i+2]=255,this.data[i+3]=255}e!==0&&(this.pos+=4-e)}},Tl.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),n=this.height-1;n>=0;n--){for(var s=this.bottom_up?n:this.height-1-n,a=0;a<this.width;a++){var i=this.datav.getUint16(this.pos,!0);this.pos+=2;var o=(i&t)/t*255|0,l=(i>>5&t)/t*255|0,c=(i>>10&t)/t*255|0,d=i>>15?255:0,u=s*this.width*4+4*a;this.data[u]=c,this.data[u+1]=l,this.data[u+2]=o,this.data[u+3]=d}this.pos+=e}},Tl.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),n=parseInt("111111",2),s=this.height-1;s>=0;s--){for(var a=this.bottom_up?s:this.height-1-s,i=0;i<this.width;i++){var o=this.datav.getUint16(this.pos,!0);this.pos+=2;var l=(o&t)/t*255|0,c=(o>>5&n)/n*255|0,d=(o>>11)/t*255|0,u=a*this.width*4+4*i;this.data[u]=d,this.data[u+1]=c,this.data[u+2]=l,this.data[u+3]=255}this.pos+=e}},Tl.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=t*this.width*4+4*n;this.data[o]=i,this.data[o+1]=a,this.data[o+2]=s,this.data[o+3]=255}this.pos+=this.width%4}},Tl.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,n=0;n<this.width;n++){var s=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=this.datav.getUint8(this.pos++,!0),l=t*this.width*4+4*n;this.data[l]=i,this.data[l+1]=a,this.data[l+2]=s,this.data[l+3]=o}},Tl.prototype.getData=function(){return this.data},function(e){e.processBMP=function(t,n,s,a){var i=new Tl(t,!1),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},d=new TC(100).encode(c,100);return e.processJPEG.call(this,d,n,s,a)}}(ar.API),M9.prototype.getData=function(){return this.data},function(e){e.processWEBP=function(t,n,s,a){var i=new M9(t),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},d=new TC(100).encode(c,100);return e.processJPEG.call(this,d,n,s,a)}}(ar.API),ar.API.processRGBA=function(e,t,n){for(var s=e.data,a=s.length,i=new Uint8Array(a/4*3),o=new Uint8Array(a/4),l=0,c=0,d=0;d<a;d+=4){var u=s[d],h=s[d+1],f=s[d+2],m=s[d+3];i[l++]=u,i[l++]=h,i[l++]=f,o[c++]=m}var x=this.__addimage__.arrayBufferToBinaryString(i);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:x,index:t,alias:n,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},ar.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 (Canad
1156a)","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},Yp=ar.API,D1=Yp.getCharWidthsArray=function(e,t){var n,s,a=(t=t||{}).font||this.internal.getFont(),i=t.fontSize||this.internal.getFontSize(),o=t.charSpace||this.internal.getCharSpace(),l=t.widths?t.widths:a.metadata.Unicode.widths,c=l.fof?l.fof:1,d=t.kerning?t.kerning:a.metadata.Unicode.kerning,u=d.fof?d.fof:1,h=t.doKerning!==!1,f=0,m=e.length,x=0,p=l[0]||c,v=[];for(n=0;n<m;n++)s=e.charCodeAt(n),typeof a.metadata.widthOfString=="function"?v.push((a.metadata.widthOfGlyph(a.metadata.characterToGlyph(s))+o*(1e3/i)||0)/1e3):(f=h&&En(d[s])==="object"&&!isNaN(parseInt(d[s][x],10))?d[s][x]/u:0,v.push((l[s]||p)/c+f)),x=s;return v},k9=Yp.getStringUnitWidth=function(e,t){var n=(t=t||{}).fontSize||this.internal.getFontSize(),s=t.font||this.internal.getFont(),a=t.charSpace||this.internal.getCharSpace();return Yp.processArabic&&(e=Yp.processArabic(e)),typeof s.metadata.widthOfString=="function"?s.metadata.widthOfString(e,n,a)/n:D1.apply(this,arguments).reduce(function(i,o){return i+o},0)},C9=function(e,t,n,s){for(var a=[],i=0,o=e.length,l=0;i!==o&&l+t[i]<n;)l+=t[i],i++;a.push(e.slice(0,i));var c=i;for(l=0;i!==o;)l+t[i]>s&&(a.push(e.slice(c,i)),l=0,c=i),l+=t[i],i++;return c!==i&&a.push(e.slice(c,i)),a},A9=function(e,t,n){n||(n={});var s,a,i,o,l,c,d,u=[],h=[u],f=n.textIndent||0,m=0,x=0,p=e.split(" "),v=D1.apply(this,[" ",n])[0];if(c=n.lineIndent===-1?p[0].length+2:n.lineIndent||0){var g=Array(c).join(" "),y=[];p.map(function(w){(w=w.split(/\s*\n/)).length>1?y=y.concat(w.map(function(_,C){return(C&&_.length?` 1157`:"")+_})):y.push(w[0])}),p=y,c=k9.apply(this,[g,n])}for(i=0,o=p.length;i<o;i++){var b=0;if(s=p[i],c&&s[0]==` 1158`&&(s=s.substr(1),b=1),f+m+(x=(a=D1.apply(this,[s,n])).reduce(function(w,_){return w+_},0))>t||b){if(x>t){for(l=C9.apply(this,[s,a,t-(f+m),t]),u.push(l.shift()),u=[l.pop()];l.length;)h.push([l.shift()]);x=a.slice(s.length-(u[0]?u[0].length:0)).reduce(function(w,_){return w+_},0)}else u=[s];h.push(u),f=x+c,m=v}else u.push(s),f+=m+x,m=v}return d=c?function(w,_){return(_?g:"")+w.join(" ")}:function(w){return w.join(" ")},h.map(d)},Yp.splitTextToSize=function(e,t,n){var s,a=(n=n||{}).fontSize||this.internal.getFontSize(),i=(function(u){if(u.widths&&u.kerning)return{widths:u.widths,kerning:u.kerning};var h=this.internal.getFont(u.fontName,u.fontStyle),f="Unicode";return h.metadata[f]?{widths:h.metadata[f].widths||{0:1},kerning:h.metadata[f].kerning||{}}:{font:h.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,n);s=Array.isArray(e)?e:String(e).split(/\r?\n/);var o=1*this.internal.scaleFactor*t/a;i.textIndent=n.textIndent?1*n.textIndent*this.internal.scaleFactor/a:0,i.lineIndent=n.lineIndent;var l,c,d=[];for(l=0,c=s.length;l<c;l++)d=d.concat(A9.apply(this,[s[l],o,i]));return d},function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",n="klmnopqrstuvwxyz",s={},a={},i=0;i<16;i++)s[n[i]]=t[i],a[t[i]]=n[i];var o=function(f){return"0x"+parseInt(f,10).toString(16)},l=e.__fontmetrics__.compress=function(f){var m,x,p,v,g=["{"];for(var y in f){if(m=f[y],isNaN(parseInt(y,10))?x="'"+y+"'":(y=parseInt(y,10),x=(x=o(y).slice(2)).slice(0,-1)+a[x.slice(-1)]),typeof m=="number")m<0?(p=o(m).slice(3),v="-"):(p=o(m).slice(2),v=""),p=v+p.slice(0,-1)+a[p.slice(-1)];
vendor: 1,089 bytes, line 1158
1158else{if(En(m)!=="object")throw new Error("Don't know what to do with value type "+En(m)+".");p=l(m)}g.push(x+p)}return g.push("}"),g.join("")},c=e.__fontmetrics__.uncompress=function(f){if(typeof f!="string")throw new Error("Invalid argument passed to uncompress.");for(var m,x,p,v,g={},y=1,b=g,w=[],_="",C="",E=f.length-1,N=1;N<E;N+=1)(v=f[N])=="'"?m?(p=m.join(""),m=void 0):m=[]:m?m.push(v):v=="{"?(w.push([b,p]),b={},p=void 0):v=="}"?((x=w.pop())[0][x[1]]=b,p=void 0,b=x[0]):v=="-"?y=-1:p===void 0?s.hasOwnProperty(v)?(_+=s[v],p=parseInt(_,16)*y,y=1,_=""):_+=v:s.hasOwnProperty(v)?(C+=s[v],b[p]=parseInt(C,16)*y,y=1,p=void 0,C=""):C+=v;return g},d={codePages:["WinAnsiEncoding"],WinAnsiEncoding:c("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},u={Unicode:{Courier:d,"Courier-Bold":d,"Courier-BoldOblique":d,"Courier-Oblique":d,Helvetica:d,"Helvetica-Bold":d,"Helvetica-BoldOblique":d,"Helvetica-Oblique":d,"Times-Roman":d,"Times-Bold":d,"Times-BoldItalic":d,"Times-Italic":d
vendor: 14,731 bytes, line 1158
1158}},h={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(
vendor: 47,219 bytes, lines 1158-1187
1158f){var m=f.font,x=h.Unicode[m.postScriptName];x&&(m.metadata.Unicode={},m.metadata.Unicode.widths=x.widths,m.metadata.Unicode.kerning=x.kerning);var p=u.Unicode[m.postScriptName];p&&(m.metadata.Unicode.encoding=p,m.encoding=p.codePages[0])}])}(ar.API),function(e){var t=function(n){for(var s=n.length,a=new Uint8Array(s),i=0;i<s;i++)a[i]=n.charCodeAt(i);return a};e.API.events.push(["addFont",function(n){var s=void 0,a=n.font,i=n.instance;if(!a.isStandardFont){if(i===void 0)throw new Error("Font does not exist in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");if(typeof(s=i.existsFileInVFS(a.postScriptName)===!1?i.loadFile(a.postScriptName):i.getFileFromVFS(a.postScriptName))!="string")throw new Error("Font is not stored as string-data in vFS, import fonts or remove declaration doc.addFont('"+a.postScriptName+"').");(function(o,l){l=/^\x00\x01\x00\x00/.test(l)?t(l):t(cN(l)),o.metadata=e.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(a,s)}}])}(ar),ar.API.addSvgAsImage=function(e,t,n,s,a,i,o,l){if(isNaN(t)||isNaN(n))throw Bn.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(s)||isNaN(a))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=s,c.height=a;var d=c.getContext("2d");d.fillStyle="#fff",d.fillRect(0,0,c.width,c.height);var u={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},h=this;return(jr.canvg?Promise.resolve(jr.canvg):Vc(()=>import("./index.es-UuDk-W4U.js"),[])).catch(function(f){return Promise.reject(new Error("Could not load canvg: "+f))}).then(function(f){return f.default?f.default:f}).then(function(f){return f.fromString(d,e,u)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(f){return f.render(u)}).then(function(){h.addImage(c.toDataURL("image/jpeg",1),t,n,s,a,o,l)})},ar.API.putTotalPages=function(e){var t,n=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),n=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),n=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var s=1;s<=this.internal.getNumberOfPages();s++)for(var a=0;a<this.internal.pages[s].length;a++)this.internal.pages[s][a]=this.internal.pages[s][a].replace(t,n);return this},ar.API.viewerPreferences=function(e,t){var n;e=e||{},t=t||!1;var s,a,i,o={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(o),c=[],d=0,u=0,h=0;function f(x,p){var v,g=!1;for(v=0;v<x.length;v+=1)x[v]===p&&(g=!0);return g}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),n=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var m=l.length;for(h=0;h<m;h+=1)n[l[h]].value=n[l[h]].defaultValue,n[l[h]].explicitSet=!1}if(En(e)==="object"){for(a in e)if(i=e[a],f(l,a)&&i!==void 0){if(n[a].type==="boolean"&&typeof i=="boolean")n[a].value=i;else if(n[a].type==="name"&&f(n[a].valueSet,i))n[a].value=i;else if(n[a].type==="integer"&&Number.isInteger(i))n[a].value=i;else if(n[a].type==="array"){for(d=0;d<i.length;d+=1)if(s=!0,i[d].length===1&&typeof i[d][0]=="number")c.push(String(i[d]-1));else if(i[d].length>1){for(u=0;u<i[d].length;u+=1)typeof i[d][u]!="number"&&(s=!1);s===!0&&c.push([i[d][0]-1,i[d][1]-1].join(" "))}n[a].value="["+c.join(" ")+"]"}else n[a].value=n[a].defaultValue;n[a].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var x,p=[];for(x in n)n[x].explicitSet===!0&&(n[x].type==="name"?p.push("/"+x+" /"+n[x].value):p.push("/"+x+" "+n[x].value));p.length!==0&&this.internal.write(`/ViewerPreferences 1159<< 1160`+p.join(` 1161`)+` 1162>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=n,this},ar.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",cZe),this.internal.events.subscribe("postPutResources",lZe)),this},function(e){var t=e.API,n=t.pdfEscape16=function(i,o){for(var l,c=o.metadata.Unicode.widths,d=["","0","00","000","0000"],u=[""],h=0,f=i.length;h<f;++h){if(l=o.metadata.characterToGlyph(i.charCodeAt(h)),o.metadata.glyIdsUsed.push(l),o.metadata.toUnicode[l]=i.charCodeAt(h),c.indexOf(l)==-1&&(c.push(l),c.push([parseInt(o.metadata.widthOfGlyph(l),10)])),l=="0")return u.join("");l=l.toString(16),u.push(d[4-l.length],l)}return u.join("")},s=function(i){var o,l,c,d,u,h,f;for(u=`/CIDInit /ProcSet findresource begin 116312 dict begin 1164begincmap 1165/CIDSystemInfo << 1166 /Registry (Adobe) 1167 /Ordering (UCS) 1168 /Supplement 0 1169>> def 1170/CMapName /Adobe-Identity-UCS def 1171/CMapType 2 def 11721 begincodespacerange 1173<0000><ffff> 1174endcodespacerange`,c=[],h=0,f=(l=Object.keys(i).sort(function(m,x){return m-x})).length;h<f;h++)o=l[h],c.length>=100&&(u+=` 1175`+c.length+` beginbfchar 1176`+c.join(` 1177`)+` 1178endbfchar`,c=[]),i[o]!==void 0&&i[o]!==null&&typeof i[o].toString=="function"&&(d=("0000"+i[o].toString(16)).slice(-4),o=("0000"+(+o).toString(16)).slice(-4),c.push("<"+o+"><"+d+">"));return c.length&&(u+=` 1179`+c.length+` beginbfchar 1180`+c.join(` 1181`)+` 1182endbfchar 1183`),u+`endcmap 1184CMapName currentdict /CMap defineresource pop 1185end 1186end`};t.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,d=o.newObject,u=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="Identity-H"){for(var h=l.metadata.Unicode.widths,f=l.metadata.subset.encode(l.metadata.glyIdsUsed,1),m="",x=0;x<f.length;x++)m+=String.fromCharCode(f[x]);var p=d();u({data:m,addLength1:!0,objectId:p}),c("endobj");var v=d();u({data:s(l.metadata.toUnicode),addLength1:!0,objectId:v}),c("endobj");var g=d();c("<<"),c("/Type /FontDescriptor"),c("/FontName /"+tg(l.fontName)),c("/FontFile2 "+p+" 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 y=d();c("<<"),c("/Type /Font"),c("/BaseFont /"+tg(l.fontName)),c("/FontDescriptor "+g+" 0 R"),c("/W "+e.API.PDFObject.convert(h)),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=d(),c("<<"),c("/Type /Font"),c("/Subtype /Type0"),c("/ToUnicode "+v+" 0 R"),c("/BaseFont /"+tg(l.fontName)),c("/Encoding /"+l.encoding),c("/DescendantFonts ["+y+" 0 R]"),c(">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]),t.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,d=o.newObject,u=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="WinAnsiEncoding"){for(var h=l.metadata.rawData,f="",m=0;m<h.length;m++)f+=String.fromCharCode(h[m]);var x=d();u({data:f,addLength1:!0,objectId:x}),c("endobj");var p=d();u({data:s(l.metadata.toUnicode),addLength1:!0,objectId:p}),c("endobj");var v=d();c("<<"),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c("/StemV "+l.metadata.stemV),c("/Type /FontDescriptor"),c("/FontFile2 "+x+" 0 R"),c("/Flags 96"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/FontName /"+tg(l.fontName)),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c(">>"),c("endobj"),l.objectNumber=d();for(var g=0;g<l.metadata.hmtx.widths.length;g++)l.metadata.hmtx.widths[g]=parseInt(l.metadata.hmtx.widths[g]*(1e3/l.metadata.head.unitsPerEm));c("<</Subtype/TrueType/Type/Font/ToUnicode "+p+" 0 R/BaseFont/"+tg(l.fontName)+"/FontDescriptor "+v+" 0 R/Encoding/"+l.encoding+" /FirstChar 29 /LastChar 255 /Widths "+e.API.PDFObject.convert(l.metadata.hmtx.widths)+">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]);var a=function(i){var o,l=i.text||"",c=i.x,d=i.y,u=i.options||{},h=i.mutex||{},f=h.pdfEscape,m=h.activeFontKey,x=h.fonts,p=m,v="",g=0,y="",b=x[p].encoding;if(x[p].encoding!=="Identity-H")return{text:l,x:c,y:d,options:u,mutex:h};for(y=l,p=m,Array.isArray(l)&&(y=l[0]),g=0;g<y.length;g+=1)x[p].metadata.hasOwnProperty("cmap")&&(o=x[p].metadata.cmap.unicode.codeMap[y[g].charCodeAt(0)]),o||y[g].charCodeAt(0)<256&&x[p].metadata.hasOwnProperty("Unicode")?v+=y[g]:v+="";var w="";return parseInt(p.slice(1))<14||b==="WinAnsiEncoding"?w=f(v,p).split("").map(function(_){return _.charCodeAt(0).toString(16)}).join(""):b==="Identity-H"&&(w=n(v,x[p])),h.isHex=!0,{text:w,x:c,y:d,options:u,mutex:h}};t.events.push(["postProcessText",function(i){var o=i.text||"",l=[],c={text:o,x:i.x,y:i.y,options:i.options,mutex:i.mutex};if(Array.isArray(o)){var d=0;for(d=0;d<o.length;d+=1)Array.isArray(o[d])&&o[d].length===3?l.push([a(Object.assign({},c,{text:o[d][0]})).text,o[d][1],o[d][2]]):l.push(a(Object.assign({},c,{text:o[d]})).text);i.text=l}else i.text=a(Object.assign({},c,{text:o})).text}])}(ar),function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0},e.addFileToVFS=function(n,s){return t.call(this),this.internal.vFS[n]=s,this},e.getFileFromVFS=function(n){return t.call(this),this.internal.vFS[n]!==void 0?this.internal.vFS[n]:null}}(ar.API),function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(s){var a,i,o,l,c,d,u,h=t,f=[[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]],m=[[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]],x={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},p={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},v=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","â¹","âº","â¹","â ","â","â ","â½","â¾","â½","â","â","â","â¤","â¥","â¤","â©","âª","â©","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","ï¹","﹤","ï¹¥","﹤"],g=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)$/),y=!1,b=0;this.__bidiEngine__={};var w=function(P){var O=P.charCodeAt(),A=O>>8,R=p[A];return R!==void 0?h[256*R+(255&O)]:A===252||A===253?"AL":g.test(A)?"L":A===8?"R":"N"},_=function(P){for(var O,A=0;A<P.length;A++){if((O=w(P.charAt(A)))==="L")return!1;if(O==="R")return!0}return!1},C=function(P,O,A,R){var L,z,U,$,q=O[R];switch(q){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":y=!1;break;case"N":case"AN":break;case"EN":y&&(q="AN");break;case"AL":y=!0,q="R";break;case"WS":case"BN":q="N";break;case"CS":R<1||R+1>=O.length||(L=A[R-1])!=="EN"&&L!=="AN"||(z=O[R+1])!=="EN"&&z!=="AN"?q="N":y&&(z="AN"),q=z===L?z:"N";break;case"ES":q=(L=R>0?A[R-1]:"B")==="EN"&&R+1<O.length&&O[R+1]==="EN"?"EN":"N";break;case"ET":if(R>0&&A[R-1]==="EN"){q="EN";break}if(y){q="N";break}for(U=R+1,$=O.length;U<$&&O[U]==="ET";)U++;q=U<$&&O[U]==="EN"?"EN":"N";break;case"NSM":if(o&&!l){for($=O.length,U=R+1;U<$&&O[U]==="NSM";)U++;if(U<$){var ne=P[R],se=ne>=1425&&ne<=2303||ne===64286;if(L=O[U],se&&(L==="R"||L==="AL")){q="R";break}}}q=R<1||(L=O[R-1])==="B"?"N":A[R-1];break;case"B":y=!1,a=!0,q=b;break;case"S":i=!0,q="N"}return q},E=function(P,O,A){var R=P.split("");return A&&N(R,A,{hiLevel:b}),R.reverse(),O&&O.reverse(),R.join("")},N=function(P,O,A){var R,L,z,U,$,q=-1,ne=P.length,se=0,F=[],V=b?m:f,Z=[];for(y=!1,a=!1,i=!1,L=0;L<ne;L++)Z[L]=w(P[L]);for(z=0;z<ne;z++){if($=se,F[z]=C(P,Z,F,z),R=240&(se=V[$][x[F[z]]]),se&=15,O[z]=U=V[se][5],R>0)if(R===16){for(L=q;L<z;L++)O[L]=1;q=-1}else q=-1;if(V[se][6])q===-1&&(q=z);else if(q>-1){for(L=q;L<z;L++)O[L]=U;q=-1}Z[z]==="B"&&(O[z]=0),A.hiLevel|=U}i&&function(de,ve,pe){for(var _e=0;_e<pe;_e++)if(de[_e]==="S"){ve[_e]=b;for(var xe=_e-1;xe>=0&&de[xe]==="WS";xe--)ve[xe]=b}}(Z,O,ne)},k=function(P,O,A,R,L){if(!(L.hiLevel<P)){if(P===1&&b===1&&!a)return O.reverse(),void(A&&A.reverse());for(var z,U,$,q,ne=O.length,se=0;se<ne;){if(R[se]>=P){for($=se+1;$<ne&&R[$]>=P;)$++;for(q=se,U=$-1;q<U;q++,U--)z=O[q],O[q]=O[U],O[U]=z,A&&(z=A[q],A[q]=A[U],A[U]=z);se=$}se++}}},I=function(P,O,A){var R=P.split(""),L={hiLevel:b};return A||(A=[]),N(R,A,L),function(z,U,$){if($.hiLevel!==0&&u)for(var q,ne=0;ne<z.length;ne++)U[ne]===1&&(q=v.indexOf(z[ne]))>=0&&(z[ne]=v[q+1])}(R,A,L),k(2,R,O,A,L),k(1,R,O,A,L),R.join("")};return this.__bidiEngine__.doBidiReorder=function(P,O,A){if(function(L,z){if(z)for(var U=0;U<L.length;U++)z[U]=U;l===void 0&&(l=_(L)),d===void 0&&(d=_(L))}(P,O),o||!c||d)if(o&&c&&l^d)b=l?1:0,P=E(P,O,A);else if(!o&&c&&d)b=l?1:0,P=I(P,O,A),P=E(P,O);else if(!o||l||c||d){if(o&&!c&&l^d)P=E(P,O),l?(b=0,P=I(P,O,A)):(b=1,P=I(P,O,A),P=E(P,O));else if(o&&l&&!c&&d)b=1,P=I(P,O,A),P=E(P,O);else if(!o&&!c&&l^d){var R=u;l?(b=1,P=I(P,O,A),b=0,u=!1,P=I(P,O,A),u=R):(b=0,P=I(P,O,A),P=E(P,O),b=1,u=!1,P=I(P,O,A),u=R,P=E(P,O))}}else b=0,P=I(P,O,A);else b=l?1:0,P=I(P,O,A);return P},this.__bidiEngine__.setOptions=function(P){P&&(o=P.isInputVisual,c=P.isOutputVisual,l=P.isInputRtl,d=P.isOutputRtl,u=P.isSymmetricSwapping)},this.__bidiEngine__.setOptions(s),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"],n=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push(["postProcessText",function(s){var a=s.text;s.x,s.y;var i=s.options||{};s.mutex,i.lang;var o=[];if(i.isInputVisual=typeof i.isInputVisual!="boolean"||i.isInputVisual,n.setOptions(i),Object.prototype.toString.call(a)==="[object Array]"){var l=0;for(o=[],l=0;l<a.length;l+=1)Object.prototype.toString.call(a[l])==="[object Array]"?o.push([n.doBidiReorder(a[l][0]),a[l][1],a[l][2]]):o.push([n.doBidiReorder(a[l])]);s.text=o}else s.text=n.doBidiReorder(a);n.setOptions({isInputVisual:!0})}])}(ar),ar.API.TTFFont=function(){function e(t){var n;if(this.rawData=t,n=this.contents=new Fh(t),this.contents.pos=4,n.readString(4)==="ttcf")throw new Error("TTCF not supported.");n.pos=0,this.parse(),this.subset=new _Ze(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new dZe(this.contents),this.head=new hZe(this),this.name=new xZe(this),this.cmap=new ire(this),this.toUnicode={},this.hhea=new fZe(this),this.maxp=new vZe(this),this.hmtx=new yZe(this),this.post=new pZe(this),this.os2=new mZe(this),this.loca=new NZe(this),this.glyf=new bZe(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,n,s,a,i;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,l,c,d;for(d=[],o=0,l=(c=this.bbox).length;o<l;o++)t=c[o],d.push(Math.round(t*this.scaleFactor));return d}).call(this),this.stemV=0,this.post.exists?(s=255&(a=this.post.italic_angle),32768&(n=a>>16)&&(n=-(1+(65535^n))),this.italicAngle=+(n+"."+s)):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=(i=this.familyClass)===1||i===2||i===3||i===4||i===5||i===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 n;return((n=this.cmap.unicode)!=null?n.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var n;return n=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*n},e.prototype.widthOfString=function(t,n,s){var a,i,o,l;for(o=0,i=0,l=(t=""+t).length;0<=l?i<l:i>l;i=0<=l?++i:--i)a=t.charCodeAt(i),o+=this.widthOfGlyph(this.characterToGlyph(a))+s*(1e3/n)||0;return o*(n/1e3)},e.prototype.lineHeight=function(t,n){var s;return n==null&&(n=!1),s=n?this.lineGap:0,(this.ascender+s-this.decender)/1e3*t},e}();var mc,Fh=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 n,s;for(s=[],n=0;0<=t?n<t:n>t;n=0<=t?++n:--n)s[n]=String.fromCharCode(this.readByte());return s.join("")},e.prototype.writeString=function(t){var n,s,a;for(a=[],n=0,s=t.length;0<=s?n<s:n>s;n=0<=s?++n:--n)a.push(this.writeByte(t.charCodeAt(n)));return a},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,n,s,a,i,o,l,c;return t=this.readByte(),n=this.readByte(),s=this.readByte(),a=this.readByte(),i=this.readByte(),o=this.readByte(),l=this.readByte(),c=this.readByte(),128&t?-1*(72057594037927940*(255^t)+281474976710656*(255^n)+1099511627776*(255^s)+4294967296*(255^a)+16777216*(255^i)+65536*(255^o)+256*(255^l)+(255^c)+1):72057594037927940*t+281474976710656*n+1099511627776*s+4294967296*a+16777216*i+65536*o+256*l+c},e.prototype.writeLongLong=function(t){var n,s;return n=Math.floor(t/4294967296),s=4294967295&t,this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n),this.writeByte(s>>24&255),this.writeByte(s>>16&255),this.writeByte(s>>8&255),this.writeByte(255&s)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var n,s;for(n=[],s=0;0<=t?s<t:s>t;s=0<=t?++s:--s)n.push(this.readByte());return n},e.prototype.write=function(t){var n,s,a,i;for(i=[],s=0,a=t.length;s<a;s++)n=t[s],i.push(this.writeByte(n));return i},e}(),dZe=function(){var e;function t(n){var s,a,i;for(this.scalarType=n.readInt(),this.tableCount=n.readShort(),this.searchRange=n.readShort(),this.entrySelector=n.readShort(),this.rangeShift=n.readShort(),this.tables={},a=0,i=this.tableCount;0<=i?a<i:a>i;a=0<=i?++a:--a)s={tag:n.readString(4),checksum:n.readInt(),offset:n.readInt(),length:n.readInt()},this.tables[s.tag]=s}return t.prototype.encode=function(n){var s,a,i,o,l,c,d,u,h,f,m,x,p;for(p in m=Object.keys(n).length,c=Math.log(2),h=16*Math.floor(Math.log(m)/c),o=Math.floor(h/c),u=16*m-h,(a=new Fh).writeInt(this.scalarType),a.writeShort(m),a.writeShort(h),a.writeShort(o),a.writeShort(u),i=16*m,d=a.pos+i,l=null,x=[],n)for(f=n[p],a.writeString(p),a.writeInt(e(f)),a.writeInt(d),a.writeInt(f.length),x=x.concat(f),p==="head"&&(l=d),d+=f.length;d%4;)x.push(0),d++;return a.write(x),s=2981146554-e(a.data),a.pos=l+8,a.writeUInt32(s),a.data},e=function(n){var s,a,i,o;for(n=ore.call(n);n.length%4;)n.push(0);for(i=new Fh(n),a=0,s=0,o=n.length;s<o;s=s+=4)a+=i.readUInt32();return 4294967295&a},t}(),uZe={}.hasOwnProperty,ld=function(e,t){for(var n in t)uZe.call(t,n)&&(e[n]=t[n]);function s(){this.constructor=e}return s.prototype=t.prototype,e.prototype=new s,e.__super__=t.prototype,e};mc=function(){function e(t){var n;this.file=t,n=this.file.directory.tables[this.tag],this.exists=!!n,n&&(this.offset=n.offset,this.length=n.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 hZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),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 n;return(n=new Fh).writeInt(this.version),n.writeInt(this.revision),n.writeInt(this.checkSumAdjustment),n.writeInt(this.magicNumber),n.writeShort(this.flags),n.writeShort(this.unitsPerEm),n.writeLongLong(this.created),n.writeLongLong(this.modified),n.writeShort(this.xMin),n.writeShort(this.yMin),n.writeShort(this.xMax),n.writeShort(this.yMax),n.writeShort(this.macStyle),n.writeShort(this.lowestRecPPEM),n.writeShort(this.fontDirectionHint),n.writeShort(t),n.writeShort(this.glyphDataFormat),n.data},e}(),D9=function(){function e(t,n){var s,a,i,o,l,c,d,u,h,f,m,x,p,v,g,y,b;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=n+t.readInt(),h=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(m=t.readUInt16(),f=m/2,t.pos+=6,i=function(){var w,_;for(_=[],c=w=0;0<=f?w<f:w>f;c=0<=f?++w:--w)_.push(t.readUInt16());return _}(),t.pos+=2,p=function(){var w,_;for(_=[],c=w=0;0<=f?w<f:w>f;c=0<=f?++w:--w)_.push(t.readUInt16());return _}(),d=function(){var w,_;for(_=[],c=w=0;0<=f?w<f:w>f;c=0<=f?++w:--w)_.push(t.readUInt16());return _}(),u=function(){var w,_;for(_=[],c=w=0;0<=f?w<f:w>f;c=0<=f?++w:--w)_.push(t.readUInt16());return _}(),a=(this.length-t.pos+this.offset)/2,l=function(){var w,_;for(_=[],c=w=0;0<=a?w<a:w>a;c=0<=a?++w:--w)_.push(t.readUInt16());return _}(),c=g=0,b=i.length;g<b;c=++g)for(v=i[c],s=y=x=p[c];x<=v?y<=v:y>=v;s=x<=v?++y:--y)u[c]===0?o=s+d[c]:(o=l[u[c]/2+(s-x)-(f-c)]||0)!==0&&(o+=d[c]),this.codeMap[s]=65535&o}t.pos=h}return e.encode=function(t,n){var s,a,i,o,l,c,d,u,h,f,m,x,p,v,g,y,b,w,_,C,E,N,k,I,P,O,A,R,L,z,U,$,q,ne,se,F,V,Z,de,ve,pe,_e,xe,oe,we,ce;switch(R=new Fh,o=Object.keys(t).sort(function(De,Ue){return De-Ue}),n){case"macroman":for(p=0,v=function(){var De=[];for(x=0;x<256;++x)De.push(0);return De}(),y={0:0},i={},L=0,q=o.length;L<q;L++)y[xe=t[a=o[L]]]==null&&(y[xe]=++p),i[a]={old:t[a],new:y[t[a]]},v[a]=y[t[a]];return R.writeUInt16(1),R.writeUInt16(0),R.writeUInt32(12),R.writeUInt16(0),R.writeUInt16(262),R.writeUInt16(0),R.write(v),{charMap:i,subtable:R.data,maxGlyphID:p+1};case"unicode":for(O=[],h=[],b=0,y={},s={},g=d=null,z=0,ne=o.length;z<ne;z++)y[_=t[a=o[z]]]==null&&(y[_]=++b),s[a]={old:_,new:y[_]},l=y[_]-a,g!=null&&l===d||(g&&h.push(g),O.push(a),d=l),g=a;for(g&&h.push(g),h.push(65535),O.push(65535),I=2*(k=O.length),N=2*Math.pow(Math.log(k)/Math.LN2,2),f=Math.log(N/2)/Math.LN2,E=2*k-N,c=[],C=[],m=[],x=U=0,se=O.length;U<se;x=++U){if(P=O[x],u=h[x],P===65535){c.push(0),C.push(0);break}if(P-(A=s[P].new)>=32768)for(c.push(0),C.push(2*(m.length+k-x)),a=$=P;P<=u?$<=u:$>=u;a=P<=u?++$:--$)m.push(s[a].new);else c.push(A-P),C.push(0)}for(R.writeUInt16(3),R.writeUInt16(1),R.writeUInt32(12),R.writeUInt16(4),R.writeUInt16(16+8*k+2*m.length),R.writeUInt16(0),R.writeUInt16(I),R.writeUInt16(N),R.writeUInt16(f),R.writeUInt16(E),pe=0,F=h.length;pe<F;pe++)a=h[pe],R.writeUInt16(a);for(R.writeUInt16(0),_e=0,V=O.length;_e<V;_e++)a=O[_e],R.writeUInt16(a);for(oe=0,Z=c.length;oe<Z;oe++)l=c[oe],R.writeUInt16(l);for(we=0,de=C.length;we<de;we++)w=C[we],R.writeUInt16(w);for(ce=0,ve=m.length;ce<ve;ce++)p=m[ce],R.writeUInt16(p);return{charMap:s,subtable:R.data,maxGlyphID:b+1}}},e}(),ire=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),e.prototype.tag="cmap",e.prototype.parse=function(t){var n,s,a;for(t.pos=this.offset,this.version=t.readUInt16(),a=t.readUInt16(),this.tables=[],this.unicode=null,s=0;0<=a?s<a:s>a;s=0<=a?++s:--s)n=new D9(t,this.offset),this.tables.push(n),n.isUnicode&&this.unicode==null&&(this.unicode=n);return!0},e.encode=function(t,n){var s,a;return n==null&&(n="macroman"),s=D9.encode(t,n),(a=new Fh).writeUInt16(0),a.writeUInt16(1),s.table=a.data.concat(s.subtable),s},e}(),fZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),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}(),mZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),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 n,s;for(s=[],n=0;n<10;++n)s.push(t.readByte());return s}(),this.charRange=function(){var n,s;for(s=[],n=0;n<4;++n)s.push(t.readInt());return s}(),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 n,s;for(s=[],n=0;n<2;n=++n)s.push(t.readInt());return s}(),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}(),pZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),e.prototype.tag="post",e.prototype.parse=function(t){var n,s,a;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 i;for(s=t.readUInt16(),this.glyphNameIndex=[],i=0;0<=s?i<s:i>s;i=0<=s?++i:--i)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],a=[];t.pos<this.offset+this.length;)n=t.readByte(),a.push(this.names.push(t.readString(n)));return a;case 151552:return s=t.readUInt16(),this.offsets=t.read(s);case 262144:return this.map=(function(){var o,l,c;for(c=[],i=o=0,l=this.file.maxp.numGlyphs;0<=l?o<l:o>l;i=0<=l?++o:--o)c.push(t.readUInt32());return c}).call(this)}},e}(),gZe=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},xZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),e.prototype.tag="name",e.prototype.parse=function(t){var n,s,a,i,o,l,c,d,u,h,f;for(t.pos=this.offset,t.readShort(),n=t.readShort(),l=t.readShort(),s=[],i=0;0<=n?i<n:i>n;i=0<=n?++i:--i)s.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+l+t.readShort()});for(c={},i=u=0,h=s.length;u<h;i=++u)a=s[i],t.pos=a.offset,d=t.readString(a.length),o=new gZe(d,a),c[f=a.nameID]==null&&(c[f]=[]),c[a.nameID].push(o);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}(),vZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),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}(),yZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),e.prototype.tag="hmtx",e.prototype.parse=function(t){var n,s,a,i,o,l,c;for(t.pos=this.offset,this.metrics=[],n=0,l=this.file.hhea.numberOfMetrics;0<=l?n<l:n>l;n=0<=l?++n:--n)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(a=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var d,u;for(u=[],n=d=0;0<=a?d<a:d>a;n=0<=a?++d:--d)u.push(t.readInt16());return u}(),this.widths=(function(){var d,u,h,f;for(f=[],d=0,u=(h=this.metrics).length;d<u;d++)i=h[d],f.push(i.advance);return f}).call(this),s=this.widths[this.widths.length-1],c=[],n=o=0;0<=a?o<a:o>a;n=0<=a?++o:--o)c.push(this.widths.push(s));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}(),ore=[].slice,bZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var n,s,a,i,o,l,c,d,u,h;return t in this.cache?this.cache[t]:(i=this.file.loca,n=this.file.contents,s=i.indexOf(t),(a=i.lengthOf(t))===0?this.cache[t]=null:(n.pos=this.offset+s,o=(l=new Fh(n.read(a))).readShort(),d=l.readShort(),h=l.readShort(),c=l.readShort(),u=l.readShort(),this.cache[t]=o===-1?new wZe(l,d,h,c,u):new jZe(l,o,d,h,c,u),this.cache[t]))},e.prototype.encode=function(t,n,s){var a,i,o,l,c;for(o=[],i=[],l=0,c=n.length;l<c;l++)a=t[n[l]],i.push(o.length),a&&(o=o.concat(a.encode(s)));return i.push(o.length),{table:o,offsets:i}},e}(),jZe=function(){function e(t,n,s,a,i,o){this.raw=t,this.numberOfContours=n,this.xMin=s,this.yMin=a,this.xMax=i,this.yMax=o,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e}(),wZe=function(){function e(t,n,s,a,i){var o,l;for(this.raw=t,this.xMin=n,this.yMin=s,this.xMax=a,this.yMax=i,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],o=this.raw;l=o.readShort(),this.glyphOffsets.push(o.pos),this.glyphIDs.push(o.readUInt16()),32&l;)o.pos+=1&l?4:2,128&l?o.pos+=8:64&l?o.pos+=4:8&l&&(o.pos+=2)}return e.prototype.encode=function(){var t,n,s;for(n=new Fh(ore.call(this.raw.data)),t=0,s=this.glyphIDs.length;t<s;++t)n.pos=this.glyphOffsets[t];return n.data},e}(),NZe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return ld(e,mc),e.prototype.tag="loca",e.prototype.parse=function(t){var n,s;return t.pos=this.offset,n=this.file.head.indexToLocFormat,this.offsets=n===0?(function(){var a,i;for(i=[],s=0,a=this.length;s<a;s+=2)i.push(2*t.readUInt16());return i}).call(this):(function(){var a,i;for(i=[],s=0,a=this.length;s<a;s+=4)i.push(t.readUInt32());return i}).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,n){for(var s=new Uint32Array(this.offsets.length),a=0,i=0,o=0;o<s.length;++o)if(s[o]=a,i<n.length&&n[i]==o){++i,s[o]=a;var l=this.offsets[o],c=this.offsets[o+1]-l;c>0&&(a+=c)}for(var d=new Array(4*s.length),u=0;u<s.length;++u)d[4*u+3]=255&s[u],d[4*u+2]=(65280&s[u])>>8,d[4*u+1]=(16711680&s[u])>>16,d[4*u]=(4278190080&s[u])>>24;return d},e}(),_Ze=function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,n,s,a,i;for(n in a=this.font.cmap.tables[0].codeMap,t={},i=this.subset)s=i[n],t[n]=a[s];return t},e.prototype.glyphsFor=function(t){var n,s,a,i,o,l,c;for(a={},o=0,l=t.length;o<l;o++)a[i=t[o]]=this.font.glyf.glyphFor(i);for(i in n=[],a)(s=a[i])!=null&&s.compound&&n.push.apply(n,s.glyphIDs);if(n.length>0)for(i in c=this.glyphsFor(n))s=c[i],a[i]=s;return a},e.prototype.encode=function(t,n){var s,a,i,o,l,c,d,u,h,f,m,x,p,v,g;for(a in s=ire.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(t),m={0:0},g=s.charMap)m[(c=g[a]).old]=c.new;for(x in f=s.maxGlyphID,o)x in m||(m[x]=f++);return u=function(y){var b,w;for(b in w={},y)w[y[b]]=b;return w}(m),h=Object.keys(u).sort(function(y,b){return y-b}),p=function(){var y,b,w;for(w=[],y=0,b=h.length;y<b;y++)l=h[y],w.push(u[l]);return w}(),i=this.font.glyf.encode(o,p,m),d=this.font.loca.encode(i.offsets,p),v={cmap:this.font.cmap.raw(),glyf:i.table,loca:d,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(n)},this.font.os2.exists&&(v["OS/2"]=this.font.os2.raw()),this.font.directory.encode(v)},e}();ar.API.PDFObject=function(){var e;function t(){}return e=function(n,s){return(Array(s+1).join("0")+n).slice(-s)},t.convert=function(n){var s,a,i,o;if(Array.isArray(n))return"["+function(){var l,c,d;for(d=[],l=0,c=n.length;l<c;l++)s=n[l],d.push(t.convert(s));return d}().join(" ")+"]";if(typeof n=="string")return"/"+n;if(n!=null&&n.isString)return"("+n+")";if(n instanceof Date)return"(D:"+e(n.getUTCFullYear(),4)+e(n.getUTCMonth(),2)+e(n.getUTCDate(),2)+e(n.getUTCHours(),2)+e(n.getUTCMinutes(),2)+e(n.getUTCSeconds(),2)+"Z)";if({}.toString.call(n)==="[object Object]"){for(a in i=["<<"],n)o=n[a],i.push("/"+a+" "+t.convert(o));return i.push(">>"),i.join(` 1187`)}return""+n},t}();
1187const SZe=["So this one na say...","E be like say...","Omo, you go hear this one...","Na so the tori go...","Wetin happen be say...","Abeg hear this...","Bros and sisters, check this...","No be small thing o...","See wetin dey happen...","Make I tell you..."],kZe=["Wetin you think about this one?","Na wa o! You agree?","E shock you? E shock me too!","Abeg drop your own gist for comment.","This one na fire! You feel am?","Abi na lie? Talk your own.","You see am? Na so e dey go.","Wahala no dey finish for this country o."],CZe={standard:`How far, my people! Welcome to Naija Daily Brief! 1188Na your boy [PRESENTER_NAME] dey here again o. 1189Today na [DATE], and we get plenty gist for you. 1190Make we yarn about wetin dey happen today... 1191Oya, make we begin!`,short:`How far! Na [PRESENTER_NAME] again. 1192Today na [DATE]. We get gist â make we go!`,energetic:`EEEH! My people! How far how far! 1193Na your boy [PRESENTER_NAME] don land again o! 1194Today na [DATE] and CHAI â the gist wey we get today ehn! 1195You no go believe am! Oya sit down, grab your chin-chin, 1196make we ENTER this tori! 1197[HOOK]`},AZe={standard:`That na today own o! If this gist sweet you, 1198abeg subscribe and follow us. 1199Hit that bell button so you no go miss tomorrow own. 1200Visit naija.com for the full tori dem. 1201Share this video give your people, make dem no miss out. 1202We go see tomorrow! How far? Na bye for now!`,short:`That na today own! Subscribe, share, visit naija.com. 1203We go see tomorrow â bye!`,energetic:`CHAI! Today own SWEET o! If e sweet you too, 1204SMASH that subscribe button! BELL IT! 1205Share am give your mama, your papa, your neighbor! 1206Visit naija.com â the full tori dey there! 1207Tomorrow we go come BACK with MORE fire! 1208[QUESTION_OF_DAY] 1209Drop your answer for the comments! We dey read ALL of them! 1210Na bye for now â STAY BLESSED!`},OC={localNews:`Now for today local news stories... 1211Naija news wey go make your eye open!`,internationalNews:`Now make we check wetin dey happen for our people abroad... 1212Diaspora gist, international tori, everything dey here!`,gossip:`Oya, time for gist! You know say we must yarn... 1213Entertainment, celebrity gist, and all the hot tori!`},LC=e=>e[Math.floor(Math.random()*e.length)];function PZe(){const{user:e}=bt(),[t,n]=j.useState([]),[s,a]=j.useState(new Set),[i,o]=j.useState([]),[l,c]=j.useState({}),[d,u]=j.useState(!0),[h,f]=j.useState("Tunde"),[m,x]=j.useState(""),[p,v]=j.useState("5"),[g,y]=j.useState(""),[b,w]=j.useState(""),[_,C]=j.useState("standard"),[E,N]=j.useState("standard"),[k,I]=j.useState(""),[P,O]=j.useState(""),[A,R]=j.useState(""),[L,z]=j.useState([]),[U,$]=j.useState([]),[q,ne]=j.useState([]),[se,F]=j.useState(null),[V,Z]=j.useState("draft"),[de,ve]=j.useState(!1);j.useEffect(()=>{pe(),_e()},[]);const pe=async()=>{u(!0);try{const ke=new Date;ke.setHours(0,0,0,0);const{data:Ie,error:at}=await H.from("curated_headlines").select("id, title, description, region, category, source, url, published_at").eq("approved",!0).gte("created_at",ke.toISOString()).order("region",{ascending:!0}).order("vote_score",{ascending:!1});if(at)throw at;n(Ie||[]);const rt={};(Ie||[]).forEach(Gt=>{rt[Gt.id]=`${LC(SZe)} ${Gt.title}. ${Gt.description?Gt.description.slice(0,120)+"...":""} ${LC(kZe)}`}),c(rt)}catch(ke){console.error(ke),be({title:"Error",description:"Failed to fetch headlines",variant:"destructive"})}finally{u(!1)}},_e=async()=>{const{data:ke}=await H.from("video_scripts").select("id, episode_date, episode_title, status, created_at").order("episode_date",{ascending:!1}).limit(20);ke&&ne(ke)},xe=ke=>{a(Ie=>{const at=new Set(Ie);return at.has(ke)?(at.delete(ke),o(rt=>rt.filter(Gt=>Gt!==ke))):(at.add(ke),o(rt=>[...rt,ke])),at})},oe=ke=>{const Ie=t.filter(at=>at.region===ke).map(at=>at.id);a(at=>{const rt=new Set(at),Gt=Ie.every(gt=>rt.has(gt));return Ie.forEach(gt=>{Gt?(rt.delete(gt),o(Zt=>Zt.filter(dr=>dr!==gt))):rt.has(gt)||(rt.add(gt),o(Zt=>[...Zt,gt]))}),rt})},we=(ke,Ie)=>{o(at=>{const rt=[...at],Gt=ke+Ie;return Gt<0||Gt>=rt.length||([rt[ke],rt[Gt]]=[rt[Gt],rt[ke]]),rt})},ce=t.reduce((ke,Ie)=>{const at=Ie.region||"Other";return ke[at]||(ke[at]=[]),ke[at].push(Ie),ke},{}),De=j.useCallback(ke=>t.find(Ie=>Ie.id===ke),[t]),Ue=new Date().toLocaleDateString("en-NG",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),re=ke=>{const Ie=ke.filter(gt=>gt.region==="Nigeria"||gt.region==="Local"),at=ke.filter(gt=>gt.region==="Diaspora"||gt.region==="International"||gt.region==="World"),rt=ke.filter(gt=>gt.region==="Entertainment"||gt.region==="Gossip"||gt.category==="entertainment"),Gt=ke.filter(gt=>!Ie.includes(gt)&&!at.includes(gt)&&!rt.includes(gt));return{local:[...Ie,...Gt],intl:at,gossip:rt}},et=()=>{var pn,xr,Bt,Zr,sr,ur,Gr,ts,Ut;
1213const ke=i.map(Ur=>De(Ur)).filter(Boolean);if(ke.length===0){be({title:"Select headlines first",variant:"destructive"});return}const{local:Ie,intl:at,gossip:rt}=re(ke),Gt=m||`Naija Daily Brief - ${Ue}`;let gt=`======================================== 1214${Gt.toUpperCase()} 1215Date: ${Ue} 1216Presenter: ${h} 1217Est. Runtime: ${p} min 1218======================================== 1219 1220`;gt+=`--- SEGMENT 1: INTRO --- 1221 1222`;let Zt=CZe[_].replace("[PRESENTER_NAME]",h).replace("[DATE]",Ue).replace("[HOOK]",g||"");gt+=Zt+` 1223 1224`,Ie.length>0&&(gt+=`--- SEGMENT 2: LOCAL NEWS --- 1225 1226${OC.localNews} 1227 1228`,Ie.forEach((Ur,vs)=>{gt+=`[Story ${vs+1}] 1229${l[Ur.id]||Ur.title} 1230 1231`})),at.length>0&&(gt+=`--- SEGMENT 3: INTERNATIONAL / DIASPORA --- 1232 1233${OC.internationalNews} 1234 1235`,at.forEach((Ur,vs)=>{gt+=`[Story ${vs+1}] 1236${l[Ur.id]||Ur.title} 1237 1238`})),rt.length>0&&(gt+=`--- SEGMENT 4: GOSSIP & ENTERTAINMENT --- 1239 1240${OC.gossip} 1241 1242`,rt.forEach((Ur,vs)=>{gt+=`[Story ${vs+1}] 1243${l[Ur.id]||Ur.title} 1244 1245`})),b&&(gt+=`--- QUESTION OF THE DAY --- 1246 1247${b} 1248 1249`),gt+=`--- SEGMENT 5: OUTRO --- 1250 1251`;let dr=AZe[E].replace("[QUESTION_OF_DAY]",b||"");gt+=dr+` 1252 1253======================================== 1254END OF SCRIPT 1255========================================`,I(gt);let Fr=Zt+` 1256 1257`;[...Ie,...at,...rt].forEach(Ur=>{Fr+=(l[Ur.id]||Ur.title)+` 1258 1259`}),b&&(Fr+=b+` 1260 1261`),Fr+=dr,O(Fr);let Tt=`${Gt} 1262 1263`;Tt+=`Today's Headlines: 1264`;let Br=0;const tr=Ur=>`${Math.floor(Ur/60)}:${String(Ur%60).padStart(2,"0")}`;Tt+=`${tr(Br)} - Intro 1265`,Br+=30,Ie.length&&(Tt+=`${tr(Br)} - Local News 1266`,Ie.forEach(Ur=>{Tt+=` ⢠${Ur.title} 1267`}),Br+=Ie.length*45),at.length&&(Tt+=`${tr(Br)} - International / Diaspora 1268`,at.forEach(Ur=>{Tt+=` ⢠${Ur.title} 1269`}),Br+=at.length*45),rt.length&&(Tt+=`${tr(Br)} - Gossip & Entertainment 1270`,rt.forEach(Ur=>{Tt+=` ⢠${Ur.title} 1271`})),Tt+=` 1272ð° Full stories: https://naija.com/news 1273ð Visit: https://naija.com 1274ð§ Subscribe to our newsletter 1275 1276#NaijaDailyBrief #NigeriaNews #NaijaGist #PidginEnglish`,b&&(Tt+=` 1277 1278ð¬ Question of the Day: ${b}`),R(Tt);const or=ke.slice(0,3);z([((xr=(pn=or[0])==null?void 0:pn.title)==null?void 0:xr.split(" ").slice(0,5).join(" ").toUpperCase())+"!",`BREAKING: ${(Zr=(Bt=or[0])==null?void 0:Bt.title)==null?void 0:Zr.split(" ").slice(0,4).join(" ")}`,`${Ue.split(",")[0]} GIST ð¥`]),$([`Naija Daily Brief ${new Date().toLocaleDateString("en-NG")} - ${(ur=(sr=or[0])==null?void 0:sr.title)==null?void 0:ur.slice(0,40)}`,`${(Gr=or[0])==null?void 0:Gr.title} | Plus ${ke.length-1} More Stories`,`Today's Naija Gist: ${(Ut=(ts=or[0])==null?void 0:ts.title)==null?void 0:Ut.split(" ").slice(0,6).join(" ")}...`]),be({title:"Script Generated!",description:`${ke.length} stories across all segments.`})},kt=()=>{var at,rt,Gt,gt;const ke=i.slice(0,3).map(Zt=>De(Zt)).filter(Boolean);if(ke.length===0){be({title:"Select headlines first",variant:"destructive"});return}const Ie=[`In today's episode: ${(at=ke[0])==null?void 0:at.title}. ${ke[1]?`Plus ${ke[1].title}.`:""} ${ke[2]?"And you no go believe this last one!":""}`,`Omo! ${(rt=ke[0])==null?void 0:rt.title} â this one SHOCK everybody! Stay tuned...`,`Three tori wey go blow your mind today: Number one â ${(gt=(Gt=ke[0])==null?void 0:Gt.title)==null?void 0:gt.split(" ").slice(0,6).join(" ")}...`];y(LC(Ie))},St=async()=>{if(!e)return;ve(!0);const ke={episode_date:new Date().toISOString().split("T")[0],episode_title:m||`Naija Daily Brief - ${Ue}`,presenter_name:h,hook_text:g,question_of_day:b,estimated_runtime_minutes:parseInt(p),intro_variant:_,outro_variant:E,full_script:k,teleprompter_script:P,youtube_description:A,thumbnail_suggestions:L,video_title_suggestions:U,headline_ids:i,headline_order:i,commentary_map:l,status:V,created_by:e.id,updated_at:new Date().toISOString()};try{if(se){const{error:Ie}=await H.from("video_scripts").update(ke).eq("id",se);if(Ie)throw Ie;be({title:"Updated!",description:"Script saved."})}else{const{data:Ie,error:at}=await H.from("video_scripts").insert(ke).select("id").single();if(at)throw at;F(Ie.id),be({title:"Saved!",description:"New script draft created."})}_e()}catch(Ie){be({title:"Error",description:Ie.message,variant:"destructive"})}finally{ve(!1)}},Ve=async ke=>{const{data:Ie,error:at}=await H.from("video_scripts").select("*").eq("id",ke).single();if(at||!Ie){be({title:"Error",description:"Failed to load script",variant:"destructive"});return}F(Ie.id),x(Ie.episode_title||""),f(Ie.presenter_name||"Tunde"),y(Ie.hook_text||""),w(Ie.question_of_day||""),v(String(Ie.estimated_runtime_minutes||5)),C(Ie.intro_variant||"standard"),N(Ie.outro_variant||"standard"),I(Ie.full_script||""),O(Ie.teleprompter_script||""),R(Ie.youtube_description||""),z(Ie.thumbnail_suggestions||[]),$(Ie.video_title_suggestions||[]),Z(Ie.status||"draft");const rt=Ie.commentary_map||{};c(gt=>({...gt,...rt}));const Gt=Ie.headline_order||Ie.headline_ids||[];o(Gt),a(new Set(Gt)),be({title:"Loaded",description:Ie.episode_title})},he=async ke=>{await H.from("video_scripts").delete().eq("id",ke),se===ke&&(F(null),I("")),_e(),be({title:"Deleted"})},ye=async(ke,Ie)=>{try{await navigator.clipboard.writeText(ke),be({title:"Copied!",description:`${Ie} copied to clipboard.`})}catch{be({title:"Error",description:"Failed to copy.",variant:"destructive"})}},Ee=(ke,Ie)=>{const at=new Date().toISOString().split("T")[0],rt=new Blob([ke],{type:"text/plain"}),Gt=URL.createObjectURL(rt),gt=document.createElement("a");gt.href=Gt,gt.download=`naija-daily-brief-${Ie}-${at}.txt`,gt.click(),URL.revokeObjectURL(Gt)},Fe=()=>{const ke=new ar,Ie=m||`Naija Daily Brief - ${Ue}`;ke.setFontSize(16),ke.text(Ie,14,20),ke.setFontSize(10),ke.text(`Presenter: ${h} | Runtime: ${p} min | ${Ue}`,14,28),ke.setFontSize(11);const at=ke.splitTextToSize(k,180);let rt=38;at.forEach(Gt=>{rt>280&&(ke.addPage(),rt=14),ke.text(Gt,14,rt),rt+=5.5}),ke.save(`naija-daily-brief-${new Date().toISOString().split("T")[0]}.pdf`)},tt=ke=>({Nigeria:"ð³ð¬ Local",Local:"ð³ð¬ Local",Diaspora:"ð Diaspora",International:"ð International",World:"ð World",Entertainment:"ð Entertainment",Gossip:"ð Gossip"})[ke]||`ð° ${ke}`,qe=ke=>ke==="Nigeria"||ke==="Local"?"bg-green-100 text-green-800":ke==="Diaspora"||ke==="International"||ke==="World"?"bg-blue-100 text-blue-800":ke==="Entertainment"||ke==="Gossip"?"bg-purple-100 text-purple-800":"bg-gray-100 text-gray-800",st=ke=>ke==="published"?r.jsx(Jc,{className:"h-3 w-3"}):ke==="produced"?r.jsx(Rd,{className:"h-3 w-3"}):r.jsx($r,{className:"h-3 w-3"}),Ct=ke=>ke==="published"?"bg-green-100 text-green-800":ke==="produced"?"bg-blue-100 text-blue-800":"bg-yellow-100 text-yellow-800";return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ij,{className:"h-6 w-6 text-primary"}),r.jsxs("div",{children:[r.jsx(Ae,{children:"YouTube Video Script Generator"}),r.jsx(Nt,{children:"Select headlines, generate a Naija Daily Brief script, edit and export for production."})]})]})}),r.jsxs(X,{className:"space-y-4",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"ep-title",children:"Episode Title"}),r.jsx(ge,{id:"ep-title",value:m,onChange:ke=>x(ke.target.value),placeholder:`Naija Daily Brief - ${Ue}`})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"presenter",children:"Presenter Name"}),r.jsx(ge,{id:"presenter",value:h,onChange:ke=>f(ke.target.value),placeholder:"e.g. Tunde, Amaka"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Estimated Runtime"}),r.jsxs(mt,{value:p,onValueChange:v,children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsx(ht,{children:[3,5,7,10,12,15].map(ke=>r.jsxs(Ne,{value:String(ke),children:[ke," minutes"]},ke))})]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Status"}),r.jsxs(mt,{value:V,onValueChange:ke=>Z(ke),children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"draft",children:"Draft"}),r.jsx(Ne,{value:"produced",children:"Produced"}),r.jsx(Ne,{value:"published",children:"Published"})]})]})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx(le,{children:"Hook (First 10 Seconds)"}),r.jsxs(W,{variant:"ghost",size:"sm",onClick:kt,children:[r.jsx(Va,{className:"h-3 w-3 mr-1"})," Generate"]})]}),r.jsx(ir,{value:g,onChange:ke=>y(ke.target.value),placeholder:"The attention-grabbing opening line...",className:"min-h-[70px]"})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Question of the Day"}),r.jsx(ir,{value:b,onChange:ke=>w(ke.target.value),placeholder:"e.g. Wetin you think about this new policy?",className:"min-h-[70px]"})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{children:"Intro Style"}),r.jsxs(mt,{value:_,onValueChange:C,children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"standard",children:"Standard"}),r.jsx(Ne,{value:"short",children:"Short"}),r.jsx(Ne,{value:"energetic",children:"Energetic"})]})]})]}),r.jsxs("div",{children:[r.jsx(le,{children:"Outro Style"}),r.jsxs(mt,{value:E,onValueChange:N,children:[r.jsx(ut,{children:r.jsx(pt,{})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"standard",children:"Standard"}),r.jsx(Ne,{value:"short",children:"Short"}),r.jsx(Ne,{value:"energetic",children:"Energetic"})]})]})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(W,{onClick:pe,variant:"outline",size:"sm",children:[r.jsx(ms,{className:"h-4 w-4 mr-1"})," Refresh Headlines"]}),r.jsxs(W,{onClick:St,variant:"outline",size:"sm",disabled:de,children:[r.jsx(Sm,{className:"h-4 w-4 mr-1"})," ",se?"Update Draft":"Save Draft"]})]})]})]}),r.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[r.jsxs("h3",{className:"text-lg font-semibold",children:["Select Headlines (",s.size," selected)"]}),d?r.jsx(Y,{children:r.jsx(X,{className:"py-8 text-center text-muted-foreground",children:"Loading today's headlines..."})}):t.length===0?r.jsx(Y,{children:r.jsx(X,{className:"py-8 text-center text-muted-foreground",children:"No approved headlines found for today."})}):Object.entries(ce).map(([ke,Ie])=>r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(te,{className:qe(ke),children:tt(ke)}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[Ie.length," stories"]})]}),r.jsx(W,{variant:"ghost",size:"sm",onClick:()=>oe(ke),children:"Select All"})]})}),r.jsx(X,{className:"space-y-3",children:Ie.map(at=>r.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border hover:bg-accent/50 transition-colors",children:[r.jsx(Uo,{checked:s.has(at.id),onCheckedChange:()=>xe(at.id)}),r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("p",{className:"text-sm font-medium leading-tight",children:at.title}),at.description&&r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:at.description}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Source: ",at.source]}),s.has(at.id)&&r.jsx(ir,{value:l[at.id]||"",onChange:rt=>c(Gt=>({...Gt,[at.id]:rt.target.value})),placeholder:"Edit Pidgin commentary...",className:"mt-2 text-sm min-h-[80px]"})]})]},at.id))})]},ke)),i.length>0&&r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-2",children:r.jsx(Ae,{className:"text-base",children:"ð Headline Order (drag to reorder)"})}),r.jsx(X,{className:"space-y-2",children:i.map((ke,Ie)=>{const at=De(ke);return at?r.jsxs("div",{className:"flex items-center gap-2 p-2 rounded border text-sm",children:[r.jsx("span",{className:"font-mono text-muted-foreground w-6 text-center",children:Ie+1}),r.jsx("span",{className:"flex-1 truncate",children:at.title}),r.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>we(Ie,-1),disabled:Ie===0,children:r.jsx(jie,{className:"h-3 w-3"})}),r.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>we(Ie,1),disabled:Ie===i.length-1,children:r.jsx(yie,{className:"h-3 w-3"})})]},ke):null})})]}),s.size>0&&r.jsxs(W,{onClick:et,size:"lg",className:"w-full",children:[r.jsx(Va,{className:"h-5 w-5 mr-2"})," Generate Script (",s.size," stories)"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-2",children:r.jsx(Ae,{className:"text-base",children:"ð Saved Scripts"})}),r.jsx(X,{className:"space-y-2 max-h-[300px] overflow-y-auto",children:q.length===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No saved scripts yet."}):q.map(ke=>r.jsxs("div",{className:"flex items-center gap-2 p-2 rounded border text-sm hover:bg-accent/50 cursor-pointer",onClick:()=>Ve(ke.id),children:[r.jsxs(te,{className:`${Ct(ke.status)} text-xs`,children:[st(ke.status)," ",ke.status]}),r.jsxs("div",{className:"flex-1 truncate",children:[r.jsx("p",{className:"font-medium truncate",children:ke.episode_title}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ke.episode_date})]}),r.jsx(W,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Ie=>{Ie.stopPropagation(),he(ke.id)},children:r.jsx(ao,{className:"h-3 w-3"})})]},ke.id))})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"pb-2",children:[r.jsx(Ae,{className:"text-base",children:"ð£ï¸ Pidgin Phrase Bank"}),r.jsx(Nt,{children:"Click to copy"})]}),r.jsx(X,{children:r.jsx("div",{className:"space-y-1 max-h-[300px] overflow-y-auto",children:Object.entries(jGe).map(([ke,Ie])=>r.jsxs("button",{onClick:()=>ye(Ie,"Phrase"),className:"block w-full text-left text-sm p-1.5 rounded hover:bg-accent transition-colors",children:[r.jsx("span",{className:"font-medium",children:Ie}),r.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:["(",ke.replace(/_/g," "),")"]})]},ke))})})]}),r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-2",children:r.jsx(Ae,{className:"text-base",children:"ð¡ Script Tips"})}),r.jsxs(X,{className:"text-sm space-y-1.5 text-muted-foreground",children:[r.jsx("p",{children:"⢠Add your own Pidgin English flavor"}),r.jsx("p",{children:"⢠Keep each story to 2-3 sentences"}),r.jsx("p",{children:"⢠Mix serious and light tones"}),r.jsx("p",{children:"⢠End gossip stories with humor"}),r.jsx("p",{children:"⢠Always mention naija.com in outro"})]})]})]})]}),k&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[U.length>0&&r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-2",children:r.jsx(Ae,{className:"text-base",children:"ð¬ YouTube Title Suggestions"})}),r.jsx(X,{className:"space-y-2",children:U.map((ke,Ie)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm flex-1",children:ke}),r.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ye(ke,"Title"),children:r.jsx(ah,{className:"h-3 w-3"})})]},Ie))})]}),L.length>0&&r.jsxs(Y,{children:[r.jsx(Se,{className:"pb-2",children:r.jsx(Ae,{className:"text-base",children:"ð¼ï¸ Thumbnail Text Suggestions"})}),r.jsx(X,{className:"space-y-2",children:L.map((ke,Ie)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm flex-1 font-bold",children:ke}),r.jsx(W,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ye(ke,"Thumbnail"),children:r.jsx(ah,{className:"h-3 w-3"})})]},Ie))})]})]}),r.jsxs(vGe,{children:[r.jsx(yGe,{asChild:!0,children:r.jsxs(W,{variant:"outline",size:"sm",className:"w-full",children:[r.jsx(tj,{className:"h-4 w-4 mr-1"})," Source Headlines Used (",i.length,")"]})}),r.jsx(bGe,{className:"mt-2",children:r.jsx(Y,{children:r.jsx(X,{className:"pt-4 space-y-1",children:i.map(ke=>{const Ie=De(ke);return Ie?r.jsxs("div",{className:"text-sm flex gap-2",children:[r.jsx(te,{variant:"outline",className:"text-xs shrink-0",children:Ie.source}),r.jsx("a",{href:Ie.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate",children:Ie.title})]},ke):null})})})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[r.jsx(Ae,{children:"Generated Script"}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>ye(k,"Full Script"),children:[r.jsx(ah,{className:"h-4 w-4
1278mr-1"})," Copy"]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:()=>Ee(k,"full"),children:[r.jsx(qh,{className:"h-4 w-4 mr-1"})," TXT"]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:Fe,children:[r.jsx(Ca,{className:"h-4 w-4 mr-1"})," PDF"]}),r.jsxs(W,{variant:"outline",size:"sm",onClick:St,disabled:de,children:[r.jsx(Sm,{className:"h-4 w-4 mr-1"})," Save"]})]})]})}),r.jsx(X,{children:r.jsxs(Kr,{defaultValue:"full",children:[r.jsxs(Hr,{className:"mb-3",children:[r.jsx(Re,{value:"full",children:"Full Script"}),r.jsx(Re,{value:"teleprompter",children:"Teleprompter"}),r.jsx(Re,{value:"youtube",children:"YouTube Description"})]}),r.jsx(Be,{value:"full",children:r.jsx(ir,{value:k,onChange:ke=>I(ke.target.value),className:"min-h-[500px] font-mono text-sm"})}),r.jsx(Be,{value:"teleprompter",children:r.jsx(ir,{value:P,onChange:ke=>O(ke.target.value),className:"min-h-[500px] text-lg leading-relaxed"})}),r.jsxs(Be,{value:"youtube",children:[r.jsx(ir,{value:A,onChange:ke=>R(ke.target.value),className:"min-h-[300px] font-mono text-sm"}),r.jsxs(W,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>ye(A,"YouTube Description"),children:[r.jsx(ah,{className:"h-4 w-4 mr-1"})," Copy Description"]})]})]})})]})]})]})}const EZe=864e5,TZe=30,$1=(e,t)=>`${t==="NGN"?"â¦":t==="USD"?"$":`${t} `}${e.toLocaleString(void 0,{maximumFractionDigits:0})}`,OZe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState(!0),[o,l]=j.useState({}),[c,d]=j.useState(null),u=j.useCallback(async()=>{i(!0);const x=new Date(Date.now()-TZe*EZe).toISOString(),[p,v]=await Promise.all([H.from("affiliate_partners").select("slug, name, category, network, payout_model, payout_amount, payout_currency, payout_note, public_url, affiliate_url, disclosure, is_active, display_order").order("display_order"),H.from("affiliate_clicks").select("created_at, partner_slug, page_url").gte("created_at",x).order("created_at",{ascending:!1}).limit(2e4)]);if(p.error)Et.error("Could not load partner list",{description:p.error.message});else{const g=p.data??[];t(g),l(y=>{const b={...y};return g.forEach(w=>{b[w.slug]===void 0&&(b[w.slug]=w.affiliate_url??"")}),b})}v.error?Et.error("Could not load click data",{description:v.error.message}):s(v.data??[]),i(!1)},[]);j.useEffect(()=>{u()},[u]);const h=j.useMemo(()=>{const x=new Map,p=new Map,v=new Map;n.forEach(y=>{x.set(y.partner_slug,(x.get(y.partner_slug)??0)+1);const b=y.created_at.slice(0,10);p.set(b,(p.get(b)??0)+1);const w=y.page_url?new URL(y.page_url).pathname:"direct";v.set(w,(v.get(w)??0)+1)});const g=e.reduce((y,b)=>{if(b.payout_model!=="per_click")return y;const w=x.get(b.slug)??0;return y+w*Number(b.payout_amount??0)},0);return{byPartner:x,byDay:Array.from(p.entries()).sort((y,b)=>y[0].localeCompare(b[0])),byPage:Array.from(v.entries()).sort((y,b)=>b[1]-y[1]).slice(0,6),estimated:g,total:n.length}},[n,e]),f=async x=>{const p=(o[x]??"").trim();if(p&&!/^https?:\/\//i.test(p)){Et.error("The link must start with http:// or https://");return}d(x);const{error:v}=await H.from("affiliate_partners").update({affiliate_url:p||null}).eq("slug",x);if(d(null),v){Et.error("Could not save the link",{description:v.message});return}t(g=>g.map(y=>y.slug===x?{...y,affiliate_url:p||null}:y)),Et.success("Partner link saved")},m=()=>{const x=["date,partner_slug,clicks"],p=new Map;n.forEach(b=>{const w=`${b.created_at.slice(0,10)},${b.partner_slug}`;p.set(w,(p.get(w)??0)+1)}),Array.from(p.entries()).sort((b,w)=>w[0].localeCompare(b[0])).forEach(([b,w])=>x.push(`${b},${w}`));const v=new Blob([x.join(` 1279`)],{type:"text/csv;charset=utf-8;"}),g=URL.createObjectURL(v),y=document.createElement("a");y.href=g,y.download=`affiliate-clicks-${new Date().toISOString().slice(0,10)}.csv`,y.click(),URL.revokeObjectURL(g)};return a?r.jsxs("div",{className:"space-y-4",children:[r.jsx(jn,{className:"h-24 w-full"}),r.jsx(jn,{className:"h-72 w-full"})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[{label:"Outbound clicks (30 days)",value:h.total.toLocaleString()},{label:"Active partners",value:String(e.filter(x=>x.is_active).length)},{label:"Programs with a link pasted",value:String(e.filter(x=>!!x.affiliate_url).length)},{label:"Estimated pay-per-click earnings",value:$1(h.estimated,"NGN")}].map(x=>r.jsx(Y,{children:r.jsxs(X,{className:"pt-6",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:x.label}),r.jsx("p",{className:"text-2xl font-semibold mt-1",children:x.value})]})},x.label))}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0",children:[r.jsx(Ae,{className:"text-base",children:"Partner programs and payout rates"}),r.jsxs(W,{size:"sm",variant:"outline",onClick:m,children:[r.jsx(qh,{className:"mr-2 h-4 w-4"}),"Export CSV"]})]}),r.jsx(X,{className:"px-0",children:r.jsxs(Ei,{children:[r.jsx(Ti,{children:r.jsxs(On,{children:[r.jsx(jt,{children:"Partner"}),r.jsx(jt,{children:"Pays"}),r.jsx(jt,{className:"text-right",children:"Clicks"}),r.jsx(jt,{children:"Affiliate link"}),r.jsx(jt,{})]})}),r.jsx(Oi,{children:e.map(x=>{const p=h.byPartner.get(x.slug)??0,v=x.payout_model==="per_click"?`${$1(Number(x.payout_amount),x.payout_currency)} / click`:x.payout_model==="per_signup"?`${$1(Number(x.payout_amount),x.payout_currency)} / signup`:x.payout_model==="per_sale"?`${$1(Number(x.payout_amount),x.payout_currency)} / sale`:"TBC";return r.jsxs(On,{children:[r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:x.name}),r.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["/",x.slug," · ",x.category,x.network?` · ${x.network}`:""]})]}),x.is_active?r.jsx(te,{variant:"outline",className:"text-[9px]",children:"live"}):r.jsx(te,{variant:"secondary",className:"text-[9px]",children:"paused"})]})}),r.jsx(wt,{className:"text-xs",children:v}),r.jsx(wt,{className:"text-right font-medium",children:p}),r.jsx(wt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Uie,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),r.jsx(ge,{value:o[x.slug]??"",onChange:g=>l(y=>({...y,[x.slug]:g.target.value})),placeholder:"Paste the tracked link from the network here",className:"h-8 text-xs"})]})}),r.jsx(wt,{children:r.jsxs(W,{size:"sm",variant:"ghost",disabled:c===x.slug,onClick:()=>void f(x.slug),children:[r.jsx(Sm,{className:"mr-1 h-3.5 w-3.5"}),"Save"]})})]},x.slug)})})]})})]}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-base",children:"Clicks by day"})}
1279),r.jsx(X,{className:"space-y-1.5",children:h.byDay.length===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No clicks recorded in the last 30 days."}):h.byDay.slice(-14).reverse().map(([x,p])=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-xs text-muted-foreground w-24 shrink-0",children:x}),r.jsx("div",{className:"h-2 rounded-full bg-muted flex-1 overflow-hidden",children:r.jsx("div",{className:"h-full rounded-full bg-primary/70",style:{width:`${Math.min(100,p/Math.max(1,h.total/6)*100)}%`}})}),r.jsx("span",{className:"text-xs font-medium w-8 text-right",children:p})]},x))})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-base",children:"Which pages send the clicks"})}),r.jsx(X,{children:h.byPage.length===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing to report yet."}):r.jsx("ul",{className:"space-y-2",children:h.byPage.map(([x,p])=>r.jsxs("li",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"truncate pr-3",children:x}),r.jsx("span",{className:"font-medium",children:p})]},x))})})]})]})]})},LZe=["pending","approved","live","ended","declined"],IZe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState([]),[o,l]=j.useState(!0),c=j.useCallback(async()=>{l(!0);const[h,f,m]=await Promise.all([H.from("newsletter_subscribers").select("email, created_at, source_page, status").eq("status","subscribed").order("created_at",{ascending:!1}).limit(5e3),H.from("profiles").select("preferred_city").not("preferred_city","is",null).limit(5e3),H.from("newsletter_sponsors").select("id, sponsor_name, contact_email, whatsapp, headline, blurb, image_url, target_url, placement, status, start_date, end_date, payment_status, payment_reference, notes").order("start_date",{ascending:!1}).limit(200)]);if(h.error?Et.error("Could not load subscriber list",{description:h.error.message}):t(h.data??[]),!f.error){const x=new Map;(f.data??[]).forEach(p=>{const v=(p.preferred_city??"").trim();v&&x.set(v,(x.get(v)??0)+1)}),s(Array.from(x.entries()).map(([p,v])=>({city:p,count:v})).sort((p,v)=>v.count-p.count).slice(0,6))}m.error?Et.error("Could not load sponsor queue",{description:m.error.message}):i(m.data??[]),l(!1)},[]);j.useEffect(()=>{c()},[c]);const d=j.useMemo(()=>{const h=new Date(Date.now()-2592e6).toISOString(),f=e.filter(x=>x.created_at>=h),m=new Map;return e.forEach(x=>{const p=x.source_page?new URL(x.source_page).pathname:"other";m.set(p,(m.get(p)??0)+1)}),{total:e.length,growth:f.length,topSources:Array.from(m.entries()).sort((x,p)=>p[1]-x[1]).slice(0,5)}},[e]),u=async(h,f)=>{const{error:m}=await H.from("newsletter_sponsors").update({status:f}).eq("id",h);if(m){Et.error("Could not update the sponsor",{description:m.message});return}i(x=>x.map(p=>p.id===h?{...p,status:f}:p)),Et.success("Sponsor updated")};return o?r.jsxs("div",{className:"space-y-4",children:[r.jsx(jn,{className:"h-24 w-full"}),r.jsx(jn,{className:"h-64 w-full"})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsx(Y,{children:r.jsxs(X,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Yr,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Verified subscribers"})]}),r.jsx("p",{className:"text-3xl font-semibold mt-1",children:d.total.toLocaleString()}),r.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Counted from real sign-ups on this site."})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(lr,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"New in last 30 days"})]}),r.jsxs("p",{className:"text-3xl font-semibold mt-1",children:["+",d.growth.toLocaleString()]}),r.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:d.total>0?`${Math.round(d.growth/d.total*100)}% of the list`:"No list yet"})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(At,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Top locations"})]}),n.length===0?r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"No locations captured yet."}):r.jsx("ul",{className:"mt-2 space-y-1",children:n.slice(0,4).map(h=>r.jsxs("li",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"truncate pr-2",children:h.city}),r.jsx("span",{className:"font-medium",children:h.count})]},h.city))})]})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-base",children:"Sponsor queue"})}),r.jsx(X,{children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No sponsorship applications yet. They appear here when someone books a newsletter slot."}):r.jsx("div",{className:"space-y-3",children:a.map(h=>r.jsx("div",{className:"rounded-lg border p-4",children:r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("p",{className:"font-semibold text-sm",children:h.sponsor_name}),r.jsx(te,{variant:h.status==="live"?"default":"secondary",className:"text-[10px]",children:h.status}),r.jsx(te,{variant:"outline",className:"text-[10px]",children:h.placement})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[h.start_date??"No start date",h.end_date?` â ${h.end_date}`:""," · payment"," ",h.payment_status]}),r.jsxs("div",{className:"mt-3 rounded-lg border bg-muted/40 p-3",children:[r.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-1",children:"How the creative will look in the issue"}),r.jsx("p",{className:"text-sm font-medium",children:h.headline}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1 leading-relaxed",children:h.blurb}),h.target_url?r.jsxs("p",{className:"text-[11px] text-muted-foreground mt-1.5 break-all",children:["â ",h.target_url]}
1279):null]}),h.notes?r.jsx("p",{className:"text-xs text-muted-foreground mt-2 italic",children:h.notes}):null]}),r.jsx("div",{className:"w-36",children:r.jsxs(mt,{value:h.status,onValueChange:f=>void u(h.id,f),children:[r.jsx(ut,{className:"h-8 text-xs",children:r.jsx(pt,{})}),r.jsx(ht,{children:LZe.map(f=>r.jsx(Ne,{value:f,children:f},f))})]})})]})},h.id))})})]}),r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-base",children:"Where sign-ups come from"})}),r.jsxs(X,{children:[d.topSources.length===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No sign-ups captured yet."}):r.jsx("ul",{className:"space-y-2",children:d.topSources.map(([h,f])=>r.jsxs("li",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"truncate pr-3",children:h}),r.jsx("span",{className:"font-medium",children:f})]},h))}),r.jsx(W,{size:"sm",variant:"outline",className:"mt-4",onClick:()=>void c(),children:"Refresh numbers"})]})]})]})},RZe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],MZe=()=>{const e=new Date,t=e.getDay(),n=t===0?1:8-t;return e.setDate(e.getDate()+n),e.toISOString().slice(0,10)},Ef=(e,t=120)=>(e??"").replace(/<[^>]*>/g,"").replace(/\s+/g," ").trim().slice(0,t),DZe=()=>{const[e,t]=j.useState([]),[n,s]=j.useState([]),[a,i]=j.useState(0),[o,l]=j.useState(!0),[c,d]=j.useState(!1),[u,h]=j.useState(!1),[f,m]=j.useState(null),[x,p]=j.useState(""),[v,g]=j.useState(""),[y,b]=j.useState("none"),w=j.useCallback(async()=>{l(!0);const[I,P,O]=await Promise.all([H.from("newsletter_issues").select("id, issue_date, subject, status, body_text, sponsor_summary, subscriber_count, sent_at").order("issue_date",{ascending:!1}).limit(60),H.from("newsletter_sponsors").select("id, sponsor_name, headline, blurb, target_url, placement, status, start_date").in("status",["approved","live"]).order("start_date",{ascending:!1}).limit(50),H.from("newsletter_subscribers").select("id",{count:"exact",head:!0}).eq("status","subscribed")]);if(I.error)Et.error("Could not load issues",{description:I.error.message});else{const A=I.data??[];t(A),m(R=>R??A.find(L=>L.status==="draft")??A[0]??null)}P.error||s(P.data??[]),O.error||i(O.count??0),l(!1)},[]);j.useEffect(()=>{w()},[w]),j.useEffect(()=>{f&&(p(f.body_text??""),g(f.subject??""))},[f]);const _=async()=>{d(!0);try{const I=new Date(Date.now()-6048e5).toISOString(),P=new Date().toISOString(),[O,A,R]=await Promise.all([H.from("curated_headlines").select("id, title, region, source, url").eq("approved",!0).gte("created_at",I).order("vote_score",{ascending:!1}).limit(40),H.from("imported_events").select("id, title, city, start_datetime, source_url").eq("is_active",!0).gte("start_datetime",P).order("start_datetime",{ascending:!0}).limit(5),H.from("imported_jobs").select("id, title, company, location, apply_url").eq("is_active",!0).gte("last_seen_at",I).order("last_seen_at",{ascending:!1}).limit(6)]),L=O.data??[],z=A.data??[],U=R.data??[],$=new Map;L.forEach(Z=>{const de=Ef(Z.region,24)||"Other";$.set(de,[...$.get(de)??[],Z])});const q=n.find(Z=>Z.status==="live")??n[0]??null,ne=[];ne.push(`THE NAIJA.COM WEEKLY â ${new Date().toDateString()}`),ne.push(""),q&&(ne.push(`SPONSOR: ${q.sponsor_name}`),ne.push(q.headline),ne.push(Ef(q.blurb,300)),q.target_url&&ne.push(`Read more: ${q.target_url}`),ne.push(""),ne.push("â end of sponsor message â"),ne.push("")),$.forEach((Z,de)=>{ne.push(de.toUpperCase()),Z.slice(0,6).forEach(ve=>ne.push(`⢠${Ef(ve.title,110)} â ${ve.url}`)),ne.push("")}),z.length>0&&(ne.push("THIS WEEK, IN PERSON"),z.forEach(Z=>ne.push(`⢠${Ef(Z.title,90)}${Z.city?` (${Z.city})`:""} â ${Z.source_url}`)),ne.push("")),U.length>0&&(ne.push("FRESH ROLES"),U.forEach(Z=>ne.push(`⢠${Ef(Z.title,80)}${Z.company?` @ ${Ef(Z.company,40)}`:""} â ${Z.apply_url}`)),ne.push("")),ne.push("You are receiving this because you signed up at naija.com."),ne.push("Reply to stop the digest, or manage your details any time.");const se=MZe(),F=`Naija.com Weekly â ${new Date(se).toLocaleDateString("en-GB",{day:"numeric",month:"short"})}`,{error:V}=await H.from("newsletter_issues").insert({issue_date:se,subject:F,status:"draft",body_text:ne.join(` 1280`),body_html:null,sponsor_summary:q?`${q.sponsor_name}
1280: ${Ef(q.headline,90)}`:null,subscriber_count:a});if(V){Et.error("Could not save the draft",{description:V.message});return}q&&await H.from("newsletter_sponsors").update({issue_id:null}).eq("id",q.id),Et.success(`Draft built for ${RZe[new Date(se).getDay()]} ${se}`),await w()}catch(I){console.error("newsletter issue build failed",I),Et.error("Could not build the draft")}finally{d(!1)}},C=async()=>{if(!f)return;h(!0);const{error:I}=await H.from("newsletter_issues").update({subject:v,body_text:x}).eq("id",f.id);if(h(!1),I){Et.error("Could not save",{description:I.message});return}t(P=>P.map(O=>O.id===f.id?{...O,subject:v,body_text:x}:O)),Et.success("Draft saved")},E=async()=>{if(!f)return;const{error:I}=await H.from("newsletter_issues").update({status:"sent",sent_at:new Date().toISOString(),subscriber_count:a}).eq("id",f.id);if(I){Et.error("Could not mark as sent",{description:I.message});return}y!=="none"&&await H.from("newsletter_sponsors").update({issue_id:f.id,status:"live"}).eq("id",y),Et.success("Marked as sent"),await w()},N=async()=>{try{await navigator.clipboard.writeText(x),Et.success("Copied â ready to paste into Mailchimp")}catch{Et.error("Copy blocked by the browser. Select the text manually.")}},k=j.useMemo(()=>n.filter(I=>I.status==="approved"||I.status==="live"),[n]);return o?r.jsxs("div",{className:"space-y-4",children:[r.jsx(jn,{className:"h-16 w-full"}),r.jsx(jn,{className:"h-96 w-full"})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Y,{children:r.jsxs(X,{className:"pt-6 flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Assemble the next digest"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pulls approved headlines, upcoming events and fresh jobs, then puts the sponsor block at the top. ",a.toLocaleString()," subscribers on the list."]})]}),r.jsxs(W,{onClick:()=>void _(),disabled:c,children:[r.jsx(Va,{className:"mr-2 h-4 w-4"}),c?"Buildingâ¦":"Build this weekâs draft"]})]})}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[260px_1fr]",children:[r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-base",children:"Issues"})}),r.jsx(X,{className:"space-y-2 max-h-[520px] overflow-y-auto",children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues yet. Build the first draft to get started."}):e.map(I=>r.jsxs("button",{type:"button",onClick:()=>m(I),className:`w-full rounded-lg border p-3 text-left transition-colors ${(f==null?void 0:f.id)===I.id?"border-primary bg-primary/5":"hover:bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:I.issue_date}),r.jsx(te,{variant:I.status==="sent"?"default":"secondary",className:"text-[9px]",children:I.status})]}),r.jsx("p",{className:"text-[11px] text-muted-foreground mt-1 truncate",children:I.subject})]},I.id))})]}),r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0",children:[r.jsx(Ae,{className:"text-base",children:f?`Issue for ${f.issue_date}`:"Nothing selected"}),f?r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>void N(),children:[r.jsx(ah,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy"]}),r.jsxs(W,{size:"sm",variant:"outline",onClick:()=>void C(),disabled:u,children:[r.jsx(Sm,{className:"mr-1.5 h-3.5 w-3.5"}),"Save"]}),r.jsxs(W,{size:"sm",onClick:()=>void E(),disabled:f.status==="sent",children:[r.jsx(Jc,{className:"mr-1.5 h-3.5 w-3.5"}),f.status==="sent"?"Sent":"Mark sent"]})]}):null]}),r.jsx(X,{className:"space-y-3",children:f?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(le,{className:"text-xs",children:"Subject line"}),r.jsx(ge,{value:v,onChange:I=>g(I.target.value),className:"h-9 text-sm"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(le,{className:"text-xs",children:"Attach a sponsor to this issue"}),r.jsxs(mt,{value:y,onValueChange:b,children:[r.jsx(ut,{className:"h-9 text-sm",children:r.jsx(pt,{placeholder:"No sponsor attached"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"none",children:"No sponsor attached"}),k.map(I=>r.jsxs(Ne,{value:I.id,children:[I.sponsor_name," â ",I.placement]},I.id))]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(le,{className:"text-xs",children:"Issue body"}),r.jsx(ir,{value:x,onChange:I=>p(I.target.value),className:"min-h-[420px] font-mono text-xs leading-relaxed"})]}),r.jsxs("p",{className:"text-[11px] text-muted-foreground flex items-center gap-1.5",children:[r.jsx(Dn,{className:"h-3.5 w-3.5"}),"Paste this into your email tool, then mark it sent so the sponsor record and subscriber count are kept."]})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select an issue on the left, or build a new draft."})})]})]})]})},IC=e=>{if(!e)return"0 B";const t=["B","KB","MB","GB"],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1);return`${(e/Math.pow(1024,n)).toFixed(n===0?0:1)} ${t[n]}`},$Ze=()=>{var c,d;const[e,t]=j.useState(null),[n,s]=j.useState(!0),[a,i]=j.useState(null),o=async()=>{s(!0),i(null);const{data:u,error:h}=await H.rpc("get_database_size_report");h?(i(h.message),t(null)):t(u),s(!1)};j.useEffect(()=>{o()},[]);const l=((d=(c=e==null?void 0:e.tables)==null?void 0:c[0])==null?void 0:d.total_bytes)||1;return r.jsxs(Y,{children:[r.jsxs(Se,{className:"flex flex-row items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(AT,{className:"h-5 w-5"}),"Database Storage"]}),r.jsx(Nt,{children:"Total size and the largest tables. Old news and logs are cleaned up automatically each night."})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[e&&r.jsx(te,{variant:"secondary",className:"whitespace-nowrap",children:IC(e.database_bytes)}),r.jsx(W,{variant:"outline",size:"icon",onClick:o,disabled:n,children:r.jsx(ms,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]})]}),r.jsxs(X,{children:[a&&r.jsx("p",{className:"text-sm text-destructive",children:a}),!a&&n&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loadingâ¦"}),!a&&!n&&e&&r.jsx("div",{className:"space-y-3",children:e.tables.map(u=>r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[r.jsx("span",{className:"font-medium truncate",children:u.table_name}),r.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[IC(u.total_bytes),u.index_bytes>0&&` · ${IC(u.index_bytes)} indexes`]})]}),r.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary",style:{width:`${Math.max(2,u.total_bytes/l*100)}%`}})})]},u.table_name))})]})]})};function FZe(){const{user:e}=bt(),{isAdmin:t,loading:n}=fj(),[s,a]=j.useState({totalUsers:0,pendingReviews:0,kycPending:0,activeAds:0,monthlyRevenue:0,pendingClassifieds:0,pendingProperties:0,pendingRestaurants:0,pendingRentalCars:0,pendingArtisans:0,pendingTravelServices:0}),[i,o]=j.useState(!0);j.useEffect(()=>{t&&!n&&l()},[t,n]);const l=async()=>{try{const[{count:c},{count:d},{count:u},{data:h},{count:f},{count:m},{count:x},{count:p},{count:v},{count:g}]=await Promise.all([H.from("profiles").select("*",{count:"exact",head:!0}),H.from("moderation_queue").select("*",{count:"exact",head:!0}),H.from("profiles").select("*",{count:"exact",head:!0}
1280).eq("kyc_status","pending"),H.from("advertisements").select("*").eq("status","active"),H.from("classifieds").select("*",{count:"exact",head:!0}).eq("moderation_status","pending"),H.from("properties").select("*",{count:"exact",head:!0}).eq("moderation_status","pending"),H.from("rental_cars").select("*",{count:"exact",head:!0}).eq("moderation_status","pending"),H.from("restaurants").select("*",{count:"exact",head:!0}).eq("moderation_status","pending"),H.from("artisans").select("*",{count:"exact",head:!0}).eq("moderation_status","pending"),H.from("restaurants").select("*",{count:"exact",head:!0}).eq("moderation_status","pending")]),y=(h==null?void 0:h.reduce((b,w)=>b+(w.monthly_cost||0),0))||0;a({totalUsers:c||0,pendingReviews:d||0,kycPending:u||0,activeAds:(h==null?void 0:h.length)||0,monthlyRevenue:y,pendingClassifieds:f||0,pendingProperties:m||0,pendingRestaurants:p||0,pendingRentalCars:x||0,pendingArtisans:v||0,pendingTravelServices:g||0})}catch(c){console.error("Error fetching metrics:",c)}finally{o(!1)}};return e?n?r.jsx("div",{className:"min-h-screen flex items-center justify-center",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):t?r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"container-mobile mx-auto py-6 md:py-8",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-6 md:mb-8",children:[r.jsx(fn,{className:"h-6 w-6 md:h-8 md:w-8 text-primary"}),r.jsx("h1",{className:"text-2xl md:text-3xl font-bold",children:"Admin Dashboard"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-6 gap-4 md:gap-6 mb-6 md:mb-8",children:[r.jsxs(Y,{className:"animate-fade-in",children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(Yr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-xl md:text-2xl font-bold",children:i?"...":s.totalUsers.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Registered platform users"})]})]}),r.jsxs(Y,{className:"animate-fade-in",children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Pending Reviews"}),r.jsx(W4,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-xl md:text-2xl font-bold",children:i?"...":s.pendingReviews}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Items awaiting moderation"})]})]}),r.jsxs(Y,{className:"animate-fade-in",children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Classifieds Queue"}),r.jsx(fr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-xl md:text-2xl font-bold",children:i?"...":s.pendingClassifieds}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending approval"})]})]}),r.jsxs(Y,{className:"animate-fade-in",children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Properties Queue"}),r.jsx(en,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-xl md:text-2xl font-bold",children:i?"...":s.pendingProperties}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending approval"})]})]}),r.jsxs(Y,{className:"animate-fade-in",children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Rental Cars Queue"}),r.jsx(xa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-xl md:text-2xl font-bold",children:i?"...":s.pendingRentalCars}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending approval"})]})]}),r.jsxs(Y,{className:"animate-fade-in",children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Artisans Queue"}),r.jsx(fr,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-xl md:text-2xl font-bold",children:i?"...":s.pendingArtisans}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending approval"})]})]}),r.jsxs(Y,{className:"animate-fade-in",children:[r.jsxs(Se,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Ae,{className:"text-sm font-medium",children:"Monthly Revenue"}),r.jsx(Tn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(X,{children:[r.jsx("div",{className:"text-xl md:text-2xl font-bold",children:i?"...":`â¦${s.monthlyRevenue.toLocaleStr
1280ing()}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"From active campaigns"})]})]})]}),r.jsxs(Kr,{defaultValue:"overview",className:"space-y-4 md:space-y-6",children:[r.jsxs(Hr,{className:"flex flex-wrap gap-1 h-auto p-2",children:[r.jsx(Re,{value:"overview",className:"text-xs md:text-sm",children:"Overview"}),r.jsx(Re,{value:"subscriptions",className:"text-xs md:text-sm",children:"Subscriptions"}),r.jsx(Re,{value:"properties",className:"text-xs md:text-sm",children:"Properties"}),r.jsx(Re,{value:"rental-cars",className:"text-xs md:text-sm",children:"Rental Cars"}),r.jsx(Re,{value:"restaurants",className:"text-xs md:text-sm",children:"Restaurants"}),r.jsx(Re,{value:"classifieds",className:"text-xs md:text-sm",children:"Classifieds"}),r.jsx(Re,{value:"artisans",className:"text-xs md:text-sm",children:"Artisans"}),r.jsx(Re,{value:"travel-services",className:"text-xs md:text-sm",children:"Travel Services"}),r.jsx(Re,{value:"tour-packages",className:"text-xs md:text-sm",children:"Tour Packages"}),r.jsx(Re,{value:"news",className:"text-xs md:text-sm",children:"News"}),r.jsx(Re,{value:"rss",className:"text-xs md:text-sm",children:"RSS"}),r.jsx(Re,{value:"moderation",className:"text-xs md:text-sm",children:"Old Queue"}),r.jsx(Re,{value:"universal",className:"text-xs md:text-sm",children:"Moderation"}),r.jsx(Re,{value:"users",className:"text-xs md:text-sm",children:"Users"}),r.jsx(Re,{value:"advertisements",className:"text-xs md:text-sm",children:"Ads"}),r.jsx(Re,{value:"ad-pricing",className:"text-xs md:text-sm",children:"Ad Pricing"}),r.jsx(Re,{value:"airtime",className:"text-xs md:text-sm",children:"Airtime"}),r.jsx(Re,{value:"badges",className:"text-xs md:text-sm",children:"Badge Verification"}),r.jsx(Re,{value:"marketing",className:"text-xs md:text-sm",children:"Marketing"}),r.jsx(Re,{value:"analytics",className:"text-xs md:text-sm",children:"Analytics"}),r.jsx(Re,{value:"video-scripts",className:"text-xs md:text-sm",children:"Video Scripts"}),r.jsx(Re,{value:"affiliates",className:"text-xs md:text-sm",children:"Affiliates"}),r.jsx(Re,{value:"newsletter",className:"text-xs md:text-sm",children:"Newsletter"}),r.jsx(Re,{value:"settings",className:"text-xs md:text-sm",children:"Settings"})]}),r.jsx(Be,{value:"overview",className:"space-y-4 md:space-y-6",children:r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Recent Activity"}),r.jsx(Nt,{children:"Latest platform activity and updates"})]}),r.jsx(X,{className:"max-h-[400px] overflow-y-auto",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(vn,{className:"h-4 w-4 text-orange-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"New moderation requests"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.pendingReviews," items pending"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(fr,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"Classifieds awaiting review"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.pendingClassifieds," listings pending"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(en,{className:"h-4 w-4 text-blue-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"Properties awaiting review"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.pendingProperties," listings pending"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(xa,{className:"h-4 w-4 text-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"Rental cars awaiting review"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.pendingRentalCars," listings pending"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(Lo,{className:"h-4 w-4 text-purple-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"Restaurants awaiting review"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.pendingRestaurants," listings pending"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(lr,{className:"h-4 w-4 text-green-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"Active advertisements"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.activeAds," campaigns running"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(fm,{className:"h-4 w-4 text-indigo-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"Travel services awaiting review"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.pendingTravelServices," listings pending"]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-accent/50 rounded-lg",children:[r.jsx(Yr,{className:"h-4 w-4 text-blue-500"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm font-medium",children:"Platform growth"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.totalUsers," registered users"]})]})]})]})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Qu
1280ick Actions"}),r.jsx(Nt,{children:"Common administrative tasks"})]}),r.jsx(X,{className:"max-h-[400px] overflow-y-auto",children:r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="subscriptions"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(Tn,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Manage subscriptions"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Revenue & vendor plans"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="classifieds"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(fr,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Review classifieds"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Approve job listings"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="properties"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(en,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Review properties"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Approve lodging listings"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="travel-services"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(fm,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Review travel services"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Approve tourism listings"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="rental-cars"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(xa,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Review rental cars"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Approve vehicle listings"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="restaurants"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(Lo,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Review restaurants"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Approve listings"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="moderation"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(W4,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Review pending content"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Moderate user submissions"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="advertisements"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(Qd,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Manage advertisements"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Review ad campaigns"})]})]}),r.jsxs("button",{onClick:()=>{const c=document.querySelector('[value="users"]');c==null||c.click()},className:"flex items-center gap-3 p-3 text-left hover:bg-accent rounded-lg transition-colors",children:[r.jsx(Yr,{className:"h-4 w-4 text-primary"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Manage user roles"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Update permissions"})]})]})]})})]})]})}),r.jsx(Be,{value:"subscriptions",className:"space-y-4 md:space-y-6",children:r.jsx(GHe,{})}),r.jsx(Be,{value:"restaurants",className:"space-y-4 md:space-y-6",children:r.jsx(rGe,{})}),r.jsx(Be,{value:"properties",className:"space-y-4 md:space-y-6",children:r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ae,{children:"Property Management"}),r.jsx(Nt,{children:"Review and manage lodging listings"})]}),r.jsx(Py,{tableName:"properties"})]})}),r.jsx(X,{children:r.jsx(ZHe,{})})]})}),r.jsx(Be,{value:"rental-cars",className:"space-y-4 md:space-y-6",children:r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(xa,{
1280className:"h-5 w-5"}),"Rental Cars & Equipment Management"]}),r.jsx(Nt,{children:"Review and manage vehicle rental listings"})]}),r.jsx(Py,{tableName:"rental_cars"})]})}),r.jsx(X,{children:r.jsx(nGe,{})})]})}),r.jsx(Be,{value:"artisans",children:r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(fr,{className:"h-5 w-5"}),"Artisan Management"]}),r.jsx(Nt,{children:"Review and manage service provider listings"})]}),r.jsx(Py,{tableName:"artisans"})]})}),r.jsx(X,{children:r.jsx(sGe,{})})]})}),r.jsx(Be,{value:"travel-services",className:"space-y-4 md:space-y-6",children:r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(fm,{className:"h-5 w-5"}),"Travel Services Management"]}),r.jsx(Nt,{children:"Review and manage travel service listings"})]}),r.jsx(Py,{tableName:"travel_services"})]})}),r.jsx(X,{children:r.jsx(aGe,{})})]})}),r.jsx(Be,{value:"tour-packages",className:"space-y-4 md:space-y-6",children:r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(rj,{className:"h-5 w-5"}),"Tour Packages Management"]}),r.jsx(Nt,{children:"Seed and manage tour package listings"})]}),r.jsx(Py,{tableName:"tour_packages"})]})}),r.jsx(X,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tour packages management coming soon. Use the Seed button to populate listings."})})]})}),r.jsx(Be,{value:"classifieds",className:"space-y-4 md:space-y-6",children:r.jsx(YHe,{})}),r.jsx(Be,{value:"news",className:"space-y-4 md:space-y-6",children:r.jsx(JHe,{})}),r.jsx(Be,{value:"rss",className:"space-y-4 md:space-y-6",children:r.jsx(QHe,{})}),r.jsx(Be,{value:"moderation",className:"space-y-4 md:space-y-6",children:r.jsx(oSe,{})}),r.jsx(Be,{value:"universal",className:"space-y-4 md:space-y-6",children:r.jsx(lSe,{})}),r.jsx(Be,{value:"users",className:"space-y-4 md:space-y-6",children:r.jsx(XHe,{})}),r.jsxs(Be,{value:"advertisements",className:"space-y-4 md:space-y-6",children:[r.jsx(cSe,{}),r.jsx(dSe,{})]}),r.jsxs(Be,{value:"analytics",className:"space-y-4 md:space-y-6",children:[r.jsx($Ze,{}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Revenue Analytics"}),r.jsx(Nt,{children:"Advertisement revenue breakdown"})]}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Monthly Revenue"}),r.jsxs("span",{className:"font-semibold",children:["â¦",s.monthlyRevenue.toLocaleString()]})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Campaigns"}),r.jsx("span",{className:"font-semibold",children:s.activeAds})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Avg. Campaign Value"}),r.jsxs("span",{className:"font-semibold",children:["â¦",s.activeAds>0?Math.round(s.monthlyRevenue/s.activeAds).toLocaleString():0]})]})]})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Platform Usage"}),r.jsx(Nt,{children:"User engagement metrics"})]}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Users"}),r.jsx("span",{className:"font-semibold",children:s.totalUsers.toLocaleString()})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Pending Reviews"}),r.jsx("span",{className:"font-semibold",children:s.pendingReviews})]}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"KYC Pending"}),r.jsx("span",{className:"font-semibold",children:s.kycPending})]})]})})]})]})]}),r.jsx(Be,{value:"affiliates",className:"space-y-4 md:space-y-6",children:r.jsx(OZe,{})}),r.jsxs(Be,{value:"newsletter",className:"space-y-4 md:space-y-6",children:[r.jsx(IZe,{}),r.jsx(DZe,{})]}),r.jsx(Be,{value:"settings",className:"space-y-4 md:space-y-6",children:r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Platform Settings"}),r.jsx(Nt,{children:"Configure platform-wide settings"})]}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:"Advertisement Pricing"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage pricing tiers"})]}),r.jsx("button",{className:"text-primary hover:underline text-sm",children:"Configure"})]}),r.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:"Platform Fees"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Transaction fee settings"})]}),r.jsx("button",{className:"text-primary hover:underline text-sm",children:"Configure"})]}),r.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:"Email Templates"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Notification templates"})]}),r.jsx("button",{className:"text-primary hover:underline text-sm",children:"Configure"})]})]})})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Security Settings"}),r.jsx(Nt,{children:"Platform security configuration"})]}),r.jsx(X,{children:r.jsxs("div",{className:"space-y-4 text-sm",children:[r.jsxs("div",{className:"p-3 bg-green-50 border border-green-200 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(W4,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{className:"font-medium text-green-800",children:"RLS Enabled"})]}),r.jsx("p",{className:"text-green-600 mt-1",children:"Row Level Security is active"})]}),r.jsxs("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vn,{className:"h-4 w-4 text-yellow-600"}),r.jsx("span",{className:"font-medium text-yellow-800",children:"Password Security"})]}),r.jsx("p",{className:"text-yellow-600 mt-1",children:"Enable leaked password protection in Supabase"})]})]})})]})]})}),r.jsx(Be,{value:"airtime",className:"space-y-4 md:space-y-6",children:r.jsx(uSe,{})}),r.jsx(Be,{value:"badges",className:"space-y-4 md:space-y-6",children:r.jsx(eGe,{})}),r.jsx(Be,{value:"ad-pricing",className:"space-y-4 md:space-y-6",children:r.jsx(iGe,{})}),r.jsx(Be,{value:"marketing",className:"space-y-4 md:space-y-6",children:r.jsx(oGe,{})}),r.jsx(Be,{value:"video-scripts",className:"space-y-4 md:space-y-6",children:r.jsx(PZe,{})})]})]})}):r.jsx(V0,{to:"/",replace:!0}):r.jsx(V0,{to:"/auth",replace:!0})}function BZe({headline:e,showVoting:t=!1}){const{user:n}=bt(),[s,a]=j.useState(e.vote_score),[i,o]=j.useState(null),[l,c]=j.useState(!1),d=async h=>{if(!n){be({title:"Sign in required",description:"Please sign in to vote on headlines",variant:"destructive"});return}c(!0);try{const{data:f,error:m}=await H.functions.invoke("vote-headline",{body:{headline_id:e.id,vote_type:h}});if(m)throw m;f.action==="added"?(o(h),a(x=>x+(h==="up"?1:-1))):f.action==="changed"?(o(h),a(x=>x+(h==="up"?2:-2))):f.action==="removed"&&(a(x=>x-(i==="up"?1:-1)),o(null)),be({title:"Success",description:f.message})}catch(f){console.error("Vote error:",f),be({title:"Error",description:f.message||"Failed to vote",variant:"destructive"})}finally{c(!1)}},u=()=>
1280{be({title:"Report submitted",description:"Thank you for helping keep our community safe"})};return r.jsxs(Y,{className:"flex flex-col h-full hover:shadow-lg transition-shadow",children:[e.image_url&&r.jsx("div",{className:"relative h-48 w-full overflow-hidden rounded-t-lg bg-muted",children:r.jsx("img",{src:vl(e.image_url),alt:e.title,loading:"lazy",decoding:"async",className:"h-full w-full object-cover transition-transform hover:scale-105",onError:h=>{h.currentTarget.src="/placeholder.svg",h.currentTarget.style.objectFit="contain"}})}),r.jsxs(Se,{className:"flex-1",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[r.jsx(te,{variant:"secondary",className:"text-xs",children:e.category||"General"}),r.jsx(W,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:u,children:r.jsx($N,{className:"h-4 w-4"})})]}),r.jsx("h3",{className:"text-lg font-semibold line-clamp-3 mb-2",children:e.title}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:e.description})]}),r.jsxs(X,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:e.source}),r.jsx("span",{children:Im(new Date(e.created_at),{addSuffix:!0})})]}),t&&r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(W,{variant:"ghost",size:"icon",className:`h-8 w-8 ${i==="up"?"text-primary":""}`,onClick:()=>d("up"),disabled:l,children:r.jsx(Wq,{className:"h-5 w-5"})}),r.jsx("span",{className:`font-semibold min-w-[2rem] text-center ${s>0?"text-green-600":s<0?"text-red-600":""}`,children:s}),r.jsx(W,{variant:"ghost",size:"icon",className:`h-8 w-8 ${i==="down"?"text-destructive":""}`,onClick:()=>d("down"),disabled:l,children:r.jsx(tj,{className:"h-5 w-5"})})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(dl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:e.comment_count})]})]})]}),r.jsx(kj,{children:r.jsxs(W,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(e.url,"_blank","noopener,noreferrer"),children:["Read More",r.jsx(ds,{className:"h-4 w-4"})]})})]})}function UZe(){const[e,t]=j.useState(!1);return{checkRateLimit:async s=>{t(!0);try{return console.log("Rate limiting disabled - check_rate_limit function not implemented"),{allowed:!0,remaining:void 0,retryAfter:void 0,blockedUntil:void 0}}catch(a){return console.error("Rate limit check failed:",a),{allowed:!0}}finally{t(!1)}},isChecking:e}}function zZe({onSubmitted:e}){const[t,n]=j.useState(""),[s,a]=j.useState("General"),[i,o]=j.useState(!1),{checkRateLimit:l}=UZe(),c=async d=>{if(d.preventDefault(),!t.trim()){be({title:"Error",description:"Please enter a valid URL",variant:"destructive"});return}if((await l({endpoint:"submit_headline",maxRequests:5,windowMinutes:1440})).allowed){o(!0);try{const{data:h,error:f}=await H.functions.invoke("submit-user-headline",{body:{url:t.trim(),category:s}});if(f)throw f;be({title:"Success!",description:h.message||"Your headline has been submitted"}),n(""),a("General"),e()}catch(h){console.error("Submit error:",h),be({title:"Error",description:h.message||"Failed to submit headline",variant:"destructive"})}finally{o(!1)}}};return r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(zie,{className:"h-5 w-5"}),"Submit a Story"]}),r.jsx(Nt,{children:"Share interesting news, articles, or stories with the community"})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:c,className:"space-y-4",children:[r.jsx("div",{children:r.jsx(ge,{type:"url",placeholder:"https://example.com/article",value:t,onChange:d=>n(d.target.value),disabled:i,required:!0})}),r.jsx("div",{children:r.jsxs(mt,{value:s,onValueChange:a,disabled:i,children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select category"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"General",children:"General"}),r.jsx(Ne,{value:"Politics",children:"Politics"}),r.jsx(Ne,{value:"Business",children:"Business"}),r.jsx(Ne,{value:"Sports",children:"Sports"}),r.jsx(Ne,{value:"Entertainment",children:"Entertainment"}),r.jsx(Ne,{value:"Technology",children:"Technology"}),r.jsx(Ne,{value:"Lifestyle",children:"Lifestyle"})]})]})}),r.jsxs(_r,{children:[r.jsx(vn,{className:"h-4 w-4"}),r.jsxs(Sr,{className:"text-sm",children:[r.jsx("strong",{children:"Guidelines:"})," Only submit HTTPS links from reputable sources. Your account must be at least 7 days old. Maximum 5 submissions per day."]})]}),r.jsx(W,{type:"submit",className:"w-full",disabled:i,children:i?"Submitting...":"Submit Story"})]})})]})}function qZe(){const{user:e}=bt(),[t,n]=j.useState("nigeria"),[s,a]=j.useState([]),[i,o]=j.useState(!0),[l,c]=j.useState(""),[d,u]=j.useState("all"),[h,f]=j.useState("recent"),m=()=>{n("gossip"),setTimeout(()=>{var g;(g=document.getElementById("submit-headline"))==null||g.scrollIntoView({behavior:"smooth"})},100)};sc("news-headline",()=>m()),j.useEffect(()=>{x()},[t,d,h]);const x=async()=>{o(!0);try{const g=t==="nigeria"?"Nigeria":t==="diaspora"?"Diaspora":"Gossip";let y=H.from("curated_headlines").select("*").eq("region",g).eq("approved",!0).eq("is_flagged",!1);d!=="all"&&(y=y.eq("category",d)),y=y.order(h==="recent"?"created_at":"vote_score",{ascending:!1}),y=y.limit(50);const{data:b,error:w}=await y;if(w)throw w;a(b||[])}catch(g){console.error("Error fetching headlines:",g),be({title:"Error",description:"Failed to load news. Please try again.",variant:"destructive"}),a([])}finally{o(!1)}},p=()=>{x()},v=s.filter(g=>{var y;return l===""||g.title.toLowerCase().includes(l.toLowerCase())||((y=g.description)==null?void 0:y.toLowerCase().includes(l.toLowerCase()))});return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Naija News | Latest Headlines from Nigeria & the Diaspora",description:"Stay updated with the latest news from Nigeria and the Nigerian diaspora. Discover trending stories, community submissions, and breaking headlines.",type:"website"}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(oo,{variant:"news",title:"Naija News",subtitle:"Discover the latest headlines from Nigeria and the diaspora",icon:lr,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"text",placeholder:"Search news...",className:"pl-12 pr-14 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dar
1280k:bg-background/95 backdrop-blur-sm",value:l,onChange:g=>c(g.target.value)}),r.jsx(W,{size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 h-9 w-9","aria-label":"Search",children:r.jsx(Wr,{className:"h-4 w-4"})})]}),actionButtons:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"Submit a Headline",intentKey:"news-headline",onOpen:m}),r.jsx(ac,{})]})}),r.jsx("section",{className:"container mx-auto max-w-7xl px-4 pt-8",children:r.jsxs("div",{className:"max-w-3xl",children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Curated Nigerian headlines, updated daily"}),r.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"Our editors hand-pick the stories that matter to Nigerians at home and abroad â from politics and business to entertainment and community life in the diaspora. Every headline below is reviewed before it appears, sourced from trusted Nigerian and international outlets, and members of the community can submit their own headlines for review. Use the tabs to switch between Nigeria, Diaspora, and community-submitted gossip."})]})}),r.jsx("div",{className:"container mx-auto max-w-7xl px-4 pt-8",children:r.jsx(zo,{placementSlug:"news-top-leaderboard",className:"mx-auto mb-8"})}),r.jsx("div",{className:"container mx-auto max-w-7xl px-4 py-8",children:r.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[r.jsx("div",{className:"flex-1",children:r.jsxs(Kr,{value:t,onValueChange:g=>n(g),className:"mb-8",children:[r.jsxs(Hr,{className:"grid w-full max-w-2xl grid-cols-3",children:[r.jsxs(Re,{value:"nigeria",className:"gap-2",children:[r.jsx(lr,{className:"h-4 w-4"}),"Nigeria"]}),r.jsxs(Re,{value:"diaspora",className:"gap-2",children:[r.jsx(hn,{className:"h-4 w-4"}),"Diaspora"]}),r.jsxs(Re,{value:"gossip",className:"gap-2",children:[r.jsx(dl,{className:"h-4 w-4"}),"Your Gossip"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 mt-6",children:[r.jsxs(mt,{value:d,onValueChange:u,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{placeholder:"Category"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"all",children:"All Categories"}),r.jsx(Ne,{value:"General",children:"General"}),r.jsx(Ne,{value:"Politics",children:"Politics"}),r.jsx(Ne,{value:"Business",children:"Business"}),r.jsx(Ne,{value:"Sports",children:"Sports"}),r.jsx(Ne,{value:"Entertainment",children:"Entertainment"}),r.jsx(Ne,{value:"Technology",children:"Technology"}),r.jsx(Ne,{value:"Lifestyle",children:"Lifestyle"})]})]}),r.jsxs(mt,{value:h,onValueChange:g=>f(g),children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{placeholder:"Sort by"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"recent",children:"Most Recent"}),r.jsx(Ne,{value:"popular",children:"Most Popular"})]})]})]}),r.jsx(Be,{value:"nigeria",className:"mt-8",children:r.jsx(RC,{headlines:v,loading:i})}),r.jsx(Be,{value:"diaspora",className:"mt-8",children:r.jsx(RC,{headlines:v,loading:i})}),r.jsx(Be,{value:"gossip",className:"mt-8",children:e?r.jsxs(r.Fragment,{children:[r.jsx("div",{id:"submit-headline",children:r.jsx(zZe,{onSubmitted:p})}),r.jsx("div",{className:"mt-8",children:r.jsx(RC,{headlines:v,loading:i,showVoting:!0})})]}):r.jsxs("div",{className:"text-center py-12 bg-muted/50 rounded-lg",children:[r.jsx(dl,{className:"h-16 w-16 mx-auto mb-4 text-muted-foreground"}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Join the Community"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Sign in to submit and vote on community news"}),r.jsx(W,{onClick:()=>window.location.href="/auth",children:"Sign In"})]})})]})}),r.jsx("aside",{className:"w-full lg:w-[300px] flex-shrink-0",children:r.jsx("div",{className:"sticky top-24",children:r.jsx(_K,{showAdvertiseLink:!0})})})]})}),r.jsx("div",{className:"container mx-auto max-w-7xl px-4 pb-8",children:r.jsx(zo,{placementSlug:"footer-leaderboard",className:"mx-auto"})})]})]})}function RC({headlines:e,loading:t,showVoting:n=!1}){if(t)return r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[...Array(6)].map((a,i)=>r.jsx("div",{className:"h-[400px] bg-muted animate-pulse rounded-lg"},i))});if(e.length===0)return r.jsx("div",{className:"text-center py-12",children:r.jsx("p",{className:"text-muted-foreground",children:"No news available. Check back soon!"})});const s=[];return e.forEach((a,i)=>{s.push(a),(i+1)%6===0&&i<e.length-1&&s.push({type:"ad",key:`ad-${i}`})}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:s.map((a,i)=>{if("type"in a&&a.type==="ad")return r.jsx("div",{className:"md:col-span-2",children:r.jsx(Hc,{variant:"inline"})},a.key);const o=a;return r.jsx(BZe,{headline:o,showVoting:n},o.id)})})}const BL=()=>{var x;const e=Ri(),t=zn(),[n,s]=j.useState(""),[a,i]=j.useState(!1),[o,l]=j.useState(""),[c,d]=j.useState(""),u=((x=e.state)==null?void 0:x.status)||404;j.useEffect(()=>{console.error(`${u} Error: User attempted to access non-existent route:`,e.pathname);const p=document.createElement("meta");return p.name="cache-control",p.content=u===410?"no-cache, no-store, must-revalidate":"public, max-age=3600",document.head.appendChild(p),()=>{document.head.removeChild(p)}},[e.pathname,u]);const h=()=>{n.trim()&&t(`/content?search=${encodeURIComponent(n.trim())}`)},f=async()=>{try{console.log("Broken link report:",{url:e.pathname,email:o,message:c,timestamp:new Date().toISOString()}
1280),be({title:"Report Submitted",description:"Thank you for reporting this broken link. Our team will investigate."}),i(!1),l(""),d("")}catch{be({title:"Error",description:"Failed to submit report. Please try again.",variant:"destructive"})}},m=[{name:"Home",path:"/",icon:en},{name:"Content",path:"/content",icon:Ca},{name:"Events",path:"/events",icon:Xt},{name:"Marketplace",path:"/marketplace",icon:eu},{name:"Bookings",path:"/bookings",icon:At}];return r.jsx("div",{className:"min-h-screen bg-background text-foreground",children:r.jsx("div",{className:"container-mobile py-space-2xl",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center space-y-space-lg",children:[r.jsxs("div",{className:"space-y-space-md",children:[r.jsx("h1",{className:"text-6xl md:text-8xl font-bold text-primary",children:u}),r.jsx("h2",{className:"text-2xl md:text-3xl font-semibold",children:u===410?"Page Permanently Removed":"Page Not Found"}),r.jsx("p",{className:"text-muted-foreground text-lg",children:u===410?"This page has been permanently removed and is no longer available.":"Oops! The page you're looking for doesn't exist or has been moved."})]}),r.jsxs(Y,{className:"bg-card border-border",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Wr,{className:"h-5 w-5"}),"Search Naija.com"]})}),r.jsx(X,{className:"space-y-space-md",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ge,{placeholder:"Search for content, events, products...",value:n,onChange:p=>s(p.target.value),onKeyPress:p=>p.key==="Enter"&&h(),className:"flex-1"}),r.jsx(W,{onClick:h,size:"icon",children:r.jsx(Wr,{className:"h-4 w-4"})})]})})]}),r.jsxs(Y,{className:"bg-card border-border",children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Popular Pages"})}),r.jsx(X,{children:r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:m.map(p=>r.jsxs(ai,{to:p.path,className:"flex flex-col items-center gap-2 p-4 rounded-lg hover:bg-accent/50 transition-colors group",children:[r.jsx(p.icon,{className:"h-6 w-6 text-primary group-hover:scale-110 transition-transform"}),r.jsx("span",{className:"text-sm font-medium",children:p.name})]},p.path))})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(W,{onClick:()=>t(-1),variant:"outline",className:"flex items-center gap-2",children:[r.jsx(ej,{className:"h-4 w-4"}),"Go Back"]}),r.jsx(ai,{to:"/",children:r.jsxs(W,{className:"flex items-center gap-2",children:[r.jsx(en,{className:"h-4 w-4"}),"Go Home"]})}),r.jsx(W,{variant:"ghost",onClick:()=>i(!a),className:"text-muted-foreground hover:text-foreground",children:"Report Broken Link"})]}),a&&r.jsxs(Y,{className:"bg-card border-border text-left",children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Report Broken Link"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Help us improve by reporting this broken link: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:e.pathname})]})]}),r.jsxs(X,{className:"space-y-space-md",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"email",children:"Email (optional)"}),r.jsx(ge,{id:"email",type:"email",placeholder:"[email protected]",value:o,onChange:p=>l(p.target.value)})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"message",children:"Additional Details"}),r.jsx(ir,{id:"message",placeholder:"What were you trying to access? Any additional context...",value:c,onChange:p=>d(p.target.value),rows:3})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{onClick:f,children:"Submit Report"}),r.jsx(W,{variant:"outline",onClick:()=>i(!1),children:"Cancel"})]})]})]})]})})})},VZe=()=>{var a;const e=Ri(),t=zn(),{user:n}=bt();j.useEffect(()=>{console.error("403 Error: User attempted to access forbidden route:",e.pathname);const i=document.createElement("meta");return i.name="cache-control",i.content="no-cache, no-store, must-revalidate",document.head.appendChild(i),()=>{document.head.removeChild(i)}},[e.pathname]);const s=()=>{sessionStorage.setItem("redirectAfterLogin",e.pathname),t("/auth")};return r.jsx("div",{className:"min-h-screen bg-background text-foreground",children:r.jsx("div",{className:"container-mobile py-space-2xl",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center space-y-space-lg",children:[r.jsxs("div",{className:"space-y-space-md",children:[r.jsx("div",{className:"w-24 h-24 mx-auto bg-destructive/10 rounded-full flex items-center justify-center",children:r.jsx(fn,{className:"h-12 w-12 text-destructive"})}),r.jsx("h1",{className:"text-6xl md:text-8xl font-bold text-destructive",children:"403"}),r.jsx("h2",{className:"text-2xl md:text-3xl font-semibold",children:"Access Forbidden"}),r.jsx("p",{className:"text-muted-foreground text-lg",children:n?"You don't have permission to access this resource.":"You need to sign in to access this page."})]}),!n&&r.jsxs(Y,{className:"bg-card border-border",children:[r.jsx(Se,{children:r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(V4,{className:"h-5 w-5"}),"Sign In Required"]})}),r.jsxs(X,{className:"space-y-space-md",children:[r.jsx("p",{className:"text-muted-foreground",children:"This page requires authentication. Please sign in to continue."}),r.jsxs(W,{onClick:s,className:"w-full",children:[r.jsx(V4,{className:"h-4 w-4 mr-2"}),"Sign In"]})]})]}),n&&r.jsxs(Y,{className:"bg-card border-border",children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Insufficient Permissions"})}),r.jsxs(X,{className:"space-y-space-md",children:[r.jsx("p",{className:"text-muted-foreground",children:"Your current account doesn't have the required permissions to access this page."}),r.jsxs("div",{className:"text-sm text-muted-foreground bg-muted/50 p-4 rounded-lg",children:[r.jsxs("p",{children:[r.jsx("strong",{children:"Current Account:"})," ",n.email]}),r.jsxs("p",{children:[r.jsx("strong",{children:"Role:"})," ",((a=n.user_metadata)==null?void 0:a.role)||"Viewer"]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you believe this is an error, please contact support or check if you need to upgrade your account."})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(W,{onClick:()=>t(-1),variant:"outline",className:"flex items-center gap-2",children:[r.jsx(ej,{className:"h-4 w-4"}),"Go Back"]}),r.jsx(ai,{to:"/",children:r.jsxs(W,{className:"flex items-center gap-2",children:[r.jsx(en,{className:"h-4 w-4"}),"Go Home"]})}),!n&&r.jsxs(W,{onClick:s,variant:"default",children:[r.jsx(V4,{className:"h-4 w-4 mr-2"}),"Sign In"]})]}),r.jsxs(Y,{className:"bg-card border-border text-left",children:[r.jsx(Se,{children:r.jsx(Ae,{children:"Need Help?"})}),r.jsxs(X,{className:"space-y-space-md",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-semibold",children:"For Creators & Vendors:"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Create an account and complete your profile to access creator tools and dashboard."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-semibold",children:"For Property Owners:"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Register as a property owner to list and manage your bookings."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-semibold",children:"For Admins:"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Admin access is restricted. Contact system administrator for access."})]}),r.jsx(ai,{to:"/contact",className:"text-primary hover:underline text-sm",children:"Contact Support â"})]})]})]})})})},WZe=["email-newsletter","newsletter-banner","newsletter-sponsor-read"],HZe=["Banner in the issue header","A short sponsor read above the fold","One city or diaspora feature per quarter","Reporting on what the issue reached"],GZe=()=>{const[e,t]=j.useState([]);j.useEffect(()=>{let a=!0;return(async()=>{const o=await H.from("ad_pricing").select("duration_days, duration_label, price, currency, is_active, ad_placements(slug, name, size_label, is_active)").eq("is_active",!0).order("duration_days");if(!o.error&&a){const l=(o.data??[]).filter(c=>c.ad_placements&&WZe.includes(c.ad_placements.slug)&&c.ad_placements.is_active!==!1).map(c=>{var d,u,h;return{slug:((d=c.ad_placements)==null?void 0:d.slug)??"",name:((u=c.ad_placements)==null?void 0:u.name)??"",size_label:((h=c.ad_placements)==null?void 0:h.size_label)??"",duration_days:c.duration_days,duration_label:c.duration_label,price:Number(c.price),currency:c.currency??"NGN"}});t(l)}})(),()=>{a=!1}},[]);const n=j.useMemo(()=>{const a=new Map;return e.forEach(i=>
1280{a.set(i.slug,[...a.get(i.slug)??[],i])}),Array.from(a.entries()).map(([i,o])=>{var l,c;return{slug:i,name:((l=o[0])==null?void 0:l.name)??i,size_label:((c=o[0])==null?void 0:c.size_label)??"",from:Math.min(...o.map(d=>d.price)),prices:o.sort((d,u)=>d.duration_days-u.duration_days)}}).sort((i,o)=>i.from-o.from)},[e]),s=a=>`â¦${a.toLocaleString()}`;return r.jsx(Y,{className:"border-primary/30 bg-primary/5",children:r.jsxs(X,{className:"pt-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-5",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Dn,{className:"h-5 w-5 text-primary"}),r.jsx("h3",{className:"text-lg font-semibold",children:"The Naija.com Weekly"}),r.jsx(te,{className:"text-[10px]",children:"Sponsor a slot"})]}),r.jsx("p",{className:"text-sm text-muted-foreground max-w-xl",children:"A weekly digest for Nigerian readers at home and abroad: the headlines that mattered, events worth attending, and fresh roles. One sponsor per issue, so your message is not competing with anyone else in the inbox."})]}),r.jsxs("div",{className:"rounded-xl border bg-background px-4 py-3 text-center min-w-[160px]",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-muted-foreground",children:[r.jsx(Yr,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide",children:"Audience"})]}),r.jsxs("p",{className:"text-sm font-medium mt-1 leading-snug",children:["Readers in Nigeria",r.jsx("br",{}),"and the diaspora"]}),r.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Current reach figures shared on request"})]})]}),r.jsx("div",{className:"grid gap-3 md:grid-cols-3 mb-5",children:n.map(a=>{var i;return r.jsxs("div",{className:"rounded-xl border bg-background p-4",children:[r.jsx("p",{className:"text-sm font-semibold",children:a.name}),r.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:a.size_label}),r.jsx("p",{className:"text-2xl font-semibold mt-3",children:s(a.from)}),r.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["from, ",(i=a.prices[0])==null?void 0:i.duration_label.toLowerCase()]}),r.jsx("ul",{className:"mt-3 space-y-1",children:a.prices.slice(0,4).map(o=>r.jsxs("li",{className:"flex justify-between text-xs",children:[r.jsx("span",{className:"text-muted-foreground",children:o.duration_label}),r.jsx("span",{className:"font-medium",children:s(o.price)})]},`${a.slug}-${o.duration_days}`))})]},a.slug)})}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-[1fr_auto] items-center",children:[r.jsx("ul",{className:"grid gap-1.5 sm:grid-cols-2",children:HZe.map(a=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(ro,{className:"h-4 w-4 text-primary shrink-0"}),a]},a))}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(W,{asChild:!0,children:r.jsx(Vt,{to:"/contact?slot=newsletter",children:"Book the newsletter slot"})}),r.jsx(W,{asChild:!0,variant:"outline",children:r.jsx(Vt,{to:"/advertise",children:"See all placements"})})]})]})]})})},YZe=()=>{const{toast:e}=Sn(),[t,n]=j.useState("self-serve"),s=j.useRef(null),[a,i]=j.useState({business_name:"",business_email:"",business_phone:"",whatsapp:"",business_website:"",contact_person:"",requested_sizes:[],message:"",budget_range:""}),[o,l]=j.useState(!1),c=[{value:"billboard",label:"Billboard (970x250)",description:"Premium homepage placement"},{value:"leaderboard",label:"Leaderboard (728x90)",description:"News feed & footer"},{value:"rectangle",label:"Medium Rectangle (300x250)",description:"Sidebar placements"},{value:"half-page",label:"Half Page (300x600)",description:"High-impact sidebar"},{value:"skyscraper",label:"Wide Skyscraper (160x600)",description:"Tall sidebar format"},{value:"mobile-banner",label:"Mobile Banner (320x100)",description:"Mobile-optimized"},{value:"mobile-rectangle",label:"Mobile Rectangle (320x250)",description:"Mobile in-feed"},{value:"interstitial",label:"Interstitial (640x480)",description:"Full-screen overlay"},{value:"native",label:"Native Ad Card",description:"Blends with content"}],d=[{icon:Yr,value:"50,000+",label:"Monthly Visitors"},{icon:hn,value:"150+",label:"Countries"},{icon:Qd,value:"2.5M",label:"Page Views"},{icon:ui,value:"95%",label:"Nigerian Audience"}],u=(x,p)=>{i(v=>({...v,[x]:p}))},h=x=>{i(p=>({...p,requested_sizes:p.requested_sizes.includes(x)?p.requested_sizes.filter(v=>v!==x):[...p.requested_sizes,x]}))},f=x=>{var p;n(x==="Enterprise"?"contact":"self-serve"),(p=s.current)==null||p.scrollIntoView({behavior:"smooth"})},m=async x=>{x.preventDefault(),l(!0);try{const{error:p}=await H.from("advertisements").insert([{business_name:a.business_name,business_email:a.business_email,business_phone:a.business_phone,whatsapp:a.whatsapp,business_website:a.business_website,contact_person:a.contact_person,title:`Inquiry: ${a.business_name}`,description:a.message,advertisement_type:"inquiry",placement_location:a.requested_sizes.join(", ")||"To be discussed",pricing_plan:a.budget_range||"Custom",monthly_cost:0,start_date:new Date().toISOString().split("T")[0],end_date:new Date(Date.now()+2592e6).toISOString().split("T")[0],status:"pending",notes:`Budget Range: ${a.budget_range} 1281Requested Sizes: ${a.requested_sizes.join(", ")}`}]);if(p)throw p;e({title:"Inquiry Submitted Successfully!",description:"Our advertising team will c
1281ontact you within 24-48 hours."}),i({business_name:"",business_email:"",business_phone:"",whatsapp:"",business_website:"",contact_person:"",requested_sizes:[],message:"",budget_range:""})}catch(p){console.error("Error submitting inquiry:",p),e({title:"Submission Failed",description:"Please try again or contact us directly.",variant:"destructive"})}finally{l(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:"Media Kit & Advertising - Reach Nigerian Audiences | Naija.com",description:"Naija.com Media Kit: 50,000+ monthly visitors, 150+ countries. Self-serve ads from â¦15,000/week or custom enterprise campaigns. Download rate card."}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsxs("section",{className:"relative py-20 md:py-28 px-4 bg-gradient-to-br from-primary/10 via-background to-secondary/10 overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-primary/20 via-transparent to-transparent"}),r.jsxs("div",{className:"container mx-auto max-w-7xl relative z-10",children:[r.jsxs("div",{className:"text-center mb-14",children:[r.jsx(te,{variant:"secondary",className:"mb-4 text-sm px-4 py-1",children:"ð Media Kit & Rate Card 2025"}),r.jsxs("h1",{className:"text-4xl md:text-6xl font-bold text-foreground mb-6 leading-tight",children:["Advertise on"," ",r.jsx("span",{className:"bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent",children:"Naija.com"})]}),r.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto mb-8",children:"Nigeria's premier digital platform connecting 50,000+ monthly visitors across commerce, events, tourism, and lifestyle. Reach Nigerians at home and in the diaspora."}),r.jsxs("div",{className:"flex flex-wrap justify-center gap-4",children:[r.jsxs(W,{size:"lg",onClick:()=>f(),children:[r.jsx(LA,{className:"h-4 w-4 mr-2"})," Start Advertising"]}),r.jsx(W,{size:"lg",variant:"outline",asChild:!0,children:r.jsxs("a",{href:"#rate-card",children:[r.jsx(qh,{className:"h-4 w-4 mr-2"})," View Rate Card"]})})]})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 max-w-4xl mx-auto",children:d.map((x,p)=>r.jsx(Y,{className:"bg-card/60 backdrop-blur-sm border-primary/10",children:r.jsxs(X,{className:"p-5 text-center",children:[r.jsx(x.icon,{className:"h-7 w-7 mx-auto mb-2 text-primary"}),r.jsx("p",{className:"text-3xl font-bold text-foreground",children:x.value}),r.jsx("p",{className:"text-sm text-muted-foreground",children:x.label})]})},p))})]})]}),r.jsx(U0e,{}),r.jsx("div",{id:"rate-card",children:r.jsx(W0e,{})}),r.jsx(Z0e,{onSelectPackage:f}),r.jsx("div",{className:"py-10 px-4",children:r.jsx("div",{className:"container mx-auto max-w-7xl",children:r.jsx(GZe,{})})}),r.jsx(K0e,{}),r.jsx("section",{className:"py-16 px-4 bg-muted/20",children:r.jsxs("div",{className:"container mx-auto max-w-7xl",children:[r.jsx("h2",{className:"text-3xl font-bold text-center mb-10 text-foreground",children:"Why Advertise on Naija.com?"}),r.jsx("div",{className:"grid md:grid-cols-4 gap-6",children:[{icon:Yr,title:"Targeted Audience",desc:"95% Nigerian audience with high purchase intent across commerce and lifestyle."},{icon:Qd,title:"Real-Time Analytics",desc:"Track impressions, clicks, and conversions with your advertiser dashboard."},{icon:ui,title:"Quick Launch",desc:"Self-serve ads go live within 24 hours of payment and approval."},{icon:mr,title:"Premium Quality",desc:"Brand-safe environment with moderated, high-quality content."}].map((x,p)=>r.jsx(Y,{className:"text-center border-border/50",children:r.jsxs(X,{className:"pt-6",children:[r.jsx("div",{className:"h-12 w-12 rounded-xl bg-primary/10 flex items-center justify-center mx-auto mb-4",children:r.jsx(x.icon,{className:"h-6 w-6 text-primary"})}),r.jsx("h3",{className:"font-semibold mb-2 text-foreground",children:x.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:x.desc})]})},p))})]})}),r.jsx("section",{className:"py-16 px-4",ref:s,children:r.jsxs("div",{className:"container mx-auto max-w-5xl",children:[r.jsxs("div",{className:"text-center mb-10",children:[r.jsx("h2",{className:"text-3xl font-bold text-foreground mb-4",children:"Ready to Get Started?"}),r.jsx("p",{className:"text-muted-foreground",children:"Launch a self-serve campaign in minutes or contact us for a custom solution."})]}),r.jsxs(Kr,{value:t,onValueChange:x=>n(x),className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-2 mb-8",children:[r.jsxs(Re,{value:"self-serve",className:"gap-2",children:[r.jsx(LA,{className:"h-4 w-4"}),"Self-Serve (Launch Today)"]}),r.jsxs(Re,{value:"contact",className:"gap-2",children:[r.jsx(Oh,{className:"h-4 w-4"}),"Contact Us (Custom)"]})]}),r.jsx(Be,{value:"self-serve",children:r.jsx($0e,{})}),r.jsx(Be,{value:"contact",children:r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsxs(Ae,{className:"flex items-center gap-2",children:[r.jsx(Oh,{className:"h-5 w-5"}),"Request Custom Campaign"]}),r.jsx(Nt,{children:"For enterprise deals, custom integrations, or special requirements. Our team will c
1281ontact you within 24-48 hours."})]}),r.jsx(X,{children:r.jsxs("form",{onSubmit:m,className:"space-y-6",children:[r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Business Name *"}),r.jsx(ge,{required:!0,value:a.business_name,onChange:x=>u("business_name",x.target.value),placeholder:"Your business name"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Contact Person *"}),r.jsx(ge,{required:!0,value:a.contact_person,onChange:x=>u("contact_person",x.target.value),placeholder:"Primary contact name"})]})]}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Email *"}),r.jsx(ge,{type:"email",required:!0,value:a.business_email,onChange:x=>u("business_email",x.target.value),placeholder:"[email protected]"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Phone"}),r.jsx(ge,{value:a.business_phone,onChange:x=>u("business_phone",x.target.value),placeholder:"+234 xxx xxx xxxx"})]})]}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"WhatsApp"}),r.jsx(ge,{value:a.whatsapp,onChange:x=>u("whatsapp",x.target.value),placeholder:"+234 xxx xxx xxxx"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Website"}),r.jsx(ge,{value:a.business_website,onChange:x=>u("business_website",x.target.value),placeholder:"https://yourbusiness.com"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-3 block",children:"Interested Ad Sizes"}),r.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:c.map(x=>r.jsxs("div",{className:`border rounded-lg p-3 cursor-pointer transition-all ${a.requested_sizes.includes(x.value)?"border-primary bg-primary/5 ring-2 ring-primary":"border-border hover:border-primary/50"}`,onClick:()=>h(x.value),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(no,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-sm",children:x.label})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:x.description})]},x.value))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Budget Range"}),r.jsxs(mt,{value:a.budget_range,onValueChange:x=>u("budget_range",x),children:[r.jsx(ut,{children:r.jsx(pt,{placeholder:"Select your budget range"})}),r.jsxs(ht,{children:[r.jsx(Ne,{value:"under-100k",children:"Under â¦100,000/month"}),r.jsx(Ne,{value:"100k-500k",children:"â¦100,000 - â¦500,000/month"}),r.jsx(Ne,{value:"500k-1m",children:"â¦500,000 - â¦1,000,000/month"}),r.jsx(Ne,{value:"above-1m",children:"Above â¦1,000,000/month"}),r.jsx(Ne,{value:"custom",children:"Custom / Negotiable"})]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Message / Requirements"}),r.jsx(ir,{value:a.message,onChange:x=>u("message",x.target.value),placeholder:"Tell us about your campaign goals, target audience, special requirements, etc.",rows:4})]}),r.jsx(W,{type:"submit",className:"w-full",size:"lg",disabled:o,children:o?"Submitting...":"Submit Inquiry"}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Our advertising team will review your request and contact you within 24-48 business hours."})]})})]})})]})]})})]})]})};function KZe(){const{user:e}=bt(),[t,n]=j.useState(!0),[s,a]=j.useState(!1),[i,o]=j.useState({preferred_country:"NG",preferred_state:"",preferred_city:""});j.useEffect(()=>{e&&l()},[e]);const l=async()=>{if(e)try{const{data:u,error:h}=await H.from("profiles").select("preferred_country, preferred_state, preferred_city").eq("id",e.id).single();if(h)throw h;u&&o({preferred_country:u.preferred_country||"NG",preferred_state:u.preferred_state||"",preferred_city:u.preferred_city||""})}catch(u){console.error("Error fetching location preferences:",u)}finally{n(!1)}},c=async()=>
1281{if(e){a(!0);try{const{error:u}=await H.from("profiles").update({preferred_country:i.preferred_country,preferred_state:i.preferred_state,preferred_city:i.preferred_city}).eq("id",e.id);if(u)throw u;be({title:"Location preferences saved",description:"Your location preferences have been updated successfully."})}catch(u){be({title:"Save failed",description:u.message,variant:"destructive"})}finally{a(!1)}}},d=u=>{o({...i,preferred_country:u,preferred_state:"",preferred_city:""})};return t?r.jsx("div",{className:"container mx-auto p-6",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-primary"})})}):r.jsxs("div",{className:"container mx-auto p-6 max-w-4xl",children:[r.jsx(qn,{title:"Location Settings",description:"Set your default location for personalized content.",noindex:!0}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[r.jsx(At,{className:"h-8 w-8"}),"Location Settings"]}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Set your default location to receive personalized content from your region"})]}),r.jsxs(Y,{children:[r.jsxs(Se,{children:[r.jsx(Ae,{children:"Your Default Location"}),r.jsx(Nt,{children:"This location will be used to filter and prioritize content relevant to your area across all pages."})]}),r.jsxs(X,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"country",children:"Country"}),r.jsx(dc,{value:i.preferred_country,onValueChange:d,label:""})]}),r.jsx("div",{children:r.jsx(uc,{countryCode:i.preferred_country,value:i.preferred_state,onChange:u=>o({...i,preferred_state:u})})}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"city",children:"City (Optional)"}),r.jsxs("div",{className:"relative",children:[r.jsx(At,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(ge,{id:"city",value:i.preferred_city,onChange:u=>o({...i,preferred_city:u.target.value}),placeholder:"Enter your city",className:"pl-10"})]})]})]}),r.jsxs(W,{onClick:c,disabled:s,className:"w-full",children:[r.jsx(Sm,{className:"mr-2 h-4 w-4"}),s?"Saving...":"Save Location Preferences"]}),r.jsxs("div",{className:"bg-muted p-4 rounded-md text-sm",children:[r.jsx("p",{className:"font-semibold mb-2",children:"How this helps:"}),r.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[r.jsx("li",{children:"See products, events, and services from your area first"}),r.jsx("li",{children:"Get relevant recommendations based on your location"}),r.jsx("li",{children:"Pre-fill location fields when creating new listings"}),r.jsx("li",{children:"Discover local opportunities and connections"})]})]})]})]})]})]})}function XZe(){const[e,t]=j.useState(!1),n=[{icon:r.jsx(Oh,{className:"h-5 w-5"}),title:"Live Chat",description:"Get instant help from our support team",action:()=>{window.open("https://wa.me/2348012345678","_blank")},available:!0},{icon:r.jsx(Dn,{className:"h-5 w-5"}),title:"Email Support",description:"[email protected]",action:()=>{window.location.href="mailto:[email protected]?subject=Help Request"},available:!0},{icon:r.jsx(_ie,{className:"h-5 w-5"}),title:"Help Center",description:"Browse guides and FAQs",action:()=>{window.open("/help","_blank")},available:!0},{icon:r.jsx(ij,{className:"h-5 w-5"}),title:"Video Tutorials",description:"Watch how-to videos",action:()=>{window.open("https://youtube.com/@naija","_blank")},available:!1}];return r.jsxs(r.Fragment,{children:[r.jsx(W,{variant:"default",size:"lg",className:"fixed bottom-6 right-6 rounded-full shadow-lg hover:shadow-xl transition-all z-50 h-14 w-14 p-0",onClick:()=>t(!0),title:"Need help?",children:r.jsx(UR,{className:"h-6 w-6"})}),r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"sm:max-w-md",children:[r.jsxs(Mt,{children:[r.jsxs(Dt,{className:"flex items-center gap-2",children:[r.jsx(UR,{className:"h-5 w-5 text-primary"}),"How Can We Help?"]}),r.jsx(on,{children:"Choose the best way to get support"})]}),r.jsx("div",{className:"space-y-3 py-4",children:n.map((s,a)=>r.jsxs("button",{onClick:()=>{s.available&&(s.action(),t(!1))},disabled:!s.available,className:"w-full flex items-start gap-4 p-4 rounded-lg border hover:bg-accent hover:border-primary transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",children:[r.jsx("div",{className:"mt-0.5 text-primary",children:s.icon}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"font-medium",children:s.title}),!s.available&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"(Coming Soon)"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:s.description})]}),s.available&&r.jsx(ds,{className:"h-4 w-4 text-muted-foreground mt-1"})]},a))}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Qu
1281ick Links"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(W,{variant:"outline",size:"sm",className:"justify-start",onClick:()=>{window.open("/help/getting-started","_blank"),t(!1)},children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),"Getting Started"]}),r.jsxs(W,{variant:"outline",size:"sm",className:"justify-start",onClick:()=>{window.open("/help/featured-listings","_blank"),t(!1)},children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),"Featured Listings"]}),r.jsxs(W,{variant:"outline",size:"sm",className:"justify-start",onClick:()=>{window.open("/help/subscriptions","_blank"),t(!1)},children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),"Subscriptions"]}),r.jsxs(W,{variant:"outline",size:"sm",className:"justify-start",onClick:()=>{window.open("/help/faq","_blank"),t(!1)},children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),"FAQ"]})]})]}),r.jsx(_r,{children:r.jsxs(Sr,{className:"text-xs",children:[r.jsx("strong",{children:"Average response time:"})," Under 2 hours during business hours"]})})]})})]})}const ZZe=()=>{const[e,t]=j.useState(null),[n,s]=j.useState(!1);j.useEffect(()=>{const o=l=>{l.preventDefault(),t(l),localStorage.getItem("pwa-install-dismissed")||s(!0)};return window.addEventListener("beforeinstallprompt",o),window.matchMedia("(display-mode: standalone)").matches&&s(!1),()=>window.removeEventListener("beforeinstallprompt",o)},[]);const a=async()=>{if(!e)return;e.prompt();const{outcome:o}=await e.userChoice;o==="accepted"&&s(!1),t(null)},i=()=>{s(!1),localStorage.setItem("pwa-install-dismissed","true")};return n?r.jsxs(Y,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 p-4 shadow-lg border-2 border-primary/20 bg-background/95 backdrop-blur",children:[r.jsx("button",{onClick:i,className:"absolute top-2 right-2 p-1 hover:bg-muted rounded-full transition-colors","aria-label":"Dismiss",children:r.jsx(ks,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(qh,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold mb-1",children:"Install Naija.com"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Install our app for quick access, offline support, and a better experience!"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{onClick:a,size:"sm",className:"flex-1",children:"Install App"}),r.jsx(W,{onClick:i,variant:"outline",size:"sm",children:"Not Now"})]})]})]})]}):null},JZe=({property:e,onBookingComplete:t})=>{const{user:n}=bt(),{toast:s}=Sn(),[a,i]=j.useState(!1),[o,l]=j.useState(!1),[c,d]=j.useState("dates"),[u,h]=j.useState({checkIn:"",checkOut:"",guests:1,message:""}),[f,m]=j.useState({nights:0,baseTotal:0,cleaningFee:0,platformFee:0,total:0});j.useEffect(()=>{u.checkIn&&u.checkOut&&x()},[u.checkIn,u.checkOut]);const x=async()=>{const y=new Date(u.checkIn),b=new Date(u.checkOut),w=f_(b,y);if(w<=0)return;const{data:_}=await H.from("property_availability").select("date, price_override").eq("property_id",e.id).gte("date",wr(y,"yyyy-MM-dd")).lt("date",wr(b,"yyyy-MM-dd"));let C=0;for(let I=0;I<w;I++){const P=ma(y,I),O=wr(P,"yyyy-MM-dd"),A=_==null?void 0:_.find(L=>L.date===O),R=(A==null?void 0:A.price_override)||e.base_price_per_night;C+=R}const E=e.cleaning_fee||0,N=(C+E)*(e.platform_fee_percent/100),k=C+E+N;m({nights:w,baseTotal:C,cleaningFee:E,platformFee:N,total:k})},p=async()=>{const y=new Date(u.checkIn),b=new Date(u.checkOut),{data:w}=await H.from("property_availability").select("date").eq("property_id",e.id).eq("is_available",!1).gte("date",wr(y,"yyyy-MM-dd")).lt("date",wr(b,"yyyy-MM-dd"));if(w&&w.length>0)return s({title:"Dates unavailable",description:"Some of your selected dates are not available.",variant:"destructive"}),!1;const{data:_}=await H.from("bookings").select("check_in, check_out").eq("property_id",e.id).in("payment_status",["completed","pending"]).or(`check_in.lte.${wr(b,"yyyy-MM-dd")},check_out.gte.${wr(y,"yyyy-MM-dd")}`);return _&&_.length>0?(s({title:"Dates unavailable",description:"These dates are already booked.",variant:"destructive"}),!1):!0},v=async()=>
1281{if(!n){s({title:"Please log in to make a booking",variant:"destructive"});return}l(!0);try{if(!await p())return;const{error:b}=await H.from("bookings").insert({property_id:e.id,guest_id:n.id,check_in:u.checkIn,check_out:u.checkOut,guests:u.guests,total_amount:f.total,platform_fee:f.platformFee,status:"pending",payment_status:"pending",guest_message:u.message,requested_at:new Date().toISOString()});if(b)throw b;s({title:"Booking request sent!"}),i(!1),d("dates"),h({checkIn:"",checkOut:"",guests:1,message:""}),t==null||t()}catch(y){console.error("Error submitting booking:",y),s({title:"Error submitting booking request",variant:"destructive"})}finally{l(!1)}},g=()=>{if(!u.checkIn||!u.checkOut)return!1;const y=new Date(u.checkIn),b=new Date(u.checkOut),w=f_(b,y);return!(w<(e.min_nights||1)||e.max_nights&&w>e.max_nights||y<new Date)};return r.jsxs(Rt,{open:a,onOpenChange:i,children:[r.jsx(li,{asChild:!0,children:r.jsxs(W,{className:"w-full",size:"lg",children:[r.jsx(Xt,{className:"mr-2 h-4 w-4"}),"Request to Book"]})}),r.jsxs(Ot,{className:"max-w-2xl",children:[r.jsx(Mt,{children:r.jsxs(Dt,{children:["Book ",e.title]})}),c==="dates"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(le,{htmlFor:"checkIn",children:"Check-in"}),r.jsx(ge,{id:"checkIn",type:"date",value:u.checkIn,min:wr(new Date,"yyyy-MM-dd"),onChange:y=>h({...u,checkIn:y.target.value})})]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"checkOut",children:"Check-out"}),r.jsx(ge,{id:"checkOut",type:"date",value:u.checkOut,min:u.checkIn||wr(new Date,"yyyy-MM-dd"),onChange:y=>h({...u,checkOut:y.target.value})})]})]}),r.jsxs("div",{children:[r.jsxs(le,{htmlFor:"guests",children:["Guests (max ",e.max_guests,")"]}),r.jsx(ge,{id:"guests",type:"number",min:"1",max:e.max_guests,value:u.guests,onChange:y=>h({...u,guests:Number(y.target.value)})})]}),u.checkIn&&u.checkOut&&f.nights>0&&r.jsxs(Y,{children:[r.jsx(Se,{children:r.jsx(Ae,{className:"text-lg",children:"Price Breakdown"})}),r.jsxs(X,{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsxs("span",{children:["â¦",e.base_price_per_night.toLocaleString()," à ",f.nights," nights"]}),r.jsxs("span",{children:["â¦",f.baseTotal.toLocaleString()]})]}),f.cleaningFee>0&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Cleaning fee"}),r.jsxs("span",{children:["â¦",f.cleaningFee.toLocaleString()]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsxs("span",{children:["Platform fee (",e.platform_fee_percent,"%)"]}),r.jsxs("span",{children:["â¦",f.platformFee.toLocaleString()]})]}),r.jsx(sl,{}),r.jsxs("div",{className:"flex justify-between font-semibold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["â¦",f.total.toLocaleString()]})]})]})]}),r.jsx(W,{className:"w-full",onClick:()=>d("details"),disabled:!g(),children:"Continue"})]}),c==="details"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Xt,{className:"h-4 w-4"}),wr(new Date(u.checkIn),"MMM dd")," - ",wr(new Date(u.checkOut),"MMM dd"),r.jsx(Yr,{className:"h-4 w-4 ml-4"}),u.guests," ",u.guests===1?"guest":"guests"]}),r.jsxs("div",{children:[r.jsx(le,{htmlFor:"message",children:"Message to host (optional)"}),r.jsx(ir,{id:"message",placeholder:"Tell the host about your trip and why you'd like to stay...",value:u.message,onChange:y=>h({...u,message:y.target.value}),rows:4})]}),r.jsx(Y,{children:r.jsx(X,{className:"pt-4",children:r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsx("p",{className:"font-medium",children:"What happens next:"}),r.jsxs("div",{className:"space-y-1 text-muted-foreground",children:[r.jsx("p",{children:"1. Host reviews your request"}),r.jsx("p",{children:"2. You'll be notified of their decision"}),r.jsx("p",{children:"3. Payment is only charged if approved"})]})]})})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{variant:"outline",onClick:()=>d("dates"),className:"flex-1",children:"Back"}),r.jsx(W,{onClick:()=>d("confirmation"),className:"flex-1",children:"Review & Submit"})]})]}),c==="confirmation"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Confirm your booking request"}),r.jsx("p",{className:"text-muted-foreground",children:"You won't be charged until the host accepts"})]}),r.jsx(Y,{children:r.jsxs(X,{className:"pt-4 space-y-3",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Dates:"}),r.jsxs("span",{children:[wr(new Date(u.checkIn),"MMM dd")," - ",wr(new Date(u.checkOut),"MMM dd")]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{children:"Guests:"}),r.jsx("span",{children:u.guests})]}),r.jsxs("div",{className:"flex justify-between font-semibold",children:[r.jsx("span",{children:"Total:"}
1281),r.jsxs("span",{children:["â¦",f.total.toLocaleString()]})]})]})}),u.message&&r.jsx(Y,{children:r.jsxs(X,{className:"pt-4",children:[r.jsx("p",{className:"text-sm",children:r.jsx("strong",{children:"Your message:"})}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:u.message})]})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(W,{variant:"outline",onClick:()=>d("details"),className:"flex-1",children:"Back"}),r.jsx(W,{onClick:v,className:"flex-1",disabled:o,children:o?"Submitting...":"Send Request"})]})]})]})]})};function QZe({open:e,onOpenChange:t,property:n}){const{user:s}=bt(),[a,i]=j.useState(null),[o,l]=j.useState(null),[c,d]=j.useState(!1);j.useEffect(()=>{n!=null&&n.owner_id&&(u(),h(),s&&f())},[n==null?void 0:n.owner_id,n==null?void 0:n.id,s]);const u=async()=>{const{data:v}=await H.from("profiles").select("full_name, username").eq("id",n.owner_id).single();v&&i(v)},h=async()=>{const{count:v}=await H.from("property_inquiries").select("*",{count:"exact",head:!0}).eq("property_id",n.id);l({total_inquiries:v||0})},f=async()=>{if(!s)return;const{data:v}=await H.from("bookings").select("id").eq("property_id",n.id).eq("guest_id",s.id).eq("status","completed").lt("check_out",new Date().toISOString()).limit(1);d(!!v&&v.length>0)};if(!n)return null;const m=Math.floor((Date.now()-new Date(n.created_at).getTime())/(1e3*60*60*24)),x=n.superhost_status||n.is_verified_by_naija||n.is_boosted,p=n.source==="platform_seeded"&&!n.is_claimed;return r.jsx(Rt,{open:e,onOpenChange:t,children:r.jsxs(Ot,{className:"max-w-5xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsxs(Dt,{className:"text-2xl font-bold",children:[r.jsxs(on,{className:"sr-only",children:["View detailed information about ",n.title]}),n.title]})}),x&&r.jsx(Y,{className:"border-2 border-primary/20 bg-gradient-to-r from-primary/5 via-accent/5 to-primary/5",children:r.jsxs(X,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Va,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-semibold text-primary",children:"Premium Listing"})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.superhost_status&&r.jsxs(te,{className:"gap-1.5 px-3 py-1.5 bg-gradient-to-r from-yellow-500 to-amber-600 hover:from-yellow-600 hover:to-amber-700 text-white border-0 shadow-md",children:[r.jsx(Vd,{className:"h-4 w-4"}),r.jsx("span",{className:"font-semibold",children:"Superhost"})]}),n.is_verified_by_naija&&r.jsxs(te,{className:"gap-1.5 px-3 py-1.5 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800 text-white border-0 shadow-md",children:[r.jsx(fn,{className:"h-4 w-4"}),r.jsx("span",{className:"font-semibold",children:"Verified by Naija.com"})]}),n.is_boosted&&r.jsxs(te,{className:"gap-1.5 px-3 py-1.5 bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700 text-white border-0 shadow-md",children:[r.jsx(lr,{className:"h-4 w-4"}),r.jsx("span",{className:"font-semibold",children:"Featured Listing"})]})]}),r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground space-y-1",children:[n.superhost_status&&r.jsxs("p",{className:"flex items-start gap-2",children:[r.jsx(Vd,{className:"h-3 w-3 mt-0.5 text-yellow-600 flex-shrink-0"}),r.jsx("span",{children:"Superhost status earned with 10+ five-star reviews from verified guests"})]}),n.is_verified_by_naija&&r.jsxs("p",{className:"flex items-start gap-2",children:[r.jsx(fn,{className:"h-3 w-3 mt-0.5 text-blue-600 flex-shrink-0"}),r.jsx("span",{children:"Identity and property ownership verified by Naija.com"})]}),n.is_boosted&&r.jsxs("p",{className:"flex items-start gap-2",children:[r.jsx(lr,{className:"h-3 w-3 mt-0.5 text-green-600 flex-shrink-0"}),r.jsx("span",{children:"Featured listing with priority placement in search results"})]})]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[r.jsxs("div",{children:[n.photos&&n.photos.length>0?r.jsxs(Jh,{className:"w-full",children:[r.jsx(Qh,{children:n.photos.map((v,g)=>r.jsx(ef,{children:r.jsx("div",{className:"relative aspect-video rounded-lg overflow-hidden",children:r.jsx("img",{src:v,alt:`${n.title} ${g+1}`,className:"w-full h-full object-cover"})})},g))}),n.photos.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(Jm,{}),r.jsx(Qm,{})]})]}):r.jsx("div",{className:"aspect-video rounded-lg bg-gradient-to-br from-primary/10 to-accent/10 flex items-center justify-center",children:r.jsx(en,{className:"h-24 w-24 text-muted-foreground"})}),r.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[r.jsx(Yr,{className:"h-5 w-5 mx-auto mb-1 text-primary"}),r.jsxs("p",{className:"text-sm font-medium",children:[n.max_guests," Guests"]})]}),n.bedrooms&&r.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[r.jsx(en,{className:"h-5 w-5 mx-auto mb-1 text-primary"}),r.jsxs("p",{className:"text-sm font-medium",children:[n.bedrooms," Bedrooms"]})]}),n.baths&&r.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[r.jsx(mr,{className:"h-5 w-5 mx-auto mb-1 text-primary"}),r.jsxs("p",{className:"text-sm font-medium",children:[n.baths," Baths"]})]})]}),o&&o.total_inquiries>0&&r.jsx("div",{className:"mt-4 p-4 bg-muted/50 rounded-lg",children:r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Cr,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"font-medium",children:[o.total_inquiries," inquiries"]})]})})]}),r.jsxs("div",{className:"space-y-6",children:[a&&r.jsx(Y,{className:n.superhost_status?"border-yellow-500/30 bg-gradient-to-br from-yellow-50/50 to-amber-50/50 dark:from-yellow-950/20 dark:to-amber-950/20":"",children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-gradient-to-br from-primary to-primary/70 flex items-center justify-center text-white font-bold text-lg",children:(a.full_name||a.username||"H").charAt(0).toUpperCase()}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Hosted by"}),r.jsx("p",{className:"font-semibold text-foreground",children:a.full_name||a.username})]}),n.superhost_status&&r.jsxs(te,{className:"gap-1 bg-gradient-to-r from-yellow-500 to-amber-600 text-white border-0",children:[r.jsx(Vd,{className:"h-3 w-3"}),"Superhost"]})]})})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(At,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[n.city,", ",n.state]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-4xl font-bold",children:["â¦",n.base_price_per_night.toLocaleStr
1281ing()]}),r.jsx("span",{className:"text-muted-foreground",children:"/night"})]}),n.cleaning_fee&&n.cleaning_fee>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["+ â¦",n.cleaning_fee.toLocaleString()," cleaning fee"]})]}),r.jsx(sl,{}),n.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"About this place"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:n.description})]}),n.amenities&&n.amenities.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Amenities"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.amenities.map((v,g)=>r.jsxs(te,{variant:"outline",className:"text-xs",children:[r.jsx(er,{className:"h-3 w-3 mr-1"}),v]},g))})]}),n.website_url&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(hn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:n.website_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Visit Website"})]}),p&&r.jsx(Tj,{tableName:"properties",listingId:n.id,listingName:n.title,ownerColumn:"owner_id",variant:"detail"}),r.jsx(sl,{}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(JZe,{property:{...n,platform_fee_percent:0}}),(n.contact_phone||n.contact_email)&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"text-center text-sm text-muted-foreground my-2",children:"or contact host directly"}),r.jsx(DO,{product:{id:n.id,title:n.title,vendor_id:n.owner_id},vendor:{business_phone:n.contact_whatsapp||n.contact_phone,business_email:n.contact_email,store_name:(a==null?void 0:a.full_name)||(a==null?void 0:a.username)||"Property Owner"},variant:"default"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(fn,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-xs font-medium",children:"Secure Contact"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Xt,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-xs font-medium",children:"Instant Booking"})]})]}),m<=7&&r.jsxs(te,{variant:"outline",className:"gap-1.5 w-full justify-center py-2 border-primary/30 bg-primary/5",children:[r.jsx(Va,{className:"h-3 w-3 text-primary"}),r.jsxs("span",{className:"font-medium",children:["New listing (",m," days ago)"]})]})]})]}),r.jsxs(Kr,{defaultValue:"reviews",className:"mt-6",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-2",children:[r.jsxs(Re,{value:"reviews",className:"gap-2",children:[r.jsx(mr,{className:"h-4 w-4"}),"Reviews",n.superhost_status&&r.jsx(te,{className:"ml-2 text-xs bg-yellow-500 text-white",children:"10+ âââââ"})]}),r.jsxs(Re,{value:"write-review",className:"gap-2",children:["Write a Review",c&&r.jsxs(te,{className:"ml-2 text-xs bg-green-600 text-white gap-1",children:[r.jsx(er,{className:"h-3 w-3"}),"Verified"]})]})]}),r.jsx(Be,{value:"reviews",className:"space-y-4 mt-4",children:r.jsx(xK,{moduleType:"property",entityId:n.id})}),r.jsx(Be,{value:"write-review",className:"mt-4",children:c?r.jsx(vK,{moduleType:"property",entityId:n.id,entityTitle:n.title,isVerifiedBooking:!0,onSuccess:()=>{}}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Xt,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"Complete a stay to review"}),r.jsx("p",{className:"text-sm mt-2",children:"Only guests who have stayed at this property can leave reviews."})]})})]})]})})}const $9=["All States","Abia","Adamawa","Akwa Ibom","Anambra","Bauchi","Bayelsa","Benue","Borno","Cross River","Delta","Ebonyi","Edo","Ekiti","Enugu","FCT","Gombe","Imo","Jigawa","Kaduna","Kano","Katsina","Kebbi","Kogi","Kwara","Lagos","Nasarawa","Niger","Ogun","Ondo","Osun","Oyo","Plateau","Rivers","Sokoto","Taraba","Yobe","Zamfara"],eJe=["All Types","Hotel","Apartment","Villa","Guest House","Resort","Hostel"],tJe=["All Types","Car","Truck","Van","SUV","Motorcycle","Equipment"];function lre({subBrandKey:e="stays",defaultTab:t="lodging"}={}){var xe;const n=l6(e);c6(n.defaultUtm),bt();const{toast:s}=Sn(),{preferences:a}=Di(),[i,o]=j.useState([]),[l,c]=j.useState(""),[d,u]=j.useState("All States"),[h,f]=j.useState("All Types"),[m,x
1281]=j.useState(!1),[p,v]=j.useState(null),[g,y]=j.useState(!0),[b,w]=j.useState(!1),[_,C]=j.useState([]),[E,N]=j.useState(""),[k,I]=j.useState("All States"),[P,O]=j.useState("All Types"),[A,R]=j.useState(!1),[L,z]=j.useState(null),[U,$]=j.useState(!0),[q,ne]=j.useState(!1);sc("rentals-property",()=>x(!0)),sc("rentals-vehicle",()=>R(!0)),j.useEffect(()=>{se(),F()},[d,h,k,P]);const se=async()=>{y(!0);try{let oe=H.from("properties").select(` 1282 *, 1283 contact_phone, 1284 contact_email, 1285 contact_whatsapp, 1286 superhost_status, 1287 superhost_since, 1288 is_boosted, 1289 boost_expires_at, 1290 is_verified_by_naija, 1291 verified_badge_expires_at 1292 `).eq("status","active").eq("moderation_status","approved").order("is_boosted",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(d!=="All States"&&(oe=oe.eq("state",d)),h!=="All Types"){const Ue={Hotel:"hotel",Apartment:"apartment",Villa:"room","Guest House":"room",Resort:"hotel",Hostel:"room"}[h];Ue&&(oe=oe.eq("property_type",Ue))}const{data:we,error:ce}=await oe;if(ce)throw ce;o(we||[])}catch(oe){console.error("Error fetching properties:",oe),s({title:"Error",description:"Failed to load properties",variant:"destructive"})}finally{y(!1)}},F=async()=>{$(!0);try{let oe=H.from("rental_cars").select("*").eq("status","active").eq("moderation_status","approved").order("is_featured",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});k!=="All States"&&(oe=oe.eq("state",k)),P!=="All Types"&&(oe=oe.eq("listing_type",P.toLowerCase()));const{data:we,error:ce}=await oe;if(ce)throw ce;C(we||[])}catch(oe){console.error("Error fetching rental cars:",oe),s({title:"Error",description:"Failed to load rental cars",variant:"destructive"})}finally{$(!1)}},V=i.filter(oe=>{var ce,De;return oe.title.toLowerCase().includes(l.toLowerCase())||((ce=oe.summary)==null?void 0:ce.toLowerCase().includes(l.toLowerCase()))||((De=oe.city)==null?void 0:De.toLowerCase().includes(l.toLowerCase()))}),Z=_.filter(oe=>{var ce,De,Ue,re;return oe.title.toLowerCase().includes(E.toLowerCase())||((ce=oe.description)==null?void 0:ce.toLowerCase().includes(E.toLowerCase()))||((De=oe.city)==null?void 0:De.toLowerCase().includes(E.toLowerCase()))||((Ue=oe.make)==null?void 0:Ue.toLowerCase().includes(E.toLowerCase()))||((re=oe.model)==null?void 0:re.toLowerCase().includes(E.toLowerCase()))}),de=()=>{x(!1),se(),s({title:"Property listed successfully!"})},ve=()=>{R(!1),F(),s({title:"Rental car listed successfully!"})},pe=()=>{!b&&a?(u(a.state||"All States"),w(!0)):(u("All States"),w(!1))},_e=()=>{!q&&a?(I(a.state||"All States"),ne(!0)):(I("All States"),ne(!1))};return r.jsxs(r.Fragment,{children:[r.jsx(qn,{title:n.seoTitle,description:n.seoDescription,structuredData:{"@context":"https://schema.org","@type":n.jsonLdType,name:n.name,description:n.seoDescription,url:`https://naija-connect-platform.lovable.app${n.path}`,parentOrganization:{"@type":"Organization",name:n.parent}}}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(o6,{brand:n}),r.jsx(oo,{variant:"rentals",title:n.name,subtitle:n.tagline,icon:xa}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:r.jsxs(Kr,{defaultValue:t,className:"w-full",children:[r.jsxs(Hr,{className:"grid w-full grid-cols-2 mb-8",children:[r.jsxs(Re,{value:"lodging",className:"gap-2",children:[r.jsx(en,{className:"h-4 w-4"}),"Lodging"]}),r.jsxs(Re,{value:"cars",className:"gap-2",children:[r.jsx(xa,{className:"h-4 w-4"}),"Cars & Equipment"]})]}),r.jsxs(Be,{value:"lodging",children:[r.jsx("div",{className:"max-w-2xl mx-auto mb-6",children:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-muted-foreground"}),r.jsx(ge,{type:"search",placeholder:"Search properties, locations, or cities...",value:l,onChange:oe=>c(oe.target.value),className:"pl-12 pr-4 py-6 text-lg"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center mb-6",children:[r.jsx($h,{active:b,onToggle:pe}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"List Your Property",intentKey:"rentals-property",onOpen:()=>x(!0),variant:"default",className:"bg-primary hover:bg-primary/90"}),r.jsx(ac,{className:"text-muted-foreground"})]}),r.jsx(Rt,{open:m,onOpenChange:x,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"List Your Property"}),r.jsx(on,{children:"Fill in the details below to list your property for guests"})]}),r.jsx(p_,{onSuccess:de})]})})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[r.jsxs(mt,{value:d,onValueChange:u,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{placeholder:"Select State"})}),r.jsx(ht,{children:$9.map(oe=>r.jsx(Ne,{value:oe,children:oe},oe))})]}),r.jsxs(mt,{value:h,onValueChange:f,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{placeholder:"Select Type"})}),r.jsx(ht,{children:eJe.map(oe=>r.jsx(Ne,{value:oe,children:oe},oe))})]}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>{u("All States"),f("All Types"),c(""),w(!1)},children:"Clear Filters"})]}),r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:g?"Loading...":`${V.length} properties found`})}),g?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):V.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:V.map(oe=>{var we;return r.jsxs(Y,{className:"cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>v(oe),children:[r.jsxs("div",{className:"aspect-video relative overflow-hidden rounded-t-lg",children:[(we=oe.photos)!=null&&we[0]?r.jsx("img",{src:oe.photos[0],alt:oe.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:r.jsx(en,{className:"h-12 w-12 text-muted-foreground"})}),r.jsxs("div",{className:"absolute top-2 left-2 flex flex-col gap-1",children:[oe.superhost_status&&r.jsxs(te,{className:"gap-1 bg-gradient-to-r from-yellow-500 to-amber-600 text-white border-0 shadow-lg",children:[r.jsx(Vd,{className:"h-3 w-3"}),r.jsx("span",{className:"font-semibold",children:"Superhost"})]}),oe.is_verified_by_naija&&r.jsxs(te,{className:"gap-1 bg-gradient-to-r from-blue-600 to-blue-700 text-white border-0 shadow-lg",children:[r.jsx(fn,{className:"h-3 w-3"}),r.jsx("span",{className:"font-semibold",children:"Verified"})]})]}),r.jsx(jx,{isBoosted:oe.is_boosted,boostExpiresAt:oe.boost_expires_at,className:"absolute top-2 right-2"})]}),r.jsxs(X,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-lg truncate mb-1",children:oe.title}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mb-2",children:[r.jsx(At,{className:"h-3 w-3"}),oe.city,", ",oe.state]}),r.jsx("p",{className:"text-muted-foreground text-sm mb-3 line-clamp-2",children:oe.summary}),r.jsx("div",{className:"flex justify-between items-center",children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Yr,{className:"h-3 w-3"}),oe.max_guests]}),oe.bedrooms&&r.jsxs("span",{children:[oe.bedrooms," beds"]}),oe.baths&&r.jsxs("span",{children:[oe.baths," baths"]})]})}),r.jsxs("div",{className:"mt-3 pt-3 border-t",children:[r.jsxs("span",{className:"font-semibold text-lg",children:["â¦",oe.base_price_per_night.toLocaleStr
1292ing()]}),r.jsx("span",{className:"text-muted-foreground text-sm",children:" /night"})]})]})]},oe.id)})}):r.jsxs("div",{className:"text-center py-20",children:[r.jsx(en,{className:"h-24 w-24 mx-auto mb-6 text-muted-foreground opacity-50"}),r.jsx("h2",{className:"text-2xl font-bold mb-4",children:"No properties found"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mb-8",children:l||d!=="All States"||h!=="All Types"?"Try adjusting your search or filters":"Be the first to list a property in this area!"}),r.jsx(Ba,{label:"List Your Property",intentKey:"rentals-property",onOpen:()=>x(!0),variant:"default"})]})]}),r.jsxs(Be,{value:"cars",children:[r.jsx("div",{className:"max-w-2xl mx-auto mb-6",children:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-muted-foreground"}),r.jsx(ge,{type:"search",placeholder:"Search vehicles, equipment, or locations...",value:E,onChange:oe=>N(oe.target.value),className:"pl-12 pr-4 py-6 text-lg"})]})}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center mb-6",children:[r.jsx($h,{active:q,onToggle:_e}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"List Your Vehicle",intentKey:"rentals-vehicle",onOpen:()=>R(!0),variant:"default",className:"bg-primary hover:bg-primary/90"}),r.jsx(ac,{className:"text-muted-foreground"})]}),r.jsx(Rt,{open:A,onOpenChange:R,children:r.jsxs(Ot,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:"List Your Vehicle or Equipment"}),r.jsx(on,{children:"Fill in the details to create your rental listing"})]}),r.jsx(g_,{onSuccess:ve})]})})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 mb-6",children:[r.jsxs(mt,{value:k,onValueChange:I,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{placeholder:"Select State"})}),r.jsx(ht,{children:$9.map(oe=>r.jsx(Ne,{value:oe,children:oe},oe))})]}),r.jsxs(mt,{value:P,onValueChange:O,children:[r.jsx(ut,{className:"w-[180px]",children:r.jsx(pt,{placeholder:"Select Type"})}),r.jsx(ht,{children:tJe.map(oe=>r.jsx(Ne,{value:oe,children:oe},oe))})]}),r.jsx(W,{variant:"outline",size:"sm",onClick:()=>{I("All States"),O("All Types"),N(""),ne(!1)},children:"Clear Filters"})]}),r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:U?"Loa
1292ding...":`${Z.length} vehicles found`})}),U?r.jsx("div",{className:"flex justify-center items-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):Z.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Z.map(oe=>{var we;return r.jsxs(Y,{className:"cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>z(oe),children:[r.jsxs("div",{className:"aspect-video relative overflow-hidden rounded-t-lg",children:[(we=oe.photos)!=null&&we[0]?r.jsx("img",{src:oe.photos[0],alt:oe.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:r.jsx(xa,{className:"h-12 w-12 text-muted-foreground"})}),r.jsx(jx,{isBoosted:oe.is_featured,boostExpiresAt:null,className:"absolute top-2 right-2"}),oe.driver_included&&r.jsxs(te,{className:"absolute top-2 left-2 gap-1 bg-blue-600 text-white border-0 shadow-lg",children:[r.jsx(Yr,{className:"h-3 w-3"}),r.jsx("span",{className:"font-semibold",children:"Driver"})]})]}),r.jsxs(X,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-lg truncate mb-1",children:oe.title}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mb-2",children:[r.jsx(At,{className:"h-3 w-3"}),oe.city,", ",oe.state]}),oe.make&&oe.model&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:[oe.year," ",oe.make," ",oe.model]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[oe.transmission&&r.jsx(te,{variant:"outline",className:"text-xs",children:oe.transmission}),oe.fuel_type&&r.jsx(te,{variant:"outline",className:"text-xs",children:oe.fuel_type}),oe.seats&&r.jsxs(te,{variant:"outline",className:"text-xs",children:[r.jsx(Yr,{className:"h-3 w-3 mr-1"}),oe.seats," seats"]})]}),r.jsxs("div",{className:"mt-3 pt-3 border-t",children:[r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"font-semibold text-lg",children:["â¦",oe.daily_rate.toLocaleString()]}),r.jsx("span",{className:"text-muted-foreground text-sm",children:"/day"})]}),oe.driver_included&&oe.driver_daily_rate&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["+ â¦",oe.driver_daily_rate.toLocaleString(),"/day with driver"]})]})]})]},oe.id)})}):r.jsxs("div",{className:"text-center py-20",children:[r.jsx(xa,{className:"h-24 w-24 mx-auto mb-6 text-muted-foreground opacity-50"}),r.jsx("h2",{className:"text-2xl font-bold mb-4",children:"No vehicles found"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mb-8",children:E||k!=="All States"||P!=="All Types"?"Try adjusting your search or filters":"Be the first to list a vehicle in this area!"}),r.jsx(Ba,{label:"List Your Vehicle",intentKey:"rentals-vehicle",onOpen:()=>R(!0),variant:"default"})]})]})]})}),r.jsx(QZe,{open:!!p,onOpenChange:()=>v(null),property:p}),L&&r.jsx(Rt,{open:!!L,onOpenChange:()=>z(null),children:r.jsxs(Ot,{className:"max-w-3xl",children:[r.jsxs(Mt,{children:[r.jsx(Dt,{children:L.title}),r.jsxs(on,{children:[L.city,", ",L.state]})]}),r.jsxs("div",{className:"space-y-4",children:[((xe=L.photos)==null?void 0:xe[0])&&r.jsx("img",{src:L.photos[0],alt:L.title,className:"w-full h-64 object-cover rounded-lg"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Daily Rate"}),r.jsxs("p",{className:"text-xl font-bold",children:["â¦",L.daily_rate.toLocaleString()]})]}),L.weekly_rate&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Weekly Rate"}),r.jsxs("p",{className:"text-xl font-bold",children:["â¦",L.weekly_rate.toLocaleString()]})]})]}),L.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Description"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:L.description})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[L.driver_included&&r.jsxs(te,{className:"gap-1",children:[r.jsx(Yr,{className:"h-3 w-3"}),"Driver Available"]}),L.security_personnel_included&&r.jsxs(te,{className:"gap-1",children:[r.jsx(fn,{className:"h-3 w-3"}),"Security Available"]})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Contact"}),r.jsxs("p",{className:"text-sm",children:["Phone: ",L.contact_phone]}),L.contact_whatsapp&&r.jsxs("p",{className:"text-sm",children:["WhatsApp: ",L.contact_whatsapp]}),L.contact_email&&r.jsxs("p",{className:"text-sm",children:["Email: ",L.contact_email]})]})]})]})}),r.jsx("div",{className:"pt-8",children:r.jsx(Ej,{category:"travel",title:"Also need somewhere to stay?",blurb:"Verified hotels, guest houses and short lets across Nigeria and abroad.",ctaLabel:"Search stays"})})]})]})}function rJe(){return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Refund Policy | Naija.com",description:"Naija.com refund and cancellation policy for subscriptions and featured listings"}),r.jsxs("div",{className:"container max-w-4xl mx-auto py-12 px-4",children:[r.jsx("h1",{className:"text-4xl font-bold mb-8",children:"Refund Policy"}),r.jsxs("div",{className:"prose prose-lg max-w-none space-y-6",children:[r.jsxs("p",{className:"text-muted-foreground",children:[r.jsx("strong",{children:"Last Updated:"})," January 19, 2025"]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"1. General Policy"}),r.jsxs("p",{children:["All purchases on Naija.com, including subscription plans and featured listing boosts, are ",r.jsx("strong",{children:"final and n
1292on-refundable"}),". By completing a purchase, you acknowledge and agree that:"]}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"No refunds will be issued for any reason, including but not limited to: change of mind, lack of usage, technical issues, or dissatisfaction with results"}),r.jsx("li",{children:"You have reviewed the features and pricing before making your purchase"}),r.jsx("li",{children:"You understand that digital services begin immediately upon payment confirmation"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"2. Subscription Plans"}),r.jsx("h3",{className:"text-xl font-semibold mb-3",children:"2.1 Billing and Payments"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"Subscriptions are billed monthly or annually based on your selected plan"}),r.jsx("li",{children:"Payments are processed at the beginning of each billing cycle"}),r.jsxs("li",{children:["All payments are ",r.jsx("strong",{children:"non-refundable"}),", including:",r.jsxs("ul",{className:"list-circle pl-6 mt-2",children:[r.jsx("li",{children:"First payment for new subscriptions"}),r.jsx("li",{children:"Renewal payments for existing subscriptions"}),r.jsx("li",{children:"Upgrade fees when moving to a higher tier"})]})]})]}),r.jsx("h3",{className:"text-xl font-semibold mb-3 mt-4",children:"2.2 Cancellation Policy"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"You may cancel your subscription at any time from your dashboard"}),r.jsxs("li",{children:[r.jsx("strong",{children:"Cancellation prevents future charges only"})," - no refund is issued for the current period"]}),r.jsx("li",{children:"After cancellation, you retain access to your subscription benefits until the end of the current billing period"}),r.jsx("li",{children:"Once your current period ends, your account will automatically downgrade to the free plan"}),r.jsx("li",{children:"You can reactivate your subscription at any time"})]}),r.jsx("h3",{className:"text-xl font-semibold mb-3 mt-4",children:"2.3 Downgrades"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"Downgrading to a lower-tier plan takes effect at the end of your current billing period"}),r.jsx("li",{children:"No partial refunds are issued when downgrading"}),r.jsx("li",{children:"You keep your current plan benefits until the period ends"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"3. Featured Listing Boosts"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsxs("li",{children:["Featured listing boosts are ",r.jsx("strong",{children:"one-time purchases"})," and are ",r.jsx("strong",{children:"completely non-refundable"})]}),r.jsx("li",{children:"Boosts activate immediately upon payment confirmation"}),r.jsx("li",{children:"Boost duration begins at the time of purchase and cannot be paused or extended"}),r.jsx("li",{children:"If your listing is removed for violating our terms, the boost is forfeited without refund"}),r.jsx("li",{children:"Boost purchases cannot be transferred between listings"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"4. Exceptions"}),r.jsx("p",{children:"We may consider refunds only in the following exceptional circumstances:"}),r.jsx("h3",{className:"text-xl font-semibold mb-3 mt-4",children:"4.1 Duplicate Charges"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"If you were charged twice for the same transaction due to a technical error"}),r.jsx("li",{children:"You must report duplicate charges within 7 days"}),r.jsx("li",{children:"Provide proof of duplicate transactions"})]}),r.jsx("h3",{className:"text-xl font-semibold mb-3 mt-4",children:"4.2 Service Unavailability"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"If our platform is completely unavailable for more than 7 consecutive days"}),r.jsx("li",{children:"Partial refunds may be issued at our discretion"}),r.jsx("li",{children:"Planned maintenance and minor outages do not qualify"})]}),r.jsx("h3",{className:"text-xl font-semibold mb-3 mt-4",children:"4.3 Fraudulent Activity"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"If unauthorized charges are made due to account compromise"}),r.jsx("li",{children:"You must report within 24 hours of discovery"}),r.jsx("li",{children:"Full documentation and police report may be required"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"5. How to Request a Refund (Exceptions Only)"}
1292),r.jsx("p",{children:"If you believe you qualify for one of the exceptions listed above:"}),r.jsxs("ol",{className:"list-decimal pl-6 space-y-2",children:[r.jsxs("li",{children:["Contact us at ",r.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"[email protected]"})]}),r.jsx("li",{children:"Include your transaction reference number"}),r.jsx("li",{children:"Provide detailed explanation and supporting evidence"}),r.jsx("li",{children:"Wait for our team to review (typically 5-7 business days)"})]}),r.jsxs("p",{className:"mt-4",children:[r.jsx("strong",{children:"Important:"})," Submitting a refund request does not guarantee approval. All refund requests are reviewed case-by-case and decisions are final."]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"6. Chargebacks"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:r.jsx("strong",{children:"Do not file a chargeback without contacting us first"})}),r.jsx("li",{children:"Chargebacks for valid charges will result in immediate account suspension"}),r.jsx("li",{children:"We provide full documentation to payment processors for all transactions"}),r.jsx("li",{children:"If you have a legitimate concern, contact us directly to resolve it"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"7. Currency and Exchange Rates"}),r.jsxs("ul",{className:"list-disc pl-6 space-y-2",children:[r.jsx("li",{children:"All prices are displayed in Nigerian Naira (â¦)"}),r.jsx("li",{children:"If you pay with a foreign currency, your bank's exchange rate applies"}),r.jsx("li",{children:"We are not responsible for currency conversion fees or rate fluctuations"}),r.jsx("li",{children:"No refunds are issued due to unfavorable exchange rates"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"8. Changes to This Policy"}),r.jsx("p",{children:'We reserve the right to modify this refund policy at any time. Changes will be posted on this page with an updated "Last Updated" date. Your continued use of our services after changes are posted constitutes acceptance of the updated policy.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"9. Contact Us"}),r.jsx("p",{children:"If you have questions about this refund policy, please contact us:"}),r.jsxs("ul",{className:"list-none space-y-2 mt-4",children:[r.jsxs("li",{children:[r.jsx("strong",{children:"Email:"})," [email protected]"]}),r.jsxs("li",{children:[r.jsx("strong",{children:"Website:"})," www.naija.com/contact"]})]})]}),r.jsxs(_r,{className:"mt-12 border-orange-500",children:[r.jsx(Oo,{className:"h-4 w-4 text-orange-600"}),r.jsxs(Sr,{children:[r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"Summary"}),r.jsxs("p",{className:"text-sm",children:[r.jsx("strong",{children:"All purchases are final and n
1292on-refundable."})," By making a purchase, you agree that you understand and accept this policy. Subscriptions can be cancelled at any time to prevent future charges, but no refund will be issued for the current billing period. Featured listing boosts are one-time purchases that activate immediately and cannot be refunded or transferred."]})]})]})]})]})]})}function nJe(){return r.jsx(lre,{subBrandKey:"wheels",defaultTab:"cars"})}const sJe=[{slug:"wise",name:"Wise",tagline:"Mid-market exchange rate, transparent fees",logoEmoji:"ð¢",publicUrl:"https://wise.com/send-money/send-money-to-nigeria",feeNote:"From $1.99 + 0.4â0.6%",speedNote:"Minutes â same day",rateNote:"True mid-market FX",payoutMethods:["bank"],fromCountries:["US","GB","CA","AU","EU"],highlights:["No hidden markup","Free first transfer (varies)","Multi-currency account"],badge:"best_rate"},{slug:"lemfi",name:"LemFi",tagline:"Diaspora-built for Naija transfers",logoEmoji:"ð¡",publicUrl:"https://www.lemfi.com",feeNote:"Zero fee on most corridors",speedNote:"Minutes",rateNote:"Competitive NGN rate",payoutMethods:["bank"],fromCountries:["US","GB","CA","EU"],highlights:["Built for Africans abroad","Often zero fee","Direct bank credit"],badge:"popular"},{slug:"sendwave",name:"Sendwave",tagline:"No-fee mobile transfers",logoEmoji:"ðµ",publicUrl:"https://www.sendwave.com",feeNote:"No transfer fee",speedNote:"Minutes",rateNote:"Built-in FX margin",payoutMethods:["bank","mobile_money"],fromCountries:["US","GB","CA","EU"],highlights:["Zero fees on app","Quick mobile send","Bank or mobile payout"]},{slug:"remitly",name:"Remitly",tagline:"Economy or express delivery",logoEmoji:"ð ",publicUrl:"https://www.remitly.com/us/en/nigeria",feeNote:"From $0 (economy)",speedNote:"Economy 3â5 days · Express minutes",rateNote:"Promo rate for first transfer",payoutMethods:["bank","cash_pickup"],fromCountries:["US","GB","CA","AU","EU"],highlights:["Cash pickup at partner banks","Strong first-transfer promo","Tracking"],badge:"cash_pickup"},{slug:"worldremit",name:"WorldRemit",tagline:"Established global rails",logoEmoji:"ð´",publicUrl:"https://www.worldremit.com/en/nigeria",feeNote:"From $3.99",speedNote:"Minutes â 1 day",rateNote:"Standard market rate",payoutMethods:["bank","mobile_money","cash_pickup"],fromCountries:["US","GB","CA","AU","EU"],highlights:["Wide payout network","Cash pickup available","Trusted brand"]},{slug:"taptap-send",name:"Taptap Send",tagline:"Africa-focused, mobile-first",logoEmoji:"ð£",publicUrl:"https://www.taptapsend.com",feeNote:"No fee on most corridors",speedNote:"Minutes",rateNote:"Built-in FX margin",payoutMethods:["bank"],fromCountries:["US","GB","CA","EU"],highlights:["Africa-only specialist","Zero fees","Simple app"],badge:"fastest"}],aJe={bank:"Bank deposit",mobile_money:"Mobile money",cash_pickup:"Cash pickup",wallet:"Wallet"},iJe=[{code:"US",label:"United States",flag:"ðºð¸"},{code:"GB",label:"United Kingdom",flag:"ð¬ð§"},{code:"CA",label:"Canada",flag:"ð¨ð¦"},{code:"AU",label:"Australia",flag:"ð¦ðº"},{code:"EU",label:"Europe (EUR)",flag:"ðªðº"}],oJe={best_rate:"Best rate",fastest:"Fastest",popular:"Most popular",cash_pickup:"Cash pickup"};function lJe(){const[e,t]=j.useState(new Set);return j.useEffect(()=>{let n=!0;return(async()=>{const{data:a,error:i}=await H.from("affiliate_partners").select("slug").eq("category","remittance").eq("is_active",!0);if(i){console.error("Could not load the partner directory",i.message);return}n&&t(new Set((a??[]).map(o=>o.slug)))})(),()=>{n=!1}},[]),e}function F9(){const[e,t]=j.useState("US"),n=lJe(),s=j.useMemo(()=>sJe.filter(i=>i.fromCountries.includes(e)),[e]),a={"@context":"https://schema.org","@type":"FAQPage",mainEntity:[{"@type":"Question",name:"What is the cheapest way to send money to Nigeria?",acceptedAnswer:{"@type":"Answer",text:"Wise typically gives the cheapest mid-market exchange rate with transparent fees. LemFi, Sendwave and Taptap Send often advertise zero transfer fees but build a small margin into the NGN rate. Always compare the total NGN amount delivered, not just the headline fee."}},{"@type":"Question",name:"What is the fastest way to send money to Nigeria?",acceptedA
1292nswer:{"@type":"Answer",text:"Taptap Send, LemFi, Sendwave and Wise (express) typically deliver to Nigerian bank accounts within minutes. Remitly Express is also minute-fast; their Economy tier takes 3â5 days for a lower price."}},{"@type":"Question",name:"Can I send money to a Nigerian mobile wallet?",acceptedAnswer:{"@type":"Answer",text:"Yes â Sendwave and WorldRemit both support mobile money payout in Nigeria. Most other providers send directly to bank accounts (GTBank, Zenith, Access, UBA, Opay, Kuda, Palmpay and more)."}},{"@type":"Question",name:"Can my family pick up cash in Nigeria?",acceptedAnswer:{"@type":"Answer",text:"Remitly and WorldRemit offer cash pickup at partner bank branches across Nigeria, useful for recipients without a bank account."}}]};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:"Send Money to Nigeria â Compare Rates & Fees",description:"Compare the best ways to send money to Nigeria from the US, UK, Canada, EU and Australia. Live picks for Wise, LemFi, Sendwave, Remitly, WorldRemit & Taptap Send.",structuredData:a}),r.jsx(oo,{variant:"diaspora",title:"Send Money to Nigeria",subtitle:"Compare trusted providers side by side â rates, fees, speed and payout options.",icon:Jc,badge:{text:"Naija Remittance Hub",icon:hn}}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:[r.jsx(Y,{className:"border-primary/30",children:r.jsxs(X,{className:"p-6 flex flex-col md:flex-row md:items-center gap-4 md:gap-6",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"I'm sending from"}),r.jsxs(mt,{value:e,onValueChange:t,children:[r.jsx(ut,{className:"max-w-xs",children:r.jsx(pt,{})}),r.jsx(ht,{children:iJe.map(i=>r.jsxs(Ne,{value:i.code,children:[i.flag," ",i.label]},i.code))})]})]}),r.jsx("div",{className:"hidden md:flex items-center text-muted-foreground",children:r.jsx(kg,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Recipient in"}),r.jsx("div",{className:"flex items-center gap-2 h-10 px-3 rounded-md border bg-muted/30 font-medium",children:"ð³ð¬ Nigeria (NGN)"})]})]})}),r.jsxs("div",{className:"mt-4 flex items-start gap-2 text-xs text-muted-foreground",children:[r.jsx(sj,{className:"h-4 w-4 mt-0.5 flex-shrink-0"}),r.jsx("p",{children:"Rates and fees shown are advertised ranges from each provider's website and change frequently. Always confirm the final NGN amount in-app before sending. Naija.com may earn a referral fee â at no extra cost to you â when you sign up via these links. This helps keep the platform free."})]})]}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 pb-12",children:[r.jsxs("h2",{className:"text-2xl font-bold mb-6",children:["Compare ",s.length," providers"]}),r.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:s.map(i=>r.jsx(Y,{className:"overflow-hidden hover:shadow-lg transition-shadow",children:r.jsxs(X,{className:"p-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3 gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"text-3xl",children:i.logoEmoji}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-bold leading-tight",children:i.name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:i.tagline})]})]}),i.badge&&r.jsx(te,{className:"bg-primary/15 text-primary border-primary/30 hover:bg-primary/20",children:oJe[i.badge]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 my-4 text-sm",children:[r.jsxs("div",{children:[r.jsxs("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-0.5 flex items-center gap-1",children:[r.jsx(V2,{className:"h-3 w-3"})," Fee"]}),r.jsx("p",{className:"font-medium",children:i.feeNote})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-0.5 flex items-center gap-1",children:[r.jsx($r,{className:"h-3 w-3"})," Speed"]}),r.jsx("p",{className:"font-medium",children:i.speedNote})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-0.5",children:"Rate"}),r.jsx("p",{className:"font-medium",children:i.rateNote})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-4",children:i.payoutMethods.map(o=>r.jsx(te,{variant:"outline",className:"text-xs",children:aJe[o]},o))}),r.jsx("ul",{className:"text-sm text-muted-foreground space-y-1 mb-5 list-disc pl-5",children:i.highlights.map(o=>r.jsx("li",{children:o},o))}),r.jsx(W,{asChild:!0,className:"w-full",children:r.jsxs("a",{href:n.has(i.slug)?bX(i.slug):i.publicUrl,rel:"sponsored nofollow noopener",target:"_blank",children:["Send with ",i.name,r.jsx(kg,{className:"h-4 w-4 ml-2"})]})})]})},i.slug))})]}),r.jsxs("section",{className:"container max-w-4xl mx-auto px-4 pb-16",children:[r.jsx("h2",{className:"text-2xl font-bold mb-6",children:"FAQs about sending money to Nigeria"}),r.jsx("div",{className:"space-y-5",children:a.mainEntity.map(i=>r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-1",children:i.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:i.acceptedA
1292nswer.text})]},i.name))})]})]})}const cre=({job:e})=>r.jsx(Y,{className:"hover:shadow-md transition-shadow",children:r.jsx(X,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:r.jsx(fr,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-base line-clamp-1",children:r.jsx(Vt,{to:kK(e),className:"hover:text-primary transition-colors",children:e.title})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground mt-1",children:[e.company&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(W2,{className:"h-3.5 w-3.5"}),e.company]}),e.location&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(At,{className:"h-3.5 w-3.5"}),e.location]}),e.salary_text&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(V2,{className:"h-3.5 w-3.5"}),e.salary_text]}),e.published_at&&r.jsx("span",{className:"text-xs",children:Im(mm(e.published_at),{addSuffix:!0})})]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx(te,{variant:"secondary",className:"text-xs",children:e.source_name}),r.jsx(W,{asChild:!0,size:"sm",variant:"outline",children:r.jsxs("a",{href:e.apply_url,target:"_blank",rel:"noopener noreferrer sponsored",children:["Apply",r.jsx(ds,{className:"h-3.5 w-3.5 ml-1"})]})})]})]})})}),B9={lagos:{name:"Lagos",state:"Lagos",intro:"Latest jobs in Lagos across tech, finance, oil & gas, retail and skilled trades. Apply directly with verified employers."},abuja:{name:"Abuja",state:"FCT",intro:"Current job openings in Abuja and the FCT â government, NGOs, embassies, hospitality and tech roles."},"port-harcourt":{name:"Port Harcourt",state:"Rivers",intro:"Port Harcourt job listings â oil & gas, engineering, logistics, hospitality and skilled trades."},ibadan:{name:"Ibadan",state:"Oyo",intro:"Job openings in Ibadan and Oyo State across education, healthcare, agriculture and tech."},remote:{name:"Remote",state:"",intro:"Remote and work-from-home jobs open to candidates anywhere in Nigeria."}};function U9(){const{city:e}=iv(),t=e?B9[e]:void 0,{user:n}=bt(),[s,a]=j.useState(""),[i,o]=j.useState(!0),[l,c]=j.useState([]),[d,u]=j.useState(!1),[h,f]=j.useState([]);sc("jobs",()=>u(!0)),j.useEffect(()=>{x(),m()},[e,s]);const m=async()=>{try{let b=H.from("imported_jobs").select("*").eq("is_active",!0).order("published_at",{ascending:!1,nullsFirst:!1}).limit(12);(t==null?void 0:t.name)==="Remote"?b=b.ilike("location","%remote%"):t!=null&&t.name&&(b=b.ilike("location",`%${t.name}%`)),s&&(b=b.or(`title.ilike.%${s}%,company.ilike.%${s}%`));const{data:w,error:_}=await b;if(_)throw _;f(w||[])}catch(b){console.error("imported jobs fetch",b)}},x=async()=>{o(!0);try{let b=H.from("classifieds").select("*").eq("status","active").eq("moderation_status","approved");t!=null&&t.state?b=b.ilike("location_state",t.state):(t==null?void 0:t.name)==="Remote"&&(b=b.or("title.ilike.%remote%,description.ilike.%remote%")),s&&(b=b.or(`title.ilike.%${s}%,description.ilike.%${s}%,location_city.ilike.%${s}%`));const{data:w,error:_}=await b.order("created_at",{ascending:!1}).limit(60);if(_)throw _;const C=new Date().toISOString(),E=(w||[]).sort((N,k)=>{const I=N.is_featured&&N.featured_until&&N.featured_until>C?1:0,P=k.is_featured&&k.featured_until&&k.featured_until>C?1:0;return I!==P?P-I:new Date(k.created_at).getTime()-new Date(N.created_at).getTime()});c(E)}catch(b){console.error("jobs fetch",b)}finally{o(!1)}},p=(t==null?void 0:t.name)??"Nigeria",v=t?`Jobs in ${t.name} â Latest Vacancies & Hiring`:"Jobs in Nigeria â Latest Vacancies, Apply Today",g=(t==null?void 0:t.intro)??"Browse the latest jobs across Nigeria. Tech, finance, healthcare, skilled trades, domestic and remote roles, updated daily.",y=l.length>0?{"@context":"https://schema.org","@type":"ItemList",itemListElement:l.slice(0,10).map((b,w)=>({"@type":"ListItem",position:w+1,url:`https://naija.com/classifieds?classified=${b.id}`,name:b.title}))}:void 0;return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:v,description:g,structuredData:y}),r.jsx(oo,{variant:"classifieds",title:t?`Jobs in ${t.name}`:"Jobs in Nigeria",subtitle:g,icon:fr,searchComponent:r.jsxs("div",{className:"relative",children:[r.jsx(Wr,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-500"}),r.jsx(ge,{type:"search",placeholder:`Search jobs ${t?`in ${t.name}`:"across Nigeria"}â¦`,value:s,onChange:b=>a(b.target.value),className:"pl-12 pr-4 py-6 text-lg text-gray-900 dark:text-foreground bg-white/95 dar
1292k:bg-background/95 backdrop-blur-sm"})]}),actionButtons:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Ba,{label:"Post Your Job",intentKey:"jobs",onOpen:()=>u(!0)}),r.jsx(ac,{})]})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 pt-8",children:r.jsxs("div",{className:"max-w-3xl",children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Jobs for Nigerians, curated from employers and trusted job boards"}),r.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"Find openings posted directly by employers on Naija.com alongside roles gathered daily from reputable remote and Nigerian job boards â every listing links back to its source so you can apply with confidence. Filter by city, category, or work type, and if you are hiring, post your vacancy free to reach job seekers across Nigeria and the diaspora."})]})}),r.jsx("div",{className:"container max-w-6xl mx-auto px-4 pt-8",children:r.jsx(zo,{placementSlug:"classifieds-top-leaderboard",className:"mx-auto mb-6"})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 pb-2",children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(B9).map(([b,w])=>r.jsxs("a",{href:`/jobs/${b}`,className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${e===b?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-accent border-border"}`,children:[r.jsx(At,{className:"inline h-3 w-3 mr-1"}),w.name]},b)),r.jsx("a",{href:"/jobs",className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${e?"bg-background hover:bg-accent border-border":"bg-primary text-primary-foreground border-primary"}`,children:"All Nigeria"})]})}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[r.jsx(W2,{className:"h-5 w-5"})," Latest openings in ",p]}),r.jsxs(te,{variant:"outline",children:[l.length," listings"]})]}),i?r.jsx("div",{className:"flex justify-center py-20",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):l.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:l.map(b=>r.jsx(sN,{classified:b},b.id))}):r.jsxs(Y,{className:"p-10 text-center",children:[r.jsx(fr,{className:"h-12 w-12 mx-auto mb-3 text-muted-foreground/60"}),r.jsxs("h3",{className:"font-semibold mb-2",children:["No jobs yet in ",p]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-5",children:"Be the first employer to post a vacancy here â it's free."}),n&&r.jsxs(W,{onClick:()=>u(!0),children:[r.jsx(xs,{className:"h-4 w-4 mr-2"})," Post Your Job"]})]})]}),h.length>0&&r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 pb-12",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h2",{className:"text-xl font-bold flex items-center gap-2",children:[r.jsx(fr,{className:"h-5 w-5"})," Remote & Diaspora Jobs"]}),r.jsxs(te,{variant:"outline",children:[h.length," from partner feeds"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Pulled daily from public job boards (RemoteOK, WeWorkRemotely, Remotive). Apply links take you to the source site."}),r.jsx("div",{className:"space-y-3",children:h.map(b=>r.jsx(cre,{job:b},b.id))})]}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 py-8",children:r.jsx(Ej,{category:"tools",title:"Work from anywhere",blurb:"Keep your connection private and your applications moving, wherever you are.",ctaLabel:"Try"})}),r.jsx(Rt,{open:d,onOpenChange:u,children:r.jsxs(Ot,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Mt,{children:r.jsx(Dt,{children:"Post a Job"})}),r.jsx(TS,{})]})})]})}const z9={restaurants:{table:"restaurants",nameCol:"name",addrCol:"address",cityCol:"city",submitPath:"/submit?type=restaurant"},events:{table:"events",nameCol:"title",addrCol:"venue",cityCol:"city",submitPath:"/submit?type=event"},lodging:{table:"properties",nameCol:"title",addrCol:"address",cityCol:"city",submitPath:"/submit?type=property"},artisans:{table:"artisans",nameCol:"business_name",addrCol:"address",cityCol:"city",submitPath:"/submit?type=artisan"},groceries:{table:"service_providers",nameCol:"name",addrCol:"address",cityCol:"city",submitPath:"/submit?type=service"},churches:{table:"service_providers",nameCol:"name",addrCol:"address",cityCol:"city",submitPath:"/submit?type=service"}};function cJe(){const{city:e,category:t}=iv(),n=X1e(e),s=Z1e(t),[a,i]=j.useState([]),[o,l]=j.useState(!0);if(j.useEffect(()=>{!n||!s||c()},[e,t]),!n||!s)return r.jsx(V0,{to:"/diaspora",replace:!0});async function c(){if(!n||!s)return;l(!0);const m=z9[s.slug];try{let x=H.from(m.table).select("*").eq("moderation_status","approved").limit(30);x=x.ilike(m.cityCol,`%${n.name}%`);const{data:p}=await x;i(p||[])}catch(x){console.error("city-category fetch",x),i([])}finally{l(!1)}}const d=z9[s.slug],u=`${s.label} in ${n.name} | Naija ${n.countryName}`,h=s.intro(n.name),f={"@context":"https://schema.org","@type":"ItemList",name:`${s.label} in ${n.name}`,itemListElement:a.slice(0,10).map((m,x)=>({"@type":"ListItem",position:x+1,name:m[d.nameCol]||"Listing"}))};return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx(qn,{title:u,description:h,structuredData:f}),r.jsx(oo,{variant:"diaspora",title:`${s.label} in ${n.name}`,subtitle:`${n.name}, ${n.region} · ${n.countryName}`,icon:hn,badge:{text:n.population?`${n.population} Nigerians`:"Naija Diaspora Hub",icon:At}}),r.jsxs("nav",{className:"container max-w-6xl mx-auto px-4 pt-6 text-sm text-muted-foreground",children:[r.jsx(Vt,{to:"/diaspora",className:"hover:text-primary",children:"Diaspora"}),r.jsx(ax,{className:"inline h-3 w-3 mx-1"}),r.jsx(Vt,{to:`/diaspora/${n.slug}`,className:"hover:text-primary",children:n.name}),r.jsx(ax,{className:"inline h-3 w-3 mx-1"}),r.jsx("span",{className:"text-foreground",children:s.label})]}),r.jsx("section",{className:"container max-w-4xl mx-auto px-4 py-6",children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:h})}),r.jsx("section",{className:"container max-w-6xl mx-auto px-4 pb-10",children:o?r.jsx("div",{className:"flex justify-center py-16",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):a.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5",children:a.map((m,x)=>r.jsx(Y,{className:"hover:shadow-md transition-shadow",children:r.jsxs(X,{className:"p-5",children:[r.jsx("h3",{className:"font-semibold mb-1",children:m[d.nameCol]||"Listing"}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(At,{className:"h-3 w-3"}),m[d.addrCol]||`${n.name}, ${n.countryName}`]})]})},m.id||x))}):r.jsxs(Y,{className:"p-10 text-center",children:[r.jsxs("h3",{className:"font-semibold text-lg mb-2",children:["No ",s.label.toLowerCase()," listed in ",n.name," yet"]}),r.jsxs("p",{className:"text-muted-foreground mb-5",children:["Own or know a Nigerian ",s.singular," in ",n.name,"? Add it free and reach the diaspora."]}),r.jsx(W,{asChild:!0,children:r.jsxs(Vt,{to:`${d.submitPath}&city=${encodeURIComponent(n.name)}`,children:[r.jsx(xs,{className:"h-4 w-4 mr-2"})," Add a ",s.singular]})})]})}),r.jsxs("section",{className:"container max-w-6xl mx-auto px-4 pb-16",children:[r.jsxs("h2",{className:"text-lg font-semibold mb-3",children:["More ",s.label," cities"]}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-8",children:d6.filter(m=>m.slug!==n.slug).slice(0,12).map(m=>r.jsx(Vt,{to:`/diaspora/${m.slug}/${s.slug}`,className:"px-3 py-1.5 rounded-full text-sm border hover:bg-accent transition-colors",children:m.name},m.slug))}),r.jsxs("h2",{className:"text-lg font-semibold mb-3",children:["More categories in ",n.name]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Object.values(_X).filter(m=>m.slug!==s.slug).map(m=>r.jsx(Vt,{to:`/diaspora/${n.slug}/${m.slug}`,className:"px-3 py-1.5 rounded-full text-sm border hover:bg-accent transition-colors",children:m.label},m.slug))})]})]})}const q9="https://naija.com";function dJe(){var b,w,_;const{slug:e}=iv(),[t,n]=j.useState(null),[s,a]=j.useState(!0),[i,o]=j.useState(!1),[l,c]=j.useState([]);j.useEffect(()=>{e&&d()},[e]);async function d(){var C;a(!0),o(!1);try{const E=CK(e),{data:N,error:k}=await H.from("imported_events").select("*").eq("id",E).eq("is_active",!0).maybeSingle();if(k)throw k;if(!N){o(!0);return}n(N);const I=(C=N.city)==null?void 0:C.toLowerCase();let P=H.from("imported_events").select("*").eq("is_active",!0).neq("id",N.id).order("start_datetime",{ascending:!0,nullsFirst:!1}).limit(12);I&&(P=P.ilike("city",`%${I}%`));const{data:O}=await P;c(O||[])}catch(E){console.error("imported event detail",E),o(!0)}finally{a(!1)}}if(s)return r.jsx("div",{className:"flex justify-center py-32",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})});if(i||!t)return r.jsx(BL,{});
1292const u=[t.venue_name,t.city,t.state,t.country].filter(Boolean).join(", "),h=(b=t.city)==null?void 0:b.toLowerCase().replace(/[^a-z]+/g,"-"),f=h?`/events/${h}`:"/events",m=t.start_datetime?mm(t.start_datetime):null,x=t.last_seen_at?mm(t.last_seen_at):null,p=t.end_datetime||(m?new Date(m.getTime()+3*60*60*1e3).toISOString():void 0);let v;try{v=new URL(t.source_url).origin}catch{v=void 0}const g={"@context":"https://schema.org","@type":"Event",name:t.title,description:((w=t.description)==null?void 0:w.slice(0,300))||`Event in ${t.city||"Nigeria"} listed on Naija.com.`,url:`${q9}/events/listing/${e}`,image:t.image_url?[t.image_url]:void 0,startDate:t.start_datetime||void 0,endDate:p,eventStatus:"https://schema.org/EventScheduled",eventAttendanceMode:/online|virtual|webinar/i.test(`${t.title} ${t.venue_name??""}`)?"https://schema.org/OnlineEventAttendanceMode":"https://schema.org/OfflineEventAttendanceMode",location:{"@type":"Place",name:t.venue_name||t.city||"Nigeria",address:{"@type":"PostalAddress",addressLocality:t.city||void 0,addressRegion:t.state||void 0,addressCountry:t.country||void 0}},organizer:{"@type":"Organization",name:t.source_name,...v?{url:v}:{}},performer:{"@type":"PerformingGroup",name:t.title},offers:{"@type":"Offer",url:t.source_url,price:"0",priceCurrency:"NGN",availability:"https://schema.org/InStock",validFrom:t.start_datetime||void 0}},y=((_=t.description)==null?void 0:_.replace(/\s+/g," ").trim().slice(0,150))||`${t.title}${t.city?` in ${t.city}`:""}${m?` on ${wr(m,"EEE, MMM d")}`:""} â verified daily from ${t.source_name}.`;return r.jsxs("div",{className:"min-h-screen",children:[r.jsx(qn,{title:`${t.title} â ${t.city||"Nigeria"} Events | Naija.com`,description:y,type:"article",canonical:`${q9}/events/listing/${e}`,structuredData:g}),r.jsxs("section",{className:"relative h-64 md:h-80 overflow-hidden bg-muted",children:[t.image_url?r.jsx("img",{src:t.image_url,alt:t.title,className:"w-full h-full object-cover",fetchPriority:"high"}):r.jsx("div",{className:"w-full h-full bg-gradient-to-br from-primary/20 to-primary/5"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background via-background/40 to-transparent"}),r.jsx("div",{className:"absolute bottom-6 left-0 right-0",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs(te,{variant:"secondary",className:"mb-3 bg-background/90 text-foreground",children:["via ",t.source_name]}),r.jsx("h1",{className:"text-2xl md:text-4xl font-bold max-w-3xl",children:t.title})]})})]}),r.jsxs("section",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[r.jsxs(Vt,{to:f,className:"inline-flex items-center gap-1.5 text-sm text-primary mb-6 hover:underline",children:[r.jsx(ej,{className:"h-4 w-4"})," More ",t.city||"Nigeria"," events"]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 mb-6",children:[r.jsx(Y,{children:r.jsxs(X,{className:"p-4 space-y-2 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xt,{className:"h-4 w-4 text-primary shrink-0"}),r.jsx("span",{children:m?wr(m,"EEEE, MMMM d, yyyy"):"Date TBA"})]}),m&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($r,{className:"h-4 w-4 text-primary shrink-0"}),r.jsxs("span",{children:[wr(m,"h:mm a"),t.end_datetime?` â ${wr(mm(t.end_datetime),"h:mm a")}`:""]})]}),u&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(At,{className:"h-4 w-4 text-primary shrink-0"}),r.jsx("span",{children:u})]})]})}),r.jsx(Y,{children:r.jsxs(X,{className:"p-4 text-sm text-muted-foreground space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(sj,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsxs("span",{children:["Aggregated by Naija.com from ",r.jsx("strong",{children:t.source_name}),x?` â last verified ${wr(x,"MMM d, yyyy")}.`:"."]})]}),r.jsx("p",{children:"Naija.com gathers event listings daily so you can discover them in one place. Tickets and RSVPs are handled by the source site â never through Naija.com."})]})})]}),t.description&&r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none mb-8",children:r.jsx("p",{className:"whitespace-pre-line",children:t.description})}),t.tags&&t.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mb-8",children:t.tags.slice(0,8).map(C=>r.jsx(te,{variant:"outline",children:C},C))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsx(W,{asChild:!0,size:"lg",className:"flex-1",children:r.jsxs("a",{href:t.source_url,target:"_blank",rel:"noopener noreferrer sponsored",children:["Get tickets on ",t.source_name,r.jsx(ds,{className:"h-4 w-4 ml-2"})]})}),r.jsx(W,{asChild:!0,size:"lg",variant:"outline",className:"flex-1",children:r.jsx(Vt,{to:"/events",children:"Browse all events"})})]})]}),l.length>0&&r.jsxs("section",{className:"container mx-auto px-4 pb-16 max-w-6xl",children:[r.jsx("h2",{className:"text-2xl font-bold mb-6",children:"More upcoming events"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:l.slice(0,6).map(C=>r.jsx(n6,{event:C},C.id))})]})]})}const V9="https://naija.com";function uJe(){var x,p;const{slug:e}=iv(),[t,n]=j.useState(null),[s,a]=j.useState(!0),[i,o]=j.useState(!1),[l,c]=j.useState([]);j.useEffect(()=>{e&&d()},[e]);async function d(){a(!0),o(!1);try{const v=CK(e),{data:g,error:y}=await H.from("imported_jobs").select("*").eq("id",v).eq("is_active",!0).maybeSingle();if(y)throw y;if(!g){o(!0);return}n(g);const{data:b}=await H.from("imported_jobs").select("*").eq("is_active",!0).neq("id",g.id).order("published_at",{ascending:!1,nullsFirst:!1}).limit(6);c(b||[])}catch(v){console.error("imported job detail",v),o(!0)}finally{a(!1)}}if(s)return r.jsx("div",{className:"flex justify-center py-32",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})});if(i||!t)return r.jsx(BL,{});const u=/remote|anywhere|work from home/i.test(`${t.title} ${t.location??""}`),h=t.last_seen_at?mm(t.last_seen_at):null,f={"@context":"https://schema.org","@type":"JobPosting",title:t.title,de
1292scription:((x=t.description)==null?void 0:x.slice(0,5e3))||`${t.title} at ${t.company||t.source_name}${t.location?` â ${t.location}`:""}. View the full role and apply on ${t.source_name} via Naija.com.`,datePosted:t.published_at||void 0,url:`${V9}/jobs/listing/${e}`,identifier:{"@type":"PropertyValue",name:t.source_name,value:t.id},hiringOrganization:{"@type":"Organization",name:t.company||t.source_name},jobLocationType:u?"TELECOMMUTE":void 0,applicantLocationRequirements:u?{"@type":"Country",name:"Nigeria"}:void 0,jobLocation:u?void 0:{"@type":"Place",address:{"@type":"PostalAddress",addressLocality:t.location||void 0,addressCountry:t.country||void 0}},directApply:!1},m=((p=t.description)==null?void 0:p.replace(/\s+/g," ").trim().slice(0,150))||`${t.title} at ${t.company||"a company hiring via "+t.source_name}${t.location?` â ${t.location}`:""}. Apply on the source site via Naija.com jobs.`;return r.jsxs("div",{className:"min-h-screen",children:[r.jsx(qn,{title:`${t.title} â ${t.company||t.source_name} | Naija.com Jobs`,description:m,type:"article",canonical:`${V9}/jobs/listing/${e}`,structuredData:f}),r.jsx("section",{className:"border-b bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4 py-10 max-w-4xl",children:[r.jsxs(Vt,{to:"/jobs",className:"inline-flex items-center gap-1.5 text-sm text-primary mb-6 hover:underline",children:[r.jsx(ej,{className:"h-4 w-4"})," All jobs"]}),r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"h-14 w-14 rounded-xl bg-primary/10 flex items-center justify-center shrink-0",children:r.jsx(fr,{className:"h-7 w-7 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl md:text-3xl font-bold",children:t.title}),r.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted-foreground mt-2",children:[t.company&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(W2,{className:"h-4 w-4"})," ",t.company]}),t.location&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(At,{className:"h-4 w-4"})," ",t.location]}),t.salary_text&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(V2,{className:"h-4 w-4"})," ",t.salary_text]}),t.published_at&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx($r,{className:"h-4 w-4"}),"Posted ",Im(mm(t.published_at),{addSuffix:!0})]})]})]})]})]})}),r.jsxs("section",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[r.jsx(Y,{className:"mb-6",children:r.jsxs(X,{className:"p-4 text-sm text-muted-foreground space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(sj,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsxs("span",{children:["Aggregated by Naija.com from ",r.jsx("strong",{children:t.source_name}),h?` â last verified ${wr(h,"MMM d, yyyy")}.`:"."]})]}),r.jsx("p",{children:"Naija.com surfaces remote and diaspora-friendly roles from trusted job boards daily. Applications happen on the source site â Naija.com never takes your CV or application fee."})]})}),t.description?r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none mb-8",children:r.jsx("p",{className:"whitespace-pre-line",children:t.description})}):r.jsxs("p",{className:"text-muted-foreground mb-8",children:["The full role description lives on ",t.source_name,". Use the button below to view and apply."]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsx(W,{asChild:!0,size:"lg",className:"flex-1",children:r.jsxs("a",{href:t.apply_url,target:"_blank",rel:"noopener noreferrer sponsored",children:["Apply on ",t.source_name,r.jsx(ds,{className:"h-4 w-4 ml-2"})]})}),r.jsx(W,{asChild:!0,size:"lg",variant:"outline",className:"flex-1",children:r.jsx(Vt,{to:"/jobs/remote",children:"More remote jobs"})})]})]}),l.length>0&&r.jsxs("section",{className:"container mx-auto px-4 pb-16 max-w-5xl",children:[r.jsx("h2",{className:"text-2xl font-bold mb-6",children:"More recent jobs"}),r.jsx("div",{className:"space-y-3",children:l.map(v=>r.jsx(cre,{job:v},v.id))})]})]})}const hJe="https://naija.com";function fJe(){const{citySlug:e}=iv(),t=ube(e),[n,s]=j.useState([]),[a,i]=j.useState(!0);j.useEffect(()=>{t&&o()},[t==null?void 0:t.slug]);async function o(){i(!0);try{const d=new Date,u=new Date(d.getTime()-24*60*60*1e3).toISOString(),{data:h,error:f}=await H.from("imported_events").select("*").eq("is_active",!0).or(`start_datetime.is.null,start_datetime.gte.${u}`).order("start_datetime",{ascending:!0,nullsFirst:!1}).limit(200);if(f)throw f;s(h||[])}catch(d){console.error("event hub fetch",d)}finally{i(!1)}}const l=j.useMemo(()=>t?n.filter(d=>hbe(t,d)):[],[n,t]);if(!t)return r.jsxs("div",{className:"container mx-auto px-4 py-24 text-center",children:[r.jsx("h1",{className:"text-2xl font-bold mb-4",children:"City not found"}),r.jsx(Vt,{to:"/events",className:"text-primary hover:underline",children:"Browse all events"})]});
1292const c=new Date().toLocaleString("en-GB",{month:"long",year:"numeric"});return r.jsxs("div",{className:"min-h-screen",children:[r.jsx(qn,{title:`Events in ${t.name} ${c} â Updated Daily | Naija.com`,description:`Events in ${t.name}, Nigeria â concerts, shows and community gatherings discovered daily from trusted listing sites. Free to browse on Naija.com.`,canonical:`${hJe}/events/${t.slug}`}),r.jsx(oo,{variant:"events",title:`Events in ${t.name}`,subtitle:t.intro}),r.jsxs("section",{className:"container mx-auto px-4 py-10",children:[r.jsx("div",{className:"flex flex-wrap gap-2 mb-8",children:SS.filter(d=>d.slug!==t.slug).map(d=>r.jsxs(Vt,{to:`/events/${d.slug}`,className:"rounded-full border px-4 py-1.5 text-sm hover:bg-accent transition-colors",children:["Events in ",d.name]},d.slug))}),a?r.jsx("div",{className:"flex justify-center py-16",children:r.jsx(yt,{className:"h-8 w-8 animate-spin text-primary"})}):l.length>0?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:l.map(d=>r.jsx(n6,{event:d},d.id))}):r.jsxs(Y,{className:"p-10 text-center",children:[r.jsx(Vq,{className:"h-12 w-12 mx-auto mb-3 text-muted-foreground/60"}),r.jsxs("h2",{className:"font-semibold mb-2",children:["No ",t.name," events right now"]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["The feed refreshes daily â check back soon, or browse ",r.jsx(Vt,{to:"/events",className:"text-primary hover:underline",children:"all events"}),"."]})]})]})]})}const mJe=/^[a-z0-9][a-z0-9-]{0,63}$/,pJe=()=>{const{slug:e=""}=iv(),[t,n]=j.useState("loading"),[s,a]=j.useState(""),[i,o]=j.useState(null),[l,c]=j.useState(""),d=j.useRef(!1),u=j.useCallback(async()=>{if(!mJe.test(e)){n("missing");return}const{data:h,error:f}=await H.from("affiliate_partners").select("name, public_url, disclosure").eq("slug",e).eq("is_active",!0).maybeSingle();if(f){console.error("go: partner lookup failed",f.message),n("missing");return}if(!(h!=null&&h.public_url)){n("missing");return}a(h.name),c(h.disclosure??""),n("ready");const m=await o1e(e,h.public_url);o(m),d.current||(d.current=!0,window.location.replace(m))},[e]);return j.useEffect(()=>{d.current=!1,n("loading"),u()},[u]),t==="missing"?r.jsx("div",{className:"container mx-auto px-4 py-16",children:r.jsx(Y,{children:r.jsxs(X,{className:"pt-6 text-center",children:[r.jsx(Oo,{className:"mx-auto mb-3 h-8 w-8 text-amber-500"}),r.jsx("h1",{className:"text-xl font-semibold mb-2",children:"This link is not recognised"}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["We could not find a partner called ",r.jsx("span",{className:"font-medium",children:e}),". It may have been retired."]}),r.jsx(W,{asChild:!0,children:r.jsx(Vt,{to:"/",children:"Back to Naija.com"})})]})})}):r.jsx("div",{className:"container mx-auto px-4 py-16 max-w-lg",children:r.jsx(Y,{children:r.jsx(X,{className:"pt-6 text-center",children:t==="loading"||!i?r.jsxs(r.Fragment,{children:[r.jsx(jn,{className:"mx-auto mb-4 h-6 w-40"}),r.jsx(jn,{className:"mx-auto h-10 w-56"})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground mb-1",children:"Leaving Naija.com"}),r.jsx("h1",{className:"text-xl font-semibold mb-2",children:s}),r.jsx("p",{className:"text-sm text-muted-foreground mb-5",children:"Taking you over now. If nothing happens, use the button below."}),r.jsx(W,{asChild:!0,children:r.jsxs("a",{href:i,rel:"sponsored nofollow noopener",target:"_blank",onClick:()=>jX(),children:["Continue to ",s,r.jsx(ds,{className:"ml-2 h-4 w-4"})]})}),l?r.jsx("p",{className:"mt-5 text-[11px] leading-relaxed text-muted-foreground",children:l}):null]})})})})},gJe=new _de,xJe=()=>(kW(),r.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col",children:[r.jsx(qoe,{}),r.jsx(jle,{}),r.jsx(fme,{}),r.jsx(jye,{}),r.jsx("main",{className:"flex-1 pb-20 md:pb-0",children:r.jsx(hme,{children:r.jsxs(Eue,{children:[r.jsx(Rr,{path:"/",element:r.jsx(gbe,{})}),r.jsx(Rr,{path:"/explore",element:r.jsx(vbe,{})}),r.jsx(Rr,{path:"/news",element:r.jsx(qZe,{})}),r.jsx(Rr,{path:"/buy-sell",element:r.jsx(x1e,{})}),r.jsx(Rr,{path:"/classifieds",element:r.jsx(K1e,{})}),r.jsx(Rr,{path:"/artisans",element:r.jsx(I1e,{})}),r.jsx(Rr,{path:"/events",element:r.jsx(n1e,{})}),r.jsx(Rr,{path:"/events/listing/:slug",element:r.jsx(dJe,{})}),r.jsx(Rr,{path:"/events/:citySlug",element:r.jsx(fJe,{})}),r.jsx(Rr,{path:"/events/dashboard",element:r.jsx(a1e,{})}),r.jsx(Rr,{path:"/jobs/listing/:slug",element:r.jsx(uJe,{})}),r.jsx(Rr,{path:"/restaurants",element:r.jsx(C1e,{})}),r.jsx(Rr,{path:"/tourism",element:r.jsx(W1e,{})}),r.jsx(Rr,{path:"/lodging",element:r.jsx(V0,{to:"/rentals",replace:!0})}),r.jsx(Rr,{path:"/rentals",element:r.jsx(lre,{})}),r.jsx(Rr,{path:"/rental-cars",element:r.jsx(nJe,{})}),r.jsx(Rr,{path:"/refund-policy",element:r.jsx(rJe,{})}),r.jsx(Rr,{path:"/creativity",element:r.jsx(Zbe,{})}),r.jsx(Rr,{path:"/diaspora",element:r.jsx(sNe,{})}),r.jsx(Rr,{path:"/diaspora/send-money",element:r.jsx(F9,{})}),r.jsx(Rr,{path:"/send-money",element:r.jsx(F9,{})}),r.jsx(Rr,{path:"/diaspora/:city/:category",element:r.jsx(cJe,{})}),r.jsx(Rr,{path:"/jobs",element:r.jsx(U9,{})}),r.jsx(Rr,{path:"/jobs/:city",element:r.jsx(U9,{})}),r.jsx(Rr,{path:"/submit",element:r.jsx(aNe,{})}),r.jsx(Rr,{path:"/about",element:r.jsx(iNe,{})}),r.jsx(Rr,{path:"/contact",element:r.jsx(oNe,{})}),r.jsx(Rr,{path:"/donate",element:r.jsx(cNe,{})}),r.jsx(Rr,{path:"/create",element:r.jsx(fNe,{})}),r.jsx(Rr,{path:"/privacy-policy",element:r.jsx(mNe,{})}),r.jsx(Rr,{path:"/terms-of-service",element:r.jsx(pNe,{})}),r.jsx(Rr,{path:"/community-guidelines",element:r.jsx(gNe,{})}),r.jsx(Rr,{path:"/cookie-policy",element:r.jsx(xNe,{})}),r.jsx(Rr,{path:"/advertise",element:r.jsx(YZe,{})}),r.jsx(Rr,{path:"/payments",element:r.jsx(yNe,{})}),r.jsx(Rr,{path:"/auth",element:r.jsx(bNe,{})}),r.jsx(Rr,{path:"/dashboard",element:r.jsx(nSe,{})}),r.jsx(Rr,{path:"/admin",element:r.jsx(FZe,{})}),r.jsx(Rr,{path:"/settings/location",element:r.jsx(KZe,{})}),r.jsx(Rr,{path:"/go/:slug",element:r.jsx(pJe,{})}),r.jsx(Rr,{path:"/403",element:r.jsx(VZe,{})}),r.jsx(Rr,{path:"*",element:r.jsx(BL,{})})]})})}),r.jsx(wye,{}),r.jsx(Sye,{})]})),vJe=()=>r.jsx(Pde,{client:gJe,children:r.jsx(ade,{children:r.jsx(ame,{children:r.jsxs($ue,{children:[r.jsx(xJe,{}),r.jsx(XZe,{}),r.jsx(ZZe,{})]})})})});fq(document.getElementById("root")).render(r.jsx(vJe,{}));export{En as _,oi as c,_n as g};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.