var Vpe=Object.defineProperty;var f$=e=>{throw TypeError(e)};var Wpe=(e,t,r)=>t in e?Vpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var zn=(e,t,r)=>Wpe(e,typeof t!="symbol"?t+"":t,r),GA=(e,t,r)=>t.has(e)||f$("Cannot "+r);var ze=(e,t,r)=>(GA(e,t,"read from private field"),r?r.call(e):t.get(e)),_r=(e,t,r)=>t.has(e)?f$("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Yt=(e,t,r,n)=>(GA(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),dn=(e,t,r)=>(GA(e,t,"access private method"),r);var sN=(e,t,r,n)=>({set _(a){Yt(e,t,a,r)},get _(){return ze(e,t,n)}});function Hpe(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(n,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>n[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"]'))n(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"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(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 n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var Fc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Gpe(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}),r}var aX={exports:{}},Lk={},iX={exports:{}},xn={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Aj=Symbol.for("react.element"),Kpe=Symbol.for("react.portal"),Ype=Symbol.for("react.fragment"),Xpe=Symbol.for("react.strict_mode"),Zpe=Symbol.for("react.profiler"),Jpe=Symbol.for("react.provider"),Qpe=Symbol.for("react.context"),e0e=Symbol.for("react.forward_ref"),t0e=Symbol.for("react.suspense"),r0e=Symbol.for("react.memo"),n0e=Symbol.for("react.lazy"),h$=Symbol.iterator;function s0e(e){return e===null||typeof e!="object"?null:(e=h$&&e[h$]||e["@@iterator"],typeof e=="function"?e:null)}var oX={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},lX=Object.assign,cX={};function zy(e,t,r){this.props=e,this.context=t,this.refs=cX,this.updater=r||oX}zy.prototype.isReactComponent={};zy.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")};zy.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function uX(){}uX.prototype=zy.prototype;function dI(e,t,r){this.props=e,this.context=t,this.refs=cX,this.updater=r||oX}var fI=dI.prototype=new uX;fI.constructor=dI;lX(fI,zy.prototype);fI.isPureReactComponent=!0;var m$=Array.isArray,dX=Object.prototype.hasOwnProperty,hI={current:null},fX={key:!0,ref:!0,__self:!0,__source:!0};function hX(e,t,r){var n,a={},i=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)dX.call(t,n)&&!fX.hasOwnProperty(n)&&(a[n]=t[n]);var l=arguments.length-2;if(l===1)a.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)a[n]===void 0&&(a[n]=l[n]);return{$$typeof:Aj,type:e,key:i,ref:o,props:a,_owner:hI.current}}function a0e(e,t){return{$$typeof:Aj,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function mI(e){return typeof e=="object"&&e!==null&&e.$$typeof===Aj}function i0e(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var p$=/\/+/g;function KA(e,t){return typeof e=="object"&&e!==null&&e.key!=null?i0e(""+e.key):t.toString(36)}function MS(e,t,r,n,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 Aj:case Kpe:o=!0}}if(o)return o=e,a=a(o),e=n===""?"."+KA(o,0):n,m$(a)?(r="",e!=null&&(r=e.replace(p$,"$&/")+"/"),MS(a,t,r,"",function(u){return u})):a!=null&&(mI(a)&&(a=a0e(a,r+(!a.key||o&&o.key===a.key?"":(""+a.key).replace(p$,"$&/")+"/")+e)),t.push(a)),1;if(o=0,n=n===""?".":n+":",m$(e))for(var l=0;l<e.length;l++){i=e[l];var c=n+KA(i,l);o+=MS(i,t,r,c,a)}else if(c=s0e(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=n+KA(i,l++),o+=MS(i,t,r,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 aN(e,t,r){if(e==null)return e;var n=[],a=0;return MS(e,n,"","",function(i){return t.call(r,i,a++)}),n}function o0e(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ko={current:null},$S={transition:null},l0e={ReactCurrentDispatcher:Ko,ReactCurrentBatchConfig:$S,ReactCurrentOwner:hI};function mX(){throw Error("act(...) is not supported in production builds of React.")}xn.Children={map:aN,forEach:function(e,t,r){aN(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return aN(e,function(){t++}),t},toArray:function(e){return aN(e,function(t){return t})||[]},only:function(e){if(!mI(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};xn.Component=zy;xn.Fragment=Ype;xn.Profiler=Zpe;xn.PureComponent=dI;xn.StrictMode=Xpe;xn.Suspense=t0e;xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=l0e;xn.act=mX;xn.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=lX({},e.props),a=e.key,i=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,o=hI.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)dX.call(t,c)&&!fX.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:Aj,type:e.type,key:a,ref:i,props:n,_owner:o}};xn.createContext=function(e){return e={$$typeof:Qpe,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Jpe,_context:e},e.Consumer=e};xn.createElement=hX;xn.createFactory=function(e){var t=hX.bind(null,e);return t.type=e,t};xn.createRef=function(){return{current:null}};xn.forwardRef=function(e){return{$$typeof:e0e,render:e}};xn.isValidElement=mI;xn.lazy=function(e){return{$$typeof:n0e,_payload:{_status:-1,_result:e},_init:o0e}};xn.memo=function(e,t){return{$$typeof:r0e,type:e,compare:t===void 0?null:t}};xn.startTransition=function(e){var t=$S.transition;$S.transition={};try{e()}finally{$S.transition=t}};xn.unstable_act=mX;xn.useCallback=function(e,t){return Ko.current.useCallback(e,t)};xn.useContext=function(e){return Ko.current.useContext(e)};xn.useDebugValue=function(){};xn.useDeferredValue=function(e){return Ko.current.useDeferredValue(e)};xn.useEffect=function(e,t){return Ko.current.useEffect(e,t)};xn.useId=function(){return Ko.current.useId()};xn.useImperativeHandle=function(e,t,r){return Ko.current.useImperativeHandle(e,t,r)};xn.useInsertionEffect=function(e,t){return Ko.current.useInsertionEffect(e,t)};xn.useLayoutEffect=function(e,t){return Ko.current.useLayoutEffect(e,t)};xn.useMemo=function(e,t){return Ko.current.useMemo(e,t)};xn.useReducer=function(e,t,r){return Ko.current.useReducer(e,t,r)};xn.useRef=function(e){return Ko.current.useRef(e)};xn.useState=function(e){return Ko.current.useState(e)};xn.useSyncExternalStore=function(e,t,r){return Ko.current.useSyncExternalStore(e,t,r)};xn.useTransition=function(){return Ko.current.useTransition()};xn.version="18.3.1";iX.exports=xn;var w=iX.exports;const be=jn(w),pI=Hpe({__proto__:null,default:be},[w]);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var c0e=w,u0e=Symbol.for("react.element"),d0e=Symbol.for("react.fragment"),f0e=Object.prototype.hasOwnProperty,h0e=c0e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m0e={key:!0,ref:!0,__self:!0,__source:!0};function pX(e,t,r){var n,a={},i=null,o=null;r!==void 0&&(i=""+r),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)f0e.call(t,n)&&!m0e.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)a[n]===void 0&&(a[n]=t[n]);return{$$typeof:u0e,type:e,key:i,ref:o,props:a,_owner:h0e.current}}Lk.Fragment=d0e;Lk.jsx=pX;Lk.jsxs=pX;aX.exports=Lk;var s=aX.exports,gX={exports:{}},oc={},xX={exports:{}},vX={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(e){function t(L,M){var z=L.length;L.push(M);e:for(;0<z;){var K=z-1>>>1,E=L[K];if(0<a(E,M))L[K]=M,L[z]=E,z=K;else break e}}function r(L){return L.length===0?null:L[0]}function n(L){if(L.length===0)return null;var M=L[0],z=L.pop();if(z!==M){L[0]=z;e:for(var K=0,E=L.length,A=E>>>1;K<A;){var O=2*(K+1)-1,U=L[O],Y=O+1,J=L[Y];if(0>a(U,z))Y<E&&0>a(J,U)?(L[K]=J,L[Y]=z,K=Y):(L[K]=U,L[O]=z,K=O);else if(Y<E&&0>a(J,z))L[K]=J,L[Y]=z,K=Y;else break e}}return M}function a(L,M){var z=L.sortIndex-M.sortIndex;return z!==0?z:L.id-M.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=[],u=[],d=1,f=null,m=3,h=!1,g=!1,p=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(L){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=L)n(u),M.sortIndex=M.expirationTime,t(c,M);else break;M=r(u)}}function N(L){if(p=!1,y(L),!g)if(r(c)!==null)g=!0,H(_);else{var M=r(u);M!==null&&q(N,M.startTime-L)}}function _(L,M){g=!1,p&&(p=!1,v(I),I=-1),h=!0;var z=m;try{for(y(M),f=r(c);f!==null&&(!(f.expirationTime>M)||L&&!T());){var K=f.callback;if(typeof K=="function"){f.callback=null,m=f.priorityLevel;var E=K(f.expirationTime<=M);M=e.unstable_now(),typeof E=="function"?f.callback=E:f===r(c)&&n(c),y(M)}else n(c);f=r(c)}if(f!==null)var A=!0;else{var O=r(u);O!==null&&q(N,O.startTime-M),A=!1}return A}finally{f=null,m=z,h=!1}}var j=!1,S=null,I=-1,P=5,F=-1;function T(){return!(e.unstable_now()-F<P)}function k(){if(S!==null){var L=e.unstable_now();F=L;var M=!0;try{M=S(!0,L)}finally{M?V():(j=!1,S=null)}}else j=!1}var V;if(typeof b=="function")V=function(){b(k)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,R=C.port2;C.port1.onmessage=k,V=function(){R.postMessage(null)}}else V=function(){x(k,0)};function H(L){S=L,j||(j=!0,V())}function q(L,M){I=x(function(){L(e.unstable_now())},M)}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(L){L.callback=null},e.unstable_continueExecution=function(){g||h||(g=!0,H(_))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(L){switch(m){case 1:case 2:case 3:var M=3;break;default:M=m}var z=m;m=M;try{return L()}finally{m=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,M){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var z=m;m=L;try{return M()}finally{m=z}},e.unstable_scheduleCallback=function(L,M,z){var K=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?K+z:K):z=K,L){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=z+E,L={id:d++,callback:M,priorityLevel:L,startTime:z,expirationTime:E,sortIndex:-1},z>K?(L.sortIndex=z,t(u,L),r(c)===null&&L===r(u)&&(p?(v(I),I=-1):p=!0,q(N,z-K))):(L.sortIndex=E,t(c,L),g||h||(g=!0,H(_))),L},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(L){var M=m;return function(){var z=m;m=M;try{return L.apply(this,arguments)}finally{m=z}}}})(vX);xX.exports=vX;var p0e=xX.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var g0e=w,rc=p0e;function Et(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);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 yX=new Set,Bw={};function Ag(e,t){Hv(e,t),Hv(e+"Capture",t)}function Hv(e,t){for(Bw[e]=t,e=0;e<t.length;e++)yX.add(t[e])}var ah=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),BP=Object.prototype.hasOwnProperty,x0e=/^[: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]*$/,g$={},x$={};function v0e(e){return BP.call(x$,e)?!0:BP.call(g$,e)?!1:x0e.test(e)?x$[e]=!0:(g$[e]=!0,!1)}function y0e(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function b0e(e,t,r,n){if(t===null||typeof t>"u"||y0e(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.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 Yo(e,t,r,n,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Zi={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Zi[e]=new Yo(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Zi[t]=new Yo(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Zi[e]=new Yo(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Zi[e]=new Yo(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){Zi[e]=new Yo(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Zi[e]=new Yo(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Zi[e]=new Yo(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Zi[e]=new Yo(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Zi[e]=new Yo(e,5,!1,e.toLowerCase(),null,!1,!1)});var gI=/[\-:]([a-z])/g;function xI(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(gI,xI);Zi[t]=new Yo(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(gI,xI);Zi[t]=new Yo(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(gI,xI);Zi[t]=new Yo(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Zi[e]=new Yo(e,1,!1,e.toLowerCase(),null,!1,!1)});Zi.xlinkHref=new Yo("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Zi[e]=new Yo(e,1,!1,e.toLowerCase(),null,!0,!0)});function vI(e,t,r,n){var a=Zi.hasOwnProperty(t)?Zi[t]:null;(a!==null?a.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(b0e(t,r,a,n)&&(r=null),n||a===null?v0e(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):a.mustUseProperty?e[a.propertyName]=r===null?a.type===3?!1:"":r:(t=a.attributeName,n=a.attributeNamespace,r===null?e.removeAttribute(t):(a=a.type,r=a===3||a===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var yh=g0e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,iN=Symbol.for("react.element"),Ux=Symbol.for("react.portal"),qx=Symbol.for("react.fragment"),yI=Symbol.for("react.strict_mode"),zP=Symbol.for("react.profiler"),bX=Symbol.for("react.provider"),wX=Symbol.for("react.context"),bI=Symbol.for("react.forward_ref"),UP=Symbol.for("react.suspense"),qP=Symbol.for("react.suspense_list"),wI=Symbol.for("react.memo"),sm=Symbol.for("react.lazy"),jX=Symbol.for("react.offscreen"),v$=Symbol.iterator;function lb(e){return e===null||typeof e!="object"?null:(e=v$&&e[v$]||e["@@iterator"],typeof e=="function"?e:null)}var ra=Object.assign,YA;function zb(e){if(YA===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);YA=t&&t[1]||""}return`
`+YA+e}var XA=!1;function ZA(e,t){if(!e||XA)return"";XA=!0;var r=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(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var a=u.stack.split(`
`),i=n.stack.split(`
`),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=`
`+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{XA=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?zb(e):""}function w0e(e){switch(e.tag){case 5:return zb(e.type);case 16:return zb("Lazy");case 13:return zb("Suspense");case 19:return zb("SuspenseList");case 0:case 2:case 15:return e=ZA(e.type,!1),e;case 11:return e=ZA(e.type.render,!1),e;case 1:return e=ZA(e.type,!0),e;default:return""}}function VP(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 qx:return"Fragment";case Ux:return"Portal";case zP:return"Profiler";case yI:return"StrictMode";case UP:return"Suspense";case qP:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case wX:return(e.displayName||"Context")+".Consumer";case bX:return(e._context.displayName||"Context")+".Provider";case bI:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case wI:return t=e.displayName||null,t!==null?t:VP(e.type)||"Memo";case sm:t=e._payload,e=e._init;try{return VP(e(t))}catch{}}return null}function j0e(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 VP(t);case 8:return t===yI?"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 Xm(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _X(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _0e(e){var t=_X(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oN(e){e._valueTracker||(e._valueTracker=_0e(e))}function NX(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=_X(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function m5(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 WP(e,t){var r=t.checked;return ra({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function y$(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=Xm(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function SX(e,t){t=t.checked,t!=null&&vI(e,"checked",t,!1)}function HP(e,t){SX(e,t);var r=Xm(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?GP(e,t.type,r):t.hasOwnProperty("defaultValue")&&GP(e,t.type,Xm(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function b$(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function GP(e,t,r){(t!=="number"||m5(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Ub=Array.isArray;function cv(e,t,r,n){if(e=e.options,t){t={};for(var a=0;a<r.length;a++)t["$"+r[a]]=!0;for(r=0;r<e.length;r++)a=t.hasOwnProperty("$"+e[r].value),e[r].selected!==a&&(e[r].selected=a),a&&n&&(e[r].defaultSelected=!0)}else{for(r=""+Xm(r),t=null,a=0;a<e.length;a++){if(e[a].value===r){e[a].selected=!0,n&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function KP(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Et(91));return ra({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function w$(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(Et(92));if(Ub(r)){if(1<r.length)throw Error(Et(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:Xm(r)}}function kX(e,t){var r=Xm(t.value),n=Xm(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function j$(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function CX(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 YP(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?CX(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var lN,EX=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,a){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(lN=lN||document.createElement("div"),lN.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=lN.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function zw(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Qb={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},N0e=["Webkit","ms","Moz","O"];Object.keys(Qb).forEach(function(e){N0e.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Qb[t]=Qb[e]})});function AX(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Qb.hasOwnProperty(e)&&Qb[e]?(""+t).trim():t+"px"}function TX(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,a=AX(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,a):e[r]=a}}var S0e=ra({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 XP(e,t){if(t){if(S0e[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Et(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Et(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Et(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Et(62))}}function ZP(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 JP=null;function jI(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var QP=null,uv=null,dv=null;function _$(e){if(e=Oj(e)){if(typeof QP!="function")throw Error(Et(280));var t=e.stateNode;t&&(t=zk(t),QP(e.stateNode,e.type,t))}}function PX(e){uv?dv?dv.push(e):dv=[e]:uv=e}function OX(){if(uv){var e=uv,t=dv;if(dv=uv=null,_$(e),t)for(e=0;e<t.length;e++)_$(t[e])}}function DX(e,t){return e(t)}function IX(){}var JA=!1;function RX(e,t,r){if(JA)return e(t,r);JA=!0;try{return DX(e,t,r)}finally{JA=!1,(uv!==null||dv!==null)&&(IX(),OX())}}function Uw(e,t){var r=e.stateNode;if(r===null)return null;var n=zk(r);if(n===null)return null;r=n[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":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(Et(231,t,typeof r));return r}var eO=!1;if(ah)try{var cb={};Object.defineProperty(cb,"passive",{get:function(){eO=!0}}),window.addEventListener("test",cb,cb),window.removeEventListener("test",cb,cb)}catch{eO=!1}function k0e(e,t,r,n,a,i,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}var ew=!1,p5=null,g5=!1,tO=null,C0e={onError:function(e){ew=!0,p5=e}};function E0e(e,t,r,n,a,i,o,l,c){ew=!1,p5=null,k0e.apply(C0e,arguments)}function A0e(e,t,r,n,a,i,o,l,c){if(E0e.apply(this,arguments),ew){if(ew){var u=p5;ew=!1,p5=null}else throw Error(Et(198));g5||(g5=!0,tO=u)}}function Tg(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function LX(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 N$(e){if(Tg(e)!==e)throw Error(Et(188))}function T0e(e){var t=e.alternate;if(!t){if(t=Tg(e),t===null)throw Error(Et(188));return t!==e?null:e}for(var r=e,n=t;;){var a=r.return;if(a===null)break;var i=a.alternate;if(i===null){if(n=a.return,n!==null){r=n;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===r)return N$(a),e;if(i===n)return N$(a),t;i=i.sibling}throw Error(Et(188))}if(r.return!==n.return)r=a,n=i;else{for(var o=!1,l=a.child;l;){if(l===r){o=!0,r=a,n=i;break}if(l===n){o=!0,n=a,r=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===r){o=!0,r=i,n=a;break}if(l===n){o=!0,n=i,r=a;break}l=l.sibling}if(!o)throw Error(Et(189))}}if(r.alternate!==n)throw Error(Et(190))}if(r.tag!==3)throw Error(Et(188));return r.stateNode.current===r?e:t}function FX(e){return e=T0e(e),e!==null?MX(e):null}function MX(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=MX(e);if(t!==null)return t;e=e.sibling}return null}var $X=rc.unstable_scheduleCallback,S$=rc.unstable_cancelCallback,P0e=rc.unstable_shouldYield,O0e=rc.unstable_requestPaint,Ea=rc.unstable_now,D0e=rc.unstable_getCurrentPriorityLevel,_I=rc.unstable_ImmediatePriority,BX=rc.unstable_UserBlockingPriority,x5=rc.unstable_NormalPriority,I0e=rc.unstable_LowPriority,zX=rc.unstable_IdlePriority,Fk=null,Bd=null;function R0e(e){if(Bd&&typeof Bd.onCommitFiberRoot=="function")try{Bd.onCommitFiberRoot(Fk,e,void 0,(e.current.flags&128)===128)}catch{}}var Uu=Math.clz32?Math.clz32:M0e,L0e=Math.log,F0e=Math.LN2;function M0e(e){return e>>>=0,e===0?32:31-(L0e(e)/F0e|0)|0}var cN=64,uN=4194304;function qb(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 v5(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,a=e.suspendedLanes,i=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~a;l!==0?n=qb(l):(i&=o,i!==0&&(n=qb(i)))}else o=r&~a,o!==0?n=qb(o):i!==0&&(n=qb(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&a)&&(a=n&-n,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-Uu(t),a=1<<r,n|=e[r],t&=~a;return n}function $0e(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 B0e(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var o=31-Uu(i),l=1<<o,c=a[o];c===-1?(!(l&r)||l&n)&&(a[o]=$0e(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function rO(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function UX(){var e=cN;return cN<<=1,!(cN&4194240)&&(cN=64),e}function QA(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Tj(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Uu(t),e[t]=r}function z0e(e,t){var r=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 n=e.eventTimes;for(e=e.expirationTimes;0<r;){var a=31-Uu(r),i=1<<a;t[a]=0,n[a]=-1,e[a]=-1,r&=~i}}function NI(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-Uu(r),a=1<<n;a&t|e[n]&t&&(e[n]|=t),r&=~a}}var ss=0;function qX(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var VX,SI,WX,HX,GX,nO=!1,dN=[],Lm=null,Fm=null,Mm=null,qw=new Map,Vw=new Map,lm=[],U0e="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 k$(e,t){switch(e){case"focusin":case"focusout":Lm=null;break;case"dragenter":case"dragleave":Fm=null;break;case"mouseover":case"mouseout":Mm=null;break;case"pointerover":case"pointerout":qw.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vw.delete(t.pointerId)}}function ub(e,t,r,n,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:i,targetContainers:[a]},t!==null&&(t=Oj(t),t!==null&&SI(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function q0e(e,t,r,n,a){switch(t){case"focusin":return Lm=ub(Lm,e,t,r,n,a),!0;case"dragenter":return Fm=ub(Fm,e,t,r,n,a),!0;case"mouseover":return Mm=ub(Mm,e,t,r,n,a),!0;case"pointerover":var i=a.pointerId;return qw.set(i,ub(qw.get(i)||null,e,t,r,n,a)),!0;case"gotpointercapture":return i=a.pointerId,Vw.set(i,ub(Vw.get(i)||null,e,t,r,n,a)),!0}return!1}function KX(e){var t=v0(e.target);if(t!==null){var r=Tg(t);if(r!==null){if(t=r.tag,t===13){if(t=LX(r),t!==null){e.blockedOn=t,GX(e.priority,function(){WX(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function BS(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=sO(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);JP=n,r.target.dispatchEvent(n),JP=null}else return t=Oj(r),t!==null&&SI(t),e.blockedOn=r,!1;t.shift()}return!0}function C$(e,t,r){BS(e)&&r.delete(t)}function V0e(){nO=!1,Lm!==null&&BS(Lm)&&(Lm=null),Fm!==null&&BS(Fm)&&(Fm=null),Mm!==null&&BS(Mm)&&(Mm=null),qw.forEach(C$),Vw.forEach(C$)}function db(e,t){e.blockedOn===t&&(e.blockedOn=null,nO||(nO=!0,rc.unstable_scheduleCallback(rc.unstable_NormalPriority,V0e)))}function Ww(e){function t(a){return db(a,e)}if(0<dN.length){db(dN[0],e);for(var r=1;r<dN.length;r++){var n=dN[r];n.blockedOn===e&&(n.blockedOn=null)}}for(Lm!==null&&db(Lm,e),Fm!==null&&db(Fm,e),Mm!==null&&db(Mm,e),qw.forEach(t),Vw.forEach(t),r=0;r<lm.length;r++)n=lm[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<lm.length&&(r=lm[0],r.blockedOn===null);)KX(r),r.blockedOn===null&&lm.shift()}var fv=yh.ReactCurrentBatchConfig,y5=!0;function W0e(e,t,r,n){var a=ss,i=fv.transition;fv.transition=null;try{ss=1,kI(e,t,r,n)}finally{ss=a,fv.transition=i}}function H0e(e,t,r,n){var a=ss,i=fv.transition;fv.transition=null;try{ss=4,kI(e,t,r,n)}finally{ss=a,fv.transition=i}}function kI(e,t,r,n){if(y5){var a=sO(e,t,r,n);if(a===null)c3(e,t,n,b5,r),k$(e,n);else if(q0e(a,e,t,r,n))n.stopPropagation();else if(k$(e,n),t&4&&-1<U0e.indexOf(e)){for(;a!==null;){var i=Oj(a);if(i!==null&&VX(i),i=sO(e,t,r,n),i===null&&c3(e,t,n,b5,r),i===a)break;a=i}a!==null&&n.stopPropagation()}else c3(e,t,n,null,r)}}var b5=null;function sO(e,t,r,n){if(b5=null,e=jI(n),e=v0(e),e!==null)if(t=Tg(e),t===null)e=null;else if(r=t.tag,r===13){if(e=LX(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return b5=e,null}function YX(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(D0e()){case _I:return 1;case BX:return 4;case x5:case I0e:return 16;case zX:return 536870912;default:return 16}default:return 16}}var km=null,CI=null,zS=null;function XX(){if(zS)return zS;var e,t=CI,r=t.length,n,a="value"in km?km.value:km.textContent,i=a.length;for(e=0;e<r&&t[e]===a[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===a[i-n];n++);return zS=a.slice(e,1<n?1-n:void 0)}function US(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 fN(){return!0}function E$(){return!1}function lc(e){function t(r,n,a,i,o){this._reactName=r,this._targetInst=a,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?fN:E$,this.isPropagationStopped=E$,this}return ra(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=fN)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=fN)},persist:function(){},isPersistent:fN}),t}var Uy={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},EI=lc(Uy),Pj=ra({},Uy,{view:0,detail:0}),G0e=lc(Pj),e3,t3,fb,Mk=ra({},Pj,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:AI,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!==fb&&(fb&&e.type==="mousemove"?(e3=e.screenX-fb.screenX,t3=e.screenY-fb.screenY):t3=e3=0,fb=e),e3)},movementY:function(e){return"movementY"in e?e.movementY:t3}}),A$=lc(Mk),K0e=ra({},Mk,{dataTransfer:0}),Y0e=lc(K0e),X0e=ra({},Pj,{relatedTarget:0}),r3=lc(X0e),Z0e=ra({},Uy,{animationName:0,elapsedTime:0,pseudoElement:0}),J0e=lc(Z0e),Q0e=ra({},Uy,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ege=lc(Q0e),tge=ra({},Uy,{data:0}),T$=lc(tge),rge={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nge={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"},sge={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function age(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=sge[e])?!!t[e]:!1}function AI(){return age}var ige=ra({},Pj,{key:function(e){if(e.key){var t=rge[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=US(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?nge[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:AI,charCode:function(e){return e.type==="keypress"?US(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?US(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),oge=lc(ige),lge=ra({},Mk,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),P$=lc(lge),cge=ra({},Pj,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:AI}),uge=lc(cge),dge=ra({},Uy,{propertyName:0,elapsedTime:0,pseudoElement:0}),fge=lc(dge),hge=ra({},Mk,{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}),mge=lc(hge),pge=[9,13,27,32],TI=ah&&"CompositionEvent"in window,tw=null;ah&&"documentMode"in document&&(tw=document.documentMode);var gge=ah&&"TextEvent"in window&&!tw,ZX=ah&&(!TI||tw&&8<tw&&11>=tw),O$=" ",D$=!1;function JX(e,t){switch(e){case"keyup":return pge.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function QX(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vx=!1;function xge(e,t){switch(e){case"compositionend":return QX(t);case"keypress":return t.which!==32?null:(D$=!0,O$);case"textInput":return e=t.data,e===O$&&D$?null:e;default:return null}}function vge(e,t){if(Vx)return e==="compositionend"||!TI&&JX(e,t)?(e=XX(),zS=CI=km=null,Vx=!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 ZX&&t.locale!=="ko"?null:t.data;default:return null}}var yge={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 I$(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!yge[e.type]:t==="textarea"}function eZ(e,t,r,n){PX(n),t=w5(t,"onChange"),0<t.length&&(r=new EI("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var rw=null,Hw=null;function bge(e){dZ(e,0)}function $k(e){var t=Gx(e);if(NX(t))return e}function wge(e,t){if(e==="change")return t}var tZ=!1;if(ah){var n3;if(ah){var s3="oninput"in document;if(!s3){var R$=document.createElement("div");R$.setAttribute("oninput","return;"),s3=typeof R$.oninput=="function"}n3=s3}else n3=!1;tZ=n3&&(!document.documentMode||9<document.documentMode)}function L$(){rw&&(rw.detachEvent("onpropertychange",rZ),Hw=rw=null)}function rZ(e){if(e.propertyName==="value"&&$k(Hw)){var t=[];eZ(t,Hw,e,jI(e)),RX(bge,t)}}function jge(e,t,r){e==="focusin"?(L$(),rw=t,Hw=r,rw.attachEvent("onpropertychange",rZ)):e==="focusout"&&L$()}function _ge(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return $k(Hw)}function Nge(e,t){if(e==="click")return $k(t)}function Sge(e,t){if(e==="input"||e==="change")return $k(t)}function kge(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yu=typeof Object.is=="function"?Object.is:kge;function Gw(e,t){if(Yu(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var a=r[n];if(!BP.call(t,a)||!Yu(e[a],t[a]))return!1}return!0}function F$(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function M$(e,t){var r=F$(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=F$(r)}}function nZ(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?nZ(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sZ(){for(var e=window,t=m5();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=m5(e.document)}return t}function PI(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 Cge(e){var t=sZ(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&nZ(r.ownerDocument.documentElement,r)){if(n!==null&&PI(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,i=Math.min(n.start,a);n=n.end===void 0?i:Math.min(n.end,a),!e.extend&&i>n&&(a=n,n=i,i=a),a=M$(r,i);var o=M$(r,n);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>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ege=ah&&"documentMode"in document&&11>=document.documentMode,Wx=null,aO=null,nw=null,iO=!1;function $$(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;iO||Wx==null||Wx!==m5(n)||(n=Wx,"selectionStart"in n&&PI(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),nw&&Gw(nw,n)||(nw=n,n=w5(aO,"onSelect"),0<n.length&&(t=new EI("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Wx)))}function hN(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Hx={animationend:hN("Animation","AnimationEnd"),animationiteration:hN("Animation","AnimationIteration"),animationstart:hN("Animation","AnimationStart"),transitionend:hN("Transition","TransitionEnd")},a3={},aZ={};ah&&(aZ=document.createElement("div").style,"AnimationEvent"in window||(delete Hx.animationend.animation,delete Hx.animationiteration.animation,delete Hx.animationstart.animation),"TransitionEvent"in window||delete Hx.transitionend.transition);function Bk(e){if(a3[e])return a3[e];if(!Hx[e])return e;var t=Hx[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in aZ)return a3[e]=t[r];return e}var iZ=Bk("animationend"),oZ=Bk("animationiteration"),lZ=Bk("animationstart"),cZ=Bk("transitionend"),uZ=new Map,B$="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 gp(e,t){uZ.set(e,t),Ag(t,[e])}for(var i3=0;i3<B$.length;i3++){var o3=B$[i3],Age=o3.toLowerCase(),Tge=o3[0].toUpperCase()+o3.slice(1);gp(Age,"on"+Tge)}gp(iZ,"onAnimationEnd");gp(oZ,"onAnimationIteration");gp(lZ,"onAnimationStart");gp("dblclick","onDoubleClick");gp("focusin","onFocus");gp("focusout","onBlur");gp(cZ,"onTransitionEnd");Hv("onMouseEnter",["mouseout","mouseover"]);Hv("onMouseLeave",["mouseout","mouseover"]);Hv("onPointerEnter",["pointerout","pointerover"]);Hv("onPointerLeave",["pointerout","pointerover"]);Ag("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ag("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ag("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ag("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ag("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ag("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vb="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(" "),Pge=new Set("cancel close invalid load scroll toggle".split(" ").concat(Vb));function z$(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,A0e(n,t,void 0,e),e.currentTarget=null}function dZ(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],a=n.event;n=n.listeners;e:{var i=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&a.isPropagationStopped())break e;z$(a,l,u),i=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&a.isPropagationStopped())break e;z$(a,l,u),i=c}}}if(g5)throw e=tO,g5=!1,tO=null,e}function Ds(e,t){var r=t[dO];r===void 0&&(r=t[dO]=new Set);var n=e+"__bubble";r.has(n)||(fZ(t,e,2,!1),r.add(n))}function l3(e,t,r){var n=0;t&&(n|=4),fZ(r,e,n,t)}var mN="_reactListening"+Math.random().toString(36).slice(2);function Kw(e){if(!e[mN]){e[mN]=!0,yX.forEach(function(r){r!=="selectionchange"&&(Pge.has(r)||l3(r,!1,e),l3(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[mN]||(t[mN]=!0,l3("selectionchange",!1,t))}}function fZ(e,t,r,n){switch(YX(t)){case 1:var a=W0e;break;case 4:a=H0e;break;default:a=kI}r=a.bind(null,t,r,e),a=void 0,!eO||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),n?a!==void 0?e.addEventListener(t,r,{capture:!0,passive:a}):e.addEventListener(t,r,!0):a!==void 0?e.addEventListener(t,r,{passive:a}):e.addEventListener(t,r,!1)}function c3(e,t,r,n,a){var i=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===a||l.nodeType===8&&l.parentNode===a)break;if(o===4)for(o=n.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=v0(l),o===null)return;if(c=o.tag,c===5||c===6){n=i=o;continue e}l=l.parentNode}}n=n.return}RX(function(){var u=i,d=jI(r),f=[];e:{var m=uZ.get(e);if(m!==void 0){var h=EI,g=e;switch(e){case"keypress":if(US(r)===0)break e;case"keydown":case"keyup":h=oge;break;case"focusin":g="focus",h=r3;break;case"focusout":g="blur",h=r3;break;case"beforeblur":case"afterblur":h=r3;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=A$;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=Y0e;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=uge;break;case iZ:case oZ:case lZ:h=J0e;break;case cZ:h=fge;break;case"scroll":h=G0e;break;case"wheel":h=mge;break;case"copy":case"cut":case"paste":h=ege;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=P$}var p=(t&4)!==0,x=!p&&e==="scroll",v=p?m!==null?m+"Capture":null:m;p=[];for(var b=u,y;b!==null;){y=b;var N=y.stateNode;if(y.tag===5&&N!==null&&(y=N,v!==null&&(N=Uw(b,v),N!=null&&p.push(Yw(b,N,y)))),x)break;b=b.return}0<p.length&&(m=new h(m,g,null,r,d),f.push({event:m,listeners:p}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",m&&r!==JP&&(g=r.relatedTarget||r.fromElement)&&(v0(g)||g[ih]))break e;if((h||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,h?(g=r.relatedTarget||r.toElement,h=u,g=g?v0(g):null,g!==null&&(x=Tg(g),g!==x||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(p=A$,N="onMouseLeave",v="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(p=P$,N="onPointerLeave",v="onPointerEnter",b="pointer"),x=h==null?m:Gx(h),y=g==null?m:Gx(g),m=new p(N,b+"leave",h,r,d),m.target=x,m.relatedTarget=y,N=null,v0(d)===u&&(p=new p(v,b+"enter",g,r,d),p.target=y,p.relatedTarget=x,N=p),x=N,h&&g)t:{for(p=h,v=g,b=0,y=p;y;y=ux(y))b++;for(y=0,N=v;N;N=ux(N))y++;for(;0<b-y;)p=ux(p),b--;for(;0<y-b;)v=ux(v),y--;for(;b--;){if(p===v||v!==null&&p===v.alternate)break t;p=ux(p),v=ux(v)}p=null}else p=null;h!==null&&U$(f,m,h,p,!1),g!==null&&x!==null&&U$(f,x,g,p,!0)}}e:{if(m=u?Gx(u):window,h=m.nodeName&&m.nodeName.toLowerCase(),h==="select"||h==="input"&&m.type==="file")var _=wge;else if(I$(m))if(tZ)_=Sge;else{_=_ge;var j=jge}else(h=m.nodeName)&&h.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(_=Nge);if(_&&(_=_(e,u))){eZ(f,_,r,d);break e}j&&j(e,m,u),e==="focusout"&&(j=m._wrapperState)&&j.controlled&&m.type==="number"&&GP(m,"number",m.value)}switch(j=u?Gx(u):window,e){case"focusin":(I$(j)||j.contentEditable==="true")&&(Wx=j,aO=u,nw=null);break;case"focusout":nw=aO=Wx=null;break;case"mousedown":iO=!0;break;case"contextmenu":case"mouseup":case"dragend":iO=!1,$$(f,r,d);break;case"selectionchange":if(Ege)break;case"keydown":case"keyup":$$(f,r,d)}var S;if(TI)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else Vx?JX(e,r)&&(I="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(I="onCompositionStart");I&&(ZX&&r.locale!=="ko"&&(Vx||I!=="onCompositionStart"?I==="onCompositionEnd"&&Vx&&(S=XX()):(km=d,CI="value"in km?km.value:km.textContent,Vx=!0)),j=w5(u,I),0<j.length&&(I=new T$(I,e,null,r,d),f.push({event:I,listeners:j}),S?I.data=S:(S=QX(r),S!==null&&(I.data=S)))),(S=gge?xge(e,r):vge(e,r))&&(u=w5(u,"onBeforeInput"),0<u.length&&(d=new T$("onBeforeInput","beforeinput",null,r,d),f.push({event:d,listeners:u}),d.data=S))}dZ(f,t)})}function Yw(e,t,r){return{instance:e,listener:t,currentTarget:r}}function w5(e,t){for(var r=t+"Capture",n=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Uw(e,r),i!=null&&n.unshift(Yw(e,i,a)),i=Uw(e,t),i!=null&&n.push(Yw(e,i,a))),e=e.return}return n}function ux(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function U$(e,t,r,n,a){for(var i=t._reactName,o=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,a?(c=Uw(r,i),c!=null&&o.unshift(Yw(r,c,l))):a||(c=Uw(r,i),c!=null&&o.push(Yw(r,c,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var Oge=/\r\n?/g,Dge=/\u0000|\uFFFD/g;function q$(e){return(typeof e=="string"?e:""+e).replace(Oge,`
`).replace(Dge,"")}function pN(e,t,r){if(t=q$(t),q$(e)!==t&&r)throw Error(Et(425))}function j5(){}var oO=null,lO=null;function cO(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 uO=typeof setTimeout=="function"?setTimeout:void 0,Ige=typeof clearTimeout=="function"?clearTimeout:void 0,V$=typeof Promise=="function"?Promise:void 0,Rge=typeof queueMicrotask=="function"?queueMicrotask:typeof V$<"u"?function(e){return V$.resolve(null).then(e).catch(Lge)}:uO;function Lge(e){setTimeout(function(){throw e})}function u3(e,t){var r=t,n=0;do{var a=r.nextSibling;if(e.removeChild(r),a&&a.nodeType===8)if(r=a.data,r==="/$"){if(n===0){e.removeChild(a),Ww(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=a}while(r);Ww(t)}function $m(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 W$(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var qy=Math.random().toString(36).slice(2),Td="__reactFiber$"+qy,Xw="__reactProps$"+qy,ih="__reactContainer$"+qy,dO="__reactEvents$"+qy,Fge="__reactListeners$"+qy,Mge="__reactHandles$"+qy;function v0(e){var t=e[Td];if(t)return t;for(var r=e.parentNode;r;){if(t=r[ih]||r[Td]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=W$(e);e!==null;){if(r=e[Td])return r;e=W$(e)}return t}e=r,r=e.parentNode}return null}function Oj(e){return e=e[Td]||e[ih],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Gx(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Et(33))}function zk(e){return e[Xw]||null}var fO=[],Kx=-1;function xp(e){return{current:e}}function $s(e){0>Kx||(e.current=fO[Kx],fO[Kx]=null,Kx--)}function Ss(e,t){Kx++,fO[Kx]=e.current,e.current=t}var Zm={},vo=xp(Zm),dl=xp(!1),J0=Zm;function Gv(e,t){var r=e.type.contextTypes;if(!r)return Zm;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in r)a[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function fl(e){return e=e.childContextTypes,e!=null}function _5(){$s(dl),$s(vo)}function H$(e,t,r){if(vo.current!==Zm)throw Error(Et(168));Ss(vo,t),Ss(dl,r)}function hZ(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var a in n)if(!(a in t))throw Error(Et(108,j0e(e)||"Unknown",a));return ra({},r,n)}function N5(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Zm,J0=vo.current,Ss(vo,e),Ss(dl,dl.current),!0}function G$(e,t,r){var n=e.stateNode;if(!n)throw Error(Et(169));r?(e=hZ(e,t,J0),n.__reactInternalMemoizedMergedChildContext=e,$s(dl),$s(vo),Ss(vo,e)):$s(dl),Ss(dl,r)}var Mf=null,Uk=!1,d3=!1;function mZ(e){Mf===null?Mf=[e]:Mf.push(e)}function $ge(e){Uk=!0,mZ(e)}function vp(){if(!d3&&Mf!==null){d3=!0;var e=0,t=ss;try{var r=Mf;for(ss=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}Mf=null,Uk=!1}catch(a){throw Mf!==null&&(Mf=Mf.slice(e+1)),$X(_I,vp),a}finally{ss=t,d3=!1}}return null}var Yx=[],Xx=0,S5=null,k5=0,Pc=[],Oc=0,Q0=null,Uf=1,qf="";function n0(e,t){Yx[Xx++]=k5,Yx[Xx++]=S5,S5=e,k5=t}function pZ(e,t,r){Pc[Oc++]=Uf,Pc[Oc++]=qf,Pc[Oc++]=Q0,Q0=e;var n=Uf;e=qf;var a=32-Uu(n)-1;n&=~(1<<a),r+=1;var i=32-Uu(t)+a;if(30<i){var o=a-a%5;i=(n&(1<<o)-1).toString(32),n>>=o,a-=o,Uf=1<<32-Uu(t)+a|r<<a|n,qf=i+e}else Uf=1<<i|r<<a|n,qf=e}function OI(e){e.return!==null&&(n0(e,1),pZ(e,1,0))}function DI(e){for(;e===S5;)S5=Yx[--Xx],Yx[Xx]=null,k5=Yx[--Xx],Yx[Xx]=null;for(;e===Q0;)Q0=Pc[--Oc],Pc[Oc]=null,qf=Pc[--Oc],Pc[Oc]=null,Uf=Pc[--Oc],Pc[Oc]=null}var Xl=null,Gl=null,Ws=!1,Ru=null;function gZ(e,t){var r=Mc(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function K$(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Xl=e,Gl=$m(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Xl=e,Gl=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Q0!==null?{id:Uf,overflow:qf}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=Mc(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Xl=e,Gl=null,!0):!1;default:return!1}}function hO(e){return(e.mode&1)!==0&&(e.flags&128)===0}function mO(e){if(Ws){var t=Gl;if(t){var r=t;if(!K$(e,t)){if(hO(e))throw Error(Et(418));t=$m(r.nextSibling);var n=Xl;t&&K$(e,t)?gZ(n,r):(e.flags=e.flags&-4097|2,Ws=!1,Xl=e)}}else{if(hO(e))throw Error(Et(418));e.flags=e.flags&-4097|2,Ws=!1,Xl=e}}}function Y$(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Xl=e}function gN(e){if(e!==Xl)return!1;if(!Ws)return Y$(e),Ws=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!cO(e.type,e.memoizedProps)),t&&(t=Gl)){if(hO(e))throw xZ(),Error(Et(418));for(;t;)gZ(e,t),t=$m(t.nextSibling)}if(Y$(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Et(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Gl=$m(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Gl=null}}else Gl=Xl?$m(e.stateNode.nextSibling):null;return!0}function xZ(){for(var e=Gl;e;)e=$m(e.nextSibling)}function Kv(){Gl=Xl=null,Ws=!1}function II(e){Ru===null?Ru=[e]:Ru.push(e)}var Bge=yh.ReactCurrentBatchConfig;function hb(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(Et(309));var n=r.stateNode}if(!n)throw Error(Et(147,e));var a=n,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(Et(284));if(!r._owner)throw Error(Et(290,e))}return e}function xN(e,t){throw e=Object.prototype.toString.call(t),Error(Et(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function X$(e){var t=e._init;return t(e._payload)}function vZ(e){function t(v,b){if(e){var y=v.deletions;y===null?(v.deletions=[b],v.flags|=16):y.push(b)}}function r(v,b){if(!e)return null;for(;b!==null;)t(v,b),b=b.sibling;return null}function n(v,b){for(v=new Map;b!==null;)b.key!==null?v.set(b.key,b):v.set(b.index,b),b=b.sibling;return v}function a(v,b){return v=qm(v,b),v.index=0,v.sibling=null,v}function i(v,b,y){return v.index=y,e?(y=v.alternate,y!==null?(y=y.index,y<b?(v.flags|=2,b):y):(v.flags|=2,b)):(v.flags|=1048576,b)}function o(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,b,y,N){return b===null||b.tag!==6?(b=v3(y,v.mode,N),b.return=v,b):(b=a(b,y),b.return=v,b)}function c(v,b,y,N){var _=y.type;return _===qx?d(v,b,y.props.children,N,y.key):b!==null&&(b.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===sm&&X$(_)===b.type)?(N=a(b,y.props),N.ref=hb(v,b,y),N.return=v,N):(N=YS(y.type,y.key,y.props,null,v.mode,N),N.ref=hb(v,b,y),N.return=v,N)}function u(v,b,y,N){return b===null||b.tag!==4||b.stateNode.containerInfo!==y.containerInfo||b.stateNode.implementation!==y.implementation?(b=y3(y,v.mode,N),b.return=v,b):(b=a(b,y.children||[]),b.return=v,b)}function d(v,b,y,N,_){return b===null||b.tag!==7?(b=F0(y,v.mode,N,_),b.return=v,b):(b=a(b,y),b.return=v,b)}function f(v,b,y){if(typeof b=="string"&&b!==""||typeof b=="number")return b=v3(""+b,v.mode,y),b.return=v,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case iN:return y=YS(b.type,b.key,b.props,null,v.mode,y),y.ref=hb(v,null,b),y.return=v,y;case Ux:return b=y3(b,v.mode,y),b.return=v,b;case sm:var N=b._init;return f(v,N(b._payload),y)}if(Ub(b)||lb(b))return b=F0(b,v.mode,y,null),b.return=v,b;xN(v,b)}return null}function m(v,b,y,N){var _=b!==null?b.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return _!==null?null:l(v,b,""+y,N);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case iN:return y.key===_?c(v,b,y,N):null;case Ux:return y.key===_?u(v,b,y,N):null;case sm:return _=y._init,m(v,b,_(y._payload),N)}if(Ub(y)||lb(y))return _!==null?null:d(v,b,y,N,null);xN(v,y)}return null}function h(v,b,y,N,_){if(typeof N=="string"&&N!==""||typeof N=="number")return v=v.get(y)||null,l(b,v,""+N,_);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case iN:return v=v.get(N.key===null?y:N.key)||null,c(b,v,N,_);case Ux:return v=v.get(N.key===null?y:N.key)||null,u(b,v,N,_);case sm:var j=N._init;return h(v,b,y,j(N._payload),_)}if(Ub(N)||lb(N))return v=v.get(y)||null,d(b,v,N,_,null);xN(b,N)}return null}function g(v,b,y,N){for(var _=null,j=null,S=b,I=b=0,P=null;S!==null&&I<y.length;I++){S.index>I?(P=S,S=null):P=S.sibling;var F=m(v,S,y[I],N);if(F===null){S===null&&(S=P);break}e&&S&&F.alternate===null&&t(v,S),b=i(F,b,I),j===null?_=F:j.sibling=F,j=F,S=P}if(I===y.length)return r(v,S),Ws&&n0(v,I),_;if(S===null){for(;I<y.length;I++)S=f(v,y[I],N),S!==null&&(b=i(S,b,I),j===null?_=S:j.sibling=S,j=S);return Ws&&n0(v,I),_}for(S=n(v,S);I<y.length;I++)P=h(S,v,I,y[I],N),P!==null&&(e&&P.alternate!==null&&S.delete(P.key===null?I:P.key),b=i(P,b,I),j===null?_=P:j.sibling=P,j=P);return e&&S.forEach(function(T){return t(v,T)}),Ws&&n0(v,I),_}function p(v,b,y,N){var _=lb(y);if(typeof _!="function")throw Error(Et(150));if(y=_.call(y),y==null)throw Error(Et(151));for(var j=_=null,S=b,I=b=0,P=null,F=y.next();S!==null&&!F.done;I++,F=y.next()){S.index>I?(P=S,S=null):P=S.sibling;var T=m(v,S,F.value,N);if(T===null){S===null&&(S=P);break}e&&S&&T.alternate===null&&t(v,S),b=i(T,b,I),j===null?_=T:j.sibling=T,j=T,S=P}if(F.done)return r(v,S),Ws&&n0(v,I),_;if(S===null){for(;!F.done;I++,F=y.next())F=f(v,F.value,N),F!==null&&(b=i(F,b,I),j===null?_=F:j.sibling=F,j=F);return Ws&&n0(v,I),_}for(S=n(v,S);!F.done;I++,F=y.next())F=h(S,v,I,F.value,N),F!==null&&(e&&F.alternate!==null&&S.delete(F.key===null?I:F.key),b=i(F,b,I),j===null?_=F:j.sibling=F,j=F);return e&&S.forEach(function(k){return t(v,k)}),Ws&&n0(v,I),_}function x(v,b,y,N){if(typeof y=="object"&&y!==null&&y.type===qx&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case iN:e:{for(var _=y.key,j=b;j!==null;){if(j.key===_){if(_=y.type,_===qx){if(j.tag===7){r(v,j.sibling),b=a(j,y.props.children),b.return=v,v=b;break e}}else if(j.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===sm&&X$(_)===j.type){r(v,j.sibling),b=a(j,y.props),b.ref=hb(v,j,y),b.return=v,v=b;break e}r(v,j);break}else t(v,j);j=j.sibling}y.type===qx?(b=F0(y.props.children,v.mode,N,y.key),b.return=v,v=b):(N=YS(y.type,y.key,y.props,null,v.mode,N),N.ref=hb(v,b,y),N.return=v,v=N)}return o(v);case Ux:e:{for(j=y.key;b!==null;){if(b.key===j)if(b.tag===4&&b.stateNode.containerInfo===y.containerInfo&&b.stateNode.implementation===y.implementation){r(v,b.sibling),b=a(b,y.children||[]),b.return=v,v=b;break e}else{r(v,b);break}else t(v,b);b=b.sibling}b=y3(y,v.mode,N),b.return=v,v=b}return o(v);case sm:return j=y._init,x(v,b,j(y._payload),N)}if(Ub(y))return g(v,b,y,N);if(lb(y))return p(v,b,y,N);xN(v,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,b!==null&&b.tag===6?(r(v,b.sibling),b=a(b,y),b.return=v,v=b):(r(v,b),b=v3(y,v.mode,N),b.return=v,v=b),o(v)):r(v,b)}return x}var Yv=vZ(!0),yZ=vZ(!1),C5=xp(null),E5=null,Zx=null,RI=null;function LI(){RI=Zx=E5=null}function FI(e){var t=C5.current;$s(C5),e._currentValue=t}function pO(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function hv(e,t){E5=e,RI=Zx=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(cl=!0),e.firstContext=null)}function Qc(e){var t=e._currentValue;if(RI!==e)if(e={context:e,memoizedValue:t,next:null},Zx===null){if(E5===null)throw Error(Et(308));Zx=e,E5.dependencies={lanes:0,firstContext:e}}else Zx=Zx.next=e;return t}var y0=null;function MI(e){y0===null?y0=[e]:y0.push(e)}function bZ(e,t,r,n){var a=t.interleaved;return a===null?(r.next=r,MI(t)):(r.next=a.next,a.next=r),t.interleaved=r,oh(e,n)}function oh(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var am=!1;function $I(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function wZ(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 Xf(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Bm(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,On&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,oh(e,r)}return a=n.interleaved,a===null?(t.next=t,MI(n)):(t.next=a.next,a.next=t),n.interleaved=t,oh(e,r)}function qS(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,NI(e,r)}}function Z$(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var a=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?a=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?a=i=t:i=i.next=t}else a=i=t;r={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function A5(e,t,r,n){var a=e.updateQueue;am=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=a.baseState;o=0,d=u=c=null,l=i;do{var m=l.lane,h=l.eventTime;if((n&m)===m){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,p=l;switch(m=t,h=r,p.tag){case 1:if(g=p.payload,typeof g=="function"){f=g.call(h,f,m);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=p.payload,m=typeof g=="function"?g.call(h,f,m):g,m==null)break e;f=ra({},f,m);break e;case 2:am=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=a.effects,m===null?a.effects=[l]:m.push(l))}else h={eventTime:h,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,o|=m;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;m=l,l=m.next,m.next=null,a.lastBaseUpdate=m,a.shared.pending=null}}while(!0);if(d===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=d,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);tg|=o,e.lanes=o,e.memoizedState=f}}function J$(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],a=n.callback;if(a!==null){if(n.callback=null,n=r,typeof a!="function")throw Error(Et(191,a));a.call(n)}}}var Dj={},zd=xp(Dj),Zw=xp(Dj),Jw=xp(Dj);function b0(e){if(e===Dj)throw Error(Et(174));return e}function BI(e,t){switch(Ss(Jw,t),Ss(Zw,e),Ss(zd,Dj),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:YP(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=YP(t,e)}$s(zd),Ss(zd,t)}function Xv(){$s(zd),$s(Zw),$s(Jw)}function jZ(e){b0(Jw.current);var t=b0(zd.current),r=YP(t,e.type);t!==r&&(Ss(Zw,e),Ss(zd,r))}function zI(e){Zw.current===e&&($s(zd),$s(Zw))}var Js=xp(0);function T5(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.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 f3=[];function UI(){for(var e=0;e<f3.length;e++)f3[e]._workInProgressVersionPrimary=null;f3.length=0}var VS=yh.ReactCurrentDispatcher,h3=yh.ReactCurrentBatchConfig,eg=0,ea=null,ci=null,Si=null,P5=!1,sw=!1,Qw=0,zge=0;function Qi(){throw Error(Et(321))}function qI(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Yu(e[r],t[r]))return!1;return!0}function VI(e,t,r,n,a,i){if(eg=i,ea=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,VS.current=e===null||e.memoizedState===null?Wge:Hge,e=r(n,a),sw){i=0;do{if(sw=!1,Qw=0,25<=i)throw Error(Et(301));i+=1,Si=ci=null,t.updateQueue=null,VS.current=Gge,e=r(n,a)}while(sw)}if(VS.current=O5,t=ci!==null&&ci.next!==null,eg=0,Si=ci=ea=null,P5=!1,t)throw Error(Et(300));return e}function WI(){var e=Qw!==0;return Qw=0,e}function Nd(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Si===null?ea.memoizedState=Si=e:Si=Si.next=e,Si}function eu(){if(ci===null){var e=ea.alternate;e=e!==null?e.memoizedState:null}else e=ci.next;var t=Si===null?ea.memoizedState:Si.next;if(t!==null)Si=t,ci=e;else{if(e===null)throw Error(Et(310));ci=e,e={memoizedState:ci.memoizedState,baseState:ci.baseState,baseQueue:ci.baseQueue,queue:ci.queue,next:null},Si===null?ea.memoizedState=Si=e:Si=Si.next=e}return Si}function e2(e,t){return typeof t=="function"?t(e):t}function m3(e){var t=eu(),r=t.queue;if(r===null)throw Error(Et(311));r.lastRenderedReducer=e;var n=ci,a=n.baseQueue,i=r.pending;if(i!==null){if(a!==null){var o=a.next;a.next=i.next,i.next=o}n.baseQueue=a=i,r.pending=null}if(a!==null){i=a.next,n=n.baseState;var l=o=null,c=null,u=i;do{var d=u.lane;if((eg&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,o=n):c=c.next=f,ea.lanes|=d,tg|=d}u=u.next}while(u!==null&&u!==i);c===null?o=n:c.next=l,Yu(n,t.memoizedState)||(cl=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){a=e;do i=a.lane,ea.lanes|=i,tg|=i,a=a.next;while(a!==e)}else a===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function p3(e){var t=eu(),r=t.queue;if(r===null)throw Error(Et(311));r.lastRenderedReducer=e;var n=r.dispatch,a=r.pending,i=t.memoizedState;if(a!==null){r.pending=null;var o=a=a.next;do i=e(i,o.action),o=o.next;while(o!==a);Yu(i,t.memoizedState)||(cl=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,n]}function _Z(){}function NZ(e,t){var r=ea,n=eu(),a=t(),i=!Yu(n.memoizedState,a);if(i&&(n.memoizedState=a,cl=!0),n=n.queue,HI(CZ.bind(null,r,n,e),[e]),n.getSnapshot!==t||i||Si!==null&&Si.memoizedState.tag&1){if(r.flags|=2048,t2(9,kZ.bind(null,r,n,a,t),void 0,null),Oi===null)throw Error(Et(349));eg&30||SZ(r,t,a)}return a}function SZ(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=ea.updateQueue,t===null?(t={lastEffect:null,stores:null},ea.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function kZ(e,t,r,n){t.value=r,t.getSnapshot=n,EZ(t)&&AZ(e)}function CZ(e,t,r){return r(function(){EZ(t)&&AZ(e)})}function EZ(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Yu(e,r)}catch{return!0}}function AZ(e){var t=oh(e,1);t!==null&&qu(t,e,1,-1)}function Q$(e){var t=Nd();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e2,lastRenderedState:e},t.queue=e,e=e.dispatch=Vge.bind(null,ea,e),[t.memoizedState,e]}function t2(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=ea.updateQueue,t===null?(t={lastEffect:null,stores:null},ea.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function TZ(){return eu().memoizedState}function WS(e,t,r,n){var a=Nd();ea.flags|=e,a.memoizedState=t2(1|t,r,void 0,n===void 0?null:n)}function qk(e,t,r,n){var a=eu();n=n===void 0?null:n;var i=void 0;if(ci!==null){var o=ci.memoizedState;if(i=o.destroy,n!==null&&qI(n,o.deps)){a.memoizedState=t2(t,r,i,n);return}}ea.flags|=e,a.memoizedState=t2(1|t,r,i,n)}function eB(e,t){return WS(8390656,8,e,t)}function HI(e,t){return qk(2048,8,e,t)}function PZ(e,t){return qk(4,2,e,t)}function OZ(e,t){return qk(4,4,e,t)}function DZ(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 IZ(e,t,r){return r=r!=null?r.concat([e]):null,qk(4,4,DZ.bind(null,t,e),r)}function GI(){}function RZ(e,t){var r=eu();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&qI(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function LZ(e,t){var r=eu();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&qI(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function FZ(e,t,r){return eg&21?(Yu(r,t)||(r=UX(),ea.lanes|=r,tg|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,cl=!0),e.memoizedState=r)}function Uge(e,t){var r=ss;ss=r!==0&&4>r?r:4,e(!0);var n=h3.transition;h3.transition={};try{e(!1),t()}finally{ss=r,h3.transition=n}}function MZ(){return eu().memoizedState}function qge(e,t,r){var n=Um(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},$Z(e))BZ(t,r);else if(r=bZ(e,t,r,n),r!==null){var a=Bo();qu(r,e,n,a),zZ(r,t,n)}}function Vge(e,t,r){var n=Um(e),a={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if($Z(e))BZ(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,r);if(a.hasEagerState=!0,a.eagerState=l,Yu(l,o)){var c=t.interleaved;c===null?(a.next=a,MI(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}r=bZ(e,t,a,n),r!==null&&(a=Bo(),qu(r,e,n,a),zZ(r,t,n))}}function $Z(e){var t=e.alternate;return e===ea||t!==null&&t===ea}function BZ(e,t){sw=P5=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function zZ(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,NI(e,r)}}var O5={readContext:Qc,useCallback:Qi,useContext:Qi,useEffect:Qi,useImperativeHandle:Qi,useInsertionEffect:Qi,useLayoutEffect:Qi,useMemo:Qi,useReducer:Qi,useRef:Qi,useState:Qi,useDebugValue:Qi,useDeferredValue:Qi,useTransition:Qi,useMutableSource:Qi,useSyncExternalStore:Qi,useId:Qi,unstable_isNewReconciler:!1},Wge={readContext:Qc,useCallback:function(e,t){return Nd().memoizedState=[e,t===void 0?null:t],e},useContext:Qc,useEffect:eB,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,WS(4194308,4,DZ.bind(null,t,e),r)},useLayoutEffect:function(e,t){return WS(4194308,4,e,t)},useInsertionEffect:function(e,t){return WS(4,2,e,t)},useMemo:function(e,t){var r=Nd();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Nd();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=qge.bind(null,ea,e),[n.memoizedState,e]},useRef:function(e){var t=Nd();return e={current:e},t.memoizedState=e},useState:Q$,useDebugValue:GI,useDeferredValue:function(e){return Nd().memoizedState=e},useTransition:function(){var e=Q$(!1),t=e[0];return e=Uge.bind(null,e[1]),Nd().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ea,a=Nd();if(Ws){if(r===void 0)throw Error(Et(407));r=r()}else{if(r=t(),Oi===null)throw Error(Et(349));eg&30||SZ(n,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,eB(CZ.bind(null,n,i,e),[e]),n.flags|=2048,t2(9,kZ.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=Nd(),t=Oi.identifierPrefix;if(Ws){var r=qf,n=Uf;r=(n&~(1<<32-Uu(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Qw++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=zge++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Hge={readContext:Qc,useCallback:RZ,useContext:Qc,useEffect:HI,useImperativeHandle:IZ,useInsertionEffect:PZ,useLayoutEffect:OZ,useMemo:LZ,useReducer:m3,useRef:TZ,useState:function(){return m3(e2)},useDebugValue:GI,useDeferredValue:function(e){var t=eu();return FZ(t,ci.memoizedState,e)},useTransition:function(){var e=m3(e2)[0],t=eu().memoizedState;return[e,t]},useMutableSource:_Z,useSyncExternalStore:NZ,useId:MZ,unstable_isNewReconciler:!1},Gge={readContext:Qc,useCallback:RZ,useContext:Qc,useEffect:HI,useImperativeHandle:IZ,useInsertionEffect:PZ,useLayoutEffect:OZ,useMemo:LZ,useReducer:p3,useRef:TZ,useState:function(){return p3(e2)},useDebugValue:GI,useDeferredValue:function(e){var t=eu();return ci===null?t.memoizedState=e:FZ(t,ci.memoizedState,e)},useTransition:function(){var e=p3(e2)[0],t=eu().memoizedState;return[e,t]},useMutableSource:_Z,useSyncExternalStore:NZ,useId:MZ,unstable_isNewReconciler:!1};function Eu(e,t){if(e&&e.defaultProps){t=ra({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function gO(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:ra({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Vk={isMounted:function(e){return(e=e._reactInternals)?Tg(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Bo(),a=Um(e),i=Xf(n,a);i.payload=t,r!=null&&(i.callback=r),t=Bm(e,i,a),t!==null&&(qu(t,e,a,n),qS(t,e,a))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Bo(),a=Um(e),i=Xf(n,a);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=Bm(e,i,a),t!==null&&(qu(t,e,a,n),qS(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Bo(),n=Um(e),a=Xf(r,n);a.tag=2,t!=null&&(a.callback=t),t=Bm(e,a,n),t!==null&&(qu(t,e,n,r),qS(t,e,n))}};function tB(e,t,r,n,a,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,i,o):t.prototype&&t.prototype.isPureReactComponent?!Gw(r,n)||!Gw(a,i):!0}function UZ(e,t,r){var n=!1,a=Zm,i=t.contextType;return typeof i=="object"&&i!==null?i=Qc(i):(a=fl(t)?J0:vo.current,n=t.contextTypes,i=(n=n!=null)?Gv(e,a):Zm),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Vk,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function rB(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&Vk.enqueueReplaceState(t,t.state,null)}function xO(e,t,r,n){var a=e.stateNode;a.props=r,a.state=e.memoizedState,a.refs={},$I(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=Qc(i):(i=fl(t)?J0:vo.current,a.context=Gv(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(gO(e,t,i,r),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&&Vk.enqueueReplaceState(a,a.state,null),A5(e,r,a,n),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Zv(e,t){try{var r="",n=t;do r+=w0e(n),n=n.return;while(n);var a=r}catch(i){a=`
Error generating stack: `+i.message+`
`+i.stack}return{value:e,source:t,stack:a,digest:null}}function g3(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function vO(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Kge=typeof WeakMap=="function"?WeakMap:Map;function qZ(e,t,r){r=Xf(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){I5||(I5=!0,EO=n),vO(e,t)},r}function VZ(e,t,r){r=Xf(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var a=t.value;r.payload=function(){return n(a)},r.callback=function(){vO(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){vO(e,t),typeof n!="function"&&(zm===null?zm=new Set([this]):zm.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function nB(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Kge;var a=new Set;n.set(t,a)}else a=n.get(t),a===void 0&&(a=new Set,n.set(t,a));a.has(r)||(a.add(r),e=lxe.bind(null,e,t,r),t.then(e,e))}function sB(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 aB(e,t,r,n,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Xf(-1,1),t.tag=2,Bm(r,t,1))),r.lanes|=1),e)}var Yge=yh.ReactCurrentOwner,cl=!1;function To(e,t,r,n){t.child=e===null?yZ(t,null,r,n):Yv(t,e.child,r,n)}function iB(e,t,r,n,a){r=r.render;var i=t.ref;return hv(t,a),n=VI(e,t,r,n,i,a),r=WI(),e!==null&&!cl?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,lh(e,t,a)):(Ws&&r&&OI(t),t.flags|=1,To(e,t,n,a),t.child)}function oB(e,t,r,n,a){if(e===null){var i=r.type;return typeof i=="function"&&!tR(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,WZ(e,t,i,n,a)):(e=YS(r.type,null,n,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(r=r.compare,r=r!==null?r:Gw,r(o,n)&&e.ref===t.ref)return lh(e,t,a)}return t.flags|=1,e=qm(i,n),e.ref=t.ref,e.return=t,t.child=e}function WZ(e,t,r,n,a){if(e!==null){var i=e.memoizedProps;if(Gw(i,n)&&e.ref===t.ref)if(cl=!1,t.pendingProps=n=i,(e.lanes&a)!==0)e.flags&131072&&(cl=!0);else return t.lanes=e.lanes,lh(e,t,a)}return yO(e,t,r,n,a)}function HZ(e,t,r){var n=t.pendingProps,a=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ss(Qx,Ll),Ll|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ss(Qx,Ll),Ll|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,Ss(Qx,Ll),Ll|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,Ss(Qx,Ll),Ll|=n;return To(e,t,a,r),t.child}function GZ(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function yO(e,t,r,n,a){var i=fl(r)?J0:vo.current;return i=Gv(t,i),hv(t,a),r=VI(e,t,r,n,i,a),n=WI(),e!==null&&!cl?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,lh(e,t,a)):(Ws&&n&&OI(t),t.flags|=1,To(e,t,r,a),t.child)}function lB(e,t,r,n,a){if(fl(r)){var i=!0;N5(t)}else i=!1;if(hv(t,a),t.stateNode===null)HS(e,t),UZ(t,r,n),xO(t,r,n,a),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=Qc(u):(u=fl(r)?J0:vo.current,u=Gv(t,u));var d=r.getDerivedStateFromProps,f=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";f||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&rB(t,o,n,u),am=!1;var m=t.memoizedState;o.state=m,A5(t,n,o,a),c=t.memoizedState,l!==n||m!==c||dl.current||am?(typeof d=="function"&&(gO(t,r,d,n),c=t.memoizedState),(l=am||tB(t,r,l,n,m,c,u))?(f||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=n,t.memoizedState=c),o.props=n,o.state=c,o.context=u,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,wZ(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Eu(t.type,l),o.props=u,f=t.pendingProps,m=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=Qc(c):(c=fl(r)?J0:vo.current,c=Gv(t,c));var h=r.getDerivedStateFromProps;(d=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==f||m!==c)&&rB(t,o,n,c),am=!1,m=t.memoizedState,o.state=m,A5(t,n,o,a);var g=t.memoizedState;l!==f||m!==g||dl.current||am?(typeof h=="function"&&(gO(t,r,h,n),g=t.memoizedState),(u=am||tB(t,r,u,n,m,g,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,g,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,g,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=g),o.props=n,o.state=g,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),n=!1)}return bO(e,t,r,n,i,a)}function bO(e,t,r,n,a,i){GZ(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return a&&G$(t,r,!1),lh(e,t,i);n=t.stateNode,Yge.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=Yv(t,e.child,null,i),t.child=Yv(t,null,l,i)):To(e,t,l,i),t.memoizedState=n.state,a&&G$(t,r,!0),t.child}function KZ(e){var t=e.stateNode;t.pendingContext?H$(e,t.pendingContext,t.pendingContext!==t.context):t.context&&H$(e,t.context,!1),BI(e,t.containerInfo)}function cB(e,t,r,n,a){return Kv(),II(a),t.flags|=256,To(e,t,r,n),t.child}var wO={dehydrated:null,treeContext:null,retryLane:0};function jO(e){return{baseLanes:e,cachePool:null,transitions:null}}function YZ(e,t,r){var n=t.pendingProps,a=Js.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),Ss(Js,a&1),e===null)return mO(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=n.children,e=n.fallback,i?(n=t.mode,i=t.child,o={mode:"hidden",children:o},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Gk(o,n,0,null),e=F0(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=jO(r),t.memoizedState=wO,e):KI(t,o));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return Xge(e,t,o,n,l,a,r);if(i){i=n.fallback,o=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&t.child!==a?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=qm(a,c),n.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=qm(l,i):(i=F0(i,o,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,o=e.child.memoizedState,o=o===null?jO(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~r,t.memoizedState=wO,n}return i=e.child,e=i.sibling,n=qm(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function KI(e,t){return t=Gk({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function vN(e,t,r,n){return n!==null&&II(n),Yv(t,e.child,null,r),e=KI(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Xge(e,t,r,n,a,i,o){if(r)return t.flags&256?(t.flags&=-257,n=g3(Error(Et(422))),vN(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,a=t.mode,n=Gk({mode:"visible",children:n.children},a,0,null),i=F0(i,a,o,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&Yv(t,e.child,null,o),t.child.memoizedState=jO(o),t.memoizedState=wO,i);if(!(t.mode&1))return vN(e,t,o,null);if(a.data==="$!"){if(n=a.nextSibling&&a.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error(Et(419)),n=g3(i,n,void 0),vN(e,t,o,n)}if(l=(o&e.childLanes)!==0,cl||l){if(n=Oi,n!==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&(n.suspendedLanes|o)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,oh(e,a),qu(n,e,a,-1))}return eR(),n=g3(Error(Et(421))),vN(e,t,o,n)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=cxe.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,Gl=$m(a.nextSibling),Xl=t,Ws=!0,Ru=null,e!==null&&(Pc[Oc++]=Uf,Pc[Oc++]=qf,Pc[Oc++]=Q0,Uf=e.id,qf=e.overflow,Q0=t),t=KI(t,n.children),t.flags|=4096,t)}function uB(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),pO(e.return,t,r)}function x3(e,t,r,n,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=a)}function XZ(e,t,r){var n=t.pendingProps,a=n.revealOrder,i=n.tail;if(To(e,t,n.children,r),n=Js.current,n&2)n=n&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&&uB(e,r,t);else if(e.tag===19)uB(e,r,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}n&=1}if(Ss(Js,n),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(r=t.child,a=null;r!==null;)e=r.alternate,e!==null&&T5(e)===null&&(a=r),r=r.sibling;r=a,r===null?(a=t.child,t.child=null):(a=r.sibling,r.sibling=null),x3(t,!1,a,r,i);break;case"backwards":for(r=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&T5(e)===null){t.child=a;break}e=a.sibling,a.sibling=r,r=a,a=e}x3(t,!0,r,null,i);break;case"together":x3(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function HS(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function lh(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),tg|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Et(153));if(t.child!==null){for(e=t.child,r=qm(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=qm(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Zge(e,t,r){switch(t.tag){case 3:KZ(t),Kv();break;case 5:jZ(t);break;case 1:fl(t.type)&&N5(t);break;case 4:BI(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,a=t.memoizedProps.value;Ss(C5,n._currentValue),n._currentValue=a;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Ss(Js,Js.current&1),t.flags|=128,null):r&t.child.childLanes?YZ(e,t,r):(Ss(Js,Js.current&1),e=lh(e,t,r),e!==null?e.sibling:null);Ss(Js,Js.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return XZ(e,t,r);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Ss(Js,Js.current),n)break;return null;case 22:case 23:return t.lanes=0,HZ(e,t,r)}return lh(e,t,r)}var ZZ,_O,JZ,QZ;ZZ=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};_O=function(){};JZ=function(e,t,r,n){var a=e.memoizedProps;if(a!==n){e=t.stateNode,b0(zd.current);var i=null;switch(r){case"input":a=WP(e,a),n=WP(e,n),i=[];break;case"select":a=ra({},a,{value:void 0}),n=ra({},n,{value:void 0}),i=[];break;case"textarea":a=KP(e,a),n=KP(e,n),i=[];break;default:typeof a.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=j5)}XP(r,n);var o;r=null;for(u in a)if(!n.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var l=a[u];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Bw.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(l=a!=null?a[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(i||(i=[]),i.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Bw.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Ds("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}r&&(i=i||[]).push("style",r);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};QZ=function(e,t,r,n){r!==n&&(t.flags|=4)};function mb(e,t){if(!Ws)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function eo(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var a=e.child;a!==null;)r|=a.lanes|a.childLanes,n|=a.subtreeFlags&14680064,n|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)r|=a.lanes|a.childLanes,n|=a.subtreeFlags,n|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Jge(e,t,r){var n=t.pendingProps;switch(DI(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return eo(t),null;case 1:return fl(t.type)&&_5(),eo(t),null;case 3:return n=t.stateNode,Xv(),$s(dl),$s(vo),UI(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(gN(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ru!==null&&(PO(Ru),Ru=null))),_O(e,t),eo(t),null;case 5:zI(t);var a=b0(Jw.current);if(r=t.type,e!==null&&t.stateNode!=null)JZ(e,t,r,n,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Et(166));return eo(t),null}if(e=b0(zd.current),gN(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[Td]=t,n[Xw]=i,e=(t.mode&1)!==0,r){case"dialog":Ds("cancel",n),Ds("close",n);break;case"iframe":case"object":case"embed":Ds("load",n);break;case"video":case"audio":for(a=0;a<Vb.length;a++)Ds(Vb[a],n);break;case"source":Ds("error",n);break;case"img":case"image":case"link":Ds("error",n),Ds("load",n);break;case"details":Ds("toggle",n);break;case"input":y$(n,i),Ds("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},Ds("invalid",n);break;case"textarea":w$(n,i),Ds("invalid",n)}XP(r,i),a=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?n.textContent!==l&&(i.suppressHydrationWarning!==!0&&pN(n.textContent,l,e),a=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&pN(n.textContent,l,e),a=["children",""+l]):Bw.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Ds("scroll",n)}switch(r){case"input":oN(n),b$(n,i,!0);break;case"textarea":oN(n),j$(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=j5)}n=a,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=CX(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Td]=t,e[Xw]=n,ZZ(e,t,!1,!1),t.stateNode=e;e:{switch(o=ZP(r,n),r){case"dialog":Ds("cancel",e),Ds("close",e),a=n;break;case"iframe":case"object":case"embed":Ds("load",e),a=n;break;case"video":case"audio":for(a=0;a<Vb.length;a++)Ds(Vb[a],e);a=n;break;case"source":Ds("error",e),a=n;break;case"img":case"image":case"link":Ds("error",e),Ds("load",e),a=n;break;case"details":Ds("toggle",e),a=n;break;case"input":y$(e,n),a=WP(e,n),Ds("invalid",e);break;case"option":a=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=ra({},n,{value:void 0}),Ds("invalid",e);break;case"textarea":w$(e,n),a=KP(e,n),Ds("invalid",e);break;default:a=n}XP(r,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?TX(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&EX(e,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&zw(e,c):typeof c=="number"&&zw(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Bw.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Ds("scroll",e):c!=null&&vI(e,i,c,o))}switch(r){case"input":oN(e),b$(e,n,!1);break;case"textarea":oN(e),j$(e);break;case"option":n.value!=null&&e.setAttribute("value",""+Xm(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?cv(e,!!n.multiple,i,!1):n.defaultValue!=null&&cv(e,!!n.multiple,n.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=j5)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return eo(t),null;case 6:if(e&&t.stateNode!=null)QZ(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(Et(166));if(r=b0(Jw.current),b0(zd.current),gN(t)){if(n=t.stateNode,r=t.memoizedProps,n[Td]=t,(i=n.nodeValue!==r)&&(e=Xl,e!==null))switch(e.tag){case 3:pN(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&pN(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Td]=t,t.stateNode=n}return eo(t),null;case 13:if($s(Js),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ws&&Gl!==null&&t.mode&1&&!(t.flags&128))xZ(),Kv(),t.flags|=98560,i=!1;else if(i=gN(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(Et(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Et(317));i[Td]=t}else Kv(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;eo(t),i=!1}else Ru!==null&&(PO(Ru),Ru=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||Js.current&1?pi===0&&(pi=3):eR())),t.updateQueue!==null&&(t.flags|=4),eo(t),null);case 4:return Xv(),_O(e,t),e===null&&Kw(t.stateNode.containerInfo),eo(t),null;case 10:return FI(t.type._context),eo(t),null;case 17:return fl(t.type)&&_5(),eo(t),null;case 19:if($s(Js),i=t.memoizedState,i===null)return eo(t),null;if(n=(t.flags&128)!==0,o=i.rendering,o===null)if(n)mb(i,!1);else{if(pi!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=T5(e),o!==null){for(t.flags|=128,mb(i,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,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}),r=r.sibling;return Ss(Js,Js.current&1|2),t.child}e=e.sibling}i.tail!==null&&Ea()>Jv&&(t.flags|=128,n=!0,mb(i,!1),t.lanes=4194304)}else{if(!n)if(e=T5(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),mb(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ws)return eo(t),null}else 2*Ea()-i.renderingStartTime>Jv&&r!==1073741824&&(t.flags|=128,n=!0,mb(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(r=i.last,r!==null?r.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Ea(),t.sibling=null,r=Js.current,Ss(Js,n?r&1|2:r&1),t):(eo(t),null);case 22:case 23:return QI(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ll&1073741824&&(eo(t),t.subtreeFlags&6&&(t.flags|=8192)):eo(t),null;case 24:return null;case 25:return null}throw Error(Et(156,t.tag))}function Qge(e,t){switch(DI(t),t.tag){case 1:return fl(t.type)&&_5(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xv(),$s(dl),$s(vo),UI(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return zI(t),null;case 13:if($s(Js),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Et(340));Kv()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $s(Js),null;case 4:return Xv(),null;case 10:return FI(t.type._context),null;case 22:case 23:return QI(),null;case 24:return null;default:return null}}var yN=!1,uo=!1,exe=typeof WeakSet=="function"?WeakSet:Set,er=null;function Jx(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ua(e,t,n)}else r.current=null}function NO(e,t,r){try{r()}catch(n){ua(e,t,n)}}var dB=!1;function txe(e,t){if(oO=y5,e=sZ(),PI(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var a=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,m=null;t:for(;;){for(var h;f!==r||a!==0&&f.nodeType!==3||(l=o+a),f!==i||n!==0&&f.nodeType!==3||(c=o+n),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)m=f,f=h;for(;;){if(f===e)break t;if(m===r&&++u===a&&(l=o),m===i&&++d===n&&(c=o),(h=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=h}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(lO={focusedElem:e,selectionRange:r},y5=!1,er=t;er!==null;)if(t=er,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,er=e;else for(;er!==null;){t=er;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,x=g.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?p:Eu(t.type,p),x);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Et(163))}}catch(N){ua(t,t.return,N)}if(e=t.sibling,e!==null){e.return=t.return,er=e;break}er=t.return}return g=dB,dB=!1,g}function aw(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&NO(t,r,i)}a=a.next}while(a!==n)}}function Wk(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function SO(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function eJ(e){var t=e.alternate;t!==null&&(e.alternate=null,eJ(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Td],delete t[Xw],delete t[dO],delete t[Fge],delete t[Mge])),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 tJ(e){return e.tag===5||e.tag===3||e.tag===4}function fB(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||tJ(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 kO(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=j5));else if(n!==4&&(e=e.child,e!==null))for(kO(e,t,r),e=e.sibling;e!==null;)kO(e,t,r),e=e.sibling}function CO(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(CO(e,t,r),e=e.sibling;e!==null;)CO(e,t,r),e=e.sibling}var Wi=null,Ou=!1;function Wh(e,t,r){for(r=r.child;r!==null;)rJ(e,t,r),r=r.sibling}function rJ(e,t,r){if(Bd&&typeof Bd.onCommitFiberUnmount=="function")try{Bd.onCommitFiberUnmount(Fk,r)}catch{}switch(r.tag){case 5:uo||Jx(r,t);case 6:var n=Wi,a=Ou;Wi=null,Wh(e,t,r),Wi=n,Ou=a,Wi!==null&&(Ou?(e=Wi,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Wi.removeChild(r.stateNode));break;case 18:Wi!==null&&(Ou?(e=Wi,r=r.stateNode,e.nodeType===8?u3(e.parentNode,r):e.nodeType===1&&u3(e,r),Ww(e)):u3(Wi,r.stateNode));break;case 4:n=Wi,a=Ou,Wi=r.stateNode.containerInfo,Ou=!0,Wh(e,t,r),Wi=n,Ou=a;break;case 0:case 11:case 14:case 15:if(!uo&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&NO(r,t,o),a=a.next}while(a!==n)}Wh(e,t,r);break;case 1:if(!uo&&(Jx(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ua(r,t,l)}Wh(e,t,r);break;case 21:Wh(e,t,r);break;case 22:r.mode&1?(uo=(n=uo)||r.memoizedState!==null,Wh(e,t,r),uo=n):Wh(e,t,r);break;default:Wh(e,t,r)}}function hB(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new exe),t.forEach(function(n){var a=uxe.bind(null,e,n);r.has(n)||(r.add(n),n.then(a,a))})}}function yu(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var a=r[n];try{var i=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Wi=l.stateNode,Ou=!1;break e;case 3:Wi=l.stateNode.containerInfo,Ou=!0;break e;case 4:Wi=l.stateNode.containerInfo,Ou=!0;break e}l=l.return}if(Wi===null)throw Error(Et(160));rJ(i,o,a),Wi=null,Ou=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){ua(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)nJ(t,e),t=t.sibling}function nJ(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yu(t,e),xd(e),n&4){try{aw(3,e,e.return),Wk(3,e)}catch(p){ua(e,e.return,p)}try{aw(5,e,e.return)}catch(p){ua(e,e.return,p)}}break;case 1:yu(t,e),xd(e),n&512&&r!==null&&Jx(r,r.return);break;case 5:if(yu(t,e),xd(e),n&512&&r!==null&&Jx(r,r.return),e.flags&32){var a=e.stateNode;try{zw(a,"")}catch(p){ua(e,e.return,p)}}if(n&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,o=r!==null?r.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&SX(a,i),ZP(l,o);var u=ZP(l,i);for(o=0;o<c.length;o+=2){var d=c[o],f=c[o+1];d==="style"?TX(a,f):d==="dangerouslySetInnerHTML"?EX(a,f):d==="children"?zw(a,f):vI(a,d,f,u)}switch(l){case"input":HP(a,i);break;case"textarea":kX(a,i);break;case"select":var m=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?cv(a,!!i.multiple,h,!1):m!==!!i.multiple&&(i.defaultValue!=null?cv(a,!!i.multiple,i.defaultValue,!0):cv(a,!!i.multiple,i.multiple?[]:"",!1))}a[Xw]=i}catch(p){ua(e,e.return,p)}}break;case 6:if(yu(t,e),xd(e),n&4){if(e.stateNode===null)throw Error(Et(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(p){ua(e,e.return,p)}}break;case 3:if(yu(t,e),xd(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Ww(t.containerInfo)}catch(p){ua(e,e.return,p)}break;case 4:yu(t,e),xd(e);break;case 13:yu(t,e),xd(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(ZI=Ea())),n&4&&hB(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(uo=(u=uo)||d,yu(t,e),uo=u):yu(t,e),xd(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(er=e,d=e.child;d!==null;){for(f=er=d;er!==null;){switch(m=er,h=m.child,m.tag){case 0:case 11:case 14:case 15:aw(4,m,m.return);break;case 1:Jx(m,m.return);var g=m.stateNode;if(typeof g.componentWillUnmount=="function"){n=m,r=m.return;try{t=n,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(p){ua(n,r,p)}}break;case 5:Jx(m,m.return);break;case 22:if(m.memoizedState!==null){pB(f);continue}}h!==null?(h.return=m,er=h):pB(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=AX("display",o))}catch(p){ua(e,e.return,p)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(p){ua(e,e.return,p)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:yu(t,e),xd(e),n&4&&hB(e);break;case 21:break;default:yu(t,e),xd(e)}}function xd(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(tJ(r)){var n=r;break e}r=r.return}throw Error(Et(160))}switch(n.tag){case 5:var a=n.stateNode;n.flags&32&&(zw(a,""),n.flags&=-33);var i=fB(e);CO(e,i,a);break;case 3:case 4:var o=n.stateNode.containerInfo,l=fB(e);kO(e,l,o);break;default:throw Error(Et(161))}}catch(c){ua(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rxe(e,t,r){er=e,sJ(e)}function sJ(e,t,r){for(var n=(e.mode&1)!==0;er!==null;){var a=er,i=a.child;if(a.tag===22&&n){var o=a.memoizedState!==null||yN;if(!o){var l=a.alternate,c=l!==null&&l.memoizedState!==null||uo;l=yN;var u=uo;if(yN=o,(uo=c)&&!u)for(er=a;er!==null;)o=er,c=o.child,o.tag===22&&o.memoizedState!==null?gB(a):c!==null?(c.return=o,er=c):gB(a);for(;i!==null;)er=i,sJ(i),i=i.sibling;er=a,yN=l,uo=u}mB(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,er=i):mB(e)}}function mB(e){for(;er!==null;){var t=er;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:uo||Wk(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!uo)if(r===null)n.componentDidMount();else{var a=t.elementType===t.type?r.memoizedProps:Eu(t.type,r.memoizedProps);n.componentDidUpdate(a,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&J$(t,i,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}J$(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Ww(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Et(163))}uo||t.flags&512&&SO(t)}catch(m){ua(t,t.return,m)}}if(t===e){er=null;break}if(r=t.sibling,r!==null){r.return=t.return,er=r;break}er=t.return}}function pB(e){for(;er!==null;){var t=er;if(t===e){er=null;break}var r=t.sibling;if(r!==null){r.return=t.return,er=r;break}er=t.return}}function gB(e){for(;er!==null;){var t=er;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Wk(4,t)}catch(c){ua(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var a=t.return;try{n.componentDidMount()}catch(c){ua(t,a,c)}}var i=t.return;try{SO(t)}catch(c){ua(t,i,c)}break;case 5:var o=t.return;try{SO(t)}catch(c){ua(t,o,c)}}}catch(c){ua(t,t.return,c)}if(t===e){er=null;break}var l=t.sibling;if(l!==null){l.return=t.return,er=l;break}er=t.return}}var nxe=Math.ceil,D5=yh.ReactCurrentDispatcher,YI=yh.ReactCurrentOwner,qc=yh.ReactCurrentBatchConfig,On=0,Oi=null,Ha=null,Xi=0,Ll=0,Qx=xp(0),pi=0,r2=null,tg=0,Hk=0,XI=0,iw=null,il=null,ZI=0,Jv=1/0,Rf=null,I5=!1,EO=null,zm=null,bN=!1,Cm=null,R5=0,ow=0,AO=null,GS=-1,KS=0;function Bo(){return On&6?Ea():GS!==-1?GS:GS=Ea()}function Um(e){return e.mode&1?On&2&&Xi!==0?Xi&-Xi:Bge.transition!==null?(KS===0&&(KS=UX()),KS):(e=ss,e!==0||(e=window.event,e=e===void 0?16:YX(e.type)),e):1}function qu(e,t,r,n){if(50<ow)throw ow=0,AO=null,Error(Et(185));Tj(e,r,n),(!(On&2)||e!==Oi)&&(e===Oi&&(!(On&2)&&(Hk|=r),pi===4&&cm(e,Xi)),hl(e,n),r===1&&On===0&&!(t.mode&1)&&(Jv=Ea()+500,Uk&&vp()))}function hl(e,t){var r=e.callbackNode;B0e(e,t);var n=v5(e,e===Oi?Xi:0);if(n===0)r!==null&&S$(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&S$(r),t===1)e.tag===0?$ge(xB.bind(null,e)):mZ(xB.bind(null,e)),Rge(function(){!(On&6)&&vp()}),r=null;else{switch(qX(n)){case 1:r=_I;break;case 4:r=BX;break;case 16:r=x5;break;case 536870912:r=zX;break;default:r=x5}r=fJ(r,aJ.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function aJ(e,t){if(GS=-1,KS=0,On&6)throw Error(Et(327));var r=e.callbackNode;if(mv()&&e.callbackNode!==r)return null;var n=v5(e,e===Oi?Xi:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=L5(e,n);else{t=n;var a=On;On|=2;var i=oJ();(Oi!==e||Xi!==t)&&(Rf=null,Jv=Ea()+500,L0(e,t));do try{ixe();break}catch(l){iJ(e,l)}while(!0);LI(),D5.current=i,On=a,Ha!==null?t=0:(Oi=null,Xi=0,t=pi)}if(t!==0){if(t===2&&(a=rO(e),a!==0&&(n=a,t=TO(e,a))),t===1)throw r=r2,L0(e,0),cm(e,n),hl(e,Ea()),r;if(t===6)cm(e,n);else{if(a=e.current.alternate,!(n&30)&&!sxe(a)&&(t=L5(e,n),t===2&&(i=rO(e),i!==0&&(n=i,t=TO(e,i))),t===1))throw r=r2,L0(e,0),cm(e,n),hl(e,Ea()),r;switch(e.finishedWork=a,e.finishedLanes=n,t){case 0:case 1:throw Error(Et(345));case 2:s0(e,il,Rf);break;case 3:if(cm(e,n),(n&130023424)===n&&(t=ZI+500-Ea(),10<t)){if(v5(e,0)!==0)break;if(a=e.suspendedLanes,(a&n)!==n){Bo(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=uO(s0.bind(null,e,il,Rf),t);break}s0(e,il,Rf);break;case 4:if(cm(e,n),(n&4194240)===n)break;for(t=e.eventTimes,a=-1;0<n;){var o=31-Uu(n);i=1<<o,o=t[o],o>a&&(a=o),n&=~i}if(n=a,n=Ea()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*nxe(n/1960))-n,10<n){e.timeoutHandle=uO(s0.bind(null,e,il,Rf),n);break}s0(e,il,Rf);break;case 5:s0(e,il,Rf);break;default:throw Error(Et(329))}}}return hl(e,Ea()),e.callbackNode===r?aJ.bind(null,e):null}function TO(e,t){var r=iw;return e.current.memoizedState.isDehydrated&&(L0(e,t).flags|=256),e=L5(e,t),e!==2&&(t=il,il=r,t!==null&&PO(t)),e}function PO(e){il===null?il=e:il.push.apply(il,e)}function sxe(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var a=r[n],i=a.getSnapshot;a=a.value;try{if(!Yu(i(),a))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;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 cm(e,t){for(t&=~XI,t&=~Hk,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Uu(t),n=1<<r;e[r]=-1,t&=~n}}function xB(e){if(On&6)throw Error(Et(327));mv();var t=v5(e,0);if(!(t&1))return hl(e,Ea()),null;var r=L5(e,t);if(e.tag!==0&&r===2){var n=rO(e);n!==0&&(t=n,r=TO(e,n))}if(r===1)throw r=r2,L0(e,0),cm(e,t),hl(e,Ea()),r;if(r===6)throw Error(Et(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,s0(e,il,Rf),hl(e,Ea()),null}function JI(e,t){var r=On;On|=1;try{return e(t)}finally{On=r,On===0&&(Jv=Ea()+500,Uk&&vp())}}function rg(e){Cm!==null&&Cm.tag===0&&!(On&6)&&mv();var t=On;On|=1;var r=qc.transition,n=ss;try{if(qc.transition=null,ss=1,e)return e()}finally{ss=n,qc.transition=r,On=t,!(On&6)&&vp()}}function QI(){Ll=Qx.current,$s(Qx)}function L0(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,Ige(r)),Ha!==null)for(r=Ha.return;r!==null;){var n=r;switch(DI(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&_5();break;case 3:Xv(),$s(dl),$s(vo),UI();break;case 5:zI(n);break;case 4:Xv();break;case 13:$s(Js);break;case 19:$s(Js);break;case 10:FI(n.type._context);break;case 22:case 23:QI()}r=r.return}if(Oi=e,Ha=e=qm(e.current,null),Xi=Ll=t,pi=0,r2=null,XI=Hk=tg=0,il=iw=null,y0!==null){for(t=0;t<y0.length;t++)if(r=y0[t],n=r.interleaved,n!==null){r.interleaved=null;var a=n.next,i=r.pending;if(i!==null){var o=i.next;i.next=a,n.next=o}r.pending=n}y0=null}return e}function iJ(e,t){do{var r=Ha;try{if(LI(),VS.current=O5,P5){for(var n=ea.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}P5=!1}if(eg=0,Si=ci=ea=null,sw=!1,Qw=0,YI.current=null,r===null||r.return===null){pi=1,r2=t,Ha=null;break}e:{var i=e,o=r.return,l=r,c=t;if(t=Xi,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var m=d.alternate;m?(d.updateQueue=m.updateQueue,d.memoizedState=m.memoizedState,d.lanes=m.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=sB(o);if(h!==null){h.flags&=-257,aB(h,o,l,i,t),h.mode&1&&nB(i,u,t),t=h,c=u;var g=t.updateQueue;if(g===null){var p=new Set;p.add(c),t.updateQueue=p}else g.add(c);break e}else{if(!(t&1)){nB(i,u,t),eR();break e}c=Error(Et(426))}}else if(Ws&&l.mode&1){var x=sB(o);if(x!==null){!(x.flags&65536)&&(x.flags|=256),aB(x,o,l,i,t),II(Zv(c,l));break e}}i=c=Zv(c,l),pi!==4&&(pi=2),iw===null?iw=[i]:iw.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=qZ(i,c,t);Z$(i,v);break e;case 1:l=c;var b=i.type,y=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(zm===null||!zm.has(y)))){i.flags|=65536,t&=-t,i.lanes|=t;var N=VZ(i,l,t);Z$(i,N);break e}}i=i.return}while(i!==null)}cJ(r)}catch(_){t=_,Ha===r&&r!==null&&(Ha=r=r.return);continue}break}while(!0)}function oJ(){var e=D5.current;return D5.current=O5,e===null?O5:e}function eR(){(pi===0||pi===3||pi===2)&&(pi=4),Oi===null||!(tg&268435455)&&!(Hk&268435455)||cm(Oi,Xi)}function L5(e,t){var r=On;On|=2;var n=oJ();(Oi!==e||Xi!==t)&&(Rf=null,L0(e,t));do try{axe();break}catch(a){iJ(e,a)}while(!0);if(LI(),On=r,D5.current=n,Ha!==null)throw Error(Et(261));return Oi=null,Xi=0,pi}function axe(){for(;Ha!==null;)lJ(Ha)}function ixe(){for(;Ha!==null&&!P0e();)lJ(Ha)}function lJ(e){var t=dJ(e.alternate,e,Ll);e.memoizedProps=e.pendingProps,t===null?cJ(e):Ha=t,YI.current=null}function cJ(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=Qge(r,t),r!==null){r.flags&=32767,Ha=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{pi=6,Ha=null;return}}else if(r=Jge(r,t,Ll),r!==null){Ha=r;return}if(t=t.sibling,t!==null){Ha=t;return}Ha=t=e}while(t!==null);pi===0&&(pi=5)}function s0(e,t,r){var n=ss,a=qc.transition;try{qc.transition=null,ss=1,oxe(e,t,r,n)}finally{qc.transition=a,ss=n}return null}function oxe(e,t,r,n){do mv();while(Cm!==null);if(On&6)throw Error(Et(327));r=e.finishedWork;var a=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(Et(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(z0e(e,i),e===Oi&&(Ha=Oi=null,Xi=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||bN||(bN=!0,fJ(x5,function(){return mv(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=qc.transition,qc.transition=null;var o=ss;ss=1;var l=On;On|=4,YI.current=null,txe(e,r),nJ(r,e),Cge(lO),y5=!!oO,lO=oO=null,e.current=r,rxe(r),O0e(),On=l,ss=o,qc.transition=i}else e.current=r;if(bN&&(bN=!1,Cm=e,R5=a),i=e.pendingLanes,i===0&&(zm=null),R0e(r.stateNode),hl(e,Ea()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)a=t[r],n(a.value,{componentStack:a.stack,digest:a.digest});if(I5)throw I5=!1,e=EO,EO=null,e;return R5&1&&e.tag!==0&&mv(),i=e.pendingLanes,i&1?e===AO?ow++:(ow=0,AO=e):ow=0,vp(),null}function mv(){if(Cm!==null){var e=qX(R5),t=qc.transition,r=ss;try{if(qc.transition=null,ss=16>e?16:e,Cm===null)var n=!1;else{if(e=Cm,Cm=null,R5=0,On&6)throw Error(Et(331));var a=On;for(On|=4,er=e.current;er!==null;){var i=er,o=i.child;if(er.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(er=u;er!==null;){var d=er;switch(d.tag){case 0:case 11:case 15:aw(8,d,i)}var f=d.child;if(f!==null)f.return=d,er=f;else for(;er!==null;){d=er;var m=d.sibling,h=d.return;if(eJ(d),d===u){er=null;break}if(m!==null){m.return=h,er=m;break}er=h}}}var g=i.alternate;if(g!==null){var p=g.child;if(p!==null){g.child=null;do{var x=p.sibling;p.sibling=null,p=x}while(p!==null)}}er=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,er=o;else e:for(;er!==null;){if(i=er,i.flags&2048)switch(i.tag){case 0:case 11:case 15:aw(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,er=v;break e}er=i.return}}var b=e.current;for(er=b;er!==null;){o=er;var y=o.child;if(o.subtreeFlags&2064&&y!==null)y.return=o,er=y;else e:for(o=b;er!==null;){if(l=er,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Wk(9,l)}}catch(_){ua(l,l.return,_)}if(l===o){er=null;break e}var N=l.sibling;if(N!==null){N.return=l.return,er=N;break e}er=l.return}}if(On=a,vp(),Bd&&typeof Bd.onPostCommitFiberRoot=="function")try{Bd.onPostCommitFiberRoot(Fk,e)}catch{}n=!0}return n}finally{ss=r,qc.transition=t}}return!1}function vB(e,t,r){t=Zv(r,t),t=qZ(e,t,1),e=Bm(e,t,1),t=Bo(),e!==null&&(Tj(e,1,t),hl(e,t))}function ua(e,t,r){if(e.tag===3)vB(e,e,r);else for(;t!==null;){if(t.tag===3){vB(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(zm===null||!zm.has(n))){e=Zv(r,e),e=VZ(t,e,1),t=Bm(t,e,1),e=Bo(),t!==null&&(Tj(t,1,e),hl(t,e));break}}t=t.return}}function lxe(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=Bo(),e.pingedLanes|=e.suspendedLanes&r,Oi===e&&(Xi&r)===r&&(pi===4||pi===3&&(Xi&130023424)===Xi&&500>Ea()-ZI?L0(e,0):XI|=r),hl(e,t)}function uJ(e,t){t===0&&(e.mode&1?(t=uN,uN<<=1,!(uN&130023424)&&(uN=4194304)):t=1);var r=Bo();e=oh(e,t),e!==null&&(Tj(e,t,r),hl(e,r))}function cxe(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),uJ(e,r)}function uxe(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Et(314))}n!==null&&n.delete(t),uJ(e,r)}var dJ;dJ=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||dl.current)cl=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return cl=!1,Zge(e,t,r);cl=!!(e.flags&131072)}else cl=!1,Ws&&t.flags&1048576&&pZ(t,k5,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;HS(e,t),e=t.pendingProps;var a=Gv(t,vo.current);hv(t,r),a=VI(null,t,n,e,a,r);var i=WI();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,fl(n)?(i=!0,N5(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,$I(t),a.updater=Vk,t.stateNode=a,a._reactInternals=t,xO(t,n,e,r),t=bO(null,t,n,!0,i,r)):(t.tag=0,Ws&&i&&OI(t),To(null,t,a,r),t=t.child),t;case 16:n=t.elementType;e:{switch(HS(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=fxe(n),e=Eu(n,e),a){case 0:t=yO(null,t,n,e,r);break e;case 1:t=lB(null,t,n,e,r);break e;case 11:t=iB(null,t,n,e,r);break e;case 14:t=oB(null,t,n,Eu(n.type,e),r);break e}throw Error(Et(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Eu(n,a),yO(e,t,n,a,r);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Eu(n,a),lB(e,t,n,a,r);case 3:e:{if(KZ(t),e===null)throw Error(Et(387));n=t.pendingProps,i=t.memoizedState,a=i.element,wZ(e,t),A5(t,n,null,r);var o=t.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Zv(Error(Et(423)),t),t=cB(e,t,n,r,a);break e}else if(n!==a){a=Zv(Error(Et(424)),t),t=cB(e,t,n,r,a);break e}else for(Gl=$m(t.stateNode.containerInfo.firstChild),Xl=t,Ws=!0,Ru=null,r=yZ(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Kv(),n===a){t=lh(e,t,r);break e}To(e,t,n,r)}t=t.child}return t;case 5:return jZ(t),e===null&&mO(t),n=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,cO(n,a)?o=null:i!==null&&cO(n,i)&&(t.flags|=32),GZ(e,t),To(e,t,o,r),t.child;case 6:return e===null&&mO(t),null;case 13:return YZ(e,t,r);case 4:return BI(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Yv(t,null,n,r):To(e,t,n,r),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Eu(n,a),iB(e,t,n,a,r);case 7:return To(e,t,t.pendingProps,r),t.child;case 8:return To(e,t,t.pendingProps.children,r),t.child;case 12:return To(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,Ss(C5,n._currentValue),n._currentValue=o,i!==null)if(Yu(i.value,o)){if(i.children===a.children&&!dl.current){t=lh(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=Xf(-1,r&-r),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=r,c=i.alternate,c!==null&&(c.lanes|=r),pO(i.return,r,t),l.lanes|=r;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(Et(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),pO(o,r,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}To(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,hv(t,r),a=Qc(a),n=n(a),t.flags|=1,To(e,t,n,r),t.child;case 14:return n=t.type,a=Eu(n,t.pendingProps),a=Eu(n.type,a),oB(e,t,n,a,r);case 15:return WZ(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Eu(n,a),HS(e,t),t.tag=1,fl(n)?(e=!0,N5(t)):e=!1,hv(t,r),UZ(t,n,a),xO(t,n,a,r),bO(null,t,n,!0,e,r);case 19:return XZ(e,t,r);case 22:return HZ(e,t,r)}throw Error(Et(156,t.tag))};function fJ(e,t){return $X(e,t)}function dxe(e,t,r,n){this.tag=e,this.key=r,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mc(e,t,r,n){return new dxe(e,t,r,n)}function tR(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fxe(e){if(typeof e=="function")return tR(e)?1:0;if(e!=null){if(e=e.$$typeof,e===bI)return 11;if(e===wI)return 14}return 2}function qm(e,t){var r=e.alternate;return r===null?(r=Mc(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function YS(e,t,r,n,a,i){var o=2;if(n=e,typeof e=="function")tR(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case qx:return F0(r.children,a,i,t);case yI:o=8,a|=8;break;case zP:return e=Mc(12,r,t,a|2),e.elementType=zP,e.lanes=i,e;case UP:return e=Mc(13,r,t,a),e.elementType=UP,e.lanes=i,e;case qP:return e=Mc(19,r,t,a),e.elementType=qP,e.lanes=i,e;case jX:return Gk(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case bX:o=10;break e;case wX:o=9;break e;case bI:o=11;break e;case wI:o=14;break e;case sm:o=16,n=null;break e}throw Error(Et(130,e==null?e:typeof e,""))}return t=Mc(o,r,t,a),t.elementType=e,t.type=n,t.lanes=i,t}function F0(e,t,r,n){return e=Mc(7,e,n,t),e.lanes=r,e}function Gk(e,t,r,n){return e=Mc(22,e,n,t),e.elementType=jX,e.lanes=r,e.stateNode={isHidden:!1},e}function v3(e,t,r){return e=Mc(6,e,null,t),e.lanes=r,e}function y3(e,t,r){return t=Mc(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hxe(e,t,r,n,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=QA(0),this.expirationTimes=QA(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=QA(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function rR(e,t,r,n,a,i,o,l,c){return e=new hxe(e,t,r,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Mc(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},$I(i),e}function mxe(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ux,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function hJ(e){if(!e)return Zm;e=e._reactInternals;e:{if(Tg(e)!==e||e.tag!==1)throw Error(Et(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(fl(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Et(171))}if(e.tag===1){var r=e.type;if(fl(r))return hZ(e,r,t)}return t}function mJ(e,t,r,n,a,i,o,l,c){return e=rR(r,n,!0,e,a,i,o,l,c),e.context=hJ(null),r=e.current,n=Bo(),a=Um(r),i=Xf(n,a),i.callback=t??null,Bm(r,i,a),e.current.lanes=a,Tj(e,a,n),hl(e,n),e}function Kk(e,t,r,n){var a=t.current,i=Bo(),o=Um(a);return r=hJ(r),t.context===null?t.context=r:t.pendingContext=r,t=Xf(i,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Bm(a,t,o),e!==null&&(qu(e,a,o,i),qS(e,a,o)),o}function F5(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 yB(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function nR(e,t){yB(e,t),(e=e.alternate)&&yB(e,t)}function pxe(){return null}var pJ=typeof reportError=="function"?reportError:function(e){console.error(e)};function sR(e){this._internalRoot=e}Yk.prototype.render=sR.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Et(409));Kk(e,t,null,null)};Yk.prototype.unmount=sR.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rg(function(){Kk(null,e,null,null)}),t[ih]=null}};function Yk(e){this._internalRoot=e}Yk.prototype.unstable_scheduleHydration=function(e){if(e){var t=HX();e={blockedOn:null,target:e,priority:t};for(var r=0;r<lm.length&&t!==0&&t<lm[r].priority;r++);lm.splice(r,0,e),r===0&&KX(e)}};function aR(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Xk(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function bB(){}function gxe(e,t,r,n,a){if(a){if(typeof n=="function"){var i=n;n=function(){var u=F5(o);i.call(u)}}var o=mJ(t,n,e,0,null,!1,!1,"",bB);return e._reactRootContainer=o,e[ih]=o.current,Kw(e.nodeType===8?e.parentNode:e),rg(),o}for(;a=e.lastChild;)e.removeChild(a);if(typeof n=="function"){var l=n;n=function(){var u=F5(c);l.call(u)}}var c=rR(e,0,!1,null,null,!1,!1,"",bB);return e._reactRootContainer=c,e[ih]=c.current,Kw(e.nodeType===8?e.parentNode:e),rg(function(){Kk(t,c,r,n)}),c}function Zk(e,t,r,n,a){var i=r._reactRootContainer;if(i){var o=i;if(typeof a=="function"){var l=a;a=function(){var c=F5(o);l.call(c)}}Kk(t,o,e,a)}else o=gxe(r,t,e,a,n);return F5(o)}VX=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=qb(t.pendingLanes);r!==0&&(NI(t,r|1),hl(t,Ea()),!(On&6)&&(Jv=Ea()+500,vp()))}break;case 13:rg(function(){var n=oh(e,1);if(n!==null){var a=Bo();qu(n,e,1,a)}}),nR(e,1)}};SI=function(e){if(e.tag===13){var t=oh(e,134217728);if(t!==null){var r=Bo();qu(t,e,134217728,r)}nR(e,134217728)}};WX=function(e){if(e.tag===13){var t=Um(e),r=oh(e,t);if(r!==null){var n=Bo();qu(r,e,t,n)}nR(e,t)}};HX=function(){return ss};GX=function(e,t){var r=ss;try{return ss=e,t()}finally{ss=r}};QP=function(e,t,r){switch(t){case"input":if(HP(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var a=zk(n);if(!a)throw Error(Et(90));NX(n),HP(n,a)}}}break;case"textarea":kX(e,r);break;case"select":t=r.value,t!=null&&cv(e,!!r.multiple,t,!1)}};DX=JI;IX=rg;var xxe={usingClientEntryPoint:!1,Events:[Oj,Gx,zk,PX,OX,JI]},pb={findFiberByHostInstance:v0,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},vxe={bundleType:pb.bundleType,version:pb.version,rendererPackageName:pb.rendererPackageName,rendererConfig:pb.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:yh.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=FX(e),e===null?null:e.stateNode},findFiberByHostInstance:pb.findFiberByHostInstance||pxe,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 wN=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wN.isDisabled&&wN.supportsFiber)try{Fk=wN.inject(vxe),Bd=wN}catch{}}oc.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xxe;oc.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!aR(t))throw Error(Et(200));return mxe(e,t,null,r)};oc.createRoot=function(e,t){if(!aR(e))throw Error(Et(299));var r=!1,n="",a=pJ;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=rR(e,1,!1,null,null,r,!1,n,a),e[ih]=t.current,Kw(e.nodeType===8?e.parentNode:e),new sR(t)};oc.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(Et(188)):(e=Object.keys(e).join(","),Error(Et(268,e)));return e=FX(t),e=e===null?null:e.stateNode,e};oc.flushSync=function(e){return rg(e)};oc.hydrate=function(e,t,r){if(!Xk(t))throw Error(Et(200));return Zk(null,e,t,!0,r)};oc.hydrateRoot=function(e,t,r){if(!aR(e))throw Error(Et(405));var n=r!=null&&r.hydratedSources||null,a=!1,i="",o=pJ;if(r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=mJ(t,null,e,1,r??null,a,!1,i,o),e[ih]=t.current,Kw(e),n)for(e=0;e<n.length;e++)r=n[e],a=r._getVersion,a=a(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,a]:t.mutableSourceEagerHydrationData.push(r,a);return new Yk(t)};oc.render=function(e,t,r){if(!Xk(t))throw Error(Et(200));return Zk(null,e,t,!1,r)};oc.unmountComponentAtNode=function(e){if(!Xk(e))throw Error(Et(40));return e._reactRootContainer?(rg(function(){Zk(null,null,e,!1,function(){e._reactRootContainer=null,e[ih]=null})}),!0):!1};oc.unstable_batchedUpdates=JI;oc.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Xk(r))throw Error(Et(200));if(e==null||e._reactInternals===void 0)throw Error(Et(38));return Zk(e,t,r,!1,n)};oc.version="18.3.1-next-f1338f8080-20240426";function gJ(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gJ)}catch(e){console.error(e)}}gJ(),gX.exports=oc;var $c=gX.exports;const xJ=jn($c);var vJ,wB=$c;vJ=wB.createRoot,wB.hydrateRoot;const yxe=1,bxe=1e6;let b3=0;function wxe(){return b3=(b3+1)%Number.MAX_SAFE_INTEGER,b3.toString()}const w3=new Map,jB=e=>{if(w3.has(e))return;const t=setTimeout(()=>{w3.delete(e),lw({type:"REMOVE_TOAST",toastId:e})},bxe);w3.set(e,t)},jxe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,yxe)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?jB(r):e.toasts.forEach(n=>{jB(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},XS=[];let ZS={toasts:[]};function lw(e){ZS=jxe(ZS,e),XS.forEach(t=>{t(ZS)})}function _xe({...e}){const t=wxe(),r=a=>lw({type:"UPDATE_TOAST",toast:{...a,id:t}}),n=()=>lw({type:"DISMISS_TOAST",toastId:t});return lw({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||n()}}}),{id:t,dismiss:n,update:r}}function yJ(){const[e,t]=w.useState(ZS);return w.useEffect(()=>(XS.push(t),()=>{const r=XS.indexOf(t);r>-1&&XS.splice(r,1)}),[e]),{...e,toast:_xe,dismiss:r=>lw({type:"DISMISS_TOAST",toastId:r})}}function Ct(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e==null||e(a),r===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function _B(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ch(...e){return t=>{let r=!1;const n=e.map(a=>{const i=_B(a,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let a=0;a<n.length;a++){const i=n[a];typeof i=="function"?i():_B(e[a],null)}}}}function Cr(...e){return w.useCallback(ch(...e),e)}function Nxe(e,t){const r=w.createContext(t),n=i=>{const{children:o,...l}=i,c=w.useMemo(()=>l,Object.values(l));return s.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function a(i){const o=w.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[n,a]}function Xa(e,t=[]){let r=[];function n(i,o){const l=w.createContext(o),c=r.length;r=[...r,o];const u=f=>{var v;const{scope:m,children:h,...g}=f,p=((v=m==null?void 0:m[e])==null?void 0:v[c])||l,x=w.useMemo(()=>g,Object.values(g));return s.jsx(p.Provider,{value:x,children:h})};u.displayName=i+"Provider";function d(f,m){var p;const h=((p=m==null?void 0:m[e])==null?void 0:p[c])||l,g=w.useContext(h);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const a=()=>{const i=r.map(o=>w.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[n,Sxe(a,...t)]}function Sxe(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function Jm(e){const t=kxe(e),r=w.forwardRef((n,a)=>{const{children:i,...o}=n,l=w.Children.toArray(i),c=l.find(Cxe);if(c){const u=c.props.children,d=l.map(f=>f===c?w.Children.count(u)>1?w.Children.only(null):w.isValidElement(u)?u.props.children:null:f);return s.jsx(t,{...o,ref:a,children:w.isValidElement(u)?w.cloneElement(u,void 0,d):null})}return s.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}var bJ=Jm("Slot");function kxe(e){const t=w.forwardRef((r,n)=>{const{children:a,...i}=r;if(w.isValidElement(a)){const o=Axe(a),l=Exe(i,a.props);return a.type!==w.Fragment&&(l.ref=n?ch(n,o):o),w.cloneElement(a,l)}return w.Children.count(a)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wJ=Symbol("radix.slottable");function jJ(e){const t=({children:r})=>s.jsx(s.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=wJ,t}function Cxe(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wJ}function Exe(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Axe(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ij(e){const t=e+"CollectionProvider",[r,n]=Xa(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:x,children:v}=p,b=be.useRef(null),y=be.useRef(new Map).current;return s.jsx(a,{scope:x,itemMap:y,collectionRef:b,children:v})};o.displayName=t;const l=e+"CollectionSlot",c=Jm(l),u=be.forwardRef((p,x)=>{const{scope:v,children:b}=p,y=i(l,v),N=Cr(x,y.collectionRef);return s.jsx(c,{ref:N,children:b})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=Jm(d),h=be.forwardRef((p,x)=>{const{scope:v,children:b,...y}=p,N=be.useRef(null),_=Cr(x,N),j=i(d,v);return be.useEffect(()=>(j.itemMap.set(N,{ref:N,...y}),()=>void j.itemMap.delete(N))),s.jsx(m,{[f]:"",ref:_,children:b})});h.displayName=d;function g(p){const x=i(e+"CollectionConsumer",p);return be.useCallback(()=>{const b=x.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((j,S)=>y.indexOf(j.ref.current)-y.indexOf(S.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:u,ItemSlot:h},g,n]}var Txe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zt=Txe.reduce((e,t)=>{const r=Jm(`Primitive.${t}`),n=w.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function iR(e,t){e&&$c.flushSync(()=>e.dispatchEvent(t))}function ha(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function Pxe(e,t=globalThis==null?void 0:globalThis.document){const r=ha(e);w.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Oxe="DismissableLayer",OO="dismissableLayer.update",Dxe="dismissableLayer.pointerDownOutside",Ixe="dismissableLayer.focusOutside",NB,_J=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Pg=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=w.useContext(_J),[d,f]=w.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=w.useState({}),g=Cr(t,S=>f(S)),p=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=p.indexOf(x),b=d?p.indexOf(d):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,N=b>=v,_=Lxe(S=>{const I=S.target,P=[...u.branches].some(F=>F.contains(I));!N||P||(a==null||a(S),o==null||o(S),S.defaultPrevented||l==null||l())},m),j=Fxe(S=>{const I=S.target;[...u.branches].some(F=>F.contains(I))||(i==null||i(S),o==null||o(S),S.defaultPrevented||l==null||l())},m);return Pxe(S=>{b===u.layers.size-1&&(n==null||n(S),!S.defaultPrevented&&l&&(S.preventDefault(),l()))},m),w.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(NB=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),SB(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=NB)}},[d,m,r,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),SB())},[d,u]),w.useEffect(()=>{const S=()=>h({});return document.addEventListener(OO,S),()=>document.removeEventListener(OO,S)},[]),s.jsx(zt.div,{...c,ref:g,style:{pointerEvents:y?N?"auto":"none":void 0,...e.style},onFocusCapture:Ct(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Ct(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Ct(e.onPointerDownCapture,_.onPointerDownCapture)})});Pg.displayName=Oxe;var Rxe="DismissableLayerBranch",NJ=w.forwardRef((e,t)=>{const r=w.useContext(_J),n=w.useRef(null),a=Cr(t,n);return w.useEffect(()=>{const i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),s.jsx(zt.div,{...e,ref:a})});NJ.displayName=Rxe;function Lxe(e,t=globalThis==null?void 0:globalThis.document){const r=ha(e),n=w.useRef(!1),a=w.useRef(()=>{});return w.useEffect(()=>{const i=l=>{if(l.target&&!n.current){let c=function(){SJ(Dxe,r,u,{discrete:!0})};const u={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);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Fxe(e,t=globalThis==null?void 0:globalThis.document){const r=ha(e),n=w.useRef(!1);return w.useEffect(()=>{const a=i=>{i.target&&!n.current&&SJ(Ixe,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function SB(){const e=new CustomEvent(OO);document.dispatchEvent(e)}function SJ(e,t,r,{discrete:n}){const a=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?iR(a,i):a.dispatchEvent(i)}var Mxe=Pg,$xe=NJ,ba=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Bxe="Portal",Vy=w.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[a,i]=w.useState(!1);ba(()=>i(!0),[]);const o=r||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?xJ.createPortal(s.jsx(zt.div,{...n,ref:t}),o):null});Vy.displayName=Bxe;function zxe(e,t){return w.useReducer((r,n)=>t[r][n]??r,e)}var Za=e=>{const{present:t,children:r}=e,n=Uxe(t),a=typeof r=="function"?r({present:n.isPresent}):w.Children.only(r),i=Cr(n.ref,qxe(a));return typeof r=="function"||n.isPresent?w.cloneElement(a,{ref:i}):null};Za.displayName="Presence";function Uxe(e){const[t,r]=w.useState(),n=w.useRef(null),a=w.useRef(e),i=w.useRef("none"),o=e?"mounted":"unmounted",[l,c]=zxe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const u=jN(n.current);i.current=l==="mounted"?u:"none"},[l]),ba(()=>{const u=n.current,d=a.current;if(d!==e){const m=i.current,h=jN(u);e?c("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==h?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),ba(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const p=jN(n.current).includes(h.animationName);if(h.target===t&&p&&(c("ANIMATION_END"),!a.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},m=h=>{h.target===t&&(i.current=jN(n.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:w.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function jN(e){return(e==null?void 0:e.animationName)||"none"}function qxe(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Vxe=pI[" useInsertionEffect ".trim().toString()]||ba;function Wo({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,i,o]=Wxe({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const d=w.useRef(e!==void 0);w.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${n} is changing from ${f?"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.`),d.current=l},[l,n])}const u=w.useCallback(d=>{var f;if(l){const m=Hxe(d)?d(e):d;m!==e&&((f=o.current)==null||f.call(o,m))}else i(d)},[l,e,i,o]);return[c,u]}function Wxe({defaultProp:e,onChange:t}){const[r,n]=w.useState(e),a=w.useRef(r),i=w.useRef(t);return Vxe(()=>{i.current=t},[t]),w.useEffect(()=>{var o;a.current!==r&&((o=i.current)==null||o.call(i,r),a.current=r)},[r,a]),[r,n,i]}function Hxe(e){return typeof e=="function"}var kJ=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"}),Gxe="VisuallyHidden",Jk=w.forwardRef((e,t)=>s.jsx(zt.span,{...e,ref:t,style:{...kJ,...e.style}}));Jk.displayName=Gxe;var Kxe=Jk,oR="ToastProvider",[lR,Yxe,Xxe]=Ij("Toast"),[CJ]=Xa("Toast",[Xxe]),[Zxe,Qk]=CJ(oR),EJ=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:o}=e,[l,c]=w.useState(null),[u,d]=w.useState(0),f=w.useRef(!1),m=w.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${oR}\`. Expected non-empty \`string\`.`),s.jsx(lR.Provider,{scope:t,children:s.jsx(Zxe,{scope:t,label:r,duration:n,swipeDirection:a,swipeThreshold:i,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:w.useCallback(()=>d(h=>h+1),[]),onToastRemove:w.useCallback(()=>d(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:m,children:o})})};EJ.displayName=oR;var AJ="ToastViewport",Jxe=["F8"],DO="toast.viewportPause",IO="toast.viewportResume",TJ=w.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=Jxe,label:a="Notifications ({hotkey})",...i}=e,o=Qk(AJ,r),l=Yxe(r),c=w.useRef(null),u=w.useRef(null),d=w.useRef(null),f=w.useRef(null),m=Cr(t,f,o.onViewportChange),h=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),g=o.toastCount>0;w.useEffect(()=>{const x=v=>{var y;n.length!==0&&n.every(N=>v[N]||v.code===N)&&((y=f.current)==null||y.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]),w.useEffect(()=>{const x=c.current,v=f.current;if(g&&x&&v){const b=()=>{if(!o.isClosePausedRef.current){const j=new CustomEvent(DO);v.dispatchEvent(j),o.isClosePausedRef.current=!0}},y=()=>{if(o.isClosePausedRef.current){const j=new CustomEvent(IO);v.dispatchEvent(j),o.isClosePausedRef.current=!1}},N=j=>{!x.contains(j.relatedTarget)&&y()},_=()=>{x.contains(document.activeElement)||y()};return x.addEventListener("focusin",b),x.addEventListener("focusout",N),x.addEventListener("pointermove",b),x.addEventListener("pointerleave",_),window.addEventListener("blur",b),window.addEventListener("focus",y),()=>{x.removeEventListener("focusin",b),x.removeEventListener("focusout",N),x.removeEventListener("pointermove",b),x.removeEventListener("pointerleave",_),window.removeEventListener("blur",b),window.removeEventListener("focus",y)}}},[g,o.isClosePausedRef]);const p=w.useCallback(({tabbingDirection:x})=>{const b=l().map(y=>{const N=y.ref.current,_=[N,...dve(N)];return x==="forwards"?_:_.reverse()});return(x==="forwards"?b.reverse():b).flat()},[l]);return w.useEffect(()=>{const x=f.current;if(x){const v=b=>{var _,j,S;const y=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!y){const I=document.activeElement,P=b.shiftKey;if(b.target===x&&P){(_=u.current)==null||_.focus();return}const k=p({tabbingDirection:P?"backwards":"forwards"}),V=k.findIndex(C=>C===I);j3(k.slice(V+1))?b.preventDefault():P?(j=u.current)==null||j.focus():(S=d.current)==null||S.focus()}};return x.addEventListener("keydown",v),()=>x.removeEventListener("keydown",v)}},[l,p]),s.jsxs($xe,{ref:c,role:"region","aria-label":a.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:g?void 0:"none"},children:[g&&s.jsx(RO,{ref:u,onFocusFromOutsideViewport:()=>{const x=p({tabbingDirection:"forwards"});j3(x)}}),s.jsx(lR.Slot,{scope:r,children:s.jsx(zt.ol,{tabIndex:-1,...i,ref:m})}),g&&s.jsx(RO,{ref:d,onFocusFromOutsideViewport:()=>{const x=p({tabbingDirection:"backwards"});j3(x)}})]})});TJ.displayName=AJ;var PJ="ToastFocusProxy",RO=w.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...a}=e,i=Qk(PJ,r);return s.jsx(Jk,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=i.viewport)!=null&&u.contains(l))&&n()}})});RO.displayName=PJ;var Rj="Toast",Qxe="toast.swipeStart",eve="toast.swipeMove",tve="toast.swipeCancel",rve="toast.swipeEnd",OJ=w.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:a,onOpenChange:i,...o}=e,[l,c]=Wo({prop:n,defaultProp:a??!0,onChange:i,caller:Rj});return s.jsx(Za,{present:r||l,children:s.jsx(ave,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:ha(e.onPause),onResume:ha(e.onResume),onSwipeStart:Ct(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ct(e.onSwipeMove,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:Ct(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ct(e.onSwipeEnd,u=>{const{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});OJ.displayName=Rj;var[nve,sve]=CJ(Rj,{onClose(){}}),ave=w.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:a,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:m,onSwipeEnd:h,...g}=e,p=Qk(Rj,r),[x,v]=w.useState(null),b=Cr(t,C=>v(C)),y=w.useRef(null),N=w.useRef(null),_=a||p.duration,j=w.useRef(0),S=w.useRef(_),I=w.useRef(0),{onToastAdd:P,onToastRemove:F}=p,T=ha(()=>{var R;(x==null?void 0:x.contains(document.activeElement))&&((R=p.viewport)==null||R.focus()),o()}),k=w.useCallback(C=>{!C||C===1/0||(window.clearTimeout(I.current),j.current=new Date().getTime(),I.current=window.setTimeout(T,C))},[T]);w.useEffect(()=>{const C=p.viewport;if(C){const R=()=>{k(S.current),u==null||u()},H=()=>{const q=new Date().getTime()-j.current;S.current=S.current-q,window.clearTimeout(I.current),c==null||c()};return C.addEventListener(DO,H),C.addEventListener(IO,R),()=>{C.removeEventListener(DO,H),C.removeEventListener(IO,R)}}},[p.viewport,_,c,u,k]),w.useEffect(()=>{i&&!p.isClosePausedRef.current&&k(_)},[i,_,p.isClosePausedRef,k]),w.useEffect(()=>(P(),()=>F()),[P,F]);const V=w.useMemo(()=>x?$J(x):null,[x]);return p.viewport?s.jsxs(s.Fragment,{children:[V&&s.jsx(ive,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:V}),s.jsx(nve,{scope:r,onClose:T,children:$c.createPortal(s.jsx(lR.ItemSlot,{scope:r,children:s.jsx(Mxe,{asChild:!0,onEscapeKeyDown:Ct(l,()=>{p.isFocusedToastEscapeKeyDownRef.current||T(),p.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(zt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":p.swipeDirection,...g,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ct(e.onKeyDown,C=>{C.key==="Escape"&&(l==null||l(C.nativeEvent),C.nativeEvent.defaultPrevented||(p.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:Ct(e.onPointerDown,C=>{C.button===0&&(y.current={x:C.clientX,y:C.clientY})}),onPointerMove:Ct(e.onPointerMove,C=>{if(!y.current)return;const R=C.clientX-y.current.x,H=C.clientY-y.current.y,q=!!N.current,L=["left","right"].includes(p.swipeDirection),M=["left","up"].includes(p.swipeDirection)?Math.min:Math.max,z=L?M(0,R):0,K=L?0:M(0,H),E=C.pointerType==="touch"?10:2,A={x:z,y:K},O={originalEvent:C,delta:A};q?(N.current=A,_N(eve,f,O,{discrete:!1})):kB(A,p.swipeDirection,E)?(N.current=A,_N(Qxe,d,O,{discrete:!1}),C.target.setPointerCapture(C.pointerId)):(Math.abs(R)>E||Math.abs(H)>E)&&(y.current=null)}),onPointerUp:Ct(e.onPointerUp,C=>{const R=N.current,H=C.target;if(H.hasPointerCapture(C.pointerId)&&H.releasePointerCapture(C.pointerId),N.current=null,y.current=null,R){const q=C.currentTarget,L={originalEvent:C,delta:R};kB(R,p.swipeDirection,p.swipeThreshold)?_N(rve,h,L,{discrete:!0}):_N(tve,m,L,{discrete:!0}),q.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),p.viewport)})]}):null}),ive=e=>{const{__scopeToast:t,children:r,...n}=e,a=Qk(Rj,t),[i,o]=w.useState(!1),[l,c]=w.useState(!1);return cve(()=>o(!0)),w.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:s.jsx(Vy,{asChild:!0,children:s.jsx(Jk,{...n,children:i&&s.jsxs(s.Fragment,{children:[a.label," ",r]})})})},ove="ToastTitle",DJ=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return s.jsx(zt.div,{...n,ref:t})});DJ.displayName=ove;var lve="ToastDescription",IJ=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return s.jsx(zt.div,{...n,ref:t})});IJ.displayName=lve;var RJ="ToastAction",LJ=w.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?s.jsx(MJ,{altText:r,asChild:!0,children:s.jsx(cR,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${RJ}\`. Expected non-empty \`string\`.`),null)});LJ.displayName=RJ;var FJ="ToastClose",cR=w.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,a=sve(FJ,r);return s.jsx(MJ,{asChild:!0,children:s.jsx(zt.button,{type:"button",...n,ref:t,onClick:Ct(e.onClick,a.onClose)})})});cR.displayName=FJ;var MJ=w.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...a}=e;return s.jsx(zt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...a,ref:t})});function $J(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),uve(n)){const a=n.ariaHidden||n.hidden||n.style.display==="none",i=n.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const o=n.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...$J(n))}}),t}function _N(e,t,r,{discrete:n}){const a=r.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?iR(a,i):a.dispatchEvent(i)}var kB=(e,t,r=0)=>{const n=Math.abs(e.x),a=Math.abs(e.y),i=n>a;return t==="left"||t==="right"?i&&n>r:!i&&a>r};function cve(e=()=>{}){const t=ha(e);ba(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function uve(e){return e.nodeType===e.ELEMENT_NODE}function dve(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function j3(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var fve=EJ,BJ=TJ,zJ=OJ,UJ=DJ,qJ=IJ,VJ=LJ,WJ=cR;function HJ(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=HJ(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function en(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=HJ(e))&&(n&&(n+=" "),n+=t);return n}const CB=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,EB=en,Wy=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return EB(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(u=>{const d=r==null?void 0:r[u],f=i==null?void 0:i[u];if(d===null)return null;const m=CB(d)||CB(f);return a[u][m]}),l=r&&Object.entries(r).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:f,className:m,...h}=d;return Object.entries(h).every(g=>{let[p,x]=g;return Array.isArray(x)?x.includes({...i,...l}[p]):{...i,...l}[p]===x})?[...u,f,m]:u},[]);return EB(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hve=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),GJ=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var mve={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pve=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...l},c)=>w.createElement("svg",{ref:c,...mve,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:GJ("lucide",a),...l},[...o.map(([u,d])=>w.createElement(u,d)),...Array.isArray(i)?i:[i]]));/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ct=(e,t)=>{const r=w.forwardRef(({className:n,...a},i)=>w.createElement(pve,{ref:i,iconNode:t,className:GJ(`lucide-${hve(e)}`,n),...a}));return r.displayName=`${e}`,r};/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const NN=ct("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gve=ct("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yn=ct("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mn=ct("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const LO=ct("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yp=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xve=ct("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const FO=ct("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const AB=ct("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xl=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vve=ct("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Em=ct("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const as=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yve=ct("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vr=ct("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const MO=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $O=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bs=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const BO=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hy=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const KJ=ct("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pn=ct("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bh=ct("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eC=ct("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tu=ct("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const YJ=ct("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const n2=ct("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Di=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wr=ct("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ma=ct("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d0=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wve=ct("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fs=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const uR=ct("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jve=ct("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _ve=ct("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bc=ct("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gr=ct("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nve=ct("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["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:"m8 17 4-4 4 4",key:"1quai1"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tC=ct("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const XJ=ct("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Sve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qv=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Cve=ct("Cross",[["path",{d:"M4 9a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h4a1 1 0 0 1 1 1v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a1 1 0 0 1 1-1h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-4a1 1 0 0 1-1-1V4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4a1 1 0 0 1-1 1z",key:"1xbrqy"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pv=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const SN=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ho=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gy=ct("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vs=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dR=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const is=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qm=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zO=ct("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lj=ct("FileSpreadsheet",[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gt=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fR=ct("File",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hR=ct("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Eve=ct("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ave=ct("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ZJ=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Tve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ky=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ii=ct("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pve=ct("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mR=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pR=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ove=ct("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ey=ct("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dve=ct("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ive=ct("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rve=ct("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gR=ct("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const JS=ct("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mu=ct("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lve=ct("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const at=ct("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const TB=ct("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const PB=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fn=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gs=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $ve=ct("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zo=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zve=ct("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gb=ct("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.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uve=ct("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const OB=ct("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rC=ct("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yy=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ya=ct("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xR=ct("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yo=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _3=ct("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const JJ=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hve=ct("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const UO=ct("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pa=ct("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ta=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gve=ct("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vc=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vl=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kve=ct("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yve=ct("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uo=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const QJ=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iu=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fj=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bi=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kd=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yd=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xve=ct("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nc=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const s2=ct("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const DB=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const IB=ct("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qo=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sr=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const a2=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zve=ct("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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ri=ct("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nC=ct("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"}]]),vR="-",Jve=e=>{const t=eye(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(vR);return l[0]===""&&l.length!==1&&l.shift(),eQ(l,t)||Qve(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},eQ=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?eQ(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(vR);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},RB=/^\[(.+)\]$/,Qve=e=>{if(RB.test(e)){const t=RB.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},eye=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return rye(Object.entries(e.classGroups),r).forEach(([i,o])=>{qO(o,n,i,t)}),n},qO=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:LB(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(tye(a)){qO(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{qO(o,LB(t,i),r,n)})})},LB=(e,t)=>{let r=e;return t.split(vR).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},tye=e=>e.isThemeGetter,rye=(e,t)=>t?e.map(([r,n])=>{const a=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[r,a]}):e,nye=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},tQ="!",sye=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,a=t[0],i=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let x=0;x<l.length;x++){let v=l[x];if(u===0){if(v===a&&(n||l.slice(x,x+i)===t)){c.push(l.slice(d,x)),d=x+i;continue}if(v==="/"){f=x;continue}}v==="["?u++:v==="]"&&u--}const m=c.length===0?l:l.substring(d),h=m.startsWith(tQ),g=h?m.substring(1):m,p=f&&f>d?f-d:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:p}};return r?l=>r({className:l,parseClassName:o}):o},aye=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},iye=e=>({cache:nye(e.cacheSize),parseClassName:sye(e),...Jve(e)}),oye=/\s+/,lye=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(oye);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:h}=r(u);let g=!!h,p=n(g?m.substring(0,h):m);if(!p){if(!g){l=u+(l.length>0?" "+l:l);continue}if(p=n(m),!p){l=u+(l.length>0?" "+l:l);continue}g=!1}const x=aye(d).join(":"),v=f?x+tQ:x,b=v+p;if(i.includes(b))continue;i.push(b);const y=a(p,g);for(let N=0;N<y.length;++N){const _=y[N];i.push(v+_)}l=u+(l.length>0?" "+l:l)}return l};function cye(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=rQ(t))&&(n&&(n+=" "),n+=r);return n}const rQ=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=rQ(e[n]))&&(r&&(r+=" "),r+=t);return r};function uye(e,...t){let r,n,a,i=o;function o(c){const u=t.reduce((d,f)=>f(d),e());return r=iye(u),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=lye(c,r);return a(c,d),d}return function(){return i(cye.apply(null,arguments))}}const Os=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},nQ=/^\[(?:([a-z-]+):)?(.+)\]$/i,dye=/^\d+\/\d+$/,fye=new Set(["px","full","screen"]),hye=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mye=/\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$/,pye=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,gye=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xye=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ef=e=>gv(e)||fye.has(e)||dye.test(e),Hh=e=>Xy(e,"length",Sye),gv=e=>!!e&&!Number.isNaN(Number(e)),N3=e=>Xy(e,"number",gv),xb=e=>!!e&&Number.isInteger(Number(e)),vye=e=>e.endsWith("%")&&gv(e.slice(0,-1)),ln=e=>nQ.test(e),Gh=e=>hye.test(e),yye=new Set(["length","size","percentage"]),bye=e=>Xy(e,yye,sQ),wye=e=>Xy(e,"position",sQ),jye=new Set(["image","url"]),_ye=e=>Xy(e,jye,Cye),Nye=e=>Xy(e,"",kye),vb=()=>!0,Xy=(e,t,r)=>{const n=nQ.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},Sye=e=>mye.test(e)&&!pye.test(e),sQ=()=>!1,kye=e=>gye.test(e),Cye=e=>xye.test(e),Eye=()=>{const e=Os("colors"),t=Os("spacing"),r=Os("blur"),n=Os("brightness"),a=Os("borderColor"),i=Os("borderRadius"),o=Os("borderSpacing"),l=Os("borderWidth"),c=Os("contrast"),u=Os("grayscale"),d=Os("hueRotate"),f=Os("invert"),m=Os("gap"),h=Os("gradientColorStops"),g=Os("gradientColorStopPositions"),p=Os("inset"),x=Os("margin"),v=Os("opacity"),b=Os("padding"),y=Os("saturate"),N=Os("scale"),_=Os("sepia"),j=Os("skew"),S=Os("space"),I=Os("translate"),P=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",ln,t],k=()=>[ln,t],V=()=>["",Ef,Hh],C=()=>["auto",gv,ln],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",ln],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],K=()=>[gv,ln];return{cacheSize:500,separator:":",theme:{colors:[vb],spacing:[Ef,Hh],blur:["none","",Gh,ln],brightness:K(),borderColor:[e],borderRadius:["none","","full",Gh,ln],borderSpacing:k(),borderWidth:V(),contrast:K(),grayscale:M(),hueRotate:K(),invert:M(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[vye,Hh],inset:T(),margin:T(),opacity:K(),padding:k(),saturate:K(),scale:K(),sepia:M(),skew:K(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",ln]}],container:["container"],columns:[{columns:[Gh]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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:[...R(),ln]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],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",xb,ln]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ln]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",xb,ln]}],"grid-cols":[{"grid-cols":[vb]}],"col-start-end":[{col:["auto",{span:["full",xb,ln]},ln]}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":[vb]}],"row-start-end":[{row:["auto",{span:[xb,ln]},ln]}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ln]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ln]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ln,t]}],"min-w":[{"min-w":[ln,t,"min","max","fit"]}],"max-w":[{"max-w":[ln,t,"none","full","min","max","fit","prose",{screen:[Gh]},Gh]}],h:[{h:[ln,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ln,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ln,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ln,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Gh,Hh]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",N3]}],"font-family":[{font:[vb]}],"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",ln]}],"line-clamp":[{"line-clamp":["none",gv,N3]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ef,ln]}],"list-image":[{"list-image":["none",ln]}],"list-style-type":[{list:["none","disc","decimal",ln]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ef,Hh]}],"underline-offset":[{"underline-offset":["auto",Ef,ln]}],"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:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ln]}],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",ln]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),wye]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",bye]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},_ye]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],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":[v]}],"border-style":[{border:[...H(),"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":[v]}],"divide-style":[{divide:H()}],"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:["",...H()]}],"outline-offset":[{"outline-offset":[Ef,ln]}],"outline-w":[{outline:[Ef,Hh]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[Ef,Hh]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Gh,Nye]}],"shadow-color":[{shadow:[vb]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Gh,ln]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[y]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"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",ln]}],duration:[{duration:K()}],ease:[{ease:["linear","in","out","in-out",ln]}],delay:[{delay:K()}],animate:[{animate:["none","spin","ping","pulse","bounce",ln]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[xb,ln]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ln]}],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",ln]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",ln]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ef,Hh,N3]}],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"]}}},Aye=uye(Eye);function pt(...e){return Aye(en(e))}const Tye=fve,aQ=w.forwardRef(({className:e,...t},r)=>s.jsx(BJ,{ref:r,className:pt("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}));aQ.displayName=BJ.displayName;const Pye=Wy("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"}}),iQ=w.forwardRef(({className:e,variant:t,...r},n)=>s.jsx(zJ,{ref:n,className:pt(Pye({variant:t}),e),...r}));iQ.displayName=zJ.displayName;const Oye=w.forwardRef(({className:e,...t},r)=>s.jsx(VJ,{ref:r,className:pt("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 group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));Oye.displayName=VJ.displayName;const oQ=w.forwardRef(({className:e,...t},r)=>s.jsx(WJ,{ref:r,className:pt("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:s.jsx(Ri,{className:"h-4 w-4"})}));oQ.displayName=WJ.displayName;const lQ=w.forwardRef(({className:e,...t},r)=>s.jsx(UJ,{ref:r,className:pt("text-sm font-semibold",e),...t}));lQ.displayName=UJ.displayName;const cQ=w.forwardRef(({className:e,...t},r)=>s.jsx(qJ,{ref:r,className:pt("text-sm opacity-90",e),...t}));cQ.displayName=qJ.displayName;function Dye(){const{toasts:e}=yJ();return s.jsxs(Tye,{children:[e.map(function({id:t,title:r,description:n,action:a,...i}){return s.jsxs(iQ,{...i,children:[s.jsxs("div",{className:"grid gap-1",children:[r&&s.jsx(lQ,{children:r}),n&&s.jsx(cQ,{children:n})]}),a,s.jsx(oQ,{})]},t)}),s.jsx(aQ,{})]})}var FB=["light","dark"],Iye="(prefers-color-scheme: dark)",Rye=w.createContext(void 0),Lye={setTheme:e=>{},themes:[]},Fye=()=>{var e;return(e=w.useContext(Rye))!=null?e:Lye};w.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:a,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let u=i==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,f=a?FB.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(g,p=!1,x=!0)=>{let v=o?o[g]:g,b=p?g+"|| ''":`'${v}'`,y="";return a&&x&&!p&&FB.includes(g)&&(y+=`d.style.colorScheme = '${g}';`),r==="class"?p||v?y+=`c.add(${b})`:y+="null":v&&(y+=`d[s](n,${b})`),y},h=e?`!function(){${d}${m(e)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${Iye}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${m(o?"x[e]":"e",!0)}}${u?"":"else{"+m(i,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${m(o?"x[e]":"e",!0)}}else{${m(i,!1,!1)};}${f}}catch(t){}}();`;return w.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:h}})});var Mye=e=>{switch(e){case"success":return zye;case"info":return qye;case"warning":return Uye;case"error":return Vye;default:return null}},$ye=Array(12).fill(0),Bye=({visible:e,className:t})=>be.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},be.createElement("div",{className:"sonner-spinner"},$ye.map((r,n)=>be.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),zye=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.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"})),Uye=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},be.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"})),qye=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.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"})),Vye=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.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"})),Wye=be.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"},be.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),be.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Hye=()=>{let[e,t]=be.useState(document.hidden);return be.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},VO=1,Gye=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;let{message:n,...a}=t,i=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:VO++,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:n}),{...c,...t,id:i,dismissible:l,title:n}):c):this.addToast({title:n,...a,dismissible:l,id:i}),i},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),this.subscribers.forEach(r=>r({id:t,dismiss:!0})),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));let a=t instanceof Promise?t:t(),i=n!==void 0,o,l=a.then(async u=>{if(o=["resolve",u],be.isValidElement(u))i=!1,this.create({id:n,type:"default",message:u});else if(Yye(u)&&!u.ok){i=!1;let d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,f=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description;this.create({id:n,type:"error",message:d,description:f})}else if(r.success!==void 0){i=!1;let d=typeof r.success=="function"?await r.success(u):r.success,f=typeof r.description=="function"?await r.description(u):r.description;this.create({id:n,type:"success",message:d,description:f})}}).catch(async u=>{if(o=["reject",u],r.error!==void 0){i=!1;let d=typeof r.error=="function"?await r.error(u):r.error,f=typeof r.description=="function"?await r.description(u):r.description;this.create({id:n,type:"error",message:d,description:f})}}).finally(()=>{var u;i&&(this.dismiss(n),n=void 0),(u=r.finally)==null||u.call(r)}),c=()=>new Promise((u,d)=>l.then(()=>o[0]==="reject"?d(o[1]):u(o[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(t,r)=>{let n=(r==null?void 0:r.id)||VO++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},sl=new Gye,Kye=(e,t)=>{let r=(t==null?void 0:t.id)||VO++;return sl.addToast({title:e,...t,id:r}),r},Yye=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Xye=Kye,Zye=()=>sl.toasts,Jye=()=>sl.getActiveToasts(),ae=Object.assign(Xye,{success:sl.success,info:sl.info,warning:sl.warning,error:sl.error,custom:sl.custom,message:sl.message,promise:sl.promise,dismiss:sl.dismiss,loading:sl.loading},{getHistory:Zye,getToasts:Jye});function Qye(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Qye(`: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;left: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}: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%);--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%)}
`);function kN(e){return e.label!==void 0}var e1e=3,t1e="32px",r1e="16px",MB=4e3,n1e=356,s1e=14,a1e=20,i1e=200;function bu(...e){return e.filter(Boolean).join(" ")}function o1e(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var l1e=e=>{var t,r,n,a,i,o,l,c,u,d,f;let{invert:m,toast:h,unstyled:g,interacting:p,setHeights:x,visibleToasts:v,heights:b,index:y,toasts:N,expanded:_,removeToast:j,defaultRichColors:S,closeButton:I,style:P,cancelButtonStyle:F,actionButtonStyle:T,className:k="",descriptionClassName:V="",duration:C,position:R,gap:H,loadingIcon:q,expandByDefault:L,classNames:M,icons:z,closeButtonAriaLabel:K="Close toast",pauseWhenPageIsHidden:E}=e,[A,O]=be.useState(null),[U,Y]=be.useState(null),[J,se]=be.useState(!1),[ee,ie]=be.useState(!1),[Ee,te]=be.useState(!1),[Ue,W]=be.useState(!1),[Z,le]=be.useState(!1),[re,oe]=be.useState(0),[fe,Fe]=be.useState(0),ge=be.useRef(h.duration||C||MB),pe=be.useRef(null),Ie=be.useRef(null),Ge=y===0,we=y+1<=v,_e=h.type,qe=h.dismissible!==!1,Re=h.className||"",Me=h.descriptionClassName||"",He=be.useMemo(()=>b.findIndex(Kt=>Kt.toastId===h.id)||0,[b,h.id]),st=be.useMemo(()=>{var Kt;return(Kt=h.closeButton)!=null?Kt:I},[h.closeButton,I]),Zt=be.useMemo(()=>h.duration||C||MB,[h.duration,C]),_t=be.useRef(0),Vt=be.useRef(0),Jt=be.useRef(0),Qt=be.useRef(null),[qt,it]=R.split("-"),It=be.useMemo(()=>b.reduce((Kt,ir,jr)=>jr>=He?Kt:Kt+ir.height,0),[b,He]),Mt=Hye(),wr=h.invert||m,$t=_e==="loading";Vt.current=be.useMemo(()=>He*H+It,[He,It]),be.useEffect(()=>{ge.current=Zt},[Zt]),be.useEffect(()=>{se(!0)},[]),be.useEffect(()=>{let Kt=Ie.current;if(Kt){let ir=Kt.getBoundingClientRect().height;return Fe(ir),x(jr=>[{toastId:h.id,height:ir,position:h.position},...jr]),()=>x(jr=>jr.filter(mn=>mn.toastId!==h.id))}},[x,h.id]),be.useLayoutEffect(()=>{if(!J)return;let Kt=Ie.current,ir=Kt.style.height;Kt.style.height="auto";let jr=Kt.getBoundingClientRect().height;Kt.style.height=ir,Fe(jr),x(mn=>mn.find(Ht=>Ht.toastId===h.id)?mn.map(Ht=>Ht.toastId===h.id?{...Ht,height:jr}:Ht):[{toastId:h.id,height:jr,position:h.position},...mn])},[J,h.title,h.description,x,h.id]);let kt=be.useCallback(()=>{ie(!0),oe(Vt.current),x(Kt=>Kt.filter(ir=>ir.toastId!==h.id)),setTimeout(()=>{j(h)},i1e)},[h,j,x,Vt]);be.useEffect(()=>{if(h.promise&&_e==="loading"||h.duration===1/0||h.type==="loading")return;let Kt;return _||p||E&&Mt?(()=>{if(Jt.current<_t.current){let ir=new Date().getTime()-_t.current;ge.current=ge.current-ir}Jt.current=new Date().getTime()})():ge.current!==1/0&&(_t.current=new Date().getTime(),Kt=setTimeout(()=>{var ir;(ir=h.onAutoClose)==null||ir.call(h,h),kt()},ge.current)),()=>clearTimeout(Kt)},[_,p,h,_e,E,Mt,kt]),be.useEffect(()=>{h.delete&&kt()},[kt,h.delete]);function dr(){var Kt,ir,jr;return z!=null&&z.loading?be.createElement("div",{className:bu(M==null?void 0:M.loader,(Kt=h==null?void 0:h.classNames)==null?void 0:Kt.loader,"sonner-loader"),"data-visible":_e==="loading"},z.loading):q?be.createElement("div",{className:bu(M==null?void 0:M.loader,(ir=h==null?void 0:h.classNames)==null?void 0:ir.loader,"sonner-loader"),"data-visible":_e==="loading"},q):be.createElement(Bye,{className:bu(M==null?void 0:M.loader,(jr=h==null?void 0:h.classNames)==null?void 0:jr.loader),visible:_e==="loading"})}return be.createElement("li",{tabIndex:0,ref:Ie,className:bu(k,Re,M==null?void 0:M.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,M==null?void 0:M.default,M==null?void 0:M[_e],(r=h==null?void 0:h.classNames)==null?void 0:r[_e]),"data-sonner-toast":"","data-rich-colors":(n=h.richColors)!=null?n:S,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":J,"data-promise":!!h.promise,"data-swiped":Z,"data-removed":ee,"data-visible":we,"data-y-position":qt,"data-x-position":it,"data-index":y,"data-front":Ge,"data-swiping":Ee,"data-dismissible":qe,"data-type":_e,"data-invert":wr,"data-swipe-out":Ue,"data-swipe-direction":U,"data-expanded":!!(_||L&&J),style:{"--index":y,"--toasts-before":y,"--z-index":N.length-y,"--offset":`${ee?re:Vt.current}px`,"--initial-height":L?"auto":`${fe}px`,...P,...h.style},onDragEnd:()=>{te(!1),O(null),Qt.current=null},onPointerDown:Kt=>{$t||!qe||(pe.current=new Date,oe(Vt.current),Kt.target.setPointerCapture(Kt.pointerId),Kt.target.tagName!=="BUTTON"&&(te(!0),Qt.current={x:Kt.clientX,y:Kt.clientY}))},onPointerUp:()=>{var Kt,ir,jr,mn;if(Ue||!qe)return;Qt.current=null;let Ht=Number(((Kt=Ie.current)==null?void 0:Kt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),sn=Number(((ir=Ie.current)==null?void 0:ir.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Bn=new Date().getTime()-((jr=pe.current)==null?void 0:jr.getTime()),tn=A==="x"?Ht:sn,vn=Math.abs(tn)/Bn;if(Math.abs(tn)>=a1e||vn>.11){oe(Vt.current),(mn=h.onDismiss)==null||mn.call(h,h),Y(A==="x"?Ht>0?"right":"left":sn>0?"down":"up"),kt(),W(!0),le(!1);return}te(!1),O(null)},onPointerMove:Kt=>{var ir,jr,mn,Ht;if(!Qt.current||!qe||((ir=window.getSelection())==null?void 0:ir.toString().length)>0)return;let sn=Kt.clientY-Qt.current.y,Bn=Kt.clientX-Qt.current.x,tn=(jr=e.swipeDirections)!=null?jr:o1e(R);!A&&(Math.abs(Bn)>1||Math.abs(sn)>1)&&O(Math.abs(Bn)>Math.abs(sn)?"x":"y");let vn={x:0,y:0};A==="y"?(tn.includes("top")||tn.includes("bottom"))&&(tn.includes("top")&&sn<0||tn.includes("bottom")&&sn>0)&&(vn.y=sn):A==="x"&&(tn.includes("left")||tn.includes("right"))&&(tn.includes("left")&&Bn<0||tn.includes("right")&&Bn>0)&&(vn.x=Bn),(Math.abs(vn.x)>0||Math.abs(vn.y)>0)&&le(!0),(mn=Ie.current)==null||mn.style.setProperty("--swipe-amount-x",`${vn.x}px`),(Ht=Ie.current)==null||Ht.style.setProperty("--swipe-amount-y",`${vn.y}px`)}},st&&!h.jsx?be.createElement("button",{"aria-label":K,"data-disabled":$t,"data-close-button":!0,onClick:$t||!qe?()=>{}:()=>{var Kt;kt(),(Kt=h.onDismiss)==null||Kt.call(h,h)},className:bu(M==null?void 0:M.closeButton,(a=h==null?void 0:h.classNames)==null?void 0:a.closeButton)},(i=z==null?void 0:z.close)!=null?i:Wye):null,h.jsx||w.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:be.createElement(be.Fragment,null,_e||h.icon||h.promise?be.createElement("div",{"data-icon":"",className:bu(M==null?void 0:M.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||dr():null,h.type!=="loading"?h.icon||(z==null?void 0:z[_e])||Mye(_e):null):null,be.createElement("div",{"data-content":"",className:bu(M==null?void 0:M.content,(l=h==null?void 0:h.classNames)==null?void 0:l.content)},be.createElement("div",{"data-title":"",className:bu(M==null?void 0:M.title,(c=h==null?void 0:h.classNames)==null?void 0:c.title)},typeof h.title=="function"?h.title():h.title),h.description?be.createElement("div",{"data-description":"",className:bu(V,Me,M==null?void 0:M.description,(u=h==null?void 0:h.classNames)==null?void 0:u.description)},typeof h.description=="function"?h.description():h.description):null),w.isValidElement(h.cancel)?h.cancel:h.cancel&&kN(h.cancel)?be.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||F,onClick:Kt=>{var ir,jr;kN(h.cancel)&&qe&&((jr=(ir=h.cancel).onClick)==null||jr.call(ir,Kt),kt())},className:bu(M==null?void 0:M.cancelButton,(d=h==null?void 0:h.classNames)==null?void 0:d.cancelButton)},h.cancel.label):null,w.isValidElement(h.action)?h.action:h.action&&kN(h.action)?be.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||T,onClick:Kt=>{var ir,jr;kN(h.action)&&((jr=(ir=h.action).onClick)==null||jr.call(ir,Kt),!Kt.defaultPrevented&&kt())},className:bu(M==null?void 0:M.actionButton,(f=h==null?void 0:h.classNames)==null?void 0:f.actionButton)},h.action.label):null))};function $B(){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 c1e(e,t){let r={};return[e,t].forEach((n,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",l=i?r1e:t1e;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${o}-${u}`]=l:r[`${o}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}var u1e=w.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:f,duration:m,style:h,visibleToasts:g=e1e,toastOptions:p,dir:x=$B(),gap:v=s1e,loadingIcon:b,icons:y,containerAriaLabel:N="Notifications",pauseWhenPageIsHidden:_}=e,[j,S]=be.useState([]),I=be.useMemo(()=>Array.from(new Set([n].concat(j.filter(E=>E.position).map(E=>E.position)))),[j,n]),[P,F]=be.useState([]),[T,k]=be.useState(!1),[V,C]=be.useState(!1),[R,H]=be.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=be.useRef(null),L=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=be.useRef(null),z=be.useRef(!1),K=be.useCallback(E=>{S(A=>{var O;return(O=A.find(U=>U.id===E.id))!=null&&O.delete||sl.dismiss(E.id),A.filter(({id:U})=>U!==E.id)})},[]);return be.useEffect(()=>sl.subscribe(E=>{if(E.dismiss){S(A=>A.map(O=>O.id===E.id?{...O,delete:!0}:O));return}setTimeout(()=>{xJ.flushSync(()=>{S(A=>{let O=A.findIndex(U=>U.id===E.id);return O!==-1?[...A.slice(0,O),{...A[O],...E},...A.slice(O+1)]:[E,...A]})})})}),[]),be.useEffect(()=>{if(d!=="system"){H(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window>"u")return;let E=window.matchMedia("(prefers-color-scheme: dark)");try{E.addEventListener("change",({matches:A})=>{H(A?"dark":"light")})}catch{E.addListener(({matches:O})=>{try{H(O?"dark":"light")}catch(U){console.error(U)}})}},[d]),be.useEffect(()=>{j.length<=1&&k(!1)},[j]),be.useEffect(()=>{let E=A=>{var O,U;a.every(Y=>A[Y]||A.code===Y)&&(k(!0),(O=q.current)==null||O.focus()),A.code==="Escape"&&(document.activeElement===q.current||(U=q.current)!=null&&U.contains(document.activeElement))&&k(!1)};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[a]),be.useEffect(()=>{if(q.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,z.current=!1)}},[q.current]),be.createElement("section",{ref:t,"aria-label":`${N} ${L}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((E,A)=>{var O;let[U,Y]=E.split("-");return j.length?be.createElement("ol",{key:E,dir:x==="auto"?$B():x,tabIndex:-1,ref:q,className:l,"data-sonner-toaster":!0,"data-theme":R,"data-y-position":U,"data-lifted":T&&j.length>1&&!i,"data-x-position":Y,style:{"--front-toast-height":`${((O=P[0])==null?void 0:O.height)||0}px`,"--width":`${n1e}px`,"--gap":`${v}px`,...h,...c1e(c,u)},onBlur:J=>{z.current&&!J.currentTarget.contains(J.relatedTarget)&&(z.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||z.current||(z.current=!0,M.current=J.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{V||k(!1)},onDragEnd:()=>k(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||C(!0)},onPointerUp:()=>C(!1)},j.filter(J=>!J.position&&A===0||J.position===E).map((J,se)=>{var ee,ie;return be.createElement(l1e,{key:J.id,icons:y,index:se,toast:J,defaultRichColors:f,duration:(ee=p==null?void 0:p.duration)!=null?ee:m,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:r,visibleToasts:g,closeButton:(ie=p==null?void 0:p.closeButton)!=null?ie:o,interacting:V,position:E,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:K,toasts:j.filter(Ee=>Ee.position==J.position),heights:P.filter(Ee=>Ee.position==J.position),setHeights:F,expandByDefault:i,gap:v,loadingIcon:b,expanded:T,pauseWhenPageIsHidden:_,swipeDirections:e.swipeDirections})})):null}))});const d1e=({...e})=>{const{theme:t="system"}=Fye();return s.jsx(u1e,{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 f1e=pI[" useId ".trim().toString()]||(()=>{}),h1e=0;function Ga(e){const[t,r]=w.useState(f1e());return ba(()=>{r(n=>n??String(h1e++))},[e]),t?`radix-${t}`:""}const m1e=["top","right","bottom","left"],ep=Math.min,$l=Math.max,M5=Math.round,CN=Math.floor,Ud=e=>({x:e,y:e}),p1e={left:"right",right:"left",bottom:"top",top:"bottom"},g1e={start:"end",end:"start"};function WO(e,t,r){return $l(e,ep(t,r))}function uh(e,t){return typeof e=="function"?e(t):e}function dh(e){return e.split("-")[0]}function Zy(e){return e.split("-")[1]}function yR(e){return e==="x"?"y":"x"}function bR(e){return e==="y"?"height":"width"}const x1e=new Set(["top","bottom"]);function Id(e){return x1e.has(dh(e))?"y":"x"}function wR(e){return yR(Id(e))}function v1e(e,t,r){r===void 0&&(r=!1);const n=Zy(e),a=wR(e),i=bR(a);let o=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=$5(o)),[o,$5(o)]}function y1e(e){const t=$5(e);return[HO(e),t,HO(t)]}function HO(e){return e.replace(/start|end/g,t=>g1e[t])}const BB=["left","right"],zB=["right","left"],b1e=["top","bottom"],w1e=["bottom","top"];function j1e(e,t,r){switch(e){case"top":case"bottom":return r?t?zB:BB:t?BB:zB;case"left":case"right":return t?b1e:w1e;default:return[]}}function _1e(e,t,r,n){const a=Zy(e);let i=j1e(dh(e),r==="start",n);return a&&(i=i.map(o=>o+"-"+a),t&&(i=i.concat(i.map(HO)))),i}function $5(e){return e.replace(/left|right|bottom|top/g,t=>p1e[t])}function N1e(e){return{top:0,right:0,bottom:0,left:0,...e}}function uQ(e){return typeof e!="number"?N1e(e):{top:e,right:e,bottom:e,left:e}}function B5(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function UB(e,t,r){let{reference:n,floating:a}=e;const i=Id(t),o=wR(t),l=bR(o),c=dh(t),u=i==="y",d=n.x+n.width/2-a.width/2,f=n.y+n.height/2-a.height/2,m=n[l]/2-a[l]/2;let h;switch(c){case"top":h={x:d,y:n.y-a.height};break;case"bottom":h={x:d,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:f};break;case"left":h={x:n.x-a.width,y:f};break;default:h={x:n.x,y:n.y}}switch(Zy(t)){case"start":h[o]-=m*(r&&u?-1:1);break;case"end":h[o]+=m*(r&&u?-1:1);break}return h}const S1e=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:i=[],platform:o}=r,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:f}=UB(u,n,c),m=n,h={},g=0;for(let p=0;p<l.length;p++){const{name:x,fn:v}=l[p],{x:b,y,data:N,reset:_}=await v({x:d,y:f,initialPlacement:n,placement:m,strategy:a,middlewareData:h,rects:u,platform:o,elements:{reference:e,floating:t}});d=b??d,f=y??f,h={...h,[x]:{...h[x],...N}},_&&g<=50&&(g++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(u=_.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:a}):_.rects),{x:d,y:f}=UB(u,m,c)),p=-1)}return{x:d,y:f,placement:m,strategy:a,middlewareData:h}};async function i2(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:i,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:h=0}=uh(t,e),g=uQ(h),x=l[m?f==="floating"?"reference":"floating":f],v=B5(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(x)))==null||r?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),b=f==="floating"?{x:n,y:a,width:o.floating.width,height:o.floating.height}:o.reference,y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),N=await(i.isElement==null?void 0:i.isElement(y))?await(i.getScale==null?void 0:i.getScale(y))||{x:1,y:1}:{x:1,y:1},_=B5(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:c}):b);return{top:(v.top-_.top+g.top)/N.y,bottom:(_.bottom-v.bottom+g.bottom)/N.y,left:(v.left-_.left+g.left)/N.x,right:(_.right-v.right+g.right)/N.x}}const k1e=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=uh(e,t)||{};if(u==null)return{};const f=uQ(d),m={x:r,y:n},h=wR(a),g=bR(h),p=await o.getDimensions(u),x=h==="y",v=x?"top":"left",b=x?"bottom":"right",y=x?"clientHeight":"clientWidth",N=i.reference[g]+i.reference[h]-m[h]-i.floating[g],_=m[h]-i.reference[h],j=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let S=j?j[y]:0;(!S||!await(o.isElement==null?void 0:o.isElement(j)))&&(S=l.floating[y]||i.floating[g]);const I=N/2-_/2,P=S/2-p[g]/2-1,F=ep(f[v],P),T=ep(f[b],P),k=F,V=S-p[g]-T,C=S/2-p[g]/2+I,R=WO(k,C,V),H=!c.arrow&&Zy(a)!=null&&C!==R&&i.reference[g]/2-(C<k?F:T)-p[g]/2<0,q=H?C<k?C-k:C-V:0;return{[h]:m[h]+q,data:{[h]:R,centerOffset:C-R-q,...H&&{alignmentOffset:q}},reset:H}}}),C1e=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...x}=uh(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const v=dh(a),b=Id(l),y=dh(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=m||(y||!p?[$5(l)]:y1e(l)),j=g!=="none";!m&&j&&_.push(..._1e(l,p,g,N));const S=[l,..._],I=await i2(t,x),P=[];let F=((n=i.flip)==null?void 0:n.overflows)||[];if(d&&P.push(I[v]),f){const C=v1e(a,o,N);P.push(I[C[0]],I[C[1]])}if(F=[...F,{placement:a,overflows:P}],!P.every(C=>C<=0)){var T,k;const C=(((T=i.flip)==null?void 0:T.index)||0)+1,R=S[C];if(R&&(!(f==="alignment"?b!==Id(R):!1)||F.every(L=>L.overflows[0]>0&&Id(L.placement)===b)))return{data:{index:C,overflows:F},reset:{placement:R}};let H=(k=F.filter(q=>q.overflows[0]<=0).sort((q,L)=>q.overflows[1]-L.overflows[1])[0])==null?void 0:k.placement;if(!H)switch(h){case"bestFit":{var V;const q=(V=F.filter(L=>{if(j){const M=Id(L.placement);return M===b||M==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(M=>M>0).reduce((M,z)=>M+z,0)]).sort((L,M)=>L[1]-M[1])[0])==null?void 0:V[0];q&&(H=q);break}case"initialPlacement":H=l;break}if(a!==H)return{reset:{placement:H}}}return{}}}};function qB(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function VB(e){return m1e.some(t=>e[t]>=0)}const E1e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...a}=uh(e,t);switch(n){case"referenceHidden":{const i=await i2(t,{...a,elementContext:"reference"}),o=qB(i,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:VB(o)}}}case"escaped":{const i=await i2(t,{...a,altBoundary:!0}),o=qB(i,r.floating);return{data:{escapedOffsets:o,escaped:VB(o)}}}default:return{}}}}},dQ=new Set(["left","top"]);async function A1e(e,t){const{placement:r,platform:n,elements:a}=e,i=await(n.isRTL==null?void 0:n.isRTL(a.floating)),o=dh(r),l=Zy(r),c=Id(r)==="y",u=dQ.has(o)?-1:1,d=i&&c?-1:1,f=uh(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*d,y:m*u}:{x:m*u,y:h*d}}const T1e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:i,placement:o,middlewareData:l}=t,c=await A1e(t,e);return o===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:a+c.x,y:i+c.y,data:{...c,placement:o}}}}},P1e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:v,y:b}=x;return{x:v,y:b}}},...c}=uh(e,t),u={x:r,y:n},d=await i2(t,c),f=Id(dh(a)),m=yR(f);let h=u[m],g=u[f];if(i){const x=m==="y"?"top":"left",v=m==="y"?"bottom":"right",b=h+d[x],y=h-d[v];h=WO(b,h,y)}if(o){const x=f==="y"?"top":"left",v=f==="y"?"bottom":"right",b=g+d[x],y=g-d[v];g=WO(b,g,y)}const p=l.fn({...t,[m]:h,[f]:g});return{...p,data:{x:p.x-r,y:p.y-n,enabled:{[m]:i,[f]:o}}}}}},O1e=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=uh(e,t),d={x:r,y:n},f=Id(a),m=yR(f);let h=d[m],g=d[f];const p=uh(l,t),x=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const y=m==="y"?"height":"width",N=i.reference[m]-i.floating[y]+x.mainAxis,_=i.reference[m]+i.reference[y]-x.mainAxis;h<N?h=N:h>_&&(h=_)}if(u){var v,b;const y=m==="y"?"width":"height",N=dQ.has(dh(a)),_=i.reference[f]-i.floating[y]+(N&&((v=o.offset)==null?void 0:v[f])||0)+(N?0:x.crossAxis),j=i.reference[f]+i.reference[y]+(N?0:((b=o.offset)==null?void 0:b[f])||0)-(N?x.crossAxis:0);g<_?g=_:g>j&&(g=j)}return{[m]:h,[f]:g}}}},D1e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...u}=uh(e,t),d=await i2(t,u),f=dh(a),m=Zy(a),h=Id(a)==="y",{width:g,height:p}=i.floating;let x,v;f==="top"||f==="bottom"?(x=f,v=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,x=m==="end"?"top":"bottom");const b=p-d.top-d.bottom,y=g-d.left-d.right,N=ep(p-d[x],b),_=ep(g-d[v],y),j=!t.middlewareData.shift;let S=N,I=_;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(I=y),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(S=b),j&&!m){const F=$l(d.left,0),T=$l(d.right,0),k=$l(d.top,0),V=$l(d.bottom,0);h?I=g-2*(F!==0||T!==0?F+T:$l(d.left,d.right)):S=p-2*(k!==0||V!==0?k+V:$l(d.top,d.bottom))}await c({...t,availableWidth:I,availableHeight:S});const P=await o.getDimensions(l.floating);return g!==P.width||p!==P.height?{reset:{rects:!0}}:{}}}};function sC(){return typeof window<"u"}function Jy(e){return fQ(e)?(e.nodeName||"").toLowerCase():"#document"}function Zl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rf(e){var t;return(t=(fQ(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fQ(e){return sC()?e instanceof Node||e instanceof Zl(e).Node:!1}function Xu(e){return sC()?e instanceof Element||e instanceof Zl(e).Element:!1}function Xd(e){return sC()?e instanceof HTMLElement||e instanceof Zl(e).HTMLElement:!1}function WB(e){return!sC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Zl(e).ShadowRoot}const I1e=new Set(["inline","contents"]);function Mj(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Zu(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!I1e.has(a)}const R1e=new Set(["table","td","th"]);function L1e(e){return R1e.has(Jy(e))}const F1e=[":popover-open",":modal"];function aC(e){return F1e.some(t=>{try{return e.matches(t)}catch{return!1}})}const M1e=["transform","translate","scale","rotate","perspective"],$1e=["transform","translate","scale","rotate","perspective","filter"],B1e=["paint","layout","strict","content"];function jR(e){const t=_R(),r=Xu(e)?Zu(e):e;return M1e.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||$1e.some(n=>(r.willChange||"").includes(n))||B1e.some(n=>(r.contain||"").includes(n))}function z1e(e){let t=tp(e);for(;Xd(t)&&!ty(t);){if(jR(t))return t;if(aC(t))return null;t=tp(t)}return null}function _R(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const U1e=new Set(["html","body","#document"]);function ty(e){return U1e.has(Jy(e))}function Zu(e){return Zl(e).getComputedStyle(e)}function iC(e){return Xu(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tp(e){if(Jy(e)==="html")return e;const t=e.assignedSlot||e.parentNode||WB(e)&&e.host||rf(e);return WB(t)?t.host:t}function hQ(e){const t=tp(e);return ty(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xd(t)&&Mj(t)?t:hQ(t)}function o2(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=hQ(e),i=a===((n=e.ownerDocument)==null?void 0:n.body),o=Zl(a);if(i){const l=GO(o);return t.concat(o,o.visualViewport||[],Mj(a)?a:[],l&&r?o2(l):[])}return t.concat(a,o2(a,[],r))}function GO(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mQ(e){const t=Zu(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=Xd(e),i=a?e.offsetWidth:r,o=a?e.offsetHeight:n,l=M5(r)!==i||M5(n)!==o;return l&&(r=i,n=o),{width:r,height:n,$:l}}function NR(e){return Xu(e)?e:e.contextElement}function xv(e){const t=NR(e);if(!Xd(t))return Ud(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:i}=mQ(t);let o=(i?M5(r.width):r.width)/n,l=(i?M5(r.height):r.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const q1e=Ud(0);function pQ(e){const t=Zl(e);return!_R()||!t.visualViewport?q1e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function V1e(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Zl(e)?!1:t}function ng(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),i=NR(e);let o=Ud(1);t&&(n?Xu(n)&&(o=xv(n)):o=xv(e));const l=V1e(i,r,n)?pQ(i):Ud(0);let c=(a.left+l.x)/o.x,u=(a.top+l.y)/o.y,d=a.width/o.x,f=a.height/o.y;if(i){const m=Zl(i),h=n&&Xu(n)?Zl(n):n;let g=m,p=GO(g);for(;p&&n&&h!==g;){const x=xv(p),v=p.getBoundingClientRect(),b=Zu(p),y=v.left+(p.clientLeft+parseFloat(b.paddingLeft))*x.x,N=v.top+(p.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=y,u+=N,g=Zl(p),p=GO(g)}}return B5({width:d,height:f,x:c,y:u})}function SR(e,t){const r=iC(e).scrollLeft;return t?t.left+r:ng(rf(e)).left+r}function gQ(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),a=n.left+t.scrollLeft-(r?0:SR(e,n)),i=n.top+t.scrollTop;return{x:a,y:i}}function W1e(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const i=a==="fixed",o=rf(n),l=t?aC(t.floating):!1;if(n===o||l&&i)return r;let c={scrollLeft:0,scrollTop:0},u=Ud(1);const d=Ud(0),f=Xd(n);if((f||!f&&!i)&&((Jy(n)!=="body"||Mj(o))&&(c=iC(n)),Xd(n))){const h=ng(n);u=xv(n),d.x=h.x+n.clientLeft,d.y=h.y+n.clientTop}const m=o&&!f&&!i?gQ(o,c,!0):Ud(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:r.y*u.y-c.scrollTop*u.y+d.y+m.y}}function H1e(e){return Array.from(e.getClientRects())}function G1e(e){const t=rf(e),r=iC(e),n=e.ownerDocument.body,a=$l(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=$l(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+SR(e);const l=-r.scrollTop;return Zu(n).direction==="rtl"&&(o+=$l(t.clientWidth,n.clientWidth)-a),{width:a,height:i,x:o,y:l}}function K1e(e,t){const r=Zl(e),n=rf(e),a=r.visualViewport;let i=n.clientWidth,o=n.clientHeight,l=0,c=0;if(a){i=a.width,o=a.height;const u=_R();(!u||u&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}return{width:i,height:o,x:l,y:c}}const Y1e=new Set(["absolute","fixed"]);function X1e(e,t){const r=ng(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,i=Xd(e)?xv(e):Ud(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=a*i.x,u=n*i.y;return{width:o,height:l,x:c,y:u}}function HB(e,t,r){let n;if(t==="viewport")n=K1e(e,r);else if(t==="document")n=G1e(rf(e));else if(Xu(t))n=X1e(t,r);else{const a=pQ(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return B5(n)}function xQ(e,t){const r=tp(e);return r===t||!Xu(r)||ty(r)?!1:Zu(r).position==="fixed"||xQ(r,t)}function Z1e(e,t){const r=t.get(e);if(r)return r;let n=o2(e,[],!1).filter(l=>Xu(l)&&Jy(l)!=="body"),a=null;const i=Zu(e).position==="fixed";let o=i?tp(e):e;for(;Xu(o)&&!ty(o);){const l=Zu(o),c=jR(o);!c&&l.position==="fixed"&&(a=null),(i?!c&&!a:!c&&l.position==="static"&&!!a&&Y1e.has(a.position)||Mj(o)&&!c&&xQ(e,o))?n=n.filter(d=>d!==o):a=l,o=tp(o)}return t.set(e,n),n}function J1e(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const o=[...r==="clippingAncestors"?aC(t)?[]:Z1e(t,this._c):[].concat(r),n],l=o[0],c=o.reduce((u,d)=>{const f=HB(t,d,a);return u.top=$l(f.top,u.top),u.right=ep(f.right,u.right),u.bottom=ep(f.bottom,u.bottom),u.left=$l(f.left,u.left),u},HB(t,l,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Q1e(e){const{width:t,height:r}=mQ(e);return{width:t,height:r}}function ebe(e,t,r){const n=Xd(t),a=rf(t),i=r==="fixed",o=ng(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Ud(0);function u(){c.x=SR(a)}if(n||!n&&!i)if((Jy(t)!=="body"||Mj(a))&&(l=iC(t)),n){const h=ng(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else a&&u();i&&!n&&a&&u();const d=a&&!n&&!i?gQ(a,l):Ud(0),f=o.left+l.scrollLeft-c.x-d.x,m=o.top+l.scrollTop-c.y-d.y;return{x:f,y:m,width:o.width,height:o.height}}function S3(e){return Zu(e).position==="static"}function GB(e,t){if(!Xd(e)||Zu(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return rf(e)===r&&(r=r.ownerDocument.body),r}function vQ(e,t){const r=Zl(e);if(aC(e))return r;if(!Xd(e)){let a=tp(e);for(;a&&!ty(a);){if(Xu(a)&&!S3(a))return a;a=tp(a)}return r}let n=GB(e,t);for(;n&&L1e(n)&&S3(n);)n=GB(n,t);return n&&ty(n)&&S3(n)&&!jR(n)?r:n||z1e(e)||r}const tbe=async function(e){const t=this.getOffsetParent||vQ,r=this.getDimensions,n=await r(e.floating);return{reference:ebe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function rbe(e){return Zu(e).direction==="rtl"}const nbe={convertOffsetParentRelativeRectToViewportRelativeRect:W1e,getDocumentElement:rf,getClippingRect:J1e,getOffsetParent:vQ,getElementRects:tbe,getClientRects:H1e,getDimensions:Q1e,getScale:xv,isElement:Xu,isRTL:rbe};function yQ(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sbe(e,t){let r=null,n;const a=rf(e);function i(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:d,top:f,width:m,height:h}=u;if(l||t(),!m||!h)return;const g=CN(f),p=CN(a.clientWidth-(d+m)),x=CN(a.clientHeight-(f+h)),v=CN(d),y={rootMargin:-g+"px "+-p+"px "+-x+"px "+-v+"px",threshold:$l(0,ep(1,c))||1};let N=!0;function _(j){const S=j[0].intersectionRatio;if(S!==c){if(!N)return o();S?o(!1,S):n=setTimeout(()=>{o(!1,1e-7)},1e3)}S===1&&!yQ(u,e.getBoundingClientRect())&&o(),N=!1}try{r=new IntersectionObserver(_,{...y,root:a.ownerDocument})}catch{r=new IntersectionObserver(_,y)}r.observe(e)}return o(!0),i}function abe(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=NR(e),d=a||i?[...u?o2(u):[],...o2(t)]:[];d.forEach(v=>{a&&v.addEventListener("scroll",r,{passive:!0}),i&&v.addEventListener("resize",r)});const f=u&&l?sbe(u,r):null;let m=-1,h=null;o&&(h=new ResizeObserver(v=>{let[b]=v;b&&b.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),r()}),u&&!c&&h.observe(u),h.observe(t));let g,p=c?ng(e):null;c&&x();function x(){const v=ng(e);p&&!yQ(p,v)&&r(),p=v,g=requestAnimationFrame(x)}return r(),()=>{var v;d.forEach(b=>{a&&b.removeEventListener("scroll",r),i&&b.removeEventListener("resize",r)}),f==null||f(),(v=h)==null||v.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const ibe=T1e,obe=P1e,lbe=C1e,cbe=D1e,ube=E1e,KB=k1e,dbe=O1e,fbe=(e,t,r)=>{const n=new Map,a={platform:nbe,...r},i={...a.platform,_c:n};return S1e(e,t,{...a,platform:i})};var hbe=typeof document<"u",mbe=function(){},QS=hbe?w.useLayoutEffect:mbe;function z5(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!z5(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const i=a[n];if(!(i==="_owner"&&e.$$typeof)&&!z5(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function bQ(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function YB(e,t){const r=bQ(e);return Math.round(t*r)/r}function k3(e){const t=w.useRef(e);return QS(()=>{t.current=e}),t}function pbe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=w.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=w.useState(n);z5(m,n)||h(n);const[g,p]=w.useState(null),[x,v]=w.useState(null),b=w.useCallback(L=>{L!==j.current&&(j.current=L,p(L))},[]),y=w.useCallback(L=>{L!==S.current&&(S.current=L,v(L))},[]),N=i||g,_=o||x,j=w.useRef(null),S=w.useRef(null),I=w.useRef(d),P=c!=null,F=k3(c),T=k3(a),k=k3(u),V=w.useCallback(()=>{if(!j.current||!S.current)return;const L={placement:t,strategy:r,middleware:m};T.current&&(L.platform=T.current),fbe(j.current,S.current,L).then(M=>{const z={...M,isPositioned:k.current!==!1};C.current&&!z5(I.current,z)&&(I.current=z,$c.flushSync(()=>{f(z)}))})},[m,t,r,T,k]);QS(()=>{u===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[u]);const C=w.useRef(!1);QS(()=>(C.current=!0,()=>{C.current=!1}),[]),QS(()=>{if(N&&(j.current=N),_&&(S.current=_),N&&_){if(F.current)return F.current(N,_,V);V()}},[N,_,V,F,P]);const R=w.useMemo(()=>({reference:j,floating:S,setReference:b,setFloating:y}),[b,y]),H=w.useMemo(()=>({reference:N,floating:_}),[N,_]),q=w.useMemo(()=>{const L={position:r,left:0,top:0};if(!H.floating)return L;const M=YB(H.floating,d.x),z=YB(H.floating,d.y);return l?{...L,transform:"translate("+M+"px, "+z+"px)",...bQ(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:z}},[r,l,H.floating,d.x,d.y]);return w.useMemo(()=>({...d,update:V,refs:R,elements:H,floatingStyles:q}),[d,V,R,H,q])}const gbe=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?KB({element:n.current,padding:a}).fn(r):{}:n?KB({element:n,padding:a}).fn(r):{}}}},xbe=(e,t)=>({...ibe(e),options:[e,t]}),vbe=(e,t)=>({...obe(e),options:[e,t]}),ybe=(e,t)=>({...dbe(e),options:[e,t]}),bbe=(e,t)=>({...lbe(e),options:[e,t]}),wbe=(e,t)=>({...cbe(e),options:[e,t]}),jbe=(e,t)=>({...ube(e),options:[e,t]}),_be=(e,t)=>({...gbe(e),options:[e,t]});var Nbe="Arrow",wQ=w.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...i}=e;return s.jsx(zt.svg,{...i,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});wQ.displayName=Nbe;var Sbe=wQ;function oC(e){const[t,r]=w.useState(void 0);return ba(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=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,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;r({width:o,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var kR="Popper",[jQ,bp]=Xa(kR),[kbe,_Q]=jQ(kR),NQ=e=>{const{__scopePopper:t,children:r}=e,[n,a]=w.useState(null);return s.jsx(kbe,{scope:t,anchor:n,onAnchorChange:a,children:r})};NQ.displayName=kR;var SQ="PopperAnchor",kQ=w.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,i=_Q(SQ,r),o=w.useRef(null),l=Cr(t,o);return w.useEffect(()=>{i.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:s.jsx(zt.div,{...a,ref:l})});kQ.displayName=SQ;var CR="PopperContent",[Cbe,Ebe]=jQ(CR),CQ=w.forwardRef((e,t)=>{var J,se,ee,ie,Ee,te;const{__scopePopper:r,side:n="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:g,...p}=e,x=_Q(CR,r),[v,b]=w.useState(null),y=Cr(t,Ue=>b(Ue)),[N,_]=w.useState(null),j=oC(N),S=(j==null?void 0:j.width)??0,I=(j==null?void 0:j.height)??0,P=n+(i!=="center"?"-"+i:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],k=T.length>0,V={padding:F,boundary:T.filter(Tbe),altBoundary:k},{refs:C,floatingStyles:R,placement:H,isPositioned:q,middlewareData:L}=pbe({strategy:"fixed",placement:P,whileElementsMounted:(...Ue)=>abe(...Ue,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[xbe({mainAxis:a+I,alignmentAxis:o}),c&&vbe({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?ybe():void 0,...V}),c&&bbe({...V}),wbe({...V,apply:({elements:Ue,rects:W,availableWidth:Z,availableHeight:le})=>{const{width:re,height:oe}=W.reference,fe=Ue.floating.style;fe.setProperty("--radix-popper-available-width",`${Z}px`),fe.setProperty("--radix-popper-available-height",`${le}px`),fe.setProperty("--radix-popper-anchor-width",`${re}px`),fe.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),N&&_be({element:N,padding:l}),Pbe({arrowWidth:S,arrowHeight:I}),m&&jbe({strategy:"referenceHidden",...V})]}),[M,z]=TQ(H),K=ha(g);ba(()=>{q&&(K==null||K())},[q,K]);const E=(J=L.arrow)==null?void 0:J.x,A=(se=L.arrow)==null?void 0:se.y,O=((ee=L.arrow)==null?void 0:ee.centerOffset)!==0,[U,Y]=w.useState();return ba(()=>{v&&Y(window.getComputedStyle(v).zIndex)},[v]),s.jsx("div",{ref:C.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:q?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(ie=L.transformOrigin)==null?void 0:ie.x,(Ee=L.transformOrigin)==null?void 0:Ee.y].join(" "),...((te=L.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Cbe,{scope:r,placedSide:M,onArrowChange:_,arrowX:E,arrowY:A,shouldHideArrow:O,children:s.jsx(zt.div,{"data-side":M,"data-align":z,...p,ref:y,style:{...p.style,animation:q?void 0:"none"}})})})});CQ.displayName=CR;var EQ="PopperArrow",Abe={top:"bottom",right:"left",bottom:"top",left:"right"},AQ=w.forwardRef(function(t,r){const{__scopePopper:n,...a}=t,i=Ebe(EQ,n),o=Abe[i.placedSide];return s.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:s.jsx(Sbe,{...a,ref:r,style:{...a.style,display:"block"}})})});AQ.displayName=EQ;function Tbe(e){return e!==null}var Pbe=e=>({name:"transformOrigin",options:e,fn(t){var x,v,b;const{placement:r,rects:n,middlewareData:a}=t,o=((x=a.arrow)==null?void 0:x.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=TQ(r),f={start:"0%",center:"50%",end:"100%"}[d],m=(((v=a.arrow)==null?void 0:v.x)??0)+l/2,h=(((b=a.arrow)==null?void 0:b.y)??0)+c/2;let g="",p="";return u==="bottom"?(g=o?f:`${m}px`,p=`${-c}px`):u==="top"?(g=o?f:`${m}px`,p=`${n.floating.height+c}px`):u==="right"?(g=`${-c}px`,p=o?f:`${h}px`):u==="left"&&(g=`${n.floating.width+c}px`,p=o?f:`${h}px`),{data:{x:g,y:p}}}});function TQ(e){const[t,r="center"]=e.split("-");return[t,r]}var lC=NQ,$j=kQ,cC=CQ,uC=AQ,[dC]=Xa("Tooltip",[bp]),fC=bp(),PQ="TooltipProvider",Obe=700,KO="tooltip.open",[Dbe,ER]=dC(PQ),OQ=e=>{const{__scopeTooltip:t,delayDuration:r=Obe,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:i}=e,o=w.useRef(!0),l=w.useRef(!1),c=w.useRef(0);return w.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),s.jsx(Dbe,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:w.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:w.useCallback(u=>{l.current=u},[]),disableHoverableContent:a,children:i})};OQ.displayName=PQ;var l2="Tooltip",[Ibe,hC]=dC(l2),DQ=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=e,c=ER(l2,e.__scopeTooltip),u=fC(t),[d,f]=w.useState(null),m=Ga(),h=w.useRef(0),g=o??c.disableHoverableContent,p=l??c.delayDuration,x=w.useRef(!1),[v,b]=Wo({prop:n,defaultProp:a??!1,onChange:S=>{S?(c.onOpen(),document.dispatchEvent(new CustomEvent(KO))):c.onClose(),i==null||i(S)},caller:l2}),y=w.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),N=w.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x.current=!1,b(!0)},[b]),_=w.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),j=w.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{x.current=!0,b(!0),h.current=0},p)},[p,b]);return w.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),s.jsx(lC,{...u,children:s.jsx(Ibe,{scope:t,contentId:m,open:v,stateAttribute:y,trigger:d,onTriggerChange:f,onTriggerEnter:w.useCallback(()=>{c.isOpenDelayedRef.current?j():N()},[c.isOpenDelayedRef,j,N]),onTriggerLeave:w.useCallback(()=>{g?_():(window.clearTimeout(h.current),h.current=0)},[_,g]),onOpen:N,onClose:_,disableHoverableContent:g,children:r})})};DQ.displayName=l2;var YO="TooltipTrigger",IQ=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=hC(YO,r),i=ER(YO,r),o=fC(r),l=w.useRef(null),c=Cr(t,l,a.onTriggerChange),u=w.useRef(!1),d=w.useRef(!1),f=w.useCallback(()=>u.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),s.jsx($j,{asChild:!0,...o,children:s.jsx(zt.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:Ct(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ct(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:Ct(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ct(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:Ct(e.onBlur,a.onClose),onClick:Ct(e.onClick,a.onClose)})})});IQ.displayName=YO;var Rbe="TooltipPortal",[mkt,Lbe]=dC(Rbe,{forceMount:void 0}),ry="TooltipContent",RQ=w.forwardRef((e,t)=>{const r=Lbe(ry,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...i}=e,o=hC(ry,e.__scopeTooltip);return s.jsx(Za,{present:n||o.open,children:o.disableHoverableContent?s.jsx(LQ,{side:a,...i,ref:t}):s.jsx(Fbe,{side:a,...i,ref:t})})}),Fbe=w.forwardRef((e,t)=>{const r=hC(ry,e.__scopeTooltip),n=ER(ry,e.__scopeTooltip),a=w.useRef(null),i=Cr(t,a),[o,l]=w.useState(null),{trigger:c,onClose:u}=r,d=a.current,{onPointerInTransitChange:f}=n,m=w.useCallback(()=>{l(null),f(!1)},[f]),h=w.useCallback((g,p)=>{const x=g.currentTarget,v={x:g.clientX,y:g.clientY},b=Ube(v,x.getBoundingClientRect()),y=qbe(v,b),N=Vbe(p.getBoundingClientRect()),_=Hbe([...y,...N]);l(_),f(!0)},[f]);return w.useEffect(()=>()=>m(),[m]),w.useEffect(()=>{if(c&&d){const g=x=>h(x,d),p=x=>h(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",p)}}},[c,d,h,m]),w.useEffect(()=>{if(o){const g=p=>{const x=p.target,v={x:p.clientX,y:p.clientY},b=(c==null?void 0:c.contains(x))||(d==null?void 0:d.contains(x)),y=!Wbe(v,o);b?m():y&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,m]),s.jsx(LQ,{...e,ref:i})}),[Mbe,$be]=dC(l2,{isInside:!1}),Bbe=jJ("TooltipContent"),LQ=w.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=hC(ry,r),u=fC(r),{onClose:d}=c;return w.useEffect(()=>(document.addEventListener(KO,d),()=>document.removeEventListener(KO,d)),[d]),w.useEffect(()=>{if(c.trigger){const f=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),s.jsx(Pg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:s.jsxs(cC,{"data-state":c.stateAttribute,...u,...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:[s.jsx(Bbe,{children:n}),s.jsx(Mbe,{scope:r,isInside:!0,children:s.jsx(Kxe,{id:c.contentId,role:"tooltip",children:a||n})})]})})});RQ.displayName=ry;var FQ="TooltipArrow",zbe=w.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=fC(r);return $be(FQ,r).isInside?null:s.jsx(uC,{...a,...n,ref:t})});zbe.displayName=FQ;function Ube(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,a,i)){case i:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function qbe(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function Vbe(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function Wbe(e,t){const{x:r,y:n}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,d=l.y,f=c.x,m=c.y;d>n!=m>n&&r<(f-u)*(n-d)/(m-d)+u&&(a=!a)}return a}function Hbe(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),Gbe(t)}function Gbe(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];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 r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(a.y-o.y)>=(i.y-o.y)*(a.x-o.x))r.pop();else break}r.push(a)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Kbe=OQ,Ybe=DQ,Xbe=IQ,MQ=RQ;const Og=Kbe,Vf=Ybe,Wf=Xbe,Rd=w.forwardRef(({className:e,sideOffset:t=4,...r},n)=>s.jsx(MQ,{ref:n,sideOffset:t,className:pt("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),...r}));Rd.displayName=MQ.displayName;var Qy=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(){}},sg=typeof window>"u"||"Deno"in globalThis;function Po(){}function Zbe(e,t){return typeof e=="function"?e(t):e}function XO(e){return typeof e=="number"&&e>=0&&e!==1/0}function $Q(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Vm(e,t){return typeof e=="function"?e(t):e}function Ec(e,t){return typeof e=="function"?e(t):e}function XB(e,t){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(n){if(t.queryHash!==AR(o,t.options))return!1}else if(!c2(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function ZB(e,t){const{exact:r,status:n,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(ag(t.options.mutationKey)!==ag(i))return!1}else if(!c2(t.options.mutationKey,i))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function AR(e,t){return((t==null?void 0:t.queryKeyHashFn)||ag)(e)}function ag(e){return JSON.stringify(e,(t,r)=>ZO(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function c2(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>c2(e[r],t[r])):!1}function BQ(e,t){if(e===t)return e;const r=JB(e)&&JB(t);if(r||ZO(e)&&ZO(t)){const n=r?e:Object.keys(e),a=n.length,i=r?t:Object.keys(t),o=i.length,l=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<o;d++){const f=r?d:i[d];(!r&&c.has(f)||r)&&e[f]===void 0&&t[f]===void 0?(l[f]=void 0,u++):(l[f]=BQ(e[f],t[f]),l[f]===e[f]&&e[f]!==void 0&&u++)}return a===o&&u===a?e:l}return t}function U5(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function JB(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ZO(e){if(!QB(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!QB(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function QB(e){return Object.prototype.toString.call(e)==="[object Object]"}function Jbe(e){return new Promise(t=>{setTimeout(t,e)})}function JO(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?BQ(e,t):t}function Qbe(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function ewe(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var TR=Symbol();function zQ(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===TR?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function UQ(e,t){return typeof e=="function"?e(...t):!!e}var C0,gm,Iv,YY,twe=(YY=class extends Qy{constructor(){super();_r(this,C0);_r(this,gm);_r(this,Iv);Yt(this,Iv,t=>{if(!sg&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){ze(this,gm)||this.setEventListener(ze(this,Iv))}onUnsubscribe(){var t;this.hasListeners()||((t=ze(this,gm))==null||t.call(this),Yt(this,gm,void 0))}setEventListener(t){var r;Yt(this,Iv,t),(r=ze(this,gm))==null||r.call(this),Yt(this,gm,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){ze(this,C0)!==t&&(Yt(this,C0,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof ze(this,C0)=="boolean"?ze(this,C0):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},C0=new WeakMap,gm=new WeakMap,Iv=new WeakMap,YY),PR=new twe,Rv,xm,Lv,XY,rwe=(XY=class extends Qy{constructor(){super();_r(this,Rv,!0);_r(this,xm);_r(this,Lv);Yt(this,Lv,t=>{if(!sg&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){ze(this,xm)||this.setEventListener(ze(this,Lv))}onUnsubscribe(){var t;this.hasListeners()||((t=ze(this,xm))==null||t.call(this),Yt(this,xm,void 0))}setEventListener(t){var r;Yt(this,Lv,t),(r=ze(this,xm))==null||r.call(this),Yt(this,xm,t(this.setOnline.bind(this)))}setOnline(t){ze(this,Rv)!==t&&(Yt(this,Rv,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return ze(this,Rv)}},Rv=new WeakMap,xm=new WeakMap,Lv=new WeakMap,XY),q5=new rwe;function QO(){let e,t;const r=new Promise((a,i)=>{e=a,t=i});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},r.reject=a=>{n({status:"rejected",reason:a}),t(a)},r}function nwe(e){return Math.min(1e3*2**e,3e4)}function qQ(e){return(e??"online")==="online"?q5.isOnline():!0}var VQ=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function C3(e){return e instanceof VQ}function WQ(e){let t=!1,r=0,n=!1,a;const i=QO(),o=p=>{var x;n||(m(new VQ(p)),(x=e.abort)==null||x.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>PR.isFocused()&&(e.networkMode==="always"||q5.isOnline())&&e.canRun(),d=()=>qQ(e.networkMode)&&e.canRun(),f=p=>{var x;n||(n=!0,(x=e.onSuccess)==null||x.call(e,p),a==null||a(),i.resolve(p))},m=p=>{var x;n||(n=!0,(x=e.onError)==null||x.call(e,p),a==null||a(),i.reject(p))},h=()=>new Promise(p=>{var x;a=v=>{(n||u())&&p(v)},(x=e.onPause)==null||x.call(e)}).then(()=>{var p;a=void 0,n||(p=e.onContinue)==null||p.call(e)}),g=()=>{if(n)return;let p;const x=r===0?e.initialPromise:void 0;try{p=x??e.fn()}catch(v){p=Promise.reject(v)}Promise.resolve(p).then(f).catch(v=>{var j;if(n)return;const b=e.retry??(sg?0:3),y=e.retryDelay??nwe,N=typeof y=="function"?y(r,v):y,_=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,v);if(t||!_){m(v);return}r++,(j=e.onFail)==null||j.call(e,r,v),Jbe(N).then(()=>u()?void 0:h()).then(()=>{t?m(v):g()})})};return{promise:i,cancel:o,continue:()=>(a==null||a(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():h().then(g),i)}}var swe=e=>setTimeout(e,0);function awe(){let e=[],t=0,r=l=>{l()},n=l=>{l()},a=swe;const i=l=>{t?e.push(l):a(()=>{r(l)})},o=()=>{const l=e;e=[],l.length&&a(()=>{n(()=>{l.forEach(c=>{r(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=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{a=l}}}var fi=awe(),E0,ZY,HQ=(ZY=class{constructor(){_r(this,E0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),XO(this.gcTime)&&Yt(this,E0,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sg?1/0:5*60*1e3))}clearGcTimeout(){ze(this,E0)&&(clearTimeout(ze(this,E0)),Yt(this,E0,void 0))}},E0=new WeakMap,ZY),Fv,A0,kc,T0,io,Sj,P0,Tu,If,JY,iwe=(JY=class extends HQ{constructor(t){super();_r(this,Tu);_r(this,Fv);_r(this,A0);_r(this,kc);_r(this,T0);_r(this,io);_r(this,Sj);_r(this,P0);Yt(this,P0,!1),Yt(this,Sj,t.defaultOptions),this.setOptions(t.options),this.observers=[],Yt(this,T0,t.client),Yt(this,kc,ze(this,T0).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Yt(this,Fv,owe(this.options)),this.state=t.state??ze(this,Fv),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=ze(this,io))==null?void 0:t.promise}setOptions(t){this.options={...ze(this,Sj),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ze(this,kc).remove(this)}setData(t,r){const n=JO(this.state.data,t,this.options);return dn(this,Tu,If).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){dn(this,Tu,If).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,a;const r=(n=ze(this,io))==null?void 0:n.promise;return(a=ze(this,io))==null||a.cancel(t),r?r.then(Po).catch(Po):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ze(this,Fv))}isActive(){return this.observers.some(t=>Ec(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===TR||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Vm(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:!$Q(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=ze(this,io))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=ze(this,io))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),ze(this,kc).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(ze(this,io)&&(ze(this,P0)?ze(this,io).cancel({revert:!0}):ze(this,io).cancelRetry()),this.scheduleGc()),ze(this,kc).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||dn(this,Tu,If).call(this,{type:"invalidate"})}fetch(t,r){var u,d,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(ze(this,io))return ze(this,io).continueRetry(),ze(this,io).promise}if(t&&this.setOptions(t),!this.options.queryFn){const m=this.observers.find(h=>h.options.queryFn);m&&this.setOptions(m.options)}const n=new AbortController,a=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(Yt(this,P0,!0),n.signal)})},i=()=>{const m=zQ(this.options,r),g=(()=>{const p={client:ze(this,T0),queryKey:this.queryKey,meta:this.meta};return a(p),p})();return Yt(this,P0,!1),this.options.persister?this.options.persister(m,g,this):m(g)},l=(()=>{const m={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:ze(this,T0),state:this.state,fetchFn:i};return a(m),m})();(u=this.options.behavior)==null||u.onFetch(l,this),Yt(this,A0,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&&dn(this,Tu,If).call(this,{type:"fetch",meta:(f=l.fetchOptions)==null?void 0:f.meta});const c=m=>{var h,g,p,x;C3(m)&&m.silent||dn(this,Tu,If).call(this,{type:"error",error:m}),C3(m)||((g=(h=ze(this,kc).config).onError)==null||g.call(h,m,this),(x=(p=ze(this,kc).config).onSettled)==null||x.call(p,this.state.data,m,this)),this.scheduleGc()};return Yt(this,io,WQ({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onSuccess:m=>{var h,g,p,x;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(v){c(v);return}(g=(h=ze(this,kc).config).onSuccess)==null||g.call(h,m,this),(x=(p=ze(this,kc).config).onSettled)==null||x.call(p,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,h)=>{dn(this,Tu,If).call(this,{type:"failed",failureCount:m,error:h})},onPause:()=>{dn(this,Tu,If).call(this,{type:"pause"})},onContinue:()=>{dn(this,Tu,If).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),ze(this,io).start()}},Fv=new WeakMap,A0=new WeakMap,kc=new WeakMap,T0=new WeakMap,io=new WeakMap,Sj=new WeakMap,P0=new WeakMap,Tu=new WeakSet,If=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...GQ(n.data,this.options),fetchMeta:t.meta??null};case"success":return Yt(this,A0,void 0),{...n,data:t.data,dataUpdateCount:n.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 C3(a)&&a.revert&&ze(this,A0)?{...ze(this,A0),fetchStatus:"idle"}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),fi.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),ze(this,kc).notify({query:this,type:"updated",action:t})})},JY);function GQ(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qQ(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function owe(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Cd,QY,lwe=(QY=class extends Qy{constructor(t={}){super();_r(this,Cd);this.config=t,Yt(this,Cd,new Map)}build(t,r,n){const a=r.queryKey,i=r.queryHash??AR(a,r);let o=this.get(i);return o||(o=new iwe({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){ze(this,Cd).has(t.queryHash)||(ze(this,Cd).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=ze(this,Cd).get(t.queryHash);r&&(t.destroy(),r===t&&ze(this,Cd).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){fi.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return ze(this,Cd).get(t)}getAll(){return[...ze(this,Cd).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>XB(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>XB(t,n)):r}notify(t){fi.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){fi.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){fi.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Cd=new WeakMap,QY),Ed,Eo,O0,Ad,rm,eX,cwe=(eX=class extends HQ{constructor(t){super();_r(this,Ad);_r(this,Ed);_r(this,Eo);_r(this,O0);this.mutationId=t.mutationId,Yt(this,Eo,t.mutationCache),Yt(this,Ed,[]),this.state=t.state||KQ(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){ze(this,Ed).includes(t)||(ze(this,Ed).push(t),this.clearGcTimeout(),ze(this,Eo).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Yt(this,Ed,ze(this,Ed).filter(r=>r!==t)),this.scheduleGc(),ze(this,Eo).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){ze(this,Ed).length||(this.state.status==="pending"?this.scheduleGc():ze(this,Eo).remove(this))}continue(){var t;return((t=ze(this,O0))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,l,c,u,d,f,m,h,g,p,x,v,b,y,N,_,j,S,I;const r=()=>{dn(this,Ad,rm).call(this,{type:"continue"})};Yt(this,O0,WQ({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(P,F)=>{dn(this,Ad,rm).call(this,{type:"failed",failureCount:P,error:F})},onPause:()=>{dn(this,Ad,rm).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ze(this,Eo).canRun(this)}));const n=this.state.status==="pending",a=!ze(this,O0).canStart();try{if(n)r();else{dn(this,Ad,rm).call(this,{type:"pending",variables:t,isPaused:a}),await((o=(i=ze(this,Eo).config).onMutate)==null?void 0:o.call(i,t,this));const F=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));F!==this.state.context&&dn(this,Ad,rm).call(this,{type:"pending",context:F,variables:t,isPaused:a})}const P=await ze(this,O0).start();return await((d=(u=ze(this,Eo).config).onSuccess)==null?void 0:d.call(u,P,t,this.state.context,this)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,P,t,this.state.context)),await((g=(h=ze(this,Eo).config).onSettled)==null?void 0:g.call(h,P,null,this.state.variables,this.state.context,this)),await((x=(p=this.options).onSettled)==null?void 0:x.call(p,P,null,t,this.state.context)),dn(this,Ad,rm).call(this,{type:"success",data:P}),P}catch(P){try{throw await((b=(v=ze(this,Eo).config).onError)==null?void 0:b.call(v,P,t,this.state.context,this)),await((N=(y=this.options).onError)==null?void 0:N.call(y,P,t,this.state.context)),await((j=(_=ze(this,Eo).config).onSettled)==null?void 0:j.call(_,void 0,P,this.state.variables,this.state.context,this)),await((I=(S=this.options).onSettled)==null?void 0:I.call(S,void 0,P,t,this.state.context)),P}finally{dn(this,Ad,rm).call(this,{type:"error",error:P})}}finally{ze(this,Eo).runNext(this)}}},Ed=new WeakMap,Eo=new WeakMap,O0=new WeakMap,Ad=new WeakSet,rm=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),fi.batch(()=>{ze(this,Ed).forEach(n=>{n.onMutationUpdate(t)}),ze(this,Eo).notify({mutation:this,type:"updated",action:t})})},eX);function KQ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Bf,Pu,kj,tX,uwe=(tX=class extends Qy{constructor(t={}){super();_r(this,Bf);_r(this,Pu);_r(this,kj);this.config=t,Yt(this,Bf,new Set),Yt(this,Pu,new Map),Yt(this,kj,0)}build(t,r,n){const a=new cwe({mutationCache:this,mutationId:++sN(this,kj)._,options:t.defaultMutationOptions(r),state:n});return this.add(a),a}add(t){ze(this,Bf).add(t);const r=EN(t);if(typeof r=="string"){const n=ze(this,Pu).get(r);n?n.push(t):ze(this,Pu).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(ze(this,Bf).delete(t)){const r=EN(t);if(typeof r=="string"){const n=ze(this,Pu).get(r);if(n)if(n.length>1){const a=n.indexOf(t);a!==-1&&n.splice(a,1)}else n[0]===t&&ze(this,Pu).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=EN(t);if(typeof r=="string"){const n=ze(this,Pu).get(r),a=n==null?void 0:n.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var n;const r=EN(t);if(typeof r=="string"){const a=(n=ze(this,Pu).get(r))==null?void 0:n.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){fi.batch(()=>{ze(this,Bf).forEach(t=>{this.notify({type:"removed",mutation:t})}),ze(this,Bf).clear(),ze(this,Pu).clear()})}getAll(){return Array.from(ze(this,Bf))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>ZB(r,n))}findAll(t={}){return this.getAll().filter(r=>ZB(t,r))}notify(t){fi.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return fi.batch(()=>Promise.all(t.map(r=>r.continue().catch(Po))))}},Bf=new WeakMap,Pu=new WeakMap,kj=new WeakMap,tX);function EN(e){var t;return(t=e.options.scope)==null?void 0:t.id}function e9(e){return{onFetch:(t,r)=>{var d,f,m,h,g;const n=t.options,a=(m=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,i=((h=t.state.data)==null?void 0:h.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let p=!1;const x=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},v=zQ(t.options,t.fetchOptions),b=async(y,N,_)=>{if(p)return Promise.reject();if(N==null&&y.pages.length)return Promise.resolve(y);const S=(()=>{const T={client:t.client,queryKey:t.queryKey,pageParam:N,direction:_?"backward":"forward",meta:t.options.meta};return x(T),T})(),I=await v(S),{maxPages:P}=t.options,F=_?ewe:Qbe;return{pages:F(y.pages,I,P),pageParams:F(y.pageParams,N,P)}};if(a&&i.length){const y=a==="backward",N=y?dwe:t9,_={pages:i,pageParams:o},j=N(n,_);l=await b(_,j,y)}else{const y=e??i.length;do{const N=c===0?o[0]??n.initialPageParam:t9(n,l);if(c>0&&N==null)break;l=await b(l,N),c++}while(c<y)}return l};t.options.persister?t.fetchFn=()=>{var p,x;return(x=(p=t.options).persister)==null?void 0:x.call(p,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function t9(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function dwe(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var la,vm,ym,Mv,$v,bm,Bv,zv,rX,fwe=(rX=class{constructor(e={}){_r(this,la);_r(this,vm);_r(this,ym);_r(this,Mv);_r(this,$v);_r(this,bm);_r(this,Bv);_r(this,zv);Yt(this,la,e.queryCache||new lwe),Yt(this,vm,e.mutationCache||new uwe),Yt(this,ym,e.defaultOptions||{}),Yt(this,Mv,new Map),Yt(this,$v,new Map),Yt(this,bm,0)}mount(){sN(this,bm)._++,ze(this,bm)===1&&(Yt(this,Bv,PR.subscribe(async e=>{e&&(await this.resumePausedMutations(),ze(this,la).onFocus())})),Yt(this,zv,q5.subscribe(async e=>{e&&(await this.resumePausedMutations(),ze(this,la).onOnline())})))}unmount(){var e,t;sN(this,bm)._--,ze(this,bm)===0&&((e=ze(this,Bv))==null||e.call(this),Yt(this,Bv,void 0),(t=ze(this,zv))==null||t.call(this),Yt(this,zv,void 0))}isFetching(e){return ze(this,la).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ze(this,vm).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=ze(this,la).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=ze(this,la).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Vm(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return ze(this,la).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=ze(this,la).get(n.queryHash),i=a==null?void 0:a.state.data,o=Zbe(t,i);if(o!==void 0)return ze(this,la).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return fi.batch(()=>ze(this,la).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=ze(this,la).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=ze(this,la);fi.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=ze(this,la);return fi.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=fi.batch(()=>ze(this,la).findAll(e).map(a=>a.cancel(r)));return Promise.all(n).then(Po).catch(Po)}invalidateQueries(e,t={}){return fi.batch(()=>(ze(this,la).findAll(e).forEach(r=>{r.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 r={...t,cancelRefetch:t.cancelRefetch??!0},n=fi.batch(()=>ze(this,la).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(Po)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Po)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=ze(this,la).build(this,t);return r.isStaleByTime(Vm(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Po).catch(Po)}fetchInfiniteQuery(e){return e.behavior=e9(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Po).catch(Po)}ensureInfiniteQueryData(e){return e.behavior=e9(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return q5.isOnline()?ze(this,vm).resumePausedMutations():Promise.resolve()}getQueryCache(){return ze(this,la)}getMutationCache(){return ze(this,vm)}getDefaultOptions(){return ze(this,ym)}setDefaultOptions(e){Yt(this,ym,e)}setQueryDefaults(e,t){ze(this,Mv).set(ag(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...ze(this,Mv).values()],r={};return t.forEach(n=>{c2(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){ze(this,$v).set(ag(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...ze(this,$v).values()],r={};return t.forEach(n=>{c2(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...ze(this,ym).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=AR(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===TR&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ze(this,ym).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ze(this,la).clear(),ze(this,vm).clear()}},la=new WeakMap,vm=new WeakMap,ym=new WeakMap,Mv=new WeakMap,$v=new WeakMap,bm=new WeakMap,Bv=new WeakMap,zv=new WeakMap,rX),rl,Nn,Cj,Ao,D0,Uv,wm,jm,Ej,qv,Vv,I0,R0,_m,Wv,Wn,Wb,e6,t6,r6,n6,s6,a6,i6,YQ,nX,hwe=(nX=class extends Qy{constructor(t,r){super();_r(this,Wn);_r(this,rl);_r(this,Nn);_r(this,Cj);_r(this,Ao);_r(this,D0);_r(this,Uv);_r(this,wm);_r(this,jm);_r(this,Ej);_r(this,qv);_r(this,Vv);_r(this,I0);_r(this,R0);_r(this,_m);_r(this,Wv,new Set);this.options=r,Yt(this,rl,t),Yt(this,jm,null),Yt(this,wm,QO()),this.options.experimental_prefetchInRender||ze(this,wm).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ze(this,Nn).addObserver(this),r9(ze(this,Nn),this.options)?dn(this,Wn,Wb).call(this):this.updateResult(),dn(this,Wn,n6).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return o6(ze(this,Nn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return o6(ze(this,Nn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,dn(this,Wn,s6).call(this),dn(this,Wn,a6).call(this),ze(this,Nn).removeObserver(this)}setOptions(t){const r=this.options,n=ze(this,Nn);if(this.options=ze(this,rl).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ec(this.options.enabled,ze(this,Nn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");dn(this,Wn,i6).call(this),ze(this,Nn).setOptions(this.options),r._defaulted&&!U5(this.options,r)&&ze(this,rl).getQueryCache().notify({type:"observerOptionsUpdated",query:ze(this,Nn),observer:this});const a=this.hasListeners();a&&n9(ze(this,Nn),n,this.options,r)&&dn(this,Wn,Wb).call(this),this.updateResult(),a&&(ze(this,Nn)!==n||Ec(this.options.enabled,ze(this,Nn))!==Ec(r.enabled,ze(this,Nn))||Vm(this.options.staleTime,ze(this,Nn))!==Vm(r.staleTime,ze(this,Nn)))&&dn(this,Wn,e6).call(this);const i=dn(this,Wn,t6).call(this);a&&(ze(this,Nn)!==n||Ec(this.options.enabled,ze(this,Nn))!==Ec(r.enabled,ze(this,Nn))||i!==ze(this,_m))&&dn(this,Wn,r6).call(this,i)}getOptimisticResult(t){const r=ze(this,rl).getQueryCache().build(ze(this,rl),t),n=this.createResult(r,t);return pwe(this,n)&&(Yt(this,Ao,n),Yt(this,Uv,this.options),Yt(this,D0,ze(this,Nn).state)),n}getCurrentResult(){return ze(this,Ao)}trackResult(t,r){return new Proxy(t,{get:(n,a)=>(this.trackProp(a),r==null||r(a),Reflect.get(n,a))})}trackProp(t){ze(this,Wv).add(t)}getCurrentQuery(){return ze(this,Nn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=ze(this,rl).defaultQueryOptions(t),n=ze(this,rl).getQueryCache().build(ze(this,rl),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return dn(this,Wn,Wb).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),ze(this,Ao)))}createResult(t,r){var P;const n=ze(this,Nn),a=this.options,i=ze(this,Ao),o=ze(this,D0),l=ze(this,Uv),u=t!==n?t.state:ze(this,Cj),{state:d}=t;let f={...d},m=!1,h;if(r._optimisticResults){const F=this.hasListeners(),T=!F&&r9(t,r),k=F&&n9(t,n,r,a);(T||k)&&(f={...f,...GQ(d.data,t.options)}),r._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:x}=f;h=f.data;let v=!1;if(r.placeholderData!==void 0&&h===void 0&&x==="pending"){let F;i!=null&&i.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(F=i.data,v=!0):F=typeof r.placeholderData=="function"?r.placeholderData((P=ze(this,Vv))==null?void 0:P.state.data,ze(this,Vv)):r.placeholderData,F!==void 0&&(x="success",h=JO(i==null?void 0:i.data,F,r),m=!0)}if(r.select&&h!==void 0&&!v)if(i&&h===(o==null?void 0:o.data)&&r.select===ze(this,Ej))h=ze(this,qv);else try{Yt(this,Ej,r.select),h=r.select(h),h=JO(i==null?void 0:i.data,h,r),Yt(this,qv,h),Yt(this,jm,null)}catch(F){Yt(this,jm,F)}ze(this,jm)&&(g=ze(this,jm),h=ze(this,qv),p=Date.now(),x="error");const b=f.fetchStatus==="fetching",y=x==="pending",N=x==="error",_=y&&b,j=h!==void 0,I={status:x,fetchStatus:f.fetchStatus,isPending:y,isSuccess:x==="success",isError:N,isInitialLoading:_,isLoading:_,data:h,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:p,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!y,isLoadingError:N&&!j,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&j,isStale:OR(t,r),refetch:this.refetch,promise:ze(this,wm),isEnabled:Ec(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const F=V=>{I.status==="error"?V.reject(I.error):I.data!==void 0&&V.resolve(I.data)},T=()=>{const V=Yt(this,wm,I.promise=QO());F(V)},k=ze(this,wm);switch(k.status){case"pending":t.queryHash===n.queryHash&&F(k);break;case"fulfilled":(I.status==="error"||I.data!==k.value)&&T();break;case"rejected":(I.status!=="error"||I.error!==k.reason)&&T();break}}return I}updateResult(){const t=ze(this,Ao),r=this.createResult(ze(this,Nn),this.options);if(Yt(this,D0,ze(this,Nn).state),Yt(this,Uv,this.options),ze(this,D0).data!==void 0&&Yt(this,Vv,ze(this,Nn)),U5(r,t))return;Yt(this,Ao,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!ze(this,Wv).size)return!0;const o=new Set(i??ze(this,Wv));return this.options.throwOnError&&o.add("error"),Object.keys(ze(this,Ao)).some(l=>{const c=l;return ze(this,Ao)[c]!==t[c]&&o.has(c)})};dn(this,Wn,YQ).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&dn(this,Wn,n6).call(this)}},rl=new WeakMap,Nn=new WeakMap,Cj=new WeakMap,Ao=new WeakMap,D0=new WeakMap,Uv=new WeakMap,wm=new WeakMap,jm=new WeakMap,Ej=new WeakMap,qv=new WeakMap,Vv=new WeakMap,I0=new WeakMap,R0=new WeakMap,_m=new WeakMap,Wv=new WeakMap,Wn=new WeakSet,Wb=function(t){dn(this,Wn,i6).call(this);let r=ze(this,Nn).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Po)),r},e6=function(){dn(this,Wn,s6).call(this);const t=Vm(this.options.staleTime,ze(this,Nn));if(sg||ze(this,Ao).isStale||!XO(t))return;const n=$Q(ze(this,Ao).dataUpdatedAt,t)+1;Yt(this,I0,setTimeout(()=>{ze(this,Ao).isStale||this.updateResult()},n))},t6=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ze(this,Nn)):this.options.refetchInterval)??!1},r6=function(t){dn(this,Wn,a6).call(this),Yt(this,_m,t),!(sg||Ec(this.options.enabled,ze(this,Nn))===!1||!XO(ze(this,_m))||ze(this,_m)===0)&&Yt(this,R0,setInterval(()=>{(this.options.refetchIntervalInBackground||PR.isFocused())&&dn(this,Wn,Wb).call(this)},ze(this,_m)))},n6=function(){dn(this,Wn,e6).call(this),dn(this,Wn,r6).call(this,dn(this,Wn,t6).call(this))},s6=function(){ze(this,I0)&&(clearTimeout(ze(this,I0)),Yt(this,I0,void 0))},a6=function(){ze(this,R0)&&(clearInterval(ze(this,R0)),Yt(this,R0,void 0))},i6=function(){const t=ze(this,rl).getQueryCache().build(ze(this,rl),this.options);if(t===ze(this,Nn))return;const r=ze(this,Nn);Yt(this,Nn,t),Yt(this,Cj,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},YQ=function(t){fi.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(ze(this,Ao))}),ze(this,rl).getQueryCache().notify({query:ze(this,Nn),type:"observerResultsUpdated"})})},nX);function mwe(e,t){return Ec(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function r9(e,t){return mwe(e,t)||e.state.data!==void 0&&o6(e,t,t.refetchOnMount)}function o6(e,t,r){if(Ec(t.enabled,e)!==!1&&Vm(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&OR(e,t)}return!1}function n9(e,t,r,n){return(e!==t||Ec(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&OR(e,r)}function OR(e,t){return Ec(t.enabled,e)!==!1&&e.isStaleByTime(Vm(t.staleTime,e))}function pwe(e,t){return!U5(e.getCurrentResult(),t)}var Nm,Sm,nl,zf,sh,e5,l6,sX,gwe=(sX=class extends Qy{constructor(r,n){super();_r(this,sh);_r(this,Nm);_r(this,Sm);_r(this,nl);_r(this,zf);Yt(this,Nm,r),this.setOptions(n),this.bindMethods(),dn(this,sh,e5).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){var a;const n=this.options;this.options=ze(this,Nm).defaultMutationOptions(r),U5(this.options,n)||ze(this,Nm).getMutationCache().notify({type:"observerOptionsUpdated",mutation:ze(this,nl),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ag(n.mutationKey)!==ag(this.options.mutationKey)?this.reset():((a=ze(this,nl))==null?void 0:a.state.status)==="pending"&&ze(this,nl).setOptions(this.options)}onUnsubscribe(){var r;this.hasListeners()||(r=ze(this,nl))==null||r.removeObserver(this)}onMutationUpdate(r){dn(this,sh,e5).call(this),dn(this,sh,l6).call(this,r)}getCurrentResult(){return ze(this,Sm)}reset(){var r;(r=ze(this,nl))==null||r.removeObserver(this),Yt(this,nl,void 0),dn(this,sh,e5).call(this),dn(this,sh,l6).call(this)}mutate(r,n){var a;return Yt(this,zf,n),(a=ze(this,nl))==null||a.removeObserver(this),Yt(this,nl,ze(this,Nm).getMutationCache().build(ze(this,Nm),this.options)),ze(this,nl).addObserver(this),ze(this,nl).execute(r)}},Nm=new WeakMap,Sm=new WeakMap,nl=new WeakMap,zf=new WeakMap,sh=new WeakSet,e5=function(){var n;const r=((n=ze(this,nl))==null?void 0:n.state)??KQ();Yt(this,Sm,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},l6=function(r){fi.batch(()=>{var n,a,i,o,l,c,u,d;if(ze(this,zf)&&this.hasListeners()){const f=ze(this,Sm).variables,m=ze(this,Sm).context;(r==null?void 0:r.type)==="success"?((a=(n=ze(this,zf)).onSuccess)==null||a.call(n,r.data,f,m),(o=(i=ze(this,zf)).onSettled)==null||o.call(i,r.data,null,f,m)):(r==null?void 0:r.type)==="error"&&((c=(l=ze(this,zf)).onError)==null||c.call(l,r.error,f,m),(d=(u=ze(this,zf)).onSettled)==null||d.call(u,void 0,r.error,f,m))}this.listeners.forEach(f=>{f(ze(this,Sm))})})},sX),XQ=w.createContext(void 0),e1=e=>{const t=w.useContext(XQ);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},xwe=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(XQ.Provider,{value:e,children:t})),ZQ=w.createContext(!1),vwe=()=>w.useContext(ZQ);ZQ.Provider;function ywe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bwe=w.createContext(ywe()),wwe=()=>w.useContext(bwe),jwe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},_we=e=>{w.useEffect(()=>{e.clearReset()},[e])},Nwe=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||UQ(r,[e.error,n])),Swe=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},kwe=(e,t)=>e.isLoading&&e.isFetching&&!t,Cwe=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,s9=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Ewe(e,t,r){var f,m,h,g,p;const n=vwe(),a=wwe(),i=e1(),o=i.defaultQueryOptions(e);(m=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||m.call(f,o),o._optimisticResults=n?"isRestoring":"optimistic",Swe(o),jwe(o,a),_we(a);const l=!i.getQueryCache().get(o.queryHash),[c]=w.useState(()=>new t(i,o)),u=c.getOptimisticResult(o),d=!n&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(x=>{const v=d?c.subscribe(fi.batchCalls(x)):Po;return c.updateResult(),v},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),Cwe(o,u))throw s9(o,c,a);if(Nwe({result:u,errorResetBoundary:a,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;if((g=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||g.call(h,o,u),o.experimental_prefetchInRender&&!sg&&kwe(u,n)){const x=l?s9(o,c,a):(p=i.getQueryCache().get(o.queryHash))==null?void 0:p.promise;x==null||x.catch(Po).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}function ga(e,t){return Ewe(e,hwe)}function Ic(e,t){const r=e1(),[n]=w.useState(()=>new gwe(r,e));w.useEffect(()=>{n.setOptions(e)},[n,e]);const a=w.useSyncExternalStore(w.useCallback(o=>n.subscribe(fi.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=w.useCallback((o,l)=>{n.mutate(o,l).catch(Po)},[n]);if(a.error&&UQ(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}/**
* @remix-run/router v1.23.3
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function u2(){return u2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u2.apply(null,arguments)}var Am;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Am||(Am={}));const a9="popstate";function Awe(e){e===void 0&&(e={});function t(n,a){let{pathname:i,search:o,hash:l}=n.location;return c6("",{pathname:i,search:o,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:V5(a)}return Pwe(t,r,null,e)}function Da(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function DR(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Twe(){return Math.random().toString(36).substr(2,8)}function i9(e,t){return{usr:e.state,key:e.key,idx:t}}function c6(e,t,r,n){return r===void 0&&(r=null),u2({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?t1(t):t,{state:r,key:t&&t.key||n||Twe()})}function V5(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function t1(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function Pwe(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,l=Am.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(u2({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Am.Pop;let x=d(),v=x==null?null:x-u;u=x,c&&c({action:l,location:p.location,delta:v})}function m(x,v){l=Am.Push;let b=c6(p.location,x,v);u=d()+1;let y=i9(b,u),N=p.createHref(b);try{o.pushState(y,"",N)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;a.location.assign(N)}i&&c&&c({action:l,location:p.location,delta:1})}function h(x,v){l=Am.Replace;let b=c6(p.location,x,v);u=d();let y=i9(b,u),N=p.createHref(b);o.replaceState(y,"",N),i&&c&&c({action:l,location:p.location,delta:0})}function g(x){let v=a.location.origin!=="null"?a.location.origin:a.location.href,b=typeof x=="string"?x:V5(x);return b=b.replace(/ $/,"%20"),Da(v,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,v)}let p={get action(){return l},get location(){return e(a,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(a9,f),c=x,()=>{a.removeEventListener(a9,f),c=null}},createHref(x){return t(a,x)},createURL:g,encodeLocation(x){let v=g(x);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:h,go(x){return o.go(x)}};return p}var o9;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(o9||(o9={}));function Owe(e,t,r){return r===void 0&&(r="/"),Dwe(e,t,r)}function Dwe(e,t,r,n){let a=typeof t=="string"?t1(t):t,i=IR(a.pathname||"/",r);if(i==null)return null;let o=JQ(e);Iwe(o);let l=null,c=Hwe(i);for(let u=0;l==null&&u<o.length;++u)l=qwe(o[u],c);return l}function JQ(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");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("/")&&(Da(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=Wm([n,c.relativePath]),d=r.concat(c);i.children&&i.children.length>0&&(Da(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),JQ(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:zwe(u,i.index),routesMeta:d})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))a(i,o);else for(let c of QQ(i.path))a(i,o,c)}),t}function QQ(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=QQ(n.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 Iwe(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Uwe(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const Rwe=/^:[\w-]+$/,Lwe=3,Fwe=2,Mwe=1,$we=10,Bwe=-2,l9=e=>e==="*";function zwe(e,t){let r=e.split("/"),n=r.length;return r.some(l9)&&(n+=Bwe),t&&(n+=Fwe),r.filter(a=>!l9(a)).reduce((a,i)=>a+(Rwe.test(i)?Lwe:i===""?Mwe:$we),n)}function Uwe(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function qwe(e,t,r){let{routesMeta:n}=e,a={},i="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=i==="/"?t:t.slice(i.length)||"/",f=Vwe({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),m=c.route;if(!f)return null;Object.assign(a,f.params),o.push({params:a,pathname:Wm([i,f.pathname]),pathnameBase:Zwe(Wm([i,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(i=Wm([i,f.pathnameBase]))}return o}function Vwe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Wwe(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((u,d,f)=>{let{paramName:m,isOptional:h}=d;if(m==="*"){let p=l[f]||"";o=i.slice(0,i.length-p.length).replace(/(.)\/+$/,"$1")}const g=l[f];return h&&!g?u[m]=void 0:u[m]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function Wwe(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),DR(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Hwe(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return DR(!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 IR(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Gwe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Kwe=e=>Gwe.test(e);function Ywe(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?t1(e):e,i;if(r)if(Kwe(r))i=r;else{if(r.includes("//")){let o=r;r=eee(r),DR(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=c9(r.substring(1),"/"):i=c9(r,t)}else i=t;return{pathname:i,search:Jwe(n),hash:Qwe(a)}}function c9(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function E3(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Xwe(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function RR(e,t){let r=Xwe(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function LR(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=t1(e):(a=u2({},e),Da(!a.pathname||!a.pathname.includes("?"),E3("?","pathname","search",a)),Da(!a.pathname||!a.pathname.includes("#"),E3("#","pathname","hash",a)),Da(!a.search||!a.search.includes("#"),E3("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=r;else{let f=t.length-1;if(!n&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),f-=1;a.pathname=m.join("/")}l=f>=0?t[f]:"/"}let c=Ywe(a,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const eee=e=>e.replace(/\/\/+/g,"/"),Wm=e=>eee(e.join("/")),Zwe=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Jwe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Qwe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function e2e(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const tee=["post","put","patch","delete"];new Set(tee);const t2e=["get",...tee];new Set(t2e);/**
* React Router v6.30.4
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function d2(){return d2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d2.apply(null,arguments)}const FR=w.createContext(null),r2e=w.createContext(null),wp=w.createContext(null),mC=w.createContext(null),wh=w.createContext({outlet:null,matches:[],isDataRoute:!1}),ree=w.createContext(null);function n2e(e,t){let{relative:r}=t===void 0?{}:t;r1()||Da(!1);let{basename:n,navigator:a}=w.useContext(wp),{hash:i,pathname:o,search:l}=see(e,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:Wm([n,o])),a.createHref({pathname:c,search:l,hash:i})}function r1(){return w.useContext(mC)!=null}function ou(){return r1()||Da(!1),w.useContext(mC).location}function nee(e){w.useContext(wp).static||w.useLayoutEffect(e)}function Xt(){let{isDataRoute:e}=w.useContext(wh);return e?g2e():s2e()}function s2e(){r1()||Da(!1);let e=w.useContext(FR),{basename:t,future:r,navigator:n}=w.useContext(wp),{matches:a}=w.useContext(wh),{pathname:i}=ou(),o=JSON.stringify(RR(a,r.v7_relativeSplatPath)),l=w.useRef(!1);return nee(()=>{l.current=!0}),w.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let f=LR(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Wm([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,o,i,e])}function wo(){let{matches:e}=w.useContext(wh),t=e[e.length-1];return t?t.params:{}}function see(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=w.useContext(wp),{matches:a}=w.useContext(wh),{pathname:i}=ou(),o=JSON.stringify(RR(a,n.v7_relativeSplatPath));return w.useMemo(()=>LR(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function a2e(e,t){return i2e(e,t)}function i2e(e,t,r,n){r1()||Da(!1);let{navigator:a}=w.useContext(wp),{matches:i}=w.useContext(wh),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ou(),d;if(t){var f;let x=typeof t=="string"?t1(t):t;c==="/"||(f=x.pathname)!=null&&f.startsWith(c)||Da(!1),d=x}else d=u;let m=d.pathname||"/",h=m;if(c!=="/"){let x=c.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(x.length).join("/")}let g=Owe(e,{pathname:h}),p=d2e(g&&g.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:Wm([c,a.encodeLocation?a.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:Wm([c,a.encodeLocation?a.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,r,n);return t&&p?w.createElement(mC.Provider,{value:{location:d2({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Am.Pop}},p):p}function o2e(){let e=p2e(),t=e2e(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),r?w.createElement("pre",{style:a},r):null,null)}const l2e=w.createElement(o2e,null);class c2e extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?w.createElement(wh.Provider,{value:this.props.routeContext},w.createElement(ree.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function u2e(e){let{routeContext:t,match:r,children:n}=e,a=w.useContext(FR);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),w.createElement(wh.Provider,{value:t},n)}function d2e(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(a=r)==null?void 0:a.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Da(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:m,errors:h}=r,g=f.route.loader&&m[f.route.id]===void 0&&(!h||h[f.route.id]===void 0);if(f.route.lazy||g){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,m)=>{let h,g=!1,p=null,x=null;r&&(h=l&&f.route.id?l[f.route.id]:void 0,p=f.route.errorElement||l2e,c&&(u<0&&m===0?(x2e("route-fallback"),g=!0,x=null):u===m&&(g=!0,x=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),b=()=>{let y;return h?y=p:g?y=x:f.route.Component?y=w.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=d,w.createElement(u2e,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:y})};return r&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?w.createElement(c2e,{location:r.location,revalidation:r.revalidation,component:p,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):b()},null)}var aee=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(aee||{}),iee=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}(iee||{});function f2e(e){let t=w.useContext(FR);return t||Da(!1),t}function h2e(e){let t=w.useContext(r2e);return t||Da(!1),t}function m2e(e){let t=w.useContext(wh);return t||Da(!1),t}function oee(e){let t=m2e(),r=t.matches[t.matches.length-1];return r.route.id||Da(!1),r.route.id}function p2e(){var e;let t=w.useContext(ree),r=h2e(),n=oee();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function g2e(){let{router:e}=f2e(aee.UseNavigateStable),t=oee(iee.UseNavigateStable),r=w.useRef(!1);return nee(()=>{r.current=!0}),w.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,d2({fromRouteId:t},i)))},[e,t])}const u9={};function x2e(e,t,r){u9[e]||(u9[e]=!0)}function v2e(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function y2e(e){let{to:t,replace:r,state:n,relative:a}=e;r1()||Da(!1);let{future:i,static:o}=w.useContext(wp),{matches:l}=w.useContext(wh),{pathname:c}=ou(),u=Xt(),d=LR(t,RR(l,i.v7_relativeSplatPath),c,a==="path"),f=JSON.stringify(d);return w.useEffect(()=>u(JSON.parse(f),{replace:r,state:n,relative:a}),[u,f,a,r,n]),null}function At(e){Da(!1)}function b2e(e){let{basename:t="/",children:r=null,location:n,navigationType:a=Am.Pop,navigator:i,static:o=!1,future:l}=e;r1()&&Da(!1);let c=t.replace(/^\/*/,"/"),u=w.useMemo(()=>({basename:c,navigator:i,static:o,future:d2({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof n=="string"&&(n=t1(n));let{pathname:d="/",search:f="",hash:m="",state:h=null,key:g="default"}=n,p=w.useMemo(()=>{let x=IR(d,c);return x==null?null:{location:{pathname:x,search:f,hash:m,state:h,key:g},navigationType:a}},[c,d,f,m,h,g,a]);return p==null?null:w.createElement(wp.Provider,{value:u},w.createElement(mC.Provider,{children:r,value:p}))}function w2e(e){let{children:t,location:r}=e;return a2e(u6(t),r)}new Promise(()=>{});function u6(e,t){t===void 0&&(t=[]);let r=[];return w.Children.forEach(e,(n,a)=>{if(!w.isValidElement(n))return;let i=[...t,a];if(n.type===w.Fragment){r.push.apply(r,u6(n.props.children,i));return}n.type!==At&&Da(!1),!n.props.index||!n.props.children||Da(!1);let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=u6(n.props.children,i)),r.push(o)}),r}/**
* React Router DOM v6.30.4
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function d6(){return d6=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d6.apply(null,arguments)}function j2e(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function _2e(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function N2e(e,t){return e.button===0&&(!t||t==="_self")&&!_2e(e)}function f6(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function S2e(e,t){let r=f6(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const k2e=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],C2e="6";try{window.__reactRouterVersion=C2e}catch{}const E2e="startTransition",d9=pI[E2e];function A2e(e){let{basename:t,children:r,future:n,window:a}=e,i=w.useRef();i.current==null&&(i.current=Awe({window:a,v5Compat:!0}));let o=i.current,[l,c]=w.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},d=w.useCallback(f=>{u&&d9?d9(()=>c(f)):c(f)},[c,u]);return w.useLayoutEffect(()=>o.listen(d),[o,d]),w.useEffect(()=>v2e(n),[n]),w.createElement(b2e,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}const T2e=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",P2e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vt=w.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,m=j2e(t,k2e),{basename:h}=w.useContext(wp),g,p=!1;if(typeof u=="string"&&P2e.test(u)&&(g=u,T2e))try{let y=new URL(window.location.href),N=u.startsWith("//")?new URL(y.protocol+u):new URL(u),_=IR(N.pathname,h);N.origin===y.origin&&_!=null?u=_+N.search+N.hash:p=!0}catch{}let x=n2e(u,{relative:a}),v=O2e(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:a,viewTransition:f});function b(y){n&&n(y),y.defaultPrevented||v(y)}return w.createElement("a",d6({},m,{href:g||x,onClick:p||i?n:b,ref:r,target:c}))});var f9;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(f9||(f9={}));var h9;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(h9||(h9={}));function O2e(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=Xt(),u=ou(),d=see(e,{relative:o});return w.useCallback(f=>{if(N2e(f,r)){f.preventDefault();let m=n!==void 0?n:V5(u)===V5(d);c(e,{replace:m,state:a,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,n,a,r,e,i,o,l])}function Bj(e){let t=w.useRef(f6(e)),r=w.useRef(!1),n=ou(),a=w.useMemo(()=>S2e(n.search,r.current?null:t.current),[n.search]),i=Xt(),o=w.useCallback((l,c)=>{const u=f6(typeof l=="function"?l(a):l);r.current=!0,i("?"+u,c)},[i,a]);return[a,o]}var h6=function(e,t){return h6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},h6(e,t)};function lee(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");h6(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var Rc=function(){return Rc=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Rc.apply(this,arguments)};function jp(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function cee(e,t,r,n){var a=arguments.length,i=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function uee(e,t){return function(r,n){t(r,n,e)}}function dee(e,t,r,n,a,i){function o(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var l=n.kind,c=l==="getter"?"get":l==="setter"?"set":"value",u=!t&&e?n.static?e:e.prototype:null,d=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),f,m=!1,h=r.length-1;h>=0;h--){var g={};for(var p in n)g[p]=p==="access"?{}:n[p];for(var p in n.access)g.access[p]=n.access[p];g.addInitializer=function(v){if(m)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(v||null))};var x=(0,r[h])(l==="accessor"?{get:d.get,set:d.set}:d[c],g);if(l==="accessor"){if(x===void 0)continue;if(x===null||typeof x!="object")throw new TypeError("Object expected");(f=o(x.get))&&(d.get=f),(f=o(x.set))&&(d.set=f),(f=o(x.init))&&a.unshift(f)}else(f=o(x))&&(l==="field"?a.unshift(f):d[c]=f)}u&&Object.defineProperty(u,n.name,d),m=!0}function fee(e,t,r){for(var n=arguments.length>2,a=0;a<t.length;a++)r=n?t[a].call(e,r):t[a].call(e);return n?r:void 0}function hee(e){return typeof e=="symbol"?e:"".concat(e)}function mee(e,t,r){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function pee(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function fr(e,t,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function l(d){try{u(n.next(d))}catch(f){o(f)}}function c(d){try{u(n.throw(d))}catch(f){o(f)}}function u(d){d.done?i(d.value):a(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}function gee(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(u){return function(d){return c([u,d])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,a&&(i=u[0]&2?a.return:u[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,u[1])).done)return i;switch(a=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,a=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(d){u=[6,d],a=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var pC=Object.create?function(e,t,r,n){n===void 0&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]};function xee(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&pC(t,e,r)}function W5(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function MR(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,i=[],o;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(l){o={error:l}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function vee(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(MR(arguments[t]));return e}function yee(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),a=0,t=0;t<r;t++)for(var i=arguments[t],o=0,l=i.length;o<l;o++,a++)n[a]=i[o];return n}function $R(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,i;n<a;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function ny(e){return this instanceof ny?(this.v=e,this):new ny(e)}function bee(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),a,i=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",o),a[Symbol.asyncIterator]=function(){return this},a;function o(h){return function(g){return Promise.resolve(g).then(h,f)}}function l(h,g){n[h]&&(a[h]=function(p){return new Promise(function(x,v){i.push([h,p,x,v])>1||c(h,p)})},g&&(a[h]=g(a[h])))}function c(h,g){try{u(n[h](g))}catch(p){m(i[0][3],p)}}function u(h){h.value instanceof ny?Promise.resolve(h.value.v).then(d,f):m(i[0][2],h)}function d(h){c("next",h)}function f(h){c("throw",h)}function m(h,g){h(g),i.shift(),i.length&&c(i[0][0],i[0][1])}}function wee(e){var t,r;return t={},n("next"),n("throw",function(a){throw a}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(a,i){t[a]=e[a]?function(o){return(r=!r)?{value:ny(e[a](o)),done:!1}:i?i(o):o}:i}}function jee(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof W5=="function"?W5(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(o){return new Promise(function(l,c){o=e[i](o),a(l,c,o.done,o.value)})}}function a(i,o,l,c){Promise.resolve(c).then(function(u){i({value:u,done:l})},o)}}function _ee(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var D2e=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},m6=function(e){return m6=Object.getOwnPropertyNames||function(t){var r=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[r.length]=n);return r},m6(e)};function Nee(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r=m6(e),n=0;n<r.length;n++)r[n]!=="default"&&pC(t,e,r[n]);return D2e(t,e),t}function See(e){return e&&e.__esModule?e:{default:e}}function kee(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}function Cee(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r}function Eee(e,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof e=="function"?t===e:e.has(t)}function Aee(e,t,r){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var n,a;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(a=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");a&&(n=function(){try{a.call(this)}catch(i){return Promise.reject(i)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var I2e=typeof SuppressedError=="function"?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function Tee(e){function t(i){e.error=e.hasError?new I2e(i,e.error,"An error was suppressed during disposal."):i,e.hasError=!0}var r,n=0;function a(){for(;r=e.stack.pop();)try{if(!r.async&&n===1)return n=0,e.stack.push(r),Promise.resolve().then(a);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(a,function(o){return t(o),a()})}else n|=1}catch(o){t(o)}if(n===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return a()}function Pee(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,a,i,o){return n?t?".jsx":".js":a&&(!i||!o)?r:a+i+"."+o.toLowerCase()+"js"}):e}const R2e={__extends:lee,__assign:Rc,__rest:jp,__decorate:cee,__param:uee,__esDecorate:dee,__runInitializers:fee,__propKey:hee,__setFunctionName:mee,__metadata:pee,__awaiter:fr,__generator:gee,__createBinding:pC,__exportStar:xee,__values:W5,__read:MR,__spread:vee,__spreadArrays:yee,__spreadArray:$R,__await:ny,__asyncGenerator:bee,__asyncDelegator:wee,__asyncValues:jee,__makeTemplateObject:_ee,__importStar:Nee,__importDefault:See,__classPrivateFieldGet:kee,__classPrivateFieldSet:Cee,__classPrivateFieldIn:Eee,__addDisposableResource:Aee,__disposeResources:Tee,__rewriteRelativeImportExtension:Pee},L2e=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:Aee,get __assign(){return Rc},__asyncDelegator:wee,__asyncGenerator:bee,__asyncValues:jee,__await:ny,__awaiter:fr,__classPrivateFieldGet:kee,__classPrivateFieldIn:Eee,__classPrivateFieldSet:Cee,__createBinding:pC,__decorate:cee,__disposeResources:Tee,__esDecorate:dee,__exportStar:xee,__extends:lee,__generator:gee,__importDefault:See,__importStar:Nee,__makeTemplateObject:_ee,__metadata:pee,__param:uee,__propKey:hee,__read:MR,__rest:jp,__rewriteRelativeImportExtension:Pee,__runInitializers:fee,__setFunctionName:mee,__spread:vee,__spreadArray:$R,__spreadArrays:yee,__values:W5,default:R2e},Symbol.toStringTag,{value:"Module"})),F2e=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class BR extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}}class M2e extends BR{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class m9 extends BR{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class p9 extends BR{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var p6;(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"})(p6||(p6={}));class $2e{constructor(t,{headers:r={},customFetch:n,region:a=p6.Any}={}){this.url=t,this.headers=r,this.region=a,this.fetch=F2e(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return fr(this,arguments,void 0,function*(r,n={}){var a;let i,o;try{const{headers:l,method:c,body:u,signal:d,timeout:f}=n;let m={},{region:h}=n;h||(h=this.region);const g=new URL(`${this.url}/${r}`);h&&h!=="any"&&(m["x-region"]=h,g.searchParams.set("forceFunctionRegion",h));let p;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",p=u):typeof u=="string"?(m["Content-Type"]="text/plain",p=u):typeof FormData<"u"&&u instanceof FormData?p=u:(m["Content-Type"]="application/json",p=JSON.stringify(u)):p=u;let x=d;f&&(o=new AbortController,i=setTimeout(()=>o.abort(),f),d?(x=o.signal,d.addEventListener("abort",()=>o.abort())):x=o.signal);const v=yield this.fetch(g.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),l),body:p,signal:x}).catch(_=>{throw new M2e(_)}),b=v.headers.get("x-relay-error");if(b&&b==="true")throw new m9(v);if(!v.ok)throw new p9(v);let y=((a=v.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),N;return y==="application/json"?N=yield v.json():y==="application/octet-stream"||y==="application/pdf"?N=yield v.blob():y==="text/event-stream"?N=v:y==="multipart/form-data"?N=yield v.formData():N=yield v.text(),{data:N,error:null,response:v}}catch(l){return{data:null,error:l,response:l instanceof p9||l instanceof m9?l.context:void 0}}finally{i&&clearTimeout(i)}})}}var ol={};const n1=Gpe(L2e);var AN={},TN={},PN={},ON={},DN={},IN={},g9;function Oee(){if(g9)return IN;g9=1,Object.defineProperty(IN,"__esModule",{value:!0});class e extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}}return IN.default=e,IN}var x9;function Dee(){if(x9)return DN;x9=1,Object.defineProperty(DN,"__esModule",{value:!0});const t=n1.__importDefault(Oee());class r{constructor(a){var i,o;this.shouldThrowOnError=!1,this.method=a.method,this.url=a.url,this.headers=new Headers(a.headers),this.schema=a.schema,this.body=a.body,this.shouldThrowOnError=(i=a.shouldThrowOnError)!==null&&i!==void 0?i:!1,this.signal=a.signal,this.isMaybeSingle=(o=a.isMaybeSingle)!==null&&o!==void 0?o:!1,a.fetch?this.fetch=a.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(a,i){return this.headers=new Headers(this.headers),this.headers.set(a,i),this}then(a,i){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 o=this.fetch;let l=o(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async c=>{var u,d,f,m;let h=null,g=null,p=null,x=c.status,v=c.statusText;if(c.ok){if(this.method!=="HEAD"){const _=await c.text();_===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((u=this.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text"))?g=_:g=JSON.parse(_))}const y=(d=this.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),N=(f=c.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");y&&N&&N.length>1&&(p=parseInt(N[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(g)&&(g.length>1?(h={code:"PGRST116",details:`Results contain ${g.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},g=null,p=null,x=406,v="Not Acceptable"):g.length===1?g=g[0]:g=null)}else{const y=await c.text();try{h=JSON.parse(y),Array.isArray(h)&&c.status===404&&(g=[],h=null,x=200,v="OK")}catch{c.status===404&&y===""?(x=204,v="No Content"):h={message:y}}if(h&&this.isMaybeSingle&&(!((m=h==null?void 0:h.details)===null||m===void 0)&&m.includes("0 rows"))&&(h=null,x=200,v="OK"),h&&this.shouldThrowOnError)throw new t.default(h)}return{error:h,data:g,count:p,status:x,statusText:v}});return this.shouldThrowOnError||(l=l.catch(c=>{var u,d,f;return{error:{message:`${(u=c==null?void 0:c.name)!==null&&u!==void 0?u:"FetchError"}: ${c==null?void 0:c.message}`,details:`${(d=c==null?void 0:c.stack)!==null&&d!==void 0?d:""}`,hint:"",code:`${(f=c==null?void 0:c.code)!==null&&f!==void 0?f:""}`},data:null,count:null,status:0,statusText:""}})),l.then(a,i)}returns(){return this}overrideTypes(){return this}}return DN.default=r,DN}var v9;function Iee(){if(v9)return ON;v9=1,Object.defineProperty(ON,"__esModule",{value:!0});const t=n1.__importDefault(Dee());class r extends t.default{select(a){let i=!1;const o=(a??"*").split("").map(l=>/\s/.test(l)&&!i?"":(l==='"'&&(i=!i),l)).join("");return this.url.searchParams.set("select",o),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:i=!0,nullsFirst:o,foreignTable:l,referencedTable:c=l}={}){const u=c?`${c}.order`:"order",d=this.url.searchParams.get(u);return this.url.searchParams.set(u,`${d?`${d},`:""}${a}.${i?"asc":"desc"}${o===void 0?"":o?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:i,referencedTable:o=i}={}){const l=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(l,`${a}`),this}range(a,i,{foreignTable:o,referencedTable:l=o}={}){const c=typeof l>"u"?"offset":`${l}.offset`,u=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(c,`${a}`),this.url.searchParams.set(u,`${i-a+1}`),this}abortSignal(a){return this.signal=a,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}explain({analyze:a=!1,verbose:i=!1,settings:o=!1,buffers:l=!1,wal:c=!1,format:u="text"}={}){var d;const f=[a?"analyze":null,i?"verbose":null,o?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),m=(d=this.headers.get("Accept"))!==null&&d!==void 0?d:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${u}; for="${m}"; options=${f};`),u==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}}return ON.default=r,ON}var y9;function zR(){if(y9)return PN;y9=1,Object.defineProperty(PN,"__esModule",{value:!0});const t=n1.__importDefault(Iee()),r=new RegExp("[,()]");class n extends t.default{eq(i,o){return this.url.searchParams.append(i,`eq.${o}`),this}neq(i,o){return this.url.searchParams.append(i,`neq.${o}`),this}gt(i,o){return this.url.searchParams.append(i,`gt.${o}`),this}gte(i,o){return this.url.searchParams.append(i,`gte.${o}`),this}lt(i,o){return this.url.searchParams.append(i,`lt.${o}`),this}lte(i,o){return this.url.searchParams.append(i,`lte.${o}`),this}like(i,o){return this.url.searchParams.append(i,`like.${o}`),this}likeAllOf(i,o){return this.url.searchParams.append(i,`like(all).{${o.join(",")}}`),this}likeAnyOf(i,o){return this.url.searchParams.append(i,`like(any).{${o.join(",")}}`),this}ilike(i,o){return this.url.searchParams.append(i,`ilike.${o}`),this}ilikeAllOf(i,o){return this.url.searchParams.append(i,`ilike(all).{${o.join(",")}}`),this}ilikeAnyOf(i,o){return this.url.searchParams.append(i,`ilike(any).{${o.join(",")}}`),this}is(i,o){return this.url.searchParams.append(i,`is.${o}`),this}in(i,o){const l=Array.from(new Set(o)).map(c=>typeof c=="string"&&r.test(c)?`"${c}"`:`${c}`).join(",");return this.url.searchParams.append(i,`in.(${l})`),this}contains(i,o){return typeof o=="string"?this.url.searchParams.append(i,`cs.${o}`):Array.isArray(o)?this.url.searchParams.append(i,`cs.{${o.join(",")}}`):this.url.searchParams.append(i,`cs.${JSON.stringify(o)}`),this}containedBy(i,o){return typeof o=="string"?this.url.searchParams.append(i,`cd.${o}`):Array.isArray(o)?this.url.searchParams.append(i,`cd.{${o.join(",")}}`):this.url.searchParams.append(i,`cd.${JSON.stringify(o)}`),this}rangeGt(i,o){return this.url.searchParams.append(i,`sr.${o}`),this}rangeGte(i,o){return this.url.searchParams.append(i,`nxl.${o}`),this}rangeLt(i,o){return this.url.searchParams.append(i,`sl.${o}`),this}rangeLte(i,o){return this.url.searchParams.append(i,`nxr.${o}`),this}rangeAdjacent(i,o){return this.url.searchParams.append(i,`adj.${o}`),this}overlaps(i,o){return typeof o=="string"?this.url.searchParams.append(i,`ov.${o}`):this.url.searchParams.append(i,`ov.{${o.join(",")}}`),this}textSearch(i,o,{config:l,type:c}={}){let u="";c==="plain"?u="pl":c==="phrase"?u="ph":c==="websearch"&&(u="w");const d=l===void 0?"":`(${l})`;return this.url.searchParams.append(i,`${u}fts${d}.${o}`),this}match(i){return Object.entries(i).forEach(([o,l])=>{this.url.searchParams.append(o,`eq.${l}`)}),this}not(i,o,l){return this.url.searchParams.append(i,`not.${o}.${l}`),this}or(i,{foreignTable:o,referencedTable:l=o}={}){const c=l?`${l}.or`:"or";return this.url.searchParams.append(c,`(${i})`),this}filter(i,o,l){return this.url.searchParams.append(i,`${o}.${l}`),this}}return PN.default=n,PN}var b9;function Ree(){if(b9)return TN;b9=1,Object.defineProperty(TN,"__esModule",{value:!0});const t=n1.__importDefault(zR());class r{constructor(a,{headers:i={},schema:o,fetch:l}){this.url=a,this.headers=new Headers(i),this.schema=o,this.fetch=l}select(a,i){const{head:o=!1,count:l}=i??{},c=o?"HEAD":"GET";let u=!1;const d=(a??"*").split("").map(f=>/\s/.test(f)&&!u?"":(f==='"'&&(u=!u),f)).join("");return this.url.searchParams.set("select",d),l&&this.headers.append("Prefer",`count=${l}`),new t.default({method:c,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:i,defaultToNull:o=!0}={}){var l;const c="POST";if(i&&this.headers.append("Prefer",`count=${i}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const u=a.reduce((d,f)=>d.concat(Object.keys(f)),[]);if(u.length>0){const d=[...new Set(u)].map(f=>`"${f}"`);this.url.searchParams.set("columns",d.join(","))}}return new t.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(a,{onConflict:i,ignoreDuplicates:o=!1,count:l,defaultToNull:c=!0}={}){var u;const d="POST";if(this.headers.append("Prefer",`resolution=${o?"ignore":"merge"}-duplicates`),i!==void 0&&this.url.searchParams.set("on_conflict",i),l&&this.headers.append("Prefer",`count=${l}`),c||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const f=a.reduce((m,h)=>m.concat(Object.keys(h)),[]);if(f.length>0){const m=[...new Set(f)].map(h=>`"${h}"`);this.url.searchParams.set("columns",m.join(","))}}return new t.default({method:d,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}update(a,{count:i}={}){var o;const l="PATCH";return i&&this.headers.append("Prefer",`count=${i}`),new t.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}delete({count:a}={}){var i;const o="DELETE";return a&&this.headers.append("Prefer",`count=${a}`),new t.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}}return TN.default=r,TN}var w9;function B2e(){if(w9)return AN;w9=1,Object.defineProperty(AN,"__esModule",{value:!0});const e=n1,t=e.__importDefault(Ree()),r=e.__importDefault(zR());class n{constructor(i,{headers:o={},schema:l,fetch:c}={}){this.url=i,this.headers=new Headers(o),this.schemaName=l,this.fetch=c}from(i){const o=new URL(`${this.url}/${i}`);return new t.default(o,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(i){return new n(this.url,{headers:this.headers,schema:i,fetch:this.fetch})}rpc(i,o={},{head:l=!1,get:c=!1,count:u}={}){var d;let f;const m=new URL(`${this.url}/rpc/${i}`);let h;l||c?(f=l?"HEAD":"GET",Object.entries(o).filter(([p,x])=>x!==void 0).map(([p,x])=>[p,Array.isArray(x)?`{${x.join(",")}}`:`${x}`]).forEach(([p,x])=>{m.searchParams.append(p,x)})):(f="POST",h=o);const g=new Headers(this.headers);return u&&g.set("Prefer",`count=${u}`),new r.default({method:f,url:m,headers:g,schema:this.schemaName,body:h,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}}return AN.default=n,AN}Object.defineProperty(ol,"__esModule",{value:!0});var Lee=ol.PostgrestError=Hee=ol.PostgrestBuilder=Vee=ol.PostgrestTransformBuilder=Uee=ol.PostgrestFilterBuilder=Bee=ol.PostgrestQueryBuilder=Mee=ol.PostgrestClient=void 0;const s1=n1,Fee=s1.__importDefault(B2e());var Mee=ol.PostgrestClient=Fee.default;const $ee=s1.__importDefault(Ree());var Bee=ol.PostgrestQueryBuilder=$ee.default;const zee=s1.__importDefault(zR());var Uee=ol.PostgrestFilterBuilder=zee.default;const qee=s1.__importDefault(Iee());var Vee=ol.PostgrestTransformBuilder=qee.default;const Wee=s1.__importDefault(Dee());var Hee=ol.PostgrestBuilder=Wee.default;const Gee=s1.__importDefault(Oee());Lee=ol.PostgrestError=Gee.default;var Kee=ol.default={PostgrestClient:Fee.default,PostgrestQueryBuilder:$ee.default,PostgrestFilterBuilder:zee.default,PostgrestTransformBuilder:qee.default,PostgrestBuilder:Wee.default,PostgrestError:Gee.default};const z2e=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return Hee},get PostgrestClient(){return Mee},get PostgrestError(){return Lee},get PostgrestFilterBuilder(){return Uee},get PostgrestQueryBuilder(){return Bee},get PostgrestTransformBuilder(){return Vee},default:Kee},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:U2e,PostgrestQueryBuilder:gkt,PostgrestFilterBuilder:xkt,PostgrestTransformBuilder:vkt,PostgrestBuilder:ykt,PostgrestError:bkt}=Kee||z2e;class q2e{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"){const r=process.versions;if(r&&r.node){const n=r.node,a=parseInt(n.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
import ws from "ws"
new 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 r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=`
Suggested solution: ${t.workaround}`),new Error(r)}static createWebSocket(t,r){const n=this.getWebSocketConstructor();return new n(t,r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const V2e="2.81.1",W2e=`realtime-js/${V2e}`,Yee="1.0.0",H2e="2.0.0",j9=Yee,g6=1e4,G2e=1e3,K2e=100;var f0;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(f0||(f0={}));var li;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(li||(li={}));var Ac;(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"})(Ac||(Ac={}));var x6;(function(e){e.websocket="websocket"})(x6||(x6={}));var h0;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(h0||(h0={}));class Y2e{constructor(){this.HEADER_LENGTH=1,this.META_LENGTH=4,this.USER_BROADCAST_PUSH_META_LENGTH=5,this.KINDS={push:0,reply:1,broadcast:2,userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST="broadcast"}encode(t,r){if(this._isArrayBuffer(t.payload))return r(this._binaryEncodePush(t));if(t.event===this.BROADCAST&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(n))}_binaryEncodePush(t){const{join_ref:r,ref:n,event:a,topic:i,payload:o}=t,l=this.META_LENGTH+r.length+n.length+i.length+a.length,c=new ArrayBuffer(this.HEADER_LENGTH+l);let u=new DataView(c),d=0;u.setUint8(d++,this.KINDS.push),u.setUint8(d++,r.length),u.setUint8(d++,n.length),u.setUint8(d++,i.length),u.setUint8(d++,a.length),Array.from(r,m=>u.setUint8(d++,m.charCodeAt(0))),Array.from(n,m=>u.setUint8(d++,m.charCodeAt(0))),Array.from(i,m=>u.setUint8(d++,m.charCodeAt(0))),Array.from(a,m=>u.setUint8(d++,m.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,n;const{join_ref:a,ref:i,topic:o}=t,l=t.payload.event,c=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0),u=this.USER_BROADCAST_PUSH_META_LENGTH+a.length+i.length+o.length+l.length,d=new ArrayBuffer(this.HEADER_LENGTH+u);let f=new DataView(d),m=0;f.setUint8(m++,this.KINDS.userBroadcastPush),f.setUint8(m++,a.length),f.setUint8(m++,i.length),f.setUint8(m++,o.length),f.setUint8(m++,l.length),f.setUint8(m++,this.BINARY_ENCODING),Array.from(a,g=>f.setUint8(m++,g.charCodeAt(0))),Array.from(i,g=>f.setUint8(m++,g.charCodeAt(0))),Array.from(o,g=>f.setUint8(m++,g.charCodeAt(0))),Array.from(l,g=>f.setUint8(m++,g.charCodeAt(0)));var h=new Uint8Array(d.byteLength+c.byteLength);return h.set(new Uint8Array(d),0),h.set(new Uint8Array(c),d.byteLength),h.buffer}_encodeJsonUserBroadcastPush(t){var r,n;const{join_ref:a,ref:i,topic:o}=t,l=t.payload.event,c=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},d=new TextEncoder().encode(JSON.stringify(c)).buffer,f=this.USER_BROADCAST_PUSH_META_LENGTH+a.length+i.length+o.length+l.length,m=new ArrayBuffer(this.HEADER_LENGTH+f);let h=new DataView(m),g=0;h.setUint8(g++,this.KINDS.userBroadcastPush),h.setUint8(g++,a.length),h.setUint8(g++,i.length),h.setUint8(g++,o.length),h.setUint8(g++,l.length),h.setUint8(g++,this.JSON_ENCODING),Array.from(a,x=>h.setUint8(g++,x.charCodeAt(0))),Array.from(i,x=>h.setUint8(g++,x.charCodeAt(0))),Array.from(o,x=>h.setUint8(g++,x.charCodeAt(0))),Array.from(l,x=>h.setUint8(g++,x.charCodeAt(0)));var p=new Uint8Array(m.byteLength+d.byteLength);return p.set(new Uint8Array(m),0),p.set(new Uint8Array(d),m.byteLength),p.buffer}decode(t,r){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return r(n)}if(typeof t=="string"){const n=JSON.parse(t),[a,i,o,l,c]=n;return r({join_ref:a,ref:i,topic:o,event:l,payload:c})}return r({})}_binaryDecode(t){const r=new DataView(t),n=r.getUint8(0),a=new TextDecoder;switch(n){case this.KINDS.push:return this._decodePush(t,r,a);case this.KINDS.reply:return this._decodeReply(t,r,a);case this.KINDS.broadcast:return this._decodeBroadcast(t,r,a);case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,a)}}_decodePush(t,r,n){const a=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3);let l=this.HEADER_LENGTH+this.META_LENGTH-1;const c=n.decode(t.slice(l,l+a));l=l+a;const u=n.decode(t.slice(l,l+i));l=l+i;const d=n.decode(t.slice(l,l+o));l=l+o;const f=JSON.parse(n.decode(t.slice(l,t.byteLength)));return{join_ref:c,ref:null,topic:u,event:d,payload:f}}_decodeReply(t,r,n){const a=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),l=r.getUint8(4);let c=this.HEADER_LENGTH+this.META_LENGTH;const u=n.decode(t.slice(c,c+a));c=c+a;const d=n.decode(t.slice(c,c+i));c=c+i;const f=n.decode(t.slice(c,c+o));c=c+o;const m=n.decode(t.slice(c,c+l));c=c+l;const h=JSON.parse(n.decode(t.slice(c,t.byteLength))),g={status:m,response:h};return{join_ref:u,ref:d,topic:f,event:Ac.reply,payload:g}}_decodeBroadcast(t,r,n){const a=r.getUint8(1),i=r.getUint8(2);let o=this.HEADER_LENGTH+2;const l=n.decode(t.slice(o,o+a));o=o+a;const c=n.decode(t.slice(o,o+i));o=o+i;const u=JSON.parse(n.decode(t.slice(o,t.byteLength)));return{join_ref:null,ref:null,topic:l,event:c,payload:u}}_decodeUserBroadcast(t,r,n){const a=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),l=r.getUint8(4);let c=this.HEADER_LENGTH+4;const u=n.decode(t.slice(c,c+a));c=c+a;const d=n.decode(t.slice(c,c+i));c=c+i;const f=n.decode(t.slice(c,c+o));c=c+o;const m=t.slice(c,t.byteLength),h=l===this.JSON_ENCODING?JSON.parse(n.decode(m)):m,g={type:this.BROADCAST,event:d,payload:h};return o>0&&(g.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST,payload:g}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}}class Xee{constructor(t,r){this.callback=t,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=r}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 ws;(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"})(ws||(ws={}));const _9=(e,t,r={})=>{var n;const a=(n=r.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=X2e(o,e,t,a),i),{}):{}},X2e=(e,t,r,n)=>{const a=t.find(l=>l.name===e),i=a==null?void 0:a.type,o=r[e];return i&&!n.includes(i)?Zee(i,o):v6(o)},Zee=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return eje(t,r)}switch(e){case ws.bool:return Z2e(t);case ws.float4:case ws.float8:case ws.int2:case ws.int4:case ws.int8:case ws.numeric:case ws.oid:return J2e(t);case ws.json:case ws.jsonb:return Q2e(t);case ws.timestamp:return tje(t);case ws.abstime:case ws.date:case ws.daterange:case ws.int4range:case ws.int8range:case ws.money:case ws.reltime:case ws.text:case ws.time:case ws.timestamptz:case ws.timetz:case ws.tsrange:case ws.tstzrange:return v6(t);default:return v6(t)}},v6=e=>e,Z2e=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},J2e=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Q2e=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},eje=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,n=e[r];if(e[0]==="{"&&n==="}"){let i;const o=e.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(l=>Zee(t,l))}return e},tje=e=>typeof e=="string"?e.replace(" ","T"):e,Jee=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class A3{constructor(t,r,n={},a=g6){this.channel=t,this.event=r,this.payload=n,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,r){var n;return this._hasReceived(t)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:t,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:r})}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:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(r))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var N9;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(N9||(N9={}));class cw{constructor(t,r){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(r==null?void 0:r.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=cw.syncState(this.state,a,i,o),this.pendingDiffs.forEach(c=>{this.state=cw.syncDiff(this.state,c,i,o)}),this.pendingDiffs=[],l()}),this.channel._on(n.diff,{},a=>{const{onJoin:i,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=cw.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,r,n,a){const i=this.cloneDeep(t),o=this.transformState(r),l={},c={};return this.map(i,(u,d)=>{o[u]||(c[u]=d)}),this.map(o,(u,d)=>{const f=i[u];if(f){const m=d.map(x=>x.presence_ref),h=f.map(x=>x.presence_ref),g=d.filter(x=>h.indexOf(x.presence_ref)<0),p=f.filter(x=>m.indexOf(x.presence_ref)<0);g.length>0&&(l[u]=g),p.length>0&&(c[u]=p)}else l[u]=d}),this.syncDiff(i,{joins:l,leaves:c},n,a)}static syncDiff(t,r,n,a){const{joins:i,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),a||(a=()=>{}),this.map(i,(l,c)=>{var u;const d=(u=t[l])!==null&&u!==void 0?u:[];if(t[l]=this.cloneDeep(c),d.length>0){const f=t[l].map(h=>h.presence_ref),m=d.filter(h=>f.indexOf(h.presence_ref)<0);t[l].unshift(...m)}n(l,d,c)}),this.map(o,(l,c)=>{let u=t[l];if(!u)return;const d=c.map(f=>f.presence_ref);u=u.filter(f=>d.indexOf(f.presence_ref)<0),t[l]=u,a(l,u,c),u.length===0&&delete t[l]}),t}static map(t,r){return Object.getOwnPropertyNames(t).map(n=>r(n,t[n]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const a=t[n];return"metas"in a?r[n]=a.metas.map(i=>(i.presence_ref=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):r[n]=a,r},{})}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 S9;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(S9||(S9={}));var uw;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(uw||(uw={}));var Lf;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Lf||(Lf={}));class UR{constructor(t,r={config:{}},n){var a,i;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.state=li.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},r.config),this.timeout=this.socket.timeout,this.joinPush=new A3(this,Ac.join,this.params,this.timeout),this.rejoinTimer=new Xee(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=li.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=li.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=li.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=li.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=li.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ac.reply,{},(o,l)=>{this._trigger(this._replyEventName(l),o)}),this.presence=new cw(this),this.broadcastEndpointURL=Jee(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((i=(a=this.params.config)===null||a===void 0?void 0:a.broadcast)===null||i===void 0)&&i.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,r=this.timeout){var n,a,i;if(this.socket.isConnected()||this.socket.connect(),this.state==li.closed){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(a=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(h=>h.filter))!==null&&a!==void 0?a:[],d=!!this.bindings[uw.PRESENCE]&&this.bindings[uw.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,f={},m={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(h=>t==null?void 0:t(Lf.CHANNEL_ERROR,h)),this._onClose(()=>t==null?void 0:t(Lf.CLOSED)),this.updateJoinPayload(Object.assign({config:m},f)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:h})=>{var g;if(this.socket.setAuth(),h===void 0){t==null||t(Lf.SUBSCRIBED);return}else{const p=this.bindings.postgres_changes,x=(g=p==null?void 0:p.length)!==null&&g!==void 0?g:0,v=[];for(let b=0;b<x;b++){const y=p[b],{filter:{event:N,schema:_,table:j,filter:S}}=y,I=h&&h[b];if(I&&I.event===N&&I.schema===_&&I.table===j&&I.filter===S)v.push(Object.assign(Object.assign({},y),{id:I.id}));else{this.unsubscribe(),this.state=li.errored,t==null||t(Lf.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=v,t&&t(Lf.SUBSCRIBED);return}}).receive("error",h=>{this.state=li.errored,t==null||t(Lf.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(h).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Lf.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,n){return this.state===li.joined&&t===uw.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,r,n)}async httpSend(t,r,n={}){var a;const i=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");const o={method:"POST",headers:{Authorization:i,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:r,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(a=n.timeout)!==null&&a!==void 0?a:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const u=await l.json();c=u.error||u.message||c}catch{}return Promise.reject(new Error(c))}async send(t,r={}){var n,a;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");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 u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((a=u.body)===null||a===void 0?void 0:a.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,l,c;const u=this._push(t.type,t,r.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"),u.receive("ok",()=>i("ok")),u.receive("error",()=>i("error")),u.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=li.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ac.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(a=>{n=new A3(this,Ac.leave,{},t),n.receive("ok",()=>{r(),a("ok")}).receive("timeout",()=>{r(),a("timed out")}).receive("error",()=>{a("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=li.closed,this.bindings={}}async _fetchWithTimeout(t,r,n){const a=new AbortController,i=setTimeout(()=>a.abort(),n),o=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:a.signal}));return clearTimeout(i),o}_push(t,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new A3(this,t,r,n);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>K2e){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(t,r,n){return r}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,r,n){var a,i;const o=t.toLocaleLowerCase(),{close:l,error:c,leave:u,join:d}=Ac;if(n&&[l,c,u,d].indexOf(o)>=0&&n!==this._joinRef())return;let m=this._onMessage(o,r,n);if(r&&!m)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(h=>{var g,p,x;return((g=h.filter)===null||g===void 0?void 0:g.event)==="*"||((x=(p=h.filter)===null||p===void 0?void 0:p.event)===null||x===void 0?void 0:x.toLocaleLowerCase())===o}).map(h=>h.callback(m,n)):(i=this.bindings[o])===null||i===void 0||i.filter(h=>{var g,p,x,v,b,y;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in h){const N=h.id,_=(g=h.filter)===null||g===void 0?void 0:g.event;return N&&((p=r.ids)===null||p===void 0?void 0:p.includes(N))&&(_==="*"||(_==null?void 0:_.toLocaleLowerCase())===((x=r.data)===null||x===void 0?void 0:x.type.toLocaleLowerCase()))}else{const N=(b=(v=h==null?void 0:h.filter)===null||v===void 0?void 0:v.event)===null||b===void 0?void 0:b.toLocaleLowerCase();return N==="*"||N===((y=r==null?void 0:r.event)===null||y===void 0?void 0:y.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===o}).map(h=>{if(typeof m=="object"&&"ids"in m){const g=m.data,{schema:p,table:x,commit_timestamp:v,type:b,errors:y}=g;m=Object.assign(Object.assign({},{schema:p,table:x,commit_timestamp:v,eventType:b,new:{},old:{},errors:y}),this._getPayloadRecords(g))}h.callback(m,n)})}_isClosed(){return this.state===li.closed}_isJoined(){return this.state===li.joined}_isJoining(){return this.state===li.joining}_isLeaving(){return this.state===li.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,r,n){const a=t.toLocaleLowerCase(),i={type:a,filter:r,callback:n};return this.bindings[a]?this.bindings[a].push(i):this.bindings[a]=[i],this}_off(t,r){const n=t.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(a=>{var i;return!(((i=a.type)===null||i===void 0?void 0:i.toLocaleLowerCase())===n&&UR.isEqual(a.filter,r))})),this}static isEqual(t,r){if(Object.keys(t).length!==Object.keys(r).length)return!1;for(const n in t)if(t[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Ac.close,{},t)}_onError(t){this._on(Ac.error,{},r=>t(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=li.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=_9(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=_9(t.columns,t.old_record)),r}}const T3=()=>{},RN={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},rje=[1e3,2e3,5e3,1e4],nje=1e4,sje=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class aje{constructor(t,r){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=g6,this.transport=null,this.heartbeatIntervalMs=RN.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=T3,this.ref=0,this.reconnectTimer=null,this.vsn=j9,this.logger=T3,this.conn=null,this.sendBuffer=[],this.serializer=new Y2e,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=a=>a?(...i)=>a(...i):(...i)=>fetch(...i),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey,this.endPoint=`${t}/${x6.websocket}`,this.httpEndpoint=Jee(t),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=q2e.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const r=t.message;throw r.includes("Node.js")?new Error(`${r}
To use Realtime in Node.js, you need to provide a WebSocket implementation:
Option 1: Use Node.js 22+ which has native WebSocket support
Option 2: Install and provide the "ws" package:
npm install ws
import ws from "ws"
const client = new RealtimeClient(url, {
...options,
transport: ws
})`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(t,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(t?this.conn.close(t,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,r,n){this.logger(t,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case f0.connecting:return h0.Connecting;case f0.open:return h0.Open;case f0.closing:return h0.Closing;default:return h0.Closed}}isConnected(){return this.connectionState()===h0.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,r={config:{}}){const n=`realtime:${t}`,a=this.getChannels().find(i=>i.topic===n);if(a)return a;{const i=new UR(`realtime:${t}`,r,this);return this.channels.push(i),i}}push(t){const{topic:r,event:n,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",`${r} ${n} (${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(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(G2e,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},RN.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}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 r=this.channels.find(n=>n.topic===t&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply")try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error")}catch(u){this.log("error","error in heartbeat callback",u)}r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:a,payload:i,ref:o}=r,l=o?`(${o})`:"",c=i.status||"";this.log("receive",`${c} ${n} ${a} ${l}`.trim(),i),this.channels.filter(u=>u._isMember(n)).forEach(u=>u._trigger(a,i,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(t){var r;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.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(){if(this.conn){if(this.conn.readyState===f0.open||this.conn.readyState===f0.connecting)try{this.conn.close()}catch(t){this.log("error","Error closing connection",t)}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._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),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=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(t){var r;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.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(Ac.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;const n=t.match(/\?/)?"&":"?",a=new URLSearchParams(r);return`${t}${n}${a}`}_workerObjectUrl(t){let r;if(t)r=t;else{const n=new Blob([sje],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(t,r=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(t=null){let r;t?r=t:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{const a={access_token:r,version:W2e};r&&n.updateJoinPayload(a),n.joinedOnce&&n._isJoined()&&n._push(Ac.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${t}`,r)})}_triggerStateCallbacks(t,r){try{this.stateChangeCallbacks[t].forEach(n=>{try{n(r)}catch(a){this.log("error",`error in ${t} callback`,a)}})}catch(n){this.log("error",`error triggering ${t} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new Xee(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},RN.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var r,n,a,i,o,l,c,u,d,f,m,h;switch(this.transport=(r=t==null?void 0:t.transport)!==null&&r!==void 0?r:null,this.timeout=(n=t==null?void 0:t.timeout)!==null&&n!==void 0?n:g6,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:RN.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:T3,this.vsn=(c=t==null?void 0:t.vsn)!==null&&c!==void 0?c:j9,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=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:g=>rje[g-1]||nje,this.vsn){case Yee:this.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:(g,p)=>p(JSON.stringify(g)),this.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:(g,p)=>p(JSON.parse(g));break;case H2e:this.encode=(m=t==null?void 0:t.encode)!==null&&m!==void 0?m:this.serializer.encode.bind(this.serializer),this.decode=(h=t==null?void 0:t.decode)!==null&&h!==void 0?h:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(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 qR extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Xs(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class ije extends qR{constructor(t,r,n){super(t),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class y6 extends qR{constructor(t,r){super(t),this.name="StorageUnknownError",this.originalError=r}}const VR=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),oje=()=>Response,b6=e=>{if(Array.isArray(e))return e.map(r=>b6(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,n])=>{const a=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[a]=b6(n)}),t},lje=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)},P3=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},cje=(e,t,r)=>fr(void 0,void 0,void 0,function*(){const n=yield oje();e instanceof n&&!(r!=null&&r.noResolveJson)?e.json().then(a=>{const i=e.status||500,o=(a==null?void 0:a.statusCode)||i+"";t(new ije(P3(a),i,o))}).catch(a=>{t(new y6(P3(a),a))}):t(new y6(P3(e),e))}),uje=(e,t,r,n)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!n?a:(lje(n)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(n)):a.body=n,t!=null&&t.duplex&&(a.duplex=t.duplex),Object.assign(Object.assign({},a),r))};function zj(e,t,r,n,a,i){return fr(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(r,uje(t,n,a,i)).then(c=>{if(!c.ok)throw c;return n!=null&&n.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>cje(c,l,n))})})}function f2(e,t,r,n){return fr(this,void 0,void 0,function*(){return zj(e,"GET",t,r,n)})}function Au(e,t,r,n,a){return fr(this,void 0,void 0,function*(){return zj(e,"POST",t,n,a,r)})}function w6(e,t,r,n,a){return fr(this,void 0,void 0,function*(){return zj(e,"PUT",t,n,a,r)})}function dje(e,t,r,n){return fr(this,void 0,void 0,function*(){return zj(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function WR(e,t,r,n,a){return fr(this,void 0,void 0,function*(){return zj(e,"DELETE",t,n,a,r)})}class fje{constructor(t,r){this.downloadFn=t,this.shouldThrowOnError=r}then(t,r){return this.execute().then(t,r)}execute(){return fr(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Xs(t))return{data:null,error:t};throw t}})}}var Qee;class hje{constructor(t,r){this.downloadFn=t,this.shouldThrowOnError=r,this[Qee]="BlobDownloadBuilder",this.promise=null}asStream(){return new fje(this.downloadFn,this.shouldThrowOnError)}then(t,r){return this.getPromise().then(t,r)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return fr(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Xs(t))return{data:null,error:t};throw t}})}}Qee=Symbol.toStringTag;const mje={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},k9={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class pje{constructor(t,r={},n,a){this.shouldThrowOnError=!1,this.url=t,this.headers=r,this.bucketId=n,this.fetch=VR(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,r,n,a){return fr(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},k9),a);let l=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",this.encodeMetadata(c)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),c&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(c))):(i=n,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=this.toBase64(this.encodeMetadata(c))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),a!=null&&a.headers&&(l=Object.assign(Object.assign({},l),a.headers));const u=this._removeEmptyFolders(r),d=this._getFinalPath(u),f=yield(t=="PUT"?w6:Au)(this.fetch,`${this.url}/object/${d}`,i,Object.assign({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{data:{path:u,id:f.Id,fullPath:f.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Xs(i))return{data:null,error:i};throw i}})}upload(t,r,n){return fr(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,r,n)})}uploadToSignedUrl(t,r,n,a){return fr(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",r);try{let c;const u=Object.assign({upsert:k9.upsert},a),d=Object.assign(Object.assign({},this.headers),{"x-upsert":String(u.upsert)});typeof Blob<"u"&&n instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),c.append("",n)):typeof FormData<"u"&&n instanceof FormData?(c=n,c.append("cacheControl",u.cacheControl)):(c=n,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType);const f=yield w6(this.fetch,l.toString(),c,{headers:d});return{data:{path:i,fullPath:f.Key},error:null}}catch(c){if(this.shouldThrowOnError)throw c;if(Xs(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(t,r){return fr(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t);const a=Object.assign({},this.headers);r!=null&&r.upsert&&(a["x-upsert"]="true");const i=yield Au(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:a}),o=new URL(this.url+i.url),l=o.searchParams.get("token");if(!l)throw new qR("No token returned by API");return{data:{signedUrl:o.toString(),path:t,token:l},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Xs(n))return{data:null,error:n};throw n}})}update(t,r,n){return fr(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,r,n)})}move(t,r,n){return fr(this,void 0,void 0,function*(){try{return{data:yield Au(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Xs(a))return{data:null,error:a};throw a}})}copy(t,r,n){return fr(this,void 0,void 0,function*(){try{return{data:{path:(yield Au(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Xs(a))return{data:null,error:a};throw a}})}createSignedUrl(t,r,n){return fr(this,void 0,void 0,function*(){try{let a=this._getFinalPath(t),i=yield Au(this.fetch,`${this.url}/object/sign/${a}`,Object.assign({expiresIn:r},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const o=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${o}`)},{data:i,error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Xs(a))return{data:null,error:a};throw a}})}createSignedUrls(t,r,n){return fr(this,void 0,void 0,function*(){try{const a=yield Au(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:t},{headers:this.headers}),i=n!=null&&n.download?`&download=${n.download===!0?"":n.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(this.shouldThrowOnError)throw a;if(Xs(a))return{data:null,error:a};throw a}})}download(t,r){const a=typeof(r==null?void 0:r.transform)<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString((r==null?void 0:r.transform)||{}),o=i?`?${i}`:"",l=this._getFinalPath(t),c=()=>f2(this.fetch,`${this.url}/${a}/${l}${o}`,{headers:this.headers,noResolveJson:!0});return new hje(c,this.shouldThrowOnError)}info(t){return fr(this,void 0,void 0,function*(){const r=this._getFinalPath(t);try{const n=yield f2(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:b6(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Xs(n))return{data:null,error:n};throw n}})}exists(t){return fr(this,void 0,void 0,function*(){const r=this._getFinalPath(t);try{return yield dje(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Xs(n)&&n instanceof y6){const a=n.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:n}}throw n}})}getPublicUrl(t,r){const n=this._getFinalPath(t),a=[],i=r!=null&&r.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&a.push(i);const l=typeof(r==null?void 0:r.transform)<"u"?"render/image":"object",c=this.transformOptsToQueryString((r==null?void 0:r.transform)||{});c!==""&&a.push(c);let u=a.join("&");return u!==""&&(u=`?${u}`),{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}${u}`)}}}remove(t){return fr(this,void 0,void 0,function*(){try{return{data:yield WR(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}list(t,r,n){return fr(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},mje),r),{prefix:t||""});return{data:yield Au(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},n),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Xs(a))return{data:null,error:a};throw a}})}listV2(t,r){return fr(this,void 0,void 0,function*(){try{const n=Object.assign({},t);return{data:yield Au(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Xs(n))return{data:null,error:n};throw n}})}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 r=[];return t.width&&r.push(`width=${t.width}`),t.height&&r.push(`height=${t.height}`),t.resize&&r.push(`resize=${t.resize}`),t.format&&r.push(`format=${t.format}`),t.quality&&r.push(`quality=${t.quality}`),r.join("&")}}const ete="2.81.1",tte={"X-Client-Info":`storage-js/${ete}`};class gje{constructor(t,r={},n,a){this.shouldThrowOnError=!1;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.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},tte),r),this.fetch=VR(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return fr(this,void 0,void 0,function*(){try{const r=this.listBucketOptionsToQueryString(t);return{data:yield f2(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}getBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:yield f2(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}createBucket(t){return fr(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield Au(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Xs(a))return{data:null,error:a};throw a}})}updateBucket(t,r){return fr(this,void 0,void 0,function*(){try{return{data:yield w6(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Xs(n))return{data:null,error:n};throw n}})}emptyBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:yield Au(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}deleteBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:yield WR(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}listBucketOptionsToQueryString(t){const r={};return t&&("limit"in t&&(r.limit=String(t.limit)),"offset"in t&&(r.offset=String(t.offset)),t.search&&(r.search=t.search),t.sortColumn&&(r.sortColumn=t.sortColumn),t.sortOrder&&(r.sortOrder=t.sortOrder)),Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():""}}class xje{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},tte),r),this.fetch=VR(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:yield Au(this.fetch,`${this.url}/bucket`,{name:t},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}listBuckets(t){return fr(this,void 0,void 0,function*(){try{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),a=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield f2(this.fetch,a,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}deleteBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:yield WR(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Xs(r))return{data:null,error:r};throw r}})}}const HR={"X-Client-Info":`storage-js/${ete}`,"Content-Type":"application/json"};class rte extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Ul(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class O3 extends rte{constructor(t,r,n){super(t),this.name="StorageVectorsApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class vje extends rte{constructor(t,r){super(t),this.name="StorageVectorsUnknownError",this.originalError=r}}var C9;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(C9||(C9={}));const GR=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),yje=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)},E9=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),bje=(e,t,r)=>fr(void 0,void 0,void 0,function*(){if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(r!=null&&r.noResolveJson)){const a=e.status||500,i=e;if(typeof i.json=="function")i.json().then(o=>{const l=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||a+"";t(new O3(E9(o),a,l))}).catch(()=>{const o=a+"",l=i.statusText||`HTTP ${a} error`;t(new O3(l,a,o))});else{const o=a+"",l=i.statusText||`HTTP ${a} error`;t(new O3(l,a,o))}}else t(new vje(E9(e),e))}),wje=(e,t,r,n)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return n?(yje(n)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(n)):a.body=n,Object.assign(Object.assign({},a),r)):a};function jje(e,t,r,n,a,i){return fr(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(r,wje(t,n,a,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;const u=c.headers.get("content-type");return!u||!u.includes("application/json")?{}:c.json()}).then(c=>o(c)).catch(c=>bje(c,l,n))})})}function ql(e,t,r,n,a){return fr(this,void 0,void 0,function*(){return jje(e,"POST",t,n,a,r)})}class _je{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},HR),r),this.fetch=GR(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return fr(this,void 0,void 0,function*(){try{return{data:(yield ql(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}getIndex(t,r){return fr(this,void 0,void 0,function*(){try{return{data:yield ql(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ul(n))return{data:null,error:n};throw n}})}listIndexes(t){return fr(this,void 0,void 0,function*(){try{return{data:yield ql(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}deleteIndex(t,r){return fr(this,void 0,void 0,function*(){try{return{data:(yield ql(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ul(n))return{data:null,error:n};throw n}})}}class Nje{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},HR),r),this.fetch=GR(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return fr(this,void 0,void 0,function*(){try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield ql(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}getVectors(t){return fr(this,void 0,void 0,function*(){try{return{data:yield ql(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}listVectors(t){return fr(this,void 0,void 0,function*(){try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:yield ql(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}queryVectors(t){return fr(this,void 0,void 0,function*(){try{return{data:yield ql(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}deleteVectors(t){return fr(this,void 0,void 0,function*(){try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield ql(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}}class Sje{constructor(t,r={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},HR),r),this.fetch=GR(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:(yield ql(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}getBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:yield ql(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}listBuckets(){return fr(this,arguments,void 0,function*(t={}){try{return{data:yield ql(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}deleteBucket(t){return fr(this,void 0,void 0,function*(){try{return{data:(yield ql(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Ul(r))return{data:null,error:r};throw r}})}}class kje extends Sje{constructor(t,r={}){super(t,r.headers||{},r.fetch)}from(t){return new Cje(this.url,this.headers,t,this.fetch)}}class Cje extends _je{constructor(t,r,n,a){super(t,r,a),this.vectorBucketName=n}createIndex(t){const r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return fr(this,void 0,void 0,function*(){return r.createIndex.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const t=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return fr(this,arguments,void 0,function*(r={}){return t.listIndexes.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}getIndex(t){const r=Object.create(null,{getIndex:{get:()=>super.getIndex}});return fr(this,void 0,void 0,function*(){return r.getIndex.call(this,this.vectorBucketName,t)})}deleteIndex(t){const r=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return fr(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new Eje(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class Eje extends Nje{constructor(t,r,n,a,i){super(t,r,i),this.vectorBucketName=n,this.indexName=a}putVectors(t){const r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return fr(this,void 0,void 0,function*(){return r.putVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(t){const r=Object.create(null,{getVectors:{get:()=>super.getVectors}});return fr(this,void 0,void 0,function*(){return r.getVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const t=Object.create(null,{listVectors:{get:()=>super.listVectors}});return fr(this,arguments,void 0,function*(r={}){return t.listVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(t){const r=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return fr(this,void 0,void 0,function*(){return r.queryVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(t){const r=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return fr(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class Aje extends gje{constructor(t,r={},n,a){super(t,r,n,a)}from(t){return new pje(this.url,this.headers,t,this.fetch)}get vectors(){return new kje(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new xje(this.url+"/iceberg",this.headers,this.fetch)}}const Tje="2.81.1";let Hb="";typeof Deno<"u"?Hb="deno":typeof document<"u"?Hb="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Hb="react-native":Hb="node";const Pje={"X-Client-Info":`supabase-js-${Hb}/${Tje}`},Oje={headers:Pje},Dje={schema:"public"},Ije={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Rje={},Lje=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Fje=()=>Headers,Mje=(e,t,r)=>{const n=Lje(r),a=Fje();return async(i,o)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let u=new a(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(i,Object.assign(Object.assign({},o),{headers:u}))}};function $je(e){return e.endsWith("/")?e:e+"/"}function Bje(e,t){var r,n;const{db:a,auth:i,realtime:o,global:l}=e,{db:c,auth:u,realtime:d,global:f}=t,m={db:Object.assign(Object.assign({},c),a),auth:Object.assign(Object.assign({},u),i),realtime:Object.assign(Object.assign({},d),o),storage:{},global:Object.assign(Object.assign(Object.assign({},f),l),{headers:Object.assign(Object.assign({},(r=f==null?void 0:f.headers)!==null&&r!==void 0?r:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?m.accessToken=e.accessToken:delete m.accessToken,m}function zje(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL($je(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const nte="2.81.1",Ix=30*1e3,j6=3,D3=j6*Ix,Uje="http://localhost:9999",qje="supabase.auth.token",Vje={"X-Client-Info":`gotrue-js/${nte}`},_6="X-Supabase-Api-Version",ste={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Wje=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Hje=10*60*1e3;class h2 extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}}function xr(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Gje extends h2{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function Kje(e){return xr(e)&&e.name==="AuthApiError"}class m0 extends h2{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class _p extends h2{constructor(t,r,n,a){super(t,n,a),this.name=r,this.status=n}}class Su extends _p{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Yje(e){return xr(e)&&e.name==="AuthSessionMissingError"}class dx extends _p{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class LN extends _p{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class FN extends _p{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function Xje(e){return xr(e)&&e.name==="AuthImplicitGrantRedirectError"}class A9 extends _p{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class N6 extends _p{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function I3(e){return xr(e)&&e.name==="AuthRetryableFetchError"}class T9 extends _p{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}}class S6 extends _p{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const H5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),P9=`
\r=`.split(""),Zje=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<P9.length;t+=1)e[P9[t].charCodeAt(0)]=-2;for(let t=0;t<H5.length;t+=1)e[H5[t].charCodeAt(0)]=t;return e})();function O9(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(H5[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(H5[n]),t.queuedBits-=6}}function ate(e,t,r){const n=Zje[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function D9(e){const t=[],r=o=>{t.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},i=o=>{e_e(o,n,r)};for(let o=0;o<e.length;o+=1)ate(e.charCodeAt(o),a,i);return t.join("")}function Jje(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 Qje(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){const a=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|a)+65536,r+=1}Jje(n,t)}}function e_e(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;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&&r(t.codepoint)}}function vv(e){const t=[],r={queue:0,queuedBits:0},n=a=>{t.push(a)};for(let a=0;a<e.length;a+=1)ate(e.charCodeAt(a),r,n);return new Uint8Array(t)}function t_e(e){const t=[];return Qje(e,r=>t.push(r)),new Uint8Array(t)}function w0(e){const t=[],r={queue:0,queuedBits:0},n=a=>{t.push(a)};return e.forEach(a=>O9(a,r,n)),O9(null,r,n),t.join("")}function r_e(e){return Math.round(Date.now()/1e3)+e}function n_e(){return Symbol("auth-callback")}const Ui=()=>typeof window<"u"&&typeof document<"u",Zp={tested:!1,writable:!1},ite=()=>{if(!Ui())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Zp.tested)return Zp.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Zp.tested=!0,Zp.writable=!0}catch{Zp.tested=!0,Zp.writable=!1}return Zp.writable};function s_e(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((a,i)=>{t[i]=a})}catch{}return r.searchParams.forEach((n,a)=>{t[a]=n}),t}const ote=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),a_e=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Rx=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},Jp=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Kh=async(e,t)=>{await e.removeItem(t)};class gC{constructor(){this.promise=new gC.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}gC.promiseConstructor=Promise;function R3(e){const t=e.split(".");if(t.length!==3)throw new S6("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!Wje.test(t[n]))throw new S6("JWT not in base64url format");return{header:JSON.parse(D9(t[0])),payload:JSON.parse(D9(t[1])),signature:vv(t[2]),raw:{header:t[0],payload:t[1]}}}async function i_e(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function o_e(e,t){return new Promise((n,a)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){n(o);return}}catch(o){if(!t(i,o)){a(o);return}}})()})}function l_e(e){return("0"+e.toString(16)).substr(-2)}function c_e(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let a="";for(let i=0;i<56;i++)a+=r.charAt(Math.floor(Math.random()*n));return a}return crypto.getRandomValues(t),Array.from(t,l_e).join("")}async function u_e(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r),a=new Uint8Array(n);return Array.from(a).map(i=>String.fromCharCode(i)).join("")}async function d_e(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 r=await u_e(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fx(e,t,r=!1){const n=c_e();let a=n;r&&(a+="/PASSWORD_RECOVERY"),await Rx(e,`${t}-code-verifier`,a);const i=await d_e(n);return[i,n===i?"plain":"s256"]}const f_e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function h_e(e){const t=e.headers.get(_6);if(!t||!t.match(f_e))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function m_e(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 p_e(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 g_e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function hx(e){if(!g_e.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function L3(){const e={};return new Proxy(e,{get:(t,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="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 "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function x_e(e,t){return new Proxy(e,{get:(r,n,a)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,a)}return!t.value&&typeof n=="string"&&(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."),t.value=!0),Reflect.get(r,n,a)}})}function I9(e){return JSON.parse(JSON.stringify(e))}const a0=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),v_e=[502,503,504];async function R9(e){var t;if(!a_e(e))throw new N6(a0(e),0);if(v_e.includes(e.status))throw new N6(a0(e),e.status);let r;try{r=await e.json()}catch(i){throw new m0(a0(i),i)}let n;const a=h_e(e);if(a&&a.getTime()>=ste["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new T9(a0(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Su}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new T9(a0(r),e.status,r.weak_password.reasons);throw new Gje(a0(r),e.status||500,n)}const y_e=(e,t,r,n)=>{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(n),Object.assign(Object.assign({},a),r))};async function Dr(e,t,r,n){var a;const i=Object.assign({},n==null?void 0:n.headers);i[_6]||(i[_6]=ste["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(a=n==null?void 0:n.query)!==null&&a!==void 0?a:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await b_e(e,t,r+l,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function b_e(e,t,r,n,a,i){const o=y_e(t,n,a,i);let l;try{l=await e(r,Object.assign({},o))}catch(c){throw console.error(c),new N6(a0(c),0)}if(l.ok||await R9(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await R9(c)}}function ku(e){var t;let r=null;__e(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=r_e(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:n},error:null}}function L9(e){const t=ku(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((r,n)=>r&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function um(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function w_e(e){return{data:e,error:null}}function j_e(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:a,verification_type:i}=e,o=jp(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:r,hashed_token:n,redirect_to:a,verification_type:i},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function F9(e){return e}function __e(e){return e.access_token&&e.refresh_token&&e.expires_in}const F3=["global","local","others"];class N_e{constructor({url:t="",headers:r={},fetch:n}){this.url=t,this.headers=r,this.fetch=ote(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(t,r=F3[0]){if(F3.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${F3.join(", ")}`);try{return await Dr(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(xr(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await Dr(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:um})}catch(n){if(xr(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=jp(t,["options"]),a=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(a.new_email=n==null?void 0:n.newEmail,delete a.newEmail),await Dr(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:j_e,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(xr(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await Dr(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:um})}catch(r){if(xr(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,a,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Dr(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:F9});if(d.error)throw d.error;const f=await d.json(),m=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,h=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return h.length>0&&(h.forEach(g=>{const p=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(g.split(";")[1].split("=")[1]);u[`${x}Page`]=p}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(xr(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){hx(t);try{return await Dr(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:um})}catch(r){if(xr(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){hx(t);try{return await Dr(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:um})}catch(n){if(xr(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){hx(t);try{return await Dr(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:um})}catch(n){if(xr(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){hx(t.userId);try{const{data:r,error:n}=await Dr(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:r,error:n}}catch(r){if(xr(r))return{data:null,error:r};throw r}}async _deleteFactor(t){hx(t.userId),hx(t.id);try{return{data:await Dr(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(xr(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,a,i,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await Dr(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&i!==void 0?i:""},xform:F9});if(d.error)throw d.error;const f=await d.json(),m=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,h=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return h.length>0&&(h.forEach(g=>{const p=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(g.split(";")[1].split("=")[1]);u[`${x}Page`]=p}),u.total=parseInt(m)),{data:Object.assign(Object.assign({},f),u),error:null}}catch(u){if(xr(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await Dr(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(xr(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await Dr(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(xr(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await Dr(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(xr(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await Dr(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(xr(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await Dr(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(xr(r))return{data:null,error:r};throw r}}}function M9(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const mx={debug:!!(globalThis&&ite()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class lte extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class S_e extends lte{}async function k_e(e,t,r){mx.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),mx.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:n.signal},async a=>{if(a){mx.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await r()}finally{mx.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw mx.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new S_e(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(mx.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 r()}}))}function C_e(){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)}}function cte(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function E_e(e){return parseInt(e,16)}function A_e(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function T_e(e){var t;const{chainId:r,domain:n,expirationTime:a,issuedAt:i=new Date,nonce:o,notBefore:l,requestId:c,resources:u,scheme:d,uri:f,version:m}=e;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const h=cte(e.address),g=d?`${d}://${n}`:n,p=e.statement?`${e.statement}
`:"",x=`${g} wants you to sign in with your Ethereum account:
${h}
${p}`;let v=`URI: ${f}
Version: ${m}
Chain ID: ${r}${o?`
Nonce: ${o}`:""}
Issued At: ${i.toISOString()}`;if(a&&(v+=`
Expiration Time: ${a.toISOString()}`),l&&(v+=`
Not Before: ${l.toISOString()}`),c&&(v+=`
Request ID: ${c}`),u){let b=`
Resources:`;for(const y of u){if(!y||typeof y!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${y}`);b+=`
- ${y}`}v+=b}return`${x}
${v}`}class Wa extends Error{constructor({message:t,code:r,cause:n,name:a}){var i;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=a??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}}class G5 extends Wa{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function P_e({error:e,options:t}){var r,n,a;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Wa({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Wa({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Wa({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((a=i.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new Wa({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new Wa({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Wa({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new Wa({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Wa({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(ute(o)){if(i.rp.id!==o)return new Wa({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Wa({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Wa({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new Wa({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Wa({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function O_e({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Wa({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Wa({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(ute(n)){if(r.rpId!==n)return new Wa({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Wa({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Wa({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Wa({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class D_e{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const I_e=new D_e;function R_e(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:n}=e,a=jp(e,["challenge","user","excludeCredentials"]),i=vv(t).buffer,o=Object.assign(Object.assign({},r),{id:vv(r.id).buffer}),l=Object.assign(Object.assign({},a),{challenge:i,user:o});if(n&&n.length>0){l.excludeCredentials=new Array(n.length);for(let c=0;c<n.length;c++){const u=n[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:vv(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function L_e(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,n=jp(e,["challenge","allowCredentials"]),a=vv(t).buffer,i=Object.assign(Object.assign({},n),{challenge:a});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const l=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},l),{id:vv(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return i}function F_e(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:w0(new Uint8Array(e.response.attestationObject)),clientDataJSON:w0(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function M_e(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,n=e.getClientExtensionResults(),a=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:w0(new Uint8Array(a.authenticatorData)),clientDataJSON:w0(new Uint8Array(a.clientDataJSON)),signature:w0(new Uint8Array(a.signature)),userHandle:a.userHandle?w0(new Uint8Array(a.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function ute(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function $9(){var e,t;return!!(Ui()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function $_e(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new G5("Browser returned unexpected credential type",t)}:{data:null,error:new G5("Empty credential response",t)}}catch(t){return{data:null,error:P_e({error:t,options:e})}}}async function B_e(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new G5("Browser returned unexpected credential type",t)}:{data:null,error:new G5("Empty credential response",t)}}catch(t){return{data:null,error:O_e({error:t,options:e})}}}const z_e={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},U_e={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function K5(...e){const t=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),r=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),n={};for(const a of e)if(a)for(const i in a){const o=a[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(r(o))n[i]=o;else if(t(o)){const l=n[i];t(l)?n[i]=K5(l,o):n[i]=K5(o)}else n[i]=o}return n}function q_e(e,t){return K5(z_e,e,t||{})}function V_e(e,t){return K5(U_e,e,t||{})}class W_e{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:n,signal:a},i){try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!o)return{data:null,error:l};const c=a??I_e.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;u.name||(u.name=`${u.id}:${n}`),u.displayName||(u.displayName=u.name)}switch(o.webauthn.type){case"create":{const u=q_e(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:f}=await $_e({publicKey:u,signal:c});return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const u=V_e(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:f}=await B_e(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(o){return xr(o)?{data:null,error:o}:{data:null,error:new m0("Unexpected error in challenge",o)}}}async _verify({challengeId:t,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!r)return{data:null,error:new h2("rpId is required for WebAuthn authentication")};try{if(!$9())return{data:null,error:new m0("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:n},signal:a},{request:i});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:n,credential_response:c.credential_response}})}catch(o){return xr(o)?{data:null,error:o}:{data:null,error:new m0("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:a}={}},i){if(!r)return{data:null,error:new h2("rpId is required for WebAuthn registration")};try{if(!$9())return{data:null,error:new m0("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(d=>{var f;return(f=d.data)===null||f===void 0?void 0:f.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===t&&m.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:a},{create:i});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(o){return xr(o)?{data:null,error:o}:{data:null,error:new m0("Unexpected error in register",o)}}}}C_e();const H_e={url:Uje,storageKey:qje,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Vje,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function B9(e,t,r){return await r()}const px={};class m2{get jwks(){var t,r;return(r=(t=px[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){px[this.storageKey]=Object.assign(Object.assign({},px[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=px[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){px[this.storageKey]=Object.assign(Object.assign({},px[this.storageKey]),{cachedAt:t})}constructor(t){var r,n,a;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;const i=Object.assign(Object.assign({},H_e),t);if(this.storageKey=i.storageKey,this.instanceID=(r=m2.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,m2.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&Ui()){const o=`${this._logPrefix()} 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.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.admin=new N_e({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=ote(i.fetch),this.lock=i.lock||B9,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:Ui()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=k_e:this.lock=B9,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),webauthn:new W_e(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:ite()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=M9(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=M9(this.memoryStorage)),Ui()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(a=this.broadcastChannel)===null||a===void 0||a.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${nte}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...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{let r={},n="none";if(Ui()&&(r=s_e(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Ui()&&this.detectSessionInUrl&&n!=="none"){const{data:a,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Xje(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(r){return xr(r)?this._returnResult({error:r}):this._returnResult({error:new m0("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,a;try{const i=await Dr(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(a=t==null?void 0:t.options)===null||a===void 0?void 0:a.captchaToken}},xform:ku}),{data:o,error:l}=i;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(xr(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var r,n,a;try{let i;if("email"in t){const{email:d,password:f,options:m}=t;let h=null,g=null;this.flowType==="pkce"&&([h,g]=await fx(this.storage,this.storageKey)),i=await Dr(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:d,password:f,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:h,code_challenge_method:g},xform:ku})}else if("phone"in t){const{phone:d,password:f,options:m}=t;i=await Dr(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:f,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},channel:(a=m==null?void 0:m.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:ku})}else throw new LN("You must provide either an email or phone number and a password");const{data:o,error:l}=i;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(i){if(xr(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let r;if("email"in t){const{email:i,password:o,options:l}=t;r=await Dr(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:L9})}else if("phone"in t){const{phone:i,password:o,options:l}=t;r=await Dr(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:L9})}else throw new LN("You must provide either an email or phone number and a password");const{data:n,error:a}=r;if(a)return this._returnResult({data:{user:null,session:null},error:a});if(!n||!n.session||!n.user){const i=new dx;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:a})}catch(r){if(xr(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,n,a,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.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:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,n,a,i,o,l,c,u,d,f,m;let h,g;if("message"in t)h=t.message,g=t.signature;else{const{chain:p,wallet:x,statement:v,options:b}=t;let y;if(Ui())if(typeof x=="object")y=x;else{const P=window;if("ethereum"in P&&typeof P.ethereum=="object"&&"request"in P.ethereum&&typeof P.ethereum.request=="function")y=P.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) 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: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof x!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=x}const N=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href),_=await y.request({method:"eth_requestAccounts"}).then(P=>P).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!_||_.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const j=cte(_[0]);let S=(n=b==null?void 0:b.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!S){const P=await y.request({method:"eth_chainId"});S=E_e(P)}const I={domain:N.host,address:j,statement:v,uri:N.href,version:"1",chainId:S,nonce:(a=b==null?void 0:b.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(o=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=b==null?void 0:b.signInWithEthereum)===null||d===void 0?void 0:d.resources};h=T_e(I),g=await y.request({method:"personal_sign",params:[A_e(h),j]})}try{const{data:p,error:x}=await Dr(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:g},!((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:ku});if(x)throw x;if(!p||!p.session||!p.user){const v=new dx;return this._returnResult({data:{user:null,session:null},error:v})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:Object.assign({},p),error:x})}catch(p){if(xr(p))return this._returnResult({data:{user:null,session:null},error:p});throw p}}async signInWithSolana(t){var r,n,a,i,o,l,c,u,d,f,m,h;let g,p;if("message"in t)g=t.message,p=t.signature;else{const{chain:x,wallet:v,statement:b,options:y}=t;let N;if(Ui())if(typeof v=="object")N=v;else{const j=window;if("solana"in j&&typeof j.solana=="object"&&("signIn"in j.solana&&typeof j.solana.signIn=="function"||"signMessage"in j.solana&&typeof j.solana.signMessage=="function"))N=j.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 v!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=v}const _=new URL((r=y==null?void 0:y.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in N&&N.signIn){const j=await N.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},y==null?void 0:y.signInWithSolana),{version:"1",domain:_.host,uri:_.href}),b?{statement:b}:null));let S;if(Array.isArray(j)&&j[0]&&typeof j[0]=="object")S=j[0];else if(j&&typeof j=="object"&&"signedMessage"in j&&"signature"in j)S=j;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in S&&"signature"in S&&(typeof S.signedMessage=="string"||S.signedMessage instanceof Uint8Array)&&S.signature instanceof Uint8Array)g=typeof S.signedMessage=="string"?S.signedMessage:new TextDecoder().decode(S.signedMessage),p=S.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in N)||typeof N.signMessage!="function"||!("publicKey"in N)||typeof N!="object"||!N.publicKey||!("toBase58"in N.publicKey)||typeof N.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${_.host} wants you to sign in with your Solana account:`,N.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${_.href}`,`Issued At: ${(a=(n=y==null?void 0:y.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((i=y==null?void 0:y.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${y.signInWithSolana.notBefore}`]:[],...!((o=y==null?void 0:y.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${y.signInWithSolana.expirationTime}`]:[],...!((l=y==null?void 0:y.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${y.signInWithSolana.chainId}`]:[],...!((c=y==null?void 0:y.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${y.signInWithSolana.nonce}`]:[],...!((u=y==null?void 0:y.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${y.signInWithSolana.requestId}`]:[],...!((f=(d=y==null?void 0:y.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||f===void 0)&&f.length?["Resources",...y.signInWithSolana.resources.map(S=>`- ${S}`)]:[]].join(`
`);const j=await N.signMessage(new TextEncoder().encode(g),"utf8");if(!j||!(j instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=j}}try{const{data:x,error:v}=await Dr(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:w0(p)},!((m=t.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:ku});if(v)throw v;if(!x||!x.session||!x.user){const b=new dx;return this._returnResult({data:{user:null,session:null},error:b})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:v})}catch(x){if(xr(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async _exchangeCodeForSession(t){const r=await Jp(this.storage,`${this.storageKey}-code-verifier`),[n,a]=(r??"").split("/");try{const{data:i,error:o}=await Dr(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:ku});if(await Kh(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const l=new dx;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:a??null}),error:o})}catch(i){if(xr(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:r,provider:n,token:a,access_token:i,nonce:o}=t,l=await Dr(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:a,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ku}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new dx;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(xr(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,n,a,i,o;try{if("email"in t){const{email:l,options:c}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await fx(this.storage,this.storageKey));const{error:f}=await Dr(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in t){const{phone:l,options:c}=t,{data:u,error:d}=await Dr(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 this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new LN("You must provide either an email or phone number.")}catch(l){if(xr(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var r,n;try{let a,i;"options"in t&&(a=(r=t.options)===null||r===void 0?void 0:r.redirectTo,i=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await Dr(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:a,xform:ku});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(a){if(xr(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSSO(t){var r,n,a,i,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await fx(this.storage,this.storageKey));const u=await Dr(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:(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n: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:l,code_challenge_method:c}),headers:this.headers,xform:w_e});return!((i=u.data)===null||i===void 0)&&i.url&&Ui()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(xr(l))return this._returnResult({data:null,error:l});throw l}}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:r},error:n}=t;if(n)throw n;if(!r)throw new Su;const{error:a}=await Dr(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:a})})}catch(t){if(xr(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:n,type:a,options:i}=t,{error:o}=await Dr(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:n,type:a,options:i}=t,{data:o,error:l}=await Dr(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:a,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l})}throw new LN("You must provide either an email or phone number and a type")}catch(r){if(xr(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await n,await r()))();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 n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await n}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 r=await this.__loadSession();return await t(r)}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 r=await Jp(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<D3:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const o=await Jp(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=L3()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=x_e(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({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 Dr(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:um}):await this._useSession(async r=>{var n,a,i;const{data:o,error:l}=r;if(l)throw l;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Su}:await Dr(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:um})})}catch(r){if(xr(r))return Yje(r)&&(await this._removeSession(),await Kh(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async n=>{const{data:a,error:i}=n;if(i)throw i;if(!a.session)throw new Su;const o=a.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await fx(this.storage,this.storageKey));const{data:u,error:d}=await Dr(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:um});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(xr(n))return this._returnResult({data:{user:null},error:n});throw n}}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 Su;const r=Date.now()/1e3;let n=r,a=!0,i=null;const{payload:o}=R3(t.access_token);if(o.exp&&(n=o.exp,a=n<=r),a){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({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:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(xr(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}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 r=>{var n;if(!t){const{data:o,error:l}=r;if(l)throw l;t=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new Su;const{data:a,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):a?this._returnResult({data:{user:a.user,session:a},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(xr(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){try{if(!Ui())throw new FN("No browser detected.");if(t.error||t.error_description||t.error_code)throw new FN(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new A9("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new FN("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new A9("No code detected.");const{data:b,error:y}=await this._exchangeCodeForSession(t.code);if(y)throw y;const N=new URL(window.location.href);return N.searchParams.delete("code"),window.history.replaceState(window.history.state,"",N.toString()),{data:{session:b.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:a,access_token:i,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=t;if(!i||!l||!o||!u)throw new FN("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(l);let m=d+f;c&&(m=parseInt(c));const h=m-d;h*1e3<=Ix&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${f}s`);const g=m-f;d-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,m,d):d-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,m,d);const{data:p,error:x}=await this._getUser(i);if(x)throw x;const v={provider_token:n,provider_refresh_token:a,access_token:i,expires_in:f,expires_at:m,refresh_token:o,token_type:u,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:t.type},error:null})}catch(n){if(xr(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(t){return!!(t.access_token||t.error_description)}async _isPKCECallback(t){const r=await Jp(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}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 r=>{var n;const{data:a,error:i}=r;if(i)return this._returnResult({error:i});const o=(n=a.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(Kje(l)&&(l.status===404||l.status===401||l.status===403)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await Kh(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=n_e(),n={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async r=>{var n,a;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.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,r={}){let n=null,a=null;this.flowType==="pkce"&&([n,a]=await fx(this.storage,this.storageKey,!0));try{return await Dr(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:a,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(xr(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(xr(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:n,error:a}=await this._useSession(async i=>{var o,l,c,u,d;const{data:f,error:m}=i;if(m)throw m;const h=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 Dr(this.fetch,"GET",h,{headers:this.headers,jwt:(d=(u=f.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(a)throw a;return Ui()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(xr(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var n;try{const{error:a,data:{session:i}}=r;if(a)throw a;const{options:o,provider:l,token:c,access_token:u,nonce:d}=t,f=await Dr(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ku}),{data:m,error:h}=f;return h?this._returnResult({data:{user:null,session:null},error:h}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new dx}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:h}))}catch(a){if(xr(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var n,a;const{data:i,error:o}=r;if(o)throw o;return await Dr(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&a!==void 0?a:void 0})})}catch(r){if(xr(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await o_e(async a=>(a>0&&await i_e(200*Math.pow(2,a-1)),this._debug(r,"refreshing attempt",a),await Dr(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ku})),(a,i)=>{const o=200*Math.pow(2,a);return i&&I3(i)&&Date.now()+o-n<Ix})}catch(n){if(this._debug(r,"error",n),xr(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",n),Ui()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const a=await Jp(this.storage,this.storageKey);if(a&&this.userStorage){let o=await Jp(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:a.user},await Rx(this.userStorage,this.storageKey+"-user",o)),a.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:L3()}else if(a&&!a.user&&!a.user){const o=await Jp(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(a.user=o.user,await Kh(this.storage,this.storageKey+"-user"),await Rx(this.storage,this.storageKey,a)):a.user=L3()}if(this._debug(n,"session from storage",a),!this._isValidSession(a)){this._debug(n,"session is not valid"),a!==null&&await this._removeSession();return}const i=((r=a.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<D3;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${D3}s`),i){if(this.autoRefreshToken&&a.refresh_token){const{error:o}=await this._callRefreshToken(a.refresh_token);o&&(console.error(o),I3(o)||(this._debug(n,"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(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",a)}catch(a){this._debug(n,"error",a),console.error(a);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var r,n;if(!t)throw new Su;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const a=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new gC;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Su;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const l={data:i.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(i){if(this._debug(a,"error",i),xr(i)){const o={data:null,error:i};return I3(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(t,r,n=!0){const a=`#_notifyAllSubscribers(${t})`;this._debug(a,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,r)}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 r=Object.assign({},t),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Rx(this.userStorage,this.storageKey+"-user",{user:r.user});const a=Object.assign({},r);delete a.user;const i=I9(a);await Rx(this.storage,this.storageKey,i)}else{const a=I9(r);await Rx(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),await Kh(this.storage,this.storageKey),await Kh(this.storage,this.storageKey+"-code-verifier"),await Kh(this.storage,this.storageKey+"-user"),this.userStorage&&await Kh(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ui()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Ix);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 r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((n.expires_at*1e3-t)/Ix);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${Ix}ms, refresh threshold is ${j6} ticks`),a<=j6&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof lte)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ui()||!(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 r=`#_onVisibilityChanged(${t})`;this._debug(r,"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(r,"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,r,n){const a=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&a.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&a.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await fx(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});a.push(l.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);a.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&a.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var n;const{data:a,error:i}=r;return i?this._returnResult({data:null,error:i}):await Dr(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(xr(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var n,a;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:c,error:u}=await Dr(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(t.factorType==="totp"&&c.type==="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}`),this._returnResult({data:c,error:null}))})}catch(r){if(xr(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:a,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?F_e(t.webauthn.credential_response):M_e(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await Dr(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(r){if(xr(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;const{data:a,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await Dr(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;const{data:l}=o;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:R_e(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:L_e(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(xr(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(t){const{data:r,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const a={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])a.all.push(i),i.status==="verified"&&a[i.factor_type].push(i);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(){var t,r;const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:i}=R3(n.access_token);let o=null;i.aal&&(o=i.aal);let l=o;((r=(t=n.user.factors)===null||t===void 0?void 0:t.filter(d=>d.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(l="aal2");const u=i.amr||[];return{data:{currentLevel:o,nextLevel:l,currentAuthenticationMethods:u},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:n},error:a}=r;return a?this._returnResult({data:null,error:a}):n?await Dr(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Su})})}catch(r){if(xr(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:a},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Su});const o=await Dr(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Ui()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(xr(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:a},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!a)return this._returnResult({data:null,error:new Su});const o=await Dr(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&Ui()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(xr(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,r={keys:[]}){let n=r.keys.find(l=>l.kid===t);if(n)return n;const a=Date.now();if(n=this.jwks.keys.find(l=>l.kid===t),n&&this.jwks_cached_at+Hje>a)return n;const{data:i,error:o}=await Dr(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,n=i.keys.find(l=>l.kid===t),!n)?null:n}async getClaims(t,r={}){try{let n=t;if(!n){const{data:h,error:g}=await this.getSession();if(g||!h.session)return this._returnResult({data:null,error:g});n=h.session.access_token}const{header:a,payload:i,signature:o,raw:{header:l,payload:c}}=R3(n);r!=null&&r.allowExpired||m_e(i.exp);const u=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:h}=await this.getUser(n);if(h)throw h;return{data:{claims:i,header:a,signature:o},error:null}}const d=p_e(a.alg),f=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,f,o,t_e(`${l}.${c}`)))throw new S6("Invalid JWT signature");return{data:{claims:i,header:a,signature:o},error:null}}catch(n){if(xr(n))return this._returnResult({data:null,error:n});throw n}}}m2.nextInstanceID={};const G_e=m2;class K_e extends G_e{constructor(t){super(t)}}class Y_e{constructor(t,r,n){var a,i,o;this.supabaseUrl=t,this.supabaseKey=r;const l=zje(t);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const c=`sb-${l.hostname.split(".")[0]}-auth-token`,u={db:Dje,realtime:Rje,auth:Object.assign(Object.assign({},Ije),{storageKey:c}),global:Oje},d=Bje(n??{},u);this.storageKey=(a=d.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(i=d.global.headers)!==null&&i!==void 0?i:{},d.accessToken?(this.accessToken=d.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=d.auth)!==null&&o!==void 0?o:{},this.headers,d.global.fetch),this.fetch=Mje(r,this._getAccessToken.bind(this),d.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},d.realtime)),this.accessToken&&this.accessToken().then(f=>this.realtime.setAuth(f)).catch(f=>console.warn("Failed to set initial Realtime auth token:",f)),this.rest=new U2e(new URL("rest/v1",l).href,{headers:this.headers,schema:d.db.schema,fetch:this.fetch}),this.storage=new Aje(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),d.accessToken||this._listenForAuthEvents()}get functions(){return new $2e(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,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,r,n)}channel(t,r={config:{}}){return this.realtime.channel(t,r)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t,r;if(this.accessToken)return await this.accessToken();const{data:n}=await this.auth.getSession();return(r=(t=n.session)===null||t===void 0?void 0:t.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:r,detectSessionInUrl:n,storage:a,userStorage:i,storageKey:o,flowType:l,lock:c,debug:u,throwOnError:d},f,m){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K_e({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),f),storageKey:o,autoRefreshToken:t,persistSession:r,detectSessionInUrl:n,storage:a,userStorage:i,flowType:l,lock:c,debug:u,throwOnError:d,fetch:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(g=>g.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new aje(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((r,n)=>{this._handleTokenChanged(r,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(t,r,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const X_e=(e,t,r)=>new Y_e(e,t,r);function Z_e(){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}Z_e()&&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");const J_e="https://pedagobridge.com",Q_e="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzc2MjQzNzQyLCJleHAiOjIwOTE2MDM3NDJ9.73Zk3EieShL_u8EKlAW2LekPnT1agaI3de2bE8hkWq4",he=X_e(J_e,Q_e,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}});class eNe{constructor(){zn(this,"sessionId");if(typeof window<"u"){const t=sessionStorage.getItem("app_session_id");t?this.sessionId=t:(this.sessionId=`${Date.now()}-${Math.random().toString(36).substring(2,11)}`,sessionStorage.setItem("app_session_id",this.sessionId))}else this.sessionId="server"}async getCurrentUser(){try{const{data:{user:t}}=await he.auth.getUser();return t}catch{return null}}async log(t){try{const r=await this.getCurrentUser(),a={...(t.context?JSON.parse(JSON.stringify(t.context)):null)||{},sessionId:this.sessionId},{error:i}=await he.from("app_logs").insert([{level:t.level,message:t.message,context:a,user_id:t.userId||(r==null?void 0:r.id)||null,user_email:t.userEmail||(r==null?void 0:r.email)||null,page_url:typeof window<"u"?window.location.href:null,user_agent:typeof navigator<"u"?navigator.userAgent:null,ip_address:null}]);i&&console.error("Failed to save log:",i)}catch(r){console.error("Logger error:",r)}}info(t,r){this.log({level:"info",message:t,context:r})}warning(t,r){this.log({level:"warning",message:t,context:r})}error(t,r,n){const a={...n,errorCode:r instanceof Error?r.name:"Unknown",errorStack:r instanceof Error?r.stack:String(r)};this.log({level:"error",message:t,context:a})}pageView(t,r){this.info(`Page view: ${t}`,{action:"page_view",component:t,metadata:r})}formSubmit(t,r,n){r?this.info(`Form submitted: ${t}`,{action:"form_submit",formName:t,metadata:{...n,success:!0}}):this.warning(`Form submission failed: ${t}`,{action:"form_submit_failed",formName:t,metadata:{...n,success:!1}})}action(t,r,n){this.info(`Action: ${t}`,{action:t,component:r,metadata:n})}auth(t,r,n){const a=r?"info":"error",i=r?`Auth ${t} successful`:`Auth ${t} failed`;this.log({level:a,message:i,context:{action:`auth_${t}`,metadata:{...n,success:r}}})}}const Ai=new eNe;let M3=!1;if(typeof window<"u"){const e=console.error.bind(console);console.error=(...t)=>{if(e(...t),M3)return;const r=typeof t[0]=="string"?t[0]:"";if(!(r.startsWith("Failed to save log")||r.startsWith("Logger error")||r.startsWith("[ERROR]")||r.startsWith("[WARNING]")||r.startsWith("[INFO]"))){M3=!0;try{const n=t.map(i=>i instanceof Error?i.message:typeof i=="string"?i:(()=>{try{return JSON.stringify(i)}catch{return String(i)}})()).join(" ").slice(0,500),a=t.find(i=>i instanceof Error);Ai.error(n||"console.error",a,{action:"console_error"})}finally{M3=!1}}}}const dte=w.createContext(void 0);function tNe({children:e}){const[t,r]=w.useState(null),[n,a]=w.useState(null),[i,o]=w.useState(!1),[l,c]=w.useState(!1),[u,d]=w.useState(!1),[f,m]=w.useState(!0);w.useEffect(()=>{let p=!0;const{data:{subscription:x}}=he.auth.onAuthStateChange((v,b)=>{var y,N,_;p&&(v==="SIGNED_IN"?Ai.auth("login",!0,{email:(y=b==null?void 0:b.user)==null?void 0:y.email}):v==="SIGNED_OUT"?Ai.auth("logout",!0):v==="USER_UPDATED"?Ai.info("User updated",{action:"user_updated",metadata:{userId:(N=b==null?void 0:b.user)==null?void 0:N.id}}):v==="PASSWORD_RECOVERY"&&Ai.auth("password_reset",!0,{email:(_=b==null?void 0:b.user)==null?void 0:_.email}),a(b),r((b==null?void 0:b.user)??null),b!=null&&b.user?setTimeout(()=>{p&&h(b.user.id)},0):(o(!1),c(!1),d(!1),m(!1)))});return he.auth.getSession().then(({data:{session:v}})=>{p&&(a(v),r((v==null?void 0:v.user)??null),v!=null&&v.user?h(v.user.id):m(!1))}),()=>{p=!1,x.unsubscribe()}},[]);const h=async p=>{try{const{data:x,error:v}=await he.from("user_roles").select("role").eq("user_id",p);if(v)console.error("Error fetching roles:",v),o(!1),c(!1),d(!1);else if(x){const b=x.map(y=>y.role);o(b.includes("admin")),c(b.includes("trainer")),d(b.includes("school"))}}catch(x){console.error("Error checking roles:",x),o(!1),c(!1),d(!1)}finally{m(!1)}},g=async()=>{Ai.auth("logout",!0,{userId:t==null?void 0:t.id}),await he.auth.signOut(),r(null),a(null),o(!1),c(!1),d(!1)};return s.jsx(dte.Provider,{value:{user:t,session:n,isAdmin:i,isTrainer:l,isSchool:u,loading:f,signOut:g},children:e})}function Ur(){const e=w.useContext(dte);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function bn({children:e,requireAdmin:t,requireTrainer:r}){const{user:n,isAdmin:a,isTrainer:i,loading:o}=Ur(),l=Xt();return w.useEffect(()=>{o||(n?(t&&!a||r&&!i&&!a)&&l("/"):l("/auth"))},[n,a,i,o,l,t,r]),o?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx(at,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),s.jsx("p",{className:"text-muted-foreground",children:"Chargement..."})]})}):!n||t&&!a||r&&!i&&!a?null:s.jsx(s.Fragment,{children:e})}const z9="/assets/logo-DpJyQIgQ.jpg",p2=Wy("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"}}),ne=w.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},i)=>{const o=n?bJ:"button";return s.jsx(o,{className:pt(p2({variant:t,size:r,className:e})),ref:i,...a})});ne.displayName="Button";var $3="focusScope.autoFocusOnMount",B3="focusScope.autoFocusOnUnmount",U9={bubbles:!1,cancelable:!0},rNe="FocusScope",Uj=w.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=e,[l,c]=w.useState(null),u=ha(a),d=ha(i),f=w.useRef(null),m=Cr(t,p=>c(p)),h=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(n){let p=function(y){if(h.paused||!l)return;const N=y.target;l.contains(N)?f.current=N:nm(f.current,{select:!0})},x=function(y){if(h.paused||!l)return;const N=y.relatedTarget;N!==null&&(l.contains(N)||nm(f.current,{select:!0}))},v=function(y){if(document.activeElement===document.body)for(const _ of y)_.removedNodes.length>0&&nm(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",x);const b=new MutationObserver(v);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",x),b.disconnect()}}},[n,l,h.paused]),w.useEffect(()=>{if(l){V9.add(h);const p=document.activeElement;if(!l.contains(p)){const v=new CustomEvent($3,U9);l.addEventListener($3,u),l.dispatchEvent(v),v.defaultPrevented||(nNe(lNe(fte(l)),{select:!0}),document.activeElement===p&&nm(l))}return()=>{l.removeEventListener($3,u),setTimeout(()=>{const v=new CustomEvent(B3,U9);l.addEventListener(B3,d),l.dispatchEvent(v),v.defaultPrevented||nm(p??document.body,{select:!0}),l.removeEventListener(B3,d),V9.remove(h)},0)}}},[l,u,d,h]);const g=w.useCallback(p=>{if(!r&&!n||h.paused)return;const x=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,v=document.activeElement;if(x&&v){const b=p.currentTarget,[y,N]=sNe(b);y&&N?!p.shiftKey&&v===N?(p.preventDefault(),r&&nm(y,{select:!0})):p.shiftKey&&v===y&&(p.preventDefault(),r&&nm(N,{select:!0})):v===b&&p.preventDefault()}},[r,n,h.paused]);return s.jsx(zt.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});Uj.displayName=rNe;function nNe(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(nm(n,{select:t}),document.activeElement!==r)return}function sNe(e){const t=fte(e),r=q9(t,e),n=q9(t.reverse(),e);return[r,n]}function fte(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function q9(e,t){for(const r of e)if(!aNe(r,{upTo:t}))return r}function aNe(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 iNe(e){return e instanceof HTMLInputElement&&"select"in e}function nm(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&iNe(e)&&t&&e.select()}}var V9=oNe();function oNe(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=W9(e,t),e.unshift(t)},remove(t){var r;e=W9(e,t),(r=e[0])==null||r.resume()}}}function W9(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function lNe(e){return e.filter(t=>t.tagName!=="A")}var z3=0;function xC(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??H9()),document.body.insertAdjacentElement("beforeend",e[1]??H9()),z3++,()=>{z3===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),z3--}},[])}function H9(){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 t5="right-scroll-bar-position",r5="width-before-scroll-bar",cNe="with-scroll-bars-hidden",uNe="--removed-body-scroll-bar-size";function U3(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function dNe(e,t){var r=w.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var fNe=typeof window<"u"?w.useLayoutEffect:w.useEffect,G9=new WeakMap;function hNe(e,t){var r=dNe(null,function(n){return e.forEach(function(a){return U3(a,n)})});return fNe(function(){var n=G9.get(r);if(n){var a=new Set(n),i=new Set(e),o=r.current;a.forEach(function(l){i.has(l)||U3(l,null)}),i.forEach(function(l){a.has(l)||U3(l,o)})}G9.set(r,e)},[e]),r}function mNe(e){return e}function pNe(e,t){t===void 0&&(t=mNe);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(i){var o=t(i,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(n=!0;r.length;){var o=r;r=[],o.forEach(i)}r={push:function(l){return i(l)},filter:function(){return r}}},assignMedium:function(i){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(i),o=r}var c=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return a}function gNe(e){e===void 0&&(e={});var t=pNe(null);return t.options=Rc({async:!0,ssr:!1},e),t}var hte=function(e){var t=e.sideCar,r=jp(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return w.createElement(n,Rc({},r))};hte.isSideCarExport=!0;function xNe(e,t){return e.useMedium(t),hte}var mte=gNe(),q3=function(){},vC=w.forwardRef(function(e,t){var r=w.useRef(null),n=w.useState({onScrollCapture:q3,onWheelCapture:q3,onTouchMoveCapture:q3}),a=n[0],i=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,h=e.noRelative,g=e.noIsolation,p=e.inert,x=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,y=e.gapMode,N=jp(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=m,j=hNe([r,t]),S=Rc(Rc({},N),a);return w.createElement(w.Fragment,null,d&&w.createElement(_,{sideCar:mte,removeScrollBar:u,shards:f,noRelative:h,noIsolation:g,inert:p,setCallbacks:i,allowPinchZoom:!!x,lockRef:r,gapMode:y}),o?w.cloneElement(w.Children.only(l),Rc(Rc({},S),{ref:j})):w.createElement(b,Rc({},S,{className:c,ref:j}),l))});vC.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vC.classNames={fullWidth:r5,zeroRight:t5};var vNe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function yNe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=vNe();return t&&e.setAttribute("nonce",t),e}function bNe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function wNe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var jNe=function(){var e=0,t=null;return{add:function(r){e==0&&(t=yNe())&&(bNe(t,r),wNe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_Ne=function(){var e=jNe();return function(t,r){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},pte=function(){var e=_Ne(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},NNe={left:0,top:0,right:0,gap:0},V3=function(e){return parseInt(e||"",10)||0},SNe=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[V3(r),V3(n),V3(a)]},kNe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return NNe;var t=SNe(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},CNe=pte(),yv="data-scroll-locked",ENe=function(e,t,r,n){var a=e.left,i=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
.`.concat(cNe,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(l,"px ").concat(n,`;
}
body[`).concat(yv,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(a,`px;
padding-top: `).concat(i,`px;
padding-right: `).concat(o,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(l,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(t5,` {
right: `).concat(l,"px ").concat(n,`;
}
.`).concat(r5,` {
margin-right: `).concat(l,"px ").concat(n,`;
}
.`).concat(t5," .").concat(t5,` {
right: 0 `).concat(n,`;
}
.`).concat(r5," .").concat(r5,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(yv,`] {
`).concat(uNe,": ").concat(l,`px;
}
`)},K9=function(){var e=parseInt(document.body.getAttribute(yv)||"0",10);return isFinite(e)?e:0},ANe=function(){w.useEffect(function(){return document.body.setAttribute(yv,(K9()+1).toString()),function(){var e=K9()-1;e<=0?document.body.removeAttribute(yv):document.body.setAttribute(yv,e.toString())}},[])},TNe=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;ANe();var i=w.useMemo(function(){return kNe(a)},[a]);return w.createElement(CNe,{styles:ENe(i,!t,a,r?"":"!important")})},k6=!1;if(typeof window<"u")try{var MN=Object.defineProperty({},"passive",{get:function(){return k6=!0,!0}});window.addEventListener("test",MN,MN),window.removeEventListener("test",MN,MN)}catch{k6=!1}var gx=k6?{passive:!1}:!1,PNe=function(e){return e.tagName==="TEXTAREA"},gte=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!PNe(e)&&r[t]==="visible")},ONe=function(e){return gte(e,"overflowY")},DNe=function(e){return gte(e,"overflowX")},Y9=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=xte(e,n);if(a){var i=vte(e,n),o=i[1],l=i[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},INe=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},RNe=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},xte=function(e,t){return e==="v"?ONe(t):DNe(t)},vte=function(e,t){return e==="v"?INe(t):RNe(t)},LNe=function(e,t){return e==="h"&&t==="rtl"?-1:1},FNe=function(e,t,r,n,a){var i=LNe(e,window.getComputedStyle(t).direction),o=i*n,l=r.target,c=t.contains(l),u=!1,d=o>0,f=0,m=0;do{if(!l)break;var h=vte(e,l),g=h[0],p=h[1],x=h[2],v=p-x-i*g;(g||v)&&xte(e,l)&&(f+=v,m+=g);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(u=!0),u},$N=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},X9=function(e){return[e.deltaX,e.deltaY]},Z9=function(e){return e&&"current"in e?e.current:e},MNe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$Ne=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},BNe=0,xx=[];function zNe(e){var t=w.useRef([]),r=w.useRef([0,0]),n=w.useRef(),a=w.useState(BNe++)[0],i=w.useState(pte)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var p=$R([e.lockRef.current],(e.shards||[]).map(Z9),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=w.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!o.current.allowPinchZoom;var v=$N(p),b=r.current,y="deltaX"in p?p.deltaX:b[0]-v[0],N="deltaY"in p?p.deltaY:b[1]-v[1],_,j=p.target,S=Math.abs(y)>Math.abs(N)?"h":"v";if("touches"in p&&S==="h"&&j.type==="range")return!1;var I=Y9(S,j);if(!I)return!0;if(I?_=S:(_=S==="v"?"h":"v",I=Y9(S,j)),!I)return!1;if(!n.current&&"changedTouches"in p&&(y||N)&&(n.current=_),!_)return!0;var P=n.current||_;return FNe(P,x,p,P==="h"?y:N)},[]),c=w.useCallback(function(p){var x=p;if(!(!xx.length||xx[xx.length-1]!==i)){var v="deltaY"in x?X9(x):$N(x),b=t.current.filter(function(_){return _.name===x.type&&(_.target===x.target||x.target===_.shadowParent)&&MNe(_.delta,v)})[0];if(b&&b.should){x.cancelable&&x.preventDefault();return}if(!b){var y=(o.current.shards||[]).map(Z9).filter(Boolean).filter(function(_){return _.contains(x.target)}),N=y.length>0?l(x,y[0]):!o.current.noIsolation;N&&x.cancelable&&x.preventDefault()}}},[]),u=w.useCallback(function(p,x,v,b){var y={name:p,delta:x,target:v,should:b,shadowParent:UNe(v)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(N){return N!==y})},1)},[]),d=w.useCallback(function(p){r.current=$N(p),n.current=void 0},[]),f=w.useCallback(function(p){u(p.type,X9(p),p.target,l(p,e.lockRef.current))},[]),m=w.useCallback(function(p){u(p.type,$N(p),p.target,l(p,e.lockRef.current))},[]);w.useEffect(function(){return xx.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,gx),document.addEventListener("touchmove",c,gx),document.addEventListener("touchstart",d,gx),function(){xx=xx.filter(function(p){return p!==i}),document.removeEventListener("wheel",c,gx),document.removeEventListener("touchmove",c,gx),document.removeEventListener("touchstart",d,gx)}},[]);var h=e.removeScrollBar,g=e.inert;return w.createElement(w.Fragment,null,g?w.createElement(i,{styles:$Ne(a)}):null,h?w.createElement(TNe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function UNe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const qNe=xNe(mte,zNe);var qj=w.forwardRef(function(e,t){return w.createElement(vC,Rc({},e,{ref:t,sideCar:qNe}))});qj.classNames=vC.classNames;var VNe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},vx=new WeakMap,BN=new WeakMap,zN={},W3=0,yte=function(e){return e&&(e.host||yte(e.parentNode))},WNe=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=yte(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},HNe=function(e,t,r,n){var a=WNe(t,Array.isArray(e)?e:[e]);zN[r]||(zN[r]=new WeakMap);var i=zN[r],o=[],l=new Set,c=new Set(a),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};a.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))d(m);else try{var h=m.getAttribute(n),g=h!==null&&h!=="false",p=(vx.get(m)||0)+1,x=(i.get(m)||0)+1;vx.set(m,p),i.set(m,x),o.push(m),p===1&&g&&BN.set(m,!0),x===1&&m.setAttribute(r,"true"),g||m.setAttribute(n,"true")}catch(v){console.error("aria-hidden: cannot operate on ",m,v)}})};return d(t),l.clear(),W3++,function(){o.forEach(function(f){var m=vx.get(f)-1,h=i.get(f)-1;vx.set(f,m),i.set(f,h),m||(BN.has(f)||f.removeAttribute(n),BN.delete(f)),h||f.removeAttribute(r)}),W3--,W3||(vx=new WeakMap,vx=new WeakMap,BN=new WeakMap,zN={})}},yC=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=VNe(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live]"))),HNe(n,a,r,"aria-hidden")):function(){return null}},bC="Dialog",[bte,wte]=Xa(bC),[GNe,nd]=bte(bC),jte=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:o=!0}=e,l=w.useRef(null),c=w.useRef(null),[u,d]=Wo({prop:n,defaultProp:a??!1,onChange:i,caller:bC});return s.jsx(GNe,{scope:t,triggerRef:l,contentRef:c,contentId:Ga(),titleId:Ga(),descriptionId:Ga(),open:u,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(f=>!f),[d]),modal:o,children:r})};jte.displayName=bC;var _te="DialogTrigger",Nte=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=nd(_te,r),i=Cr(t,a.triggerRef);return s.jsx(zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":XR(a.open),...n,ref:i,onClick:Ct(e.onClick,a.onOpenToggle)})});Nte.displayName=_te;var KR="DialogPortal",[KNe,Ste]=bte(KR,{forceMount:void 0}),kte=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,i=nd(KR,t);return s.jsx(KNe,{scope:t,forceMount:r,children:w.Children.map(n,o=>s.jsx(Za,{present:r||i.open,children:s.jsx(Vy,{asChild:!0,container:a,children:o})}))})};kte.displayName=KR;var Y5="DialogOverlay",Cte=w.forwardRef((e,t)=>{const r=Ste(Y5,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=nd(Y5,e.__scopeDialog);return i.modal?s.jsx(Za,{present:n||i.open,children:s.jsx(XNe,{...a,ref:t})}):null});Cte.displayName=Y5;var YNe=Jm("DialogOverlay.RemoveScroll"),XNe=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=nd(Y5,r);return s.jsx(qj,{as:YNe,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(zt.div,{"data-state":XR(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),ig="DialogContent",Ete=w.forwardRef((e,t)=>{const r=Ste(ig,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,i=nd(ig,e.__scopeDialog);return s.jsx(Za,{present:n||i.open,children:i.modal?s.jsx(ZNe,{...a,ref:t}):s.jsx(JNe,{...a,ref:t})})});Ete.displayName=ig;var ZNe=w.forwardRef((e,t)=>{const r=nd(ig,e.__scopeDialog),n=w.useRef(null),a=Cr(t,r.contentRef,n);return w.useEffect(()=>{const i=n.current;if(i)return yC(i)},[]),s.jsx(Ate,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ct(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Ct(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:Ct(e.onFocusOutside,i=>i.preventDefault())})}),JNe=w.forwardRef((e,t)=>{const r=nd(ig,e.__scopeDialog),n=w.useRef(!1),a=w.useRef(!1);return s.jsx(Ate,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Ate=w.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=e,l=nd(ig,r),c=w.useRef(null),u=Cr(t,c);return xC(),s.jsxs(s.Fragment,{children:[s.jsx(Uj,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(Pg,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":XR(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(eSe,{titleId:l.titleId}),s.jsx(rSe,{contentRef:c,descriptionId:l.descriptionId})]})]})}),YR="DialogTitle",Tte=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=nd(YR,r);return s.jsx(zt.h2,{id:a.titleId,...n,ref:t})});Tte.displayName=YR;var Pte="DialogDescription",Ote=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=nd(Pte,r);return s.jsx(zt.p,{id:a.descriptionId,...n,ref:t})});Ote.displayName=Pte;var Dte="DialogClose",Ite=w.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=nd(Dte,r);return s.jsx(zt.button,{type:"button",...n,ref:t,onClick:Ct(e.onClick,()=>a.onOpenChange(!1))})});Ite.displayName=Dte;function XR(e){return e?"open":"closed"}var Rte="DialogTitleWarning",[QNe,Lte]=Nxe(Rte,{contentName:ig,titleName:YR,docsSlug:"dialog"}),eSe=({titleId:e})=>{const t=Lte(Rte),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},tSe="DialogDescriptionWarning",rSe=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Lte(tSe).contentName}}.`;return w.useEffect(()=>{var i;const a=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},wC=jte,ZR=Nte,jC=kte,a1=Cte,i1=Ete,Vj=Tte,Wj=Ote,_C=Ite;const JR=wC,QR=ZR,nSe=jC,Fte=w.forwardRef(({className:e,...t},r)=>s.jsx(a1,{className:pt("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:r}));Fte.displayName=a1.displayName;const sSe=Wy("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"}}),NC=w.forwardRef(({side:e="right",className:t,children:r,...n},a)=>s.jsxs(nSe,{children:[s.jsx(Fte,{}),s.jsxs(i1,{ref:a,className:pt(sSe({side:e}),t),...n,children:[r,s.jsxs(_C,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Ri,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));NC.displayName=i1.displayName;const SC=({className:e,...t})=>s.jsx("div",{className:pt("flex flex-col space-y-2 text-center sm:text-left",e),...t});SC.displayName="SheetHeader";const kC=w.forwardRef(({className:e,...t},r)=>s.jsx(Vj,{ref:r,className:pt("text-lg font-semibold text-foreground",e),...t}));kC.displayName=Vj.displayName;const Mte=w.forwardRef(({className:e,...t},r)=>s.jsx(Wj,{ref:r,className:pt("text-sm text-muted-foreground",e),...t}));Mte.displayName=Wj.displayName;var aSe=w.createContext(void 0);function Dg(e){const t=w.useContext(aSe);return e||t||"ltr"}var H3="rovingFocusGroup.onEntryFocus",iSe={bubbles:!1,cancelable:!0},Hj="RovingFocusGroup",[C6,$te,oSe]=Ij(Hj),[lSe,o1]=Xa(Hj,[oSe]),[cSe,uSe]=lSe(Hj),Bte=w.forwardRef((e,t)=>s.jsx(C6.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(C6.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(dSe,{...e,ref:t})})}));Bte.displayName=Hj;var dSe=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=w.useRef(null),h=Cr(t,m),g=Dg(i),[p,x]=Wo({prop:o,defaultProp:l??null,onChange:c,caller:Hj}),[v,b]=w.useState(!1),y=ha(u),N=$te(r),_=w.useRef(!1),[j,S]=w.useState(0);return w.useEffect(()=>{const I=m.current;if(I)return I.addEventListener(H3,y),()=>I.removeEventListener(H3,y)},[y]),s.jsx(cSe,{scope:r,orientation:n,dir:g,loop:a,currentTabStopId:p,onItemFocus:w.useCallback(I=>x(I),[x]),onItemShiftTab:w.useCallback(()=>b(!0),[]),onFocusableItemAdd:w.useCallback(()=>S(I=>I+1),[]),onFocusableItemRemove:w.useCallback(()=>S(I=>I-1),[]),children:s.jsx(zt.div,{tabIndex:v||j===0?-1:0,"data-orientation":n,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:Ct(e.onMouseDown,()=>{_.current=!0}),onFocus:Ct(e.onFocus,I=>{const P=!_.current;if(I.target===I.currentTarget&&P&&!v){const F=new CustomEvent(H3,iSe);if(I.currentTarget.dispatchEvent(F),!F.defaultPrevented){const T=N().filter(H=>H.focusable),k=T.find(H=>H.active),V=T.find(H=>H.id===p),R=[k,V,...T].filter(Boolean).map(H=>H.ref.current);qte(R,d)}}_.current=!1}),onBlur:Ct(e.onBlur,()=>b(!1))})})}),zte="RovingFocusGroupItem",Ute=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:i,children:o,...l}=e,c=Ga(),u=i||c,d=uSe(zte,r),f=d.currentTabStopId===u,m=$te(r),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:p}=d;return w.useEffect(()=>{if(n)return h(),()=>g()},[n,h,g]),s.jsx(C6.ItemSlot,{scope:r,id:u,focusable:n,active:a,children:s.jsx(zt.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Ct(e.onMouseDown,x=>{n?d.onItemFocus(u):x.preventDefault()}),onFocus:Ct(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Ct(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const v=mSe(x,d.orientation,d.dir);if(v!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let y=m().filter(N=>N.focusable).map(N=>N.ref.current);if(v==="last")y.reverse();else if(v==="prev"||v==="next"){v==="prev"&&y.reverse();const N=y.indexOf(x.currentTarget);y=d.loop?pSe(y,N+1):y.slice(N+1)}setTimeout(()=>qte(y))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:p!=null}):o})})});Ute.displayName=zte;var fSe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hSe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mSe(e,t,r){const n=hSe(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return fSe[n]}function qte(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function pSe(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var eL=Bte,tL=Ute,E6=["Enter"," "],gSe=["ArrowDown","PageUp","Home"],Vte=["ArrowUp","PageDown","End"],xSe=[...gSe,...Vte],vSe={ltr:[...E6,"ArrowRight"],rtl:[...E6,"ArrowLeft"]},ySe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Gj="Menu",[g2,bSe,wSe]=Ij(Gj),[Ig,Wte]=Xa(Gj,[wSe,bp,o1]),CC=bp(),Hte=o1(),[jSe,Rg]=Ig(Gj),[_Se,Kj]=Ig(Gj),Gte=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:a,onOpenChange:i,modal:o=!0}=e,l=CC(t),[c,u]=w.useState(null),d=w.useRef(!1),f=ha(i),m=Dg(a);return w.useEffect(()=>{const h=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),s.jsx(lC,{...l,children:s.jsx(jSe,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:s.jsx(_Se,{scope:t,onClose:w.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:m,modal:o,children:n})})})};Gte.displayName=Gj;var NSe="MenuAnchor",rL=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,a=CC(r);return s.jsx($j,{...a,...n,ref:t})});rL.displayName=NSe;var nL="MenuPortal",[SSe,Kte]=Ig(nL,{forceMount:void 0}),Yte=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:a}=e,i=Rg(nL,t);return s.jsx(SSe,{scope:t,forceMount:r,children:s.jsx(Za,{present:r||i.open,children:s.jsx(Vy,{asChild:!0,container:a,children:n})})})};Yte.displayName=nL;var Wc="MenuContent",[kSe,sL]=Ig(Wc),Xte=w.forwardRef((e,t)=>{const r=Kte(Wc,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=Rg(Wc,e.__scopeMenu),o=Kj(Wc,e.__scopeMenu);return s.jsx(g2.Provider,{scope:e.__scopeMenu,children:s.jsx(Za,{present:n||i.open,children:s.jsx(g2.Slot,{scope:e.__scopeMenu,children:o.modal?s.jsx(CSe,{...a,ref:t}):s.jsx(ESe,{...a,ref:t})})})})}),CSe=w.forwardRef((e,t)=>{const r=Rg(Wc,e.__scopeMenu),n=w.useRef(null),a=Cr(t,n);return w.useEffect(()=>{const i=n.current;if(i)return yC(i)},[]),s.jsx(aL,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ct(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),ESe=w.forwardRef((e,t)=>{const r=Rg(Wc,e.__scopeMenu);return s.jsx(aL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),ASe=Jm("MenuContent.ScrollLock"),aL=w.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,...p}=e,x=Rg(Wc,r),v=Kj(Wc,r),b=CC(r),y=Hte(r),N=bSe(r),[_,j]=w.useState(null),S=w.useRef(null),I=Cr(t,S,x.onContentChange),P=w.useRef(0),F=w.useRef(""),T=w.useRef(0),k=w.useRef(null),V=w.useRef("right"),C=w.useRef(0),R=g?qj:w.Fragment,H=g?{as:ASe,allowPinchZoom:!0}:void 0,q=M=>{var J,se;const z=F.current+M,K=N().filter(ee=>!ee.disabled),E=document.activeElement,A=(J=K.find(ee=>ee.ref.current===E))==null?void 0:J.textValue,O=K.map(ee=>ee.textValue),U=zSe(O,z,A),Y=(se=K.find(ee=>ee.textValue===U))==null?void 0:se.ref.current;(function ee(ie){F.current=ie,window.clearTimeout(P.current),ie!==""&&(P.current=window.setTimeout(()=>ee(""),1e3))})(z),Y&&setTimeout(()=>Y.focus())};w.useEffect(()=>()=>window.clearTimeout(P.current),[]),xC();const L=w.useCallback(M=>{var K,E;return V.current===((K=k.current)==null?void 0:K.side)&&qSe(M,(E=k.current)==null?void 0:E.area)},[]);return s.jsx(kSe,{scope:r,searchRef:F,onItemEnter:w.useCallback(M=>{L(M)&&M.preventDefault()},[L]),onItemLeave:w.useCallback(M=>{var z;L(M)||((z=S.current)==null||z.focus(),j(null))},[L]),onTriggerLeave:w.useCallback(M=>{L(M)&&M.preventDefault()},[L]),pointerGraceTimerRef:T,onPointerGraceIntentChange:w.useCallback(M=>{k.current=M},[]),children:s.jsx(R,{...H,children:s.jsx(Uj,{asChild:!0,trapped:a,onMountAutoFocus:Ct(i,M=>{var z;M.preventDefault(),(z=S.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:s.jsx(Pg,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:m,onDismiss:h,children:s.jsx(eL,{asChild:!0,...y,dir:v.dir,orientation:"vertical",loop:n,currentTabStopId:_,onCurrentTabStopIdChange:j,onEntryFocus:Ct(c,M=>{v.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(cC,{role:"menu","aria-orientation":"vertical","data-state":fre(x.open),"data-radix-menu-content":"",dir:v.dir,...b,...p,ref:I,style:{outline:"none",...p.style},onKeyDown:Ct(p.onKeyDown,M=>{const K=M.target.closest("[data-radix-menu-content]")===M.currentTarget,E=M.ctrlKey||M.altKey||M.metaKey,A=M.key.length===1;K&&(M.key==="Tab"&&M.preventDefault(),!E&&A&&q(M.key));const O=S.current;if(M.target!==O||!xSe.includes(M.key))return;M.preventDefault();const Y=N().filter(J=>!J.disabled).map(J=>J.ref.current);Vte.includes(M.key)&&Y.reverse(),$Se(Y)}),onBlur:Ct(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(P.current),F.current="")}),onPointerMove:Ct(e.onPointerMove,x2(M=>{const z=M.target,K=C.current!==M.clientX;if(M.currentTarget.contains(z)&&K){const E=M.clientX>C.current?"right":"left";V.current=E,C.current=M.clientX}}))})})})})})})});Xte.displayName=Wc;var TSe="MenuGroup",iL=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return s.jsx(zt.div,{role:"group",...n,ref:t})});iL.displayName=TSe;var PSe="MenuLabel",Zte=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return s.jsx(zt.div,{...n,ref:t})});Zte.displayName=PSe;var X5="MenuItem",J9="menu.itemSelect",EC=w.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...a}=e,i=w.useRef(null),o=Kj(X5,e.__scopeMenu),l=sL(X5,e.__scopeMenu),c=Cr(t,i),u=w.useRef(!1),d=()=>{const f=i.current;if(!r&&f){const m=new CustomEvent(J9,{bubbles:!0,cancelable:!0});f.addEventListener(J9,h=>n==null?void 0:n(h),{once:!0}),iR(f,m),m.defaultPrevented?u.current=!1:o.onClose()}};return s.jsx(Jte,{...a,ref:c,disabled:r,onClick:Ct(e.onClick,d),onPointerDown:f=>{var m;(m=e.onPointerDown)==null||m.call(e,f),u.current=!0},onPointerUp:Ct(e.onPointerUp,f=>{var m;u.current||(m=f.currentTarget)==null||m.click()}),onKeyDown:Ct(e.onKeyDown,f=>{const m=l.searchRef.current!=="";r||m&&f.key===" "||E6.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});EC.displayName=X5;var Jte=w.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:a,...i}=e,o=sL(X5,r),l=Hte(r),c=w.useRef(null),u=Cr(t,c),[d,f]=w.useState(!1),[m,h]=w.useState("");return w.useEffect(()=>{const g=c.current;g&&h((g.textContent??"").trim())},[i.children]),s.jsx(g2.ItemSlot,{scope:r,disabled:n,textValue:a??m,children:s.jsx(tL,{asChild:!0,...l,focusable:!n,children:s.jsx(zt.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:u,onPointerMove:Ct(e.onPointerMove,x2(g=>{n?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ct(e.onPointerLeave,x2(g=>o.onItemLeave(g))),onFocus:Ct(e.onFocus,()=>f(!0)),onBlur:Ct(e.onBlur,()=>f(!1))})})})}),OSe="MenuCheckboxItem",Qte=w.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...a}=e;return s.jsx(sre,{scope:e.__scopeMenu,checked:r,children:s.jsx(EC,{role:"menuitemcheckbox","aria-checked":Z5(r)?"mixed":r,...a,ref:t,"data-state":lL(r),onSelect:Ct(a.onSelect,()=>n==null?void 0:n(Z5(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Qte.displayName=OSe;var ere="MenuRadioGroup",[DSe,ISe]=Ig(ere,{value:void 0,onValueChange:()=>{}}),tre=w.forwardRef((e,t)=>{const{value:r,onValueChange:n,...a}=e,i=ha(n);return s.jsx(DSe,{scope:e.__scopeMenu,value:r,onValueChange:i,children:s.jsx(iL,{...a,ref:t})})});tre.displayName=ere;var rre="MenuRadioItem",nre=w.forwardRef((e,t)=>{const{value:r,...n}=e,a=ISe(rre,e.__scopeMenu),i=r===a.value;return s.jsx(sre,{scope:e.__scopeMenu,checked:i,children:s.jsx(EC,{role:"menuitemradio","aria-checked":i,...n,ref:t,"data-state":lL(i),onSelect:Ct(n.onSelect,()=>{var o;return(o=a.onValueChange)==null?void 0:o.call(a,r)},{checkForDefaultPrevented:!1})})})});nre.displayName=rre;var oL="MenuItemIndicator",[sre,RSe]=Ig(oL,{checked:!1}),are=w.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...a}=e,i=RSe(oL,r);return s.jsx(Za,{present:n||Z5(i.checked)||i.checked===!0,children:s.jsx(zt.span,{...a,ref:t,"data-state":lL(i.checked)})})});are.displayName=oL;var LSe="MenuSeparator",ire=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return s.jsx(zt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});ire.displayName=LSe;var FSe="MenuArrow",ore=w.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,a=CC(r);return s.jsx(uC,{...a,...n,ref:t})});ore.displayName=FSe;var MSe="MenuSub",[wkt,lre]=Ig(MSe),Gb="MenuSubTrigger",cre=w.forwardRef((e,t)=>{const r=Rg(Gb,e.__scopeMenu),n=Kj(Gb,e.__scopeMenu),a=lre(Gb,e.__scopeMenu),i=sL(Gb,e.__scopeMenu),o=w.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=w.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return w.useEffect(()=>d,[d]),w.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),s.jsx(rL,{asChild:!0,...u,children:s.jsx(Jte,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":a.contentId,"data-state":fre(r.open),...e,ref:ch(t,a.onTriggerChange),onClick:f=>{var m;(m=e.onClick)==null||m.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Ct(e.onPointerMove,x2(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:Ct(e.onPointerLeave,x2(f=>{var h,g;d();const m=(h=r.content)==null?void 0:h.getBoundingClientRect();if(m){const p=(g=r.content)==null?void 0:g.dataset.side,x=p==="right",v=x?-5:5,b=m[x?"left":"right"],y=m[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:b,y:m.top},{x:y,y:m.top},{x:y,y:m.bottom},{x:b,y:m.bottom}],side:p}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ct(e.onKeyDown,f=>{var h;const m=i.searchRef.current!=="";e.disabled||m&&f.key===" "||vSe[n.dir].includes(f.key)&&(r.onOpenChange(!0),(h=r.content)==null||h.focus(),f.preventDefault())})})})});cre.displayName=Gb;var ure="MenuSubContent",dre=w.forwardRef((e,t)=>{const r=Kte(Wc,e.__scopeMenu),{forceMount:n=r.forceMount,...a}=e,i=Rg(Wc,e.__scopeMenu),o=Kj(Wc,e.__scopeMenu),l=lre(ure,e.__scopeMenu),c=w.useRef(null),u=Cr(t,c);return s.jsx(g2.Provider,{scope:e.__scopeMenu,children:s.jsx(Za,{present:n||i.open,children:s.jsx(g2.Slot,{scope:e.__scopeMenu,children:s.jsx(aL,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ct(e.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ct(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Ct(e.onKeyDown,d=>{var h;const f=d.currentTarget.contains(d.target),m=ySe[o.dir].includes(d.key);f&&m&&(i.onOpenChange(!1),(h=l.trigger)==null||h.focus(),d.preventDefault())})})})})})});dre.displayName=ure;function fre(e){return e?"open":"closed"}function Z5(e){return e==="indeterminate"}function lL(e){return Z5(e)?"indeterminate":e?"checked":"unchecked"}function $Se(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function BSe(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function zSe(e,t,r){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let o=BSe(e,Math.max(i,0));a.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(a.toLowerCase()));return c!==r?c:void 0}function USe(e,t){const{x:r,y:n}=e;let a=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const l=t[i],c=t[o],u=l.x,d=l.y,f=c.x,m=c.y;d>n!=m>n&&r<(f-u)*(n-d)/(m-d)+u&&(a=!a)}return a}function qSe(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return USe(r,t)}function x2(e){return t=>t.pointerType==="mouse"?e(t):void 0}var VSe=Gte,WSe=rL,HSe=Yte,GSe=Xte,KSe=iL,YSe=Zte,XSe=EC,ZSe=Qte,JSe=tre,QSe=nre,e5e=are,t5e=ire,r5e=ore,n5e=cre,s5e=dre,AC="DropdownMenu",[a5e]=Xa(AC,[Wte]),Xo=Wte(),[i5e,hre]=a5e(AC),mre=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:a,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=Xo(t),u=w.useRef(null),[d,f]=Wo({prop:a,defaultProp:i??!1,onChange:o,caller:AC});return s.jsx(i5e,{scope:t,triggerId:Ga(),triggerRef:u,contentId:Ga(),open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(m=>!m),[f]),modal:l,children:s.jsx(VSe,{...c,open:d,onOpenChange:f,dir:n,modal:l,children:r})})};mre.displayName=AC;var pre="DropdownMenuTrigger",gre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...a}=e,i=hre(pre,r),o=Xo(r);return s.jsx(WSe,{asChild:!0,...o,children:s.jsx(zt.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":n?"":void 0,disabled:n,...a,ref:ch(t,i.triggerRef),onPointerDown:Ct(e.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Ct(e.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});gre.displayName=pre;var o5e="DropdownMenuPortal",xre=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Xo(t);return s.jsx(HSe,{...n,...r})};xre.displayName=o5e;var vre="DropdownMenuContent",yre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=hre(vre,r),i=Xo(r),o=w.useRef(!1);return s.jsx(GSe,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...n,ref:t,onCloseAutoFocus:Ct(e.onCloseAutoFocus,l=>{var c;o.current||(c=a.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:Ct(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!a.modal||d)&&(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)"}})});yre.displayName=vre;var l5e="DropdownMenuGroup",c5e=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(KSe,{...a,...n,ref:t})});c5e.displayName=l5e;var u5e="DropdownMenuLabel",bre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(YSe,{...a,...n,ref:t})});bre.displayName=u5e;var d5e="DropdownMenuItem",wre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(XSe,{...a,...n,ref:t})});wre.displayName=d5e;var f5e="DropdownMenuCheckboxItem",jre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(ZSe,{...a,...n,ref:t})});jre.displayName=f5e;var h5e="DropdownMenuRadioGroup",m5e=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(JSe,{...a,...n,ref:t})});m5e.displayName=h5e;var p5e="DropdownMenuRadioItem",_re=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(QSe,{...a,...n,ref:t})});_re.displayName=p5e;var g5e="DropdownMenuItemIndicator",Nre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(e5e,{...a,...n,ref:t})});Nre.displayName=g5e;var x5e="DropdownMenuSeparator",Sre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(t5e,{...a,...n,ref:t})});Sre.displayName=x5e;var v5e="DropdownMenuArrow",y5e=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(r5e,{...a,...n,ref:t})});y5e.displayName=v5e;var b5e="DropdownMenuSubTrigger",kre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(n5e,{...a,...n,ref:t})});kre.displayName=b5e;var w5e="DropdownMenuSubContent",Cre=w.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,a=Xo(r);return s.jsx(s5e,{...a,...n,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)"}})});Cre.displayName=w5e;var j5e=mre,_5e=gre,N5e=xre,Ere=yre,Are=bre,Tre=wre,Pre=jre,Ore=_re,Dre=Nre,Ire=Sre,Rre=kre,Lre=Cre;const A6=j5e,T6=_5e,S5e=w.forwardRef(({className:e,inset:t,children:r,...n},a)=>s.jsxs(Rre,{ref:a,className:pt("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...n,children:[r,s.jsx(tu,{className:"ml-auto h-4 w-4"})]}));S5e.displayName=Rre.displayName;const k5e=w.forwardRef(({className:e,...t},r)=>s.jsx(Lre,{ref:r,className:pt("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}));k5e.displayName=Lre.displayName;const J5=w.forwardRef(({className:e,sideOffset:t=4,...r},n)=>s.jsx(N5e,{children:s.jsx(Ere,{ref:n,sideOffset:t,className:pt("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),...r})}));J5.displayName=Ere.displayName;const Nc=w.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(Tre,{ref:n,className:pt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...r}));Nc.displayName=Tre.displayName;const C5e=w.forwardRef(({className:e,children:t,checked:r,...n},a)=>s.jsxs(Pre,{ref:a,className:pt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:r,...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Dre,{children:s.jsx(Pn,{className:"h-4 w-4"})})}),t]}));C5e.displayName=Pre.displayName;const E5e=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(Ore,{ref:n,className:pt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...r,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(Dre,{children:s.jsx(uR,{className:"h-2 w-2 fill-current"})})}),t]}));E5e.displayName=Ore.displayName;const A5e=w.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(Are,{ref:n,className:pt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));A5e.displayName=Are.displayName;const cL=w.forwardRef(({className:e,...t},r)=>s.jsx(Ire,{ref:r,className:pt("-mx-1 my-1 h-px bg-muted",e),...t}));cL.displayName=Ire.displayName;const T5e=Wy("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 Le({className:e,variant:t,...r}){return s.jsx("div",{className:pt(T5e({variant:t}),e),...r})}var TC="Popover",[Fre]=Xa(TC,[bp]),Yj=bp(),[P5e,Np]=Fre(TC),Mre=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:i,modal:o=!1}=e,l=Yj(t),c=w.useRef(null),[u,d]=w.useState(!1),[f,m]=Wo({prop:n,defaultProp:a??!1,onChange:i,caller:TC});return s.jsx(lC,{...l,children:s.jsx(P5e,{scope:t,contentId:Ga(),triggerRef:c,open:f,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(h=>!h),[m]),hasCustomAnchor:u,onCustomAnchorAdd:w.useCallback(()=>d(!0),[]),onCustomAnchorRemove:w.useCallback(()=>d(!1),[]),modal:o,children:r})})};Mre.displayName=TC;var $re="PopoverAnchor",O5e=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Np($re,r),i=Yj(r),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=a;return w.useEffect(()=>(o(),()=>l()),[o,l]),s.jsx($j,{...i,...n,ref:t})});O5e.displayName=$re;var Bre="PopoverTrigger",zre=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Np(Bre,r),i=Yj(r),o=Cr(t,a.triggerRef),l=s.jsx(zt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Hre(a.open),...n,ref:o,onClick:Ct(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:s.jsx($j,{asChild:!0,...i,children:l})});zre.displayName=Bre;var uL="PopoverPortal",[D5e,I5e]=Fre(uL,{forceMount:void 0}),Ure=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,i=Np(uL,t);return s.jsx(D5e,{scope:t,forceMount:r,children:s.jsx(Za,{present:r||i.open,children:s.jsx(Vy,{asChild:!0,container:a,children:n})})})};Ure.displayName=uL;var sy="PopoverContent",qre=w.forwardRef((e,t)=>{const r=I5e(sy,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,i=Np(sy,e.__scopePopover);return s.jsx(Za,{present:n||i.open,children:i.modal?s.jsx(L5e,{...a,ref:t}):s.jsx(F5e,{...a,ref:t})})});qre.displayName=sy;var R5e=Jm("PopoverContent.RemoveScroll"),L5e=w.forwardRef((e,t)=>{const r=Np(sy,e.__scopePopover),n=w.useRef(null),a=Cr(t,n),i=w.useRef(!1);return w.useEffect(()=>{const o=n.current;if(o)return yC(o)},[]),s.jsx(qj,{as:R5e,allowPinchZoom:!0,children:s.jsx(Vre,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ct(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Ct(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Ct(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),F5e=w.forwardRef((e,t)=>{const r=Np(sy,e.__scopePopover),n=w.useRef(!1),a=w.useRef(!1);return s.jsx(Vre,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),i.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(n.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Vre=w.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,...f}=e,m=Np(sy,r),h=Yj(r);return xC(),s.jsx(Uj,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(Pg,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:s.jsx(cC,{"data-state":Hre(m.open),role:"dialog",id:m.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Wre="PopoverClose",M5e=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Np(Wre,r);return s.jsx(zt.button,{type:"button",...n,ref:t,onClick:Ct(e.onClick,()=>a.onOpenChange(!1))})});M5e.displayName=Wre;var $5e="PopoverArrow",B5e=w.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Yj(r);return s.jsx(uC,{...a,...n,ref:t})});B5e.displayName=$5e;function Hre(e){return e?"open":"closed"}var z5e=Mre,U5e=zre,q5e=Ure,Gre=qre;const rp=z5e,np=U5e,fh=w.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>s.jsx(q5e,{children:s.jsx(Gre,{ref:a,align:t,sideOffset:r,className:pt("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]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));fh.displayName=Gre.displayName;function P6(e,[t,r]){return Math.min(r,Math.max(t,e))}function V5e(e,t){return w.useReducer((r,n)=>t[r][n]??r,e)}var dL="ScrollArea",[Kre]=Xa(dL),[W5e,lu]=Kre(dL),Yre=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:i=600,...o}=e,[l,c]=w.useState(null),[u,d]=w.useState(null),[f,m]=w.useState(null),[h,g]=w.useState(null),[p,x]=w.useState(null),[v,b]=w.useState(0),[y,N]=w.useState(0),[_,j]=w.useState(!1),[S,I]=w.useState(!1),P=Cr(t,T=>c(T)),F=Dg(a);return s.jsx(W5e,{scope:r,type:n,dir:F,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:_,onScrollbarXEnabledChange:j,scrollbarY:p,onScrollbarYChange:x,scrollbarYEnabled:S,onScrollbarYEnabledChange:I,onCornerWidthChange:b,onCornerHeightChange:N,children:s.jsx(zt.div,{dir:F,...o,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});Yre.displayName=dL;var Xre="ScrollAreaViewport",Zre=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...i}=e,o=lu(Xre,r),l=w.useRef(null),c=Cr(t,l,o.onViewportChange);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),s.jsx(zt.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:s.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Zre.displayName=Xre;var nf="ScrollAreaScrollbar",fL=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=lu(nf,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=a,l=e.orientation==="horizontal";return w.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),a.type==="hover"?s.jsx(H5e,{...n,ref:t,forceMount:r}):a.type==="scroll"?s.jsx(G5e,{...n,ref:t,forceMount:r}):a.type==="auto"?s.jsx(Jre,{...n,ref:t,forceMount:r}):a.type==="always"?s.jsx(hL,{...n,ref:t}):null});fL.displayName=nf;var H5e=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=lu(nf,e.__scopeScrollArea),[i,o]=w.useState(!1);return w.useEffect(()=>{const l=a.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[a.scrollArea,a.scrollHideDelay]),s.jsx(Za,{present:r||i,children:s.jsx(Jre,{"data-state":i?"visible":"hidden",...n,ref:t})})}),G5e=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=lu(nf,e.__scopeScrollArea),i=e.orientation==="horizontal",o=OC(()=>c("SCROLL_END"),100),[l,c]=V5e("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return w.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,a.scrollHideDelay,c]),w.useEffect(()=>{const u=a.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const m=()=>{const h=u[d];f!==h&&(c("SCROLL"),o()),f=h};return u.addEventListener("scroll",m),()=>u.removeEventListener("scroll",m)}},[a.viewport,i,c,o]),s.jsx(Za,{present:r||l!=="hidden",children:s.jsx(hL,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Ct(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ct(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Jre=w.forwardRef((e,t)=>{const r=lu(nf,e.__scopeScrollArea),{forceMount:n,...a}=e,[i,o]=w.useState(!1),l=e.orientation==="horizontal",c=OC(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;o(l?u:d)}},10);return ay(r.viewport,c),ay(r.content,c),s.jsx(Za,{present:n||i,children:s.jsx(hL,{"data-state":i?"visible":"hidden",...a,ref:t})})}),hL=w.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=lu(nf,e.__scopeScrollArea),i=w.useRef(null),o=w.useRef(0),[l,c]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=nne(l.viewport,l.content),d={...n,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function f(m,h){return Q5e(m,o.current,l,h)}return r==="horizontal"?s.jsx(K5e,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollLeft,h=Q9(m,l,a.dir);i.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollLeft=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollLeft=f(m,a.dir))}}):r==="vertical"?s.jsx(Y5e,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&i.current){const m=a.viewport.scrollTop,h=Q9(m,l);i.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:m=>{a.viewport&&(a.viewport.scrollTop=m)},onDragScroll:m=>{a.viewport&&(a.viewport.scrollTop=f(m))}}):null}),K5e=w.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=lu(nf,e.__scopeScrollArea),[o,l]=w.useState(),c=w.useRef(null),u=Cr(t,c,i.onScrollbarXChange);return w.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx(ene,{"data-orientation":"horizontal",...a,ref:u,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":PC(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(m),ane(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:e4(o.paddingLeft),paddingEnd:e4(o.paddingRight)}})}})}),Y5e=w.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,i=lu(nf,e.__scopeScrollArea),[o,l]=w.useState(),c=w.useRef(null),u=Cr(t,c,i.onScrollbarYChange);return w.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx(ene,{"data-orientation":"vertical",...a,ref:u,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":PC(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const m=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(m),ane(m,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:e4(o.paddingTop),paddingEnd:e4(o.paddingBottom)}})}})}),[X5e,Qre]=Kre(nf),ene=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...m}=e,h=lu(nf,r),[g,p]=w.useState(null),x=Cr(t,P=>p(P)),v=w.useRef(null),b=w.useRef(""),y=h.viewport,N=n.content-n.viewport,_=ha(d),j=ha(c),S=OC(f,10);function I(P){if(v.current){const F=P.clientX-v.current.left,T=P.clientY-v.current.top;u({x:F,y:T})}}return w.useEffect(()=>{const P=F=>{const T=F.target;(g==null?void 0:g.contains(T))&&_(F,N)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[y,g,N,_]),w.useEffect(j,[n,j]),ay(g,S),ay(h.content,S),s.jsx(X5e,{scope:r,scrollbar:g,hasThumb:a,onThumbChange:ha(i),onThumbPointerUp:ha(o),onThumbPositionChange:j,onThumbPointerDown:ha(l),children:s.jsx(zt.div,{...m,ref:x,style:{position:"absolute",...m.style},onPointerDown:Ct(e.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),v.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),I(P))}),onPointerMove:Ct(e.onPointerMove,I),onPointerUp:Ct(e.onPointerUp,P=>{const F=P.target;F.hasPointerCapture(P.pointerId)&&F.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=""),v.current=null})})})}),Q5="ScrollAreaThumb",tne=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Qre(Q5,e.__scopeScrollArea);return s.jsx(Za,{present:r||a.hasThumb,children:s.jsx(Z5e,{ref:t,...n})})}),Z5e=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,i=lu(Q5,r),o=Qre(Q5,r),{onThumbPositionChange:l}=o,c=Cr(t,f=>o.onThumbChange(f)),u=w.useRef(void 0),d=OC(()=>{u.current&&(u.current(),u.current=void 0)},100);return w.useEffect(()=>{const f=i.viewport;if(f){const m=()=>{if(d(),!u.current){const h=e4e(f,l);u.current=h,l()}};return l(),f.addEventListener("scroll",m),()=>f.removeEventListener("scroll",m)}},[i.viewport,d,l]),s.jsx(zt.div,{"data-state":o.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ct(e.onPointerDownCapture,f=>{const h=f.target.getBoundingClientRect(),g=f.clientX-h.left,p=f.clientY-h.top;o.onThumbPointerDown({x:g,y:p})}),onPointerUp:Ct(e.onPointerUp,o.onThumbPointerUp)})});tne.displayName=Q5;var mL="ScrollAreaCorner",rne=w.forwardRef((e,t)=>{const r=lu(mL,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?s.jsx(J5e,{...e,ref:t}):null});rne.displayName=mL;var J5e=w.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=lu(mL,r),[i,o]=w.useState(0),[l,c]=w.useState(0),u=!!(i&&l);return ay(a.scrollbarX,()=>{var f;const d=((f=a.scrollbarX)==null?void 0:f.offsetHeight)||0;a.onCornerHeightChange(d),c(d)}),ay(a.scrollbarY,()=>{var f;const d=((f=a.scrollbarY)==null?void 0:f.offsetWidth)||0;a.onCornerWidthChange(d),o(d)}),u?s.jsx(zt.div,{...n,ref:t,style:{width:i,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function e4(e){return e?parseInt(e,10):0}function nne(e,t){const r=e/t;return isNaN(r)?0:r}function PC(e){const t=nne(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Q5e(e,t,r,n="ltr"){const a=PC(r),i=a/2,o=t||i,l=a-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-l,d=r.content-r.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return sne([c,u],f)(e)}function Q9(e,t,r="ltr"){const n=PC(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-a,o=t.content-t.viewport,l=i-n,c=r==="ltr"?[0,o]:[o*-1,0],u=P6(e,c);return sne([0,o],[0,l])(u)}function sne(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function ane(e,t){return e>0&&e<t}var e4e=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const i={left:e.scrollLeft,top:e.scrollTop},o=r.left!==i.left,l=r.top!==i.top;(o||l)&&t(),r=i,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function OC(e,t){const r=ha(e),n=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(n.current),[]),w.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function ay(e,t){const r=ha(t);ba(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var ine=Yre,t4e=Zre,r4e=rne;const ru=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(ine,{ref:n,className:pt("relative overflow-hidden",e),...r,children:[s.jsx(t4e,{className:"h-full w-full rounded-[inherit]",children:t}),s.jsx(t4,{}),s.jsx(r4e,{})]}));ru.displayName=ine.displayName;const t4=w.forwardRef(({className:e,orientation:t="vertical",...r},n)=>s.jsx(fL,{ref:n,orientation:t,className:pt("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:s.jsx(tne,{className:"relative flex-1 rounded-full bg-border"})}));t4.displayName=fL.displayName;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 yl(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Oo(e,t){const r=Pr(e);return isNaN(t)?yl(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function sc(e,t){const r=Pr(e);if(isNaN(t))return yl(e,NaN);if(!t)return r;const n=r.getDate(),a=yl(e,r.getTime());a.setMonth(r.getMonth()+t+1,0);const i=a.getDate();return n>=i?a:(r.setFullYear(a.getFullYear(),a.getMonth(),n),r)}const pL=6048e5,n4e=864e5,one=6e4,lne=36e5,UN=43200,ez=1440;let s4e={};function l1(){return s4e}function Ju(e,t){var l,c,u,d;const r=l1(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,a=Pr(e),i=a.getDay(),o=(i<n?7:0)+i-n;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function og(e){return Ju(e,{weekStartsOn:1})}function cne(e){const t=Pr(e),r=t.getFullYear(),n=yl(e,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const a=og(n),i=yl(e,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const o=og(i);return t.getTime()>=a.getTime()?r+1:t.getTime()>=o.getTime()?r:r-1}function lg(e){const t=Pr(e);return t.setHours(0,0,0,0),t}function iy(e){const t=Pr(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ld(e,t){const r=lg(e),n=lg(t),a=+r-iy(r),i=+n-iy(n);return Math.round((a-i)/n4e)}function a4e(e){const t=cne(e),r=yl(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),og(r)}function O6(e,t){const r=t*7;return Oo(e,r)}function i4e(e,t){return sc(e,t*12)}function o4e(e){let t;return e.forEach(function(r){const n=Pr(r);(t===void 0||t<n||isNaN(Number(n)))&&(t=n)}),t||new Date(NaN)}function l4e(e){let t;return e.forEach(r=>{const n=Pr(r);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function n5(e,t){const r=Pr(e),n=Pr(t),a=r.getTime()-n.getTime();return a<0?-1:a>0?1:a}function c4e(e){return yl(e,Date.now())}function Lo(e,t){const r=lg(e),n=lg(t);return+r==+n}function gL(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function u4e(e){if(!gL(e)&&typeof e!="number")return!1;const t=Pr(e);return!isNaN(Number(t))}function oy(e,t){const r=Pr(e),n=Pr(t),a=r.getFullYear()-n.getFullYear(),i=r.getMonth()-n.getMonth();return a*12+i}function d4e(e,t,r){const n=Ju(e,r),a=Ju(t,r),i=+n-iy(n),o=+a-iy(a);return Math.round((i-o)/pL)}function f4e(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function h4e(e,t){return+Pr(e)-+Pr(t)}function une(e){const t=Pr(e);return t.setHours(23,59,59,999),t}function Xj(e){const t=Pr(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function m4e(e){const t=Pr(e);return+une(t)==+Xj(t)}function p4e(e,t){const r=Pr(e),n=Pr(t),a=n5(r,n),i=Math.abs(oy(r,n));let o;if(i<1)o=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*i);let l=n5(r,n)===-a;m4e(Pr(e))&&i===1&&n5(e,n)===1&&(l=!1),o=a*(i-Number(l))}return o===0?0:o}function g4e(e,t,r){const n=h4e(e,t)/1e3;return f4e(r==null?void 0:r.roundingMethod)(n)}function x4e(e,t){const r=Pr(e.start),n=Pr(e.end);let a=+r>+n;const i=a?+r:+n,o=a?n:r;o.setHours(0,0,0,0);let l=1;const c=[];for(;+o<=i;)c.push(Pr(o)),o.setDate(o.getDate()+l),o.setHours(0,0,0,0);return a?c.reverse():c}function po(e){const t=Pr(e);return t.setDate(1),t.setHours(0,0,0,0),t}function dne(e){const t=Pr(e),r=yl(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function DC(e,t){var l,c,u,d;const r=l1(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.weekStartsOn)??0,a=Pr(e),i=a.getDay(),o=(i<n?-7:0)+6-(i-n);return a.setDate(a.getDate()+o),a.setHours(23,59,59,999),a}function fne(e){return DC(e,{weekStartsOn:1})}const v4e={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"}},y4e=(e,t,r)=>{let n;const a=v4e[e];return typeof a=="string"?n=a:t===1?n=a.one:n=a.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function bv(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const b4e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},w4e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},j4e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_4e={date:bv({formats:b4e,defaultWidth:"full"}),time:bv({formats:w4e,defaultWidth:"full"}),dateTime:bv({formats:j4e,defaultWidth:"full"})},N4e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},S4e=(e,t,r,n)=>N4e[e];function Pd(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let a;if(n==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):o;a=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const k4e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},C4e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},E4e={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"]},A4e={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"]},T4e={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"}},P4e={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"}},O4e=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},D4e={ordinalNumber:O4e,era:Pd({values:k4e,defaultWidth:"wide"}),quarter:Pd({values:C4e,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Pd({values:E4e,defaultWidth:"wide"}),day:Pd({values:A4e,defaultWidth:"wide"}),dayPeriod:Pd({values:T4e,defaultWidth:"wide",formattingValues:P4e,defaultFormattingWidth:"wide"})};function Od(e){return(t,r={})=>{const n=r.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?R4e(l,f=>f.test(o)):I4e(l,f=>f.test(o));let u;u=e.valueCallback?e.valueCallback(c):c,u=r.valueCallback?r.valueCallback(u):u;const d=t.slice(o.length);return{value:u,rest:d}}}function I4e(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function R4e(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function hne(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const a=n[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=t.slice(a.length);return{value:o,rest:l}}}const L4e=/^(\d+)(th|st|nd|rd)?/i,F4e=/\d+/i,M4e={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},$4e={any:[/^b/i,/^(a|c)/i]},B4e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},z4e={any:[/1/i,/2/i,/3/i,/4/i]},U4e={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},q4e={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]},V4e={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},W4e={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]},H4e={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},G4e={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}},K4e={ordinalNumber:hne({matchPattern:L4e,parsePattern:F4e,valueCallback:e=>parseInt(e,10)}),era:Od({matchPatterns:M4e,defaultMatchWidth:"wide",parsePatterns:$4e,defaultParseWidth:"any"}),quarter:Od({matchPatterns:B4e,defaultMatchWidth:"wide",parsePatterns:z4e,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Od({matchPatterns:U4e,defaultMatchWidth:"wide",parsePatterns:q4e,defaultParseWidth:"any"}),day:Od({matchPatterns:V4e,defaultMatchWidth:"wide",parsePatterns:W4e,defaultParseWidth:"any"}),dayPeriod:Od({matchPatterns:H4e,defaultMatchWidth:"any",parsePatterns:G4e,defaultParseWidth:"any"})},xL={code:"en-US",formatDistance:y4e,formatLong:_4e,formatRelative:S4e,localize:D4e,match:K4e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Y4e(e){const t=Pr(e);return Ld(t,dne(t))+1}function mne(e){const t=Pr(e),r=+og(t)-+a4e(t);return Math.round(r/pL)+1}function pne(e,t){var d,f,m,h;const r=Pr(e),n=r.getFullYear(),a=l1(),i=(t==null?void 0:t.firstWeekContainsDate)??((f=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??a.firstWeekContainsDate??((h=(m=a.locale)==null?void 0:m.options)==null?void 0:h.firstWeekContainsDate)??1,o=yl(e,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=Ju(o,t),c=yl(e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const u=Ju(c,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=u.getTime()?n:n-1}function X4e(e,t){var l,c,u,d;const r=l1(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((d=(u=r.locale)==null?void 0:u.options)==null?void 0:d.firstWeekContainsDate)??1,a=pne(e,t),i=yl(e,0);return i.setFullYear(a,0,n),i.setHours(0,0,0,0),Ju(i,t)}function gne(e,t){const r=Pr(e),n=+Ju(r,t)-+X4e(r,t);return Math.round(n/pL)+1}function es(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const Yh={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return es(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):es(r+1,2)},d(e,t){return es(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return es(e.getHours()%12||12,t.length)},H(e,t){return es(e.getHours(),t.length)},m(e,t){return es(e.getMinutes(),t.length)},s(e,t){return es(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return es(a,t.length)}},yx={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},tz={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return Yh.y(e,t)},Y:function(e,t,r,n){const a=pne(e,n),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return es(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):es(i,t.length)},R:function(e,t){const r=cne(e);return es(r,t.length)},u:function(e,t){const r=e.getFullYear();return es(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return es(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return es(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return Yh.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return es(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const a=gne(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):es(a,t.length)},I:function(e,t,r){const n=mne(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):es(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):Yh.d(e,t)},D:function(e,t,r){const n=Y4e(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):es(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const a=e.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return es(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return es(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return es(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=yx.noon:n===0?a=yx.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=yx.evening:n>=12?a=yx.afternoon:n>=4?a=yx.morning:a=yx.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Yh.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):Yh.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):es(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):es(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):Yh.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):Yh.s(e,t)},S:function(e,t){return Yh.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return nz(n);case"XXXX":case"XX":return i0(n);case"XXXXX":case"XXX":default:return i0(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return nz(n);case"xxxx":case"xx":return i0(n);case"xxxxx":case"xxx":default:return i0(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+rz(n,":");case"OOOO":default:return"GMT"+i0(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+rz(n,":");case"zzzz":default:return"GMT"+i0(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return es(n,t.length)},T:function(e,t,r){const n=e.getTime();return es(n,t.length)}};function rz(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),i=n%60;return i===0?r+String(a):r+String(a)+t+es(i,2)}function nz(e,t){return e%60===0?(e>0?"-":"+")+es(Math.abs(e)/60,2):i0(e,t)}function i0(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=es(Math.trunc(n/60),2),i=es(n%60,2);return r+a+t+i}const sz=(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"})}},xne=(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"})}},Z4e=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return sz(e,t);let i;switch(n){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}}",sz(n,t)).replace("{{time}}",xne(a,t))},J4e={p:xne,P:Z4e},Q4e=/^D+$/,eke=/^Y+$/,tke=["D","DD","YY","YYYY"];function rke(e){return Q4e.test(e)}function nke(e){return eke.test(e)}function ske(e,t,r){const n=ake(e,t,r);if(console.warn(n),tke.includes(e))throw new RangeError(n)}function ake(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ike=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,oke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lke=/^'([^]*?)'?$/,cke=/''/g,uke=/[a-zA-Z]/;function Ot(e,t,r){var d,f,m,h,g,p,x,v;const n=l1(),a=(r==null?void 0:r.locale)??n.locale??xL,i=(r==null?void 0:r.firstWeekContainsDate)??((f=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((h=(m=n.locale)==null?void 0:m.options)==null?void 0:h.firstWeekContainsDate)??1,o=(r==null?void 0:r.weekStartsOn)??((p=(g=r==null?void 0:r.locale)==null?void 0:g.options)==null?void 0:p.weekStartsOn)??n.weekStartsOn??((v=(x=n.locale)==null?void 0:x.options)==null?void 0:v.weekStartsOn)??0,l=Pr(e);if(!u4e(l))throw new RangeError("Invalid time value");let c=t.match(oke).map(b=>{const y=b[0];if(y==="p"||y==="P"){const N=J4e[y];return N(b,a.formatLong)}return b}).join("").match(ike).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const y=b[0];if(y==="'")return{isToken:!1,value:dke(b)};if(tz[y])return{isToken:!0,value:b};if(y.match(uke))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(b=>{if(!b.isToken)return b.value;const y=b.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&nke(y)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&rke(y))&&ske(y,t,String(e));const N=tz[y[0]];return N(l,y,a.localize,u)}).join("")}function dke(e){const t=e.match(lke);return t?t[1].replace(cke,"'"):e}function fke(e,t,r){const n=l1(),a=(r==null?void 0:r.locale)??n.locale??xL,i=2520,o=n5(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o});let c,u;o>0?(c=Pr(t),u=Pr(e)):(c=Pr(e),u=Pr(t));const d=g4e(u,c),f=(iy(u)-iy(c))/1e3,m=Math.round((d-f)/60);let h;if(m<2)return r!=null&&r.includeSeconds?d<5?a.formatDistance("lessThanXSeconds",5,l):d<10?a.formatDistance("lessThanXSeconds",10,l):d<20?a.formatDistance("lessThanXSeconds",20,l):d<40?a.formatDistance("halfAMinute",0,l):d<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<ez){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}else{if(m<i)return a.formatDistance("xDays",1,l);if(m<UN){const g=Math.round(m/ez);return a.formatDistance("xDays",g,l)}else if(m<UN*2)return h=Math.round(m/UN),a.formatDistance("aboutXMonths",h,l)}if(h=p4e(u,c),h<12){const g=Math.round(m/UN);return a.formatDistance("xMonths",g,l)}else{const g=h%12,p=Math.trunc(h/12);return g<3?a.formatDistance("aboutXYears",p,l):g<9?a.formatDistance("overXYears",p,l):a.formatDistance("almostXYears",p+1,l)}}function hke(e,t){return fke(e,c4e(e),t)}function mke(e){const t=Pr(e),r=t.getFullYear(),n=t.getMonth(),a=yl(e,0);return a.setFullYear(r,n+1,0),a.setHours(0,0,0,0),a.getDate()}function pke(e){return Math.trunc(+Pr(e)/1e3)}function gke(e){const t=Pr(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function xke(e,t){return d4e(gke(e),po(e),t)+1}function D6(e,t){const r=Pr(e),n=Pr(t);return r.getTime()>n.getTime()}function vne(e,t){const r=Pr(e),n=Pr(t);return+r<+n}function IC(e,t){const r=Pr(e),n=Pr(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function vke(e,t){const r=Pr(e),n=Pr(t);return r.getFullYear()===n.getFullYear()}function M0(e,t){return Oo(e,-t)}function ll(e,t){const n=jke(e);let a;if(n.date){const c=_ke(n.date,2);a=Nke(c.restDateString,c.year)}if(!a||isNaN(a.getTime()))return new Date(NaN);const i=a.getTime();let o=0,l;if(n.time&&(o=Ske(n.time),isNaN(o)))return new Date(NaN);if(n.timezone){if(l=kke(n.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(i+o),u=new Date(0);return u.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),u.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),u}return new Date(i+o+l)}const qN={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},yke=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,bke=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,wke=/^([+-])(\d{2})(?::?(\d{2}))?$/;function jke(e){const t={},r=e.split(qN.dateTimeDelimiter);let n;if(r.length>2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],qN.timeZoneDelimiter.test(t.date)&&(t.date=e.split(qN.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){const a=qN.timezone.exec(n);a?(t.time=n.replace(a[1],""),t.timezone=a[1]):t.time=n}return t}function _ke(e,t){const r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};const a=n[1]?parseInt(n[1]):null,i=n[2]?parseInt(n[2]):null;return{year:i===null?a:i*100,restDateString:e.slice((n[1]||n[2]).length)}}function Nke(e,t){if(t===null)return new Date(NaN);const r=e.match(yke);if(!r)return new Date(NaN);const n=!!r[4],a=yb(r[1]),i=yb(r[2])-1,o=yb(r[3]),l=yb(r[4]),c=yb(r[5])-1;if(n)return Pke(t,l,c)?Cke(t,l,c):new Date(NaN);{const u=new Date(0);return!Ake(t,i,o)||!Tke(t,a)?new Date(NaN):(u.setUTCFullYear(t,i,Math.max(a,o)),u)}}function yb(e){return e?parseInt(e):1}function Ske(e){const t=e.match(bke);if(!t)return NaN;const r=G3(t[1]),n=G3(t[2]),a=G3(t[3]);return Oke(r,n,a)?r*lne+n*one+a*1e3:NaN}function G3(e){return e&&parseFloat(e.replace(",","."))||0}function kke(e){if(e==="Z")return 0;const t=e.match(wke);if(!t)return 0;const r=t[1]==="+"?-1:1,n=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return Dke(n,a)?r*(n*lne+a*one):NaN}function Cke(e,t,r){const n=new Date(0);n.setUTCFullYear(e,0,4);const a=n.getUTCDay()||7,i=(t-1)*7+r+1-a;return n.setUTCDate(n.getUTCDate()+i),n}const Eke=[31,null,31,30,31,30,31,31,30,31,30,31];function yne(e){return e%400===0||e%4===0&&e%100!==0}function Ake(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(Eke[t]||(yne(e)?29:28))}function Tke(e,t){return t>=1&&t<=(yne(e)?366:365)}function Pke(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}function Oke(e,t,r){return e===24?t===0&&r===0:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}function Dke(e,t){return t>=0&&t<=59}function K3(e,t){const r=Pr(e),n=r.getFullYear(),a=r.getDate(),i=yl(e,0);i.setFullYear(n,t,15),i.setHours(0,0,0,0);const o=mke(i);return r.setMonth(t,Math.min(a,o)),r}function az(e,t){const r=Pr(e);return isNaN(+r)?yl(e,NaN):(r.setFullYear(t),r)}function Ike(e,t){return sc(e,-1)}const Rke={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},Lke=(e,t,r)=>{let n;const a=Rke[e];return typeof a=="string"?n=a:t===1?n=a.one:n=a.other.replace("{{count}}",String(t)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"dans "+n:"il y a "+n:n},Fke={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Mke={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},$ke={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Bke={date:bv({formats:Fke,defaultWidth:"full"}),time:bv({formats:Mke,defaultWidth:"full"}),dateTime:bv({formats:$ke,defaultWidth:"full"})},zke={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},Uke=(e,t,r,n)=>zke[e],qke={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},Vke={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},Wke={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},Hke={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},Gke={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},Kke=(e,t)=>{const r=Number(e),n=t==null?void 0:t.unit;if(r===0)return"0";const a=["year","week","hour","minute","second"];let i;return r===1?i=n&&a.includes(n)?"ère":"er":i="ème",r+i},Yke=["MMM","MMMM"],Xke={preprocessor:(e,t)=>e.getDate()===1||!t.some(n=>n.isToken&&Yke.includes(n.value))?t:t.map(n=>n.isToken&&n.value==="do"?{isToken:!0,value:"d"}:n),ordinalNumber:Kke,era:Pd({values:qke,defaultWidth:"wide"}),quarter:Pd({values:Vke,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Pd({values:Wke,defaultWidth:"wide"}),day:Pd({values:Hke,defaultWidth:"wide"}),dayPeriod:Pd({values:Gke,defaultWidth:"wide"})},Zke=/^(\d+)(ième|ère|ème|er|e)?/i,Jke=/\d+/i,Qke={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},eCe={any:[/^av/i,/^ap/i]},tCe={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},rCe={any:[/1/i,/2/i,/3/i,/4/i]},nCe={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},sCe={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,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},aCe={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},iCe={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},oCe={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},lCe={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},cCe={ordinalNumber:hne({matchPattern:Zke,parsePattern:Jke,valueCallback:e=>parseInt(e)}),era:Od({matchPatterns:Qke,defaultMatchWidth:"wide",parsePatterns:eCe,defaultParseWidth:"any"}),quarter:Od({matchPatterns:tCe,defaultMatchWidth:"wide",parsePatterns:rCe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Od({matchPatterns:nCe,defaultMatchWidth:"wide",parsePatterns:sCe,defaultParseWidth:"any"}),day:Od({matchPatterns:aCe,defaultMatchWidth:"wide",parsePatterns:iCe,defaultParseWidth:"any"}),dayPeriod:Od({matchPatterns:oCe,defaultMatchWidth:"any",parsePatterns:lCe,defaultParseWidth:"any"})},yr={code:"fr",formatDistance:Lke,formatLong:Bke,formatRelative:Uke,localize:Xke,match:cCe,options:{weekStartsOn:1,firstWeekContainsDate:4}},iz=()=>{const{user:e,isAdmin:t}=Ur(),r=Xt(),[n,a]=w.useState([]),[i,o]=w.useState(0),[l,c]=w.useState(!1),[u,d]=w.useState(!0),f=async()=>{if(!e)return;const{data:b,error:y}=await he.from("notifications").select("*").eq("user_id",e.id).order("created_at",{ascending:!1}).limit(20);y&&console.error("Error loading user notifications:",y);let N=(b||[]).map(_=>({..._,source:"user"}));if(t){const{data:_,error:j}=await he.from("admin_notifications").select("*").order("created_at",{ascending:!1}).limit(20);j&&console.error("Error loading admin notifications:",j);const S=(_||[]).map(I=>({...I,link:typeof I.metadata=="object"&&I.metadata!==null&&"link"in I.metadata?String(I.metadata.link):null,source:"admin"}));N=[...N,...S]}N.sort((_,j)=>new Date(j.created_at).getTime()-new Date(_.created_at).getTime()),N=N.slice(0,30),a(N),o(N.filter(_=>!_.is_read).length),d(!1)};w.useEffect(()=>{if(!e)return;f();const b=he.channel("user-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"notifications",filter:`user_id=eq.${e.id}`},N=>{const _={...N.new,source:"user"};a(j=>[_,...j].slice(0,30)),o(j=>j+1)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"notifications",filter:`user_id=eq.${e.id}`},()=>f()).on("postgres_changes",{event:"DELETE",schema:"public",table:"notifications",filter:`user_id=eq.${e.id}`},()=>f()).subscribe();let y=null;return t&&(y=he.channel("admin-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"admin_notifications"},N=>{const _=N.new,j={..._,link:typeof _.metadata=="object"&&_.metadata!==null&&"link"in _.metadata?String(_.metadata.link):null,source:"admin"};a(S=>[j,...S].slice(0,30)),o(S=>S+1)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"admin_notifications"},()=>f()).on("postgres_changes",{event:"DELETE",schema:"public",table:"admin_notifications"},()=>f()).subscribe()),()=>{he.removeChannel(b),y&&he.removeChannel(y)}},[e,t]);const m=async b=>{const y=b.source==="admin"?"admin_notifications":"notifications";await he.from(y).update({is_read:!0}).eq("id",b.id),a(N=>N.map(_=>_.id===b.id?{..._,is_read:!0}:_)),o(N=>Math.max(0,N-1))},h=async()=>{const b=n.filter(N=>!N.is_read&&N.source==="user"),y=n.filter(N=>!N.is_read&&N.source==="admin");b.length>0&&await he.from("notifications").update({is_read:!0}).in("id",b.map(N=>N.id)),y.length>0&&t&&await he.from("admin_notifications").update({is_read:!0}).in("id",y.map(N=>N.id)),a(N=>N.map(_=>({..._,is_read:!0}))),o(0)},g=async b=>{const y=b.source==="admin"?"admin_notifications":"notifications";await he.from(y).delete().eq("id",b.id),a(N=>N.filter(_=>_.id!==b.id)),b.is_read||o(N=>Math.max(0,N-1))},p=b=>{b.is_read||m(b),b.link&&(c(!1),r(b.link))},x=(b,y)=>{if(y==="admin")return s.jsx(vl,{className:"h-4 w-4 text-amber-500"});switch(b){case"application":return s.jsx(s2,{className:"h-4 w-4 text-primary"});case"message":return s.jsx(zo,{className:"h-4 w-4 text-blue-500"});case"success":return s.jsx(Pn,{className:"h-4 w-4 text-green-500"});case"warning":return s.jsx(Di,{className:"h-4 w-4 text-amber-500"});default:return s.jsx(ey,{className:"h-4 w-4 text-muted-foreground"})}},v=(b,y)=>{if(y==="admin")return s.jsx(Le,{className:"bg-amber-500/10 text-amber-500",variant:"secondary",children:"Admin"});const N={application:"bg-primary/10 text-primary",message:"bg-blue-500/10 text-blue-500",success:"bg-green-500/10 text-green-500",warning:"bg-amber-500/10 text-amber-500",info:"bg-muted text-muted-foreground"},_={application:"Candidature",message:"Message",success:"Succès",warning:"Attention",info:"Info"};return s.jsx(Le,{className:N[b]||N.info,variant:"secondary",children:_[b]||"Info"})};return e?s.jsxs(rp,{open:l,onOpenChange:c,children:[s.jsx(np,{asChild:!0,children:s.jsxs(ne,{variant:"ghost",size:"icon",className:"relative",children:[s.jsx(AB,{className:"h-5 w-5"}),i>0&&s.jsx(Le,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:i>9?"9+":i})]})}),s.jsxs(fh,{className:"w-80 p-0",align:"end",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[s.jsx("h4",{className:"font-semibold",children:"Notifications"}),i>0&&s.jsx(ne,{variant:"ghost",size:"sm",className:"text-xs",onClick:h,children:"Tout marquer lu"})]}),s.jsx(ru,{className:"h-[400px]",children:u?s.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"Chargement..."}):n.length===0?s.jsxs("div",{className:"p-8 text-center text-muted-foreground",children:[s.jsx(AB,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),s.jsx("p",{children:"Aucune notification"})]}):s.jsx("div",{className:"divide-y",children:n.map(b=>s.jsx("div",{className:`p-4 transition-colors ${b.is_read?"":"bg-primary/5"} ${b.link?"hover:bg-muted/50 cursor-pointer":""}`,onClick:()=>b.link&&p(b),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-0.5",children:x(b.type,b.source)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v(b.type,b.source),!b.is_read&&s.jsx("span",{className:"h-2 w-2 bg-primary rounded-full"}),b.link&&s.jsx(Le,{variant:"outline",className:"text-xs",children:"Voir détails"})]}),s.jsx("p",{className:"font-medium text-sm truncate",children:b.title}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:b.message}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:hke(new Date(b.created_at),{addSuffix:!0,locale:yr})})]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[!b.is_read&&s.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:y=>{y.stopPropagation(),m(b)},children:s.jsx(Pn,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:y=>{y.stopPropagation(),g(b)},children:s.jsx(bi,{className:"h-4 w-4"})})]})]})},`${b.source}-${b.id}`))})})]})]}):null},Ye=w.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:pt("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:n,...r}));Ye.displayName="Input";var bne={exports:{}},wne={};/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ly=w;function uCe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dCe=typeof Object.is=="function"?Object.is:uCe,fCe=ly.useState,hCe=ly.useEffect,mCe=ly.useLayoutEffect,pCe=ly.useDebugValue;function gCe(e,t){var r=t(),n=fCe({inst:{value:r,getSnapshot:t}}),a=n[0].inst,i=n[1];return mCe(function(){a.value=r,a.getSnapshot=t,Y3(a)&&i({inst:a})},[e,r,t]),hCe(function(){return Y3(a)&&i({inst:a}),e(function(){Y3(a)&&i({inst:a})})},[e]),pCe(r),r}function Y3(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!dCe(e,r)}catch{return!0}}function xCe(e,t){return t()}var vCe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?xCe:gCe;wne.useSyncExternalStore=ly.useSyncExternalStore!==void 0?ly.useSyncExternalStore:vCe;bne.exports=wne;var yCe=bne.exports;function bCe(){return yCe.useSyncExternalStore(wCe,()=>!0,()=>!1)}function wCe(){return()=>{}}var vL="Avatar",[jCe]=Xa(vL),[_Ce,jne]=jCe(vL),_ne=w.forwardRef((e,t)=>{const{__scopeAvatar:r,...n}=e,[a,i]=w.useState("idle");return s.jsx(_Ce,{scope:r,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:s.jsx(zt.span,{...n,ref:t})})});_ne.displayName=vL;var Nne="AvatarImage",Sne=w.forwardRef((e,t)=>{const{__scopeAvatar:r,src:n,onLoadingStatusChange:a=()=>{},...i}=e,o=jne(Nne,r),l=NCe(n,i),c=ha(u=>{a(u),o.onImageLoadingStatusChange(u)});return ba(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?s.jsx(zt.img,{...i,ref:t,src:n}):null});Sne.displayName=Nne;var kne="AvatarFallback",Cne=w.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:n,...a}=e,i=jne(kne,r),[o,l]=w.useState(n===void 0);return w.useEffect(()=>{if(n!==void 0){const c=window.setTimeout(()=>l(!0),n);return()=>window.clearTimeout(c)}},[n]),o&&i.imageLoadingStatus!=="loaded"?s.jsx(zt.span,{...a,ref:t}):null});Cne.displayName=kne;function oz(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function NCe(e,{referrerPolicy:t,crossOrigin:r}){const n=bCe(),a=w.useRef(null),i=n?(a.current||(a.current=new window.Image),a.current):null,[o,l]=w.useState(()=>oz(i,e));return ba(()=>{l(oz(i,e))},[i,e]),ba(()=>{const c=f=>()=>{l(f)};if(!i)return;const u=c("loaded"),d=c("error");return i.addEventListener("load",u),i.addEventListener("error",d),t&&(i.referrerPolicy=t),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",u),i.removeEventListener("error",d)}},[i,r,t]),o}var Ene=_ne,Ane=Sne,Tne=Cne;const ps=w.forwardRef(({className:e,...t},r)=>s.jsx(Ene,{ref:r,className:pt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ps.displayName=Ene.displayName;const vi=w.forwardRef(({className:e,...t},r)=>s.jsx(Ane,{ref:r,className:pt("aspect-square h-full w-full",e),...t}));vi.displayName=Ane.displayName;const gs=w.forwardRef(({className:e,...t},r)=>s.jsx(Tne,{ref:r,className:pt("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));gs.displayName=Tne.displayName;const SCe="https://pedagobridge.com/functions/v1/ai-assistant",bb={"/training-request":{description:"Formulaire de création d'une offre de formation pour les écoles",suggestions:[{icon:Bc,text:"Comment remplir ce formulaire ?",category:"Aide formulaire"},{icon:Gt,text:"Quels domaines de formation choisir ?",category:"Conseil"},{icon:d0,text:"Qu'est-ce que la modalité de formation ?",category:"Explication"},{icon:MO,text:"Comment définir un bon TJM ?",category:"Budget"}]},"/trainer-register":{description:"Formulaire d'inscription pour les formateurs",suggestions:[{icon:Bc,text:"Comment m'inscrire comme formateur ?",category:"Inscription"},{icon:Gt,text:"Quelles spécialités indiquer ?",category:"Profil"},{icon:d0,text:"Quels documents dois-je fournir ?",category:"Documents"},{icon:sr,text:"Comment être visible sur la plateforme ?",category:"Visibilité"}]},"/school-register":{description:"Formulaire d'inscription pour les écoles",suggestions:[{icon:MO,text:"Comment inscrire mon établissement ?",category:"Inscription"},{icon:Gt,text:"Quelles informations fournir ?",category:"Profil"},{icon:d0,text:"Comment publier des offres ensuite ?",category:"Offres"},{icon:sr,text:"Comment contacter des formateurs ?",category:"Contact"}]},"/trainer-profile":{description:"Page de profil du formateur connecté",suggestions:[{icon:Gt,text:"Comment compléter mon profil ?",category:"Profil"},{icon:Bc,text:"Comment obtenir mon NDA ?",category:"NDA"},{icon:d0,text:"Quels documents télécharger ?",category:"Documents"},{icon:sr,text:"Comment améliorer ma visibilité ?",category:"Visibilité"}]},default:{description:"Navigation générale sur PedagoBridge",suggestions:[{icon:sr,text:"Comment trouver un formateur ?",category:"Recherche"},{icon:Gt,text:"Comment publier une offre de formation ?",category:"Écoles"},{icon:xl,text:"Comment m'inscrire comme formateur ?",category:"Formateurs"},{icon:d0,text:"Comment fonctionne la plateforme ?",category:"Général"}]}};function kCe({trigger:e,side:t="right"}){var _;const{user:r}=Ur(),n=ou(),[a,i]=w.useState(!1),[o,l]=w.useState([]),[c,u]=w.useState(""),[d,f]=w.useState(!1),m=w.useRef(null),h=w.useRef(null),p=(()=>{const j=n.pathname;if(bb[j])return bb[j];const S=Object.keys(bb).find(I=>I!=="default"&&j.startsWith(I));return S?bb[S]:bb.default})(),x=p.suggestions;w.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[o]),w.useEffect(()=>{a&&h.current&&setTimeout(()=>{var j;return(j=h.current)==null?void 0:j.focus()},100)},[a]);const v=async j=>{var k,V,C;const S=await fetch(SCe,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzc2MjQzNzQyLCJleHAiOjIwOTE2MDM3NDJ9.73Zk3EieShL_u8EKlAW2LekPnT1agaI3de2bE8hkWq4"},body:JSON.stringify({messages:j,userId:r==null?void 0:r.id,pageContext:{path:n.pathname,description:p.description}})});if(!S.ok)throw S.status===429?new Error("Trop de requêtes, veuillez réessayer dans quelques instants."):S.status===402?new Error("Service temporairement indisponible."):new Error("Erreur de connexion à l'assistant");if(!S.body)throw new Error("Pas de réponse");const I=S.body.getReader(),P=new TextDecoder;let F="",T="";for(;;){const{done:R,value:H}=await I.read();if(R)break;F+=P.decode(H,{stream:!0});let q;for(;(q=F.indexOf(`
`))!==-1;){let L=F.slice(0,q);if(F=F.slice(q+1),L.endsWith("\r")&&(L=L.slice(0,-1)),L.startsWith(":")||L.trim()===""||!L.startsWith("data: "))continue;const M=L.slice(6).trim();if(M==="[DONE]")break;try{const K=(C=(V=(k=JSON.parse(M).choices)==null?void 0:k[0])==null?void 0:V.delta)==null?void 0:C.content;K&&(T+=K,l(E=>{const A=E[E.length-1];return(A==null?void 0:A.role)==="assistant"?E.map((O,U)=>U===E.length-1?{...O,content:T}:O):[...E,{role:"assistant",content:T}]}))}catch{F=L+`
`+F;break}}}},b=async j=>{var I;if(!j.trim()||d)return;const S={role:"user",content:j.trim()};l(P=>[...P,S]),u(""),f(!0);try{await v([...o,S])}catch(P){console.error("Chat error:",P),ae.error(P instanceof Error?P.message:"Erreur de l'assistant"),l(F=>{const T=F[F.length-1];return(T==null?void 0:T.role)==="assistant"&&!T.content?F.slice(0,-1):F})}finally{f(!1),(I=h.current)==null||I.focus()}},y=j=>{j.preventDefault(),b(c)},N=j=>{b(j)};return r?s.jsxs(JR,{open:a,onOpenChange:i,children:[s.jsx(QR,{asChild:!0,children:e||s.jsxs(ne,{variant:"ghost",size:"sm",className:"flex items-center gap-1",children:[s.jsx(Em,{className:"h-4 w-4"}),"Assistant"]})}),s.jsxs(NC,{side:t,className:"w-[400px] sm:w-[450px] p-0 flex flex-col",children:[s.jsx(SC,{className:"p-4 border-b bg-primary/5",children:s.jsxs(kC,{className:"flex items-center gap-2",children:[s.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(Em,{className:"h-4 w-4 text-primary"})}),s.jsxs("div",{children:[s.jsx("span",{className:"text-base",children:"Assistant PedagoBridge"}),s.jsx("p",{className:"text-xs font-normal text-muted-foreground",children:"Je suis là pour vous aider"})]})]})}),s.jsx(ru,{className:"flex-1 p-4",ref:m,children:o.length===0?s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[s.jsx(Uo,{className:"h-4 w-4 text-primary"}),"Comment puis-je vous aider ?"]}),s.jsx("div",{className:"grid gap-2",children:x.map((j,S)=>s.jsxs(ne,{variant:"outline",size:"sm",className:"h-auto p-3 justify-start text-left hover:bg-primary/5 hover:border-primary/30",onClick:()=>N(j.text),children:[s.jsx(j.icon,{className:"h-4 w-4 mr-2 text-primary shrink-0"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] text-muted-foreground",children:j.category}),s.jsx("div",{className:"text-xs font-medium",children:j.text})]})]},S))})]}):s.jsxs("div",{className:"space-y-3",children:[o.map((j,S)=>s.jsxs("div",{className:`flex gap-2 ${j.role==="user"?"justify-end":"justify-start"}`,children:[j.role==="assistant"&&s.jsx(ps,{className:"h-6 w-6 shrink-0",children:s.jsx(gs,{className:"bg-primary/10 text-primary text-xs",children:s.jsx(Em,{className:"h-3 w-3"})})}),s.jsx("div",{className:`max-w-[85%] rounded-xl px-3 py-2 ${j.role==="user"?"bg-primary text-primary-foreground":"bg-muted"}`,children:s.jsx("p",{className:"whitespace-pre-wrap text-xs",children:j.content})}),j.role==="user"&&s.jsx(ps,{className:"h-6 w-6 shrink-0",children:s.jsx(gs,{className:"bg-secondary text-xs",children:s.jsx(qo,{className:"h-3 w-3"})})})]},S)),d&&((_=o[o.length-1])==null?void 0:_.role)==="user"&&s.jsxs("div",{className:"flex gap-2 justify-start",children:[s.jsx(ps,{className:"h-6 w-6 shrink-0",children:s.jsx(gs,{className:"bg-primary/10 text-primary text-xs",children:s.jsx(Em,{className:"h-3 w-3"})})}),s.jsx("div",{className:"bg-muted rounded-xl px-3 py-2",children:s.jsx(at,{className:"h-3 w-3 animate-spin"})})]})]})}),s.jsxs("form",{onSubmit:y,className:"p-3 border-t bg-muted/30",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{ref:h,value:c,onChange:j=>u(j.target.value),placeholder:"Posez votre question...",disabled:d,className:"flex-1 h-9 text-sm"}),s.jsx(ne,{type:"submit",size:"sm",disabled:d||!c.trim(),children:d?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsx(ta,{className:"h-4 w-4"})})]}),s.jsx("p",{className:"text-[10px] text-muted-foreground mt-2 text-center",children:"L'assistant peut faire des erreurs."})]})]})]}):null}const CCe=()=>{const{user:e,isAdmin:t,isTrainer:r,isSchool:n,signOut:a}=Ur(),i=Xt(),o=ou(),[l,c]=w.useState(!1),u=p=>{if(c(!1),o.pathname!=="/")i("/",{state:{scrollTo:p}});else{const x=document.getElementById(p);x&&x.scrollIntoView({behavior:"smooth"})}},d=p=>{c(!1),i(p)},f=async()=>{c(!1),await a(),i("/")},m=({mobile:p=!1})=>s.jsxs("div",{className:p?"flex flex-col gap-1":"flex items-center gap-4",children:[s.jsx("button",{onClick:()=>d("/trainers"),className:`text-sm font-medium hover:text-primary transition-colors ${p?"w-full text-left px-4 py-3 rounded-lg hover:bg-muted":""}`,children:"Formateurs"}),s.jsx("button",{onClick:()=>d("/training-offers"),className:`text-sm font-medium hover:text-primary transition-colors ${p?"w-full text-left px-4 py-3 rounded-lg hover:bg-muted":""}`,children:"Offres"}),p?s.jsxs("div",{className:"border-t border-border pt-2 mt-1",children:[s.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase px-4 py-2 tracking-wider",children:"Établissements"}),s.jsxs("button",{type:"button",onClick:()=>d("/pour-les-ecoles"),className:"w-full text-left px-4 py-3 rounded-lg hover:bg-muted text-sm font-medium hover:text-primary transition-colors flex items-center gap-2",children:[s.jsx(Vr,{className:"h-4 w-4 opacity-60"}),"Pour les établissements"]}),s.jsxs("button",{type:"button",onClick:()=>d("/constitution-de-programme"),className:"w-full text-left px-4 py-3 rounded-lg hover:bg-muted text-sm font-medium hover:text-primary transition-colors flex items-center gap-2",children:[s.jsx(Bc,{className:"h-4 w-4 opacity-60"}),"Constitution de programmes"]}),s.jsxs("button",{type:"button",onClick:()=>d("/assistance-nda"),className:"w-full text-left px-4 py-3 rounded-lg hover:bg-muted text-sm font-medium hover:text-primary transition-colors flex items-center gap-2",children:[s.jsx(Vc,{className:"h-4 w-4 opacity-60"}),"Assistance NDA formateurs"]}),s.jsxs("button",{type:"button",onClick:()=>d("/school-register"),className:"w-full text-left px-4 py-3 rounded-lg hover:bg-muted text-sm font-medium text-primary transition-colors flex items-center gap-2",children:[s.jsx(Vr,{className:"h-4 w-4"}),"Inscrire mon établissement"]})]}):s.jsxs(A6,{modal:!1,children:[s.jsx(T6,{asChild:!0,children:s.jsxs("button",{className:"text-sm font-medium hover:text-primary transition-colors flex items-center gap-1",children:["Établissements",s.jsx(bh,{className:"h-3.5 w-3.5 opacity-60"})]})}),s.jsxs(J5,{align:"start",className:"z-[100] bg-background border border-border shadow-lg min-w-[220px]",children:[s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/pour-les-ecoles"),children:[s.jsx(Vr,{className:"mr-2 h-4 w-4"}),"Pour les établissements"]}),s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/constitution-de-programme"),children:[s.jsx(Bc,{className:"mr-2 h-4 w-4"}),"Constitution de programmes"]}),s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/offre-ecoles"),children:[s.jsx(Gt,{className:"mr-2 h-4 w-4"}),"Offre SaaS"]}),s.jsx(cL,{}),s.jsxs(Nc,{className:"cursor-pointer font-medium text-primary",onSelect:()=>d("/school-register"),children:[s.jsx(Vr,{className:"mr-2 h-4 w-4"}),"Inscrire mon établissement"]})]})]}),e&&s.jsx(kCe,{trigger:s.jsxs("button",{className:`text-sm font-medium hover:text-primary transition-colors flex items-center gap-1 ${p?"w-full text-left px-4 py-3 rounded-lg hover:bg-muted":""}`,children:[s.jsx(Em,{className:"h-4 w-4"}),"Assistant"]})})]}),h=()=>s.jsxs(s.Fragment,{children:[n&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d("/school/dashboard"),children:[s.jsx(Vr,{className:"mr-2 h-4 w-4"}),"Mon Espace"]}),e&&s.jsx(iz,{}),t&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>d("/admin"),children:[s.jsx(vl,{className:"mr-2 h-4 w-4"}),"Administration"]}),r&&s.jsxs(A6,{modal:!1,children:[s.jsx(T6,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(qo,{className:"mr-2 h-4 w-4"}),"Mon Espace"]})}),s.jsxs(J5,{align:"end",className:"z-[100] bg-background border border-border shadow-lg min-w-[200px]",children:[s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/trainer/profile"),children:[s.jsx(qo,{className:"mr-2 h-4 w-4"}),"Mon Profil"]}),s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/trainer/planning"),children:[s.jsx($O,{className:"mr-2 h-4 w-4"}),"Mon Planning"]}),s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/trainer/bpf"),children:[s.jsx(Bc,{className:"mr-2 h-4 w-4"}),"Mon BPF"]}),s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/trainer/applications"),children:[s.jsx(as,{className:"mr-2 h-4 w-4"}),"Mes Candidatures"]}),s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/trainer/messages"),children:[s.jsx(zo,{className:"mr-2 h-4 w-4"}),"Messages"]}),s.jsxs(Nc,{className:"cursor-pointer",onSelect:()=>d("/trainer/contract"),children:[s.jsx(Gt,{className:"mr-2 h-4 w-4"}),"Mon Contrat"]})]})]}),e?s.jsxs(ne,{onClick:f,variant:"ghost",size:"sm",children:[s.jsx(PB,{className:"mr-2 h-4 w-4"}),"Déconnexion"]}):s.jsx(ne,{onClick:()=>d("/auth"),variant:"ghost",size:"sm",children:"Connexion"}),s.jsx(ne,{onClick:()=>u("contact"),variant:"default",size:"sm",children:"Contact"})]}),g=()=>s.jsxs("div",{className:"flex flex-col gap-2 pt-4 border-t border-border",children:[e&&s.jsxs("div",{className:"flex items-center justify-between px-2 py-2 mb-2 border-b border-border",children:[s.jsx("span",{className:"text-sm font-medium",children:"Notifications"}),s.jsx(iz,{})]}),n&&s.jsxs(ne,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>d("/school/dashboard"),children:[s.jsx(Vr,{className:"mr-3 h-5 w-5"}),"Mon Espace École"]}),r&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>d("/trainer/profile"),children:[s.jsx(qo,{className:"mr-3 h-5 w-5"}),"Mon Profil Formateur"]}),s.jsxs(ne,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>d("/trainer/planning"),children:[s.jsx($O,{className:"mr-3 h-5 w-5"}),"Mon Planning"]}),s.jsxs(ne,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>d("/trainer/bpf"),children:[s.jsx(Bc,{className:"mr-3 h-5 w-5"}),"Mon BPF"]})]}),t&&s.jsxs(ne,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>d("/admin"),children:[s.jsx(vl,{className:"mr-3 h-5 w-5"}),"Administration"]}),s.jsxs("div",{className:"pt-4 space-y-2",children:[e?s.jsxs(ne,{onClick:f,variant:"outline",className:"w-full h-12",children:[s.jsx(PB,{className:"mr-3 h-5 w-5"}),"Déconnexion"]}):s.jsx(ne,{onClick:()=>d("/auth"),variant:"outline",className:"w-full h-12",children:"Connexion"}),s.jsx(ne,{onClick:()=>u("contact"),variant:"default",className:"w-full h-12",children:"Contact"})]})]});return s.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-background/95 backdrop-blur-sm border-b border-border",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"flex items-center justify-between h-16",children:[s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 cursor-pointer shrink-0",onClick:()=>d("/"),children:[s.jsx("img",{src:z9,alt:"PedagoBridge Logo",className:"h-8 w-8 sm:h-10 sm:w-10 rounded-lg"}),s.jsx("span",{className:"text-lg sm:text-xl font-bold hidden xs:inline",children:"PedagoBridge"})]}),s.jsxs("div",{className:"hidden lg:flex items-center gap-4 flex-wrap",children:[s.jsx(m,{}),s.jsx(h,{})]}),s.jsxs("div",{className:"flex items-center gap-2 lg:hidden",children:[s.jsx(ne,{onClick:()=>u("contact"),variant:"default",size:"sm",className:"hidden sm:flex",children:"Contact"}),s.jsxs(JR,{open:l,onOpenChange:c,children:[s.jsx(QR,{asChild:!0,children:s.jsxs(ne,{variant:"ghost",size:"icon",className:"h-10 w-10",children:[s.jsx(Mve,{className:"h-6 w-6"}),s.jsx("span",{className:"sr-only",children:"Menu"})]})}),s.jsxs(NC,{side:"right",className:"w-[300px] sm:w-[350px] p-0",children:[s.jsx(SC,{className:"p-6 pb-4 border-b border-border",children:s.jsxs(kC,{className:"flex items-center gap-3",children:[s.jsx("img",{src:z9,alt:"PedagoBridge",className:"h-8 w-8 rounded-lg"}),s.jsx("span",{children:"PedagoBridge"})]})}),s.jsxs("div",{className:"flex flex-col p-6 overflow-y-auto max-h-[calc(100vh-80px)]",children:[s.jsx(m,{mobile:!0}),s.jsx(g,{})]})]})]})]})]})})})},ECe=()=>{const e=Xt(),t=ou(),{data:r}=ga({queryKey:["top-skills-footer"],queryFn:async()=>{const{data:i}=await he.rpc("get_public_trainer_profiles");if(!i)return[];const o={};return i.forEach(l=>{var c;(c=l.specialties)==null||c.forEach(u=>{const d=u.trim();d&&(o[d]=(o[d]||0)+1)})}),Object.entries(o).sort((l,c)=>c[1]-l[1]).slice(0,20).map(([l])=>l)},staleTime:1e3*60*30}),n=i=>{if(t.pathname!=="/")e("/",{state:{scrollTo:i}});else{const o=document.getElementById(i);o&&o.scrollIntoView({behavior:"smooth"})}},a=i=>encodeURIComponent(i.toLowerCase().replace(/\s+/g,"-"));return s.jsx("footer",{className:"bg-foreground text-background py-12",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-5 gap-8 mb-8",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-bold mb-4",children:"PedagoBridge"}),s.jsx("p",{className:"opacity-90",children:"Excellence en formation pour les établissements d'enseignement, centres de formation professionnelle et entreprises."})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"Liens Rapides"}),s.jsxs("ul",{className:"space-y-2 opacity-90",children:[s.jsx("li",{children:s.jsx("button",{onClick:()=>n("about"),className:"hover:text-secondary transition-colors text-left",children:"À propos"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/trainers"),className:"hover:text-secondary transition-colors text-left",children:"Nos formateurs"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/skills"),className:"hover:text-secondary transition-colors text-left",children:"Compétences"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/villes"),className:"hover:text-secondary transition-colors text-left",children:"Villes"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/training-offers"),className:"hover:text-secondary transition-colors text-left",children:"Offres de formation"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/ressources"),className:"hover:text-secondary transition-colors text-left",children:"Ressources"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/glossaire"),className:"hover:text-secondary transition-colors text-left",children:"Glossaire"})}),s.jsx("li",{children:s.jsx(vt,{to:"/tarif-formateur",className:"hover:text-secondary transition-colors text-left",children:"Tarif d'un formateur"})}),s.jsx("li",{children:s.jsx(vt,{to:"/devenir-formateur",className:"hover:text-secondary transition-colors text-left",children:"Devenir formateur"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/metiers"),className:"hover:text-secondary transition-colors text-left",children:"Fiches Métiers"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/blog"),className:"hover:text-secondary transition-colors text-left",children:"Blog"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/feedback"),className:"hover:text-secondary transition-colors text-left",children:"Nous faire un retour"})})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"Nos services"}),s.jsxs("ul",{className:"space-y-2 opacity-90",children:[s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/pour-les-ecoles"),className:"hover:text-secondary transition-colors text-left",children:"Pour les établissements"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/constitution-de-programme"),className:"hover:text-secondary transition-colors text-left",children:"Constitution de programmes"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/offre-ecoles"),className:"hover:text-secondary transition-colors text-left",children:"Offre SaaS écoles"})}),s.jsx("li",{children:s.jsx("a",{href:"https://certiskool.fr",target:"_blank",rel:"noopener noreferrer",className:"hover:text-secondary transition-colors text-left",children:"CertiSkool — certification écoles"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/tarifs-planning"),className:"hover:text-secondary transition-colors text-left",children:"Tarifs Planning formateur"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/assistance-nda"),className:"hover:text-secondary transition-colors text-left",children:"Assistance NDA formateurs"})}),s.jsx("li",{children:s.jsx("button",{type:"button",onClick:()=>e("/pourquoi-pedagobridge"),className:"hover:text-secondary transition-colors text-left",children:"Pourquoi PedagoBridge ?"})}),s.jsx("li",{children:s.jsx("button",{type:"button",onClick:()=>e("/school-register"),className:"hover:text-secondary transition-colors text-left",children:"Inscrire mon établissement"})})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"Informations Légales"}),s.jsxs("ul",{className:"space-y-2 opacity-90",children:[s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/privacy"),className:"hover:text-secondary transition-colors text-left",children:"Politique de confidentialité"})}),s.jsx("li",{children:s.jsx("button",{onClick:()=>e("/terms"),className:"hover:text-secondary transition-colors text-left",children:"CGU"})})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-4",children:"Contact"}),s.jsxs("ul",{className:"space-y-2 opacity-90",children:[s.jsx("li",{children:"contact-pedagobridge@qalamsoftware.com"}),s.jsx("li",{children:"+33 7 58 39 45 21"}),s.jsx("li",{children:"Paris, France"})]})]})]}),r&&r.length>0&&s.jsxs("div",{className:"border-t border-background/20 pt-8 mb-8",children:[s.jsx("h4",{className:"font-semibold mb-4",children:"Top Compétences"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(i=>s.jsx(vt,{to:`/competence/${a(i)}`,className:"text-sm px-3 py-1 rounded-full bg-background/10 hover:bg-background/20 transition-colors",children:i},i))})]}),s.jsxs("div",{className:"border-t border-background/20 pt-8 text-center opacity-75 space-y-2",children:[s.jsxs("p",{children:["© ",new Date().getFullYear()," PedagoBridge par ",s.jsx("a",{href:"https://qalamsoftware.fr",target:"_blank",rel:"noopener noreferrer",className:"hover:text-secondary transition-colors",children:"Qalam Software"}),". Tous droits réservés."]}),s.jsx("p",{className:"text-sm",children:"SIRET : 913 180 832 00010"})]})]})})},X3="pedagobridge_cookie_consent";function ACe(){const[e,t]=w.useState(!1);w.useEffect(()=>{if(!localStorage.getItem(X3)){const i=setTimeout(()=>t(!0),1e3);return()=>clearTimeout(i)}},[]);const r=()=>{localStorage.setItem(X3,"accepted"),t(!1)},n=()=>{localStorage.setItem(X3,"declined"),t(!1)};return e?s.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 p-4 animate-in slide-in-from-bottom-5 duration-500",children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsx("div",{className:"bg-card border border-border rounded-xl shadow-lg p-4 md:p-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-4",children:[s.jsx("div",{className:"flex-shrink-0 p-3 bg-primary/10 rounded-full",children:s.jsx(Sve,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"🍪 Nous utilisons des cookies"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Ce site utilise des cookies pour améliorer votre expérience, analyser le trafic et personnaliser le contenu. En continuant à naviguer, vous acceptez notre"," ",s.jsx(vt,{to:"/privacy-policy",className:"text-primary hover:underline",children:"politique de confidentialité"}),"."]})]}),s.jsxs("div",{className:"flex items-center gap-2 w-full md:w-auto",children:[s.jsx(ne,{variant:"outline",size:"sm",onClick:n,className:"flex-1 md:flex-none",children:"Refuser"}),s.jsx(ne,{size:"sm",onClick:r,className:"flex-1 md:flex-none",children:"Accepter"})]}),s.jsx("button",{onClick:n,className:"absolute top-2 right-2 md:static p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Fermer",children:s.jsx(Ri,{className:"h-4 w-4"})})]})})})}):null}const xa=({children:e})=>s.jsxs("div",{className:"min-h-screen flex flex-col",children:[s.jsx(CCe,{}),s.jsx("main",{className:"flex-1 pt-16",children:e}),s.jsx(ECe,{}),s.jsx(ACe,{})]});class TCe extends be.Component{constructor(r){super(r);zn(this,"handleReload",()=>{window.location.reload()});this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){Ai.error("React Error Boundary caught error",r,{action:"error_boundary",errorStack:n.componentStack,metadata:{errorName:r.name,errorMessage:r.message}})}render(){return this.state.hasError?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"max-w-md w-full text-center space-y-6",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx("div",{className:"p-4 bg-destructive/10 rounded-full",children:s.jsx(Yd,{className:"h-12 w-12 text-destructive"})})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Une erreur est survenue"}),s.jsx("p",{className:"text-muted-foreground",children:"Nous sommes désolés, quelque chose s'est mal passé. Notre équipe a été notifiée de ce problème."})]}),s.jsxs(ne,{onClick:this.handleReload,className:"gap-2",children:[s.jsx(yo,{className:"h-4 w-4"}),"Recharger la page"]}),!1]})}):this.props.children}}var PCe={},Pne={},One={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t=function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];if(typeof window<"u"){var l;typeof window.gtag>"u"&&(window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)}),(l=window).gtag.apply(l,i)}},r=t;e.default=r})(One);var Dne={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var t=/^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;function r(l){return l.toString().trim().replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g,function(c,u,d){return u>0&&u+c.length!==d.length&&c.search(t)>-1&&d.charAt(u-2)!==":"&&(d.charAt(u+c.length)!=="-"||d.charAt(u-1)==="-")&&d.charAt(u-1).search(/[^\s-]/)<0?c.toLowerCase():c.substr(1).search(/[A-Z]|\../)>-1?c:c.charAt(0).toUpperCase()+c.substr(1)})}function n(l){return typeof l=="string"&&l.indexOf("@")!==-1}var a="REDACTED (Potential Email Address)";function i(l){return n(l)?(console.warn("This arg looks like an email address, redacting."),a):l}function o(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,d=l||"";return c&&(d=r(l)),u&&(d=i(d)),d}})(Dne);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.GA4=void 0;var t=o(One),r=o(Dne),n=["eventCategory","eventAction","eventLabel","eventValue","hitType"],a=["title","location"],i=["page","hitType"];function o(C){return C&&C.__esModule?C:{default:C}}function l(C,R){if(C==null)return{};var H=c(C,R),q,L;if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(C);for(L=0;L<M.length;L++)q=M[L],!(R.indexOf(q)>=0)&&Object.prototype.propertyIsEnumerable.call(C,q)&&(H[q]=C[q])}return H}function c(C,R){if(C==null)return{};var H={},q=Object.keys(C),L,M;for(M=0;M<q.length;M++)L=q[M],!(R.indexOf(L)>=0)&&(H[L]=C[L]);return H}function u(C){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(R){return typeof R}:function(R){return R&&typeof Symbol=="function"&&R.constructor===Symbol&&R!==Symbol.prototype?"symbol":typeof R},u(C)}function d(C){return h(C)||m(C)||b(C)||f()}function f(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m(C){if(typeof Symbol<"u"&&C[Symbol.iterator]!=null||C["@@iterator"]!=null)return Array.from(C)}function h(C){if(Array.isArray(C))return y(C)}function g(C,R){var H=Object.keys(C);if(Object.getOwnPropertySymbols){var q=Object.getOwnPropertySymbols(C);R&&(q=q.filter(function(L){return Object.getOwnPropertyDescriptor(C,L).enumerable})),H.push.apply(H,q)}return H}function p(C){for(var R=1;R<arguments.length;R++){var H=arguments[R]!=null?arguments[R]:{};R%2?g(Object(H),!0).forEach(function(q){P(C,q,H[q])}):Object.getOwnPropertyDescriptors?Object.defineProperties(C,Object.getOwnPropertyDescriptors(H)):g(Object(H)).forEach(function(q){Object.defineProperty(C,q,Object.getOwnPropertyDescriptor(H,q))})}return C}function x(C,R){return _(C)||N(C,R)||b(C,R)||v()}function v(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(C,R){if(C){if(typeof C=="string")return y(C,R);var H=Object.prototype.toString.call(C).slice(8,-1);if(H==="Object"&&C.constructor&&(H=C.constructor.name),H==="Map"||H==="Set")return Array.from(C);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return y(C,R)}}function y(C,R){(R==null||R>C.length)&&(R=C.length);for(var H=0,q=new Array(R);H<R;H++)q[H]=C[H];return q}function N(C,R){var H=C==null?null:typeof Symbol<"u"&&C[Symbol.iterator]||C["@@iterator"];if(H!=null){var q,L,M,z,K=[],E=!0,A=!1;try{if(M=(H=H.call(C)).next,R!==0)for(;!(E=(q=M.call(H)).done)&&(K.push(q.value),K.length!==R);E=!0);}catch(O){A=!0,L=O}finally{try{if(!E&&H.return!=null&&(z=H.return(),Object(z)!==z))return}finally{if(A)throw L}}return K}}function _(C){if(Array.isArray(C))return C}function j(C,R){if(!(C instanceof R))throw new TypeError("Cannot call a class as a function")}function S(C,R){for(var H=0;H<R.length;H++){var q=R[H];q.enumerable=q.enumerable||!1,q.configurable=!0,"value"in q&&(q.writable=!0),Object.defineProperty(C,F(q.key),q)}}function I(C,R,H){return R&&S(C.prototype,R),Object.defineProperty(C,"prototype",{writable:!1}),C}function P(C,R,H){return R=F(R),R in C?Object.defineProperty(C,R,{value:H,enumerable:!0,configurable:!0,writable:!0}):C[R]=H,C}function F(C){var R=T(C,"string");return u(R)==="symbol"?R:String(R)}function T(C,R){if(u(C)!=="object"||C===null)return C;var H=C[Symbol.toPrimitive];if(H!==void 0){var q=H.call(C,R);if(u(q)!=="object")return q;throw new TypeError("@@toPrimitive must return a primitive value.")}return(R==="string"?String:Number)(C)}var k=function(){function C(){var R=this;j(this,C),P(this,"reset",function(){R.isInitialized=!1,R._testMode=!1,R._currentMeasurementId,R._hasLoadedGA=!1,R._isQueuing=!1,R._queueGtag=[]}),P(this,"_gtag",function(){for(var H=arguments.length,q=new Array(H),L=0;L<H;L++)q[L]=arguments[L];R._testMode||R._isQueuing?R._queueGtag.push(q):t.default.apply(void 0,q)}),P(this,"_loadGA",function(H,q){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"https://www.googletagmanager.com/gtag/js";if(!(typeof window>"u"||typeof document>"u")&&!R._hasLoadedGA){var M=document.createElement("script");M.async=!0,M.src="".concat(L,"?id=").concat(H),q&&M.setAttribute("nonce",q),document.body.appendChild(M),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},R._hasLoadedGA=!0}}),P(this,"_toGtagOptions",function(H){if(H){var q={cookieUpdate:"cookie_update",cookieExpires:"cookie_expires",cookieDomain:"cookie_domain",cookieFlags:"cookie_flags",userId:"user_id",clientId:"client_id",anonymizeIp:"anonymize_ip",contentGroup1:"content_group1",contentGroup2:"content_group2",contentGroup3:"content_group3",contentGroup4:"content_group4",contentGroup5:"content_group5",allowAdFeatures:"allow_google_signals",allowAdPersonalizationSignals:"allow_ad_personalization_signals",nonInteraction:"non_interaction",page:"page_path",hitCallback:"event_callback"},L=Object.entries(H).reduce(function(M,z){var K=x(z,2),E=K[0],A=K[1];return q[E]?M[q[E]]=A:M[E]=A,M},{});return L}}),P(this,"initialize",function(H){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!H)throw new Error("Require GA_MEASUREMENT_ID");var L=typeof H=="string"?[{trackingId:H}]:H;R._currentMeasurementId=L[0].trackingId;var M=q.gaOptions,z=q.gtagOptions,K=q.nonce,E=q.testMode,A=E===void 0?!1:E,O=q.gtagUrl;if(R._testMode=A,A||R._loadGA(R._currentMeasurementId,K,O),R.isInitialized||(R._gtag("js",new Date),L.forEach(function(J){var se=p(p(p({},R._toGtagOptions(p(p({},M),J.gaOptions))),z),J.gtagOptions);Object.keys(se).length?R._gtag("config",J.trackingId,se):R._gtag("config",J.trackingId)})),R.isInitialized=!0,!A){var U=d(R._queueGtag);for(R._queueGtag=[],R._isQueuing=!1;U.length;){var Y=U.shift();R._gtag.apply(R,d(Y)),Y[0]==="get"&&(R._isQueuing=!0)}}}),P(this,"set",function(H){if(!H){console.warn("`fieldsObject` is required in .set()");return}if(u(H)!=="object"){console.warn("Expected `fieldsObject` arg to be an Object");return}Object.keys(H).length===0&&console.warn("empty `fieldsObject` given to .set()"),R._gaCommand("set",H)}),P(this,"_gaCommandSendEvent",function(H,q,L,M,z){R._gtag("event",q,p(p({event_category:H,event_label:L,value:M},z&&{non_interaction:z.nonInteraction}),R._toGtagOptions(z)))}),P(this,"_gaCommandSendEventParameters",function(){for(var H=arguments.length,q=new Array(H),L=0;L<H;L++)q[L]=arguments[L];if(typeof q[0]=="string")R._gaCommandSendEvent.apply(R,d(q.slice(1)));else{var M=q[0],z=M.eventCategory,K=M.eventAction,E=M.eventLabel,A=M.eventValue;M.hitType;var O=l(M,n);R._gaCommandSendEvent(z,K,E,A,O)}}),P(this,"_gaCommandSendTiming",function(H,q,L,M){R._gtag("event","timing_complete",{name:q,value:L,event_category:H,event_label:M})}),P(this,"_gaCommandSendPageview",function(H,q){if(q&&Object.keys(q).length){var L=R._toGtagOptions(q),M=L.title,z=L.location,K=l(L,a);R._gtag("event","page_view",p(p(p(p({},H&&{page_path:H}),M&&{page_title:M}),z&&{page_location:z}),K))}else H?R._gtag("event","page_view",{page_path:H}):R._gtag("event","page_view")}),P(this,"_gaCommandSendPageviewParameters",function(){for(var H=arguments.length,q=new Array(H),L=0;L<H;L++)q[L]=arguments[L];if(typeof q[0]=="string")R._gaCommandSendPageview.apply(R,d(q.slice(1)));else{var M=q[0],z=M.page;M.hitType;var K=l(M,i);R._gaCommandSendPageview(z,K)}}),P(this,"_gaCommandSend",function(){for(var H=arguments.length,q=new Array(H),L=0;L<H;L++)q[L]=arguments[L];var M=typeof q[0]=="string"?q[0]:q[0].hitType;switch(M){case"event":R._gaCommandSendEventParameters.apply(R,q);break;case"pageview":R._gaCommandSendPageviewParameters.apply(R,q);break;case"timing":R._gaCommandSendTiming.apply(R,d(q.slice(1)));break;case"screenview":case"transaction":case"item":case"social":case"exception":console.warn("Unsupported send command: ".concat(M));break;default:console.warn("Send command doesn't exist: ".concat(M))}}),P(this,"_gaCommandSet",function(){for(var H=arguments.length,q=new Array(H),L=0;L<H;L++)q[L]=arguments[L];typeof q[0]=="string"&&(q[0]=P({},q[0],q[1])),R._gtag("set",R._toGtagOptions(q[0]))}),P(this,"_gaCommand",function(H){for(var q=arguments.length,L=new Array(q>1?q-1:0),M=1;M<q;M++)L[M-1]=arguments[M];switch(H){case"send":R._gaCommandSend.apply(R,L);break;case"set":R._gaCommandSet.apply(R,L);break;default:console.warn("Command doesn't exist: ".concat(H))}}),P(this,"ga",function(){for(var H=arguments.length,q=new Array(H),L=0;L<H;L++)q[L]=arguments[L];if(typeof q[0]=="string")R._gaCommand.apply(R,q);else{var M=q[0];R._gtag("get",R._currentMeasurementId,"client_id",function(z){R._isQueuing=!1;var K=R._queueGtag;for(M({get:function(O){return O==="clientId"?z:O==="trackingId"?R._currentMeasurementId:O==="apiVersion"?"1":void 0}});K.length;){var E=K.shift();R._gtag.apply(R,d(E))}}),R._isQueuing=!0}return R.ga}),P(this,"event",function(H,q){if(typeof H=="string")R._gtag("event",H,R._toGtagOptions(q));else{var L=H.action,M=H.category,z=H.label,K=H.value,E=H.nonInteraction,A=H.transport;if(!M||!L){console.warn("args.category AND args.action are required in event()");return}var O={hitType:"event",eventCategory:(0,r.default)(M),eventAction:(0,r.default)(L)};z&&(O.eventLabel=(0,r.default)(z)),typeof K<"u"&&(typeof K!="number"?console.warn("Expected `args.value` arg to be a Number."):O.eventValue=K),typeof E<"u"&&(typeof E!="boolean"?console.warn("`args.nonInteraction` must be a boolean."):O.nonInteraction=E),typeof A<"u"&&(typeof A!="string"?console.warn("`args.transport` must be a string."):(["beacon","xhr","image"].indexOf(A)===-1&&console.warn("`args.transport` must be either one of these values: `beacon`, `xhr` or `image`"),O.transport=A)),R._gaCommand("send",O)}}),P(this,"send",function(H){R._gaCommand("send",H)}),this.reset()}return I(C,[{key:"gtag",value:function(){this._gtag.apply(this,arguments)}}]),C}();e.GA4=k;var V=new k;e.default=V})(Pne);(function(e){function t(l){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},t(l)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.ReactGAImplementation=void 0;var r=a(Pne);function n(l){if(typeof WeakMap!="function")return null;var c=new WeakMap,u=new WeakMap;return(n=function(f){return f?u:c})(l)}function a(l,c){if(l&&l.__esModule)return l;if(l===null||t(l)!=="object"&&typeof l!="function")return{default:l};var u=n(c);if(u&&u.has(l))return u.get(l);var d={},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var m in l)if(m!=="default"&&Object.prototype.hasOwnProperty.call(l,m)){var h=f?Object.getOwnPropertyDescriptor(l,m):null;h&&(h.get||h.set)?Object.defineProperty(d,m,h):d[m]=l[m]}return d.default=l,u&&u.set(l,d),d}var i=r.GA4;e.ReactGAImplementation=i;var o=r.default;e.default=o})(PCe);const OCe=e=>{},DCe=()=>{},ICe=e=>{},RCe=()=>`${Date.now()}-${Math.random().toString(36).substring(2,11)}`,LCe=()=>{const e="pb_session_id";let t=sessionStorage.getItem(e);return t||(t=RCe(),sessionStorage.setItem(e,t)),t};class FCe{async getCurrentUserId(){var t;try{const{data:r}=await he.auth.getUser();return((t=r.user)==null?void 0:t.id)||null}catch{return null}}async track({eventType:t,eventName:r,trainerProfileId:n,schoolRequestId:a,metadata:i={}}){try{const o=await this.getCurrentUserId(),l=LCe();await he.from("analytics_events").insert({event_type:t,event_name:r,user_id:o,trainer_profile_id:n||null,school_request_id:a||null,metadata:{...i,session_id:l}})}catch(o){console.error("Analytics tracking error:",o)}}async trackSignup(t,r){await this.track({eventType:"signup",eventName:t==="school"?"École inscrite":"Formateur inscrit",metadata:{...r,role:t}})}async trackPageView(t,r){const n=new URLSearchParams(window.location.search),a={};["utm_source","utm_medium","utm_campaign","utm_content","utm_term"].forEach(i=>{const o=n.get(i);o&&(a[i]=o)}),await this.track({eventType:"page_view",eventName:t,metadata:{...r,url:window.location.pathname,search:window.location.search||void 0,referrer:document.referrer||void 0,...a}})}async trackProfileView(t,r){await this.track({eventType:"profile_view",eventName:"Trainer Profile Viewed",trainerProfileId:t,metadata:{trainerName:r}})}async trackOfferView(t,r){await this.track({eventType:"offer_view",eventName:"Offer Viewed",schoolRequestId:t,metadata:{offerTitle:r}})}async trackApplicationSent(t,r){await this.track({eventType:"application_sent",eventName:"Application Sent",schoolRequestId:t,trainerProfileId:r})}async trackSearch(t,r,n){await this.track({eventType:"search",eventName:"Search Performed",metadata:{query:t,filters:r,resultsCount:n}})}async trackOfferFilled(t){await this.track({eventType:"offer_filled",eventName:"Offer Marked as Filled",schoolRequestId:t})}async trackCVDownload(t,r){await this.track({eventType:"cv_download",eventName:"CV Downloaded",trainerProfileId:t,metadata:{trainerName:r}})}async trackSocialLinkClick(t,r,n){const a={linkedin:"LinkedIn",website:"Website",email:"Email"};await this.track({eventType:"social_link_click",eventName:`${a[r]} Link Clicked`,trainerProfileId:t,metadata:{trainerName:n,linkType:r}})}async trackContactClick(t,r){await this.track({eventType:"contact_click",eventName:"Contact Trainer Clicked",trainerProfileId:t,metadata:{trainerName:r}})}async trackNameCopied(t,r){await this.track({eventType:"name_copied",eventName:"Trainer Name Copied",trainerProfileId:t,metadata:{trainerName:r}})}}const xi=new FCe,MCe="/assets/hero-training-Bapo3PNV.jpg",$Ce=()=>{const e=Xt();return s.jsxs("section",{className:"relative min-h-[85vh] md:min-h-[90vh] flex items-center justify-center overflow-hidden",children:[s.jsx("div",{className:"absolute inset-0 z-0 bg-gradient-to-br from-primary/90 to-secondary/90",style:{backgroundImage:`linear-gradient(135deg, hsl(14 85% 60% / 0.92), hsl(250 50% 65% / 0.92)), url(${MCe})`,backgroundSize:"cover",backgroundPosition:"center"}}),s.jsxs("div",{className:"container mx-auto px-4 z-10 text-center text-white py-8",children:[s.jsx("h1",{className:"text-3xl sm:text-5xl md:text-7xl font-bold mb-4 md:mb-6 animate-fade-in",children:"PedagoBridge"}),s.jsx("p",{className:"text-base sm:text-xl md:text-2xl mb-6 md:mb-8 max-w-3xl mx-auto opacity-95 px-2",children:"Le pont entre formateurs experts, établissements d'excellence et entreprises"}),s.jsxs("div",{className:"flex flex-col gap-5 md:gap-7",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-stretch max-w-2xl mx-auto w-full",children:[s.jsxs("div",{className:"flex-1 bg-white/15 backdrop-blur-sm border border-white/40 rounded-xl p-4 flex flex-col items-center gap-3 hover:bg-white/20 transition-all",children:[s.jsx(Hve,{className:"h-7 w-7"}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-semibold text-base",children:"Vous êtes un établissement ?"}),s.jsx("p",{className:"text-white/80 text-xs mt-0.5",children:"CFA, OF, école — inscription gratuite"})]}),s.jsxs(ne,{size:"default",className:"w-full bg-white text-primary hover:bg-white/90 font-semibold shadow-md",onClick:()=>e("/school-register"),children:["Recruter un formateur",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})]}),s.jsxs("div",{className:"flex-1 bg-white/10 backdrop-blur-sm border border-white/30 rounded-xl p-4 flex flex-col items-center gap-3 hover:bg-white/15 transition-all",children:[s.jsx(sr,{className:"h-7 w-7"}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"font-semibold text-base",children:"Vous êtes formateur ?"}),s.jsx("p",{className:"text-white/80 text-xs mt-0.5",children:"Indépendant, expert — rejoignez le réseau"})]}),s.jsxs(ne,{size:"default",variant:"outline",className:"w-full bg-transparent border-white/60 text-white hover:bg-white/20 hover:text-white",onClick:()=>e("/trainer-register"),children:["Créer mon profil",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-3 justify-center text-sm text-white/70",children:[s.jsx("button",{type:"button",className:"hover:text-white underline underline-offset-2 transition-colors",onClick:()=>{const t=document.getElementById("trainers");t==null||t.scrollIntoView({behavior:"smooth"})},children:"Voir les formateurs"}),s.jsx("span",{children:"·"}),s.jsx("button",{type:"button",className:"hover:text-white underline underline-offset-2 transition-colors",onClick:()=>e("/training-offers"),children:"Offres de formation"}),s.jsx("span",{children:"·"}),s.jsx("button",{type:"button",className:"hover:text-white underline underline-offset-2 transition-colors",onClick:()=>e("/training-request"),children:"Déposer un besoin"})]})]})]})]})},ke=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:pt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ke.displayName="Card";const ht=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:pt("flex flex-col space-y-1.5 p-6",e),...t}));ht.displayName="CardHeader";const xt=w.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:pt("text-2xl font-semibold leading-none tracking-tight",e),...t}));xt.displayName="CardTitle";const Qr=w.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:pt("text-sm text-muted-foreground",e),...t}));Qr.displayName="CardDescription";const Ae=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:pt("p-6 pt-0",e),...t}));Ae.displayName="CardContent";const Ine=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:pt("flex items-center p-6 pt-0",e),...t}));Ine.displayName="CardFooter";const BCe=[{icon:sr,title:"Expertise Collective",description:"Une équipe de formateurs qualifiés et finement sélectionnés"},{icon:Fj,title:"Approche Personnalisée",description:"Des programmes sur mesure adaptés aux besoins spécifiques de chaque établissement"},{icon:yp,title:"Excellence Pédagogique",description:"Méthodes innovantes et éprouvées pour maximiser l'apprentissage"},{icon:mR,title:"Passion & Engagement",description:"Un collectif uni par la volonté de transmettre et de faire progresser"}],zCe=()=>s.jsx("section",{className:"py-20 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Pour Vous "}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Les principes qui guident notre action au quotidien"})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6 mb-16",children:BCe.map((e,t)=>{const r=e.icon;return s.jsxs(ke,{className:"p-6 text-center hover:shadow-lg transition-shadow border-border/50",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-full bg-primary/10 text-primary mb-4",children:s.jsx(r,{className:"h-7 w-7"})}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:e.title}),s.jsx("p",{className:"text-muted-foreground",children:e.description})]},t)})}),s.jsx("div",{className:"bg-card rounded-2xl p-8 md:p-12 shadow-sm border",children:s.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[s.jsx("h3",{className:"text-2xl md:text-3xl font-bold mb-6",children:"Notre Mission"}),s.jsx("p",{className:"text-lg text-muted-foreground leading-relaxed mb-6",children:"PedagoBridge connecte les Centres de Formation, Ecoles et Entreprises avec les meilleurs formateurs experts dans leur domaine. Nous créons des ponts entre vos besoins pédagogiques et les compétences des formateurs les plus qualifiés."}),s.jsx("p",{className:"text-lg text-muted-foreground leading-relaxed",children:"Notre plateforme garantit qualité, transparence et simplicité pour faciliter vos collaborations avec des experts passionnés et engagés dans la transmission de savoirs."})]})})]})}),UCe=[{icon:xve,title:"Prix Transparent",description:"Trouver un formateur avec PedagoBridge ne coûte pas plus cher qu'une recherche classique"},{icon:yp,title:"Qualité Garantie",description:"Nous assurons la qualité pédagogique de chaque formateur par un processus de validation rigoureux"},{icon:vl,title:"Garantie de Remplacement",description:"En cas d'urgence ou d'empêchement, nous garantissons un formateur de remplacement qualifié"},{icon:Bs,title:"Application Disponible",description:"Disponible dès maintenant : l'application de gestion des calendriers de formateurs, avec export facile pour les écoles.",available:!0,link:"/trainer/planning",cta:"Accéder au calendrier"}],qCe=()=>s.jsx("section",{className:"py-20 bg-background",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Nos Valeurs Ajoutées"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Les avantages qui font de PedagoBridge votre partenaire de confiance"})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-8 max-w-6xl mx-auto",children:UCe.map((e,t)=>{const r=e.icon,n=s.jsxs(ke,{className:`h-full p-8 text-center transition-all duration-300 border-border/50 ${e.available?"bg-gradient-to-br from-primary/5 to-secondary/5 border-primary/30 hover:shadow-xl hover:border-primary/50":"hover:shadow-lg"}`,children:[e.available&&s.jsx("span",{className:"inline-block mb-4 text-xs font-bold uppercase tracking-wider text-primary bg-primary/10 px-3 py-1 rounded-full",children:"Disponible"}),s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-6",children:s.jsx(r,{className:"h-8 w-8"})}),s.jsx("h3",{className:"text-2xl font-semibold mb-4",children:e.title}),s.jsx("p",{className:"text-muted-foreground text-lg leading-relaxed",children:e.description}),e.cta&&s.jsxs("span",{className:"inline-flex items-center gap-1 mt-6 font-semibold text-primary group-hover:gap-2 transition-all",children:[e.cta,s.jsx(Mn,{className:"h-4 w-4"})]})]});return e.link?s.jsx(vt,{to:e.link,className:"block group",children:n},t):s.jsx("div",{children:n},t)})})]})});function Zd({size:e="md",showTooltip:t=!0,className:r=""}){const n={sm:"text-[10px] px-1.5 py-0.5",md:"text-xs px-2 py-1",lg:"text-sm px-3 py-1.5"},a={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"},i=s.jsxs(Le,{className:`
bg-gradient-to-r from-emerald-600 to-emerald-500
text-white
border-0
gap-1
font-semibold
shadow-md
hover:from-emerald-700 hover:to-emerald-600
transition-all
${n[e]}
${r}
`,children:[s.jsx(vl,{className:a[e]}),"Certifié PedagoBridge"]});return t?s.jsx(Og,{children:s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:i}),s.jsx(Rd,{className:"max-w-sm p-4",side:"bottom",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-1.5 bg-emerald-100 rounded-full",children:s.jsx(yp,{className:"h-5 w-5 text-emerald-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-foreground",children:"Formateur Certifié"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Gage de qualité PedagoBridge"})]})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Ce formateur a passé notre ",s.jsx("strong",{className:"text-foreground",children:"processus de validation rigoureux"})," incluant :"]}),s.jsxs("ul",{className:"space-y-2 text-sm",children:[s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ma,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Vérification des compétences"})," : expertise technique validée par nos équipes"]})]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ma,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Qualités professionnelles"})," : expérience pédagogique et références vérifiées"]})]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ma,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Documents conformes"})," : diplômes, certifications et pièces légales validées"]})]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ma,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Conformité Qualiopi"})," : respect des exigences de certification qualité"]})]})]}),s.jsxs("div",{className:"pt-2 border-t flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(iu,{className:"h-3.5 w-3.5 text-amber-500"}),s.jsx("span",{children:"Prioritaire pour les missions et le support"})]})]})})]})}):i}const VCe={fluent:"Bilingue",advanced:"Anglais courant",intermediate:"Anglais intermédiaire",basic:"Anglais basique"},WCe={fluent:"Peut former entièrement en anglais",advanced:"Niveau professionnel C1/C2",intermediate:"Niveau B2",basic:"Notions de base"},Rne=({level:e,className:t=""})=>!e||!["fluent","advanced"].includes(e)?null:s.jsx(Og,{children:s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:s.jsxs(Le,{variant:"outline",className:`bg-blue-50 text-blue-700 border-blue-200 gap-1 ${t}`,children:[s.jsx(Ive,{className:"h-3 w-3"}),VCe[e]||"Anglophone"]})}),s.jsx(Rd,{children:s.jsx("p",{children:WCe[e]||"Compétent en anglais"})})]})});function HCe(e){let t=0;return e.bio&&e.bio.length>200?t+=15:e.bio&&e.bio.length>50&&(t+=10),(e.cv_url||e.cv_path)&&(t+=10),e.specialties&&e.specialties.length>=5?t+=15:e.specialties&&e.specialties.length>=3&&(t+=10),e.preferred_departments&&e.preferred_departments.length>0&&(t+=5),e.linkedin_url&&(t+=3),e.website_url&&(t+=2),e.photo_url&&(t+=10),e.email_verified&&(t+=8),t}const Z3=24*60*60*1e3;function GCe(e,t=Date.now()){let r=Math.round(Math.log10((e.view_count||0)+1)*12);if(e.updated_at){const n=t-new Date(e.updated_at).getTime();n>=0&&n<=30*Z3?r+=8:n>30*Z3&&n<=90*Z3&&(r+=4)}return e.referral_count&&e.referral_count>0&&(r+=Math.min(e.referral_count*4,12)),r}function lz(e,t){const r=(t||"").trim().toLowerCase();if(!r)return 0;const n=(e.specialties||[]).map(a=>a.toLowerCase());return(e.name||"").toLowerCase().includes(r)?4:n.some(a=>a===r)?3:n.some(a=>a.includes(r)||r.includes(a))?2:(e.bio||"").toLowerCase().includes(r)?1:0}function cz(e){return!e.country||e.country==="France"}function KCe(e,t,r){const n=lz(e,r),a=lz(t,r);if(n!==a)return a-n;if(e.isAffiliated!==t.isAffiliated)return e.isAffiliated?-1:1;const i=e.completenessScore+e.engagementScore,o=t.completenessScore+t.engagementScore;if(i!==o)return o-i;const l=cz(e),c=cz(t);return l!==c?l?-1:1:e.id<t.id?-1:e.id>t.id?1:0}function YCe(e,t,r=Date.now()){return{...e,isAffiliated:t.has(e.id)||!!e.manual_certified,completenessScore:HCe(e),engagementScore:GCe(e,r)}}function Hm(e,t,r){const n=Date.now();return e.map(a=>YCe(a,t,n)).sort((a,i)=>KCe(a,i,r))}const XCe=()=>{const e=Xt(),[t,r]=w.useState([]),[n,a]=w.useState(!0),i=10,o=async c=>{try{await he.rpc("increment_trainer_view",{trainer_id:c})}catch(u){console.error("Error incrementing view count:",u)}};w.useEffect(()=>{(async()=>{var u;try{const[d,f]=await Promise.all([he.rpc("get_public_trainer_profiles"),he.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0)]);if(d.error)throw d.error;const m=new Set(((u=f.data)==null?void 0:u.map(g=>g.trainer_id))||[]),h=Hm(d.data||[],m);r(h)}catch(d){console.error("Error fetching trainers:",d)}finally{a(!1)}})()},[]);const l=c=>c.split(" ").map(u=>u[0]).join("").toUpperCase().slice(0,2);return n?s.jsx("section",{className:"py-20 bg-background",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})})}):t.length===0?s.jsx("section",{className:"py-20 bg-background",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Nos Formateurs"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Des experts passionnés, chacun dans son domaine d'excellence"})]}),s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-muted-foreground text-lg",children:"Nos formateurs experts rejoignent la plateforme. Revenez bientôt pour découvrir leurs profils !"})})]})}):s.jsx("section",{className:"py-20 bg-background",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Nos Formateurs"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Des experts passionnés, chacun dans son domaine d'excellence"})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6",children:t.slice(0,i).map(c=>s.jsx(ke,{className:"hover:shadow-lg transition-all duration-300 border-border/50 group",children:s.jsxs(Ae,{className:"p-6 text-center",children:[s.jsxs(ps,{className:"w-24 h-24 mx-auto mb-4",children:[c.photo_url?s.jsx(vi,{src:c.photo_url,alt:c.name}):null,s.jsx(gs,{className:"text-2xl font-bold bg-primary text-primary-foreground",children:l(c.name)})]}),s.jsxs("div",{className:"flex items-center gap-2 justify-center mb-1",children:[s.jsx("h3",{className:"text-xl font-bold group-hover:text-primary transition-colors",children:c.name}),c.isAffiliated&&s.jsx(Zd,{size:"sm"})]}),c.english_level&&s.jsx("div",{className:"flex justify-center mb-1",children:s.jsx(Rne,{level:c.english_level})}),c.bio&&s.jsx("p",{className:"text-muted-foreground mb-4 text-sm line-clamp-2",children:c.bio}),s.jsxs("div",{className:"flex flex-wrap gap-2 justify-center mb-4",children:[c.specialties.slice(0,3).map((u,d)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:u},d)),c.specialties.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",c.specialties.length-3]})]}),s.jsx(ne,{variant:"outline",className:"w-full",onClick:()=>{o(c.id),e(`/trainers/${c.id}`)},children:"Voir le profil"})]})},c.id))}),s.jsx("div",{className:"text-center mt-10",children:s.jsxs(ne,{size:"lg",onClick:()=>e("/trainers"),className:"group",children:["Voir tous nos formateurs",s.jsx(Mn,{className:"ml-2 h-4 w-4 group-hover:translate-x-1 transition-transform"})]})})]})})},J3=[{icon:XJ,name:"Développement",keywords:["développement","dev","web","frontend","backend","fullstack","react","angular","vue","node","javascript","typescript","java","python","php","c#",".net","spring","express","django","api","rest","graphql","mobile","android","ios","flutter","swift","kotlin"],topics:["Développement Web","Frontend","Backend","Fullstack","Mobile","React","Angular","Vue.js","Node.js"]},{icon:SN,name:"Bases de Données",keywords:["sql","nosql","mongodb","postgresql","mysql","oracle","sql server","mariadb","redis","elasticsearch","base de données","bdd","sgbd","requêtes"],topics:["SQL","NoSQL","MongoDB","PostgreSQL","MySQL","Oracle","Modélisation BDD"]},{icon:SN,name:"Data Analyse",keywords:["data analyst","analyse de données","analytics","bi","business intelligence","power bi","tableau","looker","reporting","kpi","dashboard","excel avancé"],topics:["Power BI","Tableau","Excel Avancé","Reporting","KPI","Dashboards"]},{icon:SN,name:"Data Science",keywords:["data science","data scientist","machine learning","ml","deep learning","statistique","python data","r","pandas","numpy","scikit-learn","tensorflow","pytorch","modèles prédictifs"],topics:["Machine Learning","Deep Learning","Python Data","Statistiques","Modèles Prédictifs"]},{icon:SN,name:"Intelligence Artificielle",keywords:["ia","intelligence artificielle","ai","chatgpt","gpt","llm","nlp","traitement langage","prompt engineering","acculturation ia","générative","copilot","midjourney","dall-e"],topics:["Acculturation IA","ChatGPT","Prompt Engineering","IA Générative","NLP","LLM"]},{icon:tC,name:"Cloud & DevOps",keywords:["cloud","aws","azure","gcp","google cloud","devops","ci/cd","docker","kubernetes","k8s","terraform","ansible","jenkins","gitlab","github actions","infrastructure","iaas","paas","saas","microservices","conteneur","serverless"],topics:["AWS","Azure","GCP","Docker","Kubernetes","CI/CD","DevOps","Infrastructure Cloud"]},{icon:Uve,name:"Réseaux & Systèmes",keywords:["réseau","network","cisco","système","linux","windows server","active directory","vmware","virtualisation","tcp/ip","firewall","routeur","switch","vpn","wifi","administration système","sysadmin","serveur","dns","dhcp"],topics:["Réseaux","Administration Système","Linux","Windows Server","Virtualisation","Cisco"]},{icon:vl,name:"Cybersécurité",keywords:["cybersécurité","sécurité informatique","pentest","pentesting","ethical hacking","soc","siem","firewall","cryptographie","rgpd","iso 27001","audit sécurité","forensic","malware","vulnerability"],topics:["Cybersécurité","Pentest","SOC","RGPD","Audit Sécurité","ISO 27001"]},{icon:qve,name:"UI/UX Design",keywords:["ui","ux","design","figma","sketch","adobe xd","user experience","user interface","ergonomie","wireframe","prototype","accessibilité","design system","webdesign"],topics:["UI Design","UX Design","Figma","Prototypage","Ergonomie Web","Design System"]},{icon:Ave,name:"Gestion de Projet IT",keywords:["gestion de projet","project management","agile","scrum","kanban","prince2","pmp","jira","confluence","product owner","scrum master","safe","lean","sprint"],topics:["Agile","Scrum","Kanban","JIRA","Product Owner","Scrum Master"]},{icon:Wr,name:"Qualité & Tests",keywords:["qualité","test","qa","quality assurance","testing","selenium","cypress","jest","junit","automation","recette","intégration continue","tdd","bdd","performance test"],topics:["Tests Automatisés","QA","Selenium","Cypress","Tests de Performance","Recette"]},{icon:xl,name:"BTS & Diplômes",keywords:["bts","ndrc","mco","sam","sio","ciel","négociation","relation client","commerce","assistant manager","comptabilité","gestion pme"],topics:["BTS NDRC","BTS SIO","BTS CIEL","BTS MCO","BTS SAM","Négociation","Relation Client"]},{icon:mR,name:"Santé & Sécurité",keywords:["santé","sécurité au travail","sst","prap","ergonomie","prévention","risques professionnels","qhse","hse"],topics:["SST","Ergonomie","Prévention des risques","PRAP","QHSE"]},{icon:Cve,name:"Secourisme",keywords:["secourisme","psc1","premiers secours","afgsu","sauveteur","urgence","gestes qui sauvent","dae","défibrillateur"],topics:["PSC1","SST","Premiers secours","Gestes d'urgence","AFGSU"]},{icon:as,name:"Management",keywords:["management","leadership","gestion équipe","communication","stratégie","marketing","commercial","vente","négociation commerciale","manager"],topics:["Leadership","Gestion d'équipe","Communication","Stratégie","Marketing"]},{icon:Ii,name:"Pédagogie",keywords:["pédagogie","formation","formateur","e-learning","ingénierie pédagogique","andragogie","learning","enseignement"],topics:["Ingénierie pédagogique","E-learning","Formation de formateurs","Innovation"]},{icon:sr,name:"Ressources Humaines",keywords:["rh","ressources humaines","recrutement","gpec","droit du travail","paie","sirh","entretien","talent"],topics:["Recrutement","GPEC","Droit du travail","Paie","SIRH"]},{icon:Zve,name:"Industrie",keywords:["maintenance","lean","manufacturing","iso","6 sigma","amélioration continue","production","logistique","supply chain","autocad","cao","dao","électronique","mécanique","automatisme"],topics:["Maintenance","Lean Manufacturing","Normes ISO","Logistique","CAO/DAO"]}],ZCe=()=>{const e=Xt(),[t,r]=w.useState({});w.useEffect(()=>{(async()=>{const{data:o,error:l}=await he.from("trainer_profiles").select("specialties").eq("status","approved");if(l){console.error("Error fetching trainer specialties:",l);return}const c={};J3.forEach(d=>{c[d.name]=new Set(d.topics)}),o==null||o.forEach(d=>{var f;(f=d.specialties)==null||f.forEach(m=>{const h=m.toLowerCase();let g=!1;for(const p of J3)if(p.keywords.some(x=>h.includes(x)||x.includes(h))){c[p.name].add(m),g=!0;break}!g&&c.Industrie&&c.Industrie.add(m)})});const u={};Object.entries(c).forEach(([d,f])=>{u[d]=Array.from(f)}),r(u)})()},[]);const n=i=>{e(`/formateurs?specialty=${encodeURIComponent(i)}`)},a=i=>{e(`/formateurs?search=${encodeURIComponent(i)}`)};return s.jsx("section",{className:"py-12 md:py-20 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Domaines d'Activité Couverts"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Une expertise diversifiée pour répondre à tous vos besoins de formation"})]}),s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 md:gap-6",children:J3.map((i,o)=>{const l=i.icon,c=t[i.name]||i.topics;return s.jsxs(ke,{className:"p-4 md:p-6 hover:shadow-lg transition-all duration-300 border-border/50",children:[s.jsxs("div",{className:"flex items-start gap-3 md:gap-4 mb-4 cursor-pointer group",onClick:()=>a(i.name),children:[s.jsx("div",{className:"inline-flex items-center justify-center w-10 h-10 md:w-12 md:h-12 rounded-full bg-primary/10 text-primary flex-shrink-0 group-hover:bg-primary group-hover:text-primary-foreground transition-colors",children:s.jsx(l,{className:"h-5 w-5 md:h-6 md:w-6"})}),s.jsx("h3",{className:"text-lg md:text-xl font-bold pt-2 group-hover:text-primary transition-colors",children:i.name})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.slice(0,6).map((u,d)=>s.jsx(Le,{variant:"secondary",className:"text-xs cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",onClick:()=>n(u),children:u},d)),c.length>6&&s.jsxs(Le,{variant:"outline",className:"text-xs cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",onClick:()=>a(i.name),children:["+",c.length-6," autres"]})]})]},o)})})]})})};function RC(e){const t=w.useRef({value:e,previous:e});return w.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yL="Radio",[JCe,Lne]=Xa(yL),[QCe,eEe]=JCe(yL),Fne=w.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:a=!1,required:i,disabled:o,value:l="on",onCheck:c,form:u,...d}=e,[f,m]=w.useState(null),h=Cr(t,x=>m(x)),g=w.useRef(!1),p=f?u||!!f.closest("form"):!0;return s.jsxs(QCe,{scope:r,checked:a,disabled:o,children:[s.jsx(zt.button,{type:"button",role:"radio","aria-checked":a,"data-state":zne(a),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:h,onClick:Ct(e.onClick,x=>{a||c==null||c(),p&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})}),p&&s.jsx(Bne,{control:f,bubbles:!g.current,name:n,value:l,checked:a,required:i,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});Fne.displayName=yL;var Mne="RadioIndicator",$ne=w.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...a}=e,i=eEe(Mne,r);return s.jsx(Za,{present:n||i.checked,children:s.jsx(zt.span,{"data-state":zne(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})})});$ne.displayName=Mne;var tEe="RadioBubbleInput",Bne=w.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const o=w.useRef(null),l=Cr(o,i),c=RC(r),u=oC(t);return w.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&h){const g=new Event("click",{bubbles:n});h.call(d,r),d.dispatchEvent(g)}},[c,r,n]),s.jsx(zt.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Bne.displayName=tEe;function zne(e){return e?"checked":"unchecked"}var rEe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],LC="RadioGroup",[nEe]=Xa(LC,[o1,Lne]),Une=o1(),qne=Lne(),[sEe,aEe]=nEe(LC),Vne=w.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:a,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...m}=e,h=Une(r),g=Dg(u),[p,x]=Wo({prop:i,defaultProp:a??null,onChange:f,caller:LC});return s.jsx(sEe,{scope:r,name:n,required:o,disabled:l,value:p,onValueChange:x,children:s.jsx(eL,{asChild:!0,...h,orientation:c,dir:g,loop:d,children:s.jsx(zt.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:g,...m,ref:t})})})});Vne.displayName=LC;var Wne="RadioGroupItem",Hne=w.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...a}=e,i=aEe(Wne,r),o=i.disabled||n,l=Une(r),c=qne(r),u=w.useRef(null),d=Cr(t,u),f=i.value===a.value,m=w.useRef(!1);return w.useEffect(()=>{const h=p=>{rEe.includes(p.key)&&(m.current=!0)},g=()=>m.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",g)}},[]),s.jsx(tL,{asChild:!0,...l,focusable:!o,active:f,children:s.jsx(Fne,{disabled:o,required:i.required,checked:f,...c,...a,name:i.name,ref:d,onCheck:()=>i.onValueChange(a.value),onKeyDown:Ct(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Ct(a.onFocus,()=>{var h;m.current&&((h=u.current)==null||h.click())})})})});Hne.displayName=Wne;var iEe="RadioGroupIndicator",Gne=w.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,a=qne(r);return s.jsx($ne,{...a,...n,ref:t})});Gne.displayName=iEe;var Kne=Vne,Yne=Hne,oEe=Gne;const $0=w.forwardRef(({className:e,...t},r)=>s.jsx(Kne,{className:pt("grid gap-2",e),...t,ref:r}));$0.displayName=Kne.displayName;const Ro=w.forwardRef(({className:e,...t},r)=>s.jsx(Yne,{ref:r,className:pt("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:s.jsx(oEe,{className:"flex items-center justify-center",children:s.jsx(uR,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ro.displayName=Yne.displayName;var lEe="Label",Xne=w.forwardRef((e,t)=>s.jsx(zt.label,{...e,ref:t,onMouseDown:r=>{var a;r.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Xne.displayName=lEe;var Zne=Xne;const cEe=Wy("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=w.forwardRef(({className:e,...t},r)=>s.jsx(Zne,{ref:r,className:pt(cEe(),e),...t}));We.displayName=Zne.displayName;function jt(e,t,r){function n(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=o.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const m=d[f];m in l||(l[m]=u[m].bind(l))}}const a=(r==null?void 0:r.Parent)??Object;class i extends a{}Object.defineProperty(i,"name",{value:e});function o(l){var c;const u=r!=null&&r.Parent?new i:this;n(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:l=>{var c,u;return r!=null&&r.Parent&&l instanceof r.Parent?!0:(u=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:u.has(e)}}),Object.defineProperty(o,"name",{value:e}),o}class wv extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Jne extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Qne={};function cg(e){return Qne}function uEe(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,a])=>t.indexOf(+n)===-1).map(([n,a])=>a)}function I6(e,t){return typeof t=="bigint"?t.toString():t}function bL(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function wL(e){return e==null}function jL(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const uz=Symbol("evaluating");function Cs(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==uz)return n===void 0&&(n=uz,n=r()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Lg(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Fg(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function dz(e){return JSON.stringify(e)}function dEe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ese="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function r4(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const fEe=bL(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function v2(e){if(r4(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(r4(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function tse(e){return v2(e)?{...e}:Array.isArray(e)?[...e]:e}const hEe=new Set(["string","number","symbol"]);function cy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sp(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function zr(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function mEe(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function pEe(e,t){const r=e._zod.def,n=Fg(e._zod.def,{get shape(){const a={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(a[i]=r.shape[i])}return Lg(this,"shape",a),a},checks:[]});return Sp(e,n)}function gEe(e,t){const r=e._zod.def,n=Fg(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete a[i]}return Lg(this,"shape",a),a},checks:[]});return Sp(e,n)}function xEe(e,t){if(!v2(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const a=Fg(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Lg(this,"shape",i),i},checks:[]});return Sp(e,a)}function vEe(e,t){if(!v2(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return Lg(this,"shape",n),n},checks:e._zod.def.checks};return Sp(e,r)}function yEe(e,t){const r=Fg(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Lg(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Sp(e,r)}function bEe(e,t,r){const n=Fg(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(r)for(const o in r){if(!(o in a))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=e?new e({type:"optional",innerType:a[o]}):a[o])}else for(const o in a)i[o]=e?new e({type:"optional",innerType:a[o]}):a[o];return Lg(this,"shape",i),i},checks:[]});return Sp(t,n)}function wEe(e,t,r){const n=Fg(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(i[o]=new e({type:"nonoptional",innerType:a[o]}))}else for(const o in a)i[o]=new e({type:"nonoptional",innerType:a[o]});return Lg(this,"shape",i),i},checks:[]});return Sp(t,n)}function ev(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function rse(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function VN(e){return typeof e=="string"?e:e==null?void 0:e.message}function ug(e,t,r){var a,i,o,l,c,u;const n={...e,path:e.path??[]};if(!e.message){const d=VN((o=(i=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:i.error)==null?void 0:o.call(i,e))??VN((l=t==null?void 0:t.error)==null?void 0:l.call(t,e))??VN((c=r.customError)==null?void 0:c.call(r,e))??VN((u=r.localeError)==null?void 0:u.call(r,e))??"Invalid input";n.message=d}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function _L(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function y2(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const nse=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,I6,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},sse=jt("$ZodError",nse),ase=jt("$ZodError",nse,{Parent:Error});function jEe(e,t=r=>r.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}function _Ee(e,t=r=>r.message){const r={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let o=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(i))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return n(e),r}const NL=e=>(t,r,n,a)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new wv;if(o.issues.length){const l=new((a==null?void 0:a.Err)??e)(o.issues.map(c=>ug(c,i,cg())));throw ese(l,a==null?void 0:a.callee),l}return o.value},SL=e=>async(t,r,n,a)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const l=new((a==null?void 0:a.Err)??e)(o.issues.map(c=>ug(c,i,cg())));throw ese(l,a==null?void 0:a.callee),l}return o.value},FC=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},a);if(i instanceof Promise)throw new wv;return i.issues.length?{success:!1,error:new(e??sse)(i.issues.map(o=>ug(o,a,cg())))}:{success:!0,data:i.value}},NEe=FC(ase),MC=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},a);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(o=>ug(o,a,cg())))}:{success:!0,data:i.value}},SEe=MC(ase),kEe=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return NL(e)(t,r,a)},CEe=e=>(t,r,n)=>NL(e)(t,r,n),EEe=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return SL(e)(t,r,a)},AEe=e=>async(t,r,n)=>SL(e)(t,r,n),TEe=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return FC(e)(t,r,a)},PEe=e=>(t,r,n)=>FC(e)(t,r,n),OEe=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return MC(e)(t,r,a)},DEe=e=>async(t,r,n)=>MC(e)(t,r,n),IEe=/^[cC][^\s-]{8,}$/,REe=/^[0-9a-z]+$/,LEe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,FEe=/^[0-9a-vA-V]{20}$/,MEe=/^[A-Za-z0-9]{27}$/,$Ee=/^[a-zA-Z0-9_-]{21}$/,BEe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zEe=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,fz=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,UEe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qEe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function VEe(){return new RegExp(qEe,"u")}const WEe=/^(?:(?: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])$/,HEe=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,GEe=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,KEe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,YEe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ise=/^[A-Za-z0-9_-]*$/,XEe=/^\+(?:[0-9]){6,14}[0-9]$/,ose="(?:(?:\\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])))",ZEe=new RegExp(`^${ose}$`);function lse(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function JEe(e){return new RegExp(`^${lse(e)}$`)}function QEe(e){const t=lse({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${ose}T(?:${n})$`)}const eAe=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},tAe=/^[^A-Z]*$/,rAe=/^[^a-z]*$/,sf=jt("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),nAe=jt("$ZodCheckMaxLength",(e,t)=>{var r;sf.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!wL(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const a=n.value;if(a.length<=t.maximum)return;const o=_L(a);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),sAe=jt("$ZodCheckMinLength",(e,t)=>{var r;sf.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!wL(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const a=n.value;if(a.length>=t.minimum)return;const o=_L(a);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),aAe=jt("$ZodCheckLengthEquals",(e,t)=>{var r;sf.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!wL(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=n=>{const a=n.value,i=a.length;if(i===t.length)return;const o=_L(a),l=i>t.length;n.issues.push({origin:o,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),$C=jt("$ZodCheckStringFormat",(e,t)=>{var r,n;sf.init(e,t),e._zod.onattach.push(a=>{const i=a._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),iAe=jt("$ZodCheckRegex",(e,t)=>{$C.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),oAe=jt("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tAe),$C.init(e,t)}),lAe=jt("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rAe),$C.init(e,t)}),cAe=jt("$ZodCheckIncludes",(e,t)=>{sf.init(e,t);const r=cy(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(a=>{const i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),uAe=jt("$ZodCheckStartsWith",(e,t)=>{sf.init(e,t);const r=new RegExp(`^${cy(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),dAe=jt("$ZodCheckEndsWith",(e,t)=>{sf.init(e,t);const r=new RegExp(`.*${cy(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),fAe=jt("$ZodCheckOverwrite",(e,t)=>{sf.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class hAe{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
`).filter(o=>o),a=Math.min(...n.map(o=>o.length-o.trimStart().length)),i=n.map(o=>o.slice(a)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const t=Function,r=this==null?void 0:this.args,a=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...r,a.join(`
`))}}const mAe={major:4,minor:1,patch:13},Ja=jt("$ZodType",(e,t)=>{var a;var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=mAe;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const i of n)for(const o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const i=(l,c,u)=>{let d=ev(l),f;for(const m of c){if(m._zod.def.when){if(!m._zod.def.when(l))continue}else if(d)continue;const h=l.issues.length,g=m._zod.check(l);if(g instanceof Promise&&(u==null?void 0:u.async)===!1)throw new wv;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,l.issues.length!==h&&(d||(d=ev(l,h)))});else{if(l.issues.length===h)continue;d||(d=ev(l,h))}}return f?f.then(()=>l):l},o=(l,c,u)=>{if(ev(l))return l.aborted=!0,l;const d=i(c,n,u);if(d instanceof Promise){if(u.async===!1)throw new wv;return d.then(f=>e._zod.parse(f,u))}return e._zod.parse(d,u)};e._zod.run=(l,c)=>{if(c.skipChecks)return e._zod.parse(l,c);if(c.direction==="backward"){const d=e._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return d instanceof Promise?d.then(f=>o(f,l,c)):o(d,l,c)}const u=e._zod.parse(l,c);if(u instanceof Promise){if(c.async===!1)throw new wv;return u.then(d=>i(d,n,c))}return i(u,n,c)}}e["~standard"]={validate:i=>{var o;try{const l=NEe(e,i);return l.success?{value:l.data}:{issues:(o=l.error)==null?void 0:o.issues}}catch{return SEe(e,i).then(c=>{var u;return c.success?{value:c.data}:{issues:(u=c.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),kL=jt("$ZodString",(e,t)=>{var r;Ja.init(e,t),e._zod.pattern=[...((r=e==null?void 0:e._zod.bag)==null?void 0:r.patterns)??[]].pop()??eAe(e._zod.bag),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ks=jt("$ZodStringFormat",(e,t)=>{$C.init(e,t),kL.init(e,t)}),pAe=jt("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=zEe),Ks.init(e,t)}),gAe=jt("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=fz(n))}else t.pattern??(t.pattern=fz());Ks.init(e,t)}),xAe=jt("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=UEe),Ks.init(e,t)}),vAe=jt("$ZodURL",(e,t)=>{Ks.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),a=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=a.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),yAe=jt("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=VEe()),Ks.init(e,t)}),bAe=jt("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=$Ee),Ks.init(e,t)}),wAe=jt("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=IEe),Ks.init(e,t)}),jAe=jt("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=REe),Ks.init(e,t)}),_Ae=jt("$ZodULID",(e,t)=>{t.pattern??(t.pattern=LEe),Ks.init(e,t)}),NAe=jt("$ZodXID",(e,t)=>{t.pattern??(t.pattern=FEe),Ks.init(e,t)}),SAe=jt("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=MEe),Ks.init(e,t)}),kAe=jt("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=QEe(t)),Ks.init(e,t)}),CAe=jt("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ZEe),Ks.init(e,t)}),EAe=jt("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=JEe(t)),Ks.init(e,t)}),AAe=jt("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=BEe),Ks.init(e,t)}),TAe=jt("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=WEe),Ks.init(e,t),e._zod.bag.format="ipv4"}),PAe=jt("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=HEe),Ks.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),OAe=jt("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=GEe),Ks.init(e,t)}),DAe=jt("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=KEe),Ks.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[a,i]=n;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function cse(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const IAe=jt("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=YEe),Ks.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{cse(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function RAe(e){if(!ise.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return cse(r)}const LAe=jt("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ise),Ks.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{RAe(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),FAe=jt("$ZodE164",(e,t)=>{t.pattern??(t.pattern=XEe),Ks.init(e,t)});function MAe(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const $Ae=jt("$ZodJWT",(e,t)=>{Ks.init(e,t),e._zod.check=r=>{MAe(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),BAe=jt("$ZodUnknown",(e,t)=>{Ja.init(e,t),e._zod.parse=r=>r}),zAe=jt("$ZodNever",(e,t)=>{Ja.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function hz(e,t,r){e.issues.length&&t.issues.push(...rse(r,e.issues)),t.value[r]=e.value}const UAe=jt("$ZodArray",(e,t)=>{Ja.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const i=[];for(let o=0;o<a.length;o++){const l=a[o],c=t.element._zod.run({value:l,issues:[]},n);c instanceof Promise?i.push(c.then(u=>hz(u,r,o))):hz(c,r,o)}return i.length?Promise.all(i).then(()=>r):r}});function n4(e,t,r,n){e.issues.length&&t.issues.push(...rse(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function use(e){var n,a,i,o;const t=Object.keys(e.shape);for(const l of t)if(!((o=(i=(a=(n=e.shape)==null?void 0:n[l])==null?void 0:a._zod)==null?void 0:i.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const r=mEe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function dse(e,t,r,n,a,i){const o=[],l=a.keySet,c=a.catchall._zod,u=c.def.type;for(const d in t){if(l.has(d))continue;if(u==="never"){o.push(d);continue}const f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(m=>n4(m,r,d,t))):n4(f,r,d,t)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const qAe=jt("$ZodObject",(e,t)=>{Ja.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!(r!=null&&r.get)){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const n=bL(()=>use(t));Cs(e._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const d=l[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const f of d.values)c[u].add(f)}}return c});const a=r4,i=t.catchall;let o;e._zod.parse=(l,c)=>{o??(o=n.value);const u=l.value;if(!a(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const d=[],f=o.shape;for(const m of o.keys){const g=f[m]._zod.run({value:u[m],issues:[]},c);g instanceof Promise?d.push(g.then(p=>n4(p,l,m,u))):n4(g,l,m,u)}return i?dse(d,u,l,c,n.value,e):d.length?Promise.all(d).then(()=>l):l}}),VAe=jt("$ZodObjectJIT",(e,t)=>{qAe.init(e,t);const r=e._zod.parse,n=bL(()=>use(t)),a=m=>{const h=new hAe(["shape","payload","ctx"]),g=n.value,p=y=>{const N=dz(y);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};h.write("const input = payload.value;");const x=Object.create(null);let v=0;for(const y of g.keys)x[y]=`key_${v++}`;h.write("const newResult = {};");for(const y of g.keys){const N=x[y],_=dz(y);h.write(`const ${N} = ${p(y)};`),h.write(`
if (${N}.issues.length) {
payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
...iss,
path: iss.path ? [${_}, ...iss.path] : [${_}]
})));
}
if (${N}.value === undefined) {
if (${_} in input) {
newResult[${_}] = undefined;
}
} else {
newResult[${_}] = ${N}.value;
}
`)}h.write("payload.value = newResult;"),h.write("return payload;");const b=h.compile();return(y,N)=>b(m,y,N)};let i;const o=r4,l=!Qne.jitless,u=l&&fEe.value,d=t.catchall;let f;e._zod.parse=(m,h)=>{f??(f=n.value);const g=m.value;return o(g)?l&&u&&(h==null?void 0:h.async)===!1&&h.jitless!==!0?(i||(i=a(t.shape)),m=i(m,h),d?dse([],g,m,h,f,e):m):r(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function mz(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const a=e.filter(i=>!ev(i));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(o=>ug(o,n,cg())))}),t)}const WAe=jt("$ZodUnion",(e,t)=>{Ja.init(e,t),Cs(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),Cs(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),Cs(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),Cs(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){const a=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${a.map(i=>jL(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(a,i)=>{if(r)return n(a,i);let o=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:a.value,issues:[]},i);if(u instanceof Promise)l.push(u),o=!0;else{if(u.issues.length===0)return u;l.push(u)}}return o?Promise.all(l).then(c=>mz(c,a,e,i)):mz(l,a,e,i)}}),HAe=jt("$ZodIntersection",(e,t)=>{Ja.init(e,t),e._zod.parse=(r,n)=>{const a=r.value,i=t.left._zod.run({value:a,issues:[]},n),o=t.right._zod.run({value:a,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([c,u])=>pz(r,c,u)):pz(r,i,o)}});function R6(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(v2(e)&&v2(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),a={...e,...t};for(const i of n){const o=R6(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};a[i]=o.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=e[n],i=t[n],o=R6(a,i);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function pz(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),ev(e))return e;const n=R6(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const GAe=jt("$ZodEnum",(e,t)=>{Ja.init(e,t);const r=uEe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(a=>hEe.has(typeof a)).map(a=>typeof a=="string"?cy(a):a.toString()).join("|")})$`),e._zod.parse=(a,i)=>{const o=a.value;return n.has(o)||a.issues.push({code:"invalid_value",values:r,input:o,inst:e}),a}}),KAe=jt("$ZodLiteral",(e,t)=>{if(Ja.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?cy(n):n?cy(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,a)=>{const i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),YAe=jt("$ZodTransform",(e,t)=>{Ja.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Jne(e.constructor.name);const a=t.transform(r.value,r);if(n.async)return(a instanceof Promise?a:Promise.resolve(a)).then(o=>(r.value=o,r));if(a instanceof Promise)throw new wv;return r.value=a,r}});function gz(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const XAe=jt("$ZodOptional",(e,t)=>{Ja.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Cs(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Cs(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${jL(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(i=>gz(i,r.value)):gz(a,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ZAe=jt("$ZodNullable",(e,t)=>{Ja.init(e,t),Cs(e._zod,"optin",()=>t.innerType._zod.optin),Cs(e._zod,"optout",()=>t.innerType._zod.optout),Cs(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${jL(r.source)}|null)$`):void 0}),Cs(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),JAe=jt("$ZodDefault",(e,t)=>{Ja.init(e,t),e._zod.optin="optional",Cs(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(i=>xz(i,t)):xz(a,t)}});function xz(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const QAe=jt("$ZodPrefault",(e,t)=>{Ja.init(e,t),e._zod.optin="optional",Cs(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),e3e=jt("$ZodNonOptional",(e,t)=>{Ja.init(e,t),Cs(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(i=>vz(i,e)):vz(a,e)}});function vz(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const t3e=jt("$ZodCatch",(e,t)=>{Ja.init(e,t),Cs(e._zod,"optin",()=>t.innerType._zod.optin),Cs(e._zod,"optout",()=>t.innerType._zod.optout),Cs(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>ug(o,n,cg()))},input:r.value}),r.issues=[]),r)):(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(i=>ug(i,n,cg()))},input:r.value}),r.issues=[]),r)}}),r3e=jt("$ZodPipe",(e,t)=>{Ja.init(e,t),Cs(e._zod,"values",()=>t.in._zod.values),Cs(e._zod,"optin",()=>t.in._zod.optin),Cs(e._zod,"optout",()=>t.out._zod.optout),Cs(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(o=>WN(o,t.in,n)):WN(i,t.in,n)}const a=t.in._zod.run(r,n);return a instanceof Promise?a.then(i=>WN(i,t.out,n)):WN(a,t.out,n)}});function WN(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const n3e=jt("$ZodReadonly",(e,t)=>{Ja.init(e,t),Cs(e._zod,"propValues",()=>t.innerType._zod.propValues),Cs(e._zod,"values",()=>t.innerType._zod.values),Cs(e._zod,"optin",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.optin}),Cs(e._zod,"optout",()=>{var r,n;return(n=(r=t.innerType)==null?void 0:r._zod)==null?void 0:n.optout}),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(yz):yz(a)}});function yz(e){return e.value=Object.freeze(e.value),e}const s3e=jt("$ZodCustom",(e,t)=>{sf.init(e,t),Ja.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(i=>bz(i,r,n,e));bz(a,r,n,e)}});function bz(e,t,r,n){if(!e){const a={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(a.params=n._zod.def.params),t.issues.push(y2(a))}}var wz;class a3e{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const a={...n,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function i3e(){return new a3e}(wz=globalThis).__zod_globalRegistry??(wz.__zod_globalRegistry=i3e());const HN=globalThis.__zod_globalRegistry;function o3e(e,t){return new e({type:"string",...zr(t)})}function l3e(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...zr(t)})}function jz(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...zr(t)})}function c3e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...zr(t)})}function u3e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...zr(t)})}function d3e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...zr(t)})}function f3e(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...zr(t)})}function h3e(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...zr(t)})}function m3e(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...zr(t)})}function p3e(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...zr(t)})}function g3e(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...zr(t)})}function x3e(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...zr(t)})}function v3e(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...zr(t)})}function y3e(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...zr(t)})}function b3e(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...zr(t)})}function w3e(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...zr(t)})}function j3e(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...zr(t)})}function _3e(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...zr(t)})}function N3e(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...zr(t)})}function S3e(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...zr(t)})}function k3e(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...zr(t)})}function C3e(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...zr(t)})}function E3e(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...zr(t)})}function A3e(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...zr(t)})}function T3e(e,t){return new e({type:"string",format:"date",check:"string_format",...zr(t)})}function P3e(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...zr(t)})}function O3e(e,t){return new e({type:"string",format:"duration",check:"string_format",...zr(t)})}function D3e(e){return new e({type:"unknown"})}function I3e(e,t){return new e({type:"never",...zr(t)})}function fse(e,t){return new nAe({check:"max_length",...zr(t),maximum:e})}function s4(e,t){return new sAe({check:"min_length",...zr(t),minimum:e})}function hse(e,t){return new aAe({check:"length_equals",...zr(t),length:e})}function R3e(e,t){return new iAe({check:"string_format",format:"regex",...zr(t),pattern:e})}function L3e(e){return new oAe({check:"string_format",format:"lowercase",...zr(e)})}function F3e(e){return new lAe({check:"string_format",format:"uppercase",...zr(e)})}function M3e(e,t){return new cAe({check:"string_format",format:"includes",...zr(t),includes:e})}function $3e(e,t){return new uAe({check:"string_format",format:"starts_with",...zr(t),prefix:e})}function B3e(e,t){return new dAe({check:"string_format",format:"ends_with",...zr(t),suffix:e})}function c1(e){return new fAe({check:"overwrite",tx:e})}function z3e(e){return c1(t=>t.normalize(e))}function U3e(){return c1(e=>e.trim())}function q3e(){return c1(e=>e.toLowerCase())}function V3e(){return c1(e=>e.toUpperCase())}function W3e(){return c1(e=>dEe(e))}function H3e(e,t,r){return new e({type:"array",element:t,...zr(r)})}function G3e(e,t,r){return new e({type:"custom",check:"custom",fn:t,...zr(r)})}function K3e(e){const t=Y3e(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(y2(n,r.value,t._zod.def));else{const a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!t._zod.def.abort),r.issues.push(y2(a))}},e(r.value,r)));return t}function Y3e(e,t){const r=new sf({check:"custom",...zr(t)});return r._zod.check=e,r}const X3e=jt("ZodISODateTime",(e,t)=>{kAe.init(e,t),na.init(e,t)});function Z3e(e){return A3e(X3e,e)}const J3e=jt("ZodISODate",(e,t)=>{CAe.init(e,t),na.init(e,t)});function Q3e(e){return T3e(J3e,e)}const eTe=jt("ZodISOTime",(e,t)=>{EAe.init(e,t),na.init(e,t)});function tTe(e){return P3e(eTe,e)}const rTe=jt("ZodISODuration",(e,t)=>{AAe.init(e,t),na.init(e,t)});function nTe(e){return O3e(rTe,e)}const mse=(e,t)=>{sse.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>_Ee(e,r)},flatten:{value:r=>jEe(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,I6,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,I6,2)}},isEmpty:{get(){return e.issues.length===0}}})},_z=jt("ZodError",mse),cu=jt("ZodError",mse,{Parent:Error}),sTe=NL(cu),aTe=SL(cu),iTe=FC(cu),oTe=MC(cu),lTe=kEe(cu),cTe=CEe(cu),uTe=EEe(cu),dTe=AEe(cu),fTe=TEe(cu),hTe=PEe(cu),mTe=OEe(cu),pTe=DEe(cu),wi=jt("ZodType",(e,t)=>(Ja.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Fg(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>Sp(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>sTe(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>iTe(e,r,n),e.parseAsync=async(r,n)=>aTe(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>oTe(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>lTe(e,r,n),e.decode=(r,n)=>cTe(e,r,n),e.encodeAsync=async(r,n)=>uTe(e,r,n),e.decodeAsync=async(r,n)=>dTe(e,r,n),e.safeEncode=(r,n)=>fTe(e,r,n),e.safeDecode=(r,n)=>hTe(e,r,n),e.safeEncodeAsync=async(r,n)=>mTe(e,r,n),e.safeDecodeAsync=async(r,n)=>pTe(e,r,n),e.refine=(r,n)=>e.check(aPe(r,n)),e.superRefine=r=>e.check(iPe(r)),e.overwrite=r=>e.check(c1(r)),e.optional=()=>kz(e),e.nullable=()=>Cz(e),e.nullish=()=>kz(Cz(e)),e.nonoptional=r=>JTe(e,r),e.array=()=>gse(e),e.or=r=>BTe([e,r]),e.and=r=>UTe(e,r),e.transform=r=>Ez(e,HTe(r)),e.default=r=>YTe(e,r),e.prefault=r=>ZTe(e,r),e.catch=r=>ePe(e,r),e.pipe=r=>Ez(e,r),e.readonly=()=>nPe(e),e.describe=r=>{const n=e.clone();return HN.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){var r;return(r=HN.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return HN.get(e);const n=e.clone();return HN.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),pse=jt("_ZodString",(e,t)=>{kL.init(e,t),wi.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(R3e(...n)),e.includes=(...n)=>e.check(M3e(...n)),e.startsWith=(...n)=>e.check($3e(...n)),e.endsWith=(...n)=>e.check(B3e(...n)),e.min=(...n)=>e.check(s4(...n)),e.max=(...n)=>e.check(fse(...n)),e.length=(...n)=>e.check(hse(...n)),e.nonempty=(...n)=>e.check(s4(1,...n)),e.lowercase=n=>e.check(L3e(n)),e.uppercase=n=>e.check(F3e(n)),e.trim=()=>e.check(U3e()),e.normalize=(...n)=>e.check(z3e(...n)),e.toLowerCase=()=>e.check(q3e()),e.toUpperCase=()=>e.check(V3e()),e.slugify=()=>e.check(W3e())}),gTe=jt("ZodString",(e,t)=>{kL.init(e,t),pse.init(e,t),e.email=r=>e.check(l3e(xTe,r)),e.url=r=>e.check(h3e(vTe,r)),e.jwt=r=>e.check(E3e(DTe,r)),e.emoji=r=>e.check(m3e(yTe,r)),e.guid=r=>e.check(jz(Nz,r)),e.uuid=r=>e.check(c3e(GN,r)),e.uuidv4=r=>e.check(u3e(GN,r)),e.uuidv6=r=>e.check(d3e(GN,r)),e.uuidv7=r=>e.check(f3e(GN,r)),e.nanoid=r=>e.check(p3e(bTe,r)),e.guid=r=>e.check(jz(Nz,r)),e.cuid=r=>e.check(g3e(wTe,r)),e.cuid2=r=>e.check(x3e(jTe,r)),e.ulid=r=>e.check(v3e(_Te,r)),e.base64=r=>e.check(S3e(TTe,r)),e.base64url=r=>e.check(k3e(PTe,r)),e.xid=r=>e.check(y3e(NTe,r)),e.ksuid=r=>e.check(b3e(STe,r)),e.ipv4=r=>e.check(w3e(kTe,r)),e.ipv6=r=>e.check(j3e(CTe,r)),e.cidrv4=r=>e.check(_3e(ETe,r)),e.cidrv6=r=>e.check(N3e(ATe,r)),e.e164=r=>e.check(C3e(OTe,r)),e.datetime=r=>e.check(Z3e(r)),e.date=r=>e.check(Q3e(r)),e.time=r=>e.check(tTe(r)),e.duration=r=>e.check(nTe(r))});function pn(e){return o3e(gTe,e)}const na=jt("ZodStringFormat",(e,t)=>{Ks.init(e,t),pse.init(e,t)}),xTe=jt("ZodEmail",(e,t)=>{xAe.init(e,t),na.init(e,t)}),Nz=jt("ZodGUID",(e,t)=>{pAe.init(e,t),na.init(e,t)}),GN=jt("ZodUUID",(e,t)=>{gAe.init(e,t),na.init(e,t)}),vTe=jt("ZodURL",(e,t)=>{vAe.init(e,t),na.init(e,t)}),yTe=jt("ZodEmoji",(e,t)=>{yAe.init(e,t),na.init(e,t)}),bTe=jt("ZodNanoID",(e,t)=>{bAe.init(e,t),na.init(e,t)}),wTe=jt("ZodCUID",(e,t)=>{wAe.init(e,t),na.init(e,t)}),jTe=jt("ZodCUID2",(e,t)=>{jAe.init(e,t),na.init(e,t)}),_Te=jt("ZodULID",(e,t)=>{_Ae.init(e,t),na.init(e,t)}),NTe=jt("ZodXID",(e,t)=>{NAe.init(e,t),na.init(e,t)}),STe=jt("ZodKSUID",(e,t)=>{SAe.init(e,t),na.init(e,t)}),kTe=jt("ZodIPv4",(e,t)=>{TAe.init(e,t),na.init(e,t)}),CTe=jt("ZodIPv6",(e,t)=>{PAe.init(e,t),na.init(e,t)}),ETe=jt("ZodCIDRv4",(e,t)=>{OAe.init(e,t),na.init(e,t)}),ATe=jt("ZodCIDRv6",(e,t)=>{DAe.init(e,t),na.init(e,t)}),TTe=jt("ZodBase64",(e,t)=>{IAe.init(e,t),na.init(e,t)}),PTe=jt("ZodBase64URL",(e,t)=>{LAe.init(e,t),na.init(e,t)}),OTe=jt("ZodE164",(e,t)=>{FAe.init(e,t),na.init(e,t)}),DTe=jt("ZodJWT",(e,t)=>{$Ae.init(e,t),na.init(e,t)}),ITe=jt("ZodUnknown",(e,t)=>{BAe.init(e,t),wi.init(e,t)});function Sz(){return D3e(ITe)}const RTe=jt("ZodNever",(e,t)=>{zAe.init(e,t),wi.init(e,t)});function LTe(e){return I3e(RTe,e)}const FTe=jt("ZodArray",(e,t)=>{UAe.init(e,t),wi.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(s4(r,n)),e.nonempty=r=>e.check(s4(1,r)),e.max=(r,n)=>e.check(fse(r,n)),e.length=(r,n)=>e.check(hse(r,n)),e.unwrap=()=>e.element});function gse(e,t){return H3e(FTe,e,t)}const MTe=jt("ZodObject",(e,t)=>{VAe.init(e,t),wi.init(e,t),Cs(e,"shape",()=>t.shape),e.keyof=()=>xse(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Sz()}),e.loose=()=>e.clone({...e._zod.def,catchall:Sz()}),e.strict=()=>e.clone({...e._zod.def,catchall:LTe()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>xEe(e,r),e.safeExtend=r=>vEe(e,r),e.merge=r=>yEe(e,r),e.pick=r=>pEe(e,r),e.omit=r=>gEe(e,r),e.partial=(...r)=>bEe(vse,e,r[0]),e.required=(...r)=>wEe(yse,e,r[0])});function Mg(e,t){const r={type:"object",shape:e??{},...zr(t)};return new MTe(r)}const $Te=jt("ZodUnion",(e,t)=>{WAe.init(e,t),wi.init(e,t),e.options=t.options});function BTe(e,t){return new $Te({type:"union",options:e,...zr(t)})}const zTe=jt("ZodIntersection",(e,t)=>{HAe.init(e,t),wi.init(e,t)});function UTe(e,t){return new zTe({type:"intersection",left:e,right:t})}const L6=jt("ZodEnum",(e,t)=>{GAe.init(e,t),wi.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,a)=>{const i={};for(const o of n)if(r.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new L6({...t,checks:[],...zr(a),entries:i})},e.exclude=(n,a)=>{const i={...t.entries};for(const o of n)if(r.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new L6({...t,checks:[],...zr(a),entries:i})}});function xse(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new L6({type:"enum",entries:r,...zr(t)})}const qTe=jt("ZodLiteral",(e,t)=>{KAe.init(e,t),wi.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function VTe(e,t){return new qTe({type:"literal",values:Array.isArray(e)?e:[e],...zr(t)})}const WTe=jt("ZodTransform",(e,t)=>{YAe.init(e,t),wi.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Jne(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(y2(i,r.value,t));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(y2(o))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(i=>(r.value=i,r)):(r.value=a,r)}});function HTe(e){return new WTe({type:"transform",transform:e})}const vse=jt("ZodOptional",(e,t)=>{XAe.init(e,t),wi.init(e,t),e.unwrap=()=>e._zod.def.innerType});function kz(e){return new vse({type:"optional",innerType:e})}const GTe=jt("ZodNullable",(e,t)=>{ZAe.init(e,t),wi.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Cz(e){return new GTe({type:"nullable",innerType:e})}const KTe=jt("ZodDefault",(e,t)=>{JAe.init(e,t),wi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function YTe(e,t){return new KTe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():tse(t)}})}const XTe=jt("ZodPrefault",(e,t)=>{QAe.init(e,t),wi.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ZTe(e,t){return new XTe({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():tse(t)}})}const yse=jt("ZodNonOptional",(e,t)=>{e3e.init(e,t),wi.init(e,t),e.unwrap=()=>e._zod.def.innerType});function JTe(e,t){return new yse({type:"nonoptional",innerType:e,...zr(t)})}const QTe=jt("ZodCatch",(e,t)=>{t3e.init(e,t),wi.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ePe(e,t){return new QTe({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const tPe=jt("ZodPipe",(e,t)=>{r3e.init(e,t),wi.init(e,t),e.in=t.in,e.out=t.out});function Ez(e,t){return new tPe({type:"pipe",in:e,out:t})}const rPe=jt("ZodReadonly",(e,t)=>{n3e.init(e,t),wi.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nPe(e){return new rPe({type:"readonly",innerType:e})}const sPe=jt("ZodCustom",(e,t)=>{s3e.init(e,t),wi.init(e,t)});function aPe(e,t={}){return G3e(sPe,e,t)}function iPe(e){return K3e(e)}const Az=Mg({contactType:xse(["establishment","trainer"]),name:pn().trim().min(2,"Le nom doit contenir au moins 2 caractères").max(100,"Le nom ne peut pas dépasser 100 caractères"),email:pn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères"),message:pn().trim().max(2e3,"Le message ne peut pas dépasser 2000 caractères").optional()});Mg({schoolName:pn().trim().min(2,"Le nom de l'établissement doit contenir au moins 2 caractères").max(200,"Le nom de l'établissement ne peut pas dépasser 200 caractères"),contactName:pn().trim().min(2,"Le nom du contact doit contenir au moins 2 caractères").max(100,"Le nom du contact ne peut pas dépasser 100 caractères"),contactEmail:pn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères"),contactPhone:pn().trim().max(20,"Le téléphone ne peut pas dépasser 20 caractères").optional(),contactPosition:pn().trim().max(100,"Le poste ne peut pas dépasser 100 caractères").optional(),trainingNeeds:gse(pn().trim().max(200)).min(1,"Ajoutez au moins un besoin en formation").max(20,"Maximum 20 besoins"),startDate:pn().optional(),endDate:pn().optional(),durationHours:pn().optional(),numTrainers:pn().optional(),estimatedBudget:pn().trim().max(100,"Le budget ne peut pas dépasser 100 caractères").optional(),description:pn().trim().min(20,"La description doit contenir au moins 20 caractères").max(5e3,"La description ne peut pas dépasser 5000 caractères")});Mg({name:pn().trim().min(2,"Le nom doit contenir au moins 2 caractères").max(100,"Le nom ne peut pas dépasser 100 caractères"),password:pn().min(6,"Le mot de passe doit contenir au moins 6 caractères").max(72,"Le mot de passe ne peut pas dépasser 72 caractères"),confirmPassword:pn()}).refine(e=>e.password===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]});const oPe=Mg({email:pn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères")});Mg({email:pn().trim().email("Email invalide").max(255,"L'email ne peut pas dépasser 255 caractères"),password:pn().min(6,"Le mot de passe doit contenir au moins 6 caractères").max(72,"Le mot de passe ne peut pas dépasser 72 caractères")});function CL(e){const{schema:t,fieldLabels:r={}}=e,[n,a]=w.useState({}),[i,o]=w.useState(new Set),l=w.useRef(null),c=w.useCallback((x,v,b)=>{try{return b&&t.parse(b),a(y=>{const N={...y};return delete N[x],N}),!0}catch(y){if(y instanceof _z){const N=y.issues.find(_=>_.path[0]===x);if(N){const _=r[x]||x;let j=N.message;return j.toLowerCase().includes("required")||j.toLowerCase().includes("requis")?j=`${_} est requis`:j.includes(_)||(j=`${_} : ${j}`),a(S=>({...S,[x]:{message:j,touched:!0}})),!1}}return!0}},[t,r]),u=w.useCallback((x,v,b)=>{o(y=>new Set(y).add(x)),c(x,v,b)},[c]),d=w.useCallback(x=>{try{return t.parse(x),a({}),!0}catch(v){if(v instanceof _z){const b={};return v.issues.forEach(y=>{var S;const N=((S=y.path[0])==null?void 0:S.toString())||"",_=r[N]||N;let j=y.message;j.toLowerCase().includes("required")||j.toLowerCase().includes("requis")?j=`${_} est requis`:j.includes(_)||(j=`${_} : ${j}`),b[N]={message:j,touched:!0}}),a(b),f(Object.keys(b)[0]),!1}return!1}},[t,r]),f=w.useCallback(x=>{x&&setTimeout(()=>{var b;const v=document.querySelector(`[data-field="${x}"], [name="${x}"], #${x}`);v&&(v.scrollIntoView({behavior:"smooth",block:"center"}),(b=v.focus)==null||b.call(v))},100)},[]),m=w.useCallback(x=>{const v=n[x];return v!=null&&v.touched||i.has(x)?v==null?void 0:v.message:void 0},[n,i]),h=w.useCallback(x=>!!m(x),[m]),g=w.useCallback(()=>{a({}),o(new Set)},[]),p=w.useCallback(x=>{a(v=>{const b={...v};return delete b[x],b})},[]);return{errors:n,touchedFields:i,formRef:l,validateField:c,handleBlur:u,validateAll:d,getFieldError:m,hasFieldError:h,clearErrors:g,clearFieldError:p,scrollToFirstError:f}}const gn=w.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{className:pt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-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:r,...t}));gn.displayName="Textarea";const EL=w.forwardRef(({id:e,label:t,error:r,required:n,className:a,labelClassName:i,children:o},l)=>s.jsxs("div",{ref:l,className:pt("space-y-2",a),"data-field":e,children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs(We,{htmlFor:e,className:pt("text-sm font-medium",r&&"text-destructive",i),children:[t,n&&s.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),r&&s.jsx(Di,{className:"h-4 w-4 text-destructive flex-shrink-0"})]}),o,r&&s.jsx("p",{className:"text-sm text-destructive flex items-center gap-1 animate-in fade-in-0 slide-in-from-top-1 duration-200",children:r})]}));EL.displayName="FormFieldWrapper";const Hi=w.forwardRef(({id:e,label:t,error:r,required:n,className:a,onFieldBlur:i,onBlur:o,...l},c)=>{const u=d=>{i==null||i(d.target.value),o==null||o(d)};return s.jsx(EL,{id:e||"",label:t,error:r,required:n,children:s.jsx(Ye,{ref:c,id:e,"data-field":e,className:pt(r&&"border-destructive bg-destructive/5 focus-visible:ring-destructive",a),onBlur:u,...l})})});Hi.displayName="FormInput";const BC=w.forwardRef(({id:e,label:t,error:r,required:n,className:a,onFieldBlur:i,onBlur:o,...l},c)=>{const u=d=>{i==null||i(d.target.value),o==null||o(d)};return s.jsx(EL,{id:e||"",label:t,error:r,required:n,children:s.jsx(gn,{ref:c,id:e,"data-field":e,className:pt(r&&"border-destructive bg-destructive/5 focus-visible:ring-destructive",a),onBlur:u,...l})})});BC.displayName="FormTextarea";const lPe={name:"Le nom",email:"L'email",message:"Le message",contactType:"Le type de contact"},zC=()=>{const{toast:e}=yJ(),[t,r]=w.useState({contactType:"establishment",name:"",email:"",message:""}),[n,a]=w.useState(!1),{getFieldError:i,validateAll:o,handleBlur:l,clearFieldError:c}=CL({schema:Az,fieldLabels:lPe}),u=async m=>{if(m.preventDefault(),!o(t)){e({title:"Erreur de validation",description:"Veuillez corriger les champs en erreur.",variant:"destructive"});return}a(!0);try{const h=Az.parse(t),{error:g}=await he.from("contact_messages").insert({name:h.name,email:h.email,message:h.message,subject:h.contactType==="establishment"?"Demande établissement":"Demande formateur"});g&&console.error("Database error:",g);const{data:p,error:x}=await he.functions.invoke("send-contact-email",{body:h});if(x)throw console.error("Edge function error:",x),x;console.log("Email sent successfully:",p),ICe(h.contactType),Ai.formSubmit("contact",!0,{contactType:h.contactType}),e({title:"Message envoyé !",description:"Nous vous recontacterons dans les plus brefs délais."}),r({contactType:"establishment",name:"",email:"",message:""})}catch(h){console.error("Contact form submission error:",h),Ai.error("Contact form submission failed",h,{formName:"contact"});const g=typeof(h==null?void 0:h.message)=="string"&&h.message.trim().length>0?h.message:"Une erreur inattendue est survenue. Veuillez réessayer plus tard.";e({title:"Erreur",description:g,variant:"destructive"})}finally{a(!1)}},d=m=>{const{name:h,value:g}=m.target;r({...t,[h]:g}),c(h)},f=m=>{l(m,t[m],t)};return s.jsx("section",{className:"py-20 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Contactez-nous"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Discutons de vos besoins en formation"})]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 max-w-6xl mx-auto",children:[s.jsx("div",{children:s.jsx(ke,{className:"p-8 mb-8 border-border/50",children:s.jsxs("form",{onSubmit:u,className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium mb-3",children:"Vous êtes :"}),s.jsxs($0,{value:t.contactType,onValueChange:m=>r({...t,contactType:m}),className:"flex gap-6",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ro,{value:"establishment",id:"establishment"}),s.jsx(We,{htmlFor:"establishment",className:"cursor-pointer",children:"Un établissement"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ro,{value:"trainer",id:"trainer"}),s.jsx(We,{htmlFor:"trainer",className:"cursor-pointer",children:"Un formateur"})]})]})]}),s.jsx(Hi,{id:"name",name:"name",label:"Nom complet",value:t.name,onChange:d,onFieldBlur:()=>f("name"),placeholder:"Votre nom",required:!0,error:i("name")}),s.jsx(Hi,{id:"email",name:"email",type:"email",label:"Email",value:t.email,onChange:d,onFieldBlur:()=>f("email"),placeholder:"votre@email.com",required:!0,error:i("email")}),s.jsx(BC,{id:"message",name:"message",label:"Message (optionnel)",value:t.message,onChange:d,onFieldBlur:()=>f("message"),placeholder:"Parlez-nous de votre projet...",rows:5,error:i("message")}),s.jsx(ne,{type:"submit",size:"lg",className:"w-full",disabled:n,children:n?"Envoi en cours...":"Envoyer le message"})]})})}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-2xl font-bold mb-6",children:"Informations de Contact"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs(ke,{className:"p-6 flex items-start gap-4 border-border/50",children:[s.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Fn,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-1",children:"Email"}),s.jsx("p",{className:"text-muted-foreground",children:"contact-pedagobridge@qalamsoftware.com"})]})]}),s.jsxs(ke,{className:"p-6 flex items-start gap-4 border-border/50",children:[s.jsx("div",{className:"w-12 h-12 rounded-lg bg-secondary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Yy,{className:"h-6 w-6 text-secondary"})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-1",children:"Téléphone"}),s.jsx("p",{className:"text-muted-foreground",children:"+33 7 58 39 45 21"})]})]}),s.jsxs(ke,{className:"p-6 flex items-start gap-4 border-border/50",children:[s.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:s.jsx(Gs,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-1",children:"Localisation"}),s.jsxs("p",{className:"text-muted-foreground",children:["Paris, France",s.jsx("br",{}),"Interventions partout en France"]})]})]})]})]}),s.jsxs(ke,{className:"p-6 bg-gradient-to-br from-primary/5 to-secondary/5 border-border/50",children:[s.jsx("h4",{className:"font-semibold text-lg mb-3",children:"Disponibilité"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Nous répondons généralement sous quelques heures. Pour les demandes urgentes, n'hésitez pas à nous appeler directement."}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Lundi - Vendredi : 9h00 - 18h00"})]})]})]})]})})};function bse({subscriberType:e="general",source:t="website",placeholder:r="votre@email.com",buttonLabel:n="S'abonner"}){const[a,i]=w.useState(""),[o,l]=w.useState(!1),[c,u]=w.useState(""),d=async f=>{var m;f.preventDefault(),u(""),l(!0);try{const h=oPe.parse({email:a}),g=await fetch("https://pedagobridge.com/functions/v1/newsletter-subscribe",{method:"POST",headers:{"Content-Type":"application/json",apikey:void 0},body:JSON.stringify({email:h.email.toLowerCase(),subscriber_type:e,source:t})}),p=await g.json();if(!g.ok)throw new Error(p.error||"Erreur serveur");p.alreadySubscribed?ae.error("Vous êtes déjà inscrit à la newsletter"):(DCe(),ae.success("Merci ! Un email de bienvenue vous a été envoyé."),i(""))}catch(h){if(h.errors){const g=((m=h.errors[0])==null?void 0:m.message)||"Email invalide";u(g),ae.error(g)}else console.error("Error subscribing:",h),ae.error("Une erreur est survenue. Veuillez réessayer.")}finally{l(!1)}};return s.jsxs("div",{className:"bg-primary/5 rounded-lg p-8 border border-primary/10",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[s.jsx(Fn,{className:"h-6 w-6 text-primary"}),s.jsx("h3",{className:"text-2xl font-bold",children:"Newsletter"})]}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Recevez nos derniers articles directement dans votre boîte mail."}),s.jsxs("form",{onSubmit:d,className:"flex gap-2 flex-col sm:flex-row",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(Ye,{type:"email",placeholder:r,value:a,onChange:f=>{i(f.target.value),u("")},disabled:o,required:!0,className:`flex-1 ${c?"border-destructive":""}`}),c&&s.jsx("p",{className:"text-sm text-destructive mt-1",children:c})]}),s.jsx(ne,{type:"submit",disabled:o,className:"whitespace-nowrap",children:o?"Inscription...":n})]})]})}const cPe="/assets/logo-efrei-hGFND0X_.svg",uPe="/assets/logo-imie-C3T8YoOg.png",dPe="/assets/logo-croix-rouge-DNxBrTcL.jpg",fPe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAf4AAADSBAMAAABZWL/vAAAAKlBMVEVHcEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHrpZrAAAADXRSTlMAQFCEbh+gsuLzDi/LuRuA7wAABfVJREFUeNrtnc1rHHUYxydpNurEw0ogaCGwKI3Y026hpdAG1kMpJSksGqUeCjH0kB4CofRghEJqNIqykGJtVLowhlwUCwvxoIdCIMH6wkJiN81uu/O/2MhmXnZ+b8+PNj6z+X6O235/v/nMzDNv+0zWcQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6BJm/IBc+6NR35DWFS8xXmbkj4om1nxQcAS5j7S5z0/E5usJ/2n3vw96ww/qB+H/dN5qx3CrNaPcnVJHrtcwl+Xl7z+Mj9ZXMcw9iu85vWXTFV7i5e//FR3M/dM491UsN2Ocu8XMvxXdkJfMc83onvwzYcIcL39/MrIZa4TcZ5GFuEHI3WLmvx2O1U/J7UaOGnY7HA//VjjWfVIw3JEvk3J5Xv5+1mo39v35IEeb8Etm/sEBIOPbFY5bIeXqzPyXrMr46SVAcPKn5XaZ+Qfb8QVarrGfO0LL+R4v/2CqF4ke+9fOLxNzOV7+wX58z9KDut7yvPxbdqe/0IO63mZ5+Tf3hxq29KD6r/PyD45Hw5Yel4m5JWb+JUv/eUv/x8z8q5b+S5b+O8/Z/53XDRhN5iL+x96T8W74n7aS/ieluYmD8zdiWOmfleaOJPfjiH9Rmou4PYE//EX+zk8B3qH0fzbP/+EPf/jDH/7wP4z+Q6cCsnb+G56d/0aVg/+oyfZQ+C+fU8yn8L87psilxr8xpbz2lPo3p0pOF/hvZNXzyfwXjqpz6fDfPaebT+zfGtPl0uDfnNLfdon8m9dKThf4r2UN5hP4v3/UIJcCfyME/kZ0i/8zBP7whz9L/7Xa9ZLN0vxSU9wCpMZ/ZXrvOrhAXpYfTu/lTqTcP3O+3c9z5zhpSdw327nlY2n2X6uF7UyUIpiINE9uVtPq3zMd7404Y7ovn433BhVS6R/swiGLJkXgjiRyy8fT5z8h6v9t6otgYk70NfdmKWX+rqxBSFcEZUmDXCFl239G1rGwqL7DkzZcqM8g7PzljRzqO/wf5b0equJh569q5FQ94VE1wLYKKTr+KxvAF7P0AlCeQfj5qzuA5UWg7gCWnUEYXv9cUHduSZ/wv6VpMT2TEv+M7hWIBXERuFc1OdEZhOP1b+a0rltW/IzY1eaSRcDz/mewrHt/QfwdwVpNswISZxC297++VRG45yu6XI6lf8Jm5aq2CIRjrkzrctc8hv6Cm3VtEXzqWRWB/7V3oP7fSakk+79jRTCuEflEvDgZXRHcPlB/I8QD64pgUrJAuiL4mJt/QzKypy4C+SIPKotA8f7r/+P/SDr2gKoImnlpTn0GmWTmr2q1XlUUwTeKnKp4tpn57yjHHyrT9xt1Edxl5r+unmDgrKwAPGUuM17RvG/ExL+om2J1ThzManKyIiiy8m8aPN4WF0FeGxSfQWZZ+Ru9aSIsgll9TngZtc7Kf97w66056oGjXQRz0vfmePhXDSdyR8oSD2oRPObkXzefqrMItkxz4+ITLgv/PGWyeBFsGefiRfCEkX+dNlusCCj9b9EzCCP/Ro46X79l/18fS/+T5PnS1f+o2fp0/ZT5f/uFnAdXSk63+xcpQ70arpssxf9SmCum2b9b3n+CP/zhD3/4wx/+8Ic//OEPf/jDH/7wT7P/hbCDK3cY/S926sL/efi//YqMoeT3XxH/D6W5wVT5G7HUzt0j5naY+t8nesxb+m8x9ad6zLZzL1muN27+VI98O0f9+/eTTP1t/45/PzFXZOpv+zsOxN/NCDpuuPn30DSCZSb+bkrDYervVEge/wS5GilXZ+tv2zh3kZT7nq3/B1aHP+oPgOTZ+pMOgJEfjiMdABseW3+3TPCItv/fIOS2Hbb+zm9Wuz/pdwMji8TPv6dCP4rvMWCee+gw9ndes9r8jvOrcbd9nrV/xvRU/nfHkcP0CHDTYe3v9JkdAm97nY93zFZc9PVPlv5On8mW3PSSz7dMcguew91/7wegNSX8u/AFePcNbW5Mer9h//wbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAin8B4sSogYpER2AAAAAASUVORK5CYII=",hPe="/assets/logo-schools-group-jGL8DzpO.png",mPe=[{name:"EFREI",logo:cPe},{name:"IMIE",logo:uPe},{name:"Croix-Rouge",logo:dPe},{name:"IPSSI",logo:fPe},{name:"Schools Group",logo:hPe}],pPe=()=>{const[e,t]=w.useState([]),[r,n]=w.useState(!0);w.useEffect(()=>{(async()=>{try{const{data:o,error:l}=await he.from("school_profiles").select("id, name, logo_url, website_url").eq("is_verified",!0);if(l)throw l;t(o||[])}catch(o){console.error("Error fetching verified schools:",o)}finally{n(!1)}})()},[]);const a=[...mPe.map(i=>({...i,isDynamic:!1,website_url:null})),...e.filter(i=>i.logo_url).map(i=>({name:i.name,logo:i.logo_url,isDynamic:!0,website_url:i.website_url}))];return r?s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4 flex justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})}):a.length===0?null:s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Ils nous ont fait confiance"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-8 items-center justify-items-center",children:a.map((i,o)=>{const l=s.jsx("img",{src:i.logo,alt:`Logo ${i.name}`,className:"max-h-16 w-auto object-contain"});return s.jsx("div",{className:"flex items-center justify-center p-4 grayscale hover:grayscale-0 transition-all duration-300 opacity-70 hover:opacity-100",children:i.website_url?s.jsx("a",{href:i.website_url,target:"_blank",rel:"noopener noreferrer",title:i.name,children:l}):l},`${i.name}-${o}`)})})]})})},gPe=()=>{const[e,t]=w.useState({trainersCount:0,schoolsCount:0,activeOffers:0,completedMissions:0}),[r,n]=w.useState(!0);w.useEffect(()=>{(async()=>{try{const[{count:l},{count:c},{count:u},{count:d}]=await Promise.all([he.from("trainer_profiles").select("*",{count:"exact",head:!0}).eq("status","approved").eq("is_visible",!0),he.from("school_profiles").select("*",{count:"exact",head:!0}),he.from("school_requests").select("*",{count:"exact",head:!0}).eq("status","approved").eq("is_filled",!1),he.from("service_contracts").select("*",{count:"exact",head:!0}).eq("signed_by_school",!0)]);t({trainersCount:l||0,schoolsCount:c||0,activeOffers:u||0,completedMissions:d||0})}catch(l){console.error("Error fetching stats:",l)}finally{n(!1)}})()},[]);const i=[{icon:sr,value:e.trainersCount,label:"Formateurs certifiés",suffix:"+"},{icon:Vr,value:e.schoolsCount,label:"Établissements partenaires",suffix:""},{icon:as,value:e.activeOffers,label:"Offres actives",suffix:""},{icon:Wr,value:e.completedMissions,label:"Missions réalisées",suffix:""}].filter(o=>o.value>0);return r||i.length===0?null:s.jsx("section",{className:"py-12 bg-primary text-primary-foreground",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"flex flex-wrap justify-center gap-8 md:gap-12",children:i.map((o,l)=>{const c=o.icon;return s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary-foreground/10 mb-4",children:s.jsx(c,{className:"h-6 w-6"})}),s.jsxs("div",{className:"text-3xl md:text-4xl font-bold mb-2",children:[o.suffix&&o.value>0?o.suffix:"",o.value]}),s.jsx("div",{className:"text-sm md:text-base text-primary-foreground/80",children:o.label})]},l)})})})})};var wse={exports:{}},xPe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",vPe=xPe,yPe=vPe;function jse(){}function _se(){}_se.resetWarningCache=jse;var bPe=function(){function e(n,a,i,o,l,c){if(c!==yPe){var u=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 u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:_se,resetWarningCache:jse};return r.PropTypes=r,r};wse.exports=bPe();var wPe=wse.exports;const br=jn(wPe);function jPe(e){return e&&typeof e=="object"&&"default"in e?e.default:e}var Nse=w,_Pe=jPe(Nse);function Tz(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function NPe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var SPe=!!(typeof window<"u"&&window.document&&window.document.createElement);function kPe(e,t,r){if(typeof e!="function")throw new Error("Expected reducePropsToState to be a function.");if(typeof t!="function")throw new Error("Expected handleStateChangeOnClient to be a function.");if(typeof r<"u"&&typeof r!="function")throw new Error("Expected mapStateOnServer to either be undefined or a function.");function n(a){return a.displayName||a.name||"Component"}return function(i){if(typeof i!="function")throw new Error("Expected WrappedComponent to be a React component.");var o=[],l;function c(){l=e(o.map(function(d){return d.props})),u.canUseDOM?t(l):r&&(l=r(l))}var u=function(d){NPe(f,d);function f(){return d.apply(this,arguments)||this}f.peek=function(){return l},f.rewind=function(){if(f.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var g=l;return l=void 0,o=[],g};var m=f.prototype;return m.UNSAFE_componentWillMount=function(){o.push(this),c()},m.componentDidUpdate=function(){c()},m.componentWillUnmount=function(){var g=o.indexOf(this);o.splice(g,1),c()},m.render=function(){return _Pe.createElement(i,this.props)},f}(Nse.PureComponent);return Tz(u,"displayName","SideEffect("+n(i)+")"),Tz(u,"canUseDOM",SPe),u}}var CPe=kPe;const EPe=jn(CPe);var APe=typeof Element<"u",TPe=typeof Map=="function",PPe=typeof Set=="function",OPe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function s5(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,a;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!s5(e[n],t[n]))return!1;return!0}var i;if(TPe&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(i=e.entries();!(n=i.next()).done;)if(!t.has(n.value[0]))return!1;for(i=e.entries();!(n=i.next()).done;)if(!s5(n.value[1],t.get(n.value[0])))return!1;return!0}if(PPe&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(i=e.entries();!(n=i.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(OPe&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[n]))return!1;if(APe&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((a[n]==="_owner"||a[n]==="__v"||a[n]==="__o")&&e.$$typeof)&&!s5(e[a[n]],t[a[n]]))return!1;return!0}return e!==e&&t!==t}var DPe=function(t,r){try{return s5(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const IPe=jn(DPe);/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var Pz=Object.getOwnPropertySymbols,RPe=Object.prototype.hasOwnProperty,LPe=Object.prototype.propertyIsEnumerable;function FPe(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function MPe(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(i){return t[i]});if(n.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(i){a[i]=i}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var $Pe=MPe()?Object.assign:function(e,t){for(var r,n=FPe(e),a,i=1;i<arguments.length;i++){r=Object(arguments[i]);for(var o in r)RPe.call(r,o)&&(n[o]=r[o]);if(Pz){a=Pz(r);for(var l=0;l<a.length;l++)LPe.call(r,a[l])&&(n[a[l]]=r[a[l]])}}return n};const BPe=jn($Pe);var B0={BODY:"bodyAttributes",HTML:"htmlAttributes",TITLE:"titleAttributes"},Jr={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"};Object.keys(Jr).map(function(e){return Jr[e]});var Vs={CHARSET:"charset",CSS_TEXT:"cssText",HREF:"href",HTTPEQUIV:"http-equiv",INNER_HTML:"innerHTML",ITEM_PROP:"itemprop",NAME:"name",PROPERTY:"property",REL:"rel",SRC:"src",TARGET:"target"},a4={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},b2={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate"},zPe=Object.keys(a4).reduce(function(e,t){return e[a4[t]]=t,e},{}),UPe=[Jr.NOSCRIPT,Jr.SCRIPT,Jr.STYLE],$u="data-react-helmet",qPe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},VPe=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},WPe=function(){function e(t,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),el=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},HPe=function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},Oz=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},GPe=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e},F6=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return r===!1?String(t):String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},KPe=function(t){var r=jv(t,Jr.TITLE),n=jv(t,b2.TITLE_TEMPLATE);if(n&&r)return n.replace(/%s/g,function(){return Array.isArray(r)?r.join(""):r});var a=jv(t,b2.DEFAULT_TITLE);return r||a||void 0},YPe=function(t){return jv(t,b2.ON_CHANGE_CLIENT_STATE)||function(){}},Q3=function(t,r){return r.filter(function(n){return typeof n[t]<"u"}).map(function(n){return n[t]}).reduce(function(n,a){return el({},n,a)},{})},XPe=function(t,r){return r.filter(function(n){return typeof n[Jr.BASE]<"u"}).map(function(n){return n[Jr.BASE]}).reverse().reduce(function(n,a){if(!n.length)for(var i=Object.keys(a),o=0;o<i.length;o++){var l=i[o],c=l.toLowerCase();if(t.indexOf(c)!==-1&&a[c])return n.concat(a)}return n},[])},wb=function(t,r,n){var a={};return n.filter(function(i){return Array.isArray(i[t])?!0:(typeof i[t]<"u"&&eOe("Helmet: "+t+' should be of type "Array". Instead found type "'+qPe(i[t])+'"'),!1)}).map(function(i){return i[t]}).reverse().reduce(function(i,o){var l={};o.filter(function(m){for(var h=void 0,g=Object.keys(m),p=0;p<g.length;p++){var x=g[p],v=x.toLowerCase();r.indexOf(v)!==-1&&!(h===Vs.REL&&m[h].toLowerCase()==="canonical")&&!(v===Vs.REL&&m[v].toLowerCase()==="stylesheet")&&(h=v),r.indexOf(x)!==-1&&(x===Vs.INNER_HTML||x===Vs.CSS_TEXT||x===Vs.ITEM_PROP)&&(h=x)}if(!h||!m[h])return!1;var b=m[h].toLowerCase();return a[h]||(a[h]={}),l[h]||(l[h]={}),a[h][b]?!1:(l[h][b]=!0,!0)}).reverse().forEach(function(m){return i.push(m)});for(var c=Object.keys(l),u=0;u<c.length;u++){var d=c[u],f=BPe({},a[d],l[d]);a[d]=f}return i},[]).reverse()},jv=function(t,r){for(var n=t.length-1;n>=0;n--){var a=t[n];if(a.hasOwnProperty(r))return a[r]}return null},ZPe=function(t){return{baseTag:XPe([Vs.HREF,Vs.TARGET],t),bodyAttributes:Q3(B0.BODY,t),defer:jv(t,b2.DEFER),encode:jv(t,b2.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Q3(B0.HTML,t),linkTags:wb(Jr.LINK,[Vs.REL,Vs.HREF],t),metaTags:wb(Jr.META,[Vs.NAME,Vs.CHARSET,Vs.HTTPEQUIV,Vs.PROPERTY,Vs.ITEM_PROP],t),noscriptTags:wb(Jr.NOSCRIPT,[Vs.INNER_HTML],t),onChangeClientState:YPe(t),scriptTags:wb(Jr.SCRIPT,[Vs.SRC,Vs.INNER_HTML],t),styleTags:wb(Jr.STYLE,[Vs.CSS_TEXT],t),title:KPe(t),titleAttributes:Q3(B0.TITLE,t)}},M6=function(){var e=Date.now();return function(t){var r=Date.now();r-e>16?(e=r,t(r)):setTimeout(function(){M6(t)},0)}}(),Dz=function(t){return clearTimeout(t)},JPe=typeof window<"u"?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||M6:global.requestAnimationFrame||M6,QPe=typeof window<"u"?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||Dz:global.cancelAnimationFrame||Dz,eOe=function(t){return console&&typeof console.warn=="function"&&console.warn(t)},jb=null,tOe=function(t){jb&&QPe(jb),t.defer?jb=JPe(function(){Iz(t,function(){jb=null})}):(Iz(t),jb=null)},Iz=function(t,r){var n=t.baseTag,a=t.bodyAttributes,i=t.htmlAttributes,o=t.linkTags,l=t.metaTags,c=t.noscriptTags,u=t.onChangeClientState,d=t.scriptTags,f=t.styleTags,m=t.title,h=t.titleAttributes;$6(Jr.BODY,a),$6(Jr.HTML,i),rOe(m,h);var g={baseTag:bx(Jr.BASE,n),linkTags:bx(Jr.LINK,o),metaTags:bx(Jr.META,l),noscriptTags:bx(Jr.NOSCRIPT,c),scriptTags:bx(Jr.SCRIPT,d),styleTags:bx(Jr.STYLE,f)},p={},x={};Object.keys(g).forEach(function(v){var b=g[v],y=b.newTags,N=b.oldTags;y.length&&(p[v]=y),N.length&&(x[v]=g[v].oldTags)}),r&&r(),u(t,p,x)},Sse=function(t){return Array.isArray(t)?t.join(""):t},rOe=function(t,r){typeof t<"u"&&document.title!==t&&(document.title=Sse(t)),$6(Jr.TITLE,r)},$6=function(t,r){var n=document.getElementsByTagName(t)[0];if(n){for(var a=n.getAttribute($u),i=a?a.split(","):[],o=[].concat(i),l=Object.keys(r),c=0;c<l.length;c++){var u=l[c],d=r[u]||"";n.getAttribute(u)!==d&&n.setAttribute(u,d),i.indexOf(u)===-1&&i.push(u);var f=o.indexOf(u);f!==-1&&o.splice(f,1)}for(var m=o.length-1;m>=0;m--)n.removeAttribute(o[m]);i.length===o.length?n.removeAttribute($u):n.getAttribute($u)!==l.join(",")&&n.setAttribute($u,l.join(","))}},bx=function(t,r){var n=document.head||document.querySelector(Jr.HEAD),a=n.querySelectorAll(t+"["+$u+"]"),i=Array.prototype.slice.call(a),o=[],l=void 0;return r&&r.length&&r.forEach(function(c){var u=document.createElement(t);for(var d in c)if(c.hasOwnProperty(d))if(d===Vs.INNER_HTML)u.innerHTML=c.innerHTML;else if(d===Vs.CSS_TEXT)u.styleSheet?u.styleSheet.cssText=c.cssText:u.appendChild(document.createTextNode(c.cssText));else{var f=typeof c[d]>"u"?"":c[d];u.setAttribute(d,f)}u.setAttribute($u,"true"),i.some(function(m,h){return l=h,u.isEqualNode(m)})?i.splice(l,1):o.push(u)}),i.forEach(function(c){return c.parentNode.removeChild(c)}),o.forEach(function(c){return n.appendChild(c)}),{oldTags:i,newTags:o}},kse=function(t){return Object.keys(t).reduce(function(r,n){var a=typeof t[n]<"u"?n+'="'+t[n]+'"':""+n;return r?r+" "+a:a},"")},nOe=function(t,r,n,a){var i=kse(n),o=Sse(r);return i?"<"+t+" "+$u+'="true" '+i+">"+F6(o,a)+"</"+t+">":"<"+t+" "+$u+'="true">'+F6(o,a)+"</"+t+">"},sOe=function(t,r,n){return r.reduce(function(a,i){var o=Object.keys(i).filter(function(u){return!(u===Vs.INNER_HTML||u===Vs.CSS_TEXT)}).reduce(function(u,d){var f=typeof i[d]>"u"?d:d+'="'+F6(i[d],n)+'"';return u?u+" "+f:f},""),l=i.innerHTML||i.cssText||"",c=UPe.indexOf(t)===-1;return a+"<"+t+" "+$u+'="true" '+o+(c?"/>":">"+l+"</"+t+">")},"")},Cse=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(t).reduce(function(n,a){return n[a4[a]||a]=t[a],n},r)},aOe=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.keys(t).reduce(function(n,a){return n[zPe[a]||a]=t[a],n},r)},iOe=function(t,r,n){var a,i=(a={key:r},a[$u]=!0,a),o=Cse(n,i);return[be.createElement(Jr.TITLE,o,r)]},oOe=function(t,r){return r.map(function(n,a){var i,o=(i={key:a},i[$u]=!0,i);return Object.keys(n).forEach(function(l){var c=a4[l]||l;if(c===Vs.INNER_HTML||c===Vs.CSS_TEXT){var u=n.innerHTML||n.cssText;o.dangerouslySetInnerHTML={__html:u}}else o[c]=n[l]}),be.createElement(t,o)})},Af=function(t,r,n){switch(t){case Jr.TITLE:return{toComponent:function(){return iOe(t,r.title,r.titleAttributes)},toString:function(){return nOe(t,r.title,r.titleAttributes,n)}};case B0.BODY:case B0.HTML:return{toComponent:function(){return Cse(r)},toString:function(){return kse(r)}};default:return{toComponent:function(){return oOe(t,r)},toString:function(){return sOe(t,r,n)}}}},Ese=function(t){var r=t.baseTag,n=t.bodyAttributes,a=t.encode,i=t.htmlAttributes,o=t.linkTags,l=t.metaTags,c=t.noscriptTags,u=t.scriptTags,d=t.styleTags,f=t.title,m=f===void 0?"":f,h=t.titleAttributes;return{base:Af(Jr.BASE,r,a),bodyAttributes:Af(B0.BODY,n,a),htmlAttributes:Af(B0.HTML,i,a),link:Af(Jr.LINK,o,a),meta:Af(Jr.META,l,a),noscript:Af(Jr.NOSCRIPT,c,a),script:Af(Jr.SCRIPT,u,a),style:Af(Jr.STYLE,d,a),title:Af(Jr.TITLE,{title:m,titleAttributes:h},a)}},lOe=function(t){var r,n;return n=r=function(a){HPe(i,a);function i(){return VPe(this,i),GPe(this,a.apply(this,arguments))}return i.prototype.shouldComponentUpdate=function(l){return!IPe(this.props,l)},i.prototype.mapNestedChildrenToProps=function(l,c){if(!c)return null;switch(l.type){case Jr.SCRIPT:case Jr.NOSCRIPT:return{innerHTML:c};case Jr.STYLE:return{cssText:c}}throw new Error("<"+l.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},i.prototype.flattenArrayTypeChildren=function(l){var c,u=l.child,d=l.arrayTypeChildren,f=l.newChildProps,m=l.nestedChildren;return el({},d,(c={},c[u.type]=[].concat(d[u.type]||[],[el({},f,this.mapNestedChildrenToProps(u,m))]),c))},i.prototype.mapObjectTypeChildren=function(l){var c,u,d=l.child,f=l.newProps,m=l.newChildProps,h=l.nestedChildren;switch(d.type){case Jr.TITLE:return el({},f,(c={},c[d.type]=h,c.titleAttributes=el({},m),c));case Jr.BODY:return el({},f,{bodyAttributes:el({},m)});case Jr.HTML:return el({},f,{htmlAttributes:el({},m)})}return el({},f,(u={},u[d.type]=el({},m),u))},i.prototype.mapArrayTypeChildrenToProps=function(l,c){var u=el({},c);return Object.keys(l).forEach(function(d){var f;u=el({},u,(f={},f[d]=l[d],f))}),u},i.prototype.warnOnInvalidChildren=function(l,c){return!0},i.prototype.mapChildrenToProps=function(l,c){var u=this,d={};return be.Children.forEach(l,function(f){if(!(!f||!f.props)){var m=f.props,h=m.children,g=Oz(m,["children"]),p=aOe(g);switch(u.warnOnInvalidChildren(f,h),f.type){case Jr.LINK:case Jr.META:case Jr.NOSCRIPT:case Jr.SCRIPT:case Jr.STYLE:d=u.flattenArrayTypeChildren({child:f,arrayTypeChildren:d,newChildProps:p,nestedChildren:h});break;default:c=u.mapObjectTypeChildren({child:f,newProps:c,newChildProps:p,nestedChildren:h});break}}}),c=this.mapArrayTypeChildrenToProps(d,c),c},i.prototype.render=function(){var l=this.props,c=l.children,u=Oz(l,["children"]),d=el({},u);return c&&(d=this.mapChildrenToProps(c,d)),be.createElement(t,d)},WPe(i,null,[{key:"canUseDOM",set:function(l){t.canUseDOM=l}}]),i}(be.Component),r.propTypes={base:br.object,bodyAttributes:br.object,children:br.oneOfType([br.arrayOf(br.node),br.node]),defaultTitle:br.string,defer:br.bool,encodeSpecialCharacters:br.bool,htmlAttributes:br.object,link:br.arrayOf(br.object),meta:br.arrayOf(br.object),noscript:br.arrayOf(br.object),onChangeClientState:br.func,script:br.arrayOf(br.object),style:br.arrayOf(br.object),title:br.string,titleAttributes:br.object,titleTemplate:br.string},r.defaultProps={defer:!0,encodeSpecialCharacters:!0},r.peek=t.peek,r.rewind=function(){var a=t.rewind();return a||(a=Ese({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),a},n},cOe=function(){return null},uOe=EPe(ZPe,tOe,Ese)(cOe),nu=lOe(uOe);nu.renderStatic=nu.rewind;const qd="https://pedagobridge.com";function gr({title:e,description:t="PedagoBridge connecte établissements de formation et formateurs experts certifiés. Qualité garantie, transparence totale.",image:r=`${qd}/og-image.jpg`,url:n,type:a="website",author:i,keywords:o=[],noindex:l=!1,publishedTime:c,modifiedTime:u}){const d=e==null?void 0:e.replace(/\s*\|\s*PedagoBridge\s*/gi,"").trim(),f=d?`${d} | PedagoBridge`:"PedagoBridge - Plateforme de Formateurs Experts | Formation Professionnelle",m=n?`${qd}${n}`:qd,h=["formateurs experts","formation professionnelle","établissement formation","recrutement formateurs","formation continue"],g=[...new Set([...h,...o])];return s.jsxs(nu,{children:[s.jsx("title",{children:f}),s.jsx("meta",{name:"description",content:t}),s.jsx("meta",{name:"keywords",content:g.join(", ")}),i&&s.jsx("meta",{name:"author",content:i}),l?s.jsx("meta",{name:"robots",content:"noindex, nofollow"}):s.jsx("meta",{name:"robots",content:"index, follow, max-image-preview:large"}),s.jsx("link",{rel:"canonical",href:m}),s.jsx("meta",{property:"og:type",content:a}),s.jsx("meta",{property:"og:url",content:m}),s.jsx("meta",{property:"og:title",content:f}),s.jsx("meta",{property:"og:description",content:t}),s.jsx("meta",{property:"og:image",content:r}),s.jsx("meta",{property:"og:site_name",content:"PedagoBridge"}),s.jsx("meta",{property:"og:locale",content:"fr_FR"}),a==="article"&&c&&s.jsx("meta",{property:"article:published_time",content:c}),a==="article"&&u&&s.jsx("meta",{property:"article:modified_time",content:u}),a==="article"&&i&&s.jsx("meta",{property:"article:author",content:i}),s.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),s.jsx("meta",{name:"twitter:url",content:m}),s.jsx("meta",{name:"twitter:title",content:f}),s.jsx("meta",{name:"twitter:description",content:t}),s.jsx("meta",{name:"twitter:image",content:r})]})}function Ase({name:e="PedagoBridge",description:t="Plateforme de mise en relation entre formateurs experts et établissements de formation",url:r=qd,logo:n=`${qd}/logo.jpg`,email:a="contact-pedagobridge@qalamsoftware.com"}){const i={"@context":"https://schema.org","@type":"Organization",name:e,description:t,url:r,logo:n,contactPoint:{"@type":"ContactPoint",email:a,contactType:"Service Client",availableLanguage:["fr"]}};return s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(i)})})}function dOe({name:e,description:t,provider:r,duration:n,mode:a="OnSiteCoursed",startDate:i,endDate:o,location:l,url:c}){const u={"@context":"https://schema.org","@type":"Course",name:e,description:t,provider:{"@type":"Organization",name:r},courseMode:a};return n&&(u.duration=n),i&&(u.startDate=i),o&&(u.endDate=o),l&&(u.location={"@type":"Place",name:l}),c&&(u.url=`${qd}${c}`),s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(u)})})}function u1({name:e,description:t,image:r,jobTitle:n="Expert Formateur",knowsAbout:a=[],url:i}){const o={"@context":"https://schema.org","@type":"Person",name:e,jobTitle:n};return t&&(o.description=t),r&&(o.image=r),a.length>0&&(o.knowsAbout=a),i&&(o.url=`${qd}${i}`),s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(o)})})}function Qa({items:e}){const t={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((r,n)=>({"@type":"ListItem",position:n+1,name:r.name,item:`${qd}${r.url}`}))};return s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(t)})})}function AL({headline:e,description:t,image:r,author:n="PedagoBridge",publishedTime:a,modifiedTime:i,url:o}){const l={"@context":"https://schema.org","@type":"Article",headline:e,description:t,author:{"@type":"Organization",name:n},publisher:{"@type":"Organization",name:"PedagoBridge",logo:{"@type":"ImageObject",url:`${qd}/logo.jpg`}},datePublished:a,mainEntityOfPage:{"@type":"WebPage","@id":`${qd}${o}`}};return i&&(l.dateModified=i),r&&(l.image=r),s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(l)})})}function sd({items:e}){const t={"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(r=>({"@type":"Question",name:r.question,acceptedAnswer:{"@type":"Answer",text:r.answer}}))};return s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(t)})})}const TL=()=>{const e=Xt();return s.jsx("section",{className:"py-14 px-4 bg-gradient-to-r from-primary/10 via-primary/5 to-secondary/10 border-y border-primary/10",children:s.jsx("div",{className:"container mx-auto max-w-5xl",children:s.jsxs("div",{className:"flex flex-col lg:flex-row items-center gap-8 lg:gap-12",children:[s.jsxs("div",{className:"flex-1 text-center lg:text-left",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-primary mb-2",children:"Vous êtes un établissement ?"}),s.jsx("h2",{className:"text-2xl md:text-3xl font-bold mb-3",children:"Trouvez vos formateurs et structurez vos programmes"}),s.jsx("p",{className:"text-muted-foreground text-sm md:text-base max-w-lg",children:"Inscription gratuite, formateurs vérifiés, accompagnement pédagogique sur mesure. Des centaines d'experts prêts à intervenir dans votre établissement."})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row lg:flex-col xl:flex-row gap-3 flex-shrink-0",children:[s.jsxs(ne,{size:"lg",onClick:()=>e("/school-register"),className:"gap-2 shadow-sm",children:[s.jsx(Vr,{className:"h-4 w-4"}),"Inscrire mon établissement",s.jsx(Mn,{className:"h-4 w-4"})]}),s.jsxs(ne,{size:"lg",variant:"outline",onClick:()=>e("/constitution-de-programme"),className:"gap-2 border-primary/30 hover:border-primary",children:[s.jsx(Bc,{className:"h-4 w-4"}),"Constitution de programme"]})]})]})})})},fOe=()=>{const e=ou();w.useEffect(()=>{var r;(r=e.state)!=null&&r.scrollTo&&setTimeout(()=>{const n=document.getElementById(e.state.scrollTo);n&&n.scrollIntoView({behavior:"smooth"})},100)},[e]);const t=[{question:"Comment fonctionne PedagoBridge ?",answer:"PedagoBridge met en relation les établissements de formation avec des formateurs experts certifiés. Les écoles publient leurs besoins et les formateurs qualifiés peuvent postuler."},{question:"Comment une école peut-elle trouver un formateur sur PedagoBridge ?",answer:"Un établissement crée un compte gratuit, publie une offre de formation (domaine, dates, niveau) et reçoit des candidatures de formateurs experts vérifiés. La sélection, la messagerie et le suivi des missions se font entièrement sur la plateforme."},{question:"Comment devenir formateur sur PedagoBridge ?",answer:"Créez votre profil formateur, ajoutez vos spécialités et votre CV. Après validation par notre équipe, vous pourrez postuler aux offres de formation. PedagoBridge vous aide également à obtenir votre numéro de déclaration d'activité (NDA)."},{question:"Qu'est-ce que le service de constitution de programmes ?",answer:"PedagoBridge accompagne les écoles et centres de formation dans la structuration de leurs programmes pédagogiques : définition des objectifs, découpage en modules, sélection des formateurs adaptés. Le premier entretien est gratuit et sans engagement."},{question:"Quelles garanties offre PedagoBridge ?",answer:"Nous garantissons la qualité des formateurs affiliés (vérification des diplômes et références), la transparence tarifaire et un remplacement d'urgence en cas de défaillance d'un formateur."},{question:"Est-ce gratuit pour les écoles de s'inscrire et publier des offres ?",answer:"Oui, l'inscription et la publication d'offres sont entièrement gratuites pour les établissements. Une offre SaaS optionnelle à 99 €/mois est disponible pour les fonctionnalités avancées (émargement digital, facturation, Qualiopi)."}];return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Plateforme de Formateurs Experts",description:"PedagoBridge connecte établissements de formation et formateurs experts certifiés. Qualité garantie, transparence totale et remplacement d'urgence assuré.",url:"/",keywords:["formateurs experts","formation professionnelle","recrutement formateurs","plateforme formation","trouver formateur école","formateur pour établissement","centre de formation formateurs","organisme formation formateurs","formateur indépendant certifié"]}),s.jsx(sd,{items:t}),s.jsx($Ce,{}),s.jsx(gPe,{}),s.jsx(TL,{}),s.jsx("div",{id:"values",children:s.jsx(qCe,{})}),s.jsx("div",{id:"about",children:s.jsx(zCe,{})}),s.jsx("div",{id:"domains",children:s.jsx(ZCe,{})}),s.jsx("div",{id:"trainers",children:s.jsx(XCe,{})}),s.jsx(pPe,{}),s.jsx("div",{id:"contact",children:s.jsx(zC,{})}),s.jsx("div",{className:"container mx-auto px-4 py-16",children:s.jsx(bse,{})})]})},hOe=()=>{const e=Xt(),t=ou();w.useEffect(()=>{Ai.warning("404 - Page not found",{metadata:{path:t.pathname,search:t.search,referrer:document.referrer}})},[t]);const r=[{title:"Offres de formation",description:"Découvrez les opportunités de formation",icon:pa,path:"/training-offers"},{title:"Nos formateurs",description:"Parcourez les profils de nos experts",icon:sr,path:"/trainers"},{title:"Blog",description:"Consultez nos articles",icon:xl,path:"/blog"}];return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Page non trouvée - 404",description:"La page que vous recherchez n'existe pas. Découvrez nos formateurs experts et offres de formation.",noindex:!0}),s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"max-w-4xl w-full",children:[s.jsx(ke,{className:"mb-8",children:s.jsxs(Ae,{className:"pt-8 text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-7xl font-bold text-primary mb-4",children:"404"}),s.jsx("h2",{className:"text-3xl font-semibold mb-4",children:"Page non trouvée"}),s.jsxs("p",{className:"text-muted-foreground text-lg max-w-md mx-auto",children:["Désolé, la page ",s.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:t.pathname})," n'existe pas ou a été déplacée."]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mb-6",children:[s.jsxs(ne,{onClick:()=>e(-1),variant:"outline",size:"lg",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour"]}),s.jsxs(ne,{onClick:()=>e("/"),size:"lg",children:[s.jsx(pR,{className:"mr-2 h-4 w-4"}),"Page d'accueil"]})]})]})}),s.jsx("div",{className:"grid md:grid-cols-3 gap-4",children:r.map(n=>s.jsx(ke,{className:"hover:shadow-lg transition-all duration-300 cursor-pointer group",onClick:()=>e(n.path),children:s.jsxs(Ae,{className:"pt-6 text-center",children:[s.jsx(n.icon,{className:"h-12 w-12 mx-auto mb-3 text-primary group-hover:scale-110 transition-transform"}),s.jsx("h3",{className:"font-semibold mb-2 group-hover:text-primary transition-colors",children:n.title}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:n.description}),s.jsx(ne,{variant:"ghost",size:"sm",children:"Découvrir"})]})},n.path))})]})})]})};var UC="Tabs",[mOe]=Xa(UC,[o1]),Tse=o1(),[pOe,PL]=mOe(UC),Pse=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Dg(l),[f,m]=Wo({prop:n,onChange:a,defaultProp:i??"",caller:UC});return s.jsx(pOe,{scope:r,baseId:Ga(),value:f,onValueChange:m,orientation:o,dir:d,activationMode:c,children:s.jsx(zt.div,{dir:d,"data-orientation":o,...u,ref:t})})});Pse.displayName=UC;var Ose="TabsList",Dse=w.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...a}=e,i=PL(Ose,r),o=Tse(r);return s.jsx(eL,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:n,children:s.jsx(zt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:t})})});Dse.displayName=Ose;var Ise="TabsTrigger",Rse=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:a=!1,...i}=e,o=PL(Ise,r),l=Tse(r),c=Mse(o.baseId,n),u=$se(o.baseId,n),d=n===o.value;return s.jsx(tL,{asChild:!0,...l,focusable:!a,active:d,children:s.jsx(zt.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:c,...i,ref:t,onMouseDown:Ct(e.onMouseDown,f=>{!a&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:Ct(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:Ct(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!a&&f&&o.onValueChange(n)})})})});Rse.displayName=Ise;var Lse="TabsContent",Fse=w.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:a,children:i,...o}=e,l=PL(Lse,r),c=Mse(l.baseId,n),u=$se(l.baseId,n),d=n===l.value,f=w.useRef(d);return w.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),s.jsx(Za,{present:a||d,children:({present:m})=>s.jsx(zt.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&i})})});Fse.displayName=Lse;function Mse(e,t){return`${e}-trigger-${t}`}function $se(e,t){return`${e}-content-${t}`}var gOe=Pse,Bse=Dse,zse=Rse,Use=Fse;const af=gOe,ad=w.forwardRef(({className:e,...t},r)=>s.jsx(Bse,{ref:r,className:pt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ad.displayName=Bse.displayName;const In=w.forwardRef(({className:e,...t},r)=>s.jsx(zse,{ref:r,className:pt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));In.displayName=zse.displayName;const Es=w.forwardRef(({className:e,...t},r)=>s.jsx(Use,{ref:r,className:pt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Es.displayName=Use.displayName;const Hn=wC,ml=ZR,xOe=jC,qse=w.forwardRef(({className:e,...t},r)=>s.jsx(a1,{ref:r,className:pt("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}));qse.displayName=a1.displayName;const qn=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(xOe,{children:[s.jsx(qse,{}),s.jsxs(i1,{ref:n,className:pt("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),...r,children:[t,s.jsxs(_C,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(Ri,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));qn.displayName=i1.displayName;const Gn=({className:e,...t})=>s.jsx("div",{className:pt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Gn.displayName="DialogHeader";const Jl=({className:e,...t})=>s.jsx("div",{className:pt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Jl.displayName="DialogFooter";const Kn=w.forwardRef(({className:e,...t},r)=>s.jsx(Vj,{ref:r,className:pt("text-lg font-semibold leading-none tracking-tight",e),...t}));Kn.displayName=Vj.displayName;const Ia=w.forwardRef(({className:e,...t},r)=>s.jsx(Wj,{ref:r,className:pt("text-sm text-muted-foreground",e),...t}));Ia.displayName=Wj.displayName;function vOe(){const e=Xt(),[t]=Bj(),r=t.get("role"),[n,a]=w.useState(!1),[i,o]=w.useState(!1),[l,c]=w.useState(!1),[u,d]=w.useState(""),[f,m]=w.useState(""),[h,g]=w.useState(r==="school"?"school":"trainer"),[p,x]=w.useState(!1),[v,b]=w.useState(""),[y,N]=w.useState(!1);w.useEffect(()=>{const{data:{subscription:P}}=he.auth.onAuthStateChange(async(F,T)=>{T&&setTimeout(async()=>{var C;const{data:k}=await he.from("user_roles").select("role").eq("user_id",T.user.id),V=(k==null?void 0:k.map(R=>R.role))||[];if(V.includes("school"))e("/school/dashboard");else if(V.includes("trainer")){const{data:R}=await he.from("trainer_profiles").select("id, bio, specialties").eq("user_id",T.user.id).single(),H=!R||!R.bio&&((C=R.specialties)==null?void 0:C.length)===0;e(H?"/trainer/profile":"/training-offers")}else e("/")},0)});return he.auth.getSession().then(({data:{session:F}})=>{F&&e("/")}),()=>P.unsubscribe()},[e]),w.useEffect(()=>{r==="school"&&g("school")},[r]);const _=async()=>{o(!0);try{const{error:P}=await he.auth.signInWithOAuth({provider:"google",options:{redirectTo:`${window.location.origin}/auth`,queryParams:{access_type:"offline",prompt:"consent"}}});if(P)throw P}catch(P){console.error("Google login error:",P),Ai.error("Google login failed",P,{action:"google_login",formName:"Auth"}),ae.error(P.message||"Erreur lors de la connexion avec Google"),o(!1)}},j=async P=>{if(P.preventDefault(),!v.trim()){ae.error("Veuillez entrer votre adresse email");return}c(!0);try{const{error:F}=await he.auth.resetPasswordForEmail(v.trim(),{redirectTo:`${window.location.origin}/reset-password`});if(F)throw F;N(!0),Ai.formSubmit("password_reset_request",!0,{email:v}),ae.success("Email de réinitialisation envoyé !")}catch(F){console.error("Reset password error:",F),Ai.error("Password reset failed",F,{action:"password_reset",formName:"Auth"}),ae.error(F.message||"Erreur lors de l'envoi de l'email")}finally{c(!1)}},S=async P=>{var F;P.preventDefault(),a(!0);try{const{data:T,error:k}=await he.auth.signInWithPassword({email:u,password:f});if(k)throw k;Ai.formSubmit("login",!0,{email:u,role:h}),ae.success("Connexion réussie");const{data:V}=await he.from("user_roles").select("role").eq("user_id",T.user.id),C=(V==null?void 0:V.map(R=>R.role))||[];if(C.includes("school"))e("/school/dashboard");else if(C.includes("trainer")){const{data:R}=await he.from("trainer_profiles").select("id, bio, specialties").eq("user_id",T.user.id).single(),H=!R||!R.bio&&((F=R.specialties)==null?void 0:F.length)===0;e(H?"/trainer/profile":"/training-offers")}else e("/")}catch(T){console.error("Login error:",T),Ai.error("Login failed",T,{action:"login",formName:"Auth",metadata:{email:u}});let k="Erreur lors de la connexion";T.message.includes("Invalid login credentials")?k="Email ou mot de passe incorrect.":T.message.includes("Email not confirmed")?k="Veuillez confirmer votre email avant de vous connecter.":k=T.message||"Erreur lors de la connexion.",ae.error(k)}finally{a(!1)}},I=()=>{x(!1),b(""),N(!1)};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Connexion",description:"Connectez-vous à votre espace PedagoBridge - Formateurs et établissements de formation.",url:"/auth",noindex:!0}),s.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center px-4 py-12",children:[s.jsxs("div",{className:"w-full max-w-md",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>e("/"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour à l'accueil"]}),s.jsxs(ke,{children:[s.jsxs(ht,{className:"text-center pb-4",children:[s.jsx(xt,{className:"text-2xl",children:"Connexion"}),s.jsx(Qr,{className:"mb-2",children:"Accédez à votre espace personnel"}),s.jsxs("div",{className:"bg-primary/5 border border-primary/20 text-primary p-3 rounded-md text-sm text-center shadow-sm",children:["Si vous ne parvenez pas à vous connecter, utilisez ",s.jsx("strong",{children:"Mot de passe oublié"})," pour configurer un nouveau mot de passe sécurisé."]})]}),s.jsxs(Ae,{children:[s.jsx(af,{value:h,onValueChange:g,className:"mb-6",children:s.jsxs(ad,{className:"grid w-full grid-cols-2",children:[s.jsxs(In,{value:"trainer",className:"flex items-center gap-2",children:[s.jsx(Ii,{className:"h-4 w-4"}),"Formateur"]}),s.jsxs(In,{value:"school",className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-4 w-4"}),"Établissement"]})]})}),h==="school"&&s.jsxs("div",{className:"mb-6 p-4 rounded-lg bg-primary/5 border border-primary/20 space-y-3",children:[s.jsx("p",{className:"text-sm font-medium text-center",children:"Pas encore de compte établissement ?"}),s.jsxs(ne,{type:"button",className:"w-full",onClick:()=>e("/school-register"),children:[s.jsx(Vr,{className:"mr-2 h-4 w-4"}),"Créer mon espace établissement — gratuit"]}),s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Inscription en 2 min · 10 publications gratuites · Sans engagement"}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 flex items-center",children:s.jsx("span",{className:"w-full border-t"})}),s.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:s.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"déjà un compte"})})]})]}),s.jsxs(ne,{type:"button",variant:"outline",className:"w-full mb-4 flex items-center justify-center gap-2",onClick:_,disabled:i,children:[i?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",children:[s.jsx("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),s.jsx("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),s.jsx("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Continuer avec Google"]}),s.jsxs("div",{className:"relative my-4",children:[s.jsx("div",{className:"absolute inset-0 flex items-center",children:s.jsx("span",{className:"w-full border-t"})}),s.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:s.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"ou par email"})})]}),s.jsxs("form",{onSubmit:S,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"login-email",children:"Email"}),s.jsx(Ye,{id:"login-email",type:"email",placeholder:"votre@email.com",value:u,onChange:P=>d(P.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(We,{htmlFor:"login-password",children:"Mot de passe"}),s.jsx("button",{type:"button",onClick:()=>x(!0),className:"text-sm text-primary hover:underline",children:"Mot de passe oublié ?"})]}),s.jsx(Ye,{id:"login-password",type:"password",placeholder:"••••••",value:f,onChange:P=>m(P.target.value),required:!0})]}),s.jsx(ne,{type:"submit",className:"w-full",disabled:n,children:n?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Connexion..."]}):"Se connecter"})]}),s.jsxs("div",{className:"mt-6 pt-6 border-t",children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-4 text-center",children:"Pas encore de compte ? Créez-en un :"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs(ne,{variant:"default",onClick:()=>e("/trainer-register"),className:"w-full",children:[s.jsx(Ii,{className:"mr-2 h-4 w-4"}),"Créer un compte formateur"]}),s.jsxs(ne,{variant:"outline",onClick:()=>e("/school-register"),className:"w-full",children:[s.jsx(Vr,{className:"mr-2 h-4 w-4"}),"Créer un compte établissement"]})]})]})]})]})]}),s.jsx(Hn,{open:p,onOpenChange:I,children:s.jsxs(qn,{className:"sm:max-w-md",children:[s.jsxs(Gn,{children:[s.jsxs(Kn,{className:"flex items-center gap-2",children:[s.jsx(Fn,{className:"h-5 w-5"}),"Réinitialiser le mot de passe"]}),s.jsx(Ia,{children:y?"Un email de réinitialisation a été envoyé à votre adresse.":"Entrez votre adresse email pour recevoir un lien de réinitialisation."})]}),y?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"p-4 rounded-lg bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 text-sm",children:[s.jsx("p",{className:"font-medium mb-1",children:"Email envoyé !"}),s.jsx("p",{children:"Vérifiez votre boîte de réception (et vos spams) pour le lien de réinitialisation."})]}),s.jsx(ne,{onClick:I,className:"w-full",children:"Fermer"})]}):s.jsxs("form",{onSubmit:j,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"reset-email",children:"Email"}),s.jsx(Ye,{id:"reset-email",type:"email",placeholder:"votre@email.com",value:v,onChange:P=>b(P.target.value),required:!0})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{type:"button",variant:"outline",onClick:I,className:"flex-1",children:"Annuler"}),s.jsx(ne,{type:"submit",disabled:l,className:"flex-1",children:l?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi..."]}):"Envoyer"})]})]})]})})]})]})}var qC="Checkbox",[yOe]=Xa(qC),[bOe,OL]=yOe(qC);function wOe(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[m,h]=Wo({prop:r,defaultProp:a??!1,onChange:c,caller:qC}),[g,p]=w.useState(null),[x,v]=w.useState(null),b=w.useRef(!1),y=g?!!o||!!g.closest("form"):!0,N={checked:m,disabled:i,setChecked:h,control:g,setControl:p,name:l,form:o,value:d,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:Gm(a)?!1:a,isFormControl:y,bubbleInput:x,setBubbleInput:v};return s.jsx(bOe,{scope:t,...N,children:jOe(f)?f(N):n})}var Vse="CheckboxTrigger",Wse=w.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:i,value:o,disabled:l,checked:c,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:g}=OL(Vse,e),p=Cr(a,d),x=w.useRef(c);return w.useEffect(()=>{const v=i==null?void 0:i.form;if(v){const b=()=>f(x.current);return v.addEventListener("reset",b),()=>v.removeEventListener("reset",b)}},[i,f]),s.jsx(zt.button,{type:"button",role:"checkbox","aria-checked":Gm(c)?"mixed":c,"aria-required":u,"data-state":Xse(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:p,onKeyDown:Ct(t,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:Ct(r,v=>{f(b=>Gm(b)?!0:!b),g&&h&&(m.current=v.isPropagationStopped(),m.current||v.stopPropagation())})})});Wse.displayName=Vse;var DL=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:u,form:d,...f}=e;return s.jsx(wOe,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:u,name:n,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>s.jsxs(s.Fragment,{children:[s.jsx(Wse,{...f,ref:t,__scopeCheckbox:r}),m&&s.jsx(Yse,{__scopeCheckbox:r})]})})});DL.displayName=qC;var Hse="CheckboxIndicator",Gse=w.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,i=OL(Hse,r);return s.jsx(Za,{present:n||Gm(i.checked)||i.checked===!0,children:s.jsx(zt.span,{"data-state":Xse(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});Gse.displayName=Hse;var Kse="CheckboxBubbleInput",Yse=w.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:o,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:m,setBubbleInput:h}=OL(Kse,e),g=Cr(r,h),p=RC(i),x=oC(n);w.useEffect(()=>{const b=m;if(!b)return;const y=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(y,"checked").set,j=!a.current;if(p!==i&&_){const S=new Event("click",{bubbles:j});b.indeterminate=Gm(i),_.call(b,Gm(i)?!1:i),b.dispatchEvent(S)}},[m,p,i,a]);const v=w.useRef(Gm(i)?!1:i);return s.jsx(zt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??v.current,required:l,disabled:c,name:u,value:d,form:f,...t,tabIndex:-1,ref:g,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Yse.displayName=Kse;function jOe(e){return typeof e=="function"}function Gm(e){return e==="indeterminate"}function Xse(e){return Gm(e)?"indeterminate":e?"checked":"unchecked"}const Vo=w.forwardRef(({className:e,...t},r)=>s.jsx(DL,{ref:r,className:pt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-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),...t,children:s.jsx(Gse,{className:pt("flex items-center justify-center text-current"),children:s.jsx(Pn,{className:"h-4 w-4"})})}));Vo.displayName=DL.displayName;var Zse="AlertDialog",[_Oe]=Xa(Zse,[wte]),jh=wte(),Jse=e=>{const{__scopeAlertDialog:t,...r}=e,n=jh(t);return s.jsx(wC,{...n,...r,modal:!0})};Jse.displayName=Zse;var NOe="AlertDialogTrigger",Qse=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=jh(r);return s.jsx(ZR,{...a,...n,ref:t})});Qse.displayName=NOe;var SOe="AlertDialogPortal",eae=e=>{const{__scopeAlertDialog:t,...r}=e,n=jh(t);return s.jsx(jC,{...n,...r})};eae.displayName=SOe;var kOe="AlertDialogOverlay",tae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=jh(r);return s.jsx(a1,{...a,...n,ref:t})});tae.displayName=kOe;var _v="AlertDialogContent",[COe,EOe]=_Oe(_v),AOe=jJ("AlertDialogContent"),rae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...a}=e,i=jh(r),o=w.useRef(null),l=Cr(t,o),c=w.useRef(null);return s.jsx(QNe,{contentName:_v,titleName:nae,docsSlug:"alert-dialog",children:s.jsx(COe,{scope:r,cancelRef:c,children:s.jsxs(i1,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:Ct(a.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[s.jsx(AOe,{children:n}),s.jsx(POe,{contentRef:o})]})})})});rae.displayName=_v;var nae="AlertDialogTitle",sae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=jh(r);return s.jsx(Vj,{...a,...n,ref:t})});sae.displayName=nae;var aae="AlertDialogDescription",iae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=jh(r);return s.jsx(Wj,{...a,...n,ref:t})});iae.displayName=aae;var TOe="AlertDialogAction",oae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=jh(r);return s.jsx(_C,{...a,...n,ref:t})});oae.displayName=TOe;var lae="AlertDialogCancel",cae=w.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=EOe(lae,r),i=jh(r),o=Cr(t,a);return s.jsx(_C,{...i,...n,ref:o})});cae.displayName=lae;var POe=({contentRef:e})=>{const t=`\`${_v}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${_v}\` by passing a \`${aae}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
Alternatively, 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 \`${_v}\`. 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.
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return w.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},OOe=Jse,DOe=Qse,IOe=eae,uae=tae,dae=rae,fae=oae,hae=cae,mae=sae,pae=iae;const Vu=OOe,Zf=DOe,ROe=IOe,gae=w.forwardRef(({className:e,...t},r)=>s.jsx(uae,{className:pt("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:r}));gae.displayName=uae.displayName;const Hc=w.forwardRef(({className:e,...t},r)=>s.jsxs(ROe,{children:[s.jsx(gae,{}),s.jsx(dae,{ref:r,className:pt("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})]}));Hc.displayName=dae.displayName;const Gc=({className:e,...t})=>s.jsx("div",{className:pt("flex flex-col space-y-2 text-center sm:text-left",e),...t});Gc.displayName="AlertDialogHeader";const Kc=({className:e,...t})=>s.jsx("div",{className:pt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Kc.displayName="AlertDialogFooter";const Yc=w.forwardRef(({className:e,...t},r)=>s.jsx(mae,{ref:r,className:pt("text-lg font-semibold",e),...t}));Yc.displayName=mae.displayName;const Xc=w.forwardRef(({className:e,...t},r)=>s.jsx(pae,{ref:r,className:pt("text-sm text-muted-foreground",e),...t}));Xc.displayName=pae.displayName;const Zc=w.forwardRef(({className:e,...t},r)=>s.jsx(fae,{ref:r,className:pt(p2(),e),...t}));Zc.displayName=fae.displayName;const Wu=w.forwardRef(({className:e,...t},r)=>s.jsx(hae,{ref:r,className:pt(p2({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Wu.displayName=hae.displayName;function LOe(){const e=Xt(),[t]=Bj(),[r,n]=w.useState(!1),[a,i]=w.useState(!1);w.useEffect(()=>{const y=t.get("ref");y&&localStorage.setItem("pb_ref",y)},[t]);const[o,l]=w.useState(""),[c,u]=w.useState(""),[d,f]=w.useState(""),[m,h]=w.useState(""),[g,p]=w.useState(!1),x=async y=>{if(y.preventDefault(),d!==m){ae.error("Les mots de passe ne correspondent pas");return}if(d.length<6){ae.error("Le mot de passe doit contenir au moins 6 caractères");return}if(!o.trim()){ae.error("Veuillez entrer votre nom");return}if(!g){ae.error("Veuillez accepter les CGU et la politique de confidentialité");return}n(!0);try{const{data:N,error:_}=await he.auth.signUp({email:c.trim(),password:d,options:{emailRedirectTo:`${window.location.origin}/`,data:{name:o.trim()}}});if(_)throw _;if(!N.user)throw new Error("Erreur lors de la création du compte");const{error:j}=await he.from("user_roles").insert({user_id:N.user.id,role:"trainer"});j&&console.error("Error assigning role:",j);const S=t.get("ref")||localStorage.getItem("pb_ref"),{error:I}=await he.from("trainer_profiles").insert({user_id:N.user.id,email:c.trim(),name:o.trim(),status:"pending",...S?{referred_by_code:S}:{}});I||localStorage.removeItem("pb_ref"),I?console.error("Error creating profile:",I):xi.trackSignup("trainer");try{await he.functions.invoke("notify-trainer-signup",{body:{trainerName:o.trim(),trainerEmail:c.trim()}})}catch(P){console.error("Error sending notification email:",P)}ae.success("Compte créé avec succès !"),ae.info("Votre profil sera vérifié sous 48h avant vous pourrez le publier en activant visibilité publique",{duration:5e3}),i(!0)}catch(N){console.error("Error during registration:",N),ae.error(N.message||"Erreur lors de la création du compte")}finally{n(!1)}},v=()=>{e("/auth")},b=()=>{e("/")};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Inscription Formateur",description:"Créez votre compte formateur sur PedagoBridge et rejoignez notre réseau de formateurs qualifiés pour trouver des missions de formation.",url:"/trainer/register",noindex:!0}),s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4 py-12",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>e("/auth"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour à la connexion"]}),s.jsxs(ke,{children:[s.jsxs(ht,{className:"text-center",children:[s.jsx(xt,{className:"text-2xl",children:"Créer un compte formateur"}),s.jsx(Qr,{children:"Rejoignez notre réseau et accédez à des centaines d'offres de formation"}),s.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2 text-left",children:[{icon:as,text:"Offres de formation en continu"},{icon:iu,text:"Badge formateur certifié"},{icon:Wr,text:"Profil visible par les écoles"}].map(y=>{const N=y.icon;return s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/50 text-xs",children:[s.jsx(N,{className:"h-3.5 w-3.5 text-primary shrink-0"}),s.jsx("span",{children:y.text})]},y.text)})})]}),s.jsxs(Ae,{children:[s.jsxs("form",{onSubmit:x,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"name",children:"Nom complet *"}),s.jsx(Ye,{id:"name",type:"text",placeholder:"Jean Dupont",value:o,onChange:y=>l(y.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email",children:"Email *"}),s.jsx(Ye,{id:"email",type:"email",placeholder:"jean.dupont@example.com",value:c,onChange:y=>u(y.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"password",children:"Mot de passe *"}),s.jsx(Ye,{id:"password",type:"password",placeholder:"Minimum 6 caractères",value:d,onChange:y=>f(y.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"confirmPassword",children:"Confirmer le mot de passe *"}),s.jsx(Ye,{id:"confirmPassword",type:"password",placeholder:"Confirmez votre mot de passe",value:m,onChange:y=>h(y.target.value),required:!0})]}),s.jsxs("div",{className:"flex items-start space-x-2 pt-2",children:[s.jsx(Vo,{id:"terms",checked:g,onCheckedChange:y=>p(y)}),s.jsxs("label",{htmlFor:"terms",className:"text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["J'accepte les"," ",s.jsx("a",{href:"/terms",className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",children:"conditions générales d'utilisation"})," ","et la"," ",s.jsx("a",{href:"/privacy",className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",children:"politique de confidentialité"}),"*"]})]}),s.jsx(ne,{type:"submit",className:"w-full",disabled:r,children:r?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Création en cours..."]}):"Créer mon compte"})]}),s.jsxs("div",{className:"mt-6 pt-6 border-t space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-emerald-50 dark:bg-emerald-950/20 border border-emerald-100 dark:border-emerald-900",children:[s.jsx(Vc,{className:"h-5 w-5 text-emerald-600 shrink-0"}),s.jsxs("p",{className:"text-sm",children:[s.jsx("span",{className:"font-medium text-emerald-800 dark:text-emerald-200",children:"Assistance NDA incluse"}),s.jsx("span",{className:"text-muted-foreground",children:" — Nous vous aidons à obtenir votre numéro de déclaration d'activité."}),s.jsx("a",{href:"/assistance-nda",className:"text-emerald-700 dark:text-emerald-300 underline underline-offset-2 hover:no-underline text-xs",children:"En savoir plus"})]})]}),s.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[s.jsx("div",{className:"h-7 w-7 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:s.jsx("span",{className:"text-primary text-sm",children:"🤖"})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Assistant IA inclus"})," — Pour vous guider sur la plateforme."]})]}),s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Profil vérifié par notre équipe sous 48h avant publication."})]})]})]})]})}),s.jsx(Vu,{open:a,onOpenChange:i,children:s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Compte créé avec succès ! 🎉"}),s.jsx(Xc,{asChild:!0,children:s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{children:"Votre compte formateur est actif. ✅"}),s.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/20 text-sm",children:[s.jsx("p",{className:"font-medium mb-1",children:"✨ Gagnez du temps"}),s.jsxs("p",{children:["Téléchargez simplement votre CV : votre profil (spécialités, bio, expériences) sera ",s.jsx("strong",{children:"automatiquement rempli"})," grâce à l'analyse IA."]})]}),s.jsx("p",{children:"Souhaitez-vous compléter votre profil maintenant ou le faire plus tard ?"})]})})]}),s.jsxs(Kc,{className:"flex-col sm:flex-row gap-2",children:[s.jsx(ne,{variant:"outline",onClick:b,className:"w-full sm:w-auto",children:"Compléter plus tard"}),s.jsx(Zc,{onClick:v,className:"w-full sm:w-auto",children:"Compléter mon profil"})]})]})})]})}var Rz=1,FOe=.9,MOe=.8,$Oe=.17,eT=.1,tT=.999,BOe=.9999,zOe=.99,UOe=/[\\\/_+.#"@\[\(\{&]/,qOe=/[\\\/_+.#"@\[\(\{&]/g,VOe=/[\s-]/,xae=/[\s-]/g;function B6(e,t,r,n,a,i,o){if(i===t.length)return a===e.length?Rz:zOe;var l=`${a},${i}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(i),u=r.indexOf(c,a),d=0,f,m,h,g;u>=0;)f=B6(e,t,r,n,u+1,i+1,o),f>d&&(u===a?f*=Rz:UOe.test(e.charAt(u-1))?(f*=MOe,h=e.slice(a,u-1).match(qOe),h&&a>0&&(f*=Math.pow(tT,h.length))):VOe.test(e.charAt(u-1))?(f*=FOe,g=e.slice(a,u-1).match(xae),g&&a>0&&(f*=Math.pow(tT,g.length))):(f*=$Oe,a>0&&(f*=Math.pow(tT,u-a))),e.charAt(u)!==t.charAt(i)&&(f*=BOe)),(f<eT&&r.charAt(u-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(u-1)!==n.charAt(i))&&(m=B6(e,t,r,n,u+1,i+2,o),m*eT>f&&(f=m*eT)),f>d&&(d=f),u=r.indexOf(c,u+1);return o[l]=d,d}function Lz(e){return e.toLowerCase().replace(xae," ")}function WOe(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,B6(e,t,Lz(e),Lz(t),0,0,{})}var _b='[cmdk-group=""]',rT='[cmdk-group-items=""]',HOe='[cmdk-group-heading=""]',vae='[cmdk-item=""]',Fz=`${vae}:not([aria-disabled="true"])`,z6="cmdk-item-select",Lx="data-value",GOe=(e,t,r)=>WOe(e,t,r),yae=w.createContext(void 0),Zj=()=>w.useContext(yae),bae=w.createContext(void 0),IL=()=>w.useContext(bae),wae=w.createContext(void 0),jae=w.forwardRef((e,t)=>{let r=Fx(()=>{var E,A;return{search:"",value:(A=(E=e.value)!=null?E:e.defaultValue)!=null?A:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=Fx(()=>new Set),a=Fx(()=>new Map),i=Fx(()=>new Map),o=Fx(()=>new Set),l=_ae(e),{label:c,children:u,value:d,onValueChange:f,filter:m,shouldFilter:h,loop:g,disablePointerSelection:p=!1,vimBindings:x=!0,...v}=e,b=Ga(),y=Ga(),N=Ga(),_=w.useRef(null),j=s6e();dg(()=>{if(d!==void 0){let E=d.trim();r.current.value=E,S.emit()}},[d]),dg(()=>{j(6,V)},[]);let S=w.useMemo(()=>({subscribe:E=>(o.current.add(E),()=>o.current.delete(E)),snapshot:()=>r.current,setState:(E,A,O)=>{var U,Y,J,se;if(!Object.is(r.current[E],A)){if(r.current[E]=A,E==="search")k(),F(),j(1,T);else if(E==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ee=document.getElementById(N);ee?ee.focus():(U=document.getElementById(b))==null||U.focus()}if(j(7,()=>{var ee;r.current.selectedItemId=(ee=C())==null?void 0:ee.id,S.emit()}),O||j(5,V),((Y=l.current)==null?void 0:Y.value)!==void 0){let ee=A??"";(se=(J=l.current).onValueChange)==null||se.call(J,ee);return}}S.emit()}},emit:()=>{o.current.forEach(E=>E())}}),[]),I=w.useMemo(()=>({value:(E,A,O)=>{var U;A!==((U=i.current.get(E))==null?void 0:U.value)&&(i.current.set(E,{value:A,keywords:O}),r.current.filtered.items.set(E,P(A,O)),j(2,()=>{F(),S.emit()}))},item:(E,A)=>(n.current.add(E),A&&(a.current.has(A)?a.current.get(A).add(E):a.current.set(A,new Set([E]))),j(3,()=>{k(),F(),r.current.value||T(),S.emit()}),()=>{i.current.delete(E),n.current.delete(E),r.current.filtered.items.delete(E);let O=C();j(4,()=>{k(),(O==null?void 0:O.getAttribute("id"))===E&&T(),S.emit()})}),group:E=>(a.current.has(E)||a.current.set(E,new Set),()=>{i.current.delete(E),a.current.delete(E)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:N,labelId:y,listInnerRef:_}),[]);function P(E,A){var O,U;let Y=(U=(O=l.current)==null?void 0:O.filter)!=null?U:GOe;return E?Y(E,r.current.search,A):0}function F(){if(!r.current.search||l.current.shouldFilter===!1)return;let E=r.current.filtered.items,A=[];r.current.filtered.groups.forEach(U=>{let Y=a.current.get(U),J=0;Y.forEach(se=>{let ee=E.get(se);J=Math.max(ee,J)}),A.push([U,J])});let O=_.current;R().sort((U,Y)=>{var J,se;let ee=U.getAttribute("id"),ie=Y.getAttribute("id");return((J=E.get(ie))!=null?J:0)-((se=E.get(ee))!=null?se:0)}).forEach(U=>{let Y=U.closest(rT);Y?Y.appendChild(U.parentElement===Y?U:U.closest(`${rT} > *`)):O.appendChild(U.parentElement===O?U:U.closest(`${rT} > *`))}),A.sort((U,Y)=>Y[1]-U[1]).forEach(U=>{var Y;let J=(Y=_.current)==null?void 0:Y.querySelector(`${_b}[${Lx}="${encodeURIComponent(U[0])}"]`);J==null||J.parentElement.appendChild(J)})}function T(){let E=R().find(O=>O.getAttribute("aria-disabled")!=="true"),A=E==null?void 0:E.getAttribute(Lx);S.setState("value",A||void 0)}function k(){var E,A,O,U;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let Y=0;for(let J of n.current){let se=(A=(E=i.current.get(J))==null?void 0:E.value)!=null?A:"",ee=(U=(O=i.current.get(J))==null?void 0:O.keywords)!=null?U:[],ie=P(se,ee);r.current.filtered.items.set(J,ie),ie>0&&Y++}for(let[J,se]of a.current)for(let ee of se)if(r.current.filtered.items.get(ee)>0){r.current.filtered.groups.add(J);break}r.current.filtered.count=Y}function V(){var E,A,O;let U=C();U&&(((E=U.parentElement)==null?void 0:E.firstChild)===U&&((O=(A=U.closest(_b))==null?void 0:A.querySelector(HOe))==null||O.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function C(){var E;return(E=_.current)==null?void 0:E.querySelector(`${vae}[aria-selected="true"]`)}function R(){var E;return Array.from(((E=_.current)==null?void 0:E.querySelectorAll(Fz))||[])}function H(E){let A=R()[E];A&&S.setState("value",A.getAttribute(Lx))}function q(E){var A;let O=C(),U=R(),Y=U.findIndex(se=>se===O),J=U[Y+E];(A=l.current)!=null&&A.loop&&(J=Y+E<0?U[U.length-1]:Y+E===U.length?U[0]:U[Y+E]),J&&S.setState("value",J.getAttribute(Lx))}function L(E){let A=C(),O=A==null?void 0:A.closest(_b),U;for(;O&&!U;)O=E>0?r6e(O,_b):n6e(O,_b),U=O==null?void 0:O.querySelector(Fz);U?S.setState("value",U.getAttribute(Lx)):q(E)}let M=()=>H(R().length-1),z=E=>{E.preventDefault(),E.metaKey?M():E.altKey?L(1):q(1)},K=E=>{E.preventDefault(),E.metaKey?H(0):E.altKey?L(-1):q(-1)};return w.createElement(zt.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:E=>{var A;(A=v.onKeyDown)==null||A.call(v,E);let O=E.nativeEvent.isComposing||E.keyCode===229;if(!(E.defaultPrevented||O))switch(E.key){case"n":case"j":{x&&E.ctrlKey&&z(E);break}case"ArrowDown":{z(E);break}case"p":case"k":{x&&E.ctrlKey&&K(E);break}case"ArrowUp":{K(E);break}case"Home":{E.preventDefault(),H(0);break}case"End":{E.preventDefault(),M();break}case"Enter":{E.preventDefault();let U=C();if(U){let Y=new Event(z6);U.dispatchEvent(Y)}}}}},w.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:i6e},c),VC(e,E=>w.createElement(bae.Provider,{value:S},w.createElement(yae.Provider,{value:I},E))))}),KOe=w.forwardRef((e,t)=>{var r,n;let a=Ga(),i=w.useRef(null),o=w.useContext(wae),l=Zj(),c=_ae(e),u=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;dg(()=>{if(!u)return l.item(a,o==null?void 0:o.id)},[u]);let d=Nae(a,i,[e.value,e.children,i],e.keywords),f=IL(),m=sp(j=>j.value&&j.value===d.current),h=sp(j=>u||l.filter()===!1?!0:j.search?j.filtered.items.get(a)>0:!0);w.useEffect(()=>{let j=i.current;if(!(!j||e.disabled))return j.addEventListener(z6,g),()=>j.removeEventListener(z6,g)},[h,e.onSelect,e.disabled]);function g(){var j,S;p(),(S=(j=c.current).onSelect)==null||S.call(j,d.current)}function p(){f.setState("value",d.current,!0)}if(!h)return null;let{disabled:x,value:v,onSelect:b,forceMount:y,keywords:N,..._}=e;return w.createElement(zt.div,{ref:ch(i,t),..._,id:a,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!m,"data-disabled":!!x,"data-selected":!!m,onPointerMove:x||l.getDisablePointerSelection()?void 0:p,onClick:x?void 0:g},e.children)}),YOe=w.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...i}=e,o=Ga(),l=w.useRef(null),c=w.useRef(null),u=Ga(),d=Zj(),f=sp(h=>a||d.filter()===!1?!0:h.search?h.filtered.groups.has(o):!0);dg(()=>d.group(o),[]),Nae(o,l,[e.value,e.heading,c]);let m=w.useMemo(()=>({id:o,forceMount:a}),[a]);return w.createElement(zt.div,{ref:ch(l,t),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&w.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),VC(e,h=>w.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},w.createElement(wae.Provider,{value:m},h))))}),XOe=w.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=w.useRef(null),i=sp(o=>!o.search);return!r&&!i?null:w.createElement(zt.div,{ref:ch(a,t),...n,"cmdk-separator":"",role:"separator"})}),ZOe=w.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,i=IL(),o=sp(u=>u.search),l=sp(u=>u.selectedItemId),c=Zj();return w.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),w.createElement(zt.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:a?e.value:o,onChange:u=>{a||i.setState("search",u.target.value),r==null||r(u.target.value)}})}),JOe=w.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,i=w.useRef(null),o=w.useRef(null),l=sp(u=>u.selectedItemId),c=Zj();return w.useEffect(()=>{if(o.current&&i.current){let u=o.current,d=i.current,f,m=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let h=u.offsetHeight;d.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return m.observe(u),()=>{cancelAnimationFrame(f),m.unobserve(u)}}},[]),w.createElement(zt.div,{ref:ch(i,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:c.listId},VC(e,u=>w.createElement("div",{ref:ch(o,c.listInnerRef),"cmdk-list-sizer":""},u)))}),QOe=w.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:i,container:o,...l}=e;return w.createElement(wC,{open:r,onOpenChange:n},w.createElement(jC,{container:o},w.createElement(a1,{"cmdk-overlay":"",className:a}),w.createElement(i1,{"aria-label":e.label,"cmdk-dialog":"",className:i},w.createElement(jae,{ref:t,...l}))))}),e6e=w.forwardRef((e,t)=>sp(r=>r.filtered.count===0)?w.createElement(zt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),t6e=w.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...i}=e;return w.createElement(zt.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},VC(e,o=>w.createElement("div",{"aria-hidden":!0},o)))}),bl=Object.assign(jae,{List:JOe,Item:KOe,Input:ZOe,Group:YOe,Separator:XOe,Dialog:QOe,Empty:e6e,Loading:t6e});function r6e(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function n6e(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function _ae(e){let t=w.useRef(e);return dg(()=>{t.current=e}),t}var dg=typeof window>"u"?w.useEffect:w.useLayoutEffect;function Fx(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function sp(e){let t=IL(),r=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,r,r)}function Nae(e,t,r,n=[]){let a=w.useRef(),i=Zj();return dg(()=>{var o;let l=(()=>{var u;for(let d of r){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():a.current}})(),c=n.map(u=>u.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Lx,l),a.current=l}),a}var s6e=()=>{let[e,t]=w.useState(),r=Fx(()=>new Map);return dg(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function a6e(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function VC({asChild:e,children:t},r){return e&&w.isValidElement(t)?w.cloneElement(a6e(t),{ref:t.ref},r(t.props.children)):r(t)}var i6e={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const ap=w.forwardRef(({className:e,...t},r)=>s.jsx(bl,{ref:r,className:pt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));ap.displayName=bl.displayName;const o6e=({children:e,...t})=>s.jsx(Hn,{...t,children:s.jsx(qn,{className:"overflow-hidden p-0 shadow-lg",children:s.jsx(ap,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),ip=w.forwardRef(({className:e,...t},r)=>s.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[s.jsx(pa,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),s.jsx(bl.Input,{ref:r,className:pt("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));ip.displayName=bl.Input.displayName;const op=w.forwardRef(({className:e,...t},r)=>s.jsx(bl.List,{ref:r,className:pt("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));op.displayName=bl.List.displayName;const lp=w.forwardRef((e,t)=>s.jsx(bl.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));lp.displayName=bl.Empty.displayName;const Jf=w.forwardRef(({className:e,...t},r)=>s.jsx(bl.Group,{ref:r,className:pt("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Jf.displayName=bl.Group.displayName;const l6e=w.forwardRef(({className:e,...t},r)=>s.jsx(bl.Separator,{ref:r,className:pt("-mx-1 h-px bg-border",e),...t}));l6e.displayName=bl.Separator.displayName;const Bu=w.forwardRef(({className:e,...t},r)=>s.jsx(bl.Item,{ref:r,className:pt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),...t}));Bu.displayName=bl.Item.displayName;function c6e(){const[e,t]=w.useState(!1),[r,n]=w.useState(""),[a,i]=w.useState([]),[o,l]=w.useState(!1),c=Xt();w.useEffect(()=>{const h=g=>{g.key==="k"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),t(p=>!p))};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[]);const u=w.useCallback(async h=>{if(!h.trim()){i([]);return}l(!0);const g=[];h.toLowerCase();try{const{data:p}=await he.from("trainer_profiles").select("id, name, email, status").or(`name.ilike.%${h}%,email.ilike.%${h}%`).limit(5);p&&g.push(...p.map(y=>({id:y.id,type:"trainer",title:y.name,subtitle:`${y.email} - ${y.status==="approved"?"Approuvé":y.status==="pending"?"En attente":"Rejeté"}`,href:"/admin/trainers"})));const{data:x}=await he.from("school_profiles").select("id, name, contact_email").or(`name.ilike.%${h}%,contact_email.ilike.%${h}%`).limit(5);x&&g.push(...x.map(y=>({id:y.id,type:"school",title:y.name,subtitle:y.contact_email||void 0,href:"/admin/schools"})));const{data:v}=await he.from("school_requests").select("id, school_name, description, status").or(`school_name.ilike.%${h}%,description.ilike.%${h}%`).limit(5);v&&g.push(...v.map(y=>({id:y.id,type:"offer",title:y.school_name,subtitle:y.description.substring(0,50)+"...",href:"/admin/training-requests"})));const{data:b}=await he.from("blog_posts").select("id, title, slug, status").or(`title.ilike.%${h}%`).limit(5);b&&g.push(...b.map(y=>({id:y.id,type:"blog",title:y.title,subtitle:y.status==="published"?"Publié":"Brouillon",href:`/admin/blog/edit/${y.id}`}))),i(g)}catch(p){console.error("Search error:",p)}finally{l(!1)}},[]);w.useEffect(()=>{const h=setTimeout(()=>{u(r)},300);return()=>clearTimeout(h)},[r,u]);const d=h=>{switch(h){case"trainer":return s.jsx(qo,{className:"h-4 w-4"});case"school":return s.jsx(Vr,{className:"h-4 w-4"});case"offer":return s.jsx(as,{className:"h-4 w-4"});case"blog":return s.jsx(Gt,{className:"h-4 w-4"})}},f=h=>{switch(h){case"trainer":return"Formateurs";case"school":return"Écoles";case"offer":return"Offres";case"blog":return"Blog"}},m=a.reduce((h,g)=>(h[g.type]||(h[g.type]=[]),h[g.type].push(g),h),{});return s.jsxs(s.Fragment,{children:[s.jsxs(ne,{variant:"outline",className:"relative w-full justify-start text-sm text-muted-foreground sm:pr-12 md:w-64",onClick:()=>t(!0),children:[s.jsx(pa,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"hidden lg:inline-flex",children:"Rechercher..."}),s.jsx("span",{className:"inline-flex lg:hidden",children:"Rechercher..."}),s.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-1.5 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex",children:[s.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),s.jsxs(o6e,{open:e,onOpenChange:t,children:[s.jsx(ip,{placeholder:"Rechercher formateurs, écoles, offres, articles...",value:r,onValueChange:n}),s.jsxs(op,{children:[s.jsx(lp,{children:o?"Recherche en cours...":"Aucun résultat trouvé."}),Object.entries(m).map(([h,g],p)=>s.jsx(Jf,{heading:f(h),children:g.map(x=>s.jsxs(Bu,{value:x.title,onSelect:()=>{c(x.href),t(!1),n("")},children:[d(x.type),s.jsxs("div",{className:"ml-2 flex-1",children:[s.jsx("p",{className:"text-sm font-medium",children:x.title}),x.subtitle&&s.jsx("p",{className:"text-xs text-muted-foreground",children:x.subtitle})]})]},x.id))},h))]})]})]})}function u6e(){const[e,t]=w.useState({pendingTrainers:0,pendingOffers:0,pendingSchools:0,contractsToCountersign:0,hiddenApprovedTrainers:0,pendingNDARequests:0,loading:!0});return w.useEffect(()=>{(async()=>{try{const[n,a,i,o,l,c]=await Promise.all([he.from("trainer_profiles").select("id",{count:"exact",head:!0}).eq("status","pending"),he.from("school_requests").select("id",{count:"exact",head:!0}).eq("status","pending"),he.from("school_profiles").select("id",{count:"exact",head:!0}).eq("is_verified",!1),he.from("trainer_contracts").select("id",{count:"exact",head:!0}).eq("status","signed").eq("counter_signed",!1),he.from("trainer_profiles").select("id",{count:"exact",head:!0}).eq("status","approved").eq("is_visible",!1),he.from("nda_assistance_requests").select("id",{count:"exact",head:!0}).eq("status","pending")]);t({pendingTrainers:n.count||0,pendingOffers:a.count||0,pendingSchools:i.count||0,contractsToCountersign:o.count||0,hiddenApprovedTrainers:l.count||0,pendingNDARequests:c.count||0,loading:!1})}catch(n){console.error("Error loading pending actions:",n),t(a=>({...a,loading:!1}))}})()},[]),e}function Yr({className:e,...t}){return s.jsx("div",{className:pt("animate-pulse rounded-md bg-muted",e),...t})}const d6e=[{title:"Formateurs",description:"Gérer les profils, approuver les inscriptions",icon:sr,path:"/admin/trainers",color:"bg-blue-500",countKey:"pendingTrainers"},{title:"Contrats",description:"Contre-signer les contrats formateurs, voir les prestations",icon:UO,path:"/admin/contracts",color:"bg-amber-500",highlight:!0,countKey:"contractsToCountersign"},{title:"Suivi Missions",description:"Vue d'ensemble des candidatures et missions",icon:Bc,path:"/admin/missions",color:"bg-teal-500"},{title:"Invitations",description:"Inviter de nouveaux formateurs par email",icon:Fn,path:"/admin/invitations",color:"bg-purple-500"},{title:"Offres de Formation",description:"Valider et gérer les offres des écoles",icon:as,path:"/admin/training-requests",color:"bg-green-500",countKey:"pendingOffers"},{title:"Écoles",description:"Voir la liste des établissements inscrits",icon:Vr,path:"/admin/schools",color:"bg-orange-500",countKey:"pendingSchools"},{title:"Documents",description:"Vérifier et valider les documents des formateurs",icon:Qm,path:"/admin/documents",color:"bg-violet-500"},{title:"Documents Drive",description:"Tous les fichiers du Drive (factures, missions, contrats, CV…) indexés et cherchables",icon:tC,path:"/admin/drive",color:"bg-emerald-600"},{title:"Demandes NDA",description:"Aider les formateurs à obtenir leur NDA",icon:Gt,path:"/admin/nda-requests",color:"bg-lime-500",countKey:"pendingNDARequests"},{title:"Prospection LinkedIn (image)",description:"Capture d'un post → email + formateurs proposés automatiquement",icon:Fn,path:"/admin/linkedin-lead",color:"bg-sky-500"},{title:"Factures",description:"Gérer la facturation des missions avec formateurs certifiés",icon:xR,path:"/admin/invoices",color:"bg-emerald-500"},{title:"Avis Écoles",description:"Consulter les avis des formateurs sur les écoles",icon:iu,path:"/admin/school-reviews",color:"bg-yellow-500"},{title:"Blog",description:"Créer et gérer les articles du blog",icon:Gt,path:"/admin/blog",color:"bg-indigo-500"},{title:"Calendrier Éditorial",description:"Planifier la publication des articles",icon:Bs,path:"/admin/editorial-calendar",color:"bg-pink-500"},{title:"Newsletter",description:"Gérer les abonnés et les envois",icon:zo,path:"/admin/newsletter",color:"bg-cyan-500"},{title:"Emailing Formateurs",description:"Email de masse aux formateurs inscrits + liste importée (filtres ville/module)",icon:Fn,path:"/admin/trainer-mailing",color:"bg-violet-500"},{title:"Délivrabilité Emails",description:"Suivre le taux de délivrance des emails",icon:Fn,path:"/admin/email-dashboard",color:"bg-rose-500"},{title:"Messages Contact",description:"Consulter les messages du formulaire de contact",icon:zo,path:"/admin/contact-messages",color:"bg-slate-500"},{title:"Prospection",description:"Gérer les prospects écoles et entreprises",icon:Fj,path:"/admin/prospection",color:"bg-fuchsia-500"},{title:"Logs Application",description:"Consulter les journaux d'activité",icon:Gt,path:"/admin/logs",color:"bg-gray-500"},{title:"Analytics",description:"Statistiques et performances de la plateforme",icon:Hy,path:"/admin/analytics",color:"bg-red-500"}],f6e=[{title:"Glossaire",description:"Dictionnaire des termes de la formation",icon:Gt,path:"/admin/glossary",color:"bg-violet-500"},{title:"Fiches Métiers",description:"Pages métiers pour le SEO",icon:as,path:"/admin/jobs",color:"bg-sky-500"},{title:"Ressources",description:"Templates et documents téléchargeables",icon:Gt,path:"/admin/resources",color:"bg-lime-500"}];function Nb({icon:e,title:t,count:r,path:n,color:a,label:i}){return r===0?null:s.jsx(vt,{to:n,children:s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-accent transition-colors",children:[s.jsx("div",{className:`p-2 rounded-lg ${a} text-white`,children:s.jsx(e,{className:"h-4 w-4"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium text-sm",children:t}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[r," ",i||"en attente"]})]}),s.jsx(Le,{variant:"destructive",className:"text-xs",children:r})]})})}function h6e(){const{isAdmin:e,isTrainer:t}=Ur(),r=Xt(),{pendingTrainers:n,pendingOffers:a,pendingSchools:i,contractsToCountersign:o,hiddenApprovedTrainers:l,pendingNDARequests:c,loading:u}=u6e();if(!e)return r("/"),null;const d=n+a+i+o+l+c,f=m=>m?{pendingTrainers:n,pendingOffers:a,pendingSchools:i,contractsToCountersign:o,hiddenApprovedTrainers:l,pendingNDARequests:c}[m]:0;return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Administration",description:"Tableau de bord d'administration PedagoBridge",noindex:!0}),s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4 mb-8",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(vl,{className:"h-8 w-8 text-primary"}),"Administration"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Tableau de bord d'administration de la plateforme"})]}),s.jsx(c6e,{})]}),u?s.jsxs(ke,{className:"mb-8",children:[s.jsx(ht,{children:s.jsx(Yr,{className:"h-6 w-48"})}),s.jsx(Ae,{children:s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(m=>s.jsx(Yr,{className:"h-16 w-full"},m))})})]}):d>0?s.jsxs(ke,{className:"mb-8 border-destructive/50 bg-destructive/5",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsxs(xt,{className:"text-lg flex items-center gap-2",children:[s.jsx(Di,{className:"h-5 w-5 text-destructive"}),"Actions prioritaires",s.jsx(Le,{variant:"destructive",children:d})]}),s.jsx(Qr,{children:"Ces éléments nécessitent votre attention"})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsx(Nb,{icon:sr,title:"Nouveaux formateurs",count:n,path:"/admin/trainers",color:"bg-blue-500"}),s.jsx(Nb,{icon:as,title:"Nouvelles offres",count:a,path:"/admin/training-requests",color:"bg-green-500"}),s.jsx(Nb,{icon:Vr,title:"Écoles à vérifier",count:i,path:"/admin/schools",color:"bg-orange-500"}),s.jsx(Nb,{icon:UO,title:"Contrats à contre-signer",count:o,path:"/admin/contracts",color:"bg-amber-500"}),s.jsx(Nb,{icon:dR,title:"Formateurs masqués",count:l,path:"/admin/trainers",color:"bg-gray-500",label:"approuvé(s) non visible(s)"})]})})]}):s.jsx(ke,{className:"mb-8 border-green-500/50 bg-green-500/5",children:s.jsx(Ae,{className:"py-6",children:s.jsx("p",{className:"text-center text-muted-foreground",children:"✓ Aucune action prioritaire en attente"})})}),t&&s.jsxs(ke,{className:"mb-8 border-primary/50 bg-primary/5",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsxs(xt,{className:"text-lg flex items-center gap-2",children:[s.jsx(DB,{className:"h-5 w-5 text-primary"}),"Mon Profil Formateur"]}),s.jsx(Qr,{children:"Vous êtes également formateur sur la plateforme"})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsx(vt,{to:"/trainer-profile",children:s.jsx(ke,{className:"hover:shadow-md transition-all cursor-pointer group",children:s.jsxs(Ae,{className:"p-4 flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary text-primary-foreground group-hover:scale-105 transition-transform",children:s.jsx(DB,{className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium group-hover:text-primary transition-colors",children:"Gérer mon profil"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Modifier mes informations"})]})]})})}),s.jsx(vt,{to:"/trainer-applications",children:s.jsx(ke,{className:"hover:shadow-md transition-all cursor-pointer group",children:s.jsxs(Ae,{className:"p-4 flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-green-500 text-white group-hover:scale-105 transition-transform",children:s.jsx(as,{className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium group-hover:text-primary transition-colors",children:"Mes candidatures"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Suivre mes candidatures"})]})]})})}),s.jsx(vt,{to:"/trainer/contract",children:s.jsx(ke,{className:"hover:shadow-md transition-all cursor-pointer group",children:s.jsxs(Ae,{className:"p-4 flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-amber-500 text-white group-hover:scale-105 transition-transform",children:s.jsx(UO,{className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium group-hover:text-primary transition-colors",children:"Mon contrat"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Voir/signer mon contrat"})]})]})})})]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:d6e.map(m=>{const h=f(m.countKey);return s.jsx(vt,{to:m.path,children:s.jsx(ke,{className:`hover:shadow-lg transition-all cursor-pointer group h-full ${m.highlight?"ring-2 ring-amber-400":""}`,children:s.jsx(ht,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs("div",{className:`p-3 rounded-lg ${m.color} text-white group-hover:scale-105 transition-transform relative`,children:[s.jsx(m.icon,{className:"h-6 w-6"}),h>0&&s.jsx("span",{className:"absolute -top-2 -right-2 bg-destructive text-destructive-foreground text-xs font-bold rounded-full h-5 w-5 flex items-center justify-center",children:h>99?"99+":h})]}),s.jsxs("div",{className:"flex-1",children:[s.jsxs(xt,{className:"text-lg group-hover:text-primary transition-colors flex items-center gap-2",children:[m.title,s.jsx(vs,{className:"w-4 h-4 opacity-0 group-hover:opacity-50 transition-opacity"})]}),s.jsx(Qr,{className:"text-sm mt-1",children:m.description})]})]})})})},m.path)})}),s.jsxs("div",{className:"mt-12",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-2",children:[s.jsx(Hy,{className:"h-6 w-6 text-primary"}),"Pages SEO"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:f6e.map(m=>s.jsx(vt,{to:m.path,children:s.jsx(ke,{className:"hover:shadow-lg transition-all cursor-pointer group h-full",children:s.jsx(ht,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:`p-3 rounded-lg ${m.color} text-white group-hover:scale-105 transition-transform`,children:s.jsx(m.icon,{className:"h-6 w-6"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs(xt,{className:"text-lg group-hover:text-primary transition-colors flex items-center gap-2",children:[m.title,s.jsx(vs,{className:"w-4 h-4 opacity-0 group-hover:opacity-50 transition-opacity"})]}),s.jsx(Qr,{className:"text-sm mt-1",children:m.description})]})]})})})},m.path))})]})]})]})}const Sae=w.forwardRef(({...e},t)=>s.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));Sae.displayName="Breadcrumb";const kae=w.forwardRef(({className:e,...t},r)=>s.jsx("ol",{ref:r,className:pt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));kae.displayName="BreadcrumbList";const U6=w.forwardRef(({className:e,...t},r)=>s.jsx("li",{ref:r,className:pt("inline-flex items-center gap-1.5",e),...t}));U6.displayName="BreadcrumbItem";const q6=w.forwardRef(({asChild:e,className:t,...r},n)=>{const a=e?bJ:"a";return s.jsx(a,{ref:n,className:pt("transition-colors hover:text-foreground",t),...r})});q6.displayName="BreadcrumbLink";const Cae=w.forwardRef(({className:e,...t},r)=>s.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:pt("font-normal text-foreground",e),...t}));Cae.displayName="BreadcrumbPage";const Eae=({children:e,className:t,...r})=>s.jsx("li",{role:"presentation","aria-hidden":"true",className:pt("[&>svg]:size-3.5",t),...r,children:e??s.jsx(tu,{})});Eae.displayName="BreadcrumbSeparator";function sa({items:e}){return s.jsx(Sae,{className:"mb-6",children:s.jsxs(kae,{children:[s.jsx(U6,{children:s.jsx(q6,{asChild:!0,children:s.jsxs(vt,{to:"/admin",className:"flex items-center gap-2",children:[s.jsx(pR,{className:"h-4 w-4"}),"Admin"]})})}),e.map((t,r)=>s.jsxs(U6,{children:[s.jsx(Eae,{}),r===e.length-1||!t.href?s.jsx(Cae,{children:t.label}):s.jsx(q6,{asChild:!0,children:s.jsx(vt,{to:t.href,children:t.label})})]},r))]})})}function m6e(){const e=Xt(),[t,r]=w.useState(""),[n,a]=w.useState(!1),i=async o=>{if(o.preventDefault(),!t||!t.includes("@")){ae.error("Veuillez entrer une adresse email valide");return}a(!0);try{const{data:{session:l}}=await he.auth.getSession();if(!l){ae.error("Vous devez être connecté"),e("/auth");return}const{data:c,error:u}=await he.functions.invoke("send-trainer-invitation",{body:{email:t}});if(u)throw u;ae.success(`Invitation envoyée à ${t}`),r("")}catch(l){console.error("Error sending invitation:",l),ae.error(l.message||"Erreur lors de l'envoi de l'invitation")}finally{a(!1)}};return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-2xl mx-auto",children:[s.jsx(sa,{items:[{label:"Invitations"}]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{className:"text-2xl",children:"Inviter un formateur"}),s.jsx(Qr,{children:"Envoyez une invitation par email pour permettre à un formateur de créer son compte"})]}),s.jsxs(Ae,{children:[s.jsxs("form",{onSubmit:i,className:"space-y-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email",children:"Email du formateur"}),s.jsxs("div",{className:"relative",children:[s.jsx(Fn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{id:"email",type:"email",placeholder:"formateur@example.com",value:t,onChange:o=>r(o.target.value),className:"pl-10",required:!0})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"L'invitation sera valide pendant 7 jours"})]}),s.jsx(ne,{type:"submit",className:"w-full",disabled:n,children:n?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Fn,{className:"mr-2 h-4 w-4"}),"Envoyer l'invitation"]})})]}),s.jsxs("div",{className:"mt-8 p-4 bg-muted rounded-lg",children:[s.jsx("h3",{className:"font-semibold mb-2",children:"Ce qui se passe ensuite :"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-muted-foreground",children:[s.jsx("li",{children:"Le formateur reçoit un email avec un lien d'invitation"}),s.jsx("li",{children:"Il clique sur le lien et crée son compte avec un mot de passe"}),s.jsx("li",{children:"Son rôle de formateur est automatiquement attribué"}),s.jsx("li",{children:"Il peut ensuite compléter son profil et devenir visible sur le site"})]})]})]})]})]})})}function p6e(){const[e,t]=w.useState([]),[r,n]=w.useState(!0),[a,i]=w.useState(""),[o,l]=w.useState(!1),[c,u]=w.useState(null),d=async()=>{n(!0);const{data:h,error:g}=await he.functions.invoke("manage-blacklist",{body:{action:"list"}});g||h!=null&&h.error?ae.error("Impossible de charger la blacklist"):t(h.entries??[]),n(!1)};w.useEffect(()=>{d()},[]);const f=async()=>{const h=a.trim().toLowerCase();if(!h)return;l(!0);const{data:g,error:p}=await he.functions.invoke("manage-blacklist",{body:{action:"add",email:h}});if(l(!1),p||g!=null&&g.error){ae.error((g==null?void 0:g.error)||"Échec de l'ajout");return}ae.success(`${h} ne recevra plus aucun email de notre part`),i(""),d()},m=async h=>{u(h);const{data:g,error:p}=await he.functions.invoke("manage-blacklist",{body:{action:"remove",email:h}});if(u(null),p||g!=null&&g.error){ae.error((g==null?void 0:g.error)||"Échec de la suppression");return}ae.success(`${h} retiré de la blacklist`),d()};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"p-4 bg-muted/50 rounded-md text-sm text-muted-foreground",children:[s.jsx(FO,{className:"w-4 h-4 inline mr-2"}),"Les adresses listées ici ne reçoivent ",s.jsx("strong",{children:"plus aucun email"})," de la plateforme (mailings, relances, newsletters, notifications). Les formateurs supprimés y sont ajoutés automatiquement."]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{type:"email",placeholder:"adresse@exemple.com",value:a,onChange:h=>i(h.target.value),onKeyDown:h=>h.key==="Enter"&&f()}),s.jsxs(ne,{onClick:f,disabled:o||!a.trim(),children:[o?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(FO,{className:"w-4 h-4 mr-2"}),"Blacklister"]})]}),r?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(at,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):e.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune adresse blacklistée."}):s.jsx("div",{className:"divide-y border rounded-md",children:e.map(h=>s.jsxs("div",{className:"flex items-center justify-between gap-4 p-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium truncate",children:h.email}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[h.reason||"—"," · ",new Date(h.created_at).toLocaleDateString("fr-FR")]})]}),s.jsx(ne,{size:"sm",variant:"ghost",onClick:()=>m(h.email),disabled:c===h.email,children:c===h.email?s.jsx(at,{className:"w-4 h-4 animate-spin"}):s.jsx(bi,{className:"w-4 h-4"})})]},h.email))})]})}var g6e="Separator",Mz="horizontal",x6e=["horizontal","vertical"],Aae=w.forwardRef((e,t)=>{const{decorative:r,orientation:n=Mz,...a}=e,i=v6e(n)?n:Mz,l=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return s.jsx(zt.div,{"data-orientation":i,...l,...a,ref:t})});Aae.displayName=g6e;function v6e(e){return x6e.includes(e)}var Tae=Aae;const Lu=w.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>s.jsx(Tae,{ref:a,decorative:r,orientation:t,className:pt("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Lu.displayName=Tae.displayName;const y6e="trainer-documents",b6e=3600;async function w6e(e){if(e.document_path){const{data:t,error:r}=await he.storage.from(y6e).createSignedUrl(e.document_path,b6e);return r||!(t!=null&&t.signedUrl)?null:t.signedUrl}return e.document_url??null}async function RL(e){return Promise.all(e.map(async t=>({...t,viewUrl:await w6e(t)})))}async function V6(e){if(e.cv_path){const{data:t,error:r}=await he.functions.invoke("get-cv-url",{body:{trainerProfileId:e.id}});return r||!(t!=null&&t.url)?null:t.url}return e.cv_url??null}const j6e={cni:"CNI / Passeport",kbis:"Kbis / Extrait RCS",casier_judiciaire:"Casier judiciaire (B3)",diploma:"Diplôme",other:"Autre document"};function _6e({trainerId:e,trainerName:t}){const[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState("");w.useEffect(()=>{c()},[e]);const c=async()=>{try{const{data:h,error:g}=await he.from("trainer_documents").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1});if(g)throw g;n(await RL(h||[]))}catch(h){console.error("Error loading documents:",h)}finally{i(!1)}},u=async h=>{try{const{error:g}=await he.from("trainer_documents").update({status:"verified",verified_at:new Date().toISOString(),admin_comment:null}).eq("id",h);if(g)throw g;ae.success("Document vérifié"),c()}catch(g){console.error("Error verifying document:",g),ae.error("Erreur lors de la vérification")}},d=async h=>{try{const{error:g}=await he.from("trainer_documents").update({status:"rejected",admin_comment:o||"Document non conforme"}).eq("id",h);if(g)throw g;ae.success("Document rejeté"),l(""),c()}catch(g){console.error("Error rejecting document:",g),ae.error("Erreur lors du rejet")}},f=h=>{switch(h){case"verified":return s.jsxs(Le,{className:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Vérifié"]});case"rejected":return s.jsxs(Le,{className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Rejeté"]});default:return s.jsxs(Le,{className:"bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]})}},m=r.filter(h=>h.status==="pending").length;return a||r.length===0?null:s.jsxs(Hn,{children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",className:"gap-2",children:[s.jsx(Gt,{className:"w-4 h-4"}),"Documents (",r.length,")",m>0&&s.jsx(Le,{variant:"destructive",className:"ml-1",children:m})]})}),s.jsxs(qn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsx(Gn,{children:s.jsxs(Kn,{children:["Documents de ",t]})}),s.jsx("div",{className:"space-y-4 mt-4",children:r.map(h=>s.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:j6e[h.document_type]||h.document_type}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[h.document_name," • ",Ot(new Date(h.created_at),"d MMM yyyy",{locale:yr})]})]}),f(h.status)]}),h.admin_comment&&s.jsxs("p",{className:"text-sm text-red-600 flex items-center gap-1 bg-red-50 p-2 rounded",children:[s.jsx(Di,{className:"w-4 h-4"}),h.admin_comment]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("a",{href:h.viewUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline flex items-center gap-1",children:[s.jsx(vs,{className:"w-4 h-4"}),"Voir le document"]}),h.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>u(h.id),children:[s.jsx(Wr,{className:"w-4 h-4 mr-1"}),"Valider"]}),s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsxs(ne,{size:"sm",variant:"destructive",children:[s.jsx(Fs,{className:"w-4 h-4 mr-1"}),"Rejeter"]})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Rejeter ce document ?"}),s.jsx(Xc,{children:"Ajoutez un commentaire pour expliquer le rejet au formateur."})]}),s.jsx(Ye,{placeholder:"Raison du rejet (ex: Document illisible)",value:o,onChange:g=>l(g.target.value)}),s.jsxs(Kc,{children:[s.jsx(Wu,{onClick:()=>l(""),children:"Annuler"}),s.jsx(Zc,{onClick:()=>d(h.id),children:"Rejeter"})]})]})]})]})]})]},h.id))})]})]})}function Pae({country:e,className:t}){const r=(e||"").toLowerCase().trim();return!e||r==="france"||r==="fr"?null:s.jsxs(Le,{variant:"outline",className:pt("bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-950 dark:text-amber-300 dark:border-amber-800",t),children:[s.jsx(Ky,{className:"w-3 h-3 mr-1"}),e]})}const N6e={platform:{label:"Plateforme",className:"bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950 dark:text-indigo-300 dark:border-indigo-800",Icon:Rve},drive:{label:"Drive",className:"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300 dark:border-emerald-800",Icon:tC}};function Jj({source:e,className:t}){const{label:r,className:n,Icon:a}=N6e[e];return s.jsxs(Le,{variant:"outline",className:pt("text-xs",n,t),title:`Source : ${r}`,children:[s.jsx(a,{className:"w-3 h-3 mr-1"}),r]})}const S6e={facture:"Facture",contrat:"Contrat",mission:"Mission",formateur:"Formateur",ecole:"École",pedagogie:"Pédagogie",communication:"Comm.",autre:"Autre"},k6e=e=>e.replace(/[%,()*]/g," ").replace(/\s+/g," ").trim();function uy({query:e,title:t="Documents Drive",category:r,defaultOpen:n=!1}){const[a,i]=w.useState(null),[o,l]=w.useState(n);w.useEffect(()=>{if(!o)return;const u=k6e(e||"");if(u.length<3){i([]);return}let d=!1;return(async()=>{i(null);const f="id, file_name, folder_path, category, web_view_link, drive_modified_at",m=()=>{let v=he.from("drive_documents").select(f).limit(50);return r&&(v=v.eq("category",r)),v},[h,g]=await Promise.all([m().ilike("folder_path",`%${u}%`),m().ilike("file_name",`%${u}%`)]),p=new Map;for(const v of[...h.data||[],...g.data||[]])p.set(v.id,v);const x=Array.from(p.values()).sort((v,b)=>(b.drive_modified_at||"").localeCompare(v.drive_modified_at||""));d||i(x)})(),()=>{d=!0}},[e,r,o]);const c=(a==null?void 0:a.length)??0;return s.jsxs("div",{className:"border rounded-lg",children:[s.jsxs("button",{type:"button",onClick:()=>l(u=>!u),className:"w-full flex items-center justify-between px-3 py-2 text-sm font-medium hover:bg-muted/40 rounded-lg transition-colors",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Jj,{source:"drive"}),t,a&&s.jsx(Le,{variant:"secondary",className:"text-xs",children:c})]}),s.jsx(bh,{className:`w-4 h-4 transition-transform ${o?"rotate-180":""}`})]}),o&&s.jsx("div",{className:"px-3 pb-3 space-y-1",children:a===null?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-2",children:[s.jsx(at,{className:"w-4 h-4 animate-spin"})," Recherche dans le Drive…"]}):c===0?s.jsxs("p",{className:"text-xs text-muted-foreground py-2",children:["Aucun document Drive trouvé pour « ",e," »."]}):a.map(u=>s.jsxs("a",{href:u.web_view_link||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm hover:bg-muted/50 rounded px-2 py-1.5 group",title:u.folder_path?`${u.folder_path}/${u.file_name}`:u.file_name,children:[s.jsx(Gt,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:"truncate flex-1",children:u.file_name}),s.jsx(Le,{variant:"outline",className:"text-[10px] shrink-0",children:S6e[u.category]||u.category}),s.jsx(vs,{className:"w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 shrink-0"})]},u.id))})]})}const nT=[{id:"cv_missing",label:"Demander le CV",icon:Gt,subject:"Veuillez ajouter votre CV",message:`Nous avons remarqué que votre CV n'est pas encore disponible sur votre profil.
Pour maximiser vos chances d'être sélectionné par les établissements, merci de téléverser votre CV depuis votre espace formateur.
Votre CV nous permet de mieux comprendre votre parcours et de vous recommander aux écoles les plus adaptées à votre profil.`},{id:"profile_incomplete",label:"Profil incomplet",icon:wve,subject:"Complétez votre profil formateur",message:`Votre profil formateur n'est pas encore complet.
Pour recevoir des propositions de missions pertinentes, merci de compléter les informations suivantes :
- Votre biographie professionnelle
- Vos spécialités et compétences
- Vos préférences d'intervention (modalité, départements)
Un profil complet augmente significativement votre visibilité auprès des établissements.`},{id:"legal_info_missing",label:"Infos légales manquantes",icon:Wve,subject:"Informations légales requises",message:`Pour pouvoir établir un contrat de partenariat, nous avons besoin de vos informations légales complètes.
Merci de renseigner dans votre profil :
- Forme juridique de votre structure
- Numéro SIRET
- Adresse du siège social
- Nom et fonction du représentant légal
Ces informations sont nécessaires pour la conformité réglementaire et Qualiopi.`},{id:"documents_required",label:"Documents requis",icon:ZJ,subject:"Documents requis pour votre certification",message:`Pour valider votre certification PedagoBridge, nous avons besoin des documents suivants :
- Copie de votre pièce d'identité
- Extrait Kbis ou équivalent (moins de 3 mois)
- Casier judiciaire B3 (moins de 3 mois)
Vous pouvez téléverser ces documents depuis la section 'Documents' de votre espace formateur.`},{id:"photo_missing",label:"Demander une photo de profil",icon:BO,subject:"Ajoutez une photo de profil",message:`Nous avons remarqué que votre profil formateur ne comporte pas encore de photo.
La photo de profil est l'un des premiers éléments que les établissements voient : un profil avec un portrait professionnel inspire confiance et augmente nettement vos chances d'être contacté.
Merci d'ajouter une photo depuis votre espace formateur :
- Un portrait professionnel récent
- Un fond neutre et une bonne luminosité
- Un cadrage type CV (visage et épaules)
- Une résolution d'au moins 400x400 pixels`},{id:"photo_quality",label:"Photo de mauvaise qualité",icon:Ove,subject:"Améliorer votre photo de profil",message:`Nous avons remarqué que votre photo de profil actuelle ne met pas suffisamment en valeur votre image professionnelle.
Pour optimiser votre visibilité auprès des établissements, nous vous recommandons de mettre à jour votre photo avec :
- Un portrait professionnel de bonne qualité
- Un fond neutre et une bonne luminosité
- Un cadrage type CV (visage et épaules)
- Une résolution suffisante (minimum 400x400 pixels)
Votre photo est souvent le premier élément que les recruteurs voient. Une image soignée renforce votre crédibilité et augmente vos chances d'être contacté.`}];function C6e({trainerId:e,trainerUserId:t,trainerName:r,trainerEmail:n}){const{user:a}=Ur(),[i,o]=w.useState(null),l=async c=>{const u=nT.find(d=>d.id===c);if(u){o(c);try{const{error:d}=await he.functions.invoke("send-trainer-reminder",{body:{trainerId:e,type:"custom",customSubject:u.subject,customMessage:u.message}});if(d)throw d;const{error:f}=await he.from("admin_trainer_messages").insert({trainer_id:e,trainer_user_id:t,sent_by:a==null?void 0:a.id,subject:u.subject,message:u.message,message_type:c});f&&console.error("Error saving message history:",f),ae.success(`"${u.label}" envoyé à ${r}`)}catch(d){console.error("Error sending message:",d),ae.error("Erreur lors de l'envoi du message")}finally{o(null)}}};return s.jsxs(A6,{children:[s.jsx(T6,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",disabled:i!==null,children:[i?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(zo,{className:"w-4 h-4 mr-2"}),"Envoyer message",s.jsx(bh,{className:"w-4 h-4 ml-1"})]})}),s.jsx(J5,{align:"end",className:"w-56",children:nT.map((c,u)=>{const d=c.icon;return s.jsxs("div",{children:[s.jsxs(Nc,{onClick:()=>l(c.id),disabled:i!==null,className:"cursor-pointer",children:[s.jsx(d,{className:"w-4 h-4 mr-2"}),c.label]}),u<nT.length-1&&s.jsx(cL,{})]},c.id)})})]})}var E6e=[" ","Enter","ArrowUp","ArrowDown"],A6e=[" ","Enter"],fg="Select",[WC,HC,T6e]=Ij(fg),[d1]=Xa(fg,[T6e,bp]),GC=bp(),[P6e,kp]=d1(fg),[O6e,D6e]=d1(fg),Oae=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:h,form:g}=e,p=GC(t),[x,v]=w.useState(null),[b,y]=w.useState(null),[N,_]=w.useState(!1),j=Dg(u),[S,I]=Wo({prop:n,defaultProp:a??!1,onChange:i,caller:fg}),[P,F]=Wo({prop:o,defaultProp:l,onChange:c,caller:fg}),T=w.useRef(null),k=x?g||!!x.closest("form"):!0,[V,C]=w.useState(new Set),R=Array.from(V).map(H=>H.props.value).join(";");return s.jsx(lC,{...p,children:s.jsxs(P6e,{required:h,scope:t,trigger:x,onTriggerChange:v,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:N,onValueNodeHasChildrenChange:_,contentId:Ga(),value:P,onValueChange:F,open:S,onOpenChange:I,dir:j,triggerPointerDownPosRef:T,disabled:m,children:[s.jsx(WC.Provider,{scope:t,children:s.jsx(O6e,{scope:e.__scopeSelect,onNativeOptionAdd:w.useCallback(H=>{C(q=>new Set(q).add(H))},[]),onNativeOptionRemove:w.useCallback(H=>{C(q=>{const L=new Set(q);return L.delete(H),L})},[]),children:r})}),k?s.jsxs(rie,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:H=>F(H.target.value),disabled:m,form:g,children:[P===void 0?s.jsx("option",{value:""}):null,Array.from(V)]},R):null]})})};Oae.displayName=fg;var Dae="SelectTrigger",Iae=w.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,i=GC(r),o=kp(Dae,r),l=o.disabled||n,c=Cr(t,o.onTriggerChange),u=HC(r),d=w.useRef("touch"),[f,m,h]=sie(p=>{const x=u().filter(y=>!y.disabled),v=x.find(y=>y.value===o.value),b=aie(x,p,v);b!==void 0&&o.onValueChange(b.value)}),g=p=>{l||(o.onOpenChange(!0),h()),p&&(o.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return s.jsx($j,{asChild:!0,...i,children:s.jsx(zt.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":nie(o.value)?"":void 0,...a,ref:c,onClick:Ct(a.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&g(p)}),onPointerDown:Ct(a.onPointerDown,p=>{d.current=p.pointerType;const x=p.target;x.hasPointerCapture(p.pointerId)&&x.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:Ct(a.onKeyDown,p=>{const x=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(x&&p.key===" ")&&E6e.includes(p.key)&&(g(),p.preventDefault())})})})});Iae.displayName=Dae;var Rae="SelectValue",Lae=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:i,placeholder:o="",...l}=e,c=kp(Rae,r),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=Cr(t,c.onValueNodeChange);return ba(()=>{u(d)},[u,d]),s.jsx(zt.span,{...l,ref:f,style:{pointerEvents:"none"},children:nie(c.value)?s.jsx(s.Fragment,{children:o}):i})});Lae.displayName=Rae;var I6e="SelectIcon",Fae=w.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return s.jsx(zt.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});Fae.displayName=I6e;var R6e="SelectPortal",Mae=e=>s.jsx(Vy,{asChild:!0,...e});Mae.displayName=R6e;var hg="SelectContent",$ae=w.forwardRef((e,t)=>{const r=kp(hg,e.__scopeSelect),[n,a]=w.useState();if(ba(()=>{a(new DocumentFragment)},[]),!r.open){const i=n;return i?$c.createPortal(s.jsx(Bae,{scope:e.__scopeSelect,children:s.jsx(WC.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),i):null}return s.jsx(zae,{...e,ref:t})});$ae.displayName=hg;var Cu=10,[Bae,Cp]=d1(hg),L6e="SelectContentImpl",F6e=Jm("SelectContent.RemoveScroll"),zae=w.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:x,...v}=e,b=kp(hg,r),[y,N]=w.useState(null),[_,j]=w.useState(null),S=Cr(t,J=>N(J)),[I,P]=w.useState(null),[F,T]=w.useState(null),k=HC(r),[V,C]=w.useState(!1),R=w.useRef(!1);w.useEffect(()=>{if(y)return yC(y)},[y]),xC();const H=w.useCallback(J=>{const[se,...ee]=k().map(te=>te.ref.current),[ie]=ee.slice(-1),Ee=document.activeElement;for(const te of J)if(te===Ee||(te==null||te.scrollIntoView({block:"nearest"}),te===se&&_&&(_.scrollTop=0),te===ie&&_&&(_.scrollTop=_.scrollHeight),te==null||te.focus(),document.activeElement!==Ee))return},[k,_]),q=w.useCallback(()=>H([I,y]),[H,I,y]);w.useEffect(()=>{V&&q()},[V,q]);const{onOpenChange:L,triggerPointerDownPosRef:M}=b;w.useEffect(()=>{if(y){let J={x:0,y:0};const se=ie=>{var Ee,te;J={x:Math.abs(Math.round(ie.pageX)-(((Ee=M.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ie.pageY)-(((te=M.current)==null?void 0:te.y)??0))}},ee=ie=>{J.x<=10&&J.y<=10?ie.preventDefault():y.contains(ie.target)||L(!1),document.removeEventListener("pointermove",se),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",ee,{capture:!0})}}},[y,L,M]),w.useEffect(()=>{const J=()=>L(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[L]);const[z,K]=sie(J=>{const se=k().filter(Ee=>!Ee.disabled),ee=se.find(Ee=>Ee.ref.current===document.activeElement),ie=aie(se,J,ee);ie&&setTimeout(()=>ie.ref.current.focus())}),E=w.useCallback((J,se,ee)=>{const ie=!R.current&&!ee;(b.value!==void 0&&b.value===se||ie)&&(P(J),ie&&(R.current=!0))},[b.value]),A=w.useCallback(()=>y==null?void 0:y.focus(),[y]),O=w.useCallback((J,se,ee)=>{const ie=!R.current&&!ee;(b.value!==void 0&&b.value===se||ie)&&T(J)},[b.value]),U=n==="popper"?W6:Uae,Y=U===W6?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:x}:{};return s.jsx(Bae,{scope:r,content:y,viewport:_,onViewportChange:j,itemRefCallback:E,selectedItem:I,onItemLeave:A,itemTextRefCallback:O,focusSelectedItem:q,selectedItemText:F,position:n,isPositioned:V,searchRef:z,children:s.jsx(qj,{as:F6e,allowPinchZoom:!0,children:s.jsx(Uj,{asChild:!0,trapped:b.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:Ct(a,J=>{var se;(se=b.trigger)==null||se.focus({preventScroll:!0}),J.preventDefault()}),children:s.jsx(Pg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:s.jsx(U,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:J=>J.preventDefault(),...v,...Y,onPlaced:()=>C(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Ct(v.onKeyDown,J=>{const se=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!se&&J.key.length===1&&K(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let ie=k().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(J.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const Ee=J.target,te=ie.indexOf(Ee);ie=ie.slice(te+1)}setTimeout(()=>H(ie)),J.preventDefault()}})})})})})})});zae.displayName=L6e;var M6e="SelectItemAlignedPosition",Uae=w.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,i=kp(hg,r),o=Cp(hg,r),[l,c]=w.useState(null),[u,d]=w.useState(null),f=Cr(t,S=>d(S)),m=HC(r),h=w.useRef(!1),g=w.useRef(!0),{viewport:p,selectedItem:x,selectedItemText:v,focusSelectedItem:b}=o,y=w.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&p&&x&&v){const S=i.trigger.getBoundingClientRect(),I=u.getBoundingClientRect(),P=i.valueNode.getBoundingClientRect(),F=v.getBoundingClientRect();if(i.dir!=="rtl"){const Ee=F.left-I.left,te=P.left-Ee,Ue=S.left-te,W=S.width+Ue,Z=Math.max(W,I.width),le=window.innerWidth-Cu,re=P6(te,[Cu,Math.max(Cu,le-Z)]);l.style.minWidth=W+"px",l.style.left=re+"px"}else{const Ee=I.right-F.right,te=window.innerWidth-P.right-Ee,Ue=window.innerWidth-S.right-te,W=S.width+Ue,Z=Math.max(W,I.width),le=window.innerWidth-Cu,re=P6(te,[Cu,Math.max(Cu,le-Z)]);l.style.minWidth=W+"px",l.style.right=re+"px"}const T=m(),k=window.innerHeight-Cu*2,V=p.scrollHeight,C=window.getComputedStyle(u),R=parseInt(C.borderTopWidth,10),H=parseInt(C.paddingTop,10),q=parseInt(C.borderBottomWidth,10),L=parseInt(C.paddingBottom,10),M=R+H+V+L+q,z=Math.min(x.offsetHeight*5,M),K=window.getComputedStyle(p),E=parseInt(K.paddingTop,10),A=parseInt(K.paddingBottom,10),O=S.top+S.height/2-Cu,U=k-O,Y=x.offsetHeight/2,J=x.offsetTop+Y,se=R+H+J,ee=M-se;if(se<=O){const Ee=T.length>0&&x===T[T.length-1].ref.current;l.style.bottom="0px";const te=u.clientHeight-p.offsetTop-p.offsetHeight,Ue=Math.max(U,Y+(Ee?A:0)+te+q),W=se+Ue;l.style.height=W+"px"}else{const Ee=T.length>0&&x===T[0].ref.current;l.style.top="0px";const Ue=Math.max(O,R+p.offsetTop+(Ee?E:0)+Y)+ee;l.style.height=Ue+"px",p.scrollTop=se-O+p.offsetTop}l.style.margin=`${Cu}px 0`,l.style.minHeight=z+"px",l.style.maxHeight=k+"px",n==null||n(),requestAnimationFrame(()=>h.current=!0)}},[m,i.trigger,i.valueNode,l,u,p,x,v,i.dir,n]);ba(()=>y(),[y]);const[N,_]=w.useState();ba(()=>{u&&_(window.getComputedStyle(u).zIndex)},[u]);const j=w.useCallback(S=>{S&&g.current===!0&&(y(),b==null||b(),g.current=!1)},[y,b]);return s.jsx(B6e,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:s.jsx(zt.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});Uae.displayName=M6e;var $6e="SelectPopperPosition",W6=w.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=Cu,...i}=e,o=GC(r);return s.jsx(cC,{...o,...i,ref:t,align:n,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)"}})});W6.displayName=$6e;var[B6e,LL]=d1(hg,{}),H6="SelectViewport",qae=w.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,i=Cp(H6,r),o=LL(H6,r),l=Cr(t,i.onViewportChange),c=w.useRef(0);return s.jsxs(s.Fragment,{children:[s.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:n}),s.jsx(WC.Slot,{scope:r,children:s.jsx(zt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Ct(a.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&f){const h=Math.abs(c.current-d.scrollTop);if(h>0){const g=window.innerHeight-Cu*2,p=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),v=Math.max(p,x);if(v<g){const b=v+h,y=Math.min(g,b),N=b-y;f.style.height=y+"px",f.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});qae.displayName=H6;var Vae="SelectGroup",[z6e,U6e]=d1(Vae),q6e=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=Ga();return s.jsx(z6e,{scope:r,id:a,children:s.jsx(zt.div,{role:"group","aria-labelledby":a,...n,ref:t})})});q6e.displayName=Vae;var Wae="SelectLabel",Hae=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=U6e(Wae,r);return s.jsx(zt.div,{id:a.id,...n,ref:t})});Hae.displayName=Wae;var i4="SelectItem",[V6e,Gae]=d1(i4),Kae=w.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...o}=e,l=kp(i4,r),c=Cp(i4,r),u=l.value===n,[d,f]=w.useState(i??""),[m,h]=w.useState(!1),g=Cr(t,b=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,b,n,a)}),p=Ga(),x=w.useRef("touch"),v=()=>{a||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")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 s.jsx(V6e,{scope:r,value:n,disabled:a,textId:p,isSelected:u,onItemTextChange:w.useCallback(b=>{f(y=>y||((b==null?void 0:b.textContent)??"").trim())},[]),children:s.jsx(WC.ItemSlot,{scope:r,value:n,disabled:a,textValue:d,children:s.jsx(zt.div,{role:"option","aria-labelledby":p,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:g,onFocus:Ct(o.onFocus,()=>h(!0)),onBlur:Ct(o.onBlur,()=>h(!1)),onClick:Ct(o.onClick,()=>{x.current!=="mouse"&&v()}),onPointerUp:Ct(o.onPointerUp,()=>{x.current==="mouse"&&v()}),onPointerDown:Ct(o.onPointerDown,b=>{x.current=b.pointerType}),onPointerMove:Ct(o.onPointerMove,b=>{var y;x.current=b.pointerType,a?(y=c.onItemLeave)==null||y.call(c):x.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ct(o.onPointerLeave,b=>{var y;b.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:Ct(o.onKeyDown,b=>{var N;((N=c.searchRef)==null?void 0:N.current)!==""&&b.key===" "||(A6e.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});Kae.displayName=i4;var Kb="SelectItemText",Yae=w.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...i}=e,o=kp(Kb,r),l=Cp(Kb,r),c=Gae(Kb,r),u=D6e(Kb,r),[d,f]=w.useState(null),m=Cr(t,v=>f(v),c.onItemTextChange,v=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,v,c.value,c.disabled)}),h=d==null?void 0:d.textContent,g=w.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:x}=u;return ba(()=>(p(g),()=>x(g)),[p,x,g]),s.jsxs(s.Fragment,{children:[s.jsx(zt.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?$c.createPortal(i.children,o.valueNode):null]})});Yae.displayName=Kb;var Xae="SelectItemIndicator",Zae=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return Gae(Xae,r).isSelected?s.jsx(zt.span,{"aria-hidden":!0,...n,ref:t}):null});Zae.displayName=Xae;var G6="SelectScrollUpButton",Jae=w.forwardRef((e,t)=>{const r=Cp(G6,e.__scopeSelect),n=LL(G6,e.__scopeSelect),[a,i]=w.useState(!1),o=Cr(t,n.onScrollButtonChange);return ba(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?s.jsx(eie,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Jae.displayName=G6;var K6="SelectScrollDownButton",Qae=w.forwardRef((e,t)=>{const r=Cp(K6,e.__scopeSelect),n=LL(K6,e.__scopeSelect),[a,i]=w.useState(!1),o=Cr(t,n.onScrollButtonChange);return ba(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?s.jsx(eie,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Qae.displayName=K6;var eie=w.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,i=Cp("SelectScrollButton",r),o=w.useRef(null),l=HC(r),c=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>c(),[c]),ba(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),s.jsx(zt.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Ct(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(n,50))}),onPointerMove:Ct(a.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(n,50))}),onPointerLeave:Ct(a.onPointerLeave,()=>{c()})})}),W6e="SelectSeparator",tie=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return s.jsx(zt.div,{"aria-hidden":!0,...n,ref:t})});tie.displayName=W6e;var Y6="SelectArrow",H6e=w.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=GC(r),i=kp(Y6,r),o=Cp(Y6,r);return i.open&&o.position==="popper"?s.jsx(uC,{...a,...n,ref:t}):null});H6e.displayName=Y6;var G6e="SelectBubbleInput",rie=w.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=w.useRef(null),i=Cr(n,a),o=RC(t);return w.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[o,t]),s.jsx(zt.select,{...r,style:{...kJ,...r.style},ref:i,defaultValue:t})});rie.displayName=G6e;function nie(e){return e===""||e===void 0}function sie(e){const t=ha(e),r=w.useRef(""),n=w.useRef(0),a=w.useCallback(o=>{const l=r.current+o;t(l),function c(u){r.current=u,window.clearTimeout(n.current),u!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=w.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,i]}function aie(e,t,r){const a=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=r?e.indexOf(r):-1;let o=K6e(e,Math.max(i,0));a.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.textValue.toLowerCase().startsWith(a.toLowerCase()));return c!==r?c:void 0}function K6e(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Y6e=Oae,iie=Iae,X6e=Lae,Z6e=Fae,J6e=Mae,oie=$ae,Q6e=qae,lie=Hae,cie=Kae,e8e=Yae,t8e=Zae,uie=Jae,die=Qae,fie=tie;const Lr=Y6e,Br=X6e,Ar=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(iie,{ref:n,className:pt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-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),...r,children:[t,s.jsx(Z6e,{asChild:!0,children:s.jsx(bh,{className:"h-4 w-4 opacity-50"})})]}));Ar.displayName=iie.displayName;const hie=w.forwardRef(({className:e,...t},r)=>s.jsx(uie,{ref:r,className:pt("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(YJ,{className:"h-4 w-4"})}));hie.displayName=uie.displayName;const mie=w.forwardRef(({className:e,...t},r)=>s.jsx(die,{ref:r,className:pt("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(bh,{className:"h-4 w-4"})}));mie.displayName=die.displayName;const Tr=w.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>s.jsx(J6e,{children:s.jsxs(oie,{ref:a,className:pt("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",r==="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:r,...n,children:[s.jsx(hie,{}),s.jsx(Q6e,{className:pt("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(mie,{})]})}));Tr.displayName=oie.displayName;const r8e=w.forwardRef(({className:e,...t},r)=>s.jsx(lie,{ref:r,className:pt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));r8e.displayName=lie.displayName;const ot=w.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(cie,{ref:n,className:pt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...r,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(t8e,{children:s.jsx(Pn,{className:"h-4 w-4"})})}),s.jsx(e8e,{children:t})]}));ot.displayName=cie.displayName;const n8e=w.forwardRef(({className:e,...t},r)=>s.jsx(fie,{ref:r,className:pt("-mx-1 my-1 h-px bg-muted",e),...t}));n8e.displayName=fie.displayName;var KC="Switch",[s8e]=Xa(KC),[a8e,i8e]=s8e(KC),pie=w.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[m,h]=w.useState(null),g=Cr(t,y=>h(y)),p=w.useRef(!1),x=m?d||!!m.closest("form"):!0,[v,b]=Wo({prop:a,defaultProp:i??!1,onChange:u,caller:KC});return s.jsxs(a8e,{scope:r,checked:v,disabled:l,children:[s.jsx(zt.button,{type:"button",role:"switch","aria-checked":v,"aria-required":o,"data-state":yie(v),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onClick:Ct(e.onClick,y=>{b(N=>!N),x&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})}),x&&s.jsx(vie,{control:m,bubbles:!p.current,name:n,value:c,checked:v,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});pie.displayName=KC;var gie="SwitchThumb",xie=w.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=i8e(gie,r);return s.jsx(zt.span,{"data-state":yie(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});xie.displayName=gie;var o8e="SwitchBubbleInput",vie=w.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const o=w.useRef(null),l=Cr(o,i),c=RC(r),u=oC(t);return w.useEffect(()=>{const d=o.current;if(!d)return;const f=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&h){const g=new Event("click",{bubbles:n});h.call(d,r),d.dispatchEvent(g)}},[c,r,n]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});vie.displayName=o8e;function yie(e){return e?"checked":"unchecked"}var bie=pie,l8e=xie;const dy=w.forwardRef(({className:e,...t},r)=>s.jsx(bie,{className:pt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input 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",e),...t,ref:r,children:s.jsx(l8e,{className:pt("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")})}));dy.displayName=bie.displayName;const FL=[{code:"01",name:"Ain"},{code:"02",name:"Aisne"},{code:"03",name:"Allier"},{code:"04",name:"Alpes-de-Haute-Provence"},{code:"05",name:"Hautes-Alpes"},{code:"06",name:"Alpes-Maritimes"},{code:"07",name:"Ardèche"},{code:"08",name:"Ardennes"},{code:"09",name:"Ariège"},{code:"10",name:"Aube"},{code:"11",name:"Aude"},{code:"12",name:"Aveyron"},{code:"13",name:"Bouches-du-Rhône"},{code:"14",name:"Calvados"},{code:"15",name:"Cantal"},{code:"16",name:"Charente"},{code:"17",name:"Charente-Maritime"},{code:"18",name:"Cher"},{code:"19",name:"Corrèze"},{code:"2A",name:"Corse-du-Sud"},{code:"2B",name:"Haute-Corse"},{code:"21",name:"Côte-d'Or"},{code:"22",name:"Côtes-d'Armor"},{code:"23",name:"Creuse"},{code:"24",name:"Dordogne"},{code:"25",name:"Doubs"},{code:"26",name:"Drôme"},{code:"27",name:"Eure"},{code:"28",name:"Eure-et-Loir"},{code:"29",name:"Finistère"},{code:"30",name:"Gard"},{code:"31",name:"Haute-Garonne"},{code:"32",name:"Gers"},{code:"33",name:"Gironde"},{code:"34",name:"Hérault"},{code:"35",name:"Ille-et-Vilaine"},{code:"36",name:"Indre"},{code:"37",name:"Indre-et-Loire"},{code:"38",name:"Isère"},{code:"39",name:"Jura"},{code:"40",name:"Landes"},{code:"41",name:"Loir-et-Cher"},{code:"42",name:"Loire"},{code:"43",name:"Haute-Loire"},{code:"44",name:"Loire-Atlantique"},{code:"45",name:"Loiret"},{code:"46",name:"Lot"},{code:"47",name:"Lot-et-Garonne"},{code:"48",name:"Lozère"},{code:"49",name:"Maine-et-Loire"},{code:"50",name:"Manche"},{code:"51",name:"Marne"},{code:"52",name:"Haute-Marne"},{code:"53",name:"Mayenne"},{code:"54",name:"Meurthe-et-Moselle"},{code:"55",name:"Meuse"},{code:"56",name:"Morbihan"},{code:"57",name:"Moselle"},{code:"58",name:"Nièvre"},{code:"59",name:"Nord"},{code:"60",name:"Oise"},{code:"61",name:"Orne"},{code:"62",name:"Pas-de-Calais"},{code:"63",name:"Puy-de-Dôme"},{code:"64",name:"Pyrénées-Atlantiques"},{code:"65",name:"Hautes-Pyrénées"},{code:"66",name:"Pyrénées-Orientales"},{code:"67",name:"Bas-Rhin"},{code:"68",name:"Haut-Rhin"},{code:"69",name:"Rhône"},{code:"70",name:"Haute-Saône"},{code:"71",name:"Saône-et-Loire"},{code:"72",name:"Sarthe"},{code:"73",name:"Savoie"},{code:"74",name:"Haute-Savoie"},{code:"75",name:"Paris"},{code:"76",name:"Seine-Maritime"},{code:"77",name:"Seine-et-Marne"},{code:"78",name:"Yvelines"},{code:"79",name:"Deux-Sèvres"},{code:"80",name:"Somme"},{code:"81",name:"Tarn"},{code:"82",name:"Tarn-et-Garonne"},{code:"83",name:"Var"},{code:"84",name:"Vaucluse"},{code:"85",name:"Vendée"},{code:"86",name:"Vienne"},{code:"87",name:"Haute-Vienne"},{code:"88",name:"Vosges"},{code:"89",name:"Yonne"},{code:"90",name:"Territoire de Belfort"},{code:"91",name:"Essonne"},{code:"92",name:"Hauts-de-Seine"},{code:"93",name:"Seine-Saint-Denis"},{code:"94",name:"Val-de-Marne"},{code:"95",name:"Val-d'Oise"},{code:"971",name:"Guadeloupe"},{code:"972",name:"Martinique"},{code:"973",name:"Guyane"},{code:"974",name:"La Réunion"},{code:"976",name:"Mayotte"},{code:"ETR",name:"🌍 Étranger"}],c8e=["Allemagne","Belgique","Suisse","Luxembourg","Espagne","Italie","Portugal","Royaume-Uni","Pays-Bas","Autriche","Pologne","Irlande","Canada","États-Unis","Maroc","Algérie","Tunisie","Sénégal","Côte d'Ivoire","Cameroun","Maurice","Madagascar","Vietnam","Chine","Japon","Inde","Brésil","Mexique","Autre"],u8e={75:"Paris",92:"Paris",93:"Paris",94:"Paris",91:"Paris",77:"Paris",78:"Paris",95:"Paris",13:"Marseille",69:"Lyon",31:"Toulouse","06":"Nice",44:"Nantes",34:"Montpellier",33:"Bordeaux",59:"Lille",67:"Strasbourg",35:"Rennes",38:"Grenoble",76:"Rouen",51:"Reims",63:"Clermont-Ferrand",37:"Tours",45:"Orléans",21:"Dijon",14:"Caen",62:"Pas-de-Calais",83:"Toulon",30:"Nîmes",84:"Avignon",64:"Bayonne",57:"Metz",54:"Nancy",68:"Mulhouse",49:"Angers",72:"Le Mans",29:"Brest",56:"Lorient",42:"Saint-Étienne",974:"La Réunion",971:"Guadeloupe",972:"Martinique",973:"Guyane",976:"Mayotte"},d8e={75:"Île-de-France",77:"Île-de-France",78:"Île-de-France",91:"Île-de-France",92:"Île-de-France",93:"Île-de-France",94:"Île-de-France",95:"Île-de-France","01":"Auvergne-Rhône-Alpes","03":"Auvergne-Rhône-Alpes","07":"Auvergne-Rhône-Alpes",15:"Auvergne-Rhône-Alpes",26:"Auvergne-Rhône-Alpes",38:"Auvergne-Rhône-Alpes",42:"Auvergne-Rhône-Alpes",43:"Auvergne-Rhône-Alpes",63:"Auvergne-Rhône-Alpes",69:"Auvergne-Rhône-Alpes",73:"Auvergne-Rhône-Alpes",74:"Auvergne-Rhône-Alpes","04":"PACA","05":"PACA","06":"PACA",13:"PACA",83:"PACA",84:"PACA","09":"Occitanie",11:"Occitanie",12:"Occitanie",30:"Occitanie",31:"Occitanie",32:"Occitanie",34:"Occitanie",46:"Occitanie",48:"Occitanie",65:"Occitanie",66:"Occitanie",81:"Occitanie",82:"Occitanie",16:"Nouvelle-Aquitaine",17:"Nouvelle-Aquitaine",19:"Nouvelle-Aquitaine",23:"Nouvelle-Aquitaine",24:"Nouvelle-Aquitaine",33:"Nouvelle-Aquitaine",40:"Nouvelle-Aquitaine",47:"Nouvelle-Aquitaine",64:"Nouvelle-Aquitaine",79:"Nouvelle-Aquitaine",86:"Nouvelle-Aquitaine",87:"Nouvelle-Aquitaine","02":"Hauts-de-France",59:"Hauts-de-France",60:"Hauts-de-France",62:"Hauts-de-France",80:"Hauts-de-France","08":"Grand Est",10:"Grand Est",51:"Grand Est",52:"Grand Est",54:"Grand Est",55:"Grand Est",57:"Grand Est",67:"Grand Est",68:"Grand Est",88:"Grand Est",44:"Pays de la Loire",49:"Pays de la Loire",53:"Pays de la Loire",72:"Pays de la Loire",85:"Pays de la Loire",22:"Bretagne",29:"Bretagne",35:"Bretagne",56:"Bretagne",14:"Normandie",27:"Normandie",50:"Normandie",61:"Normandie",76:"Normandie",18:"Centre-Val de Loire",28:"Centre-Val de Loire",36:"Centre-Val de Loire",37:"Centre-Val de Loire",41:"Centre-Val de Loire",45:"Centre-Val de Loire",21:"Bourgogne-Franche-Comté",25:"Bourgogne-Franche-Comté",39:"Bourgogne-Franche-Comté",58:"Bourgogne-Franche-Comté",70:"Bourgogne-Franche-Comté",71:"Bourgogne-Franche-Comté",89:"Bourgogne-Franche-Comté",90:"Bourgogne-Franche-Comté","2A":"Corse","2B":"Corse",971:"Outre-mer",972:"Outre-mer",973:"Outre-mer",974:"Outre-mer",976:"Outre-mer"},tv=e=>{if(e.startsWith("ETR:"))return`🌍 ${e.substring(4)}`;const t=FL.find(r=>r.code===e);return t?`${t.code} - ${t.name}`:e},wie=e=>e==="ETR"||e.startsWith("ETR:"),f8e=e=>wie(e)?null:u8e[e]||null,X6=e=>{const t=new Set;return e.forEach(r=>{const n=f8e(r);n&&t.add(n)}),Array.from(t)},jie=(e,t=3)=>{const r=new Set;return e.forEach(n=>{if(!wie(n)){const a=d8e[n];a&&r.add(a)}}),r.size>=t},$z=[{value:"cni",label:"CNI / Passeport"},{value:"titre_sejour",label:"Titre de séjour / Récépissé"},{value:"kbis",label:"Kbis / Extrait RCS"},{value:"casier_judiciaire",label:"Casier judiciaire (B3)"},{value:"nda_proof",label:"Attestation NDA"},{value:"rib",label:"RIB"},{value:"carte_vitale",label:"Carte vitale"},{value:"attestation_fiscale",label:"Attestation fiscale"},{value:"insurance",label:"Assurance RC Pro"},{value:"diploma",label:"Diplôme"},{value:"contrat_signe",label:"Contrat signé"},{value:"other",label:"Autre document"}];function h8e({trainerId:e,trainerUserId:t}){const[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState(!1),[c,u]=w.useState(""),[d,f]=w.useState(null),m=w.useRef(null);w.useEffect(()=>{h()},[e]);const h=async()=>{try{const{data:y,error:N}=await he.from("trainer_documents").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1});if(N)throw N;n(await RL(y||[]))}catch(y){console.error("Error loading documents:",y)}finally{i(!1)}},g=y=>{var _;const N=(_=y.target.files)==null?void 0:_[0];if(N){if(N.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}f(N)}},p=async()=>{if(!d||!c){ae.error("Veuillez sélectionner un type et un fichier");return}l(!0);try{const y=d.name.split(".").pop()||"pdf",N=`${t}/documents/${c}-${Date.now()}.${y}`;console.log("[AdminTrainerDocuments] Uploading to path:",N);const{error:_}=await he.storage.from("trainer-documents").upload(N,d);if(_){console.error("[AdminTrainerDocuments] Storage upload error:",_),ae.error(`Erreur storage: ${_.message}`),l(!1);return}const{error:j}=await he.from("trainer_documents").insert({trainer_profile_id:e,document_type:c,document_name:d.name,document_path:N,status:"verified"});if(j){console.error("[AdminTrainerDocuments] DB insert error:",j),ae.error(`Erreur base de données: ${j.message}`),l(!1);return}ae.success("Document ajouté avec succès"),f(null),u(""),m.current&&(m.current.value=""),h()}catch(y){console.error("[AdminTrainerDocuments] Unexpected error:",y);const N=y instanceof Error?y.message:"Erreur inconnue";ae.error(`Erreur: ${N}`)}finally{l(!1)}},x=async y=>{try{const{error:N}=await he.from("trainer_documents").delete().eq("id",y);if(N)throw N;ae.success("Document supprimé"),h()}catch(N){console.error("Error deleting document:",N),ae.error("Erreur lors de la suppression")}},v=async(y,N)=>{try{const{error:_}=await he.from("trainer_documents").update({status:N}).eq("id",y);if(_)throw _;ae.success("Statut mis à jour"),h()}catch(_){console.error("Error updating status:",_),ae.error("Erreur lors de la mise à jour")}},b=y=>{var N;return((N=$z.find(_=>_.value===y))==null?void 0:N.label)||y};return a?s.jsx("div",{className:"animate-pulse h-32 bg-muted rounded-lg"}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("h3",{className:"font-semibold text-sm text-muted-foreground flex items-center gap-2",children:[s.jsx(Gt,{className:"w-4 h-4"}),"Documents administratifs"]}),s.jsxs("div",{className:"p-3 border border-dashed rounded-lg space-y-3 bg-muted/30",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Type de document"}),s.jsxs(Lr,{value:c,onValueChange:u,children:[s.jsx(Ar,{className:"h-9",children:s.jsx(Br,{placeholder:"Sélectionner..."})}),s.jsx(Tr,{children:$z.map(y=>s.jsx(ot,{value:y.value,children:y.label},y.value))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Fichier (PDF, JPG, PNG)"}),s.jsx(Ye,{ref:m,type:"file",accept:".pdf,.jpg,.jpeg,.png",onChange:g,className:"h-9"})]})]}),d&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Fichier: ",d.name]}),s.jsx(ne,{onClick:p,disabled:!d||!c||o,size:"sm",children:o?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}),"Envoi..."]}):s.jsxs(s.Fragment,{children:[s.jsx(nc,{className:"w-4 h-4 mr-2"}),"Ajouter le document"]})})]}),r.length>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:r.map(y=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg text-sm",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[s.jsx(Gt,{className:"w-5 h-5 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium truncate",children:b(y.document_type)}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[y.document_name," • ",Ot(new Date(y.created_at),"d MMM yyyy",{locale:yr})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs(Lr,{value:y.status,onValueChange:N=>v(y.id,N),children:[s.jsx(Ar,{className:"w-[110px] h-8",children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"pending",children:"En attente"}),s.jsx(ot,{value:"verified",children:"Vérifié"}),s.jsx(ot,{value:"rejected",children:"Rejeté"})]})]}),s.jsx("a",{href:y.viewUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",title:"Voir le document",children:s.jsx(vs,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>x(y.id),children:s.jsx(bi,{className:"w-4 h-4 text-destructive"})})]})]},y.id))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucun document"})]})}function m8e({trainer:e,onUpdate:t}){var qt;const[r,n]=w.useState(!1),[a,i]=w.useState(!1),[o,l]=w.useState(!1),[c,u]=w.useState(""),[d,f]=w.useState(!1),[m,h]=w.useState(!1),[g,p]=w.useState(null),x=w.useRef(null),v=w.useRef(null),[b,y]=w.useState(e.name),[N,_]=w.useState(e.email),[j,S]=w.useState(e.bio||""),[I,P]=w.useState(e.cv_url||""),[F,T]=w.useState(e.specialties),[k,V]=w.useState(""),[C,R]=w.useState(e.status),[H,q]=w.useState(e.is_visible),[L,M]=w.useState(!!e.manual_certified),[z,K]=w.useState(e.legal_form||""),[E,A]=w.useState(((qt=e.capital_amount)==null?void 0:qt.toString())||""),[O,U]=w.useState(e.headquarters_address||""),[Y,J]=w.useState(e.legal_representative_name||""),[se,ee]=w.useState(e.legal_representative_function||""),[ie,Ee]=w.useState(e.siret||""),[te,Ue]=w.useState(e.activity_declaration_number||""),[W,Z]=w.useState(e.preferred_modality||"both"),[le,re]=w.useState(e.preferred_departments||[]),[oe,fe]=w.useState(e.country||"France"),[Fe,ge]=w.useState(e.phone||""),[pe,Ie]=w.useState(e.linkedin_url||""),[Ge,we]=w.useState(e.website_url||""),[_e,qe]=w.useState(e.english_level||""),[Re,Me]=w.useState(()=>{const it=(e.preferred_departments||[]).find(It=>It.startsWith("ETR:"));return it?it.substring(4):""}),He=async()=>{try{const{data:it}=await he.from("trainer_contracts").select("signed_contract_url").eq("trainer_id",e.id).maybeSingle();it&&p(it.signed_contract_url)}catch(it){console.error("Error loading signed contract:",it)}},st=it=>{n(it),it&&He()},Zt=async it=>{var Mt;const It=(Mt=it.target.files)==null?void 0:Mt[0];if(It){if(!It.type.includes("pdf")){ae.error("Seuls les fichiers PDF sont acceptés");return}h(!0);try{const wr=It.name.split(".").pop(),$t=`${e.user_id}/signed-contracts/contrat-signe-${Date.now()}.${wr}`,{error:kt}=await he.storage.from("trainer-files").upload($t,It,{upsert:!0});if(kt)throw kt;const{data:{publicUrl:dr}}=he.storage.from("trainer-files").getPublicUrl($t),{error:Kt}=await he.from("trainer_contracts").update({signed_contract_url:dr}).eq("trainer_id",e.id);if(Kt)throw Kt;p(dr),ae.success("Contrat signé uploadé avec succès")}catch(wr){console.error("Error uploading signed contract:",wr),ae.error("Erreur lors de l'upload du contrat signé")}finally{h(!1),v.current&&(v.current.value="")}}},_t=async it=>{var Mt;const It=(Mt=it.target.files)==null?void 0:Mt[0];if(It){if(!It.type.includes("pdf")){ae.error("Seuls les fichiers PDF sont acceptés");return}f(!0);try{const wr=It.name.split(".").pop(),$t=`${e.id}/cv-${Date.now()}.${wr}`,{error:kt}=await he.storage.from("trainer-files").upload($t,It,{upsert:!0});if(kt)throw kt;const{data:{publicUrl:dr}}=he.storage.from("trainer-files").getPublicUrl($t);P(dr),ae.success("CV uploadé avec succès")}catch(wr){console.error("Error uploading CV:",wr),ae.error("Erreur lors de l'upload du CV")}finally{f(!1),x.current&&(x.current.value="")}}},Vt=async()=>{i(!0);try{const{error:it}=await he.from("trainer_profiles").update({name:b,email:N,bio:j||null,cv_url:I||null,specialties:F,status:C,is_visible:H,manual_certified:L,legal_form:z||null,capital_amount:E?parseFloat(E):null,headquarters_address:O||null,legal_representative_name:Y||null,legal_representative_function:se||null,siret:ie||null,activity_declaration_number:te||null,preferred_modality:W,preferred_departments:le,country:oe||null,phone:Fe||null,linkedin_url:pe||null,website_url:Ge||null,english_level:_e||null}).eq("id",e.id);if(it)throw it;ae.success("Profil formateur mis à jour"),n(!1),t()}catch(it){console.error("Error updating trainer:",it),ae.error("Erreur lors de la mise à jour")}finally{i(!1)}},Jt=()=>{k.trim()&&!F.includes(k.trim())&&(T([...F,k.trim()]),V(""))},Qt=it=>{T(F.filter(It=>It!==it))};return s.jsxs(Hn,{open:r,onOpenChange:st,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(rC,{className:"h-4 w-4 mr-2"}),"Modifier"]})}),s.jsxs(qn,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Gn,{children:s.jsxs(Kn,{children:["Modifier le profil de ",e.name]})}),s.jsxs("div",{className:"space-y-6 py-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Informations de base"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"name",children:"Nom complet"}),s.jsx(Ye,{id:"name",value:b,onChange:it=>y(it.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email",children:"Email"}),s.jsx(Ye,{id:"email",type:"email",value:N,onChange:it=>_(it.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"bio",children:"Biographie"}),s.jsx(gn,{id:"bio",value:j,onChange:it=>S(it.target.value),rows:3})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"CV (PDF)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{ref:x,type:"file",accept:".pdf",onChange:_t,className:"hidden"}),s.jsx(ne,{type:"button",variant:"outline",onClick:()=>{var it;return(it=x.current)==null?void 0:it.click()},disabled:d,className:"flex-1",children:d?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}),"Upload en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(nc,{className:"h-4 w-4 mr-2"}),I?"Remplacer le CV":"Ajouter un CV"]})}),I&&s.jsxs("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-primary hover:underline",children:[s.jsx(Gt,{className:"h-4 w-4"}),"Voir",s.jsx(vs,{className:"h-3 w-3"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Niveau d'anglais"}),s.jsxs(Lr,{value:_e||"none",onValueChange:it=>qe(it==="none"?"":it),children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Non renseigné"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"none",children:"Non renseigné"}),s.jsx(ot,{value:"basic",children:"Basique"}),s.jsx(ot,{value:"intermediate",children:"Intermédiaire"}),s.jsx(ot,{value:"advanced",children:"Avancé"}),s.jsx(ot,{value:"fluent",children:"Bilingue"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Statut"}),s.jsxs(Lr,{value:C,onValueChange:R,children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"pending",children:"En attente"}),s.jsx(ot,{value:"approved",children:"Approuvé"}),s.jsx(ot,{value:"rejected",children:"Rejeté"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Visibilité publique"}),s.jsxs("div",{className:"flex items-center gap-2 h-10",children:[s.jsx(dy,{checked:H,onCheckedChange:q}),s.jsx("span",{className:"text-sm text-muted-foreground",children:H?"Visible":"Masqué"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:'Badge "Certifié PedagoBridge" (manuel)'}),s.jsxs("div",{className:"flex items-center gap-2 h-10",children:[s.jsx(dy,{checked:L,onCheckedChange:M}),s.jsx("span",{className:"text-sm text-muted-foreground",children:L?"Activé":"Désactivé"}),L&&s.jsx(Le,{className:"ml-auto",variant:"secondary",children:"Certifié PedagoBridge"})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Compétences"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:F.map(it=>s.jsxs(Le,{variant:"secondary",className:"gap-1",children:[it,s.jsx("button",{type:"button",onClick:()=>Qt(it),className:"ml-1 hover:text-destructive",children:s.jsx(Ri,{className:"h-3 w-3"})})]},it))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{placeholder:"Ajouter une compétence...",value:k,onChange:it=>V(it.target.value),onKeyDown:it=>it.key==="Enter"&&(it.preventDefault(),Jt())}),s.jsx(ne,{type:"button",variant:"outline",onClick:Jt,children:s.jsx(Ya,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Préférences d'intervention"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Modalité"}),s.jsxs(Lr,{value:W,onValueChange:Z,children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"physical",children:"Présentiel"}),s.jsx(ot,{value:"remote",children:"Distanciel"}),s.jsx(ot,{value:"both",children:"Les deux"})]})]})]}),s.jsxs("div",{className:"space-y-2 col-span-2",children:[s.jsx(We,{children:"Départements d'intervention"}),s.jsxs(rp,{open:o,onOpenChange:l,children:[s.jsx(np,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":o,className:"w-full justify-between",children:[le.length===0?"France entière":`${le.length} département(s)`,s.jsx(n2,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(fh,{className:"w-full p-0 z-[100]",align:"start",children:s.jsxs(ap,{children:[s.jsx(ip,{placeholder:"Rechercher...",value:c,onValueChange:u}),s.jsxs(op,{className:"max-h-[200px]",children:[s.jsx(lp,{children:"Aucun résultat"}),s.jsx(Jf,{children:FL.filter(it=>it.name.toLowerCase().includes(c.toLowerCase())||it.code.includes(c)).map(it=>s.jsxs(Bu,{value:`${it.code} ${it.name}`,onSelect:()=>{re(It=>It.includes(it.code)?It.filter(Mt=>Mt!==it.code):[...It,it.code])},children:[s.jsx(Pn,{className:pt("mr-2 h-4 w-4",le.includes(it.code)?"opacity-100":"opacity-0")}),it.code," - ",it.name]},it.code))})]})]})})]}),le.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[le.slice(0,5).map(it=>s.jsxs(Le,{variant:"secondary",className:"text-xs gap-1",children:[it,s.jsx("button",{type:"button",onClick:()=>re(It=>It.filter(Mt=>Mt!==it)),children:s.jsx(Ri,{className:"h-3 w-3"})})]},it)),le.length>5&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",le.length-5]})]})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"font-semibold text-sm text-muted-foreground",children:"Informations légales"}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalForm",children:"Forme juridique"}),s.jsx(Ye,{id:"legalForm",value:z,onChange:it=>K(it.target.value),placeholder:"SASU, EURL, Auto-entrepreneur..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"capitalAmount",children:"Capital social (€)"}),s.jsx(Ye,{id:"capitalAmount",type:"number",value:E,onChange:it=>A(it.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"headquartersAddress",children:"Adresse du siège social"}),s.jsx(Ye,{id:"headquartersAddress",value:O,onChange:it=>U(it.target.value)})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalRepresentativeName",children:"Représentant légal"}),s.jsx(Ye,{id:"legalRepresentativeName",value:Y,onChange:it=>J(it.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalRepresentativeFunction",children:"Fonction"}),s.jsx(Ye,{id:"legalRepresentativeFunction",value:se,onChange:it=>ee(it.target.value),placeholder:"Président, Gérant..."})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"siret",children:"SIRET"}),s.jsx(Ye,{id:"siret",value:ie,onChange:it=>Ee(it.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"activityDeclarationNumber",children:"N° déclaration d'activité"}),s.jsx(Ye,{id:"activityDeclarationNumber",value:te,onChange:it=>Ue(it.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"country",children:"Pays"}),s.jsx(Ye,{id:"country",value:oe,onChange:it=>fe(it.target.value)})]})]}),s.jsx(h8e,{trainerId:e.id,trainerUserId:e.user_id}),s.jsx(Lu,{}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("h3",{className:"font-semibold text-sm text-muted-foreground flex items-center gap-2",children:[s.jsx(zO,{className:"h-4 w-4"}),"Contrat signé"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{ref:v,type:"file",accept:".pdf",onChange:Zt,className:"hidden"}),s.jsx(ne,{type:"button",variant:"outline",onClick:()=>{var it;return(it=v.current)==null?void 0:it.click()},disabled:m,className:"flex-1",children:m?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}),"Upload en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(nc,{className:"h-4 w-4 mr-2"}),g?"Remplacer le contrat signé":"Uploader le contrat signé"]})}),g&&s.jsxs("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-primary hover:underline",children:[s.jsx(Gt,{className:"h-4 w-4"}),"Voir",s.jsx(vs,{className:"h-3 w-3"})]})]}),g&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"✓ Un contrat signé a été uploadé pour ce formateur"})]})]}),s.jsxs(Jl,{children:[s.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"Annuler"}),s.jsx(ne,{onClick:Vt,disabled:a,children:a?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}),"Enregistrement..."]}):s.jsxs(s.Fragment,{children:[s.jsx(JJ,{className:"h-4 w-4 mr-2"}),"Enregistrer"]})})]})]})]})}function KN(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _ie={exports:{}};/*!
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/(function(e,t){(function(r){e.exports=r()})(function(){return function r(n,a,i){function o(u,d){if(!a[u]){if(!n[u]){var f=typeof KN=="function"&&KN;if(!d&&f)return f(u,!0);if(l)return l(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var h=a[u]={exports:{}};n[u][0].call(h.exports,function(g){var p=n[u][1][g];return o(p||g)},h,h.exports,r,n,a,i)}return a[u].exports}for(var l=typeof KN=="function"&&KN,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(r,n,a){var i=r("./utils"),o=r("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.encode=function(c){for(var u,d,f,m,h,g,p,x=[],v=0,b=c.length,y=b,N=i.getTypeOf(c)!=="string";v<c.length;)y=b-v,f=N?(u=c[v++],d=v<b?c[v++]:0,v<b?c[v++]:0):(u=c.charCodeAt(v++),d=v<b?c.charCodeAt(v++):0,v<b?c.charCodeAt(v++):0),m=u>>2,h=(3&u)<<4|d>>4,g=1<y?(15&d)<<2|f>>6:64,p=2<y?63&f:64,x.push(l.charAt(m)+l.charAt(h)+l.charAt(g)+l.charAt(p));return x.join("")},a.decode=function(c){var u,d,f,m,h,g,p=0,x=0,v="data:";if(c.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var b,y=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&y--,c.charAt(c.length-2)===l.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=o.uint8array?new Uint8Array(0|y):new Array(0|y);p<c.length;)u=l.indexOf(c.charAt(p++))<<2|(m=l.indexOf(c.charAt(p++)))>>4,d=(15&m)<<4|(h=l.indexOf(c.charAt(p++)))>>2,f=(3&h)<<6|(g=l.indexOf(c.charAt(p++))),b[x++]=u,h!==64&&(b[x++]=d),g!==64&&(b[x++]=f);return b}},{"./support":30,"./utils":32}],2:[function(r,n,a){var i=r("./external"),o=r("./stream/DataWorker"),l=r("./stream/Crc32Probe"),c=r("./stream/DataLengthProbe");function u(d,f,m,h,g){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=h,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new o(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new o(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,m){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(f.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,a){var i=r("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},a.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,a){var i=r("./utils"),o=function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c}();n.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?function(u,d,f,m){var h=o,g=m+f;u^=-1;for(var p=m;p<g;p++)u=u>>>8^h[255&(u^d[p])];return-1^u}(0|c,l,l.length,0):function(u,d,f,m){var h=o,g=m+f;u^=-1;for(var p=m;p<g;p++)u=u>>>8^h[255&(u^d.charCodeAt(p))];return-1^u}(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(r,n,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(r,n,a){var i=null;i=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:i}},{lie:37}],7:[function(r,n,a){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=r("pako"),l=r("./utils"),c=r("./stream/GenericWorker"),u=i?"uint8array":"array";function d(f,m){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=m,this.meta={}}a.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(m){f.push({data:m,meta:f.meta})}},a.compressWorker=function(f){return new d("Deflate",f)},a.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,a){function i(h,g){var p,x="";for(p=0;p<g;p++)x+=String.fromCharCode(255&h),h>>>=8;return x}function o(h,g,p,x,v,b){var y,N,_=h.file,j=h.compression,S=b!==u.utf8encode,I=l.transformTo("string",b(_.name)),P=l.transformTo("string",u.utf8encode(_.name)),F=_.comment,T=l.transformTo("string",b(F)),k=l.transformTo("string",u.utf8encode(F)),V=P.length!==_.name.length,C=k.length!==F.length,R="",H="",q="",L=_.dir,M=_.date,z={crc32:0,compressedSize:0,uncompressedSize:0};g&&!p||(z.crc32=h.crc32,z.compressedSize=h.compressedSize,z.uncompressedSize=h.uncompressedSize);var K=0;g&&(K|=8),S||!V&&!C||(K|=2048);var E=0,A=0;L&&(E|=16),v==="UNIX"?(A=798,E|=function(U,Y){var J=U;return U||(J=Y?16893:33204),(65535&J)<<16}(_.unixPermissions,L)):(A=20,E|=function(U){return 63&(U||0)}(_.dosPermissions)),y=M.getUTCHours(),y<<=6,y|=M.getUTCMinutes(),y<<=5,y|=M.getUTCSeconds()/2,N=M.getUTCFullYear()-1980,N<<=4,N|=M.getUTCMonth()+1,N<<=5,N|=M.getUTCDate(),V&&(H=i(1,1)+i(d(I),4)+P,R+="up"+i(H.length,2)+H),C&&(q=i(1,1)+i(d(T),4)+k,R+="uc"+i(q.length,2)+q);var O="";return O+=`
\0`,O+=i(K,2),O+=j.magic,O+=i(y,2),O+=i(N,2),O+=i(z.crc32,4),O+=i(z.compressedSize,4),O+=i(z.uncompressedSize,4),O+=i(I.length,2),O+=i(R.length,2),{fileRecord:f.LOCAL_FILE_HEADER+O+I+R,dirRecord:f.CENTRAL_FILE_HEADER+i(A,2)+O+i(T.length,2)+"\0\0\0\0"+i(E,4)+i(x,4)+I+R+T}}var l=r("../utils"),c=r("../stream/GenericWorker"),u=r("../utf8"),d=r("../crc32"),f=r("../signature");function m(h,g,p,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=p,this.encodeFileName=x,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(m,c),m.prototype.push=function(h){var g=h.meta.percent||0,p=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,c.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:p?(g+100*(p-x-1))/p:100}}))},m.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var g=this.streamFiles&&!h.file.dir;if(g){var p=o(h,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(h){this.accumulate=!1;var g=this.streamFiles&&!h.file.dir,p=o(h,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),g)this.push({data:function(x){return f.DATA_DESCRIPTOR+i(x.crc32,4)+i(x.compressedSize,4)+i(x.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var h=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var p=this.bytesWritten-h,x=function(v,b,y,N,_){var j=l.transformTo("string",_(N));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(v,2)+i(v,2)+i(b,4)+i(y,4)+i(j.length,2)+j}(this.dirRecords.length,p,h,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(h){this._sources.push(h);var g=this;return h.on("data",function(p){g.processChunk(p)}),h.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),h.on("error",function(p){g.error(p)}),this},m.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},m.prototype.error=function(h){var g=this._sources;if(!c.prototype.error.call(this,h))return!1;for(var p=0;p<g.length;p++)try{g[p].error(h)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var h=this._sources,g=0;g<h.length;g++)h[g].lock()},n.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(r,n,a){var i=r("../compressions"),o=r("./ZipFileWorker");a.generateWorker=function(l,c,u){var d=new o(c.streamFiles,u,c.platform,c.encodeFileName),f=0;try{l.forEach(function(m,h){f++;var g=function(b,y){var N=b||y,_=i[N];if(!_)throw new Error(N+" is not a valid compression method !");return _}(h.options.compression,c.compression),p=h.options.compressionOptions||c.compressionOptions||{},x=h.dir,v=h.date;h._compressWorker(g,p).withStreamInfo("file",{name:m,dir:x,date:v,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(m){d.error(m)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(r,n,a){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new i;for(var l in this)typeof this[l]!="function"&&(o[l]=this[l]);return o}}(i.prototype=r("./object")).loadAsync=r("./load"),i.support=r("./support"),i.defaults=r("./defaults"),i.version="3.10.1",i.loadAsync=function(o,l){return new i().loadAsync(o,l)},i.external=r("./external"),n.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(r,n,a){var i=r("./utils"),o=r("./external"),l=r("./utf8"),c=r("./zipEntries"),u=r("./stream/Crc32Probe"),d=r("./nodejsUtils");function f(m){return new o.Promise(function(h,g){var p=m.decompressed.getContentWorker().pipe(new u);p.on("error",function(x){g(x)}).on("end",function(){p.streamInfo.crc32!==m.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}n.exports=function(m,h){var g=this;return h=i.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(m)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",m,!0,h.optimizedBinaryString,h.base64).then(function(p){var x=new c(h);return x.load(p),x}).then(function(p){var x=[o.Promise.resolve(p)],v=p.files;if(h.checkCRC32)for(var b=0;b<v.length;b++)x.push(f(v[b]));return o.Promise.all(x)}).then(function(p){for(var x=p.shift(),v=x.files,b=0;b<v.length;b++){var y=v[b],N=y.fileNameStr,_=i.resolve(y.fileNameStr);g.file(_,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:h.createFolders}),y.dir||(g.file(_).unsafeOriginalName=N)}return x.zipComment.length&&(g.comment=x.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(r,n,a){var i=r("../utils"),o=r("../stream/GenericWorker");function l(c,u){o.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(l,o),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},n.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(r,n,a){var i=r("readable-stream").Readable;function o(l,c,u){i.call(this,c),this._helper=l;var d=this;l.on("data",function(f,m){d.push(f)||d._helper.pause(),u&&u(m)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}r("../utils").inherits(o,i),o.prototype._read=function(){this._helper.resume()},n.exports=o},{"../utils":32,"readable-stream":16}],14:[function(r,n,a){n.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,o);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,o)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var o=new Buffer(i);return o.fill(0),o},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(r,n,a){function i(_,j,S){var I,P=l.getTypeOf(j),F=l.extend(S||{},d);F.date=F.date||new Date,F.compression!==null&&(F.compression=F.compression.toUpperCase()),typeof F.unixPermissions=="string"&&(F.unixPermissions=parseInt(F.unixPermissions,8)),F.unixPermissions&&16384&F.unixPermissions&&(F.dir=!0),F.dosPermissions&&16&F.dosPermissions&&(F.dir=!0),F.dir&&(_=v(_)),F.createFolders&&(I=x(_))&&b.call(this,I,!0);var T=P==="string"&&F.binary===!1&&F.base64===!1;S&&S.binary!==void 0||(F.binary=!T),(j instanceof f&&j.uncompressedSize===0||F.dir||!j||j.length===0)&&(F.base64=!1,F.binary=!0,j="",F.compression="STORE",P="string");var k=null;k=j instanceof f||j instanceof c?j:g.isNode&&g.isStream(j)?new p(_,j):l.prepareContent(_,j,F.binary,F.optimizedBinaryString,F.base64);var V=new m(_,k,F);this.files[_]=V}var o=r("./utf8"),l=r("./utils"),c=r("./stream/GenericWorker"),u=r("./stream/StreamHelper"),d=r("./defaults"),f=r("./compressedObject"),m=r("./zipObject"),h=r("./generate"),g=r("./nodejsUtils"),p=r("./nodejs/NodejsStreamInputAdapter"),x=function(_){_.slice(-1)==="/"&&(_=_.substring(0,_.length-1));var j=_.lastIndexOf("/");return 0<j?_.substring(0,j):""},v=function(_){return _.slice(-1)!=="/"&&(_+="/"),_},b=function(_,j){return j=j!==void 0?j:d.createFolders,_=v(_),this.files[_]||i.call(this,_,null,{dir:!0,createFolders:j}),this.files[_]};function y(_){return Object.prototype.toString.call(_)==="[object RegExp]"}var N={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(_){var j,S,I;for(j in this.files)I=this.files[j],(S=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&_(S,I)},filter:function(_){var j=[];return this.forEach(function(S,I){_(S,I)&&j.push(I)}),j},file:function(_,j,S){if(arguments.length!==1)return _=this.root+_,i.call(this,_,j,S),this;if(y(_)){var I=_;return this.filter(function(F,T){return!T.dir&&I.test(F)})}var P=this.files[this.root+_];return P&&!P.dir?P:null},folder:function(_){if(!_)return this;if(y(_))return this.filter(function(P,F){return F.dir&&_.test(P)});var j=this.root+_,S=b.call(this,j),I=this.clone();return I.root=S.name,I},remove:function(_){_=this.root+_;var j=this.files[_];if(j||(_.slice(-1)!=="/"&&(_+="/"),j=this.files[_]),j&&!j.dir)delete this.files[_];else for(var S=this.filter(function(P,F){return F.name.slice(0,_.length)===_}),I=0;I<S.length;I++)delete this.files[S[I].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(_){var j,S={};try{if((S=l.extend(_||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=S.type.toLowerCase(),S.compression=S.compression.toUpperCase(),S.type==="binarystring"&&(S.type="string"),!S.type)throw new Error("No output type specified.");l.checkSupport(S.type),S.platform!=="darwin"&&S.platform!=="freebsd"&&S.platform!=="linux"&&S.platform!=="sunos"||(S.platform="UNIX"),S.platform==="win32"&&(S.platform="DOS");var I=S.comment||this.comment||"";j=h.generateWorker(this,S,I)}catch(P){(j=new c("error")).error(P)}return new u(j,S.type||"string",S.mimeType)},generateAsync:function(_,j){return this.generateInternalStream(_).accumulate(j)},generateNodeStream:function(_,j){return(_=_||{}).type||(_.type="nodebuffer"),this.generateInternalStream(_).toNodejsStream(j)}};n.exports=N},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(r,n,a){n.exports=r("stream")},{stream:void 0}],17:[function(r,n,a){var i=r("./DataReader");function o(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data[this.zero+l]},o.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===c&&this.data[m+1]===u&&this.data[m+2]===d&&this.data[m+3]===f)return m-this.zero;return-1},o.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),m=this.readData(4);return c===m[0]&&u===m[1]&&d===m[2]&&f===m[3]},o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],18:[function(r,n,a){var i=r("../utils");function o(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return i.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},n.exports=o},{"../utils":32}],19:[function(r,n,a){var i=r("./Uint8ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,a){var i=r("./DataReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},o.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},o.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},o.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(r,n,a){var i=r("./ArrayReader");function o(l){i.call(this,l)}r("../utils").inherits(o,i),o.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,a){var i=r("../utils"),o=r("../support"),l=r("./ArrayReader"),c=r("./StringReader"),u=r("./NodeBufferReader"),d=r("./Uint8ArrayReader");n.exports=function(f){var m=i.getTypeOf(f);return i.checkSupport(m),m!=="string"||o.uint8array?m==="nodebuffer"?new u(f):o.uint8array?new d(i.transformTo("uint8array",f)):new l(i.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,a){var i=r("./GenericWorker"),o=r("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}o.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:o.transformTo(this.destType,c.data),meta:c.meta})},n.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,a){var i=r("./GenericWorker"),o=r("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=o(c.data,this.streamInfo.crc32||0),this.push(c)},n.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,a){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(l,o),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}o.prototype.processChunk.call(this,c)},n.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,a){var i=r("../utils"),o=r("./GenericWorker");function l(c){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(l,o),l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,a){function i(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,l){return this._listeners[o].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,l){if(this._listeners[o])for(var c=0;c<this._listeners[o].length;c++)this._listeners[o][c].call(this,l)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var l=this;return o.on("data",function(c){l.processChunk(c)}),o.on("end",function(){l.end()}),o.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,l){return this.extraStreamInfo[o]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},n.exports=i},{}],29:[function(r,n,a){var i=r("../utils"),o=r("./ConvertWorker"),l=r("./GenericWorker"),c=r("../base64"),u=r("../support"),d=r("../external"),f=null;if(u.nodestream)try{f=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function m(g,p){return new d.Promise(function(x,v){var b=[],y=g._internalType,N=g._outputType,_=g._mimeType;g.on("data",function(j,S){b.push(j),p&&p(S)}).on("error",function(j){b=[],v(j)}).on("end",function(){try{var j=function(S,I,P){switch(S){case"blob":return i.newBlob(i.transformTo("arraybuffer",I),P);case"base64":return c.encode(I);default:return i.transformTo(S,I)}}(N,function(S,I){var P,F=0,T=null,k=0;for(P=0;P<I.length;P++)k+=I[P].length;switch(S){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(T=new Uint8Array(k),P=0;P<I.length;P++)T.set(I[P],F),F+=I[P].length;return T;case"nodebuffer":return Buffer.concat(I);default:throw new Error("concat : unsupported type '"+S+"'")}}(y,b),_);x(j)}catch(S){v(S)}b=[]}).resume()})}function h(g,p,x){var v=p;switch(p){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=p,this._mimeType=x,i.checkSupport(v),this._worker=g.pipe(new o(v)),g.lock()}catch(b){this._worker=new l("error"),this._worker.error(b)}}h.prototype={accumulate:function(g){return m(this,g)},on:function(g,p){var x=this;return g==="data"?this._worker.on(g,function(v){p.call(x,v.data,v.meta)}):this._worker.on(g,function(){i.delay(p,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},g)}},n.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(r,n,a){if(a.base64=!0,a.array=!0,a.string=!0,a.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",a.nodebuffer=typeof Buffer<"u",a.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")a.blob=!1;else{var i=new ArrayBuffer(0);try{a.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),a.blob=o.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!r("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,a){for(var i=r("./utils"),o=r("./support"),l=r("./nodejsUtils"),c=r("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function m(){c.call(this,"utf-8 encode")}a.utf8encode=function(h){return o.nodebuffer?l.newBufferFrom(h,"utf-8"):function(g){var p,x,v,b,y,N=g.length,_=0;for(b=0;b<N;b++)(64512&(x=g.charCodeAt(b)))==55296&&b+1<N&&(64512&(v=g.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),b++),_+=x<128?1:x<2048?2:x<65536?3:4;for(p=o.uint8array?new Uint8Array(_):new Array(_),b=y=0;y<_;b++)(64512&(x=g.charCodeAt(b)))==55296&&b+1<N&&(64512&(v=g.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),b++),x<128?p[y++]=x:(x<2048?p[y++]=192|x>>>6:(x<65536?p[y++]=224|x>>>12:(p[y++]=240|x>>>18,p[y++]=128|x>>>12&63),p[y++]=128|x>>>6&63),p[y++]=128|63&x);return p}(h)},a.utf8decode=function(h){return o.nodebuffer?i.transformTo("nodebuffer",h).toString("utf-8"):function(g){var p,x,v,b,y=g.length,N=new Array(2*y);for(p=x=0;p<y;)if((v=g[p++])<128)N[x++]=v;else if(4<(b=u[v]))N[x++]=65533,p+=b-1;else{for(v&=b===2?31:b===3?15:7;1<b&&p<y;)v=v<<6|63&g[p++],b--;1<b?N[x++]=65533:v<65536?N[x++]=v:(v-=65536,N[x++]=55296|v>>10&1023,N[x++]=56320|1023&v)}return N.length!==x&&(N.subarray?N=N.subarray(0,x):N.length=x),i.applyFromCharCode(N)}(h=i.transformTo(o.uint8array?"uint8array":"array",h))},i.inherits(f,c),f.prototype.processChunk=function(h){var g=i.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var p=g;(g=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),g.set(p,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=function(b,y){var N;for((y=y||b.length)>b.length&&(y=b.length),N=y-1;0<=N&&(192&b[N])==128;)N--;return N<0||N===0?y:N+u[b[N]]>y?N:y}(g),v=g;x!==g.length&&(o.uint8array?(v=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(v=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:a.utf8decode(v),meta:h.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=f,i.inherits(m,c),m.prototype.processChunk=function(h){this.push({data:a.utf8encode(h.data),meta:h.meta})},a.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,a){var i=r("./support"),o=r("./base64"),l=r("./nodejsUtils"),c=r("./external");function u(p){return p}function d(p,x){for(var v=0;v<p.length;++v)x[v]=255&p.charCodeAt(v);return x}r("setimmediate"),a.newBlob=function(p,x){a.checkSupport("blob");try{return new Blob([p],{type:x})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(p),v.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(p,x,v){var b=[],y=0,N=p.length;if(N<=v)return String.fromCharCode.apply(null,p);for(;y<N;)x==="array"||x==="nodebuffer"?b.push(String.fromCharCode.apply(null,p.slice(y,Math.min(y+v,N)))):b.push(String.fromCharCode.apply(null,p.subarray(y,Math.min(y+v,N)))),y+=v;return b.join("")},stringifyByChar:function(p){for(var x="",v=0;v<p.length;v++)x+=String.fromCharCode(p[v]);return x},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}}()}};function m(p){var x=65536,v=a.getTypeOf(p),b=!0;if(v==="uint8array"?b=f.applyCanBeUsed.uint8array:v==="nodebuffer"&&(b=f.applyCanBeUsed.nodebuffer),b)for(;1<x;)try{return f.stringifyByChunk(p,v,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(p)}function h(p,x){for(var v=0;v<p.length;v++)x[v]=p[v];return x}a.applyFromCharCode=m;var g={};g.string={string:u,array:function(p){return d(p,new Array(p.length))},arraybuffer:function(p){return g.string.uint8array(p).buffer},uint8array:function(p){return d(p,new Uint8Array(p.length))},nodebuffer:function(p){return d(p,l.allocBuffer(p.length))}},g.array={string:m,array:u,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(p)}},g.arraybuffer={string:function(p){return m(new Uint8Array(p))},array:function(p){return h(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:u,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(new Uint8Array(p))}},g.uint8array={string:m,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:u,nodebuffer:function(p){return l.newBufferFrom(p)}},g.nodebuffer={string:m,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return g.nodebuffer.uint8array(p).buffer},uint8array:function(p){return h(p,new Uint8Array(p.length))},nodebuffer:u},a.transformTo=function(p,x){if(x=x||"",!p)return x;a.checkSupport(p);var v=a.getTypeOf(x);return g[v][p](x)},a.resolve=function(p){for(var x=p.split("/"),v=[],b=0;b<x.length;b++){var y=x[b];y==="."||y===""&&b!==0&&b!==x.length-1||(y===".."?v.pop():v.push(y))}return v.join("/")},a.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(p)?"nodebuffer":i.uint8array&&p instanceof Uint8Array?"uint8array":i.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(p){if(!i[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(p){var x,v,b="";for(v=0;v<(p||"").length;v++)b+="\\x"+((x=p.charCodeAt(v))<16?"0":"")+x.toString(16).toUpperCase();return b},a.delay=function(p,x,v){setImmediate(function(){p.apply(v||null,x||[])})},a.inherits=function(p,x){function v(){}v.prototype=x.prototype,p.prototype=new v},a.extend=function(){var p,x,v={};for(p=0;p<arguments.length;p++)for(x in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],x)&&v[x]===void 0&&(v[x]=arguments[p][x]);return v},a.prepareContent=function(p,x,v,b,y){return c.Promise.resolve(x).then(function(N){return i.blob&&(N instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(N))!==-1)&&typeof FileReader<"u"?new c.Promise(function(_,j){var S=new FileReader;S.onload=function(I){_(I.target.result)},S.onerror=function(I){j(I.target.error)},S.readAsArrayBuffer(N)}):N}).then(function(N){var _=a.getTypeOf(N);return _?(_==="arraybuffer"?N=a.transformTo("uint8array",N):_==="string"&&(y?N=o.decode(N):v&&b!==!0&&(N=function(j){return d(j,i.uint8array?new Uint8Array(j.length):new Array(j.length))}(N))),N):c.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(r,n,a){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./signature"),c=r("./zipEntry"),u=r("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(m)+", expected "+o.pretty(f)+")")}},isSignature:function(f,m){var h=this.reader.index;this.reader.setIndex(f);var g=this.reader.readString(4)===m;return this.reader.setIndex(h),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),m=u.uint8array?"uint8array":"array",h=o.transformTo(m,f);this.zipComment=this.loadOptions.decodeFileName(h)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,m,h,g=this.zip64EndOfCentralSize-44;0<g;)f=this.reader.readInt(2),m=this.reader.readInt(4),h=this.reader.readData(m),this.zip64ExtensibleData[f]={id:f,length:m,value:h}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,m;for(f=0;f<this.files.length;f++)m=this.files[f],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(f=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var m=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var g=m-h;if(0<g)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},n.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(r,n,a){var i=r("./reader/readerFor"),o=r("./utils"),l=r("./compressedObject"),c=r("./crc32"),u=r("./utf8"),d=r("./compressions"),f=r("./support");function m(h,g){this.options=h,this.loadOptions=g}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var g,p;if(h.skip(22),this.fileNameLength=h.readInt(2),p=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=function(x){for(var v in d)if(Object.prototype.hasOwnProperty.call(d,v)&&d[v].magic===x)return d[v];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,h.readData(this.compressedSize))},readCentralPart:function(h){this.versionMadeBy=h.readInt(2),h.skip(2),this.bitFlag=h.readInt(2),this.compressionMethod=h.readString(2),this.date=h.readDate(),this.crc32=h.readInt(4),this.compressedSize=h.readInt(4),this.uncompressedSize=h.readInt(4);var g=h.readInt(2);if(this.extraFieldsLength=h.readInt(2),this.fileCommentLength=h.readInt(2),this.diskNumberStart=h.readInt(2),this.internalFileAttributes=h.readInt(2),this.externalFileAttributes=h.readInt(4),this.localHeaderOffset=h.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");h.skip(g),this.readExtraFields(h),this.parseZIP64ExtraField(h),this.fileComment=h.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var h=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=i(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var g,p,x,v=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<v;)g=h.readInt(2),p=h.readInt(2),x=h.readData(p),this.extraFields[g]={id:g,length:p,value:x};h.setIndex(v)},handleUTF8:function(){var h=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var p=o.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var v=o.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var g=i(h.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var g=i(h.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(h.length-5))}return null}},n.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(r,n,a){function i(g,p,x){this.name=g,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=p,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var o=r("./stream/StreamHelper"),l=r("./stream/DataWorker"),c=r("./utf8"),u=r("./compressedObject"),d=r("./stream/GenericWorker");i.prototype={internalStream:function(g){var p=null,x="string";try{if(!g)throw new Error("No output type specified.");var v=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),p=this._decompressWorker();var b=!this._dataBinary;b&&!v&&(p=p.pipe(new c.Utf8EncodeWorker)),!b&&v&&(p=p.pipe(new c.Utf8DecodeWorker))}catch(y){(p=new d("error")).error(y)}return new o(p,x,"")},async:function(g,p){return this.internalStream(g).accumulate(p)},nodeStream:function(g,p){return this.internalStream(g||"nodebuffer").toNodejsStream(p)},_compressWorker:function(g,p){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,g,p)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<f.length;h++)i.prototype[f[h]]=m;n.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(r,n,a){(function(i){var o,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(g),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),o=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)o="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var p=i.document.createElement("script");p.onreadystatechange=function(){g(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},i.document.documentElement.appendChild(p)}:function(){setTimeout(g,0)};else{var m=new i.MessageChannel;m.port1.onmessage=g,o=function(){m.port2.postMessage(0)}}var h=[];function g(){var p,x;l=!0;for(var v=h.length;v;){for(x=h,h=[],p=-1;++p<v;)x[p]();v=h.length}l=!1}n.exports=function(p){h.push(p)!==1||l||o()}}).call(this,typeof Fc<"u"?Fc:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(r,n,a){var i=r("immediate");function o(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,v!==o&&p(this,v)}function m(v,b,y){this.promise=v,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function h(v,b,y){i(function(){var N;try{N=b(y)}catch(_){return l.reject(v,_)}N===v?l.reject(v,new TypeError("Cannot resolve promise with itself")):l.resolve(v,N)})}function g(v){var b=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof b=="function")return function(){b.apply(v,arguments)}}function p(v,b){var y=!1;function N(S){y||(y=!0,l.reject(v,S))}function _(S){y||(y=!0,l.resolve(v,S))}var j=x(function(){b(_,N)});j.status==="error"&&N(j.value)}function x(v,b){var y={};try{y.value=v(b),y.status="success"}catch(N){y.status="error",y.value=N}return y}(n.exports=f).prototype.finally=function(v){if(typeof v!="function")return this;var b=this.constructor;return this.then(function(y){return b.resolve(v()).then(function(){return y})},function(y){return b.resolve(v()).then(function(){throw y})})},f.prototype.catch=function(v){return this.then(null,v)},f.prototype.then=function(v,b){if(typeof v!="function"&&this.state===u||typeof b!="function"&&this.state===c)return this;var y=new this.constructor(o);return this.state!==d?h(y,this.state===u?v:b,this.outcome):this.queue.push(new m(y,v,b)),y},m.prototype.callFulfilled=function(v){l.resolve(this.promise,v)},m.prototype.otherCallFulfilled=function(v){h(this.promise,this.onFulfilled,v)},m.prototype.callRejected=function(v){l.reject(this.promise,v)},m.prototype.otherCallRejected=function(v){h(this.promise,this.onRejected,v)},l.resolve=function(v,b){var y=x(g,b);if(y.status==="error")return l.reject(v,y.value);var N=y.value;if(N)p(v,N);else{v.state=u,v.outcome=b;for(var _=-1,j=v.queue.length;++_<j;)v.queue[_].callFulfilled(b)}return v},l.reject=function(v,b){v.state=c,v.outcome=b;for(var y=-1,N=v.queue.length;++y<N;)v.queue[y].callRejected(b);return v},f.resolve=function(v){return v instanceof this?v:l.resolve(new this(o),v)},f.reject=function(v){var b=new this(o);return l.reject(b,v)},f.all=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=v.length,N=!1;if(!y)return this.resolve([]);for(var _=new Array(y),j=0,S=-1,I=new this(o);++S<y;)P(v[S],S);return I;function P(F,T){b.resolve(F).then(function(k){_[T]=k,++j!==y||N||(N=!0,l.resolve(I,_))},function(k){N||(N=!0,l.reject(I,k))})}},f.race=function(v){var b=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=v.length,N=!1;if(!y)return this.resolve([]);for(var _=-1,j=new this(o);++_<y;)S=v[_],b.resolve(S).then(function(I){N||(N=!0,l.resolve(j,I))},function(I){N||(N=!0,l.reject(j,I))});var S;return j}},{immediate:36}],38:[function(r,n,a){var i={};(0,r("./lib/utils/common").assign)(i,r("./lib/deflate"),r("./lib/inflate"),r("./lib/zlib/constants")),n.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(r,n,a){var i=r("./zlib/deflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/messages"),u=r("./zlib/zstream"),d=Object.prototype.toString,f=0,m=-1,h=0,g=8;function p(v){if(!(this instanceof p))return new p(v);this.options=o.assign({level:m,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},v||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=i.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(y!==f)throw new Error(c[y]);if(b.header&&i.deflateSetHeader(this.strm,b.header),b.dictionary){var N;if(N=typeof b.dictionary=="string"?l.string2buf(b.dictionary):d.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(y=i.deflateSetDictionary(this.strm,N))!==f)throw new Error(c[y]);this._dict_set=!0}}function x(v,b){var y=new p(b);if(y.push(v,!0),y.err)throw y.msg||c[y.err];return y.result}p.prototype.push=function(v,b){var y,N,_=this.strm,j=this.options.chunkSize;if(this.ended)return!1;N=b===~~b?b:b===!0?4:0,typeof v=="string"?_.input=l.string2buf(v):d.call(v)==="[object ArrayBuffer]"?_.input=new Uint8Array(v):_.input=v,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new o.Buf8(j),_.next_out=0,_.avail_out=j),(y=i.deflate(_,N))!==1&&y!==f)return this.onEnd(y),!(this.ended=!0);_.avail_out!==0&&(_.avail_in!==0||N!==4&&N!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(o.shrinkBuf(_.output,_.next_out))):this.onData(o.shrinkBuf(_.output,_.next_out)))}while((0<_.avail_in||_.avail_out===0)&&y!==1);return N===4?(y=i.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===f):N!==2||(this.onEnd(f),!(_.avail_out=0))},p.prototype.onData=function(v){this.chunks.push(v)},p.prototype.onEnd=function(v){v===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},a.Deflate=p,a.deflate=x,a.deflateRaw=function(v,b){return(b=b||{}).raw=!0,x(v,b)},a.gzip=function(v,b){return(b=b||{}).gzip=!0,x(v,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(r,n,a){var i=r("./zlib/inflate"),o=r("./utils/common"),l=r("./utils/strings"),c=r("./zlib/constants"),u=r("./zlib/messages"),d=r("./zlib/zstream"),f=r("./zlib/gzheader"),m=Object.prototype.toString;function h(p){if(!(this instanceof h))return new h(p);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},p||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||p&&p.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&!(15&x.windowBits)&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var v=i.inflateInit2(this.strm,x.windowBits);if(v!==c.Z_OK)throw new Error(u[v]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function g(p,x){var v=new h(x);if(v.push(p,!0),v.err)throw v.msg||u[v.err];return v.result}h.prototype.push=function(p,x){var v,b,y,N,_,j,S=this.strm,I=this.options.chunkSize,P=this.options.dictionary,F=!1;if(this.ended)return!1;b=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof p=="string"?S.input=l.binstring2buf(p):m.call(p)==="[object ArrayBuffer]"?S.input=new Uint8Array(p):S.input=p,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new o.Buf8(I),S.next_out=0,S.avail_out=I),(v=i.inflate(S,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&P&&(j=typeof P=="string"?l.string2buf(P):m.call(P)==="[object ArrayBuffer]"?new Uint8Array(P):P,v=i.inflateSetDictionary(this.strm,j)),v===c.Z_BUF_ERROR&&F===!0&&(v=c.Z_OK,F=!1),v!==c.Z_STREAM_END&&v!==c.Z_OK)return this.onEnd(v),!(this.ended=!0);S.next_out&&(S.avail_out!==0&&v!==c.Z_STREAM_END&&(S.avail_in!==0||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=l.utf8border(S.output,S.next_out),N=S.next_out-y,_=l.buf2string(S.output,y),S.next_out=N,S.avail_out=I-N,N&&o.arraySet(S.output,S.output,y,N,0),this.onData(_)):this.onData(o.shrinkBuf(S.output,S.next_out)))),S.avail_in===0&&S.avail_out===0&&(F=!0)}while((0<S.avail_in||S.avail_out===0)&&v!==c.Z_STREAM_END);return v===c.Z_STREAM_END&&(b=c.Z_FINISH),b===c.Z_FINISH?(v=i.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(S.avail_out=0))},h.prototype.onData=function(p){this.chunks.push(p)},h.prototype.onEnd=function(p){p===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},a.Inflate=h,a.inflate=g,a.inflateRaw=function(p,x){return(x=x||{}).raw=!0,g(p,x)},a.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(r,n,a){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";a.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(c[f]=d[f])}}return c},a.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var o={arraySet:function(c,u,d,f,m){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+f),m);else for(var h=0;h<f;h++)c[m+h]=u[d+h]},flattenChunks:function(c){var u,d,f,m,h,g;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(g=new Uint8Array(f),u=m=0,d=c.length;u<d;u++)h=c[u],g.set(h,m),m+=h.length;return g}},l={arraySet:function(c,u,d,f,m){for(var h=0;h<f;h++)c[m+h]=u[d+h]},flattenChunks:function(c){return[].concat.apply([],c)}};a.setTyped=function(c){c?(a.Buf8=Uint8Array,a.Buf16=Uint16Array,a.Buf32=Int32Array,a.assign(a,o)):(a.Buf8=Array,a.Buf16=Array,a.Buf32=Array,a.assign(a,l))},a.setTyped(i)},{}],42:[function(r,n,a){var i=r("./common"),o=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,m){if(m<65537&&(f.subarray&&l||!f.subarray&&o))return String.fromCharCode.apply(null,i.shrinkBuf(f,m));for(var h="",g=0;g<m;g++)h+=String.fromCharCode(f[g]);return h}c[254]=c[254]=1,a.string2buf=function(f){var m,h,g,p,x,v=f.length,b=0;for(p=0;p<v;p++)(64512&(h=f.charCodeAt(p)))==55296&&p+1<v&&(64512&(g=f.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),p++),b+=h<128?1:h<2048?2:h<65536?3:4;for(m=new i.Buf8(b),p=x=0;x<b;p++)(64512&(h=f.charCodeAt(p)))==55296&&p+1<v&&(64512&(g=f.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),p++),h<128?m[x++]=h:(h<2048?m[x++]=192|h>>>6:(h<65536?m[x++]=224|h>>>12:(m[x++]=240|h>>>18,m[x++]=128|h>>>12&63),m[x++]=128|h>>>6&63),m[x++]=128|63&h);return m},a.buf2binstring=function(f){return d(f,f.length)},a.binstring2buf=function(f){for(var m=new i.Buf8(f.length),h=0,g=m.length;h<g;h++)m[h]=f.charCodeAt(h);return m},a.buf2string=function(f,m){var h,g,p,x,v=m||f.length,b=new Array(2*v);for(h=g=0;h<v;)if((p=f[h++])<128)b[g++]=p;else if(4<(x=c[p]))b[g++]=65533,h+=x-1;else{for(p&=x===2?31:x===3?15:7;1<x&&h<v;)p=p<<6|63&f[h++],x--;1<x?b[g++]=65533:p<65536?b[g++]=p:(p-=65536,b[g++]=55296|p>>10&1023,b[g++]=56320|1023&p)}return d(b,g)},a.utf8border=function(f,m){var h;for((m=m||f.length)>f.length&&(m=f.length),h=m-1;0<=h&&(192&f[h])==128;)h--;return h<0||h===0?m:h+c[f[h]]>m?h:m}},{"./common":41}],43:[function(r,n,a){n.exports=function(i,o,l,c){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;l!==0;){for(l-=f=2e3<l?2e3:l;d=d+(u=u+o[c++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(r,n,a){n.exports={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_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}},{}],45:[function(r,n,a){var i=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();n.exports=function(o,l,c,u){var d=i,f=u+c;o^=-1;for(var m=u;m<f;m++)o=o>>>8^d[255&(o^l[m])];return-1^o}},{}],46:[function(r,n,a){var i,o=r("../utils/common"),l=r("./trees"),c=r("./adler32"),u=r("./crc32"),d=r("./messages"),f=0,m=4,h=0,g=-2,p=-1,x=4,v=2,b=8,y=9,N=286,_=30,j=19,S=2*N+1,I=15,P=3,F=258,T=F+P+1,k=42,V=113,C=1,R=2,H=3,q=4;function L(W,Z){return W.msg=d[Z],Z}function M(W){return(W<<1)-(4<W?9:0)}function z(W){for(var Z=W.length;0<=--Z;)W[Z]=0}function K(W){var Z=W.state,le=Z.pending;le>W.avail_out&&(le=W.avail_out),le!==0&&(o.arraySet(W.output,Z.pending_buf,Z.pending_out,le,W.next_out),W.next_out+=le,Z.pending_out+=le,W.total_out+=le,W.avail_out-=le,Z.pending-=le,Z.pending===0&&(Z.pending_out=0))}function E(W,Z){l._tr_flush_block(W,0<=W.block_start?W.block_start:-1,W.strstart-W.block_start,Z),W.block_start=W.strstart,K(W.strm)}function A(W,Z){W.pending_buf[W.pending++]=Z}function O(W,Z){W.pending_buf[W.pending++]=Z>>>8&255,W.pending_buf[W.pending++]=255&Z}function U(W,Z){var le,re,oe=W.max_chain_length,fe=W.strstart,Fe=W.prev_length,ge=W.nice_match,pe=W.strstart>W.w_size-T?W.strstart-(W.w_size-T):0,Ie=W.window,Ge=W.w_mask,we=W.prev,_e=W.strstart+F,qe=Ie[fe+Fe-1],Re=Ie[fe+Fe];W.prev_length>=W.good_match&&(oe>>=2),ge>W.lookahead&&(ge=W.lookahead);do if(Ie[(le=Z)+Fe]===Re&&Ie[le+Fe-1]===qe&&Ie[le]===Ie[fe]&&Ie[++le]===Ie[fe+1]){fe+=2,le++;do;while(Ie[++fe]===Ie[++le]&&Ie[++fe]===Ie[++le]&&Ie[++fe]===Ie[++le]&&Ie[++fe]===Ie[++le]&&Ie[++fe]===Ie[++le]&&Ie[++fe]===Ie[++le]&&Ie[++fe]===Ie[++le]&&Ie[++fe]===Ie[++le]&&fe<_e);if(re=F-(_e-fe),fe=_e-F,Fe<re){if(W.match_start=Z,ge<=(Fe=re))break;qe=Ie[fe+Fe-1],Re=Ie[fe+Fe]}}while((Z=we[Z&Ge])>pe&&--oe!=0);return Fe<=W.lookahead?Fe:W.lookahead}function Y(W){var Z,le,re,oe,fe,Fe,ge,pe,Ie,Ge,we=W.w_size;do{if(oe=W.window_size-W.lookahead-W.strstart,W.strstart>=we+(we-T)){for(o.arraySet(W.window,W.window,we,we,0),W.match_start-=we,W.strstart-=we,W.block_start-=we,Z=le=W.hash_size;re=W.head[--Z],W.head[Z]=we<=re?re-we:0,--le;);for(Z=le=we;re=W.prev[--Z],W.prev[Z]=we<=re?re-we:0,--le;);oe+=we}if(W.strm.avail_in===0)break;if(Fe=W.strm,ge=W.window,pe=W.strstart+W.lookahead,Ie=oe,Ge=void 0,Ge=Fe.avail_in,Ie<Ge&&(Ge=Ie),le=Ge===0?0:(Fe.avail_in-=Ge,o.arraySet(ge,Fe.input,Fe.next_in,Ge,pe),Fe.state.wrap===1?Fe.adler=c(Fe.adler,ge,Ge,pe):Fe.state.wrap===2&&(Fe.adler=u(Fe.adler,ge,Ge,pe)),Fe.next_in+=Ge,Fe.total_in+=Ge,Ge),W.lookahead+=le,W.lookahead+W.insert>=P)for(fe=W.strstart-W.insert,W.ins_h=W.window[fe],W.ins_h=(W.ins_h<<W.hash_shift^W.window[fe+1])&W.hash_mask;W.insert&&(W.ins_h=(W.ins_h<<W.hash_shift^W.window[fe+P-1])&W.hash_mask,W.prev[fe&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=fe,fe++,W.insert--,!(W.lookahead+W.insert<P)););}while(W.lookahead<T&&W.strm.avail_in!==0)}function J(W,Z){for(var le,re;;){if(W.lookahead<T){if(Y(W),W.lookahead<T&&Z===f)return C;if(W.lookahead===0)break}if(le=0,W.lookahead>=P&&(W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+P-1])&W.hash_mask,le=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart),le!==0&&W.strstart-le<=W.w_size-T&&(W.match_length=U(W,le)),W.match_length>=P)if(re=l._tr_tally(W,W.strstart-W.match_start,W.match_length-P),W.lookahead-=W.match_length,W.match_length<=W.max_lazy_match&&W.lookahead>=P){for(W.match_length--;W.strstart++,W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+P-1])&W.hash_mask,le=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart,--W.match_length!=0;);W.strstart++}else W.strstart+=W.match_length,W.match_length=0,W.ins_h=W.window[W.strstart],W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+1])&W.hash_mask;else re=l._tr_tally(W,0,W.window[W.strstart]),W.lookahead--,W.strstart++;if(re&&(E(W,!1),W.strm.avail_out===0))return C}return W.insert=W.strstart<P-1?W.strstart:P-1,Z===m?(E(W,!0),W.strm.avail_out===0?H:q):W.last_lit&&(E(W,!1),W.strm.avail_out===0)?C:R}function se(W,Z){for(var le,re,oe;;){if(W.lookahead<T){if(Y(W),W.lookahead<T&&Z===f)return C;if(W.lookahead===0)break}if(le=0,W.lookahead>=P&&(W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+P-1])&W.hash_mask,le=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart),W.prev_length=W.match_length,W.prev_match=W.match_start,W.match_length=P-1,le!==0&&W.prev_length<W.max_lazy_match&&W.strstart-le<=W.w_size-T&&(W.match_length=U(W,le),W.match_length<=5&&(W.strategy===1||W.match_length===P&&4096<W.strstart-W.match_start)&&(W.match_length=P-1)),W.prev_length>=P&&W.match_length<=W.prev_length){for(oe=W.strstart+W.lookahead-P,re=l._tr_tally(W,W.strstart-1-W.prev_match,W.prev_length-P),W.lookahead-=W.prev_length-1,W.prev_length-=2;++W.strstart<=oe&&(W.ins_h=(W.ins_h<<W.hash_shift^W.window[W.strstart+P-1])&W.hash_mask,le=W.prev[W.strstart&W.w_mask]=W.head[W.ins_h],W.head[W.ins_h]=W.strstart),--W.prev_length!=0;);if(W.match_available=0,W.match_length=P-1,W.strstart++,re&&(E(W,!1),W.strm.avail_out===0))return C}else if(W.match_available){if((re=l._tr_tally(W,0,W.window[W.strstart-1]))&&E(W,!1),W.strstart++,W.lookahead--,W.strm.avail_out===0)return C}else W.match_available=1,W.strstart++,W.lookahead--}return W.match_available&&(re=l._tr_tally(W,0,W.window[W.strstart-1]),W.match_available=0),W.insert=W.strstart<P-1?W.strstart:P-1,Z===m?(E(W,!0),W.strm.avail_out===0?H:q):W.last_lit&&(E(W,!1),W.strm.avail_out===0)?C:R}function ee(W,Z,le,re,oe){this.good_length=W,this.max_lazy=Z,this.nice_length=le,this.max_chain=re,this.func=oe}function ie(){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=b,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 o.Buf16(2*S),this.dyn_dtree=new o.Buf16(2*(2*_+1)),this.bl_tree=new o.Buf16(2*(2*j+1)),z(this.dyn_ltree),z(this.dyn_dtree),z(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(I+1),this.heap=new o.Buf16(2*N+1),z(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*N+1),z(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ee(W){var Z;return W&&W.state?(W.total_in=W.total_out=0,W.data_type=v,(Z=W.state).pending=0,Z.pending_out=0,Z.wrap<0&&(Z.wrap=-Z.wrap),Z.status=Z.wrap?k:V,W.adler=Z.wrap===2?0:1,Z.last_flush=f,l._tr_init(Z),h):L(W,g)}function te(W){var Z=Ee(W);return Z===h&&function(le){le.window_size=2*le.w_size,z(le.head),le.max_lazy_match=i[le.level].max_lazy,le.good_match=i[le.level].good_length,le.nice_match=i[le.level].nice_length,le.max_chain_length=i[le.level].max_chain,le.strstart=0,le.block_start=0,le.lookahead=0,le.insert=0,le.match_length=le.prev_length=P-1,le.match_available=0,le.ins_h=0}(W.state),Z}function Ue(W,Z,le,re,oe,fe){if(!W)return g;var Fe=1;if(Z===p&&(Z=6),re<0?(Fe=0,re=-re):15<re&&(Fe=2,re-=16),oe<1||y<oe||le!==b||re<8||15<re||Z<0||9<Z||fe<0||x<fe)return L(W,g);re===8&&(re=9);var ge=new ie;return(W.state=ge).strm=W,ge.wrap=Fe,ge.gzhead=null,ge.w_bits=re,ge.w_size=1<<ge.w_bits,ge.w_mask=ge.w_size-1,ge.hash_bits=oe+7,ge.hash_size=1<<ge.hash_bits,ge.hash_mask=ge.hash_size-1,ge.hash_shift=~~((ge.hash_bits+P-1)/P),ge.window=new o.Buf8(2*ge.w_size),ge.head=new o.Buf16(ge.hash_size),ge.prev=new o.Buf16(ge.w_size),ge.lit_bufsize=1<<oe+6,ge.pending_buf_size=4*ge.lit_bufsize,ge.pending_buf=new o.Buf8(ge.pending_buf_size),ge.d_buf=1*ge.lit_bufsize,ge.l_buf=3*ge.lit_bufsize,ge.level=Z,ge.strategy=fe,ge.method=le,te(W)}i=[new ee(0,0,0,0,function(W,Z){var le=65535;for(le>W.pending_buf_size-5&&(le=W.pending_buf_size-5);;){if(W.lookahead<=1){if(Y(W),W.lookahead===0&&Z===f)return C;if(W.lookahead===0)break}W.strstart+=W.lookahead,W.lookahead=0;var re=W.block_start+le;if((W.strstart===0||W.strstart>=re)&&(W.lookahead=W.strstart-re,W.strstart=re,E(W,!1),W.strm.avail_out===0)||W.strstart-W.block_start>=W.w_size-T&&(E(W,!1),W.strm.avail_out===0))return C}return W.insert=0,Z===m?(E(W,!0),W.strm.avail_out===0?H:q):(W.strstart>W.block_start&&(E(W,!1),W.strm.avail_out),C)}),new ee(4,4,8,4,J),new ee(4,5,16,8,J),new ee(4,6,32,32,J),new ee(4,4,16,16,se),new ee(8,16,32,32,se),new ee(8,16,128,128,se),new ee(8,32,128,256,se),new ee(32,128,258,1024,se),new ee(32,258,258,4096,se)],a.deflateInit=function(W,Z){return Ue(W,Z,b,15,8,0)},a.deflateInit2=Ue,a.deflateReset=te,a.deflateResetKeep=Ee,a.deflateSetHeader=function(W,Z){return W&&W.state?W.state.wrap!==2?g:(W.state.gzhead=Z,h):g},a.deflate=function(W,Z){var le,re,oe,fe;if(!W||!W.state||5<Z||Z<0)return W?L(W,g):g;if(re=W.state,!W.output||!W.input&&W.avail_in!==0||re.status===666&&Z!==m)return L(W,W.avail_out===0?-5:g);if(re.strm=W,le=re.last_flush,re.last_flush=Z,re.status===k)if(re.wrap===2)W.adler=0,A(re,31),A(re,139),A(re,8),re.gzhead?(A(re,(re.gzhead.text?1:0)+(re.gzhead.hcrc?2:0)+(re.gzhead.extra?4:0)+(re.gzhead.name?8:0)+(re.gzhead.comment?16:0)),A(re,255&re.gzhead.time),A(re,re.gzhead.time>>8&255),A(re,re.gzhead.time>>16&255),A(re,re.gzhead.time>>24&255),A(re,re.level===9?2:2<=re.strategy||re.level<2?4:0),A(re,255&re.gzhead.os),re.gzhead.extra&&re.gzhead.extra.length&&(A(re,255&re.gzhead.extra.length),A(re,re.gzhead.extra.length>>8&255)),re.gzhead.hcrc&&(W.adler=u(W.adler,re.pending_buf,re.pending,0)),re.gzindex=0,re.status=69):(A(re,0),A(re,0),A(re,0),A(re,0),A(re,0),A(re,re.level===9?2:2<=re.strategy||re.level<2?4:0),A(re,3),re.status=V);else{var Fe=b+(re.w_bits-8<<4)<<8;Fe|=(2<=re.strategy||re.level<2?0:re.level<6?1:re.level===6?2:3)<<6,re.strstart!==0&&(Fe|=32),Fe+=31-Fe%31,re.status=V,O(re,Fe),re.strstart!==0&&(O(re,W.adler>>>16),O(re,65535&W.adler)),W.adler=1}if(re.status===69)if(re.gzhead.extra){for(oe=re.pending;re.gzindex<(65535&re.gzhead.extra.length)&&(re.pending!==re.pending_buf_size||(re.gzhead.hcrc&&re.pending>oe&&(W.adler=u(W.adler,re.pending_buf,re.pending-oe,oe)),K(W),oe=re.pending,re.pending!==re.pending_buf_size));)A(re,255&re.gzhead.extra[re.gzindex]),re.gzindex++;re.gzhead.hcrc&&re.pending>oe&&(W.adler=u(W.adler,re.pending_buf,re.pending-oe,oe)),re.gzindex===re.gzhead.extra.length&&(re.gzindex=0,re.status=73)}else re.status=73;if(re.status===73)if(re.gzhead.name){oe=re.pending;do{if(re.pending===re.pending_buf_size&&(re.gzhead.hcrc&&re.pending>oe&&(W.adler=u(W.adler,re.pending_buf,re.pending-oe,oe)),K(W),oe=re.pending,re.pending===re.pending_buf_size)){fe=1;break}fe=re.gzindex<re.gzhead.name.length?255&re.gzhead.name.charCodeAt(re.gzindex++):0,A(re,fe)}while(fe!==0);re.gzhead.hcrc&&re.pending>oe&&(W.adler=u(W.adler,re.pending_buf,re.pending-oe,oe)),fe===0&&(re.gzindex=0,re.status=91)}else re.status=91;if(re.status===91)if(re.gzhead.comment){oe=re.pending;do{if(re.pending===re.pending_buf_size&&(re.gzhead.hcrc&&re.pending>oe&&(W.adler=u(W.adler,re.pending_buf,re.pending-oe,oe)),K(W),oe=re.pending,re.pending===re.pending_buf_size)){fe=1;break}fe=re.gzindex<re.gzhead.comment.length?255&re.gzhead.comment.charCodeAt(re.gzindex++):0,A(re,fe)}while(fe!==0);re.gzhead.hcrc&&re.pending>oe&&(W.adler=u(W.adler,re.pending_buf,re.pending-oe,oe)),fe===0&&(re.status=103)}else re.status=103;if(re.status===103&&(re.gzhead.hcrc?(re.pending+2>re.pending_buf_size&&K(W),re.pending+2<=re.pending_buf_size&&(A(re,255&W.adler),A(re,W.adler>>8&255),W.adler=0,re.status=V)):re.status=V),re.pending!==0){if(K(W),W.avail_out===0)return re.last_flush=-1,h}else if(W.avail_in===0&&M(Z)<=M(le)&&Z!==m)return L(W,-5);if(re.status===666&&W.avail_in!==0)return L(W,-5);if(W.avail_in!==0||re.lookahead!==0||Z!==f&&re.status!==666){var ge=re.strategy===2?function(pe,Ie){for(var Ge;;){if(pe.lookahead===0&&(Y(pe),pe.lookahead===0)){if(Ie===f)return C;break}if(pe.match_length=0,Ge=l._tr_tally(pe,0,pe.window[pe.strstart]),pe.lookahead--,pe.strstart++,Ge&&(E(pe,!1),pe.strm.avail_out===0))return C}return pe.insert=0,Ie===m?(E(pe,!0),pe.strm.avail_out===0?H:q):pe.last_lit&&(E(pe,!1),pe.strm.avail_out===0)?C:R}(re,Z):re.strategy===3?function(pe,Ie){for(var Ge,we,_e,qe,Re=pe.window;;){if(pe.lookahead<=F){if(Y(pe),pe.lookahead<=F&&Ie===f)return C;if(pe.lookahead===0)break}if(pe.match_length=0,pe.lookahead>=P&&0<pe.strstart&&(we=Re[_e=pe.strstart-1])===Re[++_e]&&we===Re[++_e]&&we===Re[++_e]){qe=pe.strstart+F;do;while(we===Re[++_e]&&we===Re[++_e]&&we===Re[++_e]&&we===Re[++_e]&&we===Re[++_e]&&we===Re[++_e]&&we===Re[++_e]&&we===Re[++_e]&&_e<qe);pe.match_length=F-(qe-_e),pe.match_length>pe.lookahead&&(pe.match_length=pe.lookahead)}if(pe.match_length>=P?(Ge=l._tr_tally(pe,1,pe.match_length-P),pe.lookahead-=pe.match_length,pe.strstart+=pe.match_length,pe.match_length=0):(Ge=l._tr_tally(pe,0,pe.window[pe.strstart]),pe.lookahead--,pe.strstart++),Ge&&(E(pe,!1),pe.strm.avail_out===0))return C}return pe.insert=0,Ie===m?(E(pe,!0),pe.strm.avail_out===0?H:q):pe.last_lit&&(E(pe,!1),pe.strm.avail_out===0)?C:R}(re,Z):i[re.level].func(re,Z);if(ge!==H&&ge!==q||(re.status=666),ge===C||ge===H)return W.avail_out===0&&(re.last_flush=-1),h;if(ge===R&&(Z===1?l._tr_align(re):Z!==5&&(l._tr_stored_block(re,0,0,!1),Z===3&&(z(re.head),re.lookahead===0&&(re.strstart=0,re.block_start=0,re.insert=0))),K(W),W.avail_out===0))return re.last_flush=-1,h}return Z!==m?h:re.wrap<=0?1:(re.wrap===2?(A(re,255&W.adler),A(re,W.adler>>8&255),A(re,W.adler>>16&255),A(re,W.adler>>24&255),A(re,255&W.total_in),A(re,W.total_in>>8&255),A(re,W.total_in>>16&255),A(re,W.total_in>>24&255)):(O(re,W.adler>>>16),O(re,65535&W.adler)),K(W),0<re.wrap&&(re.wrap=-re.wrap),re.pending!==0?h:1)},a.deflateEnd=function(W){var Z;return W&&W.state?(Z=W.state.status)!==k&&Z!==69&&Z!==73&&Z!==91&&Z!==103&&Z!==V&&Z!==666?L(W,g):(W.state=null,Z===V?L(W,-3):h):g},a.deflateSetDictionary=function(W,Z){var le,re,oe,fe,Fe,ge,pe,Ie,Ge=Z.length;if(!W||!W.state||(fe=(le=W.state).wrap)===2||fe===1&&le.status!==k||le.lookahead)return g;for(fe===1&&(W.adler=c(W.adler,Z,Ge,0)),le.wrap=0,Ge>=le.w_size&&(fe===0&&(z(le.head),le.strstart=0,le.block_start=0,le.insert=0),Ie=new o.Buf8(le.w_size),o.arraySet(Ie,Z,Ge-le.w_size,le.w_size,0),Z=Ie,Ge=le.w_size),Fe=W.avail_in,ge=W.next_in,pe=W.input,W.avail_in=Ge,W.next_in=0,W.input=Z,Y(le);le.lookahead>=P;){for(re=le.strstart,oe=le.lookahead-(P-1);le.ins_h=(le.ins_h<<le.hash_shift^le.window[re+P-1])&le.hash_mask,le.prev[re&le.w_mask]=le.head[le.ins_h],le.head[le.ins_h]=re,re++,--oe;);le.strstart=re,le.lookahead=P-1,Y(le)}return le.strstart+=le.lookahead,le.block_start=le.strstart,le.insert=le.lookahead,le.lookahead=0,le.match_length=le.prev_length=P-1,le.match_available=0,W.next_in=ge,W.input=pe,W.avail_in=Fe,le.wrap=fe,h},a.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(r,n,a){n.exports=function(){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}},{}],48:[function(r,n,a){n.exports=function(i,o){var l,c,u,d,f,m,h,g,p,x,v,b,y,N,_,j,S,I,P,F,T,k,V,C,R;l=i.state,c=i.next_in,C=i.input,u=c+(i.avail_in-5),d=i.next_out,R=i.output,f=d-(o-i.avail_out),m=d+(i.avail_out-257),h=l.dmax,g=l.wsize,p=l.whave,x=l.wnext,v=l.window,b=l.hold,y=l.bits,N=l.lencode,_=l.distcode,j=(1<<l.lenbits)-1,S=(1<<l.distbits)-1;e:do{y<15&&(b+=C[c++]<<y,y+=8,b+=C[c++]<<y,y+=8),I=N[b&j];t:for(;;){if(b>>>=P=I>>>24,y-=P,(P=I>>>16&255)===0)R[d++]=65535&I;else{if(!(16&P)){if(!(64&P)){I=N[(65535&I)+(b&(1<<P)-1)];continue t}if(32&P){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}F=65535&I,(P&=15)&&(y<P&&(b+=C[c++]<<y,y+=8),F+=b&(1<<P)-1,b>>>=P,y-=P),y<15&&(b+=C[c++]<<y,y+=8,b+=C[c++]<<y,y+=8),I=_[b&S];r:for(;;){if(b>>>=P=I>>>24,y-=P,!(16&(P=I>>>16&255))){if(!(64&P)){I=_[(65535&I)+(b&(1<<P)-1)];continue r}i.msg="invalid distance code",l.mode=30;break e}if(T=65535&I,y<(P&=15)&&(b+=C[c++]<<y,(y+=8)<P&&(b+=C[c++]<<y,y+=8)),h<(T+=b&(1<<P)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(b>>>=P,y-=P,(P=d-f)<T){if(p<(P=T-P)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(V=v,(k=0)===x){if(k+=g-P,P<F){for(F-=P;R[d++]=v[k++],--P;);k=d-T,V=R}}else if(x<P){if(k+=g+x-P,(P-=x)<F){for(F-=P;R[d++]=v[k++],--P;);if(k=0,x<F){for(F-=P=x;R[d++]=v[k++],--P;);k=d-T,V=R}}}else if(k+=x-P,P<F){for(F-=P;R[d++]=v[k++],--P;);k=d-T,V=R}for(;2<F;)R[d++]=V[k++],R[d++]=V[k++],R[d++]=V[k++],F-=3;F&&(R[d++]=V[k++],1<F&&(R[d++]=V[k++]))}else{for(k=d-T;R[d++]=R[k++],R[d++]=R[k++],R[d++]=R[k++],2<(F-=3););F&&(R[d++]=R[k++],1<F&&(R[d++]=R[k++]))}break}}break}}while(c<u&&d<m);c-=F=y>>3,b&=(1<<(y-=F<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<m?m-d+257:257-(d-m),l.hold=b,l.bits=y}},{}],49:[function(r,n,a){var i=r("../utils/common"),o=r("./adler32"),l=r("./crc32"),c=r("./inffast"),u=r("./inftrees"),d=1,f=2,m=0,h=-2,g=1,p=852,x=592;function v(k){return(k>>>24&255)+(k>>>8&65280)+((65280&k)<<8)+((255&k)<<24)}function b(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(k){var V;return k&&k.state?(V=k.state,k.total_in=k.total_out=V.total=0,k.msg="",V.wrap&&(k.adler=1&V.wrap),V.mode=g,V.last=0,V.havedict=0,V.dmax=32768,V.head=null,V.hold=0,V.bits=0,V.lencode=V.lendyn=new i.Buf32(p),V.distcode=V.distdyn=new i.Buf32(x),V.sane=1,V.back=-1,m):h}function N(k){var V;return k&&k.state?((V=k.state).wsize=0,V.whave=0,V.wnext=0,y(k)):h}function _(k,V){var C,R;return k&&k.state?(R=k.state,V<0?(C=0,V=-V):(C=1+(V>>4),V<48&&(V&=15)),V&&(V<8||15<V)?h:(R.window!==null&&R.wbits!==V&&(R.window=null),R.wrap=C,R.wbits=V,N(k))):h}function j(k,V){var C,R;return k?(R=new b,(k.state=R).window=null,(C=_(k,V))!==m&&(k.state=null),C):h}var S,I,P=!0;function F(k){if(P){var V;for(S=new i.Buf32(512),I=new i.Buf32(32),V=0;V<144;)k.lens[V++]=8;for(;V<256;)k.lens[V++]=9;for(;V<280;)k.lens[V++]=7;for(;V<288;)k.lens[V++]=8;for(u(d,k.lens,0,288,S,0,k.work,{bits:9}),V=0;V<32;)k.lens[V++]=5;u(f,k.lens,0,32,I,0,k.work,{bits:5}),P=!1}k.lencode=S,k.lenbits=9,k.distcode=I,k.distbits=5}function T(k,V,C,R){var H,q=k.state;return q.window===null&&(q.wsize=1<<q.wbits,q.wnext=0,q.whave=0,q.window=new i.Buf8(q.wsize)),R>=q.wsize?(i.arraySet(q.window,V,C-q.wsize,q.wsize,0),q.wnext=0,q.whave=q.wsize):(R<(H=q.wsize-q.wnext)&&(H=R),i.arraySet(q.window,V,C-R,H,q.wnext),(R-=H)?(i.arraySet(q.window,V,C-R,R,0),q.wnext=R,q.whave=q.wsize):(q.wnext+=H,q.wnext===q.wsize&&(q.wnext=0),q.whave<q.wsize&&(q.whave+=H))),0}a.inflateReset=N,a.inflateReset2=_,a.inflateResetKeep=y,a.inflateInit=function(k){return j(k,15)},a.inflateInit2=j,a.inflate=function(k,V){var C,R,H,q,L,M,z,K,E,A,O,U,Y,J,se,ee,ie,Ee,te,Ue,W,Z,le,re,oe=0,fe=new i.Buf8(4),Fe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!k||!k.state||!k.output||!k.input&&k.avail_in!==0)return h;(C=k.state).mode===12&&(C.mode=13),L=k.next_out,H=k.output,z=k.avail_out,q=k.next_in,R=k.input,M=k.avail_in,K=C.hold,E=C.bits,A=M,O=z,Z=m;e:for(;;)switch(C.mode){case g:if(C.wrap===0){C.mode=13;break}for(;E<16;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(2&C.wrap&&K===35615){fe[C.check=0]=255&K,fe[1]=K>>>8&255,C.check=l(C.check,fe,2,0),E=K=0,C.mode=2;break}if(C.flags=0,C.head&&(C.head.done=!1),!(1&C.wrap)||(((255&K)<<8)+(K>>8))%31){k.msg="incorrect header check",C.mode=30;break}if((15&K)!=8){k.msg="unknown compression method",C.mode=30;break}if(E-=4,W=8+(15&(K>>>=4)),C.wbits===0)C.wbits=W;else if(W>C.wbits){k.msg="invalid window size",C.mode=30;break}C.dmax=1<<W,k.adler=C.check=1,C.mode=512&K?10:12,E=K=0;break;case 2:for(;E<16;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(C.flags=K,(255&C.flags)!=8){k.msg="unknown compression method",C.mode=30;break}if(57344&C.flags){k.msg="unknown header flags set",C.mode=30;break}C.head&&(C.head.text=K>>8&1),512&C.flags&&(fe[0]=255&K,fe[1]=K>>>8&255,C.check=l(C.check,fe,2,0)),E=K=0,C.mode=3;case 3:for(;E<32;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}C.head&&(C.head.time=K),512&C.flags&&(fe[0]=255&K,fe[1]=K>>>8&255,fe[2]=K>>>16&255,fe[3]=K>>>24&255,C.check=l(C.check,fe,4,0)),E=K=0,C.mode=4;case 4:for(;E<16;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}C.head&&(C.head.xflags=255&K,C.head.os=K>>8),512&C.flags&&(fe[0]=255&K,fe[1]=K>>>8&255,C.check=l(C.check,fe,2,0)),E=K=0,C.mode=5;case 5:if(1024&C.flags){for(;E<16;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}C.length=K,C.head&&(C.head.extra_len=K),512&C.flags&&(fe[0]=255&K,fe[1]=K>>>8&255,C.check=l(C.check,fe,2,0)),E=K=0}else C.head&&(C.head.extra=null);C.mode=6;case 6:if(1024&C.flags&&(M<(U=C.length)&&(U=M),U&&(C.head&&(W=C.head.extra_len-C.length,C.head.extra||(C.head.extra=new Array(C.head.extra_len)),i.arraySet(C.head.extra,R,q,U,W)),512&C.flags&&(C.check=l(C.check,R,U,q)),M-=U,q+=U,C.length-=U),C.length))break e;C.length=0,C.mode=7;case 7:if(2048&C.flags){if(M===0)break e;for(U=0;W=R[q+U++],C.head&&W&&C.length<65536&&(C.head.name+=String.fromCharCode(W)),W&&U<M;);if(512&C.flags&&(C.check=l(C.check,R,U,q)),M-=U,q+=U,W)break e}else C.head&&(C.head.name=null);C.length=0,C.mode=8;case 8:if(4096&C.flags){if(M===0)break e;for(U=0;W=R[q+U++],C.head&&W&&C.length<65536&&(C.head.comment+=String.fromCharCode(W)),W&&U<M;);if(512&C.flags&&(C.check=l(C.check,R,U,q)),M-=U,q+=U,W)break e}else C.head&&(C.head.comment=null);C.mode=9;case 9:if(512&C.flags){for(;E<16;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(K!==(65535&C.check)){k.msg="header crc mismatch",C.mode=30;break}E=K=0}C.head&&(C.head.hcrc=C.flags>>9&1,C.head.done=!0),k.adler=C.check=0,C.mode=12;break;case 10:for(;E<32;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}k.adler=C.check=v(K),E=K=0,C.mode=11;case 11:if(C.havedict===0)return k.next_out=L,k.avail_out=z,k.next_in=q,k.avail_in=M,C.hold=K,C.bits=E,2;k.adler=C.check=1,C.mode=12;case 12:if(V===5||V===6)break e;case 13:if(C.last){K>>>=7&E,E-=7&E,C.mode=27;break}for(;E<3;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}switch(C.last=1&K,E-=1,3&(K>>>=1)){case 0:C.mode=14;break;case 1:if(F(C),C.mode=20,V!==6)break;K>>>=2,E-=2;break e;case 2:C.mode=17;break;case 3:k.msg="invalid block type",C.mode=30}K>>>=2,E-=2;break;case 14:for(K>>>=7&E,E-=7&E;E<32;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if((65535&K)!=(K>>>16^65535)){k.msg="invalid stored block lengths",C.mode=30;break}if(C.length=65535&K,E=K=0,C.mode=15,V===6)break e;case 15:C.mode=16;case 16:if(U=C.length){if(M<U&&(U=M),z<U&&(U=z),U===0)break e;i.arraySet(H,R,q,U,L),M-=U,q+=U,z-=U,L+=U,C.length-=U;break}C.mode=12;break;case 17:for(;E<14;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(C.nlen=257+(31&K),K>>>=5,E-=5,C.ndist=1+(31&K),K>>>=5,E-=5,C.ncode=4+(15&K),K>>>=4,E-=4,286<C.nlen||30<C.ndist){k.msg="too many length or distance symbols",C.mode=30;break}C.have=0,C.mode=18;case 18:for(;C.have<C.ncode;){for(;E<3;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}C.lens[Fe[C.have++]]=7&K,K>>>=3,E-=3}for(;C.have<19;)C.lens[Fe[C.have++]]=0;if(C.lencode=C.lendyn,C.lenbits=7,le={bits:C.lenbits},Z=u(0,C.lens,0,19,C.lencode,0,C.work,le),C.lenbits=le.bits,Z){k.msg="invalid code lengths set",C.mode=30;break}C.have=0,C.mode=19;case 19:for(;C.have<C.nlen+C.ndist;){for(;ee=(oe=C.lencode[K&(1<<C.lenbits)-1])>>>16&255,ie=65535&oe,!((se=oe>>>24)<=E);){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(ie<16)K>>>=se,E-=se,C.lens[C.have++]=ie;else{if(ie===16){for(re=se+2;E<re;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(K>>>=se,E-=se,C.have===0){k.msg="invalid bit length repeat",C.mode=30;break}W=C.lens[C.have-1],U=3+(3&K),K>>>=2,E-=2}else if(ie===17){for(re=se+3;E<re;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}E-=se,W=0,U=3+(7&(K>>>=se)),K>>>=3,E-=3}else{for(re=se+7;E<re;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}E-=se,W=0,U=11+(127&(K>>>=se)),K>>>=7,E-=7}if(C.have+U>C.nlen+C.ndist){k.msg="invalid bit length repeat",C.mode=30;break}for(;U--;)C.lens[C.have++]=W}}if(C.mode===30)break;if(C.lens[256]===0){k.msg="invalid code -- missing end-of-block",C.mode=30;break}if(C.lenbits=9,le={bits:C.lenbits},Z=u(d,C.lens,0,C.nlen,C.lencode,0,C.work,le),C.lenbits=le.bits,Z){k.msg="invalid literal/lengths set",C.mode=30;break}if(C.distbits=6,C.distcode=C.distdyn,le={bits:C.distbits},Z=u(f,C.lens,C.nlen,C.ndist,C.distcode,0,C.work,le),C.distbits=le.bits,Z){k.msg="invalid distances set",C.mode=30;break}if(C.mode=20,V===6)break e;case 20:C.mode=21;case 21:if(6<=M&&258<=z){k.next_out=L,k.avail_out=z,k.next_in=q,k.avail_in=M,C.hold=K,C.bits=E,c(k,O),L=k.next_out,H=k.output,z=k.avail_out,q=k.next_in,R=k.input,M=k.avail_in,K=C.hold,E=C.bits,C.mode===12&&(C.back=-1);break}for(C.back=0;ee=(oe=C.lencode[K&(1<<C.lenbits)-1])>>>16&255,ie=65535&oe,!((se=oe>>>24)<=E);){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(ee&&!(240&ee)){for(Ee=se,te=ee,Ue=ie;ee=(oe=C.lencode[Ue+((K&(1<<Ee+te)-1)>>Ee)])>>>16&255,ie=65535&oe,!(Ee+(se=oe>>>24)<=E);){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}K>>>=Ee,E-=Ee,C.back+=Ee}if(K>>>=se,E-=se,C.back+=se,C.length=ie,ee===0){C.mode=26;break}if(32&ee){C.back=-1,C.mode=12;break}if(64&ee){k.msg="invalid literal/length code",C.mode=30;break}C.extra=15&ee,C.mode=22;case 22:if(C.extra){for(re=C.extra;E<re;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}C.length+=K&(1<<C.extra)-1,K>>>=C.extra,E-=C.extra,C.back+=C.extra}C.was=C.length,C.mode=23;case 23:for(;ee=(oe=C.distcode[K&(1<<C.distbits)-1])>>>16&255,ie=65535&oe,!((se=oe>>>24)<=E);){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(!(240&ee)){for(Ee=se,te=ee,Ue=ie;ee=(oe=C.distcode[Ue+((K&(1<<Ee+te)-1)>>Ee)])>>>16&255,ie=65535&oe,!(Ee+(se=oe>>>24)<=E);){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}K>>>=Ee,E-=Ee,C.back+=Ee}if(K>>>=se,E-=se,C.back+=se,64&ee){k.msg="invalid distance code",C.mode=30;break}C.offset=ie,C.extra=15&ee,C.mode=24;case 24:if(C.extra){for(re=C.extra;E<re;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}C.offset+=K&(1<<C.extra)-1,K>>>=C.extra,E-=C.extra,C.back+=C.extra}if(C.offset>C.dmax){k.msg="invalid distance too far back",C.mode=30;break}C.mode=25;case 25:if(z===0)break e;if(U=O-z,C.offset>U){if((U=C.offset-U)>C.whave&&C.sane){k.msg="invalid distance too far back",C.mode=30;break}Y=U>C.wnext?(U-=C.wnext,C.wsize-U):C.wnext-U,U>C.length&&(U=C.length),J=C.window}else J=H,Y=L-C.offset,U=C.length;for(z<U&&(U=z),z-=U,C.length-=U;H[L++]=J[Y++],--U;);C.length===0&&(C.mode=21);break;case 26:if(z===0)break e;H[L++]=C.length,z--,C.mode=21;break;case 27:if(C.wrap){for(;E<32;){if(M===0)break e;M--,K|=R[q++]<<E,E+=8}if(O-=z,k.total_out+=O,C.total+=O,O&&(k.adler=C.check=C.flags?l(C.check,H,O,L-O):o(C.check,H,O,L-O)),O=z,(C.flags?K:v(K))!==C.check){k.msg="incorrect data check",C.mode=30;break}E=K=0}C.mode=28;case 28:if(C.wrap&&C.flags){for(;E<32;){if(M===0)break e;M--,K+=R[q++]<<E,E+=8}if(K!==(4294967295&C.total)){k.msg="incorrect length check",C.mode=30;break}E=K=0}C.mode=29;case 29:Z=1;break e;case 30:Z=-3;break e;case 31:return-4;case 32:default:return h}return k.next_out=L,k.avail_out=z,k.next_in=q,k.avail_in=M,C.hold=K,C.bits=E,(C.wsize||O!==k.avail_out&&C.mode<30&&(C.mode<27||V!==4))&&T(k,k.output,k.next_out,O-k.avail_out)?(C.mode=31,-4):(A-=k.avail_in,O-=k.avail_out,k.total_in+=A,k.total_out+=O,C.total+=O,C.wrap&&O&&(k.adler=C.check=C.flags?l(C.check,H,O,k.next_out-O):o(C.check,H,O,k.next_out-O)),k.data_type=C.bits+(C.last?64:0)+(C.mode===12?128:0)+(C.mode===20||C.mode===15?256:0),(A==0&&O===0||V===4)&&Z===m&&(Z=-5),Z)},a.inflateEnd=function(k){if(!k||!k.state)return h;var V=k.state;return V.window&&(V.window=null),k.state=null,m},a.inflateGetHeader=function(k,V){var C;return k&&k.state&&2&(C=k.state).wrap?((C.head=V).done=!1,m):h},a.inflateSetDictionary=function(k,V){var C,R=V.length;return k&&k.state?(C=k.state).wrap!==0&&C.mode!==11?h:C.mode===11&&o(1,V,R,0)!==C.check?-3:T(k,V,R,R)?(C.mode=31,-4):(C.havedict=1,m):h},a.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(r,n,a){var i=r("../utils/common"),o=[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],l=[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],c=[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],u=[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];n.exports=function(d,f,m,h,g,p,x,v){var b,y,N,_,j,S,I,P,F,T=v.bits,k=0,V=0,C=0,R=0,H=0,q=0,L=0,M=0,z=0,K=0,E=null,A=0,O=new i.Buf16(16),U=new i.Buf16(16),Y=null,J=0;for(k=0;k<=15;k++)O[k]=0;for(V=0;V<h;V++)O[f[m+V]]++;for(H=T,R=15;1<=R&&O[R]===0;R--);if(R<H&&(H=R),R===0)return g[p++]=20971520,g[p++]=20971520,v.bits=1,0;for(C=1;C<R&&O[C]===0;C++);for(H<C&&(H=C),k=M=1;k<=15;k++)if(M<<=1,(M-=O[k])<0)return-1;if(0<M&&(d===0||R!==1))return-1;for(U[1]=0,k=1;k<15;k++)U[k+1]=U[k]+O[k];for(V=0;V<h;V++)f[m+V]!==0&&(x[U[f[m+V]]++]=V);if(S=d===0?(E=Y=x,19):d===1?(E=o,A-=257,Y=l,J-=257,256):(E=c,Y=u,-1),k=C,j=p,L=V=K=0,N=-1,_=(z=1<<(q=H))-1,d===1&&852<z||d===2&&592<z)return 1;for(;;){for(I=k-L,F=x[V]<S?(P=0,x[V]):x[V]>S?(P=Y[J+x[V]],E[A+x[V]]):(P=96,0),b=1<<k-L,C=y=1<<q;g[j+(K>>L)+(y-=b)]=I<<24|P<<16|F|0,y!==0;);for(b=1<<k-1;K&b;)b>>=1;if(b!==0?(K&=b-1,K+=b):K=0,V++,--O[k]==0){if(k===R)break;k=f[m+x[V]]}if(H<k&&(K&_)!==N){for(L===0&&(L=H),j+=C,M=1<<(q=k-L);q+L<R&&!((M-=O[q+L])<=0);)q++,M<<=1;if(z+=1<<q,d===1&&852<z||d===2&&592<z)return 1;g[N=K&_]=H<<24|q<<16|j-p|0}}return K!==0&&(g[j+K]=k-L<<24|64<<16|0),v.bits=H,0}},{"../utils/common":41}],51:[function(r,n,a){n.exports={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"}},{}],52:[function(r,n,a){var i=r("../utils/common"),o=0,l=1;function c(oe){for(var fe=oe.length;0<=--fe;)oe[fe]=0}var u=0,d=29,f=256,m=f+1+d,h=30,g=19,p=2*m+1,x=15,v=16,b=7,y=256,N=16,_=17,j=18,S=[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],I=[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],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],T=new Array(2*(m+2));c(T);var k=new Array(2*h);c(k);var V=new Array(512);c(V);var C=new Array(256);c(C);var R=new Array(d);c(R);var H,q,L,M=new Array(h);function z(oe,fe,Fe,ge,pe){this.static_tree=oe,this.extra_bits=fe,this.extra_base=Fe,this.elems=ge,this.max_length=pe,this.has_stree=oe&&oe.length}function K(oe,fe){this.dyn_tree=oe,this.max_code=0,this.stat_desc=fe}function E(oe){return oe<256?V[oe]:V[256+(oe>>>7)]}function A(oe,fe){oe.pending_buf[oe.pending++]=255&fe,oe.pending_buf[oe.pending++]=fe>>>8&255}function O(oe,fe,Fe){oe.bi_valid>v-Fe?(oe.bi_buf|=fe<<oe.bi_valid&65535,A(oe,oe.bi_buf),oe.bi_buf=fe>>v-oe.bi_valid,oe.bi_valid+=Fe-v):(oe.bi_buf|=fe<<oe.bi_valid&65535,oe.bi_valid+=Fe)}function U(oe,fe,Fe){O(oe,Fe[2*fe],Fe[2*fe+1])}function Y(oe,fe){for(var Fe=0;Fe|=1&oe,oe>>>=1,Fe<<=1,0<--fe;);return Fe>>>1}function J(oe,fe,Fe){var ge,pe,Ie=new Array(x+1),Ge=0;for(ge=1;ge<=x;ge++)Ie[ge]=Ge=Ge+Fe[ge-1]<<1;for(pe=0;pe<=fe;pe++){var we=oe[2*pe+1];we!==0&&(oe[2*pe]=Y(Ie[we]++,we))}}function se(oe){var fe;for(fe=0;fe<m;fe++)oe.dyn_ltree[2*fe]=0;for(fe=0;fe<h;fe++)oe.dyn_dtree[2*fe]=0;for(fe=0;fe<g;fe++)oe.bl_tree[2*fe]=0;oe.dyn_ltree[2*y]=1,oe.opt_len=oe.static_len=0,oe.last_lit=oe.matches=0}function ee(oe){8<oe.bi_valid?A(oe,oe.bi_buf):0<oe.bi_valid&&(oe.pending_buf[oe.pending++]=oe.bi_buf),oe.bi_buf=0,oe.bi_valid=0}function ie(oe,fe,Fe,ge){var pe=2*fe,Ie=2*Fe;return oe[pe]<oe[Ie]||oe[pe]===oe[Ie]&&ge[fe]<=ge[Fe]}function Ee(oe,fe,Fe){for(var ge=oe.heap[Fe],pe=Fe<<1;pe<=oe.heap_len&&(pe<oe.heap_len&&ie(fe,oe.heap[pe+1],oe.heap[pe],oe.depth)&&pe++,!ie(fe,ge,oe.heap[pe],oe.depth));)oe.heap[Fe]=oe.heap[pe],Fe=pe,pe<<=1;oe.heap[Fe]=ge}function te(oe,fe,Fe){var ge,pe,Ie,Ge,we=0;if(oe.last_lit!==0)for(;ge=oe.pending_buf[oe.d_buf+2*we]<<8|oe.pending_buf[oe.d_buf+2*we+1],pe=oe.pending_buf[oe.l_buf+we],we++,ge===0?U(oe,pe,fe):(U(oe,(Ie=C[pe])+f+1,fe),(Ge=S[Ie])!==0&&O(oe,pe-=R[Ie],Ge),U(oe,Ie=E(--ge),Fe),(Ge=I[Ie])!==0&&O(oe,ge-=M[Ie],Ge)),we<oe.last_lit;);U(oe,y,fe)}function Ue(oe,fe){var Fe,ge,pe,Ie=fe.dyn_tree,Ge=fe.stat_desc.static_tree,we=fe.stat_desc.has_stree,_e=fe.stat_desc.elems,qe=-1;for(oe.heap_len=0,oe.heap_max=p,Fe=0;Fe<_e;Fe++)Ie[2*Fe]!==0?(oe.heap[++oe.heap_len]=qe=Fe,oe.depth[Fe]=0):Ie[2*Fe+1]=0;for(;oe.heap_len<2;)Ie[2*(pe=oe.heap[++oe.heap_len]=qe<2?++qe:0)]=1,oe.depth[pe]=0,oe.opt_len--,we&&(oe.static_len-=Ge[2*pe+1]);for(fe.max_code=qe,Fe=oe.heap_len>>1;1<=Fe;Fe--)Ee(oe,Ie,Fe);for(pe=_e;Fe=oe.heap[1],oe.heap[1]=oe.heap[oe.heap_len--],Ee(oe,Ie,1),ge=oe.heap[1],oe.heap[--oe.heap_max]=Fe,oe.heap[--oe.heap_max]=ge,Ie[2*pe]=Ie[2*Fe]+Ie[2*ge],oe.depth[pe]=(oe.depth[Fe]>=oe.depth[ge]?oe.depth[Fe]:oe.depth[ge])+1,Ie[2*Fe+1]=Ie[2*ge+1]=pe,oe.heap[1]=pe++,Ee(oe,Ie,1),2<=oe.heap_len;);oe.heap[--oe.heap_max]=oe.heap[1],function(Re,Me){var He,st,Zt,_t,Vt,Jt,Qt=Me.dyn_tree,qt=Me.max_code,it=Me.stat_desc.static_tree,It=Me.stat_desc.has_stree,Mt=Me.stat_desc.extra_bits,wr=Me.stat_desc.extra_base,$t=Me.stat_desc.max_length,kt=0;for(_t=0;_t<=x;_t++)Re.bl_count[_t]=0;for(Qt[2*Re.heap[Re.heap_max]+1]=0,He=Re.heap_max+1;He<p;He++)$t<(_t=Qt[2*Qt[2*(st=Re.heap[He])+1]+1]+1)&&(_t=$t,kt++),Qt[2*st+1]=_t,qt<st||(Re.bl_count[_t]++,Vt=0,wr<=st&&(Vt=Mt[st-wr]),Jt=Qt[2*st],Re.opt_len+=Jt*(_t+Vt),It&&(Re.static_len+=Jt*(it[2*st+1]+Vt)));if(kt!==0){do{for(_t=$t-1;Re.bl_count[_t]===0;)_t--;Re.bl_count[_t]--,Re.bl_count[_t+1]+=2,Re.bl_count[$t]--,kt-=2}while(0<kt);for(_t=$t;_t!==0;_t--)for(st=Re.bl_count[_t];st!==0;)qt<(Zt=Re.heap[--He])||(Qt[2*Zt+1]!==_t&&(Re.opt_len+=(_t-Qt[2*Zt+1])*Qt[2*Zt],Qt[2*Zt+1]=_t),st--)}}(oe,fe),J(Ie,qe,oe.bl_count)}function W(oe,fe,Fe){var ge,pe,Ie=-1,Ge=fe[1],we=0,_e=7,qe=4;for(Ge===0&&(_e=138,qe=3),fe[2*(Fe+1)+1]=65535,ge=0;ge<=Fe;ge++)pe=Ge,Ge=fe[2*(ge+1)+1],++we<_e&&pe===Ge||(we<qe?oe.bl_tree[2*pe]+=we:pe!==0?(pe!==Ie&&oe.bl_tree[2*pe]++,oe.bl_tree[2*N]++):we<=10?oe.bl_tree[2*_]++:oe.bl_tree[2*j]++,Ie=pe,qe=(we=0)===Ge?(_e=138,3):pe===Ge?(_e=6,3):(_e=7,4))}function Z(oe,fe,Fe){var ge,pe,Ie=-1,Ge=fe[1],we=0,_e=7,qe=4;for(Ge===0&&(_e=138,qe=3),ge=0;ge<=Fe;ge++)if(pe=Ge,Ge=fe[2*(ge+1)+1],!(++we<_e&&pe===Ge)){if(we<qe)for(;U(oe,pe,oe.bl_tree),--we!=0;);else pe!==0?(pe!==Ie&&(U(oe,pe,oe.bl_tree),we--),U(oe,N,oe.bl_tree),O(oe,we-3,2)):we<=10?(U(oe,_,oe.bl_tree),O(oe,we-3,3)):(U(oe,j,oe.bl_tree),O(oe,we-11,7));Ie=pe,qe=(we=0)===Ge?(_e=138,3):pe===Ge?(_e=6,3):(_e=7,4)}}c(M);var le=!1;function re(oe,fe,Fe,ge){O(oe,(u<<1)+(ge?1:0),3),function(pe,Ie,Ge,we){ee(pe),A(pe,Ge),A(pe,~Ge),i.arraySet(pe.pending_buf,pe.window,Ie,Ge,pe.pending),pe.pending+=Ge}(oe,fe,Fe)}a._tr_init=function(oe){le||(function(){var fe,Fe,ge,pe,Ie,Ge=new Array(x+1);for(pe=ge=0;pe<d-1;pe++)for(R[pe]=ge,fe=0;fe<1<<S[pe];fe++)C[ge++]=pe;for(C[ge-1]=pe,pe=Ie=0;pe<16;pe++)for(M[pe]=Ie,fe=0;fe<1<<I[pe];fe++)V[Ie++]=pe;for(Ie>>=7;pe<h;pe++)for(M[pe]=Ie<<7,fe=0;fe<1<<I[pe]-7;fe++)V[256+Ie++]=pe;for(Fe=0;Fe<=x;Fe++)Ge[Fe]=0;for(fe=0;fe<=143;)T[2*fe+1]=8,fe++,Ge[8]++;for(;fe<=255;)T[2*fe+1]=9,fe++,Ge[9]++;for(;fe<=279;)T[2*fe+1]=7,fe++,Ge[7]++;for(;fe<=287;)T[2*fe+1]=8,fe++,Ge[8]++;for(J(T,m+1,Ge),fe=0;fe<h;fe++)k[2*fe+1]=5,k[2*fe]=Y(fe,5);H=new z(T,S,f+1,m,x),q=new z(k,I,0,h,x),L=new z(new Array(0),P,0,g,b)}(),le=!0),oe.l_desc=new K(oe.dyn_ltree,H),oe.d_desc=new K(oe.dyn_dtree,q),oe.bl_desc=new K(oe.bl_tree,L),oe.bi_buf=0,oe.bi_valid=0,se(oe)},a._tr_stored_block=re,a._tr_flush_block=function(oe,fe,Fe,ge){var pe,Ie,Ge=0;0<oe.level?(oe.strm.data_type===2&&(oe.strm.data_type=function(we){var _e,qe=4093624447;for(_e=0;_e<=31;_e++,qe>>>=1)if(1&qe&&we.dyn_ltree[2*_e]!==0)return o;if(we.dyn_ltree[18]!==0||we.dyn_ltree[20]!==0||we.dyn_ltree[26]!==0)return l;for(_e=32;_e<f;_e++)if(we.dyn_ltree[2*_e]!==0)return l;return o}(oe)),Ue(oe,oe.l_desc),Ue(oe,oe.d_desc),Ge=function(we){var _e;for(W(we,we.dyn_ltree,we.l_desc.max_code),W(we,we.dyn_dtree,we.d_desc.max_code),Ue(we,we.bl_desc),_e=g-1;3<=_e&&we.bl_tree[2*F[_e]+1]===0;_e--);return we.opt_len+=3*(_e+1)+5+5+4,_e}(oe),pe=oe.opt_len+3+7>>>3,(Ie=oe.static_len+3+7>>>3)<=pe&&(pe=Ie)):pe=Ie=Fe+5,Fe+4<=pe&&fe!==-1?re(oe,fe,Fe,ge):oe.strategy===4||Ie===pe?(O(oe,2+(ge?1:0),3),te(oe,T,k)):(O(oe,4+(ge?1:0),3),function(we,_e,qe,Re){var Me;for(O(we,_e-257,5),O(we,qe-1,5),O(we,Re-4,4),Me=0;Me<Re;Me++)O(we,we.bl_tree[2*F[Me]+1],3);Z(we,we.dyn_ltree,_e-1),Z(we,we.dyn_dtree,qe-1)}(oe,oe.l_desc.max_code+1,oe.d_desc.max_code+1,Ge+1),te(oe,oe.dyn_ltree,oe.dyn_dtree)),se(oe),ge&&ee(oe)},a._tr_tally=function(oe,fe,Fe){return oe.pending_buf[oe.d_buf+2*oe.last_lit]=fe>>>8&255,oe.pending_buf[oe.d_buf+2*oe.last_lit+1]=255&fe,oe.pending_buf[oe.l_buf+oe.last_lit]=255&Fe,oe.last_lit++,fe===0?oe.dyn_ltree[2*Fe]++:(oe.matches++,fe--,oe.dyn_ltree[2*(C[Fe]+f+1)]++,oe.dyn_dtree[2*E(fe)]++),oe.last_lit===oe.lit_bufsize-1},a._tr_align=function(oe){O(oe,2,3),U(oe,y,T),function(fe){fe.bi_valid===16?(A(fe,fe.bi_buf),fe.bi_buf=0,fe.bi_valid=0):8<=fe.bi_valid&&(fe.pending_buf[fe.pending++]=255&fe.bi_buf,fe.bi_buf>>=8,fe.bi_valid-=8)}(oe)}},{"../utils/common":41}],53:[function(r,n,a){n.exports=function(){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}},{}],54:[function(r,n,a){(function(i){(function(o,l){if(!o.setImmediate){var c,u,d,f,m=1,h={},g=!1,p=o.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(o);x=x&&x.setTimeout?x:o,c={}.toString.call(o.process)==="[object process]"?function(N){process.nextTick(function(){b(N)})}:function(){if(o.postMessage&&!o.importScripts){var N=!0,_=o.onmessage;return o.onmessage=function(){N=!1},o.postMessage("","*"),o.onmessage=_,N}}()?(f="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",y,!1):o.attachEvent("onmessage",y),function(N){o.postMessage(f+N,"*")}):o.MessageChannel?((d=new MessageChannel).port1.onmessage=function(N){b(N.data)},function(N){d.port2.postMessage(N)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(N){var _=p.createElement("script");_.onreadystatechange=function(){b(N),_.onreadystatechange=null,u.removeChild(_),_=null},u.appendChild(_)}):function(N){setTimeout(b,0,N)},x.setImmediate=function(N){typeof N!="function"&&(N=new Function(""+N));for(var _=new Array(arguments.length-1),j=0;j<_.length;j++)_[j]=arguments[j+1];var S={callback:N,args:_};return h[m]=S,c(m),m++},x.clearImmediate=v}function v(N){delete h[N]}function b(N){if(g)setTimeout(b,0,N);else{var _=h[N];if(_){g=!0;try{(function(j){var S=j.callback,I=j.args;switch(I.length){case 0:S();break;case 1:S(I[0]);break;case 2:S(I[0],I[1]);break;case 3:S(I[0],I[1],I[2]);break;default:S.apply(l,I)}})(_)}finally{v(N),g=!1}}}}function y(N){N.source===o&&typeof N.data=="string"&&N.data.indexOf(f)===0&&b(+N.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof Fc<"u"?Fc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(_ie);var p8e=_ie.exports;const g8e=jn(p8e);function YN(e){return e.trim().replace(/\s+/g,"_").replace(/[^a-zA-Z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,120)}function x8e(e,t){const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}function Bz(e,t){const r=n=>`"${String(n??"").replace(/"/g,'""').replace(/\r?\n/g," ")}"`;return[e.map(r).join(","),...t.map(n=>n.map(r).join(","))].join(`
`)}async function v8e(e){const t=await fetch(e,{credentials:"omit"});if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);const r=t.headers.get("content-type")||void 0;return{blob:await t.blob(),contentType:r}}async function y8e(e){const t=new g8e;for(const n of e.files)t.file(n.pathInZip,n.content);const r=await t.generateAsync({type:"blob"});x8e(r,`${e.zipBaseName}.zip`)}const Xh=e=>e.cv_url||e.cv_path?"hascv":e.bio&&e.bio.trim()!==""||e.specialties&&e.specialties.length>0?"started":"empty",Qp={hascv:{label:"CV reçu — à approuver",className:"bg-green-100 text-green-700 border-green-300",hint:"A déposé un CV : il suffit de l'approuver."},started:{label:"Commencé — sans CV",className:"bg-amber-100 text-amber-700 border-amber-300",hint:"A renseigné bio/compétences mais pas de CV."},empty:{label:"Profil vide",className:"bg-muted text-muted-foreground border-border",hint:"Inscrit mais n'a rien rempli."}},a5=e=>/\+test/i.test(e)||/@(test|example)\./i.test(e),zz=e=>!e.photo_url&&!!e.email&&!a5(e.email)&&(e.status==="approved"||!!e.cv_url||!!e.cv_path);function b8e(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState("pending"),[u,d]=w.useState(null),[f,m]=w.useState(null),[h,g]=w.useState(null),[p,x]=w.useState(!1),[v,b]=w.useState(null),[y,N]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&_()},[t]);const _=async()=>{try{const{data:O,error:U}=await he.from("trainer_profiles").select("*").order("created_at",{ascending:!1});if(U)throw U;const Y=await Promise.all((O||[]).map(async J=>{const{data:se}=await he.from("trainer_contracts").select("status, signed_at, created_at").eq("trainer_id",J.id).maybeSingle();return{...J,contract:se}}));o(Y)}catch(O){console.error("Error loading trainers:",O),ae.error("Erreur lors du chargement des formateurs")}finally{a(!1)}},j=async(O,U)=>{try{const{error:Y}=await he.from("trainer_profiles").update({cv_url:U,pending_cv_url:null,pending_cv_filename:null,cv_analyzed:!1}).eq("id",O);if(Y)throw Y;ae.success("Nouveau CV approuvé et activé !"),_()}catch(Y){console.error("Error approving CV change:",Y),ae.error("Erreur lors de l'approbation du CV")}},S=async O=>{try{const{error:U}=await he.from("trainer_profiles").update({pending_cv_url:null,pending_cv_filename:null}).eq("id",O);if(U)throw U;ae.success("Changement de CV rejeté"),_()}catch(U){console.error("Error rejecting CV change:",U),ae.error("Erreur lors du rejet du changement")}},I=async O=>{N(O.id);try{const{data:U,error:Y}=await he.functions.invoke("remove-trainer",{body:{trainer_id:O.id}});if(Y||U!=null&&U.error)throw new Error((U==null?void 0:U.error)||(Y==null?void 0:Y.message));const J=U.removal==="deleted"?"profil supprimé":"profil désactivé (factures liées)",se=U.farewell_sent?"email d'adieu envoyé":"email d'adieu NON envoyé";ae.success(`${O.name} retiré : ${J}, blacklisté, ${se}.`),_()}catch(U){console.error("Error removing trainer:",U),ae.error(`Erreur lors de la suppression : ${U instanceof Error?U.message:"inconnue"}`)}finally{N(null)}},P=async(O,U)=>{try{const Y={status:U};U==="approved"&&(Y.is_visible=!0);const{error:J}=await he.from("trainer_profiles").update(Y).eq("id",O);if(J)throw J;if(U==="approved"){const se=i.find(ee=>ee.id===O);if(se!=null&&se.cv_url&&!se.cv_analyzed){ae.info("Analyse automatique du CV en cours...");try{const{data:ee,error:ie}=await he.functions.invoke("analyze-cv",{body:{cvUrl:se.cv_url}});if(ie)throw ie;if(ee!=null&&ee.specialties&&ee.specialties.length>0){const{error:Ee}=await he.from("trainer_profiles").update({specialties:ee.specialties,cv_analyzed:!0}).eq("id",O);if(Ee)throw Ee;ae.success(`Formateur approuvé et ${ee.specialties.length} compétences extraites automatiquement !`)}else await he.from("trainer_profiles").update({cv_analyzed:!0}).eq("id",O),ae.success("Formateur approuvé avec succès")}catch(ee){console.error("Error analyzing CV:",ee),await he.from("trainer_profiles").update({cv_analyzed:!0}).eq("id",O),ae.success("Formateur approuvé avec succès"),ae.warning("L'analyse automatique du CV a échoué")}}else ae.success("Formateur approuvé avec succès");try{ae.info("Génération du contrat en cours...");const{data:ee,error:ie}=await he.functions.invoke("create-trainer-contract",{body:{trainerId:O}});if(ie)throw ie;ae.success("Contrat généré automatiquement ! Le formateur peut maintenant le signer.")}catch(ee){console.error("Error creating contract:",ee),ae.warning("Le formateur est approuvé mais la génération du contrat a échoué. Réessayez plus tard.")}}else ae.success("Formateur rejeté");_()}catch(Y){console.error("Error updating trainer status:",Y),ae.error("Erreur lors de la mise à jour")}},F=O=>O.split(" ").map(U=>U[0]).join("").toUpperCase().slice(0,2),T=async(O,U)=>{d(`${O}-${U}`);try{const{error:Y}=await he.functions.invoke("send-trainer-reminder",{body:{trainerId:O,type:U}});if(Y)throw Y;ae.success(U==="contract"?"Email de demande de signature envoyé !":U==="photo"?"Email de demande de photo envoyé !":"Email de demande de visibilité envoyé !")}catch(Y){console.error("Error sending reminder:",Y),ae.error("Erreur lors de l'envoi de l'email")}finally{d(null)}},k=async O=>{m(O.id);try{const{error:U}=await he.functions.invoke("send-trainer-reminder",{body:{trainerId:O.id,type:"complete_profile",cohort:Xh(O)}});if(U)throw U;ae.success(`Email de relance envoyé à ${O.name}`)}catch(U){console.error("Error sending re-activation email:",U),ae.error(U.message||"Erreur lors de l'envoi")}finally{m(null)}},V=async O=>{const U=i.filter(se=>se.status==="pending"&&Xh(se)===O&&se.email&&!a5(se.email));if(U.length===0){ae.info("Aucun formateur à relancer dans ce groupe");return}if(!window.confirm(`Envoyer un email de relance à ${U.length} formateur(s) de ce groupe ?`))return;g(O);let Y=0,J=0;for(const se of U){try{const{error:ee}=await he.functions.invoke("send-trainer-reminder",{body:{trainerId:se.id,type:"complete_profile",cohort:O}});if(ee)throw ee;Y++}catch(ee){console.error(`relance failed for ${se.email}`,ee),J++}await new Promise(ee=>setTimeout(ee,400))}g(null),ae.success(`Relance terminée : ${Y} envoyé(s)${J?`, ${J} échec(s)`:""}`)},C=async()=>{const O=i.filter(zz);if(O.length===0){ae.info("Aucun formateur sans photo à relancer");return}if(!window.confirm(`Envoyer une demande de photo de profil à ${O.length} formateur(s) ?`))return;x(!0);let U=0,Y=0;for(const J of O){try{const{error:se}=await he.functions.invoke("send-trainer-reminder",{body:{trainerId:J.id,type:"photo"}});if(se)throw se;U++}catch(se){console.error(`photo relance failed for ${J.email}`,se),Y++}await new Promise(se=>setTimeout(se,400))}x(!1),ae.success(`Relance photo terminée : ${U} envoyé(s)${Y?`, ${Y} échec(s)`:""}`)},R=async O=>{const U=await V6(O);U?window.open(U,"_blank","noopener,noreferrer"):ae.error("CV indisponible")},H=async O=>{var U,Y;b(O.id);try{const{data:J,error:se}=await he.from("trainer_documents").select("document_name, document_type, document_url, status, created_at, updated_at").eq("trainer_profile_id",O.id).order("created_at",{ascending:!0});if(se)throw se;const ee=YN(O.name||"formateur"),ie=new Date().toISOString().slice(0,10),Ee=`formateur_${ee}_${ie}`,te=[["id",O.id],["user_id",O.user_id],["name",O.name],["email",O.email],["status",O.status],["created_at",O.created_at],["is_visible",String(O.is_visible)],["manual_certified",String(!!O.manual_certified)],["view_count",String(O.view_count)],["country",O.country??""],["phone",O.phone??""],["english_level",O.english_level??""],["linkedin_url",O.linkedin_url??""],["website_url",O.website_url??""],["preferred_modality",O.preferred_modality??""],["preferred_departments",((U=O.preferred_departments)==null?void 0:U.join("; "))??""],["specialties",((Y=O.specialties)==null?void 0:Y.join("; "))??""],["bio",O.bio??""],["legal_form",O.legal_form??""],["capital_amount",O.capital_amount!=null?String(O.capital_amount):""],["headquarters_address",O.headquarters_address??""],["legal_representative_name",O.legal_representative_name??""],["legal_representative_function",O.legal_representative_function??""],["siret",O.siret??""],["activity_declaration_number",O.activity_declaration_number??""],["cv_url",O.cv_url??""],["pending_cv_url",O.pending_cv_url??""],["pending_cv_filename",O.pending_cv_filename??""]],Ue=["\uFEFF"+Bz(["field","value"],te.map(fe=>[fe[0],fe[1]]))].join(""),W="\uFEFF"+Bz(["document_type","document_name","status","document_url","created_at","updated_at"],(J??[]).map(fe=>[fe.document_type,fe.document_name,fe.status,fe.document_url,fe.created_at,fe.updated_at])),Z=[{pathInZip:"profile.csv",content:Ue},{pathInZip:"documents.csv",content:W}],le=[],re=(fe,Fe="pdf")=>{try{const pe=new URL(fe).pathname.split("/").pop()||"",Ge=((pe.includes(".")?pe.split(".").pop():"")||"").toLowerCase().replace(/[^a-z0-9]/g,"");return Ge||Fe}catch{return Fe}},oe=async(fe,Fe)=>{try{const{blob:ge}=await v8e(fe);Z.push({pathInZip:Fe,content:ge})}catch(ge){le.push(`${Fe} => ${fe} (${(ge==null?void 0:ge.message)??"download failed"})`)}};if(O.cv_url||O.cv_path){const fe=await V6(O);fe&&await oe(fe,`cv/cv_${ee}.${re(O.cv_path||O.cv_url||fe)}`)}if(O.pending_cv_url){const fe=YN(O.pending_cv_filename||`pending_cv_${ee}.${re(O.pending_cv_url)}`);await oe(O.pending_cv_url,`cv/${fe}`)}await Promise.all((J??[]).map(async(fe,Fe)=>{const ge=YN(fe.document_name||`${fe.document_type}_${Fe+1}`)||`${fe.document_type}_${Fe+1}`,pe=`documents/${YN(fe.document_type)||"document"}/${ge}`;await oe(fe.document_url,pe)})),le.length&&Z.push({pathInZip:"_errors.txt",content:le.join(`
`)}),await y8e({zipBaseName:Ee,files:Z}),ae.success("Export ZIP + CSV généré")}catch(J){console.error("Export trainer failed:",J),ae.error("Erreur lors de l'export")}finally{b(null)}},q=i.filter(O=>O.status==="pending"),L=i.filter(O=>O.status==="approved"),M=i.filter(O=>O.status==="rejected"),z=O=>q.filter(U=>Xh(U)===O).length,K=O=>q.filter(U=>Xh(U)===O&&U.email&&!a5(U.email)),E=i.filter(zz);if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});const A=({trainer:O})=>s.jsx(ke,{className:"hover:shadow-lg transition-all",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(ps,{className:"w-16 h-16",children:[O.photo_url?s.jsx(vi,{src:O.photo_url,alt:O.name}):null,s.jsx(gs,{className:"text-lg font-bold bg-primary text-primary-foreground",children:F(O.name)})]}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between mb-2",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[s.jsx("h3",{className:"text-xl font-bold",children:O.name}),s.jsx(Jj,{source:"platform"}),s.jsx(Pae,{country:O.country})]}),s.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground mb-2",children:[s.jsxs("a",{href:`mailto:${O.email}`,className:"hover:text-primary transition-colors flex items-center gap-1",children:[s.jsx(Fn,{className:"w-3 h-3"}),O.email]}),s.jsx("span",{className:"text-muted-foreground/50",children:"•"}),s.jsxs("span",{className:"text-xs",children:["Inscrit le ",new Date(O.created_at).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"})," à ",new Date(O.created_at).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]}),s.jsxs(Hn,{children:[s.jsx(ml,{asChild:!0,children:s.jsxs("button",{className:"inline-flex items-center gap-2 text-sm text-primary hover:underline",children:["Voir toutes les informations",s.jsx(is,{className:"w-3 h-3"})]})}),s.jsxs(qn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsx(Gn,{children:s.jsxs(Kn,{className:"flex items-center gap-3",children:[s.jsxs(ps,{className:"w-10 h-10",children:[O.photo_url?s.jsx(vi,{src:O.photo_url,alt:O.name}):null,s.jsx(gs,{className:"bg-primary text-primary-foreground",children:F(O.name)})]}),O.name]})}),s.jsxs("div",{className:"space-y-6 mt-4",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground mb-3 flex items-center gap-2",children:[s.jsx(qo,{className:"w-4 h-4"}),"Informations de base"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Email :"}),s.jsx("p",{className:"font-medium",children:O.email})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Statut :"}),s.jsx("p",{className:"font-medium",children:O.status==="approved"?"Approuvé":O.status==="pending"?"En attente":"Rejeté"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Visible publiquement :"}),s.jsx("p",{className:"font-medium",children:O.is_visible?"Oui":"Non"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Vues du profil :"}),s.jsx("p",{className:"font-medium",children:O.view_count})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Inscrit le :"}),s.jsxs("p",{className:"font-medium",children:[new Date(O.created_at).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"})," à ",new Date(O.created_at).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]})]})]}),s.jsx(Lu,{}),O.bio&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold text-sm text-muted-foreground mb-2",children:"Biographie"}),s.jsx("p",{className:"text-sm",children:O.bio})]}),s.jsx(Lu,{})]}),s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground mb-3",children:["Compétences (",O.specialties.length,")"]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:O.specialties.length>0?O.specialties.map((U,Y)=>s.jsx(Le,{variant:"outline",children:U},Y)):s.jsx("span",{className:"text-sm text-muted-foreground italic",children:"Aucune compétence renseignée"})})]}),s.jsx(Lu,{}),s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground mb-3 flex items-center gap-2",children:[s.jsx(Gs,{className:"w-4 h-4"}),"Préférences d'intervention"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Modalité préférée :"}),s.jsx("p",{className:"font-medium",children:O.preferred_modality==="presentiel"?"Présentiel":O.preferred_modality==="distanciel"?"Distanciel":O.preferred_modality==="both"?"Les deux":"Non renseigné"})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Départements d'intervention :"}),s.jsx("p",{className:"font-medium",children:O.preferred_departments&&O.preferred_departments.length>0?O.preferred_departments.join(", "):"France entière"})]})]})]}),s.jsx(Lu,{}),s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground mb-3 flex items-center gap-2",children:[s.jsx(Vr,{className:"w-4 h-4"}),"Informations légales"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Forme juridique :"}),s.jsx("p",{className:"font-medium",children:O.legal_form||s.jsx("span",{className:"text-muted-foreground italic",children:"Non renseigné"})})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Capital social :"}),s.jsx("p",{className:"font-medium",children:O.capital_amount?`${O.capital_amount.toLocaleString("fr-FR")} €`:s.jsx("span",{className:"text-muted-foreground italic",children:"Non renseigné"})})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Siège social :"}),s.jsx("p",{className:"font-medium",children:O.headquarters_address||s.jsx("span",{className:"text-muted-foreground italic",children:"Non renseigné"})})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Représentant légal :"}),s.jsx("p",{className:"font-medium",children:O.legal_representative_name||s.jsx("span",{className:"text-muted-foreground italic",children:"Non renseigné"})})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"Fonction :"}),s.jsx("p",{className:"font-medium",children:O.legal_representative_function||s.jsx("span",{className:"text-muted-foreground italic",children:"Non renseigné"})})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"SIRET :"}),s.jsx("p",{className:"font-medium font-mono",children:O.siret||s.jsx("span",{className:"text-muted-foreground italic font-sans",children:"Non renseigné"})})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-muted-foreground",children:"N° déclaration d'activité :"}),s.jsx("p",{className:"font-medium font-mono",children:O.activity_declaration_number||s.jsx("span",{className:"text-muted-foreground italic font-sans",children:"Non renseigné"})})]})]})]}),s.jsx(Lu,{}),s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold text-sm text-muted-foreground mb-3 flex items-center gap-2",children:[s.jsx(Qm,{className:"w-4 h-4"}),"Documents"]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[O.cv_url||O.cv_path?s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>R(O),children:[s.jsx(Gt,{className:"w-4 h-4 mr-2"}),"Voir le CV"]}):s.jsx("span",{className:"text-sm text-muted-foreground italic",children:"Aucun CV téléchargé"}),s.jsx(Le,{variant:O.cv_analyzed?"default":"secondary",children:O.cv_analyzed?"CV analysé":"CV non analysé"})]}),s.jsx("div",{className:"mt-3",children:s.jsx(uy,{query:O.name,title:"Documents liés (Drive PedagoBridge)",defaultOpen:!0})})]})]})]})]})]}),s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsx(Le,{variant:O.status==="approved"?"default":O.status==="pending"?"secondary":"destructive",children:O.status==="approved"?"Approuvé":O.status==="pending"?"En attente":"Rejeté"}),O.status==="pending"&&s.jsx(Le,{variant:"outline",className:`text-xs ${Qp[Xh(O)].className}`,title:Qp[Xh(O)].hint,children:Qp[Xh(O)].label}),O.status==="pending"&&a5(O.email)&&s.jsx(Le,{variant:"outline",className:"text-xs bg-red-100 text-red-700 border-red-300",children:"⚠ test/fake"}),!O.photo_url&&s.jsxs(Le,{variant:"outline",className:"text-xs bg-sky-100 text-sky-700 border-sky-300",title:"Ce formateur n'a pas encore de photo de profil",children:[s.jsx(BO,{className:"w-3 h-3 mr-1"}),"Sans photo"]})]})]}),O.bio&&s.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:O.bio}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:O.specialties.map((U,Y)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:U},Y))}),O.status==="approved"&&s.jsxs(vt,{to:"/admin/contracts",className:"block mb-4 p-3 bg-muted/50 border rounded-md hover:bg-muted/70 transition-colors group",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(zO,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary transition-colors"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("p",{className:"text-sm font-medium",children:["Contrat :"," ",O.contract?O.contract.status==="pending"?s.jsx("span",{className:"text-blue-600",children:"En attente de signature"}):s.jsxs("span",{className:"text-green-600",children:["Signé le ",new Date(O.contract.signed_at).toLocaleDateString("fr-FR")]}):s.jsx("span",{className:"text-amber-600",children:"Non généré"})]}),s.jsx(Le,{variant:"outline",className:"text-xs bg-muted",children:"Optionnel"}),s.jsx(vs,{className:"w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]}),O.contract&&O.contract.status==="pending"&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Créé le ",new Date(O.contract.created_at).toLocaleDateString("fr-FR")]})]}),s.jsx(Le,{variant:O.contract?O.contract.status==="pending"?"outline":"default":"secondary",className:O.contract?O.contract.status==="pending"?"border-blue-300 text-blue-700":"bg-green-100 text-green-700":"bg-amber-100 text-amber-700",children:O.contract?O.contract.status==="pending"?"À signer":"Signé":"Aucun"})]}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-2 ml-8",children:[s.jsx("strong",{children:"Avantages :"}),' Badge "Certifié PedagoBridge" visible sur le profil, priorité dans les recommandations, accès aux offres exclusives']})]}),O.pending_cv_url&&O.status==="approved"&&s.jsxs("div",{className:"mb-4 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-md",children:[s.jsx("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200 mb-2",children:"📄 Nouveau CV en attente de validation"}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsxs(ne,{size:"sm",onClick:()=>window.open(O.pending_cv_url,"_blank","noopener,noreferrer"),variant:"outline",children:[s.jsx(Gt,{className:"w-4 h-4 mr-2"}),"Voir le nouveau CV"]}),s.jsxs(ne,{size:"sm",onClick:()=>j(O.id,O.pending_cv_url),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(ma,{className:"w-4 h-4 mr-2"}),"Approuver"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>S(O.id),children:[s.jsx(Fs,{className:"w-4 h-4 mr-2"}),"Rejeter"]})]})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[(O.cv_url||O.cv_path)&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>R(O),children:[s.jsx(Gt,{className:"w-4 h-4 mr-2"}),"Voir le CV actuel"]}),s.jsx(_6e,{trainerId:O.id,trainerName:O.name}),s.jsx(C6e,{trainerId:O.id,trainerUserId:O.user_id,trainerName:O.name,trainerEmail:O.email}),s.jsx(m8e,{trainer:O,onUpdate:_}),s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>H(O),disabled:v===O.id,children:[v===O.id?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Ho,{className:"w-4 h-4 mr-2"}),"Export (ZIP + CSV)"]}),O.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>P(O.id,"approved"),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(ma,{className:"w-4 h-4 mr-2"}),"Approuver"]}),Xh(O)!=="hascv"&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>k(O),disabled:f===O.id,children:[f===O.id?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(ta,{className:"w-4 h-4 mr-2"}),"Relancer (compléter)"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>P(O.id,"rejected"),children:[s.jsx(Fs,{className:"w-4 h-4 mr-2"}),"Rejeter"]})]}),O.status==="rejected"&&s.jsxs(ne,{size:"sm",onClick:()=>P(O.id,"approved"),children:[s.jsx(ma,{className:"w-4 h-4 mr-2"}),"Approuver"]}),O.status==="approved"&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{size:"sm",variant:"outline",onClick:()=>P(O.id,"pending"),children:"Mettre en attente"}),(!O.contract||O.contract.status==="pending")&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>T(O.id,"contract"),disabled:u===`${O.id}-contract`,children:[u===`${O.id}-contract`?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(zO,{className:"w-4 h-4 mr-2"}),"Demander signature"]}),!O.photo_url&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>T(O.id,"photo"),disabled:u===`${O.id}-photo`,children:[u===`${O.id}-photo`?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(BO,{className:"w-4 h-4 mr-2"}),"Demander une photo"]}),!O.is_visible&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>T(O.id,"visibility"),disabled:u===`${O.id}-visibility`,children:[u===`${O.id}-visibility`?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(is,{className:"w-4 h-4 mr-2"}),"Demander visibilité"]})]}),s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsxs(ne,{size:"sm",variant:"destructive",disabled:y===O.id,children:[y===O.id?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(bi,{className:"w-4 h-4 mr-2"}),"Supprimer"]})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsxs(Yc,{children:["Supprimer ",O.name," ?"]}),s.jsxs(Xc,{children:["Cette action : envoie un dernier email l'informant de son retrait de la plateforme, ",s.jsx("strong",{children:"blackliste son adresse"})," (",O.email,") — il ne recevra plus jamais d'email de notre part — puis supprime son profil et son compte. Irréversible."]})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>I(O),children:"Supprimer définitivement"})]})]})]})]})]})]})})},O.id);return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsx(sa,{items:[{label:"Formateurs"}]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-3xl",children:"Gestion des Formateurs"})}),s.jsx(Ae,{children:s.jsxs(af,{value:l,onValueChange:c,children:[s.jsxs(ad,{className:"grid w-full grid-cols-4 mb-6",children:[s.jsxs(In,{value:"pending",children:["En attente (",q.length,")"]}),s.jsxs(In,{value:"approved",children:["Approuvés (",L.length,")"]}),s.jsxs(In,{value:"rejected",children:["Rejetés (",M.length,")"]}),s.jsxs(In,{value:"blacklist",children:[s.jsx(FO,{className:"w-4 h-4 mr-2"}),"Blacklist email"]})]}),s.jsxs(Es,{value:"pending",className:"space-y-4",children:[(q.length>0||E.length>0)&&s.jsx(ke,{className:"border-primary/20 bg-primary/5",children:s.jsxs(Ae,{className:"py-4",children:[s.jsxs("div",{className:"mb-3",children:[s.jsx("h3",{className:"font-semibold",children:"Campagne de relance — compléter le profil"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Relancez les inscriptions incomplètes par groupe, et demandez une photo aux profils qui n'en ont pas. Les comptes test/fake sont exclus automatiquement."})]}),s.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-3",children:[s.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[s.jsx(Le,{variant:"outline",className:`text-xs mb-2 ${Qp.hascv.className}`,children:Qp.hascv.label}),s.jsx("div",{className:"text-2xl font-bold",children:z("hascv")}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"À approuver individuellement ci-dessous."})]}),["started","empty"].map(O=>s.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[s.jsx(Le,{variant:"outline",className:`text-xs mb-2 ${Qp[O].className}`,children:Qp[O].label}),s.jsx("div",{className:"text-2xl font-bold",children:K(O).length}),s.jsxs(ne,{size:"sm",className:"mt-2 w-full",onClick:()=>V(O),disabled:h!==null||K(O).length===0,children:[h===O?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(ta,{className:"w-4 h-4 mr-2"}),"Relancer ces ",K(O).length]})]},O)),s.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[s.jsx(Le,{variant:"outline",className:"text-xs mb-2 bg-sky-100 text-sky-700 border-sky-300",children:"Sans photo de profil"}),s.jsx("div",{className:"text-2xl font-bold",children:E.length}),s.jsxs(ne,{size:"sm",className:"mt-2 w-full",onClick:C,disabled:p||E.length===0,children:[p?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(ta,{className:"w-4 h-4 mr-2"}),"Demander une photo"]})]})]})]})}),q.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun formateur en attente"}):q.map(O=>s.jsx(A,{trainer:O},O.id))]}),s.jsx(Es,{value:"approved",className:"space-y-4",children:L.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun formateur approuvé"}):L.map(O=>s.jsx(A,{trainer:O},O.id))}),s.jsx(Es,{value:"rejected",className:"space-y-4",children:M.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun formateur rejeté"}):M.map(O=>s.jsx(A,{trainer:O},O.id))}),s.jsx(Es,{value:"blacklist",children:s.jsx(p6e,{})})]})})]})]})})}var Ir=function(){return Ir=Object.assign||function(t){for(var r,n=1,a=arguments.length;n<a;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ir.apply(this,arguments)};function w8e(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function Nie(e,t,r){for(var n=0,a=t.length,i;n<a;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Qj(e){return e.mode==="multiple"}function e_(e){return e.mode==="range"}function YC(e){return e.mode==="single"}var j8e={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 _8e(e,t){return Ot(e,"LLLL y",t)}function N8e(e,t){return Ot(e,"d",t)}function S8e(e,t){return Ot(e,"LLLL",t)}function k8e(e){return"".concat(e)}function C8e(e,t){return Ot(e,"cccccc",t)}function E8e(e,t){return Ot(e,"yyyy",t)}var A8e=Object.freeze({__proto__:null,formatCaption:_8e,formatDay:N8e,formatMonthCaption:S8e,formatWeekNumber:k8e,formatWeekdayName:C8e,formatYearCaption:E8e}),T8e=function(e,t,r){return Ot(e,"do MMMM (EEEE)",r)},P8e=function(){return"Month: "},O8e=function(){return"Go to next month"},D8e=function(){return"Go to previous month"},I8e=function(e,t){return Ot(e,"cccc",t)},R8e=function(e){return"Week n. ".concat(e)},L8e=function(){return"Year: "},F8e=Object.freeze({__proto__:null,labelDay:T8e,labelMonthDropdown:P8e,labelNext:O8e,labelPrevious:D8e,labelWeekNumber:R8e,labelWeekday:I8e,labelYearDropdown:L8e});function M8e(){var e="buttons",t=j8e,r=xL,n={},a={},i=1,o={},l=new Date;return{captionLayout:e,classNames:t,formatters:A8e,labels:F8e,locale:r,modifiersClassNames:n,modifiers:a,numberOfMonths:i,styles:o,today:l,mode:"default"}}function $8e(e){var t=e.fromYear,r=e.toYear,n=e.fromMonth,a=e.toMonth,i=e.fromDate,o=e.toDate;return n?i=po(n):t&&(i=new Date(t,0,1)),a?o=Xj(a):r&&(o=new Date(r,11,31)),{fromDate:i?lg(i):void 0,toDate:o?lg(o):void 0}}var Sie=w.createContext(void 0);function B8e(e){var t,r=e.initialProps,n=M8e(),a=$8e(r),i=a.fromDate,o=a.toDate,l=(t=r.captionLayout)!==null&&t!==void 0?t:n.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var c;(YC(r)||Qj(r)||e_(r))&&(c=r.onSelect);var u=Ir(Ir(Ir({},n),r),{captionLayout:l,classNames:Ir(Ir({},n.classNames),r.classNames),components:Ir({},r.components),formatters:Ir(Ir({},n.formatters),r.formatters),fromDate:i,labels:Ir(Ir({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:Ir(Ir({},n.modifiers),r.modifiers),modifiersClassNames:Ir(Ir({},n.modifiersClassNames),r.modifiersClassNames),onSelect:c,styles:Ir(Ir({},n.styles),r.styles),toDate:o});return s.jsx(Sie.Provider,{value:u,children:e.children})}function Ts(){var e=w.useContext(Sie);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function kie(e){var t=Ts(),r=t.locale,n=t.classNames,a=t.styles,i=t.formatters.formatCaption;return s.jsx("div",{className:n.caption_label,style:a.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:i(e.displayMonth,{locale:r})})}function z8e(e){return s.jsx("svg",Ir({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:s.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Cie(e){var t,r,n=e.onChange,a=e.value,i=e.children,o=e.caption,l=e.className,c=e.style,u=Ts(),d=(r=(t=u.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&r!==void 0?r:z8e;return s.jsxs("div",{className:l,style:c,children:[s.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),s.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:a,onChange:n,children:i}),s.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[o,s.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function U8e(e){var t,r=Ts(),n=r.fromDate,a=r.toDate,i=r.styles,o=r.locale,l=r.formatters.formatMonthCaption,c=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!n)return s.jsx(s.Fragment,{});if(!a)return s.jsx(s.Fragment,{});var f=[];if(vke(n,a))for(var m=po(n),h=n.getMonth();h<=a.getMonth();h++)f.push(K3(m,h));else for(var m=po(new Date),h=0;h<=11;h++)f.push(K3(m,h));var g=function(x){var v=Number(x.target.value),b=K3(po(e.displayMonth),v);e.onChange(b)},p=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:Cie;return s.jsx(p,{name:"months","aria-label":d(),className:c.dropdown_month,style:i.dropdown_month,onChange:g,value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:o}),children:f.map(function(x){return s.jsx("option",{value:x.getMonth(),children:l(x,{locale:o})},x.getMonth())})})}function q8e(e){var t,r=e.displayMonth,n=Ts(),a=n.fromDate,i=n.toDate,o=n.locale,l=n.styles,c=n.classNames,u=n.components,d=n.formatters.formatYearCaption,f=n.labels.labelYearDropdown,m=[];if(!a)return s.jsx(s.Fragment,{});if(!i)return s.jsx(s.Fragment,{});for(var h=a.getFullYear(),g=i.getFullYear(),p=h;p<=g;p++)m.push(az(dne(new Date),p));var x=function(b){var y=az(po(r),Number(b.target.value));e.onChange(y)},v=(t=u==null?void 0:u.Dropdown)!==null&&t!==void 0?t:Cie;return s.jsx(v,{name:"years","aria-label":f(),className:c.dropdown_year,style:l.dropdown_year,onChange:x,value:r.getFullYear(),caption:d(r,{locale:o}),children:m.map(function(b){return s.jsx("option",{value:b.getFullYear(),children:d(b,{locale:o})},b.getFullYear())})})}function V8e(e,t){var r=w.useState(e),n=r[0],a=r[1],i=t===void 0?n:t;return[i,a]}function W8e(e){var t=e.month,r=e.defaultMonth,n=e.today,a=t||r||n||new Date,i=e.toDate,o=e.fromDate,l=e.numberOfMonths,c=l===void 0?1:l;if(i&&oy(i,a)<0){var u=-1*(c-1);a=sc(i,u)}return o&&oy(a,o)<0&&(a=o),po(a)}function H8e(){var e=Ts(),t=W8e(e),r=V8e(t,e.month),n=r[0],a=r[1],i=function(o){var l;if(!e.disableNavigation){var c=po(o);a(c),(l=e.onMonthChange)===null||l===void 0||l.call(e,c)}};return[n,i]}function G8e(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,a=po(e),i=po(sc(a,n)),o=oy(i,a),l=[],c=0;c<o;c++){var u=sc(a,c);l.push(u)}return r&&(l=l.reverse()),l}function K8e(e,t){if(!t.disableNavigation){var r=t.toDate,n=t.pagedNavigation,a=t.numberOfMonths,i=a===void 0?1:a,o=n?i:1,l=po(e);if(!r)return sc(l,o);var c=oy(r,e);if(!(c<i))return sc(l,o)}}function Y8e(e,t){if(!t.disableNavigation){var r=t.fromDate,n=t.pagedNavigation,a=t.numberOfMonths,i=a===void 0?1:a,o=n?i:1,l=po(e);if(!r)return sc(l,-o);var c=oy(l,r);if(!(c<=0))return sc(l,-o)}}var Eie=w.createContext(void 0);function X8e(e){var t=Ts(),r=H8e(),n=r[0],a=r[1],i=G8e(n,t),o=K8e(n,t),l=Y8e(n,t),c=function(f){return i.some(function(m){return IC(f,m)})},u=function(f,m){c(f)||(m&&vne(f,m)?a(sc(f,1+t.numberOfMonths*-1)):a(f))},d={currentMonth:n,displayMonths:i,goToMonth:a,goToDate:u,previousMonth:l,nextMonth:o,isDateDisplayed:c};return s.jsx(Eie.Provider,{value:d,children:e.children})}function t_(){var e=w.useContext(Eie);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Uz(e){var t,r=Ts(),n=r.classNames,a=r.styles,i=r.components,o=t_().goToMonth,l=function(d){o(sc(d,e.displayIndex?-e.displayIndex:0))},c=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:kie,u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth});return s.jsxs("div",{className:n.caption_dropdowns,style:a.caption_dropdowns,children:[s.jsx("div",{className:n.vhidden,children:u}),s.jsx(U8e,{onChange:l,displayMonth:e.displayMonth}),s.jsx(q8e,{onChange:l,displayMonth:e.displayMonth})]})}function Z8e(e){return s.jsx("svg",Ir({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.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 J8e(e){return s.jsx("svg",Ir({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:s.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 o4=w.forwardRef(function(e,t){var r=Ts(),n=r.classNames,a=r.styles,i=[n.button_reset,n.button];e.className&&i.push(e.className);var o=i.join(" "),l=Ir(Ir({},a.button_reset),a.button);return e.style&&Object.assign(l,e.style),s.jsx("button",Ir({},e,{ref:t,type:"button",className:o,style:l}))});function Q8e(e){var t,r,n=Ts(),a=n.dir,i=n.locale,o=n.classNames,l=n.styles,c=n.labels,u=c.labelPrevious,d=c.labelNext,f=n.components;if(!e.nextMonth&&!e.previousMonth)return s.jsx(s.Fragment,{});var m=u(e.previousMonth,{locale:i}),h=[o.nav_button,o.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:i}),p=[o.nav_button,o.nav_button_next].join(" "),x=(t=f==null?void 0:f.IconRight)!==null&&t!==void 0?t:J8e,v=(r=f==null?void 0:f.IconLeft)!==null&&r!==void 0?r:Z8e;return s.jsxs("div",{className:o.nav,style:l.nav,children:[!e.hidePrevious&&s.jsx(o4,{name:"previous-month","aria-label":m,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:a==="rtl"?s.jsx(x,{className:o.nav_icon,style:l.nav_icon}):s.jsx(v,{className:o.nav_icon,style:l.nav_icon})}),!e.hideNext&&s.jsx(o4,{name:"next-month","aria-label":g,className:p,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:a==="rtl"?s.jsx(v,{className:o.nav_icon,style:l.nav_icon}):s.jsx(x,{className:o.nav_icon,style:l.nav_icon})})]})}function qz(e){var t=Ts().numberOfMonths,r=t_(),n=r.previousMonth,a=r.nextMonth,i=r.goToMonth,o=r.displayMonths,l=o.findIndex(function(g){return IC(e.displayMonth,g)}),c=l===0,u=l===o.length-1,d=t>1&&(c||!u),f=t>1&&(u||!c),m=function(){n&&i(n)},h=function(){a&&i(a)};return s.jsx(Q8e,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:a,previousMonth:n,onPreviousClick:m,onNextClick:h})}function eDe(e){var t,r=Ts(),n=r.classNames,a=r.disableNavigation,i=r.styles,o=r.captionLayout,l=r.components,c=(t=l==null?void 0:l.CaptionLabel)!==null&&t!==void 0?t:kie,u;return a?u=s.jsx(c,{id:e.id,displayMonth:e.displayMonth}):o==="dropdown"?u=s.jsx(Uz,{displayMonth:e.displayMonth,id:e.id}):o==="dropdown-buttons"?u=s.jsxs(s.Fragment,{children:[s.jsx(Uz,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),s.jsx(qz,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):u=s.jsxs(s.Fragment,{children:[s.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(qz,{displayMonth:e.displayMonth,id:e.id})]}),s.jsx("div",{className:n.caption,style:i.caption,children:u})}function tDe(e){var t=Ts(),r=t.footer,n=t.styles,a=t.classNames.tfoot;return r?s.jsx("tfoot",{className:a,style:n.tfoot,children:s.jsx("tr",{children:s.jsx("td",{colSpan:8,children:r})})}):s.jsx(s.Fragment,{})}function rDe(e,t,r){for(var n=r?og(new Date):Ju(new Date,{locale:e,weekStartsOn:t}),a=[],i=0;i<7;i++){var o=Oo(n,i);a.push(o)}return a}function nDe(){var e=Ts(),t=e.classNames,r=e.styles,n=e.showWeekNumber,a=e.locale,i=e.weekStartsOn,o=e.ISOWeek,l=e.formatters.formatWeekdayName,c=e.labels.labelWeekday,u=rDe(a,i,o);return s.jsxs("tr",{style:r.head_row,className:t.head_row,children:[n&&s.jsx("td",{style:r.head_cell,className:t.head_cell}),u.map(function(d,f){return s.jsx("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":c(d,{locale:a}),children:l(d,{locale:a})},f)})]})}function sDe(){var e,t=Ts(),r=t.classNames,n=t.styles,a=t.components,i=(e=a==null?void 0:a.HeadRow)!==null&&e!==void 0?e:nDe;return s.jsx("thead",{style:n.head,className:r.head,children:s.jsx(i,{})})}function aDe(e){var t=Ts(),r=t.locale,n=t.formatters.formatDay;return s.jsx(s.Fragment,{children:n(e.date,{locale:r})})}var ML=w.createContext(void 0);function iDe(e){if(!Qj(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return s.jsx(ML.Provider,{value:t,children:e.children})}return s.jsx(oDe,{initialProps:e.initialProps,children:e.children})}function oDe(e){var t=e.initialProps,r=e.children,n=t.selected,a=t.min,i=t.max,o=function(u,d,f){var m,h;(m=t.onDayClick)===null||m===void 0||m.call(t,u,d,f);var g=!!(d.selected&&a&&(n==null?void 0:n.length)===a);if(!g){var p=!!(!d.selected&&i&&(n==null?void 0:n.length)===i);if(!p){var x=n?Nie([],n):[];if(d.selected){var v=x.findIndex(function(b){return Lo(u,b)});x.splice(v,1)}else x.push(u);(h=t.onSelect)===null||h===void 0||h.call(t,x,u,d,f)}}},l={disabled:[]};n&&l.disabled.push(function(u){var d=i&&n.length>i-1,f=n.some(function(m){return Lo(m,u)});return!!(d&&!f)});var c={selected:n,onDayClick:o,modifiers:l};return s.jsx(ML.Provider,{value:c,children:r})}function $L(){var e=w.useContext(ML);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function lDe(e,t){var r=t||{},n=r.from,a=r.to;return n&&a?Lo(a,e)&&Lo(n,e)?void 0:Lo(a,e)?{from:a,to:void 0}:Lo(n,e)?void 0:D6(n,e)?{from:e,to:a}:{from:n,to:e}:a?D6(e,a)?{from:a,to:e}:{from:e,to:a}:n?vne(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var BL=w.createContext(void 0);function cDe(e){if(!e_(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return s.jsx(BL.Provider,{value:t,children:e.children})}return s.jsx(uDe,{initialProps:e.initialProps,children:e.children})}function uDe(e){var t=e.initialProps,r=e.children,n=t.selected,a=n||{},i=a.from,o=a.to,l=t.min,c=t.max,u=function(h,g,p){var x,v;(x=t.onDayClick)===null||x===void 0||x.call(t,h,g,p);var b=lDe(h,n);(v=t.onSelect)===null||v===void 0||v.call(t,b,h,g,p)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(d.range_start=[i],o?(d.range_end=[o],Lo(i,o)||(d.range_middle=[{after:i,before:o}])):d.range_end=[i]):o&&(d.range_start=[o],d.range_end=[o]),l&&(i&&!o&&d.disabled.push({after:M0(i,l-1),before:Oo(i,l-1)}),i&&o&&d.disabled.push({after:i,before:Oo(i,l-1)}),!i&&o&&d.disabled.push({after:M0(o,l-1),before:Oo(o,l-1)})),c){if(i&&!o&&(d.disabled.push({before:Oo(i,-c+1)}),d.disabled.push({after:Oo(i,c-1)})),i&&o){var f=Ld(o,i)+1,m=c-f;d.disabled.push({before:M0(i,m)}),d.disabled.push({after:Oo(o,m)})}!i&&o&&(d.disabled.push({before:Oo(o,-c+1)}),d.disabled.push({after:Oo(o,c-1)}))}return s.jsx(BL.Provider,{value:{selected:n,onDayClick:u,modifiers:d},children:r})}function zL(){var e=w.useContext(BL);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function i5(e){return Array.isArray(e)?Nie([],e):e!==void 0?[e]:[]}function dDe(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],a=r[1];t[n]=i5(a)}),t}var Qu;(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"})(Qu||(Qu={}));var fDe=Qu.Selected,Tf=Qu.Disabled,hDe=Qu.Hidden,mDe=Qu.Today,sT=Qu.RangeEnd,aT=Qu.RangeMiddle,iT=Qu.RangeStart,pDe=Qu.Outside;function gDe(e,t,r){var n,a=(n={},n[fDe]=i5(e.selected),n[Tf]=i5(e.disabled),n[hDe]=i5(e.hidden),n[mDe]=[e.today],n[sT]=[],n[aT]=[],n[iT]=[],n[pDe]=[],n);return e.fromDate&&a[Tf].push({before:e.fromDate}),e.toDate&&a[Tf].push({after:e.toDate}),Qj(e)?a[Tf]=a[Tf].concat(t.modifiers[Tf]):e_(e)&&(a[Tf]=a[Tf].concat(r.modifiers[Tf]),a[iT]=r.modifiers[iT],a[aT]=r.modifiers[aT],a[sT]=r.modifiers[sT]),a}var Aie=w.createContext(void 0);function xDe(e){var t=Ts(),r=$L(),n=zL(),a=gDe(t,r,n),i=dDe(t.modifiers),o=Ir(Ir({},a),i);return s.jsx(Aie.Provider,{value:o,children:e.children})}function Tie(){var e=w.useContext(Aie);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function vDe(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function yDe(e){return!!(e&&typeof e=="object"&&"from"in e)}function bDe(e){return!!(e&&typeof e=="object"&&"after"in e)}function wDe(e){return!!(e&&typeof e=="object"&&"before"in e)}function jDe(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function _De(e,t){var r,n=t.from,a=t.to;if(n&&a){var i=Ld(a,n)<0;i&&(r=[a,n],n=r[0],a=r[1]);var o=Ld(e,n)>=0&&Ld(a,e)>=0;return o}return a?Lo(a,e):n?Lo(n,e):!1}function NDe(e){return gL(e)}function SDe(e){return Array.isArray(e)&&e.every(gL)}function kDe(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(NDe(r))return Lo(e,r);if(SDe(r))return r.includes(e);if(yDe(r))return _De(e,r);if(jDe(r))return r.dayOfWeek.includes(e.getDay());if(vDe(r)){var n=Ld(r.before,e),a=Ld(r.after,e),i=n>0,o=a<0,l=D6(r.before,r.after);return l?o&&i:i||o}return bDe(r)?Ld(e,r.after)>0:wDe(r)?Ld(r.before,e)>0:typeof r=="function"?r(e):!1})}function UL(e,t,r){var n=Object.keys(t).reduce(function(i,o){var l=t[o];return kDe(e,l)&&i.push(o),i},[]),a={};return n.forEach(function(i){return a[i]=!0}),r&&!IC(e,r)&&(a.outside=!0),a}function CDe(e,t){for(var r=po(e[0]),n=Xj(e[e.length-1]),a,i,o=r;o<=n;){var l=UL(o,t),c=!l.disabled&&!l.hidden;if(!c){o=Oo(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),a||(a=o),o=Oo(o,1)}return i||a}var EDe=365;function Pie(e,t){var r=t.moveBy,n=t.direction,a=t.context,i=t.modifiers,o=t.retry,l=o===void 0?{count:0,lastFocused:e}:o,c=a.weekStartsOn,u=a.fromDate,d=a.toDate,f=a.locale,m={day:Oo,week:O6,month:sc,year:i4e,startOfWeek:function(x){return a.ISOWeek?og(x):Ju(x,{locale:f,weekStartsOn:c})},endOfWeek:function(x){return a.ISOWeek?fne(x):DC(x,{locale:f,weekStartsOn:c})}},h=m[r](e,n==="after"?1:-1);n==="before"&&u?h=o4e([u,h]):n==="after"&&d&&(h=l4e([d,h]));var g=!0;if(i){var p=UL(h,i);g=!p.disabled&&!p.hidden}return g?h:l.count>EDe?l.lastFocused:Pie(h,{moveBy:r,direction:n,context:a,modifiers:i,retry:Ir(Ir({},l),{count:l.count+1})})}var Oie=w.createContext(void 0);function ADe(e){var t=t_(),r=Tie(),n=w.useState(),a=n[0],i=n[1],o=w.useState(),l=o[0],c=o[1],u=CDe(t.displayMonths,r),d=a??(l&&t.isDateDisplayed(l))?l:u,f=function(){c(a),i(void 0)},m=function(x){i(x)},h=Ts(),g=function(x,v){if(a){var b=Pie(a,{moveBy:x,direction:v,context:h,modifiers:r});Lo(a,b)||(t.goToDate(b,a),m(b))}},p={focusedDay:a,focusTarget:d,blur:f,focus:m,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}};return s.jsx(Oie.Provider,{value:p,children:e.children})}function qL(){var e=w.useContext(Oie);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function TDe(e,t){var r=Tie(),n=UL(e,r,t);return n}var VL=w.createContext(void 0);function PDe(e){if(!YC(e.initialProps)){var t={selected:void 0};return s.jsx(VL.Provider,{value:t,children:e.children})}return s.jsx(ODe,{initialProps:e.initialProps,children:e.children})}function ODe(e){var t=e.initialProps,r=e.children,n=function(i,o,l){var c,u,d;if((c=t.onDayClick)===null||c===void 0||c.call(t,i,o,l),o.selected&&!t.required){(u=t.onSelect)===null||u===void 0||u.call(t,void 0,i,o,l);return}(d=t.onSelect)===null||d===void 0||d.call(t,i,i,o,l)},a={selected:t.selected,onDayClick:n};return s.jsx(VL.Provider,{value:a,children:r})}function Die(){var e=w.useContext(VL);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function DDe(e,t){var r=Ts(),n=Die(),a=$L(),i=zL(),o=qL(),l=o.focusDayAfter,c=o.focusDayBefore,u=o.focusWeekAfter,d=o.focusWeekBefore,f=o.blur,m=o.focus,h=o.focusMonthBefore,g=o.focusMonthAfter,p=o.focusYearBefore,x=o.focusYearAfter,v=o.focusStartOfWeek,b=o.focusEndOfWeek,y=function(q){var L,M,z,K;YC(r)?(L=n.onDayClick)===null||L===void 0||L.call(n,e,t,q):Qj(r)?(M=a.onDayClick)===null||M===void 0||M.call(a,e,t,q):e_(r)?(z=i.onDayClick)===null||z===void 0||z.call(i,e,t,q):(K=r.onDayClick)===null||K===void 0||K.call(r,e,t,q)},N=function(q){var L;m(e),(L=r.onDayFocus)===null||L===void 0||L.call(r,e,t,q)},_=function(q){var L;f(),(L=r.onDayBlur)===null||L===void 0||L.call(r,e,t,q)},j=function(q){var L;(L=r.onDayMouseEnter)===null||L===void 0||L.call(r,e,t,q)},S=function(q){var L;(L=r.onDayMouseLeave)===null||L===void 0||L.call(r,e,t,q)},I=function(q){var L;(L=r.onDayPointerEnter)===null||L===void 0||L.call(r,e,t,q)},P=function(q){var L;(L=r.onDayPointerLeave)===null||L===void 0||L.call(r,e,t,q)},F=function(q){var L;(L=r.onDayTouchCancel)===null||L===void 0||L.call(r,e,t,q)},T=function(q){var L;(L=r.onDayTouchEnd)===null||L===void 0||L.call(r,e,t,q)},k=function(q){var L;(L=r.onDayTouchMove)===null||L===void 0||L.call(r,e,t,q)},V=function(q){var L;(L=r.onDayTouchStart)===null||L===void 0||L.call(r,e,t,q)},C=function(q){var L;(L=r.onDayKeyUp)===null||L===void 0||L.call(r,e,t,q)},R=function(q){var L;switch(q.key){case"ArrowLeft":q.preventDefault(),q.stopPropagation(),r.dir==="rtl"?l():c();break;case"ArrowRight":q.preventDefault(),q.stopPropagation(),r.dir==="rtl"?c():l();break;case"ArrowDown":q.preventDefault(),q.stopPropagation(),u();break;case"ArrowUp":q.preventDefault(),q.stopPropagation(),d();break;case"PageUp":q.preventDefault(),q.stopPropagation(),q.shiftKey?p():h();break;case"PageDown":q.preventDefault(),q.stopPropagation(),q.shiftKey?x():g();break;case"Home":q.preventDefault(),q.stopPropagation(),v();break;case"End":q.preventDefault(),q.stopPropagation(),b();break}(L=r.onDayKeyDown)===null||L===void 0||L.call(r,e,t,q)},H={onClick:y,onFocus:N,onBlur:_,onKeyDown:R,onKeyUp:C,onMouseEnter:j,onMouseLeave:S,onPointerEnter:I,onPointerLeave:P,onTouchCancel:F,onTouchEnd:T,onTouchMove:k,onTouchStart:V};return H}function IDe(){var e=Ts(),t=Die(),r=$L(),n=zL(),a=YC(e)?t.selected:Qj(e)?r.selected:e_(e)?n.selected:void 0;return a}function RDe(e){return Object.values(Qu).includes(e)}function LDe(e,t){var r=[e.classNames.day];return Object.keys(t).forEach(function(n){var a=e.modifiersClassNames[n];if(a)r.push(a);else if(RDe(n)){var i=e.classNames["day_".concat(n)];i&&r.push(i)}}),r}function FDe(e,t){var r=Ir({},e.styles.day);return Object.keys(t).forEach(function(n){var a;r=Ir(Ir({},r),(a=e.modifiersStyles)===null||a===void 0?void 0:a[n])}),r}function MDe(e,t,r){var n,a,i,o=Ts(),l=qL(),c=TDe(e,t),u=DDe(e,c),d=IDe(),f=!!(o.onDayClick||o.mode!=="default");w.useEffect(function(){var j;c.outside||l.focusedDay&&f&&Lo(l.focusedDay,e)&&((j=r.current)===null||j===void 0||j.focus())},[l.focusedDay,e,r,f,c.outside]);var m=LDe(o,c).join(" "),h=FDe(o,c),g=!!(c.outside&&!o.showOutsideDays||c.hidden),p=(i=(a=o.components)===null||a===void 0?void 0:a.DayContent)!==null&&i!==void 0?i:aDe,x=s.jsx(p,{date:e,displayMonth:t,activeModifiers:c}),v={style:h,className:m,children:x,role:"gridcell"},b=l.focusTarget&&Lo(l.focusTarget,e)&&!c.outside,y=l.focusedDay&&Lo(l.focusedDay,e),N=Ir(Ir(Ir({},v),(n={disabled:c.disabled,role:"gridcell"},n["aria-selected"]=c.selected,n.tabIndex=y||b?0:-1,n)),u),_={isButton:f,isHidden:g,activeModifiers:c,selectedDays:d,buttonProps:N,divProps:v};return _}function $De(e){var t=w.useRef(null),r=MDe(e.date,e.displayMonth,t);return r.isHidden?s.jsx("div",{role:"gridcell"}):r.isButton?s.jsx(o4,Ir({name:"day",ref:t},r.buttonProps)):s.jsx("div",Ir({},r.divProps))}function BDe(e){var t=e.number,r=e.dates,n=Ts(),a=n.onWeekNumberClick,i=n.styles,o=n.classNames,l=n.locale,c=n.labels.labelWeekNumber,u=n.formatters.formatWeekNumber,d=u(Number(t),{locale:l});if(!a)return s.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:d});var f=c(Number(t),{locale:l}),m=function(h){a(t,r,h)};return s.jsx(o4,{name:"week-number","aria-label":f,className:o.weeknumber,style:i.weeknumber,onClick:m,children:d})}function zDe(e){var t,r,n=Ts(),a=n.styles,i=n.classNames,o=n.showWeekNumber,l=n.components,c=(t=l==null?void 0:l.Day)!==null&&t!==void 0?t:$De,u=(r=l==null?void 0:l.WeekNumber)!==null&&r!==void 0?r:BDe,d;return o&&(d=s.jsx("td",{className:i.cell,style:a.cell,children:s.jsx(u,{number:e.weekNumber,dates:e.dates})})),s.jsxs("tr",{className:i.row,style:a.row,children:[d,e.dates.map(function(f){return s.jsx("td",{className:i.cell,style:a.cell,role:"presentation",children:s.jsx(c,{displayMonth:e.displayMonth,date:f})},pke(f))})]})}function Vz(e,t,r){for(var n=r!=null&&r.ISOWeek?fne(t):DC(t,r),a=r!=null&&r.ISOWeek?og(e):Ju(e,r),i=Ld(n,a),o=[],l=0;l<=i;l++)o.push(Oo(a,l));var c=o.reduce(function(u,d){var f=r!=null&&r.ISOWeek?mne(d):gne(d,r),m=u.find(function(h){return h.weekNumber===f});return m?(m.dates.push(d),u):(u.push({weekNumber:f,dates:[d]}),u)},[]);return c}function UDe(e,t){var r=Vz(po(e),Xj(e),t);if(t!=null&&t.useFixedWeeks){var n=xke(e,t);if(n<6){var a=r[r.length-1],i=a.dates[a.dates.length-1],o=O6(i,6-n),l=Vz(O6(i,1),o,t);r.push.apply(r,l)}}return r}function qDe(e){var t,r,n,a=Ts(),i=a.locale,o=a.classNames,l=a.styles,c=a.hideHead,u=a.fixedWeeks,d=a.components,f=a.weekStartsOn,m=a.firstWeekContainsDate,h=a.ISOWeek,g=UDe(e.displayMonth,{useFixedWeeks:!!u,ISOWeek:h,locale:i,weekStartsOn:f,firstWeekContainsDate:m}),p=(t=d==null?void 0:d.Head)!==null&&t!==void 0?t:sDe,x=(r=d==null?void 0:d.Row)!==null&&r!==void 0?r:zDe,v=(n=d==null?void 0:d.Footer)!==null&&n!==void 0?n:tDe;return s.jsxs("table",{id:e.id,className:o.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&s.jsx(p,{}),s.jsx("tbody",{className:o.tbody,style:l.tbody,children:g.map(function(b){return s.jsx(x,{displayMonth:e.displayMonth,dates:b.dates,weekNumber:b.weekNumber},b.weekNumber)})}),s.jsx(v,{displayMonth:e.displayMonth})]})}function VDe(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var WDe=VDe()?w.useLayoutEffect:w.useEffect,oT=!1,HDe=0;function Wz(){return"react-day-picker-".concat(++HDe)}function GDe(e){var t,r=e??(oT?Wz():null),n=w.useState(r),a=n[0],i=n[1];return WDe(function(){a===null&&i(Wz())},[]),w.useEffect(function(){oT===!1&&(oT=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function KDe(e){var t,r,n=Ts(),a=n.dir,i=n.classNames,o=n.styles,l=n.components,c=t_().displayMonths,u=GDe(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),d=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[i.month],m=o.month,h=e.displayIndex===0,g=e.displayIndex===c.length-1,p=!h&&!g;a==="rtl"&&(t=[h,g],g=t[0],h=t[1]),h&&(f.push(i.caption_start),m=Ir(Ir({},m),o.caption_start)),g&&(f.push(i.caption_end),m=Ir(Ir({},m),o.caption_end)),p&&(f.push(i.caption_between),m=Ir(Ir({},m),o.caption_between));var x=(r=l==null?void 0:l.Caption)!==null&&r!==void 0?r:eDe;return s.jsxs("div",{className:f.join(" "),style:m,children:[s.jsx(x,{id:u,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),s.jsx(qDe,{id:d,"aria-labelledby":u,displayMonth:e.displayMonth})]},e.displayIndex)}function YDe(e){var t=Ts(),r=t.classNames,n=t.styles;return s.jsx("div",{className:r.months,style:n.months,children:e.children})}function XDe(e){var t,r,n=e.initialProps,a=Ts(),i=qL(),o=t_(),l=w.useState(!1),c=l[0],u=l[1];w.useEffect(function(){a.initialFocus&&i.focusTarget&&(c||(i.focus(i.focusTarget),u(!0)))},[a.initialFocus,c,i.focus,i.focusTarget,i]);var d=[a.classNames.root,a.className];a.numberOfMonths>1&&d.push(a.classNames.multiple_months),a.showWeekNumber&&d.push(a.classNames.with_weeknumber);var f=Ir(Ir({},a.styles.root),a.style),m=Object.keys(n).filter(function(g){return g.startsWith("data-")}).reduce(function(g,p){var x;return Ir(Ir({},g),(x={},x[p]=n[p],x))},{}),h=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:YDe;return s.jsx("div",Ir({className:d.join(" "),style:f,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},m,{children:s.jsx(h,{children:o.displayMonths.map(function(g,p){return s.jsx(KDe,{displayIndex:p,displayMonth:g},p)})})}))}function ZDe(e){var t=e.children,r=w8e(e,["children"]);return s.jsx(B8e,{initialProps:r,children:s.jsx(X8e,{children:s.jsx(PDe,{initialProps:r,children:s.jsx(iDe,{initialProps:r,children:s.jsx(cDe,{initialProps:r,children:s.jsx(xDe,{children:s.jsx(ADe,{children:t})})})})})})})}function JDe(e){return s.jsx(ZDe,Ir({},e,{children:s.jsx(XDe,{initialProps:e})}))}function Iie({className:e,classNames:t,showOutsideDays:r=!0,...n}){return s.jsx(JDe,{showOutsideDays:r,className:pt("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-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:pt(p2({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:pt(p2({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})=>s.jsx(eC,{className:"h-4 w-4"}),IconRight:({...a})=>s.jsx(tu,{className:"h-4 w-4"})},...n})}Iie.displayName="Calendar";function QDe(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(""),[h,g]=w.useState(""),[p,x]=w.useState(""),[v,b]=w.useState(""),[y,N]=w.useState(""),[_,j]=w.useState("1500"),[S,I]=w.useState();w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&(P(),F())},[t]);const P=async()=>{try{const{data:R,error:H}=await he.from("editorial_calendar").select("*, blog_categories(name)").order("scheduled_date",{ascending:!0});if(H)throw H;o(R||[])}catch(R){console.error("Error loading calendar:",R),ae.error("Erreur lors du chargement du calendrier")}finally{a(!1)}},F=async()=>{try{const{data:R,error:H}=await he.from("blog_categories").select("*").order("name");if(H)throw H;c(R||[])}catch(R){console.error("Error loading categories:",R)}},T=async()=>{if(!f.trim()||!h.trim()||!S){ae.error("Veuillez remplir tous les champs requis");return}try{const{error:R}=await he.from("editorial_calendar").insert({title:f,topic:h,description:p||null,keywords:v?v.split(",").map(H=>H.trim()):null,category_id:y||null,target_word_count:parseInt(_),scheduled_date:Ot(S,"yyyy-MM-dd"),status:"planned"});if(R)throw R;ae.success("Entrée ajoutée au calendrier"),d(!1),V(),P()}catch(R){console.error("Error adding entry:",R),ae.error("Erreur lors de l'ajout")}},k=async R=>{if(confirm("Êtes-vous sûr de vouloir supprimer cette entrée ?"))try{const{error:H}=await he.from("editorial_calendar").delete().eq("id",R);if(H)throw H;ae.success("Entrée supprimée"),P()}catch(H){console.error("Error deleting entry:",H),ae.error("Erreur lors de la suppression")}},V=()=>{m(""),g(""),x(""),b(""),N(""),j("1500"),I(void 0)};if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});const C=R=>{switch(R){case"planned":return"secondary";case"generated":return"default";case"published":return"outline";default:return"secondary"}};return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-6xl mx-auto",children:[s.jsx(sa,{items:[{label:"Blog",href:"/admin/blog"},{label:"Calendrier Éditorial"}]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-4xl font-bold",children:"Calendrier Éditorial"}),s.jsx("p",{className:"text-muted-foreground mt-2",children:"Les articles seront générés automatiquement 1 jour avant la date prévue"})]}),s.jsx("div",{children:s.jsxs(Hn,{open:u,onOpenChange:d,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Planifier un article"]})}),s.jsxs(qn,{className:"max-w-2xl",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Planifier un nouvel article"}),s.jsx(Ia,{children:"L'article sera généré automatiquement par IA et publié à la date prévue"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"title",children:"Titre de l'article *"}),s.jsx(Ye,{id:"title",value:f,onChange:R=>m(R.target.value),placeholder:"Ex: Les nouvelles tendances de la formation"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"topic",children:"Sujet détaillé *"}),s.jsx(gn,{id:"topic",value:h,onChange:R=>g(R.target.value),placeholder:"Décrivez le sujet de l'article en détail",rows:3})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"description",children:"Description (optionnel)"}),s.jsx(gn,{id:"description",value:p,onChange:R=>x(R.target.value),placeholder:"Notes additionnelles",rows:2})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"keywords",children:"Mots-clés (séparés par virgule) *"}),s.jsx(Ye,{id:"keywords",value:v,onChange:R=>b(R.target.value),placeholder:"formation, compétences, apprentissage"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"category",children:"Catégorie"}),s.jsxs(Lr,{value:y,onValueChange:N,children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Sélectionner une catégorie"})}),s.jsx(Tr,{children:l.map(R=>s.jsx(ot,{value:R.id,children:R.name},R.id))})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"wordCount",children:"Nombre de mots cible"}),s.jsx(Ye,{id:"wordCount",type:"number",value:_,onChange:R=>j(R.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Date de publication *"}),s.jsxs(rp,{children:[s.jsx(np,{asChild:!0,children:s.jsxs(ne,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[s.jsx(Bs,{className:"mr-2 h-4 w-4"}),S?Ot(S,"PPP",{locale:yr}):"Sélectionner une date"]})}),s.jsx(fh,{className:"w-auto p-0",children:s.jsx(Iie,{mode:"single",selected:S,onSelect:I,initialFocus:!0})})]})]}),s.jsxs(ne,{onClick:T,className:"w-full",children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Ajouter au calendrier"]})]})]})]})})]}),s.jsxs("div",{className:"space-y-4",children:[i.map(R=>s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx("div",{className:"flex items-start justify-between",children:s.jsxs("div",{className:"flex-1",children:[s.jsx(xt,{className:"mb-2",children:R.title}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[R.blog_categories&&s.jsx(Le,{variant:"secondary",children:R.blog_categories.name}),s.jsx(Le,{variant:C(R.status),children:R.status}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-4 w-4"}),Ot(new Date(R.scheduled_date),"d MMM yyyy",{locale:yr})]})]})]})})}),s.jsxs(Ae,{children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:R.topic}),R.keywords&&s.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:R.keywords.map((H,q)=>s.jsx(Le,{variant:"outline",children:H},q))}),s.jsxs("div",{className:"flex gap-2",children:[R.post_id&&s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>e(`/admin/blog/edit/${R.post_id}`),children:"Voir l'article"}),s.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>k(R.id),children:[s.jsx(bi,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})]},R.id)),i.length===0&&s.jsx(ke,{children:s.jsx(Ae,{className:"text-center py-12",children:s.jsx("p",{className:"text-muted-foreground",children:"Aucune entrée dans le calendrier. Ajoutez-en une pour commencer !"})})})]})]})})}function eIe(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(!1),[h,g]=w.useState(""),[p,x]=w.useState(""),[v,b]=w.useState("now"),[y,N]=w.useState("all");w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&_()},[t]);const _=async()=>{try{const[F,T]=await Promise.all([he.from("newsletter_subscribers").select("*").order("subscribed_at",{ascending:!1}),he.from("newsletter_sends").select("*, blog_posts(title, slug)").order("sent_at",{ascending:!1}).limit(10)]);if(F.error)throw F.error;if(T.error)throw T.error;o(F.data||[]),c(T.data||[])}catch(F){console.error("Error loading data:",F),ae.error("Erreur lors du chargement des données")}finally{a(!1)}},j=async F=>{if(confirm("Êtes-vous sûr de vouloir supprimer cet abonné ?"))try{const{error:T}=await he.from("newsletter_subscribers").delete().eq("id",F);if(T)throw T;ae.success("Abonné supprimé"),_()}catch(T){console.error("Error deleting subscriber:",T),ae.error("Erreur lors de la suppression")}},S=async()=>{if(!h.trim()||!p.trim()){ae.error("Veuillez remplir le sujet et le contenu");return}const F=i.filter(T=>T.is_active&&T.confirmed);if(F.length===0){ae.error("Aucun abonné actif");return}d(!0);try{const{data:T,error:k}=await he.functions.invoke("send-custom-newsletter",{body:{subject:h,content:p,scheduleTime:v==="now"?null:v,target_type:y}});if(k)throw k;v==="now"?ae.success(`Newsletter envoyée à ${T.successCount||F.length} abonnés !`):ae.success("Newsletter programmée avec succès !"),g(""),x(""),b("now"),_()}catch(T){console.error("Error sending newsletter:",T),ae.error("Erreur lors de l'envoi de la newsletter")}finally{d(!1)}};if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});const I=i.filter(F=>F.is_active&&F.confirmed).length,P=i.length;return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-6xl mx-auto",children:[s.jsx(sa,{items:[{label:"Newsletter"}]}),s.jsx("h1",{className:"text-4xl font-bold mb-8",children:"Gestion de la Newsletter"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(sr,{className:"h-5 w-5"}),"Abonnés actifs"]})}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-4xl font-bold",children:I}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["sur ",P," total"]})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Fn,{className:"h-5 w-5"}),"Newsletters envoyées"]})}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-4xl font-bold",children:l.length}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"au total"})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Gr,{className:"h-5 w-5"}),"Meilleur moment"]})}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-2xl font-bold",children:"Mardi 10h"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Taux d'ouverture optimal"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Composer une newsletter"}),s.jsx(Qr,{children:"Rédigez votre contenu et envoyez-le aux abonnés"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"subject",children:"Sujet de l'email *"}),s.jsx(Ye,{id:"subject",value:h,onChange:F=>g(F.target.value),placeholder:"📰 Votre newsletter formation du mois"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"content",children:"Contenu *"}),s.jsx(gn,{id:"content",value:p,onChange:F=>x(F.target.value),placeholder:`Bonjour,
Voici les dernières actualités de la formation professionnelle...`,rows:12,className:"font-mono text-sm"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Vous pouvez utiliser du HTML basique pour la mise en forme"})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Audience cible"}),s.jsxs(Lr,{value:y,onValueChange:N,children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Choisir l'audience"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les abonnés"}),s.jsx(ot,{value:"school",children:"Écoles uniquement"}),s.jsx(ot,{value:"trainer",children:"Formateurs uniquement"}),s.jsx(ot,{value:"general",children:"Visiteurs (inscription web)"})]})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"schedule",children:"Programmation"}),s.jsxs(Lr,{value:v,onValueChange:b,children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Choisir le moment d'envoi"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"now",children:"Envoyer maintenant"}),s.jsx(ot,{value:"best",children:"Meilleur moment (Mardi 10h)"}),s.jsx(ot,{value:"morning",children:"Demain matin (9h)"}),s.jsx(ot,{value:"afternoon",children:"Demain après-midi (14h)"})]})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:()=>m(!0),disabled:!h||!p,children:[s.jsx(is,{className:"mr-2 h-4 w-4"}),"Prévisualiser"]}),s.jsx(ne,{onClick:S,disabled:u||!h||!p||I===0,className:"flex-1",children:u?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):v==="now"?s.jsxs(s.Fragment,{children:[s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Envoyer à ",I," abonnés"]}):s.jsxs(s.Fragment,{children:[s.jsx(Gr,{className:"mr-2 h-4 w-4"}),"Programmer l'envoi"]})})]})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"Abonnés récents"})}),s.jsx(Ae,{children:s.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[i.slice(0,10).map(F=>s.jsxs("div",{className:"flex items-center justify-between p-2 rounded border",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:F.email}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:Ot(new Date(F.subscribed_at),"d MMM",{locale:yr})}),F.is_active&&F.confirmed?s.jsx(Le,{variant:"secondary",className:"text-xs",children:"Actif"}):s.jsx(Le,{variant:"outline",className:"text-xs",children:"Inactif"})]})]}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>j(F.id),children:s.jsx(bi,{className:"h-4 w-4 text-destructive"})})]},F.id)),i.length===0&&s.jsx("p",{className:"text-center text-muted-foreground py-4",children:"Aucun abonné"})]})})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"Envois récents"})}),s.jsx(Ae,{children:s.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.map(F=>{var T;return s.jsxs("div",{className:"p-2 rounded border",children:[s.jsx("p",{className:"font-medium text-sm truncate",children:((T=F.blog_posts)==null?void 0:T.title)||"Newsletter manuelle"}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-1",children:[s.jsx("span",{children:Ot(new Date(F.sent_at),"d MMM HH:mm",{locale:yr})}),s.jsxs("span",{className:"text-green-600",children:["✓ ",F.success_count]}),F.failed_count>0&&s.jsxs("span",{className:"text-red-600",children:["✗ ",F.failed_count]})]})]},F.id)}),l.length===0&&s.jsx("p",{className:"text-center text-muted-foreground py-4",children:"Aucun envoi"})]})})]})]})]}),s.jsx(Hn,{open:f,onOpenChange:m,children:s.jsxs(qn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Prévisualisation de la newsletter"}),s.jsx(Ia,{children:"Aperçu de ce que les abonnés recevront"})]}),s.jsxs("div",{className:"border rounded-lg p-6 bg-muted/30",children:[s.jsxs("div",{className:"text-center mb-6 pb-4 border-b",children:[s.jsx("div",{className:"text-2xl font-bold text-primary mb-2",children:"📚 PedagoBridge"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Votre newsletter formation professionnelle"})]}),s.jsx("h1",{className:"text-xl font-bold mb-4",children:h||"Sujet de l'email"}),s.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:p.replace(/\n/g,"<br>")||"<p>Contenu de la newsletter...</p>"}}),s.jsxs("div",{className:"mt-6 pt-4 border-t text-center text-xs text-muted-foreground",children:[s.jsx("p",{children:"Vous recevez cet email car vous êtes abonné à la newsletter PedagoBridge."}),s.jsx("p",{className:"mt-2",children:"Se désabonner | Confidentialité | CGU"})]})]})]})})]})})}const tIe="modulepreload",rIe=function(e){return"/"+e},Hz={},Vd=function(t,r,n){let a=Promise.resolve();if(r&&r.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(r.map(c=>{if(c=rIe(c),c in Hz)return;Hz[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":tIe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((m,h)=>{f.addEventListener("load",m),f.addEventListener("error",()=>h(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)})};function rs(e){"@babel/helpers - typeof";return rs=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},rs(e)}var ed=Uint8Array,Kl=Uint16Array,WL=Int32Array,HL=new ed([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]),GL=new ed([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]),Gz=new ed([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rie=function(e,t){for(var r=new Kl(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var a=new WL(r[30]),n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return{b:r,r:a}},Lie=Rie(HL,2),nIe=Lie.b,Z6=Lie.r;nIe[28]=258,Z6[258]=28;var sIe=Rie(GL,0),Kz=sIe.r,J6=new Kl(32768);for(var Ms=0;Ms<32768;++Ms){var Zh=(Ms&43690)>>1|(Ms&21845)<<1;Zh=(Zh&52428)>>2|(Zh&13107)<<2,Zh=(Zh&61680)>>4|(Zh&3855)<<4,J6[Ms]=((Zh&65280)>>8|(Zh&255)<<8)>>1}var dw=function(e,t,r){for(var n=e.length,a=0,i=new Kl(t);a<n;++a)e[a]&&++i[e[a]-1];var o=new Kl(t);for(a=1;a<t;++a)o[a]=o[a-1]+i[a-1]<<1;var l;if(r){l=new Kl(1<<t);var c=15-t;for(a=0;a<n;++a)if(e[a])for(var u=a<<4|e[a],d=t-e[a],f=o[e[a]-1]++<<d,m=f|(1<<d)-1;f<=m;++f)l[J6[f]>>c]=u}else for(l=new Kl(n),a=0;a<n;++a)e[a]&&(l[a]=J6[o[e[a]-1]++]>>15-e[a]);return l},mg=new ed(288);for(var Ms=0;Ms<144;++Ms)mg[Ms]=8;for(var Ms=144;Ms<256;++Ms)mg[Ms]=9;for(var Ms=256;Ms<280;++Ms)mg[Ms]=7;for(var Ms=280;Ms<288;++Ms)mg[Ms]=8;var l4=new ed(32);for(var Ms=0;Ms<32;++Ms)l4[Ms]=5;var aIe=dw(mg,9,0),iIe=dw(l4,5,0),Fie=function(e){return(e+7)/8|0},oIe=function(e,t,r){return(r==null||r>e.length)&&(r=e.length),new ed(e.subarray(t,r))},Pf=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},Sb=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},lT=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var a=r.length,i=r.slice();if(!a)return{t:$ie,l:0};if(a==1){var o=new ed(r[0].s+1);return o[r[0].s]=1,{t:o,l:1}}r.sort(function(_,j){return _.f-j.f}),r.push({s:-1,f:25001});var l=r[0],c=r[1],u=0,d=1,f=2;for(r[0]={s:-1,f:l.f+c.f,l,r:c};d!=a-1;)l=r[r[u].f<r[f].f?u++:f++],c=r[u!=d&&r[u].f<r[f].f?u++:f++],r[d++]={s:-1,f:l.f+c.f,l,r:c};for(var m=i[0].s,n=1;n<a;++n)i[n].s>m&&(m=i[n].s);var h=new Kl(m+1),g=Q6(r[d-1],h,0);if(g>t){var n=0,p=0,x=g-t,v=1<<x;for(i.sort(function(j,S){return h[S.s]-h[j.s]||j.f-S.f});n<a;++n){var b=i[n].s;if(h[b]>t)p+=v-(1<<g-h[b]),h[b]=t;else break}for(p>>=x;p>0;){var y=i[n].s;h[y]<t?p-=1<<t-h[y]++-1:++n}for(;n>=0&&p;--n){var N=i[n].s;h[N]==t&&(--h[N],++p)}g=t}return{t:new ed(h),l:g}},Q6=function(e,t,r){return e.s==-1?Math.max(Q6(e.l,t,r+1),Q6(e.r,t,r+1)):t[e.s]=r},Yz=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Kl(++t),n=0,a=e[0],i=1,o=function(c){r[n++]=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:r.subarray(0,n),n:t}},kb=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Mie=function(e,t,r){var n=r.length,a=Fie(t+2);e[a]=n&255,e[a+1]=n>>8,e[a+2]=e[a]^255,e[a+3]=e[a+1]^255;for(var i=0;i<n;++i)e[a+i+4]=r[i];return(a+4+n)*8},Xz=function(e,t,r,n,a,i,o,l,c,u,d){Pf(t,d++,r),++a[256];for(var f=lT(a,15),m=f.t,h=f.l,g=lT(i,15),p=g.t,x=g.l,v=Yz(m),b=v.c,y=v.n,N=Yz(p),_=N.c,j=N.n,S=new Kl(19),I=0;I<b.length;++I)++S[b[I]&31];for(var I=0;I<_.length;++I)++S[_[I]&31];for(var P=lT(S,7),F=P.t,T=P.l,k=19;k>4&&!F[Gz[k-1]];--k);var V=u+5<<3,C=kb(a,mg)+kb(i,l4)+o,R=kb(a,m)+kb(i,p)+o+14+3*k+kb(S,F)+2*S[16]+3*S[17]+7*S[18];if(c>=0&&V<=C&&V<=R)return Mie(t,d,e.subarray(c,c+u));var H,q,L,M;if(Pf(t,d,1+(R<C)),d+=2,R<C){H=dw(m,h,0),q=m,L=dw(p,x,0),M=p;var z=dw(F,T,0);Pf(t,d,y-257),Pf(t,d+5,j-1),Pf(t,d+10,k-4),d+=14;for(var I=0;I<k;++I)Pf(t,d+3*I,F[Gz[I]]);d+=3*k;for(var K=[b,_],E=0;E<2;++E)for(var A=K[E],I=0;I<A.length;++I){var O=A[I]&31;Pf(t,d,z[O]),d+=F[O],O>15&&(Pf(t,d,A[I]>>5&127),d+=A[I]>>12)}}else H=aIe,q=mg,L=iIe,M=l4;for(var I=0;I<l;++I){var U=n[I];if(U>255){var O=U>>18&31;Sb(t,d,H[O+257]),d+=q[O+257],O>7&&(Pf(t,d,U>>23&31),d+=HL[O]);var Y=U&31;Sb(t,d,L[Y]),d+=M[Y],Y>3&&(Sb(t,d,U>>5&8191),d+=GL[Y])}else Sb(t,d,H[U]),d+=q[U]}return Sb(t,d,H[256]),d+q[256]},lIe=new WL([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$ie=new ed(0),cIe=function(e,t,r,n,a,i){var o=i.z||e.length,l=new ed(n+o+5*(1+Math.ceil(o/7e3))+a),c=l.subarray(n,l.length-a),u=i.l,d=(i.r||0)&7;if(t){d&&(c[0]=i.r>>3);for(var f=lIe[t-1],m=f>>13,h=f&8191,g=(1<<r)-1,p=i.p||new Kl(32768),x=i.h||new Kl(g+1),v=Math.ceil(r/3),b=2*v,y=function(W){return(e[W]^e[W+1]<<v^e[W+2]<<b)&g},N=new WL(25e3),_=new Kl(288),j=new Kl(32),S=0,I=0,P=i.i||0,F=0,T=i.w||0,k=0;P+2<o;++P){var V=y(P),C=P&32767,R=x[V];if(p[C]=R,x[V]=C,T<=P){var H=o-P;if((S>7e3||F>24576)&&(H>423||!u)){d=Xz(e,c,0,N,_,j,I,F,k,P-k,d),F=S=I=0,k=P;for(var q=0;q<286;++q)_[q]=0;for(var q=0;q<30;++q)j[q]=0}var L=2,M=0,z=h,K=C-R&32767;if(H>2&&V==y(P-K))for(var E=Math.min(m,H)-1,A=Math.min(32767,P),O=Math.min(258,H);K<=A&&--z&&C!=R;){if(e[P+L]==e[P+L-K]){for(var U=0;U<O&&e[P+U]==e[P+U-K];++U);if(U>L){if(L=U,M=K,U>E)break;for(var Y=Math.min(K,U-2),J=0,q=0;q<Y;++q){var se=P-K+q&32767,ee=p[se],ie=se-ee&32767;ie>J&&(J=ie,R=se)}}}C=R,R=p[C],K+=C-R&32767}if(M){N[F++]=268435456|Z6[L]<<18|Kz[M];var Ee=Z6[L]&31,te=Kz[M]&31;I+=HL[Ee]+GL[te],++_[257+Ee],++j[te],T=P+L,++S}else N[F++]=e[P],++_[e[P]]}}for(P=Math.max(P,T);P<o;++P)N[F++]=e[P],++_[e[P]];d=Xz(e,c,u,N,_,j,I,F,k,P-k,d),u||(i.r=d&7|c[d/8|0]<<3,d-=7,i.h=x,i.p=p,i.i=P,i.w=T)}else{for(var P=i.w||0;P<o+u;P+=65535){var Ue=P+65535;Ue>=o&&(c[d/8|0]=u,Ue=o),d=Mie(c,d+1,e.subarray(P,Ue))}i.i=o}return oIe(l,0,n+Fie(d)+a)},Bie=function(){var e=1,t=0;return{p:function(r){for(var n=e,a=t,i=r.length|0,o=0;o!=i;){for(var l=Math.min(o+2655,i);o<l;++o)a+=n+=r[o];n=(n&65535)+15*(n>>16),a=(a&65535)+15*(a>>16)}e=n,t=a},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},uIe=function(e,t,r,n,a){if(!a&&(a={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new ed(i.length+e.length);o.set(i),o.set(e,i.length),e=o,a.w=i.length}return cIe(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,r,n,a)},zie=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},dIe=function(e,t){var r=t.level,n=r==0?0:r<6?1:r==9?3:2;if(e[0]=120,e[1]=n<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var a=Bie();a.p(t.dictionary),zie(e,2,a.d())}};function e8(e,t){t||(t={});var r=Bie();r.p(e);var n=uIe(e,t,t.dictionary?6:2,4);return dIe(n,t),zie(n,n.length-4,r.d()),n}var fIe=typeof TextDecoder<"u"&&new TextDecoder,hIe=0;try{fIe.decode($ie,{stream:!0}),hIe=1}catch{}function mIe(e){if(Array.isArray(e))return e}function pIe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Zz(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function gIe(e,t){if(e){if(typeof e=="string")return Zz(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Zz(e,t):void 0}}function xIe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jz(e,t){return mIe(e)||pIe(e,t)||gIe(e,t)||xIe()}function Qz(e,t="utf8"){return new TextDecoder(t).decode(e)}const vIe=new TextEncoder;function yIe(e){return vIe.encode(e)}const bIe=1024*8,wIe=(()=>{const e=new Uint8Array(4),t=new Uint32Array(e.buffer);return!((t[0]=1)&e[0])})(),cT={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 KL{constructor(t=bIe,r={}){zn(this,"buffer");zn(this,"byteLength");zn(this,"byteOffset");zn(this,"length");zn(this,"offset");zn(this,"lastWrittenByte");zn(this,"littleEndian");zn(this,"_data");zn(this,"_mark");zn(this,"_marks");let n=!1;typeof t=="number"?t=new ArrayBuffer(t):(n=!0,this.lastWrittenByte=t.byteLength);const a=r.offset?r.offset>>>0:0,i=t.byteLength-a;let o=a;(ArrayBuffer.isView(t)||t instanceof KL)&&(t.byteLength!==t.buffer.byteLength&&(o=t.byteOffset+a),t=t.buffer),n?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 n=(this.offset+t)*2,a=new Uint8Array(n);a.set(new Uint8Array(this.buffer)),this.buffer=a.buffer,this.length=n,this.byteLength=n,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,r){const n=cT[r].BYTES_PER_ELEMENT*t,a=this.byteOffset+this.offset,i=this.buffer.slice(a,a+n);if(this.littleEndian===wIe&&r!=="uint8"&&r!=="int8"){const l=new Uint8Array(this.buffer.slice(a,a+n));l.reverse();const c=new cT[r](l.buffer);return this.offset+=n,c.reverse(),c}const o=new cT[r](i);return this.offset+=n,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 r="";for(let n=0;n<t;n++)r+=this.readChar();return r}readUtf8(t=1){return Qz(this.readBytes(t))}decodeText(t=1,r="utf8"){return Qz(this.readBytes(t),r)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let r=0;r<t.length;r++)this._data.setUint8(this.offset++,t[r]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let r=0;r<t.length;r++)this.writeUint8(t.charCodeAt(r));return this}writeUtf8(t){return this.writeBytes(yIe(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}getWrittenByteLength(){return this.lastWrittenByte-this.byteOffset}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function f1(e){let t=e.length;for(;--t>=0;)e[t]=0}const jIe=3,_Ie=258,Uie=29,NIe=256,SIe=NIe+1+Uie,qie=30,kIe=512,CIe=new Array((SIe+2)*2);f1(CIe);const EIe=new Array(qie*2);f1(EIe);const AIe=new Array(kIe);f1(AIe);const TIe=new Array(_Ie-jIe+1);f1(TIe);const PIe=new Array(Uie);f1(PIe);const OIe=new Array(qie);f1(OIe);const DIe=(e,t,r,n)=>{let a=e&65535|0,i=e>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do a=a+t[n++]|0,i=i+a|0;while(--o);a%=65521,i%=65521}return a|i<<16|0};var t8=DIe;const IIe=()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t},RIe=new Uint32Array(IIe()),LIe=(e,t,r,n)=>{const a=RIe,i=n+r;e^=-1;for(let o=n;o<i;o++)e=e>>>8^a[(e^t[o])&255];return e^-1};var vd=LIe,r8={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"},Vie={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const FIe=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var MIe=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(const n in r)FIe(r,n)&&(e[n]=r[n])}}return e},$Ie=e=>{let t=0;for(let n=0,a=e.length;n<a;n++)t+=e[n].length;const r=new Uint8Array(t);for(let n=0,a=0,i=e.length;n<i;n++){let o=e[n];r.set(o,a),a+=o.length}return r},Wie={assign:MIe,flattenChunks:$Ie};let Hie=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Hie=!1}const w2=new Uint8Array(256);for(let e=0;e<256;e++)w2[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;w2[254]=w2[254]=1;var BIe=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,r,n,a,i,o=e.length,l=0;for(a=0;a<o;a++)r=e.charCodeAt(a),(r&64512)===55296&&a+1<o&&(n=e.charCodeAt(a+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),a++)),l+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(l),i=0,a=0;i<l;a++)r=e.charCodeAt(a),(r&64512)===55296&&a+1<o&&(n=e.charCodeAt(a+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),a++)),r<128?t[i++]=r:r<2048?(t[i++]=192|r>>>6,t[i++]=128|r&63):r<65536?(t[i++]=224|r>>>12,t[i++]=128|r>>>6&63,t[i++]=128|r&63):(t[i++]=240|r>>>18,t[i++]=128|r>>>12&63,t[i++]=128|r>>>6&63,t[i++]=128|r&63);return t};const zIe=(e,t)=>{if(t<65534&&e.subarray&&Hie)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r};var UIe=(e,t)=>{const r=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let n,a;const i=new Array(r*2);for(a=0,n=0;n<r;){let o=e[n++];if(o<128){i[a++]=o;continue}let l=w2[o];if(l>4){i[a++]=65533,n+=l-1;continue}for(o&=l===2?31:l===3?15:7;l>1&&n<r;)o=o<<6|e[n++]&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 zIe(i,a)},qIe=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let r=t-1;for(;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+w2[e[r]]>t?r:t},n8={string2buf:BIe,buf2string:UIe,utf8border:qIe};function VIe(){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 WIe=VIe;const XN=16209,HIe=16191;var GIe=function(t,r){let n,a,i,o,l,c,u,d,f,m,h,g,p,x,v,b,y,N,_,j,S,I,P,F;const T=t.state;n=t.next_in,P=t.input,a=n+(t.avail_in-5),i=t.next_out,F=t.output,o=i-(r-t.avail_out),l=i+(t.avail_out-257),c=T.dmax,u=T.wsize,d=T.whave,f=T.wnext,m=T.window,h=T.hold,g=T.bits,p=T.lencode,x=T.distcode,v=(1<<T.lenbits)-1,b=(1<<T.distbits)-1;e:do{g<15&&(h+=P[n++]<<g,g+=8,h+=P[n++]<<g,g+=8),y=p[h&v];t:for(;;){if(N=y>>>24,h>>>=N,g-=N,N=y>>>16&255,N===0)F[i++]=y&65535;else if(N&16){_=y&65535,N&=15,N&&(g<N&&(h+=P[n++]<<g,g+=8),_+=h&(1<<N)-1,h>>>=N,g-=N),g<15&&(h+=P[n++]<<g,g+=8,h+=P[n++]<<g,g+=8),y=x[h&b];r:for(;;){if(N=y>>>24,h>>>=N,g-=N,N=y>>>16&255,N&16){if(j=y&65535,N&=15,g<N&&(h+=P[n++]<<g,g+=8,g<N&&(h+=P[n++]<<g,g+=8)),j+=h&(1<<N)-1,j>c){t.msg="invalid distance too far back",T.mode=XN;break e}if(h>>>=N,g-=N,N=i-o,j>N){if(N=j-N,N>d&&T.sane){t.msg="invalid distance too far back",T.mode=XN;break e}if(S=0,I=m,f===0){if(S+=u-N,N<_){_-=N;do F[i++]=m[S++];while(--N);S=i-j,I=F}}else if(f<N){if(S+=u+f-N,N-=f,N<_){_-=N;do F[i++]=m[S++];while(--N);if(S=0,f<_){N=f,_-=N;do F[i++]=m[S++];while(--N);S=i-j,I=F}}}else if(S+=f-N,N<_){_-=N;do F[i++]=m[S++];while(--N);S=i-j,I=F}for(;_>2;)F[i++]=I[S++],F[i++]=I[S++],F[i++]=I[S++],_-=3;_&&(F[i++]=I[S++],_>1&&(F[i++]=I[S++]))}else{S=i-j;do F[i++]=F[S++],F[i++]=F[S++],F[i++]=F[S++],_-=3;while(_>2);_&&(F[i++]=F[S++],_>1&&(F[i++]=F[S++]))}}else if(N&64){t.msg="invalid distance code",T.mode=XN;break e}else{y=x[(y&65535)+(h&(1<<N)-1)];continue r}break}}else if(N&64)if(N&32){T.mode=HIe;break e}else{t.msg="invalid literal/length code",T.mode=XN;break e}else{y=p[(y&65535)+(h&(1<<N)-1)];continue t}break}}while(n<a&&i<l);_=g>>3,n-=_,g-=_<<3,h&=(1<<g)-1,t.next_in=n,t.next_out=i,t.avail_in=n<a?5+(a-n):5-(n-a),t.avail_out=i<l?257+(l-i):257-(i-l),T.hold=h,T.bits=g};const wx=15,eU=852,tU=592,rU=0,uT=1,nU=2,KIe=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]),YIe=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]),XIe=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]),ZIe=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]),JIe=(e,t,r,n,a,i,o,l)=>{const c=l.bits;let u=0,d=0,f=0,m=0,h=0,g=0,p=0,x=0,v=0,b=0,y,N,_,j,S,I=null,P;const F=new Uint16Array(wx+1),T=new Uint16Array(wx+1);let k=null,V,C,R;for(u=0;u<=wx;u++)F[u]=0;for(d=0;d<n;d++)F[t[r+d]]++;for(h=c,m=wx;m>=1&&F[m]===0;m--);if(h>m&&(h=m),m===0)return a[i++]=1<<24|64<<16|0,a[i++]=1<<24|64<<16|0,l.bits=1,0;for(f=1;f<m&&F[f]===0;f++);for(h<f&&(h=f),x=1,u=1;u<=wx;u++)if(x<<=1,x-=F[u],x<0)return-1;if(x>0&&(e===rU||m!==1))return-1;for(T[1]=0,u=1;u<wx;u++)T[u+1]=T[u]+F[u];for(d=0;d<n;d++)t[r+d]!==0&&(o[T[t[r+d]]++]=d);if(e===rU?(I=k=o,P=20):e===uT?(I=KIe,k=YIe,P=257):(I=XIe,k=ZIe,P=0),b=0,d=0,u=f,S=i,g=h,p=0,_=-1,v=1<<h,j=v-1,e===uT&&v>eU||e===nU&&v>tU)return 1;for(;;){V=u-p,o[d]+1<P?(C=0,R=o[d]):o[d]>=P?(C=k[o[d]-P],R=I[o[d]-P]):(C=96,R=0),y=1<<u-p,N=1<<g,f=N;do N-=y,a[S+(b>>p)+N]=V<<24|C<<16|R|0;while(N!==0);for(y=1<<u-1;b&y;)y>>=1;if(y!==0?(b&=y-1,b+=y):b=0,d++,--F[u]===0){if(u===m)break;u=t[r+o[d]]}if(u>h&&(b&j)!==_){for(p===0&&(p=h),S+=f,g=u-p,x=1<<g;g+p<m&&(x-=F[g+p],!(x<=0));)g++,x<<=1;if(v+=1<<g,e===uT&&v>eU||e===nU&&v>tU)return 1;_=b&j,a[_]=h<<24|g<<16|S-i|0}}return b!==0&&(a[S+b]=u-p<<24|64<<16|0),l.bits=h,0};var fw=JIe;const QIe=0,Gie=1,Kie=2,{Z_FINISH:sU,Z_BLOCK:eRe,Z_TREES:ZN,Z_OK:pg,Z_STREAM_END:tRe,Z_NEED_DICT:rRe,Z_STREAM_ERROR:su,Z_DATA_ERROR:Yie,Z_MEM_ERROR:Xie,Z_BUF_ERROR:nRe,Z_DEFLATED:aU}=Vie,XC=16180,iU=16181,oU=16182,lU=16183,cU=16184,uU=16185,dU=16186,fU=16187,hU=16188,mU=16189,c4=16190,Of=16191,dT=16192,pU=16193,fT=16194,gU=16195,xU=16196,vU=16197,yU=16198,JN=16199,QN=16200,bU=16201,wU=16202,jU=16203,_U=16204,NU=16205,hT=16206,SU=16207,kU=16208,qs=16209,Zie=16210,Jie=16211,sRe=852,aRe=592,iRe=15,oRe=iRe,CU=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function lRe(){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 $g=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<XC||t.mode>Jie?1:0},Qie=e=>{if($g(e))return su;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=XC,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(sRe),t.distcode=t.distdyn=new Int32Array(aRe),t.sane=1,t.back=-1,pg},eoe=e=>{if($g(e))return su;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Qie(e)},toe=(e,t)=>{let r;if($g(e))return su;const n=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?su:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,eoe(e))},roe=(e,t)=>{if(!e)return su;const r=new lRe;e.state=r,r.strm=e,r.window=null,r.mode=XC;const n=toe(e,t);return n!==pg&&(e.state=null),n},cRe=e=>roe(e,oRe);let EU=!0,mT,pT;const uRe=e=>{if(EU){mT=new Int32Array(512),pT=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(fw(Gie,e.lens,0,288,mT,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;fw(Kie,e.lens,0,32,pT,0,e.work,{bits:5}),EU=!1}e.lencode=mT,e.lenbits=9,e.distcode=pT,e.distbits=5},noe=(e,t,r,n)=>{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)),n>=i.wsize?(i.window.set(t.subarray(r-i.wsize,r),0),i.wnext=0,i.whave=i.wsize):(a=i.wsize-i.wnext,a>n&&(a=n),i.window.set(t.subarray(r-n,r-n+a),i.wnext),n-=a,n?(i.window.set(t.subarray(r-n,r),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=a,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=a))),0},dRe=(e,t)=>{let r,n,a,i,o,l,c,u,d,f,m,h,g,p,x=0,v,b,y,N,_,j,S,I;const P=new Uint8Array(4);let F,T;const k=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if($g(e)||!e.output||!e.input&&e.avail_in!==0)return su;r=e.state,r.mode===Of&&(r.mode=dT),o=e.next_out,a=e.output,c=e.avail_out,i=e.next_in,n=e.input,l=e.avail_in,u=r.hold,d=r.bits,f=l,m=c,I=pg;e:for(;;)switch(r.mode){case XC:if(r.wrap===0){r.mode=dT;break}for(;d<16;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(r.wrap&2&&u===35615){r.wbits===0&&(r.wbits=15),r.check=0,P[0]=u&255,P[1]=u>>>8&255,r.check=vd(r.check,P,2,0),u=0,d=0,r.mode=iU;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=qs;break}if((u&15)!==aU){e.msg="unknown compression method",r.mode=qs;break}if(u>>>=4,d-=4,S=(u&15)+8,r.wbits===0&&(r.wbits=S),S>15||S>r.wbits){e.msg="invalid window size",r.mode=qs;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=u&512?mU:Of,u=0,d=0;break;case iU:for(;d<16;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(r.flags=u,(r.flags&255)!==aU){e.msg="unknown compression method",r.mode=qs;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=qs;break}r.head&&(r.head.text=u>>8&1),r.flags&512&&r.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,r.check=vd(r.check,P,2,0)),u=0,d=0,r.mode=oU;case oU:for(;d<32;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}r.head&&(r.head.time=u),r.flags&512&&r.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,P[2]=u>>>16&255,P[3]=u>>>24&255,r.check=vd(r.check,P,4,0)),u=0,d=0,r.mode=lU;case lU:for(;d<16;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}r.head&&(r.head.xflags=u&255,r.head.os=u>>8),r.flags&512&&r.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,r.check=vd(r.check,P,2,0)),u=0,d=0,r.mode=cU;case cU:if(r.flags&1024){for(;d<16;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),r.flags&512&&r.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,r.check=vd(r.check,P,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=uU;case uU:if(r.flags&1024&&(h=r.length,h>l&&(h=l),h&&(r.head&&(S=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(i,i+h),S)),r.flags&512&&r.wrap&4&&(r.check=vd(r.check,n,h,i)),l-=h,i+=h,r.length-=h),r.length))break e;r.length=0,r.mode=dU;case dU:if(r.flags&2048){if(l===0)break e;h=0;do S=n[i+h++],r.head&&S&&r.length<65536&&(r.head.name+=String.fromCharCode(S));while(S&&h<l);if(r.flags&512&&r.wrap&4&&(r.check=vd(r.check,n,h,i)),l-=h,i+=h,S)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=fU;case fU:if(r.flags&4096){if(l===0)break e;h=0;do S=n[i+h++],r.head&&S&&r.length<65536&&(r.head.comment+=String.fromCharCode(S));while(S&&h<l);if(r.flags&512&&r.wrap&4&&(r.check=vd(r.check,n,h,i)),l-=h,i+=h,S)break e}else r.head&&(r.head.comment=null);r.mode=hU;case hU:if(r.flags&512){for(;d<16;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(r.wrap&4&&u!==(r.check&65535)){e.msg="header crc mismatch",r.mode=qs;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Of;break;case mU:for(;d<32;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}e.adler=r.check=CU(u),u=0,d=0,r.mode=c4;case c4:if(r.havedict===0)return e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,r.hold=u,r.bits=d,rRe;e.adler=r.check=1,r.mode=Of;case Of:if(t===eRe||t===ZN)break e;case dT:if(r.last){u>>>=d&7,d-=d&7,r.mode=hT;break}for(;d<3;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}switch(r.last=u&1,u>>>=1,d-=1,u&3){case 0:r.mode=pU;break;case 1:if(uRe(r),r.mode=JN,t===ZN){u>>>=2,d-=2;break e}break;case 2:r.mode=xU;break;case 3:e.msg="invalid block type",r.mode=qs}u>>>=2,d-=2;break;case pU:for(u>>>=d&7,d-=d&7;d<32;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if((u&65535)!==(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=qs;break}if(r.length=u&65535,u=0,d=0,r.mode=fT,t===ZN)break e;case fT:r.mode=gU;case gU:if(h=r.length,h){if(h>l&&(h=l),h>c&&(h=c),h===0)break e;a.set(n.subarray(i,i+h),o),l-=h,i+=h,c-=h,o+=h,r.length-=h;break}r.mode=Of;break;case xU:for(;d<14;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(r.nlen=(u&31)+257,u>>>=5,d-=5,r.ndist=(u&31)+1,u>>>=5,d-=5,r.ncode=(u&15)+4,u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=qs;break}r.have=0,r.mode=vU;case vU:for(;r.have<r.ncode;){for(;d<3;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}r.lens[k[r.have++]]=u&7,u>>>=3,d-=3}for(;r.have<19;)r.lens[k[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,F={bits:r.lenbits},I=fw(QIe,r.lens,0,19,r.lencode,0,r.work,F),r.lenbits=F.bits,I){e.msg="invalid code lengths set",r.mode=qs;break}r.have=0,r.mode=yU;case yU:for(;r.have<r.nlen+r.ndist;){for(;x=r.lencode[u&(1<<r.lenbits)-1],v=x>>>24,b=x>>>16&255,y=x&65535,!(v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(y<16)u>>>=v,d-=v,r.lens[r.have++]=y;else{if(y===16){for(T=v+2;d<T;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(u>>>=v,d-=v,r.have===0){e.msg="invalid bit length repeat",r.mode=qs;break}S=r.lens[r.have-1],h=3+(u&3),u>>>=2,d-=2}else if(y===17){for(T=v+3;d<T;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}u>>>=v,d-=v,S=0,h=3+(u&7),u>>>=3,d-=3}else{for(T=v+7;d<T;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}u>>>=v,d-=v,S=0,h=11+(u&127),u>>>=7,d-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=qs;break}for(;h--;)r.lens[r.have++]=S}}if(r.mode===qs)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=qs;break}if(r.lenbits=9,F={bits:r.lenbits},I=fw(Gie,r.lens,0,r.nlen,r.lencode,0,r.work,F),r.lenbits=F.bits,I){e.msg="invalid literal/lengths set",r.mode=qs;break}if(r.distbits=6,r.distcode=r.distdyn,F={bits:r.distbits},I=fw(Kie,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,F),r.distbits=F.bits,I){e.msg="invalid distances set",r.mode=qs;break}if(r.mode=JN,t===ZN)break e;case JN:r.mode=QN;case QN:if(l>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,r.hold=u,r.bits=d,GIe(e,m),o=e.next_out,a=e.output,c=e.avail_out,i=e.next_in,n=e.input,l=e.avail_in,u=r.hold,d=r.bits,r.mode===Of&&(r.back=-1);break}for(r.back=0;x=r.lencode[u&(1<<r.lenbits)-1],v=x>>>24,b=x>>>16&255,y=x&65535,!(v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(b&&!(b&240)){for(N=v,_=b,j=y;x=r.lencode[j+((u&(1<<N+_)-1)>>N)],v=x>>>24,b=x>>>16&255,y=x&65535,!(N+v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}u>>>=N,d-=N,r.back+=N}if(u>>>=v,d-=v,r.back+=v,r.length=y,b===0){r.mode=NU;break}if(b&32){r.back=-1,r.mode=Of;break}if(b&64){e.msg="invalid literal/length code",r.mode=qs;break}r.extra=b&15,r.mode=bU;case bU:if(r.extra){for(T=r.extra;d<T;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=wU;case wU:for(;x=r.distcode[u&(1<<r.distbits)-1],v=x>>>24,b=x>>>16&255,y=x&65535,!(v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(!(b&240)){for(N=v,_=b,j=y;x=r.distcode[j+((u&(1<<N+_)-1)>>N)],v=x>>>24,b=x>>>16&255,y=x&65535,!(N+v<=d);){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}u>>>=N,d-=N,r.back+=N}if(u>>>=v,d-=v,r.back+=v,b&64){e.msg="invalid distance code",r.mode=qs;break}r.offset=y,r.extra=b&15,r.mode=jU;case jU:if(r.extra){for(T=r.extra;d<T;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=qs;break}r.mode=_U;case _U:if(c===0)break e;if(h=m-c,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=qs;break}h>r.wnext?(h-=r.wnext,g=r.wsize-h):g=r.wnext-h,h>r.length&&(h=r.length),p=r.window}else p=a,g=o-r.offset,h=r.length;h>c&&(h=c),c-=h,r.length-=h;do a[o++]=p[g++];while(--h);r.length===0&&(r.mode=QN);break;case NU:if(c===0)break e;a[o++]=r.length,c--,r.mode=QN;break;case hT:if(r.wrap){for(;d<32;){if(l===0)break e;l--,u|=n[i++]<<d,d+=8}if(m-=c,e.total_out+=m,r.total+=m,r.wrap&4&&m&&(e.adler=r.check=r.flags?vd(r.check,a,m,o-m):t8(r.check,a,m,o-m)),m=c,r.wrap&4&&(r.flags?u:CU(u))!==r.check){e.msg="incorrect data check",r.mode=qs;break}u=0,d=0}r.mode=SU;case SU:if(r.wrap&&r.flags){for(;d<32;){if(l===0)break e;l--,u+=n[i++]<<d,d+=8}if(r.wrap&4&&u!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=qs;break}u=0,d=0}r.mode=kU;case kU:I=tRe;break e;case qs:I=Yie;break e;case Zie:return Xie;case Jie:default:return su}return e.next_out=o,e.avail_out=c,e.next_in=i,e.avail_in=l,r.hold=u,r.bits=d,(r.wsize||m!==e.avail_out&&r.mode<qs&&(r.mode<hT||t!==sU))&&noe(e,e.output,e.next_out,m-e.avail_out),f-=e.avail_in,m-=e.avail_out,e.total_in+=f,e.total_out+=m,r.total+=m,r.wrap&4&&m&&(e.adler=r.check=r.flags?vd(r.check,a,m,e.next_out-m):t8(r.check,a,m,e.next_out-m)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Of?128:0)+(r.mode===JN||r.mode===fT?256:0),(f===0&&m===0||t===sU)&&I===pg&&(I=nRe),I},fRe=e=>{if($g(e))return su;let t=e.state;return t.window&&(t.window=null),e.state=null,pg},hRe=(e,t)=>{if($g(e))return su;const r=e.state;return r.wrap&2?(r.head=t,t.done=!1,pg):su},mRe=(e,t)=>{const r=t.length;let n,a,i;return $g(e)||(n=e.state,n.wrap!==0&&n.mode!==c4)?su:n.mode===c4&&(a=1,a=t8(a,t,r,0),a!==n.check)?Yie:(i=noe(e,t,r,r),i?(n.mode=Zie,Xie):(n.havedict=1,pg))};var pRe=eoe,gRe=toe,xRe=Qie,vRe=cRe,yRe=roe,bRe=dRe,wRe=fRe,jRe=hRe,_Re=mRe,NRe="pako inflate (from Nodeca project)",$f={inflateReset:pRe,inflateReset2:gRe,inflateResetKeep:xRe,inflateInit:vRe,inflateInit2:yRe,inflate:bRe,inflateEnd:wRe,inflateGetHeader:jRe,inflateSetDictionary:_Re,inflateInfo:NRe};function SRe(){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 kRe=SRe;const soe=Object.prototype.toString,{Z_NO_FLUSH:CRe,Z_FINISH:ERe,Z_OK:j2,Z_STREAM_END:gT,Z_NEED_DICT:xT,Z_STREAM_ERROR:ARe,Z_DATA_ERROR:AU,Z_MEM_ERROR:TRe}=Vie;function r_(e){this.options=Wie.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 WIe,this.strm.avail_out=0;let r=$f.inflateInit2(this.strm,t.windowBits);if(r!==j2)throw new Error(r8[r]);if(this.header=new kRe,$f.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=n8.string2buf(t.dictionary):soe.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=$f.inflateSetDictionary(this.strm,t.dictionary),r!==j2)))throw new Error(r8[r])}r_.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,a=this.options.dictionary;let i,o,l;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?ERe:CRe,soe.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),i=$f.inflate(r,o),i===xT&&a&&(i=$f.inflateSetDictionary(r,a),i===j2?i=$f.inflate(r,o):i===AU&&(i=xT));r.avail_in>0&&i===gT&&r.state.wrap>0&&e[r.next_in]!==0;)$f.inflateReset(r),i=$f.inflate(r,o);switch(i){case ARe:case AU:case xT:case TRe:return this.onEnd(i),this.ended=!0,!1}if(l=r.avail_out,r.next_out&&(r.avail_out===0||i===gT))if(this.options.to==="string"){let c=n8.utf8border(r.output,r.next_out),u=r.next_out-c,d=n8.buf2string(r.output,c);r.next_out=u,r.avail_out=n-u,u&&r.output.set(r.output.subarray(c,c+u),0),this.onData(d)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(i===j2&&l===0)){if(i===gT)return i=$f.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};r_.prototype.onData=function(e){this.chunks.push(e)};r_.prototype.onEnd=function(e){e===j2&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wie.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function PRe(e,t){const r=new r_(t);if(r.push(e),r.err)throw r.msg||r8[r.err];return r.result}var ORe=r_,DRe=PRe,IRe={Inflate:ORe,inflate:DRe};const{Inflate:RRe,inflate:LRe}=IRe;var TU=RRe,FRe=LRe;const aoe=[];for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t&1?t=3988292384^t>>>1:t=t>>>1;aoe[e]=t}const PU=4294967295;function MRe(e,t,r){let n=e;for(let a=0;a<r;a++)n=aoe[(n^t[a])&255]^n>>>8;return n}function $Re(e,t){return(MRe(PU,e,t)^PU)>>>0}function OU(e,t,r){const n=e.readUint32(),a=$Re(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(a!==n)throw new Error(`CRC mismatch for chunk ${r}. Expected ${n}, found ${a}`)}function ioe(e,t,r){for(let n=0;n<r;n++)t[n]=e[n]}function ooe(e,t,r,n){let a=0;for(;a<n;a++)t[a]=e[a];for(;a<r;a++)t[a]=e[a]+t[a-n]&255}function loe(e,t,r,n){let a=0;if(r.length===0)for(;a<n;a++)t[a]=e[a];else for(;a<n;a++)t[a]=e[a]+r[a]&255}function coe(e,t,r,n,a){let i=0;if(r.length===0){for(;i<a;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+(t[i-a]>>1)&255}else{for(;i<a;i++)t[i]=e[i]+(r[i]>>1)&255;for(;i<n;i++)t[i]=e[i]+(t[i-a]+r[i]>>1)&255}}function uoe(e,t,r,n,a){let i=0;if(r.length===0){for(;i<a;i++)t[i]=e[i];for(;i<n;i++)t[i]=e[i]+t[i-a]&255}else{for(;i<a;i++)t[i]=e[i]+r[i]&255;for(;i<n;i++)t[i]=e[i]+BRe(t[i-a],r[i],r[i-a])&255}}function BRe(e,t,r){const n=e+t-r,a=Math.abs(n-e),i=Math.abs(n-t),o=Math.abs(n-r);return a<=i&&a<=o?e:i<=o?t:r}function zRe(e,t,r,n,a,i){switch(e){case 0:ioe(t,r,a);break;case 1:ooe(t,r,a,i);break;case 2:loe(t,r,n,a);break;case 3:coe(t,r,n,a,i);break;case 4:uoe(t,r,n,a,i);break;default:throw new Error(`Unsupported filter: ${e}`)}}const URe=new Uint16Array([255]),qRe=new Uint8Array(URe.buffer),VRe=qRe[0]===255;function WRe(e){const{data:t,width:r,height:n,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(n*r*l);let u=0;for(let d=0;d<7;d++){const f=o[d],m=Math.ceil((r-f.x)/f.xStep),h=Math.ceil((n-f.y)/f.yStep);if(m<=0||h<=0)continue;const g=m*l,p=new Uint8Array(g);for(let x=0;x<h;x++){const v=t[u++],b=t.subarray(u,u+g);u+=g;const y=new Uint8Array(g);zRe(v,b,y,p,g,l),p.set(y);for(let N=0;N<m;N++){const _=f.x+N*f.xStep,j=f.y+x*f.yStep;if(!(_>=r||j>=n))for(let S=0;S<l;S++)c[(j*r+_)*l+S]=y[N*l+S]}}}if(i===16){const d=new Uint16Array(c.buffer);if(VRe)for(let f=0;f<d.length;f++)d[f]=HRe(d[f]);return d}else return c}function HRe(e){return(e&255)<<8|e>>8&255}const GRe=new Uint16Array([255]),KRe=new Uint8Array(GRe.buffer),YRe=KRe[0]===255,XRe=new Uint8Array(0);function DU(e){const{data:t,width:r,height:n,channels:a,depth:i}=e,o=Math.ceil(i/8)*a,l=Math.ceil(i/8*a*r),c=new Uint8Array(n*l);let u=XRe,d=0,f,m;for(let h=0;h<n;h++){switch(f=t.subarray(d+1,d+1+l),m=c.subarray(h*l,(h+1)*l),t[d]){case 0:ioe(f,m,l);break;case 1:ooe(f,m,l,o);break;case 2:loe(f,m,u,l);break;case 3:coe(f,m,u,l,o);break;case 4:uoe(f,m,u,l,o);break;default:throw new Error(`Unsupported filter: ${t[d]}`)}u=m,d+=l+1}if(i===16){const h=new Uint16Array(c.buffer);if(YRe)for(let g=0;g<h.length;g++)h[g]=ZRe(h[g]);return h}else return c}function ZRe(e){return(e&255)<<8|e>>8&255}const o5=Uint8Array.of(137,80,78,71,13,10,26,10);function IU(e){if(!JRe(e.readBytes(o5.length)))throw new Error("wrong PNG signature")}function JRe(e){if(e.length<o5.length)return!1;for(let t=0;t<o5.length;t++)if(e[t]!==o5[t])return!1;return!0}const QRe="tEXt",eLe=0,doe=new TextDecoder("latin1");function tLe(e){if(nLe(e),e.length===0||e.length>79)throw new Error("keyword length must be between 1 and 79")}const rLe=/^[\u0000-\u00FF]*$/;function nLe(e){if(!rLe.test(e))throw new Error("invalid latin1 text")}function sLe(e,t,r){const n=foe(t);e[n]=aLe(t,r-n.length-1)}function foe(e){for(e.mark();e.readByte()!==eLe;);const t=e.offset;e.reset();const r=doe.decode(e.readBytes(t-e.offset-1));return e.skip(1),tLe(r),r}function aLe(e,t){return doe.decode(e.readBytes(t))}const Ol={UNKNOWN:-1,GREYSCALE:0,TRUECOLOUR:2,INDEXED_COLOUR:3,GREYSCALE_ALPHA:4,TRUECOLOUR_ALPHA:6},vT={UNKNOWN:-1,DEFLATE:0},RU={UNKNOWN:-1,ADAPTIVE:0},yT={UNKNOWN:-1,NO_INTERLACE:0,ADAM7:1},eS={NONE:0,BACKGROUND:1,PREVIOUS:2},bT={SOURCE:0,OVER:1};class iLe extends KL{constructor(r,n={}){super(r);zn(this,"_checkCrc");zn(this,"_inflator");zn(this,"_png");zn(this,"_apng");zn(this,"_end");zn(this,"_hasPalette");zn(this,"_palette");zn(this,"_hasTransparency");zn(this,"_transparency");zn(this,"_compressionMethod");zn(this,"_filterMethod");zn(this,"_interlaceMethod");zn(this,"_colorType");zn(this,"_isAnimated");zn(this,"_numberOfFrames");zn(this,"_numberOfPlays");zn(this,"_frames");zn(this,"_writingDataChunks");const{checkCrc:a=!1}=n;this._checkCrc=a,this._inflator=new TU,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=vT.UNKNOWN,this._filterMethod=RU.UNKNOWN,this._interlaceMethod=yT.UNKNOWN,this._colorType=Ol.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for(IU(this);!this._end;){const r=this.readUint32(),n=this.readChars(4);this.decodeChunk(r,n)}return this.decodeImage(),this._png}decodeApng(){for(IU(this);!this._end;){const r=this.readUint32(),n=this.readChars(4);this.decodeApngChunk(r,n)}return this.decodeApngImage(),this._apng}decodeChunk(r,n){const a=this.offset;switch(n){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(r);break;case"IDAT":this.decodeIDAT(r);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(r);break;case"iCCP":this.decodeiCCP(r);break;case QRe:sLe(this._png.text,this,r);break;case"pHYs":this.decodepHYs();break;default:this.skip(r);break}if(this.offset-a!==r)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?OU(this,r+4,n):this.skip(4)}decodeApngChunk(r,n){const a=this.offset;switch(n!=="fdAT"&&n!=="IDAT"&&this._writingDataChunks&&this.pushDataToFrame(),n){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(r);break;default:this.decodeChunk(r,n),this.offset=a+r;break}if(this.offset-a!==r)throw new Error(`Length mismatch while decoding chunk ${n}`);this._checkCrc?OU(this,r+4,n):this.skip(4)}decodeIHDR(){const r=this._png;r.width=this.readUint32(),r.height=this.readUint32(),r.depth=oLe(this.readUint8());const n=this.readUint8();this._colorType=n;let a;switch(n){case Ol.GREYSCALE:a=1;break;case Ol.TRUECOLOUR:a=3;break;case Ol.INDEXED_COLOUR:a=1;break;case Ol.GREYSCALE_ALPHA:a=2;break;case Ol.TRUECOLOUR_ALPHA:a=4;break;case Ol.UNKNOWN:default:throw new Error(`Unknown color type: ${n}`)}if(this._png.channels=a,this._compressionMethod=this.readUint8(),this._compressionMethod!==vT.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const r={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(r)}decodePLTE(r){if(r%3!==0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${r}`);const n=r/3;this._hasPalette=!0;const a=[];this._palette=a;for(let i=0;i<n;i++)a.push([this.readUint8(),this.readUint8(),this.readUint8()])}decodeIDAT(r){this._writingDataChunks=!0;const n=r,a=this.offset+this.byteOffset;if(this._inflator.push(new Uint8Array(this.buffer,a,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodeFDAT(r){this._writingDataChunks=!0;let n=r,a=this.offset+this.byteOffset;if(a+=4,n-=4,this._inflator.push(new Uint8Array(this.buffer,a,n)),this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);this.skip(r)}decodetRNS(r){switch(this._colorType){case Ol.GREYSCALE:case Ol.TRUECOLOUR:{if(r%2!==0)throw new RangeError(`tRNS chunk length must be a multiple of 2. Got ${r}`);if(r/2>this._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${r/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(r/2);for(let n=0;n<r/2;n++)this._transparency[n]=this.readUint16();break}case Ol.INDEXED_COLOUR:{if(r>this._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${r} vs ${this._palette.length})`);let n=0;for(;n<r;n++){const a=this.readByte();this._palette[n].push(a)}for(;n<this._palette.length;n++)this._palette[n].push(255);break}case Ol.UNKNOWN:case Ol.GREYSCALE_ALPHA:case Ol.TRUECOLOUR_ALPHA:default:throw new Error(`tRNS chunk is not supported for color type ${this._colorType}`)}}decodeiCCP(r){const n=foe(this),a=this.readUint8();if(a!==vT.DEFLATE)throw new Error(`Unsupported iCCP compression method: ${a}`);const i=this.readBytes(r-n.length-2);this._png.iccEmbeddedProfile={name:n,profile:FRe(i)}}decodepHYs(){const r=this.readUint32(),n=this.readUint32(),a=this.readByte();this._png.resolution={x:r,y:n,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 r=0;r<this._numberOfFrames;r++){const n={sequenceNumber:this._frames[r].sequenceNumber,delayNumber:this._frames[r].delayNumber,delayDenominator:this._frames[r].delayDenominator,data:this._apng.depth===8?new Uint8Array(this._apng.width*this._apng.height*this._apng.channels):new Uint16Array(this._apng.width*this._apng.height*this._apng.channels)},a=this._frames.at(r);if(a){if(a.data=DU({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),r===0||a.xOffset===0&&a.yOffset===0&&a.width===this._png.width&&a.height===this._png.height)n.data=a.data;else{const i=this._apng.frames.at(r-1);this.disposeFrame(a,i,n),this.addFrameDataToCanvas(n,a)}this._apng.frames.push(n)}}return this._apng}disposeFrame(r,n,a){switch(r.disposeOp){case eS.NONE:break;case eS.BACKGROUND:for(let i=0;i<this._png.height;i++)for(let o=0;o<this._png.width;o++){const l=(i*r.width+o)*this._png.channels;for(let c=0;c<this._png.channels;c++)a.data[l+c]=0}break;case eS.PREVIOUS:a.data.set(n.data);break;default:throw new Error("Unknown disposeOp")}}addFrameDataToCanvas(r,n){const a=1<<this._png.depth,i=(o,l)=>{const c=((o+n.yOffset)*this._png.width+n.xOffset+l)*this._png.channels,u=(o*n.width+l)*this._png.channels;return{index:c,frameIndex:u}};switch(n.blendOp){case bT.SOURCE:for(let o=0;o<n.height;o++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:u}=i(o,l);for(let d=0;d<this._png.channels;d++)r.data[c+d]=n.data[u+d]}break;case bT.OVER:for(let o=0;o<n.height;o++)for(let l=0;l<n.width;l++){const{index:c,frameIndex:u}=i(o,l);for(let d=0;d<this._png.channels;d++){const f=n.data[u+this._png.channels-1]/a,m=d%(this._png.channels-1)===0?1:n.data[u+d],h=Math.floor(f*m+(1-f)*r.data[c+d]);r.data[c+d]+=h}}break;default:throw new Error("Unknown blendOp")}}decodeImage(){var n;if(this._inflator.err)throw new Error(`Error while decompressing the data: ${this._inflator.err}`);const r=this._isAnimated?((n=this._frames)==null?void 0:n.at(0)).data:this._inflator.result;if(this._filterMethod!==RU.ADAPTIVE)throw new Error(`Filter method ${this._filterMethod} not supported`);if(this._interlaceMethod===yT.NO_INTERLACE)this._png.data=DU({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else if(this._interlaceMethod===yT.ADAM7)this._png.data=WRe({data:r,width:this._png.width,height:this._png.height,channels:this._png.channels,depth:this._png.depth});else throw new Error(`Interlace method ${this._interlaceMethod} not supported`);this._hasPalette&&(this._png.palette=this._palette),this._hasTransparency&&(this._png.transparency=this._transparency)}pushDataToFrame(){const r=this._inflator.result,n=this._frames.at(-1);n?n.data=r:this._frames.push({sequenceNumber:0,width:this._png.width,height:this._png.height,xOffset:0,yOffset:0,delayNumber:0,delayDenominator:0,disposeOp:eS.NONE,blendOp:bT.SOURCE,data:r}),this._inflator=new TU,this._writingDataChunks=!1}}function oLe(e){if(e!==1&&e!==2&&e!==4&&e!==8&&e!==16)throw new Error(`invalid bit depth: ${e}`);return e}var LU;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.METRE=1]="METRE"})(LU||(LU={}));function lLe(e,t){return new iLe(e,t).decode()}var Fr=function(){return typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this}();function wT(){Fr.console&&typeof Fr.console.log=="function"&&Fr.console.log.apply(Fr.console,arguments)}var hs={log:wT,warn:function(e){Fr.console&&(typeof Fr.console.warn=="function"?Fr.console.warn.apply(Fr.console,arguments):wT.call(null,arguments))},error:function(e){Fr.console&&(typeof Fr.console.error=="function"?Fr.console.error.apply(Fr.console,arguments):wT(e))}};function jT(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){o0(n.response,t,r)},n.onerror=function(){hs.error("could not download file")},n.send()}function FU(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function tS(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 o0=Fr.saveAs||((typeof window>"u"?"undefined":rs(window))!=="object"||window!==Fr?function(){}:typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype?function(e,t,r){var n=Fr.URL||Fr.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?FU(a.href)?jT(e,t,r):tS(a,a.target="_blank"):tS(a)):(a.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(a.href)},4e4),setTimeout(function(){tS(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,r){if(t=t||e.name||"download",typeof e=="string")if(FU(e))jT(e,t,r);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){tS(n)})}else navigator.msSaveOrOpenBlob(function(a,i){return i===void 0?i={autoBom:!1}:rs(i)!=="object"&&(hs.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,r),t)}:function(e,t,r,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return jT(e,t,r);var a=e.type==="application/octet-stream",i=/constructor/i.test(Fr.HTMLElement)||Fr.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||a&&i)&&(typeof FileReader>"u"?"undefined":rs(FileReader))==="object"){var l=new FileReader;l.onloadend=function(){var d=l.result;d=o?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=d:location=d,n=null},l.readAsDataURL(e)}else{var c=Fr.URL||Fr.webkitURL,u=c.createObjectURL(e);n?n.location=u:location.href=u,n=null,setTimeout(function(){c.revokeObjectURL(u)},4e4)}});/**
* A class to parse color values
* @author Stoyan Stefanov <sstoo@gmail.com>
* {@link http://www.phpied.com/rgb-color-parser-in-javascript/}
* @license Use it if you like it
*/function hoe(e){var t;e=e||"",this.ok=!1,e.charAt(0)=="#"&&(e=e.substr(1,6)),e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var r=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(l){return[parseInt(l[1]),parseInt(l[2]),parseInt(l[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(l){return[parseInt(l[1],16),parseInt(l[2],16),parseInt(l[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(l){return[parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16),parseInt(l[3]+l[3],16)]}}],n=0;n<r.length;n++){var a=r[n].re,i=r[n].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),u=this.b.toString(16);return l.length==1&&(l="0"+l),c.length==1&&(c="0"+c),u.length==1&&(u="0"+u),"#"+l+c+u}}var l5=Fr.atob.bind(Fr),MU=Fr.btoa.bind(Fr);/**
* @license
* Joseph Myers does not specify a particular license for his work.
*
* Author: Joseph Myers
* Accessed from: http://www.myersdaily.org/joseph/javascript/md5.js
*
* Modified by: Owen Leong
*/function _T(e,t){var r=e[0],n=e[1],a=e[2],i=e[3];r=to(r,n,a,i,t[0],7,-680876936),i=to(i,r,n,a,t[1],12,-389564586),a=to(a,i,r,n,t[2],17,606105819),n=to(n,a,i,r,t[3],22,-1044525330),r=to(r,n,a,i,t[4],7,-176418897),i=to(i,r,n,a,t[5],12,1200080426),a=to(a,i,r,n,t[6],17,-1473231341),n=to(n,a,i,r,t[7],22,-45705983),r=to(r,n,a,i,t[8],7,1770035416),i=to(i,r,n,a,t[9],12,-1958414417),a=to(a,i,r,n,t[10],17,-42063),n=to(n,a,i,r,t[11],22,-1990404162),r=to(r,n,a,i,t[12],7,1804603682),i=to(i,r,n,a,t[13],12,-40341101),a=to(a,i,r,n,t[14],17,-1502002290),r=ro(r,n=to(n,a,i,r,t[15],22,1236535329),a,i,t[1],5,-165796510),i=ro(i,r,n,a,t[6],9,-1069501632),a=ro(a,i,r,n,t[11],14,643717713),n=ro(n,a,i,r,t[0],20,-373897302),r=ro(r,n,a,i,t[5],5,-701558691),i=ro(i,r,n,a,t[10],9,38016083),a=ro(a,i,r,n,t[15],14,-660478335),n=ro(n,a,i,r,t[4],20,-405537848),r=ro(r,n,a,i,t[9],5,568446438),i=ro(i,r,n,a,t[14],9,-1019803690),a=ro(a,i,r,n,t[3],14,-187363961),n=ro(n,a,i,r,t[8],20,1163531501),r=ro(r,n,a,i,t[13],5,-1444681467),i=ro(i,r,n,a,t[2],9,-51403784),a=ro(a,i,r,n,t[7],14,1735328473),r=no(r,n=ro(n,a,i,r,t[12],20,-1926607734),a,i,t[5],4,-378558),i=no(i,r,n,a,t[8],11,-2022574463),a=no(a,i,r,n,t[11],16,1839030562),n=no(n,a,i,r,t[14],23,-35309556),r=no(r,n,a,i,t[1],4,-1530992060),i=no(i,r,n,a,t[4],11,1272893353),a=no(a,i,r,n,t[7],16,-155497632),n=no(n,a,i,r,t[10],23,-1094730640),r=no(r,n,a,i,t[13],4,681279174),i=no(i,r,n,a,t[0],11,-358537222),a=no(a,i,r,n,t[3],16,-722521979),n=no(n,a,i,r,t[6],23,76029189),r=no(r,n,a,i,t[9],4,-640364487),i=no(i,r,n,a,t[12],11,-421815835),a=no(a,i,r,n,t[15],16,530742520),r=so(r,n=no(n,a,i,r,t[2],23,-995338651),a,i,t[0],6,-198630844),i=so(i,r,n,a,t[7],10,1126891415),a=so(a,i,r,n,t[14],15,-1416354905),n=so(n,a,i,r,t[5],21,-57434055),r=so(r,n,a,i,t[12],6,1700485571),i=so(i,r,n,a,t[3],10,-1894986606),a=so(a,i,r,n,t[10],15,-1051523),n=so(n,a,i,r,t[1],21,-2054922799),r=so(r,n,a,i,t[8],6,1873313359),i=so(i,r,n,a,t[15],10,-30611744),a=so(a,i,r,n,t[6],15,-1560198380),n=so(n,a,i,r,t[13],21,1309151649),r=so(r,n,a,i,t[4],6,-145523070),i=so(i,r,n,a,t[11],10,-1120210379),a=so(a,i,r,n,t[2],15,718787259),n=so(n,a,i,r,t[9],21,-343485551),e[0]=Tm(r,e[0]),e[1]=Tm(n,e[1]),e[2]=Tm(a,e[2]),e[3]=Tm(i,e[3])}function ZC(e,t,r,n,a,i){return t=Tm(Tm(t,e),Tm(n,i)),Tm(t<<a|t>>>32-a,r)}function to(e,t,r,n,a,i,o){return ZC(t&r|~t&n,e,t,a,i,o)}function ro(e,t,r,n,a,i,o){return ZC(t&n|r&~n,e,t,a,i,o)}function no(e,t,r,n,a,i,o){return ZC(t^r^n,e,t,a,i,o)}function so(e,t,r,n,a,i,o){return ZC(r^(t|~n),e,t,a,i,o)}function moe(e){var t,r=e.length,n=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)_T(n,cLe(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(_T(n,a),t=0;t<16;t++)a[t]=0;return a[14]=8*r,_T(n,a),n}function cLe(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}var $U="0123456789abcdef".split("");function uLe(e){for(var t="",r=0;r<4;r++)t+=$U[e>>8*r+4&15]+$U[e>>8*r&15];return t}function dLe(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function s8(e){return moe(e).map(dLe).join("")}var fLe=function(e){for(var t=0;t<e.length;t++)e[t]=uLe(e[t]);return e.join("")}(moe("hello"))!="5d41402abc4b2a76b9719d911017c592";function Tm(e,t){if(fLe){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}return e+t&4294967295}/**
* @license
* FPDF is released under a permissive license: there is no usage restriction.
* You may embed it freely in your application (commercial or not), with or
* without modifications.
*
* Reference: http://www.fpdf.org/en/script/script37.php
*/function a8(e,t){var r,n,a,i;if(e!==r){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 u=0;for(c=0;c<256;c++){var d=l[c];u=(u+d+o.charCodeAt(c))%256,l[c]=l[u],l[u]=d}r=e,n=l}else l=n;var f=t.length,m=0,h=0,g="";for(c=0;c<f;c++)h=(h+(d=l[m=(m+1)%256]))%256,l[m]=l[h],l[h]=d,o=l[(l[m]+l[h])%256],g+=String.fromCharCode(t.charCodeAt(c)^o);return g}/**
* @license
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
* Author: Owen Leong (@owenl131)
* Date: 15 Oct 2020
* References:
* https://www.cs.cmu.edu/~dst/Adobe/Gallery/anon21jul01-pdf-encryption.txt
* https://github.com/foliojs/pdfkit/blob/master/lib/security.js
* http://www.fpdf.org/en/script/script37.php
*/var BU={print:4,modify:8,copy:16,"annot-forms":32};function Mx(e,t,r,n){this.v=1,this.r=2;var a=192;e.forEach(function(l){if(BU.perm!==void 0)throw new Error("Invalid permission: "+l);a+=BU[l]}),this.padding="(¿N^NuAd\0NVÿú\b..\0¶Ðh>/\f©þdSiz";var i=(t+this.padding).substr(0,32),o=(r+this.padding).substr(0,32);this.O=this.processOwnerPassword(i,o),this.P=-(1+(255^a)),this.encryptionKey=s8(i+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(n)).substr(0,5),this.U=a8(this.encryptionKey,this.padding)}function $x(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",r=e.length,n=0;n<r;n++){var a=e.charCodeAt(n);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[n]}return t}function zU(e){if(rs(e)!=="object")throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(r,n,a){if(a=a||!1,typeof r!="string"||typeof n!="function"||typeof a!="boolean")throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(r)||(t[r]={});var i=Math.random().toString(35);return t[r][i]=[n,!!a],i},this.unsubscribe=function(r){for(var n in t)if(t[n][r])return delete t[n][r],Object.keys(t[n]).length===0&&delete t[n],!0;return!1},this.publish=function(r){if(t.hasOwnProperty(r)){var n=Array.prototype.slice.call(arguments,1),a=[];for(var i in t[r]){var o=t[r][i];try{o[0].apply(e,n)}catch(l){Fr.console&&hs.error("jsPDF PubSub Error",l.message,l)}o[1]&&a.push(i)}a.length&&a.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function _2(e){if(!(this instanceof _2))return new _2(e);var t="opacity,stroke-opacity".split(",");for(var r in e)e.hasOwnProperty(r)&&t.indexOf(r)>=0&&(this[r]=e[r]);this.id="",this.objectNumber=-1}function poe(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function dm(e,t,r,n,a){if(!(this instanceof dm))return new dm(e,t,r,n,a);this.type=e==="axial"?2:3,this.coords=t,this.colors=r,poe.call(this,n,a)}function j0(e,t,r,n,a){if(!(this instanceof j0))return new j0(e,t,r,n,a);this.boundingBox=e,this.xStep=t,this.yStep=r,this.stream="",this.cloneIndex=0,poe.call(this,n,a)}function or(e){var t,r=typeof arguments[0]=="string"?arguments[0]:"p",n=arguments[1],a=arguments[2],i=arguments[3],o=[],l=1,c=16,u="S",d=null;rs(e=e||{})==="object"&&(r=e.orientation,n=e.unit||n,a=e.format||a,i=e.compress||e.compressPdf||i,(d=e.encryption||null)!==null&&(d.userPassword=d.userPassword||"",d.ownerPassword=d.ownerPassword||"",d.userPermissions=d.userPermissions||[]),l=typeof e.userUnit=="number"?Math.abs(e.userUnit):1,e.precision!==void 0&&(t=e.precision),e.floatPrecision!==void 0&&(c=e.floatPrecision),u=e.defaultPathOperation||"S"),o=e.filters||(i===!0?["FlateEncode"]:o),n=n||"mm",r=(""+(r||"P")).toLowerCase();var f=e.putOnlyUsedFonts||!1,m={},h={internal:{},__private__:{}};h.__private__.PubSub=zU;var g="1.3",p=h.__private__.getPdfVersion=function(){return g};h.__private__.setPdfVersion=function(G){g=G};var x={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]};h.__private__.getPageFormats=function(){return x};var v=h.__private__.getPageFormat=function(G){return x[G]};a=a||"a4";var b="compat",y="advanced",N=b;function _(){this.saveGraphicsState(),Z(new Ht(He,0,0,-He,0,zp()*He).toString()+" cm"),this.setFontSize(this.getFontSize()/He),u="n",N=y}function j(){this.restoreGraphicsState(),u="S",N=b}var S=h.__private__.combineFontStyleAndFontWeight=function(G,ce){if(G=="bold"&&ce=="normal"||G=="bold"&&ce==400||G=="normal"&&ce=="italic"||G=="bold"&&ce=="italic")throw new Error("Invalid Combination of fontweight and fontstyle");return ce&&(G=ce==400||ce==="normal"?G==="italic"?"italic":"normal":ce!=700&&ce!=="bold"||G!=="normal"?(ce==700?"bold":ce)+""+G:"bold"),G};h.advancedAPI=function(G){var ce=N===b;return ce&&_.call(this),typeof G!="function"||(G(this),ce&&j.call(this)),this},h.compatAPI=function(G){var ce=N===y;return ce&&j.call(this),typeof G!="function"||(G(this),ce&&_.call(this)),this},h.isAdvancedAPI=function(){return N===y};var I,P=function(G){if(N!==y)throw new Error(G+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},F=h.roundToPrecision=h.__private__.roundToPrecision=function(G,ce){var De=t||ce;if(isNaN(G)||isNaN(De))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return G.toFixed(De).replace(/0+$/,"")};I=h.hpf=h.__private__.hpf=typeof c=="number"?function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.hpf");return F(G,c)}:c==="smart"?function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.hpf");return F(G,G>-1&&G<1?16:5)}:function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.hpf");return F(G,16)};var T=h.f2=h.__private__.f2=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.f2");return F(G,2)},k=h.__private__.f3=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.f3");return F(G,3)},V=h.scale=h.__private__.scale=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.scale");return N===b?G*He:N===y?G:void 0},C=function(G){return V(function(ce){return N===b?zp()-ce:N===y?ce:void 0}(G))};h.__private__.setPrecision=h.setPrecision=function(G){typeof parseInt(G,10)=="number"&&(t=parseInt(G,10))};var R,H="00000000000000000000000000000000",q=h.__private__.getFileId=function(){return H},L=h.__private__.setFileId=function(G){return H=G!==void 0&&/^[a-fA-F0-9]{32}$/.test(G)?G.toUpperCase():H.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),d!==null&&(ei=new Mx(d.userPermissions,d.userPassword,d.ownerPassword,H)),H};h.setFileId=function(G){return L(G),this},h.getFileId=function(){return q()};var M=h.__private__.convertDateToPDFDate=function(G){var ce=G.getTimezoneOffset(),De=ce<0?"+":"-",Be=Math.floor(Math.abs(ce/60)),Je=Math.abs(ce%60),mt=[De,O(Be),"'",O(Je),"'"].join("");return["D:",G.getFullYear(),O(G.getMonth()+1),O(G.getDate()),O(G.getHours()),O(G.getMinutes()),O(G.getSeconds()),mt].join("")},z=h.__private__.convertPDFDateToDate=function(G){var ce=parseInt(G.substr(2,4),10),De=parseInt(G.substr(6,2),10)-1,Be=parseInt(G.substr(8,2),10),Je=parseInt(G.substr(10,2),10),mt=parseInt(G.substr(12,2),10),bt=parseInt(G.substr(14,2),10);return new Date(ce,De,Be,Je,mt,bt,0)},K=h.__private__.setCreationDate=function(G){var ce;if(G===void 0&&(G=new Date),G instanceof Date)ce=M(G);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(G))throw new Error("Invalid argument passed to jsPDF.setCreationDate");ce=G}return R=ce},E=h.__private__.getCreationDate=function(G){var ce=R;return G==="jsDate"&&(ce=z(R)),ce};h.setCreationDate=function(G){return K(G),this},h.getCreationDate=function(G){return E(G)};var A,O=h.__private__.padd2=function(G){return("0"+parseInt(G)).slice(-2)},U=h.__private__.padd2Hex=function(G){return("00"+(G=G.toString())).substr(G.length)},Y=0,J=[],se=[],ee=0,ie=[],Ee=[],te=!1,Ue=se;h.__private__.setCustomOutputDestination=function(G){te=!0,Ue=G};var W=function(G){te||(Ue=G)};h.__private__.resetCustomOutputDestination=function(){te=!1,Ue=se};var Z=h.__private__.out=function(G){return G=G.toString(),ee+=G.length+1,Ue.push(G),Ue},le=h.__private__.write=function(G){return Z(arguments.length===1?G.toString():Array.prototype.join.call(arguments," "))},re=h.__private__.getArrayBuffer=function(G){for(var ce=G.length,De=new ArrayBuffer(ce),Be=new Uint8Array(De);ce--;)Be[ce]=G.charCodeAt(ce);return De},oe=[["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]];h.__private__.getStandardFonts=function(){return oe};var fe=e.fontSize||16;h.__private__.setFontSize=h.setFontSize=function(G){return fe=N===y?G/He:G,this};var Fe,ge=h.__private__.getFontSize=h.getFontSize=function(){return N===b?fe:fe*He},pe=e.R2L||!1;h.__private__.setR2L=h.setR2L=function(G){return pe=G,this},h.__private__.getR2L=h.getR2L=function(){return pe};var Ie,Ge=h.__private__.setZoomMode=function(G){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(G))Fe=G;else if(isNaN(G)){if([void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(G)===-1)throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+G+'" is not recognized.');Fe=G}else Fe=parseInt(G,10)};h.__private__.getZoomMode=function(){return Fe};var we,_e=h.__private__.setPageMode=function(G){if([void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(G)==-1)throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+G+'" is not recognized.');Ie=G};h.__private__.getPageMode=function(){return Ie};var qe=h.__private__.setLayoutMode=function(G){if([void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(G)==-1)throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+G+'" is not recognized.');we=G};h.__private__.getLayoutMode=function(){return we},h.__private__.setDisplayMode=h.setDisplayMode=function(G,ce,De){return Ge(G),qe(ce),_e(De),this};var Re={title:"",subject:"",author:"",keywords:"",creator:""};h.__private__.getDocumentProperty=function(G){if(Object.keys(Re).indexOf(G)===-1)throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Re[G]},h.__private__.getDocumentProperties=function(){return Re},h.__private__.setDocumentProperties=h.setProperties=h.setDocumentProperties=function(G){for(var ce in Re)Re.hasOwnProperty(ce)&&G[ce]&&(Re[ce]=G[ce]);return this},h.__private__.setDocumentProperty=function(G,ce){if(Object.keys(Re).indexOf(G)===-1)throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Re[G]=ce};var Me,He,st,Zt,_t,Vt={},Jt={},Qt=[],qt={},it={},It={},Mt={},wr=null,$t=0,kt=[],dr=new zU(h),Kt=e.hotfixes||[],ir={},jr={},mn=[],Ht=function G(ce,De,Be,Je,mt,bt){if(!(this instanceof G))return new G(ce,De,Be,Je,mt,bt);isNaN(ce)&&(ce=1),isNaN(De)&&(De=0),isNaN(Be)&&(Be=0),isNaN(Je)&&(Je=1),isNaN(mt)&&(mt=0),isNaN(bt)&&(bt=0),this._matrix=[ce,De,Be,Je,mt,bt]};Object.defineProperty(Ht.prototype,"sx",{get:function(){return this._matrix[0]},set:function(G){this._matrix[0]=G}}),Object.defineProperty(Ht.prototype,"shy",{get:function(){return this._matrix[1]},set:function(G){this._matrix[1]=G}}),Object.defineProperty(Ht.prototype,"shx",{get:function(){return this._matrix[2]},set:function(G){this._matrix[2]=G}}),Object.defineProperty(Ht.prototype,"sy",{get:function(){return this._matrix[3]},set:function(G){this._matrix[3]=G}}),Object.defineProperty(Ht.prototype,"tx",{get:function(){return this._matrix[4]},set:function(G){this._matrix[4]=G}}),Object.defineProperty(Ht.prototype,"ty",{get:function(){return this._matrix[5]},set:function(G){this._matrix[5]=G}}),Object.defineProperty(Ht.prototype,"a",{get:function(){return this._matrix[0]},set:function(G){this._matrix[0]=G}}),Object.defineProperty(Ht.prototype,"b",{get:function(){return this._matrix[1]},set:function(G){this._matrix[1]=G}}),Object.defineProperty(Ht.prototype,"c",{get:function(){return this._matrix[2]},set:function(G){this._matrix[2]=G}}),Object.defineProperty(Ht.prototype,"d",{get:function(){return this._matrix[3]},set:function(G){this._matrix[3]=G}}),Object.defineProperty(Ht.prototype,"e",{get:function(){return this._matrix[4]},set:function(G){this._matrix[4]=G}}),Object.defineProperty(Ht.prototype,"f",{get:function(){return this._matrix[5]},set:function(G){this._matrix[5]=G}}),Object.defineProperty(Ht.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ht.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ht.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ht.prototype,"isIdentity",{get:function(){return this.sx===1&&this.shy===0&&this.shx===0&&this.sy===1&&this.tx===0&&this.ty===0}}),Ht.prototype.join=function(G){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(I).join(G)},Ht.prototype.multiply=function(G){var ce=G.sx*this.sx+G.shy*this.shx,De=G.sx*this.shy+G.shy*this.sy,Be=G.shx*this.sx+G.sy*this.shx,Je=G.shx*this.shy+G.sy*this.sy,mt=G.tx*this.sx+G.ty*this.shx+this.tx,bt=G.tx*this.shy+G.ty*this.sy+this.ty;return new Ht(ce,De,Be,Je,mt,bt)},Ht.prototype.decompose=function(){var G=this.sx,ce=this.shy,De=this.shx,Be=this.sy,Je=this.tx,mt=this.ty,bt=Math.sqrt(G*G+ce*ce),ar=(G/=bt)*De+(ce/=bt)*Be;De-=G*ar,Be-=ce*ar;var hr=Math.sqrt(De*De+Be*Be);return ar/=hr,G*(Be/=hr)<ce*(De/=hr)&&(G=-G,ce=-ce,ar=-ar,bt=-bt),{scale:new Ht(bt,0,0,hr,0,0),translate:new Ht(1,0,0,1,Je,mt),rotate:new Ht(G,ce,-ce,G,0,0),skew:new Ht(1,0,ar,1,0,0)}},Ht.prototype.toString=function(G){return this.join(" ")},Ht.prototype.inversed=function(){var G=this.sx,ce=this.shy,De=this.shx,Be=this.sy,Je=this.tx,mt=this.ty,bt=1/(G*Be-ce*De),ar=Be*bt,hr=-ce*bt,qr=-De*bt,rn=G*bt;return new Ht(ar,hr,qr,rn,-ar*Je-qr*mt,-hr*Je-rn*mt)},Ht.prototype.applyToPoint=function(G){var ce=G.x*this.sx+G.y*this.shx+this.tx,De=G.x*this.shy+G.y*this.sy+this.ty;return new xf(ce,De)},Ht.prototype.applyToRectangle=function(G){var ce=this.applyToPoint(G),De=this.applyToPoint(new xf(G.x+G.w,G.y+G.h));return new U1(ce.x,ce.y,De.x-ce.x,De.y-ce.y)},Ht.prototype.clone=function(){var G=this.sx,ce=this.shy,De=this.shx,Be=this.sy,Je=this.tx,mt=this.ty;return new Ht(G,ce,De,Be,Je,mt)},h.Matrix=Ht;var sn=h.matrixMult=function(G,ce){return ce.multiply(G)},Bn=new Ht(1,0,0,1,0,0);h.unitMatrix=h.identityMatrix=Bn;var tn=function(G,ce){if(!it[G]){var De=(ce instanceof dm?"Sh":"P")+(Object.keys(qt).length+1).toString(10);ce.id=De,it[G]=De,qt[De]=ce,dr.publish("addPattern",ce)}};h.ShadingPattern=dm,h.TilingPattern=j0,h.addShadingPattern=function(G,ce){return P("addShadingPattern()"),tn(G,ce),this},h.beginTilingPattern=function(G){P("beginTilingPattern()"),q1(G.boundingBox[0],G.boundingBox[1],G.boundingBox[2]-G.boundingBox[0],G.boundingBox[3]-G.boundingBox[1],G.matrix)},h.endTilingPattern=function(G,ce){P("endTilingPattern()"),ce.stream=Ee[A].join(`
`),tn(G,ce),dr.publish("endTilingPattern",ce),mn.pop().restore()};var vn,En=h.__private__.newObject=function(){var G=Xn();return me(G,!0),G},Xn=h.__private__.newObjectDeferred=function(){return Y++,J[Y]=function(){return ee},Y},me=function(G,ce){return ce=typeof ce=="boolean"&&ce,J[G]=ee,ce&&Z(G+" 0 obj"),G},Te=h.__private__.newAdditionalObject=function(){var G={objId:Xn(),content:""};return ie.push(G),G},Ne=Xn(),Ce=Xn(),ue=h.__private__.decodeColorString=function(G){var ce=G.split(" ");if(ce.length!==2||ce[1]!=="g"&&ce[1]!=="G")ce.length!==5||ce[4]!=="k"&&ce[4]!=="K"||(ce=[(1-ce[0])*(1-ce[3]),(1-ce[1])*(1-ce[3]),(1-ce[2])*(1-ce[3]),"r"]);else{var De=parseFloat(ce[0]);ce=[De,De,De,"r"]}for(var Be="#",Je=0;Je<3;Je++)Be+=("0"+Math.floor(255*parseFloat(ce[Je])).toString(16)).slice(-2);return Be},ve=h.__private__.encodeColorString=function(G){var ce;typeof G=="string"&&(G={ch1:G});var De=G.ch1,Be=G.ch2,Je=G.ch3,mt=G.ch4,bt=G.pdfColorType==="draw"?["G","RG","K"]:["g","rg","k"];if(typeof De=="string"&&De.charAt(0)!=="#"){var ar=new hoe(De);if(ar.ok)De=ar.toHex();else if(!/^\d*\.?\d*$/.test(De))throw new Error('Invalid color "'+De+'" passed to jsPDF.encodeColorString.')}if(typeof De=="string"&&/^#[0-9A-Fa-f]{3}$/.test(De)&&(De="#"+De[1]+De[1]+De[2]+De[2]+De[3]+De[3]),typeof De=="string"&&/^#[0-9A-Fa-f]{6}$/.test(De)){var hr=parseInt(De.substr(1),16);De=hr>>16&255,Be=hr>>8&255,Je=255&hr}if(Be===void 0||mt===void 0&&De===Be&&Be===Je)ce=typeof De=="string"?De+" "+bt[0]:G.precision===2?T(De/255)+" "+bt[0]:k(De/255)+" "+bt[0];else if(mt===void 0||rs(mt)==="object"){if(mt&&!isNaN(mt.a)&&mt.a===0)return["1.","1.","1.",bt[1]].join(" ");ce=typeof De=="string"?[De,Be,Je,bt[1]].join(" "):G.precision===2?[T(De/255),T(Be/255),T(Je/255),bt[1]].join(" "):[k(De/255),k(Be/255),k(Je/255),bt[1]].join(" ")}else ce=typeof De=="string"?[De,Be,Je,mt,bt[2]].join(" "):G.precision===2?[T(De),T(Be),T(Je),T(mt),bt[2]].join(" "):[k(De),k(Be),k(Je),k(mt),bt[2]].join(" ");return ce},$e=h.__private__.getFilters=function(){return o},et=h.__private__.putStream=function(G){var ce=(G=G||{}).data||"",De=G.filters||$e(),Be=G.alreadyAppliedFilters||[],Je=G.addLength1||!1,mt=ce.length,bt=G.objectId,ar=function(ti){return ti};if(d!==null&&bt===void 0)throw new Error("ObjectId must be passed to putStream for file encryption");d!==null&&(ar=ei.encryptor(bt,0));var hr={};De===!0&&(De=["FlateEncode"]);var qr=G.additionalKeyValues||[],rn=(hr=or.API.processDataByFilters!==void 0?or.API.processDataByFilters(ce,De):{data:ce,reverseChain:[]}).reverseChain+(Array.isArray(Be)?Be.join(" "):Be.toString());if(hr.data.length!==0&&(qr.push({key:"Length",value:hr.data.length}),Je===!0&&qr.push({key:"Length1",value:mt})),rn.length!=0)if(rn.split("/").length-1==1)qr.push({key:"Filter",value:rn});else{qr.push({key:"Filter",value:"["+rn+"]"});for(var An=0;An<qr.length;An+=1)if(qr[An].key==="DecodeParms"){for(var Ys=[],Ma=0;Ma<hr.reverseChain.split("/").length-1;Ma+=1)Ys.push("null");Ys.push(qr[An].value),qr[An].value="["+Ys.join(" ")+"]"}}Z("<<");for(var ys=0;ys<qr.length;ys++)Z("/"+qr[ys].key+" "+qr[ys].value);Z(">>"),hr.data.length!==0&&(Z("stream"),Z(ar(hr.data)),Z("endstream"))},Xe=h.__private__.putPage=function(G){var ce=G.number,De=G.data,Be=G.objId,Je=G.contentsObjId;me(Be,!0),Z("<</Type /Page"),Z("/Parent "+G.rootDictionaryObjId+" 0 R"),Z("/Resources "+G.resourceDictionaryObjId+" 0 R"),Z("/MediaBox ["+parseFloat(I(G.mediaBox.bottomLeftX))+" "+parseFloat(I(G.mediaBox.bottomLeftY))+" "+I(G.mediaBox.topRightX)+" "+I(G.mediaBox.topRightY)+"]"),G.cropBox!==null&&Z("/CropBox ["+I(G.cropBox.bottomLeftX)+" "+I(G.cropBox.bottomLeftY)+" "+I(G.cropBox.topRightX)+" "+I(G.cropBox.topRightY)+"]"),G.bleedBox!==null&&Z("/BleedBox ["+I(G.bleedBox.bottomLeftX)+" "+I(G.bleedBox.bottomLeftY)+" "+I(G.bleedBox.topRightX)+" "+I(G.bleedBox.topRightY)+"]"),G.trimBox!==null&&Z("/TrimBox ["+I(G.trimBox.bottomLeftX)+" "+I(G.trimBox.bottomLeftY)+" "+I(G.trimBox.topRightX)+" "+I(G.trimBox.topRightY)+"]"),G.artBox!==null&&Z("/ArtBox ["+I(G.artBox.bottomLeftX)+" "+I(G.artBox.bottomLeftY)+" "+I(G.artBox.topRightX)+" "+I(G.artBox.topRightY)+"]"),typeof G.userUnit=="number"&&G.userUnit!==1&&Z("/UserUnit "+G.userUnit),dr.publish("putPage",{objId:Be,pageContext:kt[ce],pageNumber:ce,page:De}),Z("/Contents "+Je+" 0 R"),Z(">>"),Z("endobj");var mt=De.join(`
`);return N===y&&(mt+=`
Q`),me(Je,!0),et({data:mt,filters:$e(),objectId:Je}),Z("endobj"),Be},Ze=h.__private__.putPages=function(){var G,ce,De=[];for(G=1;G<=$t;G++)kt[G].objId=Xn(),kt[G].contentsObjId=Xn();for(G=1;G<=$t;G++)De.push(Xe({number:G,data:Ee[G],objId:kt[G].objId,contentsObjId:kt[G].contentsObjId,mediaBox:kt[G].mediaBox,cropBox:kt[G].cropBox,bleedBox:kt[G].bleedBox,trimBox:kt[G].trimBox,artBox:kt[G].artBox,userUnit:kt[G].userUnit,rootDictionaryObjId:Ne,resourceDictionaryObjId:Ce}));me(Ne,!0),Z("<</Type /Pages");var Be="/Kids [";for(ce=0;ce<$t;ce++)Be+=De[ce]+" 0 R ";Z(Be+"]"),Z("/Count "+$t),Z(">>"),Z("endobj"),dr.publish("postPutPages")},rt=function(G){dr.publish("putFont",{font:G,out:Z,newObject:En,putStream:et}),G.isAlreadyPutted!==!0&&(G.objectNumber=En(),Z("<<"),Z("/Type /Font"),Z("/BaseFont /"+$x(G.postScriptName)),Z("/Subtype /Type1"),typeof G.encoding=="string"&&Z("/Encoding /"+G.encoding),Z("/FirstChar 32"),Z("/LastChar 255"),Z(">>"),Z("endobj"))},Nt=function(G){G.objectNumber=En();var ce=[];ce.push({key:"Type",value:"/XObject"}),ce.push({key:"Subtype",value:"/Form"}),ce.push({key:"BBox",value:"["+[I(G.x),I(G.y),I(G.x+G.width),I(G.y+G.height)].join(" ")+"]"}),ce.push({key:"Matrix",value:"["+G.matrix.toString()+"]"});var De=G.pages[1].join(`
`);et({data:De,additionalKeyValues:ce,objectId:G.objectNumber}),Z("endobj")},Rt=function(G,ce){ce||(ce=21);var De=En(),Be=function(bt,ar){var hr,qr=[],rn=1/(ar-1);for(hr=0;hr<1;hr+=rn)qr.push(hr);if(qr.push(1),bt[0].offset!=0){var An={offset:0,color:bt[0].color};bt.unshift(An)}if(bt[bt.length-1].offset!=1){var Ys={offset:1,color:bt[bt.length-1].color};bt.push(Ys)}for(var Ma="",ys=0,ti=0;ti<qr.length;ti++){for(hr=qr[ti];hr>bt[ys+1].offset;)ys++;var $a=bt[ys].offset,Fi=(hr-$a)/(bt[ys+1].offset-$a),bf=bt[ys].color,pu=bt[ys+1].color;Ma+=U(Math.round((1-Fi)*bf[0]+Fi*pu[0]).toString(16))+U(Math.round((1-Fi)*bf[1]+Fi*pu[1]).toString(16))+U(Math.round((1-Fi)*bf[2]+Fi*pu[2]).toString(16))}return Ma.trim()}(G.colors,ce),Je=[];Je.push({key:"FunctionType",value:"0"}),Je.push({key:"Domain",value:"[0.0 1.0]"}),Je.push({key:"Size",value:"["+ce+"]"}),Je.push({key:"BitsPerSample",value:"8"}),Je.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),Je.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),et({data:Be,additionalKeyValues:Je,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:De}),Z("endobj"),G.objectNumber=En(),Z("<< /ShadingType "+G.type),Z("/ColorSpace /DeviceRGB");var mt="/Coords ["+I(parseFloat(G.coords[0]))+" "+I(parseFloat(G.coords[1]))+" ";G.type===2?mt+=I(parseFloat(G.coords[2]))+" "+I(parseFloat(G.coords[3])):mt+=I(parseFloat(G.coords[2]))+" "+I(parseFloat(G.coords[3]))+" "+I(parseFloat(G.coords[4]))+" "+I(parseFloat(G.coords[5])),Z(mt+="]"),G.matrix&&Z("/Matrix ["+G.matrix.toString()+"]"),Z("/Function "+De+" 0 R"),Z("/Extend [true true]"),Z(">>"),Z("endobj")},Wt=function(G,ce){var De=Xn(),Be=En();ce.push({resourcesOid:De,objectOid:Be}),G.objectNumber=Be;var Je=[];Je.push({key:"Type",value:"/Pattern"}),Je.push({key:"PatternType",value:"1"}),Je.push({key:"PaintType",value:"1"}),Je.push({key:"TilingType",value:"1"}),Je.push({key:"BBox",value:"["+G.boundingBox.map(I).join(" ")+"]"}),Je.push({key:"XStep",value:I(G.xStep)}),Je.push({key:"YStep",value:I(G.yStep)}),Je.push({key:"Resources",value:De+" 0 R"}),G.matrix&&Je.push({key:"Matrix",value:"["+G.matrix.toString()+"]"}),et({data:G.stream,additionalKeyValues:Je,objectId:G.objectNumber}),Z("endobj")},Tt=function(G){for(var ce in G.objectNumber=En(),Z("<<"),G)switch(ce){case"opacity":Z("/ca "+T(G[ce]));break;case"stroke-opacity":Z("/CA "+T(G[ce]))}Z(">>"),Z("endobj")},Ut=function(G){me(G.resourcesOid,!0),Z("<<"),Z("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var ce in Z("/Font <<"),Vt)Vt.hasOwnProperty(ce)&&(f===!1||f===!0&&m.hasOwnProperty(ce))&&Z("/"+ce+" "+Vt[ce].objectNumber+" 0 R");Z(">>")}(),function(){if(Object.keys(qt).length>0){for(var ce in Z("/Shading <<"),qt)qt.hasOwnProperty(ce)&&qt[ce]instanceof dm&&qt[ce].objectNumber>=0&&Z("/"+ce+" "+qt[ce].objectNumber+" 0 R");dr.publish("putShadingPatternDict"),Z(">>")}}(),function(ce){if(Object.keys(qt).length>0){for(var De in Z("/Pattern <<"),qt)qt.hasOwnProperty(De)&&qt[De]instanceof h.TilingPattern&&qt[De].objectNumber>=0&&qt[De].objectNumber<ce&&Z("/"+De+" "+qt[De].objectNumber+" 0 R");dr.publish("putTilingPatternDict"),Z(">>")}}(G.objectOid),function(){if(Object.keys(It).length>0){var ce;for(ce in Z("/ExtGState <<"),It)It.hasOwnProperty(ce)&&It[ce].objectNumber>=0&&Z("/"+ce+" "+It[ce].objectNumber+" 0 R");dr.publish("putGStateDict"),Z(">>")}}(),function(){for(var ce in Z("/XObject <<"),ir)ir.hasOwnProperty(ce)&&ir[ce].objectNumber>=0&&Z("/"+ce+" "+ir[ce].objectNumber+" 0 R");dr.publish("putXobjectDict"),Z(">>")}(),Z(">>"),Z("endobj")},Or=function(G){Jt[G.fontName]=Jt[G.fontName]||{},Jt[G.fontName][G.fontStyle]=G.id},ls=function(G,ce,De,Be,Je){var mt={id:"F"+(Object.keys(Vt).length+1).toString(10),postScriptName:G,fontName:ce,fontStyle:De,encoding:Be,isStandardFont:Je||!1,metadata:{}};return dr.publish("addFont",{font:mt,instance:this}),Vt[mt.id]=mt,Or(mt),mt.id},yn=h.__private__.pdfEscape=h.pdfEscape=function(G,ce){return function(De,Be){var Je,mt,bt,ar,hr,qr,rn,An,Ys;if(bt=(Be=Be||{}).sourceEncoding||"Unicode",hr=Be.outputEncoding,(Be.autoencode||hr)&&Vt[Me].metadata&&Vt[Me].metadata[bt]&&Vt[Me].metadata[bt].encoding&&(ar=Vt[Me].metadata[bt].encoding,!hr&&Vt[Me].encoding&&(hr=Vt[Me].encoding),!hr&&ar.codePages&&(hr=ar.codePages[0]),typeof hr=="string"&&(hr=ar[hr]),hr)){for(rn=!1,qr=[],Je=0,mt=De.length;Je<mt;Je++)(An=hr[De.charCodeAt(Je)])?qr.push(String.fromCharCode(An)):qr.push(De[Je]),qr[Je].charCodeAt(0)>>8&&(rn=!0);De=qr.join("")}for(Je=De.length;rn===void 0&&Je!==0;)De.charCodeAt(Je-1)>>8&&(rn=!0),Je--;if(!rn)return De;for(qr=Be.noBOM?[]:[254,255],Je=0,mt=De.length;Je<mt;Je++){if((Ys=(An=De.charCodeAt(Je))>>8)>>8)throw new Error("Character at position "+Je+" of string '"+De+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");qr.push(Ys),qr.push(An-(Ys<<8))}return String.fromCharCode.apply(void 0,qr)}(G,ce).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},aa=h.__private__.beginPage=function(G){Ee[++$t]=[],kt[$t]={objId:0,contentsObjId:0,userUnit:Number(l),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(G[0]),topRightY:Number(G[1])}},dd($t),W(Ee[A])},ud=function(G,ce){var De,Be,Je;switch(r=ce||r,typeof G=="string"&&(De=v(G.toLowerCase()),Array.isArray(De)&&(Be=De[0],Je=De[1])),Array.isArray(G)&&(Be=G[0]*He,Je=G[1]*He),isNaN(Be)&&(Be=a[0],Je=a[1]),(Be>14400||Je>14400)&&(hs.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),Be=Math.min(14400,Be),Je=Math.min(14400,Je)),a=[Be,Je],r.substr(0,1)){case"l":Je>Be&&(a=[Je,Be]);break;case"p":Be>Je&&(a=[Je,Be])}aa(a),Hr(M1),Z(nx),B1!==0&&Z(B1+" J"),z1!==0&&Z(z1+" j"),dr.publish("addPage",{pageNumber:$t})},hu=function(G){G>0&&G<=$t&&(Ee.splice(G,1),kt.splice(G,1),$t--,A>$t&&(A=$t),this.setPage(A))},dd=function(G){G>0&&G<=$t&&(A=G)},cc=h.__private__.getNumberOfPages=h.getNumberOfPages=function(){return Ee.length-1},Ah=function(G,ce,De){var Be,Je=void 0;return De=De||{},G=G!==void 0?G:Vt[Me].fontName,ce=ce!==void 0?ce:Vt[Me].fontStyle,Be=G.toLowerCase(),Jt[Be]!==void 0&&Jt[Be][ce]!==void 0?Je=Jt[Be][ce]:Jt[G]!==void 0&&Jt[G][ce]!==void 0?Je=Jt[G][ce]:De.disableWarning===!1&&hs.warn("Unable to look up font label for font '"+G+"', '"+ce+"'. Refer to getFontList() for available fonts."),Je||De.noFallback||(Je=Jt.times[ce])==null&&(Je=Jt.times.normal),Je},La=h.__private__.putInfo=function(){var G=En(),ce=function(Be){return Be};for(var De in d!==null&&(ce=ei.encryptor(G,0)),Z("<<"),Z("/Producer ("+yn(ce("jsPDF "+or.version))+")"),Re)Re.hasOwnProperty(De)&&Re[De]&&Z("/"+De.substr(0,1).toUpperCase()+De.substr(1)+" ("+yn(ce(Re[De]))+")");Z("/CreationDate ("+yn(ce(R))+")"),Z(">>"),Z("endobj")},ex=h.__private__.putCatalog=function(G){var ce=(G=G||{}).rootDictionaryObjId||Ne;switch(En(),Z("<<"),Z("/Type /Catalog"),Z("/Pages "+ce+" 0 R"),Fe||(Fe="fullwidth"),Fe){case"fullwidth":Z("/OpenAction [3 0 R /FitH null]");break;case"fullheight":Z("/OpenAction [3 0 R /FitV null]");break;case"fullpage":Z("/OpenAction [3 0 R /Fit]");break;case"original":Z("/OpenAction [3 0 R /XYZ null null 1]");break;default:var De=""+Fe;De.substr(De.length-1)==="%"&&(Fe=parseInt(Fe)/100),typeof Fe=="number"&&Z("/OpenAction [3 0 R /XYZ null null "+T(Fe)+"]")}switch(we||(we="continuous"),we){case"continuous":Z("/PageLayout /OneColumn");break;case"single":Z("/PageLayout /SinglePage");break;case"two":case"twoleft":Z("/PageLayout /TwoColumnLeft");break;case"tworight":Z("/PageLayout /TwoColumnRight")}Ie&&Z("/PageMode /"+Ie),dr.publish("putCatalog"),Z(">>"),Z("endobj")},gA=h.__private__.putTrailer=function(){Z("trailer"),Z("<<"),Z("/Size "+(Y+1)),Z("/Root "+Y+" 0 R"),Z("/Info "+(Y-1)+" 0 R"),d!==null&&Z("/Encrypt "+ei.oid+" 0 R"),Z("/ID [ <"+H+"> <"+H+"> ]"),Z(">>")},Fa=h.__private__.putHeader=function(){Z("%PDF-"+g),Z("%ºß¬à")},E_=h.__private__.putXRef=function(){var G="0000000000";Z("xref"),Z("0 "+(Y+1)),Z("0000000000 65535 f ");for(var ce=1;ce<=Y;ce++)typeof J[ce]=="function"?Z((G+J[ce]()).slice(-10)+" 00000 n "):J[ce]!==void 0?Z((G+J[ce]).slice(-10)+" 00000 n "):Z("0000000000 00000 n ")},fd=h.__private__.buildDocument=function(){var G;Y=0,ee=0,se=[],J=[],ie=[],Ne=Xn(),Ce=Xn(),W(se),dr.publish("buildDocument"),Fa(),Ze(),function(){dr.publish("putAdditionalObjects");for(var De=0;De<ie.length;De++){var Be=ie[De];me(Be.objId,!0),Z(Be.content),Z("endobj")}dr.publish("postPutAdditionalObjects")}(),G=[],function(){for(var De in Vt)Vt.hasOwnProperty(De)&&(f===!1||f===!0&&m.hasOwnProperty(De))&&rt(Vt[De])}(),function(){var De;for(De in It)It.hasOwnProperty(De)&&Tt(It[De])}(),function(){for(var De in ir)ir.hasOwnProperty(De)&&Nt(ir[De])}(),function(De){var Be;for(Be in qt)qt.hasOwnProperty(Be)&&(qt[Be]instanceof dm?Rt(qt[Be]):qt[Be]instanceof j0&&Wt(qt[Be],De))}(G),dr.publish("putResources"),G.forEach(Ut),Ut({resourcesOid:Ce,objectOid:Number.MAX_SAFE_INTEGER}),dr.publish("postPutResources"),d!==null&&(ei.oid=En(),Z("<<"),Z("/Filter /Standard"),Z("/V "+ei.v),Z("/R "+ei.r),Z("/U <"+ei.toHexString(ei.U)+">"),Z("/O <"+ei.toHexString(ei.O)+">"),Z("/P "+ei.P),Z(">>"),Z("endobj")),La(),ex();var ce=ee;return E_(),gA(),Z("startxref"),Z(""+ce),Z("%%EOF"),W(Ee[A]),se.join(`
`)},tx=h.__private__.getBlob=function(G){return new Blob([re(G)],{type:"application/pdf"})},A_=h.output=h.__private__.output=(vn=function(G,ce){switch(typeof(ce=ce||{})=="string"?ce={filename:ce}:ce.filename=ce.filename||"generated.pdf",G){case void 0:return fd();case"save":h.save(ce.filename);break;case"arraybuffer":return re(fd());case"blob":return tx(fd());case"bloburi":case"bloburl":if(Fr.URL!==void 0&&typeof Fr.URL.createObjectURL=="function")return Fr.URL&&Fr.URL.createObjectURL(tx(fd()))||void 0;hs.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var De="",Be=fd();try{De=MU(Be)}catch{De=MU(unescape(encodeURIComponent(Be)))}return"data:application/pdf;filename="+ce.filename+";base64,"+De;case"pdfobjectnewwindow":if(Object.prototype.toString.call(Fr)==="[object Window]"){var Je="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",mt=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';ce.pdfObjectUrl&&(Je=ce.pdfObjectUrl,mt="");var bt='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><script src="'+Je+'"'+mt+'><\/script><script >PDFObject.embed("'+this.output("dataurlstring")+'", '+JSON.stringify(ce)+");<\/script></body></html>",ar=Fr.open();return ar!==null&&ar.document.write(bt),ar}throw new Error("The option pdfobjectnewwindow just works in a browser-environment.");case"pdfjsnewwindow":if(Object.prototype.toString.call(Fr)==="[object Window]"){var hr='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe id="pdfViewer" src="'+(ce.pdfJsUrl||"examples/PDF.js/web/viewer.html")+"?file=&downloadName="+ce.filename+'" width="500px" height="400px" /></body></html>',qr=Fr.open();if(qr!==null){qr.document.write(hr);var rn=this;qr.document.documentElement.querySelector("#pdfViewer").onload=function(){qr.document.title=ce.filename,qr.document.documentElement.querySelector("#pdfViewer").contentWindow.PDFViewerApplication.open(rn.output("bloburl"))}}return qr}throw new Error("The option pdfjsnewwindow just works in a browser-environment.");case"dataurlnewwindow":if(Object.prototype.toString.call(Fr)!=="[object Window]")throw new Error("The option dataurlnewwindow just works in a browser-environment.");var An='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe src="'+this.output("datauristring",ce)+'"></iframe></body></html>',Ys=Fr.open();if(Ys!==null&&(Ys.document.write(An),Ys.document.title=ce.filename),Ys||typeof safari>"u")return Ys;break;case"datauri":case"dataurl":return Fr.document.location.href=this.output("datauristring",ce);default:return null}},vn.foo=function(){try{return vn.apply(this,arguments)}catch(De){var G=De.stack||"";~G.indexOf(" at ")&&(G=G.split(" at ")[1]);var ce="Error in function "+G.split(`
`)[0].split("<")[0]+": "+De.message;if(!Fr.console)throw new Error(ce);Fr.console.error(ce,De),Fr.alert&&alert(ce)}},vn.foo.bar=vn,vn.foo),uc=function(G){return Array.isArray(Kt)===!0&&Kt.indexOf(G)>-1};switch(n){case"pt":He=1;break;case"mm":He=72/25.4;break;case"cm":He=72/2.54;break;case"in":He=72;break;case"px":He=uc("px_scaling")==1?.75:96/72;break;case"pc":case"em":He=12;break;case"ex":He=6;break;default:if(typeof n!="number")throw new Error("Invalid unit: "+n);He=n}var ei=null;K(),L();var hf=h.__private__.getPageInfo=h.getPageInfo=function(G){if(isNaN(G)||G%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:kt[G].objId,pageNumber:G,pageContext:kt[G]}},T_=h.__private__.getPageInfoByObjId=function(G){if(isNaN(G)||G%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");for(var ce in kt)if(kt[ce].objId===G)break;return hf(ce)},xA=h.__private__.getCurrentPageInfo=h.getCurrentPageInfo=function(){return{objId:kt[A].objId,pageNumber:A,pageContext:kt[A]}};h.addPage=function(){return ud.apply(this,arguments),this},h.setPage=function(){return dd.apply(this,arguments),W.call(this,Ee[A]),this},h.insertPage=function(G){return this.addPage(),this.movePage(A,G),this},h.movePage=function(G,ce){var De,Be;if(G>ce){De=Ee[G],Be=kt[G];for(var Je=G;Je>ce;Je--)Ee[Je]=Ee[Je-1],kt[Je]=kt[Je-1];Ee[ce]=De,kt[ce]=Be,this.setPage(ce)}else if(G<ce){De=Ee[G],Be=kt[G];for(var mt=G;mt<ce;mt++)Ee[mt]=Ee[mt+1],kt[mt]=kt[mt+1];Ee[ce]=De,kt[ce]=Be,this.setPage(ce)}return this},h.deletePage=function(){return hu.apply(this,arguments),this},h.__private__.text=h.text=function(G,ce,De,Be,Je){var mt,bt,ar,hr,qr,rn,An,Ys,Ma,ys=(Be=Be||{}).scope||this;if(typeof G=="number"&&typeof ce=="number"&&(typeof De=="string"||Array.isArray(De))){var ti=De;De=ce,ce=G,G=ti}if(arguments[3]instanceof Ht==0?(ar=arguments[4],hr=arguments[5],rs(An=arguments[3])==="object"&&An!==null||(typeof ar=="string"&&(hr=ar,ar=null),typeof An=="string"&&(hr=An,An=null),typeof An=="number"&&(ar=An,An=null),Be={flags:An,angle:ar,align:hr})):(P("The transform parameter of text() with a Matrix value"),Ma=Je),isNaN(ce)||isNaN(De)||G==null)throw new Error("Invalid arguments passed to jsPDF.text");if(G.length===0)return ys;var $a,Fi="",bf=typeof Be.lineHeightFactor=="number"?Be.lineHeightFactor:Mp,pu=ys.internal.scaleFactor;function wf(Vn){return Vn=Vn.split(" ").join(Array(Be.TabLen||9).join(" ")),yn(Vn,An)}function W1(Vn){for(var ds,_a=Vn.concat(),ri=[],Nf=_a.length;Nf--;)typeof(ds=_a.shift())=="string"?ri.push(ds):Array.isArray(Vn)&&(ds.length===1||ds[1]===void 0&&ds[2]===void 0)?ri.push(ds[0]):ri.push([ds[0],ds[1],ds[2]]);return ri}function ax(Vn,ds){var _a;if(typeof Vn=="string")_a=ds(Vn)[0];else if(Array.isArray(Vn)){for(var ri,Nf,tb=Vn.concat(),lx=[],z_=tb.length;z_--;)typeof(ri=tb.shift())=="string"?lx.push(ds(ri)[0]):Array.isArray(ri)&&typeof ri[0]=="string"&&(Nf=ds(ri[0],ri[1],ri[2]),lx.push([Nf[0],Nf[1],Nf[2]]));_a=lx}return _a}var Th=!1,Up=!0;if(typeof G=="string")Th=!0;else if(Array.isArray(G)){var qp=G.concat();bt=[];for(var Ph,Mi=qp.length;Mi--;)(typeof(Ph=qp.shift())!="string"||Array.isArray(Ph)&&typeof Ph[0]!="string")&&(Up=!1);Th=Up}if(Th===!1)throw new Error('Type of text must be string or Array. "'+G+'" is not recognized.');typeof G=="string"&&(G=G.match(/[\r?\n]/)?G.split(/\r\n|\r|\n/g):[G]);var Vp=fe/ys.internal.scaleFactor,Wp=Vp*(bf-1);switch(Be.baseline){case"bottom":De-=Wp;break;case"top":De+=Vp-Wp;break;case"hanging":De+=Vp-2*Wp;break;case"middle":De+=Vp/2-Wp}if((rn=Be.maxWidth||0)>0&&(typeof G=="string"?G=ys.splitTextToSize(G,rn):Object.prototype.toString.call(G)==="[object Array]"&&(G=G.reduce(function(Vn,ds){return Vn.concat(ys.splitTextToSize(ds,rn))},[]))),mt={text:G,x:ce,y:De,options:Be,mutex:{pdfEscape:yn,activeFontKey:Me,fonts:Vt,activeFontSize:fe}},dr.publish("preProcessText",mt),G=mt.text,ar=(Be=mt.options).angle,Ma instanceof Ht==0&&ar&&typeof ar=="number"){ar*=Math.PI/180,Be.rotationDirection===0&&(ar=-ar),N===y&&(ar=-ar);var H1=Math.cos(ar),G1=Math.sin(ar);Ma=new Ht(H1,G1,-G1,H1,0,0)}else ar&&ar instanceof Ht&&(Ma=ar);N!==y||Ma||(Ma=Bn),(qr=Be.charSpace||gf)!==void 0&&(Fi+=I(V(qr))+` Tc
`,this.setCharSpace(this.getCharSpace()||0)),(Ys=Be.horizontalScale)!==void 0&&(Fi+=I(100*Ys)+` Tz
`),Be.lang;var No=-1,jf=Be.renderingMode!==void 0?Be.renderingMode:Be.stroke,ix=ys.internal.getCurrentPageInfo().pageContext;switch(jf){case 0:case!1:case"fill":No=0;break;case 1:case!0:case"stroke":No=1;break;case 2:case"fillThenStroke":No=2;break;case 3:case"invisible":No=3;break;case 4:case"fillAndAddForClipping":No=4;break;case 5:case"strokeAndAddPathForClipping":No=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":No=6;break;case 7:case"addToPathForClipping":No=7}var $_=ix.usedRenderingMode!==void 0?ix.usedRenderingMode:-1;No!==-1?Fi+=No+` Tr
`:$_!==-1&&(Fi+=`0 Tr
`),No!==-1&&(ix.usedRenderingMode=No),hr=Be.align||"left";var dc,Hp=fe*bf,K1=ys.internal.pageSize.getWidth(),Y1=Vt[Me];qr=Be.charSpace||gf,rn=Be.maxWidth||0,An=Object.assign({autoencode:!0,noBOM:!0},Be.flags);var Oh=[],Gp=function(Vn){return ys.getStringUnitWidth(Vn,{font:Y1,charSpace:qr,fontSize:fe,doKerning:!1})*fe/pu};if(Object.prototype.toString.call(G)==="[object Array]"){var Nl;bt=W1(G),hr!=="left"&&(dc=bt.map(Gp));var Sl,Dh=0;if(hr==="right"){ce-=dc[0],G=[],Mi=bt.length;for(var _f=0;_f<Mi;_f++)_f===0?(Sl=mf(ce),Nl=pf(De)):(Sl=V(Dh-dc[_f]),Nl=-Hp),G.push([bt[_f],Sl,Nl]),Dh=dc[_f]}else if(hr==="center"){ce-=dc[0]/2,G=[],Mi=bt.length;for(var Ih=0;Ih<Mi;Ih++)Ih===0?(Sl=mf(ce),Nl=pf(De)):(Sl=V((Dh-dc[Ih])/2),Nl=-Hp),G.push([bt[Ih],Sl,Nl]),Dh=dc[Ih]}else if(hr==="left"){G=[],Mi=bt.length;for(var X1=0;X1<Mi;X1++)G.push(bt[X1])}else if(hr==="justify"&&Y1.encoding==="Identity-H"){G=[],Mi=bt.length,rn=rn!==0?rn:K1;for(var ox=0,ja=0;ja<Mi;ja++)if(Nl=ja===0?pf(De):-Hp,Sl=ja===0?mf(ce):ox,ja<Mi-1){var B_=V((rn-dc[ja])/(bt[ja].split(" ").length-1)),md=bt[ja].split(" ");G.push([md[0]+" ",Sl,Nl]),ox=0;for(var pd=1;pd<md.length;pd++){var Z1=(Gp(md[pd-1]+" "+md[pd])-Gp(md[pd]))*pu+B_;pd==md.length-1?G.push([md[pd],Z1,0]):G.push([md[pd]+" ",Z1,0]),ox-=Z1}}else G.push([bt[ja],Sl,Nl]);G.push(["",ox,0])}else{if(hr!=="justify")throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');for(G=[],Mi=bt.length,rn=rn!==0?rn:K1,ja=0;ja<Mi;ja++){Nl=ja===0?pf(De):-Hp,Sl=ja===0?mf(ce):0;var J1=bt[ja].split(" ").length-1,Q1=J1>0?(rn-dc[ja])/J1:0;ja<Mi-1?Oh.push(I(V(Q1))):Oh.push(0),G.push([bt[ja],Sl,Nl])}}}(typeof Be.R2L=="boolean"?Be.R2L:pe)===!0&&(G=ax(G,function(Vn,ds,_a){return[Vn.split("").reverse().join(""),ds,_a]})),mt={text:G,x:ce,y:De,options:Be,mutex:{pdfEscape:yn,activeFontKey:Me,fonts:Vt,activeFontSize:fe}},dr.publish("postProcessText",mt),G=mt.text,$a=mt.mutex.isHex||!1;var eb=Vt[Me].encoding;eb!=="WinAnsiEncoding"&&eb!=="StandardEncoding"||(G=ax(G,function(Vn,ds,_a){return[wf(Vn),ds,_a]})),bt=W1(G),G=[];for(var Rh,Lh,Fh,Kp=Array.isArray(bt[0])?1:0,Mh="",Yp=function(Vn,ds,_a){var ri="";return _a instanceof Ht?(_a=typeof Be.angle=="number"?sn(_a,new Ht(1,0,0,1,Vn,ds)):sn(new Ht(1,0,0,1,Vn,ds),_a),N===y&&(_a=sn(new Ht(1,0,0,-1,0,0),_a)),ri=_a.join(" ")+` Tm
`):ri=I(Vn)+" "+I(ds)+` Td
`,ri},fc=0;fc<bt.length;fc++){switch(Mh="",Kp){case 1:Fh=($a?"<":"(")+bt[fc][0]+($a?">":")"),Rh=parseFloat(bt[fc][1]),Lh=parseFloat(bt[fc][2]);break;case 0:Fh=($a?"<":"(")+bt[fc]+($a?">":")"),Rh=mf(ce),Lh=pf(De)}Oh!==void 0&&Oh[fc]!==void 0&&(Mh=Oh[fc]+` Tw
`),fc===0?G.push(Mh+Yp(Rh,Lh,Ma)+Fh):Kp===0?G.push(Mh+Fh):Kp===1&&G.push(Mh+Yp(Rh,Lh,Ma)+Fh)}G=Kp===0?G.join(` Tj
T* `):G.join(` Tj
`),G+=` Tj
`;var gd=`BT
/`;return gd+=Me+" "+fe+` Tf
`,gd+=I(fe*bf)+` TL
`,gd+=$p+`
`,gd+=Fi,gd+=G,Z(gd+="ET"),m[Me]=!0,ys};var vA=h.__private__.clip=h.clip=function(G){return Z(G==="evenodd"?"W*":"W"),this};h.clipEvenOdd=function(){return vA("evenodd")},h.__private__.discardPath=h.discardPath=function(){return Z("n"),this};var hd=h.__private__.isValidStyle=function(G){var ce=!1;return[void 0,null,"S","D","F","DF","FD","f","f*","B","B*","n"].indexOf(G)!==-1&&(ce=!0),ce};h.__private__.setDefaultPathOperation=h.setDefaultPathOperation=function(G){return hd(G)&&(u=G),this};var P_=h.__private__.getStyle=h.getStyle=function(G){var ce=u;switch(G){case"D":case"S":ce="S";break;case"F":ce="f";break;case"FD":case"DF":ce="B";break;case"f":case"f*":case"B":case"B*":ce=G}return ce},O_=h.close=function(){return Z("h"),this};h.stroke=function(){return Z("S"),this},h.fill=function(G){return rx("f",G),this},h.fillEvenOdd=function(G){return rx("f*",G),this},h.fillStroke=function(G){return rx("B",G),this},h.fillStrokeEvenOdd=function(G){return rx("B*",G),this};var rx=function(G,ce){rs(ce)==="object"?bA(ce,G):Z(G)},Fp=function(G){G===null||N===y&&G===void 0||(G=P_(G),Z(G))};function yA(G,ce,De,Be,Je){var mt=new j0(ce||this.boundingBox,De||this.xStep,Be||this.yStep,this.gState,Je||this.matrix);mt.stream=this.stream;var bt=G+"$$"+this.cloneIndex+++"$$";return tn(bt,mt),mt}var bA=function(G,ce){var De=it[G.key],Be=qt[De];if(Be instanceof dm)Z("q"),Z(wA(ce)),Be.gState&&h.setGState(Be.gState),Z(G.matrix.toString()+" cm"),Z("/"+De+" sh"),Z("Q");else if(Be instanceof j0){var Je=new Ht(1,0,0,-1,0,zp());G.matrix&&(Je=Je.multiply(G.matrix||Bn),De=yA.call(Be,G.key,G.boundingBox,G.xStep,G.yStep,Je).id),Z("q"),Z("/Pattern cs"),Z("/"+De+" scn"),Be.gState&&h.setGState(Be.gState),Z(ce),Z("Q")}},wA=function(G){switch(G){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"}},F1=h.moveTo=function(G,ce){return Z(I(V(G))+" "+I(C(ce))+" m"),this},D_=h.lineTo=function(G,ce){return Z(I(V(G))+" "+I(C(ce))+" l"),this},mu=h.curveTo=function(G,ce,De,Be,Je,mt){return Z([I(V(G)),I(C(ce)),I(V(De)),I(C(Be)),I(V(Je)),I(C(mt)),"c"].join(" ")),this};h.__private__.line=h.line=function(G,ce,De,Be,Je){if(isNaN(G)||isNaN(ce)||isNaN(De)||isNaN(Be)||!hd(Je))throw new Error("Invalid arguments passed to jsPDF.line");return N===b?this.lines([[De-G,Be-ce]],G,ce,[1,1],Je||"S"):this.lines([[De-G,Be-ce]],G,ce,[1,1]).stroke()},h.__private__.lines=h.lines=function(G,ce,De,Be,Je,mt){var bt,ar,hr,qr,rn,An,Ys,Ma,ys,ti,$a,Fi;if(typeof G=="number"&&(Fi=De,De=ce,ce=G,G=Fi),Be=Be||[1,1],mt=mt||!1,isNaN(ce)||isNaN(De)||!Array.isArray(G)||!Array.isArray(Be)||!hd(Je)||typeof mt!="boolean")throw new Error("Invalid arguments passed to jsPDF.lines");for(F1(ce,De),bt=Be[0],ar=Be[1],qr=G.length,ti=ce,$a=De,hr=0;hr<qr;hr++)(rn=G[hr]).length===2?(ti=rn[0]*bt+ti,$a=rn[1]*ar+$a,D_(ti,$a)):(An=rn[0]*bt+ti,Ys=rn[1]*ar+$a,Ma=rn[2]*bt+ti,ys=rn[3]*ar+$a,ti=rn[4]*bt+ti,$a=rn[5]*ar+$a,mu(An,Ys,Ma,ys,ti,$a));return mt&&O_(),Fp(Je),this},h.path=function(G){for(var ce=0;ce<G.length;ce++){var De=G[ce],Be=De.c;switch(De.op){case"m":F1(Be[0],Be[1]);break;case"l":D_(Be[0],Be[1]);break;case"c":mu.apply(this,Be);break;case"h":O_()}}return this},h.__private__.rect=h.rect=function(G,ce,De,Be,Je){if(isNaN(G)||isNaN(ce)||isNaN(De)||isNaN(Be)||!hd(Je))throw new Error("Invalid arguments passed to jsPDF.rect");return N===b&&(Be=-Be),Z([I(V(G)),I(C(ce)),I(V(De)),I(V(Be)),"re"].join(" ")),Fp(Je),this},h.__private__.triangle=h.triangle=function(G,ce,De,Be,Je,mt,bt){if(isNaN(G)||isNaN(ce)||isNaN(De)||isNaN(Be)||isNaN(Je)||isNaN(mt)||!hd(bt))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[De-G,Be-ce],[Je-De,mt-Be],[G-Je,ce-mt]],G,ce,[1,1],bt,!0),this},h.__private__.roundedRect=h.roundedRect=function(G,ce,De,Be,Je,mt,bt){if(isNaN(G)||isNaN(ce)||isNaN(De)||isNaN(Be)||isNaN(Je)||isNaN(mt)||!hd(bt))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var ar=4/3*(Math.SQRT2-1);return Je=Math.min(Je,.5*De),mt=Math.min(mt,.5*Be),this.lines([[De-2*Je,0],[Je*ar,0,Je,mt-mt*ar,Je,mt],[0,Be-2*mt],[0,mt*ar,-Je*ar,mt,-Je,mt],[2*Je-De,0],[-Je*ar,0,-Je,-mt*ar,-Je,-mt],[0,2*mt-Be],[0,-mt*ar,Je*ar,-mt,Je,-mt]],G+Je,ce,[1,1],bt,!0),this},h.__private__.ellipse=h.ellipse=function(G,ce,De,Be,Je){if(isNaN(G)||isNaN(ce)||isNaN(De)||isNaN(Be)||!hd(Je))throw new Error("Invalid arguments passed to jsPDF.ellipse");var mt=4/3*(Math.SQRT2-1)*De,bt=4/3*(Math.SQRT2-1)*Be;return F1(G+De,ce),mu(G+De,ce-bt,G+mt,ce-Be,G,ce-Be),mu(G-mt,ce-Be,G-De,ce-bt,G-De,ce),mu(G-De,ce+bt,G-mt,ce+Be,G,ce+Be),mu(G+mt,ce+Be,G+De,ce+bt,G+De,ce),Fp(Je),this},h.__private__.circle=h.circle=function(G,ce,De,Be){if(isNaN(G)||isNaN(ce)||isNaN(De)||!hd(Be))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(G,ce,De,De,Be)},h.setFont=function(G,ce,De){return De&&(ce=S(ce,De)),Me=Ah(G,ce,{disableWarning:!1}),this};var jA=h.__private__.getFont=h.getFont=function(){return Vt[Ah.apply(h,arguments)]};h.__private__.getFontList=h.getFontList=function(){var G,ce,De={};for(G in Jt)if(Jt.hasOwnProperty(G))for(ce in De[G]=[],Jt[G])Jt[G].hasOwnProperty(ce)&&De[G].push(ce);return De},h.addFont=function(G,ce,De,Be,Je){var mt=["StandardEncoding","MacRomanEncoding","Identity-H","WinAnsiEncoding"];return arguments[3]&&mt.indexOf(arguments[3])!==-1?Je=arguments[3]:arguments[3]&&mt.indexOf(arguments[3])==-1&&(De=S(De,Be)),ls.call(this,G,ce,De,Je=Je||"Identity-H")};var Mp,M1=e.lineWidth||.200025,_A=h.__private__.getLineWidth=h.getLineWidth=function(){return M1},Hr=h.__private__.setLineWidth=h.setLineWidth=function(G){return M1=G,Z(I(V(G))+" w"),this};h.__private__.setLineDash=or.API.setLineDash=or.API.setLineDashPattern=function(G,ce){if(G=G||[],ce=ce||0,isNaN(ce)||!Array.isArray(G))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return G=G.map(function(De){return I(V(De))}).join(" "),ce=I(V(ce)),Z("["+G+"] "+ce+" d"),this};var NA=h.__private__.getLineHeight=h.getLineHeight=function(){return fe*Mp};h.__private__.getLineHeight=h.getLineHeight=function(){return fe*Mp};var SA=h.__private__.setLineHeightFactor=h.setLineHeightFactor=function(G){return typeof(G=G||1.15)=="number"&&(Mp=G),this},kA=h.__private__.getLineHeightFactor=h.getLineHeightFactor=function(){return Mp};SA(e.lineHeight);var mf=h.__private__.getHorizontalCoordinate=function(G){return V(G)},pf=h.__private__.getVerticalCoordinate=function(G){return N===y?G:kt[A].mediaBox.topRightY-kt[A].mediaBox.bottomLeftY-V(G)},CA=h.__private__.getHorizontalCoordinateString=h.getHorizontalCoordinateString=function(G){return I(mf(G))},EA=h.__private__.getVerticalCoordinateString=h.getVerticalCoordinateString=function(G){return I(pf(G))},nx=e.strokeColor||"0 G";h.__private__.getStrokeColor=h.getDrawColor=function(){return ue(nx)},h.__private__.setStrokeColor=h.setDrawColor=function(G,ce,De,Be){return nx=ve({ch1:G,ch2:ce,ch3:De,ch4:Be,pdfColorType:"draw",precision:2}),Z(nx),this};var $1=e.fillColor||"0 g";h.__private__.getFillColor=h.getFillColor=function(){return ue($1)},h.__private__.setFillColor=h.setFillColor=function(G,ce,De,Be){return $1=ve({ch1:G,ch2:ce,ch3:De,ch4:Be,pdfColorType:"fill",precision:2}),Z($1),this};var $p=e.textColor||"0 g",AA=h.__private__.getTextColor=h.getTextColor=function(){return ue($p)};h.__private__.setTextColor=h.setTextColor=function(G,ce,De,Be){return $p=ve({ch1:G,ch2:ce,ch3:De,ch4:Be,pdfColorType:"text",precision:3}),this};var gf=e.charSpace,TA=h.__private__.getCharSpace=h.getCharSpace=function(){return parseFloat(gf||0)};h.__private__.setCharSpace=h.setCharSpace=function(G){if(isNaN(G))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return gf=G,this};var B1=0;h.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},h.__private__.setLineCap=h.setLineCap=function(G){var ce=h.CapJoinStyles[G];if(ce===void 0)throw new Error("Line cap style of '"+G+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return B1=ce,Z(ce+" J"),this};var z1=0;h.__private__.setLineJoin=h.setLineJoin=function(G){var ce=h.CapJoinStyles[G];if(ce===void 0)throw new Error("Line join style of '"+G+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return z1=ce,Z(ce+" j"),this},h.__private__.setLineMiterLimit=h.__private__.setMiterLimit=h.setLineMiterLimit=h.setMiterLimit=function(G){if(G=G||0,isNaN(G))throw new Error("Invalid argument passed to jsPDF.setLineMiterLimit");return Z(I(V(G))+" M"),this},h.GState=_2,h.setGState=function(G){(G=typeof G=="string"?It[Mt[G]]:I_(null,G)).equals(wr)||(Z("/"+G.id+" gs"),wr=G)};var I_=function(G,ce){if(!G||!Mt[G]){var De=!1;for(var Be in It)if(It.hasOwnProperty(Be)&&It[Be].equals(ce)){De=!0;break}if(De)ce=It[Be];else{var Je="GS"+(Object.keys(It).length+1).toString(10);It[Je]=ce,ce.id=Je}return G&&(Mt[G]=ce.id),dr.publish("addGState",ce),ce}};h.addGState=function(G,ce){return I_(G,ce),this},h.saveGraphicsState=function(){return Z("q"),Qt.push({key:Me,size:fe,color:$p}),this},h.restoreGraphicsState=function(){Z("Q");var G=Qt.pop();return Me=G.key,fe=G.size,$p=G.color,wr=null,this},h.setCurrentTransformationMatrix=function(G){return Z(G.toString()+" cm"),this},h.comment=function(G){return Z("#"+G),this};var xf=function(G,ce){var De=G||0;Object.defineProperty(this,"x",{enumerable:!0,get:function(){return De},set:function(mt){isNaN(mt)||(De=parseFloat(mt))}});var Be=ce||0;Object.defineProperty(this,"y",{enumerable:!0,get:function(){return Be},set:function(mt){isNaN(mt)||(Be=parseFloat(mt))}});var Je="pt";return Object.defineProperty(this,"type",{enumerable:!0,get:function(){return Je},set:function(mt){Je=mt.toString()}}),this},U1=function(G,ce,De,Be){xf.call(this,G,ce),this.type="rect";var Je=De||0;Object.defineProperty(this,"w",{enumerable:!0,get:function(){return Je},set:function(bt){isNaN(bt)||(Je=parseFloat(bt))}});var mt=Be||0;return Object.defineProperty(this,"h",{enumerable:!0,get:function(){return mt},set:function(bt){isNaN(bt)||(mt=parseFloat(bt))}}),this},sx=function(){this.page=$t,this.currentPage=A,this.pages=Ee.slice(0),this.pagesContext=kt.slice(0),this.x=st,this.y=Zt,this.matrix=_t,this.width=V1(A),this.height=L_(A),this.outputDestination=Ue,this.id="",this.objectNumber=-1};sx.prototype.restore=function(){$t=this.page,A=this.currentPage,kt=this.pagesContext,Ee=this.pages,st=this.x,Zt=this.y,_t=this.matrix,R_(A,this.width),vf(A,this.height),Ue=this.outputDestination};var q1=function(G,ce,De,Be,Je){mn.push(new sx),$t=A=0,Ee=[],st=G,Zt=ce,_t=Je,aa([De,Be])};for(var Bp in h.beginFormObject=function(G,ce,De,Be,Je){return q1(G,ce,De,Be,Je),this},h.endFormObject=function(G){return function(ce){if(jr[ce])mn.pop().restore();else{var De=new sx,Be="Xo"+(Object.keys(ir).length+1).toString(10);De.id=Be,jr[ce]=Be,ir[Be]=De,dr.publish("addFormObject",De),mn.pop().restore()}}(G),this},h.doFormObject=function(G,ce){var De=ir[jr[G]];return Z("q"),Z(ce.toString()+" cm"),Z("/"+De.id+" Do"),Z("Q"),this},h.getFormObject=function(G){var ce=ir[jr[G]];return{x:ce.x,y:ce.y,width:ce.width,height:ce.height,matrix:ce.matrix}},h.save=function(G,ce){return G=G||"generated.pdf",(ce=ce||{}).returnPromise=ce.returnPromise||!1,ce.returnPromise===!1?(o0(tx(fd()),G),typeof o0.unload=="function"&&Fr.setTimeout&&setTimeout(o0.unload,911),this):new Promise(function(De,Be){try{var Je=o0(tx(fd()),G);typeof o0.unload=="function"&&Fr.setTimeout&&setTimeout(o0.unload,911),De(Je)}catch(mt){Be(mt.message)}})},or.API)or.API.hasOwnProperty(Bp)&&(Bp==="events"&&or.API.events.length?function(G,ce){var De,Be,Je;for(Je=ce.length-1;Je!==-1;Je--)De=ce[Je][0],Be=ce[Je][1],G.subscribe.apply(G,[De].concat(typeof Be=="function"?[Be]:Be))}(dr,or.API.events):h[Bp]=or.API[Bp]);function V1(G){return kt[G].mediaBox.topRightX-kt[G].mediaBox.bottomLeftX}function R_(G,ce){kt[G].mediaBox.topRightX=ce+kt[G].mediaBox.bottomLeftX}function L_(G){return kt[G].mediaBox.topRightY-kt[G].mediaBox.bottomLeftY}function vf(G,ce){kt[G].mediaBox.topRightY=ce+kt[G].mediaBox.bottomLeftY}var yf=h.getPageWidth=function(G){return V1(G=G||A)/He},F_=h.setPageWidth=function(G,ce){R_(G,ce*He)},zp=h.getPageHeight=function(G){return L_(G=G||A)/He},M_=h.setPageHeight=function(G,ce){vf(G,ce*He)};return h.internal={pdfEscape:yn,getStyle:P_,getFont:jA,getFontSize:ge,getCharSpace:TA,getTextColor:AA,getLineHeight:NA,getLineHeightFactor:kA,getLineWidth:_A,write:le,getHorizontalCoordinate:mf,getVerticalCoordinate:pf,getCoordinateString:CA,getVerticalCoordinateString:EA,collections:{},newObject:En,newAdditionalObject:Te,newObjectDeferred:Xn,newObjectDeferredBegin:me,getFilters:$e,putStream:et,events:dr,scaleFactor:He,pageSize:{getWidth:function(){return yf(A)},setWidth:function(G){F_(A,G)},getHeight:function(){return zp(A)},setHeight:function(G){M_(A,G)}},encryptionOptions:d,encryption:ei,getEncryptor:function(G){return d!==null?ei.encryptor(G,0):function(ce){return ce}},output:A_,getNumberOfPages:cc,get pages(){return Ee},out:Z,f2:T,f3:k,getPageInfo:hf,getPageInfoByObjId:T_,getCurrentPageInfo:xA,getPDFVersion:p,Point:xf,Rectangle:U1,Matrix:Ht,hasHotfix:uc},Object.defineProperty(h.internal.pageSize,"width",{get:function(){return yf(A)},set:function(G){F_(A,G)},enumerable:!0,configurable:!0}),Object.defineProperty(h.internal.pageSize,"height",{get:function(){return zp(A)},set:function(G){M_(A,G)},enumerable:!0,configurable:!0}),(function(G){for(var ce=0,De=oe.length;ce<De;ce++){var Be=ls.call(this,G[ce][0],G[ce][1],G[ce][2],oe[ce][3],!0);f===!1&&(m[Be]=!0);var Je=G[ce][0].split("-");Or({id:Be,fontName:Je[0],fontStyle:Je[1]||""})}dr.publish("addFonts",{fonts:Vt,dictionary:Jt})}).call(h,oe),Me="F1",ud(a,r),dr.publish("initialized"),h}Mx.prototype.lsbFirstWord=function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)},Mx.prototype.toHexString=function(e){return e.split("").map(function(t){return("0"+(255&t.charCodeAt(0)).toString(16)).slice(-2)}).join("")},Mx.prototype.hexToBytes=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(String.fromCharCode(parseInt(e.substr(r,2),16)));return t.join("")},Mx.prototype.processOwnerPassword=function(e,t){return a8(s8(t).substr(0,5),e)},Mx.prototype.encryptor=function(e,t){var r=s8(this.encryptionKey+String.fromCharCode(255&e,e>>8&255,e>>16&255,255&t,t>>8&255)).substr(0,10);return function(n){return a8(r,n)}},_2.prototype.equals=function(e){var t,r="id,objectNumber,equals";if(!e||rs(e)!==rs(this))return!1;var n=0;for(t in this)if(!(r.indexOf(t)>=0)){if(this.hasOwnProperty(t)&&!e.hasOwnProperty(t)||this[t]!==e[t])return!1;n++}for(t in e)e.hasOwnProperty(t)&&r.indexOf(t)<0&&n--;return n===0},or.API={events:[]},or.version="3.0.4";var ca=or.API,YL=1,Bg=function(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},jx=function(e){return e.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},Kr=function(e){return e.toFixed(2)},Jh=function(e){return e.toFixed(5)};ca.__acroform__={};var wl=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},UU=function(e){return e*YL},wd=function(e){var t=new xoe,r=nr.internal.getHeight(e)||0,n=nr.internal.getWidth(e)||0;return t.BBox=[0,0,Number(Kr(n)),Number(Kr(r))],t},hLe=ca.__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},mLe=ca.__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)},pLe=ca.__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},Aa=ca.__acroform__.getBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return pLe(e,t-1)},Ta=ca.__acroform__.setBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return hLe(e,t-1)},Pa=ca.__acroform__.clearBitForPdf=function(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return mLe(e,t-1)},gLe=ca.__acroform__.calculateCoordinates=function(e,t){var r=t.internal.getHorizontalCoordinate,n=t.internal.getVerticalCoordinate,a=e[0],i=e[1],o=e[2],l=e[3],c={};return c.lowerLeft_X=r(a)||0,c.lowerLeft_Y=n(i+l)||0,c.upperRight_X=r(a+o)||0,c.upperRight_Y=n(i)||0,[Number(Kr(c.lowerLeft_X)),Number(Kr(c.lowerLeft_Y)),Number(Kr(c.upperRight_X)),Number(Kr(c.upperRight_Y))]},xLe=function(e){if(e.appearanceStreamContent)return e.appearanceStreamContent;if(e.V||e.DV){var t=[],r=e._V||e.DV,n=i8(e,r),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+" "+Kr(n.fontSize)+" Tf"),t.push("1 0 0 1 0 0 Tm"),t.push(n.text),t.push("ET"),t.push("Q"),t.push("EMC");var i=wd(e);return i.scope=e.scope,i.stream=t.join(`
`),i}},i8=function(e,t){var r=e.fontSize===0?e.maxFontSize:e.fontSize,n={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(T){return T.split(`
`)}):a.map(function(T){return[T]});var i=r,o=nr.internal.getHeight(e)||0;o=o<0?-o:o;var l=nr.internal.getWidth(e)||0;l=l<0?-l:l;var c=function(T,k,V){if(T+1<a.length){var C=k+" "+a[T+1][0];return rS(C,e,V).width<=l-4}return!1};i++;e:for(;i>0;){t="",i--;var u,d,f=rS("3",e,i).height,m=e.multiline?o-i:(o-f)/2,h=m+=2,g=0,p=0,x=0;if(i<=0){t=`(...) Tj
`,t+="% Width of Text: "+rS(t,e,i=12).width+", FieldWidth:"+l+`
`;break}for(var v="",b=0,y=0;y<a.length;y++)if(a.hasOwnProperty(y)){var N=!1;if(a[y].length!==1&&x!==a[y].length-1){if((f+2)*(b+2)+2>o)continue e;v+=a[y][x],N=!0,p=y,y--}else{v=(v+=a[y][x]+" ").substr(v.length-1)==" "?v.substr(0,v.length-1):v;var _=parseInt(y),j=c(_,v,i),S=y>=a.length-1;if(j&&!S){v+=" ",x=0;continue}if(j||S){if(S)p=_;else if(e.multiline&&(f+2)*(b+2)+2>o)continue e}else{if(!e.multiline||(f+2)*(b+2)+2>o)continue e;p=_}}for(var I="",P=g;P<=p;P++){var F=a[P];if(e.multiline){if(P===p){I+=F[x]+" ",x=(x+1)%F.length;continue}if(P===g){I+=F[F.length-1]+" ";continue}}I+=F[0]+" "}switch(I=I.substr(I.length-1)==" "?I.substr(0,I.length-1):I,d=rS(I,e,i).width,e.textAlign){case"right":u=l-d-2;break;case"center":u=(l-d)/2;break;default:u=2}t+=Kr(u)+" "+Kr(h)+` Td
`,t+="("+Bg(I)+`) Tj
`,t+=-Kr(u)+` 0 Td
`,h=-(i+2),d=0,g=N?p:p+1,b++,v=""}break}return n.text=t,n.fontSize=i,n},rS=function(e,t,r){var n=t.scope.internal.getFont(t.fontName,t.fontStyle),a=t.scope.getStringUnitWidth(e,{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r);return{height:t.scope.getStringUnitWidth("3",{font:n,fontSize:parseFloat(r),charSpace:0})*parseFloat(r)*1.5,width:a}},vLe={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},yLe=function(e,t){var r={type:"reference",object:e};t.internal.getPageInfo(e.page).pageContext.annotations.find(function(n){return n.type===r.type&&n.object===r.object})===void 0&&t.internal.getPageInfo(e.page).pageContext.annotations.push(r)},bLe=function(e,t){if(t.scope=e,e.internal!==void 0&&(e.internal.acroformPlugin===void 0||e.internal.acroformPlugin.isInitialized===!1)){if(id.FieldNum=0,e.internal.acroformPlugin=JSON.parse(JSON.stringify(vLe)),e.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");YL=e.internal.scaleFactor,e.internal.acroformPlugin.acroFormDictionaryRoot=new voe,e.internal.acroformPlugin.acroFormDictionaryRoot.scope=e,e.internal.acroformPlugin.acroFormDictionaryRoot._eventID=e.internal.events.subscribe("postPutResources",function(){(function(r){r.internal.events.unsubscribe(r.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete r.internal.acroformPlugin.acroFormDictionaryRoot._eventID,r.internal.acroformPlugin.printedOut=!0})(e)}),e.internal.events.subscribe("buildDocument",function(){(function(r){r.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var n=r.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var a in n)if(n.hasOwnProperty(a)){var i=n[a];i.objId=void 0,i.hasAnnotation&&yLe(i,r)}})(e)}),e.internal.events.subscribe("putCatalog",function(){(function(r){if(r.internal.acroformPlugin.acroFormDictionaryRoot===void 0)throw new Error("putCatalogCallback: Root missing.");r.internal.write("/AcroForm "+r.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")})(e)}),e.internal.events.subscribe("postPutPages",function(r){(function(n,a){var i=!n;for(var o in n||(a.internal.newObjectDeferredBegin(a.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),a.internal.acroformPlugin.acroFormDictionaryRoot.putStream()),n=n||a.internal.acroformPlugin.acroFormDictionaryRoot.Kids)if(n.hasOwnProperty(o)){var l=n[o],c=[],u=l.Rect;if(l.Rect&&(l.Rect=gLe(l.Rect,a)),a.internal.newObjectDeferredBegin(l.objId,!0),l.DA=nr.createDefaultAppearanceStream(l),rs(l)==="object"&&typeof l.getKeyValueListForStream=="function"&&(c=l.getKeyValueListForStream()),l.Rect=u,l.hasAppearanceStream&&!l.appearanceStreamContent){var d=xLe(l);c.push({key:"AP",value:"<</N "+d+">>"}),a.internal.acroformPlugin.xForms.push(d)}if(l.appearanceStreamContent){var f="";for(var m in l.appearanceStreamContent)if(l.appearanceStreamContent.hasOwnProperty(m)){var h=l.appearanceStreamContent[m];if(f+="/"+m+" ",f+="<<",Object.keys(h).length>=1||Array.isArray(h)){for(var o in h)if(h.hasOwnProperty(o)){var g=h[o];typeof g=="function"&&(g=g.call(a,l)),f+="/"+o+" "+g+" ",a.internal.acroformPlugin.xForms.indexOf(g)>=0||a.internal.acroformPlugin.xForms.push(g)}}else typeof(g=h)=="function"&&(g=g.call(a,l)),f+="/"+o+" "+g,a.internal.acroformPlugin.xForms.indexOf(g)>=0||a.internal.acroformPlugin.xForms.push(g);f+=">>"}c.push({key:"AP",value:`<<
`+f+">>"})}a.internal.putStream({additionalKeyValues:c,objectId:l.objId}),a.internal.out("endobj")}i&&function(p,x){for(var v in p)if(p.hasOwnProperty(v)){var b=v,y=p[v];x.internal.newObjectDeferredBegin(y.objId,!0),rs(y)==="object"&&typeof y.putStream=="function"&&y.putStream(),delete p[b]}}(a.internal.acroformPlugin.xForms,a)})(r,e)}),e.internal.acroformPlugin.isInitialized=!0}},goe=ca.__acroform__.arrayToPdfArray=function(e,t,r){var n=function(o){return o};if(Array.isArray(e)){for(var a="[",i=0;i<e.length;i++)switch(i!==0&&(a+=" "),rs(e[i])){case"boolean":case"number":case"object":a+=e[i].toString();break;case"string":e[i].substr(0,1)!=="/"?(t!==void 0&&r&&(n=r.internal.getEncryptor(t)),a+="("+Bg(n(e[i].toString()))+")"):a+=e[i].toString()}return a+"]"}throw new Error("Invalid argument passed to jsPDF.__acroform__.arrayToPdfArray")},NT=function(e,t,r){var n=function(a){return a};return t!==void 0&&r&&(n=r.internal.getEncryptor(t)),(e=e||"").toString(),"("+Bg(n(e))+")"},Fd=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})};Fd.prototype.toString=function(){return this.objId+" 0 R"},Fd.prototype.putStream=function(){var e=this.getKeyValueListForStream();this.scope.internal.putStream({data:this.stream,additionalKeyValues:e,objectId:this.objId}),this.scope.internal.out("endobj")},Fd.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 r in t)if(Object.getOwnPropertyDescriptor(this,t[r]).configurable===!1){var n=t[r],a=this[n];a&&(Array.isArray(a)?e.push({key:n,value:goe(a,this.objId,this.scope)}):a instanceof Fd?(a.scope=this.scope,e.push({key:n,value:a.objId+" 0 R"})):typeof a!="function"&&e.push({key:n,value:a}))}return e};var xoe=function(){Fd.call(this),Object.defineProperty(this,"Type",{value:"/XObject",configurable:!1,writable:!0}),Object.defineProperty(this,"Subtype",{value:"/Form",configurable:!1,writable:!0}),Object.defineProperty(this,"FormType",{value:1,configurable:!1,writable:!0});var e,t=[];Object.defineProperty(this,"BBox",{configurable:!1,get:function(){return t},set:function(r){t=r}}),Object.defineProperty(this,"Resources",{value:"2 0 R",configurable:!1,writable:!0}),Object.defineProperty(this,"stream",{enumerable:!1,configurable:!0,set:function(r){e=r.trim()},get:function(){return e||null}})};wl(xoe,Fd);var voe=function(){Fd.call(this);var e,t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!1,configurable:!1,get:function(){return t}}),Object.defineProperty(this,"DA",{enumerable:!1,configurable:!1,get:function(){if(e){var r=function(n){return n};return this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),"("+Bg(r(e))+")"}},set:function(r){e=r}})};wl(voe,Fd);var id=function e(){Fd.call(this);var t=4;Object.defineProperty(this,"F",{enumerable:!1,configurable:!1,get:function(){return t},set:function(v){if(isNaN(v))throw new Error('Invalid value "'+v+'" for attribute F supplied.');t=v}}),Object.defineProperty(this,"showWhenPrinted",{enumerable:!0,configurable:!0,get:function(){return!!Aa(t,3)},set:function(v){v?this.F=Ta(t,3):this.F=Pa(t,3)}});var r=0;Object.defineProperty(this,"Ff",{enumerable:!1,configurable:!1,get:function(){return r},set:function(v){if(isNaN(v))throw new Error('Invalid value "'+v+'" for attribute Ff supplied.');r=v}});var n=[];Object.defineProperty(this,"Rect",{enumerable:!1,configurable:!1,get:function(){if(n.length!==0)return n},set:function(v){n=v!==void 0?v:[]}}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[0])?0:n[0]},set:function(v){n[0]=v}}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[1])?0:n[1]},set:function(v){n[1]=v}}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[2])?0:n[2]},set:function(v){n[2]=v}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,get:function(){return!n||isNaN(n[3])?0:n[3]},set:function(v){n[3]=v}});var a="";Object.defineProperty(this,"FT",{enumerable:!0,configurable:!1,get:function(){return a},set:function(v){switch(v){case"/Btn":case"/Tx":case"/Ch":case"/Sig":a=v;break;default:throw new Error('Invalid value "'+v+'" 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 u4)return;i="FieldObject"+e.FieldNum++}var v=function(b){return b};return this.scope&&(v=this.scope.internal.getEncryptor(this.objId)),"("+Bg(v(i))+")"},set:function(v){i=v.toString()}}),Object.defineProperty(this,"fieldName",{configurable:!0,enumerable:!0,get:function(){return i},set:function(v){i=v}});var o="helvetica";Object.defineProperty(this,"fontName",{enumerable:!0,configurable:!0,get:function(){return o},set:function(v){o=v}});var l="normal";Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,get:function(){return l},set:function(v){l=v}});var c=0;Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,get:function(){return c},set:function(v){c=v}});var u=void 0;Object.defineProperty(this,"maxFontSize",{enumerable:!0,configurable:!0,get:function(){return u===void 0?50/YL:u},set:function(v){u=v}});var d="black";Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,get:function(){return d},set:function(v){d=v}});var f="/F1 0 Tf 0 g";Object.defineProperty(this,"DA",{enumerable:!0,configurable:!1,get:function(){if(!(!f||this instanceof u4||this instanceof Km))return NT(f,this.objId,this.scope)},set:function(v){v=v.toString(),f=v}});var m=null;Object.defineProperty(this,"DV",{enumerable:!1,configurable:!1,get:function(){if(m)return this instanceof ui==0?NT(m,this.objId,this.scope):m},set:function(v){v=v.toString(),m=this instanceof ui==0?v.substr(0,1)==="("?jx(v.substr(1,v.length-2)):jx(v):v}}),Object.defineProperty(this,"defaultValue",{enumerable:!0,configurable:!0,get:function(){return this instanceof ui==1?jx(m.substr(1,m.length-1)):m},set:function(v){v=v.toString(),m=this instanceof ui==1?"/"+v:v}});var h=null;Object.defineProperty(this,"_V",{enumerable:!1,configurable:!1,get:function(){if(h)return h},set:function(v){this.V=v}}),Object.defineProperty(this,"V",{enumerable:!1,configurable:!1,get:function(){if(h)return this instanceof ui==0?NT(h,this.objId,this.scope):h},set:function(v){v=v.toString(),h=this instanceof ui==0?v.substr(0,1)==="("?jx(v.substr(1,v.length-2)):jx(v):v}}),Object.defineProperty(this,"value",{enumerable:!0,configurable:!0,get:function(){return this instanceof ui==1?jx(h.substr(1,h.length-1)):h},set:function(v){v=v.toString(),h=this instanceof ui==1?"/"+v:v}}),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 g,p=!1;Object.defineProperty(this,"hasAppearanceStream",{enumerable:!0,configurable:!0,get:function(){return p},set:function(v){v=!!v,p=v}}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,get:function(){if(g)return g},set:function(v){g=v}}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,1)},set:function(v){v?this.Ff=Ta(this.Ff,1):this.Ff=Pa(this.Ff,1)}}),Object.defineProperty(this,"required",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,2)},set:function(v){v?this.Ff=Ta(this.Ff,2):this.Ff=Pa(this.Ff,2)}}),Object.defineProperty(this,"noExport",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,3)},set:function(v){v?this.Ff=Ta(this.Ff,3):this.Ff=Pa(this.Ff,3)}});var x=null;Object.defineProperty(this,"Q",{enumerable:!0,configurable:!1,get:function(){if(x!==null)return x},set:function(v){if([0,1,2].indexOf(v)===-1)throw new Error('Invalid value "'+v+'" for attribute Q supplied.');x=v}}),Object.defineProperty(this,"textAlign",{get:function(){var v;switch(x){case 0:default:v="left";break;case 1:v="center";break;case 2:v="right"}return v},configurable:!0,enumerable:!0,set:function(v){switch(v){case"right":case 2:x=2;break;case"center":case 1:x=1;break;default:x=0}}})};wl(id,Fd);var z0=function(){id.call(this),this.FT="/Ch",this.V="()",this.fontName="zapfdingbats";var e=0;Object.defineProperty(this,"TI",{enumerable:!0,configurable:!1,get:function(){return e},set:function(r){e=r}}),Object.defineProperty(this,"topIndex",{enumerable:!0,configurable:!0,get:function(){return e},set:function(r){e=r}});var t=[];Object.defineProperty(this,"Opt",{enumerable:!0,configurable:!1,get:function(){return goe(t,this.objId,this.scope)},set:function(r){var n,a;a=[],typeof(n=r)=="string"&&(a=function(i,o,l){l||(l=1);for(var c,u=[];c=o.exec(i);)u.push(c[l]);return u}(n,/\((.*?)\)/g)),t=a}}),this.getOptions=function(){return t},this.setOptions=function(r){t=r,this.sort&&t.sort()},this.addOption=function(r){r=(r=r||"").toString(),t.push(r),this.sort&&t.sort()},this.removeOption=function(r,n){for(n=n||!1,r=(r=r||"").toString();t.indexOf(r)!==-1&&(t.splice(t.indexOf(r),1),n!==!1););},Object.defineProperty(this,"combo",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,18)},set:function(r){r?this.Ff=Ta(this.Ff,18):this.Ff=Pa(this.Ff,18)}}),Object.defineProperty(this,"edit",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,19)},set:function(r){this.combo===!0&&(r?this.Ff=Ta(this.Ff,19):this.Ff=Pa(this.Ff,19))}}),Object.defineProperty(this,"sort",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,20)},set:function(r){r?(this.Ff=Ta(this.Ff,20),t.sort()):this.Ff=Pa(this.Ff,20)}}),Object.defineProperty(this,"multiSelect",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,22)},set:function(r){r?this.Ff=Ta(this.Ff,22):this.Ff=Pa(this.Ff,22)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,23)},set:function(r){r?this.Ff=Ta(this.Ff,23):this.Ff=Pa(this.Ff,23)}}),Object.defineProperty(this,"commitOnSelChange",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,27)},set:function(r){r?this.Ff=Ta(this.Ff,27):this.Ff=Pa(this.Ff,27)}}),this.hasAppearanceStream=!1};wl(z0,id);var U0=function(){z0.call(this),this.fontName="helvetica",this.combo=!1};wl(U0,z0);var q0=function(){U0.call(this),this.combo=!0};wl(q0,U0);var hw=function(){q0.call(this),this.edit=!0};wl(hw,q0);var ui=function(){id.call(this),this.FT="/Btn",Object.defineProperty(this,"noToggleToOff",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,15)},set:function(r){r?this.Ff=Ta(this.Ff,15):this.Ff=Pa(this.Ff,15)}}),Object.defineProperty(this,"radio",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,16)},set:function(r){r?this.Ff=Ta(this.Ff,16):this.Ff=Pa(this.Ff,16)}}),Object.defineProperty(this,"pushButton",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,17)},set:function(r){r?this.Ff=Ta(this.Ff,17):this.Ff=Pa(this.Ff,17)}}),Object.defineProperty(this,"radioIsUnison",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,26)},set:function(r){r?this.Ff=Ta(this.Ff,26):this.Ff=Pa(this.Ff,26)}});var e,t={};Object.defineProperty(this,"MK",{enumerable:!1,configurable:!1,get:function(){var r=function(i){return i};if(this.scope&&(r=this.scope.internal.getEncryptor(this.objId)),Object.keys(t).length!==0){var n,a=[];for(n in a.push("<<"),t)a.push("/"+n+" ("+Bg(r(t[n]))+")");return a.push(">>"),a.join(`
`)}},set:function(r){rs(r)==="object"&&(t=r)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return t.CA||""},set:function(r){typeof r=="string"&&(t.CA=r)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return e},set:function(r){e=r}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return e.substr(1,e.length-1)},set:function(r){e="/"+r}})};wl(ui,id);var mw=function(){ui.call(this),this.pushButton=!0};wl(mw,ui);var V0=function(){ui.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:[]}})};wl(V0,ui);var u4=function(){var e,t;id.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 r,n={};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("<<"),n)o.push("/"+i+" ("+Bg(a(n[i]))+")");return o.push(">>"),o.join(`
`)},set:function(a){rs(a)==="object"&&(n=a)}}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,get:function(){return n.CA||""},set:function(a){typeof a=="string"&&(n.CA=a)}}),Object.defineProperty(this,"AS",{enumerable:!1,configurable:!1,get:function(){return r},set:function(a){r=a}}),Object.defineProperty(this,"appearanceState",{enumerable:!0,configurable:!0,get:function(){return r.substr(1,r.length-1)},set:function(a){r="/"+a}}),this.caption="l",this.appearanceState="Off",this._AppearanceType=nr.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(this.optionName)};wl(u4,id),V0.prototype.setAppearance=function(e){if(!("createAppearanceStream"in e)||!("getCA"in e))throw new Error("Couldn't assign Appearance to RadioButton. Appearance was Invalid!");for(var t in this.Kids)if(this.Kids.hasOwnProperty(t)){var r=this.Kids[t];r.appearanceStreamContent=e.createAppearanceStream(r.optionName),r.caption=e.getCA()}},V0.prototype.createOption=function(e){var t=new u4;return t.Parent=this,t.optionName=e,this.Kids.push(t),wLe.call(this.scope,t),t};var pw=function(){ui.call(this),this.fontName="zapfdingbats",this.caption="3",this.appearanceState="On",this.value="On",this.textAlign="center",this.appearanceStreamContent=nr.CheckBox.createAppearanceStream()};wl(pw,ui);var Km=function(){id.call(this),this.FT="/Tx",Object.defineProperty(this,"multiline",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,13)},set:function(t){t?this.Ff=Ta(this.Ff,13):this.Ff=Pa(this.Ff,13)}}),Object.defineProperty(this,"fileSelect",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,21)},set:function(t){t?this.Ff=Ta(this.Ff,21):this.Ff=Pa(this.Ff,21)}}),Object.defineProperty(this,"doNotSpellCheck",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,23)},set:function(t){t?this.Ff=Ta(this.Ff,23):this.Ff=Pa(this.Ff,23)}}),Object.defineProperty(this,"doNotScroll",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,24)},set:function(t){t?this.Ff=Ta(this.Ff,24):this.Ff=Pa(this.Ff,24)}}),Object.defineProperty(this,"comb",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,25)},set:function(t){t?this.Ff=Ta(this.Ff,25):this.Ff=Pa(this.Ff,25)}}),Object.defineProperty(this,"richText",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,26)},set:function(t){t?this.Ff=Ta(this.Ff,26):this.Ff=Pa(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}})};wl(Km,id);var gw=function(){Km.call(this),Object.defineProperty(this,"password",{enumerable:!0,configurable:!0,get:function(){return!!Aa(this.Ff,14)},set:function(e){e?this.Ff=Ta(this.Ff,14):this.Ff=Pa(this.Ff,14)}}),this.password=!0};wl(gw,Km);var nr={CheckBox:{createAppearanceStream:function(){return{N:{On:nr.CheckBox.YesNormal},D:{On:nr.CheckBox.YesPushDown,Off:nr.CheckBox.OffPushDown}}},YesPushDown:function(e){var t=wd(e);t.scope=e.scope;var r=[],n=e.scope.internal.getFont(e.fontName,e.fontStyle).id,a=e.scope.__private__.encodeColorString(e.color),i=i8(e,e.caption);return r.push("0.749023 g"),r.push("0 0 "+Kr(nr.internal.getWidth(e))+" "+Kr(nr.internal.getHeight(e))+" re"),r.push("f"),r.push("BMC"),r.push("q"),r.push("0 0 1 rg"),r.push("/"+n+" "+Kr(i.fontSize)+" Tf "+a),r.push("BT"),r.push(i.text),r.push("ET"),r.push("Q"),r.push("EMC"),t.stream=r.join(`
`),t},YesNormal:function(e){var t=wd(e);t.scope=e.scope;var r=e.scope.internal.getFont(e.fontName,e.fontStyle).id,n=e.scope.__private__.encodeColorString(e.color),a=[],i=nr.internal.getHeight(e),o=nr.internal.getWidth(e),l=i8(e,e.caption);return a.push("1 g"),a.push("0 0 "+Kr(o)+" "+Kr(i)+" re"),a.push("f"),a.push("q"),a.push("0 0 1 rg"),a.push("0 0 "+Kr(o-1)+" "+Kr(i-1)+" re"),a.push("W"),a.push("n"),a.push("0 g"),a.push("BT"),a.push("/"+r+" "+Kr(l.fontSize)+" Tf "+n),a.push(l.text),a.push("ET"),a.push("Q"),t.stream=a.join(`
`),t},OffPushDown:function(e){var t=wd(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Kr(nr.internal.getWidth(e))+" "+Kr(nr.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
`),t}},RadioButton:{Circle:{createAppearanceStream:function(e){var t={D:{Off:nr.RadioButton.Circle.OffPushDown},N:{}};return t.N[e]=nr.RadioButton.Circle.YesNormal,t.D[e]=nr.RadioButton.Circle.YesPushDown,t},getCA:function(){return"l"},YesNormal:function(e){var t=wd(e);t.scope=e.scope;var r=[],n=nr.internal.getWidth(e)<=nr.internal.getHeight(e)?nr.internal.getWidth(e)/4:nr.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=nr.internal.Bezier_C,i=Number((n*a).toFixed(5));return r.push("q"),r.push("1 0 0 1 "+Jh(nr.internal.getWidth(e)/2)+" "+Jh(nr.internal.getHeight(e)/2)+" cm"),r.push(n+" 0 m"),r.push(n+" "+i+" "+i+" "+n+" 0 "+n+" c"),r.push("-"+i+" "+n+" -"+n+" "+i+" -"+n+" 0 c"),r.push("-"+n+" -"+i+" -"+i+" -"+n+" 0 -"+n+" c"),r.push(i+" -"+n+" "+n+" -"+i+" "+n+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t},YesPushDown:function(e){var t=wd(e);t.scope=e.scope;var r=[],n=nr.internal.getWidth(e)<=nr.internal.getHeight(e)?nr.internal.getWidth(e)/4:nr.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=Number((2*n).toFixed(5)),i=Number((a*nr.internal.Bezier_C).toFixed(5)),o=Number((n*nr.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+Jh(nr.internal.getWidth(e)/2)+" "+Jh(nr.internal.getHeight(e)/2)+" cm"),r.push(a+" 0 m"),r.push(a+" "+i+" "+i+" "+a+" 0 "+a+" c"),r.push("-"+i+" "+a+" -"+a+" "+i+" -"+a+" 0 c"),r.push("-"+a+" -"+i+" -"+i+" -"+a+" 0 -"+a+" c"),r.push(i+" -"+a+" "+a+" -"+i+" "+a+" 0 c"),r.push("f"),r.push("Q"),r.push("0 g"),r.push("q"),r.push("1 0 0 1 "+Jh(nr.internal.getWidth(e)/2)+" "+Jh(nr.internal.getHeight(e)/2)+" cm"),r.push(n+" 0 m"),r.push(n+" "+o+" "+o+" "+n+" 0 "+n+" c"),r.push("-"+o+" "+n+" -"+n+" "+o+" -"+n+" 0 c"),r.push("-"+n+" -"+o+" -"+o+" -"+n+" 0 -"+n+" c"),r.push(o+" -"+n+" "+n+" -"+o+" "+n+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t},OffPushDown:function(e){var t=wd(e);t.scope=e.scope;var r=[],n=nr.internal.getWidth(e)<=nr.internal.getHeight(e)?nr.internal.getWidth(e)/4:nr.internal.getHeight(e)/4;n=Number((.9*n).toFixed(5));var a=Number((2*n).toFixed(5)),i=Number((a*nr.internal.Bezier_C).toFixed(5));return r.push("0.749023 g"),r.push("q"),r.push("1 0 0 1 "+Jh(nr.internal.getWidth(e)/2)+" "+Jh(nr.internal.getHeight(e)/2)+" cm"),r.push(a+" 0 m"),r.push(a+" "+i+" "+i+" "+a+" 0 "+a+" c"),r.push("-"+i+" "+a+" -"+a+" "+i+" -"+a+" 0 c"),r.push("-"+a+" -"+i+" -"+i+" -"+a+" 0 -"+a+" c"),r.push(i+" -"+a+" "+a+" -"+i+" "+a+" 0 c"),r.push("f"),r.push("Q"),t.stream=r.join(`
`),t}},Cross:{createAppearanceStream:function(e){var t={D:{Off:nr.RadioButton.Cross.OffPushDown},N:{}};return t.N[e]=nr.RadioButton.Cross.YesNormal,t.D[e]=nr.RadioButton.Cross.YesPushDown,t},getCA:function(){return"8"},YesNormal:function(e){var t=wd(e);t.scope=e.scope;var r=[],n=nr.internal.calculateCross(e);return r.push("q"),r.push("1 1 "+Kr(nr.internal.getWidth(e)-2)+" "+Kr(nr.internal.getHeight(e)-2)+" re"),r.push("W"),r.push("n"),r.push(Kr(n.x1.x)+" "+Kr(n.x1.y)+" m"),r.push(Kr(n.x2.x)+" "+Kr(n.x2.y)+" l"),r.push(Kr(n.x4.x)+" "+Kr(n.x4.y)+" m"),r.push(Kr(n.x3.x)+" "+Kr(n.x3.y)+" l"),r.push("s"),r.push("Q"),t.stream=r.join(`
`),t},YesPushDown:function(e){var t=wd(e);t.scope=e.scope;var r=nr.internal.calculateCross(e),n=[];return n.push("0.749023 g"),n.push("0 0 "+Kr(nr.internal.getWidth(e))+" "+Kr(nr.internal.getHeight(e))+" re"),n.push("f"),n.push("q"),n.push("1 1 "+Kr(nr.internal.getWidth(e)-2)+" "+Kr(nr.internal.getHeight(e)-2)+" re"),n.push("W"),n.push("n"),n.push(Kr(r.x1.x)+" "+Kr(r.x1.y)+" m"),n.push(Kr(r.x2.x)+" "+Kr(r.x2.y)+" l"),n.push(Kr(r.x4.x)+" "+Kr(r.x4.y)+" m"),n.push(Kr(r.x3.x)+" "+Kr(r.x3.y)+" l"),n.push("s"),n.push("Q"),t.stream=n.join(`
`),t},OffPushDown:function(e){var t=wd(e);t.scope=e.scope;var r=[];return r.push("0.749023 g"),r.push("0 0 "+Kr(nr.internal.getWidth(e))+" "+Kr(nr.internal.getHeight(e))+" re"),r.push("f"),t.stream=r.join(`
`),t}}},createDefaultAppearanceStream:function(e){var t=e.scope.internal.getFont(e.fontName,e.fontStyle).id,r=e.scope.__private__.encodeColorString(e.color);return"/"+t+" "+e.fontSize+" Tf "+r}};nr.internal={Bezier_C:.551915024494,calculateCross:function(e){var t=nr.internal.getWidth(e),r=nr.internal.getHeight(e),n=Math.min(t,r);return{x1:{x:(t-n)/2,y:(r-n)/2+n},x2:{x:(t-n)/2+n,y:(r-n)/2},x3:{x:(t-n)/2,y:(r-n)/2},x4:{x:(t-n)/2+n,y:(r-n)/2+n}}}},nr.internal.getWidth=function(e){var t=0;return rs(e)==="object"&&(t=UU(e.Rect[2])),t},nr.internal.getHeight=function(e){var t=0;return rs(e)==="object"&&(t=UU(e.Rect[3])),t};var wLe=ca.addField=function(e){if(bLe(this,e),!(e instanceof id))throw new Error("Invalid argument passed to jsPDF.addField.");var t;return(t=e).scope.internal.acroformPlugin.printedOut&&(t.scope.internal.acroformPlugin.printedOut=!1,t.scope.internal.acroformPlugin.acroFormDictionaryRoot=null),t.scope.internal.acroformPlugin.acroFormDictionaryRoot.Fields.push(t),e.page=e.scope.internal.getCurrentPageInfo().pageNumber,this};ca.AcroFormChoiceField=z0,ca.AcroFormListBox=U0,ca.AcroFormComboBox=q0,ca.AcroFormEditBox=hw,ca.AcroFormButton=ui,ca.AcroFormPushButton=mw,ca.AcroFormRadioButton=V0,ca.AcroFormCheckBox=pw,ca.AcroFormTextField=Km,ca.AcroFormPasswordField=gw,ca.AcroFormAppearance=nr,ca.AcroForm={ChoiceField:z0,ListBox:U0,ComboBox:q0,EditBox:hw,Button:ui,PushButton:mw,RadioButton:V0,CheckBox:pw,TextField:Km,PasswordField:gw,Appearance:nr},or.AcroForm={ChoiceField:z0,ListBox:U0,ComboBox:q0,EditBox:hw,Button:ui,PushButton:mw,RadioButton:V0,CheckBox:pw,TextField:Km,PasswordField:gw,Appearance:nr};var jLe=or.AcroForm;function yoe(e){return e.reduce(function(t,r,n){return t[r]=n,t},{})}(function(e){var t="addImage_";e.__addimage__={};var r="UNKNOWN",n={PNG:[[137,80,78,71]],TIFF:[[77,77,0,42],[73,73,42,0]],JPEG:[[255,216,255,224,void 0,void 0,74,70,73,70,0],[255,216,255,225,void 0,void 0,69,120,105,102,0,0],[255,216,255,219],[255,216,255,238]],JPEG2000:[[0,0,0,12,106,80,32,32]],GIF87a:[[71,73,70,56,55,97]],GIF89a:[[71,73,70,56,57,97]],WEBP:[[82,73,70,70,void 0,void 0,void 0,void 0,87,69,66,80]],BMP:[[66,77],[66,65],[67,73],[67,80],[73,67],[80,84]]},a=e.__addimage__.getImageFileTypeByImageData=function(T,k){var V,C,R,H,q,L=r;if((k=k||r)==="RGBA"||T.data!==void 0&&T.data instanceof Uint8ClampedArray&&"height"in T&&"width"in T)return"RGBA";if(j(T))for(q in n)for(R=n[q],V=0;V<R.length;V+=1){for(H=!0,C=0;C<R[V].length;C+=1)if(R[V][C]!==void 0&&R[V][C]!==T[C]){H=!1;break}if(H===!0){L=q;break}}else for(q in n)for(R=n[q],V=0;V<R.length;V+=1){for(H=!0,C=0;C<R[V].length;C+=1)if(R[V][C]!==void 0&&R[V][C]!==T.charCodeAt(C)){H=!1;break}if(H===!0){L=q;break}}return L===r&&k!==r&&(L=k),L},i=function T(k){for(var V=this.internal.write,C=this.internal.putStream,R=(0,this.internal.getFilters)();R.indexOf("FlateEncode")!==-1;)R.splice(R.indexOf("FlateEncode"),1);k.objectId=this.internal.newObject();var H=[];if(H.push({key:"Type",value:"/XObject"}),H.push({key:"Subtype",value:"/Image"}),H.push({key:"Width",value:k.width}),H.push({key:"Height",value:k.height}),k.colorSpace===v.INDEXED?H.push({key:"ColorSpace",value:"[/Indexed /DeviceRGB "+(k.palette.length/3-1)+" "+("sMask"in k&&k.sMask!==void 0?k.objectId+2:k.objectId+1)+" 0 R]"}):(H.push({key:"ColorSpace",value:"/"+k.colorSpace}),k.colorSpace===v.DEVICE_CMYK&&H.push({key:"Decode",value:"[1 0 1 0 1 0 1 0]"})),H.push({key:"BitsPerComponent",value:k.bitsPerComponent}),"decodeParameters"in k&&k.decodeParameters!==void 0&&H.push({key:"DecodeParms",value:"<<"+k.decodeParameters+">>"}),"transparency"in k&&Array.isArray(k.transparency)&&k.transparency.length>0){for(var q="",L=0,M=k.transparency.length;L<M;L++)q+=k.transparency[L]+" "+k.transparency[L]+" ";H.push({key:"Mask",value:"["+q+"]"})}k.sMask!==void 0&&H.push({key:"SMask",value:k.objectId+1+" 0 R"});var z=k.filter!==void 0?["/"+k.filter]:void 0;if(C({data:k.data,additionalKeyValues:H,alreadyAppliedFilters:z,objectId:k.objectId}),V("endobj"),"sMask"in k&&k.sMask!==void 0){var K,E=(K=k.sMaskBitsPerComponent)!==null&&K!==void 0?K:k.bitsPerComponent,A={width:k.width,height:k.height,colorSpace:"DeviceGray",bitsPerComponent:E,data:k.sMask};"filter"in k&&(A.decodeParameters="/Predictor ".concat(k.predictor," /Colors 1 /BitsPerComponent ").concat(E," /Columns ").concat(k.width),A.filter=k.filter),T.call(this,A)}if(k.colorSpace===v.INDEXED){var O=this.internal.newObject();C({data:I(new Uint8Array(k.palette)),objectId:O}),V("endobj")}},o=function(){var T=this.internal.collections[t+"images"];for(var k in T)i.call(this,T[k])},l=function(){var T,k=this.internal.collections[t+"images"],V=this.internal.write;for(var C in k)V("/I"+(T=k[C]).index,T.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))},u=function(){var T=this.internal.collections[t+"images"];return c.call(this),T},d=function(){return Object.keys(this.internal.collections[t+"images"]).length},f=function(T){return typeof e["process"+T.toUpperCase()]=="function"},m=function(T){return rs(T)==="object"&&T.nodeType===1},h=function(T,k){if(T.nodeName==="IMG"&&T.hasAttribute("src")){var V=""+T.getAttribute("src");if(V.indexOf("data:image/")===0)return l5(unescape(V).split("base64,").pop());var C=e.loadFile(V,!0);if(C!==void 0)return C}if(T.nodeName==="CANVAS"){if(T.width===0||T.height===0)throw new Error("Given canvas must have data. Canvas width: "+T.width+", height: "+T.height);var R;switch(k){case"PNG":R="image/png";break;case"WEBP":R="image/webp";break;default:R="image/jpeg"}return l5(T.toDataURL(R,1).split("base64,").pop())}},g=function(T){var k=this.internal.collections[t+"images"];if(k){for(var V in k)if(T===k[V].alias)return k[V]}},p=function(T,k,V){return T||k||(T=-96,k=-96),T<0&&(T=-1*V.width*72/T/this.internal.scaleFactor),k<0&&(k=-1*V.height*72/k/this.internal.scaleFactor),T===0&&(T=k*V.width/V.height),k===0&&(k=T*V.height/V.width),[T,k]},x=function(T,k,V,C,R,H){var q=p.call(this,V,C,R),L=this.internal.getCoordinateString,M=this.internal.getVerticalCoordinateString,z=u.call(this);if(V=q[0],C=q[1],z[R.index]=R,H){H*=Math.PI/180;var K=Math.cos(H),E=Math.sin(H),A=function(U){return U.toFixed(4)},O=[A(K),A(E),A(-1*E),A(K),0,0,"cm"]}this.internal.write("q"),H?(this.internal.write([1,"0","0",1,L(T),M(k+C),"cm"].join(" ")),this.internal.write(O.join(" ")),this.internal.write([L(V),"0","0",L(C),"0","0","cm"].join(" "))):this.internal.write([L(V),"0","0",L(C),L(T),M(k+C),"cm"].join(" ")),this.isAdvancedAPI()&&this.internal.write([1,0,0,-1,0,0,"cm"].join(" ")),this.internal.write("/I"+R.index+" Do"),this.internal.write("Q")},v=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 b=e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},y=e.__addimage__.sHashCode=function(T){var k,V,C=0;if(typeof T=="string")for(V=T.length,k=0;k<V;k++)C=(C<<5)-C+T.charCodeAt(k),C|=0;else if(j(T))for(V=T.byteLength/2,k=0;k<V;k++)C=(C<<5)-C+T[k],C|=0;return C},N=e.__addimage__.validateStringAsBase64=function(T){(T=T||"").toString().trim();var k=!0;return T.length===0&&(k=!1),T.length%4!=0&&(k=!1),/^[A-Za-z0-9+/]+$/.test(T.substr(0,T.length-2))===!1&&(k=!1),/^[A-Za-z0-9/][A-Za-z0-9+/]|[A-Za-z0-9+/]=|==$/.test(T.substr(-2))===!1&&(k=!1),k},_=e.__addimage__.extractImageFromDataUrl=function(T){if(T==null||!(T=T.trim()).startsWith("data:"))return null;var k=T.indexOf(",");return k<0?null:T.substring(0,k).trim().endsWith("base64")?T.substring(k+1):null};e.__addimage__.isArrayBuffer=function(T){return T instanceof ArrayBuffer};var j=e.__addimage__.isArrayBufferView=function(T){return T instanceof Int8Array||T instanceof Uint8Array||T instanceof Uint8ClampedArray||T instanceof Int16Array||T instanceof Uint16Array||T instanceof Int32Array||T instanceof Uint32Array||T instanceof Float32Array||T instanceof Float64Array},S=e.__addimage__.binaryStringToUint8Array=function(T){for(var k=T.length,V=new Uint8Array(k),C=0;C<k;C++)V[C]=T.charCodeAt(C);return V},I=e.__addimage__.arrayBufferToBinaryString=function(T){for(var k="",V=j(T)?T:new Uint8Array(T),C=0;C<V.length;C+=8192)k+=String.fromCharCode.apply(null,V.subarray(C,C+8192));return k};e.addImage=function(){var T,k,V,C,R,H,q,L,M;if(typeof arguments[1]=="number"?(k=r,V=arguments[1],C=arguments[2],R=arguments[3],H=arguments[4],q=arguments[5],L=arguments[6],M=arguments[7]):(k=arguments[1],V=arguments[2],C=arguments[3],R=arguments[4],H=arguments[5],q=arguments[6],L=arguments[7],M=arguments[8]),rs(T=arguments[0])==="object"&&!m(T)&&"imageData"in T){var z=T;T=z.imageData,k=z.format||k||r,V=z.x||V||0,C=z.y||C||0,R=z.w||z.width||R,H=z.h||z.height||H,q=z.alias||q,L=z.compression||L,M=z.rotation||z.angle||M}var K=this.internal.getFilters();if(L===void 0&&K.indexOf("FlateEncode")!==-1&&(L="SLOW"),isNaN(V)||isNaN(C))throw new Error("Invalid coordinates passed to jsPDF.addImage");c.call(this);var E=P.call(this,T,k,q,L);return x.call(this,V,C,R,H,E,M),this};var P=function(T,k,V,C){var R,H,q;if(typeof T=="string"&&a(T)===r){T=unescape(T);var L=F(T,!1);(L!==""||(L=e.loadFile(T,!0))!==void 0)&&(T=L)}if(m(T)&&(T=h(T,k)),k=a(T,k),!f(k))throw new Error("addImage does not support files of type '"+k+"', please ensure that a plugin for '"+k+"' support is added.");if(((q=V)==null||q.length===0)&&(V=function(M){return typeof M=="string"||j(M)?y(M):j(M.data)?y(M.data):null}(T)),(R=g.call(this,V))||(T instanceof Uint8Array||k==="RGBA"||(H=T,T=S(T)),R=this["process"+k.toUpperCase()](T,d.call(this),V,function(M){return M&&typeof M=="string"&&(M=M.toUpperCase()),M in e.image_compression?M:b.NONE}(C),H)),!R)throw new Error("An unknown error occurred whilst processing the image.");return R},F=e.__addimage__.convertBase64ToBinaryString=function(T,k){k=typeof k!="boolean"||k;var V,C="";if(typeof T=="string"){var R;V=(R=_(T))!==null&&R!==void 0?R:T;try{C=l5(V)}catch(H){if(k)throw N(V)?new Error("atob-Error in jsPDF.convertBase64ToBinaryString "+H.message):new Error("Supplied Data is not a valid base64-String jsPDF.convertBase64ToBinaryString ")}}return C};e.getImageProperties=function(T){var k,V,C="";if(m(T)&&(T=h(T)),typeof T=="string"&&a(T)===r&&((C=F(T,!1))===""&&(C=e.loadFile(T)||""),T=C),V=a(T),!f(V))throw new Error("addImage does not support files of type '"+V+"', please ensure that a plugin for '"+V+"' support is added.");if(T instanceof Uint8Array||(T=S(T)),!(k=this["process"+V.toUpperCase()](T)))throw new Error("An unknown error occurred whilst processing the image");return k.fileType=V,k}})(or.API),function(e){var t=function(r){if(r!==void 0&&r!="")return!0};or.API.events.push(["addPage",function(r){this.internal.getPageInfo(r.pageNumber).pageContext.annotations=[]}]),e.events.push(["putPage",function(r){for(var n,a,i,o=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString,c=this.internal.getPageInfoByObjId(r.objId),u=r.pageContext.annotations,d=!1,f=0;f<u.length&&!d;f++)switch((n=u[f]).type){case"link":(t(n.options.url)||t(n.options.pageNumber))&&(d=!0);break;case"reference":case"text":case"freetext":d=!0}if(d!=0){this.internal.write("/Annots [");for(var m=0;m<u.length;m++){n=u[m];var h=this.internal.pdfEscape,g=this.internal.getEncryptor(r.objId);switch(n.type){case"reference":this.internal.write(" "+n.object.objId+" 0 R ");break;case"text":var p=this.internal.newAdditionalObject(),x=this.internal.newAdditionalObject(),v=this.internal.getEncryptor(p.objId),b=n.title||"Note";i="<</Type /Annot /Subtype /Text "+(a="/Rect ["+o(n.bounds.x)+" "+l(n.bounds.y+n.bounds.h)+" "+o(n.bounds.x+n.bounds.w)+" "+l(n.bounds.y)+"] ")+"/Contents ("+h(v(n.contents))+")",i+=" /Popup "+x.objId+" 0 R",i+=" /P "+c.objId+" 0 R",i+=" /T ("+h(v(b))+") >>",p.content=i;var y=p.objId+" 0 R";i="<</Type /Annot /Subtype /Popup "+(a="/Rect ["+o(n.bounds.x+30)+" "+l(n.bounds.y+n.bounds.h)+" "+o(n.bounds.x+n.bounds.w+30)+" "+l(n.bounds.y)+"] ")+" /Parent "+y,n.open&&(i+=" /Open true"),i+=" >>",x.content=i,this.internal.write(p.objId,"0 R",x.objId,"0 R");break;case"freetext":a="/Rect ["+o(n.bounds.x)+" "+l(n.bounds.y)+" "+o(n.bounds.x+n.bounds.w)+" "+l(n.bounds.y+n.bounds.h)+"] ";var N=n.color||"#000000";i="<</Type /Annot /Subtype /FreeText "+a+"/Contents ("+h(g(n.contents))+")",i+=" /DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#"+N+")",i+=" /Border [0 0 0]",i+=" >>",this.internal.write(i);break;case"link":if(n.options.name){var _=this.annotations._nameMap[n.options.name];n.options.pageNumber=_.page,n.options.top=_.y}else n.options.top||(n.options.top=0);if(a="/Rect ["+n.finalBounds.x+" "+n.finalBounds.y+" "+n.finalBounds.w+" "+n.finalBounds.h+"] ",i="",n.options.url)i="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /A <</S /URI /URI ("+h(g(n.options.url))+") >>";else if(n.options.pageNumber)switch(i="<</Type /Annot /Subtype /Link "+a+"/Border [0 0 0] /Dest ["+this.internal.getPageInfo(n.options.pageNumber).objId+" 0 R",n.options.magFactor=n.options.magFactor||"XYZ",n.options.magFactor){case"Fit":i+=" /Fit]";break;case"FitH":i+=" /FitH "+n.options.top+"]";break;case"FitV":n.options.left=n.options.left||0,i+=" /FitV "+n.options.left+"]";break;default:var j=l(n.options.top);n.options.left=n.options.left||0,n.options.zoom===void 0&&(n.options.zoom=0),i+=" /XYZ "+n.options.left+" "+j+" "+n.options.zoom+"]"}i!=""&&(i+=" >>",this.internal.write(i))}}this.internal.write("]")}}]),e.createAnnotation=function(r){var n=this.internal.getCurrentPageInfo();switch(r.type){case"link":this.link(r.bounds.x,r.bounds.y,r.bounds.w,r.bounds.h,r);break;case"text":case"freetext":n.pageContext.annotations.push(r)}},e.link=function(r,n,a,i,o){var l=this.internal.getCurrentPageInfo(),c=this.internal.getCoordinateString,u=this.internal.getVerticalCoordinateString;l.pageContext.annotations.push({finalBounds:{x:c(r),y:u(n),w:c(r+a),h:u(n+i)},options:o,type:"link"})},e.textWithLink=function(r,n,a,i){var o,l,c=this.getTextWidth(r),u=this.internal.getLineHeight()/this.internal.scaleFactor;if(i.maxWidth!==void 0){l=i.maxWidth;var d=this.splitTextToSize(r,l).length;o=Math.ceil(u*d)}else l=c,o=u;return this.text(r,n,a,i),a+=.2*u,i.align==="center"&&(n-=c/2),i.align==="right"&&(n-=c),this.link(n,a-u,l,o,i),c},e.getTextWidth=function(r){var n=this.internal.getFontSize();return this.getStringUnitWidth(r)*n/this.internal.scaleFactor}}(or.API),function(e){var t={1569:[65152],1570:[65153,65154],1571:[65155,65156],1572:[65157,65158],1573:[65159,65160],1574:[65161,65162,65163,65164],1575:[65165,65166],1576:[65167,65168,65169,65170],1577:[65171,65172],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194],1584:[65195,65196],1585:[65197,65198],1586:[65199,65200],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1649:[64336,64337],1655:[64477],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393],1676:[64388,64389],1677:[64386,64387],1678:[64390,64391],1681:[64396,64397],1688:[64394,64395],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421],1729:[64422,64423,64424,64425],1733:[64480,64481],1734:[64473,64474],1735:[64471,64472],1736:[64475,64476],1737:[64482,64483],1739:[64478,64479],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431],1747:[64432,64433]},r={65247:{65154:65269,65156:65271,65160:65273,65166:65275},65248:{65154:65270,65156:65272,65160:65274,65166:65276},65165:{65247:{65248:{65258:65010}}},1617:{1612:64606,1613:64607,1614:64608,1615:64609,1616:64610}},n={1612:64606,1613:64607,1614:64608,1615:64609,1616:64610},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 u=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 d=e.__arabicParser__.arabicLetterHasMedialForm=function(p){return o(p)&&i(p)&&t[p.charCodeAt(0)].length==4},f=e.__arabicParser__.resolveLigatures=function(p){var x=0,v=r,b="",y=0;for(x=0;x<p.length;x+=1)v[p.charCodeAt(x)]!==void 0?(y++,typeof(v=v[p.charCodeAt(x)])=="number"&&(b+=String.fromCharCode(v),v=r,y=0),x===p.length-1&&(v=r,b+=p.charAt(x-(y-1)),x-=y-1,y=0)):(v=r,b+=p.charAt(x-y),x-=y,y=0);return b};e.__arabicParser__.isArabicDiacritic=function(p){return p!==void 0&&n[p.charCodeAt(0)]!==void 0};var m=e.__arabicParser__.getCorrectForm=function(p,x,v){return o(p)?i(p)===!1?-1:!u(p)||!o(x)&&!o(v)||!o(v)&&l(x)||l(p)&&!o(x)||l(p)&&c(x)||l(p)&&l(x)?0:d(p)&&o(x)&&!l(x)&&o(v)&&u(v)?3:l(p)||!o(v)?1:2:-1},h=function(p){var x=0,v=0,b=0,y="",N="",_="",j=(p=p||"").split("\\s+"),S=[];for(x=0;x<j.length;x+=1){for(S.push(""),v=0;v<j[x].length;v+=1)y=j[x][v],N=j[x][v-1],_=j[x][v+1],o(y)?(b=m(y,N,_),S[x]+=b!==-1?String.fromCharCode(t[y.charCodeAt(0)][b]):y):S[x]+=y;S[x]=f(S[x])}return S.join(" ")},g=e.__arabicParser__.processArabic=e.processArabic=function(){var p,x=typeof arguments[0]=="string"?arguments[0]:arguments[0].text,v=[];if(Array.isArray(x)){var b=0;for(v=[],b=0;b<x.length;b+=1)Array.isArray(x[b])?v.push([h(x[b][0]),x[b][1],x[b][2]]):v.push([h(x[b])]);p=v}else p=h(x);return typeof arguments[0]=="string"?p:(arguments[0].text=p,arguments[0])};e.events.push(["preProcessText",g])}(or.API),or.API.autoPrint=function(e){var t;return(e=e||{}).variant=e.variant||"non-conform",e.variant==="javascript"?this.addJS("print({});"):(this.internal.events.subscribe("postPutResources",function(){t=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /Named"),this.internal.out("/Type /Action"),this.internal.out("/N /Print"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){this.internal.out("/OpenAction "+t+" 0 R")})),this},function(e){var t=function(){var r=void 0;Object.defineProperty(this,"pdf",{get:function(){return r},set:function(l){r=l}});var n=150;Object.defineProperty(this,"width",{get:function(){return n},set:function(l){n=isNaN(l)||Number.isInteger(l)===!1||l<0?150:l,this.getContext("2d").pageWrapXEnabled&&(this.getContext("2d").pageWrapX=n+1)}});var 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(r,n){var a;if((r=r||"2d")!=="2d")return null;for(a in n)this.pdf.context2d.hasOwnProperty(a)&&(this.pdf.context2d[a]=n[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}])}(or.API),function(e){var t={left:0,top:0,bottom:0,right:0},r=!1,n=function(){this.internal.__cell__===void 0&&(this.internal.__cell__={},this.internal.__cell__.padding=3,this.internal.__cell__.headerFunction=void 0,this.internal.__cell__.margins=Object.assign({},t),this.internal.__cell__.margins.width=this.getPageWidth(),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 u=arguments[1];Object.defineProperty(this,"y",{enumerable:!0,get:function(){return u},set:function(p){u=p}});var d=arguments[2];Object.defineProperty(this,"width",{enumerable:!0,get:function(){return d},set:function(p){d=p}});var f=arguments[3];Object.defineProperty(this,"height",{enumerable:!0,get:function(){return f},set:function(p){f=p}});var m=arguments[4];Object.defineProperty(this,"text",{enumerable:!0,get:function(){return m},set:function(p){m=p}});var h=arguments[5];Object.defineProperty(this,"lineNumber",{enumerable:!0,get:function(){return h},set:function(p){h=p}});var g=arguments[6];return Object.defineProperty(this,"align",{enumerable:!0,get:function(){return g},set:function(p){g=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 n.call(this),this.internal.__cell__.headerFunction=typeof c=="function"?c:void 0,this},e.getTextDimensions=function(c,u){n.call(this);var d=(u=u||{}).fontSize||this.getFontSize(),f=u.font||this.getFont(),m=u.scaleFactor||this.internal.scaleFactor,h=0,g=0,p=0,x=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 v=u.maxWidth;v>0?typeof c=="string"?c=this.splitTextToSize(c,v):Object.prototype.toString.call(c)==="[object Array]"&&(c=c.reduce(function(y,N){return y.concat(x.splitTextToSize(N,v))},[])):c=Array.isArray(c)?c:[c];for(var b=0;b<c.length;b++)h<(p=this.getStringUnitWidth(c[b],{font:f})*d)&&(h=p);return h!==0&&(g=c.length),{w:h/=m,h:Math.max((g*d*this.getLineHeightFactor()-d*(this.getLineHeightFactor()-1))/m,0)}},e.cellAddPage=function(){n.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]),n.call(this);var u=this.internal.__cell__.lastCell,d=this.internal.__cell__.padding,f=this.internal.__cell__.margins||t,m=this.internal.__cell__.tableHeaderRow,h=this.internal.__cell__.printHeaders;return u.lineNumber!==void 0&&(u.lineNumber===c.lineNumber?(c.x=(u.x||0)+(u.width||0),c.y=u.y||0):u.y+u.height+c.height+f.bottom>this.getPageHeight()?(this.cellAddPage(),c.y=f.top,h&&m&&(this.printHeaderRow(c.lineNumber,!0),c.y+=m[0].height)):c.y=u.y+u.height||c.y),c.text[0]!==void 0&&(this.rect(c.x,c.y,c.width,c.height,r===!0?"FD":void 0),c.align==="right"?this.text(c.text,c.x+c.width-d,c.y+d,{align:"right",baseline:"top"}):c.align==="center"?this.text(c.text,c.x+c.width/2,c.y+d,{align:"center",baseline:"top",maxWidth:c.width-d-d}):this.text(c.text,c.x+d,c.y+d,{align:"left",baseline:"top",maxWidth:c.width-d-d})),this.internal.__cell__.lastCell=c,this};e.table=function(c,u,d,f,m){if(n.call(this),!d)throw new Error("No data for PDF table.");var h,g,p,x,v=[],b=[],y=[],N={},_={},j=[],S=[],I=(m=m||{}).autoSize||!1,P=m.printHeaders!==!1,F=m.css&&m.css["font-size"]!==void 0?16*m.css["font-size"]:m.fontSize||12,T=m.margins||Object.assign({width:this.getPageWidth()},t),k=typeof m.padding=="number"?m.padding:3,V=m.headerBackgroundColor||"#c8c8c8",C=m.headerTextColor||"#000";if(a.call(this),this.internal.__cell__.printHeaders=P,this.internal.__cell__.margins=T,this.internal.__cell__.table_font_size=F,this.internal.__cell__.padding=k,this.internal.__cell__.headerBackgroundColor=V,this.internal.__cell__.headerTextColor=C,this.setFontSize(F),f==null)b=v=Object.keys(d[0]),y=v.map(function(){return"left"});else if(Array.isArray(f)&&rs(f[0])==="object")for(v=f.map(function(z){return z.name}),b=f.map(function(z){return z.prompt||z.name||""}),y=f.map(function(z){return z.align||"left"}),h=0;h<f.length;h+=1)_[f[h].name]=.7499990551181103*f[h].width;else Array.isArray(f)&&typeof f[0]=="string"&&(b=v=f,y=v.map(function(){return"left"}));if(I||Array.isArray(f)&&typeof f[0]=="string")for(h=0;h<v.length;h+=1){for(N[x=v[h]]=d.map(function(z){return z[x]}),this.setFont(void 0,"bold"),j.push(this.getTextDimensions(b[h],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w),g=N[x],this.setFont(void 0,"normal"),p=0;p<g.length;p+=1)j.push(this.getTextDimensions(g[p],{fontSize:this.internal.__cell__.table_font_size,scaleFactor:this.internal.scaleFactor}).w);_[x]=Math.max.apply(null,j)+k+k,j=[]}if(P){var R={};for(h=0;h<v.length;h+=1)R[v[h]]={},R[v[h]].text=b[h],R[v[h]].align=y[h];var H=l.call(this,R,_);S=v.map(function(z){return new i(c,u,_[z],H,R[z].text,void 0,R[z].align)}),this.setTableHeaderRow(S),this.printHeaderRow(1,!1)}var q=f.reduce(function(z,K){return z[K.name]=K.align,z},{});for(h=0;h<d.length;h+=1){"rowStart"in m&&m.rowStart instanceof Function&&m.rowStart({row:h,data:d[h]},this);var L=l.call(this,d[h],_);for(p=0;p<v.length;p+=1){var M=d[h][v[p]];"cellStart"in m&&m.cellStart instanceof Function&&m.cellStart({row:h,col:p,data:M},this),o.call(this,new i(c,u,_[v[p]],L,M,h+2,q[v[p]]))}}return this.internal.__cell__.table_x=c,this.internal.__cell__.table_y=u,this};var l=function(c,u){var d=this.internal.__cell__.padding,f=this.internal.__cell__.table_font_size,m=this.internal.scaleFactor;return Object.keys(c).map(function(h){var g=c[h];return this.splitTextToSize(g.hasOwnProperty("text")?g.text:g,u[h]-d-d)},this).map(function(h){return this.getLineHeightFactor()*h.length*f/m+d+d},this).reduce(function(h,g){return Math.max(h,g)},0)};e.setTableHeaderRow=function(c){n.call(this),this.internal.__cell__.tableHeaderRow=c},e.printHeaderRow=function(c,u){if(n.call(this),!this.internal.__cell__.tableHeaderRow)throw new Error("Property tableHeaderRow does not exist.");var d;if(r=!0,typeof this.internal.__cell__.headerFunction=="function"){var f=this.internal.__cell__.headerFunction(this,this.internal.__cell__.pages);this.internal.__cell__.lastCell=new i(f[0],f[1],f[2],f[3],void 0,-1)}this.setFont(void 0,"bold");for(var m=[],h=0;h<this.internal.__cell__.tableHeaderRow.length;h+=1){d=this.internal.__cell__.tableHeaderRow[h].clone(),u&&(d.y=this.internal.__cell__.margins.top||0,m.push(d)),d.lineNumber=c;var g=this.getTextColor();this.setTextColor(this.internal.__cell__.headerTextColor),this.setFillColor(this.internal.__cell__.headerBackgroundColor),o.call(this,d),this.setTextColor(g)}m.length>0&&this.setTableHeaderRow(m),this.setFont(void 0,"normal"),r=!1}}(or.API);var boe={italic:["italic","oblique","normal"],oblique:["oblique","italic","normal"],normal:["normal","oblique","italic"]},woe=["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded"],o8=yoe(woe),joe=[100,200,300,400,500,600,700,800,900],_Le=yoe(joe);function ST(e){var t=e.family.replace(/"|'/g,"").toLowerCase(),r=function(i){return boe[i=i||"normal"]?i:"normal"}(e.style),n=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 o8[i=i||"normal"]=="number"?i:"normal"}(e.stretch);return{family:t,style:r,weight:n,stretch:a,src:e.src||[],ref:e.ref||{name:t,style:[a,r,n].join(" ")}}}function qU(e,t,r,n){var a;for(a=r;a>=0&&a<t.length;a+=n)if(e[t[a]])return e[t[a]];for(a=r;a>=0&&a<t.length;a-=n)if(e[t[a]])return e[t[a]]}var NLe={"sans-serif":"helvetica",fixed:"courier",monospace:"courier",terminal:"courier",cursive:"times",fantasy:"times",serif:"times"},VU={caption:"times",icon:"times",menu:"times","message-box":"times","small-caption":"times","status-bar":"times"};function WU(e){return[e.stretch,e.style,e.weight,e.family].join(" ")}function HU(e){return e.trimLeft()}function SLe(e,t){for(var r=0;r<e.length;){if(e.charAt(r)===t)return[e.substring(0,r),e.substring(r+1)];r+=1}return null}function kLe(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 nS,GU,KU,_x,sS,YU,XU,ZU,kT=["times"];function JU(e,t,r,n,a){var i=4,o=eq;switch(a){case or.API.image_compression.FAST:i=1,o=QU;break;case or.API.image_compression.MEDIUM:i=6,o=tq;break;case or.API.image_compression.SLOW:i=9,o=rq}e=function(c,u,d,f){for(var m,h=c.length/u,g=new Uint8Array(c.length+h),p=[CLe,QU,eq,tq,rq],x=0;x<h;x+=1){var v=x*u,b=c.subarray(v,v+u);if(f)g.set(f(b,d,m),v+x);else{for(var y=p.length,N=[],_=0;_<y;_+=1)N[_]=p[_](b,d,m);var j=ALe(N.concat());g.set(N[j],v+x)}m=b}return g}(e,t,Math.ceil(r*n/8),o);var l=e8(e,{level:i});return or.API.__addimage__.arrayBufferToBinaryString(l)}function CLe(e){var t=Array.apply([],e);return t.unshift(0),t}function QU(e,t){var r=e.length,n=[];n[0]=1;for(var a=0;a<r;a+=1){var i=e[a-t]||0;n[a+1]=e[a]-i+256&255}return n}function eq(e,t,r){var n=e.length,a=[];a[0]=2;for(var i=0;i<n;i+=1){var o=r&&r[i]||0;a[i+1]=e[i]-o+256&255}return a}function tq(e,t,r){var n=e.length,a=[];a[0]=3;for(var i=0;i<n;i+=1){var o=e[i-t]||0,l=r&&r[i]||0;a[i+1]=e[i]+256-(o+l>>>1)&255}return a}function rq(e,t,r){var n=e.length,a=[];a[0]=4;for(var i=0;i<n;i+=1){var o=ELe(e[i-t]||0,r&&r[i]||0,r&&r[i-t]||0);a[i+1]=e[i]-o+256&255}return a}function ELe(e,t,r){if(e===t&&t===r)return e;var n=Math.abs(t-r),a=Math.abs(e-r),i=Math.abs(e+t-r-r);return n<=a&&n<=i?e:a<=i?t:r}function ALe(e){var t=e.map(function(r){return r.reduce(function(n,a){return n+Math.abs(a)},0)});return t.indexOf(Math.min.apply(null,t))}function CT(e,t,r){var n=t*r,a=Math.floor(n/8),i=16-(n-8*a+r),o=(1<<r)-1;return _oe(e,a)>>i&o}function nq(e,t,r,n){var a=r*n,i=Math.floor(a/8),o=16-(a-8*i+n),l=(1<<n)-1,c=(t&l)<<o;(function(u,d,f){if(d+1<u.byteLength)u.setUint16(d,f,!1);else{var m=f>>8&255;u.setUint8(d,m)}})(e,i,_oe(e,i)&~(l<<o)&65535|c)}function _oe(e,t){return t+1<e.byteLength?e.getUint16(t,!1):e.getUint8(t)<<8}function TLe(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!=56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var r=e[t++]|e[t++]<<8,n=e[t++]|e[t++]<<8,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 u=!0,d=[],f=0,m=null,h=0,g=null;for(this.width=r,this.height=n;u&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,g=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!((T=e[t++])>=0))throw Error("Invalid block size");if(T===0)break;t+=T}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var p=e[t++];f=e[t++]|e[t++]<<8,m=e[t++],1&p||(m=null),h=p>>2&7,t++;break;case 254:for(;;){if(!((T=e[t++])>=0))throw Error("Invalid block size");if(T===0)break;t+=T}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var x=e[t++]|e[t++]<<8,v=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,N=e[t++],_=N>>6&1,j=1<<1+(7&N),S=l,I=c,P=!1;N>>7&&(P=!0,S=t,I=j,t+=3*j);var F=t;for(t++;;){var T;if(!((T=e[t++])>=0))throw Error("Invalid block size");if(T===0)break;t+=T}d.push({x,y:v,width:b,height:y,has_local_palette:P,palette_offset:S,palette_size:I,data_offset:F,data_length:t-F,transparent_index:m,interlaced:!!_,delay:f,disposal:h});break;case 59:u=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return d.length},this.loopCount=function(){return g},this.frameInfo=function(k){if(k<0||k>=d.length)throw new Error("Frame index out of range.");return d[k]},this.decodeAndBlitFrameBGRA=function(k,V){var C=this.frameInfo(k),R=C.width*C.height,H=new Uint8Array(R);sq(e,C.data_offset,H,R);var q=C.palette_offset,L=C.transparent_index;L===null&&(L=256);var M=C.width,z=r-M,K=M,E=4*(C.y*r+C.x),A=4*((C.y+C.height)*r+C.x),O=E,U=4*z;C.interlaced===!0&&(U+=4*r*7);for(var Y=8,J=0,se=H.length;J<se;++J){var ee=H[J];if(K===0&&(K=M,(O+=U)>=A&&(U=4*z+4*r*(Y-1),O=E+(M+z)*(Y<<1),Y>>=1)),ee===L)O+=4;else{var ie=e[q+3*ee],Ee=e[q+3*ee+1],te=e[q+3*ee+2];V[O++]=te,V[O++]=Ee,V[O++]=ie,V[O++]=255}--K}},this.decodeAndBlitFrameRGBA=function(k,V){var C=this.frameInfo(k),R=C.width*C.height,H=new Uint8Array(R);sq(e,C.data_offset,H,R);var q=C.palette_offset,L=C.transparent_index;L===null&&(L=256);var M=C.width,z=r-M,K=M,E=4*(C.y*r+C.x),A=4*((C.y+C.height)*r+C.x),O=E,U=4*z;C.interlaced===!0&&(U+=4*r*7);for(var Y=8,J=0,se=H.length;J<se;++J){var ee=H[J];if(K===0&&(K=M,(O+=U)>=A&&(U=4*z+4*r*(Y-1),O=E+(M+z)*(Y<<1),Y>>=1)),ee===L)O+=4;else{var ie=e[q+3*ee],Ee=e[q+3*ee+1],te=e[q+3*ee+2];V[O++]=ie,V[O++]=Ee,V[O++]=te,V[O++]=255}--K}}}function sq(e,t,r,n){for(var a=e[t++],i=1<<a,o=i+1,l=o+1,c=a+1,u=(1<<c)-1,d=0,f=0,m=0,h=e[t++],g=new Int32Array(4096),p=null;;){for(;d<16&&h!==0;)f|=e[t++]<<d,d+=8,h===1?h=e[t++]:--h;if(d<c)break;var x=f&u;if(f>>=c,d-=c,x!==i){if(x===o)break;for(var v=x<l?x:p,b=0,y=v;y>i;)y=g[y]>>8,++b;var N=y;if(m+b+(v!==x?1:0)>n)return void hs.log("Warning, gif stream longer than expected.");r[m++]=N;var _=m+=b;for(v!==x&&(r[m++]=N),y=v;b--;)y=g[y],r[--_]=255&y,y>>=8;p!==null&&l<4096&&(g[l++]=p<<8|N,l>=u+1&&c<12&&(++c,u=u<<1|1)),p=x}else l=o+1,u=(1<<(c=a+1))-1,p=null}return m!==n&&hs.log("Warning, gif stream shorter than expected."),r}/**
* @license
Copyright (c) 2008, Adobe Systems Incorporated
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Adobe Systems Incorporated nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/function ET(e){var t,r,n,a,i,o=Math.floor,l=new Array(64),c=new Array(64),u=new Array(64),d=new Array(64),f=new Array(65535),m=new Array(65535),h=new Array(64),g=new Array(64),p=[],x=0,v=7,b=new Array(64),y=new Array(64),N=new Array(64),_=new Array(256),j=new Array(2048),S=[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],I=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],P=[0,1,2,3,4,5,6,7,8,9,10,11],F=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[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],k=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],C=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],R=[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 H(E,A){for(var O=0,U=0,Y=new Array,J=1;J<=16;J++){for(var se=1;se<=E[J];se++)Y[A[U]]=[],Y[A[U]][0]=O,Y[A[U]][1]=J,U++,O++;O*=2}return Y}function q(E){for(var A=E[0],O=E[1]-1;O>=0;)A&1<<O&&(x|=1<<v),O--,--v<0&&(x==255?(L(255),L(0)):L(x),v=7,x=0)}function L(E){p.push(E)}function M(E){L(E>>8&255),L(255&E)}function z(E,A,O,U,Y){for(var J,se=Y[0],ee=Y[240],ie=function(fe,Fe){var ge,pe,Ie,Ge,we,_e,qe,Re,Me,He,st=0;for(Me=0;Me<8;++Me){ge=fe[st],pe=fe[st+1],Ie=fe[st+2],Ge=fe[st+3],we=fe[st+4],_e=fe[st+5],qe=fe[st+6];var Zt=ge+(Re=fe[st+7]),_t=ge-Re,Vt=pe+qe,Jt=pe-qe,Qt=Ie+_e,qt=Ie-_e,it=Ge+we,It=Ge-we,Mt=Zt+it,wr=Zt-it,$t=Vt+Qt,kt=Vt-Qt;fe[st]=Mt+$t,fe[st+4]=Mt-$t;var dr=.707106781*(kt+wr);fe[st+2]=wr+dr,fe[st+6]=wr-dr;var Kt=.382683433*((Mt=It+qt)-(kt=Jt+_t)),ir=.5411961*Mt+Kt,jr=1.306562965*kt+Kt,mn=.707106781*($t=qt+Jt),Ht=_t+mn,sn=_t-mn;fe[st+5]=sn+ir,fe[st+3]=sn-ir,fe[st+1]=Ht+jr,fe[st+7]=Ht-jr,st+=8}for(st=0,Me=0;Me<8;++Me){ge=fe[st],pe=fe[st+8],Ie=fe[st+16],Ge=fe[st+24],we=fe[st+32],_e=fe[st+40],qe=fe[st+48];var Bn=ge+(Re=fe[st+56]),tn=ge-Re,vn=pe+qe,En=pe-qe,Xn=Ie+_e,me=Ie-_e,Te=Ge+we,Ne=Ge-we,Ce=Bn+Te,ue=Bn-Te,ve=vn+Xn,$e=vn-Xn;fe[st]=Ce+ve,fe[st+32]=Ce-ve;var et=.707106781*($e+ue);fe[st+16]=ue+et,fe[st+48]=ue-et;var Xe=.382683433*((Ce=Ne+me)-($e=En+tn)),Ze=.5411961*Ce+Xe,rt=1.306562965*$e+Xe,Nt=.707106781*(ve=me+En),Rt=tn+Nt,Wt=tn-Nt;fe[st+40]=Wt+Ze,fe[st+24]=Wt-Ze,fe[st+8]=Rt+rt,fe[st+56]=Rt-rt,st++}for(Me=0;Me<64;++Me)He=fe[Me]*Fe[Me],h[Me]=He>0?He+.5|0:He-.5|0;return h}(E,A),Ee=0;Ee<64;++Ee)g[S[Ee]]=ie[Ee];var te=g[0]-O;O=g[0],te==0?q(U[0]):(q(U[m[J=32767+te]]),q(f[J]));for(var Ue=63;Ue>0&&g[Ue]==0;)Ue--;if(Ue==0)return q(se),O;for(var W,Z=1;Z<=Ue;){for(var le=Z;g[Z]==0&&Z<=Ue;)++Z;var re=Z-le;if(re>=16){W=re>>4;for(var oe=1;oe<=W;++oe)q(ee);re&=15}J=32767+g[Z],q(Y[(re<<4)+m[J]]),q(f[J]),Z++}return Ue!=63&&q(se),O}function K(E){E=Math.min(Math.max(E,1),100),i!=E&&(function(A){for(var O=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],U=0;U<64;U++){var Y=o((O[U]*A+50)/100);Y=Math.min(Math.max(Y,1),255),l[S[U]]=Y}for(var J=[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],se=0;se<64;se++){var ee=o((J[se]*A+50)/100);ee=Math.min(Math.max(ee,1),255),c[S[se]]=ee}for(var ie=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],Ee=0,te=0;te<8;te++)for(var Ue=0;Ue<8;Ue++)u[Ee]=1/(l[S[Ee]]*ie[te]*ie[Ue]*8),d[Ee]=1/(c[S[Ee]]*ie[te]*ie[Ue]*8),Ee++}(E<50?Math.floor(5e3/E):Math.floor(200-2*E)),i=E)}this.encode=function(E,A){A&&K(A),p=new Array,x=0,v=7,M(65496),M(65504),M(16),L(74),L(70),L(73),L(70),L(0),L(1),L(1),L(0),M(1),M(1),L(0),L(0),function(){M(65499),M(132),L(0);for(var pe=0;pe<64;pe++)L(l[pe]);L(1);for(var Ie=0;Ie<64;Ie++)L(c[Ie])}(),function(pe,Ie){M(65472),M(17),L(8),M(Ie),M(pe),L(3),L(1),L(17),L(0),L(2),L(17),L(1),L(3),L(17),L(1)}(E.width,E.height),function(){M(65476),M(418),L(0);for(var pe=0;pe<16;pe++)L(I[pe+1]);for(var Ie=0;Ie<=11;Ie++)L(P[Ie]);L(16);for(var Ge=0;Ge<16;Ge++)L(F[Ge+1]);for(var we=0;we<=161;we++)L(T[we]);L(1);for(var _e=0;_e<16;_e++)L(k[_e+1]);for(var qe=0;qe<=11;qe++)L(V[qe]);L(17);for(var Re=0;Re<16;Re++)L(C[Re+1]);for(var Me=0;Me<=161;Me++)L(R[Me])}(),M(65498),M(12),L(3),L(1),L(0),L(2),L(17),L(3),L(17),L(0),L(63),L(0);var O=0,U=0,Y=0;x=0,v=7,this.encode.displayName="_encode_";for(var J,se,ee,ie,Ee,te,Ue,W,Z,le=E.data,re=E.width,oe=E.height,fe=4*re,Fe=0;Fe<oe;){for(J=0;J<fe;){for(Ee=fe*Fe+J,Ue=-1,W=0,Z=0;Z<64;Z++)te=Ee+(W=Z>>3)*fe+(Ue=4*(7&Z)),Fe+W>=oe&&(te-=fe*(Fe+1+W-oe)),J+Ue>=fe&&(te-=J+Ue-fe+4),se=le[te++],ee=le[te++],ie=le[te++],b[Z]=(j[se]+j[ee+256|0]+j[ie+512|0]>>16)-128,y[Z]=(j[se+768|0]+j[ee+1024|0]+j[ie+1280|0]>>16)-128,N[Z]=(j[se+1280|0]+j[ee+1536|0]+j[ie+1792|0]>>16)-128;O=z(b,u,O,t,n),U=z(y,d,U,r,a),Y=z(N,d,Y,r,a),J+=32}Fe+=8}if(v>=0){var ge=[];ge[1]=v+1,ge[0]=(1<<v+1)-1,q(ge)}return M(65497),new Uint8Array(p)},e=e||50,function(){for(var E=String.fromCharCode,A=0;A<256;A++)_[A]=E(A)}(),t=H(I,P),r=H(k,V),n=H(F,T),a=H(C,R),function(){for(var E=1,A=2,O=1;O<=15;O++){for(var U=E;U<A;U++)m[32767+U]=O,f[32767+U]=[],f[32767+U][1]=O,f[32767+U][0]=U;for(var Y=-(A-1);Y<=-E;Y++)m[32767+Y]=O,f[32767+Y]=[],f[32767+Y][1]=O,f[32767+Y][0]=A-1+Y;E<<=1,A<<=1}}(),function(){for(var E=0;E<256;E++)j[E]=19595*E,j[E+256|0]=38470*E,j[E+512|0]=7471*E+32768,j[E+768|0]=-11059*E,j[E+1024|0]=-21709*E,j[E+1280|0]=32768*E+8421375,j[E+1536|0]=-27439*E,j[E+1792|0]=-5329*E}(),K(e)}/**
* @license
* Copyright (c) 2017 Aras Abbasi
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/function wu(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 aq(e){function t(P){if(!P)throw Error("assert :P")}function r(P,F,T){for(var k=0;4>k;k++)if(P[F+k]!=T.charCodeAt(k))return!0;return!1}function n(P,F,T,k,V){for(var C=0;C<V;C++)P[F+C]=T[k+C]}function a(P,F,T,k){for(var V=0;V<k;V++)P[F+V]=T}function i(P){return new Int32Array(P)}function o(P,F){for(var T=[],k=0;k<P;k++)T.push(new F);return T}function l(P,F){var T=[];return function k(V,C,R){for(var H=R[C],q=0;q<H&&(V.push(R.length>C+1?[]:new F),!(R.length<C+1));q++)k(V[q],C+1,R)}(T,0,P),T}var c=function(){var P=this;function F(D,B){for(var X=1<<B-1>>>0;D&X;)X>>>=1;return X?(D&X-1)+X:D}function T(D,B,X,Q,de){t(!(Q%X));do D[B+(Q-=X)]=de;while(0<Q)}function k(D,B,X,Q,de){if(t(2328>=de),512>=de)var xe=i(512);else if((xe=i(de))==null)return 0;return function(ye,je,Se,Pe,Ve,nt){var Oe,Ke,Qe=je,ut=1<<Se,tt=i(16),ft=i(16);for(t(Ve!=0),t(Pe!=null),t(ye!=null),t(0<Se),Ke=0;Ke<Ve;++Ke){if(15<Pe[Ke])return 0;++tt[Pe[Ke]]}if(tt[0]==Ve)return 0;for(ft[1]=0,Oe=1;15>Oe;++Oe){if(tt[Oe]>1<<Oe)return 0;ft[Oe+1]=ft[Oe]+tt[Oe]}for(Ke=0;Ke<Ve;++Ke)Oe=Pe[Ke],0<Pe[Ke]&&(nt[ft[Oe]++]=Ke);if(ft[15]==1)return(Pe=new V).g=0,Pe.value=nt[0],T(ye,Qe,1,ut,Pe),ut;var gt,St=-1,wt=ut-1,mr=0,rr=1,an=1,lr=1<<Se;for(Ke=0,Oe=1,Ve=2;Oe<=Se;++Oe,Ve<<=1){if(rr+=an<<=1,0>(an-=tt[Oe]))return 0;for(;0<tt[Oe];--tt[Oe])(Pe=new V).g=Oe,Pe.value=nt[Ke++],T(ye,Qe+mr,Ve,lr,Pe),mr=F(mr,Oe)}for(Oe=Se+1,Ve=2;15>=Oe;++Oe,Ve<<=1){if(rr+=an<<=1,0>(an-=tt[Oe]))return 0;for(;0<tt[Oe];--tt[Oe]){if(Pe=new V,(mr&wt)!=St){for(Qe+=lr,gt=1<<(St=Oe)-Se;15>St&&!(0>=(gt-=tt[St]));)++St,gt<<=1;ut+=lr=1<<(gt=St-Se),ye[je+(St=mr&wt)].g=gt+Se,ye[je+St].value=Qe-je-St}Pe.g=Oe-Se,Pe.value=nt[Ke++],T(ye,Qe+(mr>>Se),Ve,lr,Pe),mr=F(mr,Oe)}}return rr!=2*ft[15]-1?0:ut}(D,B,X,Q,de,xe)}function V(){this.value=this.g=0}function C(){this.value=this.g=0}function R(){this.G=o(5,V),this.H=i(5),this.jc=this.Qb=this.qb=this.nd=0,this.pd=o(Gp,C)}function H(D,B,X,Q){t(D!=null),t(B!=null),t(2147483648>Q),D.Ca=254,D.I=0,D.b=-8,D.Ka=0,D.oa=B,D.pa=X,D.Jd=B,D.Yc=X+Q,D.Zc=4<=Q?X+Q-4+1:X,se(D)}function q(D,B){for(var X=0;0<B--;)X|=ie(D,128)<<B;return X}function L(D,B){var X=q(D,B);return ee(D)?-X:X}function M(D,B,X,Q){var de,xe=0;for(t(D!=null),t(B!=null),t(4294967288>Q),D.Sb=Q,D.Ra=0,D.u=0,D.h=0,4<Q&&(Q=4),de=0;de<Q;++de)xe+=B[X+de]<<8*de;D.Ra=xe,D.bb=Q,D.oa=B,D.pa=X}function z(D){for(;8<=D.u&&D.bb<D.Sb;)D.Ra>>>=8,D.Ra+=D.oa[D.pa+D.bb]<<Dh-8>>>0,++D.bb,D.u-=8;U(D)&&(D.h=1,D.u=0)}function K(D,B){if(t(0<=B),!D.h&&B<=Sl){var X=O(D)&Nl[B];return D.u+=B,z(D),X}return D.h=1,D.u=0}function E(){this.b=this.Ca=this.I=0,this.oa=[],this.pa=0,this.Jd=[],this.Yc=0,this.Zc=[],this.Ka=0}function A(){this.Ra=0,this.oa=[],this.h=this.u=this.bb=this.Sb=this.pa=0}function O(D){return D.Ra>>>(D.u&Dh-1)>>>0}function U(D){return t(D.bb<=D.Sb),D.h||D.bb==D.Sb&&D.u>Dh}function Y(D,B){D.u=B,D.h=U(D)}function J(D){D.u>=_f&&(t(D.u>=_f),z(D))}function se(D){t(D!=null&&D.oa!=null),D.pa<D.Zc?(D.I=(D.oa[D.pa++]|D.I<<8)>>>0,D.b+=8):(t(D!=null&&D.oa!=null),D.pa<D.Yc?(D.b+=8,D.I=D.oa[D.pa++]|D.I<<8):D.Ka?D.b=0:(D.I<<=8,D.b+=8,D.Ka=1))}function ee(D){return q(D,1)}function ie(D,B){var X=D.Ca;0>D.b&&se(D);var Q=D.b,de=X*B>>>8,xe=(D.I>>>Q>de)+0;for(xe?(X-=de,D.I-=de+1<<Q>>>0):X=de+1,Q=X,de=0;256<=Q;)de+=8,Q>>=8;return Q=7^de+Ih[Q],D.b-=Q,D.Ca=(X<<Q)-1,xe}function Ee(D,B,X){D[B+0]=X>>24&255,D[B+1]=X>>16&255,D[B+2]=X>>8&255,D[B+3]=255&X}function te(D,B){return D[B+0]|D[B+1]<<8}function Ue(D,B){return te(D,B)|D[B+2]<<16}function W(D,B){return te(D,B)|te(D,B+2)<<16}function Z(D,B){var X=1<<B;return t(D!=null),t(0<B),D.X=i(X),D.X==null?0:(D.Mb=32-B,D.Xa=B,1)}function le(D,B){t(D!=null),t(B!=null),t(D.Xa==B.Xa),n(B.X,0,D.X,0,1<<B.Xa)}function re(){this.X=[],this.Xa=this.Mb=0}function oe(D,B,X,Q){t(X!=null),t(Q!=null);var de=X[0],xe=Q[0];return de==0&&(de=(D*xe+B/2)/B),xe==0&&(xe=(B*de+D/2)/D),0>=de||0>=xe?0:(X[0]=de,Q[0]=xe,1)}function fe(D,B){return D+(1<<B)-1>>>B}function Fe(D,B){return((4278255360&D)+(4278255360&B)>>>0&4278255360)+((16711935&D)+(16711935&B)>>>0&16711935)>>>0}function ge(D,B){P[B]=function(X,Q,de,xe,ye,je,Se){var Pe;for(Pe=0;Pe<ye;++Pe){var Ve=P[D](je[Se+Pe-1],de,xe+Pe);je[Se+Pe]=Fe(X[Q+Pe],Ve)}}}function pe(){this.ud=this.hd=this.jd=0}function Ie(D,B){return((4278124286&(D^B))>>>1)+(D&B)>>>0}function Ge(D){return 0<=D&&256>D?D:0>D?0:255<D?255:void 0}function we(D,B){return Ge(D+(D-B+.5>>1))}function _e(D,B,X){return Math.abs(B-X)-Math.abs(D-X)}function qe(D,B,X,Q,de,xe,ye){for(Q=xe[ye-1],X=0;X<de;++X)xe[ye+X]=Q=Fe(D[B+X],Q)}function Re(D,B,X,Q,de){var xe;for(xe=0;xe<X;++xe){var ye=D[B+xe],je=ye>>8&255,Se=16711935&(Se=(Se=16711935&ye)+((je<<16)+je));Q[de+xe]=(4278255360&ye)+Se>>>0}}function Me(D,B){B.jd=255&D,B.hd=D>>8&255,B.ud=D>>16&255}function He(D,B,X,Q,de,xe){var ye;for(ye=0;ye<Q;++ye){var je=B[X+ye],Se=je>>>8,Pe=je,Ve=255&(Ve=(Ve=je>>>16)+((D.jd<<24>>24)*(Se<<24>>24)>>>5));Pe=255&(Pe=(Pe+=(D.hd<<24>>24)*(Se<<24>>24)>>>5)+((D.ud<<24>>24)*(Ve<<24>>24)>>>5)),de[xe+ye]=(4278255360&je)+(Ve<<16)+Pe}}function st(D,B,X,Q,de){P[B]=function(xe,ye,je,Se,Pe,Ve,nt,Oe,Ke){for(Se=nt;Se<Oe;++Se)for(nt=0;nt<Ke;++nt)Pe[Ve++]=de(je[Q(xe[ye++])])},P[D]=function(xe,ye,je,Se,Pe,Ve,nt){var Oe=8>>xe.b,Ke=xe.Ea,Qe=xe.K[0],ut=xe.w;if(8>Oe)for(xe=(1<<xe.b)-1,ut=(1<<Oe)-1;ye<je;++ye){var tt,ft=0;for(tt=0;tt<Ke;++tt)tt&xe||(ft=Q(Se[Pe++])),Ve[nt++]=de(Qe[ft&ut]),ft>>=Oe}else P["VP8LMapColor"+X](Se,Pe,Qe,ut,Ve,nt,ye,je,Ke)}}function Zt(D,B,X,Q,de){for(X=B+X;B<X;){var xe=D[B++];Q[de++]=xe>>16&255,Q[de++]=xe>>8&255,Q[de++]=255&xe}}function _t(D,B,X,Q,de){for(X=B+X;B<X;){var xe=D[B++];Q[de++]=xe>>16&255,Q[de++]=xe>>8&255,Q[de++]=255&xe,Q[de++]=xe>>24&255}}function Vt(D,B,X,Q,de){for(X=B+X;B<X;){var xe=(ye=D[B++])>>16&240|ye>>12&15,ye=240&ye|ye>>28&15;Q[de++]=xe,Q[de++]=ye}}function Jt(D,B,X,Q,de){for(X=B+X;B<X;){var xe=(ye=D[B++])>>16&248|ye>>13&7,ye=ye>>5&224|ye>>3&31;Q[de++]=xe,Q[de++]=ye}}function Qt(D,B,X,Q,de){for(X=B+X;B<X;){var xe=D[B++];Q[de++]=255&xe,Q[de++]=xe>>8&255,Q[de++]=xe>>16&255}}function qt(D,B,X,Q,de,xe){if(xe==0)for(X=B+X;B<X;)Ee(Q,((xe=D[B++])[0]>>24|xe[1]>>8&65280|xe[2]<<8&16711680|xe[3]<<24)>>>0),de+=32;else n(Q,de,D,B,X)}function it(D,B){P[B][0]=P[D+"0"],P[B][1]=P[D+"1"],P[B][2]=P[D+"2"],P[B][3]=P[D+"3"],P[B][4]=P[D+"4"],P[B][5]=P[D+"5"],P[B][6]=P[D+"6"],P[B][7]=P[D+"7"],P[B][8]=P[D+"8"],P[B][9]=P[D+"9"],P[B][10]=P[D+"10"],P[B][11]=P[D+"11"],P[B][12]=P[D+"12"],P[B][13]=P[D+"13"],P[B][14]=P[D+"0"],P[B][15]=P[D+"0"]}function It(D){return D==DA||D==IA||D==G_||D==RA}function Mt(){this.eb=[],this.size=this.A=this.fb=0}function wr(){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 $t(){this.Rd=this.height=this.width=this.S=0,this.f={},this.f.RGBA=new Mt,this.f.kb=new wr,this.sd=null}function kt(){this.width=[0],this.height=[0],this.Pd=[0],this.Qd=[0],this.format=[0]}function dr(){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 Kt(D){return alert("todo:WebPSamplerProcessPlane"),D.T}function ir(D,B){var X=D.T,Q=B.ba.f.RGBA,de=Q.eb,xe=Q.fb+D.ka*Q.A,ye=mc[B.ba.S],je=D.y,Se=D.O,Pe=D.f,Ve=D.N,nt=D.ea,Oe=D.W,Ke=B.cc,Qe=B.dc,ut=B.Mc,tt=B.Nc,ft=D.ka,gt=D.ka+D.T,St=D.U,wt=St+1>>1;for(ft==0?ye(je,Se,null,null,Pe,Ve,nt,Oe,Pe,Ve,nt,Oe,de,xe,null,null,St):(ye(B.ec,B.fc,je,Se,Ke,Qe,ut,tt,Pe,Ve,nt,Oe,de,xe-Q.A,de,xe,St),++X);ft+2<gt;ft+=2)Ke=Pe,Qe=Ve,ut=nt,tt=Oe,Ve+=D.Rc,Oe+=D.Rc,xe+=2*Q.A,ye(je,(Se+=2*D.fa)-D.fa,je,Se,Ke,Qe,ut,tt,Pe,Ve,nt,Oe,de,xe-Q.A,de,xe,St);return Se+=D.fa,D.j+gt<D.o?(n(B.ec,B.fc,je,Se,St),n(B.cc,B.dc,Pe,Ve,wt),n(B.Mc,B.Nc,nt,Oe,wt),X--):1>||ye(je,Se,null,null,Pe,Ve,nt,Oe,Pe,Ve,nt,Oe,de,xe+Q.A,null,null,St),X}function jr(D,B,X){var Q=D.F,de=[D.J];if(Q!=null){var xe=D.U,ye=B.ba.S,je=ye==H_||ye==G_;B=B.ba.f.RGBA;var Se=[0],Pe=D.ka;Se[0]=D.T,D.Kb&&(Pe==0?--Se[0]:(--Pe,de[0]-=D.width),D.j+D.ka+D.T==D.o&&(Se[0]=D.o-D.j-Pe));var Ve=B.eb;Pe=B.fb+Pe*B.A,D=L7(Q,de[0],D.width,xe,Se,Ve,Pe+(je?0:3),B.A),t(X==Se),D&&It(ye)&&rb(Ve,Pe,je,xe,Se,B.A)}return 0}function mn(D){var B=D.ma,X=B.ba.S,Q=11>X,de=X==V_||X==W_||X==H_||X==OA||X==12||It(X);if(B.memory=null,B.Ib=null,B.Jb=null,B.Nd=null,!K1(B.Oa,D,de?11:12))return 0;if(de&&It(X)&&W1(),D.da)alert("todo:use_scaling");else{if(Q){if(B.Ib=Kt,D.Kb){if(X=D.U+1>>1,B.memory=i(D.U+2*X),B.memory==null)return 0;B.ec=B.memory,B.fc=0,B.cc=B.ec,B.dc=B.fc+D.U,B.Mc=B.cc,B.Nc=B.dc+X,B.Ib=ir,W1()}}else alert("todo:EmitYUV");de&&(B.Jb=jr,Q&&pu())}if(Q&&!J7){for(D=0;256>D;++D)Spe[D]=89858*(D-128)+Y_>>K_,Epe[D]=-22014*(D-128)+Y_,Cpe[D]=-45773*(D-128),kpe[D]=113618*(D-128)+Y_>>K_;for(D=sb;D<MA;++D)B=76283*(D-16)+Y_>>K_,Ape[D-sb]=La(B,255),Tpe[D-sb]=La(B+8>>4,15);J7=1}return 1}function Ht(D){var B=D.ma,X=D.U,Q=D.T;return t(!(1&D.ka)),0>=X||0>=Q?0:(X=B.Ib(D,B),B.Jb!=null&&B.Jb(D,B,X),B.Dc+=X,1)}function sn(D){D.ma.memory=null}function Bn(D,B,X,Q){return K(D,8)!=47?0:(B[0]=K(D,14)+1,X[0]=K(D,14)+1,Q[0]=K(D,1),K(D,3)!=0?0:!D.h)}function tn(D,B){if(4>D)return D+1;var X=D-2>>1;return(2+(1&D)<<X)+K(B,X)+1}function vn(D,B){return 120<B?B-120:1<=(X=((X=dpe[B-1])>>4)*D+(8-(15&X)))?X:1;var X}function En(D,B,X){var Q=O(X),de=D[B+=255&Q].g-8;return 0<de&&(Y(X,X.u+8),Q=O(X),B+=D[B].value,B+=Q&(1<<de)-1),Y(X,X.u+D[B].g),D[B].value}function Xn(D,B,X){return X.g+=D.g,X.value+=D.value<<B>>>0,t(8>=X.g),D.g}function me(D,B,X){var Q=D.xc;return t((B=Q==0?0:D.vc[D.md*(X>>Q)+(B>>Q)])<D.Wb),D.Ya[B]}function Te(D,B,X,Q){var de=D.ab,xe=D.c*B,ye=D.C;B=ye+B;var je=X,Se=Q;for(Q=D.Ta,X=D.Ua;0<de--;){var Pe=D.gc[de],Ve=ye,nt=B,Oe=je,Ke=Se,Qe=(Se=Q,je=X,Pe.Ea);switch(t(Ve<nt),t(nt<=Pe.nc),Pe.hc){case 2:ja(Oe,Ke,(nt-Ve)*Qe,Se,je);break;case 0:var ut=Ve,tt=nt,ft=Se,gt=je,St=(lr=Pe).Ea;ut==0&&(X1(Oe,Ke,null,null,1,ft,gt),qe(Oe,Ke+1,0,0,St-1,ft,gt+1),Ke+=St,gt+=St,++ut);for(var wt=1<<lr.b,mr=wt-1,rr=fe(St,lr.b),an=lr.K,lr=lr.w+(ut>>lr.b)*rr;ut<tt;){var _n=an,ni=lr,on=1;for(ox(Oe,Ke,ft,gt-St,1,ft,gt);on<St;){var cr=(on&~mr)+wt;cr>St&&(cr=St),(0,J1[_n[ni++]>>8&15])(Oe,Ke+ +on,ft,gt+on-St,cr-on,ft,gt+on),on=cr}Ke+=St,gt+=St,++ut&mr||(lr+=rr)}nt!=Pe.nc&&n(Se,je-Qe,Se,je+(nt-Ve-1)*Qe,Qe);break;case 1:for(Qe=Oe,tt=Ke,St=(Oe=Pe.Ea)-(gt=Oe&~(ft=(Ke=1<<Pe.b)-1)),ut=fe(Oe,Pe.b),wt=Pe.K,Pe=Pe.w+(Ve>>Pe.b)*ut;Ve<nt;){for(mr=wt,rr=Pe,an=new pe,lr=tt+gt,_n=tt+Oe;tt<lr;)Me(mr[rr++],an),Q1(an,Qe,tt,Ke,Se,je),tt+=Ke,je+=Ke;tt<_n&&(Me(mr[rr++],an),Q1(an,Qe,tt,St,Se,je),tt+=St,je+=St),++Ve&ft||(Pe+=ut)}break;case 3:if(Oe==Se&&Ke==je&&0<Pe.b){for(tt=Se,Oe=Qe=je+(nt-Ve)*Qe-(gt=(nt-Ve)*fe(Pe.Ea,Pe.b)),Ke=Se,ft=je,ut=[],gt=(St=gt)-1;0<=gt;--gt)ut[gt]=Ke[ft+gt];for(gt=St-1;0<=gt;--gt)tt[Oe+gt]=ut[gt];B_(Pe,Ve,nt,Se,Qe,Se,je)}else B_(Pe,Ve,nt,Oe,Ke,Se,je)}je=Q,Se=X}Se!=X&&n(Q,X,je,Se,xe)}function Ne(D,B){var X=D.V,Q=D.Ba+D.c*D.C,de=B-D.C;if(t(B<=D.l.o),t(16>=de),0<de){var xe=D.l,ye=D.Ta,je=D.Ua,Se=xe.width;if(Te(D,de,X,Q),de=je=[je],t((X=D.C)<(Q=B)),t(xe.v<xe.va),Q>xe.o&&(Q=xe.o),X<xe.j){var Pe=xe.j-X;X=xe.j,de[0]+=Pe*Se}if(X>=Q?X=0:(de[0]+=4*xe.v,xe.ka=X-xe.j,xe.U=xe.va-xe.v,xe.T=Q-X,X=1),X){if(je=je[0],11>(X=D.ca).S){var Ve=X.f.RGBA,nt=(Q=X.S,de=xe.U,xe=xe.T,Pe=Ve.eb,Ve.A),Oe=xe;for(Ve=Ve.fb+D.Ma*Ve.A;0<Oe--;){var Ke=ye,Qe=je,ut=de,tt=Pe,ft=Ve;switch(Q){case q_:eb(Ke,Qe,ut,tt,ft);break;case V_:Rh(Ke,Qe,ut,tt,ft);break;case DA:Rh(Ke,Qe,ut,tt,ft),rb(tt,ft,0,ut,1,0);break;case q7:Kp(Ke,Qe,ut,tt,ft);break;case W_:qt(Ke,Qe,ut,tt,ft,1);break;case IA:qt(Ke,Qe,ut,tt,ft,1),rb(tt,ft,0,ut,1,0);break;case H_:qt(Ke,Qe,ut,tt,ft,0);break;case G_:qt(Ke,Qe,ut,tt,ft,0),rb(tt,ft,1,ut,1,0);break;case OA:Lh(Ke,Qe,ut,tt,ft);break;case RA:Lh(Ke,Qe,ut,tt,ft),R7(tt,ft,ut,1,0);break;case V7:Fh(Ke,Qe,ut,tt,ft);break;default:t(0)}je+=Se,Ve+=nt}D.Ma+=xe}else alert("todo:EmitRescaledRowsYUVA");t(D.Ma<=X.height)}}D.C=B,t(D.C<=D.i)}function Ce(D){var B;if(0<D.ua)return 0;for(B=0;B<D.Wb;++B){var X=D.Ya[B].G,Q=D.Ya[B].H;if(0<X[1][Q[1]+0].g||0<X[2][Q[2]+0].g||0<X[3][Q[3]+0].g)return 0}return 1}function ue(D,B,X,Q,de,xe){if(D.Z!=0){var ye=D.qd,je=D.rd;for(t(Bh[D.Z]!=null);B<X;++B)Bh[D.Z](ye,je,Q,de,Q,de,xe),ye=Q,je=de,de+=xe;D.qd=ye,D.rd=je}}function ve(D,B){var X=D.l.ma,Q=X.Z==0||X.Z==1?D.l.j:D.C;if(Q=D.C<Q?Q:D.C,t(B<=D.l.o),B>Q){var de=D.l.width,xe=X.ca,ye=X.tb+de*Q,je=D.V,Se=D.Ba+D.c*Q,Pe=D.gc;t(D.ab==1),t(Pe[0].hc==3),pd(Pe[0],Q,B,je,Se,xe,ye),ue(X,Q,B,xe,ye,de)}D.C=D.Ma=B}function $e(D,B,X,Q,de,xe,ye){var je=D.$/Q,Se=D.$%Q,Pe=D.m,Ve=D.s,nt=X+D.$,Oe=nt;de=X+Q*de;var Ke=X+Q*xe,Qe=280+Ve.ua,ut=D.Pb?je:16777216,tt=0<Ve.ua?Ve.Wa:null,ft=Ve.wc,gt=nt<Ke?me(Ve,Se,je):null;t(D.C<xe),t(Ke<=de);var St=!1;e:for(;;){for(;St||nt<Ke;){var wt=0;if(je>=ut){var mr=nt-X;t((ut=D).Pb),ut.wd=ut.m,ut.xd=mr,0<ut.s.ua&&le(ut.s.Wa,ut.s.vb),ut=je+hpe}if(Se&ft||(gt=me(Ve,Se,je)),t(gt!=null),gt.Qb&&(B[nt]=gt.qb,St=!0),!St)if(J(Pe),gt.jc){wt=Pe,mr=B;var rr=nt,an=gt.pd[O(wt)&Gp-1];t(gt.jc),256>an.g?(Y(wt,wt.u+an.g),mr[rr]=an.value,wt=0):(Y(wt,wt.u+an.g-256),t(256<=an.value),wt=an.value),wt==0&&(St=!0)}else wt=En(gt.G[0],gt.H[0],Pe);if(Pe.h)break;if(St||256>wt){if(!St)if(gt.nd)B[nt]=(gt.qb|wt<<8)>>>0;else{if(J(Pe),St=En(gt.G[1],gt.H[1],Pe),J(Pe),mr=En(gt.G[2],gt.H[2],Pe),rr=En(gt.G[3],gt.H[3],Pe),Pe.h)break;B[nt]=(rr<<24|St<<16|wt<<8|mr)>>>0}if(St=!1,++nt,++Se>=Q&&(Se=0,++je,ye!=null&&je<=xe&&!(je%16)&&ye(D,je),tt!=null))for(;Oe<nt;)wt=B[Oe++],tt.X[(506832829*wt&4294967295)>>>tt.Mb]=wt}else if(280>wt){if(wt=tn(wt-256,Pe),mr=En(gt.G[4],gt.H[4],Pe),J(Pe),mr=vn(Q,mr=tn(mr,Pe)),Pe.h)break;if(nt-X<mr||de-nt<wt)break e;for(rr=0;rr<wt;++rr)B[nt+rr]=B[nt+rr-mr];for(nt+=wt,Se+=wt;Se>=Q;)Se-=Q,++je,ye!=null&&je<=xe&&!(je%16)&&ye(D,je);if(t(nt<=de),Se&ft&&(gt=me(Ve,Se,je)),tt!=null)for(;Oe<nt;)wt=B[Oe++],tt.X[(506832829*wt&4294967295)>>>tt.Mb]=wt}else{if(!(wt<Qe))break e;for(St=wt-280,t(tt!=null);Oe<nt;)wt=B[Oe++],tt.X[(506832829*wt&4294967295)>>>tt.Mb]=wt;wt=nt,t(!(St>>>(mr=tt).Xa)),B[wt]=mr.X[St],St=!0}St||t(Pe.h==U(Pe))}if(D.Pb&&Pe.h&&nt<de)t(D.m.h),D.a=5,D.m=D.wd,D.$=D.xd,0<D.s.ua&&le(D.s.vb,D.s.Wa);else{if(Pe.h)break e;ye!=null&&ye(D,je>xe?xe:je),D.a=0,D.$=nt-X}return 1}return D.a=3,0}function et(D){t(D!=null),D.vc=null,D.yc=null,D.Ya=null;var B=D.Wa;B!=null&&(B.X=null),D.vb=null,t(D!=null)}function Xe(){var D=new qr;return D==null?null:(D.a=0,D.xb=G7,it("Predictor","VP8LPredictors"),it("Predictor","VP8LPredictors_C"),it("PredictorAdd","VP8LPredictorsAdd"),it("PredictorAdd","VP8LPredictorsAdd_C"),ja=Re,Q1=He,eb=Zt,Rh=_t,Lh=Vt,Fh=Jt,Kp=Qt,P.VP8LMapColor32b=md,P.VP8LMapColor8b=Z1,D)}function Ze(D,B,X,Q,de){var xe=1,ye=[D],je=[B],Se=Q.m,Pe=Q.s,Ve=null,nt=0;e:for(;;){if(X)for(;xe&&K(Se,1);){var Oe=ye,Ke=je,Qe=Q,ut=1,tt=Qe.m,ft=Qe.gc[Qe.ab],gt=K(tt,2);if(Qe.Oc&1<<gt)xe=0;else{switch(Qe.Oc|=1<<gt,ft.hc=gt,ft.Ea=Oe[0],ft.nc=Ke[0],ft.K=[null],++Qe.ab,t(4>=Qe.ab),gt){case 0:case 1:ft.b=K(tt,3)+2,ut=Ze(fe(ft.Ea,ft.b),fe(ft.nc,ft.b),0,Qe,ft.K),ft.K=ft.K[0];break;case 3:var St,wt=K(tt,8)+1,mr=16<wt?0:4<wt?1:2<wt?2:3;if(Oe[0]=fe(ft.Ea,mr),ft.b=mr,St=ut=Ze(wt,1,0,Qe,ft.K)){var rr,an=wt,lr=ft,_n=1<<(8>>lr.b),ni=i(_n);if(ni==null)St=0;else{var on=lr.K[0],cr=lr.w;for(ni[0]=lr.K[0][0],rr=1;rr<1*an;++rr)ni[rr]=Fe(on[cr+rr],ni[rr-1]);for(;rr<4*_n;++rr)ni[rr]=0;lr.K[0]=null,lr.K[0]=ni,St=1}}ut=St;break;case 2:break;default:t(0)}xe=ut}}if(ye=ye[0],je=je[0],xe&&K(Se,1)&&!(xe=1<=(nt=K(Se,4))&&11>=nt)){Q.a=3;break e}var Bt;if(Bt=xe)t:{var Na,Zr,kn,Ps=Q,$i=ye,So=je,ia=nt,Ji=X,ko=Ps.m,si=Ps.s,Tn=[null],Zn=1,oa=0,Jn=fpe[ia];r:for(;;){if(Ji&&K(ko,1)){var Bi=K(ko,3)+2,xu=fe($i,Bi),Sa=fe(So,Bi),Jo=xu*Sa;if(!Ze(xu,Sa,0,Ps,Tn))break r;for(Tn=Tn[0],si.xc=Bi,Na=0;Na<Jo;++Na){var fs=Tn[Na]>>8&65535;Tn[Na]=fs,fs>=Zn&&(Zn=fs+1)}}if(ko.h)break r;for(Zr=0;5>Zr;++Zr){var ai=W7[Zr];!Zr&&0<ia&&(ai+=1<<ia),oa<ai&&(oa=ai)}var Cl=o(Zn*Jn,V),Co=Zn,El=o(Co,R);if(El==null)var Al=null;else t(65536>=Co),Al=El;var Qo=i(oa);if(Al==null||Qo==null||Cl==null){Ps.a=1;break r}var Tl=Cl;for(Na=kn=0;Na<Zn;++Na){var bs=Al[Na],Pl=bs.G,vu=bs.H,Xp=0,kf=1,zi=0;for(Zr=0;5>Zr;++Zr){ai=W7[Zr],Pl[Zr]=Tl,vu[Zr]=kn,!Zr&&0<ia&&(ai+=1<<ia);s:{var Z_,$A=ai,J_=Ps,ab=Qo,Dpe=Tl,Ipe=kn,BA=0,zh=J_.m,Rpe=K(zh,1);if(a(ab,0,0,$A),Rpe){var Lpe=K(zh,1)+1,Fpe=K(zh,1),t$=K(zh,Fpe==0?1:8);ab[t$]=1,Lpe==2&&(ab[t$=K(zh,8)]=1);var Q_=1}else{var r$=i(19),n$=K(zh,4)+4;if(19<n$){J_.a=3;var eN=0;break s}for(Z_=0;Z_<n$;++Z_)r$[upe[Z_]]=K(zh,3);var zA=void 0,ib=void 0,s$=J_,Mpe=r$,tN=$A,a$=ab,UA=0,Uh=s$.m,i$=8,o$=o(128,V);n:for(;k(o$,0,7,Mpe,19);){if(K(Uh,1)){var $pe=2+2*K(Uh,3);if((zA=2+K(Uh,$pe))>tN)break n}else zA=tN;for(ib=0;ib<tN&&zA--;){J(Uh);var l$=o$[0+(127&O(Uh))];Y(Uh,Uh.u+l$.g);var cx=l$.value;if(16>cx)a$[ib++]=cx,cx!=0&&(i$=cx);else{var Bpe=cx==16,c$=cx-16,zpe=lpe[c$],u$=K(Uh,ope[c$])+zpe;if(ib+u$>tN)break n;for(var Upe=Bpe?i$:0;0<u$--;)a$[ib++]=Upe}}UA=1;break n}UA||(s$.a=3),Q_=UA}(Q_=Q_&&!zh.h)&&(BA=k(Dpe,Ipe,8,ab,$A)),Q_&&BA!=0?eN=BA:(J_.a=3,eN=0)}if(eN==0)break r;if(kf&&cpe[Zr]==1&&(kf=Tl[kn].g==0),Xp+=Tl[kn].g,kn+=eN,3>=Zr){var ob,qA=Qo[0];for(ob=1;ob<ai;++ob)Qo[ob]>qA&&(qA=Qo[ob]);zi+=qA}}if(bs.nd=kf,bs.Qb=0,kf&&(bs.qb=(Pl[3][vu[3]+0].value<<24|Pl[1][vu[1]+0].value<<16|Pl[2][vu[2]+0].value)>>>0,Xp==0&&256>Pl[0][vu[0]+0].value&&(bs.Qb=1,bs.qb+=Pl[0][vu[0]+0].value<<8)),bs.jc=!bs.Qb&&6>zi,bs.jc){var rN,Cf=bs;for(rN=0;rN<Gp;++rN){var qh=rN,Vh=Cf.pd[qh],nN=Cf.G[0][Cf.H[0]+qh];256<=nN.value?(Vh.g=nN.g+256,Vh.value=nN.value):(Vh.g=0,Vh.value=0,qh>>=Xn(nN,8,Vh),qh>>=Xn(Cf.G[1][Cf.H[1]+qh],16,Vh),qh>>=Xn(Cf.G[2][Cf.H[2]+qh],0,Vh),Xn(Cf.G[3][Cf.H[3]+qh],24,Vh))}}}si.vc=Tn,si.Wb=Zn,si.Ya=Al,si.yc=Cl,Bt=1;break t}Bt=0}if(!(xe=Bt)){Q.a=3;break e}if(0<nt){if(Pe.ua=1<<nt,!Z(Pe.Wa,nt)){Q.a=1,xe=0;break e}}else Pe.ua=0;var VA=Q,d$=ye,qpe=je,WA=VA.s,HA=WA.xc;if(VA.c=d$,VA.i=qpe,WA.md=fe(d$,HA),WA.wc=HA==0?-1:(1<<HA)-1,X){Q.xb=bpe;break e}if((Ve=i(ye*je))==null){Q.a=1,xe=0;break e}xe=(xe=$e(Q,Ve,0,ye,je,je,null))&&!Se.h;break e}return xe?(de!=null?de[0]=Ve:(t(Ve==null),t(X)),Q.$=0,X||et(Pe)):et(Pe),xe}function rt(D,B){var X=D.c*D.i,Q=X+B+16*B;return t(D.c<=B),D.V=i(Q),D.V==null?(D.Ta=null,D.Ua=0,D.a=1,0):(D.Ta=D.V,D.Ua=D.Ba+X+B,1)}function Nt(D,B){var X=D.C,Q=B-X,de=D.V,xe=D.Ba+D.c*X;for(t(B<=D.l.o);0<Q;){var ye=16<Q?16:Q,je=D.l.ma,Se=D.l.width,Pe=Se*ye,Ve=je.ca,nt=je.tb+Se*X,Oe=D.Ta,Ke=D.Ua;Te(D,ye,de,xe),F7(Oe,Ke,Ve,nt,Pe),ue(je,X,X+ye,Ve,nt,Se),Q-=ye,de+=ye*D.c,X+=ye}t(X==B),D.C=D.Ma=B}function Rt(){this.ub=this.yd=this.td=this.Rb=0}function Wt(){this.Kd=this.Ld=this.Ud=this.Td=this.i=this.c=0}function Tt(){this.Fb=this.Bb=this.Cb=0,this.Zb=i(4),this.Lb=i(4)}function Ut(){this.Yb=function(){var D=[];return function B(X,Q,de){for(var xe=de[Q],ye=0;ye<xe&&(X.push(de.length>Q+1?[]:0),!(de.length<Q+1));ye++)B(X[ye],Q+1,de)}(D,0,[3,11]),D}()}function Or(){this.jb=i(3),this.Wc=l([4,8],Ut),this.Xc=l([4,17],Ut)}function ls(){this.Pc=this.wb=this.Tb=this.zd=0,this.vd=new i(4),this.od=new i(4)}function yn(){this.ld=this.La=this.dd=this.tc=0}function aa(){this.Na=this.la=0}function ud(){this.Sc=[0,0],this.Eb=[0,0],this.Qc=[0,0],this.ia=this.lc=0}function hu(){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 dd(){this.uc=this.M=this.Nb=0,this.wa=Array(new yn),this.Y=0,this.ya=Array(new hu),this.aa=0,this.l=new ex}function cc(){this.y=i(16),this.f=i(8),this.ea=i(8)}function Ah(){this.cb=this.a=0,this.sc="",this.m=new E,this.Od=new Rt,this.Kc=new Wt,this.ed=new ls,this.Qa=new Tt,this.Ic=this.$c=this.Aa=0,this.D=new dd,this.Xb=this.Va=this.Hb=this.zb=this.yb=this.Ub=this.za=0,this.Jc=o(8,E),this.ia=0,this.pb=o(4,ud),this.Pa=new Or,this.Bd=this.kc=0,this.Ac=[],this.Bc=0,this.zc=[0,0,0,0],this.Gd=Array(new cc),this.Hd=0,this.rb=Array(new aa),this.sb=0,this.wa=Array(new yn),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 hu),this.L=this.aa=0,this.gd=l([4,2],yn),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 La(D,B){return 0>D?0:D>B?B:D}function ex(){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 gA(){var D=new Ah;return D!=null&&(D.a=0,D.sc="OK",D.cb=0,D.Xb=0,nb||(nb=tx)),D}function Fa(D,B,X){return D.a==0&&(D.a=B,D.sc=X,D.cb=0),0}function E_(D,B,X){return 3<=X&&D[B+0]==157&&D[B+1]==1&&D[B+2]==42}function fd(D,B){if(D==null)return 0;if(D.a=0,D.sc="OK",B==null)return Fa(D,2,"null VP8Io passed to VP8GetHeaders()");var X=B.data,Q=B.w,de=B.ha;if(4>de)return Fa(D,7,"Truncated header.");var xe=X[Q+0]|X[Q+1]<<8|X[Q+2]<<16,ye=D.Od;if(ye.Rb=!(1&xe),ye.td=xe>>1&7,ye.yd=xe>>4&1,ye.ub=xe>>5,3<ye.td)return Fa(D,3,"Incorrect keyframe parameters.");if(!ye.yd)return Fa(D,4,"Frame not displayable.");Q+=3,de-=3;var je=D.Kc;if(ye.Rb){if(7>de)return Fa(D,7,"cannot parse picture header");if(!E_(X,Q,de))return Fa(D,3,"Bad code word");je.c=16383&(X[Q+4]<<8|X[Q+3]),je.Td=X[Q+4]>>6,je.i=16383&(X[Q+6]<<8|X[Q+5]),je.Ud=X[Q+6]>>6,Q+=7,de-=7,D.za=je.c+15>>4,D.Ub=je.i+15>>4,B.width=je.c,B.height=je.i,B.Da=0,B.j=0,B.v=0,B.va=B.width,B.o=B.height,B.da=0,B.ib=B.width,B.hb=B.height,B.U=B.width,B.T=B.height,a((xe=D.Pa).jb,0,255,xe.jb.length),t((xe=D.Qa)!=null),xe.Cb=0,xe.Bb=0,xe.Fb=1,a(xe.Zb,0,0,xe.Zb.length),a(xe.Lb,0,0,xe.Lb)}if(ye.ub>de)return Fa(D,7,"bad partition length");H(xe=D.m,X,Q,ye.ub),Q+=ye.ub,de-=ye.ub,ye.Rb&&(je.Ld=ee(xe),je.Kd=ee(xe)),je=D.Qa;var Se,Pe=D.Pa;if(t(xe!=null),t(je!=null),je.Cb=ee(xe),je.Cb){if(je.Bb=ee(xe),ee(xe)){for(je.Fb=ee(xe),Se=0;4>Se;++Se)je.Zb[Se]=ee(xe)?L(xe,7):0;for(Se=0;4>Se;++Se)je.Lb[Se]=ee(xe)?L(xe,6):0}if(je.Bb)for(Se=0;3>Se;++Se)Pe.jb[Se]=ee(xe)?q(xe,8):255}else je.Bb=0;if(xe.Ka)return Fa(D,3,"cannot parse segment header");if((je=D.ed).zd=ee(xe),je.Tb=q(xe,6),je.wb=q(xe,3),je.Pc=ee(xe),je.Pc&&ee(xe)){for(Pe=0;4>Pe;++Pe)ee(xe)&&(je.vd[Pe]=L(xe,6));for(Pe=0;4>Pe;++Pe)ee(xe)&&(je.od[Pe]=L(xe,6))}if(D.L=je.Tb==0?0:je.zd?1:2,xe.Ka)return Fa(D,3,"cannot parse filter header");var Ve=de;if(de=Se=Q,Q=Se+Ve,je=Ve,D.Xb=(1<<q(D.m,2))-1,Ve<3*(Pe=D.Xb))X=7;else{for(Se+=3*Pe,je-=3*Pe,Ve=0;Ve<Pe;++Ve){var nt=X[de+0]|X[de+1]<<8|X[de+2]<<16;nt>je&&(nt=je),H(D.Jc[+Ve],X,Se,nt),Se+=nt,je-=nt,de+=3}H(D.Jc[+Pe],X,Se,je),X=Se<Q?0:5}if(X!=0)return Fa(D,X,"cannot parse partitions");for(X=q(Se=D.m,7),de=ee(Se)?L(Se,4):0,Q=ee(Se)?L(Se,4):0,je=ee(Se)?L(Se,4):0,Pe=ee(Se)?L(Se,4):0,Se=ee(Se)?L(Se,4):0,Ve=D.Qa,nt=0;4>nt;++nt){if(Ve.Cb){var Oe=Ve.Zb[nt];Ve.Fb||(Oe+=X)}else{if(0<nt){D.pb[nt]=D.pb[0];continue}Oe=X}var Ke=D.pb[nt];Ke.Sc[0]=LA[La(Oe+de,127)],Ke.Sc[1]=FA[La(Oe+0,127)],Ke.Eb[0]=2*LA[La(Oe+Q,127)],Ke.Eb[1]=101581*FA[La(Oe+je,127)]>>16,8>Ke.Eb[1]&&(Ke.Eb[1]=8),Ke.Qc[0]=LA[La(Oe+Pe,117)],Ke.Qc[1]=FA[La(Oe+Se,127)],Ke.lc=Oe+Se}if(!ye.Rb)return Fa(D,4,"Not a key frame.");for(ee(xe),ye=D.Pa,X=0;4>X;++X){for(de=0;8>de;++de)for(Q=0;3>Q;++Q)for(je=0;11>je;++je)Pe=ie(xe,vpe[X][de][Q][je])?q(xe,8):gpe[X][de][Q][je],ye.Wc[X][de].Yb[Q][je]=Pe;for(de=0;17>de;++de)ye.Xc[X][de]=ye.Wc[X][ype[de]]}return D.kc=ee(xe),D.kc&&(D.Bd=q(xe,8)),D.cb=1}function tx(D,B,X,Q,de,xe,ye){var je=B[de].Yb[X];for(X=0;16>de;++de){if(!ie(D,je[X+0]))return de;for(;!ie(D,je[X+1]);)if(je=B[++de].Yb[0],X=0,de==16)return 16;var Se=B[de+1].Yb;if(ie(D,je[X+2])){var Pe=D,Ve=0;if(ie(Pe,(Oe=je)[(nt=X)+3]))if(ie(Pe,Oe[nt+6])){for(je=0,nt=2*(Ve=ie(Pe,Oe[nt+8]))+(Oe=ie(Pe,Oe[nt+9+Ve])),Ve=0,Oe=mpe[nt];Oe[je];++je)Ve+=Ve+ie(Pe,Oe[je]);Ve+=3+(8<<nt)}else ie(Pe,Oe[nt+7])?(Ve=7+2*ie(Pe,165),Ve+=ie(Pe,145)):Ve=5+ie(Pe,159);else Ve=ie(Pe,Oe[nt+4])?3+ie(Pe,Oe[nt+5]):2;je=Se[2]}else Ve=1,je=Se[1];Se=ye+ppe[de],0>(Pe=D).b&&se(Pe);var nt,Oe=Pe.b,Ke=(nt=Pe.Ca>>1)-(Pe.I>>Oe)>>31;--Pe.b,Pe.Ca+=Ke,Pe.Ca|=1,Pe.I-=(nt+1&Ke)<<Oe,xe[Se]=((Ve^Ke)-Ke)*Q[(0<de)+0]}return 16}function A_(D){var B=D.rb[D.sb-1];B.la=0,B.Na=0,a(D.zc,0,0,D.zc.length),D.ja=0}function uc(D,B,X,Q,de){de=D[B+X+32*Q]+(de>>3),D[B+X+32*Q]=-256&de?0>de?0:255:de}function ei(D,B,X,Q,de,xe){uc(D,B,0,X,Q+de),uc(D,B,1,X,Q+xe),uc(D,B,2,X,Q-xe),uc(D,B,3,X,Q-de)}function hf(D){return(20091*D>>16)+D}function T_(D,B,X,Q){var de,xe=0,ye=i(16);for(de=0;4>de;++de){var je=D[B+0]+D[B+8],Se=D[B+0]-D[B+8],Pe=(35468*D[B+4]>>16)-hf(D[B+12]),Ve=hf(D[B+4])+(35468*D[B+12]>>16);ye[xe+0]=je+Ve,ye[xe+1]=Se+Pe,ye[xe+2]=Se-Pe,ye[xe+3]=je-Ve,xe+=4,B++}for(de=xe=0;4>de;++de)je=(D=ye[xe+0]+4)+ye[xe+8],Se=D-ye[xe+8],Pe=(35468*ye[xe+4]>>16)-hf(ye[xe+12]),uc(X,Q,0,0,je+(Ve=hf(ye[xe+4])+(35468*ye[xe+12]>>16))),uc(X,Q,1,0,Se+Pe),uc(X,Q,2,0,Se-Pe),uc(X,Q,3,0,je-Ve),xe++,Q+=32}function xA(D,B,X,Q){var de=D[B+0]+4,xe=35468*D[B+4]>>16,ye=hf(D[B+4]),je=35468*D[B+1]>>16;ei(X,Q,0,de+ye,D=hf(D[B+1]),je),ei(X,Q,1,de+xe,D,je),ei(X,Q,2,de-xe,D,je),ei(X,Q,3,de-ye,D,je)}function vA(D,B,X,Q,de){T_(D,B,X,Q),de&&T_(D,B+16,X,Q+4)}function hd(D,B,X,Q){Yp(D,B+0,X,Q,1),Yp(D,B+32,X,Q+128,1)}function P_(D,B,X,Q){var de;for(D=D[B+0]+4,de=0;4>de;++de)for(B=0;4>B;++B)uc(X,Q,B,de,D)}function O_(D,B,X,Q){D[B+0]&&Vn(D,B+0,X,Q),D[B+16]&&Vn(D,B+16,X,Q+4),D[B+32]&&Vn(D,B+32,X,Q+128),D[B+48]&&Vn(D,B+48,X,Q+128+4)}function rx(D,B,X,Q){var de,xe=i(16);for(de=0;4>de;++de){var ye=D[B+0+de]+D[B+12+de],je=D[B+4+de]+D[B+8+de],Se=D[B+4+de]-D[B+8+de],Pe=D[B+0+de]-D[B+12+de];xe[0+de]=ye+je,xe[8+de]=ye-je,xe[4+de]=Pe+Se,xe[12+de]=Pe-Se}for(de=0;4>de;++de)ye=(D=xe[0+4*de]+3)+xe[3+4*de],je=xe[1+4*de]+xe[2+4*de],Se=xe[1+4*de]-xe[2+4*de],Pe=D-xe[3+4*de],X[Q+0]=ye+je>>3,X[Q+16]=Pe+Se>>3,X[Q+32]=ye-je>>3,X[Q+48]=Pe-Se>>3,Q+=64}function Fp(D,B,X){var Q,de=B-32,xe=kl,ye=255-D[de-1];for(Q=0;Q<X;++Q){var je,Se=xe,Pe=ye+D[B-1];for(je=0;je<X;++je)D[B+je]=Se[Pe+D[de+je]];B+=32}}function yA(D,B){Fp(D,B,4)}function bA(D,B){Fp(D,B,8)}function wA(D,B){Fp(D,B,16)}function F1(D,B){var X;for(X=0;16>X;++X)n(D,B+32*X,D,B-32,16)}function D_(D,B){var X;for(X=16;0<X;--X)a(D,B,D[B-1],16),B+=32}function mu(D,B,X){var Q;for(Q=0;16>Q;++Q)a(B,X+32*Q,D,16)}function jA(D,B){var X,Q=16;for(X=0;16>X;++X)Q+=D[B-1+32*X]+D[B+X-32];mu(Q>>5,D,B)}function Mp(D,B){var X,Q=8;for(X=0;16>X;++X)Q+=D[B-1+32*X];mu(Q>>4,D,B)}function M1(D,B){var X,Q=8;for(X=0;16>X;++X)Q+=D[B+X-32];mu(Q>>4,D,B)}function _A(D,B){mu(128,D,B)}function Hr(D,B,X){return D+2*B+X+2>>2}function NA(D,B){var X,Q=B-32;for(Q=new Uint8Array([Hr(D[Q-1],D[Q+0],D[Q+1]),Hr(D[Q+0],D[Q+1],D[Q+2]),Hr(D[Q+1],D[Q+2],D[Q+3]),Hr(D[Q+2],D[Q+3],D[Q+4])]),X=0;4>X;++X)n(D,B+32*X,Q,0,Q.length)}function SA(D,B){var X=D[B-1],Q=D[B-1+32],de=D[B-1+64],xe=D[B-1+96];Ee(D,B+0,16843009*Hr(D[B-1-32],X,Q)),Ee(D,B+32,16843009*Hr(X,Q,de)),Ee(D,B+64,16843009*Hr(Q,de,xe)),Ee(D,B+96,16843009*Hr(de,xe,xe))}function kA(D,B){var X,Q=4;for(X=0;4>X;++X)Q+=D[B+X-32]+D[B-1+32*X];for(Q>>=3,X=0;4>X;++X)a(D,B+32*X,Q,4)}function mf(D,B){var X=D[B-1+0],Q=D[B-1+32],de=D[B-1+64],xe=D[B-1-32],ye=D[B+0-32],je=D[B+1-32],Se=D[B+2-32],Pe=D[B+3-32];D[B+0+96]=Hr(Q,de,D[B-1+96]),D[B+1+96]=D[B+0+64]=Hr(X,Q,de),D[B+2+96]=D[B+1+64]=D[B+0+32]=Hr(xe,X,Q),D[B+3+96]=D[B+2+64]=D[B+1+32]=D[B+0+0]=Hr(ye,xe,X),D[B+3+64]=D[B+2+32]=D[B+1+0]=Hr(je,ye,xe),D[B+3+32]=D[B+2+0]=Hr(Se,je,ye),D[B+3+0]=Hr(Pe,Se,je)}function pf(D,B){var X=D[B+1-32],Q=D[B+2-32],de=D[B+3-32],xe=D[B+4-32],ye=D[B+5-32],je=D[B+6-32],Se=D[B+7-32];D[B+0+0]=Hr(D[B+0-32],X,Q),D[B+1+0]=D[B+0+32]=Hr(X,Q,de),D[B+2+0]=D[B+1+32]=D[B+0+64]=Hr(Q,de,xe),D[B+3+0]=D[B+2+32]=D[B+1+64]=D[B+0+96]=Hr(de,xe,ye),D[B+3+32]=D[B+2+64]=D[B+1+96]=Hr(xe,ye,je),D[B+3+64]=D[B+2+96]=Hr(ye,je,Se),D[B+3+96]=Hr(je,Se,Se)}function CA(D,B){var X=D[B-1+0],Q=D[B-1+32],de=D[B-1+64],xe=D[B-1-32],ye=D[B+0-32],je=D[B+1-32],Se=D[B+2-32],Pe=D[B+3-32];D[B+0+0]=D[B+1+64]=xe+ye+1>>1,D[B+1+0]=D[B+2+64]=ye+je+1>>1,D[B+2+0]=D[B+3+64]=je+Se+1>>1,D[B+3+0]=Se+Pe+1>>1,D[B+0+96]=Hr(de,Q,X),D[B+0+64]=Hr(Q,X,xe),D[B+0+32]=D[B+1+96]=Hr(X,xe,ye),D[B+1+32]=D[B+2+96]=Hr(xe,ye,je),D[B+2+32]=D[B+3+96]=Hr(ye,je,Se),D[B+3+32]=Hr(je,Se,Pe)}function EA(D,B){var X=D[B+0-32],Q=D[B+1-32],de=D[B+2-32],xe=D[B+3-32],ye=D[B+4-32],je=D[B+5-32],Se=D[B+6-32],Pe=D[B+7-32];D[B+0+0]=X+Q+1>>1,D[B+1+0]=D[B+0+64]=Q+de+1>>1,D[B+2+0]=D[B+1+64]=de+xe+1>>1,D[B+3+0]=D[B+2+64]=xe+ye+1>>1,D[B+0+32]=Hr(X,Q,de),D[B+1+32]=D[B+0+96]=Hr(Q,de,xe),D[B+2+32]=D[B+1+96]=Hr(de,xe,ye),D[B+3+32]=D[B+2+96]=Hr(xe,ye,je),D[B+3+64]=Hr(ye,je,Se),D[B+3+96]=Hr(je,Se,Pe)}function nx(D,B){var X=D[B-1+0],Q=D[B-1+32],de=D[B-1+64],xe=D[B-1+96];D[B+0+0]=X+Q+1>>1,D[B+2+0]=D[B+0+32]=Q+de+1>>1,D[B+2+32]=D[B+0+64]=de+xe+1>>1,D[B+1+0]=Hr(X,Q,de),D[B+3+0]=D[B+1+32]=Hr(Q,de,xe),D[B+3+32]=D[B+1+64]=Hr(de,xe,xe),D[B+3+64]=D[B+2+64]=D[B+0+96]=D[B+1+96]=D[B+2+96]=D[B+3+96]=xe}function $1(D,B){var X=D[B-1+0],Q=D[B-1+32],de=D[B-1+64],xe=D[B-1+96],ye=D[B-1-32],je=D[B+0-32],Se=D[B+1-32],Pe=D[B+2-32];D[B+0+0]=D[B+2+32]=X+ye+1>>1,D[B+0+32]=D[B+2+64]=Q+X+1>>1,D[B+0+64]=D[B+2+96]=de+Q+1>>1,D[B+0+96]=xe+de+1>>1,D[B+3+0]=Hr(je,Se,Pe),D[B+2+0]=Hr(ye,je,Se),D[B+1+0]=D[B+3+32]=Hr(X,ye,je),D[B+1+32]=D[B+3+64]=Hr(Q,X,ye),D[B+1+64]=D[B+3+96]=Hr(de,Q,X),D[B+1+96]=Hr(xe,de,Q)}function $p(D,B){var X;for(X=0;8>X;++X)n(D,B+32*X,D,B-32,8)}function AA(D,B){var X;for(X=0;8>X;++X)a(D,B,D[B-1],8),B+=32}function gf(D,B,X){var Q;for(Q=0;8>Q;++Q)a(B,X+32*Q,D,8)}function TA(D,B){var X,Q=8;for(X=0;8>X;++X)Q+=D[B+X-32]+D[B-1+32*X];gf(Q>>4,D,B)}function B1(D,B){var X,Q=4;for(X=0;8>X;++X)Q+=D[B+X-32];gf(Q>>3,D,B)}function z1(D,B){var X,Q=4;for(X=0;8>X;++X)Q+=D[B-1+32*X];gf(Q>>3,D,B)}function I_(D,B){gf(128,D,B)}function xf(D,B,X){var Q=D[B-X],de=D[B+0],xe=3*(de-Q)+PA[1020+D[B-2*X]-D[B+X]],ye=U_[112+(xe+4>>3)];D[B-X]=kl[255+Q+U_[112+(xe+3>>3)]],D[B+0]=kl[255+de-ye]}function U1(D,B,X,Q){var de=D[B+0],xe=D[B+X];return hc[255+D[B-2*X]-D[B-X]]>Q||hc[255+xe-de]>Q}function sx(D,B,X,Q){return 4*hc[255+D[B-X]-D[B+0]]+hc[255+D[B-2*X]-D[B+X]]<=Q}function q1(D,B,X,Q,de){var xe=D[B-3*X],ye=D[B-2*X],je=D[B-X],Se=D[B+0],Pe=D[B+X],Ve=D[B+2*X],nt=D[B+3*X];return 4*hc[255+je-Se]+hc[255+ye-Pe]>Q?0:hc[255+D[B-4*X]-xe]<=de&&hc[255+xe-ye]<=de&&hc[255+ye-je]<=de&&hc[255+nt-Ve]<=de&&hc[255+Ve-Pe]<=de&&hc[255+Pe-Se]<=de}function Bp(D,B,X,Q){var de=2*Q+1;for(Q=0;16>Q;++Q)sx(D,B+Q,X,de)&&xf(D,B+Q,X)}function V1(D,B,X,Q){var de=2*Q+1;for(Q=0;16>Q;++Q)sx(D,B+Q*X,1,de)&&xf(D,B+Q*X,1)}function R_(D,B,X,Q){var de;for(de=3;0<de;--de)Bp(D,B+=4*X,X,Q)}function L_(D,B,X,Q){var de;for(de=3;0<de;--de)V1(D,B+=4,X,Q)}function vf(D,B,X,Q,de,xe,ye,je){for(xe=2*xe+1;0<de--;){if(q1(D,B,X,xe,ye))if(U1(D,B,X,je))xf(D,B,X);else{var Se=D,Pe=B,Ve=X,nt=Se[Pe-2*Ve],Oe=Se[Pe-Ve],Ke=Se[Pe+0],Qe=Se[Pe+Ve],ut=Se[Pe+2*Ve],tt=27*(gt=PA[1020+3*(Ke-Oe)+PA[1020+nt-Qe]])+63>>7,ft=18*gt+63>>7,gt=9*gt+63>>7;Se[Pe-3*Ve]=kl[255+Se[Pe-3*Ve]+gt],Se[Pe-2*Ve]=kl[255+nt+ft],Se[Pe-Ve]=kl[255+Oe+tt],Se[Pe+0]=kl[255+Ke-tt],Se[Pe+Ve]=kl[255+Qe-ft],Se[Pe+2*Ve]=kl[255+ut-gt]}B+=Q}}function yf(D,B,X,Q,de,xe,ye,je){for(xe=2*xe+1;0<de--;){if(q1(D,B,X,xe,ye))if(U1(D,B,X,je))xf(D,B,X);else{var Se=D,Pe=B,Ve=X,nt=Se[Pe-Ve],Oe=Se[Pe+0],Ke=Se[Pe+Ve],Qe=U_[112+(4+(ut=3*(Oe-nt))>>3)],ut=U_[112+(ut+3>>3)],tt=Qe+1>>1;Se[Pe-2*Ve]=kl[255+Se[Pe-2*Ve]+tt],Se[Pe-Ve]=kl[255+nt+ut],Se[Pe+0]=kl[255+Oe-Qe],Se[Pe+Ve]=kl[255+Ke-tt]}B+=Q}}function F_(D,B,X,Q,de,xe){vf(D,B,X,1,16,Q,de,xe)}function zp(D,B,X,Q,de,xe){vf(D,B,1,X,16,Q,de,xe)}function M_(D,B,X,Q,de,xe){var ye;for(ye=3;0<ye;--ye)yf(D,B+=4*X,X,1,16,Q,de,xe)}function G(D,B,X,Q,de,xe){var ye;for(ye=3;0<ye;--ye)yf(D,B+=4,1,X,16,Q,de,xe)}function ce(D,B,X,Q,de,xe,ye,je){vf(D,B,de,1,8,xe,ye,je),vf(X,Q,de,1,8,xe,ye,je)}function De(D,B,X,Q,de,xe,ye,je){vf(D,B,1,de,8,xe,ye,je),vf(X,Q,1,de,8,xe,ye,je)}function Be(D,B,X,Q,de,xe,ye,je){yf(D,B+4*de,de,1,8,xe,ye,je),yf(X,Q+4*de,de,1,8,xe,ye,je)}function Je(D,B,X,Q,de,xe,ye,je){yf(D,B+4,1,de,8,xe,ye,je),yf(X,Q+4,1,de,8,xe,ye,je)}function mt(){this.ba=new $t,this.ec=[],this.cc=[],this.Mc=[],this.Dc=this.Nc=this.dc=this.fc=0,this.Oa=new dr,this.memory=0,this.Ib="OutputFunc",this.Jb="OutputAlphaFunc",this.Nd="OutputRowFunc"}function bt(){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 ar(){this.nc=this.Ea=this.b=this.hc=0,this.K=[],this.w=0}function hr(){this.ua=0,this.Wa=new re,this.vb=new re,this.md=this.xc=this.wc=0,this.vc=[],this.Wb=0,this.Ya=new R,this.yc=new V}function qr(){this.xb=this.a=0,this.l=new ex,this.ca=new $t,this.V=[],this.Ba=0,this.Ta=[],this.Ua=0,this.m=new A,this.Pb=0,this.wd=new A,this.Ma=this.$=this.C=this.i=this.c=this.xd=0,this.s=new hr,this.ab=0,this.gc=o(4,ar),this.Oc=0}function rn(){this.Lc=this.Z=this.$a=this.i=this.c=0,this.l=new ex,this.ic=0,this.ca=[],this.tb=0,this.qd=null,this.rd=0}function An(D,B,X,Q,de,xe,ye){for(D=D==null?0:D[B+0],B=0;B<ye;++B)de[xe+B]=D+X[Q+B]&255,D=de[xe+B]}function Ys(D,B,X,Q,de,xe,ye){var je;if(D==null)An(null,null,X,Q,de,xe,ye);else for(je=0;je<ye;++je)de[xe+je]=D[B+je]+X[Q+je]&255}function Ma(D,B,X,Q,de,xe,ye){if(D==null)An(null,null,X,Q,de,xe,ye);else{var je,Se=D[B+0],Pe=Se,Ve=Se;for(je=0;je<ye;++je)Pe=Ve+(Se=D[B+je])-Pe,Ve=X[Q+je]+(-256&Pe?0>Pe?0:255:Pe)&255,Pe=Se,de[xe+je]=Ve}}function ys(D,B,X,Q){var de=B.width,xe=B.o;if(t(D!=null&&B!=null),0>X||0>=Q||X+Q>xe)return null;if(!D.Cc){if(D.ga==null){var ye;if(D.ga=new rn,(ye=D.ga==null)||(ye=B.width*B.o,t(D.Gb.length==0),D.Gb=i(ye),D.Uc=0,D.Gb==null?ye=0:(D.mb=D.Gb,D.nb=D.Uc,D.rc=null,ye=1),ye=!ye),!ye){ye=D.ga;var je=D.Fa,Se=D.P,Pe=D.qc,Ve=D.mb,nt=D.nb,Oe=Se+1,Ke=Pe-1,Qe=ye.l;if(t(je!=null&&Ve!=null&&B!=null),Bh[0]=null,Bh[1]=An,Bh[2]=Ys,Bh[3]=Ma,ye.ca=Ve,ye.tb=nt,ye.c=B.width,ye.i=B.height,t(0<ye.c&&0<ye.i),1>=Pe)B=0;else if(ye.$a=3&je[Se+0],ye.Z=je[Se+0]>>2&3,ye.Lc=je[Se+0]>>4&3,Se=je[Se+0]>>6&3,0>ye.$a||1<ye.$a||4<=ye.Z||1<ye.Lc||Se)B=0;else if(Qe.put=Ht,Qe.ac=mn,Qe.bc=sn,Qe.ma=ye,Qe.width=B.width,Qe.height=B.height,Qe.Da=B.Da,Qe.v=B.v,Qe.va=B.va,Qe.j=B.j,Qe.o=B.o,ye.$a)e:{t(ye.$a==1),B=Xe();t:for(;;){if(B==null){B=0;break e}if(t(ye!=null),ye.mc=B,B.c=ye.c,B.i=ye.i,B.l=ye.l,B.l.ma=ye,B.l.width=ye.c,B.l.height=ye.i,B.a=0,M(B.m,je,Oe,Ke),!Ze(ye.c,ye.i,1,B,null)||(B.ab==1&&B.gc[0].hc==3&&Ce(B.s)?(ye.ic=1,je=B.c*B.i,B.Ta=null,B.Ua=0,B.V=i(je),B.Ba=0,B.V==null?(B.a=1,B=0):B=1):(ye.ic=0,B=rt(B,ye.c)),!B))break t;B=1;break e}ye.mc=null,B=0}else B=Ke>=ye.c*ye.i;ye=!B}if(ye)return null;D.ga.Lc!=1?D.Ga=0:Q=xe-X}t(D.ga!=null),t(X+Q<=xe);e:{if(B=(je=D.ga).c,xe=je.l.o,je.$a==0){if(Oe=D.rc,Ke=D.Vc,Qe=D.Fa,Se=D.P+1+X*B,Pe=D.mb,Ve=D.nb+X*B,t(Se<=D.P+D.qc),je.Z!=0)for(t(Bh[je.Z]!=null),ye=0;ye<Q;++ye)Bh[je.Z](Oe,Ke,Qe,Se,Pe,Ve,B),Oe=Pe,Ke=Ve,Ve+=B,Se+=B;else for(ye=0;ye<Q;++ye)n(Pe,Ve,Qe,Se,B),Oe=Pe,Ke=Ve,Ve+=B,Se+=B;D.rc=Oe,D.Vc=Ke}else{if(t(je.mc!=null),B=X+Q,t((ye=je.mc)!=null),t(B<=ye.i),ye.C>=B)B=1;else if(je.ic||pu(),je.ic){je=ye.V,Oe=ye.Ba,Ke=ye.c;var ut=ye.i,tt=(Qe=1,Se=ye.$/Ke,Pe=ye.$%Ke,Ve=ye.m,nt=ye.s,ye.$),ft=Ke*ut,gt=Ke*B,St=nt.wc,wt=tt<gt?me(nt,Pe,Se):null;t(tt<=ft),t(B<=ut),t(Ce(nt));t:for(;;){for(;!Ve.h&&tt<gt;){if(Pe&St||(wt=me(nt,Pe,Se)),t(wt!=null),J(Ve),256>(ut=En(wt.G[0],wt.H[0],Ve)))je[Oe+tt]=ut,++tt,++Pe>=Ke&&(Pe=0,++Se<=B&&!(Se%16)&&ve(ye,Se));else{if(!(280>ut)){Qe=0;break t}ut=tn(ut-256,Ve);var mr,rr=En(wt.G[4],wt.H[4],Ve);if(J(Ve),!(tt>=(rr=vn(Ke,rr=tn(rr,Ve)))&&ft-tt>=ut)){Qe=0;break t}for(mr=0;mr<ut;++mr)je[Oe+tt+mr]=je[Oe+tt+mr-rr];for(tt+=ut,Pe+=ut;Pe>=Ke;)Pe-=Ke,++Se<=B&&!(Se%16)&&ve(ye,Se);tt<gt&&Pe&St&&(wt=me(nt,Pe,Se))}t(Ve.h==U(Ve))}ve(ye,Se>B?B:Se);break t}!Qe||Ve.h&&tt<ft?(Qe=0,ye.a=Ve.h?5:3):ye.$=tt,B=Qe}else B=$e(ye,ye.V,ye.Ba,ye.c,ye.i,B,Nt);if(!B){Q=0;break e}}X+Q>=xe&&(D.Cc=1),Q=1}if(!Q)return null;if(D.Cc&&((Q=D.ga)!=null&&(Q.mc=null),D.ga=null,0<D.Ga))return alert("todo:WebPDequantizeLevels"),null}return D.nb+X*de}function ti(D,B,X,Q,de,xe){for(;0<de--;){var ye,je=D,Se=B+(X?1:0),Pe=D,Ve=B+(X?0:3);for(ye=0;ye<Q;++ye){var nt=Pe[Ve+4*ye];nt!=255&&(nt*=32897,je[Se+4*ye+0]=je[Se+4*ye+0]*nt>>23,je[Se+4*ye+1]=je[Se+4*ye+1]*nt>>23,je[Se+4*ye+2]=je[Se+4*ye+2]*nt>>23)}B+=xe}}function $a(D,B,X,Q,de){for(;0<Q--;){var xe;for(xe=0;xe<X;++xe){var ye=D[B+2*xe+0],je=15&(Pe=D[B+2*xe+1]),Se=4369*je,Pe=(240&Pe|Pe>>4)*Se>>16;D[B+2*xe+0]=(240&ye|ye>>4)*Se>>16&240|(15&ye|ye<<4)*Se>>16>>4&15,D[B+2*xe+1]=240&Pe|je}B+=de}}function Fi(D,B,X,Q,de,xe,ye,je){var Se,Pe,Ve=255;for(Pe=0;Pe<de;++Pe){for(Se=0;Se<Q;++Se){var nt=D[B+Se];xe[ye+4*Se]=nt,Ve&=nt}B+=X,ye+=je}return Ve!=255}function bf(D,B,X,Q,de){var xe;for(xe=0;xe<de;++xe)X[Q+xe]=D[B+xe]>>8}function pu(){rb=ti,R7=$a,L7=Fi,F7=bf}function wf(D,B,X){P[D]=function(Q,de,xe,ye,je,Se,Pe,Ve,nt,Oe,Ke,Qe,ut,tt,ft,gt,St){var wt,mr=St-1>>1,rr=je[Se+0]|Pe[Ve+0]<<16,an=nt[Oe+0]|Ke[Qe+0]<<16;t(Q!=null);var lr=3*rr+an+131074>>2;for(B(Q[de+0],255&lr,lr>>16,ut,tt),xe!=null&&(lr=3*an+rr+131074>>2,B(xe[ye+0],255&lr,lr>>16,ft,gt)),wt=1;wt<=mr;++wt){var _n=je[Se+wt]|Pe[Ve+wt]<<16,ni=nt[Oe+wt]|Ke[Qe+wt]<<16,on=rr+_n+an+ni+524296,cr=on+2*(_n+an)>>3;lr=cr+rr>>1,rr=(on=on+2*(rr+ni)>>3)+_n>>1,B(Q[de+2*wt-1],255&lr,lr>>16,ut,tt+(2*wt-1)*X),B(Q[de+2*wt-0],255&rr,rr>>16,ut,tt+(2*wt-0)*X),xe!=null&&(lr=on+an>>1,rr=cr+ni>>1,B(xe[ye+2*wt-1],255&lr,lr>>16,ft,gt+(2*wt-1)*X),B(xe[ye+2*wt+0],255&rr,rr>>16,ft,gt+(2*wt+0)*X)),rr=_n,an=ni}1&St||(lr=3*rr+an+131074>>2,B(Q[de+St-1],255&lr,lr>>16,ut,tt+(St-1)*X),xe!=null&&(lr=3*an+rr+131074>>2,B(xe[ye+St-1],255&lr,lr>>16,ft,gt+(St-1)*X)))}}function W1(){mc[q_]=wpe,mc[V_]=K7,mc[q7]=jpe,mc[W_]=Y7,mc[H_]=X7,mc[OA]=Z7,mc[V7]=_pe,mc[DA]=K7,mc[IA]=Y7,mc[G_]=X7,mc[RA]=Z7}function ax(D){return D&-16384?0>D?0:255:D>>Npe}function Th(D,B){return ax((19077*D>>8)+(26149*B>>8)-14234)}function Up(D,B,X){return ax((19077*D>>8)-(6419*B>>8)-(13320*X>>8)+8708)}function qp(D,B){return ax((19077*D>>8)+(33050*B>>8)-17685)}function Ph(D,B,X,Q,de){Q[de+0]=Th(D,X),Q[de+1]=Up(D,B,X),Q[de+2]=qp(D,B)}function Mi(D,B,X,Q,de){Q[de+0]=qp(D,B),Q[de+1]=Up(D,B,X),Q[de+2]=Th(D,X)}function Vp(D,B,X,Q,de){var xe=Up(D,B,X);B=xe<<3&224|qp(D,B)>>3,Q[de+0]=248&Th(D,X)|xe>>5,Q[de+1]=B}function Wp(D,B,X,Q,de){var xe=240&qp(D,B)|15;Q[de+0]=240&Th(D,X)|Up(D,B,X)>>4,Q[de+1]=xe}function H1(D,B,X,Q,de){Q[de+0]=255,Ph(D,B,X,Q,de+1)}function G1(D,B,X,Q,de){Mi(D,B,X,Q,de),Q[de+3]=255}function No(D,B,X,Q,de){Ph(D,B,X,Q,de),Q[de+3]=255}function jf(D,B,X){P[D]=function(Q,de,xe,ye,je,Se,Pe,Ve,nt){for(var Oe=Ve+(-2&nt)*X;Ve!=Oe;)B(Q[de+0],xe[ye+0],je[Se+0],Pe,Ve),B(Q[de+1],xe[ye+0],je[Se+0],Pe,Ve+X),de+=2,++ye,++Se,Ve+=2*X;1&nt&&B(Q[de+0],xe[ye+0],je[Se+0],Pe,Ve)}}function ix(D,B,X){return X==0?D==0?B==0?6:5:B==0?4:0:X}function $_(D,B,X,Q,de){switch(D>>>30){case 3:Yp(B,X,Q,de,0);break;case 2:fc(B,X,Q,de);break;case 1:Vn(B,X,Q,de)}}function dc(D,B){var X,Q,de=B.M,xe=B.Nb,ye=D.oc,je=D.pc+40,Se=D.oc,Pe=D.pc+584,Ve=D.oc,nt=D.pc+600;for(X=0;16>X;++X)ye[je+32*X-1]=129;for(X=0;8>X;++X)Se[Pe+32*X-1]=129,Ve[nt+32*X-1]=129;for(0<de?ye[je-1-32]=Se[Pe-1-32]=Ve[nt-1-32]=129:(a(ye,je-32-1,127,21),a(Se,Pe-32-1,127,9),a(Ve,nt-32-1,127,9)),Q=0;Q<D.za;++Q){var Oe=B.ya[B.aa+Q];if(0<Q){for(X=-1;16>X;++X)n(ye,je+32*X-4,ye,je+32*X+12,4);for(X=-1;8>X;++X)n(Se,Pe+32*X-4,Se,Pe+32*X+4,4),n(Ve,nt+32*X-4,Ve,nt+32*X+4,4)}var Ke=D.Gd,Qe=D.Hd+Q,ut=Oe.ad,tt=Oe.Hc;if(0<de&&(n(ye,je-32,Ke[Qe].y,0,16),n(Se,Pe-32,Ke[Qe].f,0,8),n(Ve,nt-32,Ke[Qe].ea,0,8)),Oe.Za){var ft=ye,gt=je-32+16;for(0<de&&(Q>=D.za-1?a(ft,gt,Ke[Qe].y[15],4):n(ft,gt,Ke[Qe+1].y,0,4)),X=0;4>X;X++)ft[gt+128+X]=ft[gt+256+X]=ft[gt+384+X]=ft[gt+0+X];for(X=0;16>X;++X,tt<<=2)ft=ye,gt=je+Q7[X],gu[Oe.Ob[X]](ft,gt),$_(tt,ut,16*+X,ft,gt)}else if(ft=ix(Q,de,Oe.Ob[0]),$h[ft](ye,je),tt!=0)for(X=0;16>X;++X,tt<<=2)$_(tt,ut,16*+X,ye,je+Q7[X]);for(X=Oe.Gc,ft=ix(Q,de,Oe.Dd),Sf[ft](Se,Pe),Sf[ft](Ve,nt),tt=ut,ft=Se,gt=Pe,255&(Oe=0|X)&&(170&Oe?gd(tt,256,ft,gt):ds(tt,256,ft,gt)),Oe=Ve,tt=nt,255&(X>>=8)&&(170&X?gd(ut,320,Oe,tt):ds(ut,320,Oe,tt)),de<D.Ub-1&&(n(Ke[Qe].y,0,ye,je+480,16),n(Ke[Qe].f,0,Se,Pe+224,8),n(Ke[Qe].ea,0,Ve,nt+224,8)),X=8*xe*D.B,Ke=D.sa,Qe=D.ta+16*Q+16*xe*D.R,ut=D.qa,Oe=D.ra+8*Q+X,tt=D.Ha,ft=D.Ia+8*Q+X,X=0;16>X;++X)n(Ke,Qe+X*D.R,ye,je+32*X,16);for(X=0;8>X;++X)n(ut,Oe+X*D.B,Se,Pe+32*X,8),n(tt,ft+X*D.B,Ve,nt+32*X,8)}}function Hp(D,B,X,Q,de,xe,ye,je,Se){var Pe=[0],Ve=[0],nt=0,Oe=Se!=null?Se.kd:0,Ke=Se??new bt;if(D==null||12>X)return 7;Ke.data=D,Ke.w=B,Ke.ha=X,B=[B],X=[X],Ke.gb=[Ke.gb];e:{var Qe=B,ut=X,tt=Ke.gb;if(t(D!=null),t(ut!=null),t(tt!=null),tt[0]=0,12<=ut[0]&&!r(D,Qe[0],"RIFF")){if(r(D,Qe[0]+8,"WEBP")){tt=3;break e}var ft=W(D,Qe[0]+4);if(12>ft||4294967286<ft){tt=3;break e}if(Oe&&ft>ut[0]-8){tt=7;break e}tt[0]=ft,Qe[0]+=12,ut[0]-=12}tt=0}if(tt!=0)return tt;for(ft=0<Ke.gb[0],X=X[0];;){e:{var gt=D;ut=B,tt=X;var St=Pe,wt=Ve,mr=Qe=[0];if((lr=nt=[nt])[0]=0,8>tt[0])tt=7;else{if(!r(gt,ut[0],"VP8X")){if(W(gt,ut[0]+4)!=10){tt=3;break e}if(18>tt[0]){tt=7;break e}var rr=W(gt,ut[0]+8),an=1+Ue(gt,ut[0]+12);if(2147483648<=an*(gt=1+Ue(gt,ut[0]+15))){tt=3;break e}mr!=null&&(mr[0]=rr),St!=null&&(St[0]=an),wt!=null&&(wt[0]=gt),ut[0]+=18,tt[0]-=18,lr[0]=1}tt=0}}if(nt=nt[0],Qe=Qe[0],tt!=0)return tt;if(ut=!!(2&Qe),!ft&&nt)return 3;if(xe!=null&&(xe[0]=!!(16&Qe)),ye!=null&&(ye[0]=ut),je!=null&&(je[0]=0),ye=Pe[0],Qe=Ve[0],nt&&ut&&Se==null){tt=0;break}if(4>X){tt=7;break}if(ft&&nt||!ft&&!nt&&!r(D,B[0],"ALPH")){X=[X],Ke.na=[Ke.na],Ke.P=[Ke.P],Ke.Sa=[Ke.Sa];e:{rr=D,tt=B,ft=X;var lr=Ke.gb;St=Ke.na,wt=Ke.P,mr=Ke.Sa,an=22,t(rr!=null),t(ft!=null),gt=tt[0];var _n=ft[0];for(t(St!=null),t(mr!=null),St[0]=null,wt[0]=null,mr[0]=0;;){if(tt[0]=gt,ft[0]=_n,8>_n){tt=7;break e}var ni=W(rr,gt+4);if(4294967286<ni){tt=3;break e}var on=8+ni+1&-2;if(an+=on,0<lr&&an>lr){tt=3;break e}if(!r(rr,gt,"VP8 ")||!r(rr,gt,"VP8L")){tt=0;break e}if(_n[0]<on){tt=7;break e}r(rr,gt,"ALPH")||(St[0]=rr,wt[0]=gt+8,mr[0]=ni),gt+=on,_n-=on}}if(X=X[0],Ke.na=Ke.na[0],Ke.P=Ke.P[0],Ke.Sa=Ke.Sa[0],tt!=0)break}X=[X],Ke.Ja=[Ke.Ja],Ke.xa=[Ke.xa];e:if(lr=D,tt=B,ft=X,St=Ke.gb[0],wt=Ke.Ja,mr=Ke.xa,rr=tt[0],gt=!r(lr,rr,"VP8 "),an=!r(lr,rr,"VP8L"),t(lr!=null),t(ft!=null),t(wt!=null),t(mr!=null),8>ft[0])tt=7;else{if(gt||an){if(lr=W(lr,rr+4),12<=St&&lr>St-12){tt=3;break e}if(Oe&&lr>ft[0]-8){tt=7;break e}wt[0]=lr,tt[0]+=8,ft[0]-=8,mr[0]=an}else mr[0]=5<=ft[0]&&lr[rr+0]==47&&!(lr[rr+4]>>5),wt[0]=ft[0];tt=0}if(X=X[0],Ke.Ja=Ke.Ja[0],Ke.xa=Ke.xa[0],B=B[0],tt!=0)break;if(4294967286<Ke.Ja)return 3;if(je==null||ut||(je[0]=Ke.xa?2:1),ye=[ye],Qe=[Qe],Ke.xa){if(5>X){tt=7;break}je=ye,Oe=Qe,ut=xe,D==null||5>X?D=0:5<=X&&D[B+0]==47&&!(D[B+4]>>5)?(ft=[0],lr=[0],St=[0],M(wt=new A,D,B,X),Bn(wt,ft,lr,St)?(je!=null&&(je[0]=ft[0]),Oe!=null&&(Oe[0]=lr[0]),ut!=null&&(ut[0]=St[0]),D=1):D=0):D=0}else{if(10>X){tt=7;break}je=Qe,D==null||10>X||!E_(D,B+3,X-3)?D=0:(Oe=D[B+0]|D[B+1]<<8|D[B+2]<<16,ut=16383&(D[B+7]<<8|D[B+6]),D=16383&(D[B+9]<<8|D[B+8]),1&Oe||3<(Oe>>1&7)||!(Oe>>4&1)||Oe>>5>=Ke.Ja||!ut||!D?D=0:(ye&&(ye[0]=ut),je&&(je[0]=D),D=1))}if(!D||(ye=ye[0],Qe=Qe[0],nt&&(Pe[0]!=ye||Ve[0]!=Qe)))return 3;Se!=null&&(Se[0]=Ke,Se.offset=B-Se.w,t(4294967286>B-Se.w),t(Se.offset==Se.ha-X));break}return tt==0||tt==7&&nt&&Se==null?(xe!=null&&(xe[0]|=Ke.na!=null&&0<Ke.na.length),Q!=null&&(Q[0]=ye),de!=null&&(de[0]=Qe),0):tt}function K1(D,B,X){var Q=B.width,de=B.height,xe=0,ye=0,je=Q,Se=de;if(B.Da=D!=null&&0<D.Da,B.Da&&(je=D.cd,Se=D.bd,xe=D.v,ye=D.j,11>X||(xe&=-2,ye&=-2),0>xe||0>ye||0>=je||0>=Se||xe+je>Q||ye+Se>de))return 0;if(B.v=xe,B.j=ye,B.va=xe+je,B.o=ye+Se,B.U=je,B.T=Se,B.da=D!=null&&0<D.da,B.da){if(!oe(je,Se,X=[D.ib],xe=[D.hb]))return 0;B.ib=X[0],B.hb=xe[0]}return B.ob=D!=null&&D.ob,B.Kb=D==null||!D.Sd,B.da&&(B.ob=B.ib<3*Q/4&&B.hb<3*de/4,B.Kb=0),1}function Y1(D){if(D==null)return 2;if(11>D.S){var B=D.f.RGBA;B.fb+=(D.height-1)*B.A,B.A=-B.A}else B=D.f.kb,D=D.height,B.O+=(D-1)*B.fa,B.fa=-B.fa,B.N+=(D-1>>1)*B.Ab,B.Ab=-B.Ab,B.W+=(D-1>>1)*B.Db,B.Db=-B.Db,B.F!=null&&(B.J+=(D-1)*B.lb,B.lb=-B.lb);return 0}function Oh(D,B,X,Q){if(Q==null||0>=D||0>=B)return 2;if(X!=null){if(X.Da){var de=X.cd,xe=X.bd,ye=-2&X.v,je=-2&X.j;if(0>ye||0>je||0>=de||0>=xe||ye+de>D||je+xe>B)return 2;D=de,B=xe}if(X.da){if(!oe(D,B,de=[X.ib],xe=[X.hb]))return 2;D=de[0],B=xe[0]}}Q.width=D,Q.height=B;e:{var Se=Q.width,Pe=Q.height;if(D=Q.S,0>=Se||0>=Pe||!(D>=q_&&13>D))D=2;else{if(0>=Q.Rd&&Q.sd==null){ye=xe=de=B=0;var Ve=(je=Se*e$[D])*Pe;if(11>D||(xe=(Pe+1)/2*(B=(Se+1)/2),D==12&&(ye=(de=Se)*Pe)),(Pe=i(Ve+2*xe+ye))==null){D=1;break e}Q.sd=Pe,11>D?((Se=Q.f.RGBA).eb=Pe,Se.fb=0,Se.A=je,Se.size=Ve):((Se=Q.f.kb).y=Pe,Se.O=0,Se.fa=je,Se.Fd=Ve,Se.f=Pe,Se.N=0+Ve,Se.Ab=B,Se.Cd=xe,Se.ea=Pe,Se.W=0+Ve+xe,Se.Db=B,Se.Ed=xe,D==12&&(Se.F=Pe,Se.J=0+Ve+2*xe),Se.Tc=ye,Se.lb=de)}if(B=1,de=Q.S,xe=Q.width,ye=Q.height,de>=q_&&13>de)if(11>de)D=Q.f.RGBA,B&=(je=Math.abs(D.A))*(ye-1)+xe<=D.size,B&=je>=xe*e$[de],B&=D.eb!=null;else{D=Q.f.kb,je=(xe+1)/2,Ve=(ye+1)/2,Se=Math.abs(D.fa),Pe=Math.abs(D.Ab);var nt=Math.abs(D.Db),Oe=Math.abs(D.lb),Ke=Oe*(ye-1)+xe;B&=Se*(ye-1)+xe<=D.Fd,B&=Pe*(Ve-1)+je<=D.Cd,B=(B&=nt*(Ve-1)+je<=D.Ed)&Se>=xe&Pe>=je&nt>=je,B&=D.y!=null,B&=D.f!=null,B&=D.ea!=null,de==12&&(B&=Oe>=xe,B&=Ke<=D.Tc,B&=D.F!=null)}else B=0;D=B?0:2}}return D!=0||X!=null&&X.fd&&(D=Y1(Q)),D}var Gp=64,Nl=[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],Sl=24,Dh=32,_f=8,Ih=[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];ge("Predictor0","PredictorAdd0"),P.Predictor0=function(){return 4278190080},P.Predictor1=function(D){return D},P.Predictor2=function(D,B,X){return B[X+0]},P.Predictor3=function(D,B,X){return B[X+1]},P.Predictor4=function(D,B,X){return B[X-1]},P.Predictor5=function(D,B,X){return Ie(Ie(D,B[X+1]),B[X+0])},P.Predictor6=function(D,B,X){return Ie(D,B[X-1])},P.Predictor7=function(D,B,X){return Ie(D,B[X+0])},P.Predictor8=function(D,B,X){return Ie(B[X-1],B[X+0])},P.Predictor9=function(D,B,X){return Ie(B[X+0],B[X+1])},P.Predictor10=function(D,B,X){return Ie(Ie(D,B[X-1]),Ie(B[X+0],B[X+1]))},P.Predictor11=function(D,B,X){var Q=B[X+0];return 0>=_e(Q>>24&255,D>>24&255,(B=B[X-1])>>24&255)+_e(Q>>16&255,D>>16&255,B>>16&255)+_e(Q>>8&255,D>>8&255,B>>8&255)+_e(255&Q,255&D,255&B)?Q:D},P.Predictor12=function(D,B,X){var Q=B[X+0];return(Ge((D>>24&255)+(Q>>24&255)-((B=B[X-1])>>24&255))<<24|Ge((D>>16&255)+(Q>>16&255)-(B>>16&255))<<16|Ge((D>>8&255)+(Q>>8&255)-(B>>8&255))<<8|Ge((255&D)+(255&Q)-(255&B)))>>>0},P.Predictor13=function(D,B,X){var Q=B[X-1];return(we((D=Ie(D,B[X+0]))>>24&255,Q>>24&255)<<24|we(D>>16&255,Q>>16&255)<<16|we(D>>8&255,Q>>8&255)<<8|we(255&D,255&Q))>>>0};var X1=P.PredictorAdd0;P.PredictorAdd1=qe,ge("Predictor2","PredictorAdd2"),ge("Predictor3","PredictorAdd3"),ge("Predictor4","PredictorAdd4"),ge("Predictor5","PredictorAdd5"),ge("Predictor6","PredictorAdd6"),ge("Predictor7","PredictorAdd7"),ge("Predictor8","PredictorAdd8"),ge("Predictor9","PredictorAdd9"),ge("Predictor10","PredictorAdd10"),ge("Predictor11","PredictorAdd11"),ge("Predictor12","PredictorAdd12"),ge("Predictor13","PredictorAdd13");var ox=P.PredictorAdd2;st("ColorIndexInverseTransform","MapARGB","32b",function(D){return D>>8&255},function(D){return D}),st("VP8LColorIndexInverseTransformAlpha","MapAlpha","8b",function(D){return D},function(D){return D>>8&255});var ja,B_=P.ColorIndexInverseTransform,md=P.MapARGB,pd=P.VP8LColorIndexInverseTransformAlpha,Z1=P.MapAlpha,J1=P.VP8LPredictorsAdd=[];J1.length=16,(P.VP8LPredictors=[]).length=16,(P.VP8LPredictorsAdd_C=[]).length=16,(P.VP8LPredictors_C=[]).length=16;var Q1,eb,Rh,Lh,Fh,Kp,Mh,Yp,fc,gd,Vn,ds,_a,ri,Nf,tb,lx,z_,A7,T7,P7,O7,D7,I7,rb,R7,L7,F7,M7=i(511),$7=i(2041),B7=i(225),z7=i(767),U7=0,PA=$7,U_=B7,kl=z7,hc=M7,q_=0,V_=1,q7=2,W_=3,H_=4,OA=5,V7=6,DA=7,IA=8,G_=9,RA=10,ope=[2,3,7],lpe=[3,3,11],W7=[280,256,256,256,40],cpe=[0,1,1,1,0],upe=[17,18,0,1,2,3,4,5,16,6,7,8,9,10,11,12,13,14,15],dpe=[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],fpe=[2954,2956,2958,2962,2970,2986,3018,3082,3212,3468,3980,5004],hpe=8,LA=[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],FA=[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],nb=null,mpe=[[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]],ppe=[0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15],H7=[-0,1,-1,2,-2,3,4,6,-3,5,-4,-5,-6,7,-7,8,-8,-9],gpe=[[[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]],[[253,136,254,255,228,219,128,128,128,128,128],[189,129,242,255,227,213,255,219,128,128,128],[106,126,227,252,214,209,255,255,128,128,128]],[[1,98,248,255,236,226,255,255,128,128,128],[181,133,238,254,221,234,255,154,128,128,128],[78,134,202,247,198,180,255,219,128,128,128]],[[1,185,249,255,243,255,128,128,128,128,128],[184,150,247,255,236,224,128,128,128,128,128],[77,110,216,255,236,230,128,128,128,128,128]],[[1,101,251,255,241,255,128,128,128,128,128],[170,139,241,252,236,209,255,255,128,128,128],[37,116,196,243,228,255,255,255,128,128,128]],[[1,204,254,255,245,255,128,128,128,128,128],[207,160,250,255,238,128,128,128,128,128,128],[102,103,231,255,211,171,128,128,128,128,128]],[[1,152,252,255,240,255,128,128,128,128,128],[177,135,243,255,234,225,128,128,128,128,128],[80,129,211,255,194,224,128,128,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[246,1,255,128,128,128,128,128,128,128,128],[255,128,128,128,128,128,128,128,128,128,128]]],[[[198,35,237,223,193,187,162,160,145,155,62],[131,45,198,221,172,176,220,157,252,221,1],[68,47,146,208,149,167,221,162,255,223,128]],[[1,149,241,255,221,224,255,255,128,128,128],[184,141,234,253,222,220,255,199,128,128,128],[81,99,181,242,176,190,249,202,255,255,128]],[[1,129,232,253,214,197,242,196,255,255,128],[99,121,210,250,201,198,255,202,128,128,128],[23,91,163,242,170,187,247,210,255,255,128]],[[1,200,246,255,234,255,128,128,128,128,128],[109,178,241,255,231,245,255,255,128,128,128],[44,130,201,253,205,192,255,255,128,128,128]],[[1,132,239,251,219,209,255,165,128,128,128],[94,136,225,251,218,190,255,255,128,128,128],[22,100,174,245,186,161,255,199,128,128,128]],[[1,182,249,255,232,235,128,128,128,128,128],[124,143,241,255,227,234,128,128,128,128,128],[35,77,181,251,193,211,255,205,128,128,128]],[[1,157,247,255,236,231,255,255,128,128,128],[121,141,235,255,225,227,255,255,128,128,128],[45,99,188,251,195,217,255,224,128,128,128]],[[1,1,251,255,213,255,128,128,128,128,128],[203,1,248,255,255,128,128,128,128,128,128],[137,1,177,255,224,255,128,128,128,128,128]]],[[[253,9,248,251,207,208,255,192,128,128,128],[175,13,224,243,193,185,249,198,255,255,128],[73,17,171,221,161,179,236,167,255,234,128]],[[1,95,247,253,212,183,255,255,128,128,128],[239,90,244,250,211,209,255,255,128,128,128],[155,77,195,248,188,195,255,255,128,128,128]],[[1,24,239,251,218,219,255,205,128,128,128],[201,51,219,255,196,186,128,128,128,128,128],[69,46,190,239,201,218,255,228,128,128,128]],[[1,191,251,255,255,128,128,128,128,128,128],[223,165,249,255,213,255,128,128,128,128,128],[141,124,248,255,255,128,128,128,128,128,128]],[[1,16,248,255,255,128,128,128,128,128,128],[190,36,230,255,236,255,128,128,128,128,128],[149,1,255,128,128,128,128,128,128,128,128]],[[1,226,255,128,128,128,128,128,128,128,128],[247,192,255,128,128,128,128,128,128,128,128],[240,128,255,128,128,128,128,128,128,128,128]],[[1,134,252,255,255,128,128,128,128,128,128],[213,62,250,255,255,128,128,128,128,128,128],[55,93,255,128,128,128,128,128,128,128,128]],[[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128],[128,128,128,128,128,128,128,128,128,128,128]]],[[[202,24,213,235,186,191,220,160,240,175,255],[126,38,182,232,169,184,228,174,255,187,128],[61,46,138,219,151,178,240,170,255,216,128]],[[1,112,230,250,199,191,247,159,255,255,128],[166,109,228,252,211,215,255,174,128,128,128],[39,77,162,232,172,180,245,178,255,255,128]],[[1,52,220,246,198,199,249,220,255,255,128],[124,74,191,243,183,193,250,221,255,255,128],[24,71,130,219,154,170,243,182,255,255,128]],[[1,182,225,249,219,240,255,224,128,128,128],[149,150,226,252,216,205,255,171,128,128,128],[28,108,170,242,183,194,254,223,255,255,128]],[[1,81,230,252,204,203,255,192,128,128,128],[123,102,209,247,188,196,255,233,128,128,128],[20,95,153,243,164,173,255,203,128,128,128]],[[1,222,248,255,216,213,128,128,128,128,128],[168,175,246,252,235,205,255,255,128,128,128],[47,116,215,255,211,212,255,255,128,128,128]],[[1,121,236,253,212,214,255,255,128,128,128],[141,84,213,252,201,202,255,219,128,128,128],[42,80,160,240,162,185,255,205,128,128,128]],[[1,1,255,128,128,128,128,128,128,128,128],[244,1,255,128,128,128,128,128,128,128,128],[238,1,255,128,128,128,128,128,128,128,128]]]],xpe=[[[231,120,48,89,115,113,120,152,112],[152,179,64,126,170,118,46,70,95],[175,69,143,80,85,82,72,155,103],[56,58,10,171,218,189,17,13,152],[114,26,17,163,44,195,21,10,173],[121,24,80,195,26,62,44,64,85],[144,71,10,38,171,213,144,34,26],[170,46,55,19,136,160,33,206,71],[63,20,8,114,114,208,12,9,226],[81,40,11,96,182,84,29,16,36]],[[134,183,89,137,98,101,106,165,148],[72,187,100,130,157,111,32,75,80],[66,102,167,99,74,62,40,234,128],[41,53,9,178,241,141,26,8,107],[74,43,26,146,73,166,49,23,157],[65,38,105,160,51,52,31,115,128],[104,79,12,27,217,255,87,17,7],[87,68,71,44,114,51,15,186,23],[47,41,14,110,182,183,21,17,194],[66,45,25,102,197,189,23,18,22]],[[88,88,147,150,42,46,45,196,205],[43,97,183,117,85,38,35,179,61],[39,53,200,87,26,21,43,232,171],[56,34,51,104,114,102,29,93,77],[39,28,85,171,58,165,90,98,64],[34,22,116,206,23,34,43,166,73],[107,54,32,26,51,1,81,43,31],[68,25,106,22,64,171,36,225,114],[34,19,21,102,132,188,16,76,124],[62,18,78,95,85,57,50,48,51]],[[193,101,35,159,215,111,89,46,111],[60,148,31,172,219,228,21,18,111],[112,113,77,85,179,255,38,120,114],[40,42,1,196,245,209,10,25,109],[88,43,29,140,166,213,37,43,154],[61,63,30,155,67,45,68,1,209],[100,80,8,43,154,1,51,26,71],[142,78,78,16,255,128,34,197,171],[41,40,5,102,211,183,4,1,221],[51,50,17,168,209,192,23,25,82]],[[138,31,36,171,27,166,38,44,229],[67,87,58,169,82,115,26,59,179],[63,59,90,180,59,166,93,73,154],[40,40,21,116,143,209,34,39,175],[47,15,16,183,34,223,49,45,183],[46,17,33,183,6,98,15,32,183],[57,46,22,24,128,1,54,17,37],[65,32,73,115,28,128,23,128,205],[40,3,9,115,51,192,18,6,223],[87,37,9,115,59,77,64,21,47]],[[104,55,44,218,9,54,53,130,226],[64,90,70,205,40,41,23,26,57],[54,57,112,184,5,41,38,166,213],[30,34,26,133,152,116,10,32,134],[39,19,53,221,26,114,32,73,255],[31,9,65,234,2,15,1,118,73],[75,32,12,51,192,255,160,43,51],[88,31,35,67,102,85,55,186,85],[56,21,23,111,59,205,45,37,192],[55,38,70,124,73,102,1,34,98]],[[125,98,42,88,104,85,117,175,82],[95,84,53,89,128,100,113,101,45],[75,79,123,47,51,128,81,171,1],[57,17,5,71,102,57,53,41,49],[38,33,13,121,57,73,26,1,85],[41,10,67,138,77,110,90,47,114],[115,21,2,10,102,255,166,23,6],[101,29,16,10,85,128,101,196,26],[57,18,10,102,102,213,34,20,43],[117,20,15,36,163,128,68,1,26]],[[102,61,71,37,34,53,31,243,192],[69,60,71,38,73,119,28,222,37],[68,45,128,34,1,47,11,245,171],[62,17,19,70,146,85,55,62,70],[37,43,37,154,100,163,85,160,1],[63,9,92,136,28,64,32,201,85],[75,15,9,9,64,255,184,119,16],[86,6,28,5,64,255,25,248,1],[56,8,17,132,137,255,55,116,128],[58,15,20,82,135,57,26,121,40]],[[164,50,31,137,154,133,25,35,218],[51,103,44,131,131,123,31,6,158],[86,40,64,135,148,224,45,183,128],[22,26,17,131,240,154,14,1,209],[45,16,21,91,64,222,7,1,197],[56,21,39,155,60,138,23,102,213],[83,12,13,54,192,255,68,47,28],[85,26,85,85,128,128,32,146,171],[18,11,7,63,144,171,4,4,246],[35,27,10,146,174,171,12,26,128]],[[190,80,35,99,180,80,126,54,45],[85,126,47,87,176,51,41,20,32],[101,75,128,139,118,146,116,128,85],[56,41,15,176,236,85,37,9,62],[71,30,17,119,118,255,17,18,138],[101,38,60,138,55,70,43,26,142],[146,36,19,30,171,255,97,27,20],[138,45,61,62,219,1,81,188,64],[32,41,20,117,151,142,20,21,163],[112,19,12,61,195,128,48,4,24]]],vpe=[[[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[176,246,255,255,255,255,255,255,255,255,255],[223,241,252,255,255,255,255,255,255,255,255],[249,253,253,255,255,255,255,255,255,255,255]],[[255,244,252,255,255,255,255,255,255,255,255],[234,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255]],[[255,246,254,255,255,255,255,255,255,255,255],[239,253,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[251,255,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[251,254,254,255,255,255,255,255,255,255,255],[254,255,254,255,255,255,255,255,255,255,255]],[[255,254,253,255,254,255,255,255,255,255,255],[250,255,254,255,254,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[217,255,255,255,255,255,255,255,255,255,255],[225,252,241,253,255,255,254,255,255,255,255],[234,250,241,250,253,255,253,254,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[223,254,254,255,255,255,255,255,255,255,255],[238,253,254,254,255,255,255,255,255,255,255]],[[255,248,254,255,255,255,255,255,255,255,255],[249,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,255,255,255,255,255,255,255,255,255],[247,254,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[252,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[253,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[186,251,250,255,255,255,255,255,255,255,255],[234,251,244,254,255,255,255,255,255,255,255],[251,251,243,253,254,255,254,255,255,255,255]],[[255,253,254,255,255,255,255,255,255,255,255],[236,253,254,255,255,255,255,255,255,255,255],[251,253,253,254,254,255,255,255,255,255,255]],[[255,254,254,255,255,255,255,255,255,255,255],[254,254,254,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,254,255,255,255,255,255,255,255,255,255],[254,254,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]],[[[248,255,255,255,255,255,255,255,255,255,255],[250,254,252,254,255,255,255,255,255,255,255],[248,254,249,253,255,255,255,255,255,255,255]],[[255,253,253,255,255,255,255,255,255,255,255],[246,253,253,255,255,255,255,255,255,255,255],[252,254,251,254,254,255,255,255,255,255,255]],[[255,254,252,255,255,255,255,255,255,255,255],[248,254,253,255,255,255,255,255,255,255,255],[253,255,254,254,255,255,255,255,255,255,255]],[[255,251,254,255,255,255,255,255,255,255,255],[245,251,254,255,255,255,255,255,255,255,255],[253,253,254,255,255,255,255,255,255,255,255]],[[255,251,253,255,255,255,255,255,255,255,255],[252,253,254,255,255,255,255,255,255,255,255],[255,254,255,255,255,255,255,255,255,255,255]],[[255,252,255,255,255,255,255,255,255,255,255],[249,255,254,255,255,255,255,255,255,255,255],[255,255,254,255,255,255,255,255,255,255,255]],[[255,255,253,255,255,255,255,255,255,255,255],[250,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]],[[255,255,255,255,255,255,255,255,255,255,255],[254,255,255,255,255,255,255,255,255,255,255],[255,255,255,255,255,255,255,255,255,255,255]]]],ype=[0,1,2,3,6,4,5,6,6,6,6,6,6,6,6,7,0],$h=[],gu=[],Sf=[],bpe=1,G7=2,Bh=[],mc=[];wf("UpsampleRgbLinePair",Ph,3),wf("UpsampleBgrLinePair",Mi,3),wf("UpsampleRgbaLinePair",No,4),wf("UpsampleBgraLinePair",G1,4),wf("UpsampleArgbLinePair",H1,4),wf("UpsampleRgba4444LinePair",Wp,2),wf("UpsampleRgb565LinePair",Vp,2);var wpe=P.UpsampleRgbLinePair,jpe=P.UpsampleBgrLinePair,K7=P.UpsampleRgbaLinePair,Y7=P.UpsampleBgraLinePair,X7=P.UpsampleArgbLinePair,Z7=P.UpsampleRgba4444LinePair,_pe=P.UpsampleRgb565LinePair,K_=16,Y_=1<<K_-1,sb=-227,MA=482,Npe=6,J7=0,Spe=i(256),kpe=i(256),Cpe=i(256),Epe=i(256),Ape=i(MA-sb),Tpe=i(MA-sb);jf("YuvToRgbRow",Ph,3),jf("YuvToBgrRow",Mi,3),jf("YuvToRgbaRow",No,4),jf("YuvToBgraRow",G1,4),jf("YuvToArgbRow",H1,4),jf("YuvToRgba4444Row",Wp,2),jf("YuvToRgb565Row",Vp,2);var Q7=[0,4,8,12,128,132,136,140,256,260,264,268,384,388,392,396],X_=[0,2,8],Ppe=[8,7,6,4,4,2,2,2,1,1,1,1],Ope=1;this.WebPDecodeRGBA=function(D,B,X,Q,de){var xe=V_,ye=new mt,je=new $t;ye.ba=je,je.S=xe,je.width=[je.width],je.height=[je.height];var Se=je.width,Pe=je.height,Ve=new kt;if(Ve==null||D==null)var nt=2;else t(Ve!=null),nt=Hp(D,B,X,Ve.width,Ve.height,Ve.Pd,Ve.Qd,Ve.format,null);if(nt!=0?Se=0:(Se!=null&&(Se[0]=Ve.width[0]),Pe!=null&&(Pe[0]=Ve.height[0]),Se=1),Se){je.width=je.width[0],je.height=je.height[0],Q!=null&&(Q[0]=je.width),de!=null&&(de[0]=je.height);e:{if(Q=new ex,(de=new bt).data=D,de.w=B,de.ha=X,de.kd=1,B=[0],t(de!=null),((D=Hp(de.data,de.w,de.ha,null,null,null,B,null,de))==0||D==7)&&B[0]&&(D=4),(B=D)==0){if(t(ye!=null),Q.data=de.data,Q.w=de.w+de.offset,Q.ha=de.ha-de.offset,Q.put=Ht,Q.ac=mn,Q.bc=sn,Q.ma=ye,de.xa){if((D=Xe())==null){ye=1;break e}if(function(Oe,Ke){var Qe=[0],ut=[0],tt=[0];t:for(;;){if(Oe==null)return 0;if(Ke==null)return Oe.a=2,0;if(Oe.l=Ke,Oe.a=0,M(Oe.m,Ke.data,Ke.w,Ke.ha),!Bn(Oe.m,Qe,ut,tt)){Oe.a=3;break t}if(Oe.xb=G7,Ke.width=Qe[0],Ke.height=ut[0],!Ze(Qe[0],ut[0],1,Oe,null))break t;return 1}return t(Oe.a!=0),0}(D,Q)){if(Q=(B=Oh(Q.width,Q.height,ye.Oa,ye.ba))==0){t:{Q=D;r:for(;;){if(Q==null){Q=0;break t}if(t(Q.s.yc!=null),t(Q.s.Ya!=null),t(0<Q.s.Wb),t((X=Q.l)!=null),t((de=X.ma)!=null),Q.xb!=0){if(Q.ca=de.ba,Q.tb=de.tb,t(Q.ca!=null),!K1(de.Oa,X,W_)){Q.a=2;break r}if(!rt(Q,X.width)||X.da)break r;if((X.da||It(Q.ca.S))&&pu(),11>Q.ca.S||(alert("todo:WebPInitConvertARGBToYUV"),Q.ca.f.kb.F!=null&&pu()),Q.Pb&&0<Q.s.ua&&Q.s.vb.X==null&&!Z(Q.s.vb,Q.s.Wa.Xa)){Q.a=1;break r}Q.xb=0}if(!$e(Q,Q.V,Q.Ba,Q.c,Q.i,X.o,Ne))break r;de.Dc=Q.Ma,Q=1;break t}t(Q.a!=0),Q=0}Q=!Q}Q&&(B=D.a)}else B=D.a}else{if((D=new gA)==null){ye=1;break e}if(D.Fa=de.na,D.P=de.P,D.qc=de.Sa,fd(D,Q)){if((B=Oh(Q.width,Q.height,ye.Oa,ye.ba))==0){if(D.Aa=0,X=ye.Oa,t((de=D)!=null),X!=null){if(0<(Se=0>(Se=X.Md)?0:100<Se?255:255*Se/100)){for(Pe=Ve=0;4>Pe;++Pe)12>(nt=de.pb[Pe]).lc&&(nt.ia=Se*Ppe[0>nt.lc?0:nt.lc]>>3),Ve|=nt.ia;Ve&&(alert("todo:VP8InitRandom"),de.ia=1)}de.Ga=X.Id,100<de.Ga?de.Ga=100:0>de.Ga&&(de.Ga=0)}(function(Oe,Ke){if(Oe==null)return 0;if(Ke==null)return Fa(Oe,2,"NULL VP8Io parameter in VP8Decode().");if(!Oe.cb&&!fd(Oe,Ke))return 0;if(t(Oe.cb),Ke.ac==null||Ke.ac(Ke)){Ke.ob&&(Oe.L=0);var Qe=X_[Oe.L];if(Oe.L==2?(Oe.yb=0,Oe.zb=0):(Oe.yb=Ke.v-Qe>>4,Oe.zb=Ke.j-Qe>>4,0>Oe.yb&&(Oe.yb=0),0>Oe.zb&&(Oe.zb=0)),Oe.Va=Ke.o+15+Qe>>4,Oe.Hb=Ke.va+15+Qe>>4,Oe.Hb>Oe.za&&(Oe.Hb=Oe.za),Oe.Va>Oe.Ub&&(Oe.Va=Oe.Ub),0<Oe.L){var ut=Oe.ed;for(Qe=0;4>Qe;++Qe){var tt;if(Oe.Qa.Cb){var ft=Oe.Qa.Lb[Qe];Oe.Qa.Fb||(ft+=ut.Tb)}else ft=ut.Tb;for(tt=0;1>=tt;++tt){var gt=Oe.gd[Qe][tt],St=ft;if(ut.Pc&&(St+=ut.vd[0],tt&&(St+=ut.od[0])),0<(St=0>St?0:63<St?63:St)){var wt=St;0<ut.wb&&(wt=4<ut.wb?wt>>2:wt>>1)>9-ut.wb&&(wt=9-ut.wb),1>wt&&(wt=1),gt.dd=wt,gt.tc=2*St+wt,gt.ld=40<=St?2:15<=St?1:0}else gt.tc=0;gt.La=tt}}}Qe=0}else Fa(Oe,6,"Frame setup failed"),Qe=Oe.a;if(Qe=Qe==0){if(Qe){Oe.$c=0,0<Oe.Aa||(Oe.Ic=Ope);t:{Qe=Oe.Ic,ut=4*(wt=Oe.za);var mr=32*wt,rr=wt+1,an=0<Oe.L?wt*(0<Oe.Aa?2:1):0,lr=(Oe.Aa==2?2:1)*wt;if((gt=ut+832+(tt=3*(16*Qe+X_[Oe.L])/2*mr)+(ft=Oe.Fa!=null&&0<Oe.Fa.length?Oe.Kc.c*Oe.Kc.i:0))!=gt)Qe=0;else{if(gt>Oe.Vb){if(Oe.Vb=0,Oe.Ec=i(gt),Oe.Fc=0,Oe.Ec==null){Qe=Fa(Oe,1,"no memory during frame initialization.");break t}Oe.Vb=gt}gt=Oe.Ec,St=Oe.Fc,Oe.Ac=gt,Oe.Bc=St,St+=ut,Oe.Gd=o(mr,cc),Oe.Hd=0,Oe.rb=o(rr+1,aa),Oe.sb=1,Oe.wa=an?o(an,yn):null,Oe.Y=0,Oe.D.Nb=0,Oe.D.wa=Oe.wa,Oe.D.Y=Oe.Y,0<Oe.Aa&&(Oe.D.Y+=wt),t(!0),Oe.oc=gt,Oe.pc=St,St+=832,Oe.ya=o(lr,hu),Oe.aa=0,Oe.D.ya=Oe.ya,Oe.D.aa=Oe.aa,Oe.Aa==2&&(Oe.D.aa+=wt),Oe.R=16*wt,Oe.B=8*wt,wt=(mr=X_[Oe.L])*Oe.R,mr=mr/2*Oe.B,Oe.sa=gt,Oe.ta=St+wt,Oe.qa=Oe.sa,Oe.ra=Oe.ta+16*Qe*Oe.R+mr,Oe.Ha=Oe.qa,Oe.Ia=Oe.ra+8*Qe*Oe.B+mr,Oe.$c=0,St+=tt,Oe.mb=ft?gt:null,Oe.nb=ft?St:null,t(St+ft<=Oe.Fc+Oe.Vb),A_(Oe),a(Oe.Ac,Oe.Bc,0,ut),Qe=1}}if(Qe){if(Ke.ka=0,Ke.y=Oe.sa,Ke.O=Oe.ta,Ke.f=Oe.qa,Ke.N=Oe.ra,Ke.ea=Oe.Ha,Ke.Vd=Oe.Ia,Ke.fa=Oe.R,Ke.Rc=Oe.B,Ke.F=null,Ke.J=0,!U7){for(Qe=-255;255>=Qe;++Qe)M7[255+Qe]=0>Qe?-Qe:Qe;for(Qe=-1020;1020>=Qe;++Qe)$7[1020+Qe]=-128>Qe?-128:127<Qe?127:Qe;for(Qe=-112;112>=Qe;++Qe)B7[112+Qe]=-16>Qe?-16:15<Qe?15:Qe;for(Qe=-255;510>=Qe;++Qe)z7[255+Qe]=0>Qe?0:255<Qe?255:Qe;U7=1}Mh=rx,Yp=vA,gd=hd,Vn=P_,ds=O_,fc=xA,_a=F_,ri=zp,Nf=ce,tb=De,lx=M_,z_=G,A7=Be,T7=Je,P7=Bp,O7=V1,D7=R_,I7=L_,gu[0]=kA,gu[1]=yA,gu[2]=NA,gu[3]=SA,gu[4]=mf,gu[5]=CA,gu[6]=pf,gu[7]=EA,gu[8]=$1,gu[9]=nx,$h[0]=jA,$h[1]=wA,$h[2]=F1,$h[3]=D_,$h[4]=Mp,$h[5]=M1,$h[6]=_A,Sf[0]=TA,Sf[1]=bA,Sf[2]=$p,Sf[3]=AA,Sf[4]=z1,Sf[5]=B1,Sf[6]=I_,Qe=1}else Qe=0}Qe&&(Qe=function(_n,ni){for(_n.M=0;_n.M<_n.Va;++_n.M){var on,cr=_n.Jc[_n.M&_n.Xb],Bt=_n.m,Na=_n;for(on=0;on<Na.za;++on){var Zr=Bt,kn=Na,Ps=kn.Ac,$i=kn.Bc+4*on,So=kn.zc,ia=kn.ya[kn.aa+on];if(kn.Qa.Bb?ia.$b=ie(Zr,kn.Pa.jb[0])?2+ie(Zr,kn.Pa.jb[2]):ie(Zr,kn.Pa.jb[1]):ia.$b=0,kn.kc&&(ia.Ad=ie(Zr,kn.Bd)),ia.Za=!ie(Zr,145)+0,ia.Za){var Ji=ia.Ob,ko=0;for(kn=0;4>kn;++kn){var si,Tn=So[0+kn];for(si=0;4>si;++si){Tn=xpe[Ps[$i+si]][Tn];for(var Zn=H7[ie(Zr,Tn[0])];0<Zn;)Zn=H7[2*Zn+ie(Zr,Tn[Zn])];Tn=-Zn,Ps[$i+si]=Tn}n(Ji,ko,Ps,$i,4),ko+=4,So[0+kn]=Tn}}else Tn=ie(Zr,156)?ie(Zr,128)?1:3:ie(Zr,163)?2:0,ia.Ob[0]=Tn,a(Ps,$i,Tn,4),a(So,0,Tn,4);ia.Dd=ie(Zr,142)?ie(Zr,114)?ie(Zr,183)?1:3:2:0}if(Na.m.Ka)return Fa(_n,7,"Premature end-of-partition0 encountered.");for(;_n.ja<_n.za;++_n.ja){if(Na=cr,Zr=(Bt=_n).rb[Bt.sb-1],Ps=Bt.rb[Bt.sb+Bt.ja],on=Bt.ya[Bt.aa+Bt.ja],$i=Bt.kc?on.Ad:0)Zr.la=Ps.la=0,on.Za||(Zr.Na=Ps.Na=0),on.Hc=0,on.Gc=0,on.ia=0;else{var oa,Jn;if(Zr=Ps,Ps=Na,$i=Bt.Pa.Xc,So=Bt.ya[Bt.aa+Bt.ja],ia=Bt.pb[So.$b],kn=So.ad,Ji=0,ko=Bt.rb[Bt.sb-1],Tn=si=0,a(kn,Ji,0,384),So.Za)var Bi=0,xu=$i[3];else{Zn=i(16);var Sa=Zr.Na+ko.Na;if(Sa=nb(Ps,$i[1],Sa,ia.Eb,0,Zn,0),Zr.Na=ko.Na=(0<Sa)+0,1<Sa)Mh(Zn,0,kn,Ji);else{var Jo=Zn[0]+3>>3;for(Zn=0;256>Zn;Zn+=16)kn[Ji+Zn]=Jo}Bi=1,xu=$i[0]}var fs=15&Zr.la,ai=15&ko.la;for(Zn=0;4>Zn;++Zn){var Cl=1&ai;for(Jo=Jn=0;4>Jo;++Jo)fs=fs>>1|(Cl=(Sa=nb(Ps,xu,Sa=Cl+(1&fs),ia.Sc,Bi,kn,Ji))>Bi)<<7,Jn=Jn<<2|(3<Sa?3:1<Sa?2:kn[Ji+0]!=0),Ji+=16;fs>>=4,ai=ai>>1|Cl<<7,si=(si<<8|Jn)>>>0}for(xu=fs,Bi=ai>>4,oa=0;4>oa;oa+=2){for(Jn=0,fs=Zr.la>>4+oa,ai=ko.la>>4+oa,Zn=0;2>Zn;++Zn){for(Cl=1&ai,Jo=0;2>Jo;++Jo)Sa=Cl+(1&fs),fs=fs>>1|(Cl=0<(Sa=nb(Ps,$i[2],Sa,ia.Qc,0,kn,Ji)))<<3,Jn=Jn<<2|(3<Sa?3:1<Sa?2:kn[Ji+0]!=0),Ji+=16;fs>>=2,ai=ai>>1|Cl<<5}Tn|=Jn<<4*oa,xu|=fs<<4<<oa,Bi|=(240&ai)<<oa}Zr.la=xu,ko.la=Bi,So.Hc=si,So.Gc=Tn,So.ia=43690&Tn?0:ia.ia,$i=!(si|Tn)}if(0<Bt.L&&(Bt.wa[Bt.Y+Bt.ja]=Bt.gd[on.$b][on.Za],Bt.wa[Bt.Y+Bt.ja].La|=!$i),Na.Ka)return Fa(_n,7,"Premature end-of-file encountered.")}if(A_(_n),Bt=ni,Na=1,on=(cr=_n).D,Zr=0<cr.L&&cr.M>=cr.zb&&cr.M<=cr.Va,cr.Aa==0)t:{if(on.M=cr.M,on.uc=Zr,dc(cr,on),Na=1,on=(Jn=cr.D).Nb,Zr=(Tn=X_[cr.L])*cr.R,Ps=Tn/2*cr.B,Zn=16*on*cr.R,Jo=8*on*cr.B,$i=cr.sa,So=cr.ta-Zr+Zn,ia=cr.qa,kn=cr.ra-Ps+Jo,Ji=cr.Ha,ko=cr.Ia-Ps+Jo,ai=(fs=Jn.M)==0,si=fs>=cr.Va-1,cr.Aa==2&&dc(cr,Jn),Jn.uc)for(Cl=(Sa=cr).D.M,t(Sa.D.uc),Jn=Sa.yb;Jn<Sa.Hb;++Jn){Bi=Jn,xu=Cl;var Co=(El=(zi=Sa).D).Nb;oa=zi.R;var El=El.wa[El.Y+Bi],Al=zi.sa,Qo=zi.ta+16*Co*oa+16*Bi,Tl=El.dd,bs=El.tc;if(bs!=0)if(t(3<=bs),zi.L==1)0<Bi&&O7(Al,Qo,oa,bs+4),El.La&&I7(Al,Qo,oa,bs),0<xu&&P7(Al,Qo,oa,bs+4),El.La&&D7(Al,Qo,oa,bs);else{var Pl=zi.B,vu=zi.qa,Xp=zi.ra+8*Co*Pl+8*Bi,kf=zi.Ha,zi=zi.Ia+8*Co*Pl+8*Bi;Co=El.ld,0<Bi&&(ri(Al,Qo,oa,bs+4,Tl,Co),tb(vu,Xp,kf,zi,Pl,bs+4,Tl,Co)),El.La&&(z_(Al,Qo,oa,bs,Tl,Co),T7(vu,Xp,kf,zi,Pl,bs,Tl,Co)),0<xu&&(_a(Al,Qo,oa,bs+4,Tl,Co),Nf(vu,Xp,kf,zi,Pl,bs+4,Tl,Co)),El.La&&(lx(Al,Qo,oa,bs,Tl,Co),A7(vu,Xp,kf,zi,Pl,bs,Tl,Co))}}if(cr.ia&&alert("todo:DitherRow"),Bt.put!=null){if(Jn=16*fs,fs=16*(fs+1),ai?(Bt.y=cr.sa,Bt.O=cr.ta+Zn,Bt.f=cr.qa,Bt.N=cr.ra+Jo,Bt.ea=cr.Ha,Bt.W=cr.Ia+Jo):(Jn-=Tn,Bt.y=$i,Bt.O=So,Bt.f=ia,Bt.N=kn,Bt.ea=Ji,Bt.W=ko),si||(fs-=Tn),fs>Bt.o&&(fs=Bt.o),Bt.F=null,Bt.J=null,cr.Fa!=null&&0<cr.Fa.length&&Jn<fs&&(Bt.J=ys(cr,Bt,Jn,fs-Jn),Bt.F=cr.mb,Bt.F==null&&Bt.F.length==0)){Na=Fa(cr,3,"Could not decode alpha data.");break t}Jn<Bt.j&&(Tn=Bt.j-Jn,Jn=Bt.j,t(!(1&Tn)),Bt.O+=cr.R*Tn,Bt.N+=cr.B*(Tn>>1),Bt.W+=cr.B*(Tn>>1),Bt.F!=null&&(Bt.J+=Bt.width*Tn)),Jn<fs&&(Bt.O+=Bt.v,Bt.N+=Bt.v>>1,Bt.W+=Bt.v>>1,Bt.F!=null&&(Bt.J+=Bt.v),Bt.ka=Jn-Bt.j,Bt.U=Bt.va-Bt.v,Bt.T=fs-Jn,Na=Bt.put(Bt))}on+1!=cr.Ic||si||(n(cr.sa,cr.ta-Zr,$i,So+16*cr.R,Zr),n(cr.qa,cr.ra-Ps,ia,kn+8*cr.B,Ps),n(cr.Ha,cr.Ia-Ps,Ji,ko+8*cr.B,Ps))}if(!Na)return Fa(_n,6,"Output aborted.")}return 1}(Oe,Ke)),Ke.bc!=null&&Ke.bc(Ke),Qe&=1}return Qe?(Oe.cb=0,Qe):0})(D,Q)||(B=D.a)}}else B=D.a}B==0&&ye.Oa!=null&&ye.Oa.fd&&(B=Y1(ye.ba))}ye=B}xe=ye!=0?null:11>xe?je.f.RGBA.eb:je.f.kb.y}else xe=null;return xe};var e$=[3,4,3,4,4,2,2,4,4,4,2,1,1]};function u(P,F){for(var T="",k=0;k<4;k++)T+=String.fromCharCode(P[F++]);return T}function d(P,F){return P[F+0]|P[F+1]<<8}function f(P,F){return(P[F+0]|P[F+1]<<8|P[F+2]<<16)>>>0}function m(P,F){return(P[F+0]|P[F+1]<<8|P[F+2]<<16|P[F+3]<<24)>>>0}new c;var h=[0],g=[0],p=[],x=new c,v=e,b=function(P,F){var T={},k=0,V=!1,C=0,R=0;if(T.frames=[],!function(E,A){for(var O=0;O<4;O++)if(E[A+O]!="RIFF".charCodeAt(O))return!0;return!1}(P,F)){for(m(P,F+=4),F+=8;F<P.length;){var H=u(P,F),q=m(P,F+=4);F+=4;var L=q+(1&q);switch(H){case"VP8 ":case"VP8L":T.frames[k]===void 0&&(T.frames[k]={}),(K=T.frames[k]).src_off=V?R:F-8,K.src_size=C+q+8,k++,V&&(V=!1,C=0,R=0);break;case"VP8X":(K=T.header={}).feature_flags=P[F];var M=F+4;K.canvas_width=1+f(P,M),M+=3,K.canvas_height=1+f(P,M),M+=3;break;case"ALPH":V=!0,C=L+8,R=F-8;break;case"ANIM":(K=T.header).bgcolor=m(P,F),M=F+4,K.loop_count=d(P,M),M+=2;break;case"ANMF":var z,K;(K=T.frames[k]={}).offset_x=2*f(P,F),F+=3,K.offset_y=2*f(P,F),F+=3,K.width=1+f(P,F),F+=3,K.height=1+f(P,F),F+=3,K.duration=f(P,F),F+=3,z=P[F++],K.dispose=1&z,K.blend=z>>1&1}H!="ANMF"&&(F+=L)}return T}}(v,0);b.response=v,b.rgbaoutput=!0,b.dataurl=!1;var y=b.header?b.header:null,N=b.frames?b.frames:null;if(y){y.loop_counter=y.loop_count,h=[y.canvas_height],g=[y.canvas_width];for(var _=0;_<N.length&&N[_].blend!=0;_++);}var j=N[0],S=x.WebPDecodeRGBA(v,j.src_off,j.src_size,g,h);j.rgba=S,j.imgwidth=g[0],j.imgheight=h[0];for(var I=0;I<g[0]*h[0]*4;I++)p[I]=S[I];return this.width=g,this.height=h,this.data=p,this}(function(e){var t,r,n,a,i,o,l,c,u,d=function(E){return E=E||{},this.isStrokeTransparent=E.isStrokeTransparent||!1,this.strokeOpacity=E.strokeOpacity||1,this.strokeStyle=E.strokeStyle||"#000000",this.fillStyle=E.fillStyle||"#000000",this.isFillTransparent=E.isFillTransparent||!1,this.fillOpacity=E.fillOpacity||1,this.font=E.font||"10px sans-serif",this.textBaseline=E.textBaseline||"alphabetic",this.textAlign=E.textAlign||"left",this.lineWidth=E.lineWidth||1,this.lineJoin=E.lineJoin||"miter",this.lineCap=E.lineCap||"butt",this.path=E.path||[],this.transform=E.transform!==void 0?E.transform.clone():new c,this.globalCompositeOperation=E.globalCompositeOperation||"normal",this.globalAlpha=E.globalAlpha||1,this.clip_path=E.clip_path||[],this.currentPoint=E.currentPoint||new o,this.miterLimit=E.miterLimit||10,this.lastPoint=E.lastPoint||new o,this.lineDashOffset=E.lineDashOffset||0,this.lineDash=E.lineDash||[],this.margin=E.margin||[0,0,0,0],this.prevPageLastElemOffset=E.prevPageLastElemOffset||0,this.ignoreClearRect=typeof E.ignoreClearRect!="boolean"||E.ignoreClearRect,this};e.events.push(["initialized",function(){this.context2d=new f(this),t=this.internal.f2,r=this.internal.getCoordinateString,n=this.internal.getVerticalCoordinateString,a=this.internal.getHorizontalCoordinate,i=this.internal.getVerticalCoordinate,o=this.internal.Point,l=this.internal.Rectangle,c=this.internal.Matrix,u=new d}]);var f=function(E){Object.defineProperty(this,"canvas",{get:function(){return{parentNode:!1,style:!1}}});var A=E;Object.defineProperty(this,"pdf",{get:function(){return A}});var O=!1;Object.defineProperty(this,"pageWrapXEnabled",{get:function(){return O},set:function(Z){O=!!Z}});var U=!1;Object.defineProperty(this,"pageWrapYEnabled",{get:function(){return U},set:function(Z){U=!!Z}});var Y=0;Object.defineProperty(this,"posX",{get:function(){return Y},set:function(Z){isNaN(Z)||(Y=Z)}});var J=0;Object.defineProperty(this,"posY",{get:function(){return J},set:function(Z){isNaN(Z)||(J=Z)}}),Object.defineProperty(this,"margin",{get:function(){return u.margin},set:function(Z){var le;typeof Z=="number"?le=[Z,Z,Z,Z]:((le=new Array(4))[0]=Z[0],le[1]=Z.length>=2?Z[1]:le[0],le[2]=Z.length>=3?Z[2]:le[0],le[3]=Z.length>=4?Z[3]:le[1]),u.margin=le}});var se=!1;Object.defineProperty(this,"autoPaging",{get:function(){return se},set:function(Z){se=Z}});var ee=0;Object.defineProperty(this,"lastBreak",{get:function(){return ee},set:function(Z){ee=Z}});var ie=[];Object.defineProperty(this,"pageBreaks",{get:function(){return ie},set:function(Z){ie=Z}}),Object.defineProperty(this,"ctx",{get:function(){return u},set:function(Z){Z instanceof d&&(u=Z)}}),Object.defineProperty(this,"path",{get:function(){return u.path},set:function(Z){u.path=Z}});var Ee=[];Object.defineProperty(this,"ctxStack",{get:function(){return Ee},set:function(Z){Ee=Z}}),Object.defineProperty(this,"fillStyle",{get:function(){return this.ctx.fillStyle},set:function(Z){var le;le=m(Z),this.ctx.fillStyle=le.style,this.ctx.isFillTransparent=le.a===0,this.ctx.fillOpacity=le.a,this.pdf.setFillColor(le.r,le.g,le.b,{a:le.a}),this.pdf.setTextColor(le.r,le.g,le.b,{a:le.a})}}),Object.defineProperty(this,"strokeStyle",{get:function(){return this.ctx.strokeStyle},set:function(Z){var le=m(Z);this.ctx.strokeStyle=le.style,this.ctx.isStrokeTransparent=le.a===0,this.ctx.strokeOpacity=le.a,le.a===0?this.pdf.setDrawColor(255,255,255):(le.a,this.pdf.setDrawColor(le.r,le.g,le.b))}}),Object.defineProperty(this,"lineCap",{get:function(){return this.ctx.lineCap},set:function(Z){["butt","round","square"].indexOf(Z)!==-1&&(this.ctx.lineCap=Z,this.pdf.setLineCap(Z))}}),Object.defineProperty(this,"lineWidth",{get:function(){return this.ctx.lineWidth},set:function(Z){isNaN(Z)||(this.ctx.lineWidth=Z,this.pdf.setLineWidth(Z))}}),Object.defineProperty(this,"lineJoin",{get:function(){return this.ctx.lineJoin},set:function(Z){["bevel","round","miter"].indexOf(Z)!==-1&&(this.ctx.lineJoin=Z,this.pdf.setLineJoin(Z))}}),Object.defineProperty(this,"miterLimit",{get:function(){return this.ctx.miterLimit},set:function(Z){isNaN(Z)||(this.ctx.miterLimit=Z,this.pdf.setMiterLimit(Z))}}),Object.defineProperty(this,"textBaseline",{get:function(){return this.ctx.textBaseline},set:function(Z){this.ctx.textBaseline=Z}}),Object.defineProperty(this,"textAlign",{get:function(){return this.ctx.textAlign},set:function(Z){["right","end","center","left","start"].indexOf(Z)!==-1&&(this.ctx.textAlign=Z)}});var te=null,Ue=null,W=null;Object.defineProperty(this,"fontFaces",{get:function(){return W},set:function(Z){te=null,Ue=null,W=Z}}),Object.defineProperty(this,"font",{get:function(){return this.ctx.font},set:function(Z){var le;if(this.ctx.font=Z,(le=/^\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(Z))!==null){var re=le[1];le[2];var oe=le[3],fe=le[4];le[5];var Fe=le[6],ge=/^([.\d]+)((?:%|in|[cem]m|ex|p[ctx]))$/i.exec(fe)[2];fe=Math.floor(ge==="px"?parseFloat(fe)*this.pdf.internal.scaleFactor:ge==="em"?parseFloat(fe)*this.pdf.getFontSize():parseFloat(fe)*this.pdf.internal.scaleFactor),this.pdf.setFontSize(fe);var pe=function(st){var Zt,_t,Vt=[],Jt=st.trim();if(Jt==="")return kT;if(Jt in VU)return[VU[Jt]];for(;Jt!=="";){switch(_t=null,Zt=(Jt=HU(Jt)).charAt(0)){case'"':case"'":_t=SLe(Jt.substring(1),Zt);break;default:_t=kLe(Jt)}if(_t===null||(Vt.push(_t[0]),(Jt=HU(_t[1]))!==""&&Jt.charAt(0)!==","))return kT;Jt=Jt.replace(/^,/,"")}return Vt}(Fe);if(this.fontFaces){var Ie=function(st,Zt){var _t=st.getFontList(),Vt=JSON.stringify(_t);if(te===null||Ue!==Vt){var Jt=function(Qt){var qt=[];return Object.keys(Qt).forEach(function(it){Qt[it].forEach(function(It){var Mt=null;switch(It){case"bold":Mt={family:it,weight:"bold"};break;case"italic":Mt={family:it,style:"italic"};break;case"bolditalic":Mt={family:it,weight:"bold",style:"italic"};break;case"":case"normal":Mt={family:it}}Mt!==null&&(Mt.ref={name:it,style:It},qt.push(Mt))})}),qt}(_t);te=function(Qt){for(var qt={},it=0;it<Qt.length;++it){var It=ST(Qt[it]),Mt=It.family,wr=It.stretch,$t=It.style,kt=It.weight;qt[Mt]=qt[Mt]||{},qt[Mt][wr]=qt[Mt][wr]||{},qt[Mt][wr][$t]=qt[Mt][wr][$t]||{},qt[Mt][wr][$t][kt]=It}return qt}(Jt.concat(Zt)),Ue=Vt}return te}(this.pdf,this.fontFaces),Ge=pe.map(function(st){return{family:st,stretch:"normal",weight:oe,style:re}}),we=function(st,Zt,_t){for(var Vt=(_t=_t||{}).defaultFontFamily||"times",Jt=Object.assign({},NLe,_t.genericFontFamilies||{}),Qt=null,qt=null,it=0;it<Zt.length;++it)if(Jt[(Qt=ST(Zt[it])).family]&&(Qt.family=Jt[Qt.family]),st.hasOwnProperty(Qt.family)){qt=st[Qt.family];break}if(!(qt=qt||st[Vt]))throw new Error("Could not find a font-family for the rule '"+WU(Qt)+"' and default family '"+Vt+"'.");if(qt=function(It,Mt){if(Mt[It])return Mt[It];var wr=o8[It],$t=wr<=o8.normal?-1:1,kt=qU(Mt,woe,wr,$t);if(!kt)throw new Error("Could not find a matching font-stretch value for "+It);return kt}(Qt.stretch,qt),qt=function(It,Mt){if(Mt[It])return Mt[It];for(var wr=boe[It],$t=0;$t<wr.length;++$t)if(Mt[wr[$t]])return Mt[wr[$t]];throw new Error("Could not find a matching font-style for "+It)}(Qt.style,qt),!(qt=function(It,Mt){if(Mt[It])return Mt[It];if(It===400&&Mt[500])return Mt[500];if(It===500&&Mt[400])return Mt[400];var wr=_Le[It],$t=qU(Mt,joe,wr,It<400?-1:1);if(!$t)throw new Error("Could not find a matching font-weight for value "+It);return $t}(Qt.weight,qt)))throw new Error("Failed to resolve a font for the rule '"+WU(Qt)+"'.");return qt}(Ie,Ge);this.pdf.setFont(we.ref.name,we.ref.style)}else{var _e="";(oe==="bold"||parseInt(oe,10)>=700||re==="bold")&&(_e="bold"),re==="italic"&&(_e+="italic"),_e.length===0&&(_e="normal");for(var qe="",Re={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"},Me=0;Me<pe.length;Me++){if(this.pdf.internal.getFont(pe[Me],_e,{noFallback:!0,disableWarning:!0})!==void 0){qe=pe[Me];break}if(_e==="bolditalic"&&this.pdf.internal.getFont(pe[Me],"bold",{noFallback:!0,disableWarning:!0})!==void 0)qe=pe[Me],_e="bold";else if(this.pdf.internal.getFont(pe[Me],"normal",{noFallback:!0,disableWarning:!0})!==void 0){qe=pe[Me],_e="normal";break}}if(qe===""){for(var He=0;He<pe.length;He++)if(Re[pe[He]]){qe=Re[pe[He]];break}}qe=qe===""?"Times":qe,this.pdf.setFont(qe,_e)}}}}),Object.defineProperty(this,"globalCompositeOperation",{get:function(){return this.ctx.globalCompositeOperation},set:function(Z){this.ctx.globalCompositeOperation=Z}}),Object.defineProperty(this,"globalAlpha",{get:function(){return this.ctx.globalAlpha},set:function(Z){this.ctx.globalAlpha=Z}}),Object.defineProperty(this,"lineDashOffset",{get:function(){return this.ctx.lineDashOffset},set:function(Z){this.ctx.lineDashOffset=Z,K.call(this)}}),Object.defineProperty(this,"lineDash",{get:function(){return this.ctx.lineDash},set:function(Z){this.ctx.lineDash=Z,K.call(this)}}),Object.defineProperty(this,"ignoreClearRect",{get:function(){return this.ctx.ignoreClearRect},set:function(Z){this.ctx.ignoreClearRect=!!Z}})};f.prototype.setLineDash=function(E){this.lineDash=E},f.prototype.getLineDash=function(){return this.lineDash.length%2?this.lineDash.concat(this.lineDash):this.lineDash.slice()},f.prototype.fill=function(){N.call(this,"fill",!1)},f.prototype.stroke=function(){N.call(this,"stroke",!1)},f.prototype.beginPath=function(){this.path=[{type:"begin"}]},f.prototype.moveTo=function(E,A){if(isNaN(E)||isNaN(A))throw hs.error("jsPDF.context2d.moveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.moveTo");var O=this.ctx.transform.applyToPoint(new o(E,A));this.path.push({type:"mt",x:O.x,y:O.y}),this.ctx.lastPoint=new o(E,A)},f.prototype.closePath=function(){var E=new o(0,0),A=0;for(A=this.path.length-1;A!==-1;A--)if(this.path[A].type==="begin"&&rs(this.path[A+1])==="object"&&typeof this.path[A+1].x=="number"){E=new o(this.path[A+1].x,this.path[A+1].y);break}this.path.push({type:"close"}),this.ctx.lastPoint=new o(E.x,E.y)},f.prototype.lineTo=function(E,A){if(isNaN(E)||isNaN(A))throw hs.error("jsPDF.context2d.lineTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.lineTo");var O=this.ctx.transform.applyToPoint(new o(E,A));this.path.push({type:"lt",x:O.x,y:O.y}),this.ctx.lastPoint=new o(O.x,O.y)},f.prototype.clip=function(){this.ctx.clip_path=JSON.parse(JSON.stringify(this.path)),N.call(this,null,!0)},f.prototype.quadraticCurveTo=function(E,A,O,U){if(isNaN(O)||isNaN(U)||isNaN(E)||isNaN(A))throw hs.error("jsPDF.context2d.quadraticCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.quadraticCurveTo");var Y=this.ctx.transform.applyToPoint(new o(O,U)),J=this.ctx.transform.applyToPoint(new o(E,A));this.path.push({type:"qct",x1:J.x,y1:J.y,x:Y.x,y:Y.y}),this.ctx.lastPoint=new o(Y.x,Y.y)},f.prototype.bezierCurveTo=function(E,A,O,U,Y,J){if(isNaN(Y)||isNaN(J)||isNaN(E)||isNaN(A)||isNaN(O)||isNaN(U))throw hs.error("jsPDF.context2d.bezierCurveTo: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.bezierCurveTo");var se=this.ctx.transform.applyToPoint(new o(Y,J)),ee=this.ctx.transform.applyToPoint(new o(E,A)),ie=this.ctx.transform.applyToPoint(new o(O,U));this.path.push({type:"bct",x1:ee.x,y1:ee.y,x2:ie.x,y2:ie.y,x:se.x,y:se.y}),this.ctx.lastPoint=new o(se.x,se.y)},f.prototype.arc=function(E,A,O,U,Y,J){if(isNaN(E)||isNaN(A)||isNaN(O)||isNaN(U)||isNaN(Y))throw hs.error("jsPDF.context2d.arc: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.arc");if(J=!!J,!this.ctx.transform.isIdentity){var se=this.ctx.transform.applyToPoint(new o(E,A));E=se.x,A=se.y;var ee=this.ctx.transform.applyToPoint(new o(0,O)),ie=this.ctx.transform.applyToPoint(new o(0,0));O=Math.sqrt(Math.pow(ee.x-ie.x,2)+Math.pow(ee.y-ie.y,2))}Math.abs(Y-U)>=2*Math.PI&&(U=0,Y=2*Math.PI),this.path.push({type:"arc",x:E,y:A,radius:O,startAngle:U,endAngle:Y,counterclockwise:J})},f.prototype.arcTo=function(E,A,O,U,Y){throw new Error("arcTo not implemented.")},f.prototype.rect=function(E,A,O,U){if(isNaN(E)||isNaN(A)||isNaN(O)||isNaN(U))throw hs.error("jsPDF.context2d.rect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rect");this.moveTo(E,A),this.lineTo(E+O,A),this.lineTo(E+O,A+U),this.lineTo(E,A+U),this.lineTo(E,A),this.lineTo(E+O,A),this.lineTo(E,A)},f.prototype.fillRect=function(E,A,O,U){if(isNaN(E)||isNaN(A)||isNaN(O)||isNaN(U))throw hs.error("jsPDF.context2d.fillRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillRect");if(!h.call(this)){var Y={};this.lineCap!=="butt"&&(Y.lineCap=this.lineCap,this.lineCap="butt"),this.lineJoin!=="miter"&&(Y.lineJoin=this.lineJoin,this.lineJoin="miter"),this.beginPath(),this.rect(E,A,O,U),this.fill(),Y.hasOwnProperty("lineCap")&&(this.lineCap=Y.lineCap),Y.hasOwnProperty("lineJoin")&&(this.lineJoin=Y.lineJoin)}},f.prototype.strokeRect=function(E,A,O,U){if(isNaN(E)||isNaN(A)||isNaN(O)||isNaN(U))throw hs.error("jsPDF.context2d.strokeRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeRect");g.call(this)||(this.beginPath(),this.rect(E,A,O,U),this.stroke())},f.prototype.clearRect=function(E,A,O,U){if(isNaN(E)||isNaN(A)||isNaN(O)||isNaN(U))throw hs.error("jsPDF.context2d.clearRect: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.clearRect");this.ignoreClearRect||(this.fillStyle="#ffffff",this.fillRect(E,A,O,U))},f.prototype.save=function(E){E=typeof E!="boolean"||E;for(var A=this.pdf.internal.getCurrentPageInfo().pageNumber,O=0;O<this.pdf.internal.getNumberOfPages();O++)this.pdf.setPage(O+1),this.pdf.internal.out("q");if(this.pdf.setPage(A),E){this.ctx.fontSize=this.pdf.internal.getFontSize();var U=new d(this.ctx);this.ctxStack.push(this.ctx),this.ctx=U}},f.prototype.restore=function(E){E=typeof E!="boolean"||E;for(var A=this.pdf.internal.getCurrentPageInfo().pageNumber,O=0;O<this.pdf.internal.getNumberOfPages();O++)this.pdf.setPage(O+1),this.pdf.internal.out("Q");this.pdf.setPage(A),E&&this.ctxStack.length!==0&&(this.ctx=this.ctxStack.pop(),this.fillStyle=this.ctx.fillStyle,this.strokeStyle=this.ctx.strokeStyle,this.font=this.ctx.font,this.lineCap=this.ctx.lineCap,this.lineWidth=this.ctx.lineWidth,this.lineJoin=this.ctx.lineJoin,this.lineDash=this.ctx.lineDash,this.lineDashOffset=this.ctx.lineDashOffset)},f.prototype.toDataURL=function(){throw new Error("toDataUrl not implemented.")};var m=function(E){var A,O,U,Y;if(E.isCanvasGradient===!0&&(E=E.getColor()),!E)return{r:0,g:0,b:0,a:0,style:E};if(/transparent|rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*0+\s*\)/.test(E))A=0,O=0,U=0,Y=0;else{var J=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(E);if(J!==null)A=parseInt(J[1]),O=parseInt(J[2]),U=parseInt(J[3]),Y=1;else if((J=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)/.exec(E))!==null)A=parseInt(J[1]),O=parseInt(J[2]),U=parseInt(J[3]),Y=parseFloat(J[4]);else{if(Y=1,typeof E=="string"&&E.charAt(0)!=="#"){var se=new hoe(E);E=se.ok?se.toHex():"#000000"}E.length===4?(A=E.substring(1,2),A+=A,O=E.substring(2,3),O+=O,U=E.substring(3,4),U+=U):(A=E.substring(1,3),O=E.substring(3,5),U=E.substring(5,7)),A=parseInt(A,16),O=parseInt(O,16),U=parseInt(U,16)}}return{r:A,g:O,b:U,a:Y,style:E}},h=function(){return this.ctx.isFillTransparent||this.globalAlpha==0},g=function(){return!!(this.ctx.isStrokeTransparent||this.globalAlpha==0)};f.prototype.fillText=function(E,A,O,U){if(isNaN(A)||isNaN(O)||typeof E!="string")throw hs.error("jsPDF.context2d.fillText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.fillText");if(U=isNaN(U)?void 0:U,!h.call(this)){var Y=L(this.ctx.transform.rotation),J=this.ctx.transform.scaleX;k.call(this,{text:E,x:A,y:O,scale:J,angle:Y,align:this.textAlign,maxWidth:U})}},f.prototype.strokeText=function(E,A,O,U){if(isNaN(A)||isNaN(O)||typeof E!="string")throw hs.error("jsPDF.context2d.strokeText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.strokeText");if(!g.call(this)){U=isNaN(U)?void 0:U;var Y=L(this.ctx.transform.rotation),J=this.ctx.transform.scaleX;k.call(this,{text:E,x:A,y:O,scale:J,renderingMode:"stroke",angle:Y,align:this.textAlign,maxWidth:U})}},f.prototype.measureText=function(E){if(typeof E!="string")throw hs.error("jsPDF.context2d.measureText: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.measureText");var A=this.pdf,O=this.pdf.internal.scaleFactor,U=A.internal.getFontSize(),Y=A.getStringUnitWidth(E)*U/A.internal.scaleFactor;return new function(J){var se=(J=J||{}).width||0;return Object.defineProperty(this,"width",{get:function(){return se}}),this}({width:Y*=Math.round(96*O/72*1e4)/1e4})},f.prototype.scale=function(E,A){if(isNaN(E)||isNaN(A))throw hs.error("jsPDF.context2d.scale: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.scale");var O=new c(E,0,0,A,0,0);this.ctx.transform=this.ctx.transform.multiply(O)},f.prototype.rotate=function(E){if(isNaN(E))throw hs.error("jsPDF.context2d.rotate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.rotate");var A=new c(Math.cos(E),Math.sin(E),-Math.sin(E),Math.cos(E),0,0);this.ctx.transform=this.ctx.transform.multiply(A)},f.prototype.translate=function(E,A){if(isNaN(E)||isNaN(A))throw hs.error("jsPDF.context2d.translate: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.translate");var O=new c(1,0,0,1,E,A);this.ctx.transform=this.ctx.transform.multiply(O)},f.prototype.transform=function(E,A,O,U,Y,J){if(isNaN(E)||isNaN(A)||isNaN(O)||isNaN(U)||isNaN(Y)||isNaN(J))throw hs.error("jsPDF.context2d.transform: Invalid arguments",arguments),new Error("Invalid arguments passed to jsPDF.context2d.transform");var se=new c(E,A,O,U,Y,J);this.ctx.transform=this.ctx.transform.multiply(se)},f.prototype.setTransform=function(E,A,O,U,Y,J){E=isNaN(E)?1:E,A=isNaN(A)?0:A,O=isNaN(O)?0:O,U=isNaN(U)?1:U,Y=isNaN(Y)?0:Y,J=isNaN(J)?0:J,this.ctx.transform=new c(E,A,O,U,Y,J)};var p=function(){return this.margin[0]>0||this.margin[1]>0||this.margin[2]>0||this.margin[3]>0};f.prototype.drawImage=function(E,A,O,U,Y,J,se,ee,ie){var Ee=this.pdf.getImageProperties(E),te=1,Ue=1,W=1,Z=1;U!==void 0&&ee!==void 0&&(W=ee/U,Z=ie/Y,te=Ee.width/U*ee/U,Ue=Ee.height/Y*ie/Y),J===void 0&&(J=A,se=O,A=0,O=0),U!==void 0&&ee===void 0&&(ee=U,ie=Y),U===void 0&&ee===void 0&&(ee=Ee.width,ie=Ee.height);var le=this.ctx.transform.decompose(),re=L(le.rotate.shx),oe=new c,fe=(oe=(oe=(oe=oe.multiply(le.translate)).multiply(le.skew)).multiply(le.scale)).applyToRectangle(new l(J-A*W,se-O*Z,U*te,Y*Ue));if(this.autoPaging){for(var Fe,ge=x.call(this,fe),pe=[],Ie=0;Ie<ge.length;Ie+=1)pe.indexOf(ge[Ie])===-1&&pe.push(ge[Ie]);y(pe);for(var Ge=pe[0],we=pe[pe.length-1],_e=Ge;_e<we+1;_e++){this.pdf.setPage(_e);var qe=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Re=_e===1?this.posY+this.margin[0]:this.margin[0],Me=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],He=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],st=_e===1?0:Me+(_e-2)*He;if(this.ctx.clip_path.length!==0){var Zt=this.path;Fe=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(Fe,this.posX+this.margin[3],-st+Re+this.ctx.prevPageLastElemOffset),_.call(this,"fill",!0),this.path=Zt}var _t=JSON.parse(JSON.stringify(fe));_t=b([_t],this.posX+this.margin[3],-st+Re+this.ctx.prevPageLastElemOffset)[0];var Vt=(_e>Ge||_e<we)&&p.call(this);Vt&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],qe,He,null).clip().discardPath()),this.pdf.addImage(E,"JPEG",_t.x,_t.y,_t.w,_t.h,null,null,re),Vt&&this.pdf.restoreGraphicsState()}}else this.pdf.addImage(E,"JPEG",fe.x,fe.y,fe.w,fe.h,null,null,re)};var x=function(E,A,O){var U=[];A=A||this.pdf.internal.pageSize.width,O=O||this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2];var Y=this.posY+this.ctx.prevPageLastElemOffset;switch(E.type){default:case"mt":case"lt":U.push(Math.floor((E.y+Y)/O)+1);break;case"arc":U.push(Math.floor((E.y+Y-E.radius)/O)+1),U.push(Math.floor((E.y+Y+E.radius)/O)+1);break;case"qct":var J=M(this.ctx.lastPoint.x,this.ctx.lastPoint.y,E.x1,E.y1,E.x,E.y);U.push(Math.floor((J.y+Y)/O)+1),U.push(Math.floor((J.y+J.h+Y)/O)+1);break;case"bct":var se=z(this.ctx.lastPoint.x,this.ctx.lastPoint.y,E.x1,E.y1,E.x2,E.y2,E.x,E.y);U.push(Math.floor((se.y+Y)/O)+1),U.push(Math.floor((se.y+se.h+Y)/O)+1);break;case"rect":U.push(Math.floor((E.y+Y)/O)+1),U.push(Math.floor((E.y+E.h+Y)/O)+1)}for(var ee=0;ee<U.length;ee+=1)for(;this.pdf.internal.getNumberOfPages()<U[ee];)v.call(this);return U},v=function(){var E=this.fillStyle,A=this.strokeStyle,O=this.font,U=this.lineCap,Y=this.lineWidth,J=this.lineJoin;this.pdf.addPage(),this.fillStyle=E,this.strokeStyle=A,this.font=O,this.lineCap=U,this.lineWidth=Y,this.lineJoin=J},b=function(E,A,O){for(var U=0;U<E.length;U++)switch(E[U].type){case"bct":E[U].x2+=A,E[U].y2+=O;case"qct":E[U].x1+=A,E[U].y1+=O;default:E[U].x+=A,E[U].y+=O}return E},y=function(E){return E.sort(function(A,O){return A-O})},N=function(E,A){var O=this.fillStyle,U=this.strokeStyle,Y=this.lineCap,J=this.lineWidth,se=Math.abs(J*this.ctx.transform.scaleX),ee=this.lineJoin;if(this.autoPaging){for(var ie,Ee,te=JSON.parse(JSON.stringify(this.path)),Ue=JSON.parse(JSON.stringify(this.path)),W=[],Z=0;Z<Ue.length;Z++)if(Ue[Z].x!==void 0)for(var le=x.call(this,Ue[Z]),re=0;re<le.length;re+=1)W.indexOf(le[re])===-1&&W.push(le[re]);for(var oe=0;oe<W.length;oe++)for(;this.pdf.internal.getNumberOfPages()<W[oe];)v.call(this);y(W);for(var fe=W[0],Fe=W[W.length-1],ge=fe;ge<Fe+1;ge++){this.pdf.setPage(ge),this.fillStyle=O,this.strokeStyle=U,this.lineCap=Y,this.lineWidth=se,this.lineJoin=ee;var pe=this.pdf.internal.pageSize.width-this.margin[3]-this.margin[1],Ie=ge===1?this.posY+this.margin[0]:this.margin[0],Ge=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],we=this.pdf.internal.pageSize.height-this.margin[0]-this.margin[2],_e=ge===1?0:Ge+(ge-2)*we;if(this.ctx.clip_path.length!==0){var qe=this.path;ie=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(ie,this.posX+this.margin[3],-_e+Ie+this.ctx.prevPageLastElemOffset),_.call(this,E,!0),this.path=qe}if(Ee=JSON.parse(JSON.stringify(te)),this.path=b(Ee,this.posX+this.margin[3],-_e+Ie+this.ctx.prevPageLastElemOffset),A===!1||ge===0){var Re=(ge>fe||ge<Fe)&&p.call(this);Re&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],pe,we,null).clip().discardPath()),_.call(this,E,A),Re&&this.pdf.restoreGraphicsState()}this.lineWidth=J}this.path=te}else this.lineWidth=se,_.call(this,E,A),this.lineWidth=J},_=function(E,A){if((E!=="stroke"||A||!g.call(this))&&(E==="stroke"||A||!h.call(this))){for(var O,U,Y=[],J=this.path,se=0;se<J.length;se++){var ee=J[se];switch(ee.type){case"begin":Y.push({begin:!0});break;case"close":Y.push({close:!0});break;case"mt":Y.push({start:ee,deltas:[],abs:[]});break;case"lt":var ie=Y.length;if(J[se-1]&&!isNaN(J[se-1].x)&&(O=[ee.x-J[se-1].x,ee.y-J[se-1].y],ie>0)){for(;ie>=0;ie--)if(Y[ie-1].close!==!0&&Y[ie-1].begin!==!0){Y[ie-1].deltas.push(O),Y[ie-1].abs.push(ee);break}}break;case"bct":O=[ee.x1-J[se-1].x,ee.y1-J[se-1].y,ee.x2-J[se-1].x,ee.y2-J[se-1].y,ee.x-J[se-1].x,ee.y-J[se-1].y],Y[Y.length-1].deltas.push(O);break;case"qct":var Ee=J[se-1].x+2/3*(ee.x1-J[se-1].x),te=J[se-1].y+2/3*(ee.y1-J[se-1].y),Ue=ee.x+2/3*(ee.x1-ee.x),W=ee.y+2/3*(ee.y1-ee.y),Z=ee.x,le=ee.y;O=[Ee-J[se-1].x,te-J[se-1].y,Ue-J[se-1].x,W-J[se-1].y,Z-J[se-1].x,le-J[se-1].y],Y[Y.length-1].deltas.push(O);break;case"arc":Y.push({deltas:[],abs:[],arc:!0}),Array.isArray(Y[Y.length-1].abs)&&Y[Y.length-1].abs.push(ee)}}U=A?null:E==="stroke"?"stroke":"fill";for(var re=!1,oe=0;oe<Y.length;oe++)if(Y[oe].arc)for(var fe=Y[oe].abs,Fe=0;Fe<fe.length;Fe++){var ge=fe[Fe];ge.type==="arc"?I.call(this,ge.x,ge.y,ge.radius,ge.startAngle,ge.endAngle,ge.counterclockwise,void 0,A,!re):V.call(this,ge.x,ge.y),re=!0}else if(Y[oe].close===!0)this.pdf.internal.out("h"),re=!1;else if(Y[oe].begin!==!0){var pe=Y[oe].start.x,Ie=Y[oe].start.y;C.call(this,Y[oe].deltas,pe,Ie),re=!0}U&&P.call(this,U),A&&F.call(this)}},j=function(E){var A=this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor,O=A*(this.pdf.internal.getLineHeightFactor()-1);switch(this.ctx.textBaseline){case"bottom":return E-O;case"top":return E+A-O;case"hanging":return E+A-2*O;case"middle":return E+A/2-O;default:return E}},S=function(E){return E+this.pdf.internal.getFontSize()/this.pdf.internal.scaleFactor*(this.pdf.internal.getLineHeightFactor()-1)};f.prototype.createLinearGradient=function(){var E=function(){};return E.colorStops=[],E.addColorStop=function(A,O){this.colorStops.push([A,O])},E.getColor=function(){return this.colorStops.length===0?"#000000":this.colorStops[0][1]},E.isCanvasGradient=!0,E},f.prototype.createPattern=function(){return this.createLinearGradient()},f.prototype.createRadialGradient=function(){return this.createLinearGradient()};var I=function(E,A,O,U,Y,J,se,ee,ie){for(var Ee=H.call(this,O,U,Y,J),te=0;te<Ee.length;te++){var Ue=Ee[te];te===0&&(ie?T.call(this,Ue.x1+E,Ue.y1+A):V.call(this,Ue.x1+E,Ue.y1+A)),R.call(this,E,A,Ue.x2,Ue.y2,Ue.x3,Ue.y3,Ue.x4,Ue.y4)}ee?F.call(this):P.call(this,se)},P=function(E){switch(E){case"stroke":this.pdf.internal.out("S");break;case"fill":this.pdf.internal.out("f")}},F=function(){this.pdf.clip(),this.pdf.discardPath()},T=function(E,A){this.pdf.internal.out(r(E)+" "+n(A)+" m")},k=function(E){var A;switch(E.align){case"right":case"end":A="right";break;case"center":A="center";break;default:A="left"}var O,U,Y,J=this.pdf.getTextDimensions(E.text),se=j.call(this,E.y),ee=S.call(this,se)-J.h,ie=this.ctx.transform.applyToPoint(new o(E.x,se));if(this.autoPaging){var Ee=this.ctx.transform.decompose(),te=new c;te=(te=(te=te.multiply(Ee.translate)).multiply(Ee.skew)).multiply(Ee.scale);for(var Ue=this.ctx.transform.applyToRectangle(new l(E.x,se,J.w,J.h)),W=te.applyToRectangle(new l(E.x,ee,J.w,J.h)),Z=x.call(this,W),le=[],re=0;re<Z.length;re+=1)le.indexOf(Z[re])===-1&&le.push(Z[re]);y(le);for(var oe=le[0],fe=le[le.length-1],Fe=oe;Fe<fe+1;Fe++){this.pdf.setPage(Fe);var ge=Fe===1?this.posY+this.margin[0]:this.margin[0],pe=this.pdf.internal.pageSize.height-this.posY-this.margin[0]-this.margin[2],Ie=this.pdf.internal.pageSize.height-this.margin[2],Ge=Ie-this.margin[0],we=this.pdf.internal.pageSize.width-this.margin[1],_e=we-this.margin[3],qe=Fe===1?0:pe+(Fe-2)*Ge;if(this.ctx.clip_path.length!==0){var Re=this.path;O=JSON.parse(JSON.stringify(this.ctx.clip_path)),this.path=b(O,this.posX+this.margin[3],-1*qe+ge),_.call(this,"fill",!0),this.path=Re}var Me=b([JSON.parse(JSON.stringify(W))],this.posX+this.margin[3],-qe+ge+this.ctx.prevPageLastElemOffset)[0];E.scale>=.01&&(U=this.pdf.internal.getFontSize(),this.pdf.setFontSize(U*E.scale),Y=this.lineWidth,this.lineWidth=Y*E.scale);var He=this.autoPaging!=="text";if(He||Me.y+Me.h<=Ie){if(He||Me.y>=ge&&Me.x<=we){var st=He?E.text:this.pdf.splitTextToSize(E.text,E.maxWidth||we-Me.x)[0],Zt=b([JSON.parse(JSON.stringify(Ue))],this.posX+this.margin[3],-qe+ge+this.ctx.prevPageLastElemOffset)[0],_t=He&&(Fe>oe||Fe<fe)&&p.call(this);_t&&(this.pdf.saveGraphicsState(),this.pdf.rect(this.margin[3],this.margin[0],_e,Ge,null).clip().discardPath()),this.pdf.text(st,Zt.x,Zt.y,{angle:E.angle,align:A,renderingMode:E.renderingMode}),_t&&this.pdf.restoreGraphicsState()}}else Me.y<Ie&&(this.ctx.prevPageLastElemOffset+=Ie-Me.y);E.scale>=.01&&(this.pdf.setFontSize(U),this.lineWidth=Y)}}else E.scale>=.01&&(U=this.pdf.internal.getFontSize(),this.pdf.setFontSize(U*E.scale),Y=this.lineWidth,this.lineWidth=Y*E.scale),this.pdf.text(E.text,ie.x+this.posX,ie.y+this.posY,{angle:E.angle,align:A,renderingMode:E.renderingMode,maxWidth:E.maxWidth}),E.scale>=.01&&(this.pdf.setFontSize(U),this.lineWidth=Y)},V=function(E,A,O,U){O=O||0,U=U||0,this.pdf.internal.out(r(E+O)+" "+n(A+U)+" l")},C=function(E,A,O){return this.pdf.lines(E,A,O,null,null)},R=function(E,A,O,U,Y,J,se,ee){this.pdf.internal.out([t(a(O+E)),t(i(U+A)),t(a(Y+E)),t(i(J+A)),t(a(se+E)),t(i(ee+A)),"c"].join(" "))},H=function(E,A,O,U){for(var Y=2*Math.PI,J=Math.PI/2;A>O;)A-=Y;var se=Math.abs(O-A);se<Y&&U&&(se=Y-se);for(var ee=[],ie=U?-1:1,Ee=A;se>1e-5;){var te=Ee+ie*Math.min(se,J);ee.push(q.call(this,E,Ee,te)),se-=Math.abs(te-Ee),Ee=te}return ee},q=function(E,A,O){var U=(O-A)/2,Y=E*Math.cos(U),J=E*Math.sin(U),se=Y,ee=-J,ie=se*se+ee*ee,Ee=ie+se*Y+ee*J,te=4/3*(Math.sqrt(2*ie*Ee)-Ee)/(se*J-ee*Y),Ue=se-te*ee,W=ee+te*se,Z=Ue,le=-W,re=U+A,oe=Math.cos(re),fe=Math.sin(re);return{x1:E*Math.cos(A),y1:E*Math.sin(A),x2:Ue*oe-W*fe,y2:Ue*fe+W*oe,x3:Z*oe-le*fe,y3:Z*fe+le*oe,x4:E*Math.cos(O),y4:E*Math.sin(O)}},L=function(E){return 180*E/Math.PI},M=function(E,A,O,U,Y,J){var se=E+.5*(O-E),ee=A+.5*(U-A),ie=Y+.5*(O-Y),Ee=J+.5*(U-J),te=Math.min(E,Y,se,ie),Ue=Math.max(E,Y,se,ie),W=Math.min(A,J,ee,Ee),Z=Math.max(A,J,ee,Ee);return new l(te,W,Ue-te,Z-W)},z=function(E,A,O,U,Y,J,se,ee){var ie,Ee,te,Ue,W,Z,le,re,oe,fe,Fe,ge,pe,Ie,Ge=O-E,we=U-A,_e=Y-O,qe=J-U,Re=se-Y,Me=ee-J;for(Ee=0;Ee<41;Ee++)oe=(le=(te=E+(ie=Ee/40)*Ge)+ie*((W=O+ie*_e)-te))+ie*(W+ie*(Y+ie*Re-W)-le),fe=(re=(Ue=A+ie*we)+ie*((Z=U+ie*qe)-Ue))+ie*(Z+ie*(J+ie*Me-Z)-re),Ee==0?(Fe=oe,ge=fe,pe=oe,Ie=fe):(Fe=Math.min(Fe,oe),ge=Math.min(ge,fe),pe=Math.max(pe,oe),Ie=Math.max(Ie,fe));return new l(Math.round(Fe),Math.round(ge),Math.round(pe-Fe),Math.round(Ie-ge))},K=function(){if(this.prevLineDash||this.ctx.lineDash.length||this.ctx.lineDashOffset){var E,A,O=(E=this.ctx.lineDash,A=this.ctx.lineDashOffset,JSON.stringify({lineDash:E,lineDashOffset:A}));this.prevLineDash!==O&&(this.pdf.setLineDash(this.ctx.lineDash,this.ctx.lineDashOffset),this.prevLineDash=O)}}})(or.API),function(e){var t=function(o){var l,c,u,d,f,m,h,g,p,x;for(c=[],u=0,d=(o+=l="\0\0\0\0".slice(o.length%4||4)).length;d>u;u+=4)(f=(o.charCodeAt(u)<<24)+(o.charCodeAt(u+1)<<16)+(o.charCodeAt(u+2)<<8)+o.charCodeAt(u+3))!==0?(m=(f=((f=((f=((f=(f-(x=f%85))/85)-(p=f%85))/85)-(g=f%85))/85)-(h=f%85))/85)%85,c.push(m+33,h+33,g+33,p+33,x+33)):c.push(122);return function(v,b){for(var y=b;y>0;y--)v.pop()}(c,l.length),String.fromCharCode.apply(String,c)+"~>"},r=function(o){var l,c,u,d,f,m=String,h="length",g=255,p="charCodeAt",x="slice",v="replace";for(o[x](-2),o=o[x](0,-2)[v](/\s/g,"")[v]("z","!!!!!"),u=[],d=0,f=(o+=l="uuuuu"[x](o[h]%5||5))[h];f>d;d+=5)c=52200625*(o[p](d)-33)+614125*(o[p](d+1)-33)+7225*(o[p](d+2)-33)+85*(o[p](d+3)-33)+(o[p](d+4)-33),u.push(g&c>>24,g&c>>16,g&c>>8,g&c);return function(b,y){for(var N=y;N>0;N--)b.pop()}(u,l[h]),m.fromCharCode.apply(m,u)},n=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="",u=0;u<o.length;u+=2)c+=String.fromCharCode("0x"+(o[u]+o[u+1]));return c},i=function(o){for(var l=new Uint8Array(o.length),c=o.length;c--;)l[c]=o.charCodeAt(c);return(l=e8(l)).reduce(function(u,d){return u+String.fromCharCode(d)},"")};e.processDataByFilters=function(o,l){var c=0,u=o||"",d=[];for(typeof(l=l||[])=="string"&&(l=[l]),c=0;c<l.length;c+=1)switch(l[c]){case"ASCII85Decode":case"/ASCII85Decode":u=r(u),d.push("/ASCII85Encode");break;case"ASCII85Encode":case"/ASCII85Encode":u=t(u),d.push("/ASCII85Decode");break;case"ASCIIHexDecode":case"/ASCIIHexDecode":u=a(u),d.push("/ASCIIHexEncode");break;case"ASCIIHexEncode":case"/ASCIIHexEncode":u=n(u),d.push("/ASCIIHexDecode");break;case"FlateEncode":case"/FlateEncode":u=i(u),d.push("/FlateDecode");break;default:throw new Error('The filter: "'+l[c]+'" is not implemented')}return{data:u,reverseChain:d.reverse().join(" ")}}}(or.API),function(e){e.loadFile=function(t,r,n){return function(a,i,o){i=i!==!1,o=typeof o=="function"?o:function(){};var l=void 0;try{l=function(c,u,d){var f=new XMLHttpRequest,m=0,h=function(g){var p=g.length,x=[],v=String.fromCharCode;for(m=0;m<p;m+=1)x.push(v(255&g.charCodeAt(m)));return x.join("")};if(f.open("GET",c,!u),f.overrideMimeType("text/plain; charset=x-user-defined"),u===!1&&(f.onload=function(){f.status===200?d(h(this.responseText)):d(void 0)}),f.send(null),u&&f.status===200)return h(f.responseText)}(a,i,o)}catch{}return l}(t,r,n)},e.loadImageFile=e.loadFile}(or.API),function(e){function t(){return(Fr.html2canvas?Promise.resolve(Fr.html2canvas):Vd(()=>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 r(){return(Fr.DOMPurify?Promise.resolve(Fr.DOMPurify):Vd(()=>import("./purify.es-CKWrWwPe.js"),[])).catch(function(l){return Promise.reject(new Error("Could not load dompurify: "+l))}).then(function(l){return l.default?l.default:l})}var n=function(l){var c=rs(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 u=document.createElement(l);for(var d in c.className&&(u.className=c.className),c.innerHTML&&c.dompurify&&(u.innerHTML=c.dompurify.sanitize(c.innerHTML)),c.style)u.style[d]=c.style[d];return u},i=function l(c,u){for(var d=c.nodeType===3?document.createTextNode(c.nodeValue):c.cloneNode(!1),f=c.firstChild;f;f=f.nextSibling)u!==!0&&f.nodeType===1&&f.nodeName==="SCRIPT"||d.appendChild(l(f,u));return c.nodeType===1&&(c.nodeName==="CANVAS"?(d.width=c.width,d.height=c.height,d.getContext("2d").drawImage(c,0,0)):c.nodeName!=="TEXTAREA"&&c.nodeName!=="SELECT"||(d.value=c.value),d.addEventListener("load",function(){d.scrollTop=c.scrollTop,d.scrollLeft=c.scrollLeft},!0)),d},o=function l(c){var u=Object.assign(l.convert(Promise.resolve()),JSON.parse(JSON.stringify(l.template))),d=l.convert(Promise.resolve(),u);return(d=d.setProgress(1,l,1,[l])).set(c)};(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(u){switch(n(u)){case"string":return"string";case"element":return u.nodeName.toLowerCase()==="canvas"?"canvas":"element";default:return"unknown"}}(l),c){case"string":return this.then(r).then(function(u){return this.set({src:a("div",{innerHTML:l,dompurify:u})})});case"element":return this.set({src:l});case"canvas":return this.set({canvas:l});case"img":return this.set({img:l});default:return this.error("Unknown source type.")}})},o.prototype.to=function(l){switch(l){case"container":return this.toContainer();case"canvas":return this.toCanvas();case"img":return this.toImg();case"pdf":return this.toPdf();default:return this.error("Invalid target.")}},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 u=Object.assign({},this.opt.html2canvas);return delete u.onrendered,c(this.prop.container,u)}).then(function(c){(this.opt.html2canvas.onrendered||function(){})(c),this.prop.canvas=c,document.body.removeChild(this.prop.overlay)})},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 u=this.opt.jsPDF,d=this.opt.fontFaces,f=typeof this.opt.width!="number"||isNaN(this.opt.width)||typeof this.opt.windowWidth!="number"||isNaN(this.opt.windowWidth)?1:this.opt.width/this.opt.windowWidth,m=Object.assign({async:!0,allowTaint:!0,scale:f,scrollX:this.opt.scrollX||0,scrollY:this.opt.scrollY||0,backgroundColor:"#ffffff",imageTimeout:15e3,logging:!0,proxy:null,removeContainer:!0,foreignObjectRendering:!1,useCORS:!1},this.opt.html2canvas);if(delete m.onrendered,u.context2d.autoPaging=this.opt.autoPaging===void 0||this.opt.autoPaging,u.context2d.posX=this.opt.x,u.context2d.posY=this.opt.y,u.context2d.margin=this.opt.margin,u.context2d.fontFaces=d,d)for(var h=0;h<d.length;++h){var g=d[h],p=g.src.find(function(x){return x.format==="truetype"});p&&u.addFont(p.url,g.ref.name,g.ref.style)}return m.windowHeight=m.windowHeight||0,m.windowHeight=m.windowHeight==0?Math.max(this.prop.container.clientHeight,this.prop.container.scrollHeight,this.prop.container.offsetHeight):m.windowHeight,u.context2d.save(!0),c(this.prop.container,m)}).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,u){return(u=u||"pdf").toLowerCase()==="img"||u.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(n(l)!=="object")return this;var c=Object.keys(l||{}).map(function(u){if(u in o.template.prop)return function(){this.prop[u]=l[u]};switch(u){case"margin":return this.setMargin.bind(this,l.margin);case"jsPDF":return function(){return this.opt.jsPDF=l.jsPDF,this.setPageSize()};case"pageSize":return this.setPageSize.bind(this,l.pageSize);default:return function(){this.opt[u]=l[u]}}},this);return this.then(function(){return this.thenList(c)})},o.prototype.get=function(l,c){return this.then(function(){var u=l in o.template.prop?this.prop[l]:this.opt[l];return c?c(u):u})},o.prototype.setMargin=function(l){return this.then(function(){switch(n(l)){case"number":l=[l,l,l,l];case"array":if(l.length===2&&(l=[l[0],l[1],l[0],l[1]]),l.length===4)break;default:return this.error("Invalid margin array.")}this.opt.margin=l}).then(this.setPageSize)},o.prototype.setPageSize=function(l){function c(u,d){return Math.floor(u*d/72*96)}return this.then(function(){(l=l||or.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,u,d){return l!=null&&(this.progress.val=l),c!=null&&(this.progress.state=c),u!=null&&(this.progress.n=u),d!=null&&(this.progress.stack=d),this.progress.ratio=this.progress.val/this.progress.state,this},o.prototype.updateProgress=function(l,c,u,d){return this.setProgress(l?this.progress.val+l:null,c||null,u?this.progress.n+u:null,d?this.progress.stack.concat(d):null)},o.prototype.then=function(l,c){var u=this;return this.thenCore(l,c,function(d,f){return u.updateProgress(null,null,1,[d]),Promise.prototype.then.call(this,function(m){return u.updateProgress(null,d),m}).then(d,f).then(function(m){return u.updateProgress(1),m})})},o.prototype.thenCore=function(l,c,u){u=u||Promise.prototype.then;var d=this;l&&(l=l.bind(d)),c&&(c=c.bind(d));var f=Promise.toString().indexOf("[native code]")!==-1&&Promise.name==="Promise"?d:o.convert(Object.assign({},d),Promise.prototype),m=u.call(f,l,c);return o.convert(m,d.__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(u){c=c.thenCore(u)}),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,or.getPageSize=function(l,c,u){if(rs(l)==="object"){var d=l;l=d.orientation,c=d.unit||c,u=d.format||u}c=c||"mm",u=u||"a4",l=(""+(l||"P")).toLowerCase();var f,m=(""+u).toLowerCase(),h={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};switch(c){case"pt":f=1;break;case"mm":f=72/25.4;break;case"cm":f=72/2.54;break;case"in":f=72;break;case"px":f=.75;break;case"pc":case"em":f=12;break;case"ex":f=6;break;default:throw"Invalid unit: "+c}var g,p=0,x=0;if(h.hasOwnProperty(m))p=h[m][1]/f,x=h[m][0]/f;else try{p=u[1],x=u[0]}catch{throw new Error("Invalid format: "+u)}if(l==="p"||l==="portrait")l="p",x>p&&(g=x,x=p,p=g);else{if(l!=="l"&&l!=="landscape")throw"Invalid orientation: "+l;l="l",p>x&&(g=x,x=p,p=g)}return{width:x,height:p,unit:c,k:f,orientation:l}},e.html=function(l,c){(c=c||{}).callback=c.callback||function(){},c.html2canvas=c.html2canvas||{},c.html2canvas.canvas=c.html2canvas.canvas||this.canvas,c.jsPDF=c.jsPDF||this,c.fontFaces=c.fontFaces?c.fontFaces.map(ST):null;var u=new o(c);return c.worker?u:u.from(l).doCallback()}}(or.API),or.API.addJS=function(e){return KU=e,this.internal.events.subscribe("postPutResources",function(){nS=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/Names [(EmbeddedJS) "+(nS+1)+" 0 R]"),this.internal.out(">>"),this.internal.out("endobj"),GU=this.internal.newObject(),this.internal.out("<<"),this.internal.out("/S /JavaScript"),this.internal.out("/JS ("+KU+")"),this.internal.out(">>"),this.internal.out("endobj")}),this.internal.events.subscribe("putCatalog",function(){nS!==void 0&&GU!==void 0&&this.internal.out("/Names <</JavaScript "+nS+" 0 R>>")}),this},function(e){var t;e.events.push(["postPutResources",function(){var r=this,n=/^(\d+) 0 obj$/;if(this.outline.root.children.length>0)for(var a=r.outline.render().split(/\r\n/),i=0;i<a.length;i++){var o=a[i],l=n.exec(o);if(l!=null){var c=l[1];r.internal.newObjectDeferredBegin(c,!1)}r.internal.write(o)}if(this.outline.createNamedDestinations){var u=this.internal.pages.length,d=[];for(i=0;i<u;i++){var f=r.internal.newObject();d.push(f);var m=r.internal.getPageInfo(i+1);r.internal.write("<< /D["+m.objId+" 0 R /XYZ null null null]>> endobj")}var h=r.internal.newObject();for(r.internal.write("<< /Names [ "),i=0;i<d.length;i++)r.internal.write("(page_"+(i+1)+")"+d[i]+" 0 R");r.internal.write(" ] >>","endobj"),t=r.internal.newObject(),r.internal.write("<< /Dests "+h+" 0 R"),r.internal.write(">>","endobj")}}]),e.events.push(["putCatalog",function(){var r=this;r.outline.root.children.length>0&&(r.internal.write("/Outlines",this.outline.makeRef(this.outline.root)),this.outline.createNamedDestinations&&r.internal.write("/Names "+t+" 0 R"))}]),e.events.push(["initialized",function(){var r=this;r.outline={createNamedDestinations:!1,root:{children:[]}},r.outline.add=function(n,a,i){var o={title:a,options:i,children:[]};return n==null&&(n=this.root),n.children.push(o),o},r.outline.render=function(){return this.ctx={},this.ctx.val="",this.ctx.pdf=r,this.genIds_r(this.root),this.renderRoot(this.root),this.renderItems(this.root),this.ctx.val},r.outline.genIds_r=function(n){n.id=r.internal.newObjectDeferred();for(var a=0;a<n.children.length;a++)this.genIds_r(n.children[a])},r.outline.renderRoot=function(n){this.objStart(n),this.line("/Type /Outlines"),n.children.length>0&&(this.line("/First "+this.makeRef(n.children[0])),this.line("/Last "+this.makeRef(n.children[n.children.length-1]))),this.line("/Count "+this.count_r({count:0},n)),this.objEnd()},r.outline.renderItems=function(n){for(var a=this.ctx.pdf.internal.getVerticalCoordinateString,i=0;i<n.children.length;i++){var o=n.children[i];this.objStart(o),this.line("/Title "+this.makeString(o.title)),this.line("/Parent "+this.makeRef(n)),i>0&&this.line("/Prev "+this.makeRef(n.children[i-1])),i<n.children.length-1&&this.line("/Next "+this.makeRef(n.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=r.internal.getPageInfo(o.options.pageNumber);this.line("/Dest ["+c.objId+" 0 R /XYZ 0 "+a(0)+" 0]")}this.objEnd()}for(var u=0;u<n.children.length;u++)this.renderItems(n.children[u])},r.outline.line=function(n){this.ctx.val+=n+`\r
`},r.outline.makeRef=function(n){return n.id+" 0 R"},r.outline.makeString=function(n){return"("+r.internal.pdfEscape(n)+")"},r.outline.objStart=function(n){this.ctx.val+=`\r
`+n.id+` 0 obj\r
<<\r
`},r.outline.objEnd=function(){this.ctx.val+=`>> \r
endobj\r
`},r.outline.count_r=function(n,a){for(var i=0;i<a.children.length;i++)n.count++,this.count_r(n,a.children[i]);return n.count}}])}(or.API),function(e){var t=[192,193,194,195,196,197,198,199];e.processJPEG=function(r,n,a,i,o,l){var c,u=this.decode.DCT_DECODE,d=null;if(typeof r=="string"||this.__addimage__.isArrayBuffer(r)||this.__addimage__.isArrayBufferView(r)){switch(r=o||r,r=this.__addimage__.isArrayBuffer(r)?new Uint8Array(r):r,c=function(f){for(var m,h=256*f.charCodeAt(4)+f.charCodeAt(5),g=f.length,p={width:0,height:0,numcomponents:1},x=4;x<g;x+=2){if(x+=h,t.indexOf(f.charCodeAt(x+1))!==-1){m=256*f.charCodeAt(x+5)+f.charCodeAt(x+6),p={width:256*f.charCodeAt(x+7)+f.charCodeAt(x+8),height:m,numcomponents:f.charCodeAt(x+9)};break}h=256*f.charCodeAt(x+2)+f.charCodeAt(x+3)}return p}(r=this.__addimage__.isArrayBufferView(r)?this.__addimage__.arrayBufferToBinaryString(r):r),c.numcomponents){case 1:l=this.color_spaces.DEVICE_GRAY;break;case 4:l=this.color_spaces.DEVICE_CMYK;break;case 3:l=this.color_spaces.DEVICE_RGB}d={data:r,width:c.width,height:c.height,colorSpace:l,bitsPerComponent:8,filter:u,index:n,alias:a}}return d}}(or.API),or.API.processPNG=function(e,t,r,n){if(this.__addimage__.isArrayBuffer(e)&&(e=new Uint8Array(e)),this.__addimage__.isArrayBufferView(e)){var a,i=lLe(e,{checkCrc:!0}),o=i.width,l=i.height,c=i.channels,u=i.palette,d=i.depth;a=u&&c===1?function(I){for(var P=I.width,F=I.height,T=I.data,k=I.palette,V=I.depth,C=!1,R=[],H=[],q=void 0,L=!1,M=0,z=0;z<k.length;z++){var K=Jz(k[z],4),E=K[0],A=K[1],O=K[2],U=K[3];R.push(E,A,O),U!=null&&(U===0?(M++,H.length<1&&H.push(z)):U<255&&(L=!0))}if(L||M>1){C=!0,H=void 0;var Y=P*F;q=new Uint8Array(Y);for(var J=new DataView(T.buffer),se=0;se<Y;se++){var ee=CT(J,se,V),ie=Jz(k[ee],4)[3];q[se]=ie}}else M===0&&(H=void 0);return{colorSpace:"Indexed",colorsPerPixel:1,sMaskBitsPerComponent:C?8:void 0,colorBytes:T,alphaBytes:q,needSMask:C,palette:R,mask:H}}(i):c===2||c===4?function(I){for(var P=I.data,F=I.width,T=I.height,k=I.channels,V=I.depth,C=k===2?"DeviceGray":"DeviceRGB",R=k-1,H=F*T,q=R,L=H*q,M=1*H,z=Math.ceil(L*V/8),K=Math.ceil(M*V/8),E=new Uint8Array(z),A=new Uint8Array(K),O=new DataView(P.buffer),U=new DataView(E.buffer),Y=new DataView(A.buffer),J=!1,se=0;se<H;se++){for(var ee=se*k,ie=0;ie<q;ie++)nq(U,CT(O,ee+ie,V),se*q+ie,V);var Ee=CT(O,ee+q,V);Ee<(1<<V)-1&&(J=!0),nq(Y,Ee,1*se,V)}return{colorSpace:C,colorsPerPixel:R,sMaskBitsPerComponent:J?V:void 0,colorBytes:E,alphaBytes:A,needSMask:J}}(i):function(I){var P=I.data,F=I.channels===1?"DeviceGray":"DeviceRGB";return{colorSpace:F,colorsPerPixel:F==="DeviceGray"?1:3,colorBytes:P instanceof Uint16Array?function(T){for(var k=T.length,V=new Uint8Array(2*k),C=new DataView(V.buffer,V.byteOffset,V.byteLength),R=0;R<k;R++)C.setUint16(2*R,T[R],!1);return V}(P):P,needSMask:!1}}(i);var f,m,h,g=a,p=g.colorSpace,x=g.colorsPerPixel,v=g.sMaskBitsPerComponent,b=g.colorBytes,y=g.alphaBytes,N=g.needSMask,_=g.palette,j=g.mask,S=null;return n!==or.API.image_compression.NONE&&typeof e8=="function"?(S=function(I){var P;switch(I){case or.API.image_compression.FAST:P=11;break;case or.API.image_compression.MEDIUM:P=13;break;case or.API.image_compression.SLOW:P=14;break;default:P=12}return P}(n),f=this.decode.FLATE_DECODE,m="/Predictor ".concat(S," /Colors ").concat(x," /BitsPerComponent ").concat(d," /Columns ").concat(o),e=JU(b,Math.ceil(o*x*d/8),x,d,n),N&&(h=JU(y,Math.ceil(o*v/8),1,v,n))):(f=void 0,m=void 0,e=b,N&&(h=y)),(this.__addimage__.isArrayBuffer(e)||this.__addimage__.isArrayBufferView(e))&&(e=this.__addimage__.arrayBufferToBinaryString(e)),(h&&this.__addimage__.isArrayBuffer(h)||this.__addimage__.isArrayBufferView(h))&&(h=this.__addimage__.arrayBufferToBinaryString(h)),{alias:r,data:e,index:t,filter:f,decodeParameters:m,transparency:j,palette:_,sMask:h,predictor:S,width:o,height:l,bitsPerComponent:d,sMaskBitsPerComponent:v,colorSpace:p}}},function(e){e.processGIF89A=function(t,r,n,a){var i=new TLe(t),o=i.width,l=i.height,c=[];i.decodeAndBlitFrameRGBA(0,c);var u={data:c,width:o,height:l},d=new ET(100).encode(u,100);return e.processJPEG.call(this,d,r,n,a)},e.processGIF87A=e.processGIF89A}(or.API),wu.prototype.parseHeader=function(){if(this.fileSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.reserved=this.datav.getUint32(this.pos,!0),this.pos+=4,this.offset=this.datav.getUint32(this.pos,!0),this.pos+=4,this.headerSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.width=this.datav.getUint32(this.pos,!0),this.pos+=4,this.height=this.datav.getInt32(this.pos,!0),this.pos+=4,this.planes=this.datav.getUint16(this.pos,!0),this.pos+=2,this.bitPP=this.datav.getUint16(this.pos,!0),this.pos+=2,this.compress=this.datav.getUint32(this.pos,!0),this.pos+=4,this.rawSize=this.datav.getUint32(this.pos,!0),this.pos+=4,this.hr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.vr=this.datav.getUint32(this.pos,!0),this.pos+=4,this.colors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.importantColors=this.datav.getUint32(this.pos,!0),this.pos+=4,this.bitPP===16&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var e=this.colors===0?1<<this.bitPP:this.colors;this.palette=new Array(e);for(var t=0;t<e;t++){var r=this.datav.getUint8(this.pos++,!0),n=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0);this.palette[t]={red:a,green:n,blue:r,quad:i}}}this.height<0&&(this.height*=-1,this.bottom_up=!1)},wu.prototype.parseBGR=function(){this.pos=this.offset;try{var e="bit"+this.bitPP,t=this.width*this.height*4;this.data=new Uint8Array(t),this[e]()}catch(r){hs.log("bit decode error:"+r)}},wu.prototype.bit1=function(){var e,t=Math.ceil(this.width/8),r=t%4;for(e=this.height-1;e>=0;e--){for(var n=this.bottom_up?e:this.height-1-e,a=0;a<t;a++)for(var i=this.datav.getUint8(this.pos++,!0),o=n*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}r!==0&&(this.pos+=4-r)}},wu.prototype.bit4=function(){for(var e=Math.ceil(this.width/2),t=e%4,r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,a=0;a<e;a++){var i=this.datav.getUint8(this.pos++,!0),o=n*this.width*4+2*a*4,l=i>>4,c=15&i,u=this.palette[l];if(this.data[o]=u.blue,this.data[o+1]=u.green,this.data[o+2]=u.red,this.data[o+3]=255,2*a+1>=this.width)break;u=this.palette[c],this.data[o+4]=u.blue,this.data[o+4+1]=u.green,this.data[o+4+2]=u.red,this.data[o+4+3]=255}t!==0&&(this.pos+=4-t)}},wu.prototype.bit8=function(){for(var e=this.width%4,t=this.height-1;t>=0;t--){for(var r=this.bottom_up?t:this.height-1-t,n=0;n<this.width;n++){var a=this.datav.getUint8(this.pos++,!0),i=r*this.width*4+4*n;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)}},wu.prototype.bit15=function(){for(var e=this.width%3,t=parseInt("11111",2),r=this.height-1;r>=0;r--){for(var n=this.bottom_up?r:this.height-1-r,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,u=i>>15?255:0,d=n*this.width*4+4*a;this.data[d]=c,this.data[d+1]=l,this.data[d+2]=o,this.data[d+3]=u}this.pos+=e}},wu.prototype.bit16=function(){for(var e=this.width%3,t=parseInt("11111",2),r=parseInt("111111",2),n=this.height-1;n>=0;n--){for(var a=this.bottom_up?n:this.height-1-n,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&r)/r*255|0,u=(o>>11)/t*255|0,d=a*this.width*4+4*i;this.data[d]=u,this.data[d+1]=c,this.data[d+2]=l,this.data[d+3]=255}this.pos+=e}},wu.prototype.bit24=function(){for(var e=this.height-1;e>=0;e--){for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),a=this.datav.getUint8(this.pos++,!0),i=this.datav.getUint8(this.pos++,!0),o=t*this.width*4+4*r;this.data[o]=i,this.data[o+1]=a,this.data[o+2]=n,this.data[o+3]=255}this.pos+=this.width%4}},wu.prototype.bit32=function(){for(var e=this.height-1;e>=0;e--)for(var t=this.bottom_up?e:this.height-1-e,r=0;r<this.width;r++){var n=this.datav.getUint8(this.pos++,!0),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*r;this.data[l]=i,this.data[l+1]=a,this.data[l+2]=n,this.data[l+3]=o}},wu.prototype.getData=function(){return this.data},function(e){e.processBMP=function(t,r,n,a){var i=new wu(t,!1),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},u=new ET(100).encode(c,100);return e.processJPEG.call(this,u,r,n,a)}}(or.API),aq.prototype.getData=function(){return this.data},function(e){e.processWEBP=function(t,r,n,a){var i=new aq(t),o=i.width,l=i.height,c={data:i.getData(),width:o,height:l},u=new ET(100).encode(c,100);return e.processJPEG.call(this,u,r,n,a)}}(or.API),or.API.processRGBA=function(e,t,r){for(var n=e.data,a=n.length,i=new Uint8Array(a/4*3),o=new Uint8Array(a/4),l=0,c=0,u=0;u<a;u+=4){var d=n[u],f=n[u+1],m=n[u+2],h=n[u+3];i[l++]=d,i[l++]=f,i[l++]=m,o[c++]=h}var g=this.__addimage__.arrayBufferToBinaryString(i);return{alpha:this.__addimage__.arrayBufferToBinaryString(o),data:g,index:t,alias:r,colorSpace:"DeviceRGB",bitsPerComponent:8,width:e.width,height:e.height}},or.API.setLanguage=function(e){return this.internal.languageSettings===void 0&&(this.internal.languageSettings={},this.internal.languageSettings.isSubscribed=!1),{af:"Afrikaans",sq:"Albanian",ar:"Arabic (Standard)","ar-DZ":"Arabic (Algeria)","ar-BH":"Arabic (Bahrain)","ar-EG":"Arabic (Egypt)","ar-IQ":"Arabic (Iraq)","ar-JO":"Arabic (Jordan)","ar-KW":"Arabic (Kuwait)","ar-LB":"Arabic (Lebanon)","ar-LY":"Arabic (Libya)","ar-MA":"Arabic (Morocco)","ar-OM":"Arabic (Oman)","ar-QA":"Arabic (Qatar)","ar-SA":"Arabic (Saudi Arabia)","ar-SY":"Arabic (Syria)","ar-TN":"Arabic (Tunisia)","ar-AE":"Arabic (U.A.E.)","ar-YE":"Arabic (Yemen)",an:"Aragonese",hy:"Armenian",as:"Assamese",ast:"Asturian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",zh:"Chinese","zh-HK":"Chinese (Hong Kong)","zh-CN":"Chinese (PRC)","zh-SG":"Chinese (Singapore)","zh-TW":"Chinese (Taiwan)",cv:"Chuvash",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch (Standard)","nl-BE":"Dutch (Belgian)",en:"English","en-AU":"English (Australia)","en-BZ":"English (Belize)","en-CA":"English (Canada)","en-IE":"English (Ireland)","en-JM":"English (Jamaica)","en-NZ":"English (New Zealand)","en-PH":"English (Philippines)","en-ZA":"English (South Africa)","en-TT":"English (Trinidad & Tobago)","en-GB":"English (United Kingdom)","en-US":"English (United States)","en-ZW":"English (Zimbabwe)",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fj:"Fijian",fi:"Finnish",fr:"French (Standard)","fr-BE":"French (Belgium)","fr-CA":"French (Canada)","fr-FR":"French (France)","fr-LU":"French (Luxembourg)","fr-MC":"French (Monaco)","fr-CH":"French (Switzerland)",fy:"Frisian",fur:"Friulian",gd:"Gaelic (Scots)","gd-IE":"Gaelic (Irish)",gl:"Galacian",ka:"Georgian",de:"German (Standard)","de-AT":"German (Austria)","de-DE":"German (Germany)","de-LI":"German (Liechtenstein)","de-LU":"German (Luxembourg)","de-CH":"German (Switzerland)",el:"Greek",gu:"Gujurati",ht:"Haitian",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",iu:"Inuktitut",ga:"Irish",it:"Italian (Standard)","it-CH":"Italian (Switzerland)",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ky:"Kirghiz",tlh:"Klingon",ko:"Korean","ko-KP":"Korean (North Korea)","ko-KR":"Korean (South Korea)",la:"Latin",lv:"Latvian",lt:"Lithuanian",lb:"Luxembourgish",mk:"North Macedonia",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",nv:"Navajo",ng:"Ndonga",ne:"Nepali",no:"Norwegian",nb:"Norwegian (Bokmal)",nn:"Norwegian (Nynorsk)",oc:"Occitan",or:"Oriya",om:"Oromo",fa:"Persian","fa-IR":"Persian/Iran",pl:"Polish",pt:"Portuguese","pt-BR":"Portuguese (Brazil)",pa:"Punjabi","pa-IN":"Punjabi (India)","pa-PK":"Punjabi (Pakistan)",qu:"Quechua",rm:"Rhaeto-Romanic",ro:"Romanian","ro-MO":"Romanian (Moldavia)",ru:"Russian","ru-MO":"Russian (Moldavia)",sz:"Sami (Lappish)",sg:"Sango",sa:"Sanskrit",sc:"Sardinian",sd:"Sindhi",si:"Singhalese",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somani",sb:"Sorbian",es:"Spanish","es-AR":"Spanish (Argentina)","es-BO":"Spanish (Bolivia)","es-CL":"Spanish (Chile)","es-CO":"Spanish (Colombia)","es-CR":"Spanish (Costa Rica)","es-DO":"Spanish (Dominican Republic)","es-EC":"Spanish (Ecuador)","es-SV":"Spanish (El Salvador)","es-GT":"Spanish (Guatemala)","es-HN":"Spanish (Honduras)","es-MX":"Spanish (Mexico)","es-NI":"Spanish (Nicaragua)","es-PA":"Spanish (Panama)","es-PY":"Spanish (Paraguay)","es-PE":"Spanish (Peru)","es-PR":"Spanish (Puerto Rico)","es-ES":"Spanish (Spain)","es-UY":"Spanish (Uruguay)","es-VE":"Spanish (Venezuela)",sx:"Sutu",sw:"Swahili",sv:"Swedish","sv-FI":"Swedish (Finland)","sv-SV":"Swedish (Sweden)",ta:"Tamil",tt:"Tatar",te:"Teluga",th:"Thai",tig:"Tigre",ts:"Tsonga",tn:"Tswana",tr:"Turkish",tk:"Turkmen",uk:"Ukrainian",hsb:"Upper Sorbian",ur:"Urdu",ve:"Venda",vi:"Vietnamese",vo:"Volapuk",wa:"Walloon",cy:"Welsh",xh:"Xhosa",ji:"Yiddish",zu:"Zulu"}[e]!==void 0&&(this.internal.languageSettings.languageCode=e,this.internal.languageSettings.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){this.internal.write("/Lang ("+this.internal.languageSettings.languageCode+")")}),this.internal.languageSettings.isSubscribed=!0)),this},_x=or.API,sS=_x.getCharWidthsArray=function(e,t){var r,n,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,u=t.kerning?t.kerning:a.metadata.Unicode.kerning,d=u.fof?u.fof:1,f=t.doKerning!==!1,m=0,h=e.length,g=0,p=l[0]||c,x=[];for(r=0;r<h;r++)n=e.charCodeAt(r),typeof a.metadata.widthOfString=="function"?x.push((a.metadata.widthOfGlyph(a.metadata.characterToGlyph(n))+o*(1e3/i)||0)/1e3):(m=f&&rs(u[n])==="object"&&!isNaN(parseInt(u[n][g],10))?u[n][g]/d:0,x.push((l[n]||p)/c+m)),g=n;return x},YU=_x.getStringUnitWidth=function(e,t){var r=(t=t||{}).fontSize||this.internal.getFontSize(),n=t.font||this.internal.getFont(),a=t.charSpace||this.internal.getCharSpace();return _x.processArabic&&(e=_x.processArabic(e)),typeof n.metadata.widthOfString=="function"?n.metadata.widthOfString(e,r,a)/r:sS.apply(this,arguments).reduce(function(i,o){return i+o},0)},XU=function(e,t,r,n){for(var a=[],i=0,o=e.length,l=0;i!==o&&l+t[i]<r;)l+=t[i],i++;a.push(e.slice(0,i));var c=i;for(l=0;i!==o;)l+t[i]>n&&(a.push(e.slice(c,i)),l=0,c=i),l+=t[i],i++;return c!==i&&a.push(e.slice(c,i)),a},ZU=function(e,t,r){r||(r={});var n,a,i,o,l,c,u,d=[],f=[d],m=r.textIndent||0,h=0,g=0,p=e.split(" "),x=sS.apply(this,[" ",r])[0];if(c=r.lineIndent===-1?p[0].length+2:r.lineIndent||0){var v=Array(c).join(" "),b=[];p.map(function(N){(N=N.split(/\s*\n/)).length>1?b=b.concat(N.map(function(_,j){return(j&&_.length?`
`:"")+_})):b.push(N[0])}),p=b,c=YU.apply(this,[v,r])}for(i=0,o=p.length;i<o;i++){var y=0;if(n=p[i],c&&n[0]==`
`&&(n=n.substr(1),y=1),m+h+(g=(a=sS.apply(this,[n,r])).reduce(function(N,_){return N+_},0))>t||y){if(g>t){for(l=XU.apply(this,[n,a,t-(m+h),t]),d.push(l.shift()),d=[l.pop()];l.length;)f.push([l.shift()]);g=a.slice(n.length-(d[0]?d[0].length:0)).reduce(function(N,_){return N+_},0)}else d=[n];f.push(d),m=g+c,h=x}else d.push(n),m+=h+g,h=x}return u=c?function(N,_){return(_?v:"")+N.join(" ")}:function(N){return N.join(" ")},f.map(u)},_x.splitTextToSize=function(e,t,r){var n,a=(r=r||{}).fontSize||this.internal.getFontSize(),i=(function(d){if(d.widths&&d.kerning)return{widths:d.widths,kerning:d.kerning};var f=this.internal.getFont(d.fontName,d.fontStyle),m="Unicode";return f.metadata[m]?{widths:f.metadata[m].widths||{0:1},kerning:f.metadata[m].kerning||{}}:{font:f.metadata,fontSize:this.internal.getFontSize(),charSpace:this.internal.getCharSpace()}}).call(this,r);n=Array.isArray(e)?e:String(e).split(/\r?\n/);var o=1*this.internal.scaleFactor*t/a;i.textIndent=r.textIndent?1*r.textIndent*this.internal.scaleFactor/a:0,i.lineIndent=r.lineIndent;var l,c,u=[];for(l=0,c=n.length;l<c;l++)u=u.concat(ZU.apply(this,[n[l],o,i]));return u},function(e){e.__fontmetrics__=e.__fontmetrics__||{};for(var t="0123456789abcdef",r="klmnopqrstuvwxyz",n={},a={},i=0;i<16;i++)n[r[i]]=t[i],a[t[i]]=r[i];var o=function(m){return"0x"+parseInt(m,10).toString(16)},l=e.__fontmetrics__.compress=function(m){var h,g,p,x,v=["{"];for(var b in m){if(h=m[b],isNaN(parseInt(b,10))?g="'"+b+"'":(b=parseInt(b,10),g=(g=o(b).slice(2)).slice(0,-1)+a[g.slice(-1)]),typeof h=="number")h<0?(p=o(h).slice(3),x="-"):(p=o(h).slice(2),x=""),p=x+p.slice(0,-1)+a[p.slice(-1)];else{if(rs(h)!=="object")throw new Error("Don't know what to do with value type "+rs(h)+".");p=l(h)}v.push(g+p)}return v.push("}"),v.join("")},c=e.__fontmetrics__.uncompress=function(m){if(typeof m!="string")throw new Error("Invalid argument passed to uncompress.");for(var h,g,p,x,v={},b=1,y=v,N=[],_="",j="",S=m.length-1,I=1;I<S;I+=1)(x=m[I])=="'"?h?(p=h.join(""),h=void 0):h=[]:h?h.push(x):x=="{"?(N.push([y,p]),y={},p=void 0):x=="}"?((g=N.pop())[0][g[1]]=y,p=void 0,y=g[0]):x=="-"?b=-1:p===void 0?n.hasOwnProperty(x)?(_+=n[x],p=parseInt(_,16)*b,b=1,_=""):_+=x:n.hasOwnProperty(x)?(j+=n[x],y[p]=parseInt(j,16)*b,b=1,p=void 0,j=""):j+=x;return v},u={codePages:["WinAnsiEncoding"],WinAnsiEncoding:c("{19m8n201n9q201o9r201s9l201t9m201u8m201w9n201x9o201y8o202k8q202l8r202m9p202q8p20aw8k203k8t203t8v203u9v2cq8s212m9t15m8w15n9w2dw9s16k8u16l9u17s9z17x8y17y9y}")},d={Unicode:{Courier:u,"Courier-Bold":u,"Courier-BoldOblique":u,"Courier-Oblique":u,Helvetica:u,"Helvetica-Bold":u,"Helvetica-BoldOblique":u,"Helvetica-Oblique":u,"Times-Roman":u,"Times-Bold":u,"Times-BoldItalic":u,"Times-Italic":u}},f={Unicode:{"Courier-Oblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-BoldItalic":c("{'widths'{k3o2q4ycx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2r202m2n2n3m2o3m2p5n202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5n4l4m4m4m4n4m4o4s4p4m4q4m4r4s4s4y4t2r4u3m4v4m4w3x4x5t4y4s4z4s5k3x5l4s5m4m5n3r5o3x5p4s5q4m5r5t5s4m5t3x5u3x5v2l5w1w5x2l5y3t5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q2l6r3m6s3r6t1w6u1w6v3m6w1w6x4y6y3r6z3m7k3m7l3m7m2r7n2r7o1w7p3r7q2w7r4m7s3m7t2w7u2r7v2n7w1q7x2n7y3t202l3mcl4mal2ram3man3mao3map3mar3mas2lat4uau1uav3maw3way4uaz2lbk2sbl3t'fof'6obo2lbp3tbq3mbr1tbs2lbu1ybv3mbz3mck4m202k3mcm4mcn4mco4mcp4mcq5ycr4mcs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz2w203k6o212m6o2dw2l2cq2l3t3m3u2l17s3x19m3m}'kerning'{cl{4qu5kt5qt5rs17ss5ts}201s{201ss}201t{cks4lscmscnscoscpscls2wu2yu201ts}201x{2wu2yu}2k{201ts}2w{4qx5kx5ou5qx5rs17su5tu}2x{17su5tu5ou}2y{4qx5kx5ou5qx5rs17ss5ts}'fof'-6ofn{17sw5tw5ou5qw5rs}7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qs}3v{17su5tu5os5qs}7p{17su5tu}ck{4qu5kt5qt5rs17ss5ts}4l{4qu5kt5qt5rs17ss5ts}cm{4qu5kt5qt5rs17ss5ts}cn{4qu5kt5qt5rs17ss5ts}co{4qu5kt5qt5rs17ss5ts}cp{4qu5kt5qt5rs17ss5ts}6l{4qu5ou5qw5rt17su5tu}5q{ckuclucmucnucoucpu4lu}5r{ckuclucmucnucoucpu4lu}7q{cksclscmscnscoscps4ls}6p{4qu5ou5qw5rt17sw5tw}ek{4qu5ou5qw5rt17su5tu}el{4qu5ou5qw5rt17su5tu}em{4qu5ou5qw5rt17su5tu}en{4qu5ou5qw5rt17su5tu}eo{4qu5ou5qw5rt17su5tu}ep{4qu5ou5qw5rt17su5tu}es{17ss5ts5qs4qu}et{4qu5ou5qw5rt17sw5tw}eu{4qu5ou5qw5rt17ss5ts}ev{17ss5ts5qs4qu}6z{17sw5tw5ou5qw5rs}fm{17sw5tw5ou5qw5rs}7n{201ts}fo{17sw5tw5ou5qw5rs}fp{17sw5tw5ou5qw5rs}fq{17sw5tw5ou5qw5rs}7r{cksclscmscnscoscps4ls}fs{17sw5tw5ou5qw5rs}ft{17su5tu}fu{17su5tu}fv{17su5tu}fw{17su5tu}fz{cksclscmscnscoscps4ls}}}"),"Helvetica-Bold":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),Courier:c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-BoldOblique":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Bold":c("{'widths'{k3q2q5ncx2r201n3m201o6o201s2l201t2l201u2l201w3m201x3m201y3m2k1t2l2l202m2n2n3m2o3m2p6o202q6o2r1w2s2l2t2l2u3m2v3t2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w3t3x3t3y3t3z3m4k5x4l4s4m4m4n4s4o4s4p4m4q3x4r4y4s4y4t2r4u3m4v4y4w4m4x5y4y4s4z4y5k3x5l4y5m4s5n3r5o4m5p4s5q4s5r6o5s4s5t4s5u4m5v2l5w1w5x2l5y3u5z3m6k2l6l3m6m3r6n2w6o3r6p2w6q2l6r3m6s3r6t1w6u2l6v3r6w1w6x5n6y3r6z3m7k3r7l3r7m2w7n2r7o2l7p3r7q3m7r4s7s3m7t3m7u2w7v2r7w1q7x2r7y3o202l3mcl4sal2lam3man3mao3map3mar3mas2lat4uau1yav3maw3tay4uaz2lbk2sbl3t'fof'6obo2lbp3rbr1tbs2lbu2lbv3mbz3mck4s202k3mcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw2r2m3rcy2rcz2rdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3rek3mel3mem3men3meo3mep3meq4ser2wes2wet2weu2wev2wew1wex1wey1wez1wfl3rfm3mfn3mfo3mfp3mfq3mfr3tfs3mft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3m3u2l17s4s19m3m}'kerning'{cl{4qt5ks5ot5qy5rw17sv5tv}201t{cks4lscmscnscoscpscls4wv}2k{201ts}2w{4qu5ku7mu5os5qx5ru17su5tu}2x{17su5tu5ou5qs}2y{4qv5kv7mu5ot5qz5ru17su5tu}'fof'-6o7t{cksclscmscnscoscps4ls}3u{17su5tu5os5qu}3v{17su5tu5os5qu}fu{17su5tu5ou5qu}7p{17su5tu5ou5qu}ck{4qt5ks5ot5qy5rw17sv5tv}4l{4qt5ks5ot5qy5rw17sv5tv}cm{4qt5ks5ot5qy5rw17sv5tv}cn{4qt5ks5ot5qy5rw17sv5tv}co{4qt5ks5ot5qy5rw17sv5tv}cp{4qt5ks5ot5qy5rw17sv5tv}6l{17st5tt5ou5qu}17s{ckuclucmucnucoucpu4lu4wu}5o{ckuclucmucnucoucpu4lu4wu}5q{ckzclzcmzcnzcozcpz4lz4wu}5r{ckxclxcmxcnxcoxcpx4lx4wu}5t{ckuclucmucnucoucpu4lu4wu}7q{ckuclucmucnucoucpu4lu}6p{17sw5tw5ou5qu}ek{17st5tt5qu}el{17st5tt5ou5qu}em{17st5tt5qu}en{17st5tt5qu}eo{17st5tt5qu}ep{17st5tt5ou5qu}es{17ss5ts5qu}et{17sw5tw5ou5qu}eu{17sw5tw5ou5qu}ev{17ss5ts5qu}6z{17sw5tw5ou5qu5rs}fm{17sw5tw5ou5qu5rs}fn{17sw5tw5ou5qu5rs}fo{17sw5tw5ou5qu5rs}fp{17sw5tw5ou5qu5rs}fq{17sw5tw5ou5qu5rs}7r{cktcltcmtcntcotcpt4lt5os}fs{17sw5tw5ou5qu5rs}ft{17su5tu5ou5qu}7m{5os}fv{17su5tu5ou5qu}fw{17su5tu5ou5qu}fz{cksclscmscnscoscps4ls}}}"),Symbol:c("{'widths'{k3uaw4r19m3m2k1t2l2l202m2y2n3m2p5n202q6o3k3m2s2l2t2l2v3r2w1t3m3m2y1t2z1wbk2sbl3r'fof'6o3n3m3o3m3p3m3q3m3r3m3s3m3t3m3u1w3v1w3w3r3x3r3y3r3z2wbp3t3l3m5v2l5x2l5z3m2q4yfr3r7v3k7w1o7x3k}'kerning'{'fof'-6o}}"),Helvetica:c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}"),"Helvetica-BoldOblique":c("{'widths'{k3s2q4scx1w201n3r201o6o201s1w201t1w201u1w201w3m201x3m201y3m2k1w2l2l202m2n2n3r2o3r2p5t202q6o2r1s2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v2l3w3u3x3u3y3u3z3x4k6l4l4s4m4s4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3r4v4s4w3x4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v2l5w1w5x2l5y3u5z3r6k2l6l3r6m3x6n3r6o3x6p3r6q2l6r3x6s3x6t1w6u1w6v3r6w1w6x5t6y3x6z3x7k3x7l3x7m2r7n3r7o2l7p3x7q3r7r4y7s3r7t3r7u3m7v2r7w1w7x2r7y3u202l3rcl4sal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3xbq3rbr1wbs2lbu2obv3rbz3xck4s202k3rcm4scn4sco4scp4scq6ocr4scs4mct4mcu4mcv4mcw1w2m2zcy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3res3ret3reu3rev3rew1wex1wey1wez1wfl3xfm3xfn3xfo3xfp3xfq3xfr3ufs3xft3xfu3xfv3xfw3xfz3r203k6o212m6o2dw2l2cq2l3t3r3u2l17s4m19m3r}'kerning'{cl{4qs5ku5ot5qs17sv5tv}201t{2ww4wy2yw}201w{2ks}201x{2ww4wy2yw}2k{201ts201xs}2w{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}2x{5ow5qs}2y{7qs4qu5kw5os5qw5rs17su5tu7tsfzs}'fof'-6o7p{17su5tu5ot}ck{4qs5ku5ot5qs17sv5tv}4l{4qs5ku5ot5qs17sv5tv}cm{4qs5ku5ot5qs17sv5tv}cn{4qs5ku5ot5qs17sv5tv}co{4qs5ku5ot5qs17sv5tv}cp{4qs5ku5ot5qs17sv5tv}6l{17st5tt5os}17s{2kwclvcmvcnvcovcpv4lv4wwckv}5o{2kucltcmtcntcotcpt4lt4wtckt}5q{2ksclscmscnscoscps4ls4wvcks}5r{2ks4ws}5t{2kwclvcmvcnvcovcpv4lv4wwckv}eo{17st5tt5os}fu{17su5tu5ot}6p{17ss5ts}ek{17st5tt5os}el{17st5tt5os}em{17st5tt5os}en{17st5tt5os}6o{201ts}ep{17st5tt5os}es{17ss5ts}et{17ss5ts}eu{17ss5ts}ev{17ss5ts}6z{17su5tu5os5qt}fm{17su5tu5os5qt}fn{17su5tu5os5qt}fo{17su5tu5os5qt}fp{17su5tu5os5qt}fq{17su5tu5os5qt}fs{17su5tu5os5qt}ft{17su5tu5ot}7m{5os}fv{17su5tu5ot}fw{17su5tu5ot}}}"),ZapfDingbats:c("{'widths'{k4u2k1w'fof'6o}'kerning'{'fof'-6o}}"),"Courier-Bold":c("{'widths'{k3w'fof'6o}'kerning'{'fof'-6o}}"),"Times-Italic":c("{'widths'{k3n2q4ycx2l201n3m201o5t201s2l201t2l201u2l201w3r201x3r201y3r2k1t2l2l202m2n2n3m2o3m2p5n202q5t2r1p2s2l2t2l2u3m2v4n2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v2l3w4n3x4n3y4n3z3m4k5w4l3x4m3x4n4m4o4s4p3x4q3x4r4s4s4s4t2l4u2w4v4m4w3r4x5n4y4m4z4s5k3x5l4s5m3x5n3m5o3r5p4s5q3x5r5n5s3x5t3r5u3r5v2r5w1w5x2r5y2u5z3m6k2l6l3m6m3m6n2w6o3m6p2w6q1w6r3m6s3m6t1w6u1w6v2w6w1w6x4s6y3m6z3m7k3m7l3m7m2r7n2r7o1w7p3m7q2w7r4m7s2w7t2w7u2r7v2s7w1v7x2s7y3q202l3mcl3xal2ram3man3mao3map3mar3mas2lat4wau1vav3maw4nay4waz2lbk2sbl4n'fof'6obo2lbp3mbq3obr1tbs2lbu1zbv3mbz3mck3x202k3mcm3xcn3xco3xcp3xcq5tcr4mcs3xct3xcu3xcv3xcw2l2m2ucy2lcz2ldl4mdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek3mel3mem3men3meo3mep3meq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr4nfs3mft3mfu3mfv3mfw3mfz2w203k6o212m6m2dw2l2cq2l3t3m3u2l17s3r19m3m}'kerning'{cl{5kt4qw}201s{201sw}201t{201tw2wy2yy6q-t}201x{2wy2yy}2k{201tw}2w{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}2x{17ss5ts5os}2y{7qs4qy7rs5ky7mw5os5qx5ru17su5tu}'fof'-6o6t{17ss5ts5qs}7t{5os}3v{5qs}7p{17su5tu5qs}ck{5kt4qw}4l{5kt4qw}cm{5kt4qw}cn{5kt4qw}co{5kt4qw}cp{5kt4qw}6l{4qs5ks5ou5qw5ru17su5tu}17s{2ks}5q{ckvclvcmvcnvcovcpv4lv}5r{ckuclucmucnucoucpu4lu}5t{2ks}6p{4qs5ks5ou5qw5ru17su5tu}ek{4qs5ks5ou5qw5ru17su5tu}el{4qs5ks5ou5qw5ru17su5tu}em{4qs5ks5ou5qw5ru17su5tu}en{4qs5ks5ou5qw5ru17su5tu}eo{4qs5ks5ou5qw5ru17su5tu}ep{4qs5ks5ou5qw5ru17su5tu}es{5ks5qs4qs}et{4qs5ks5ou5qw5ru17su5tu}eu{4qs5ks5qw5ru17su5tu}ev{5ks5qs4qs}ex{17ss5ts5qs}6z{4qv5ks5ou5qw5ru17su5tu}fm{4qv5ks5ou5qw5ru17su5tu}fn{4qv5ks5ou5qw5ru17su5tu}fo{4qv5ks5ou5qw5ru17su5tu}fp{4qv5ks5ou5qw5ru17su5tu}fq{4qv5ks5ou5qw5ru17su5tu}7r{5os}fs{4qv5ks5ou5qw5ru17su5tu}ft{17su5tu5qs}fu{17su5tu5qs}fv{17su5tu5qs}fw{17su5tu5qs}}}"),"Times-Roman":c("{'widths'{k3n2q4ycx2l201n3m201o6o201s2l201t2l201u2l201w2w201x2w201y2w2k1t2l2l202m2n2n3m2o3m2p5n202q6o2r1m2s2l2t2l2u3m2v3s2w1t2x2l2y1t2z1w3k3m3l3m3m3m3n3m3o3m3p3m3q3m3r3m3s3m203t2l203u2l3v1w3w3s3x3s3y3s3z2w4k5w4l4s4m4m4n4m4o4s4p3x4q3r4r4s4s4s4t2l4u2r4v4s4w3x4x5t4y4s4z4s5k3r5l4s5m4m5n3r5o3x5p4s5q4s5r5y5s4s5t4s5u3x5v2l5w1w5x2l5y2z5z3m6k2l6l2w6m3m6n2w6o3m6p2w6q2l6r3m6s3m6t1w6u1w6v3m6w1w6x4y6y3m6z3m7k3m7l3m7m2l7n2r7o1w7p3m7q3m7r4s7s3m7t3m7u2w7v3k7w1o7x3k7y3q202l3mcl4sal2lam3man3mao3map3mar3mas2lat4wau1vav3maw3say4waz2lbk2sbl3s'fof'6obo2lbp3mbq2xbr1tbs2lbu1zbv3mbz2wck4s202k3mcm4scn4sco4scp4scq5tcr4mcs3xct3xcu3xcv3xcw2l2m2tcy2lcz2ldl4sdm4sdn4sdo4sdp4sdq4sds4sdt4sdu4sdv4sdw4sdz3mek2wel2wem2wen2weo2wep2weq4mer2wes2wet2weu2wev2wew1wex1wey1wez1wfl3mfm3mfn3mfo3mfp3mfq3mfr3sfs3mft3mfu3mfv3mfw3mfz3m203k6o212m6m2dw2l2cq2l3t3m3u1w17s4s19m3m}'kerning'{cl{4qs5ku17sw5ou5qy5rw201ss5tw201ws}201s{201ss}201t{ckw4lwcmwcnwcowcpwclw4wu201ts}2k{201ts}2w{4qs5kw5os5qx5ru17sx5tx}2x{17sw5tw5ou5qu}2y{4qs5kw5os5qx5ru17sx5tx}'fof'-6o7t{ckuclucmucnucoucpu4lu5os5rs}3u{17su5tu5qs}3v{17su5tu5qs}7p{17sw5tw5qs}ck{4qs5ku17sw5ou5qy5rw201ss5tw201ws}4l{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cm{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cn{4qs5ku17sw5ou5qy5rw201ss5tw201ws}co{4qs5ku17sw5ou5qy5rw201ss5tw201ws}cp{4qs5ku17sw5ou5qy5rw201ss5tw201ws}6l{17su5tu5os5qw5rs}17s{2ktclvcmvcnvcovcpv4lv4wuckv}5o{ckwclwcmwcnwcowcpw4lw4wu}5q{ckyclycmycnycoycpy4ly4wu5ms}5r{cktcltcmtcntcotcpt4lt4ws}5t{2ktclvcmvcnvcovcpv4lv4wuckv}7q{cksclscmscnscoscps4ls}6p{17su5tu5qw5rs}ek{5qs5rs}el{17su5tu5os5qw5rs}em{17su5tu5os5qs5rs}en{17su5qs5rs}eo{5qs5rs}ep{17su5tu5os5qw5rs}es{5qs}et{17su5tu5qw5rs}eu{17su5tu5qs5rs}ev{5qs}6z{17sv5tv5os5qx5rs}fm{5os5qt5rs}fn{17sv5tv5os5qx5rs}fo{17sv5tv5os5qx5rs}fp{5os5qt5rs}fq{5os5qt5rs}7r{ckuclucmucnucoucpu4lu5os}fs{17sv5tv5os5qx5rs}ft{17ss5ts5qs}fu{17sw5tw5qs}fv{17sw5tw5qs}fw{17ss5ts5qs}fz{ckuclucmucnucoucpu4lu5os5rs}}}"),"Helvetica-Oblique":c("{'widths'{k3p2q4mcx1w201n3r201o6o201s1q201t1q201u1q201w2l201x2l201y2l2k1w2l1w202m2n2n3r2o3r2p5t202q6o2r1n2s2l2t2l2u2r2v3u2w1w2x2l2y1w2z1w3k3r3l3r3m3r3n3r3o3r3p3r3q3r3r3r3s3r203t2l203u2l3v1w3w3u3x3u3y3u3z3r4k6p4l4m4m4m4n4s4o4s4p4m4q3x4r4y4s4s4t1w4u3m4v4m4w3r4x5n4y4s4z4y5k4m5l4y5m4s5n4m5o3x5p4s5q4m5r5y5s4m5t4m5u3x5v1w5w1w5x1w5y2z5z3r6k2l6l3r6m3r6n3m6o3r6p3r6q1w6r3r6s3r6t1q6u1q6v3m6w1q6x5n6y3r6z3r7k3r7l3r7m2l7n3m7o1w7p3r7q3m7r4s7s3m7t3m7u3m7v2l7w1u7x2l7y3u202l3rcl4mal2lam3ran3rao3rap3rar3ras2lat4tau2pav3raw3uay4taz2lbk2sbl3u'fof'6obo2lbp3rbr1wbs2lbu2obv3rbz3xck4m202k3rcm4mcn4mco4mcp4mcq6ocr4scs4mct4mcu4mcv4mcw1w2m2ncy1wcz1wdl4sdm4ydn4ydo4ydp4ydq4yds4ydt4sdu4sdv4sdw4sdz3xek3rel3rem3ren3reo3rep3req5ter3mes3ret3reu3rev3rew1wex1wey1wez1wfl3rfm3rfn3rfo3rfp3rfq3rfr3ufs3xft3rfu3rfv3rfw3rfz3m203k6o212m6o2dw2l2cq2l3t3r3u1w17s4m19m3r}'kerning'{5q{4wv}cl{4qs5kw5ow5qs17sv5tv}201t{2wu4w1k2yu}201x{2wu4wy2yu}17s{2ktclucmucnu4otcpu4lu4wycoucku}2w{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}2x{17sy5ty5oy5qs}2y{7qs4qz5k1m17sy5ow5qx5rsfsu5ty7tufzu}'fof'-6o7p{17sv5tv5ow}ck{4qs5kw5ow5qs17sv5tv}4l{4qs5kw5ow5qs17sv5tv}cm{4qs5kw5ow5qs17sv5tv}cn{4qs5kw5ow5qs17sv5tv}co{4qs5kw5ow5qs17sv5tv}cp{4qs5kw5ow5qs17sv5tv}6l{17sy5ty5ow}do{17st5tt}4z{17st5tt}7s{fst}dm{17st5tt}dn{17st5tt}5o{ckwclwcmwcnwcowcpw4lw4wv}dp{17st5tt}dq{17st5tt}7t{5ow}ds{17st5tt}5t{2ktclucmucnu4otcpu4lu4wycoucku}fu{17sv5tv5ow}6p{17sy5ty5ow5qs}ek{17sy5ty5ow}el{17sy5ty5ow}em{17sy5ty5ow}en{5ty}eo{17sy5ty5ow}ep{17sy5ty5ow}es{17sy5ty5qs}et{17sy5ty5ow5qs}eu{17sy5ty5ow5qs}ev{17sy5ty5ow5qs}6z{17sy5ty5ow5qs}fm{17sy5ty5ow5qs}fn{17sy5ty5ow5qs}fo{17sy5ty5ow5qs}fp{17sy5ty5qs}fq{17sy5ty5ow5qs}7r{5ow}fs{17sy5ty5ow5qs}ft{17sv5tv5ow}7m{5ow}fv{17sv5tv5ow}fw{17sv5tv5ow}}}")}};e.events.push(["addFont",function(m){var h=m.font,g=f.Unicode[h.postScriptName];g&&(h.metadata.Unicode={},h.metadata.Unicode.widths=g.widths,h.metadata.Unicode.kerning=g.kerning);var p=d.Unicode[h.postScriptName];p&&(h.metadata.Unicode.encoding=p,h.encoding=p.codePages[0])}])}(or.API),function(e){var t=function(r){for(var n=r.length,a=new Uint8Array(n),i=0;i<n;i++)a[i]=r.charCodeAt(i);return a};e.API.events.push(["addFont",function(r){var n=void 0,a=r.font,i=r.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(n=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(l5(l)),o.metadata=e.API.TTFFont.open(l),o.metadata.Unicode=o.metadata.Unicode||{encoding:{},kerning:{},widths:[]},o.metadata.glyIdsUsed=[0]})(a,n)}}])}(or),or.API.addSvgAsImage=function(e,t,r,n,a,i,o,l){if(isNaN(t)||isNaN(r))throw hs.error("jsPDF.addSvgAsImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addSvgAsImage");if(isNaN(n)||isNaN(a))throw hs.error("jsPDF.addSvgAsImage: Invalid measurements",arguments),new Error("Invalid measurements (width and/or height) passed to jsPDF.addSvgAsImage");var c=document.createElement("canvas");c.width=n,c.height=a;var u=c.getContext("2d");u.fillStyle="#fff",u.fillRect(0,0,c.width,c.height);var d={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0},f=this;return(Fr.canvg?Promise.resolve(Fr.canvg):Vd(()=>import("./index.es-416u_pTw.js"),[])).catch(function(m){return Promise.reject(new Error("Could not load canvg: "+m))}).then(function(m){return m.default?m.default:m}).then(function(m){return m.fromString(u,e,d)},function(){return Promise.reject(new Error("Could not load canvg."))}).then(function(m){return m.render(d)}).then(function(){f.addImage(c.toDataURL("image/jpeg",1),t,r,n,a,o,l)})},or.API.putTotalPages=function(e){var t,r=0;parseInt(this.internal.getFont().id.substr(1),10)<15?(t=new RegExp(e,"g"),r=this.internal.getNumberOfPages()):(t=new RegExp(this.pdfEscape16(e,this.internal.getFont()),"g"),r=this.pdfEscape16(this.internal.getNumberOfPages()+"",this.internal.getFont()));for(var n=1;n<=this.internal.getNumberOfPages();n++)for(var a=0;a<this.internal.pages[n].length;a++)this.internal.pages[n][a]=this.internal.pages[n][a].replace(t,r);return this},or.API.viewerPreferences=function(e,t){var r;e=e||{},t=t||!1;var n,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=[],u=0,d=0,f=0;function m(g,p){var x,v=!1;for(x=0;x<g.length;x+=1)g[x]===p&&(v=!0);return v}if(this.internal.viewerpreferences===void 0&&(this.internal.viewerpreferences={},this.internal.viewerpreferences.configuration=JSON.parse(JSON.stringify(o)),this.internal.viewerpreferences.isSubscribed=!1),r=this.internal.viewerpreferences.configuration,e==="reset"||t===!0){var h=l.length;for(f=0;f<h;f+=1)r[l[f]].value=r[l[f]].defaultValue,r[l[f]].explicitSet=!1}if(rs(e)==="object"){for(a in e)if(i=e[a],m(l,a)&&i!==void 0){if(r[a].type==="boolean"&&typeof i=="boolean")r[a].value=i;else if(r[a].type==="name"&&m(r[a].valueSet,i))r[a].value=i;else if(r[a].type==="integer"&&Number.isInteger(i))r[a].value=i;else if(r[a].type==="array"){for(u=0;u<i.length;u+=1)if(n=!0,i[u].length===1&&typeof i[u][0]=="number")c.push(String(i[u]-1));else if(i[u].length>1){for(d=0;d<i[u].length;d+=1)typeof i[u][d]!="number"&&(n=!1);n===!0&&c.push([i[u][0]-1,i[u][1]-1].join(" "))}r[a].value="["+c.join(" ")+"]"}else r[a].value=r[a].defaultValue;r[a].explicitSet=!0}}return this.internal.viewerpreferences.isSubscribed===!1&&(this.internal.events.subscribe("putCatalog",function(){var g,p=[];for(g in r)r[g].explicitSet===!0&&(r[g].type==="name"?p.push("/"+g+" /"+r[g].value):p.push("/"+g+" "+r[g].value));p.length!==0&&this.internal.write(`/ViewerPreferences
<<
`+p.join(`
`)+`
>>`)}),this.internal.viewerpreferences.isSubscribed=!0),this.internal.viewerpreferences.configuration=r,this},function(e){var t=function(){var n='<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>',a=unescape(encodeURIComponent('<x:xmpmeta xmlns:x="adobe:ns:meta/">')),i=unescape(encodeURIComponent(n)),o=unescape(encodeURIComponent(this.internal.__metadata__.metadata)),l=unescape(encodeURIComponent("</jspdf:metadata></rdf:Description></rdf:RDF>")),c=unescape(encodeURIComponent("</x:xmpmeta>")),u=i.length+o.length+l.length+a.length+c.length;this.internal.__metadata__.metadata_object_number=this.internal.newObject(),this.internal.write("<< /Type /Metadata /Subtype /XML /Length "+u+" >>"),this.internal.write("stream"),this.internal.write(a+i+o+l+c),this.internal.write("endstream"),this.internal.write("endobj")},r=function(){this.internal.__metadata__.metadata_object_number&&this.internal.write("/Metadata "+this.internal.__metadata__.metadata_object_number+" 0 R")};e.addMetadata=function(n,a){return this.internal.__metadata__===void 0&&(this.internal.__metadata__={metadata:n,namespaceuri:a||"http://jspdf.default.namespaceuri/"},this.internal.events.subscribe("putCatalog",r),this.internal.events.subscribe("postPutResources",t)),this}}(or.API),function(e){var t=e.API,r=t.pdfEscape16=function(i,o){for(var l,c=o.metadata.Unicode.widths,u=["","0","00","000","0000"],d=[""],f=0,m=i.length;f<m;++f){if(l=o.metadata.characterToGlyph(i.charCodeAt(f)),o.metadata.glyIdsUsed.push(l),o.metadata.toUnicode[l]=i.charCodeAt(f),c.indexOf(l)==-1&&(c.push(l),c.push([parseInt(o.metadata.widthOfGlyph(l),10)])),l=="0")return d.join("");l=l.toString(16),d.push(u[4-l.length],l)}return d.join("")},n=function(i){var o,l,c,u,d,f,m;for(d=`/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo <<
/Registry (Adobe)
/Ordering (UCS)
/Supplement 0
>> def
/CMapName /Adobe-Identity-UCS def
/CMapType 2 def
1 begincodespacerange
<0000><ffff>
endcodespacerange`,c=[],f=0,m=(l=Object.keys(i).sort(function(h,g){return h-g})).length;f<m;f++)o=l[f],c.length>=100&&(d+=`
`+c.length+` beginbfchar
`+c.join(`
`)+`
endbfchar`,c=[]),i[o]!==void 0&&i[o]!==null&&typeof i[o].toString=="function"&&(u=("0000"+i[o].toString(16)).slice(-4),o=("0000"+(+o).toString(16)).slice(-4),c.push("<"+o+"><"+u+">"));return c.length&&(d+=`
`+c.length+` beginbfchar
`+c.join(`
`)+`
endbfchar
`),d+`endcmap
CMapName currentdict /CMap defineresource pop
end
end`};t.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,u=o.newObject,d=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="Identity-H"){for(var f=l.metadata.Unicode.widths,m=l.metadata.subset.encode(l.metadata.glyIdsUsed,1),h="",g=0;g<m.length;g++)h+=String.fromCharCode(m[g]);var p=u();d({data:h,addLength1:!0,objectId:p}),c("endobj");var x=u();d({data:n(l.metadata.toUnicode),addLength1:!0,objectId:x}),c("endobj");var v=u();c("<<"),c("/Type /FontDescriptor"),c("/FontName /"+$x(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 b=u();c("<<"),c("/Type /Font"),c("/BaseFont /"+$x(l.fontName)),c("/FontDescriptor "+v+" 0 R"),c("/W "+e.API.PDFObject.convert(f)),c("/CIDToGIDMap /Identity"),c("/DW 1000"),c("/Subtype /CIDFontType2"),c("/CIDSystemInfo"),c("<<"),c("/Supplement 0"),c("/Registry (Adobe)"),c("/Ordering ("+l.encoding+")"),c(">>"),c(">>"),c("endobj"),l.objectNumber=u(),c("<<"),c("/Type /Font"),c("/Subtype /Type0"),c("/ToUnicode "+x+" 0 R"),c("/BaseFont /"+$x(l.fontName)),c("/Encoding /"+l.encoding),c("/DescendantFonts ["+b+" 0 R]"),c(">>"),c("endobj"),l.isAlreadyPutted=!0}})(i)}]),t.events.push(["putFont",function(i){(function(o){var l=o.font,c=o.out,u=o.newObject,d=o.putStream;if(l.metadata instanceof e.API.TTFFont&&l.encoding==="WinAnsiEncoding"){for(var f=l.metadata.rawData,m="",h=0;h<f.length;h++)m+=String.fromCharCode(f[h]);var g=u();d({data:m,addLength1:!0,objectId:g}),c("endobj");var p=u();d({data:n(l.metadata.toUnicode),addLength1:!0,objectId:p}),c("endobj");var x=u();c("<<"),c("/Descent "+l.metadata.decender),c("/CapHeight "+l.metadata.capHeight),c("/StemV "+l.metadata.stemV),c("/Type /FontDescriptor"),c("/FontFile2 "+g+" 0 R"),c("/Flags 96"),c("/FontBBox "+e.API.PDFObject.convert(l.metadata.bbox)),c("/FontName /"+$x(l.fontName)),c("/ItalicAngle "+l.metadata.italicAngle),c("/Ascent "+l.metadata.ascender),c(">>"),c("endobj"),l.objectNumber=u();for(var v=0;v<l.metadata.hmtx.widths.length;v++)l.metadata.hmtx.widths[v]=parseInt(l.metadata.hmtx.widths[v]*(1e3/l.metadata.head.unitsPerEm));c("<</Subtype/TrueType/Type/Font/ToUnicode "+p+" 0 R/BaseFont/"+$x(l.fontName)+"/FontDescriptor "+x+" 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,u=i.y,d=i.options||{},f=i.mutex||{},m=f.pdfEscape,h=f.activeFontKey,g=f.fonts,p=h,x="",v=0,b="",y=g[p].encoding;if(g[p].encoding!=="Identity-H")return{text:l,x:c,y:u,options:d,mutex:f};for(b=l,p=h,Array.isArray(l)&&(b=l[0]),v=0;v<b.length;v+=1)g[p].metadata.hasOwnProperty("cmap")&&(o=g[p].metadata.cmap.unicode.codeMap[b[v].charCodeAt(0)]),o||b[v].charCodeAt(0)<256&&g[p].metadata.hasOwnProperty("Unicode")?x+=b[v]:x+="";var N="";return parseInt(p.slice(1))<14||y==="WinAnsiEncoding"?N=m(x,p).split("").map(function(_){return _.charCodeAt(0).toString(16)}).join(""):y==="Identity-H"&&(N=r(x,g[p])),f.isHex=!0,{text:N,x:c,y:u,options:d,mutex:f}};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 u=0;for(u=0;u<o.length;u+=1)Array.isArray(o[u])&&o[u].length===3?l.push([a(Object.assign({},c,{text:o[u][0]})).text,o[u][1],o[u][2]]):l.push(a(Object.assign({},c,{text:o[u]})).text);i.text=l}else i.text=a(Object.assign({},c,{text:o})).text}])}(or),function(e){var t=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};e.existsFileInVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0},e.addFileToVFS=function(r,n){return t.call(this),this.internal.vFS[r]=n,this},e.getFileFromVFS=function(r){return t.call(this),this.internal.vFS[r]!==void 0?this.internal.vFS[r]:null}}(or.API),function(e){e.__bidiEngine__=e.prototype.__bidiEngine__=function(n){var a,i,o,l,c,u,d,f=t,m=[[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]],h=[[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]],g={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},x=["(",")","(","<",">","<","[","]","[","{","}","{","«","»","«","‹","›","‹","⁅","⁆","⁅","⁽","⁾","⁽","₍","₎","₍","≤","≥","≤","〈","〉","〈","﹙","﹚","﹙","﹛","﹜","﹛","﹝","﹞","﹝","﹤","﹥","﹤"],v=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)$/),b=!1,y=0;this.__bidiEngine__={};var N=function(T){var k=T.charCodeAt(),V=k>>8,C=p[V];return C!==void 0?f[256*C+(255&k)]:V===252||V===253?"AL":v.test(V)?"L":V===8?"R":"N"},_=function(T){for(var k,V=0;V<T.length;V++){if((k=N(T.charAt(V)))==="L")return!1;if(k==="R")return!0}return!1},j=function(T,k,V,C){var R,H,q,L,M=k[C];switch(M){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":b=!1;break;case"N":case"AN":break;case"EN":b&&(M="AN");break;case"AL":b=!0,M="R";break;case"WS":case"BN":M="N";break;case"CS":C<1||C+1>=k.length||(R=V[C-1])!=="EN"&&R!=="AN"||(H=k[C+1])!=="EN"&&H!=="AN"?M="N":b&&(H="AN"),M=H===R?H:"N";break;case"ES":M=(R=C>0?V[C-1]:"B")==="EN"&&C+1<k.length&&k[C+1]==="EN"?"EN":"N";break;case"ET":if(C>0&&V[C-1]==="EN"){M="EN";break}if(b){M="N";break}for(q=C+1,L=k.length;q<L&&k[q]==="ET";)q++;M=q<L&&k[q]==="EN"?"EN":"N";break;case"NSM":if(o&&!l){for(L=k.length,q=C+1;q<L&&k[q]==="NSM";)q++;if(q<L){var z=T[C],K=z>=1425&&z<=2303||z===64286;if(R=k[q],K&&(R==="R"||R==="AL")){M="R";break}}}M=C<1||(R=k[C-1])==="B"?"N":V[C-1];break;case"B":b=!1,a=!0,M=y;break;case"S":i=!0,M="N"}return M},S=function(T,k,V){var C=T.split("");return V&&I(C,V,{hiLevel:y}),C.reverse(),k&&k.reverse(),C.join("")},I=function(T,k,V){var C,R,H,q,L,M=-1,z=T.length,K=0,E=[],A=y?h:m,O=[];for(b=!1,a=!1,i=!1,R=0;R<z;R++)O[R]=N(T[R]);for(H=0;H<z;H++){if(L=K,E[H]=j(T,O,E,H),C=240&(K=A[L][g[E[H]]]),K&=15,k[H]=q=A[K][5],C>0)if(C===16){for(R=M;R<H;R++)k[R]=1;M=-1}else M=-1;if(A[K][6])M===-1&&(M=H);else if(M>-1){for(R=M;R<H;R++)k[R]=q;M=-1}O[H]==="B"&&(k[H]=0),V.hiLevel|=q}i&&function(U,Y,J){for(var se=0;se<J;se++)if(U[se]==="S"){Y[se]=y;for(var ee=se-1;ee>=0&&U[ee]==="WS";ee--)Y[ee]=y}}(O,k,z)},P=function(T,k,V,C,R){if(!(R.hiLevel<T)){if(T===1&&y===1&&!a)return k.reverse(),void(V&&V.reverse());for(var H,q,L,M,z=k.length,K=0;K<z;){if(C[K]>=T){for(L=K+1;L<z&&C[L]>=T;)L++;for(M=K,q=L-1;M<q;M++,q--)H=k[M],k[M]=k[q],k[q]=H,V&&(H=V[M],V[M]=V[q],V[q]=H);K=L}K++}}},F=function(T,k,V){var C=T.split(""),R={hiLevel:y};return V||(V=[]),I(C,V,R),function(H,q,L){if(L.hiLevel!==0&&d)for(var M,z=0;z<H.length;z++)q[z]===1&&(M=x.indexOf(H[z]))>=0&&(H[z]=x[M+1])}(C,V,R),P(2,C,k,V,R),P(1,C,k,V,R),C.join("")};return this.__bidiEngine__.doBidiReorder=function(T,k,V){if(function(R,H){if(H)for(var q=0;q<R.length;q++)H[q]=q;l===void 0&&(l=_(R)),u===void 0&&(u=_(R))}(T,k),o||!c||u)if(o&&c&&l^u)y=l?1:0,T=S(T,k,V);else if(!o&&c&&u)y=l?1:0,T=F(T,k,V),T=S(T,k);else if(!o||l||c||u){if(o&&!c&&l^u)T=S(T,k),l?(y=0,T=F(T,k,V)):(y=1,T=F(T,k,V),T=S(T,k));else if(o&&l&&!c&&u)y=1,T=F(T,k,V),T=S(T,k);else if(!o&&!c&&l^u){var C=d;l?(y=1,T=F(T,k,V),y=0,d=!1,T=F(T,k,V),d=C):(y=0,T=F(T,k,V),T=S(T,k),y=1,d=!1,T=F(T,k,V),d=C,T=S(T,k))}}else y=0,T=F(T,k,V);else y=l?1:0,T=F(T,k,V);return T},this.__bidiEngine__.setOptions=function(T){T&&(o=T.isInputVisual,c=T.isOutputVisual,l=T.isInputRtl,u=T.isOutputRtl,d=T.isSymmetricSwapping)},this.__bidiEngine__.setOptions(n),this.__bidiEngine__};var t=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],r=new e.__bidiEngine__({isInputVisual:!0});e.API.events.push(["postProcessText",function(n){var a=n.text;n.x,n.y;var i=n.options||{};n.mutex,i.lang;var o=[];if(i.isInputVisual=typeof i.isInputVisual!="boolean"||i.isInputVisual,r.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([r.doBidiReorder(a[l][0]),a[l][1],a[l][2]]):o.push([r.doBidiReorder(a[l])]);n.text=o}else n.text=r.doBidiReorder(a);r.setOptions({isInputVisual:!0})}])}(or),or.API.TTFFont=function(){function e(t){var r;if(this.rawData=t,r=this.contents=new cp(t),this.contents.pos=4,r.readString(4)==="ttcf")throw new Error("TTCF not supported.");r.pos=0,this.parse(),this.subset=new WLe(this),this.registerTTF()}return e.open=function(t){return new e(t)},e.prototype.parse=function(){return this.directory=new PLe(this.contents),this.head=new DLe(this),this.name=new MLe(this),this.cmap=new Noe(this),this.toUnicode={},this.hhea=new ILe(this),this.maxp=new $Le(this),this.hmtx=new BLe(this),this.post=new LLe(this),this.os2=new RLe(this),this.loca=new VLe(this),this.glyf=new zLe(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},e.prototype.registerTTF=function(){var t,r,n,a,i;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=(function(){var o,l,c,u;for(u=[],o=0,l=(c=this.bbox).length;o<l;o++)t=c[o],u.push(Math.round(t*this.scaleFactor));return u}).call(this),this.stemV=0,this.post.exists?(n=255&(a=this.post.italic_angle),32768&(r=a>>16)&&(r=-(1+(65535^r))),this.italicAngle=+(r+"."+n)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(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 r;return((r=this.cmap.unicode)!=null?r.codeMap[t]:void 0)||0},e.prototype.widthOfGlyph=function(t){var r;return r=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(t).advance*r},e.prototype.widthOfString=function(t,r,n){var 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))+n*(1e3/r)||0;return o*(r/1e3)},e.prototype.lineHeight=function(t,r){var n;return r==null&&(r=!1),n=r?this.lineGap:0,(this.ascender+n-this.decender)/1e3*t},e}();var od,cp=function(){function e(t){this.data=t??[],this.pos=0,this.length=this.data.length}return e.prototype.readByte=function(){return this.data[this.pos++]},e.prototype.writeByte=function(t){return this.data[this.pos++]=t},e.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},e.prototype.writeUInt32=function(t){return this.writeByte(t>>>24&255),this.writeByte(t>>16&255),this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt32=function(){var t;return(t=this.readUInt32())>=2147483648?t-4294967296:t},e.prototype.writeInt32=function(t){return t<0&&(t+=4294967296),this.writeUInt32(t)},e.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},e.prototype.writeUInt16=function(t){return this.writeByte(t>>8&255),this.writeByte(255&t)},e.prototype.readInt16=function(){var t;return(t=this.readUInt16())>=32768?t-65536:t},e.prototype.writeInt16=function(t){return t<0&&(t+=65536),this.writeUInt16(t)},e.prototype.readString=function(t){var r,n;for(n=[],r=0;0<=t?r<t:r>t;r=0<=t?++r:--r)n[r]=String.fromCharCode(this.readByte());return n.join("")},e.prototype.writeString=function(t){var r,n,a;for(a=[],r=0,n=t.length;0<=n?r<n:r>n;r=0<=n?++r:--r)a.push(this.writeByte(t.charCodeAt(r)));return a},e.prototype.readShort=function(){return this.readInt16()},e.prototype.writeShort=function(t){return this.writeInt16(t)},e.prototype.readLongLong=function(){var t,r,n,a,i,o,l,c;return t=this.readByte(),r=this.readByte(),n=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^r)+1099511627776*(255^n)+4294967296*(255^a)+16777216*(255^i)+65536*(255^o)+256*(255^l)+(255^c)+1):72057594037927940*t+281474976710656*r+1099511627776*n+4294967296*a+16777216*i+65536*o+256*l+c},e.prototype.writeLongLong=function(t){var r,n;return r=Math.floor(t/4294967296),n=4294967295&t,this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r),this.writeByte(n>>24&255),this.writeByte(n>>16&255),this.writeByte(n>>8&255),this.writeByte(255&n)},e.prototype.readInt=function(){return this.readInt32()},e.prototype.writeInt=function(t){return this.writeInt32(t)},e.prototype.read=function(t){var r,n;for(r=[],n=0;0<=t?n<t:n>t;n=0<=t?++n:--n)r.push(this.readByte());return r},e.prototype.write=function(t){var r,n,a,i;for(i=[],n=0,a=t.length;n<a;n++)r=t[n],i.push(this.writeByte(r));return i},e}(),PLe=function(){var e;function t(r){var n,a,i;for(this.scalarType=r.readInt(),this.tableCount=r.readShort(),this.searchRange=r.readShort(),this.entrySelector=r.readShort(),this.rangeShift=r.readShort(),this.tables={},a=0,i=this.tableCount;0<=i?a<i:a>i;a=0<=i?++a:--a)n={tag:r.readString(4),checksum:r.readInt(),offset:r.readInt(),length:r.readInt()},this.tables[n.tag]=n}return t.prototype.encode=function(r){var n,a,i,o,l,c,u,d,f,m,h,g,p;for(p in h=Object.keys(r).length,c=Math.log(2),f=16*Math.floor(Math.log(h)/c),o=Math.floor(f/c),d=16*h-f,(a=new cp).writeInt(this.scalarType),a.writeShort(h),a.writeShort(f),a.writeShort(o),a.writeShort(d),i=16*h,u=a.pos+i,l=null,g=[],r)for(m=r[p],a.writeString(p),a.writeInt(e(m)),a.writeInt(u),a.writeInt(m.length),g=g.concat(m),p==="head"&&(l=u),u+=m.length;u%4;)g.push(0),u++;return a.write(g),n=2981146554-e(a.data),a.pos=l+8,a.writeUInt32(n),a.data},e=function(r){var n,a,i,o;for(r=Soe.call(r);r.length%4;)r.push(0);for(i=new cp(r),a=0,n=0,o=r.length;n<o;n=n+=4)a+=i.readUInt32();return 4294967295&a},t}(),OLe={}.hasOwnProperty,of=function(e,t){for(var r in t)OLe.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e};od=function(){function e(t){var r;this.file=t,r=this.file.directory.tables[this.tag],this.exists=!!r,r&&(this.offset=r.offset,this.length=r.length,this.parse(this.file.contents))}return e.prototype.parse=function(){},e.prototype.encode=function(){},e.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},e}();var DLe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="head",e.prototype.parse=function(t){return t.pos=this.offset,this.version=t.readInt(),this.revision=t.readInt(),this.checkSumAdjustment=t.readInt(),this.magicNumber=t.readInt(),this.flags=t.readShort(),this.unitsPerEm=t.readShort(),this.created=t.readLongLong(),this.modified=t.readLongLong(),this.xMin=t.readShort(),this.yMin=t.readShort(),this.xMax=t.readShort(),this.yMax=t.readShort(),this.macStyle=t.readShort(),this.lowestRecPPEM=t.readShort(),this.fontDirectionHint=t.readShort(),this.indexToLocFormat=t.readShort(),this.glyphDataFormat=t.readShort()},e.prototype.encode=function(t){var r;return(r=new cp).writeInt(this.version),r.writeInt(this.revision),r.writeInt(this.checkSumAdjustment),r.writeInt(this.magicNumber),r.writeShort(this.flags),r.writeShort(this.unitsPerEm),r.writeLongLong(this.created),r.writeLongLong(this.modified),r.writeShort(this.xMin),r.writeShort(this.yMin),r.writeShort(this.xMax),r.writeShort(this.yMax),r.writeShort(this.macStyle),r.writeShort(this.lowestRecPPEM),r.writeShort(this.fontDirectionHint),r.writeShort(t),r.writeShort(this.glyphDataFormat),r.data},e}(),iq=function(){function e(t,r){var n,a,i,o,l,c,u,d,f,m,h,g,p,x,v,b,y;switch(this.platformID=t.readUInt16(),this.encodingID=t.readShort(),this.offset=r+t.readInt(),f=t.pos,t.pos=this.offset,this.format=t.readUInt16(),this.length=t.readUInt16(),this.language=t.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(c=0;c<256;++c)this.codeMap[c]=t.readByte();break;case 4:for(h=t.readUInt16(),m=h/2,t.pos+=6,i=function(){var N,_;for(_=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)_.push(t.readUInt16());return _}(),t.pos+=2,p=function(){var N,_;for(_=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)_.push(t.readUInt16());return _}(),u=function(){var N,_;for(_=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)_.push(t.readUInt16());return _}(),d=function(){var N,_;for(_=[],c=N=0;0<=m?N<m:N>m;c=0<=m?++N:--N)_.push(t.readUInt16());return _}(),a=(this.length-t.pos+this.offset)/2,l=function(){var N,_;for(_=[],c=N=0;0<=a?N<a:N>a;c=0<=a?++N:--N)_.push(t.readUInt16());return _}(),c=v=0,y=i.length;v<y;c=++v)for(x=i[c],n=b=g=p[c];g<=x?b<=x:b>=x;n=g<=x?++b:--b)d[c]===0?o=n+u[c]:(o=l[d[c]/2+(n-g)-(m-c)]||0)!==0&&(o+=u[c]),this.codeMap[n]=65535&o}t.pos=f}return e.encode=function(t,r){var n,a,i,o,l,c,u,d,f,m,h,g,p,x,v,b,y,N,_,j,S,I,P,F,T,k,V,C,R,H,q,L,M,z,K,E,A,O,U,Y,J,se,ee,ie,Ee,te;switch(C=new cp,o=Object.keys(t).sort(function(Ue,W){return Ue-W}),r){case"macroman":for(p=0,x=function(){var Ue=[];for(g=0;g<256;++g)Ue.push(0);return Ue}(),b={0:0},i={},R=0,M=o.length;R<M;R++)b[ee=t[a=o[R]]]==null&&(b[ee]=++p),i[a]={old:t[a],new:b[t[a]]},x[a]=b[t[a]];return C.writeUInt16(1),C.writeUInt16(0),C.writeUInt32(12),C.writeUInt16(0),C.writeUInt16(262),C.writeUInt16(0),C.write(x),{charMap:i,subtable:C.data,maxGlyphID:p+1};case"unicode":for(k=[],f=[],y=0,b={},n={},v=u=null,H=0,z=o.length;H<z;H++)b[_=t[a=o[H]]]==null&&(b[_]=++y),n[a]={old:_,new:b[_]},l=b[_]-a,v!=null&&l===u||(v&&f.push(v),k.push(a),u=l),v=a;for(v&&f.push(v),f.push(65535),k.push(65535),F=2*(P=k.length),I=2*Math.pow(Math.log(P)/Math.LN2,2),m=Math.log(I/2)/Math.LN2,S=2*P-I,c=[],j=[],h=[],g=q=0,K=k.length;q<K;g=++q){if(T=k[g],d=f[g],T===65535){c.push(0),j.push(0);break}if(T-(V=n[T].new)>=32768)for(c.push(0),j.push(2*(h.length+P-g)),a=L=T;T<=d?L<=d:L>=d;a=T<=d?++L:--L)h.push(n[a].new);else c.push(V-T),j.push(0)}for(C.writeUInt16(3),C.writeUInt16(1),C.writeUInt32(12),C.writeUInt16(4),C.writeUInt16(16+8*P+2*h.length),C.writeUInt16(0),C.writeUInt16(F),C.writeUInt16(I),C.writeUInt16(m),C.writeUInt16(S),J=0,E=f.length;J<E;J++)a=f[J],C.writeUInt16(a);for(C.writeUInt16(0),se=0,A=k.length;se<A;se++)a=k[se],C.writeUInt16(a);for(ie=0,O=c.length;ie<O;ie++)l=c[ie],C.writeUInt16(l);for(Ee=0,U=j.length;Ee<U;Ee++)N=j[Ee],C.writeUInt16(N);for(te=0,Y=h.length;te<Y;te++)p=h[te],C.writeUInt16(p);return{charMap:n,subtable:C.data,maxGlyphID:y+1}}},e}(),Noe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="cmap",e.prototype.parse=function(t){var r,n,a;for(t.pos=this.offset,this.version=t.readUInt16(),a=t.readUInt16(),this.tables=[],this.unicode=null,n=0;0<=a?n<a:n>a;n=0<=a?++n:--n)r=new iq(t,this.offset),this.tables.push(r),r.isUnicode&&this.unicode==null&&(this.unicode=r);return!0},e.encode=function(t,r){var n,a;return r==null&&(r="macroman"),n=iq.encode(t,r),(a=new cp).writeUInt16(0),a.writeUInt16(1),n.table=a.data.concat(n.subtable),n},e}(),ILe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),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}(),RLe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="OS/2",e.prototype.parse=function(t){if(t.pos=this.offset,this.version=t.readUInt16(),this.averageCharWidth=t.readShort(),this.weightClass=t.readUInt16(),this.widthClass=t.readUInt16(),this.type=t.readShort(),this.ySubscriptXSize=t.readShort(),this.ySubscriptYSize=t.readShort(),this.ySubscriptXOffset=t.readShort(),this.ySubscriptYOffset=t.readShort(),this.ySuperscriptXSize=t.readShort(),this.ySuperscriptYSize=t.readShort(),this.ySuperscriptXOffset=t.readShort(),this.ySuperscriptYOffset=t.readShort(),this.yStrikeoutSize=t.readShort(),this.yStrikeoutPosition=t.readShort(),this.familyClass=t.readShort(),this.panose=function(){var r,n;for(n=[],r=0;r<10;++r)n.push(t.readByte());return n}(),this.charRange=function(){var r,n;for(n=[],r=0;r<4;++r)n.push(t.readInt());return n}(),this.vendorID=t.readString(4),this.selection=t.readShort(),this.firstCharIndex=t.readShort(),this.lastCharIndex=t.readShort(),this.version>0&&(this.ascent=t.readShort(),this.descent=t.readShort(),this.lineGap=t.readShort(),this.winAscent=t.readShort(),this.winDescent=t.readShort(),this.codePageRange=function(){var r,n;for(n=[],r=0;r<2;r=++r)n.push(t.readInt());return n}(),this.version>1))return this.xHeight=t.readShort(),this.capHeight=t.readShort(),this.defaultChar=t.readShort(),this.breakChar=t.readShort(),this.maxContext=t.readShort()},e}(),LLe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="post",e.prototype.parse=function(t){var r,n,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(n=t.readUInt16(),this.glyphNameIndex=[],i=0;0<=n?i<n:i>n;i=0<=n?++i:--i)this.glyphNameIndex.push(t.readUInt16());for(this.names=[],a=[];t.pos<this.offset+this.length;)r=t.readByte(),a.push(this.names.push(t.readString(r)));return a;case 151552:return n=t.readUInt16(),this.offsets=t.read(n);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}(),FLe=function(e,t){this.raw=e,this.length=e.length,this.platformID=t.platformID,this.encodingID=t.encodingID,this.languageID=t.languageID},MLe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="name",e.prototype.parse=function(t){var r,n,a,i,o,l,c,u,d,f,m;for(t.pos=this.offset,t.readShort(),r=t.readShort(),l=t.readShort(),n=[],i=0;0<=r?i<r:i>r;i=0<=r?++i:--i)n.push({platformID:t.readShort(),encodingID:t.readShort(),languageID:t.readShort(),nameID:t.readShort(),length:t.readShort(),offset:this.offset+l+t.readShort()});for(c={},i=d=0,f=n.length;d<f;i=++d)a=n[i],t.pos=a.offset,u=t.readString(a.length),o=new FLe(u,a),c[m=a.nameID]==null&&(c[m]=[]),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}(),$Le=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),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}(),BLe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="hmtx",e.prototype.parse=function(t){var r,n,a,i,o,l,c;for(t.pos=this.offset,this.metrics=[],r=0,l=this.file.hhea.numberOfMetrics;0<=l?r<l:r>l;r=0<=l?++r:--r)this.metrics.push({advance:t.readUInt16(),lsb:t.readInt16()});for(a=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=function(){var u,d;for(d=[],r=u=0;0<=a?u<a:u>a;r=0<=a?++u:--u)d.push(t.readInt16());return d}(),this.widths=(function(){var u,d,f,m;for(m=[],u=0,d=(f=this.metrics).length;u<d;u++)i=f[u],m.push(i.advance);return m}).call(this),n=this.widths[this.widths.length-1],c=[],r=o=0;0<=a?o<a:o>a;r=0<=a?++o:--o)c.push(this.widths.push(n));return c},e.prototype.forGlyph=function(t){return t in this.metrics?this.metrics[t]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[t-this.metrics.length]}},e}(),Soe=[].slice,zLe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="glyf",e.prototype.parse=function(){return this.cache={}},e.prototype.glyphFor=function(t){var r,n,a,i,o,l,c,u,d,f;return t in this.cache?this.cache[t]:(i=this.file.loca,r=this.file.contents,n=i.indexOf(t),(a=i.lengthOf(t))===0?this.cache[t]=null:(r.pos=this.offset+n,o=(l=new cp(r.read(a))).readShort(),u=l.readShort(),f=l.readShort(),c=l.readShort(),d=l.readShort(),this.cache[t]=o===-1?new qLe(l,u,f,c,d):new ULe(l,o,u,f,c,d),this.cache[t]))},e.prototype.encode=function(t,r,n){var a,i,o,l,c;for(o=[],i=[],l=0,c=r.length;l<c;l++)a=t[r[l]],i.push(o.length),a&&(o=o.concat(a.encode(n)));return i.push(o.length),{table:o,offsets:i}},e}(),ULe=function(){function e(t,r,n,a,i,o){this.raw=t,this.numberOfContours=r,this.xMin=n,this.yMin=a,this.xMax=i,this.yMax=o,this.compound=!1}return e.prototype.encode=function(){return this.raw.data},e}(),qLe=function(){function e(t,r,n,a,i){var o,l;for(this.raw=t,this.xMin=r,this.yMin=n,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,r,n;for(r=new cp(Soe.call(this.raw.data)),t=0,n=this.glyphIDs.length;t<n;++t)r.pos=this.glyphOffsets[t];return r.data},e}(),VLe=function(){function e(){return e.__super__.constructor.apply(this,arguments)}return of(e,od),e.prototype.tag="loca",e.prototype.parse=function(t){var r,n;return t.pos=this.offset,r=this.file.head.indexToLocFormat,this.offsets=r===0?(function(){var a,i;for(i=[],n=0,a=this.length;n<a;n+=2)i.push(2*t.readUInt16());return i}).call(this):(function(){var a,i;for(i=[],n=0,a=this.length;n<a;n+=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,r){for(var n=new Uint32Array(this.offsets.length),a=0,i=0,o=0;o<n.length;++o)if(n[o]=a,i<r.length&&r[i]==o){++i,n[o]=a;var l=this.offsets[o],c=this.offsets[o+1]-l;c>0&&(a+=c)}for(var u=new Array(4*n.length),d=0;d<n.length;++d)u[4*d+3]=255&n[d],u[4*d+2]=(65280&n[d])>>8,u[4*d+1]=(16711680&n[d])>>16,u[4*d]=(4278190080&n[d])>>24;return u},e}(),WLe=function(){function e(t){this.font=t,this.subset={},this.unicodes={},this.next=33}return e.prototype.generateCmap=function(){var t,r,n,a,i;for(r in a=this.font.cmap.tables[0].codeMap,t={},i=this.subset)n=i[r],t[r]=a[n];return t},e.prototype.glyphsFor=function(t){var r,n,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 r=[],a)(n=a[i])!=null&&n.compound&&r.push.apply(r,n.glyphIDs);if(r.length>0)for(i in c=this.glyphsFor(r))n=c[i],a[i]=n;return a},e.prototype.encode=function(t,r){var n,a,i,o,l,c,u,d,f,m,h,g,p,x,v;for(a in n=Noe.encode(this.generateCmap(),"unicode"),o=this.glyphsFor(t),h={0:0},v=n.charMap)h[(c=v[a]).old]=c.new;for(g in m=n.maxGlyphID,o)g in h||(h[g]=m++);return d=function(b){var y,N;for(y in N={},b)N[b[y]]=y;return N}(h),f=Object.keys(d).sort(function(b,y){return b-y}),p=function(){var b,y,N;for(N=[],b=0,y=f.length;b<y;b++)l=f[b],N.push(d[l]);return N}(),i=this.font.glyf.encode(o,p,h),u=this.font.loca.encode(i.offsets,p),x={cmap:this.font.cmap.raw(),glyf:i.table,loca:u,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(r)},this.font.os2.exists&&(x["OS/2"]=this.font.os2.raw()),this.font.directory.encode(x)},e}();or.API.PDFObject=function(){var e;function t(){}return e=function(r,n){return(Array(n+1).join("0")+r).slice(-n)},t.convert=function(r){var n,a,i,o;if(Array.isArray(r))return"["+function(){var l,c,u;for(u=[],l=0,c=r.length;l<c;l++)n=r[l],u.push(t.convert(n));return u}().join(" ")+"]";if(typeof r=="string")return"/"+r;if(r!=null&&r.isString)return"("+r+")";if(r instanceof Date)return"(D:"+e(r.getUTCFullYear(),4)+e(r.getUTCMonth(),2)+e(r.getUTCDate(),2)+e(r.getUTCHours(),2)+e(r.getUTCMinutes(),2)+e(r.getUTCSeconds(),2)+"Z)";if({}.toString.call(r)==="[object Object]"){for(a in i=["<<"],r)o=r[a],i.push("/"+a+" "+t.convert(o));return i.push(">>"),i.join(`
`)}return""+r},t}();const N2=Object.freeze(Object.defineProperty({__proto__:null,AcroForm:jLe,AcroFormAppearance:nr,AcroFormButton:ui,AcroFormCheckBox:pw,AcroFormChoiceField:z0,AcroFormComboBox:q0,AcroFormEditBox:hw,AcroFormListBox:U0,AcroFormPasswordField:gw,AcroFormPushButton:mw,AcroFormRadioButton:V0,AcroFormTextField:Km,GState:_2,ShadingPattern:dm,TilingPattern:j0,default:or,jsPDF:or},Symbol.toStringTag,{value:"Module"}));function HLe(){const{isAdmin:e}=Ur(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState([]),[o,l]=w.useState(!0),[c,u]=w.useState("trainer"),[d,f]=w.useState(null),[m,h]=w.useState(!1),g=w.useRef(null),[p,x]=w.useState(!1),[v,b]=w.useState("all"),[y,N]=w.useState(!1),[_,j]=w.useState(!1);w.useEffect(()=>{if(!e){t("/");return}S()},[e,t]),w.useEffect(()=>{if(!d)return;const q=setTimeout(()=>{const L=g.current;if(!L)return;const M=L.getContext("2d");if(!M)return;L.width=500,L.height=150,M.fillStyle="#ffffff",M.fillRect(0,0,L.width,L.height),M.strokeStyle="#000000",M.lineWidth=2,M.lineCap="round",M.lineJoin="round";let z=!1;const K=U=>{const Y=L.getBoundingClientRect(),J=L.width/Y.width,se=L.height/Y.height,ee=(U.clientX-Y.left)*J,ie=(U.clientY-Y.top)*se;return{x:ee,y:ie}},E=U=>{U.preventDefault(),L.setPointerCapture(U.pointerId),z=!0;const{x:Y,y:J}=K(U);M.beginPath(),M.moveTo(Y,J),x(!0)},A=U=>{if(!z)return;U.preventDefault();const{x:Y,y:J}=K(U);M.lineTo(Y,J),M.stroke()},O=U=>{if(z){U.preventDefault(),z=!1;try{L.releasePointerCapture(U.pointerId)}catch{}M.closePath()}};L.style.touchAction="none",L.addEventListener("pointerdown",E),L.addEventListener("pointermove",A),L.addEventListener("pointerup",O),L.addEventListener("pointerleave",O),L._cleanupSignature=()=>{L.removeEventListener("pointerdown",E),L.removeEventListener("pointermove",A),L.removeEventListener("pointerup",O),L.removeEventListener("pointerleave",O)}},100);return()=>{clearTimeout(q);const L=g.current;L&&L._cleanupSignature&&L._cleanupSignature()}},[d]);const S=async()=>{l(!0);try{const{data:q,error:L}=await he.from("trainer_contracts").select(`
id,
status,
signed_at,
counter_signed,
counter_signed_at,
signature_data,
counter_signature_data,
created_at,
contract_data,
trainer:trainer_profiles(id, name, email)
`).order("created_at",{ascending:!1});if(L)throw L;const{data:M,error:z}=await he.from("service_contracts").select(`
id,
status,
signed_by_school,
signed_by_school_at,
created_at,
contract_data,
school_request:school_requests(id, school_name, contact_name, contact_email),
trainer_application:trainer_applications(
trainer:trainer_profiles(name, email)
)
`).order("created_at",{ascending:!1});if(z)throw z;n(q||[]),i(M||[])}catch(q){console.error("Error loading contracts:",q),ae.error("Erreur lors du chargement des contrats")}finally{l(!1)}},I=()=>{const q=g.current;if(!q)return;const L=q.getContext("2d");L&&(L.fillStyle="#ffffff",L.fillRect(0,0,q.width,q.height),x(!1))},P=async()=>{const q=g.current;if(!(!q||!d))try{if(!p){ae.error("Veuillez signer avant de valider");return}h(!0);const L=q.toDataURL("image/png"),{error:M}=await he.from("trainer_contracts").update({counter_signature_data:L,counter_signed_at:new Date().toISOString(),counter_signed:!0}).eq("id",d.id);if(M)throw M;ae.success("Contrat contre-signé avec succès ! Le formateur est maintenant affilié."),f(null),S()}catch(L){console.error("Error counter-signing:",L),ae.error("Erreur lors de la contre-signature")}finally{h(!1)}},F=async q=>{try{const L=new or,M=L.internal.pageSize.getWidth(),z=L.internal.pageSize.getHeight(),K=15;let E=K;const A=q.contract_data.trainerName||"XXXXXX",O=q.contract_data,U=(Z=30)=>{E>z-Z&&(L.addPage(),E=K)},Y=(Z,le=0)=>{L.setFont("helvetica","normal"),L.setFontSize(9);const re=L.splitTextToSize(Z,M-2*K-le);U(re.length*4+5),L.text(re,K+le,E),E+=re.length*4+3},J=(Z,le=5)=>{Z.forEach((re,oe)=>{const fe=`${oe+1}. ${re}`,Fe=L.splitTextToSize(fe,M-2*K-le);U(Fe.length*4+2),L.text(Fe,K+le,E),E+=Fe.length*4+1}),E+=2},se=(Z,le=5)=>{Z.forEach(re=>{const oe=`• ${re}`,fe=L.splitTextToSize(oe,M-2*K-le);U(fe.length*4+2),L.text(fe,K+le,E),E+=fe.length*4+1}),E+=2};L.setFillColor(30,64,175),L.rect(0,0,M,35,"F"),L.setTextColor(255,255,255),L.setFontSize(18),L.setFont("helvetica","bold"),L.text("CONTRAT DE PRESTATION DE SERVICES",M/2,20,{align:"center"}),L.setFontSize(11),L.text("PedagoBridge - Qalam Software",M/2,28,{align:"center"}),E=50,L.setTextColor(0,0,0),L.setFontSize(9);const ee=q.counter_signed?"CERTIFIÉ":q.status==="signed"?"EN ATTENTE CONTRE-SIGNATURE":"EN ATTENTE",ie=q.counter_signed?[34,197,94]:q.status==="signed"?[245,158,11]:[156,163,175];L.setFillColor(ie[0],ie[1],ie[2]),L.setTextColor(255,255,255),L.roundedRect(K,E,50,7,2,2,"F"),L.text(ee,K+25,E+5,{align:"center"}),E+=15,L.setTextColor(0,0,0),Y("Entre les soussignés :"),E+=2,Y("Qalam Software SASU, société par actions simplifiée unipersonnelle au capital de 500 euros, immatriculée au RCS de Paris, dont le siège social est situé 40 rue Alexandre Dumas, 75011 Paris, représentée par M. Ayoub Mekouar, en qualité de Président, ci‑après dénommée « Qalam », Créateur du Collectif PedagoBridge"),E+=2,Y("Et"),E+=2;let Ee=`${A}, ${O.legalForm||"[forme juridique à préciser, ou Nom et Prénom pour un indépendant]"}, `;Ee+=O.capitalAmount?`au capital de ${O.capitalAmount} euros, `:"[au capital de ___ euros (si société)], ",Ee+=`dont le siège social est situé ${O.headquartersAddress||"[adresse complète, ou adresse personnelle pour un indépendant]"}, `,Ee+=`représentée par ${O.legalRepresentativeName||"[Nom et fonction, ou lui-même pour un indépendant]"}`,O.legalRepresentativeFunction&&(Ee+=`, en qualité de ${O.legalRepresentativeFunction}`),Ee+=`, ci‑après dénommée « ${A} »,`,Y(Ee),E+=2,Y("Ci‑après dénommées individuellement la « Partie » ou collectivement les « Parties »."),E+=5,U(40),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 1 – Objet",K,E),E+=6,Y(`Le présent contrat a pour objet de définir les conditions dans lesquelles Qalam fournit à ${A} des prestations de gestion, de coordination et d'encadrement pédagogique dans le domaine de la formation professionnelle. Qalam recueille les besoins en formation auprès des établissements (écoles et organismes de formation), structure ces missions et les propose aux formateurs du collectif PedagoBridge.`),U(50),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 2 – Missions de Qalam",K,E),E+=6,J(["Qualifier les demandes et les structurer ;","Rechercher et présélectionner les formateurs adéquats au sein du collectif PedagoBridge ;","Vérifier la conformité administrative des formateurs (droits au travail, statuts légaux, diplômes, certifications) ;","Garantir la conformité Qualiopi pour chaque action de formation ;","Gérer les plannings et la logistique des missions ;","Assurer le suivi pédagogique et la qualité des interventions ;","Mettre à disposition les ressources humaines nécessaires ;",`Représenter ${A} auprès des écoles dans le cadre des missions confiées, conformément au mandat octroyé.`]),U(50),L.setFont("helvetica","bold"),L.setFontSize(10),L.text(`Article 3 – Obligations de ${A}`,K,E),E+=6,Y(`${A} s'engage à :`),J(["Mettre à disposition sa base de données de formateurs ;","Permettre à Qalam d'accéder aux profils, de contacter les formateurs et de piloter leur affectation ;",`Contractualiser directement avec les formateurs sous‑traitants, en intégrant une clause d'exclusivité interdisant tout contact direct avec les écoles sans l'intermédiaire de ${A} ou Qalam ;`,"Vérifier la validité des documents administratifs des formateurs ;",`Fournir à chaque formateur un bon de commande émis par ${A}— préparé par Qalam — avant le démarrage de la mission ;`,"Soutenir Qalam dans la réalisation des missions, notamment sur les questions RH et logistiques."]),U(60),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 4 – Rémunération et modalités de paiement",K,E),E+=6,L.setFont("helvetica","bold"),L.setFontSize(9),L.text("4.1 Répartition",K,E),E+=5,Y("Sauf accord écrit spécifique, la rémunération globale d'une mission est répartie ainsi :"),se([`70 % pour ${A} ;`,"30 % pour Qalam ;"]),Y("Toute dérogation doit faire l'objet d'un accord écrit signé des deux Parties."),E+=3,L.setFont("helvetica","bold"),L.setFontSize(9),L.text("4.2 Facturation de Qalam",K,E),E+=5,Y(`Qalam émet une facture à ${A} en fin de chaque mois pour sa part (30 %) correspondant aux missions réalisées. ${A} règle cette facture dans un délai maximum de quinze (15) jours calendaires.`),E+=3,L.setFont("helvetica","bold"),L.setFontSize(9),L.text("4.3 Paiement des formateurs",K,E),E+=5,Y(`${A} s'engage à verser la rémunération des formateurs dès réception des fonds de l'école cliente et, au plus tard, le dernier jour du mois en cours.`),E+=3,L.setFont("helvetica","bold"),L.setFontSize(9),L.text("4.4 Bon de commande",K,E),E+=5,Y(`Pour chaque mission, un bon de commande préparé par Qalam est validé et transmis par ${A} au formateur avant le début de la prestation.`),U(30),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 5 – Durée et résiliation",K,E),E+=6,Y("Le contrat est conclu pour une durée indéterminée à compter de sa signature. Chaque Partie peut y mettre fin à tout moment moyennant un préavis de trente (30) jours calendaires notifié par lettre recommandée avec accusé de réception, sans indemnité, sous réserve de l'exécution des obligations déjà engagées."),U(30),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 6 – Confidentialité",K,E),E+=6,Y("Chaque Partie s'engage à garder confidentielles toutes informations techniques, commerciales ou stratégiques obtenues dans le cadre du présent contrat pendant toute sa durée et pendant cinq (5) ans après son expiration."),U(80),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 7 – Clause de non-contournement",K,E),E+=6,L.setFont("helvetica","bold"),L.setFontSize(9),L.text(`7.1 Interdiction de contournement par ${A}`,K,E),E+=5,Y(`${A} s'engage expressément à ne pas contractualiser directement, ni indirectement, avec un Établissement Client pour la réalisation d'une mission de formation ou d'une prestation de même nature dont le besoin a été identifié, qualifié ou apporté par Qalam dans le cadre du présent contrat.`),Y(`Il est expressément convenu que cette interdiction porte uniquement sur le besoin spécifique concerné et ne confère à Qalam aucun droit d'exclusivité sur l'Établissement Client, lequel conserve toute liberté de contractualiser avec ${A} pour d'autres besoins en formation futurs ou différents.`),Y("Cette interdiction s'applique pendant toute la durée du présent contrat et pendant une période de douze (12) mois suivant sa cessation, quelle qu'en soit la cause."),E+=3,L.setFont("helvetica","bold"),L.setFontSize(9),L.text("7.2 Obligations concernant les formateurs",K,E),E+=5,Y(`${A} s'engage à inclure, dans tous ses contrats avec les formateurs et/ou les sociétés de formateurs intervenant dans le cadre des missions générées par Qalam, une clause d'exclusivité et de non-sollicitation interdisant formellement tout contact direct ou toute relation commerciale directe entre ces formateurs et l'Établissement Client, sans l'intermédiaire de ${A} ou de Qalam, pour une durée de deux (2) ans après la dernière mission concernée.`),E+=3,L.setFont("helvetica","bold"),L.setFontSize(9),L.text("7.3 Sanction",K,E),E+=5,Y(`Tout manquement à la présente clause, qu'il provienne directement de ${A} ou de la violation de l'obligation de non-sollicitation par un formateur sous-contrat avec ${A}, ouvrira droit pour Qalam à des dommages et intérêts forfaitaires équivalents à 20 % du montant total de la mission concernée, sans préjudice de toute autre action ou réparation complémentaire que Qalam serait en droit d'engager.`),U(30),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 8 – Indépendance des Parties",K,E),E+=6,Y("Les Parties agissent chacune en qualité de prestataire indépendant. Aucune stipulation du présent contrat ne saurait être interprétée comme créant un lien de subordination ou une société de fait entre elles."),U(30),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 9 – Déclarations sur l'honneur et conformité légale",K,E),E+=6,Y("Chaque Partie atteste sur l'honneur être en situation régulière au regard de l'administration fiscale et de l'URSSAF, et être immatriculée et habilitée à exercer son activité. Elles s'engagent à se fournir mutuellement un extrait Kbis à jour sur simple demande."),U(30),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 10 – Protection des données personnelles",K,E),E+=6,Y("Les Parties respectent le RGPD pour tous traitements de données personnelles. Qalam est responsable de traitement pour les données qu'elle collecte. Le DPO désigné est M. Ayoub Mekouar (ayoub.m@naoris.com). Les Parties prennent toutes mesures techniques et organisationnelles appropriées pour sécuriser les données."),U(40),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 11 – Responsabilités",K,E),E+=6,Y("Chaque Partie est responsable de la bonne exécution des obligations lui incombant. En cas de manquement grave, la Partie lésée pourra résilier le contrat de plein droit après mise en demeure restée sans effet sous quinze (15) jours."),Y(`Il est expressément convenu que Qalam ne saurait être tenu responsable des manquements à ses obligations prévues à l'Article 2 pour toute mission de formation ou prestation de services contractualisée directement entre ${A} et l'Établissement Client, ou entre le Formateur et l'Établissement Client, en dehors du cadre du présent contrat.`),U(30),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 12 – Règlement des différends",K,E),E+=6,Y("Les Parties s'efforceront de résoudre à l'amiable tout différend né de l'interprétation ou de l'exécution du présent contrat. À défaut d'accord dans les trente (30) jours suivant la notification du différend, il sera soumis à la compétence exclusive du tribunal de commerce de Paris."),U(20),L.setFont("helvetica","bold"),L.setFontSize(10),L.text("Article 13 – Droit applicable",K,E),E+=6,Y("Le présent contrat est régi par le droit français."),U(80),E+=10,Y(`Fait à Paris, le ${Ot(new Date(q.created_at),"d MMMM yyyy",{locale:yr})}, en deux exemplaires originaux.`),E+=10;const te=(M-2*K)/2;L.setFont("helvetica","bold"),L.setFontSize(9),L.text("Pour Qalam Software SASU",K,E),L.text(`Pour ${A}`,K+te,E),E+=5,L.setFont("helvetica","normal"),L.text("Ayoub Mekouar – Président",K,E);const Ue=O.legalRepresentativeName||"[Nom]",W=O.legalRepresentativeFunction||"[Fonction]";L.text(`${Ue} – ${W}`,K+te,E),E+=10,q.counter_signature_data&&(L.addImage(q.counter_signature_data,"PNG",K,E,50,18),q.counter_signed_at&&(L.setFontSize(7),L.setTextColor(100,100,100),L.text(`Signé le ${Ot(new Date(q.counter_signed_at),"dd/MM/yyyy")}`,K,E+22))),q.signature_data&&(L.addImage(q.signature_data,"PNG",K+te,E,50,18),q.signed_at&&(L.setFontSize(7),L.setTextColor(100,100,100),L.text(`Signé le ${Ot(new Date(q.signed_at),"dd/MM/yyyy")}`,K+te,E+22))),L.save(`contrat_prestation_services_${A.replace(/\s/g,"_")}_${Ot(new Date,"yyyy-MM-dd")}.pdf`),ae.success("Contrat téléchargé en PDF")}catch(L){console.error("Error generating PDF:",L),ae.error("Erreur lors de la génération du PDF")}},T=q=>q.counter_signed?s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(vl,{className:"w-3 h-3 mr-1"}),"Certifié"]}):q.status==="signed"?s.jsxs(Le,{className:"bg-amber-500",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"À contre-signer"]}):s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]}),k=r.filter(q=>q.status==="signed"&&!q.counter_signed).length,V=r.filter(q=>q.counter_signed).length,C=r.filter(q=>q.status==="pending").length,R=r.filter(q=>{const L=new Date;return L.setFullYear(L.getFullYear()-1),new Date(q.created_at)<L}),H=r.filter(q=>{if(v==="all")return!0;if(v==="pending")return q.status==="pending";if(v==="signed")return q.status==="signed"&&!q.counter_signed;if(v==="affiliated")return q.counter_signed;if(v==="expired"){const L=new Date;return L.setFullYear(L.getFullYear()-1),new Date(q.created_at)<L}return!0});return o?s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Gestion des Contrats",description:"Administration des contrats formateurs et prestations",noindex:!0}),s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(sa,{items:[{label:"Contrats"}]}),s.jsxs("div",{className:"mb-8 flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(Gt,{className:"h-8 w-8 text-primary"}),"Gestion des Contrats"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Gérez les contrats formateurs et de prestation"})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(ne,{variant:"outline",onClick:()=>j(!0),disabled:y,children:[y?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(yo,{className:"h-4 w-4 mr-2"}),"Régénérer les contrats"]})})]}),s.jsx(Hn,{open:_,onOpenChange:j,children:s.jsxs(qn,{children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Régénérer les contrats"}),s.jsx(Ia,{children:"Choisissez une option de régénération pour tous les contrats formateurs."})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ne,{variant:"outline",className:"w-full justify-start h-auto p-4",onClick:async()=>{j(!1),N(!0);try{const{data:q,error:L}=await he.functions.invoke("regenerate-contracts",{body:{resetSignatures:!1}});if(L)throw L;ae.success(`${q.updated} contrats mis à jour sur ${q.total}`),S()}catch(q){console.error("Error regenerating contracts:",q),ae.error("Erreur lors de la régénération")}finally{N(!1)}},disabled:y,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(yo,{className:"h-5 w-5 text-primary mt-0.5"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"font-semibold",children:"Mettre à jour les données"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Met à jour les informations des formateurs sans toucher aux signatures existantes"})]})]})}),s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsx(ne,{variant:"outline",className:"w-full justify-start h-auto p-4 border-destructive hover:bg-destructive/10",disabled:y,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(bi,{className:"h-5 w-5 text-destructive mt-0.5"}),s.jsxs("div",{className:"text-left",children:[s.jsx("p",{className:"font-semibold text-destructive",children:"Réinitialiser tous les contrats"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Supprime toutes les signatures et remet tous les contrats en attente"})]})]})})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsxs(Yc,{className:"flex items-center gap-2",children:[s.jsx(Yd,{className:"h-5 w-5 text-destructive"}),"Confirmer la réinitialisation"]}),s.jsxs(Xc,{children:[s.jsx("strong",{className:"text-destructive",children:"Cette action est irréversible."}),s.jsx("br",{}),s.jsx("br",{}),"Tous les contrats seront réinitialisés :",s.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[s.jsx("li",{children:"Toutes les signatures seront supprimées"}),s.jsx("li",{children:'Tous les contrats repasseront en statut "En attente"'}),s.jsx("li",{children:"Les formateurs devront resigner leurs contrats"}),s.jsx("li",{children:"Les contre-signatures admin seront perdues"})]})]})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{className:"bg-destructive hover:bg-destructive/90",onClick:async()=>{j(!1),N(!0);try{const{data:q,error:L}=await he.functions.invoke("regenerate-contracts",{body:{resetSignatures:!0}});if(L)throw L;ae.success(`${q.updated} contrats réinitialisés sur ${q.total}`),S()}catch(q){console.error("Error resetting contracts:",q),ae.error("Erreur lors de la réinitialisation")}finally{N(!1)}},children:"Réinitialiser tous les contrats"})]})]})]})]}),s.jsx(Jl,{children:s.jsx(ne,{variant:"ghost",onClick:()=>j(!1),children:"Annuler"})})]})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4 mb-8",children:[s.jsx(vt,{to:"/admin/trainers",className:"block",children:s.jsx(ke,{className:"hover:shadow-md transition-shadow cursor-pointer group",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:"Formateurs certifiés"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:V})]}),s.jsx(vl,{className:"h-8 w-8 text-green-500 opacity-80 group-hover:opacity-100 transition-opacity"})]})})})}),s.jsx(ke,{className:k>0?"ring-2 ring-amber-400":"",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"À contre-signer"}),s.jsx("p",{className:"text-2xl font-bold text-amber-600",children:k})]}),s.jsx(OB,{className:"h-8 w-8 text-amber-500 opacity-80"})]})})}),s.jsx(vt,{to:"/admin/trainers",className:"block",children:s.jsx(ke,{className:"hover:shadow-md transition-shadow cursor-pointer group",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:"Total formateurs"}),s.jsx("p",{className:"text-2xl font-bold",children:r.length})]}),s.jsx(sr,{className:"h-8 w-8 text-primary opacity-80 group-hover:opacity-100 transition-opacity"})]})})})}),s.jsx(ke,{className:C>0?"hover:shadow-md transition-shadow cursor-pointer":"",onClick:()=>C>0&&b("pending"),children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"En attente"}),s.jsx("p",{className:"text-2xl font-bold text-gray-600",children:C})]}),s.jsx(Gr,{className:"h-8 w-8 text-gray-500 opacity-80"})]})})}),R.length>0&&s.jsx(ke,{className:"ring-2 ring-red-400 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>b("expired"),children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Contrats expirés"}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:R.length})]}),s.jsx(Gr,{className:"h-8 w-8 text-red-500 opacity-80"})]})})}),s.jsx(vt,{to:"/admin/training-requests",className:"block",children:s.jsx(ke,{className:"hover:shadow-md transition-shadow cursor-pointer group",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:"Contrats prestation"}),s.jsx("p",{className:"text-2xl font-bold",children:a.length})]}),s.jsx(Vr,{className:"h-8 w-8 text-blue-500 opacity-80 group-hover:opacity-100 transition-opacity"})]})})})})]}),c==="trainer"&&s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsxs(ne,{variant:v==="all"?"default":"outline",size:"sm",onClick:()=>b("all"),children:["Tous (",r.length,")"]}),s.jsxs(ne,{variant:v==="pending"?"default":"outline",size:"sm",onClick:()=>b("pending"),children:["En attente (",C,")"]}),s.jsxs(ne,{variant:v==="signed"?"default":"outline",size:"sm",onClick:()=>b("signed"),children:["À contre-signer (",k,")"]}),s.jsxs(ne,{variant:v==="affiliated"?"default":"outline",size:"sm",onClick:()=>b("affiliated"),children:["Certifiés (",V,")"]}),R.length>0&&s.jsxs(ne,{variant:v==="expired"?"default":"outline",size:"sm",onClick:()=>b("expired"),children:["Expirés (",R.length,")"]})]}),s.jsxs(af,{value:c,onValueChange:u,children:[s.jsxs(ad,{className:"mb-6",children:[s.jsxs(In,{value:"trainer",children:["Contrats Formateurs (",r.length,")"]}),s.jsxs(In,{value:"service",children:["Contrats Prestation (",a.length,")"]})]}),s.jsx(Es,{value:"trainer",children:H.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(Gt,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("p",{className:"text-muted-foreground",children:v==="all"?"Aucun contrat formateur":`Aucun contrat ${v==="pending"?"en attente":v==="signed"?"à contre-signer":v==="affiliated"?"certifié":"expiré"}`})]})}):s.jsx("div",{className:"space-y-4",children:H.map(q=>{var M;const L=(()=>{const z=new Date;return z.setFullYear(z.getFullYear()-1),new Date(q.created_at)<z})();return s.jsx(ke,{className:`hover:shadow-md transition-shadow ${L?"ring-2 ring-red-400 bg-red-50/50 dark:bg-red-950/20":q.status==="signed"&&!q.counter_signed?"ring-2 ring-amber-400 bg-amber-50/50 dark:bg-amber-950/20":""}`,children:s.jsxs(Ae,{className:"p-6",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsxs(vt,{to:"/admin/trainers",className:"text-lg font-semibold hover:text-primary transition-colors flex items-center gap-1",children:[q.contract_data.trainerName,s.jsx(vs,{className:"w-3 h-3 opacity-50"})]}),T(q),L&&s.jsx(Le,{variant:"destructive",children:"Expiré"})]}),s.jsxs("a",{href:`mailto:${q.contract_data.trainerEmail}`,className:"text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1 mb-2",children:[s.jsx(Fn,{className:"w-3 h-3"}),q.contract_data.trainerEmail]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:(M=q.contract_data.specialties)==null?void 0:M.slice(0,3).map((z,K)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:z},K))}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Créé le ",Ot(new Date(q.created_at),"dd MMM yyyy",{locale:yr}),q.signed_at&&` • Signé le ${Ot(new Date(q.signed_at),"dd MMM yyyy",{locale:yr})}`,q.counter_signed_at&&` • Contre-signé le ${Ot(new Date(q.counter_signed_at),"dd MMM yyyy",{locale:yr})}`]})]}),s.jsxs("div",{className:"flex gap-2",children:[q.status==="signed"&&!q.counter_signed&&s.jsxs(ne,{onClick:()=>f(q),children:[s.jsx(OB,{className:"mr-2 h-4 w-4"}),"Contre-signer"]}),s.jsxs(ne,{variant:"outline",onClick:()=>F(q),children:[s.jsx(Ho,{className:"mr-2 h-4 w-4"}),"Télécharger PDF"]})]})]}),s.jsx("div",{className:"mt-4",children:s.jsx(uy,{query:q.contract_data.trainerName,title:"Documents Drive (formateur)"})}),(q.signature_data||q.counter_signature_data)&&s.jsxs("div",{className:"mt-4 pt-4 border-t flex flex-wrap gap-6",children:[q.signature_data&&s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Signature formateur:"}),s.jsx("img",{src:q.signature_data,alt:"Signature formateur",className:"h-12 border rounded"})]}),q.counter_signature_data&&s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Contre-signature PedagoBridge:"}),s.jsx("img",{src:q.counter_signature_data,alt:"Contre-signature",className:"h-12 border rounded"})]})]})]})},q.id)})})}),s.jsx(Es,{value:"service",children:a.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(Gt,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("p",{className:"text-muted-foreground",children:"Aucun contrat de prestation"})]})}):s.jsx("div",{className:"space-y-4",children:a.map(q=>{var L,M,z,K,E,A,O,U,Y,J;return s.jsx(ke,{className:"hover:shadow-md transition-shadow",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsxs(vt,{to:`/training-offers/${(L=q.school_request)==null?void 0:L.id}`,className:"text-lg font-semibold hover:text-primary transition-colors flex items-center gap-1",children:[(M=q.school_request)==null?void 0:M.school_name,s.jsx(vs,{className:"w-3 h-3 opacity-50"})]}),s.jsx(Le,{className:q.status==="active"?"bg-green-500":"",children:q.status})]}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:["Formateur: ",s.jsx(vt,{to:"/admin/trainers",className:"hover:text-primary transition-colors",children:(K=(z=q.trainer_application)==null?void 0:z.trainer)==null?void 0:K.name})]}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:["Contact école: ",(E=q.school_request)==null?void 0:E.contact_name," (",s.jsx("a",{href:`mailto:${(A=q.school_request)==null?void 0:A.contact_email}`,className:"hover:text-primary transition-colors",children:(O=q.school_request)==null?void 0:O.contact_email}),")"]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Créé le ",Ot(new Date(q.created_at),"dd MMM yyyy",{locale:yr})]})]})}),s.jsx("div",{className:"mt-4",children:s.jsx(uy,{query:((Y=(U=q.trainer_application)==null?void 0:U.trainer)==null?void 0:Y.name)||((J=q.school_request)==null?void 0:J.school_name)||"",title:"Documents Drive"})})]})},q.id)})})})]}),s.jsx(Hn,{open:!!d,onOpenChange:()=>f(null),children:s.jsxs(qn,{className:"max-w-2xl",children:[s.jsx(Gn,{children:s.jsx(Kn,{children:"Contre-signer le contrat"})}),d&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"p-4 bg-muted rounded-lg",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Formateur:"})," ",d.contract_data.trainerName]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Email:"})," ",d.contract_data.trainerEmail]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Signé le:"})," ",d.signed_at?Ot(new Date(d.signed_at),"dd MMMM yyyy à HH:mm",{locale:yr}):"N/A"]})]}),d.signature_data&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium mb-2",children:"Signature du formateur:"}),s.jsx("img",{src:d.signature_data,alt:"Signature formateur",className:"border rounded p-2 bg-white",style:{maxHeight:"100px"}})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium mb-2",children:"Votre contre-signature (PedagoBridge):"}),s.jsx("div",{className:"border rounded-lg overflow-hidden bg-white",children:s.jsx("canvas",{ref:g,className:"cursor-crosshair block",style:{width:"500px",height:"150px"}})})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(ne,{variant:"outline",onClick:I,children:"Effacer"}),s.jsxs(ne,{onClick:P,disabled:m,children:[m?s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(Wr,{className:"mr-2 h-4 w-4"}),"Valider la contre-signature"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"En contre-signant, vous validez l'affiliation du formateur à PedagoBridge."})]})]})})]})]})}function GLe(){const{isAdmin:e}=Ur(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState("all"),[c,u]=w.useState("all");w.useEffect(()=>{if(!e){t("/");return}d()},[e,t]);const d=async()=>{i(!0);try{const{data:g,error:p}=await he.from("trainer_applications").select(`
id,
status,
created_at,
message,
rejection_reason,
trainer_id,
school_request_id
`).order("created_at",{ascending:!1});if(p)throw p;const x=[];for(const v of g||[]){const{data:b}=await he.from("trainer_profiles").select("id, name, email").eq("id",v.trainer_id).single(),{data:y}=await he.from("school_requests").select("id, school_name, description, status, contact_email").eq("id",v.school_request_id).single();let N=!1;if(b){const{data:_}=await he.from("trainer_contracts").select("id, counter_signed").eq("trainer_id",b.id).eq("counter_signed",!0).maybeSingle();N=!!_}b&&y&&x.push({id:v.id,status:v.status,created_at:v.created_at,message:v.message,rejection_reason:v.rejection_reason,trainer:{...b,is_affiliated:N},school_request:y})}n(x)}catch(g){console.error("Error loading missions:",g),ae.error("Erreur lors du chargement des missions")}finally{i(!1)}},f=g=>{switch(g){case"accepted":return s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Acceptée"]});case"rejected":return s.jsxs(Le,{variant:"destructive",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"pending":default:return s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]})}},m=r.filter(g=>!(o!=="all"&&g.status!==o||c==="affiliated"&&!g.trainer.is_affiliated||c==="non-affiliated"&&g.trainer.is_affiliated)),h={total:r.length,pending:r.filter(g=>g.status==="pending").length,accepted:r.filter(g=>g.status==="accepted").length,rejected:r.filter(g=>g.status==="rejected").length,affiliated:r.filter(g=>g.trainer.is_affiliated).length,pendingSchoolAction:r.filter(g=>g.status==="pending"&&g.school_request.status==="approved").length};return a?s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Suivi des Missions",description:"Tableau de bord des candidatures et missions",noindex:!0}),s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(sa,{items:[{label:"Suivi Missions"}]}),s.jsxs("div",{className:"mb-8",children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(as,{className:"h-8 w-8 text-primary"}),"Suivi des Missions"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Vue d'ensemble des candidatures et missions"})]}),h.pendingSchoolAction>0&&s.jsx(ke,{className:"mb-6 border-amber-400 bg-amber-50 dark:bg-amber-950/20",children:s.jsx(Ae,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Di,{className:"h-6 w-6 text-amber-600"}),s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium text-amber-800 dark:text-amber-200",children:[h.pendingSchoolAction," candidature",h.pendingSchoolAction>1?"s":""," en attente de validation école"]}),s.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Des écoles doivent encore valider ces candidatures."})]})]})})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-4 mb-8",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-2xl font-bold",children:h.total})]})})}),s.jsx(ke,{className:h.pending>0?"ring-1 ring-amber-400":"",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"En attente"}),s.jsx("p",{className:"text-2xl font-bold text-amber-600",children:h.pending})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Acceptées"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:h.accepted})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Refusées"}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:h.rejected})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Certifiés"}),s.jsx("p",{className:"text-2xl font-bold text-primary",children:h.affiliated})]})})}),s.jsx(ke,{className:h.pendingSchoolAction>0?"ring-2 ring-amber-500 bg-amber-50 dark:bg-amber-950/20":"",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Action école"}),s.jsx("p",{className:"text-2xl font-bold text-amber-700",children:h.pendingSchoolAction})]})})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-4 mb-6",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Statut:"}),s.jsxs(Lr,{value:o,onValueChange:l,children:[s.jsx(Ar,{className:"w-40",children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous"}),s.jsx(ot,{value:"pending",children:"En attente"}),s.jsx(ot,{value:"accepted",children:"Acceptées"}),s.jsx(ot,{value:"rejected",children:"Refusées"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Affiliation:"}),s.jsxs(Lr,{value:c,onValueChange:u,children:[s.jsx(Ar,{className:"w-40",children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous"}),s.jsx(ot,{value:"affiliated",children:"Certifiés"}),s.jsx(ot,{value:"non-affiliated",children:"Non certifiés"})]})]})]})]}),m.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(as,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("p",{className:"text-muted-foreground",children:"Aucune mission trouvée"})]})}):s.jsx("div",{className:"space-y-4",children:m.map(g=>s.jsx(ke,{className:`hover:shadow-md transition-shadow ${g.status==="pending"?"border-l-4 border-l-amber-400":g.status==="accepted"?"border-l-4 border-l-green-500":""}`,children:s.jsxs(Ae,{className:"p-6",children:[s.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2 flex-wrap",children:[s.jsx(sr,{className:"h-5 w-5 text-primary"}),s.jsxs(vt,{to:`/trainers/${g.trainer.id}`,className:"font-semibold hover:text-primary transition-colors flex items-center gap-1",children:[g.trainer.name,s.jsx(vs,{className:"w-3 h-3 opacity-50"})]}),g.trainer.is_affiliated&&s.jsx(Zd,{size:"sm"}),f(g.status)]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-2",children:[s.jsx(Vr,{className:"h-4 w-4"}),s.jsx(vt,{to:"/admin/training-requests",className:"hover:text-primary transition-colors",children:g.school_request.school_name}),s.jsx(Le,{variant:"outline",className:"text-xs",children:g.school_request.status})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1 mb-2",children:g.school_request.description}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Postulé le ",Ot(new Date(g.created_at),"dd MMM yyyy à HH:mm",{locale:yr})]}),g.status==="rejected"&&g.rejection_reason&&s.jsxs("div",{className:"mt-2 p-2 bg-red-50 dark:bg-red-950/20 rounded text-sm text-red-700 dark:text-red-300",children:[s.jsx("strong",{children:"Raison:"})," ",g.rejection_reason]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>t(`/training-offers/${g.school_request.id}`),children:[s.jsx(is,{className:"mr-2 h-4 w-4"}),"Voir l'offre"]})})]}),s.jsx("div",{className:"mt-4",children:s.jsx(uy,{query:g.trainer.name,title:"Documents Drive (formateur)"})})]})},g.id))})]})]})}const Gi=he,KLe=["Reconversion","Salariés","Alternants","Étudiants","Particuliers"],YLe=["Action de formation","Bilan de compétences","VAE","Apprentissage"],Bx=["Entreprise","OPCO","CPF","France Travail","Particulier","Public","Autre OF"];function koe(e,t,r=0){if(!e||!t)return null;const n=new Date(e).getTime(),a=new Date(t).getTime();if(Number.isNaN(n)||Number.isNaN(a)||a<=n)return null;const i=(a-n)/6e4-(r||0);return i<=0?null:Math.round(i/60*100)/100}const kd={planifie:{label:"Planifié",className:"bg-blue-100 text-blue-700 border-blue-300"},realise:{label:"Réalisé",className:"bg-green-100 text-green-700 border-green-300"},annule:{label:"Annulé",className:"bg-muted text-muted-foreground border-border line-through"},facture:{label:"Facturé",className:"bg-purple-100 text-purple-700 border-purple-300"}},AT=e=>{if(!e.starts_at)return 0;const t=new Date(e.starts_at).getTime();return e.ends_at?new Date(e.ends_at).getTime():t+(e.hours??0)*36e5};function XLe(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState({}),[u,d]=w.useState("all"),[f,m]=w.useState("");w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&h()},[t]);const h=async()=>{a(!0);try{const[{data:v},{data:b}]=await Promise.all([Gi.from("trainer_interventions").select("*").order("starts_at",{ascending:!1}).limit(2e3),he.from("trainer_profiles").select("id, name")]);o(v||[]);const y={};(b||[]).forEach(N=>{y[N.id]=N.name}),c(y)}catch(v){console.error(v)}finally{a(!1)}},g=w.useMemo(()=>{var y;const v=new Set,b={};for(const N of i)N.status==="annule"||!N.starts_at||(b[y=N.trainer_profile_id]||(b[y]=[])).push(N);for(const N of Object.values(b)){const _=[...N].sort((j,S)=>new Date(j.starts_at).getTime()-new Date(S.starts_at).getTime());for(let j=0;j<_.length;j++)for(let S=j+1;S<_.length;S++){const I=new Date(_[j].starts_at).getTime(),P=new Date(_[S].starts_at).getTime();if(P>=AT(_[j]))break;P<AT(_[j])&&I<AT(_[S])&&(v.add(_[j].id),v.add(_[S].id))}}return v},[i]),p=w.useMemo(()=>{const v=f.trim().toLowerCase();return i.filter(b=>u==="all"||b.trainer_profile_id===u).filter(b=>v?[l[b.trainer_profile_id],b.subject,b.client_name,b.cursus].filter(Boolean).some(y=>y.toLowerCase().includes(v)):!0).map(b=>({...b,trainerName:l[b.trainer_profile_id]||"—",conflict:g.has(b.id)}))},[i,u,f,l,g]),x=w.useMemo(()=>Object.entries(l).filter(([v])=>i.some(b=>b.trainer_profile_id===v)).sort((v,b)=>v[1].localeCompare(b[1])),[l,i]);return r||n?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsx(sa,{items:[{label:"Planning global"}]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"text-3xl flex items-center gap-3",children:["Planning global",g.size>0&&s.jsxs(Le,{variant:"outline",className:"bg-red-100 text-red-700 border-red-300 text-sm",children:[s.jsx(Yd,{className:"h-3.5 w-3.5 mr-1"}),g.size/2," conflit(s) potentiel(s)"]})]})}),s.jsxs(Ae,{children:[s.jsxs("div",{className:"flex flex-wrap gap-3 mb-4",children:[s.jsx(Ye,{placeholder:"Rechercher (formateur, école, matière)…",value:f,onChange:v=>m(v.target.value),className:"max-w-xs"}),s.jsxs(Lr,{value:u,onValueChange:d,children:[s.jsx(Ar,{className:"w-64",children:s.jsx(Br,{placeholder:"Formateur"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les formateurs"}),x.map(([v,b])=>s.jsx(ot,{value:v,children:b},v))]})]}),s.jsxs(Le,{variant:"outline",className:"ml-auto self-center",children:[p.length," intervention(s)"]})]}),p.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-10",children:"Aucune intervention."}):s.jsx("div",{className:"space-y-2",children:p.map(v=>s.jsxs("div",{className:`flex flex-wrap items-center gap-x-4 gap-y-1 border rounded-md p-3 ${v.conflict?"border-red-300 bg-red-50":""}`,children:[s.jsxs("div",{className:"w-28 shrink-0",children:[s.jsx("div",{className:"font-medium text-sm",children:v.starts_at?Ot(ll(v.starts_at),"EEE d MMM",{locale:yr}):"—"}),s.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(Gr,{className:"w-3 h-3"}),v.hours!=null?`${v.hours}h`:v.half_day||""]})]}),s.jsx("div",{className:"w-40 shrink-0 font-medium text-sm truncate",children:v.trainerName}),s.jsxs("div",{className:"flex-1 min-w-[160px]",children:[s.jsx("div",{className:"text-sm font-semibold",children:v.subject||"—"}),s.jsxs("div",{className:"text-xs text-muted-foreground flex flex-wrap gap-x-3",children:[s.jsx("span",{children:v.client_name||"—"}),v.cursus&&s.jsxs("span",{children:["· ",v.cursus]}),v.city&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Gs,{className:"w-3 h-3"}),v.city]}),v.nb_stagiaires!=null&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(sr,{className:"w-3 h-3"}),v.nb_stagiaires]})]})]}),v.conflict&&s.jsxs(Le,{variant:"outline",className:"bg-red-100 text-red-700 border-red-300",children:[s.jsx(Yd,{className:"h-3 w-3 mr-1"}),"Conflit"]}),s.jsx(Le,{variant:"outline",className:kd[v.status].className,children:kd[v.status].label})]},v.id))})]})]})]})})}function ZLe(){return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Politique de Confidentialité",description:"Politique de confidentialité de PedagoBridge - Comment nous protégeons vos données personnelles.",url:"/privacy-policy"}),s.jsxs("div",{className:"container max-w-4xl mx-auto px-4 py-16",children:[s.jsx("h1",{className:"text-4xl font-bold mb-8",children:"Politique de Confidentialité"}),s.jsxs("div",{className:"space-y-8 text-foreground",children:[s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"1. Informations légales"}),s.jsx("p",{className:"text-muted-foreground mb-2",children:"La présente politique de confidentialité s'applique au site PedagoBridge, édité par :"}),s.jsxs("div",{className:"bg-muted/50 p-4 rounded-lg space-y-1",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Société :"})," Qalam Software"]}),s.jsxs("p",{children:[s.jsx("strong",{children:"SIRET :"})," 91318083200010"]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Responsable de publication :"})," Qalam Software"]})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"2. Collecte des données personnelles"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Nous collectons différentes catégories de données personnelles selon votre utilisation de notre plateforme :"}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"2.1 Données collectées automatiquement"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Adresse IP"}),s.jsx("li",{children:"Type de navigateur et système d'exploitation"}),s.jsx("li",{children:"Pages consultées et temps passé sur le site"}),s.jsx("li",{children:"Date et heure de connexion"}),s.jsx("li",{children:"Actions effectuées sur la plateforme (clics, navigation)"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"2.2 Données collectées via les formulaires"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Nom et prénom"}),s.jsx("li",{children:"Adresse email"}),s.jsx("li",{children:"Numéro de téléphone (optionnel)"}),s.jsx("li",{children:"Photo de profil (pour les formateurs)"}),s.jsx("li",{children:"Informations professionnelles (spécialités, bio, CV pour les formateurs)"}),s.jsx("li",{children:"Nom et informations de l'établissement scolaire"}),s.jsx("li",{children:"Besoins de formation et documents joints"}),s.jsx("li",{children:"Ville et adresse (pour les offres de formation)"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"2.3 Documents confidentiels des formateurs"}),s.jsx("p",{className:"text-muted-foreground mb-2",children:"Les formateurs peuvent télécharger des documents sensibles pour validation de leur profil :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Carte nationale d'identité ou passeport"}),s.jsx("li",{children:"Extrait Kbis ou RCS"}),s.jsx("li",{children:"Casier judiciaire (B3)"}),s.jsx("li",{children:"Diplômes et certifications"}),s.jsx("li",{children:"Attestations d'assurance"})]}),s.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 p-4 rounded-lg mb-4",children:s.jsxs("p",{className:"text-green-800 dark:text-green-200 text-sm",children:[s.jsx("strong",{children:"Protection renforcée :"})," Ces documents sont strictement confidentiels et accessibles uniquement par le formateur concerné et les administrateurs de PedagoBridge. Ils ne sont jamais partagés avec les établissements scolaires ou des tiers, et sont stockés de manière sécurisée avec chiffrement."]})}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"2.4 Données de messagerie"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Les messages échangés via la messagerie intégrée entre formateurs et établissements sont stockés pour permettre le suivi des échanges."}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"2.5 Données contractuelles"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Signatures électroniques des contrats"}),s.jsx("li",{children:"Données des contrats de prestation"}),s.jsx("li",{children:"Déclarations d'heures de mission"}),s.jsx("li",{children:"Données de facturation"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"2.6 Newsletter"}),s.jsx("p",{className:"text-muted-foreground",children:"Pour l'inscription à notre newsletter, nous collectons uniquement votre adresse email."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"3. Finalités du traitement"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vos données personnelles sont collectées et traitées pour les finalités suivantes :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[s.jsx("li",{children:"Gestion des inscriptions des formateurs et validation de leur profil"}),s.jsx("li",{children:"Traitement des demandes de formation des établissements scolaires"}),s.jsx("li",{children:"Mise en relation entre formateurs et établissements"}),s.jsx("li",{children:"Gestion des candidatures et suivi des missions"}),s.jsx("li",{children:"Messagerie entre les utilisateurs"}),s.jsx("li",{children:"Génération et gestion des contrats et factures"}),s.jsx("li",{children:"Envoi de notifications en temps réel"}),s.jsx("li",{children:"Envoi d'emails transactionnels (approbation d'offres, candidatures, etc.)"}),s.jsx("li",{children:"Envoi de notre newsletter (avec votre consentement)"}),s.jsx("li",{children:"Analyse automatique des CV par intelligence artificielle"}),s.jsx("li",{children:"Recommandations personnalisées de formateurs"}),s.jsx("li",{children:"Amélioration de nos services et personnalisation de l'expérience utilisateur"}),s.jsx("li",{children:"Respect de nos obligations légales et réglementaires"}),s.jsx("li",{children:"Statistiques d'utilisation du site"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"4. Base légale du traitement"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Le traitement de vos données personnelles repose sur les bases légales suivantes :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Consentement :"})," pour l'envoi de la newsletter et l'utilisation des cookies non essentiels"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Exécution d'un contrat :"})," pour la gestion des services de mise en relation, des contrats et de la facturation"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Intérêt légitime :"})," pour l'amélioration de nos services, la sécurité de la plateforme et les notifications"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Obligation légale :"})," pour la conservation de certaines données comptables et fiscales"]})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"5. Destinataires des données"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vos données personnelles sont destinées aux services internes de Qalam Software. Elles peuvent également être partagées avec :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[s.jsx("li",{children:"Les formateurs (pour les établissements effectuant une demande ou une candidature acceptée)"}),s.jsx("li",{children:"Les établissements scolaires (pour les profils de formateurs validés et les candidatures)"}),s.jsxs("li",{children:["Nos prestataires techniques :",s.jsxs("ul",{className:"list-disc list-inside ml-6 mt-2 space-y-1",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Supabase :"})," hébergement et base de données"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Resend :"})," envoi d'emails transactionnels et newsletter"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Stripe :"})," traitement sécurisé des paiements"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Google Analytics :"})," statistiques d'utilisation (si consentement cookies)"]})]})]}),s.jsx("li",{children:"Les autorités légales sur demande justifiée"})]}),s.jsx("p",{className:"text-muted-foreground mt-4",children:"Nous ne vendons ni ne louons vos données personnelles à des tiers."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"6. Durée de conservation"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vos données personnelles sont conservées pour les durées suivantes :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Comptes utilisateurs actifs :"})," jusqu'à la suppression du compte"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Comptes inactifs :"})," 3 ans à compter de la dernière connexion"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Newsletter :"})," jusqu'à désabonnement"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Demandes de formation :"})," 2 ans à compter de la demande"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Messages :"})," 2 ans à compter de l'envoi"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Contrats et factures :"})," 10 ans (obligation légale)"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Données de connexion :"})," 12 mois maximum"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Logs applicatifs :"})," 90 jours"]})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"7. Vos droits"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Conformément au RGPD, vous disposez des droits suivants sur vos données personnelles :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Droit d'accès :"})," obtenir une copie de vos données"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Droit de rectification :"})," corriger vos données inexactes"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Droit à l'effacement :"})," demander la suppression de vos données"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Droit à la limitation :"})," limiter le traitement de vos données"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Droit à la portabilité :"})," recevoir vos données dans un format structuré"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Droit d'opposition :"})," vous opposer au traitement de vos données"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Droit de retrait du consentement :"})," retirer votre consentement à tout moment"]})]}),s.jsxs("p",{className:"text-muted-foreground",children:["Pour exercer ces droits, contactez-nous via le ",s.jsx(vt,{to:"/#contact",className:"text-primary hover:underline",children:"formulaire de contact"})," du site ou par email."]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"8. Sécurité des données"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Nous mettons en œuvre toutes les mesures techniques et organisationnelles appropriées pour protéger vos données personnelles contre :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[s.jsx("li",{children:"L'accès non autorisé"}),s.jsx("li",{children:"La modification, la divulgation ou la destruction non autorisées"}),s.jsx("li",{children:"La perte accidentelle"})]}),s.jsx("p",{className:"text-muted-foreground mt-4",children:"Nos mesures de sécurité incluent :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mt-2",children:[s.jsx("li",{children:"Chiffrement des données sensibles et des communications (HTTPS)"}),s.jsx("li",{children:"Authentification sécurisée avec gestion des sessions"}),s.jsx("li",{children:"Politiques de sécurité au niveau ligne (Row Level Security) sur la base de données"}),s.jsx("li",{children:"Accès strictement limité aux personnes autorisées"}),s.jsx("li",{children:"Sauvegardes régulières des données"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"9. Cookies"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Notre site utilise des cookies pour améliorer votre expérience utilisateur. Lors de votre première visite, une bannière de consentement vous permet de choisir d'accepter ou de refuser les cookies non essentiels."}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"9.1 Types de cookies utilisés"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Cookies essentiels :"})," nécessaires au fonctionnement du site",s.jsxs("ul",{className:"list-disc list-inside ml-6 mt-2 space-y-1",children:[s.jsx("li",{children:"Authentification et session utilisateur"}),s.jsx("li",{children:"Préférences de langue et d'affichage"}),s.jsx("li",{children:"Consentement aux cookies"})]})]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Cookies analytiques :"})," pour comprendre l'utilisation du site (Google Analytics)",s.jsxs("ul",{className:"list-disc list-inside ml-6 mt-2 space-y-1",children:[s.jsx("li",{children:"Pages visitées et temps passé"}),s.jsx("li",{children:"Source du trafic"}),s.jsx("li",{children:"Interactions avec le site"})]})]})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"9.2 Gestion des cookies"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vous pouvez modifier vos préférences de cookies à tout moment :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[s.jsx("li",{children:"Via les paramètres de votre navigateur"}),s.jsx("li",{children:'En supprimant le cookie "pedagobridge_cookie_consent" de votre navigateur'})]}),s.jsx("p",{className:"text-muted-foreground mt-4",children:"La désactivation de certains cookies peut affecter le fonctionnement du site."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"10. Intelligence artificielle"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Notre plateforme utilise l'intelligence artificielle pour :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Analyse de CV :"})," extraction automatique des compétences et spécialités des formateurs à partir de leur CV"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Recommandations :"})," suggestion de formateurs correspondant aux besoins des établissements"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Génération de contenu :"})," aide à la rédaction d'articles de blog"]})]}),s.jsx("p",{className:"text-muted-foreground mt-4",children:"Ces traitements automatisés n'entraînent pas de prise de décision automatisée ayant des effets juridiques ou significatifs sur vous. Les résultats de l'analyse IA sont toujours vérifiés par l'utilisateur avant publication."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"11. Transferts internationaux"}),s.jsx("p",{className:"text-muted-foreground",children:"Vos données sont principalement hébergées au sein de l'Union Européenne. Certains de nos prestataires (Stripe, Google Analytics) peuvent traiter des données aux États-Unis. Dans ce cas, nous nous assurons que des garanties appropriées sont mises en place conformément au RGPD (clauses contractuelles types, Data Privacy Framework)."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"12. Mineurs"}),s.jsx("p",{className:"text-muted-foreground",children:"Notre plateforme s'adresse à des professionnels et n'est pas destinée aux mineurs de moins de 18 ans. Nous ne collectons pas sciemment de données personnelles de mineurs."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"13. Modifications"}),s.jsx("p",{className:"text-muted-foreground",children:"Nous nous réservons le droit de modifier cette politique de confidentialité à tout moment. Les modifications entreront en vigueur dès leur publication sur cette page. En cas de modification substantielle, nous vous en informerons par email ou via une notification sur la plateforme."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"14. Contact et réclamation"}),s.jsxs("p",{className:"text-muted-foreground mb-4",children:["Pour toute question concernant cette politique de confidentialité ou pour exercer vos droits, contactez-nous via notre ",s.jsx(vt,{to:"/#contact",className:"text-primary hover:underline",children:"formulaire de contact"}),"."]}),s.jsx("p",{className:"text-muted-foreground",children:"Si vous estimez que vos droits ne sont pas respectés, vous pouvez introduire une réclamation auprès de la CNIL (Commission Nationale de l'Informatique et des Libertés) :"}),s.jsxs("div",{className:"bg-muted/50 p-4 rounded-lg mt-4",children:[s.jsx("p",{children:"CNIL - 3 Place de Fontenoy"}),s.jsx("p",{children:"TSA 80715 - 75334 PARIS CEDEX 07"}),s.jsx("p",{children:"Téléphone : 01 53 73 22 22"}),s.jsxs("p",{children:["Site web : ",s.jsx("a",{href:"https://www.cnil.fr",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"www.cnil.fr"})]})]})]}),s.jsx("div",{className:"mt-12 pt-8 border-t",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Dernière mise à jour : 26 novembre 2025"})})]})]})]})}function JLe(){return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Conditions Générales d'Utilisation",description:"Conditions générales d'utilisation de la plateforme PedagoBridge.",url:"/terms-of-service"}),s.jsxs("div",{className:"container max-w-4xl mx-auto px-4 py-16",children:[s.jsx("h1",{className:"text-4xl font-bold mb-8",children:"Conditions Générales d'Utilisation"}),s.jsxs("div",{className:"space-y-8 text-foreground",children:[s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"1. Informations légales"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Les présentes Conditions Générales d'Utilisation (CGU) régissent l'utilisation du site internet PedagoBridge, édité par :"}),s.jsxs("div",{className:"bg-muted/50 p-4 rounded-lg space-y-1",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Société :"})," Qalam Software"]}),s.jsxs("p",{children:[s.jsx("strong",{children:"SIRET :"})," 91318083200010"]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Siège social :"})," France"]})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"2. Objet"}),s.jsx("p",{className:"text-muted-foreground",children:"Les présentes CGU ont pour objet de définir les modalités et conditions d'utilisation de la plateforme PedagoBridge, ainsi que les droits et obligations des utilisateurs dans ce cadre."}),s.jsx("p",{className:"text-muted-foreground mt-4",children:"La plateforme PedagoBridge est une plateforme de mise en relation entre formateurs professionnels et établissements scolaires recherchant des prestations de formation."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"3. Acceptation des CGU"}),s.jsx("p",{className:"text-muted-foreground",children:"L'utilisation de la plateforme PedagoBridge implique l'acceptation pleine et entière des présentes CGU. Si vous n'acceptez pas ces conditions, veuillez ne pas utiliser la plateforme."}),s.jsx("p",{className:"text-muted-foreground mt-4",children:"Qalam Software se réserve le droit de modifier les présentes CGU à tout moment. Les modifications entreront en vigueur dès leur publication sur le site. Il est donc recommandé de consulter régulièrement cette page."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"4. Accès à la plateforme"}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"4.1 Accès libre"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"La consultation des informations publiques de la plateforme (présentation, blog, profils de formateurs validés, offres de formation approuvées) est libre et gratuite."}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"4.2 Création de compte"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"L'accès à certaines fonctionnalités nécessite la création d'un compte utilisateur. L'inscription est libre et gratuite :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Formateurs :"})," inscription libre, profil soumis à validation avant publication"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Établissements scolaires :"})," inscription libre, possibilité de soumettre des demandes de formation"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Administrateurs :"})," gestion de la plateforme"]})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"4.3 Informations de compte"}),s.jsx("p",{className:"text-muted-foreground",children:"Vous vous engagez à fournir des informations exactes, à jour et complètes lors de votre inscription. Vous êtes responsable de la confidentialité de vos identifiants de connexion."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"5. Utilisation de la plateforme"}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"5.1 Usage conforme"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vous vous engagez à utiliser la plateforme de manière conforme à sa destination et aux lois en vigueur. Il est strictement interdit de :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Publier des contenus illégaux, diffamatoires, discriminatoires ou contraires aux bonnes mœurs"}),s.jsx("li",{children:"Usurper l'identité d'une autre personne ou entité"}),s.jsx("li",{children:"Tenter d'accéder de manière non autorisée à la plateforme ou aux données d'autres utilisateurs"}),s.jsx("li",{children:"Collecter des données personnelles d'autres utilisateurs sans leur consentement"}),s.jsx("li",{children:"Utiliser la plateforme à des fins commerciales non autorisées"}),s.jsx("li",{children:"Diffuser des virus ou tout autre code malveillant"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"5.2 Responsabilité des contenus"}),s.jsx("p",{className:"text-muted-foreground",children:"Chaque utilisateur est responsable des contenus qu'il publie sur la plateforme (profils, demandes, messages, documents). Qalam Software se réserve le droit de supprimer tout contenu jugé inapproprié sans préavis."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"6. Services proposés"}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"6.1 Pour les formateurs"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Création et gestion de profil professionnel"}),s.jsx("li",{children:"Mise en avant de leurs spécialités et expertises"}),s.jsx("li",{children:"Visibilité auprès des établissements scolaires (après validation)"}),s.jsx("li",{children:"Analyse automatique de CV par intelligence artificielle"}),s.jsx("li",{children:"Candidature aux offres de formation"}),s.jsx("li",{children:"Messagerie intégrée pour communiquer avec les établissements"}),s.jsx("li",{children:"Signature électronique de contrats de collaboration"}),s.jsx("li",{children:"Suivi des missions et déclaration des heures"}),s.jsx("li",{children:"Système de notifications en temps réel"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"6.2 Pour les établissements"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Consultation des profils de formateurs validés"}),s.jsx("li",{children:"Publication d'offres de formation (gratuites jusqu'à un certain nombre, puis payantes)"}),s.jsx("li",{children:"Sponsorisation d'offres pour une meilleure visibilité (service payant)"}),s.jsx("li",{children:"Réception et gestion des candidatures de formateurs"}),s.jsx("li",{children:"Messagerie intégrée pour communiquer avec les formateurs"}),s.jsx("li",{children:"Recommandations automatiques de formateurs correspondant aux besoins"}),s.jsx("li",{children:"Gestion des contrats de prestation"}),s.jsx("li",{children:"Validation des heures de mission"}),s.jsx("li",{children:"Système de notifications en temps réel"}),s.jsx("li",{children:"Pré-remplissage automatique des informations pour les établissements connectés"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"6.3 Services payants"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Certains services sont payants pour les établissements :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Publications supplémentaires :"})," Au-delà du quota gratuit, chaque publication d'offre est facturée"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Sponsorisation d'offres :"}),` Mise en avant d'une offre pendant 30 jours avec badge "Offre sponsorisée" et position prioritaire dans les recherches`]})]}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Les paiements sont traités de manière sécurisée via notre partenaire Stripe. Les tarifs sont affichés au moment de la transaction. Les offres sponsorisées ne sont pas automatiquement archivées et peuvent être archivées manuellement par l'établissement."}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"6.4 Système de notifications"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"La plateforme dispose d'un système de notifications en temps réel qui vous informe :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Des nouvelles candidatures reçues (établissements)"}),s.jsx("li",{children:"De l'acceptation ou du refus de vos candidatures (formateurs)"}),s.jsx("li",{children:"Des nouveaux messages reçus"}),s.jsx("li",{children:"De l'approbation ou du rejet de vos offres/profils"}),s.jsx("li",{children:"Des mises à jour importantes concernant vos missions"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"6.5 Communications par email"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"En utilisant la plateforme, vous acceptez de recevoir des communications par email concernant :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"L'approbation de vos offres de formation"}),s.jsx("li",{children:"Les recommandations de formateurs pour vos offres"}),s.jsx("li",{children:"Les notifications importantes liées à votre compte"}),s.jsx("li",{children:"Notre newsletter (avec votre consentement explicite)"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"6.6 Disponibilité"}),s.jsx("p",{className:"text-muted-foreground",children:"Nous nous efforçons d'assurer la disponibilité de la plateforme 24h/24, 7j/7. Toutefois, des interruptions pour maintenance ou raisons techniques peuvent survenir. Qalam Software ne saurait être tenu responsable des dommages résultant d'une indisponibilité temporaire."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"7. Contrats et engagements"}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"7.1 Contrat formateur"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Les formateurs validés sont invités à signer un contrat de collaboration avec PedagoBridge définissant les modalités de leur intervention via la plateforme. Ce contrat est signé électroniquement et contresigné par l'administration."}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"7.2 Contrats de prestation"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Lorsqu'un établissement accepte la candidature d'un formateur, un contrat de prestation peut être généré pour formaliser la mission. Ce contrat détaille les conditions de la prestation (durée, rémunération, modalités)."}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"7.3 Signature électronique"}),s.jsx("p",{className:"text-muted-foreground",children:"La signature électronique des contrats via la plateforme a la même valeur juridique qu'une signature manuscrite conformément à la réglementation en vigueur."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"8. Propriété intellectuelle"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Tous les éléments de la plateforme PedagoBridge (design, textes, images, logos, code source) sont protégés par le droit de la propriété intellectuelle et appartiennent à Qalam Software ou à ses partenaires."}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Toute reproduction, représentation, modification, publication ou adaptation de tout ou partie des éléments de la plateforme, quel que soit le moyen ou le procédé utilisé, est interdite sans l'autorisation écrite préalable de Qalam Software."}),s.jsx("p",{className:"text-muted-foreground",children:"Les contenus publiés par les utilisateurs restent leur propriété. En publiant sur la plateforme, vous accordez à Qalam Software une licence non exclusive d'utilisation de ces contenus dans le cadre de l'exploitation de la plateforme."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"9. Données personnelles et cookies"}),s.jsxs("p",{className:"text-muted-foreground mb-4",children:["Le traitement de vos données personnelles est régi par notre ",s.jsx(vt,{to:"/privacy-policy",className:"text-primary hover:underline",children:"Politique de Confidentialité"}),". En utilisant la plateforme, vous consentez à ce que vos données soient collectées et traitées conformément à cette politique."]}),s.jsx("p",{className:"text-muted-foreground",children:"Notre site utilise des cookies pour améliorer votre expérience. Une bannière de consentement vous est présentée lors de votre première visite pour vous permettre d'accepter ou de refuser l'utilisation des cookies non essentiels."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"10. Responsabilité"}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"10.1 Limitation de responsabilité"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Qalam Software agit en tant qu'intermédiaire technique facilitant la mise en relation entre formateurs et établissements. La plateforme ne saurait être tenue responsable :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"De la qualité des prestations de formation réalisées"}),s.jsx("li",{children:"Des litiges pouvant survenir entre formateurs et établissements"}),s.jsx("li",{children:"De l'exactitude des informations fournies par les utilisateurs"}),s.jsx("li",{children:"Des dommages directs ou indirects résultant de l'utilisation de la plateforme"})]}),s.jsx("h3",{className:"text-xl font-semibold mb-3",children:"10.2 Contenu des utilisateurs"}),s.jsx("p",{className:"text-muted-foreground",children:"Chaque utilisateur est seul responsable du contenu qu'il publie. Qalam Software ne peut être tenu responsable des propos ou contenus publiés par les utilisateurs."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"11. Suspension et résiliation"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Qalam Software se réserve le droit de suspendre ou de résilier, à tout moment et sans préavis, l'accès d'un utilisateur à la plateforme en cas de :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Non-respect des présentes CGU"}),s.jsx("li",{children:"Fourniture d'informations fausses ou trompeuses"}),s.jsx("li",{children:"Comportement nuisible aux intérêts de la plateforme ou d'autres utilisateurs"}),s.jsx("li",{children:"Demande de l'utilisateur"})]}),s.jsx("p",{className:"text-muted-foreground",children:"L'utilisateur peut demander la suppression de son compte à tout moment via les paramètres de son compte ou en nous contactant."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"12. Paiements et remboursements"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Les paiements sont traités de manière sécurisée par notre partenaire Stripe. En effectuant un paiement, vous acceptez les conditions d'utilisation de Stripe."}),s.jsxs("ul",{className:"list-disc list-inside space-y-2 text-muted-foreground mb-4",children:[s.jsx("li",{children:"Les prix sont affichés TTC"}),s.jsx("li",{children:"Le paiement est dû au moment de la transaction"}),s.jsx("li",{children:"Les services de sponsorisation ne sont pas remboursables une fois activés"}),s.jsx("li",{children:"En cas d'erreur technique empêchant la livraison du service, un remboursement pourra être effectué sur demande"})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"13. Newsletter"}),s.jsx("p",{className:"text-muted-foreground",children:"En vous inscrivant à notre newsletter, vous consentez à recevoir des emails concernant nos articles de blog et actualités. Vous pouvez vous désabonner à tout moment en cliquant sur le lien présent dans chaque email."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"14. Liens hypertextes"}),s.jsx("p",{className:"text-muted-foreground",children:"La plateforme peut contenir des liens vers des sites externes. Qalam Software n'exerce aucun contrôle sur ces sites et décline toute responsabilité quant à leur contenu ou leurs pratiques en matière de confidentialité."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"15. Force majeure"}),s.jsx("p",{className:"text-muted-foreground",children:"Qalam Software ne pourra être tenu responsable de tout retard ou inexécution de ses obligations résultant d'un cas de force majeure tel que défini par la jurisprudence française."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"16. Droit applicable et juridiction"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Les présentes CGU sont régies par le droit français. En cas de litige relatif à l'interprétation ou à l'exécution des présentes, et à défaut de résolution amiable, les tribunaux français seront seuls compétents."}),s.jsx("p",{className:"text-muted-foreground",children:"Conformément à l'article L.612-1 du Code de la consommation, vous pouvez recourir gratuitement à un médiateur de la consommation en cas de litige."})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"17. Contact"}),s.jsxs("p",{className:"text-muted-foreground",children:["Pour toute question concernant les présentes CGU, vous pouvez nous contacter via le ",s.jsx(vt,{to:"/#contact",className:"text-primary hover:underline",children:"formulaire de contact"})," disponible sur le site."]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"18. Divisibilité"}),s.jsx("p",{className:"text-muted-foreground",children:"Si une ou plusieurs dispositions des présentes CGU sont déclarées nulles ou non applicables, les autres dispositions conserveront leur pleine force et effet."})]}),s.jsx("div",{className:"mt-12 pt-8 border-t",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Dernière mise à jour : 26 novembre 2025"})})]})]})]})}function QLe(){const e=Xt(),[t]=Bj(),r=t.get("token"),[n,a]=w.useState(!0),[i,o]=w.useState(null),[l,c]=w.useState(""),[u,d]=w.useState(""),[f,m]=w.useState(""),[h,g]=w.useState(!1),[p,x]=w.useState(!1),[v,b]=w.useState(!1);w.useEffect(()=>{y()},[r]);const y=async()=>{if(!r){a(!1);return}try{const{data:_,error:j}=await he.from("trainer_invitations").select("*").eq("token",r).eq("used",!1).gt("expires_at",new Date().toISOString()).single();if(j||!_){ae.error("Cette invitation n'est plus valide"),a(!1);return}o(_),a(!1)}catch(_){console.error("Error validating token:",_),a(!1)}},N=async _=>{if(_.preventDefault(),l!==u){ae.error("Les mots de passe ne correspondent pas");return}if(l.length<6){ae.error("Le mot de passe doit contenir au moins 6 caractères");return}if(!f.trim()){ae.error("Veuillez entrer votre nom");return}if(!h||!p){ae.error("Veuillez accepter les CGU et la politique de confidentialité");return}b(!0);try{const{data:j,error:S}=await he.auth.signUp({email:i.email,password:l,options:{emailRedirectTo:`${window.location.origin}/`,data:{name:f.trim()}}});if(S)throw S;if(!j.user)throw new Error("Erreur lors de la création du compte");const{error:I}=await he.from("trainer_invitations").update({used:!0,used_at:new Date().toISOString()}).eq("token",r);I&&console.error("Error updating invitation:",I);const{error:P}=await he.from("user_roles").insert({user_id:j.user.id,role:"trainer"});P&&console.error("Error assigning role:",P);const{error:F}=await he.from("trainer_profiles").insert({user_id:j.user.id,email:i.email,name:f.trim(),status:"pending"});F?console.error("Error creating profile:",F):xi.trackSignup("trainer",{via:"invitation"});try{await he.functions.invoke("notify-trainer-signup",{body:{trainerName:f.trim(),trainerEmail:i.email}})}catch(T){console.error("Error sending notification email:",T)}ae.success("Compte créé avec succès ! Vous pouvez maintenant vous connecter."),e("/auth")}catch(j){console.error("Error during signup:",j),ae.error(j.message||"Erreur lors de la création du compte")}finally{b(!1)}};return n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx(at,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),s.jsx("p",{className:"text-muted-foreground",children:"Validation de l'invitation..."})]})}):!r||!i?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsxs(ke,{className:"max-w-md w-full",children:[s.jsxs(ht,{className:"text-center",children:[s.jsx(Fs,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),s.jsx(xt,{children:"Invitation invalide"}),s.jsx(Qr,{children:"Cette invitation n'existe pas ou a expiré. Veuillez contacter un administrateur pour obtenir une nouvelle invitation."})]}),s.jsx(Ae,{children:s.jsx(ne,{onClick:()=>e("/"),className:"w-full",children:"Retour à l'accueil"})})]})}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsx("div",{className:"container max-w-md mx-auto",children:s.jsxs(ke,{children:[s.jsxs(ht,{className:"text-center",children:[s.jsx(ma,{className:"h-12 w-12 text-primary mx-auto mb-4"}),s.jsx(xt,{className:"text-2xl",children:"Créez votre compte formateur"}),s.jsxs(Qr,{children:["Invitation pour : ",s.jsx("strong",{children:i.email})]})]}),s.jsxs(Ae,{children:[s.jsxs("form",{onSubmit:N,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"name",children:"Nom complet"}),s.jsx(Ye,{id:"name",type:"text",placeholder:"Votre nom",value:f,onChange:_=>m(_.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"password",children:"Mot de passe"}),s.jsx(Ye,{id:"password",type:"password",placeholder:"Minimum 6 caractères",value:l,onChange:_=>c(_.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"confirmPassword",children:"Confirmer le mot de passe"}),s.jsx(Ye,{id:"confirmPassword",type:"password",placeholder:"Confirmez votre mot de passe",value:u,onChange:_=>d(_.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-3 pt-2",children:[s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Vo,{id:"terms",checked:h,onCheckedChange:_=>g(_===!0)}),s.jsxs("label",{htmlFor:"terms",className:"text-sm leading-tight cursor-pointer",children:["J'accepte les"," ",s.jsx("button",{type:"button",onClick:()=>e("/terms"),className:"text-primary hover:underline",children:"Conditions Générales d'Utilisation"})]})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Vo,{id:"privacy",checked:p,onCheckedChange:_=>x(_===!0)}),s.jsxs("label",{htmlFor:"privacy",className:"text-sm leading-tight cursor-pointer",children:["J'accepte la"," ",s.jsx("button",{type:"button",onClick:()=>e("/privacy"),className:"text-primary hover:underline",children:"Politique de Confidentialité"})]})]})]}),s.jsx(ne,{type:"submit",className:"w-full",disabled:v||!h||!p,children:v?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Création en cours..."]}):"Créer mon compte"})]}),s.jsx("div",{className:"mt-6 p-4 bg-muted rounded-lg text-sm",children:s.jsx("p",{className:"text-muted-foreground",children:"Après la création de votre compte, vous pourrez compléter votre profil avec vos spécialités, votre CV et votre photo."})})]})]})})})}function eFe(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return w.useMemo(()=>n=>{t.forEach(a=>a(n))},t)}const JC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function h1(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function XL(e){return"nodeType"in e}function Zo(e){var t,r;return e?h1(e)?e:XL(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function ZL(e){const{Document:t}=Zo(e);return e instanceof t}function n_(e){return h1(e)?!1:e instanceof Zo(e).HTMLElement}function Coe(e){return e instanceof Zo(e).SVGElement}function m1(e){return e?h1(e)?e.document:XL(e)?ZL(e)?e:n_(e)||Coe(e)?e.ownerDocument:document:document:document}const td=JC?w.useLayoutEffect:w.useEffect;function QC(e){const t=w.useRef(e);return td(()=>{t.current=e}),w.useCallback(function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];return t.current==null?void 0:t.current(...n)},[])}function tFe(){const e=w.useRef(null),t=w.useCallback((n,a)=>{e.current=setInterval(n,a)},[]),r=w.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function S2(e,t){t===void 0&&(t=[e]);const r=w.useRef(e);return td(()=>{r.current!==e&&(r.current=e)},t),r}function s_(e,t){const r=w.useRef();return w.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function d4(e){const t=QC(e),r=w.useRef(null),n=w.useCallback(a=>{a!==r.current&&(t==null||t(a,r.current)),r.current=a},[]);return[r,n]}function f4(e){const t=w.useRef();return w.useEffect(()=>{t.current=e},[e]),t.current}let TT={};function a_(e,t){return w.useMemo(()=>{if(t)return t;const r=TT[e]==null?0:TT[e]+1;return TT[e]=r,e+"-"+r},[e,t])}function Eoe(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return n.reduce((i,o)=>{const l=Object.entries(o);for(const[c,u]of l){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const Nv=Eoe(1),k2=Eoe(-1);function rFe(e){return"clientX"in e&&"clientY"in e}function eE(e){if(!e)return!1;const{KeyboardEvent:t}=Zo(e.target);return t&&e instanceof t}function nFe(e){if(!e)return!1;const{TouchEvent:t}=Zo(e.target);return t&&e instanceof t}function h4(e){if(nFe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return rFe(e)?{x:e.clientX,y:e.clientY}:null}const up=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[up.Translate.toString(e),up.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),oq="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function sFe(e){return e.matches(oq)?e:e.querySelector(oq)}const aFe={display:"none"};function iFe(e){let{id:t,value:r}=e;return be.createElement("div",{id:t,style:aFe},r)}function oFe(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return be.createElement("div",{id:t,style:a,role:"status","aria-live":n,"aria-atomic":!0},r)}function lFe(){const[e,t]=w.useState("");return{announce:w.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Aoe=w.createContext(null);function cFe(e){const t=w.useContext(Aoe);w.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function uFe(){const[e]=w.useState(()=>new Set),t=w.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[w.useCallback(n=>{let{type:a,event:i}=n;e.forEach(o=>{var l;return(l=o[a])==null?void 0:l.call(o,i)})},[e]),t]}const dFe={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},fFe={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function hFe(e){let{announcements:t=fFe,container:r,hiddenTextDescribedById:n,screenReaderInstructions:a=dFe}=e;const{announce:i,announcement:o}=lFe(),l=a_("DndLiveRegion"),[c,u]=w.useState(!1);if(w.useEffect(()=>{u(!0)},[]),cFe(w.useMemo(()=>({onDragStart(f){let{active:m}=f;i(t.onDragStart({active:m}))},onDragMove(f){let{active:m,over:h}=f;t.onDragMove&&i(t.onDragMove({active:m,over:h}))},onDragOver(f){let{active:m,over:h}=f;i(t.onDragOver({active:m,over:h}))},onDragEnd(f){let{active:m,over:h}=f;i(t.onDragEnd({active:m,over:h}))},onDragCancel(f){let{active:m,over:h}=f;i(t.onDragCancel({active:m,over:h}))}}),[i,t])),!c)return null;const d=be.createElement(be.Fragment,null,be.createElement(iFe,{id:n,value:a.draggable}),be.createElement(oFe,{id:l,announcement:o}));return r?$c.createPortal(d,r):d}var di;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(di||(di={}));function m4(){}function l8(e,t){return w.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Toe(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return w.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const rd=Object.freeze({x:0,y:0});function Poe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mFe(e,t){const r=h4(e);if(!r)return"0 0";const n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}function Ooe(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function pFe(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function lq(e){let{left:t,top:r,height:n,width:a}=e;return[{x:t,y:r},{x:t+a,y:r},{x:t,y:r+n},{x:t+a,y:r+n}]}function Doe(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function cq(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const gFe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=cq(t,t.left,t.top),i=[];for(const o of n){const{id:l}=o,c=r.get(l);if(c){const u=Poe(cq(c),a);i.push({id:l,data:{droppableContainer:o,value:u}})}}return i.sort(Ooe)},xFe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=lq(t),i=[];for(const o of n){const{id:l}=o,c=r.get(l);if(c){const u=lq(c),d=a.reduce((m,h,g)=>m+Poe(u[g],h),0),f=Number((d/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:f}})}}return i.sort(Ooe)};function vFe(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=a-n,l=i-r;if(n<a&&r<i){const c=t.width*t.height,u=e.width*e.height,d=o*l,f=d/(c+u-d);return Number(f.toFixed(4))}return 0}const yFe=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const a=[];for(const i of n){const{id:o}=i,l=r.get(o);if(l){const c=vFe(l,t);c>0&&a.push({id:o,data:{droppableContainer:i,value:c}})}}return a.sort(pFe)};function bFe(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Ioe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:rd}function wFe(e){return function(r){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return a.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...r})}}const jFe=wFe(1);function Roe(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function _Fe(e,t,r){const n=Roe(t);if(!n)return e;const{scaleX:a,scaleY:i,x:o,y:l}=n,c=e.left-o-(1-a)*parseFloat(r),u=e.top-l-(1-i)*parseFloat(r.slice(r.indexOf(" ")+1)),d=a?e.width/a:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const NFe={ignoreTransform:!1};function p1(e,t){t===void 0&&(t=NFe);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Zo(e).getComputedStyle(e);u&&(r=_Fe(r,u,d))}const{top:n,left:a,width:i,height:o,bottom:l,right:c}=r;return{top:n,left:a,width:i,height:o,bottom:l,right:c}}function uq(e){return p1(e,{ignoreTransform:!0})}function SFe(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function kFe(e,t){return t===void 0&&(t=Zo(e).getComputedStyle(e)),t.position==="fixed"}function CFe(e,t){t===void 0&&(t=Zo(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const i=t[a];return typeof i=="string"?r.test(i):!1})}function tE(e,t){const r=[];function n(a){if(t!=null&&r.length>=t||!a)return r;if(ZL(a)&&a.scrollingElement!=null&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!n_(a)||Coe(a)||r.includes(a))return r;const i=Zo(e).getComputedStyle(a);return a!==e&&CFe(a,i)&&r.push(a),kFe(a,i)?r:n(a.parentNode)}return e?n(e):r}function Loe(e){const[t]=tE(e,1);return t??null}function PT(e){return!JC||!e?null:h1(e)?e:XL(e)?ZL(e)||e===m1(e).scrollingElement?window:n_(e)?e:null:null}function Foe(e){return h1(e)?e.scrollX:e.scrollLeft}function Moe(e){return h1(e)?e.scrollY:e.scrollTop}function c8(e){return{x:Foe(e),y:Moe(e)}}var ki;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ki||(ki={}));function $oe(e){return!JC||!e?!1:e===document.scrollingElement}function Boe(e){const t={x:0,y:0},r=$oe(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},a=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,l=e.scrollLeft>=n.x;return{isTop:a,isLeft:i,isBottom:o,isRight:l,maxScroll:n,minScroll:t}}const EFe={x:.2,y:.2};function AFe(e,t,r,n,a){let{top:i,left:o,right:l,bottom:c}=r;n===void 0&&(n=10),a===void 0&&(a=EFe);const{isTop:u,isBottom:d,isLeft:f,isRight:m}=Boe(e),h={x:0,y:0},g={x:0,y:0},p={height:t.height*a.y,width:t.width*a.x};return!u&&i<=t.top+p.height?(h.y=ki.Backward,g.y=n*Math.abs((t.top+p.height-i)/p.height)):!d&&c>=t.bottom-p.height&&(h.y=ki.Forward,g.y=n*Math.abs((t.bottom-p.height-c)/p.height)),!m&&l>=t.right-p.width?(h.x=ki.Forward,g.x=n*Math.abs((t.right-p.width-l)/p.width)):!f&&o<=t.left+p.width&&(h.x=ki.Backward,g.x=n*Math.abs((t.left+p.width-o)/p.width)),{direction:h,speed:g}}function TFe(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:r,right:n,bottom:a}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:a,width:e.clientWidth,height:e.clientHeight}}function zoe(e){return e.reduce((t,r)=>Nv(t,c8(r)),rd)}function PFe(e){return e.reduce((t,r)=>t+Foe(r),0)}function OFe(e){return e.reduce((t,r)=>t+Moe(r),0)}function Uoe(e,t){if(t===void 0&&(t=p1),!e)return;const{top:r,left:n,bottom:a,right:i}=t(e);Loe(e)&&(a<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const DFe=[["x",["left","right"],PFe],["y",["top","bottom"],OFe]];class JL{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=tE(r),a=zoe(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of DFe)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=l(n),d=a[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xw{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var a;(a=this.target)==null||a.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function IFe(e){const{EventTarget:t}=Zo(e);return e instanceof t?e:m1(e)}function OT(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var Tc;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Tc||(Tc={}));function dq(e){e.preventDefault()}function RFe(e){e.stopPropagation()}var Sn;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Sn||(Sn={}));const qoe={start:[Sn.Space,Sn.Enter],cancel:[Sn.Esc],end:[Sn.Space,Sn.Enter,Sn.Tab]},LFe=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Sn.Right:return{...r,x:r.x+25};case Sn.Left:return{...r,x:r.x-25};case Sn.Down:return{...r,y:r.y+25};case Sn.Up:return{...r,y:r.y-25}}};class QL{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new xw(m1(r)),this.windowListeners=new xw(Zo(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Tc.Resize,this.handleCancel),this.windowListeners.add(Tc.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Tc.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Uoe(n),r(rd)}handleKeyDown(t){if(eE(t)){const{active:r,context:n,options:a}=this.props,{keyboardCodes:i=qoe,coordinateGetter:o=LFe,scrollBehavior:l="smooth"}=a,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=n.current,d=u?{x:u.left,y:u.top}:rd;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:r,context:n.current,currentCoordinates:d});if(f){const m=k2(f,d),h={x:0,y:0},{scrollableAncestors:g}=n.current;for(const p of g){const x=t.code,{isTop:v,isRight:b,isLeft:y,isBottom:N,maxScroll:_,minScroll:j}=Boe(p),S=TFe(p),I={x:Math.min(x===Sn.Right?S.right-S.width/2:S.right,Math.max(x===Sn.Right?S.left:S.left+S.width/2,f.x)),y:Math.min(x===Sn.Down?S.bottom-S.height/2:S.bottom,Math.max(x===Sn.Down?S.top:S.top+S.height/2,f.y))},P=x===Sn.Right&&!b||x===Sn.Left&&!y,F=x===Sn.Down&&!N||x===Sn.Up&&!v;if(P&&I.x!==f.x){const T=p.scrollLeft+m.x,k=x===Sn.Right&&T<=_.x||x===Sn.Left&&T>=j.x;if(k&&!m.y){p.scrollTo({left:T,behavior:l});return}k?h.x=p.scrollLeft-T:h.x=x===Sn.Right?p.scrollLeft-_.x:p.scrollLeft-j.x,h.x&&p.scrollBy({left:-h.x,behavior:l});break}else if(F&&I.y!==f.y){const T=p.scrollTop+m.y,k=x===Sn.Down&&T<=_.y||x===Sn.Up&&T>=j.y;if(k&&!m.x){p.scrollTo({top:T,behavior:l});return}k?h.y=p.scrollTop-T:h.y=x===Sn.Down?p.scrollTop-_.y:p.scrollTop-j.y,h.y&&p.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,Nv(k2(f,this.referenceCoordinates),h))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}QL.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=qoe,onActivation:a}=t,{active:i}=r;const{code:o}=e.nativeEvent;if(n.start.includes(o)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function fq(e){return!!(e&&"distance"in e)}function hq(e){return!!(e&&"delay"in e)}class eF{constructor(t,r,n){var a;n===void 0&&(n=IFe(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:i}=t,{target:o}=i;this.props=t,this.events=r,this.document=m1(o),this.documentListeners=new xw(this.document),this.listeners=new xw(n),this.windowListeners=new xw(Zo(o)),this.initialCoordinates=(a=h4(i))!=null?a:rd,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Tc.Resize,this.handleCancel),this.windowListeners.add(Tc.DragStart,dq),this.windowListeners.add(Tc.VisibilityChange,this.handleCancel),this.windowListeners.add(Tc.ContextMenu,dq),this.documentListeners.add(Tc.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(hq(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(fq(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:a}=this.props;a(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Tc.Click,RFe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Tc.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:a,props:i}=this,{onMove:o,options:{activationConstraint:l}}=i;if(!a)return;const c=(r=h4(t))!=null?r:rd,u=k2(a,c);if(!n&&l){if(fq(l)){if(l.tolerance!=null&&OT(u,l.tolerance))return this.handleCancel();if(OT(u,l.distance))return this.handleStart()}if(hq(l)&&OT(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Sn.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const FFe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rE extends eF{constructor(t){const{event:r}=t,n=m1(r.target);super(t,FFe,n)}}rE.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n==null||n({event:r}),!0)}}];const MFe={move:{name:"mousemove"},end:{name:"mouseup"}};var u8;(function(e){e[e.RightClick=2]="RightClick"})(u8||(u8={}));class $Fe extends eF{constructor(t){super(t,MFe,m1(t.event.target))}}$Fe.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===u8.RightClick?!1:(n==null||n({event:r}),!0)}}];const DT={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class BFe extends eF{constructor(t){super(t,DT)}static setup(){return window.addEventListener(DT.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(DT.move.name,t)};function t(){}}}BFe.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:a}=r;return a.length>1?!1:(n==null||n({event:r}),!0)}}];var vw;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(vw||(vw={}));var p4;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(p4||(p4={}));function zFe(e){let{acceleration:t,activator:r=vw.Pointer,canScroll:n,draggingRect:a,enabled:i,interval:o=5,order:l=p4.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:m}=e;const h=qFe({delta:f,disabled:!i}),[g,p]=tFe(),x=w.useRef({x:0,y:0}),v=w.useRef({x:0,y:0}),b=w.useMemo(()=>{switch(r){case vw.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case vw.DraggableRect:return a}},[r,a,c]),y=w.useRef(null),N=w.useCallback(()=>{const j=y.current;if(!j)return;const S=x.current.x*v.current.x,I=x.current.y*v.current.y;j.scrollBy(S,I)},[]),_=w.useMemo(()=>l===p4.TreeOrder?[...u].reverse():u,[l,u]);w.useEffect(()=>{if(!i||!u.length||!b){p();return}for(const j of _){if((n==null?void 0:n(j))===!1)continue;const S=u.indexOf(j),I=d[S];if(!I)continue;const{direction:P,speed:F}=AFe(j,I,b,t,m);for(const T of["x","y"])h[T][P[T]]||(F[T]=0,P[T]=0);if(F.x>0||F.y>0){p(),y.current=j,g(N,o),x.current=F,v.current=P;return}}x.current={x:0,y:0},v.current={x:0,y:0},p()},[t,N,n,p,i,o,JSON.stringify(b),JSON.stringify(h),g,u,_,d,JSON.stringify(m)])}const UFe={x:{[ki.Backward]:!1,[ki.Forward]:!1},y:{[ki.Backward]:!1,[ki.Forward]:!1}};function qFe(e){let{delta:t,disabled:r}=e;const n=f4(t);return s_(a=>{if(r||!n||!a)return UFe;const i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[ki.Backward]:a.x[ki.Backward]||i.x===-1,[ki.Forward]:a.x[ki.Forward]||i.x===1},y:{[ki.Backward]:a.y[ki.Backward]||i.y===-1,[ki.Forward]:a.y[ki.Forward]||i.y===1}}},[r,t,n])}function VFe(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return s_(a=>{var i;return t==null?null:(i=n??a)!=null?i:null},[n,t])}function WFe(e,t){return w.useMemo(()=>e.reduce((r,n)=>{const{sensor:a}=n,i=a.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,n)}));return[...r,...i]},[]),[e,t])}var C2;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(C2||(C2={}));var d8;(function(e){e.Optimized="optimized"})(d8||(d8={}));const mq=new Map;function HFe(e,t){let{dragging:r,dependencies:n,config:a}=t;const[i,o]=w.useState(null),{frequency:l,measure:c,strategy:u}=a,d=w.useRef(e),f=x(),m=S2(f),h=w.useCallback(function(v){v===void 0&&(v=[]),!m.current&&o(b=>b===null?v:b.concat(v.filter(y=>!b.includes(y))))},[m]),g=w.useRef(null),p=s_(v=>{if(f&&!r)return mq;if(!v||v===mq||d.current!==e||i!=null){const b=new Map;for(let y of e){if(!y)continue;if(i&&i.length>0&&!i.includes(y.id)&&y.rect.current){b.set(y.id,y.rect.current);continue}const N=y.node.current,_=N?new JL(c(N),N):null;y.rect.current=_,_&&b.set(y.id,_)}return b}return v},[e,i,r,f,c]);return w.useEffect(()=>{d.current=e},[e]),w.useEffect(()=>{f||h()},[r,f]),w.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),w.useEffect(()=>{f||typeof l!="number"||g.current!==null||(g.current=setTimeout(()=>{h(),g.current=null},l))},[l,f,h,...n]),{droppableRects:p,measureDroppableContainers:h,measuringScheduled:i!=null};function x(){switch(u){case C2.Always:return!1;case C2.BeforeDragging:return r;default:return!r}}}function tF(e,t){return s_(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function GFe(e,t){return tF(e,t)}function KFe(e){let{callback:t,disabled:r}=e;const n=QC(t),a=w.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(n)},[n,r]);return w.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function nE(e){let{callback:t,disabled:r}=e;const n=QC(t),a=w.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(n)},[r]);return w.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function YFe(e){return new JL(p1(e),e)}function pq(e,t,r){t===void 0&&(t=YFe);const[n,a]=w.useState(null);function i(){a(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??r)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=KFe({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=nE({callback:i});return td(()=>{i(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),n}function XFe(e){const t=tF(e);return Ioe(e,t)}const gq=[];function ZFe(e){const t=w.useRef(e),r=s_(n=>e?n&&n!==gq&&e&&t.current&&e.parentNode===t.current.parentNode?n:tE(e):gq,[e]);return w.useEffect(()=>{t.current=e},[e]),r}function JFe(e){const[t,r]=w.useState(null),n=w.useRef(e),a=w.useCallback(i=>{const o=PT(i.target);o&&r(l=>l?(l.set(o,c8(o)),new Map(l)):null)},[]);return w.useEffect(()=>{const i=n.current;if(e!==i){o(i);const l=e.map(c=>{const u=PT(c);return u?(u.addEventListener("scroll",a,{passive:!0}),[u,c8(u)]):null}).filter(c=>c!=null);r(l.length?new Map(l):null),n.current=e}return()=>{o(e),o(i)};function o(l){l.forEach(c=>{const u=PT(c);u==null||u.removeEventListener("scroll",a)})}},[a,e]),w.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Nv(i,o),rd):zoe(e):rd,[e,t])}function xq(e,t){t===void 0&&(t=[]);const r=w.useRef(null);return w.useEffect(()=>{r.current=null},t),w.useEffect(()=>{const n=e!==rd;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?k2(e,r.current):rd}function QFe(e){w.useEffect(()=>{if(!JC)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function eMe(e,t){return w.useMemo(()=>e.reduce((r,n)=>{let{eventName:a,handler:i}=n;return r[a]=o=>{i(o,t)},r},{}),[e,t])}function Voe(e){return w.useMemo(()=>e?SFe(e):null,[e])}const vq=[];function tMe(e,t){t===void 0&&(t=p1);const[r]=e,n=Voe(r?Zo(r):null),[a,i]=w.useState(vq);function o(){i(()=>e.length?e.map(c=>$oe(c)?n:new JL(t(c),c)):vq)}const l=nE({callback:o});return td(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),a}function Woe(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return n_(t)?t:e}function rMe(e){let{measure:t}=e;const[r,n]=w.useState(null),a=w.useCallback(u=>{for(const{target:d}of u)if(n_(d)){n(f=>{const m=t(d);return f?{...f,width:m.width,height:m.height}:m});break}},[t]),i=nE({callback:a}),o=w.useCallback(u=>{const d=Woe(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),n(d?t(d):null)},[t,i]),[l,c]=d4(o);return w.useMemo(()=>({nodeRef:l,rect:r,setRef:c}),[r,l,c])}const nMe=[{sensor:rE,options:{}},{sensor:QL,options:{}}],sMe={current:{}},c5={draggable:{measure:uq},droppable:{measure:uq,strategy:C2.WhileDragging,frequency:d8.Optimized},dragOverlay:{measure:p1}};class yw extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const aMe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yw,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:m4},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:c5,measureDroppableContainers:m4,windowRect:null,measuringScheduled:!1},Hoe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:m4,draggableNodes:new Map,over:null,measureDroppableContainers:m4},i_=w.createContext(Hoe),Goe=w.createContext(aMe);function iMe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yw}}}function oMe(e,t){switch(t.type){case di.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case di.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case di.DragEnd:case di.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case di.RegisterDroppable:{const{element:r}=t,{id:n}=r,a=new yw(e.droppable.containers);return a.set(n,r),{...e,droppable:{...e.droppable,containers:a}}}case di.SetDroppableDisabled:{const{id:r,key:n,disabled:a}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;const o=new yw(e.droppable.containers);return o.set(r,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:o}}}case di.UnregisterDroppable:{const{id:r,key:n}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new yw(e.droppable.containers);return i.delete(r),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function lMe(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:a}=w.useContext(i_),i=f4(n),o=f4(r==null?void 0:r.id);return w.useEffect(()=>{if(!t&&!n&&i&&o!=null){if(!eE(i)||document.activeElement===i.target)return;const l=a.get(o);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=sFe(d);if(f){f.focus();break}}})}},[n,t,a,o,i]),null}function Koe(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((a,i)=>i({transform:a,...n}),r):r}function cMe(e){return w.useMemo(()=>({draggable:{...c5.draggable,...e==null?void 0:e.draggable},droppable:{...c5.droppable,...e==null?void 0:e.droppable},dragOverlay:{...c5.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function uMe(e){let{activeNode:t,measure:r,initialRect:n,config:a=!0}=e;const i=w.useRef(!1),{x:o,y:l}=typeof a=="boolean"?{x:a,y:a}:a;td(()=>{if(!o&&!l||!t){i.current=!1;return}if(i.current||!n)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=r(u),f=Ioe(d,n);if(o||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=Loe(u);m&&m.scrollBy({top:f.y,left:f.x})}},[t,o,l,n,r])}const sE=w.createContext({...rd,scaleX:1,scaleY:1});var im;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(im||(im={}));const Yoe=w.memo(function(t){var r,n,a,i;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:d=nMe,collisionDetection:f=yFe,measuring:m,modifiers:h,...g}=t;const p=w.useReducer(oMe,void 0,iMe),[x,v]=p,[b,y]=uFe(),[N,_]=w.useState(im.Uninitialized),j=N===im.Initialized,{draggable:{active:S,nodes:I,translate:P},droppable:{containers:F}}=x,T=S!=null?I.get(S):null,k=w.useRef({initial:null,translated:null}),V=w.useMemo(()=>{var $t;return S!=null?{id:S,data:($t=T==null?void 0:T.data)!=null?$t:sMe,rect:k}:null},[S,T]),C=w.useRef(null),[R,H]=w.useState(null),[q,L]=w.useState(null),M=S2(g,Object.values(g)),z=a_("DndDescribedBy",o),K=w.useMemo(()=>F.getEnabled(),[F]),E=cMe(m),{droppableRects:A,measureDroppableContainers:O,measuringScheduled:U}=HFe(K,{dragging:j,dependencies:[P.x,P.y],config:E.droppable}),Y=VFe(I,S),J=w.useMemo(()=>q?h4(q):null,[q]),se=wr(),ee=GFe(Y,E.draggable.measure);uMe({activeNode:S!=null?I.get(S):null,config:se.layoutShiftCompensation,initialRect:ee,measure:E.draggable.measure});const ie=pq(Y,E.draggable.measure,ee),Ee=pq(Y?Y.parentElement:null),te=w.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:A,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ue=F.getNodeFor((r=te.current.over)==null?void 0:r.id),W=rMe({measure:E.dragOverlay.measure}),Z=(n=W.nodeRef.current)!=null?n:Y,le=j?(a=W.rect)!=null?a:ie:null,re=!!(W.nodeRef.current&&W.rect),oe=XFe(re?null:ie),fe=Voe(Z?Zo(Z):null),Fe=ZFe(j?Ue??Y:null),ge=tMe(Fe),pe=Koe(h,{transform:{x:P.x-oe.x,y:P.y-oe.y,scaleX:1,scaleY:1},activatorEvent:q,active:V,activeNodeRect:ie,containerNodeRect:Ee,draggingNodeRect:le,over:te.current.over,overlayNodeRect:W.rect,scrollableAncestors:Fe,scrollableAncestorRects:ge,windowRect:fe}),Ie=J?Nv(J,P):null,Ge=JFe(Fe),we=xq(Ge),_e=xq(Ge,[ie]),qe=Nv(pe,we),Re=le?jFe(le,pe):null,Me=V&&Re?f({active:V,collisionRect:Re,droppableRects:A,droppableContainers:K,pointerCoordinates:Ie}):null,He=Doe(Me,"id"),[st,Zt]=w.useState(null),_t=re?pe:Nv(pe,_e),Vt=bFe(_t,(i=st==null?void 0:st.rect)!=null?i:null,ie),Jt=w.useRef(null),Qt=w.useCallback(($t,kt)=>{let{sensor:dr,options:Kt}=kt;if(C.current==null)return;const ir=I.get(C.current);if(!ir)return;const jr=$t.nativeEvent,mn=new dr({active:C.current,activeNode:ir,event:jr,options:Kt,context:te,onAbort(sn){if(!I.get(sn))return;const{onDragAbort:tn}=M.current,vn={id:sn};tn==null||tn(vn),b({type:"onDragAbort",event:vn})},onPending(sn,Bn,tn,vn){if(!I.get(sn))return;const{onDragPending:Xn}=M.current,me={id:sn,constraint:Bn,initialCoordinates:tn,offset:vn};Xn==null||Xn(me),b({type:"onDragPending",event:me})},onStart(sn){const Bn=C.current;if(Bn==null)return;const tn=I.get(Bn);if(!tn)return;const{onDragStart:vn}=M.current,En={activatorEvent:jr,active:{id:Bn,data:tn.data,rect:k}};$c.unstable_batchedUpdates(()=>{vn==null||vn(En),_(im.Initializing),v({type:di.DragStart,initialCoordinates:sn,active:Bn}),b({type:"onDragStart",event:En}),H(Jt.current),L(jr)})},onMove(sn){v({type:di.DragMove,coordinates:sn})},onEnd:Ht(di.DragEnd),onCancel:Ht(di.DragCancel)});Jt.current=mn;function Ht(sn){return async function(){const{active:tn,collisions:vn,over:En,scrollAdjustedTranslate:Xn}=te.current;let me=null;if(tn&&Xn){const{cancelDrop:Te}=M.current;me={activatorEvent:jr,active:tn,collisions:vn,delta:Xn,over:En},sn===di.DragEnd&&typeof Te=="function"&&await Promise.resolve(Te(me))&&(sn=di.DragCancel)}C.current=null,$c.unstable_batchedUpdates(()=>{v({type:sn}),_(im.Uninitialized),Zt(null),H(null),L(null),Jt.current=null;const Te=sn===di.DragEnd?"onDragEnd":"onDragCancel";if(me){const Ne=M.current[Te];Ne==null||Ne(me),b({type:Te,event:me})}})}}},[I]),qt=w.useCallback(($t,kt)=>(dr,Kt)=>{const ir=dr.nativeEvent,jr=I.get(Kt);if(C.current!==null||!jr||ir.dndKit||ir.defaultPrevented)return;const mn={active:jr};$t(dr,kt.options,mn)===!0&&(ir.dndKit={capturedBy:kt.sensor},C.current=Kt,Qt(dr,kt))},[I,Qt]),it=WFe(d,qt);QFe(d),td(()=>{ie&&N===im.Initializing&&_(im.Initialized)},[ie,N]),w.useEffect(()=>{const{onDragMove:$t}=M.current,{active:kt,activatorEvent:dr,collisions:Kt,over:ir}=te.current;if(!kt||!dr)return;const jr={active:kt,activatorEvent:dr,collisions:Kt,delta:{x:qe.x,y:qe.y},over:ir};$c.unstable_batchedUpdates(()=>{$t==null||$t(jr),b({type:"onDragMove",event:jr})})},[qe.x,qe.y]),w.useEffect(()=>{const{active:$t,activatorEvent:kt,collisions:dr,droppableContainers:Kt,scrollAdjustedTranslate:ir}=te.current;if(!$t||C.current==null||!kt||!ir)return;const{onDragOver:jr}=M.current,mn=Kt.get(He),Ht=mn&&mn.rect.current?{id:mn.id,rect:mn.rect.current,data:mn.data,disabled:mn.disabled}:null,sn={active:$t,activatorEvent:kt,collisions:dr,delta:{x:ir.x,y:ir.y},over:Ht};$c.unstable_batchedUpdates(()=>{Zt(Ht),jr==null||jr(sn),b({type:"onDragOver",event:sn})})},[He]),td(()=>{te.current={activatorEvent:q,active:V,activeNode:Y,collisionRect:Re,collisions:Me,droppableRects:A,draggableNodes:I,draggingNode:Z,draggingNodeRect:le,droppableContainers:F,over:st,scrollableAncestors:Fe,scrollAdjustedTranslate:qe},k.current={initial:le,translated:Re}},[V,Y,Me,Re,I,Z,le,A,F,st,Fe,qe]),zFe({...se,delta:P,draggingRect:Re,pointerCoordinates:Ie,scrollableAncestors:Fe,scrollableAncestorRects:ge});const It=w.useMemo(()=>({active:V,activeNode:Y,activeNodeRect:ie,activatorEvent:q,collisions:Me,containerNodeRect:Ee,dragOverlay:W,draggableNodes:I,droppableContainers:F,droppableRects:A,over:st,measureDroppableContainers:O,scrollableAncestors:Fe,scrollableAncestorRects:ge,measuringConfiguration:E,measuringScheduled:U,windowRect:fe}),[V,Y,ie,q,Me,Ee,W,I,F,A,st,O,Fe,ge,E,U,fe]),Mt=w.useMemo(()=>({activatorEvent:q,activators:it,active:V,activeNodeRect:ie,ariaDescribedById:{draggable:z},dispatch:v,draggableNodes:I,over:st,measureDroppableContainers:O}),[q,it,V,ie,v,z,I,st,O]);return be.createElement(Aoe.Provider,{value:y},be.createElement(i_.Provider,{value:Mt},be.createElement(Goe.Provider,{value:It},be.createElement(sE.Provider,{value:Vt},u)),be.createElement(lMe,{disabled:(l==null?void 0:l.restoreFocus)===!1})),be.createElement(hFe,{...l,hiddenTextDescribedById:z}));function wr(){const $t=(R==null?void 0:R.autoScrollEnabled)===!1,kt=typeof c=="object"?c.enabled===!1:c===!1,dr=j&&!$t&&!kt;return typeof c=="object"?{...c,enabled:dr}:{enabled:dr}}}),dMe=w.createContext(null),yq="button",fMe="Draggable";function Xoe(e){let{id:t,data:r,disabled:n=!1,attributes:a}=e;const i=a_(fMe),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:m}=w.useContext(i_),{role:h=yq,roleDescription:g="draggable",tabIndex:p=0}=a??{},x=(c==null?void 0:c.id)===t,v=w.useContext(x?sE:dMe),[b,y]=d4(),[N,_]=d4(),j=eMe(o,t),S=S2(r);td(()=>(f.set(t,{id:t,key:i,node:b,activatorNode:N,data:S}),()=>{const P=f.get(t);P&&P.key===i&&f.delete(t)}),[f,t]);const I=w.useMemo(()=>({role:h,tabIndex:p,"aria-disabled":n,"aria-pressed":x&&h===yq?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[n,h,p,x,g,d.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:I,isDragging:x,listeners:n?void 0:j,node:b,over:m,setNodeRef:y,setActivatorNodeRef:_,transform:v}}function Zoe(){return w.useContext(Goe)}const hMe="Droppable",mMe={timeout:25};function Joe(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:a}=e;const i=a_(hMe),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=w.useContext(i_),d=w.useRef({disabled:r}),f=w.useRef(!1),m=w.useRef(null),h=w.useRef(null),{disabled:g,updateMeasurementsFor:p,timeout:x}={...mMe,...a},v=S2(p??n),b=w.useCallback(()=>{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),h.current=null},x)},[x]),y=nE({callback:b,disabled:g||!o}),N=w.useCallback((I,P)=>{y&&(P&&(y.unobserve(P),f.current=!1),I&&y.observe(I))},[y]),[_,j]=d4(N),S=S2(t);return w.useEffect(()=>{!y||!_.current||(y.disconnect(),f.current=!1,y.observe(_.current))},[_,y]),w.useEffect(()=>(l({type:di.RegisterDroppable,element:{id:n,key:i,disabled:r,node:_,rect:m,data:S}}),()=>l({type:di.UnregisterDroppable,key:i,id:n})),[n]),w.useEffect(()=>{r!==d.current.disabled&&(l({type:di.SetDroppableDisabled,id:n,key:i,disabled:r}),d.current.disabled=r)},[n,i,r,l]),{active:o,rect:m,isOver:(c==null?void 0:c.id)===n,node:_,over:c,setNodeRef:j}}function pMe(e){let{animation:t,children:r}=e;const[n,a]=w.useState(null),[i,o]=w.useState(null),l=f4(r);return!r&&!n&&l&&a(l),td(()=>{if(!i)return;const c=n==null?void 0:n.key,u=n==null?void 0:n.props.id;if(c==null||u==null){a(null);return}Promise.resolve(t(u,i)).then(()=>{a(null)})},[t,n,i]),be.createElement(be.Fragment,null,r,n?w.cloneElement(n,{ref:o}):null)}const gMe={x:0,y:0,scaleX:1,scaleY:1};function xMe(e){let{children:t}=e;return be.createElement(i_.Provider,{value:Hoe},be.createElement(sE.Provider,{value:gMe},t))}const vMe={position:"fixed",touchAction:"none"},yMe=e=>eE(e)?"transform 250ms ease":void 0,bMe=w.forwardRef((e,t)=>{let{as:r,activatorEvent:n,adjustScale:a,children:i,className:o,rect:l,style:c,transform:u,transition:d=yMe}=e;if(!l)return null;const f=a?u:{...u,scaleX:1,scaleY:1},m={...vMe,width:l.width,height:l.height,top:l.top,left:l.left,transform:up.Transform.toString(f),transformOrigin:a&&n?mFe(n,l):void 0,transition:typeof d=="function"?d(n):d,...c};return be.createElement(r,{className:o,style:m,ref:t},i)}),wMe=e=>t=>{let{active:r,dragOverlay:n}=t;const a={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[l,c]of Object.entries(i.active))c!==void 0&&(a[l]=r.node.style.getPropertyValue(l),r.node.style.setProperty(l,c));if(i!=null&&i.dragOverlay)for(const[l,c]of Object.entries(i.dragOverlay))c!==void 0&&n.node.style.setProperty(l,c);return o!=null&&o.active&&r.node.classList.add(o.active),o!=null&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(const[c,u]of Object.entries(a))r.node.style.setProperty(c,u);o!=null&&o.active&&r.node.classList.remove(o.active)}},jMe=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:up.Transform.toString(t)},{transform:up.Transform.toString(r)}]},_Me={duration:250,easing:"ease",keyframes:jMe,sideEffects:wMe({styles:{active:{opacity:"0"}}})};function NMe(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:a}=e;return QC((i,o)=>{if(t===null)return;const l=r.get(i);if(!l)return;const c=l.node.current;if(!c)return;const u=Woe(o);if(!u)return;const{transform:d}=Zo(o).getComputedStyle(o),f=Roe(d);if(!f)return;const m=typeof t=="function"?t:SMe(t);return Uoe(c,a.draggable.measure),m({active:{id:i,data:l.data,node:c,rect:a.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:o,rect:a.dragOverlay.measure(u)},droppableContainers:n,measuringConfiguration:a,transform:f})})}function SMe(e){const{duration:t,easing:r,sideEffects:n,keyframes:a}={..._Me,...e};return i=>{let{active:o,dragOverlay:l,transform:c,...u}=i;if(!t)return;const d={x:l.rect.left-o.rect.left,y:l.rect.top-o.rect.top},f={scaleX:c.scaleX!==1?o.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?o.rect.height*c.scaleY/l.rect.height:1},m={x:c.x-d.x,y:c.y-d.y,...f},h=a({...u,active:o,dragOverlay:l,transform:{initial:c,final:m}}),[g]=h,p=h[h.length-1];if(JSON.stringify(g)===JSON.stringify(p))return;const x=n==null?void 0:n({active:o,dragOverlay:l,...u}),v=l.node.animate(h,{duration:t,easing:r,fill:"forwards"});return new Promise(b=>{v.onfinish=()=>{x==null||x(),b()}})}}let bq=0;function kMe(e){return w.useMemo(()=>{if(e!=null)return bq++,bq},[e])}const CMe=be.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:n,style:a,transition:i,modifiers:o,wrapperElement:l="div",className:c,zIndex:u=999}=e;const{activatorEvent:d,active:f,activeNodeRect:m,containerNodeRect:h,draggableNodes:g,droppableContainers:p,dragOverlay:x,over:v,measuringConfiguration:b,scrollableAncestors:y,scrollableAncestorRects:N,windowRect:_}=Zoe(),j=w.useContext(sE),S=kMe(f==null?void 0:f.id),I=Koe(o,{activatorEvent:d,active:f,activeNodeRect:m,containerNodeRect:h,draggingNodeRect:x.rect,over:v,overlayNodeRect:x.rect,scrollableAncestors:y,scrollableAncestorRects:N,transform:j,windowRect:_}),P=tF(m),F=NMe({config:n,draggableNodes:g,droppableContainers:p,measuringConfiguration:b}),T=P?x.setRef:void 0;return be.createElement(xMe,null,be.createElement(pMe,{animation:F},f&&S?be.createElement(bMe,{key:S,id:f.id,ref:T,as:l,activatorEvent:d,adjustScale:t,className:c,transition:i,rect:P,style:{zIndex:u,...a},transform:I},r):null))});function rF(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function EMe(e,t){return e.reduce((r,n,a)=>{const i=t.get(n);return i&&(r[a]=i),r},Array(e.length))}function aS(e){return e!==null&&e>=0}function AMe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function TMe(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Qoe=e=>{let{rects:t,activeIndex:r,overIndex:n,index:a}=e;const i=rF(t,n,r),o=t[a],l=i[a];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},iS={scaleX:1,scaleY:1},PMe=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:a,rects:i,overIndex:o}=e;const l=(t=i[r])!=null?t:n;if(!l)return null;if(a===r){const u=i[o];return u?{x:0,y:r<o?u.top+u.height-(l.top+l.height):u.top-l.top,...iS}:null}const c=OMe(i,a,r);return a>r&&a<=o?{x:0,y:-l.height-c,...iS}:a<r&&a>=o?{x:0,y:l.height+c,...iS}:{x:0,y:0,...iS}};function OMe(e,t,r){const n=e[t],a=e[t-1],i=e[t+1];return n?r<t?a?n.top-(a.top+a.height):i?i.top-(n.top+n.height):0:i?i.top-(n.top+n.height):a?n.top-(a.top+a.height):0:0}const ele="Sortable",tle=be.createContext({activeIndex:-1,containerId:ele,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Qoe,disabled:{draggable:!1,droppable:!1}});function DMe(e){let{children:t,id:r,items:n,strategy:a=Qoe,disabled:i=!1}=e;const{active:o,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:d}=Zoe(),f=a_(ele,r),m=l.rect!==null,h=w.useMemo(()=>n.map(j=>typeof j=="object"&&"id"in j?j.id:j),[n]),g=o!=null,p=o?h.indexOf(o.id):-1,x=u?h.indexOf(u.id):-1,v=w.useRef(h),b=!AMe(h,v.current),y=x!==-1&&p===-1||b,N=TMe(i);td(()=>{b&&g&&d(h)},[b,h,g,d]),w.useEffect(()=>{v.current=h},[h]);const _=w.useMemo(()=>({activeIndex:p,containerId:f,disabled:N,disableTransforms:y,items:h,overIndex:x,useDragOverlay:m,sortedRects:EMe(h,c),strategy:a}),[p,f,N.draggable,N.droppable,y,h,x,c,m,a]);return be.createElement(tle.Provider,{value:_},t)}const IMe=e=>{let{id:t,items:r,activeIndex:n,overIndex:a}=e;return rF(r,n,a).indexOf(t)},RMe=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:a,items:i,newIndex:o,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!n||l!==i&&a===o?!1:r?!0:o!==a&&t===c},LMe={duration:200,easing:"ease"},rle="transform",FMe=up.Transition.toString({property:rle,duration:0,easing:"linear"}),MMe={roleDescription:"sortable"};function $Me(e){let{disabled:t,index:r,node:n,rect:a}=e;const[i,o]=w.useState(null),l=w.useRef(r);return td(()=>{if(!t&&r!==l.current&&n.current){const c=a.current;if(c){const u=p1(n.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}r!==l.current&&(l.current=r)},[t,r,n,a]),w.useEffect(()=>{i&&o(null)},[i]),i}function BMe(e){let{animateLayoutChanges:t=RMe,attributes:r,disabled:n,data:a,getNewIndex:i=IMe,id:o,strategy:l,resizeObserverConfig:c,transition:u=LMe}=e;const{items:d,containerId:f,activeIndex:m,disabled:h,disableTransforms:g,sortedRects:p,overIndex:x,useDragOverlay:v,strategy:b}=w.useContext(tle),y=zMe(n,h),N=d.indexOf(o),_=w.useMemo(()=>({sortable:{containerId:f,index:N,items:d},...a}),[f,a,N,d]),j=w.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:S,node:I,isOver:P,setNodeRef:F}=Joe({id:o,data:_,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:T,activatorEvent:k,activeNodeRect:V,attributes:C,setNodeRef:R,listeners:H,isDragging:q,over:L,setActivatorNodeRef:M,transform:z}=Xoe({id:o,data:_,attributes:{...MMe,...r},disabled:y.draggable}),K=eFe(F,R),E=!!T,A=E&&!g&&aS(m)&&aS(x),O=!v&&q,U=O&&A?z:null,J=A?U??(l??b)({rects:p,activeNodeRect:V,activeIndex:m,overIndex:x,index:N}):null,se=aS(m)&&aS(x)?i({id:o,items:d,activeIndex:m,overIndex:x}):N,ee=T==null?void 0:T.id,ie=w.useRef({activeId:ee,items:d,newIndex:se,containerId:f}),Ee=d!==ie.current.items,te=t({active:T,containerId:f,isDragging:q,isSorting:E,id:o,index:N,items:d,newIndex:ie.current.newIndex,previousItems:ie.current.items,previousContainerId:ie.current.containerId,transition:u,wasDragging:ie.current.activeId!=null}),Ue=$Me({disabled:!te,index:N,node:I,rect:S});return w.useEffect(()=>{E&&ie.current.newIndex!==se&&(ie.current.newIndex=se),f!==ie.current.containerId&&(ie.current.containerId=f),d!==ie.current.items&&(ie.current.items=d)},[E,se,f,d]),w.useEffect(()=>{if(ee===ie.current.activeId)return;if(ee!=null&&ie.current.activeId==null){ie.current.activeId=ee;return}const Z=setTimeout(()=>{ie.current.activeId=ee},50);return()=>clearTimeout(Z)},[ee]),{active:T,activeIndex:m,attributes:C,data:_,rect:S,index:N,newIndex:se,items:d,isOver:P,isSorting:E,isDragging:q,listeners:H,node:I,overIndex:x,over:L,setNodeRef:K,setActivatorNodeRef:M,setDroppableNodeRef:F,setDraggableNodeRef:R,transform:Ue??J,transition:W()};function W(){if(Ue||Ee&&ie.current.newIndex===N)return FMe;if(!(O&&!eE(k)||!u)&&(E||te))return up.Transition.toString({...u,property:rle})}}function zMe(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e==null?void 0:e.draggable)!=null?r:t.draggable,droppable:(n=e==null?void 0:e.droppable)!=null?n:t.droppable}}function g4(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const UMe=[Sn.Down,Sn.Right,Sn.Up,Sn.Left],qMe=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:a,droppableContainers:i,over:o,scrollableAncestors:l}}=t;if(UMe.includes(e.code)){if(e.preventDefault(),!r||!n)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const m=a.get(f.id);if(m)switch(e.code){case Sn.Down:n.top<m.top&&c.push(f);break;case Sn.Up:n.top>m.top&&c.push(f);break;case Sn.Left:n.left>m.left&&c.push(f);break;case Sn.Right:n.left<m.left&&c.push(f);break}});const u=xFe({collisionRect:n,droppableRects:a,droppableContainers:c});let d=Doe(u,"id");if(d===(o==null?void 0:o.id)&&u.length>1&&(d=u[1].id),d!=null){const f=i.get(r.id),m=i.get(d),h=m?a.get(m.id):null,g=m==null?void 0:m.node.current;if(g&&h&&f&&m){const x=tE(g).some((j,S)=>l[S]!==j),v=nle(f,m),b=VMe(f,m),y=x||!v?{x:0,y:0}:{x:b?n.width-h.width:0,y:b?n.height-h.height:0},N={x:h.left,y:h.top};return y.x&&y.y?N:k2(N,y)}}}};function nle(e,t){return!g4(e)||!g4(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function VMe(e,t){return!g4(e)||!g4(t)||!nle(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var aE="Collapsible",[WMe,sle]=Xa(aE),[HMe,nF]=WMe(aE),ale=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:a,disabled:i,onOpenChange:o,...l}=e,[c,u]=Wo({prop:n,defaultProp:a??!1,onChange:o,caller:aE});return s.jsx(HMe,{scope:r,disabled:i,contentId:Ga(),open:c,onOpenToggle:w.useCallback(()=>u(d=>!d),[u]),children:s.jsx(zt.div,{"data-state":oF(c),"data-disabled":i?"":void 0,...l,ref:t})})});ale.displayName=aE;var ile="CollapsibleTrigger",sF=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,a=nF(ile,r);return s.jsx(zt.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":oF(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...n,ref:t,onClick:Ct(e.onClick,a.onOpenToggle)})});sF.displayName=ile;var aF="CollapsibleContent",iF=w.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=nF(aF,e.__scopeCollapsible);return s.jsx(Za,{present:r||a.open,children:({present:i})=>s.jsx(GMe,{...n,ref:t,present:i})})});iF.displayName=aF;var GMe=w.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:a,...i}=e,o=nF(aF,r),[l,c]=w.useState(n),u=w.useRef(null),d=Cr(t,u),f=w.useRef(0),m=f.current,h=w.useRef(0),g=h.current,p=o.open||l,x=w.useRef(p),v=w.useRef(void 0);return w.useEffect(()=>{const b=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(b)},[]),ba(()=>{const b=u.current;if(b){v.current=v.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const y=b.getBoundingClientRect();f.current=y.height,h.current=y.width,x.current||(b.style.transitionDuration=v.current.transitionDuration,b.style.animationName=v.current.animationName),c(n)}},[o.open,n]),s.jsx(zt.div,{"data-state":oF(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!p,...i,ref:d,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:p&&a})});function oF(e){return e?"open":"closed"}var ole=ale,KMe=sF,YMe=iF;const XMe=ole,ZMe=sF,JMe=iF;function QMe({fields:e,status:t,onFieldClick:r}){const[n,a]=w.useState(!0),i=e.filter(p=>p.isRequired),o=e.filter(p=>!p.isRequired),l=i.filter(p=>p.isComplete).length,c=o.filter(p=>p.isComplete).length,u=l+c,d=Math.round(u/e.length*100);Math.round(l/i.length*100);const f=l===i.length,m=()=>d<30?"bg-destructive":d<60?"bg-orange-500":"bg-green-500",g=t==="approved"?{icon:s.jsx(Pn,{className:"h-4 w-4 text-green-600"}),text:"Profil approuvé",color:"text-green-600",bg:"bg-green-50 dark:bg-green-950/20"}:t==="rejected"?{icon:s.jsx(Ri,{className:"h-4 w-4 text-destructive"}),text:"Profil refusé",color:"text-destructive",bg:"bg-destructive/10"}:f?{icon:s.jsx(Di,{className:"h-4 w-4 text-blue-600"}),text:"En attente de validation admin",color:"text-blue-600",bg:"bg-blue-50 dark:bg-blue-950/20"}:{icon:s.jsx(Di,{className:"h-4 w-4 text-orange-500"}),text:"Complétez les champs obligatoires",color:"text-orange-500",bg:"bg-orange-50 dark:bg-orange-950/20"};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:"Profil complété"}),s.jsx(Og,{children:s.jsxs(Vf,{children:[s.jsx(Wf,{children:s.jsx(ey,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx(Rd,{side:"right",className:"max-w-[250px]",children:s.jsx("p",{className:"text-sm",children:"Complétez tous les champs obligatoires pour soumettre votre profil à approbation."})})]})})]}),s.jsxs("span",{className:pt("text-lg font-bold",d<30&&"text-destructive",d>=30&&d<60&&"text-orange-500",d>=60&&"text-green-600"),children:[d,"%"]})]}),s.jsx("div",{className:"relative h-3 w-full overflow-hidden rounded-full bg-secondary",children:s.jsx("div",{className:pt("h-full transition-all duration-500",m()),style:{width:`${d}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[u," / ",e.length," champs complétés"]})]}),s.jsxs("div",{className:pt("flex items-center gap-2 p-3 rounded-lg",g.bg),children:[g.icon,s.jsx("span",{className:pt("text-sm font-medium",g.color),children:g.text})]}),s.jsxs(XMe,{open:n,onOpenChange:a,children:[s.jsx(ZMe,{asChild:!0,children:s.jsxs(ne,{variant:"ghost",size:"sm",className:"w-full justify-between hover:bg-muted",children:[s.jsxs("span",{className:"text-sm font-medium",children:["Voir les critères (",l,"/",i.length," obligatoires)"]}),n?s.jsx(YJ,{className:"h-4 w-4"}):s.jsx(bh,{className:"h-4 w-4"})]})}),s.jsxs(JMe,{className:"space-y-3 pt-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Champs obligatoires"}),i.map(p=>s.jsx(wq,{field:p,onClick:()=>r==null?void 0:r(p.id)},p.id))]}),o.length>0&&s.jsxs("div",{className:"space-y-2 pt-2 border-t border-border",children:[s.jsxs("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:["Champs optionnels (",c,"/",o.length,")"]}),o.map(p=>s.jsx(wq,{field:p,onClick:()=>r==null?void 0:r(p.id)},p.id))]})]})]}),t==="pending"&&s.jsxs("div",{className:"p-3 bg-muted/50 rounded-lg border border-border",children:[s.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2",children:"Processus d'approbation"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:pt("w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold",f?"bg-green-500 text-white":"bg-muted-foreground/20 text-muted-foreground"),children:"1"}),s.jsx("span",{className:"text-xs",children:"Compléter"})]}),s.jsx("div",{className:"h-px flex-1 bg-border"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:pt("w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold",f?"bg-blue-500 text-white":"bg-muted-foreground/20 text-muted-foreground"),children:"2"}),s.jsx("span",{className:"text-xs",children:"En attente"})]}),s.jsx("div",{className:"h-px flex-1 bg-border"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold bg-muted-foreground/20 text-muted-foreground",children:"3"}),s.jsx("span",{className:"text-xs",children:"Approuvé"})]})]})]})]})}function wq({field:e,onClick:t}){return s.jsx(Og,{children:s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:s.jsxs("button",{onClick:t,className:pt("w-full flex items-center gap-2 p-2 rounded-md text-left transition-colors","hover:bg-muted cursor-pointer",!e.isComplete&&e.isRequired&&"bg-orange-50 dark:bg-orange-950/10"),children:[e.isComplete?s.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center flex-shrink-0",children:s.jsx(Pn,{className:"h-3 w-3 text-white"})}):s.jsx("div",{className:pt("w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0",e.isRequired?"bg-orange-500":"bg-muted-foreground/30"),children:s.jsx(Ri,{className:"h-3 w-3 text-white"})}),s.jsx("span",{className:pt("text-sm flex-1",e.isComplete?"text-muted-foreground":"text-foreground font-medium"),children:e.label}),e.isRequired&&!e.isComplete&&s.jsx("span",{className:"text-xs text-orange-500 font-medium",children:"Requis"})]})}),e.hint&&s.jsx(Rd,{side:"right",className:"max-w-[200px]",children:s.jsx("p",{className:"text-sm",children:e.hint})})]})})}const jq=[{value:"cni",label:"CNI / Passeport",category:"identity"},{value:"titre_sejour",label:"Titre de séjour / Récépissé (étranger)",category:"identity"},{value:"kbis",label:"Kbis / Extrait RCS / Inscription auto-entrepreneur",category:"legal"},{value:"casier_judiciaire",label:"Casier judiciaire (B3)",category:"legal"},{value:"nda_proof",label:"Attestation NDA / Déclaration d'activité",category:"legal"},{value:"rib",label:"RIB (Relevé d'Identité Bancaire)",category:"financial"},{value:"carte_vitale",label:"Carte vitale / Attestation de droits",category:"social"},{value:"attestation_fiscale",label:"Attestation de régularité fiscale / Déclaration sur l'honneur",category:"financial"},{value:"insurance",label:"Attestation d'assurance RC Pro",category:"insurance"},{value:"diploma",label:"Diplôme",category:"qualification"},{value:"contrat_signe",label:"Modèle de contrat rempli et signé",category:"contract"},{value:"other",label:"Autre document",category:"other"}];function e7e({trainerId:e,trainerName:t,trainerEmail:r}){const[n,a]=w.useState([]),[i,o]=w.useState(!0),[l,c]=w.useState(!1),[u,d]=w.useState(""),[f,m]=w.useState(null);w.useEffect(()=>{h()},[e]);const h=async()=>{try{const{data:y,error:N}=await he.from("trainer_documents").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1});if(N)throw N;a(await RL(y||[]))}catch(y){console.error("Error loading documents:",y)}finally{o(!1)}},g=y=>{var _;const N=(_=y.target.files)==null?void 0:_[0];if(N){if(N.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}m(N)}},p=async()=>{if(!f||!u){ae.error("Veuillez sélectionner un type de document et un fichier");return}c(!0);try{const{data:{user:y}}=await he.auth.getUser();if(!y){ae.error("Vous devez être connecté pour uploader des documents"),c(!1);return}console.log("[TrainerDocumentsSection] Upload attempt:",{userId:y.id,trainerId:e,selectedType:u,fileName:f.name});const{data:N,error:_}=await he.from("trainer_profiles").select("id, user_id").eq("id",e).single();if(_||!N){console.error("[TrainerDocumentsSection] Profile check failed:",_),ae.error("Profil formateur introuvable"),c(!1);return}if(N.user_id!==y.id){console.error("[TrainerDocumentsSection] User mismatch:",{profileUserId:N.user_id,currentUserId:y.id}),ae.error("Vous ne pouvez pas uploader des documents pour ce profil"),c(!1);return}const j=f.name.split(".").pop()||"pdf",S=`${y.id}/documents/${u}-${Date.now()}.${j}`,{error:I}=await he.storage.from("trainer-documents").upload(S,f);if(I){console.error("[TrainerDocumentsSection] Storage upload error:",I),ae.error(`Erreur storage: ${I.message}`),c(!1);return}const P={trainer_profile_id:e,document_type:u,document_name:f.name,document_path:S,status:"pending"};console.log("[TrainerDocumentsSection] Inserting to trainer_documents:",P);const{error:F}=await he.from("trainer_documents").insert(P);if(F){console.error("[TrainerDocumentsSection] DB insert error:",F),ae.error(`Erreur base de données: ${F.message}`),c(!1);return}if(console.log("[TrainerDocumentsSection] DB insert success"),t&&r)try{await he.functions.invoke("notify-document-upload",{body:{trainerName:t,trainerEmail:r,documentType:u,documentName:f.name}})}catch(T){console.error("Error notifying admin:",T)}ae.success("Document uploadé avec succès !"),m(null),d(""),h()}catch(y){console.error("[TrainerDocumentsSection] Unexpected error:",y);const N=y instanceof Error?y.message:"Erreur inconnue";ae.error(`Erreur: ${N}`)}finally{c(!1)}},x=async y=>{try{const{error:N}=await he.from("trainer_documents").delete().eq("id",y);if(N)throw N;ae.success("Document supprimé"),h()}catch(N){console.error("Error deleting document:",N),ae.error("Erreur lors de la suppression")}},v=y=>{switch(y){case"verified":return s.jsxs(Le,{className:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Vérifié"]});case"rejected":return s.jsxs(Le,{className:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Rejeté"]});default:return s.jsxs(Le,{className:"bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]})}},b=y=>{var N;return((N=jq.find(_=>_.value===y))==null?void 0:N.label)||y};return i?s.jsx("div",{className:"animate-pulse h-48 bg-muted rounded-lg"}):s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Gt,{className:"w-5 h-5"}),"Documents administratifs"]}),s.jsx(Qr,{children:"Uploadez vos documents officiels pour validation"})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"p-4 border border-dashed rounded-lg space-y-4",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Type de document"}),s.jsxs(Lr,{value:u,onValueChange:d,children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Sélectionner..."})}),s.jsx(Tr,{children:jq.map(y=>s.jsx(ot,{value:y.value,children:y.label},y.value))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Fichier (PDF, JPG, PNG - max 10Mo)"}),s.jsx(Ye,{type:"file",accept:".pdf,.jpg,.jpeg,.png",onChange:g})]})]}),f&&s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Fichier sélectionné : ",f.name]}),s.jsx(ne,{onClick:p,disabled:!f||!u||l,children:l?s.jsx(s.Fragment,{children:"Envoi en cours..."}):s.jsxs(s.Fragment,{children:[s.jsx(nc,{className:"w-4 h-4 mr-2"}),"Envoyer le document"]})})]}),n.length>0?s.jsx("div",{className:"space-y-3",children:n.map(y=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-muted/50 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(Gt,{className:"w-8 h-8 text-muted-foreground"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:b(y.document_type)}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[y.document_name," • ",Ot(new Date(y.created_at),"d MMM yyyy",{locale:yr})]}),y.admin_comment&&s.jsxs("p",{className:"text-sm text-red-600 mt-1 flex items-center gap-1",children:[s.jsx(Di,{className:"w-3 h-3"}),y.admin_comment]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[v(y.status),s.jsx("a",{href:y.viewUrl??void 0,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline",children:"Voir"}),y.status==="pending"&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>x(y.id),children:s.jsx(bi,{className:"w-4 h-4 text-destructive"})})]})]},y.id))}):s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucun document uploadé"})]})]})}function t7e({trainerProfileId:e,trainerName:t,trainerEmail:r,trainerPhone:n}){const{user:a}=Ur(),[i,o]=w.useState(!1),[l,c]=w.useState(null),[u,d]=w.useState(!0),[f,m]=w.useState(n||""),[h,g]=w.useState("");w.useEffect(()=>{p()},[e]);const p=async()=>{try{const{data:v,error:b}=await he.from("nda_assistance_requests").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(b)throw b;c(v)}catch(v){console.error("Error checking NDA request:",v)}finally{d(!1)}},x=async()=>{if(!a){ae.error("Vous devez être connecté");return}o(!0);try{const{error:v}=await he.from("nda_assistance_requests").insert({trainer_profile_id:e,user_id:a.id,trainer_name:t,trainer_email:r,phone:f.trim()||null,message:h.trim()||null});if(v)throw v;const{error:b}=await he.from("admin_notifications").insert({title:"Nouvelle demande d'assistance NDA",message:`${t} demande de l'aide pour obtenir son numéro de déclaration d'activité (NDA).`,type:"info",metadata:{link:"/admin/nda-requests",trainerProfileId:e,trainerName:t,trainerEmail:r}});b&&console.error("Error creating admin notification:",b);const{error:y}=await he.functions.invoke("send-contact-email",{body:{name:t,email:r,phone:f.trim()||"Non renseigné",subject:`Demande d'assistance NDA - ${t}`,message:`
Un formateur demande de l'aide pour obtenir son numéro de déclaration d'activité (NDA).
Formateur: ${t}
Email: ${r}
Téléphone: ${f.trim()||"Non renseigné"}
Message du formateur:
${h.trim()||"Aucun message supplémentaire"}
---
Cette demande peut être gérée depuis l'administration PedagoBridge.
`.trim(),recipientEmail:"contact-pedagobridge@qalamsoftware.com"}});y&&console.error("Error sending email:",y),ae.success("Votre demande d'assistance a été envoyée !"),await p()}catch(v){console.error("Error submitting NDA request:",v),ae.error("Erreur lors de l'envoi de la demande")}finally{o(!1)}};return u?s.jsx(ke,{children:s.jsx(Ae,{className:"p-6 flex items-center justify-center",children:s.jsx(at,{className:"h-5 w-5 animate-spin text-muted-foreground"})})}):l?s.jsxs(ke,{className:"border-primary/20 bg-primary/5",children:[s.jsx(ht,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gt,{className:"h-5 w-5 text-primary"}),s.jsx(xt,{className:"text-lg",children:"Assistance NDA"})]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[l.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsx(Gr,{className:"h-4 w-4 text-amber-500"}),s.jsx(Le,{variant:"secondary",className:"bg-amber-100 text-amber-700",children:"En attente de traitement"})]}),l.status==="in_progress"&&s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"h-4 w-4 text-blue-500 animate-spin"}),s.jsx(Le,{variant:"secondary",className:"bg-blue-100 text-blue-700",children:"En cours de traitement"})]}),l.status==="completed"&&s.jsxs(s.Fragment,{children:[s.jsx(Wr,{className:"h-4 w-4 text-green-500"}),s.jsx(Le,{variant:"secondary",className:"bg-green-100 text-green-700",children:"Terminée"})]})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Demande soumise le ",new Date(l.created_at).toLocaleDateString("fr-FR")]}),l.admin_notes&&s.jsxs("div",{className:"mt-3 p-3 bg-background rounded-md border",children:[s.jsx("p",{className:"text-sm font-medium mb-1",children:"Note de l'équipe :"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l.admin_notes})]})]})})]}):s.jsxs(ke,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gt,{className:"h-5 w-5 text-primary"}),s.jsx(xt,{className:"text-lg",children:"Obtenez votre NDA gratuitement"})]}),s.jsx(Qr,{children:"Grâce à l'assistance PedagoBridge, obtenez votre numéro de déclaration d'activité facilement."})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"nda-phone",children:"Téléphone (pour vous recontacter)"}),s.jsx(Ye,{id:"nda-phone",value:f,onChange:v=>m(v.target.value),placeholder:"06 12 34 56 78"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"nda-message",children:"Message (optionnel)"}),s.jsx(gn,{id:"nda-message",value:h,onChange:v=>g(v.target.value),placeholder:"Questions ou précisions supplémentaires...",rows:3})]}),s.jsx(ne,{onClick:x,disabled:i,className:"w-full",children:i?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Demander l'assistance"]})}),s.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Notre équipe vous contactera pour vous accompagner dans les démarches."})]})]})}const r7e=Wy("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"}}),bw=w.forwardRef(({className:e,variant:t,...r},n)=>s.jsx("div",{ref:n,role:"alert",className:pt(r7e({variant:t}),e),...r}));bw.displayName="Alert";const u5=w.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:pt("mb-1 font-medium leading-none tracking-tight",e),...t}));u5.displayName="AlertTitle";const ww=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:pt("text-sm [&_p]:leading-relaxed",e),...t}));ww.displayName="AlertDescription";function n7e({id:e,specialty:t,index:r,onRemove:n}){const{attributes:a,listeners:i,setNodeRef:o,transform:l,transition:c,isDragging:u}=BMe({id:e}),d={transform:up.Transform.toString(l),transition:c,opacity:u?.5:1};return s.jsxs("div",{ref:o,style:d,className:"flex items-center gap-3 p-3 bg-muted rounded-md",children:[s.jsx("div",{...a,...i,className:"cursor-grab active:cursor-grabbing",children:s.jsx(Pve,{className:"h-5 w-5 text-muted-foreground"})}),s.jsxs("span",{className:"font-semibold text-primary min-w-[1.5rem]",children:[r+1,"."]}),s.jsx("span",{className:"text-sm font-medium flex-1",children:t}),s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>n(t),children:s.jsx(Ri,{className:"h-4 w-4"})})]})}function s7e(){const e=Xt(),{user:t,isTrainer:r,isAdmin:n,loading:a}=Ur(),[i,o]=w.useState(!0),[l,c]=w.useState(!1),[u,d]=w.useState(null),[f,m]=w.useState(0),[h,g]=w.useState(""),[p,x]=w.useState(""),[v,b]=w.useState([]),[y,N]=w.useState([]),[_,j]=w.useState(""),[S,I]=w.useState(!1),[P,F]=w.useState(null),[T,k]=w.useState(null),[V,C]=w.useState(null),[R,H]=w.useState(!1),[q,L]=w.useState(!1),[M,z]=w.useState(!1),[K,E]=w.useState(null),[A,O]=w.useState(""),[U,Y]=w.useState(""),[J,se]=w.useState(""),[ee,ie]=w.useState(""),[Ee,te]=w.useState(""),[Ue,W]=w.useState(""),[Z,le]=w.useState(""),[re,oe]=w.useState(""),[fe,Fe]=w.useState("France"),[ge,pe]=w.useState(""),[Ie,Ge]=w.useState(""),[we,_e]=w.useState(""),[qe,Re]=w.useState("both"),[Me,He]=w.useState([]),[st,Zt]=w.useState(""),[_t,Vt]=w.useState(""),[Jt,Qt]=w.useState(!1),[qt,it]=w.useState("");w.useEffect(()=>{a||(t?!r&&!n?(ae.error("Accès réservé aux formateurs"),e("/")):(It(),wr()):e("/auth"))},[t,r,n,a,e]);const It=async()=>{var ue;try{const{data:ve,error:$e}=await he.from("trainer_profiles").select("*").eq("user_id",t==null?void 0:t.id).single();if($e&&$e.code!=="PGRST116")throw $e;if(ve){if(d(ve),ve.referral_code){const{count:Xe}=await he.from("trainer_profiles").select("id",{count:"exact",head:!0}).eq("referred_by_code",ve.referral_code);m(Xe||0)}g(ve.name||""),x(ve.bio||""),b(ve.specialties||[]),k(ve.photo_url),H(ve.is_visible||!1),O(ve.legal_form||""),Y(((ue=ve.capital_amount)==null?void 0:ue.toString())||""),se(ve.headquarters_address||""),ie(ve.legal_representative_name||""),te(ve.legal_representative_function||""),W(ve.siret||""),le(ve.activity_declaration_number||""),oe(ve.activity_declaration_region||""),Fe(ve.country||"France"),pe(ve.phone||""),Ge(ve.linkedin_url||""),_e(ve.website_url||""),Re(ve.preferred_modality||"both"),He(ve.preferred_departments||[]),Zt(ve.preferred_tjm!=null?String(ve.preferred_tjm):"");const et=(ve.preferred_departments||[]).find(Xe=>Xe.startsWith("ETR:"));et&&it(et.substring(4)),ve.specialties&&ve.specialties.length>0&&Mt(ve.specialties)}}catch(ve){console.error("Error loading profile:",ve),ae.error("Erreur lors du chargement du profil")}finally{o(!1)}},Mt=async ue=>{for(const ve of ue)try{const{data:$e}=await he.from("referenced_specialties").select("id").eq("name",ve).maybeSingle();$e||await he.from("referenced_specialties").insert({name:ve,usage_count:1})}catch($e){console.error(`Error syncing specialty ${ve}:`,$e)}await wr()},wr=async()=>{try{const{data:ue,error:ve}=await he.from("referenced_specialties").select("name").order("usage_count",{ascending:!1});if(ve)throw ve;ue&&N(ue.map($e=>$e.name))}catch(ue){console.error("Error loading specialties:",ue)}},$t=async()=>{L(!0);try{const{data:ue,error:ve}=await he.functions.invoke("verify-trainer-email",{body:{}});if(ve)throw ve;ue!=null&&ue.alreadyVerified?ae.success("Votre email est déjà vérifié"):ae.success("Email de vérification envoyé ! Consultez votre boîte mail.")}catch(ue){console.error("Email verification error:",ue),ae.error("Erreur lors de l'envoi de l'email de vérification")}finally{L(!1)}},kt=ue=>{var $e;const ve=($e=ue.target.files)==null?void 0:$e[0];if(ve){if(ve.size>5*1024*1024){ae.error("La photo ne doit pas dépasser 5 Mo");return}F(ve),k(URL.createObjectURL(ve))}},dr=async ue=>{var $e;const ve=($e=ue.target.files)==null?void 0:$e[0];if(ve){if(ve.size>10*1024*1024){ae.error("Le CV ne doit pas dépasser 10 Mo");return}C(ve),ae.success("CV sélectionné")}},Kt=async()=>{const ue=_.trim();if(!ue||v.includes(ue)){I(!1),j("");return}b(ve=>[...ve,ue]),j(""),I(!1);try{const{data:ve}=await he.from("referenced_specialties").select("id, usage_count").eq("name",ue).maybeSingle();ve?await he.from("referenced_specialties").update({usage_count:ve.usage_count+1}).eq("id",ve.id):await he.from("referenced_specialties").insert({name:ue,usage_count:1}),await wr()}catch(ve){console.error("Error updating referenced specialties:",ve)}},ir=ue=>{b(ve=>ve.filter($e=>$e!==ue))},jr=w.useCallback(async()=>{if(!(!t||!h.trim()||v.length===0)){z(!0);try{const{error:ue}=await he.from("trainer_profiles").upsert({user_id:t.id,email:t.email,name:h.trim(),bio:p.trim(),specialties:v,photo_url:u==null?void 0:u.photo_url,cv_url:u==null?void 0:u.cv_url,pending_cv_url:u==null?void 0:u.pending_cv_url,pending_cv_filename:u==null?void 0:u.pending_cv_filename,status:(u==null?void 0:u.status)||"pending",is_visible:R,legal_form:A.trim()||null,capital_amount:U?parseFloat(U):null,headquarters_address:J.trim()||null,legal_representative_name:ee.trim()||null,legal_representative_function:Ee.trim()||null,siret:Ue.trim()||null,activity_declaration_number:Z.trim()||null,activity_declaration_region:re.trim()||null,country:fe.trim()||"France",preferred_modality:qe,preferred_departments:Me,preferred_tjm:st?parseInt(st,10):null},{onConflict:"user_id"});if(ue)throw ue;E(new Date)}catch(ue){console.error("Auto-save error:",ue)}finally{z(!1)}}},[t,h,p,v,u,R,A,U,J,ee,Ee,Ue,Z,re,fe,qe,Me,st]);w.useEffect(()=>{const ue=setTimeout(()=>{jr()},2e3);return()=>clearTimeout(ue)},[h,p,v,R,jr]);const mn=Toe(l8(rE),l8(QL,{coordinateGetter:qMe})),Ht=ue=>{const{active:ve,over:$e}=ue;$e&&ve.id!==$e.id&&b(et=>{const Xe=et.indexOf(ve.id),Ze=et.indexOf($e.id);return rF(et,Xe,Ze)})},sn=w.useRef(null),Bn=w.useRef(null),tn=w.useRef(null),vn=w.useRef(null),En=w.useRef(null),Xn=w.useCallback(()=>{const ue=!!(u!=null&&u.photo_url||P),ve=!!h.trim(),$e=!!(p.trim()&&p.trim().length>=50),et=v.length>0,Xe=!!(u!=null&&u.cv_url||V);return[{id:"name",label:"Nom complet",isComplete:ve,isRequired:!0,hint:"Votre nom tel qu'il apparaîtra sur votre profil public"},{id:"photo",label:"Photo de profil",isComplete:ue,isRequired:!0,hint:"Une photo professionnelle augmente vos chances d'être contacté"},{id:"bio",label:"Bio / Présentation (min. 50 caractères)",isComplete:$e,isRequired:!0,hint:`${p.length}/50 caractères minimum`},{id:"specialties",label:"Au moins une spécialité",isComplete:et,isRequired:!0,hint:"Vos domaines d'expertise"},{id:"cv",label:"CV (PDF)",isComplete:Xe,isRequired:!1,hint:"Optionnel mais recommandé pour augmenter votre visibilité"}]},[h,p,v,u==null?void 0:u.photo_url,u==null?void 0:u.cv_url,P,V]),me=ue=>{const $e={photo:sn,name:Bn,bio:tn,specialties:vn,cv:En}[ue];$e!=null&&$e.current&&($e.current.scrollIntoView({behavior:"smooth",block:"center"}),$e.current.classList.add("ring-2","ring-primary","ring-offset-2"),setTimeout(()=>{var et;(et=$e.current)==null||et.classList.remove("ring-2","ring-primary","ring-offset-2")},2e3))},Te=()=>{const ue=Xn(),ve=ue.filter($e=>$e.isComplete).length;return Math.round(ve/ue.length*100)},Ne=async(ue,ve,$e)=>{const{data:et,error:Xe}=await he.storage.from(ve).upload($e,ue,{upsert:!0});if(Xe)throw Xe;const{data:{publicUrl:Ze}}=he.storage.from(ve).getPublicUrl(et.path);return Ze},Ce=async()=>{if(!h.trim()){ae.error("Le nom est requis");return}if(v.length===0){ae.error("Sélectionnez au moins une spécialité");return}c(!0);try{let ue=u==null?void 0:u.photo_url,ve=u==null?void 0:u.cv_url,$e=u==null?void 0:u.pending_cv_url,et=u==null?void 0:u.pending_cv_filename;if(P){const Ze=`${t==null?void 0:t.id}/photo-${Date.now()}.${P.name.split(".").pop()}`;ue=await Ne(P,"trainer-files",Ze)}if(V){const Ze=`${t==null?void 0:t.id}/cv-${Date.now()}.pdf`,rt=await Ne(V,"trainer-files",Ze);(u==null?void 0:u.status)==="approved"?($e=rt,et=V.name,ae.success("CV uploadé ! En attente de validation par un administrateur.")):(ve=rt,ae.success("CV uploadé avec succès !"))}const{error:Xe}=await he.from("trainer_profiles").upsert({user_id:t==null?void 0:t.id,email:t==null?void 0:t.email,name:h.trim(),bio:p.trim(),specialties:v,photo_url:ue,cv_url:ve,pending_cv_url:$e,pending_cv_filename:et,status:(u==null?void 0:u.status)||"pending",is_visible:R,legal_form:A.trim()||null,capital_amount:U?parseFloat(U):null,headquarters_address:J.trim()||null,legal_representative_name:ee.trim()||null,legal_representative_function:Ee.trim()||null,siret:Ue.trim()||null,activity_declaration_number:Z.trim()||null,activity_declaration_region:re.trim()||null,country:fe.trim()||"France",phone:ge.trim()||null,linkedin_url:Ie.trim()||null,website_url:we.trim()||null,preferred_modality:qe,preferred_departments:Me,preferred_tjm:st?parseInt(st,10):null},{onConflict:"user_id"});if(Xe)throw Xe;ae.success("Profil enregistré avec succès !"),await It()}catch(ue){console.error("Error saving profile:",ue),ae.error("Erreur lors de l'enregistrement du profil")}finally{c(!1)}};return a||i?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-3xl mx-auto",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>e("/"),children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour à l'accueil"]}),(u==null?void 0:u.status)==="approved"&&s.jsxs(ne,{variant:"outline",onClick:()=>e("/trainer/contract"),className:"gap-2",children:[s.jsx(Gt,{className:"h-4 w-4"}),"Mon contrat"]})]}),(u==null?void 0:u.status)==="approved"&&s.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl border border-primary/25 bg-primary/5 px-4 py-3 cursor-pointer hover:bg-primary/10 transition-colors",onClick:()=>e("/trainer/contract"),children:[s.jsx(Kd,{className:"h-5 w-5 text-primary shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-primary",children:"Signez votre contrat pour apparaître en premier"}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:"Les formateurs certifiés sont prioritaires dans tous les résultats de recherche et pages ville."})]}),s.jsx(Gt,{className:"h-4 w-4 text-primary shrink-0"})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(xt,{className:"text-2xl",children:"Mon Profil Formateur"}),M&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(at,{className:"h-3 w-3 animate-spin"}),s.jsx("span",{children:"Enregistrement..."})]}),!M&&K&&s.jsxs("div",{className:"text-xs text-muted-foreground",children:["Dernier enregistrement: ",K.toLocaleTimeString()]})]}),s.jsx(Qr,{className:"mt-2",children:"Les modifications sont enregistrées automatiquement"})]}),(Te()<100||(u==null?void 0:u.status)!=="approved")&&s.jsx(QMe,{fields:Xn(),status:(u==null?void 0:u.status)||"pending",onFieldClick:me}),(u==null?void 0:u.status)==="approved"&&s.jsxs("div",{className:"flex items-center justify-between p-4 bg-muted/50 rounded-lg border",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(is,{className:"h-5 w-5 text-blue-600"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:"Vues de votre profil"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Nombre de fois où votre profil a été consulté par les écoles"})]})]}),s.jsx("span",{className:"text-2xl font-bold",children:(u==null?void 0:u.view_count)||0})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 bg-muted/50 rounded-lg border",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[u!=null&&u.email_verified?s.jsx(Pn,{className:"h-5 w-5 text-green-600"}):s.jsx(ey,{className:"h-5 w-5 text-amber-600"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:u!=null&&u.email_verified?"Email vérifié":"Vérifiez votre email"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:u!=null&&u.email_verified?"Votre email est vérifié — meilleure visibilité auprès des écoles":"Un email vérifié améliore votre classement et la confiance des écoles"})]})]}),!(u!=null&&u.email_verified)&&s.jsx(ne,{size:"sm",variant:"outline",onClick:$t,disabled:q,children:q?s.jsx(at,{className:"h-4 w-4 animate-spin"}):"Vérifier"})]}),(u==null?void 0:u.status)==="approved"&&s.jsxs("div",{className:"flex items-center justify-between p-4 bg-muted/50 rounded-lg border",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[R?s.jsx(is,{className:"h-5 w-5 text-green-600"}):s.jsx(dR,{className:"h-5 w-5 text-muted-foreground"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:"Visibilité publique"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:R?"Votre profil est visible sur le site":"Votre profil est masqué du site public"})]})]}),s.jsx(dy,{checked:R,onCheckedChange:H,"aria-label":"Visibilité du profil"})]}),s.jsxs(bw,{className:"bg-gradient-to-r from-primary/5 to-secondary/5 border-primary/20",children:[s.jsx(Kd,{className:"h-4 w-4"}),s.jsxs(ww,{className:"space-y-2",children:[s.jsx("p",{className:"font-medium text-sm",children:"Comment apparaître en premier dans la liste des formateurs ?"}),s.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Photo de profil"})," : Un profil avec photo est mieux classé"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Bio détaillée"})," : Rédigez une bio complète (minimum 50 caractères)"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"CV téléchargé"})," : Les profils avec CV sont favorisés"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Plusieurs spécialités"})," : Plus vous avez de compétences, mieux c'est"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Certification PedagoBridge"})," : Les formateurs certifiés apparaissent en premier"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Parrainez des collègues"})," : Les Ambassadeurs sont mis en avant (voir ci-dessous)"]})]})]})]}),(u==null?void 0:u.referral_code)&&s.jsxs("div",{className:"p-4 rounded-lg border bg-gradient-to-r from-primary/5 to-secondary/5 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Tve,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("p",{className:"font-medium text-sm",children:["Parrainez des formateurs",f>0&&s.jsxs("span",{className:"ml-2 inline-flex items-center rounded-full bg-primary/10 text-primary text-xs px-2 py-0.5",children:[f," parrainé",f>1?"s":""]}),f>=1&&s.jsx("span",{className:"ml-2 inline-flex items-center rounded-full bg-amber-100 text-amber-700 text-xs px-2 py-0.5",children:"⭐ Ambassadeur"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Partagez votre lien. Chaque formateur qui rejoint le réseau grâce à vous améliore votre statut d'Ambassadeur et votre visibilité."})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{readOnly:!0,value:`${window.location.origin}/trainer-register?ref=${u.referral_code}`,className:"text-xs",onFocus:ue=>ue.currentTarget.select()}),s.jsxs(ne,{type:"button",size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(`${window.location.origin}/trainer-register?ref=${u.referral_code}`),ae.success("Lien de parrainage copié !")},children:[s.jsx(Qv,{className:"h-4 w-4 mr-1"})," Copier"]})]})]})]})}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{ref:En,className:"space-y-3 p-4 bg-primary/5 border border-primary/20 rounded-lg",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(nc,{className:"h-5 w-5 text-primary mt-0.5"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(We,{htmlFor:"cv",className:"text-base font-semibold",children:"Téléchargez votre CV en premier"}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Votre profil sera ",s.jsx("strong",{className:"text-primary",children:"automatiquement rempli"})," grâce à l'analyse IA de votre CV (spécialités, bio, expériences)."]})]})]}),s.jsxs("div",{className:"space-y-2",children:[(u==null?void 0:u.cv_url)&&!V&&s.jsxs("p",{className:"text-sm text-green-600 flex items-center gap-2",children:[s.jsx(Pn,{className:"h-4 w-4"}),"CV déjà téléchargé"]}),s.jsx(Ye,{id:"cv",type:"file",accept:".pdf",onChange:dr}),V&&s.jsxs("p",{className:"text-sm text-primary flex items-center gap-2",children:[s.jsx(Pn,{className:"h-4 w-4"}),"Nouveau CV sélectionné : ",V.name]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Format PDF uniquement - Maximum 10 Mo"})]})]}),s.jsxs("div",{ref:sn,className:"space-y-2 transition-all rounded-lg p-2 -m-2",children:[s.jsx(We,{children:"Photo de profil *"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(ps,{className:"h-20 w-20",children:[s.jsx(vi,{src:T||void 0}),s.jsx(gs,{className:"text-2xl",children:h.split(" ").map(ue=>ue[0]).join("").toUpperCase().slice(0,2)})]}),s.jsxs("div",{children:[s.jsx(Ye,{id:"photo",type:"file",accept:"image/*",onChange:kt,className:"hidden"}),s.jsx(We,{htmlFor:"photo",className:"cursor-pointer",children:s.jsx(ne,{type:"button",variant:"outline",size:"sm",asChild:!0,children:s.jsxs("span",{children:[s.jsx(nc,{className:"mr-2 h-4 w-4"}),"Choisir une photo"]})})}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Maximum 5 Mo - JPG, PNG"})]})]})]}),s.jsxs("div",{ref:Bn,className:"space-y-2 transition-all rounded-lg p-2 -m-2",children:[s.jsx(We,{htmlFor:"name",children:"Nom complet *"}),s.jsx(Ye,{id:"name",value:h,onChange:ue=>g(ue.target.value),placeholder:"Jean Dupont",required:!0})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"phone",children:"Téléphone"}),s.jsx(Ye,{id:"phone",type:"tel",value:ge,onChange:ue=>pe(ue.target.value),placeholder:"+33 6 XX XX XX XX"})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(We,{htmlFor:"linkedinUrl",children:"LinkedIn"}),s.jsxs("button",{type:"button",onClick:async()=>{var $e;if(!Ie.trim()){ae.error("Entrez d'abord votre URL LinkedIn");return}const{data:{session:ue}}=await he.auth.getSession(),ve=ae.loading("Extraction du profil LinkedIn...");try{const et=await fetch("https://pedagobridge.com/functions/v1/extract-profile-from-linkedin",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ue==null?void 0:ue.access_token}`,apikey:void 0},body:JSON.stringify({mode:"url",linkedin_url:Ie,profile_type:"trainer"})}),Xe=await et.json();if(!et.ok)throw new Error(Xe.error);const Ze=Xe.profile;Ze.bio&&x(Ze.bio),Ze.website&&_e(Ze.website),Ze.phone&&pe(Ze.phone),($e=Ze.specialties)!=null&&$e.length&&b(rt=>[...new Set([...rt,...Ze.specialties])]),ae.success("Profil LinkedIn importé !",{id:ve})}catch(et){ae.error(et.message||"Erreur extraction",{id:ve})}},className:"text-xs font-bold text-[#0077B5] hover:underline flex items-center gap-1",children:[s.jsx("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})}),"Remplir depuis LinkedIn"]})]}),s.jsx(Ye,{id:"linkedinUrl",type:"url",value:Ie,onChange:ue=>Ge(ue.target.value),placeholder:"https://linkedin.com/in/..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"websiteUrl",children:"Site web"}),s.jsx(Ye,{id:"websiteUrl",type:"url",value:we,onChange:ue=>_e(ue.target.value),placeholder:"https://..."})]})]})]}),s.jsxs("div",{ref:tn,className:"space-y-2 transition-all rounded-lg p-2 -m-2",children:[s.jsx(We,{htmlFor:"bio",children:"Bio / Présentation * (min. 50 caractères)"}),s.jsx(gn,{id:"bio",value:p,onChange:ue=>x(ue.target.value),placeholder:"Présentez votre expérience et vos compétences...",rows:5}),s.jsxs("p",{className:pt("text-xs",p.length<50?"text-orange-500":"text-muted-foreground"),children:[p.length,"/50 caractères minimum ",p.length>=50&&"✓"]})]}),s.jsxs("div",{ref:vn,className:"space-y-4 transition-all rounded-lg p-2 -m-2",children:[s.jsxs("div",{children:[s.jsx(We,{children:"Ajouter une spécialité"}),s.jsxs("div",{className:"mt-2",children:[s.jsxs(rp,{open:S,onOpenChange:I,children:[s.jsx(np,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":S,className:"w-full justify-between",children:[_||"Rechercher ou ajouter une compétence...",s.jsx(n2,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(fh,{className:"w-full p-0 z-[100] bg-background border border-border shadow-lg",align:"start",children:s.jsxs(ap,{children:[s.jsx(ip,{placeholder:"Rechercher ou taper une nouvelle compétence...",value:_,onValueChange:j}),s.jsxs(op,{children:[s.jsx(lp,{children:s.jsxs("div",{className:"p-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Aucune compétence trouvée"}),_.trim()&&s.jsxs(ne,{size:"sm",variant:"outline",onClick:Kt,className:"w-full",children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),'Ajouter "',_.trim(),'"']})]})}),s.jsx(Jf,{heading:"Compétences référencées",children:y.filter(ue=>!v.includes(ue)).map(ue=>s.jsxs(Bu,{value:ue,onSelect:ve=>{v.includes(ve)||(b($e=>[...$e,ve]),j(""),I(!1),(async()=>{try{const{data:$e}=await he.from("referenced_specialties").select("id, usage_count").eq("name",ve).maybeSingle();$e&&await he.from("referenced_specialties").update({usage_count:$e.usage_count+1}).eq("id",$e.id)}catch($e){console.error("Error updating specialty count:",$e)}})())},children:[s.jsx(Pn,{className:pt("mr-2 h-4 w-4",v.includes(ue)?"opacity-100":"opacity-0")}),ue]},ue))}),_.trim()&&!y.includes(_.trim())&&s.jsx(Jf,{children:s.jsxs(Bu,{onSelect:()=>Kt(),children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),'Ajouter "',_.trim(),'"']})})]})]})})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Sélectionnez parmi les compétences existantes ou ajoutez-en une nouvelle"})]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Mes spécialités * (au moins une requise)"}),v.length===0?s.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Aucune spécialité sélectionnée. Sélectionnez au moins une spécialité ci-dessus."}):s.jsxs("div",{className:"mt-2",children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Glissez-déposez pour réorganiser l'ordre de priorité"}),s.jsx(Yoe,{sensors:mn,collisionDetection:gFe,onDragEnd:Ht,children:s.jsx(DMe,{items:v,strategy:PMe,children:s.jsx("div",{className:"space-y-2",children:v.map((ue,ve)=>s.jsx(n7e,{id:ue,specialty:ue,index:ve,onRemove:ir},ue))})})})]})]})]}),s.jsxs("div",{className:"space-y-4 border-t pt-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Préférences d'intervention"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Indiquez vos préférences en termes de modalité et de lieux d'intervention"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"preferredTjm",children:"TJM souhaité (€ / jour)"}),s.jsx("input",{id:"preferredTjm",type:"number",min:"0",step:"10",inputMode:"numeric",value:st,onChange:ue=>Zt(ue.target.value),placeholder:"Ex : 600",className:"flex h-10 w-full max-w-[200px] rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Votre tarif journalier indicatif — aide les écoles à vous proposer des missions adaptées."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Modalité préférée *"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"modality",value:"physical",checked:qe==="physical",onChange:ue=>Re(ue.target.value),className:"w-4 h-4"}),s.jsx("span",{className:"text-sm",children:"Présentiel uniquement"})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"modality",value:"remote",checked:qe==="remote",onChange:ue=>Re(ue.target.value),className:"w-4 h-4"}),s.jsx("span",{className:"text-sm",children:"Distanciel uniquement"})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"modality",value:"both",checked:qe==="both",onChange:ue=>Re(ue.target.value),className:"w-4 h-4"}),s.jsx("span",{className:"text-sm",children:"Les deux (présentiel et distanciel)"})]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(We,{children:"Départements d'intervention"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:'Sélectionnez les départements où vous pouvez intervenir. Laissez vide pour "France entière".'}),s.jsxs(rp,{open:Jt,onOpenChange:Qt,children:[s.jsx(np,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":Jt,className:"w-full justify-between",children:[Me.length===0?"France entière (cliquez pour sélectionner des départements)":`${Me.length} département(s) sélectionné(s)`,s.jsx(n2,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(fh,{className:"w-full p-0 z-[100] bg-background border border-border shadow-lg max-h-[300px]",align:"start",children:s.jsxs(ap,{children:[s.jsx(ip,{placeholder:"Rechercher un département...",value:_t,onValueChange:Vt}),s.jsxs(op,{className:"max-h-[250px] overflow-y-auto",children:[s.jsx(lp,{children:"Aucun département trouvé"}),s.jsx(Jf,{children:FL.filter(ue=>ue.name.toLowerCase().includes(_t.toLowerCase())||ue.code.includes(_t)).map(ue=>s.jsxs(Bu,{value:`${ue.code} ${ue.name}`,onSelect:()=>{ue.code==="ETR"?(Qt(!1),Me.some(ve=>ve.startsWith("ETR:"))||it("")):He(ve=>ve.includes(ue.code)?ve.filter($e=>$e!==ue.code):[...ve,ue.code])},children:[s.jsx(Pn,{className:pt("mr-2 h-4 w-4",ue.code==="ETR"?Me.some(ve=>ve.startsWith("ETR:"))?"opacity-100":"opacity-0":Me.includes(ue.code)?"opacity-100":"opacity-0")}),ue.code==="ETR"?ue.name:`${ue.code} - ${ue.name}`]},ue.code))})]})]})})]}),Me.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:Me.map(ue=>s.jsxs(Le,{variant:"secondary",className:"gap-1",children:[tv(ue),s.jsx("button",{type:"button",onClick:()=>{He(Me.filter(ve=>ve!==ue)),ue.startsWith("ETR:")&&it("")},className:"ml-1 hover:text-destructive",children:s.jsx(Ri,{className:"h-3 w-3"})})]},ue))}),s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>{He([]),it("")},className:"text-xs",children:"Réinitialiser (France entière)"})]}),s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsx(We,{children:"Intervention à l'étranger"}),s.jsx("div",{className:"flex gap-2",children:s.jsxs("select",{value:qt,onChange:ue=>{const ve=ue.target.value;if(it(ve),ve){const $e=Me.filter(et=>!et.startsWith("ETR:"));He([...$e,`ETR:${ve}`])}else He(Me.filter($e=>!$e.startsWith("ETR:")))},className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background",children:[s.jsx("option",{value:"",children:"-- Sélectionner un pays --"}),c8e.map(ue=>s.jsx("option",{value:ue,children:ue},ue))]})}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Sélectionnez un pays si vous pouvez intervenir à l'étranger"})]})]})]}),s.jsxs("div",{className:"space-y-4 border-t pt-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Informations Juridiques"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Ces informations seront utilisées pour générer votre contrat de prestation"})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalForm",children:"Forme juridique"}),s.jsx(Ye,{id:"legalForm",value:A,onChange:ue=>O(ue.target.value),placeholder:"Ex: SASU, SARL, EURL, Auto-entrepreneur"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"capitalAmount",children:"Capital social (€, optionnel)"}),s.jsx(Ye,{id:"capitalAmount",type:"number",value:U,onChange:ue=>Y(ue.target.value),placeholder:"Ex: 500"})]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"headquartersAddress",children:"Adresse du siège social"}),s.jsx(Ye,{id:"headquartersAddress",value:J,onChange:ue=>se(ue.target.value),placeholder:"Adresse complète du siège social"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"country",children:"Pays"}),s.jsx(Ye,{id:"country",value:fe,onChange:ue=>Fe(ue.target.value),placeholder:"France"})]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalRepresentativeName",children:"Représentant légal"}),s.jsx(Ye,{id:"legalRepresentativeName",value:ee,onChange:ue=>ie(ue.target.value),placeholder:"Nom du représentant"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"legalRepresentativeFunction",children:"Fonction"}),s.jsx(Ye,{id:"legalRepresentativeFunction",value:Ee,onChange:ue=>te(ue.target.value),placeholder:"Ex: Président, Gérant"})]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"siret",children:"SIRET"}),s.jsx(Ye,{id:"siret",value:Ue,onChange:ue=>W(ue.target.value),placeholder:"Numéro SIRET"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"activityDeclarationNumber",children:"N° déclaration d'activité (NDA)"}),s.jsx(Ye,{id:"activityDeclarationNumber",value:Z,onChange:ue=>le(ue.target.value),placeholder:"Numéro de déclaration"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"activityDeclarationRegion",children:"Région de déclaration d'activité (NDA)"}),s.jsx(Ye,{id:"activityDeclarationRegion",value:re,onChange:ue=>oe(ue.target.value),placeholder:"Ex: Île-de-France, Occitanie, Grand Est..."}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Région du préfet ayant accordé votre numéro de déclaration d'activité"})]})]}),(u==null?void 0:u.id)&&s.jsx(e7e,{trainerId:u.id,trainerName:u.name,trainerEmail:u.email}),(u==null?void 0:u.id)&&!Z&&s.jsx(t7e,{trainerProfileId:u.id,trainerName:u.name,trainerEmail:u.email,trainerPhone:ge}),s.jsx("div",{className:"flex gap-4",children:s.jsx(ne,{onClick:Ce,disabled:l,className:"flex-1",children:l?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Enregistrement..."]}):"Enregistrer"})})]})]})]})})}function a7e(){const{user:e,isTrainer:t}=Ur(),r=Xt(),[n,a]=w.useState([]),[i,o]=w.useState(!0);w.useEffect(()=>{if(!e){r("/auth");return}if(!t){r("/");return}l()},[e,t,r]);const l=async()=>{if(e){o(!0);try{const{data:d}=await he.from("trainer_profiles").select("id").eq("user_id",e.id).single();if(!d){a([]),o(!1);return}const{data:f,error:m}=await he.from("trainer_applications").select(`
id,
message,
status,
created_at,
school_request_id
`).eq("trainer_id",d.id).order("created_at",{ascending:!1});if(m)throw m;const h=[];for(const g of f||[]){const{data:p}=await he.from("school_requests").select("id, school_name, description, contact_email, start_date, end_date, subject_areas, status").eq("id",g.school_request_id).single();p&&h.push({id:g.id,message:g.message,status:g.status,created_at:g.created_at,school_request:p})}a(h)}catch(d){console.error("Error loading applications:",d),ae.error("Erreur lors du chargement des candidatures")}finally{o(!1)}}},c=d=>{switch(d){case"accepted":return s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Acceptée"]});case"rejected":return s.jsxs(Le,{variant:"destructive",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"pending":default:return s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]})}},u={total:n.length,pending:n.filter(d=>d.status==="pending").length,accepted:n.filter(d=>d.status==="accepted").length,rejected:n.filter(d=>d.status==="rejected").length};return i?s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Mes Candidatures",description:"Suivez l'état de vos candidatures aux offres de formation sur PedagoBridge.",noindex:!0}),s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"mb-8",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>r("/trainer/profile"),className:"mb-4",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour au profil"]}),s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(as,{className:"h-8 w-8 text-primary"}),"Mes Candidatures"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Suivez l'état de vos candidatures aux offres de formation"})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-2xl font-bold",children:u.total})]}),s.jsx(as,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"En attente"}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:u.pending})]}),s.jsx(Gr,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Acceptées"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:u.accepted})]}),s.jsx(Wr,{className:"h-8 w-8 text-green-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Refusées"}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:u.rejected})]}),s.jsx(Fs,{className:"h-8 w-8 text-red-500 opacity-80"})]})})})]}),n.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(as,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Vous n'avez pas encore postulé à une offre"}),s.jsx(ne,{onClick:()=>r("/training-offers"),children:"Voir les offres disponibles"})]})}):s.jsx("div",{className:"space-y-4",children:n.map(d=>s.jsx(ke,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-start gap-3 mb-2 flex-wrap",children:[s.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:s.jsx(Vr,{className:"h-5 w-5 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-lg font-semibold",children:d.school_request.school_name}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c(d.status),d.school_request.status==="archived"&&s.jsx(Le,{variant:"outline",children:"Offre archivée"})]})]})]}),s.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2 mb-3",children:d.school_request.description}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground mb-3",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-4 w-4"}),"Postulé le ",Ot(new Date(d.created_at),"dd MMM yyyy",{locale:yr})]}),d.school_request.start_date&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Gr,{className:"h-4 w-4"}),"Début: ",Ot(new Date(d.school_request.start_date),"dd MMM yyyy",{locale:yr})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.school_request.subject_areas.slice(0,3).map((f,m)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:f},m)),d.school_request.subject_areas.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",d.school_request.subject_areas.length-3]})]}),d.status==="accepted"&&s.jsx("div",{className:"mt-4 p-3 bg-green-50 dark:bg-green-950/20 border border-green-200 dark:border-green-800 rounded-lg",children:s.jsx("p",{className:"text-sm text-green-700 dark:text-green-300 font-medium",children:"Votre candidature a été acceptée ! Vous pouvez contacter l'établissement."})})]}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>r(`/training-offers/${d.school_request.id}`),children:[s.jsx(is,{className:"mr-2 h-4 w-4"}),"Voir l'offre"]}),d.status==="accepted"&&s.jsxs(ne,{size:"sm",onClick:()=>window.location.href=`mailto:${d.school_request.contact_email}`,children:[s.jsx(Fn,{className:"mr-2 h-4 w-4"}),"Contacter"]})]})]})})},d.id))})]})]})}function i7e(){const{user:e,isTrainer:t}=Ur(),r=Xt(),[n,a]=w.useState([]),[i,o]=w.useState(null),[l,c]=w.useState([]),[u,d]=w.useState(""),[f,m]=w.useState(!0),[h,g]=w.useState(!1),p=w.useRef(null);w.useEffect(()=>{if(!e){r("/auth");return}if(!t){r("/");return}x()},[e,t,r]),w.useEffect(()=>{var y;(y=p.current)==null||y.scrollIntoView({behavior:"smooth"})},[l]);const x=async()=>{var y,N;if(e){m(!0);try{const{data:_,error:j}=await he.from("offer_messages").select(`
*,
school_requests (id, school_name, description)
`).or(`sender_id.eq.${e.id},recipient_id.eq.${e.id}`).order("created_at",{ascending:!1});if(j)throw j;const S=new Map;for(const I of _||[]){const P=I.sender_id===e.id?I.recipient_id:I.sender_id,F=`${I.school_request_id}-${P}`;if(!S.has(F))S.set(F,{id:F,school_request_id:I.school_request_id,other_user_id:P,other_user_name:((y=I.school_requests)==null?void 0:y.school_name)||"École",last_message:I.content,last_message_at:I.created_at,unread_count:I.recipient_id===e.id&&!I.is_read?1:0,offer_title:((N=I.school_requests)==null?void 0:N.school_name)||"Offre"});else if(I.recipient_id===e.id&&!I.is_read){const T=S.get(F);T.unread_count++}}a(Array.from(S.values()))}catch(_){console.error("Error loading conversations:",_),ae.error("Erreur lors du chargement des messages")}finally{m(!1)}}},v=async y=>{if(e)try{const{data:N,error:_}=await he.from("offer_messages").select("*").eq("school_request_id",y.school_request_id).or(`sender_id.eq.${y.other_user_id},recipient_id.eq.${y.other_user_id}`).order("created_at",{ascending:!0});if(_)throw _;c(N||[]),await he.from("offer_messages").update({is_read:!0}).eq("school_request_id",y.school_request_id).eq("recipient_id",e.id).eq("sender_id",y.other_user_id),a(j=>j.map(S=>S.id===y.id?{...S,unread_count:0}:S))}catch(N){console.error("Error loading messages:",N)}},b=async()=>{if(!(!e||!i||!u.trim())){g(!0);try{const{error:y}=await he.from("offer_messages").insert({school_request_id:i.school_request_id,sender_id:e.id,recipient_id:i.other_user_id,content:u.trim()});if(y)throw y;d(""),await v(i)}catch(y){console.error("Error sending message:",y),ae.error("Erreur lors de l'envoi du message")}finally{g(!1)}}};return f?s.jsxs(xa,{children:[s.jsx(gr,{title:"Messages - PedagoBridge",description:"Gérez vos conversations avec les établissements",noindex:!0}),s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})]}):s.jsxs(xa,{children:[s.jsx(gr,{title:"Messages - PedagoBridge",description:"Gérez vos conversations avec les établissements",noindex:!0}),s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>r("/trainer/applications"),children:[s.jsx(Yn,{className:"h-4 w-4 mr-2"}),"Retour"]}),s.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[s.jsx(zo,{className:"h-6 w-6"}),"Messages"]})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6 h-[600px]",children:[s.jsxs(ke,{className:"md:col-span-1",children:[s.jsx(ht,{className:"pb-3",children:s.jsx(xt,{className:"text-lg",children:"Conversations"})}),s.jsx(Ae,{className:"p-0",children:s.jsx(ru,{className:"h-[500px]",children:n.length===0?s.jsxs("div",{className:"p-6 text-center text-muted-foreground",children:[s.jsx(zo,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),s.jsx("p",{children:"Aucune conversation"}),s.jsx("p",{className:"text-sm mt-2",children:"Les conversations apparaîtront ici lorsque vous échangerez avec des établissements."})]}):s.jsx("div",{className:"divide-y",children:n.map(y=>s.jsx("button",{onClick:()=>{o(y),v(y)},className:`w-full p-4 text-left hover:bg-muted/50 transition-colors ${(i==null?void 0:i.id)===y.id?"bg-muted":""}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ps,{className:"h-10 w-10",children:s.jsx(gs,{children:s.jsx(Vr,{className:"h-5 w-5"})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-medium truncate",children:y.offer_title}),y.unread_count>0&&s.jsx(Le,{variant:"destructive",className:"ml-2",children:y.unread_count})]}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.last_message}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Ot(new Date(y.last_message_at),"dd MMM HH:mm",{locale:yr})})]})]})},y.id))})})})]}),s.jsx(ke,{className:"md:col-span-2 flex flex-col",children:i?s.jsxs(s.Fragment,{children:[s.jsx(ht,{className:"pb-3 border-b",children:s.jsxs(xt,{className:"text-lg flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5"}),i.offer_title]})}),s.jsxs(Ae,{className:"flex-1 flex flex-col p-0",children:[s.jsx(ru,{className:"flex-1 p-4",children:s.jsxs("div",{className:"space-y-4",children:[l.map(y=>s.jsx("div",{className:`flex ${y.sender_id===(e==null?void 0:e.id)?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[70%] rounded-lg p-3 ${y.sender_id===(e==null?void 0:e.id)?"bg-primary text-primary-foreground":"bg-muted"}`,children:[s.jsx("p",{className:"text-sm",children:y.content}),s.jsxs("div",{className:"flex items-center justify-end gap-1 mt-1",children:[s.jsx("span",{className:"text-xs opacity-70",children:Ot(new Date(y.created_at),"HH:mm",{locale:yr})}),y.sender_id===(e==null?void 0:e.id)&&(y.is_read?s.jsx(KJ,{className:"h-3 w-3 opacity-70"}):s.jsx(Pn,{className:"h-3 w-3 opacity-70"}))]})]})},y.id)),s.jsx("div",{ref:p})]})}),s.jsx("div",{className:"p-4 border-t",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(gn,{placeholder:"Votre message...",value:u,onChange:y=>d(y.target.value),className:"min-h-[60px] resize-none",onKeyDown:y=>{y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),b())}}),s.jsx(ne,{onClick:b,disabled:!u.trim()||h,size:"icon",className:"h-auto",children:h?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsx(ta,{className:"h-4 w-4"})})]})})]})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:s.jsxs("div",{className:"text-center",children:[s.jsx(zo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{children:"Sélectionnez une conversation"})]})})})]})]})]})}const o7e=[{key:"date",re:/^date|jour/i},{key:"start",re:/d[ée]but|heure d/i},{key:"end",re:/fin|heure f/i},{key:"half_day",re:/demi|matin|journ/i},{key:"client_name",re:/[ée]cole|client/i},{key:"subject",re:/mati|module/i},{key:"cursus",re:/cursus|groupe|promo|intitul/i},{key:"nb_stagiaires",re:/stagiaire|[ée]l[èe]ve|nombre/i},{key:"mode",re:/pr[ée]sentiel|distanciel|mode/i},{key:"notes",re:/note|commentaire/i}];function _q(e){const t=(e||"").trim();if(!t)return"";const r=t.match(/^(\d{4})-(\d{2})-(\d{2})/);if(r)return`${r[1]}-${r[2]}-${r[3]}`;const n=t.match(/^(\d{1,2})[/.\-](\d{1,2})[/.\-](\d{2,4})/);return n?`${n[3].length===2?`20${n[3]}`:n[3]}-${n[2].padStart(2,"0")}-${n[1].padStart(2,"0")}`:""}function Nq(e){const t=(e||"").toLowerCase();return/distan|visio|à distance|a distance/.test(t)?"distanciel":/pr[ée]sent/.test(t)?"presentiel":""}function Sq(e){const t=(e||"").toLowerCase();return/journ/.test(t)?"journee":/apr[èe]s|am|pm.*after|après-midi/.test(t)||t==="apres-midi"?"apres-midi":/matin/.test(t)?"matin":""}const l7e=()=>({include:!0,date:"",start:"",end:"",half_day:"",client_name:"",subject:"",cursus:"",nb_stagiaires:"",mode:"",notes:""});function c7e({trainerId:e,open:t,onOpenChange:r,onImported:n}){const[a,i]=w.useState(!1),[o,l]=w.useState(""),[c,u]=w.useState([]),[d,f]=w.useState(!1),[m,h]=w.useState(""),g=()=>{u([]),l(""),h("")};function p(_){for(let j=0;j<Math.min(_.length,8);j++){const S=_[j].map(T=>(T??"").toString()),I={};S.forEach((T,k)=>{for(const V of o7e)if(V.re.test(T)&&I[V.key]===void 0){I[V.key]=k;break}});const P=I.date!==void 0,F=I.client_name!==void 0||I.subject!==void 0;if(P&&F){const T=[];for(let k=j+1;k<_.length;k++){const V=_[k].map(H=>(H??"").toString().trim());if(V.every(H=>H===""))continue;const C=H=>I[H]!==void 0?V[I[H]]??"":"",R=_q(C("date"));R&&T.push({include:!0,date:R,start:C("start"),end:C("end"),half_day:Sq(C("half_day")),client_name:C("client_name"),subject:C("subject"),cursus:C("cursus"),nb_stagiaires:C("nb_stagiaires").replace(/[^\d]/g,""),mode:Nq(C("mode")),notes:C("notes")})}return T.length?T:null}}return null}const x=async _=>{i(!0),g();try{const j=await Vd(()=>Promise.resolve().then(()=>ape),void 0),S=await _.arrayBuffer(),I=j.read(S,{type:"array"});let P=[];for(const C of I.SheetNames){const R=j.utils.sheet_to_json(I.Sheets[C],{header:1,raw:!1,defval:""});if(R.some(H=>H.some(q=>(q??"").toString().trim()!==""))){P=R;break}}if(!P.length){h("Fichier vide ou illisible. Vérifiez qu'il contient bien des données."),ae.error("Fichier vide ou illisible");return}const F=p(P);if(F){u(F),l("tabular"),ae.success(`${F.length} ligne(s) détectée(s) (tableau structuré)`);return}ae.info("Format libre détecté — extraction par IA en cours…");const{data:T,error:k}=await he.functions.invoke("parse-planning-excel",{body:{rows:P,year:new Date().getFullYear()}});if(k||T!=null&&T.error)throw new Error((T==null?void 0:T.error)||(k==null?void 0:k.message));const V=(T==null?void 0:T.interventions)||[];if(!V.length){h("Aucune intervention détectée par l'IA. Les plannings annuels en grille (mois côte à côte) sont difficiles à lire automatiquement — utilisez le « Modèle Excel » fourni, ou saisissez les séances directement dans le calendrier."),ae.error("Aucune intervention détectée.");return}u(V.map(C=>({...l7e(),date:_q(String(C.date??"")),start:String(C.start_time??""),end:String(C.end_time??""),half_day:Sq(String(C.half_day??"")),client_name:String(C.client_name??""),subject:String(C.subject??""),cursus:String(C.cursus??""),nb_stagiaires:C.nb_stagiaires!=null?String(C.nb_stagiaires):"",mode:Nq(String(C.mode??"")),notes:String(C.notes??"")}))),l("ai"),ae.success(`${V.length} intervention(s) extraite(s) par IA — vérifiez avant import`)}catch(j){console.error(j);const S=j instanceof Error?j.message:"inconnue";h(`Échec de l'analyse du fichier : ${S}`),ae.error(`Erreur d'import : ${S}`)}finally{i(!1)}},v=(_,j)=>u(S=>S.map((I,P)=>P===_?{...I,...j}:I)),b=(_,j)=>{const[S,I,P]=_.split("-").map(Number),[F,T]=(j||"00:00").split(":").map(Number);return new Date(S,(I||1)-1,P||1,F||0,T||0,0).toISOString()},y=async()=>{const _=c.filter(j=>j.include&&j.date);if(!_.length){ae.error("Aucune ligne valide à importer");return}f(!0);try{const j=_.map(I=>{const P=b(I.date,I.start||"00:00"),F=I.end?b(I.date,I.end):null;let T=I.start&&I.end?koe(P,F,0):null;return T==null&&I.half_day&&(T=I.half_day==="journee"?7:3.5),{trainer_profile_id:e,starts_at:P,ends_at:F,half_day:I.half_day||null,hours:T,client_name:I.client_name.trim()||null,subject:I.subject.trim()||null,cursus:I.cursus.trim()||null,nb_stagiaires:I.nb_stagiaires?parseInt(I.nb_stagiaires,10):null,mode:I.mode||null,notes:I.notes.trim()||null,status:"realise",source:"excel"}}),{error:S}=await Gi.from("trainer_interventions").insert(j);if(S)throw S;ae.success(`${j.length} intervention(s) importée(s) !`),n(),r(!1),g()}catch(j){console.error(j),ae.error("Erreur lors de l'import en base")}finally{f(!1)}},N=c.filter(_=>_.include&&_.date).length;return s.jsx(Hn,{open:t,onOpenChange:_=>{r(_),_||g()},children:s.jsxs(qn,{className:"max-w-4xl max-h-[88vh] overflow-y-auto",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Importer un planning Excel"}),s.jsx(Ia,{children:"Déposez votre fichier (.xlsx / .csv). Les tableaux structurés sont lus directement ; les plannings en grille libre sont extraits par IA. Vous validez tout avant l'import."})]}),m&&c.length===0&&s.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 text-red-700 text-sm p-3",children:m}),c.length===0?s.jsxs("label",{className:"flex flex-col items-center justify-center gap-3 border-2 border-dashed rounded-lg py-12 cursor-pointer hover:bg-muted/40 transition-colors",children:[a?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"Analyse du fichier…"})]}):s.jsxs(s.Fragment,{children:[s.jsx(Nve,{className:"h-8 w-8 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:"Cliquez ou glissez votre fichier ici"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:".xlsx, .xls, .csv"})]}),s.jsx("input",{type:"file",accept:".xlsx,.xls,.csv",className:"hidden",disabled:a,onChange:_=>{var S;const j=(S=_.target.files)==null?void 0:S[0];j&&x(j)}})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o==="ai"?s.jsxs(Le,{variant:"outline",className:"bg-purple-100 text-purple-700 border-purple-300",children:[s.jsx(Uo,{className:"w-3 h-3 mr-1"})," Extraction IA"]}):s.jsxs(Le,{variant:"outline",className:"bg-blue-100 text-blue-700 border-blue-300",children:[s.jsx(Lj,{className:"w-3 h-3 mr-1"})," Tableau structuré"]}),s.jsxs("span",{className:"text-muted-foreground",children:[N," / ",c.length," ligne(s) sélectionnée(s)"]}),s.jsx(ne,{variant:"ghost",size:"sm",className:"ml-auto",onClick:g,children:"Changer de fichier"})]}),s.jsx("div",{className:"border rounded-md overflow-x-auto mt-2",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-muted/50 text-xs",children:s.jsxs("tr",{children:[s.jsx("th",{className:"p-2 w-8"}),s.jsx("th",{className:"p-2 text-left",children:"Date"}),s.jsx("th",{className:"p-2 text-left",children:"École"}),s.jsx("th",{className:"p-2 text-left",children:"Matière"}),s.jsx("th",{className:"p-2 text-left",children:"Groupe"}),s.jsx("th",{className:"p-2 text-left w-16",children:"Élèves"}),s.jsx("th",{className:"p-2 text-left w-24",children:"½ journée"})]})}),s.jsx("tbody",{children:c.map((_,j)=>s.jsxs("tr",{className:`border-t ${_.include?"":"opacity-40"} ${_.date?"":"bg-red-50"}`,children:[s.jsx("td",{className:"p-1 text-center",children:s.jsx(Vo,{checked:_.include,onCheckedChange:S=>v(j,{include:!!S})})}),s.jsx("td",{className:"p-1",children:s.jsx(Ye,{className:"h-8",type:"date",value:_.date,onChange:S=>v(j,{date:S.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Ye,{className:"h-8",value:_.client_name,onChange:S=>v(j,{client_name:S.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Ye,{className:"h-8",value:_.subject,onChange:S=>v(j,{subject:S.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Ye,{className:"h-8",value:_.cursus,onChange:S=>v(j,{cursus:S.target.value})})}),s.jsx("td",{className:"p-1",children:s.jsx(Ye,{className:"h-8",value:_.nb_stagiaires,onChange:S=>v(j,{nb_stagiaires:S.target.value})})}),s.jsx("td",{className:"p-1 text-xs text-muted-foreground",children:_.half_day||(_.start?`${_.start}-${_.end}`:"")})]},j))})]})}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Les lignes sans date (en rouge) ne seront pas importées. Tout est modifiable ci-dessus."})]}),s.jsxs(Jl,{className:"mt-2",children:[s.jsx(ne,{variant:"outline",onClick:()=>r(!1),children:"Annuler"}),c.length>0&&s.jsxs(ne,{onClick:y,disabled:d||N===0,children:[d?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Importer ",N," intervention(s)"]})]})]})})}const kq={netypareo:"Netypareo (iCal)",google:"Google Agenda",ical:"Autre iCal / Outlook"};function u7e({trainerId:e,open:t,onOpenChange:r,onSynced:n}){const[a,i]=w.useState([]),[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState("netypareo"),[m,h]=w.useState(""),[g,p]=w.useState(""),[x,v]=w.useState(!1);w.useEffect(()=>{t&&b()},[t]);const b=async()=>{l(!0);const{data:j}=await Gi.from("calendar_sync_sources").select("*").eq("trainer_profile_id",e).order("created_at",{ascending:!0});i(j||[]),l(!1)},y=async()=>{if(!g.trim()){ae.error("URL iCal requise");return}if(!/^https?:\/\//i.test(g.trim())){ae.error("URL invalide (doit commencer par http)");return}v(!0);try{const{error:j}=await Gi.from("calendar_sync_sources").insert({trainer_profile_id:e,kind:d,label:m.trim()||null,ics_url:g.trim(),active:!0});if(j)throw j;h(""),p(""),ae.success("Source ajoutée"),await b()}catch(j){console.error(j),ae.error("Erreur lors de l'ajout")}finally{v(!1)}},N=async j=>{const{error:S}=await Gi.from("calendar_sync_sources").delete().eq("id",j);if(S){ae.error("Erreur");return}ae.success("Source supprimée"),await b()},_=async()=>{u(!0);try{const{data:j,error:S}=await he.functions.invoke("sync-calendar-feeds",{body:{}});if(S||j!=null&&j.error)throw new Error((j==null?void 0:j.error)||(S==null?void 0:S.message));ae.success(`Synchronisation terminée — ${j.imported} intervention(s) importée(s)`),await b(),n()}catch(j){console.error(j),ae.error(`Erreur de synchronisation : ${j instanceof Error?j.message:"inconnue"}`)}finally{u(!1)}};return s.jsx(Hn,{open:t,onOpenChange:r,children:s.jsxs(qn,{className:"max-w-lg",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Synchroniser un calendrier"}),s.jsxs(Ia,{children:["Connectez votre agenda Netypareo, Google ou Outlook via son lien iCal. Pour Netypareo, collez l'URL ",s.jsx("code",{className:"text-xs",children:"…/ical.php?token=…"})," (le module iCal doit être activé par votre école). La synchro importe les nouvelles séances sans écraser vos saisies."]})]}),s.jsx("div",{className:"space-y-2",children:o?s.jsx("div",{className:"flex justify-center py-4",children:s.jsx(at,{className:"h-5 w-5 animate-spin"})}):a.length===0?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"Aucune source connectée."}):a.map(j=>s.jsxs("div",{className:"flex items-center gap-2 border rounded-md p-2",children:[s.jsx(JS,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"text-sm font-medium truncate",children:[j.label||kq[j.kind]||j.kind,s.jsx(Le,{variant:"outline",className:"ml-2 text-[10px]",children:kq[j.kind]||j.kind})]}),s.jsx("div",{className:"text-xs text-muted-foreground truncate",children:j.last_status?j.last_status:"jamais synchronisé"})]}),s.jsx(ne,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>N(j.id),children:s.jsx(bi,{className:"h-4 w-4"})})]},j.id))}),s.jsxs("div",{className:"border-t pt-3 space-y-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Type"}),s.jsxs(Lr,{value:d,onValueChange:f,children:[s.jsx(Ar,{className:"h-9",children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"netypareo",children:"Netypareo"}),s.jsx(ot,{value:"google",children:"Google Agenda"}),s.jsx(ot,{value:"ical",children:"Autre iCal / Outlook"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Nom (optionnel)"}),s.jsx(Ye,{className:"h-9",value:m,onChange:j=>h(j.target.value),placeholder:"ex: EFREI"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"URL iCal"}),s.jsx(Ye,{className:"h-9",value:g,onChange:j=>p(j.target.value),placeholder:"https://netypareo.monecole.fr/ical.php?token=…"})]}),s.jsxs(ne,{variant:"outline",className:"w-full",onClick:y,disabled:x,children:[x?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Ya,{className:"h-4 w-4 mr-2"}),"Ajouter la source"]})]}),s.jsxs(ne,{onClick:_,disabled:c||a.length===0,className:"w-full",children:[c?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(yo,{className:"h-4 w-4 mr-2"}),"Synchroniser maintenant"]})]})})}function d7e({items:e,trainerName:t,open:r,onOpenChange:n}){const a=new Date,[i,o]=w.useState(Ot(new Date(a.getFullYear(),a.getMonth(),1),"yyyy-MM-dd")),[l,c]=w.useState(Ot(new Date(a.getFullYear(),a.getMonth()+1,0),"yyyy-MM-dd")),[u,d]=w.useState(""),[f,m]=w.useState(""),[h,g]=w.useState(!1),p=w.useMemo(()=>{const N=new Date(`${i}T00:00:00`).getTime(),_=new Date(`${l}T23:59:59`).getTime();return e.filter(j=>j.status!=="annule"&&j.starts_at).filter(j=>{const S=new Date(j.starts_at).getTime();return S>=N&&S<=_}).filter(j=>!u.trim()||(j.client_name||"").toLowerCase().includes(u.trim().toLowerCase())).sort((j,S)=>new Date(j.starts_at).getTime()-new Date(S.starts_at).getTime())},[e,i,l,u]),x=w.useMemo(()=>Math.round(p.reduce((N,_)=>N+(_.hours??0),0)*100)/100,[p]),v=w.useMemo(()=>{if(f)return Number(f)||0;const N=p.map(_=>_.tjm).filter(_=>_!=null&&_>0);return N.length?N[0]:0},[f,p]),b=Math.round(v/7*x*100)/100,y=async()=>{if(p.length===0){ae.error("Aucune intervention sur la période");return}if(v<=0){ae.error("Renseignez un TJM");return}g(!0);try{const{jsPDF:N}=await Vd(async()=>{const{jsPDF:S}=await Promise.resolve().then(()=>N2);return{jsPDF:S}},void 0),_=new N;let j=16;_.setFontSize(16),_.setFont("helvetica","bold"),_.text("FACTURE (projet)",14,j),j+=8,_.setFontSize(10),_.setFont("helvetica","normal"),_.text(`Émetteur : ${t}`,14,j),j+=5,_.text(`Destinataire : ${u||"—"}`,14,j),j+=5,_.text(`Période : ${Ot(ll(i),"d MMM yyyy",{locale:yr})} → ${Ot(ll(l),"d MMM yyyy",{locale:yr})}`,14,j),j+=5,_.text(`Date d'émission : ${Ot(new Date,"d MMMM yyyy",{locale:yr})}`,14,j),j+=8,_.setFont("helvetica","bold"),_.text("Date",14,j),_.text("Prestation",40,j),_.text("Heures",170,j,{align:"right"}),j+=2,_.setLineWidth(.2),_.line(14,j,196,j),j+=5,_.setFont("helvetica","normal"),_.setFontSize(9);for(const S of p){j>270&&(_.addPage(),j=16);const I=Ot(ll(S.starts_at),"dd/MM/yy"),P=`${S.subject||""}${S.client_name?` — ${S.client_name}`:""}${S.cursus?` (${S.cursus})`:""}`.slice(0,80);_.text(I,14,j),_.text(P,40,j),_.text(String(S.hours??0),196,j,{align:"right"}),j+=5}j+=2,_.line(14,j,196,j),j+=6,_.setFontSize(10),_.setFont("helvetica","bold"),_.text(`Total heures : ${x} h`,14,j),j+=6,_.text(`TJM : ${v} € — base TJM/7 × heures`,14,j),j+=6,_.setFontSize(12),_.text(`MONTANT HT : ${b.toLocaleString("fr-FR")} €`,14,j),j+=8,_.setFontSize(8),_.setFont("helvetica","italic"),_.text("Document pré-rempli à vérifier avant envoi. TVA non applicable, art. 293 B du CGI (si franchise).",14,j),_.save(`facture_${(u||"client").replace(/[^a-z0-9]/gi,"_")}_${i}.pdf`),ae.success("Facture générée")}catch(N){console.error(N),ae.error("Erreur lors de la génération")}finally{g(!1)}};return s.jsx(Hn,{open:r,onOpenChange:n,children:s.jsxs(qn,{className:"max-w-lg",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Générer ma facture"}),s.jsx(Ia,{children:"Facture pré-remplie à partir de vos interventions sur la période (base TJM/7 × heures). À vérifier avant envoi."})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-sm",children:"Du"}),s.jsx(Ye,{type:"date",value:i,onChange:N=>o(N.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-sm",children:"Au"}),s.jsx(Ye,{type:"date",value:l,onChange:N=>c(N.target.value)})]}),s.jsxs("div",{className:"space-y-1 col-span-2",children:[s.jsx(We,{className:"text-sm",children:"Client / destinataire"}),s.jsx(Ye,{value:u,onChange:N=>d(N.target.value),placeholder:"filtre aussi les interventions par école"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-sm",children:"TJM (€)"}),s.jsx(Ye,{type:"number",min:"0",value:f,onChange:N=>m(N.target.value),placeholder:v?String(v):"ex: 600"})]})]}),s.jsx(Lu,{}),s.jsxs("div",{className:"text-sm space-y-1",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Interventions"}),s.jsx("span",{children:p.length})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted-foreground",children:"Total heures"}),s.jsxs("span",{children:[x," h"]})]}),s.jsxs("div",{className:"flex justify-between font-semibold",children:[s.jsx("span",{children:"Montant HT estimé"}),s.jsxs("span",{children:[b.toLocaleString("fr-FR")," €"]})]})]}),s.jsxs(Jl,{children:[s.jsx(ne,{variant:"outline",onClick:()=>n(!1),children:"Fermer"}),s.jsxs(ne,{onClick:y,disabled:h||p.length===0,children:[h?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Ho,{className:"h-4 w-4 mr-2"}),"Télécharger la facture"]})]})]})})}const Cq=e=>({date:e,start:"",end:"",half_day:"",break_minutes:"0",hours:"",client_name:"",subject:"",cursus:"",nb_stagiaires:"",student_types:[],mode:"",action_type:"",funder:"",city:"",address:"",responsable_name:"",responsable_contact:"",tjm:"",hourly_rate_school:"",status:"planifie",notes:""}),f7e={matin:3.5,"apres-midi":3.5,journee:7},pc="__none__";function h7e(e){const t=e.starts_at?ll(e.starts_at):new Date;return{date:Ot(t,"yyyy-MM-dd"),start:e.starts_at&&Ot(ll(e.starts_at),"HH:mm")!=="00:00"?Ot(ll(e.starts_at),"HH:mm"):"",end:e.ends_at?Ot(ll(e.ends_at),"HH:mm"):"",half_day:e.half_day??"",break_minutes:String(e.break_minutes??0),hours:e.hours!=null?String(e.hours):"",client_name:e.client_name??"",subject:e.subject??"",cursus:e.cursus??"",nb_stagiaires:e.nb_stagiaires!=null?String(e.nb_stagiaires):"",student_types:e.student_types??[],mode:e.mode??"",action_type:e.action_type??"",funder:e.funder??"",city:e.city??"",address:e.address??"",responsable_name:e.responsable_name??"",responsable_contact:e.responsable_contact??"",tjm:e.tjm!=null?String(e.tjm):"",hourly_rate_school:e.hourly_rate_school!=null?String(e.hourly_rate_school):"",status:e.status,notes:e.notes??""}}function x4(e,t){const[r,n,a]=e.split("-").map(Number),[i,o]=(t||"00:00").split(":").map(Number);return new Date(r,(n||1)-1,a||1,i||0,o||0,0).toISOString()}function oS(e,t){if(!e)return null;const r=ll(e),[n,a,i]=t.split("-").map(Number);return new Date(n,(a||1)-1,i||1,r.getHours(),r.getMinutes(),0).toISOString()}const Eq="planning-help-dismissed";function m7e(e,t){const r=x4(e.date,e.start||"00:00"),n=e.end?x4(e.date,e.end):null,a=parseInt(e.break_minutes||"0",10)||0;let i=e.hours?parseFloat(e.hours):null;i==null&&e.start&&e.end&&(i=koe(r,n,a)),i==null&&e.half_day&&(i=f7e[e.half_day]??null);const o=l=>l.trim()===""?null:Number(l);return{trainer_profile_id:t,starts_at:r,ends_at:n,half_day:e.half_day||null,break_minutes:a,hours:i,client_name:e.client_name.trim()||null,subject:e.subject.trim()||null,cursus:e.cursus.trim()||null,nb_stagiaires:e.nb_stagiaires?parseInt(e.nb_stagiaires,10):null,student_types:e.student_types,mode:e.mode||null,action_type:e.action_type||null,funder:e.funder||null,city:e.city.trim()||null,address:e.address.trim()||null,responsable_name:e.responsable_name.trim()||null,responsable_contact:e.responsable_contact.trim()||null,tjm:o(e.tjm),hourly_rate_school:o(e.hourly_rate_school),status:e.status,notes:e.notes.trim()||null}}function p7e(){const{user:e,isTrainer:t,loading:r}=Ur(),n=Xt(),[a,i]=w.useState(null),[o,l]=w.useState(""),[c,u]=w.useState([]),[d,f]=w.useState(!0),[m,h]=w.useState(()=>po(new Date)),[g,p]=w.useState("month"),[x,v]=w.useState(""),[b,y]=w.useState("all"),[N,_]=w.useState(!1),[j,S]=w.useState(!1),[I,P]=w.useState(!1),[F,T]=w.useState(!1),[k,V]=w.useState(null),[C,R]=w.useState(Cq(Ot(new Date,"yyyy-MM-dd"))),[H,q]=w.useState(!1),[L,M]=w.useState(null),[z,K]=w.useState(()=>typeof window>"u"||localStorage.getItem(Eq)!=="1"),E=w.useRef(!1),A=Toe(l8(rE,{activationConstraint:{distance:8}}));w.useEffect(()=>{const ge=Ie=>{(Ie.altKey||Ie.key==="Alt")&&(E.current=!0)},pe=Ie=>{Ie.key==="Alt"&&(E.current=!1)};return window.addEventListener("keydown",ge),window.addEventListener("keyup",pe),()=>{window.removeEventListener("keydown",ge),window.removeEventListener("keyup",pe)}},[]),w.useEffect(()=>{if(!r){if(!e){n("/auth");return}if(!t){n("/");return}O()}},[e,t,r]);const O=async()=>{if(e){f(!0);try{const{data:ge}=await he.from("trainer_profiles").select("id, name").eq("user_id",e.id).single();if(!ge){ae.error("Profil formateur introuvable"),f(!1);return}i(ge.id),l(ge.name||""),await U(ge.id)}catch(ge){console.error(ge),ae.error("Erreur lors du chargement du planning")}finally{f(!1)}}},U=async ge=>{const{data:pe,error:Ie}=await Gi.from("trainer_interventions").select("*").eq("trainer_profile_id",ge).order("starts_at",{ascending:!0});if(Ie){console.error(Ie),ae.error("Impossible de charger les interventions");return}u(pe||[])},Y=w.useMemo(()=>{const ge=x.trim().toLowerCase();return c.filter(pe=>b!=="all"&&pe.status!==b?!1:ge?[pe.client_name,pe.subject,pe.cursus,pe.city].filter(Boolean).some(Ie=>Ie.toLowerCase().includes(ge)):!0)},[c,x,b]),J=w.useMemo(()=>{const ge=new Map;for(const pe of Y){if(!pe.starts_at)continue;const Ie=Ot(ll(pe.starts_at),"yyyy-MM-dd");(ge.get(Ie)??ge.set(Ie,[]).get(Ie)).push(pe)}return ge},[Y]),se=w.useMemo(()=>{const ge=Ju(po(m),{weekStartsOn:1}),pe=DC(Xj(m),{weekStartsOn:1});return x4e({start:ge,end:pe})},[m]),ee=ge=>{V(null),R(Cq(Ot(ge??new Date,"yyyy-MM-dd"))),_(!0)},ie=ge=>{V(ge),R(h7e(ge)),_(!0)},Ee=async()=>{if(a){if(!C.date){ae.error("La date est obligatoire");return}q(!0);try{const ge=m7e(C,a);if(k){const{error:pe}=await Gi.from("trainer_interventions").update(ge).eq("id",k.id);if(pe)throw pe;ae.success("Intervention mise à jour")}else{const{error:pe}=await Gi.from("trainer_interventions").insert({...ge,created_by:e==null?void 0:e.id,source:"manual"});if(pe)throw pe;ae.success("Intervention ajoutée")}_(!1),await U(a)}catch(ge){console.error(ge),ae.error("Erreur lors de l'enregistrement")}finally{q(!1)}}},te=async ge=>{if(a)try{const pe={...ge,series_id:ge.series_id??ge.id,created_by:e==null?void 0:e.id};delete pe.id,delete pe.created_at,delete pe.updated_at;const{error:Ie}=await Gi.from("trainer_interventions").insert(pe);if(Ie)throw Ie;ae.success("Intervention dupliquée — modifiez la date du doublon"),await U(a)}catch(pe){console.error(pe),ae.error("Erreur lors de la duplication")}},Ue=()=>{K(!1);try{localStorage.setItem(Eq,"1")}catch{}},W=async(ge,pe)=>{if(a)try{const Ie={...ge,series_id:ge.series_id??ge.id,created_by:e==null?void 0:e.id,starts_at:oS(ge.starts_at,pe)??x4(pe,"00:00"),ends_at:oS(ge.ends_at,pe)};delete Ie.id,delete Ie.created_at,delete Ie.updated_at;const{error:Ge}=await Gi.from("trainer_interventions").insert(Ie);if(Ge)throw Ge;ae.success(`Séance dupliquée au ${Ot(ll(Ie.starts_at),"d MMM",{locale:yr})}`),await U(a)}catch(Ie){console.error(Ie),ae.error("Erreur lors de la duplication")}},Z=async(ge,pe)=>{if(a)try{const Ie={starts_at:oS(ge.starts_at,pe)??x4(pe,"00:00"),ends_at:oS(ge.ends_at,pe)},{error:Ge}=await Gi.from("trainer_interventions").update(Ie).eq("id",ge.id);if(Ge)throw Ge;ae.success(`Séance déplacée au ${Ot(ll(Ie.starts_at),"d MMM",{locale:yr})}`),await U(a)}catch(Ie){console.error(Ie),ae.error("Erreur lors du déplacement")}},le=ge=>{M(c.find(Ie=>Ie.id===ge.active.id)??null);const pe=ge.activatorEvent;pe&&typeof pe.altKey=="boolean"&&(E.current=pe.altKey)},re=ge=>{M(null);const{active:pe,over:Ie}=ge;if(!Ie)return;const Ge=c.find(_e=>_e.id===pe.id);if(!Ge)return;const we=String(Ie.id);Ge.starts_at&&Ot(ll(Ge.starts_at),"yyyy-MM-dd")===we||(E.current?Z(Ge,we):W(Ge,we))},oe=async ge=>{if(a)try{const{error:pe}=await Gi.from("trainer_interventions").delete().eq("id",ge.id);if(pe)throw pe;ae.success("Intervention supprimée"),_(!1),await U(a)}catch(pe){console.error(pe),ae.error("Erreur lors de la suppression")}},fe=async()=>{try{const ge=await Vd(()=>Promise.resolve().then(()=>ape),void 0),pe=["Date","Heure début","Heure fin","Demi-journée (matin/après-midi/journée)","École / Client","Matière / Module","Pause (min)","Intitulé / Cursus / Groupe","Nombre de stagiaires","Type d'élèves","Présentiel / Distanciel","Type d'action (L6313-1)","Financeur","Ville / Adresse","Responsable","Contact responsable","TJM formateur","Tarif horaire école","Statut","Notes"],Ie=["12/01/2026","09:00","12:00","matin","EFREI","CDWFS - Développement Back-end",0,"CDWFS 26 - A3",18,"Alternants","Présentiel","Action de formation","OPCO","Villejuif","M. Dupont","dupont@efrei.fr",600,75,"réalisé","cours du matin"],Ge=ge.utils.aoa_to_sheet([pe,Ie]),we=ge.utils.book_new();ge.utils.book_append_sheet(we,Ge,"Planning"),ge.writeFile(we,"PedagoBridge - Modele Planning.xlsx")}catch(ge){console.error(ge),ae.error("Erreur lors de la génération du modèle")}},Fe=ge=>ge.hours!=null?`${ge.hours}h`:ge.half_day?ge.half_day:"";return r||d?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background py-10 px-4",children:[s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",children:"Mon planning"}),s.jsx("p",{className:"text-muted-foreground",children:"Saisissez et modifiez vos interventions. Elles alimenteront votre BPF."})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:fe,children:[s.jsx(Ho,{className:"w-4 h-4 mr-2"}),"Modèle Excel"]}),s.jsxs(ne,{variant:"outline",onClick:()=>S(!0),disabled:!a,children:[s.jsx(nc,{className:"w-4 h-4 mr-2"}),"Importer Excel"]}),s.jsxs(ne,{variant:"outline",onClick:()=>P(!0),disabled:!a,children:[s.jsx(yo,{className:"w-4 h-4 mr-2"}),"Synchroniser"]}),s.jsxs(ne,{variant:"outline",onClick:()=>T(!0),disabled:!a,children:[s.jsx(xR,{className:"w-4 h-4 mr-2"}),"Ma facture"]}),s.jsxs(ne,{onClick:()=>ee(),children:[s.jsx(Ya,{className:"w-4 h-4 mr-2"}),"Ajouter une intervention"]})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[s.jsx(Ye,{placeholder:"Rechercher (école, matière, groupe, ville)…",value:x,onChange:ge=>v(ge.target.value),className:"max-w-xs"}),s.jsxs(Lr,{value:b,onValueChange:y,children:[s.jsx(Ar,{className:"w-44",children:s.jsx(Br,{placeholder:"Statut"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les statuts"}),Object.keys(kd).map(ge=>s.jsx(ot,{value:ge,children:kd[ge].label},ge))]})]}),s.jsxs(Le,{variant:"outline",className:"ml-auto",children:[Y.length," intervention",Y.length>1?"s":""]})]}),z?s.jsxs("div",{className:"mb-4 rounded-lg border border-primary/30 bg-primary/5 p-3 text-sm relative",children:[s.jsx("button",{type:"button",onClick:Ue,className:"absolute top-2 right-2 text-muted-foreground hover:text-foreground",title:"Masquer l'aide",children:s.jsx(Ri,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex items-start gap-2 pr-6",children:[s.jsx(ey,{className:"w-4 h-4 mt-0.5 text-primary shrink-0"}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"font-medium",children:"Comment utiliser le calendrier"}),s.jsxs("ul",{className:"text-muted-foreground space-y-0.5",children:[s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Cliquez"})," sur une séance pour la modifier, ou sur ",s.jsx("strong",{children:"+"})," dans un jour pour en ajouter une."]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Glissez"})," une séance sur un autre jour pour la ",s.jsx("strong",{children:"dupliquer"})," (l'original reste en place)."]}),s.jsxs("li",{children:["• ",s.jsx("strong",{children:"Alt + glisser"})," (maintenez la touche Alt enfoncée) pour la ",s.jsx("strong",{children:"déplacer"})," au lieu de la dupliquer."]}),s.jsx("li",{children:"• Importez un Excel, synchronisez un agenda iCal ou générez votre facture via les boutons en haut."})]})]})]})]}):s.jsxs("button",{type:"button",onClick:()=>K(!0),className:"mb-3 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-primary",children:[s.jsx(d0,{className:"w-3.5 h-3.5"})," Aide : comment utiliser le calendrier"]}),s.jsxs(af,{value:g,onValueChange:p,children:[s.jsxs(ad,{className:"mb-4",children:[s.jsxs(In,{value:"month",children:[s.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Mois"]}),s.jsxs(In,{value:"list",children:[s.jsx(Fve,{className:"w-4 h-4 mr-2"}),"Liste"]})]}),s.jsxs(Es,{value:"month",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>h(Ike(m)),children:s.jsx(eC,{className:"w-4 h-4"})}),s.jsx("h2",{className:"text-lg font-semibold capitalize",children:Ot(m,"MMMM yyyy",{locale:yr})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>h(sc(m,1)),children:s.jsx(tu,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-muted-foreground mb-1",children:["Lun","Mar","Mer","Jeu","Ven","Sam","Dim"].map(ge=>s.jsx("div",{children:ge},ge))}),s.jsxs(Yoe,{sensors:A,onDragStart:le,onDragEnd:re,children:[s.jsx("div",{className:"grid grid-cols-7 gap-1",children:se.map(ge=>{const pe=Ot(ge,"yyyy-MM-dd"),Ie=J.get(pe)??[],Ge=IC(ge,m),we=Lo(ge,new Date);return s.jsxs(x7e,{id:pe,className:`min-h-[92px] rounded-md border p-1 flex flex-col gap-1 ${Ge?"bg-card":"bg-muted/40"} ${we?"ring-1 ring-primary":""}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:`text-xs ${Ge?"":"text-muted-foreground"}`,children:Ot(ge,"d")}),s.jsx("button",{type:"button",onClick:()=>ee(ge),className:"text-muted-foreground hover:text-primary",title:"Ajouter",children:s.jsx(Ya,{className:"w-3 h-3"})})]}),s.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[Ie.slice(0,4).map(_e=>s.jsx(g7e,{i:_e,onOpen:ie},_e.id)),Ie.length>4&&s.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",Ie.length-4," autre(s)"]})]})]},pe)})}),s.jsx(CMe,{dropAnimation:null,children:L?s.jsxs("div",{className:`text-[11px] leading-tight rounded px-1.5 py-1 border shadow-md ${kd[L.status].className}`,children:[s.jsx("span",{className:"font-medium",children:L.client_name||"—"}),L.subject?s.jsxs("span",{className:"opacity-80",children:[" · ",L.subject]}):null]}):null})]})]}),s.jsx(Es,{value:"list",children:Y.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-10",children:"Aucune intervention. Cliquez sur « Ajouter une intervention »."}):s.jsx("div",{className:"space-y-2",children:Y.map(ge=>s.jsx(ke,{className:"hover:shadow-sm transition-shadow",children:s.jsxs(Ae,{className:"py-3 flex flex-wrap items-center gap-x-4 gap-y-1",children:[s.jsxs("div",{className:"w-28 shrink-0",children:[s.jsx("div",{className:"font-medium text-sm",children:ge.starts_at?Ot(ll(ge.starts_at),"EEE d MMM",{locale:yr}):"—"}),s.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(Gr,{className:"w-3 h-3"})," ",Fe(ge)]})]}),s.jsxs("div",{className:"flex-1 min-w-[180px]",children:[s.jsx("div",{className:"font-semibold",children:ge.subject||"—"}),s.jsxs("div",{className:"text-sm text-muted-foreground flex flex-wrap items-center gap-x-3",children:[s.jsx("span",{children:ge.client_name||"—"}),ge.cursus&&s.jsxs("span",{children:["· ",ge.cursus]}),ge.city&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Gs,{className:"w-3 h-3"}),ge.city]}),ge.nb_stagiaires!=null&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(sr,{className:"w-3 h-3"}),ge.nb_stagiaires]})]})]}),s.jsx(Le,{variant:"outline",className:kd[ge.status].className,children:kd[ge.status].label}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{size:"icon",variant:"ghost",onClick:()=>te(ge),title:"Dupliquer",children:s.jsx(Qv,{className:"w-4 h-4"})}),s.jsx(ne,{size:"sm",variant:"outline",onClick:()=>ie(ge),children:"Modifier"})]})]})},ge.id))})})]})]}),s.jsx(Hn,{open:N,onOpenChange:_,children:s.jsxs(qn,{className:"max-w-2xl max-h-[88vh] overflow-y-auto",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:k?"Modifier l'intervention":"Nouvelle intervention"}),s.jsx(Ia,{children:"Seuls la date, l'école et la matière sont vraiment utiles pour commencer. Le reste sert au BPF."})]}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 mt-2",children:[s.jsx(ka,{label:"Date *",children:s.jsx(Ye,{type:"date",value:C.date,onChange:ge=>R({...C,date:ge.target.value})})}),s.jsx(ka,{label:"Demi-journée",children:s.jsxs(Lr,{value:C.half_day||pc,onValueChange:ge=>R({...C,half_day:ge===pc?"":ge}),children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"—"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:pc,children:"—"}),s.jsx(ot,{value:"matin",children:"Matin"}),s.jsx(ot,{value:"apres-midi",children:"Après-midi"}),s.jsx(ot,{value:"journee",children:"Journée"})]})]})}),s.jsx(ka,{label:"Heure début",children:s.jsx(Ye,{type:"time",value:C.start,onChange:ge=>R({...C,start:ge.target.value})})}),s.jsx(ka,{label:"Heure fin",children:s.jsx(Ye,{type:"time",value:C.end,onChange:ge=>R({...C,end:ge.target.value})})}),s.jsx(ka,{label:"Pause (min)",children:s.jsx(Ye,{type:"number",min:"0",value:C.break_minutes,onChange:ge=>R({...C,break_minutes:ge.target.value})})}),s.jsx(ka,{label:"Heures (sinon calculé)",children:s.jsx(Ye,{type:"number",min:"0",step:"0.5",placeholder:"auto",value:C.hours,onChange:ge=>R({...C,hours:ge.target.value})})}),s.jsx(ka,{label:"École / Client",children:s.jsx(Ye,{value:C.client_name,onChange:ge=>R({...C,client_name:ge.target.value}),placeholder:"EFREI"})}),s.jsx(ka,{label:"Matière / Module",children:s.jsx(Ye,{value:C.subject,onChange:ge=>R({...C,subject:ge.target.value}),placeholder:"CDWFS - Back-end"})}),s.jsx(ka,{label:"Intitulé / Cursus / Groupe",children:s.jsx(Ye,{value:C.cursus,onChange:ge=>R({...C,cursus:ge.target.value}),placeholder:"CDWFS 26 - A3"})}),s.jsx(ka,{label:"Nombre de stagiaires",children:s.jsx(Ye,{type:"number",min:"0",value:C.nb_stagiaires,onChange:ge=>R({...C,nb_stagiaires:ge.target.value})})}),s.jsx(ka,{label:"Mode",children:s.jsxs(Lr,{value:C.mode||pc,onValueChange:ge=>R({...C,mode:ge===pc?"":ge}),children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"—"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:pc,children:"—"}),s.jsx(ot,{value:"presentiel",children:"Présentiel"}),s.jsx(ot,{value:"distanciel",children:"Distanciel"})]})]})}),s.jsx(ka,{label:"Statut",children:s.jsxs(Lr,{value:C.status,onValueChange:ge=>R({...C,status:ge}),children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsx(Tr,{children:Object.keys(kd).map(ge=>s.jsx(ot,{value:ge,children:kd[ge].label},ge))})]})}),s.jsx(ka,{label:"Type d'action (BPF)",children:s.jsxs(Lr,{value:C.action_type||pc,onValueChange:ge=>R({...C,action_type:ge===pc?"":ge}),children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"—"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:pc,children:"—"}),YLe.map(ge=>s.jsx(ot,{value:ge,children:ge},ge))]})]})}),s.jsx(ka,{label:"Financeur (BPF)",children:s.jsxs(Lr,{value:C.funder||pc,onValueChange:ge=>R({...C,funder:ge===pc?"":ge}),children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"—"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:pc,children:"—"}),Bx.map(ge=>s.jsx(ot,{value:ge,children:ge},ge))]})]})}),s.jsx(ka,{label:"Ville",children:s.jsx(Ye,{value:C.city,onChange:ge=>R({...C,city:ge.target.value})})}),s.jsx(ka,{label:"Adresse",children:s.jsx(Ye,{value:C.address,onChange:ge=>R({...C,address:ge.target.value})})}),s.jsx(ka,{label:"Responsable",children:s.jsx(Ye,{value:C.responsable_name,onChange:ge=>R({...C,responsable_name:ge.target.value})})}),s.jsx(ka,{label:"Contact responsable",children:s.jsx(Ye,{value:C.responsable_contact,onChange:ge=>R({...C,responsable_contact:ge.target.value})})}),s.jsx(ka,{label:"TJM formateur (€)",children:s.jsx(Ye,{type:"number",min:"0",value:C.tjm,onChange:ge=>R({...C,tjm:ge.target.value})})}),s.jsx(ka,{label:"Tarif horaire école (€)",children:s.jsx(Ye,{type:"number",min:"0",value:C.hourly_rate_school,onChange:ge=>R({...C,hourly_rate_school:ge.target.value})})})]}),s.jsxs("div",{className:"mt-2",children:[s.jsx(We,{className:"text-sm",children:"Type d'élèves"}),s.jsx("div",{className:"flex flex-wrap gap-3 mt-2",children:KLe.map(ge=>{const pe=C.student_types.includes(ge);return s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx(Vo,{checked:pe,onCheckedChange:Ie=>R({...C,student_types:Ie?[...C.student_types,ge]:C.student_types.filter(Ge=>Ge!==ge)})}),ge]},ge)})})]}),s.jsx(ka,{label:"Notes",children:s.jsx(gn,{value:C.notes,onChange:ge=>R({...C,notes:ge.target.value}),rows:2})}),s.jsxs(Jl,{className:"mt-4 flex-wrap gap-2",children:[k&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>te(k),children:[s.jsx(Qv,{className:"w-4 h-4 mr-2"})," Dupliquer"]}),s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsxs(ne,{variant:"destructive",children:[s.jsx(bi,{className:"w-4 h-4 mr-2"})," Supprimer"]})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Supprimer cette intervention ?"}),s.jsx(Xc,{children:"Action irréversible."})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>oe(k),children:"Supprimer"})]})]})]})]}),s.jsxs(ne,{className:"ml-auto",onClick:Ee,disabled:H,children:[H?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):null,k?"Enregistrer":"Ajouter"]})]})]})}),a&&s.jsx(c7e,{trainerId:a,open:j,onOpenChange:S,onImported:()=>U(a)}),a&&s.jsx(u7e,{trainerId:a,open:I,onOpenChange:P,onSynced:()=>U(a)}),s.jsx(d7e,{items:c,trainerName:o,open:F,onOpenChange:T})]})}function g7e({i:e,onOpen:t}){const{attributes:r,listeners:n,setNodeRef:a,isDragging:i}=Xoe({id:e.id});return s.jsxs("button",{ref:a,type:"button",...n,...r,onClick:()=>t(e),className:`w-full text-left text-[11px] leading-tight rounded px-1.5 py-1 border truncate hover:opacity-80 cursor-grab active:cursor-grabbing ${kd[e.status].className} ${i?"opacity-40":""}`,title:`${e.subject??""} — ${e.client_name??""} · glisser = dupliquer, Alt+glisser = déplacer`,children:[s.jsx("span",{className:"font-medium",children:e.client_name||"—"}),e.subject?s.jsxs("span",{className:"opacity-80",children:[" · ",e.subject]}):null]})}function x7e({id:e,className:t,children:r}){const{setNodeRef:n,isOver:a}=Joe({id:e});return s.jsx("div",{ref:n,className:`${t??""} ${a?"ring-2 ring-primary bg-primary/10":""}`,children:r})}function ka({label:e,children:t}){return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(We,{className:"text-sm",children:e}),t]})}const Aq=e=>({is_of:!1,raison_sociale:"",siret:"",nda:"",adresse:"",code_postal:"",ville:"",exercice_start:`${e}-01-01`,exercice_end:`${e}-12-31`,franchise_tva:!0,distanciel:!1}),IT=[{key:"identite",label:"Identité (A/B)",icon:Vr},{key:"pedago",label:"Pédagogique (E/F)",icon:Ii},{key:"produits",label:"Produits (C)",icon:Gy},{key:"charges",label:"Charges (D)",icon:xR},{key:"recap",label:"Récapitulatif",icon:Qm}],yd=e=>`${Math.round(e).toLocaleString("fr-FR")} €`;function v7e(){const{user:e,isTrainer:t,loading:r}=Ur(),n=Xt(),[a,i]=w.useState(null),[o,l]=w.useState(!0),[c,u]=w.useState(!1),[d,f]=w.useState(0),[m,h]=w.useState(new Date().getFullYear()-1),[g,p]=w.useState([]),[x,v]=w.useState(Aq(new Date().getFullYear()-1)),[b,y]=w.useState({}),[N,_]=w.useState(""),[j,S]=w.useState({remuneration:"",soustraitance:"",achats:"",autres:""}),[I,P]=w.useState(null);w.useEffect(()=>{if(!r){if(!e){n("/auth");return}if(!t){n("/");return}F()}},[e,t,r]),w.useEffect(()=>{a&&T(a,m)},[m,a]);const F=async()=>{if(e){l(!0);try{const{data:z}=await he.from("trainer_profiles").select("id").eq("user_id",e.id).single();if(!z){ae.error("Profil formateur introuvable"),l(!1);return}i(z.id);const{data:K}=await Gi.from("trainer_of_profiles").select("*").eq("trainer_profile_id",z.id).maybeSingle();K&&v({...Aq(m),...K}),await T(z.id,m)}catch(z){console.error(z),ae.error("Erreur lors du chargement")}finally{l(!1)}}},T=async(z,K)=>{var Y,J,se,ee;const{data:E}=await Gi.from("trainer_interventions").select("*").eq("trainer_profile_id",z).gte("starts_at",`${K}-01-01`).lte("starts_at",`${K}-12-31T23:59:59`),A=(E||[]).filter(ie=>ie.status!=="annule");p(A);const{data:O}=await Gi.from("bpf_declarations").select("manual").eq("trainer_profile_id",z).eq("year",K).maybeSingle(),U=(O==null?void 0:O.manual)??{};y(U.funders??{}),_(U.trainee_count!=null?String(U.trainee_count):""),S({remuneration:((Y=U.charges)==null?void 0:Y.remuneration)??"",soustraitance:((J=U.charges)==null?void 0:J.soustraitance)??"",achats:((se=U.charges)==null?void 0:se.achats)??"",autres:((ee=U.charges)==null?void 0:ee.autres)??""})},k=w.useMemo(()=>{let z=0,K=0,E=0;const A={},O={};for(const U of g){const Y=U.hours??0;z+=Y;const J=Y*(U.nb_stagiaires??0);K+=J,U.mode==="distanciel"&&(E+=Y);const se=U.action_type||"Non précisé";A[se]=A[se]||{hours:0,hs:0},A[se].hours+=Y,A[se].hs+=J;const ee=Y*(U.hourly_rate_school??0);if(ee>0){const ie=U.funder||"Non précisé";O[ie]=(O[ie]||0)+ee}}return{sessions:g.length,totalHours:Math.round(z*100)/100,heuresStagiaires:Math.round(K),distancielHours:Math.round(E*100)/100,byAction:A,revenueByFunder:O}},[g]),V=z=>{const K=b[z];return K!=null&&K!==""?Number(K)||0:Math.round(k.revenueByFunder[z]||0)},C=w.useMemo(()=>Bx.reduce((z,K)=>z+V(K),0),[b,k]),R=(Number(j.remuneration)||0)+(Number(j.soustraitance)||0)+(Number(j.achats)||0)+(Number(j.autres)||0),H=async(z="draft")=>{if(a){u(!0);try{await Gi.from("trainer_of_profiles").upsert({trainer_profile_id:a,...x},{onConflict:"trainer_profile_id"});const K={funders:b,trainee_count:N?parseInt(N,10):null,charges:j},E={...k,totalProduits:C,totalCharges:R,produitsByFunder:Object.fromEntries(Bx.map(O=>[O,V(O)]))},{error:A}=await Gi.from("bpf_declarations").upsert({trainer_profile_id:a,year:m,status:z,manual:K,computed:E},{onConflict:"trainer_profile_id,year"});if(A)throw A;ae.success("BPF enregistré")}catch(K){console.error(K),ae.error("Erreur lors de l'enregistrement")}finally{u(!1)}}},q=(z,K)=>{navigator.clipboard.writeText(K).then(()=>{P(z),setTimeout(()=>P(null),1500)})},L=async()=>{try{const{jsPDF:z}=await Vd(async()=>{const{jsPDF:O}=await Promise.resolve().then(()=>N2);return{jsPDF:O}},void 0),K=new z;let E=14;const A=(O,U=10,Y=!1)=>{K.setFontSize(U),K.setFont("helvetica",Y?"bold":"normal"),K.text(O,14,E),E+=U<12?6:8};A("Bilan Pédagogique et Financier — Récapitulatif",14,!0),A(`Exercice ${m} — ${x.raison_sociale||"(raison sociale)"}`,11),E+=2,A("Cadre A/B — Identité",12,!0),A(`SIRET : ${x.siret||"—"} N° NDA : ${x.nda||"—"}`),A(`Adresse : ${x.adresse||"—"} ${x.code_postal} ${x.ville}`),A(`Exercice : ${x.exercice_start} → ${x.exercice_end} Distanciel : ${x.distanciel?"Oui":"Non"}`),E+=2,A("Cadre C — Produits",12,!0),Bx.forEach(O=>V(O)>0&&A(`${O} : ${yd(V(O))}`)),A(`TOTAL produits : ${yd(C)}`,10,!0),E+=2,A("Cadre D — Charges",12,!0),A(`Rémunération formateurs : ${yd(Number(j.remuneration)||0)}`),A(`Sous-traitance : ${yd(Number(j.soustraitance)||0)}`),A(`Achats : ${yd(Number(j.achats)||0)}`),A(`Autres : ${yd(Number(j.autres)||0)}`),A(`TOTAL charges : ${yd(R)}`,10,!0),E+=2,A("Cadre E — Formateurs & heures dispensées",12,!0),A(`Formateurs : 1 (vous) Heures dispensées : ${k.totalHours} h`),E+=2,A("Cadre F — Stagiaires & heures-stagiaires",12,!0),A(`Heures-stagiaires : ${k.heuresStagiaires} Sessions : ${k.sessions}`),A(`Stagiaires (déclarés) : ${N||"—"} Dont distanciel : ${k.distancielHours} h`),Object.entries(k.byAction).forEach(([O,U])=>A(` ${O} : ${U.hours} h / ${Math.round(U.hs)} h-stagiaires`)),E+=4,K.setFontSize(8),K.setFont("helvetica","italic"),K.text("Valeurs à reporter sur Mon Activité Formation (saisie manuelle, écran par écran).",14,E),K.save(`BPF_${m}_${(x.raison_sociale||"formateur").replace(/[^a-z0-9]/gi,"_")}.pdf`)}catch(z){console.error(z),ae.error("Erreur lors de la génération du PDF")}};if(r||o)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});const M=({id:z,label:K,value:E})=>s.jsxs("div",{className:"flex items-center justify-between gap-2 py-1.5 border-b last:border-0",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:K}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:E}),s.jsx(ne,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>q(z,E),children:I===z?s.jsx(Pn,{className:"h-3.5 w-3.5 text-green-600"}):s.jsx(Qv,{className:"h-3.5 w-3.5"})})]})]});return s.jsx("div",{className:"min-h-screen bg-background py-10 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-4xl",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",children:"Assistant BPF"}),s.jsx("p",{className:"text-muted-foreground",children:"Préparez votre Bilan Pédagogique et Financier à partir de votre planning."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(We,{className:"text-sm",children:"Exercice"}),s.jsxs(Lr,{value:String(m),onValueChange:z=>h(Number(z)),children:[s.jsx(Ar,{className:"w-28",children:s.jsx(Br,{})}),s.jsx(Tr,{children:[0,1,2].map(z=>{const K=new Date().getFullYear()-z;return s.jsx(ot,{value:String(K),children:K},K)})})]})]})]}),s.jsx(ke,{className:"mb-6 border-amber-200 bg-amber-50",children:s.jsxs(Ae,{className:"py-3 text-sm text-amber-900",children:["⚠️ Le portail ",s.jsx("strong",{children:"Mon Activité Formation"})," n'accepte pas d'import : la saisie est manuelle, écran par écran, avant le ",s.jsx("strong",{children:"30 avril"}),". Cet outil calcule et structure vos chiffres pour une saisie rapide, et génère un PDF récapitulatif."]})}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-6",children:IT.map((z,K)=>{const E=z.icon;return s.jsxs("button",{type:"button",onClick:()=>f(K),className:`flex items-center gap-2 rounded-full px-3 py-1.5 text-sm border transition-colors ${K===d?"bg-primary text-primary-foreground border-primary":"hover:bg-muted"}`,children:[s.jsx(E,{className:"h-4 w-4"})," ",z.label]},z.key)})}),d===0&&s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Identité de l'organisme (cadres A/B)"}),s.jsx(Qr,{children:"Vos informations d'organisme de formation déclaré."})]}),s.jsxs(Ae,{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("label",{className:"flex items-center gap-2 text-sm sm:col-span-2",children:[s.jsx(Vo,{checked:x.is_of,onCheckedChange:z=>v({...x,is_of:!!z})}),"Je suis un organisme de formation déclaré (avec NDA)"]}),s.jsx(gc,{label:"Raison sociale",children:s.jsx(Ye,{value:x.raison_sociale,onChange:z=>v({...x,raison_sociale:z.target.value})})}),s.jsx(gc,{label:"SIRET",children:s.jsx(Ye,{value:x.siret,onChange:z=>v({...x,siret:z.target.value})})}),s.jsx(gc,{label:"N° de déclaration d'activité (NDA)",children:s.jsx(Ye,{value:x.nda,onChange:z=>v({...x,nda:z.target.value})})}),s.jsx(gc,{label:"Ville",children:s.jsx(Ye,{value:x.ville,onChange:z=>v({...x,ville:z.target.value})})}),s.jsx(gc,{label:"Adresse",children:s.jsx(Ye,{value:x.adresse,onChange:z=>v({...x,adresse:z.target.value})})}),s.jsx(gc,{label:"Code postal",children:s.jsx(Ye,{value:x.code_postal,onChange:z=>v({...x,code_postal:z.target.value})})}),s.jsx(gc,{label:"Exercice — début",children:s.jsx(Ye,{type:"date",value:x.exercice_start,onChange:z=>v({...x,exercice_start:z.target.value})})}),s.jsx(gc,{label:"Exercice — fin",children:s.jsx(Ye,{type:"date",value:x.exercice_end,onChange:z=>v({...x,exercice_end:z.target.value})})}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Vo,{checked:x.franchise_tva,onCheckedChange:z=>v({...x,franchise_tva:!!z})}),"Franchise en base de TVA"]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Vo,{checked:x.distanciel,onCheckedChange:z=>v({...x,distanciel:!!z})}),"Activité en distanciel"]})]})]}),d===1&&s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Données pédagogiques (cadres E & F)"}),s.jsxs(Qr,{children:["Calculées depuis votre planning ",m," (",k.sessions," séances)."]})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[s.jsx(lS,{label:"Heures dispensées",value:`${k.totalHours} h`}),s.jsx(lS,{label:"Heures-stagiaires",value:String(k.heuresStagiaires)}),s.jsx(lS,{label:"Séances",value:String(k.sessions)}),s.jsx(lS,{label:"Dont distanciel",value:`${k.distancielHours} h`})]}),s.jsxs("div",{children:[s.jsx(We,{className:"text-sm",children:"Nombre de stagiaires (à déclarer)"}),s.jsx(Ye,{className:"max-w-xs mt-1",type:"number",min:"0",value:N,onChange:z=>_(z.target.value),placeholder:"ex: 42"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Le nombre de stagiaires distincts ne peut être déduit automatiquement (un stagiaire suit plusieurs séances). À renseigner manuellement."})]}),s.jsx(Lu,{}),s.jsxs("div",{children:[s.jsx(We,{className:"text-sm mb-2 block",children:"Par type d'action"}),Object.entries(k.byAction).map(([z,K])=>s.jsxs("div",{className:"flex justify-between text-sm py-1 border-b last:border-0",children:[s.jsx("span",{children:z}),s.jsxs("span",{className:"text-muted-foreground",children:[K.hours," h · ",Math.round(K.hs)," h-stagiaires"]})]},z))]})]})]}),d===2&&s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Produits par financeur (cadre C)"}),s.jsx(Qr,{children:"Préremplis (heures × tarif horaire école) ; ajustez ou complétez à la main."})]}),s.jsxs(Ae,{className:"space-y-2",children:[Bx.map(z=>s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-sm",children:z}),s.jsxs("div",{className:"flex items-center gap-2",children:[k.revenueByFunder[z]>0&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["calculé ",yd(k.revenueByFunder[z])]}),s.jsx(Ye,{type:"number",min:"0",className:"w-36",value:b[z]??(k.revenueByFunder[z]?String(Math.round(k.revenueByFunder[z])):""),onChange:K=>y({...b,[z]:K.target.value})})]})]},z)),s.jsx(Lu,{}),s.jsxs("div",{className:"flex justify-between font-semibold pt-1",children:[s.jsx("span",{children:"Total produits"}),s.jsx("span",{children:yd(C)})]})]})]}),d===3&&s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Charges (cadre D)"}),s.jsx(Qr,{children:"Saisie manuelle."})]}),s.jsxs(Ae,{className:"grid sm:grid-cols-2 gap-4",children:[s.jsx(gc,{label:"Rémunération des formateurs (€)",children:s.jsx(Ye,{type:"number",value:j.remuneration,onChange:z=>S({...j,remuneration:z.target.value})})}),s.jsx(gc,{label:"Sous-traitance (€)",children:s.jsx(Ye,{type:"number",value:j.soustraitance,onChange:z=>S({...j,soustraitance:z.target.value})})}),s.jsx(gc,{label:"Achats / fournitures (€)",children:s.jsx(Ye,{type:"number",value:j.achats,onChange:z=>S({...j,achats:z.target.value})})}),s.jsx(gc,{label:"Autres charges (€)",children:s.jsx(Ye,{type:"number",value:j.autres,onChange:z=>S({...j,autres:z.target.value})})}),s.jsxs("div",{className:"sm:col-span-2 flex justify-between font-semibold",children:[s.jsx("span",{children:"Total charges"}),s.jsx("span",{children:yd(R)})]})]})]}),d===4&&s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Récapitulatif — à reporter sur Mon Activité Formation"}),s.jsx(Qr,{children:"Copiez chaque valeur dans l'écran correspondant du portail MAF."})]}),s.jsxs(Ae,{className:"space-y-5",children:[s.jsxs("section",{children:[s.jsx(Le,{variant:"outline",className:"mb-2",children:"Cadre C — Produits"}),Bx.filter(z=>V(z)>0).map(z=>s.jsx(M,{id:`c-${z}`,label:z,value:String(V(z))},z)),s.jsx(M,{id:"c-total",label:"Total produits",value:String(C)})]}),s.jsxs("section",{children:[s.jsx(Le,{variant:"outline",className:"mb-2",children:"Cadre E/F — Pédagogique"}),s.jsx(M,{id:"hours",label:"Heures dispensées",value:String(k.totalHours)}),s.jsx(M,{id:"hs",label:"Heures-stagiaires",value:String(k.heuresStagiaires)}),s.jsx(M,{id:"trainees",label:"Nombre de stagiaires",value:N||"—"}),s.jsx(M,{id:"dist",label:"Heures distanciel",value:String(k.distancielHours)})]}),s.jsxs("section",{children:[s.jsx(Le,{variant:"outline",className:"mb-2",children:"Cadre D — Charges"}),s.jsx(M,{id:"charges",label:"Total charges",value:String(R)})]}),s.jsxs("div",{className:"flex gap-2 pt-2",children:[s.jsxs(ne,{onClick:L,variant:"outline",children:[s.jsx(Ho,{className:"h-4 w-4 mr-2"}),"Télécharger le PDF récapitulatif"]}),s.jsxs(ne,{onClick:()=>H("ready"),disabled:c,children:[c?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Marquer comme prêt"]})]})]})]}),s.jsxs("div",{className:"flex items-center justify-between mt-6",children:[s.jsxs(ne,{variant:"outline",onClick:()=>f(Math.max(0,d-1)),disabled:d===0,children:[s.jsx(eC,{className:"h-4 w-4 mr-1"}),"Précédent"]}),s.jsxs(ne,{variant:"ghost",onClick:()=>H("draft"),disabled:c,children:[c?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Enregistrer le brouillon"]}),s.jsxs(ne,{onClick:()=>f(Math.min(IT.length-1,d+1)),disabled:d===IT.length-1,children:["Suivant",s.jsx(tu,{className:"h-4 w-4 ml-1"})]})]})]})})}function gc({label:e,children:t}){return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(We,{className:"text-sm",children:e}),t]})}function lS({label:e,value:t}){return s.jsxs("div",{className:"rounded-lg border bg-card p-3",children:[s.jsx("div",{className:"text-2xl font-bold",children:t}),s.jsx("div",{className:"text-xs text-muted-foreground",children:e})]})}const y7e="mailto:contact@qalamsoftware.com?subject=",b7e=[{name:"Gratuit",price:"0 €",period:"",highlight:!1,features:["Calendrier d'interventions (saisie manuelle)","Import Excel (assisté par IA)","Synchronisation Netypareo / Google (iCal)","Assistant BPF + récapitulatif PDF","Facture pré-remplie"],cta:{kind:"link",label:"Commencer",to:"/trainer/planning"}},{name:"Export avancé",price:"5 €",period:"/ mois",highlight:!0,features:["Tout le plan Gratuit","Exports avancés (Excel filtrés, formats personnalisés)","Envoi du planning par e-mail","Récapitulatifs périodiques"],cta:{kind:"checkout",label:"S'abonner",plan:"export"}},{name:"Agent attitré",price:"300 €",period:"/ mois",highlight:!1,features:["Tout le plan Export avancé","Un agent dédié gère votre planning","Saisie et mise à jour à votre place","Suivi prioritaire"],cta:{kind:"checkout",label:"S'abonner",plan:"agent"}},{name:"Sur-mesure",price:"Sur devis",period:"",highlight:!1,features:["Développement de fonctionnalités à la demande","Intégrations spécifiques (ERP, API école…)","Accompagnement dédié"],cta:{kind:"mailto",label:"Contactez-nous",href:`${y7e}Demande sur-mesure`}}];function w7e(){const{user:e}=Ur(),t=Xt(),[r,n]=w.useState(null),a=async i=>{if(!e){ae.info("Connectez-vous pour vous abonner"),t("/auth");return}n(i);try{const{data:o,error:l}=await he.functions.invoke("create-planning-checkout",{body:{plan:i}});if(l||o!=null&&o.error)throw new Error((o==null?void 0:o.error)||(l==null?void 0:l.message));if(o!=null&&o.url)window.location.href=o.url;else throw new Error("URL de paiement manquante")}catch(o){console.error(o),ae.error(`Paiement indisponible : ${o instanceof Error?o.message:"erreur"}`)}finally{n(null)}};return s.jsx("div",{className:"min-h-screen bg-background py-16 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsxs(Le,{variant:"outline",className:"mb-3",children:[s.jsx($O,{className:"h-3.5 w-3.5 mr-1"}),"Planning & BPF"]}),s.jsx("h1",{className:"text-4xl font-bold mb-3",children:"Tarifs Planning Formateur"}),s.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Le calendrier, l'import Excel, la synchronisation et l'assistant BPF sont gratuits. Passez à un plan supérieur pour les exports avancés ou un agent qui gère tout pour vous."})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6",children:b7e.map(i=>s.jsxs(ke,{className:i.highlight?"border-primary shadow-lg relative":"",children:[i.highlight&&s.jsx(Le,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Populaire"}),s.jsxs(ht,{children:[s.jsx(xt,{children:i.name}),s.jsxs(Qr,{children:[s.jsx("span",{className:"text-3xl font-bold text-foreground",children:i.price}),s.jsx("span",{className:"text-muted-foreground",children:i.period})]})]}),s.jsxs(Ae,{className:"flex flex-col h-full",children:[s.jsx("ul",{className:"space-y-2 mb-6 flex-1",children:i.features.map(o=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx(Pn,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}),s.jsx("span",{children:o})]},o))}),i.cta.kind==="link"&&s.jsx(ne,{asChild:!0,variant:i.highlight?"default":"outline",className:"w-full",children:s.jsx(vt,{to:i.cta.to,children:i.cta.label})}),i.cta.kind==="mailto"&&s.jsx(ne,{asChild:!0,variant:"outline",className:"w-full",children:s.jsxs("a",{href:i.cta.href,children:[s.jsx(Fn,{className:"h-4 w-4 mr-2"}),i.cta.label]})}),i.cta.kind==="checkout"&&s.jsxs(ne,{variant:i.highlight?"default":"outline",className:"w-full",disabled:r!==null,onClick:()=>a(i.cta.plan),children:[r===i.cta.plan?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):null,i.cta.label]})]})]},i.name))}),s.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-10",children:["Une question ou une idée ?"," ",s.jsx(vt,{to:"/feedback",className:"text-primary hover:underline",children:"Envoyez-nous un retour"}),"."]})]})})}const RT="mailto:contact@qalamsoftware.com?subject=",j7e=[{icon:gR,title:"Envoyez-nous vos recommandations",desc:"Une idée pour améliorer la plateforme ? Dites-nous tout.",href:`${RT}Recommandation PedagoBridge`,label:"Proposer une idée"},{icon:yve,title:"Signalez un bug",desc:"Quelque chose ne fonctionne pas comme prévu ? Signalez-le.",href:`${RT}Signalement de bug`,label:"Signaler un bug"},{icon:$ve,title:"Demandez-nous quelque chose",desc:"Une question, une demande particulière ? Écrivez-nous.",href:`${RT}Demande PedagoBridge`,label:"Poser une question"}];function _7e(){return s.jsx("div",{className:"min-h-screen bg-background py-16 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-3xl",children:[s.jsxs("div",{className:"text-center mb-10",children:[s.jsx("h1",{className:"text-4xl font-bold mb-3",children:"Votre avis compte"}),s.jsx("p",{className:"text-muted-foreground",children:"Aidez-nous à améliorer PedagoBridge. Choisissez ce qui vous correspond :"})]}),s.jsx("div",{className:"grid gap-4",children:j7e.map(e=>{const t=e.icon;return s.jsx(ke,{className:"hover:shadow-md transition-shadow",children:s.jsxs(ht,{className:"flex flex-row items-center gap-4 space-y-0",children:[s.jsx("div",{className:"rounded-lg bg-primary/10 p-3",children:s.jsx(t,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx(xt,{className:"text-lg",children:e.title}),s.jsx(Qr,{children:e.desc})]}),s.jsx(ne,{asChild:!0,children:s.jsx("a",{href:e.href,children:e.label})})]})},e.title)})}),s.jsx("div",{className:"text-center mt-10",children:s.jsx(ne,{asChild:!0,variant:"outline",children:s.jsxs("a",{href:"https://pedagobridge.com",target:"_blank",rel:"noopener noreferrer",children:[s.jsx(vs,{className:"h-4 w-4 mr-2"}),"Visiter pedagobridge.com"]})})})]})})}const LT=10,N7e=59;function lle(){const[e,t]=w.useState(0),[r,n]=w.useState(!0),[a,i]=w.useState(!0),[o,l]=w.useState(!1);w.useEffect(()=>{c()},[]);const c=async()=>{try{const{data:{user:d}}=await he.auth.getUser();if(!d){i(!0),n(!1);return}const{data:f}=await he.from("school_profiles").select("is_affiliated").eq("user_id",d.id).single(),m=(f==null?void 0:f.is_affiliated)||!1;if(l(m),m){i(!0),t(0),n(!1);return}const{data:h,error:g}=await he.from("school_requests").select("id",{count:"exact"}).eq("user_id",d.id).in("status",["pending","approved"]);if(g)throw g;const p=(h==null?void 0:h.length)||0;t(p),i(p<LT)}catch(d){console.error("Error checking publication count:",d),i(!0)}finally{n(!1)}};return{publicationCount:e,canPublish:a,loading:r,refreshCount:()=>{n(!0),c()},freeLimit:LT,pricePerPublication:N7e,remainingFree:o?1/0:Math.max(0,LT-e),isAffiliated:o}}function cle({publicationCount:e,pricePerPublication:t}){const r=()=>{window.location.href=`mailto:contact@example.com?subject=Demande de paiement pour publication&body=Bonjour,%0A%0AJe souhaite publier une nouvelle offre de formation.%0A%0ANombre de publications actuelles: ${e}%0AMontant à régler: ${t}€%0A%0ACordialement`};return s.jsxs(ke,{className:"border-destructive/50 bg-destructive/5",children:[s.jsxs(ht,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Di,{className:"h-6 w-6 text-destructive"}),s.jsx(xt,{className:"text-destructive",children:"Paiement requis"})]}),s.jsx(Qr,{children:"Vous avez atteint la limite de 2 publications gratuites"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"bg-background rounded-lg p-4 border",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Publications actuelles"}),s.jsx("span",{className:"font-bold",children:e})]}),s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Publications gratuites"}),s.jsx("span",{className:"font-bold",children:"2"})]}),s.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[s.jsx("span",{className:"text-sm font-medium",children:"Prix par publication supplémentaire"}),s.jsxs("span",{className:"text-lg font-bold text-primary",children:[t,"€"]})]})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Pour publier de nouvelles offres, veuillez effectuer le paiement. Contactez-nous pour procéder au règlement."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[s.jsxs(ne,{onClick:r,className:"flex-1",children:[s.jsx(Fn,{className:"mr-2 h-4 w-4"}),"Contacter pour payer"]}),s.jsxs(ne,{variant:"outline",className:"flex-1",disabled:!0,children:[s.jsx(kve,{className:"mr-2 h-4 w-4"}),"Paiement en ligne (bientôt)"]})]})]})]})}const S7e=Mg({schoolName:pn().min(2,"doit contenir au moins 2 caractères"),contactName:pn().min(2,"doit contenir au moins 2 caractères"),contactEmail:pn().email("doit être un email valide"),additionalNotes:pn().optional(),city:pn().optional(),address:pn().optional(),contactPhone:pn().optional(),contactPosition:pn().optional()}),k7e={schoolName:"Le nom de l'établissement",contactName:"Le nom du contact",contactEmail:"L'email du contact",additionalNotes:"Les notes",city:"La ville",address:"L'adresse",contactPhone:"Le téléphone",contactPosition:"Le poste"},C7e=["Syllabus","Description du besoin","Planning","Cahier des charges","Autre"];function E7e(){const e=Xt(),{user:t,isSchool:r}=Ur(),[n,a]=w.useState(!1),[i,o]=w.useState(!1),[l,c]=w.useState(""),{canPublish:u,publicationCount:d,loading:f,pricePerPublication:m,remainingFree:h,freeLimit:g}=lle(),[p,x]=w.useState(!1),[v,b]=w.useState(null),[y,N]=w.useState(null),[_,j]=w.useState("school"),[S,I]=w.useState(""),[P,F]=w.useState(""),[T,k]=w.useState(""),[V,C]=w.useState(""),[R,H]=w.useState(""),[q,L]=w.useState(""),[M,z]=w.useState(""),[K,E]=w.useState([]),[A,O]=w.useState(""),[U,Y]=w.useState(""),[J,se]=w.useState([]),[ee,ie]=w.useState(""),[Ee,te]=w.useState(null),[Ue,W]=w.useState(!1);w.useEffect(()=>{const Re=new URLSearchParams(window.location.search),Me=Re.get("from_trainer"),He=Re.get("trainer_name");Me&&(b(Me),He&&N(decodeURIComponent(He)),window.history.replaceState({},"","/training-request"))},[]),w.useEffect(()=>{(async()=>{if(!(!t||!r))try{const{data:Me,error:He}=await he.from("school_profiles").select("*").eq("user_id",t.id).single();if(He||!Me)return;W(Me.can_auto_publish||!1),Me.name&&I(Me.name),Me.address&&k(Me.address),Me.contact_name&&C(Me.contact_name),Me.contact_email&&H(Me.contact_email),Me.contact_phone&&L(Me.contact_phone),!Me.contact_email&&t.email&&H(t.email)}catch(Me){console.error("Error fetching school profile:",Me)}})()},[t,r]),w.useEffect(()=>{if(new URLSearchParams(window.location.search).get("source")==="linkedin"){const Me=sessionStorage.getItem("linkedInOfferData");if(Me)try{const He=JSON.parse(Me);if(He.school_name&&I(He.school_name),He.city&&F(He.city),He.description&&Y(He.description),He.contact_name&&C(He.contact_name),He.contact_email&&H(He.contact_email),He.subject_areas&&Array.isArray(He.subject_areas)){const st=He.subject_areas.map((Zt,_t)=>({id:`imported-${_t}-${Date.now()}`,name:Zt,expanded:!0,startDate:_t===0?He.start_date:void 0,endDate:_t===0?He.end_date:void 0,durationHours:_t===0&&He.duration_hours?He.duration_hours.toString():void 0,modality:He.modality||"presentiel",visibility:"public",documents:[]}));E(st)}x(!0),sessionStorage.removeItem("linkedInOfferData"),ae.success("Données LinkedIn importées !",{duration:3e3})}catch(He){console.error("Error parsing LinkedIn data:",He)}window.history.replaceState({},"","/training-request")}},[]);const Z=()=>({schoolName:S,contactName:V,contactEmail:R,additionalNotes:U,city:P,address:T,contactPhone:q,contactPosition:M}),{getFieldError:le,validateAll:re,handleBlur:oe,clearFieldError:fe}=CL({schema:S7e,fieldLabels:k7e}),Fe=Re=>{oe(Re,Z()[Re],Z())},ge=()=>{if(A.trim()&&!K.some(Re=>Re.name===A.trim())){const Re=K[K.length-1],Me={id:`need-${Date.now()}`,name:A.trim(),expanded:!0,modality:(Re==null?void 0:Re.modality)||"presentiel",visibility:(Re==null?void 0:Re.visibility)||"public",documents:[]};E([...K,Me]),O("")}},pe=Re=>{E(K.filter(Me=>Me.id!==Re))},Ie=(Re,Me)=>{E(K.map(He=>He.id===Re?{...He,...Me}:He))},Ge=Re=>{E(K.map(Me=>Me.id===Re?{...Me,expanded:!Me.expanded}:Me))},we=(Re,Me)=>{E(K.map(He=>He.id===Re?{...He,documents:[...He.documents,Me]}:He))},_e=(Re,Me)=>{E(K.map(He=>He.id===Re?{...He,documents:He.documents.filter((st,Zt)=>Zt!==Me)}:He))},qe=async Re=>{if(Re.preventDefault(),!re(Z())){ae.error("Veuillez corriger les champs en erreur");return}let Me=[...K];if(A.trim()&&!K.some(He=>He.name===A.trim())&&Me.push({id:`need-${Date.now()}`,name:A.trim(),expanded:!1,documents:[]}),Me.length===0){ae.error("Ajoutez au moins un besoin en formation");return}for(const He of Me)if(!He.startDate||!He.endDate||!He.durationHours){ae.error(`Veuillez compléter les détails obligatoires pour "${He.name}" (dates et durée)`);return}a(!0);try{const He=[];for(const Mt of Me)for(const wr of Mt.documents)if(wr.file){const $t=`${Date.now()}-${wr.file.name}`,{data:kt,error:dr}=await he.storage.from("school-attachments").upload($t,wr.file);if(dr)throw dr;const{data:{publicUrl:Kt}}=he.storage.from("school-attachments").getPublicUrl(kt.path);He.push({type:wr.type,name:wr.name,url:Kt,needName:Mt.name})}for(const Mt of J)if(Mt.file){const wr=`${Date.now()}-${Mt.file.name}`,{data:$t,error:kt}=await he.storage.from("school-attachments").upload(wr,Mt.file);if(kt)throw kt;const{data:{publicUrl:dr}}=he.storage.from("school-attachments").getPublicUrl($t.path);He.push({type:Mt.type,name:Mt.name,url:dr})}const st=Me[0],Zt=(st==null?void 0:st.startDate)||null,_t=(st==null?void 0:st.endDate)||null,Vt=st!=null&&st.durationHours?parseInt(st.durationHours):null,Jt=st!=null&&st.tjmOffered?parseFloat(st.tjmOffered):null,Qt=(st==null?void 0:st.modality)||"presentiel",qt=(st==null?void 0:st.visibility)||"public",it=v?`Demande initiée depuis le profil du formateur: ${y||v}`:null,{error:It}=await he.from("school_requests").insert({school_name:S.trim(),city:P.trim()||null,address:T.trim()||null,modality:Qt,contact_name:V.trim(),contact_email:R.trim(),contact_phone:q.trim()||null,contact_position:M.trim()||null,training_needs:Me.map(Mt=>Mt.name),subject_areas:Me.map(Mt=>Mt.name),start_date:Zt,end_date:_t,duration_hours:Vt,num_trainers:1,tjm_offered:Jt,description:U.trim()||null,documents:He,status:r&&t&&Ue?"approved":"pending",user_id:r&&t?t.id:null,notes:it,visibility:qt});if(It)throw It;r&&t&&Ue?ae.success("Offre publiée automatiquement !"):ae.info("Votre demande a été envoyée et sera validée par notre équipe sous 48h",{duration:5e3});try{await he.functions.invoke("notify-school-request",{body:{schoolName:S.trim(),contactName:V.trim(),contactEmail:R.trim(),contactPhone:q.trim()||void 0,contactPosition:M.trim()||void 0,trainingNeeds:Me.map(Mt=>Mt.name),startDate:Zt||void 0,endDate:_t||void 0,durationHours:Vt||void 0,description:U.trim()||void 0}})}catch(Mt){console.error("Error sending notification email:",Mt)}c(R.trim()),o(!0),ae.success("Demande envoyée avec succès !")}catch(He){console.error("Error submitting request:",He),ae.error("Erreur lors de l'envoi de la demande")}finally{a(!1)}};return i?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsx(ke,{className:"w-full max-w-md text-center",children:s.jsxs(Ae,{className:"pt-12 pb-8",children:[s.jsx(ma,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),s.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Votre demande a bien été prise en compte !"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Nous la traiterons dans les plus brefs délais."}),s.jsxs("div",{className:"bg-muted/50 p-4 rounded-lg mb-6 text-left",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:s.jsx("strong",{className:"text-foreground",children:"Prochaines étapes :"})}),s.jsxs("ul",{className:"text-sm text-muted-foreground mt-2 space-y-1 list-disc list-inside",children:[s.jsx("li",{children:"Validation de votre demande par notre équipe (sous 48h)"}),s.jsx("li",{children:"Publication de l'offre auprès de nos formateurs"}),s.jsx("li",{children:"Réception des candidatures de formateurs qualifiés"})]})]}),!t&&s.jsxs("div",{className:"mb-6 p-4 bg-primary/5 border border-primary/20 rounded-lg",children:[s.jsx(IB,{className:"w-8 h-8 text-primary mx-auto mb-2"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Créez un compte établissement pour suivre vos demandes, gérer les candidatures et accéder à toutes nos fonctionnalités."}),s.jsxs(ne,{onClick:()=>e(`/school-register?email=${encodeURIComponent(l)}`),variant:"default",className:"w-full",children:[s.jsx(IB,{className:"mr-2 h-4 w-4"}),"Créer mon compte établissement"]})]}),s.jsx(ne,{onClick:()=>e("/"),variant:t?"default":"outline",className:"w-full",children:"Retour à l'accueil"})]})})}):f?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background py-12 px-4",children:[s.jsx(gr,{title:"Demande de Formation",description:"Faites votre demande de formation et trouvez le formateur idéal pour votre établissement ou entreprise.",url:"/training-request",keywords:["demande formation","recherche formateur","formation sur mesure"]}),s.jsxs("div",{className:"container mx-auto max-w-3xl",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>e("/"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour à l'accueil"]}),h>0&&d>0&&s.jsx(ke,{className:"mb-6 border-primary/20 bg-primary/5",children:s.jsx(Ae,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Di,{className:"h-5 w-5 text-primary"}),s.jsxs("p",{className:"text-sm",children:[s.jsxs("span",{className:"font-medium",children:[h," publication",h>1?"s":""," gratuite",h>1?"s":""," restante",h>1?"s":""]})," ","sur ",g,". Au-delà, chaque publication coûte ",m,"€."]})]})})}),!u&&s.jsx("div",{className:"mb-6",children:s.jsx(cle,{publicationCount:d,pricePerPublication:m})}),s.jsxs(ke,{className:u?"":"opacity-50 pointer-events-none",children:[s.jsx(ht,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(xt,{className:"text-3xl",children:"Demande de Formation"}),s.jsx(Qr,{children:"Décrivez vos besoins en formation et nous vous contacterons rapidement"})]}),p&&s.jsxs(Le,{variant:"secondary",className:"flex items-center gap-1 bg-[#0077B5]/10 text-[#0077B5] border-[#0077B5]/20",children:[s.jsx(Mu,{className:"h-3 w-3"}),"Importé depuis LinkedIn"]})]})}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:qe,className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx(We,{children:"Type d'organisation *"}),s.jsxs($0,{value:_,onValueChange:Re=>j(Re),className:"flex gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ro,{value:"school",id:"school"}),s.jsx(We,{htmlFor:"school",className:"cursor-pointer font-normal",children:"Établissement scolaire"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ro,{value:"company",id:"company"}),s.jsx(We,{htmlFor:"company",className:"cursor-pointer font-normal",children:"Société / Entreprise"})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:_==="school"?"Informations de l'établissement":"Informations de l'entreprise"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsx(Hi,{id:"schoolName",label:_==="school"?"Nom de l'établissement":"Nom de l'entreprise",value:S,onChange:Re=>{I(Re.target.value),fe("schoolName")},onFieldBlur:()=>Fe("schoolName"),placeholder:_==="school"?"Lycée Victor Hugo":"Société ABC",required:!0,error:le("schoolName")}),s.jsx(Hi,{id:"city",label:"Ville",value:P,onChange:Re=>{F(Re.target.value),fe("city")},onFieldBlur:()=>Fe("city"),placeholder:"Paris, Lyon, Marseille...",error:le("city")})]}),s.jsx(Hi,{id:"address",label:"Adresse de l'établissement",value:T,onChange:Re=>{k(Re.target.value),fe("address")},onFieldBlur:()=>Fe("address"),placeholder:"123 rue de l'École, 75001 Paris",error:le("address")})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Informations du contact"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsx(Hi,{id:"contactName",label:"Nom du contact",value:V,onChange:Re=>{C(Re.target.value),fe("contactName")},onFieldBlur:()=>Fe("contactName"),placeholder:"Jean Dupont",required:!0,error:le("contactName")}),s.jsx(Hi,{id:"contactPosition",label:"Poste",value:M,onChange:Re=>z(Re.target.value),placeholder:_==="school"?"Directeur pédagogique":"Responsable RH / Formation"})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsx(Hi,{id:"contactEmail",type:"email",label:"Email",value:R,onChange:Re=>{H(Re.target.value),fe("contactEmail")},onFieldBlur:()=>Fe("contactEmail"),placeholder:"jean.dupont@lycee.fr",required:!0,error:le("contactEmail")}),s.jsx(Hi,{id:"contactPhone",type:"tel",label:"Téléphone",value:q,onChange:Re=>L(Re.target.value),placeholder:"+33 6 12 34 56 78"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:_==="school"?"Besoins en formation *":"Objectifs de formation *"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:_==="school"?"Ajoutez vos besoins spécifiques en formation":"Décrivez les compétences à développer pour vos collaborateurs"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{value:A,onChange:Re=>O(Re.target.value),onKeyPress:Re=>{Re.key==="Enter"&&(Re.preventDefault(),ge())},placeholder:_==="school"?"Ex: Formation en mathématiques appliquées":"Ex: Leadership et management d'équipe"}),s.jsxs(ne,{type:"button",onClick:ge,variant:"secondary",className:"shrink-0",children:[s.jsx(Ya,{className:"h-4 w-4 mr-1"}),"Ajouter"]})]}),K.length>0&&s.jsx("div",{className:"space-y-3",children:K.map(Re=>s.jsxs("div",{className:"border rounded-lg p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("span",{className:"font-medium",children:Re.name}),!Re.expanded&&(Re.startDate||Re.durationHours||Re.modality)&&s.jsxs("div",{className:"flex flex-wrap gap-2 mt-1",children:[Re.startDate&&Re.endDate&&s.jsxs(Le,{variant:"outline",className:"text-xs font-normal",children:[new Date(Re.startDate).toLocaleDateString("fr-FR",{day:"numeric",month:"short"})," - ",new Date(Re.endDate).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"})]}),Re.durationHours&&s.jsxs(Le,{variant:"outline",className:"text-xs font-normal",children:[Re.durationHours,"h"]}),Re.modality&&s.jsx(Le,{variant:"secondary",className:"text-xs font-normal",children:Re.modality==="presentiel"?"Présentiel":Re.modality==="distanciel"?"Distanciel":"Hybride"}),Re.tjmOffered&&s.jsxs(Le,{variant:"outline",className:"text-xs font-normal",children:[Re.tjmOffered,"€/jour"]}),Re.visibility==="platform_only"&&s.jsx(Le,{variant:"secondary",className:"text-xs font-normal",children:"Formateurs inscrits"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ge(Re.id),className:"h-8 px-2",children:[s.jsx(Ya,{className:`h-4 w-4 transition-transform ${Re.expanded?"rotate-45":""}`}),s.jsx("span",{className:"ml-1 text-xs",children:"Détails"}),s.jsx(bh,{className:`ml-1 h-3 w-3 transition-transform ${Re.expanded?"rotate-180":""}`})]}),s.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>pe(Re.id),children:s.jsx(Ri,{className:"h-4 w-4 text-destructive"})})]})]}),Re.expanded&&s.jsxs("div",{className:"space-y-4 pt-2 border-t",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Modalité *"}),s.jsxs($0,{value:Re.modality||"presentiel",onValueChange:Me=>Ie(Re.id,{modality:Me}),className:"flex flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Ro,{value:"presentiel",id:`modality-presentiel-${Re.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`modality-presentiel-${Re.id}`,className:"cursor-pointer font-normal text-xs",children:"Présentiel"})]}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Ro,{value:"distanciel",id:`modality-distanciel-${Re.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`modality-distanciel-${Re.id}`,className:"cursor-pointer font-normal text-xs",children:"Distanciel"})]}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Ro,{value:"hybride",id:`modality-hybride-${Re.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`modality-hybride-${Re.id}`,className:"cursor-pointer font-normal text-xs",children:"Hybride"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Visibilité *"}),s.jsxs($0,{value:Re.visibility||"public",onValueChange:Me=>Ie(Re.id,{visibility:Me}),className:"flex flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Ro,{value:"public",id:`visibility-public-${Re.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`visibility-public-${Re.id}`,className:"cursor-pointer font-normal text-xs",children:"Publique"})]}),s.jsxs("div",{className:"flex items-center space-x-1",children:[s.jsx(Ro,{value:"platform_only",id:`visibility-platform-${Re.id}`,className:"h-3 w-3"}),s.jsx(We,{htmlFor:`visibility-platform-${Re.id}`,className:"cursor-pointer font-normal text-xs",children:"Formateurs inscrits"})]})]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Date de début *"}),s.jsx(Ye,{type:"date",value:Re.startDate||"",onChange:Me=>Ie(Re.id,{startDate:Me.target.value}),min:new Date().toISOString().split("T")[0],className:"h-9"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Date de fin *"}),s.jsx(Ye,{type:"date",value:Re.endDate||"",onChange:Me=>Ie(Re.id,{endDate:Me.target.value}),min:Re.startDate||new Date().toISOString().split("T")[0],className:"h-9"})]})]}),s.jsx("div",{className:"grid md:grid-cols-2 gap-3",children:s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"Durée totale (heures) *"}),s.jsx(Ye,{type:"number",min:"1",value:Re.durationHours||"",onChange:Me=>Ie(Re.id,{durationHours:Me.target.value}),placeholder:"40",className:"h-9",required:!0})]})}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{className:"text-xs",children:"TJM proposé (€/jour)"}),s.jsx(Ye,{type:"number",min:"0",step:"10",value:Re.tjmOffered||"",onChange:Me=>Ie(Re.id,{tjmOffered:Me.target.value}),placeholder:"400",className:"h-9"}),s.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Ce montant sera visible sur l'offre. Si vous choisissez un formateur certifié PedagoBridge, nous prenons en charge la facturation, le syllabus et le suivi. Sinon, aucune garantie ne peut être fournie par PedagoBridge."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{className:"text-xs",children:"Documents"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Lr,{value:ee,onValueChange:ie,children:[s.jsx(Ar,{className:"bg-background h-9 flex-1",children:s.jsx(Br,{placeholder:"Type"})}),s.jsx(Tr,{className:"bg-popover z-50",children:C7e.map(Me=>s.jsx(ot,{value:Me,children:Me},Me))})]}),s.jsx(Ye,{type:"file",onChange:Me=>{var st;const He=(st=Me.target.files)==null?void 0:st[0];if(He&&ee){if(He.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}we(Re.id,{type:ee,name:He.name,url:"",file:He}),ie(""),Me.target.value=""}else ee||ae.error("Sélectionnez d'abord un type de document")},accept:".pdf,.doc,.docx,.xls,.xlsx,.txt",className:"h-9 flex-1"})]}),Re.documents.length>0&&s.jsx("div",{className:"space-y-1",children:Re.documents.map((Me,He)=>s.jsxs("div",{className:"flex items-center justify-between p-2 bg-muted rounded text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gt,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{children:[Me.type,": ",Me.name]})]}),s.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>_e(Re.id,He),children:s.jsx(Ri,{className:"h-3 w-3"})})]},He))})]})]})]},Re.id))})]}),s.jsx(BC,{id:"additionalNotes",label:"Autre chose à nous dire ?",value:U,onChange:Re=>{Y(Re.target.value),fe("additionalNotes")},onFieldBlur:()=>Fe("additionalNotes"),placeholder:"Informations complémentaires, contraintes particulières, questions...",rows:4,error:le("additionalNotes")}),s.jsx(ne,{type:"submit",className:"w-full",size:"lg",disabled:n,children:n?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-5 w-5 animate-spin"}),"Envoi en cours..."]}):"Envoyer la demande"})]})})]})]})]})}function A7e(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const T7e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,P7e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,O7e={};function Tq(e,t){return(O7e.jsx?P7e:T7e).test(e)}const D7e=/[ \t\n\f\r]/g;function I7e(e){return typeof e=="object"?e.type==="text"?Pq(e.value):!1:Pq(e)}function Pq(e){return e.replace(D7e,"")===""}class o_{constructor(t,r,n){this.normal=r,this.property=t,n&&(this.space=n)}}o_.prototype.normal={};o_.prototype.property={};o_.prototype.space=void 0;function ule(e,t){const r={},n={};for(const a of e)Object.assign(r,a.property),Object.assign(n,a.normal);return new o_(r,n,t)}function f8(e){return e.toLowerCase()}class jl{constructor(t,r){this.attribute=r,this.property=t}}jl.prototype.attribute="";jl.prototype.booleanish=!1;jl.prototype.boolean=!1;jl.prototype.commaOrSpaceSeparated=!1;jl.prototype.commaSeparated=!1;jl.prototype.defined=!1;jl.prototype.mustUseProperty=!1;jl.prototype.number=!1;jl.prototype.overloadedBoolean=!1;jl.prototype.property="";jl.prototype.spaceSeparated=!1;jl.prototype.space=void 0;let R7e=0;const cn=zg(),za=zg(),h8=zg(),Pt=zg(),js=zg(),Sv=zg(),Dl=zg();function zg(){return 2**++R7e}const m8=Object.freeze(Object.defineProperty({__proto__:null,boolean:cn,booleanish:za,commaOrSpaceSeparated:Dl,commaSeparated:Sv,number:Pt,overloadedBoolean:h8,spaceSeparated:js},Symbol.toStringTag,{value:"Module"})),FT=Object.keys(m8);class lF extends jl{constructor(t,r,n,a){let i=-1;if(super(t,r),Oq(this,"space",a),typeof n=="number")for(;++i<FT.length;){const o=FT[i];Oq(this,FT[i],(n&m8[o])===m8[o])}}}lF.prototype.defined=!0;function Oq(e,t,r){r&&(e[t]=r)}function g1(e){const t={},r={};for(const[n,a]of Object.entries(e.properties)){const i=new lF(n,e.transform(e.attributes||{},n),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(i.mustUseProperty=!0),t[n]=i,r[f8(n)]=n,r[f8(i.attribute)]=n}return new o_(t,r,e.space)}const dle=g1({properties:{ariaActiveDescendant:null,ariaAtomic:za,ariaAutoComplete:null,ariaBusy:za,ariaChecked:za,ariaColCount:Pt,ariaColIndex:Pt,ariaColSpan:Pt,ariaControls:js,ariaCurrent:null,ariaDescribedBy:js,ariaDetails:null,ariaDisabled:za,ariaDropEffect:js,ariaErrorMessage:null,ariaExpanded:za,ariaFlowTo:js,ariaGrabbed:za,ariaHasPopup:null,ariaHidden:za,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:js,ariaLevel:Pt,ariaLive:null,ariaModal:za,ariaMultiLine:za,ariaMultiSelectable:za,ariaOrientation:null,ariaOwns:js,ariaPlaceholder:null,ariaPosInSet:Pt,ariaPressed:za,ariaReadOnly:za,ariaRelevant:null,ariaRequired:za,ariaRoleDescription:js,ariaRowCount:Pt,ariaRowIndex:Pt,ariaRowSpan:Pt,ariaSelected:za,ariaSetSize:Pt,ariaSort:null,ariaValueMax:Pt,ariaValueMin:Pt,ariaValueNow:Pt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function fle(e,t){return t in e?e[t]:t}function hle(e,t){return fle(e,t.toLowerCase())}const L7e=g1({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Sv,acceptCharset:js,accessKey:js,action:null,allow:null,allowFullScreen:cn,allowPaymentRequest:cn,allowUserMedia:cn,alt:null,as:null,async:cn,autoCapitalize:null,autoComplete:js,autoFocus:cn,autoPlay:cn,blocking:js,capture:null,charSet:null,checked:cn,cite:null,className:js,cols:Pt,colSpan:null,content:null,contentEditable:za,controls:cn,controlsList:js,coords:Pt|Sv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:cn,defer:cn,dir:null,dirName:null,disabled:cn,download:h8,draggable:za,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:cn,formTarget:null,headers:js,height:Pt,hidden:h8,high:Pt,href:null,hrefLang:null,htmlFor:js,httpEquiv:js,id:null,imageSizes:null,imageSrcSet:null,inert:cn,inputMode:null,integrity:null,is:null,isMap:cn,itemId:null,itemProp:js,itemRef:js,itemScope:cn,itemType:js,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:cn,low:Pt,manifest:null,max:null,maxLength:Pt,media:null,method:null,min:null,minLength:Pt,multiple:cn,muted:cn,name:null,nonce:null,noModule:cn,noValidate:cn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:cn,optimum:Pt,pattern:null,ping:js,placeholder:null,playsInline:cn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:cn,referrerPolicy:null,rel:js,required:cn,reversed:cn,rows:Pt,rowSpan:Pt,sandbox:js,scope:null,scoped:cn,seamless:cn,selected:cn,shadowRootClonable:cn,shadowRootDelegatesFocus:cn,shadowRootMode:null,shape:null,size:Pt,sizes:null,slot:null,span:Pt,spellCheck:za,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Pt,step:null,style:null,tabIndex:Pt,target:null,title:null,translate:null,type:null,typeMustMatch:cn,useMap:null,value:za,width:Pt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:js,axis:null,background:null,bgColor:null,border:Pt,borderColor:null,bottomMargin:Pt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:cn,declare:cn,event:null,face:null,frame:null,frameBorder:null,hSpace:Pt,leftMargin:Pt,link:null,longDesc:null,lowSrc:null,marginHeight:Pt,marginWidth:Pt,noResize:cn,noHref:cn,noShade:cn,noWrap:cn,object:null,profile:null,prompt:null,rev:null,rightMargin:Pt,rules:null,scheme:null,scrolling:za,standby:null,summary:null,text:null,topMargin:Pt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Pt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:cn,disableRemotePlayback:cn,prefix:null,property:null,results:Pt,security:null,unselectable:null},space:"html",transform:hle}),F7e=g1({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Dl,accentHeight:Pt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Pt,amplitude:Pt,arabicForm:null,ascent:Pt,attributeName:null,attributeType:null,azimuth:Pt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Pt,by:null,calcMode:null,capHeight:Pt,className:js,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Pt,diffuseConstant:Pt,direction:null,display:null,dur:null,divisor:Pt,dominantBaseline:null,download:cn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Pt,enableBackground:null,end:null,event:null,exponent:Pt,externalResourcesRequired:null,fill:null,fillOpacity:Pt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Sv,g2:Sv,glyphName:Sv,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Pt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Pt,horizOriginX:Pt,horizOriginY:Pt,id:null,ideographic:Pt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Pt,k:Pt,k1:Pt,k2:Pt,k3:Pt,k4:Pt,kernelMatrix:Dl,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Pt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Pt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Pt,overlineThickness:Pt,paintOrder:null,panose1:null,path:null,pathLength:Pt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:js,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Pt,pointsAtY:Pt,pointsAtZ:Pt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Dl,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Dl,rev:Dl,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Dl,requiredFeatures:Dl,requiredFonts:Dl,requiredFormats:Dl,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Pt,specularExponent:Pt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Pt,strikethroughThickness:Pt,string:null,stroke:null,strokeDashArray:Dl,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Pt,strokeOpacity:Pt,strokeWidth:null,style:null,surfaceScale:Pt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Dl,tabIndex:Pt,tableValues:null,target:null,targetX:Pt,targetY:Pt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Dl,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Pt,underlineThickness:Pt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Pt,values:null,vAlphabetic:Pt,vMathematical:Pt,vectorEffect:null,vHanging:Pt,vIdeographic:Pt,version:null,vertAdvY:Pt,vertOriginX:Pt,vertOriginY:Pt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Pt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fle}),mle=g1({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ple=g1({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hle}),gle=g1({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),M7e={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},$7e=/[A-Z]/g,Dq=/-[a-z]/g,B7e=/^data[-\w.:]+$/i;function z7e(e,t){const r=f8(t);let n=t,a=jl;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&B7e.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Dq,q7e);n="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Dq.test(i)){let o=i.replace($7e,U7e);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}a=lF}return new a(n,t)}function U7e(e){return"-"+e.toLowerCase()}function q7e(e){return e.charAt(1).toUpperCase()}const V7e=ule([dle,L7e,mle,ple,gle],"html"),cF=ule([dle,F7e,mle,ple,gle],"svg");function W7e(e){return e.join(" ").trim()}var uF={},Iq=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,H7e=/\n/g,G7e=/^\s*/,K7e=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Y7e=/^:\s*/,X7e=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Z7e=/^[;\s]*/,J7e=/^\s+|\s+$/g,Q7e=`
`,Rq="/",Lq="*",p0="",e$e="comment",t$e="declaration";function r$e(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function a(g){var p=g.match(H7e);p&&(r+=p.length);var x=g.lastIndexOf(Q7e);n=~x?g.length-x:n+g.length}function i(){var g={line:r,column:n};return function(p){return p.position=new o(g),u(),p}}function o(g){this.start=g,this.end={line:r,column:n},this.source=t.source}o.prototype.content=e;function l(g){var p=new Error(t.source+":"+r+":"+n+": "+g);if(p.reason=g,p.filename=t.source,p.line=r,p.column=n,p.source=e,!t.silent)throw p}function c(g){var p=g.exec(e);if(p){var x=p[0];return a(x),e=e.slice(x.length),p}}function u(){c(G7e)}function d(g){var p;for(g=g||[];p=f();)p!==!1&&g.push(p);return g}function f(){var g=i();if(!(Rq!=e.charAt(0)||Lq!=e.charAt(1))){for(var p=2;p0!=e.charAt(p)&&(Lq!=e.charAt(p)||Rq!=e.charAt(p+1));)++p;if(p+=2,p0===e.charAt(p-1))return l("End of comment missing");var x=e.slice(2,p-2);return n+=2,a(x),e=e.slice(p),n+=2,g({type:e$e,comment:x})}}function m(){var g=i(),p=c(K7e);if(p){if(f(),!c(Y7e))return l("property missing ':'");var x=c(X7e),v=g({type:t$e,property:Fq(p[0].replace(Iq,p0)),value:x?Fq(x[0].replace(Iq,p0)):p0});return c(Z7e),v}}function h(){var g=[];d(g);for(var p;p=m();)p!==!1&&(g.push(p),d(g));return g}return u(),h()}function Fq(e){return e?e.replace(J7e,p0):p0}var n$e=r$e,s$e=Fc&&Fc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(uF,"__esModule",{value:!0});uF.default=i$e;const a$e=s$e(n$e);function i$e(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,a$e.default)(e),a=typeof t=="function";return n.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;a?t(o,l,i):l&&(r=r||{},r[o]=l)}),r}var iE={};Object.defineProperty(iE,"__esModule",{value:!0});iE.camelCase=void 0;var o$e=/^--[a-zA-Z0-9_-]+$/,l$e=/-([a-z])/g,c$e=/^[^-]+$/,u$e=/^-(webkit|moz|ms|o|khtml)-/,d$e=/^-(ms)-/,f$e=function(e){return!e||c$e.test(e)||o$e.test(e)},h$e=function(e,t){return t.toUpperCase()},Mq=function(e,t){return"".concat(t,"-")},m$e=function(e,t){return t===void 0&&(t={}),f$e(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(d$e,Mq):e=e.replace(u$e,Mq),e.replace(l$e,h$e))};iE.camelCase=m$e;var p$e=Fc&&Fc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},g$e=p$e(uF),x$e=iE;function p8(e,t){var r={};return!e||typeof e!="string"||(0,g$e.default)(e,function(n,a){n&&a&&(r[(0,x$e.camelCase)(n,t)]=a)}),r}p8.default=p8;var v$e=p8;const y$e=jn(v$e),xle=vle("end"),dF=vle("start");function vle(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function b$e(e){const t=dF(e),r=xle(e);if(t&&r)return{start:t,end:r}}function jw(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$q(e.position):"start"in e||"end"in e?$q(e):"line"in e||"column"in e?g8(e):""}function g8(e){return Bq(e&&e.line)+":"+Bq(e&&e.column)}function $q(e){return g8(e&&e.start)+"-"+g8(e&&e.end)}function Bq(e){return e&&typeof e=="number"?e:1}class jo extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let a="",i={},o=!1;if(r&&("line"in r&&"column"in r?i={place:r}:"start"in r&&"end"in r?i={place:r}:"type"in r?i={ancestors:[r],place:r.position}:i={...r}),typeof t=="string"?a=t:!i.cause&&t&&(o=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof n=="string"){const c=n.indexOf(":");c===-1?i.ruleId=n:(i.source=n.slice(0,c),i.ruleId=n.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=jw(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jo.prototype.file="";jo.prototype.name="";jo.prototype.reason="";jo.prototype.message="";jo.prototype.stack="";jo.prototype.column=void 0;jo.prototype.line=void 0;jo.prototype.ancestors=void 0;jo.prototype.cause=void 0;jo.prototype.fatal=void 0;jo.prototype.place=void 0;jo.prototype.ruleId=void 0;jo.prototype.source=void 0;const fF={}.hasOwnProperty,w$e=new Map,j$e=/[A-Z]/g,_$e=new Set(["table","tbody","thead","tfoot","tr"]),N$e=new Set(["td","th"]),yle="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function S$e(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=D$e(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=O$e(r,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?cF:V7e,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=ble(a,e,void 0);return i&&typeof i!="string"?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function ble(e,t,r){if(t.type==="element")return k$e(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return C$e(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return A$e(e,t,r);if(t.type==="mdxjsEsm")return E$e(e,t);if(t.type==="root")return T$e(e,t,r);if(t.type==="text")return P$e(e,t)}function k$e(e,t,r){const n=e.schema;let a=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(a=cF,e.schema=a),e.ancestors.push(t);const i=jle(e,t.tagName,!1),o=I$e(e,t);let l=mF(e,t);return _$e.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!I7e(c):!0})),wle(e,o,i,t),hF(o,l),e.ancestors.pop(),e.schema=n,e.create(t,i,o,r)}function C$e(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}E2(e,t.position)}function E$e(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);E2(e,t.position)}function A$e(e,t,r){const n=e.schema;let a=n;t.name==="svg"&&n.space==="html"&&(a=cF,e.schema=a),e.ancestors.push(t);const i=t.name===null?e.Fragment:jle(e,t.name,!0),o=R$e(e,t),l=mF(e,t);return wle(e,o,i,t),hF(o,l),e.ancestors.pop(),e.schema=n,e.create(t,i,o,r)}function T$e(e,t,r){const n={};return hF(n,mF(e,t)),e.create(t,e.Fragment,n,r)}function P$e(e,t){return t.value}function wle(e,t,r,n){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=n)}function hF(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function O$e(e,t,r){return n;function n(a,i,o,l){const u=Array.isArray(o.children)?r:t;return l?u(i,o,l):u(i,o)}}function D$e(e,t){return r;function r(n,a,i,o){const l=Array.isArray(i.children),c=dF(n);return t(a,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function I$e(e,t){const r={};let n,a;for(a in t.properties)if(a!=="children"&&fF.call(t.properties,a)){const i=L$e(e,a,t.properties[a]);if(i){const[o,l]=i;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&N$e.has(t.tagName)?n=l:r[o]=l}}if(n){const i=r.style||(r.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return r}function R$e(e,t){const r={};for(const n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else E2(e,t.position);else{const a=n.name;let i;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){const l=n.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else E2(e,t.position);else i=n.value===null?!0:n.value;r[a]=i}return r}function mF(e,t){const r=[];let n=-1;const a=e.passKeys?new Map:w$e;for(;++n<t.children.length;){const i=t.children[n];let o;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=a.get(c)||0;o=c+"-"+u,a.set(c,u+1)}}const l=ble(e,i,o);l!==void 0&&r.push(l)}return r}function L$e(e,t,r){const n=z7e(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=n.commaSeparated?A7e(r):W7e(r)),n.property==="style"){let a=typeof r=="object"?r:F$e(e,String(r));return e.stylePropertyNameCase==="css"&&(a=M$e(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&n.space?M7e[n.property]||n.property:n.attribute,r]}}function F$e(e,t){try{return y$e(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const n=r,a=new jo("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=yle+"#cannot-parse-style-attribute",a}}function jle(e,t,r){let n;if(!r)n={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let i=-1,o;for(;++i<a.length;){const l=Tq(a[i])?{type:"Identifier",name:a[i]}:{type:"Literal",value:a[i]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}n=o}else n=Tq(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){const a=n.value;return fF.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(n);E2(e)}function E2(e,t){const r=new jo("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=yle+"#cannot-handle-mdx-estrees-without-createevaluater",r}function M$e(e){const t={};let r;for(r in e)fF.call(e,r)&&(t[$$e(r)]=e[r]);return t}function $$e(e){let t=e.replace(j$e,B$e);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function B$e(e){return"-"+e.toLowerCase()}const MT={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},z$e={};function U$e(e,t){const r=z$e,n=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,a=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return _le(e,n,a)}function _le(e,t,r){if(q$e(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return zq(e.children,t,r)}return Array.isArray(e)?zq(e,t,r):""}function zq(e,t,r){const n=[];let a=-1;for(;++a<e.length;)n[a]=_le(e[a],t,r);return n.join("")}function q$e(e){return!!(e&&typeof e=="object")}const Uq=document.createElement("i");function pF(e){const t="&"+e+";";Uq.innerHTML=t;const r=Uq.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Jd(e,t,r,n){const a=e.length;let i=0,o;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,r=r>0?r:0,n.length<1e4)o=Array.from(n),o.unshift(t,r),e.splice(...o);else for(r&&e.splice(t,r);i<n.length;)o=n.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Dc(e,t){return e.length>0?(Jd(e,e.length,0,t),e):t}const qq={}.hasOwnProperty;function V$e(e){const t={};let r=-1;for(;++r<e.length;)W$e(t,e[r]);return t}function W$e(e,t){let r;for(r in t){const a=(qq.call(e,r)?e[r]:void 0)||(e[r]={}),i=t[r];let o;if(i)for(o in i){qq.call(a,o)||(a[o]=[]);const l=i[o];H$e(a[o],Array.isArray(l)?l:l?[l]:[])}}}function H$e(e,t){let r=-1;const n=[];for(;++r<t.length;)(t[r].add==="after"?e:n).push(t[r]);Jd(e,0,0,n)}function Nle(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function kv(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Dd=Ep(/[A-Za-z]/),Yl=Ep(/[\dA-Za-z]/),G$e=Ep(/[#-'*+\--9=?A-Z^-~]/);function x8(e){return e!==null&&(e<32||e===127)}const v8=Ep(/\d/),K$e=Ep(/[\dA-Fa-f]/),Y$e=Ep(/[!-/:-@[-`{-~]/);function $r(e){return e!==null&&e<-2}function pl(e){return e!==null&&(e<0||e===32)}function Un(e){return e===-2||e===-1||e===32}const X$e=Ep(new RegExp("\\p{P}|\\p{S}","u")),Z$e=Ep(/\s/);function Ep(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function x1(e){const t=[];let r=-1,n=0,a=0;for(;++r<e.length;){const i=e.charCodeAt(r);let o="";if(i===37&&Yl(e.charCodeAt(r+1))&&Yl(e.charCodeAt(r+2)))a=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(r+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),a=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(n,r),encodeURIComponent(o)),n=r+a+1,o=""),a&&(r+=a,a=0)}return t.join("")+e.slice(n)}function ks(e,t,r,n){const a=n?n-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return Un(c)?(e.enter(r),l(c)):t(c)}function l(c){return Un(c)&&i++<a?(e.consume(c),l):(e.exit(r),t(c))}}const J$e={tokenize:Q$e};function Q$e(e){const t=e.attempt(this.parser.constructs.contentInitial,n,a);let r;return t;function n(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ks(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=c),r=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return $r(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),o)}}const eBe={tokenize:tBe},Vq={tokenize:rBe};function tBe(e){const t=this,r=[];let n=0,a,i,o;return l;function l(y){if(n<r.length){const N=r[n];return t.containerState=N[1],e.attempt(N[0].continuation,c,u)(y)}return u(y)}function c(y){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&b();const N=t.events.length;let _=N,j;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){j=t.events[_][1].end;break}v(n);let S=N;for(;S<t.events.length;)t.events[S][1].end={...j},S++;return Jd(t.events,_+1,0,t.events.slice(N)),t.events.length=S,u(y)}return l(y)}function u(y){if(n===r.length){if(!a)return m(y);if(a.currentConstruct&&a.currentConstruct.concrete)return g(y);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Vq,d,f)(y)}function d(y){return a&&b(),v(n),m(y)}function f(y){return t.parser.lazy[t.now().line]=n!==r.length,o=t.now().offset,g(y)}function m(y){return t.containerState={},e.attempt(Vq,h,g)(y)}function h(y){return n++,r.push([t.currentConstruct,t.containerState]),m(y)}function g(y){if(y===null){a&&b(),v(0),e.consume(y);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:i}),p(y)}function p(y){if(y===null){x(e.exit("chunkFlow"),!0),v(0),e.consume(y);return}return $r(y)?(e.consume(y),x(e.exit("chunkFlow")),n=0,t.interrupt=void 0,l):(e.consume(y),p)}function x(y,N){const _=t.sliceStream(y);if(N&&_.push(null),y.previous=i,i&&(i.next=y),i=y,a.defineSkip(y.start),a.write(_),t.parser.lazy[y.start.line]){let j=a.events.length;for(;j--;)if(a.events[j][1].start.offset<o&&(!a.events[j][1].end||a.events[j][1].end.offset>o))return;const S=t.events.length;let I=S,P,F;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(P){F=t.events[I][1].end;break}P=!0}for(v(n),j=S;j<t.events.length;)t.events[j][1].end={...F},j++;Jd(t.events,I+1,0,t.events.slice(S)),t.events.length=j}}function v(y){let N=r.length;for(;N-- >y;){const _=r[N];t.containerState=_[1],_[0].exit.call(t,e)}r.length=y}function b(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function rBe(e,t,r){return ks(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Wq(e){if(e===null||pl(e)||Z$e(e))return 1;if(X$e(e))return 2}function gF(e,t,r){const n=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!n.includes(i)&&(t=i(t,r),n.push(i))}return t}const y8={name:"attention",resolveAll:nBe,tokenize:sBe};function nBe(e,t){let r=-1,n,a,i,o,l,c,u,d;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[n][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;c=e[n][1].end.offset-e[n][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const f={...e[n][1].end},m={...e[r][1].start};Hq(f,-c),Hq(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[n][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[r][1].start}},a={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[n][1].end={...o.start},e[r][1].start={...l.end},u=[],e[n][1].end.offset-e[n][1].start.offset&&(u=Dc(u,[["enter",e[n][1],t],["exit",e[n][1],t]])),u=Dc(u,[["enter",a,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Dc(u,gF(t.parser.constructs.insideSpan.null,e.slice(n+1,r),t)),u=Dc(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[r][1].end.offset-e[r][1].start.offset?(d=2,u=Dc(u,[["enter",e[r][1],t],["exit",e[r][1],t]])):d=0,Jd(e,n-1,r-n+3,u),r=n+u.length-d-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function sBe(e,t){const r=this.parser.constructs.attentionMarkers.null,n=this.previous,a=Wq(n);let i;return o;function o(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=Wq(c),f=!d||d===2&&a||r.includes(c),m=!a||a===2&&d||r.includes(n);return u._open=!!(i===42?f:f&&(a||!m)),u._close=!!(i===42?m:m&&(d||!f)),t(c)}}function Hq(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const aBe={name:"autolink",tokenize:iBe};function iBe(e,t,r){let n=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Dd(h)?(e.consume(h),o):h===64?r(h):u(h)}function o(h){return h===43||h===45||h===46||Yl(h)?(n=1,l(h)):u(h)}function l(h){return h===58?(e.consume(h),n=0,c):(h===43||h===45||h===46||Yl(h))&&n++<32?(e.consume(h),l):(n=0,u(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||x8(h)?r(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),d):G$e(h)?(e.consume(h),u):r(h)}function d(h){return Yl(h)?f(h):r(h)}function f(h){return h===46?(e.consume(h),n=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):m(h)}function m(h){if((h===45||Yl(h))&&n++<63){const g=h===45?m:f;return e.consume(h),g}return r(h)}}const oE={partial:!0,tokenize:oBe};function oBe(e,t,r){return n;function n(i){return Un(i)?ks(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||$r(i)?t(i):r(i)}}const Sle={continuation:{tokenize:cBe},exit:uBe,name:"blockQuote",tokenize:lBe};function lBe(e,t,r){const n=this;return a;function a(o){if(o===62){const l=n.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return r(o)}function i(o){return Un(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function cBe(e,t,r){const n=this;return a;function a(o){return Un(o)?ks(e,i,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Sle,t,r)(o)}}function uBe(e){e.exit("blockQuote")}const kle={name:"characterEscape",tokenize:dBe};function dBe(e,t,r){return n;function n(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return Y$e(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(i)}}const Cle={name:"characterReference",tokenize:fBe};function fBe(e,t,r){const n=this;let a=0,i,o;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=Yl,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=K$e,d):(e.enter("characterReferenceValue"),i=7,o=v8,d(f))}function d(f){if(f===59&&a){const m=e.exit("characterReferenceValue");return o===Yl&&!pF(n.sliceSerialize(m))?r(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(f)&&a++<i?(e.consume(f),d):r(f)}}const Gq={partial:!0,tokenize:mBe},Kq={concrete:!0,name:"codeFenced",tokenize:hBe};function hBe(e,t,r){const n=this,a={partial:!0,tokenize:_};let i=0,o=0,l;return c;function c(j){return u(j)}function u(j){const S=n.events[n.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===l?(o++,e.consume(j),d):o<3?r(j):(e.exit("codeFencedFenceSequence"),Un(j)?ks(e,f,"whitespace")(j):f(j))}function f(j){return j===null||$r(j)?(e.exit("codeFencedFence"),n.interrupt?t(j):e.check(Gq,p,N)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(j))}function m(j){return j===null||$r(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Un(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ks(e,h,"whitespace")(j)):j===96&&j===l?r(j):(e.consume(j),m)}function h(j){return j===null||$r(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||$r(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?r(j):(e.consume(j),g)}function p(j){return e.attempt(a,N,x)(j)}function x(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),v}function v(j){return i>0&&Un(j)?ks(e,b,"linePrefix",i+1)(j):b(j)}function b(j){return j===null||$r(j)?e.check(Gq,p,N)(j):(e.enter("codeFlowValue"),y(j))}function y(j){return j===null||$r(j)?(e.exit("codeFlowValue"),b(j)):(e.consume(j),y)}function N(j){return e.exit("codeFenced"),t(j)}function _(j,S,I){let P=0;return F;function F(R){return j.enter("lineEnding"),j.consume(R),j.exit("lineEnding"),T}function T(R){return j.enter("codeFencedFence"),Un(R)?ks(j,k,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):k(R)}function k(R){return R===l?(j.enter("codeFencedFenceSequence"),V(R)):I(R)}function V(R){return R===l?(P++,j.consume(R),V):P>=o?(j.exit("codeFencedFenceSequence"),Un(R)?ks(j,C,"whitespace")(R):C(R)):I(R)}function C(R){return R===null||$r(R)?(j.exit("codeFencedFence"),S(R)):I(R)}}}function mBe(e,t,r){const n=this;return a;function a(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}const $T={name:"codeIndented",tokenize:gBe},pBe={partial:!0,tokenize:xBe};function gBe(e,t,r){const n=this;return a;function a(u){return e.enter("codeIndented"),ks(e,i,"linePrefix",5)(u)}function i(u){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):r(u)}function o(u){return u===null?c(u):$r(u)?e.attempt(pBe,o,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||$r(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function xBe(e,t,r){const n=this;return a;function a(o){return n.parser.lazy[n.now().line]?r(o):$r(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):ks(e,i,"linePrefix",5)(o)}function i(o){const l=n.events[n.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):$r(o)?a(o):r(o)}}const vBe={name:"codeText",previous:bBe,resolve:yBe,tokenize:wBe};function yBe(e){let t=e.length-4,r=3,n,a;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(n=r;++n<t;)if(e[n][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(n=r-1,t++;++n<=t;)a===void 0?n!==t&&e[n][1].type!=="lineEnding"&&(a=n):(n===t||e[n][1].type==="lineEnding")&&(e[a][1].type="codeTextData",n!==a+2&&(e[a][1].end=e[n-1][1].end,e.splice(a+2,n-a-2),t-=n-a-2,n=a+2),a=void 0);return e}function bBe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wBe(e,t,r){let n=0,a,i;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),n++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?r(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),a=0,d(f)):$r(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||$r(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),a++,d):a===n?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class jBe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const n=r??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(t,n):t>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(t,r,n){const a=r||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return n&&Cb(this.left,n),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Cb(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Cb(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Cb(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Cb(this.left,r.reverse())}}}function Cb(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function Ele(e){const t={};let r=-1,n,a,i,o,l,c,u;const d=new jBe(e);for(;++r<d.length;){for(;r in t;)r=t[r];if(n=d.get(r),r&&n[1].type==="chunkFlow"&&d.get(r-1)[1].type==="listItemPrefix"&&(c=n[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(n[0]==="enter")n[1].contentType&&(Object.assign(t,_Be(d,r)),r=t[r],u=!0);else if(n[1]._container){for(i=r,a=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),o[1].type="lineEnding",a=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;a&&(n[1].end={...d.get(a)[1].start},l=d.slice(a,r),l.unshift(n),d.splice(a,r-a+1,l))}}return Jd(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function _Be(e,t){const r=e.get(t)[1],n=e.get(t)[2];let a=t-1;const i=[];let o=r._tokenizer;o||(o=n.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],u={};let d,f,m=-1,h=r,g=0,p=0;const x=[p];for(;h;){for(;e.get(++a)[1]!==h;);i.push(a),h._tokenizer||(d=n.sliceStream(h),h.next||d.push(null),f&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=r;++m<l.length;)l[m][0]==="exit"&&l[m-1][0]==="enter"&&l[m][1].type===l[m-1][1].type&&l[m][1].start.line!==l[m][1].end.line&&(p=m+1,x.push(p),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):x.pop(),m=x.length;m--;){const v=l.slice(x[m],x[m+1]),b=i.pop();c.push([b,b+v.length-1]),e.splice(b,2,v)}for(c.reverse(),m=-1;++m<c.length;)u[g+c[m][0]]=g+c[m][1],g+=c[m][1]-c[m][0]-1;return u}const NBe={resolve:kBe,tokenize:CBe},SBe={partial:!0,tokenize:EBe};function kBe(e){return Ele(e),e}function CBe(e,t){let r;return n;function n(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?i(l):$r(l)?e.check(SBe,o,i)(l):(e.consume(l),a)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,a}}function EBe(e,t,r){const n=this;return a;function a(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ks(e,i,"linePrefix")}function i(o){if(o===null||$r(o))return r(o);const l=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):e.interrupt(n.parser.constructs.flow,r,t)(o)}}function Ale(e,t,r,n,a,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(v){return v===60?(e.enter(n),e.enter(a),e.enter(i),e.consume(v),e.exit(i),m):v===null||v===32||v===41||x8(v)?r(v):(e.enter(n),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),p(v))}function m(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(n),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(l),m(v)):v===null||v===60||$r(v)?r(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function p(v){return!d&&(v===null||v===41||pl(v))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(n),t(v)):d<u&&v===40?(e.consume(v),d++,p):v===41?(e.consume(v),d--,p):v===null||v===32||v===40||x8(v)?r(v):(e.consume(v),v===92?x:p)}function x(v){return v===40||v===41||v===92?(e.consume(v),p):p(v)}}function Tle(e,t,r,n,a,i){const o=this;let l=0,c;return u;function u(h){return e.enter(n),e.enter(a),e.consume(h),e.exit(a),e.enter(i),d}function d(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(n),t):$r(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||$r(h)||l++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!Un(h)),h===92?m:f)}function m(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function Ple(e,t,r,n,a,i){let o;return l;function l(m){return m===34||m===39||m===40?(e.enter(n),e.enter(a),e.consume(m),e.exit(a),o=m===40?41:m,c):r(m)}function c(m){return m===o?(e.enter(a),e.consume(m),e.exit(a),e.exit(n),t):(e.enter(i),u(m))}function u(m){return m===o?(e.exit(i),c(o)):m===null?r(m):$r(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ks(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||$r(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?f:d)}function f(m){return m===o||m===92?(e.consume(m),d):d(m)}}function _w(e,t){let r;return n;function n(a){return $r(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,n):Un(a)?ks(e,n,r?"linePrefix":"lineSuffix")(a):t(a)}}const ABe={name:"definition",tokenize:PBe},TBe={partial:!0,tokenize:OBe};function PBe(e,t,r){const n=this;let a;return i;function i(h){return e.enter("definition"),o(h)}function o(h){return Tle.call(n,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return a=kv(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):r(h)}function c(h){return pl(h)?_w(e,u)(h):u(h)}function u(h){return Ale(e,d,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(TBe,f,f)(h)}function f(h){return Un(h)?ks(e,m,"whitespace")(h):m(h)}function m(h){return h===null||$r(h)?(e.exit("definition"),n.parser.defined.push(a),t(h)):r(h)}}function OBe(e,t,r){return n;function n(l){return pl(l)?_w(e,a)(l):r(l)}function a(l){return Ple(e,i,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Un(l)?ks(e,o,"whitespace")(l):o(l)}function o(l){return l===null||$r(l)?t(l):r(l)}}const DBe={name:"hardBreakEscape",tokenize:IBe};function IBe(e,t,r){return n;function n(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return $r(i)?(e.exit("hardBreakEscape"),t(i)):r(i)}}const RBe={name:"headingAtx",resolve:LBe,tokenize:FBe};function LBe(e,t){let r=e.length-2,n=3,a,i;return e[n][1].type==="whitespace"&&(n+=2),r-2>n&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(n===r-1||r-4>n&&e[r-2][1].type==="whitespace")&&(r-=n+1===r?2:4),r>n&&(a={type:"atxHeadingText",start:e[n][1].start,end:e[r][1].end},i={type:"chunkText",start:e[n][1].start,end:e[r][1].end,contentType:"text"},Jd(e,n,r-n+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function FBe(e,t,r){let n=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&n++<6?(e.consume(d),o):d===null||pl(d)?(e.exit("atxHeadingSequence"),l(d)):r(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||$r(d)?(e.exit("atxHeading"),t(d)):Un(d)?ks(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||pl(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const MBe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Yq=["pre","script","style","textarea"],$Be={concrete:!0,name:"htmlFlow",resolveTo:UBe,tokenize:qBe},BBe={partial:!0,tokenize:WBe},zBe={partial:!0,tokenize:VBe};function UBe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function qBe(e,t,r){const n=this;let a,i,o,l,c;return u;function u(A){return d(A)}function d(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),f}function f(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),i=!0,p):A===63?(e.consume(A),a=3,n.interrupt?t:z):Dd(A)?(e.consume(A),o=String.fromCharCode(A),x):r(A)}function m(A){return A===45?(e.consume(A),a=2,h):A===91?(e.consume(A),a=5,l=0,g):Dd(A)?(e.consume(A),a=4,n.interrupt?t:z):r(A)}function h(A){return A===45?(e.consume(A),n.interrupt?t:z):r(A)}function g(A){const O="CDATA[";return A===O.charCodeAt(l++)?(e.consume(A),l===O.length?n.interrupt?t:k:g):r(A)}function p(A){return Dd(A)?(e.consume(A),o=String.fromCharCode(A),x):r(A)}function x(A){if(A===null||A===47||A===62||pl(A)){const O=A===47,U=o.toLowerCase();return!O&&!i&&Yq.includes(U)?(a=1,n.interrupt?t(A):k(A)):MBe.includes(o.toLowerCase())?(a=6,O?(e.consume(A),v):n.interrupt?t(A):k(A)):(a=7,n.interrupt&&!n.parser.lazy[n.now().line]?r(A):i?b(A):y(A))}return A===45||Yl(A)?(e.consume(A),o+=String.fromCharCode(A),x):r(A)}function v(A){return A===62?(e.consume(A),n.interrupt?t:k):r(A)}function b(A){return Un(A)?(e.consume(A),b):F(A)}function y(A){return A===47?(e.consume(A),F):A===58||A===95||Dd(A)?(e.consume(A),N):Un(A)?(e.consume(A),y):F(A)}function N(A){return A===45||A===46||A===58||A===95||Yl(A)?(e.consume(A),N):_(A)}function _(A){return A===61?(e.consume(A),j):Un(A)?(e.consume(A),_):y(A)}function j(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),c=A,S):Un(A)?(e.consume(A),j):I(A)}function S(A){return A===c?(e.consume(A),c=null,P):A===null||$r(A)?r(A):(e.consume(A),S)}function I(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||pl(A)?_(A):(e.consume(A),I)}function P(A){return A===47||A===62||Un(A)?y(A):r(A)}function F(A){return A===62?(e.consume(A),T):r(A)}function T(A){return A===null||$r(A)?k(A):Un(A)?(e.consume(A),T):r(A)}function k(A){return A===45&&a===2?(e.consume(A),H):A===60&&a===1?(e.consume(A),q):A===62&&a===4?(e.consume(A),K):A===63&&a===3?(e.consume(A),z):A===93&&a===5?(e.consume(A),M):$r(A)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(BBe,E,V)(A)):A===null||$r(A)?(e.exit("htmlFlowData"),V(A)):(e.consume(A),k)}function V(A){return e.check(zBe,C,E)(A)}function C(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),R}function R(A){return A===null||$r(A)?V(A):(e.enter("htmlFlowData"),k(A))}function H(A){return A===45?(e.consume(A),z):k(A)}function q(A){return A===47?(e.consume(A),o="",L):k(A)}function L(A){if(A===62){const O=o.toLowerCase();return Yq.includes(O)?(e.consume(A),K):k(A)}return Dd(A)&&o.length<8?(e.consume(A),o+=String.fromCharCode(A),L):k(A)}function M(A){return A===93?(e.consume(A),z):k(A)}function z(A){return A===62?(e.consume(A),K):A===45&&a===2?(e.consume(A),z):k(A)}function K(A){return A===null||$r(A)?(e.exit("htmlFlowData"),E(A)):(e.consume(A),K)}function E(A){return e.exit("htmlFlow"),t(A)}}function VBe(e,t,r){const n=this;return a;function a(o){return $r(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):r(o)}function i(o){return n.parser.lazy[n.now().line]?r(o):t(o)}}function WBe(e,t,r){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(oE,t,r)}}const HBe={name:"htmlText",tokenize:GBe};function GBe(e,t,r){const n=this;let a,i,o;return l;function l(z){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(z),c}function c(z){return z===33?(e.consume(z),u):z===47?(e.consume(z),_):z===63?(e.consume(z),y):Dd(z)?(e.consume(z),I):r(z)}function u(z){return z===45?(e.consume(z),d):z===91?(e.consume(z),i=0,g):Dd(z)?(e.consume(z),b):r(z)}function d(z){return z===45?(e.consume(z),h):r(z)}function f(z){return z===null?r(z):z===45?(e.consume(z),m):$r(z)?(o=f,q(z)):(e.consume(z),f)}function m(z){return z===45?(e.consume(z),h):f(z)}function h(z){return z===62?H(z):z===45?m(z):f(z)}function g(z){const K="CDATA[";return z===K.charCodeAt(i++)?(e.consume(z),i===K.length?p:g):r(z)}function p(z){return z===null?r(z):z===93?(e.consume(z),x):$r(z)?(o=p,q(z)):(e.consume(z),p)}function x(z){return z===93?(e.consume(z),v):p(z)}function v(z){return z===62?H(z):z===93?(e.consume(z),v):p(z)}function b(z){return z===null||z===62?H(z):$r(z)?(o=b,q(z)):(e.consume(z),b)}function y(z){return z===null?r(z):z===63?(e.consume(z),N):$r(z)?(o=y,q(z)):(e.consume(z),y)}function N(z){return z===62?H(z):y(z)}function _(z){return Dd(z)?(e.consume(z),j):r(z)}function j(z){return z===45||Yl(z)?(e.consume(z),j):S(z)}function S(z){return $r(z)?(o=S,q(z)):Un(z)?(e.consume(z),S):H(z)}function I(z){return z===45||Yl(z)?(e.consume(z),I):z===47||z===62||pl(z)?P(z):r(z)}function P(z){return z===47?(e.consume(z),H):z===58||z===95||Dd(z)?(e.consume(z),F):$r(z)?(o=P,q(z)):Un(z)?(e.consume(z),P):H(z)}function F(z){return z===45||z===46||z===58||z===95||Yl(z)?(e.consume(z),F):T(z)}function T(z){return z===61?(e.consume(z),k):$r(z)?(o=T,q(z)):Un(z)?(e.consume(z),T):P(z)}function k(z){return z===null||z===60||z===61||z===62||z===96?r(z):z===34||z===39?(e.consume(z),a=z,V):$r(z)?(o=k,q(z)):Un(z)?(e.consume(z),k):(e.consume(z),C)}function V(z){return z===a?(e.consume(z),a=void 0,R):z===null?r(z):$r(z)?(o=V,q(z)):(e.consume(z),V)}function C(z){return z===null||z===34||z===39||z===60||z===61||z===96?r(z):z===47||z===62||pl(z)?P(z):(e.consume(z),C)}function R(z){return z===47||z===62||pl(z)?P(z):r(z)}function H(z){return z===62?(e.consume(z),e.exit("htmlTextData"),e.exit("htmlText"),t):r(z)}function q(z){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),L}function L(z){return Un(z)?ks(e,M,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):M(z)}function M(z){return e.enter("htmlTextData"),o(z)}}const xF={name:"labelEnd",resolveAll:ZBe,resolveTo:JBe,tokenize:QBe},KBe={tokenize:e9e},YBe={tokenize:t9e},XBe={tokenize:r9e};function ZBe(e){let t=-1;const r=[];for(;++t<e.length;){const n=e[t][1];if(r.push(e[t]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const a=n.type==="labelImage"?4:2;n.type="data",t+=a}}return e.length!==r.length&&Jd(e,0,e.length,r),e}function JBe(e,t){let r=e.length,n=0,a,i,o,l;for(;r--;)if(a=e[r][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[r][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=r,a.type!=="labelLink")){n=2;break}}else a.type==="labelEnd"&&(o=r);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+n+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Dc(l,e.slice(i+1,i+n+3)),l=Dc(l,[["enter",d,t]]),l=Dc(l,gF(t.parser.constructs.insideSpan.null,e.slice(i+n+4,o-3),t)),l=Dc(l,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),l=Dc(l,e.slice(o+1)),l=Dc(l,[["exit",c,t]]),Jd(e,i,e.length,l),e}function QBe(e,t,r){const n=this;let a=n.events.length,i,o;for(;a--;)if((n.events[a][1].type==="labelImage"||n.events[a][1].type==="labelLink")&&!n.events[a][1]._balanced){i=n.events[a][1];break}return l;function l(m){return i?i._inactive?f(m):(o=n.parser.defined.includes(kv(n.sliceSerialize({start:i.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),c):r(m)}function c(m){return m===40?e.attempt(KBe,d,o?d:f)(m):m===91?e.attempt(YBe,d,o?u:f)(m):o?d(m):f(m)}function u(m){return e.attempt(XBe,d,f)(m)}function d(m){return t(m)}function f(m){return i._balanced=!0,r(m)}}function e9e(e,t,r){return n;function n(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return pl(f)?_w(e,i)(f):i(f)}function i(f){return f===41?d(f):Ale(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return pl(f)?_w(e,c)(f):d(f)}function l(f){return r(f)}function c(f){return f===34||f===39||f===40?Ple(e,u,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return pl(f)?_w(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):r(f)}}function t9e(e,t,r){const n=this;return a;function a(l){return Tle.call(n,e,i,o,"reference","referenceMarker","referenceString")(l)}function i(l){return n.parser.defined.includes(kv(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(l):r(l)}function o(l){return r(l)}}function r9e(e,t,r){return n;function n(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):r(i)}}const n9e={name:"labelStartImage",resolveAll:xF.resolveAll,tokenize:s9e};function s9e(e,t,r){const n=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(l):t(l)}}const a9e={name:"labelStartLink",resolveAll:xF.resolveAll,tokenize:i9e};function i9e(e,t,r){const n=this;return a;function a(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in n.parser.constructs?r(o):t(o)}}const BT={name:"lineEnding",tokenize:o9e};function o9e(e,t){return r;function r(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),ks(e,t,"linePrefix")}}const d5={name:"thematicBreak",tokenize:l9e};function l9e(e,t,r){let n=0,a;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return a=u,l(u)}function l(u){return u===a?(e.enter("thematicBreakSequence"),c(u)):n>=3&&(u===null||$r(u))?(e.exit("thematicBreak"),t(u)):r(u)}function c(u){return u===a?(e.consume(u),n++,c):(e.exit("thematicBreakSequence"),Un(u)?ks(e,l,"whitespace")(u):l(u))}}const tl={continuation:{tokenize:f9e},exit:m9e,name:"list",tokenize:d9e},c9e={partial:!0,tokenize:p9e},u9e={partial:!0,tokenize:h9e};function d9e(e,t,r){const n=this,a=n.events[n.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,o=0;return l;function l(h){const g=n.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||h===n.containerState.marker:v8(h)){if(n.containerState.type||(n.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(d5,r,u)(h):u(h);if(!n.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return r(h)}function c(h){return v8(h)&&++o<10?(e.consume(h),c):(!n.interrupt||o<2)&&(n.containerState.marker?h===n.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):r(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||h,e.check(oE,n.interrupt?r:d,e.attempt(c9e,m,f))}function d(h){return n.containerState.initialBlankLine=!0,i++,m(h)}function f(h){return Un(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),m):r(h)}function m(h){return n.containerState.size=i+n.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function f9e(e,t,r){const n=this;return n.containerState._closeFlow=void 0,e.check(oE,a,i);function a(l){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ks(e,t,"listItemIndent",n.containerState.size+1)(l)}function i(l){return n.containerState.furtherBlankLines||!Un(l)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,o(l)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(u9e,t,o)(l))}function o(l){return n.containerState._closeFlow=!0,n.interrupt=void 0,ks(e,e.attempt(tl,t,r),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function h9e(e,t,r){const n=this;return ks(e,a,"listItemIndent",n.containerState.size+1);function a(i){const o=n.events[n.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===n.containerState.size?t(i):r(i)}}function m9e(e){e.exit(this.containerState.type)}function p9e(e,t,r){const n=this;return ks(e,a,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(i){const o=n.events[n.events.length-1];return!Un(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):r(i)}}const Xq={name:"setextUnderline",resolveTo:g9e,tokenize:x9e};function g9e(e,t){let r=e.length,n,a,i;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){n=r;break}e[r][1].type==="paragraph"&&(a=r)}else e[r][1].type==="content"&&e.splice(r,1),!i&&e[r][1].type==="definition"&&(i=r);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e}function x9e(e,t,r){const n=this;let a;return i;function i(u){let d=n.events.length,f;for(;d--;)if(n.events[d][1].type!=="lineEnding"&&n.events[d][1].type!=="linePrefix"&&n.events[d][1].type!=="content"){f=n.events[d][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||f)?(e.enter("setextHeadingLine"),a=u,o(u)):r(u)}function o(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===a?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Un(u)?ks(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||$r(u)?(e.exit("setextHeadingLine"),t(u)):r(u)}}const v9e={tokenize:y9e};function y9e(e){const t=this,r=e.attempt(oE,n,e.attempt(this.parser.constructs.flowInitial,a,ks(e,e.attempt(this.parser.constructs.flow,a,e.attempt(NBe,a)),"linePrefix")));return r;function n(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const b9e={resolveAll:Dle()},w9e=Ole("string"),j9e=Ole("text");function Ole(e){return{resolveAll:Dle(e==="text"?_9e:void 0),tokenize:t};function t(r){const n=this,a=this.parser.constructs[e],i=r.attempt(a,o,l);return o;function o(d){return u(d)?i(d):l(d)}function l(d){if(d===null){r.consume(d);return}return r.enter("data"),r.consume(d),c}function c(d){return u(d)?(r.exit("data"),i(d)):(r.consume(d),c)}function u(d){if(d===null)return!0;const f=a[d];let m=-1;if(f)for(;++m<f.length;){const h=f[m];if(!h.previous||h.previous.call(n,n.previous))return!0}return!1}}}function Dle(e){return t;function t(r,n){let a=-1,i;for(;++a<=r.length;)i===void 0?r[a]&&r[a][1].type==="data"&&(i=a,a++):(!r[a]||r[a][1].type!=="data")&&(a!==i+2&&(r[i][1].end=r[a-1][1].end,r.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(r,n):r}}function _9e(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const n=e[r-1][1],a=t.sliceStream(n);let i=a.length,o=-1,l=0,c;for(;i--;){const u=a[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(l=0),l){const u={type:r===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:n.start._bufferIndex+o,_index:n.start._index+i,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(e.splice(r,0,["enter",u,t],["exit",u,t]),r+=2)}r++}return e}const N9e={42:tl,43:tl,45:tl,48:tl,49:tl,50:tl,51:tl,52:tl,53:tl,54:tl,55:tl,56:tl,57:tl,62:Sle},S9e={91:ABe},k9e={[-2]:$T,[-1]:$T,32:$T},C9e={35:RBe,42:d5,45:[Xq,d5],60:$Be,61:Xq,95:d5,96:Kq,126:Kq},E9e={38:Cle,92:kle},A9e={[-5]:BT,[-4]:BT,[-3]:BT,33:n9e,38:Cle,42:y8,60:[aBe,HBe],91:a9e,92:[DBe,kle],93:xF,95:y8,96:vBe},T9e={null:[y8,b9e]},P9e={null:[42,95]},O9e={null:[]},D9e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:P9e,contentInitial:S9e,disable:O9e,document:N9e,flow:C9e,flowInitial:k9e,insideSpan:T9e,string:E9e,text:A9e},Symbol.toStringTag,{value:"Module"}));function I9e(e,t,r){let n={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const a={},i=[];let o=[],l=[];const c={attempt:S(_),check:S(j),consume:b,enter:y,exit:N,interrupt:S(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:p,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:h,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(T){return o=Dc(o,T),x(),o[o.length-1]!==null?[]:(I(t,0),u.events=gF(i,u.events,u),u.events)}function m(T,k){return L9e(h(T),k)}function h(T){return R9e(o,T)}function g(){const{_bufferIndex:T,_index:k,line:V,column:C,offset:R}=n;return{_bufferIndex:T,_index:k,line:V,column:C,offset:R}}function p(T){a[T.line]=T.column,F()}function x(){let T;for(;n._index<o.length;){const k=o[n._index];if(typeof k=="string")for(T=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===T&&n._bufferIndex<k.length;)v(k.charCodeAt(n._bufferIndex));else v(k)}}function v(T){d=d(T)}function b(T){$r(T)?(n.line++,n.column=1,n.offset+=T===-3?2:1,F()):T!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===o[n._index].length&&(n._bufferIndex=-1,n._index++)),u.previous=T}function y(T,k){const V=k||{};return V.type=T,V.start=g(),u.events.push(["enter",V,u]),l.push(V),V}function N(T){const k=l.pop();return k.end=g(),u.events.push(["exit",k,u]),k}function _(T,k){I(T,k.from)}function j(T,k){k.restore()}function S(T,k){return V;function V(C,R,H){let q,L,M,z;return Array.isArray(C)?E(C):"tokenize"in C?E([C]):K(C);function K(Y){return J;function J(se){const ee=se!==null&&Y[se],ie=se!==null&&Y.null,Ee=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return E(Ee)(se)}}function E(Y){return q=Y,L=0,Y.length===0?H:A(Y[L])}function A(Y){return J;function J(se){return z=P(),M=Y,Y.partial||(u.currentConstruct=Y),Y.name&&u.parser.constructs.disable.null.includes(Y.name)?U():Y.tokenize.call(k?Object.assign(Object.create(u),k):u,c,O,U)(se)}}function O(Y){return T(M,z),R}function U(Y){return z.restore(),++L<q.length?A(q[L]):H}}}function I(T,k){T.resolveAll&&!i.includes(T)&&i.push(T),T.resolve&&Jd(u.events,k,u.events.length-k,T.resolve(u.events.slice(k),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function P(){const T=g(),k=u.previous,V=u.currentConstruct,C=u.events.length,R=Array.from(l);return{from:C,restore:H};function H(){n=T,u.previous=k,u.currentConstruct=V,u.events.length=C,l=R,F()}}function F(){n.line in a&&n.column<2&&(n.column=a[n.line],n.offset+=a[n.line]-1)}}function R9e(e,t){const r=t.start._index,n=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let o;if(r===a)o=[e[r].slice(n,i)];else{if(o=e.slice(r,a),n>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(n):o.shift()}i>0&&o.push(e[a].slice(0,i))}return o}function L9e(e,t){let r=-1;const n=[];let a;for(;++r<e.length;){const i=e[r];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&a)continue;o=" ";break}default:o=String.fromCharCode(i)}a=i===-2,n.push(o)}return n.join("")}function F9e(e){const n={constructs:V$e([D9e,...(e||{}).extensions||[]]),content:a(J$e),defined:[],document:a(eBe),flow:a(v9e),lazy:{},string:a(w9e),text:a(j9e)};return n;function a(i){return o;function o(l){return I9e(n,i,l)}}}function M9e(e){for(;!Ele(e););return e}const Zq=/[\0\t\n\r]/g;function $9e(){let e=1,t="",r=!0,n;return a;function a(i,o,l){const c=[];let u,d,f,m,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),f=0,t="",r&&(i.charCodeAt(0)===65279&&f++,r=void 0);f<i.length;){if(Zq.lastIndex=f,u=Zq.exec(i),m=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(m),!u){t=i.slice(f);break}if(h===10&&f===m&&n)c.push(-3),n=void 0;else switch(n&&(c.push(-5),n=void 0),f<m&&(c.push(i.slice(f,m)),e+=m-f),h){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:n=!0,e=1}f=m+1}return l&&(n&&c.push(-5),t&&c.push(t),c.push(null)),c}}const B9e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function z9e(e){return e.replace(B9e,U9e)}function U9e(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const a=r.charCodeAt(1),i=a===120||a===88;return Nle(r.slice(i?2:1),i?16:10)}return pF(r)||e}const Ile={}.hasOwnProperty;function q9e(e,t,r){return typeof t!="string"&&(r=t,t=void 0),V9e(r)(M9e(F9e(r).document().write($9e()(e,t,!0))))}function V9e(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(fe),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(Z),blockQuote:i(ie),characterEscape:P,characterReference:P,codeFenced:i(Ee),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Ee,o),codeText:i(te,o),codeTextData:P,data:P,codeFlowValue:P,definition:i(Ue),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(W),hardBreakEscape:i(le),hardBreakTrailing:i(le),htmlFlow:i(re,o),htmlFlowData:P,htmlText:i(re,o),htmlTextData:P,image:i(oe),label:o,link:i(fe),listItem:i(ge),listItemValue:m,listOrdered:i(Fe,f),listUnordered:i(Fe),paragraph:i(pe),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Z),strong:i(Ie),thematicBreak:i(we)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:ee,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:Y,characterReference:J,codeFenced:c(x),codeFencedFence:p,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:F,codeIndented:c(v),codeText:c(R),codeTextData:F,data:F,definition:c(),definitionDestinationString:N,definitionLabelString:b,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(k),hardBreakTrailing:c(k),htmlFlow:c(V),htmlFlowData:F,htmlText:c(C),htmlTextData:F,image:c(q),label:M,labelText:L,lineEnding:T,link:c(H),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:O,resourceDestinationString:z,resourceTitleString:K,resource:E,setextHeading:c(I),setextHeadingLineSequence:S,setextHeadingText:j,strong:c(),thematicBreak:c()}};Rle(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(_e){let qe={type:"root",children:[]};const Re={stack:[qe],tokenStack:[],config:t,enter:l,exit:u,buffer:o,resume:d,data:r},Me=[];let He=-1;for(;++He<_e.length;)if(_e[He][1].type==="listOrdered"||_e[He][1].type==="listUnordered")if(_e[He][0]==="enter")Me.push(He);else{const st=Me.pop();He=a(_e,st,He)}for(He=-1;++He<_e.length;){const st=t[_e[He][0]];Ile.call(st,_e[He][1].type)&&st[_e[He][1].type].call(Object.assign({sliceSerialize:_e[He][2].sliceSerialize},Re),_e[He][1])}if(Re.tokenStack.length>0){const st=Re.tokenStack[Re.tokenStack.length-1];(st[1]||Jq).call(Re,void 0,st[0])}for(qe.position={start:Qh(_e.length>0?_e[0][1].start:{line:1,column:1,offset:0}),end:Qh(_e.length>0?_e[_e.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He<t.transforms.length;)qe=t.transforms[He](qe)||qe;return qe}function a(_e,qe,Re){let Me=qe-1,He=-1,st=!1,Zt,_t,Vt,Jt;for(;++Me<=Re;){const Qt=_e[Me];switch(Qt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qt[0]==="enter"?He++:He--,Jt=void 0;break}case"lineEndingBlank":{Qt[0]==="enter"&&(Zt&&!Jt&&!He&&!Vt&&(Vt=Me),Jt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Jt=void 0}if(!He&&Qt[0]==="enter"&&Qt[1].type==="listItemPrefix"||He===-1&&Qt[0]==="exit"&&(Qt[1].type==="listUnordered"||Qt[1].type==="listOrdered")){if(Zt){let qt=Me;for(_t=void 0;qt--;){const it=_e[qt];if(it[1].type==="lineEnding"||it[1].type==="lineEndingBlank"){if(it[0]==="exit")continue;_t&&(_e[_t][1].type="lineEndingBlank",st=!0),it[1].type="lineEnding",_t=qt}else if(!(it[1].type==="linePrefix"||it[1].type==="blockQuotePrefix"||it[1].type==="blockQuotePrefixWhitespace"||it[1].type==="blockQuoteMarker"||it[1].type==="listItemIndent"))break}Vt&&(!_t||Vt<_t)&&(Zt._spread=!0),Zt.end=Object.assign({},_t?_e[_t][1].start:Qt[1].end),_e.splice(_t||Me,0,["exit",Zt,Qt[2]]),Me++,Re++}if(Qt[1].type==="listItemPrefix"){const qt={type:"listItem",_spread:!1,start:Object.assign({},Qt[1].start),end:void 0};Zt=qt,_e.splice(Me,0,["enter",qt,Qt[2]]),Me++,Re++,Vt=void 0,Jt=!0}}}return _e[qe][1]._spread=st,Re}function i(_e,qe){return Re;function Re(Me){l.call(this,_e(Me),Me),qe&&qe.call(this,Me)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(_e,qe,Re){this.stack[this.stack.length-1].children.push(_e),this.stack.push(_e),this.tokenStack.push([qe,Re||void 0]),_e.position={start:Qh(qe.start),end:void 0}}function c(_e){return qe;function qe(Re){_e&&_e.call(this,Re),u.call(this,Re)}}function u(_e,qe){const Re=this.stack.pop(),Me=this.tokenStack.pop();if(Me)Me[0].type!==_e.type&&(qe?qe.call(this,_e,Me[0]):(Me[1]||Jq).call(this,_e,Me[0]));else throw new Error("Cannot close `"+_e.type+"` ("+jw({start:_e.start,end:_e.end})+"): it’s not open");Re.position.end=Qh(_e.end)}function d(){return U$e(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(_e){if(this.data.expectingFirstListItemValue){const qe=this.stack[this.stack.length-2];qe.start=Number.parseInt(this.sliceSerialize(_e),10),this.data.expectingFirstListItemValue=void 0}}function h(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.lang=_e}function g(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.meta=_e}function p(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.value=_e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.value=_e.replace(/(\r?\n|\r)$/g,"")}function b(_e){const qe=this.resume(),Re=this.stack[this.stack.length-1];Re.label=qe,Re.identifier=kv(this.sliceSerialize(_e)).toLowerCase()}function y(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.title=_e}function N(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.url=_e}function _(_e){const qe=this.stack[this.stack.length-1];if(!qe.depth){const Re=this.sliceSerialize(_e).length;qe.depth=Re}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function S(_e){const qe=this.stack[this.stack.length-1];qe.depth=this.sliceSerialize(_e).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function P(_e){const Re=this.stack[this.stack.length-1].children;let Me=Re[Re.length-1];(!Me||Me.type!=="text")&&(Me=Ge(),Me.position={start:Qh(_e.start),end:void 0},Re.push(Me)),this.stack.push(Me)}function F(_e){const qe=this.stack.pop();qe.value+=this.sliceSerialize(_e),qe.position.end=Qh(_e.end)}function T(_e){const qe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=qe.children[qe.children.length-1];Re.position.end=Qh(_e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(qe.type)&&(P.call(this,_e),F.call(this,_e))}function k(){this.data.atHardBreak=!0}function V(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.value=_e}function C(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.value=_e}function R(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.value=_e}function H(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const qe=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=qe,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function q(){const _e=this.stack[this.stack.length-1];if(this.data.inReference){const qe=this.data.referenceType||"shortcut";_e.type+="Reference",_e.referenceType=qe,delete _e.url,delete _e.title}else delete _e.identifier,delete _e.label;this.data.referenceType=void 0}function L(_e){const qe=this.sliceSerialize(_e),Re=this.stack[this.stack.length-2];Re.label=z9e(qe),Re.identifier=kv(qe).toLowerCase()}function M(){const _e=this.stack[this.stack.length-1],qe=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const Me=_e.children;Re.children=Me}else Re.alt=qe}function z(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.url=_e}function K(){const _e=this.resume(),qe=this.stack[this.stack.length-1];qe.title=_e}function E(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function O(_e){const qe=this.resume(),Re=this.stack[this.stack.length-1];Re.label=qe,Re.identifier=kv(this.sliceSerialize(_e)).toLowerCase(),this.data.referenceType="full"}function U(_e){this.data.characterReferenceType=_e.type}function Y(_e){const qe=this.sliceSerialize(_e),Re=this.data.characterReferenceType;let Me;Re?(Me=Nle(qe,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Me=pF(qe);const He=this.stack[this.stack.length-1];He.value+=Me}function J(_e){const qe=this.stack.pop();qe.position.end=Qh(_e.end)}function se(_e){F.call(this,_e);const qe=this.stack[this.stack.length-1];qe.url=this.sliceSerialize(_e)}function ee(_e){F.call(this,_e);const qe=this.stack[this.stack.length-1];qe.url="mailto:"+this.sliceSerialize(_e)}function ie(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function te(){return{type:"inlineCode",value:""}}function Ue(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function W(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:0,children:[]}}function le(){return{type:"break"}}function re(){return{type:"html",value:""}}function oe(){return{type:"image",title:null,url:"",alt:null}}function fe(){return{type:"link",title:null,url:"",children:[]}}function Fe(_e){return{type:"list",ordered:_e.type==="listOrdered",start:null,spread:_e._spread,children:[]}}function ge(_e){return{type:"listItem",spread:_e._spread,checked:null,children:[]}}function pe(){return{type:"paragraph",children:[]}}function Ie(){return{type:"strong",children:[]}}function Ge(){return{type:"text",value:""}}function we(){return{type:"thematicBreak"}}}function Qh(e){return{line:e.line,column:e.column,offset:e.offset}}function Rle(e,t){let r=-1;for(;++r<t.length;){const n=t[r];Array.isArray(n)?Rle(e,n):W9e(e,n)}}function W9e(e,t){let r;for(r in t)if(Ile.call(t,r))switch(r){case"canContainEols":{const n=t[r];n&&e[r].push(...n);break}case"transforms":{const n=t[r];n&&e[r].push(...n);break}case"enter":case"exit":{const n=t[r];n&&Object.assign(e[r],n);break}}}function Jq(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jw({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jw({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jw({start:t.start,end:t.end})+") is still open")}function H9e(e){const t=this;t.parser=r;function r(n){return q9e(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function G9e(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function K9e(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
`}]}function Y9e(e,t){const r=t.value?t.value+`
`:"",n={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(n.className=["language-"+a[0]]);let i={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function X9e(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Z9e(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function J9e(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),a=x1(n.toLowerCase()),i=e.footnoteOrder.indexOf(n);let o,l=e.footnoteCounts.get(n);l===void 0?(l=0,e.footnoteOrder.push(n),o=e.footnoteOrder.length):o=i+1,l+=1,e.footnoteCounts.set(n,l);const c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function Q9e(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function eze(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function Lle(e,t){const r=t.referenceType;let n="]";if(r==="collapsed"?n+="[]":r==="full"&&(n+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+n}];const a=e.all(t),i=a[0];i&&i.type==="text"?i.value="["+i.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&o.type==="text"?o.value+=n:a.push({type:"text",value:n}),a}function tze(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Lle(e,t);const a={src:x1(n.url||""),alt:t.alt};n.title!==null&&n.title!==void 0&&(a.title=n.title);const i={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,i),e.applyData(t,i)}function rze(e,t){const r={src:x1(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,n),e.applyData(t,n)}function nze(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const n={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,n),e.applyData(t,n)}function sze(e,t){const r=String(t.identifier).toUpperCase(),n=e.definitionById.get(r);if(!n)return Lle(e,t);const a={href:x1(n.url||"")};n.title!==null&&n.title!==void 0&&(a.title=n.title);const i={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function aze(e,t){const r={href:x1(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const n={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ize(e,t,r){const n=e.all(t),a=r?oze(r):Fle(t),i={},o=[];if(typeof t.checked=="boolean"){const d=n[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},n.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<n.length;){const d=n[l];(a||l!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!a?o.push(...d.children):o.push(d)}const c=n[n.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function oze(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let n=-1;for(;!t&&++n<r.length;)t=Fle(r[n])}return t}function Fle(e){const t=e.spread;return t??e.children.length>1}function lze(e,t){const r={},n=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++a<n.length;){const o=n[a];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(n,!0)};return e.patch(t,i),e.applyData(t,i)}function cze(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function uze(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function dze(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function fze(e,t){const r=e.all(t),n=r.shift(),a=[];if(n){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([n],!0)};e.patch(t.children[0],o),a.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=dF(t.children[1]),c=xle(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),a.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,i),e.applyData(t,i)}function hze(e,t,r){const n=r?r.children:void 0,i=(n?n.indexOf(t):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],m={},h=o?o[c]:void 0;h&&(m.align=h);let g={type:"element",tagName:i,properties:m,children:[]};f&&(g.children=e.all(f),e.patch(f,g),g=e.applyData(f,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function mze(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Qq=9,eV=32;function pze(e){const t=String(e),r=/\r?\n|\r/g;let n=r.exec(t),a=0;const i=[];for(;n;)i.push(tV(t.slice(a,n.index),a>0,!0),n[0]),a=n.index+n[0].length,n=r.exec(t);return i.push(tV(t.slice(a),a>0,!1)),i.join("")}function tV(e,t,r){let n=0,a=e.length;if(t){let i=e.codePointAt(n);for(;i===Qq||i===eV;)n++,i=e.codePointAt(n)}if(r){let i=e.codePointAt(a-1);for(;i===Qq||i===eV;)a--,i=e.codePointAt(a-1)}return a>n?e.slice(n,a):""}function gze(e,t){const r={type:"text",value:pze(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function xze(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const vze={blockquote:G9e,break:K9e,code:Y9e,delete:X9e,emphasis:Z9e,footnoteReference:J9e,heading:Q9e,html:eze,imageReference:tze,image:rze,inlineCode:nze,linkReference:sze,link:aze,listItem:ize,list:lze,paragraph:cze,root:uze,strong:dze,table:fze,tableCell:mze,tableRow:hze,text:gze,thematicBreak:xze,toml:cS,yaml:cS,definition:cS,footnoteDefinition:cS};function cS(){}const Mle=-1,lE=0,Nw=1,v4=2,vF=3,yF=4,bF=5,wF=6,$le=7,Ble=8,rV=typeof self=="object"?self:globalThis,yze=(e,t)=>{const r=(a,i)=>(e.set(i,a),a),n=a=>{if(e.has(a))return e.get(a);const[i,o]=t[a];switch(i){case lE:case Mle:return r(o,a);case Nw:{const l=r([],a);for(const c of o)l.push(n(c));return l}case v4:{const l=r({},a);for(const[c,u]of o)l[n(c)]=n(u);return l}case vF:return r(new Date(o),a);case yF:{const{source:l,flags:c}=o;return r(new RegExp(l,c),a)}case bF:{const l=r(new Map,a);for(const[c,u]of o)l.set(n(c),n(u));return l}case wF:{const l=r(new Set,a);for(const c of o)l.add(n(c));return l}case $le:{const{name:l,message:c}=o;return r(new rV[l](c),a)}case Ble:return r(BigInt(o),a);case"BigInt":return r(Object(BigInt(o)),a);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new rV[i](o),a)};return n},nV=e=>yze(new Map,e)(0),Nx="",{toString:bze}={},{keys:wze}=Object,Eb=e=>{const t=typeof e;if(t!=="object"||!e)return[lE,t];const r=bze.call(e).slice(8,-1);switch(r){case"Array":return[Nw,Nx];case"Object":return[v4,Nx];case"Date":return[vF,Nx];case"RegExp":return[yF,Nx];case"Map":return[bF,Nx];case"Set":return[wF,Nx];case"DataView":return[Nw,r]}return r.includes("Array")?[Nw,r]:r.includes("Error")?[$le,r]:[v4,r]},uS=([e,t])=>e===lE&&(t==="function"||t==="symbol"),jze=(e,t,r,n)=>{const a=(o,l)=>{const c=n.push(o)-1;return r.set(l,c),c},i=o=>{if(r.has(o))return r.get(o);let[l,c]=Eb(o);switch(l){case lE:{let d=o;switch(c){case"bigint":l=Ble,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return a([Mle],o)}return a([l,d],o)}case Nw:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),a([c,[...m]],o)}const d=[],f=a([l,d],o);for(const m of o)d.push(i(m));return f}case v4:{if(c)switch(c){case"BigInt":return a([c,o.toString()],o);case"Boolean":case"Number":case"String":return a([c,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],f=a([l,d],o);for(const m of wze(o))(e||!uS(Eb(o[m])))&&d.push([i(m),i(o[m])]);return f}case vF:return a([l,o.toISOString()],o);case yF:{const{source:d,flags:f}=o;return a([l,{source:d,flags:f}],o)}case bF:{const d=[],f=a([l,d],o);for(const[m,h]of o)(e||!(uS(Eb(m))||uS(Eb(h))))&&d.push([i(m),i(h)]);return f}case wF:{const d=[],f=a([l,d],o);for(const m of o)(e||!uS(Eb(m)))&&d.push(i(m));return f}}const{message:u}=o;return a([l,{name:c,message:u}],o)};return i},sV=(e,{json:t,lossy:r}={})=>{const n=[];return jze(!(t||r),!!t,new Map,n)(e),n},y4=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nV(sV(e,t)):structuredClone(e):(e,t)=>nV(sV(e,t));function _ze(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function Nze(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Sze(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||_ze,n=e.options.footnoteBackLabel||Nze,a=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),m=x1(f.toLowerCase());let h=0;const g=[],p=e.footnoteCounts.get(f);for(;p!==void 0&&++h<=p;){g.length>0&&g.push({type:"text",value:" "});let b=typeof r=="string"?r:r(c,h);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(c,h),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const b=x.children[x.children.length-1];b&&b.type==="text"?b.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,v),l.push(v)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...y4(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
`}]}}const zle=function(e){if(e==null)return Aze;if(typeof e=="function")return cE(e);if(typeof e=="object")return Array.isArray(e)?kze(e):Cze(e);if(typeof e=="string")return Eze(e);throw new Error("Expected function, string, or object as test")};function kze(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=zle(e[r]);return cE(n);function n(...a){let i=-1;for(;++i<t.length;)if(t[i].apply(this,a))return!0;return!1}}function Cze(e){const t=e;return cE(r);function r(n){const a=n;let i;for(i in e)if(a[i]!==t[i])return!1;return!0}}function Eze(e){return cE(t);function t(r){return r&&r.type===e}}function cE(e){return t;function t(r,n,a){return!!(Tze(r)&&e.call(this,r,typeof n=="number"?n:void 0,a||void 0))}}function Aze(){return!0}function Tze(e){return e!==null&&typeof e=="object"&&"type"in e}const Ule=[],Pze=!0,aV=!1,Oze="skip";function Dze(e,t,r,n){let a;typeof t=="function"&&typeof r!="function"?(n=r,r=t):a=t;const i=zle(a),o=n?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return m;function m(){let h=Ule,g,p,x;if((!t||i(c,u,d[d.length-1]||void 0))&&(h=Ize(r(c,d)),h[0]===aV))return h;if("children"in c&&c.children){const v=c;if(v.children&&h[0]!==Oze)for(p=(n?v.children.length:-1)+o,x=d.concat(v);p>-1&&p<v.children.length;){const b=v.children[p];if(g=l(b,p,x)(),g[0]===aV)return g;p=typeof g[1]=="number"?g[1]:p+o}}return h}}}function Ize(e){return Array.isArray(e)?e:typeof e=="number"?[Pze,e]:e==null?Ule:[e]}function qle(e,t,r,n){let a,i,o;typeof t=="function"&&typeof r!="function"?(i=void 0,o=t,a=r):(i=t,o=r,a=n),Dze(e,i,l,a);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return o(c,f,d)}}const b8={}.hasOwnProperty,Rze={};function Lze(e,t){const r=t||Rze,n=new Map,a=new Map,i=new Map,o={...vze,...r.handlers},l={all:u,applyData:Mze,definitionById:n,footnoteById:a,footnoteCounts:i,footnoteOrder:[],handlers:o,one:c,options:r,patch:Fze,wrap:Bze};return qle(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?n:a,m=String(d.identifier).toUpperCase();f.has(m)||f.set(m,d)}}),l;function c(d,f){const m=d.type,h=l.handlers[m];if(b8.call(l.handlers,m)&&h)return h(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(m)){if("children"in d){const{children:p,...x}=d,v=y4(x);return v.children=l.all(d),v}return y4(d)}return(l.options.unknownHandler||$ze)(l,d,f)}function u(d){const f=[];if("children"in d){const m=d.children;let h=-1;for(;++h<m.length;){const g=l.one(m[h],d);if(g){if(h&&m[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=iV(g.value)),!Array.isArray(g)&&g.type==="element")){const p=g.children[0];p&&p.type==="text"&&(p.value=iV(p.value))}Array.isArray(g)?f.push(...g):f.push(g)}}}return f}}function Fze(e,t){e.position&&(t.position=b$e(e))}function Mze(e,t){let r=t;if(e&&e.data){const n=e.data.hName,a=e.data.hChildren,i=e.data.hProperties;if(typeof n=="string")if(r.type==="element")r.tagName=n;else{const o="children"in r?r.children:[r];r={type:"element",tagName:n,properties:{},children:o}}r.type==="element"&&i&&Object.assign(r.properties,y4(i)),"children"in r&&r.children&&a!==null&&a!==void 0&&(r.children=a)}return r}function $ze(e,t){const r=t.data||{},n="value"in t&&!(b8.call(r,"hProperties")||b8.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bze(e,t){const r=[];let n=-1;for(t&&r.push({type:"text",value:`
`});++n<e.length;)n&&r.push({type:"text",value:`
`}),r.push(e[n]);return t&&e.length>0&&r.push({type:"text",value:`
`}),r}function iV(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function oV(e,t){const r=Lze(e,t),n=r.one(e,void 0),a=Sze(r),i=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return a&&i.children.push({type:"text",value:`
`},a),i}function zze(e,t){return e&&"run"in e?async function(r,n){const a=oV(r,{file:n,...t});await e.run(a,n)}:function(r,n){return oV(r,{file:n,...e||t})}}function lV(e){if(e)throw e}var f5=Object.prototype.hasOwnProperty,Vle=Object.prototype.toString,cV=Object.defineProperty,uV=Object.getOwnPropertyDescriptor,dV=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Vle.call(t)==="[object Array]"},fV=function(t){if(!t||Vle.call(t)!=="[object Object]")return!1;var r=f5.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&f5.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!n)return!1;var a;for(a in t);return typeof a>"u"||f5.call(t,a)},hV=function(t,r){cV&&r.name==="__proto__"?cV(t,r.name,{enumerable:!0,configurable:!0,value:r.newValue,writable:!0}):t[r.name]=r.newValue},mV=function(t,r){if(r==="__proto__")if(f5.call(t,r)){if(uV)return uV(t,r).value}else return;return t[r]},Uze=function e(){var t,r,n,a,i,o,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(r in t)n=mV(l,r),a=mV(t,r),l!==a&&(d&&a&&(fV(a)||(i=dV(a)))?(i?(i=!1,o=n&&dV(n)?n:[]):o=n&&fV(n)?n:{},hV(l,{name:r,newValue:e(d,o,a)})):typeof a<"u"&&hV(l,{name:r,newValue:a}));return l};const zT=jn(Uze);function w8(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)}function qze(){const e=[],t={run:r,use:n};return t;function r(...a){let i=-1;const o=a.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...a);function l(c,...u){const d=e[++i];let f=-1;if(c){o(c);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,d?Vze(d,l)(...u):o(null,...u)}}function n(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Vze(e,t){let r;return n;function n(...o){const l=e.length>o.length;let c;l&&o.push(a);try{c=e.apply(this,o)}catch(u){const d=u;if(l&&r)throw d;return a(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,a):c instanceof Error?a(c):i(c))}function a(o,...l){r||(r=!0,t(o,...l))}function i(o){a(null,o)}}const Sd={basename:Wze,dirname:Hze,extname:Gze,join:Kze,sep:"/"};function Wze(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');l_(e);let r=0,n=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){r=a+1;break}}else n<0&&(i=!0,n=a+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let o=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){r=a+1;break}}else o<0&&(i=!0,o=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(n=a):(l=-1,n=o));return r===n?n=o:n<0&&(n=e.length),e.slice(r,n)}function Hze(e){if(l_(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Gze(e){l_(e);let t=e.length,r=-1,n=0,a=-1,i=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){n=t+1;break}continue}r<0&&(o=!0,r=t+1),l===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||r<0||i===0||i===1&&a===r-1&&a===n+1?"":e.slice(a,r)}function Kze(...e){let t=-1,r;for(;++t<e.length;)l_(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":Yze(r)}function Yze(e){l_(e);const t=e.codePointAt(0)===47;let r=Xze(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Xze(e,t){let r="",n=0,a=-1,i=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(a===o-1||i===1))if(a!==o-1&&i===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),a=o,i=0;continue}}else if(r.length>0){r="",n=0,a=o,i=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(a+1,o):r=e.slice(a+1,o),n=o-a-1;a=o,i=0}else l===46&&i>-1?i++:i=-1}return r}function l_(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Zze={cwd:Jze};function Jze(){return"/"}function j8(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Qze(e){if(typeof e=="string")e=new URL(e);else if(!j8(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return eUe(e)}function eUe(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const UT=["history","path","basename","stem","extname","dirname"];class Wle{constructor(t){let r;t?j8(t)?r={path:t}:typeof t=="string"||tUe(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":Zze.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<UT.length;){const i=UT[n];i in r&&r[i]!==void 0&&r[i]!==null&&(this[i]=i==="history"?[...r[i]]:r[i])}let a;for(a in r)UT.includes(a)||(this[a]=r[a])}get basename(){return typeof this.path=="string"?Sd.basename(this.path):void 0}set basename(t){VT(t,"basename"),qT(t,"basename"),this.path=Sd.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Sd.dirname(this.path):void 0}set dirname(t){pV(this.basename,"dirname"),this.path=Sd.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Sd.extname(this.path):void 0}set extname(t){if(qT(t,"extname"),pV(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Sd.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){j8(t)&&(t=Qze(t)),VT(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Sd.basename(this.path,this.extname):void 0}set stem(t){VT(t,"stem"),qT(t,"stem"),this.path=Sd.join(this.dirname||"",t+(this.extname||""))}fail(t,r,n){const a=this.message(t,r,n);throw a.fatal=!0,a}info(t,r,n){const a=this.message(t,r,n);return a.fatal=void 0,a}message(t,r,n){const a=new jo(t,r,n);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function qT(e,t){if(e&&e.includes(Sd.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Sd.sep+"`")}function VT(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function pV(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function tUe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rUe=function(e){const n=this.constructor.prototype,a=n[e],i=function(){return a.apply(i,arguments)};return Object.setPrototypeOf(i,n),i},nUe={}.hasOwnProperty;class jF extends rUe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=qze()}copy(){const t=new jF;let r=-1;for(;++r<this.attachers.length;){const n=this.attachers[r];t.use(...n)}return t.data(zT(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(GT("data",this.frozen),this.namespace[t]=r,this):nUe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(GT("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);const a=r.call(t,...n);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=dS(t),n=this.parser||this.Parser;return WT("parse",n),n(String(r),r)}process(t,r){const n=this;return this.freeze(),WT("process",this.parser||this.Parser),HT("process",this.compiler||this.Compiler),r?a(void 0,r):new Promise(a);function a(i,o){const l=dS(t),c=n.parse(l);n.run(c,l,function(d,f,m){if(d||!f||!m)return u(d);const h=f,g=n.stringify(h,m);iUe(g)?m.value=g:m.result=g,u(d,m)});function u(d,f){d||!f?o(d):i?i(f):r(void 0,f)}}}processSync(t){let r=!1,n;return this.freeze(),WT("processSync",this.parser||this.Parser),HT("processSync",this.compiler||this.Compiler),this.process(t,a),xV("processSync","process",r),n;function a(i,o){r=!0,lV(i),n=o}}run(t,r,n){gV(t),this.freeze();const a=this.transformers;return!n&&typeof r=="function"&&(n=r,r=void 0),n?i(void 0,n):new Promise(i);function i(o,l){const c=dS(r);a.run(t,c,u);function u(d,f,m){const h=f||t;d?l(d):o?o(h):n(void 0,h,m)}}}runSync(t,r){let n=!1,a;return this.run(t,r,i),xV("runSync","run",n),a;function i(o,l){lV(o),a=l,n=!0}}stringify(t,r){this.freeze();const n=dS(r),a=this.compiler||this.Compiler;return HT("stringify",a),gV(t),a(t,n)}use(t,...r){const n=this.attachers,a=this.namespace;if(GT("use",this.frozen),t!=null)if(typeof t=="function")c(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(a.settings=zT(!0,a.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,m=-1;for(;++f<n.length;)if(n[f][0]===u){m=f;break}if(m===-1)n.push([u,...d]);else if(d.length>0){let[h,...g]=d;const p=n[m][1];w8(p)&&w8(h)&&(h=zT(!0,p,h)),n[m]=[u,h,...g]}}}}const sUe=new jF().freeze();function WT(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function HT(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function GT(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gV(e){if(!w8(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function xV(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function dS(e){return aUe(e)?e:new Wle(e)}function aUe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function iUe(e){return typeof e=="string"||oUe(e)}function oUe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lUe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",vV=[],yV={allowDangerousHtml:!0},cUe=/^(https?|ircs?|mailto|xmpp)$/i,uUe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function _F(e){const t=dUe(e),r=fUe(e);return hUe(t.runSync(t.parse(r),r),e)}function dUe(e){const t=e.rehypePlugins||vV,r=e.remarkPlugins||vV,n=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...yV}:yV;return sUe().use(H9e).use(r).use(zze,n).use(t)}function fUe(e){const t=e.children||"",r=new Wle;return typeof t=="string"&&(r.value=t),r}function hUe(e,t){const r=t.allowedElements,n=t.allowElement,a=t.components,i=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||mUe;for(const d of uUe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+lUe+d.id,void 0);return qle(e,u),S$e(e,{Fragment:s.Fragment,components:a,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function u(d,f,m){if(d.type==="raw"&&m&&typeof f=="number")return o?m.children.splice(f,1):m.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let h;for(h in MT)if(Object.hasOwn(MT,h)&&Object.hasOwn(d.properties,h)){const g=d.properties[h],p=MT[h];(p===null||p.includes(d.tagName))&&(d.properties[h]=c(String(g||""),h,d))}}if(d.type==="element"){let h=r?!r.includes(d.tagName):i?i.includes(d.tagName):!1;if(!h&&n&&typeof f=="number"&&(h=!n(d,f,m)),h&&m&&typeof f=="number")return l&&d.children?m.children.splice(f,1,...d.children):m.children.splice(f,1),f}}}function mUe(e){const t=e.indexOf(":"),r=e.indexOf("?"),n=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||r!==-1&&t>r||n!==-1&&t>n||cUe.test(e.slice(0,t))?e:""}const Ab=10;function pUe({src:e,alt:t,className:r}){const[n,a]=w.useState(!1),[i,o]=w.useState(!1),[l,c]=w.useState(null);return w.useEffect(()=>{if(!l)return;const u=new IntersectionObserver(([d])=>{d.isIntersecting&&(o(!0),u.disconnect())},{rootMargin:"100px"});return u.observe(l),()=>u.disconnect()},[l]),s.jsxs("div",{ref:c,className:"relative overflow-hidden rounded-t-lg",children:[!n&&s.jsx(Yr,{className:"absolute inset-0 w-full h-48"}),i&&s.jsx("img",{src:e,alt:t,loading:"lazy",onLoad:()=>a(!0),className:`${r} ${n?"opacity-100":"opacity-0"} transition-opacity duration-300`})]})}function gUe(){const e=Xt(),[t,r]=w.useState([]),[n,a]=w.useState(!0),[i,o]=w.useState(null),[l,c]=w.useState([]),[u,d]=w.useState(1),[f,m]=w.useState(0),h=Math.ceil(f/Ab),g=w.useCallback(async()=>{a(!0);try{let j=he.from("blog_posts").select("id",{count:"exact",head:!0}).eq("status","published");i&&(j=j.eq("category_id",i));const{count:S}=await j;m(S||0);const I=(u-1)*Ab,P=I+Ab-1;let F=he.from("blog_posts").select("*, blog_categories(name, slug)").eq("status","published").order("published_at",{ascending:!1}).range(I,P);i&&(F=F.eq("category_id",i));const{data:T,error:k}=await F;if(k)throw k;r(T||[])}catch(j){console.error("Error loading posts:",j)}finally{a(!1)}},[u,i]),p=async()=>{try{const{data:j,error:S}=await he.from("blog_categories").select("*").order("name");if(S)throw S;c(j||[])}catch(j){console.error("Error loading categories:",j)}};w.useEffect(()=>{p()},[]),w.useEffect(()=>{g()},[g]);const x=j=>{o(j),d(1)},v=async j=>{const{data:S}=await he.from("blog_posts").select("view_count").eq("id",j).single();S&&await he.from("blog_posts").update({view_count:(S.view_count||0)+1}).eq("id",j)},b=j=>{v(j.id),e(`/blog/${j.slug}`)},y=j=>{d(j),window.scrollTo({top:0,behavior:"smooth"})},N=f===0?0:(u-1)*Ab+1,_=Math.min(u*Ab,f);return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:"Blog - Actualités Formation Professionnelle",description:"Découvrez nos articles sur la formation professionnelle, les compétences pédagogiques et l'actualité du secteur de la formation.",url:"/blog",keywords:["blog formation","actualités pédagogie","articles formateurs"]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 to-primary/5 py-20",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[s.jsx("h1",{className:"text-5xl font-bold mb-6",children:"Blog PedagoBridge"}),s.jsx("p",{className:"text-xl text-muted-foreground",children:"Découvrez nos articles sur la formation professionnelle, les compétences et l'actualité pédagogique"})]})})}),s.jsx("section",{className:"py-8 border-b",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"flex flex-wrap gap-2 justify-center",children:[s.jsx(ne,{variant:i===null?"default":"outline",onClick:()=>x(null),size:"sm",children:"Tous les articles"}),l.map(j=>s.jsx(ne,{variant:i===j.id?"default":"outline",onClick:()=>x(j.id),size:"sm",children:j.name},j.id))]})})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4",children:[!n&&f>0&&s.jsx("div",{className:"mb-8 text-center",children:s.jsxs("p",{className:"text-muted-foreground",children:["Affichage ",s.jsxs("span",{className:"font-semibold text-foreground",children:[N,"-",_]})," sur"," ",s.jsx("span",{className:"font-semibold text-foreground",children:f})," article",f>1?"s":""]})}),n?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:Array.from({length:6}).map((j,S)=>s.jsxs(ke,{className:"overflow-hidden",children:[s.jsx(Yr,{className:"h-48 w-full"}),s.jsxs(ht,{children:[s.jsx(Yr,{className:"h-4 w-20 mb-2"}),s.jsx(Yr,{className:"h-6 w-full"})]}),s.jsxs(Ae,{children:[s.jsx(Yr,{className:"h-4 w-full mb-2"}),s.jsx(Yr,{className:"h-4 w-3/4"})]})]},S))}):t.length===0?s.jsx("div",{className:"text-center py-12",children:s.jsx("p",{className:"text-muted-foreground text-lg",children:"Aucun article publié pour le moment. Revenez bientôt !"})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map(j=>s.jsxs(ke,{className:"hover:shadow-xl transition-all duration-300 cursor-pointer group",onClick:()=>b(j),children:[j.featured_image&&s.jsx(pUe,{src:j.featured_image,alt:j.title,className:"w-full h-48 object-cover group-hover:scale-105 transition-transform duration-300"}),s.jsxs(ht,{children:[s.jsx("div",{className:"flex items-center gap-2 mb-2",children:j.blog_categories&&s.jsx(Le,{variant:"secondary",children:j.blog_categories.name})}),s.jsx(xt,{className:"group-hover:text-primary transition-colors line-clamp-2",children:j.title})]}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-muted-foreground mb-4 line-clamp-3 prose prose-sm max-w-none",children:s.jsx(_F,{children:j.excerpt})}),s.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bs,{className:"h-4 w-4"}),Ot(new Date(j.published_at),"d MMMM yyyy",{locale:yr})]}),s.jsxs(ne,{variant:"ghost",size:"sm",className:"group-hover:text-primary",children:["Lire ",s.jsx(Mn,{className:"ml-1 h-4 w-4"})]})]})]})]},j.id))}),h>1&&s.jsxs("div",{className:"mt-12 flex items-center justify-center gap-2",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>y(u-1),disabled:u===1,className:"gap-1",children:[s.jsx(eC,{className:"h-4 w-4"}),"Précédent"]}),s.jsx("div",{className:"flex items-center gap-1 mx-4",children:Array.from({length:h},(j,S)=>S+1).map(j=>{const S=j===1||j===h||Math.abs(j-u)<=1;return j===2&&u>3||j===h-1&&u<h-2?s.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},j):S?s.jsx(ne,{variant:u===j?"default":"outline",size:"sm",onClick:()=>y(j),className:"w-10",children:j},j):null})}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>y(u+1),disabled:u===h,className:"gap-1",children:["Suivant",s.jsx(tu,{className:"h-4 w-4"})]})]})]}),s.jsx("div",{className:"max-w-2xl mx-auto mt-16",children:s.jsx(bse,{})})]})})]})}function Ap({items:e,className:t=""}){return e.length===0?null:s.jsxs("nav",{"aria-label":"Fil d'Ariane",className:`flex items-center gap-2 text-sm text-muted-foreground ${t}`,children:[s.jsxs(vt,{to:"/",className:"hover:text-primary transition-colors flex items-center gap-1","aria-label":"Retour à l'accueil",children:[s.jsx(pR,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Accueil"})]}),e.map((r,n)=>{const a=n===e.length-1;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(tu,{className:"h-4 w-4"}),a?s.jsx("span",{className:"text-foreground font-medium","aria-current":"page",children:r.name}):s.jsx(vt,{to:r.url,className:"hover:text-primary transition-colors",children:r.name})]},r.url)})]})}function xUe({src:e,alt:t,className:r="",width:n,height:a,priority:i=!1,onLoad:o}){const[l,c]=w.useState(!1),[u,d]=w.useState(i),f=w.useRef(null);w.useEffect(()=>{if(i||!f.current)return;const h=new IntersectionObserver(([g])=>{g.isIntersecting&&(d(!0),h.disconnect())},{rootMargin:"100px",threshold:.01});return h.observe(f.current),()=>h.disconnect()},[i]);const m=()=>{c(!0),o==null||o()};return s.jsxs("div",{ref:f,className:"relative overflow-hidden",children:[!l&&s.jsx(Yr,{className:"absolute inset-0 w-full h-full",style:{aspectRatio:n&&a?`${n}/${a}`:void 0}}),u&&s.jsx("img",{src:e,alt:t,width:n,height:a,loading:i?"eager":"lazy",decoding:"async",onLoad:m,className:`${r} ${l?"opacity-100":"opacity-0"} transition-opacity duration-300`})]})}function vUe(){const{slug:e}=wo(),t=Xt(),[r,n]=w.useState(null),[a,i]=w.useState(!0);w.useEffect(()=>{e&&o()},[e]);const o=async()=>{try{const{data:l,error:c}=await he.from("blog_posts").select(`
*,
blog_categories(name, slug),
blog_post_tags(blog_tags(name, slug))
`).eq("slug",e).eq("status","published").single();if(c)throw c;n(l),await he.from("blog_posts").update({view_count:(l.view_count||0)+1}).eq("id",l.id)}catch(l){console.error("Error loading post:",l)}finally{i(!1)}};return a?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):r?s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:r.meta_title||r.title,description:r.meta_description||r.excerpt,url:`/blog/${r.slug}`,type:"article",image:r.og_image||r.featured_image||void 0,keywords:r.meta_keywords||[],publishedTime:r.published_at}),s.jsx(AL,{headline:r.title,description:r.excerpt,image:r.featured_image||void 0,publishedTime:r.published_at,url:`/blog/${r.slug}`}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Blog",url:"/blog"},...r.blog_categories?[{name:r.blog_categories.name,url:`/blog?category=${r.blog_categories.slug}`}]:[],{name:r.title,url:`/blog/${r.slug}`}]}),s.jsxs("article",{className:"min-h-screen bg-background",children:[s.jsx("div",{className:"container mx-auto px-4 max-w-4xl pt-6",children:s.jsx(Ap,{items:[{name:"Blog",url:"/blog"},...r.blog_categories?[{name:r.blog_categories.name,url:`/blog?category=${r.blog_categories.slug}`}]:[],{name:r.title,url:`/blog/${r.slug}`}]})}),s.jsx("header",{className:"bg-gradient-to-br from-primary/10 to-primary/5 py-12",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-4xl",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/blog"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour au blog"]}),r.blog_categories&&s.jsx(Le,{variant:"secondary",className:"mb-4",children:r.blog_categories.name}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:r.title}),s.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bs,{className:"h-4 w-4"}),Ot(new Date(r.published_at),"d MMMM yyyy",{locale:yr})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(is,{className:"h-4 w-4"}),r.view_count," vues"]})]})]})}),r.featured_image&&s.jsx("div",{className:"container mx-auto px-4 max-w-4xl -mt-8 rounded-lg overflow-hidden shadow-lg",children:s.jsx(xUe,{src:r.featured_image,alt:`Image de couverture illustrant l'article : ${r.title}`,className:"w-full h-96 object-cover",priority:!0})}),s.jsxs("div",{className:"container mx-auto px-4 max-w-4xl py-12",children:[s.jsx("div",{className:"prose prose-lg max-w-none",children:s.jsx(_F,{children:r.content})}),r.blog_post_tags&&r.blog_post_tags.length>0&&s.jsxs("div",{className:"mt-12 pt-8 border-t",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:r.blog_post_tags.map((l,c)=>s.jsx(Le,{variant:"outline",children:l.blog_tags.name},c))})]})]})]})]}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Article non trouvé"}),s.jsxs(ne,{onClick:()=>t("/blog"),children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour au blog"]})]})})}function yUe(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(!1),[h,g]=w.useState(""),[p,x]=w.useState(""),[v,b]=w.useState(""),[y,N]=w.useState("1500"),[_,j]=w.useState(!1),[S,I]=w.useState(!0),[P,F]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&(C(),R(),T())},[t]);const T=async()=>{try{const{data:A,error:O}=await he.from("app_settings").select("value").eq("key","linkedin_credentials").single();!O&&(A!=null&&A.value)&&A.value.access_token&&j(!0)}catch(A){console.error("Error checking LinkedIn connection:",A)}finally{I(!1)}},k=async()=>{try{const O=await(await fetch("https://pedagobridge.com/functions/v1/linkedin-oauth?action=authorize")).json();if(O.authUrl){window.open(O.authUrl,"_blank","width=600,height=700");const U=setInterval(async()=>{await T(),_&&clearInterval(U)},3e3);setTimeout(()=>clearInterval(U),3e5)}}catch(A){console.error("Error connecting LinkedIn:",A),ae.error("Erreur lors de la connexion LinkedIn")}},V=async A=>{F(A.id);try{const{data:O}=await he.auth.getSession(),U=O==null?void 0:O.session;if(!U){ae.error("Session expirée");return}const Y=`${window.location.origin}/blog/${A.slug}`,J=await fetch("https://pedagobridge.com/functions/v1/publish-to-linkedin",{method:"POST",headers:{Authorization:`Bearer ${U.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({postId:A.id,title:A.title,excerpt:A.excerpt,url:Y})}),se=await J.json();if(!J.ok){if(J.status===401)j(!1),ae.error("Token LinkedIn expiré. Veuillez reconnecter votre compte.");else throw new Error(se.error||"Erreur LinkedIn");return}ae.success("Article publié sur LinkedIn !"),C()}catch(O){console.error("Error publishing to LinkedIn:",O),ae.error("Erreur lors de la publication sur LinkedIn")}finally{F(null)}},C=async()=>{try{const{data:A,error:O}=await he.from("blog_posts").select("*, blog_categories(name)").order("created_at",{ascending:!1});if(O)throw O;o(A||[])}catch(A){console.error("Error loading posts:",A),ae.error("Erreur lors du chargement des articles")}finally{a(!1)}},R=async()=>{try{const{data:A,error:O}=await he.from("blog_categories").select("*").order("name");if(O)throw O;c(A||[])}catch(A){console.error("Error loading categories:",A)}},H=async()=>{if(!h.trim()||!p.trim()){ae.error("Veuillez remplir tous les champs requis");return}m(!0);try{const{data:A}=await he.auth.getSession(),O=A==null?void 0:A.session;if(!O){ae.error("Session expirée");return}const U=await fetch("https://pedagobridge.com/functions/v1/generate-blog-post",{method:"POST",headers:{Authorization:`Bearer ${O.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({topic:h,keywords:p.split(",").map(J=>J.trim()),categoryId:v||void 0,targetWordCount:parseInt(y)})});if(!U.ok)throw new Error("Échec de la génération");const Y=await U.json();ae.success("Article généré avec succès !"),d(!1),g(""),x(""),b(""),N("1500"),C()}catch(A){console.error("Error generating post:",A),ae.error("Erreur lors de la génération de l'article")}finally{m(!1)}},q=async A=>{if(confirm("Êtes-vous sûr de vouloir supprimer cet article ?"))try{const{error:O}=await he.from("blog_posts").delete().eq("id",A);if(O)throw O;ae.success("Article supprimé"),C()}catch(O){console.error("Error deleting post:",O),ae.error("Erreur lors de la suppression")}},L=async A=>{try{const{error:O}=await he.from("blog_posts").update({status:"published",published_at:new Date().toISOString(),updated_at:new Date().toISOString()}).eq("id",A);if(O)throw O;ae.success("Article publié !"),C()}catch(O){console.error("Error publishing post:",O),ae.error("Erreur lors de la publication")}};if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});const M=i.filter(A=>A.status==="draft"),z=i.filter(A=>A.status==="scheduled"),K=i.filter(A=>A.status==="published"),E=({post:A})=>s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx(xt,{className:"mb-2",children:A.title}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[A.blog_categories&&s.jsx(Le,{variant:"secondary",children:A.blog_categories.name}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-4 w-4"}),Ot(new Date(A.created_at),"d MMM yyyy",{locale:yr})]})]})]}),s.jsx(Le,{variant:A.status==="published"?"default":A.status==="scheduled"?"secondary":"outline",children:A.status})]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>e(`/blog/${A.slug}`),children:[s.jsx(is,{className:"h-4 w-4 mr-2"}),"Voir"]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>e(`/admin/blog/edit/${A.id}`),children:[s.jsx(QJ,{className:"h-4 w-4 mr-2"}),"Modifier"]}),A.status==="draft"&&s.jsxs(ne,{variant:"default",size:"sm",onClick:()=>L(A.id),children:[s.jsx(Wr,{className:"h-4 w-4 mr-2"}),"Publier"]}),A.status==="published"&&_&&!A.linkedin_post_id&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>V(A),disabled:P===A.id,className:"text-[#0077B5] border-[#0077B5] hover:bg-[#0077B5] hover:text-white",children:[P===A.id?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(Mu,{className:"h-4 w-4 mr-2"}),"LinkedIn"]}),A.linkedin_post_id&&s.jsxs(Le,{variant:"secondary",className:"flex items-center gap-1",children:[s.jsx(Mu,{className:"h-3 w-3"}),"Publié"]}),s.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>q(A.id),children:[s.jsx(bi,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})})]});return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-6xl mx-auto",children:[s.jsx(sa,{items:[{label:"Blog"}]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsx("h1",{className:"text-4xl font-bold",children:"Gestion du Blog"}),s.jsxs("div",{className:"flex items-center gap-3",children:[!S&&(_?s.jsxs(Le,{variant:"secondary",className:"flex items-center gap-1",children:[s.jsx(Mu,{className:"h-4 w-4"}),"LinkedIn connecté"]}):s.jsxs(ne,{variant:"outline",onClick:k,className:"text-[#0077B5] border-[#0077B5] hover:bg-[#0077B5] hover:text-white",children:[s.jsx(Mu,{className:"mr-2 h-4 w-4"}),"Connecter LinkedIn"]})),s.jsxs(Hn,{open:u,onOpenChange:d,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(Uo,{className:"mr-2 h-4 w-4"}),"Générer un article avec IA"]})}),s.jsxs(qn,{children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Générer un article avec IA"}),s.jsx(Ia,{children:"L'IA va générer un article complet et optimisé SEO"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"topic",children:"Sujet de l'article *"}),s.jsx(Ye,{id:"topic",value:h,onChange:A=>g(A.target.value),placeholder:"Ex: Les nouvelles tendances de la formation professionnelle"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"keywords",children:"Mots-clés (séparés par virgule) *"}),s.jsx(Ye,{id:"keywords",value:p,onChange:A=>x(A.target.value),placeholder:"formation, compétences, apprentissage"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"category",children:"Catégorie"}),s.jsxs(Lr,{value:v,onValueChange:b,children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Sélectionner une catégorie"})}),s.jsx(Tr,{children:l.map(A=>s.jsx(ot,{value:A.id,children:A.name},A.id))})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"wordCount",children:"Nombre de mots cible"}),s.jsx(Ye,{id:"wordCount",type:"number",value:y,onChange:A=>N(A.target.value)})]}),s.jsx(ne,{onClick:H,disabled:f,className:"w-full",children:f?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Génération en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Uo,{className:"mr-2 h-4 w-4"}),"Générer l'article"]})})]})]})]})]})]}),s.jsxs(af,{defaultValue:"all",className:"space-y-6",children:[s.jsxs(ad,{children:[s.jsxs(In,{value:"all",children:["Tous (",i.length,")"]}),s.jsxs(In,{value:"published",children:["Publiés (",K.length,")"]}),s.jsxs(In,{value:"scheduled",children:["Programmés (",z.length,")"]}),s.jsxs(In,{value:"draft",children:["Brouillons (",M.length,")"]})]}),s.jsx(Es,{value:"all",className:"space-y-4",children:i.map(A=>s.jsx(E,{post:A},A.id))}),s.jsx(Es,{value:"published",className:"space-y-4",children:K.map(A=>s.jsx(E,{post:A},A.id))}),s.jsx(Es,{value:"scheduled",className:"space-y-4",children:z.map(A=>s.jsx(E,{post:A},A.id))}),s.jsx(Es,{value:"draft",className:"space-y-4",children:M.map(A=>s.jsx(E,{post:A},A.id))})]})]})})}function bUe(){const{id:e}=wo(),t=Xt(),{isAdmin:r,loading:n}=Ur(),[a,i]=w.useState(!0),[o,l]=w.useState(!1),[c,u]=w.useState([]),[d,f]=w.useState(""),[m,h]=w.useState(""),[g,p]=w.useState(""),[x,v]=w.useState(""),[b,y]=w.useState("draft"),[N,_]=w.useState(""),[j,S]=w.useState(""),[I,P]=w.useState("");w.useEffect(()=>{!n&&!r&&t("/auth")},[r,n,t]),w.useEffect(()=>{r&&e&&(F(),T())},[r,e]);const F=async()=>{try{const{data:R,error:H}=await he.from("blog_posts").select("*").eq("id",e).single();if(H)throw H;f(R.title),h(R.slug),p(R.content),v(R.excerpt||""),y(R.status),_(R.category_id||""),S(R.meta_title||""),P(R.meta_description||"")}catch(R){console.error("Error loading post:",R),ae.error("Erreur lors du chargement de l'article")}finally{i(!1)}},T=async()=>{try{const{data:R,error:H}=await he.from("blog_categories").select("*").order("name");if(H)throw H;u(R||[])}catch(R){console.error("Error loading categories:",R)}},k=R=>R.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),V=R=>{f(R),(!m||m===k(d))&&h(k(R))},C=async()=>{if(!d.trim()||!g.trim()){ae.error("Le titre et le contenu sont requis");return}l(!0);try{const R={title:d,slug:m,content:g,excerpt:x,status:b,category_id:N||null,meta_title:j,meta_description:I,updated_at:new Date().toISOString()};if(b==="published"){const{data:q}=await he.from("blog_posts").select("published_at").eq("id",e).single();q!=null&&q.published_at||(R.published_at=new Date().toISOString())}const{error:H}=await he.from("blog_posts").update(R).eq("id",e);if(H)throw H;ae.success("Article enregistré avec succès"),t("/admin/blog")}catch(R){console.error("Error saving post:",R),ae.error(R.message||"Erreur lors de l'enregistrement")}finally{l(!1)}};return n||a?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-4xl mx-auto",children:[s.jsxs("div",{className:"mb-8",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/admin/blog"),className:"mb-4",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour aux articles"]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h1",{className:"text-4xl font-bold",children:"Modifier l'article"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:()=>window.open(`/blog/${m}`,"_blank"),disabled:!m,children:[s.jsx(is,{className:"mr-2 h-4 w-4"}),"Aperçu"]}),s.jsx(ne,{onClick:C,disabled:o,children:o?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Enregistrement..."]}):s.jsxs(s.Fragment,{children:[s.jsx(JJ,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})})]})]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{children:"Contenu principal"})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"title",children:"Titre *"}),s.jsx(Ye,{id:"title",value:d,onChange:R=>V(R.target.value),placeholder:"Titre de l'article"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"slug",children:"URL (slug) *"}),s.jsx(Ye,{id:"slug",value:m,onChange:R=>h(R.target.value),placeholder:"url-de-l-article"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"excerpt",children:"Extrait"}),s.jsx(gn,{id:"excerpt",value:x,onChange:R=>v(R.target.value),placeholder:"Court résumé de l'article",rows:3})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"content",children:"Contenu * (Markdown supporté)"}),s.jsx(gn,{id:"content",value:g,onChange:R=>p(R.target.value),placeholder:"Contenu de l'article en Markdown...",rows:15,className:"font-mono"})]})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{children:"Paramètres de publication"})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"status",children:"Statut *"}),s.jsxs(Lr,{value:b,onValueChange:y,children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"draft",children:"Brouillon"}),s.jsx(ot,{value:"published",children:"Publié"}),s.jsx(ot,{value:"scheduled",children:"Programmé"})]})]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"category",children:"Catégorie"}),s.jsxs(Lr,{value:N,onValueChange:_,children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Sélectionner une catégorie"})}),s.jsx(Tr,{children:c.map(R=>s.jsx(ot,{value:R.id,children:R.name},R.id))})]})]})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{children:"SEO"})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"metaTitle",children:"Meta titre"}),s.jsx(Ye,{id:"metaTitle",value:j,onChange:R=>S(R.target.value),placeholder:"Titre pour les moteurs de recherche"}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[j.length,"/60 caractères"]})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"metaDescription",children:"Meta description"}),s.jsx(gn,{id:"metaDescription",value:I,onChange:R=>P(R.target.value),placeholder:"Description pour les moteurs de recherche",rows:3}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[I.length,"/160 caractères"]})]})]})]})]})]})})}function wUe(){const e=Xt(),{user:t,isTrainer:r,loading:n}=Ur(),[a,i]=w.useState(!0),[o,l]=w.useState(null),[c,u]=w.useState([]),d=w.useRef(null),[f,m]=w.useState(!1),[h,g]=w.useState(!1),[p,x]=w.useState(!1),[v,b]=w.useState(!1);w.useEffect(()=>{const T=d.current;if(!T)return;const k=T.getContext("2d");k&&(k.fillStyle="#ffffff",k.fillRect(0,0,T.width,T.height),k.strokeStyle="#1f2937",k.lineWidth=2,k.lineCap="round",k.lineJoin="round")},[o]);const y=T=>{const k=d.current;if(!k)return{x:0,y:0};const V=k.getBoundingClientRect();return{x:(T.clientX-V.left)*(k.width/V.width),y:(T.clientY-V.top)*(k.height/V.height)}},N=T=>{var R;const k=(R=d.current)==null?void 0:R.getContext("2d");if(!k)return;m(!0);const{x:V,y:C}=y(T);k.beginPath(),k.moveTo(V,C)},_=T=>{var R;if(!f)return;const k=(R=d.current)==null?void 0:R.getContext("2d");if(!k)return;const{x:V,y:C}=y(T);k.lineTo(V,C),k.stroke(),g(!0)},j=()=>{const T=d.current,k=T==null?void 0:T.getContext("2d");!k||!T||(k.fillStyle="#ffffff",k.fillRect(0,0,T.width,T.height),g(!1))},S=async()=>{if(!p){ae.error("Veuillez cocher la case de confirmation");return}if(!h){ae.error("Veuillez signer dans le cadre ci-dessus");return}if(o){b(!0);try{const T=d.current.toDataURL("image/png"),{error:k}=await he.from("trainer_contracts").update({status:"signed",signature_data:T,signed_at:new Date().toISOString()}).eq("id",o.id);if(k)throw k;l(V=>V&&{...V,status:"signed",signature_data:T}),ae.success("Contrat signé ! L'équipe PedagoBridge va contre-signer sous 48h. Vous serez notifié.")}catch(T){console.error(T),ae.error("Erreur lors de la signature")}finally{b(!1)}}};w.useEffect(()=>{!n&&!r&&e("/auth")},[r,n,e]),w.useEffect(()=>{r&&t&&I()},[r,t]);const I=async()=>{try{if(!t)return;const{data:T}=await he.from("trainer_profiles").select("id").eq("user_id",t.id).single();if(!T){ae.error("Profil formateur non trouvé");return}const{data:k,error:V}=await he.from("trainer_contracts").select("*").eq("trainer_id",T.id).maybeSingle();if(V)throw V;l(k),k&&P(k.contract_data)}catch(T){console.error("Error loading contract:",T),ae.error("Erreur lors du chargement du contrat")}finally{i(!1)}},P=T=>{const k=[];T.legalForm||k.push("Forme juridique"),T.capitalAmount||k.push("Montant du capital"),T.headquartersAddress||k.push("Adresse du siège social"),T.legalRepresentativeName||k.push("Nom du représentant légal"),T.legalRepresentativeFunction||k.push("Fonction du représentant légal"),T.siret||k.push("Numéro SIRET"),u(k)},F=async()=>{if(o)try{const T=new or,k=T.internal.pageSize.getWidth(),V=T.internal.pageSize.getHeight(),C=15,R=k-C*2;let H=C;const q=(Y=8)=>{H+Y>V-C&&(T.addPage(),H=C)},L=(Y,J={})=>{const{bold:se=!1,size:ee=9,indent:ie=0,lineGap:Ee=4}=J;T.setFontSize(ee),T.setFont("helvetica",se?"bold":"normal"),T.splitTextToSize(Y,R-ie).forEach(Ue=>{q(ee*.5+Ee),T.text(Ue,C+ie,H),H+=ee*.35+Ee}),H+=1},M=(Y,J,se)=>{q(14),H+=3,T.setFontSize(10),T.setFont("helvetica","bold"),T.text(`Article ${Y} : ${J}`,C,H),H+=6,se(),H+=2},z=(Y,J=5)=>{T.setFontSize(9),T.setFont("helvetica","normal");const se=T.splitTextToSize(Y,R-J-4);q(se.length*5),T.text("•",C+J,H),se.forEach((ee,ie)=>{T.text(ee,C+J+4,H),ie<se.length-1&&(H+=4.5)}),H+=5},K=o.contract_data;T.setFillColor(30,64,175),T.rect(0,0,k,32,"F"),T.setTextColor(255,255,255),T.setFontSize(16),T.setFont("helvetica","bold"),T.text("CONTRAT DE SOUS-TRAITANCE",k/2,16,{align:"center"}),T.setFontSize(10),T.text("PedagoBridge — Qalam Software",k/2,25,{align:"center"}),T.setTextColor(0,0,0),H=40;const E=o.signed_contract_url?"CONTRAT SIGNÉ":"EN ATTENTE DE SIGNATURE",A=o.signed_contract_url?[34,197,94]:[245,158,11];T.setFillColor(A[0],A[1],A[2]),T.setTextColor(255,255,255),T.roundedRect(C,H,75,7,1.5,1.5,"F"),T.setFontSize(8),T.text(E,C+37.5,H+4.8,{align:"center"}),T.setTextColor(0,0,0),H+=13,L("ENTRE LES SOUSSIGNÉS :",{bold:!0,size:11}),H+=2,L("Qalam Software",{bold:!0,size:10,indent:4}),L("40 rue Alexandre Dumas 75011 Paris",{indent:4}),L("SIRET : 91318083200010",{indent:4}),L("NDA : 11756723075 (Préfecture Île-de-France)",{indent:4}),L("Fondateur du collectif PedagoBridge",{indent:4}),L("Ci-après désigné comme « le Donneur d'Ordre ».",{indent:4}),H+=3,L("ET",{bold:!0,size:10}),H+=2,L(`${K.legalForm||K.trainerName} (Le Sous-Traitant)`,{bold:!0,size:10,indent:4}),K.headquartersAddress&&L(`Adresse : ${K.headquartersAddress}`,{indent:4}),K.siret&&L(`SIRET : ${K.siret}`,{indent:4}),K.activityDeclarationNumber&&L(`NDA : ${K.activityDeclarationNumber} (${K.activityDeclarationRegion||""})`,{indent:4}),K.legalRepresentativeName&&L(`Représenté(e) par : ${K.legalRepresentativeName}${K.legalRepresentativeFunction?", "+K.legalRepresentativeFunction:""}`,{indent:4}),L("Désigné(e) ci-après comme « le Formateur » ou « le Sous-traitant ».",{indent:4}),H+=4,L("Il est convenu ce qui suit :",{bold:!0}),H+=4,M(1,"Nature du contrat",()=>{L("Ce contrat définit les termes de la collaboration annuelle entre le Donneur d'Ordre et le Sous-Traitant pour la réalisation de prestations de formation. Ce partenariat s'appuie sur des bons de commande spécifiques émis pour chaque mission de formation.")}),M(2,"Objet du contrat",()=>{L("L'objet de ce contrat est d'établir une relation de sous-traitance pour la réalisation de formations diverses, selon les besoins identifiés par le Donneur d'Ordre. La nature spécifique, le contenu, les dates et les horaires de chaque formation seront définis dans des bons de commande distincts.")}),M(3,"Durée du contrat",()=>{L("Le présent contrat est valable pour une durée d'un an à compter de sa signature et est renouvelable par tacite reconduction, sauf dénonciation par l'une des parties avec un préavis de 3 mois avant la date d'expiration.")}),M(4,"Obligations du Donneur d'Ordre",()=>{L("Le Donneur d'Ordre s'engage à :"),z("Fournir au Sous-Traitant toutes les informations nécessaires à la réalisation des formations."),z("Émettre des bons de commande pour chaque formation spécifique, précisant les conditions de réalisation et de rémunération."),z("Assurer le paiement des prestations réalisées conformément aux bons de commande."),z("Assurer la conformité pédagogique et la qualité des prestations."),z("Gérer les plannings et la logistique des missions."),z("Collaborer avec le sous-traitant pour assurer la conformité légale des actions de formation."),z("Garantir la validité de son NDA en soumettant le Bilan Pédagogique et Financier conformément à la législation en vigueur."),z("Représenter Le Sous-Traitant auprès des écoles dans le cadre des missions confiées, conformément au mandat octroyé.")}),M(5,"Obligations du Sous-Traitant",()=>{L("Le Sous-Traitant s'engage à :"),z("Réaliser les formations conformément aux exigences du Donneur d'Ordre et aux standards de qualité en vigueur."),z("Communiquer les besoins matériels et logistiques en amont de chaque formation."),z("Assurer la confidentialité des informations partagées dans le cadre des formations."),z("Respecter les dispositions relatives à la qualité et à l'évaluation des formations."),z("Mettre en copie Qalam Software (contact-pedagobridge@qalamsoftware.com) de tout échange e-mail avec le client final."),z("Être à jour de ses déclarations fiscales et des dispositions prévues par la législation pour exercer son activité."),z("Communiquer tout document administratif nécessaire à la réalisation de la mission."),H+=2,L("Documents requis :",{bold:!0}),z("Auto Entrepreneur : Avis de Situation SIRENE, Attestation de Vigilance"),z("Société sans employés : Kbis, Attestation sur l'honneur de régularité fiscale"),z("Société avec employés : Kbis, Attestation de régularité fiscale"),H+=2,L("Le Sous-Traitant s'engage à transmettre dans un délai de 15 jours ouvrés après chaque mission : les supports pédagogiques, les feuilles d'émargement signées, les résultats d'évaluation ou de certification si applicable, et tout autre élément demandé.")}),M(6,"Force majeure",()=>{L("En cas de force majeure (art. 1218 du Code civil), les obligations des parties seront suspendues pendant la durée de l'événement. Chaque partie devra informer l'autre dans les meilleurs délais. Si l'empêchement dépasse 30 jours consécutifs, chaque partie pourra résilier le contrat par notification écrite sans indemnité.")}),M(7,"Résiliation anticipée",()=>{L("1. Résiliation pour faute grave : En cas de faute grave avérée, l'autre partie pourra résilier avec effet immédiat, après notification écrite précisant les manquements constatés.",{indent:2}),H+=1,L("2. Résiliation pour non-conformité : Si le Sous-Traitant ne respecte pas les objectifs fixés, le Donneur d'Ordre pourra résilier après une mise en demeure restée sans effet dans un délai de 7 jours ouvrés.",{indent:2}),H+=1,L("3. Résiliation amiable : Les parties peuvent convenir d'une résiliation amiable par écrit à tout moment.",{indent:2}),H+=1,L("4. Résiliation pour force majeure prolongée : Si un cas de force majeure dure plus de 30 jours consécutifs, chacune des parties pourra résilier par notification écrite, sans indemnité.",{indent:2})}),M(8,"Modalités financières et remboursement des frais",()=>{L("Modalités financières :",{bold:!0}),z("La rémunération du Sous-Traitant pour chaque formation sera spécifiée dans le bon de commande correspondant."),z("Les factures doivent être transmises avant le 5 du mois suivant les prestations réalisées."),K.activityDeclarationNumber&&z(`En cas de NDA, la facture doit porter la mention : NDA ${K.activityDeclarationNumber} accordé par le préfet de ${K.activityDeclarationRegion||"[Région]"} et « TVA non applicable – art. 293 B du CGI ».`),z("Les paiements seront effectués 5 jours après réception par Qalam du paiement du client final."),H+=2,L("Paiement lié aux financements CPF :",{bold:!0}),z("Dans le cadre d'une formation financée par le CPF, le paiement est conditionné au versement effectif des fonds par la Caisse des Dépôts à QALAM SOFTWARE. Le règlement interviendra dans un délai de 10 à 30 jours calendaires."),z("En cas de non-passage à la certification par le bénéficiaire sans motif valable, aucun paiement ne pourra être garanti."),H+=2,L("Remboursement des frais professionnels :",{bold:!0}),z("Frais de déplacement : Remboursés sur présentation des justificatifs, sous réserve d'une validation préalable."),z("Repas : Remboursés à hauteur de 25 € maximum par repas, uniquement dans le cadre de formations Qalam Software."),z("Hébergement : Remboursés dans la limite de 100 € par nuitée (sur présentation des justificatifs).")}),M(9,"Pénalités de retard",()=>{L("En cas de retard significatif dans la réalisation des prestations, le Donneur d'Ordre se réserve le droit d'évaluer la situation et de négocier une éventuelle compensation. Toute pénalité devra être proportionnée aux dommages réels subis et faire l'objet d'un accord écrit entre les parties.")}),M(10,"Bons de commande",()=>{L("Pour chaque mission de formation, un bon de commande sera émis par le Donneur d'Ordre, détaillant l'objet, la durée, la rémunération et les conditions spécifiques de la prestation. Chaque bon de commande, une fois accepté par le Sous-Traitant, devient partie intégrante du présent contrat.")}),M(11,"Confidentialité et RGPD",()=>{z("Le Sous-Traitant s'engage à respecter la confidentialité des informations partagées dans le cadre du contrat, y compris après la fin de celui-ci, pour une durée de trois ans."),z("Le Sous-Traitant s'engage à se conformer aux dispositions du RGPD pour la protection des données personnelles de QALAM SOFTWARE, de ses partenaires et clients."),z("Une charte RGPD pourra être annexée au contrat, et le Sous-Traitant devra la signer pour formaliser son engagement."),z("En cas de non-respect, le Donneur d'Ordre se réserve le droit de suspendre ou résilier le contrat.")}),M(12,"Clause de non-concurrence",()=>{L("Le sous-traitant s'engage expressément à ne pas contractualiser directement, ni indirectement, avec un Établissement Client pour la réalisation d'une mission dont le besoin a été identifié, qualifié ou apporté par Qalam dans le cadre du présent contrat."),H+=2,L("Cette interdiction porte uniquement sur le besoin spécifique concerné et ne confère à Qalam aucun droit d'exclusivité sur l'établissement Client pour d'autres besoins futurs."),H+=2,L("Cette interdiction s'applique pendant toute la durée du présent contrat et pendant une période de douze (12) mois suivant sa cessation, quelle qu'en soit la cause.")}),M(13,"Dispositions diverses",()=>{z("Les parties conviennent que ce contrat ne crée aucun lien de subordination entre le Donneur d'Ordre et le Sous-Traitant."),z("Le Sous-Traitant conserve la propriété intellectuelle sur les contenus de formation développés, sauf accord contraire spécifié dans un bon de commande."),z("Le Sous-Traitant s'engage à respecter les valeurs et les objectifs définis sur le site web pedagobridge.com, collectif détenu par Qalam Software."),z("Le Sous-Traitant s'engage à respecter les obligations légales et déontologiques qui en découlent.")}),M(14,"Communication et collaboration interne",()=>{L("Le Sous-Traitant s'engage à répondre aux communications internes dans un délai raisonnable et à collaborer avec les autres intervenants du Collectif PedagoBridge. Toute communication se fera par e-mail ou via le site web pedagobridge.com sauf indication contraire formulée par écrit."),H+=2,L("En cas de demande urgente, le Sous-Traitant s'engage à utiliser le standard téléphonique mis à disposition par le Donneur d'Ordre.")}),M(15,"Engagement Qualiopi",()=>{L("Dans le cadre de l'éventuelle certification Qualiopi détenue par Qalam Software, le Sous-Traitant s'engage à respecter les exigences liées à cette certification, notamment en matière de traçabilité, d'émargement, d'évaluation des acquis, de gestion des réclamations et d'amélioration continue. Le respect de ces obligations pourra faire l'objet de vérifications régulières par le Donneur d'Ordre.")}),M(16,"Clause de dérogation - Absence de NDA",()=>{L("Par dérogation aux conditions générales du présent contrat, si le Sous-traitant déclare expressément ne pas être titulaire d'un NDA :"),H+=1,L("1. Régime Fiscal : Le Sous-Traitant reconnaît qu'il ne peut prétendre à l'exonération de TVA liée à la formation professionnelle. Il s'engage à facturer ses prestations avec application de la TVA au taux en vigueur.",{indent:4}),H+=1,L("2. Responsabilité : Le Sous-Traitant intervient sous la seule responsabilité administrative et pédagogique du donneur d'ordre, détenteur du NDA pour la mission.",{indent:4}),H+=1,L("3. Indépendance : Le Sous-Traitant certifie que cette absence de NDA ne constitue pas un obstacle à l'exercice de son activité.",{indent:4}),H+=1,L("4. Rémunération : Le montant indiqué sur le BDC est entendu Toutes Taxes Comprises (TTC). La TVA s'inclut dans ce montant et ne peut s'y ajouter.",{indent:4})}),M(17,"Résolution des différends",()=>{L("1. Les éventuels différends relatifs à l'exécution ou à l'interprétation du présent contrat seront soumis à une tentative de résolution amiable avant tout recours judiciaire.",{indent:2}),H+=1,L("2. En cas de désaccord persistant, les litiges seront de la compétence exclusive des tribunaux compétents du siège social du Donneur d'Ordre.",{indent:2})}),M(18,"Modification du contrat",()=>{L("Toute modification ou ajout au présent contrat devra faire l'objet d'un accord écrit signé par les deux parties. Cet avenant précisera les nouvelles dispositions ainsi que leur entrée en vigueur.")}),q(40),H+=6,T.setDrawColor(200,200,200),T.line(C,H,k-C,H),H+=8;const O=new Date(o.created_at).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"});L(`Fait à Paris, le ${O}, en deux exemplaires originaux.`),H+=8;const U=k/2+5;T.setFontSize(9),T.setFont("helvetica","bold"),T.text("Signature du Donneur d'Ordre :",C,H),T.text("Signature du Sous-Traitant :",U,H),H+=5,T.setFont("helvetica","normal"),T.text("Président de Qalam Software",C,H),T.text(`${K.legalRepresentativeFunction||"[Fonction]"} — ${K.legalForm||"[Raison sociale]"}`,U,H),H+=5,T.text("Mekouar Ayoub",C,H),T.text(K.legalRepresentativeName||K.trainerName,U,H),H+=15,T.setDrawColor(100,100,100),T.line(C,H,C+70,H),T.line(U,H,U+70,H),T.save(`contrat_sous_traitance_${K.trainerName.replace(/\s/g,"_")}_${Ot(new Date,"yyyy-MM-dd")}.pdf`),ae.success("Contrat complet téléchargé en PDF")}catch(T){console.error("Error generating PDF:",T),ae.error("Erreur lors de la génération du PDF")}};return n||a?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):o?s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Mon Contrat de Sous-Traitance",description:"Consultez votre contrat de sous-traitance avec PedagoBridge - Qalam Software.",url:"/trainer/contract",noindex:!0}),s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-4xl mx-auto space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h1",{className:"text-4xl font-bold",children:"Contrat de Sous-Traitance"}),s.jsxs("div",{className:"flex items-center gap-3",children:[o.signed_contract_url?s.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[s.jsx(Pn,{className:"h-5 w-5"}),s.jsx("span",{className:"font-semibold",children:"Contrat signé"})]}):s.jsxs("div",{className:"flex items-center gap-2 text-amber-600",children:[s.jsx(Gr,{className:"h-5 w-5"}),s.jsx("span",{className:"font-semibold",children:"En attente de signature"})]}),s.jsxs(ne,{onClick:F,variant:"outline",size:"sm",children:[s.jsx(Ho,{className:"h-4 w-4 mr-2"}),"Télécharger le PDF"]})]})]}),o.signed_contract_url&&s.jsxs(bw,{className:"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-900",children:[s.jsx(Gt,{className:"h-4 w-4 text-green-600"}),s.jsx(u5,{className:"text-green-800 dark:text-green-200",children:"Contrat signé disponible"}),s.jsxs(ww,{className:"text-green-700 dark:text-green-300",children:["Votre contrat signé a été uploadé par l'administration.",s.jsxs("a",{href:o.signed_contract_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-primary hover:underline mt-2 font-medium",children:[s.jsx(Gt,{className:"h-4 w-4"}),"Voir le contrat signé",s.jsx(vs,{className:"h-3 w-3"})]})]})]}),c.length>0&&!o.signed_contract_url&&s.jsxs(bw,{variant:"destructive",children:[s.jsx(Di,{className:"h-4 w-4"}),s.jsx(u5,{children:"Informations juridiques incomplètes"}),s.jsxs(ww,{children:["Pour finaliser votre contrat, vous devez compléter les informations suivantes dans votre profil :",s.jsx("ul",{className:"list-disc list-inside mt-2",children:c.map((T,k)=>s.jsx("li",{children:T},k))}),s.jsx(ne,{onClick:()=>e("/trainer/profile"),variant:"outline",size:"sm",className:"mt-3",children:"Compléter mon profil"})]})]}),s.jsx("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-r from-primary/5 to-secondary/5 p-5",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"p-2 rounded-full bg-primary/10 shrink-0",children:s.jsx(Kd,{className:"h-5 w-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-base mb-1",children:"Signez le contrat pour apparaître en premier"}),s.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Les formateurs dont le contrat est signé et contre-signé par PedagoBridge obtiennent le badge"," ",s.jsxs("span",{className:"inline-flex items-center gap-1 text-primary font-medium",children:[s.jsx(yp,{className:"h-3.5 w-3.5"})," Certifié"]})," ","et sont affichés ",s.jsx("strong",{children:"en priorité"})," dans tous les résultats de recherche et les pages ville."]}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-green-700",children:[s.jsx(Pn,{className:"h-4 w-4"}),s.jsx("span",{children:"Priorité dans les résultats"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-green-700",children:[s.jsx(iu,{className:"h-4 w-4"}),s.jsx("span",{children:'Badge "Certifié" sur votre profil'})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-green-700",children:[s.jsx(Kd,{className:"h-4 w-4"}),s.jsx("span",{children:"Plus de visibilité auprès des écoles"})]})]})]})]})}),!o.signature_data&&o.status!=="signed"&&!o.signed_contract_url&&c.length===0&&s.jsxs(ke,{className:"border-primary/30",children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"Signer le contrat en ligne"})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Signez dans le cadre ci-dessous (stylet ou souris). Une fois signé, l'équipe PedagoBridge contre-signera sous 48h et vous obtiendrez le statut Certifié."}),s.jsx("div",{className:"border-2 border-dashed border-muted rounded-lg overflow-hidden bg-white",children:s.jsx("canvas",{ref:d,width:600,height:150,className:"w-full cursor-crosshair touch-none",onPointerDown:N,onPointerMove:_,onPointerUp:()=>m(!1),onPointerLeave:()=>m(!1)})}),s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Signez ci-dessus avec votre souris ou stylet"}),s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:j,children:"Effacer"})]}),s.jsxs("div",{className:"flex items-start gap-3 pt-2",children:[s.jsx(Vo,{id:"accept-contract",checked:p,onCheckedChange:T=>x(T===!0)}),s.jsx(We,{htmlFor:"accept-contract",className:"text-sm leading-relaxed cursor-pointer",children:"J'ai lu et j'accepte l'intégralité du contrat de sous-traitance ci-dessus. Je confirme que les informations de mon profil sont exactes."})]}),s.jsx(ne,{className:"w-full",onClick:S,disabled:v||!h||!p,children:v?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Signature en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Pn,{className:"mr-2 h-4 w-4"}),"Signer le contrat"]})})]})]}),o.status==="signed"&&!o.signed_contract_url&&s.jsxs(bw,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20",children:[s.jsx(Gr,{className:"h-4 w-4 text-amber-600"}),s.jsx(u5,{className:"text-amber-800 dark:text-amber-200",children:"Contrat signé — contre-signature en attente"}),s.jsx(ww,{className:"text-amber-700 dark:text-amber-300",children:"Votre signature a bien été enregistrée. L'équipe PedagoBridge va contre-signer sous 48h. Vous recevrez une notification dès que votre statut Certifié sera activé."})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{children:"Contrat de Sous-Traitance"})}),s.jsx(Ae,{className:"space-y-6",children:s.jsxs("div",{className:"prose max-w-none space-y-6",children:[s.jsx("h2",{className:"text-center text-xl font-bold mb-8",children:"CONTRAT DE SOUS-TRAITANCE"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm",children:"Entre les soussignés :"}),s.jsxs("p",{className:"text-sm",children:[s.jsx("strong",{children:"Qalam Software"}),", domicilié au 40 rue Alexandre Dumas 75011 Paris, immatriculé sous le numéro SIRET 91318083200010, enregistré comme organisme de formation avec le numéro de déclaration d'activité : 11756723075 auprès de la Préfecture de la Région d'Île-de-France, et fondateur du collectif PedagoBridge."]}),s.jsxs("p",{className:"text-sm",children:["désigné par la suite comme « ",s.jsx("strong",{children:"le donneur d'ordre"})," »."]}),s.jsx("p",{className:"text-sm",children:"Et"}),s.jsx("p",{className:"text-sm",children:s.jsx("strong",{children:o.contract_data.legalForm||"[Nom de l'entreprise ou Nom prénom du formateur si Auto Entrepreneur]"})}),s.jsxs("p",{className:"text-sm",children:["Adresse : ",o.contract_data.headquartersAddress||"[À compléter]"]}),s.jsxs("p",{className:"text-sm",children:["Immatriculé sous le numéro SIRET : ",o.contract_data.siret||"[À compléter]"]}),s.jsxs("p",{className:"text-sm",children:["Numéro de déclaration d'activité : ",o.contract_data.activityDeclarationNumber||"[À compléter si applicable]"]}),s.jsxs("p",{className:"text-sm",children:["Représenté(e) par ",o.contract_data.legalRepresentativeName||o.contract_data.trainerName||"[Nom Prénom]",o.contract_data.legalRepresentativeFunction?`, ${o.contract_data.legalRepresentativeFunction}`:"",","]}),s.jsxs("p",{className:"text-sm",children:["Désigné(e) ci-après comme « ",s.jsx("strong",{children:"le Formateur"})," » ou « ",s.jsx("strong",{children:"le Sous-traitant"})," »."]}),s.jsx("p",{className:"text-sm font-medium",children:"Il est convenu ce qui suit :"})]}),s.jsxs("div",{className:"space-y-6 mt-8",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 1 : Nature du contrat"}),s.jsx("p",{className:"text-sm",children:"Ce contrat définit les termes de la collaboration annuelle entre le Donneur d'Ordre et le Sous-Traitant pour la réalisation de prestations de formation."}),s.jsx("p",{className:"text-sm mt-2",children:"Ce partenariat s'appuie sur des bons de commande spécifiques émis pour chaque mission de formation."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 2 : Objet du contrat"}),s.jsx("p",{className:"text-sm",children:"L'objet de ce contrat est d'établir une relation de sous-traitance pour la réalisation de formations diverses, selon les besoins identifiés par le Donneur d'Ordre. La nature spécifique, le contenu, les dates, et les horaires de chaque formation seront définis dans des bons de commande distincts."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 3 : Durée du contrat"}),s.jsx("p",{className:"text-sm",children:"Le présent contrat est valable pour une durée d'un an à compter de sa signature et est renouvelable par tacite reconduction, sauf dénonciation par l'une des parties avec un préavis de 3 mois avant la date d'expiration."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 4 : Obligations du Donneur d'Ordre"}),s.jsx("p",{className:"text-sm mb-2",children:"Le Donneur d'Ordre s'engage à :"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsx("li",{children:"Fournir au Sous-Traitant toutes les informations nécessaires à la réalisation des formations."}),s.jsx("li",{children:"Émettre des bons de commande pour chaque formation spécifique, précisant les conditions de réalisation et de rémunération."}),s.jsx("li",{children:"Assurer le paiement des prestations réalisées conformément aux bons de commande."}),s.jsx("li",{children:"Assurer la conformité pédagogique et la qualité des prestations."}),s.jsx("li",{children:"Gérer les plannings et la logistique des missions."}),s.jsx("li",{children:"Collaborer avec le sous-traitant pour assurer la conformité légale des actions de formation."}),s.jsx("li",{children:"Garantir la validité de son NDA en soumettant le Bilan Pédagogique et Financier conformément à la législation en vigueur."}),s.jsx("li",{children:"Représenter Le Sous-Traitant auprès des écoles dans le cadre des missions confiées, conformément au mandat octroyé."})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 5 : Obligations du Sous-Traitant"}),s.jsx("p",{className:"text-sm mb-2",children:"Le Sous-Traitant s'engage à :"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsx("li",{children:"Réaliser les formations conformément aux exigences du Donneur d'Ordre et aux standards de qualité en vigueur."}),s.jsx("li",{children:"Communiquer les besoins matériels et logistiques en amont de chaque formation."}),s.jsx("li",{children:"Assurer la confidentialité des informations partagées dans le cadre des formations."}),s.jsx("li",{children:"Respecter les dispositions relatives à la qualité et à l'évaluation des formations, conformément aux exigences du Donneur d'Ordre."}),s.jsx("li",{children:"Mettre en copie Qalam Software (contact-pedagobridge@qalamsoftware.com) de tout échange e-mail avec le client final et tenir Qalam Software au courant des informations échangées et jugées importantes par écrit."}),s.jsx("li",{children:"Être à jour de ses déclarations fiscales et des dispositions prévues par la législation pour exercer son activité."}),s.jsx("li",{children:"Communiquer tout document administratif nécessaire à la réalisation de la mission."})]}),s.jsxs("div",{className:"mt-4 p-4 bg-muted/30 rounded-lg",children:[s.jsx("h4",{className:"font-semibold text-sm mb-2",children:"Documents requis :"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Auto Entrepreneur:"})," L'Avis de Situation SIRENE, Attestation de Vigilance"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Société sans employés:"})," Kbis, Attestation sur l'honneur de régularité fiscale"]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Société avec employés:"})," Kbis, Attestation de régularité fiscale"]})]})]}),s.jsx("p",{className:"text-sm mt-4",children:"Le Sous-Traitant s'engage à transmettre, dans un délai de quinze (15) jours ouvrés après la fin de chaque mission, l'ensemble des documents suivants :"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm mt-2",children:[s.jsx("li",{children:"Les supports pédagogiques mis à disposition des stagiaires"}),s.jsx("li",{children:"Les feuilles d'émargement signées (ou émargement numérique validé)"}),s.jsx("li",{children:"Les résultats d'évaluation ou de certification si applicable"}),s.jsx("li",{children:"Tout autre élément demandé dans le cadre de la mission"}),s.jsx("li",{children:"Communiquer toute information ou document demandés directement par le client final"})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 6 : Force majeure"}),s.jsx("p",{className:"text-sm",children:"En cas de force majeure, telle que définie par l'article 1218 du Code civil, les obligations des parties seront suspendues pendant la durée de l'événement empêchant leur exécution. Chaque partie devra informer l'autre partie dans les meilleurs délais, en précisant la nature de l'événement et son impact sur l'exécution du contrat. Si l'empêchement se prolonge au-delà de 30 jours consécutifs, chaque partie pourra résilier le contrat par notification écrite sans indemnité."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 7 : Résiliation anticipée"}),s.jsxs("p",{className:"text-sm mb-2",children:[s.jsx("strong",{children:"1. Résiliation pour faute grave :"})," En cas de faute grave avérée de l'une des parties (non-respect des obligations essentielles, retards répétés, atteinte à la réputation), l'autre partie pourra résilier le contrat avec effet immédiat, après notification écrite précisant les manquements constatés."]}),s.jsxs("p",{className:"text-sm mb-2",children:[s.jsx("strong",{children:"2. Résiliation pour non-conformité aux objectifs :"})," Si le Sous-Traitant ne respecte pas les objectifs fixés (interactions, délais, livrables), le Donneur d'Ordre pourra résilier le contrat après une mise en demeure restée sans effet dans un délai de 7 jours ouvrés."]}),s.jsxs("p",{className:"text-sm mb-2",children:[s.jsx("strong",{children:"3. Résiliation amiable :"})," Les parties peuvent convenir d'une résiliation amiable par écrit à tout moment."]}),s.jsxs("p",{className:"text-sm",children:[s.jsx("strong",{children:"4. Résiliation pour force majeure prolongée :"})," Si un cas de force majeure dure plus de 30 jours consécutifs, chacune des parties pourra résilier le contrat par notification écrite, sans indemnité."]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 8 : Modalités financières et remboursement des frais professionnels"}),s.jsx("h4",{className:"font-semibold text-sm mt-3 mb-1",children:"Modalités financières :"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsx("li",{children:"La rémunération du Sous-Traitant pour chaque formation sera spécifiée dans le bon de commande correspondant à la mission."}),s.jsx("li",{children:"Les factures doivent être transmises avant le 5 du mois suivant les prestations réalisées."}),s.jsxs("li",{children:["En cas de NDA, cette facture doit porter la mention obligatoire : Numéro de déclaration d'activité : ",o.contract_data.activityDeclarationNumber||"[Numéro]"," accordé par le préfet de ",o.contract_data.activityDeclarationRegion||"[Région du NDA]"," et « TVA non applicable – art. 293 B du CGI »."]}),s.jsx("li",{children:"Les paiements seront effectués 5 jours après réception par Qalam du paiement du client final."})]}),s.jsx("h4",{className:"font-semibold text-sm mt-3 mb-1",children:"Paiement lié aux financements CPF :"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsx("li",{children:"Dans le cadre d'une formation financée par le CPF, le paiement de la prestation du Sous-Traitant est conditionné au versement effectif des fonds par la Caisse des Dépôts à QALAM SOFTWARE. Le règlement interviendra dans un délai de 10 à 30 jours calendaires à compter de la réception desdits fonds."}),s.jsx("li",{children:"En cas de non-passage à la certification par le bénéficiaire sans motif valable, aucun paiement ne pourra être garanti."})]}),s.jsx("h4",{className:"font-semibold text-sm mt-3 mb-1",children:"Remboursement des frais professionnels :"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Frais de déplacement :"})," Les frais directement liés aux missions pourront être remboursés sur présentation des justificatifs, sous réserve d'une validation préalable par le Donneur d'Ordre."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Repas :"})," Les repas pris lors des déplacements seront remboursés à hauteur de 25 € maximum par repas, uniquement dans le cadre de formations inter ou intra proposées par Qalam Software."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Hébergement :"})," Remboursés dans la limite de 100 € par nuitée (sur présentation des justificatifs)."]})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 9 : Pénalités de retard"}),s.jsx("p",{className:"text-sm",children:"En cas de retard significatif dans la livraison ou la réalisation des prestations convenues dans le bon de commande, le Donneur d'Ordre se réserve le droit d'évaluer la situation et de négocier une éventuelle compensation avec le Sous-Traitant. Toute pénalité devra être proportionnée aux dommages réels subis et faire l'objet d'un accord écrit entre les parties."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 10 : Bons de commande"}),s.jsx("p",{className:"text-sm",children:"Pour chaque mission de formation, un bon de commande sera émis par le Donneur d'Ordre, détaillant l'objet, la durée, la rémunération et les conditions spécifiques de la prestation. Chaque bon de commande, une fois accepté par le Sous-Traitant, devient partie intégrante du présent contrat."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 11 : Confidentialité et RGPD"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsx("li",{children:"Le Sous-Traitant s'engage à respecter la confidentialité des informations et données partagées dans le cadre du contrat, y compris après la fin de celui-ci, pour une durée de trois ans."}),s.jsx("li",{children:"Le Sous-Traitant s'engage à se conformer aux dispositions du RGPD pour la protection des données personnelles de QALAM SOFTWARE, de ses partenaires et clients."}),s.jsx("li",{children:"Une charte RGPD pourra être annexée au contrat, et le Sous-Traitant devra la signer pour formaliser son engagement."}),s.jsx("li",{children:"En cas de non-respect des obligations liées à la confidentialité ou au RGPD, le Donneur d'Ordre se réserve le droit de prendre des mesures correctives, pouvant inclure une suspension temporaire ou la résiliation du contrat."})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 12 : Clause de non-concurrence"}),s.jsx("p",{className:"text-sm mb-2",children:"Le sous-traitant s'engage expressément à ne pas contractualiser directement, ni indirectement, avec un Établissement Client pour la réalisation d'une mission de formation ou d'une prestation de même nature dont le besoin a été identifié, qualifié ou apporté par Qalam dans le cadre du présent contrat."}),s.jsx("p",{className:"text-sm mb-2",children:"Il est expressément convenu que cette interdiction porte uniquement sur le besoin spécifique concerné et ne confère à Qalam aucun droit d'exclusivité sur l'établissement Client, lequel conserve toute liberté de contractualiser avec le sous-traitant pour d'autres besoins en formation futurs et différents par nature."}),s.jsx("p",{className:"text-sm",children:"Cette interdiction s'applique pendant toute la durée du présent contrat et pendant une période de douze (12) mois suivant sa cessation, quelle qu'en soit la cause."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 13 : Dispositions diverses"}),s.jsxs("ul",{className:"list-disc pl-6 space-y-1 text-sm",children:[s.jsx("li",{children:"Les parties conviennent que ce contrat ne crée aucun lien de subordination entre le Donneur d'Ordre et le Sous-Traitant."}),s.jsx("li",{children:"Le Sous-Traitant conserve la propriété intellectuelle sur les contenus de formation développés, sauf accord contraire spécifié dans un bon de commande."}),s.jsx("li",{children:"Le Sous-Traitant s'engage à respecter les valeurs et les objectifs définis sur le site web de Pédago Bridge (pedagobridge.com), collectif détenu par Qalam Software."}),s.jsx("li",{children:"Le Sous-Traitant s'engage à respecter les obligations légales et déontologiques qui en découlent."})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 14 : Communication et collaboration interne"}),s.jsx("p",{className:"text-sm mb-2",children:"Le Sous-Traitant s'engage à répondre aux communications internes dans un délai raisonnable et à collaborer avec les autres intervenants du Collectif PedagoBridge le cas échéant. Toute communication entre les parties se fera par e-mail ou via le site web pedagobridge.com sauf indication contraire formulée par écrit."}),s.jsx("p",{className:"text-sm",children:"En cas de demande urgente ou de besoin particulier, le Sous-Traitant s'engage à utiliser le standard téléphonique mis à disposition par le Donneur d'Ordre. Le numéro du standard est indiqué dans le livret d'accueil, sur le site internet ou communiqué par e-mail."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 15 : Engagement Qualiopi"}),s.jsx("p",{className:"text-sm",children:"Dans le cadre de l'éventuelle certification Qualiopi détenue par Qalam Software, le Sous-Traitant s'engage à respecter les exigences liées à cette certification, notamment en matière de traçabilité, d'émargement, d'évaluation des acquis, de gestion des réclamations et d'amélioration continue."}),s.jsx("p",{className:"text-sm mt-2",children:"Le respect de ces obligations pourra faire l'objet de vérifications régulières par le Donneur d'Ordre."})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 16 : Clause de dérogation - Absence de NDA"}),s.jsx("p",{className:"text-sm mb-2",children:"Par dérogation aux conditions générales du présent contrat prévoyant la détention d'un Numéro de Déclaration d'Activité (NDA), si le Sous-traitant déclare expressément ne pas en être titulaire. En conséquence :"}),s.jsxs("ol",{className:"list-decimal pl-6 space-y-2 text-sm",children:[s.jsxs("li",{children:[s.jsx("strong",{children:"Régime Fiscal :"}),` Le Sous-Traitant reconnaît qu'il ne peut prétendre à l'exonération de TVA liée à la formation professionnelle. Il s'engage à facturer ses prestations avec application de la TVA au taux en vigueur (ou avec la mention "Art. 293 B du CGI" s'il bénéficie de la franchise en base).`]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Responsabilité :"})," Le Sous-Traitant intervient sous la seule responsabilité administrative et pédagogique du donneur d'ordre, détenteur du NDA pour la mission."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Indépendance :"})," Le Sous-Traitant certifie que cette absence de NDA ne constitue pas un obstacle à l'exercice de son activité de conseil ou d'animation de sessions de cours pour le compte de tiers."]}),s.jsxs("li",{children:[s.jsx("strong",{children:"Rémunération :"})," Le montant indiqué sur le BDC est entendu Toutes Taxes Comprises (TTC). La TVA au taux en vigueur s'inclut alors dans ce montant et ne peut s'y ajouter."]})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 17 : Résolution des différends"}),s.jsxs("ol",{className:"list-decimal pl-6 space-y-1 text-sm",children:[s.jsx("li",{children:"Les éventuels différends relatifs à l'exécution ou à l'interprétation du présent contrat seront soumis à une tentative de résolution amiable avant tout recours judiciaire."}),s.jsx("li",{children:"En cas de désaccord persistant, les litiges seront de la compétence exclusive des tribunaux compétents du siège social du Donneur d'Ordre."})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-base mb-2",children:"Article 18 : Modification du contrat"}),s.jsx("p",{className:"text-sm",children:"Toute modification ou ajout au présent contrat devra faire l'objet d'un accord écrit signé par les deux parties. Cet avenant précisera les nouvelles dispositions ainsi que leur entrée en vigueur."})]})]}),s.jsxs("div",{className:"mt-8 pt-6 border-t space-y-6",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Fait à Paris, le ",new Date(o.created_at).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}),", en deux exemplaires originaux."]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold mb-1",children:"Signature du donneur d'ordre :"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Président de Qalam Software"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Mekouar Ayoub"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold mb-1",children:"Signature du sous-traitant :"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.contract_data.legalRepresentativeFunction||"[Fonction]"," - ",o.contract_data.legalForm||"[Raison sociale]"]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:o.contract_data.legalRepresentativeName||o.contract_data.trainerName||"[Nom Prénom]"})]})]})]})]})})]})]})})]}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsx("div",{className:"container max-w-4xl mx-auto",children:s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{children:"Aucun contrat disponible"})}),s.jsxs(Ae,{children:[s.jsx("p",{className:"text-muted-foreground",children:"Votre contrat sera généré automatiquement après validation de votre profil par l'équipe PedagoBridge."}),s.jsx(ne,{onClick:()=>e("/trainer/profile"),className:"mt-4",children:"Retour au profil"})]})]})})})}function jUe(){const[e,t]=w.useState(!1);return{applyToOffer:async(a,i)=>{t(!0);try{const{data:{user:o}}=await he.auth.getUser();if(!o)return ae.error("Vous devez être connecté pour postuler"),{success:!1,error:"Not authenticated"};const{data:l,error:c}=await he.from("trainer_profiles").select("id, status").eq("user_id",o.id).single();if(c||!l)return ae.error("Vous devez avoir un profil formateur pour postuler"),{success:!1,error:"No trainer profile"};if(l.status!=="approved")return ae.error("Votre profil formateur doit être validé pour postuler"),{success:!1,error:"Profile not approved"};const{data:u}=await he.from("trainer_applications").select("id").eq("trainer_id",l.id).eq("school_request_id",a).maybeSingle();if(u)return ae.error("Vous avez déjà postulé à cette offre"),{success:!1,error:"Already applied"};const{data:d,error:f}=await he.from("trainer_applications").insert({trainer_id:l.id,school_request_id:a,message:i||null,status:"pending"}).select().single();if(f)throw f;try{await he.functions.invoke("notify-trainer-application",{body:{applicationId:d.id,schoolRequestId:a,trainerId:l.id,message:i||void 0}})}catch(m){console.error("Error sending notification email:",m)}return xi.trackApplicationSent(a,l.id),ae.success("Candidature envoyée avec succès !"),{success:!0}}catch(o){return console.error("Error applying to offer:",o),ae.error("Erreur lors de l'envoi de la candidature"),{success:!1,error:o.message}}finally{t(!1)}},checkIfApplied:async a=>{try{const{data:{user:i}}=await he.auth.getUser();if(!i)return!1;const{data:o}=await he.from("trainer_profiles").select("id").eq("user_id",i.id).maybeSingle();if(!o)return!1;const{data:l}=await he.from("trainer_applications").select("id").eq("trainer_id",o.id).eq("school_request_id",a).maybeSingle();return!!l}catch{return!1}},applying:e}}function _8({offerId:e,offerTitle:t,schoolName:r,onSuccess:n,disabled:a,hasApplied:i}){const[o,l]=w.useState(!1),[c,u]=w.useState(""),{applyToOffer:d,applying:f}=jUe(),m=async()=>{(await d(e,c)).success&&(l(!1),u(""),n==null||n())};return i?s.jsxs(ne,{disabled:!0,variant:"outline",className:"gap-2",children:[s.jsx(Wr,{className:"h-4 w-4 text-green-500"}),"Déjà postulé"]}):s.jsxs(Hn,{open:o,onOpenChange:l,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{disabled:a,children:[s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Postuler"]})}),s.jsxs(qn,{className:"sm:max-w-[500px]",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Postuler à cette offre"}),s.jsxs(Ia,{children:["Candidature pour l'offre de ",s.jsx("strong",{children:r})]})]}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx("div",{className:"bg-muted/50 rounded-lg p-3",children:s.jsx("p",{className:"text-sm font-medium line-clamp-2",children:t})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"message",children:"Message de candidature (optionnel)"}),s.jsx(gn,{id:"message",placeholder:"Présentez votre motivation et votre expérience pertinente pour cette offre...",value:c,onChange:h=>u(h.target.value),rows:5}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"L'établissement recevra votre candidature avec votre profil formateur."})]})]}),s.jsxs(Jl,{children:[s.jsx(ne,{variant:"outline",onClick:()=>l(!1),children:"Annuler"}),s.jsx(ne,{onClick:m,disabled:f,children:f?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Envoyer ma candidature"]})})]})]})]})}function _Ue(){const e=Xt(),{user:t,isTrainer:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(new Set),[f,m]=w.useState([]),[h,g]=w.useState(0),[p,x]=w.useState(""),[v,b]=w.useState("all"),[y,N]=w.useState("all"),[_,j]=w.useState("all"),[S,I]=w.useState("relevance"),[P,F]=w.useState({});w.useEffect(()=>{V(),t&&r&&(T(),k())},[t,r]),w.useEffect(()=>{H()},[i,p,v,y,_,S,f]);const T=async()=>{try{const{data:O}=await he.from("trainer_profiles").select("id").eq("user_id",t==null?void 0:t.id).maybeSingle();if(!O)return;const{data:U}=await he.from("trainer_applications").select("school_request_id").eq("trainer_id",O.id);U&&d(new Set(U.map(Y=>Y.school_request_id)))}catch(O){console.error("Error loading applied offers:",O)}},k=async()=>{try{const{data:O}=await he.from("trainer_profiles").select("specialties").eq("user_id",t==null?void 0:t.id).maybeSingle();O!=null&&O.specialties&&m(O.specialties)}catch(O){console.error("Error loading trainer specialties:",O)}},V=async()=>{try{const{data:O,error:U}=await he.from("school_requests").select("*, view_count, is_sponsored, sponsored_until, city, address, modality").eq("status","approved").eq("is_filled",!1).order("created_at",{ascending:!1});if(U)throw U;const Y=new Date;Y.setHours(0,0,0,0);const J=[];let se=0;(O||[]).forEach(ie=>{if(!ie.end_date)J.push(ie);else{const Ee=new Date(ie.end_date);Ee.setHours(23,59,59,999),Ee>=Y?J.push(ie):se++}}),o(J),g(se);const ee={};J.forEach(ie=>{ee[ie.id]=ie.view_count||0}),F(ee)}catch(O){console.error("Error loading offers:",O),ae.error("Erreur lors du chargement des offres")}finally{a(!1)}},C=O=>{if(f.length===0)return 0;const U=O.subject_areas.map(se=>se.toLowerCase()),Y=f.map(se=>se.toLowerCase());let J=0;for(const se of Y)for(const ee of U)(ee.includes(se)||se.includes(ee))&&J++;return J},R=O=>!O.is_sponsored||!O.sponsored_until?!1:new Date(O.sponsored_until)>new Date,H=()=>{let O=[...i];if(p.trim()){const U=p.toLowerCase();O=O.filter(Y=>Y.school_name.toLowerCase().includes(U)||Y.description.toLowerCase().includes(U)||Y.subject_areas.some(J=>J.toLowerCase().includes(U))||Y.training_needs&&Y.training_needs.some(J=>J.toLowerCase().includes(U)))}switch(v!=="all"&&(O=O.filter(U=>U.subject_areas.includes(v))),y!=="all"&&(O=O.filter(U=>{var Y;return((Y=U.city)==null?void 0:Y.toLowerCase())===y.toLowerCase()})),_!=="all"&&(O=O.filter(U=>U.modality===_)),S){case"relevance":O.sort((U,Y)=>{const J=R(U)?1:0,se=R(Y)?1:0;if(se!==J)return se-J;const ee=C(U),ie=C(Y);return ie!==ee?ie-ee:new Date(Y.created_at).getTime()-new Date(U.created_at).getTime()});break;case"recent":O.sort((U,Y)=>{const J=R(U)?1:0,se=R(Y)?1:0;return se!==J?se-J:new Date(Y.created_at).getTime()-new Date(U.created_at).getTime()});break;case"views":O.sort((U,Y)=>{const J=R(U)?1:0,se=R(Y)?1:0;return se!==J?se-J:(P[Y.id]||0)-(P[U.id]||0)});break}c(O)},q=["Informatique","Santé & Sécurité au Travail","Management","Pédagogie","Ressources Humaines","Technique & Industrie","Marketing & Communication","Finance & Comptabilité","Langues","Développement Personnel"],L=()=>{const O={};i.forEach(Y=>{Y.subject_areas.forEach(J=>{O[J]=(O[J]||0)+1})});const U=new Set([...q]);return i.forEach(Y=>{Y.subject_areas.forEach(J=>U.add(J))}),Array.from(U).map(Y=>({name:Y,count:O[Y]||0})).sort((Y,J)=>J.count!==Y.count?J.count-Y.count:Y.name.localeCompare(J.name))},M=()=>{const O={};return i.forEach(U=>{U.city&&(O[U.city]=(O[U.city]||0)+1)}),Object.entries(O).map(([U,Y])=>({name:U,count:Y})).sort((U,Y)=>Y.count-U.count)},z=O=>{const U=new Date(O.created_at);return Math.floor((new Date().getTime()-U.getTime())/(1e3*60*60*24))<=7},K=O=>{if(!O.start_date)return!1;const U=new Date(O.start_date),Y=new Date,J=Math.floor((U.getTime()-Y.getTime())/(1e3*60*60*24));return J>=0&&J<=14},E=O=>{if(!O.start_date)return null;const U=new Date(O.start_date),Y=new Date;return Math.floor((U.getTime()-Y.getTime())/(1e3*60*60*24))},A=O=>O?new Date(O).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):"Date à définir";return n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:"Offres de Formation Professionnelle",description:"Découvrez les offres de formation : informatique, management, langues et plus. Trouvez des missions adaptées à votre expertise.",url:"/training-offers",keywords:["offres formation","missions formateur","opportunités formation"]}),s.jsx("div",{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-b",children:s.jsx("div",{className:"container mx-auto px-4 py-8 md:py-16",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-6",children:[s.jsxs("div",{className:"max-w-3xl",children:[s.jsx("h1",{className:"text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-bold mb-3 md:mb-4",children:"Trouvez les offres d'interventions qui vous correspondent"}),s.jsx("p",{className:"text-base md:text-lg text-muted-foreground",children:"Découvrez les opportunités de formation proposées par nos établissements partenaires"})]}),s.jsxs(ne,{onClick:()=>e("/training-request"),size:"lg",className:"w-full md:w-auto shrink-0 bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary/70 shadow-lg hover:shadow-xl transition-all text-lg px-8 py-6",children:[s.jsx(Ya,{className:"mr-2 h-5 w-5"}),"Postez votre offre"]})]})})}),s.jsxs("div",{className:"container mx-auto px-4 py-4 md:py-8",children:[s.jsx(ke,{className:"mb-4 md:mb-8",children:s.jsx(Ae,{className:"p-4 md:p-6",children:s.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[s.jsx("div",{className:"w-full",children:s.jsxs("div",{className:"relative",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Mots clés",value:p,onChange:O=>x(O.target.value),className:"pl-10"})]})}),s.jsxs("div",{className:"hidden lg:flex gap-4",children:[s.jsxs(Lr,{value:v,onValueChange:b,children:[s.jsx(Ar,{className:"w-64",children:s.jsx(Br,{placeholder:"Domaine d'expertise"})}),s.jsxs(Tr,{className:"max-h-80",children:[s.jsxs(ot,{value:"all",children:["Tous les domaines (",i.length,")"]}),L().map(({name:O,count:U})=>s.jsxs(ot,{value:O,children:[O," ",U>0&&s.jsxs("span",{className:"text-muted-foreground",children:["(",U,")"]})]},O))]})]}),s.jsxs(Lr,{value:y,onValueChange:N,children:[s.jsx(Ar,{className:"w-48",children:s.jsx(Br,{placeholder:"Ville"})}),s.jsxs(Tr,{className:"max-h-80",children:[s.jsx(ot,{value:"all",children:"Toutes les villes"}),M().map(({name:O,count:U})=>s.jsxs(ot,{value:O,children:[O," (",U,")"]},O))]})]}),s.jsxs(Lr,{value:_,onValueChange:j,children:[s.jsx(Ar,{className:"w-48",children:s.jsx(Br,{placeholder:"Modalité"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Toutes modalités"}),s.jsx(ot,{value:"presentiel",children:"Présentiel"}),s.jsx(ot,{value:"distanciel",children:"Distanciel"}),s.jsx(ot,{value:"hybride",children:"Hybride"})]})]}),s.jsxs(Lr,{value:S,onValueChange:O=>I(O),children:[s.jsxs(Ar,{className:"w-48",children:[s.jsx(LO,{className:"h-4 w-4 mr-2"}),s.jsx(Br,{placeholder:"Trier par"})]}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"relevance",children:s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Uo,{className:"h-4 w-4"}),"Pertinence"]})}),s.jsx(ot,{value:"recent",children:"Plus récentes"}),s.jsx(ot,{value:"views",children:"Plus consultées"})]})]})]}),s.jsxs(JR,{children:[s.jsx(QR,{asChild:!0,children:s.jsxs(ne,{variant:"outline",className:"lg:hidden w-full",children:[s.jsx(Yve,{className:"mr-2 h-4 w-4"}),"Filtres avancés"]})}),s.jsxs(NC,{children:[s.jsxs(SC,{children:[s.jsx(kC,{children:"Filtres"}),s.jsx(Mte,{children:"Affinez votre recherche d'offres"})]}),s.jsx("div",{className:"space-y-4 mt-6",children:s.jsx(ne,{variant:"ghost",className:"w-full",onClick:()=>{x(""),b("all"),N("all")},children:"Réinitialiser les filtres"})})]})]})]})})}),s.jsxs("div",{className:"mb-4 md:mb-6 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 sm:gap-4",children:[s.jsxs("h2",{className:"text-xl md:text-2xl font-bold",children:["Offres de formation (",l.length,")"]}),h>0&&s.jsxs(Le,{variant:"secondary",className:"text-muted-foreground",children:[s.jsx(Gr,{className:"h-3 w-3 mr-1"}),h," offre",h>1?"s":""," passée",h>1?"s":""]})]}),s.jsx("div",{className:"grid gap-4 md:gap-6 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:l.map(O=>s.jsx(ke,{className:`hover:shadow-lg transition-all cursor-pointer group ${R(O)?"ring-2 ring-amber-400 bg-amber-50/50 dark:bg-amber-950/20":""}`,onClick:()=>e(`/training-offers/${O.id}`),children:s.jsxs(Ae,{className:"p-4 md:p-6",children:[s.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[R(O)&&s.jsxs(Le,{className:"bg-amber-500 hover:bg-amber-600 text-white",children:[s.jsx(pv,{className:"h-3 w-3 mr-1"}),"Sponsorisée"]}),z(O)&&s.jsxs(Le,{className:"bg-green-500 hover:bg-green-600 text-white",children:[s.jsx(Uo,{className:"h-3 w-3 mr-1"}),"Nouvelle"]}),K(O)&&s.jsxs(Le,{className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(Eve,{className:"h-3 w-3 mr-1"}),E(O)===0?"Aujourd'hui":`Dans ${E(O)}j`]}),O.visibility==="public"?s.jsxs(Le,{variant:"outline",className:"border-blue-500 text-blue-600",children:[s.jsx(Ky,{className:"h-3 w-3 mr-1"}),"Publique"]}):s.jsxs(Le,{variant:"outline",className:"border-purple-500 text-purple-600",children:[s.jsx(sr,{className:"h-3 w-3 mr-1"}),"Formateurs"]})]}),s.jsxs("div",{className:"flex items-start justify-between mb-4",children:[s.jsxs("h3",{className:"text-xl font-bold group-hover:text-primary transition-colors line-clamp-2",children:[O.description.substring(0,60),"..."]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground shrink-0 ml-2",children:[s.jsx(is,{className:"h-4 w-4"}),s.jsx("span",{children:P[O.id]||0})]})]}),s.jsxs("div",{className:"space-y-2 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Gs,{className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"line-clamp-1",children:O.city?`${O.city} - ${O.school_name}`:O.school_name})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Bs,{className:"h-4 w-4 shrink-0"}),s.jsxs("span",{children:["Le ",A(O.start_date)]})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[s.jsx(Le,{variant:"secondary",className:"text-xs",children:O.modality==="distanciel"?"Distanciel":O.modality==="hybride"?"Hybride":"Présentiel"}),O.duration_hours&&s.jsxs(Le,{variant:"secondary",className:"text-xs",children:[O.duration_hours,"h"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[O.subject_areas.slice(0,3).map((U,Y)=>s.jsx(Le,{variant:"outline",className:"text-xs bg-primary/10 text-primary border-primary/20",children:U},Y)),O.subject_areas.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",O.subject_areas.length-3]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-6 pt-4 border-t",children:[r&&s.jsx("div",{onClick:U=>U.stopPropagation(),className:"flex-1",children:s.jsx(_8,{offerId:O.id,offerTitle:O.description,schoolName:O.school_name,hasApplied:u.has(O.id),onSuccess:()=>d(U=>new Set([...U,O.id]))})}),s.jsx(ne,{size:"sm",className:"flex-1",onClick:U=>{U.stopPropagation(),e(`/training-offers/${O.id}`)},children:"Voir l'offre"})]})]})},O.id))}),l.length===0&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx("p",{className:"text-muted-foreground text-lg",children:"Aucune offre ne correspond à vos critères"}),s.jsx(ne,{variant:"outline",className:"mt-4",onClick:()=>{x(""),b("all"),N("all")},children:"Réinitialiser les filtres"})]})]})]})}function NUe({offerId:e,offerTitle:t}){const r=Xt(),[n,a]=w.useState([]),[i,o]=w.useState(!1),[l,c]=w.useState(!1),[u,d]=w.useState(null),f=async()=>{o(!0),d(null);try{const{data:g,error:p}=await he.functions.invoke("recommend-trainers",{body:{offerId:e}});if(p)throw p;if(g.error)throw new Error(g.error);a(g.recommendations||[]),c(!0)}catch(g){console.error("Error loading recommendations:",g),d(g instanceof Error?g.message:"Erreur lors du chargement"),ae.error("Erreur lors du chargement des recommandations")}finally{o(!1)}},m=g=>g>=80?"text-green-600 bg-green-100 dark:bg-green-900/30":g>=60?"text-blue-600 bg-blue-100 dark:bg-blue-900/30":g>=40?"text-orange-600 bg-orange-100 dark:bg-orange-900/30":"text-muted-foreground bg-muted",h=g=>g>=80?"Excellent match":g>=60?"Bon match":g>=40?"Match potentiel":"Match faible";return s.jsxs(ke,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent",children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Uo,{className:"h-5 w-5 text-primary"}),"Formateurs Recommandés",s.jsxs(Le,{variant:"secondary",className:"ml-2",children:[s.jsx(Vc,{className:"h-3 w-3 mr-1"}),"Certifiés PedagoBridge"]})]}),s.jsx(Qr,{children:"Recommandations IA basées sur le matching CV/offre pour les formateurs qui ont signé le contrat PedagoBridge"})]}),s.jsxs(Ae,{children:[!l&&!i&&s.jsxs("div",{className:"text-center py-6",children:[s.jsx(Uo,{className:"h-10 w-10 mx-auto mb-3 text-primary/50"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Obtenez des recommandations personnalisées de formateurs certifiés pour cette offre"}),s.jsxs(ne,{onClick:f,children:[s.jsx(Uo,{className:"mr-2 h-4 w-4"}),"Générer les recommandations"]})]}),i&&s.jsxs("div",{className:"text-center py-8",children:[s.jsx(at,{className:"h-8 w-8 animate-spin mx-auto mb-3 text-primary"}),s.jsx("p",{className:"text-muted-foreground",children:"Analyse en cours..."}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"L'IA analyse les profils des formateurs certifiés"})]}),u&&s.jsxs("div",{className:"text-center py-6",children:[s.jsx("p",{className:"text-destructive mb-4",children:u}),s.jsxs(ne,{variant:"outline",onClick:f,children:[s.jsx(yo,{className:"mr-2 h-4 w-4"}),"Réessayer"]})]}),l&&!i&&n.length===0&&s.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[s.jsx(qo,{className:"h-10 w-10 mx-auto mb-3 opacity-50"}),s.jsx("p",{children:"Aucun formateur certifié correspondant trouvé"}),s.jsx("p",{className:"text-sm mt-1",children:"Consultez l'annuaire pour voir tous les formateurs disponibles"})]}),l&&!i&&n.length>0&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(ne,{variant:"ghost",size:"sm",onClick:f,children:[s.jsx(yo,{className:"mr-2 h-4 w-4"}),"Actualiser"]})}),n.map((g,p)=>s.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-lg border bg-card hover:shadow-md transition-shadow",children:[s.jsxs("div",{className:"relative",children:[s.jsxs(ps,{className:"h-14 w-14",children:[s.jsx(vi,{src:g.trainer.photo_url||void 0,alt:g.trainer.name}),s.jsx(gs,{className:"bg-primary/10",children:g.trainer.name.split(" ").map(x=>x[0]).join("").toUpperCase()})]}),p===0&&s.jsx("div",{className:"absolute -top-1 -right-1 bg-amber-500 rounded-full p-1",children:s.jsx(yp,{className:"h-3 w-3 text-white"})})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold flex items-center gap-2",children:[g.trainer.name,s.jsxs(Le,{variant:"outline",className:"text-xs",children:[s.jsx(Vc,{className:"h-3 w-3 mr-1"}),"Certifié"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[g.trainer.specialties.slice(0,3).map((x,v)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:x},v)),g.trainer.specialties.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",g.trainer.specialties.length-3]})]})]}),s.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full text-sm font-medium ${m(g.score)}`,children:[s.jsx(iu,{className:"h-4 w-4"}),g.score,"%"]})]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-2 line-clamp-2",children:g.reason}),s.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>r(`/trainers/${g.trainer.id}`),children:[s.jsx(is,{className:"mr-1.5 h-3.5 w-3.5"}),"Voir le profil"]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:h(g.score)})]})]})]},g.trainerId)),s.jsx("div",{className:"mt-4 p-3 bg-muted/50 rounded-lg text-sm text-muted-foreground",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Vc,{className:"h-4 w-4 mt-0.5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-foreground",children:"Avantages des formateurs certifiés"}),s.jsxs("ul",{className:"mt-1 space-y-0.5 text-xs",children:[s.jsx("li",{children:"• Assurance qualité PedagoBridge"}),s.jsx("li",{children:"• Documents vérifiés et conformes"}),s.jsx("li",{children:"• Accompagnement administratif inclus"}),s.jsx("li",{children:"• Certification Qualiopi garantie"})]})]})]})})]})]})]})}function SUe(){const{id:e}=wo(),t=Xt(),{user:r,isTrainer:n,isSchool:a}=Ur(),[i,o]=w.useState(!0),[l,c]=w.useState(null),[u,d]=w.useState(!1),[f,m]=w.useState(!1);w.useEffect(()=>{e&&(h(),r&&n&&g())},[e,r,n]);const h=async()=>{try{const{data:b,error:y}=await he.from("school_requests").select("*, city, address, modality, user_id").eq("id",e).single();if(y)throw y;c(b),await he.rpc("increment_offer_view",{offer_id:b.id}),xi.trackOfferView(b.id,b.description),r&&b.user_id===r.id&&m(!0)}catch(b){console.error("Error loading offer:",b),ae.error("Erreur lors du chargement de l'offre"),t("/training-offers")}finally{o(!1)}},g=async()=>{try{const{data:b}=await he.from("trainer_profiles").select("id").eq("user_id",r==null?void 0:r.id).single();if(!b)return;const{data:y}=await he.from("trainer_applications").select("id").eq("trainer_id",b.id).eq("school_request_id",e).single();d(!!y)}catch{d(!1)}},p=b=>b?new Date(b).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):"À définir",x=()=>{l&&(window.location.href=`mailto:${l.contact_email}?subject=Candidature pour la formation ${l.school_name}&body=Bonjour ${l.contact_name},
Je suis intéressé(e) par l'offre de formation concernant : ${l.description.substring(0,100)}...
Cordialement,`)};if(i)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});if(!l)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg text-muted-foreground mb-4",children:"Offre introuvable"}),s.jsx(ne,{onClick:()=>t("/training-offers"),children:"Retour aux offres"})]})});const v=b=>{switch(b){case"presentiel":return"OnSiteCoursed";case"distanciel":return"OnlineCoursed";case"hybride":return"BlendedCoursed";default:return"OnSiteCoursed"}};return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:`${l.description.substring(0,60)} - ${l.school_name}`,description:`Offre de formation: ${l.description.substring(0,150)}. ${l.city?`À ${l.city}.`:""} ${l.duration_hours?`Durée: ${l.duration_hours}h.`:""}`,url:`/training-offers/${e}`,keywords:l.subject_areas}),s.jsx(dOe,{name:l.description.substring(0,100),description:l.description,provider:l.school_name,duration:l.duration_hours?`PT${l.duration_hours}H`:void 0,mode:v(l.modality),startDate:l.start_date||void 0,endDate:l.end_date||void 0,location:l.city||void 0,url:`/training-offers/${e}`}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Offres de formation",url:"/training-offers"},{name:l.description.substring(0,50),url:`/training-offers/${e}`}]}),s.jsx("div",{className:"bg-primary/5 border-b",children:s.jsxs("div",{className:"container mx-auto px-4 py-6",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/training-offers"),className:"mb-4",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour aux offres"]}),s.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-4",children:l.description}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gs,{className:"h-4 w-4"}),s.jsx("span",{children:l.city?`${l.city} - ${l.school_name}`:l.school_name})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bs,{className:"h-4 w-4"}),s.jsxs("span",{children:["Le ",p(l.start_date)]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gr,{className:"h-4 w-4"}),s.jsxs("span",{children:["Publié le ",p(l.created_at)]})]})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{variant:"outline",size:"icon",children:s.jsx(Gve,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"outline",size:"icon",children:s.jsx(vve,{className:"h-4 w-4"})}),n?s.jsx(_8,{offerId:l.id,offerTitle:l.description,schoolName:l.school_name,hasApplied:u,onSuccess:()=>d(!0)}):s.jsx(ne,{onClick:x,size:"lg",className:"min-w-32",children:"Postuler"})]})]})]})}),s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-bold mb-4",children:"L'essentiel"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Ii,{className:"h-5 w-5 text-primary"}),s.jsx("span",{className:"font-semibold",children:"Type de formation"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Le,{children:l.modality==="distanciel"?"Distanciel":l.modality==="hybride"?"Hybride":"Présentiel"}),l.duration_hours&&s.jsxs(Le,{variant:"outline",children:[l.duration_hours,"h"]})]})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Gs,{className:"h-5 w-5 text-primary"}),s.jsx("span",{className:"font-semibold",children:"Lieu et mode de présence"})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[l.school_name,l.city&&`, ${l.city}`]}),l.address&&s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:l.address}),s.jsx("div",{className:"flex gap-2 mt-2",children:s.jsx(Le,{variant:"secondary",children:l.modality==="distanciel"?"Distanciel":l.modality==="hybride"?"Hybride":"Présentiel"})})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Bs,{className:"h-5 w-5 text-primary"}),s.jsx("span",{className:"font-semibold",children:"Dates et volume horaire"})]}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bs,{className:"h-3 w-3 text-muted-foreground"}),s.jsxs("span",{className:"text-muted-foreground",children:["Début : ",s.jsx("span",{className:"text-foreground font-medium",children:p(l.start_date)})]})]}),l.end_date&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bs,{className:"h-3 w-3 text-muted-foreground"}),s.jsxs("span",{className:"text-muted-foreground",children:["Fin : ",s.jsx("span",{className:"text-foreground font-medium",children:p(l.end_date)})]})]}),l.duration_hours&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gr,{className:"h-3 w-3 text-muted-foreground"}),s.jsx("span",{className:"text-muted-foreground",children:s.jsxs("span",{className:"text-foreground font-medium",children:[l.duration_hours," heures"]})})]})]})]}),l.num_trainers&&s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(sr,{className:"h-5 w-5 text-primary"}),s.jsx("span",{className:"font-semibold",children:"Rémunération et effectifs"})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[l.num_trainers," formateur",l.num_trainers>1?"s":""," recherché",l.num_trainers>1?"s":""]})]})]})]})]})}),s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-bold mb-4",children:"Présentation de l'offre"}),s.jsx("p",{className:"text-muted-foreground whitespace-pre-line",children:l.description})]})}),s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-bold mb-4",children:"Domaines d'enseignement"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:l.subject_areas.map((b,y)=>s.jsx(Le,{variant:"outline",className:"text-sm bg-primary/10 text-primary border-primary/20",children:b},y))})]})}),l.training_needs&&l.training_needs.length>0&&s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h2",{className:"text-xl font-bold mb-4",children:"Mots clés"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:l.training_needs.map((b,y)=>s.jsx(Le,{variant:"secondary",className:"text-sm",children:b},y))})]})}),s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsxs("h2",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[s.jsx(Fj,{className:"h-5 w-5 text-primary"}),"Objectifs pédagogiques"]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Les objectifs pédagogiques seront précisés avec l'établissement lors de l'échange initial."})]})}),f&&l&&s.jsx(NUe,{offerId:l.id,offerTitle:l.description})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(ke,{className:"sticky top-4",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h3",{className:"font-bold mb-4",children:"Contact"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:l.contact_name}),l.contact_position&&s.jsx("p",{className:"text-xs text-muted-foreground",children:l.contact_position})]}),s.jsx(Lu,{}),s.jsx("div",{className:"space-y-2",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:l.contact_email})}),n?u?s.jsxs(ne,{disabled:!0,variant:"outline",className:"w-full mt-4 gap-2",children:[s.jsx(Wr,{className:"h-4 w-4 text-green-500"}),"Déjà postulé"]}):s.jsx("div",{className:"mt-4",children:s.jsx(_8,{offerId:l.id,offerTitle:l.description,schoolName:l.school_name,hasApplied:u,onSuccess:()=>d(!0)})}):s.jsx(ne,{className:"w-full mt-4",onClick:x,children:"Postuler à l'offre"})]})]})}),l.estimated_budget&&s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h3",{className:"font-bold mb-4",children:"Budget estimé"}),s.jsx("p",{className:"text-2xl font-bold text-primary",children:l.estimated_budget})]})})]})]})})]})}function kUe(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState("pending"),[u,d]=w.useState(!1);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&(f(),m())},[t]);const f=async()=>{try{const{data:j,error:S}=await he.from("school_requests").select("*").order("created_at",{ascending:!1});if(S)throw S;const{data:I,error:P}=await he.from("trainer_applications").select(`
id,
trainer_id,
status,
created_at,
school_request_id,
trainer_profiles (
id,
name,
email,
specialties
)
`);P&&console.error("Error loading applications:",P);const F=(I||[]).reduce((k,V)=>(k[V.school_request_id]||(k[V.school_request_id]=[]),k[V.school_request_id].push(V),k),{}),T=(j||[]).map(k=>({...k,documents:Array.isArray(k.documents)?k.documents:null,applications:F[k.id]||[]}));o(T)}catch(j){console.error("Error loading requests:",j),ae.error("Erreur lors du chargement des demandes")}finally{a(!1)}},m=()=>{const j=localStorage.getItem("autoApproveTrainingRequests");j&&d(j==="true")},h=j=>{d(j),localStorage.setItem("autoApproveTrainingRequests",String(j)),ae.success(j?"Approbation automatique activée":"Approbation automatique désactivée")},g=async(j,S)=>{try{const I=i.find(F=>F.id===j),{error:P}=await he.from("school_requests").update({status:S}).eq("id",j);if(P)throw P;if(ae.success(S==="approved"?"Demande approuvée et publiée !":S==="rejected"?"Demande rejetée":"Demande archivée"),S==="approved"&&I){if(I.user_id)try{await he.from("notifications").insert({user_id:I.user_id,title:"Offre approuvée",message:`Votre offre de formation "${I.school_name}" a été approuvée et est maintenant visible par les formateurs.`,type:"success",link:"/school/dashboard",metadata:{school_request_id:j}})}catch(F){console.error("Failed to create notification:",F)}try{const{error:F}=await he.functions.invoke("notify-offer-approved",{body:{schoolName:I.school_name,contactName:I.contact_name,contactEmail:I.contact_email,offerId:j,subjectAreas:I.subject_areas,startDate:I.start_date,endDate:I.end_date}});F?console.error("Error sending approval email:",F):ae.success("Email d'approbation envoyé à l'école")}catch(F){console.error("Failed to send approval email:",F)}try{const{data:F,error:T}=await he.functions.invoke("publish-offer-to-linkedin",{body:{schoolName:I.school_name,offerId:j,subjectAreas:I.subject_areas,description:I.description}});T?console.error("LinkedIn publish error:",T):(F==null?void 0:F.posted)>0?ae.success(`Offre publiée sur LinkedIn (${F.posted} compte(s))`):F!=null&&F.message&&console.warn("LinkedIn publish:",F.message)}catch(F){console.error("Failed to publish to LinkedIn:",F)}}if(S==="rejected"&&(I!=null&&I.user_id))try{await he.from("notifications").insert({user_id:I.user_id,title:"Offre non publiée",message:`Votre offre de formation "${I.school_name}" n'a pas été publiée. Contactez-nous pour plus d'informations.`,type:"warning",link:"/school/dashboard",metadata:{school_request_id:j}})}catch(F){console.error("Failed to create notification:",F)}if(S==="approved")try{const{error:F}=await he.functions.invoke("send-recommendations-email",{body:{offerId:j}});F?console.error("Error sending recommendation email:",F):ae.success("Email de recommandations envoyé à l'école")}catch(F){console.error("Failed to send recommendation email:",F)}f()}catch(I){console.error("Error updating request status:",I),ae.error("Erreur lors de la mise à jour")}},p=async j=>{try{const{error:S}=await he.from("school_requests").delete().eq("id",j);if(S)throw S;ae.success("Demande supprimée"),f()}catch(S){console.error("Error deleting request:",S),ae.error("Erreur lors de la suppression")}},x=j=>j?new Date(j).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):"Non définie",v=j=>{if(!j)return!1;const S=new Date(j),I=new Date;return I.setDate(I.getDate()-3),S<I},b=i.filter(j=>j.status==="pending"),y=i.filter(j=>j.status==="approved"&&!v(j.end_date)),N=i.filter(j=>j.status==="rejected"||j.status==="archived"||j.status==="approved"&&v(j.end_date));if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});const _=({request:j})=>{const S=v(j.end_date);return s.jsx(ke,{className:`hover:shadow-lg transition-all ${S?"opacity-60":""}`,children:s.jsxs(Ae,{className:"p-6",children:[s.jsxs("div",{className:"flex items-start justify-between mb-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx(Vr,{className:"h-5 w-5 text-primary"}),s.jsxs(vt,{to:"/admin/schools",className:"text-xl font-bold hover:text-primary transition-colors flex items-center gap-1",children:[j.school_name,s.jsx(vs,{className:"w-4 h-4 opacity-50"})]})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:j.description})]}),s.jsxs("div",{className:"flex flex-col items-end gap-2",children:[s.jsx(Le,{variant:j.status==="approved"?"default":j.status==="pending"?"secondary":"destructive",children:j.status==="approved"?S?"Expirée":"Publiée":j.status==="pending"?"En attente":j.status==="archived"?"Archivée":"Rejetée"}),S&&j.status==="approved"&&s.jsx(Le,{variant:"outline",className:"text-amber-600 border-amber-300",children:"Terminée il y a +3 jours"}),s.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground mt-1",children:[s.jsxs("div",{className:"flex items-center gap-1",title:"Nombre de vues",children:[s.jsx(zve,{className:"h-4 w-4"}),s.jsx("span",{children:j.view_count||0})]}),s.jsxs("div",{className:"flex items-center gap-1",title:"Nombre de candidatures",children:[s.jsx(s2,{className:"h-4 w-4"}),s.jsx("span",{children:j.application_count||0})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4 p-4 bg-muted/50 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sr,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{className:"text-sm",children:[j.contact_name,j.contact_position&&` - ${j.contact_position}`]})]}),s.jsxs("a",{href:`mailto:${j.contact_email}`,className:"flex items-center gap-2 hover:text-primary transition-colors",children:[s.jsx(Fn,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:j.contact_email})]}),j.contact_phone&&s.jsxs("a",{href:`tel:${j.contact_phone}`,className:"flex items-center gap-2 hover:text-primary transition-colors",children:[s.jsx(Yy,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:j.contact_phone})]}),j.city&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gs,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:j.city})]}),j.duration_hours&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gr,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{className:"text-sm",children:[j.duration_hours,"h de formation"]})]}),j.tjm_offered&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gy,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{className:"text-sm",children:[j.tjm_offered,"€/jour (TJM)"]})]}),j.modality&&s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(Le,{variant:"outline",className:"text-xs capitalize",children:j.modality==="presentiel"?"Présentiel":j.modality==="distanciel"?"Distanciel":"Hybride"})})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Bs,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{children:["Début: ",x(j.start_date)]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Bs,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("span",{children:["Fin: ",x(j.end_date)]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:j.subject_areas.map((I,P)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:I},P))}),(j.estimated_budget||j.budget_range)&&s.jsx("div",{className:"mb-4 p-3 bg-primary/5 rounded-lg",children:s.jsxs("p",{className:"text-sm font-medium",children:["Budget: ",j.estimated_budget||j.budget_range]})}),j.notes&&s.jsx("div",{className:"mb-4 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Gt,{className:"h-4 w-4 text-amber-600 mt-0.5"}),s.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:j.notes})]})}),j.documents&&j.documents.length>0&&s.jsxs("div",{className:"mb-4 p-4 bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Gt,{className:"h-4 w-4 text-blue-600"}),s.jsxs("span",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:["Documents joints (",j.documents.length,")"]})]}),s.jsx("div",{className:"space-y-2",children:j.documents.map((I,P)=>s.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Le,{variant:"outline",className:"text-xs",children:I.type}),s.jsx("span",{className:"text-sm truncate max-w-[200px]",children:I.name})]}),s.jsx(ne,{variant:"ghost",size:"sm",asChild:!0,children:s.jsx("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",children:s.jsx(Ho,{className:"h-4 w-4"})})})]},P))})]}),j.applications&&j.applications.length>0&&s.jsxs("div",{className:"mb-4 p-4 bg-green-50 dark:bg-green-950 border border-green-200 dark:border-green-800 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(s2,{className:"h-4 w-4 text-green-600"}),s.jsxs("span",{className:"text-sm font-medium text-green-800 dark:text-green-200",children:["Candidatures (",j.applications.length,")"]})]}),s.jsx("div",{className:"space-y-2",children:j.applications.map(I=>{var P,F;return s.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm font-medium",children:((P=I.trainer_profiles)==null?void 0:P.name)||"Formateur"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:(F=I.trainer_profiles)==null?void 0:F.email})]}),s.jsx(Le,{variant:I.status==="accepted"?"default":I.status==="rejected"?"destructive":"secondary",className:"text-xs",children:I.status==="accepted"?"Acceptée":I.status==="rejected"?"Refusée":"En attente"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(I.created_at).toLocaleDateString("fr-FR")}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{var T;return e(`/trainer/${(T=I.trainer_profiles)==null?void 0:T.id}`)},children:s.jsx(is,{className:"h-4 w-4"})})]})]},I.id)})})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap pt-4 border-t",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>e(`/training-offers/${j.id}`),children:[s.jsx(is,{className:"w-4 h-4 mr-2"}),"Voir l'offre"]}),j.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>g(j.id,"approved"),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(ma,{className:"w-4 h-4 mr-2"}),"Approuver"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>g(j.id,"rejected"),children:[s.jsx(Fs,{className:"w-4 h-4 mr-2"}),"Rejeter"]})]}),j.status==="approved"&&!S&&s.jsx(ne,{size:"sm",variant:"outline",onClick:()=>g(j.id,"archived"),children:"Archiver"}),(j.status==="rejected"||S)&&s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsxs(ne,{size:"sm",variant:"destructive",children:[s.jsx(bi,{className:"w-4 h-4 mr-2"}),"Supprimer"]})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Confirmer la suppression"}),s.jsxs(Xc,{children:["Cette action est irréversible. La demande de ",j.school_name," sera définitivement supprimée."]})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{onClick:()=>p(j.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})]})]})]})})};return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsx(sa,{items:[{label:"Offres de Formation"}]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[s.jsx(xt,{className:"text-3xl",children:"Gestion des Offres de Formation"}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(dy,{id:"auto-approve",checked:u,onCheckedChange:h}),s.jsx(We,{htmlFor:"auto-approve",className:"text-sm",children:"Approbation automatique"})]})]}),s.jsx("p",{className:"text-muted-foreground mt-2",children:"Les offres sont automatiquement archivées 3 jours après la date de fin de formation"})]}),s.jsx(Ae,{children:s.jsxs(af,{value:l,onValueChange:c,children:[s.jsxs(ad,{className:"grid w-full grid-cols-3 mb-6",children:[s.jsxs(In,{value:"pending",children:["En attente (",b.length,")"]}),s.jsxs(In,{value:"approved",children:["Publiées (",y.length,")"]}),s.jsxs(In,{value:"archived",children:["Archivées (",N.length,")"]})]}),s.jsx(Es,{value:"pending",className:"space-y-4",children:b.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune demande en attente"}):b.map(j=>s.jsx(_,{request:j},j.id))}),s.jsx(Es,{value:"approved",className:"space-y-4",children:y.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune offre publiée"}):y.map(j=>s.jsx(_,{request:j},j.id))}),s.jsx(Es,{value:"archived",className:"space-y-4",children:N.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune demande archivée"}):N.map(j=>s.jsx(_,{request:j},j.id))})]})})]})]})})}var CUe=Array.isArray,_l=CUe,EUe=typeof Fc=="object"&&Fc&&Fc.Object===Object&&Fc,Hle=EUe,AUe=Hle,TUe=typeof self=="object"&&self&&self.Object===Object&&self,PUe=AUe||TUe||Function("return this")(),lf=PUe,OUe=lf,DUe=OUe.Symbol,c_=DUe,bV=c_,Gle=Object.prototype,IUe=Gle.hasOwnProperty,RUe=Gle.toString,Tb=bV?bV.toStringTag:void 0;function LUe(e){var t=IUe.call(e,Tb),r=e[Tb];try{e[Tb]=void 0;var n=!0}catch{}var a=RUe.call(e);return n&&(t?e[Tb]=r:delete e[Tb]),a}var FUe=LUe,MUe=Object.prototype,$Ue=MUe.toString;function BUe(e){return $Ue.call(e)}var zUe=BUe,wV=c_,UUe=FUe,qUe=zUe,VUe="[object Null]",WUe="[object Undefined]",jV=wV?wV.toStringTag:void 0;function HUe(e){return e==null?e===void 0?WUe:VUe:jV&&jV in Object(e)?UUe(e):qUe(e)}var _h=HUe;function GUe(e){return e!=null&&typeof e=="object"}var Nh=GUe,KUe=_h,YUe=Nh,XUe="[object Symbol]";function ZUe(e){return typeof e=="symbol"||YUe(e)&&KUe(e)==XUe}var v1=ZUe,JUe=_l,QUe=v1,eqe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tqe=/^\w*$/;function rqe(e,t){if(JUe(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||QUe(e)?!0:tqe.test(e)||!eqe.test(e)||t!=null&&e in Object(t)}var NF=rqe;function nqe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Tp=nqe;const y1=jn(Tp);var sqe=_h,aqe=Tp,iqe="[object AsyncFunction]",oqe="[object Function]",lqe="[object GeneratorFunction]",cqe="[object Proxy]";function uqe(e){if(!aqe(e))return!1;var t=sqe(e);return t==oqe||t==lqe||t==iqe||t==cqe}var SF=uqe;const Mr=jn(SF);var dqe=lf,fqe=dqe["__core-js_shared__"],hqe=fqe,KT=hqe,_V=function(){var e=/[^.]+$/.exec(KT&&KT.keys&&KT.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function mqe(e){return!!_V&&_V in e}var pqe=mqe,gqe=Function.prototype,xqe=gqe.toString;function vqe(e){if(e!=null){try{return xqe.call(e)}catch{}try{return e+""}catch{}}return""}var Kle=vqe,yqe=SF,bqe=pqe,wqe=Tp,jqe=Kle,_qe=/[\\^$.*+?()[\]{}|]/g,Nqe=/^\[object .+?Constructor\]$/,Sqe=Function.prototype,kqe=Object.prototype,Cqe=Sqe.toString,Eqe=kqe.hasOwnProperty,Aqe=RegExp("^"+Cqe.call(Eqe).replace(_qe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Tqe(e){if(!wqe(e)||bqe(e))return!1;var t=yqe(e)?Aqe:Nqe;return t.test(jqe(e))}var Pqe=Tqe;function Oqe(e,t){return e==null?void 0:e[t]}var Dqe=Oqe,Iqe=Pqe,Rqe=Dqe;function Lqe(e,t){var r=Rqe(e,t);return Iqe(r)?r:void 0}var Ug=Lqe,Fqe=Ug,Mqe=Fqe(Object,"create"),uE=Mqe,NV=uE;function $qe(){this.__data__=NV?NV(null):{},this.size=0}var Bqe=$qe;function zqe(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Uqe=zqe,qqe=uE,Vqe="__lodash_hash_undefined__",Wqe=Object.prototype,Hqe=Wqe.hasOwnProperty;function Gqe(e){var t=this.__data__;if(qqe){var r=t[e];return r===Vqe?void 0:r}return Hqe.call(t,e)?t[e]:void 0}var Kqe=Gqe,Yqe=uE,Xqe=Object.prototype,Zqe=Xqe.hasOwnProperty;function Jqe(e){var t=this.__data__;return Yqe?t[e]!==void 0:Zqe.call(t,e)}var Qqe=Jqe,eVe=uE,tVe="__lodash_hash_undefined__";function rVe(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=eVe&&t===void 0?tVe:t,this}var nVe=rVe,sVe=Bqe,aVe=Uqe,iVe=Kqe,oVe=Qqe,lVe=nVe;function b1(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}b1.prototype.clear=sVe;b1.prototype.delete=aVe;b1.prototype.get=iVe;b1.prototype.has=oVe;b1.prototype.set=lVe;var cVe=b1;function uVe(){this.__data__=[],this.size=0}var dVe=uVe;function fVe(e,t){return e===t||e!==e&&t!==t}var kF=fVe,hVe=kF;function mVe(e,t){for(var r=e.length;r--;)if(hVe(e[r][0],t))return r;return-1}var dE=mVe,pVe=dE,gVe=Array.prototype,xVe=gVe.splice;function vVe(e){var t=this.__data__,r=pVe(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():xVe.call(t,r,1),--this.size,!0}var yVe=vVe,bVe=dE;function wVe(e){var t=this.__data__,r=bVe(t,e);return r<0?void 0:t[r][1]}var jVe=wVe,_Ve=dE;function NVe(e){return _Ve(this.__data__,e)>-1}var SVe=NVe,kVe=dE;function CVe(e,t){var r=this.__data__,n=kVe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var EVe=CVe,AVe=dVe,TVe=yVe,PVe=jVe,OVe=SVe,DVe=EVe;function w1(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}w1.prototype.clear=AVe;w1.prototype.delete=TVe;w1.prototype.get=PVe;w1.prototype.has=OVe;w1.prototype.set=DVe;var fE=w1,IVe=Ug,RVe=lf,LVe=IVe(RVe,"Map"),CF=LVe,SV=cVe,FVe=fE,MVe=CF;function $Ve(){this.size=0,this.__data__={hash:new SV,map:new(MVe||FVe),string:new SV}}var BVe=$Ve;function zVe(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var UVe=zVe,qVe=UVe;function VVe(e,t){var r=e.__data__;return qVe(t)?r[typeof t=="string"?"string":"hash"]:r.map}var hE=VVe,WVe=hE;function HVe(e){var t=WVe(this,e).delete(e);return this.size-=t?1:0,t}var GVe=HVe,KVe=hE;function YVe(e){return KVe(this,e).get(e)}var XVe=YVe,ZVe=hE;function JVe(e){return ZVe(this,e).has(e)}var QVe=JVe,eWe=hE;function tWe(e,t){var r=eWe(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var rWe=tWe,nWe=BVe,sWe=GVe,aWe=XVe,iWe=QVe,oWe=rWe;function j1(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}j1.prototype.clear=nWe;j1.prototype.delete=sWe;j1.prototype.get=aWe;j1.prototype.has=iWe;j1.prototype.set=oWe;var EF=j1,Yle=EF,lWe="Expected a function";function AF(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(lWe);var r=function(){var n=arguments,a=t?t.apply(this,n):n[0],i=r.cache;if(i.has(a))return i.get(a);var o=e.apply(this,n);return r.cache=i.set(a,o)||i,o};return r.cache=new(AF.Cache||Yle),r}AF.Cache=Yle;var Xle=AF;const cWe=jn(Xle);var uWe=Xle,dWe=500;function fWe(e){var t=uWe(e,function(n){return r.size===dWe&&r.clear(),n}),r=t.cache;return t}var hWe=fWe,mWe=hWe,pWe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gWe=/\\(\\)?/g,xWe=mWe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(pWe,function(r,n,a,i){t.push(a?i.replace(gWe,"$1"):n||r)}),t}),vWe=xWe;function yWe(e,t){for(var r=-1,n=e==null?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a}var TF=yWe,kV=c_,bWe=TF,wWe=_l,jWe=v1,CV=kV?kV.prototype:void 0,EV=CV?CV.toString:void 0;function Zle(e){if(typeof e=="string")return e;if(wWe(e))return bWe(e,Zle)+"";if(jWe(e))return EV?EV.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var _We=Zle,NWe=_We;function SWe(e){return e==null?"":NWe(e)}var Jle=SWe,kWe=_l,CWe=NF,EWe=vWe,AWe=Jle;function TWe(e,t){return kWe(e)?e:CWe(e,t)?[e]:EWe(AWe(e))}var Qle=TWe,PWe=v1;function OWe(e){if(typeof e=="string"||PWe(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var mE=OWe,DWe=Qle,IWe=mE;function RWe(e,t){t=DWe(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[IWe(t[r++])];return r&&r==n?e:void 0}var PF=RWe,LWe=PF;function FWe(e,t,r){var n=e==null?void 0:LWe(e,t);return n===void 0?r:n}var ece=FWe;const Ql=jn(ece);function MWe(e){return e==null}var $We=MWe;const Xr=jn($We);var BWe=_h,zWe=_l,UWe=Nh,qWe="[object String]";function VWe(e){return typeof e=="string"||!zWe(e)&&UWe(e)&&BWe(e)==qWe}var WWe=VWe;const gg=jn(WWe);var tce={exports:{}},os={};/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var OF=Symbol.for("react.element"),DF=Symbol.for("react.portal"),pE=Symbol.for("react.fragment"),gE=Symbol.for("react.strict_mode"),xE=Symbol.for("react.profiler"),vE=Symbol.for("react.provider"),yE=Symbol.for("react.context"),HWe=Symbol.for("react.server_context"),bE=Symbol.for("react.forward_ref"),wE=Symbol.for("react.suspense"),jE=Symbol.for("react.suspense_list"),_E=Symbol.for("react.memo"),NE=Symbol.for("react.lazy"),GWe=Symbol.for("react.offscreen"),rce;rce=Symbol.for("react.module.reference");function uu(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case OF:switch(e=e.type,e){case pE:case xE:case gE:case wE:case jE:return e;default:switch(e=e&&e.$$typeof,e){case HWe:case yE:case bE:case NE:case _E:case vE:return e;default:return t}}case DF:return t}}}os.ContextConsumer=yE;os.ContextProvider=vE;os.Element=OF;os.ForwardRef=bE;os.Fragment=pE;os.Lazy=NE;os.Memo=_E;os.Portal=DF;os.Profiler=xE;os.StrictMode=gE;os.Suspense=wE;os.SuspenseList=jE;os.isAsyncMode=function(){return!1};os.isConcurrentMode=function(){return!1};os.isContextConsumer=function(e){return uu(e)===yE};os.isContextProvider=function(e){return uu(e)===vE};os.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===OF};os.isForwardRef=function(e){return uu(e)===bE};os.isFragment=function(e){return uu(e)===pE};os.isLazy=function(e){return uu(e)===NE};os.isMemo=function(e){return uu(e)===_E};os.isPortal=function(e){return uu(e)===DF};os.isProfiler=function(e){return uu(e)===xE};os.isStrictMode=function(e){return uu(e)===gE};os.isSuspense=function(e){return uu(e)===wE};os.isSuspenseList=function(e){return uu(e)===jE};os.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===pE||e===xE||e===gE||e===wE||e===jE||e===GWe||typeof e=="object"&&e!==null&&(e.$$typeof===NE||e.$$typeof===_E||e.$$typeof===vE||e.$$typeof===yE||e.$$typeof===bE||e.$$typeof===rce||e.getModuleId!==void 0)};os.typeOf=uu;tce.exports=os;var KWe=tce.exports,YWe=_h,XWe=Nh,ZWe="[object Number]";function JWe(e){return typeof e=="number"||XWe(e)&&YWe(e)==ZWe}var nce=JWe;const QWe=jn(nce);var eHe=nce;function tHe(e){return eHe(e)&&e!=+e}var rHe=tHe;const u_=jn(rHe);var Fo=function(t){return t===0?0:t>0?1:-1},_0=function(t){return gg(t)&&t.indexOf("%")===t.length-1},Dt=function(t){return QWe(t)&&!u_(t)},nHe=function(t){return Xr(t)},gi=function(t){return Dt(t)||gg(t)},sHe=0,_1=function(t){var r=++sHe;return"".concat(t||"").concat(r)},Mo=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Dt(t)&&!gg(t))return n;var i;if(_0(t)){var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return u_(i)&&(i=n),a&&i>r&&(i=r),i},fm=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},aHe=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},a=0;a<r;a++)if(!n[t[a]])n[t[a]]=!0;else return!0;return!1},Bl=function(t,r){return Dt(t)&&Dt(r)?function(n){return t+n*(r-t)}:function(){return r}};function b4(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):Ql(n,t))===r})}var iHe=function(t,r){return Dt(t)&&Dt(r)?t-r:gg(t)&&gg(r)?t.localeCompare(r):t instanceof Date&&r instanceof Date?t.getTime()-r.getTime():String(t).localeCompare(String(r))};function Cv(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function N8(e){"@babel/helpers - typeof";return N8=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},N8(e)}var oHe=["viewBox","children"],lHe=["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"],AV=["points","pathLength"],YT={svg:oHe,polygon:AV,polyline:AV},IF=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],w4=function(t,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(w.isValidElement(t)&&(n=t.props),!y1(n))return null;var a={};return Object.keys(n).forEach(function(i){IF.includes(i)&&(a[i]=r||function(o){return n[i](n,o)})}),a},cHe=function(t,r,n){return function(a){return t(r,n,a),null}},xg=function(t,r,n){if(!y1(t)||N8(t)!=="object")return null;var a=null;return Object.keys(t).forEach(function(i){var o=t[i];IF.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=cHe(o,r,n))}),a},uHe=["children"],dHe=["children"];function TV(e,t){if(e==null)return{};var r=fHe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function fHe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function S8(e){"@babel/helpers - typeof";return S8=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},S8(e)}var PV={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"},Qf=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},OV=null,XT=null,RF=function e(t){if(t===OV&&Array.isArray(XT))return XT;var r=[];return w.Children.forEach(t,function(n){Xr(n)||(KWe.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),XT=r,OV=t,r};function ec(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(a){return Qf(a)}):n=[Qf(t)],RF(e).forEach(function(a){var i=Ql(a,"type.displayName")||Ql(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function Fl(e,t){var r=ec(e,t);return r&&r[0]}var DV=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,a=r.height;return!(!Dt(n)||n<=0||!Dt(a)||a<=0)},hHe=["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"],mHe=function(t){return t&&t.type&&gg(t.type)&&hHe.indexOf(t.type)>=0},pHe=function(t){return t&&S8(t)==="object"&&"clipDot"in t},gHe=function(t,r,n,a){var i,o=(i=YT==null?void 0:YT[a])!==null&&i!==void 0?i:[];return r.startsWith("data-")||!Mr(t)&&(a&&o.includes(r)||lHe.includes(r))||n&&IF.includes(r)},Sr=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(w.isValidElement(t)&&(a=t.props),!y1(a))return null;var i={};return Object.keys(a).forEach(function(o){var l;gHe((l=a)===null||l===void 0?void 0:l[o],o,r,n)&&(i[o]=a[o])}),i},k8=function e(t,r){if(t===r)return!0;var n=w.Children.count(t);if(n!==w.Children.count(r))return!1;if(n===0)return!0;if(n===1)return IV(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var a=0;a<n;a++){var i=t[a],o=r[a];if(Array.isArray(i)||Array.isArray(o)){if(!e(i,o))return!1}else if(!IV(i,o))return!1}return!0},IV=function(t,r){if(Xr(t)&&Xr(r))return!0;if(!Xr(t)&&!Xr(r)){var n=t.props||{},a=n.children,i=TV(n,uHe),o=r.props||{},l=o.children,c=TV(o,dHe);return a&&l?Cv(i,c)&&k8(a,l):!a&&!l?Cv(i,c):!1}return!1},RV=function(t,r){var n=[],a={};return RF(t).forEach(function(i,o){if(mHe(i))n.push(i);else if(i){var l=Qf(i.type),c=r[l]||{},u=c.handler,d=c.once;if(u&&(!d||!a[l])){var f=u(i,l,o);n.push(f),a[l]=!0}}}),n},xHe=function(t){var r=t&&t.type;return r&&PV[r]?PV[r]:null},vHe=function(t,r){return RF(r).indexOf(t)},yHe=["children","width","height","viewBox","className","style","title","desc"];function C8(){return C8=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},C8.apply(this,arguments)}function bHe(e,t){if(e==null)return{};var r=wHe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function wHe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function E8(e){var t=e.children,r=e.width,n=e.height,a=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,u=bHe(e,yHe),d=a||{width:r,height:n,x:0,y:0},f=en("recharts-surface",i);return be.createElement("svg",C8({},Sr(u,!0,"svg"),{className:f,width:r,height:n,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),be.createElement("title",null,l),be.createElement("desc",null,c),t)}var jHe=["children","className"];function A8(){return A8=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},A8.apply(this,arguments)}function _He(e,t){if(e==null)return{};var r=NHe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function NHe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Ln=be.forwardRef(function(e,t){var r=e.children,n=e.className,a=_He(e,jHe),i=en("recharts-layer",n);return be.createElement("g",A8({className:i},Sr(a,!0),{ref:t}),r)}),Hu=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i]};function SHe(e,t,r){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),r=r>a?a:r,r<0&&(r+=a),a=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(a);++n<a;)i[n]=e[n+t];return i}var kHe=SHe,CHe=kHe;function EHe(e,t,r){var n=e.length;return r=r===void 0?n:r,!t&&r>=n?e:CHe(e,t,r)}var AHe=EHe,THe="\\ud800-\\udfff",PHe="\\u0300-\\u036f",OHe="\\ufe20-\\ufe2f",DHe="\\u20d0-\\u20ff",IHe=PHe+OHe+DHe,RHe="\\ufe0e\\ufe0f",LHe="\\u200d",FHe=RegExp("["+LHe+THe+IHe+RHe+"]");function MHe(e){return FHe.test(e)}var sce=MHe;function $He(e){return e.split("")}var BHe=$He,ace="\\ud800-\\udfff",zHe="\\u0300-\\u036f",UHe="\\ufe20-\\ufe2f",qHe="\\u20d0-\\u20ff",VHe=zHe+UHe+qHe,WHe="\\ufe0e\\ufe0f",HHe="["+ace+"]",T8="["+VHe+"]",P8="\\ud83c[\\udffb-\\udfff]",GHe="(?:"+T8+"|"+P8+")",ice="[^"+ace+"]",oce="(?:\\ud83c[\\udde6-\\uddff]){2}",lce="[\\ud800-\\udbff][\\udc00-\\udfff]",KHe="\\u200d",cce=GHe+"?",uce="["+WHe+"]?",YHe="(?:"+KHe+"(?:"+[ice,oce,lce].join("|")+")"+uce+cce+")*",XHe=uce+cce+YHe,ZHe="(?:"+[ice+T8+"?",T8,oce,lce,HHe].join("|")+")",JHe=RegExp(P8+"(?="+P8+")|"+ZHe+XHe,"g");function QHe(e){return e.match(JHe)||[]}var eGe=QHe,tGe=BHe,rGe=sce,nGe=eGe;function sGe(e){return rGe(e)?nGe(e):tGe(e)}var aGe=sGe,iGe=AHe,oGe=sce,lGe=aGe,cGe=Jle;function uGe(e){return function(t){t=cGe(t);var r=oGe(t)?lGe(t):void 0,n=r?r[0]:t.charAt(0),a=r?iGe(r,1).join(""):t.slice(1);return n[e]()+a}}var dGe=uGe,fGe=dGe,hGe=fGe("toUpperCase"),mGe=hGe;const SE=jn(mGe);function Ns(e){return function(){return e}}const dce=Math.cos,j4=Math.sin,ld=Math.sqrt,_4=Math.PI,kE=2*_4,O8=Math.PI,D8=2*O8,l0=1e-6,pGe=D8-l0;function fce(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function gGe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return fce;const r=10**t;return function(n){this._+=n[0];for(let a=1,i=n.length;a<i;++a)this._+=Math.round(arguments[a]*r)/r+n[a]}}class xGe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?fce:gGe(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,a){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+a}`}bezierCurveTo(t,r,n,a,i,o){this._append`C${+t},${+r},${+n},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,r,n,a,i){if(t=+t,r=+r,n=+n,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=n-t,u=a-r,d=o-t,f=l-r,m=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(m>l0)if(!(Math.abs(f*c-u*d)>l0)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-o,g=a-l,p=c*c+u*u,x=h*h+g*g,v=Math.sqrt(p),b=Math.sqrt(m),y=i*Math.tan((O8-Math.acos((p+m-x)/(2*v*b)))/2),N=y/b,_=y/v;Math.abs(N-1)>l0&&this._append`L${t+N*d},${r+N*f}`,this._append`A${i},${i},0,0,${+(f*h>d*g)},${this._x1=t+_*c},${this._y1=r+_*u}`}}arc(t,r,n,a,i,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(a),c=n*Math.sin(a),u=t+l,d=r+c,f=1^o,m=o?a-i:i-a;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>l0||Math.abs(this._y1-d)>l0)&&this._append`L${u},${d}`,n&&(m<0&&(m=m%D8+D8),m>pGe?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=u},${this._y1=d}`:m>l0&&this._append`A${n},${n},0,${+(m>=O8)},${f},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function LF(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new xGe(t)}function FF(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hce(e){this._context=e}hce.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 CE(e){return new hce(e)}function mce(e){return e[0]}function pce(e){return e[1]}function gce(e,t){var r=Ns(!0),n=null,a=CE,i=null,o=LF(l);e=typeof e=="function"?e:e===void 0?mce:Ns(e),t=typeof t=="function"?t:t===void 0?pce:Ns(t);function l(c){var u,d=(c=FF(c)).length,f,m=!1,h;for(n==null&&(i=a(h=o())),u=0;u<=d;++u)!(u<d&&r(f=c[u],u,c))===m&&((m=!m)?i.lineStart():i.lineEnd()),m&&i.point(+e(f,u,c),+t(f,u,c));if(h)return i=null,h+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ns(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ns(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:Ns(!!c),l):r},l.curve=function(c){return arguments.length?(a=c,n!=null&&(i=a(n)),l):a},l.context=function(c){return arguments.length?(c==null?n=i=null:i=a(n=c),l):n},l}function fS(e,t,r){var n=null,a=Ns(!0),i=null,o=CE,l=null,c=LF(u);e=typeof e=="function"?e:e===void 0?mce:Ns(+e),t=typeof t=="function"?t:Ns(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?pce:Ns(+r);function u(f){var m,h,g,p=(f=FF(f)).length,x,v=!1,b,y=new Array(p),N=new Array(p);for(i==null&&(l=o(b=c())),m=0;m<=p;++m){if(!(m<p&&a(x=f[m],m,f))===v)if(v=!v)h=m,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),g=m-1;g>=h;--g)l.point(y[g],N[g]);l.lineEnd(),l.areaEnd()}v&&(y[m]=+e(x,m,f),N[m]=+t(x,m,f),l.point(n?+n(x,m,f):y[m],r?+r(x,m,f):N[m]))}if(b)return l=null,b+""||null}function d(){return gce().defined(a).curve(o).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ns(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ns(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ns(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ns(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ns(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ns(+f),u):r},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(r)},u.lineX1=function(){return d().x(n).y(t)},u.defined=function(f){return arguments.length?(a=typeof f=="function"?f:Ns(!!f),u):a},u.curve=function(f){return arguments.length?(o=f,i!=null&&(l=o(i)),u):o},u.context=function(f){return arguments.length?(f==null?i=l=null:l=o(i=f),u):i},u}class xce{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function vGe(e){return new xce(e,!0)}function yGe(e){return new xce(e,!1)}const MF={draw(e,t){const r=ld(t/_4);e.moveTo(r,0),e.arc(0,0,r,0,kE)}},bGe={draw(e,t){const r=ld(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},vce=ld(1/3),wGe=vce*2,jGe={draw(e,t){const r=ld(t/wGe),n=r*vce;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},_Ge={draw(e,t){const r=ld(t),n=-r/2;e.rect(n,n,r,r)}},NGe=.8908130915292852,yce=j4(_4/10)/j4(7*_4/10),SGe=j4(kE/10)*yce,kGe=-dce(kE/10)*yce,CGe={draw(e,t){const r=ld(t*NGe),n=SGe*r,a=kGe*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const o=kE*i/5,l=dce(o),c=j4(o);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*a,c*n+l*a)}e.closePath()}},ZT=ld(3),EGe={draw(e,t){const r=-ld(t/(ZT*3));e.moveTo(0,r*2),e.lineTo(-ZT*r,-r),e.lineTo(ZT*r,-r),e.closePath()}},xc=-.5,vc=ld(3)/2,I8=1/ld(12),AGe=(I8/2+1)*3,TGe={draw(e,t){const r=ld(t/AGe),n=r/2,a=r*I8,i=n,o=r*I8+r,l=-i,c=o;e.moveTo(n,a),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(xc*n-vc*a,vc*n+xc*a),e.lineTo(xc*i-vc*o,vc*i+xc*o),e.lineTo(xc*l-vc*c,vc*l+xc*c),e.lineTo(xc*n+vc*a,xc*a-vc*n),e.lineTo(xc*i+vc*o,xc*o-vc*i),e.lineTo(xc*l+vc*c,xc*c-vc*l),e.closePath()}};function PGe(e,t){let r=null,n=LF(a);e=typeof e=="function"?e:Ns(e||MF),t=typeof t=="function"?t:Ns(t===void 0?64:+t);function a(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:Ns(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:Ns(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function N4(){}function S4(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function bce(e){this._context=e}bce.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:S4(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:S4(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function OGe(e){return new bce(e)}function wce(e){this._context=e}wce.prototype={areaStart:N4,areaEnd:N4,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:S4(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function DGe(e){return new wce(e)}function jce(e){this._context=e}jce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:S4(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function IGe(e){return new jce(e)}function _ce(e){this._context=e}_ce.prototype={areaStart:N4,areaEnd:N4,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 RGe(e){return new _ce(e)}function LV(e){return e<0?-1:1}function FV(e,t,r){var n=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(n||a<0&&-0),o=(r-e._y1)/(a||n<0&&-0),l=(i*a+o*n)/(n+a);return(LV(i)+LV(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function MV(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function JT(e,t,r){var n=e._x0,a=e._y0,i=e._x1,o=e._y1,l=(i-n)/3;e._context.bezierCurveTo(n+l,a+l*t,i-l,o-l*r,i,o)}function k4(e){this._context=e}k4.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:JT(this,this._t0,MV(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,JT(this,MV(this,r=FV(this,e,t)),r);break;default:JT(this,this._t0,r=FV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Nce(e){this._context=new Sce(e)}(Nce.prototype=Object.create(k4.prototype)).point=function(e,t){k4.prototype.point.call(this,t,e)};function Sce(e){this._context=e}Sce.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,i){this._context.bezierCurveTo(t,e,n,r,i,a)}};function LGe(e){return new k4(e)}function FGe(e){return new Nce(e)}function kce(e){this._context=e}kce.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=$V(e),a=$V(t),i=0,o=1;o<r;++i,++o)this._context.bezierCurveTo(n[0][i],a[0][i],n[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function $V(e){var t,r=e.length-1,n,a=new Array(r),i=new Array(r),o=new Array(r);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[r-1]=2,i[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=a[t]/i[t-1],i[t]-=n,o[t]-=n*o[t-1];for(a[r-1]=o[r-1]/i[r-1],t=r-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function MGe(e){return new kce(e)}function EE(e,t){this._context=e,this._t=t}EE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function $Ge(e){return new EE(e,.5)}function BGe(e){return new EE(e,0)}function zGe(e){return new EE(e,1)}function fy(e,t){if((o=e.length)>1)for(var r=1,n,a,i=e[t[0]],o,l=i.length;r<o;++r)for(a=i,i=e[t[r]],n=0;n<l;++n)i[n][1]+=i[n][0]=isNaN(a[n][1])?a[n][0]:a[n][1]}function R8(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function UGe(e,t){return e[t]}function qGe(e){const t=[];return t.key=e,t}function VGe(){var e=Ns([]),t=R8,r=fy,n=UGe;function a(i){var o=Array.from(e.apply(this,arguments),qGe),l,c=o.length,u=-1,d;for(const f of i)for(l=0,++u;l<c;++l)(o[l][u]=[0,+n(f,o[l].key,u,i)]).data=f;for(l=0,d=FF(t(o));l<c;++l)o[d[l]].index=l;return r(o,d),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:Ns(Array.from(i)),a):e},a.value=function(i){return arguments.length?(n=typeof i=="function"?i:Ns(+i),a):n},a.order=function(i){return arguments.length?(t=i==null?R8:typeof i=="function"?i:Ns(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(r=i??fy,a):r},a}function WGe(e,t){if((n=e.length)>0){for(var r,n,a=0,i=e[0].length,o;a<i;++a){for(o=r=0;r<n;++r)o+=e[r][a][1]||0;if(o)for(r=0;r<n;++r)e[r][a][1]/=o}fy(e,t)}}function HGe(e,t){if((a=e.length)>0){for(var r=0,n=e[t[0]],a,i=n.length;r<i;++r){for(var o=0,l=0;o<a;++o)l+=e[o][r][1]||0;n[r][1]+=n[r][0]=-l/2}fy(e,t)}}function GGe(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,i,o;n<i;++n){for(var l=0,c=0,u=0;l<o;++l){for(var d=e[t[l]],f=d[n][1]||0,m=d[n-1][1]||0,h=(f-m)/2,g=0;g<l;++g){var p=e[t[g]],x=p[n][1]||0,v=p[n-1][1]||0;h+=x-v}c+=f,u+=h*f}a[n-1][1]+=a[n-1][0]=r,c&&(r-=u/c)}a[n-1][1]+=a[n-1][0]=r,fy(e,t)}}function A2(e){"@babel/helpers - typeof";return A2=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},A2(e)}var KGe=["type","size","sizeType"];function L8(){return L8=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},L8.apply(this,arguments)}function BV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function zV(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?BV(Object(r),!0).forEach(function(n){YGe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BV(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YGe(e,t,r){return t=XGe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function XGe(e){var t=ZGe(e,"string");return A2(t)=="symbol"?t:t+""}function ZGe(e,t){if(A2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(A2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function JGe(e,t){if(e==null)return{};var r=QGe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function QGe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Cce={symbolCircle:MF,symbolCross:bGe,symbolDiamond:jGe,symbolSquare:_Ge,symbolStar:CGe,symbolTriangle:EGe,symbolWye:TGe},eKe=Math.PI/180,tKe=function(t){var r="symbol".concat(SE(t));return Cce[r]||MF},rKe=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*eKe;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}},nKe=function(t,r){Cce["symbol".concat(SE(t))]=r},$F=function(t){var r=t.type,n=r===void 0?"circle":r,a=t.size,i=a===void 0?64:a,o=t.sizeType,l=o===void 0?"area":o,c=JGe(t,KGe),u=zV(zV({},c),{},{type:n,size:i,sizeType:l}),d=function(){var x=tKe(n),v=PGe().type(x).size(rKe(i,l,n));return v()},f=u.className,m=u.cx,h=u.cy,g=Sr(u,!0);return m===+m&&h===+h&&i===+i?be.createElement("path",L8({},g,{className:en("recharts-symbols",f),transform:"translate(".concat(m,", ").concat(h,")"),d:d()})):null};$F.registerSymbol=nKe;function hy(e){"@babel/helpers - typeof";return hy=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},hy(e)}function F8(){return F8=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},F8.apply(this,arguments)}function UV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function sKe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?UV(Object(r),!0).forEach(function(n){T2(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UV(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aKe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iKe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ace(n.key),n)}}function oKe(e,t,r){return t&&iKe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function lKe(e,t,r){return t=C4(t),cKe(e,Ece()?Reflect.construct(t,r||[],C4(e).constructor):t.apply(e,r))}function cKe(e,t){if(t&&(hy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uKe(e)}function uKe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ece(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ece=function(){return!!e})()}function C4(e){return C4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},C4(e)}function dKe(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&&M8(e,t)}function M8(e,t){return M8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},M8(e,t)}function T2(e,t,r){return t=Ace(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ace(e){var t=fKe(e,"string");return hy(t)=="symbol"?t:t+""}function fKe(e,t){if(hy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(hy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var yc=32,BF=function(e){function t(){return aKe(this,t),lKe(this,t,arguments)}return dKe(t,e),oKe(t,[{key:"renderIcon",value:function(n){var a=this.props.inactiveColor,i=yc/2,o=yc/6,l=yc/3,c=n.inactive?a:n.color;if(n.type==="plainline")return be.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:yc,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return be.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
H`).concat(yc,"M").concat(2*l,",").concat(i,`
A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(n.type==="rect")return be.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(yc/8,"h").concat(yc,"v").concat(yc*3/4,"h").concat(-yc,"z"),className:"recharts-legend-icon"});if(be.isValidElement(n.legendIcon)){var u=sKe({},n);return delete u.legendIcon,be.cloneElement(n.legendIcon,u)}return be.createElement($F,{fill:c,cx:i,cy:i,size:yc,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,a=this.props,i=a.payload,o=a.iconSize,l=a.layout,c=a.formatter,u=a.inactiveColor,d={x:0,y:0,width:yc,height:yc},f={display:l==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(h,g){var p=h.formatter||c,x=en(T2(T2({"recharts-legend-item":!0},"legend-item-".concat(g),!0),"inactive",h.inactive));if(h.type==="none")return null;var v=Mr(h.value)?null:h.value;Hu(!Mr(h.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 b=h.inactive?u:h.color;return be.createElement("li",F8({className:x,style:f,key:"legend-item-".concat(g)},xg(n.props,h,g)),be.createElement(E8,{width:o,height:o,viewBox:d,style:m},n.renderIcon(h)),be.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},p?p(v,h,g):v))})}},{key:"render",value:function(){var n=this.props,a=n.payload,i=n.layout,o=n.align;if(!a||!a.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return be.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(w.PureComponent);T2(BF,"displayName","Legend");T2(BF,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var hKe=fE;function mKe(){this.__data__=new hKe,this.size=0}var pKe=mKe;function gKe(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var xKe=gKe;function vKe(e){return this.__data__.get(e)}var yKe=vKe;function bKe(e){return this.__data__.has(e)}var wKe=bKe,jKe=fE,_Ke=CF,NKe=EF,SKe=200;function kKe(e,t){var r=this.__data__;if(r instanceof jKe){var n=r.__data__;if(!_Ke||n.length<SKe-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new NKe(n)}return r.set(e,t),this.size=r.size,this}var CKe=kKe,EKe=fE,AKe=pKe,TKe=xKe,PKe=yKe,OKe=wKe,DKe=CKe;function N1(e){var t=this.__data__=new EKe(e);this.size=t.size}N1.prototype.clear=AKe;N1.prototype.delete=TKe;N1.prototype.get=PKe;N1.prototype.has=OKe;N1.prototype.set=DKe;var Tce=N1,IKe="__lodash_hash_undefined__";function RKe(e){return this.__data__.set(e,IKe),this}var LKe=RKe;function FKe(e){return this.__data__.has(e)}var MKe=FKe,$Ke=EF,BKe=LKe,zKe=MKe;function E4(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new $Ke;++t<r;)this.add(e[t])}E4.prototype.add=E4.prototype.push=BKe;E4.prototype.has=zKe;var Pce=E4;function UKe(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Oce=UKe;function qKe(e,t){return e.has(t)}var Dce=qKe,VKe=Pce,WKe=Oce,HKe=Dce,GKe=1,KKe=2;function YKe(e,t,r,n,a,i){var o=r&GKe,l=e.length,c=t.length;if(l!=c&&!(o&&c>l))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var f=-1,m=!0,h=r&KKe?new VKe:void 0;for(i.set(e,t),i.set(t,e);++f<l;){var g=e[f],p=t[f];if(n)var x=o?n(p,g,f,t,e,i):n(g,p,f,e,t,i);if(x!==void 0){if(x)continue;m=!1;break}if(h){if(!WKe(t,function(v,b){if(!HKe(h,b)&&(g===v||a(g,v,r,n,i)))return h.push(b)})){m=!1;break}}else if(!(g===p||a(g,p,r,n,i))){m=!1;break}}return i.delete(e),i.delete(t),m}var Ice=YKe,XKe=lf,ZKe=XKe.Uint8Array,JKe=ZKe;function QKe(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}var eYe=QKe;function tYe(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var zF=tYe,qV=c_,VV=JKe,rYe=kF,nYe=Ice,sYe=eYe,aYe=zF,iYe=1,oYe=2,lYe="[object Boolean]",cYe="[object Date]",uYe="[object Error]",dYe="[object Map]",fYe="[object Number]",hYe="[object RegExp]",mYe="[object Set]",pYe="[object String]",gYe="[object Symbol]",xYe="[object ArrayBuffer]",vYe="[object DataView]",WV=qV?qV.prototype:void 0,QT=WV?WV.valueOf:void 0;function yYe(e,t,r,n,a,i,o){switch(r){case vYe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case xYe:return!(e.byteLength!=t.byteLength||!i(new VV(e),new VV(t)));case lYe:case cYe:case fYe:return rYe(+e,+t);case uYe:return e.name==t.name&&e.message==t.message;case hYe:case pYe:return e==t+"";case dYe:var l=sYe;case mYe:var c=n&iYe;if(l||(l=aYe),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=oYe,o.set(e,t);var d=nYe(l(e),l(t),n,a,i,o);return o.delete(e),d;case gYe:if(QT)return QT.call(e)==QT.call(t)}return!1}var bYe=yYe;function wYe(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}var Rce=wYe,jYe=Rce,_Ye=_l;function NYe(e,t,r){var n=t(e);return _Ye(e)?n:jYe(n,r(e))}var SYe=NYe;function kYe(e,t){for(var r=-1,n=e==null?0:e.length,a=0,i=[];++r<n;){var o=e[r];t(o,r,e)&&(i[a++]=o)}return i}var CYe=kYe;function EYe(){return[]}var AYe=EYe,TYe=CYe,PYe=AYe,OYe=Object.prototype,DYe=OYe.propertyIsEnumerable,HV=Object.getOwnPropertySymbols,IYe=HV?function(e){return e==null?[]:(e=Object(e),TYe(HV(e),function(t){return DYe.call(e,t)}))}:PYe,RYe=IYe;function LYe(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var FYe=LYe,MYe=_h,$Ye=Nh,BYe="[object Arguments]";function zYe(e){return $Ye(e)&&MYe(e)==BYe}var UYe=zYe,GV=UYe,qYe=Nh,Lce=Object.prototype,VYe=Lce.hasOwnProperty,WYe=Lce.propertyIsEnumerable,HYe=GV(function(){return arguments}())?GV:function(e){return qYe(e)&&VYe.call(e,"callee")&&!WYe.call(e,"callee")},UF=HYe,A4={exports:{}};function GYe(){return!1}var KYe=GYe;A4.exports;(function(e,t){var r=lf,n=KYe,a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===a,l=o?r.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||n;e.exports=u})(A4,A4.exports);var Fce=A4.exports,YYe=9007199254740991,XYe=/^(?:0|[1-9]\d*)$/;function ZYe(e,t){var r=typeof e;return t=t??YYe,!!t&&(r=="number"||r!="symbol"&&XYe.test(e))&&e>-1&&e%1==0&&e<t}var qF=ZYe,JYe=9007199254740991;function QYe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=JYe}var VF=QYe,eXe=_h,tXe=VF,rXe=Nh,nXe="[object Arguments]",sXe="[object Array]",aXe="[object Boolean]",iXe="[object Date]",oXe="[object Error]",lXe="[object Function]",cXe="[object Map]",uXe="[object Number]",dXe="[object Object]",fXe="[object RegExp]",hXe="[object Set]",mXe="[object String]",pXe="[object WeakMap]",gXe="[object ArrayBuffer]",xXe="[object DataView]",vXe="[object Float32Array]",yXe="[object Float64Array]",bXe="[object Int8Array]",wXe="[object Int16Array]",jXe="[object Int32Array]",_Xe="[object Uint8Array]",NXe="[object Uint8ClampedArray]",SXe="[object Uint16Array]",kXe="[object Uint32Array]",Is={};Is[vXe]=Is[yXe]=Is[bXe]=Is[wXe]=Is[jXe]=Is[_Xe]=Is[NXe]=Is[SXe]=Is[kXe]=!0;Is[nXe]=Is[sXe]=Is[gXe]=Is[aXe]=Is[xXe]=Is[iXe]=Is[oXe]=Is[lXe]=Is[cXe]=Is[uXe]=Is[dXe]=Is[fXe]=Is[hXe]=Is[mXe]=Is[pXe]=!1;function CXe(e){return rXe(e)&&tXe(e.length)&&!!Is[eXe(e)]}var EXe=CXe;function AXe(e){return function(t){return e(t)}}var Mce=AXe,T4={exports:{}};T4.exports;(function(e,t){var r=Hle,n=t&&!t.nodeType&&t,a=n&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===n,o=i&&r.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})(T4,T4.exports);var TXe=T4.exports,PXe=EXe,OXe=Mce,KV=TXe,YV=KV&&KV.isTypedArray,DXe=YV?OXe(YV):PXe,$ce=DXe,IXe=FYe,RXe=UF,LXe=_l,FXe=Fce,MXe=qF,$Xe=$ce,BXe=Object.prototype,zXe=BXe.hasOwnProperty;function UXe(e,t){var r=LXe(e),n=!r&&RXe(e),a=!r&&!n&&FXe(e),i=!r&&!n&&!a&&$Xe(e),o=r||n||a||i,l=o?IXe(e.length,String):[],c=l.length;for(var u in e)(t||zXe.call(e,u))&&!(o&&(u=="length"||a&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||MXe(u,c)))&&l.push(u);return l}var qXe=UXe,VXe=Object.prototype;function WXe(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||VXe;return e===r}var HXe=WXe;function GXe(e,t){return function(r){return e(t(r))}}var Bce=GXe,KXe=Bce,YXe=KXe(Object.keys,Object),XXe=YXe,ZXe=HXe,JXe=XXe,QXe=Object.prototype,eZe=QXe.hasOwnProperty;function tZe(e){if(!ZXe(e))return JXe(e);var t=[];for(var r in Object(e))eZe.call(e,r)&&r!="constructor"&&t.push(r);return t}var rZe=tZe,nZe=SF,sZe=VF;function aZe(e){return e!=null&&sZe(e.length)&&!nZe(e)}var d_=aZe,iZe=qXe,oZe=rZe,lZe=d_;function cZe(e){return lZe(e)?iZe(e):oZe(e)}var AE=cZe,uZe=SYe,dZe=RYe,fZe=AE;function hZe(e){return uZe(e,fZe,dZe)}var mZe=hZe,XV=mZe,pZe=1,gZe=Object.prototype,xZe=gZe.hasOwnProperty;function vZe(e,t,r,n,a,i){var o=r&pZe,l=XV(e),c=l.length,u=XV(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var m=l[f];if(!(o?m in t:xZe.call(t,m)))return!1}var h=i.get(e),g=i.get(t);if(h&&g)return h==t&&g==e;var p=!0;i.set(e,t),i.set(t,e);for(var x=o;++f<c;){m=l[f];var v=e[m],b=t[m];if(n)var y=o?n(b,v,m,t,e,i):n(v,b,m,e,t,i);if(!(y===void 0?v===b||a(v,b,r,n,i):y)){p=!1;break}x||(x=m=="constructor")}if(p&&!x){var N=e.constructor,_=t.constructor;N!=_&&"constructor"in e&&"constructor"in t&&!(typeof N=="function"&&N instanceof N&&typeof _=="function"&&_ instanceof _)&&(p=!1)}return i.delete(e),i.delete(t),p}var yZe=vZe,bZe=Ug,wZe=lf,jZe=bZe(wZe,"DataView"),_Ze=jZe,NZe=Ug,SZe=lf,kZe=NZe(SZe,"Promise"),CZe=kZe,EZe=Ug,AZe=lf,TZe=EZe(AZe,"Set"),zce=TZe,PZe=Ug,OZe=lf,DZe=PZe(OZe,"WeakMap"),IZe=DZe,$8=_Ze,B8=CF,z8=CZe,U8=zce,q8=IZe,Uce=_h,S1=Kle,ZV="[object Map]",RZe="[object Object]",JV="[object Promise]",QV="[object Set]",eW="[object WeakMap]",tW="[object DataView]",LZe=S1($8),FZe=S1(B8),MZe=S1(z8),$Ze=S1(U8),BZe=S1(q8),c0=Uce;($8&&c0(new $8(new ArrayBuffer(1)))!=tW||B8&&c0(new B8)!=ZV||z8&&c0(z8.resolve())!=JV||U8&&c0(new U8)!=QV||q8&&c0(new q8)!=eW)&&(c0=function(e){var t=Uce(e),r=t==RZe?e.constructor:void 0,n=r?S1(r):"";if(n)switch(n){case LZe:return tW;case FZe:return ZV;case MZe:return JV;case $Ze:return QV;case BZe:return eW}return t});var zZe=c0,eP=Tce,UZe=Ice,qZe=bYe,VZe=yZe,rW=zZe,nW=_l,sW=Fce,WZe=$ce,HZe=1,aW="[object Arguments]",iW="[object Array]",hS="[object Object]",GZe=Object.prototype,oW=GZe.hasOwnProperty;function KZe(e,t,r,n,a,i){var o=nW(e),l=nW(t),c=o?iW:rW(e),u=l?iW:rW(t);c=c==aW?hS:c,u=u==aW?hS:u;var d=c==hS,f=u==hS,m=c==u;if(m&&sW(e)){if(!sW(t))return!1;o=!0,d=!1}if(m&&!d)return i||(i=new eP),o||WZe(e)?UZe(e,t,r,n,a,i):qZe(e,t,c,r,n,a,i);if(!(r&HZe)){var h=d&&oW.call(e,"__wrapped__"),g=f&&oW.call(t,"__wrapped__");if(h||g){var p=h?e.value():e,x=g?t.value():t;return i||(i=new eP),a(p,x,r,n,i)}}return m?(i||(i=new eP),VZe(e,t,r,n,a,i)):!1}var YZe=KZe,XZe=YZe,lW=Nh;function qce(e,t,r,n,a){return e===t?!0:e==null||t==null||!lW(e)&&!lW(t)?e!==e&&t!==t:XZe(e,t,r,n,qce,a)}var WF=qce,ZZe=Tce,JZe=WF,QZe=1,eJe=2;function tJe(e,t,r,n){var a=r.length,i=a,o=!n;if(e==null)return!i;for(e=Object(e);a--;){var l=r[a];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++a<i;){l=r[a];var c=l[0],u=e[c],d=l[1];if(o&&l[2]){if(u===void 0&&!(c in e))return!1}else{var f=new ZZe;if(n)var m=n(u,d,c,e,t,f);if(!(m===void 0?JZe(d,u,QZe|eJe,n,f):m))return!1}}return!0}var rJe=tJe,nJe=Tp;function sJe(e){return e===e&&!nJe(e)}var Vce=sJe,aJe=Vce,iJe=AE;function oJe(e){for(var t=iJe(e),r=t.length;r--;){var n=t[r],a=e[n];t[r]=[n,a,aJe(a)]}return t}var lJe=oJe;function cJe(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Wce=cJe,uJe=rJe,dJe=lJe,fJe=Wce;function hJe(e){var t=dJe(e);return t.length==1&&t[0][2]?fJe(t[0][0],t[0][1]):function(r){return r===e||uJe(r,e,t)}}var mJe=hJe;function pJe(e,t){return e!=null&&t in Object(e)}var gJe=pJe,xJe=Qle,vJe=UF,yJe=_l,bJe=qF,wJe=VF,jJe=mE;function _Je(e,t,r){t=xJe(t,e);for(var n=-1,a=t.length,i=!1;++n<a;){var o=jJe(t[n]);if(!(i=e!=null&&r(e,o)))break;e=e[o]}return i||++n!=a?i:(a=e==null?0:e.length,!!a&&wJe(a)&&bJe(o,a)&&(yJe(e)||vJe(e)))}var NJe=_Je,SJe=gJe,kJe=NJe;function CJe(e,t){return e!=null&&kJe(e,t,SJe)}var EJe=CJe,AJe=WF,TJe=ece,PJe=EJe,OJe=NF,DJe=Vce,IJe=Wce,RJe=mE,LJe=1,FJe=2;function MJe(e,t){return OJe(e)&&DJe(t)?IJe(RJe(e),t):function(r){var n=TJe(r,e);return n===void 0&&n===t?PJe(r,e):AJe(t,n,LJe|FJe)}}var $Je=MJe;function BJe(e){return e}var k1=BJe;function zJe(e){return function(t){return t==null?void 0:t[e]}}var UJe=zJe,qJe=PF;function VJe(e){return function(t){return qJe(t,e)}}var WJe=VJe,HJe=UJe,GJe=WJe,KJe=NF,YJe=mE;function XJe(e){return KJe(e)?HJe(YJe(e)):GJe(e)}var ZJe=XJe,JJe=mJe,QJe=$Je,eQe=k1,tQe=_l,rQe=ZJe;function nQe(e){return typeof e=="function"?e:e==null?eQe:typeof e=="object"?tQe(e)?QJe(e[0],e[1]):JJe(e):rQe(e)}var cf=nQe;function sQe(e,t,r,n){for(var a=e.length,i=r+(n?1:-1);n?i--:++i<a;)if(t(e[i],i,e))return i;return-1}var Hce=sQe;function aQe(e){return e!==e}var iQe=aQe;function oQe(e,t,r){for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var lQe=oQe,cQe=Hce,uQe=iQe,dQe=lQe;function fQe(e,t,r){return t===t?dQe(e,t,r):cQe(e,uQe,r)}var hQe=fQe,mQe=hQe;function pQe(e,t){var r=e==null?0:e.length;return!!r&&mQe(e,t,0)>-1}var gQe=pQe;function xQe(e,t,r){for(var n=-1,a=e==null?0:e.length;++n<a;)if(r(t,e[n]))return!0;return!1}var vQe=xQe;function yQe(){}var bQe=yQe,tP=zce,wQe=bQe,jQe=zF,_Qe=1/0,NQe=tP&&1/jQe(new tP([,-0]))[1]==_Qe?function(e){return new tP(e)}:wQe,SQe=NQe,kQe=Pce,CQe=gQe,EQe=vQe,AQe=Dce,TQe=SQe,PQe=zF,OQe=200;function DQe(e,t,r){var n=-1,a=CQe,i=e.length,o=!0,l=[],c=l;if(r)o=!1,a=EQe;else if(i>=OQe){var u=t?null:TQe(e);if(u)return PQe(u);o=!1,a=AQe,c=new kQe}else c=t?[]:l;e:for(;++n<i;){var d=e[n],f=t?t(d):d;if(d=r||d!==0?d:0,o&&f===f){for(var m=c.length;m--;)if(c[m]===f)continue e;t&&c.push(f),l.push(d)}else a(c,f,r)||(c!==l&&c.push(f),l.push(d))}return l}var IQe=DQe,RQe=cf,LQe=IQe;function FQe(e,t){return e&&e.length?LQe(e,RQe(t)):[]}var MQe=FQe;const cW=jn(MQe);function Gce(e,t,r){return t===!0?cW(e,r):Mr(t)?cW(e,t):e}function my(e){"@babel/helpers - typeof";return my=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},my(e)}var $Qe=["ref"];function uW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Df(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uW(Object(r),!0).forEach(function(n){TE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BQe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dW(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Yce(n.key),n)}}function zQe(e,t,r){return t&&dW(e.prototype,t),r&&dW(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function UQe(e,t,r){return t=P4(t),qQe(e,Kce()?Reflect.construct(t,r||[],P4(e).constructor):t.apply(e,r))}function qQe(e,t){if(t&&(my(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return VQe(e)}function VQe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kce(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Kce=function(){return!!e})()}function P4(e){return P4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},P4(e)}function WQe(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&&V8(e,t)}function V8(e,t){return V8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},V8(e,t)}function TE(e,t,r){return t=Yce(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yce(e){var t=HQe(e,"string");return my(t)=="symbol"?t:t+""}function HQe(e,t){if(my(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(my(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function GQe(e,t){if(e==null)return{};var r=KQe(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function KQe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function YQe(e){return e.value}function XQe(e,t){if(be.isValidElement(e))return be.cloneElement(e,t);if(typeof e=="function")return be.createElement(e,t);t.ref;var r=GQe(t,$Qe);return be.createElement(BF,r)}var fW=1,W0=function(e){function t(){var r;BQe(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=UQe(this,t,[].concat(a)),TE(r,"lastBoundingBox",{width:-1,height:-1}),r}return WQe(t,e),zQe(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>fW||Math.abs(a.height-this.lastBoundingBox.height)>fW)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Df({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,i=a.layout,o=a.align,l=a.verticalAlign,c=a.margin,u=a.chartWidth,d=a.chartHeight,f,m;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&i==="vertical"){var h=this.getBBoxSnapshot();f={left:((u||0)-h.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();m={top:((d||0)-g.height)/2}}else m=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Df(Df({},f),m)}},{key:"render",value:function(){var n=this,a=this.props,i=a.content,o=a.width,l=a.height,c=a.wrapperStyle,u=a.payloadUniqBy,d=a.payload,f=Df(Df({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return be.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(h){n.wrapperNode=h}},XQe(i,Df(Df({},this.props),{},{payload:Gce(d,u,YQe)})))}}],[{key:"getWithHeight",value:function(n,a){var i=Df(Df({},this.defaultProps),n.props),o=i.layout;return o==="vertical"&&Dt(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||a}:null}}])}(w.PureComponent);TE(W0,"displayName","Legend");TE(W0,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var hW=c_,ZQe=UF,JQe=_l,mW=hW?hW.isConcatSpreadable:void 0;function QQe(e){return JQe(e)||ZQe(e)||!!(mW&&e&&e[mW])}var eet=QQe,tet=Rce,ret=eet;function Xce(e,t,r,n,a){var i=-1,o=e.length;for(r||(r=ret),a||(a=[]);++i<o;){var l=e[i];t>0&&r(l)?t>1?Xce(l,t-1,r,n,a):tet(a,l):n||(a[a.length]=l)}return a}var Zce=Xce;function net(e){return function(t,r,n){for(var a=-1,i=Object(t),o=n(t),l=o.length;l--;){var c=o[e?l:++a];if(r(i[c],c,i)===!1)break}return t}}var set=net,aet=set,iet=aet(),oet=iet,cet=oet,uet=AE;function det(e,t){return e&&cet(e,t,uet)}var Jce=det,fet=d_;function het(e,t){return function(r,n){if(r==null)return r;if(!fet(r))return e(r,n);for(var a=r.length,i=t?a:-1,o=Object(r);(t?i--:++i<a)&&n(o[i],i,o)!==!1;);return r}}var met=het,pet=Jce,get=met,xet=get(pet),HF=xet,vet=HF,yet=d_;function bet(e,t){var r=-1,n=yet(e)?Array(e.length):[];return vet(e,function(a,i,o){n[++r]=t(a,i,o)}),n}var Qce=bet;function wet(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var jet=wet,pW=v1;function _et(e,t){if(e!==t){var r=e!==void 0,n=e===null,a=e===e,i=pW(e),o=t!==void 0,l=t===null,c=t===t,u=pW(t);if(!l&&!u&&!i&&e>t||i&&o&&c&&!l&&!u||n&&o&&c||!r&&c||!a)return 1;if(!n&&!i&&!u&&e<t||u&&r&&a&&!n&&!i||l&&r&&a||!o&&a||!c)return-1}return 0}var Net=_et,ket=Net;function Cet(e,t,r){for(var n=-1,a=e.criteria,i=t.criteria,o=a.length,l=r.length;++n<o;){var c=ket(a[n],i[n]);if(c){if(n>=l)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}var Eet=Cet,rP=TF,Aet=PF,Tet=cf,Pet=Qce,Oet=jet,Det=Mce,Iet=Eet,Ret=k1,Let=_l;function Fet(e,t,r){t.length?t=rP(t,function(i){return Let(i)?function(o){return Aet(o,i.length===1?i[0]:i)}:i}):t=[Ret];var n=-1;t=rP(t,Det(Tet));var a=Pet(e,function(i,o,l){var c=rP(t,function(u){return u(i)});return{criteria:c,index:++n,value:i}});return Oet(a,function(i,o){return Iet(i,o,r)})}var Met=Fet;function $et(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Bet=$et,zet=Bet,gW=Math.max;function Uet(e,t,r){return t=gW(t===void 0?e.length-1:t,0),function(){for(var n=arguments,a=-1,i=gW(n.length-t,0),o=Array(i);++a<i;)o[a]=n[t+a];a=-1;for(var l=Array(t+1);++a<t;)l[a]=n[a];return l[t]=r(o),zet(e,this,l)}}var qet=Uet;function Vet(e){return function(){return e}}var Wet=Vet,Het=Ug,Get=function(){try{var e=Het(Object,"defineProperty");return e({},"",{}),e}catch{}}(),eue=Get,Ket=Wet,xW=eue,Yet=k1,Xet=xW?function(e,t){return xW(e,"toString",{configurable:!0,enumerable:!1,value:Ket(t),writable:!0})}:Yet,Zet=Xet,Jet=800,Qet=16,ett=Date.now;function ttt(e){var t=0,r=0;return function(){var n=ett(),a=Qet-(n-r);if(r=n,a>0){if(++t>=Jet)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var rtt=ttt,ntt=Zet,stt=rtt,att=stt(ntt),itt=att,ott=k1,ltt=qet,ctt=itt;function utt(e,t){return ctt(ltt(e,t,ott),e+"")}var dtt=utt,ftt=kF,htt=d_,mtt=qF,ptt=Tp;function gtt(e,t,r){if(!ptt(r))return!1;var n=typeof t;return(n=="number"?htt(r)&&mtt(t,r.length):n=="string"&&t in r)?ftt(r[t],e):!1}var PE=gtt,xtt=Zce,vtt=Met,ytt=dtt,vW=PE,btt=ytt(function(e,t){if(e==null)return[];var r=t.length;return r>1&&vW(e,t[0],t[1])?t=[]:r>2&&vW(t[0],t[1],t[2])&&(t=[t[0]]),vtt(e,xtt(t,1),[])}),wtt=btt;const GF=jn(wtt);function P2(e){"@babel/helpers - typeof";return P2=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},P2(e)}function W8(){return W8=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},W8.apply(this,arguments)}function jtt(e,t){return ktt(e)||Stt(e,t)||Ntt(e,t)||_tt()}function _tt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ntt(e,t){if(e){if(typeof e=="string")return yW(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yW(e,t)}}function yW(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Stt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function ktt(e){if(Array.isArray(e))return e}function bW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function nP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bW(Object(r),!0).forEach(function(n){Ctt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ctt(e,t,r){return t=Ett(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ett(e){var t=Att(e,"string");return P2(t)=="symbol"?t:t+""}function Att(e,t){if(P2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(P2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ttt(e){return Array.isArray(e)&&gi(e[0])&&gi(e[1])?e.join(" ~ "):e}var Ptt=function(t){var r=t.separator,n=r===void 0?" : ":r,a=t.contentStyle,i=a===void 0?{}:a,o=t.itemStyle,l=o===void 0?{}:o,c=t.labelStyle,u=c===void 0?{}:c,d=t.payload,f=t.formatter,m=t.itemSorter,h=t.wrapperClassName,g=t.labelClassName,p=t.label,x=t.labelFormatter,v=t.accessibilityLayer,b=v===void 0?!1:v,y=function(){if(d&&d.length){var k={padding:0,margin:0},V=(m?GF(d,m):d).map(function(C,R){if(C.type==="none")return null;var H=nP({display:"block",paddingTop:4,paddingBottom:4,color:C.color||"#000"},l),q=C.formatter||f||Ttt,L=C.value,M=C.name,z=L,K=M;if(q&&z!=null&&K!=null){var E=q(L,M,C,R,d);if(Array.isArray(E)){var A=jtt(E,2);z=A[0],K=A[1]}else z=E}return be.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(R),style:H},gi(K)?be.createElement("span",{className:"recharts-tooltip-item-name"},K):null,gi(K)?be.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,be.createElement("span",{className:"recharts-tooltip-item-value"},z),be.createElement("span",{className:"recharts-tooltip-item-unit"},C.unit||""))});return be.createElement("ul",{className:"recharts-tooltip-item-list",style:k},V)}return null},N=nP({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),_=nP({margin:0},u),j=!Xr(p),S=j?p:"",I=en("recharts-default-tooltip",h),P=en("recharts-tooltip-label",g);j&&x&&d!==void 0&&d!==null&&(S=x(p,d));var F=b?{role:"status","aria-live":"assertive"}:{};return be.createElement("div",W8({className:I,style:N},F),be.createElement("p",{className:P,style:_},be.isValidElement(S)?S:"".concat(S)),y())};function O2(e){"@babel/helpers - typeof";return O2=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},O2(e)}function mS(e,t,r){return t=Ott(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ott(e){var t=Dtt(e,"string");return O2(t)=="symbol"?t:t+""}function Dtt(e,t){if(O2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(O2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Pb="recharts-tooltip-wrapper",Itt={visibility:"hidden"};function Rtt(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return en(Pb,mS(mS(mS(mS({},"".concat(Pb,"-right"),Dt(r)&&t&&Dt(t.x)&&r>=t.x),"".concat(Pb,"-left"),Dt(r)&&t&&Dt(t.x)&&r<t.x),"".concat(Pb,"-bottom"),Dt(n)&&t&&Dt(t.y)&&n>=t.y),"".concat(Pb,"-top"),Dt(n)&&t&&Dt(t.y)&&n<t.y))}function wW(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.key,a=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipDimension,c=e.viewBox,u=e.viewBoxDimension;if(i&&Dt(i[n]))return i[n];var d=r[n]-l-a,f=r[n]+a;if(t[n])return o[n]?d:f;if(o[n]){var m=d,h=c[n];return m<h?Math.max(f,c[n]):Math.max(d,c[n])}var g=f+l,p=c[n]+u;return g>p?Math.max(d,c[n]):Math.max(f,c[n])}function Ltt(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function Ftt(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,a=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&r?(d=wW({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=wW({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:a,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=Ltt({translateX:d,translateY:f,useTranslate3d:l})):u=Itt,{cssProperties:u,cssClasses:Rtt({translateX:d,translateY:f,coordinate:r})}}function py(e){"@babel/helpers - typeof";return py=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},py(e)}function jW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _W(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jW(Object(r),!0).forEach(function(n){G8(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mtt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $tt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,rue(n.key),n)}}function Btt(e,t,r){return t&&$tt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ztt(e,t,r){return t=O4(t),Utt(e,tue()?Reflect.construct(t,r||[],O4(e).constructor):t.apply(e,r))}function Utt(e,t){if(t&&(py(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qtt(e)}function qtt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tue=function(){return!!e})()}function O4(e){return O4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},O4(e)}function Vtt(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&&H8(e,t)}function H8(e,t){return H8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},H8(e,t)}function G8(e,t,r){return t=rue(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rue(e){var t=Wtt(e,"string");return py(t)=="symbol"?t:t+""}function Wtt(e,t){if(py(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(py(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var NW=1,Htt=function(e){function t(){var r;Mtt(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=ztt(this,t,[].concat(a)),G8(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),G8(r,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,u,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=r.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(u=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&u!==void 0?u:0}})}}),r}return Vtt(t,e),Btt(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>NW||Math.abs(n.height-this.state.lastBoundingBox.height)>NW)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.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 n=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,u=a.children,d=a.coordinate,f=a.hasPayload,m=a.isAnimationActive,h=a.offset,g=a.position,p=a.reverseDirection,x=a.useTranslate3d,v=a.viewBox,b=a.wrapperStyle,y=Ftt({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:h,position:g,reverseDirection:p,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:v}),N=y.cssClasses,_=y.cssProperties,j=_W(_W({transition:m&&i?"transform ".concat(l,"ms ").concat(c):void 0},_),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},b);return be.createElement("div",{tabIndex:-1,className:N,style:j,ref:function(I){n.wrapperNode=I}},u)}}])}(w.PureComponent),Gtt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},qg={isSsr:Gtt()};function gy(e){"@babel/helpers - typeof";return gy=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},gy(e)}function SW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function kW(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?SW(Object(r),!0).forEach(function(n){KF(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ktt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ytt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,sue(n.key),n)}}function Xtt(e,t,r){return t&&Ytt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ztt(e,t,r){return t=D4(t),Jtt(e,nue()?Reflect.construct(t,r||[],D4(e).constructor):t.apply(e,r))}function Jtt(e,t){if(t&&(gy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qtt(e)}function Qtt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nue(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nue=function(){return!!e})()}function D4(e){return D4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},D4(e)}function ert(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&&K8(e,t)}function K8(e,t){return K8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},K8(e,t)}function KF(e,t,r){return t=sue(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sue(e){var t=trt(e,"string");return gy(t)=="symbol"?t:t+""}function trt(e,t){if(gy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(gy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function rrt(e){return e.dataKey}function nrt(e,t){return be.isValidElement(e)?be.cloneElement(e,t):typeof e=="function"?be.createElement(e,t):be.createElement(Ptt,t)}var Ml=function(e){function t(){return Ktt(this,t),Ztt(this,t,arguments)}return ert(t,e),Xtt(t,[{key:"render",value:function(){var n=this,a=this.props,i=a.active,o=a.allowEscapeViewBox,l=a.animationDuration,c=a.animationEasing,u=a.content,d=a.coordinate,f=a.filterNull,m=a.isAnimationActive,h=a.offset,g=a.payload,p=a.payloadUniqBy,x=a.position,v=a.reverseDirection,b=a.useTranslate3d,y=a.viewBox,N=a.wrapperStyle,_=g??[];f&&_.length&&(_=Gce(g.filter(function(S){return S.value!=null&&(S.hide!==!0||n.props.includeHidden)}),p,rrt));var j=_.length>0;return be.createElement(Htt,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:m,active:i,coordinate:d,hasPayload:j,offset:h,position:x,reverseDirection:v,useTranslate3d:b,viewBox:y,wrapperStyle:N},nrt(u,kW(kW({},this.props),{},{payload:_})))}}])}(w.PureComponent);KF(Ml,"displayName","Tooltip");KF(Ml,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!qg.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 srt=lf,art=function(){return srt.Date.now()},irt=art,ort=/\s/;function lrt(e){for(var t=e.length;t--&&ort.test(e.charAt(t)););return t}var crt=lrt,urt=crt,drt=/^\s+/;function frt(e){return e&&e.slice(0,urt(e)+1).replace(drt,"")}var hrt=frt,mrt=hrt,CW=Tp,prt=v1,EW=NaN,grt=/^[-+]0x[0-9a-f]+$/i,xrt=/^0b[01]+$/i,vrt=/^0o[0-7]+$/i,yrt=parseInt;function brt(e){if(typeof e=="number")return e;if(prt(e))return EW;if(CW(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=CW(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=mrt(e);var r=xrt.test(e);return r||vrt.test(e)?yrt(e.slice(2),r?2:8):grt.test(e)?EW:+e}var aue=brt,wrt=Tp,sP=irt,AW=aue,jrt="Expected a function",_rt=Math.max,Nrt=Math.min;function Srt(e,t,r){var n,a,i,o,l,c,u=0,d=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(jrt);t=AW(t)||0,wrt(r)&&(d=!!r.leading,f="maxWait"in r,i=f?_rt(AW(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function h(j){var S=n,I=a;return n=a=void 0,u=j,o=e.apply(I,S),o}function g(j){return u=j,l=setTimeout(v,t),d?h(j):o}function p(j){var S=j-c,I=j-u,P=t-S;return f?Nrt(P,i-I):P}function x(j){var S=j-c,I=j-u;return c===void 0||S>=t||S<0||f&&I>=i}function v(){var j=sP();if(x(j))return b(j);l=setTimeout(v,p(j))}function b(j){return l=void 0,m&&n?h(j):(n=a=void 0,o)}function y(){l!==void 0&&clearTimeout(l),u=0,n=c=a=l=void 0}function N(){return l===void 0?o:b(sP())}function _(){var j=sP(),S=x(j);if(n=arguments,a=this,c=j,S){if(l===void 0)return g(c);if(f)return clearTimeout(l),l=setTimeout(v,t),h(c)}return l===void 0&&(l=setTimeout(v,t)),o}return _.cancel=y,_.flush=N,_}var krt=Srt,Crt=krt,Ert=Tp,Art="Expected a function";function Trt(e,t,r){var n=!0,a=!0;if(typeof e!="function")throw new TypeError(Art);return Ert(r)&&(n="leading"in r?!!r.leading:n,a="trailing"in r?!!r.trailing:a),Crt(e,t,{leading:n,maxWait:t,trailing:a})}var Prt=Trt;const iue=jn(Prt);function D2(e){"@babel/helpers - typeof";return D2=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},D2(e)}function TW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function pS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?TW(Object(r),!0).forEach(function(n){Ort(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ort(e,t,r){return t=Drt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Drt(e){var t=Irt(e,"string");return D2(t)=="symbol"?t:t+""}function Irt(e,t){if(D2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(D2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rrt(e,t){return $rt(e)||Mrt(e,t)||Frt(e,t)||Lrt()}function Lrt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Frt(e,t){if(e){if(typeof e=="string")return PW(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return PW(e,t)}}function PW(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Mrt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function $rt(e){if(Array.isArray(e))return e}var I4=w.forwardRef(function(e,t){var r=e.aspect,n=e.initialDimension,a=n===void 0?{width:-1,height:-1}:n,i=e.width,o=i===void 0?"100%":i,l=e.height,c=l===void 0?"100%":l,u=e.minWidth,d=u===void 0?0:u,f=e.minHeight,m=e.maxHeight,h=e.children,g=e.debounce,p=g===void 0?0:g,x=e.id,v=e.className,b=e.onResize,y=e.style,N=y===void 0?{}:y,_=w.useRef(null),j=w.useRef();j.current=b,w.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 S=w.useState({containerWidth:a.width,containerHeight:a.height}),I=Rrt(S,2),P=I[0],F=I[1],T=w.useCallback(function(V,C){F(function(R){var H=Math.round(V),q=Math.round(C);return R.containerWidth===H&&R.containerHeight===q?R:{containerWidth:H,containerHeight:q}})},[]);w.useEffect(function(){var V=function(M){var z,K=M[0].contentRect,E=K.width,A=K.height;T(E,A),(z=j.current)===null||z===void 0||z.call(j,E,A)};p>0&&(V=iue(V,p,{trailing:!0,leading:!1}));var C=new ResizeObserver(V),R=_.current.getBoundingClientRect(),H=R.width,q=R.height;return T(H,q),C.observe(_.current),function(){C.disconnect()}},[T,p]);var k=w.useMemo(function(){var V=P.containerWidth,C=P.containerHeight;if(V<0||C<0)return null;Hu(_0(o)||_0(c),`The width(%s) and height(%s) are both fixed numbers,
maybe you don't need to use a ResponsiveContainer.`,o,c),Hu(!r||r>0,"The aspect(%s) must be greater than zero.",r);var R=_0(o)?V:o,H=_0(c)?C:c;r&&r>0&&(R?H=R/r:H&&(R=H*r),m&&H>m&&(H=m)),Hu(R>0||H>0,`The width(%s) and height(%s) of chart should be greater than 0,
please check the style of container, or the props width(%s) and height(%s),
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
height and width.`,R,H,o,c,d,f,r);var q=!Array.isArray(h)&&Qf(h.type).endsWith("Chart");return be.Children.map(h,function(L){return be.isValidElement(L)?w.cloneElement(L,pS({width:R,height:H},q?{style:pS({height:"100%",width:"100%",maxHeight:H,maxWidth:R},L.props.style)}:{})):L})},[r,h,c,m,f,d,P,o]);return be.createElement("div",{id:x?"".concat(x):void 0,className:en("recharts-responsive-container",v),style:pS(pS({},N),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:m}),ref:_},k)}),f_=function(t){return null};f_.displayName="Cell";function I2(e){"@babel/helpers - typeof";return I2=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},I2(e)}function OW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Y8(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?OW(Object(r),!0).forEach(function(n){Brt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OW(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Brt(e,t,r){return t=zrt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zrt(e){var t=Urt(e,"string");return I2(t)=="symbol"?t:t+""}function Urt(e,t){if(I2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(I2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Sx={widthCache:{},cacheCount:0},qrt=2e3,Vrt={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},DW="recharts_measurement_span";function Wrt(e){var t=Y8({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var Sw=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||qg.isSsr)return{width:0,height:0};var n=Wrt(r),a=JSON.stringify({text:t,copyStyle:n});if(Sx.widthCache[a])return Sx.widthCache[a];try{var i=document.getElementById(DW);i||(i=document.createElement("span"),i.setAttribute("id",DW),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=Y8(Y8({},Vrt),n);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return Sx.widthCache[a]=c,++Sx.cacheCount>qrt&&(Sx.cacheCount=0,Sx.widthCache={}),c}catch{return{width:0,height:0}}},Hrt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function R2(e){"@babel/helpers - typeof";return R2=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},R2(e)}function R4(e,t){return Xrt(e)||Yrt(e,t)||Krt(e,t)||Grt()}function Grt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Krt(e,t){if(e){if(typeof e=="string")return IW(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return IW(e,t)}}function IW(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Yrt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Xrt(e){if(Array.isArray(e))return e}function Zrt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RW(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Qrt(n.key),n)}}function Jrt(e,t,r){return t&&RW(e.prototype,t),r&&RW(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Qrt(e){var t=ent(e,"string");return R2(t)=="symbol"?t:t+""}function ent(e,t){if(R2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(R2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var LW=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,FW=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,tnt=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,rnt=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,oue={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},nnt=Object.keys(oue),rv="NaN";function snt(e,t){return e*oue[t]}var gS=function(){function e(t,r){Zrt(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!tnt.test(r)&&(this.num=NaN,this.unit=""),nnt.includes(r)&&(this.num=snt(t,r),this.unit="px")}return Jrt(e,[{key:"add",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new e(NaN,""):new e(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new e(NaN,""):new e(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,a=(n=rnt.exec(r))!==null&&n!==void 0?n:[],i=R4(a,3),o=i[1],l=i[2];return new e(parseFloat(o),l??"")}}])}();function lue(e){if(e.includes(rv))return rv;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=LW.exec(t))!==null&&r!==void 0?r:[],a=R4(n,4),i=a[1],o=a[2],l=a[3],c=gS.parse(i??""),u=gS.parse(l??""),d=o==="*"?c.multiply(u):c.divide(u);if(d.isNaN())return rv;t=t.replace(LW,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,m=(f=FW.exec(t))!==null&&f!==void 0?f:[],h=R4(m,4),g=h[1],p=h[2],x=h[3],v=gS.parse(g??""),b=gS.parse(x??""),y=p==="+"?v.add(b):v.subtract(b);if(y.isNaN())return rv;t=t.replace(FW,y.toString())}return t}var MW=/\(([^()]*)\)/;function ant(e){for(var t=e;t.includes("(");){var r=MW.exec(t),n=R4(r,2),a=n[1];t=t.replace(MW,lue(a))}return t}function int(e){var t=e.replace(/\s+/g,"");return t=ant(t),t=lue(t),t}function ont(e){try{return int(e)}catch{return rv}}function aP(e){var t=ont(e.slice(5,-1));return t===rv?"":t}var lnt=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],cnt=["dx","dy","angle","className","breakAll"];function X8(){return X8=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},X8.apply(this,arguments)}function $W(e,t){if(e==null)return{};var r=unt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function unt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function BW(e,t){return mnt(e)||hnt(e,t)||fnt(e,t)||dnt()}function dnt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fnt(e,t){if(e){if(typeof e=="string")return zW(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zW(e,t)}}function zW(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function hnt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function mnt(e){if(Array.isArray(e))return e}var cue=/[ \f\n\r\t\v\u2028\u2029]+/,uue=function(t){var r=t.children,n=t.breakAll,a=t.style;try{var i=[];Xr(r)||(n?i=r.toString().split(""):i=r.toString().split(cue));var o=i.map(function(c){return{word:c,width:Sw(c,a).width}}),l=n?0:Sw(" ",a).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},pnt=function(t,r,n,a,i){var o=t.maxLines,l=t.children,c=t.style,u=t.breakAll,d=Dt(o),f=l,m=function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return R.reduce(function(H,q){var L=q.word,M=q.width,z=H[H.length-1];if(z&&(a==null||i||z.width+M+n<Number(a)))z.words.push(L),z.width+=M+n;else{var K={words:[L],width:M};H.push(K)}return H},[])},h=m(r),g=function(R){return R.reduce(function(H,q){return H.width>q.width?H:q})};if(!d)return h;for(var p="…",x=function(R){var H=f.slice(0,R),q=uue({breakAll:u,style:c,children:H+p}).wordsWithComputedWidth,L=m(q),M=L.length>o||g(L).width>Number(a);return[M,L]},v=0,b=f.length-1,y=0,N;v<=b&&y<=f.length-1;){var _=Math.floor((v+b)/2),j=_-1,S=x(j),I=BW(S,2),P=I[0],F=I[1],T=x(_),k=BW(T,1),V=k[0];if(!P&&!V&&(v=_+1),P&&V&&(b=_-1),!P&&V){N=F;break}y++}return N||h},UW=function(t){var r=Xr(t)?[]:t.toString().split(cue);return[{words:r}]},gnt=function(t){var r=t.width,n=t.scaleToFit,a=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((r||n)&&!qg.isSsr){var c,u,d=uue({breakAll:o,children:a,style:i});if(d){var f=d.wordsWithComputedWidth,m=d.spaceWidth;c=f,u=m}else return UW(a);return pnt({breakAll:o,children:a,maxLines:l,style:i},c,u,r,n)}return UW(a)},qW="#808080",vg=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,m=t.textAnchor,h=m===void 0?"start":m,g=t.verticalAnchor,p=g===void 0?"end":g,x=t.fill,v=x===void 0?qW:x,b=$W(t,lnt),y=w.useMemo(function(){return gnt({breakAll:b.breakAll,children:b.children,maxLines:b.maxLines,scaleToFit:f,style:b.style,width:b.width})},[b.breakAll,b.children,b.maxLines,f,b.style,b.width]),N=b.dx,_=b.dy,j=b.angle,S=b.className,I=b.breakAll,P=$W(b,cnt);if(!gi(n)||!gi(i))return null;var F=n+(Dt(N)?N:0),T=i+(Dt(_)?_:0),k;switch(p){case"start":k=aP("calc(".concat(u,")"));break;case"middle":k=aP("calc(".concat((y.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:k=aP("calc(".concat(y.length-1," * -").concat(l,")"));break}var V=[];if(f){var C=y[0].width,R=b.width;V.push("scale(".concat((Dt(R)?R/C:1)/C,")"))}return j&&V.push("rotate(".concat(j,", ").concat(F,", ").concat(T,")")),V.length&&(P.transform=V.join(" ")),be.createElement("text",X8({},Sr(P,!0),{x:F,y:T,className:en("recharts-text",S),textAnchor:h,fill:v.includes("url")?qW:v}),y.map(function(H,q){var L=H.words.join(I?"":" ");return be.createElement("tspan",{x:F,dy:q===0?k:l,key:"".concat(L,"-").concat(q)},L)}))};function Ym(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function xnt(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function YF(e){let t,r,n;e.length!==2?(t=Ym,r=(l,c)=>Ym(e(l),c),n=(l,c)=>e(l)-c):(t=e===Ym||e===xnt?e:vnt,r=e,n=e);function a(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<0?u=f+1:d=f}while(u<d)}return u}function i(l,c,u=0,d=l.length){if(u<d){if(t(c,c)!==0)return d;do{const f=u+d>>>1;r(l[f],c)<=0?u=f+1:d=f}while(u<d)}return u}function o(l,c,u=0,d=l.length){const f=a(l,c,u,d-1);return f>u&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:a,center:o,right:i}}function vnt(){return 0}function due(e){return e===null?NaN:+e}function*ynt(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const bnt=YF(Ym),h_=bnt.right;YF(due).center;class VW extends Map{constructor(t,r=_nt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(WW(this,t))}has(t){return super.has(WW(this,t))}set(t,r){return super.set(wnt(this,t),r)}delete(t){return super.delete(jnt(this,t))}}function WW({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function wnt({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function jnt({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function _nt(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Nnt(e=Ym){if(e===Ym)return fue;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function fue(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Snt=Math.sqrt(50),knt=Math.sqrt(10),Cnt=Math.sqrt(2);function L4(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),i=n/Math.pow(10,a),o=i>=Snt?10:i>=knt?5:i>=Cnt?2:1;let l,c,u;return a<0?(u=Math.pow(10,-a)/o,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,a)*o,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=r&&r<2?L4(e,t,r*2):[l,c,u]}function Z8(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[a,i,o]=n?L4(t,e,r):L4(e,t,r);if(!(i>=a))return[];const l=i-a+1,c=new Array(l);if(n)if(o<0)for(let u=0;u<l;++u)c[u]=(i-u)/-o;else for(let u=0;u<l;++u)c[u]=(i-u)*o;else if(o<0)for(let u=0;u<l;++u)c[u]=(a+u)/-o;else for(let u=0;u<l;++u)c[u]=(a+u)*o;return c}function J8(e,t,r){return t=+t,e=+e,r=+r,L4(e,t,r)[2]}function Q8(e,t,r){t=+t,e=+e,r=+r;const n=t<e,a=n?J8(t,e,r):J8(e,t,r);return(n?-1:1)*(a<0?1/-a:a)}function HW(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function GW(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function hue(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?fue:Nnt(a);n>r;){if(n-r>600){const c=n-r+1,u=t-r+1,d=Math.log(c),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),h=Math.max(r,Math.floor(t-u*f/c+m)),g=Math.min(n,Math.floor(t+(c-u)*f/c+m));hue(e,t,h,g,a)}const i=e[t];let o=r,l=n;for(Ob(e,r,t),a(e[n],i)>0&&Ob(e,r,n);o<l;){for(Ob(e,o,l),++o,--l;a(e[o],i)<0;)++o;for(;a(e[l],i)>0;)--l}a(e[r],i)===0?Ob(e,r,l):(++l,Ob(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function Ob(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Ent(e,t,r){if(e=Float64Array.from(ynt(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return GW(e);if(t>=1)return HW(e);var n,a=(n-1)*t,i=Math.floor(a),o=HW(hue(e,i).subarray(0,i+1)),l=GW(e.subarray(i+1));return o+(l-o)*(a-i)}}function Ant(e,t,r=due){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,i=Math.floor(a),o=+r(e[i],i,e),l=+r(e[i+1],i+1,e);return o+(l-o)*(a-i)}}function Tnt(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(a);++n<a;)i[n]=e+n*r;return i}function du(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Sh(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 eD=Symbol("implicit");function XF(){var e=new VW,t=[],r=[],n=eD;function a(i){let o=e.get(i);if(o===void 0){if(n!==eD)return n;e.set(i,o=t.push(i)-1)}return r[o%r.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new VW;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(r=Array.from(i),a):r.slice()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return XF(t,r).unknown(n)},du.apply(a,arguments),a}function L2(){var e=XF().unknown(void 0),t=e.domain,r=e.range,n=0,a=1,i,o,l=!1,c=0,u=0,d=.5;delete e.unknown;function f(){var m=t().length,h=a<n,g=h?a:n,p=h?n:a;i=(p-g)/Math.max(1,m-c+u*2),l&&(i=Math.floor(i)),g+=(p-g-i*(m-c))*d,o=i*(1-c),l&&(g=Math.round(g),o=Math.round(o));var x=Tnt(m).map(function(v){return g+i*v});return r(h?x.reverse():x)}return e.domain=function(m){return arguments.length?(t(m),f()):t()},e.range=function(m){return arguments.length?([n,a]=m,n=+n,a=+a,f()):[n,a]},e.rangeRound=function(m){return[n,a]=m,n=+n,a=+a,l=!0,f()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(m){return arguments.length?(l=!!m,f()):l},e.padding=function(m){return arguments.length?(c=Math.min(1,u=+m),f()):c},e.paddingInner=function(m){return arguments.length?(c=Math.min(1,m),f()):c},e.paddingOuter=function(m){return arguments.length?(u=+m,f()):u},e.align=function(m){return arguments.length?(d=Math.max(0,Math.min(1,m)),f()):d},e.copy=function(){return L2(t(),[n,a]).round(l).paddingInner(c).paddingOuter(u).align(d)},du.apply(f(),arguments)}function mue(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return mue(t())},e}function kw(){return mue(L2.apply(null,arguments).paddingInner(1))}function ZF(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function pue(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function m_(){}var F2=.7,F4=1/F2,Ev="\\s*([+-]?\\d+)\\s*",M2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Pnt=/^#([0-9a-f]{3,8})$/,Ont=new RegExp(`^rgb\\(${Ev},${Ev},${Ev}\\)$`),Dnt=new RegExp(`^rgb\\(${Wd},${Wd},${Wd}\\)$`),Int=new RegExp(`^rgba\\(${Ev},${Ev},${Ev},${M2}\\)$`),Rnt=new RegExp(`^rgba\\(${Wd},${Wd},${Wd},${M2}\\)$`),Lnt=new RegExp(`^hsl\\(${M2},${Wd},${Wd}\\)$`),Fnt=new RegExp(`^hsla\\(${M2},${Wd},${Wd},${M2}\\)$`),KW={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};ZF(m_,$2,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:YW,formatHex:YW,formatHex8:Mnt,formatHsl:$nt,formatRgb:XW,toString:XW});function YW(){return this.rgb().formatHex()}function Mnt(){return this.rgb().formatHex8()}function $nt(){return gue(this).formatHsl()}function XW(){return this.rgb().formatRgb()}function $2(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Pnt.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?ZW(t):r===3?new ul(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?xS(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?xS(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=Ont.exec(e))?new ul(t[1],t[2],t[3],1):(t=Dnt.exec(e))?new ul(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Int.exec(e))?xS(t[1],t[2],t[3],t[4]):(t=Rnt.exec(e))?xS(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Lnt.exec(e))?eH(t[1],t[2]/100,t[3]/100,1):(t=Fnt.exec(e))?eH(t[1],t[2]/100,t[3]/100,t[4]):KW.hasOwnProperty(e)?ZW(KW[e]):e==="transparent"?new ul(NaN,NaN,NaN,0):null}function ZW(e){return new ul(e>>16&255,e>>8&255,e&255,1)}function xS(e,t,r,n){return n<=0&&(e=t=r=NaN),new ul(e,t,r,n)}function Bnt(e){return e instanceof m_||(e=$2(e)),e?(e=e.rgb(),new ul(e.r,e.g,e.b,e.opacity)):new ul}function tD(e,t,r,n){return arguments.length===1?Bnt(e):new ul(e,t,r,n??1)}function ul(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}ZF(ul,tD,pue(m_,{brighter(e){return e=e==null?F4:Math.pow(F4,e),new ul(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?F2:Math.pow(F2,e),new ul(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ul(H0(this.r),H0(this.g),H0(this.b),M4(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:JW,formatHex:JW,formatHex8:znt,formatRgb:QW,toString:QW}));function JW(){return`#${N0(this.r)}${N0(this.g)}${N0(this.b)}`}function znt(){return`#${N0(this.r)}${N0(this.g)}${N0(this.b)}${N0((isNaN(this.opacity)?1:this.opacity)*255)}`}function QW(){const e=M4(this.opacity);return`${e===1?"rgb(":"rgba("}${H0(this.r)}, ${H0(this.g)}, ${H0(this.b)}${e===1?")":`, ${e})`}`}function M4(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function H0(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function N0(e){return e=H0(e),(e<16?"0":"")+e.toString(16)}function eH(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Fu(e,t,r,n)}function gue(e){if(e instanceof Fu)return new Fu(e.h,e.s,e.l,e.opacity);if(e instanceof m_||(e=$2(e)),!e)return new Fu;if(e instanceof Fu)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),i=Math.max(t,r,n),o=NaN,l=i-a,c=(i+a)/2;return l?(t===i?o=(r-n)/l+(r<n)*6:r===i?o=(n-t)/l+2:o=(t-r)/l+4,l/=c<.5?i+a:2-i-a,o*=60):l=c>0&&c<1?0:o,new Fu(o,l,c,e.opacity)}function Unt(e,t,r,n){return arguments.length===1?gue(e):new Fu(e,t,r,n??1)}function Fu(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}ZF(Fu,Unt,pue(m_,{brighter(e){return e=e==null?F4:Math.pow(F4,e),new Fu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?F2:Math.pow(F2,e),new Fu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new ul(iP(e>=240?e-240:e+120,a,n),iP(e,a,n),iP(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new Fu(tH(this.h),vS(this.s),vS(this.l),M4(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=M4(this.opacity);return`${e===1?"hsl(":"hsla("}${tH(this.h)}, ${vS(this.s)*100}%, ${vS(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tH(e){return e=(e||0)%360,e<0?e+360:e}function vS(e){return Math.max(0,Math.min(1,e||0))}function iP(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const JF=e=>()=>e;function qnt(e,t){return function(r){return e+r*t}}function Vnt(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Wnt(e){return(e=+e)==1?xue:function(t,r){return r-t?Vnt(t,r,e):JF(isNaN(t)?r:t)}}function xue(e,t){var r=t-e;return r?qnt(e,r):JF(isNaN(e)?t:e)}const rH=function e(t){var r=Wnt(t);function n(a,i){var o=r((a=tD(a)).r,(i=tD(i)).r),l=r(a.g,i.g),c=r(a.b,i.b),u=xue(a.opacity,i.opacity);return function(d){return a.r=o(d),a.g=l(d),a.b=c(d),a.opacity=u(d),a+""}}return n.gamma=e,n}(1);function Hnt(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(i){for(a=0;a<r;++a)n[a]=e[a]*(1-i)+t[a]*i;return n}}function Gnt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Knt(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,a=new Array(n),i=new Array(r),o;for(o=0;o<n;++o)a[o]=C1(e[o],t[o]);for(;o<r;++o)i[o]=t[o];return function(l){for(o=0;o<n;++o)i[o]=a[o](l);return i}}function Ynt(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function $4(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function Xnt(e,t){var r={},n={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?r[a]=C1(e[a],t[a]):n[a]=t[a];return function(i){for(a in r)n[a]=r[a](i);return n}}var rD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oP=new RegExp(rD.source,"g");function Znt(e){return function(){return e}}function Jnt(e){return function(t){return e(t)+""}}function Qnt(e,t){var r=rD.lastIndex=oP.lastIndex=0,n,a,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(n=rD.exec(e))&&(a=oP.exec(t));)(i=a.index)>r&&(i=t.slice(r,i),l[o]?l[o]+=i:l[++o]=i),(n=n[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,c.push({i:o,x:$4(n,a)})),r=oP.lastIndex;return r<t.length&&(i=t.slice(r),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?Jnt(c[0].x):Znt(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function C1(e,t){var r=typeof t,n;return t==null||r==="boolean"?JF(t):(r==="number"?$4:r==="string"?(n=$2(t))?(t=n,rH):Qnt:t instanceof $2?rH:t instanceof Date?Ynt:Gnt(t)?Hnt:Array.isArray(t)?Knt:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Xnt:$4)(e,t)}function QF(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function est(e,t){t===void 0&&(t=e,e=C1);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(a,a=t[++r]);return function(o){var l=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[l](o-l)}}function tst(e){return function(){return e}}function B4(e){return+e}var nH=[0,1];function $o(e){return e}function nD(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:tst(isNaN(t)?NaN:.5)}function rst(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function nst(e,t,r){var n=e[0],a=e[1],i=t[0],o=t[1];return a<n?(n=nD(a,n),i=r(o,i)):(n=nD(n,a),i=r(i,o)),function(l){return i(n(l))}}function sst(e,t,r){var n=Math.min(e.length,t.length)-1,a=new Array(n),i=new Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)a[o]=nD(e[o],e[o+1]),i[o]=r(t[o],t[o+1]);return function(l){var c=h_(e,l,1,n)-1;return i[c](a[c](l))}}function p_(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function OE(){var e=nH,t=nH,r=C1,n,a,i,o=$o,l,c,u;function d(){var m=Math.min(e.length,t.length);return o!==$o&&(o=rst(e[0],e[m-1])),l=m>2?sst:nst,c=u=null,f}function f(m){return m==null||isNaN(m=+m)?i:(c||(c=l(e.map(n),t,r)))(n(o(m)))}return f.invert=function(m){return o(a((u||(u=l(t,e.map(n),$4)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,B4),d()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),d()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),r=QF,d()},f.clamp=function(m){return arguments.length?(o=m?!0:$o,d()):o!==$o},f.interpolate=function(m){return arguments.length?(r=m,d()):r},f.unknown=function(m){return arguments.length?(i=m,f):i},function(m,h){return n=m,a=h,d()}}function eM(){return OE()($o,$o)}function ast(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function z4(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function xy(e){return e=z4(Math.abs(e)),e?e[1]:NaN}function ist(e,t){return function(r,n){for(var a=r.length,i=[],o=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),i.push(r.substring(a-=l,a+l)),!((c+=l+1)>n));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function ost(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var lst=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function B2(e){if(!(t=lst.exec(e)))throw new Error("invalid format: "+e);var t;return new tM({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]})}B2.prototype=tM.prototype;function tM(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+""}tM.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 cst(e){e:for(var t=e.length,r=1,n=-1,a;r<t;++r)switch(e[r]){case".":n=a=r;break;case"0":n===0&&(n=r),a=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var vue;function ust(e,t){var r=z4(e,t);if(!r)return e+"";var n=r[0],a=r[1],i=a-(vue=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+z4(e,Math.max(0,t+i-1))[0]}function sH(e,t){var r=z4(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const aH={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:ast,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)=>sH(e*100,t),r:sH,s:ust,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function iH(e){return e}var oH=Array.prototype.map,lH=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function dst(e){var t=e.grouping===void 0||e.thousands===void 0?iH:ist(oH.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?iH:ost(oH.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 u(f){f=B2(f);var m=f.fill,h=f.align,g=f.sign,p=f.symbol,x=f.zero,v=f.width,b=f.comma,y=f.precision,N=f.trim,_=f.type;_==="n"?(b=!0,_="g"):aH[_]||(y===void 0&&(y=12),N=!0,_="g"),(x||m==="0"&&h==="=")&&(x=!0,m="0",h="=");var j=p==="$"?r:p==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",S=p==="$"?n:/[%p]/.test(_)?o:"",I=aH[_],P=/[defgprs%]/.test(_);y=y===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y));function F(T){var k=j,V=S,C,R,H;if(_==="c")V=I(T)+V,T="";else{T=+T;var q=T<0||1/T<0;if(T=isNaN(T)?c:I(Math.abs(T),y),N&&(T=cst(T)),q&&+T==0&&g!=="+"&&(q=!1),k=(q?g==="("?g:l:g==="-"||g==="("?"":g)+k,V=(_==="s"?lH[8+vue/3]:"")+V+(q&&g==="("?")":""),P){for(C=-1,R=T.length;++C<R;)if(H=T.charCodeAt(C),48>H||H>57){V=(H===46?a+T.slice(C+1):T.slice(C))+V,T=T.slice(0,C);break}}}b&&!x&&(T=t(T,1/0));var L=k.length+T.length+V.length,M=L<v?new Array(v-L+1).join(m):"";switch(b&&x&&(T=t(M+T,M.length?v-V.length:1/0),M=""),h){case"<":T=k+T+V+M;break;case"=":T=k+M+T+V;break;case"^":T=M.slice(0,L=M.length>>1)+k+T+V+M.slice(L);break;default:T=M+k+T+V;break}return i(T)}return F.toString=function(){return f+""},F}function d(f,m){var h=u((f=B2(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(xy(m)/3)))*3,p=Math.pow(10,-g),x=lH[8+g/3];return function(v){return h(p*v)+x}}return{format:u,formatPrefix:d}}var yS,rM,yue;fst({thousands:",",grouping:[3],currency:["$",""]});function fst(e){return yS=dst(e),rM=yS.format,yue=yS.formatPrefix,yS}function hst(e){return Math.max(0,-xy(Math.abs(e)))}function mst(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(xy(t)/3)))*3-xy(Math.abs(e)))}function pst(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,xy(t)-xy(e))+1}function bue(e,t,r,n){var a=Q8(e,t,r),i;switch(n=B2(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=mst(a,o))&&(n.precision=i),yue(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=pst(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=hst(a))&&(n.precision=i-(n.type==="%")*2);break}}return rM(n)}function Pp(e){var t=e.domain;return e.ticks=function(r){var n=t();return Z8(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return bue(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,i=n.length-1,o=n[a],l=n[i],c,u,d=10;for(l<o&&(u=o,o=l,l=u,u=a,a=i,i=u);d-- >0;){if(u=J8(o,l,r),u===c)return n[a]=o,n[i]=l,t(n);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function U4(){var e=eM();return e.copy=function(){return p_(e,U4())},du.apply(e,arguments),Pp(e)}function wue(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,B4),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return wue(e).unknown(t)},e=arguments.length?Array.from(e,B4):[0,1],Pp(r)}function jue(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],i=e[n],o;return i<a&&(o=r,r=n,n=o,o=a,a=i,i=o),e[r]=t.floor(a),e[n]=t.ceil(i),e}function cH(e){return Math.log(e)}function uH(e){return Math.exp(e)}function gst(e){return-Math.log(-e)}function xst(e){return-Math.exp(-e)}function vst(e){return isFinite(e)?+("1e"+e):e<0?0:e}function yst(e){return e===10?vst:e===Math.E?Math.exp:t=>Math.pow(e,t)}function bst(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 dH(e){return(t,r)=>-e(-t,r)}function nM(e){const t=e(cH,uH),r=t.domain;let n=10,a,i;function o(){return a=bst(n),i=yst(n),r()[0]<0?(a=dH(a),i=dH(i),e(gst,xst)):e(cH,uH),t}return t.base=function(l){return arguments.length?(n=+l,o()):n},t.domain=function(l){return arguments.length?(r(l),o()):r()},t.ticks=l=>{const c=r();let u=c[0],d=c[c.length-1];const f=d<u;f&&([u,d]=[d,u]);let m=a(u),h=a(d),g,p;const x=l==null?10:+l;let v=[];if(!(n%1)&&h-m<x){if(m=Math.floor(m),h=Math.ceil(h),u>0){for(;m<=h;++m)for(g=1;g<n;++g)if(p=m<0?g/i(-m):g*i(m),!(p<u)){if(p>d)break;v.push(p)}}else for(;m<=h;++m)for(g=n-1;g>=1;--g)if(p=m>0?g/i(-m):g*i(m),!(p<u)){if(p>d)break;v.push(p)}v.length*2<x&&(v=Z8(u,d,x))}else v=Z8(m,h,Math.min(h-m,x)).map(i);return f?v.reverse():v},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=B2(c)).precision==null&&(c.trim=!0),c=rM(c)),l===1/0)return c;const u=Math.max(1,n*l/t.ticks().length);return d=>{let f=d/i(Math.round(a(d)));return f*n<n-.5&&(f*=n),f<=u?c(d):""}},t.nice=()=>r(jue(r(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function _ue(){const e=nM(OE()).domain([1,10]);return e.copy=()=>p_(e,_ue()).base(e.base()),du.apply(e,arguments),e}function fH(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function hH(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function sM(e){var t=1,r=e(fH(t),hH(t));return r.constant=function(n){return arguments.length?e(fH(t=+n),hH(t)):t},Pp(r)}function Nue(){var e=sM(OE());return e.copy=function(){return p_(e,Nue()).constant(e.constant())},du.apply(e,arguments)}function mH(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function wst(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function jst(e){return e<0?-e*e:e*e}function aM(e){var t=e($o,$o),r=1;function n(){return r===1?e($o,$o):r===.5?e(wst,jst):e(mH(r),mH(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},Pp(t)}function iM(){var e=aM(OE());return e.copy=function(){return p_(e,iM()).exponent(e.exponent())},du.apply(e,arguments),e}function _st(){return iM.apply(null,arguments).exponent(.5)}function pH(e){return Math.sign(e)*e*e}function Nst(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Sue(){var e=eM(),t=[0,1],r=!1,n;function a(i){var o=Nst(e(i));return isNaN(o)?n:r?Math.round(o):o}return a.invert=function(i){return e.invert(pH(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,B4)).map(pH)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(r=!!i,a):r},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return Sue(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},du.apply(a,arguments),Pp(a)}function kue(){var e=[],t=[],r=[],n;function a(){var o=0,l=Math.max(1,t.length);for(r=new Array(l-1);++o<l;)r[o-1]=Ant(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?n:t[h_(r,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[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(Ym),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.quantiles=function(){return r.slice()},i.copy=function(){return kue().domain(e).range(t).unknown(n)},du.apply(i,arguments)}function Cue(){var e=0,t=1,r=1,n=[.5],a=[0,1],i;function o(c){return c!=null&&c<=c?a[h_(n,c,0,r)]:i}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+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?(r=(a=Array.from(c)).length-1,l()):a.slice()},o.invertExtent=function(c){var u=a.indexOf(c);return u<0?[NaN,NaN]:u<1?[e,n[0]]:u>=r?[n[r-1],t]:[n[u-1],n[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return Cue().domain([e,t]).range(a).unknown(i)},du.apply(Pp(o),arguments)}function Eue(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[h_(e,i,0,n)]:r}return a.domain=function(i){return arguments.length?(e=Array.from(i),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),n=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?(r=i,a):r},a.copy=function(){return Eue().domain(e).range(t).unknown(r)},du.apply(a,arguments)}const lP=new Date,cP=new Date;function ji(e,t,r,n){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 u;do c.push(u=new Date(+i)),t(i,l),e(i);while(u<i&&i<o);return c},a.filter=i=>ji(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););}),r&&(a.count=(i,o)=>(lP.setTime(+i),cP.setTime(+o),e(lP),e(cP),Math.floor(r(lP,cP))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(n?o=>n(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const q4=ji(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);q4.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ji(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):q4);q4.range;const Hf=1e3,zc=Hf*60,Gf=zc*60,hh=Gf*24,oM=hh*7,gH=hh*30,uP=hh*365,S0=ji(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Hf)},(e,t)=>(t-e)/Hf,e=>e.getUTCSeconds());S0.range;const lM=ji(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Hf)},(e,t)=>{e.setTime(+e+t*zc)},(e,t)=>(t-e)/zc,e=>e.getMinutes());lM.range;const cM=ji(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*zc)},(e,t)=>(t-e)/zc,e=>e.getUTCMinutes());cM.range;const uM=ji(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Hf-e.getMinutes()*zc)},(e,t)=>{e.setTime(+e+t*Gf)},(e,t)=>(t-e)/Gf,e=>e.getHours());uM.range;const dM=ji(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Gf)},(e,t)=>(t-e)/Gf,e=>e.getUTCHours());dM.range;const g_=ji(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*zc)/hh,e=>e.getDate()-1);g_.range;const DE=ji(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/hh,e=>e.getUTCDate()-1);DE.range;const Aue=ji(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/hh,e=>Math.floor(e/hh));Aue.range;function Vg(e){return ji(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*zc)/oM)}const IE=Vg(0),V4=Vg(1),Sst=Vg(2),kst=Vg(3),vy=Vg(4),Cst=Vg(5),Est=Vg(6);IE.range;V4.range;Sst.range;kst.range;vy.range;Cst.range;Est.range;function Wg(e){return ji(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/oM)}const RE=Wg(0),W4=Wg(1),Ast=Wg(2),Tst=Wg(3),yy=Wg(4),Pst=Wg(5),Ost=Wg(6);RE.range;W4.range;Ast.range;Tst.range;yy.range;Pst.range;Ost.range;const fM=ji(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());fM.range;const hM=ji(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());hM.range;const mh=ji(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());mh.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ji(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});mh.range;const ph=ji(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());ph.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ji(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});ph.range;function Tue(e,t,r,n,a,i){const o=[[S0,1,Hf],[S0,5,5*Hf],[S0,15,15*Hf],[S0,30,30*Hf],[i,1,zc],[i,5,5*zc],[i,15,15*zc],[i,30,30*zc],[a,1,Gf],[a,3,3*Gf],[a,6,6*Gf],[a,12,12*Gf],[n,1,hh],[n,2,2*hh],[r,1,oM],[t,1,gH],[t,3,3*gH],[e,1,uP]];function l(u,d,f){const m=d<u;m&&([u,d]=[d,u]);const h=f&&typeof f.range=="function"?f:c(u,d,f),g=h?h.range(u,+d+1):[];return m?g.reverse():g}function c(u,d,f){const m=Math.abs(d-u)/f,h=YF(([,,x])=>x).right(o,m);if(h===o.length)return e.every(Q8(u/uP,d/uP,f));if(h===0)return q4.every(Math.max(Q8(u,d,f),1));const[g,p]=o[m/o[h-1][2]<o[h][2]/m?h-1:h];return g.every(p)}return[l,c]}const[Dst,Ist]=Tue(ph,hM,RE,Aue,dM,cM),[Rst,Lst]=Tue(mh,fM,IE,g_,uM,lM);function dP(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 fP(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 Db(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function Fst(e){var t=e.dateTime,r=e.date,n=e.time,a=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,u=Ib(a),d=Rb(a),f=Ib(i),m=Rb(i),h=Ib(o),g=Rb(o),p=Ib(l),x=Rb(l),v=Ib(c),b=Rb(c),y={a:q,A:L,b:M,B:z,c:null,d:jH,e:jH,f:iat,g:gat,G:vat,H:nat,I:sat,j:aat,L:Pue,m:oat,M:lat,p:K,q:E,Q:SH,s:kH,S:cat,u:uat,U:dat,V:fat,w:hat,W:mat,x:null,X:null,y:pat,Y:xat,Z:yat,"%":NH},N={a:A,A:O,b:U,B:Y,c:null,d:_H,e:_H,f:_at,g:Dat,G:Rat,H:bat,I:wat,j:jat,L:Due,m:Nat,M:Sat,p:J,q:se,Q:SH,s:kH,S:kat,u:Cat,U:Eat,V:Aat,w:Tat,W:Pat,x:null,X:null,y:Oat,Y:Iat,Z:Lat,"%":NH},_={a:F,A:T,b:k,B:V,c:C,d:bH,e:bH,f:Qst,g:yH,G:vH,H:wH,I:wH,j:Yst,L:Jst,m:Kst,M:Xst,p:P,q:Gst,Q:tat,s:rat,S:Zst,u:Ust,U:qst,V:Vst,w:zst,W:Wst,x:R,X:H,y:yH,Y:vH,Z:Hst,"%":eat};y.x=j(r,y),y.X=j(n,y),y.c=j(t,y),N.x=j(r,N),N.X=j(n,N),N.c=j(t,N);function j(ee,ie){return function(Ee){var te=[],Ue=-1,W=0,Z=ee.length,le,re,oe;for(Ee instanceof Date||(Ee=new Date(+Ee));++Ue<Z;)ee.charCodeAt(Ue)===37&&(te.push(ee.slice(W,Ue)),(re=xH[le=ee.charAt(++Ue)])!=null?le=ee.charAt(++Ue):re=le==="e"?" ":"0",(oe=ie[le])&&(le=oe(Ee,re)),te.push(le),W=Ue+1);return te.push(ee.slice(W,Ue)),te.join("")}}function S(ee,ie){return function(Ee){var te=Db(1900,void 0,1),Ue=I(te,ee,Ee+="",0),W,Z;if(Ue!=Ee.length)return null;if("Q"in te)return new Date(te.Q);if("s"in te)return new Date(te.s*1e3+("L"in te?te.L:0));if(ie&&!("Z"in te)&&(te.Z=0),"p"in te&&(te.H=te.H%12+te.p*12),te.m===void 0&&(te.m="q"in te?te.q:0),"V"in te){if(te.V<1||te.V>53)return null;"w"in te||(te.w=1),"Z"in te?(W=fP(Db(te.y,0,1)),Z=W.getUTCDay(),W=Z>4||Z===0?W4.ceil(W):W4(W),W=DE.offset(W,(te.V-1)*7),te.y=W.getUTCFullYear(),te.m=W.getUTCMonth(),te.d=W.getUTCDate()+(te.w+6)%7):(W=dP(Db(te.y,0,1)),Z=W.getDay(),W=Z>4||Z===0?V4.ceil(W):V4(W),W=g_.offset(W,(te.V-1)*7),te.y=W.getFullYear(),te.m=W.getMonth(),te.d=W.getDate()+(te.w+6)%7)}else("W"in te||"U"in te)&&("w"in te||(te.w="u"in te?te.u%7:"W"in te?1:0),Z="Z"in te?fP(Db(te.y,0,1)).getUTCDay():dP(Db(te.y,0,1)).getDay(),te.m=0,te.d="W"in te?(te.w+6)%7+te.W*7-(Z+5)%7:te.w+te.U*7-(Z+6)%7);return"Z"in te?(te.H+=te.Z/100|0,te.M+=te.Z%100,fP(te)):dP(te)}}function I(ee,ie,Ee,te){for(var Ue=0,W=ie.length,Z=Ee.length,le,re;Ue<W;){if(te>=Z)return-1;if(le=ie.charCodeAt(Ue++),le===37){if(le=ie.charAt(Ue++),re=_[le in xH?ie.charAt(Ue++):le],!re||(te=re(ee,Ee,te))<0)return-1}else if(le!=Ee.charCodeAt(te++))return-1}return te}function P(ee,ie,Ee){var te=u.exec(ie.slice(Ee));return te?(ee.p=d.get(te[0].toLowerCase()),Ee+te[0].length):-1}function F(ee,ie,Ee){var te=h.exec(ie.slice(Ee));return te?(ee.w=g.get(te[0].toLowerCase()),Ee+te[0].length):-1}function T(ee,ie,Ee){var te=f.exec(ie.slice(Ee));return te?(ee.w=m.get(te[0].toLowerCase()),Ee+te[0].length):-1}function k(ee,ie,Ee){var te=v.exec(ie.slice(Ee));return te?(ee.m=b.get(te[0].toLowerCase()),Ee+te[0].length):-1}function V(ee,ie,Ee){var te=p.exec(ie.slice(Ee));return te?(ee.m=x.get(te[0].toLowerCase()),Ee+te[0].length):-1}function C(ee,ie,Ee){return I(ee,t,ie,Ee)}function R(ee,ie,Ee){return I(ee,r,ie,Ee)}function H(ee,ie,Ee){return I(ee,n,ie,Ee)}function q(ee){return o[ee.getDay()]}function L(ee){return i[ee.getDay()]}function M(ee){return c[ee.getMonth()]}function z(ee){return l[ee.getMonth()]}function K(ee){return a[+(ee.getHours()>=12)]}function E(ee){return 1+~~(ee.getMonth()/3)}function A(ee){return o[ee.getUTCDay()]}function O(ee){return i[ee.getUTCDay()]}function U(ee){return c[ee.getUTCMonth()]}function Y(ee){return l[ee.getUTCMonth()]}function J(ee){return a[+(ee.getUTCHours()>=12)]}function se(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var ie=j(ee+="",y);return ie.toString=function(){return ee},ie},parse:function(ee){var ie=S(ee+="",!1);return ie.toString=function(){return ee},ie},utcFormat:function(ee){var ie=j(ee+="",N);return ie.toString=function(){return ee},ie},utcParse:function(ee){var ie=S(ee+="",!0);return ie.toString=function(){return ee},ie}}}var xH={"-":"",_:" ",0:"0"},Li=/^\s*\d+/,Mst=/^%/,$st=/[\\^$*+?|[\]().{}]/g;function $n(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i<r?new Array(r-i+1).join(t)+a:a)}function Bst(e){return e.replace($st,"\\$&")}function Ib(e){return new RegExp("^(?:"+e.map(Bst).join("|")+")","i")}function Rb(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function zst(e,t,r){var n=Li.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function Ust(e,t,r){var n=Li.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function qst(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Vst(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Wst(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function vH(e,t,r){var n=Li.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function yH(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function Hst(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function Gst(e,t,r){var n=Li.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Kst(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function bH(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function Yst(e,t,r){var n=Li.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function wH(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function Xst(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Zst(e,t,r){var n=Li.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Jst(e,t,r){var n=Li.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Qst(e,t,r){var n=Li.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function eat(e,t,r){var n=Mst.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function tat(e,t,r){var n=Li.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function rat(e,t,r){var n=Li.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function jH(e,t){return $n(e.getDate(),t,2)}function nat(e,t){return $n(e.getHours(),t,2)}function sat(e,t){return $n(e.getHours()%12||12,t,2)}function aat(e,t){return $n(1+g_.count(mh(e),e),t,3)}function Pue(e,t){return $n(e.getMilliseconds(),t,3)}function iat(e,t){return Pue(e,t)+"000"}function oat(e,t){return $n(e.getMonth()+1,t,2)}function lat(e,t){return $n(e.getMinutes(),t,2)}function cat(e,t){return $n(e.getSeconds(),t,2)}function uat(e){var t=e.getDay();return t===0?7:t}function dat(e,t){return $n(IE.count(mh(e)-1,e),t,2)}function Oue(e){var t=e.getDay();return t>=4||t===0?vy(e):vy.ceil(e)}function fat(e,t){return e=Oue(e),$n(vy.count(mh(e),e)+(mh(e).getDay()===4),t,2)}function hat(e){return e.getDay()}function mat(e,t){return $n(V4.count(mh(e)-1,e),t,2)}function pat(e,t){return $n(e.getFullYear()%100,t,2)}function gat(e,t){return e=Oue(e),$n(e.getFullYear()%100,t,2)}function xat(e,t){return $n(e.getFullYear()%1e4,t,4)}function vat(e,t){var r=e.getDay();return e=r>=4||r===0?vy(e):vy.ceil(e),$n(e.getFullYear()%1e4,t,4)}function yat(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+$n(t/60|0,"0",2)+$n(t%60,"0",2)}function _H(e,t){return $n(e.getUTCDate(),t,2)}function bat(e,t){return $n(e.getUTCHours(),t,2)}function wat(e,t){return $n(e.getUTCHours()%12||12,t,2)}function jat(e,t){return $n(1+DE.count(ph(e),e),t,3)}function Due(e,t){return $n(e.getUTCMilliseconds(),t,3)}function _at(e,t){return Due(e,t)+"000"}function Nat(e,t){return $n(e.getUTCMonth()+1,t,2)}function Sat(e,t){return $n(e.getUTCMinutes(),t,2)}function kat(e,t){return $n(e.getUTCSeconds(),t,2)}function Cat(e){var t=e.getUTCDay();return t===0?7:t}function Eat(e,t){return $n(RE.count(ph(e)-1,e),t,2)}function Iue(e){var t=e.getUTCDay();return t>=4||t===0?yy(e):yy.ceil(e)}function Aat(e,t){return e=Iue(e),$n(yy.count(ph(e),e)+(ph(e).getUTCDay()===4),t,2)}function Tat(e){return e.getUTCDay()}function Pat(e,t){return $n(W4.count(ph(e)-1,e),t,2)}function Oat(e,t){return $n(e.getUTCFullYear()%100,t,2)}function Dat(e,t){return e=Iue(e),$n(e.getUTCFullYear()%100,t,2)}function Iat(e,t){return $n(e.getUTCFullYear()%1e4,t,4)}function Rat(e,t){var r=e.getUTCDay();return e=r>=4||r===0?yy(e):yy.ceil(e),$n(e.getUTCFullYear()%1e4,t,4)}function Lat(){return"+0000"}function NH(){return"%"}function SH(e){return+e}function kH(e){return Math.floor(+e/1e3)}var kx,Rue,Lue;Fat({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 Fat(e){return kx=Fst(e),Rue=kx.format,kx.parse,Lue=kx.utcFormat,kx.utcParse,kx}function Mat(e){return new Date(e)}function $at(e){return e instanceof Date?+e:+new Date(+e)}function mM(e,t,r,n,a,i,o,l,c,u){var d=eM(),f=d.invert,m=d.domain,h=u(".%L"),g=u(":%S"),p=u("%I:%M"),x=u("%I %p"),v=u("%a %d"),b=u("%b %d"),y=u("%B"),N=u("%Y");function _(j){return(c(j)<j?h:l(j)<j?g:o(j)<j?p:i(j)<j?x:n(j)<j?a(j)<j?v:b:r(j)<j?y:N)(j)}return d.invert=function(j){return new Date(f(j))},d.domain=function(j){return arguments.length?m(Array.from(j,$at)):m().map(Mat)},d.ticks=function(j){var S=m();return e(S[0],S[S.length-1],j??10)},d.tickFormat=function(j,S){return S==null?_:u(S)},d.nice=function(j){var S=m();return(!j||typeof j.range!="function")&&(j=t(S[0],S[S.length-1],j??10)),j?m(jue(S,j)):d},d.copy=function(){return p_(d,mM(e,t,r,n,a,i,o,l,c,u))},d}function Bat(){return du.apply(mM(Rst,Lst,mh,fM,IE,g_,uM,lM,S0,Rue).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function zat(){return du.apply(mM(Dst,Ist,ph,hM,RE,DE,dM,cM,S0,Lue).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function LE(){var e=0,t=1,r,n,a,i,o=$o,l=!1,c;function u(f){return f==null||isNaN(f=+f)?c:o(a===0?.5:(f=(i(f)-r)*a,l?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([e,t]=f,r=i(e=+e),n=i(t=+t),a=r===n?0:1/(n-r),u):[e,t]},u.clamp=function(f){return arguments.length?(l=!!f,u):l},u.interpolator=function(f){return arguments.length?(o=f,u):o};function d(f){return function(m){var h,g;return arguments.length?([h,g]=m,o=f(h,g),u):[o(0),o(1)]}}return u.range=d(C1),u.rangeRound=d(QF),u.unknown=function(f){return arguments.length?(c=f,u):c},function(f){return i=f,r=f(e),n=f(t),a=r===n?0:1/(n-r),u}}function Op(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Fue(){var e=Pp(LE()($o));return e.copy=function(){return Op(e,Fue())},Sh.apply(e,arguments)}function Mue(){var e=nM(LE()).domain([1,10]);return e.copy=function(){return Op(e,Mue()).base(e.base())},Sh.apply(e,arguments)}function $ue(){var e=sM(LE());return e.copy=function(){return Op(e,$ue()).constant(e.constant())},Sh.apply(e,arguments)}function pM(){var e=aM(LE());return e.copy=function(){return Op(e,pM()).exponent(e.exponent())},Sh.apply(e,arguments)}function Uat(){return pM.apply(null,arguments).exponent(.5)}function Bue(){var e=[],t=$o;function r(n){if(n!=null&&!isNaN(n=+n))return t((h_(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let a of n)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Ym),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,a)=>t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,i)=>Ent(e,i/n))},r.copy=function(){return Bue(t).domain(e)},Sh.apply(r,arguments)}function FE(){var e=0,t=.5,r=1,n=1,a,i,o,l,c,u=$o,d,f=!1,m;function h(p){return isNaN(p=+p)?m:(p=.5+((p=+d(p))-i)*(n*p<n*i?l:c),u(f?Math.max(0,Math.min(1,p)):p))}h.domain=function(p){return arguments.length?([e,t,r]=p,a=d(e=+e),i=d(t=+t),o=d(r=+r),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),n=i<a?-1:1,h):[e,t,r]},h.clamp=function(p){return arguments.length?(f=!!p,h):f},h.interpolator=function(p){return arguments.length?(u=p,h):u};function g(p){return function(x){var v,b,y;return arguments.length?([v,b,y]=x,u=est(p,[v,b,y]),h):[u(0),u(.5),u(1)]}}return h.range=g(C1),h.rangeRound=g(QF),h.unknown=function(p){return arguments.length?(m=p,h):m},function(p){return d=p,a=p(e),i=p(t),o=p(r),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),n=i<a?-1:1,h}}function zue(){var e=Pp(FE()($o));return e.copy=function(){return Op(e,zue())},Sh.apply(e,arguments)}function Uue(){var e=nM(FE()).domain([.1,1,10]);return e.copy=function(){return Op(e,Uue()).base(e.base())},Sh.apply(e,arguments)}function que(){var e=sM(FE());return e.copy=function(){return Op(e,que()).constant(e.constant())},Sh.apply(e,arguments)}function gM(){var e=aM(FE());return e.copy=function(){return Op(e,gM()).exponent(e.exponent())},Sh.apply(e,arguments)}function qat(){return gM.apply(null,arguments).exponent(.5)}const CH=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:L2,scaleDiverging:zue,scaleDivergingLog:Uue,scaleDivergingPow:gM,scaleDivergingSqrt:qat,scaleDivergingSymlog:que,scaleIdentity:wue,scaleImplicit:eD,scaleLinear:U4,scaleLog:_ue,scaleOrdinal:XF,scalePoint:kw,scalePow:iM,scaleQuantile:kue,scaleQuantize:Cue,scaleRadial:Sue,scaleSequential:Fue,scaleSequentialLog:Mue,scaleSequentialPow:pM,scaleSequentialQuantile:Bue,scaleSequentialSqrt:Uat,scaleSequentialSymlog:$ue,scaleSqrt:_st,scaleSymlog:Nue,scaleThreshold:Eue,scaleTime:Bat,scaleUtc:zat,tickFormat:bue},Symbol.toStringTag,{value:"Module"}));var Vat=v1;function Wat(e,t,r){for(var n=-1,a=e.length;++n<a;){var i=e[n],o=t(i);if(o!=null&&(l===void 0?o===o&&!Vat(o):r(o,l)))var l=o,c=i}return c}var ME=Wat;function Hat(e,t){return e>t}var Vue=Hat,Gat=ME,Kat=Vue,Yat=k1;function Xat(e){return e&&e.length?Gat(e,Yat,Kat):void 0}var Zat=Xat;const $E=jn(Zat);function Jat(e,t){return e<t}var Wue=Jat,Qat=ME,eit=Wue,tit=k1;function rit(e){return e&&e.length?Qat(e,tit,eit):void 0}var nit=rit;const BE=jn(nit);var sit=TF,ait=cf,iit=Qce,oit=_l;function lit(e,t){var r=oit(e)?sit:iit;return r(e,ait(t))}var cit=lit,uit=Zce,dit=cit;function fit(e,t){return uit(dit(e,t),1)}var hit=fit;const mit=jn(hit);var pit=WF;function git(e,t){return pit(e,t)}var xit=git;const x_=jn(xit);var E1=1e9,vit={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},vM,Hs=!0,au="[DecimalError] ",G0=au+"Invalid argument: ",xM=au+"Exponent out of range: ",A1=Math.floor,u0=Math.pow,yit=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Vl,_i=1e7,Rs=7,Hue=9007199254740991,H4=A1(Hue/Rs),tr={};tr.absoluteValue=tr.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};tr.comparedTo=tr.cmp=function(e){var t,r,n,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(n=i.d.length,a=e.d.length,t=0,r=n<a?n:a;t<r;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return n===a?0:n>a^i.s<0?1:-1};tr.decimalPlaces=tr.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Rs;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};tr.dividedBy=tr.div=function(e){return eh(this,new this.constructor(e))};tr.dividedToIntegerBy=tr.idiv=function(e){var t=this,r=t.constructor;return ms(eh(t,new r(e),0,1),r.precision)};tr.equals=tr.eq=function(e){return!this.cmp(e)};tr.exponent=function(){return Ka(this)};tr.greaterThan=tr.gt=function(e){return this.cmp(e)>0};tr.greaterThanOrEqualTo=tr.gte=function(e){return this.cmp(e)>=0};tr.isInteger=tr.isint=function(){return this.e>this.d.length-2};tr.isNegative=tr.isneg=function(){return this.s<0};tr.isPositive=tr.ispos=function(){return this.s>0};tr.isZero=function(){return this.s===0};tr.lessThan=tr.lt=function(e){return this.cmp(e)<0};tr.lessThanOrEqualTo=tr.lte=function(e){return this.cmp(e)<1};tr.logarithm=tr.log=function(e){var t,r=this,n=r.constructor,a=n.precision,i=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Vl))throw Error(au+"NaN");if(r.s<1)throw Error(au+(r.s?"NaN":"-Infinity"));return r.eq(Vl)?new n(0):(Hs=!1,t=eh(z2(r,i),z2(e,i),i),Hs=!0,ms(t,a))};tr.minus=tr.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Yue(t,e):Gue(t,(e.s=-e.s,e))};tr.modulo=tr.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(au+"NaN");return r.s?(Hs=!1,t=eh(r,e,0,1).times(e),Hs=!0,r.minus(t)):ms(new n(r),a)};tr.naturalExponential=tr.exp=function(){return Kue(this)};tr.naturalLogarithm=tr.ln=function(){return z2(this)};tr.negated=tr.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};tr.plus=tr.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Gue(t,e):Yue(t,(e.s=-e.s,e))};tr.precision=tr.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(G0+e);if(t=Ka(a)+1,n=a.d.length-1,r=n*Rs+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};tr.squareRoot=tr.sqrt=function(){var e,t,r,n,a,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(au+"NaN")}for(e=Ka(l),Hs=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=Md(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=A1((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),n=new c(t)):n=new c(a.toString()),r=c.precision,a=o=r+3;;)if(i=n,n=i.plus(eh(l,i,o+2)).times(.5),Md(i.d).slice(0,o)===(t=Md(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(ms(i,r+1,0),i.times(i).eq(l)){n=i;break}}else if(t!="9999")break;o+=4}return Hs=!0,ms(n,r)};tr.times=tr.mul=function(e){var t,r,n,a,i,o,l,c,u,d=this,f=d.constructor,m=d.d,h=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,c=m.length,u=h.length,c<u&&(i=m,m=h,h=i,o=c,c=u,u=o),i=[],o=c+u,n=o;n--;)i.push(0);for(n=u;--n>=0;){for(t=0,a=c+n;a>n;)l=i[a]+h[n]*m[a-n-1]+t,i[a--]=l%_i|0,t=l/_i|0;i[a]=(i[a]+t)%_i|0}for(;!i[--o];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,Hs?ms(e,f.precision):e};tr.toDecimalPlaces=tr.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Qd(e,0,E1),t===void 0?t=n.rounding:Qd(t,0,8),ms(r,e+Ka(r)+1,t))};tr.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=yg(n,!0):(Qd(e,0,E1),t===void 0?t=a.rounding:Qd(t,0,8),n=ms(new a(n),e+1,t),r=yg(n,!0,e+1)),r};tr.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?yg(a):(Qd(e,0,E1),t===void 0?t=i.rounding:Qd(t,0,8),n=ms(new i(a),e+Ka(a)+1,t),r=yg(n.abs(),!1,e+Ka(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};tr.toInteger=tr.toint=function(){var e=this,t=e.constructor;return ms(new t(e),Ka(e)+1,t.rounding)};tr.toNumber=function(){return+this};tr.toPower=tr.pow=function(e){var t,r,n,a,i,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Vl);if(l=new c(l),!l.s){if(e.s<1)throw Error(au+"Infinity");return l}if(l.eq(Vl))return l;if(n=c.precision,e.eq(Vl))return ms(l,n);if(t=e.e,r=e.d.length-1,o=t>=r,i=l.s,o){if((r=d<0?-d:d)<=Hue){for(a=new c(Vl),t=Math.ceil(n/Rs+4),Hs=!1;r%2&&(a=a.times(l),AH(a.d,t)),r=A1(r/2),r!==0;)l=l.times(l),AH(l.d,t);return Hs=!0,e.s<0?new c(Vl).div(a):ms(a,n)}}else if(i<0)throw Error(au+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,Hs=!1,a=e.times(z2(l,n+u)),Hs=!0,a=Kue(a),a.s=i,a};tr.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=Ka(a),n=yg(a,r<=i.toExpNeg||r>=i.toExpPos)):(Qd(e,1,E1),t===void 0?t=i.rounding:Qd(t,0,8),a=ms(new i(a),e,t),r=Ka(a),n=yg(a,e<=r||r<=i.toExpNeg,e)),n};tr.toSignificantDigits=tr.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Qd(e,1,E1),t===void 0?t=n.rounding:Qd(t,0,8)),ms(new n(r),e,t)};tr.toString=tr.valueOf=tr.val=tr.toJSON=tr[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ka(e),r=e.constructor;return yg(e,t<=r.toExpNeg||t>=r.toExpPos)};function Gue(e,t){var r,n,a,i,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Hs?ms(t,f):t;if(c=e.d,u=t.d,o=e.e,a=t.e,c=c.slice(),i=o-a,i){for(i<0?(n=c,i=-i,l=u.length):(n=u,a=o,l=c.length),o=Math.ceil(f/Rs),l=o>l?o+1:l+1,i>l&&(i=l,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,n=u,u=c,c=n),r=0;i;)r=(c[--i]=c[i]+u[i]+r)/_i|0,c[i]%=_i;for(r&&(c.unshift(r),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,Hs?ms(t,f):t}function Qd(e,t,r){if(e!==~~e||e<t||e>r)throw Error(G0+e)}function Md(e){var t,r,n,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)n=e[t]+"",r=Rs-n.length,r&&(i+=om(r)),i+=n;o=e[t],n=o+"",r=Rs-n.length,r&&(i+=om(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var eh=function(){function e(n,a){var i,o=0,l=n.length;for(n=n.slice();l--;)i=n[l]*a+o,n[l]=i%_i|0,o=i/_i|0;return o&&n.unshift(o),n}function t(n,a,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(n[l]!=a[l]){c=n[l]>a[l]?1:-1;break}return c}function r(n,a,i){for(var o=0;i--;)n[i]-=o,o=n[i]<a[i]?1:0,n[i]=o*_i+n[i]-a[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,a,i,o){var l,c,u,d,f,m,h,g,p,x,v,b,y,N,_,j,S,I,P=n.constructor,F=n.s==a.s?1:-1,T=n.d,k=a.d;if(!n.s)return new P(n);if(!a.s)throw Error(au+"Division by zero");for(c=n.e-a.e,S=k.length,_=T.length,h=new P(F),g=h.d=[],u=0;k[u]==(T[u]||0);)++u;if(k[u]>(T[u]||0)&&--c,i==null?b=i=P.precision:o?b=i+(Ka(n)-Ka(a))+1:b=i,b<0)return new P(0);if(b=b/Rs+2|0,u=0,S==1)for(d=0,k=k[0],b++;(u<_||d)&&b--;u++)y=d*_i+(T[u]||0),g[u]=y/k|0,d=y%k|0;else{for(d=_i/(k[0]+1)|0,d>1&&(k=e(k,d),T=e(T,d),S=k.length,_=T.length),N=S,p=T.slice(0,S),x=p.length;x<S;)p[x++]=0;I=k.slice(),I.unshift(0),j=k[0],k[1]>=_i/2&&++j;do d=0,l=t(k,p,S,x),l<0?(v=p[0],S!=x&&(v=v*_i+(p[1]||0)),d=v/j|0,d>1?(d>=_i&&(d=_i-1),f=e(k,d),m=f.length,x=p.length,l=t(f,p,m,x),l==1&&(d--,r(f,S<m?I:k,m))):(d==0&&(l=d=1),f=k.slice()),m=f.length,m<x&&f.unshift(0),r(p,f,x),l==-1&&(x=p.length,l=t(k,p,S,x),l<1&&(d++,r(p,S<x?I:k,x))),x=p.length):l===0&&(d++,p=[0]),g[u++]=d,l&&p[0]?p[x++]=T[N]||0:(p=[T[N]],x=1);while((N++<_||p[0]!==void 0)&&b--)}return g[0]||g.shift(),h.e=c,ms(h,o?i+Ka(h)+1:i)}}();function Kue(e,t){var r,n,a,i,o,l,c=0,u=0,d=e.constructor,f=d.precision;if(Ka(e)>16)throw Error(xM+Ka(e));if(!e.s)return new d(Vl);for(Hs=!1,l=f,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(n=Math.log(u0(2,u))/Math.LN10*2+5|0,l+=n,r=a=i=new d(Vl),d.precision=l;;){if(a=ms(a.times(e),l),r=r.times(++c),o=i.plus(eh(a,r,l)),Md(o.d).slice(0,l)===Md(i.d).slice(0,l)){for(;u--;)i=ms(i.times(i),l);return d.precision=f,t==null?(Hs=!0,ms(i,f)):i}i=o}}function Ka(e){for(var t=e.e*Rs,r=e.d[0];r>=10;r/=10)t++;return t}function hP(e,t,r){if(t>e.LN10.sd())throw Hs=!0,r&&(e.precision=r),Error(au+"LN10 precision limit exceeded");return ms(new e(e.LN10),t)}function om(e){for(var t="";e--;)t+="0";return t}function z2(e,t){var r,n,a,i,o,l,c,u,d,f=1,m=10,h=e,g=h.d,p=h.constructor,x=p.precision;if(h.s<1)throw Error(au+(h.s?"NaN":"-Infinity"));if(h.eq(Vl))return new p(0);if(t==null?(Hs=!1,u=x):u=t,h.eq(10))return t==null&&(Hs=!0),hP(p,u);if(u+=m,p.precision=u,r=Md(g),n=r.charAt(0),i=Ka(h),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(e),r=Md(h.d),n=r.charAt(0),f++;i=Ka(h),n>1?(h=new p("0."+r),i++):h=new p(n+"."+r.slice(1))}else return c=hP(p,u+2,x).times(i+""),h=z2(new p(n+"."+r.slice(1)),u-m).plus(c),p.precision=x,t==null?(Hs=!0,ms(h,x)):h;for(l=o=h=eh(h.minus(Vl),h.plus(Vl),u),d=ms(h.times(h),u),a=3;;){if(o=ms(o.times(d),u),c=l.plus(eh(o,new p(a),u)),Md(c.d).slice(0,u)===Md(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(hP(p,u+2,x).times(i+""))),l=eh(l,new p(f),u),p.precision=x,t==null?(Hs=!0,ms(l,x)):l;l=c,a+=2}}function EH(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=A1(r/Rs),e.d=[],n=(r+1)%Rs,r<0&&(n+=Rs),n<a){for(n&&e.d.push(+t.slice(0,n)),a-=Rs;n<a;)e.d.push(+t.slice(n,n+=Rs));t=t.slice(n),n=Rs-t.length}else n-=a;for(;n--;)t+="0";if(e.d.push(+t),Hs&&(e.e>H4||e.e<-H4))throw Error(xM+r)}else e.s=0,e.e=0,e.d=[0];return e}function ms(e,t,r){var n,a,i,o,l,c,u,d,f=e.d;for(o=1,i=f[0];i>=10;i/=10)o++;if(n=t-o,n<0)n+=Rs,a=t,u=f[d=0];else{if(d=Math.ceil((n+1)/Rs),i=f.length,d>=i)return e;for(u=i=f[d],o=1;i>=10;i/=10)o++;n%=Rs,a=n-Rs+o}if(r!==void 0&&(i=u0(10,o-a-1),l=u/i%10|0,c=t<0||f[d+1]!==void 0||u%i,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?a>0?u/u0(10,o-a):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(i=Ka(e),f.length=1,t=t-i-1,f[0]=u0(10,(Rs-t%Rs)%Rs),e.e=A1(-t/Rs)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,i=1,d--):(f.length=d+1,i=u0(10,Rs-n),f[d]=a>0?(u/u0(10,o-a)%u0(10,a)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==_i&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=_i)break;f[d--]=0,i=1}for(n=f.length;f[--n]===0;)f.pop();if(Hs&&(e.e>H4||e.e<-H4))throw Error(xM+Ka(e));return e}function Yue(e,t){var r,n,a,i,o,l,c,u,d,f,m=e.constructor,h=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),Hs?ms(t,h):t;if(c=e.d,f=t.d,n=t.e,u=e.e,c=c.slice(),o=u-n,o){for(d=o<0,d?(r=c,o=-o,l=f.length):(r=f,n=u,l=c.length),a=Math.max(Math.ceil(h/Rs),l)+2,o>a&&(o=a,r.length=1),r.reverse(),a=o;a--;)r.push(0);r.reverse()}else{for(a=c.length,l=f.length,d=a<l,d&&(l=a),a=0;a<l;a++)if(c[a]!=f[a]){d=c[a]<f[a];break}o=0}for(d&&(r=c,c=f,f=r,t.s=-t.s),l=c.length,a=f.length-l;a>0;--a)c[l++]=0;for(a=f.length;a>o;){if(c[--a]<f[a]){for(i=a;i&&c[--i]===0;)c[i]=_i-1;--c[i],c[a]+=_i}c[a]-=f[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,Hs?ms(t,h):t):new m(0)}function yg(e,t,r){var n,a=Ka(e),i=Md(e.d),o=i.length;return t?(r&&(n=r-o)>0?i=i.charAt(0)+"."+i.slice(1)+om(n):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+om(-a-1)+i,r&&(n=r-o)>0&&(i+=om(n))):a>=o?(i+=om(a+1-o),r&&(n=r-a-1)>0&&(i=i+"."+om(n))):((n=a+1)<o&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-o)>0&&(a+1===o&&(i+="."),i+=om(n))),e.s<0?"-"+i:i}function AH(e,t){if(e.length>t)return e.length=t,!0}function Xue(e){var t,r,n;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(G0+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 EH(o,i.toString())}else if(typeof i!="string")throw Error(G0+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,yit.test(i))EH(o,i);else throw Error(G0+i)}if(a.prototype=tr,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=Xue,a.config=a.set=bit,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return a.config(e),a}function bit(e){if(!e||typeof e!="object")throw Error(au+"Object expected");var t,r,n,a=["precision",1,E1,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((n=e[r=a[t]])!==void 0)if(A1(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(G0+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(G0+r+": "+n);return this}var vM=Xue(vit);Vl=new vM(1);const cs=vM;function wit(e){return Sit(e)||Nit(e)||_it(e)||jit()}function jit(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _it(e,t){if(e){if(typeof e=="string")return sD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sD(e,t)}}function Nit(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Sit(e){if(Array.isArray(e))return sD(e)}function sD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var kit=function(t){return t},Zue={},Jue=function(t){return t===Zue},TH=function(t){return function r(){return arguments.length===0||arguments.length===1&&Jue(arguments.length<=0?void 0:arguments[0])?r:t.apply(void 0,arguments)}},Cit=function e(t,r){return t===1?r:TH(function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];var o=a.filter(function(l){return l!==Zue}).length;return o>=t?r.apply(void 0,a):e(t-o,TH(function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var d=a.map(function(f){return Jue(f)?c.shift():f});return r.apply(void 0,wit(d).concat(c))}))})},zE=function(t){return Cit(t.length,t)},aD=function(t,r){for(var n=[],a=t;a<r;++a)n[a-t]=a;return n},Eit=zE(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),Ait=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(!r.length)return kit;var a=r.reverse(),i=a[0],o=a.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},iD=function(t){return Array.isArray(t)?t.reverse():t.split("").reverse.join("")},Que=function(t){var r=null,n=null;return function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return r&&i.every(function(l,c){return l===r[c]})||(r=i,n=t.apply(void 0,i)),n}};function Tit(e){var t;return e===0?t=1:t=Math.floor(new cs(e).abs().log(10).toNumber())+1,t}function Pit(e,t,r){for(var n=new cs(e),a=0,i=[];n.lt(t)&&a<1e5;)i.push(n.toNumber()),n=n.add(r),a++;return i}var Oit=zE(function(e,t,r){var n=+e,a=+t;return n+r*(a-n)}),Dit=zE(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),Iit=zE(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const UE={rangeStep:Pit,getDigitCount:Tit,interpolateNumber:Oit,uninterpolateNumber:Dit,uninterpolateTruncation:Iit};function oD(e){return Fit(e)||Lit(e)||ede(e)||Rit()}function Rit(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lit(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Fit(e){if(Array.isArray(e))return lD(e)}function U2(e,t){return Bit(e)||$it(e,t)||ede(e,t)||Mit()}function Mit(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ede(e,t){if(e){if(typeof e=="string")return lD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lD(e,t)}}function lD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $it(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,a=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(n=(l=o.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(c){a=!0,i=c}finally{try{!n&&o.return!=null&&o.return()}finally{if(a)throw i}}return r}}function Bit(e){if(Array.isArray(e))return e}function tde(e){var t=U2(e,2),r=t[0],n=t[1],a=r,i=n;return r>n&&(a=n,i=r),[a,i]}function rde(e,t,r){if(e.lte(0))return new cs(0);var n=UE.getDigitCount(e.toNumber()),a=new cs(10).pow(n),i=e.div(a),o=n!==1?.05:.1,l=new cs(Math.ceil(i.div(o).toNumber())).add(r).mul(o),c=l.mul(a);return t?c:new cs(Math.ceil(c))}function zit(e,t,r){var n=1,a=new cs(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new cs(10).pow(UE.getDigitCount(e)-1),a=new cs(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new cs(Math.floor(e)))}else e===0?a=new cs(Math.floor((t-1)/2)):r||(a=new cs(Math.floor(e)));var o=Math.floor((t-1)/2),l=Ait(Eit(function(c){return a.add(new cs(c-o).mul(n)).toNumber()}),aD);return l(0,t)}function nde(e,t,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new cs(0),tickMin:new cs(0),tickMax:new cs(0)};var i=rde(new cs(t).sub(e).div(r-1),n,a),o;e<=0&&t>=0?o=new cs(0):(o=new cs(e).add(t).div(2),o=o.sub(new cs(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new cs(t).sub(o).div(i).toNumber()),u=l+c+1;return u>r?nde(e,t,r,n,a+1):(u<r&&(c=t>0?c+(r-u):c,l=t>0?l:l+(r-u)),{step:i,tickMin:o.sub(new cs(l).mul(i)),tickMax:o.add(new cs(c).mul(i))})}function Uit(e){var t=U2(e,2),r=t[0],n=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=tde([r,n]),c=U2(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(oD(aD(0,a-1).map(function(){return 1/0}))):[].concat(oD(aD(0,a-1).map(function(){return-1/0})),[d]);return r>n?iD(f):f}if(u===d)return zit(u,a,i);var m=nde(u,d,o,i),h=m.step,g=m.tickMin,p=m.tickMax,x=UE.rangeStep(g,p.add(new cs(.1).mul(h)),h);return r>n?iD(x):x}function qit(e,t){var r=U2(e,2),n=r[0],a=r[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=tde([n,a]),l=U2(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[n,a];if(c===u)return[c];var d=Math.max(t,2),f=rde(new cs(u).sub(c).div(d-1),i,0),m=[].concat(oD(UE.rangeStep(new cs(c),new cs(u).sub(new cs(.99).mul(f)),f)),[u]);return n>a?iD(m):m}var Vit=Que(Uit),Wit=Que(qit),Hit="Invariant failed";function bg(e,t){throw new Error(Hit)}var Git=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function by(e){"@babel/helpers - typeof";return by=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},by(e)}function G4(){return G4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G4.apply(this,arguments)}function Kit(e,t){return Jit(e)||Zit(e,t)||Xit(e,t)||Yit()}function Yit(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xit(e,t){if(e){if(typeof e=="string")return PH(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return PH(e,t)}}function PH(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Zit(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Jit(e){if(Array.isArray(e))return e}function Qit(e,t){if(e==null)return{};var r=eot(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function eot(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function tot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ide(n.key),n)}}function not(e,t,r){return t&&rot(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function sot(e,t,r){return t=K4(t),aot(e,sde()?Reflect.construct(t,r||[],K4(e).constructor):t.apply(e,r))}function aot(e,t){if(t&&(by(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iot(e)}function iot(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sde=function(){return!!e})()}function K4(e){return K4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},K4(e)}function oot(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&&cD(e,t)}function cD(e,t){return cD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},cD(e,t)}function ade(e,t,r){return t=ide(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ide(e){var t=lot(e,"string");return by(t)=="symbol"?t:t+""}function lot(e,t){if(by(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(by(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var v_=function(e){function t(){return tot(this,t),sot(this,t,arguments)}return oot(t,e),not(t,[{key:"render",value:function(){var n=this.props,a=n.offset,i=n.layout,o=n.width,l=n.dataKey,c=n.data,u=n.dataPointFormatter,d=n.xAxis,f=n.yAxis,m=Qit(n,Git),h=Sr(m,!1);this.props.direction==="x"&&d.type!=="number"&&bg();var g=c.map(function(p){var x=u(p,l),v=x.x,b=x.y,y=x.value,N=x.errorVal;if(!N)return null;var _=[],j,S;if(Array.isArray(N)){var I=Kit(N,2);j=I[0],S=I[1]}else j=S=N;if(i==="vertical"){var P=d.scale,F=b+a,T=F+o,k=F-o,V=P(y-j),C=P(y+S);_.push({x1:C,y1:T,x2:C,y2:k}),_.push({x1:V,y1:F,x2:C,y2:F}),_.push({x1:V,y1:T,x2:V,y2:k})}else if(i==="horizontal"){var R=f.scale,H=v+a,q=H-o,L=H+o,M=R(y-j),z=R(y+S);_.push({x1:q,y1:z,x2:L,y2:z}),_.push({x1:H,y1:M,x2:H,y2:z}),_.push({x1:q,y1:M,x2:L,y2:M})}return be.createElement(Ln,G4({className:"recharts-errorBar",key:"bar-".concat(_.map(function(K){return"".concat(K.x1,"-").concat(K.x2,"-").concat(K.y1,"-").concat(K.y2)}))},h),_.map(function(K){return be.createElement("line",G4({},K,{key:"line-".concat(K.x1,"-").concat(K.x2,"-").concat(K.y1,"-").concat(K.y2)}))}))});return be.createElement(Ln,{className:"recharts-errorBars"},g)}}])}(be.Component);ade(v_,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});ade(v_,"displayName","ErrorBar");function q2(e){"@babel/helpers - typeof";return q2=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},q2(e)}function OH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function e0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?OH(Object(r),!0).forEach(function(n){cot(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function cot(e,t,r){return t=uot(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uot(e){var t=dot(e,"string");return q2(t)=="symbol"?t:t+""}function dot(e,t){if(q2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(q2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ode=function(t){var r=t.children,n=t.formattedGraphicalItems,a=t.legendWidth,i=t.legendContent,o=Fl(r,W0);if(!o)return null;var l=W0.defaultProps,c=l!==void 0?e0(e0({},l),o.props):{},u;return o.props&&o.props.payload?u=o.props&&o.props.payload:i==="children"?u=(n||[]).reduce(function(d,f){var m=f.item,h=f.props,g=h.sectors||h.data||[];return d.concat(g.map(function(p){return{type:o.props.iconType||m.props.legendType,value:p.name,color:p.fill,payload:p}}))},[]):u=(n||[]).map(function(d){var f=d.item,m=f.type.defaultProps,h=m!==void 0?e0(e0({},m),f.props):{},g=h.dataKey,p=h.name,x=h.legendType,v=h.hide;return{inactive:v,dataKey:g,type:c.iconType||x||"square",color:yM(f),value:p||g,payload:h}}),e0(e0(e0({},c),W0.getWithHeight(o,a)),{},{payload:u,item:o})};function V2(e){"@babel/helpers - typeof";return V2=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},V2(e)}function DH(e){return pot(e)||mot(e)||hot(e)||fot()}function fot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hot(e,t){if(e){if(typeof e=="string")return uD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uD(e,t)}}function mot(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pot(e){if(Array.isArray(e))return uD(e)}function uD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function IH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IH(Object(r),!0).forEach(function(n){Av(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Av(e,t,r){return t=got(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function got(e){var t=xot(e,"string");return V2(t)=="symbol"?t:t+""}function xot(e,t){if(V2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(V2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hi(e,t,r){return Xr(e)||Xr(t)?r:gi(t)?Ql(e,t,r):Mr(t)?t(e):r}function Cw(e,t,r,n){var a=mit(e,function(l){return hi(l,t)});if(r==="number"){var i=a.filter(function(l){return Dt(l)||parseFloat(l)});return i.length?[BE(i),$E(i)]:[1/0,-1/0]}var o=n?a.filter(function(l){return!Xr(l)}):a;return o.map(function(l){return gi(l)||l instanceof Date?l:""})}var vot=function(t){var r,n=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=(r=n==null?void 0:n.length)!==null&&r!==void 0?r: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,u=0;u<l;u++){var d=u>0?a[u-1].coordinate:a[l-1].coordinate,f=a[u].coordinate,m=u>=l-1?a[0].coordinate:a[u+1].coordinate,h=void 0;if(Fo(f-d)!==Fo(m-f)){var g=[];if(Fo(m-f)===Fo(c[1]-c[0])){h=m;var p=f+c[1]-c[0];g[0]=Math.min(p,(p+d)/2),g[1]=Math.max(p,(p+d)/2)}else{h=d;var x=m+c[1]-c[0];g[0]=Math.min(f,(x+f)/2),g[1]=Math.max(f,(x+f)/2)}var v=[Math.min(f,(h+f)/2),Math.max(f,(h+f)/2)];if(t>v[0]&&t<=v[1]||t>=g[0]&&t<=g[1]){o=a[u].index;break}}else{var b=Math.min(d,m),y=Math.max(d,m);if(t>(b+f)/2&&t<=(y+f)/2){o=a[u].index;break}}}else for(var N=0;N<l;N++)if(N===0&&t<=(n[N].coordinate+n[N+1].coordinate)/2||N>0&&N<l-1&&t>(n[N].coordinate+n[N-1].coordinate)/2&&t<=(n[N].coordinate+n[N+1].coordinate)/2||N===l-1&&t>(n[N].coordinate+n[N-1].coordinate)/2){o=n[N].index;break}return o},yM=function(t){var r,n=t,a=n.type.displayName,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?da(da({},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},yot=function(t){var r=t.barSize,n=t.totalSize,a=t.stackGroups,i=a===void 0?{}:a;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c<u;c++)for(var d=i[l[c]].stackGroups,f=Object.keys(d),m=0,h=f.length;m<h;m++){var g=d[f[m]],p=g.items,x=g.cateAxisId,v=p.filter(function(S){return Qf(S.type).indexOf("Bar")>=0});if(v&&v.length){var b=v[0].type.defaultProps,y=b!==void 0?da(da({},b),v[0].props):v[0].props,N=y.barSize,_=y[x];o[_]||(o[_]=[]);var j=Xr(N)?r:N;o[_].push({item:v[0],stackList:v.slice(1),barSize:Xr(j)?void 0:Mo(j,n,0)})}}return o},bot=function(t){var r=t.barGap,n=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 u=Mo(r,a,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var m=!1,h=a/c,g=o.reduce(function(N,_){return N+_.barSize||0},0);g+=(c-1)*u,g>=a&&(g-=(c-1)*u,u=0),g>=a&&h>0&&(m=!0,h*=.9,g=c*h);var p=(a-g)/2>>0,x={offset:p-u,size:0};d=o.reduce(function(N,_){var j={item:_.item,position:{offset:x.offset+x.size+u,size:m?h:_.barSize}},S=[].concat(DH(N),[j]);return x=S[S.length-1].position,_.stackList&&_.stackList.length&&_.stackList.forEach(function(I){S.push({item:I,position:x})}),S},f)}else{var v=Mo(n,a,0,!0);a-2*v-(c-1)*u<=0&&(u=0);var b=(a-2*v-(c-1)*u)/c;b>1&&(b>>=0);var y=l===+l?Math.min(b,l):b;d=o.reduce(function(N,_,j){var S=[].concat(DH(N),[{item:_.item,position:{offset:v+(b+u)*j+(b-y)/2,size:y}}]);return _.stackList&&_.stackList.length&&_.stackList.forEach(function(I){S.push({item:I,position:S[S.length-1].position})}),S},f)}return d},wot=function(t,r,n,a){var i=n.children,o=n.width,l=n.margin,c=o-(l.left||0)-(l.right||0),u=ode({children:i,legendWidth:c});if(u){var d=a||{},f=d.width,m=d.height,h=u.align,g=u.verticalAlign,p=u.layout;if((p==="vertical"||p==="horizontal"&&g==="middle")&&h!=="center"&&Dt(t[h]))return da(da({},t),{},Av({},h,t[h]+(f||0)));if((p==="horizontal"||p==="vertical"&&h==="center")&&g!=="middle"&&Dt(t[g]))return da(da({},t),{},Av({},g,t[g]+(m||0)))}return t},jot=function(t,r,n){return Xr(r)?!0:t==="horizontal"?r==="yAxis":t==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},lde=function(t,r,n,a,i){var o=r.props.children,l=ec(o,v_).filter(function(u){return jot(a,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=hi(d,n);if(Xr(f))return u;var m=Array.isArray(f)?[BE(f),$E(f)]:[f,f],h=c.reduce(function(g,p){var x=hi(d,p,0),v=m[0]-Math.abs(Array.isArray(x)?x[0]:x),b=m[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(v,g[0]),Math.max(b,g[1])]},[1/0,-1/0]);return[Math.min(h[0],u[0]),Math.max(h[1],u[1])]},[1/0,-1/0])}return null},_ot=function(t,r,n,a,i){var o=r.map(function(l){return lde(t,l,n,i,a)}).filter(function(l){return!Xr(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},cde=function(t,r,n,a,i){var o=r.map(function(c){var u=c.props.dataKey;return n==="number"&&u&&lde(t,c,u,a)||Cw(t,u,n,i)});if(n==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d<f;d++)l[u[d]]||(l[u[d]]=!0,c.push(u[d]));return c},[])},ude=function(t,r){return t==="horizontal"&&r==="xAxis"||t==="vertical"&&r==="yAxis"||t==="centric"&&r==="angleAxis"||t==="radial"&&r==="radiusAxis"},dde=function(t,r,n,a){if(a)return t.map(function(c){return c.coordinate});var i,o,l=t.map(function(c){return c.coordinate===r&&(i=!0),c.coordinate===n&&(o=!0),c.coordinate});return i||l.push(r),o||l.push(n),l},Kf=function(t,r,n){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,u=(r||n)&&o==="category"&&a.bandwidth?a.bandwidth()/c:0;if(u=t.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?Fo(l[0]-l[1])*2*u:u,r&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var m=i?i.indexOf(f):f;return{coordinate:a(m)+u,value:f,offset:u}});return d.filter(function(f){return!u_(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,m){return{coordinate:a(f)+u,value:f,index:m,offset:u}}):a.ticks&&!n?a.ticks(t.tickCount).map(function(f){return{coordinate:a(f)+u,value:f,offset:u}}):a.domain().map(function(f,m){return{coordinate:a(f)+u,value:i?i[f]:f,index:m,offset:u}})},mP=new WeakMap,bS=function(t,r){if(typeof r!="function")return t;mP.has(t)||mP.set(t,new WeakMap);var n=mP.get(t);if(n.has(r))return n.get(r);var a=function(){t.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,a),a},fde=function(t,r,n){var a=t.scale,i=t.type,o=t.layout,l=t.axisType;if(a==="auto")return o==="radial"&&l==="radiusAxis"?{scale:L2(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:U4(),realScaleType:"linear"}:i==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:kw(),realScaleType:"point"}:i==="category"?{scale:L2(),realScaleType:"band"}:{scale:U4(),realScaleType:"linear"};if(gg(a)){var c="scale".concat(SE(a));return{scale:(CH[c]||kw)(),realScaleType:CH[c]?c:"point"}}return Mr(a)?{scale:a}:{scale:kw(),realScaleType:"point"}},RH=1e-4,hde=function(t){var r=t.domain();if(!(!r||r.length<=2)){var n=r.length,a=t.range(),i=Math.min(a[0],a[1])-RH,o=Math.max(a[0],a[1])+RH,l=t(r[0]),c=t(r[n-1]);(l<i||l>o||c<i||c>o)&&t.domain([r[0],r[n-1]])}},Not=function(t,r){if(!t)return null;for(var n=0,a=t.length;n<a;n++)if(t[n].item===r)return t[n].position;return null},Sot=function(t,r){if(!r||r.length!==2||!Dt(r[0])||!Dt(r[1]))return t;var n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]),i=[t[0],t[1]];return(!Dt(t[0])||t[0]<n)&&(i[0]=n),(!Dt(t[1])||t[1]>a)&&(i[1]=a),i[0]>a&&(i[0]=a),i[1]<n&&(i[1]=n),i},kot=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n<a;++n)for(var i=0,o=0,l=0;l<r;++l){var c=u_(t[l][n][1])?t[l][n][0]:t[l][n][1];c>=0?(t[l][n][0]=i,t[l][n][1]=i+c,i=t[l][n][1]):(t[l][n][0]=o,t[l][n][1]=o+c,o=t[l][n][1])}},Cot=function(t){var r=t.length;if(!(r<=0))for(var n=0,a=t[0].length;n<a;++n)for(var i=0,o=0;o<r;++o){var l=u_(t[o][n][1])?t[o][n][0]:t[o][n][1];l>=0?(t[o][n][0]=i,t[o][n][1]=i+l,i=t[o][n][1]):(t[o][n][0]=0,t[o][n][1]=0)}},Eot={sign:kot,expand:WGe,none:fy,silhouette:HGe,wiggle:GGe,positive:Cot},Aot=function(t,r,n){var a=r.map(function(l){return l.props.dataKey}),i=Eot[n],o=VGe().keys(a).value(function(l,c){return+hi(l,c,0)}).order(R8).offset(i);return o(t)},Tot=function(t,r,n,a,i,o){if(!t)return null;var l=o?r.reverse():r,c={},u=l.reduce(function(f,m){var h,g=(h=m.type)!==null&&h!==void 0&&h.defaultProps?da(da({},m.type.defaultProps),m.props):m.props,p=g.stackId,x=g.hide;if(x)return f;var v=g[n],b=f[v]||{hasStack:!1,stackGroups:{}};if(gi(p)){var y=b.stackGroups[p]||{numericAxisId:n,cateAxisId:a,items:[]};y.items.push(m),b.hasStack=!0,b.stackGroups[p]=y}else b.stackGroups[_1("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[m]};return da(da({},f),{},Av({},v,b))},c),d={};return Object.keys(u).reduce(function(f,m){var h=u[m];if(h.hasStack){var g={};h.stackGroups=Object.keys(h.stackGroups).reduce(function(p,x){var v=h.stackGroups[x];return da(da({},p),{},Av({},x,{numericAxisId:n,cateAxisId:a,items:v.items,stackedData:Aot(t,v.items,i)}))},g)}return da(da({},f),{},Av({},m,h))},d)},mde=function(t,r){var n=r.realScaleType,a=r.type,i=r.tickCount,o=r.originalDomain,l=r.allowDecimals,c=n||r.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&a==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=Vit(u,i,l);return t.domain([BE(d),$E(d)]),{niceTicks:d}}if(i&&a==="number"){var f=t.domain(),m=Wit(f,i,l);return{niceTicks:m}}return null};function LH(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Xr(a[t.dataKey])){var l=b4(r,"value",a[t.dataKey]);if(l)return l.coordinate+n/2}return r[i]?r[i].coordinate+n/2:null}var c=hi(a,Xr(o)?t.dataKey:o);return Xr(c)?null:t.scale(c)}var FH=function(t){var r=t.axis,n=t.ticks,a=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(r.type==="category")return n[l]?n[l].coordinate+a:null;var c=hi(o,r.dataKey,r.domain[l]);return Xr(c)?null:r.scale(c)-i/2+a},Pot=function(t){var r=t.numericAxis,n=r.scale.domain();if(r.type==="number"){var a=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return a<=0&&i>=0?0:i<0?i:a}return n[0]},Oot=function(t,r){var n,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?da(da({},t.type.defaultProps),t.props):t.props,i=a.stackId;if(gi(i)){var o=r[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},Dot=function(t){return t.reduce(function(r,n){return[BE(n.concat([r[0]]).filter(Dt)),$E(n.concat([r[1]]).filter(Dt))]},[1/0,-1/0])},pde=function(t,r,n){return Object.keys(t).reduce(function(a,i){var o=t[i],l=o.stackedData,c=l.reduce(function(u,d){var f=Dot(d.slice(r,n+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],a[0]),Math.max(c[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},MH=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$H=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,dD=function(t,r,n){if(Mr(t))return t(r,n);if(!Array.isArray(t))return r;var a=[];if(Dt(t[0]))a[0]=n?t[0]:Math.min(t[0],r[0]);else if(MH.test(t[0])){var i=+MH.exec(t[0])[1];a[0]=r[0]-i}else Mr(t[0])?a[0]=t[0](r[0]):a[0]=r[0];if(Dt(t[1]))a[1]=n?t[1]:Math.max(t[1],r[1]);else if($H.test(t[1])){var o=+$H.exec(t[1])[1];a[1]=r[1]+o}else Mr(t[1])?a[1]=t[1](r[1]):a[1]=r[1];return a},Y4=function(t,r,n){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!n||a>0)return a}if(t&&r&&r.length>=2){for(var i=GF(r,function(f){return f.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var u=i[l],d=i[l-1];o=Math.min((u.coordinate||0)-(d.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0},BH=function(t,r,n){return!t||!t.length||x_(t,Ql(n,"type.defaultProps.domain"))?r:t},gde=function(t,r){var n=t.type.defaultProps?da(da({},t.type.defaultProps),t.props):t.props,a=n.dataKey,i=n.name,o=n.unit,l=n.formatter,c=n.tooltipType,u=n.chartType,d=n.hide;return da(da({},Sr(t,!1)),{},{dataKey:a,unit:o,formatter:l,name:i||a,color:yM(t),value:hi(r,a),type:c,payload:r,chartType:u,hide:d})};function W2(e){"@babel/helpers - typeof";return W2=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},W2(e)}function zH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ff(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zH(Object(r),!0).forEach(function(n){xde(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xde(e,t,r){return t=Iot(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Iot(e){var t=Rot(e,"string");return W2(t)=="symbol"?t:t+""}function Rot(e,t){if(W2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(W2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Lot(e,t){return Bot(e)||$ot(e,t)||Mot(e,t)||Fot()}function Fot(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mot(e,t){if(e){if(typeof e=="string")return UH(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return UH(e,t)}}function UH(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $ot(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Bot(e){if(Array.isArray(e))return e}var X4=Math.PI/180,zot=function(t){return t*180/Math.PI},As=function(t,r,n,a){return{x:t+Math.cos(-X4*a)*n,y:r+Math.sin(-X4*a)*n}},vde=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},Uot=function(t,r,n,a,i){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Mo(t.cx,o,o/2),f=Mo(t.cy,l,l/2),m=vde(o,l,n),h=Mo(t.innerRadius,m,0),g=Mo(t.outerRadius,m,m*.8),p=Object.keys(r);return p.reduce(function(x,v){var b=r[v],y=b.domain,N=b.reversed,_;if(Xr(b.range))a==="angleAxis"?_=[c,u]:a==="radiusAxis"&&(_=[h,g]),N&&(_=[_[1],_[0]]);else{_=b.range;var j=_,S=Lot(j,2);c=S[0],u=S[1]}var I=fde(b,i),P=I.realScaleType,F=I.scale;F.domain(y).range(_),hde(F);var T=mde(F,Ff(Ff({},b),{},{realScaleType:P})),k=Ff(Ff(Ff({},b),T),{},{range:_,radius:g,realScaleType:P,scale:F,cx:d,cy:f,innerRadius:h,outerRadius:g,startAngle:c,endAngle:u});return Ff(Ff({},x),{},xde({},v,k))},{})},qot=function(t,r){var n=t.x,a=t.y,i=r.x,o=r.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(a-o,2))},Vot=function(t,r){var n=t.x,a=t.y,i=r.cx,o=r.cy,l=qot({x:n,y:a},{x:i,y:o});if(l<=0)return{radius:l};var c=(n-i)/l,u=Math.acos(c);return a>o&&(u=2*Math.PI-u),{radius:l,angle:zot(u),angleInRadian:u}},Wot=function(t){var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),i=Math.floor(n/360),o=Math.min(a,i);return{startAngle:r-o*360,endAngle:n-o*360}},Hot=function(t,r){var n=r.startAngle,a=r.endAngle,i=Math.floor(n/360),o=Math.floor(a/360),l=Math.min(i,o);return t+l*360},qH=function(t,r){var n=t.x,a=t.y,i=Vot({x:n,y:a},r),o=i.radius,l=i.angle,c=r.innerRadius,u=r.outerRadius;if(o<c||o>u)return!1;if(o===0)return!0;var d=Wot(r),f=d.startAngle,m=d.endAngle,h=l,g;if(f<=m){for(;h>m;)h-=360;for(;h<f;)h+=360;g=h>=f&&h<=m}else{for(;h>f;)h-=360;for(;h<m;)h+=360;g=h>=m&&h<=f}return g?Ff(Ff({},r),{},{radius:o,angle:Hot(h,r)}):null},yde=function(t){return!w.isValidElement(t)&&!Mr(t)&&typeof t!="boolean"?t.className:""};function H2(e){"@babel/helpers - typeof";return H2=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},H2(e)}var Got=["offset"];function Kot(e){return Jot(e)||Zot(e)||Xot(e)||Yot()}function Yot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xot(e,t){if(e){if(typeof e=="string")return fD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fD(e,t)}}function Zot(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Jot(e){if(Array.isArray(e))return fD(e)}function fD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Qot(e,t){if(e==null)return{};var r=elt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function elt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function VH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function oi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VH(Object(r),!0).forEach(function(n){tlt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tlt(e,t,r){return t=rlt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rlt(e){var t=nlt(e,"string");return H2(t)=="symbol"?t:t+""}function nlt(e,t){if(H2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(H2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function G2(){return G2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G2.apply(this,arguments)}var slt=function(t){var r=t.value,n=t.formatter,a=Xr(t.children)?r:t.children;return Mr(n)?n(a):a},alt=function(t,r){var n=Fo(r-t),a=Math.min(Math.abs(r-t),360);return n*a},ilt=function(t,r,n){var a=t.position,i=t.viewBox,o=t.offset,l=t.className,c=i,u=c.cx,d=c.cy,f=c.innerRadius,m=c.outerRadius,h=c.startAngle,g=c.endAngle,p=c.clockWise,x=(f+m)/2,v=alt(h,g),b=v>=0?1:-1,y,N;a==="insideStart"?(y=h+b*o,N=p):a==="insideEnd"?(y=g-b*o,N=!p):a==="end"&&(y=g+b*o,N=p),N=v<=0?N:!N;var _=As(u,d,x,y),j=As(u,d,x,y+(N?1:-1)*359),S="M".concat(_.x,",").concat(_.y,`
A`).concat(x,",").concat(x,",0,1,").concat(N?0:1,`,
`).concat(j.x,",").concat(j.y),I=Xr(t.id)?_1("recharts-radial-line-"):t.id;return be.createElement("text",G2({},n,{dominantBaseline:"central",className:en("recharts-radial-bar-label",l)}),be.createElement("defs",null,be.createElement("path",{id:I,d:S})),be.createElement("textPath",{xlinkHref:"#".concat(I)},r))},olt=function(t){var r=t.viewBox,n=t.offset,a=t.position,i=r,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,m=(d+f)/2;if(a==="outside"){var h=As(o,l,u+n,m),g=h.x,p=h.y;return{x:g,y:p,textAnchor:g>=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 x=(c+u)/2,v=As(o,l,x,m),b=v.x,y=v.y;return{x:b,y,textAnchor:"middle",verticalAnchor:"middle"}},llt=function(t){var r=t.viewBox,n=t.parentViewBox,a=t.offset,i=t.position,o=r,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,m=f*a,h=f>0?"end":"start",g=f>0?"start":"end",p=u>=0?1:-1,x=p*a,v=p>0?"end":"start",b=p>0?"start":"end";if(i==="top"){var y={x:l+u/2,y:c-f*a,textAnchor:"middle",verticalAnchor:h};return oi(oi({},y),n?{height:Math.max(c-n.y,0),width:u}:{})}if(i==="bottom"){var N={x:l+u/2,y:c+d+m,textAnchor:"middle",verticalAnchor:g};return oi(oi({},N),n?{height:Math.max(n.y+n.height-(c+d),0),width:u}:{})}if(i==="left"){var _={x:l-x,y:c+d/2,textAnchor:v,verticalAnchor:"middle"};return oi(oi({},_),n?{width:Math.max(_.x-n.x,0),height:d}:{})}if(i==="right"){var j={x:l+u+x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return oi(oi({},j),n?{width:Math.max(n.x+n.width-j.x,0),height:d}:{})}var S=n?{width:u,height:d}:{};return i==="insideLeft"?oi({x:l+x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},S):i==="insideRight"?oi({x:l+u-x,y:c+d/2,textAnchor:v,verticalAnchor:"middle"},S):i==="insideTop"?oi({x:l+u/2,y:c+m,textAnchor:"middle",verticalAnchor:g},S):i==="insideBottom"?oi({x:l+u/2,y:c+d-m,textAnchor:"middle",verticalAnchor:h},S):i==="insideTopLeft"?oi({x:l+x,y:c+m,textAnchor:b,verticalAnchor:g},S):i==="insideTopRight"?oi({x:l+u-x,y:c+m,textAnchor:v,verticalAnchor:g},S):i==="insideBottomLeft"?oi({x:l+x,y:c+d-m,textAnchor:b,verticalAnchor:h},S):i==="insideBottomRight"?oi({x:l+u-x,y:c+d-m,textAnchor:v,verticalAnchor:h},S):y1(i)&&(Dt(i.x)||_0(i.x))&&(Dt(i.y)||_0(i.y))?oi({x:l+Mo(i.x,u),y:c+Mo(i.y,d),textAnchor:"end",verticalAnchor:"end"},S):oi({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},S)},clt=function(t){return"cx"in t&&Dt(t.cx)};function Ci(e){var t=e.offset,r=t===void 0?5:t,n=Qot(e,Got),a=oi({offset:r},n),i=a.viewBox,o=a.position,l=a.value,c=a.children,u=a.content,d=a.className,f=d===void 0?"":d,m=a.textBreakAll;if(!i||Xr(l)&&Xr(c)&&!w.isValidElement(u)&&!Mr(u))return null;if(w.isValidElement(u))return w.cloneElement(u,a);var h;if(Mr(u)){if(h=w.createElement(u,a),w.isValidElement(h))return h}else h=slt(a);var g=clt(i),p=Sr(a,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return ilt(a,h,p);var x=g?olt(a):llt(a);return be.createElement(vg,G2({className:en("recharts-label",f)},p,x,{breakAll:m}),h)}Ci.displayName="Label";var bde=function(t){var r=t.cx,n=t.cy,a=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,m=t.y,h=t.top,g=t.left,p=t.width,x=t.height,v=t.clockWise,b=t.labelViewBox;if(b)return b;if(Dt(p)&&Dt(x)){if(Dt(f)&&Dt(m))return{x:f,y:m,width:p,height:x};if(Dt(h)&&Dt(g))return{x:h,y:g,width:p,height:x}}return Dt(f)&&Dt(m)?{x:f,y:m,width:0,height:0}:Dt(r)&&Dt(n)?{cx:r,cy:n,startAngle:i||a||0,endAngle:o||a||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:v}:t.viewBox?t.viewBox:{}},ult=function(t,r){return t?t===!0?be.createElement(Ci,{key:"label-implicit",viewBox:r}):gi(t)?be.createElement(Ci,{key:"label-implicit",viewBox:r,value:t}):w.isValidElement(t)?t.type===Ci?w.cloneElement(t,{key:"label-implicit",viewBox:r}):be.createElement(Ci,{key:"label-implicit",content:t,viewBox:r}):Mr(t)?be.createElement(Ci,{key:"label-implicit",content:t,viewBox:r}):y1(t)?be.createElement(Ci,G2({viewBox:r},t,{key:"label-implicit"})):null:null},dlt=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var a=t.children,i=bde(t),o=ec(a,Ci).map(function(c,u){return w.cloneElement(c,{viewBox:r||i,key:"label-".concat(u)})});if(!n)return o;var l=ult(t.label,r||i);return[l].concat(Kot(o))};Ci.parseViewBox=bde;Ci.renderCallByParent=dlt;function flt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var hlt=flt;const mlt=jn(hlt);function K2(e){"@babel/helpers - typeof";return K2=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},K2(e)}var plt=["valueAccessor"],glt=["data","dataKey","clockWise","id","textBreakAll"];function xlt(e){return wlt(e)||blt(e)||ylt(e)||vlt()}function vlt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ylt(e,t){if(e){if(typeof e=="string")return hD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hD(e,t)}}function blt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wlt(e){if(Array.isArray(e))return hD(e)}function hD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Z4(){return Z4=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Z4.apply(this,arguments)}function WH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function HH(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WH(Object(r),!0).forEach(function(n){jlt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jlt(e,t,r){return t=_lt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _lt(e){var t=Nlt(e,"string");return K2(t)=="symbol"?t:t+""}function Nlt(e,t){if(K2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(K2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function GH(e,t){if(e==null)return{};var r=Slt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Slt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var klt=function(t){return Array.isArray(t.value)?mlt(t.value):t.value};function th(e){var t=e.valueAccessor,r=t===void 0?klt:t,n=GH(e,plt),a=n.data,i=n.dataKey,o=n.clockWise,l=n.id,c=n.textBreakAll,u=GH(n,glt);return!a||!a.length?null:be.createElement(Ln,{className:"recharts-label-list"},a.map(function(d,f){var m=Xr(i)?r(d,f):hi(d&&d.payload,i),h=Xr(l)?{}:{id:"".concat(l,"-").concat(f)};return be.createElement(Ci,Z4({},Sr(d,!0),u,h,{parentViewBox:d.parentViewBox,value:m,textBreakAll:c,viewBox:Ci.parseViewBox(Xr(o)?d:HH(HH({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}th.displayName="LabelList";function Clt(e,t){return e?e===!0?be.createElement(th,{key:"labelList-implicit",data:t}):be.isValidElement(e)||Mr(e)?be.createElement(th,{key:"labelList-implicit",data:t,content:e}):y1(e)?be.createElement(th,Z4({data:t},e,{key:"labelList-implicit"})):null:null}function Elt(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,a=ec(n,th).map(function(o,l){return w.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!r)return a;var i=Clt(e.label,t);return[i].concat(xlt(a))}th.renderCallByParent=Elt;function Y2(e){"@babel/helpers - typeof";return Y2=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},Y2(e)}function mD(){return mD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mD.apply(this,arguments)}function KH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function YH(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KH(Object(r),!0).forEach(function(n){Alt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Alt(e,t,r){return t=Tlt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tlt(e){var t=Plt(e,"string");return Y2(t)=="symbol"?t:t+""}function Plt(e,t){if(Y2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Y2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Olt=function(t,r){var n=Fo(r-t),a=Math.min(Math.abs(r-t),359.999);return n*a},wS=function(t){var r=t.cx,n=t.cy,a=t.radius,i=t.angle,o=t.sign,l=t.isExternal,c=t.cornerRadius,u=t.cornerIsExternal,d=c*(l?1:-1)+a,f=Math.asin(c/d)/X4,m=u?i:i+o*f,h=As(r,n,d,m),g=As(r,n,a,m),p=u?i-o*f:i,x=As(r,n,d*Math.cos(f*X4),p);return{center:h,circleTangency:g,lineTangency:x,theta:f}},wde=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.startAngle,l=t.endAngle,c=Olt(o,l),u=o+c,d=As(r,n,i,o),f=As(r,n,i,u),m="M ".concat(d.x,",").concat(d.y,`
A `).concat(i,",").concat(i,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o>u),`,
`).concat(f.x,",").concat(f.y,`
`);if(a>0){var h=As(r,n,a,o),g=As(r,n,a,u);m+="L ".concat(g.x,",").concat(g.y,`
A `).concat(a,",").concat(a,`,0,
`).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`,
`).concat(h.x,",").concat(h.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},Dlt=function(t){var r=t.cx,n=t.cy,a=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=Fo(d-u),m=wS({cx:r,cy:n,radius:i,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),h=m.circleTangency,g=m.lineTangency,p=m.theta,x=wS({cx:r,cy:n,radius:i,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),v=x.circleTangency,b=x.lineTangency,y=x.theta,N=c?Math.abs(u-d):Math.abs(u-d)-p-y;if(N<0)return l?"M ".concat(g.x,",").concat(g.y,`
a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
`):wde({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:u,endAngle:d});var _="M ".concat(g.x,",").concat(g.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(h.x,",").concat(h.y,`
A`).concat(i,",").concat(i,",0,").concat(+(N>180),",").concat(+(f<0),",").concat(v.x,",").concat(v.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(b.x,",").concat(b.y,`
`);if(a>0){var j=wS({cx:r,cy:n,radius:a,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),S=j.circleTangency,I=j.lineTangency,P=j.theta,F=wS({cx:r,cy:n,radius:a,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),T=F.circleTangency,k=F.lineTangency,V=F.theta,C=c?Math.abs(u-d):Math.abs(u-d)-P-V;if(C<0&&o===0)return"".concat(_,"L").concat(r,",").concat(n,"Z");_+="L".concat(k.x,",").concat(k.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(T.x,",").concat(T.y,`
A`).concat(a,",").concat(a,",0,").concat(+(C>180),",").concat(+(f>0),",").concat(S.x,",").concat(S.y,`
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(I.x,",").concat(I.y,"Z")}else _+="L".concat(r,",").concat(n,"Z");return _},Ilt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},jde=function(t){var r=YH(YH({},Ilt),t),n=r.cx,a=r.cy,i=r.innerRadius,o=r.outerRadius,l=r.cornerRadius,c=r.forceCornerRadius,u=r.cornerIsExternal,d=r.startAngle,f=r.endAngle,m=r.className;if(o<i||d===f)return null;var h=en("recharts-sector",m),g=o-i,p=Mo(l,g,0,!0),x;return p>0&&Math.abs(d-f)<360?x=Dlt({cx:n,cy:a,innerRadius:i,outerRadius:o,cornerRadius:Math.min(p,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):x=wde({cx:n,cy:a,innerRadius:i,outerRadius:o,startAngle:d,endAngle:f}),be.createElement("path",mD({},Sr(r,!0),{className:h,d:x,role:"img"}))};function X2(e){"@babel/helpers - typeof";return X2=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},X2(e)}function pD(){return pD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pD.apply(this,arguments)}function XH(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ZH(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XH(Object(r),!0).forEach(function(n){Rlt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XH(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rlt(e,t,r){return t=Llt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Llt(e){var t=Flt(e,"string");return X2(t)=="symbol"?t:t+""}function Flt(e,t){if(X2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(X2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var JH={curveBasisClosed:DGe,curveBasisOpen:IGe,curveBasis:OGe,curveBumpX:vGe,curveBumpY:yGe,curveLinearClosed:RGe,curveLinear:CE,curveMonotoneX:LGe,curveMonotoneY:FGe,curveNatural:MGe,curveStep:$Ge,curveStepAfter:zGe,curveStepBefore:BGe},jS=function(t){return t.x===+t.x&&t.y===+t.y},Lb=function(t){return t.x},Fb=function(t){return t.y},Mlt=function(t,r){if(Mr(t))return t;var n="curve".concat(SE(t));return(n==="curveMonotone"||n==="curveBump")&&r?JH["".concat(n).concat(r==="vertical"?"Y":"X")]:JH[n]||CE},$lt=function(t){var r=t.type,n=r===void 0?"linear":r,a=t.points,i=a===void 0?[]:a,o=t.baseLine,l=t.layout,c=t.connectNulls,u=c===void 0?!1:c,d=Mlt(n,l),f=u?i.filter(function(p){return jS(p)}):i,m;if(Array.isArray(o)){var h=u?o.filter(function(p){return jS(p)}):o,g=f.map(function(p,x){return ZH(ZH({},p),{},{base:h[x]})});return l==="vertical"?m=fS().y(Fb).x1(Lb).x0(function(p){return p.base.x}):m=fS().x(Lb).y1(Fb).y0(function(p){return p.base.y}),m.defined(jS).curve(d),m(g)}return l==="vertical"&&Dt(o)?m=fS().y(Fb).x1(Lb).x0(o):Dt(o)?m=fS().x(Lb).y1(Fb).y0(o):m=gce().x(Lb).y(Fb),m.defined(jS).curve(d),m(f)},J4=function(t){var r=t.className,n=t.points,a=t.path,i=t.pathRef;if((!n||!n.length)&&!a)return null;var o=n&&n.length?$lt(t):a;return w.createElement("path",pD({},Sr(t,!1),w4(t),{className:en("recharts-curve",r),d:o,ref:i}))},Blt=Object.getOwnPropertyNames,zlt=Object.getOwnPropertySymbols,Ult=Object.prototype.hasOwnProperty;function QH(e,t){return function(n,a,i){return e(n,a,i)&&t(n,a,i)}}function _S(e){return function(r,n,a){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,a);var i=a.cache,o=i.get(r),l=i.get(n);if(o&&l)return o===n&&l===r;i.set(r,n),i.set(n,r);var c=e(r,n,a);return i.delete(r),i.delete(n),c}}function eG(e){return Blt(e).concat(zlt(e))}var qlt=Object.hasOwn||function(e,t){return Ult.call(e,t)};function Hg(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var Vlt="__v",Wlt="__o",Hlt="_owner",tG=Object.getOwnPropertyDescriptor,rG=Object.keys;function Glt(e,t,r){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function Klt(e,t){return Hg(e.getTime(),t.getTime())}function Ylt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Xlt(e,t){return e===t}function nG(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var a=new Array(n),i=e.entries(),o,l,c=0;(o=i.next())&&!o.done;){for(var u=t.entries(),d=!1,f=0;(l=u.next())&&!l.done;){if(a[f]){f++;continue}var m=o.value,h=l.value;if(r.equals(m[0],h[0],c,f,e,t,r)&&r.equals(m[1],h[1],m[0],h[0],e,t,r)){d=a[f]=!0;break}f++}if(!d)return!1;c++}return!0}var Zlt=Hg;function Jlt(e,t,r){var n=rG(e),a=n.length;if(rG(t).length!==a)return!1;for(;a-- >0;)if(!_de(e,t,r,n[a]))return!1;return!0}function Mb(e,t,r){var n=eG(e),a=n.length;if(eG(t).length!==a)return!1;for(var i,o,l;a-- >0;)if(i=n[a],!_de(e,t,r,i)||(o=tG(e,i),l=tG(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Qlt(e,t){return Hg(e.valueOf(),t.valueOf())}function ect(e,t){return e.source===t.source&&e.flags===t.flags}function sG(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var a=new Array(n),i=e.values(),o,l;(o=i.next())&&!o.done;){for(var c=t.values(),u=!1,d=0;(l=c.next())&&!l.done;){if(!a[d]&&r.equals(o.value,l.value,o.value,l.value,e,t,r)){u=a[d]=!0;break}d++}if(!u)return!1}return!0}function tct(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function rct(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 _de(e,t,r,n){return(n===Hlt||n===Wlt||n===Vlt)&&(e.$$typeof||t.$$typeof)?!0:qlt(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var nct="[object Arguments]",sct="[object Boolean]",act="[object Date]",ict="[object Error]",oct="[object Map]",lct="[object Number]",cct="[object Object]",uct="[object RegExp]",dct="[object Set]",fct="[object String]",hct="[object URL]",mct=Array.isArray,aG=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,iG=Object.assign,pct=Object.prototype.toString.call.bind(Object.prototype.toString);function gct(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,a=e.areFunctionsEqual,i=e.areMapsEqual,o=e.areNumbersEqual,l=e.areObjectsEqual,c=e.arePrimitiveWrappersEqual,u=e.areRegExpsEqual,d=e.areSetsEqual,f=e.areTypedArraysEqual,m=e.areUrlsEqual;return function(g,p,x){if(g===p)return!0;if(g==null||p==null)return!1;var v=typeof g;if(v!==typeof p)return!1;if(v!=="object")return v==="number"?o(g,p,x):v==="function"?a(g,p,x):!1;var b=g.constructor;if(b!==p.constructor)return!1;if(b===Object)return l(g,p,x);if(mct(g))return t(g,p,x);if(aG!=null&&aG(g))return f(g,p,x);if(b===Date)return r(g,p,x);if(b===RegExp)return u(g,p,x);if(b===Map)return i(g,p,x);if(b===Set)return d(g,p,x);var y=pct(g);return y===act?r(g,p,x):y===uct?u(g,p,x):y===oct?i(g,p,x):y===dct?d(g,p,x):y===cct?typeof g.then!="function"&&typeof p.then!="function"&&l(g,p,x):y===hct?m(g,p,x):y===ict?n(g,p,x):y===nct?l(g,p,x):y===sct||y===lct||y===fct?c(g,p,x):!1}}function xct(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,a={areArraysEqual:n?Mb:Glt,areDatesEqual:Klt,areErrorsEqual:Ylt,areFunctionsEqual:Xlt,areMapsEqual:n?QH(nG,Mb):nG,areNumbersEqual:Zlt,areObjectsEqual:n?Mb:Jlt,arePrimitiveWrappersEqual:Qlt,areRegExpsEqual:ect,areSetsEqual:n?QH(sG,Mb):sG,areTypedArraysEqual:n?Mb:tct,areUrlsEqual:rct};if(r&&(a=iG({},a,r(a))),t){var i=_S(a.areArraysEqual),o=_S(a.areMapsEqual),l=_S(a.areObjectsEqual),c=_S(a.areSetsEqual);a=iG({},a,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return a}function vct(e){return function(t,r,n,a,i,o,l){return e(t,r,l)}}function yct(e){var t=e.circular,r=e.comparator,n=e.createState,a=e.equals,i=e.strict;if(n)return function(c,u){var d=n(),f=d.cache,m=f===void 0?t?new WeakMap:void 0:f,h=d.meta;return r(c,u,{cache:m,equals:a,meta:h,strict:i})};if(t)return function(c,u){return r(c,u,{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,u){return r(c,u,o)}}var bct=Dp();Dp({strict:!0});Dp({circular:!0});Dp({circular:!0,strict:!0});Dp({createInternalComparator:function(){return Hg}});Dp({strict:!0,createInternalComparator:function(){return Hg}});Dp({circular:!0,createInternalComparator:function(){return Hg}});Dp({circular:!0,createInternalComparator:function(){return Hg},strict:!0});function Dp(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,a=e.createState,i=e.strict,o=i===void 0?!1:i,l=xct(e),c=gct(l),u=n?n(c):vct(c);return yct({circular:r,comparator:c,createState:a,equals:u,strict:o})}function wct(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function oG(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function a(i){r<0&&(r=i),i-r>t?(e(i),r=-1):wct(a)};requestAnimationFrame(n)}function gD(e){"@babel/helpers - typeof";return gD=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},gD(e)}function jct(e){return kct(e)||Sct(e)||Nct(e)||_ct()}function _ct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nct(e,t){if(e){if(typeof e=="string")return lG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lG(e,t)}}function lG(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Sct(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function kct(e){if(Array.isArray(e))return e}function Cct(){var e={},t=function(){return null},r=!1,n=function a(i){if(!r){if(Array.isArray(i)){if(!i.length)return;var o=i,l=jct(o),c=l[0],u=l.slice(1);if(typeof c=="number"){oG(a.bind(null,u),c);return}a(c),oG(a.bind(null,u));return}gD(i)==="object"&&(e=i,t(e)),typeof i=="function"&&i()}};return{stop:function(){r=!0},start:function(i){r=!1,n(i)},subscribe:function(i){return t=i,function(){t=function(){return null}}}}}function Z2(e){"@babel/helpers - typeof";return Z2=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},Z2(e)}function cG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function uG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cG(Object(r),!0).forEach(function(n){Nde(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Nde(e,t,r){return t=Ect(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ect(e){var t=Act(e,"string");return Z2(t)==="symbol"?t:String(t)}function Act(e,t){if(Z2(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Z2(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Tct=function(t,r){return[Object.keys(t),Object.keys(r)].reduce(function(n,a){return n.filter(function(i){return a.includes(i)})})},Pct=function(t){return t},Oct=function(t){return t.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},Ew=function(t,r){return Object.keys(r).reduce(function(n,a){return uG(uG({},n),{},Nde({},a,t(a,r[a])))},{})},dG=function(t,r,n){return t.map(function(a){return"".concat(Oct(a)," ").concat(r,"ms ").concat(n)}).join(",")};function Dct(e,t){return Lct(e)||Rct(e,t)||Sde(e,t)||Ict()}function Ict(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rct(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Lct(e){if(Array.isArray(e))return e}function Fct(e){return Bct(e)||$ct(e)||Sde(e)||Mct()}function Mct(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sde(e,t){if(e){if(typeof e=="string")return xD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xD(e,t)}}function $ct(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Bct(e){if(Array.isArray(e))return xD(e)}function xD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Q4=1e-4,kde=function(t,r){return[0,3*t,3*r-6*t,3*t-3*r+1]},Cde=function(t,r){return t.map(function(n,a){return n*Math.pow(r,a)}).reduce(function(n,a){return n+a})},fG=function(t,r){return function(n){var a=kde(t,r);return Cde(a,n)}},zct=function(t,r){return function(n){var a=kde(t,r),i=[].concat(Fct(a.map(function(o,l){return o*l}).slice(1)),[0]);return Cde(i,n)}},hG=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=r[0],i=r[1],o=r[2],l=r[3];if(r.length===1)switch(r[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=r[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var u=c[1].split(")")[0].split(",").map(function(x){return parseFloat(x)}),d=Dct(u,4);a=d[0],i=d[1],o=d[2],l=d[3]}}}var f=fG(a,o),m=fG(i,l),h=zct(a,o),g=function(v){return v>1?1:v<0?0:v},p=function(v){for(var b=v>1?1:v,y=b,N=0;N<8;++N){var _=f(y)-b,j=h(y);if(Math.abs(_-b)<Q4||j<Q4)return m(y);y=g(y-_/j)}return m(y)};return p.isStepper=!1,p},Uct=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,a=t.damping,i=a===void 0?8:a,o=t.dt,l=o===void 0?17:o,c=function(d,f,m){var h=-(d-f)*n,g=m*i,p=m+(h-g)*l/1e3,x=m*l/1e3+d;return Math.abs(x-f)<Q4&&Math.abs(p)<Q4?[f,0]:[x,p]};return c.isStepper=!0,c.dt=l,c},qct=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=r[0];if(typeof a=="string")switch(a){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return hG(a);case"spring":return Uct();default:if(a.split("(")[0]==="cubic-bezier")return hG(a)}return typeof a=="function"?a:null};function J2(e){"@babel/helpers - typeof";return J2=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},J2(e)}function mG(e){return Hct(e)||Wct(e)||Ede(e)||Vct()}function Vct(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wct(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Hct(e){if(Array.isArray(e))return yD(e)}function pG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Vi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?pG(Object(r),!0).forEach(function(n){vD(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vD(e,t,r){return t=Gct(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gct(e){var t=Kct(e,"string");return J2(t)==="symbol"?t:String(t)}function Kct(e,t){if(J2(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(J2(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yct(e,t){return Jct(e)||Zct(e,t)||Ede(e,t)||Xct()}function Xct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ede(e,t){if(e){if(typeof e=="string")return yD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yD(e,t)}}function yD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Zct(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Jct(e){if(Array.isArray(e))return e}var ek=function(t,r,n){return t+(r-t)*n},bD=function(t){var r=t.from,n=t.to;return r!==n},Qct=function e(t,r,n){var a=Ew(function(i,o){if(bD(o)){var l=t(o.from,o.to,o.velocity),c=Yct(l,2),u=c[0],d=c[1];return Vi(Vi({},o),{},{from:u,velocity:d})}return o},r);return n<1?Ew(function(i,o){return bD(o)?Vi(Vi({},o),{},{velocity:ek(o.velocity,a[i].velocity,n),from:ek(o.from,a[i].from,n)}):o},r):e(t,a,n-1)};const eut=function(e,t,r,n,a){var i=Tct(e,t),o=i.reduce(function(x,v){return Vi(Vi({},x),{},vD({},v,[e[v],t[v]]))},{}),l=i.reduce(function(x,v){return Vi(Vi({},x),{},vD({},v,{from:e[v],velocity:0,to:t[v]}))},{}),c=-1,u,d,f=function(){return null},m=function(){return Ew(function(v,b){return b.from},l)},h=function(){return!Object.values(l).filter(bD).length},g=function(v){u||(u=v);var b=v-u,y=b/r.dt;l=Qct(r,l,y),a(Vi(Vi(Vi({},e),t),m())),u=v,h()||(c=requestAnimationFrame(f))},p=function(v){d||(d=v);var b=(v-d)/n,y=Ew(function(_,j){return ek.apply(void 0,mG(j).concat([r(b)]))},o);if(a(Vi(Vi(Vi({},e),t),y)),b<1)c=requestAnimationFrame(f);else{var N=Ew(function(_,j){return ek.apply(void 0,mG(j).concat([r(1)]))},o);a(Vi(Vi(Vi({},e),t),N))}};return f=r.isStepper?g:p,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(c)}}};function wy(e){"@babel/helpers - typeof";return wy=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},wy(e)}var tut=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function rut(e,t){if(e==null)return{};var r=nut(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nut(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,i;for(i=0;i<n.length;i++)a=n[i],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}function pP(e){return out(e)||iut(e)||aut(e)||sut()}function sut(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aut(e,t){if(e){if(typeof e=="string")return wD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wD(e,t)}}function iut(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function out(e){if(Array.isArray(e))return wD(e)}function wD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ju(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gG(Object(r),!0).forEach(function(n){Yb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Yb(e,t,r){return t=Ade(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lut(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cut(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ade(n.key),n)}}function uut(e,t,r){return t&&cut(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ade(e){var t=dut(e,"string");return wy(t)==="symbol"?t:String(t)}function dut(e,t){if(wy(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(wy(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fut(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&&jD(e,t)}function jD(e,t){return jD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},jD(e,t)}function hut(e){var t=mut();return function(){var n=tk(e),a;if(t){var i=tk(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return _D(this,a)}}function _D(e,t){if(t&&(wy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ND(e)}function ND(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mut(){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 tk(e){return tk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tk(e)}var ef=function(e){fut(r,e);var t=hut(r);function r(n,a){var i;lut(this,r),i=t.call(this,n,a);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,m=o.children,h=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(ND(i)),i.changeStyle=i.changeStyle.bind(ND(i)),!l||h<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:d}),_D(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof m=="function")return i.state={style:u},_D(i);i.state={style:c?Yb({},c,u):u}}else i.state={style:{}};return i}return uut(r,[{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,u=i.shouldReAnimate,d=i.to,f=i.from,m=this.state.style;if(l){if(!o){var h={style:c?Yb({},c,d):d};this.state&&m&&(c&&m[c]!==d||!c&&m!==d)&&this.setState(h);return}if(!(bct(a.to,d)&&a.canBegin&&a.isActive)){var g=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var p=g||u?f:a.to;if(this.state&&m){var x={style:c?Yb({},c,p):p};(c&&m[c]!==p||!c&&m!==p)&&this.setState(x)}this.runAnimation(ju(ju({},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,u=a.easing,d=a.begin,f=a.onAnimationEnd,m=a.onAnimationStart,h=eut(o,l,qct(u),c,this.changeStyle),g=function(){i.stopJSAnimation=h()};this.manager.start([m,d,g,c,f])}},{key:"runStepAnimation",value:function(a){var i=this,o=a.steps,l=a.begin,c=a.onAnimationStart,u=o[0],d=u.style,f=u.duration,m=f===void 0?0:f,h=function(p,x,v){if(v===0)return p;var b=x.duration,y=x.easing,N=y===void 0?"ease":y,_=x.style,j=x.properties,S=x.onAnimationEnd,I=v>0?o[v-1]:x,P=j||Object.keys(_);if(typeof N=="function"||N==="spring")return[].concat(pP(p),[i.runJSAnimation.bind(i,{from:I.style,to:_,duration:b,easing:N}),b]);var F=dG(P,b,N),T=ju(ju(ju({},I.style),_),{},{transition:F});return[].concat(pP(p),[T,b,S]).filter(Pct)};return this.manager.start([c].concat(pP(o.reduce(h,[d,Math.max(m,l)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=Cct());var i=a.begin,o=a.duration,l=a.attributeName,c=a.to,u=a.easing,d=a.onAnimationStart,f=a.onAnimationEnd,m=a.steps,h=a.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof h=="function"||u==="spring"){this.runJSAnimation(a);return}if(m.length>1){this.runStepAnimation(a);return}var p=l?Yb({},l,c):c,x=dG(Object.keys(p),o,u);g.start([d,i,ju(ju({},p),{},{transition:x}),o,f])}},{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=rut(a,tut),u=w.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||o<=0)return i;var f=function(h){var g=h.props,p=g.style,x=p===void 0?{}:p,v=g.className,b=w.cloneElement(h,ju(ju({},c),{},{style:ju(ju({},x),d),className:v}));return b};return u===1?f(w.Children.only(i)):be.createElement("div",null,w.Children.map(i,function(m){return f(m)}))}}]),r}(w.PureComponent);ef.displayName="Animate";ef.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};ef.propTypes={from:br.oneOfType([br.object,br.string]),to:br.oneOfType([br.object,br.string]),attributeName:br.string,duration:br.number,begin:br.number,easing:br.oneOfType([br.string,br.func]),steps:br.arrayOf(br.shape({duration:br.number.isRequired,style:br.object.isRequired,easing:br.oneOfType([br.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),br.func]),properties:br.arrayOf("string"),onAnimationEnd:br.func})),children:br.oneOfType([br.node,br.func]),isActive:br.bool,canBegin:br.bool,onAnimationEnd:br.func,shouldReAnimate:br.bool,onAnimationStart:br.func,onAnimationReStart:br.func};function Q2(e){"@babel/helpers - typeof";return Q2=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},Q2(e)}function rk(){return rk=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rk.apply(this,arguments)}function put(e,t){return yut(e)||vut(e,t)||xut(e,t)||gut()}function gut(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xut(e,t){if(e){if(typeof e=="string")return xG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xG(e,t)}}function xG(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function vut(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function yut(e){if(Array.isArray(e))return e}function vG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function yG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vG(Object(r),!0).forEach(function(n){but(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function but(e,t,r){return t=wut(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wut(e){var t=jut(e,"string");return Q2(t)=="symbol"?t:t+""}function jut(e,t){if(Q2(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Q2(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var bG=function(t,r,n,a,i){var o=Math.min(Math.abs(n)/2,Math.abs(a)/2),l=a>=0?1:-1,c=n>=0?1:-1,u=a>=0&&n>=0||a<0&&n<0?1:0,d;if(o>0&&i instanceof Array){for(var f=[0,0,0,0],m=0,h=4;m<h;m++)f[m]=i[m]>o?o:i[m];d="M".concat(t,",").concat(r+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(r)),d+="L ".concat(t+n-c*f[1],",").concat(r),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`,
`).concat(t+n,",").concat(r+l*f[1])),d+="L ".concat(t+n,",").concat(r+a-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`,
`).concat(t+n-c*f[2],",").concat(r+a)),d+="L ".concat(t+c*f[3],",").concat(r+a),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`,
`).concat(t,",").concat(r+a-l*f[3])),d+="Z"}else if(o>0&&i===+i&&i>0){var g=Math.min(o,i);d="M ".concat(t,",").concat(r+l*g,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+c*g,",").concat(r,`
L `).concat(t+n-c*g,",").concat(r,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+n,",").concat(r+l*g,`
L `).concat(t+n,",").concat(r+a-l*g,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+n-c*g,",").concat(r+a,`
L `).concat(t+c*g,",").concat(r+a,`
A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t,",").concat(r+a-l*g," Z")}else d="M ".concat(t,",").concat(r," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return d},_ut=function(t,r){if(!t||!r)return!1;var n=t.x,a=t.y,i=r.x,o=r.y,l=r.width,c=r.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),f=Math.min(o,o+c),m=Math.max(o,o+c);return n>=u&&n<=d&&a>=f&&a<=m}return!1},Nut={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},bM=function(t){var r=yG(yG({},Nut),t),n=w.useRef(),a=w.useState(-1),i=put(a,2),o=i[0],l=i[1];w.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var N=n.current.getTotalLength();N&&l(N)}catch{}},[]);var c=r.x,u=r.y,d=r.width,f=r.height,m=r.radius,h=r.className,g=r.animationEasing,p=r.animationDuration,x=r.animationBegin,v=r.isAnimationActive,b=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var y=en("recharts-rectangle",h);return b?be.createElement(ef,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:p,animationEasing:g,isActive:b},function(N){var _=N.width,j=N.height,S=N.x,I=N.y;return be.createElement(ef,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:p,isActive:v,easing:g},be.createElement("path",rk({},Sr(r,!0),{className:y,d:bG(S,I,_,j,m),ref:n})))}):be.createElement("path",rk({},Sr(r,!0),{className:y,d:bG(c,u,d,f,m)}))},Sut=["points","className","baseLinePoints","connectNulls"];function nv(){return nv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nv.apply(this,arguments)}function kut(e,t){if(e==null)return{};var r=Cut(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cut(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function wG(e){return Put(e)||Tut(e)||Aut(e)||Eut()}function Eut(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Aut(e,t){if(e){if(typeof e=="string")return SD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return SD(e,t)}}function Tut(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Put(e){if(Array.isArray(e))return SD(e)}function SD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var jG=function(t){return t&&t.x===+t.x&&t.y===+t.y},Out=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return t.forEach(function(n){jG(n)?r[r.length-1].push(n):r[r.length-1].length>0&&r.push([])}),jG(t[0])&&r[r.length-1].push(t[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},Aw=function(t,r){var n=Out(t);r&&(n=[n.reduce(function(i,o){return[].concat(wG(i),wG(o))},[])]);var a=n.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 n.length===1?"".concat(a,"Z"):a},Dut=function(t,r,n){var a=Aw(t,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(Aw(r.reverse(),n).slice(1))},Iut=function(t){var r=t.points,n=t.className,a=t.baseLinePoints,i=t.connectNulls,o=kut(t,Sut);if(!r||!r.length)return null;var l=en("recharts-polygon",n);if(a&&a.length){var c=o.stroke&&o.stroke!=="none",u=Dut(r,a,i);return be.createElement("g",{className:l},be.createElement("path",nv({},Sr(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?be.createElement("path",nv({},Sr(o,!0),{fill:"none",d:Aw(r,i)})):null,c?be.createElement("path",nv({},Sr(o,!0),{fill:"none",d:Aw(a,i)})):null)}var d=Aw(r,i);return be.createElement("path",nv({},Sr(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function kD(){return kD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},kD.apply(this,arguments)}var qE=function(t){var r=t.cx,n=t.cy,a=t.r,i=t.className,o=en("recharts-dot",i);return r===+r&&n===+n&&a===+a?w.createElement("circle",kD({},Sr(t,!1),w4(t),{className:o,cx:r,cy:n,r:a})):null};function ej(e){"@babel/helpers - typeof";return ej=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},ej(e)}var Rut=["x","y","top","left","width","height","className"];function CD(){return CD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},CD.apply(this,arguments)}function _G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Lut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?_G(Object(r),!0).forEach(function(n){Fut(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_G(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fut(e,t,r){return t=Mut(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mut(e){var t=$ut(e,"string");return ej(t)=="symbol"?t:t+""}function $ut(e,t){if(ej(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ej(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function But(e,t){if(e==null)return{};var r=zut(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function zut(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Uut=function(t,r,n,a,i,o){return"M".concat(t,",").concat(i,"v").concat(a,"M").concat(o,",").concat(r,"h").concat(n)},qut=function(t){var r=t.x,n=r===void 0?0:r,a=t.y,i=a===void 0?0:a,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,m=t.height,h=m===void 0?0:m,g=t.className,p=But(t,Rut),x=Lut({x:n,y:i,top:l,left:u,width:f,height:h},p);return!Dt(n)||!Dt(i)||!Dt(f)||!Dt(h)||!Dt(l)||!Dt(u)?null:be.createElement("path",CD({},Sr(x,!0),{className:en("recharts-cross",g),d:Uut(n,i,f,h,l,u)}))},Vut=ME,Wut=Vue,Hut=cf;function Gut(e,t){return e&&e.length?Vut(e,Hut(t),Wut):void 0}var Kut=Gut;const Yut=jn(Kut);var Xut=ME,Zut=cf,Jut=Wue;function Qut(e,t){return e&&e.length?Xut(e,Zut(t),Jut):void 0}var edt=Qut;const tdt=jn(edt);var rdt=["cx","cy","angle","ticks","axisLine"],ndt=["ticks","tick","angle","tickFormatter","stroke"];function jy(e){"@babel/helpers - typeof";return jy=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},jy(e)}function Tw(){return Tw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tw.apply(this,arguments)}function NG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function t0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?NG(Object(r),!0).forEach(function(n){VE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function SG(e,t){if(e==null)return{};var r=sdt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function sdt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function adt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kG(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Pde(n.key),n)}}function idt(e,t,r){return t&&kG(e.prototype,t),r&&kG(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function odt(e,t,r){return t=nk(t),ldt(e,Tde()?Reflect.construct(t,r||[],nk(e).constructor):t.apply(e,r))}function ldt(e,t){if(t&&(jy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cdt(e)}function cdt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Tde=function(){return!!e})()}function nk(e){return nk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},nk(e)}function udt(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&&ED(e,t)}function ED(e,t){return ED=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},ED(e,t)}function VE(e,t,r){return t=Pde(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pde(e){var t=ddt(e,"string");return jy(t)=="symbol"?t:t+""}function ddt(e,t){if(jy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(jy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var WE=function(e){function t(){return adt(this,t),odt(this,t,arguments)}return udt(t,e),idt(t,[{key:"getTickValueCoord",value:function(n){var a=n.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return As(l,c,a,o)}},{key:"getTickTextAnchor",value:function(){var n=this.props.orientation,a;switch(n){case"left":a="end";break;case"right":a="start";break;default:a="middle";break}return a}},{key:"getViewBox",value:function(){var n=this.props,a=n.cx,i=n.cy,o=n.angle,l=n.ticks,c=Yut(l,function(d){return d.coordinate||0}),u=tdt(l,function(d){return d.coordinate||0});return{cx:a,cy:i,startAngle:o,endAngle:o,innerRadius:u.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,o=n.angle,l=n.ticks,c=n.axisLine,u=SG(n,rdt),d=l.reduce(function(g,p){return[Math.min(g[0],p.coordinate),Math.max(g[1],p.coordinate)]},[1/0,-1/0]),f=As(a,i,d[0],o),m=As(a,i,d[1],o),h=t0(t0(t0({},Sr(u,!1)),{},{fill:"none"},Sr(c,!1)),{},{x1:f.x,y1:f.y,x2:m.x,y2:m.y});return be.createElement("line",Tw({className:"recharts-polar-radius-axis-line"},h))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,o=a.tick,l=a.angle,c=a.tickFormatter,u=a.stroke,d=SG(a,ndt),f=this.getTickTextAnchor(),m=Sr(d,!1),h=Sr(o,!1),g=i.map(function(p,x){var v=n.getTickValueCoord(p),b=t0(t0(t0(t0({textAnchor:f,transform:"rotate(".concat(90-l,", ").concat(v.x,", ").concat(v.y,")")},m),{},{stroke:"none",fill:u},h),{},{index:x},v),{},{payload:p});return be.createElement(Ln,Tw({className:en("recharts-polar-radius-axis-tick",yde(o)),key:"tick-".concat(p.coordinate)},xg(n.props,p,x)),t.renderTickItem(o,b,c?c(p.value,x):p.value))});return be.createElement(Ln,{className:"recharts-polar-radius-axis-ticks"},g)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.axisLine,o=n.tick;return!a||!a.length?null:be.createElement(Ln,{className:en("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),Ci.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(n,a,i){var o;return be.isValidElement(n)?o=be.cloneElement(n,a):Mr(n)?o=n(a):o=be.createElement(vg,Tw({},a,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(w.PureComponent);VE(WE,"displayName","PolarRadiusAxis");VE(WE,"axisType","radiusAxis");VE(WE,"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 _y(e){"@babel/helpers - typeof";return _y=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},_y(e)}function g0(){return g0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g0.apply(this,arguments)}function CG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function r0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?CG(Object(r),!0).forEach(function(n){HE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fdt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function EG(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Dde(n.key),n)}}function hdt(e,t,r){return t&&EG(e.prototype,t),r&&EG(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function mdt(e,t,r){return t=sk(t),pdt(e,Ode()?Reflect.construct(t,r||[],sk(e).constructor):t.apply(e,r))}function pdt(e,t){if(t&&(_y(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gdt(e)}function gdt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ode(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ode=function(){return!!e})()}function sk(e){return sk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sk(e)}function xdt(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&&AD(e,t)}function AD(e,t){return AD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},AD(e,t)}function HE(e,t,r){return t=Dde(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dde(e){var t=vdt(e,"string");return _y(t)=="symbol"?t:t+""}function vdt(e,t){if(_y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(_y(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ydt=Math.PI/180,AG=1e-5,GE=function(e){function t(){return fdt(this,t),mdt(this,t,arguments)}return xdt(t,e),hdt(t,[{key:"getTickLineCoord",value:function(n){var a=this.props,i=a.cx,o=a.cy,l=a.radius,c=a.orientation,u=a.tickSize,d=u||8,f=As(i,o,l,n.coordinate),m=As(i,o,l+(c==="inner"?-1:1)*d,n.coordinate);return{x1:f.x,y1:f.y,x2:m.x,y2:m.y}}},{key:"getTickTextAnchor",value:function(n){var a=this.props.orientation,i=Math.cos(-n.coordinate*ydt),o;return i>AG?o=a==="outer"?"start":"end":i<-AG?o=a==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,i=n.cy,o=n.radius,l=n.axisLine,c=n.axisLineType,u=r0(r0({},Sr(this.props,!1)),{},{fill:"none"},Sr(l,!1));if(c==="circle")return be.createElement(qE,g0({className:"recharts-polar-angle-axis-line"},u,{cx:a,cy:i,r:o}));var d=this.props.ticks,f=d.map(function(m){return As(a,i,o,m.coordinate)});return be.createElement(Iut,g0({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,i=a.ticks,o=a.tick,l=a.tickLine,c=a.tickFormatter,u=a.stroke,d=Sr(this.props,!1),f=Sr(o,!1),m=r0(r0({},d),{},{fill:"none"},Sr(l,!1)),h=i.map(function(g,p){var x=n.getTickLineCoord(g),v=n.getTickTextAnchor(g),b=r0(r0(r0({textAnchor:v},d),{},{stroke:"none",fill:u},f),{},{index:p,payload:g,x:x.x2,y:x.y2});return be.createElement(Ln,g0({className:en("recharts-polar-angle-axis-tick",yde(o)),key:"tick-".concat(g.coordinate)},xg(n.props,g,p)),l&&be.createElement("line",g0({className:"recharts-polar-angle-axis-tick-line"},m,x)),o&&t.renderTickItem(o,b,c?c(g.value,p):g.value))});return be.createElement(Ln,{className:"recharts-polar-angle-axis-ticks"},h)}},{key:"render",value:function(){var n=this.props,a=n.ticks,i=n.radius,o=n.axisLine;return i<=0||!a||!a.length?null:be.createElement(Ln,{className:en("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,i){var o;return be.isValidElement(n)?o=be.cloneElement(n,a):Mr(n)?o=n(a):o=be.createElement(vg,g0({},a,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(w.PureComponent);HE(GE,"displayName","PolarAngleAxis");HE(GE,"axisType","angleAxis");HE(GE,"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 bdt=Bce,wdt=bdt(Object.getPrototypeOf,Object),jdt=wdt,_dt=_h,Ndt=jdt,Sdt=Nh,kdt="[object Object]",Cdt=Function.prototype,Edt=Object.prototype,Ide=Cdt.toString,Adt=Edt.hasOwnProperty,Tdt=Ide.call(Object);function Pdt(e){if(!Sdt(e)||_dt(e)!=kdt)return!1;var t=Ndt(e);if(t===null)return!0;var r=Adt.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Ide.call(r)==Tdt}var Odt=Pdt;const Ddt=jn(Odt);var Idt=_h,Rdt=Nh,Ldt="[object Boolean]";function Fdt(e){return e===!0||e===!1||Rdt(e)&&Idt(e)==Ldt}var Mdt=Fdt;const $dt=jn(Mdt);function tj(e){"@babel/helpers - typeof";return tj=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},tj(e)}function ak(){return ak=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ak.apply(this,arguments)}function Bdt(e,t){return Vdt(e)||qdt(e,t)||Udt(e,t)||zdt()}function zdt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Udt(e,t){if(e){if(typeof e=="string")return TG(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return TG(e,t)}}function TG(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function qdt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Vdt(e){if(Array.isArray(e))return e}function PG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function OG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PG(Object(r),!0).forEach(function(n){Wdt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wdt(e,t,r){return t=Hdt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hdt(e){var t=Gdt(e,"string");return tj(t)=="symbol"?t:t+""}function Gdt(e,t){if(tj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(tj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var DG=function(t,r,n,a,i){var o=n-a,l;return l="M ".concat(t,",").concat(r),l+="L ".concat(t+n,",").concat(r),l+="L ".concat(t+n-o/2,",").concat(r+i),l+="L ".concat(t+n-o/2-a,",").concat(r+i),l+="L ".concat(t,",").concat(r," Z"),l},Kdt={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Ydt=function(t){var r=OG(OG({},Kdt),t),n=w.useRef(),a=w.useState(-1),i=Bdt(a,2),o=i[0],l=i[1];w.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var y=n.current.getTotalLength();y&&l(y)}catch{}},[]);var c=r.x,u=r.y,d=r.upperWidth,f=r.lowerWidth,m=r.height,h=r.className,g=r.animationEasing,p=r.animationDuration,x=r.animationBegin,v=r.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||m!==+m||d===0&&f===0||m===0)return null;var b=en("recharts-trapezoid",h);return v?be.createElement(ef,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:m,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:m,x:c,y:u},duration:p,animationEasing:g,isActive:v},function(y){var N=y.upperWidth,_=y.lowerWidth,j=y.height,S=y.x,I=y.y;return be.createElement(ef,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:p,easing:g},be.createElement("path",ak({},Sr(r,!0),{className:b,d:DG(S,I,N,_,j),ref:n})))}):be.createElement("g",null,be.createElement("path",ak({},Sr(r,!0),{className:b,d:DG(c,u,d,f,m)})))},Xdt=["option","shapeType","propTransformer","activeClassName","isActive"];function rj(e){"@babel/helpers - typeof";return rj=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},rj(e)}function Zdt(e,t){if(e==null)return{};var r=Jdt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Jdt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function IG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ik(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?IG(Object(r),!0).forEach(function(n){Qdt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):IG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qdt(e,t,r){return t=eft(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eft(e){var t=tft(e,"string");return rj(t)=="symbol"?t:t+""}function tft(e,t){if(rj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(rj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rft(e,t){return ik(ik({},t),e)}function nft(e,t){return e==="symbols"}function RG(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return be.createElement(bM,r);case"trapezoid":return be.createElement(Ydt,r);case"sector":return be.createElement(jde,r);case"symbols":if(nft(t))return be.createElement($F,r);break;default:return null}}function sft(e){return w.isValidElement(e)?e.props:e}function Rde(e){var t=e.option,r=e.shapeType,n=e.propTransformer,a=n===void 0?rft:n,i=e.activeClassName,o=i===void 0?"recharts-active-shape":i,l=e.isActive,c=Zdt(e,Xdt),u;if(w.isValidElement(t))u=w.cloneElement(t,ik(ik({},c),sft(t)));else if(Mr(t))u=t(c);else if(Ddt(t)&&!$dt(t)){var d=a(t,c);u=be.createElement(RG,{shapeType:r,elementProps:d})}else{var f=c;u=be.createElement(RG,{shapeType:r,elementProps:f})}return l?be.createElement(Ln,{className:o},u):u}function KE(e,t){return t!=null&&"trapezoids"in e.props}function YE(e,t){return t!=null&&"sectors"in e.props}function nj(e,t){return t!=null&&"points"in e.props}function aft(e,t){var r,n,a=e.x===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.x)||e.x===t.x,i=e.y===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.y)||e.y===t.y;return a&&i}function ift(e,t){var r=e.endAngle===t.endAngle,n=e.startAngle===t.startAngle;return r&&n}function oft(e,t){var r=e.x===t.x,n=e.y===t.y,a=e.z===t.z;return r&&n&&a}function lft(e,t){var r;return KE(e,t)?r=aft:YE(e,t)?r=ift:nj(e,t)&&(r=oft),r}function cft(e,t){var r;return KE(e,t)?r="trapezoids":YE(e,t)?r="sectors":nj(e,t)&&(r="points"),r}function uft(e,t){if(KE(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(YE(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return nj(e,t)?t.payload:{}}function dft(e){var t=e.activeTooltipItem,r=e.graphicalItem,n=e.itemData,a=cft(r,t),i=uft(r,t),o=n.filter(function(c,u){var d=x_(i,c),f=r.props[a].filter(function(g){var p=lft(r,t);return p(g,t)}),m=r.props[a].indexOf(f[f.length-1]),h=u===m;return d&&h}),l=n.indexOf(o[o.length-1]);return l}var h5;function Ny(e){"@babel/helpers - typeof";return Ny=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},Ny(e)}function sv(){return sv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sv.apply(this,arguments)}function LG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?LG(Object(r),!0).forEach(function(n){Lc(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FG(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Fde(n.key),n)}}function hft(e,t,r){return t&&FG(e.prototype,t),r&&FG(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function mft(e,t,r){return t=ok(t),pft(e,Lde()?Reflect.construct(t,r||[],ok(e).constructor):t.apply(e,r))}function pft(e,t){if(t&&(Ny(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gft(e)}function gft(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lde=function(){return!!e})()}function ok(e){return ok=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ok(e)}function xft(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&&TD(e,t)}function TD(e,t){return TD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},TD(e,t)}function Lc(e,t,r){return t=Fde(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fde(e){var t=vft(e,"string");return Ny(t)=="symbol"?t:t+""}function vft(e,t){if(Ny(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ny(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var uf=function(e){function t(r){var n;return fft(this,t),n=mft(this,t,[r]),Lc(n,"pieRef",null),Lc(n,"sectorRefs",[]),Lc(n,"id",_1("recharts-pie-")),Lc(n,"handleAnimationEnd",function(){var a=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Mr(a)&&a()}),Lc(n,"handleAnimationStart",function(){var a=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Mr(a)&&a()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return xft(t,e),hft(t,[{key:"isActiveIndex",value:function(n){var a=this.props.activeIndex;return Array.isArray(a)?a.indexOf(n)!==-1:n===a}},{key:"hasActiveIndex",value:function(){var n=this.props.activeIndex;return Array.isArray(n)?n.length!==0:n||n===0}},{key:"renderLabels",value:function(n){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.label,l=i.labelLine,c=i.dataKey,u=i.valueKey,d=Sr(this.props,!1),f=Sr(o,!1),m=Sr(l,!1),h=o&&o.offsetRadius||20,g=n.map(function(p,x){var v=(p.startAngle+p.endAngle)/2,b=As(p.cx,p.cy,p.outerRadius+h,v),y=_s(_s(_s(_s({},d),p),{},{stroke:"none"},f),{},{index:x,textAnchor:t.getTextAnchor(b.x,p.cx)},b),N=_s(_s(_s(_s({},d),p),{},{fill:"none",stroke:p.fill},m),{},{index:x,points:[As(p.cx,p.cy,p.outerRadius,v),b]}),_=c;return Xr(c)&&Xr(u)?_="value":Xr(c)&&(_=u),be.createElement(Ln,{key:"label-".concat(p.startAngle,"-").concat(p.endAngle,"-").concat(p.midAngle,"-").concat(x)},l&&t.renderLabelLineItem(l,N,"line"),t.renderLabelItem(o,y,hi(p,_)))});return be.createElement(Ln,{className:"recharts-pie-labels"},g)}},{key:"renderSectorsStatically",value:function(n){var a=this,i=this.props,o=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return n.map(function(u,d){if((u==null?void 0:u.startAngle)===0&&(u==null?void 0:u.endAngle)===0&&n.length!==1)return null;var f=a.isActiveIndex(d),m=c&&a.hasActiveIndex()?c:null,h=f?o:m,g=_s(_s({},u),{},{stroke:l?u.fill:u.stroke,tabIndex:-1});return be.createElement(Ln,sv({ref:function(x){x&&!a.sectorRefs.includes(x)&&a.sectorRefs.push(x)},tabIndex:-1,className:"recharts-pie-sector"},xg(a.props,u,d),{key:"sector-".concat(u==null?void 0:u.startAngle,"-").concat(u==null?void 0:u.endAngle,"-").concat(u.midAngle,"-").concat(d)}),be.createElement(Rde,sv({option:h,isActive:f,shapeType:"sector"},g)))})}},{key:"renderSectorsWithAnimation",value:function(){var n=this,a=this.props,i=a.sectors,o=a.isAnimationActive,l=a.animationBegin,c=a.animationDuration,u=a.animationEasing,d=a.animationId,f=this.state,m=f.prevSectors,h=f.prevIsAnimationActive;return be.createElement(ef,{begin:l,duration:c,isActive:o,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(d,"-").concat(h),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(g){var p=g.t,x=[],v=i&&i[0],b=v.startAngle;return i.forEach(function(y,N){var _=m&&m[N],j=N>0?Ql(y,"paddingAngle",0):0;if(_){var S=Bl(_.endAngle-_.startAngle,y.endAngle-y.startAngle),I=_s(_s({},y),{},{startAngle:b+j,endAngle:b+S(p)+j});x.push(I),b=I.endAngle}else{var P=y.endAngle,F=y.startAngle,T=Bl(0,P-F),k=T(p),V=_s(_s({},y),{},{startAngle:b+j,endAngle:b+k+j});x.push(V),b=V.endAngle}}),be.createElement(Ln,null,n.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.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 n=this.props,a=n.sectors,i=n.isAnimationActive,o=this.state.prevSectors;return i&&a&&a.length&&(!o||!x_(o,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,a=this.props,i=a.hide,o=a.sectors,l=a.className,c=a.label,u=a.cx,d=a.cy,f=a.innerRadius,m=a.outerRadius,h=a.isAnimationActive,g=this.state.isAnimationFinished;if(i||!o||!o.length||!Dt(u)||!Dt(d)||!Dt(f)||!Dt(m))return null;var p=en("recharts-pie",l);return be.createElement(Ln,{tabIndex:this.props.rootTabIndex,className:p,ref:function(v){n.pieRef=v}},this.renderSectors(),c&&this.renderLabels(o),Ci.renderCallByParent(this.props,null,!1),(!h||g)&&th.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return a.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:n.sectors!==a.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,a){return n>a?"start":n<a?"end":"middle"}},{key:"renderLabelLineItem",value:function(n,a,i){if(be.isValidElement(n))return be.cloneElement(n,a);if(Mr(n))return n(a);var o=en("recharts-pie-label-line",typeof n!="boolean"?n.className:"");return be.createElement(J4,sv({},a,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(n,a,i){if(be.isValidElement(n))return be.cloneElement(n,a);var o=i;if(Mr(n)&&(o=n(a),be.isValidElement(o)))return o;var l=en("recharts-pie-label-text",typeof n!="boolean"&&!Mr(n)?n.className:"");return be.createElement(vg,sv({},a,{alignmentBaseline:"middle",className:l}),o)}}])}(w.PureComponent);h5=uf;Lc(uf,"displayName","Pie");Lc(uf,"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:!qg.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Lc(uf,"parseDeltaAngle",function(e,t){var r=Fo(t-e),n=Math.min(Math.abs(t-e),360);return r*n});Lc(uf,"getRealPieData",function(e){var t=e.data,r=e.children,n=Sr(e,!1),a=ec(r,f_);return t&&t.length?t.map(function(i,o){return _s(_s(_s({payload:i},n),i),a&&a[o]&&a[o].props)}):a&&a.length?a.map(function(i){return _s(_s({},n),i.props)}):[]});Lc(uf,"parseCoordinateOfPie",function(e,t){var r=t.top,n=t.left,a=t.width,i=t.height,o=vde(a,i),l=n+Mo(e.cx,a,a/2),c=r+Mo(e.cy,i,i/2),u=Mo(e.innerRadius,o,0),d=Mo(e.outerRadius,o,o*.8),f=e.maxRadius||Math.sqrt(a*a+i*i)/2;return{cx:l,cy:c,innerRadius:u,outerRadius:d,maxRadius:f}});Lc(uf,"getComposedData",function(e){var t=e.item,r=e.offset,n=t.type.defaultProps!==void 0?_s(_s({},t.type.defaultProps),t.props):t.props,a=h5.getRealPieData(n);if(!a||!a.length)return null;var i=n.cornerRadius,o=n.startAngle,l=n.endAngle,c=n.paddingAngle,u=n.dataKey,d=n.nameKey,f=n.valueKey,m=n.tooltipType,h=Math.abs(n.minAngle),g=h5.parseCoordinateOfPie(n,r),p=h5.parseDeltaAngle(o,l),x=Math.abs(p),v=u;Xr(u)&&Xr(f)?(Hu(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),v="value"):Xr(u)&&(Hu(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),v=f);var b=a.filter(function(I){return hi(I,v,0)!==0}).length,y=(x>=360?b:b-1)*c,N=x-b*h-y,_=a.reduce(function(I,P){var F=hi(P,v,0);return I+(Dt(F)?F:0)},0),j;if(_>0){var S;j=a.map(function(I,P){var F=hi(I,v,0),T=hi(I,d,P),k=(Dt(F)?F:0)/_,V;P?V=S.endAngle+Fo(p)*c*(F!==0?1:0):V=o;var C=V+Fo(p)*((F!==0?h:0)+k*N),R=(V+C)/2,H=(g.innerRadius+g.outerRadius)/2,q=[{name:T,value:F,payload:I,dataKey:v,type:m}],L=As(g.cx,g.cy,H,R);return S=_s(_s(_s({percent:k,cornerRadius:i,name:T,tooltipPayload:q,midAngle:R,middleRadius:H,tooltipPosition:L},I),g),{},{value:hi(I,v),startAngle:V,endAngle:C,payload:I,paddingAngle:Fo(p)*c}),S})}return _s(_s({},g),{},{sectors:j,data:a})});var yft=Math.ceil,bft=Math.max;function wft(e,t,r,n){for(var a=-1,i=bft(yft((t-e)/(r||1)),0),o=Array(i);i--;)o[n?i:++a]=e,e+=r;return o}var jft=wft,_ft=aue,MG=1/0,Nft=17976931348623157e292;function Sft(e){if(!e)return e===0?e:0;if(e=_ft(e),e===MG||e===-MG){var t=e<0?-1:1;return t*Nft}return e===e?e:0}var Mde=Sft,kft=jft,Cft=PE,gP=Mde;function Eft(e){return function(t,r,n){return n&&typeof n!="number"&&Cft(t,r,n)&&(r=n=void 0),t=gP(t),r===void 0?(r=t,t=0):r=gP(r),n=n===void 0?t<r?1:-1:gP(n),kft(t,r,n,e)}}var Aft=Eft,Tft=Aft,Pft=Tft(),Oft=Pft;const lk=jn(Oft);function sj(e){"@babel/helpers - typeof";return sj=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},sj(e)}function $G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function BG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$G(Object(r),!0).forEach(function(n){$de(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$G(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $de(e,t,r){return t=Dft(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dft(e){var t=Ift(e,"string");return sj(t)=="symbol"?t:t+""}function Ift(e,t){if(sj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(sj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rft=["Webkit","Moz","O","ms"],Lft=function(t,r){var n=t.replace(/(\w)/,function(i){return i.toUpperCase()}),a=Rft.reduce(function(i,o){return BG(BG({},i),{},$de({},o+n,r))},{});return a[t]=r,a};function Sy(e){"@babel/helpers - typeof";return Sy=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},Sy(e)}function ck(){return ck=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ck.apply(this,arguments)}function zG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function xP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zG(Object(r),!0).forEach(function(n){Rl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fft(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function UG(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,zde(n.key),n)}}function Mft(e,t,r){return t&&UG(e.prototype,t),r&&UG(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $ft(e,t,r){return t=uk(t),Bft(e,Bde()?Reflect.construct(t,r||[],uk(e).constructor):t.apply(e,r))}function Bft(e,t){if(t&&(Sy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zft(e)}function zft(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Bde=function(){return!!e})()}function uk(e){return uk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},uk(e)}function Uft(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&&PD(e,t)}function PD(e,t){return PD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},PD(e,t)}function Rl(e,t,r){return t=zde(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zde(e){var t=qft(e,"string");return Sy(t)=="symbol"?t:t+""}function qft(e,t){if(Sy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Sy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Vft=function(t){var r=t.data,n=t.startIndex,a=t.endIndex,i=t.x,o=t.width,l=t.travellerWidth;if(!r||!r.length)return{};var c=r.length,u=kw().domain(lk(0,c)).range([i,i+o-l]),d=u.domain().map(function(f){return u(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(n),endX:u(a),scale:u,scaleValues:d}},qG=function(t){return t.changedTouches&&!!t.changedTouches.length},ky=function(e){function t(r){var n;return Fft(this,t),n=$ft(this,t,[r]),Rl(n,"handleDrag",function(a){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(a):n.state.isSlideMoving&&n.handleSlideDrag(a)}),Rl(n,"handleTouchMove",function(a){a.changedTouches!=null&&a.changedTouches.length>0&&n.handleDrag(a.changedTouches[0])}),Rl(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,i=a.endIndex,o=a.onDragEnd,l=a.startIndex;o==null||o({endIndex:i,startIndex:l})}),n.detachDragEndListener()}),Rl(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),Rl(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),Rl(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),Rl(n,"handleSlideDragStart",function(a){var i=qG(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return Uft(t,e),Mft(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var a=n.startX,i=n.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(a,i),m=Math.max(a,i),h=t.getIndexInRange(o,f),g=t.getIndexInRange(o,m);return{startIndex:h-h%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(n){var a=this.props,i=a.data,o=a.tickFormatter,l=a.dataKey,c=hi(i[n],l,n);return Mr(o)?o(c,n):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var a=this.state,i=a.slideMoveStartX,o=a.startX,l=a.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,m=c.startIndex,h=c.endIndex,g=c.onChange,p=n.pageX-i;p>0?p=Math.min(p,u+d-f-l,u+d-f-o):p<0&&(p=Math.max(p,u-o,u-l));var x=this.getIndex({startX:o+p,endX:l+p});(x.startIndex!==m||x.endIndex!==h)&&g&&g(x),this.setState({startX:o+p,endX:l+p,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var i=qG(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var a=this.state,i=a.brushMoveStartX,o=a.movingTravellerId,l=a.endX,c=a.startX,u=this.state[o],d=this.props,f=d.x,m=d.width,h=d.travellerWidth,g=d.onChange,p=d.gap,x=d.data,v={startX:this.state.startX,endX:this.state.endX},b=n.pageX-i;b>0?b=Math.min(b,f+m-h-u):b<0&&(b=Math.max(b,f-u)),v[o]=u+b;var y=this.getIndex(v),N=y.startIndex,_=y.endIndex,j=function(){var I=x.length-1;return o==="startX"&&(l>c?N%p===0:_%p===0)||l<c&&_===I||o==="endX"&&(l>c?_%p===0:N%p===0)||l>c&&_===I};this.setState(Rl(Rl({},o,u+b),"brushMoveStartX",n.pageX),function(){g&&j()&&g(y)})}},{key:"handleTravellerMoveKeyboard",value:function(n,a){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[a],f=l.indexOf(d);if(f!==-1){var m=f+n;if(!(m===-1||m>=l.length)){var h=l[m];a==="startX"&&h>=u||a==="endX"&&h<=c||this.setState(Rl({},a,h),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,a=n.x,i=n.y,o=n.width,l=n.height,c=n.fill,u=n.stroke;return be.createElement("rect",{stroke:u,fill:c,x:a,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,i=n.y,o=n.width,l=n.height,c=n.data,u=n.children,d=n.padding,f=w.Children.only(u);return f?be.cloneElement(f,{x:a,y:i,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(n,a){var i,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,m=c.traveller,h=c.ariaLabel,g=c.data,p=c.startIndex,x=c.endIndex,v=Math.max(n,this.props.x),b=xP(xP({},Sr(this.props,!1)),{},{x:v,y:u,width:d,height:f}),y=h||"Min value: ".concat((i=g[p])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=g[x])===null||o===void 0?void 0:o.name);return be.createElement(Ln,{tabIndex:0,role:"slider","aria-label":y,"aria-valuenow":n,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(m,b))}},{key:"renderSlide",value:function(n,a){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(n,a)+u,f=Math.max(Math.abs(a-n)-u,0);return be.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var n=this.props,a=n.startIndex,i=n.endIndex,o=n.y,l=n.height,c=n.travellerWidth,u=n.stroke,d=this.state,f=d.startX,m=d.endX,h=5,g={pointerEvents:"none",fill:u};return be.createElement(Ln,{className:"recharts-brush-texts"},be.createElement(vg,ck({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,m)-h,y:o+l/2},g),this.getTextOfTick(a)),be.createElement(vg,ck({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,m)+c+h,y:o+l/2},g),this.getTextOfTick(i)))}},{key:"render",value:function(){var n=this.props,a=n.data,i=n.className,o=n.children,l=n.x,c=n.y,u=n.width,d=n.height,f=n.alwaysShowText,m=this.state,h=m.startX,g=m.endX,p=m.isTextActive,x=m.isSlideMoving,v=m.isTravellerMoving,b=m.isTravellerFocused;if(!a||!a.length||!Dt(l)||!Dt(c)||!Dt(u)||!Dt(d)||u<=0||d<=0)return null;var y=en("recharts-brush",i),N=be.Children.count(o)===1,_=Lft("userSelect","none");return be.createElement(Ln,{className:y,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:_},this.renderBackground(),N&&this.renderPanorama(),this.renderSlide(h,g),this.renderTravellerLayer(h,"startX"),this.renderTravellerLayer(g,"endX"),(p||x||v||b||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,i=n.y,o=n.width,l=n.height,c=n.stroke,u=Math.floor(i+l/2)-1;return be.createElement(be.Fragment,null,be.createElement("rect",{x:a,y:i,width:o,height:l,fill:c,stroke:"none"}),be.createElement("line",{x1:a+1,y1:u,x2:a+o-1,y2:u,fill:"none",stroke:"#fff"}),be.createElement("line",{x1:a+1,y1:u+2,x2:a+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var i;return be.isValidElement(n)?i=be.cloneElement(n,a):Mr(n)?i=n(a):i=t.renderDefaultTraveller(a),i}},{key:"getDerivedStateFromProps",value:function(n,a){var i=n.data,o=n.width,l=n.x,c=n.travellerWidth,u=n.updateId,d=n.startIndex,f=n.endIndex;if(i!==a.prevData||u!==a.prevUpdateId)return xP({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?Vft({data:i,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(a.scale&&(o!==a.prevWidth||l!==a.prevX||c!==a.prevTravellerWidth)){a.scale.range([l,l+o-c]);var m=a.scale.domain().map(function(h){return a.scale(h)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:a.scale(n.startIndex),endX:a.scale(n.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(n,a){for(var i=n.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);n[c]>a?l=c:o=c}return a>=n[l]?l:o}}])}(w.PureComponent);Rl(ky,"displayName","Brush");Rl(ky,"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 Wft=HF;function Hft(e,t){var r;return Wft(e,function(n,a,i){return r=t(n,a,i),!r}),!!r}var Gft=Hft,Kft=Oce,Yft=cf,Xft=Gft,Zft=_l,Jft=PE;function Qft(e,t,r){var n=Zft(e)?Kft:Xft;return r&&Jft(e,t,r)&&(t=void 0),n(e,Yft(t))}var eht=Qft;const tht=jn(eht);var Hd=function(t,r){var n=t.alwaysShow,a=t.ifOverflow;return n&&(a="extendDomain"),a===r},VG=eue;function rht(e,t,r){t=="__proto__"&&VG?VG(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var nht=rht,sht=nht,aht=Jce,iht=cf;function oht(e,t){var r={};return t=iht(t),aht(e,function(n,a,i){sht(r,a,t(n,a,i))}),r}var lht=oht;const cht=jn(lht);function uht(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}var dht=uht,fht=HF;function hht(e,t){var r=!0;return fht(e,function(n,a,i){return r=!!t(n,a,i),r}),r}var mht=hht,pht=dht,ght=mht,xht=cf,vht=_l,yht=PE;function bht(e,t,r){var n=vht(e)?pht:ght;return r&&yht(e,t,r)&&(t=void 0),n(e,xht(t))}var wht=bht;const Ude=jn(wht);var jht=["x","y"];function aj(e){"@babel/helpers - typeof";return aj=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},aj(e)}function OD(){return OD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},OD.apply(this,arguments)}function WG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function $b(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WG(Object(r),!0).forEach(function(n){_ht(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _ht(e,t,r){return t=Nht(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nht(e){var t=Sht(e,"string");return aj(t)=="symbol"?t:t+""}function Sht(e,t){if(aj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(aj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kht(e,t){if(e==null)return{};var r=Cht(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cht(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Eht(e,t){var r=e.x,n=e.y,a=kht(e,jht),i="".concat(r),o=parseInt(i,10),l="".concat(n),c=parseInt(l,10),u="".concat(t.height||a.height),d=parseInt(u,10),f="".concat(t.width||a.width),m=parseInt(f,10);return $b($b($b($b($b({},t),a),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:m,name:t.name,radius:t.radius})}function HG(e){return be.createElement(Rde,OD({shapeType:"rectangle",propTransformer:Eht,activeClassName:"recharts-active-bar"},e))}var Aht=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,a){if(typeof t=="number")return t;var i=Dt(n)||nHe(n);return i?t(n,a):(i||bg(),r)}},Tht=["value","background"],qde;function Cy(e){"@babel/helpers - typeof";return Cy=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},Cy(e)}function Pht(e,t){if(e==null)return{};var r=Oht(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Oht(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function dk(){return dk=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},dk.apply(this,arguments)}function GG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ua(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?GG(Object(r),!0).forEach(function(n){Pm(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KG(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Wde(n.key),n)}}function Iht(e,t,r){return t&&KG(e.prototype,t),r&&KG(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Rht(e,t,r){return t=fk(t),Lht(e,Vde()?Reflect.construct(t,r||[],fk(e).constructor):t.apply(e,r))}function Lht(e,t){if(t&&(Cy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Fht(e)}function Fht(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vde(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vde=function(){return!!e})()}function fk(e){return fk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fk(e)}function Mht(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&&DD(e,t)}function DD(e,t){return DD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},DD(e,t)}function Pm(e,t,r){return t=Wde(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wde(e){var t=$ht(e,"string");return Cy(t)=="symbol"?t:t+""}function $ht(e,t){if(Cy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Cy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var dp=function(e){function t(){var r;Dht(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=Rht(this,t,[].concat(a)),Pm(r,"state",{isAnimationFinished:!1}),Pm(r,"id",_1("recharts-bar-")),Pm(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),o&&o()}),Pm(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),o&&o()}),r}return Mht(t,e),Iht(t,[{key:"renderRectanglesStatically",value:function(n){var a=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,u=i.activeBar,d=Sr(this.props,!1);return n&&n.map(function(f,m){var h=m===c,g=h?u:o,p=Ua(Ua(Ua({},d),f),{},{isActive:h,option:g,index:m,dataKey:l,onAnimationStart:a.handleAnimationStart,onAnimationEnd:a.handleAnimationEnd});return be.createElement(Ln,dk({className:"recharts-bar-rectangle"},xg(a.props,f,m),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(m)}),be.createElement(HG,p))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,a=this.props,i=a.data,o=a.layout,l=a.isAnimationActive,c=a.animationBegin,u=a.animationDuration,d=a.animationEasing,f=a.animationId,m=this.state.prevData;return be.createElement(ef,{begin:c,duration:u,isActive:l,easing:d,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(h){var g=h.t,p=i.map(function(x,v){var b=m&&m[v];if(b){var y=Bl(b.x,x.x),N=Bl(b.y,x.y),_=Bl(b.width,x.width),j=Bl(b.height,x.height);return Ua(Ua({},x),{},{x:y(g),y:N(g),width:_(g),height:j(g)})}if(o==="horizontal"){var S=Bl(0,x.height),I=S(g);return Ua(Ua({},x),{},{y:x.y+x.height-I,height:I})}var P=Bl(0,x.width),F=P(g);return Ua(Ua({},x),{},{width:F})});return be.createElement(Ln,null,n.renderRectanglesStatically(p))})}},{key:"renderRectangles",value:function(){var n=this.props,a=n.data,i=n.isAnimationActive,o=this.state.prevData;return i&&a&&a.length&&(!o||!x_(o,a))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(a)}},{key:"renderBackground",value:function(){var n=this,a=this.props,i=a.data,o=a.dataKey,l=a.activeIndex,c=Sr(this.props.background,!1);return i.map(function(u,d){u.value;var f=u.background,m=Pht(u,Tht);if(!f)return null;var h=Ua(Ua(Ua(Ua(Ua({},m),{},{fill:"#eee"},f),c),xg(n.props,u,d)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:o,index:d,className:"recharts-bar-background-rectangle"});return be.createElement(HG,dk({key:"background-bar-".concat(d),option:n.props.background,isActive:d===l},h))})}},{key:"renderErrorBar",value:function(n,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=ec(d,v_);if(!f)return null;var m=u==="vertical"?o[0].height/2:o[0].width/2,h=function(x,v){var b=Array.isArray(x.value)?x.value[1]:x.value;return{x:x.x,y:x.y,value:b,errorVal:hi(x,v)}},g={clipPath:n?"url(#clipPath-".concat(a,")"):null};return be.createElement(Ln,g,f.map(function(p){return be.cloneElement(p,{key:"error-bar-".concat(a,"-").concat(p.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,offset:m,dataPointFormatter:h})}))}},{key:"render",value:function(){var n=this.props,a=n.hide,i=n.data,o=n.className,l=n.xAxis,c=n.yAxis,u=n.left,d=n.top,f=n.width,m=n.height,h=n.isAnimationActive,g=n.background,p=n.id;if(a||!i||!i.length)return null;var x=this.state.isAnimationFinished,v=en("recharts-bar",o),b=l&&l.allowDataOverflow,y=c&&c.allowDataOverflow,N=b||y,_=Xr(p)?this.id:p;return be.createElement(Ln,{className:v},b||y?be.createElement("defs",null,be.createElement("clipPath",{id:"clipPath-".concat(_)},be.createElement("rect",{x:b?u:u-f/2,y:y?d:d-m/2,width:b?f:f*2,height:y?m:m*2}))):null,be.createElement(Ln,{className:"recharts-bar-rectangles",clipPath:N?"url(#clipPath-".concat(_,")"):null},g?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(N,_),(!h||x)&&th.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:a.curData}:n.data!==a.curData?{curData:n.data}:null}}])}(w.PureComponent);qde=dp;Pm(dp,"displayName","Bar");Pm(dp,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!qg.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Pm(dp,"getComposedData",function(e){var t=e.props,r=e.item,n=e.barPosition,a=e.bandSize,i=e.xAxis,o=e.yAxis,l=e.xAxisTicks,c=e.yAxisTicks,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,m=e.offset,h=Not(n,r);if(!h)return null;var g=t.layout,p=r.type.defaultProps,x=p!==void 0?Ua(Ua({},p),r.props):r.props,v=x.dataKey,b=x.children,y=x.minPointSize,N=g==="horizontal"?o:i,_=u?N.scale.domain():null,j=Pot({numericAxis:N}),S=ec(b,f_),I=f.map(function(P,F){var T,k,V,C,R,H;u?T=Sot(u[d+F],_):(T=hi(P,v),Array.isArray(T)||(T=[j,T]));var q=Aht(y,qde.defaultProps.minPointSize)(T[1],F);if(g==="horizontal"){var L,M=[o.scale(T[0]),o.scale(T[1])],z=M[0],K=M[1];k=FH({axis:i,ticks:l,bandSize:a,offset:h.offset,entry:P,index:F}),V=(L=K??z)!==null&&L!==void 0?L:void 0,C=h.size;var E=z-K;if(R=Number.isNaN(E)?0:E,H={x:k,y:o.y,width:C,height:o.height},Math.abs(q)>0&&Math.abs(R)<Math.abs(q)){var A=Fo(R||q)*(Math.abs(q)-Math.abs(R));V-=A,R+=A}}else{var O=[i.scale(T[0]),i.scale(T[1])],U=O[0],Y=O[1];if(k=U,V=FH({axis:o,ticks:c,bandSize:a,offset:h.offset,entry:P,index:F}),C=Y-U,R=h.size,H={x:i.x,y:V,width:i.width,height:R},Math.abs(q)>0&&Math.abs(C)<Math.abs(q)){var J=Fo(C||q)*(Math.abs(q)-Math.abs(C));C+=J}}return Ua(Ua(Ua({},P),{},{x:k,y:V,width:C,height:R,value:u?T:T[1],payload:P,background:H},S&&S[F]&&S[F].props),{},{tooltipPayload:[gde(r,P)],tooltipPosition:{x:k+C/2,y:V+R/2}})});return Ua({data:I,layout:g},m)});function ij(e){"@babel/helpers - typeof";return ij=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},ij(e)}function Bht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function YG(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hde(n.key),n)}}function zht(e,t,r){return t&&YG(e.prototype,t),r&&YG(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function XG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Du(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?XG(Object(r),!0).forEach(function(n){XE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function XE(e,t,r){return t=Hde(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hde(e){var t=Uht(e,"string");return ij(t)=="symbol"?t:t+""}function Uht(e,t){if(ij(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ij(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gde=function(t,r,n,a,i){var o=t.width,l=t.height,c=t.layout,u=t.children,d=Object.keys(r),f={left:n.left,leftMirror:n.left,right:o-n.right,rightMirror:o-n.right,top:n.top,topMirror:n.top,bottom:l-n.bottom,bottomMirror:l-n.bottom},m=!!Fl(u,dp);return d.reduce(function(h,g){var p=r[g],x=p.orientation,v=p.domain,b=p.padding,y=b===void 0?{}:b,N=p.mirror,_=p.reversed,j="".concat(x).concat(N?"Mirror":""),S,I,P,F,T;if(p.type==="number"&&(p.padding==="gap"||p.padding==="no-gap")){var k=v[1]-v[0],V=1/0,C=p.categoricalDomain.sort(iHe);if(C.forEach(function(O,U){U>0&&(V=Math.min((O||0)-(C[U-1]||0),V))}),Number.isFinite(V)){var R=V/k,H=p.layout==="vertical"?n.height:n.width;if(p.padding==="gap"&&(S=R*H/2),p.padding==="no-gap"){var q=Mo(t.barCategoryGap,R*H),L=R*H/2;S=L-q-(L-q)/H*q}}}a==="xAxis"?I=[n.left+(y.left||0)+(S||0),n.left+n.width-(y.right||0)-(S||0)]:a==="yAxis"?I=c==="horizontal"?[n.top+n.height-(y.bottom||0),n.top+(y.top||0)]:[n.top+(y.top||0)+(S||0),n.top+n.height-(y.bottom||0)-(S||0)]:I=p.range,_&&(I=[I[1],I[0]]);var M=fde(p,i,m),z=M.scale,K=M.realScaleType;z.domain(v).range(I),hde(z);var E=mde(z,Du(Du({},p),{},{realScaleType:K}));a==="xAxis"?(T=x==="top"&&!N||x==="bottom"&&N,P=n.left,F=f[j]-T*p.height):a==="yAxis"&&(T=x==="left"&&!N||x==="right"&&N,P=f[j]-T*p.width,F=n.top);var A=Du(Du(Du({},p),E),{},{realScaleType:K,x:P,y:F,scale:z,width:a==="xAxis"?n.width:p.width,height:a==="yAxis"?n.height:p.height});return A.bandSize=Y4(A,E),!p.hide&&a==="xAxis"?f[j]+=(T?-1:1)*A.height:p.hide||(f[j]+=(T?-1:1)*A.width),Du(Du({},h),{},XE({},g,A))},{})},Kde=function(t,r){var n=t.x,a=t.y,i=r.x,o=r.y;return{x:Math.min(n,i),y:Math.min(a,o),width:Math.abs(i-n),height:Math.abs(o-a)}},qht=function(t){var r=t.x1,n=t.y1,a=t.x2,i=t.y2;return Kde({x:r,y:n},{x:a,y:i})},Yde=function(){function e(t){Bht(this,e),this.scale=t}return zht(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,i=n.position;if(r!==void 0){if(i)switch(i){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(r)+l}default:return this.scale(r)}if(a){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+c}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),a=n[0],i=n[n.length-1];return a<=i?r>=a&&r<=i:r>=i&&r<=a}}],[{key:"create",value:function(r){return new e(r)}}])}();XE(Yde,"EPS",1e-4);var wM=function(t){var r=Object.keys(t).reduce(function(n,a){return Du(Du({},n),{},XE({},a,Yde.create(t[a])))},{});return Du(Du({},r),{},{apply:function(a){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return cht(a,function(c,u){return r[u].apply(c,{bandAware:o,position:l})})},isInRange:function(a){return Ude(a,function(i,o){return r[o].isInRange(i)})}})};function Vht(e){return(e%180+180)%180}var Wht=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=Vht(a),o=i*Math.PI/180,l=Math.atan(n/r),c=o>l&&o<Math.PI-l?n/Math.sin(o):r/Math.cos(o);return Math.abs(c)},Hht=cf,Ght=d_,Kht=AE;function Yht(e){return function(t,r,n){var a=Object(t);if(!Ght(t)){var i=Hht(r);t=Kht(t),r=function(l){return i(a[l],l,a)}}var o=e(t,r,n);return o>-1?a[i?t[o]:o]:void 0}}var Xht=Yht,Zht=Mde;function Jht(e){var t=Zht(e),r=t%1;return t===t?r?t-r:t:0}var Qht=Jht,emt=Hce,tmt=cf,rmt=Qht,nmt=Math.max;function smt(e,t,r){var n=e==null?0:e.length;if(!n)return-1;var a=r==null?0:rmt(r);return a<0&&(a=nmt(n+a,0)),emt(e,tmt(t),a)}var amt=smt,imt=Xht,omt=amt,lmt=imt(omt),cmt=lmt;const umt=jn(cmt);var dmt=cWe(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("")}),jM=w.createContext(void 0),_M=w.createContext(void 0),Xde=w.createContext(void 0),Zde=w.createContext({}),Jde=w.createContext(void 0),Qde=w.createContext(0),efe=w.createContext(0),ZG=function(t){var r=t.state,n=r.xAxisMap,a=r.yAxisMap,i=r.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=dmt(i);return be.createElement(jM.Provider,{value:n},be.createElement(_M.Provider,{value:a},be.createElement(Zde.Provider,{value:i},be.createElement(Xde.Provider,{value:d},be.createElement(Jde.Provider,{value:o},be.createElement(Qde.Provider,{value:u},be.createElement(efe.Provider,{value:c},l)))))))},fmt=function(){return w.useContext(Jde)},tfe=function(t){var r=w.useContext(jM);r==null&&bg();var n=r[t];return n==null&&bg(),n},hmt=function(){var t=w.useContext(jM);return fm(t)},mmt=function(){var t=w.useContext(_M),r=umt(t,function(n){return Ude(n.domain,Number.isFinite)});return r||fm(t)},rfe=function(t){var r=w.useContext(_M);r==null&&bg();var n=r[t];return n==null&&bg(),n},pmt=function(){var t=w.useContext(Xde);return t},gmt=function(){return w.useContext(Zde)},NM=function(){return w.useContext(efe)},SM=function(){return w.useContext(Qde)};function Ey(e){"@babel/helpers - typeof";return Ey=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},Ey(e)}function xmt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vmt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,sfe(n.key),n)}}function ymt(e,t,r){return t&&vmt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bmt(e,t,r){return t=hk(t),wmt(e,nfe()?Reflect.construct(t,r||[],hk(e).constructor):t.apply(e,r))}function wmt(e,t){if(t&&(Ey(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jmt(e)}function jmt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nfe=function(){return!!e})()}function hk(e){return hk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},hk(e)}function _mt(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&&ID(e,t)}function ID(e,t){return ID=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},ID(e,t)}function JG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function QG(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JG(Object(r),!0).forEach(function(n){kM(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JG(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kM(e,t,r){return t=sfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sfe(e){var t=Nmt(e,"string");return Ey(t)=="symbol"?t:t+""}function Nmt(e,t){if(Ey(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ey(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Smt(e,t){return Amt(e)||Emt(e,t)||Cmt(e,t)||kmt()}function kmt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cmt(e,t){if(e){if(typeof e=="string")return eK(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eK(e,t)}}function eK(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Emt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function Amt(e){if(Array.isArray(e))return e}function RD(){return RD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},RD.apply(this,arguments)}var Tmt=function(t,r){var n;return be.isValidElement(t)?n=be.cloneElement(t,r):Mr(t)?n=t(r):n=be.createElement("line",RD({},r,{className:"recharts-reference-line-line"})),n},Pmt=function(t,r,n,a,i,o,l,c,u){var d=i.x,f=i.y,m=i.width,h=i.height;if(n){var g=u.y,p=t.y.apply(g,{position:o});if(Hd(u,"discard")&&!t.y.isInRange(p))return null;var x=[{x:d+m,y:p},{x:d,y:p}];return c==="left"?x.reverse():x}if(r){var v=u.x,b=t.x.apply(v,{position:o});if(Hd(u,"discard")&&!t.x.isInRange(b))return null;var y=[{x:b,y:f+h},{x:b,y:f}];return l==="top"?y.reverse():y}if(a){var N=u.segment,_=N.map(function(j){return t.apply(j,{position:o})});return Hd(u,"discard")&&tht(_,function(j){return!t.isInRange(j)})?null:_}return null};function Omt(e){var t=e.x,r=e.y,n=e.segment,a=e.xAxisId,i=e.yAxisId,o=e.shape,l=e.className,c=e.alwaysShow,u=fmt(),d=tfe(a),f=rfe(i),m=pmt();if(!u||!m)return null;Hu(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=wM({x:d.scale,y:f.scale}),g=gi(t),p=gi(r),x=n&&n.length===2,v=Pmt(h,g,p,x,m,e.position,d.orientation,f.orientation,e);if(!v)return null;var b=Smt(v,2),y=b[0],N=y.x,_=y.y,j=b[1],S=j.x,I=j.y,P=Hd(e,"hidden")?"url(#".concat(u,")"):void 0,F=QG(QG({clipPath:P},Sr(e,!0)),{},{x1:N,y1:_,x2:S,y2:I});return be.createElement(Ln,{className:en("recharts-reference-line",l)},Tmt(o,F),Ci.renderCallByParent(e,qht({x1:N,y1:_,x2:S,y2:I})))}var CM=function(e){function t(){return xmt(this,t),bmt(this,t,arguments)}return _mt(t,e),ymt(t,[{key:"render",value:function(){return be.createElement(Omt,this.props)}}])}(be.Component);kM(CM,"displayName","ReferenceLine");kM(CM,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function LD(){return LD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},LD.apply(this,arguments)}function Ay(e){"@babel/helpers - typeof";return Ay=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},Ay(e)}function tK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function rK(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?tK(Object(r),!0).forEach(function(n){ZE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dmt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Imt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ife(n.key),n)}}function Rmt(e,t,r){return t&&Imt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lmt(e,t,r){return t=mk(t),Fmt(e,afe()?Reflect.construct(t,r||[],mk(e).constructor):t.apply(e,r))}function Fmt(e,t){if(t&&(Ay(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mmt(e)}function Mmt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function afe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(afe=function(){return!!e})()}function mk(e){return mk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mk(e)}function $mt(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&&FD(e,t)}function FD(e,t){return FD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},FD(e,t)}function ZE(e,t,r){return t=ife(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ife(e){var t=Bmt(e,"string");return Ay(t)=="symbol"?t:t+""}function Bmt(e,t){if(Ay(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ay(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var zmt=function(t){var r=t.x,n=t.y,a=t.xAxis,i=t.yAxis,o=wM({x:a.scale,y:i.scale}),l=o.apply({x:r,y:n},{bandAware:!0});return Hd(t,"discard")&&!o.isInRange(l)?null:l},JE=function(e){function t(){return Dmt(this,t),Lmt(this,t,arguments)}return $mt(t,e),Rmt(t,[{key:"render",value:function(){var n=this.props,a=n.x,i=n.y,o=n.r,l=n.alwaysShow,c=n.clipPathId,u=gi(a),d=gi(i);if(Hu(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!d)return null;var f=zmt(this.props);if(!f)return null;var m=f.x,h=f.y,g=this.props,p=g.shape,x=g.className,v=Hd(this.props,"hidden")?"url(#".concat(c,")"):void 0,b=rK(rK({clipPath:v},Sr(this.props,!0)),{},{cx:m,cy:h});return be.createElement(Ln,{className:en("recharts-reference-dot",x)},t.renderDot(p,b),Ci.renderCallByParent(this.props,{x:m-o,y:h-o,width:2*o,height:2*o}))}}])}(be.Component);ZE(JE,"displayName","ReferenceDot");ZE(JE,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});ZE(JE,"renderDot",function(e,t){var r;return be.isValidElement(e)?r=be.cloneElement(e,t):Mr(e)?r=e(t):r=be.createElement(qE,LD({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function MD(){return MD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},MD.apply(this,arguments)}function Ty(e){"@babel/helpers - typeof";return Ty=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},Ty(e)}function nK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function sK(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nK(Object(r),!0).forEach(function(n){QE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Umt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qmt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,lfe(n.key),n)}}function Vmt(e,t,r){return t&&qmt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wmt(e,t,r){return t=pk(t),Hmt(e,ofe()?Reflect.construct(t,r||[],pk(e).constructor):t.apply(e,r))}function Hmt(e,t){if(t&&(Ty(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gmt(e)}function Gmt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ofe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ofe=function(){return!!e})()}function pk(e){return pk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},pk(e)}function Kmt(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&&$D(e,t)}function $D(e,t){return $D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},$D(e,t)}function QE(e,t,r){return t=lfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lfe(e){var t=Ymt(e,"string");return Ty(t)=="symbol"?t:t+""}function Ymt(e,t){if(Ty(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ty(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Xmt=function(t,r,n,a,i){var o=i.x1,l=i.x2,c=i.y1,u=i.y2,d=i.xAxis,f=i.yAxis;if(!d||!f)return null;var m=wM({x:d.scale,y:f.scale}),h={x:t?m.x.apply(o,{position:"start"}):m.x.rangeMin,y:n?m.y.apply(c,{position:"start"}):m.y.rangeMin},g={x:r?m.x.apply(l,{position:"end"}):m.x.rangeMax,y:a?m.y.apply(u,{position:"end"}):m.y.rangeMax};return Hd(i,"discard")&&(!m.isInRange(h)||!m.isInRange(g))?null:Kde(h,g)},eA=function(e){function t(){return Umt(this,t),Wmt(this,t,arguments)}return Kmt(t,e),Vmt(t,[{key:"render",value:function(){var n=this.props,a=n.x1,i=n.x2,o=n.y1,l=n.y2,c=n.className,u=n.alwaysShow,d=n.clipPathId;Hu(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=gi(a),m=gi(i),h=gi(o),g=gi(l),p=this.props.shape;if(!f&&!m&&!h&&!g&&!p)return null;var x=Xmt(f,m,h,g,this.props);if(!x&&!p)return null;var v=Hd(this.props,"hidden")?"url(#".concat(d,")"):void 0;return be.createElement(Ln,{className:en("recharts-reference-area",c)},t.renderRect(p,sK(sK({clipPath:v},Sr(this.props,!0)),x)),Ci.renderCallByParent(this.props,x))}}])}(be.Component);QE(eA,"displayName","ReferenceArea");QE(eA,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});QE(eA,"renderRect",function(e,t){var r;return be.isValidElement(e)?r=be.cloneElement(e,t):Mr(e)?r=e(t):r=be.createElement(bM,MD({},t,{className:"recharts-reference-area-rect"})),r});function cfe(e,t,r){if(t<1)return[];if(t===1&&r===void 0)return e;for(var n=[],a=0;a<e.length;a+=t)n.push(e[a]);return n}function Zmt(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return Wht(n,r)}function Jmt(e,t,r){var n=r==="width",a=e.x,i=e.y,o=e.width,l=e.height;return t===1?{start:n?a:i,end:n?a+o:i+l}:{start:n?a+o:i+l,end:n?a:i}}function gk(e,t,r,n,a){if(e*t<e*n||e*t>e*a)return!1;var i=r();return e*(t-e*i/2-n)>=0&&e*(t+e*i/2-a)<=0}function Qmt(e,t){return cfe(e,t+1)}function ept(e,t,r,n,a){for(var i=(n||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var g=n==null?void 0:n[c];if(g===void 0)return{v:cfe(n,u)};var p=c,x,v=function(){return x===void 0&&(x=r(g,p)),x},b=g.coordinate,y=c===0||gk(e,b,v,d,l);y||(c=0,d=o,u+=1),y&&(d=b+e*(v()/2+a),c+=u)},m;u<=i.length;)if(m=f(),m)return m.v;return[]}function oj(e){"@babel/helpers - typeof";return oj=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},oj(e)}function aK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function oo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aK(Object(r),!0).forEach(function(n){tpt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tpt(e,t,r){return t=rpt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rpt(e){var t=npt(e,"string");return oj(t)=="symbol"?t:t+""}function npt(e,t){if(oj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(oj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function spt(e,t,r,n,a){for(var i=(n||[]).slice(),o=i.length,l=t.start,c=t.end,u=function(m){var h=i[m],g,p=function(){return g===void 0&&(g=r(h,m)),g};if(m===o-1){var x=e*(h.coordinate+e*p()/2-c);i[m]=h=oo(oo({},h),{},{tickCoord:x>0?h.coordinate-x*e:h.coordinate})}else i[m]=h=oo(oo({},h),{},{tickCoord:h.coordinate});var v=gk(e,h.tickCoord,p,l,c);v&&(c=h.tickCoord-e*(p()/2+a),i[m]=oo(oo({},h),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return i}function apt(e,t,r,n,a,i){var o=(n||[]).slice(),l=o.length,c=t.start,u=t.end;if(i){var d=n[l-1],f=r(d,l-1),m=e*(d.coordinate+e*f/2-u);o[l-1]=d=oo(oo({},d),{},{tickCoord:m>0?d.coordinate-m*e:d.coordinate});var h=gk(e,d.tickCoord,function(){return f},c,u);h&&(u=d.tickCoord-e*(f/2+a),o[l-1]=oo(oo({},d),{},{isShow:!0}))}for(var g=i?l-1:l,p=function(b){var y=o[b],N,_=function(){return N===void 0&&(N=r(y,b)),N};if(b===0){var j=e*(y.coordinate-e*_()/2-c);o[b]=y=oo(oo({},y),{},{tickCoord:j<0?y.coordinate-j*e:y.coordinate})}else o[b]=y=oo(oo({},y),{},{tickCoord:y.coordinate});var S=gk(e,y.tickCoord,_,c,u);S&&(c=y.tickCoord+e*(_()/2+a),o[b]=oo(oo({},y),{},{isShow:!0}))},x=0;x<g;x++)p(x);return o}function EM(e,t,r){var n=e.tick,a=e.ticks,i=e.viewBox,o=e.minTickGap,l=e.orientation,c=e.interval,u=e.tickFormatter,d=e.unit,f=e.angle;if(!a||!a.length||!n)return[];if(Dt(c)||qg.isSsr)return Qmt(a,typeof c=="number"&&Dt(c)?c:0);var m=[],h=l==="top"||l==="bottom"?"width":"height",g=d&&h==="width"?Sw(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},p=function(y,N){var _=Mr(u)?u(y.value,N):y.value;return h==="width"?Zmt(Sw(_,{fontSize:t,letterSpacing:r}),g,f):Sw(_,{fontSize:t,letterSpacing:r})[h]},x=a.length>=2?Fo(a[1].coordinate-a[0].coordinate):1,v=Jmt(i,x,h);return c==="equidistantPreserveStart"?ept(x,v,p,a,o):(c==="preserveStart"||c==="preserveStartEnd"?m=apt(x,v,p,a,o,c==="preserveStartEnd"):m=spt(x,v,p,a,o),m.filter(function(b){return b.isShow}))}var ipt=["viewBox"],opt=["viewBox"],lpt=["ticks"];function Py(e){"@babel/helpers - typeof";return Py=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},Py(e)}function av(){return av=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},av.apply(this,arguments)}function iK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ii(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?iK(Object(r),!0).forEach(function(n){AM(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vP(e,t){if(e==null)return{};var r=cpt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function cpt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function upt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oK(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,dfe(n.key),n)}}function dpt(e,t,r){return t&&oK(e.prototype,t),r&&oK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function fpt(e,t,r){return t=xk(t),hpt(e,ufe()?Reflect.construct(t,r||[],xk(e).constructor):t.apply(e,r))}function hpt(e,t){if(t&&(Py(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mpt(e)}function mpt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ufe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ufe=function(){return!!e})()}function xk(e){return xk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xk(e)}function ppt(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&&BD(e,t)}function BD(e,t){return BD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},BD(e,t)}function AM(e,t,r){return t=dfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dfe(e){var t=gpt(e,"string");return Py(t)=="symbol"?t:t+""}function gpt(e,t){if(Py(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Py(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var T1=function(e){function t(r){var n;return upt(this,t),n=fpt(this,t,[r]),n.state={fontSize:"",letterSpacing:""},n}return ppt(t,e),dpt(t,[{key:"shouldComponentUpdate",value:function(n,a){var i=n.viewBox,o=vP(n,ipt),l=this.props,c=l.viewBox,u=vP(l,opt);return!Cv(i,c)||!Cv(o,u)||!Cv(a,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var a=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];a&&this.setState({fontSize:window.getComputedStyle(a).fontSize,letterSpacing:window.getComputedStyle(a).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var a=this.props,i=a.x,o=a.y,l=a.width,c=a.height,u=a.orientation,d=a.tickSize,f=a.mirror,m=a.tickMargin,h,g,p,x,v,b,y=f?-1:1,N=n.tickSize||d,_=Dt(n.tickCoord)?n.tickCoord:n.coordinate;switch(u){case"top":h=g=n.coordinate,x=o+ +!f*c,p=x-y*N,b=p-y*m,v=_;break;case"left":p=x=n.coordinate,g=i+ +!f*l,h=g-y*N,v=h-y*m,b=_;break;case"right":p=x=n.coordinate,g=i+ +f*l,h=g+y*N,v=h+y*m,b=_;break;default:h=g=n.coordinate,x=o+ +f*c,p=x+y*N,b=p+y*m,v=_;break}return{line:{x1:h,y1:p,x2:g,y2:x},tick:{x:v,y:b}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,a=n.orientation,i=n.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 n=this.props,a=n.orientation,i=n.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 n=this.props,a=n.x,i=n.y,o=n.width,l=n.height,c=n.orientation,u=n.mirror,d=n.axisLine,f=ii(ii(ii({},Sr(this.props,!1)),Sr(d,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var m=+(c==="top"&&!u||c==="bottom"&&u);f=ii(ii({},f),{},{x1:a,y1:i+m*l,x2:a+o,y2:i+m*l})}else{var h=+(c==="left"&&!u||c==="right"&&u);f=ii(ii({},f),{},{x1:a+h*o,y1:i,x2:a+h*o,y2:i+l})}return be.createElement("line",av({},f,{className:en("recharts-cartesian-axis-line",Ql(d,"className"))}))}},{key:"renderTicks",value:function(n,a,i){var o=this,l=this.props,c=l.tickLine,u=l.stroke,d=l.tick,f=l.tickFormatter,m=l.unit,h=EM(ii(ii({},this.props),{},{ticks:n}),a,i),g=this.getTickTextAnchor(),p=this.getTickVerticalAnchor(),x=Sr(this.props,!1),v=Sr(d,!1),b=ii(ii({},x),{},{fill:"none"},Sr(c,!1)),y=h.map(function(N,_){var j=o.getTickLineCoord(N),S=j.line,I=j.tick,P=ii(ii(ii(ii({textAnchor:g,verticalAnchor:p},x),{},{stroke:"none",fill:u},v),I),{},{index:_,payload:N,visibleTicksCount:h.length,tickFormatter:f});return be.createElement(Ln,av({className:"recharts-cartesian-axis-tick",key:"tick-".concat(N.value,"-").concat(N.coordinate,"-").concat(N.tickCoord)},xg(o.props,N,_)),c&&be.createElement("line",av({},b,S,{className:en("recharts-cartesian-axis-tick-line",Ql(c,"className"))})),d&&t.renderTickItem(d,P,"".concat(Mr(f)?f(N.value,_):N.value).concat(m||"")))});return be.createElement("g",{className:"recharts-cartesian-axis-ticks"},y)}},{key:"render",value:function(){var n=this,a=this.props,i=a.axisLine,o=a.width,l=a.height,c=a.ticksGenerator,u=a.className,d=a.hide;if(d)return null;var f=this.props,m=f.ticks,h=vP(f,lpt),g=m;return Mr(c)&&(g=m&&m.length>0?c(this.props):c(h)),o<=0||l<=0||!g||!g.length?null:be.createElement(Ln,{className:en("recharts-cartesian-axis",u),ref:function(x){n.layerReference=x}},i&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Ci.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,i){var o,l=en(a.className,"recharts-cartesian-axis-tick-value");return be.isValidElement(n)?o=be.cloneElement(n,ii(ii({},a),{},{className:l})):Mr(n)?o=n(ii(ii({},a),{},{className:l})):o=be.createElement(vg,av({},a,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(w.Component);AM(T1,"displayName","CartesianAxis");AM(T1,"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 xpt=["x1","y1","x2","y2","key"],vpt=["offset"];function wg(e){"@babel/helpers - typeof";return wg=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},wg(e)}function lK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function fo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lK(Object(r),!0).forEach(function(n){ypt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ypt(e,t,r){return t=bpt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bpt(e){var t=wpt(e,"string");return wg(t)=="symbol"?t:t+""}function wpt(e,t){if(wg(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(wg(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function k0(){return k0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k0.apply(this,arguments)}function cK(e,t){if(e==null)return{};var r=jpt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function jpt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var _pt=function(t){var r=t.fill;if(!r||r==="none")return null;var n=t.fillOpacity,a=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return be.createElement("rect",{x:a,y:i,ry:c,width:o,height:l,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function ffe(e,t){var r;if(be.isValidElement(e))r=be.cloneElement(e,t);else if(Mr(e))r=e(t);else{var n=t.x1,a=t.y1,i=t.x2,o=t.y2,l=t.key,c=cK(t,xpt),u=Sr(c,!1);u.offset;var d=cK(u,vpt);r=be.createElement("line",k0({},d,{x1:n,y1:a,x2:i,y2:o,fill:"none",key:l}))}return r}function Npt(e){var t=e.x,r=e.width,n=e.horizontal,a=n===void 0?!0:n,i=e.horizontalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var u=fo(fo({},e),{},{x1:t,y1:l,x2:t+r,y2:l,key:"line-".concat(c),index:c});return ffe(a,u)});return be.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Spt(e){var t=e.y,r=e.height,n=e.vertical,a=n===void 0?!0:n,i=e.verticalPoints;if(!a||!i||!i.length)return null;var o=i.map(function(l,c){var u=fo(fo({},e),{},{x1:l,y1:t,x2:l,y2:t+r,key:"line-".concat(c),index:c});return ffe(a,u)});return be.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function kpt(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(m){return Math.round(m+a-a)}).sort(function(m,h){return m-h});a!==d[0]&&d.unshift(0);var f=d.map(function(m,h){var g=!d[h+1],p=g?a+o-m:d[h+1]-m;if(p<=0)return null;var x=h%t.length;return be.createElement("rect",{key:"react-".concat(h),y:m,x:n,height:p,width:i,stroke:"none",fill:t[x],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return be.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Cpt(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!r||!n||!n.length)return null;var d=u.map(function(m){return Math.round(m+i-i)}).sort(function(m,h){return m-h});i!==d[0]&&d.unshift(0);var f=d.map(function(m,h){var g=!d[h+1],p=g?i+l-m:d[h+1]-m;if(p<=0)return null;var x=h%n.length;return be.createElement("rect",{key:"react-".concat(h),x:m,y:o,width:p,height:c,stroke:"none",fill:n[x],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return be.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Ept=function(t,r){var n=t.xAxis,a=t.width,i=t.height,o=t.offset;return dde(EM(fo(fo(fo({},T1.defaultProps),n),{},{ticks:Kf(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.left,o.left+o.width,r)},Apt=function(t,r){var n=t.yAxis,a=t.width,i=t.height,o=t.offset;return dde(EM(fo(fo(fo({},T1.defaultProps),n),{},{ticks:Kf(n,!0),viewBox:{x:0,y:0,width:a,height:i}})),o.top,o.top+o.height,r)},Cx={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function TM(e){var t,r,n,a,i,o,l=NM(),c=SM(),u=gmt(),d=fo(fo({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Cx.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Cx.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Cx.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:Cx.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:Cx.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:Cx.verticalFill,x:Dt(e.x)?e.x:u.left,y:Dt(e.y)?e.y:u.top,width:Dt(e.width)?e.width:u.width,height:Dt(e.height)?e.height:u.height}),f=d.x,m=d.y,h=d.width,g=d.height,p=d.syncWithTicks,x=d.horizontalValues,v=d.verticalValues,b=hmt(),y=mmt();if(!Dt(h)||h<=0||!Dt(g)||g<=0||!Dt(f)||f!==+f||!Dt(m)||m!==+m)return null;var N=d.verticalCoordinatesGenerator||Ept,_=d.horizontalCoordinatesGenerator||Apt,j=d.horizontalPoints,S=d.verticalPoints;if((!j||!j.length)&&Mr(_)){var I=x&&x.length,P=_({yAxis:y?fo(fo({},y),{},{ticks:I?x:y.ticks}):void 0,width:l,height:c,offset:u},I?!0:p);Hu(Array.isArray(P),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(wg(P),"]")),Array.isArray(P)&&(j=P)}if((!S||!S.length)&&Mr(N)){var F=v&&v.length,T=N({xAxis:b?fo(fo({},b),{},{ticks:F?v:b.ticks}):void 0,width:l,height:c,offset:u},F?!0:p);Hu(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(wg(T),"]")),Array.isArray(T)&&(S=T)}return be.createElement("g",{className:"recharts-cartesian-grid"},be.createElement(_pt,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),be.createElement(Npt,k0({},d,{offset:u,horizontalPoints:j,xAxis:b,yAxis:y})),be.createElement(Spt,k0({},d,{offset:u,verticalPoints:S,xAxis:b,yAxis:y})),be.createElement(kpt,k0({},d,{horizontalPoints:j})),be.createElement(Cpt,k0({},d,{verticalPoints:S})))}TM.displayName="CartesianGrid";var Tpt=["type","layout","connectNulls","ref"],Ppt=["key"];function Oy(e){"@babel/helpers - typeof";return Oy=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},Oy(e)}function uK(e,t){if(e==null)return{};var r=Opt(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Opt(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Pw(){return Pw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Pw.apply(this,arguments)}function dK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Il(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dK(Object(r),!0).forEach(function(n){Iu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ex(e){return Lpt(e)||Rpt(e)||Ipt(e)||Dpt()}function Dpt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ipt(e,t){if(e){if(typeof e=="string")return zD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zD(e,t)}}function Rpt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lpt(e){if(Array.isArray(e))return zD(e)}function zD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Fpt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fK(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,mfe(n.key),n)}}function Mpt(e,t,r){return t&&fK(e.prototype,t),r&&fK(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $pt(e,t,r){return t=vk(t),Bpt(e,hfe()?Reflect.construct(t,r||[],vk(e).constructor):t.apply(e,r))}function Bpt(e,t){if(t&&(Oy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zpt(e)}function zpt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hfe=function(){return!!e})()}function vk(e){return vk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vk(e)}function Upt(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&&UD(e,t)}function UD(e,t){return UD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},UD(e,t)}function Iu(e,t,r){return t=mfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mfe(e){var t=qpt(e,"string");return Oy(t)=="symbol"?t:t+""}function qpt(e,t){if(Oy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Oy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Dy=function(e){function t(){var r;Fpt(this,t);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=$pt(this,t,[].concat(a)),Iu(r,"state",{isAnimationFinished:!0,totalLength:0}),Iu(r,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),Iu(r,"getStrokeDasharray",function(o,l,c){var u=c.reduce(function(v,b){return v+b});if(!u)return r.generateSimpleStrokeDasharray(l,o);for(var d=Math.floor(o/u),f=o%u,m=l-o,h=[],g=0,p=0;g<c.length;p+=c[g],++g)if(p+c[g]>f){h=[].concat(Ex(c.slice(0,g)),[f-p]);break}var x=h.length%2===0?[0,m]:[m];return[].concat(Ex(t.repeat(c,d)),Ex(h),x).map(function(v){return"".concat(v,"px")}).join(", ")}),Iu(r,"id",_1("recharts-line-")),Iu(r,"pathRef",function(o){r.mainCurve=o}),Iu(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Iu(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Upt(t,e),Mpt(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,a){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,u=i.layout,d=i.children,f=ec(d,v_);if(!f)return null;var m=function(p,x){return{x:p.x,y:p.y,value:p.value,errorVal:hi(p.payload,x)}},h={clipPath:n?"url(#clipPath-".concat(a,")"):null};return be.createElement(Ln,h,f.map(function(g){return be.cloneElement(g,{key:"bar-".concat(g.props.dataKey),data:o,xAxis:l,yAxis:c,layout:u,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,a,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,u=l.points,d=l.dataKey,f=Sr(this.props,!1),m=Sr(c,!0),h=u.map(function(p,x){var v=Il(Il(Il({key:"dot-".concat(x),r:3},f),m),{},{index:x,cx:p.x,cy:p.y,value:p.value,dataKey:d,payload:p.payload,points:u});return t.renderDotItem(c,v)}),g={clipPath:n?"url(#clipPath-".concat(a?"":"dots-").concat(i,")"):null};return be.createElement(Ln,Pw({className:"recharts-line-dots",key:"dots"},g),h)}},{key:"renderCurveStatically",value:function(n,a,i,o){var l=this.props,c=l.type,u=l.layout,d=l.connectNulls;l.ref;var f=uK(l,Tpt),m=Il(Il(Il({},Sr(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:a?"url(#clipPath-".concat(i,")"):null,points:n},o),{},{type:c,layout:u,connectNulls:d});return be.createElement(J4,Pw({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,a){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,u=o.isAnimationActive,d=o.animationBegin,f=o.animationDuration,m=o.animationEasing,h=o.animationId,g=o.animateNewValues,p=o.width,x=o.height,v=this.state,b=v.prevPoints,y=v.totalLength;return be.createElement(ef,{begin:d,duration:f,isActive:u,easing:m,from:{t:0},to:{t:1},key:"line-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(N){var _=N.t;if(b){var j=b.length/l.length,S=l.map(function(k,V){var C=Math.floor(V*j);if(b[C]){var R=b[C],H=Bl(R.x,k.x),q=Bl(R.y,k.y);return Il(Il({},k),{},{x:H(_),y:q(_)})}if(g){var L=Bl(p*2,k.x),M=Bl(x/2,k.y);return Il(Il({},k),{},{x:L(_),y:M(_)})}return Il(Il({},k),{},{x:k.x,y:k.y})});return i.renderCurveStatically(S,n,a)}var I=Bl(0,y),P=I(_),F;if(c){var T="".concat(c).split(/[,\s]+/gim).map(function(k){return parseFloat(k)});F=i.getStrokeDasharray(P,y,T)}else F=i.generateSimpleStrokeDasharray(y,P);return i.renderCurveStatically(l,n,a,{strokeDasharray:F})})}},{key:"renderCurve",value:function(n,a){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,u=c.prevPoints,d=c.totalLength;return l&&o&&o.length&&(!u&&d>0||!x_(u,o))?this.renderCurveWithAnimation(n,a):this.renderCurveStatically(o,n,a)}},{key:"render",value:function(){var n,a=this.props,i=a.hide,o=a.dot,l=a.points,c=a.className,u=a.xAxis,d=a.yAxis,f=a.top,m=a.left,h=a.width,g=a.height,p=a.isAnimationActive,x=a.id;if(i||!l||!l.length)return null;var v=this.state.isAnimationFinished,b=l.length===1,y=en("recharts-line",c),N=u&&u.allowDataOverflow,_=d&&d.allowDataOverflow,j=N||_,S=Xr(x)?this.id:x,I=(n=Sr(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},P=I.r,F=P===void 0?3:P,T=I.strokeWidth,k=T===void 0?2:T,V=pHe(o)?o:{},C=V.clipDot,R=C===void 0?!0:C,H=F*2+k;return be.createElement(Ln,{className:y},N||_?be.createElement("defs",null,be.createElement("clipPath",{id:"clipPath-".concat(S)},be.createElement("rect",{x:N?m:m-h/2,y:_?f:f-g/2,width:N?h:h*2,height:_?g:g*2})),!R&&be.createElement("clipPath",{id:"clipPath-dots-".concat(S)},be.createElement("rect",{x:m-H/2,y:f-H/2,width:h+H,height:g+H}))):null,!b&&this.renderCurve(j,S),this.renderErrorBar(j,S),(b||o)&&this.renderDots(j,R,S),(!p||v)&&th.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:a.curPoints}:n.points!==a.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,a){for(var i=n.length%2!==0?[].concat(Ex(n),[0]):n,o=[],l=0;l<a;++l)o=[].concat(Ex(o),Ex(i));return o}},{key:"renderDotItem",value:function(n,a){var i;if(be.isValidElement(n))i=be.cloneElement(n,a);else if(Mr(n))i=n(a);else{var o=a.key,l=uK(a,Ppt),c=en("recharts-line-dot",typeof n!="boolean"?n.className:"");i=be.createElement(qE,Pw({key:o},l,{className:c}))}return i}}])}(w.PureComponent);Iu(Dy,"displayName","Line");Iu(Dy,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!qg.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Iu(Dy,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,o=e.dataKey,l=e.bandSize,c=e.displayedData,u=e.offset,d=t.layout,f=c.map(function(m,h){var g=hi(m,o);return d==="horizontal"?{x:LH({axis:r,ticks:a,bandSize:l,entry:m,index:h}),y:Xr(g)?null:n.scale(g),value:g,payload:m}:{x:Xr(g)?null:r.scale(g),y:LH({axis:n,ticks:i,bandSize:l,entry:m,index:h}),value:g,payload:m}});return Il({points:f,layout:d},u)});function Iy(e){"@babel/helpers - typeof";return Iy=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},Iy(e)}function Vpt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wpt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xfe(n.key),n)}}function Hpt(e,t,r){return t&&Wpt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gpt(e,t,r){return t=yk(t),Kpt(e,pfe()?Reflect.construct(t,r||[],yk(e).constructor):t.apply(e,r))}function Kpt(e,t){if(t&&(Iy(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ypt(e)}function Ypt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pfe=function(){return!!e})()}function yk(e){return yk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},yk(e)}function Xpt(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&&qD(e,t)}function qD(e,t){return qD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},qD(e,t)}function gfe(e,t,r){return t=xfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xfe(e){var t=Zpt(e,"string");return Iy(t)=="symbol"?t:t+""}function Zpt(e,t){if(Iy(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Iy(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function VD(){return VD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},VD.apply(this,arguments)}function Jpt(e){var t=e.xAxisId,r=NM(),n=SM(),a=tfe(t);return a==null?null:w.createElement(T1,VD({},a,{className:en("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Kf(o,!0)}}))}var P1=function(e){function t(){return Vpt(this,t),Gpt(this,t,arguments)}return Xpt(t,e),Hpt(t,[{key:"render",value:function(){return w.createElement(Jpt,this.props)}}])}(w.Component);gfe(P1,"displayName","XAxis");gfe(P1,"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 Ry(e){"@babel/helpers - typeof";return Ry=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},Ry(e)}function Qpt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function e0t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,bfe(n.key),n)}}function t0t(e,t,r){return t&&e0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r0t(e,t,r){return t=bk(t),n0t(e,vfe()?Reflect.construct(t,r||[],bk(e).constructor):t.apply(e,r))}function n0t(e,t){if(t&&(Ry(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s0t(e)}function s0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vfe=function(){return!!e})()}function bk(e){return bk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},bk(e)}function a0t(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&&WD(e,t)}function WD(e,t){return WD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},WD(e,t)}function yfe(e,t,r){return t=bfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bfe(e){var t=i0t(e,"string");return Ry(t)=="symbol"?t:t+""}function i0t(e,t){if(Ry(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ry(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function HD(){return HD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},HD.apply(this,arguments)}var o0t=function(t){var r=t.yAxisId,n=NM(),a=SM(),i=rfe(r);return i==null?null:w.createElement(T1,HD({},i,{className:en("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:n,height:a},ticksGenerator:function(l){return Kf(l,!0)}}))},O1=function(e){function t(){return Qpt(this,t),r0t(this,t,arguments)}return a0t(t,e),t0t(t,[{key:"render",value:function(){return w.createElement(o0t,this.props)}}])}(w.Component);yfe(O1,"displayName","YAxis");yfe(O1,"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 hK(e){return d0t(e)||u0t(e)||c0t(e)||l0t()}function l0t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c0t(e,t){if(e){if(typeof e=="string")return GD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return GD(e,t)}}function u0t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function d0t(e){if(Array.isArray(e))return GD(e)}function GD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var KD=function(t,r,n,a,i){var o=ec(t,CM),l=ec(t,JE),c=[].concat(hK(o),hK(l)),u=ec(t,eA),d="".concat(a,"Id"),f=a[0],m=r;if(c.length&&(m=c.reduce(function(p,x){if(x.props[d]===n&&Hd(x.props,"extendDomain")&&Dt(x.props[f])){var v=x.props[f];return[Math.min(p[0],v),Math.max(p[1],v)]}return p},m)),u.length){var h="".concat(f,"1"),g="".concat(f,"2");m=u.reduce(function(p,x){if(x.props[d]===n&&Hd(x.props,"extendDomain")&&Dt(x.props[h])&&Dt(x.props[g])){var v=x.props[h],b=x.props[g];return[Math.min(p[0],v,b),Math.max(p[1],v,b)]}return p},m)}return i&&i.length&&(m=i.reduce(function(p,x){return Dt(x)?[Math.min(p[0],x),Math.max(p[1],x)]:p},m)),m},wfe={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new a(d,f||c,m),g=r?r+u:u;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],h]:c._events[g].push(h):(c._events[g]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=r?r+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,h=f.length,g=new Array(h);m<h;m++)g[m]=f[m].fn;return g},l.prototype.listenerCount=function(u){var d=r?r+u:u,f=this._events[d];return f?f.fn?1:f.length:0},l.prototype.emit=function(u,d,f,m,h,g){var p=r?r+u:u;if(!this._events[p])return!1;var x=this._events[p],v=arguments.length,b,y;if(x.fn){switch(x.once&&this.removeListener(u,x.fn,void 0,!0),v){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,d),!0;case 3:return x.fn.call(x.context,d,f),!0;case 4:return x.fn.call(x.context,d,f,m),!0;case 5:return x.fn.call(x.context,d,f,m,h),!0;case 6:return x.fn.call(x.context,d,f,m,h,g),!0}for(y=1,b=new Array(v-1);y<v;y++)b[y-1]=arguments[y];x.fn.apply(x.context,b)}else{var N=x.length,_;for(y=0;y<N;y++)switch(x[y].once&&this.removeListener(u,x[y].fn,void 0,!0),v){case 1:x[y].fn.call(x[y].context);break;case 2:x[y].fn.call(x[y].context,d);break;case 3:x[y].fn.call(x[y].context,d,f);break;case 4:x[y].fn.call(x[y].context,d,f,m);break;default:if(!b)for(_=1,b=new Array(v-1);_<v;_++)b[_-1]=arguments[_];x[y].fn.apply(x[y].context,b)}}return!0},l.prototype.on=function(u,d,f){return i(this,u,d,f,!1)},l.prototype.once=function(u,d,f){return i(this,u,d,f,!0)},l.prototype.removeListener=function(u,d,f,m){var h=r?r+u:u;if(!this._events[h])return this;if(!d)return o(this,h),this;var g=this._events[h];if(g.fn)g.fn===d&&(!m||g.once)&&(!f||g.context===f)&&o(this,h);else{for(var p=0,x=[],v=g.length;p<v;p++)(g[p].fn!==d||m&&!g[p].once||f&&g[p].context!==f)&&x.push(g[p]);x.length?this._events[h]=x.length===1?x[0]:x:o(this,h)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=r?r+u:u,this._events[d]&&o(this,d)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(wfe);var f0t=wfe.exports;const h0t=jn(f0t);var yP=new h0t,bP="recharts.syncMouseEvents";function lj(e){"@babel/helpers - typeof";return lj=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},lj(e)}function m0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p0t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,jfe(n.key),n)}}function g0t(e,t,r){return t&&p0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function wP(e,t,r){return t=jfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jfe(e){var t=x0t(e,"string");return lj(t)=="symbol"?t:t+""}function x0t(e,t){if(lj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(lj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var v0t=function(){function e(){m0t(this,e),wP(this,"activeIndex",0),wP(this,"coordinateList",[]),wP(this,"layout","horizontal")}return g0t(e,[{key:"setDetails",value:function(r){var n,a=r.coordinateList,i=a===void 0?null:a,o=r.container,l=o===void 0?null:o,c=r.layout,u=c===void 0?null:c,d=r.offset,f=d===void 0?null:d,m=r.mouseHandlerCallback,h=m===void 0?null:m;this.coordinateList=(n=i??this.coordinateList)!==null&&n!==void 0?n:[],this.container=l??this.container,this.layout=u??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=h??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var a=this.container.getBoundingClientRect(),i=a.x,o=a.y,l=a.height,c=this.coordinateList[this.activeIndex].coordinate,u=((r=window)===null||r===void 0?void 0:r.scrollX)||0,d=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=i+c+u,m=o+this.offset.top+l/2+d;this.mouseHandlerCallback({pageX:f,pageY:m})}}}])}();function y0t(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e==null?void 0:e[0],a=e==null?void 0:e[1];if(n&&a&&Dt(n)&&Dt(a))return!0}return!1}function b0t(e,t,r,n){var a=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-a,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function _fe(e){var t=e.cx,r=e.cy,n=e.radius,a=e.startAngle,i=e.endAngle,o=As(t,r,n,a),l=As(t,r,n,i);return{points:[o,l],cx:t,cy:r,radius:n,startAngle:a,endAngle:i}}function w0t(e,t,r){var n,a,i,o;if(e==="horizontal")n=t.x,i=n,a=r.top,o=r.top+r.height;else if(e==="vertical")a=t.y,o=a,n=r.left,i=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var l=t.cx,c=t.cy,u=t.innerRadius,d=t.outerRadius,f=t.angle,m=As(l,c,u,f),h=As(l,c,d,f);n=m.x,a=m.y,i=h.x,o=h.y}else return _fe(t);return[{x:n,y:a},{x:i,y:o}]}function cj(e){"@babel/helpers - typeof";return cj=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},cj(e)}function mK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function NS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?mK(Object(r),!0).forEach(function(n){j0t(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function j0t(e,t,r){return t=_0t(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _0t(e){var t=N0t(e,"string");return cj(t)=="symbol"?t:t+""}function N0t(e,t){if(cj(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(cj(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function S0t(e){var t,r,n=e.element,a=e.tooltipEventType,i=e.isActive,o=e.activeCoordinate,l=e.activePayload,c=e.offset,u=e.activeTooltipIndex,d=e.tooltipAxisBandSize,f=e.layout,m=e.chartName,h=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!h||!i||!o||m!=="ScatterChart"&&a!=="axis")return null;var g,p=J4;if(m==="ScatterChart")g=o,p=qut;else if(m==="BarChart")g=b0t(f,o,c,d),p=bM;else if(f==="radial"){var x=_fe(o),v=x.cx,b=x.cy,y=x.radius,N=x.startAngle,_=x.endAngle;g={cx:v,cy:b,startAngle:N,endAngle:_,innerRadius:y,outerRadius:y},p=jde}else g={points:w0t(f,o,c)},p=J4;var j=NS(NS(NS(NS({stroke:"#ccc",pointerEvents:"none"},c),g),Sr(h,!1)),{},{payload:l,payloadIndex:u,className:en("recharts-tooltip-cursor",h.className)});return w.isValidElement(h)?w.cloneElement(h,j):w.createElement(p,j)}var k0t=["item"],C0t=["children","className","width","height","style","compact","title","desc"];function Ly(e){"@babel/helpers - typeof";return Ly=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},Ly(e)}function iv(){return iv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},iv.apply(this,arguments)}function pK(e,t){return T0t(e)||A0t(e,t)||Sfe(e,t)||E0t()}function E0t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A0t(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,a,i,o,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return l}}function T0t(e){if(Array.isArray(e))return e}function gK(e,t){if(e==null)return{};var r=P0t(e,t),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function P0t(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function O0t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D0t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,kfe(n.key),n)}}function I0t(e,t,r){return t&&D0t(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function R0t(e,t,r){return t=wk(t),L0t(e,Nfe()?Reflect.construct(t,r||[],wk(e).constructor):t.apply(e,r))}function L0t(e,t){if(t&&(Ly(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F0t(e)}function F0t(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Nfe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Nfe=function(){return!!e})()}function wk(e){return wk=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},wk(e)}function M0t(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&&YD(e,t)}function YD(e,t){return YD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},YD(e,t)}function Fy(e){return z0t(e)||B0t(e)||Sfe(e)||$0t()}function $0t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sfe(e,t){if(e){if(typeof e=="string")return XD(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return XD(e,t)}}function B0t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function z0t(e){if(Array.isArray(e))return XD(e)}function XD(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xK(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function dt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xK(Object(r),!0).forEach(function(n){kr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xK(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function kr(e,t,r){return t=kfe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kfe(e){var t=U0t(e,"string");return Ly(t)=="symbol"?t:t+""}function U0t(e,t){if(Ly(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ly(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var q0t={xAxis:["bottom","top"],yAxis:["left","right"]},V0t={width:"100%",height:"100%"},Cfe={x:0,y:0};function SS(e){return e}var W0t=function(t,r){return r==="horizontal"?t.x:r==="vertical"?t.y:r==="centric"?t.angle:t.radius},H0t=function(t,r,n,a){var i=r.find(function(d){return d&&d.index===n});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 dt(dt(dt({},a),As(a.cx,a.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,u=a.angle;return dt(dt(dt({},a),As(a.cx,a.cy,c,u)),{},{angle:u,radius:c})}return Cfe},tA=function(t,r){var n=r.graphicalItems,a=r.dataStartIndex,i=r.dataEndIndex,o=(n??[]).reduce(function(l,c){var u=c.props.data;return u&&u.length?[].concat(Fy(l),Fy(u)):l},[]);return o.length>0?o:t&&t.length&&Dt(a)&&Dt(i)?t.slice(a,i+1):[]};function Efe(e){return e==="number"?[0,"auto"]:void 0}var ZD=function(t,r,n,a){var i=t.graphicalItems,o=t.tooltipAxis,l=tA(r,t);return n<0||!i||!i.length||n>=l.length?null:i.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:r;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=n&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var m;if(o.dataKey&&!o.allowDuplicatedCategory){var h=f===void 0?l:f;m=b4(h,o.dataKey,a)}else m=f&&f[n]||l[n];return m?[].concat(Fy(c),[gde(u,m)]):c},[])},vK=function(t,r,n,a){var i=a||{x:t.chartX,y:t.chartY},o=W0t(i,n),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=vot(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,m=ZD(t,r,d,f),h=H0t(n,l,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:m,activeCoordinate:h}}return null},G0t=function(t,r){var n=r.axes,a=r.graphicalItems,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,m=t.stackOffset,h=ude(d,i);return n.reduce(function(g,p){var x,v=p.type.defaultProps!==void 0?dt(dt({},p.type.defaultProps),p.props):p.props,b=v.type,y=v.dataKey,N=v.allowDataOverflow,_=v.allowDuplicatedCategory,j=v.scale,S=v.ticks,I=v.includeHidden,P=v[o];if(g[P])return g;var F=tA(t.data,{graphicalItems:a.filter(function(E){var A,O=o in E.props?E.props[o]:(A=E.type.defaultProps)===null||A===void 0?void 0:A[o];return O===P}),dataStartIndex:c,dataEndIndex:u}),T=F.length,k,V,C;y0t(v.domain,N,b)&&(k=dD(v.domain,null,N),h&&(b==="number"||j!=="auto")&&(C=Cw(F,y,"category")));var R=Efe(b);if(!k||k.length===0){var H,q=(H=v.domain)!==null&&H!==void 0?H:R;if(y){if(k=Cw(F,y,b),b==="category"&&h){var L=aHe(k);_&&L?(V=k,k=lk(0,T)):_||(k=BH(q,k,p).reduce(function(E,A){return E.indexOf(A)>=0?E:[].concat(Fy(E),[A])},[]))}else if(b==="category")_?k=k.filter(function(E){return E!==""&&!Xr(E)}):k=BH(q,k,p).reduce(function(E,A){return E.indexOf(A)>=0||A===""||Xr(A)?E:[].concat(Fy(E),[A])},[]);else if(b==="number"){var M=_ot(F,a.filter(function(E){var A,O,U=o in E.props?E.props[o]:(A=E.type.defaultProps)===null||A===void 0?void 0:A[o],Y="hide"in E.props?E.props.hide:(O=E.type.defaultProps)===null||O===void 0?void 0:O.hide;return U===P&&(I||!Y)}),y,i,d);M&&(k=M)}h&&(b==="number"||j!=="auto")&&(C=Cw(F,y,"category"))}else h?k=lk(0,T):l&&l[P]&&l[P].hasStack&&b==="number"?k=m==="expand"?[0,1]:pde(l[P].stackGroups,c,u):k=cde(F,a.filter(function(E){var A=o in E.props?E.props[o]:E.type.defaultProps[o],O="hide"in E.props?E.props.hide:E.type.defaultProps.hide;return A===P&&(I||!O)}),b,d,!0);if(b==="number")k=KD(f,k,P,i,S),q&&(k=dD(q,k,N));else if(b==="category"&&q){var z=q,K=k.every(function(E){return z.indexOf(E)>=0});K&&(k=z)}}return dt(dt({},g),{},kr({},P,dt(dt({},v),{},{axisType:i,domain:k,categoricalDomain:C,duplicateDomain:V,originalDomain:(x=v.domain)!==null&&x!==void 0?x:R,isCategorical:h,layout:d})))},{})},K0t=function(t,r){var n=r.graphicalItems,a=r.Axis,i=r.axisType,o=r.axisIdKey,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.layout,f=t.children,m=tA(t.data,{graphicalItems:n,dataStartIndex:c,dataEndIndex:u}),h=m.length,g=ude(d,i),p=-1;return n.reduce(function(x,v){var b=v.type.defaultProps!==void 0?dt(dt({},v.type.defaultProps),v.props):v.props,y=b[o],N=Efe("number");if(!x[y]){p++;var _;return g?_=lk(0,h):l&&l[y]&&l[y].hasStack?(_=pde(l[y].stackGroups,c,u),_=KD(f,_,y,i)):(_=dD(N,cde(m,n.filter(function(j){var S,I,P=o in j.props?j.props[o]:(S=j.type.defaultProps)===null||S===void 0?void 0:S[o],F="hide"in j.props?j.props.hide:(I=j.type.defaultProps)===null||I===void 0?void 0:I.hide;return P===y&&!F}),"number",d),a.defaultProps.allowDataOverflow),_=KD(f,_,y,i)),dt(dt({},x),{},kr({},y,dt(dt({axisType:i},a.defaultProps),{},{hide:!0,orientation:Ql(q0t,"".concat(i,".").concat(p%2),null),domain:_,originalDomain:N,isCategorical:g,layout:d})))}return x},{})},Y0t=function(t,r){var n=r.axisType,a=n===void 0?"xAxis":n,i=r.AxisComp,o=r.graphicalItems,l=r.stackGroups,c=r.dataStartIndex,u=r.dataEndIndex,d=t.children,f="".concat(a,"Id"),m=ec(d,i),h={};return m&&m.length?h=G0t(t,{axes:m,graphicalItems:o,axisType:a,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(h=K0t(t,{Axis:i,graphicalItems:o,axisType:a,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),h},X0t=function(t){var r=fm(t),n=Kf(r,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:GF(n,function(a){return a.coordinate}),tooltipAxis:r,tooltipAxisBandSize:Y4(r,n)}},yK=function(t){var r=t.children,n=t.defaultShowTooltip,a=Fl(r,ky),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:!!n}},Z0t=function(t){return!t||!t.length?!1:t.some(function(r){var n=Qf(r&&r.type);return n&&n.indexOf("Bar")>=0})},bK=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"}},J0t=function(t,r){var n=t.props,a=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,u=n.width,d=n.height,f=n.children,m=n.margin||{},h=Fl(f,ky),g=Fl(f,W0),p=Object.keys(c).reduce(function(_,j){var S=c[j],I=S.orientation;return!S.mirror&&!S.hide?dt(dt({},_),{},kr({},I,_[I]+S.width)):_},{left:m.left||0,right:m.right||0}),x=Object.keys(o).reduce(function(_,j){var S=o[j],I=S.orientation;return!S.mirror&&!S.hide?dt(dt({},_),{},kr({},I,Ql(_,"".concat(I))+S.height)):_},{top:m.top||0,bottom:m.bottom||0}),v=dt(dt({},x),p),b=v.bottom;h&&(v.bottom+=h.props.height||ky.defaultProps.height),g&&r&&(v=wot(v,a,n,r));var y=u-v.left-v.right,N=d-v.top-v.bottom;return dt(dt({brushBottom:b},v),{},{width:Math.max(y,0),height:Math.max(N,0)})},Q0t=function(t,r){if(r==="xAxis")return t[r].width;if(r==="yAxis")return t[r].height},PM=function(t){var r=t.chartName,n=t.GraphicalChild,a=t.defaultTooltipEventType,i=a===void 0?"axis":a,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,m=function(v,b){var y=b.graphicalItems,N=b.stackGroups,_=b.offset,j=b.updateId,S=b.dataStartIndex,I=b.dataEndIndex,P=v.barSize,F=v.layout,T=v.barGap,k=v.barCategoryGap,V=v.maxBarSize,C=bK(F),R=C.numericAxisName,H=C.cateAxisName,q=Z0t(y),L=[];return y.forEach(function(M,z){var K=tA(v.data,{graphicalItems:[M],dataStartIndex:S,dataEndIndex:I}),E=M.type.defaultProps!==void 0?dt(dt({},M.type.defaultProps),M.props):M.props,A=E.dataKey,O=E.maxBarSize,U=E["".concat(R,"Id")],Y=E["".concat(H,"Id")],J={},se=c.reduce(function(ge,pe){var Ie=b["".concat(pe.axisType,"Map")],Ge=E["".concat(pe.axisType,"Id")];Ie&&Ie[Ge]||pe.axisType==="zAxis"||bg();var we=Ie[Ge];return dt(dt({},ge),{},kr(kr({},pe.axisType,we),"".concat(pe.axisType,"Ticks"),Kf(we)))},J),ee=se[H],ie=se["".concat(H,"Ticks")],Ee=N&&N[U]&&N[U].hasStack&&Oot(M,N[U].stackGroups),te=Qf(M.type).indexOf("Bar")>=0,Ue=Y4(ee,ie),W=[],Z=q&&yot({barSize:P,stackGroups:N,totalSize:Q0t(se,H)});if(te){var le,re,oe=Xr(O)?V:O,fe=(le=(re=Y4(ee,ie,!0))!==null&&re!==void 0?re:oe)!==null&&le!==void 0?le:0;W=bot({barGap:T,barCategoryGap:k,bandSize:fe!==Ue?fe:Ue,sizeList:Z[Y],maxBarSize:oe}),fe!==Ue&&(W=W.map(function(ge){return dt(dt({},ge),{},{position:dt(dt({},ge.position),{},{offset:ge.position.offset-fe/2})})}))}var Fe=M&&M.type&&M.type.getComposedData;Fe&&L.push({props:dt(dt({},Fe(dt(dt({},se),{},{displayedData:K,props:v,dataKey:A,item:M,bandSize:Ue,barPosition:W,offset:_,stackedData:Ee,layout:F,dataStartIndex:S,dataEndIndex:I}))),{},kr(kr(kr({key:M.key||"item-".concat(z)},R,se[R]),H,se[H]),"animationId",j)),childIndex:vHe(M,v.children),item:M})}),L},h=function(v,b){var y=v.props,N=v.dataStartIndex,_=v.dataEndIndex,j=v.updateId;if(!DV({props:y}))return null;var S=y.children,I=y.layout,P=y.stackOffset,F=y.data,T=y.reverseStackOrder,k=bK(I),V=k.numericAxisName,C=k.cateAxisName,R=ec(S,n),H=Tot(F,R,"".concat(V,"Id"),"".concat(C,"Id"),P,T),q=c.reduce(function(E,A){var O="".concat(A.axisType,"Map");return dt(dt({},E),{},kr({},O,Y0t(y,dt(dt({},A),{},{graphicalItems:R,stackGroups:A.axisType===V&&H,dataStartIndex:N,dataEndIndex:_}))))},{}),L=J0t(dt(dt({},q),{},{props:y,graphicalItems:R}),b==null?void 0:b.legendBBox);Object.keys(q).forEach(function(E){q[E]=d(y,q[E],L,E.replace("Map",""),r)});var M=q["".concat(C,"Map")],z=X0t(M),K=m(y,dt(dt({},q),{},{dataStartIndex:N,dataEndIndex:_,updateId:j,graphicalItems:R,stackGroups:H,offset:L}));return dt(dt({formattedGraphicalItems:K,graphicalItems:R,offset:L,stackGroups:H},z),q)},g=function(x){function v(b){var y,N,_;return O0t(this,v),_=R0t(this,v,[b]),kr(_,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),kr(_,"accessibilityManager",new v0t),kr(_,"handleLegendBBoxUpdate",function(j){if(j){var S=_.state,I=S.dataStartIndex,P=S.dataEndIndex,F=S.updateId;_.setState(dt({legendBBox:j},h({props:_.props,dataStartIndex:I,dataEndIndex:P,updateId:F},dt(dt({},_.state),{},{legendBBox:j}))))}}),kr(_,"handleReceiveSyncEvent",function(j,S,I){if(_.props.syncId===j){if(I===_.eventEmitterSymbol&&typeof _.props.syncMethod!="function")return;_.applySyncEvent(S)}}),kr(_,"handleBrushChange",function(j){var S=j.startIndex,I=j.endIndex;if(S!==_.state.dataStartIndex||I!==_.state.dataEndIndex){var P=_.state.updateId;_.setState(function(){return dt({dataStartIndex:S,dataEndIndex:I},h({props:_.props,dataStartIndex:S,dataEndIndex:I,updateId:P},_.state))}),_.triggerSyncEvent({dataStartIndex:S,dataEndIndex:I})}}),kr(_,"handleMouseEnter",function(j){var S=_.getMouseInfo(j);if(S){var I=dt(dt({},S),{},{isTooltipActive:!0});_.setState(I),_.triggerSyncEvent(I);var P=_.props.onMouseEnter;Mr(P)&&P(I,j)}}),kr(_,"triggeredAfterMouseMove",function(j){var S=_.getMouseInfo(j),I=S?dt(dt({},S),{},{isTooltipActive:!0}):{isTooltipActive:!1};_.setState(I),_.triggerSyncEvent(I);var P=_.props.onMouseMove;Mr(P)&&P(I,j)}),kr(_,"handleItemMouseEnter",function(j){_.setState(function(){return{isTooltipActive:!0,activeItem:j,activePayload:j.tooltipPayload,activeCoordinate:j.tooltipPosition||{x:j.cx,y:j.cy}}})}),kr(_,"handleItemMouseLeave",function(){_.setState(function(){return{isTooltipActive:!1}})}),kr(_,"handleMouseMove",function(j){j.persist(),_.throttleTriggeredAfterMouseMove(j)}),kr(_,"handleMouseLeave",function(j){_.throttleTriggeredAfterMouseMove.cancel();var S={isTooltipActive:!1};_.setState(S),_.triggerSyncEvent(S);var I=_.props.onMouseLeave;Mr(I)&&I(S,j)}),kr(_,"handleOuterEvent",function(j){var S=xHe(j),I=Ql(_.props,"".concat(S));if(S&&Mr(I)){var P,F;/.*touch.*/i.test(S)?F=_.getMouseInfo(j.changedTouches[0]):F=_.getMouseInfo(j),I((P=F)!==null&&P!==void 0?P:{},j)}}),kr(_,"handleClick",function(j){var S=_.getMouseInfo(j);if(S){var I=dt(dt({},S),{},{isTooltipActive:!0});_.setState(I),_.triggerSyncEvent(I);var P=_.props.onClick;Mr(P)&&P(I,j)}}),kr(_,"handleMouseDown",function(j){var S=_.props.onMouseDown;if(Mr(S)){var I=_.getMouseInfo(j);S(I,j)}}),kr(_,"handleMouseUp",function(j){var S=_.props.onMouseUp;if(Mr(S)){var I=_.getMouseInfo(j);S(I,j)}}),kr(_,"handleTouchMove",function(j){j.changedTouches!=null&&j.changedTouches.length>0&&_.throttleTriggeredAfterMouseMove(j.changedTouches[0])}),kr(_,"handleTouchStart",function(j){j.changedTouches!=null&&j.changedTouches.length>0&&_.handleMouseDown(j.changedTouches[0])}),kr(_,"handleTouchEnd",function(j){j.changedTouches!=null&&j.changedTouches.length>0&&_.handleMouseUp(j.changedTouches[0])}),kr(_,"handleDoubleClick",function(j){var S=_.props.onDoubleClick;if(Mr(S)){var I=_.getMouseInfo(j);S(I,j)}}),kr(_,"handleContextMenu",function(j){var S=_.props.onContextMenu;if(Mr(S)){var I=_.getMouseInfo(j);S(I,j)}}),kr(_,"triggerSyncEvent",function(j){_.props.syncId!==void 0&&yP.emit(bP,_.props.syncId,j,_.eventEmitterSymbol)}),kr(_,"applySyncEvent",function(j){var S=_.props,I=S.layout,P=S.syncMethod,F=_.state.updateId,T=j.dataStartIndex,k=j.dataEndIndex;if(j.dataStartIndex!==void 0||j.dataEndIndex!==void 0)_.setState(dt({dataStartIndex:T,dataEndIndex:k},h({props:_.props,dataStartIndex:T,dataEndIndex:k,updateId:F},_.state)));else if(j.activeTooltipIndex!==void 0){var V=j.chartX,C=j.chartY,R=j.activeTooltipIndex,H=_.state,q=H.offset,L=H.tooltipTicks;if(!q)return;if(typeof P=="function")R=P(L,j);else if(P==="value"){R=-1;for(var M=0;M<L.length;M++)if(L[M].value===j.activeLabel){R=M;break}}var z=dt(dt({},q),{},{x:q.left,y:q.top}),K=Math.min(V,z.x+z.width),E=Math.min(C,z.y+z.height),A=L[R]&&L[R].value,O=ZD(_.state,_.props.data,R),U=L[R]?{x:I==="horizontal"?L[R].coordinate:K,y:I==="horizontal"?E:L[R].coordinate}:Cfe;_.setState(dt(dt({},j),{},{activeLabel:A,activeCoordinate:U,activePayload:O,activeTooltipIndex:R}))}else _.setState(j)}),kr(_,"renderCursor",function(j){var S,I=_.state,P=I.isTooltipActive,F=I.activeCoordinate,T=I.activePayload,k=I.offset,V=I.activeTooltipIndex,C=I.tooltipAxisBandSize,R=_.getTooltipEventType(),H=(S=j.props.active)!==null&&S!==void 0?S:P,q=_.props.layout,L=j.key||"_recharts-cursor";return be.createElement(S0t,{key:L,activeCoordinate:F,activePayload:T,activeTooltipIndex:V,chartName:r,element:j,isActive:H,layout:q,offset:k,tooltipAxisBandSize:C,tooltipEventType:R})}),kr(_,"renderPolarAxis",function(j,S,I){var P=Ql(j,"type.axisType"),F=Ql(_.state,"".concat(P,"Map")),T=j.type.defaultProps,k=T!==void 0?dt(dt({},T),j.props):j.props,V=F&&F[k["".concat(P,"Id")]];return w.cloneElement(j,dt(dt({},V),{},{className:en(P,V.className),key:j.key||"".concat(S,"-").concat(I),ticks:Kf(V,!0)}))}),kr(_,"renderPolarGrid",function(j){var S=j.props,I=S.radialLines,P=S.polarAngles,F=S.polarRadius,T=_.state,k=T.radiusAxisMap,V=T.angleAxisMap,C=fm(k),R=fm(V),H=R.cx,q=R.cy,L=R.innerRadius,M=R.outerRadius;return w.cloneElement(j,{polarAngles:Array.isArray(P)?P:Kf(R,!0).map(function(z){return z.coordinate}),polarRadius:Array.isArray(F)?F:Kf(C,!0).map(function(z){return z.coordinate}),cx:H,cy:q,innerRadius:L,outerRadius:M,key:j.key||"polar-grid",radialLines:I})}),kr(_,"renderLegend",function(){var j=_.state.formattedGraphicalItems,S=_.props,I=S.children,P=S.width,F=S.height,T=_.props.margin||{},k=P-(T.left||0)-(T.right||0),V=ode({children:I,formattedGraphicalItems:j,legendWidth:k,legendContent:u});if(!V)return null;var C=V.item,R=gK(V,k0t);return w.cloneElement(C,dt(dt({},R),{},{chartWidth:P,chartHeight:F,margin:T,onBBoxUpdate:_.handleLegendBBoxUpdate}))}),kr(_,"renderTooltip",function(){var j,S=_.props,I=S.children,P=S.accessibilityLayer,F=Fl(I,Ml);if(!F)return null;var T=_.state,k=T.isTooltipActive,V=T.activeCoordinate,C=T.activePayload,R=T.activeLabel,H=T.offset,q=(j=F.props.active)!==null&&j!==void 0?j:k;return w.cloneElement(F,{viewBox:dt(dt({},H),{},{x:H.left,y:H.top}),active:q,label:R,payload:q?C:[],coordinate:V,accessibilityLayer:P})}),kr(_,"renderBrush",function(j){var S=_.props,I=S.margin,P=S.data,F=_.state,T=F.offset,k=F.dataStartIndex,V=F.dataEndIndex,C=F.updateId;return w.cloneElement(j,{key:j.key||"_recharts-brush",onChange:bS(_.handleBrushChange,j.props.onChange),data:P,x:Dt(j.props.x)?j.props.x:T.left,y:Dt(j.props.y)?j.props.y:T.top+T.height+T.brushBottom-(I.bottom||0),width:Dt(j.props.width)?j.props.width:T.width,startIndex:k,endIndex:V,updateId:"brush-".concat(C)})}),kr(_,"renderReferenceElement",function(j,S,I){if(!j)return null;var P=_,F=P.clipPathId,T=_.state,k=T.xAxisMap,V=T.yAxisMap,C=T.offset,R=j.type.defaultProps||{},H=j.props,q=H.xAxisId,L=q===void 0?R.xAxisId:q,M=H.yAxisId,z=M===void 0?R.yAxisId:M;return w.cloneElement(j,{key:j.key||"".concat(S,"-").concat(I),xAxis:k[L],yAxis:V[z],viewBox:{x:C.left,y:C.top,width:C.width,height:C.height},clipPathId:F})}),kr(_,"renderActivePoints",function(j){var S=j.item,I=j.activePoint,P=j.basePoint,F=j.childIndex,T=j.isRange,k=[],V=S.props.key,C=S.item.type.defaultProps!==void 0?dt(dt({},S.item.type.defaultProps),S.item.props):S.item.props,R=C.activeDot,H=C.dataKey,q=dt(dt({index:F,dataKey:H,cx:I.x,cy:I.y,r:4,fill:yM(S.item),strokeWidth:2,stroke:"#fff",payload:I.payload,value:I.value},Sr(R,!1)),w4(R));return k.push(v.renderActiveDot(R,q,"".concat(V,"-activePoint-").concat(F))),P?k.push(v.renderActiveDot(R,dt(dt({},q),{},{cx:P.x,cy:P.y}),"".concat(V,"-basePoint-").concat(F))):T&&k.push(null),k}),kr(_,"renderGraphicChild",function(j,S,I){var P=_.filterFormatItem(j,S,I);if(!P)return null;var F=_.getTooltipEventType(),T=_.state,k=T.isTooltipActive,V=T.tooltipAxis,C=T.activeTooltipIndex,R=T.activeLabel,H=_.props.children,q=Fl(H,Ml),L=P.props,M=L.points,z=L.isRange,K=L.baseLine,E=P.item.type.defaultProps!==void 0?dt(dt({},P.item.type.defaultProps),P.item.props):P.item.props,A=E.activeDot,O=E.hide,U=E.activeBar,Y=E.activeShape,J=!!(!O&&k&&q&&(A||U||Y)),se={};F!=="axis"&&q&&q.props.trigger==="click"?se={onClick:bS(_.handleItemMouseEnter,j.props.onClick)}:F!=="axis"&&(se={onMouseLeave:bS(_.handleItemMouseLeave,j.props.onMouseLeave),onMouseEnter:bS(_.handleItemMouseEnter,j.props.onMouseEnter)});var ee=w.cloneElement(j,dt(dt({},P.props),se));function ie(pe){return typeof V.dataKey=="function"?V.dataKey(pe.payload):null}if(J)if(C>=0){var Ee,te;if(V.dataKey&&!V.allowDuplicatedCategory){var Ue=typeof V.dataKey=="function"?ie:"payload.".concat(V.dataKey.toString());Ee=b4(M,Ue,R),te=z&&K&&b4(K,Ue,R)}else Ee=M==null?void 0:M[C],te=z&&K&&K[C];if(Y||U){var W=j.props.activeIndex!==void 0?j.props.activeIndex:C;return[w.cloneElement(j,dt(dt(dt({},P.props),se),{},{activeIndex:W})),null,null]}if(!Xr(Ee))return[ee].concat(Fy(_.renderActivePoints({item:P,activePoint:Ee,basePoint:te,childIndex:C,isRange:z})))}else{var Z,le=(Z=_.getItemByXY(_.state.activeCoordinate))!==null&&Z!==void 0?Z:{graphicalItem:ee},re=le.graphicalItem,oe=re.item,fe=oe===void 0?j:oe,Fe=re.childIndex,ge=dt(dt(dt({},P.props),se),{},{activeIndex:Fe});return[w.cloneElement(fe,ge),null,null]}return z?[ee,null,null]:[ee,null]}),kr(_,"renderCustomized",function(j,S,I){return w.cloneElement(j,dt(dt({key:"recharts-customized-".concat(I)},_.props),_.state))}),kr(_,"renderMap",{CartesianGrid:{handler:SS,once:!0},ReferenceArea:{handler:_.renderReferenceElement},ReferenceLine:{handler:SS},ReferenceDot:{handler:_.renderReferenceElement},XAxis:{handler:SS},YAxis:{handler:SS},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((y=b.id)!==null&&y!==void 0?y:_1("recharts"),"-clip"),_.throttleTriggeredAfterMouseMove=iue(_.triggeredAfterMouseMove,(N=b.throttleDelay)!==null&&N!==void 0?N:1e3/60),_.state={},_}return M0t(v,x),I0t(v,[{key:"componentDidMount",value:function(){var y,N;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(y=this.props.margin.left)!==null&&y!==void 0?y:0,top:(N=this.props.margin.top)!==null&&N!==void 0?N:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var y=this.props,N=y.children,_=y.data,j=y.height,S=y.layout,I=Fl(N,Ml);if(I){var P=I.props.defaultIndex;if(!(typeof P!="number"||P<0||P>this.state.tooltipTicks.length-1)){var F=this.state.tooltipTicks[P]&&this.state.tooltipTicks[P].value,T=ZD(this.state,_,P,F),k=this.state.tooltipTicks[P].coordinate,V=(this.state.offset.top+j)/2,C=S==="horizontal",R=C?{x:k,y:V}:{y:k,x:V},H=this.state.formattedGraphicalItems.find(function(L){var M=L.item;return M.type.name==="Scatter"});H&&(R=dt(dt({},R),H.props.points[P].tooltipPosition),T=H.props.points[P].tooltipPayload);var q={activeTooltipIndex:P,isTooltipActive:!0,activeLabel:F,activePayload:T,activeCoordinate:R};this.setState(q),this.renderCursor(I),this.accessibilityManager.setIndex(P)}}}},{key:"getSnapshotBeforeUpdate",value:function(y,N){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==N.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==y.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==y.margin){var _,j;this.accessibilityManager.setDetails({offset:{left:(_=this.props.margin.left)!==null&&_!==void 0?_:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0}})}return null}},{key:"componentDidUpdate",value:function(y){k8([Fl(y.children,Ml)],[Fl(this.props.children,Ml)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var y=Fl(this.props.children,Ml);if(y&&typeof y.props.shared=="boolean"){var N=y.props.shared?"axis":"item";return l.indexOf(N)>=0?N:i}return i}},{key:"getMouseInfo",value:function(y){if(!this.container)return null;var N=this.container,_=N.getBoundingClientRect(),j=Hrt(_),S={chartX:Math.round(y.pageX-j.left),chartY:Math.round(y.pageY-j.top)},I=_.width/N.offsetWidth||1,P=this.inRange(S.chartX,S.chartY,I);if(!P)return null;var F=this.state,T=F.xAxisMap,k=F.yAxisMap,V=this.getTooltipEventType(),C=vK(this.state,this.props.data,this.props.layout,P);if(V!=="axis"&&T&&k){var R=fm(T).scale,H=fm(k).scale,q=R&&R.invert?R.invert(S.chartX):null,L=H&&H.invert?H.invert(S.chartY):null;return dt(dt({},S),{},{xValue:q,yValue:L},C)}return C?dt(dt({},S),C):null}},{key:"inRange",value:function(y,N){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=this.props.layout,S=y/_,I=N/_;if(j==="horizontal"||j==="vertical"){var P=this.state.offset,F=S>=P.left&&S<=P.left+P.width&&I>=P.top&&I<=P.top+P.height;return F?{x:S,y:I}:null}var T=this.state,k=T.angleAxisMap,V=T.radiusAxisMap;if(k&&V){var C=fm(k);return qH({x:S,y:I},C)}return null}},{key:"parseEventsOfWrapper",value:function(){var y=this.props.children,N=this.getTooltipEventType(),_=Fl(y,Ml),j={};_&&N==="axis"&&(_.props.trigger==="click"?j={onClick:this.handleClick}:j={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 S=w4(this.props,this.handleOuterEvent);return dt(dt({},S),j)}},{key:"addListener",value:function(){yP.on(bP,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){yP.removeListener(bP,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(y,N,_){for(var j=this.state.formattedGraphicalItems,S=0,I=j.length;S<I;S++){var P=j[S];if(P.item===y||P.props.key===y.key||N===Qf(P.item.type)&&_===P.childIndex)return P}return null}},{key:"renderClipPath",value:function(){var y=this.clipPathId,N=this.state.offset,_=N.left,j=N.top,S=N.height,I=N.width;return be.createElement("defs",null,be.createElement("clipPath",{id:y},be.createElement("rect",{x:_,y:j,height:S,width:I})))}},{key:"getXScales",value:function(){var y=this.state.xAxisMap;return y?Object.entries(y).reduce(function(N,_){var j=pK(_,2),S=j[0],I=j[1];return dt(dt({},N),{},kr({},S,I.scale))},{}):null}},{key:"getYScales",value:function(){var y=this.state.yAxisMap;return y?Object.entries(y).reduce(function(N,_){var j=pK(_,2),S=j[0],I=j[1];return dt(dt({},N),{},kr({},S,I.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(y){var N;return(N=this.state.xAxisMap)===null||N===void 0||(N=N[y])===null||N===void 0?void 0:N.scale}},{key:"getYScaleByAxisId",value:function(y){var N;return(N=this.state.yAxisMap)===null||N===void 0||(N=N[y])===null||N===void 0?void 0:N.scale}},{key:"getItemByXY",value:function(y){var N=this.state,_=N.formattedGraphicalItems,j=N.activeItem;if(_&&_.length)for(var S=0,I=_.length;S<I;S++){var P=_[S],F=P.props,T=P.item,k=T.type.defaultProps!==void 0?dt(dt({},T.type.defaultProps),T.props):T.props,V=Qf(T.type);if(V==="Bar"){var C=(F.data||[]).find(function(L){return _ut(y,L)});if(C)return{graphicalItem:P,payload:C}}else if(V==="RadialBar"){var R=(F.data||[]).find(function(L){return qH(y,L)});if(R)return{graphicalItem:P,payload:R}}else if(KE(P,j)||YE(P,j)||nj(P,j)){var H=dft({graphicalItem:P,activeTooltipItem:j,itemData:k.data}),q=k.activeIndex===void 0?H:k.activeIndex;return{graphicalItem:dt(dt({},P),{},{childIndex:q}),payload:nj(P,j)?k.data[H]:P.props.data[H]}}}return null}},{key:"render",value:function(){var y=this;if(!DV(this))return null;var N=this.props,_=N.children,j=N.className,S=N.width,I=N.height,P=N.style,F=N.compact,T=N.title,k=N.desc,V=gK(N,C0t),C=Sr(V,!1);if(F)return be.createElement(ZG,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},be.createElement(E8,iv({},C,{width:S,height:I,title:T,desc:k}),this.renderClipPath(),RV(_,this.renderMap)));if(this.props.accessibilityLayer){var R,H;C.tabIndex=(R=this.props.tabIndex)!==null&&R!==void 0?R:0,C.role=(H=this.props.role)!==null&&H!==void 0?H:"application",C.onKeyDown=function(L){y.accessibilityManager.keyboardEvent(L)},C.onFocus=function(){y.accessibilityManager.focus()}}var q=this.parseEventsOfWrapper();return be.createElement(ZG,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},be.createElement("div",iv({className:en("recharts-wrapper",j),style:dt({position:"relative",cursor:"default",width:S,height:I},P)},q,{ref:function(M){y.container=M}}),be.createElement(E8,iv({},C,{width:S,height:I,title:T,desc:k,style:V0t}),this.renderClipPath(),RV(_,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(w.Component);kr(g,"displayName",r),kr(g,"defaultProps",dt({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),kr(g,"getDerivedStateFromProps",function(x,v){var b=x.dataKey,y=x.data,N=x.children,_=x.width,j=x.height,S=x.layout,I=x.stackOffset,P=x.margin,F=v.dataStartIndex,T=v.dataEndIndex;if(v.updateId===void 0){var k=yK(x);return dt(dt(dt({},k),{},{updateId:0},h(dt(dt({props:x},k),{},{updateId:0}),v)),{},{prevDataKey:b,prevData:y,prevWidth:_,prevHeight:j,prevLayout:S,prevStackOffset:I,prevMargin:P,prevChildren:N})}if(b!==v.prevDataKey||y!==v.prevData||_!==v.prevWidth||j!==v.prevHeight||S!==v.prevLayout||I!==v.prevStackOffset||!Cv(P,v.prevMargin)){var V=yK(x),C={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},R=dt(dt({},vK(v,y,S)),{},{updateId:v.updateId+1}),H=dt(dt(dt({},V),C),R);return dt(dt(dt({},H),h(dt({props:x},H),v)),{},{prevDataKey:b,prevData:y,prevWidth:_,prevHeight:j,prevLayout:S,prevStackOffset:I,prevMargin:P,prevChildren:N})}if(!k8(N,v.prevChildren)){var q,L,M,z,K=Fl(N,ky),E=K&&(q=(L=K.props)===null||L===void 0?void 0:L.startIndex)!==null&&q!==void 0?q:F,A=K&&(M=(z=K.props)===null||z===void 0?void 0:z.endIndex)!==null&&M!==void 0?M:T,O=E!==F||A!==T,U=!Xr(y),Y=U&&!O?v.updateId:v.updateId+1;return dt(dt({updateId:Y},h(dt(dt({props:x},v),{},{updateId:Y,dataStartIndex:E,dataEndIndex:A}),v)),{},{prevChildren:N,dataStartIndex:E,dataEndIndex:A})}return null}),kr(g,"renderActiveDot",function(x,v,b){var y;return w.isValidElement(x)?y=w.cloneElement(x,v):Mr(x)?y=x(v):y=be.createElement(qE,v),be.createElement(Ln,{className:"recharts-active-dot",key:b},y)});var p=w.forwardRef(function(v,b){return be.createElement(g,iv({},v,{ref:b}))});return p.displayName=g.displayName,p},egt=PM({chartName:"LineChart",GraphicalChild:Dy,axisComponents:[{axisType:"xAxis",AxisComp:P1},{axisType:"yAxis",AxisComp:O1}],formatAxisMap:Gde}),tgt=PM({chartName:"BarChart",GraphicalChild:dp,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:P1},{axisType:"yAxis",AxisComp:O1}],formatAxisMap:Gde}),Afe=PM({chartName:"PieChart",GraphicalChild:uf,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:GE},{axisType:"radiusAxis",AxisComp:WE}],formatAxisMap:Uot,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});function rgt(){const{isAdmin:e}=Ur(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState({totalSent:0,totalSuccess:0,totalFailed:0,deliveryRate:0,totalCampaigns:0}),[o,l]=w.useState(!0),[c,u]=w.useState([]);w.useEffect(()=>{if(!e){t("/");return}d()},[e,t]);const d=async()=>{l(!0);try{const{data:m,error:h}=await he.from("email_logs").select("*").order("created_at",{ascending:!1}).limit(500);if(h)throw h;n(m||[]);const g=(m==null?void 0:m.reduce((y,N)=>y+(N.recipients_count||1),0))||0,p=(m==null?void 0:m.reduce((y,N)=>y+(N.success?N.recipients_count||1:0),0))||0,x=g-p,v=g>0?p/g*100:0;i({totalSent:g,totalSuccess:p,totalFailed:x,deliveryRate:v,totalCampaigns:(m==null?void 0:m.length)||0});const b=Array.from({length:30},(y,N)=>{const _=M0(new Date,29-N);return{date:Ot(_,"dd/MM",{locale:yr}),fullDate:_,sent:0,success:0,failed:0}});m==null||m.forEach(y=>{const N=new Date(y.created_at),_=b.findIndex(j=>N>=lg(j.fullDate)&&N<=une(j.fullDate));if(_!==-1){const j=y.recipients_count||1;b[_].sent+=j,y.success?b[_].success+=j:b[_].failed+=j}}),u(b)}catch(m){console.error("Error loading email stats:",m)}finally{l(!1)}},f=[{name:"Délivrés",value:a.totalSuccess,color:"hsl(var(--chart-2))"},{name:"Échoués",value:a.totalFailed,color:"hsl(var(--destructive))"}].filter(m=>m.value>0);return o?s.jsx(xa,{children:s.jsx("div",{className:"container mx-auto px-4 py-8",children:s.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:s.jsx(yo,{className:"h-8 w-8 animate-spin text-primary"})})})}):s.jsx(xa,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",children:"Dashboard Email"}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Tous les emails envoyés par la plateforme (toutes sources, via SMTP)"})]}),s.jsxs(ne,{onClick:d,variant:"outline",className:"mt-4 md:mt-0",children:[s.jsx(yo,{className:"mr-2 h-4 w-4"}),"Actualiser"]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4 mb-8",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Envois"}),s.jsx("p",{className:"text-2xl font-bold",children:a.totalCampaigns})]}),s.jsx(ta,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Emails envoyés"}),s.jsx("p",{className:"text-2xl font-bold",children:a.totalSent.toLocaleString()})]}),s.jsx(Fn,{className:"h-8 w-8 text-blue-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Délivrés"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:a.totalSuccess.toLocaleString()})]}),s.jsx(Wr,{className:"h-8 w-8 text-green-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Échoués"}),s.jsx("p",{className:"text-2xl font-bold text-destructive",children:a.totalFailed.toLocaleString()})]}),s.jsx(Fs,{className:"h-8 w-8 text-destructive opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Taux de délivrabilité"}),s.jsx("p",{className:"text-2xl font-bold",children:s.jsxs("span",{className:a.deliveryRate>=95?"text-green-600":a.deliveryRate>=80?"text-yellow-600":"text-destructive",children:[a.deliveryRate.toFixed(1),"%"]})})]}),s.jsx(Kd,{className:"h-8 w-8 text-primary opacity-80"})]})})})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8",children:[s.jsxs(ke,{className:"lg:col-span-2",children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Hy,{className:"h-5 w-5"}),"Évolution sur 30 jours"]}),s.jsx(Qr,{children:"Nombre d'emails envoyés par jour"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"h-[300px]",children:s.jsx(I4,{width:"100%",height:"100%",children:s.jsxs(tgt,{data:c,children:[s.jsx(TM,{strokeDasharray:"3 3",className:"stroke-muted"}),s.jsx(P1,{dataKey:"date",tick:{fontSize:12},tickLine:!1}),s.jsx(O1,{tick:{fontSize:12},tickLine:!1}),s.jsx(Ml,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),s.jsx(dp,{dataKey:"success",name:"Délivrés",fill:"hsl(var(--chart-2))",radius:[4,4,0,0]}),s.jsx(dp,{dataKey:"failed",name:"Échoués",fill:"hsl(var(--destructive))",radius:[4,4,0,0]})]})})})})]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Répartition globale"}),s.jsx(Qr,{children:"Délivrés vs Échoués"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"h-[300px]",children:f.length>0?s.jsx(I4,{width:"100%",height:"100%",children:s.jsxs(Afe,{children:[s.jsx(uf,{data:f,cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,paddingAngle:5,dataKey:"value",children:f.map((m,h)=>s.jsx(f_,{fill:m.color},`cell-${h}`))}),s.jsx(Ml,{contentStyle:{backgroundColor:"hsl(var(--background))",border:"1px solid hsl(var(--border))",borderRadius:"8px"},formatter:m=>[m.toLocaleString(),""]}),s.jsx(W0,{})]})}):s.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Aucune donnée disponible"})})})]})]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Bs,{className:"h-5 w-5"}),"Historique des envois"]}),s.jsx(Qr,{children:"Derniers emails envoyés (toutes sources)"})]}),s.jsx(Ae,{children:r.length===0?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(Fn,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{children:"Aucun email envoyé pour le moment"})]}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[s.jsx("th",{className:"text-left py-3 px-4 font-medium",children:"Destinataire"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium",children:"Objet"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium",children:"Source"}),s.jsx("th",{className:"text-left py-3 px-4 font-medium",children:"Date"}),s.jsx("th",{className:"text-center py-3 px-4 font-medium",children:"Statut"})]})}),s.jsx("tbody",{children:r.map(m=>s.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[s.jsxs("td",{className:"py-3 px-4",children:[s.jsx("span",{className:"font-medium",children:m.to_email}),m.recipients_count>1&&s.jsxs("span",{className:"text-muted-foreground",children:[" +",m.recipients_count-1]})]}),s.jsx("td",{className:"py-3 px-4 max-w-[280px] truncate",title:m.subject||"",children:m.subject||"—"}),s.jsx("td",{className:"py-3 px-4 text-muted-foreground",children:m.source||"—"}),s.jsx("td",{className:"py-3 px-4 text-muted-foreground whitespace-nowrap",children:Ot(new Date(m.created_at),"dd MMM yyyy à HH:mm",{locale:yr})}),s.jsx("td",{className:"py-3 px-4 text-center",children:m.success?s.jsx(Le,{className:"bg-green-500 hover:bg-green-600",children:"Délivré"}):s.jsx(Le,{variant:"destructive",title:m.error||"",children:"Échoué"})})]},m.id))})]})})})]})]})})}const gh=w.forwardRef(({className:e,...t},r)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:r,className:pt("w-full caption-bottom text-sm",e),...t})}));gh.displayName="Table";const xh=w.forwardRef(({className:e,...t},r)=>s.jsx("thead",{ref:r,className:pt("[&_tr]:border-b",e),...t}));xh.displayName="TableHeader";const vh=w.forwardRef(({className:e,...t},r)=>s.jsx("tbody",{ref:r,className:pt("[&_tr:last-child]:border-0",e),...t}));vh.displayName="TableBody";const ngt=w.forwardRef(({className:e,...t},r)=>s.jsx("tfoot",{ref:r,className:pt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));ngt.displayName="TableFooter";const Oa=w.forwardRef(({className:e,...t},r)=>s.jsx("tr",{ref:r,className:pt("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Oa.displayName="TableRow";const pr=w.forwardRef(({className:e,...t},r)=>s.jsx("th",{ref:r,className:pt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));pr.displayName="TableHead";const ur=w.forwardRef(({className:e,...t},r)=>s.jsx("td",{ref:r,className:pt("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));ur.displayName="TableCell";const sgt=w.forwardRef(({className:e,...t},r)=>s.jsx("caption",{ref:r,className:pt("mt-4 text-sm text-muted-foreground",e),...t}));sgt.displayName="TableCaption";function agt(){const[e,t]=w.useState([]),[r,n]=w.useState(!0),[a,i]=w.useState(!1),[o,l]=w.useState("all"),[c,u]=w.useState("all"),[d,f]=w.useState(""),[m,h]=w.useState(null),[g,p]=w.useState({info:0,warning:0,error:0,total:0}),[x,v]=w.useState([]);w.useEffect(()=>{y()},[o,c]),w.useEffect(()=>{b()},[]);const b=async()=>{try{const{data:P,error:F}=await he.from("app_logs").select("user_email").not("user_email","is",null);if(F)throw F;const T={};P==null||P.forEach(V=>{V.user_email&&(T[V.user_email]=(T[V.user_email]||0)+1)});const k=Object.entries(T).map(([V,C])=>({email:V,count:C})).sort((V,C)=>C.count-V.count);v(k)}catch(P){console.error("Error loading unique users:",P)}},y=async()=>{n(!0);try{let P=he.from("app_logs").select("*").order("created_at",{ascending:!1}).limit(500);o!=="all"&&(P=P.eq("level",o)),c!=="all"&&(c==="anonymous"?P=P.is("user_email",null):P=P.eq("user_email",c));const{data:F,error:T}=await P;if(T)throw T;const k=(F||[]).map(C=>({...C,level:C.level,context:C.context}));t(k);const{data:V}=await he.from("app_logs").select("level");if(V){const C=V.filter(q=>q.level==="info").length,R=V.filter(q=>q.level==="warning").length,H=V.filter(q=>q.level==="error").length;p({info:C,warning:R,error:H,total:V.length})}}catch(P){console.error("Error loading logs:",P),ae.error("Erreur lors du chargement des logs")}finally{n(!1)}},N=async P=>{if(confirm("Êtes-vous sûr de vouloir supprimer tous les logs ?"))try{let F=he.from("app_logs").delete();P||(F=F.neq("id","00000000-0000-0000-0000-000000000000"));const{error:T}=await F;if(T)throw T;ae.success("Logs supprimés"),y()}catch(F){console.error("Error clearing logs:",F),ae.error("Erreur lors de la suppression")}},_=async()=>{if(confirm("Supprimer tous les logs de plus de 30 jours ?")){i(!0);try{const{data:P,error:F}=await he.functions.invoke("purge-old-logs");if(F)throw F;ae.success(P.message||"Logs purgés avec succès"),y()}catch(P){console.error("Error purging old logs:",P),ae.error("Erreur lors de la purge")}finally{i(!1)}}},j=P=>{switch(P){case"error":return s.jsxs(Le,{variant:"destructive",className:"gap-1",children:[s.jsx(Di,{className:"h-3 w-3"}),"Error"]});case"warning":return s.jsxs(Le,{className:"bg-yellow-500 gap-1",children:[s.jsx(Yd,{className:"h-3 w-3"}),"Warning"]});default:return s.jsxs(Le,{variant:"secondary",className:"gap-1",children:[s.jsx(ey,{className:"h-3 w-3"}),"Info"]})}},S=e.filter(P=>{var k,V,C,R;if(!d)return!0;const F=d.toLowerCase(),T=((k=P.context)==null?void 0:k.sessionId)||"";return P.message.toLowerCase().includes(F)||((V=P.user_email)==null?void 0:V.toLowerCase().includes(F))||((C=P.page_url)==null?void 0:C.toLowerCase().includes(F))||T.toLowerCase().includes(F)||((R=P.ip_address)==null?void 0:R.toLowerCase().includes(F))||JSON.stringify(P.context).toLowerCase().includes(F)}),I=P=>{var T;const F=(T=P.context)==null?void 0:T.sessionId;return F?F.substring(0,8)+"...":"-"};return s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(sa,{items:[{label:"Logs"}]}),s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-8",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(Gt,{className:"h-8 w-8 text-primary"}),"Logs Application"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Suivi des actions et erreurs de l'application"})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mt-4 md:mt-0",children:[s.jsxs(ne,{variant:"outline",onClick:()=>y(),children:[s.jsx(yo,{className:"mr-2 h-4 w-4"}),"Rafraîchir"]}),s.jsxs(ne,{variant:"outline",onClick:_,disabled:a,children:[a?s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(Gr,{className:"mr-2 h-4 w-4"}),"Purger +30j"]}),s.jsxs(ne,{variant:"destructive",onClick:()=>N(),children:[s.jsx(bi,{className:"mr-2 h-4 w-4"}),"Vider tout"]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-2xl font-bold",children:g.total})]}),s.jsx(Gt,{className:"h-8 w-8 text-muted-foreground opacity-50"})]})})}),s.jsx(ke,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>l("info"),children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Info"}),s.jsx("p",{className:"text-2xl font-bold text-blue-600",children:g.info})]}),s.jsx(ey,{className:"h-8 w-8 text-blue-500 opacity-50"})]})})}),s.jsx(ke,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>l("warning"),children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Warning"}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:g.warning})]}),s.jsx(Yd,{className:"h-8 w-8 text-yellow-500 opacity-50"})]})})}),s.jsx(ke,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>l("error"),children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Error"}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:g.error})]}),s.jsx(Di,{className:"h-8 w-8 text-red-500 opacity-50"})]})})})]}),s.jsx(ke,{className:"mb-6",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[s.jsx("div",{className:"flex-1",children:s.jsxs("div",{className:"relative",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher dans les logs...",value:d,onChange:P=>f(P.target.value),className:"pl-10"})]})}),s.jsxs(Lr,{value:o,onValueChange:l,children:[s.jsx(Ar,{className:"w-[180px]",children:s.jsx(Br,{placeholder:"Filtrer par niveau"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les niveaux"}),s.jsx(ot,{value:"info",children:"Info"}),s.jsx(ot,{value:"warning",children:"Warning"}),s.jsx(ot,{value:"error",children:"Error"})]})]}),s.jsxs(Lr,{value:c,onValueChange:u,children:[s.jsxs(Ar,{className:"w-[250px]",children:[s.jsx(qo,{className:"mr-2 h-4 w-4"}),s.jsx(Br,{placeholder:"Filtrer par utilisateur"})]}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les utilisateurs"}),s.jsx(ot,{value:"anonymous",children:"Anonymes uniquement"}),x.map(P=>s.jsx(ot,{value:P.email,children:s.jsxs("span",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate max-w-[180px]",children:P.email}),s.jsx(Le,{variant:"secondary",className:"text-xs",children:P.count})]})},P.email))]})]}),(o!=="all"||c!=="all")&&s.jsx(ne,{variant:"ghost",onClick:()=>{l("all"),u("all")},children:"Réinitialiser"})]})})}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Logs récents"}),s.jsxs(Qr,{children:[S.length," log",S.length>1?"s":""," affiché",S.length>1?"s":""]})]}),s.jsx(Ae,{children:r?s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):S.length===0?s.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Aucun log trouvé"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{className:"w-[100px]",children:"Niveau"}),s.jsx(pr,{children:"Message"}),s.jsx(pr,{className:"w-[120px]",children:"Session ID"}),s.jsx(pr,{className:"w-[150px]",children:"Utilisateur"}),s.jsx(pr,{className:"w-[120px]",children:"IP"}),s.jsx(pr,{className:"w-[180px]",children:"Date"}),s.jsx(pr,{className:"w-[80px]",children:"Actions"})]})}),s.jsx(vh,{children:S.map(P=>{var F;return s.jsxs(Oa,{children:[s.jsx(ur,{children:j(P.level)}),s.jsx(ur,{className:"max-w-[300px] truncate",children:P.message}),s.jsx(ur,{className:"text-xs font-mono text-muted-foreground",children:I(P)}),s.jsx(ur,{className:"text-sm text-muted-foreground truncate max-w-[150px]",children:P.user_email||"Anonyme"}),s.jsx(ur,{className:"text-xs text-muted-foreground",children:P.ip_address||"-"}),s.jsx(ur,{className:"text-sm text-muted-foreground",children:Ot(new Date(P.created_at),"dd MMM yyyy HH:mm",{locale:yr})}),s.jsx(ur,{children:s.jsxs(Hn,{children:[s.jsx(ml,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>h(P),children:s.jsx(is,{className:"h-4 w-4"})})}),s.jsxs(qn,{className:"max-w-2xl",children:[s.jsx(Gn,{children:s.jsxs(Kn,{className:"flex items-center gap-2",children:[j(P.level),"Détails du log"]})}),s.jsx(ru,{className:"max-h-[60vh]",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Message"}),s.jsx("p",{className:"mt-1",children:P.message})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Date"}),s.jsx("p",{className:"mt-1",children:Ot(new Date(P.created_at),"dd MMMM yyyy à HH:mm:ss",{locale:yr})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Utilisateur"}),s.jsx("p",{className:"mt-1",children:P.user_email||"Anonyme"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"User ID"}),s.jsx("p",{className:"mt-1 text-sm font-mono",children:P.user_id||"-"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Session ID"}),s.jsx("p",{className:"mt-1 text-sm font-mono break-all",children:((F=P.context)==null?void 0:F.sessionId)||"-"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Adresse IP"}),s.jsx("p",{className:"mt-1 text-sm",children:P.ip_address||"-"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Page"}),s.jsx("p",{className:"mt-1 text-sm break-all",children:P.page_url||"-"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Contexte"}),s.jsx("pre",{className:"mt-1 p-3 bg-muted rounded-md text-xs overflow-x-auto",children:JSON.stringify(P.context,null,2)})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"User Agent"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground break-all",children:P.user_agent||"-"})]})]})})]})]})})]},P.id)})})]})})})]})]})}const wK=["hsl(var(--primary))","hsl(var(--secondary))","#10b981","#f59e0b","#ef4444"],jK={page_view:s.jsx(is,{className:"h-4 w-4 text-blue-500"}),profile_view:s.jsx(sr,{className:"h-4 w-4 text-purple-500"}),offer_view:s.jsx(Vr,{className:"h-4 w-4 text-orange-500"}),application_sent:s.jsx(Gt,{className:"h-4 w-4 text-green-500"}),search:s.jsx(pa,{className:"h-4 w-4 text-yellow-500"}),cv_download:s.jsx(Ho,{className:"h-4 w-4 text-cyan-500"}),signup:s.jsx(sr,{className:"h-4 w-4 text-emerald-500"}),login:s.jsx(gb,{className:"h-4 w-4 text-indigo-500"}),social_link_click:s.jsx(gb,{className:"h-4 w-4 text-blue-600"}),email_click:s.jsx(gb,{className:"h-4 w-4 text-red-500"}),name_copy:s.jsx(gb,{className:"h-4 w-4 text-gray-500"}),name_copied:s.jsx(gb,{className:"h-4 w-4 text-gray-500"})};function igt(){const{user:e,isAdmin:t}=Ur(),r=Xt(),[n,a]=w.useState(!0),[i,o]=w.useState("overview"),[l,c]=w.useState({totalTrainers:0,totalOffers:0,totalViews:0,totalApplications:0,filledOffers:0,activeOffers:0}),[u,d]=w.useState([]),[f,m]=w.useState([]),[h,g]=w.useState([]),[p,x]=w.useState(new Map),[v,b]=w.useState(new Map),[y,N]=w.useState(""),[_,j]=w.useState("views"),[S,I]=w.useState([]),[P,F]=w.useState(""),[T,k]=w.useState("views"),[V,C]=w.useState("all"),[R,H]=w.useState([]),[q,L]=w.useState(new Set),[M,z]=w.useState("");w.useEffect(()=>{if(!e||!t){r("/auth");return}K()},[e,t,r]);const K=async()=>{a(!0),await Promise.all([E(),A(),O(),U(),Y(),se(),J()]),a(!1)},E=async()=>{try{const[W,Z,le]=await Promise.all([he.from("trainer_profiles").select("id, view_count, status",{count:"exact"}),he.from("school_requests").select("id, view_count, status, is_filled, application_count",{count:"exact"}),he.from("trainer_applications").select("id",{count:"exact"})]),re=W.data||[],oe=Z.data||[];c({totalTrainers:W.count||0,totalOffers:Z.count||0,totalViews:re.reduce((fe,Fe)=>fe+(Fe.view_count||0),0)+oe.reduce((fe,Fe)=>fe+(Fe.view_count||0),0),totalApplications:le.count||0,filledOffers:oe.filter(fe=>fe.is_filled).length,activeOffers:oe.filter(fe=>fe.status==="approved"&&!fe.is_filled).length})}catch(W){console.error("Error loading stats:",W)}},A=async()=>{try{const W=Array.from({length:30},(re,oe)=>{const fe=M0(new Date,29-oe);return Ot(fe,"yyyy-MM-dd")}),{data:Z}=await he.from("analytics_events").select("event_type, created_at").gte("created_at",M0(new Date,30).toISOString()),le=W.map(re=>{const oe=(Z==null?void 0:Z.filter(fe=>Ot(new Date(fe.created_at),"yyyy-MM-dd")===re))||[];return{date:Ot(new Date(re),"dd/MM",{locale:yr}),views:oe.filter(fe=>["profile_view","offer_view","page_view"].includes(fe.event_type)).length,applications:oe.filter(fe=>fe.event_type==="application_sent").length,signups:oe.filter(fe=>fe.event_type==="signup").length}});d(le)}catch(W){console.error("Error loading daily stats:",W)}},O=async()=>{try{const{data:W}=await he.from("analytics_events").select("event_type").gte("created_at",M0(new Date,30).toISOString()),Z={};W==null||W.forEach(re=>{Z[re.event_type]=(Z[re.event_type]||0)+1});const le={page_view:"Pages vues",profile_view:"Profils vus",offer_view:"Offres vues",application_sent:"Candidatures",search:"Recherches",cv_download:"CVs téléchargés"};m(Object.entries(Z).map(([re,oe])=>({name:le[re]||re,value:oe})).sort((re,oe)=>oe.value-re.value).slice(0,5))}catch(W){console.error("Error loading events by type:",W)}},U=async()=>{try{const{data:W}=await he.from("trainer_profiles").select("id, name, email, specialties, view_count, status, created_at").order("view_count",{ascending:!1});g(W||[]);const Z=new Map;W==null||W.forEach(le=>Z.set(le.id,le.name)),b(Z)}catch(W){console.error("Error loading trainers:",W)}},Y=async()=>{try{const{data:W}=await he.from("school_requests").select("id, school_name, description, subject_areas, view_count, application_count, status, is_filled, created_at, start_date, end_date").order("view_count",{ascending:!1});I(W||[])}catch(W){console.error("Error loading offers:",W)}},J=async()=>{try{const{data:W}=await he.from("analytics_events").select("trainer_profile_id, event_type").not("trainer_profile_id","is",null).in("event_type",["profile_view","cv_download","contact_click","social_link_click","name_copied"]),Z=new Map;W==null||W.forEach(le=>{const re=le.trainer_profile_id;if(!re)return;const oe=Z.get(re)||{profileViews:0,cvViews:0,contacts:0,linkClicks:0,nameCopies:0};le.event_type==="profile_view"?oe.profileViews++:le.event_type==="cv_download"?oe.cvViews++:le.event_type==="contact_click"?oe.contacts++:le.event_type==="social_link_click"?oe.linkClicks++:le.event_type==="name_copied"&&oe.nameCopies++,Z.set(re,oe)}),x(Z)}catch(W){console.error("Error loading trainer engagement:",W)}},se=async()=>{try{let W=[],Z=0;const le=1e3;let re=!0;for(;re;){const{data:pe,error:Ie}=await he.from("analytics_events").select("*").order("created_at",{ascending:!0}).range(Z*le,(Z+1)*le-1);if(Ie)throw Ie;pe&&pe.length>0?(W=[...W,...pe],Z++,re=pe.length===le):re=!1}if(W.length===0){H([]);return}const oe=[...new Set(W.filter(pe=>pe.user_id).map(pe=>pe.user_id))],fe=new Map;if(oe.length>0){const{data:pe}=await he.from("trainer_profiles").select("user_id, name, email").in("user_id",oe);pe==null||pe.forEach(we=>{fe.set(we.user_id,`${we.name} (${we.email})`)});const Ie=oe.filter(we=>!fe.has(we));if(Ie.length>0){const{data:we}=await he.from("school_profiles").select("user_id, name, contact_email").in("user_id",Ie);we==null||we.forEach(_e=>{fe.set(_e.user_id,`${_e.name} (${_e.contact_email||"école"})`)})}const Ge=oe.filter(we=>!fe.has(we));if(Ge.length>0){const{data:we}=await he.from("user_roles").select("user_id, role").in("user_id",Ge);Ge.forEach(_e=>{const qe=we==null?void 0:we.some(Me=>Me.user_id===_e&&Me.role==="admin"),Re=_e.substring(0,8);fe.set(_e,qe?`Admin (${Re}...)`:`User (${Re}...)`)})}}const Fe=new Map;W.forEach(pe=>{const Ie=pe.metadata,we=(Ie==null?void 0:Ie.session_id)||`legacy-${pe.id}`;Fe.has(we)||Fe.set(we,{userId:pe.user_id,userEmail:pe.user_id&&fe.get(pe.user_id)||null,sessionId:we,sessionStart:pe.created_at,events:[]}),Fe.get(we).events.push({eventType:pe.event_type,eventName:pe.event_name,createdAt:pe.created_at,metadata:Ie})});const ge=Array.from(Fe.values()).sort((pe,Ie)=>new Date(Ie.sessionStart).getTime()-new Date(pe.sessionStart).getTime());H(ge)}catch(W){console.error("Error loading user journeys:",W)}},ee=W=>{const Z=new Set(q);Z.has(W)?Z.delete(W):Z.add(W),L(Z)},ie=()=>{if(!M)return R;const W=M.toLowerCase();return R.filter(Z=>{var le;return((le=Z.userEmail)==null?void 0:le.toLowerCase().includes(W))||Z.events.some(re=>re.eventName.toLowerCase().includes(W)||re.eventType.toLowerCase().includes(W))})},Ee=W=>{const Z=W.metadata,le=Z==null?void 0:Z.trainer_profile_id,re=le?v.get(le):null,oe=String((Z==null?void 0:Z.trainerName)||re||"Inconnu");switch(W.eventType){case"page_view":return String((Z==null?void 0:Z.url)||W.eventName);case"profile_view":return`Profil: ${oe}`;case"offer_view":return`Offre: ${String((Z==null?void 0:Z.offerTitle)||"Inconnue")}`;case"search":return`Recherche: "${String((Z==null?void 0:Z.query)||"")}"`;case"social_link_click":return`${String((Z==null?void 0:Z.link_type)||(Z==null?void 0:Z.linkType)||"Lien")}: ${oe}`;case"cv_download":return`CV téléchargé: ${oe}`;case"email_click":return`Email cliqué: ${oe}`;case"name_copy":case"name_copied":return`Nom copié: ${oe}`;default:return W.eventName}},te=()=>{let W=[...h];if(y){const Z=y.toLowerCase();W=W.filter(le=>le.name.toLowerCase().includes(Z)||le.email.toLowerCase().includes(Z)||le.specialties.some(re=>re.toLowerCase().includes(Z)))}switch(_){case"views":W.sort((Z,le)=>(le.view_count||0)-(Z.view_count||0));break;case"recent":W.sort((Z,le)=>new Date(le.created_at).getTime()-new Date(Z.created_at).getTime());break;case"name":W.sort((Z,le)=>Z.name.localeCompare(le.name));break}return W},Ue=()=>{let W=[...S];if(P){const Z=P.toLowerCase();W=W.filter(le=>le.school_name.toLowerCase().includes(Z)||le.description.toLowerCase().includes(Z)||le.subject_areas.some(re=>re.toLowerCase().includes(Z)))}switch(V!=="all"&&(V==="filled"?W=W.filter(Z=>Z.is_filled):V==="active"?W=W.filter(Z=>Z.status==="approved"&&!Z.is_filled):W=W.filter(Z=>Z.status===V)),T){case"views":W.sort((Z,le)=>(le.view_count||0)-(Z.view_count||0));break;case"applications":W.sort((Z,le)=>(le.application_count||0)-(Z.application_count||0));break;case"recent":W.sort((Z,le)=>new Date(le.created_at).getTime()-new Date(Z.created_at).getTime());break}return W};return n?s.jsx(xa,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsx(xa,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(sa,{items:[{label:"Analytics"}]}),s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-8",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(Hy,{className:"h-8 w-8 text-primary"}),"Analytics & Tracking"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Suivi des performances et statistiques détaillées"})]}),s.jsxs(ne,{variant:"outline",onClick:K,children:[s.jsx(NN,{className:"mr-2 h-4 w-4"}),"Rafraîchir"]})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-8",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(sr,{className:"h-5 w-5 text-primary mb-2"}),s.jsx("p",{className:"text-2xl font-bold",children:l.totalTrainers}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Formateurs"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(Vr,{className:"h-5 w-5 text-primary mb-2"}),s.jsx("p",{className:"text-2xl font-bold",children:l.totalOffers}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Offres totales"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(NN,{className:"h-5 w-5 text-green-500 mb-2"}),s.jsx("p",{className:"text-2xl font-bold",children:l.activeOffers}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Offres actives"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(is,{className:"h-5 w-5 text-blue-500 mb-2"}),s.jsx("p",{className:"text-2xl font-bold",children:l.totalViews}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Vues totales"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(Gt,{className:"h-5 w-5 text-orange-500 mb-2"}),s.jsx("p",{className:"text-2xl font-bold",children:l.totalApplications}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Candidatures"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx(Wr,{className:"h-5 w-5 text-green-500 mb-2"}),s.jsx("p",{className:"text-2xl font-bold",children:l.filledOffers}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Offres pourvues"})]})})})]}),s.jsxs(af,{value:i,onValueChange:o,children:[s.jsxs(ad,{className:"mb-6",children:[s.jsx(In,{value:"overview",children:"Vue d'ensemble"}),s.jsxs(In,{value:"journeys",children:[s.jsx(_3,{className:"h-4 w-4 mr-1"}),"Parcours"]}),s.jsx(In,{value:"trainers",children:"Formateurs"}),s.jsx(In,{value:"offers",children:"Offres"})]}),s.jsx(Es,{value:"overview",children:s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(ke,{className:"md:col-span-2",children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Kd,{className:"h-5 w-5"}),"Activité des 30 derniers jours"]})}),s.jsx(Ae,{children:s.jsx("div",{className:"h-[300px]",children:s.jsx(I4,{width:"100%",height:"100%",children:s.jsxs(egt,{data:u,children:[s.jsx(TM,{strokeDasharray:"3 3",className:"stroke-muted"}),s.jsx(P1,{dataKey:"date",className:"text-xs"}),s.jsx(O1,{className:"text-xs"}),s.jsx(Ml,{}),s.jsx(Dy,{type:"monotone",dataKey:"views",stroke:"hsl(var(--primary))",name:"Vues",strokeWidth:2}),s.jsx(Dy,{type:"monotone",dataKey:"applications",stroke:"#10b981",name:"Candidatures",strokeWidth:2})]})})})})]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Types d'événements"}),s.jsx(Qr,{children:"Répartition sur 30 jours"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"h-[250px]",children:s.jsx(I4,{width:"100%",height:"100%",children:s.jsxs(Afe,{children:[s.jsx(uf,{data:f,cx:"50%",cy:"50%",innerRadius:60,outerRadius:80,paddingAngle:5,dataKey:"value",label:({name:W,percent:Z})=>`${W} ${(Z*100).toFixed(0)}%`,children:f.map((W,Z)=>s.jsx(f_,{fill:wK[Z%wK.length]},`cell-${Z}`))}),s.jsx(Ml,{})]})})})})]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Top 5 Formateurs"}),s.jsx(Qr,{children:"Par nombre de vues"})]}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-4",children:h.slice(0,5).map((W,Z)=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("span",{className:"text-lg font-bold text-muted-foreground",children:["#",Z+1]}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:W.name}),s.jsx("p",{className:"text-xs text-muted-foreground",children:W.specialties.slice(0,2).join(", ")})]})]}),s.jsxs(Le,{variant:"secondary",children:[s.jsx(is,{className:"h-3 w-3 mr-1"}),W.view_count||0]})]},W.id))})})]})]})}),s.jsx(Es,{value:"journeys",children:s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(_3,{className:"h-5 w-5"}),"Parcours Utilisateurs"]}),s.jsx(Qr,{children:"Suivi des sessions et navigation des utilisateurs (7 derniers jours)"}),s.jsx("div",{className:"flex flex-col md:flex-row gap-4 mt-4",children:s.jsxs("div",{className:"relative flex-1",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher par email, page ou événement...",value:M,onChange:W=>z(W.target.value),className:"pl-10"})]})})]}),s.jsx(Ae,{children:ie().length===0?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(_3,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{children:"Aucun parcours utilisateur enregistré"}),s.jsx("p",{className:"text-sm",children:"Les données apparaîtront au fur et à mesure de la navigation des utilisateurs"})]}):s.jsx("div",{className:"space-y-3",children:ie().map((W,Z)=>{const le=`${W.userId}-${W.sessionStart}`,re=q.has(le),oe=W.events.length>1?Math.round((new Date(W.events[W.events.length-1].createdAt).getTime()-new Date(W.events[0].createdAt).getTime())/1e3/60):0;return s.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[s.jsxs("button",{onClick:()=>ee(le),className:"w-full px-4 py-3 flex items-center justify-between bg-muted/30 hover:bg-muted/50 transition-colors text-left",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[re?s.jsx(bh,{className:"h-4 w-4 text-muted-foreground"}):s.jsx(tu,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:W.userId?s.jsx(s.Fragment,{children:s.jsx(Le,{variant:"outline",className:"text-xs",children:W.userEmail||"Utilisateur connecté"})}):s.jsx(Le,{variant:"secondary",className:"text-xs",children:"Visiteur anonyme"})}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Ot(new Date(W.sessionStart),"dd/MM/yyyy HH:mm",{locale:yr})})]}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[W.events.length," événement(s)",oe>0&&` • ${oe} min de session`,!W.sessionId.startsWith("legacy-")&&s.jsxs("span",{className:"ml-2 font-mono text-xs opacity-70",children:["ID: ",W.sessionId]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[W.events.slice(0,4).map((fe,Fe)=>s.jsx("span",{title:fe.eventType,children:jK[fe.eventType]||s.jsx(NN,{className:"h-4 w-4"})},Fe)),W.events.length>4&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",W.events.length-4]})]})]}),re&&s.jsx("div",{className:"px-4 py-3 border-t bg-background",children:s.jsxs("div",{className:"relative pl-6",children:[s.jsx("div",{className:"absolute left-2 top-2 bottom-2 w-0.5 bg-border"}),s.jsx("div",{className:"space-y-3",children:W.events.map((fe,Fe)=>s.jsxs("div",{className:"relative flex items-start gap-3",children:[s.jsx("div",{className:"absolute -left-4 mt-1 w-2 h-2 rounded-full bg-primary ring-2 ring-background"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[jK[fe.eventType]||s.jsx(NN,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium text-sm truncate",children:Ee(fe)})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[s.jsx(Gr,{className:"h-3 w-3 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Ot(new Date(fe.createdAt),"HH:mm:ss",{locale:yr})}),s.jsx(Le,{variant:"outline",className:"text-xs",children:fe.eventType})]})]})]},Fe))})]})})]},Z)})})})]})}),s.jsx(Es,{value:"trainers",children:s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(sr,{className:"h-5 w-5"}),"Liste des Formateurs"]}),s.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mt-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher par nom, email ou spécialité...",value:y,onChange:W=>N(W.target.value),className:"pl-10"})]}),s.jsxs(Lr,{value:_,onValueChange:W=>j(W),children:[s.jsxs(Ar,{className:"w-48",children:[s.jsx(LO,{className:"h-4 w-4 mr-2"}),s.jsx(Br,{})]}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"views",children:"Par vues"}),s.jsx(ot,{value:"recent",children:"Plus récents"}),s.jsx(ot,{value:"name",children:"Par nom"})]})]})]})]}),s.jsx(Ae,{children:s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{children:"Nom"}),s.jsx(pr,{children:"Email"}),s.jsx(pr,{children:"Spécialités"}),s.jsx(pr,{children:"Statut"}),s.jsx(pr,{className:"text-right",children:"Vues"}),s.jsx(pr,{className:"text-right",title:"Vues de la fiche profil",children:"Profil"}),s.jsx(pr,{className:"text-right",title:"CV consultés",children:"CV"}),s.jsx(pr,{className:"text-right",title:"Liens (LinkedIn/site/email) cliqués",children:"Liens"}),s.jsx(pr,{className:"text-right",title:"Clics 'Contacter pour une formation'",children:"Contacts"})]})}),s.jsx(vh,{children:te().map(W=>{const Z=p.get(W.id);return s.jsxs(Oa,{children:[s.jsx(ur,{className:"font-medium",children:W.name}),s.jsx(ur,{children:W.email}),s.jsx(ur,{children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[W.specialties.slice(0,2).map((le,re)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:le},re)),W.specialties.length>2&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",W.specialties.length-2]})]})}),s.jsx(ur,{children:W.status==="approved"?s.jsx(Le,{variant:"default",children:"Validé"}):s.jsx(vt,{to:"/admin/trainers",className:"hover:opacity-80 transition-opacity",children:s.jsx(Le,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",children:"En attente"})})}),s.jsx(ur,{className:"text-right font-bold",children:W.view_count||0}),s.jsx(ur,{className:"text-right",children:(Z==null?void 0:Z.profileViews)||0}),s.jsx(ur,{className:"text-right",children:(Z==null?void 0:Z.cvViews)||0}),s.jsx(ur,{className:"text-right",children:(Z==null?void 0:Z.linkClicks)||0}),s.jsx(ur,{className:"text-right font-medium",children:(Z==null?void 0:Z.contacts)||0})]},W.id)})})]})})]})}),s.jsx(Es,{value:"offers",children:s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5"}),"Liste des Offres"]}),s.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mt-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher par établissement, description ou domaine...",value:P,onChange:W=>F(W.target.value),className:"pl-10"})]}),s.jsxs(Lr,{value:V,onValueChange:C,children:[s.jsx(Ar,{className:"w-40",children:s.jsx(Br,{placeholder:"Statut"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous"}),s.jsx(ot,{value:"active",children:"Actives"}),s.jsx(ot,{value:"filled",children:"Pourvues"}),s.jsx(ot,{value:"pending",children:"En attente"}),s.jsx(ot,{value:"archived",children:"Archivées"})]})]}),s.jsxs(Lr,{value:T,onValueChange:W=>k(W),children:[s.jsxs(Ar,{className:"w-48",children:[s.jsx(LO,{className:"h-4 w-4 mr-2"}),s.jsx(Br,{})]}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"views",children:"Par vues"}),s.jsx(ot,{value:"applications",children:"Par candidatures"}),s.jsx(ot,{value:"recent",children:"Plus récentes"})]})]})]})]}),s.jsx(Ae,{children:s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{children:"Établissement"}),s.jsx(pr,{children:"Domaines"}),s.jsx(pr,{children:"Statut"}),s.jsx(pr,{className:"text-right",children:"Vues"}),s.jsx(pr,{className:"text-right",children:"Candidatures"})]})}),s.jsx(vh,{children:Ue().map(W=>s.jsxs(Oa,{children:[s.jsx(ur,{children:s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:W.school_name}),s.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-1",children:[W.description.substring(0,50),"..."]})]})}),s.jsx(ur,{children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[W.subject_areas.slice(0,2).map((Z,le)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:Z},le)),W.subject_areas.length>2&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",W.subject_areas.length-2]})]})}),s.jsx(ur,{children:W.is_filled?s.jsx(Le,{className:"bg-green-500",children:"Pourvue"}):W.status==="approved"?s.jsx(Le,{children:"Active"}):s.jsx(Le,{variant:"secondary",children:W.status})}),s.jsx(ur,{className:"text-right font-bold",children:W.view_count||0}),s.jsx(ur,{className:"text-right font-bold",children:W.application_count||0})]},W.id))})]})})]})})]})]})})}function ogt(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState("pending"),[u,d]=w.useState(null),[f,m]=w.useState(new Set),[h,g]=w.useState(null),[p,x]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&v()},[t]);const v=async()=>{try{const[R,H]=await Promise.all([he.from("school_profiles").select("*").order("created_at",{ascending:!1}),he.from("school_requests").select("user_id")]);if(R.error)throw R.error;o(R.data||[]),m(new Set((H.data||[]).map(q=>q.user_id).filter(Boolean)))}catch(R){console.error("Error loading schools:",R),ae.error("Erreur lors du chargement des établissements")}finally{a(!1)}},b=async R=>{const H=R.contact_email;if(!H){ae.error("Aucun email de contact pour cet établissement");return}g(R.id);try{const{data:q,error:L}=await he.functions.invoke("send-school-nudge",{body:{to:H,schoolName:R.name,contactName:null}});if(L||!(q!=null&&q.success))throw L||new Error("Échec");ae.success(`Relance envoyée à ${R.name}`)}catch(q){console.error("Error nudging school:",q),ae.error("Erreur lors de l'envoi de la relance")}finally{g(null)}},y=async(R,H)=>{try{const{error:q}=await he.from("school_profiles").update({is_verified:H}).eq("id",R);if(q)throw q;ae.success(H?"Établissement vérifié !":"Vérification retirée"),v()}catch(q){console.error("Error updating verification:",q),ae.error("Erreur lors de la mise à jour")}},N=async R=>{const H=window.prompt("Motif du refus (optionnel — il pourra être communiqué à l'établissement) :","");if(H!==null)try{const{error:q}=await he.from("school_profiles").update({is_rejected:!0,is_verified:!1,rejection_reason:H.trim()||null,rejected_at:new Date().toISOString()}).eq("id",R);if(q)throw q;ae.success("Établissement refusé"),v()}catch(q){console.error("Error rejecting school:",q),ae.error("Erreur lors du refus")}},_=async R=>{try{const{error:H}=await he.from("school_profiles").update({is_rejected:!1,rejection_reason:null,rejected_at:null}).eq("id",R);if(H)throw H;ae.success("Établissement remis en attente"),v()}catch(H){console.error("Error restoring school:",H),ae.error("Erreur lors de la restauration")}},j=async R=>{if(window.confirm(`Supprimer définitivement l'établissement « ${R.name} » ?
Action irréversible. Pour seulement le masquer, utilisez plutôt « Refuser ».`)){x(R.id);try{const{data:H,error:q}=await he.from("school_profiles").delete().eq("id",R.id).select("id");if(q)throw q;if(!H||H.length===0){ae.error("Suppression impossible (permissions ou données liées). Utilisez « Refuser ».");return}ae.success("Établissement supprimé"),v()}catch(H){console.error("Error deleting school:",H),ae.error("Erreur : l'établissement a peut-être des offres/contrats liés. Utilisez « Refuser ».")}finally{x(null)}}},S=async(R,H)=>{try{const{error:q}=await he.from("school_profiles").update({can_auto_publish:H}).eq("id",R);if(q)throw q;ae.success(H?"Auto-publication activée !":"Auto-publication désactivée"),v()}catch(q){console.error("Error updating auto-publish:",q),ae.error("Erreur lors de la mise à jour")}},I=async(R,H)=>{if(H){if(!H.type.startsWith("image/")){ae.error("Veuillez sélectionner une image");return}if(H.size>2*1024*1024){ae.error("L'image ne doit pas dépasser 2 Mo");return}d(R);try{const q=H.name.split(".").pop(),L=`school-logos/${R}-${Date.now()}.${q}`,{error:M}=await he.storage.from("trainer-files").upload(L,H,{upsert:!0});if(M)throw M;const{data:z}=he.storage.from("trainer-files").getPublicUrl(L),{error:K}=await he.from("school_profiles").update({logo_url:z.publicUrl}).eq("id",R);if(K)throw K;ae.success("Logo mis à jour avec succès !"),v()}catch(q){console.error("Error uploading logo:",q),ae.error("Erreur lors de l'upload du logo")}finally{d(null)}}},P=R=>R.split(" ").map(H=>H[0]).join("").toUpperCase().slice(0,2),F=i.filter(R=>!R.is_verified&&!R.is_rejected),T=i.filter(R=>R.is_verified),k=i.filter(R=>R.is_rejected&&!R.is_verified),V=i.filter(R=>!R.is_rejected&&!f.has(R.user_id));if(r||n)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});const C=({school:R})=>s.jsx(ke,{className:"hover:shadow-lg transition-all",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(ps,{className:"w-16 h-16",children:[R.logo_url?s.jsx(vi,{src:R.logo_url,alt:R.name,className:"object-contain"}):null,s.jsx(gs,{className:"text-lg font-bold bg-primary text-primary-foreground",children:P(R.name)})]}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between mb-2",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[s.jsx(Vr,{className:"w-5 h-5 text-muted-foreground"}),R.name]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Inscrit le ",new Date(R.created_at).toLocaleDateString("fr-FR")]})]}),s.jsx(Le,{variant:R.is_verified?"default":R.is_rejected?"destructive":"secondary",children:R.is_verified?"Vérifié":R.is_rejected?"Refusé":"Non vérifié"})]}),R.is_rejected&&R.rejection_reason&&s.jsxs("p",{className:"text-sm text-destructive mb-3",children:["Motif du refus : ",R.rejection_reason]}),R.description&&s.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:R.description}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 mb-4 text-sm",children:[R.contact_email&&s.jsxs("a",{href:`mailto:${R.contact_email}`,className:"flex items-center gap-2 text-muted-foreground hover:text-primary transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),s.jsx("span",{children:R.contact_email})]}),R.contact_phone&&s.jsxs("a",{href:`tel:${R.contact_phone}`,className:"flex items-center gap-2 text-muted-foreground hover:text-primary transition-colors",children:[s.jsx(Yy,{className:"w-4 h-4"}),s.jsx("span",{children:R.contact_phone})]}),R.website_url&&s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Ky,{className:"w-4 h-4"}),s.jsx("a",{href:R.website_url,target:"_blank",rel:"noopener noreferrer",className:"hover:text-primary truncate",children:R.website_url})]}),R.address&&s.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[s.jsx(Gs,{className:"w-4 h-4"}),s.jsx("span",{className:"truncate",children:R.address})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-3 mb-4",children:[s.jsxs(vt,{to:`/admin/school/${R.id}`,className:"flex items-center gap-2 text-sm text-primary hover:underline",children:[s.jsx(Vr,{className:"w-4 h-4"}),"Voir le profil complet",s.jsx(vs,{className:"w-3 h-3"})]}),s.jsxs(vt,{to:"/admin/training-requests",className:"flex items-center gap-2 text-sm text-primary hover:underline",children:[s.jsx(as,{className:"w-4 h-4"}),"Voir les offres",s.jsx(vs,{className:"w-3 h-3"})]})]}),s.jsx("div",{className:"mb-4",children:s.jsx(uy,{query:R.name,title:"Documents Drive (établissement)"})}),s.jsxs("div",{className:"mb-4 p-3 bg-muted/50 border rounded-md",children:[s.jsx(We,{htmlFor:`logo-${R.id}`,className:"text-sm font-medium mb-2 block",children:"Logo de l'établissement"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ye,{id:`logo-${R.id}`,type:"file",accept:"image/*",disabled:u===R.id,onChange:H=>{var L;const q=(L=H.target.files)==null?void 0:L[0];q&&I(R.id,q)},className:"flex-1"}),u===R.id&&s.jsx(at,{className:"w-5 h-5 animate-spin text-primary"})]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Format: JPG, PNG. Taille max: 2 Mo"})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[R.is_verified?s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>y(R.id,!1),children:[s.jsx(Fs,{className:"w-4 h-4 mr-2"}),"Retirer la vérification"]}):s.jsxs(ne,{size:"sm",onClick:()=>y(R.id,!0),className:"bg-green-600 hover:bg-green-700",children:[s.jsx(ma,{className:"w-4 h-4 mr-2"}),"Vérifier"]}),!R.is_verified&&(R.is_rejected?s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>_(R.id),children:[s.jsx(ma,{className:"w-4 h-4 mr-2"}),"Remettre en attente"]}):s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>N(R.id),children:[s.jsx(Fs,{className:"w-4 h-4 mr-2"}),"Refuser"]})),s.jsx(ne,{size:"sm",variant:R.can_auto_publish?"default":"outline",onClick:()=>S(R.id,!R.can_auto_publish),children:R.can_auto_publish?"✓ Auto-publication activée":"Activer auto-publication"}),s.jsxs(ne,{size:"sm",variant:"outline",className:"ml-auto text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive",disabled:p===R.id,onClick:()=>j(R),children:[p===R.id?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(bi,{className:"w-4 h-4 mr-2"}),"Supprimer"]})]})]})]})})},R.id);return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsx(sa,{items:[{label:"Établissements"}]}),V.length>0&&s.jsxs(ke,{className:"mb-6 border-amber-300 bg-amber-50/60",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsxs(xt,{className:"text-lg flex items-center gap-2 text-amber-800",children:[s.jsx(as,{className:"w-5 h-5"}),"À relancer : ",V.length," établissement(s) inscrit(s) sans aucune offre"]}),s.jsx("p",{className:"text-sm text-amber-700",children:"Ces établissements se sont inscrits mais n'ont publié aucune offre. Relancez-les par email pour les activer."})]}),s.jsx(Ae,{children:s.jsx("div",{className:"space-y-2",children:V.map(R=>s.jsxs("div",{className:"flex items-center justify-between gap-3 p-3 rounded-md border bg-background",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-medium truncate",children:R.name}),s.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[R.contact_email||"Aucun email de contact"," · inscrit le"," ",new Date(R.created_at).toLocaleDateString("fr-FR")]})]}),s.jsxs(ne,{size:"sm",variant:"outline",disabled:!R.contact_email||h===R.id,onClick:()=>b(R),children:[h===R.id?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"Relancer"]})]},R.id))})})]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{className:"text-3xl",children:"Gestion des Établissements"}),s.jsx("p",{className:"text-muted-foreground",children:`Vérifiez les profils des établissements pour qu'ils apparaissent dans la section "Ils nous ont fait confiance"`})]}),s.jsx(Ae,{children:s.jsxs(af,{value:l,onValueChange:c,children:[s.jsxs(ad,{className:"grid w-full grid-cols-3 mb-6",children:[s.jsxs(In,{value:"pending",children:["Non vérifiés (",F.length,")"]}),s.jsxs(In,{value:"verified",children:["Vérifiés (",T.length,")"]}),s.jsxs(In,{value:"rejected",children:["Refusés (",k.length,")"]})]}),s.jsx(Es,{value:"pending",className:"space-y-4",children:F.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun établissement en attente de vérification"}):F.map(R=>s.jsx(C,{school:R},R.id))}),s.jsx(Es,{value:"verified",className:"space-y-4",children:T.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun établissement vérifié"}):T.map(R=>s.jsx(C,{school:R},R.id))}),s.jsx(Es,{value:"rejected",className:"space-y-4",children:k.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucun établissement refusé"}):k.map(R=>s.jsx(C,{school:R},R.id))})]})})]})]})})}function lgt(){const e=Xt(),{id:t}=wo(),{isAdmin:r,loading:n}=Ur(),[a,i]=w.useState(!0),[o,l]=w.useState(null),[c,u]=w.useState([]);w.useEffect(()=>{!n&&!r&&e("/auth")},[r,n,e]),w.useEffect(()=>{r&&t&&d()},[r,t]);const d=async()=>{if(t)try{const{data:g,error:p}=await he.from("school_profiles").select("*").eq("id",t).single();if(p)throw p;l(g);const{data:x,error:v}=await he.from("school_requests").select("*").eq("user_id",g.user_id).order("created_at",{ascending:!1});if(v)throw v;u(x||[])}catch(g){console.error("Error loading school data:",g),ae.error("Erreur lors du chargement du profil")}finally{i(!1)}},f=g=>g.split(" ").map(p=>p[0]).join("").toUpperCase().slice(0,2),m=g=>{switch(g){case"approved":return s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(ma,{className:"w-3 h-3 mr-1"}),"Approuvée"]});case"pending":return s.jsx(Le,{variant:"secondary",children:"En attente"});case"rejected":return s.jsxs(Le,{variant:"destructive",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Rejetée"]});case"archived":return s.jsx(Le,{variant:"outline",children:"Archivée"});default:return s.jsx(Le,{variant:"outline",children:g})}};if(n||a)return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})});if(!o)return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-4xl text-center",children:[s.jsx("p",{className:"text-muted-foreground",children:"Établissement non trouvé"}),s.jsxs(ne,{onClick:()=>e("/admin/schools"),className:"mt-4",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"Retour"]})]})});const h={totalOffers:c.length,approvedOffers:c.filter(g=>g.status==="approved").length,totalViews:c.reduce((g,p)=>g+(p.view_count||0),0),totalApplications:c.reduce((g,p)=>g+(p.application_count||0),0)};return s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsx(sa,{items:[{label:"Établissements",href:"/admin/schools"},{label:o.name}]}),s.jsx("div",{className:"flex items-center gap-4 mb-6",children:s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>e("/admin/schools"),children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"Retour"]})}),s.jsx(ke,{className:"mb-6",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-6",children:[s.jsxs(ps,{className:"w-24 h-24",children:[o.logo_url?s.jsx(vi,{src:o.logo_url,alt:o.name,className:"object-contain"}):null,s.jsx(gs,{className:"text-2xl font-bold bg-primary text-primary-foreground",children:f(o.name)})]}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between mb-3",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold flex items-center gap-3",children:o.name}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Inscrit le ",new Date(o.created_at).toLocaleDateString("fr-FR")]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Le,{variant:o.is_verified?"default":"secondary",children:o.is_verified?"✓ Vérifié":"Non vérifié"}),o.can_auto_publish&&s.jsx(Le,{variant:"default",className:"bg-blue-600",children:"Auto-publication activée"})]})]}),o.description&&s.jsx("p",{className:"text-muted-foreground mb-4",children:o.description}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[o.contact_email&&s.jsxs("a",{href:`mailto:${o.contact_email}`,className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-primary transition-colors",children:[s.jsx(Fn,{className:"w-4 h-4"}),s.jsx("span",{children:o.contact_email})]}),o.contact_phone&&s.jsxs("a",{href:`tel:${o.contact_phone}`,className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-primary transition-colors",children:[s.jsx(Yy,{className:"w-4 h-4"}),s.jsx("span",{children:o.contact_phone})]}),o.website_url&&s.jsxs("a",{href:o.website_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-primary transition-colors",children:[s.jsx(Ky,{className:"w-4 h-4"}),s.jsx("span",{className:"truncate",children:o.website_url})]}),o.address&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Gs,{className:"w-4 h-4"}),s.jsx("span",{children:o.address})]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:s.jsx(as,{className:"h-5 w-5 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:h.totalOffers}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Offres totales"})]})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-green-500/10 rounded-lg",children:s.jsx(ma,{className:"h-5 w-5 text-green-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:h.approvedOffers}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Offres approuvées"})]})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg",children:s.jsx(is,{className:"h-5 w-5 text-blue-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:h.totalViews}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Vues totales"})]})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg",children:s.jsx(sr,{className:"h-5 w-5 text-purple-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:h.totalApplications}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Candidatures"})]})]})})})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(as,{className:"h-5 w-5"}),"Offres de formation (",c.length,")"]})}),s.jsx(Ae,{children:c.length===0?s.jsx("p",{className:"text-center text-muted-foreground py-8",children:"Aucune offre publiée"}):s.jsx("div",{className:"space-y-4",children:c.map(g=>s.jsx(ke,{className:"hover:shadow-md transition-all",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("h3",{className:"font-semibold text-lg",children:g.school_name}),m(g.status),g.is_sponsored&&s.jsx(Le,{variant:"default",className:"bg-yellow-600",children:"Sponsorisée"})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:g.description}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:g.subject_areas.map((p,x)=>s.jsx(Le,{variant:"outline",children:p},x))}),s.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"w-4 h-4"}),new Date(g.created_at).toLocaleDateString("fr-FR")]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(is,{className:"w-4 h-4"}),g.view_count||0," vues"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(sr,{className:"w-4 h-4"}),g.application_count||0," candidatures"]})]})]}),s.jsx(vt,{to:`/training-offers/${g.id}`,children:s.jsx(ne,{variant:"outline",size:"sm",children:"Voir l'offre"})})]})})},g.id))})})]})]})})}function cgt(){const{data:e,isLoading:t}=ga({queryKey:["admin-school-reviews"],queryFn:async()=>{const{data:r,error:n}=await he.from("school_reviews").select(`
*,
trainer_profiles:trainer_profile_id(name, email),
school_requests:school_request_id(school_name, contact_name)
`).order("created_at",{ascending:!1});if(n)throw n;return r}});return t?s.jsx("div",{className:"container mx-auto py-8",children:s.jsx("p",{children:"Chargement des avis..."})}):s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Avis des Formateurs sur les Établissements - Admin",description:"Dashboard admin pour consulter les avis et notes laissés par les formateurs sur les établissements après leurs missions."}),s.jsxs("div",{className:"container mx-auto py-8",children:[s.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Avis des Formateurs sur les Établissements"}),!e||e.length===0?s.jsx(ke,{children:s.jsx(Ae,{className:"py-8 text-center text-muted-foreground",children:"Aucun avis pour le moment"})}):s.jsx("div",{className:"space-y-4",children:e.map(r=>{var n,a,i,o;return s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{children:[s.jsx(xt,{className:"text-lg",children:((n=r.school_requests)==null?void 0:n.school_name)||"Établissement inconnu"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Contact: ",(a=r.school_requests)==null?void 0:a.contact_name]})]}),s.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(l=>s.jsx(iu,{className:`w-5 h-5 ${l<=r.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},l))})]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Formateur:"}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[((i=r.trainer_profiles)==null?void 0:i.name)||"Inconnu"," (",(o=r.trainer_profiles)==null?void 0:o.email,")"]})]}),r.comment&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"Commentaire:"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:r.comment})]}),s.jsx("div",{className:"text-xs text-muted-foreground pt-2 border-t",children:Ot(new Date(r.created_at),"d MMMM yyyy 'à' HH:mm",{locale:yr})})]})})]},r.id)})})]})]})}function ugt(){var N,_;const{isAdmin:e}=Ur(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState(""),[c,u]=w.useState("all"),[d,f]=w.useState(null),[m,h]=w.useState(null);w.useEffect(()=>{if(!e){t("/");return}g()},[e,t]);const g=async()=>{i(!0);try{const{data:j,error:S}=await he.from("invoices").select(`
*,
trainer_profile:trainer_profiles(name),
school_request:school_requests(school_name, description)
`).order("created_at",{ascending:!1});if(S)throw S;n(j||[])}catch(j){console.error("Error loading invoices:",j),ae.error("Erreur lors du chargement des factures")}finally{i(!1)}},p=async(j,S)=>{try{const I={status:S};S==="sent"?(I.issued_at=new Date().toISOString(),I.due_at=new Date(Date.now()+30*24*60*60*1e3).toISOString()):S==="paid"&&(I.paid_at=new Date().toISOString());const{error:P}=await he.from("invoices").update(I).eq("id",j);if(P)throw P;n(F=>F.map(T=>T.id===j?{...T,...I}:T)),ae.success("Statut mis à jour")}catch(I){console.error("Error updating invoice:",I),ae.error("Erreur lors de la mise à jour")}},x=async j=>{h(j);try{const{data:S,error:I}=await he.functions.invoke("sync-invoice-tiime",{body:{invoiceId:j}});if(I)throw I;if(S!=null&&S.success)ae.success("Facture synchronisée avec Tiime"),g();else throw new Error((S==null?void 0:S.error)||"Erreur de synchronisation")}catch(S){console.error("Error syncing to Tiime:",S),ae.error(S.message||"Erreur de synchronisation Tiime")}finally{h(null)}},v=j=>{switch(j){case"paid":return s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Payée"]});case"sent":return s.jsxs(Le,{className:"bg-blue-500",children:[s.jsx(ta,{className:"w-3 h-3 mr-1"}),"Envoyée"]});case"overdue":return s.jsxs(Le,{variant:"destructive",children:[s.jsx(Di,{className:"w-3 h-3 mr-1"}),"En retard"]});case"draft":default:return s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"Brouillon"]})}},b=r.filter(j=>{var P;const S=j.invoice_number.toLowerCase().includes(o.toLowerCase())||j.client_name.toLowerCase().includes(o.toLowerCase())||((P=j.trainer_profile)==null?void 0:P.name.toLowerCase().includes(o.toLowerCase())),I=c==="all"||j.status===c;return S&&I}),y={total:r.length,draft:r.filter(j=>j.status==="draft").length,sent:r.filter(j=>j.status==="sent").length,paid:r.filter(j=>j.status==="paid").length,totalAmount:r.filter(j=>j.status!=="draft").reduce((j,S)=>j+S.amount_ttc,0),paidAmount:r.filter(j=>j.status==="paid").reduce((j,S)=>j+S.amount_ttc,0)};return a?s.jsx(xa,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsx(xa,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(sa,{items:[{label:"Factures"}]}),s.jsxs("div",{className:"mb-8",children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(Gt,{className:"h-8 w-8 text-primary"}),"Gestion des factures"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Gérez les factures pour les missions avec formateurs affiliés"})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total factures"}),s.jsx("p",{className:"text-2xl font-bold",children:y.total})]}),s.jsx(Gt,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Brouillons"}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:y.draft})]}),s.jsx(Gr,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"CA facturé"}),s.jsxs("p",{className:"text-2xl font-bold text-blue-600",children:[y.totalAmount.toFixed(2),"€"]})]}),s.jsx(Gy,{className:"h-8 w-8 text-blue-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"CA encaissé"}),s.jsxs("p",{className:"text-2xl font-bold text-green-600",children:[y.paidAmount.toFixed(2),"€"]})]}),s.jsx(Wr,{className:"h-8 w-8 text-green-500 opacity-80"})]})})})]}),s.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher par numéro, client ou formateur...",value:o,onChange:j=>l(j.target.value),className:"pl-10"})]}),s.jsxs(Lr,{value:c,onValueChange:u,children:[s.jsx(Ar,{className:"w-48",children:s.jsx(Br,{placeholder:"Statut"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les statuts"}),s.jsx(ot,{value:"draft",children:"Brouillons"}),s.jsx(ot,{value:"sent",children:"Envoyées"}),s.jsx(ot,{value:"paid",children:"Payées"})]})]}),s.jsxs(ne,{variant:"outline",onClick:g,children:[s.jsx(yo,{className:"h-4 w-4 mr-2"}),"Actualiser"]})]}),b.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(Gt,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("p",{className:"text-muted-foreground",children:r.length===0?"Aucune facture créée pour le moment":"Aucune facture ne correspond à votre recherche"})]})}):s.jsx(ke,{children:s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{children:"N° Facture"}),s.jsx(pr,{children:"Client"}),s.jsx(pr,{children:"Formateur"}),s.jsx(pr,{className:"text-right",children:"Montant TTC"}),s.jsx(pr,{children:"Statut"}),s.jsx(pr,{children:"Tiime"}),s.jsx(pr,{className:"text-right",children:"Actions"})]})}),s.jsx(vh,{children:b.map(j=>{var S,I;return s.jsxs(Oa,{children:[s.jsx(ur,{className:"font-medium",children:j.invoice_number}),s.jsx(ur,{children:s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:j.client_name}),s.jsxs("a",{href:`mailto:${j.client_email}`,className:"text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1",children:[s.jsx(Fn,{className:"w-3 h-3"}),j.client_email]})]})}),s.jsx(ur,{children:s.jsxs(vt,{to:"/admin/trainers",className:"hover:text-primary transition-colors flex items-center gap-1",children:[((S=j.trainer_profile)==null?void 0:S.name)||"-",((I=j.trainer_profile)==null?void 0:I.name)&&s.jsx(vs,{className:"w-3 h-3 opacity-50"})]})}),s.jsxs(ur,{className:"text-right font-bold",children:[j.amount_ttc.toFixed(2),"€"]}),s.jsx(ur,{children:v(j.status)}),s.jsx(ur,{children:j.tiime_invoice_id?s.jsxs(Le,{variant:"outline",className:"bg-green-50 text-green-700",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Sync"]}):j.tiime_sync_error?s.jsxs(Le,{variant:"outline",className:"bg-red-50 text-red-700",children:[s.jsx(Di,{className:"w-3 h-3 mr-1"}),"Erreur"]}):s.jsx(Le,{variant:"outline",children:"Non sync"})}),s.jsx(ur,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>f(j),children:"Voir"}),!j.tiime_invoice_id&&s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>x(j.id),disabled:m===j.id,children:m===j.id?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(vs,{className:"h-4 w-4 mr-1"}),"Tiime"]})})]})})]},j.id)})})]})}),s.jsx(Hn,{open:!!d,onOpenChange:()=>f(null),children:s.jsxs(qn,{className:"max-w-2xl",children:[s.jsxs(Gn,{children:[s.jsxs(Kn,{children:["Facture ",d==null?void 0:d.invoice_number]}),s.jsx(Ia,{children:"Détails de la facture"})]}),d&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold mb-2 flex items-center gap-2",children:[s.jsx(MO,{className:"h-4 w-4"}),"Client"]}),s.jsx("p",{className:"font-medium",children:d.client_name}),s.jsx("p",{className:"text-sm text-muted-foreground",children:d.client_email})]}),s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold mb-2 flex items-center gap-2",children:[s.jsx(qo,{className:"h-4 w-4"}),"Formateur"]}),s.jsx("p",{children:((N=d.trainer_profile)==null?void 0:N.name)||"-"})]})]}),s.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"TJM"}),s.jsxs("span",{children:[d.tjm.toFixed(2),"€"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Heures totales"}),s.jsxs("span",{children:[d.total_hours,"h"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Calcul"}),s.jsxs("span",{className:"text-muted-foreground",children:[d.tjm,"€ / 7 × ",d.total_hours,"h"]})]}),s.jsx("hr",{}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Montant HT"}),s.jsxs("span",{children:[d.amount_ht.toFixed(2),"€"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"TVA (20%)"}),s.jsxs("span",{children:[d.amount_tva.toFixed(2),"€"]})]}),s.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[s.jsx("span",{children:"Total TTC"}),s.jsxs("span",{children:[d.amount_ttc.toFixed(2),"€"]})]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Statut"}),v(d.status)]}),d.issued_at&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Émise le"}),s.jsx("p",{children:Ot(new Date(d.issued_at),"dd MMM yyyy",{locale:yr})})]}),d.due_at&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Échéance"}),s.jsx("p",{children:Ot(new Date(d.due_at),"dd MMM yyyy",{locale:yr})})]})]}),s.jsx(uy,{query:((_=d.trainer_profile)==null?void 0:_.name)||d.client_name||"",title:"Documents Drive liés",defaultOpen:!0}),d.tiime_sync_error&&s.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:s.jsxs("p",{className:"text-sm text-red-700",children:[s.jsx(Di,{className:"h-4 w-4 inline mr-1"}),"Erreur Tiime: ",d.tiime_sync_error]})})]}),s.jsxs(Jl,{children:[(d==null?void 0:d.status)==="draft"&&s.jsxs(ne,{onClick:()=>{p(d.id,"sent"),f(null)},children:[s.jsx(ta,{className:"h-4 w-4 mr-2"}),"Marquer comme envoyée"]}),(d==null?void 0:d.status)==="sent"&&s.jsxs(ne,{className:"bg-green-600 hover:bg-green-700",onClick:()=>{p(d.id,"paid"),f(null)},children:[s.jsx(Wr,{className:"h-4 w-4 mr-2"}),"Marquer comme payée"]})]})]})})]})})}function _K(){var T;const e=Xt(),[t]=Bj(),[r,n]=w.useState([]),[a,i]=w.useState([]),[o,l]=w.useState(new Set),[c,u]=w.useState(!0),[d,f]=w.useState(t.get("search")||""),[m,h]=w.useState(t.get("specialty")||"all"),[g,p]=w.useState("all"),[x,v]=w.useState(!1),[b,y]=w.useState(!1),N=async k=>{try{await he.rpc("increment_trainer_view",{trainer_id:k})}catch(V){console.error("Error incrementing view count:",V)}},_=(k,V,C,R)=>{xi.trackSocialLinkClick(k,V,C),window.open(R,"_blank","noopener,noreferrer")},j=async(k,V)=>{try{await navigator.clipboard.writeText(V),xi.trackNameCopied(k,V),ae.success("Nom copié dans le presse-papier")}catch{ae.error("Erreur lors de la copie")}};w.useEffect(()=>{(async()=>{var V;try{const[C,R]=await Promise.all([he.rpc("get_public_trainer_profiles"),he.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0)]);if(C.error)throw C.error;const H=new Set(((V=R.data)==null?void 0:V.map(L=>L.trainer_id))||[]);l(H);const q=Hm(C.data||[],H);n(q),i(q)}catch(C){console.error("Error fetching trainers:",C)}finally{u(!1)}})()},[]),w.useEffect(()=>{let k=[...r];if(d){const C=d.toLowerCase();k=k.filter(R=>{var H;return R.name.toLowerCase().includes(C)||((H=R.bio)==null?void 0:H.toLowerCase().includes(C))||R.specialties.some(q=>q.toLowerCase().includes(C))})}if(m&&m!=="all"){const C=m.toLowerCase();k=k.filter(R=>R.specialties.some(H=>{const q=H.toLowerCase();return q===C||q.includes(C)||C.includes(q)}))}g&&g!=="all"&&(k=k.filter(C=>{var R;return(R=C.preferred_departments)==null?void 0:R.includes(g)}));const V=d.trim()||(m!=="all"?m:"");i(Hm(k,o,V))},[d,m,g,r,o]);const S=()=>{const k=new Set;return r.forEach(V=>{V.specialties.forEach(C=>k.add(C))}),Array.from(k).sort()},I=()=>{const k=new Set;return r.forEach(V=>{var C;(C=V.preferred_departments)==null||C.forEach(R=>k.add(R))}),Array.from(k).sort()},P=k=>k.split(" ").map(V=>V[0]).join("").toUpperCase().slice(0,2),F=()=>{f(""),h("all"),p("all")};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Formateurs Experts Certifiés",description:"Découvrez nos formateurs experts certifiés dans tous les domaines : informatique, management, langues, et plus. Des professionnels qualifiés pour vos formations.",url:"/trainers",keywords:["formateurs certifiés","experts formation","formateurs professionnels"]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-background py-8 md:py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"text-center max-w-3xl mx-auto",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 bg-primary/10 text-primary px-3 py-1.5 sm:px-4 sm:py-2 rounded-full mb-4 md:mb-6",children:[s.jsx(sr,{className:"h-4 w-4"}),s.jsxs("span",{className:"text-xs sm:text-sm font-medium",children:[r.length," formateurs experts"]})]}),s.jsx("h1",{className:"text-2xl sm:text-4xl md:text-5xl font-bold mb-3 md:mb-4",children:"Nos Formateurs"}),s.jsx("p",{className:"text-base sm:text-lg md:text-xl text-muted-foreground px-2",children:"Des experts passionnés, chacun dans son domaine d'excellence, prêts à transmettre leur savoir"})]})})}),s.jsx("div",{className:"bg-emerald-50 dark:bg-emerald-950/20 border-b border-emerald-100 dark:border-emerald-900 py-3 px-4",children:s.jsxs("div",{className:"container mx-auto flex flex-col sm:flex-row items-center justify-between gap-2 max-w-5xl",children:[s.jsxs("p",{className:"text-sm text-emerald-800 dark:text-emerald-200",children:[s.jsx("span",{className:"font-semibold",children:"Formateurs :"})," obtenez votre Numéro de Déclaration d'Activité (NDA) avec l'aide de PedagoBridge."]}),s.jsx("button",{type:"button",onClick:()=>e("/assistance-nda"),className:"text-xs font-semibold text-emerald-700 dark:text-emerald-300 underline underline-offset-2 hover:no-underline whitespace-nowrap shrink-0",children:"En savoir plus →"})]})}),s.jsx("section",{className:"py-4 md:py-8 border-b bg-background sticky top-16 z-30",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[s.jsxs("div",{className:"relative w-full",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher par nom, compétence...",value:d,onChange:k=>f(k.target.value),className:"pl-10"})]}),s.jsxs("div",{className:"grid grid-cols-2 md:flex md:flex-row gap-2 md:gap-4",children:[s.jsxs(rp,{open:x,onOpenChange:v,children:[s.jsx(np,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":x,className:"w-full md:w-[220px] justify-between text-xs sm:text-sm",children:[s.jsx(hR,{className:"h-4 w-4 mr-1 sm:mr-2 shrink-0"}),s.jsx("span",{className:"truncate",children:m==="all"?"Spécialité":m.length>12?m.slice(0,12)+"...":m}),s.jsx(n2,{className:"ml-1 sm:ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(fh,{className:"w-[250px] p-0",align:"start",children:s.jsxs(ap,{children:[s.jsx(ip,{placeholder:"Rechercher une spécialité..."}),s.jsxs(op,{children:[s.jsx(lp,{children:"Aucune spécialité trouvée"}),s.jsxs(Jf,{children:[s.jsxs(Bu,{value:"all",onSelect:()=>{h("all"),v(!1)},children:[s.jsx(Pn,{className:pt("mr-2 h-4 w-4",m==="all"?"opacity-100":"opacity-0")}),"Toutes les spécialités"]}),S().map(k=>s.jsxs(Bu,{value:k,onSelect:()=>{h(k),v(!1)},children:[s.jsx(Pn,{className:pt("mr-2 h-4 w-4",m===k?"opacity-100":"opacity-0")}),k]},k))]})]})]})})]}),s.jsxs(rp,{open:b,onOpenChange:y,children:[s.jsx(np,{asChild:!0,children:s.jsxs(ne,{variant:"outline",role:"combobox","aria-expanded":b,className:"w-full md:w-[200px] justify-between text-xs sm:text-sm",children:[s.jsx(Gs,{className:"h-4 w-4 mr-1 sm:mr-2 shrink-0"}),s.jsx("span",{className:"truncate",children:g==="all"?"Département":((T=tv(g))==null?void 0:T.slice(0,10))+"..."}),s.jsx(n2,{className:"ml-1 sm:ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),s.jsx(fh,{className:"w-[280px] p-0",align:"start",children:s.jsxs(ap,{children:[s.jsx(ip,{placeholder:"Rechercher un département..."}),s.jsxs(op,{children:[s.jsx(lp,{children:"Aucun département trouvé"}),s.jsxs(Jf,{children:[s.jsxs(Bu,{value:"all",onSelect:()=>{p("all"),y(!1)},children:[s.jsx(Pn,{className:pt("mr-2 h-4 w-4",g==="all"?"opacity-100":"opacity-0")}),"Tous les départements"]}),I().map(k=>s.jsxs(Bu,{value:`${k} ${tv(k)}`,onSelect:()=>{p(k),y(!1)},children:[s.jsx(Pn,{className:pt("mr-2 h-4 w-4",g===k?"opacity-100":"opacity-0")}),k," - ",tv(k)]},k))]})]})]})})]}),(d||m!=="all"||g!=="all")&&s.jsx(ne,{variant:"ghost",onClick:F,className:"col-span-2 md:col-span-1",children:"Réinitialiser"})]})]})})}),s.jsx("section",{className:"py-8 md:py-12 bg-background",children:s.jsx("div",{className:"container mx-auto px-4",children:c?s.jsx("div",{className:"flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):a.length===0?s.jsxs("div",{className:"text-center py-12 md:py-16",children:[s.jsx(sr,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("h3",{className:"text-lg md:text-xl font-semibold mb-2",children:"Aucun formateur trouvé"}),s.jsx("p",{className:"text-muted-foreground mb-4 text-sm md:text-base",children:"Essayez de modifier vos critères de recherche"}),s.jsx(ne,{onClick:F,variant:"outline",children:"Réinitialiser les filtres"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-4 md:mb-6 text-sm md:text-base text-muted-foreground",children:[a.length," formateur",a.length>1?"s":""," trouvé",a.length>1?"s":""]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 md:gap-6",children:s.jsx(Og,{children:a.map(k=>s.jsx(ke,{className:"hover:shadow-lg transition-all duration-300 border-border/50 group overflow-hidden",children:s.jsx(Ae,{className:"p-4 sm:p-6",children:s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsxs(ps,{className:"w-20 h-20 sm:w-24 sm:h-24 mb-3 sm:mb-4 ring-4 ring-background shadow-lg",children:[k.photo_url?s.jsx(vi,{src:k.photo_url,alt:k.name}):null,s.jsx(gs,{className:"text-2xl font-bold bg-primary text-primary-foreground",children:P(k.name)})]}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 justify-center flex-wrap mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("h3",{className:"text-lg sm:text-xl font-bold group-hover:text-primary transition-colors",children:k.name}),s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:V=>{V.stopPropagation(),j(k.id,k.name)},children:s.jsx(Qv,{className:"h-3 w-3"})})}),s.jsx(Rd,{children:"Copier le nom"})]})]}),k.isAffiliated&&s.jsx(Zd,{size:"sm"}),s.jsx(Pae,{country:k.country}),s.jsx(Rne,{level:k.english_level||null})]}),(k.linkedin_url||k.website_url||k.email)&&s.jsxs("div",{className:"flex gap-2 mb-3",children:[k.email&&s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:V=>{V.stopPropagation(),xi.trackSocialLinkClick(k.id,"email",k.name),window.location.href=`mailto:${k.email}`},children:s.jsx(Fn,{className:"h-4 w-4 text-muted-foreground"})})}),s.jsx(Rd,{children:k.email})]}),k.linkedin_url&&s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:V=>{V.stopPropagation(),_(k.id,"linkedin",k.name,k.linkedin_url)},children:s.jsx(Mu,{className:"h-4 w-4 text-[#0077B5]"})})}),s.jsx(Rd,{children:"LinkedIn"})]}),k.website_url&&s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:s.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:V=>{V.stopPropagation(),_(k.id,"website",k.name,k.website_url)},children:s.jsx(Ky,{className:"h-4 w-4 text-primary"})})}),s.jsx(Rd,{children:"Site web"})]})]}),k.preferred_departments&&k.preferred_departments.length>0&&s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-3",children:[s.jsx(Gs,{className:"h-3 w-3"}),s.jsxs("span",{children:[k.preferred_departments.slice(0,3).map(V=>tv(V)||V).join(", "),k.preferred_departments.length>3&&` +${k.preferred_departments.length-3}`]})]}),k.bio&&s.jsx("p",{className:"text-muted-foreground mb-4 text-sm line-clamp-3",children:k.bio}),s.jsxs("div",{className:"flex flex-wrap gap-2 justify-center mb-4",children:[k.specialties.slice(0,4).map((V,C)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:V},C)),k.specialties.length>4&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",k.specialties.length-4]})]}),s.jsx(ne,{variant:"outline",className:"w-full",onClick:()=>{N(k.id),e(`/trainers/${k.id}`)},children:"Voir le profil"})]})})},k.id))})})]})})})]})}function dgt({size:e="md"}){const t={sm:"text-xs px-1.5 py-0.5",md:"text-sm px-2 py-1",lg:"text-base px-3 py-1.5"},r={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return s.jsx(Og,{children:s.jsxs(Vf,{children:[s.jsx(Wf,{asChild:!0,children:s.jsxs(Le,{variant:"outline",className:`${t[e]} bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300 dark:border-emerald-800`,children:[s.jsx(Vc,{className:`${r[e]} mr-1`}),"NDA Vérifié"]})}),s.jsx(Rd,{children:s.jsx("p",{children:"Numéro de déclaration d'activité vérifié par PedagoBridge"})})]})})}function NK(){const{id:e}=wo(),t=Xt(),{user:r}=Ur(),[n,a]=w.useState(null),[i,o]=w.useState(null),[l,c]=w.useState(!0),[u,d]=w.useState(!1);w.useEffect(()=>{(async()=>{var h,g,p;if(!e){d(!0),c(!1);return}try{const[x,v,b]=await Promise.all([he.rpc("get_public_trainer_profiles"),he.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),he.from("trainer_documents").select("trainer_profile_id").eq("document_type","nda_proof").eq("status","verified")]);if(x.error)throw x.error;const y=new Set(((h=v.data)==null?void 0:h.map(j=>j.trainer_id))||[]),N=new Set(((g=b.data)==null?void 0:g.map(j=>j.trainer_profile_id))||[]),_=(p=x.data)==null?void 0:p.find(j=>j.id===e);_?(a({..._,isAffiliated:y.has(_.id)||!!_.manual_certified,hasVerifiedNDA:N.has(_.id)}),xi.trackProfileView(_.id,_.name)):d(!0)}catch(x){console.error("Error fetching trainer:",x),d(!0)}finally{c(!1)}})()},[e]),w.useEffect(()=>{let m=!1;return n&&r&&(n.cv_path||n.cv_url)?V6(n).then(h=>{m||o(h)}):o(null),()=>{m=!0}},[n,r]);const f=m=>m.split(" ").map(h=>h[0]).join("").toUpperCase().slice(0,2);return l?s.jsx("div",{className:"min-h-screen bg-background",children:s.jsx("div",{className:"container mx-auto px-4 py-16",children:s.jsx("div",{className:"flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})})}):u||!n?s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:"Formateur non trouvé",description:"Ce profil de formateur n'existe pas ou n'est plus disponible.",noindex:!0}),s.jsx("div",{className:"container mx-auto px-4 py-16",children:s.jsxs("div",{className:"text-center py-16",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Formateur non trouvé"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Ce profil n'existe pas ou n'est plus disponible."}),s.jsxs(ne,{onClick:()=>t("/trainers"),children:[s.jsx(Yn,{className:"h-4 w-4 mr-2"}),"Retour aux formateurs"]})]})})]}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:`${n.name} - Formateur Expert`,description:n.bio||`Découvrez le profil de ${n.name}, formateur expert spécialisé en ${n.specialties.slice(0,3).join(", ")}.`,url:`/trainer/${e}`,type:"profile",keywords:n.specialties,image:n.photo_url||void 0}),s.jsx(u1,{name:n.name,description:n.bio||void 0,image:n.photo_url||void 0,knowsAbout:n.specialties,url:`/trainer/${e}`}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Formateurs",url:"/trainers"},{name:n.name,url:`/trainer/${e}`}]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-background py-8",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs(ne,{variant:"ghost",onClick:()=>t("/trainers"),className:"mb-6",children:[s.jsx(Yn,{className:"h-4 w-4 mr-2"}),"Retour aux formateurs"]})})}),s.jsx("section",{className:"py-8",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsx(ke,{className:"overflow-hidden",children:s.jsx(Ae,{className:"p-8",children:s.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[s.jsx("div",{className:"flex flex-col items-center md:items-start",children:s.jsxs(ps,{className:"w-32 h-32 ring-4 ring-background shadow-lg",children:[n.photo_url?s.jsx(vi,{src:n.photo_url,alt:n.name}):null,s.jsx(gs,{className:"text-3xl font-bold bg-primary text-primary-foreground",children:f(n.name)})]})}),s.jsxs("div",{className:"flex-1 text-center md:text-left",children:[s.jsxs("div",{className:"flex items-center gap-3 flex-wrap justify-center md:justify-start",children:[s.jsx("h1",{className:"text-3xl font-bold",children:n.name}),n.isAffiliated&&s.jsx(Zd,{size:"lg"}),n.hasVerifiedNDA&&s.jsx(dgt,{size:"md"})]}),n.bio&&s.jsx("p",{className:"text-muted-foreground mb-6 text-lg",children:n.bio}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Domaines d'expertise"}),s.jsx("div",{className:"flex flex-wrap gap-2 justify-center md:justify-start",children:n.specialties.map((m,h)=>s.jsx(Le,{variant:"secondary",className:"text-sm",children:m},h))})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center md:justify-start",children:[i&&s.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",onClick:()=>xi.trackCVDownload(n.id,n.name),className:"inline-flex items-center justify-center h-10 px-4 text-sm font-medium rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors",children:[s.jsx(Gt,{className:"w-4 h-4 mr-2"}),"Voir le CV",s.jsx(vs,{className:"w-3 h-3 ml-2"})]}),s.jsxs(ne,{onClick:()=>{xi.trackContactClick(n.id,n.name),t(`/training-request?from_trainer=${n.id}&trainer_name=${encodeURIComponent(n.name)}`)},children:[s.jsx(Fn,{className:"h-4 w-4 mr-2"}),"Contacter pour une formation"]})]})]})]})})}),s.jsx(ke,{className:"mt-6",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-center gap-8",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-primary",children:n.view_count}),s.jsx("div",{className:"text-sm text-muted-foreground",children:"Vues du profil"})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-primary",children:n.specialties.length}),s.jsx("div",{className:"text-sm text-muted-foreground",children:"Domaines d'expertise"})]})]})})})]})})})]})}function fgt(){return s.jsxs(ke,{className:"border-amber-200 bg-gradient-to-br from-amber-50/50 to-background dark:from-amber-950/20",children:[s.jsxs(ht,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(pv,{className:"h-6 w-6 text-amber-500"}),s.jsx(xt,{className:"text-lg",children:"Boostez la visibilité de vos offres"})]}),s.jsx(Qr,{children:"Sponsorisez vos offres pour les mettre en avant auprès des formateurs"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("h4",{className:"font-semibold flex items-center gap-2",children:[s.jsx(pv,{className:"h-4 w-4 text-amber-500"}),"Avantages du sponsoring"]}),s.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(Kd,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),s.jsx("span",{children:"Position prioritaire dans les résultats de recherche"})]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(is,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),s.jsx("span",{children:'Badge "Offre sponsorisée" pour plus de visibilité'})]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(Fj,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),s.jsxs("span",{children:[s.jsx("strong",{children:"49€ pour 30 jours"})," de mise en avant"]})]})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("h4",{className:"font-semibold flex items-center gap-2",children:[s.jsx(Uo,{className:"h-4 w-4 text-primary"}),"Règles de pertinence"]}),s.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"font-bold text-amber-500 shrink-0",children:"1."}),s.jsxs("span",{children:[s.jsx("strong",{children:"Offres sponsorisées"})," : toujours affichées en premier"]})]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"font-bold text-primary shrink-0",children:"2."}),s.jsxs("span",{children:[s.jsx("strong",{children:"Correspondance spécialités"})," : les offres matchant les compétences du formateur"]})]}),s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"font-bold text-muted-foreground shrink-0",children:"3."}),s.jsxs("span",{children:[s.jsx("strong",{children:"Date de publication"})," : les plus récentes en priorité"]})]})]})]})]}),s.jsxs("div",{className:"p-3 bg-green-50 dark:bg-green-950/30 rounded-lg border border-green-200/50",children:[s.jsxs("h4",{className:"font-semibold text-sm flex items-center gap-2 mb-2",children:[s.jsx(ma,{className:"h-4 w-4 text-green-600"}),"Offre pourvue ? Gardez vos jours !"]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Si votre offre sponsorisée est pourvue avant la fin des 30 jours, vous pouvez ",s.jsx("strong",{children:"transférer les jours restants"}),' vers une autre offre active. Utilisez le bouton "Transférer" pour déplacer le sponsoring.']})]}),s.jsxs("div",{className:"p-3 bg-amber-100/50 dark:bg-amber-950/30 rounded-lg border border-amber-200/50",children:[s.jsxs("h4",{className:"font-semibold text-sm flex items-center gap-2 mb-2",children:[s.jsx(yo,{className:"h-4 w-4 text-amber-600"}),"Prolonger votre sponsoring"]}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Vous pouvez ",s.jsx("strong",{children:"prolonger une offre déjà sponsorisée"})," à tout moment. Les 30 jours supplémentaires s'ajouteront à la période restante."]})]}),s.jsx("div",{className:"mt-4 p-3 bg-muted/50 rounded-lg",children:s.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.jsx("strong",{children:"Comment ça marche ?"})," Les formateurs voient d'abord vos offres sponsorisées, puis celles qui correspondent à leurs spécialités. Plus vos domaines correspondent aux compétences des formateurs, plus votre offre sera visible. Le sponsoring garantit une visibilité maximale pendant 30 jours."]})})]})]})}function hgt(){const{user:e}=Ur(),[t,r]=w.useState([]),[n,a]=w.useState(!0),[i,o]=w.useState(null),[l,c]=w.useState(null);w.useRef(null),w.useEffect(()=>{e&&u()},[e]);const u=async()=>{if(e){a(!0);try{const{data:h}=await he.from("school_requests").select("id").eq("user_id",e.id);if(!h||h.length===0){r([]),a(!1);return}const g=h.map(b=>b.id),{data:p,error:x}=await he.from("service_contracts").select(`
id,
status,
created_at,
signed_by_school,
signed_by_school_at,
school_contract_url,
contract_data,
trainer_application_id,
school_request_id
`).in("school_request_id",g).order("created_at",{ascending:!1});if(x)throw x;const v=[];for(const b of p||[]){const{data:y}=await he.from("trainer_applications").select("id, trainer_id").eq("id",b.trainer_application_id).single();if(!y)continue;const{data:N}=await he.from("trainer_profiles").select("id, name, email").eq("id",y.trainer_id).single(),{data:_}=await he.from("school_requests").select("id, school_name, description, training_needs").eq("id",b.school_request_id).single();N&&_&&v.push({...b,school_contract_url:b.school_contract_url||null,contract_data:b.contract_data,trainer_application:{id:y.id,trainer:N},school_request:_})}r(v)}catch(h){console.error("Error loading contracts:",h),ae.error("Erreur lors du chargement des contrats")}finally{a(!1)}}},d=(h,g)=>h==="signed"&&g?s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Signé"]}):h==="signed"?s.jsxs(Le,{className:"bg-blue-500",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente signature"]}):s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"Brouillon"]}),f=async(h,g)=>{if(e){if(g.type!=="application/pdf"){ae.error("Seuls les fichiers PDF sont acceptés");return}if(g.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}c(h);try{const p=`${e.id}/${h}/${Date.now()}_${g.name}`,{data:x,error:v}=await he.storage.from("school-attachments").upload(p,g,{upsert:!0});if(v)throw v;const{data:b}=he.storage.from("school-attachments").getPublicUrl(p),{error:y}=await he.from("service_contracts").update({school_contract_url:b.publicUrl}).eq("id",h);if(y)throw y;ae.success("Contrat téléversé avec succès"),u()}catch(p){console.error("Error uploading contract:",p),ae.error("Erreur lors du téléversement du contrat")}finally{c(null)}}},m=h=>{const g=document.createElement("input");g.type="file",g.accept=".pdf",g.onchange=p=>{var v;const x=(v=p.target.files)==null?void 0:v[0];x&&f(h,x)},g.click()};return n?s.jsx("div",{className:"flex justify-center items-center py-12",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):t.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(Gt,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Aucun contrat de prestation"}),s.jsx("p",{className:"text-muted-foreground",children:"Les contrats seront créés automatiquement lorsque vous accepterez des candidatures de formateurs affiliés."})]})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"space-y-4",children:t.map(h=>s.jsx(ke,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ae,{className:"py-4",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"font-semibold",children:h.contract_data.trainerName}),s.jsx(Zd,{}),d(h.status,h.signed_by_school)]}),s.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Vr,{className:"h-4 w-4"}),h.school_request.school_name]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-4 w-4"}),Ot(new Date(h.created_at),"d MMM yyyy",{locale:yr})]})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:h.school_request.description}),h.contract_data.tjm&&s.jsxs("p",{className:"text-sm font-medium text-primary",children:["TJM: ",h.contract_data.tjm,"€ HT"]})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[h.school_contract_url?s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>window.open(h.school_contract_url,"_blank"),children:[s.jsx(Ho,{className:"h-4 w-4 mr-1"}),"Contrat école"]}):s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>m(h.id),disabled:l===h.id,children:[l===h.id?s.jsx(at,{className:"h-4 w-4 mr-1 animate-spin"}):s.jsx(nc,{className:"h-4 w-4 mr-1"}),"Ajouter contrat"]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>o(h),children:[s.jsx(is,{className:"h-4 w-4 mr-1"}),"Voir"]})]})]})})},h.id))}),s.jsx(Hn,{open:!!i,onOpenChange:()=>o(null),children:s.jsxs(qn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Contrat de prestation"}),s.jsxs(Ia,{children:["Détails du contrat avec ",i==null?void 0:i.contract_data.trainerName]})]}),i&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Formateur"}),s.jsx("p",{className:"font-medium",children:i.contract_data.trainerName})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Établissement"}),s.jsx("p",{className:"font-medium",children:i.contract_data.schoolName})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Statut"}),d(i.status,i.signed_by_school)]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Date de création"}),s.jsx("p",{className:"font-medium",children:Ot(new Date(i.created_at),"d MMMM yyyy",{locale:yr})})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Description de la formation"}),s.jsx("p",{children:i.contract_data.trainingDescription})]}),i.contract_data.tjm&&s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"TJM"}),s.jsxs("p",{className:"font-medium text-primary",children:[i.contract_data.tjm,"€ HT"]})]}),i.contract_data.totalHours&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Heures totales"}),s.jsxs("p",{className:"font-medium",children:[i.contract_data.totalHours,"h"]})]})]}),s.jsxs("div",{className:"border rounded-lg p-4",children:[s.jsx("p",{className:"text-sm font-medium mb-3",children:"Contrat de l'école"}),i.school_contract_url?s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[s.jsx(Wr,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm",children:"Contrat téléversé"})]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>window.open(i.school_contract_url,"_blank"),children:[s.jsx(vs,{className:"h-4 w-4 mr-1"}),"Voir le contrat"]})]}):s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Téléversez votre contrat PDF à destination de Qalam"}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>m(i.id),disabled:l===i.id,children:[l===i.id?s.jsx(at,{className:"h-4 w-4 mr-1 animate-spin"}):s.jsx(nc,{className:"h-4 w-4 mr-1"}),"Ajouter contrat"]})]})]}),i.signed_by_school&&i.signed_by_school_at&&s.jsxs("div",{className:"p-4 bg-green-50 dark:bg-green-900/20 rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 text-green-700 dark:text-green-300",children:[s.jsx(Wr,{className:"h-5 w-5"}),s.jsx("span",{className:"font-medium",children:"Contrat signé"})]}),s.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 mt-1",children:["Signé le ",Ot(new Date(i.signed_by_school_at),"d MMMM yyyy à HH:mm",{locale:yr})]})]})]})]})})]})}function mgt({onImport:e,trigger:t}){const[r,n]=w.useState(!1),[a,i]=w.useState(""),[o,l]=w.useState(!1),[c,u]=w.useState(!1),[d,f]=w.useState(null),[m,h]=w.useState(!0);w.useEffect(()=>{r&&g()},[r]),w.useEffect(()=>{const b=y=>{var N,_;((N=y.data)==null?void 0:N.type)==="linkedin-connected"&&((_=y.data)!=null&&_.success)&&(g(),ae.success("LinkedIn connecté avec succès !"))};return window.addEventListener("message",b),()=>window.removeEventListener("message",b)},[]);const g=async()=>{h(!0);try{const{data:b}=await he.auth.getSession(),y=b==null?void 0:b.session;if(!y)return;const _=await(await fetch("https://pedagobridge.com/functions/v1/user-linkedin-oauth?action=status",{headers:{Authorization:`Bearer ${y.access_token}`}})).json();u(_.connected),f(_.profile)}catch(b){console.error("Error checking LinkedIn connection:",b)}finally{h(!1)}},p=async()=>{try{const{data:b}=await he.auth.getSession(),y=b==null?void 0:b.session;if(!y){ae.error("Veuillez vous connecter");return}const _=await(await fetch("https://pedagobridge.com/functions/v1/user-linkedin-oauth?action=authorize",{headers:{Authorization:`Bearer ${y.access_token}`}})).json();_.authUrl&&window.open(_.authUrl,"_blank","width=600,height=700")}catch(b){console.error("Error connecting LinkedIn:",b),ae.error("Erreur lors de la connexion LinkedIn")}},x=async()=>{try{const{data:b}=await he.auth.getSession(),y=b==null?void 0:b.session;if(!y)return;await fetch("https://pedagobridge.com/functions/v1/user-linkedin-oauth?action=disconnect",{method:"POST",headers:{Authorization:`Bearer ${y.access_token}`}}),u(!1),f(null),ae.success("LinkedIn déconnecté")}catch(b){console.error("Error disconnecting LinkedIn:",b)}},v=async()=>{if(!a.trim()){ae.error("Veuillez coller le texte du post LinkedIn");return}l(!0);try{const{data:b}=await he.auth.getSession(),y=b==null?void 0:b.session;if(!y){ae.error("Session expirée");return}const N=await fetch("https://pedagobridge.com/functions/v1/extract-offer-from-linkedin",{method:"POST",headers:{Authorization:`Bearer ${y.access_token}`,"Content-Type":"application/json"},body:JSON.stringify({postText:a})});if(!N.ok){const j=await N.json();throw new Error(j.error||"Erreur lors de l'extraction")}const _=await N.json();_.offer?(e(_.offer),n(!1),i(""),ae.success("Informations extraites avec succès !")):ae.error("Impossible d'extraire les informations du post")}catch(b){console.error("Error extracting offer:",b),ae.error(b instanceof Error?b.message:"Erreur lors de l'extraction")}finally{l(!1)}};return s.jsxs(Hn,{open:r,onOpenChange:n,children:[s.jsx(ml,{asChild:!0,children:t||s.jsxs(ne,{variant:"outline",className:"gap-2",children:[s.jsx(Mu,{className:"h-4 w-4 text-[#0077B5]"}),"Importer depuis LinkedIn"]})}),s.jsxs(qn,{className:"sm:max-w-lg",children:[s.jsxs(Gn,{children:[s.jsxs(Kn,{className:"flex items-center gap-2",children:[s.jsx(Mu,{className:"h-5 w-5 text-[#0077B5]"}),"Importer depuis LinkedIn"]}),s.jsx(Ia,{children:"Collez le texte d'un post LinkedIn pour pré-remplir automatiquement votre offre"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[s.jsx("div",{className:"flex items-center gap-3",children:m?s.jsx(at,{className:"h-4 w-4 animate-spin"}):c?s.jsxs(s.Fragment,{children:[d!=null&&d.picture?s.jsx("img",{src:d.picture,alt:d.name||"LinkedIn",className:"w-8 h-8 rounded-full"}):s.jsx(s2,{className:"h-5 w-5 text-green-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:(d==null?void 0:d.name)||"Connecté"}),s.jsx(Le,{variant:"secondary",className:"text-xs",children:"LinkedIn connecté"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Mu,{className:"h-5 w-5 text-muted-foreground"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"Non connecté"})]})}),!m&&s.jsx(ne,{variant:c?"ghost":"outline",size:"sm",onClick:c?x:p,className:c?"":"text-[#0077B5] border-[#0077B5]",children:c?"Déconnecter":"Connecter"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"postText",children:"Texte du post LinkedIn"}),s.jsx(gn,{id:"postText",value:a,onChange:b=>i(b.target.value),placeholder:`Copiez-collez ici le texte complet de votre post LinkedIn...\r
\r
Exemple:\r
🎓 Nous recherchons un formateur React.js !\r
\r
📍 Paris - Présentiel\r
📅 Du 15 janvier au 15 mars 2025\r
⏱️ 35 heures\r
\r
Vous êtes expert React et souhaitez transmettre vos connaissances ?`,className:"min-h-[200px]"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"L'IA analysera le texte pour extraire automatiquement les informations de l'offre"})]}),s.jsx(ne,{onClick:v,disabled:o||!a.trim(),className:"w-full",children:o?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Analyse en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Uo,{className:"mr-2 h-4 w-4"}),"Extraire les informations"]})})]})]})]})}function pgt({hasProfile:e,hasOffers:t,hasApplications:r}){const n=Xt(),a=[{done:e,icon:Vr,title:"Complétez votre profil",description:"Ajoutez le site web, l'adresse et une description de votre établissement.",cta:"Compléter mon profil",action:()=>n("/school/profile")},{done:t,icon:Gt,title:"Publiez votre première offre",description:"Décrivez le formateur dont vous avez besoin : domaine, dates, niveau.",cta:"Publier une offre",action:()=>n("/school/dashboard")},{done:r,icon:sr,title:"Recevez et sélectionnez des candidatures",description:"Consultez les profils des formateurs qui postulent et échangez via la messagerie.",cta:"Voir les candidatures",action:()=>n("/school/applications")}],i=a.filter(o=>o.done).length;return i===a.length?null:s.jsxs(ke,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-transparent mb-6",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Uo,{className:"h-5 w-5 text-primary"}),s.jsx(xt,{className:"text-base",children:"Démarrez en 3 étapes"})]}),s.jsxs("span",{className:"text-sm text-muted-foreground font-medium",children:[i,"/",a.length," complétées"]})]}),s.jsx("div",{className:"w-full bg-muted rounded-full h-1.5 mt-2",children:s.jsx("div",{className:"bg-primary h-1.5 rounded-full transition-all",style:{width:`${i/a.length*100}%`}})})]}),s.jsx(Ae,{className:"space-y-3",children:a.map((o,l)=>{const c=o.icon;return s.jsxs("div",{className:`flex items-start gap-3 p-3 rounded-lg transition-colors ${o.done?"opacity-50":"bg-background border"}`,children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:o.done?s.jsx(Wr,{className:"h-5 w-5 text-green-500"}):s.jsx(uR,{className:"h-5 w-5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx(c,{className:"h-4 w-4 text-primary shrink-0"}),s.jsx("p",{className:`text-sm font-medium ${o.done?"line-through":""}`,children:o.title})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:o.description})]}),!o.done&&s.jsxs(ne,{size:"sm",variant:"outline",className:"shrink-0 text-xs h-8",onClick:o.action,children:[o.cta,s.jsx(Mn,{className:"ml-1 h-3 w-3"})]})]},l)})})]})}function SK(){const{user:e,isSchool:t}=Ur(),r=Xt(),[n,a]=w.useState([]),[i,o]=w.useState(!0),[l,c]=w.useState({totalOffers:0,activeOffers:0,totalViews:0,pendingOffers:0,unreadMessages:0}),[u,d]=w.useState("active"),[f,m]=w.useState(!1),[h,g]=w.useState(null),[p,x]=w.useState(!1),[v,b]=w.useState(null),{canPublish:y,publicationCount:N,remainingFree:_,pricePerPublication:j,freeLimit:S}=lle();w.useEffect(()=>{if(!e){r("/auth?role=school");return}I()},[e,r]);const I=async()=>{if(e){o(!0);try{const{data:A}=await he.from("school_profiles").select("*").eq("user_id",e.id).single();b(A);const{data:O,error:U}=await he.from("school_requests").select("*").eq("user_id",e.id).order("created_at",{ascending:!1});if(U)throw U;const{data:Y,error:J}=await he.from("school_requests").select("*").is("user_id",null).eq("contact_email",e.email).order("created_at",{ascending:!1});if(J)throw J;const ee=[...O||[],...Y||[]].filter((le,re,oe)=>re===oe.findIndex(fe=>fe.id===le.id));a(ee);const ie=new Date;ie.setHours(0,0,0,0);const Ee=ee.length||0,te=ee.filter(le=>{if(le.status!=="approved"||le.is_filled)return!1;if(!le.end_date)return!0;const re=new Date(le.end_date);return re.setHours(23,59,59,999),re>=ie}).length||0,Ue=ee.filter(le=>le.status==="pending").length||0,W=ee.reduce((le,re)=>le+(re.view_count||0),0)||0,{count:Z}=await he.from("offer_messages").select("*",{count:"exact",head:!0}).eq("recipient_id",e.id).eq("is_read",!1);c({totalOffers:Ee,activeOffers:te,totalViews:W,pendingOffers:Ue,unreadMessages:Z||0})}catch(A){console.error("Error loading data:",A),ae.error("Erreur lors du chargement des données")}finally{o(!1)}}},P=async A=>{try{const{error:O}=await he.from("school_requests").update({user_id:e==null?void 0:e.id}).eq("id",A).is("user_id",null);if(O)throw O;ae.success("Offre associée à votre compte !"),I()}catch(O){console.error("Error claiming offer:",O),ae.error("Erreur lors de l'association de l'offre")}},F=async A=>{try{const{error:O}=await he.from("school_requests").delete().eq("id",A).eq("user_id",e==null?void 0:e.id);if(O)throw O;ae.success("Annonce supprimée"),I()}catch(O){console.error("Error deleting request:",O),ae.error("Erreur lors de la suppression")}},T=async A=>{try{const{error:O}=await he.from("school_requests").update({is_filled:!0,filled_at:new Date().toISOString(),status:"archived"}).eq("id",A).eq("user_id",e==null?void 0:e.id);if(O)throw O;ae.success("Offre marquée comme pourvue"),I()}catch(O){console.error("Error marking as filled:",O),ae.error("Erreur lors de la mise à jour")}},k=async A=>{try{const{error:O}=await he.from("school_requests").update({status:"archived"}).eq("id",A).eq("user_id",e==null?void 0:e.id);if(O)throw O;ae.success("Offre archivée avec succès"),I()}catch(O){console.error("Error archiving offer:",O),ae.error("Erreur lors de l'archivage")}},V=async A=>{if(e)try{const{data:O,error:U}=await he.from("school_requests").insert({school_name:A.school_name,contact_name:A.contact_name,contact_email:A.contact_email,contact_phone:A.contact_phone,description:A.description,subject_areas:A.subject_areas,training_needs:A.training_needs,start_date:A.start_date,end_date:A.end_date,duration_hours:A.duration_hours,num_trainers:A.num_trainers,estimated_budget:A.estimated_budget,budget_range:A.budget_range,tjm_offered:A.tjm_offered,modality:A.modality,city:A.city,address:A.address,documents:A.documents,user_id:e.id,status:"pending",view_count:0,application_count:0,is_filled:!1,is_sponsored:!1,is_first_validated:!1}).select().single();if(U)throw U;ae.success("Offre dupliquée avec succès ! Elle est en attente de validation."),I()}catch(O){console.error("Error duplicating offer:",O),ae.error("Erreur lors de la duplication de l'offre")}},C=()=>{try{const A=["École","Description","Domaines","Date début","Date fin","Statut","Vues","Candidatures","Pourvue","Sponsorisée","Date création"],O=E.map(ee=>[ee.school_name,ee.description.replace(/"/g,'""').replace(/\n/g," "),ee.subject_areas.join("; "),ee.start_date?Ot(new Date(ee.start_date),"dd/MM/yyyy"):"",ee.end_date?Ot(new Date(ee.end_date),"dd/MM/yyyy"):"",ee.status,ee.view_count||0,ee.application_count||0,ee.is_filled?"Oui":"Non",q(ee)?"Oui":"Non",Ot(new Date(ee.created_at),"dd/MM/yyyy HH:mm",{locale:yr})]),U=[A.map(ee=>`"${ee}"`).join(","),...O.map(ee=>ee.map(ie=>`"${ie}"`).join(","))].join(`
`),Y=new Blob(["\uFEFF"+U],{type:"text/csv;charset=utf-8;"}),J=document.createElement("a"),se=URL.createObjectURL(Y);J.setAttribute("href",se),J.setAttribute("download",`offres_${u}_${Ot(new Date,"yyyy-MM-dd")}.csv`),J.style.visibility="hidden",document.body.appendChild(J),J.click(),document.body.removeChild(J),ae.success("Export CSV réussi !")}catch(A){console.error("Error exporting to CSV:",A),ae.error("Erreur lors de l'export CSV")}},R=()=>{try{const A=new or,O=A.internal.pageSize.getWidth(),U=A.internal.pageSize.getHeight(),Y=15;let J=Y;A.setFontSize(18),A.setFont("helvetica","bold"),A.text("Mes Offres de Formation",Y,J),J+=10,A.setFontSize(10),A.setFont("helvetica","normal");const se={active:"Actives",pending:"En attente",history:"Historique"};A.text(`${se[u]||u} - Exporté le ${Ot(new Date,"dd/MM/yyyy à HH:mm",{locale:yr})}`,Y,J),J+=15,E.forEach((ee,ie)=>{J>U-50&&(A.addPage(),J=Y),A.setFontSize(12),A.setFont("helvetica","bold"),A.text(`${ie+1}. ${ee.school_name}`,Y,J),J+=7,A.setFontSize(9),A.setFont("helvetica","normal");const Ee=`Statut: ${ee.status}${ee.is_filled?" (Pourvue)":""}${q(ee)?" (Sponsorisée)":""}`;A.text(Ee,Y+5,J),J+=5;const te=ee.description.substring(0,150)+(ee.description.length>150?"...":""),Ue=A.splitTextToSize(te,O-Y*2-5);if(A.text(Ue,Y+5,J),J+=Ue.length*5,ee.subject_areas.length>0&&(A.text(`Domaines: ${ee.subject_areas.slice(0,3).join(", ")}${ee.subject_areas.length>3?"...":""}`,Y+5,J),J+=5),ee.start_date){const W=`Période: ${Ot(new Date(ee.start_date),"dd/MM/yyyy")}${ee.end_date?` - ${Ot(new Date(ee.end_date),"dd/MM/yyyy")}`:""}`;A.text(W,Y+5,J),J+=5}A.text(`Vues: ${ee.view_count||0} | Candidatures: ${ee.application_count||0}`,Y+5,J),J+=10}),A.save(`offres_${u}_${Ot(new Date,"yyyy-MM-dd")}.pdf`),ae.success("Export PDF réussi !")}catch(A){console.error("Error exporting to PDF:",A),ae.error("Erreur lors de l'export PDF")}},H=async A=>{try{const{data:O,error:U}=await he.functions.invoke("sponsor-offer",{body:{offerId:A}});if(U)throw U;O!=null&&O.url&&window.open(O.url,"_blank")}catch(O){console.error("Error sponsoring offer:",O),ae.error("Erreur lors de la création du paiement")}};w.useEffect(()=>{const O=new URLSearchParams(window.location.search).get("sponsored");O&&(he.functions.invoke("verify-sponsorship",{body:{offerId:O}}).then(({error:U})=>{U||(ae.success("Votre offre est maintenant sponsorisée pour 30 jours !"),I())}),window.history.replaceState({},"","/school/dashboard"))},[]);const q=A=>!A.is_sponsored||!A.sponsored_until?!1:new Date(A.sponsored_until)>new Date,L=A=>{if(!A.end_date)return!1;const O=new Date;O.setHours(0,0,0,0);const U=new Date(A.end_date);return U.setHours(23,59,59,999),U<O},M=async A=>{if(h){x(!0);try{if(!n.find(U=>U.id===A))throw new Error("Offre cible non trouvée");await he.from("school_requests").update({status:"archived",is_sponsored:!1,sponsored_at:null,sponsored_until:null}).eq("id",h.id),await he.from("school_requests").update({is_sponsored:!0,sponsored_at:h.sponsored_until?new Date().toISOString():null,sponsored_until:h.sponsored_until}).eq("id",A),ae.success("Sponsoring transféré avec succès ! L'ancienne offre a été archivée."),m(!1),g(null),I()}catch(O){console.error("Error swapping sponsorship:",O),ae.error("Erreur lors du transfert du sponsoring")}finally{x(!1)}}},z=()=>n.filter(A=>A.status==="approved"&&!A.is_filled&&!q(A)&&A.id!==(h==null?void 0:h.id)),K=A=>{if(A.is_filled)return s.jsxs(Le,{className:"bg-green-600",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Pourvue"]});switch(A.status){case"approved":return s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Publiée"]});case"pending":return s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]});case"rejected":return s.jsxs(Le,{variant:"destructive",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"archived":return s.jsx(Le,{variant:"outline",children:"Archivée"});default:return s.jsx(Le,{variant:"outline",children:A.status})}},E=n.filter(A=>{const O=L(A);return u==="active"?A.status==="approved"&&!A.is_filled&&!O:u==="pending"?A.status==="pending":u==="history"?["rejected","archived"].includes(A.status)||A.is_filled||A.status==="approved"&&O:!0});return i?s.jsx(xa,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsxs(xa,{children:[s.jsx(gr,{title:"Espace Établissement",description:"Gérez vos offres de formation et suivez les candidatures des formateurs.",noindex:!0}),s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-8",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(Vr,{className:"h-8 w-8 text-primary"}),"Mon Espace Établissement"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Gérez vos offres de formation et suivez leur performance"})]}),s.jsxs("div",{className:"flex flex-wrap gap-3 mt-4 md:mt-0",children:[s.jsxs(ne,{variant:"outline",onClick:()=>r("/school/applications"),children:[s.jsx(sr,{className:"mr-2 h-4 w-4"}),"Candidatures"]}),s.jsxs(ne,{variant:"outline",onClick:()=>r("/school/messages"),children:[s.jsx(zo,{className:"mr-2 h-4 w-4"}),"Messages",l.unreadMessages>0&&s.jsx(Le,{variant:"destructive",className:"ml-2",children:l.unreadMessages})]}),s.jsx(mgt,{onImport:A=>{sessionStorage.setItem("linkedInOfferData",JSON.stringify(A)),r("/training-request?source=linkedin")}}),s.jsxs(ne,{onClick:()=>r("/training-request"),disabled:!y,children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Nouvelle offre"]})]})]}),!y&&s.jsx("div",{className:"mb-6",children:s.jsx(cle,{publicationCount:N,pricePerPublication:j})}),y&&_>0&&N>0&&s.jsx(ke,{className:"mb-6 border-primary/20 bg-primary/5",children:s.jsx(Ae,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Di,{className:"h-5 w-5 text-primary"}),s.jsxs("p",{className:"text-sm",children:[s.jsxs("span",{className:"font-medium",children:[_," publication",_>1?"s":""," gratuite",_>1?"s":""," restante",_>1?"s":""]})," ","sur ",S,". Au-delà, chaque publication coûte ",j,"€."]})]})})}),s.jsx(pgt,{hasProfile:!!(v!=null&&v.website_url||v!=null&&v.contact_phone||v!=null&&v.address),hasOffers:n.length>0,hasApplications:l.totalApplications>0}),v&&s.jsxs(ke,{className:"mb-6 border-primary/20",children:[s.jsxs(ht,{className:"flex flex-row items-center justify-between",children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5 text-primary"}),"Profil de l'établissement"]}),s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>r("/school/profile"),children:"Modifier le profil"})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Nom de l'établissement"}),s.jsx("p",{className:"font-semibold",children:v.name})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Email de contact"}),s.jsx("p",{children:v.contact_email||"Non renseigné"})]}),v.contact_phone&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Téléphone"}),s.jsx("p",{children:v.contact_phone})]}),v.website_url&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Site web"}),s.jsxs("a",{href:v.website_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[v.website_url,s.jsx(JS,{className:"h-3 w-3"})]})]}),v.address&&s.jsxs("div",{className:"md:col-span-2",children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Adresse"}),s.jsx("p",{children:v.address})]}),v.description&&s.jsxs("div",{className:"md:col-span-2",children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Description"}),s.jsx("p",{className:"text-sm",children:v.description})]}),s.jsxs("div",{className:"md:col-span-2 flex items-center gap-2 pt-2",children:[s.jsx(Le,{variant:v.is_verified?"default":"secondary",children:v.is_verified?s.jsxs(s.Fragment,{children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Établissement vérifié"]}):s.jsxs(s.Fragment,{children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente de vérification"]})}),!v.is_verified&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Votre établissement sera vérifié par notre équipe sous 48h"})]})]})})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Offres actives"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:l.activeOffers})]}),s.jsx(Wr,{className:"h-8 w-8 text-green-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"En attente"}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:l.pendingOffers})]}),s.jsx(Gr,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Vues totales"}),s.jsx("p",{className:"text-2xl font-bold",children:l.totalViews})]}),s.jsx(is,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Messages"}),s.jsx("p",{className:"text-2xl font-bold",children:l.unreadMessages}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"non lus"})]}),s.jsx(zo,{className:"h-8 w-8 text-blue-500 opacity-80"})]})})})]}),s.jsx("div",{className:"mb-8",children:s.jsx(fgt,{})}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Hy,{className:"h-5 w-5"}),"Mes Offres de Formation"]}),s.jsx(Qr,{children:"Gérez et suivez vos offres publiées"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:C,disabled:E.length===0,children:[s.jsx(Ho,{className:"h-4 w-4 mr-2"}),"Export CSV"]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:R,disabled:E.length===0,children:[s.jsx(Gt,{className:"h-4 w-4 mr-2"}),"Export PDF"]})]})]})}),s.jsx(Ae,{children:s.jsxs(af,{value:u,onValueChange:d,children:[s.jsxs(ad,{className:"mb-6",children:[s.jsxs(In,{value:"active",children:["Actives (",n.filter(A=>A.status==="approved"&&!A.is_filled&&!L(A)).length,")"]}),s.jsxs(In,{value:"pending",children:["En attente (",n.filter(A=>A.status==="pending").length,")"]}),s.jsxs(In,{value:"history",children:["Historique (",n.filter(A=>["rejected","archived"].includes(A.status)||A.is_filled||A.status==="approved"&&L(A)).length,")"]}),s.jsxs(In,{value:"contracts",children:[s.jsx(Gt,{className:"h-4 w-4 mr-1"}),"Contrats"]})]}),s.jsx(Es,{value:u,children:E.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Vr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsxs("p",{className:"text-muted-foreground mb-4",children:[u==="active"&&"Aucune offre active pour le moment",u==="pending"&&"Aucune offre en attente de validation",u==="history"&&"Aucune offre dans l'historique"]}),u!=="history"&&s.jsxs(ne,{onClick:()=>r("/training-request"),children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Créer une offre"]})]}):s.jsx("div",{className:"space-y-4",children:E.map(A=>s.jsx(ke,{className:`hover:shadow-md transition-shadow ${q(A)?"ring-2 ring-amber-400 bg-amber-50/50 dark:bg-amber-950/20":""}`,children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-start gap-3 mb-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-semibold",children:A.school_name}),K(A),!A.user_id&&s.jsxs(Le,{variant:"outline",className:"border-blue-300 text-blue-600 bg-blue-50 dark:bg-blue-950/30",children:[s.jsx(JS,{className:"w-3 h-3 mr-1"}),"Non associée"]}),L(A)&&A.status==="approved"&&!A.is_filled&&s.jsxs(Le,{variant:"destructive",className:"bg-red-500",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"Expirée"]}),q(A)&&s.jsxs(Le,{className:"bg-amber-500 text-white",title:`Expire le ${Ot(new Date(A.sponsored_until),"dd MMM yyyy",{locale:yr})}`,children:[s.jsx(pv,{className:"w-3 h-3 mr-1"}),"Sponsorisée jusqu'au ",Ot(new Date(A.sponsored_until),"dd/MM",{locale:yr})]})]}),s.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2 mb-3",children:A.description}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[A.start_date&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-4 w-4"}),Ot(new Date(A.start_date),"dd MMM yyyy",{locale:yr}),A.end_date&&` - ${Ot(new Date(A.end_date),"dd MMM yyyy",{locale:yr})}`]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(is,{className:"h-4 w-4"}),A.view_count||0," vues"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(sr,{className:"h-4 w-4"}),A.application_count||0," candidatures"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[A.subject_areas.slice(0,3).map((O,U)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:O},U)),A.subject_areas.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",A.subject_areas.length-3]})]})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[!A.user_id&&s.jsxs(ne,{variant:"outline",size:"sm",className:"text-blue-600 border-blue-300 hover:bg-blue-50",onClick:()=>P(A.id),children:[s.jsx(JS,{className:"h-4 w-4 mr-1"}),"Associer à mon compte"]}),A.status==="approved"&&!A.is_filled&&!q(A)&&s.jsxs(ne,{variant:"outline",size:"sm",className:"text-amber-600 border-amber-300 hover:bg-amber-50",onClick:()=>H(A.id),children:[s.jsx(pv,{className:"h-4 w-4 mr-1"}),"Sponsoriser (49€)"]}),A.status==="approved"&&!A.is_filled&&q(A)&&s.jsxs(ne,{variant:"outline",size:"sm",className:"text-amber-600 border-amber-400 bg-amber-50 hover:bg-amber-100",onClick:()=>H(A.id),children:[s.jsx(pv,{className:"h-4 w-4 mr-1"}),"Prolonger (49€)"]}),A.status==="approved"&&!A.is_filled&&s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",className:"text-green-600",children:[s.jsx(Wr,{className:"h-4 w-4 mr-1"}),"Pourvue"]})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Marquer comme pourvue ?"}),s.jsx(Xc,{children:"Cette offre sera archivée et marquée comme pourvue. Confirmez-vous avoir trouvé un formateur ?"})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{onClick:()=>T(A.id),children:"Confirmer"})]})]})]}),A.status==="approved"&&!A.is_filled&&q(A)&&s.jsxs(ne,{variant:"outline",size:"sm",className:"text-amber-600 border-amber-300",onClick:()=>{g(A),m(!0)},children:[s.jsx(yo,{className:"h-4 w-4 mr-1"}),"Transférer"]}),A.status==="approved"&&!A.is_filled&&q(A)&&s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(gve,{className:"h-4 w-4 mr-1"}),"Archiver"]})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Archiver cette offre sponsorisée ?"}),s.jsx(Xc,{children:"Cette offre sponsorisée sera archivée. Vous pouvez transférer le sponsoring à une autre offre avant d'archiver."})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{onClick:()=>k(A.id),children:"Archiver sans transférer"})]})]})]}),s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>r(`/school/edit-offer/${A.id}`),disabled:A.status==="approved",children:s.jsx(QJ,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"outline",size:"sm",onClick:()=>V(A),title:"Dupliquer cette offre",children:s.jsx(Qv,{className:"h-4 w-4"})}),s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsx(ne,{variant:"outline",size:"sm",className:"text-destructive",children:s.jsx(bi,{className:"h-4 w-4"})})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Supprimer cette offre ?"}),s.jsx(Xc,{children:"Cette action est irréversible. L'offre sera définitivement supprimée."})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{onClick:()=>F(A.id),children:"Supprimer"})]})]})]})]})]})})},A.id))})}),s.jsx(Es,{value:"contracts",children:s.jsx(hgt,{})})]})})]}),s.jsx(Hn,{open:f,onOpenChange:m,children:s.jsxs(qn,{children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Transférer le sponsoring"}),s.jsx(Ia,{children:"L'offre actuelle sera archivée et le sponsoring sera transféré à l'offre sélectionnée."})]}),s.jsx("div",{className:"space-y-4 py-4",children:z().length===0?s.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucune autre offre approuvée disponible pour le transfert."}):z().map(A=>s.jsx(ke,{className:"cursor-pointer hover:border-primary transition-colors",onClick:()=>M(A.id),children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:A.school_name}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]}),p?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsx(yo,{className:"h-4 w-4 text-muted-foreground"})]})})},A.id))})]})})]})]})}function ggt(){const{user:e}=Ur(),t=Xt(),[r,n]=w.useState(!0),[a,i]=w.useState(!1),[o,l]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState({name:"",description:"",website_url:"",contact_name:"",contact_email:"",contact_phone:"",address:""});w.useEffect(()=>{if(!e){t("/auth?role=school");return}m()},[e,t]);const m=async()=>{if(e)try{const{data:x,error:v}=await he.from("school_profiles").select("*").eq("user_id",e.id).single();if(v)throw v;u(x),f({name:x.name||"",description:x.description||"",website_url:x.website_url||"",contact_name:x.contact_name||"",contact_email:x.contact_email||"",contact_phone:x.contact_phone||"",address:x.address||""})}catch(x){console.error("Error loading profile:",x),ae.error("Erreur lors du chargement du profil")}finally{n(!1)}},h=async x=>{if(!(!x||!c)){if(!x.type.startsWith("image/")){ae.error("Veuillez sélectionner une image");return}if(x.size>2*1024*1024){ae.error("L'image ne doit pas dépasser 2 Mo");return}l(!0);try{const v=x.name.split(".").pop(),b=`school-logos/${c.id}-${Date.now()}.${v}`,{error:y}=await he.storage.from("trainer-files").upload(b,x,{upsert:!0});if(y)throw y;const{data:N}=he.storage.from("trainer-files").getPublicUrl(b),{error:_}=await he.from("school_profiles").update({logo_url:N.publicUrl}).eq("id",c.id);if(_)throw _;ae.success("Logo mis à jour avec succès !"),m()}catch(v){console.error("Error uploading logo:",v),ae.error("Erreur lors de l'upload du logo")}finally{l(!1)}}},g=async x=>{if(x.preventDefault(),!!c){i(!0);try{const{error:v}=await he.from("school_profiles").update({name:d.name,description:d.description||null,website_url:d.website_url||null,contact_name:d.contact_name||null,contact_email:d.contact_email||null,contact_phone:d.contact_phone||null,address:d.address||null,updated_at:new Date().toISOString()}).eq("id",c.id);if(v)throw v;ae.success("Profil mis à jour avec succès !"),m()}catch(v){console.error("Error updating profile:",v),ae.error("Erreur lors de la mise à jour du profil")}finally{i(!1)}}},p=x=>x.split(" ").map(v=>v[0]).join("").toUpperCase().slice(0,2);return r?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):c?s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Mon Profil",description:"Gérez les informations de votre établissement",noindex:!0}),s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-4xl",children:[s.jsx("div",{className:"flex items-center gap-4 mb-6",children:s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>t("/school/dashboard"),children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"Retour au tableau de bord"]})}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"text-3xl flex items-center gap-3",children:[s.jsx(Vr,{className:"h-8 w-8 text-primary"}),"Profil de l'établissement"]}),s.jsx("p",{className:"text-muted-foreground",children:'Complétez les informations de votre établissement pour apparaître dans "Ils nous ont fait confiance"'})]}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:g,className:"space-y-6",children:[s.jsxs("div",{className:"flex flex-col items-center gap-4 p-6 bg-muted/50 rounded-lg",children:[s.jsxs(ps,{className:"w-32 h-32",children:[c.logo_url?s.jsx(vi,{src:c.logo_url,alt:c.name,className:"object-contain"}):null,s.jsx(gs,{className:"text-3xl font-bold bg-primary text-primary-foreground",children:p(c.name)})]}),s.jsxs("div",{className:"text-center",children:[s.jsx(We,{htmlFor:"logo-upload",className:"cursor-pointer",children:s.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary hover:underline",children:[s.jsx(nc,{className:"w-4 h-4"}),o?"Upload en cours...":"Changer le logo"]})}),s.jsx(Ye,{id:"logo-upload",type:"file",accept:"image/*",disabled:o,onChange:x=>{var b;const v=(b=x.target.files)==null?void 0:b[0];v&&h(v)},className:"hidden"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Format: JPG, PNG. Taille max: 2 Mo"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(We,{htmlFor:"name",children:["Nom de l'établissement ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(Ye,{id:"name",value:d.name,onChange:x=>f({...d,name:x.target.value}),required:!0,placeholder:"Ex: École Supérieure de Commerce"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"description",children:"Description"}),s.jsx(gn,{id:"description",value:d.description,onChange:x=>f({...d,description:x.target.value}),placeholder:"Présentez votre établissement en quelques lignes...",rows:4}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Cette description sera visible sur votre profil public"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contact_name",children:"Nom du contact"}),s.jsx(Ye,{id:"contact_name",value:d.contact_name,onChange:x=>f({...d,contact_name:x.target.value}),placeholder:"Ex: Jean Dupont"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Ce nom sera pré-rempli lors de vos demandes de formation"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contact_email",children:"Email de contact"}),s.jsx(Ye,{id:"contact_email",type:"email",value:d.contact_email,onChange:x=>f({...d,contact_email:x.target.value}),placeholder:"contact@ecole.fr"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contact_phone",children:"Téléphone"}),s.jsx(Ye,{id:"contact_phone",type:"tel",value:d.contact_phone,onChange:x=>f({...d,contact_phone:x.target.value}),placeholder:"01 23 45 67 89"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"website_url",children:"Site web"}),s.jsx(Ye,{id:"website_url",type:"url",value:d.website_url,onChange:x=>f({...d,website_url:x.target.value}),placeholder:"https://www.monecole.fr"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"address",children:"Adresse"}),s.jsx(gn,{id:"address",value:d.address,onChange:x=>f({...d,address:x.target.value}),placeholder:"123 Rue de l'Exemple, 75001 Paris",rows:2})]}),s.jsxs("div",{className:"flex gap-3 pt-4",children:[s.jsx(ne,{type:"button",variant:"outline",onClick:()=>t("/school/dashboard"),children:"Annuler"}),s.jsx(ne,{type:"submit",disabled:a,children:a?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}),"Enregistrement..."]}):"Enregistrer les modifications"})]})]})})]})]})})]}):s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx("p",{className:"text-muted-foreground",children:"Profil non trouvé"})})}function xgt(){const[e,t]=w.useState(!1),[r,n]=w.useState(!0),[a,i]=w.useState(null);w.useEffect(()=>{o()},[]);const o=async()=>{try{const{data:{user:u}}=await he.auth.getUser();if(!u){t(!1),n(!1);return}const{data:d,error:f}=await he.from("school_profiles").select("nda_signed_at").eq("user_id",u.id).single();if(f&&f.code!=="PGRST116")throw f;const m=!!(d!=null&&d.nda_signed_at);t(m),i((d==null?void 0:d.nda_signed_at)||null)}catch(u){console.error("Error checking NDA status:",u),t(!1)}finally{n(!1)}};return{hasSignedNDA:e,loading:r,ndaSignedAt:a,signNDA:async u=>{try{const{data:{user:d}}=await he.auth.getUser();if(!d)throw new Error("User not authenticated");const{error:f}=await he.from("school_profiles").update({nda_signed_at:new Date().toISOString(),nda_signature_data:u}).eq("user_id",d.id);if(f)throw f;return t(!0),i(new Date().toISOString()),{success:!0}}catch(d){return console.error("Error signing NDA:",d),{success:!1,error:d}}},refreshStatus:()=>{n(!0),o()}}}const vgt=`
ACCORD DE NON-DIVULGATION (NDA)
Entre :
- PedagoBridge, plateforme de mise en relation formateurs-établissements
- L'Établissement signataire
PRÉAMBULE
Dans le cadre de l'utilisation de la plateforme PedagoBridge, l'Établissement aura accès à des informations confidentielles concernant les formateurs inscrits, notamment ceux qui n'ont pas rendu leur profil public.
ARTICLE 1 - DÉFINITION DES INFORMATIONS CONFIDENTIELLES
Sont considérées comme confidentielles toutes les informations relatives aux formateurs, notamment :
- Coordonnées personnelles (email, téléphone, adresse)
- Curriculum vitae et parcours professionnel
- Compétences et spécialités
- Disponibilités et préférences de travail
- Conditions tarifaires
ARTICLE 2 - OBLIGATIONS DE L'ÉTABLISSEMENT
L'Établissement s'engage à :
a) Ne pas divulguer les informations confidentielles à des tiers
b) Ne pas utiliser ces informations à des fins autres que le recrutement de formateurs via la plateforme
c) Ne pas contacter les formateurs en dehors de la plateforme sans leur consentement explicite
d) Protéger les données conformément au RGPD
e) Ne pas transmettre, vendre ou partager les profils des formateurs
ARTICLE 3 - DURÉE
Cet accord est valable pendant toute la durée d'utilisation de la plateforme et 2 ans après la fin de l'utilisation.
ARTICLE 4 - SANCTIONS
En cas de non-respect de ces engagements :
- Suspension immédiate du compte
- Poursuites judiciaires possibles
- Dommages et intérêts
ARTICLE 5 - ACCEPTATION
En signant électroniquement ce document, l'Établissement reconnaît avoir lu, compris et accepté l'ensemble des conditions mentionnées ci-dessus.
`;function ygt({onSign:e,loading:t}){const r=w.useRef(null),[n,a]=w.useState(!1),[i,o]=w.useState(!1),[l,c]=w.useState(!1),[u,d]=w.useState(!1);w.useEffect(()=>{const v=r.current;if(!v)return;const b=v.getContext("2d");b&&(b.fillStyle="#ffffff",b.fillRect(0,0,v.width,v.height),b.strokeStyle="#1f2937",b.lineWidth=2,b.lineCap="round",b.lineJoin="round")},[]);const f=v=>{const b=r.current;if(!b)return{x:0,y:0};const y=b.getBoundingClientRect(),N=b.width/y.width,_=b.height/y.height;return{x:(v.clientX-y.left)*N,y:(v.clientY-y.top)*_}},m=v=>{const b=r.current,y=b==null?void 0:b.getContext("2d");if(!y)return;a(!0);const{x:N,y:_}=f(v);y.beginPath(),y.moveTo(N,_)},h=v=>{if(!n)return;const b=r.current,y=b==null?void 0:b.getContext("2d");if(!y)return;const{x:N,y:_}=f(v);y.lineTo(N,_),y.stroke(),c(!0)},g=()=>{a(!1)},p=()=>{const v=r.current,b=v==null?void 0:v.getContext("2d");!b||!v||(b.fillStyle="#ffffff",b.fillRect(0,0,v.width,v.height),c(!1))},x=async()=>{if(!i){ae.error("Veuillez confirmer avoir lu le NDA");return}if(!l){ae.error("Veuillez signer dans le cadre prévu");return}const v=r.current;if(v){d(!0);try{const b=v.toDataURL("image/png");(await e(b)).success?ae.success("NDA signé avec succès"):ae.error("Erreur lors de la signature du NDA")}catch{ae.error("Erreur lors de la signature")}finally{d(!1)}}};return s.jsxs(ke,{className:"max-w-4xl mx-auto",children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(vl,{className:"h-6 w-6 text-primary"}),"Accord de Non-Divulgation (NDA)"]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Pour accéder aux profils des formateurs et postuler aux offres, vous devez signer cet accord de confidentialité."})]}),s.jsxs(Ae,{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start gap-2 p-4 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-800",children:[s.jsx(Yd,{className:"h-5 w-5 text-amber-600 shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-amber-800 dark:text-amber-200",children:[s.jsx("strong",{children:"Important :"})," La signature de ce NDA est obligatoire pour protéger les données personnelles des formateurs. En cas de non-respect, votre compte sera suspendu."]})]}),s.jsxs("div",{className:"border rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted/50 border-b",children:[s.jsx(Gt,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium text-sm",children:"Contenu du NDA"})]}),s.jsx(ru,{className:"h-64 p-4",children:s.jsx("pre",{className:"whitespace-pre-wrap text-sm font-sans",children:vgt})})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Vo,{id:"hasRead",checked:i,onCheckedChange:v=>o(v===!0)}),s.jsx(We,{htmlFor:"hasRead",className:"text-sm leading-tight cursor-pointer",children:"Je confirme avoir lu et compris l'ensemble des termes de cet Accord de Non-Divulgation et m'engage à les respecter."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Signature électronique"}),s.jsx("div",{className:"border rounded-lg p-2 bg-background",children:s.jsx("canvas",{ref:r,width:600,height:150,className:"w-full border rounded cursor-crosshair bg-white",style:{touchAction:"none"},onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerLeave:g})}),s.jsx(ne,{variant:"outline",size:"sm",onClick:p,type:"button",children:"Effacer la signature"})]}),s.jsx(ne,{onClick:x,disabled:!i||!l||u||t,className:"w-full",children:u?"Signature en cours...":"Signer le NDA"})]})]})}function Tfe({children:e}){const{hasSignedNDA:t,loading:r,signNDA:n}=xgt();return r?s.jsxs("div",{className:"space-y-4 p-6",children:[s.jsx(Yr,{className:"h-8 w-64"}),s.jsx(Yr,{className:"h-64 w-full"})]}):t?s.jsx(s.Fragment,{children:e}):s.jsx("div",{className:"container mx-auto py-8 px-4",children:s.jsx(ygt,{onSign:n,loading:r})})}function bgt(){const{user:e}=Ur(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState(null),[o,l]=w.useState([]),[c,u]=w.useState(""),[d,f]=w.useState(!0),[m,h]=w.useState(!1),g=w.useRef(null);w.useEffect(()=>{if(!e){t("/auth?role=school");return}p()},[e,t]),w.useEffect(()=>{var y;(y=g.current)==null||y.scrollIntoView({behavior:"smooth"})},[o]);const p=async()=>{var y;if(e){f(!0);try{const{data:N,error:_}=await he.from("offer_messages").select(`
*,
school_requests (id, school_name, description)
`).or(`sender_id.eq.${e.id},recipient_id.eq.${e.id}`).order("created_at",{ascending:!1});if(_)throw _;const j=new Map;for(const S of N||[]){const I=S.sender_id===e.id?S.recipient_id:S.sender_id,P=`${S.school_request_id}-${I}`;if(!j.has(P))j.set(P,{id:P,school_request_id:S.school_request_id,other_user_id:I,other_user_name:"Utilisateur",last_message:S.content,last_message_at:S.created_at,unread_count:S.recipient_id===e.id&&!S.is_read?1:0,offer_title:((y=S.school_requests)==null?void 0:y.school_name)||"Offre"});else if(S.recipient_id===e.id&&!S.is_read){const F=j.get(P);F.unread_count++}}n(Array.from(j.values()))}catch(N){console.error("Error loading conversations:",N),ae.error("Erreur lors du chargement des messages")}finally{f(!1)}}},x=async y=>{if(e)try{const{data:N,error:_}=await he.from("offer_messages").select("*").eq("school_request_id",y.school_request_id).or(`sender_id.eq.${y.other_user_id},recipient_id.eq.${y.other_user_id}`).order("created_at",{ascending:!0});if(_)throw _;l(N||[]),await he.from("offer_messages").update({is_read:!0}).eq("school_request_id",y.school_request_id).eq("recipient_id",e.id).eq("sender_id",y.other_user_id),n(j=>j.map(S=>S.id===y.id?{...S,unread_count:0}:S))}catch(N){console.error("Error loading messages:",N)}},v=async()=>{if(!(!e||!a||!c.trim())){h(!0);try{const{error:y}=await he.from("offer_messages").insert({school_request_id:a.school_request_id,sender_id:e.id,recipient_id:a.other_user_id,content:c.trim()});if(y)throw y;u(""),await x(a)}catch(y){console.error("Error sending message:",y),ae.error("Erreur lors de l'envoi du message")}finally{h(!1)}}},b=y=>y.split(" ").map(N=>N[0]).join("").toUpperCase().slice(0,2);return d?s.jsx(xa,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsx(xa,{children:s.jsx(Tfe,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/school/dashboard"),children:[s.jsx(Yn,{className:"h-4 w-4 mr-2"}),"Retour"]}),s.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[s.jsx(zo,{className:"h-6 w-6"}),"Messages"]})]}),s.jsxs("div",{className:"grid md:grid-cols-3 gap-6 h-[600px]",children:[s.jsxs(ke,{className:"md:col-span-1",children:[s.jsx(ht,{className:"pb-3",children:s.jsx(xt,{className:"text-lg",children:"Conversations"})}),s.jsx(Ae,{className:"p-0",children:s.jsx(ru,{className:"h-[500px]",children:r.length===0?s.jsxs("div",{className:"p-6 text-center text-muted-foreground",children:[s.jsx(zo,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),s.jsx("p",{children:"Aucune conversation"})]}):s.jsx("div",{className:"divide-y",children:r.map(y=>s.jsx("button",{onClick:()=>{i(y),x(y)},className:`w-full p-4 text-left hover:bg-muted/50 transition-colors ${(a==null?void 0:a.id)===y.id?"bg-muted":""}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ps,{className:"h-10 w-10",children:s.jsx(gs,{children:b(y.other_user_name)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-medium truncate",children:y.offer_title}),y.unread_count>0&&s.jsx(Le,{variant:"destructive",className:"ml-2",children:y.unread_count})]}),s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:y.last_message}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Ot(new Date(y.last_message_at),"dd MMM HH:mm",{locale:yr})})]})]})},y.id))})})})]}),s.jsx(ke,{className:"md:col-span-2 flex flex-col",children:a?s.jsxs(s.Fragment,{children:[s.jsx(ht,{className:"pb-3 border-b",children:s.jsx(xt,{className:"text-lg",children:a.offer_title})}),s.jsxs(Ae,{className:"flex-1 flex flex-col p-0",children:[s.jsx(ru,{className:"flex-1 p-4",children:s.jsxs("div",{className:"space-y-4",children:[o.map(y=>s.jsx("div",{className:`flex ${y.sender_id===(e==null?void 0:e.id)?"justify-end":"justify-start"}`,children:s.jsxs("div",{className:`max-w-[70%] rounded-lg p-3 ${y.sender_id===(e==null?void 0:e.id)?"bg-primary text-primary-foreground":"bg-muted"}`,children:[s.jsx("p",{className:"text-sm",children:y.content}),s.jsxs("div",{className:"flex items-center justify-end gap-1 mt-1",children:[s.jsx("span",{className:"text-xs opacity-70",children:Ot(new Date(y.created_at),"HH:mm",{locale:yr})}),y.sender_id===(e==null?void 0:e.id)&&(y.is_read?s.jsx(KJ,{className:"h-3 w-3 opacity-70"}):s.jsx(Pn,{className:"h-3 w-3 opacity-70"}))]})]})},y.id)),s.jsx("div",{ref:g})]})}),s.jsx("div",{className:"p-4 border-t",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(gn,{placeholder:"Votre message...",value:c,onChange:y=>u(y.target.value),className:"min-h-[60px] resize-none",onKeyDown:y=>{y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),v())}}),s.jsx(ne,{onClick:v,disabled:!c.trim()||m,size:"icon",className:"h-auto",children:m?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsx(ta,{className:"h-4 w-4"})})]})})]})]}):s.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:s.jsxs("div",{className:"text-center",children:[s.jsx(zo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{children:"Sélectionnez une conversation"})]})})})]})]})})})}const wgt=[{icon:sr,text:"Accès à des centaines de formateurs experts vérifiés"},{icon:Wr,text:"Publication d'offres de formation gratuite et illimitée"},{icon:Vc,text:"Formateurs certifiés, diplômes et références contrôlés"},{icon:Gr,text:"Première candidature reçue en moyenne sous 24h"},{icon:nC,text:"Remplacement d'urgence sous 48h"}],jgt=Mg({name:pn().min(2,"Le nom doit contenir au moins 2 caractères"),email:pn().email("Email invalide"),password:pn().min(6,"Le mot de passe doit contenir au moins 6 caractères"),confirmPassword:pn(),website:pn().url("URL invalide").optional().or(VTe("")),description:pn().max(500,"Maximum 500 caractères").optional(),contactPhone:pn().optional(),address:pn().optional()}).refine(e=>e.password===e.confirmPassword,{message:"Les mots de passe ne correspondent pas",path:["confirmPassword"]}),_gt={name:"Le nom de l'établissement",email:"L'email",password:"Le mot de passe",confirmPassword:"La confirmation du mot de passe",website:"Le site web",description:"La description",contactPhone:"Le téléphone",address:"L'adresse"};function kK(){const e=Xt(),[t]=Bj(),[r,n]=w.useState(!1),[a,i]=w.useState(!1),[o,l]=w.useState({name:"",email:"",password:"",confirmPassword:"",website:"",description:"",contactPhone:"",address:""}),[c,u]=w.useState(!1),[d,f]=w.useState(!1);w.useEffect(()=>{const y=t.get("email");y&&l(N=>({...N,email:y}))},[t]);const{getFieldError:m,validateAll:h,handleBlur:g,clearFieldError:p}=CL({schema:jgt,fieldLabels:_gt}),x=y=>{const{name:N,value:_}=y.target;l(j=>({...j,[N]:_})),p(N)},v=y=>{g(y,o[y],o)},b=async y=>{if(y.preventDefault(),!c||!d){ae.error("Veuillez accepter les CGU et la politique de confidentialité");return}if(!h(o)){ae.error("Veuillez corriger les champs en erreur");return}n(!0);try{const{data:N,error:_}=await he.auth.signUp({email:o.email,password:o.password,options:{emailRedirectTo:`${window.location.origin}/school/dashboard`}});if(_)throw _;if(!N.user)throw new Error("Erreur lors de la création du compte");const{error:j}=await he.from("user_roles").insert({user_id:N.user.id,role:"school"});if(j)throw j;const{error:S}=await he.from("school_profiles").insert({user_id:N.user.id,name:o.name,contact_email:o.email,website_url:o.website||null,description:o.description||null,contact_phone:o.contactPhone||null,address:o.address||null,is_verified:!1});if(S)throw S;xi.trackSignup("school");try{await he.functions.invoke("notify-school-signup",{body:{schoolName:o.name,contactEmail:o.email,websiteUrl:o.website||void 0,contactPhone:o.contactPhone||void 0}})}catch(I){console.error("Error sending notification email:",I)}i(!0),ae.success("Compte créé avec succès !"),ae.info("Votre établissement sera vérifié par notre équipe sous 48h",{duration:5e3}),N.session&&setTimeout(()=>{e("/school/dashboard")},2e3)}catch(N){console.error("Registration error:",N),N.message.includes("already registered")?ae.error("Cet email est déjà utilisé"):ae.error(N.message||"Erreur lors de l'inscription")}finally{n(!1)}};return a?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4 py-12",children:s.jsx(ke,{className:"w-full max-w-md text-center",children:s.jsxs(Ae,{className:"pt-8 pb-8",children:[s.jsx(Wr,{className:"h-16 w-16 text-green-500 mx-auto mb-4"}),s.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Compte créé !"}),s.jsxs("div",{className:"p-4 rounded-lg bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300 text-sm mb-4",children:[s.jsx("p",{className:"font-medium mb-1",children:"📧 Vérifiez votre email"}),s.jsxs("p",{children:["Un email de confirmation a été envoyé à ",s.jsx("strong",{children:o.email}),". Cliquez sur le lien pour activer votre compte et accéder à votre tableau de bord."]})]}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Une fois confirmé, vous pourrez publier vos offres de formation."}),s.jsx(ne,{variant:"outline",onClick:()=>e("/auth?role=school"),className:"w-full",children:"Retour à la connexion"})]})})}):s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Inscription Établissement",description:"Créez votre compte établissement sur PedagoBridge pour publier des offres de formation et trouver des formateurs qualifiés.",url:"/school/register",noindex:!0}),s.jsx("div",{className:"min-h-screen bg-background px-4 py-12",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>e("/auth?role=school"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour à la connexion"]}),s.jsxs("div",{className:"grid lg:grid-cols-2 gap-10 items-start",children:[s.jsxs("div",{className:"hidden lg:block pt-2",children:[s.jsxs("h1",{className:"text-3xl font-bold mb-3",children:["Trouvez vos formateurs,",s.jsx("br",{}),s.jsx("span",{className:"text-primary",children:"publiez gratuitement"})]}),s.jsx("p",{className:"text-muted-foreground mb-8",children:"Rejoignez les établissements qui font confiance à PedagoBridge pour leurs formations professionnelles."}),s.jsx("ul",{className:"space-y-4",children:wgt.map(y=>{const N=y.icon;return s.jsxs("li",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center shrink-0 mt-0.5",children:s.jsx(N,{className:"h-4 w-4 text-primary"})}),s.jsx("span",{className:"text-sm",children:y.text})]},y.text)})}),s.jsxs("div",{className:"mt-8 p-4 rounded-xl bg-muted/60 border text-sm text-muted-foreground",children:["Besoin d'aide pour structurer votre programme ?"," ",s.jsx("button",{type:"button",onClick:()=>e("/constitution-de-programme"),className:"text-primary underline underline-offset-2 hover:no-underline font-medium",children:"Découvrir notre service de constitution de programmes →"})]})]}),s.jsx("div",{children:s.jsxs(ke,{children:[s.jsxs(ht,{className:"text-center",children:[s.jsx("div",{className:"mx-auto mb-4 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(Vr,{className:"h-6 w-6 text-primary"})}),s.jsx(xt,{className:"text-2xl",children:"Créer un compte Établissement"}),s.jsx(Qr,{children:"Inscription gratuite — Accès immédiat à votre espace"})]}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:b,className:"space-y-4",children:[s.jsx(Hi,{id:"name",name:"name",label:"Nom de l'établissement",placeholder:"Ex: École Supérieure du Digital",value:o.name,onChange:x,onFieldBlur:()=>v("name"),required:!0,error:m("name")}),s.jsx(Hi,{id:"email",name:"email",type:"email",label:"Email professionnel",placeholder:"contact@etablissement.fr",value:o.email,onChange:x,onFieldBlur:()=>v("email"),required:!0,error:m("email")}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Hi,{id:"password",name:"password",type:"password",label:"Mot de passe",placeholder:"••••••",value:o.password,onChange:x,onFieldBlur:()=>v("password"),required:!0,error:m("password")}),s.jsx(Hi,{id:"confirmPassword",name:"confirmPassword",type:"password",label:"Confirmer",placeholder:"••••••",value:o.confirmPassword,onChange:x,onFieldBlur:()=>v("confirmPassword"),required:!0,error:m("confirmPassword")})]}),s.jsx(Hi,{id:"website",name:"website",type:"url",label:"Site web",placeholder:"https://www.etablissement.fr",value:o.website,onChange:x,onFieldBlur:()=>v("website"),error:m("website")}),s.jsx(Hi,{id:"contactPhone",name:"contactPhone",type:"tel",label:"Téléphone",placeholder:"01 23 45 67 89",value:o.contactPhone,onChange:x,onFieldBlur:()=>v("contactPhone"),error:m("contactPhone")}),s.jsx(Hi,{id:"address",name:"address",label:"Adresse",placeholder:"123 rue de la Formation, 75001 Paris",value:o.address,onChange:x,onFieldBlur:()=>v("address"),error:m("address")}),s.jsx(BC,{id:"description",name:"description",label:"Description (optionnel)",placeholder:"Décrivez votre établissement en quelques mots...",value:o.description,onChange:x,onFieldBlur:()=>v("description"),rows:3,error:m("description")}),s.jsxs("div",{className:"space-y-3 pt-2",children:[s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Vo,{id:"terms",checked:c,onCheckedChange:y=>u(y===!0)}),s.jsxs("label",{htmlFor:"terms",className:"text-sm leading-tight cursor-pointer",children:["J'accepte les"," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Conditions Générales d'Utilisation"})]})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Vo,{id:"privacy",checked:d,onCheckedChange:y=>f(y===!0)}),s.jsxs("label",{htmlFor:"privacy",className:"text-sm leading-tight cursor-pointer",children:["J'accepte la"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Politique de Confidentialité"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[s.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:s.jsx("span",{className:"text-primary text-lg",children:"🤖"})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Assistant IA inclus"})," — Pour vous guider dans vos recherches et démarches."]})]}),s.jsx(ne,{type:"submit",className:"w-full",disabled:r||!c||!d,children:r?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Création du compte..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Vr,{className:"mr-2 h-4 w-4"}),"Créer mon compte"]})})]})})]})})]})]})})]})}function Ngt(){const{user:e}=Ur(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState(null),[c,u]=w.useState("all"),[d,f]=w.useState(null),[m,h]=w.useState(null),[g,p]=w.useState(!1),[x,v]=w.useState(null),[b,y]=w.useState(""),[N,_]=w.useState([]),[j,S]=w.useState(!1);w.useEffect(()=>{if(!e){t("/auth?role=school");return}P(),I()},[e,t]);const I=async()=>{try{const{data:M,error:z}=await he.from("rejection_reasons").select("reason").order("usage_count",{ascending:!1}).limit(20);if(z)throw z;_((M==null?void 0:M.map(K=>K.reason))||[])}catch(M){console.error("Error loading rejection suggestions:",M)}},P=async()=>{if(e){i(!0);try{const{data:M,error:z}=await he.from("school_requests").select("id").eq("user_id",e.id);if(z)throw z;if(!M||M.length===0){n([]),i(!1);return}const K=M.map(U=>U.id),{data:E,error:A}=await he.from("trainer_applications").select(`
id,
message,
status,
created_at,
trainer_id,
school_request_id
`).in("school_request_id",K).order("created_at",{ascending:!1});if(A)throw A;const O=[];for(const U of E||[]){const{data:Y}=await he.from("trainer_profiles").select("id, name, email, specialties, bio, photo_url, user_id").eq("id",U.trainer_id).single(),{data:J}=await he.from("school_requests").select("id, school_name, description, tjm_offered").eq("id",U.school_request_id).single();let se=!1;if(Y){const{data:ie}=await he.from("trainer_contracts").select("id, status").eq("trainer_id",Y.id).eq("status","signed").maybeSingle();se=!!ie}let ee=!1;if(U.status==="accepted"){const{data:ie}=await he.from("service_contracts").select("id").eq("trainer_application_id",U.id).maybeSingle();ee=!!ie}Y&&J&&O.push({id:U.id,message:U.message,status:U.status,created_at:U.created_at,trainer:Y,school_request:J,is_affiliated:se,has_service_contract:ee})}n(O)}catch(M){console.error("Error loading applications:",M),ae.error("Erreur lors du chargement des candidatures")}finally{i(!1)}}},F=async(M,z,K)=>{f(M);try{const E=r.find(U=>U.id===M),A={status:z};K&&(A.rejection_reason=K);const{error:O}=await he.from("trainer_applications").update(A).eq("id",M);if(O)throw O;try{await he.functions.invoke("notify-application-status",{body:{applicationId:M,newStatus:z,rejectionReason:K}})}catch(U){console.error("Error notifying trainer:",U)}z==="accepted"&&E&&await he.from("school_requests").update({status:"archived",is_filled:!0,filled_at:new Date().toISOString()}).eq("id",E.school_request.id),z==="rejected"&&K&&await T(K),n(U=>U.map(Y=>Y.id===M?{...Y,status:z}:Y)),z==="accepted"?ae.success("Candidature acceptée ! L'offre a été archivée automatiquement."):ae.success(`Candidature ${z==="rejected"?"refusée":"mise à jour"}`),(o==null?void 0:o.id)===M&&l(U=>U?{...U,status:z}:null)}catch(E){console.error("Error updating application:",E),ae.error("Erreur lors de la mise à jour")}finally{f(null)}},T=async M=>{const z=M.trim();if(z)try{const K=z.toLowerCase().substring(0,30),{data:E}=await he.from("rejection_reasons").select("id, usage_count, reason").ilike("reason",`${K}%`).maybeSingle();E?await he.from("rejection_reasons").update({usage_count:E.usage_count+1}).eq("id",E.id):await he.from("rejection_reasons").insert({reason:z,usage_count:1}),await I()}catch(K){console.error("Error saving rejection reason:",K)}},k=M=>{v(M),y(""),p(!0)},V=async()=>{x&&(await F(x.id,"rejected",b),p(!1),v(null),y(""))},C=async M=>{if(!M.is_affiliated){ae.error("Ce formateur n'est pas affilié");return}h(M.id);try{const{data:z,error:K}=await he.functions.invoke("create-service-contract",{body:{applicationId:M.id}});if(K)throw K;ae.success("Contrat de prestation créé avec succès !"),P()}catch(z){console.error("Error creating service contract:",z),ae.error(z.message||"Erreur lors de la création du contrat")}finally{h(null)}},R=M=>{const z={formateur:M.trainer.name,email_formateur:M.trainer.email,offre:M.school_request.description,ecole:M.school_request.school_name,tjm:M.school_request.tjm_offered||"Non défini",date_acceptation:Ot(new Date(M.created_at),"dd/MM/yyyy"),statut:M.status==="accepted"?"Accepté":M.status,affilie:M.is_affiliated?"Oui":"Non"},K=Object.entries(z).map(([U,Y])=>`${U};${Y}`).join(`
`),E=new Blob([K],{type:"text/csv;charset=utf-8"}),A=URL.createObjectURL(E),O=document.createElement("a");O.href=A,O.download=`facturation_${M.trainer.name.replace(/\s/g,"_")}_${Ot(new Date,"yyyy-MM-dd")}.csv`,O.click(),URL.revokeObjectURL(A),ae.success("Informations exportées")},H=M=>{switch(M){case"accepted":return s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(Wr,{className:"w-3 h-3 mr-1"}),"Acceptée"]});case"rejected":return s.jsxs(Le,{variant:"destructive",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Refusée"]});case"pending":default:return s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]})}},q=r.filter(M=>c==="all"?!0:M.status===c),L={total:r.length,pending:r.filter(M=>M.status==="pending").length,accepted:r.filter(M=>M.status==="accepted").length,rejected:r.filter(M=>M.status==="rejected").length};return a?s.jsx(xa,{children:s.jsx("div",{className:"container mx-auto px-4 py-8 flex justify-center items-center min-h-[400px]",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})})}):s.jsxs(xa,{children:[s.jsx(gr,{title:"Candidatures Reçues",description:"Gérez les candidatures des formateurs à vos offres de formation.",noindex:!0}),s.jsx(Tfe,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsxs("div",{className:"mb-8",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/school/dashboard"),className:"mb-4",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour au tableau de bord"]}),s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-3",children:[s.jsx(sr,{className:"h-8 w-8 text-primary"}),"Candidatures reçues"]}),s.jsx("p",{className:"text-muted-foreground mt-1",children:"Gérez les candidatures des formateurs à vos offres"})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-2xl font-bold",children:L.total})]}),s.jsx(sr,{className:"h-8 w-8 text-primary opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"En attente"}),s.jsx("p",{className:"text-2xl font-bold text-yellow-600",children:L.pending})]}),s.jsx(Gr,{className:"h-8 w-8 text-yellow-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Acceptées"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:L.accepted})]}),s.jsx(Wr,{className:"h-8 w-8 text-green-500 opacity-80"})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Refusées"}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:L.rejected})]}),s.jsx(Fs,{className:"h-8 w-8 text-red-500 opacity-80"})]})})})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Filtrer par statut :"}),s.jsxs(Lr,{value:c,onValueChange:u,children:[s.jsx(Ar,{className:"w-48",children:s.jsx(Br,{placeholder:"Tous les statuts"})}),s.jsxs(Tr,{children:[s.jsxs(ot,{value:"all",children:["Tous (",L.total,")"]}),s.jsxs(ot,{value:"pending",children:["En attente (",L.pending,")"]}),s.jsxs(ot,{value:"accepted",children:["Acceptées (",L.accepted,")"]}),s.jsxs(ot,{value:"rejected",children:["Refusées (",L.rejected,")"]})]})]})]}),q.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(sr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:c==="all"?"Aucune candidature reçue pour le moment":`Aucune candidature ${c==="pending"?"en attente":c==="accepted"?"acceptée":"refusée"}`})]})}):s.jsx("div",{className:"space-y-4",children:q.map(M=>s.jsx(ke,{className:`hover:shadow-md transition-shadow ${M.is_affiliated?"ring-1 ring-amber-300 bg-amber-50/30 dark:bg-amber-950/10":""}`,children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-start gap-3 mb-2",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:M.trainer.photo_url?s.jsx("img",{src:M.trainer.photo_url,alt:M.trainer.name,className:"w-12 h-12 rounded-full object-cover"}):s.jsx(sr,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-semibold",children:M.trainer.name}),M.is_affiliated&&s.jsx(Zd,{})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:M.trainer.email})]}),s.jsx("div",{className:"ml-auto",children:H(M.status)})]}),s.jsxs("div",{className:"ml-15 pl-15",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-2",children:[s.jsx(as,{className:"h-4 w-4"}),s.jsxs("span",{className:"line-clamp-1",children:["Offre : ",M.school_request.description.substring(0,60),"..."]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-3",children:[s.jsx(Bs,{className:"h-4 w-4"}),s.jsxs("span",{children:["Postulé le ",Ot(new Date(M.created_at),"dd MMM yyyy à HH:mm",{locale:yr})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[M.trainer.specialties.slice(0,4).map((z,K)=>s.jsx(Le,{variant:"outline",className:"text-xs",children:z},K)),M.trainer.specialties.length>4&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",M.trainer.specialties.length-4]})]}),M.status==="accepted"&&s.jsx("div",{className:`mt-3 p-3 rounded-lg border ${M.is_affiliated?"bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800":"bg-blue-50 dark:bg-blue-950/20 border-blue-200 dark:border-blue-800"}`,children:M.is_affiliated?s.jsxs("div",{children:[s.jsxs("p",{className:"text-sm font-medium text-amber-700 dark:text-amber-300 mb-2",children:[s.jsx(iu,{className:"h-4 w-4 inline mr-1"}),"Formateur certifié - Facturation via PedagoBridge"]}),M.has_service_contract?s.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:[s.jsx(Wr,{className:"h-3 w-3 inline mr-1"}),"Contrat de prestation créé"]}):s.jsxs(ne,{size:"sm",variant:"outline",className:"mt-2",onClick:()=>C(M),disabled:m===M.id,children:[m===M.id?s.jsx(at,{className:"h-4 w-4 animate-spin mr-2"}):s.jsx(Gt,{className:"h-4 w-4 mr-2"}),"Créer le contrat de prestation"]})]}):s.jsxs("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:[s.jsx(Fn,{className:"h-4 w-4 inline mr-1"}),"Formateur non certifié - Contactez-le directement pour finaliser les modalités."]})})]})]}),s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>l(M),children:[s.jsx(is,{className:"mr-2 h-4 w-4"}),"Voir le profil"]}),M.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsx(ne,{size:"sm",className:"bg-green-600 hover:bg-green-700",onClick:()=>F(M.id,"accepted"),disabled:d===M.id,children:d===M.id?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(Wr,{className:"mr-2 h-4 w-4"}),"Accepter"]})}),s.jsxs(ne,{variant:"destructive",size:"sm",onClick:()=>k(M),disabled:d===M.id,children:[s.jsx(Fs,{className:"mr-2 h-4 w-4"}),"Refuser"]})]}),M.status==="accepted"&&s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>R(M),children:[s.jsx(Ho,{className:"mr-2 h-4 w-4"}),"Export facturation"]}),s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>window.location.href=`mailto:${M.trainer.email}`,children:[s.jsx(Fn,{className:"mr-2 h-4 w-4"}),"Contacter"]})]})]})})},M.id))}),s.jsx(Hn,{open:!!o,onOpenChange:()=>l(null),children:s.jsxs(qn,{className:"max-w-2xl",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Profil du formateur"}),s.jsx(Ia,{children:"Détails de la candidature"})]}),o&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:o.trainer.photo_url?s.jsx("img",{src:o.trainer.photo_url,alt:o.trainer.name,className:"w-20 h-20 rounded-full object-cover"}):s.jsx(sr,{className:"h-10 w-10 text-primary"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-xl font-bold",children:o.trainer.name}),o.is_affiliated&&s.jsx(Zd,{})]}),s.jsx("p",{className:"text-muted-foreground",children:o.trainer.email}),s.jsx("div",{className:"mt-2",children:H(o.status)})]})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-2",children:"Offre concernée"}),s.jsx("p",{className:"text-sm text-muted-foreground bg-muted/50 p-3 rounded-lg",children:o.school_request.description})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-2",children:"Spécialités"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:o.trainer.specialties.map((M,z)=>s.jsx(Le,{variant:"secondary",children:M},z))})]}),o.trainer.bio&&s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold mb-2",children:"À propos"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:o.trainer.bio})]}),o.message&&s.jsxs("div",{children:[s.jsxs("h4",{className:"font-semibold mb-2 flex items-center gap-2",children:[s.jsx(zo,{className:"h-4 w-4"}),"Message de candidature"]}),s.jsx("p",{className:"text-sm bg-primary/5 p-4 rounded-lg border",children:o.message})]}),s.jsxs("div",{className:"flex gap-2 pt-4 border-t",children:[o.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{className:"flex-1 bg-green-600 hover:bg-green-700",onClick:()=>{F(o.id,"accepted")},disabled:d===o.id,children:[s.jsx(Wr,{className:"mr-2 h-4 w-4"}),"Accepter"]}),s.jsxs(ne,{variant:"destructive",className:"flex-1",onClick:()=>{F(o.id,"rejected")},disabled:d===o.id,children:[s.jsx(Fs,{className:"mr-2 h-4 w-4"}),"Refuser"]})]}),s.jsxs(ne,{variant:"outline",className:"flex-1",onClick:()=>window.location.href=`mailto:${o.trainer.email}`,children:[s.jsx(Fn,{className:"mr-2 h-4 w-4"}),"Contacter"]})]})]})]})}),s.jsx(Hn,{open:g,onOpenChange:p,children:s.jsxs(qn,{className:"max-w-md",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Refuser la candidature"}),s.jsx(Ia,{children:x&&s.jsxs(s.Fragment,{children:["Vous allez refuser la candidature de ",s.jsx("strong",{children:x.trainer.name}),"."]})})]}),s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium",children:"Raison du refus (optionnel)"}),s.jsxs(rp,{open:j,onOpenChange:S,children:[s.jsx(np,{asChild:!0,children:s.jsx(Ye,{placeholder:"Expliquer la raison du refus...",value:b,onChange:M=>y(M.target.value),onClick:()=>S(!0)})}),N.length>0&&s.jsx(fh,{className:"p-0 w-[300px]",align:"start",children:s.jsxs(ap,{children:[s.jsx(ip,{placeholder:"Rechercher..."}),s.jsxs(op,{children:[s.jsx(lp,{children:"Aucune suggestion"}),s.jsx(Jf,{heading:"Suggestions",children:N.filter(M=>M.toLowerCase().includes(b.toLowerCase())).slice(0,8).map((M,z)=>s.jsx(Bu,{onSelect:()=>{y(M),S(!1)},children:M},z))})]})]})})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Votre raison sera suggérée pour les prochains refus."})]})}),s.jsxs(Jl,{className:"gap-2",children:[s.jsx(ne,{variant:"outline",onClick:()=>p(!1),children:"Annuler"}),s.jsxs(ne,{variant:"destructive",onClick:V,disabled:d!==null,children:[d?s.jsx(at,{className:"h-4 w-4 animate-spin mr-2"}):s.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Confirmer le refus"]})]})]})})]})})]})}const Sgt=["Syllabus","Description du besoin","Planning","Cahier des charges","Autre"];function kgt(){const{id:e}=wo(),t=Xt(),{user:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState(!1),[l,c]=w.useState(!1),[u,d]=w.useState(""),[f,m]=w.useState(""),[h,g]=w.useState(""),[p,x]=w.useState("presentiel"),[v,b]=w.useState(""),[y,N]=w.useState(""),[_,j]=w.useState(""),[S,I]=w.useState(""),[P,F]=w.useState([]),[T,k]=w.useState(""),[V,C]=w.useState(""),[R,H]=w.useState(""),[q,L]=w.useState(""),[M,z]=w.useState(""),[K,E]=w.useState(""),[A,O]=w.useState(""),[U,Y]=w.useState([]),[J,se]=w.useState(""),[ee,ie]=w.useState(null),[Ee,te]=w.useState(""),[Ue,W]=w.useState("public");w.useEffect(()=>{if(!r||!e){t("/auth?role=school");return}Z()},[r,e,t]);const Z=async()=>{var pe,Ie;if(e)try{const{data:Ge,error:we}=await he.from("school_requests").select("*").eq("id",e).eq("user_id",r==null?void 0:r.id).single();if(we)throw we;if(!Ge){ae.error("Offre non trouvée"),t("/school/dashboard");return}if(Ge.status==="approved"){ae.error("Vous ne pouvez pas modifier une offre publiée"),t("/school/dashboard");return}if(d(Ge.school_name),m(Ge.city||""),g(Ge.address||""),x(Ge.modality||"presentiel"),b(Ge.contact_name),N(Ge.contact_email),j(Ge.contact_phone||""),I(Ge.contact_position||""),F(Ge.training_needs||[]),C(Ge.start_date||""),H(Ge.end_date||""),L(((pe=Ge.duration_hours)==null?void 0:pe.toString())||""),z(((Ie=Ge.num_trainers)==null?void 0:Ie.toString())||""),E(Ge.estimated_budget||""),O(Ge.description),te(Ge.status),W(Ge.visibility||"public"),Ge.documents&&Array.isArray(Ge.documents)){const _e=Ge.documents.map(qe=>({type:qe.type||"",name:qe.name||"",url:qe.url||""}));Y(_e)}}catch(Ge){console.error("Error loading request:",Ge),ae.error("Erreur lors du chargement de l'offre"),t("/school/dashboard")}finally{a(!1)}},le=()=>{T.trim()&&!P.includes(T.trim())&&(F([...P,T.trim()]),k(""))},re=pe=>{F(P.filter(Ie=>Ie!==pe))},oe=pe=>{var Ge;const Ie=(Ge=pe.target.files)==null?void 0:Ge[0];if(Ie){if(Ie.size>10*1024*1024){ae.error("Le fichier ne doit pas dépasser 10 Mo");return}ie(Ie)}},fe=()=>{if(!J){ae.error("Veuillez sélectionner un type de document");return}if(!ee){ae.error("Veuillez sélectionner un fichier");return}Y([...U,{type:J,name:ee.name,url:"",file:ee}]),se(""),ie(null);const pe=document.getElementById("doc-file-input");pe&&(pe.value="")},Fe=pe=>{Y(U.filter((Ie,Ge)=>Ge!==pe))},ge=async pe=>{if(pe.preventDefault(),!u.trim()||!v.trim()||!y.trim()){ae.error("Veuillez remplir tous les champs obligatoires");return}if(V&&R){const Ge=new Date(V);if(new Date(R)<Ge){ae.error("La date de fin doit être après la date de début");return}}let Ie=[...P];if(T.trim()&&!P.includes(T.trim())&&Ie.push(T.trim()),Ie.length===0){ae.error("Ajoutez au moins un besoin en formation");return}if(!A.trim()){ae.error("Veuillez décrire vos besoins");return}o(!0);try{const Ge=[];for(const _e of U)if(_e.file){const qe=`${Date.now()}-${_e.file.name}`,{data:Re,error:Me}=await he.storage.from("school-attachments").upload(qe,_e.file);if(Me)throw Me;const{data:{publicUrl:He}}=he.storage.from("school-attachments").getPublicUrl(Re.path);Ge.push({type:_e.type,name:_e.name,url:He})}else _e.url&&Ge.push({type:_e.type,name:_e.name,url:_e.url});const{error:we}=await he.from("school_requests").update({school_name:u.trim(),city:f.trim()||null,address:h.trim()||null,modality:p,contact_name:v.trim(),contact_email:y.trim(),contact_phone:_.trim()||null,contact_position:S.trim()||null,training_needs:Ie,start_date:V||null,end_date:R||null,duration_hours:q?parseInt(q):null,num_trainers:M?parseInt(M):null,estimated_budget:K.trim()||null,description:A.trim(),documents:Ge,subject_areas:Ie,visibility:Ue,updated_at:new Date().toISOString()}).eq("id",e).eq("user_id",r==null?void 0:r.id);if(we)throw we;c(!0),ae.success("Offre mise à jour avec succès !")}catch(Ge){console.error("Error updating request:",Ge),ae.error("Erreur lors de la mise à jour")}finally{o(!1)}};return n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):l?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4",children:s.jsx(ke,{className:"w-full max-w-md text-center",children:s.jsxs(Ae,{className:"pt-12 pb-8",children:[s.jsx(ma,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),s.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Offre mise à jour !"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Vos modifications ont été enregistrées."}),s.jsx(ne,{onClick:()=>t("/school/dashboard"),className:"w-full",children:"Retour au tableau de bord"})]})})}):s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Modifier l'offre de formation",description:"Modifiez les détails de votre offre de formation sur PedagoBridge.",noindex:!0}),s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-3xl",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/school/dashboard"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour au tableau de bord"]}),Ee==="rejected"&&s.jsx(ke,{className:"mb-6 border-destructive/50 bg-destructive/5",children:s.jsx(Ae,{className:"py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Yd,{className:"h-5 w-5 text-destructive"}),s.jsxs("p",{className:"text-sm",children:[s.jsx("span",{className:"font-medium",children:"Cette offre a été refusée."})," ","Vous pouvez la modifier et la soumettre à nouveau."]})]})})}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{className:"text-3xl",children:"Modifier l'offre"}),s.jsx(Qr,{children:"Modifiez les informations de votre demande de formation"})]}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:ge,className:"space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Informations de l'établissement"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"schoolName",children:"Nom de l'établissement *"}),s.jsx(Ye,{id:"schoolName",value:u,onChange:pe=>d(pe.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"city",children:"Ville"}),s.jsx(Ye,{id:"city",value:f,onChange:pe=>m(pe.target.value),placeholder:"Paris, Lyon, Marseille..."})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"address",children:"Adresse de l'établissement"}),s.jsx(Ye,{id:"address",value:h,onChange:pe=>g(pe.target.value),placeholder:"123 rue de l'École, 75001 Paris"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Modalité de formation *"}),s.jsxs($0,{value:p,onValueChange:pe=>x(pe),className:"flex flex-wrap gap-4",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ro,{value:"presentiel",id:"edit-presentiel"}),s.jsx(We,{htmlFor:"edit-presentiel",className:"cursor-pointer font-normal",children:"Présentiel"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ro,{value:"distanciel",id:"edit-distanciel"}),s.jsx(We,{htmlFor:"edit-distanciel",className:"cursor-pointer font-normal",children:"Distanciel"})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(Ro,{value:"hybride",id:"edit-hybride"}),s.jsx(We,{htmlFor:"edit-hybride",className:"cursor-pointer font-normal",children:"Hybride"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Visibilité de l'offre *"}),s.jsxs($0,{value:Ue,onValueChange:pe=>W(pe),className:"flex flex-col gap-3",children:[s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Ro,{value:"public",id:"edit-visibility-public",className:"mt-1"}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"edit-visibility-public",className:"cursor-pointer font-normal",children:"Publique"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible par tous les visiteurs du site"})]})]}),s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Ro,{value:"platform_only",id:"edit-visibility-platform",className:"mt-1"}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"edit-visibility-platform",className:"cursor-pointer font-normal",children:"Formateurs de la plateforme uniquement"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible uniquement par les formateurs inscrits"})]})]})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Informations du contact"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contactName",children:"Nom du contact *"}),s.jsx(Ye,{id:"contactName",value:v,onChange:pe=>b(pe.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contactPosition",children:"Poste"}),s.jsx(Ye,{id:"contactPosition",value:S,onChange:pe=>I(pe.target.value)})]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contactEmail",children:"Email *"}),s.jsx(Ye,{id:"contactEmail",type:"email",value:y,onChange:pe=>N(pe.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"contactPhone",children:"Téléphone"}),s.jsx(Ye,{id:"contactPhone",type:"tel",value:_,onChange:pe=>j(pe.target.value)})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Besoins en formation *"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{value:T,onChange:pe=>k(pe.target.value),onKeyPress:pe=>{pe.key==="Enter"&&(pe.preventDefault(),le())},placeholder:"Ex: Formation en développement web"}),s.jsx(ne,{type:"button",onClick:le,size:"icon",children:s.jsx(Ya,{className:"h-4 w-4"})})]}),P.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2",children:P.map((pe,Ie)=>s.jsxs(Le,{variant:"secondary",className:"text-sm py-1.5",children:[pe,s.jsx("button",{type:"button",onClick:()=>re(pe),className:"ml-2 hover:text-destructive",children:s.jsx(Ri,{className:"h-3 w-3"})})]},Ie))})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Détails de la formation"}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"startDate",children:"Date de début souhaitée"}),s.jsx(Ye,{id:"startDate",type:"date",value:V,onChange:pe=>C(pe.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"endDate",children:"Date de fin souhaitée"}),s.jsx(Ye,{id:"endDate",type:"date",value:R,onChange:pe=>H(pe.target.value)})]})]}),s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"durationHours",children:"Durée estimée (heures)"}),s.jsx(Ye,{id:"durationHours",type:"number",min:"1",value:q,onChange:pe=>L(pe.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"numTrainers",children:"Nombre de formateurs souhaités"}),s.jsx(Ye,{id:"numTrainers",type:"number",min:"1",value:M,onChange:pe=>z(pe.target.value)})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"estimatedBudget",children:"Budget estimé"}),s.jsx(Ye,{id:"estimatedBudget",value:K,onChange:pe=>E(pe.target.value),placeholder:"Ex: 5000€ - 10000€"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"description",children:"Description détaillée des besoins *"}),s.jsx(gn,{id:"description",value:A,onChange:pe=>O(pe.target.value),rows:6,required:!0})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Documents"}),U.length>0&&s.jsx("div",{className:"space-y-2",children:U.map((pe,Ie)=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-sm",children:pe.name}),s.jsx("p",{className:"text-xs text-muted-foreground",children:pe.type})]})]}),s.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>Fe(Ie),children:s.jsx(Ri,{className:"h-4 w-4"})})]},Ie))}),s.jsxs("div",{className:"space-y-3 p-4 border border-dashed rounded-lg",children:[s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Type de document"}),s.jsxs(Lr,{value:J,onValueChange:se,children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Sélectionner..."})}),s.jsx(Tr,{children:Sgt.map(pe=>s.jsx(ot,{value:pe,children:pe},pe))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Fichier"}),s.jsx(Ye,{id:"doc-file-input",type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx",onChange:oe})]})]}),s.jsxs(ne,{type:"button",variant:"outline",onClick:fe,children:[s.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Ajouter le document"]})]})]}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx(ne,{type:"button",variant:"outline",onClick:()=>t("/school/dashboard"),className:"flex-1",children:"Annuler"}),s.jsx(ne,{type:"submit",disabled:i,className:"flex-1",children:i?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Enregistrement..."]}):"Enregistrer les modifications"})]})]})})]})]})})]})}function Cgt(){const e=Xt(),[t,r]=w.useState(!1),[n,a]=w.useState(!1),[i,o]=w.useState(""),[l,c]=w.useState(""),[u,d]=w.useState(null);w.useEffect(()=>{const m=x=>{const v=new URLSearchParams(window.location.hash.substring(1)),b=new URLSearchParams(window.location.search);return v.get(x)??b.get(x)},h=m("access_token"),g=m("refresh_token");m("type")==="recovery"&&h&&he.auth.setSession({access_token:h,refresh_token:g||""}).catch(console.error)},[]);const f=async m=>{if(m.preventDefault(),d(null),i.length<6){d("Le mot de passe doit contenir au moins 6 caractères");return}if(i!==l){d("Les mots de passe ne correspondent pas");return}r(!0);try{const{error:h}=await he.auth.updateUser({password:i});if(h)throw h;a(!0),ae.success("Mot de passe modifié avec succès !"),setTimeout(()=>{e("/auth")},3e3)}catch(h){console.error("Reset password error:",h),h.message.includes("Auth session missing")?d("Le lien de réinitialisation a expiré. Veuillez en demander un nouveau."):d(h.message||"Erreur lors de la réinitialisation")}finally{r(!1)}};return n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4 py-12",children:s.jsx(ke,{className:"w-full max-w-md text-center",children:s.jsxs(Ae,{className:"pt-8 pb-8",children:[s.jsx(Wr,{className:"h-16 w-16 text-green-500 mx-auto mb-4"}),s.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Mot de passe modifié !"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Votre mot de passe a été réinitialisé avec succès. Vous allez être redirigé vers la page de connexion."}),s.jsx(at,{className:"h-6 w-6 animate-spin mx-auto text-primary"})]})})}):s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Réinitialisation du mot de passe",description:"Réinitialisez votre mot de passe PedagoBridge pour accéder à votre compte.",url:"/reset-password",noindex:!0}),s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4 py-12",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>e("/auth"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour à la connexion"]}),s.jsxs(ke,{children:[s.jsxs(ht,{className:"text-center",children:[s.jsx("div",{className:"mx-auto mb-4 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(Dve,{className:"h-6 w-6 text-primary"})}),s.jsx(xt,{className:"text-2xl",children:"Nouveau mot de passe"}),s.jsx(Qr,{children:"Choisissez un nouveau mot de passe pour votre compte"})]}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:f,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"password",children:"Nouveau mot de passe"}),s.jsx(Ye,{id:"password",type:"password",placeholder:"Minimum 6 caractères",value:i,onChange:m=>o(m.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"confirmPassword",children:"Confirmer le mot de passe"}),s.jsx(Ye,{id:"confirmPassword",type:"password",placeholder:"Confirmez votre mot de passe",value:l,onChange:m=>c(m.target.value),required:!0})]}),u&&s.jsx("div",{className:"p-3 rounded-md bg-destructive/10 text-destructive text-sm",children:u}),s.jsx(ne,{type:"submit",className:"w-full",disabled:t,children:t?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Modification..."]}):"Modifier mon mot de passe"})]})})]})]})})]})}function Egt(){const[e,t]=w.useState([]),[r,n]=w.useState(!0),[a,i]=w.useState("");w.useEffect(()=>{o()},[]);const o=async()=>{try{const{data:m,error:h}=await he.from("trainer_profiles").select("specialties").eq("status","approved").eq("is_visible",!0);if(h)throw h;const g=new Map;m==null||m.forEach(x=>{var v;(v=x.specialties)==null||v.forEach(b=>{const y=b.trim();y&&g.set(y,(g.get(y)||0)+1)})});const p=Array.from(g.entries()).map(([x,v])=>({name:x,count:v,slug:encodeURIComponent(x.toLowerCase().replace(/\s+/g,"-"))})).sort((x,v)=>v.count-x.count);t(p)}catch(m){console.error("Error loading skills:",m)}finally{n(!1)}},l=m=>encodeURIComponent(m.toLowerCase().replace(/\s+/g,"-")),c=e.filter(m=>m.name.toLowerCase().includes(a.toLowerCase())),u=c.reduce((m,h)=>{var p;const g=((p=h.name[0])==null?void 0:p.toUpperCase())||"#";return m[g]||(m[g]=[]),m[g].push(h),m},{}),d=Object.keys(u).sort(),f=e.slice(0,30);return r?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:"Annuaire des Compétences - Trouvez le Formateur Expert | PedagoBridge",description:`Explorez ${e.length}+ compétences et trouvez des formateurs experts en ${f.slice(0,5).map(m=>m.name).join(", ")} et plus. Plateforme de mise en relation formateurs-établissements.`,url:"/skills",keywords:f.slice(0,10).map(m=>m.name)}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Compétences",url:"/skills"}]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 border-b",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Annuaire des Compétences"}),s.jsxs("p",{className:"text-xl text-muted-foreground mb-8",children:["Trouvez des formateurs experts parmi ",e.length,"+ compétences"]}),s.jsxs("div",{className:"relative max-w-xl mx-auto",children:[s.jsx(pa,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher une compétence...",value:a,onChange:m=>i(m.target.value),className:"pl-12 h-14 text-lg"})]})]})})}),s.jsxs("div",{className:"container mx-auto px-4 py-12",children:[!a&&s.jsx("section",{className:"mb-16",children:s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Kd,{className:"h-5 w-5 text-primary"}),"Compétences populaires"]})}),s.jsx(Ae,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((m,h)=>{const g=h<5?"text-lg px-4 py-2":h<15?"text-base px-3 py-1.5":"text-sm px-2 py-1";return s.jsx(vt,{to:`/skills/${l(m.name)}`,className:"inline-block",children:s.jsxs(Le,{variant:h<5?"default":"secondary",className:`${g} hover:scale-105 transition-transform cursor-pointer`,children:[m.name,s.jsxs("span",{className:"ml-2 opacity-70",children:["(",m.count,")"]})]})},m.name)})})})]})}),s.jsxs("section",{children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-2",children:[s.jsx(sr,{className:"h-6 w-6 text-primary"}),"Toutes les compétences (A-Z)"]}),c.length===0?s.jsx(ke,{children:s.jsx(Ae,{className:"py-12 text-center",children:s.jsxs("p",{className:"text-muted-foreground",children:['Aucune compétence trouvée pour "',a,'"']})})}):s.jsx("div",{className:"space-y-8",children:d.map(m=>s.jsxs("div",{id:`letter-${m}`,children:[s.jsx("h3",{className:"text-xl font-bold text-primary mb-3 border-b pb-2",children:m}),s.jsx("div",{className:"grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:u[m].map(h=>s.jsx(vt,{to:`/skills/${l(h.name)}`,className:"group",children:s.jsx(ke,{className:"h-full hover:border-primary/50 hover:shadow-md transition-all",children:s.jsxs(Ae,{className:"p-4 flex items-center justify-between",children:[s.jsx("span",{className:"font-medium group-hover:text-primary transition-colors",children:h.name}),s.jsxs(Le,{variant:"outline",className:"shrink-0",children:[h.count," formateur",h.count>1?"s":""]})]})})},h.name))})]},m))})]}),!a&&d.length>0&&s.jsx("nav",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 bg-background/95 backdrop-blur border rounded-full px-4 py-2 shadow-lg z-50",children:s.jsx("div",{className:"flex gap-1 flex-wrap justify-center max-w-lg",children:d.map(m=>s.jsx("a",{href:`#letter-${m}`,className:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-primary hover:text-primary-foreground transition-colors text-sm font-medium",children:m},m))})})]})]})}var cd="Accordion",Agt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[OM,Tgt,Pgt]=Ij(cd),[rA]=Xa(cd,[Pgt,sle]),DM=sle(),Pfe=be.forwardRef((e,t)=>{const{type:r,...n}=e,a=n,i=n;return s.jsx(OM.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?s.jsx(Rgt,{...i,ref:t}):s.jsx(Igt,{...a,ref:t})})});Pfe.displayName=cd;var[Ofe,Ogt]=rA(cd),[Dfe,Dgt]=rA(cd,{collapsible:!1}),Igt=be.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},collapsible:i=!1,...o}=e,[l,c]=Wo({prop:r,defaultProp:n??"",onChange:a,caller:cd});return s.jsx(Ofe,{scope:e.__scopeAccordion,value:be.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:be.useCallback(()=>i&&c(""),[i,c]),children:s.jsx(Dfe,{scope:e.__scopeAccordion,collapsible:i,children:s.jsx(Ife,{...o,ref:t})})})}),Rgt=be.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:a=()=>{},...i}=e,[o,l]=Wo({prop:r,defaultProp:n??[],onChange:a,caller:cd}),c=be.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=be.useCallback(d=>l((f=[])=>f.filter(m=>m!==d)),[l]);return s.jsx(Ofe,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:s.jsx(Dfe,{scope:e.__scopeAccordion,collapsible:!0,children:s.jsx(Ife,{...i,ref:t})})})}),[Lgt,nA]=rA(cd),Ife=be.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:n,dir:a,orientation:i="vertical",...o}=e,l=be.useRef(null),c=Cr(l,t),u=Tgt(r),f=Dg(a)==="ltr",m=Ct(e.onKeyDown,h=>{var I;if(!Agt.includes(h.key))return;const g=h.target,p=u().filter(P=>{var F;return!((F=P.ref.current)!=null&&F.disabled)}),x=p.findIndex(P=>P.ref.current===g),v=p.length;if(x===-1)return;h.preventDefault();let b=x;const y=0,N=v-1,_=()=>{b=x+1,b>N&&(b=y)},j=()=>{b=x-1,b<y&&(b=N)};switch(h.key){case"Home":b=y;break;case"End":b=N;break;case"ArrowRight":i==="horizontal"&&(f?_():j());break;case"ArrowDown":i==="vertical"&&_();break;case"ArrowLeft":i==="horizontal"&&(f?j():_());break;case"ArrowUp":i==="vertical"&&j();break}const S=b%v;(I=p[S].ref.current)==null||I.focus()});return s.jsx(Lgt,{scope:r,disabled:n,direction:a,orientation:i,children:s.jsx(OM.Slot,{scope:r,children:s.jsx(zt.div,{...o,"data-orientation":i,ref:c,onKeyDown:n?void 0:m})})})}),jk="AccordionItem",[Fgt,IM]=rA(jk),Rfe=be.forwardRef((e,t)=>{const{__scopeAccordion:r,value:n,...a}=e,i=nA(jk,r),o=Ogt(jk,r),l=DM(r),c=Ga(),u=n&&o.value.includes(n)||!1,d=i.disabled||e.disabled;return s.jsx(Fgt,{scope:r,open:u,disabled:d,triggerId:c,children:s.jsx(ole,{"data-orientation":i.orientation,"data-state":zfe(u),...l,...a,ref:t,disabled:d,open:u,onOpenChange:f=>{f?o.onItemOpen(n):o.onItemClose(n)}})})});Rfe.displayName=jk;var Lfe="AccordionHeader",Ffe=be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=nA(cd,r),i=IM(Lfe,r);return s.jsx(zt.h3,{"data-orientation":a.orientation,"data-state":zfe(i.open),"data-disabled":i.disabled?"":void 0,...n,ref:t})});Ffe.displayName=Lfe;var JD="AccordionTrigger",Mfe=be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=nA(cd,r),i=IM(JD,r),o=Dgt(JD,r),l=DM(r);return s.jsx(OM.ItemSlot,{scope:r,children:s.jsx(KMe,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...n,ref:t})})});Mfe.displayName=JD;var $fe="AccordionContent",Bfe=be.forwardRef((e,t)=>{const{__scopeAccordion:r,...n}=e,a=nA(cd,r),i=IM($fe,r),o=DM(r);return s.jsx(YMe,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...o,...n,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Bfe.displayName=$fe;function zfe(e){return e?"open":"closed"}var Mgt=Pfe,$gt=Rfe,Bgt=Ffe,Ufe=Mfe,qfe=Bfe;const RM=Mgt,hm=w.forwardRef(({className:e,...t},r)=>s.jsx($gt,{ref:r,className:pt("border-b",e),...t}));hm.displayName="AccordionItem";const mm=w.forwardRef(({className:e,children:t,...r},n)=>s.jsx(Bgt,{className:"flex",children:s.jsxs(Ufe,{ref:n,className:pt("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,s.jsx(bh,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));mm.displayName=Ufe.displayName;const pm=w.forwardRef(({className:e,children:t,...r},n)=>s.jsx(qfe,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:s.jsx("div",{className:pt("pb-4 pt-0",e),children:t})}));pm.displayName=qfe.displayName;const jP=10,zgt=[{icon:vl,text:"Formateurs vérifiés",desc:"Profils validés par nos équipes"},{icon:Gr,text:"Réponse sous 48h",desc:"Mise en relation rapide"},{icon:iu,text:"Satisfaction garantie",desc:"Accompagnement personnalisé"}];function Ugt(){const{skillName:e}=wo(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState(!1),[c,u]=w.useState([]),[d,f]=w.useState({company:"",email:"",phone:"",message:""}),[m,h]=w.useState(!1),g=decodeURIComponent(e||"").replace(/-/g," "),p=g.charAt(0).toUpperCase()+g.slice(1);w.useEffect(()=>{e&&(x(),xi.trackPageView(`Skill Landing - ${p}`,{skill:p,pageType:"skill_landing"}))},[e]);const x=async()=>{i(!0);try{const{data:S,error:I}=await he.from("trainer_profiles").select("id, name, specialties, bio, photo_url, view_count, cv_url, cv_path, preferred_departments, linkedin_url, website_url, country, manual_certified, email_verified, referral_count, updated_at").eq("status","approved").eq("is_visible",!0);if(I)throw I;const P=(S||[]).filter(V=>{var C;return(C=V.specialties)==null?void 0:C.some(R=>R.toLowerCase().includes(g.toLowerCase())||g.toLowerCase().includes(R.toLowerCase()))}),{data:F}=await he.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),T=new Set((F==null?void 0:F.map(V=>V.trainer_id))||[]);n(Hm(P,T,g));const k=new Set;P.forEach(V=>{var C;(C=V.specialties)==null||C.forEach(R=>{R.toLowerCase()!==g.toLowerCase()&&k.add(R)})}),u(Array.from(k).slice(0,12))}catch(S){console.error("Error loading trainers:",S)}finally{i(!1)}},v=S=>encodeURIComponent(S.toLowerCase().replace(/\s+/g,"-")),b=S=>S.split(" ").map(I=>I[0]).join("").toUpperCase().slice(0,2),y=async S=>{if(S.preventDefault(),!d.email||!d.company){ae.error("Veuillez remplir les champs obligatoires");return}h(!0);try{const{error:I}=await he.from("school_requests").insert({school_name:d.company,contact_email:d.email,contact_name:d.company,contact_phone:d.phone||null,description:`Recherche de formateur en ${p}. ${d.message||""}`,subject_areas:[p],status:"pending"});if(I)throw I;xi.track({eventType:"offer_created",eventName:"Lead Form Submitted",metadata:{source:"skill_landing",skill:p,company:d.company}}),ae.success("Demande envoyée ! Nous vous recontactons sous 48h."),f({company:"",email:"",phone:"",message:""})}catch(I){console.error("Error submitting lead:",I),ae.error("Erreur lors de l'envoi. Veuillez réessayer.")}finally{h(!1)}},N=o?r:r.slice(0,jP),_=r.length>jP,j=r.length<5;return a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:`Formateurs ${p} Freelance - Experts Certifiés | PedagoBridge`,description:`Trouvez les meilleurs formateurs ${p} freelance. ${r.length} experts disponibles. Profils vérifiés, mise en relation rapide. Demandez un devis gratuit.`,url:`/skills/${e}`,keywords:[p,`formateur ${p}`,`expert ${p}`,"formation professionnelle",...c.slice(0,5)]}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Compétences",url:"/skills"},{name:p,url:`/skills/${e}`}]}),r.slice(0,3).map(S=>s.jsx(u1,{name:S.name,jobTitle:`Formateur ${p}`,description:S.bio||`Expert en ${p}`,image:S.photo_url||void 0,url:`/trainers/${S.id}`},S.id)),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 border-b",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/skills"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Toutes les compétences"]}),s.jsxs("div",{className:"max-w-4xl",children:[s.jsxs(Le,{variant:"secondary",className:"mb-4",children:[r.length," formateur",r.length>1?"s":""," disponible",r.length>1?"s":""]}),s.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-6",children:["Formateurs ",s.jsx("span",{className:"text-primary",children:p})," Freelance"]}),s.jsxs("p",{className:"text-xl text-muted-foreground mb-8 max-w-2xl",children:["Trouvez et engagez les meilleurs experts en ",p," pour vos formations professionnelles. Profils vérifiés, mise en relation sous 48h."]}),s.jsxs("div",{className:"flex flex-wrap gap-4",children:[s.jsx(ne,{size:"lg",asChild:!0,children:s.jsxs("a",{href:"#trainers",children:[s.jsx(sr,{className:"mr-2 h-5 w-5"}),"Voir les formateurs"]})}),s.jsx(ne,{size:"lg",variant:"outline",asChild:!0,children:s.jsxs("a",{href:"#contact",children:[s.jsx(ta,{className:"mr-2 h-5 w-5"}),"Demander un devis"]})})]})]})]})}),s.jsx("section",{className:"py-8 border-b bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:zgt.map((S,I)=>s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:s.jsx(S.icon,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:S.text}),s.jsx("p",{className:"text-sm text-muted-foreground",children:S.desc})]})]},I))})})}),s.jsx("div",{className:"container mx-auto px-4 py-12",children:s.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[j&&s.jsxs(ke,{className:"border-primary/50 bg-primary/5",id:"contact",children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5 text-primary"}),"Vous ne trouvez pas le formateur idéal ?"]}),s.jsxs("p",{className:"text-muted-foreground",children:["Notre équipe vous aide à trouver l'expert ",p," parfait pour votre besoin."]})]}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:y,className:"space-y-4",children:[s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"company",children:"Entreprise *"}),s.jsx(Ye,{id:"company",value:d.company,onChange:S=>f(I=>({...I,company:S.target.value})),placeholder:"Nom de votre entreprise",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email",children:"Email *"}),s.jsx(Ye,{id:"email",type:"email",value:d.email,onChange:S=>f(I=>({...I,email:S.target.value})),placeholder:"votre@email.com",required:!0})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"phone",children:"Téléphone"}),s.jsx(Ye,{id:"phone",value:d.phone,onChange:S=>f(I=>({...I,phone:S.target.value})),placeholder:"06 12 34 56 78"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"message",children:"Votre besoin"}),s.jsx(gn,{id:"message",value:d.message,onChange:S=>f(I=>({...I,message:S.target.value})),placeholder:"Décrivez votre projet de formation...",rows:3})]}),s.jsxs(ne,{type:"submit",className:"w-full",disabled:m,children:[m?s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Envoyer ma demande"]})]})})]}),s.jsxs("section",{id:"trainers",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-2",children:[s.jsx(Ii,{className:"h-6 w-6 text-primary"}),r.length>0?s.jsxs(s.Fragment,{children:["Nos experts ",p]}):s.jsxs(s.Fragment,{children:["Aucun formateur ",p," disponible"]})]}),r.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(sr,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),s.jsxs("p",{className:"text-lg font-medium mb-2",children:["Pas encore de formateur ",p]}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Décrivez votre besoin et nous trouverons l'expert qu'il vous faut."}),s.jsx(ne,{asChild:!0,children:s.jsx("a",{href:"#contact",children:"Demander un formateur"})})]})}):s.jsxs("div",{className:"space-y-4",children:[N.map(S=>s.jsx(ke,{className:"hover:shadow-md transition-all group",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(ps,{className:"h-16 w-16 shrink-0",children:[S.photo_url&&s.jsx(vi,{src:S.photo_url,alt:S.name}),s.jsx(gs,{className:"text-lg font-bold bg-primary text-primary-foreground",children:b(S.name)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h3",{className:"font-bold text-lg group-hover:text-primary transition-colors",children:S.name}),S.isAffiliated&&s.jsx(Zd,{size:"sm"})]}),S.bio&&s.jsx("p",{className:"text-muted-foreground text-sm mb-3 line-clamp-2",children:S.bio}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[S.specialties.slice(0,5).map((I,P)=>s.jsx(Le,{variant:I.toLowerCase().includes(g.toLowerCase())?"default":"secondary",className:"text-xs",children:I},P)),S.specialties.length>5&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",S.specialties.length-5]})]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>t(`/trainers/${S.id}`),children:["Voir le profil",s.jsx(tu,{className:"ml-1 h-4 w-4"})]})]})]})})},S.id)),_&&!o&&s.jsx("div",{className:"text-center pt-4",children:s.jsxs(ne,{variant:"outline",size:"lg",onClick:()=>l(!0),children:["Voir les ",r.length-jP," autres formateurs"]})})]})]}),s.jsxs("section",{id:"faq",className:"mt-12",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6",children:["Questions fréquentes sur les formateurs ",p]}),s.jsx(sd,{items:[{question:`Comment trouver un formateur ${p} ?`,answer:`PedagoBridge vous met en relation avec des formateurs experts en ${p}. Parcourez les profils disponibles ou soumettez votre demande pour être contacté sous 48h.`},{question:`Combien coûte un formateur ${p} ?`,answer:"Les tarifs varient selon l'expertise, la durée de la formation et le nombre de participants. En moyenne, comptez entre 500€ et 1500€ par jour. Demandez un devis gratuit pour obtenir un tarif personnalisé."},{question:`Les formateurs ${p} sont-ils certifiés ?`,answer:"Tous nos formateurs sont vérifiés par notre équipe. Ils possèdent une expérience significative et peuvent justifier de leurs compétences par des certifications, diplômes ou références clients."},{question:`Comment se déroule une formation ${p} ?`,answer:"Nos formateurs s'adaptent à vos besoins : formation en présentiel, distanciel ou hybride. La durée et le contenu sont personnalisés selon vos objectifs et le niveau des participants."},{question:"Comment se déroule la mise en relation ?",answer:"Décrivez votre besoin via notre formulaire, notre équipe analyse votre demande et vous propose les profils les plus adaptés sous 48h. Vous pouvez ensuite échanger directement avec les formateurs sélectionnés."}]}),s.jsxs(RM,{type:"single",collapsible:!0,className:"w-full",children:[s.jsxs(hm,{value:"faq-1",children:[s.jsxs(mm,{className:"text-left",children:["Comment trouver un formateur ",p," ?"]}),s.jsxs(pm,{className:"text-muted-foreground",children:["PedagoBridge vous met en relation avec des formateurs experts en ",p,". Parcourez les profils disponibles ou soumettez votre demande pour être contacté sous 48h."]})]}),s.jsxs(hm,{value:"faq-2",children:[s.jsxs(mm,{className:"text-left",children:["Combien coûte un formateur ",p," ?"]}),s.jsx(pm,{className:"text-muted-foreground",children:"Les tarifs varient selon l'expertise, la durée de la formation et le nombre de participants. En moyenne, comptez entre 500€ et 1500€ par jour. Demandez un devis gratuit pour obtenir un tarif personnalisé."})]}),s.jsxs(hm,{value:"faq-3",children:[s.jsxs(mm,{className:"text-left",children:["Les formateurs ",p," sont-ils certifiés ?"]}),s.jsx(pm,{className:"text-muted-foreground",children:"Tous nos formateurs sont vérifiés par notre équipe. Ils possèdent une expérience significative et peuvent justifier de leurs compétences par des certifications, diplômes ou références clients."})]}),s.jsxs(hm,{value:"faq-4",children:[s.jsxs(mm,{className:"text-left",children:["Comment se déroule une formation ",p," ?"]}),s.jsx(pm,{className:"text-muted-foreground",children:"Nos formateurs s'adaptent à vos besoins : formation en présentiel, distanciel ou hybride. La durée et le contenu sont personnalisés selon vos objectifs et le niveau des participants."})]}),s.jsxs(hm,{value:"faq-5",children:[s.jsx(mm,{className:"text-left",children:"Comment se déroule la mise en relation ?"}),s.jsx(pm,{className:"text-muted-foreground",children:"Décrivez votre besoin via notre formulaire, notre équipe analyse votre demande et vous propose les profils les plus adaptés sous 48h. Vous pouvez ensuite échanger directement avec les formateurs sélectionnés."})]})]})]})]}),s.jsxs("div",{className:"space-y-6",children:[!j&&s.jsxs(ke,{className:"sticky top-4",id:"contact",children:[s.jsx(ht,{children:s.jsxs(xt,{className:"text-lg",children:["Besoin d'un formateur ",p," ?"]})}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:y,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"company-sidebar",children:"Entreprise *"}),s.jsx(Ye,{id:"company-sidebar",value:d.company,onChange:S=>f(I=>({...I,company:S.target.value})),placeholder:"Nom de votre entreprise",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email-sidebar",children:"Email *"}),s.jsx(Ye,{id:"email-sidebar",type:"email",value:d.email,onChange:S=>f(I=>({...I,email:S.target.value})),placeholder:"votre@email.com",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"message-sidebar",children:"Votre besoin"}),s.jsx(gn,{id:"message-sidebar",value:d.message,onChange:S=>f(I=>({...I,message:S.target.value})),placeholder:"Décrivez votre projet...",rows:3})]}),s.jsxs(ne,{type:"submit",className:"w-full",disabled:m,children:[m?s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Demander un devis"]})]})})]}),s.jsx(ke,{className:"border-blue-200 bg-blue-50/50 dark:border-blue-900 dark:bg-blue-950/30",children:s.jsx(Ae,{className:"py-5",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/50 flex items-center justify-center shrink-0",children:s.jsx(Ii,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-sm mb-1",children:"Outil Recruteur"}),s.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["Questions techniques pour valider un candidat ",p]}),s.jsx(ne,{variant:"outline",size:"sm",className:"w-full text-xs",onClick:()=>t(`/recruiter-tools/interview-questions/${v(p)}`),children:"Voir les questions d'entretien"})]})]})})}),c.length>0&&s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"Compétences connexes"})}),s.jsx(Ae,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(S=>s.jsx(vt,{to:`/skills/${v(S)}`,children:s.jsx(Le,{variant:"outline",className:"cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",children:S})},S))})})]}),s.jsx(ke,{className:"bg-primary text-primary-foreground",children:s.jsxs(Ae,{className:"py-6",children:[s.jsxs("h3",{className:"font-bold text-lg mb-2",children:["Vous êtes formateur ",p," ?"]}),s.jsx("p",{className:"text-primary-foreground/80 text-sm mb-4",children:"Rejoignez notre réseau et recevez des opportunités de missions."}),s.jsx(ne,{variant:"secondary",className:"w-full",onClick:()=>t("/trainer-signup"),children:"Devenir formateur"})]})})]})]})})]})}function qgt(){const[e,t]=w.useState([]),[r,n]=w.useState(!0),[a,i]=w.useState("");w.useEffect(()=>{o()},[]);const o=async()=>{try{const{data:m,error:h}=await he.from("trainer_profiles").select("preferred_departments, location_preference").eq("status","approved").eq("is_visible",!0);if(h)throw h;const g=new Map;let p=0;m==null||m.forEach(v=>{const b=v.preferred_departments||[];X6(b).forEach(N=>{g.set(N,(g.get(N)||0)+1)}),jie(b,3)&&p++}),p>0&&g.set("National",p);const x=Array.from(g.entries()).map(([v,b])=>({name:v,count:b,slug:encodeURIComponent(v.toLowerCase().replace(/\s+/g,"-"))})).sort((v,b)=>b.count-v.count);t(x)}catch(m){console.error("Error loading cities:",m)}finally{n(!1)}},l=m=>encodeURIComponent(m.toLowerCase().replace(/\s+/g,"-")),c=e.filter(m=>m.name.toLowerCase().includes(a.toLowerCase())),u=c.reduce((m,h)=>{var p;const g=((p=h.name[0])==null?void 0:p.toUpperCase())||"#";return m[g]||(m[g]=[]),m[g].push(h),m},{}),d=Object.keys(u).sort(),f=e.slice(0,20);return r?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:"Formateurs par Ville - Trouvez un Expert Près de Chez Vous | PedagoBridge",description:`Trouvez des formateurs professionnels dans ${e.length}+ villes en France. ${f.slice(0,5).map(m=>m.name).join(", ")} et plus. Mise en relation rapide.`,url:"/villes",keywords:["formateur","formation",...f.slice(0,10).map(m=>`formateur ${m.name}`)]}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Villes",url:"/villes"}]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 border-b",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Formateurs par Ville"}),s.jsxs("p",{className:"text-xl text-muted-foreground mb-8",children:["Trouvez un formateur expert dans ",e.length,"+ localisations"]}),s.jsxs("div",{className:"relative max-w-xl mx-auto",children:[s.jsx(pa,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher une ville...",value:a,onChange:m=>i(m.target.value),className:"pl-12 h-14 text-lg"})]})]})})}),s.jsxs("div",{className:"container mx-auto px-4 py-12",children:[!a&&f.length>0&&s.jsx("section",{className:"mb-16",children:s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Kd,{className:"h-5 w-5 text-primary"}),"Villes populaires"]})}),s.jsx(Ae,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((m,h)=>{const g=h<5?"text-lg px-4 py-2":h<12?"text-base px-3 py-1.5":"text-sm px-2 py-1";return s.jsx(vt,{to:`/villes/${l(m.name)}`,className:"inline-block",children:s.jsxs(Le,{variant:h<5?"default":"secondary",className:`${g} hover:scale-105 transition-transform cursor-pointer`,children:[s.jsx(Gs,{className:"mr-1 h-3 w-3"}),m.name,s.jsxs("span",{className:"ml-2 opacity-70",children:["(",m.count,")"]})]})},m.name)})})})]})}),s.jsxs("section",{children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-2",children:[s.jsx(Gs,{className:"h-6 w-6 text-primary"}),"Toutes les villes (A-Z)"]}),c.length===0?s.jsx(ke,{children:s.jsx(Ae,{className:"py-12 text-center",children:s.jsxs("p",{className:"text-muted-foreground",children:['Aucune ville trouvée pour "',a,'"']})})}):s.jsx("div",{className:"space-y-8",children:d.map(m=>s.jsxs("div",{id:`letter-${m}`,children:[s.jsx("h3",{className:"text-xl font-bold text-primary mb-3 border-b pb-2",children:m}),s.jsx("div",{className:"grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:u[m].map(h=>s.jsx(vt,{to:`/villes/${l(h.name)}`,className:"group",children:s.jsx(ke,{className:"h-full hover:border-primary/50 hover:shadow-md transition-all",children:s.jsxs(Ae,{className:"p-4 flex items-center justify-between",children:[s.jsxs("span",{className:"font-medium group-hover:text-primary transition-colors flex items-center gap-2",children:[s.jsx(Gs,{className:"h-4 w-4 text-muted-foreground"}),h.name]}),s.jsxs(Le,{variant:"outline",className:"shrink-0",children:[h.count," formateur",h.count>1?"s":""]})]})})},h.name))})]},m))})]}),!a&&d.length>0&&s.jsx("nav",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 bg-background/95 backdrop-blur border rounded-full px-4 py-2 shadow-lg z-50",children:s.jsx("div",{className:"flex gap-1 flex-wrap justify-center max-w-lg",children:d.map(m=>s.jsx("a",{href:`#letter-${m}`,className:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-primary hover:text-primary-foreground transition-colors text-sm font-medium",children:m},m))})})]})]})}const _P=10,Vgt=[{icon:vl,text:"Formateurs vérifiés",desc:"Profils validés par nos équipes"},{icon:Gr,text:"Réponse sous 48h",desc:"Mise en relation rapide"},{icon:iu,text:"Satisfaction garantie",desc:"Accompagnement personnalisé"}];function Wgt(){const{cityName:e}=wo(),t=Xt(),[r,n]=w.useState([]),[a,i]=w.useState(!0),[o,l]=w.useState(!1),[c,u]=w.useState([]),[d,f]=w.useState([]),[m,h]=w.useState({company:"",email:"",phone:"",message:""}),[g,p]=w.useState(!1),x=decodeURIComponent(e||"").replace(/-/g," "),v=x.charAt(0).toUpperCase()+x.slice(1),b=v.toLowerCase()==="national";w.useEffect(()=>{e&&(y(),xi.trackPageView(`City Landing - ${v}`,{city:v,pageType:"city_landing"}))},[e]);const y=async()=>{i(!0);try{const{data:T,error:k}=await he.from("trainer_profiles").select("id, name, specialties, bio, photo_url, view_count, preferred_departments, location_preference, cv_url, cv_path, linkedin_url, website_url, country, manual_certified, email_verified, referral_count, updated_at").eq("status","approved").eq("is_visible",!0);if(k)throw k;const V=(T||[]).filter(z=>{const K=z.preferred_departments||[];return b?jie(K,3):X6(K).some(A=>A.toLowerCase()===x.toLowerCase())}),{data:C}=await he.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),R=new Set((C==null?void 0:C.map(z=>z.trainer_id))||[]);n(Hm(V,R));const H=new Map;V.forEach(z=>{var K;(K=z.specialties)==null||K.forEach(E=>{H.set(E,(H.get(E)||0)+1)})});const q=Array.from(H.entries()).sort((z,K)=>K[1]-z[1]).slice(0,10).map(([z])=>z);u(q);const L=new Map;T==null||T.forEach(z=>{X6(z.preferred_departments||[]).forEach(E=>{E.toLowerCase()!==x.toLowerCase()&&L.set(E,(L.get(E)||0)+1)})});const M=Array.from(L.entries()).sort((z,K)=>K[1]-z[1]).slice(0,8).map(([z])=>z);f(M)}catch(T){console.error("Error loading trainers:",T)}finally{i(!1)}},N=T=>encodeURIComponent(T.toLowerCase().replace(/\s+/g,"-")),_=T=>T.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2),j=async T=>{if(T.preventDefault(),!m.email||!m.company){ae.error("Veuillez remplir les champs obligatoires");return}p(!0);try{const{error:k}=await he.from("school_requests").insert({school_name:m.company,contact_email:m.email,contact_name:m.company,contact_phone:m.phone||null,description:`Recherche de formateur à ${v}. ${m.message||""}`,subject_areas:[],city:b?null:v,status:"pending"});if(k)throw k;xi.track({eventType:"offer_created",eventName:"Lead Form Submitted",metadata:{source:"city_landing",city:v,company:m.company}}),ae.success("Demande envoyée ! Nous vous recontactons sous 48h."),h({company:"",email:"",phone:"",message:""})}catch(k){console.error("Error submitting lead:",k),ae.error("Erreur lors de l'envoi. Veuillez réessayer.")}finally{p(!1)}},S=[{question:`Comment trouver un formateur à ${v} ?`,answer:`PedagoBridge vous met en relation avec des formateurs professionnels basés à ${v} ou intervenant dans cette zone. Parcourez les profils disponibles ou soumettez votre demande pour être contacté sous 48h.`},{question:`Combien coûte un formateur à ${v} ?`,answer:"Les tarifs varient selon l'expertise, la durée de la formation et le nombre de participants. En moyenne, comptez entre 500€ et 1500€ par jour. Demandez un devis gratuit pour obtenir un tarif personnalisé."},{question:`Les formateurs ${b?"nationaux":`de ${v}`} sont-ils certifiés ?`,answer:"Tous nos formateurs sont vérifiés par notre équipe. Ils possèdent une expérience significative et peuvent justifier de leurs compétences par des certifications, diplômes ou références clients."},{question:`Quelles formations sont disponibles ${b?"en France":`à ${v}`} ?`,answer:`Nos formateurs couvrent un large éventail de domaines : informatique, management, langues, soft skills, et bien plus. ${c.length>0?`Les compétences les plus demandées sont : ${c.slice(0,5).join(", ")}.`:""}`},{question:"Comment se déroule la mise en relation ?",answer:"Décrivez votre besoin via notre formulaire, notre équipe analyse votre demande et vous propose les profils les plus adaptés sous 48h. Vous pouvez ensuite échanger directement avec les formateurs sélectionnés."}],I=o?r:r.slice(0,_P),P=r.length>_P,F=r.length<5;return a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx(gr,{title:`Formateurs à ${v} - Experts Formation Professionnelle | PedagoBridge`,description:`Trouvez les meilleurs formateurs à ${v}. ${r.length} experts disponibles. Profils vérifiés, mise en relation rapide. Demandez un devis gratuit.`,url:`/villes/${e}`,keywords:[`formateur ${v}`,`formation ${v}`,"formation professionnelle",...c.slice(0,5)]}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Villes",url:"/villes"},{name:v,url:`/villes/${e}`}]}),s.jsx(sd,{items:S}),r.slice(0,3).map(T=>s.jsx(u1,{name:T.name,jobTitle:`Formateur à ${v}`,description:T.bio||`Expert formation à ${v}`,image:T.photo_url||void 0,url:`/trainers/${T.id}`},T.id)),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 border-b",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs(ne,{variant:"ghost",onClick:()=>t("/villes"),className:"mb-6",children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Toutes les villes"]}),s.jsxs("div",{className:"max-w-4xl",children:[s.jsxs(Le,{variant:"secondary",className:"mb-4",children:[s.jsx(Gs,{className:"mr-1 h-3 w-3"}),r.length," formateur",r.length>1?"s":""," disponible",r.length>1?"s":""]}),s.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-6",children:["Formateurs à ",s.jsx("span",{className:"text-primary",children:v})]}),s.jsx("p",{className:"text-xl text-muted-foreground mb-8 max-w-2xl",children:b?"Trouvez des formateurs intervenant partout en France pour vos formations professionnelles.":`Trouvez et engagez les meilleurs formateurs professionnels à ${v}. Profils vérifiés, mise en relation sous 48h.`}),s.jsxs("div",{className:"flex flex-wrap gap-4",children:[s.jsx(ne,{size:"lg",asChild:!0,children:s.jsxs("a",{href:"#trainers",children:[s.jsx(sr,{className:"mr-2 h-5 w-5"}),"Voir les formateurs"]})}),s.jsx(ne,{size:"lg",variant:"outline",asChild:!0,children:s.jsxs("a",{href:"#contact",children:[s.jsx(ta,{className:"mr-2 h-5 w-5"}),"Demander un devis"]})})]})]})]})}),s.jsx("section",{className:"py-8 border-b bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:Vgt.map((T,k)=>s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:s.jsx(T.icon,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:T.text}),s.jsx("p",{className:"text-sm text-muted-foreground",children:T.desc})]})]},k))})})}),s.jsx("div",{className:"container mx-auto px-4 py-12",children:s.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[F&&s.jsxs(ke,{className:"border-primary/50 bg-primary/5",id:"contact",children:[s.jsxs(ht,{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5 text-primary"}),"Vous ne trouvez pas le formateur idéal ?"]}),s.jsxs("p",{className:"text-muted-foreground",children:["Notre équipe vous aide à trouver l'expert parfait pour votre besoin à ",v,"."]})]}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:j,className:"space-y-4",children:[s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"company",children:"Entreprise *"}),s.jsx(Ye,{id:"company",value:m.company,onChange:T=>h(k=>({...k,company:T.target.value})),placeholder:"Nom de votre entreprise",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email",children:"Email *"}),s.jsx(Ye,{id:"email",type:"email",value:m.email,onChange:T=>h(k=>({...k,email:T.target.value})),placeholder:"votre@email.com",required:!0})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"phone",children:"Téléphone"}),s.jsx(Ye,{id:"phone",value:m.phone,onChange:T=>h(k=>({...k,phone:T.target.value})),placeholder:"06 12 34 56 78"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"message",children:"Votre besoin"}),s.jsx(gn,{id:"message",value:m.message,onChange:T=>h(k=>({...k,message:T.target.value})),placeholder:"Décrivez votre projet de formation...",rows:3})]}),s.jsxs(ne,{type:"submit",className:"w-full",disabled:g,children:[g?s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Envoyer ma demande"]})]})})]}),s.jsxs("section",{id:"trainers",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-2",children:[s.jsx(Ii,{className:"h-6 w-6 text-primary"}),r.length>0?s.jsxs(s.Fragment,{children:["Formateurs à ",v]}):s.jsxs(s.Fragment,{children:["Aucun formateur disponible à ",v]})]}),r.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(Gs,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),s.jsxs("p",{className:"text-lg font-medium mb-2",children:["Pas encore de formateur à ",v]}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Décrivez votre besoin et nous trouverons l'expert qu'il vous faut."}),s.jsx(ne,{asChild:!0,children:s.jsx("a",{href:"#contact",children:"Demander un formateur"})})]})}):s.jsxs("div",{className:"space-y-4",children:[I.map(T=>s.jsx(ke,{className:"hover:shadow-md transition-all group",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(ps,{className:"h-16 w-16 shrink-0",children:[T.photo_url&&s.jsx(vi,{src:T.photo_url,alt:T.name}),s.jsx(gs,{className:"text-lg font-bold bg-primary text-primary-foreground",children:_(T.name)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("h3",{className:"font-bold text-lg group-hover:text-primary transition-colors",children:T.name}),T.isAffiliated&&s.jsx(Zd,{size:"sm"})]}),T.bio&&s.jsx("p",{className:"text-muted-foreground text-sm mb-3 line-clamp-2",children:T.bio}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[T.specialties.slice(0,5).map((k,V)=>s.jsx(vt,{to:`/skills/${N(k)}`,children:s.jsx(Le,{variant:"secondary",className:"text-xs cursor-pointer hover:bg-primary hover:text-primary-foreground",children:k})},V)),T.specialties.length>5&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",T.specialties.length-5]})]}),s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>t(`/trainers/${T.id}`),children:["Voir le profil",s.jsx(tu,{className:"ml-1 h-4 w-4"})]})]})]})})},T.id)),P&&!o&&s.jsx("div",{className:"text-center pt-4",children:s.jsxs(ne,{variant:"outline",size:"lg",onClick:()=>l(!0),children:["Voir les ",r.length-_P," autres formateurs"]})})]})]}),s.jsx(TL,{}),s.jsxs("section",{id:"faq",className:"mt-12",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6",children:["Questions fréquentes sur les formateurs ",b?"en France":`à ${v}`]}),s.jsx(RM,{type:"single",collapsible:!0,className:"w-full",children:S.map((T,k)=>s.jsxs(hm,{value:`faq-${k}`,children:[s.jsx(mm,{className:"text-left",children:T.question}),s.jsx(pm,{className:"text-muted-foreground",children:T.answer})]},k))})]})]}),s.jsxs("div",{className:"space-y-6",children:[!F&&s.jsxs(ke,{className:"sticky top-4",id:"contact",children:[s.jsx(ht,{children:s.jsxs(xt,{className:"text-lg",children:["Besoin d'un formateur à ",v," ?"]})}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:j,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"company-sidebar",children:"Entreprise *"}),s.jsx(Ye,{id:"company-sidebar",value:m.company,onChange:T=>h(k=>({...k,company:T.target.value})),placeholder:"Nom de votre entreprise",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"email-sidebar",children:"Email *"}),s.jsx(Ye,{id:"email-sidebar",type:"email",value:m.email,onChange:T=>h(k=>({...k,email:T.target.value})),placeholder:"votre@email.com",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{htmlFor:"message-sidebar",children:"Votre besoin"}),s.jsx(gn,{id:"message-sidebar",value:m.message,onChange:T=>h(k=>({...k,message:T.target.value})),placeholder:"Décrivez votre projet...",rows:3})]}),s.jsxs(ne,{type:"submit",className:"w-full",disabled:g,children:[g?s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}):s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Demander un devis"]})]})})]}),c.length>0&&s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"Compétences populaires"})}),s.jsx(Ae,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(T=>s.jsx(vt,{to:`/skills/${N(T)}`,children:s.jsx(Le,{variant:"outline",className:"cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",children:T})},T))})})]}),d.length>0&&s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"Autres villes"})}),s.jsx(Ae,{children:s.jsx("div",{className:"flex flex-wrap gap-2",children:d.map(T=>s.jsx(vt,{to:`/villes/${N(T)}`,children:s.jsxs(Le,{variant:"outline",className:"cursor-pointer hover:bg-primary hover:text-primary-foreground transition-colors",children:[s.jsx(Gs,{className:"mr-1 h-3 w-3"}),T]})},T))})})]}),s.jsx(ke,{className:"bg-primary text-primary-foreground",children:s.jsxs(Ae,{className:"py-6",children:[s.jsxs("h3",{className:"font-bold text-lg mb-2",children:["Vous êtes formateur ",b?"":`à ${v}`," ?"]}),s.jsx("p",{className:"text-primary-foreground/80 text-sm mb-4",children:"Rejoignez notre réseau et recevez des opportunités de missions."}),s.jsx(ne,{variant:"secondary",className:"w-full",onClick:()=>t("/trainer-signup"),children:"Devenir formateur"})]})})]})]})})]})}const Hgt=["Paris","Lyon","Marseille","Toulouse","Nice","Nantes","Strasbourg","Montpellier","Bordeaux","Lille","Rennes","Reims","Le Havre","Saint-Étienne","Toulon","Grenoble","Dijon","Angers","Nîmes","Villeurbanne"],Ggt=()=>{var g;const{cityName:e,skillName:t}=wo(),r=decodeURIComponent(e||"").replace(/-/g," "),n=decodeURIComponent(t||"").replace(/-/g," "),a=r.charAt(0).toUpperCase()+r.slice(1).toLowerCase(),i=n,{data:o,isLoading:l}=ga({queryKey:["trainers-city-skill",a,i],queryFn:async()=>{const{data:p,error:x}=await he.from("trainer_profiles").select("id, name, bio, photo_url, specialties, view_count, preferred_cities, location_preference, preferred_modality, cv_url, cv_path, preferred_departments, linkedin_url, website_url, country, manual_certified, email_verified, referral_count, updated_at").eq("status","approved").eq("is_visible",!0);if(x)throw x;const{data:v}=await he.from("trainer_contracts").select("trainer_id").eq("counter_signed",!0),b=new Set((v==null?void 0:v.map(T=>T.trainer_id))||[]),y=i.toLowerCase(),N=(p||[]).filter(T=>T.specialties.some(k=>k.toLowerCase().includes(y)||y.includes(k.toLowerCase()))),_=[],j=[],S=[];N.forEach(T=>{const k=T.preferred_cities||[],V=a.toLowerCase(),C=k.some(q=>q.toLowerCase()===V),R=T.location_preference==="national",H=T.location_preference==="remote"||T.preferred_modality==="distanciel";C?_.push({...T,availabilityType:"local"}):R?j.push({...T,availabilityType:"travel"}):H&&S.push({...T,availabilityType:"remote"})});const I=Hm(_,b,i),P=Hm(j,b,i),F=Hm(S,b,i);return{local:I,travel:P,remote:F,total:I.length+P.length+F.length}},enabled:!!a&&!!i});w.useEffect(()=>{a&&i&&xi.trackPageView(`City Skill Landing - ${i} à ${a}`,{city:a,skill:i,pageType:"city_skill_landing"})},[a,i]);const c=[...(o==null?void 0:o.local)||[],...(o==null?void 0:o.travel)||[],...(o==null?void 0:o.remote)||[]],u=c.slice(0,12),d=(((g=o==null?void 0:o.local)==null?void 0:g.length)||0)>0,f=[{name:"Compétences",url:"/skills"},{name:i,url:`/skills/${encodeURIComponent(i.toLowerCase().replace(/\s+/g,"-"))}`},{name:a,url:`/villes/${encodeURIComponent(a.toLowerCase().replace(/\s+/g,"-"))}/${encodeURIComponent(i.toLowerCase().replace(/\s+/g,"-"))}`}],m=[{question:`Comment trouver un formateur ${i} à ${a} ?`,answer:`PedagoBridge vous permet de trouver facilement des formateurs ${i} disponibles à ${a}. Parcourez les profils, consultez leurs expériences et contactez-les directement pour vos besoins de formation.`},{question:`Quel est le tarif d'un formateur ${i} à ${a} ?`,answer:`Les tarifs varient selon l'expérience et la durée de la mission. En moyenne, comptez entre 400€ et 800€ par jour pour un formateur ${i} qualifié à ${a}.`},{question:`Puis-je trouver un formateur ${i} en distanciel depuis ${a} ?`,answer:`Oui, de nombreux formateurs ${i} proposent des formations à distance. C'est idéal si vous souhaitez réduire les frais de déplacement tout en bénéficiant d'une formation de qualité.`},{question:`Comment vérifier les compétences d'un formateur ${i} ?`,answer:`Tous nos formateurs ${i} sont vérifiés par notre équipe. Consultez leur CV, leurs certifications et les avis d'autres établissements pour faire votre choix.`}],h=p=>{switch(p){case"local":return s.jsxs(Le,{className:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",children:[s.jsx(Vr,{className:"w-3 h-3 mr-1"}),"Basé à ",a]});case"travel":return s.jsxs(Le,{className:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-100",children:[s.jsx(Vve,{className:"w-3 h-3 mr-1"}),"Se déplace à ",a]});case"remote":return s.jsxs(Le,{className:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-100",children:[s.jsx(Bve,{className:"w-3 h-3 mr-1"}),"Disponible en distanciel"]})}};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:`Formateurs ${i} à ${a} - Experts Freelance | PedagoBridge`,description:`Trouvez les meilleurs formateurs ${i} à ${a}. ${(o==null?void 0:o.total)||0} experts disponibles pour vos formations. Devis gratuit sous 24h.`,keywords:[i,a,"formateur","formation","freelance","expert"],url:`https://pedagobridge.fr/villes/${e}/${t}`}),s.jsx(Qa,{items:f}),s.jsx(sd,{items:m}),u.slice(0,3).map(p=>s.jsx(u1,{name:p.name,jobTitle:`Formateur ${i}`,description:p.bio||`Expert ${i} disponible à ${a}`,image:p.photo_url||void 0},p.id)),s.jsx("section",{className:"relative bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 md:py-24",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx(Ap,{items:f}),s.jsxs("div",{className:"max-w-4xl mx-auto text-center mt-8",children:[s.jsxs(Le,{variant:"outline",className:"mb-4",children:[s.jsx(Gs,{className:"w-3 h-3 mr-1"}),a,", France"]}),s.jsxs("h1",{className:"text-4xl md:text-5xl font-bold mb-6",children:["Formateurs ",s.jsx("span",{className:"text-primary",children:i})," à ",a]}),s.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:d?s.jsxs(s.Fragment,{children:["Économisez sur les frais de déplacement. Engagez un expert local à ",a,"."]}):s.jsxs(s.Fragment,{children:["Trouvez des experts ",i," disponibles pour ",a," en présentiel ou distanciel."]})}),s.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mb-8",children:[s.jsxs("div",{className:"flex items-center gap-2 bg-background/80 backdrop-blur px-4 py-2 rounded-full",children:[s.jsx(sr,{className:"w-5 h-5 text-primary"}),s.jsxs("span",{className:"font-semibold",children:[(o==null?void 0:o.total)||0," formateurs"]})]}),(o==null?void 0:o.local)&&o.local.length>0&&s.jsxs("div",{className:"flex items-center gap-2 bg-green-100 dark:bg-green-900/30 px-4 py-2 rounded-full",children:[s.jsx(Vr,{className:"w-5 h-5 text-green-600"}),s.jsxs("span",{className:"font-semibold text-green-800 dark:text-green-200",children:[o.local.length," locaux"]})]}),s.jsxs("div",{className:"flex items-center gap-2 bg-background/80 backdrop-blur px-4 py-2 rounded-full",children:[s.jsx(Gr,{className:"w-5 h-5 text-primary"}),s.jsx("span",{className:"font-semibold",children:"Réponse sous 24h"})]})]})]})]})}),s.jsx("section",{className:"py-8 bg-muted/30 border-y",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"flex flex-wrap justify-center items-center gap-8 text-sm text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yp,{className:"w-5 h-5 text-primary"}),s.jsx("span",{children:"Formateurs vérifiés"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(iu,{className:"w-5 h-5 text-yellow-500"}),s.jsx("span",{children:"Avis authentiques"})]})]})})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"lg:col-span-2",children:[s.jsx("h2",{className:"text-2xl font-bold mb-6",children:d?s.jsxs(s.Fragment,{children:["Experts ",i," basés à ",a]}):s.jsxs(s.Fragment,{children:["Experts ",i," disponibles pour ",a]})}),l?s.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:[...Array(6)].map((p,x)=>s.jsx(ke,{children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx(Yr,{className:"h-16 w-16 rounded-full"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx(Yr,{className:"h-4 w-3/4"}),s.jsx(Yr,{className:"h-3 w-full"}),s.jsx(Yr,{className:"h-3 w-1/2"})]})]})})},x))}):u.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:u.map(p=>s.jsx(vt,{to:`/formateurs/${p.id}`,className:"block",children:s.jsx(ke,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsxs(Ae,{className:"p-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs(ps,{className:"h-16 w-16",children:[s.jsx(vi,{src:p.photo_url||void 0,alt:p.name}),s.jsx(gs,{className:"text-lg",children:p.name.split(" ").map(x=>x[0]).join("").slice(0,2)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("h3",{className:"font-semibold truncate",children:p.name}),p.isAffiliated&&s.jsx(Zd,{size:"sm"})]}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:p.bio||`Expert ${i}`}),h(p.availabilityType)]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1 mt-3",children:[p.specialties.slice(0,3).map((x,v)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:x},v)),p.specialties.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",p.specialties.length-3]})]})]})})},p.id))}),c.length>12&&s.jsx("div",{className:"text-center mt-8",children:s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(vt,{to:`/skills/${encodeURIComponent(i.toLowerCase().replace(/\s+/g,"-"))}`,children:["Voir tous les formateurs ",i]})})})]}):s.jsx(ke,{className:"bg-muted/50",children:s.jsxs(Ae,{className:"p-8 text-center",children:[s.jsx(sr,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),s.jsxs("h3",{className:"text-lg font-semibold mb-2",children:["Pas encore de formateur ",i," à ",a]}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Décrivez votre besoin et nous trouverons le formateur idéal pour vous."})]})})]}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(ke,{className:"sticky top-24 border-primary/20",children:s.jsxs(Ae,{className:"p-6",children:[s.jsxs("h3",{className:"text-lg font-semibold mb-2",children:["Besoin d'un formateur ",i," ?"]}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Décrivez votre projet et recevez des propositions sous 24h."}),s.jsx(ne,{asChild:!0,className:"w-full mb-3",children:s.jsx(vt,{to:"/ecoles/inscription",children:"Publier une offre gratuitement"})}),s.jsx(ne,{variant:"outline",asChild:!0,className:"w-full mb-3",children:s.jsx(vt,{to:"/contact",children:"Contacter notre équipe"})}),s.jsxs("div",{className:"pt-4 border-t text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Vous êtes formateur ?"}),s.jsx(ne,{variant:"link",asChild:!0,className:"p-0 h-auto text-primary",children:s.jsx(vt,{to:"/formateurs/inscription",children:"Rejoignez notre réseau"})})]})]})})})]})})}),s.jsx(TL,{}),s.jsx("section",{className:"py-12 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("h2",{className:"text-xl font-semibold mb-6",children:["Formateurs ",i," dans d'autres villes"]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Hgt.filter(p=>p.toLowerCase()!==a.toLowerCase()).slice(0,10).map(p=>s.jsx(ne,{variant:"outline",size:"sm",asChild:!0,children:s.jsxs(vt,{to:`/villes/${encodeURIComponent(p.toLowerCase())}/${encodeURIComponent(i.toLowerCase().replace(/\s+/g,"-"))}`,children:[i," à ",p]})},p))})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-8 text-center",children:["Questions fréquentes sur les formateurs ",i," à ",a]}),s.jsx(RM,{type:"single",collapsible:!0,className:"w-full",children:m.map((p,x)=>s.jsxs(hm,{value:`faq-${x}`,children:[s.jsx(mm,{className:"text-left",children:p.question}),s.jsx(pm,{className:"text-muted-foreground",children:p.answer})]},x))})]})}),s.jsx(zC,{})]})},Kgt=()=>{const{skillName:e}=wo(),[t,r]=w.useState(new Set),[n,a]=w.useState(new Set),i=decodeURIComponent(e||"").replace(/-/g," "),o=i.charAt(0).toUpperCase()+i.slice(1),{data:l,isLoading:c}=ga({queryKey:["interview-questions",o],queryFn:async()=>{const{data:g,error:p}=await he.from("skill_interview_questions").select("*").ilike("skill_tag",o).order("display_order",{ascending:!0});if(p)throw p;return g},enabled:!!o}),u=g=>{r(p=>{const x=new Set(p);return x.has(g)?x.delete(g):x.add(g),x})},d=async(g,p)=>{try{await navigator.clipboard.writeText(g),a(x=>new Set(x).add(p)),ae.success("Question copiée dans le presse-papier"),setTimeout(()=>{a(x=>{const v=new Set(x);return v.delete(p),v})},2e3)}catch{ae.error("Impossible de copier la question")}},f=[{name:"Outils RH",url:"/recruiter-tools"},{name:`Questions ${o}`,url:`/recruiter-tools/interview-questions/${e}`}],m=[{question:`Comment évaluer un formateur ${o} lors d'un entretien ?`,answer:"Utilisez des questions techniques ciblées qui testent à la fois les connaissances théoriques et l'expérience pratique. Variez les niveaux de difficulté pour distinguer les juniors des seniors."},{question:`Quelles sont les red flags lors d'un entretien avec un formateur ${o} ?`,answer:"Méfiez-vous des réponses trop vagues, de l'incapacité à donner des exemples concrets, ou d'une mauvaise compréhension des fondamentaux malgré des années d'expérience affichées."},{question:`Combien de questions poser pour évaluer un formateur ${o} ?`,answer:"Nous recommandons 5 à 10 questions bien ciblées couvrant différents aspects de la compétence, plutôt qu'un grand nombre de questions superficielles."}],h=()=>s.jsx(ke,{className:"border-primary/30 bg-gradient-to-br from-primary/5 to-primary/10 my-8",children:s.jsx(Ae,{className:"p-6 md:p-8",children:s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-6",children:[s.jsx("div",{className:"flex-shrink-0",children:s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/20 flex items-center justify-center",children:s.jsx(ma,{className:"w-8 h-8 text-primary"})})}),s.jsxs("div",{className:"flex-1 text-center md:text-left",children:[s.jsx("h3",{className:"text-xl font-bold mb-2",children:"Pas le temps de tester les candidats vous-même ?"}),s.jsxs("p",{className:"text-muted-foreground mb-4",children:["Les formateurs PedagoBridge sont déjà testés et certifiés en ",s.jsx("strong",{children:o}),". Gagnez du temps et accédez à des experts vérifiés."]}),s.jsx(ne,{asChild:!0,size:"lg",className:"group",children:s.jsxs(vt,{to:`/skills/${encodeURIComponent(o.toLowerCase().replace(/\s+/g,"-"))}`,children:["Voir les formateurs ",o," certifiés",s.jsx(Mn,{className:"ml-2 w-4 h-4 group-hover:translate-x-1 transition-transform"})]})})]})]})})});return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:`10 Questions d'entretien pour recruter un expert ${o} | PedagoBridge`,description:`Évaluez efficacement les candidats ${o} avec notre checklist de questions d'entretien techniques. Guide complet pour recruteurs avec réponses attendues.`,keywords:[o,"entretien","recrutement","formateur","questions techniques","évaluation"],url:`https://pedagobridge.fr/recruiter-tools/interview-questions/${e}`}),s.jsx(Qa,{items:f}),s.jsx(sd,{items:m}),s.jsxs("section",{className:"relative bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 text-white py-16 md:py-24",children:[s.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI2MCIgaGVpZ2h0PSI2MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAxMCAwIEwgMCAwIDAgMTAiIGZpbGw9Im5vbmUiIHN0cm9rZT0icmdiYSgyNTUsMjU1LDI1NSwwLjAzKSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9wYXR0ZXJuPjwvZGVmcz48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyaWQpIi8+PC9zdmc+')] opacity-50"}),s.jsxs("div",{className:"container mx-auto px-4 relative z-10",children:[s.jsx(Ap,{items:f,className:"text-slate-400 mb-8"}),s.jsxs("div",{className:"max-w-4xl",children:[s.jsxs(Le,{variant:"outline",className:"mb-4 border-primary/50 text-primary bg-primary/10",children:[s.jsx(Qm,{className:"w-3 h-3 mr-1"}),"Outil Recruteur"]}),s.jsxs("h1",{className:"text-3xl md:text-5xl font-bold mb-6 leading-tight",children:["Comment valider un formateur ",s.jsx("span",{className:"text-primary",children:o})," freelance ?",s.jsx("br",{}),s.jsx("span",{className:"text-2xl md:text-3xl text-slate-300 font-normal",children:"La checklist ultime."})]}),s.jsx("p",{className:"text-lg md:text-xl text-slate-300 mb-8 max-w-2xl",children:"Ne vous faites pas avoir par de faux experts. Utilisez ces questions techniques pour tester vos candidats et identifier les vrais professionnels."}),s.jsxs("div",{className:"flex flex-wrap gap-6 text-sm text-slate-400",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sr,{className:"w-5 h-5 text-primary"}),s.jsx("span",{children:"Utilisé par +200 RH"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yp,{className:"w-5 h-5 text-primary"}),s.jsx("span",{children:"Questions validées par des experts"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ii,{className:"w-5 h-5 text-primary"}),s.jsxs("span",{children:[(l==null?void 0:l.length)||0," questions disponibles"]})]})]})]})]})]}),s.jsx("section",{className:"py-16 bg-background",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("h2",{className:"text-2xl font-bold",children:["Questions d'entretien ",o]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Le,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Junior"}),s.jsx(Le,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Senior"})]})]}),c?s.jsx("div",{className:"space-y-4",children:[...Array(5)].map((g,p)=>s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx(Yr,{className:"h-6 w-3/4 mb-4"}),s.jsx(Yr,{className:"h-4 w-full mb-2"}),s.jsx(Yr,{className:"h-4 w-2/3"})]})},p))}):l&&l.length>0?s.jsxs("div",{className:"space-y-6",children:[l.map((g,p)=>s.jsxs("div",{children:[p===3&&s.jsx(h,{}),s.jsxs(ke,{className:"overflow-hidden hover:shadow-md transition-shadow",children:[s.jsx(ht,{className:"pb-3",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 text-primary font-semibold flex items-center justify-center text-sm",children:p+1}),s.jsxs("div",{children:[s.jsx(xt,{className:"text-lg leading-relaxed",children:g.question_text}),s.jsx(Le,{variant:"outline",className:`mt-2 ${g.complexity_level==="Junior"?"bg-green-50 text-green-700 border-green-200":"bg-orange-50 text-orange-700 border-orange-200"}`,children:g.complexity_level})]})]}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>d(g.question_text,g.id),className:"flex-shrink-0",children:n.has(g.id)?s.jsx(ma,{className:"w-4 h-4 text-green-600"}):s.jsx(_ve,{className:"w-4 h-4"})})]})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start gap-2 p-3 bg-blue-50 dark:bg-blue-950/30 rounded-lg",children:[s.jsx(gR,{className:"w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:"Pourquoi poser cette question ?"}),s.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:g.why_ask_this})]})]}),s.jsxs("div",{className:"relative",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Réponse attendue"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(g.id),className:"text-xs",children:t.has(g.id)?s.jsxs(s.Fragment,{children:[s.jsx(dR,{className:"w-3 h-3 mr-1"}),"Masquer"]}):s.jsxs(s.Fragment,{children:[s.jsx(is,{className:"w-3 h-3 mr-1"}),"Révéler la réponse"]})})]}),s.jsx("div",{className:`p-4 bg-muted/50 rounded-lg transition-all duration-300 ${t.has(g.id)?"":"blur-sm select-none"}`,children:s.jsx("p",{className:"text-sm leading-relaxed",children:g.expected_answer})}),!t.has(g.id)&&s.jsx("div",{className:"absolute inset-0 flex items-center justify-center cursor-pointer",onClick:()=>u(g.id),children:s.jsxs(ne,{variant:"secondary",size:"sm",children:[s.jsx(is,{className:"w-4 h-4 mr-2"}),"Cliquer pour révéler"]})})]})]})]})]},g.id)),s.jsx(h,{})]}):s.jsx(ke,{className:"bg-muted/50",children:s.jsxs(Ae,{className:"p-8 text-center",children:[s.jsx(Qm,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Questions en cours de préparation"}),s.jsxs("p",{className:"text-muted-foreground mb-4",children:["Notre équipe prépare les questions d'entretien pour ",o,". Revenez bientôt !"]}),s.jsx(ne,{asChild:!0,children:s.jsx(vt,{to:"/skills",children:"Voir toutes les compétences"})})]})})]})})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-8 text-center",children:["Questions fréquentes sur le recrutement ",o]}),s.jsx("div",{className:"space-y-4",children:m.map((g,p)=>s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h3",{className:"font-semibold mb-2",children:g.question}),s.jsx("p",{className:"text-muted-foreground text-sm",children:g.answer})]})},p))})]})}),s.jsx(zC,{})]})},Ygt=()=>{const[e,t]=w.useState(""),{data:r,isLoading:n}=ga({queryKey:["interview-questions-skills"],queryFn:async()=>{const{data:l,error:c}=await he.from("skill_interview_questions").select("skill_tag");if(c)throw c;const u=(l||[]).reduce((d,f)=>{const m=f.skill_tag;return d[m]=(d[m]||0)+1,d},{});return Object.entries(u).map(([d,f])=>({skill_tag:d,count:f})).sort((d,f)=>f.count-d.count)}}),a=r==null?void 0:r.filter(l=>l.skill_tag.toLowerCase().includes(e.toLowerCase())),i=[{name:"Outils Recruteur",url:"/recruiter-tools/interview-questions"}],o=l=>l.toLowerCase().replace(/\s+/g,"-");return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Questions d'entretien techniques pour recruteurs | PedagoBridge",description:"Boîte à outils RH : questions d'entretien techniques avec réponses pour évaluer les formateurs freelance. React, Excel, Management, Cybersécurité et plus.",keywords:["recrutement","entretien","questions techniques","formateur","évaluation","RH"],url:"https://pedagobridge.fr/recruiter-tools/interview-questions"}),s.jsx(Qa,{items:i}),s.jsxs("section",{className:"relative bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 text-white py-16 md:py-24",children:[s.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI2MCIgaGVpZ2h0PSI2MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAxMCAwIEwgMCAwIDAgMTAiIGZpbGw9Im5vbmUiIHN0cm9rZT0icmdiYSgyNTUsMjU1LDI1NSwwLjAzKSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9wYXR0ZXJuPjwvZGVmcz48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJ1cmwoI2dyaWQpIi8+PC9zdmc+')] opacity-50"}),s.jsxs("div",{className:"container mx-auto px-4 relative z-10",children:[s.jsx(Ap,{items:i,className:"text-slate-400 mb-8"}),s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsxs(Le,{variant:"outline",className:"mb-4 border-primary/50 text-primary bg-primary/10",children:[s.jsx(Bc,{className:"w-3 h-3 mr-1"}),"Boîte à outils RH"]}),s.jsxs("h1",{className:"text-3xl md:text-5xl font-bold mb-6 leading-tight",children:["Questions d'entretien ",s.jsx("span",{className:"text-primary",children:"techniques"}),s.jsx("br",{}),s.jsx("span",{className:"text-2xl md:text-3xl text-slate-300 font-normal",children:"pour valider vos candidats formateurs"})]}),s.jsx("p",{className:"text-lg md:text-xl text-slate-300 mb-8 max-w-2xl mx-auto",children:"Ne vous faites plus avoir par de faux experts. Accédez à nos checklists de questions techniques avec les réponses attendues, gratuitement."}),s.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-sm text-slate-400",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ii,{className:"w-5 h-5 text-primary"}),s.jsxs("span",{children:[(r==null?void 0:r.length)||0," compétences couvertes"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Qm,{className:"w-5 h-5 text-primary"}),s.jsxs("span",{children:[(r==null?void 0:r.reduce((l,c)=>l+c.count,0))||0," questions disponibles"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sr,{className:"w-5 h-5 text-primary"}),s.jsx("span",{children:"Utilisé par +200 RH"})]})]})]})]})]}),s.jsx("section",{className:"py-8 bg-muted/30 border-b",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"flex flex-wrap justify-center items-center gap-8 text-sm text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(yp,{className:"w-5 h-5 text-primary"}),s.jsx("span",{children:"Questions validées par des experts"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(vl,{className:"w-5 h-5 text-primary"}),s.jsx("span",{children:"Réponses attendues incluses"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Qm,{className:"w-5 h-5 text-primary"}),s.jsx("span",{children:"Niveaux Junior & Senior"})]})]})})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"relative mb-8",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher une compétence (React, Excel, Management...)",value:e,onChange:l=>t(l.target.value),className:"pl-10 h-12"})]}),n?s.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:[...Array(6)].map((l,c)=>s.jsx(ke,{children:s.jsxs(Ae,{className:"p-6",children:[s.jsx(Yr,{className:"h-6 w-3/4 mb-2"}),s.jsx(Yr,{className:"h-4 w-1/2"})]})},c))}):a&&a.length>0?s.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:a.map(l=>s.jsx(vt,{to:`/recruiter-tools/interview-questions/${o(l.skill_tag)}`,children:s.jsxs(ke,{className:"h-full hover:shadow-lg transition-all hover:border-primary/50 group",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(xt,{className:"text-lg group-hover:text-primary transition-colors",children:l.skill_tag}),s.jsx(Mn,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary group-hover:translate-x-1 transition-all"})]}),s.jsxs(Qr,{children:[l.count," questions techniques disponibles"]})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Le,{variant:"secondary",className:"text-xs",children:"Junior"}),s.jsx(Le,{variant:"secondary",className:"text-xs",children:"Senior"}),s.jsx(Le,{variant:"outline",className:"text-xs",children:"Réponses incluses"})]})})]})},l.skill_tag))}):s.jsx(ke,{className:"bg-muted/50",children:s.jsxs(Ae,{className:"p-8 text-center",children:[s.jsx(pa,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:e?"Aucun résultat trouvé":"Questionnaires en préparation"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:e?`Aucune compétence ne correspond à "${e}"`:"Notre équipe prépare les questionnaires d'entretien."}),e&&s.jsx(ne,{variant:"outline",onClick:()=>t(""),children:"Effacer la recherche"})]})}),s.jsx(ke,{className:"mt-12 border-primary/30 bg-gradient-to-br from-primary/5 to-primary/10",children:s.jsx(Ae,{className:"p-8",children:s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-6",children:[s.jsx("div",{className:"flex-shrink-0",children:s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/20 flex items-center justify-center",children:s.jsx(sr,{className:"w-8 h-8 text-primary"})})}),s.jsxs("div",{className:"flex-1 text-center md:text-left",children:[s.jsx("h3",{className:"text-xl font-bold mb-2",children:"Vous n'avez pas le temps de tester les candidats ?"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Nos formateurs PedagoBridge sont déjà testés et certifiés. Gagnez du temps et accédez à des experts vérifiés."}),s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(vt,{to:"/trainers",children:["Voir les formateurs certifiés",s.jsx(Mn,{className:"ml-2 w-4 h-4"})]})})]})]})})})]})})}),s.jsx(zC,{})]})},Xgt=()=>{const{data:e,isLoading:t}=ga({queryKey:["glossary-terms"],queryFn:async()=>{const{data:i,error:o}=await he.from("glossary_terms").select("*").order("term",{ascending:!0});if(o)throw o;return i}}),r=(e==null?void 0:e.reduce((i,o)=>{const l=o.term.charAt(0).toUpperCase();return i[l]||(i[l]=[]),i[l].push(o),i},{}))||{},n=Object.keys(r).sort(),a=[{name:"Glossaire",url:"/glossaire"}];return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Glossaire de la Formation Professionnelle | PedagoBridge",description:"Découvrez notre dictionnaire complet des termes de la formation professionnelle. Définitions claires de Qualiopi, CPF, OPCO et plus encore.",keywords:["glossaire formation","définitions formation professionnelle","vocabulaire formation","Qualiopi","CPF","OPCO"],url:"https://pedagobridge.fr/glossaire"}),s.jsx(Qa,{items:a}),s.jsx("section",{className:"relative bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 md:py-24",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx(Ap,{items:a}),s.jsxs("div",{className:"max-w-4xl mx-auto text-center mt-8",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-6",children:s.jsx(xl,{className:"w-8 h-8 text-primary"})}),s.jsxs("h1",{className:"text-4xl md:text-5xl font-bold mb-6",children:["Glossaire de la ",s.jsx("span",{className:"text-primary",children:"Formation"})]}),s.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Tous les termes essentiels de la formation professionnelle expliqués simplement."}),s.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:n.map(i=>s.jsx("a",{href:`#letter-${i}`,className:"w-10 h-10 flex items-center justify-center rounded-lg bg-background border hover:bg-primary hover:text-primary-foreground transition-colors font-semibold",children:i},i))})]})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4 max-w-4xl",children:t?s.jsx("div",{className:"space-y-8",children:[...Array(5)].map((i,o)=>s.jsxs("div",{className:"space-y-4",children:[s.jsx(Yr,{className:"h-8 w-16"}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx(Yr,{className:"h-20 w-full"}),s.jsx(Yr,{className:"h-20 w-full"})]})]},o))}):n.length>0?s.jsx("div",{className:"space-y-12",children:n.map(i=>s.jsxs("div",{id:`letter-${i}`,className:"scroll-mt-24",children:[s.jsx("h2",{className:"text-3xl font-bold text-primary mb-6 border-b pb-2",children:i}),s.jsx("div",{className:"grid gap-4",children:r[i].map(o=>s.jsx(vt,{to:`/glossaire/${o.slug}`,children:s.jsx(ke,{className:"hover:shadow-lg transition-all hover:border-primary/30",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("h3",{className:"text-xl font-semibold mb-2",children:o.term}),s.jsxs("p",{className:"text-muted-foreground line-clamp-2",children:[o.definition.substring(0,150),"..."]}),o.related_skill_tag&&s.jsx("span",{className:"inline-block mt-2 text-xs bg-primary/10 text-primary px-2 py-1 rounded",children:o.related_skill_tag})]}),s.jsx(Mn,{className:"w-5 h-5 text-muted-foreground flex-shrink-0 mt-1"})]})})})},o.id))})]},i))}):s.jsx(ke,{className:"bg-muted/50",children:s.jsxs(Ae,{className:"p-12 text-center",children:[s.jsx(xl,{className:"w-16 h-16 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Glossaire en cours de création"}),s.jsx("p",{className:"text-muted-foreground",children:"Les définitions seront bientôt disponibles."})]})})})})]})},Zgt=()=>{const{slug:e}=wo(),{data:t,isLoading:r}=ga({queryKey:["glossary-term",e],queryFn:async()=>{const{data:o,error:l}=await he.from("glossary_terms").select("*").eq("slug",e).single();if(l)throw l;return o},enabled:!!e}),{data:n,isLoading:a}=ga({queryKey:["glossary-trainers",t==null?void 0:t.related_skill_tag],queryFn:async()=>{if(!(t!=null&&t.related_skill_tag))return[];const{data:o,error:l}=await he.from("trainer_profiles").select("id, name, bio, photo_url, specialties").eq("status","approved").eq("is_visible",!0);if(l)throw l;const c=t.related_skill_tag.toLowerCase();return(o||[]).filter(u=>u.specialties.some(d=>d.toLowerCase().includes(c)||c.includes(d.toLowerCase()))).slice(0,6)},enabled:!!(t!=null&&t.related_skill_tag)}),i=[{name:"Glossaire",url:"/glossaire"},{name:(t==null?void 0:t.term)||"Définition",url:`/glossaire/${e}`}];return r?s.jsxs("div",{className:"container mx-auto px-4 py-16",children:[s.jsx(Yr,{className:"h-8 w-48 mb-4"}),s.jsx(Yr,{className:"h-12 w-3/4 mb-8"}),s.jsx(Yr,{className:"h-64 w-full"})]}):t?s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:`${t.term} - Définition | Glossaire PedagoBridge`,description:t.definition.substring(0,155),keywords:[t.term,"définition","formation professionnelle",t.related_skill_tag||""].filter(Boolean),url:`https://pedagobridge.fr/glossaire/${e}`}),s.jsx(Qa,{items:i}),n==null?void 0:n.slice(0,3).map(o=>s.jsx(u1,{name:o.name,jobTitle:`Expert ${t.related_skill_tag||t.term}`,description:o.bio||"Formateur spécialisé",image:o.photo_url||void 0},o.id)),s.jsx("section",{className:"relative bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 md:py-20",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx(Ap,{items:i}),s.jsxs("div",{className:"max-w-4xl mx-auto mt-8",children:[s.jsxs(vt,{to:"/glossaire",className:"inline-flex items-center text-sm text-muted-foreground hover:text-primary mb-4",children:[s.jsx(Yn,{className:"w-4 h-4 mr-1"}),"Retour au glossaire"]}),s.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[s.jsx("div",{className:"p-3 rounded-xl bg-primary/10",children:s.jsx(xl,{className:"w-8 h-8 text-primary"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-4xl md:text-5xl font-bold",children:t.term}),t.related_skill_tag&&s.jsx(Le,{variant:"secondary",className:"mt-2",children:t.related_skill_tag})]})]})]})]})}),s.jsx("section",{className:"py-12",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsx(ke,{children:s.jsxs(Ae,{className:"p-8",children:[s.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Définition"}),s.jsx("div",{className:"prose prose-lg max-w-none text-muted-foreground",children:t.definition.split(`
`).map((o,l)=>s.jsx("p",{className:"mb-4",children:o},l))})]})})})})}),t.related_skill_tag&&s.jsx("section",{className:"py-12 bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[s.jsx(sr,{className:"w-6 h-6 text-primary"}),s.jsxs("h2",{className:"text-2xl font-bold",children:["Les formateurs experts en ",t.term]})]}),a?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((o,l)=>s.jsx(ke,{children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex gap-4",children:[s.jsx(Yr,{className:"h-14 w-14 rounded-full"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx(Yr,{className:"h-4 w-3/4"}),s.jsx(Yr,{className:"h-3 w-full"})]})]})})},l))}):n&&n.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:n.map(o=>s.jsx(vt,{to:`/formateurs/${o.id}`,children:s.jsx(ke,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsxs(Ae,{className:"p-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs(ps,{className:"h-14 w-14",children:[s.jsx(vi,{src:o.photo_url||void 0,alt:o.name}),s.jsx(gs,{children:o.name.split(" ").map(l=>l[0]).join("").slice(0,2)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-semibold truncate",children:o.name}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:o.bio||`Expert ${t.related_skill_tag}`})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:o.specialties.slice(0,3).map((l,c)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:l},c))})]})})},o.id))}),s.jsx("div",{className:"text-center mt-8",children:s.jsx(ne,{asChild:!0,children:s.jsxs(vt,{to:`/skills/${encodeURIComponent(t.related_skill_tag.toLowerCase().replace(/\s+/g,"-"))}`,children:["Voir tous les formateurs ",t.related_skill_tag,s.jsx(Mn,{className:"w-4 h-4 ml-2"})]})})})]}):s.jsx(ke,{className:"bg-background",children:s.jsxs(Ae,{className:"p-8 text-center",children:[s.jsx(sr,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Pas encore de formateurs spécialisés dans ce domaine."}),s.jsx(ne,{asChild:!0,variant:"outline",children:s.jsx(vt,{to:"/trainers",children:"Découvrir tous les formateurs"})})]})})]})})}),s.jsx("section",{className:"py-12",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsx(ke,{className:"bg-primary/5 border-primary/20",children:s.jsxs(Ae,{className:"p-8 text-center",children:[s.jsxs("h3",{className:"text-xl font-semibold mb-2",children:["Besoin d'un formateur en ",t.related_skill_tag||t.term," ?"]}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Décrivez votre projet et recevez des propositions sous 24h."}),s.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[s.jsx(ne,{asChild:!0,children:s.jsx(vt,{to:"/ecoles/inscription",children:"Publier une offre"})}),s.jsx(ne,{variant:"outline",asChild:!0,children:s.jsx(vt,{to:"/contact",children:"Nous contacter"})})]})]})})})})})]}):s.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[s.jsx(xl,{className:"w-16 h-16 text-muted-foreground mx-auto mb-4"}),s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Terme non trouvé"}),s.jsx(ne,{asChild:!0,children:s.jsxs(vt,{to:"/glossaire",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"Retour au glossaire"]})})]})},Jgt=()=>{const e=e1(),[t,r]=w.useState(null),[n,a]=w.useState(!1),[i,o]=w.useState({term:"",slug:"",definition:"",related_skill_tag:""}),[l,c]=w.useState(!1),{data:u,isLoading:d}=ga({queryKey:["admin-glossary-terms"],queryFn:async()=>{const{data:b,error:y}=await he.from("glossary_terms").select("*").order("term",{ascending:!0});if(y)throw y;return b}}),f=Ic({mutationFn:async b=>{if(b.id){const{error:y}=await he.from("glossary_terms").update({term:b.term,slug:b.slug,definition:b.definition,related_skill_tag:b.related_skill_tag||null}).eq("id",b.id);if(y)throw y}else{const{error:y}=await he.from("glossary_terms").insert({term:b.term,slug:b.slug,definition:b.definition,related_skill_tag:b.related_skill_tag||null});if(y)throw y}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-glossary-terms"]}),ae.success(t?"Terme mis à jour":"Terme créé"),h()},onError:b=>{ae.error("Erreur: "+b.message)}}),m=Ic({mutationFn:async b=>{const{error:y}=await he.from("glossary_terms").delete().eq("id",b);if(y)throw y},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-glossary-terms"]}),ae.success("Terme supprimé")},onError:b=>{ae.error("Erreur: "+b.message)}}),h=()=>{o({term:"",slug:"",definition:"",related_skill_tag:""}),r(null),a(!1)},g=b=>{r(b),o({term:b.term,slug:b.slug,definition:b.definition,related_skill_tag:b.related_skill_tag||""}),a(!0)},p=b=>{b.preventDefault(),f.mutate({...i,id:t==null?void 0:t.id})},x=b=>b.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),v=async()=>{var b;c(!0);try{const{data:y,error:N}=await he.functions.invoke("generate-glossary-terms",{body:{generateAll:!0}});if(N)throw N;ae.success(`${((b=y.generated)==null?void 0:b.length)||0} termes générés. ${y.remaining||0} restants.`),e.invalidateQueries({queryKey:["admin-glossary-terms"]})}catch(y){ae.error("Erreur: "+y.message)}finally{c(!1)}};return s.jsxs("div",{className:"container mx-auto py-8 px-4",children:[s.jsx(sa,{items:[{label:"Tableau de bord",href:"/admin"},{label:"Glossaire",href:"/admin/glossary"}]}),s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-8",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[s.jsx(xl,{className:"w-8 h-8"}),"Gestion du Glossaire"]}),s.jsxs("p",{className:"text-muted-foreground",children:[(u==null?void 0:u.length)||0," termes définis"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:v,disabled:l,children:[l?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(a2,{className:"w-4 h-4 mr-2"}),"Générer depuis compétences"]}),s.jsxs(Hn,{open:n,onOpenChange:a,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{onClick:()=>h(),children:[s.jsx(Ya,{className:"w-4 h-4 mr-2"}),"Ajouter un terme"]})}),s.jsxs(qn,{className:"max-w-2xl",children:[s.jsx(Gn,{children:s.jsx(Kn,{children:t?"Modifier le terme":"Ajouter un terme"})}),s.jsxs("form",{onSubmit:p,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Terme"}),s.jsx(Ye,{value:i.term,onChange:b=>{o({...i,term:b.target.value,slug:x(b.target.value)})},placeholder:"Ex: Qualiopi",required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Slug URL"}),s.jsx(Ye,{value:i.slug,onChange:b=>o({...i,slug:b.target.value}),placeholder:"qualiopi",required:!0})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Compétence liée"}),s.jsx(Ye,{value:i.related_skill_tag,onChange:b=>o({...i,related_skill_tag:b.target.value}),placeholder:"Ex: Qualité, Management..."})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Définition"}),s.jsx(gn,{value:i.definition,onChange:b=>o({...i,definition:b.target.value}),placeholder:"Définition détaillée du terme...",rows:8,required:!0})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{type:"button",variant:"outline",onClick:h,children:"Annuler"}),s.jsx(ne,{type:"submit",disabled:f.isPending,children:f.isPending?"Enregistrement...":"Enregistrer"})]})]})]})]})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{children:"Termes du glossaire"})}),s.jsx(Ae,{children:d?s.jsx("div",{className:"space-y-4",children:[...Array(5)].map((b,y)=>s.jsx(Yr,{className:"h-16 w-full"},y))}):u&&u.length>0?s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{children:"Terme"}),s.jsx(pr,{children:"Slug"}),s.jsx(pr,{children:"Compétence liée"}),s.jsx(pr,{children:"Créé le"}),s.jsx(pr,{className:"text-right",children:"Actions"})]})}),s.jsx(vh,{children:u.map(b=>s.jsxs(Oa,{children:[s.jsx(ur,{className:"font-medium",children:b.term}),s.jsx(ur,{children:s.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded",children:b.slug})}),s.jsx(ur,{children:b.related_skill_tag?s.jsx(Le,{variant:"secondary",children:b.related_skill_tag}):s.jsx("span",{className:"text-muted-foreground",children:"-"})}),s.jsx(ur,{children:Ot(new Date(b.created_at),"dd MMM yyyy",{locale:yr})}),s.jsx(ur,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{variant:"ghost",size:"icon",asChild:!0,children:s.jsx("a",{href:`/glossaire/${b.slug}`,target:"_blank",rel:"noopener noreferrer",children:s.jsx(vs,{className:"w-4 h-4"})})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>g(b),children:s.jsx(rC,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>{confirm(`Supprimer "${b.term}" ?`)&&m.mutate(b.id)},children:s.jsx(bi,{className:"w-4 h-4 text-destructive"})})]})})]},b.id))})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(xl,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Aucun terme dans le glossaire"}),s.jsxs(ne,{onClick:v,disabled:l,children:[s.jsx(a2,{className:"w-4 h-4 mr-2"}),"Générer depuis les compétences formateur"]})]})})]})]})},Qgt=()=>{const[e,t]=w.useState(""),{data:r,isLoading:n}=ga({queryKey:["job-descriptions"],queryFn:async()=>{const{data:o,error:l}=await he.from("job_descriptions").select("*").order("title",{ascending:!0});if(l)throw l;return o}}),a=(r==null?void 0:r.filter(o=>o.title.toLowerCase().includes(e.toLowerCase())||o.required_skills.some(l=>l.toLowerCase().includes(e.toLowerCase()))))||[],i=[{name:"Métiers",url:"/metiers"}];return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Fiches Métiers - Comment devenir... | PedagoBridge",description:"Découvrez les fiches métiers et les formations nécessaires pour chaque profession. Data Analyst, Chef de Projet, Développeur et plus encore.",keywords:["fiches métiers","formation professionnelle","reconversion","compétences","carrière"],url:"https://pedagobridge.fr/metiers"}),s.jsx(Qa,{items:i}),s.jsx("section",{className:"relative bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 md:py-24",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx(Ap,{items:i}),s.jsxs("div",{className:"max-w-4xl mx-auto text-center mt-8",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-6",children:s.jsx(as,{className:"w-8 h-8 text-primary"})}),s.jsxs("h1",{className:"text-4xl md:text-5xl font-bold mb-6",children:["Fiches ",s.jsx("span",{className:"text-primary",children:"Métiers"})]}),s.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Découvrez les compétences requises et les formations pour chaque métier."}),s.jsxs("div",{className:"max-w-md mx-auto relative",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),s.jsx(Ye,{type:"text",placeholder:"Rechercher un métier...",value:e,onChange:o=>t(o.target.value),className:"pl-10"})]})]})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"max-w-6xl mx-auto",children:n?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((o,l)=>s.jsx(Yr,{className:"h-48"},l))}):a.length>0?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(o=>s.jsx(vt,{to:`/metier/${o.slug}`,children:s.jsx(ke,{className:"h-full hover:shadow-lg transition-all hover:border-primary/30 group",children:s.jsxs(Ae,{className:"p-6",children:[s.jsxs("div",{className:"flex items-start justify-between mb-4",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary/10 group-hover:bg-primary/20 transition-colors",children:s.jsx(as,{className:"w-6 h-6 text-primary"})}),s.jsx(Mn,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary transition-colors"})]}),s.jsx("h2",{className:"text-xl font-semibold mb-2 group-hover:text-primary transition-colors",children:o.title}),s.jsxs("p",{className:"text-muted-foreground text-sm line-clamp-2 mb-4",children:[o.description.substring(0,100),"..."]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[o.required_skills.slice(0,3).map((l,c)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:l},c)),o.required_skills.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",o.required_skills.length-3]})]})]})})},o.id))}):s.jsx(ke,{className:"bg-muted/50",children:s.jsxs(Ae,{className:"p-12 text-center",children:[s.jsx(as,{className:"w-16 h-16 text-muted-foreground mx-auto mb-4"}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:e?"Aucun métier trouvé":"Fiches métiers en préparation"}),s.jsx("p",{className:"text-muted-foreground",children:e?"Essayez avec d'autres mots-clés.":"Les fiches métiers seront bientôt disponibles."})]})})})})})]})},ext=()=>{var o,l;const{slug:e}=wo(),{data:t,isLoading:r}=ga({queryKey:["job-description",e],queryFn:async()=>{const{data:c,error:u}=await he.from("job_descriptions").select("*").eq("slug",e).single();if(u)throw u;return c},enabled:!!e}),{data:n}=ga({queryKey:["job-trainers",t==null?void 0:t.required_skills],queryFn:async()=>{var f;if(!((f=t==null?void 0:t.required_skills)!=null&&f.length))return{};const{data:c,error:u}=await he.from("trainer_profiles").select("id, name, bio, photo_url, specialties").eq("status","approved").eq("is_visible",!0);if(u)throw u;const d={};return t.required_skills.forEach(m=>{const h=m.toLowerCase();d[m]=(c||[]).filter(g=>g.specialties.some(p=>p.toLowerCase().includes(h)||h.includes(p.toLowerCase()))).slice(0,10)}),d},enabled:!!((o=t==null?void 0:t.required_skills)!=null&&o.length)}),{data:a}=ga({queryKey:["job-offers",t==null?void 0:t.required_skills],queryFn:async()=>{var f;if(!((f=t==null?void 0:t.required_skills)!=null&&f.length))return{};const{data:c,error:u}=await he.from("school_requests").select("id, school_name, description, subject_areas, city, duration_hours").eq("status","approved").eq("is_filled",!1);if(u)throw u;const d={};return t.required_skills.forEach(m=>{const h=m.toLowerCase();d[m]=(c||[]).filter(g=>g.subject_areas.some(p=>p.toLowerCase().includes(h)||h.includes(p.toLowerCase()))||g.description.toLowerCase().includes(h)).slice(0,10)}),d},enabled:!!((l=t==null?void 0:t.required_skills)!=null&&l.length)}),i=[{name:"Métiers",url:"/metiers"},{name:(t==null?void 0:t.title)||"Fiche métier",url:`/metier/${e}`}];return r?s.jsxs("div",{className:"container mx-auto px-4 py-16",children:[s.jsx(Yr,{className:"h-8 w-48 mb-4"}),s.jsx(Yr,{className:"h-12 w-3/4 mb-8"}),s.jsx(Yr,{className:"h-64 w-full"})]}):t?s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:`Comment devenir ${t.title} ? Les formations indispensables | PedagoBridge`,description:`Découvrez le métier de ${t.title}, les compétences requises et les formations disponibles. ${t.description.substring(0,100)}...`,keywords:[t.title,"formation","métier",...t.required_skills],url:`https://pedagobridge.fr/metier/${e}`}),s.jsx(Qa,{items:i}),s.jsx("section",{className:"relative bg-gradient-to-br from-primary/10 via-background to-secondary/10 py-16 md:py-20",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx(Ap,{items:i}),s.jsxs("div",{className:"max-w-4xl mx-auto mt-8",children:[s.jsxs(vt,{to:"/metiers",className:"inline-flex items-center text-sm text-muted-foreground hover:text-primary mb-4",children:[s.jsx(Yn,{className:"w-4 h-4 mr-1"}),"Tous les métiers"]}),s.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[s.jsx("div",{className:"p-3 rounded-xl bg-primary/10",children:s.jsx(as,{className:"w-8 h-8 text-primary"})}),s.jsxs("div",{children:[s.jsxs("h1",{className:"text-4xl md:text-5xl font-bold",children:["Comment devenir ",s.jsx("span",{className:"text-primary",children:t.title})," ?"]}),s.jsx("p",{className:"text-xl text-muted-foreground mt-2",children:"Les formations indispensables"})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-6",children:t.required_skills.map((c,u)=>s.jsx(Le,{variant:"secondary",className:"text-sm",children:c},u))})]})]})}),s.jsx("section",{className:"py-12",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsx(ke,{children:s.jsxs(Ae,{className:"p-8",children:[s.jsxs("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[s.jsx(xl,{className:"w-5 h-5 text-primary"}),"Le métier de ",t.title]}),s.jsx("div",{className:"prose prose-lg max-w-none text-muted-foreground",children:t.description.split(`
`).map((c,u)=>s.jsx("p",{className:"mb-4",children:c},u))})]})})})})}),t.required_skills.map((c,u)=>s.jsx("section",{className:`py-12 ${u%2===0?"bg-muted/30":""}`,children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-6xl mx-auto",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-2",children:[s.jsx(Ii,{className:"w-6 h-6 text-primary"}),"Se former à ",c]}),(n==null?void 0:n[c])&&n[c].length>0&&s.jsxs("div",{className:"mb-8",children:[s.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[s.jsx(sr,{className:"w-5 h-5"}),"Formateurs experts en ",c]}),s.jsxs(ru,{className:"w-full whitespace-nowrap",children:[s.jsxs("div",{className:"flex gap-4 pb-4",children:[n[c].map(d=>s.jsx(vt,{to:`/formateurs/${d.id}`,className:"flex-shrink-0 w-64",children:s.jsx(ke,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ps,{className:"h-12 w-12",children:[s.jsx(vi,{src:d.photo_url||void 0,alt:d.name}),s.jsx(gs,{children:d.name.split(" ").map(f=>f[0]).join("").slice(0,2)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h4",{className:"font-semibold truncate",children:d.name}),s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:d.bio||`Expert ${c}`})]})]})})})},d.id)),s.jsx(vt,{to:`/skills/${encodeURIComponent(c.toLowerCase().replace(/\s+/g,"-"))}`,className:"flex-shrink-0",children:s.jsx(ke,{className:"h-full flex items-center justify-center min-w-[150px] hover:border-primary transition-colors",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx(Mn,{className:"w-6 h-6 mx-auto mb-2 text-primary"}),s.jsx("span",{className:"text-sm font-medium",children:"Voir tous"})]})})})]}),s.jsx(t4,{orientation:"horizontal"})]})]}),(a==null?void 0:a[c])&&a[c].length>0&&s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[s.jsx(as,{className:"w-5 h-5"}),"Formations disponibles en ",c]}),s.jsxs(ru,{className:"w-full whitespace-nowrap",children:[s.jsxs("div",{className:"flex gap-4 pb-4",children:[a[c].map(d=>s.jsx(vt,{to:`/training-offers/${d.id}`,className:"flex-shrink-0 w-72",children:s.jsx(ke,{className:"h-full hover:shadow-lg transition-shadow",children:s.jsxs(Ae,{className:"p-4",children:[s.jsx("h4",{className:"font-semibold truncate mb-2",children:d.school_name}),s.jsxs("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:[d.description.substring(0,100),"..."]}),s.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[d.city&&s.jsxs(Le,{variant:"outline",className:"flex items-center gap-1",children:[s.jsx(Gs,{className:"w-3 h-3"}),d.city]}),d.duration_hours&&s.jsxs(Le,{variant:"outline",className:"flex items-center gap-1",children:[s.jsx(Gr,{className:"w-3 h-3"}),d.duration_hours,"h"]})]})]})})},d.id)),s.jsx(vt,{to:"/training-offers",className:"flex-shrink-0",children:s.jsx(ke,{className:"h-full flex items-center justify-center min-w-[150px] hover:border-primary transition-colors",children:s.jsxs(Ae,{className:"p-4 text-center",children:[s.jsx(Mn,{className:"w-6 h-6 mx-auto mb-2 text-primary"}),s.jsx("span",{className:"text-sm font-medium",children:"Voir toutes"})]})})})]}),s.jsx(t4,{orientation:"horizontal"})]})]}),(!(n!=null&&n[c])||n[c].length===0)&&(!(a!=null&&a[c])||a[c].length===0)&&s.jsx(ke,{className:"bg-muted/50",children:s.jsxs(Ae,{className:"p-6 text-center",children:[s.jsxs("p",{className:"text-muted-foreground",children:["Pas encore de formations disponibles pour ",c,"."]}),s.jsx(ne,{asChild:!0,variant:"outline",className:"mt-4",children:s.jsx(vt,{to:"/training-request",children:"Demander une formation"})})]})})]})})},u)),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"max-w-4xl mx-auto",children:s.jsx(ke,{className:"bg-primary/5 border-primary/20",children:s.jsxs(Ae,{className:"p-8 text-center",children:[s.jsxs("h3",{className:"text-2xl font-semibold mb-2",children:["Prêt à devenir ",t.title," ?"]}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Trouvez le formateur idéal ou publiez votre besoin de formation."}),s.jsxs("div",{className:"flex flex-wrap justify-center gap-4",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsx(vt,{to:"/trainers",children:"Trouver un formateur"})}),s.jsx(ne,{variant:"outline",size:"lg",asChild:!0,children:s.jsx(vt,{to:"/ecoles/inscription",children:"Publier une offre"})})]})]})})})})})]}):s.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[s.jsx(as,{className:"w-16 h-16 text-muted-foreground mx-auto mb-4"}),s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Fiche métier non trouvée"}),s.jsx(ne,{asChild:!0,children:s.jsxs(vt,{to:"/metiers",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"Retour aux métiers"]})})]})},txt=()=>{const e=e1(),[t,r]=w.useState(null),[n,a]=w.useState(!1),[i,o]=w.useState({title:"",slug:"",description:"",required_skills:[]}),[l,c]=w.useState(""),[u,d]=w.useState(!1),{data:f,isLoading:m}=ga({queryKey:["admin-job-descriptions"],queryFn:async()=>{const{data:j,error:S}=await he.from("job_descriptions").select("*").order("title",{ascending:!0});if(S)throw S;return j}}),h=Ic({mutationFn:async j=>{if(j.id){const{error:S}=await he.from("job_descriptions").update({title:j.title,slug:j.slug,description:j.description,required_skills:j.required_skills}).eq("id",j.id);if(S)throw S}else{const{error:S}=await he.from("job_descriptions").insert({title:j.title,slug:j.slug,description:j.description,required_skills:j.required_skills});if(S)throw S}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-job-descriptions"]}),ae.success(t?"Fiche mise à jour":"Fiche créée"),p()},onError:j=>{ae.error("Erreur: "+j.message)}}),g=Ic({mutationFn:async j=>{const{error:S}=await he.from("job_descriptions").delete().eq("id",j);if(S)throw S},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-job-descriptions"]}),ae.success("Fiche supprimée")},onError:j=>{ae.error("Erreur: "+j.message)}}),p=()=>{o({title:"",slug:"",description:"",required_skills:[]}),c(""),r(null),a(!1)},x=j=>{r(j),o({title:j.title,slug:j.slug,description:j.description,required_skills:j.required_skills}),a(!0)},v=j=>{j.preventDefault(),h.mutate({...i,id:t==null?void 0:t.id})},b=j=>j.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),y=()=>{l.trim()&&!i.required_skills.includes(l.trim())&&(o({...i,required_skills:[...i.required_skills,l.trim()]}),c(""))},N=j=>{o({...i,required_skills:i.required_skills.filter(S=>S!==j)})},_=async()=>{var j;d(!0);try{const{data:S,error:I}=await he.functions.invoke("generate-job-descriptions",{body:{generateAll:!0}});if(I)throw I;ae.success(`${((j=S.generated)==null?void 0:j.length)||0} fiches générées. ${S.remaining||0} restantes.`),e.invalidateQueries({queryKey:["admin-job-descriptions"]})}catch(S){ae.error("Erreur: "+S.message)}finally{d(!1)}};return s.jsxs("div",{className:"container mx-auto py-8 px-4",children:[s.jsx(sa,{items:[{label:"Tableau de bord",href:"/admin"},{label:"Fiches Métiers",href:"/admin/jobs"}]}),s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-8",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[s.jsx(as,{className:"w-8 h-8"}),"Gestion des Fiches Métiers"]}),s.jsxs("p",{className:"text-muted-foreground",children:[(f==null?void 0:f.length)||0," fiches métiers"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:_,disabled:u,children:[u?s.jsx(at,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(a2,{className:"w-4 h-4 mr-2"}),"Générer depuis formateurs"]}),s.jsxs(Hn,{open:n,onOpenChange:a,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{onClick:()=>p(),children:[s.jsx(Ya,{className:"w-4 h-4 mr-2"}),"Ajouter une fiche"]})}),s.jsxs(qn,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Gn,{children:s.jsx(Kn,{children:t?"Modifier la fiche":"Ajouter une fiche métier"})}),s.jsxs("form",{onSubmit:v,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Titre du métier"}),s.jsx(Ye,{value:i.title,onChange:j=>{o({...i,title:j.target.value,slug:b(j.target.value)})},placeholder:"Ex: Data Analyst",required:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Slug URL"}),s.jsx(Ye,{value:i.slug,onChange:j=>o({...i,slug:j.target.value}),placeholder:"data-analyst",required:!0})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Compétences requises"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{value:l,onChange:j=>c(j.target.value),placeholder:"Ajouter une compétence...",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),y())}}),s.jsx(ne,{type:"button",variant:"outline",onClick:y,children:s.jsx(Ya,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:i.required_skills.map((j,S)=>s.jsxs(Le,{variant:"secondary",className:"flex items-center gap-1",children:[j,s.jsx("button",{type:"button",onClick:()=>N(j),className:"hover:text-destructive",children:s.jsx(Ri,{className:"w-3 h-3"})})]},S))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"Description"}),s.jsx(gn,{value:i.description,onChange:j=>o({...i,description:j.target.value}),placeholder:"Description complète du métier...",rows:10,required:!0})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{type:"button",variant:"outline",onClick:p,children:"Annuler"}),s.jsx(ne,{type:"submit",disabled:h.isPending,children:h.isPending?"Enregistrement...":"Enregistrer"})]})]})]})]})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{children:"Fiches métiers"})}),s.jsx(Ae,{children:m?s.jsx("div",{className:"space-y-4",children:[...Array(5)].map((j,S)=>s.jsx(Yr,{className:"h-16 w-full"},S))}):f&&f.length>0?s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{children:"Métier"}),s.jsx(pr,{children:"Compétences"}),s.jsx(pr,{children:"Créé le"}),s.jsx(pr,{className:"text-right",children:"Actions"})]})}),s.jsx(vh,{children:f.map(j=>s.jsxs(Oa,{children:[s.jsx(ur,{children:s.jsxs("div",{children:[s.jsx("span",{className:"font-medium",children:j.title}),s.jsx("br",{}),s.jsx("code",{className:"text-xs text-muted-foreground",children:j.slug})]})}),s.jsx(ur,{children:s.jsxs("div",{className:"flex flex-wrap gap-1 max-w-xs",children:[j.required_skills.slice(0,3).map((S,I)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:S},I)),j.required_skills.length>3&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",j.required_skills.length-3]})]})}),s.jsx(ur,{children:Ot(new Date(j.created_at),"dd MMM yyyy",{locale:yr})}),s.jsx(ur,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{variant:"ghost",size:"icon",asChild:!0,children:s.jsx("a",{href:`/metier/${j.slug}`,target:"_blank",rel:"noopener noreferrer",children:s.jsx(vs,{className:"w-4 h-4"})})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>x(j),children:s.jsx(rC,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"icon",onClick:()=>{confirm(`Supprimer "${j.title}" ?`)&&g.mutate(j.id)},children:s.jsx(bi,{className:"w-4 h-4 text-destructive"})})]})})]},j.id))})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(as,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Aucune fiche métier"}),s.jsxs(ne,{onClick:_,disabled:u,children:[s.jsx(a2,{className:"w-4 h-4 mr-2"}),"Générer depuis les compétences formateur"]})]})})]})]})};var Zs=(e=>(e.PENDING="PENDING",e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED",e.ERROR="ERROR",e.DOWNLOADING="DOWNLOADING",e.UPLOADING="UPLOADING",e))(Zs||{});const Vfe=({onFilesSelected:e,disabled:t})=>{const r=w.useCallback(a=>{if(a.preventDefault(),t)return;const i=Array.from(a.dataTransfer.files).filter(o=>o.type==="application/pdf"||o.type.startsWith("image/"));i.length>0&&e(i)},[e,t]),n=a=>{if(a.target.files&&a.target.files.length>0){const i=Array.from(a.target.files).filter(o=>o.type==="application/pdf"||o.type.startsWith("image/"));e(i)}};return s.jsxs("div",{onDragOver:a=>a.preventDefault(),onDrop:r,className:`border-2 border-dashed rounded-xl p-10 text-center transition-colors cursor-pointer group
${t?"border-gray-200 bg-gray-50 cursor-not-allowed opacity-60":"border-blue-300 bg-blue-50/50 hover:bg-blue-50 hover:border-blue-500"}`,children:[s.jsx("input",{type:"file",multiple:!0,accept:"application/pdf,image/png,image/jpeg",onChange:n,className:"hidden",id:"file-upload",disabled:t}),s.jsxs("label",{htmlFor:"file-upload",className:`flex flex-col items-center justify-center ${t?"cursor-not-allowed":"cursor-pointer"}`,children:[s.jsx("div",{className:`p-4 rounded-full mb-4 ${t?"bg-gray-100":"bg-blue-100 text-blue-600 group-hover:scale-110 transition-transform"}`,children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-8 h-8",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0l3 3.75m-3-3.75l-3 3.75M12 9.75V4.5m0 0l-3 3.75m3-3.75l3 3.75M3.75 19.5h16.5"})})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-700",children:"Glissez-déposez vos CV ici"}),s.jsx("p",{className:"text-sm text-gray-500 mt-2 max-w-sm",children:"Supporte PDF, PNG, JPG. Sélectionnez un dossier ou plusieurs fichiers."}),s.jsx("span",{className:`mt-4 px-4 py-2 rounded-lg text-sm font-medium transition-colors
${t?"bg-gray-200 text-gray-400":"bg-blue-600 text-white hover:bg-blue-700"}`,children:"Parcourir les fichiers"})]})]})},CK=({files:e})=>e.length===0?null:s.jsxs("div",{className:"bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden",children:[s.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 bg-gray-50 flex justify-between items-center",children:[s.jsx("h3",{className:"font-bold text-gray-800",children:"Table de Correspondance"}),s.jsxs("span",{className:"text-xs font-bold px-3 py-1 rounded-full bg-blue-100 text-blue-700 uppercase tracking-wider",children:[e.filter(t=>t.status===Zs.COMPLETED).length," / ",e.length," traités"]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm text-left text-gray-600",children:[s.jsx("thead",{className:"text-xs text-gray-500 uppercase bg-gray-50 font-bold border-b",children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",className:"px-6 py-4",children:"Source"}),s.jsx("th",{scope:"col",className:"px-6 py-4",children:"Identifiant"}),s.jsx("th",{scope:"col",className:"px-6 py-4",children:"Statut"}),s.jsx("th",{scope:"col",className:"px-6 py-4",children:"Destination"})]})}),s.jsx("tbody",{children:e.map(t=>{var r,n;return s.jsxs("tr",{className:"bg-white border-b hover:bg-gray-50 transition-colors",children:[s.jsx("td",{className:"px-6 py-4 font-medium text-gray-900 truncate max-w-[240px]",title:t.fileName,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Jj,{source:t.driveId?"drive":"platform"}),s.jsx("span",{className:"truncate",children:t.fileName})]})}),s.jsx("td",{className:"px-6 py-4 font-mono text-blue-600 font-bold",children:((r=t.result)==null?void 0:r.candidateId)||"—"}),s.jsx("td",{className:"px-6 py-4",children:s.jsx(rxt,{status:t.status,error:t.error})}),s.jsx("td",{className:"px-6 py-4 text-xs font-medium text-gray-500",children:(n=t.result)!=null&&n.driveFileId?s.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-3 h-3",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),"Drive ID: ",t.result.driveFileId.substring(0,8),"..."]}):t.status===Zs.COMPLETED?"Local Download":"—"})]},t.id)})})]})})]}),rxt=({status:e,error:t})=>{switch(e){case Zs.PENDING:return s.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-gray-100 text-gray-600",children:"En attente"});case Zs.DOWNLOADING:return s.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-blue-50 text-blue-700 animate-pulse-subtle",children:"Drive ➔ App..."});case Zs.PROCESSING:return s.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-yellow-50 text-yellow-700 animate-pulse",children:"IA en cours..."});case Zs.UPLOADING:return s.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-indigo-50 text-indigo-700 animate-pulse-subtle",children:"App ➔ Drive..."});case Zs.COMPLETED:return s.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-green-100 text-green-800",children:"Terminé"});case Zs.ERROR:return s.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-bold bg-red-100 text-red-800",title:t,children:"Erreur"});default:return null}},Wfe=({file:e,onDownload:t,onSendEmail:r})=>{const[n,a]=w.useState(""),[i,o]=w.useState(!1),[l,c]=w.useState(!1);if(!e.result)return null;const{result:u}=e,d=u.matchScore>70?"text-green-600":u.matchScore>40?"text-yellow-600":"text-red-600",f=async()=>{if(!(!n||!r)){o(!0);try{await r(n,u),alert("Email envoyé avec succès !"),c(!1)}catch{alert("Erreur lors de l'envoi")}finally{o(!1)}}};return s.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-gray-200 shadow-sm hover:shadow-lg transition-all flex flex-col gap-4",children:[s.jsxs("div",{className:"flex justify-between items-start",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[s.jsx("h4",{className:"font-black text-gray-900 text-lg uppercase tracking-tight",children:u.candidateId}),s.jsxs("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold border ${d} border-current bg-opacity-10`,children:["MATCH ",u.matchScore,"%"]}),s.jsx(Jj,{source:e.driveId?"drive":"platform"})]}),s.jsxs("p",{className:"text-[10px] text-gray-400 truncate",children:["Source: ",e.fileName]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>t(u.anonymizedText,`${u.candidateId}_CV.pdf`),className:"p-2 text-gray-400 hover:text-blue-600 transition-colors bg-gray-50 rounded-lg",title:"Télécharger PDF",children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})})}),s.jsx("button",{onClick:()=>c(!l),className:`p-2 transition-colors rounded-lg ${l?"bg-indigo-600 text-white":"text-gray-400 hover:text-indigo-600 bg-gray-50"}`,title:"Envoyer par Gmail",children:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})})})]})]}),l&&s.jsxs("div",{className:"bg-indigo-50 p-3 rounded-xl border border-indigo-100 animate-slide-up",children:[s.jsx("input",{type:"email",placeholder:"Destinataire...",className:"w-full text-xs px-3 py-2 border border-indigo-200 rounded-lg mb-2 focus:ring-2 focus:ring-indigo-500 outline-none",value:n,onChange:m=>a(m.target.value)}),s.jsx("button",{disabled:i||!n,onClick:f,className:"w-full py-1.5 bg-indigo-600 text-white text-[10px] font-bold rounded-lg disabled:opacity-50",children:i?"Envoi...":"Envoyer Rapport"})]}),s.jsxs("div",{className:"space-y-3 flex-1",children:[s.jsxs("div",{className:"bg-gray-50 p-3 rounded-xl text-xs text-gray-600 border border-gray-100",children:[s.jsx("p",{className:"font-bold text-gray-900 mb-1",children:"Résumé & Matching"}),u.matchingExplanation]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px]",children:[s.jsxs("div",{className:"p-2 bg-green-50 rounded-lg border border-green-100",children:[s.jsx("p",{className:"font-black text-green-700 uppercase mb-1",children:"Points Forts"}),s.jsx("ul",{className:"list-disc list-inside text-green-600 opacity-80",children:u.strengths.slice(0,2).map((m,h)=>s.jsx("li",{className:"truncate",children:m},h))})]}),s.jsxs("div",{className:"p-2 bg-red-50 rounded-lg border border-red-100",children:[s.jsx("p",{className:"font-black text-red-700 uppercase mb-1",children:"Lacunes"}),s.jsx("ul",{className:"list-disc list-inside text-red-600 opacity-80",children:u.gaps.slice(0,2).map((m,h)=>s.jsx("li",{className:"truncate",children:m},h))})]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-auto pt-3 border-t border-gray-50",children:u.detectedPII.map((m,h)=>s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-100 text-gray-500 text-[8px] uppercase font-bold rounded",children:m},h))})]})},nxt=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result.split(",")[1]),n.onerror=r,n.readAsDataURL(e)});function sxt(){const[e,t]=w.useState([]),[r,n]=w.useState(""),[a,i]=w.useState(!0),[o,l]=w.useState(!1),[c,u]=w.useState("upload"),[d,f]=w.useState(null),[m,h]=w.useState(!1),[g,p]=w.useState(null),[x,v]=w.useState(null),[b,y]=w.useState(!1),[N,_]=w.useState({running:!1,result:null,error:null}),[j,S]=w.useState([]),[I,P]=w.useState(!1);w.useEffect(()=>{},[]);const F=async()=>{{alert("Configurez VITE_GOOGLE_CLIENT_ID et VITE_GOOGLE_API_KEY dans .env");return}},T=async()=>{_({running:!0,result:null,error:null});try{const{data:{session:M}}=await he.auth.getSession(),z=await fetch("https://pedagobridge.com/functions/v1/sync-drive-cv-folder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${M==null?void 0:M.access_token}`,apikey:void 0},body:JSON.stringify({})}),K=await z.json();if(!z.ok)throw new Error(K.error||"Échec de la synchronisation");_({running:!1,result:K,error:null})}catch(M){_({running:!1,result:null,error:M.message})}},k=w.useRef(null);w.useEffect(()=>{if(!(!m||!d))return k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{d.saveConfig({lessonsText:r,sourceFolder:g,destFolder:x}).catch(console.error)},3e3),()=>{k.current&&clearTimeout(k.current)}},[r,g,x,m,d]);const V=M=>{const z=M.map((K,E)=>({id:`${Date.now()}-${E}`,file:K,fileName:K.name,status:Zs.PENDING,uploadProgress:0}));t(K=>[...K,...z])},C=async()=>{if(!d||!g)return;const M=await d.listFiles(g.id);t(M.map(z=>({id:z.id,driveId:z.id,fileName:z.name,status:Zs.PENDING,uploadProgress:0})))},R=async()=>{if(e.length===0||!r.trim())return;l(!0),u("results");const{data:{session:M}}=await he.auth.getSession();for(const z of e)if(z.status!==Zs.COMPLETED)try{let K;if(z.driveId&&d){t(J=>J.map(se=>se.id===z.id?{...se,status:Zs.DOWNLOADING}:se));const Y=await d.downloadFile(z.driveId);K=new File([Y],z.fileName,{type:Y.type})}else if(z.file)K=z.file;else throw new Error("Fichier manquant");t(Y=>Y.map(J=>J.id===z.id?{...J,status:Zs.PROCESSING}:J));const E=await nxt(K),A=await fetch("https://pedagobridge.com/functions/v1/match-cv",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${M==null?void 0:M.access_token}`,apikey:void 0},body:JSON.stringify({fileBase64:E,mimeType:K.type,fileName:z.fileName,fileSize:K.size,lessonsText:r,shouldAnonymize:a})});if(!A.ok)throw new Error(await A.text());const{result:O,matchId:U}=await A.json();if(O.matchId=U,x&&d){t(ie=>ie.map(Ee=>Ee.id===z.id?{...Ee,status:Zs.UPLOADING}:Ee));const{jsPDF:Y}=await Vd(async()=>{const{jsPDF:ie}=await Promise.resolve().then(()=>N2);return{jsPDF:ie}},void 0),J=new Y;J.setFont("helvetica"),J.setFontSize(11);const se=J.splitTextToSize(O.anonymizedText,180);J.text(se,15,20);const ee=J.output("blob");O.driveFileId=await d.uploadFile(`${O.candidateId}_MATCH_${O.matchScore}.pdf`,ee,x.id)}t(Y=>Y.map(J=>J.id===z.id?{...J,status:Zs.COMPLETED,result:O}:J))}catch(K){t(E=>E.map(A=>A.id===z.id?{...A,status:Zs.ERROR,error:K.message}:A))}l(!1)},H=async()=>{P(!0);const{data:M}=await he.from("cv_matches").select("id, created_at, candidate_id, file_name, match_score, result, is_admin").order("created_at",{ascending:!1}).limit(50);S(M||[]),P(!1)};w.useEffect(()=>{c==="history"&&H()},[c]);const q=e.filter(M=>M.status===Zs.COMPLETED).length,L=e.length>0&&r.trim()!=="";return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Matcher de Profils — Admin",description:"Outil de matching CV/profil pour administrateurs PedagoBridge.",url:"/admin/matcher"}),s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsxs("div",{className:"bg-white border-b border-slate-200 px-8 py-5 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-black text-slate-900 tracking-tight",children:"Matcher de Profils"}),s.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:"Analyse IA de CVs avec matching pédagogique"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[m&&s.jsxs("div",{className:"flex items-center gap-2 text-xs font-bold text-green-600 bg-green-50 px-3 py-1.5 rounded-lg border border-green-100",children:[s.jsx("div",{className:`w-2 h-2 rounded-full ${b?"bg-amber-400 animate-pulse":"bg-green-500"}`}),b?"Sync...":"Drive connecté"]}),s.jsx("button",{onClick:()=>u(c==="history"?"upload":"history"),className:"px-4 py-2 text-sm font-bold text-slate-600 bg-slate-100 hover:bg-slate-200 rounded-xl transition-colors",children:c==="history"?"Nouvel Analyse":"Historique"}),s.jsx("button",{onClick:F,className:`px-5 py-2 text-sm font-bold rounded-xl transition-colors ${m?"bg-white border border-slate-200 text-slate-600":"bg-indigo-600 text-white hover:bg-indigo-700"}`,children:m?"Google Drive OK":"Connecter Drive"})]})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-8 py-8",children:[c==="history"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("h2",{className:"text-xl font-black text-slate-800",children:"Historique des analyses"}),I?s.jsx("div",{className:"text-center py-20 text-slate-400",children:"Chargement..."}):j.length===0?s.jsx("div",{className:"text-center py-20 text-slate-400",children:"Aucune analyse enregistrée."}):s.jsx("div",{className:"bg-white rounded-2xl border border-slate-200 overflow-hidden",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-slate-50 border-b text-xs font-bold text-slate-500 uppercase",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-6 py-4 text-left",children:"Date"}),s.jsx("th",{className:"px-6 py-4 text-left",children:"Fichier"}),s.jsx("th",{className:"px-6 py-4 text-left",children:"ID Candidat"}),s.jsx("th",{className:"px-6 py-4 text-center",children:"Score"}),s.jsx("th",{className:"px-6 py-4 text-left",children:"Résumé"})]})}),s.jsx("tbody",{children:j.map(M=>{var z;return s.jsxs("tr",{className:"border-b hover:bg-slate-50 transition-colors",children:[s.jsx("td",{className:"px-6 py-4 text-slate-500 whitespace-nowrap",children:new Date(M.created_at).toLocaleDateString("fr-FR")}),s.jsx("td",{className:"px-6 py-4 font-medium text-slate-700 max-w-[200px] truncate",children:M.file_name}),s.jsx("td",{className:"px-6 py-4 font-mono text-indigo-600 font-bold",children:M.candidate_id}),s.jsx("td",{className:"px-6 py-4 text-center",children:s.jsxs("span",{className:`font-black text-lg ${M.match_score>70?"text-green-600":M.match_score>40?"text-yellow-600":"text-red-600"}`,children:[M.match_score,"%"]})}),s.jsx("td",{className:"px-6 py-4 text-slate-500 text-xs max-w-[300px] truncate",children:(z=M.result)==null?void 0:z.summary})]},M.id)})})]})})]}),c==="upload"&&s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-8",children:[s.jsxs("div",{className:"lg:col-span-4 space-y-6",children:[s.jsxs("div",{className:"bg-white rounded-2xl p-6 border border-slate-200",children:[s.jsx("h3",{className:"text-xs font-black uppercase text-indigo-600 tracking-widest mb-4",children:"Besoins Pédagogiques"}),s.jsx("textarea",{value:r,onChange:M=>n(M.target.value),placeholder:"Décrivez les compétences recherchées, objectifs pédagogiques, profil idéal...",className:"w-full h-44 px-4 py-3 text-sm bg-slate-50 border border-slate-200 rounded-xl resize-none focus:ring-2 focus:ring-indigo-500/20 outline-none"}),s.jsxs("div",{className:"mt-4",children:[s.jsx("label",{className:"text-xs font-black text-slate-400 uppercase tracking-widest mb-2 block",children:"Confidentialité"}),s.jsx("div",{className:"flex gap-3",children:[{val:!0,label:"Anonymisé"},{val:!1,label:"Identité visible"}].map(M=>s.jsx("button",{onClick:()=>i(M.val),className:`flex-1 py-2.5 text-xs font-bold rounded-xl border transition-colors ${a===M.val?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200"}`,children:M.label},String(M.val)))})]})]}),s.jsxs("div",{className:"bg-white rounded-2xl p-6 border border-slate-200",children:[s.jsx("h3",{className:"text-xs font-black uppercase text-slate-400 tracking-widest mb-4",children:"Automatisation Drive"}),s.jsxs("div",{className:"mb-4 pb-4 border-b border-slate-100",children:[s.jsx("button",{onClick:T,disabled:N.running,className:"w-full py-3 bg-slate-900 text-white rounded-xl font-black text-xs uppercase tracking-widest hover:bg-slate-700 disabled:opacity-40 transition-colors",children:N.running?"Synchronisation…":"Synchroniser le dossier Drive"}),s.jsx("p",{className:"text-[10px] text-slate-400 mt-2",children:"Scanne le dossier partagé (compte de service) et indexe les CV — sans connexion navigateur."}),N.result&&s.jsxs("p",{className:"text-[11px] font-bold text-emerald-600 mt-2",children:[N.result.total_files," CV trouvés · ",N.result.new_files," nouveaux · ",N.result.extracted," analysés"]}),N.error&&s.jsx("p",{className:"text-[11px] font-bold text-rose-600 mt-2",children:N.error})]}),m?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("button",{onClick:async()=>{const M=await(d==null?void 0:d.selectFolder("Dossier Source CV"));M&&p(M)},className:"w-full text-left p-4 bg-slate-50 border border-slate-200 rounded-xl hover:border-indigo-400 transition-colors",children:[s.jsx("span",{className:"text-[9px] font-black text-slate-400 uppercase",children:"Source CV"}),s.jsx("p",{className:"text-sm font-bold mt-0.5 truncate",children:(g==null?void 0:g.name)||"Sélectionner..."})]}),s.jsxs("button",{onClick:async()=>{const M=await(d==null?void 0:d.selectFolder("Dossier Rapports PDF"));M&&v(M)},className:"w-full text-left p-4 bg-slate-50 border border-slate-200 rounded-xl hover:border-indigo-400 transition-colors",children:[s.jsx("span",{className:"text-[9px] font-black text-slate-400 uppercase",children:"Rapports PDF"}),s.jsx("p",{className:"text-sm font-bold mt-0.5 truncate",children:(x==null?void 0:x.name)||"Sélectionner..."})]})]}):s.jsxs("div",{className:"text-center py-6 text-slate-400",children:[s.jsx("p",{className:"text-xs mb-3",children:"Connectez Google Drive pour importer par dossier et sauvegarder les rapports."}),s.jsx("button",{onClick:F,className:"text-xs font-black text-indigo-600 underline",children:"Connecter Drive"})]})]})]}),s.jsx("div",{className:"lg:col-span-8",children:s.jsxs("div",{className:"bg-white rounded-2xl p-8 border border-slate-200 min-h-[500px] flex flex-col",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-black text-slate-900",children:"Fichiers à analyser"}),s.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"Glissez vos CVs ou importez depuis Drive."})]}),m&&g&&s.jsx("button",{onClick:C,className:"px-5 py-2 bg-indigo-50 text-indigo-700 text-xs font-black uppercase tracking-widest rounded-xl border border-indigo-100 hover:bg-indigo-700 hover:text-white transition-colors",children:"Importer depuis Drive"})]}),s.jsx(Vfe,{onFilesSelected:V,disabled:o}),e.length>0&&s.jsx("div",{className:"mt-4",children:s.jsx(CK,{files:e})}),s.jsx("div",{className:"mt-auto pt-6 border-t border-slate-100",children:s.jsx("button",{onClick:R,disabled:!L||o,className:"w-full py-5 bg-indigo-600 text-white rounded-2xl font-black text-base uppercase tracking-widest shadow-lg shadow-indigo-200 hover:bg-indigo-700 disabled:opacity-30 transition-all active:scale-[0.98]",children:o?"Analyse en cours...":`Lancer le matching (${e.length} fichier${e.length>1?"s":""})`})})]})})]}),c==="results"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-8 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-3xl font-black text-slate-900",children:"Résultats"}),s.jsxs("p",{className:"text-slate-500 mt-1",children:[q," / ",e.length," profils traités"]})]}),s.jsx("button",{onClick:()=>{u("upload"),t([])},className:"px-6 py-3 bg-slate-900 text-white rounded-xl font-black text-xs uppercase tracking-widest hover:bg-slate-700 transition-colors",children:"Nouvelle analyse"})]}),s.jsx(CK,{files:e}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.filter(M=>M.status===Zs.COMPLETED).map(M=>s.jsx(Wfe,{file:M,onDownload:async(z,K)=>{const{jsPDF:E}=await Vd(async()=>{const{jsPDF:O}=await Promise.resolve().then(()=>N2);return{jsPDF:O}},void 0),A=new E;A.text(A.splitTextToSize(z,180),15,20),A.save(K)}},M.id))})]})]})]})]})}const EK=5,axt=1,ixt=e=>new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result.split(",")[1]),n.onerror=r,n.readAsDataURL(e)});function oxt(){const e=[navigator.userAgent,navigator.language,screen.width,screen.height,Intl.DateTimeFormat().resolvedOptions().timeZone].join("|");let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t).toString(36)}function lxt(){Xt();const[e,t]=w.useState(null),[r,n]=w.useState(""),[a,i]=w.useState(!0),[o,l]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(null),[m,h]=w.useState(null),[g,p]=w.useState("free"),[x,v]=w.useState(0),[b]=w.useState(()=>oxt());w.useEffect(()=>{he.auth.getUser().then(({data:{user:S}})=>{h(S),S&&y(S.id)})},[]);const y=async S=>{const{count:I}=await he.from("cv_matches").select("id",{count:"exact",head:!0}).eq("user_id",S),P=I??0;if(v(P),P>=EK){const{data:F}=await he.from("matcher_credits").select("credits_total, credits_used").eq("user_id",S).single();((F==null?void 0:F.credits_total)??0)-((F==null?void 0:F.credits_used)??0)<=0?p("needs_payment"):p("free")}else p("free")},N=S=>{S.length!==0&&(t({id:"1",file:S[0],fileName:S[0].name,status:Zs.PENDING,uploadProgress:0}),u(null),f(null))},_=async()=>{if(!(!(e!=null&&e.file)||!r.trim())){l(!0),f(null);try{const S=await ixt(e.file),{data:{session:I}}=await he.auth.getSession(),P={"Content-Type":"application/json",apikey:void 0,"x-ip-fingerprint":b};I!=null&&I.access_token&&(P.Authorization=`Bearer ${I.access_token}`);const F=await fetch("https://pedagobridge.com/functions/v1/match-cv",{method:"POST",headers:P,body:JSON.stringify({fileBase64:S,mimeType:e.file.type,fileName:e.fileName,fileSize:e.file.size,lessonsText:r,shouldAnonymize:a})}),T=await F.json();if(!F.ok){if(T.error==="LIMIT_ANONYMOUS"){p("needs_account");return}if(T.error==="LIMIT_PAID"){p("needs_payment");return}throw new Error(T.error||"Erreur serveur")}u(T.result),t(k=>k&&{...k,status:Zs.COMPLETED,result:T.result}),m&&y(m.id),m||v(1)}catch(S){f(S.message),t(I=>I&&{...I,status:Zs.ERROR,error:S.message})}finally{l(!1)}}},j=m?Math.max(0,EK-x):Math.max(0,axt-x);return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Outil de Matching CV/Profil Gratuit — PedagoBridge",description:"Analysez un CV et matchez-le avec vos besoins pédagogiques grâce à l'IA. Anonymisation automatique, score de pertinence, points forts et lacunes.",url:"/outils/matching",keywords:["matching cv","analyse profil formateur","outil recrutement formation","IA matching pédagogique"]}),s.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-indigo-50 to-white",children:[s.jsxs("div",{className:"max-w-4xl mx-auto px-6 pt-16 pb-10 text-center",children:[s.jsx("span",{className:"inline-block px-4 py-1.5 bg-indigo-100 text-indigo-700 text-xs font-black uppercase tracking-widest rounded-full mb-4",children:"Outil IA Gratuit"}),s.jsxs("h1",{className:"text-4xl md:text-5xl font-black text-slate-900 tracking-tight leading-tight",children:["Matchez un CV avec vos",s.jsx("br",{}),s.jsx("span",{className:"text-indigo-600",children:"besoins pédagogiques"})]}),s.jsx("p",{className:"mt-5 text-lg text-slate-500 max-w-2xl mx-auto",children:"Déposez un CV, décrivez votre besoin, et obtenez en quelques secondes un score de pertinence, les points forts et les lacunes du profil."}),!m&&x===0&&s.jsxs("div",{className:"mt-6 inline-flex items-center gap-2 px-5 py-2.5 bg-white rounded-full border border-slate-200 shadow-sm text-sm",children:[s.jsx("span",{className:"text-green-500 font-black",children:"1 analyse gratuite"}),s.jsx("span",{className:"text-slate-400",children:"— puis création de compte requise"})]}),m&&g==="free"&&s.jsx("div",{className:"mt-6 inline-flex items-center gap-2 px-5 py-2.5 bg-white rounded-full border border-slate-200 shadow-sm text-sm",children:s.jsxs("span",{className:"text-indigo-600 font-black",children:[j," analyse",j>1?"s":""," gratuite",j>1?"s":""," restante",j>1?"s":""]})})]}),g==="needs_account"&&s.jsx("div",{className:"max-w-xl mx-auto px-6 pb-20",children:s.jsxs("div",{className:"bg-white rounded-3xl border border-indigo-200 shadow-xl p-10 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-indigo-100 rounded-2xl flex items-center justify-center mx-auto mb-6",children:s.jsx("svg",{className:"w-8 h-8 text-indigo-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),s.jsx("h2",{className:"text-2xl font-black text-slate-900 mb-3",children:"Créez un compte gratuit"}),s.jsx("p",{className:"text-slate-500 mb-2",children:"Vous avez utilisé votre analyse gratuite."}),s.jsxs("p",{className:"text-slate-500 mb-8",children:["Un compte vous donne accès à ",s.jsx("strong",{children:"5 analyses gratuites"})," supplémentaires."]}),s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx(vt,{to:"/auth?mode=register",className:"py-4 bg-indigo-600 text-white rounded-2xl font-black text-sm uppercase tracking-widest hover:bg-indigo-700 transition-colors",children:"Créer un compte gratuit"}),s.jsx(vt,{to:"/auth",className:"py-3 text-slate-500 text-sm font-bold hover:text-slate-700 transition-colors",children:"J'ai déjà un compte"})]})]})}),g==="needs_payment"&&s.jsx("div",{className:"max-w-xl mx-auto px-6 pb-20",children:s.jsxs("div",{className:"bg-white rounded-3xl border border-amber-200 shadow-xl p-10 text-center",children:[s.jsx("div",{className:"w-16 h-16 bg-amber-100 rounded-2xl flex items-center justify-center mx-auto mb-6",children:s.jsx("svg",{className:"w-8 h-8 text-amber-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsx("h2",{className:"text-2xl font-black text-slate-900 mb-3",children:"5 analyses utilisées"}),s.jsx("p",{className:"text-slate-500 mb-8",children:"Continuez avec un pack de crédits pour débloquer des analyses illimitées."}),s.jsxs("div",{className:"bg-indigo-50 rounded-2xl p-6 mb-8",children:[s.jsx("p",{className:"text-3xl font-black text-indigo-700",children:"€9.90"}),s.jsx("p",{className:"text-sm text-indigo-500 mt-1",children:"20 analyses supplémentaires"})]}),s.jsx("button",{onClick:()=>alert("Stripe checkout — à configurer"),className:"w-full py-4 bg-indigo-600 text-white rounded-2xl font-black text-sm uppercase tracking-widest hover:bg-indigo-700 transition-colors",children:"Acheter des crédits"})]})}),(g==="free"||g==="admin")&&s.jsxs("div",{className:"max-w-4xl mx-auto px-6 pb-20",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[s.jsx("h3",{className:"text-xs font-black text-slate-400 uppercase tracking-widest mb-4",children:"CV à analyser"}),e?s.jsxs("div",{className:"flex items-center gap-3 p-4 bg-indigo-50 rounded-xl border border-indigo-100",children:[s.jsx("svg",{className:"w-8 h-8 text-indigo-600 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-bold text-slate-800 text-sm truncate",children:e.fileName}),s.jsx("p",{className:"text-xs text-slate-400",children:e.file?`${(e.file.size/1024).toFixed(0)} Ko`:""})]}),s.jsx("button",{onClick:()=>{t(null),u(null)},className:"text-slate-400 hover:text-red-500 transition-colors",children:s.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}):s.jsx(Vfe,{onFilesSelected:N,disabled:o})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[s.jsx("h3",{className:"text-xs font-black text-slate-400 uppercase tracking-widest mb-4",children:"Besoins / Objectifs"}),s.jsx("textarea",{value:r,onChange:S=>n(S.target.value),placeholder:"Ex: Nous cherchons un formateur expert en React et TypeScript pour une formation de 3 jours destinée à des développeurs seniors. Priorité aux compétences pédagogiques et aux certifications AWS...",className:"w-full h-40 text-sm bg-slate-50 border border-slate-200 rounded-xl px-4 py-3 resize-none focus:ring-2 focus:ring-indigo-500/20 outline-none"}),s.jsx("div",{className:"mt-3 flex gap-2",children:[{val:!0,label:"Anonymiser le CV"},{val:!1,label:"Garder l'identité"}].map(S=>s.jsx("button",{onClick:()=>i(S.val),className:`flex-1 py-2 text-xs font-bold rounded-xl border transition-colors ${a===S.val?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-500 border-slate-200"}`,children:S.label},String(S.val)))})]})]}),d&&s.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-xl text-sm text-red-700",children:d}),s.jsx("button",{onClick:_,disabled:!e||!r.trim()||o,className:"w-full py-5 bg-indigo-600 text-white rounded-2xl font-black text-lg uppercase tracking-widest shadow-xl shadow-indigo-200 hover:bg-indigo-700 disabled:opacity-30 transition-all active:scale-[0.98]",children:o?s.jsxs("span",{className:"flex items-center justify-center gap-3",children:[s.jsxs("svg",{className:"animate-spin w-5 h-5",fill:"none",viewBox:"0 0 24 24",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Analyse IA en cours..."]}):"Lancer le matching"}),c&&e&&s.jsxs("div",{className:"mt-8",children:[s.jsx(Wfe,{file:{...e,result:c,status:Zs.COMPLETED},onDownload:async(S,I)=>{const{jsPDF:P}=await Vd(async()=>{const{jsPDF:T}=await Promise.resolve().then(()=>N2);return{jsPDF:T}},void 0),F=new P;F.text(F.splitTextToSize(S,180),15,20),F.save(I)}}),!m&&s.jsxs("div",{className:"mt-6 bg-indigo-50 border border-indigo-200 rounded-2xl p-6 text-center",children:[s.jsx("p",{className:"font-bold text-indigo-900 mb-1",children:"Créez un compte pour 5 analyses gratuites supplémentaires"}),s.jsx("p",{className:"text-sm text-indigo-500 mb-4",children:"Retrouvez aussi l'historique de vos analyses et accédez aux outils avancés."}),s.jsx(vt,{to:"/auth?mode=register",className:"inline-block px-8 py-3 bg-indigo-600 text-white rounded-xl font-black text-sm uppercase tracking-widest hover:bg-indigo-700 transition-colors",children:"Créer un compte gratuit"})]})]}),!c&&s.jsx("div",{className:"mt-12 grid grid-cols-1 md:grid-cols-3 gap-6",children:[{icon:"🎯",title:"Score de matching",desc:"Score de 0 à 100 pour évaluer la pertinence du profil avec vos besoins."},{icon:"🔒",title:"Anonymisation IA",desc:"Suppression automatique des informations personnelles pour un processus équitable."},{icon:"📊",title:"Analyse détaillée",desc:"Points forts, lacunes et recommandations pour chaque profil analysé."}].map(S=>s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6 text-center",children:[s.jsx("div",{className:"text-3xl mb-3",children:S.icon}),s.jsx("h3",{className:"font-black text-slate-800 mb-2",children:S.title}),s.jsx("p",{className:"text-sm text-slate-500",children:S.desc})]},S.title))})]})]})]})}const Ax="https://pedagobridge.com",NP=void 0,cxt=["Management","Leadership","Digital","Vente","RH","Comptabilité","Anglais","Bureautique","Sécurité","Qualité","Droit","Finance","Communication","Marketing","Développement personnel","Informatique"],SP={new:{label:"Nouveau",color:"bg-slate-100 text-slate-700"},contacted:{label:"Contacté",color:"bg-blue-100 text-blue-700"},replied:{label:"Répondu",color:"bg-indigo-100 text-indigo-700"},interested:{label:"Intéressé",color:"bg-green-100 text-green-700"},not_interested:{label:"Pas intéressé",color:"bg-red-100 text-red-700"},bounced:{label:"Bounce",color:"bg-amber-100 text-amber-700"}};function uxt(){var Ge;const[e,t]=w.useState("search"),[r,n]=w.useState(null),[a,i]=w.useState("school"),[o,l]=w.useState("France"),[c,u]=w.useState([]),[d,f]=w.useState(""),[m,h]=w.useState(!1),[g,p]=w.useState(null),[x,v]=w.useState(null),[b,y]=w.useState(!1),[N,_]=w.useState(null),j=w.useRef(null),[S,I]=w.useState([]),[P,F]=w.useState(!1),[T,k]=w.useState(new Set),[V,C]=w.useState("all"),[R,H]=w.useState("all"),[q,L]=w.useState("email"),[M,z]=w.useState(!1),[K,E]=w.useState([]),[A,O]=w.useState(""),[U,Y]=w.useState(!0),[J,se]=w.useState(!1),[ee,ie]=w.useState(null);w.useEffect(()=>{he.auth.getSession().then(({data:{session:we}})=>n(we)),te(),oe()},[]),w.useEffect(()=>{e==="prospects"&&re(),e==="templates"&&oe()},[e,V,R]);const Ee=()=>({"Content-Type":"application/json",Authorization:`Bearer ${r==null?void 0:r.access_token}`,apikey:NP}),te=async()=>{const{data:{session:we}}=await he.auth.getSession();if(we)try{const qe=await(await fetch(`${Ax}/functions/v1/user-linkedin-oauth?action=status`,{headers:{Authorization:`Bearer ${we.access_token}`,apikey:NP}})).json();se(qe.connected),ie(qe.profile)}catch{}},Ue=async()=>{const{data:{session:we}}=await he.auth.getSession();if(we)try{const qe=await(await fetch(`${Ax}/functions/v1/user-linkedin-oauth?action=authorize`,{headers:{Authorization:`Bearer ${we.access_token}`,apikey:NP}})).json();if(qe.authUrl){const Re=window.open(qe.authUrl,"_blank","width=600,height=700"),Me=He=>{var st,Zt;((st=He.data)==null?void 0:st.type)==="linkedin-connected"&&((Zt=He.data)!=null&&Zt.success)&&(te(),ae.success("LinkedIn connecté !"),window.removeEventListener("message",Me))};window.addEventListener("message",Me)}}catch{ae.error("Connexion LinkedIn échouée")}},W=async()=>{h(!0),p(null);try{const we=await fetch(`${Ax}/functions/v1/scan-linkedin-prospects`,{method:"POST",headers:Ee(),body:JSON.stringify({mode:"web_search",prospect_type:a,location:o,specialties:c,query:d||void 0,limit:20})}),_e=await we.json();if(!we.ok)throw new Error(_e.error);p(_e.prospects||[]),ae.success(`${_e.found} prospects trouvés et enregistrés`)}catch(we){ae.error(we.message)}finally{h(!1)}},Z=async()=>{h(!0);try{const we=await fetch(`${Ax}/functions/v1/scan-linkedin-prospects`,{method:"POST",headers:Ee(),body:JSON.stringify({mode:"api"})}),_e=await we.json();if(!we.ok)throw new Error(_e.error);ae.success(`${_e.found} profils connectés importés via API LinkedIn`),p(_e.prospects||[])}catch(we){ae.error(we.message)}finally{h(!1)}},le=async()=>{if(x){y(!0),_(null);try{const we=await x.text(),_e=await fetch(`${Ax}/functions/v1/import-linkedin-csv`,{method:"POST",headers:Ee(),body:JSON.stringify({csv:we})}),qe=await _e.json();if(!_e.ok)throw new Error(qe.error);_(qe),ae.success(`${qe.imported} prospects importés`)}catch(we){ae.error(we.message)}finally{y(!1)}}},re=async()=>{F(!0);let we=he.from("linkedin_prospects").select("*").order("created_at",{ascending:!1}).limit(200);V!=="all"&&(we=we.eq("prospect_type",V)),R!=="all"&&(we=we.eq("status",R));const{data:_e}=await we;I(_e||[]),F(!1)},oe=async()=>{const{data:we}=await he.from("linkedin_outreach_templates").select("*").order("name");E(we||[])},fe=we=>{k(_e=>{const qe=new Set(_e);return qe.has(we)?qe.delete(we):qe.add(we),qe})},Fe=()=>{T.size===S.length?k(new Set):k(new Set(S.map(we=>we.id)))},ge=async()=>{var we;if(T.size===0){ae.error("Sélectionnez au moins un prospect");return}z(!0);try{const{data:{session:_e}}=await he.auth.getSession(),qe=await fetch(`${Ax}/functions/v1/send-linkedin-outreach`,{method:"POST",headers:Ee(),body:JSON.stringify({prospect_ids:Array.from(T),template_id:A||void 0,channel:q,linkedin_user_id:J?(we=_e==null?void 0:_e.user)==null?void 0:we.id:void 0,dry_run:U})}),Re=await qe.json();if(!qe.ok)throw new Error(Re.error);U?ae.info(`Prévisualisation : ${Re.total} messages générés`):(ae.success(`${Re.sent}/${Re.total} messages envoyés`),re(),k(new Set))}catch(_e){ae.error(_e.message)}finally{z(!1)}},pe=async(we,_e)=>{await he.from("linkedin_prospects").update({status:_e}).eq("id",we),I(qe=>qe.map(Re=>Re.id===we?{...Re,status:_e}:Re))},Ie={total:S.length,schools:S.filter(we=>we.prospect_type==="school").length,trainers:S.filter(we=>we.prospect_type==="trainer").length,contacted:S.filter(we=>we.status==="contacted"||we.status==="replied").length,interested:S.filter(we=>we.status==="interested").length,withEmail:S.filter(we=>we.email).length};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"LinkedIn Scanner — Admin PedagoBridge",description:"Outil de prospection LinkedIn automatisé",url:"/admin/linkedin-scanner"}),s.jsxs("div",{className:"min-h-screen bg-slate-50",children:[s.jsxs("div",{className:"bg-white border-b border-slate-200 px-8 py-5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-2xl font-black text-slate-900 tracking-tight flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 bg-[#0077B5] rounded-xl flex items-center justify-center",children:s.jsx("svg",{className:"w-5 h-5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})}),"LinkedIn Scanner"]}),s.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:"Prospection automatique écoles & formateurs"})]}),s.jsx("button",{onClick:J?void 0:Ue,className:`flex items-center gap-2 px-4 py-2 rounded-xl text-sm font-bold transition-colors ${J?"bg-green-50 text-green-700 border border-green-200":"bg-[#0077B5] text-white hover:bg-[#005885]"}`,children:J?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"w-2 h-2 bg-green-500 rounded-full"}),(ee==null?void 0:ee.name)||"LinkedIn connecté"]}):s.jsx(s.Fragment,{children:"Connecter mon LinkedIn"})})]}),s.jsx("div",{className:"flex gap-1 mt-5",children:[{id:"search",label:"Recherche IA"},{id:"csv",label:"Import CSV"},{id:"prospects",label:`Prospects (${Ie.total})`},{id:"templates",label:"Templates"}].map(we=>s.jsx("button",{onClick:()=>t(we.id),className:`px-5 py-2 text-sm font-bold rounded-xl transition-colors ${e===we.id?"bg-indigo-600 text-white":"text-slate-500 hover:text-slate-900 hover:bg-slate-100"}`,children:we.label},we.id))})]}),s.jsxs("div",{className:"max-w-7xl mx-auto px-8 py-8",children:[e==="search"&&s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"grid grid-cols-5 gap-4",children:[{label:"Total prospects",value:Ie.total},{label:"Écoles",value:Ie.schools},{label:"Formateurs",value:Ie.trainers},{label:"Contactés",value:Ie.contacted},{label:"Intéressés",value:Ie.interested}].map(we=>s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-5 text-center",children:[s.jsx("p",{className:"text-3xl font-black text-slate-900",children:we.value}),s.jsx("p",{className:"text-xs text-slate-400 mt-1 uppercase tracking-wider",children:we.label})]},we.label))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[s.jsx("span",{className:"px-2.5 py-1 bg-indigo-100 text-indigo-700 text-[10px] font-black uppercase tracking-widest rounded-full",children:"Option C"}),s.jsx("h3",{className:"font-black text-slate-800",children:"Recherche Web IA"})]}),s.jsxs("p",{className:"text-sm text-slate-500 mb-5",children:["Gemini recherche sur Google des profils LinkedIn de "," ",a==="school"?"centres de formation":"formateurs freelances"," en France."]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex gap-2",children:["school","trainer"].map(we=>s.jsx("button",{onClick:()=>i(we),className:`flex-1 py-2.5 text-xs font-bold rounded-xl border transition-colors ${a===we?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200"}`,children:we==="school"?"Écoles / OF":"Formateurs"},we))}),s.jsx("input",{value:o,onChange:we=>l(we.target.value),placeholder:"Région / ville (ex: Paris, Lyon, France)",className:"w-full px-4 py-3 text-sm bg-slate-50 border border-slate-200 rounded-xl outline-none focus:ring-2 focus:ring-indigo-500/20"}),a==="trainer"&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase mb-2",children:"Spécialités ciblées"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:cxt.slice(0,10).map(we=>s.jsx("button",{onClick:()=>u(_e=>_e.includes(we)?_e.filter(qe=>qe!==we):[..._e,we]),className:`px-3 py-1 text-xs font-bold rounded-full border transition-colors ${c.includes(we)?"bg-indigo-600 text-white border-indigo-600":"bg-white text-slate-600 border-slate-200"}`,children:we},we))})]}),s.jsx("input",{value:d,onChange:we=>f(we.target.value),placeholder:"Requête personnalisée (optionnel)",className:"w-full px-4 py-3 text-sm bg-slate-50 border border-slate-200 rounded-xl outline-none focus:ring-2 focus:ring-indigo-500/20"}),s.jsx("button",{onClick:W,disabled:m,className:"w-full py-3.5 bg-indigo-600 text-white rounded-xl font-black text-sm uppercase tracking-widest hover:bg-indigo-700 disabled:opacity-50 transition-colors",children:m?"Recherche IA en cours...":"Lancer la recherche"})]})]}),s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-5",children:[s.jsx("span",{className:"px-2.5 py-1 bg-[#0077B5]/10 text-[#0077B5] text-[10px] font-black uppercase tracking-widest rounded-full",children:"Option A"}),s.jsx("h3",{className:"font-black text-slate-800",children:"Scan via API LinkedIn"})]}),s.jsx("p",{className:"text-sm text-slate-500 mb-5",children:"Importe automatiquement tous les utilisateurs qui ont connecté leur compte LinkedIn à PedagoBridge et les classe (école/formateur)."}),!J&&s.jsx("div",{className:"p-4 bg-amber-50 border border-amber-200 rounded-xl mb-4 text-sm text-amber-700",children:"Connectez votre LinkedIn pour activer cette option."}),s.jsx("button",{onClick:Z,disabled:m,className:"w-full py-3.5 bg-[#0077B5] text-white rounded-xl font-black text-sm uppercase tracking-widest hover:bg-[#005885] disabled:opacity-50 transition-colors",children:m?"Scan en cours...":"Scanner via API LinkedIn"}),g&&s.jsx("div",{className:"mt-4 space-y-2",children:g.slice(0,5).map((we,_e)=>s.jsxs("div",{className:"flex items-center justify-between p-3 bg-slate-50 rounded-xl text-sm",children:[s.jsx("span",{className:"font-bold text-slate-800",children:we.name||we.full_name}),s.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-bold ${we.type==="school"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"}`,children:we.type})]},_e))})]})]})]}),e==="csv"&&s.jsx("div",{className:"max-w-2xl",children:s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-8",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[s.jsx("span",{className:"px-2.5 py-1 bg-green-100 text-green-700 text-[10px] font-black uppercase tracking-widest rounded-full",children:"Option B"}),s.jsx("h3",{className:"font-black text-slate-800",children:"Import CSV LinkedIn"})]}),s.jsxs("div",{className:"bg-indigo-50 rounded-xl p-4 mb-6 text-sm text-indigo-700",children:[s.jsx("p",{className:"font-bold mb-1",children:"Formats acceptés :"}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-indigo-600",children:[s.jsx("li",{children:"LinkedIn Sales Navigator export"}),s.jsx("li",{children:"LinkedIn Connections export (CSV)"}),s.jsx("li",{children:"CSV custom : name, title, company, location, linkedin_url, email"})]})]}),s.jsxs("div",{onClick:()=>{var we;return(we=j.current)==null?void 0:we.click()},className:"border-2 border-dashed border-slate-300 rounded-2xl p-10 text-center cursor-pointer hover:border-indigo-400 hover:bg-indigo-50/30 transition-colors",children:[s.jsx("input",{ref:j,type:"file",accept:".csv",className:"hidden",onChange:we=>{var _e;(_e=we.target.files)!=null&&_e[0]&&v(we.target.files[0])}}),x?s.jsxs("div",{children:[s.jsx("p",{className:"font-bold text-slate-800",children:x.name}),s.jsxs("p",{className:"text-sm text-slate-400 mt-1",children:[(x.size/1024).toFixed(0)," Ko"]})]}):s.jsxs("div",{children:[s.jsx("p",{className:"text-slate-500",children:"Glissez votre fichier CSV ou cliquez"}),s.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Export LinkedIn Sales Navigator ou connections"})]})]}),s.jsx("button",{onClick:le,disabled:!x||b,className:"w-full mt-5 py-4 bg-green-600 text-white rounded-xl font-black text-sm uppercase tracking-widest hover:bg-green-700 disabled:opacity-50 transition-colors",children:b?"Import et classification IA...":"Importer et classifier"}),N&&s.jsxs("div",{className:"mt-6 p-5 bg-green-50 border border-green-200 rounded-xl",children:[s.jsxs("p",{className:"font-black text-green-800 text-lg",children:[N.imported," prospects importés"]}),s.jsxs("p",{className:"text-sm text-green-600",children:[N.skipped," ignorés (doublons ou données insuffisantes)"]}),s.jsx("div",{className:"mt-3 space-y-1.5",children:(Ge=N.preview)==null?void 0:Ge.map((we,_e)=>s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-slate-700",children:we.name}),s.jsxs("span",{className:`font-bold ${we.type==="school"?"text-blue-600":"text-green-600"}`,children:[we.type," (",we.confidence,"%)"]})]},_e))})]})]})}),e==="prospects"&&s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-5 flex flex-wrap items-center gap-4",children:[s.jsxs("select",{value:V,onChange:we=>C(we.target.value),className:"px-4 py-2 text-sm border border-slate-200 rounded-xl bg-slate-50 outline-none",children:[s.jsx("option",{value:"all",children:"Tous types"}),s.jsx("option",{value:"school",children:"Écoles"}),s.jsx("option",{value:"trainer",children:"Formateurs"}),s.jsx("option",{value:"unknown",children:"Non classifié"})]}),s.jsxs("select",{value:R,onChange:we=>H(we.target.value),className:"px-4 py-2 text-sm border border-slate-200 rounded-xl bg-slate-50 outline-none",children:[s.jsx("option",{value:"all",children:"Tous statuts"}),Object.entries(SP).map(([we,_e])=>s.jsx("option",{value:we,children:_e.label},we))]}),s.jsx("div",{className:"ml-auto flex items-center gap-3",children:T.size>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"text-sm font-bold text-indigo-600",children:[T.size," sélectionné(s)"]}),s.jsxs("select",{value:A,onChange:we=>O(we.target.value),className:"px-3 py-2 text-sm border border-slate-200 rounded-xl bg-slate-50 outline-none",children:[s.jsx("option",{value:"",children:"Template auto (par type)"}),K.map(we=>s.jsx("option",{value:we.id,children:we.name},we.id))]}),s.jsxs("select",{value:q,onChange:we=>L(we.target.value),className:"px-3 py-2 text-sm border border-slate-200 rounded-xl bg-slate-50 outline-none",children:[s.jsx("option",{value:"email",children:"Email"}),J&&s.jsx("option",{value:"linkedin_message",children:"LinkedIn message"}),J&&s.jsx("option",{value:"both",children:"Email + LinkedIn"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:U,onChange:we=>Y(we.target.checked),className:"rounded"}),"Test"]}),s.jsx("button",{onClick:ge,disabled:M,className:`px-5 py-2 text-sm font-black rounded-xl text-white transition-colors ${U?"bg-amber-500 hover:bg-amber-600":"bg-indigo-600 hover:bg-indigo-700"} disabled:opacity-50`,children:M?"Envoi...":U?"Prévisualiser":"Envoyer"})]})})]}),s.jsx("div",{className:"bg-white rounded-2xl border border-slate-200 overflow-hidden",children:P?s.jsx("div",{className:"text-center py-20 text-slate-400",children:"Chargement..."}):S.length===0?s.jsxs("div",{className:"text-center py-20 text-slate-400",children:[s.jsx("p",{className:"font-bold mb-2",children:"Aucun prospect"}),s.jsx("p",{className:"text-sm",children:"Lancez une recherche ou importez un CSV"})]}):s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-slate-50 border-b text-xs font-bold text-slate-500 uppercase",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-4 py-3 text-left w-10",children:s.jsx("input",{type:"checkbox",checked:T.size===S.length&&S.length>0,onChange:Fe,className:"rounded"})}),s.jsx("th",{className:"px-4 py-3 text-left",children:"Nom"}),s.jsx("th",{className:"px-4 py-3 text-left",children:"Type"}),s.jsx("th",{className:"px-4 py-3 text-left",children:"Contact"}),s.jsx("th",{className:"px-4 py-3 text-center",children:"Score"}),s.jsx("th",{className:"px-4 py-3 text-left",children:"Statut"}),s.jsx("th",{className:"px-4 py-3 text-left",children:"Source"}),s.jsx("th",{className:"px-4 py-3 text-left",children:"Actions"})]})}),s.jsx("tbody",{children:S.map(we=>s.jsxs("tr",{className:`border-b hover:bg-slate-50 transition-colors ${T.has(we.id)?"bg-indigo-50/30":""}`,children:[s.jsx("td",{className:"px-4 py-3",children:s.jsx("input",{type:"checkbox",checked:T.has(we.id),onChange:()=>fe(we.id),className:"rounded"})}),s.jsxs("td",{className:"px-4 py-3",children:[s.jsx("div",{className:"font-bold text-slate-800",children:we.full_name}),we.title&&s.jsx("div",{className:"text-xs text-slate-400 truncate max-w-[200px]",children:we.title}),we.company_name&&s.jsx("div",{className:"text-xs text-indigo-600",children:we.company_name})]}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-black ${we.prospect_type==="school"?"bg-blue-100 text-blue-700":we.prospect_type==="trainer"?"bg-green-100 text-green-700":"bg-slate-100 text-slate-500"}`,children:we.prospect_type==="school"?"École":we.prospect_type==="trainer"?"Formateur":"?"})}),s.jsxs("td",{className:"px-4 py-3",children:[we.email?s.jsx("a",{href:`mailto:${we.email}`,className:"text-indigo-600 text-xs hover:underline",children:we.email}):s.jsx("span",{className:"text-slate-300 text-xs",children:"—"}),we.linkedin_url&&s.jsx("a",{href:we.linkedin_url.startsWith("http")?we.linkedin_url:`https://${we.linkedin_url}`,target:"_blank",rel:"noopener noreferrer",className:"block text-[#0077B5] text-xs hover:underline mt-0.5",children:"LinkedIn ↗"})]}),s.jsx("td",{className:"px-4 py-3 text-center",children:s.jsxs("span",{className:`font-black ${(we.confidence_score||0)>70?"text-green-600":(we.confidence_score||0)>40?"text-amber-600":"text-red-400"}`,children:[we.confidence_score||0,"%"]})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("select",{value:we.status,onChange:_e=>pe(we.id,_e.target.value),className:`text-xs font-bold px-2 py-1 rounded-lg border-0 cursor-pointer ${SP[we.status].color}`,children:Object.entries(SP).map(([_e,qe])=>s.jsx("option",{value:_e,children:qe.label},_e))})}),s.jsx("td",{className:"px-4 py-3 text-xs text-slate-400",children:we.source==="web_search"?"Web IA":we.source==="csv_import"?"CSV":we.source==="linkedin_api"?"API":we.source}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("button",{onClick:()=>{k(new Set([we.id])),t("prospects")},className:"text-xs text-indigo-600 hover:underline",children:"Sélect."})})]},we.id))})]})})]}),e==="templates"&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:K.map(we=>s.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[s.jsx("div",{className:"flex items-center justify-between mb-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`px-2 py-0.5 rounded-full text-[10px] font-black ${we.prospect_type==="school"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"}`,children:we.prospect_type==="school"?"École":"Formateur"}),s.jsx("span",{className:"text-[10px] font-black text-slate-400 uppercase",children:we.channel}),we.is_default&&s.jsx("span",{className:"text-[10px] font-black text-amber-600 bg-amber-50 px-2 py-0.5 rounded-full",children:"Défaut"})]})}),s.jsx("h4",{className:"font-black text-slate-800 mb-1",children:we.name}),we.subject&&s.jsxs("p",{className:"text-xs font-bold text-slate-500 mb-3",children:["Objet : ",we.subject]}),s.jsx("pre",{className:"text-xs text-slate-600 bg-slate-50 rounded-xl p-4 whitespace-pre-wrap font-sans overflow-auto max-h-48",children:we.body}),s.jsxs("p",{className:"text-[10px] text-slate-400 mt-3",children:["Variables : ","{{name}}"," ","{{company}}"," ","{{specialty}}"," ","{{trainer_count}}"]})]},we.id))})]})]})]})}function dxt(){const{user:e,isAdmin:t,loading:r}=Ur(),n=Xt(),[a,i]=w.useState(null),[o,l]=w.useState("image/jpeg"),[c,u]=w.useState(null),[d,f]=w.useState(!1),[m,h]=w.useState(!1),[g,p]=w.useState(null),[x,v]=w.useState([]),[b,y]=w.useState(""),[N,_]=w.useState(""),[j,S]=w.useState("");w.useEffect(()=>{!r&&(!e||!t)&&n("/auth")},[r,e,t,n]);const I=C=>{var q;const R=(q=C.target.files)==null?void 0:q[0];if(!R)return;l(R.type||"image/jpeg");const H=new FileReader;H.onload=()=>{const L=H.result;u(L),i(L.split(",")[1]||null)},H.readAsDataURL(R)},P=async(C,R)=>{var L;const{data:H,error:q}=await he.functions.invoke("linkedin-lead-outreach",{body:C});if(q){let M=q.message;try{const z=await((L=q.context)==null?void 0:L.json());z!=null&&z.error&&(M=z.error)}catch{}throw new Error(M||R)}if(!(H!=null&&H.success))throw new Error((H==null?void 0:H.error)||R);return H},F=async()=>{if(!a){ae.error("Choisissez une capture LinkedIn");return}f(!0);try{const C=await P({imageBase64:a,mimeType:o,dryRun:!0},"Échec de l'analyse");p({specialty_keywords:[],...C.lead}),v(C.matched||[]),y(C.subject||""),_(C.html||""),ae.success("Analyse terminée — vérifiez les infos avant d'envoyer")}catch(C){ae.error(C.message||"Erreur d'analyse")}finally{f(!1)}},T=async C=>{if(g){if(C&&!j){ae.error("Indiquez un email pour le test");return}if(!C&&!g.contact_email){ae.error("Aucun email de contact détecté");return}h(!0);try{const R=await P({lead:g,subject:b,html:N,...C?{demoTo:j}:{}},"Échec de l'envoi");ae.success(`Email envoyé à ${R.sentTo}`)}catch(R){ae.error(R.message||"Erreur d'envoi")}finally{h(!1)}}},k=async()=>{if(g){f(!0);try{const C=await P({lead:g,dryRun:!0},"Échec de la régénération");v(C.matched||[]),y(C.subject||""),_(C.html||""),ae.success("Aperçu régénéré depuis les infos")}catch(C){ae.error(C.message||"Erreur")}finally{f(!1)}}},V=(C,R)=>p(H=>H&&{...H,[C]:R});return s.jsx(xa,{children:s.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-3xl",children:[s.jsx(sa,{items:[{label:"Prospection LinkedIn (image)"}]}),s.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Prospection depuis une capture LinkedIn"}),s.jsx("p",{className:"text-muted-foreground mb-6",children:"Importez la capture d'un post (école/recruteur cherchant un formateur). L'outil extrait l'email + le besoin, propose des formateurs et envoie leur CV + une présentation PedagoBridge."}),s.jsxs(ke,{className:"mb-6",children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"1. Capture LinkedIn"})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsx(Ye,{type:"file",accept:"image/*",onChange:I}),c&&s.jsx("img",{src:c,alt:"aperçu",className:"max-h-64 rounded border"}),s.jsxs(ne,{onClick:F,disabled:d||!a,children:[d?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(pa,{className:"h-4 w-4 mr-2"}),"Analyser"]})]})]}),g&&s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{className:"text-lg",children:"2. Vérifier & envoyer"}),s.jsxs(Qr,{children:["Formateurs proposés : ",x.length?x.join(", "):"(aucun — ajustez les domaines)"]})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx(We,{children:"Email du contact"}),s.jsx(Ye,{value:g.contact_email||"",onChange:C=>V("contact_email",C.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Nom du contact"}),s.jsx(Ye,{value:g.contact_name||"",onChange:C=>V("contact_name",C.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Établissement"}),s.jsx(Ye,{value:g.organization||"",onChange:C=>V("organization",C.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Domaines (séparés par virgule)"}),s.jsx(Ye,{value:(g.specialty_keywords||[]).join(", "),onChange:C=>V("specialty_keywords",C.target.value.split(",").map(R=>R.trim()).filter(Boolean))})]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Besoin"}),s.jsx(gn,{value:g.need_summary||"",onChange:C=>V("need_summary",C.target.value)})]}),s.jsxs("div",{className:"border-t pt-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(We,{className:"text-base font-semibold",children:"Contenu de l'email"}),s.jsxs(ne,{type:"button",variant:"outline",size:"sm",onClick:k,disabled:d,children:[d?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(pa,{className:"h-4 w-4 mr-2"}),"Régénérer depuis les infos"]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Objet"}),s.jsx(Ye,{value:b,onChange:C=>y(C.target.value)})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Corps du mail (HTML)"}),s.jsx(gn,{value:N,onChange:C=>_(C.target.value),className:"font-mono text-xs min-h-[220px]"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Modifiable librement. « Régénérer » réécrit l'objet et le corps à partir des infos ci-dessus."})]}),N&&s.jsxs("div",{children:[s.jsx(We,{children:"Aperçu"}),s.jsx("div",{className:"border rounded p-3 bg-white text-black max-h-[320px] overflow-auto",dangerouslySetInnerHTML:{__html:N}})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2",children:[s.jsxs(ne,{onClick:()=>T(!1),disabled:m,children:[m?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(ta,{className:"h-4 w-4 mr-2"}),"Envoyer au contact"]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(Ye,{placeholder:"email test (démo)",value:j,onChange:C=>S(C.target.value),className:"w-56"}),s.jsx(ne,{variant:"outline",onClick:()=>T(!0),disabled:m,children:"Envoyer un test"})]})]})]})]})]})})}const fxt=e=>{switch(e.toLowerCase()){case"pdf":return s.jsx(Gt,{className:"h-8 w-8 text-red-500"});case"excel":return s.jsx(Lj,{className:"h-8 w-8 text-green-500"});case"word":return s.jsx(fR,{className:"h-8 w-8 text-blue-500"});default:return s.jsx(Gt,{className:"h-8 w-8 text-muted-foreground"})}},AK=e=>({"documents-legaux":"Documents Légaux",programmes:"Programmes",evaluation:"Évaluation","gestion-projet":"Gestion de Projet",commercial:"Commercial",general:"Général"})[e]||e,hxt=()=>{const[e,t]=w.useState(""),[r,n]=w.useState("all"),{data:a,isLoading:i}=ga({queryKey:["resources"],queryFn:async()=>{const{data:c,error:u}=await he.from("resources").select("*").eq("is_published",!0).order("title");if(u)throw u;return c}}),o=[...new Set((a==null?void 0:a.map(c=>c.category))||[])],l=a==null?void 0:a.filter(c=>{const u=c.title.toLowerCase().includes(e.toLowerCase()),d=r==="all"||c.category===r;return u&&d});return s.jsxs(xa,{children:[s.jsx(gr,{title:"Ressources & Modèles Gratuits pour la Formation Professionnelle",description:"Téléchargez gratuitement nos modèles et templates pour la formation professionnelle : conventions, programmes, syllabus, attestations, et plus encore."}),s.jsxs("div",{className:"container py-12",children:[s.jsxs("div",{className:"text-center mb-12",children:[s.jsx("h1",{className:"text-4xl font-bold mb-4",children:"Ressources & Modèles Gratuits"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Téléchargez nos templates professionnels pour gérer vos formations : conventions, programmes, évaluations et documents administratifs."})]}),s.jsxs("div",{className:"flex flex-col md:flex-row gap-4 mb-8",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher une ressource...",value:e,onChange:c=>t(c.target.value),className:"pl-10"})]}),s.jsxs(Lr,{value:r,onValueChange:n,children:[s.jsxs(Ar,{className:"w-full md:w-[200px]",children:[s.jsx(hR,{className:"h-4 w-4 mr-2"}),s.jsx(Br,{placeholder:"Catégorie"})]}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Toutes les catégories"}),o.map(c=>s.jsx(ot,{value:c,children:AK(c)},c))]})]})]}),i?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((c,u)=>s.jsxs(ke,{className:"animate-pulse",children:[s.jsxs(ht,{children:[s.jsx("div",{className:"h-8 w-8 bg-muted rounded mb-2"}),s.jsx("div",{className:"h-6 bg-muted rounded w-3/4"})]}),s.jsxs(Ae,{children:[s.jsx("div",{className:"h-4 bg-muted rounded w-full mb-2"}),s.jsx("div",{className:"h-4 bg-muted rounded w-2/3"})]})]},u))}):(l==null?void 0:l.length)===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Gt,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),s.jsx("p",{className:"text-lg text-muted-foreground",children:"Aucune ressource trouvée"})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:l==null?void 0:l.map(c=>s.jsx(vt,{to:`/ressources/${c.slug}`,children:s.jsxs(ke,{className:"h-full hover:shadow-lg transition-shadow cursor-pointer group",children:[s.jsxs(ht,{children:[s.jsxs("div",{className:"flex items-start justify-between",children:[fxt(c.type),s.jsx(Le,{variant:"secondary",children:AK(c.category)})]}),s.jsx(xt,{className:"mt-4 group-hover:text-primary transition-colors",children:c.title})]}),s.jsxs(Ae,{children:[s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:c.meta_description}),s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsx(Le,{variant:"outline",children:c.type}),s.jsxs("span",{className:"flex items-center text-muted-foreground",children:[s.jsx(Ho,{className:"h-4 w-4 mr-1"}),c.download_count," téléchargements"]})]})]})]})},c.id))}),s.jsxs("div",{className:"mt-16 bg-primary/5 rounded-lg p-8 text-center",children:[s.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Besoin d'aide pour vos formations ?"}),s.jsx("p",{className:"text-muted-foreground mb-6 max-w-2xl mx-auto",children:"Nos formateurs experts peuvent vous accompagner dans la mise en place de vos programmes de formation et l'utilisation de ces documents."}),s.jsx(vt,{to:"/formateurs",className:"inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 text-sm font-medium text-primary-foreground hover:bg-primary/90",children:"Découvrir nos formateurs"})]})]})]})},TK=(e,t="lg")=>{const r=t==="lg"?"h-12 w-12":"h-6 w-6";switch(e.toLowerCase()){case"pdf":return s.jsx(Gt,{className:`${r} text-red-500`});case"excel":return s.jsx(Lj,{className:`${r} text-green-500`});case"word":return s.jsx(fR,{className:`${r} text-blue-500`});default:return s.jsx(Gt,{className:`${r} text-muted-foreground`})}},mxt=e=>({"documents-legaux":"Documents Légaux",programmes:"Programmes",evaluation:"Évaluation","gestion-projet":"Gestion de Projet",commercial:"Commercial",general:"Général"})[e]||e,pxt=()=>{const{slug:e}=wo(),{data:t,isLoading:r}=ga({queryKey:["resource",e],queryFn:async()=>{const{data:i,error:o}=await he.from("resources").select("*").eq("slug",e).eq("is_published",!0).single();if(o)throw o;return i},enabled:!!e}),{data:n}=ga({queryKey:["featured-trainers"],queryFn:async()=>{const{data:i,error:o}=await he.rpc("get_public_trainer_profiles").limit(10);if(o)throw o;return(i==null?void 0:i.sort(()=>Math.random()-.5).slice(0,3))||[]}}),a=async()=>{t&&(await he.rpc("increment_resource_download",{resource_id:t.id}),t.download_url?window.open(t.download_url,"_blank"):alert("Ce document sera disponible prochainement. Revenez bientôt !"))};return r?s.jsx(xa,{children:s.jsxs("div",{className:"container py-12",children:[s.jsx(Yr,{className:"h-8 w-48 mb-8"}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"lg:col-span-2",children:[s.jsx(Yr,{className:"h-12 w-3/4 mb-4"}),s.jsx(Yr,{className:"h-4 w-full mb-2"}),s.jsx(Yr,{className:"h-4 w-full mb-2"}),s.jsx(Yr,{className:"h-4 w-2/3"})]}),s.jsx("div",{children:s.jsx(Yr,{className:"h-64 w-full"})})]})]})}):t?s.jsxs(xa,{children:[s.jsx(gr,{title:`${t.title} - Téléchargement Gratuit`,description:t.meta_description||`Téléchargez gratuitement notre ${t.title} pour la formation professionnelle.`}),s.jsxs("div",{className:"container py-12",children:[s.jsxs(vt,{to:"/ressources",className:"inline-flex items-center text-muted-foreground hover:text-primary mb-8",children:[s.jsx(Yn,{className:"h-4 w-4 mr-2"}),"Retour aux ressources"]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[s.jsxs("div",{className:"lg:col-span-2",children:[s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[TK(t.type),s.jsxs("div",{children:[s.jsx(Le,{variant:"secondary",className:"mb-2",children:mxt(t.category)}),s.jsx("h1",{className:"text-3xl font-bold",children:t.title})]})]}),s.jsx("div",{className:"prose prose-lg max-w-none",children:s.jsx(_F,{children:t.content})}),s.jsx(ke,{className:"mt-8 bg-primary/5 border-primary/20",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Besoin d'aide pour utiliser ce document ?"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Nos formateurs experts peuvent vous accompagner dans la mise en place de vos formations et l'utilisation de ces documents administratifs."}),s.jsx(vt,{to:"/formateurs",children:s.jsxs(ne,{variant:"outline",children:["Découvrir nos formateurs",s.jsx(vs,{className:"h-4 w-4 ml-2"})]})})]})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(ke,{className:"sticky top-24",children:[s.jsxs(ht,{className:"text-center",children:[s.jsx("div",{className:"mx-auto mb-4",children:TK(t.type)}),s.jsx(xt,{children:t.title})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-center gap-4 text-sm text-muted-foreground",children:[s.jsx(Le,{variant:"outline",children:t.type}),s.jsxs("span",{className:"flex items-center",children:[s.jsx(Ho,{className:"h-4 w-4 mr-1"}),t.download_count," téléchargements"]})]}),s.jsxs(ne,{className:"w-full",size:"lg",onClick:a,children:[s.jsx(Ho,{className:"h-5 w-5 mr-2"}),"Télécharger ",t.type]}),s.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Téléchargement gratuit, aucune inscription requise"})]})]}),n&&n.length>0&&s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsx(xt,{className:"text-lg",children:"Formateurs à la une"})}),s.jsxs(Ae,{className:"space-y-4",children:[n.map(i=>{var o;return s.jsxs(vt,{to:`/formateurs/${i.id}`,className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted transition-colors",children:[s.jsxs(ps,{children:[s.jsx(vi,{src:i.photo_url||void 0}),s.jsx(gs,{children:s.jsx(qo,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium truncate",children:i.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:(o=i.specialties)==null?void 0:o.slice(0,2).join(", ")})]})]},i.id)}),s.jsx(vt,{to:"/formateurs",className:"block text-center text-sm text-primary hover:underline pt-2",children:"Voir tous les formateurs →"})]})]})]})]})]})]}):s.jsx(xa,{children:s.jsxs("div",{className:"container py-12 text-center",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Ressource non trouvée"}),s.jsx(vt,{to:"/ressources",className:"text-primary hover:underline",children:"Retour aux ressources"})]})})},gxt=e=>{switch(e.toLowerCase()){case"pdf":return s.jsx(Gt,{className:"h-4 w-4 text-red-500"});case"excel":return s.jsx(Lj,{className:"h-4 w-4 text-green-500"});case"word":return s.jsx(fR,{className:"h-4 w-4 text-blue-500"});default:return s.jsx(Gt,{className:"h-4 w-4 text-muted-foreground"})}},PK=[{value:"documents-legaux",label:"Documents Légaux"},{value:"programmes",label:"Programmes"},{value:"evaluation",label:"Évaluation"},{value:"gestion-projet",label:"Gestion de Projet"},{value:"commercial",label:"Commercial"},{value:"general",label:"Général"}],xxt=["PDF","Word","Excel"],vxt=()=>{const e=e1(),[t,r]=w.useState(!1),[n,a]=w.useState(!1),[i,o]=w.useState(!1),[l,c]=w.useState(null),[u,d]=w.useState({title:"",slug:"",type:"PDF",category:"general",download_url:"",content:"",meta_description:"",is_published:!1}),{data:f,isLoading:m}=ga({queryKey:["admin-resources"],queryFn:async()=>{const{data:_,error:j}=await he.from("resources").select("*").order("created_at",{ascending:!1});if(j)throw j;return _}}),h=Ic({mutationFn:async _=>{const{error:j}=await he.from("resources").insert([_]);if(j)throw j},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-resources"]}),ae.success("Ressource créée"),v()},onError:_=>{ae.error(`Erreur: ${_.message}`)}}),g=Ic({mutationFn:async({id:_,data:j})=>{const{error:S}=await he.from("resources").update(j).eq("id",_);if(S)throw S},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-resources"]}),ae.success("Ressource mise à jour"),v()},onError:_=>{ae.error(`Erreur: ${_.message}`)}}),p=Ic({mutationFn:async _=>{const{error:j}=await he.from("resources").delete().eq("id",_);if(j)throw j},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-resources"]}),ae.success("Ressource supprimée")},onError:_=>{ae.error(`Erreur: ${_.message}`)}}),x=async()=>{a(!0);try{const{data:_,error:j}=await he.functions.invoke("generate-resources");if(j)throw j;_.generated>0?(ae.success(`${_.generated} ressources générées`),e.invalidateQueries({queryKey:["admin-resources"]})):ae.info("Toutes les ressources existent déjà")}catch(_){ae.error(`Erreur: ${_.message}`)}finally{a(!1)}},v=()=>{d({title:"",slug:"",type:"PDF",category:"general",download_url:"",content:"",meta_description:"",is_published:!1}),c(null),r(!1)},b=_=>{c(_),d({title:_.title,slug:_.slug,type:_.type,category:_.category,download_url:_.download_url||"",content:_.content,meta_description:_.meta_description||"",is_published:_.is_published}),r(!0)},y=()=>{if(!u.title||!u.slug||!u.content){ae.error("Veuillez remplir tous les champs obligatoires");return}l?g.mutate({id:l.id,data:u}):h.mutate(u)},N=_=>_.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"");return s.jsxs("div",{className:"container py-8",children:[s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",children:"Ressources & Templates"}),s.jsx("p",{className:"text-muted-foreground",children:"Gérez les documents téléchargeables pour le SEO"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:x,disabled:n,children:[n?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(a2,{className:"h-4 w-4 mr-2"}),"Générer les ressources"]}),s.jsxs(Hn,{open:t,onOpenChange:r,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{onClick:()=>v(),children:[s.jsx(Ya,{className:"h-4 w-4 mr-2"}),"Nouvelle ressource"]})}),s.jsxs(qn,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Gn,{children:s.jsx(Kn,{children:l?"Modifier la ressource":"Nouvelle ressource"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Titre *"}),s.jsx(Ye,{value:u.title,onChange:_=>{d({...u,title:_.target.value,slug:u.slug||N(_.target.value)})},placeholder:"Modèle de Convention..."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Slug *"}),s.jsx(Ye,{value:u.slug,onChange:_=>d({...u,slug:_.target.value}),placeholder:"modele-convention"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Type"}),s.jsxs(Lr,{value:u.type,onValueChange:_=>d({...u,type:_}),children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsx(Tr,{children:xxt.map(_=>s.jsx(ot,{value:_,children:_},_))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Catégorie"}),s.jsxs(Lr,{value:u.category,onValueChange:_=>d({...u,category:_}),children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsx(Tr,{children:PK.map(_=>s.jsx(ot,{value:_.value,children:_.label},_.value))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Fichier téléchargeable"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{value:u.download_url,onChange:_=>d({...u,download_url:_.target.value}),placeholder:"URL ou uploadez un fichier...",className:"flex-1"}),s.jsx(We,{htmlFor:"file-upload",className:"cursor-pointer inline-flex items-center justify-center rounded-md bg-secondary px-4 py-2 text-sm font-medium text-secondary-foreground hover:bg-secondary/80",children:i?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsx(nc,{className:"h-4 w-4"})}),s.jsx("input",{id:"file-upload",type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx",className:"hidden",onChange:async _=>{var S;const j=(S=_.target.files)==null?void 0:S[0];if(j){o(!0);try{const I=j.name.split(".").pop(),P=`${u.slug||"resource"}-${Date.now()}.${I}`,{data:F,error:T}=await he.storage.from("resources").upload(P,j,{upsert:!0});if(T)throw T;const{data:k}=he.storage.from("resources").getPublicUrl(F.path);d({...u,download_url:k.publicUrl}),ae.success("Fichier uploadé")}catch(I){ae.error(`Erreur upload: ${I.message}`)}finally{o(!1)}}}})]}),u.download_url&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:u.download_url})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Meta description"}),s.jsx(Ye,{value:u.meta_description,onChange:_=>d({...u,meta_description:_.target.value}),placeholder:"Description SEO (max 155 caractères)",maxLength:155})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Contenu *"}),s.jsx(gn,{value:u.content,onChange:_=>d({...u,content:_.target.value}),placeholder:"Contenu détaillé (Markdown supporté)",rows:10})]}),s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx(dy,{id:"published",checked:u.is_published,onCheckedChange:_=>d({...u,is_published:_})}),s.jsx(We,{htmlFor:"published",children:"Publier"})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ne,{variant:"outline",onClick:v,children:"Annuler"}),s.jsxs(ne,{onClick:y,disabled:h.isPending||g.isPending,children:[(h.isPending||g.isPending)&&s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}),l?"Mettre à jour":"Créer"]})]})]})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-sm text-muted-foreground",children:"Total ressources"})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-2xl font-bold",children:(f==null?void 0:f.length)||0})})]}),s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-sm text-muted-foreground",children:"Publiées"})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-2xl font-bold",children:(f==null?void 0:f.filter(_=>_.is_published).length)||0})})]}),s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-sm text-muted-foreground",children:"Total téléchargements"})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-2xl font-bold",children:(f==null?void 0:f.reduce((_,j)=>_+(j.download_count||0),0))||0})})]})]}),s.jsx(ke,{children:s.jsx(Ae,{className:"p-0",children:s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{children:"Ressource"}),s.jsx(pr,{children:"Type"}),s.jsx(pr,{children:"Catégorie"}),s.jsx(pr,{children:"Téléchargements"}),s.jsx(pr,{children:"Statut"}),s.jsx(pr,{className:"text-right",children:"Actions"})]})}),s.jsx(vh,{children:m?s.jsx(Oa,{children:s.jsx(ur,{colSpan:6,className:"text-center py-8",children:s.jsx(at,{className:"h-6 w-6 animate-spin mx-auto"})})}):(f==null?void 0:f.length)===0?s.jsx(Oa,{children:s.jsx(ur,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:'Aucune ressource. Cliquez sur "Générer les ressources" pour commencer.'})}):f==null?void 0:f.map(_=>{var j;return s.jsxs(Oa,{children:[s.jsx(ur,{children:s.jsxs("div",{className:"flex items-center gap-2",children:[gxt(_.type),s.jsx("span",{className:"font-medium",children:_.title})]})}),s.jsx(ur,{children:s.jsx(Le,{variant:"outline",children:_.type})}),s.jsx(ur,{children:((j=PK.find(S=>S.value===_.category))==null?void 0:j.label)||_.category}),s.jsx(ur,{children:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Ho,{className:"h-4 w-4"}),_.download_count]})}),s.jsx(ur,{children:s.jsx(Le,{variant:_.is_published?"default":"secondary",children:_.is_published?"Publié":"Brouillon"})}),s.jsx(ur,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[_.is_published&&s.jsx(ne,{variant:"ghost",size:"sm",asChild:!0,children:s.jsx(vt,{to:`/ressources/${_.slug}`,target:"_blank",children:s.jsx(vs,{className:"h-4 w-4"})})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>b(_),children:s.jsx(rC,{className:"h-4 w-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{confirm("Supprimer cette ressource ?")&&p.mutate(_.id)},children:s.jsx(bi,{className:"h-4 w-4 text-destructive"})})]})})]},_.id)})})]})})})]})};function yxt(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&l()},[t]);const l=async()=>{try{const{data:f,error:m}=await he.from("contact_messages").select("*").order("created_at",{ascending:!1});if(m)throw m;o(f||[])}catch(f){console.error("Error loading messages:",f),ae.error("Erreur lors du chargement des messages")}finally{a(!1)}},c=async f=>{try{const{error:m}=await he.from("contact_messages").update({is_read:!0}).eq("id",f);if(m)throw m;l()}catch(m){console.error("Error marking as read:",m),ae.error("Erreur lors de la mise à jour")}},u=async f=>{try{const{error:m}=await he.from("contact_messages").delete().eq("id",f);if(m)throw m;ae.success("Message supprimé"),l()}catch(m){console.error("Error deleting message:",m),ae.error("Erreur lors de la suppression")}},d=i.filter(f=>!f.is_read).length;return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-4xl mx-auto",children:[s.jsx(sa,{items:[{label:"Dashboard",href:"/admin"},{label:"Messages de contact"}]}),s.jsx("div",{className:"flex items-center justify-between mb-8",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",children:"Messages de contact"}),s.jsxs("p",{className:"text-muted-foreground mt-1",children:[i.length," message(s) • ",d," non lu(s)"]})]})}),i.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(zo,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),s.jsx("p",{className:"text-muted-foreground",children:"Aucun message de contact"})]})}):s.jsx("div",{className:"space-y-4",children:i.map(f=>s.jsxs(ke,{className:f.is_read?"opacity-75":"border-primary/50",children:[s.jsx(ht,{className:"pb-2",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(qo,{className:"w-5 h-5 text-primary"})}),s.jsxs("div",{children:[s.jsxs(xt,{className:"text-lg flex items-center gap-2",children:[f.name,!f.is_read&&s.jsx(Le,{variant:"default",className:"text-xs",children:"Nouveau"})]}),s.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Fn,{className:"w-3 h-3"}),f.email]}),f.phone&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Yy,{className:"w-3 h-3"}),f.phone]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Bs,{className:"w-4 h-4"}),Ot(new Date(f.created_at),"d MMM yyyy 'à' HH:mm",{locale:yr})]})]})}),s.jsxs(Ae,{children:[f.subject&&s.jsx("p",{className:"font-medium mb-2",children:f.subject}),s.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:f.message}),s.jsxs("div",{className:"flex items-center gap-2 mt-4 pt-4 border-t",children:[s.jsx("a",{href:`mailto:${f.email}`,children:s.jsxs(ne,{variant:"outline",size:"sm",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"Répondre par email"]})}),!f.is_read&&s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>c(f.id),children:[s.jsx(Wr,{className:"w-4 h-4 mr-2"}),"Marquer comme lu"]}),s.jsxs(Vu,{children:[s.jsx(Zf,{asChild:!0,children:s.jsxs(ne,{variant:"ghost",size:"sm",className:"text-destructive",children:[s.jsx(bi,{className:"w-4 h-4 mr-2"}),"Supprimer"]})}),s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Supprimer ce message ?"}),s.jsx(Xc,{children:"Cette action est irréversible."})]}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{onClick:()=>u(f.id),children:"Supprimer"})]})]})]})]})]})]},f.id))})]})})}const bxt={cni_passport:"CNI / Passeport",kbis_rcs:"Kbis / Extrait RCS",b3_criminal_record:"Casier Judiciaire B3",diploma:"Diplôme",certification:"Certification",insurance:"Attestation d'assurance",other:"Autre"};function wxt(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState(""),[u,d]=w.useState("pending"),[f,m]=w.useState(null),[h,g]=w.useState(""),[p,x]=w.useState(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&v()},[t]);const v=async()=>{try{const{data:F,error:T}=await he.from("trainer_documents").select(`
*,
trainer:trainer_profile_id (
id,
name,
email,
photo_url
)
`).order("created_at",{ascending:!1});if(T)throw T;o(F||[])}catch(F){console.error("Error loading documents:",F),ae.error("Erreur lors du chargement des documents")}finally{a(!1)}},b=async F=>{x(F.id);try{const{error:T}=await he.from("trainer_documents").update({status:"verified",verified_at:new Date().toISOString(),admin_comment:null}).eq("id",F.id);if(T)throw T;ae.success("Document vérifié avec succès"),v()}catch(T){console.error("Error verifying document:",T),ae.error("Erreur lors de la vérification")}finally{x(null)}},y=async()=>{if(f){x(f.id);try{const{error:F}=await he.from("trainer_documents").update({status:"rejected",admin_comment:h||"Document non conforme"}).eq("id",f.id);if(F)throw F;ae.success("Document rejeté"),m(null),g(""),v()}catch(F){console.error("Error rejecting document:",F),ae.error("Erreur lors du rejet")}finally{x(null)}}},N=F=>{switch(F){case"verified":return s.jsxs(Le,{className:"bg-green-500",children:[s.jsx(ma,{className:"w-3 h-3 mr-1"}),"Vérifié"]});case"rejected":return s.jsxs(Le,{variant:"destructive",children:[s.jsx(Fs,{className:"w-3 h-3 mr-1"}),"Rejeté"]});default:return s.jsxs(Le,{variant:"secondary",children:[s.jsx(Gr,{className:"w-3 h-3 mr-1"}),"En attente"]})}},_=F=>F.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),j=i.filter(F=>{var k,V;const T=((V=(k=F.trainer)==null?void 0:k.name)==null?void 0:V.toLowerCase().includes(l.toLowerCase()))||F.document_name.toLowerCase().includes(l.toLowerCase())||F.document_type.toLowerCase().includes(l.toLowerCase());return u==="all"?T:T&&F.status===u}),S=i.filter(F=>F.status==="pending").length,I=i.filter(F=>F.status==="verified").length,P=i.filter(F=>F.status==="rejected").length;return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-background py-12 px-4",children:[s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsx(sa,{items:[{label:"Documents Formateurs"}]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(Gt,{className:"h-6 w-6 text-primary"}),"Gestion des Documents"]}),s.jsx(Qr,{children:"Vérifiez et validez les documents soumis par les formateurs"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher...",value:l,onChange:F=>c(F.target.value),className:"pl-10 w-64"})]})]})}),s.jsxs(Ae,{children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"}),s.jsx("p",{className:"text-2xl font-bold",children:i.length})]})})}),s.jsx(ke,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20",children:s.jsx(Ae,{className:"pt-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-amber-600",children:"En attente"}),s.jsx("p",{className:"text-2xl font-bold text-amber-600",children:S})]})})}),s.jsx(ke,{className:"border-green-200 bg-green-50 dark:bg-green-950/20",children:s.jsx(Ae,{className:"pt-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-green-600",children:"Vérifiés"}),s.jsx("p",{className:"text-2xl font-bold text-green-600",children:I})]})})}),s.jsx(ke,{className:"border-red-200 bg-red-50 dark:bg-red-950/20",children:s.jsx(Ae,{className:"pt-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm text-red-600",children:"Rejetés"}),s.jsx("p",{className:"text-2xl font-bold text-red-600",children:P})]})})})]}),s.jsxs(af,{value:u,onValueChange:d,children:[s.jsxs(ad,{className:"mb-4",children:[s.jsxs(In,{value:"pending",children:["En attente (",S,")"]}),s.jsxs(In,{value:"verified",children:["Vérifiés (",I,")"]}),s.jsxs(In,{value:"rejected",children:["Rejetés (",P,")"]}),s.jsxs(In,{value:"all",children:["Tous (",i.length,")"]})]}),s.jsx(Es,{value:u,children:j.length===0?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(Gt,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsxs("p",{children:["Aucun document ",u!=="all"?`${u==="pending"?"en attente":u==="verified"?"vérifié":"rejeté"}`:""]})]}):s.jsx("div",{className:"space-y-4",children:j.map(F=>{var T,k,V,C;return s.jsx(ke,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(ps,{className:"h-12 w-12",children:[(T=F.trainer)!=null&&T.photo_url?s.jsx(vi,{src:F.trainer.photo_url}):null,s.jsx(gs,{className:"bg-primary text-primary-foreground",children:(k=F.trainer)!=null&&k.name?_(F.trainer.name):"?"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[((V=F.trainer)==null?void 0:V.name)||"Formateur inconnu",N(F.status)]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:(C=F.trainer)==null?void 0:C.email})]}),s.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(F.created_at).toLocaleDateString("fr-FR")})]}),s.jsxs("div",{className:"mt-3 p-3 bg-muted rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(Gt,{className:"h-4 w-4 text-primary"}),s.jsx("span",{className:"font-medium",children:bxt[F.document_type]||F.document_type})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:F.document_name}),F.expires_at&&s.jsxs("p",{className:"text-xs text-amber-600 mt-1",children:[s.jsx(Yd,{className:"h-3 w-3 inline mr-1"}),"Expire le ",new Date(F.expires_at).toLocaleDateString("fr-FR")]}),F.admin_comment&&F.status==="rejected"&&s.jsxs("p",{className:"text-sm text-red-600 mt-2",children:[s.jsx("strong",{children:"Motif :"})," ",F.admin_comment]})]}),s.jsxs("div",{className:"flex gap-2 mt-3 flex-wrap",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>window.open(F.document_url,"_blank"),children:[s.jsx(is,{className:"h-4 w-4 mr-2"}),"Voir le document",s.jsx(vs,{className:"h-3 w-3 ml-1"})]}),F.status==="pending"&&s.jsxs(s.Fragment,{children:[s.jsxs(ne,{size:"sm",onClick:()=>b(F),disabled:p===F.id,className:"bg-green-600 hover:bg-green-700",children:[p===F.id?s.jsx(at,{className:"h-4 w-4 animate-spin mr-2"}):s.jsx(ma,{className:"h-4 w-4 mr-2"}),"Valider"]}),s.jsxs(ne,{size:"sm",variant:"destructive",onClick:()=>m(F),disabled:p===F.id,children:[s.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Rejeter"]})]}),s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>e("/admin/trainers"),children:[s.jsx(qo,{className:"h-4 w-4 mr-2"}),"Voir le profil"]})]})]})]})})},F.id)})})})]})]})]})]}),s.jsx(Vu,{open:!!f,onOpenChange:()=>m(null),children:s.jsxs(Hc,{children:[s.jsxs(Gc,{children:[s.jsx(Yc,{children:"Rejeter ce document ?"}),s.jsx(Xc,{children:"Le formateur sera notifié que son document n'est pas conforme."})]}),s.jsx("div",{className:"py-4",children:s.jsx(gn,{placeholder:"Motif du rejet (optionnel mais recommandé)...",value:h,onChange:F=>g(F.target.value),rows:3})}),s.jsxs(Kc,{children:[s.jsx(Wu,{children:"Annuler"}),s.jsx(Zc,{onClick:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Confirmer le rejet"})]})]})})]})}const Tx={facture:{label:"Factures",className:"bg-emerald-100 text-emerald-700 border-emerald-300"},contrat:{label:"Contrats",className:"bg-amber-100 text-amber-700 border-amber-300"},mission:{label:"Missions",className:"bg-teal-100 text-teal-700 border-teal-300"},formateur:{label:"Formateurs / CV",className:"bg-indigo-100 text-indigo-700 border-indigo-300"},ecole:{label:"Écoles",className:"bg-orange-100 text-orange-700 border-orange-300"},pedagogie:{label:"Pédagogie",className:"bg-pink-100 text-pink-700 border-pink-300"},communication:{label:"Communication",className:"bg-sky-100 text-sky-700 border-sky-300"},autre:{label:"Autre",className:"bg-muted text-muted-foreground border-border"}},jxt=e=>{if(!e)return"—";const t=["o","Ko","Mo","Go"];let r=e,n=0;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(r<10&&n>0?1:0)} ${t[n]}`};function _xt(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState(""),[u,d]=w.useState("all"),[f,m]=w.useState(!1);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&h()},[t]);const h=async()=>{try{const{data:b,error:y}=await he.from("drive_documents").select("id, drive_file_id, folder_path, file_name, mime_type, file_size, drive_modified_at, web_view_link, category").order("drive_modified_at",{ascending:!1,nullsFirst:!1}).limit(2e3);if(y)throw y;o(b||[])}catch(b){console.error("Error loading drive documents:",b),ae.error("Erreur lors du chargement des documents Drive")}finally{a(!1)}},g=async()=>{m(!0);try{const{data:{session:b}}=await he.auth.getSession(),y=await fetch("https://pedagobridge.com/functions/v1/sync-drive-documents",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b==null?void 0:b.access_token}`,apikey:void 0},body:JSON.stringify({})}),N=await y.json();if(!y.ok)throw new Error(N.error||"Échec de la synchronisation");ae.success(`Synchronisé : ${N.total_files} fichiers indexés`),await h()}catch(b){console.error("Drive sync failed:",b),ae.error(b.message||"Erreur lors de la synchronisation")}finally{m(!1)}},p=w.useMemo(()=>{const b={};for(const y of i)b[y.category]=(b[y.category]||0)+1;return b},[i]),x=w.useMemo(()=>{const b=l.toLowerCase().trim();return i.filter(y=>u!=="all"&&y.category!==u?!1:b?y.file_name.toLowerCase().includes(b)||(y.folder_path||"").toLowerCase().includes(b):!0)},[i,l,u]),v=w.useMemo(()=>Object.keys(Tx).filter(b=>p[b]>0),[p]);return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-6xl",children:[s.jsx(sa,{items:[{label:"Documents Drive"}]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs(xt,{className:"flex items-center gap-2",children:[s.jsx(tC,{className:"h-6 w-6 text-primary"}),"Documents Drive"]}),s.jsx(Qr,{children:"Index de tous les fichiers du Drive PedagoBridge — partagé par toutes les fonctionnalités (factures, missions, contrats, CV…)."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Ye,{placeholder:"Rechercher un fichier ou dossier...",value:l,onChange:b=>c(b.target.value),className:"pl-10 w-64"})]}),s.jsxs(ne,{onClick:g,disabled:f,children:[f?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(yo,{className:"h-4 w-4 mr-2"}),"Synchroniser"]})]})]})}),s.jsxs(Ae,{children:[s.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.jsxs("button",{onClick:()=>d("all"),className:`text-xs font-bold px-3 py-1.5 rounded-full border transition-colors ${u==="all"?"bg-primary text-primary-foreground border-primary":"bg-background hover:bg-muted border-border"}`,children:["Tous (",i.length,")"]}),v.map(b=>s.jsxs("button",{onClick:()=>d(b),className:`text-xs font-bold px-3 py-1.5 rounded-full border transition-colors ${u===b?Tx[b].className:"bg-background hover:bg-muted border-border"}`,children:[Tx[b].label," (",p[b],")"]},b))]}),i.length===0?s.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[s.jsx(ZJ,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),s.jsx("p",{className:"mb-4",children:"Aucun document indexé pour l'instant."}),s.jsxs(ne,{onClick:g,disabled:f,children:[f?s.jsx(at,{className:"h-4 w-4 mr-2 animate-spin"}):s.jsx(yo,{className:"h-4 w-4 mr-2"}),"Lancer la première synchronisation"]})]}):s.jsx("div",{className:"overflow-x-auto border rounded-lg",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-muted/50 text-muted-foreground text-xs uppercase",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left font-semibold px-4 py-3",children:"Fichier"}),s.jsx("th",{className:"text-left font-semibold px-4 py-3",children:"Catégorie"}),s.jsx("th",{className:"text-left font-semibold px-4 py-3 hidden md:table-cell",children:"Dossier"}),s.jsx("th",{className:"text-left font-semibold px-4 py-3 hidden lg:table-cell",children:"Taille"}),s.jsx("th",{className:"text-left font-semibold px-4 py-3 hidden lg:table-cell",children:"Modifié"}),s.jsx("th",{className:"px-4 py-3"})]})}),s.jsxs("tbody",{children:[x.map(b=>{var y,N;return s.jsxs("tr",{className:"border-t hover:bg-muted/30 transition-colors",children:[s.jsx("td",{className:"px-4 py-3 max-w-[280px]",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Gt,{className:"h-4 w-4 text-muted-foreground shrink-0"}),s.jsx("span",{className:"truncate font-medium",title:b.file_name,children:b.file_name}),s.jsx(Jj,{source:"drive"})]})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(Le,{variant:"outline",className:`text-xs ${((y=Tx[b.category])==null?void 0:y.className)||Tx.autre.className}`,children:((N=Tx[b.category])==null?void 0:N.label)||b.category})}),s.jsx("td",{className:"px-4 py-3 hidden md:table-cell text-muted-foreground max-w-[220px]",children:s.jsx("span",{className:"truncate block",title:b.folder_path||"",children:b.folder_path||"—"})}),s.jsx("td",{className:"px-4 py-3 hidden lg:table-cell text-muted-foreground whitespace-nowrap",children:jxt(b.file_size)}),s.jsx("td",{className:"px-4 py-3 hidden lg:table-cell text-muted-foreground whitespace-nowrap",children:b.drive_modified_at?new Date(b.drive_modified_at).toLocaleDateString("fr-FR"):"—"}),s.jsx("td",{className:"px-4 py-3 text-right",children:b.web_view_link&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>window.open(b.web_view_link,"_blank","noopener,noreferrer"),children:s.jsx(vs,{className:"h-4 w-4"})})})]},b.id)}),x.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"text-center py-10 text-muted-foreground",children:"Aucun résultat pour ce filtre."})})]})]})})]})]})]})})}function Nxt(){const e=Xt(),{user:t,isAdmin:r,loading:n}=Ur(),[a,i]=w.useState(!0),[o,l]=w.useState([]),[c,u]=w.useState("all"),[d,f]=w.useState(null),[m,h]=w.useState(""),[g,p]=w.useState(!1);w.useEffect(()=>{n||(t?r?x():(ae.error("Accès réservé aux administrateurs"),e("/")):e("/auth"))},[t,r,n,e]);const x=async()=>{try{const{data:_,error:j}=await he.from("nda_assistance_requests").select("*").order("created_at",{ascending:!1});if(j)throw j;l(_||[])}catch(_){console.error("Error loading NDA requests:",_),ae.error("Erreur lors du chargement des demandes")}finally{i(!1)}},v=async _=>{if(!(!d||!t)){p(!0);try{const{error:j}=await he.from("nda_assistance_requests").update({status:_,admin_notes:m.trim()||null,processed_at:_!=="pending"?new Date().toISOString():null,processed_by:_!=="pending"?t.id:null}).eq("id",d.id);if(j)throw j;ae.success("Statut mis à jour"),f(null),h(""),await x()}catch(j){console.error("Error updating request:",j),ae.error("Erreur lors de la mise à jour")}finally{p(!1)}}},b=_=>{switch(_){case"pending":return s.jsxs(Le,{variant:"secondary",className:"bg-amber-100 text-amber-700",children:[s.jsx(Gr,{className:"h-3 w-3 mr-1"}),"En attente"]});case"in_progress":return s.jsxs(Le,{variant:"secondary",className:"bg-blue-100 text-blue-700",children:[s.jsx(TB,{className:"h-3 w-3 mr-1"}),"En cours"]});case"completed":return s.jsxs(Le,{variant:"secondary",className:"bg-green-100 text-green-700",children:[s.jsx(Wr,{className:"h-3 w-3 mr-1"}),"Terminée"]});case"rejected":return s.jsxs(Le,{variant:"secondary",className:"bg-red-100 text-red-700",children:[s.jsx(Fs,{className:"h-3 w-3 mr-1"}),"Refusée"]});default:return s.jsx(Le,{variant:"outline",children:_})}},y=c==="all"?o:o.filter(_=>_.status===c),N=o.filter(_=>_.status==="pending").length;return n||a?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"container mx-auto px-4 py-8",children:[s.jsx(sa,{items:[{label:"Admin",href:"/admin"},{label:"Demandes NDA"}]}),s.jsx("div",{className:"flex items-center justify-between mb-8",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(ne,{variant:"outline",onClick:()=>e("/admin"),children:[s.jsx(Yn,{className:"mr-2 h-4 w-4"}),"Retour"]}),s.jsxs("div",{children:[s.jsxs("h1",{className:"text-3xl font-bold flex items-center gap-2",children:[s.jsx(Gt,{className:"h-8 w-8"}),"Demandes d'assistance NDA",N>0&&s.jsx(Le,{variant:"destructive",children:N})]}),s.jsx("p",{className:"text-muted-foreground",children:"Gérez les demandes d'aide pour l'obtention du numéro de déclaration d'activité"})]})]})}),s.jsx(ke,{className:"mb-6",children:s.jsx(Ae,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(We,{children:"Filtrer par statut :"}),s.jsxs(Lr,{value:c,onValueChange:u,children:[s.jsx(Ar,{className:"w-48",children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsxs(ot,{value:"all",children:["Tous (",o.length,")"]}),s.jsxs(ot,{value:"pending",children:["En attente (",o.filter(_=>_.status==="pending").length,")"]}),s.jsxs(ot,{value:"in_progress",children:["En cours (",o.filter(_=>_.status==="in_progress").length,")"]}),s.jsxs(ot,{value:"completed",children:["Terminées (",o.filter(_=>_.status==="completed").length,")"]}),s.jsxs(ot,{value:"rejected",children:["Refusées (",o.filter(_=>_.status==="rejected").length,")"]})]})]})]})})}),y.length===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"p-12 text-center",children:[s.jsx(Gt,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),s.jsx("p",{className:"text-muted-foreground",children:"Aucune demande trouvée"})]})}):s.jsx("div",{className:"space-y-4",children:y.map(_=>s.jsx(ke,{className:"hover:shadow-md transition-shadow",children:s.jsx(Ae,{className:"p-6",children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"space-y-3 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-lg font-semibold",children:_.trainer_name}),b(_.status)]}),s.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Fn,{className:"h-4 w-4"}),s.jsx("a",{href:`mailto:${_.trainer_email}`,className:"hover:underline",children:_.trainer_email})]}),_.phone&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Yy,{className:"h-4 w-4"}),s.jsx("a",{href:`tel:${_.phone}`,className:"hover:underline",children:_.phone})]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Bs,{className:"h-4 w-4"}),new Date(_.created_at).toLocaleDateString("fr-FR")]})]}),_.message&&s.jsx("div",{className:"p-3 bg-muted rounded-md",children:s.jsx("p",{className:"text-sm",children:_.message})}),_.admin_notes&&s.jsxs("div",{className:"p-3 bg-primary/5 rounded-md border-l-2 border-primary",children:[s.jsx("p",{className:"text-xs font-medium text-primary mb-1",children:"Note admin :"}),s.jsx("p",{className:"text-sm",children:_.admin_notes})]})]}),s.jsxs("div",{className:"flex gap-2 ml-4",children:[s.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>e(`/trainer/${_.trainer_profile_id}`),children:[s.jsx(qo,{className:"h-4 w-4 mr-1"}),"Profil"]}),s.jsx(ne,{size:"sm",onClick:()=>{f(_),h(_.admin_notes||"")},children:"Gérer"})]})]})})},_.id))}),s.jsx(Hn,{open:!!d,onOpenChange:_=>!_&&f(null),children:s.jsxs(qn,{children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Gérer la demande"}),s.jsxs(Ia,{children:["Demande de ",d==null?void 0:d.trainer_name]})]}),s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(We,{children:"Notes administrateur"}),s.jsx(gn,{value:m,onChange:_=>h(_.target.value),placeholder:"Ajouter des notes sur cette demande...",rows:4})]})}),s.jsxs(Jl,{className:"flex-col sm:flex-row gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:()=>v("pending"),disabled:g||(d==null?void 0:d.status)==="pending",children:[s.jsx(Gr,{className:"h-4 w-4 mr-1"}),"En attente"]}),s.jsxs(ne,{variant:"outline",onClick:()=>v("in_progress"),disabled:g,className:"border-blue-500 text-blue-600 hover:bg-blue-50",children:[s.jsx(TB,{className:"h-4 w-4 mr-1"}),"En cours"]}),s.jsxs(ne,{variant:"outline",onClick:()=>v("rejected"),disabled:g,className:"border-red-500 text-red-600 hover:bg-red-50",children:[s.jsx(Fs,{className:"h-4 w-4 mr-1"}),"Refuser"]}),s.jsxs(ne,{onClick:()=>v("completed"),disabled:g,className:"bg-green-600 hover:bg-green-700",children:[g?s.jsx(at,{className:"h-4 w-4 mr-1 animate-spin"}):s.jsx(Wr,{className:"h-4 w-4 mr-1"}),"Terminée"]})]})]})})]})})}/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */var uj={};uj.version="0.18.5";var tc=1200,jg=1252,Sxt=[874,932,936,949,950,1250,1251,1252,1253,1254,1255,1256,1257,1258,1e4],LM={0:1252,1:65001,2:65001,77:1e4,128:932,129:949,130:1361,134:936,136:950,161:1253,162:1254,163:1258,177:1255,178:1256,186:1257,204:1251,222:874,238:1250,255:1252,69:6969},sA=function(e){Sxt.indexOf(e)!=-1&&(jg=LM[0]=e)};function kxt(){sA(1252)}var Uc=function(e){tc=e,sA(e)};function aA(){Uc(1200),kxt()}function _k(e){for(var t=[],r=0,n=e.length;r<n;++r)t[r]=e.charCodeAt(r);return t}function Cxt(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r)+(e.charCodeAt(2*r+1)<<8));return t.join("")}function Hfe(e){for(var t=[],r=0;r<e.length>>1;++r)t[r]=String.fromCharCode(e.charCodeAt(2*r+1)+(e.charCodeAt(2*r)<<8));return t.join("")}var ov=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1);return t==255&&r==254?Cxt(e.slice(2)):t==254&&r==255?Hfe(e.slice(2)):t==65279?e.slice(1):e},Xb=function(t){return String.fromCharCode(t)},QD=function(t){return String.fromCharCode(t)},Cn;function Ext(e){Cn=e,Uc=function(t){tc=t,sA(t)},ov=function(t){return t.charCodeAt(0)===255&&t.charCodeAt(1)===254?Cn.utils.decode(1200,_k(t.slice(2))):t},Xb=function(r){return tc===1200?String.fromCharCode(r):Cn.utils.decode(tc,[r&255,r>>8])[0]},QD=function(r){return Cn.utils.decode(jg,[r])[0]},bhe()}var Om="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function dj(e){for(var t="",r=0,n=0,a=0,i=0,o=0,l=0,c=0,u=0;u<e.length;)r=e.charCodeAt(u++),i=r>>2,n=e.charCodeAt(u++),o=(r&3)<<4|n>>4,a=e.charCodeAt(u++),l=(n&15)<<2|a>>6,c=a&63,isNaN(n)?l=c=64:isNaN(a)&&(c=64),t+=Om.charAt(i)+Om.charAt(o)+Om.charAt(l)+Om.charAt(c);return t}function ac(e){var t="",r=0,n=0,a=0,i=0,o=0,l=0,c=0;e=e.replace(/[^\w\+\/\=]/g,"");for(var u=0;u<e.length;)i=Om.indexOf(e.charAt(u++)),o=Om.indexOf(e.charAt(u++)),r=i<<2|o>>4,t+=String.fromCharCode(r),l=Om.indexOf(e.charAt(u++)),n=(o&15)<<4|l>>2,l!==64&&(t+=String.fromCharCode(n)),c=Om.indexOf(e.charAt(u++)),a=(l&3)<<6|c,c!==64&&(t+=String.fromCharCode(a));return t}var fn=function(){return typeof Buffer<"u"&&typeof process<"u"&&typeof process.versions<"u"&&!!process.versions.node}(),kh=function(){if(typeof Buffer<"u"){var e=!Buffer.from;if(!e)try{Buffer.from("foo","utf8")}catch{e=!0}return e?function(t,r){return r?new Buffer(t,r):new Buffer(t)}:Buffer.from.bind(Buffer)}return function(){}}();function fp(e){return fn?Buffer.alloc?Buffer.alloc(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}function OK(e){return fn?Buffer.allocUnsafe?Buffer.allocUnsafe(e):new Buffer(e):typeof Uint8Array<"u"?new Uint8Array(e):new Array(e)}var Wl=function(t){return fn?kh(t,"binary"):t.split("").map(function(r){return r.charCodeAt(0)&255})};function y_(e){if(typeof ArrayBuffer>"u")return Wl(e);for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n!=e.length;++n)r[n]=e.charCodeAt(n)&255;return t}function Ip(e){if(Array.isArray(e))return e.map(function(n){return String.fromCharCode(n)}).join("");for(var t=[],r=0;r<e.length;++r)t[r]=String.fromCharCode(e[r]);return t.join("")}function Axt(e){if(typeof Uint8Array>"u")throw new Error("Unsupported");return new Uint8Array(e)}function FM(e){if(typeof ArrayBuffer>"u")throw new Error("Unsupported");if(e instanceof ArrayBuffer)return FM(new Uint8Array(e));for(var t=new Array(e.length),r=0;r<e.length;++r)t[r]=e[r];return t}var Ti=fn?function(e){return Buffer.concat(e.map(function(t){return Buffer.isBuffer(t)?t:kh(t)}))}:function(e){if(typeof Uint8Array<"u"){var t=0,r=0;for(t=0;t<e.length;++t)r+=e[t].length;var n=new Uint8Array(r),a=0;for(t=0,r=0;t<e.length;r+=a,++t)if(a=e[t].length,e[t]instanceof Uint8Array)n.set(e[t],r);else{if(typeof e[t]=="string")throw"wtf";n.set(new Uint8Array(e[t]),r)}return n}return[].concat.apply([],e.map(function(i){return Array.isArray(i)?i:[].slice.call(i)}))};function Txt(e){for(var t=[],r=0,n=e.length+250,a=fp(e.length+255),i=0;i<e.length;++i){var o=e.charCodeAt(i);if(o<128)a[r++]=o;else if(o<2048)a[r++]=192|o>>6&31,a[r++]=128|o&63;else if(o>=55296&&o<57344){o=(o&1023)+64;var l=e.charCodeAt(++i)&1023;a[r++]=240|o>>8&7,a[r++]=128|o>>2&63,a[r++]=128|l>>6&15|(o&3)<<4,a[r++]=128|l&63}else a[r++]=224|o>>12&15,a[r++]=128|o>>6&63,a[r++]=128|o&63;r>n&&(t.push(a.slice(0,r)),r=0,a=fp(65535),n=65530)}return t.push(a.slice(0,r)),Ti(t)}var go=/\u0000/g,Zb=/[\u0001-\u0006]/g;function Tv(e){for(var t="",r=e.length-1;r>=0;)t+=e.charAt(r--);return t}function zu(e,t){var r=""+e;return r.length>=t?r:fa("0",t-r.length)+r}function MM(e,t){var r=""+e;return r.length>=t?r:fa(" ",t-r.length)+r}function Nk(e,t){var r=""+e;return r.length>=t?r:r+fa(" ",t-r.length)}function Pxt(e,t){var r=""+Math.round(e);return r.length>=t?r:fa("0",t-r.length)+r}function Oxt(e,t){var r=""+e;return r.length>=t?r:fa("0",t-r.length)+r}var DK=Math.pow(2,32);function Px(e,t){if(e>DK||e<-DK)return Pxt(e,t);var r=Math.round(e);return Oxt(r,t)}function Sk(e,t){return t=t||0,e.length>=7+t&&(e.charCodeAt(t)|32)===103&&(e.charCodeAt(t+1)|32)===101&&(e.charCodeAt(t+2)|32)===110&&(e.charCodeAt(t+3)|32)===101&&(e.charCodeAt(t+4)|32)===114&&(e.charCodeAt(t+5)|32)===97&&(e.charCodeAt(t+6)|32)===108}var IK=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],kP=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function Dxt(e){return e||(e={}),e[0]="General",e[1]="0",e[2]="0.00",e[3]="#,##0",e[4]="#,##0.00",e[9]="0%",e[10]="0.00%",e[11]="0.00E+00",e[12]="# ?/?",e[13]="# ??/??",e[14]="m/d/yy",e[15]="d-mmm-yy",e[16]="d-mmm",e[17]="mmm-yy",e[18]="h:mm AM/PM",e[19]="h:mm:ss AM/PM",e[20]="h:mm",e[21]="h:mm:ss",e[22]="m/d/yy h:mm",e[37]="#,##0 ;(#,##0)",e[38]="#,##0 ;[Red](#,##0)",e[39]="#,##0.00;(#,##0.00)",e[40]="#,##0.00;[Red](#,##0.00)",e[45]="mm:ss",e[46]="[h]:mm:ss",e[47]="mmss.0",e[48]="##0.0E+0",e[49]="@",e[56]='"上午/下午 "hh"時"mm"分"ss"秒 "',e}var Nr={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"m/d/yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@",56:'"上午/下午 "hh"時"mm"分"ss"秒 "'},RK={5:37,6:38,7:39,8:40,23:0,24:0,25:0,26:0,27:14,28:14,29:14,30:14,31:14,50:14,51:14,52:14,53:14,54:14,55:14,56:14,57:14,58:14,59:1,60:2,61:3,62:4,67:9,68:10,69:12,70:13,71:14,72:14,73:15,74:16,75:17,76:20,77:21,78:22,79:45,80:46,81:47,82:0},Ixt={5:'"$"#,##0_);\\("$"#,##0\\)',63:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',41:'_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)'};function kk(e,t,r){for(var n=e<0?-1:1,a=e*n,i=0,o=1,l=0,c=1,u=0,d=0,f=Math.floor(a);u<t&&(f=Math.floor(a),l=f*o+i,d=f*u+c,!(a-f<5e-8));)a=1/(a-f),i=o,o=l,c=u,u=d;if(d>t&&(u>t?(d=c,l=i):(d=u,l=o)),!r)return[0,n*l,d];var m=Math.floor(n*l/d);return[m,n*l-m*d,d]}function Dm(e,t,r){if(e>2958465||e<0)return null;var n=e|0,a=Math.floor(86400*(e-n)),i=0,o=[],l={D:n,T:a,u:86400*(e-n)-a,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(l.u)<1e-6&&(l.u=0),t&&t.date1904&&(n+=1462),l.u>.9999&&(l.u=0,++a==86400&&(l.T=a=0,++n,++l.D)),n===60)o=r?[1317,10,29]:[1900,2,29],i=3;else if(n===0)o=r?[1317,8,29]:[1900,1,0],i=6;else{n>60&&--n;var c=new Date(1900,0,1);c.setDate(c.getDate()+n-1),o=[c.getFullYear(),c.getMonth()+1,c.getDate()],i=c.getDay(),n<60&&(i=(i+6)%7),r&&(i=Bxt(c,o))}return l.y=o[0],l.m=o[1],l.d=o[2],l.S=a%60,a=Math.floor(a/60),l.M=a%60,a=Math.floor(a/60),l.H=a,l.q=i,l}var Gfe=new Date(1899,11,31,0,0,0),Rxt=Gfe.getTime(),Lxt=new Date(1900,2,1,0,0,0);function Kfe(e,t){var r=e.getTime();return t?r-=1461*24*60*60*1e3:e>=Lxt&&(r+=24*60*60*1e3),(r-(Rxt+(e.getTimezoneOffset()-Gfe.getTimezoneOffset())*6e4))/(24*60*60*1e3)}function $M(e){return e.indexOf(".")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)$/,"$1")}function Fxt(e){return e.indexOf("E")==-1?e:e.replace(/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,"$1E").replace(/(E[+-])(\d)$/,"$10$2")}function Mxt(e){var t=e<0?12:11,r=$M(e.toFixed(12));return r.length<=t||(r=e.toPrecision(10),r.length<=t)?r:e.toExponential(5)}function $xt(e){var t=$M(e.toFixed(11));return t.length>(e<0?12:11)||t==="0"||t==="-0"?e.toPrecision(6):t}function fj(e){var t=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),r;return t>=-4&&t<=-1?r=e.toPrecision(10+t):Math.abs(t)<=9?r=Mxt(e):t===10?r=e.toFixed(10).substr(0,12):r=$xt(e),$M(Fxt(r.toUpperCase()))}function _g(e,t){switch(typeof e){case"string":return e;case"boolean":return e?"TRUE":"FALSE";case"number":return(e|0)===e?e.toString(10):fj(e);case"undefined":return"";case"object":if(e==null)return"";if(e instanceof Date)return ic(14,Kfe(e,t&&t.date1904),t)}throw new Error("unsupported value in General format: "+e)}function Bxt(e,t){t[0]-=581;var r=e.getDay();return e<60&&(r=(r+6)%7),r}function zxt(e,t,r,n){var a="",i=0,o=0,l=r.y,c,u=0;switch(e){case 98:l=r.y+543;case 121:switch(t.length){case 1:case 2:c=l%100,u=2;break;default:c=l%1e4,u=4;break}break;case 109:switch(t.length){case 1:case 2:c=r.m,u=t.length;break;case 3:return kP[r.m-1][1];case 5:return kP[r.m-1][0];default:return kP[r.m-1][2]}break;case 100:switch(t.length){case 1:case 2:c=r.d,u=t.length;break;case 3:return IK[r.q][0];default:return IK[r.q][1]}break;case 104:switch(t.length){case 1:case 2:c=1+(r.H+11)%12,u=t.length;break;default:throw"bad hour format: "+t}break;case 72:switch(t.length){case 1:case 2:c=r.H,u=t.length;break;default:throw"bad hour format: "+t}break;case 77:switch(t.length){case 1:case 2:c=r.M,u=t.length;break;default:throw"bad minute format: "+t}break;case 115:if(t!="s"&&t!="ss"&&t!=".0"&&t!=".00"&&t!=".000")throw"bad second format: "+t;return r.u===0&&(t=="s"||t=="ss")?zu(r.S,t.length):(n>=2?o=n===3?1e3:100:o=n===1?10:1,i=Math.round(o*(r.S+r.u)),i>=60*o&&(i=0),t==="s"?i===0?"0":""+i/o:(a=zu(i,2+n),t==="ss"?a.substr(0,2):"."+a.substr(2,t.length-1)));case 90:switch(t){case"[h]":case"[hh]":c=r.D*24+r.H;break;case"[m]":case"[mm]":c=(r.D*24+r.H)*60+r.M;break;case"[s]":case"[ss]":c=((r.D*24+r.H)*60+r.M)*60+Math.round(r.S+r.u);break;default:throw"bad abstime format: "+t}u=t.length===3?1:2;break;case 101:c=l,u=1;break}var d=u>0?zu(c,u):"";return d}function Im(e){var t=3;if(e.length<=t)return e;for(var r=e.length%t,n=e.substr(0,r);r!=e.length;r+=t)n+=(n.length>0?",":"")+e.substr(r,t);return n}var Yfe=/%/g;function Uxt(e,t,r){var n=t.replace(Yfe,""),a=t.length-n.length;return rh(e,n,r*Math.pow(10,2*a))+fa("%",a)}function qxt(e,t,r){for(var n=t.length-1;t.charCodeAt(n-1)===44;)--n;return rh(e,t.substr(0,n),r/Math.pow(10,3*(t.length-n)))}function Xfe(e,t){var r,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+Xfe(e,-t);var a=e.indexOf(".");a===-1&&(a=e.indexOf("E"));var i=Math.floor(Math.log(t)*Math.LOG10E)%a;if(i<0&&(i+=a),r=(t/Math.pow(10,i)).toPrecision(n+1+(a+i)%a),r.indexOf("e")===-1){var o=Math.floor(Math.log(t)*Math.LOG10E);for(r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(o-r.length+i):r+="E+"+(o-i);r.substr(0,2)==="0.";)r=r.charAt(0)+r.substr(2,a)+"."+r.substr(2+a),r=r.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(l,c,u,d){return c+u+d.substr(0,(a+i)%a)+"."+d.substr(i)+"E"})}else r=t.toExponential(n);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}var Zfe=/# (\?+)( ?)\/( ?)(\d+)/;function Vxt(e,t,r){var n=parseInt(e[4],10),a=Math.round(t*n),i=Math.floor(a/n),o=a-i*n,l=n;return r+(i===0?"":""+i)+" "+(o===0?fa(" ",e[1].length+1+e[4].length):MM(o,e[1].length)+e[2]+"/"+e[3]+zu(l,e[4].length))}function Wxt(e,t,r){return r+(t===0?"":""+t)+fa(" ",e[1].length+2+e[4].length)}var Jfe=/^#*0*\.([0#]+)/,Qfe=/\).*[0#]/,ehe=/\(###\) ###\\?-####/;function Do(e){for(var t="",r,n=0;n!=e.length;++n)switch(r=e.charCodeAt(n)){case 35:break;case 63:t+=" ";break;case 48:t+="0";break;default:t+=String.fromCharCode(r)}return t}function LK(e,t){var r=Math.pow(10,t);return""+Math.round(e*r)/r}function FK(e,t){var r=e-Math.floor(e),n=Math.pow(10,t);return t<(""+Math.round(r*n)).length?0:Math.round(r*n)}function Hxt(e,t){return t<(""+Math.round((e-Math.floor(e))*Math.pow(10,t))).length?1:0}function Gxt(e){return e<2147483647&&e>-2147483648?""+(e>=0?e|0:e-1|0):""+Math.floor(e)}function wc(e,t,r){if(e.charCodeAt(0)===40&&!t.match(Qfe)){var n=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?wc("n",n,r):"("+wc("n",n,-r)+")"}if(t.charCodeAt(t.length-1)===44)return qxt(e,t,r);if(t.indexOf("%")!==-1)return Uxt(e,t,r);if(t.indexOf("E")!==-1)return Xfe(t,r);if(t.charCodeAt(0)===36)return"$"+wc(e,t.substr(t.charAt(1)==" "?2:1),r);var a,i,o,l,c=Math.abs(r),u=r<0?"-":"";if(t.match(/^00+$/))return u+Px(c,t.length);if(t.match(/^[#?]+$/))return a=Px(r,0),a==="0"&&(a=""),a.length>t.length?a:Do(t.substr(0,t.length-a.length))+a;if(i=t.match(Zfe))return Vxt(i,c,u);if(t.match(/^#+0+$/))return u+Px(c,t.length-t.indexOf("0"));if(i=t.match(Jfe))return a=LK(r,i[1].length).replace(/^([^\.]+)$/,"$1."+Do(i[1])).replace(/\.$/,"."+Do(i[1])).replace(/\.(\d*)$/,function(g,p){return"."+p+fa("0",Do(i[1]).length-p.length)}),t.indexOf("0.")!==-1?a:a.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),i=t.match(/^(0*)\.(#*)$/))return u+LK(c,i[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=t.match(/^#{1,3},##0(\.?)$/))return u+Im(Px(c,0));if(i=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+wc(e,t,-r):Im(""+(Math.floor(r)+Hxt(r,i[1].length)))+"."+zu(FK(r,i[1].length),i[1].length);if(i=t.match(/^#,#*,#0/))return wc(e,t.replace(/^#,#*,/,""),r);if(i=t.match(/^([0#]+)(\\?-([0#]+))+$/))return a=Tv(wc(e,t.replace(/[\\-]/g,""),r)),o=0,Tv(Tv(t.replace(/\\/g,"")).replace(/[0#]/g,function(g){return o<a.length?a.charAt(o++):g==="0"?"0":""}));if(t.match(ehe))return a=wc(e,"##########",r),"("+a.substr(0,3)+") "+a.substr(3,3)+"-"+a.substr(6);var d="";if(i=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(i[4].length,7),l=kk(c,Math.pow(10,o)-1,!1),a=""+u,d=rh("n",i[1],l[1]),d.charAt(d.length-1)==" "&&(d=d.substr(0,d.length-1)+"0"),a+=d+i[2]+"/"+i[3],d=Nk(l[2],o),d.length<i[4].length&&(d=Do(i[4].substr(i[4].length-d.length))+d),a+=d,a;if(i=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(Math.max(i[1].length,i[4].length),7),l=kk(c,Math.pow(10,o)-1,!0),u+(l[0]||(l[1]?"":"0"))+" "+(l[1]?MM(l[1],o)+i[2]+"/"+i[3]+Nk(l[2],o):fa(" ",2*o+1+i[2].length+i[3].length));if(i=t.match(/^[#0?]+$/))return a=Px(r,0),t.length<=a.length?a:Do(t.substr(0,t.length-a.length))+a;if(i=t.match(/^([#0?]+)\.([#0]+)$/)){a=""+r.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),o=a.indexOf(".");var f=t.indexOf(".")-o,m=t.length-a.length-f;return Do(t.substr(0,f)+a+t.substr(t.length-m))}if(i=t.match(/^00,000\.([#0]*0)$/))return o=FK(r,i[1].length),r<0?"-"+wc(e,t,-r):Im(Gxt(r)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(g){return"00,"+(g.length<3?zu(0,3-g.length):"")+g})+"."+zu(o,i[1].length);switch(t){case"###,##0.00":return wc(e,"#,##0.00",r);case"###,###":case"##,###":case"#,###":var h=Im(Px(c,0));return h!=="0"?u+h:"";case"###,###.00":return wc(e,"###,##0.00",r).replace(/^0\./,".");case"#,###.00":return wc(e,"#,##0.00",r).replace(/^0\./,".")}throw new Error("unsupported format |"+t+"|")}function Kxt(e,t,r){for(var n=t.length-1;t.charCodeAt(n-1)===44;)--n;return rh(e,t.substr(0,n),r/Math.pow(10,3*(t.length-n)))}function Yxt(e,t,r){var n=t.replace(Yfe,""),a=t.length-n.length;return rh(e,n,r*Math.pow(10,2*a))+fa("%",a)}function the(e,t){var r,n=e.indexOf("E")-e.indexOf(".")-1;if(e.match(/^#+0.0E\+0$/)){if(t==0)return"0.0E+0";if(t<0)return"-"+the(e,-t);var a=e.indexOf(".");a===-1&&(a=e.indexOf("E"));var i=Math.floor(Math.log(t)*Math.LOG10E)%a;if(i<0&&(i+=a),r=(t/Math.pow(10,i)).toPrecision(n+1+(a+i)%a),!r.match(/[Ee]/)){var o=Math.floor(Math.log(t)*Math.LOG10E);r.indexOf(".")===-1?r=r.charAt(0)+"."+r.substr(1)+"E+"+(o-r.length+i):r+="E+"+(o-i),r=r.replace(/\+-/,"-")}r=r.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(l,c,u,d){return c+u+d.substr(0,(a+i)%a)+"."+d.substr(i)+"E"})}else r=t.toExponential(n);return e.match(/E\+00$/)&&r.match(/e[+-]\d$/)&&(r=r.substr(0,r.length-1)+"0"+r.charAt(r.length-1)),e.match(/E\-/)&&r.match(/e\+/)&&(r=r.replace(/e\+/,"e")),r.replace("e","E")}function jd(e,t,r){if(e.charCodeAt(0)===40&&!t.match(Qfe)){var n=t.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return r>=0?jd("n",n,r):"("+jd("n",n,-r)+")"}if(t.charCodeAt(t.length-1)===44)return Kxt(e,t,r);if(t.indexOf("%")!==-1)return Yxt(e,t,r);if(t.indexOf("E")!==-1)return the(t,r);if(t.charCodeAt(0)===36)return"$"+jd(e,t.substr(t.charAt(1)==" "?2:1),r);var a,i,o,l,c=Math.abs(r),u=r<0?"-":"";if(t.match(/^00+$/))return u+zu(c,t.length);if(t.match(/^[#?]+$/))return a=""+r,r===0&&(a=""),a.length>t.length?a:Do(t.substr(0,t.length-a.length))+a;if(i=t.match(Zfe))return Wxt(i,c,u);if(t.match(/^#+0+$/))return u+zu(c,t.length-t.indexOf("0"));if(i=t.match(Jfe))return a=(""+r).replace(/^([^\.]+)$/,"$1."+Do(i[1])).replace(/\.$/,"."+Do(i[1])),a=a.replace(/\.(\d*)$/,function(g,p){return"."+p+fa("0",Do(i[1]).length-p.length)}),t.indexOf("0.")!==-1?a:a.replace(/^0\./,".");if(t=t.replace(/^#+([0.])/,"$1"),i=t.match(/^(0*)\.(#*)$/))return u+(""+c).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,i[1].length?"0.":".");if(i=t.match(/^#{1,3},##0(\.?)$/))return u+Im(""+c);if(i=t.match(/^#,##0\.([#0]*0)$/))return r<0?"-"+jd(e,t,-r):Im(""+r)+"."+fa("0",i[1].length);if(i=t.match(/^#,#*,#0/))return jd(e,t.replace(/^#,#*,/,""),r);if(i=t.match(/^([0#]+)(\\?-([0#]+))+$/))return a=Tv(jd(e,t.replace(/[\\-]/g,""),r)),o=0,Tv(Tv(t.replace(/\\/g,"")).replace(/[0#]/g,function(g){return o<a.length?a.charAt(o++):g==="0"?"0":""}));if(t.match(ehe))return a=jd(e,"##########",r),"("+a.substr(0,3)+") "+a.substr(3,3)+"-"+a.substr(6);var d="";if(i=t.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(i[4].length,7),l=kk(c,Math.pow(10,o)-1,!1),a=""+u,d=rh("n",i[1],l[1]),d.charAt(d.length-1)==" "&&(d=d.substr(0,d.length-1)+"0"),a+=d+i[2]+"/"+i[3],d=Nk(l[2],o),d.length<i[4].length&&(d=Do(i[4].substr(i[4].length-d.length))+d),a+=d,a;if(i=t.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return o=Math.min(Math.max(i[1].length,i[4].length),7),l=kk(c,Math.pow(10,o)-1,!0),u+(l[0]||(l[1]?"":"0"))+" "+(l[1]?MM(l[1],o)+i[2]+"/"+i[3]+Nk(l[2],o):fa(" ",2*o+1+i[2].length+i[3].length));if(i=t.match(/^[#0?]+$/))return a=""+r,t.length<=a.length?a:Do(t.substr(0,t.length-a.length))+a;if(i=t.match(/^([#0]+)\.([#0]+)$/)){a=""+r.toFixed(Math.min(i[2].length,10)).replace(/([^0])0+$/,"$1"),o=a.indexOf(".");var f=t.indexOf(".")-o,m=t.length-a.length-f;return Do(t.substr(0,f)+a+t.substr(t.length-m))}if(i=t.match(/^00,000\.([#0]*0)$/))return r<0?"-"+jd(e,t,-r):Im(""+r).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(g){return"00,"+(g.length<3?zu(0,3-g.length):"")+g})+"."+zu(0,i[1].length);switch(t){case"###,###":case"##,###":case"#,###":var h=Im(""+c);return h!=="0"?u+h:"";default:if(t.match(/\.[0#?]*$/))return jd(e,t.slice(0,t.lastIndexOf(".")),r)+Do(t.slice(t.lastIndexOf(".")))}throw new Error("unsupported format |"+t+"|")}function rh(e,t,r){return(r|0)===r?jd(e,t,r):wc(e,t,r)}function Xxt(e){for(var t=[],r=!1,n=0,a=0;n<e.length;++n)switch(e.charCodeAt(n)){case 34:r=!r;break;case 95:case 42:case 92:++n;break;case 59:t[t.length]=e.substr(a,n-a),a=n+1}if(t[t.length]=e.substr(a),r===!0)throw new Error("Format |"+e+"| unterminated string ");return t}var rhe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function Gg(e){for(var t=0,r="",n="";t<e.length;)switch(r=e.charAt(t)){case"G":Sk(e,t)&&(t+=6),t++;break;case'"':for(;e.charCodeAt(++t)!==34&&t<e.length;);++t;break;case"\\":t+=2;break;case"_":t+=2;break;case"@":++t;break;case"B":case"b":if(e.charAt(t+1)==="1"||e.charAt(t+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(e.substr(t,3).toUpperCase()==="A/P"||e.substr(t,5).toUpperCase()==="AM/PM"||e.substr(t,5).toUpperCase()==="上午/下午")return!0;++t;break;case"[":for(n=r;e.charAt(t++)!=="]"&&t<e.length;)n+=e.charAt(t);if(n.match(rhe))return!0;break;case".":case"0":case"#":for(;t<e.length&&("0#?.,E+-%".indexOf(r=e.charAt(++t))>-1||r=="\\"&&e.charAt(t+1)=="-"&&"0#".indexOf(e.charAt(t+2))>-1););break;case"?":for(;e.charAt(++t)===r;);break;case"*":++t,(e.charAt(t)==" "||e.charAt(t)=="*")&&++t;break;case"(":case")":++t;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;t<e.length&&"0123456789".indexOf(e.charAt(++t))>-1;);break;case" ":++t;break;default:++t;break}return!1}function Zxt(e,t,r,n){for(var a=[],i="",o=0,l="",c="t",u,d,f,m="H";o<e.length;)switch(l=e.charAt(o)){case"G":if(!Sk(e,o))throw new Error("unrecognized character "+l+" in "+e);a[a.length]={t:"G",v:"General"},o+=7;break;case'"':for(i="";(f=e.charCodeAt(++o))!==34&&o<e.length;)i+=String.fromCharCode(f);a[a.length]={t:"t",v:i},++o;break;case"\\":var h=e.charAt(++o),g=h==="("||h===")"?h:"t";a[a.length]={t:g,v:h},++o;break;case"_":a[a.length]={t:"t",v:" "},o+=2;break;case"@":a[a.length]={t:"T",v:t},++o;break;case"B":case"b":if(e.charAt(o+1)==="1"||e.charAt(o+1)==="2"){if(u==null&&(u=Dm(t,r,e.charAt(o+1)==="2"),u==null))return"";a[a.length]={t:"X",v:e.substr(o,2)},c=l,o+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":l=l.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if(t<0||u==null&&(u=Dm(t,r),u==null))return"";for(i=l;++o<e.length&&e.charAt(o).toLowerCase()===l;)i+=l;l==="m"&&c.toLowerCase()==="h"&&(l="M"),l==="h"&&(l=m),a[a.length]={t:l,v:i},c=l;break;case"A":case"a":case"上":var p={t:l,v:l};if(u==null&&(u=Dm(t,r)),e.substr(o,3).toUpperCase()==="A/P"?(u!=null&&(p.v=u.H>=12?"P":"A"),p.t="T",m="h",o+=3):e.substr(o,5).toUpperCase()==="AM/PM"?(u!=null&&(p.v=u.H>=12?"PM":"AM"),p.t="T",o+=5,m="h"):e.substr(o,5).toUpperCase()==="上午/下午"?(u!=null&&(p.v=u.H>=12?"下午":"上午"),p.t="T",o+=5,m="h"):(p.t="t",++o),u==null&&p.t==="T")return"";a[a.length]=p,c=l;break;case"[":for(i=l;e.charAt(o++)!=="]"&&o<e.length;)i+=e.charAt(o);if(i.slice(-1)!=="]")throw'unterminated "[" block: |'+i+"|";if(i.match(rhe)){if(u==null&&(u=Dm(t,r),u==null))return"";a[a.length]={t:"Z",v:i.toLowerCase()},c=i.charAt(1)}else i.indexOf("$")>-1&&(i=(i.match(/\$([^-\[\]]*)/)||[])[1]||"$",Gg(e)||(a[a.length]={t:"t",v:i}));break;case".":if(u!=null){for(i=l;++o<e.length&&(l=e.charAt(o))==="0";)i+=l;a[a.length]={t:"s",v:i};break}case"0":case"#":for(i=l;++o<e.length&&"0#?.,E+-%".indexOf(l=e.charAt(o))>-1;)i+=l;a[a.length]={t:"n",v:i};break;case"?":for(i=l;e.charAt(++o)===l;)i+=l;a[a.length]={t:l,v:i},c=l;break;case"*":++o,(e.charAt(o)==" "||e.charAt(o)=="*")&&++o;break;case"(":case")":a[a.length]={t:n===1?"t":l,v:l},++o;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(i=l;o<e.length&&"0123456789".indexOf(e.charAt(++o))>-1;)i+=e.charAt(o);a[a.length]={t:"D",v:i};break;case" ":a[a.length]={t:l,v:l},++o;break;case"$":a[a.length]={t:"t",v:"$"},++o;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(l)===-1)throw new Error("unrecognized character "+l+" in "+e);a[a.length]={t:"t",v:l},++o;break}var x=0,v=0,b;for(o=a.length-1,c="t";o>=0;--o)switch(a[o].t){case"h":case"H":a[o].t=m,c="h",x<1&&(x=1);break;case"s":(b=a[o].v.match(/\.0+$/))&&(v=Math.max(v,b[0].length-1)),x<3&&(x=3);case"d":case"y":case"M":case"e":c=a[o].t;break;case"m":c==="s"&&(a[o].t="M",x<2&&(x=2));break;case"X":break;case"Z":x<1&&a[o].v.match(/[Hh]/)&&(x=1),x<2&&a[o].v.match(/[Mm]/)&&(x=2),x<3&&a[o].v.match(/[Ss]/)&&(x=3)}switch(x){case 0:break;case 1:u.u>=.5&&(u.u=0,++u.S),u.S>=60&&(u.S=0,++u.M),u.M>=60&&(u.M=0,++u.H);break;case 2:u.u>=.5&&(u.u=0,++u.S),u.S>=60&&(u.S=0,++u.M);break}var y="",N;for(o=0;o<a.length;++o)switch(a[o].t){case"t":case"T":case" ":case"D":break;case"X":a[o].v="",a[o].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":a[o].v=zxt(a[o].t.charCodeAt(0),a[o].v,u,v),a[o].t="t";break;case"n":case"?":for(N=o+1;a[N]!=null&&((l=a[N].t)==="?"||l==="D"||(l===" "||l==="t")&&a[N+1]!=null&&(a[N+1].t==="?"||a[N+1].t==="t"&&a[N+1].v==="/")||a[o].t==="("&&(l===" "||l==="n"||l===")")||l==="t"&&(a[N].v==="/"||a[N].v===" "&&a[N+1]!=null&&a[N+1].t=="?"));)a[o].v+=a[N].v,a[N]={v:"",t:";"},++N;y+=a[o].v,o=N-1;break;case"G":a[o].t="t",a[o].v=_g(t,r);break}var _="",j,S;if(y.length>0){y.charCodeAt(0)==40?(j=t<0&&y.charCodeAt(0)===45?-t:t,S=rh("n",y,j)):(j=t<0&&n>1?-t:t,S=rh("n",y,j),j<0&&a[0]&&a[0].t=="t"&&(S=S.substr(1),a[0].v="-"+a[0].v)),N=S.length-1;var I=a.length;for(o=0;o<a.length;++o)if(a[o]!=null&&a[o].t!="t"&&a[o].v.indexOf(".")>-1){I=o;break}var P=a.length;if(I===a.length&&S.indexOf("E")===-1){for(o=a.length-1;o>=0;--o)a[o]==null||"n?".indexOf(a[o].t)===-1||(N>=a[o].v.length-1?(N-=a[o].v.length,a[o].v=S.substr(N+1,a[o].v.length)):N<0?a[o].v="":(a[o].v=S.substr(0,N+1),N=-1),a[o].t="t",P=o);N>=0&&P<a.length&&(a[P].v=S.substr(0,N+1)+a[P].v)}else if(I!==a.length&&S.indexOf("E")===-1){for(N=S.indexOf(".")-1,o=I;o>=0;--o)if(!(a[o]==null||"n?".indexOf(a[o].t)===-1)){for(d=a[o].v.indexOf(".")>-1&&o===I?a[o].v.indexOf(".")-1:a[o].v.length-1,_=a[o].v.substr(d+1);d>=0;--d)N>=0&&(a[o].v.charAt(d)==="0"||a[o].v.charAt(d)==="#")&&(_=S.charAt(N--)+_);a[o].v=_,a[o].t="t",P=o}for(N>=0&&P<a.length&&(a[P].v=S.substr(0,N+1)+a[P].v),N=S.indexOf(".")+1,o=I;o<a.length;++o)if(!(a[o]==null||"n?(".indexOf(a[o].t)===-1&&o!==I)){for(d=a[o].v.indexOf(".")>-1&&o===I?a[o].v.indexOf(".")+1:0,_=a[o].v.substr(0,d);d<a[o].v.length;++d)N<S.length&&(_+=S.charAt(N++));a[o].v=_,a[o].t="t",P=o}}}for(o=0;o<a.length;++o)a[o]!=null&&"n?".indexOf(a[o].t)>-1&&(j=n>1&&t<0&&o>0&&a[o-1].v==="-"?-t:t,a[o].v=rh(a[o].t,a[o].v,j),a[o].t="t");var F="";for(o=0;o!==a.length;++o)a[o]!=null&&(F+=a[o].v);return F}var MK=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function $K(e,t){if(t==null)return!1;var r=parseFloat(t[2]);switch(t[1]){case"=":if(e==r)return!0;break;case">":if(e>r)return!0;break;case"<":if(e<r)return!0;break;case"<>":if(e!=r)return!0;break;case">=":if(e>=r)return!0;break;case"<=":if(e<=r)return!0;break}return!1}function Jxt(e,t){var r=Xxt(e),n=r.length,a=r[n-1].indexOf("@");if(n<4&&a>-1&&--n,r.length>4)throw new Error("cannot find right format for |"+r.join("|")+"|");if(typeof t!="number")return[4,r.length===4||a>-1?r[r.length-1]:"@"];switch(r.length){case 1:r=a>-1?["General","General","General",r[0]]:[r[0],r[0],r[0],"@"];break;case 2:r=a>-1?[r[0],r[0],r[0],r[1]]:[r[0],r[1],r[0],"@"];break;case 3:r=a>-1?[r[0],r[1],r[0],r[2]]:[r[0],r[1],r[2],"@"];break}var i=t>0?r[0]:t<0?r[1]:r[2];if(r[0].indexOf("[")===-1&&r[1].indexOf("[")===-1)return[n,i];if(r[0].match(/\[[=<>]/)!=null||r[1].match(/\[[=<>]/)!=null){var o=r[0].match(MK),l=r[1].match(MK);return $K(t,o)?[n,r[0]]:$K(t,l)?[n,r[1]]:[n,r[o!=null&&l!=null?2:1]]}return[n,i]}function ic(e,t,r){r==null&&(r={});var n="";switch(typeof e){case"string":e=="m/d/yy"&&r.dateNF?n=r.dateNF:n=e;break;case"number":e==14&&r.dateNF?n=r.dateNF:n=(r.table!=null?r.table:Nr)[e],n==null&&(n=r.table&&r.table[RK[e]]||Nr[RK[e]]),n==null&&(n=Ixt[e]||"General");break}if(Sk(n,0))return _g(t,r);t instanceof Date&&(t=Kfe(t,r.date1904));var a=Jxt(n,t);if(Sk(a[1]))return _g(t,r);if(t===!0)t="TRUE";else if(t===!1)t="FALSE";else if(t===""||t==null)return"";return Zxt(a[1],t,r,a[0])}function Gd(e,t){if(typeof t!="number"){t=+t||-1;for(var r=0;r<392;++r){if(Nr[r]==null){t<0&&(t=r);continue}if(Nr[r]==e){t=r;break}}t<0&&(t=391)}return Nr[t]=e,t}function b_(e){for(var t=0;t!=392;++t)e[t]!==void 0&&Gd(e[t],t)}function D1(){Nr=Dxt()}var BM={format:ic,load:Gd,_table:Nr,load_table:b_,parse_date_code:Dm,is_date:Gg,get_table:function(){return BM._table=Nr}},Qxt={5:'"$"#,##0_);\\("$"#,##0\\)',6:'"$"#,##0_);[Red]\\("$"#,##0\\)',7:'"$"#,##0.00_);\\("$"#,##0.00\\)',8:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',23:"General",24:"General",25:"General",26:"General",27:"m/d/yy",28:"m/d/yy",29:"m/d/yy",30:"m/d/yy",31:"m/d/yy",32:"h:mm:ss",33:"h:mm:ss",34:"h:mm:ss",35:"h:mm:ss",36:"m/d/yy",41:'_(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)',42:'_("$"* #,##0_);_("$"* (#,##0);_("$"* "-"_);_(@_)',43:'_(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)',44:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',50:"m/d/yy",51:"m/d/yy",52:"m/d/yy",53:"m/d/yy",54:"m/d/yy",55:"m/d/yy",56:"m/d/yy",57:"m/d/yy",58:"m/d/yy",59:"0",60:"0.00",61:"#,##0",62:"#,##0.00",63:'"$"#,##0_);\\("$"#,##0\\)',64:'"$"#,##0_);[Red]\\("$"#,##0\\)',65:'"$"#,##0.00_);\\("$"#,##0.00\\)',66:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',67:"0%",68:"0.00%",69:"# ?/?",70:"# ??/??",71:"m/d/yy",72:"m/d/yy",73:"d-mmm-yy",74:"d-mmm",75:"mmm-yy",76:"h:mm",77:"h:mm:ss",78:"m/d/yy h:mm",79:"mm:ss",80:"[h]:mm:ss",81:"mmss.0"},nhe=/[dD]+|[mM]+|[yYeE]+|[Hh]+|[Ss]+/g;function evt(e){var t=typeof e=="number"?Nr[e]:e;return t=t.replace(nhe,"(\\d+)"),new RegExp("^"+t+"$")}function tvt(e,t,r){var n=-1,a=-1,i=-1,o=-1,l=-1,c=-1;(t.match(nhe)||[]).forEach(function(f,m){var h=parseInt(r[m+1],10);switch(f.toLowerCase().charAt(0)){case"y":n=h;break;case"d":i=h;break;case"h":o=h;break;case"s":c=h;break;case"m":o>=0?l=h:a=h;break}}),c>=0&&l==-1&&a>=0&&(l=a,a=-1);var u=(""+(n>=0?n:new Date().getFullYear())).slice(-4)+"-"+("00"+(a>=1?a:1)).slice(-2)+"-"+("00"+(i>=1?i:1)).slice(-2);u.length==7&&(u="0"+u),u.length==8&&(u="20"+u);var d=("00"+(o>=0?o:0)).slice(-2)+":"+("00"+(l>=0?l:0)).slice(-2)+":"+("00"+(c>=0?c:0)).slice(-2);return o==-1&&l==-1&&c==-1?u:n==-1&&a==-1&&i==-1?d:u+"T"+d}var rvt=function(){var e={};e.version="1.2.0";function t(){for(var S=0,I=new Array(256),P=0;P!=256;++P)S=P,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,S=S&1?-306674912^S>>>1:S>>>1,I[P]=S;return typeof Int32Array<"u"?new Int32Array(I):I}var r=t();function n(S){var I=0,P=0,F=0,T=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(F=0;F!=256;++F)T[F]=S[F];for(F=0;F!=256;++F)for(P=S[F],I=256+F;I<4096;I+=256)P=T[I]=P>>>8^S[P&255];var k=[];for(F=1;F!=16;++F)k[F-1]=typeof Int32Array<"u"?T.subarray(F*256,F*256+256):T.slice(F*256,F*256+256);return k}var a=n(r),i=a[0],o=a[1],l=a[2],c=a[3],u=a[4],d=a[5],f=a[6],m=a[7],h=a[8],g=a[9],p=a[10],x=a[11],v=a[12],b=a[13],y=a[14];function N(S,I){for(var P=I^-1,F=0,T=S.length;F<T;)P=P>>>8^r[(P^S.charCodeAt(F++))&255];return~P}function _(S,I){for(var P=I^-1,F=S.length-15,T=0;T<F;)P=y[S[T++]^P&255]^b[S[T++]^P>>8&255]^v[S[T++]^P>>16&255]^x[S[T++]^P>>>24]^p[S[T++]]^g[S[T++]]^h[S[T++]]^m[S[T++]]^f[S[T++]]^d[S[T++]]^u[S[T++]]^c[S[T++]]^l[S[T++]]^o[S[T++]]^i[S[T++]]^r[S[T++]];for(F+=15;T<F;)P=P>>>8^r[(P^S[T++])&255];return~P}function j(S,I){for(var P=I^-1,F=0,T=S.length,k=0,V=0;F<T;)k=S.charCodeAt(F++),k<128?P=P>>>8^r[(P^k)&255]:k<2048?(P=P>>>8^r[(P^(192|k>>6&31))&255],P=P>>>8^r[(P^(128|k&63))&255]):k>=55296&&k<57344?(k=(k&1023)+64,V=S.charCodeAt(F++)&1023,P=P>>>8^r[(P^(240|k>>8&7))&255],P=P>>>8^r[(P^(128|k>>2&63))&255],P=P>>>8^r[(P^(128|V>>6&15|(k&3)<<4))&255],P=P>>>8^r[(P^(128|V&63))&255]):(P=P>>>8^r[(P^(224|k>>12&15))&255],P=P>>>8^r[(P^(128|k>>6&63))&255],P=P>>>8^r[(P^(128|k&63))&255]);return~P}return e.table=r,e.bstr=N,e.buf=_,e.str=j,e}(),vr=function(){var t={};t.version="1.2.1";function r(me,Te){for(var Ne=me.split("/"),Ce=Te.split("/"),ue=0,ve=0,$e=Math.min(Ne.length,Ce.length);ue<$e;++ue){if(ve=Ne[ue].length-Ce[ue].length)return ve;if(Ne[ue]!=Ce[ue])return Ne[ue]<Ce[ue]?-1:1}return Ne.length-Ce.length}function n(me){if(me.charAt(me.length-1)=="/")return me.slice(0,-1).indexOf("/")===-1?me:n(me.slice(0,-1));var Te=me.lastIndexOf("/");return Te===-1?me:me.slice(0,Te+1)}function a(me){if(me.charAt(me.length-1)=="/")return a(me.slice(0,-1));var Te=me.lastIndexOf("/");return Te===-1?me:me.slice(Te+1)}function i(me,Te){typeof Te=="string"&&(Te=new Date(Te));var Ne=Te.getHours();Ne=Ne<<6|Te.getMinutes(),Ne=Ne<<5|Te.getSeconds()>>>1,me.write_shift(2,Ne);var Ce=Te.getFullYear()-1980;Ce=Ce<<4|Te.getMonth()+1,Ce=Ce<<5|Te.getDate(),me.write_shift(2,Ce)}function o(me){var Te=me.read_shift(2)&65535,Ne=me.read_shift(2)&65535,Ce=new Date,ue=Ne&31;Ne>>>=5;var ve=Ne&15;Ne>>>=4,Ce.setMilliseconds(0),Ce.setFullYear(Ne+1980),Ce.setMonth(ve-1),Ce.setDate(ue);var $e=Te&31;Te>>>=5;var et=Te&63;return Te>>>=6,Ce.setHours(Te),Ce.setMinutes(et),Ce.setSeconds($e<<1),Ce}function l(me){Ki(me,0);for(var Te={},Ne=0;me.l<=me.length-4;){var Ce=me.read_shift(2),ue=me.read_shift(2),ve=me.l+ue,$e={};switch(Ce){case 21589:Ne=me.read_shift(1),Ne&1&&($e.mtime=me.read_shift(4)),ue>5&&(Ne&2&&($e.atime=me.read_shift(4)),Ne&4&&($e.ctime=me.read_shift(4))),$e.mtime&&($e.mt=new Date($e.mtime*1e3));break}me.l=ve,Te[Ce]=$e}return Te}var c;function u(){return c||(c={})}function d(me,Te){if(me[0]==80&&me[1]==75)return Mt(me,Te);if((me[0]|32)==109&&(me[1]|32)==105)return Ht(me,Te);if(me.length<512)throw new Error("CFB file size "+me.length+" < 512");var Ne=3,Ce=512,ue=0,ve=0,$e=0,et=0,Xe=0,Ze=[],rt=me.slice(0,512);Ki(rt,0);var Nt=f(rt);switch(Ne=Nt[0],Ne){case 3:Ce=512;break;case 4:Ce=4096;break;case 0:if(Nt[1]==0)return Mt(me,Te);default:throw new Error("Major Version: Expected 3 or 4 saw "+Ne)}Ce!==512&&(rt=me.slice(0,Ce),Ki(rt,28));var Rt=me.slice(0,Ce);m(rt,Ne);var Wt=rt.read_shift(4,"i");if(Ne===3&&Wt!==0)throw new Error("# Directory Sectors: Expected 0 saw "+Wt);rt.l+=4,$e=rt.read_shift(4,"i"),rt.l+=4,rt.chk("00100000","Mini Stream Cutoff Size: "),et=rt.read_shift(4,"i"),ue=rt.read_shift(4,"i"),Xe=rt.read_shift(4,"i"),ve=rt.read_shift(4,"i");for(var Tt=-1,Ut=0;Ut<109&&(Tt=rt.read_shift(4,"i"),!(Tt<0));++Ut)Ze[Ut]=Tt;var Or=h(me,Ce);x(Xe,ve,Or,Ce,Ze);var ls=b(Or,$e,Ze,Ce);ls[$e].name="!Directory",ue>0&&et!==V&&(ls[et].name="!MiniFAT"),ls[Ze[0]].name="!FAT",ls.fat_addrs=Ze,ls.ssz=Ce;var yn={},aa=[],ud=[],hu=[];y($e,ls,Or,aa,ue,yn,ud,et),g(ud,hu,aa),aa.shift();var dd={FileIndex:ud,FullPaths:hu};return Te&&Te.raw&&(dd.raw={header:Rt,sectors:Or}),dd}function f(me){if(me[me.l]==80&&me[me.l+1]==75)return[0,0];me.chk(C,"Header Signature: "),me.l+=16;var Te=me.read_shift(2,"u");return[me.read_shift(2,"u"),Te]}function m(me,Te){var Ne=9;switch(me.l+=2,Ne=me.read_shift(2)){case 9:if(Te!=3)throw new Error("Sector Shift: Expected 9 saw "+Ne);break;case 12:if(Te!=4)throw new Error("Sector Shift: Expected 12 saw "+Ne);break;default:throw new Error("Sector Shift: Expected 9 or 12 saw "+Ne)}me.chk("0600","Mini Sector Shift: "),me.chk("000000000000","Reserved: ")}function h(me,Te){for(var Ne=Math.ceil(me.length/Te)-1,Ce=[],ue=1;ue<Ne;++ue)Ce[ue-1]=me.slice(ue*Te,(ue+1)*Te);return Ce[Ne-1]=me.slice(Ne*Te),Ce}function g(me,Te,Ne){for(var Ce=0,ue=0,ve=0,$e=0,et=0,Xe=Ne.length,Ze=[],rt=[];Ce<Xe;++Ce)Ze[Ce]=rt[Ce]=Ce,Te[Ce]=Ne[Ce];for(;et<rt.length;++et)Ce=rt[et],ue=me[Ce].L,ve=me[Ce].R,$e=me[Ce].C,Ze[Ce]===Ce&&(ue!==-1&&Ze[ue]!==ue&&(Ze[Ce]=Ze[ue]),ve!==-1&&Ze[ve]!==ve&&(Ze[Ce]=Ze[ve])),$e!==-1&&(Ze[$e]=Ce),ue!==-1&&Ce!=Ze[Ce]&&(Ze[ue]=Ze[Ce],rt.lastIndexOf(ue)<et&&rt.push(ue)),ve!==-1&&Ce!=Ze[Ce]&&(Ze[ve]=Ze[Ce],rt.lastIndexOf(ve)<et&&rt.push(ve));for(Ce=1;Ce<Xe;++Ce)Ze[Ce]===Ce&&(ve!==-1&&Ze[ve]!==ve?Ze[Ce]=Ze[ve]:ue!==-1&&Ze[ue]!==ue&&(Ze[Ce]=Ze[ue]));for(Ce=1;Ce<Xe;++Ce)if(me[Ce].type!==0){if(et=Ce,et!=Ze[et])do et=Ze[et],Te[Ce]=Te[et]+"/"+Te[Ce];while(et!==0&&Ze[et]!==-1&&et!=Ze[et]);Ze[Ce]=-1}for(Te[0]+="/",Ce=1;Ce<Xe;++Ce)me[Ce].type!==2&&(Te[Ce]+="/")}function p(me,Te,Ne){for(var Ce=me.start,ue=me.size,ve=[],$e=Ce;Ne&&ue>0&&$e>=0;)ve.push(Te.slice($e*k,$e*k+k)),ue-=k,$e=x0(Ne,$e*4);return ve.length===0?lt(0):Ti(ve).slice(0,me.size)}function x(me,Te,Ne,Ce,ue){var ve=V;if(me===V){if(Te!==0)throw new Error("DIFAT chain shorter than expected")}else if(me!==-1){var $e=Ne[me],et=(Ce>>>2)-1;if(!$e)return;for(var Xe=0;Xe<et&&(ve=x0($e,Xe*4))!==V;++Xe)ue.push(ve);x(x0($e,Ce-4),Te-1,Ne,Ce,ue)}}function v(me,Te,Ne,Ce,ue){var ve=[],$e=[];ue||(ue=[]);var et=Ce-1,Xe=0,Ze=0;for(Xe=Te;Xe>=0;){ue[Xe]=!0,ve[ve.length]=Xe,$e.push(me[Xe]);var rt=Ne[Math.floor(Xe*4/Ce)];if(Ze=Xe*4&et,Ce<4+Ze)throw new Error("FAT boundary crossed: "+Xe+" 4 "+Ce);if(!me[rt])break;Xe=x0(me[rt],Ze)}return{nodes:ve,data:ZK([$e])}}function b(me,Te,Ne,Ce){var ue=me.length,ve=[],$e=[],et=[],Xe=[],Ze=Ce-1,rt=0,Nt=0,Rt=0,Wt=0;for(rt=0;rt<ue;++rt)if(et=[],Rt=rt+Te,Rt>=ue&&(Rt-=ue),!$e[Rt]){Xe=[];var Tt=[];for(Nt=Rt;Nt>=0;){Tt[Nt]=!0,$e[Nt]=!0,et[et.length]=Nt,Xe.push(me[Nt]);var Ut=Ne[Math.floor(Nt*4/Ce)];if(Wt=Nt*4&Ze,Ce<4+Wt)throw new Error("FAT boundary crossed: "+Nt+" 4 "+Ce);if(!me[Ut]||(Nt=x0(me[Ut],Wt),Tt[Nt]))break}ve[Rt]={nodes:et,data:ZK([Xe])}}return ve}function y(me,Te,Ne,Ce,ue,ve,$e,et){for(var Xe=0,Ze=Ce.length?2:0,rt=Te[me].data,Nt=0,Rt=0,Wt;Nt<rt.length;Nt+=128){var Tt=rt.slice(Nt,Nt+128);Ki(Tt,64),Rt=Tt.read_shift(2),Wt=cA(Tt,0,Rt-Ze),Ce.push(Wt);var Ut={name:Wt,type:Tt.read_shift(1),color:Tt.read_shift(1),L:Tt.read_shift(4,"i"),R:Tt.read_shift(4,"i"),C:Tt.read_shift(4,"i"),clsid:Tt.read_shift(16),state:Tt.read_shift(4,"i"),start:0,size:0},Or=Tt.read_shift(2)+Tt.read_shift(2)+Tt.read_shift(2)+Tt.read_shift(2);Or!==0&&(Ut.ct=N(Tt,Tt.l-8));var ls=Tt.read_shift(2)+Tt.read_shift(2)+Tt.read_shift(2)+Tt.read_shift(2);ls!==0&&(Ut.mt=N(Tt,Tt.l-8)),Ut.start=Tt.read_shift(4,"i"),Ut.size=Tt.read_shift(4,"i"),Ut.size<0&&Ut.start<0&&(Ut.size=Ut.type=0,Ut.start=V,Ut.name=""),Ut.type===5?(Xe=Ut.start,ue>0&&Xe!==V&&(Te[Xe].name="!StreamData")):Ut.size>=4096?(Ut.storage="fat",Te[Ut.start]===void 0&&(Te[Ut.start]=v(Ne,Ut.start,Te.fat_addrs,Te.ssz)),Te[Ut.start].name=Ut.name,Ut.content=Te[Ut.start].data.slice(0,Ut.size)):(Ut.storage="minifat",Ut.size<0?Ut.size=0:Xe!==V&&Ut.start!==V&&Te[Xe]&&(Ut.content=p(Ut,Te[Xe].data,(Te[et]||{}).data))),Ut.content&&Ki(Ut.content,0),ve[Wt]=Ut,$e.push(Ut)}}function N(me,Te){return new Date((Ei(me,Te+4)/1e7*Math.pow(2,32)+Ei(me,Te)/1e7-11644473600)*1e3)}function _(me,Te){return u(),d(c.readFileSync(me),Te)}function j(me,Te){var Ne=Te&&Te.type;switch(Ne||fn&&Buffer.isBuffer(me)&&(Ne="buffer"),Ne||"base64"){case"file":return _(me,Te);case"base64":return d(Wl(ac(me)),Te);case"binary":return d(Wl(me),Te)}return d(me,Te)}function S(me,Te){var Ne=Te||{},Ce=Ne.root||"Root Entry";if(me.FullPaths||(me.FullPaths=[]),me.FileIndex||(me.FileIndex=[]),me.FullPaths.length!==me.FileIndex.length)throw new Error("inconsistent CFB structure");me.FullPaths.length===0&&(me.FullPaths[0]=Ce+"/",me.FileIndex[0]={name:Ce,type:5}),Ne.CLSID&&(me.FileIndex[0].clsid=Ne.CLSID),I(me)}function I(me){var Te="Sh33tJ5";if(!vr.find(me,"/"+Te)){var Ne=lt(4);Ne[0]=55,Ne[1]=Ne[3]=50,Ne[2]=54,me.FileIndex.push({name:Te,type:2,content:Ne,size:4,L:69,R:69,C:69}),me.FullPaths.push(me.FullPaths[0]+Te),P(me)}}function P(me,Te){S(me);for(var Ne=!1,Ce=!1,ue=me.FullPaths.length-1;ue>=0;--ue){var ve=me.FileIndex[ue];switch(ve.type){case 0:Ce?Ne=!0:(me.FileIndex.pop(),me.FullPaths.pop());break;case 1:case 2:case 5:Ce=!0,isNaN(ve.R*ve.L*ve.C)&&(Ne=!0),ve.R>-1&&ve.L>-1&&ve.R==ve.L&&(Ne=!0);break;default:Ne=!0;break}}if(!(!Ne&&!Te)){var $e=new Date(1987,1,19),et=0,Xe=Object.create?Object.create(null):{},Ze=[];for(ue=0;ue<me.FullPaths.length;++ue)Xe[me.FullPaths[ue]]=!0,me.FileIndex[ue].type!==0&&Ze.push([me.FullPaths[ue],me.FileIndex[ue]]);for(ue=0;ue<Ze.length;++ue){var rt=n(Ze[ue][0]);Ce=Xe[rt],Ce||(Ze.push([rt,{name:a(rt).replace("/",""),type:1,clsid:H,ct:$e,mt:$e,content:null}]),Xe[rt]=!0)}for(Ze.sort(function(Wt,Tt){return r(Wt[0],Tt[0])}),me.FullPaths=[],me.FileIndex=[],ue=0;ue<Ze.length;++ue)me.FullPaths[ue]=Ze[ue][0],me.FileIndex[ue]=Ze[ue][1];for(ue=0;ue<Ze.length;++ue){var Nt=me.FileIndex[ue],Rt=me.FullPaths[ue];if(Nt.name=a(Rt).replace("/",""),Nt.L=Nt.R=Nt.C=-(Nt.color=1),Nt.size=Nt.content?Nt.content.length:0,Nt.start=0,Nt.clsid=Nt.clsid||H,ue===0)Nt.C=Ze.length>1?1:-1,Nt.size=0,Nt.type=5;else if(Rt.slice(-1)=="/"){for(et=ue+1;et<Ze.length&&n(me.FullPaths[et])!=Rt;++et);for(Nt.C=et>=Ze.length?-1:et,et=ue+1;et<Ze.length&&n(me.FullPaths[et])!=n(Rt);++et);Nt.R=et>=Ze.length?-1:et,Nt.type=1}else n(me.FullPaths[ue+1]||"")==n(Rt)&&(Nt.R=ue+1),Nt.type=2}}}function F(me,Te){var Ne=Te||{};if(Ne.fileType=="mad")return sn(me,Ne);switch(P(me),Ne.fileType){case"zip":return $t(me,Ne)}var Ce=function(Wt){for(var Tt=0,Ut=0,Or=0;Or<Wt.FileIndex.length;++Or){var ls=Wt.FileIndex[Or];if(ls.content){var yn=ls.content.length;yn>0&&(yn<4096?Tt+=yn+63>>6:Ut+=yn+511>>9)}}for(var aa=Wt.FullPaths.length+3>>2,ud=Tt+7>>3,hu=Tt+127>>7,dd=ud+Ut+aa+hu,cc=dd+127>>7,Ah=cc<=109?0:Math.ceil((cc-109)/127);dd+cc+Ah+127>>7>cc;)Ah=++cc<=109?0:Math.ceil((cc-109)/127);var La=[1,Ah,cc,hu,aa,Ut,Tt,0];return Wt.FileIndex[0].size=Tt<<6,La[7]=(Wt.FileIndex[0].start=La[0]+La[1]+La[2]+La[3]+La[4]+La[5])+(La[6]+7>>3),La}(me),ue=lt(Ce[7]<<9),ve=0,$e=0;{for(ve=0;ve<8;++ve)ue.write_shift(1,R[ve]);for(ve=0;ve<8;++ve)ue.write_shift(2,0);for(ue.write_shift(2,62),ue.write_shift(2,3),ue.write_shift(2,65534),ue.write_shift(2,9),ue.write_shift(2,6),ve=0;ve<3;++ve)ue.write_shift(2,0);for(ue.write_shift(4,0),ue.write_shift(4,Ce[2]),ue.write_shift(4,Ce[0]+Ce[1]+Ce[2]+Ce[3]-1),ue.write_shift(4,0),ue.write_shift(4,4096),ue.write_shift(4,Ce[3]?Ce[0]+Ce[1]+Ce[2]-1:V),ue.write_shift(4,Ce[3]),ue.write_shift(-4,Ce[1]?Ce[0]-1:V),ue.write_shift(4,Ce[1]),ve=0;ve<109;++ve)ue.write_shift(-4,ve<Ce[2]?Ce[1]+ve:-1)}if(Ce[1])for($e=0;$e<Ce[1];++$e){for(;ve<236+$e*127;++ve)ue.write_shift(-4,ve<Ce[2]?Ce[1]+ve:-1);ue.write_shift(-4,$e===Ce[1]-1?V:$e+1)}var et=function(Wt){for($e+=Wt;ve<$e-1;++ve)ue.write_shift(-4,ve+1);Wt&&(++ve,ue.write_shift(-4,V))};for($e=ve=0,$e+=Ce[1];ve<$e;++ve)ue.write_shift(-4,q.DIFSECT);for($e+=Ce[2];ve<$e;++ve)ue.write_shift(-4,q.FATSECT);et(Ce[3]),et(Ce[4]);for(var Xe=0,Ze=0,rt=me.FileIndex[0];Xe<me.FileIndex.length;++Xe)rt=me.FileIndex[Xe],rt.content&&(Ze=rt.content.length,!(Ze<4096)&&(rt.start=$e,et(Ze+511>>9)));for(et(Ce[6]+7>>3);ue.l&511;)ue.write_shift(-4,q.ENDOFCHAIN);for($e=ve=0,Xe=0;Xe<me.FileIndex.length;++Xe)rt=me.FileIndex[Xe],rt.content&&(Ze=rt.content.length,!(!Ze||Ze>=4096)&&(rt.start=$e,et(Ze+63>>6)));for(;ue.l&511;)ue.write_shift(-4,q.ENDOFCHAIN);for(ve=0;ve<Ce[4]<<2;++ve){var Nt=me.FullPaths[ve];if(!Nt||Nt.length===0){for(Xe=0;Xe<17;++Xe)ue.write_shift(4,0);for(Xe=0;Xe<3;++Xe)ue.write_shift(4,-1);for(Xe=0;Xe<12;++Xe)ue.write_shift(4,0);continue}rt=me.FileIndex[ve],ve===0&&(rt.start=rt.size?rt.start-1:V);var Rt=ve===0&&Ne.root||rt.name;if(Ze=2*(Rt.length+1),ue.write_shift(64,Rt,"utf16le"),ue.write_shift(2,Ze),ue.write_shift(1,rt.type),ue.write_shift(1,rt.color),ue.write_shift(-4,rt.L),ue.write_shift(-4,rt.R),ue.write_shift(-4,rt.C),rt.clsid)ue.write_shift(16,rt.clsid,"hex");else for(Xe=0;Xe<4;++Xe)ue.write_shift(4,0);ue.write_shift(4,rt.state||0),ue.write_shift(4,0),ue.write_shift(4,0),ue.write_shift(4,0),ue.write_shift(4,0),ue.write_shift(4,rt.start),ue.write_shift(4,rt.size),ue.write_shift(4,0)}for(ve=1;ve<me.FileIndex.length;++ve)if(rt=me.FileIndex[ve],rt.size>=4096)if(ue.l=rt.start+1<<9,fn&&Buffer.isBuffer(rt.content))rt.content.copy(ue,ue.l,0,rt.size),ue.l+=rt.size+511&-512;else{for(Xe=0;Xe<rt.size;++Xe)ue.write_shift(1,rt.content[Xe]);for(;Xe&511;++Xe)ue.write_shift(1,0)}for(ve=1;ve<me.FileIndex.length;++ve)if(rt=me.FileIndex[ve],rt.size>0&&rt.size<4096)if(fn&&Buffer.isBuffer(rt.content))rt.content.copy(ue,ue.l,0,rt.size),ue.l+=rt.size+63&-64;else{for(Xe=0;Xe<rt.size;++Xe)ue.write_shift(1,rt.content[Xe]);for(;Xe&63;++Xe)ue.write_shift(1,0)}if(fn)ue.l=ue.length;else for(;ue.l<ue.length;)ue.write_shift(1,0);return ue}function T(me,Te){var Ne=me.FullPaths.map(function(Xe){return Xe.toUpperCase()}),Ce=Ne.map(function(Xe){var Ze=Xe.split("/");return Ze[Ze.length-(Xe.slice(-1)=="/"?2:1)]}),ue=!1;Te.charCodeAt(0)===47?(ue=!0,Te=Ne[0].slice(0,-1)+Te):ue=Te.indexOf("/")!==-1;var ve=Te.toUpperCase(),$e=ue===!0?Ne.indexOf(ve):Ce.indexOf(ve);if($e!==-1)return me.FileIndex[$e];var et=!ve.match(Zb);for(ve=ve.replace(go,""),et&&(ve=ve.replace(Zb,"!")),$e=0;$e<Ne.length;++$e)if((et?Ne[$e].replace(Zb,"!"):Ne[$e]).replace(go,"")==ve||(et?Ce[$e].replace(Zb,"!"):Ce[$e]).replace(go,"")==ve)return me.FileIndex[$e];return null}var k=64,V=-2,C="d0cf11e0a1b11ae1",R=[208,207,17,224,161,177,26,225],H="00000000000000000000000000000000",q={MAXREGSECT:-6,DIFSECT:-4,FATSECT:-3,ENDOFCHAIN:V,FREESECT:-1,HEADER_SIGNATURE:C,HEADER_MINOR_VERSION:"3e00",MAXREGSID:-6,NOSTREAM:-1,HEADER_CLSID:H,EntryTypes:["unknown","storage","stream","lockbytes","property","root"]};function L(me,Te,Ne){u();var Ce=F(me,Ne);c.writeFileSync(Te,Ce)}function M(me){for(var Te=new Array(me.length),Ne=0;Ne<me.length;++Ne)Te[Ne]=String.fromCharCode(me[Ne]);return Te.join("")}function z(me,Te){var Ne=F(me,Te);switch(Te&&Te.type||"buffer"){case"file":return u(),c.writeFileSync(Te.filename,Ne),Ne;case"binary":return typeof Ne=="string"?Ne:M(Ne);case"base64":return dj(typeof Ne=="string"?Ne:M(Ne));case"buffer":if(fn)return Buffer.isBuffer(Ne)?Ne:kh(Ne);case"array":return typeof Ne=="string"?Wl(Ne):Ne}return Ne}var K;function E(me){try{var Te=me.InflateRaw,Ne=new Te;if(Ne._processChunk(new Uint8Array([3,0]),Ne._finishFlushFlag),Ne.bytesRead)K=me;else throw new Error("zlib does not expose bytesRead")}catch(Ce){console.error("cannot use native zlib: "+(Ce.message||Ce))}}function A(me,Te){if(!K)return it(me,Te);var Ne=K.InflateRaw,Ce=new Ne,ue=Ce._processChunk(me.slice(me.l),Ce._finishFlushFlag);return me.l+=Ce.bytesRead,ue}function O(me){return K?K.deflateRawSync(me):He(me)}var U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Y=[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],J=[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];function se(me){var Te=(me<<1|me<<11)&139536|(me<<5|me<<15)&558144;return(Te>>16|Te>>8|Te)&255}for(var ee=typeof Uint8Array<"u",ie=ee?new Uint8Array(256):[],Ee=0;Ee<256;++Ee)ie[Ee]=se(Ee);function te(me,Te){var Ne=ie[me&255];return Te<=8?Ne>>>8-Te:(Ne=Ne<<8|ie[me>>8&255],Te<=16?Ne>>>16-Te:(Ne=Ne<<8|ie[me>>16&255],Ne>>>24-Te))}function Ue(me,Te){var Ne=Te&7,Ce=Te>>>3;return(me[Ce]|(Ne<=6?0:me[Ce+1]<<8))>>>Ne&3}function W(me,Te){var Ne=Te&7,Ce=Te>>>3;return(me[Ce]|(Ne<=5?0:me[Ce+1]<<8))>>>Ne&7}function Z(me,Te){var Ne=Te&7,Ce=Te>>>3;return(me[Ce]|(Ne<=4?0:me[Ce+1]<<8))>>>Ne&15}function le(me,Te){var Ne=Te&7,Ce=Te>>>3;return(me[Ce]|(Ne<=3?0:me[Ce+1]<<8))>>>Ne&31}function re(me,Te){var Ne=Te&7,Ce=Te>>>3;return(me[Ce]|(Ne<=1?0:me[Ce+1]<<8))>>>Ne&127}function oe(me,Te,Ne){var Ce=Te&7,ue=Te>>>3,ve=(1<<Ne)-1,$e=me[ue]>>>Ce;return Ne<8-Ce||($e|=me[ue+1]<<8-Ce,Ne<16-Ce)||($e|=me[ue+2]<<16-Ce,Ne<24-Ce)||($e|=me[ue+3]<<24-Ce),$e&ve}function fe(me,Te,Ne){var Ce=Te&7,ue=Te>>>3;return Ce<=5?me[ue]|=(Ne&7)<<Ce:(me[ue]|=Ne<<Ce&255,me[ue+1]=(Ne&7)>>8-Ce),Te+3}function Fe(me,Te,Ne){var Ce=Te&7,ue=Te>>>3;return Ne=(Ne&1)<<Ce,me[ue]|=Ne,Te+1}function ge(me,Te,Ne){var Ce=Te&7,ue=Te>>>3;return Ne<<=Ce,me[ue]|=Ne&255,Ne>>>=8,me[ue+1]=Ne,Te+8}function pe(me,Te,Ne){var Ce=Te&7,ue=Te>>>3;return Ne<<=Ce,me[ue]|=Ne&255,Ne>>>=8,me[ue+1]=Ne&255,me[ue+2]=Ne>>>8,Te+16}function Ie(me,Te){var Ne=me.length,Ce=2*Ne>Te?2*Ne:Te+5,ue=0;if(Ne>=Te)return me;if(fn){var ve=OK(Ce);if(me.copy)me.copy(ve);else for(;ue<me.length;++ue)ve[ue]=me[ue];return ve}else if(ee){var $e=new Uint8Array(Ce);if($e.set)$e.set(me);else for(;ue<Ne;++ue)$e[ue]=me[ue];return $e}return me.length=Ce,me}function Ge(me){for(var Te=new Array(me),Ne=0;Ne<me;++Ne)Te[Ne]=0;return Te}function we(me,Te,Ne){var Ce=1,ue=0,ve=0,$e=0,et=0,Xe=me.length,Ze=ee?new Uint16Array(32):Ge(32);for(ve=0;ve<32;++ve)Ze[ve]=0;for(ve=Xe;ve<Ne;++ve)me[ve]=0;Xe=me.length;var rt=ee?new Uint16Array(Xe):Ge(Xe);for(ve=0;ve<Xe;++ve)Ze[ue=me[ve]]++,Ce<ue&&(Ce=ue),rt[ve]=0;for(Ze[0]=0,ve=1;ve<=Ce;++ve)Ze[ve+16]=et=et+Ze[ve-1]<<1;for(ve=0;ve<Xe;++ve)et=me[ve],et!=0&&(rt[ve]=Ze[et+16]++);var Nt=0;for(ve=0;ve<Xe;++ve)if(Nt=me[ve],Nt!=0)for(et=te(rt[ve],Ce)>>Ce-Nt,$e=(1<<Ce+4-Nt)-1;$e>=0;--$e)Te[et|$e<<Nt]=Nt&15|ve<<4;return Ce}var _e=ee?new Uint16Array(512):Ge(512),qe=ee?new Uint16Array(32):Ge(32);if(!ee){for(var Re=0;Re<512;++Re)_e[Re]=0;for(Re=0;Re<32;++Re)qe[Re]=0}(function(){for(var me=[],Te=0;Te<32;Te++)me.push(5);we(me,qe,32);var Ne=[];for(Te=0;Te<=143;Te++)Ne.push(8);for(;Te<=255;Te++)Ne.push(9);for(;Te<=279;Te++)Ne.push(7);for(;Te<=287;Te++)Ne.push(8);we(Ne,_e,288)})();var Me=function(){for(var Te=ee?new Uint8Array(32768):[],Ne=0,Ce=0;Ne<J.length-1;++Ne)for(;Ce<J[Ne+1];++Ce)Te[Ce]=Ne;for(;Ce<32768;++Ce)Te[Ce]=29;var ue=ee?new Uint8Array(259):[];for(Ne=0,Ce=0;Ne<Y.length-1;++Ne)for(;Ce<Y[Ne+1];++Ce)ue[Ce]=Ne;function ve(et,Xe){for(var Ze=0;Ze<et.length;){var rt=Math.min(65535,et.length-Ze),Nt=Ze+rt==et.length;for(Xe.write_shift(1,+Nt),Xe.write_shift(2,rt),Xe.write_shift(2,~rt&65535);rt-- >0;)Xe[Xe.l++]=et[Ze++]}return Xe.l}function $e(et,Xe){for(var Ze=0,rt=0,Nt=ee?new Uint16Array(32768):[];rt<et.length;){var Rt=Math.min(65535,et.length-rt);if(Rt<10){for(Ze=fe(Xe,Ze,+(rt+Rt==et.length)),Ze&7&&(Ze+=8-(Ze&7)),Xe.l=Ze/8|0,Xe.write_shift(2,Rt),Xe.write_shift(2,~Rt&65535);Rt-- >0;)Xe[Xe.l++]=et[rt++];Ze=Xe.l*8;continue}Ze=fe(Xe,Ze,+(rt+Rt==et.length)+2);for(var Wt=0;Rt-- >0;){var Tt=et[rt];Wt=(Wt<<5^Tt)&32767;var Ut=-1,Or=0;if((Ut=Nt[Wt])&&(Ut|=rt&-32768,Ut>rt&&(Ut-=32768),Ut<rt))for(;et[Ut+Or]==et[rt+Or]&&Or<250;)++Or;if(Or>2){Tt=ue[Or],Tt<=22?Ze=ge(Xe,Ze,ie[Tt+1]>>1)-1:(ge(Xe,Ze,3),Ze+=5,ge(Xe,Ze,ie[Tt-23]>>5),Ze+=3);var ls=Tt<8?0:Tt-4>>2;ls>0&&(pe(Xe,Ze,Or-Y[Tt]),Ze+=ls),Tt=Te[rt-Ut],Ze=ge(Xe,Ze,ie[Tt]>>3),Ze-=3;var yn=Tt<4?0:Tt-2>>1;yn>0&&(pe(Xe,Ze,rt-Ut-J[Tt]),Ze+=yn);for(var aa=0;aa<Or;++aa)Nt[Wt]=rt&32767,Wt=(Wt<<5^et[rt])&32767,++rt;Rt-=Or-1}else Tt<=143?Tt=Tt+48:Ze=Fe(Xe,Ze,1),Ze=ge(Xe,Ze,ie[Tt]),Nt[Wt]=rt&32767,++rt}Ze=ge(Xe,Ze,0)-1}return Xe.l=(Ze+7)/8|0,Xe.l}return function(Xe,Ze){return Xe.length<8?ve(Xe,Ze):$e(Xe,Ze)}}();function He(me){var Te=lt(50+Math.floor(me.length*1.1)),Ne=Me(me,Te);return Te.slice(0,Ne)}var st=ee?new Uint16Array(32768):Ge(32768),Zt=ee?new Uint16Array(32768):Ge(32768),_t=ee?new Uint16Array(128):Ge(128),Vt=1,Jt=1;function Qt(me,Te){var Ne=le(me,Te)+257;Te+=5;var Ce=le(me,Te)+1;Te+=5;var ue=Z(me,Te)+4;Te+=4;for(var ve=0,$e=ee?new Uint8Array(19):Ge(19),et=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Xe=1,Ze=ee?new Uint8Array(8):Ge(8),rt=ee?new Uint8Array(8):Ge(8),Nt=$e.length,Rt=0;Rt<ue;++Rt)$e[U[Rt]]=ve=W(me,Te),Xe<ve&&(Xe=ve),Ze[ve]++,Te+=3;var Wt=0;for(Ze[0]=0,Rt=1;Rt<=Xe;++Rt)rt[Rt]=Wt=Wt+Ze[Rt-1]<<1;for(Rt=0;Rt<Nt;++Rt)(Wt=$e[Rt])!=0&&(et[Rt]=rt[Wt]++);var Tt=0;for(Rt=0;Rt<Nt;++Rt)if(Tt=$e[Rt],Tt!=0){Wt=ie[et[Rt]]>>8-Tt;for(var Ut=(1<<7-Tt)-1;Ut>=0;--Ut)_t[Wt|Ut<<Tt]=Tt&7|Rt<<3}var Or=[];for(Xe=1;Or.length<Ne+Ce;)switch(Wt=_t[re(me,Te)],Te+=Wt&7,Wt>>>=3){case 16:for(ve=3+Ue(me,Te),Te+=2,Wt=Or[Or.length-1];ve-- >0;)Or.push(Wt);break;case 17:for(ve=3+W(me,Te),Te+=3;ve-- >0;)Or.push(0);break;case 18:for(ve=11+re(me,Te),Te+=7;ve-- >0;)Or.push(0);break;default:Or.push(Wt),Xe<Wt&&(Xe=Wt);break}var ls=Or.slice(0,Ne),yn=Or.slice(Ne);for(Rt=Ne;Rt<286;++Rt)ls[Rt]=0;for(Rt=Ce;Rt<30;++Rt)yn[Rt]=0;return Vt=we(ls,st,286),Jt=we(yn,Zt,30),Te}function qt(me,Te){if(me[0]==3&&!(me[1]&3))return[fp(Te),2];for(var Ne=0,Ce=0,ue=OK(Te||1<<18),ve=0,$e=ue.length>>>0,et=0,Xe=0;!(Ce&1);){if(Ce=W(me,Ne),Ne+=3,Ce>>>1)Ce>>1==1?(et=9,Xe=5):(Ne=Qt(me,Ne),et=Vt,Xe=Jt);else{Ne&7&&(Ne+=8-(Ne&7));var Ze=me[Ne>>>3]|me[(Ne>>>3)+1]<<8;if(Ne+=32,Ze>0)for(!Te&&$e<ve+Ze&&(ue=Ie(ue,ve+Ze),$e=ue.length);Ze-- >0;)ue[ve++]=me[Ne>>>3],Ne+=8;continue}for(;;){!Te&&$e<ve+32767&&(ue=Ie(ue,ve+32767),$e=ue.length);var rt=oe(me,Ne,et),Nt=Ce>>>1==1?_e[rt]:st[rt];if(Ne+=Nt&15,Nt>>>=4,!(Nt>>>8&255))ue[ve++]=Nt;else{if(Nt==256)break;Nt-=257;var Rt=Nt<8?0:Nt-4>>2;Rt>5&&(Rt=0);var Wt=ve+Y[Nt];Rt>0&&(Wt+=oe(me,Ne,Rt),Ne+=Rt),rt=oe(me,Ne,Xe),Nt=Ce>>>1==1?qe[rt]:Zt[rt],Ne+=Nt&15,Nt>>>=4;var Tt=Nt<4?0:Nt-2>>1,Ut=J[Nt];for(Tt>0&&(Ut+=oe(me,Ne,Tt),Ne+=Tt),!Te&&$e<Wt&&(ue=Ie(ue,Wt+100),$e=ue.length);ve<Wt;)ue[ve]=ue[ve-Ut],++ve}}}return Te?[ue,Ne+7>>>3]:[ue.slice(0,ve),Ne+7>>>3]}function it(me,Te){var Ne=me.slice(me.l||0),Ce=qt(Ne,Te);return me.l+=Ce[1],Ce[0]}function It(me,Te){if(me)typeof console<"u"&&console.error(Te);else throw new Error(Te)}function Mt(me,Te){var Ne=me;Ki(Ne,0);var Ce=[],ue=[],ve={FileIndex:Ce,FullPaths:ue};S(ve,{root:Te.root});for(var $e=Ne.length-4;(Ne[$e]!=80||Ne[$e+1]!=75||Ne[$e+2]!=5||Ne[$e+3]!=6)&&$e>=0;)--$e;Ne.l=$e+4,Ne.l+=4;var et=Ne.read_shift(2);Ne.l+=6;var Xe=Ne.read_shift(4);for(Ne.l=Xe,$e=0;$e<et;++$e){Ne.l+=20;var Ze=Ne.read_shift(4),rt=Ne.read_shift(4),Nt=Ne.read_shift(2),Rt=Ne.read_shift(2),Wt=Ne.read_shift(2);Ne.l+=8;var Tt=Ne.read_shift(4),Ut=l(Ne.slice(Ne.l+Nt,Ne.l+Nt+Rt));Ne.l+=Nt+Rt+Wt;var Or=Ne.l;Ne.l=Tt+4,wr(Ne,Ze,rt,ve,Ut),Ne.l=Or}return ve}function wr(me,Te,Ne,Ce,ue){me.l+=2;var ve=me.read_shift(2),$e=me.read_shift(2),et=o(me);if(ve&8257)throw new Error("Unsupported ZIP encryption");for(var Xe=me.read_shift(4),Ze=me.read_shift(4),rt=me.read_shift(4),Nt=me.read_shift(2),Rt=me.read_shift(2),Wt="",Tt=0;Tt<Nt;++Tt)Wt+=String.fromCharCode(me[me.l++]);if(Rt){var Ut=l(me.slice(me.l,me.l+Rt));(Ut[21589]||{}).mt&&(et=Ut[21589].mt),((ue||{})[21589]||{}).mt&&(et=ue[21589].mt)}me.l+=Rt;var Or=me.slice(me.l,me.l+Ze);switch($e){case 8:Or=A(me,rt);break;case 0:break;default:throw new Error("Unsupported ZIP Compression method "+$e)}var ls=!1;ve&8&&(Xe=me.read_shift(4),Xe==134695760&&(Xe=me.read_shift(4),ls=!0),Ze=me.read_shift(4),rt=me.read_shift(4)),Ze!=Te&&It(ls,"Bad compressed size: "+Te+" != "+Ze),rt!=Ne&&It(ls,"Bad uncompressed size: "+Ne+" != "+rt),tn(Ce,Wt,Or,{unsafe:!0,mt:et})}function $t(me,Te){var Ne=Te||{},Ce=[],ue=[],ve=lt(1),$e=Ne.compression?8:0,et=0,Xe=0,Ze=0,rt=0,Nt=0,Rt=me.FullPaths[0],Wt=Rt,Tt=me.FileIndex[0],Ut=[],Or=0;for(Xe=1;Xe<me.FullPaths.length;++Xe)if(Wt=me.FullPaths[Xe].slice(Rt.length),Tt=me.FileIndex[Xe],!(!Tt.size||!Tt.content||Wt=="Sh33tJ5")){var ls=rt,yn=lt(Wt.length);for(Ze=0;Ze<Wt.length;++Ze)yn.write_shift(1,Wt.charCodeAt(Ze)&127);yn=yn.slice(0,yn.l),Ut[Nt]=rvt.buf(Tt.content,0);var aa=Tt.content;$e==8&&(aa=O(aa)),ve=lt(30),ve.write_shift(4,67324752),ve.write_shift(2,20),ve.write_shift(2,et),ve.write_shift(2,$e),Tt.mt?i(ve,Tt.mt):ve.write_shift(4,0),ve.write_shift(-4,Ut[Nt]),ve.write_shift(4,aa.length),ve.write_shift(4,Tt.content.length),ve.write_shift(2,yn.length),ve.write_shift(2,0),rt+=ve.length,Ce.push(ve),rt+=yn.length,Ce.push(yn),rt+=aa.length,Ce.push(aa),ve=lt(46),ve.write_shift(4,33639248),ve.write_shift(2,0),ve.write_shift(2,20),ve.write_shift(2,et),ve.write_shift(2,$e),ve.write_shift(4,0),ve.write_shift(-4,Ut[Nt]),ve.write_shift(4,aa.length),ve.write_shift(4,Tt.content.length),ve.write_shift(2,yn.length),ve.write_shift(2,0),ve.write_shift(2,0),ve.write_shift(2,0),ve.write_shift(2,0),ve.write_shift(4,0),ve.write_shift(4,ls),Or+=ve.l,ue.push(ve),Or+=yn.length,ue.push(yn),++Nt}return ve=lt(22),ve.write_shift(4,101010256),ve.write_shift(2,0),ve.write_shift(2,0),ve.write_shift(2,Nt),ve.write_shift(2,Nt),ve.write_shift(4,Or),ve.write_shift(4,rt),ve.write_shift(2,0),Ti([Ti(Ce),Ti(ue),ve])}var kt={htm:"text/html",xml:"text/xml",gif:"image/gif",jpg:"image/jpeg",png:"image/png",mso:"application/x-mso",thmx:"application/vnd.ms-officetheme",sh33tj5:"application/octet-stream"};function dr(me,Te){if(me.ctype)return me.ctype;var Ne=me.name||"",Ce=Ne.match(/\.([^\.]+)$/);return Ce&&kt[Ce[1]]||Te&&(Ce=(Ne=Te).match(/[\.\\]([^\.\\])+$/),Ce&&kt[Ce[1]])?kt[Ce[1]]:"application/octet-stream"}function Kt(me){for(var Te=dj(me),Ne=[],Ce=0;Ce<Te.length;Ce+=76)Ne.push(Te.slice(Ce,Ce+76));return Ne.join(`\r
`)+`\r
`}function ir(me){var Te=me.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF=]/g,function(Ze){var rt=Ze.charCodeAt(0).toString(16).toUpperCase();return"="+(rt.length==1?"0"+rt:rt)});Te=Te.replace(/ $/mg,"=20").replace(/\t$/mg,"=09"),Te.charAt(0)==`
`&&(Te="=0D"+Te.slice(1)),Te=Te.replace(/\r(?!\n)/mg,"=0D").replace(/\n\n/mg,`
=0A`).replace(/([^\r\n])\n/mg,"$1=0A");for(var Ne=[],Ce=Te.split(`\r
`),ue=0;ue<Ce.length;++ue){var ve=Ce[ue];if(ve.length==0){Ne.push("");continue}for(var $e=0;$e<ve.length;){var et=76,Xe=ve.slice($e,$e+et);Xe.charAt(et-1)=="="?et--:Xe.charAt(et-2)=="="?et-=2:Xe.charAt(et-3)=="="&&(et-=3),Xe=ve.slice($e,$e+et),$e+=et,$e<ve.length&&(Xe+="="),Ne.push(Xe)}}return Ne.join(`\r
`)}function jr(me){for(var Te=[],Ne=0;Ne<me.length;++Ne){for(var Ce=me[Ne];Ne<=me.length&&Ce.charAt(Ce.length-1)=="=";)Ce=Ce.slice(0,Ce.length-1)+me[++Ne];Te.push(Ce)}for(var ue=0;ue<Te.length;++ue)Te[ue]=Te[ue].replace(/[=][0-9A-Fa-f]{2}/g,function(ve){return String.fromCharCode(parseInt(ve.slice(1),16))});return Wl(Te.join(`\r
`))}function mn(me,Te,Ne){for(var Ce="",ue="",ve="",$e,et=0;et<10;++et){var Xe=Te[et];if(!Xe||Xe.match(/^\s*$/))break;var Ze=Xe.match(/^(.*?):\s*([^\s].*)$/);if(Ze)switch(Ze[1].toLowerCase()){case"content-location":Ce=Ze[2].trim();break;case"content-type":ve=Ze[2].trim();break;case"content-transfer-encoding":ue=Ze[2].trim();break}}switch(++et,ue.toLowerCase()){case"base64":$e=Wl(ac(Te.slice(et).join("")));break;case"quoted-printable":$e=jr(Te.slice(et));break;default:throw new Error("Unsupported Content-Transfer-Encoding "+ue)}var rt=tn(me,Ce.slice(Ne.length),$e,{unsafe:!0});ve&&(rt.ctype=ve)}function Ht(me,Te){if(M(me.slice(0,13)).toLowerCase()!="mime-version:")throw new Error("Unsupported MAD header");var Ne=Te&&Te.root||"",Ce=(fn&&Buffer.isBuffer(me)?me.toString("binary"):M(me)).split(`\r
`),ue=0,ve="";for(ue=0;ue<Ce.length;++ue)if(ve=Ce[ue],!!/^Content-Location:/i.test(ve)&&(ve=ve.slice(ve.indexOf("file")),Ne||(Ne=ve.slice(0,ve.lastIndexOf("/")+1)),ve.slice(0,Ne.length)!=Ne))for(;Ne.length>0&&(Ne=Ne.slice(0,Ne.length-1),Ne=Ne.slice(0,Ne.lastIndexOf("/")+1),ve.slice(0,Ne.length)!=Ne););var $e=(Ce[1]||"").match(/boundary="(.*?)"/);if(!$e)throw new Error("MAD cannot find boundary");var et="--"+($e[1]||""),Xe=[],Ze=[],rt={FileIndex:Xe,FullPaths:Ze};S(rt);var Nt,Rt=0;for(ue=0;ue<Ce.length;++ue){var Wt=Ce[ue];Wt!==et&&Wt!==et+"--"||(Rt++&&mn(rt,Ce.slice(Nt,ue),Ne),Nt=ue)}return rt}function sn(me,Te){var Ne=Te||{},Ce=Ne.boundary||"SheetJS";Ce="------="+Ce;for(var ue=["MIME-Version: 1.0",'Content-Type: multipart/related; boundary="'+Ce.slice(2)+'"',"","",""],ve=me.FullPaths[0],$e=ve,et=me.FileIndex[0],Xe=1;Xe<me.FullPaths.length;++Xe)if($e=me.FullPaths[Xe].slice(ve.length),et=me.FileIndex[Xe],!(!et.size||!et.content||$e=="Sh33tJ5")){$e=$e.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7E-\xFF]/g,function(Or){return"_x"+Or.charCodeAt(0).toString(16)+"_"}).replace(/[\u0080-\uFFFF]/g,function(Or){return"_u"+Or.charCodeAt(0).toString(16)+"_"});for(var Ze=et.content,rt=fn&&Buffer.isBuffer(Ze)?Ze.toString("binary"):M(Ze),Nt=0,Rt=Math.min(1024,rt.length),Wt=0,Tt=0;Tt<=Rt;++Tt)(Wt=rt.charCodeAt(Tt))>=32&&Wt<128&&++Nt;var Ut=Nt>=Rt*4/5;ue.push(Ce),ue.push("Content-Location: "+(Ne.root||"file:///C:/SheetJS/")+$e),ue.push("Content-Transfer-Encoding: "+(Ut?"quoted-printable":"base64")),ue.push("Content-Type: "+dr(et,$e)),ue.push(""),ue.push(Ut?ir(rt):Kt(rt))}return ue.push(Ce+`--\r
`),ue.join(`\r
`)}function Bn(me){var Te={};return S(Te,me),Te}function tn(me,Te,Ne,Ce){var ue=Ce&&Ce.unsafe;ue||S(me);var ve=!ue&&vr.find(me,Te);if(!ve){var $e=me.FullPaths[0];Te.slice(0,$e.length)==$e?$e=Te:($e.slice(-1)!="/"&&($e+="/"),$e=($e+Te).replace("//","/")),ve={name:a(Te),type:2},me.FileIndex.push(ve),me.FullPaths.push($e),ue||vr.utils.cfb_gc(me)}return ve.content=Ne,ve.size=Ne?Ne.length:0,Ce&&(Ce.CLSID&&(ve.clsid=Ce.CLSID),Ce.mt&&(ve.mt=Ce.mt),Ce.ct&&(ve.ct=Ce.ct)),ve}function vn(me,Te){S(me);var Ne=vr.find(me,Te);if(Ne){for(var Ce=0;Ce<me.FileIndex.length;++Ce)if(me.FileIndex[Ce]==Ne)return me.FileIndex.splice(Ce,1),me.FullPaths.splice(Ce,1),!0}return!1}function En(me,Te,Ne){S(me);var Ce=vr.find(me,Te);if(Ce){for(var ue=0;ue<me.FileIndex.length;++ue)if(me.FileIndex[ue]==Ce)return me.FileIndex[ue].name=a(Ne),me.FullPaths[ue]=Ne,!0}return!1}function Xn(me){P(me,!0)}return t.find=T,t.read=j,t.parse=d,t.write=z,t.writeFile=L,t.utils={cfb_new:Bn,cfb_add:tn,cfb_del:vn,cfb_mov:En,cfb_gc:Xn,ReadShift:Ow,CheckField:whe,prep_blob:Ki,bconcat:Ti,use_zlib:E,_deflateRaw:He,_inflateRaw:it,consts:q},t}();let Rm;function nvt(e){Rm=e}function svt(e){return typeof e=="string"?y_(e):Array.isArray(e)?Axt(e):e}function w_(e,t,r){if(typeof Rm<"u"&&Rm.writeFileSync)return r?Rm.writeFileSync(e,t,r):Rm.writeFileSync(e,t);if(typeof Deno<"u"){if(r&&typeof t=="string")switch(r){case"utf8":t=new TextEncoder(r).encode(t);break;case"binary":t=y_(t);break;default:throw new Error("Unsupported encoding "+r)}return Deno.writeFileSync(e,t)}var n=r=="utf8"?$d(t):t;if(typeof IE_SaveFile<"u")return IE_SaveFile(n,e);if(typeof Blob<"u"){var a=new Blob([svt(n)],{type:"application/octet-stream"});if(typeof navigator<"u"&&navigator.msSaveBlob)return navigator.msSaveBlob(a,e);if(typeof saveAs<"u")return saveAs(a,e);if(typeof URL<"u"&&typeof document<"u"&&document.createElement&&URL.createObjectURL){var i=URL.createObjectURL(a);if(typeof chrome=="object"&&typeof(chrome.downloads||{}).download=="function")return URL.revokeObjectURL&&typeof setTimeout<"u"&&setTimeout(function(){URL.revokeObjectURL(i)},6e4),chrome.downloads.download({url:i,filename:e,saveAs:!0});var o=document.createElement("a");if(o.download!=null)return o.download=e,o.href=i,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL&&typeof setTimeout<"u"&&setTimeout(function(){URL.revokeObjectURL(i)},6e4),i}}if(typeof $<"u"&&typeof File<"u"&&typeof Folder<"u")try{var l=File(e);return l.open("w"),l.encoding="binary",Array.isArray(t)&&(t=Ip(t)),l.write(t),l.close(),t}catch(c){if(!c.message||!c.message.match(/onstruct/))throw c}throw new Error("cannot save file "+e)}function avt(e){if(typeof Rm<"u")return Rm.readFileSync(e);if(typeof Deno<"u")return Deno.readFileSync(e);if(typeof $<"u"&&typeof File<"u"&&typeof Folder<"u")try{var t=File(e);t.open("r"),t.encoding="binary";var r=t.read();return t.close(),r}catch(n){if(!n.message||!n.message.match(/onstruct/))throw n}throw new Error("Cannot access file "+e)}function wa(e){for(var t=Object.keys(e),r=[],n=0;n<t.length;++n)Object.prototype.hasOwnProperty.call(e,t[n])&&r.push(t[n]);return r}function BK(e,t){for(var r=[],n=wa(e),a=0;a!==n.length;++a)r[e[n[a]][t]]==null&&(r[e[n[a]][t]]=n[a]);return r}function iA(e){for(var t=[],r=wa(e),n=0;n!==r.length;++n)t[e[r[n]]]=r[n];return t}function oA(e){for(var t=[],r=wa(e),n=0;n!==r.length;++n)t[e[r[n]]]=parseInt(r[n],10);return t}function ivt(e){for(var t=[],r=wa(e),n=0;n!==r.length;++n)t[e[r[n]]]==null&&(t[e[r[n]]]=[]),t[e[r[n]]].push(r[n]);return t}var Ck=new Date(1899,11,30,0,0,0);function yi(e,t){var r=e.getTime(),n=Ck.getTime()+(e.getTimezoneOffset()-Ck.getTimezoneOffset())*6e4;return(r-n)/(24*60*60*1e3)}var she=new Date,ovt=Ck.getTime()+(she.getTimezoneOffset()-Ck.getTimezoneOffset())*6e4,zK=she.getTimezoneOffset();function lA(e){var t=new Date;return t.setTime(e*24*60*60*1e3+ovt),t.getTimezoneOffset()!==zK&&t.setTime(t.getTime()+(t.getTimezoneOffset()-zK)*6e4),t}function lvt(e){var t=0,r=0,n=!1,a=e.match(/P([0-9\.]+Y)?([0-9\.]+M)?([0-9\.]+D)?T([0-9\.]+H)?([0-9\.]+M)?([0-9\.]+S)?/);if(!a)throw new Error("|"+e+"| is not an ISO8601 Duration");for(var i=1;i!=a.length;++i)if(a[i]){switch(r=1,i>3&&(n=!0),a[i].slice(a[i].length-1)){case"Y":throw new Error("Unsupported ISO Duration Field: "+a[i].slice(a[i].length-1));case"D":r*=24;case"H":r*=60;case"M":if(n)r*=60;else throw new Error("Unsupported ISO Duration Field: M")}t+=r*parseInt(a[i],10)}return t}var UK=new Date("2017-02-19T19:06:09.000Z"),ahe=isNaN(UK.getFullYear())?new Date("2/19/17"):UK,cvt=ahe.getFullYear()==2017;function Us(e,t){var r=new Date(e);if(cvt)return t>0?r.setTime(r.getTime()+r.getTimezoneOffset()*60*1e3):t<0&&r.setTime(r.getTime()-r.getTimezoneOffset()*60*1e3),r;if(e instanceof Date)return e;if(ahe.getFullYear()==1917&&!isNaN(r.getFullYear())){var n=r.getFullYear();return e.indexOf(""+n)>-1||r.setFullYear(r.getFullYear()+100),r}var a=e.match(/\d+/g)||["2017","2","19","0","0","0"],i=new Date(+a[0],+a[1]-1,+a[2],+a[3]||0,+a[4]||0,+a[5]||0);return e.indexOf("Z")>-1&&(i=new Date(i.getTime()-i.getTimezoneOffset()*60*1e3)),i}function Ng(e,t){if(fn&&Buffer.isBuffer(e)){if(t){if(e[0]==255&&e[1]==254)return $d(e.slice(2).toString("utf16le"));if(e[1]==254&&e[2]==255)return $d(Hfe(e.slice(2).toString("binary")))}return e.toString("binary")}if(typeof TextDecoder<"u")try{if(t){if(e[0]==255&&e[1]==254)return $d(new TextDecoder("utf-16le").decode(e.slice(2)));if(e[0]==254&&e[1]==255)return $d(new TextDecoder("utf-16be").decode(e.slice(2)))}var r={"€":"","‚":"",ƒ:"","„":"","…":"
","†":"","‡":"","ˆ":"","‰":"",Š:"","‹":"",Œ:"",Ž:"","‘":"","’":"","“":"","”":"","•":"","–":"","—":"","˜":"","™":"",š:"","›":"",œ:"",ž:"",Ÿ:""};return Array.isArray(e)&&(e=new Uint8Array(e)),new TextDecoder("latin1").decode(e).replace(/[€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ]/g,function(i){return r[i]||i})}catch{}for(var n=[],a=0;a!=e.length;++a)n.push(String.fromCharCode(e[a]));return n.join("")}function xs(e){if(typeof JSON<"u"&&!Array.isArray(e))return JSON.parse(JSON.stringify(e));if(typeof e!="object"||e==null)return e;if(e instanceof Date)return new Date(e.getTime());var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=xs(e[r]));return t}function fa(e,t){for(var r="";r.length<t;)r+=e;return r}function Gu(e){var t=Number(e);if(!isNaN(t))return isFinite(t)?t:NaN;if(!/\d/.test(e))return t;var r=1,n=e.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g,function(){return r*=100,""});return!isNaN(t=Number(n))||(n=n.replace(/[(](.*)[)]/,function(a,i){return r=-r,i}),!isNaN(t=Number(n)))?t/r:t}var uvt=["january","february","march","april","may","june","july","august","september","october","november","december"];function My(e){var t=new Date(e),r=new Date(NaN),n=t.getYear(),a=t.getMonth(),i=t.getDate();if(isNaN(i))return r;var o=e.toLowerCase();if(o.match(/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/)){if(o=o.replace(/[^a-z]/g,"").replace(/([^a-z]|^)[ap]m?([^a-z]|$)/,""),o.length>3&&uvt.indexOf(o)==-1)return r}else if(o.match(/[a-z]/))return r;return n<0||n>8099?r:(a>0||i>1)&&n!=101?t:e.match(/[^-0-9:,\/\\]/)?r:t}var dvt=function(){var e="abacaba".split(/(:?b)/i).length==5;return function(r,n,a){if(e||typeof n=="string")return r.split(n);for(var i=r.split(n),o=[i[0]],l=1;l<i.length;++l)o.push(a),o.push(i[l]);return o}}();function ihe(e){return e?e.content&&e.type?Ng(e.content,!0):e.data?ov(e.data):e.asNodeBuffer&&fn?ov(e.asNodeBuffer().toString("binary")):e.asBinary?ov(e.asBinary()):e._data&&e._data.getContent?ov(Ng(Array.prototype.slice.call(e._data.getContent(),0))):null:null}function ohe(e){if(!e)return null;if(e.data)return _k(e.data);if(e.asNodeBuffer&&fn)return e.asNodeBuffer();if(e._data&&e._data.getContent){var t=e._data.getContent();return typeof t=="string"?_k(t):Array.prototype.slice.call(t)}return e.content&&e.type?e.content:null}function fvt(e){return e&&e.name.slice(-4)===".bin"?ohe(e):ihe(e)}function Sc(e,t){for(var r=e.FullPaths||wa(e.files),n=t.toLowerCase().replace(/[\/]/g,"\\"),a=n.replace(/\\/g,"/"),i=0;i<r.length;++i){var o=r[i].replace(/^Root Entry[\/]/,"").toLowerCase();if(n==o||a==o)return e.files?e.files[r[i]]:e.FileIndex[i]}return null}function zM(e,t){var r=Sc(e,t);if(r==null)throw new Error("Cannot find file "+t+" in zip");return r}function qa(e,t,r){if(!r)return fvt(zM(e,t));if(!t)return null;try{return qa(e,t)}catch{return null}}function Hl(e,t,r){if(!r)return ihe(zM(e,t));if(!t)return null;try{return Hl(e,t)}catch{return null}}function hvt(e,t,r){return ohe(zM(e,t))}function qK(e){for(var t=e.FullPaths||wa(e.files),r=[],n=0;n<t.length;++n)t[n].slice(-1)!="/"&&r.push(t[n].replace(/^Root Entry[\/]/,""));return r.sort()}function un(e,t,r){if(e.FullPaths){if(typeof r=="string"){var n;return fn?n=kh(r):n=Txt(r),vr.utils.cfb_add(e,t,n)}vr.utils.cfb_add(e,t,r)}else e.file(t,r)}function UM(){return vr.utils.cfb_new()}function lhe(e,t){switch(t.type){case"base64":return vr.read(e,{type:"base64"});case"binary":return vr.read(e,{type:"binary"});case"buffer":case"array":return vr.read(e,{type:"buffer"})}throw new Error("Unrecognized type "+t.type)}function Jb(e,t){if(e.charAt(0)=="/")return e.slice(1);var r=t.split("/");t.slice(-1)!="/"&&r.pop();for(var n=e.split("/");n.length!==0;){var a=n.shift();a===".."?r.pop():a!=="."&&r.push(a)}return r.join("/")}var Ra=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
`,mvt=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g,VK=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s*[\/\?]?>/mg,pvt=/<[^>]*>/g,_o=Ra.match(VK)?VK:pvt,gvt=/<\w*:/,xvt=/<(\/?)\w+:/;function Rr(e,t,r){for(var n={},a=0,i=0;a!==e.length&&!((i=e.charCodeAt(a))===32||i===10||i===13);++a);if(t||(n[0]=e.slice(0,a)),a===e.length)return n;var o=e.match(mvt),l=0,c="",u=0,d="",f="",m=1;if(o)for(u=0;u!=o.length;++u){for(f=o[u],i=0;i!=f.length&&f.charCodeAt(i)!==61;++i);for(d=f.slice(0,i).trim();f.charCodeAt(i+1)==32;)++i;for(m=(a=f.charCodeAt(i+1))==34||a==39?1:0,c=f.slice(i+1+m,f.length-m),l=0;l!=d.length&&d.charCodeAt(l)!==58;++l);if(l===d.length)d.indexOf("_")>0&&(d=d.slice(0,d.indexOf("_"))),n[d]=c,n[d.toLowerCase()]=c;else{var h=(l===5&&d.slice(0,5)==="xmlns"?"xmlns":"")+d.slice(l+1);if(n[h]&&d.slice(l-3,l)=="ext")continue;n[h]=c,n[h.toLowerCase()]=c}}return n}function df(e){return e.replace(xvt,"<$1")}var che={""":'"',"'":"'",">":">","<":"<","&":"&"},qM=iA(che),Dn=function(){var e=/&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig,t=/_x([\da-fA-F]{4})_/ig;return function r(n){var a=n+"",i=a.indexOf("<![CDATA[");if(i==-1)return a.replace(e,function(l,c){return che[l]||String.fromCharCode(parseInt(c,l.indexOf("x")>-1?16:10))||l}).replace(t,function(l,c){return String.fromCharCode(parseInt(c,16))});var o=a.indexOf("]]>");return r(a.slice(0,i))+a.slice(i+9,o)+r(a.slice(o+3))}}(),VM=/[&<>'"]/g,vvt=/[\u0000-\u0008\u000b-\u001f]/g;function ns(e){var t=e+"";return t.replace(VM,function(r){return qM[r]}).replace(vvt,function(r){return"_x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+"_"})}function WK(e){return ns(e).replace(/ /g,"_x0020_")}var uhe=/[\u0000-\u001f]/g;function WM(e){var t=e+"";return t.replace(VM,function(r){return qM[r]}).replace(/\n/g,"<br/>").replace(uhe,function(r){return"&#x"+("000"+r.charCodeAt(0).toString(16)).slice(-4)+";"})}function yvt(e){var t=e+"";return t.replace(VM,function(r){return qM[r]}).replace(uhe,function(r){return"&#x"+r.charCodeAt(0).toString(16).toUpperCase()+";"})}var HK=function(){var e=/&#(\d+);/g;function t(r,n){return String.fromCharCode(parseInt(n,10))}return function(n){return n.replace(e,t)}}();function bvt(e){return e.replace(/(\r\n|[\r\n])/g," ")}function Ls(e){switch(e){case 1:case!0:case"1":case"true":case"TRUE":return!0;default:return!1}}function CP(e){for(var t="",r=0,n=0,a=0,i=0,o=0,l=0;r<e.length;){if(n=e.charCodeAt(r++),n<128){t+=String.fromCharCode(n);continue}if(a=e.charCodeAt(r++),n>191&&n<224){o=(n&31)<<6,o|=a&63,t+=String.fromCharCode(o);continue}if(i=e.charCodeAt(r++),n<240){t+=String.fromCharCode((n&15)<<12|(a&63)<<6|i&63);continue}o=e.charCodeAt(r++),l=((n&7)<<18|(a&63)<<12|(i&63)<<6|o&63)-65536,t+=String.fromCharCode(55296+(l>>>10&1023)),t+=String.fromCharCode(56320+(l&1023))}return t}function GK(e){var t=fp(2*e.length),r,n,a=1,i=0,o=0,l;for(n=0;n<e.length;n+=a)a=1,(l=e.charCodeAt(n))<128?r=l:l<224?(r=(l&31)*64+(e.charCodeAt(n+1)&63),a=2):l<240?(r=(l&15)*4096+(e.charCodeAt(n+1)&63)*64+(e.charCodeAt(n+2)&63),a=3):(a=4,r=(l&7)*262144+(e.charCodeAt(n+1)&63)*4096+(e.charCodeAt(n+2)&63)*64+(e.charCodeAt(n+3)&63),r-=65536,o=55296+(r>>>10&1023),r=56320+(r&1023)),o!==0&&(t[i++]=o&255,t[i++]=o>>>8,o=0),t[i++]=r%256,t[i++]=r>>>8;return t.slice(0,i).toString("ucs2")}function KK(e){return kh(e,"binary").toString("utf8")}var kS="foo bar bazâð£",us=fn&&(KK(kS)==CP(kS)&&KK||GK(kS)==CP(kS)&&GK)||CP,$d=fn?function(e){return kh(e,"utf8").toString("binary")}:function(e){for(var t=[],r=0,n=0,a=0;r<e.length;)switch(n=e.charCodeAt(r++),!0){case n<128:t.push(String.fromCharCode(n));break;case n<2048:t.push(String.fromCharCode(192+(n>>6))),t.push(String.fromCharCode(128+(n&63)));break;case(n>=55296&&n<57344):n-=55296,a=e.charCodeAt(r++)-56320+(n<<10),t.push(String.fromCharCode(240+(a>>18&7))),t.push(String.fromCharCode(144+(a>>12&63))),t.push(String.fromCharCode(128+(a>>6&63))),t.push(String.fromCharCode(128+(a&63)));break;default:t.push(String.fromCharCode(224+(n>>12))),t.push(String.fromCharCode(128+(n>>6&63))),t.push(String.fromCharCode(128+(n&63)))}return t.join("")},hj=function(){var e={};return function(r,n){var a=r+"|"+(n||"");return e[a]?e[a]:e[a]=new RegExp("<(?:\\w+:)?"+r+'(?: xml:space="preserve")?(?:[^>]*)>([\\s\\S]*?)</(?:\\w+:)?'+r+">",n||"")}}(),dhe=function(){var e=[["nbsp"," "],["middot","·"],["quot",'"'],["apos","'"],["gt",">"],["lt","<"],["amp","&"]].map(function(t){return[new RegExp("&"+t[0]+";","ig"),t[1]]});return function(r){for(var n=r.replace(/^[\t\n\r ]+/,"").replace(/[\t\n\r ]+$/,"").replace(/>\s+/g,">").replace(/\s+</g,"<").replace(/[\t\n\r ]+/g," ").replace(/<\s*[bB][rR]\s*\/?>/g,`
`).replace(/<[^>]*>/g,""),a=0;a<e.length;++a)n=n.replace(e[a][0],e[a][1]);return n}}(),wvt=function(){var e={};return function(r){return e[r]!==void 0?e[r]:e[r]=new RegExp("<(?:vt:)?"+r+">([\\s\\S]*?)</(?:vt:)?"+r+">","g")}}(),jvt=/<\/?(?:vt:)?variant>/g,_vt=/<(?:vt:)([^>]*)>([\s\S]*)</;function YK(e,t){var r=Rr(e),n=e.match(wvt(r.baseType))||[],a=[];if(n.length!=r.size){if(t.WTF)throw new Error("unexpected vector length "+n.length+" != "+r.size);return a}return n.forEach(function(i){var o=i.replace(jvt,"").match(_vt);o&&a.push({v:us(o[2]),t:o[1]})}),a}var fhe=/(^\s|\s$|\n)/;function Yi(e,t){return"<"+e+(t.match(fhe)?' xml:space="preserve"':"")+">"+t+"</"+e+">"}function mj(e){return wa(e).map(function(t){return" "+t+'="'+e[t]+'"'}).join("")}function Lt(e,t,r){return"<"+e+(r!=null?mj(r):"")+(t!=null?(t.match(fhe)?' xml:space="preserve"':"")+">"+t+"</"+e:"/")+">"}function eI(e,t){try{return e.toISOString().replace(/\.\d*/,"")}catch(r){if(t)throw r}return""}function Nvt(e,t){switch(typeof e){case"string":var r=Lt("vt:lpwstr",ns(e));return r=r.replace(/"/g,"_x0022_"),r;case"number":return Lt((e|0)==e?"vt:i4":"vt:r8",ns(String(e)));case"boolean":return Lt("vt:bool",e?"true":"false")}if(e instanceof Date)return Lt("vt:filetime",eI(e));throw new Error("Unable to serialize "+e)}function HM(e){if(fn&&Buffer.isBuffer(e))return e.toString("utf8");if(typeof e=="string")return e;if(typeof Uint8Array<"u"&&e instanceof Uint8Array)return us(Ip(FM(e)));throw new Error("Bad input format: expected Buffer or string")}var pj=/<(\/?)([^\s?><!\/:]*:|)([^\s?<>:\/]+)(?:[\s?:\/][^>]*)?>/mg,mi={CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",CT:"http://schemas.openxmlformats.org/package/2006/content-types",RELS:"http://schemas.openxmlformats.org/package/2006/relationships",TCMNT:"http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",xsd:"http://www.w3.org/2001/XMLSchema"},Kg=["http://schemas.openxmlformats.org/spreadsheetml/2006/main","http://purl.oclc.org/ooxml/spreadsheetml/main","http://schemas.microsoft.com/office/excel/2006/main","http://schemas.microsoft.com/office/excel/2006/2"],zl={o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel",ss:"urn:schemas-microsoft-com:office:spreadsheet",dt:"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882",mv:"http://macVmlSchemaUri",v:"urn:schemas-microsoft-com:vml",html:"http://www.w3.org/TR/REC-html40"};function Svt(e,t){for(var r=1-2*(e[t+7]>>>7),n=((e[t+7]&127)<<4)+(e[t+6]>>>4&15),a=e[t+6]&15,i=5;i>=0;--i)a=a*256+e[t+i];return n==2047?a==0?r*(1/0):NaN:(n==0?n=-1022:(n-=1023,a+=Math.pow(2,52)),r*Math.pow(2,n-52)*a)}function kvt(e,t,r){var n=(t<0||1/t==-1/0?1:0)<<7,a=0,i=0,o=n?-t:t;isFinite(o)?o==0?a=i=0:(a=Math.floor(Math.log(o)/Math.LN2),i=o*Math.pow(2,52-a),a<=-1023&&(!isFinite(i)||i<Math.pow(2,52))?a=-1022:(i-=Math.pow(2,52),a+=1023)):(a=2047,i=isNaN(t)?26985:0);for(var l=0;l<=5;++l,i/=256)e[r+l]=i&255;e[r+6]=(a&15)<<4|i&15,e[r+7]=a>>4|n}var XK=function(e){for(var t=[],r=10240,n=0;n<e[0].length;++n)if(e[0][n])for(var a=0,i=e[0][n].length;a<i;a+=r)t.push.apply(t,e[0][n].slice(a,a+r));return t},ZK=fn?function(e){return e[0].length>0&&Buffer.isBuffer(e[0][0])?Buffer.concat(e[0].map(function(t){return Buffer.isBuffer(t)?t:kh(t)})):XK(e)}:XK,JK=function(e,t,r){for(var n=[],a=t;a<r;a+=2)n.push(String.fromCharCode(Yf(e,a)));return n.join("").replace(go,"")},cA=fn?function(e,t,r){return Buffer.isBuffer(e)?e.toString("utf16le",t,r).replace(go,""):JK(e,t,r)}:JK,QK=function(e,t,r){for(var n=[],a=t;a<t+r;++a)n.push(("0"+e[a].toString(16)).slice(-2));return n.join("")},hhe=fn?function(e,t,r){return Buffer.isBuffer(e)?e.toString("hex",t,t+r):QK(e,t,r)}:QK,eY=function(e,t,r){for(var n=[],a=t;a<r;a++)n.push(String.fromCharCode(zx(e,a)));return n.join("")},I1=fn?function(t,r,n){return Buffer.isBuffer(t)?t.toString("utf8",r,n):eY(t,r,n)}:eY,mhe=function(e,t){var r=Ei(e,t);return r>0?I1(e,t+4,t+4+r-1):""},GM=mhe,phe=function(e,t){var r=Ei(e,t);return r>0?I1(e,t+4,t+4+r-1):""},KM=phe,ghe=function(e,t){var r=2*Ei(e,t);return r>0?I1(e,t+4,t+4+r-1):""},YM=ghe,xhe=function(t,r){var n=Ei(t,r);return n>0?cA(t,r+4,r+4+n):""},XM=xhe,vhe=function(e,t){var r=Ei(e,t);return r>0?I1(e,t+4,t+4+r):""},ZM=vhe,yhe=function(e,t){return Svt(e,t)},Ek=yhe,JM=function(t){return Array.isArray(t)||typeof Uint8Array<"u"&&t instanceof Uint8Array};fn&&(GM=function(t,r){if(!Buffer.isBuffer(t))return mhe(t,r);var n=t.readUInt32LE(r);return n>0?t.toString("utf8",r+4,r+4+n-1):""},KM=function(t,r){if(!Buffer.isBuffer(t))return phe(t,r);var n=t.readUInt32LE(r);return n>0?t.toString("utf8",r+4,r+4+n-1):""},YM=function(t,r){if(!Buffer.isBuffer(t))return ghe(t,r);var n=2*t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+n-1)},XM=function(t,r){if(!Buffer.isBuffer(t))return xhe(t,r);var n=t.readUInt32LE(r);return t.toString("utf16le",r+4,r+4+n)},ZM=function(t,r){if(!Buffer.isBuffer(t))return vhe(t,r);var n=t.readUInt32LE(r);return t.toString("utf8",r+4,r+4+n)},Ek=function(t,r){return Buffer.isBuffer(t)?t.readDoubleLE(r):yhe(t,r)},JM=function(t){return Buffer.isBuffer(t)||Array.isArray(t)||typeof Uint8Array<"u"&&t instanceof Uint8Array});function bhe(){cA=function(e,t,r){return Cn.utils.decode(1200,e.slice(t,r)).replace(go,"")},I1=function(e,t,r){return Cn.utils.decode(65001,e.slice(t,r))},GM=function(e,t){var r=Ei(e,t);return r>0?Cn.utils.decode(jg,e.slice(t+4,t+4+r-1)):""},KM=function(e,t){var r=Ei(e,t);return r>0?Cn.utils.decode(tc,e.slice(t+4,t+4+r-1)):""},YM=function(e,t){var r=2*Ei(e,t);return r>0?Cn.utils.decode(1200,e.slice(t+4,t+4+r-1)):""},XM=function(e,t){var r=Ei(e,t);return r>0?Cn.utils.decode(1200,e.slice(t+4,t+4+r)):""},ZM=function(e,t){var r=Ei(e,t);return r>0?Cn.utils.decode(65001,e.slice(t+4,t+4+r)):""}}typeof Cn<"u"&&bhe();var zx=function(e,t){return e[t]},Yf=function(e,t){return e[t+1]*256+e[t]},Cvt=function(e,t){var r=e[t+1]*256+e[t];return r<32768?r:(65535-r+1)*-1},Ei=function(e,t){return e[t+3]*(1<<24)+(e[t+2]<<16)+(e[t+1]<<8)+e[t]},x0=function(e,t){return e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]},Evt=function(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]};function Ow(e,t){var r="",n,a,i=[],o,l,c,u;switch(t){case"dbcs":if(u=this.l,fn&&Buffer.isBuffer(this))r=this.slice(this.l,this.l+2*e).toString("utf16le");else for(c=0;c<e;++c)r+=String.fromCharCode(Yf(this,u)),u+=2;e*=2;break;case"utf8":r=I1(this,this.l,this.l+e);break;case"utf16le":e*=2,r=cA(this,this.l,this.l+e);break;case"wstr":if(typeof Cn<"u")r=Cn.utils.decode(tc,this.slice(this.l,this.l+2*e));else return Ow.call(this,e,"dbcs");e=2*e;break;case"lpstr-ansi":r=GM(this,this.l),e=4+Ei(this,this.l);break;case"lpstr-cp":r=KM(this,this.l),e=4+Ei(this,this.l);break;case"lpwstr":r=YM(this,this.l),e=4+2*Ei(this,this.l);break;case"lpp4":e=4+Ei(this,this.l),r=XM(this,this.l),e&2&&(e+=2);break;case"8lpp4":e=4+Ei(this,this.l),r=ZM(this,this.l),e&3&&(e+=4-(e&3));break;case"cstr":for(e=0,r="";(o=zx(this,this.l+e++))!==0;)i.push(Xb(o));r=i.join("");break;case"_wstr":for(e=0,r="";(o=Yf(this,this.l+e))!==0;)i.push(Xb(o)),e+=2;e+=2,r=i.join("");break;case"dbcs-cont":for(r="",u=this.l,c=0;c<e;++c){if(this.lens&&this.lens.indexOf(u)!==-1)return o=zx(this,u),this.l=u+1,l=Ow.call(this,e-c,o?"dbcs-cont":"sbcs-cont"),i.join("")+l;i.push(Xb(Yf(this,u))),u+=2}r=i.join(""),e*=2;break;case"cpstr":if(typeof Cn<"u"){r=Cn.utils.decode(tc,this.slice(this.l,this.l+e));break}case"sbcs-cont":for(r="",u=this.l,c=0;c!=e;++c){if(this.lens&&this.lens.indexOf(u)!==-1)return o=zx(this,u),this.l=u+1,l=Ow.call(this,e-c,o?"dbcs-cont":"sbcs-cont"),i.join("")+l;i.push(Xb(zx(this,u))),u+=1}r=i.join("");break;default:switch(e){case 1:return n=zx(this,this.l),this.l++,n;case 2:return n=(t==="i"?Cvt:Yf)(this,this.l),this.l+=2,n;case 4:case-4:return t==="i"||!(this[this.l+3]&128)?(n=(e>0?x0:Evt)(this,this.l),this.l+=4,n):(a=Ei(this,this.l),this.l+=4,a);case 8:case-8:if(t==="f")return e==8?a=Ek(this,this.l):a=Ek([this[this.l+7],this[this.l+6],this[this.l+5],this[this.l+4],this[this.l+3],this[this.l+2],this[this.l+1],this[this.l+0]],0),this.l+=8,a;e=8;case 16:r=hhe(this,this.l,e);break}}return this.l+=e,r}var Avt=function(e,t,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24&255},Tvt=function(e,t,r){e[r]=t&255,e[r+1]=t>>8&255,e[r+2]=t>>16&255,e[r+3]=t>>24&255},Pvt=function(e,t,r){e[r]=t&255,e[r+1]=t>>>8&255};function Ovt(e,t,r){var n=0,a=0;if(r==="dbcs"){for(a=0;a!=t.length;++a)Pvt(this,t.charCodeAt(a),this.l+2*a);n=2*t.length}else if(r==="sbcs"){if(typeof Cn<"u"&&jg==874)for(a=0;a!=t.length;++a){var i=Cn.utils.encode(jg,t.charAt(a));this[this.l+a]=i[0]}else for(t=t.replace(/[^\x00-\x7F]/g,"_"),a=0;a!=t.length;++a)this[this.l+a]=t.charCodeAt(a)&255;n=t.length}else if(r==="hex"){for(;a<e;++a)this[this.l++]=parseInt(t.slice(2*a,2*a+2),16)||0;return this}else if(r==="utf16le"){var o=Math.min(this.l+e,this.length);for(a=0;a<Math.min(t.length,e);++a){var l=t.charCodeAt(a);this[this.l++]=l&255,this[this.l++]=l>>8}for(;this.l<o;)this[this.l++]=0;return this}else switch(e){case 1:n=1,this[this.l]=t&255;break;case 2:n=2,this[this.l]=t&255,t>>>=8,this[this.l+1]=t&255;break;case 3:n=3,this[this.l]=t&255,t>>>=8,this[this.l+1]=t&255,t>>>=8,this[this.l+2]=t&255;break;case 4:n=4,Avt(this,t,this.l);break;case 8:if(n=8,r==="f"){kvt(this,t,this.l);break}case 16:break;case-4:n=4,Tvt(this,t,this.l);break}return this.l+=n,this}function whe(e,t){var r=hhe(this,this.l,e.length>>1);if(r!==e)throw new Error(t+"Expected "+e+" saw "+r);this.l+=e.length>>1}function Ki(e,t){e.l=t,e.read_shift=Ow,e.chk=whe,e.write_shift=Ovt}function bo(e,t){e.l+=t}function lt(e){var t=fp(e);return Ki(t,0),t}function Ch(e,t,r){if(e){var n,a,i;Ki(e,e.l||0);for(var o=e.length,l=0,c=0;e.l<o;){l=e.read_shift(1),l&128&&(l=(l&127)+((e.read_shift(1)&127)<<7));var u=wj[l]||wj[65535];for(n=e.read_shift(1),i=n&127,a=1;a<4&&n&128;++a)i+=((n=e.read_shift(1))&127)<<7*a;c=e.l+i;var d=u.f&&u.f(e,i,r);if(e.l=c,t(d,u,l))return}}}function gl(){var e=[],t=fn?256:2048,r=function(u){var d=lt(u);return Ki(d,0),d},n=r(t),a=function(){n&&(n.length>n.l&&(n=n.slice(0,n.l),n.l=n.length),n.length>0&&e.push(n),n=null)},i=function(u){return n&&u<n.length-n.l?n:(a(),n=r(Math.max(u+1,t)))},o=function(){return a(),Ti(e)},l=function(u){a(),n=u,n.l==null&&(n.l=n.length),i(t)};return{next:i,push:l,end:o,_bufs:e}}function yt(e,t,r,n){var a=+t,i;if(!isNaN(a)){n||(n=wj[a].p||(r||[]).length||0),i=1+(a>=128?1:0)+1,n>=128&&++i,n>=16384&&++i,n>=2097152&&++i;var o=e.next(i);a<=127?o.write_shift(1,a):(o.write_shift(1,(a&127)+128),o.write_shift(1,a>>7));for(var l=0;l!=4;++l)if(n>=128)o.write_shift(1,(n&127)+128),n>>=7;else{o.write_shift(1,n);break}n>0&&JM(r)&&e.push(r)}}function Dw(e,t,r){var n=xs(e);if(t.s?(n.cRel&&(n.c+=t.s.c),n.rRel&&(n.r+=t.s.r)):(n.cRel&&(n.c+=t.c),n.rRel&&(n.r+=t.r)),!r||r.biff<12){for(;n.c>=256;)n.c-=256;for(;n.r>=65536;)n.r-=65536}return n}function tY(e,t,r){var n=xs(e);return n.s=Dw(n.s,t.s,r),n.e=Dw(n.e,t.s,r),n}function Iw(e,t){if(e.cRel&&e.c<0)for(e=xs(e);e.c<0;)e.c+=t>8?16384:256;if(e.rRel&&e.r<0)for(e=xs(e);e.r<0;)e.r+=t>8?1048576:t>5?65536:16384;var r=Er(e);return!e.cRel&&e.cRel!=null&&(r=Rvt(r)),!e.rRel&&e.rRel!=null&&(r=Dvt(r)),r}function EP(e,t){return e.s.r==0&&!e.s.rRel&&e.e.r==(t.biff>=12?1048575:t.biff>=8?65536:16384)&&!e.e.rRel?(e.s.cRel?"":"$")+zs(e.s.c)+":"+(e.e.cRel?"":"$")+zs(e.e.c):e.s.c==0&&!e.s.cRel&&e.e.c==(t.biff>=12?16383:255)&&!e.e.cRel?(e.s.rRel?"":"$")+va(e.s.r)+":"+(e.e.rRel?"":"$")+va(e.e.r):Iw(e.s,t.biff)+":"+Iw(e.e,t.biff)}function QM(e){return parseInt(Ivt(e),10)-1}function va(e){return""+(e+1)}function Dvt(e){return e.replace(/([A-Z]|^)(\d+)$/,"$1$$$2")}function Ivt(e){return e.replace(/\$(\d+)$/,"$1")}function e7(e){for(var t=Lvt(e),r=0,n=0;n!==t.length;++n)r=26*r+t.charCodeAt(n)-64;return r-1}function zs(e){if(e<0)throw new Error("invalid column "+e);var t="";for(++e;e;e=Math.floor((e-1)/26))t=String.fromCharCode((e-1)%26+65)+t;return t}function Rvt(e){return e.replace(/^([A-Z])/,"$$$1")}function Lvt(e){return e.replace(/^\$([A-Z])/,"$1")}function Fvt(e){return e.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(",")}function Qs(e){for(var t=0,r=0,n=0;n<e.length;++n){var a=e.charCodeAt(n);a>=48&&a<=57?t=10*t+(a-48):a>=65&&a<=90&&(r=26*r+(a-64))}return{c:r-1,r:t-1}}function Er(e){for(var t=e.c+1,r="";t;t=(t-1)/26|0)r=String.fromCharCode((t-1)%26+65)+r;return r+(e.r+1)}function Go(e){var t=e.indexOf(":");return t==-1?{s:Qs(e),e:Qs(e)}:{s:Qs(e.slice(0,t)),e:Qs(e.slice(t+1))}}function nn(e,t){return typeof t>"u"||typeof t=="number"?nn(e.s,e.e):(typeof e!="string"&&(e=Er(e)),typeof t!="string"&&(t=Er(t)),e==t?e:e+":"+t)}function wn(e){var t={s:{c:0,r:0},e:{c:0,r:0}},r=0,n=0,a=0,i=e.length;for(r=0;n<i&&!((a=e.charCodeAt(n)-64)<1||a>26);++n)r=26*r+a;for(t.s.c=--r,r=0;n<i&&!((a=e.charCodeAt(n)-48)<0||a>9);++n)r=10*r+a;if(t.s.r=--r,n===i||a!=10)return t.e.c=t.s.c,t.e.r=t.s.r,t;for(++n,r=0;n!=i&&!((a=e.charCodeAt(n)-64)<1||a>26);++n)r=26*r+a;for(t.e.c=--r,r=0;n!=i&&!((a=e.charCodeAt(n)-48)<0||a>9);++n)r=10*r+a;return t.e.r=--r,t}function rY(e,t){var r=e.t=="d"&&t instanceof Date;if(e.z!=null)try{return e.w=ic(e.z,r?yi(t):t)}catch{}try{return e.w=ic((e.XF||{}).numFmtId||(r?14:0),r?yi(t):t)}catch{return""+t}}function tf(e,t,r){return e==null||e.t==null||e.t=="z"?"":e.w!==void 0?e.w:(e.t=="d"&&!e.z&&r&&r.dateNF&&(e.z=r.dateNF),e.t=="e"?Eh[e.v]||e.v:t==null?rY(e,e.v):rY(e,t))}function Rp(e,t){var r=t&&t.sheet?t.sheet:"Sheet1",n={};return n[r]=e,{SheetNames:[r],Sheets:n}}function jhe(e,t,r){var n=r||{},a=e?Array.isArray(e):n.dense,i=e||(a?[]:{}),o=0,l=0;if(i&&n.origin!=null){if(typeof n.origin=="number")o=n.origin;else{var c=typeof n.origin=="string"?Qs(n.origin):n.origin;o=c.r,l=c.c}i["!ref"]||(i["!ref"]="A1:A1")}var u={s:{c:1e7,r:1e7},e:{c:0,r:0}};if(i["!ref"]){var d=wn(i["!ref"]);u.s.c=d.s.c,u.s.r=d.s.r,u.e.c=Math.max(u.e.c,d.e.c),u.e.r=Math.max(u.e.r,d.e.r),o==-1&&(u.e.r=o=d.e.r+1)}for(var f=0;f!=t.length;++f)if(t[f]){if(!Array.isArray(t[f]))throw new Error("aoa_to_sheet expects an array of arrays");for(var m=0;m!=t[f].length;++m)if(!(typeof t[f][m]>"u")){var h={v:t[f][m]},g=o+f,p=l+m;if(u.s.r>g&&(u.s.r=g),u.s.c>p&&(u.s.c=p),u.e.r<g&&(u.e.r=g),u.e.c<p&&(u.e.c=p),t[f][m]&&typeof t[f][m]=="object"&&!Array.isArray(t[f][m])&&!(t[f][m]instanceof Date))h=t[f][m];else if(Array.isArray(h.v)&&(h.f=t[f][m][1],h.v=h.v[0]),h.v===null)if(h.f)h.t="n";else if(n.nullError)h.t="e",h.v=0;else if(n.sheetStubs)h.t="z";else continue;else typeof h.v=="number"?h.t="n":typeof h.v=="boolean"?h.t="b":h.v instanceof Date?(h.z=n.dateNF||Nr[14],n.cellDates?(h.t="d",h.w=ic(h.z,yi(h.v))):(h.t="n",h.v=yi(h.v),h.w=ic(h.z,h.v))):h.t="s";if(a)i[g]||(i[g]=[]),i[g][p]&&i[g][p].z&&(h.z=i[g][p].z),i[g][p]=h;else{var x=Er({c:p,r:g});i[x]&&i[x].z&&(h.z=i[x].z),i[x]=h}}}return u.s.c<1e7&&(i["!ref"]=nn(u)),i}function R1(e,t){return jhe(null,e,t)}function Mvt(e){return e.read_shift(4,"i")}function Ku(e,t){return t||(t=lt(4)),t.write_shift(4,e),t}function xo(e){var t=e.read_shift(4);return t===0?"":e.read_shift(t,"dbcs")}function Pi(e,t){var r=!1;return t==null&&(r=!0,t=lt(4+2*e.length)),t.write_shift(4,e.length),e.length>0&&t.write_shift(0,e,"dbcs"),r?t.slice(0,t.l):t}function $vt(e){return{ich:e.read_shift(2),ifnt:e.read_shift(2)}}function Bvt(e,t){return t||(t=lt(4)),t.write_shift(2,0),t.write_shift(2,0),t}function t7(e,t){var r=e.l,n=e.read_shift(1),a=xo(e),i=[],o={t:a,h:a};if(n&1){for(var l=e.read_shift(4),c=0;c!=l;++c)i.push($vt(e));o.r=i}else o.r=[{ich:0,ifnt:0}];return e.l=r+t,o}function zvt(e,t){var r=!1;return t==null&&(r=!0,t=lt(15+4*e.t.length)),t.write_shift(1,0),Pi(e.t,t),r?t.slice(0,t.l):t}var Uvt=t7;function qvt(e,t){var r=!1;return t==null&&(r=!0,t=lt(23+4*e.t.length)),t.write_shift(1,1),Pi(e.t,t),t.write_shift(4,1),Bvt({},t),r?t.slice(0,t.l):t}function fu(e){var t=e.read_shift(4),r=e.read_shift(2);return r+=e.read_shift(1)<<16,e.l++,{c:t,iStyleRef:r}}function Yg(e,t){return t==null&&(t=lt(8)),t.write_shift(-4,e.c),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}function Xg(e){var t=e.read_shift(2);return t+=e.read_shift(1)<<16,e.l++,{c:-1,iStyleRef:t}}function Zg(e,t){return t==null&&(t=lt(4)),t.write_shift(3,e.iStyleRef||e.s),t.write_shift(1,0),t}var Vvt=xo,_he=Pi;function r7(e){var t=e.read_shift(4);return t===0||t===4294967295?"":e.read_shift(t,"dbcs")}function Ak(e,t){var r=!1;return t==null&&(r=!0,t=lt(127)),t.write_shift(4,e.length>0?e.length:4294967295),e.length>0&&t.write_shift(0,e,"dbcs"),r?t.slice(0,t.l):t}var Wvt=xo,tI=r7,n7=Ak;function s7(e){var t=e.slice(e.l,e.l+4),r=t[0]&1,n=t[0]&2;e.l+=4;var a=n===0?Ek([0,0,0,0,t[0]&252,t[1],t[2],t[3]],0):x0(t,0)>>2;return r?a/100:a}function Nhe(e,t){t==null&&(t=lt(4));var r=0,n=0,a=e*100;if(e==(e|0)&&e>=-536870912&&e<1<<29?n=1:a==(a|0)&&a>=-536870912&&a<1<<29&&(n=1,r=1),n)t.write_shift(-4,((r?a:e)<<2)+(r+2));else throw new Error("unsupported RkNumber "+e)}function She(e){var t={s:{},e:{}};return t.s.r=e.read_shift(4),t.e.r=e.read_shift(4),t.s.c=e.read_shift(4),t.e.c=e.read_shift(4),t}function Hvt(e,t){return t||(t=lt(16)),t.write_shift(4,e.s.r),t.write_shift(4,e.e.r),t.write_shift(4,e.s.c),t.write_shift(4,e.e.c),t}var Jg=She,L1=Hvt;function mo(e){if(e.length-e.l<8)throw"XLS Xnum Buffer underflow";return e.read_shift(8,"f")}function Sg(e,t){return(t||lt(8)).write_shift(8,e,"f")}function Gvt(e){var t={},r=e.read_shift(1),n=r>>>1,a=e.read_shift(1),i=e.read_shift(2,"i"),o=e.read_shift(1),l=e.read_shift(1),c=e.read_shift(1);switch(e.l++,n){case 0:t.auto=1;break;case 1:t.index=a;var u=K0[a];u&&(t.rgb=xj(u));break;case 2:t.rgb=xj([o,l,c]);break;case 3:t.theme=a;break}return i!=0&&(t.tint=i>0?i/32767:i/32768),t}function Tk(e,t){if(t||(t=lt(8)),!e||e.auto)return t.write_shift(4,0),t.write_shift(4,0),t;e.index!=null?(t.write_shift(1,2),t.write_shift(1,e.index)):e.theme!=null?(t.write_shift(1,6),t.write_shift(1,e.theme)):(t.write_shift(1,5),t.write_shift(1,0));var r=e.tint||0;if(r>0?r*=32767:r<0&&(r*=32768),t.write_shift(2,r),!e.rgb||e.theme!=null)t.write_shift(2,0),t.write_shift(1,0),t.write_shift(1,0);else{var n=e.rgb||"FFFFFF";typeof n=="number"&&(n=("000000"+n.toString(16)).slice(-6)),t.write_shift(1,parseInt(n.slice(0,2),16)),t.write_shift(1,parseInt(n.slice(2,4),16)),t.write_shift(1,parseInt(n.slice(4,6),16)),t.write_shift(1,255)}return t}function Kvt(e){var t=e.read_shift(1);e.l++;var r={fBold:t&1,fItalic:t&2,fUnderline:t&4,fStrikeout:t&8,fOutline:t&16,fShadow:t&32,fCondense:t&64,fExtend:t&128};return r}function Yvt(e,t){t||(t=lt(2));var r=(e.italic?2:0)|(e.strike?8:0)|(e.outline?16:0)|(e.shadow?32:0)|(e.condense?64:0)|(e.extend?128:0);return t.write_shift(1,r),t.write_shift(1,0),t}function khe(e,t){var r={2:"BITMAP",3:"METAFILEPICT",8:"DIB",14:"ENHMETAFILE"},n=e.read_shift(4);switch(n){case 0:return"";case 4294967295:case 4294967294:return r[e.read_shift(4)]||""}if(n>400)throw new Error("Unsupported Clipboard: "+n.toString(16));return e.l-=4,e.read_shift(0,t==1?"lpstr":"lpwstr")}function Xvt(e){return khe(e,1)}function Zvt(e){return khe(e,2)}var a7=2,al=3,CS=11,nY=12,Pk=19,ES=64,Jvt=65,Qvt=71,eyt=4108,tyt=4126,Ni=80,Che=81,ryt=[Ni,Che],rI={1:{n:"CodePage",t:a7},2:{n:"Category",t:Ni},3:{n:"PresentationFormat",t:Ni},4:{n:"ByteCount",t:al},5:{n:"LineCount",t:al},6:{n:"ParagraphCount",t:al},7:{n:"SlideCount",t:al},8:{n:"NoteCount",t:al},9:{n:"HiddenCount",t:al},10:{n:"MultimediaClipCount",t:al},11:{n:"ScaleCrop",t:CS},12:{n:"HeadingPairs",t:eyt},13:{n:"TitlesOfParts",t:tyt},14:{n:"Manager",t:Ni},15:{n:"Company",t:Ni},16:{n:"LinksUpToDate",t:CS},17:{n:"CharacterCount",t:al},19:{n:"SharedDoc",t:CS},22:{n:"HyperlinksChanged",t:CS},23:{n:"AppVersion",t:al,p:"version"},24:{n:"DigSig",t:Jvt},26:{n:"ContentType",t:Ni},27:{n:"ContentStatus",t:Ni},28:{n:"Language",t:Ni},29:{n:"Version",t:Ni},255:{},2147483648:{n:"Locale",t:Pk},2147483651:{n:"Behavior",t:Pk},1919054434:{}},nI={1:{n:"CodePage",t:a7},2:{n:"Title",t:Ni},3:{n:"Subject",t:Ni},4:{n:"Author",t:Ni},5:{n:"Keywords",t:Ni},6:{n:"Comments",t:Ni},7:{n:"Template",t:Ni},8:{n:"LastAuthor",t:Ni},9:{n:"RevNumber",t:Ni},10:{n:"EditTime",t:ES},11:{n:"LastPrinted",t:ES},12:{n:"CreatedDate",t:ES},13:{n:"ModifiedDate",t:ES},14:{n:"PageCount",t:al},15:{n:"WordCount",t:al},16:{n:"CharCount",t:al},17:{n:"Thumbnail",t:Qvt},18:{n:"Application",t:Ni},19:{n:"DocSecurity",t:al},255:{},2147483648:{n:"Locale",t:Pk},2147483651:{n:"Behavior",t:Pk},1919054434:{}},sY={1:"US",2:"CA",3:"",7:"RU",20:"EG",30:"GR",31:"NL",32:"BE",33:"FR",34:"ES",36:"HU",39:"IT",41:"CH",43:"AT",44:"GB",45:"DK",46:"SE",47:"NO",48:"PL",49:"DE",52:"MX",55:"BR",61:"AU",64:"NZ",66:"TH",81:"JP",82:"KR",84:"VN",86:"CN",90:"TR",105:"JS",213:"DZ",216:"MA",218:"LY",351:"PT",354:"IS",358:"FI",420:"CZ",886:"TW",961:"LB",962:"JO",963:"SY",964:"IQ",965:"KW",966:"SA",971:"AE",972:"IL",974:"QA",981:"IR",65535:"US"},nyt=[null,"solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"];function syt(e){return e.map(function(t){return[t>>16&255,t>>8&255,t&255]})}var ayt=syt([0,16777215,16711680,65280,255,16776960,16711935,65535,0,16777215,16711680,65280,255,16776960,16711935,65535,8388608,32768,128,8421376,8388736,32896,12632256,8421504,10066431,10040166,16777164,13434879,6684774,16744576,26316,13421823,128,16711935,16776960,65535,8388736,8388608,32896,255,52479,13434879,13434828,16777113,10079487,16751052,13408767,16764057,3368703,3394764,10079232,16763904,16750848,16737792,6710937,9868950,13158,3381606,13056,3355392,10040064,10040166,3355545,3355443,16777215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),K0=xs(ayt),Eh={0:"#NULL!",7:"#DIV/0!",15:"#VALUE!",23:"#REF!",29:"#NAME?",36:"#NUM!",42:"#N/A",43:"#GETTING_DATA",255:"#WTF?"},Ehe={"#NULL!":0,"#DIV/0!":7,"#VALUE!":15,"#REF!":23,"#NAME?":29,"#NUM!":36,"#N/A":42,"#GETTING_DATA":43,"#WTF?":255},sI={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":"workbooks","application/vnd.ms-excel.sheet.macroEnabled.main+xml":"workbooks","application/vnd.ms-excel.sheet.binary.macroEnabled.main":"workbooks","application/vnd.ms-excel.addin.macroEnabled.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":"workbooks","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":"sheets","application/vnd.ms-excel.worksheet":"sheets","application/vnd.ms-excel.binIndexWs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":"charts","application/vnd.ms-excel.chartsheet":"charts","application/vnd.ms-excel.macrosheet+xml":"macros","application/vnd.ms-excel.macrosheet":"macros","application/vnd.ms-excel.intlmacrosheet":"TODO","application/vnd.ms-excel.binIndexMs":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":"dialogs","application/vnd.ms-excel.dialogsheet":"dialogs","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml":"strs","application/vnd.ms-excel.sharedStrings":"strs","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":"styles","application/vnd.ms-excel.styles":"styles","application/vnd.openxmlformats-package.core-properties+xml":"coreprops","application/vnd.openxmlformats-officedocument.custom-properties+xml":"custprops","application/vnd.openxmlformats-officedocument.extended-properties+xml":"extprops","application/vnd.openxmlformats-officedocument.customXmlProperties+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":"comments","application/vnd.ms-excel.comments":"comments","application/vnd.ms-excel.threadedcomments+xml":"threadedcomments","application/vnd.ms-excel.person+xml":"people","application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":"metadata","application/vnd.ms-excel.sheetMetadata":"metadata","application/vnd.ms-excel.pivotTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.chart+xml":"TODO","application/vnd.ms-office.chartcolorstyle+xml":"TODO","application/vnd.ms-office.chartstyle+xml":"TODO","application/vnd.ms-office.chartex+xml":"TODO","application/vnd.ms-excel.calcChain":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml":"calcchains","application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings":"TODO","application/vnd.ms-office.activeX":"TODO","application/vnd.ms-office.activeX+xml":"TODO","application/vnd.ms-excel.attachedToolbars":"TODO","application/vnd.ms-excel.connections":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":"TODO","application/vnd.ms-excel.externalLink":"links","application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":"links","application/vnd.ms-excel.pivotCacheDefinition":"TODO","application/vnd.ms-excel.pivotCacheRecords":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml":"TODO","application/vnd.ms-excel.queryTable":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml":"TODO","application/vnd.ms-excel.userNames":"TODO","application/vnd.ms-excel.revisionHeaders":"TODO","application/vnd.ms-excel.revisionLog":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml":"TODO","application/vnd.ms-excel.tableSingleCells":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml":"TODO","application/vnd.ms-excel.slicer":"TODO","application/vnd.ms-excel.slicerCache":"TODO","application/vnd.ms-excel.slicer+xml":"TODO","application/vnd.ms-excel.slicerCache+xml":"TODO","application/vnd.ms-excel.wsSortMap":"TODO","application/vnd.ms-excel.table":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":"TODO","application/vnd.openxmlformats-officedocument.theme+xml":"themes","application/vnd.openxmlformats-officedocument.themeOverride+xml":"TODO","application/vnd.ms-excel.Timeline+xml":"TODO","application/vnd.ms-excel.TimelineCache+xml":"TODO","application/vnd.ms-office.vbaProject":"vba","application/vnd.ms-office.vbaProjectSignature":"TODO","application/vnd.ms-office.volatileDependencies":"TODO","application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml":"TODO","application/vnd.ms-excel.controlproperties+xml":"TODO","application/vnd.openxmlformats-officedocument.model+data":"TODO","application/vnd.ms-excel.Survey+xml":"TODO","application/vnd.openxmlformats-officedocument.drawing+xml":"drawings","application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml":"TODO","application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml":"TODO","application/vnd.openxmlformats-officedocument.vmlDrawing":"TODO","application/vnd.openxmlformats-package.relationships+xml":"rels","application/vnd.openxmlformats-officedocument.oleObject":"TODO","image/png":"TODO",sheet:"js"},AS={workbooks:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",xlsm:"application/vnd.ms-excel.sheet.macroEnabled.main+xml",xlsb:"application/vnd.ms-excel.sheet.binary.macroEnabled.main",xlam:"application/vnd.ms-excel.addin.macroEnabled.main+xml",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml"},strs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",xlsb:"application/vnd.ms-excel.sharedStrings"},comments:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",xlsb:"application/vnd.ms-excel.comments"},sheets:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",xlsb:"application/vnd.ms-excel.worksheet"},charts:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml",xlsb:"application/vnd.ms-excel.chartsheet"},dialogs:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml",xlsb:"application/vnd.ms-excel.dialogsheet"},macros:{xlsx:"application/vnd.ms-excel.macrosheet+xml",xlsb:"application/vnd.ms-excel.macrosheet"},metadata:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",xlsb:"application/vnd.ms-excel.sheetMetadata"},styles:{xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",xlsb:"application/vnd.ms-excel.styles"}};function i7(){return{workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],rels:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],calcchains:[],vba:[],drawings:[],metadata:[],people:[],TODO:[],xmlns:""}}function iyt(e){var t=i7();if(!e||!e.match)return t;var r={};if((e.match(_o)||[]).forEach(function(n){var a=Rr(n);switch(a[0].replace(gvt,"<")){case"<?xml":break;case"<Types":t.xmlns=a["xmlns"+(a[0].match(/<(\w+):/)||["",""])[1]];break;case"<Default":r[a.Extension]=a.ContentType;break;case"<Override":t[sI[a.ContentType]]!==void 0&&t[sI[a.ContentType]].push(a.PartName);break}}),t.xmlns!==mi.CT)throw new Error("Unknown Namespace: "+t.xmlns);return t.calcchain=t.calcchains.length>0?t.calcchains[0]:"",t.sst=t.strs.length>0?t.strs[0]:"",t.style=t.styles.length>0?t.styles[0]:"",t.defaults=r,delete t.calcchains,t}function Ahe(e,t){var r=ivt(sI),n=[],a;n[n.length]=Ra,n[n.length]=Lt("Types",null,{xmlns:mi.CT,"xmlns:xsd":mi.xsd,"xmlns:xsi":mi.xsi}),n=n.concat([["xml","application/xml"],["bin","application/vnd.ms-excel.sheet.binary.macroEnabled.main"],["vml","application/vnd.openxmlformats-officedocument.vmlDrawing"],["data","application/vnd.openxmlformats-officedocument.model+data"],["bmp","image/bmp"],["png","image/png"],["gif","image/gif"],["emf","image/x-emf"],["wmf","image/x-wmf"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["tif","image/tiff"],["tiff","image/tiff"],["pdf","application/pdf"],["rels","application/vnd.openxmlformats-package.relationships+xml"]].map(function(c){return Lt("Default",null,{Extension:c[0],ContentType:c[1]})}));var i=function(c){e[c]&&e[c].length>0&&(a=e[c][0],n[n.length]=Lt("Override",null,{PartName:(a[0]=="/"?"":"/")+a,ContentType:AS[c][t.bookType]||AS[c].xlsx}))},o=function(c){(e[c]||[]).forEach(function(u){n[n.length]=Lt("Override",null,{PartName:(u[0]=="/"?"":"/")+u,ContentType:AS[c][t.bookType]||AS[c].xlsx})})},l=function(c){(e[c]||[]).forEach(function(u){n[n.length]=Lt("Override",null,{PartName:(u[0]=="/"?"":"/")+u,ContentType:r[c][0]})})};return i("workbooks"),o("sheets"),o("charts"),l("themes"),["strs","styles"].forEach(i),["coreprops","extprops","custprops"].forEach(l),l("vba"),l("comments"),l("threadedcomments"),l("drawings"),o("metadata"),l("people"),n.length>2&&(n[n.length]="</Types>",n[1]=n[1].replace("/>",">")),n.join("")}var hn={WB:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",SHEET:"http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument",HLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",VML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",XPATH:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",XMISS:"http://schemas.microsoft.com/office/2006/relationships/xlExternalLinkPath/xlPathMissing",XLINK:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",CXML:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",CXMLP:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",CMNT:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",CORE_PROPS:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",EXT_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",CUST_PROPS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",SST:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",STY:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",THEME:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",CHART:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",CHARTEX:"http://schemas.microsoft.com/office/2014/relationships/chartEx",CS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet",WS:["http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","http://purl.oclc.org/ooxml/officeDocument/relationships/worksheet"],DS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet",MS:"http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet",IMG:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",DRAW:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",XLMETA:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",TCMNT:"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",PEOPLE:"http://schemas.microsoft.com/office/2017/10/relationships/person",VBA:"http://schemas.microsoft.com/office/2006/relationships/vbaProject"};function gj(e){var t=e.lastIndexOf("/");return e.slice(0,t+1)+"_rels/"+e.slice(t+1)+".rels"}function Rw(e,t){var r={"!id":{}};if(!e)return r;t.charAt(0)!=="/"&&(t="/"+t);var n={};return(e.match(_o)||[]).forEach(function(a){var i=Rr(a);if(i[0]==="<Relationship"){var o={};o.Type=i.Type,o.Target=i.Target,o.Id=i.Id,i.TargetMode&&(o.TargetMode=i.TargetMode);var l=i.TargetMode==="External"?i.Target:Jb(i.Target,t);r[l]=o,n[i.Id]=o}}),r["!id"]=n,r}function Pv(e){var t=[Ra,Lt("Relationships",null,{xmlns:mi.RELS})];return wa(e["!id"]).forEach(function(r){t[t.length]=Lt("Relationship",null,e["!id"][r])}),t.length>2&&(t[t.length]="</Relationships>",t[1]=t[1].replace("/>",">")),t.join("")}function ts(e,t,r,n,a,i){if(a||(a={}),e["!id"]||(e["!id"]={}),e["!idx"]||(e["!idx"]=1),t<0)for(t=e["!idx"];e["!id"]["rId"+t];++t);if(e["!idx"]=t+1,a.Id="rId"+t,a.Type=n,a.Target=r,[hn.HLINK,hn.XPATH,hn.XMISS].indexOf(a.Type)>-1&&(a.TargetMode="External"),e["!id"][a.Id])throw new Error("Cannot rewrite rId "+t);return e["!id"][a.Id]=a,e[("/"+a.Target).replace("//","/")]=a,t}var oyt="application/vnd.oasis.opendocument.spreadsheet";function lyt(e,t){for(var r=HM(e),n,a;n=pj.exec(r);)switch(n[3]){case"manifest":break;case"file-entry":if(a=Rr(n[0],!1),a.path=="/"&&a.type!==oyt)throw new Error("This OpenDocument is not a spreadsheet");break;case"encryption-data":case"algorithm":case"start-key-generation":case"key-derivation":throw new Error("Unsupported ODS Encryption");default:if(t&&t.WTF)throw n}}function cyt(e){var t=[Ra];t.push(`<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">
`),t.push(` <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/>
`);for(var r=0;r<e.length;++r)t.push(' <manifest:file-entry manifest:full-path="'+e[r][0]+'" manifest:media-type="'+e[r][1]+`"/>
`);return t.push("</manifest:manifest>"),t.join("")}function aY(e,t,r){return[' <rdf:Description rdf:about="'+e+`">
`,' <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/'+(r||"odf")+"#"+t+`"/>
`,` </rdf:Description>
`].join("")}function uyt(e,t){return[' <rdf:Description rdf:about="'+e+`">
`,' <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="'+t+`"/>
`,` </rdf:Description>
`].join("")}function dyt(e){var t=[Ra];t.push(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
`);for(var r=0;r!=e.length;++r)t.push(aY(e[r][0],e[r][1])),t.push(uyt("",e[r][0]));return t.push(aY("","Document","pkg")),t.push("</rdf:RDF>"),t.join("")}function The(){return'<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.2"><office:meta><meta:generator>SheetJS '+uj.version+"</meta:generator></office:meta></office:document-meta>"}var Jc=[["cp:category","Category"],["cp:contentStatus","ContentStatus"],["cp:keywords","Keywords"],["cp:lastModifiedBy","LastAuthor"],["cp:lastPrinted","LastPrinted"],["cp:revision","RevNumber"],["cp:version","Version"],["dc:creator","Author"],["dc:description","Comments"],["dc:identifier","Identifier"],["dc:language","Language"],["dc:subject","Subject"],["dc:title","Title"],["dcterms:created","CreatedDate","date"],["dcterms:modified","ModifiedDate","date"]],fyt=function(){for(var e=new Array(Jc.length),t=0;t<Jc.length;++t){var r=Jc[t],n="(?:"+r[0].slice(0,r[0].indexOf(":"))+":)"+r[0].slice(r[0].indexOf(":")+1);e[t]=new RegExp("<"+n+"[^>]*>([\\s\\S]*?)</"+n+">")}return e}();function Phe(e){var t={};e=us(e);for(var r=0;r<Jc.length;++r){var n=Jc[r],a=e.match(fyt[r]);a!=null&&a.length>0&&(t[n[1]]=Dn(a[1])),n[2]==="date"&&t[n[1]]&&(t[n[1]]=Us(t[n[1]]))}return t}function AP(e,t,r,n,a){a[e]!=null||t==null||t===""||(a[e]=t,t=ns(t),n[n.length]=r?Lt(e,t,r):Yi(e,t))}function Ohe(e,t){var r=t||{},n=[Ra,Lt("cp:coreProperties",null,{"xmlns:cp":mi.CORE_PROPS,"xmlns:dc":mi.dc,"xmlns:dcterms":mi.dcterms,"xmlns:dcmitype":mi.dcmitype,"xmlns:xsi":mi.xsi})],a={};if(!e&&!r.Props)return n.join("");e&&(e.CreatedDate!=null&&AP("dcterms:created",typeof e.CreatedDate=="string"?e.CreatedDate:eI(e.CreatedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a),e.ModifiedDate!=null&&AP("dcterms:modified",typeof e.ModifiedDate=="string"?e.ModifiedDate:eI(e.ModifiedDate,r.WTF),{"xsi:type":"dcterms:W3CDTF"},n,a));for(var i=0;i!=Jc.length;++i){var o=Jc[i],l=r.Props&&r.Props[o[1]]!=null?r.Props[o[1]]:e?e[o[1]]:null;l===!0?l="1":l===!1?l="0":typeof l=="number"&&(l=String(l)),l!=null&&AP(o[0],l,null,n,a)}return n.length>2&&(n[n.length]="</cp:coreProperties>",n[1]=n[1].replace("/>",">")),n.join("")}var Y0=[["Application","Application","string"],["AppVersion","AppVersion","string"],["Company","Company","string"],["DocSecurity","DocSecurity","string"],["Manager","Manager","string"],["HyperlinksChanged","HyperlinksChanged","bool"],["SharedDoc","SharedDoc","bool"],["LinksUpToDate","LinksUpToDate","bool"],["ScaleCrop","ScaleCrop","bool"],["HeadingPairs","HeadingPairs","raw"],["TitlesOfParts","TitlesOfParts","raw"]],Dhe=["Worksheets","SheetNames","NamedRanges","DefinedNames","Chartsheets","ChartNames"];function Ihe(e,t,r,n){var a=[];if(typeof e=="string")a=YK(e,n);else for(var i=0;i<e.length;++i)a=a.concat(e[i].map(function(d){return{v:d}}));var o=typeof t=="string"?YK(t,n).map(function(d){return d.v}):t,l=0,c=0;if(o.length>0)for(var u=0;u!==a.length;u+=2){switch(c=+a[u+1].v,a[u].v){case"Worksheets":case"工作表":case"Листы":case"أوراق العمل":case"ワークシート":case"גליונות עבודה":case"Arbeitsblätter":case"Çalışma Sayfaları":case"Feuilles de calcul":case"Fogli di lavoro":case"Folhas de cálculo":case"Planilhas":case"Regneark":case"Hojas de cálculo":case"Werkbladen":r.Worksheets=c,r.SheetNames=o.slice(l,l+c);break;case"Named Ranges":case"Rangos con nombre":case"名前付き一覧":case"Benannte Bereiche":case"Navngivne områder":r.NamedRanges=c,r.DefinedNames=o.slice(l,l+c);break;case"Charts":case"Diagramme":r.Chartsheets=c,r.ChartNames=o.slice(l,l+c);break}l+=c}}function hyt(e,t,r){var n={};return t||(t={}),e=us(e),Y0.forEach(function(a){var i=(e.match(hj(a[0]))||[])[1];switch(a[2]){case"string":i&&(t[a[1]]=Dn(i));break;case"bool":t[a[1]]=i==="true";break;case"raw":var o=e.match(new RegExp("<"+a[0]+"[^>]*>([\\s\\S]*?)</"+a[0]+">"));o&&o.length>0&&(n[a[1]]=o[1]);break}}),n.HeadingPairs&&n.TitlesOfParts&&Ihe(n.HeadingPairs,n.TitlesOfParts,t,r),t}function Rhe(e){var t=[],r=Lt;return e||(e={}),e.Application="SheetJS",t[t.length]=Ra,t[t.length]=Lt("Properties",null,{xmlns:mi.EXT_PROPS,"xmlns:vt":mi.vt}),Y0.forEach(function(n){if(e[n[1]]!==void 0){var a;switch(n[2]){case"string":a=ns(String(e[n[1]]));break;case"bool":a=e[n[1]]?"true":"false";break}a!==void 0&&(t[t.length]=r(n[0],a))}}),t[t.length]=r("HeadingPairs",r("vt:vector",r("vt:variant","<vt:lpstr>Worksheets</vt:lpstr>")+r("vt:variant",r("vt:i4",String(e.Worksheets))),{size:2,baseType:"variant"})),t[t.length]=r("TitlesOfParts",r("vt:vector",e.SheetNames.map(function(n){return"<vt:lpstr>"+ns(n)+"</vt:lpstr>"}).join(""),{size:e.Worksheets,baseType:"lpstr"})),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var myt=/<[^>]+>[^<]*/g;function pyt(e,t){var r={},n="",a=e.match(myt);if(a)for(var i=0;i!=a.length;++i){var o=a[i],l=Rr(o);switch(l[0]){case"<?xml":break;case"<Properties":break;case"<property":n=Dn(l.name);break;case"</property>":n=null;break;default:if(o.indexOf("<vt:")===0){var c=o.split(">"),u=c[0].slice(4),d=c[1];switch(u){case"lpstr":case"bstr":case"lpwstr":r[n]=Dn(d);break;case"bool":r[n]=Ls(d);break;case"i1":case"i2":case"i4":case"i8":case"int":case"uint":r[n]=parseInt(d,10);break;case"r4":case"r8":case"decimal":r[n]=parseFloat(d);break;case"filetime":case"date":r[n]=Us(d);break;case"cy":case"error":r[n]=Dn(d);break;default:if(u.slice(-1)=="/")break;t.WTF&&typeof console<"u"&&console.warn("Unexpected",o,u,c)}}else if(o.slice(0,2)!=="</"){if(t.WTF)throw new Error(o)}}}return r}function Lhe(e){var t=[Ra,Lt("Properties",null,{xmlns:mi.CUST_PROPS,"xmlns:vt":mi.vt})];if(!e)return t.join("");var r=1;return wa(e).forEach(function(a){++r,t[t.length]=Lt("property",Nvt(e[a]),{fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:r,name:ns(a)})}),t.length>2&&(t[t.length]="</Properties>",t[1]=t[1].replace("/>",">")),t.join("")}var aI={Title:"Title",Subject:"Subject",Author:"Author",Keywords:"Keywords",Comments:"Description",LastAuthor:"LastAuthor",RevNumber:"Revision",Application:"AppName",LastPrinted:"LastPrinted",CreatedDate:"Created",ModifiedDate:"LastSaved",Category:"Category",Manager:"Manager",Company:"Company",AppVersion:"Version",ContentStatus:"ContentStatus",Identifier:"Identifier",Language:"Language"},TP;function gyt(e,t,r){TP||(TP=iA(aI)),t=TP[t]||t,e[t]=r}function xyt(e,t){var r=[];return wa(aI).map(function(n){for(var a=0;a<Jc.length;++a)if(Jc[a][1]==n)return Jc[a];for(a=0;a<Y0.length;++a)if(Y0[a][1]==n)return Y0[a];throw n}).forEach(function(n){if(e[n[1]]!=null){var a=t&&t.Props&&t.Props[n[1]]!=null?t.Props[n[1]]:e[n[1]];switch(n[2]){case"date":a=new Date(a).toISOString().replace(/\.\d*Z/,"Z");break}typeof a=="number"?a=String(a):a===!0||a===!1?a=a?"1":"0":a instanceof Date&&(a=new Date(a).toISOString().replace(/\.\d*Z/,"")),r.push(Yi(aI[n[1]]||n[1],a))}}),Lt("DocumentProperties",r.join(""),{xmlns:zl.o})}function vyt(e,t){var r=["Worksheets","SheetNames"],n="CustomDocumentProperties",a=[];return e&&wa(e).forEach(function(i){if(Object.prototype.hasOwnProperty.call(e,i)){for(var o=0;o<Jc.length;++o)if(i==Jc[o][1])return;for(o=0;o<Y0.length;++o)if(i==Y0[o][1])return;for(o=0;o<r.length;++o)if(i==r[o])return;var l=e[i],c="string";typeof l=="number"?(c="float",l=String(l)):l===!0||l===!1?(c="boolean",l=l?"1":"0"):l=String(l),a.push(Lt(WK(i),l,{"dt:dt":c}))}}),t&&wa(t).forEach(function(i){if(Object.prototype.hasOwnProperty.call(t,i)&&!(e&&Object.prototype.hasOwnProperty.call(e,i))){var o=t[i],l="string";typeof o=="number"?(l="float",o=String(o)):o===!0||o===!1?(l="boolean",o=o?"1":"0"):o instanceof Date?(l="dateTime.tz",o=o.toISOString()):o=String(o),a.push(Lt(WK(i),o,{"dt:dt":l}))}}),"<"+n+' xmlns="'+zl.o+'">'+a.join("")+"</"+n+">"}function o7(e){var t=e.read_shift(4),r=e.read_shift(4);return new Date((r/1e7*Math.pow(2,32)+t/1e7-11644473600)*1e3).toISOString().replace(/\.000/,"")}function yyt(e){var t=typeof e=="string"?new Date(Date.parse(e)):e,r=t.getTime()/1e3+11644473600,n=r%Math.pow(2,32),a=(r-n)/Math.pow(2,32);n*=1e7,a*=1e7;var i=n/Math.pow(2,32)|0;i>0&&(n=n%Math.pow(2,32),a+=i);var o=lt(8);return o.write_shift(4,n),o.write_shift(4,a),o}function Fhe(e,t,r){var n=e.l,a=e.read_shift(0,"lpstr-cp");if(r)for(;e.l-n&3;)++e.l;return a}function Mhe(e,t,r){var n=e.read_shift(0,"lpwstr");return n}function $he(e,t,r){return t===31?Mhe(e):Fhe(e,t,r)}function iI(e,t,r){return $he(e,t,r===!1?0:4)}function byt(e,t){if(!t)throw new Error("VtUnalignedString must have positive length");return $he(e,t,0)}function wyt(e){for(var t=e.read_shift(4),r=[],n=0;n!=t;++n){var a=e.l;r[n]=e.read_shift(0,"lpwstr").replace(go,""),e.l-a&2&&(e.l+=2)}return r}function jyt(e){for(var t=e.read_shift(4),r=[],n=0;n!=t;++n)r[n]=e.read_shift(0,"lpstr-cp").replace(go,"");return r}function _yt(e){var t=e.l,r=Ok(e,Che);e[e.l]==0&&e[e.l+1]==0&&e.l-t&2&&(e.l+=2);var n=Ok(e,al);return[r,n]}function Nyt(e){for(var t=e.read_shift(4),r=[],n=0;n<t/2;++n)r.push(_yt(e));return r}function iY(e,t){for(var r=e.read_shift(4),n={},a=0;a!=r;++a){var i=e.read_shift(4),o=e.read_shift(4);n[i]=e.read_shift(o,t===1200?"utf16le":"utf8").replace(go,"").replace(Zb,"!"),t===1200&&o%2&&(e.l+=2)}return e.l&3&&(e.l=e.l>>3<<2),n}function Bhe(e){var t=e.read_shift(4),r=e.slice(e.l,e.l+t);return e.l+=t,(t&3)>0&&(e.l+=4-(t&3)&3),r}function Syt(e){var t={};return t.Size=e.read_shift(4),e.l+=t.Size+3-(t.Size-1)%4,t}function Ok(e,t,r){var n=e.read_shift(2),a,i=r||{};if(e.l+=2,t!==nY&&n!==t&&ryt.indexOf(t)===-1&&!((t&65534)==4126&&(n&65534)==4126))throw new Error("Expected type "+t+" saw "+n);switch(t===nY?n:t){case 2:return a=e.read_shift(2,"i"),i.raw||(e.l+=2),a;case 3:return a=e.read_shift(4,"i"),a;case 11:return e.read_shift(4)!==0;case 19:return a=e.read_shift(4),a;case 30:return Fhe(e,n,4).replace(go,"");case 31:return Mhe(e);case 64:return o7(e);case 65:return Bhe(e);case 71:return Syt(e);case 80:return iI(e,n,!i.raw).replace(go,"");case 81:return byt(e,n).replace(go,"");case 4108:return Nyt(e);case 4126:case 4127:return n==4127?wyt(e):jyt(e);default:throw new Error("TypedPropertyValue unrecognized type "+t+" "+n)}}function oY(e,t){var r=lt(4),n=lt(4);switch(r.write_shift(4,e==80?31:e),e){case 3:n.write_shift(-4,t);break;case 5:n=lt(8),n.write_shift(8,t,"f");break;case 11:n.write_shift(4,t?1:0);break;case 64:n=yyt(t);break;case 31:case 80:for(n=lt(4+2*(t.length+1)+(t.length%2?0:2)),n.write_shift(4,t.length+1),n.write_shift(0,t,"dbcs");n.l!=n.length;)n.write_shift(1,0);break;default:throw new Error("TypedPropertyValue unrecognized type "+e+" "+t)}return Ti([r,n])}function lY(e,t){var r=e.l,n=e.read_shift(4),a=e.read_shift(4),i=[],o=0,l=0,c=-1,u={};for(o=0;o!=a;++o){var d=e.read_shift(4),f=e.read_shift(4);i[o]=[d,f+r]}i.sort(function(b,y){return b[1]-y[1]});var m={};for(o=0;o!=a;++o){if(e.l!==i[o][1]){var h=!0;if(o>0&&t)switch(t[i[o-1][0]].t){case 2:e.l+2===i[o][1]&&(e.l+=2,h=!1);break;case 80:e.l<=i[o][1]&&(e.l=i[o][1],h=!1);break;case 4108:e.l<=i[o][1]&&(e.l=i[o][1],h=!1);break}if((!t||o==0)&&e.l<=i[o][1]&&(h=!1,e.l=i[o][1]),h)throw new Error("Read Error: Expected address "+i[o][1]+" at "+e.l+" :"+o)}if(t){var g=t[i[o][0]];if(m[g.n]=Ok(e,g.t,{raw:!0}),g.p==="version"&&(m[g.n]=String(m[g.n]>>16)+"."+("0000"+String(m[g.n]&65535)).slice(-4)),g.n=="CodePage")switch(m[g.n]){case 0:m[g.n]=1252;case 874:case 932:case 936:case 949:case 950:case 1250:case 1251:case 1253:case 1254:case 1255:case 1256:case 1257:case 1258:case 1e4:case 1200:case 1201:case 1252:case 65e3:case-536:case 65001:case-535:Uc(l=m[g.n]>>>0&65535);break;default:throw new Error("Unsupported CodePage: "+m[g.n])}}else if(i[o][0]===1){if(l=m.CodePage=Ok(e,a7),Uc(l),c!==-1){var p=e.l;e.l=i[c][1],u=iY(e,l),e.l=p}}else if(i[o][0]===0){if(l===0){c=o,e.l=i[o+1][1];continue}u=iY(e,l)}else{var x=u[i[o][0]],v;switch(e[e.l]){case 65:e.l+=4,v=Bhe(e);break;case 30:e.l+=4,v=iI(e,e[e.l-4]).replace(/\u0000+$/,"");break;case 31:e.l+=4,v=iI(e,e[e.l-4]).replace(/\u0000+$/,"");break;case 3:e.l+=4,v=e.read_shift(4,"i");break;case 19:e.l+=4,v=e.read_shift(4);break;case 5:e.l+=4,v=e.read_shift(8,"f");break;case 11:e.l+=4,v=Ca(e,4);break;case 64:e.l+=4,v=Us(o7(e));break;default:throw new Error("unparsed value: "+e[e.l])}m[x]=v}}return e.l=r+n,m}var zhe=["CodePage","Thumbnail","_PID_LINKBASE","_PID_HLINKS","SystemIdentifier","FMTID"];function kyt(e){switch(typeof e){case"boolean":return 11;case"number":return(e|0)==e?3:5;case"string":return 31;case"object":if(e instanceof Date)return 64;break}return-1}function cY(e,t,r){var n=lt(8),a=[],i=[],o=8,l=0,c=lt(8),u=lt(8);if(c.write_shift(4,2),c.write_shift(4,1200),u.write_shift(4,1),i.push(c),a.push(u),o+=8+c.length,!t){u=lt(8),u.write_shift(4,0),a.unshift(u);var d=[lt(4)];for(d[0].write_shift(4,e.length),l=0;l<e.length;++l){var f=e[l][0];for(c=lt(8+2*(f.length+1)+(f.length%2?0:2)),c.write_shift(4,l+2),c.write_shift(4,f.length+1),c.write_shift(0,f,"dbcs");c.l!=c.length;)c.write_shift(1,0);d.push(c)}c=Ti(d),i.unshift(c),o+=8+c.length}for(l=0;l<e.length;++l)if(!(t&&!t[e[l][0]])&&!(zhe.indexOf(e[l][0])>-1||Dhe.indexOf(e[l][0])>-1)&&e[l][1]!=null){var m=e[l][1],h=0;if(t){h=+t[e[l][0]];var g=r[h];if(g.p=="version"&&typeof m=="string"){var p=m.split(".");m=(+p[0]<<16)+(+p[1]||0)}c=oY(g.t,m)}else{var x=kyt(m);x==-1&&(x=31,m=String(m)),c=oY(x,m)}i.push(c),u=lt(8),u.write_shift(4,t?h:2+l),a.push(u),o+=8+c.length}var v=8*(i.length+1);for(l=0;l<i.length;++l)a[l].write_shift(4,v),v+=i[l].length;return n.write_shift(4,o),n.write_shift(4,i.length),Ti([n].concat(a).concat(i))}function uY(e,t,r){var n=e.content;if(!n)return{};Ki(n,0);var a,i,o,l,c=0;n.chk("feff","Byte Order: "),n.read_shift(2);var u=n.read_shift(4),d=n.read_shift(16);if(d!==vr.utils.consts.HEADER_CLSID&&d!==r)throw new Error("Bad PropertySet CLSID "+d);if(a=n.read_shift(4),a!==1&&a!==2)throw new Error("Unrecognized #Sets: "+a);if(i=n.read_shift(16),l=n.read_shift(4),a===1&&l!==n.l)throw new Error("Length mismatch: "+l+" !== "+n.l);a===2&&(o=n.read_shift(16),c=n.read_shift(4));var f=lY(n,t),m={SystemIdentifier:u};for(var h in f)m[h]=f[h];if(m.FMTID=i,a===1)return m;if(c-n.l==2&&(n.l+=2),n.l!==c)throw new Error("Length mismatch 2: "+n.l+" !== "+c);var g;try{g=lY(n,null)}catch{}for(h in g)m[h]=g[h];return m.FMTID=[i,o],m}function dY(e,t,r,n,a,i){var o=lt(a?68:48),l=[o];o.write_shift(2,65534),o.write_shift(2,0),o.write_shift(4,842412599),o.write_shift(16,vr.utils.consts.HEADER_CLSID,"hex"),o.write_shift(4,a?2:1),o.write_shift(16,t,"hex"),o.write_shift(4,a?68:48);var c=cY(e,r,n);if(l.push(c),a){var u=cY(a,null,null);o.write_shift(16,i,"hex"),o.write_shift(4,68+c.length),l.push(u)}return Ti(l)}function em(e,t){return e.read_shift(t),null}function Cyt(e,t){t||(t=lt(e));for(var r=0;r<e;++r)t.write_shift(1,0);return t}function Eyt(e,t,r){for(var n=[],a=e.l+t;e.l<a;)n.push(r(e,a-e.l));if(a!==e.l)throw new Error("Slurp error");return n}function Ca(e,t){return e.read_shift(t)===1}function Io(e,t){return t||(t=lt(2)),t.write_shift(2,+!!e),t}function Va(e){return e.read_shift(2,"u")}function Cc(e,t){return t||(t=lt(2)),t.write_shift(2,e),t}function Uhe(e,t){return Eyt(e,t,Va)}function Ayt(e){var t=e.read_shift(1),r=e.read_shift(1);return r===1?t:t===1}function qhe(e,t,r){return r||(r=lt(2)),r.write_shift(1,t=="e"?+e:+!!e),r.write_shift(1,t=="e"?1:0),r}function j_(e,t,r){var n=e.read_shift(r&&r.biff>=12?2:1),a="sbcs-cont",i=tc;if(r&&r.biff>=8&&(tc=1200),!r||r.biff==8){var o=e.read_shift(1);o&&(a="dbcs-cont")}else r.biff==12&&(a="wstr");r.biff>=2&&r.biff<=5&&(a="cpstr");var l=n?e.read_shift(n,a):"";return tc=i,l}function Tyt(e){var t=tc;tc=1200;var r=e.read_shift(2),n=e.read_shift(1),a=n&4,i=n&8,o=1+(n&1),l=0,c,u={};i&&(l=e.read_shift(2)),a&&(c=e.read_shift(4));var d=o==2?"dbcs-cont":"sbcs-cont",f=r===0?"":e.read_shift(r,d);return i&&(e.l+=4*l),a&&(e.l+=c),u.t=f,i||(u.raw="<t>"+u.t+"</t>",u.r=u.t),tc=t,u}function Pyt(e){var t=e.t||"",r=lt(3);r.write_shift(2,t.length),r.write_shift(1,1);var n=lt(2*t.length);n.write_shift(2*t.length,t,"utf16le");var a=[r,n];return Ti(a)}function kg(e,t,r){var n;if(r){if(r.biff>=2&&r.biff<=5)return e.read_shift(t,"cpstr");if(r.biff>=12)return e.read_shift(t,"dbcs-cont")}var a=e.read_shift(1);return a===0?n=e.read_shift(t,"sbcs-cont"):n=e.read_shift(t,"dbcs-cont"),n}function __(e,t,r){var n=e.read_shift(r&&r.biff==2?1:2);return n===0?(e.l++,""):kg(e,n,r)}function Qg(e,t,r){if(r.biff>5)return __(e,t,r);var n=e.read_shift(1);return n===0?(e.l++,""):e.read_shift(n,r.biff<=4||!e.lens?"cpstr":"sbcs-cont")}function Vhe(e,t,r){return r||(r=lt(3+2*e.length)),r.write_shift(2,e.length),r.write_shift(1,1),r.write_shift(31,e,"utf16le"),r}function Oyt(e){var t=e.read_shift(1);e.l++;var r=e.read_shift(2);return e.l+=2,[t,r]}function Dyt(e){var t=e.read_shift(4),r=e.l,n=!1;t>24&&(e.l+=t-24,e.read_shift(16)==="795881f43b1d7f48af2c825dc4852763"&&(n=!0),e.l=r);var a=e.read_shift((n?t-24:t)>>1,"utf16le").replace(go,"");return n&&(e.l+=24),a}function Iyt(e){for(var t=e.read_shift(2),r="";t-- >0;)r+="../";var n=e.read_shift(0,"lpstr-ansi");if(e.l+=2,e.read_shift(2)!=57005)throw new Error("Bad FileMoniker");var a=e.read_shift(4);if(a===0)return r+n.replace(/\\/g,"/");var i=e.read_shift(4);if(e.read_shift(2)!=3)throw new Error("Bad FileMoniker");var o=e.read_shift(i>>1,"utf16le").replace(go,"");return r+o}function Ryt(e,t){var r=e.read_shift(16);switch(r){case"e0c9ea79f9bace118c8200aa004ba90b":return Dyt(e);case"0303000000000000c000000000000046":return Iyt(e);default:throw new Error("Unsupported Moniker "+r)}}function TS(e){var t=e.read_shift(4),r=t>0?e.read_shift(t,"utf16le").replace(go,""):"";return r}function fY(e,t){t||(t=lt(6+e.length*2)),t.write_shift(4,1+e.length);for(var r=0;r<e.length;++r)t.write_shift(2,e.charCodeAt(r));return t.write_shift(2,0),t}function Lyt(e,t){var r=e.l+t,n=e.read_shift(4);if(n!==2)throw new Error("Unrecognized streamVersion: "+n);var a=e.read_shift(2);e.l+=2;var i,o,l,c,u="",d,f;a&16&&(i=TS(e,r-e.l)),a&128&&(o=TS(e,r-e.l)),(a&257)===257&&(l=TS(e,r-e.l)),(a&257)===1&&(c=Ryt(e,r-e.l)),a&8&&(u=TS(e,r-e.l)),a&32&&(d=e.read_shift(16)),a&64&&(f=o7(e)),e.l=r;var m=o||l||c||"";m&&u&&(m+="#"+u),m||(m="#"+u),a&2&&m.charAt(0)=="/"&&m.charAt(1)!="/"&&(m="file://"+m);var h={Target:m};return d&&(h.guid=d),f&&(h.time=f),i&&(h.Tooltip=i),h}function Fyt(e){var t=lt(512),r=0,n=e.Target;n.slice(0,7)=="file://"&&(n=n.slice(7));var a=n.indexOf("#"),i=a>-1?31:23;switch(n.charAt(0)){case"#":i=28;break;case".":i&=-3;break}t.write_shift(4,2),t.write_shift(4,i);var o=[8,6815827,6619237,4849780,83];for(r=0;r<o.length;++r)t.write_shift(4,o[r]);if(i==28)n=n.slice(1),fY(n,t);else if(i&2){for(o="e0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),r=0;r<o.length;++r)t.write_shift(1,parseInt(o[r],16));var l=a>-1?n.slice(0,a):n;for(t.write_shift(4,2*(l.length+1)),r=0;r<l.length;++r)t.write_shift(2,l.charCodeAt(r));t.write_shift(2,0),i&8&&fY(a>-1?n.slice(a+1):"",t)}else{for(o="03 03 00 00 00 00 00 00 c0 00 00 00 00 00 00 46".split(" "),r=0;r<o.length;++r)t.write_shift(1,parseInt(o[r],16));for(var c=0;n.slice(c*3,c*3+3)=="../"||n.slice(c*3,c*3+3)=="..\\";)++c;for(t.write_shift(2,c),t.write_shift(4,n.length-3*c+1),r=0;r<n.length-3*c;++r)t.write_shift(1,n.charCodeAt(r+3*c)&255);for(t.write_shift(1,0),t.write_shift(2,65535),t.write_shift(2,57005),r=0;r<6;++r)t.write_shift(4,0)}return t.slice(0,t.l)}function Whe(e){var t=e.read_shift(1),r=e.read_shift(1),n=e.read_shift(1),a=e.read_shift(1);return[t,r,n,a]}function Hhe(e,t){var r=Whe(e);return r[3]=0,r}function ff(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2);return{r:t,c:r,ixfe:n}}function Cg(e,t,r,n){return n||(n=lt(6)),n.write_shift(2,e),n.write_shift(2,t),n.write_shift(2,r||0),n}function Myt(e){var t=e.read_shift(2),r=e.read_shift(2);return e.l+=8,{type:t,flags:r}}function $yt(e,t,r){return t===0?"":Qg(e,t,r)}function Byt(e,t,r){var n=r.biff>8?4:2,a=e.read_shift(n),i=e.read_shift(n,"i"),o=e.read_shift(n,"i");return[a,i,o]}function Ghe(e){var t=e.read_shift(2),r=s7(e);return[t,r]}function zyt(e,t,r){e.l+=4,t-=4;var n=e.l+t,a=j_(e,t,r),i=e.read_shift(2);if(n-=e.l,i!==n)throw new Error("Malformed AddinUdf: padding = "+n+" != "+i);return e.l+=i,a}function uA(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2),a=e.read_shift(2);return{s:{c:n,r:t},e:{c:a,r}}}function Khe(e,t){return t||(t=lt(8)),t.write_shift(2,e.s.r),t.write_shift(2,e.e.r),t.write_shift(2,e.s.c),t.write_shift(2,e.e.c),t}function Yhe(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(1),a=e.read_shift(1);return{s:{c:n,r:t},e:{c:a,r}}}var Uyt=Yhe;function Xhe(e){e.l+=4;var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2);return e.l+=12,[r,t,n]}function qyt(e){var t={};return e.l+=4,e.l+=16,t.fSharedNote=e.read_shift(2),e.l+=4,t}function Vyt(e){var t={};return e.l+=4,e.cf=e.read_shift(2),t}function ao(e){e.l+=2,e.l+=e.read_shift(2)}var Wyt={0:ao,4:ao,5:ao,6:ao,7:Vyt,8:ao,9:ao,10:ao,11:ao,12:ao,13:qyt,14:ao,15:ao,16:ao,17:ao,18:ao,19:ao,20:ao,21:Xhe};function Hyt(e,t){for(var r=e.l+t,n=[];e.l<r;){var a=e.read_shift(2);e.l-=2;try{n.push(Wyt[a](e,r-e.l))}catch{return e.l=r,n}}return e.l!=r&&(e.l=r),n}function PS(e,t){var r={BIFFVer:0,dt:0};switch(r.BIFFVer=e.read_shift(2),t-=2,t>=2&&(r.dt=e.read_shift(2),e.l-=2),r.BIFFVer){case 1536:case 1280:case 1024:case 768:case 512:case 2:case 7:break;default:if(t>6)throw new Error("Unexpected BIFF Ver "+r.BIFFVer)}return e.read_shift(t),r}function l7(e,t,r){var n=1536,a=16;switch(r.bookType){case"biff8":break;case"biff5":n=1280,a=8;break;case"biff4":n=4,a=6;break;case"biff3":n=3,a=6;break;case"biff2":n=2,a=4;break;case"xla":break;default:throw new Error("unsupported BIFF version")}var i=lt(a);return i.write_shift(2,n),i.write_shift(2,t),a>4&&i.write_shift(2,29282),a>6&&i.write_shift(2,1997),a>8&&(i.write_shift(2,49161),i.write_shift(2,1),i.write_shift(2,1798),i.write_shift(2,0)),i}function Gyt(e,t){return t===0||e.read_shift(2),1200}function Kyt(e,t,r){if(r.enc)return e.l+=t,"";var n=e.l,a=Qg(e,0,r);return e.read_shift(t+n-e.l),a}function Yyt(e,t){var r=!t||t.biff==8,n=lt(r?112:54);for(n.write_shift(t.biff==8?2:1,7),r&&n.write_shift(1,0),n.write_shift(4,859007059),n.write_shift(4,5458548|(r?0:536870912));n.l<n.length;)n.write_shift(1,r?0:32);return n}function Xyt(e,t,r){var n=r&&r.biff==8||t==2?e.read_shift(2):(e.l+=t,0);return{fDialog:n&16,fBelow:n&64,fRight:n&128}}function Zyt(e,t,r){var n=e.read_shift(4),a=e.read_shift(1)&3,i=e.read_shift(1);switch(i){case 0:i="Worksheet";break;case 1:i="Macrosheet";break;case 2:i="Chartsheet";break;case 6:i="VBAModule";break}var o=j_(e,0,r);return o.length===0&&(o="Sheet1"),{pos:n,hs:a,dt:i,name:o}}function Jyt(e,t){var r=!t||t.biff>=8?2:1,n=lt(8+r*e.name.length);n.write_shift(4,e.pos),n.write_shift(1,e.hs||0),n.write_shift(1,e.dt),n.write_shift(1,e.name.length),t.biff>=8&&n.write_shift(1,1),n.write_shift(r*e.name.length,e.name,t.biff<8?"sbcs":"utf16le");var a=n.slice(0,n.l);return a.l=n.l,a}function Qyt(e,t){for(var r=e.l+t,n=e.read_shift(4),a=e.read_shift(4),i=[],o=0;o!=a&&e.l<r;++o)i.push(Tyt(e));return i.Count=n,i.Unique=a,i}function e1t(e,t){var r=lt(8);r.write_shift(4,e.Count),r.write_shift(4,e.Unique);for(var n=[],a=0;a<e.length;++a)n[a]=Pyt(e[a]);var i=Ti([r].concat(n));return i.parts=[r.length].concat(n.map(function(o){return o.length})),i}function t1t(e,t){var r={};return r.dsst=e.read_shift(2),e.l+=t-2,r}function r1t(e){var t={};t.r=e.read_shift(2),t.c=e.read_shift(2),t.cnt=e.read_shift(2)-t.c;var r=e.read_shift(2);e.l+=4;var n=e.read_shift(1);return e.l+=3,n&7&&(t.level=n&7),n&32&&(t.hidden=!0),n&64&&(t.hpt=r/20),t}function n1t(e){var t=Myt(e);if(t.type!=2211)throw new Error("Invalid Future Record "+t.type);var r=e.read_shift(4);return r!==0}function s1t(e){return e.read_shift(2),e.read_shift(4)}function hY(e,t,r){var n=0;r&&r.biff==2||(n=e.read_shift(2));var a=e.read_shift(2);r&&r.biff==2&&(n=1-(a>>15),a&=32767);var i={Unsynced:n&1,DyZero:(n&2)>>1,ExAsc:(n&4)>>2,ExDsc:(n&8)>>3};return[i,a]}function a1t(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(2),a=e.read_shift(2),i=e.read_shift(2),o=e.read_shift(2),l=e.read_shift(2),c=e.read_shift(2),u=e.read_shift(2);return{Pos:[t,r],Dim:[n,a],Flags:i,CurTab:o,FirstTab:l,Selected:c,TabRatio:u}}function i1t(){var e=lt(18);return e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,29280),e.write_shift(2,17600),e.write_shift(2,56),e.write_shift(2,0),e.write_shift(2,0),e.write_shift(2,1),e.write_shift(2,500),e}function o1t(e,t,r){if(r&&r.biff>=2&&r.biff<5)return{};var n=e.read_shift(2);return{RTL:n&64}}function l1t(e){var t=lt(18),r=1718;return e&&e.RTL&&(r|=64),t.write_shift(2,r),t.write_shift(4,0),t.write_shift(4,64),t.write_shift(4,0),t.write_shift(4,0),t}function c1t(){}function u1t(e,t,r){var n={dyHeight:e.read_shift(2),fl:e.read_shift(2)};switch(r&&r.biff||8){case 2:break;case 3:case 4:e.l+=2;break;default:e.l+=10;break}return n.name=j_(e,0,r),n}function d1t(e,t){var r=e.name||"Arial",n=t&&t.biff==5,a=n?15+r.length:16+2*r.length,i=lt(a);return i.write_shift(2,e.sz*20),i.write_shift(4,0),i.write_shift(2,400),i.write_shift(4,0),i.write_shift(2,0),i.write_shift(1,r.length),n||i.write_shift(1,1),i.write_shift((n?1:2)*r.length,r,n?"sbcs":"utf16le"),i}function f1t(e){var t=ff(e);return t.isst=e.read_shift(4),t}function h1t(e,t,r,n){var a=lt(10);return Cg(e,t,n,a),a.write_shift(4,r),a}function m1t(e,t,r){r.biffguess&&r.biff==2&&(r.biff=5);var n=e.l+t,a=ff(e);r.biff==2&&e.l++;var i=__(e,n-e.l,r);return a.val=i,a}function p1t(e,t,r,n,a){var i=!a||a.biff==8,o=lt(8+ +i+(1+i)*r.length);return Cg(e,t,n,o),o.write_shift(2,r.length),i&&o.write_shift(1,1),o.write_shift((1+i)*r.length,r,i?"utf16le":"sbcs"),o}function g1t(e,t,r){var n=e.read_shift(2),a=Qg(e,0,r);return[n,a]}function x1t(e,t,r,n){var a=r&&r.biff==5;n||(n=lt(a?3+t.length:5+2*t.length)),n.write_shift(2,e),n.write_shift(a?1:2,t.length),a||n.write_shift(1,1),n.write_shift((a?1:2)*t.length,t,a?"sbcs":"utf16le");var i=n.length>n.l?n.slice(0,n.l):n;return i.l==null&&(i.l=i.length),i}var v1t=Qg;function mY(e,t,r){var n=e.l+t,a=r.biff==8||!r.biff?4:2,i=e.read_shift(a),o=e.read_shift(a),l=e.read_shift(2),c=e.read_shift(2);return e.l=n,{s:{r:i,c:l},e:{r:o,c}}}function y1t(e,t){var r=t.biff==8||!t.biff?4:2,n=lt(2*r+6);return n.write_shift(r,e.s.r),n.write_shift(r,e.e.r+1),n.write_shift(2,e.s.c),n.write_shift(2,e.e.c+1),n.write_shift(2,0),n}function b1t(e){var t=e.read_shift(2),r=e.read_shift(2),n=Ghe(e);return{r:t,c:r,ixfe:n[0],rknum:n[1]}}function w1t(e,t){for(var r=e.l+t-2,n=e.read_shift(2),a=e.read_shift(2),i=[];e.l<r;)i.push(Ghe(e));if(e.l!==r)throw new Error("MulRK read error");var o=e.read_shift(2);if(i.length!=o-a+1)throw new Error("MulRK length mismatch");return{r:n,c:a,C:o,rkrec:i}}function j1t(e,t){for(var r=e.l+t-2,n=e.read_shift(2),a=e.read_shift(2),i=[];e.l<r;)i.push(e.read_shift(2));if(e.l!==r)throw new Error("MulBlank read error");var o=e.read_shift(2);if(i.length!=o-a+1)throw new Error("MulBlank length mismatch");return{r:n,c:a,C:o,ixfe:i}}function _1t(e,t,r,n){var a={},i=e.read_shift(4),o=e.read_shift(4),l=e.read_shift(4),c=e.read_shift(2);return a.patternType=nyt[l>>26],n.cellStyles&&(a.alc=i&7,a.fWrap=i>>3&1,a.alcV=i>>4&7,a.fJustLast=i>>7&1,a.trot=i>>8&255,a.cIndent=i>>16&15,a.fShrinkToFit=i>>20&1,a.iReadOrder=i>>22&2,a.fAtrNum=i>>26&1,a.fAtrFnt=i>>27&1,a.fAtrAlc=i>>28&1,a.fAtrBdr=i>>29&1,a.fAtrPat=i>>30&1,a.fAtrProt=i>>31&1,a.dgLeft=o&15,a.dgRight=o>>4&15,a.dgTop=o>>8&15,a.dgBottom=o>>12&15,a.icvLeft=o>>16&127,a.icvRight=o>>23&127,a.grbitDiag=o>>30&3,a.icvTop=l&127,a.icvBottom=l>>7&127,a.icvDiag=l>>14&127,a.dgDiag=l>>21&15,a.icvFore=c&127,a.icvBack=c>>7&127,a.fsxButton=c>>14&1),a}function N1t(e,t,r){var n={};return n.ifnt=e.read_shift(2),n.numFmtId=e.read_shift(2),n.flags=e.read_shift(2),n.fStyle=n.flags>>2&1,t-=6,n.data=_1t(e,t,n.fStyle,r),n}function pY(e,t,r,n){var a=r&&r.biff==5;n||(n=lt(a?16:20)),n.write_shift(2,0),e.style?(n.write_shift(2,e.numFmtId||0),n.write_shift(2,65524)):(n.write_shift(2,e.numFmtId||0),n.write_shift(2,t<<4));var i=0;return e.numFmtId>0&&a&&(i|=1024),n.write_shift(4,i),n.write_shift(4,0),a||n.write_shift(4,0),n.write_shift(2,0),n}function S1t(e){e.l+=4;var t=[e.read_shift(2),e.read_shift(2)];if(t[0]!==0&&t[0]--,t[1]!==0&&t[1]--,t[0]>7||t[1]>7)throw new Error("Bad Gutters: "+t.join("|"));return t}function k1t(e){var t=lt(8);return t.write_shift(4,0),t.write_shift(2,0),t.write_shift(2,0),t}function gY(e,t,r){var n=ff(e);(r.biff==2||t==9)&&++e.l;var a=Ayt(e);return n.val=a,n.t=a===!0||a===!1?"b":"e",n}function C1t(e,t,r,n,a,i){var o=lt(8);return Cg(e,t,n,o),qhe(r,i,o),o}function E1t(e,t,r){r.biffguess&&r.biff==2&&(r.biff=5);var n=ff(e),a=mo(e);return n.val=a,n}function A1t(e,t,r,n){var a=lt(14);return Cg(e,t,n,a),Sg(r,a),a}var xY=$yt;function T1t(e,t,r){var n=e.l+t,a=e.read_shift(2),i=e.read_shift(2);if(r.sbcch=i,i==1025||i==14849)return[i,a];if(i<1||i>255)throw new Error("Unexpected SupBook type: "+i);for(var o=kg(e,i),l=[];n>e.l;)l.push(__(e));return[i,a,o,l]}function vY(e,t,r){var n=e.read_shift(2),a,i={fBuiltIn:n&1,fWantAdvise:n>>>1&1,fWantPict:n>>>2&1,fOle:n>>>3&1,fOleLink:n>>>4&1,cf:n>>>5&1023,fIcon:n>>>15&1};return r.sbcch===14849&&(a=zyt(e,t-2,r)),i.body=a||e.read_shift(t-2),typeof a=="string"&&(i.Name=a),i}var P1t=["_xlnm.Consolidate_Area","_xlnm.Auto_Open","_xlnm.Auto_Close","_xlnm.Extract","_xlnm.Database","_xlnm.Criteria","_xlnm.Print_Area","_xlnm.Print_Titles","_xlnm.Recorder","_xlnm.Data_Form","_xlnm.Auto_Activate","_xlnm.Auto_Deactivate","_xlnm.Sheet_Title","_xlnm._FilterDatabase"];function yY(e,t,r){var n=e.l+t,a=e.read_shift(2),i=e.read_shift(1),o=e.read_shift(1),l=e.read_shift(r&&r.biff==2?1:2),c=0;(!r||r.biff>=5)&&(r.biff!=5&&(e.l+=2),c=e.read_shift(2),r.biff==5&&(e.l+=2),e.l+=4);var u=kg(e,o,r);a&32&&(u=P1t[u.charCodeAt(0)]);var d=n-e.l;r&&r.biff==2&&--d;var f=n==e.l||l===0||!(d>0)?[]:Hjt(e,d,r,l);return{chKey:i,Name:u,itab:c,rgce:f}}function Zhe(e,t,r){if(r.biff<8)return O1t(e,t,r);for(var n=[],a=e.l+t,i=e.read_shift(r.biff>8?4:2);i--!==0;)n.push(Byt(e,r.biff>8?12:6,r));if(e.l!=a)throw new Error("Bad ExternSheet: "+e.l+" != "+a);return n}function O1t(e,t,r){e[e.l+1]==3&&e[e.l]++;var n=j_(e,t,r);return n.charCodeAt(0)==3?n.slice(1):n}function D1t(e,t,r){if(r.biff<8){e.l+=t;return}var n=e.read_shift(2),a=e.read_shift(2),i=kg(e,n,r),o=kg(e,a,r);return[i,o]}function I1t(e,t,r){var n=Yhe(e);e.l++;var a=e.read_shift(1);return t-=8,[Gjt(e,t,r),a,n]}function bY(e,t,r){var n=Uyt(e);switch(r.biff){case 2:e.l++,t-=7;break;case 3:case 4:e.l+=2,t-=8;break;default:e.l+=6,t-=12}return[n,Vjt(e,t,r)]}function R1t(e){var t=e.read_shift(4)!==0,r=e.read_shift(4)!==0,n=e.read_shift(4);return[t,r,n]}function L1t(e,t,r){if(!(r.biff<8)){var n=e.read_shift(2),a=e.read_shift(2),i=e.read_shift(2),o=e.read_shift(2),l=Qg(e,0,r);return r.biff<8&&e.read_shift(1),[{r:n,c:a},l,o,i]}}function F1t(e,t,r){return L1t(e,t,r)}function M1t(e,t){for(var r=[],n=e.read_shift(2);n--;)r.push(uA(e));return r}function $1t(e){var t=lt(2+e.length*8);t.write_shift(2,e.length);for(var r=0;r<e.length;++r)Khe(e[r],t);return t}function B1t(e,t,r){if(r&&r.biff<8)return U1t(e,t,r);var n=Xhe(e),a=Hyt(e,t-22,n[1]);return{cmo:n,ft:a}}var z1t={8:function(e,t){var r=e.l+t;e.l+=10;var n=e.read_shift(2);e.l+=4,e.l+=2,e.l+=2,e.l+=2,e.l+=4;var a=e.read_shift(1);return e.l+=a,e.l=r,{fmt:n}}};function U1t(e,t,r){e.l+=4;var n=e.read_shift(2),a=e.read_shift(2),i=e.read_shift(2);e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=2,e.l+=6,t-=36;var o=[];return o.push((z1t[n]||bo)(e,t,r)),{cmo:[a,n,i],ft:o}}function q1t(e,t,r){var n=e.l,a="";try{e.l+=4;var i=(r.lastobj||{cmo:[0,0]}).cmo[1],o;[0,5,7,11,12,14].indexOf(i)==-1?e.l+=6:o=Oyt(e,6,r);var l=e.read_shift(2);e.read_shift(2),Va(e,2);var c=e.read_shift(2);e.l+=c;for(var u=1;u<e.lens.length-1;++u){if(e.l-n!=e.lens[u])throw new Error("TxO: bad continue record");var d=e[e.l],f=kg(e,e.lens[u+1]-e.lens[u]-1);if(a+=f,a.length>=(d?l:2*l))break}if(a.length!==l&&a.length!==l*2)throw new Error("cchText: "+l+" != "+a.length);return e.l=n+t,{t:a}}catch{return e.l=n+t,{t:a}}}function V1t(e,t){var r=uA(e);e.l+=16;var n=Lyt(e,t-24);return[r,n]}function W1t(e){var t=lt(24),r=Qs(e[0]);t.write_shift(2,r.r),t.write_shift(2,r.r),t.write_shift(2,r.c),t.write_shift(2,r.c);for(var n="d0 c9 ea 79 f9 ba ce 11 8c 82 00 aa 00 4b a9 0b".split(" "),a=0;a<16;++a)t.write_shift(1,parseInt(n[a],16));return Ti([t,Fyt(e[1])])}function H1t(e,t){e.read_shift(2);var r=uA(e),n=e.read_shift((t-10)/2,"dbcs-cont");return n=n.replace(go,""),[r,n]}function G1t(e){var t=e[1].Tooltip,r=lt(10+2*(t.length+1));r.write_shift(2,2048);var n=Qs(e[0]);r.write_shift(2,n.r),r.write_shift(2,n.r),r.write_shift(2,n.c),r.write_shift(2,n.c);for(var a=0;a<t.length;++a)r.write_shift(2,t.charCodeAt(a));return r.write_shift(2,0),r}function K1t(e){var t=[0,0],r;return r=e.read_shift(2),t[0]=sY[r]||r,r=e.read_shift(2),t[1]=sY[r]||r,t}function Y1t(e){return e||(e=lt(4)),e.write_shift(2,1),e.write_shift(2,1),e}function X1t(e){for(var t=e.read_shift(2),r=[];t-- >0;)r.push(Hhe(e));return r}function Z1t(e){for(var t=e.read_shift(2),r=[];t-- >0;)r.push(Hhe(e));return r}function J1t(e){e.l+=2;var t={cxfs:0,crc:0};return t.cxfs=e.read_shift(2),t.crc=e.read_shift(4),t}function Jhe(e,t,r){if(!r.cellStyles)return bo(e,t);var n=r&&r.biff>=12?4:2,a=e.read_shift(n),i=e.read_shift(n),o=e.read_shift(n),l=e.read_shift(n),c=e.read_shift(2);n==2&&(e.l+=2);var u={s:a,e:i,w:o,ixfe:l,flags:c};return(r.biff>=5||!r.biff)&&(u.level=c>>8&7),u}function Q1t(e,t){var r=lt(12);r.write_shift(2,t),r.write_shift(2,t),r.write_shift(2,e.width*256),r.write_shift(2,0);var n=0;return e.hidden&&(n|=1),r.write_shift(1,n),n=e.level||0,r.write_shift(1,n),r.write_shift(2,0),r}function ebt(e,t){var r={};return t<32||(e.l+=16,r.header=mo(e),r.footer=mo(e),e.l+=2),r}function tbt(e,t,r){var n={area:!1};if(r.biff!=5)return e.l+=t,n;var a=e.read_shift(1);return e.l+=3,a&16&&(n.area=!0),n}function rbt(e){for(var t=lt(2*e),r=0;r<e;++r)t.write_shift(2,r+1);return t}var nbt=ff,sbt=Uhe,abt=__;function ibt(e){var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(4),a={fmt:t,env:r,len:n,data:e.slice(e.l,e.l+n)};return e.l+=n,a}function obt(e,t,r){r.biffguess&&r.biff==5&&(r.biff=2);var n=ff(e);++e.l;var a=Qg(e,t-7,r);return n.t="str",n.val=a,n}function lbt(e){var t=ff(e);++e.l;var r=mo(e);return t.t="n",t.val=r,t}function cbt(e,t,r){var n=lt(15);return C_(n,e,t),n.write_shift(8,r,"f"),n}function ubt(e){var t=ff(e);++e.l;var r=e.read_shift(2);return t.t="n",t.val=r,t}function dbt(e,t,r){var n=lt(9);return C_(n,e,t),n.write_shift(2,r),n}function fbt(e){var t=e.read_shift(1);return t===0?(e.l++,""):e.read_shift(t,"sbcs-cont")}function hbt(e,t){e.l+=6,e.l+=2,e.l+=1,e.l+=3,e.l+=1,e.l+=t-13}function mbt(e,t,r){var n=e.l+t,a=ff(e),i=e.read_shift(2),o=kg(e,i,r);return e.l=n,a.t="str",a.val=o,a}var pbt=[2,3,48,49,131,139,140,245],oI=function(){var e={1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127,8:865,9:437,10:850,11:437,13:437,14:850,15:437,16:850,17:437,18:850,19:932,20:850,21:437,22:850,23:865,24:437,25:437,26:850,27:437,28:863,29:850,31:852,34:852,35:852,36:860,37:850,38:866,55:850,64:852,77:936,78:949,79:950,80:874,87:1252,88:1252,89:1252,108:863,134:737,135:852,136:857,204:1257,255:16969},t=iA({1:437,2:850,3:1252,4:1e4,100:852,101:866,102:865,103:861,104:895,105:620,106:737,107:857,120:950,121:949,122:936,123:932,124:874,125:1255,126:1256,150:10007,151:10029,152:10006,200:1250,201:1251,202:1254,203:1253,0:20127});function r(l,c){var u=[],d=fp(1);switch(c.type){case"base64":d=Wl(ac(l));break;case"binary":d=Wl(l);break;case"buffer":case"array":d=l;break}Ki(d,0);var f=d.read_shift(1),m=!!(f&136),h=!1,g=!1;switch(f){case 2:break;case 3:break;case 48:h=!0,m=!0;break;case 49:h=!0,m=!0;break;case 131:break;case 139:break;case 140:g=!0;break;case 245:break;default:throw new Error("DBF Unsupported Version: "+f.toString(16))}var p=0,x=521;f==2&&(p=d.read_shift(2)),d.l+=3,f!=2&&(p=d.read_shift(4)),p>1048576&&(p=1e6),f!=2&&(x=d.read_shift(2));var v=d.read_shift(2),b=c.codepage||1252;f!=2&&(d.l+=16,d.read_shift(1),d[d.l]!==0&&(b=e[d[d.l]]),d.l+=1,d.l+=2),g&&(d.l+=36);for(var y=[],N={},_=Math.min(d.length,f==2?521:x-10-(h?264:0)),j=g?32:11;d.l<_&&d[d.l]!=13;)switch(N={},N.name=Cn.utils.decode(b,d.slice(d.l,d.l+j)).replace(/[\u0000\r\n].*$/g,""),d.l+=j,N.type=String.fromCharCode(d.read_shift(1)),f!=2&&!g&&(N.offset=d.read_shift(4)),N.len=d.read_shift(1),f==2&&(N.offset=d.read_shift(2)),N.dec=d.read_shift(1),N.name.length&&y.push(N),f!=2&&(d.l+=g?13:14),N.type){case"B":(!h||N.len!=8)&&c.WTF&&console.log("Skipping "+N.name+":"+N.type);break;case"G":case"P":c.WTF&&console.log("Skipping "+N.name+":"+N.type);break;case"+":case"0":case"@":case"C":case"D":case"F":case"I":case"L":case"M":case"N":case"O":case"T":case"Y":break;default:throw new Error("Unknown Field Type: "+N.type)}if(d[d.l]!==13&&(d.l=x-1),d.read_shift(1)!==13)throw new Error("DBF Terminator not found "+d.l+" "+d[d.l]);d.l=x;var S=0,I=0;for(u[0]=[],I=0;I!=y.length;++I)u[0][I]=y[I].name;for(;p-- >0;){if(d[d.l]===42){d.l+=v;continue}for(++d.l,u[++S]=[],I=0,I=0;I!=y.length;++I){var P=d.slice(d.l,d.l+y[I].len);d.l+=y[I].len,Ki(P,0);var F=Cn.utils.decode(b,P);switch(y[I].type){case"C":F.trim().length&&(u[S][I]=F.replace(/\s+$/,""));break;case"D":F.length===8?u[S][I]=new Date(+F.slice(0,4),+F.slice(4,6)-1,+F.slice(6,8)):u[S][I]=F;break;case"F":u[S][I]=parseFloat(F.trim());break;case"+":case"I":u[S][I]=g?P.read_shift(-4,"i")^2147483648:P.read_shift(4,"i");break;case"L":switch(F.trim().toUpperCase()){case"Y":case"T":u[S][I]=!0;break;case"N":case"F":u[S][I]=!1;break;case"":case"?":break;default:throw new Error("DBF Unrecognized L:|"+F+"|")}break;case"M":if(!m)throw new Error("DBF Unexpected MEMO for type "+f.toString(16));u[S][I]="##MEMO##"+(g?parseInt(F.trim(),10):P.read_shift(4));break;case"N":F=F.replace(/\u0000/g,"").trim(),F&&F!="."&&(u[S][I]=+F||0);break;case"@":u[S][I]=new Date(P.read_shift(-8,"f")-621356832e5);break;case"T":u[S][I]=new Date((P.read_shift(4)-2440588)*864e5+P.read_shift(4));break;case"Y":u[S][I]=P.read_shift(4,"i")/1e4+P.read_shift(4,"i")/1e4*Math.pow(2,32);break;case"O":u[S][I]=-P.read_shift(-8,"f");break;case"B":if(h&&y[I].len==8){u[S][I]=P.read_shift(8,"f");break}case"G":case"P":P.l+=y[I].len;break;case"0":if(y[I].name==="_NullFlags")break;default:throw new Error("DBF Unsupported data type "+y[I].type)}}}if(f!=2&&d.l<d.length&&d[d.l++]!=26)throw new Error("DBF EOF Marker missing "+(d.l-1)+" of "+d.length+" "+d[d.l-1].toString(16));return c&&c.sheetRows&&(u=u.slice(0,c.sheetRows)),c.DBF=y,u}function n(l,c){var u=c||{};u.dateNF||(u.dateNF="yyyymmdd");var d=R1(r(l,u),u);return d["!cols"]=u.DBF.map(function(f){return{wch:f.len,DBF:f}}),delete u.DBF,d}function a(l,c){try{return Rp(n(l,c),c)}catch(u){if(c&&c.WTF)throw u}return{SheetNames:[],Sheets:{}}}var i={B:8,C:250,L:1,D:8,"?":0,"":0};function o(l,c){var u=c||{};if(+u.codepage>=0&&Uc(+u.codepage),u.type=="string")throw new Error("Cannot write DBF to JS string");var d=gl(),f=Rk(l,{header:1,raw:!0,cellDates:!0}),m=f[0],h=f.slice(1),g=l["!cols"]||[],p=0,x=0,v=0,b=1;for(p=0;p<m.length;++p){if(((g[p]||{}).DBF||{}).name){m[p]=g[p].DBF.name,++v;continue}if(m[p]!=null){if(++v,typeof m[p]=="number"&&(m[p]=m[p].toString(10)),typeof m[p]!="string")throw new Error("DBF Invalid column name "+m[p]+" |"+typeof m[p]+"|");if(m.indexOf(m[p])!==p){for(x=0;x<1024;++x)if(m.indexOf(m[p]+"_"+x)==-1){m[p]+="_"+x;break}}}}var y=wn(l["!ref"]),N=[],_=[],j=[];for(p=0;p<=y.e.c-y.s.c;++p){var S="",I="",P=0,F=[];for(x=0;x<h.length;++x)h[x][p]!=null&&F.push(h[x][p]);if(F.length==0||m[p]==null){N[p]="?";continue}for(x=0;x<F.length;++x){switch(typeof F[x]){case"number":I="B";break;case"string":I="C";break;case"boolean":I="L";break;case"object":I=F[x]instanceof Date?"D":"C";break;default:I="C"}P=Math.max(P,String(F[x]).length),S=S&&S!=I?"C":I}P>250&&(P=250),I=((g[p]||{}).DBF||{}).type,I=="C"&&g[p].DBF.len>P&&(P=g[p].DBF.len),S=="B"&&I=="N"&&(S="N",j[p]=g[p].DBF.dec,P=g[p].DBF.len),_[p]=S=="C"||I=="N"?P:i[S]||0,b+=_[p],N[p]=S}var T=d.next(32);for(T.write_shift(4,318902576),T.write_shift(4,h.length),T.write_shift(2,296+32*v),T.write_shift(2,b),p=0;p<4;++p)T.write_shift(4,0);for(T.write_shift(4,0|(+t[jg]||3)<<8),p=0,x=0;p<m.length;++p)if(m[p]!=null){var k=d.next(32),V=(m[p].slice(-10)+"\0\0\0\0\0\0\0\0\0\0\0").slice(0,11);k.write_shift(1,V,"sbcs"),k.write_shift(1,N[p]=="?"?"C":N[p],"sbcs"),k.write_shift(4,x),k.write_shift(1,_[p]||i[N[p]]||0),k.write_shift(1,j[p]||0),k.write_shift(1,2),k.write_shift(4,0),k.write_shift(1,0),k.write_shift(4,0),k.write_shift(4,0),x+=_[p]||i[N[p]]||0}var C=d.next(264);for(C.write_shift(4,13),p=0;p<65;++p)C.write_shift(4,0);for(p=0;p<h.length;++p){var R=d.next(b);for(R.write_shift(1,0),x=0;x<m.length;++x)if(m[x]!=null)switch(N[x]){case"L":R.write_shift(1,h[p][x]==null?63:h[p][x]?84:70);break;case"B":R.write_shift(8,h[p][x]||0,"f");break;case"N":var H="0";for(typeof h[p][x]=="number"&&(H=h[p][x].toFixed(j[x]||0)),v=0;v<_[x]-H.length;++v)R.write_shift(1,32);R.write_shift(1,H,"sbcs");break;case"D":h[p][x]?(R.write_shift(4,("0000"+h[p][x].getFullYear()).slice(-4),"sbcs"),R.write_shift(2,("00"+(h[p][x].getMonth()+1)).slice(-2),"sbcs"),R.write_shift(2,("00"+h[p][x].getDate()).slice(-2),"sbcs")):R.write_shift(8,"00000000","sbcs");break;case"C":var q=String(h[p][x]!=null?h[p][x]:"").slice(0,_[x]);for(R.write_shift(1,q,"sbcs"),v=0;v<_[x]-q.length;++v)R.write_shift(1,32);break}}return d.next(1).write_shift(1,26),d.end()}return{to_workbook:a,to_sheet:n,from_sheet:o}}(),Qhe=function(){var e={AA:"À",BA:"Á",CA:"Â",DA:195,HA:"Ä",JA:197,AE:"È",BE:"É",CE:"Ê",HE:"Ë",AI:"Ì",BI:"Í",CI:"Î",HI:"Ï",AO:"Ò",BO:"Ó",CO:"Ô",DO:213,HO:"Ö",AU:"Ù",BU:"Ú",CU:"Û",HU:"Ü",Aa:"à",Ba:"á",Ca:"â",Da:227,Ha:"ä",Ja:229,Ae:"è",Be:"é",Ce:"ê",He:"ë",Ai:"ì",Bi:"í",Ci:"î",Hi:"ï",Ao:"ò",Bo:"ó",Co:"ô",Do:245,Ho:"ö",Au:"ù",Bu:"ú",Cu:"û",Hu:"ü",KC:"Ç",Kc:"ç",q:"æ",z:"œ",a:"Æ",j:"Œ",DN:209,Dn:241,Hy:255,S:169,c:170,R:174,"B ":180,0:176,1:177,2:178,3:179,5:181,6:182,7:183,Q:185,k:186,b:208,i:216,l:222,s:240,y:248,"!":161,'"':162,"#":163,"(":164,"%":165,"'":167,"H ":168,"+":171,";":187,"<":188,"=":189,">":190,"?":191,"{":223},t=new RegExp("\x1BN("+wa(e).join("|").replace(/\|\|\|/,"|\\||").replace(/([?()+])/g,"\\$1")+"|\\|)","gm"),r=function(m,h){var g=e[h];return typeof g=="number"?QD(g):g},n=function(m,h,g){var p=h.charCodeAt(0)-32<<4|g.charCodeAt(0)-48;return p==59?m:QD(p)};e["|"]=254;function a(m,h){switch(h.type){case"base64":return i(ac(m),h);case"binary":return i(m,h);case"buffer":return i(fn&&Buffer.isBuffer(m)?m.toString("binary"):Ip(m),h);case"array":return i(Ng(m),h)}throw new Error("Unrecognized type "+h.type)}function i(m,h){var g=m.split(/[\n\r]+/),p=-1,x=-1,v=0,b=0,y=[],N=[],_=null,j={},S=[],I=[],P=[],F=0,T;for(+h.codepage>=0&&Uc(+h.codepage);v!==g.length;++v){F=0;var k=g[v].trim().replace(/\x1B([\x20-\x2F])([\x30-\x3F])/g,n).replace(t,r),V=k.replace(/;;/g,"\0").split(";").map(function(U){return U.replace(/\u0000/g,";")}),C=V[0],R;if(k.length>0)switch(C){case"ID":break;case"E":break;case"B":break;case"O":break;case"W":break;case"P":V[1].charAt(0)=="P"&&N.push(k.slice(3).replace(/;;/g,";"));break;case"C":var H=!1,q=!1,L=!1,M=!1,z=-1,K=-1;for(b=1;b<V.length;++b)switch(V[b].charAt(0)){case"A":break;case"X":x=parseInt(V[b].slice(1))-1,q=!0;break;case"Y":for(p=parseInt(V[b].slice(1))-1,q||(x=0),T=y.length;T<=p;++T)y[T]=[];break;case"K":R=V[b].slice(1),R.charAt(0)==='"'?R=R.slice(1,R.length-1):R==="TRUE"?R=!0:R==="FALSE"?R=!1:isNaN(Gu(R))?isNaN(My(R).getDate())||(R=Us(R)):(R=Gu(R),_!==null&&Gg(_)&&(R=lA(R))),typeof Cn<"u"&&typeof R=="string"&&(h||{}).type!="string"&&(h||{}).codepage&&(R=Cn.utils.decode(h.codepage,R)),H=!0;break;case"E":M=!0;var E=Ov(V[b].slice(1),{r:p,c:x});y[p][x]=[y[p][x],E];break;case"S":L=!0,y[p][x]=[y[p][x],"S5S"];break;case"G":break;case"R":z=parseInt(V[b].slice(1))-1;break;case"C":K=parseInt(V[b].slice(1))-1;break;default:if(h&&h.WTF)throw new Error("SYLK bad record "+k)}if(H&&(y[p][x]&&y[p][x].length==2?y[p][x][0]=R:y[p][x]=R,_=null),L){if(M)throw new Error("SYLK shared formula cannot have own formula");var A=z>-1&&y[z][K];if(!A||!A[1])throw new Error("SYLK shared formula cannot find base");y[p][x][1]=xme(A[1],{r:p-z,c:x-K})}break;case"F":var O=0;for(b=1;b<V.length;++b)switch(V[b].charAt(0)){case"X":x=parseInt(V[b].slice(1))-1,++O;break;case"Y":for(p=parseInt(V[b].slice(1))-1,T=y.length;T<=p;++T)y[T]=[];break;case"M":F=parseInt(V[b].slice(1))/20;break;case"F":break;case"G":break;case"P":_=N[parseInt(V[b].slice(1))];break;case"S":break;case"D":break;case"N":break;case"W":for(P=V[b].slice(1).split(" "),T=parseInt(P[0],10);T<=parseInt(P[1],10);++T)F=parseInt(P[2],10),I[T-1]=F===0?{hidden:!0}:{wch:F},hp(I[T-1]);break;case"C":x=parseInt(V[b].slice(1))-1,I[x]||(I[x]={});break;case"R":p=parseInt(V[b].slice(1))-1,S[p]||(S[p]={}),F>0?(S[p].hpt=F,S[p].hpx=By(F)):F===0&&(S[p].hidden=!0);break;default:if(h&&h.WTF)throw new Error("SYLK bad record "+k)}O<1&&(_=null);break;default:if(h&&h.WTF)throw new Error("SYLK bad record "+k)}}return S.length>0&&(j["!rows"]=S),I.length>0&&(j["!cols"]=I),h&&h.sheetRows&&(y=y.slice(0,h.sheetRows)),[y,j]}function o(m,h){var g=a(m,h),p=g[0],x=g[1],v=R1(p,h);return wa(x).forEach(function(b){v[b]=x[b]}),v}function l(m,h){return Rp(o(m,h),h)}function c(m,h,g,p){var x="C;Y"+(g+1)+";X"+(p+1)+";K";switch(m.t){case"n":x+=m.v||0,m.f&&!m.F&&(x+=";E"+m7(m.f,{r:g,c:p}));break;case"b":x+=m.v?"TRUE":"FALSE";break;case"e":x+=m.w||m.v;break;case"d":x+='"'+(m.w||m.v)+'"';break;case"s":x+='"'+m.v.replace(/"/g,"").replace(/;/g,";;")+'"';break}return x}function u(m,h){h.forEach(function(g,p){var x="F;W"+(p+1)+" "+(p+1)+" ";g.hidden?x+="0":(typeof g.width=="number"&&!g.wpx&&(g.wpx=vj(g.width)),typeof g.wpx=="number"&&!g.wch&&(g.wch=yj(g.wpx)),typeof g.wch=="number"&&(x+=Math.round(g.wch))),x.charAt(x.length-1)!=" "&&m.push(x)})}function d(m,h){h.forEach(function(g,p){var x="F;";g.hidden?x+="M0;":g.hpt?x+="M"+20*g.hpt+";":g.hpx&&(x+="M"+20*bj(g.hpx)+";"),x.length>2&&m.push(x+"R"+(p+1))})}function f(m,h){var g=["ID;PWXL;N;E"],p=[],x=wn(m["!ref"]),v,b=Array.isArray(m),y=`\r
`;g.push("P;PGeneral"),g.push("F;P0;DG0G8;M255"),m["!cols"]&&u(g,m["!cols"]),m["!rows"]&&d(g,m["!rows"]),g.push("B;Y"+(x.e.r-x.s.r+1)+";X"+(x.e.c-x.s.c+1)+";D"+[x.s.c,x.s.r,x.e.c,x.e.r].join(" "));for(var N=x.s.r;N<=x.e.r;++N)for(var _=x.s.c;_<=x.e.c;++_){var j=Er({r:N,c:_});v=b?(m[N]||[])[_]:m[j],!(!v||v.v==null&&(!v.f||v.F))&&p.push(c(v,m,N,_))}return g.join(y)+y+p.join(y)+y+"E"+y}return{to_workbook:l,to_sheet:o,from_sheet:f}}(),eme=function(){function e(i,o){switch(o.type){case"base64":return t(ac(i),o);case"binary":return t(i,o);case"buffer":return t(fn&&Buffer.isBuffer(i)?i.toString("binary"):Ip(i),o);case"array":return t(Ng(i),o)}throw new Error("Unrecognized type "+o.type)}function t(i,o){for(var l=i.split(`
`),c=-1,u=-1,d=0,f=[];d!==l.length;++d){if(l[d].trim()==="BOT"){f[++c]=[],u=0;continue}if(!(c<0)){var m=l[d].trim().split(","),h=m[0],g=m[1];++d;for(var p=l[d]||"";(p.match(/["]/g)||[]).length&1&&d<l.length-1;)p+=`
`+l[++d];switch(p=p.trim(),+h){case-1:if(p==="BOT"){f[++c]=[],u=0;continue}else if(p!=="EOD")throw new Error("Unrecognized DIF special command "+p);break;case 0:p==="TRUE"?f[c][u]=!0:p==="FALSE"?f[c][u]=!1:isNaN(Gu(g))?isNaN(My(g).getDate())?f[c][u]=g:f[c][u]=Us(g):f[c][u]=Gu(g),++u;break;case 1:p=p.slice(1,p.length-1),p=p.replace(/""/g,'"'),p&&p.match(/^=".*"$/)&&(p=p.slice(2,-1)),f[c][u++]=p!==""?p:null;break}if(p==="EOD")break}}return o&&o.sheetRows&&(f=f.slice(0,o.sheetRows)),f}function r(i,o){return R1(e(i,o),o)}function n(i,o){return Rp(r(i,o),o)}var a=function(){var i=function(c,u,d,f,m){c.push(u),c.push(d+","+f),c.push('"'+m.replace(/"/g,'""')+'"')},o=function(c,u,d,f){c.push(u+","+d),c.push(u==1?'"'+f.replace(/"/g,'""')+'"':f)};return function(c){var u=[],d=wn(c["!ref"]),f,m=Array.isArray(c);i(u,"TABLE",0,1,"sheetjs"),i(u,"VECTORS",0,d.e.r-d.s.r+1,""),i(u,"TUPLES",0,d.e.c-d.s.c+1,""),i(u,"DATA",0,0,"");for(var h=d.s.r;h<=d.e.r;++h){o(u,-1,0,"BOT");for(var g=d.s.c;g<=d.e.c;++g){var p=Er({r:h,c:g});if(f=m?(c[h]||[])[g]:c[p],!f){o(u,1,0,"");continue}switch(f.t){case"n":var x=f.w;!x&&f.v!=null&&(x=f.v),x==null?f.f&&!f.F?o(u,1,0,"="+f.f):o(u,1,0,""):o(u,0,x,"V");break;case"b":o(u,0,f.v?1:0,f.v?"TRUE":"FALSE");break;case"s":o(u,1,0,isNaN(f.v)?f.v:'="'+f.v+'"');break;case"d":f.w||(f.w=ic(f.z||Nr[14],yi(Us(f.v)))),o(u,0,f.w,"V");break;default:o(u,1,0,"")}}}o(u,-1,0,"EOD");var v=`\r
`,b=u.join(v);return b}}();return{to_workbook:n,to_sheet:r,from_sheet:a}}(),tme=function(){function e(f){return f.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,`
`)}function t(f){return f.replace(/\\/g,"\\b").replace(/:/g,"\\c").replace(/\n/g,"\\n")}function r(f,m){for(var h=f.split(`
`),g=-1,p=-1,x=0,v=[];x!==h.length;++x){var b=h[x].trim().split(":");if(b[0]==="cell"){var y=Qs(b[1]);if(v.length<=y.r)for(g=v.length;g<=y.r;++g)v[g]||(v[g]=[]);switch(g=y.r,p=y.c,b[2]){case"t":v[g][p]=e(b[3]);break;case"v":v[g][p]=+b[3];break;case"vtf":var N=b[b.length-1];case"vtc":switch(b[3]){case"nl":v[g][p]=!!+b[4];break;default:v[g][p]=+b[4];break}b[2]=="vtf"&&(v[g][p]=[v[g][p],N])}}}return m&&m.sheetRows&&(v=v.slice(0,m.sheetRows)),v}function n(f,m){return R1(r(f,m),m)}function a(f,m){return Rp(n(f,m),m)}var i=["socialcalc:version:1.5","MIME-Version: 1.0","Content-Type: multipart/mixed; boundary=SocialCalcSpreadsheetControlSave"].join(`
`),o=["--SocialCalcSpreadsheetControlSave","Content-type: text/plain; charset=UTF-8"].join(`
`)+`
`,l=["# SocialCalc Spreadsheet Control Save","part:sheet"].join(`
`),c="--SocialCalcSpreadsheetControlSave--";function u(f){if(!f||!f["!ref"])return"";for(var m=[],h=[],g,p="",x=Go(f["!ref"]),v=Array.isArray(f),b=x.s.r;b<=x.e.r;++b)for(var y=x.s.c;y<=x.e.c;++y)if(p=Er({r:b,c:y}),g=v?(f[b]||[])[y]:f[p],!(!g||g.v==null||g.t==="z")){switch(h=["cell",p,"t"],g.t){case"s":case"str":h.push(t(g.v));break;case"n":g.f?(h[2]="vtf",h[3]="n",h[4]=g.v,h[5]=t(g.f)):(h[2]="v",h[3]=g.v);break;case"b":h[2]="vt"+(g.f?"f":"c"),h[3]="nl",h[4]=g.v?"1":"0",h[5]=t(g.f||(g.v?"TRUE":"FALSE"));break;case"d":var N=yi(Us(g.v));h[2]="vtc",h[3]="nd",h[4]=""+N,h[5]=g.w||ic(g.z||Nr[14],N);break;case"e":continue}m.push(h.join(":"))}return m.push("sheet:c:"+(x.e.c-x.s.c+1)+":r:"+(x.e.r-x.s.r+1)+":tvf:1"),m.push("valueformat:1:text-wiki"),m.join(`
`)}function d(f){return[i,o,l,o,u(f),c].join(`
`)}return{to_workbook:a,to_sheet:n,from_sheet:d}}(),$y=function(){function e(d,f,m,h,g){g.raw?f[m][h]=d:d===""||(d==="TRUE"?f[m][h]=!0:d==="FALSE"?f[m][h]=!1:isNaN(Gu(d))?isNaN(My(d).getDate())?f[m][h]=d:f[m][h]=Us(d):f[m][h]=Gu(d))}function t(d,f){var m=f||{},h=[];if(!d||d.length===0)return h;for(var g=d.split(/[\r\n]/),p=g.length-1;p>=0&&g[p].length===0;)--p;for(var x=10,v=0,b=0;b<=p;++b)v=g[b].indexOf(" "),v==-1?v=g[b].length:v++,x=Math.max(x,v);for(b=0;b<=p;++b){h[b]=[];var y=0;for(e(g[b].slice(0,x).trim(),h,b,y,m),y=1;y<=(g[b].length-x)/10+1;++y)e(g[b].slice(x+(y-1)*10,x+y*10).trim(),h,b,y,m)}return m.sheetRows&&(h=h.slice(0,m.sheetRows)),h}var r={44:",",9:" ",59:";",124:"|"},n={44:3,9:2,59:1,124:0};function a(d){for(var f={},m=!1,h=0,g=0;h<d.length;++h)(g=d.charCodeAt(h))==34?m=!m:!m&&g in r&&(f[g]=(f[g]||0)+1);g=[];for(h in f)Object.prototype.hasOwnProperty.call(f,h)&&g.push([f[h],h]);if(!g.length){f=n;for(h in f)Object.prototype.hasOwnProperty.call(f,h)&&g.push([f[h],h])}return g.sort(function(p,x){return p[0]-x[0]||n[p[1]]-n[x[1]]}),r[g.pop()[1]]||44}function i(d,f){var m=f||{},h="",g=m.dense?[]:{},p={s:{c:0,r:0},e:{c:0,r:0}};d.slice(0,4)=="sep="?d.charCodeAt(5)==13&&d.charCodeAt(6)==10?(h=d.charAt(4),d=d.slice(7)):d.charCodeAt(5)==13||d.charCodeAt(5)==10?(h=d.charAt(4),d=d.slice(6)):h=a(d.slice(0,1024)):m&&m.FS?h=m.FS:h=a(d.slice(0,1024));var x=0,v=0,b=0,y=0,N=0,_=h.charCodeAt(0),j=!1,S=0,I=d.charCodeAt(0);d=d.replace(/\r\n/mg,`
`);var P=m.dateNF!=null?evt(m.dateNF):null;function F(){var T=d.slice(y,N),k={};if(T.charAt(0)=='"'&&T.charAt(T.length-1)=='"'&&(T=T.slice(1,-1).replace(/""/g,'"')),T.length===0)k.t="z";else if(m.raw)k.t="s",k.v=T;else if(T.trim().length===0)k.t="s",k.v=T;else if(T.charCodeAt(0)==61)T.charCodeAt(1)==34&&T.charCodeAt(T.length-1)==34?(k.t="s",k.v=T.slice(2,-1).replace(/""/g,'"')):T2t(T)?(k.t="n",k.f=T.slice(1)):(k.t="s",k.v=T);else if(T=="TRUE")k.t="b",k.v=!0;else if(T=="FALSE")k.t="b",k.v=!1;else if(!isNaN(b=Gu(T)))k.t="n",m.cellText!==!1&&(k.w=T),k.v=b;else if(!isNaN(My(T).getDate())||P&&T.match(P)){k.z=m.dateNF||Nr[14];var V=0;P&&T.match(P)&&(T=tvt(T,m.dateNF,T.match(P)||[]),V=1),m.cellDates?(k.t="d",k.v=Us(T,V)):(k.t="n",k.v=yi(Us(T,V))),m.cellText!==!1&&(k.w=ic(k.z,k.v instanceof Date?yi(k.v):k.v)),m.cellNF||delete k.z}else k.t="s",k.v=T;if(k.t=="z"||(m.dense?(g[x]||(g[x]=[]),g[x][v]=k):g[Er({c:v,r:x})]=k),y=N+1,I=d.charCodeAt(y),p.e.c<v&&(p.e.c=v),p.e.r<x&&(p.e.r=x),S==_)++v;else if(v=0,++x,m.sheetRows&&m.sheetRows<=x)return!0}e:for(;N<d.length;++N)switch(S=d.charCodeAt(N)){case 34:I===34&&(j=!j);break;case _:case 10:case 13:if(!j&&F())break e;break}return N-y>0&&F(),g["!ref"]=nn(p),g}function o(d,f){return!(f&&f.PRN)||f.FS||d.slice(0,4)=="sep="||d.indexOf(" ")>=0||d.indexOf(",")>=0||d.indexOf(";")>=0?i(d,f):R1(t(d,f),f)}function l(d,f){var m="",h=f.type=="string"?[0,0,0,0]:_7(d,f);switch(f.type){case"base64":m=ac(d);break;case"binary":m=d;break;case"buffer":f.codepage==65001?m=d.toString("utf8"):f.codepage&&typeof Cn<"u"?m=Cn.utils.decode(f.codepage,d):m=fn&&Buffer.isBuffer(d)?d.toString("binary"):Ip(d);break;case"array":m=Ng(d);break;case"string":m=d;break;default:throw new Error("Unrecognized type "+f.type)}return h[0]==239&&h[1]==187&&h[2]==191?m=us(m.slice(3)):f.type!="string"&&f.type!="buffer"&&f.codepage==65001?m=us(m):f.type=="binary"&&typeof Cn<"u"&&f.codepage&&(m=Cn.utils.decode(f.codepage,Cn.utils.encode(28591,m))),m.slice(0,19)=="socialcalc:version:"?tme.to_sheet(f.type=="string"?m:us(m),f):o(m,f)}function c(d,f){return Rp(l(d,f),f)}function u(d){for(var f=[],m=wn(d["!ref"]),h,g=Array.isArray(d),p=m.s.r;p<=m.e.r;++p){for(var x=[],v=m.s.c;v<=m.e.c;++v){var b=Er({r:p,c:v});if(h=g?(d[p]||[])[v]:d[b],!h||h.v==null){x.push(" ");continue}for(var y=(h.w||(tf(h),h.w)||"").slice(0,10);y.length<10;)y+=" ";x.push(y+(v===0?" ":""))}f.push(x.join(""))}return f.join(`
`)}return{to_workbook:c,to_sheet:l,from_sheet:u}}();function gbt(e,t){var r=t||{},n=!!r.WTF;r.WTF=!0;try{var a=Qhe.to_workbook(e,r);return r.WTF=n,a}catch(i){if(r.WTF=n,!i.message.match(/SYLK bad record ID/)&&n)throw i;return $y.to_workbook(e,t)}}var X0=function(){function e(E,A,O){if(E){Ki(E,E.l||0);for(var U=O.Enum||z;E.l<E.length;){var Y=E.read_shift(2),J=U[Y]||U[65535],se=E.read_shift(2),ee=E.l+se,ie=J.f&&J.f(E,se,O);if(E.l=ee,A(ie,J,Y))return}}}function t(E,A){switch(A.type){case"base64":return r(Wl(ac(E)),A);case"binary":return r(Wl(E),A);case"buffer":case"array":return r(E,A)}throw"Unsupported type "+A.type}function r(E,A){if(!E)return E;var O=A||{},U=O.dense?[]:{},Y="Sheet1",J="",se=0,ee={},ie=[],Ee=[],te={s:{r:0,c:0},e:{r:0,c:0}},Ue=O.sheetRows||0;if(E[2]==0&&(E[3]==8||E[3]==9)&&E.length>=16&&E[14]==5&&E[15]===108)throw new Error("Unsupported Works 3 for Mac file");if(E[2]==2)O.Enum=z,e(E,function(re,oe,fe){switch(fe){case 0:O.vers=re,re>=4096&&(O.qpro=!0);break;case 6:te=re;break;case 204:re&&(J=re);break;case 222:J=re;break;case 15:case 51:O.qpro||(re[1].v=re[1].v.slice(1));case 13:case 14:case 16:fe==14&&(re[2]&112)==112&&(re[2]&15)>1&&(re[2]&15)<15&&(re[1].z=O.dateNF||Nr[14],O.cellDates&&(re[1].t="d",re[1].v=lA(re[1].v))),O.qpro&&re[3]>se&&(U["!ref"]=nn(te),ee[Y]=U,ie.push(Y),U=O.dense?[]:{},te={s:{r:0,c:0},e:{r:0,c:0}},se=re[3],Y=J||"Sheet"+(se+1),J="");var Fe=O.dense?(U[re[0].r]||[])[re[0].c]:U[Er(re[0])];if(Fe){Fe.t=re[1].t,Fe.v=re[1].v,re[1].z!=null&&(Fe.z=re[1].z),re[1].f!=null&&(Fe.f=re[1].f);break}O.dense?(U[re[0].r]||(U[re[0].r]=[]),U[re[0].r][re[0].c]=re[1]):U[Er(re[0])]=re[1];break}},O);else if(E[2]==26||E[2]==14)O.Enum=K,E[2]==14&&(O.qpro=!0,E.l=0),e(E,function(re,oe,fe){switch(fe){case 204:Y=re;break;case 22:re[1].v=re[1].v.slice(1);case 23:case 24:case 25:case 37:case 39:case 40:if(re[3]>se&&(U["!ref"]=nn(te),ee[Y]=U,ie.push(Y),U=O.dense?[]:{},te={s:{r:0,c:0},e:{r:0,c:0}},se=re[3],Y="Sheet"+(se+1)),Ue>0&&re[0].r>=Ue)break;O.dense?(U[re[0].r]||(U[re[0].r]=[]),U[re[0].r][re[0].c]=re[1]):U[Er(re[0])]=re[1],te.e.c<re[0].c&&(te.e.c=re[0].c),te.e.r<re[0].r&&(te.e.r=re[0].r);break;case 27:re[14e3]&&(Ee[re[14e3][0]]=re[14e3][1]);break;case 1537:Ee[re[0]]=re[1],re[0]==se&&(Y=re[1]);break}},O);else throw new Error("Unrecognized LOTUS BOF "+E[2]);if(U["!ref"]=nn(te),ee[J||Y]=U,ie.push(J||Y),!Ee.length)return{SheetNames:ie,Sheets:ee};for(var W={},Z=[],le=0;le<Ee.length;++le)ee[ie[le]]?(Z.push(Ee[le]||ie[le]),W[Ee[le]]=ee[Ee[le]]||ee[ie[le]]):(Z.push(Ee[le]),W[Ee[le]]={"!ref":"A1"});return{SheetNames:Z,Sheets:W}}function n(E,A){var O=A||{};if(+O.codepage>=0&&Uc(+O.codepage),O.type=="string")throw new Error("Cannot write WK1 to JS string");var U=gl(),Y=wn(E["!ref"]),J=Array.isArray(E),se=[];Ft(U,0,i(1030)),Ft(U,6,c(Y));for(var ee=Math.min(Y.e.r,8191),ie=Y.s.r;ie<=ee;++ie)for(var Ee=va(ie),te=Y.s.c;te<=Y.e.c;++te){ie===Y.s.r&&(se[te]=zs(te));var Ue=se[te]+Ee,W=J?(E[ie]||[])[te]:E[Ue];if(!(!W||W.t=="z"))if(W.t=="n")(W.v|0)==W.v&&W.v>=-32768&&W.v<=32767?Ft(U,13,h(ie,te,W.v)):Ft(U,14,p(ie,te,W.v));else{var Z=tf(W);Ft(U,15,f(ie,te,Z.slice(0,239)))}}return Ft(U,1),U.end()}function a(E,A){var O=A||{};if(+O.codepage>=0&&Uc(+O.codepage),O.type=="string")throw new Error("Cannot write WK3 to JS string");var U=gl();Ft(U,0,o(E));for(var Y=0,J=0;Y<E.SheetNames.length;++Y)(E.Sheets[E.SheetNames[Y]]||{})["!ref"]&&Ft(U,27,M(E.SheetNames[Y],J++));var se=0;for(Y=0;Y<E.SheetNames.length;++Y){var ee=E.Sheets[E.SheetNames[Y]];if(!(!ee||!ee["!ref"])){for(var ie=wn(ee["!ref"]),Ee=Array.isArray(ee),te=[],Ue=Math.min(ie.e.r,8191),W=ie.s.r;W<=Ue;++W)for(var Z=va(W),le=ie.s.c;le<=ie.e.c;++le){W===ie.s.r&&(te[le]=zs(le));var re=te[le]+Z,oe=Ee?(ee[W]||[])[le]:ee[re];if(!(!oe||oe.t=="z"))if(oe.t=="n")Ft(U,23,F(W,le,se,oe.v));else{var fe=tf(oe);Ft(U,22,S(W,le,se,fe.slice(0,239)))}}++se}}return Ft(U,1),U.end()}function i(E){var A=lt(2);return A.write_shift(2,E),A}function o(E){var A=lt(26);A.write_shift(2,4096),A.write_shift(2,4),A.write_shift(4,0);for(var O=0,U=0,Y=0,J=0;J<E.SheetNames.length;++J){var se=E.SheetNames[J],ee=E.Sheets[se];if(!(!ee||!ee["!ref"])){++Y;var ie=Go(ee["!ref"]);O<ie.e.r&&(O=ie.e.r),U<ie.e.c&&(U=ie.e.c)}}return O>8191&&(O=8191),A.write_shift(2,O),A.write_shift(1,Y),A.write_shift(1,U),A.write_shift(2,0),A.write_shift(2,0),A.write_shift(1,1),A.write_shift(1,2),A.write_shift(4,0),A.write_shift(4,0),A}function l(E,A,O){var U={s:{c:0,r:0},e:{c:0,r:0}};return A==8&&O.qpro?(U.s.c=E.read_shift(1),E.l++,U.s.r=E.read_shift(2),U.e.c=E.read_shift(1),E.l++,U.e.r=E.read_shift(2),U):(U.s.c=E.read_shift(2),U.s.r=E.read_shift(2),A==12&&O.qpro&&(E.l+=2),U.e.c=E.read_shift(2),U.e.r=E.read_shift(2),A==12&&O.qpro&&(E.l+=2),U.s.c==65535&&(U.s.c=U.e.c=U.s.r=U.e.r=0),U)}function c(E){var A=lt(8);return A.write_shift(2,E.s.c),A.write_shift(2,E.s.r),A.write_shift(2,E.e.c),A.write_shift(2,E.e.r),A}function u(E,A,O){var U=[{c:0,r:0},{t:"n",v:0},0,0];return O.qpro&&O.vers!=20768?(U[0].c=E.read_shift(1),U[3]=E.read_shift(1),U[0].r=E.read_shift(2),E.l+=2):(U[2]=E.read_shift(1),U[0].c=E.read_shift(2),U[0].r=E.read_shift(2)),U}function d(E,A,O){var U=E.l+A,Y=u(E,A,O);if(Y[1].t="s",O.vers==20768){E.l++;var J=E.read_shift(1);return Y[1].v=E.read_shift(J,"utf8"),Y}return O.qpro&&E.l++,Y[1].v=E.read_shift(U-E.l,"cstr"),Y}function f(E,A,O){var U=lt(7+O.length);U.write_shift(1,255),U.write_shift(2,A),U.write_shift(2,E),U.write_shift(1,39);for(var Y=0;Y<U.length;++Y){var J=O.charCodeAt(Y);U.write_shift(1,J>=128?95:J)}return U.write_shift(1,0),U}function m(E,A,O){var U=u(E,A,O);return U[1].v=E.read_shift(2,"i"),U}function h(E,A,O){var U=lt(7);return U.write_shift(1,255),U.write_shift(2,A),U.write_shift(2,E),U.write_shift(2,O,"i"),U}function g(E,A,O){var U=u(E,A,O);return U[1].v=E.read_shift(8,"f"),U}function p(E,A,O){var U=lt(13);return U.write_shift(1,255),U.write_shift(2,A),U.write_shift(2,E),U.write_shift(8,O,"f"),U}function x(E,A,O){var U=E.l+A,Y=u(E,A,O);if(Y[1].v=E.read_shift(8,"f"),O.qpro)E.l=U;else{var J=E.read_shift(2);N(E.slice(E.l,E.l+J),Y),E.l+=J}return Y}function v(E,A,O){var U=A&32768;return A&=-32769,A=(U?E:0)+(A>=8192?A-16384:A),(U?"":"$")+(O?zs(A):va(A))}var b={51:["FALSE",0],52:["TRUE",0],70:["LEN",1],80:["SUM",69],81:["AVERAGEA",69],82:["COUNTA",69],83:["MINA",69],84:["MAXA",69],111:["T",1]},y=["","","","","","","","","","+","-","*","/","^","=","<>","<=",">=","<",">","","","","","&","","","","","","",""];function N(E,A){Ki(E,0);for(var O=[],U=0,Y="",J="",se="",ee="";E.l<E.length;){var ie=E[E.l++];switch(ie){case 0:O.push(E.read_shift(8,"f"));break;case 1:J=v(A[0].c,E.read_shift(2),!0),Y=v(A[0].r,E.read_shift(2),!1),O.push(J+Y);break;case 2:{var Ee=v(A[0].c,E.read_shift(2),!0),te=v(A[0].r,E.read_shift(2),!1);J=v(A[0].c,E.read_shift(2),!0),Y=v(A[0].r,E.read_shift(2),!1),O.push(Ee+te+":"+J+Y)}break;case 3:if(E.l<E.length){console.error("WK1 premature formula end");return}break;case 4:O.push("("+O.pop()+")");break;case 5:O.push(E.read_shift(2));break;case 6:{for(var Ue="";ie=E[E.l++];)Ue+=String.fromCharCode(ie);O.push('"'+Ue.replace(/"/g,'""')+'"')}break;case 8:O.push("-"+O.pop());break;case 23:O.push("+"+O.pop());break;case 22:O.push("NOT("+O.pop()+")");break;case 20:case 21:ee=O.pop(),se=O.pop(),O.push(["AND","OR"][ie-20]+"("+se+","+ee+")");break;default:if(ie<32&&y[ie])ee=O.pop(),se=O.pop(),O.push(se+y[ie]+ee);else if(b[ie]){if(U=b[ie][1],U==69&&(U=E[E.l++]),U>O.length){console.error("WK1 bad formula parse 0x"+ie.toString(16)+":|"+O.join("|")+"|");return}var W=O.slice(-U);O.length-=U,O.push(b[ie][0]+"("+W.join(",")+")")}else return ie<=7?console.error("WK1 invalid opcode "+ie.toString(16)):ie<=24?console.error("WK1 unsupported op "+ie.toString(16)):ie<=30?console.error("WK1 invalid opcode "+ie.toString(16)):ie<=115?console.error("WK1 unsupported function opcode "+ie.toString(16)):console.error("WK1 unrecognized opcode "+ie.toString(16))}}O.length==1?A[1].f=""+O[0]:console.error("WK1 bad formula parse |"+O.join("|")+"|")}function _(E){var A=[{c:0,r:0},{t:"n",v:0},0];return A[0].r=E.read_shift(2),A[3]=E[E.l++],A[0].c=E[E.l++],A}function j(E,A){var O=_(E);return O[1].t="s",O[1].v=E.read_shift(A-4,"cstr"),O}function S(E,A,O,U){var Y=lt(6+U.length);Y.write_shift(2,E),Y.write_shift(1,O),Y.write_shift(1,A),Y.write_shift(1,39);for(var J=0;J<U.length;++J){var se=U.charCodeAt(J);Y.write_shift(1,se>=128?95:se)}return Y.write_shift(1,0),Y}function I(E,A){var O=_(E);O[1].v=E.read_shift(2);var U=O[1].v>>1;if(O[1].v&1)switch(U&7){case 0:U=(U>>3)*5e3;break;case 1:U=(U>>3)*500;break;case 2:U=(U>>3)/20;break;case 3:U=(U>>3)/200;break;case 4:U=(U>>3)/2e3;break;case 5:U=(U>>3)/2e4;break;case 6:U=(U>>3)/16;break;case 7:U=(U>>3)/64;break}return O[1].v=U,O}function P(E,A){var O=_(E),U=E.read_shift(4),Y=E.read_shift(4),J=E.read_shift(2);if(J==65535)return U===0&&Y===3221225472?(O[1].t="e",O[1].v=15):U===0&&Y===3489660928?(O[1].t="e",O[1].v=42):O[1].v=0,O;var se=J&32768;return J=(J&32767)-16446,O[1].v=(1-se*2)*(Y*Math.pow(2,J+32)+U*Math.pow(2,J)),O}function F(E,A,O,U){var Y=lt(14);if(Y.write_shift(2,E),Y.write_shift(1,O),Y.write_shift(1,A),U==0)return Y.write_shift(4,0),Y.write_shift(4,0),Y.write_shift(2,65535),Y;var J=0,se=0,ee=0,ie=0;return U<0&&(J=1,U=-U),se=Math.log2(U)|0,U/=Math.pow(2,se-31),ie=U>>>0,ie&2147483648||(U/=2,++se,ie=U>>>0),U-=ie,ie|=2147483648,ie>>>=0,U*=Math.pow(2,32),ee=U>>>0,Y.write_shift(4,ee),Y.write_shift(4,ie),se+=16383+(J?32768:0),Y.write_shift(2,se),Y}function T(E,A){var O=P(E);return E.l+=A-14,O}function k(E,A){var O=_(E),U=E.read_shift(4);return O[1].v=U>>6,O}function V(E,A){var O=_(E),U=E.read_shift(8,"f");return O[1].v=U,O}function C(E,A){var O=V(E);return E.l+=A-10,O}function R(E,A){return E[E.l+A-1]==0?E.read_shift(A,"cstr"):""}function H(E,A){var O=E[E.l++];O>A-1&&(O=A-1);for(var U="";U.length<O;)U+=String.fromCharCode(E[E.l++]);return U}function q(E,A,O){if(!(!O.qpro||A<21)){var U=E.read_shift(1);E.l+=17,E.l+=1,E.l+=2;var Y=E.read_shift(A-21,"cstr");return[U,Y]}}function L(E,A){for(var O={},U=E.l+A;E.l<U;){var Y=E.read_shift(2);if(Y==14e3){for(O[Y]=[0,""],O[Y][0]=E.read_shift(2);E[E.l];)O[Y][1]+=String.fromCharCode(E[E.l]),E.l++;E.l++}}return O}function M(E,A){var O=lt(5+E.length);O.write_shift(2,14e3),O.write_shift(2,A);for(var U=0;U<E.length;++U){var Y=E.charCodeAt(U);O[O.l++]=Y>127?95:Y}return O[O.l++]=0,O}var z={0:{n:"BOF",f:Va},1:{n:"EOF"},2:{n:"CALCMODE"},3:{n:"CALCORDER"},4:{n:"SPLIT"},5:{n:"SYNC"},6:{n:"RANGE",f:l},7:{n:"WINDOW1"},8:{n:"COLW1"},9:{n:"WINTWO"},10:{n:"COLW2"},11:{n:"NAME"},12:{n:"BLANK"},13:{n:"INTEGER",f:m},14:{n:"NUMBER",f:g},15:{n:"LABEL",f:d},16:{n:"FORMULA",f:x},24:{n:"TABLE"},25:{n:"ORANGE"},26:{n:"PRANGE"},27:{n:"SRANGE"},28:{n:"FRANGE"},29:{n:"KRANGE1"},32:{n:"HRANGE"},35:{n:"KRANGE2"},36:{n:"PROTEC"},37:{n:"FOOTER"},38:{n:"HEADER"},39:{n:"SETUP"},40:{n:"MARGINS"},41:{n:"LABELFMT"},42:{n:"TITLES"},43:{n:"SHEETJS"},45:{n:"GRAPH"},46:{n:"NGRAPH"},47:{n:"CALCCOUNT"},48:{n:"UNFORMATTED"},49:{n:"CURSORW12"},50:{n:"WINDOW"},51:{n:"STRING",f:d},55:{n:"PASSWORD"},56:{n:"LOCKED"},60:{n:"QUERY"},61:{n:"QUERYNAME"},62:{n:"PRINT"},63:{n:"PRINTNAME"},64:{n:"GRAPH2"},65:{n:"GRAPHNAME"},66:{n:"ZOOM"},67:{n:"SYMSPLIT"},68:{n:"NSROWS"},69:{n:"NSCOLS"},70:{n:"RULER"},71:{n:"NNAME"},72:{n:"ACOMM"},73:{n:"AMACRO"},74:{n:"PARSE"},102:{n:"PRANGES??"},103:{n:"RRANGES??"},104:{n:"FNAME??"},105:{n:"MRANGES??"},204:{n:"SHEETNAMECS",f:R},222:{n:"SHEETNAMELP",f:H},65535:{n:""}},K={0:{n:"BOF"},1:{n:"EOF"},2:{n:"PASSWORD"},3:{n:"CALCSET"},4:{n:"WINDOWSET"},5:{n:"SHEETCELLPTR"},6:{n:"SHEETLAYOUT"},7:{n:"COLUMNWIDTH"},8:{n:"HIDDENCOLUMN"},9:{n:"USERRANGE"},10:{n:"SYSTEMRANGE"},11:{n:"ZEROFORCE"},12:{n:"SORTKEYDIR"},13:{n:"FILESEAL"},14:{n:"DATAFILLNUMS"},15:{n:"PRINTMAIN"},16:{n:"PRINTSTRING"},17:{n:"GRAPHMAIN"},18:{n:"GRAPHSTRING"},19:{n:"??"},20:{n:"ERRCELL"},21:{n:"NACELL"},22:{n:"LABEL16",f:j},23:{n:"NUMBER17",f:P},24:{n:"NUMBER18",f:I},25:{n:"FORMULA19",f:T},26:{n:"FORMULA1A"},27:{n:"XFORMAT",f:L},28:{n:"DTLABELMISC"},29:{n:"DTLABELCELL"},30:{n:"GRAPHWINDOW"},31:{n:"CPA"},32:{n:"LPLAUTO"},33:{n:"QUERY"},34:{n:"HIDDENSHEET"},35:{n:"??"},37:{n:"NUMBER25",f:k},38:{n:"??"},39:{n:"NUMBER27",f:V},40:{n:"FORMULA28",f:C},142:{n:"??"},147:{n:"??"},150:{n:"??"},151:{n:"??"},152:{n:"??"},153:{n:"??"},154:{n:"??"},155:{n:"??"},156:{n:"??"},163:{n:"??"},174:{n:"??"},175:{n:"??"},176:{n:"??"},177:{n:"??"},184:{n:"??"},185:{n:"??"},186:{n:"??"},187:{n:"??"},188:{n:"??"},195:{n:"??"},201:{n:"??"},204:{n:"SHEETNAMECS",f:R},205:{n:"??"},206:{n:"??"},207:{n:"??"},208:{n:"??"},256:{n:"??"},259:{n:"??"},260:{n:"??"},261:{n:"??"},262:{n:"??"},263:{n:"??"},265:{n:"??"},266:{n:"??"},267:{n:"??"},268:{n:"??"},270:{n:"??"},271:{n:"??"},384:{n:"??"},389:{n:"??"},390:{n:"??"},393:{n:"??"},396:{n:"??"},512:{n:"??"},514:{n:"??"},513:{n:"??"},516:{n:"??"},517:{n:"??"},640:{n:"??"},641:{n:"??"},642:{n:"??"},643:{n:"??"},644:{n:"??"},645:{n:"??"},646:{n:"??"},647:{n:"??"},648:{n:"??"},658:{n:"??"},659:{n:"??"},660:{n:"??"},661:{n:"??"},662:{n:"??"},665:{n:"??"},666:{n:"??"},768:{n:"??"},772:{n:"??"},1537:{n:"SHEETINFOQP",f:q},1600:{n:"??"},1602:{n:"??"},1793:{n:"??"},1794:{n:"??"},1795:{n:"??"},1796:{n:"??"},1920:{n:"??"},2048:{n:"??"},2049:{n:"??"},2052:{n:"??"},2688:{n:"??"},10998:{n:"??"},12849:{n:"??"},28233:{n:"??"},28484:{n:"??"},65535:{n:""}};return{sheet_to_wk1:n,book_to_wk3:a,to_workbook:t}}();function xbt(e){var t={},r=e.match(_o),n=0,a=!1;if(r)for(;n!=r.length;++n){var i=Rr(r[n]);switch(i[0].replace(/\w*:/g,"")){case"<condense":break;case"<extend":break;case"<shadow":if(!i.val)break;case"<shadow>":case"<shadow/>":t.shadow=1;break;case"</shadow>":break;case"<charset":if(i.val=="1")break;t.cp=LM[parseInt(i.val,10)];break;case"<outline":if(!i.val)break;case"<outline>":case"<outline/>":t.outline=1;break;case"</outline>":break;case"<rFont":t.name=i.val;break;case"<sz":t.sz=i.val;break;case"<strike":if(!i.val)break;case"<strike>":case"<strike/>":t.strike=1;break;case"</strike>":break;case"<u":if(!i.val)break;switch(i.val){case"double":t.uval="double";break;case"singleAccounting":t.uval="single-accounting";break;case"doubleAccounting":t.uval="double-accounting";break}case"<u>":case"<u/>":t.u=1;break;case"</u>":break;case"<b":if(i.val=="0")break;case"<b>":case"<b/>":t.b=1;break;case"</b>":break;case"<i":if(i.val=="0")break;case"<i>":case"<i/>":t.i=1;break;case"</i>":break;case"<color":i.rgb&&(t.color=i.rgb.slice(2,8));break;case"<color>":case"<color/>":case"</color>":break;case"<family":t.family=i.val;break;case"<family>":case"<family/>":case"</family>":break;case"<vertAlign":t.valign=i.val;break;case"<vertAlign>":case"<vertAlign/>":case"</vertAlign>":break;case"<scheme":break;case"<scheme>":case"<scheme/>":case"</scheme>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":a=!0;break;case"</ext>":a=!1;break;default:if(i[0].charCodeAt(1)!==47&&!a)throw new Error("Unrecognized rich format "+i[0])}}return t}var vbt=function(){var e=hj("t"),t=hj("rPr");function r(i){var o=i.match(e);if(!o)return{t:"s",v:""};var l={t:"s",v:Dn(o[1])},c=i.match(t);return c&&(l.s=xbt(c[1])),l}var n=/<(?:\w+:)?r>/g,a=/<\/(?:\w+:)?r>/;return function(o){return o.replace(n,"").split(a).map(r).filter(function(l){return l.v})}}(),ybt=function(){var t=/(\r\n|\n)/g;function r(a,i,o){var l=[];a.u&&l.push("text-decoration: underline;"),a.uval&&l.push("text-underline-style:"+a.uval+";"),a.sz&&l.push("font-size:"+a.sz+"pt;"),a.outline&&l.push("text-effect: outline;"),a.shadow&&l.push("text-shadow: auto;"),i.push('<span style="'+l.join("")+'">'),a.b&&(i.push("<b>"),o.push("</b>")),a.i&&(i.push("<i>"),o.push("</i>")),a.strike&&(i.push("<s>"),o.push("</s>"));var c=a.valign||"";return c=="superscript"||c=="super"?c="sup":c=="subscript"&&(c="sub"),c!=""&&(i.push("<"+c+">"),o.push("</"+c+">")),o.push("</span>"),a}function n(a){var i=[[],a.v,[]];return a.v?(a.s&&r(a.s,i[0],i[2]),i[0].join("")+i[1].replace(t,"<br/>")+i[2].join("")):""}return function(i){return i.map(n).join("")}}(),bbt=/<(?:\w+:)?t[^>]*>([^<]*)<\/(?:\w+:)?t>/g,wbt=/<(?:\w+:)?r>/,jbt=/<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;function c7(e,t){var r=t?t.cellHTML:!0,n={};return e?(e.match(/^\s*<(?:\w+:)?t[^>]*>/)?(n.t=Dn(us(e.slice(e.indexOf(">")+1).split(/<\/(?:\w+:)?t>/)[0]||"")),n.r=us(e),r&&(n.h=WM(n.t))):e.match(wbt)&&(n.r=us(e),n.t=Dn(us((e.replace(jbt,"").match(bbt)||[]).join("").replace(_o,""))),r&&(n.h=ybt(vbt(n.r)))),n):{t:""}}var _bt=/<(?:\w+:)?sst([^>]*)>([\s\S]*)<\/(?:\w+:)?sst>/,Nbt=/<(?:\w+:)?(?:si|sstItem)>/g,Sbt=/<\/(?:\w+:)?(?:si|sstItem)>/;function kbt(e,t){var r=[],n="";if(!e)return r;var a=e.match(_bt);if(a){n=a[2].replace(Nbt,"").split(Sbt);for(var i=0;i!=n.length;++i){var o=c7(n[i].trim(),t);o!=null&&(r[r.length]=o)}a=Rr(a[1]),r.Count=a.count,r.Unique=a.uniqueCount}return r}var Cbt=/^\s|\s$|[\t\n\r]/;function rme(e,t){if(!t.bookSST)return"";var r=[Ra];r[r.length]=Lt("sst",null,{xmlns:Kg[0],count:e.Count,uniqueCount:e.Unique});for(var n=0;n!=e.length;++n)if(e[n]!=null){var a=e[n],i="<si>";a.r?i+=a.r:(i+="<t",a.t||(a.t=""),a.t.match(Cbt)&&(i+=' xml:space="preserve"'),i+=">"+ns(a.t)+"</t>"),i+="</si>",r[r.length]=i}return r.length>2&&(r[r.length]="</sst>",r[1]=r[1].replace("/>",">")),r.join("")}function Ebt(e){return[e.read_shift(4),e.read_shift(4)]}function Abt(e,t){var r=[],n=!1;return Ch(e,function(i,o,l){switch(l){case 159:r.Count=i[0],r.Unique=i[1];break;case 19:r.push(i);break;case 160:return!0;case 35:n=!0;break;case 36:n=!1;break;default:if(o.T,!n||t.WTF)throw new Error("Unexpected record 0x"+l.toString(16))}}),r}function Tbt(e,t){return t||(t=lt(8)),t.write_shift(4,e.Count),t.write_shift(4,e.Unique),t}var Pbt=zvt;function Obt(e){var t=gl();yt(t,159,Tbt(e));for(var r=0;r<e.length;++r)yt(t,19,Pbt(e[r]));return yt(t,160),t.end()}function nme(e){if(typeof Cn<"u")return Cn.utils.encode(jg,e);for(var t=[],r=e.split(""),n=0;n<r.length;++n)t[n]=r[n].charCodeAt(0);return t}function nh(e,t){var r={};return r.Major=e.read_shift(2),r.Minor=e.read_shift(2),t>=4&&(e.l+=t-4),r}function Dbt(e){var t={};return t.id=e.read_shift(0,"lpp4"),t.R=nh(e,4),t.U=nh(e,4),t.W=nh(e,4),t}function Ibt(e){for(var t=e.read_shift(4),r=e.l+t-4,n={},a=e.read_shift(4),i=[];a-- >0;)i.push({t:e.read_shift(4),v:e.read_shift(0,"lpp4")});if(n.name=e.read_shift(0,"lpp4"),n.comps=i,e.l!=r)throw new Error("Bad DataSpaceMapEntry: "+e.l+" != "+r);return n}function Rbt(e){var t=[];e.l+=4;for(var r=e.read_shift(4);r-- >0;)t.push(Ibt(e));return t}function Lbt(e){var t=[];e.l+=4;for(var r=e.read_shift(4);r-- >0;)t.push(e.read_shift(0,"lpp4"));return t}function Fbt(e){var t={};return e.read_shift(4),e.l+=4,t.id=e.read_shift(0,"lpp4"),t.name=e.read_shift(0,"lpp4"),t.R=nh(e,4),t.U=nh(e,4),t.W=nh(e,4),t}function Mbt(e){var t=Fbt(e);if(t.ename=e.read_shift(0,"8lpp4"),t.blksz=e.read_shift(4),t.cmode=e.read_shift(4),e.read_shift(4)!=4)throw new Error("Bad !Primary record");return t}function sme(e,t){var r=e.l+t,n={};n.Flags=e.read_shift(4)&63,e.l+=4,n.AlgID=e.read_shift(4);var a=!1;switch(n.AlgID){case 26126:case 26127:case 26128:a=n.Flags==36;break;case 26625:a=n.Flags==4;break;case 0:a=n.Flags==16||n.Flags==4||n.Flags==36;break;default:throw"Unrecognized encryption algorithm: "+n.AlgID}if(!a)throw new Error("Encryption Flags/AlgID mismatch");return n.AlgIDHash=e.read_shift(4),n.KeySize=e.read_shift(4),n.ProviderType=e.read_shift(4),e.l+=8,n.CSPName=e.read_shift(r-e.l>>1,"utf16le"),e.l=r,n}function ame(e,t){var r={},n=e.l+t;return e.l+=4,r.Salt=e.slice(e.l,e.l+16),e.l+=16,r.Verifier=e.slice(e.l,e.l+16),e.l+=16,e.read_shift(4),r.VerifierHash=e.slice(e.l,n),e.l=n,r}function $bt(e){var t=nh(e);switch(t.Minor){case 2:return[t.Minor,Bbt(e)];case 3:return[t.Minor,zbt()];case 4:return[t.Minor,Ubt(e)]}throw new Error("ECMA-376 Encrypted file unrecognized Version: "+t.Minor)}function Bbt(e){var t=e.read_shift(4);if((t&63)!=36)throw new Error("EncryptionInfo mismatch");var r=e.read_shift(4),n=sme(e,r),a=ame(e,e.length-e.l);return{t:"Std",h:n,v:a}}function zbt(){throw new Error("File is password-protected: ECMA-376 Extensible")}function Ubt(e){var t=["saltSize","blockSize","keyBits","hashSize","cipherAlgorithm","cipherChaining","hashAlgorithm","saltValue"];e.l+=4;var r=e.read_shift(e.length-e.l,"utf8"),n={};return r.replace(_o,function(i){var o=Rr(i);switch(df(o[0])){case"<?xml":break;case"<encryption":case"</encryption>":break;case"<keyData":t.forEach(function(l){n[l]=o[l]});break;case"<dataIntegrity":n.encryptedHmacKey=o.encryptedHmacKey,n.encryptedHmacValue=o.encryptedHmacValue;break;case"<keyEncryptors>":case"<keyEncryptors":n.encs=[];break;case"</keyEncryptors>":break;case"<keyEncryptor":n.uri=o.uri;break;case"</keyEncryptor>":break;case"<encryptedKey":n.encs.push(o);break;default:throw o[0]}}),n}function qbt(e,t){var r={},n=r.EncryptionVersionInfo=nh(e,4);if(t-=4,n.Minor!=2)throw new Error("unrecognized minor version code: "+n.Minor);if(n.Major>4||n.Major<2)throw new Error("unrecognized major version code: "+n.Major);r.Flags=e.read_shift(4),t-=4;var a=e.read_shift(4);return t-=4,r.EncryptionHeader=sme(e,a),t-=a,r.EncryptionVerifier=ame(e,t),r}function Vbt(e){var t={},r=t.EncryptionVersionInfo=nh(e,4);if(r.Major!=1||r.Minor!=1)throw"unrecognized version code "+r.Major+" : "+r.Minor;return t.Salt=e.read_shift(16),t.EncryptedVerifier=e.read_shift(16),t.EncryptedVerifierHash=e.read_shift(16),t}function u7(e){var t=0,r,n=nme(e),a=n.length+1,i,o,l,c,u;for(r=fp(a),r[0]=n.length,i=1;i!=a;++i)r[i]=n[i-1];for(i=a-1;i>=0;--i)o=r[i],l=t&16384?1:0,c=t<<1&32767,u=l|c,t=u^o;return t^52811}var ime=function(){var e=[187,255,255,186,255,255,185,128,0,190,15,0,191,15,0],t=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],r=[44796,19929,39858,10053,20106,40212,10761,31585,63170,64933,60267,50935,40399,11199,17763,35526,1453,2906,5812,11624,23248,885,1770,3540,7080,14160,28320,56640,55369,41139,20807,41614,21821,43642,17621,28485,56970,44341,19019,38038,14605,29210,60195,50791,40175,10751,21502,43004,24537,18387,36774,3949,7898,15796,31592,63184,47201,24803,49606,37805,14203,28406,56812,17824,35648,1697,3394,6788,13576,27152,43601,17539,35078,557,1114,2228,4456,30388,60776,51953,34243,7079,14158,28316,14128,28256,56512,43425,17251,34502,7597,13105,26210,52420,35241,883,1766,3532,4129,8258,16516,33032,4657,9314,18628],n=function(o){return(o/2|o*128)&255},a=function(o,l){return n(o^l)},i=function(o){for(var l=t[o.length-1],c=104,u=o.length-1;u>=0;--u)for(var d=o[u],f=0;f!=7;++f)d&64&&(l^=r[c]),d*=2,--c;return l};return function(o){for(var l=nme(o),c=i(l),u=l.length,d=fp(16),f=0;f!=16;++f)d[f]=0;var m,h,g;for((u&1)===1&&(m=c>>8,d[u]=a(e[0],m),--u,m=c&255,h=l[l.length-1],d[u]=a(h,m));u>0;)--u,m=c>>8,d[u]=a(l[u],m),--u,m=c&255,d[u]=a(l[u],m);for(u=15,g=15-l.length;g>0;)m=c>>8,d[u]=a(e[g],m),--u,--g,m=c&255,d[u]=a(l[u],m),--u,--g;return d}}(),Wbt=function(e,t,r,n,a){a||(a=t),n||(n=ime(e));var i,o;for(i=0;i!=t.length;++i)o=t[i],o^=n[r],o=(o>>5|o<<3)&255,a[i]=o,++r;return[a,r,n]},Hbt=function(e){var t=0,r=ime(e);return function(n){var a=Wbt("",n,t,r);return t=a[1],a[0]}};function Gbt(e,t,r,n){var a={key:Va(e),verificationBytes:Va(e)};return r.password&&(a.verifier=u7(r.password)),n.valid=a.verificationBytes===a.verifier,n.valid&&(n.insitu=Hbt(r.password)),a}function Kbt(e,t,r){var n=r||{};return n.Info=e.read_shift(2),e.l-=2,n.Info===1?n.Data=Vbt(e):n.Data=qbt(e,t),n}function Ybt(e,t,r){var n={Type:r.biff>=8?e.read_shift(2):0};return n.Type?Kbt(e,t-2,n):Gbt(e,r.biff>=8?t:t-2,r,n),n}var ome=function(){function e(a,i){switch(i.type){case"base64":return t(ac(a),i);case"binary":return t(a,i);case"buffer":return t(fn&&Buffer.isBuffer(a)?a.toString("binary"):Ip(a),i);case"array":return t(Ng(a),i)}throw new Error("Unrecognized type "+i.type)}function t(a,i){var o=i||{},l=o.dense?[]:{},c=a.match(/\\trowd.*?\\row\b/g);if(!c.length)throw new Error("RTF missing table");var u={s:{c:0,r:0},e:{c:0,r:c.length-1}};return c.forEach(function(d,f){Array.isArray(l)&&(l[f]=[]);for(var m=/\\\w+\b/g,h=0,g,p=-1;g=m.exec(d);){switch(g[0]){case"\\cell":var x=d.slice(h,m.lastIndex-g[0].length);if(x[0]==" "&&(x=x.slice(1)),++p,x.length){var v={v:x,t:"s"};Array.isArray(l)?l[f][p]=v:l[Er({r:f,c:p})]=v}break}h=m.lastIndex}p>u.e.c&&(u.e.c=p)}),l["!ref"]=nn(u),l}function r(a,i){return Rp(e(a,i),i)}function n(a){for(var i=["{\\rtf1\\ansi"],o=wn(a["!ref"]),l,c=Array.isArray(a),u=o.s.r;u<=o.e.r;++u){i.push("\\trowd\\trautofit1");for(var d=o.s.c;d<=o.e.c;++d)i.push("\\cellx"+(d+1));for(i.push("\\pard\\intbl"),d=o.s.c;d<=o.e.c;++d){var f=Er({r:u,c:d});l=c?(a[u]||[])[d]:a[f],!(!l||l.v==null&&(!l.f||l.F))&&(i.push(" "+(l.w||(tf(l),l.w))),i.push("\\cell"))}i.push("\\pard\\intbl\\row")}return i.join("")+"}"}return{to_workbook:r,to_sheet:e,from_sheet:n}}();function Xbt(e){var t=e.slice(e[0]==="#"?1:0).slice(0,6);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function xj(e){for(var t=0,r=1;t!=3;++t)r=r*256+(e[t]>255?255:e[t]<0?0:e[t]);return r.toString(16).toUpperCase().slice(1)}function Zbt(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.max(t,r,n),i=Math.min(t,r,n),o=a-i;if(o===0)return[0,0,t];var l=0,c=0,u=a+i;switch(c=o/(u>1?2-u:u),a){case t:l=((r-n)/o+6)%6;break;case r:l=(n-t)/o+2;break;case n:l=(t-r)/o+4;break}return[l/6,c,u/2]}function Jbt(e){var t=e[0],r=e[1],n=e[2],a=r*2*(n<.5?n:1-n),i=n-a/2,o=[i,i,i],l=6*t,c;if(r!==0)switch(l|0){case 0:case 6:c=a*l,o[0]+=a,o[1]+=c;break;case 1:c=a*(2-l),o[0]+=c,o[1]+=a;break;case 2:c=a*(l-2),o[1]+=a,o[2]+=c;break;case 3:c=a*(4-l),o[1]+=c,o[2]+=a;break;case 4:c=a*(l-4),o[2]+=a,o[0]+=c;break;case 5:c=a*(6-l),o[2]+=c,o[0]+=a;break}for(var u=0;u!=3;++u)o[u]=Math.round(o[u]*255);return o}function Dk(e,t){if(t===0)return e;var r=Zbt(Xbt(e));return t<0?r[2]=r[2]*(1+t):r[2]=1-(1-r[2])*(1-t),xj(Jbt(r))}var lme=6,Qbt=15,ewt=1,ho=lme;function vj(e){return Math.floor((e+Math.round(128/ho)/256)*ho)}function yj(e){return Math.floor((e-5)/ho*100+.5)/100}function Ik(e){return Math.round((e*ho+5)/ho*256)/256}function PP(e){return Ik(yj(vj(e)))}function d7(e){var t=Math.abs(e-PP(e)),r=ho;if(t>.005)for(ho=ewt;ho<Qbt;++ho)Math.abs(e-PP(e))<=t&&(t=Math.abs(e-PP(e)),r=ho);ho=r}function hp(e){e.width?(e.wpx=vj(e.width),e.wch=yj(e.wpx),e.MDW=ho):e.wpx?(e.wch=yj(e.wpx),e.width=Ik(e.wch),e.MDW=ho):typeof e.wch=="number"&&(e.width=Ik(e.wch),e.wpx=vj(e.width),e.MDW=ho),e.customWidth&&delete e.customWidth}var twt=96,cme=twt;function bj(e){return e*96/cme}function By(e){return e*cme/96}var rwt={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinHorzCross:"lightGrid"};function nwt(e,t,r,n){t.Borders=[];var a={},i=!1;(e[0].match(_o)||[]).forEach(function(o){var l=Rr(o);switch(df(l[0])){case"<borders":case"<borders>":case"</borders>":break;case"<border":case"<border>":case"<border/>":a={},l.diagonalUp&&(a.diagonalUp=Ls(l.diagonalUp)),l.diagonalDown&&(a.diagonalDown=Ls(l.diagonalDown)),t.Borders.push(a);break;case"</border>":break;case"<left/>":break;case"<left":case"<left>":break;case"</left>":break;case"<right/>":break;case"<right":case"<right>":break;case"</right>":break;case"<top/>":break;case"<top":case"<top>":break;case"</top>":break;case"<bottom/>":break;case"<bottom":case"<bottom>":break;case"</bottom>":break;case"<diagonal":case"<diagonal>":case"<diagonal/>":break;case"</diagonal>":break;case"<horizontal":case"<horizontal>":case"<horizontal/>":break;case"</horizontal>":break;case"<vertical":case"<vertical>":case"<vertical/>":break;case"</vertical>":break;case"<start":case"<start>":case"<start/>":break;case"</start>":break;case"<end":case"<end>":case"<end/>":break;case"</end>":break;case"<color":case"<color>":break;case"<color/>":case"</color>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":i=!0;break;case"</ext>":i=!1;break;default:if(n&&n.WTF&&!i)throw new Error("unrecognized "+l[0]+" in borders")}})}function swt(e,t,r,n){t.Fills=[];var a={},i=!1;(e[0].match(_o)||[]).forEach(function(o){var l=Rr(o);switch(df(l[0])){case"<fills":case"<fills>":case"</fills>":break;case"<fill>":case"<fill":case"<fill/>":a={},t.Fills.push(a);break;case"</fill>":break;case"<gradientFill>":break;case"<gradientFill":case"</gradientFill>":t.Fills.push(a),a={};break;case"<patternFill":case"<patternFill>":l.patternType&&(a.patternType=l.patternType);break;case"<patternFill/>":case"</patternFill>":break;case"<bgColor":a.bgColor||(a.bgColor={}),l.indexed&&(a.bgColor.indexed=parseInt(l.indexed,10)),l.theme&&(a.bgColor.theme=parseInt(l.theme,10)),l.tint&&(a.bgColor.tint=parseFloat(l.tint)),l.rgb&&(a.bgColor.rgb=l.rgb.slice(-6));break;case"<bgColor/>":case"</bgColor>":break;case"<fgColor":a.fgColor||(a.fgColor={}),l.theme&&(a.fgColor.theme=parseInt(l.theme,10)),l.tint&&(a.fgColor.tint=parseFloat(l.tint)),l.rgb!=null&&(a.fgColor.rgb=l.rgb.slice(-6));break;case"<fgColor/>":case"</fgColor>":break;case"<stop":case"<stop/>":break;case"</stop>":break;case"<color":case"<color/>":break;case"</color>":break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":i=!0;break;case"</ext>":i=!1;break;default:if(n&&n.WTF&&!i)throw new Error("unrecognized "+l[0]+" in fills")}})}function awt(e,t,r,n){t.Fonts=[];var a={},i=!1;(e[0].match(_o)||[]).forEach(function(o){var l=Rr(o);switch(df(l[0])){case"<fonts":case"<fonts>":case"</fonts>":break;case"<font":case"<font>":break;case"</font>":case"<font/>":t.Fonts.push(a),a={};break;case"<name":l.val&&(a.name=us(l.val));break;case"<name/>":case"</name>":break;case"<b":a.bold=l.val?Ls(l.val):1;break;case"<b/>":a.bold=1;break;case"<i":a.italic=l.val?Ls(l.val):1;break;case"<i/>":a.italic=1;break;case"<u":switch(l.val){case"none":a.underline=0;break;case"single":a.underline=1;break;case"double":a.underline=2;break;case"singleAccounting":a.underline=33;break;case"doubleAccounting":a.underline=34;break}break;case"<u/>":a.underline=1;break;case"<strike":a.strike=l.val?Ls(l.val):1;break;case"<strike/>":a.strike=1;break;case"<outline":a.outline=l.val?Ls(l.val):1;break;case"<outline/>":a.outline=1;break;case"<shadow":a.shadow=l.val?Ls(l.val):1;break;case"<shadow/>":a.shadow=1;break;case"<condense":a.condense=l.val?Ls(l.val):1;break;case"<condense/>":a.condense=1;break;case"<extend":a.extend=l.val?Ls(l.val):1;break;case"<extend/>":a.extend=1;break;case"<sz":l.val&&(a.sz=+l.val);break;case"<sz/>":case"</sz>":break;case"<vertAlign":l.val&&(a.vertAlign=l.val);break;case"<vertAlign/>":case"</vertAlign>":break;case"<family":l.val&&(a.family=parseInt(l.val,10));break;case"<family/>":case"</family>":break;case"<scheme":l.val&&(a.scheme=l.val);break;case"<scheme/>":case"</scheme>":break;case"<charset":if(l.val=="1")break;l.codepage=LM[parseInt(l.val,10)];break;case"<color":if(a.color||(a.color={}),l.auto&&(a.color.auto=Ls(l.auto)),l.rgb)a.color.rgb=l.rgb.slice(-6);else if(l.indexed){a.color.index=parseInt(l.indexed,10);var c=K0[a.color.index];a.color.index==81&&(c=K0[1]),c||(c=K0[1]),a.color.rgb=c[0].toString(16)+c[1].toString(16)+c[2].toString(16)}else l.theme&&(a.color.theme=parseInt(l.theme,10),l.tint&&(a.color.tint=parseFloat(l.tint)),l.theme&&r.themeElements&&r.themeElements.clrScheme&&(a.color.rgb=Dk(r.themeElements.clrScheme[a.color.theme].rgb,a.color.tint||0)));break;case"<color/>":case"</color>":break;case"<AlternateContent":i=!0;break;case"</AlternateContent>":i=!1;break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":i=!0;break;case"</ext>":i=!1;break;default:if(n&&n.WTF&&!i)throw new Error("unrecognized "+l[0]+" in fonts")}})}function iwt(e,t,r){t.NumberFmt=[];for(var n=wa(Nr),a=0;a<n.length;++a)t.NumberFmt[n[a]]=Nr[n[a]];var i=e[0].match(_o);if(i)for(a=0;a<i.length;++a){var o=Rr(i[a]);switch(df(o[0])){case"<numFmts":case"</numFmts>":case"<numFmts/>":case"<numFmts>":break;case"<numFmt":{var l=Dn(us(o.formatCode)),c=parseInt(o.numFmtId,10);if(t.NumberFmt[c]=l,c>0){if(c>392){for(c=392;c>60&&t.NumberFmt[c]!=null;--c);t.NumberFmt[c]=l}Gd(l,c)}}break;case"</numFmt>":break;default:if(r.WTF)throw new Error("unrecognized "+o[0]+" in numFmts")}}}function owt(e){var t=["<numFmts>"];return[[5,8],[23,26],[41,44],[50,392]].forEach(function(r){for(var n=r[0];n<=r[1];++n)e[n]!=null&&(t[t.length]=Lt("numFmt",null,{numFmtId:n,formatCode:ns(e[n])}))}),t.length===1?"":(t[t.length]="</numFmts>",t[0]=Lt("numFmts",null,{count:t.length-2}).replace("/>",">"),t.join(""))}var OS=["numFmtId","fillId","fontId","borderId","xfId"],DS=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","pivotButton","quotePrefix"];function lwt(e,t,r){t.CellXf=[];var n,a=!1;(e[0].match(_o)||[]).forEach(function(i){var o=Rr(i),l=0;switch(df(o[0])){case"<cellXfs":case"<cellXfs>":case"<cellXfs/>":case"</cellXfs>":break;case"<xf":case"<xf/>":for(n=o,delete n[0],l=0;l<OS.length;++l)n[OS[l]]&&(n[OS[l]]=parseInt(n[OS[l]],10));for(l=0;l<DS.length;++l)n[DS[l]]&&(n[DS[l]]=Ls(n[DS[l]]));if(t.NumberFmt&&n.numFmtId>392){for(l=392;l>60;--l)if(t.NumberFmt[n.numFmtId]==t.NumberFmt[l]){n.numFmtId=l;break}}t.CellXf.push(n);break;case"</xf>":break;case"<alignment":case"<alignment/>":var c={};o.vertical&&(c.vertical=o.vertical),o.horizontal&&(c.horizontal=o.horizontal),o.textRotation!=null&&(c.textRotation=o.textRotation),o.indent&&(c.indent=o.indent),o.wrapText&&(c.wrapText=Ls(o.wrapText)),n.alignment=c;break;case"</alignment>":break;case"<protection":break;case"</protection>":case"<protection/>":break;case"<AlternateContent":a=!0;break;case"</AlternateContent>":a=!1;break;case"<extLst":case"<extLst>":case"</extLst>":break;case"<ext":a=!0;break;case"</ext>":a=!1;break;default:if(r&&r.WTF&&!a)throw new Error("unrecognized "+o[0]+" in cellXfs")}})}function cwt(e){var t=[];return t[t.length]=Lt("cellXfs",null),e.forEach(function(r){t[t.length]=Lt("xf",null,r)}),t[t.length]="</cellXfs>",t.length===2?"":(t[0]=Lt("cellXfs",null,{count:t.length-2}).replace("/>",">"),t.join(""))}var uwt=function(){var t=/<(?:\w+:)?numFmts([^>]*)>[\S\s]*?<\/(?:\w+:)?numFmts>/,r=/<(?:\w+:)?cellXfs([^>]*)>[\S\s]*?<\/(?:\w+:)?cellXfs>/,n=/<(?:\w+:)?fills([^>]*)>[\S\s]*?<\/(?:\w+:)?fills>/,a=/<(?:\w+:)?fonts([^>]*)>[\S\s]*?<\/(?:\w+:)?fonts>/,i=/<(?:\w+:)?borders([^>]*)>[\S\s]*?<\/(?:\w+:)?borders>/;return function(l,c,u){var d={};if(!l)return d;l=l.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");var f;return(f=l.match(t))&&iwt(f,d,u),(f=l.match(a))&&awt(f,d,c,u),(f=l.match(n))&&swt(f,d,c,u),(f=l.match(i))&&nwt(f,d,c,u),(f=l.match(r))&&lwt(f,d,u),d}}();function ume(e,t){var r=[Ra,Lt("styleSheet",null,{xmlns:Kg[0],"xmlns:vt":mi.vt})],n;return e.SSF&&(n=owt(e.SSF))!=null&&(r[r.length]=n),r[r.length]='<fonts count="1"><font><sz val="12"/><color theme="1"/><name val="Calibri"/><family val="2"/><scheme val="minor"/></font></fonts>',r[r.length]='<fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>',r[r.length]='<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>',r[r.length]='<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>',(n=cwt(t.cellXfs))&&(r[r.length]=n),r[r.length]='<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>',r[r.length]='<dxfs count="0"/>',r[r.length]='<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>',r.length>2&&(r[r.length]="</styleSheet>",r[1]=r[1].replace("/>",">")),r.join("")}function dwt(e,t){var r=e.read_shift(2),n=xo(e);return[r,n]}function fwt(e,t,r){r||(r=lt(6+4*t.length)),r.write_shift(2,e),Pi(t,r);var n=r.length>r.l?r.slice(0,r.l):r;return r.l==null&&(r.l=r.length),n}function hwt(e,t,r){var n={};n.sz=e.read_shift(2)/20;var a=Kvt(e);a.fItalic&&(n.italic=1),a.fCondense&&(n.condense=1),a.fExtend&&(n.extend=1),a.fShadow&&(n.shadow=1),a.fOutline&&(n.outline=1),a.fStrikeout&&(n.strike=1);var i=e.read_shift(2);switch(i===700&&(n.bold=1),e.read_shift(2)){case 1:n.vertAlign="superscript";break;case 2:n.vertAlign="subscript";break}var o=e.read_shift(1);o!=0&&(n.underline=o);var l=e.read_shift(1);l>0&&(n.family=l);var c=e.read_shift(1);switch(c>0&&(n.charset=c),e.l++,n.color=Gvt(e),e.read_shift(1)){case 1:n.scheme="major";break;case 2:n.scheme="minor";break}return n.name=xo(e),n}function mwt(e,t){t||(t=lt(25+4*32)),t.write_shift(2,e.sz*20),Yvt(e,t),t.write_shift(2,e.bold?700:400);var r=0;e.vertAlign=="superscript"?r=1:e.vertAlign=="subscript"&&(r=2),t.write_shift(2,r),t.write_shift(1,e.underline||0),t.write_shift(1,e.family||0),t.write_shift(1,e.charset||0),t.write_shift(1,0),Tk(e.color,t);var n=0;return n=2,t.write_shift(1,n),Pi(e.name,t),t.length>t.l?t.slice(0,t.l):t}var pwt=["none","solid","mediumGray","darkGray","lightGray","darkHorizontal","darkVertical","darkDown","darkUp","darkGrid","darkTrellis","lightHorizontal","lightVertical","lightDown","lightUp","lightGrid","lightTrellis","gray125","gray0625"],OP,gwt=bo;function wY(e,t){t||(t=lt(4*3+8*7+16*1)),OP||(OP=iA(pwt));var r=OP[e.patternType];r==null&&(r=40),t.write_shift(4,r);var n=0;if(r!=40)for(Tk({auto:1},t),Tk({auto:1},t);n<12;++n)t.write_shift(4,0);else{for(;n<4;++n)t.write_shift(4,0);for(;n<12;++n)t.write_shift(4,0)}return t.length>t.l?t.slice(0,t.l):t}function xwt(e,t){var r=e.l+t,n=e.read_shift(2),a=e.read_shift(2);return e.l=r,{ixfe:n,numFmtId:a}}function dme(e,t,r){r||(r=lt(16)),r.write_shift(2,t||0),r.write_shift(2,e.numFmtId||0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(1,0),r.write_shift(1,0);var n=0;return r.write_shift(1,n),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(1,0),r}function Bb(e,t){return t||(t=lt(10)),t.write_shift(1,0),t.write_shift(1,0),t.write_shift(4,0),t.write_shift(4,0),t}var vwt=bo;function ywt(e,t){return t||(t=lt(51)),t.write_shift(1,0),Bb(null,t),Bb(null,t),Bb(null,t),Bb(null,t),Bb(null,t),t.length>t.l?t.slice(0,t.l):t}function bwt(e,t){return t||(t=lt(12+4*10)),t.write_shift(4,e.xfId),t.write_shift(2,1),t.write_shift(1,0),t.write_shift(1,0),Ak(e.name||"",t),t.length>t.l?t.slice(0,t.l):t}function wwt(e,t,r){var n=lt(2052);return n.write_shift(4,e),Ak(t,n),Ak(r,n),n.length>n.l?n.slice(0,n.l):n}function jwt(e,t,r){var n={};n.NumberFmt=[];for(var a in Nr)n.NumberFmt[a]=Nr[a];n.CellXf=[],n.Fonts=[];var i=[],o=!1;return Ch(e,function(c,u,d){switch(d){case 44:n.NumberFmt[c[0]]=c[1],Gd(c[1],c[0]);break;case 43:n.Fonts.push(c),c.color.theme!=null&&t&&t.themeElements&&t.themeElements.clrScheme&&(c.color.rgb=Dk(t.themeElements.clrScheme[c.color.theme].rgb,c.color.tint||0));break;case 1025:break;case 45:break;case 46:break;case 47:i[i.length-1]==617&&n.CellXf.push(c);break;case 48:case 507:case 572:case 475:break;case 1171:case 2102:case 1130:case 512:case 2095:case 3072:break;case 35:o=!0;break;case 36:o=!1;break;case 37:i.push(d),o=!0;break;case 38:i.pop(),o=!1;break;default:if(u.T>0)i.push(d);else if(u.T<0)i.pop();else if(!o||r.WTF&&i[i.length-1]!=37)throw new Error("Unexpected record 0x"+d.toString(16))}}),n}function _wt(e,t){if(t){var r=0;[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var a=n[0];a<=n[1];++a)t[a]!=null&&++r}),r!=0&&(yt(e,615,Ku(r)),[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var a=n[0];a<=n[1];++a)t[a]!=null&&yt(e,44,fwt(a,t[a]))}),yt(e,616))}}function Nwt(e){var t=1;yt(e,611,Ku(t)),yt(e,43,mwt({sz:12,color:{theme:1},name:"Calibri",family:2})),yt(e,612)}function Swt(e){var t=2;yt(e,603,Ku(t)),yt(e,45,wY({patternType:"none"})),yt(e,45,wY({patternType:"gray125"})),yt(e,604)}function kwt(e){var t=1;yt(e,613,Ku(t)),yt(e,46,ywt()),yt(e,614)}function Cwt(e){var t=1;yt(e,626,Ku(t)),yt(e,47,dme({numFmtId:0},65535)),yt(e,627)}function Ewt(e,t){yt(e,617,Ku(t.length)),t.forEach(function(r){yt(e,47,dme(r,0))}),yt(e,618)}function Awt(e){var t=1;yt(e,619,Ku(t)),yt(e,48,bwt({xfId:0,name:"Normal"})),yt(e,620)}function Twt(e){var t=0;yt(e,505,Ku(t)),yt(e,506)}function Pwt(e){var t=0;yt(e,508,wwt(t,"TableStyleMedium9","PivotStyleMedium4")),yt(e,509)}function Owt(e,t){var r=gl();return yt(r,278),_wt(r,e.SSF),Nwt(r),Swt(r),kwt(r),Cwt(r),Ewt(r,t.cellXfs),Awt(r),Twt(r),Pwt(r),yt(r,279),r.end()}var Dwt=["</a:lt1>","</a:dk1>","</a:lt2>","</a:dk2>","</a:accent1>","</a:accent2>","</a:accent3>","</a:accent4>","</a:accent5>","</a:accent6>","</a:hlink>","</a:folHlink>"];function Iwt(e,t,r){t.themeElements.clrScheme=[];var n={};(e[0].match(_o)||[]).forEach(function(a){var i=Rr(a);switch(i[0]){case"<a:clrScheme":case"</a:clrScheme>":break;case"<a:srgbClr":n.rgb=i.val;break;case"<a:sysClr":n.rgb=i.lastClr;break;case"<a:dk1>":case"</a:dk1>":case"<a:lt1>":case"</a:lt1>":case"<a:dk2>":case"</a:dk2>":case"<a:lt2>":case"</a:lt2>":case"<a:accent1>":case"</a:accent1>":case"<a:accent2>":case"</a:accent2>":case"<a:accent3>":case"</a:accent3>":case"<a:accent4>":case"</a:accent4>":case"<a:accent5>":case"</a:accent5>":case"<a:accent6>":case"</a:accent6>":case"<a:hlink>":case"</a:hlink>":case"<a:folHlink>":case"</a:folHlink>":i[0].charAt(1)==="/"?(t.themeElements.clrScheme[Dwt.indexOf(i[0])]=n,n={}):n.name=i[0].slice(3,i[0].length-1);break;default:if(r&&r.WTF)throw new Error("Unrecognized "+i[0]+" in clrScheme")}})}function Rwt(){}function Lwt(){}var Fwt=/<a:clrScheme([^>]*)>[\s\S]*<\/a:clrScheme>/,Mwt=/<a:fontScheme([^>]*)>[\s\S]*<\/a:fontScheme>/,$wt=/<a:fmtScheme([^>]*)>[\s\S]*<\/a:fmtScheme>/;function Bwt(e,t,r){t.themeElements={};var n;[["clrScheme",Fwt,Iwt],["fontScheme",Mwt,Rwt],["fmtScheme",$wt,Lwt]].forEach(function(a){if(!(n=e.match(a[1])))throw new Error(a[0]+" not found in themeElements");a[2](n,t,r)})}var zwt=/<a:themeElements([^>]*)>[\s\S]*<\/a:themeElements>/;function fme(e,t){(!e||e.length===0)&&(e=f7());var r,n={};if(!(r=e.match(zwt)))throw new Error("themeElements not found in theme");return Bwt(r[0],n,t),n.raw=e,n}function f7(e,t){if(t&&t.themeXLSX)return t.themeXLSX;if(e&&typeof e.raw=="string")return e.raw;var r=[Ra];return r[r.length]='<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">',r[r.length]="<a:themeElements>",r[r.length]='<a:clrScheme name="Office">',r[r.length]='<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>',r[r.length]='<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>',r[r.length]='<a:dk2><a:srgbClr val="1F497D"/></a:dk2>',r[r.length]='<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>',r[r.length]='<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>',r[r.length]='<a:accent2><a:srgbClr val="C0504D"/></a:accent2>',r[r.length]='<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>',r[r.length]='<a:accent4><a:srgbClr val="8064A2"/></a:accent4>',r[r.length]='<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>',r[r.length]='<a:accent6><a:srgbClr val="F79646"/></a:accent6>',r[r.length]='<a:hlink><a:srgbClr val="0000FF"/></a:hlink>',r[r.length]='<a:folHlink><a:srgbClr val="800080"/></a:folHlink>',r[r.length]="</a:clrScheme>",r[r.length]='<a:fontScheme name="Office">',r[r.length]="<a:majorFont>",r[r.length]='<a:latin typeface="Cambria"/>',r[r.length]='<a:ea typeface=""/>',r[r.length]='<a:cs typeface=""/>',r[r.length]='<a:font script="Jpan" typeface="MS Pゴシック"/>',r[r.length]='<a:font script="Hang" typeface="맑은 고딕"/>',r[r.length]='<a:font script="Hans" typeface="宋体"/>',r[r.length]='<a:font script="Hant" typeface="新細明體"/>',r[r.length]='<a:font script="Arab" typeface="Times New Roman"/>',r[r.length]='<a:font script="Hebr" typeface="Times New Roman"/>',r[r.length]='<a:font script="Thai" typeface="Tahoma"/>',r[r.length]='<a:font script="Ethi" typeface="Nyala"/>',r[r.length]='<a:font script="Beng" typeface="Vrinda"/>',r[r.length]='<a:font script="Gujr" typeface="Shruti"/>',r[r.length]='<a:font script="Khmr" typeface="MoolBoran"/>',r[r.length]='<a:font script="Knda" typeface="Tunga"/>',r[r.length]='<a:font script="Guru" typeface="Raavi"/>',r[r.length]='<a:font script="Cans" typeface="Euphemia"/>',r[r.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',r[r.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',r[r.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',r[r.length]='<a:font script="Thaa" typeface="MV Boli"/>',r[r.length]='<a:font script="Deva" typeface="Mangal"/>',r[r.length]='<a:font script="Telu" typeface="Gautami"/>',r[r.length]='<a:font script="Taml" typeface="Latha"/>',r[r.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',r[r.length]='<a:font script="Orya" typeface="Kalinga"/>',r[r.length]='<a:font script="Mlym" typeface="Kartika"/>',r[r.length]='<a:font script="Laoo" typeface="DokChampa"/>',r[r.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',r[r.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',r[r.length]='<a:font script="Viet" typeface="Times New Roman"/>',r[r.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',r[r.length]='<a:font script="Geor" typeface="Sylfaen"/>',r[r.length]="</a:majorFont>",r[r.length]="<a:minorFont>",r[r.length]='<a:latin typeface="Calibri"/>',r[r.length]='<a:ea typeface=""/>',r[r.length]='<a:cs typeface=""/>',r[r.length]='<a:font script="Jpan" typeface="MS Pゴシック"/>',r[r.length]='<a:font script="Hang" typeface="맑은 고딕"/>',r[r.length]='<a:font script="Hans" typeface="宋体"/>',r[r.length]='<a:font script="Hant" typeface="新細明體"/>',r[r.length]='<a:font script="Arab" typeface="Arial"/>',r[r.length]='<a:font script="Hebr" typeface="Arial"/>',r[r.length]='<a:font script="Thai" typeface="Tahoma"/>',r[r.length]='<a:font script="Ethi" typeface="Nyala"/>',r[r.length]='<a:font script="Beng" typeface="Vrinda"/>',r[r.length]='<a:font script="Gujr" typeface="Shruti"/>',r[r.length]='<a:font script="Khmr" typeface="DaunPenh"/>',r[r.length]='<a:font script="Knda" typeface="Tunga"/>',r[r.length]='<a:font script="Guru" typeface="Raavi"/>',r[r.length]='<a:font script="Cans" typeface="Euphemia"/>',r[r.length]='<a:font script="Cher" typeface="Plantagenet Cherokee"/>',r[r.length]='<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>',r[r.length]='<a:font script="Tibt" typeface="Microsoft Himalaya"/>',r[r.length]='<a:font script="Thaa" typeface="MV Boli"/>',r[r.length]='<a:font script="Deva" typeface="Mangal"/>',r[r.length]='<a:font script="Telu" typeface="Gautami"/>',r[r.length]='<a:font script="Taml" typeface="Latha"/>',r[r.length]='<a:font script="Syrc" typeface="Estrangelo Edessa"/>',r[r.length]='<a:font script="Orya" typeface="Kalinga"/>',r[r.length]='<a:font script="Mlym" typeface="Kartika"/>',r[r.length]='<a:font script="Laoo" typeface="DokChampa"/>',r[r.length]='<a:font script="Sinh" typeface="Iskoola Pota"/>',r[r.length]='<a:font script="Mong" typeface="Mongolian Baiti"/>',r[r.length]='<a:font script="Viet" typeface="Arial"/>',r[r.length]='<a:font script="Uigh" typeface="Microsoft Uighur"/>',r[r.length]='<a:font script="Geor" typeface="Sylfaen"/>',r[r.length]="</a:minorFont>",r[r.length]="</a:fontScheme>",r[r.length]='<a:fmtScheme name="Office">',r[r.length]="<a:fillStyleLst>",r[r.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:lin ang="16200000" scaled="1"/>',r[r.length]="</a:gradFill>",r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="100000"/><a:shade val="100000"/><a:satMod val="130000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:lin ang="16200000" scaled="0"/>',r[r.length]="</a:gradFill>",r[r.length]="</a:fillStyleLst>",r[r.length]="<a:lnStyleLst>",r[r.length]='<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>',r[r.length]='<a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',r[r.length]='<a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>',r[r.length]="</a:lnStyleLst>",r[r.length]="<a:effectStyleLst>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="38000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.length]="</a:effectStyle>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.length]="</a:effectStyle>",r[r.length]="<a:effectStyle>",r[r.length]="<a:effectLst>",r[r.length]='<a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="35000"/></a:srgbClr></a:outerShdw>',r[r.length]="</a:effectLst>",r[r.length]='<a:scene3d><a:camera prst="orthographicFront"><a:rot lat="0" lon="0" rev="0"/></a:camera><a:lightRig rig="threePt" dir="t"><a:rot lat="0" lon="0" rev="1200000"/></a:lightRig></a:scene3d>',r[r.length]='<a:sp3d><a:bevelT w="63500" h="25400"/></a:sp3d>',r[r.length]="</a:effectStyle>",r[r.length]="</a:effectStyleLst>",r[r.length]="<a:bgFillStyleLst>",r[r.length]='<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>',r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="40000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="40000"><a:schemeClr val="phClr"><a:tint val="45000"/><a:shade val="99000"/><a:satMod val="350000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="20000"/><a:satMod val="255000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:path path="circle"><a:fillToRect l="50000" t="-80000" r="50000" b="180000"/></a:path>',r[r.length]="</a:gradFill>",r[r.length]='<a:gradFill rotWithShape="1">',r[r.length]="<a:gsLst>",r[r.length]='<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="80000"/><a:satMod val="300000"/></a:schemeClr></a:gs>',r[r.length]='<a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="30000"/><a:satMod val="200000"/></a:schemeClr></a:gs>',r[r.length]="</a:gsLst>",r[r.length]='<a:path path="circle"><a:fillToRect l="50000" t="50000" r="50000" b="50000"/></a:path>',r[r.length]="</a:gradFill>",r[r.length]="</a:bgFillStyleLst>",r[r.length]="</a:fmtScheme>",r[r.length]="</a:themeElements>",r[r.length]="<a:objectDefaults>",r[r.length]="<a:spDef>",r[r.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="1"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="3"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="2"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></a:style>',r[r.length]="</a:spDef>",r[r.length]="<a:lnDef>",r[r.length]='<a:spPr/><a:bodyPr/><a:lstStyle/><a:style><a:lnRef idx="2"><a:schemeClr val="accent1"/></a:lnRef><a:fillRef idx="0"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="1"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="tx1"/></a:fontRef></a:style>',r[r.length]="</a:lnDef>",r[r.length]="</a:objectDefaults>",r[r.length]="<a:extraClrSchemeLst/>",r[r.length]="</a:theme>",r.join("")}function Uwt(e,t,r){var n=e.l+t,a=e.read_shift(4);if(a!==124226){if(!r.cellStyles){e.l=n;return}var i=e.slice(e.l);e.l=n;var o;try{o=lhe(i,{type:"array"})}catch{return}var l=Hl(o,"theme/theme/theme1.xml",!0);if(l)return fme(l,r)}}function qwt(e){return e.read_shift(4)}function Vwt(e){var t={};switch(t.xclrType=e.read_shift(2),t.nTintShade=e.read_shift(2),t.xclrType){case 0:e.l+=4;break;case 1:t.xclrValue=Wwt(e,4);break;case 2:t.xclrValue=Whe(e);break;case 3:t.xclrValue=qwt(e);break;case 4:e.l+=4;break}return e.l+=8,t}function Wwt(e,t){return bo(e,t)}function Hwt(e,t){return bo(e,t)}function Gwt(e){var t=e.read_shift(2),r=e.read_shift(2)-4,n=[t];switch(t){case 4:case 5:case 7:case 8:case 9:case 10:case 11:case 13:n[1]=Vwt(e);break;case 6:n[1]=Hwt(e,r);break;case 14:case 15:n[1]=e.read_shift(r===1?1:2);break;default:throw new Error("Unrecognized ExtProp type: "+t+" "+r)}return n}function Kwt(e,t){var r=e.l+t;e.l+=2;var n=e.read_shift(2);e.l+=2;for(var a=e.read_shift(2),i=[];a-- >0;)i.push(Gwt(e,r-e.l));return{ixfe:n,ext:i}}function Ywt(e,t){t.forEach(function(r){switch(r[0]){}})}function Xwt(e,t){return{flags:e.read_shift(4),version:e.read_shift(4),name:xo(e)}}function Zwt(e){var t=lt(12+2*e.name.length);return t.write_shift(4,e.flags),t.write_shift(4,e.version),Pi(e.name,t),t.slice(0,t.l)}function Jwt(e){for(var t=[],r=e.read_shift(4);r-- >0;)t.push([e.read_shift(4),e.read_shift(4)]);return t}function Qwt(e){var t=lt(4+8*e.length);t.write_shift(4,e.length);for(var r=0;r<e.length;++r)t.write_shift(4,e[r][0]),t.write_shift(4,e[r][1]);return t}function e2t(e,t){var r=lt(8+2*t.length);return r.write_shift(4,e),Pi(t,r),r.slice(0,r.l)}function t2t(e){return e.l+=4,e.read_shift(4)!=0}function r2t(e,t){var r=lt(8);return r.write_shift(4,e),r.write_shift(4,1),r}function n2t(e,t,r){var n={Types:[],Cell:[],Value:[]},a=r||{},i=[],o=!1,l=2;return Ch(e,function(c,u,d){switch(d){case 335:n.Types.push({name:c.name});break;case 51:c.forEach(function(f){l==1?n.Cell.push({type:n.Types[f[0]-1].name,index:f[1]}):l==0&&n.Value.push({type:n.Types[f[0]-1].name,index:f[1]})});break;case 337:l=c?1:0;break;case 338:l=2;break;case 35:i.push(d),o=!0;break;case 36:i.pop(),o=!1;break;default:if(!u.T){if(!o||a.WTF&&i[i.length-1]!=35)throw new Error("Unexpected record 0x"+d.toString(16))}}}),n}function s2t(){var e=gl();return yt(e,332),yt(e,334,Ku(1)),yt(e,335,Zwt({name:"XLDAPR",version:12e4,flags:3496657072})),yt(e,336),yt(e,339,e2t(1,"XLDAPR")),yt(e,52),yt(e,35,Ku(514)),yt(e,4096,Ku(0)),yt(e,4097,Cc(1)),yt(e,36),yt(e,53),yt(e,340),yt(e,337,r2t(1)),yt(e,51,Qwt([[1,0]])),yt(e,338),yt(e,333),e.end()}function a2t(e,t,r){var n={Types:[],Cell:[],Value:[]};if(!e)return n;var a=!1,i=2,o;return e.replace(_o,function(l){var c=Rr(l);switch(df(c[0])){case"<?xml":break;case"<metadata":case"</metadata>":break;case"<metadataTypes":case"</metadataTypes>":break;case"<metadataType":n.Types.push({name:c.name});break;case"</metadataType>":break;case"<futureMetadata":for(var u=0;u<n.Types.length;++u)n.Types[u].name==c.name&&(o=n.Types[u]);break;case"</futureMetadata>":break;case"<bk>":break;case"</bk>":break;case"<rc":i==1?n.Cell.push({type:n.Types[c.t-1].name,index:+c.v}):i==0&&n.Value.push({type:n.Types[c.t-1].name,index:+c.v});break;case"</rc>":break;case"<cellMetadata":i=1;break;case"</cellMetadata>":i=2;break;case"<valueMetadata":i=0;break;case"</valueMetadata>":i=2;break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":a=!0;break;case"</ext>":a=!1;break;case"<rvb":if(!o)break;o.offsets||(o.offsets=[]),o.offsets.push(+c.i);break;default:if(!a&&r.WTF)throw new Error("unrecognized "+c[0]+" in metadata")}return l}),n}function hme(){var e=[Ra];return e.push(`<metadata xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xlrd="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" xmlns:xda="http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray">
<metadataTypes count="1">
<metadataType name="XLDAPR" minSupportedVersion="120000" copy="1" pasteAll="1" pasteValues="1" merge="1" splitFirst="1" rowColShift="1" clearFormats="1" clearComments="1" assign="1" coerce="1" cellMeta="1"/>
</metadataTypes>
<futureMetadata name="XLDAPR" count="1">
<bk>
<extLst>
<ext uri="{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}">
<xda:dynamicArrayProperties fDynamic="1" fCollapsed="0"/>
</ext>
</extLst>
</bk>
</futureMetadata>
<cellMetadata count="1">
<bk>
<rc t="1" v="0"/>
</bk>
</cellMetadata>
</metadata>`),e.join("")}function i2t(e){var t=[];if(!e)return t;var r=1;return(e.match(_o)||[]).forEach(function(n){var a=Rr(n);switch(a[0]){case"<?xml":break;case"<calcChain":case"<calcChain>":case"</calcChain>":break;case"<c":delete a[0],a.i?r=a.i:a.i=r,t.push(a);break}}),t}function o2t(e){var t={};t.i=e.read_shift(4);var r={};r.r=e.read_shift(4),r.c=e.read_shift(4),t.r=Er(r);var n=e.read_shift(1);return n&2&&(t.l="1"),n&8&&(t.a="1"),t}function l2t(e,t,r){var n=[];return Ch(e,function(i,o,l){switch(l){case 63:n.push(i);break;default:if(!o.T)throw new Error("Unexpected record 0x"+l.toString(16))}}),n}function c2t(e,t,r,n){if(!e)return e;var a=n||{},i=!1;Ch(e,function(l,c,u){switch(u){case 359:case 363:case 364:case 366:case 367:case 368:case 369:case 370:case 371:case 472:case 577:case 578:case 579:case 580:case 581:case 582:case 583:case 584:case 585:case 586:case 587:break;case 35:i=!0;break;case 36:i=!1;break;default:if(!c.T){if(!i||a.WTF)throw new Error("Unexpected record 0x"+u.toString(16))}}},a)}function u2t(e,t){if(!e)return"??";var r=(e.match(/<c:chart [^>]*r:id="([^"]*)"/)||["",""])[1];return t["!id"][r].Target}var lv=1024;function mme(e,t){for(var r=[21600,21600],n=["m0,0l0",r[1],r[0],r[1],r[0],"0xe"].join(","),a=[Lt("xml",null,{"xmlns:v":zl.v,"xmlns:o":zl.o,"xmlns:x":zl.x,"xmlns:mv":zl.mv}).replace(/\/>/,">"),Lt("o:shapelayout",Lt("o:idmap",null,{"v:ext":"edit",data:e}),{"v:ext":"edit"}),Lt("v:shapetype",[Lt("v:stroke",null,{joinstyle:"miter"}),Lt("v:path",null,{gradientshapeok:"t","o:connecttype":"rect"})].join(""),{id:"_x0000_t202","o:spt":202,coordsize:r.join(","),path:n})];lv<e*1e3;)lv+=1e3;return t.forEach(function(i){var o=Qs(i[0]),l={color2:"#BEFF82",type:"gradient"};l.type=="gradient"&&(l.angle="-180");var c=l.type=="gradient"?Lt("o:fill",null,{type:"gradientUnscaled","v:ext":"view"}):null,u=Lt("v:fill",c,l),d={on:"t",obscured:"t"};++lv,a=a.concat(["<v:shape"+mj({id:"_x0000_s"+lv,type:"#_x0000_t202",style:"position:absolute; margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10"+(i[1].hidden?";visibility:hidden":""),fillcolor:"#ECFAD4",strokecolor:"#edeaa1"})+">",u,Lt("v:shadow",null,d),Lt("v:path",null,{"o:connecttype":"none"}),'<v:textbox><div style="text-align:left"></div></v:textbox>','<x:ClientData ObjectType="Note">',"<x:MoveWithCells/>","<x:SizeWithCells/>",Yi("x:Anchor",[o.c+1,0,o.r+1,0,o.c+3,20,o.r+5,20].join(",")),Yi("x:AutoFill","False"),Yi("x:Row",String(o.r)),Yi("x:Column",String(o.c)),i[1].hidden?"":"<x:Visible/>","</x:ClientData>","</v:shape>"])}),a.push("</xml>"),a.join("")}function jY(e,t,r,n){var a=Array.isArray(e),i;t.forEach(function(o){var l=Qs(o.ref);if(a?(e[l.r]||(e[l.r]=[]),i=e[l.r][l.c]):i=e[o.ref],!i){i={t:"z"},a?e[l.r][l.c]=i:e[o.ref]=i;var c=wn(e["!ref"]||"BDWGO1000001:A1");c.s.r>l.r&&(c.s.r=l.r),c.e.r<l.r&&(c.e.r=l.r),c.s.c>l.c&&(c.s.c=l.c),c.e.c<l.c&&(c.e.c=l.c);var u=nn(c);u!==e["!ref"]&&(e["!ref"]=u)}i.c||(i.c=[]);var d={a:o.author,t:o.t,r:o.r,T:r};o.h&&(d.h=o.h);for(var f=i.c.length-1;f>=0;--f){if(!r&&i.c[f].T)return;r&&!i.c[f].T&&i.c.splice(f,1)}if(r&&n){for(f=0;f<n.length;++f)if(d.a==n[f].id){d.a=n[f].name||d.a;break}}i.c.push(d)})}function d2t(e,t){if(e.match(/<(?:\w+:)?comments *\/>/))return[];var r=[],n=[],a=e.match(/<(?:\w+:)?authors>([\s\S]*)<\/(?:\w+:)?authors>/);a&&a[1]&&a[1].split(/<\/\w*:?author>/).forEach(function(o){if(!(o===""||o.trim()==="")){var l=o.match(/<(?:\w+:)?author[^>]*>(.*)/);l&&r.push(l[1])}});var i=e.match(/<(?:\w+:)?commentList>([\s\S]*)<\/(?:\w+:)?commentList>/);return i&&i[1]&&i[1].split(/<\/\w*:?comment>/).forEach(function(o){if(!(o===""||o.trim()==="")){var l=o.match(/<(?:\w+:)?comment[^>]*>/);if(l){var c=Rr(l[0]),u={author:c.authorId&&r[c.authorId]||"sheetjsghost",ref:c.ref,guid:c.guid},d=Qs(c.ref);if(!(t.sheetRows&&t.sheetRows<=d.r)){var f=o.match(/<(?:\w+:)?text>([\s\S]*)<\/(?:\w+:)?text>/),m=!!f&&!!f[1]&&c7(f[1])||{r:"",t:"",h:""};u.r=m.r,m.r=="<t></t>"&&(m.t=m.h=""),u.t=(m.t||"").replace(/\r\n/g,`
`).replace(/\r/g,`
`),t.cellHTML&&(u.h=m.h),n.push(u)}}}}),n}function pme(e){var t=[Ra,Lt("comments",null,{xmlns:Kg[0]})],r=[];return t.push("<authors>"),e.forEach(function(n){n[1].forEach(function(a){var i=ns(a.a);r.indexOf(i)==-1&&(r.push(i),t.push("<author>"+i+"</author>")),a.T&&a.ID&&r.indexOf("tc="+a.ID)==-1&&(r.push("tc="+a.ID),t.push("<author>tc="+a.ID+"</author>"))})}),r.length==0&&(r.push("SheetJ5"),t.push("<author>SheetJ5</author>")),t.push("</authors>"),t.push("<commentList>"),e.forEach(function(n){var a=0,i=[];if(n[1][0]&&n[1][0].T&&n[1][0].ID?a=r.indexOf("tc="+n[1][0].ID):n[1].forEach(function(c){c.a&&(a=r.indexOf(ns(c.a))),i.push(c.t||"")}),t.push('<comment ref="'+n[0]+'" authorId="'+a+'"><text>'),i.length<=1)t.push(Yi("t",ns(i[0]||"")));else{for(var o=`Comment:
`+i[0]+`
`,l=1;l<i.length;++l)o+=`Reply:
`+i[l]+`
`;t.push(Yi("t",ns(o)))}t.push("</text></comment>")}),t.push("</commentList>"),t.length>2&&(t[t.length]="</comments>",t[1]=t[1].replace("/>",">")),t.join("")}function f2t(e,t){var r=[],n=!1,a={},i=0;return e.replace(_o,function(l,c){var u=Rr(l);switch(df(u[0])){case"<?xml":break;case"<ThreadedComments":break;case"</ThreadedComments>":break;case"<threadedComment":a={author:u.personId,guid:u.id,ref:u.ref,T:1};break;case"</threadedComment>":a.t!=null&&r.push(a);break;case"<text>":case"<text":i=c+l.length;break;case"</text>":a.t=e.slice(i,c).replace(/\r\n/g,`
`).replace(/\r/g,`
`);break;case"<mentions":case"<mentions>":n=!0;break;case"</mentions>":n=!1;break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;default:if(!n&&t.WTF)throw new Error("unrecognized "+u[0]+" in threaded comments")}return l}),r}function h2t(e,t,r){var n=[Ra,Lt("ThreadedComments",null,{xmlns:mi.TCMNT}).replace(/[\/]>/,">")];return e.forEach(function(a){var i="";(a[1]||[]).forEach(function(o,l){if(!o.T){delete o.ID;return}o.a&&t.indexOf(o.a)==-1&&t.push(o.a);var c={ref:a[0],id:"{54EE7951-7262-4200-6969-"+("000000000000"+r.tcid++).slice(-12)+"}"};l==0?i=c.id:c.parentId=i,o.ID=c.id,o.a&&(c.personId="{54EE7950-7262-4200-6969-"+("000000000000"+t.indexOf(o.a)).slice(-12)+"}"),n.push(Lt("threadedComment",Yi("text",o.t||""),c))})}),n.push("</ThreadedComments>"),n.join("")}function m2t(e,t){var r=[],n=!1;return e.replace(_o,function(i){var o=Rr(i);switch(df(o[0])){case"<?xml":break;case"<personList":break;case"</personList>":break;case"<person":r.push({name:o.displayname,id:o.id});break;case"</person>":break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;default:if(!n&&t.WTF)throw new Error("unrecognized "+o[0]+" in threaded comments")}return i}),r}function p2t(e){var t=[Ra,Lt("personList",null,{xmlns:mi.TCMNT,"xmlns:x":Kg[0]}).replace(/[\/]>/,">")];return e.forEach(function(r,n){t.push(Lt("person",null,{displayName:r,id:"{54EE7950-7262-4200-6969-"+("000000000000"+n).slice(-12)+"}",userId:r,providerId:"None"}))}),t.push("</personList>"),t.join("")}function g2t(e){var t={};t.iauthor=e.read_shift(4);var r=Jg(e);return t.rfx=r.s,t.ref=Er(r.s),e.l+=16,t}function x2t(e,t){return t==null&&(t=lt(36)),t.write_shift(4,e[1].iauthor),L1(e[0],t),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t.write_shift(4,0),t}var v2t=xo;function y2t(e){return Pi(e.slice(0,54))}function b2t(e,t){var r=[],n=[],a={},i=!1;return Ch(e,function(l,c,u){switch(u){case 632:n.push(l);break;case 635:a=l;break;case 637:a.t=l.t,a.h=l.h,a.r=l.r;break;case 636:if(a.author=n[a.iauthor],delete a.iauthor,t.sheetRows&&a.rfx&&t.sheetRows<=a.rfx.r)break;a.t||(a.t=""),delete a.rfx,r.push(a);break;case 3072:break;case 35:i=!0;break;case 36:i=!1;break;case 37:break;case 38:break;default:if(!c.T){if(!i||t.WTF)throw new Error("Unexpected record 0x"+u.toString(16))}}}),r}function w2t(e){var t=gl(),r=[];return yt(t,628),yt(t,630),e.forEach(function(n){n[1].forEach(function(a){r.indexOf(a.a)>-1||(r.push(a.a.slice(0,54)),yt(t,632,y2t(a.a)))})}),yt(t,631),yt(t,633),e.forEach(function(n){n[1].forEach(function(a){a.iauthor=r.indexOf(a.a);var i={s:Qs(n[0]),e:Qs(n[0])};yt(t,635,x2t([i,a])),a.t&&a.t.length>0&&yt(t,637,qvt(a)),yt(t,636),delete a.iauthor})}),yt(t,634),yt(t,629),t.end()}var j2t="application/vnd.ms-office.vbaProject";function _2t(e){var t=vr.utils.cfb_new({root:"R"});return e.FullPaths.forEach(function(r,n){if(!(r.slice(-1)==="/"||!r.match(/_VBA_PROJECT_CUR/))){var a=r.replace(/^[^\/]*/,"R").replace(/\/_VBA_PROJECT_CUR\u0000*/,"");vr.utils.cfb_add(t,a,e.FileIndex[n].content)}}),vr.write(t)}function N2t(e,t){t.FullPaths.forEach(function(r,n){if(n!=0){var a=r.replace(/[^\/]*[\/]/,"/_VBA_PROJECT_CUR/");a.slice(-1)!=="/"&&vr.utils.cfb_add(e,a,t.FileIndex[n].content)}})}var gme=["xlsb","xlsm","xlam","biff8","xla"];function S2t(){return{"!type":"dialog"}}function k2t(){return{"!type":"dialog"}}function C2t(){return{"!type":"macro"}}function E2t(){return{"!type":"macro"}}var Ov=function(){var e=/(^|[^A-Za-z_])R(\[?-?\d+\]|[1-9]\d*|)C(\[?-?\d+\]|[1-9]\d*|)(?![A-Za-z0-9_])/g,t={r:0,c:0};function r(n,a,i,o){var l=!1,c=!1;i.length==0?c=!0:i.charAt(0)=="["&&(c=!0,i=i.slice(1,-1)),o.length==0?l=!0:o.charAt(0)=="["&&(l=!0,o=o.slice(1,-1));var u=i.length>0?parseInt(i,10)|0:0,d=o.length>0?parseInt(o,10)|0:0;return l?d+=t.c:--d,c?u+=t.r:--u,a+(l?"":"$")+zs(d)+(c?"":"$")+va(u)}return function(a,i){return t=i,a.replace(e,r)}}(),h7=/(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g,m7=function(){return function(t,r){return t.replace(h7,function(n,a,i,o,l,c){var u=e7(o)-(i?0:r.c),d=QM(c)-(l?0:r.r),f=d==0?"":l?d+1:"["+d+"]",m=u==0?"":i?u+1:"["+u+"]";return a+"R"+f+"C"+m})}}();function xme(e,t){return e.replace(h7,function(r,n,a,i,o,l){return n+(a=="$"?a+i:zs(e7(i)+t.c))+(o=="$"?o+l:va(QM(l)+t.r))})}function A2t(e,t,r){var n=Go(t),a=n.s,i=Qs(r),o={r:i.r-a.r,c:i.c-a.c};return xme(e,o)}function T2t(e){return e.length!=1}function _Y(e){return e.replace(/_xlfn\./g,"")}function Ba(e){e.l+=1}function mp(e,t){var r=e.read_shift(2);return[r&16383,r>>14&1,r>>15&1]}function vme(e,t,r){var n=2;if(r){if(r.biff>=2&&r.biff<=5)return yme(e);r.biff==12&&(n=4)}var a=e.read_shift(n),i=e.read_shift(n),o=mp(e),l=mp(e);return{s:{r:a,c:o[0],cRel:o[1],rRel:o[2]},e:{r:i,c:l[0],cRel:l[1],rRel:l[2]}}}function yme(e){var t=mp(e),r=mp(e),n=e.read_shift(1),a=e.read_shift(1);return{s:{r:t[0],c:n,cRel:t[1],rRel:t[2]},e:{r:r[0],c:a,cRel:r[1],rRel:r[2]}}}function P2t(e,t,r){if(r.biff<8)return yme(e);var n=e.read_shift(r.biff==12?4:2),a=e.read_shift(r.biff==12?4:2),i=mp(e),o=mp(e);return{s:{r:n,c:i[0],cRel:i[1],rRel:i[2]},e:{r:a,c:o[0],cRel:o[1],rRel:o[2]}}}function bme(e,t,r){if(r&&r.biff>=2&&r.biff<=5)return O2t(e);var n=e.read_shift(r&&r.biff==12?4:2),a=mp(e);return{r:n,c:a[0],cRel:a[1],rRel:a[2]}}function O2t(e){var t=mp(e),r=e.read_shift(1);return{r:t[0],c:r,cRel:t[1],rRel:t[2]}}function D2t(e){var t=e.read_shift(2),r=e.read_shift(2);return{r:t,c:r&255,fQuoted:!!(r&16384),cRel:r>>15,rRel:r>>15}}function I2t(e,t,r){var n=r&&r.biff?r.biff:8;if(n>=2&&n<=5)return R2t(e);var a=e.read_shift(n>=12?4:2),i=e.read_shift(2),o=(i&16384)>>14,l=(i&32768)>>15;if(i&=16383,l==1)for(;a>524287;)a-=1048576;if(o==1)for(;i>8191;)i=i-16384;return{r:a,c:i,cRel:o,rRel:l}}function R2t(e){var t=e.read_shift(2),r=e.read_shift(1),n=(t&32768)>>15,a=(t&16384)>>14;return t&=16383,n==1&&t>=8192&&(t=t-16384),a==1&&r>=128&&(r=r-256),{r:t,c:r,cRel:a,rRel:n}}function L2t(e,t,r){var n=(e[e.l++]&96)>>5,a=vme(e,r.biff>=2&&r.biff<=5?6:8,r);return[n,a]}function F2t(e,t,r){var n=(e[e.l++]&96)>>5,a=e.read_shift(2,"i"),i=8;if(r)switch(r.biff){case 5:e.l+=12,i=6;break;case 12:i=12;break}var o=vme(e,i,r);return[n,a,o]}function M2t(e,t,r){var n=(e[e.l++]&96)>>5;return e.l+=r&&r.biff>8?12:r.biff<8?6:8,[n]}function $2t(e,t,r){var n=(e[e.l++]&96)>>5,a=e.read_shift(2),i=8;if(r)switch(r.biff){case 5:e.l+=12,i=6;break;case 12:i=12;break}return e.l+=i,[n,a]}function B2t(e,t,r){var n=(e[e.l++]&96)>>5,a=P2t(e,t-1,r);return[n,a]}function z2t(e,t,r){var n=(e[e.l++]&96)>>5;return e.l+=r.biff==2?6:r.biff==12?14:7,[n]}function NY(e){var t=e[e.l+1]&1,r=1;return e.l+=4,[t,r]}function U2t(e,t,r){e.l+=2;for(var n=e.read_shift(r&&r.biff==2?1:2),a=[],i=0;i<=n;++i)a.push(e.read_shift(r&&r.biff==2?1:2));return a}function q2t(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(r&&r.biff==2?1:2)]}function V2t(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=2,[n,e.read_shift(r&&r.biff==2?1:2)]}function W2t(e){var t=e[e.l+1]&255?1:0;return e.l+=2,[t,e.read_shift(2)]}function H2t(e,t,r){var n=e[e.l+1]&255?1:0;return e.l+=r&&r.biff==2?3:4,[n]}function wme(e){var t=e.read_shift(1),r=e.read_shift(1);return[t,r]}function G2t(e){return e.read_shift(2),wme(e)}function K2t(e){return e.read_shift(2),wme(e)}function Y2t(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=bme(e,0,r);return[n,a]}function X2t(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=I2t(e,0,r);return[n,a]}function Z2t(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=e.read_shift(2);r&&r.biff==5&&(e.l+=12);var i=bme(e,0,r);return[n,a,i]}function J2t(e,t,r){var n=(e[e.l]&96)>>5;e.l+=1;var a=e.read_shift(r&&r.biff<=3?1:2);return[t_t[a],Nme[a],n]}function Q2t(e,t,r){var n=e[e.l++],a=e.read_shift(1),i=r&&r.biff<=3?[n==88?-1:0,e.read_shift(1)]:ejt(e);return[a,(i[0]===0?Nme:e_t)[i[1]]]}function ejt(e){return[e[e.l+1]>>7,e.read_shift(2)&32767]}function tjt(e,t,r){e.l+=r&&r.biff==2?3:4}function rjt(e,t,r){if(e.l++,r&&r.biff==12)return[e.read_shift(4,"i"),0];var n=e.read_shift(2),a=e.read_shift(r&&r.biff==2?1:2);return[n,a]}function njt(e){return e.l++,Eh[e.read_shift(1)]}function sjt(e){return e.l++,e.read_shift(2)}function ajt(e){return e.l++,e.read_shift(1)!==0}function ijt(e){return e.l++,mo(e)}function ojt(e,t,r){return e.l++,j_(e,t-1,r)}function ljt(e,t){var r=[e.read_shift(1)];if(t==12)switch(r[0]){case 2:r[0]=4;break;case 4:r[0]=16;break;case 0:r[0]=1;break;case 1:r[0]=2;break}switch(r[0]){case 4:r[1]=Ca(e,1)?"TRUE":"FALSE",t!=12&&(e.l+=7);break;case 37:case 16:r[1]=Eh[e[e.l]],e.l+=t==12?4:8;break;case 0:e.l+=8;break;case 1:r[1]=mo(e);break;case 2:r[1]=Qg(e,0,{biff:t>0&&t<8?2:t});break;default:throw new Error("Bad SerAr: "+r[0])}return r}function cjt(e,t,r){for(var n=e.read_shift(r.biff==12?4:2),a=[],i=0;i!=n;++i)a.push((r.biff==12?Jg:uA)(e));return a}function ujt(e,t,r){var n=0,a=0;r.biff==12?(n=e.read_shift(4),a=e.read_shift(4)):(a=1+e.read_shift(1),n=1+e.read_shift(2)),r.biff>=2&&r.biff<8&&(--n,--a==0&&(a=256));for(var i=0,o=[];i!=n&&(o[i]=[]);++i)for(var l=0;l!=a;++l)o[i][l]=ljt(e,r.biff);return o}function djt(e,t,r){var n=e.read_shift(1)>>>5&3,a=!r||r.biff>=8?4:2,i=e.read_shift(a);switch(r.biff){case 2:e.l+=5;break;case 3:case 4:e.l+=8;break;case 5:e.l+=12;break}return[n,0,i]}function fjt(e,t,r){if(r.biff==5)return hjt(e);var n=e.read_shift(1)>>>5&3,a=e.read_shift(2),i=e.read_shift(4);return[n,a,i]}function hjt(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2,"i");e.l+=8;var n=e.read_shift(2);return e.l+=12,[t,r,n]}function mjt(e,t,r){var n=e.read_shift(1)>>>5&3;e.l+=r&&r.biff==2?3:4;var a=e.read_shift(r&&r.biff==2?1:2);return[n,a]}function pjt(e,t,r){var n=e.read_shift(1)>>>5&3,a=e.read_shift(r&&r.biff==2?1:2);return[n,a]}function gjt(e,t,r){var n=e.read_shift(1)>>>5&3;return e.l+=4,r.biff<8&&e.l--,r.biff==12&&(e.l+=2),[n]}function xjt(e,t,r){var n=(e[e.l++]&96)>>5,a=e.read_shift(2),i=4;if(r)switch(r.biff){case 5:i=15;break;case 12:i=6;break}return e.l+=i,[n,a]}var vjt=bo,yjt=bo,bjt=bo;function N_(e,t,r){return e.l+=2,[D2t(e)]}function p7(e){return e.l+=6,[]}var wjt=N_,jjt=p7,_jt=p7,Njt=N_;function jme(e){return e.l+=2,[Va(e),e.read_shift(2)&1]}var Sjt=N_,kjt=jme,Cjt=p7,Ejt=N_,Ajt=N_,Tjt=["Data","All","Headers","??","?Data2","??","?DataHeaders","??","Totals","??","??","??","?DataTotals","??","??","??","?Current"];function Pjt(e){e.l+=2;var t=e.read_shift(2),r=e.read_shift(2),n=e.read_shift(4),a=e.read_shift(2),i=e.read_shift(2),o=Tjt[r>>2&31];return{ixti:t,coltype:r&3,rt:o,idx:n,c:a,C:i}}function Ojt(e){return e.l+=2,[e.read_shift(4)]}function Djt(e,t,r){return e.l+=5,e.l+=2,e.l+=r.biff==2?1:4,["PTGSHEET"]}function Ijt(e,t,r){return e.l+=r.biff==2?4:5,["PTGENDSHEET"]}function Rjt(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function Ljt(e){var t=e.read_shift(1)>>>5&3,r=e.read_shift(2);return[t,r]}function Fjt(e){return e.l+=4,[0,0]}var SY={1:{n:"PtgExp",f:rjt},2:{n:"PtgTbl",f:bjt},3:{n:"PtgAdd",f:Ba},4:{n:"PtgSub",f:Ba},5:{n:"PtgMul",f:Ba},6:{n:"PtgDiv",f:Ba},7:{n:"PtgPower",f:Ba},8:{n:"PtgConcat",f:Ba},9:{n:"PtgLt",f:Ba},10:{n:"PtgLe",f:Ba},11:{n:"PtgEq",f:Ba},12:{n:"PtgGe",f:Ba},13:{n:"PtgGt",f:Ba},14:{n:"PtgNe",f:Ba},15:{n:"PtgIsect",f:Ba},16:{n:"PtgUnion",f:Ba},17:{n:"PtgRange",f:Ba},18:{n:"PtgUplus",f:Ba},19:{n:"PtgUminus",f:Ba},20:{n:"PtgPercent",f:Ba},21:{n:"PtgParen",f:Ba},22:{n:"PtgMissArg",f:Ba},23:{n:"PtgStr",f:ojt},26:{n:"PtgSheet",f:Djt},27:{n:"PtgEndSheet",f:Ijt},28:{n:"PtgErr",f:njt},29:{n:"PtgBool",f:ajt},30:{n:"PtgInt",f:sjt},31:{n:"PtgNum",f:ijt},32:{n:"PtgArray",f:z2t},33:{n:"PtgFunc",f:J2t},34:{n:"PtgFuncVar",f:Q2t},35:{n:"PtgName",f:djt},36:{n:"PtgRef",f:Y2t},37:{n:"PtgArea",f:L2t},38:{n:"PtgMemArea",f:mjt},39:{n:"PtgMemErr",f:vjt},40:{n:"PtgMemNoMem",f:yjt},41:{n:"PtgMemFunc",f:pjt},42:{n:"PtgRefErr",f:gjt},43:{n:"PtgAreaErr",f:M2t},44:{n:"PtgRefN",f:X2t},45:{n:"PtgAreaN",f:B2t},46:{n:"PtgMemAreaN",f:Rjt},47:{n:"PtgMemNoMemN",f:Ljt},57:{n:"PtgNameX",f:fjt},58:{n:"PtgRef3d",f:Z2t},59:{n:"PtgArea3d",f:F2t},60:{n:"PtgRefErr3d",f:xjt},61:{n:"PtgAreaErr3d",f:$2t},255:{}},Mjt={64:32,96:32,65:33,97:33,66:34,98:34,67:35,99:35,68:36,100:36,69:37,101:37,70:38,102:38,71:39,103:39,72:40,104:40,73:41,105:41,74:42,106:42,75:43,107:43,76:44,108:44,77:45,109:45,78:46,110:46,79:47,111:47,88:34,120:34,89:57,121:57,90:58,122:58,91:59,123:59,92:60,124:60,93:61,125:61},$jt={1:{n:"PtgElfLel",f:jme},2:{n:"PtgElfRw",f:Ejt},3:{n:"PtgElfCol",f:wjt},6:{n:"PtgElfRwV",f:Ajt},7:{n:"PtgElfColV",f:Njt},10:{n:"PtgElfRadical",f:Sjt},11:{n:"PtgElfRadicalS",f:Cjt},13:{n:"PtgElfColS",f:jjt},15:{n:"PtgElfColSV",f:_jt},16:{n:"PtgElfRadicalLel",f:kjt},25:{n:"PtgList",f:Pjt},29:{n:"PtgSxName",f:Ojt},255:{}},Bjt={0:{n:"PtgAttrNoop",f:Fjt},1:{n:"PtgAttrSemi",f:H2t},2:{n:"PtgAttrIf",f:V2t},4:{n:"PtgAttrChoose",f:U2t},8:{n:"PtgAttrGoto",f:q2t},16:{n:"PtgAttrSum",f:tjt},32:{n:"PtgAttrBaxcel",f:NY},33:{n:"PtgAttrBaxcel",f:NY},64:{n:"PtgAttrSpace",f:G2t},65:{n:"PtgAttrSpaceSemi",f:K2t},128:{n:"PtgAttrIfError",f:W2t},255:{}};function S_(e,t,r,n){if(n.biff<8)return bo(e,t);for(var a=e.l+t,i=[],o=0;o!==r.length;++o)switch(r[o][0]){case"PtgArray":r[o][1]=ujt(e,0,n),i.push(r[o][1]);break;case"PtgMemArea":r[o][2]=cjt(e,r[o][1],n),i.push(r[o][2]);break;case"PtgExp":n&&n.biff==12&&(r[o][1][1]=e.read_shift(4),i.push(r[o][1]));break;case"PtgList":case"PtgElfRadicalS":case"PtgElfColS":case"PtgElfColSV":throw"Unsupported "+r[o][0]}return t=a-e.l,t!==0&&i.push(bo(e,t)),i}function k_(e,t,r){for(var n=e.l+t,a,i,o=[];n!=e.l;)t=n-e.l,i=e[e.l],a=SY[i]||SY[Mjt[i]],(i===24||i===25)&&(a=(i===24?$jt:Bjt)[e[e.l+1]]),!a||!a.f?bo(e,t):o.push([a.n,a.f(e,t,r)]);return o}function zjt(e){for(var t=[],r=0;r<e.length;++r){for(var n=e[r],a=[],i=0;i<n.length;++i){var o=n[i];if(o)switch(o[0]){case 2:a.push('"'+o[1].replace(/"/g,'""')+'"');break;default:a.push(o[1])}else a.push("")}t.push(a.join(","))}return t.join(";")}var Ujt={PtgAdd:"+",PtgConcat:"&",PtgDiv:"/",PtgEq:"=",PtgGe:">=",PtgGt:">",PtgLe:"<=",PtgLt:"<",PtgMul:"*",PtgNe:"<>",PtgPower:"^",PtgSub:"-"};function qjt(e,t){if(!e&&!(t&&t.biff<=5&&t.biff>=2))throw new Error("empty sheet name");return/[^\w\u4E00-\u9FFF\u3040-\u30FF]/.test(e)?"'"+e+"'":e}function _me(e,t,r){if(!e)return"SH33TJSERR0";if(r.biff>8&&(!e.XTI||!e.XTI[t]))return e.SheetNames[t];if(!e.XTI)return"SH33TJSERR6";var n=e.XTI[t];if(r.biff<8)return t>1e4&&(t-=65536),t<0&&(t=-t),t==0?"":e.XTI[t-1];if(!n)return"SH33TJSERR1";var a="";if(r.biff>8)switch(e[n[0]][0]){case 357:return a=n[1]==-1?"#REF":e.SheetNames[n[1]],n[1]==n[2]?a:a+":"+e.SheetNames[n[2]];case 358:return r.SID!=null?e.SheetNames[r.SID]:"SH33TJSSAME"+e[n[0]][0];case 355:default:return"SH33TJSSRC"+e[n[0]][0]}switch(e[n[0]][0][0]){case 1025:return a=n[1]==-1?"#REF":e.SheetNames[n[1]]||"SH33TJSERR3",n[1]==n[2]?a:a+":"+e.SheetNames[n[2]];case 14849:return e[n[0]].slice(1).map(function(i){return i.Name}).join(";;");default:return e[n[0]][0][3]?(a=n[1]==-1?"#REF":e[n[0]][0][3][n[1]]||"SH33TJSERR4",n[1]==n[2]?a:a+":"+e[n[0]][0][3][n[2]]):"SH33TJSERR2"}}function kY(e,t,r){var n=_me(e,t,r);return n=="#REF"?n:qjt(n,r)}function co(e,t,r,n,a){var i=a&&a.biff||8,o={s:{c:0,r:0}},l=[],c,u,d,f=0,m=0,h,g="";if(!e[0]||!e[0][0])return"";for(var p=-1,x="",v=0,b=e[0].length;v<b;++v){var y=e[0][v];switch(y[0]){case"PtgUminus":l.push("-"+l.pop());break;case"PtgUplus":l.push("+"+l.pop());break;case"PtgPercent":l.push(l.pop()+"%");break;case"PtgAdd":case"PtgConcat":case"PtgDiv":case"PtgEq":case"PtgGe":case"PtgGt":case"PtgLe":case"PtgLt":case"PtgMul":case"PtgNe":case"PtgPower":case"PtgSub":if(c=l.pop(),u=l.pop(),p>=0){switch(e[0][p][1][0]){case 0:x=fa(" ",e[0][p][1][1]);break;case 1:x=fa("\r",e[0][p][1][1]);break;default:if(x="",a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}u=u+x,p=-1}l.push(u+Ujt[y[0]]+c);break;case"PtgIsect":c=l.pop(),u=l.pop(),l.push(u+" "+c);break;case"PtgUnion":c=l.pop(),u=l.pop(),l.push(u+","+c);break;case"PtgRange":c=l.pop(),u=l.pop(),l.push(u+":"+c);break;case"PtgAttrChoose":break;case"PtgAttrGoto":break;case"PtgAttrIf":break;case"PtgAttrIfError":break;case"PtgRef":d=Dw(y[1][1],o,a),l.push(Iw(d,i));break;case"PtgRefN":d=r?Dw(y[1][1],r,a):y[1][1],l.push(Iw(d,i));break;case"PtgRef3d":f=y[1][1],d=Dw(y[1][2],o,a),g=kY(n,f,a),l.push(g+"!"+Iw(d,i));break;case"PtgFunc":case"PtgFuncVar":var N=y[1][0],_=y[1][1];N||(N=0),N&=127;var j=N==0?[]:l.slice(-N);l.length-=N,_==="User"&&(_=j.shift()),l.push(_+"("+j.join(",")+")");break;case"PtgBool":l.push(y[1]?"TRUE":"FALSE");break;case"PtgInt":l.push(y[1]);break;case"PtgNum":l.push(String(y[1]));break;case"PtgStr":l.push('"'+y[1].replace(/"/g,'""')+'"');break;case"PtgErr":l.push(y[1]);break;case"PtgAreaN":h=tY(y[1][1],r?{s:r}:o,a),l.push(EP(h,a));break;case"PtgArea":h=tY(y[1][1],o,a),l.push(EP(h,a));break;case"PtgArea3d":f=y[1][1],h=y[1][2],g=kY(n,f,a),l.push(g+"!"+EP(h,a));break;case"PtgAttrSum":l.push("SUM("+l.pop()+")");break;case"PtgAttrBaxcel":case"PtgAttrSemi":break;case"PtgName":m=y[1][2];var S=(n.names||[])[m-1]||(n[0]||[])[m],I=S?S.Name:"SH33TJSNAME"+String(m);I&&I.slice(0,6)=="_xlfn."&&!a.xlfn&&(I=I.slice(6)),l.push(I);break;case"PtgNameX":var P=y[1][1];m=y[1][2];var F;if(a.biff<=5)P<0&&(P=-P),n[P]&&(F=n[P][m]);else{var T="";if(((n[P]||[])[0]||[])[0]==14849||(((n[P]||[])[0]||[])[0]==1025?n[P][m]&&n[P][m].itab>0&&(T=n.SheetNames[n[P][m].itab-1]+"!"):T=n.SheetNames[m-1]+"!"),n[P]&&n[P][m])T+=n[P][m].Name;else if(n[0]&&n[0][m])T+=n[0][m].Name;else{var k=(_me(n,P,a)||"").split(";;");k[m-1]?T=k[m-1]:T+="SH33TJSERRX"}l.push(T);break}F||(F={Name:"SH33TJSERRY"}),l.push(F.Name);break;case"PtgParen":var V="(",C=")";if(p>=0){switch(x="",e[0][p][1][0]){case 2:V=fa(" ",e[0][p][1][1])+V;break;case 3:V=fa("\r",e[0][p][1][1])+V;break;case 4:C=fa(" ",e[0][p][1][1])+C;break;case 5:C=fa("\r",e[0][p][1][1])+C;break;default:if(a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+e[0][p][1][0])}p=-1}l.push(V+l.pop()+C);break;case"PtgRefErr":l.push("#REF!");break;case"PtgRefErr3d":l.push("#REF!");break;case"PtgExp":d={c:y[1][1],r:y[1][0]};var R={c:r.c,r:r.r};if(n.sharedf[Er(d)]){var H=n.sharedf[Er(d)];l.push(co(H,o,R,n,a))}else{var q=!1;for(c=0;c!=n.arrayf.length;++c)if(u=n.arrayf[c],!(d.c<u[0].s.c||d.c>u[0].e.c)&&!(d.r<u[0].s.r||d.r>u[0].e.r)){l.push(co(u[1],o,R,n,a)),q=!0;break}q||l.push(y[1])}break;case"PtgArray":l.push("{"+zjt(y[1])+"}");break;case"PtgMemArea":break;case"PtgAttrSpace":case"PtgAttrSpaceSemi":p=v;break;case"PtgTbl":break;case"PtgMemErr":break;case"PtgMissArg":l.push("");break;case"PtgAreaErr":l.push("#REF!");break;case"PtgAreaErr3d":l.push("#REF!");break;case"PtgList":l.push("Table"+y[1].idx+"[#"+y[1].rt+"]");break;case"PtgMemAreaN":case"PtgMemNoMemN":case"PtgAttrNoop":case"PtgSheet":case"PtgEndSheet":break;case"PtgMemFunc":break;case"PtgMemNoMem":break;case"PtgElfCol":case"PtgElfColS":case"PtgElfColSV":case"PtgElfColV":case"PtgElfLel":case"PtgElfRadical":case"PtgElfRadicalLel":case"PtgElfRadicalS":case"PtgElfRw":case"PtgElfRwV":throw new Error("Unsupported ELFs");case"PtgSxName":throw new Error("Unrecognized Formula Token: "+String(y));default:throw new Error("Unrecognized Formula Token: "+String(y))}var L=["PtgAttrSpace","PtgAttrSpaceSemi","PtgAttrGoto"];if(a.biff!=3&&p>=0&&L.indexOf(e[0][v][0])==-1){y=e[0][p];var M=!0;switch(y[1][0]){case 4:M=!1;case 0:x=fa(" ",y[1][1]);break;case 5:M=!1;case 1:x=fa("\r",y[1][1]);break;default:if(x="",a.WTF)throw new Error("Unexpected PtgAttrSpaceType "+y[1][0])}l.push((M?x:"")+l.pop()+(M?"":x)),p=-1}}if(l.length>1&&a.WTF)throw new Error("bad formula stack");return l[0]}function Vjt(e,t,r){var n=e.l+t,a=r.biff==2?1:2,i,o=e.read_shift(a);if(o==65535)return[[],bo(e,t-2)];var l=k_(e,o,r);return t!==o+a&&(i=S_(e,t-o-a,l,r)),e.l=n,[l,i]}function Wjt(e,t,r){var n=e.l+t,a=r.biff==2?1:2,i,o=e.read_shift(a);if(o==65535)return[[],bo(e,t-2)];var l=k_(e,o,r);return t!==o+a&&(i=S_(e,t-o-a,l,r)),e.l=n,[l,i]}function Hjt(e,t,r,n){var a=e.l+t,i=k_(e,n,r),o;return a!==e.l&&(o=S_(e,a-e.l,i,r)),[i,o]}function Gjt(e,t,r){var n=e.l+t,a,i=e.read_shift(2),o=k_(e,i,r);return i==65535?[[],bo(e,t-2)]:(t!==i+2&&(a=S_(e,n-i-2,o,r)),[o,a])}function Kjt(e){var t;if(Yf(e,e.l+6)!==65535)return[mo(e),"n"];switch(e[e.l]){case 0:return e.l+=8,["String","s"];case 1:return t=e[e.l+2]===1,e.l+=8,[t,"b"];case 2:return t=e[e.l+2],e.l+=8,[t,"e"];case 3:return e.l+=8,["","s"]}return[]}function Yjt(e){if(e==null){var t=lt(8);return t.write_shift(1,3),t.write_shift(1,0),t.write_shift(2,0),t.write_shift(2,0),t.write_shift(2,65535),t}else if(typeof e=="number")return Sg(e);return Sg(0)}function DP(e,t,r){var n=e.l+t,a=ff(e);r.biff==2&&++e.l;var i=Kjt(e),o=e.read_shift(1);r.biff!=2&&(e.read_shift(1),r.biff>=5&&e.read_shift(4));var l=Wjt(e,n-e.l,r);return{cell:a,val:i[0],formula:l,shared:o>>3&1,tt:i[1]}}function Xjt(e,t,r,n,a){var i=Cg(t,r,a),o=Yjt(e.v),l=lt(6),c=33;l.write_shift(2,c),l.write_shift(4,0);for(var u=lt(e.bf.length),d=0;d<e.bf.length;++d)u[d]=e.bf[d];var f=Ti([i,o,l,u]);return f}function dA(e,t,r){var n=e.read_shift(4),a=k_(e,n,r),i=e.read_shift(4),o=i>0?S_(e,i,a,r):null;return[a,o]}var Zjt=dA,fA=dA,Jjt=dA,Qjt=dA,e_t={0:"BEEP",1:"OPEN",2:"OPEN.LINKS",3:"CLOSE.ALL",4:"SAVE",5:"SAVE.AS",6:"FILE.DELETE",7:"PAGE.SETUP",8:"PRINT",9:"PRINTER.SETUP",10:"QUIT",11:"NEW.WINDOW",12:"ARRANGE.ALL",13:"WINDOW.SIZE",14:"WINDOW.MOVE",15:"FULL",16:"CLOSE",17:"RUN",22:"SET.PRINT.AREA",23:"SET.PRINT.TITLES",24:"SET.PAGE.BREAK",25:"REMOVE.PAGE.BREAK",26:"FONT",27:"DISPLAY",28:"PROTECT.DOCUMENT",29:"PRECISION",30:"A1.R1C1",31:"CALCULATE.NOW",32:"CALCULATION",34:"DATA.FIND",35:"EXTRACT",36:"DATA.DELETE",37:"SET.DATABASE",38:"SET.CRITERIA",39:"SORT",40:"DATA.SERIES",41:"TABLE",42:"FORMAT.NUMBER",43:"ALIGNMENT",44:"STYLE",45:"BORDER",46:"CELL.PROTECTION",47:"COLUMN.WIDTH",48:"UNDO",49:"CUT",50:"COPY",51:"PASTE",52:"CLEAR",53:"PASTE.SPECIAL",54:"EDIT.DELETE",55:"INSERT",56:"FILL.RIGHT",57:"FILL.DOWN",61:"DEFINE.NAME",62:"CREATE.NAMES",63:"FORMULA.GOTO",64:"FORMULA.FIND",65:"SELECT.LAST.CELL",66:"SHOW.ACTIVE.CELL",67:"GALLERY.AREA",68:"GALLERY.BAR",69:"GALLERY.COLUMN",70:"GALLERY.LINE",71:"GALLERY.PIE",72:"GALLERY.SCATTER",73:"COMBINATION",74:"PREFERRED",75:"ADD.OVERLAY",76:"GRIDLINES",77:"SET.PREFERRED",78:"AXES",79:"LEGEND",80:"ATTACH.TEXT",81:"ADD.ARROW",82:"SELECT.CHART",83:"SELECT.PLOT.AREA",84:"PATTERNS",85:"MAIN.CHART",86:"OVERLAY",87:"SCALE",88:"FORMAT.LEGEND",89:"FORMAT.TEXT",90:"EDIT.REPEAT",91:"PARSE",92:"JUSTIFY",93:"HIDE",94:"UNHIDE",95:"WORKSPACE",96:"FORMULA",97:"FORMULA.FILL",98:"FORMULA.ARRAY",99:"DATA.FIND.NEXT",100:"DATA.FIND.PREV",101:"FORMULA.FIND.NEXT",102:"FORMULA.FIND.PREV",103:"ACTIVATE",104:"ACTIVATE.NEXT",105:"ACTIVATE.PREV",106:"UNLOCKED.NEXT",107:"UNLOCKED.PREV",108:"COPY.PICTURE",109:"SELECT",110:"DELETE.NAME",111:"DELETE.FORMAT",112:"VLINE",113:"HLINE",114:"VPAGE",115:"HPAGE",116:"VSCROLL",117:"HSCROLL",118:"ALERT",119:"NEW",120:"CANCEL.COPY",121:"SHOW.CLIPBOARD",122:"MESSAGE",124:"PASTE.LINK",125:"APP.ACTIVATE",126:"DELETE.ARROW",127:"ROW.HEIGHT",128:"FORMAT.MOVE",129:"FORMAT.SIZE",130:"FORMULA.REPLACE",131:"SEND.KEYS",132:"SELECT.SPECIAL",133:"APPLY.NAMES",134:"REPLACE.FONT",135:"FREEZE.PANES",136:"SHOW.INFO",137:"SPLIT",138:"ON.WINDOW",139:"ON.DATA",140:"DISABLE.INPUT",142:"OUTLINE",143:"LIST.NAMES",144:"FILE.CLOSE",145:"SAVE.WORKBOOK",146:"DATA.FORM",147:"COPY.CHART",148:"ON.TIME",149:"WAIT",150:"FORMAT.FONT",151:"FILL.UP",152:"FILL.LEFT",153:"DELETE.OVERLAY",155:"SHORT.MENUS",159:"SET.UPDATE.STATUS",161:"COLOR.PALETTE",162:"DELETE.STYLE",163:"WINDOW.RESTORE",164:"WINDOW.MAXIMIZE",166:"CHANGE.LINK",167:"CALCULATE.DOCUMENT",168:"ON.KEY",169:"APP.RESTORE",170:"APP.MOVE",171:"APP.SIZE",172:"APP.MINIMIZE",173:"APP.MAXIMIZE",174:"BRING.TO.FRONT",175:"SEND.TO.BACK",185:"MAIN.CHART.TYPE",186:"OVERLAY.CHART.TYPE",187:"SELECT.END",188:"OPEN.MAIL",189:"SEND.MAIL",190:"STANDARD.FONT",191:"CONSOLIDATE",192:"SORT.SPECIAL",193:"GALLERY.3D.AREA",194:"GALLERY.3D.COLUMN",195:"GALLERY.3D.LINE",196:"GALLERY.3D.PIE",197:"VIEW.3D",198:"GOAL.SEEK",199:"WORKGROUP",200:"FILL.GROUP",201:"UPDATE.LINK",202:"PROMOTE",203:"DEMOTE",204:"SHOW.DETAIL",206:"UNGROUP",207:"OBJECT.PROPERTIES",208:"SAVE.NEW.OBJECT",209:"SHARE",210:"SHARE.NAME",211:"DUPLICATE",212:"APPLY.STYLE",213:"ASSIGN.TO.OBJECT",214:"OBJECT.PROTECTION",215:"HIDE.OBJECT",216:"SET.EXTRACT",217:"CREATE.PUBLISHER",218:"SUBSCRIBE.TO",219:"ATTRIBUTES",220:"SHOW.TOOLBAR",222:"PRINT.PREVIEW",223:"EDIT.COLOR",224:"SHOW.LEVELS",225:"FORMAT.MAIN",226:"FORMAT.OVERLAY",227:"ON.RECALC",228:"EDIT.SERIES",229:"DEFINE.STYLE",240:"LINE.PRINT",243:"ENTER.DATA",249:"GALLERY.RADAR",250:"MERGE.STYLES",251:"EDITION.OPTIONS",252:"PASTE.PICTURE",253:"PASTE.PICTURE.LINK",254:"SPELLING",256:"ZOOM",259:"INSERT.OBJECT",260:"WINDOW.MINIMIZE",265:"SOUND.NOTE",266:"SOUND.PLAY",267:"FORMAT.SHAPE",268:"EXTEND.POLYGON",269:"FORMAT.AUTO",272:"GALLERY.3D.BAR",273:"GALLERY.3D.SURFACE",274:"FILL.AUTO",276:"CUSTOMIZE.TOOLBAR",277:"ADD.TOOL",278:"EDIT.OBJECT",279:"ON.DOUBLECLICK",280:"ON.ENTRY",281:"WORKBOOK.ADD",282:"WORKBOOK.MOVE",283:"WORKBOOK.COPY",284:"WORKBOOK.OPTIONS",285:"SAVE.WORKSPACE",288:"CHART.WIZARD",289:"DELETE.TOOL",290:"MOVE.TOOL",291:"WORKBOOK.SELECT",292:"WORKBOOK.ACTIVATE",293:"ASSIGN.TO.TOOL",295:"COPY.TOOL",296:"RESET.TOOL",297:"CONSTRAIN.NUMERIC",298:"PASTE.TOOL",302:"WORKBOOK.NEW",305:"SCENARIO.CELLS",306:"SCENARIO.DELETE",307:"SCENARIO.ADD",308:"SCENARIO.EDIT",309:"SCENARIO.SHOW",310:"SCENARIO.SHOW.NEXT",311:"SCENARIO.SUMMARY",312:"PIVOT.TABLE.WIZARD",313:"PIVOT.FIELD.PROPERTIES",314:"PIVOT.FIELD",315:"PIVOT.ITEM",316:"PIVOT.ADD.FIELDS",318:"OPTIONS.CALCULATION",319:"OPTIONS.EDIT",320:"OPTIONS.VIEW",321:"ADDIN.MANAGER",322:"MENU.EDITOR",323:"ATTACH.TOOLBARS",324:"VBAActivate",325:"OPTIONS.CHART",328:"VBA.INSERT.FILE",330:"VBA.PROCEDURE.DEFINITION",336:"ROUTING.SLIP",338:"ROUTE.DOCUMENT",339:"MAIL.LOGON",342:"INSERT.PICTURE",343:"EDIT.TOOL",344:"GALLERY.DOUGHNUT",350:"CHART.TREND",352:"PIVOT.ITEM.PROPERTIES",354:"WORKBOOK.INSERT",355:"OPTIONS.TRANSITION",356:"OPTIONS.GENERAL",370:"FILTER.ADVANCED",373:"MAIL.ADD.MAILER",374:"MAIL.DELETE.MAILER",375:"MAIL.REPLY",376:"MAIL.REPLY.ALL",377:"MAIL.FORWARD",378:"MAIL.NEXT.LETTER",379:"DATA.LABEL",380:"INSERT.TITLE",381:"FONT.PROPERTIES",382:"MACRO.OPTIONS",383:"WORKBOOK.HIDE",384:"WORKBOOK.UNHIDE",385:"WORKBOOK.DELETE",386:"WORKBOOK.NAME",388:"GALLERY.CUSTOM",390:"ADD.CHART.AUTOFORMAT",391:"DELETE.CHART.AUTOFORMAT",392:"CHART.ADD.DATA",393:"AUTO.OUTLINE",394:"TAB.ORDER",395:"SHOW.DIALOG",396:"SELECT.ALL",397:"UNGROUP.SHEETS",398:"SUBTOTAL.CREATE",399:"SUBTOTAL.REMOVE",400:"RENAME.OBJECT",412:"WORKBOOK.SCROLL",413:"WORKBOOK.NEXT",414:"WORKBOOK.PREV",415:"WORKBOOK.TAB.SPLIT",416:"FULL.SCREEN",417:"WORKBOOK.PROTECT",420:"SCROLLBAR.PROPERTIES",421:"PIVOT.SHOW.PAGES",422:"TEXT.TO.COLUMNS",423:"FORMAT.CHARTTYPE",424:"LINK.FORMAT",425:"TRACER.DISPLAY",430:"TRACER.NAVIGATE",431:"TRACER.CLEAR",432:"TRACER.ERROR",433:"PIVOT.FIELD.GROUP",434:"PIVOT.FIELD.UNGROUP",435:"CHECKBOX.PROPERTIES",436:"LABEL.PROPERTIES",437:"LISTBOX.PROPERTIES",438:"EDITBOX.PROPERTIES",439:"PIVOT.REFRESH",440:"LINK.COMBO",441:"OPEN.TEXT",442:"HIDE.DIALOG",443:"SET.DIALOG.FOCUS",444:"ENABLE.OBJECT",445:"PUSHBUTTON.PROPERTIES",446:"SET.DIALOG.DEFAULT",447:"FILTER",448:"FILTER.SHOW.ALL",449:"CLEAR.OUTLINE",450:"FUNCTION.WIZARD",451:"ADD.LIST.ITEM",452:"SET.LIST.ITEM",453:"REMOVE.LIST.ITEM",454:"SELECT.LIST.ITEM",455:"SET.CONTROL.VALUE",456:"SAVE.COPY.AS",458:"OPTIONS.LISTS.ADD",459:"OPTIONS.LISTS.DELETE",460:"SERIES.AXES",461:"SERIES.X",462:"SERIES.Y",463:"ERRORBAR.X",464:"ERRORBAR.Y",465:"FORMAT.CHART",466:"SERIES.ORDER",467:"MAIL.LOGOFF",468:"CLEAR.ROUTING.SLIP",469:"APP.ACTIVATE.MICROSOFT",470:"MAIL.EDIT.MAILER",471:"ON.SHEET",472:"STANDARD.WIDTH",473:"SCENARIO.MERGE",474:"SUMMARY.INFO",475:"FIND.FILE",476:"ACTIVE.CELL.FONT",477:"ENABLE.TIPWIZARD",478:"VBA.MAKE.ADDIN",480:"INSERTDATATABLE",481:"WORKGROUP.OPTIONS",482:"MAIL.SEND.MAILER",485:"AUTOCORRECT",489:"POST.DOCUMENT",491:"PICKLIST",493:"VIEW.SHOW",494:"VIEW.DEFINE",495:"VIEW.DELETE",509:"SHEET.BACKGROUND",510:"INSERT.MAP.OBJECT",511:"OPTIONS.MENONO",517:"MSOCHECKS",518:"NORMAL",519:"LAYOUT",520:"RM.PRINT.AREA",521:"CLEAR.PRINT.AREA",522:"ADD.PRINT.AREA",523:"MOVE.BRK",545:"HIDECURR.NOTE",546:"HIDEALL.NOTES",547:"DELETE.NOTE",548:"TRAVERSE.NOTES",549:"ACTIVATE.NOTES",620:"PROTECT.REVISIONS",621:"UNPROTECT.REVISIONS",647:"OPTIONS.ME",653:"WEB.PUBLISH",667:"NEWWEBQUERY",673:"PIVOT.TABLE.CHART",753:"OPTIONS.SAVE",755:"OPTIONS.SPELL",808:"HIDEALL.INKANNOTS"},Nme={0:"COUNT",1:"IF",2:"ISNA",3:"ISERROR",4:"SUM",5:"AVERAGE",6:"MIN",7:"MAX",8:"ROW",9:"COLUMN",10:"NA",11:"NPV",12:"STDEV",13:"DOLLAR",14:"FIXED",15:"SIN",16:"COS",17:"TAN",18:"ATAN",19:"PI",20:"SQRT",21:"EXP",22:"LN",23:"LOG10",24:"ABS",25:"INT",26:"SIGN",27:"ROUND",28:"LOOKUP",29:"INDEX",30:"REPT",31:"MID",32:"LEN",33:"VALUE",34:"TRUE",35:"FALSE",36:"AND",37:"OR",38:"NOT",39:"MOD",40:"DCOUNT",41:"DSUM",42:"DAVERAGE",43:"DMIN",44:"DMAX",45:"DSTDEV",46:"VAR",47:"DVAR",48:"TEXT",49:"LINEST",50:"TREND",51:"LOGEST",52:"GROWTH",53:"GOTO",54:"HALT",55:"RETURN",56:"PV",57:"FV",58:"NPER",59:"PMT",60:"RATE",61:"MIRR",62:"IRR",63:"RAND",64:"MATCH",65:"DATE",66:"TIME",67:"DAY",68:"MONTH",69:"YEAR",70:"WEEKDAY",71:"HOUR",72:"MINUTE",73:"SECOND",74:"NOW",75:"AREAS",76:"ROWS",77:"COLUMNS",78:"OFFSET",79:"ABSREF",80:"RELREF",81:"ARGUMENT",82:"SEARCH",83:"TRANSPOSE",84:"ERROR",85:"STEP",86:"TYPE",87:"ECHO",88:"SET.NAME",89:"CALLER",90:"DEREF",91:"WINDOWS",92:"SERIES",93:"DOCUMENTS",94:"ACTIVE.CELL",95:"SELECTION",96:"RESULT",97:"ATAN2",98:"ASIN",99:"ACOS",100:"CHOOSE",101:"HLOOKUP",102:"VLOOKUP",103:"LINKS",104:"INPUT",105:"ISREF",106:"GET.FORMULA",107:"GET.NAME",108:"SET.VALUE",109:"LOG",110:"EXEC",111:"CHAR",112:"LOWER",113:"UPPER",114:"PROPER",115:"LEFT",116:"RIGHT",117:"EXACT",118:"TRIM",119:"REPLACE",120:"SUBSTITUTE",121:"CODE",122:"NAMES",123:"DIRECTORY",124:"FIND",125:"CELL",126:"ISERR",127:"ISTEXT",128:"ISNUMBER",129:"ISBLANK",130:"T",131:"N",132:"FOPEN",133:"FCLOSE",134:"FSIZE",135:"FREADLN",136:"FREAD",137:"FWRITELN",138:"FWRITE",139:"FPOS",140:"DATEVALUE",141:"TIMEVALUE",142:"SLN",143:"SYD",144:"DDB",145:"GET.DEF",146:"REFTEXT",147:"TEXTREF",148:"INDIRECT",149:"REGISTER",150:"CALL",151:"ADD.BAR",152:"ADD.MENU",153:"ADD.COMMAND",154:"ENABLE.COMMAND",155:"CHECK.COMMAND",156:"RENAME.COMMAND",157:"SHOW.BAR",158:"DELETE.MENU",159:"DELETE.COMMAND",160:"GET.CHART.ITEM",161:"DIALOG.BOX",162:"CLEAN",163:"MDETERM",164:"MINVERSE",165:"MMULT",166:"FILES",167:"IPMT",168:"PPMT",169:"COUNTA",170:"CANCEL.KEY",171:"FOR",172:"WHILE",173:"BREAK",174:"NEXT",175:"INITIATE",176:"REQUEST",177:"POKE",178:"EXECUTE",179:"TERMINATE",180:"RESTART",181:"HELP",182:"GET.BAR",183:"PRODUCT",184:"FACT",185:"GET.CELL",186:"GET.WORKSPACE",187:"GET.WINDOW",188:"GET.DOCUMENT",189:"DPRODUCT",190:"ISNONTEXT",191:"GET.NOTE",192:"NOTE",193:"STDEVP",194:"VARP",195:"DSTDEVP",196:"DVARP",197:"TRUNC",198:"ISLOGICAL",199:"DCOUNTA",200:"DELETE.BAR",201:"UNREGISTER",204:"USDOLLAR",205:"FINDB",206:"SEARCHB",207:"REPLACEB",208:"LEFTB",209:"RIGHTB",210:"MIDB",211:"LENB",212:"ROUNDUP",213:"ROUNDDOWN",214:"ASC",215:"DBCS",216:"RANK",219:"ADDRESS",220:"DAYS360",221:"TODAY",222:"VDB",223:"ELSE",224:"ELSE.IF",225:"END.IF",226:"FOR.CELL",227:"MEDIAN",228:"SUMPRODUCT",229:"SINH",230:"COSH",231:"TANH",232:"ASINH",233:"ACOSH",234:"ATANH",235:"DGET",236:"CREATE.OBJECT",237:"VOLATILE",238:"LAST.ERROR",239:"CUSTOM.UNDO",240:"CUSTOM.REPEAT",241:"FORMULA.CONVERT",242:"GET.LINK.INFO",243:"TEXT.BOX",244:"INFO",245:"GROUP",246:"GET.OBJECT",247:"DB",248:"PAUSE",251:"RESUME",252:"FREQUENCY",253:"ADD.TOOLBAR",254:"DELETE.TOOLBAR",255:"User",256:"RESET.TOOLBAR",257:"EVALUATE",258:"GET.TOOLBAR",259:"GET.TOOL",260:"SPELLING.CHECK",261:"ERROR.TYPE",262:"APP.TITLE",263:"WINDOW.TITLE",264:"SAVE.TOOLBAR",265:"ENABLE.TOOL",266:"PRESS.TOOL",267:"REGISTER.ID",268:"GET.WORKBOOK",269:"AVEDEV",270:"BETADIST",271:"GAMMALN",272:"BETAINV",273:"BINOMDIST",274:"CHIDIST",275:"CHIINV",276:"COMBIN",277:"CONFIDENCE",278:"CRITBINOM",279:"EVEN",280:"EXPONDIST",281:"FDIST",282:"FINV",283:"FISHER",284:"FISHERINV",285:"FLOOR",286:"GAMMADIST",287:"GAMMAINV",288:"CEILING",289:"HYPGEOMDIST",290:"LOGNORMDIST",291:"LOGINV",292:"NEGBINOMDIST",293:"NORMDIST",294:"NORMSDIST",295:"NORMINV",296:"NORMSINV",297:"STANDARDIZE",298:"ODD",299:"PERMUT",300:"POISSON",301:"TDIST",302:"WEIBULL",303:"SUMXMY2",304:"SUMX2MY2",305:"SUMX2PY2",306:"CHITEST",307:"CORREL",308:"COVAR",309:"FORECAST",310:"FTEST",311:"INTERCEPT",312:"PEARSON",313:"RSQ",314:"STEYX",315:"SLOPE",316:"TTEST",317:"PROB",318:"DEVSQ",319:"GEOMEAN",320:"HARMEAN",321:"SUMSQ",322:"KURT",323:"SKEW",324:"ZTEST",325:"LARGE",326:"SMALL",327:"QUARTILE",328:"PERCENTILE",329:"PERCENTRANK",330:"MODE",331:"TRIMMEAN",332:"TINV",334:"MOVIE.COMMAND",335:"GET.MOVIE",336:"CONCATENATE",337:"POWER",338:"PIVOT.ADD.DATA",339:"GET.PIVOT.TABLE",340:"GET.PIVOT.FIELD",341:"GET.PIVOT.ITEM",342:"RADIANS",343:"DEGREES",344:"SUBTOTAL",345:"SUMIF",346:"COUNTIF",347:"COUNTBLANK",348:"SCENARIO.GET",349:"OPTIONS.LISTS.GET",350:"ISPMT",351:"DATEDIF",352:"DATESTRING",353:"NUMBERSTRING",354:"ROMAN",355:"OPEN.DIALOG",356:"SAVE.DIALOG",357:"VIEW.GET",358:"GETPIVOTDATA",359:"HYPERLINK",360:"PHONETIC",361:"AVERAGEA",362:"MAXA",363:"MINA",364:"STDEVPA",365:"VARPA",366:"STDEVA",367:"VARA",368:"BAHTTEXT",369:"THAIDAYOFWEEK",370:"THAIDIGIT",371:"THAIMONTHOFYEAR",372:"THAINUMSOUND",373:"THAINUMSTRING",374:"THAISTRINGLENGTH",375:"ISTHAIDIGIT",376:"ROUNDBAHTDOWN",377:"ROUNDBAHTUP",378:"THAIYEAR",379:"RTD",380:"CUBEVALUE",381:"CUBEMEMBER",382:"CUBEMEMBERPROPERTY",383:"CUBERANKEDMEMBER",384:"HEX2BIN",385:"HEX2DEC",386:"HEX2OCT",387:"DEC2BIN",388:"DEC2HEX",389:"DEC2OCT",390:"OCT2BIN",391:"OCT2HEX",392:"OCT2DEC",393:"BIN2DEC",394:"BIN2OCT",395:"BIN2HEX",396:"IMSUB",397:"IMDIV",398:"IMPOWER",399:"IMABS",400:"IMSQRT",401:"IMLN",402:"IMLOG2",403:"IMLOG10",404:"IMSIN",405:"IMCOS",406:"IMEXP",407:"IMARGUMENT",408:"IMCONJUGATE",409:"IMAGINARY",410:"IMREAL",411:"COMPLEX",412:"IMSUM",413:"IMPRODUCT",414:"SERIESSUM",415:"FACTDOUBLE",416:"SQRTPI",417:"QUOTIENT",418:"DELTA",419:"GESTEP",420:"ISEVEN",421:"ISODD",422:"MROUND",423:"ERF",424:"ERFC",425:"BESSELJ",426:"BESSELK",427:"BESSELY",428:"BESSELI",429:"XIRR",430:"XNPV",431:"PRICEMAT",432:"YIELDMAT",433:"INTRATE",434:"RECEIVED",435:"DISC",436:"PRICEDISC",437:"YIELDDISC",438:"TBILLEQ",439:"TBILLPRICE",440:"TBILLYIELD",441:"PRICE",442:"YIELD",443:"DOLLARDE",444:"DOLLARFR",445:"NOMINAL",446:"EFFECT",447:"CUMPRINC",448:"CUMIPMT",449:"EDATE",450:"EOMONTH",451:"YEARFRAC",452:"COUPDAYBS",453:"COUPDAYS",454:"COUPDAYSNC",455:"COUPNCD",456:"COUPNUM",457:"COUPPCD",458:"DURATION",459:"MDURATION",460:"ODDLPRICE",461:"ODDLYIELD",462:"ODDFPRICE",463:"ODDFYIELD",464:"RANDBETWEEN",465:"WEEKNUM",466:"AMORDEGRC",467:"AMORLINC",468:"CONVERT",724:"SHEETJS",469:"ACCRINT",470:"ACCRINTM",471:"WORKDAY",472:"NETWORKDAYS",473:"GCD",474:"MULTINOMIAL",475:"LCM",476:"FVSCHEDULE",477:"CUBEKPIMEMBER",478:"CUBESET",479:"CUBESETCOUNT",480:"IFERROR",481:"COUNTIFS",482:"SUMIFS",483:"AVERAGEIF",484:"AVERAGEIFS"},t_t={2:1,3:1,10:0,15:1,16:1,17:1,18:1,19:0,20:1,21:1,22:1,23:1,24:1,25:1,26:1,27:2,30:2,31:3,32:1,33:1,34:0,35:0,38:1,39:2,40:3,41:3,42:3,43:3,44:3,45:3,47:3,48:2,53:1,61:3,63:0,65:3,66:3,67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:0,75:1,76:1,77:1,79:2,80:2,83:1,85:0,86:1,89:0,90:1,94:0,95:0,97:2,98:1,99:1,101:3,102:3,105:1,106:1,108:2,111:1,112:1,113:1,114:1,117:2,118:1,119:4,121:1,126:1,127:1,128:1,129:1,130:1,131:1,133:1,134:1,135:1,136:2,137:2,138:2,140:1,141:1,142:3,143:4,144:4,161:1,162:1,163:1,164:1,165:2,172:1,175:2,176:2,177:3,178:2,179:1,184:1,186:1,189:3,190:1,195:3,196:3,197:1,198:1,199:3,201:1,207:4,210:3,211:1,212:2,213:2,214:1,215:1,225:0,229:1,230:1,231:1,232:1,233:1,234:1,235:3,244:1,247:4,252:2,257:1,261:1,271:1,273:4,274:2,275:2,276:2,277:3,278:3,279:1,280:3,281:3,282:3,283:1,284:1,285:2,286:4,287:3,288:2,289:4,290:3,291:3,292:3,293:4,294:1,295:3,296:1,297:3,298:1,299:2,300:3,301:3,302:4,303:2,304:2,305:2,306:2,307:2,308:2,309:3,310:2,311:2,312:2,313:2,314:2,315:2,316:4,325:2,326:2,327:2,328:2,331:2,332:2,337:2,342:1,343:1,346:2,347:1,350:4,351:3,352:1,353:2,360:1,368:1,369:1,370:1,371:1,372:1,373:1,374:1,375:1,376:1,377:1,378:1,382:3,385:1,392:1,393:1,396:2,397:2,398:2,399:1,400:1,401:1,402:1,403:1,404:1,405:1,406:1,407:1,408:1,409:1,410:1,414:4,415:1,416:1,417:2,420:1,421:1,422:2,424:1,425:2,426:2,427:2,428:2,430:3,438:3,439:3,440:3,443:2,444:2,445:2,446:2,447:6,448:6,449:2,450:2,464:2,468:3,476:2,479:1,480:2,65535:0};function CY(e){return e.slice(0,3)=="of:"&&(e=e.slice(3)),e.charCodeAt(0)==61&&(e=e.slice(1),e.charCodeAt(0)==61&&(e=e.slice(1))),e=e.replace(/COM\.MICROSOFT\./g,""),e=e.replace(/\[((?:\.[A-Z]+[0-9]+)(?::\.[A-Z]+[0-9]+)?)\]/g,function(t,r){return r.replace(/\./g,"")}),e=e.replace(/\[.(#[A-Z]*[?!])\]/g,"$1"),e.replace(/[;~]/g,",").replace(/\|/g,";")}function r_t(e){var t="of:="+e.replace(h7,"$1[.$2$3$4$5]").replace(/\]:\[/g,":");return t.replace(/;/g,"|").replace(/,/g,";")}function IP(e){var t=e.split(":"),r=t[0].split(".")[0];return[r,t[0].split(".")[1]+(t.length>1?":"+(t[1].split(".")[1]||t[1].split(".")[0]):"")]}function n_t(e){return e.replace(/\./,"!")}var Lw={},Dv={},Fw=typeof Map<"u";function g7(e,t,r){var n=0,a=e.length;if(r){if(Fw?r.has(t):Object.prototype.hasOwnProperty.call(r,t)){for(var i=Fw?r.get(t):r[t];n<i.length;++n)if(e[i[n]].t===t)return e.Count++,i[n]}}else for(;n<a;++n)if(e[n].t===t)return e.Count++,n;return e[a]={t},e.Count++,e.Unique++,r&&(Fw?(r.has(t)||r.set(t,[]),r.get(t).push(a)):(Object.prototype.hasOwnProperty.call(r,t)||(r[t]=[]),r[t].push(a))),a}function hA(e,t){var r={min:e+1,max:e+1},n=-1;return t.MDW&&(ho=t.MDW),t.width!=null?r.customWidth=1:t.wpx!=null?n=yj(t.wpx):t.wch!=null&&(n=t.wch),n>-1?(r.width=Ik(n),r.customWidth=1):t.width!=null&&(r.width=t.width),t.hidden&&(r.hidden=!0),t.level!=null&&(r.outlineLevel=r.level=t.level),r}function Z0(e,t){if(e){var r=[.7,.7,.75,.75,.3,.3];t=="xlml"&&(r=[1,1,1,1,.5,.5]),e.left==null&&(e.left=r[0]),e.right==null&&(e.right=r[1]),e.top==null&&(e.top=r[2]),e.bottom==null&&(e.bottom=r[3]),e.header==null&&(e.header=r[4]),e.footer==null&&(e.footer=r[5])}}function Lp(e,t,r){var n=r.revssf[t.z!=null?t.z:"General"],a=60,i=e.length;if(n==null&&r.ssf){for(;a<392;++a)if(r.ssf[a]==null){Gd(t.z,a),r.ssf[a]=t.z,r.revssf[t.z]=n=a;break}}for(a=0;a!=i;++a)if(e[a].numFmtId===n)return a;return e[i]={numFmtId:n,fontId:0,fillId:0,borderId:0,xfId:0,applyNumberFormat:1},i}function Sme(e,t,r,n,a,i){try{n.cellNF&&(e.z=Nr[t])}catch(l){if(n.WTF)throw l}if(!(e.t==="z"&&!n.cellStyles)){if(e.t==="d"&&typeof e.v=="string"&&(e.v=Us(e.v)),(!n||n.cellText!==!1)&&e.t!=="z")try{if(Nr[t]==null&&Gd(Qxt[t]||"General",t),e.t==="e")e.w=e.w||Eh[e.v];else if(t===0)if(e.t==="n")(e.v|0)===e.v?e.w=e.v.toString(10):e.w=fj(e.v);else if(e.t==="d"){var o=yi(e.v);(o|0)===o?e.w=o.toString(10):e.w=fj(o)}else{if(e.v===void 0)return"";e.w=_g(e.v,Dv)}else e.t==="d"?e.w=ic(t,yi(e.v),Dv):e.w=ic(t,e.v,Dv)}catch(l){if(n.WTF)throw l}if(n.cellStyles&&r!=null)try{e.s=i.Fills[r],e.s.fgColor&&e.s.fgColor.theme&&!e.s.fgColor.rgb&&(e.s.fgColor.rgb=Dk(a.themeElements.clrScheme[e.s.fgColor.theme].rgb,e.s.fgColor.tint||0),n.WTF&&(e.s.fgColor.raw_rgb=a.themeElements.clrScheme[e.s.fgColor.theme].rgb)),e.s.bgColor&&e.s.bgColor.theme&&(e.s.bgColor.rgb=Dk(a.themeElements.clrScheme[e.s.bgColor.theme].rgb,e.s.bgColor.tint||0),n.WTF&&(e.s.bgColor.raw_rgb=a.themeElements.clrScheme[e.s.bgColor.theme].rgb))}catch(l){if(n.WTF&&i.Fills)throw l}}}function s_t(e,t,r){if(e&&e["!ref"]){var n=wn(e["!ref"]);if(n.e.c<n.s.c||n.e.r<n.s.r)throw new Error("Bad range ("+r+"): "+e["!ref"])}}function a_t(e,t){var r=wn(t);r.s.r<=r.e.r&&r.s.c<=r.e.c&&r.s.r>=0&&r.s.c>=0&&(e["!ref"]=nn(r))}var i_t=/<(?:\w:)?mergeCell ref="[A-Z0-9:]+"\s*[\/]?>/g,o_t=/<(?:\w+:)?sheetData[^>]*>([\s\S]*)<\/(?:\w+:)?sheetData>/,l_t=/<(?:\w:)?hyperlink [^>]*>/mg,c_t=/"(\w*:\w*)"/,u_t=/<(?:\w:)?col\b[^>]*[\/]?>/g,d_t=/<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g,f_t=/<(?:\w:)?pageMargins[^>]*\/>/g,kme=/<(?:\w:)?sheetPr\b(?:[^>a-z][^>]*)?\/>/,h_t=/<(?:\w:)?sheetPr[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetPr)>/,m_t=/<(?:\w:)?sheetViews[^>]*(?:[\/]|>([\s\S]*)<\/(?:\w:)?sheetViews)>/;function p_t(e,t,r,n,a,i,o){if(!e)return e;n||(n={"!id":{}});var l=t.dense?[]:{},c={s:{r:2e6,c:2e6},e:{r:0,c:0}},u="",d="",f=e.match(o_t);f?(u=e.slice(0,f.index),d=e.slice(f.index+f[0].length)):u=d=e;var m=u.match(kme);m?x7(m[0],l,a,r):(m=u.match(h_t))&&x_t(m[0],m[1]||"",l,a,r);var h=(u.match(/<(?:\w*:)?dimension/)||{index:-1}).index;if(h>0){var g=u.slice(h,h+50).match(c_t);g&&a_t(l,g[1])}var p=u.match(m_t);p&&p[1]&&T_t(p[1],a);var x=[];if(t.cellStyles){var v=u.match(u_t);v&&S_t(x,v)}f&&D_t(f[1],l,t,c,i,o);var b=d.match(d_t);b&&(l["!autofilter"]=C_t(b[0]));var y=[],N=d.match(i_t);if(N)for(h=0;h!=N.length;++h)y[h]=wn(N[h].slice(N[h].indexOf('"')+1));var _=d.match(l_t);_&&j_t(l,_,n);var j=d.match(f_t);if(j&&(l["!margins"]=__t(Rr(j[0]))),!l["!ref"]&&c.e.c>=c.s.c&&c.e.r>=c.s.r&&(l["!ref"]=nn(c)),t.sheetRows>0&&l["!ref"]){var S=wn(l["!ref"]);t.sheetRows<=+S.e.r&&(S.e.r=t.sheetRows-1,S.e.r>c.e.r&&(S.e.r=c.e.r),S.e.r<S.s.r&&(S.s.r=S.e.r),S.e.c>c.e.c&&(S.e.c=c.e.c),S.e.c<S.s.c&&(S.s.c=S.e.c),l["!fullref"]=l["!ref"],l["!ref"]=nn(S))}return x.length>0&&(l["!cols"]=x),y.length>0&&(l["!merges"]=y),l}function g_t(e){if(e.length===0)return"";for(var t='<mergeCells count="'+e.length+'">',r=0;r!=e.length;++r)t+='<mergeCell ref="'+nn(e[r])+'"/>';return t+"</mergeCells>"}function x7(e,t,r,n){var a=Rr(e);r.Sheets[n]||(r.Sheets[n]={}),a.codeName&&(r.Sheets[n].CodeName=Dn(us(a.codeName)))}function x_t(e,t,r,n,a){x7(e.slice(0,e.indexOf(">")),r,n,a)}function v_t(e,t,r,n,a){var i=!1,o={},l=null;if(n.bookType!=="xlsx"&&t.vbaraw){var c=t.SheetNames[r];try{t.Workbook&&(c=t.Workbook.Sheets[r].CodeName||c)}catch{}i=!0,o.codeName=$d(ns(c))}if(e&&e["!outline"]){var u={summaryBelow:1,summaryRight:1};e["!outline"].above&&(u.summaryBelow=0),e["!outline"].left&&(u.summaryRight=0),l=(l||"")+Lt("outlinePr",null,u)}!i&&!l||(a[a.length]=Lt("sheetPr",l,o))}var y_t=["objects","scenarios","selectLockedCells","selectUnlockedCells"],b_t=["formatColumns","formatRows","formatCells","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"];function w_t(e){var t={sheet:1};return y_t.forEach(function(r){e[r]!=null&&e[r]&&(t[r]="1")}),b_t.forEach(function(r){e[r]!=null&&!e[r]&&(t[r]="0")}),e.password&&(t.password=u7(e.password).toString(16).toUpperCase()),Lt("sheetProtection",null,t)}function j_t(e,t,r){for(var n=Array.isArray(e),a=0;a!=t.length;++a){var i=Rr(us(t[a]),!0);if(!i.ref)return;var o=((r||{})["!id"]||[])[i.id];o?(i.Target=o.Target,i.location&&(i.Target+="#"+Dn(i.location))):(i.Target="#"+Dn(i.location),o={Target:i.Target,TargetMode:"Internal"}),i.Rel=o,i.tooltip&&(i.Tooltip=i.tooltip,delete i.tooltip);for(var l=wn(i.ref),c=l.s.r;c<=l.e.r;++c)for(var u=l.s.c;u<=l.e.c;++u){var d=Er({c:u,r:c});n?(e[c]||(e[c]=[]),e[c][u]||(e[c][u]={t:"z",v:void 0}),e[c][u].l=i):(e[d]||(e[d]={t:"z",v:void 0}),e[d].l=i)}}}function __t(e){var t={};return["left","right","top","bottom","header","footer"].forEach(function(r){e[r]&&(t[r]=parseFloat(e[r]))}),t}function N_t(e){return Z0(e),Lt("pageMargins",null,e)}function S_t(e,t){for(var r=!1,n=0;n!=t.length;++n){var a=Rr(t[n],!0);a.hidden&&(a.hidden=Ls(a.hidden));var i=parseInt(a.min,10)-1,o=parseInt(a.max,10)-1;for(a.outlineLevel&&(a.level=+a.outlineLevel||0),delete a.min,delete a.max,a.width=+a.width,!r&&a.width&&(r=!0,d7(a.width)),hp(a);i<=o;)e[i++]=xs(a)}}function k_t(e,t){for(var r=["<cols>"],n,a=0;a!=t.length;++a)(n=t[a])&&(r[r.length]=Lt("col",null,hA(a,n)));return r[r.length]="</cols>",r.join("")}function C_t(e){var t={ref:(e.match(/ref="([^"]*)"/)||[])[1]};return t}function E_t(e,t,r,n){var a=typeof e.ref=="string"?e.ref:nn(e.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var i=r.Workbook.Names,o=Go(a);o.s.r==o.e.r&&(o.e.r=Go(t["!ref"]).e.r,a=nn(o));for(var l=0;l<i.length;++l){var c=i[l];if(c.Name=="_xlnm._FilterDatabase"&&c.Sheet==n){c.Ref="'"+r.SheetNames[n]+"'!"+a;break}}return l==i.length&&i.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+r.SheetNames[n]+"'!"+a}),Lt("autoFilter",null,{ref:a})}var A_t=/<(?:\w:)?sheetView(?:[^>a-z][^>]*)?\/?>/;function T_t(e,t){t.Views||(t.Views=[{}]),(e.match(A_t)||[]).forEach(function(r,n){var a=Rr(r);t.Views[n]||(t.Views[n]={}),+a.zoomScale&&(t.Views[n].zoom=+a.zoomScale),Ls(a.rightToLeft)&&(t.Views[n].RTL=!0)})}function P_t(e,t,r,n){var a={workbookViewId:"0"};return(((n||{}).Workbook||{}).Views||[])[0]&&(a.rightToLeft=n.Workbook.Views[0].RTL?"1":"0"),Lt("sheetViews",Lt("sheetView",null,a),{})}function O_t(e,t,r,n){if(e.c&&r["!comments"].push([t,e.c]),e.v===void 0&&typeof e.f!="string"||e.t==="z"&&!e.f)return"";var a="",i=e.t,o=e.v;if(e.t!=="z")switch(e.t){case"b":a=e.v?"1":"0";break;case"n":a=""+e.v;break;case"e":a=Eh[e.v];break;case"d":n&&n.cellDates?a=Us(e.v,-1).toISOString():(e=xs(e),e.t="n",a=""+(e.v=yi(Us(e.v)))),typeof e.z>"u"&&(e.z=Nr[14]);break;default:a=e.v;break}var l=Yi("v",ns(a)),c={r:t},u=Lp(n.cellXfs,e,n);switch(u!==0&&(c.s=u),e.t){case"n":break;case"d":c.t="d";break;case"b":c.t="b";break;case"e":c.t="e";break;case"z":break;default:if(e.v==null){delete e.t;break}if(e.v.length>32767)throw new Error("Text length must not exceed 32767 characters");if(n&&n.bookSST){l=Yi("v",""+g7(n.Strings,e.v,n.revStrings)),c.t="s";break}c.t="str";break}if(e.t!=i&&(e.t=i,e.v=o),typeof e.f=="string"&&e.f){var d=e.F&&e.F.slice(0,t.length)==t?{t:"array",ref:e.F}:null;l=Lt("f",ns(e.f),d)+(e.v!=null?l:"")}return e.l&&r["!links"].push([t,e.l]),e.D&&(c.cm=1),Lt("c",l,c)}var D_t=function(){var e=/<(?:\w+:)?c[ \/>]/,t=/<\/(?:\w+:)?row>/,r=/r=["']([^"']*)["']/,n=/<(?:\w+:)?is>([\S\s]*?)<\/(?:\w+:)?is>/,a=/ref=["']([^"']*)["']/,i=hj("v"),o=hj("f");return function(c,u,d,f,m,h){for(var g=0,p="",x=[],v=[],b=0,y=0,N=0,_="",j,S,I=0,P=0,F,T,k=0,V=0,C=Array.isArray(h.CellXf),R,H=[],q=[],L=Array.isArray(u),M=[],z={},K=!1,E=!!d.sheetStubs,A=c.split(t),O=0,U=A.length;O!=U;++O){p=A[O].trim();var Y=p.length;if(Y!==0){var J=0;e:for(g=0;g<Y;++g)switch(p[g]){case">":if(p[g-1]!="/"){++g;break e}if(d&&d.cellStyles){if(S=Rr(p.slice(J,g),!0),I=S.r!=null?parseInt(S.r,10):I+1,P=-1,d.sheetRows&&d.sheetRows<I)continue;z={},K=!1,S.ht&&(K=!0,z.hpt=parseFloat(S.ht),z.hpx=By(z.hpt)),S.hidden=="1"&&(K=!0,z.hidden=!0),S.outlineLevel!=null&&(K=!0,z.level=+S.outlineLevel),K&&(M[I-1]=z)}break;case"<":J=g;break}if(J>=g)break;if(S=Rr(p.slice(J,g),!0),I=S.r!=null?parseInt(S.r,10):I+1,P=-1,!(d.sheetRows&&d.sheetRows<I)){f.s.r>I-1&&(f.s.r=I-1),f.e.r<I-1&&(f.e.r=I-1),d&&d.cellStyles&&(z={},K=!1,S.ht&&(K=!0,z.hpt=parseFloat(S.ht),z.hpx=By(z.hpt)),S.hidden=="1"&&(K=!0,z.hidden=!0),S.outlineLevel!=null&&(K=!0,z.level=+S.outlineLevel),K&&(M[I-1]=z)),x=p.slice(g).split(e);for(var se=0;se!=x.length&&x[se].trim().charAt(0)=="<";++se);for(x=x.slice(se),g=0;g!=x.length;++g)if(p=x[g].trim(),p.length!==0){if(v=p.match(r),b=g,y=0,N=0,p="<c "+(p.slice(0,1)=="<"?">":"")+p,v!=null&&v.length===2){for(b=0,_=v[1],y=0;y!=_.length&&!((N=_.charCodeAt(y)-64)<1||N>26);++y)b=26*b+N;--b,P=b}else++P;for(y=0;y!=p.length&&p.charCodeAt(y)!==62;++y);if(++y,S=Rr(p.slice(0,y),!0),S.r||(S.r=Er({r:I-1,c:P})),_=p.slice(y),j={t:""},(v=_.match(i))!=null&&v[1]!==""&&(j.v=Dn(v[1])),d.cellFormula){if((v=_.match(o))!=null&&v[1]!==""){if(j.f=Dn(us(v[1])).replace(/\r\n/g,`
`),d.xlfn||(j.f=_Y(j.f)),v[0].indexOf('t="array"')>-1)j.F=(_.match(a)||[])[1],j.F.indexOf(":")>-1&&H.push([wn(j.F),j.F]);else if(v[0].indexOf('t="shared"')>-1){T=Rr(v[0]);var ee=Dn(us(v[1]));d.xlfn||(ee=_Y(ee)),q[parseInt(T.si,10)]=[T,ee,S.r]}}else(v=_.match(/<f[^>]*\/>/))&&(T=Rr(v[0]),q[T.si]&&(j.f=A2t(q[T.si][1],q[T.si][2],S.r)));var ie=Qs(S.r);for(y=0;y<H.length;++y)ie.r>=H[y][0].s.r&&ie.r<=H[y][0].e.r&&ie.c>=H[y][0].s.c&&ie.c<=H[y][0].e.c&&(j.F=H[y][1])}if(S.t==null&&j.v===void 0)if(j.f||j.F)j.v=0,j.t="n";else if(E)j.t="z";else continue;else j.t=S.t||"n";switch(f.s.c>P&&(f.s.c=P),f.e.c<P&&(f.e.c=P),j.t){case"n":if(j.v==""||j.v==null){if(!E)continue;j.t="z"}else j.v=parseFloat(j.v);break;case"s":if(typeof j.v>"u"){if(!E)continue;j.t="z"}else F=Lw[parseInt(j.v,10)],j.v=F.t,j.r=F.r,d.cellHTML&&(j.h=F.h);break;case"str":j.t="s",j.v=j.v!=null?us(j.v):"",d.cellHTML&&(j.h=WM(j.v));break;case"inlineStr":v=_.match(n),j.t="s",v!=null&&(F=c7(v[1]))?(j.v=F.t,d.cellHTML&&(j.h=F.h)):j.v="";break;case"b":j.v=Ls(j.v);break;case"d":d.cellDates?j.v=Us(j.v,1):(j.v=yi(Us(j.v,1)),j.t="n");break;case"e":(!d||d.cellText!==!1)&&(j.w=j.v),j.v=Ehe[j.v];break}if(k=V=0,R=null,C&&S.s!==void 0&&(R=h.CellXf[S.s],R!=null&&(R.numFmtId!=null&&(k=R.numFmtId),d.cellStyles&&R.fillId!=null&&(V=R.fillId))),Sme(j,k,V,d,m,h),d.cellDates&&C&&j.t=="n"&&Gg(Nr[k])&&(j.t="d",j.v=lA(j.v)),S.cm&&d.xlmeta){var Ee=(d.xlmeta.Cell||[])[+S.cm-1];Ee&&Ee.type=="XLDAPR"&&(j.D=!0)}if(L){var te=Qs(S.r);u[te.r]||(u[te.r]=[]),u[te.r][te.c]=j}else u[S.r]=j}}}}M.length>0&&(u["!rows"]=M)}}();function I_t(e,t,r,n){var a=[],i=[],o=wn(e["!ref"]),l="",c,u="",d=[],f=0,m=0,h=e["!rows"],g=Array.isArray(e),p={r:u},x,v=-1;for(m=o.s.c;m<=o.e.c;++m)d[m]=zs(m);for(f=o.s.r;f<=o.e.r;++f){for(i=[],u=va(f),m=o.s.c;m<=o.e.c;++m){c=d[m]+u;var b=g?(e[f]||[])[m]:e[c];b!==void 0&&(l=O_t(b,c,e,t))!=null&&i.push(l)}(i.length>0||h&&h[f])&&(p={r:u},h&&h[f]&&(x=h[f],x.hidden&&(p.hidden=1),v=-1,x.hpx?v=bj(x.hpx):x.hpt&&(v=x.hpt),v>-1&&(p.ht=v,p.customHeight=1),x.level&&(p.outlineLevel=x.level)),a[a.length]=Lt("row",i.join(""),p))}if(h)for(;f<h.length;++f)h&&h[f]&&(p={r:f+1},x=h[f],x.hidden&&(p.hidden=1),v=-1,x.hpx?v=bj(x.hpx):x.hpt&&(v=x.hpt),v>-1&&(p.ht=v,p.customHeight=1),x.level&&(p.outlineLevel=x.level),a[a.length]=Lt("row","",p));return a.join("")}function Cme(e,t,r,n){var a=[Ra,Lt("worksheet",null,{xmlns:Kg[0],"xmlns:r":mi.r})],i=r.SheetNames[e],o=0,l="",c=r.Sheets[i];c==null&&(c={});var u=c["!ref"]||"A1",d=wn(u);if(d.e.c>16383||d.e.r>1048575){if(t.WTF)throw new Error("Range "+u+" exceeds format limit A1:XFD1048576");d.e.c=Math.min(d.e.c,16383),d.e.r=Math.min(d.e.c,1048575),u=nn(d)}n||(n={}),c["!comments"]=[];var f=[];v_t(c,r,e,t,a),a[a.length]=Lt("dimension",null,{ref:u}),a[a.length]=P_t(c,t,e,r),t.sheetFormat&&(a[a.length]=Lt("sheetFormatPr",null,{defaultRowHeight:t.sheetFormat.defaultRowHeight||"16",baseColWidth:t.sheetFormat.baseColWidth||"10",outlineLevelRow:t.sheetFormat.outlineLevelRow||"7"})),c["!cols"]!=null&&c["!cols"].length>0&&(a[a.length]=k_t(c,c["!cols"])),a[o=a.length]="<sheetData/>",c["!links"]=[],c["!ref"]!=null&&(l=I_t(c,t),l.length>0&&(a[a.length]=l)),a.length>o+1&&(a[a.length]="</sheetData>",a[o]=a[o].replace("/>",">")),c["!protect"]&&(a[a.length]=w_t(c["!protect"])),c["!autofilter"]!=null&&(a[a.length]=E_t(c["!autofilter"],c,r,e)),c["!merges"]!=null&&c["!merges"].length>0&&(a[a.length]=g_t(c["!merges"]));var m=-1,h,g=-1;return c["!links"].length>0&&(a[a.length]="<hyperlinks>",c["!links"].forEach(function(p){p[1].Target&&(h={ref:p[0]},p[1].Target.charAt(0)!="#"&&(g=ts(n,-1,ns(p[1].Target).replace(/#.*$/,""),hn.HLINK),h["r:id"]="rId"+g),(m=p[1].Target.indexOf("#"))>-1&&(h.location=ns(p[1].Target.slice(m+1))),p[1].Tooltip&&(h.tooltip=ns(p[1].Tooltip)),a[a.length]=Lt("hyperlink",null,h))}),a[a.length]="</hyperlinks>"),delete c["!links"],c["!margins"]!=null&&(a[a.length]=N_t(c["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&(a[a.length]=Yi("ignoredErrors",Lt("ignoredError",null,{numberStoredAsText:1,sqref:u}))),f.length>0&&(g=ts(n,-1,"../drawings/drawing"+(e+1)+".xml",hn.DRAW),a[a.length]=Lt("drawing",null,{"r:id":"rId"+g}),c["!drawing"]=f),c["!comments"].length>0&&(g=ts(n,-1,"../drawings/vmlDrawing"+(e+1)+".vml",hn.VML),a[a.length]=Lt("legacyDrawing",null,{"r:id":"rId"+g}),c["!legacy"]=g),a.length>1&&(a[a.length]="</worksheet>",a[1]=a[1].replace("/>",">")),a.join("")}function R_t(e,t){var r={},n=e.l+t;r.r=e.read_shift(4),e.l+=4;var a=e.read_shift(2);e.l+=1;var i=e.read_shift(1);return e.l=n,i&7&&(r.level=i&7),i&16&&(r.hidden=!0),i&32&&(r.hpt=a/20),r}function L_t(e,t,r){var n=lt(145),a=(r["!rows"]||[])[e]||{};n.write_shift(4,e),n.write_shift(4,0);var i=320;a.hpx?i=bj(a.hpx)*20:a.hpt&&(i=a.hpt*20),n.write_shift(2,i),n.write_shift(1,0);var o=0;a.level&&(o|=a.level),a.hidden&&(o|=16),(a.hpx||a.hpt)&&(o|=32),n.write_shift(1,o),n.write_shift(1,0);var l=0,c=n.l;n.l+=4;for(var u={r:e,c:0},d=0;d<16;++d)if(!(t.s.c>d+1<<10||t.e.c<d<<10)){for(var f=-1,m=-1,h=d<<10;h<d+1<<10;++h){u.c=h;var g=Array.isArray(r)?(r[u.r]||[])[u.c]:r[Er(u)];g&&(f<0&&(f=h),m=h)}f<0||(++l,n.write_shift(4,f),n.write_shift(4,m))}var p=n.l;return n.l=c,n.write_shift(4,l),n.l=p,n.length>n.l?n.slice(0,n.l):n}function F_t(e,t,r,n){var a=L_t(n,r,t);(a.length>17||(t["!rows"]||[])[n])&&yt(e,0,a)}var M_t=Jg,$_t=L1;function B_t(){}function z_t(e,t){var r={},n=e[e.l];return++e.l,r.above=!(n&64),r.left=!(n&128),e.l+=18,r.name=Vvt(e),r}function U_t(e,t,r){r==null&&(r=lt(84+4*e.length));var n=192;t&&(t.above&&(n&=-65),t.left&&(n&=-129)),r.write_shift(1,n);for(var a=1;a<3;++a)r.write_shift(1,0);return Tk({auto:1},r),r.write_shift(-4,-1),r.write_shift(-4,-1),_he(e,r),r.slice(0,r.l)}function q_t(e){var t=fu(e);return[t]}function V_t(e,t,r){return r==null&&(r=lt(8)),Yg(t,r)}function W_t(e){var t=Xg(e);return[t]}function H_t(e,t,r){return r==null&&(r=lt(4)),Zg(t,r)}function G_t(e){var t=fu(e),r=e.read_shift(1);return[t,r,"b"]}function K_t(e,t,r){return r==null&&(r=lt(9)),Yg(t,r),r.write_shift(1,e.v?1:0),r}function Y_t(e){var t=Xg(e),r=e.read_shift(1);return[t,r,"b"]}function X_t(e,t,r){return r==null&&(r=lt(5)),Zg(t,r),r.write_shift(1,e.v?1:0),r}function Z_t(e){var t=fu(e),r=e.read_shift(1);return[t,r,"e"]}function J_t(e,t,r){return r==null&&(r=lt(9)),Yg(t,r),r.write_shift(1,e.v),r}function Q_t(e){var t=Xg(e),r=e.read_shift(1);return[t,r,"e"]}function eNt(e,t,r){return r==null&&(r=lt(8)),Zg(t,r),r.write_shift(1,e.v),r.write_shift(2,0),r.write_shift(1,0),r}function tNt(e){var t=fu(e),r=e.read_shift(4);return[t,r,"s"]}function rNt(e,t,r){return r==null&&(r=lt(12)),Yg(t,r),r.write_shift(4,t.v),r}function nNt(e){var t=Xg(e),r=e.read_shift(4);return[t,r,"s"]}function sNt(e,t,r){return r==null&&(r=lt(8)),Zg(t,r),r.write_shift(4,t.v),r}function aNt(e){var t=fu(e),r=mo(e);return[t,r,"n"]}function iNt(e,t,r){return r==null&&(r=lt(16)),Yg(t,r),Sg(e.v,r),r}function Eme(e){var t=Xg(e),r=mo(e);return[t,r,"n"]}function oNt(e,t,r){return r==null&&(r=lt(12)),Zg(t,r),Sg(e.v,r),r}function lNt(e){var t=fu(e),r=s7(e);return[t,r,"n"]}function cNt(e,t,r){return r==null&&(r=lt(12)),Yg(t,r),Nhe(e.v,r),r}function uNt(e){var t=Xg(e),r=s7(e);return[t,r,"n"]}function dNt(e,t,r){return r==null&&(r=lt(8)),Zg(t,r),Nhe(e.v,r),r}function fNt(e){var t=fu(e),r=t7(e);return[t,r,"is"]}function hNt(e){var t=fu(e),r=xo(e);return[t,r,"str"]}function mNt(e,t,r){return r==null&&(r=lt(12+4*e.v.length)),Yg(t,r),Pi(e.v,r),r.length>r.l?r.slice(0,r.l):r}function pNt(e){var t=Xg(e),r=xo(e);return[t,r,"str"]}function gNt(e,t,r){return r==null&&(r=lt(8+4*e.v.length)),Zg(t,r),Pi(e.v,r),r.length>r.l?r.slice(0,r.l):r}function xNt(e,t,r){var n=e.l+t,a=fu(e);a.r=r["!row"];var i=e.read_shift(1),o=[a,i,"b"];if(r.cellFormula){e.l+=2;var l=fA(e,n-e.l,r);o[3]=co(l,null,a,r.supbooks,r)}else e.l=n;return o}function vNt(e,t,r){var n=e.l+t,a=fu(e);a.r=r["!row"];var i=e.read_shift(1),o=[a,i,"e"];if(r.cellFormula){e.l+=2;var l=fA(e,n-e.l,r);o[3]=co(l,null,a,r.supbooks,r)}else e.l=n;return o}function yNt(e,t,r){var n=e.l+t,a=fu(e);a.r=r["!row"];var i=mo(e),o=[a,i,"n"];if(r.cellFormula){e.l+=2;var l=fA(e,n-e.l,r);o[3]=co(l,null,a,r.supbooks,r)}else e.l=n;return o}function bNt(e,t,r){var n=e.l+t,a=fu(e);a.r=r["!row"];var i=xo(e),o=[a,i,"str"];if(r.cellFormula){e.l+=2;var l=fA(e,n-e.l,r);o[3]=co(l,null,a,r.supbooks,r)}else e.l=n;return o}var wNt=Jg,jNt=L1;function _Nt(e,t){return t==null&&(t=lt(4)),t.write_shift(4,e),t}function NNt(e,t){var r=e.l+t,n=Jg(e),a=r7(e),i=xo(e),o=xo(e),l=xo(e);e.l=r;var c={rfx:n,relId:a,loc:i,display:l};return o&&(c.Tooltip=o),c}function SNt(e,t){var r=lt(50+4*(e[1].Target.length+(e[1].Tooltip||"").length));L1({s:Qs(e[0]),e:Qs(e[0])},r),n7("rId"+t,r);var n=e[1].Target.indexOf("#"),a=n==-1?"":e[1].Target.slice(n+1);return Pi(a||"",r),Pi(e[1].Tooltip||"",r),Pi("",r),r.slice(0,r.l)}function kNt(){}function CNt(e,t,r){var n=e.l+t,a=She(e),i=e.read_shift(1),o=[a];if(o[2]=i,r.cellFormula){var l=Zjt(e,n-e.l,r);o[1]=l}else e.l=n;return o}function ENt(e,t,r){var n=e.l+t,a=Jg(e),i=[a];if(r.cellFormula){var o=Qjt(e,n-e.l,r);i[1]=o,e.l=n}else e.l=n;return i}function ANt(e,t,r){r==null&&(r=lt(18));var n=hA(e,t);r.write_shift(-4,e),r.write_shift(-4,e),r.write_shift(4,(n.width||10)*256),r.write_shift(4,0);var a=0;return t.hidden&&(a|=1),typeof n.width=="number"&&(a|=2),t.level&&(a|=t.level<<8),r.write_shift(2,a),r}var Ame=["left","right","top","bottom","header","footer"];function TNt(e){var t={};return Ame.forEach(function(r){t[r]=mo(e)}),t}function PNt(e,t){return t==null&&(t=lt(6*8)),Z0(e),Ame.forEach(function(r){Sg(e[r],t)}),t}function ONt(e){var t=e.read_shift(2);return e.l+=28,{RTL:t&32}}function DNt(e,t,r){r==null&&(r=lt(30));var n=924;return(((t||{}).Views||[])[0]||{}).RTL&&(n|=32),r.write_shift(2,n),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(1,0),r.write_shift(1,0),r.write_shift(2,0),r.write_shift(2,100),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(2,0),r.write_shift(4,0),r}function INt(e){var t=lt(24);return t.write_shift(4,4),t.write_shift(4,1),L1(e,t),t}function RNt(e,t){return t==null&&(t=lt(16*4+2)),t.write_shift(2,e.password?u7(e.password):0),t.write_shift(4,1),[["objects",!1],["scenarios",!1],["formatCells",!0],["formatColumns",!0],["formatRows",!0],["insertColumns",!0],["insertRows",!0],["insertHyperlinks",!0],["deleteColumns",!0],["deleteRows",!0],["selectLockedCells",!1],["sort",!0],["autoFilter",!0],["pivotTables",!0],["selectUnlockedCells",!1]].forEach(function(r){r[1]?t.write_shift(4,e[r[0]]!=null&&!e[r[0]]?1:0):t.write_shift(4,e[r[0]]!=null&&e[r[0]]?0:1)}),t}function LNt(){}function FNt(){}function MNt(e,t,r,n,a,i,o){if(!e)return e;var l=t||{};n||(n={"!id":{}});var c=l.dense?[]:{},u,d={s:{r:2e6,c:2e6},e:{r:0,c:0}},f=!1,m=!1,h,g,p,x,v,b,y,N,_,j=[];l.biff=12,l["!row"]=0;var S=0,I=!1,P=[],F={},T=l.supbooks||a.supbooks||[[]];if(T.sharedf=F,T.arrayf=P,T.SheetNames=a.SheetNames||a.Sheets.map(function(L){return L.name}),!l.supbooks&&(l.supbooks=T,a.Names))for(var k=0;k<a.Names.length;++k)T[0][k+1]=a.Names[k];var V=[],C=[],R=!1;wj[16]={n:"BrtShortReal",f:Eme};var H;if(Ch(e,function(M,z,K){if(!m)switch(K){case 148:u=M;break;case 0:h=M,l.sheetRows&&l.sheetRows<=h.r&&(m=!0),N=va(x=h.r),l["!row"]=h.r,(M.hidden||M.hpt||M.level!=null)&&(M.hpt&&(M.hpx=By(M.hpt)),C[M.r]=M);break;case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 13:case 14:case 15:case 16:case 17:case 18:case 62:switch(g={t:M[2]},M[2]){case"n":g.v=M[1];break;case"s":y=Lw[M[1]],g.v=y.t,g.r=y.r;break;case"b":g.v=!!M[1];break;case"e":g.v=M[1],l.cellText!==!1&&(g.w=Eh[g.v]);break;case"str":g.t="s",g.v=M[1];break;case"is":g.t="s",g.v=M[1].t;break}if((p=o.CellXf[M[0].iStyleRef])&&Sme(g,p.numFmtId,null,l,i,o),v=M[0].c==-1?v+1:M[0].c,l.dense?(c[x]||(c[x]=[]),c[x][v]=g):c[zs(v)+N]=g,l.cellFormula){for(I=!1,S=0;S<P.length;++S){var E=P[S];h.r>=E[0].s.r&&h.r<=E[0].e.r&&v>=E[0].s.c&&v<=E[0].e.c&&(g.F=nn(E[0]),I=!0)}!I&&M.length>3&&(g.f=M[3])}if(d.s.r>h.r&&(d.s.r=h.r),d.s.c>v&&(d.s.c=v),d.e.r<h.r&&(d.e.r=h.r),d.e.c<v&&(d.e.c=v),l.cellDates&&p&&g.t=="n"&&Gg(Nr[p.numFmtId])){var A=Dm(g.v);A&&(g.t="d",g.v=new Date(A.y,A.m-1,A.d,A.H,A.M,A.S,A.u))}H&&(H.type=="XLDAPR"&&(g.D=!0),H=void 0);break;case 1:case 12:if(!l.sheetStubs||f)break;g={t:"z",v:void 0},v=M[0].c==-1?v+1:M[0].c,l.dense?(c[x]||(c[x]=[]),c[x][v]=g):c[zs(v)+N]=g,d.s.r>h.r&&(d.s.r=h.r),d.s.c>v&&(d.s.c=v),d.e.r<h.r&&(d.e.r=h.r),d.e.c<v&&(d.e.c=v),H&&(H.type=="XLDAPR"&&(g.D=!0),H=void 0);break;case 176:j.push(M);break;case 49:H=((l.xlmeta||{}).Cell||[])[M-1];break;case 494:var O=n["!id"][M.relId];for(O?(M.Target=O.Target,M.loc&&(M.Target+="#"+M.loc),M.Rel=O):M.relId==""&&(M.Target="#"+M.loc),x=M.rfx.s.r;x<=M.rfx.e.r;++x)for(v=M.rfx.s.c;v<=M.rfx.e.c;++v)l.dense?(c[x]||(c[x]=[]),c[x][v]||(c[x][v]={t:"z",v:void 0}),c[x][v].l=M):(b=Er({c:v,r:x}),c[b]||(c[b]={t:"z",v:void 0}),c[b].l=M);break;case 426:if(!l.cellFormula)break;P.push(M),_=l.dense?c[x][v]:c[zs(v)+N],_.f=co(M[1],d,{r:h.r,c:v},T,l),_.F=nn(M[0]);break;case 427:if(!l.cellFormula)break;F[Er(M[0].s)]=M[1],_=l.dense?c[x][v]:c[zs(v)+N],_.f=co(M[1],d,{r:h.r,c:v},T,l);break;case 60:if(!l.cellStyles)break;for(;M.e>=M.s;)V[M.e--]={width:M.w/256,hidden:!!(M.flags&1),level:M.level},R||(R=!0,d7(M.w/256)),hp(V[M.e+1]);break;case 161:c["!autofilter"]={ref:nn(M)};break;case 476:c["!margins"]=M;break;case 147:a.Sheets[r]||(a.Sheets[r]={}),M.name&&(a.Sheets[r].CodeName=M.name),(M.above||M.left)&&(c["!outline"]={above:M.above,left:M.left});break;case 137:a.Views||(a.Views=[{}]),a.Views[0]||(a.Views[0]={}),M.RTL&&(a.Views[0].RTL=!0);break;case 485:break;case 64:case 1053:break;case 151:break;case 152:case 175:case 644:case 625:case 562:case 396:case 1112:case 1146:case 471:case 1050:case 649:case 1105:case 589:case 607:case 564:case 1055:case 168:case 174:case 1180:case 499:case 507:case 550:case 171:case 167:case 1177:case 169:case 1181:case 551:case 552:case 661:case 639:case 478:case 537:case 477:case 536:case 1103:case 680:case 1104:case 1024:case 663:case 535:case 678:case 504:case 1043:case 428:case 170:case 3072:case 50:case 2070:case 1045:break;case 35:f=!0;break;case 36:f=!1;break;case 37:f=!0;break;case 38:f=!1;break;default:if(!z.T){if(!f||l.WTF)throw new Error("Unexpected record 0x"+K.toString(16))}}},l),delete l.supbooks,delete l["!row"],!c["!ref"]&&(d.s.r<2e6||u&&(u.e.r>0||u.e.c>0||u.s.r>0||u.s.c>0))&&(c["!ref"]=nn(u||d)),l.sheetRows&&c["!ref"]){var q=wn(c["!ref"]);l.sheetRows<=+q.e.r&&(q.e.r=l.sheetRows-1,q.e.r>d.e.r&&(q.e.r=d.e.r),q.e.r<q.s.r&&(q.s.r=q.e.r),q.e.c>d.e.c&&(q.e.c=d.e.c),q.e.c<q.s.c&&(q.s.c=q.e.c),c["!fullref"]=c["!ref"],c["!ref"]=nn(q))}return j.length>0&&(c["!merges"]=j),V.length>0&&(c["!cols"]=V),C.length>0&&(c["!rows"]=C),c}function $Nt(e,t,r,n,a,i,o){if(t.v===void 0)return!1;var l="";switch(t.t){case"b":l=t.v?"1":"0";break;case"d":t=xs(t),t.z=t.z||Nr[14],t.v=yi(Us(t.v)),t.t="n";break;case"n":case"e":l=""+t.v;break;default:l=t.v;break}var c={r,c:n};switch(c.s=Lp(a.cellXfs,t,a),t.l&&i["!links"].push([Er(c),t.l]),t.c&&i["!comments"].push([Er(c),t.c]),t.t){case"s":case"str":return a.bookSST?(l=g7(a.Strings,t.v,a.revStrings),c.t="s",c.v=l,o?yt(e,18,sNt(t,c)):yt(e,7,rNt(t,c))):(c.t="str",o?yt(e,17,gNt(t,c)):yt(e,6,mNt(t,c))),!0;case"n":return t.v==(t.v|0)&&t.v>-1e3&&t.v<1e3?o?yt(e,13,dNt(t,c)):yt(e,2,cNt(t,c)):o?yt(e,16,oNt(t,c)):yt(e,5,iNt(t,c)),!0;case"b":return c.t="b",o?yt(e,15,X_t(t,c)):yt(e,4,K_t(t,c)),!0;case"e":return c.t="e",o?yt(e,14,eNt(t,c)):yt(e,3,J_t(t,c)),!0}return o?yt(e,12,H_t(t,c)):yt(e,1,V_t(t,c)),!0}function BNt(e,t,r,n){var a=wn(t["!ref"]||"A1"),i,o="",l=[];yt(e,145);var c=Array.isArray(t),u=a.e.r;t["!rows"]&&(u=Math.max(a.e.r,t["!rows"].length-1));for(var d=a.s.r;d<=u;++d){o=va(d),F_t(e,t,a,d);var f=!1;if(d<=a.e.r)for(var m=a.s.c;m<=a.e.c;++m){d===a.s.r&&(l[m]=zs(m)),i=l[m]+o;var h=c?(t[d]||[])[m]:t[i];if(!h){f=!1;continue}f=$Nt(e,h,d,m,n,t,f)}}yt(e,146)}function zNt(e,t){!t||!t["!merges"]||(yt(e,177,_Nt(t["!merges"].length)),t["!merges"].forEach(function(r){yt(e,176,jNt(r))}),yt(e,178))}function UNt(e,t){!t||!t["!cols"]||(yt(e,390),t["!cols"].forEach(function(r,n){r&&yt(e,60,ANt(n,r))}),yt(e,391))}function qNt(e,t){!t||!t["!ref"]||(yt(e,648),yt(e,649,INt(wn(t["!ref"]))),yt(e,650))}function VNt(e,t,r){t["!links"].forEach(function(n){if(n[1].Target){var a=ts(r,-1,n[1].Target.replace(/#.*$/,""),hn.HLINK);yt(e,494,SNt(n,a))}}),delete t["!links"]}function WNt(e,t,r,n){if(t["!comments"].length>0){var a=ts(n,-1,"../drawings/vmlDrawing"+(r+1)+".vml",hn.VML);yt(e,551,n7("rId"+a)),t["!legacy"]=a}}function HNt(e,t,r,n){if(t["!autofilter"]){var a=t["!autofilter"],i=typeof a.ref=="string"?a.ref:nn(a.ref);r.Workbook||(r.Workbook={Sheets:[]}),r.Workbook.Names||(r.Workbook.Names=[]);var o=r.Workbook.Names,l=Go(i);l.s.r==l.e.r&&(l.e.r=Go(t["!ref"]).e.r,i=nn(l));for(var c=0;c<o.length;++c){var u=o[c];if(u.Name=="_xlnm._FilterDatabase"&&u.Sheet==n){u.Ref="'"+r.SheetNames[n]+"'!"+i;break}}c==o.length&&o.push({Name:"_xlnm._FilterDatabase",Sheet:n,Ref:"'"+r.SheetNames[n]+"'!"+i}),yt(e,161,L1(wn(i))),yt(e,162)}}function GNt(e,t,r){yt(e,133),yt(e,137,DNt(t,r)),yt(e,138),yt(e,134)}function KNt(e,t){t["!protect"]&&yt(e,535,RNt(t["!protect"]))}function YNt(e,t,r,n){var a=gl(),i=r.SheetNames[e],o=r.Sheets[i]||{},l=i;try{r&&r.Workbook&&(l=r.Workbook.Sheets[e].CodeName||l)}catch{}var c=wn(o["!ref"]||"A1");if(c.e.c>16383||c.e.r>1048575){if(t.WTF)throw new Error("Range "+(o["!ref"]||"A1")+" exceeds format limit A1:XFD1048576");c.e.c=Math.min(c.e.c,16383),c.e.r=Math.min(c.e.c,1048575)}return o["!links"]=[],o["!comments"]=[],yt(a,129),(r.vbaraw||o["!outline"])&&yt(a,147,U_t(l,o["!outline"])),yt(a,148,$_t(c)),GNt(a,o,r.Workbook),UNt(a,o),BNt(a,o,e,t),KNt(a,o),HNt(a,o,r,e),zNt(a,o),VNt(a,o,n),o["!margins"]&&yt(a,476,PNt(o["!margins"])),(!t||t.ignoreEC||t.ignoreEC==null)&&qNt(a,o),WNt(a,o,e,n),yt(a,130),a.end()}function XNt(e){var t=[],r=e.match(/^<c:numCache>/),n;(e.match(/<c:pt idx="(\d*)">(.*?)<\/c:pt>/mg)||[]).forEach(function(i){var o=i.match(/<c:pt idx="(\d*?)"><c:v>(.*)<\/c:v><\/c:pt>/);o&&(t[+o[1]]=r?+o[2]:o[2])});var a=Dn((e.match(/<c:formatCode>([\s\S]*?)<\/c:formatCode>/)||["","General"])[1]);return(e.match(/<c:f>(.*?)<\/c:f>/mg)||[]).forEach(function(i){n=i.replace(/<.*?>/g,"")}),[t,a,n]}function ZNt(e,t,r,n,a,i){var o=i||{"!type":"chart"};if(!e)return i;var l=0,c=0,u="A",d={s:{r:2e6,c:2e6},e:{r:0,c:0}};return(e.match(/<c:numCache>[\s\S]*?<\/c:numCache>/gm)||[]).forEach(function(f){var m=XNt(f);d.s.r=d.s.c=0,d.e.c=l,u=zs(l),m[0].forEach(function(h,g){o[u+va(g)]={t:"n",v:h,z:m[1]},c=g}),d.e.r<c&&(d.e.r=c),++l}),l>0&&(o["!ref"]=nn(d)),o}function JNt(e,t,r,n,a){if(!e)return e;n||(n={"!id":{}});var i={"!type":"chart","!drawel":null,"!rel":""},o,l=e.match(kme);return l&&x7(l[0],i,a,r),(o=e.match(/drawing r:id="(.*?)"/))&&(i["!rel"]=o[1]),n["!id"][i["!rel"]]&&(i["!drawel"]=n["!id"][i["!rel"]]),i}function QNt(e,t){e.l+=10;var r=xo(e);return{name:r}}function eSt(e,t,r,n,a){if(!e)return e;n||(n={"!id":{}});var i={"!type":"chart","!drawel":null,"!rel":""},o=!1;return Ch(e,function(c,u,d){switch(d){case 550:i["!rel"]=c;break;case 651:a.Sheets[r]||(a.Sheets[r]={}),c.name&&(a.Sheets[r].CodeName=c.name);break;case 562:case 652:case 669:case 679:case 551:case 552:case 476:case 3072:break;case 35:o=!0;break;case 36:o=!1;break;case 37:break;case 38:break;default:if(!(u.T>0)){if(!(u.T<0)){if(!o||t.WTF)throw new Error("Unexpected record 0x"+d.toString(16))}}}},t),n["!id"][i["!rel"]]&&(i["!drawel"]=n["!id"][i["!rel"]]),i}var v7=[["allowRefreshQuery",!1,"bool"],["autoCompressPictures",!0,"bool"],["backupFile",!1,"bool"],["checkCompatibility",!1,"bool"],["CodeName",""],["date1904",!1,"bool"],["defaultThemeVersion",0,"int"],["filterPrivacy",!1,"bool"],["hidePivotFieldList",!1,"bool"],["promptedSolutions",!1,"bool"],["publishItems",!1,"bool"],["refreshAllConnections",!1,"bool"],["saveExternalLinkValues",!0,"bool"],["showBorderUnselectedTables",!0,"bool"],["showInkAnnotation",!0,"bool"],["showObjects","all"],["showPivotChartFilter",!1,"bool"],["updateLinks","userSet"]],tSt=[["activeTab",0,"int"],["autoFilterDateGrouping",!0,"bool"],["firstSheet",0,"int"],["minimized",!1,"bool"],["showHorizontalScroll",!0,"bool"],["showSheetTabs",!0,"bool"],["showVerticalScroll",!0,"bool"],["tabRatio",600,"int"],["visibility","visible"]],rSt=[],nSt=[["calcCompleted","true"],["calcMode","auto"],["calcOnSave","true"],["concurrentCalc","true"],["fullCalcOnLoad","false"],["fullPrecision","true"],["iterate","false"],["iterateCount","100"],["iterateDelta","0.001"],["refMode","A1"]];function EY(e,t){for(var r=0;r!=e.length;++r)for(var n=e[r],a=0;a!=t.length;++a){var i=t[a];if(n[i[0]]==null)n[i[0]]=i[1];else switch(i[2]){case"bool":typeof n[i[0]]=="string"&&(n[i[0]]=Ls(n[i[0]]));break;case"int":typeof n[i[0]]=="string"&&(n[i[0]]=parseInt(n[i[0]],10));break}}}function AY(e,t){for(var r=0;r!=t.length;++r){var n=t[r];if(e[n[0]]==null)e[n[0]]=n[1];else switch(n[2]){case"bool":typeof e[n[0]]=="string"&&(e[n[0]]=Ls(e[n[0]]));break;case"int":typeof e[n[0]]=="string"&&(e[n[0]]=parseInt(e[n[0]],10));break}}}function Tme(e){AY(e.WBProps,v7),AY(e.CalcPr,nSt),EY(e.WBView,tSt),EY(e.Sheets,rSt),Dv.date1904=Ls(e.WBProps.date1904)}function sSt(e){return!e.Workbook||!e.Workbook.WBProps?"false":Ls(e.Workbook.WBProps.date1904)?"true":"false"}var aSt="][*?/\\".split("");function Pme(e,t){if(e.length>31)throw new Error("Sheet names cannot exceed 31 chars");var r=!0;return aSt.forEach(function(n){if(e.indexOf(n)!=-1)throw new Error("Sheet name cannot contain : \\ / ? * [ ]")}),r}function iSt(e,t,r){e.forEach(function(n,a){Pme(n);for(var i=0;i<a;++i)if(n==e[i])throw new Error("Duplicate Sheet Name: "+n);if(r){var o=t&&t[a]&&t[a].CodeName||n;if(o.charCodeAt(0)==95&&o.length>22)throw new Error("Bad Code Name: Worksheet"+o)}})}function Ome(e){if(!e||!e.SheetNames||!e.Sheets)throw new Error("Invalid Workbook");if(!e.SheetNames.length)throw new Error("Workbook is empty");var t=e.Workbook&&e.Workbook.Sheets||[];iSt(e.SheetNames,t,!!e.vbaraw);for(var r=0;r<e.SheetNames.length;++r)s_t(e.Sheets[e.SheetNames[r]],e.SheetNames[r],r)}var oSt=/<\w+:workbook/;function lSt(e,t){if(!e)throw new Error("Could not find file");var r={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},Names:[],xmlns:""},n=!1,a="xmlns",i={},o=0;if(e.replace(_o,function(c,u){var d=Rr(c);switch(df(d[0])){case"<?xml":break;case"<workbook":c.match(oSt)&&(a="xmlns"+c.match(/<(\w+):/)[1]),r.xmlns=d[a];break;case"</workbook>":break;case"<fileVersion":delete d[0],r.AppVersion=d;break;case"<fileVersion/>":case"</fileVersion>":break;case"<fileSharing":break;case"<fileSharing/>":break;case"<workbookPr":case"<workbookPr/>":v7.forEach(function(f){if(d[f[0]]!=null)switch(f[2]){case"bool":r.WBProps[f[0]]=Ls(d[f[0]]);break;case"int":r.WBProps[f[0]]=parseInt(d[f[0]],10);break;default:r.WBProps[f[0]]=d[f[0]]}}),d.codeName&&(r.WBProps.CodeName=us(d.codeName));break;case"</workbookPr>":break;case"<workbookProtection":break;case"<workbookProtection/>":break;case"<bookViews":case"<bookViews>":case"</bookViews>":break;case"<workbookView":case"<workbookView/>":delete d[0],r.WBView.push(d);break;case"</workbookView>":break;case"<sheets":case"<sheets>":case"</sheets>":break;case"<sheet":switch(d.state){case"hidden":d.Hidden=1;break;case"veryHidden":d.Hidden=2;break;default:d.Hidden=0}delete d.state,d.name=Dn(us(d.name)),delete d[0],r.Sheets.push(d);break;case"</sheet>":break;case"<functionGroups":case"<functionGroups/>":break;case"<functionGroup":break;case"<externalReferences":case"</externalReferences>":case"<externalReferences>":break;case"<externalReference":break;case"<definedNames/>":break;case"<definedNames>":case"<definedNames":n=!0;break;case"</definedNames>":n=!1;break;case"<definedName":i={},i.Name=us(d.name),d.comment&&(i.Comment=d.comment),d.localSheetId&&(i.Sheet=+d.localSheetId),Ls(d.hidden||"0")&&(i.Hidden=!0),o=u+c.length;break;case"</definedName>":i.Ref=Dn(us(e.slice(o,u))),r.Names.push(i);break;case"<definedName/>":break;case"<calcPr":delete d[0],r.CalcPr=d;break;case"<calcPr/>":delete d[0],r.CalcPr=d;break;case"</calcPr>":break;case"<oleSize":break;case"<customWorkbookViews>":case"</customWorkbookViews>":case"<customWorkbookViews":break;case"<customWorkbookView":case"</customWorkbookView>":break;case"<pivotCaches>":case"</pivotCaches>":case"<pivotCaches":break;case"<pivotCache":break;case"<smartTagPr":case"<smartTagPr/>":break;case"<smartTagTypes":case"<smartTagTypes>":case"</smartTagTypes>":break;case"<smartTagType":break;case"<webPublishing":case"<webPublishing/>":break;case"<fileRecoveryPr":case"<fileRecoveryPr/>":break;case"<webPublishObjects>":case"<webPublishObjects":case"</webPublishObjects>":break;case"<webPublishObject":break;case"<extLst":case"<extLst>":case"</extLst>":case"<extLst/>":break;case"<ext":n=!0;break;case"</ext>":n=!1;break;case"<ArchID":break;case"<AlternateContent":case"<AlternateContent>":n=!0;break;case"</AlternateContent>":n=!1;break;case"<revisionPtr":break;default:if(!n&&t.WTF)throw new Error("unrecognized "+d[0]+" in workbook")}return c}),Kg.indexOf(r.xmlns)===-1)throw new Error("Unknown Namespace: "+r.xmlns);return Tme(r),r}function Dme(e){var t=[Ra];t[t.length]=Lt("workbook",null,{xmlns:Kg[0],"xmlns:r":mi.r});var r=e.Workbook&&(e.Workbook.Names||[]).length>0,n={codeName:"ThisWorkbook"};e.Workbook&&e.Workbook.WBProps&&(v7.forEach(function(l){e.Workbook.WBProps[l[0]]!=null&&e.Workbook.WBProps[l[0]]!=l[1]&&(n[l[0]]=e.Workbook.WBProps[l[0]])}),e.Workbook.WBProps.CodeName&&(n.codeName=e.Workbook.WBProps.CodeName,delete n.CodeName)),t[t.length]=Lt("workbookPr",null,n);var a=e.Workbook&&e.Workbook.Sheets||[],i=0;if(a&&a[0]&&a[0].Hidden){for(t[t.length]="<bookViews>",i=0;i!=e.SheetNames.length&&!(!a[i]||!a[i].Hidden);++i);i==e.SheetNames.length&&(i=0),t[t.length]='<workbookView firstSheet="'+i+'" activeTab="'+i+'"/>',t[t.length]="</bookViews>"}for(t[t.length]="<sheets>",i=0;i!=e.SheetNames.length;++i){var o={name:ns(e.SheetNames[i].slice(0,31))};if(o.sheetId=""+(i+1),o["r:id"]="rId"+(i+1),a[i])switch(a[i].Hidden){case 1:o.state="hidden";break;case 2:o.state="veryHidden";break}t[t.length]=Lt("sheet",null,o)}return t[t.length]="</sheets>",r&&(t[t.length]="<definedNames>",e.Workbook&&e.Workbook.Names&&e.Workbook.Names.forEach(function(l){var c={name:l.Name};l.Comment&&(c.comment=l.Comment),l.Sheet!=null&&(c.localSheetId=""+l.Sheet),l.Hidden&&(c.hidden="1"),l.Ref&&(t[t.length]=Lt("definedName",ns(l.Ref),c))}),t[t.length]="</definedNames>"),t.length>2&&(t[t.length]="</workbook>",t[1]=t[1].replace("/>",">")),t.join("")}function cSt(e,t){var r={};return r.Hidden=e.read_shift(4),r.iTabID=e.read_shift(4),r.strRelID=tI(e),r.name=xo(e),r}function uSt(e,t){return t||(t=lt(127)),t.write_shift(4,e.Hidden),t.write_shift(4,e.iTabID),n7(e.strRelID,t),Pi(e.name.slice(0,31),t),t.length>t.l?t.slice(0,t.l):t}function dSt(e,t){var r={},n=e.read_shift(4);r.defaultThemeVersion=e.read_shift(4);var a=t>8?xo(e):"";return a.length>0&&(r.CodeName=a),r.autoCompressPictures=!!(n&65536),r.backupFile=!!(n&64),r.checkCompatibility=!!(n&4096),r.date1904=!!(n&1),r.filterPrivacy=!!(n&8),r.hidePivotFieldList=!!(n&1024),r.promptedSolutions=!!(n&16),r.publishItems=!!(n&2048),r.refreshAllConnections=!!(n&262144),r.saveExternalLinkValues=!!(n&128),r.showBorderUnselectedTables=!!(n&4),r.showInkAnnotation=!!(n&32),r.showObjects=["all","placeholders","none"][n>>13&3],r.showPivotChartFilter=!!(n&32768),r.updateLinks=["userSet","never","always"][n>>8&3],r}function fSt(e,t){t||(t=lt(72));var r=0;return e&&e.filterPrivacy&&(r|=8),t.write_shift(4,r),t.write_shift(4,0),_he(e&&e.CodeName||"ThisWorkbook",t),t.slice(0,t.l)}function hSt(e,t){var r={};return e.read_shift(4),r.ArchID=e.read_shift(4),e.l+=t-8,r}function mSt(e,t,r){var n=e.l+t;e.l+=4,e.l+=1;var a=e.read_shift(4),i=Wvt(e),o=Jjt(e,0,r),l=r7(e);e.l=n;var c={Name:i,Ptg:o};return a<268435455&&(c.Sheet=a),l&&(c.Comment=l),c}function pSt(e,t){var r={AppVersion:{},WBProps:{},WBView:[],Sheets:[],CalcPr:{},xmlns:""},n=[],a=!1;t||(t={}),t.biff=12;var i=[],o=[[]];return o.SheetNames=[],o.XTI=[],wj[16]={n:"BrtFRTArchID$",f:hSt},Ch(e,function(c,u,d){switch(d){case 156:o.SheetNames.push(c.name),r.Sheets.push(c);break;case 153:r.WBProps=c;break;case 39:c.Sheet!=null&&(t.SID=c.Sheet),c.Ref=co(c.Ptg,null,null,o,t),delete t.SID,delete c.Ptg,i.push(c);break;case 1036:break;case 357:case 358:case 355:case 667:o[0].length?o.push([d,c]):o[0]=[d,c],o[o.length-1].XTI=[];break;case 362:o.length===0&&(o[0]=[],o[0].XTI=[]),o[o.length-1].XTI=o[o.length-1].XTI.concat(c),o.XTI=o.XTI.concat(c);break;case 361:break;case 2071:case 158:case 143:case 664:case 353:break;case 3072:case 3073:case 534:case 677:case 157:case 610:case 2050:case 155:case 548:case 676:case 128:case 665:case 2128:case 2125:case 549:case 2053:case 596:case 2076:case 2075:case 2082:case 397:case 154:case 1117:case 553:case 2091:break;case 35:n.push(d),a=!0;break;case 36:n.pop(),a=!1;break;case 37:n.push(d),a=!0;break;case 38:n.pop(),a=!1;break;case 16:break;default:if(!u.T){if(!a||t.WTF&&n[n.length-1]!=37&&n[n.length-1]!=35)throw new Error("Unexpected record 0x"+d.toString(16))}}},t),Tme(r),r.Names=i,r.supbooks=o,r}function gSt(e,t){yt(e,143);for(var r=0;r!=t.SheetNames.length;++r){var n=t.Workbook&&t.Workbook.Sheets&&t.Workbook.Sheets[r]&&t.Workbook.Sheets[r].Hidden||0,a={Hidden:n,iTabID:r+1,strRelID:"rId"+(r+1),name:t.SheetNames[r]};yt(e,156,uSt(a))}yt(e,144)}function xSt(e,t){t||(t=lt(127));for(var r=0;r!=4;++r)t.write_shift(4,0);return Pi("SheetJS",t),Pi(uj.version,t),Pi(uj.version,t),Pi("7262",t),t.length>t.l?t.slice(0,t.l):t}function vSt(e,t){t||(t=lt(29)),t.write_shift(-4,0),t.write_shift(-4,460),t.write_shift(4,28800),t.write_shift(4,17600),t.write_shift(4,500),t.write_shift(4,e),t.write_shift(4,e);var r=120;return t.write_shift(1,r),t.length>t.l?t.slice(0,t.l):t}function ySt(e,t){if(!(!t.Workbook||!t.Workbook.Sheets)){for(var r=t.Workbook.Sheets,n=0,a=-1,i=-1;n<r.length;++n)!r[n]||!r[n].Hidden&&a==-1?a=n:r[n].Hidden==1&&i==-1&&(i=n);i>a||(yt(e,135),yt(e,158,vSt(a)),yt(e,136))}}function bSt(e,t){var r=gl();return yt(r,131),yt(r,128,xSt()),yt(r,153,fSt(e.Workbook&&e.Workbook.WBProps||null)),ySt(r,e),gSt(r,e),yt(r,132),r.end()}function wSt(e,t,r){return t.slice(-4)===".bin"?pSt(e,r):lSt(e,r)}function jSt(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?MNt(e,n,r,a,i,o,l):p_t(e,n,r,a,i,o,l)}function _St(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?eSt(e,n,r,a,i):JNt(e,n,r,a,i)}function NSt(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?C2t():E2t()}function SSt(e,t,r,n,a,i,o,l){return t.slice(-4)===".bin"?S2t():k2t()}function kSt(e,t,r,n){return t.slice(-4)===".bin"?jwt(e,r,n):uwt(e,r,n)}function CSt(e,t,r){return fme(e,r)}function ESt(e,t,r){return t.slice(-4)===".bin"?Abt(e,r):kbt(e,r)}function ASt(e,t,r){return t.slice(-4)===".bin"?b2t(e,r):d2t(e,r)}function TSt(e,t,r){return t.slice(-4)===".bin"?l2t(e):i2t(e)}function PSt(e,t,r,n){return r.slice(-4)===".bin"?c2t(e,t,r,n):void 0}function OSt(e,t,r){return t.slice(-4)===".bin"?n2t(e,t,r):a2t(e,t,r)}function DSt(e,t,r){return(t.slice(-4)===".bin"?bSt:Dme)(e)}function ISt(e,t,r,n,a){return(t.slice(-4)===".bin"?YNt:Cme)(e,r,n,a)}function RSt(e,t,r){return(t.slice(-4)===".bin"?Owt:ume)(e,r)}function LSt(e,t,r){return(t.slice(-4)===".bin"?Obt:rme)(e,r)}function FSt(e,t,r){return(t.slice(-4)===".bin"?w2t:pme)(e)}function MSt(e){return(e.slice(-4)===".bin"?s2t:hme)()}var Ime=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g,Rme=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;function _u(e,t){var r=e.split(/\s+/),n=[];if(n[0]=r[0],r.length===1)return n;var a=e.match(Ime),i,o,l,c;if(a)for(c=0;c!=a.length;++c)i=a[c].match(Rme),(o=i[1].indexOf(":"))===-1?n[i[1]]=i[2].slice(1,i[2].length-1):(i[1].slice(0,6)==="xmlns:"?l="xmlns"+i[1].slice(6):l=i[1].slice(o+1),n[l]=i[2].slice(1,i[2].length-1));return n}function $St(e){var t=e.split(/\s+/),r={};if(t.length===1)return r;var n=e.match(Ime),a,i,o,l;if(n)for(l=0;l!=n.length;++l)a=n[l].match(Rme),(i=a[1].indexOf(":"))===-1?r[a[1]]=a[2].slice(1,a[2].length-1):(a[1].slice(0,6)==="xmlns:"?o="xmlns"+a[1].slice(6):o=a[1].slice(i+1),r[o]=a[2].slice(1,a[2].length-1));return r}var Mw;function BSt(e,t){var r=Mw[e]||Dn(e);return r==="General"?_g(t):ic(r,t)}function zSt(e,t,r,n){var a=n;switch((r[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]){case"boolean":a=Ls(n);break;case"i2":case"int":a=parseInt(n,10);break;case"r4":case"float":a=parseFloat(n);break;case"date":case"dateTime.tz":a=Us(n);break;case"i8":case"string":case"fixed":case"uuid":case"bin.base64":break;default:throw new Error("bad custprop:"+r[0])}e[Dn(t)]=a}function USt(e,t,r){if(e.t!=="z"){if(!r||r.cellText!==!1)try{e.t==="e"?e.w=e.w||Eh[e.v]:t==="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=fj(e.v):e.w=_g(e.v):e.w=BSt(t||"General",e.v)}catch(i){if(r.WTF)throw i}try{var n=Mw[t]||t||"General";if(r.cellNF&&(e.z=n),r.cellDates&&e.t=="n"&&Gg(n)){var a=Dm(e.v);a&&(e.t="d",e.v=new Date(a.y,a.m-1,a.d,a.H,a.M,a.S,a.u))}}catch(i){if(r.WTF)throw i}}}function qSt(e,t,r){if(r.cellStyles&&t.Interior){var n=t.Interior;n.Pattern&&(n.patternType=rwt[n.Pattern]||n.Pattern)}e[t.ID]=t}function VSt(e,t,r,n,a,i,o,l,c,u){var d="General",f=n.StyleID,m={};u=u||{};var h=[],g=0;for(f===void 0&&l&&(f=l.StyleID),f===void 0&&o&&(f=o.StyleID);i[f]!==void 0&&(i[f].nf&&(d=i[f].nf),i[f].Interior&&h.push(i[f].Interior),!!i[f].Parent);)f=i[f].Parent;switch(r.Type){case"Boolean":n.t="b",n.v=Ls(e);break;case"String":n.t="s",n.r=HK(Dn(e)),n.v=e.indexOf("<")>-1?Dn(t||e).replace(/<.*?>/g,""):n.r;break;case"DateTime":e.slice(-1)!="Z"&&(e+="Z"),n.v=(Us(e)-new Date(Date.UTC(1899,11,30)))/(24*60*60*1e3),n.v!==n.v?n.v=Dn(e):n.v<60&&(n.v=n.v-1),(!d||d=="General")&&(d="yyyy-mm-dd");case"Number":n.v===void 0&&(n.v=+e),n.t||(n.t="n");break;case"Error":n.t="e",n.v=Ehe[e],u.cellText!==!1&&(n.w=e);break;default:e==""&&t==""?n.t="z":(n.t="s",n.v=HK(t||e));break}if(USt(n,d,u),u.cellFormula!==!1)if(n.Formula){var p=Dn(n.Formula);p.charCodeAt(0)==61&&(p=p.slice(1)),n.f=Ov(p,a),delete n.Formula,n.ArrayRange=="RC"?n.F=Ov("RC:RC",a):n.ArrayRange&&(n.F=Ov(n.ArrayRange,a),c.push([wn(n.F),n.F]))}else for(g=0;g<c.length;++g)a.r>=c[g][0].s.r&&a.r<=c[g][0].e.r&&a.c>=c[g][0].s.c&&a.c<=c[g][0].e.c&&(n.F=c[g][1]);u.cellStyles&&(h.forEach(function(x){!m.patternType&&x.patternType&&(m.patternType=x.patternType)}),n.s=m),n.StyleID!==void 0&&(n.ixfe=n.StyleID)}function WSt(e){e.t=e.v||"",e.t=e.t.replace(/\r\n/g,`
`).replace(/\r/g,`
`),e.v=e.w=e.ixfe=void 0}function RP(e,t){var r=t||{};D1();var n=ov(HM(e));(r.type=="binary"||r.type=="array"||r.type=="base64")&&(typeof Cn<"u"?n=Cn.utils.decode(65001,_k(n)):n=us(n));var a=n.slice(0,1024).toLowerCase(),i=!1;if(a=a.replace(/".*?"/g,""),(a.indexOf(">")&1023)>Math.min(a.indexOf(",")&1023,a.indexOf(";")&1023)){var o=xs(r);return o.type="string",$y.to_workbook(n,o)}if(a.indexOf("<?xml")==-1&&["html","table","head","meta","script","style","div"].forEach(function(oe){a.indexOf("<"+oe)>=0&&(i=!0)}),i)return C5t(n,r);Mw={"General Number":"General","General Date":Nr[22],"Long Date":"dddd, mmmm dd, yyyy","Medium Date":Nr[15],"Short Date":Nr[14],"Long Time":Nr[19],"Medium Time":Nr[18],"Short Time":Nr[20],Currency:'"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',Fixed:Nr[2],Standard:Nr[4],Percent:Nr[10],Scientific:Nr[11],"Yes/No":'"Yes";"Yes";"No";@',"True/False":'"True";"True";"False";@',"On/Off":'"Yes";"Yes";"No";@'};var l,c=[],u,d={},f=[],m=r.dense?[]:{},h="",g={},p={},x=_u('<Data ss:Type="String">'),v=0,b=0,y=0,N={s:{r:2e6,c:2e6},e:{r:0,c:0}},_={},j={},S="",I=0,P=[],F={},T={},k=0,V=[],C=[],R={},H=[],q,L=!1,M=[],z=[],K={},E=0,A=0,O={Sheets:[],WBProps:{date1904:!1}},U={};pj.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"");for(var Y="";l=pj.exec(n);)switch(l[3]=(Y=l[3]).toLowerCase()){case"data":if(Y=="data"){if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"))}else l[0].charAt(l[0].length-2)!=="/"&&c.push([l[3],!0]);break}if(c[c.length-1][1])break;l[1]==="/"?VSt(n.slice(v,l.index),S,x,c[c.length-1][0]=="comment"?R:g,{c:b,r:y},_,H[b],p,M,r):(S="",x=_u(l[0]),v=l.index+l[0].length);break;case"cell":if(l[1]==="/")if(C.length>0&&(g.c=C),(!r.sheetRows||r.sheetRows>y)&&g.v!==void 0&&(r.dense?(m[y]||(m[y]=[]),m[y][b]=g):m[zs(b)+va(y)]=g),g.HRef&&(g.l={Target:Dn(g.HRef)},g.HRefScreenTip&&(g.l.Tooltip=g.HRefScreenTip),delete g.HRef,delete g.HRefScreenTip),(g.MergeAcross||g.MergeDown)&&(E=b+(parseInt(g.MergeAcross,10)|0),A=y+(parseInt(g.MergeDown,10)|0),P.push({s:{c:b,r:y},e:{c:E,r:A}})),!r.sheetStubs)g.MergeAcross?b=E+1:++b;else if(g.MergeAcross||g.MergeDown){for(var J=b;J<=E;++J)for(var se=y;se<=A;++se)(J>b||se>y)&&(r.dense?(m[se]||(m[se]=[]),m[se][J]={t:"z"}):m[zs(J)+va(se)]={t:"z"});b=E+1}else++b;else g=$St(l[0]),g.Index&&(b=+g.Index-1),b<N.s.c&&(N.s.c=b),b>N.e.c&&(N.e.c=b),l[0].slice(-2)==="/>"&&++b,C=[];break;case"row":l[1]==="/"||l[0].slice(-2)==="/>"?(y<N.s.r&&(N.s.r=y),y>N.e.r&&(N.e.r=y),l[0].slice(-2)==="/>"&&(p=_u(l[0]),p.Index&&(y=+p.Index-1)),b=0,++y):(p=_u(l[0]),p.Index&&(y=+p.Index-1),K={},(p.AutoFitHeight=="0"||p.Height)&&(K.hpx=parseInt(p.Height,10),K.hpt=bj(K.hpx),z[y]=K),p.Hidden=="1"&&(K.hidden=!0,z[y]=K));break;case"worksheet":if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"));f.push(h),N.s.r<=N.e.r&&N.s.c<=N.e.c&&(m["!ref"]=nn(N),r.sheetRows&&r.sheetRows<=N.e.r&&(m["!fullref"]=m["!ref"],N.e.r=r.sheetRows-1,m["!ref"]=nn(N))),P.length&&(m["!merges"]=P),H.length>0&&(m["!cols"]=H),z.length>0&&(m["!rows"]=z),d[h]=m}else N={s:{r:2e6,c:2e6},e:{r:0,c:0}},y=b=0,c.push([l[3],!1]),u=_u(l[0]),h=Dn(u.Name),m=r.dense?[]:{},P=[],M=[],z=[],U={name:h,Hidden:0},O.Sheets.push(U);break;case"table":if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"))}else{if(l[0].slice(-2)=="/>")break;c.push([l[3],!1]),H=[],L=!1}break;case"style":l[1]==="/"?qSt(_,j,r):j=_u(l[0]);break;case"numberformat":j.nf=Dn(_u(l[0]).Format||"General"),Mw[j.nf]&&(j.nf=Mw[j.nf]);for(var ee=0;ee!=392&&Nr[ee]!=j.nf;++ee);if(ee==392){for(ee=57;ee!=392;++ee)if(Nr[ee]==null){Gd(j.nf,ee);break}}break;case"column":if(c[c.length-1][0]!=="table")break;if(q=_u(l[0]),q.Hidden&&(q.hidden=!0,delete q.Hidden),q.Width&&(q.wpx=parseInt(q.Width,10)),!L&&q.wpx>10){L=!0,ho=lme;for(var ie=0;ie<H.length;++ie)H[ie]&&hp(H[ie])}L&&hp(q),H[q.Index-1||H.length]=q;for(var Ee=0;Ee<+q.Span;++Ee)H[H.length]=xs(q);break;case"namedrange":if(l[1]==="/")break;O.Names||(O.Names=[]);var te=Rr(l[0]),Ue={Name:te.Name,Ref:Ov(te.RefersTo.slice(1),{r:0,c:0})};O.Sheets.length>0&&(Ue.Sheet=O.Sheets.length-1),O.Names.push(Ue);break;case"namedcell":break;case"b":break;case"i":break;case"u":break;case"s":break;case"em":break;case"h2":break;case"h3":break;case"sub":break;case"sup":break;case"span":break;case"alignment":break;case"borders":break;case"border":break;case"font":if(l[0].slice(-2)==="/>")break;l[1]==="/"?S+=n.slice(I,l.index):I=l.index+l[0].length;break;case"interior":if(!r.cellStyles)break;j.Interior=_u(l[0]);break;case"protection":break;case"author":case"title":case"description":case"created":case"keywords":case"subject":case"category":case"company":case"lastauthor":case"lastsaved":case"lastprinted":case"version":case"revision":case"totaltime":case"hyperlinkbase":case"manager":case"contentstatus":case"identifier":case"language":case"appname":if(l[0].slice(-2)==="/>")break;l[1]==="/"?gyt(F,Y,n.slice(k,l.index)):k=l.index+l[0].length;break;case"paragraphs":break;case"styles":case"workbook":if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"))}else c.push([l[3],!1]);break;case"comment":if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"));WSt(R),C.push(R)}else c.push([l[3],!1]),u=_u(l[0]),R={a:u.Author};break;case"autofilter":if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"))}else if(l[0].charAt(l[0].length-2)!=="/"){var W=_u(l[0]);m["!autofilter"]={ref:Ov(W.Range).replace(/\$/g,"")},c.push([l[3],!0])}break;case"name":break;case"datavalidation":if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"))}else l[0].charAt(l[0].length-2)!=="/"&&c.push([l[3],!0]);break;case"pixelsperinch":break;case"componentoptions":case"documentproperties":case"customdocumentproperties":case"officedocumentsettings":case"pivottable":case"pivotcache":case"names":case"mapinfo":case"pagebreaks":case"querytable":case"sorting":case"schema":case"conditionalformatting":case"smarttagtype":case"smarttags":case"excelworkbook":case"workbookoptions":case"worksheetoptions":if(l[1]==="/"){if((u=c.pop())[0]!==l[3])throw new Error("Bad state: "+u.join("|"))}else l[0].charAt(l[0].length-2)!=="/"&&c.push([l[3],!0]);break;case"null":break;default:if(c.length==0&&l[3]=="document"||c.length==0&&l[3]=="uof")return IY(n,r);var Z=!0;switch(c[c.length-1][0]){case"officedocumentsettings":switch(l[3]){case"allowpng":break;case"removepersonalinformation":break;case"downloadcomponents":break;case"locationofcomponents":break;case"colors":break;case"color":break;case"index":break;case"rgb":break;case"targetscreensize":break;case"readonlyrecommended":break;default:Z=!1}break;case"componentoptions":switch(l[3]){case"toolbar":break;case"hideofficelogo":break;case"spreadsheetautofit":break;case"label":break;case"caption":break;case"maxheight":break;case"maxwidth":break;case"nextsheetnumber":break;default:Z=!1}break;case"excelworkbook":switch(l[3]){case"date1904":O.WBProps.date1904=!0;break;case"windowheight":break;case"windowwidth":break;case"windowtopx":break;case"windowtopy":break;case"tabratio":break;case"protectstructure":break;case"protectwindow":break;case"protectwindows":break;case"activesheet":break;case"displayinknotes":break;case"firstvisiblesheet":break;case"supbook":break;case"sheetname":break;case"sheetindex":break;case"sheetindexfirst":break;case"sheetindexlast":break;case"dll":break;case"acceptlabelsinformulas":break;case"donotsavelinkvalues":break;case"iteration":break;case"maxiterations":break;case"maxchange":break;case"path":break;case"xct":break;case"count":break;case"selectedsheets":break;case"calculation":break;case"uncalced":break;case"startupprompt":break;case"crn":break;case"externname":break;case"formula":break;case"colfirst":break;case"collast":break;case"wantadvise":break;case"boolean":break;case"error":break;case"text":break;case"ole":break;case"noautorecover":break;case"publishobjects":break;case"donotcalculatebeforesave":break;case"number":break;case"refmoder1c1":break;case"embedsavesmarttags":break;default:Z=!1}break;case"workbookoptions":switch(l[3]){case"owcversion":break;case"height":break;case"width":break;default:Z=!1}break;case"worksheetoptions":switch(l[3]){case"visible":if(l[0].slice(-2)!=="/>")if(l[1]==="/")switch(n.slice(k,l.index)){case"SheetHidden":U.Hidden=1;break;case"SheetVeryHidden":U.Hidden=2;break}else k=l.index+l[0].length;break;case"header":m["!margins"]||Z0(m["!margins"]={},"xlml"),isNaN(+Rr(l[0]).Margin)||(m["!margins"].header=+Rr(l[0]).Margin);break;case"footer":m["!margins"]||Z0(m["!margins"]={},"xlml"),isNaN(+Rr(l[0]).Margin)||(m["!margins"].footer=+Rr(l[0]).Margin);break;case"pagemargins":var le=Rr(l[0]);m["!margins"]||Z0(m["!margins"]={},"xlml"),isNaN(+le.Top)||(m["!margins"].top=+le.Top),isNaN(+le.Left)||(m["!margins"].left=+le.Left),isNaN(+le.Right)||(m["!margins"].right=+le.Right),isNaN(+le.Bottom)||(m["!margins"].bottom=+le.Bottom);break;case"displayrighttoleft":O.Views||(O.Views=[]),O.Views[0]||(O.Views[0]={}),O.Views[0].RTL=!0;break;case"freezepanes":break;case"frozennosplit":break;case"splithorizontal":case"splitvertical":break;case"donotdisplaygridlines":break;case"activerow":break;case"activecol":break;case"toprowbottompane":break;case"leftcolumnrightpane":break;case"unsynced":break;case"print":break;case"printerrors":break;case"panes":break;case"scale":break;case"pane":break;case"number":break;case"layout":break;case"pagesetup":break;case"selected":break;case"protectobjects":break;case"enableselection":break;case"protectscenarios":break;case"validprinterinfo":break;case"horizontalresolution":break;case"verticalresolution":break;case"numberofcopies":break;case"activepane":break;case"toprowvisible":break;case"leftcolumnvisible":break;case"fittopage":break;case"rangeselection":break;case"papersizeindex":break;case"pagelayoutzoom":break;case"pagebreakzoom":break;case"filteron":break;case"fitwidth":break;case"fitheight":break;case"commentslayout":break;case"zoom":break;case"lefttoright":break;case"gridlines":break;case"allowsort":break;case"allowfilter":break;case"allowinsertrows":break;case"allowdeleterows":break;case"allowinsertcols":break;case"allowdeletecols":break;case"allowinserthyperlinks":break;case"allowformatcells":break;case"allowsizecols":break;case"allowsizerows":break;case"nosummaryrowsbelowdetail":m["!outline"]||(m["!outline"]={}),m["!outline"].above=!0;break;case"tabcolorindex":break;case"donotdisplayheadings":break;case"showpagelayoutzoom":break;case"nosummarycolumnsrightdetail":m["!outline"]||(m["!outline"]={}),m["!outline"].left=!0;break;case"blackandwhite":break;case"donotdisplayzeros":break;case"displaypagebreak":break;case"rowcolheadings":break;case"donotdisplayoutline":break;case"noorientation":break;case"allowusepivottables":break;case"zeroheight":break;case"viewablerange":break;case"selection":break;case"protectcontents":break;default:Z=!1}break;case"pivottable":case"pivotcache":switch(l[3]){case"immediateitemsondrop":break;case"showpagemultipleitemlabel":break;case"compactrowindent":break;case"location":break;case"pivotfield":break;case"orientation":break;case"layoutform":break;case"layoutsubtotallocation":break;case"layoutcompactrow":break;case"position":break;case"pivotitem":break;case"datatype":break;case"datafield":break;case"sourcename":break;case"parentfield":break;case"ptlineitems":break;case"ptlineitem":break;case"countofsameitems":break;case"item":break;case"itemtype":break;case"ptsource":break;case"cacheindex":break;case"consolidationreference":break;case"filename":break;case"reference":break;case"nocolumngrand":break;case"norowgrand":break;case"blanklineafteritems":break;case"hidden":break;case"subtotal":break;case"basefield":break;case"mapchilditems":break;case"function":break;case"refreshonfileopen":break;case"printsettitles":break;case"mergelabels":break;case"defaultversion":break;case"refreshname":break;case"refreshdate":break;case"refreshdatecopy":break;case"versionlastrefresh":break;case"versionlastupdate":break;case"versionupdateablemin":break;case"versionrefreshablemin":break;case"calculation":break;default:Z=!1}break;case"pagebreaks":switch(l[3]){case"colbreaks":break;case"colbreak":break;case"rowbreaks":break;case"rowbreak":break;case"colstart":break;case"colend":break;case"rowend":break;default:Z=!1}break;case"autofilter":switch(l[3]){case"autofiltercolumn":break;case"autofiltercondition":break;case"autofilterand":break;case"autofilteror":break;default:Z=!1}break;case"querytable":switch(l[3]){case"id":break;case"autoformatfont":break;case"autoformatpattern":break;case"querysource":break;case"querytype":break;case"enableredirections":break;case"refreshedinxl9":break;case"urlstring":break;case"htmltables":break;case"connection":break;case"commandtext":break;case"refreshinfo":break;case"notitles":break;case"nextid":break;case"columninfo":break;case"overwritecells":break;case"donotpromptforfile":break;case"textwizardsettings":break;case"source":break;case"number":break;case"decimal":break;case"thousandseparator":break;case"trailingminusnumbers":break;case"formatsettings":break;case"fieldtype":break;case"delimiters":break;case"tab":break;case"comma":break;case"autoformatname":break;case"versionlastedit":break;case"versionlastrefresh":break;default:Z=!1}break;case"datavalidation":switch(l[3]){case"range":break;case"type":break;case"min":break;case"max":break;case"sort":break;case"descending":break;case"order":break;case"casesensitive":break;case"value":break;case"errorstyle":break;case"errormessage":break;case"errortitle":break;case"inputmessage":break;case"inputtitle":break;case"combohide":break;case"inputhide":break;case"condition":break;case"qualifier":break;case"useblank":break;case"value1":break;case"value2":break;case"format":break;case"cellrangelist":break;default:Z=!1}break;case"sorting":case"conditionalformatting":switch(l[3]){case"range":break;case"type":break;case"min":break;case"max":break;case"sort":break;case"descending":break;case"order":break;case"casesensitive":break;case"value":break;case"errorstyle":break;case"errormessage":break;case"errortitle":break;case"cellrangelist":break;case"inputmessage":break;case"inputtitle":break;case"combohide":break;case"inputhide":break;case"condition":break;case"qualifier":break;case"useblank":break;case"value1":break;case"value2":break;case"format":break;default:Z=!1}break;case"mapinfo":case"schema":case"data":switch(l[3]){case"map":break;case"entry":break;case"range":break;case"xpath":break;case"field":break;case"xsdtype":break;case"filteron":break;case"aggregate":break;case"elementtype":break;case"attributetype":break;case"schema":case"element":case"complextype":case"datatype":case"all":case"attribute":case"extends":break;case"row":break;default:Z=!1}break;case"smarttags":break;default:Z=!1;break}if(Z||l[3].match(/!\[CDATA/))break;if(!c[c.length-1][1])throw"Unrecognized tag: "+l[3]+"|"+c.join("|");if(c[c.length-1][0]==="customdocumentproperties"){if(l[0].slice(-2)==="/>")break;l[1]==="/"?zSt(T,Y,V,n.slice(k,l.index)):(V=l,k=l.index+l[0].length);break}if(r.WTF)throw"Unrecognized tag: "+l[3]+"|"+c.join("|")}var re={};return!r.bookSheets&&!r.bookProps&&(re.Sheets=d),re.SheetNames=f,re.Workbook=O,re.SSF=xs(Nr),re.Props=F,re.Custprops=T,re}function lI(e,t){switch(w7(t=t||{}),t.type||"base64"){case"base64":return RP(ac(e),t);case"binary":case"buffer":case"file":return RP(e,t);case"array":return RP(Ip(e),t)}}function HSt(e,t){var r=[];return e.Props&&r.push(xyt(e.Props,t)),e.Custprops&&r.push(vyt(e.Props,e.Custprops)),r.join("")}function GSt(){return""}function KSt(e,t){var r=['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];return t.cellXfs.forEach(function(n,a){var i=[];i.push(Lt("NumberFormat",null,{"ss:Format":ns(Nr[n.numFmtId])}));var o={"ss:ID":"s"+(21+a)};r.push(Lt("Style",i.join(""),o))}),Lt("Styles",r.join(""))}function Lme(e){return Lt("NamedRange",null,{"ss:Name":e.Name,"ss:RefersTo":"="+m7(e.Ref,{r:0,c:0})})}function YSt(e){if(!((e||{}).Workbook||{}).Names)return"";for(var t=e.Workbook.Names,r=[],n=0;n<t.length;++n){var a=t[n];a.Sheet==null&&(a.Name.match(/^_xlfn\./)||r.push(Lme(a)))}return Lt("Names",r.join(""))}function XSt(e,t,r,n){if(!e||!((n||{}).Workbook||{}).Names)return"";for(var a=n.Workbook.Names,i=[],o=0;o<a.length;++o){var l=a[o];l.Sheet==r&&(l.Name.match(/^_xlfn\./)||i.push(Lme(l)))}return i.join("")}function ZSt(e,t,r,n){if(!e)return"";var a=[];if(e["!margins"]&&(a.push("<PageSetup>"),e["!margins"].header&&a.push(Lt("Header",null,{"x:Margin":e["!margins"].header})),e["!margins"].footer&&a.push(Lt("Footer",null,{"x:Margin":e["!margins"].footer})),a.push(Lt("PageMargins",null,{"x:Bottom":e["!margins"].bottom||"0.75","x:Left":e["!margins"].left||"0.7","x:Right":e["!margins"].right||"0.7","x:Top":e["!margins"].top||"0.75"})),a.push("</PageSetup>")),n&&n.Workbook&&n.Workbook.Sheets&&n.Workbook.Sheets[r])if(n.Workbook.Sheets[r].Hidden)a.push(Lt("Visible",n.Workbook.Sheets[r].Hidden==1?"SheetHidden":"SheetVeryHidden",{}));else{for(var i=0;i<r&&!(n.Workbook.Sheets[i]&&!n.Workbook.Sheets[i].Hidden);++i);i==r&&a.push("<Selected/>")}return((((n||{}).Workbook||{}).Views||[])[0]||{}).RTL&&a.push("<DisplayRightToLeft/>"),e["!protect"]&&(a.push(Yi("ProtectContents","True")),e["!protect"].objects&&a.push(Yi("ProtectObjects","True")),e["!protect"].scenarios&&a.push(Yi("ProtectScenarios","True")),e["!protect"].selectLockedCells!=null&&!e["!protect"].selectLockedCells?a.push(Yi("EnableSelection","NoSelection")):e["!protect"].selectUnlockedCells!=null&&!e["!protect"].selectUnlockedCells&&a.push(Yi("EnableSelection","UnlockedCells")),[["formatCells","AllowFormatCells"],["formatColumns","AllowSizeCols"],["formatRows","AllowSizeRows"],["insertColumns","AllowInsertCols"],["insertRows","AllowInsertRows"],["insertHyperlinks","AllowInsertHyperlinks"],["deleteColumns","AllowDeleteCols"],["deleteRows","AllowDeleteRows"],["sort","AllowSort"],["autoFilter","AllowFilter"],["pivotTables","AllowUsePivotTables"]].forEach(function(o){e["!protect"][o[0]]&&a.push("<"+o[1]+"/>")})),a.length==0?"":Lt("WorksheetOptions",a.join(""),{xmlns:zl.x})}function JSt(e){return e.map(function(t){var r=bvt(t.t||""),n=Lt("ss:Data",r,{xmlns:"http://www.w3.org/TR/REC-html40"});return Lt("Comment",n,{"ss:Author":t.a})}).join("")}function QSt(e,t,r,n,a,i,o){if(!e||e.v==null&&e.f==null)return"";var l={};if(e.f&&(l["ss:Formula"]="="+ns(m7(e.f,o))),e.F&&e.F.slice(0,t.length)==t){var c=Qs(e.F.slice(t.length+1));l["ss:ArrayRange"]="RC:R"+(c.r==o.r?"":"["+(c.r-o.r)+"]")+"C"+(c.c==o.c?"":"["+(c.c-o.c)+"]")}if(e.l&&e.l.Target&&(l["ss:HRef"]=ns(e.l.Target),e.l.Tooltip&&(l["x:HRefScreenTip"]=ns(e.l.Tooltip))),r["!merges"])for(var u=r["!merges"],d=0;d!=u.length;++d)u[d].s.c!=o.c||u[d].s.r!=o.r||(u[d].e.c>u[d].s.c&&(l["ss:MergeAcross"]=u[d].e.c-u[d].s.c),u[d].e.r>u[d].s.r&&(l["ss:MergeDown"]=u[d].e.r-u[d].s.r));var f="",m="";switch(e.t){case"z":if(!n.sheetStubs)return"";break;case"n":f="Number",m=String(e.v);break;case"b":f="Boolean",m=e.v?"1":"0";break;case"e":f="Error",m=Eh[e.v];break;case"d":f="DateTime",m=new Date(e.v).toISOString(),e.z==null&&(e.z=e.z||Nr[14]);break;case"s":f="String",m=yvt(e.v||"");break}var h=Lp(n.cellXfs,e,n);l["ss:StyleID"]="s"+(21+h),l["ss:Index"]=o.c+1;var g=e.v!=null?m:"",p=e.t=="z"?"":'<Data ss:Type="'+f+'">'+g+"</Data>";return(e.c||[]).length>0&&(p+=JSt(e.c)),Lt("Cell",p,l)}function e5t(e,t){var r='<Row ss:Index="'+(e+1)+'"';return t&&(t.hpt&&!t.hpx&&(t.hpx=By(t.hpt)),t.hpx&&(r+=' ss:AutoFitHeight="0" ss:Height="'+t.hpx+'"'),t.hidden&&(r+=' ss:Hidden="1"')),r+">"}function t5t(e,t,r,n){if(!e["!ref"])return"";var a=wn(e["!ref"]),i=e["!merges"]||[],o=0,l=[];e["!cols"]&&e["!cols"].forEach(function(x,v){hp(x);var b=!!x.width,y=hA(v,x),N={"ss:Index":v+1};b&&(N["ss:Width"]=vj(y.width)),x.hidden&&(N["ss:Hidden"]="1"),l.push(Lt("Column",null,N))});for(var c=Array.isArray(e),u=a.s.r;u<=a.e.r;++u){for(var d=[e5t(u,(e["!rows"]||[])[u])],f=a.s.c;f<=a.e.c;++f){var m=!1;for(o=0;o!=i.length;++o)if(!(i[o].s.c>f)&&!(i[o].s.r>u)&&!(i[o].e.c<f)&&!(i[o].e.r<u)){(i[o].s.c!=f||i[o].s.r!=u)&&(m=!0);break}if(!m){var h={r:u,c:f},g=Er(h),p=c?(e[u]||[])[f]:e[g];d.push(QSt(p,g,e,t,r,n,h))}}d.push("</Row>"),d.length>2&&l.push(d.join(""))}return l.join("")}function r5t(e,t,r){var n=[],a=r.SheetNames[e],i=r.Sheets[a],o=i?XSt(i,t,e,r):"";return o.length>0&&n.push("<Names>"+o+"</Names>"),o=i?t5t(i,t,e,r):"",o.length>0&&n.push("<Table>"+o+"</Table>"),n.push(ZSt(i,t,e,r)),n.join("")}function n5t(e,t){t||(t={}),e.SSF||(e.SSF=xs(Nr)),e.SSF&&(D1(),b_(e.SSF),t.revssf=oA(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF,t.cellXfs=[],Lp(t.cellXfs,{},{revssf:{General:0}}));var r=[];r.push(HSt(e,t)),r.push(GSt()),r.push(""),r.push("");for(var n=0;n<e.SheetNames.length;++n)r.push(Lt("Worksheet",r5t(n,t,e),{"ss:Name":ns(e.SheetNames[n])}));return r[2]=KSt(e,t),r[3]=YSt(e),Ra+Lt("Workbook",r.join(""),{xmlns:zl.ss,"xmlns:o":zl.o,"xmlns:x":zl.x,"xmlns:ss":zl.ss,"xmlns:dt":zl.dt,"xmlns:html":zl.html})}function s5t(e){var t={},r=e.content;if(r.l=28,t.AnsiUserType=r.read_shift(0,"lpstr-ansi"),t.AnsiClipboardFormat=Xvt(r),r.length-r.l<=4)return t;var n=r.read_shift(4);if(n==0||n>40||(r.l-=4,t.Reserved1=r.read_shift(0,"lpstr-ansi"),r.length-r.l<=4)||(n=r.read_shift(4),n!==1907505652)||(t.UnicodeClipboardFormat=Zvt(r),n=r.read_shift(4),n==0||n>40))return t;r.l-=4,t.Reserved2=r.read_shift(0,"lpwstr")}var a5t=[60,1084,2066,2165,2175];function i5t(e,t,r,n,a){var i=n,o=[],l=r.slice(r.l,r.l+i);if(a&&a.enc&&a.enc.insitu&&l.length>0)switch(e){case 9:case 521:case 1033:case 2057:case 47:case 405:case 225:case 406:case 312:case 404:case 10:break;case 133:break;default:a.enc.insitu(l)}o.push(l),r.l+=i;for(var c=Yf(r,r.l),u=cI[c],d=0;u!=null&&a5t.indexOf(c)>-1;)i=Yf(r,r.l+2),d=r.l+4,c==2066?d+=4:(c==2165||c==2175)&&(d+=12),l=r.slice(d,r.l+4+i),o.push(l),r.l+=4+i,u=cI[c=Yf(r,r.l)];var f=Ti(o);Ki(f,0);var m=0;f.lens=[];for(var h=0;h<o.length;++h)f.lens.push(m),m+=o[h].length;if(f.length<n)throw"XLS Record 0x"+e.toString(16)+" Truncated: "+f.length+" < "+n;return t.f(f,f.length,a)}function bd(e,t,r){if(e.t!=="z"&&e.XF){var n=0;try{n=e.z||e.XF.numFmtId||0,t.cellNF&&(e.z=Nr[n])}catch(i){if(t.WTF)throw i}if(!t||t.cellText!==!1)try{e.t==="e"?e.w=e.w||Eh[e.v]:n===0||n=="General"?e.t==="n"?(e.v|0)===e.v?e.w=e.v.toString(10):e.w=fj(e.v):e.w=_g(e.v):e.w=ic(n,e.v,{date1904:!!r,dateNF:t&&t.dateNF})}catch(i){if(t.WTF)throw i}if(t.cellDates&&n&&e.t=="n"&&Gg(Nr[n]||String(n))){var a=Dm(e.v);a&&(e.t="d",e.v=new Date(a.y,a.m-1,a.d,a.H,a.M,a.S,a.u))}}}function IS(e,t,r){return{v:e,ixfe:t,t:r}}function o5t(e,t){var r={opts:{}},n={},a=t.dense?[]:{},i={},o={},l=null,c=[],u="",d={},f,m="",h,g,p,x,v={},b=[],y,N,_=[],j=[],S={Sheets:[],WBProps:{date1904:!1},Views:[{}]},I={},P=function(He){return He<8?K0[He]:He<64&&j[He-8]||K0[He]},F=function(He,st,Zt){var _t=st.XF.data;if(!(!_t||!_t.patternType||!Zt||!Zt.cellStyles)){st.s={},st.s.patternType=_t.patternType;var Vt;(Vt=xj(P(_t.icvFore)))&&(st.s.fgColor={rgb:Vt}),(Vt=xj(P(_t.icvBack)))&&(st.s.bgColor={rgb:Vt})}},T=function(He,st,Zt){if(!(K>1)&&!(Zt.sheetRows&&He.r>=Zt.sheetRows)){if(Zt.cellStyles&&st.XF&&st.XF.data&&F(He,st,Zt),delete st.ixfe,delete st.XF,f=He,m=Er(He),(!o||!o.s||!o.e)&&(o={s:{r:0,c:0},e:{r:0,c:0}}),He.r<o.s.r&&(o.s.r=He.r),He.c<o.s.c&&(o.s.c=He.c),He.r+1>o.e.r&&(o.e.r=He.r+1),He.c+1>o.e.c&&(o.e.c=He.c+1),Zt.cellFormula&&st.f){for(var _t=0;_t<b.length;++_t)if(!(b[_t][0].s.c>He.c||b[_t][0].s.r>He.r)&&!(b[_t][0].e.c<He.c||b[_t][0].e.r<He.r)){st.F=nn(b[_t][0]),(b[_t][0].s.c!=He.c||b[_t][0].s.r!=He.r)&&delete st.f,st.f&&(st.f=""+co(b[_t][1],o,He,M,k));break}}Zt.dense?(a[He.r]||(a[He.r]=[]),a[He.r][He.c]=st):a[m]=st}},k={enc:!1,sbcch:0,snames:[],sharedf:v,arrayf:b,rrtabid:[],lastuser:"",biff:8,codepage:0,winlocked:0,cellStyles:!!t&&!!t.cellStyles,WTF:!!t&&!!t.wtf};t.password&&(k.password=t.password);var V,C=[],R=[],H=[],q=[],L=!1,M=[];M.SheetNames=k.snames,M.sharedf=k.sharedf,M.arrayf=k.arrayf,M.names=[],M.XTI=[];var z=0,K=0,E=0,A=[],O=[],U;k.codepage=1200,Uc(1200);for(var Y=!1;e.l<e.length-1;){var J=e.l,se=e.read_shift(2);if(se===0&&z===10)break;var ee=e.l===e.length?0:e.read_shift(2),ie=cI[se];if(ie&&ie.f){if(t.bookSheets&&z===133&&se!==133)break;if(z=se,ie.r===2||ie.r==12){var Ee=e.read_shift(2);if(ee-=2,!k.enc&&Ee!==se&&((Ee&255)<<8|Ee>>8)!==se)throw new Error("rt mismatch: "+Ee+"!="+se);ie.r==12&&(e.l+=10,ee-=10)}var te={};if(se===10?te=ie.f(e,ee,k):te=i5t(se,ie,e,ee,k),K==0&&[9,521,1033,2057].indexOf(z)===-1)continue;switch(se){case 34:r.opts.Date1904=S.WBProps.date1904=te;break;case 134:r.opts.WriteProtect=!0;break;case 47:if(k.enc||(e.l=0),k.enc=te,!t.password)throw new Error("File is password-protected");if(te.valid==null)throw new Error("Encryption scheme unsupported");if(!te.valid)throw new Error("Password is incorrect");break;case 92:k.lastuser=te;break;case 66:var Ue=Number(te);switch(Ue){case 21010:Ue=1200;break;case 32768:Ue=1e4;break;case 32769:Ue=1252;break}Uc(k.codepage=Ue),Y=!0;break;case 317:k.rrtabid=te;break;case 25:k.winlocked=te;break;case 439:r.opts.RefreshAll=te;break;case 12:r.opts.CalcCount=te;break;case 16:r.opts.CalcDelta=te;break;case 17:r.opts.CalcIter=te;break;case 13:r.opts.CalcMode=te;break;case 14:r.opts.CalcPrecision=te;break;case 95:r.opts.CalcSaveRecalc=te;break;case 15:k.CalcRefMode=te;break;case 2211:r.opts.FullCalc=te;break;case 129:te.fDialog&&(a["!type"]="dialog"),te.fBelow||((a["!outline"]||(a["!outline"]={})).above=!0),te.fRight||((a["!outline"]||(a["!outline"]={})).left=!0);break;case 224:_.push(te);break;case 430:M.push([te]),M[M.length-1].XTI=[];break;case 35:case 547:M[M.length-1].push(te);break;case 24:case 536:U={Name:te.Name,Ref:co(te.rgce,o,null,M,k)},te.itab>0&&(U.Sheet=te.itab-1),M.names.push(U),M[0]||(M[0]=[],M[0].XTI=[]),M[M.length-1].push(te),te.Name=="_xlnm._FilterDatabase"&&te.itab>0&&te.rgce&&te.rgce[0]&&te.rgce[0][0]&&te.rgce[0][0][0]=="PtgArea3d"&&(O[te.itab-1]={ref:nn(te.rgce[0][0][1][2])});break;case 22:k.ExternCount=te;break;case 23:M.length==0&&(M[0]=[],M[0].XTI=[]),M[M.length-1].XTI=M[M.length-1].XTI.concat(te),M.XTI=M.XTI.concat(te);break;case 2196:if(k.biff<8)break;U!=null&&(U.Comment=te[1]);break;case 18:a["!protect"]=te;break;case 19:te!==0&&k.WTF&&console.error("Password verifier: "+te);break;case 133:i[te.pos]=te,k.snames.push(te.name);break;case 10:{if(--K)break;if(o.e){if(o.e.r>0&&o.e.c>0){if(o.e.r--,o.e.c--,a["!ref"]=nn(o),t.sheetRows&&t.sheetRows<=o.e.r){var W=o.e.r;o.e.r=t.sheetRows-1,a["!fullref"]=a["!ref"],a["!ref"]=nn(o),o.e.r=W}o.e.r++,o.e.c++}C.length>0&&(a["!merges"]=C),R.length>0&&(a["!objects"]=R),H.length>0&&(a["!cols"]=H),q.length>0&&(a["!rows"]=q),S.Sheets.push(I)}u===""?d=a:n[u]=a,a=t.dense?[]:{}}break;case 9:case 521:case 1033:case 2057:{if(k.biff===8&&(k.biff={9:2,521:3,1033:4}[se]||{512:2,768:3,1024:4,1280:5,1536:8,2:2,7:2}[te.BIFFVer]||8),k.biffguess=te.BIFFVer==0,te.BIFFVer==0&&te.dt==4096&&(k.biff=5,Y=!0,Uc(k.codepage=28591)),k.biff==8&&te.BIFFVer==0&&te.dt==16&&(k.biff=2),K++)break;if(a=t.dense?[]:{},k.biff<8&&!Y&&(Y=!0,Uc(k.codepage=t.codepage||1252)),k.biff<5||te.BIFFVer==0&&te.dt==4096){u===""&&(u="Sheet1"),o={s:{r:0,c:0},e:{r:0,c:0}};var Z={pos:e.l-ee,name:u};i[Z.pos]=Z,k.snames.push(u)}else u=(i[J]||{name:""}).name;te.dt==32&&(a["!type"]="chart"),te.dt==64&&(a["!type"]="macro"),C=[],R=[],k.arrayf=b=[],H=[],q=[],L=!1,I={Hidden:(i[J]||{hs:0}).hs,name:u}}break;case 515:case 3:case 2:a["!type"]=="chart"&&(t.dense?(a[te.r]||[])[te.c]:a[Er({c:te.c,r:te.r})])&&++te.c,y={ixfe:te.ixfe,XF:_[te.ixfe]||{},v:te.val,t:"n"},E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:te.c,r:te.r},y,t);break;case 5:case 517:y={ixfe:te.ixfe,XF:_[te.ixfe],v:te.val,t:te.t},E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:te.c,r:te.r},y,t);break;case 638:y={ixfe:te.ixfe,XF:_[te.ixfe],v:te.rknum,t:"n"},E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:te.c,r:te.r},y,t);break;case 189:for(var le=te.c;le<=te.C;++le){var re=te.rkrec[le-te.c][0];y={ixfe:re,XF:_[re],v:te.rkrec[le-te.c][1],t:"n"},E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:le,r:te.r},y,t)}break;case 6:case 518:case 1030:{if(te.val=="String"){l=te;break}if(y=IS(te.val,te.cell.ixfe,te.tt),y.XF=_[y.ixfe],t.cellFormula){var oe=te.formula;if(oe&&oe[0]&&oe[0][0]&&oe[0][0][0]=="PtgExp"){var fe=oe[0][0][1][0],Fe=oe[0][0][1][1],ge=Er({r:fe,c:Fe});v[ge]?y.f=""+co(te.formula,o,te.cell,M,k):y.F=((t.dense?(a[fe]||[])[Fe]:a[ge])||{}).F}else y.f=""+co(te.formula,o,te.cell,M,k)}E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T(te.cell,y,t),l=te}break;case 7:case 519:if(l)l.val=te,y=IS(te,l.cell.ixfe,"s"),y.XF=_[y.ixfe],t.cellFormula&&(y.f=""+co(l.formula,o,l.cell,M,k)),E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T(l.cell,y,t),l=null;else throw new Error("String record expects Formula");break;case 33:case 545:{b.push(te);var pe=Er(te[0].s);if(h=t.dense?(a[te[0].s.r]||[])[te[0].s.c]:a[pe],t.cellFormula&&h){if(!l||!pe||!h)break;h.f=""+co(te[1],o,te[0],M,k),h.F=nn(te[0])}}break;case 1212:{if(!t.cellFormula)break;if(m){if(!l)break;v[Er(l.cell)]=te[0],h=t.dense?(a[l.cell.r]||[])[l.cell.c]:a[Er(l.cell)],(h||{}).f=""+co(te[0],o,f,M,k)}}break;case 253:y=IS(c[te.isst].t,te.ixfe,"s"),c[te.isst].h&&(y.h=c[te.isst].h),y.XF=_[y.ixfe],E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:te.c,r:te.r},y,t);break;case 513:t.sheetStubs&&(y={ixfe:te.ixfe,XF:_[te.ixfe],t:"z"},E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:te.c,r:te.r},y,t));break;case 190:if(t.sheetStubs)for(var Ie=te.c;Ie<=te.C;++Ie){var Ge=te.ixfe[Ie-te.c];y={ixfe:Ge,XF:_[Ge],t:"z"},E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:Ie,r:te.r},y,t)}break;case 214:case 516:case 4:y=IS(te.val,te.ixfe,"s"),y.XF=_[y.ixfe],E>0&&(y.z=A[y.ixfe>>8&63]),bd(y,t,r.opts.Date1904),T({c:te.c,r:te.r},y,t);break;case 0:case 512:K===1&&(o=te);break;case 252:c=te;break;case 1054:if(k.biff==4){A[E++]=te[1];for(var we=0;we<E+163&&Nr[we]!=te[1];++we);we>=163&&Gd(te[1],E+163)}else Gd(te[1],te[0]);break;case 30:{A[E++]=te;for(var _e=0;_e<E+163&&Nr[_e]!=te;++_e);_e>=163&&Gd(te,E+163)}break;case 229:C=C.concat(te);break;case 93:R[te.cmo[0]]=k.lastobj=te;break;case 438:k.lastobj.TxO=te;break;case 127:k.lastobj.ImData=te;break;case 440:for(x=te[0].s.r;x<=te[0].e.r;++x)for(p=te[0].s.c;p<=te[0].e.c;++p)h=t.dense?(a[x]||[])[p]:a[Er({c:p,r:x})],h&&(h.l=te[1]);break;case 2048:for(x=te[0].s.r;x<=te[0].e.r;++x)for(p=te[0].s.c;p<=te[0].e.c;++p)h=t.dense?(a[x]||[])[p]:a[Er({c:p,r:x})],h&&h.l&&(h.l.Tooltip=te[1]);break;case 28:{if(k.biff<=5&&k.biff>=2)break;h=t.dense?(a[te[0].r]||[])[te[0].c]:a[Er(te[0])];var qe=R[te[2]];h||(t.dense?(a[te[0].r]||(a[te[0].r]=[]),h=a[te[0].r][te[0].c]={t:"z"}):h=a[Er(te[0])]={t:"z"},o.e.r=Math.max(o.e.r,te[0].r),o.s.r=Math.min(o.s.r,te[0].r),o.e.c=Math.max(o.e.c,te[0].c),o.s.c=Math.min(o.s.c,te[0].c)),h.c||(h.c=[]),g={a:te[1],t:qe.TxO.t},h.c.push(g)}break;case 2173:Ywt(_[te.ixfe],te.ext);break;case 125:{if(!k.cellStyles)break;for(;te.e>=te.s;)H[te.e--]={width:te.w/256,level:te.level||0,hidden:!!(te.flags&1)},L||(L=!0,d7(te.w/256)),hp(H[te.e+1])}break;case 520:{var Re={};te.level!=null&&(q[te.r]=Re,Re.level=te.level),te.hidden&&(q[te.r]=Re,Re.hidden=!0),te.hpt&&(q[te.r]=Re,Re.hpt=te.hpt,Re.hpx=By(te.hpt))}break;case 38:case 39:case 40:case 41:a["!margins"]||Z0(a["!margins"]={}),a["!margins"][{38:"left",39:"right",40:"top",41:"bottom"}[se]]=te;break;case 161:a["!margins"]||Z0(a["!margins"]={}),a["!margins"].header=te.header,a["!margins"].footer=te.footer;break;case 574:te.RTL&&(S.Views[0].RTL=!0);break;case 146:j=te;break;case 2198:V=te;break;case 140:N=te;break;case 442:u?I.CodeName=te||I.name:S.WBProps.CodeName=te||"ThisWorkbook";break}}else ie||console.error("Missing Info for XLS Record 0x"+se.toString(16)),e.l+=ee}return r.SheetNames=wa(i).sort(function(Me,He){return Number(Me)-Number(He)}).map(function(Me){return i[Me].name}),t.bookSheets||(r.Sheets=n),!r.SheetNames.length&&d["!ref"]?(r.SheetNames.push("Sheet1"),r.Sheets&&(r.Sheets.Sheet1=d)):r.Preamble=d,r.Sheets&&O.forEach(function(Me,He){r.Sheets[r.SheetNames[He]]["!autofilter"]=Me}),r.Strings=c,r.SSF=xs(Nr),k.enc&&(r.Encryption=k.enc),V&&(r.Themes=V),r.Metadata={},N!==void 0&&(r.Metadata.Country=N),M.names.length>0&&(S.Names=M.names),r.Workbook=S,r}var $w={SI:"e0859ff2f94f6810ab9108002b27b3d9",DSI:"02d5cdd59c2e1b10939708002b2cf9ae",UDI:"05d5cdd59c2e1b10939708002b2cf9ae"};function l5t(e,t,r){var n=vr.find(e,"/!DocumentSummaryInformation");if(n&&n.size>0)try{var a=uY(n,rI,$w.DSI);for(var i in a)t[i]=a[i]}catch(u){if(r.WTF)throw u}var o=vr.find(e,"/!SummaryInformation");if(o&&o.size>0)try{var l=uY(o,nI,$w.SI);for(var c in l)t[c]==null&&(t[c]=l[c])}catch(u){if(r.WTF)throw u}t.HeadingPairs&&t.TitlesOfParts&&(Ihe(t.HeadingPairs,t.TitlesOfParts,t,r),delete t.HeadingPairs,delete t.TitlesOfParts)}function c5t(e,t){var r=[],n=[],a=[],i=0,o,l=BK(rI,"n"),c=BK(nI,"n");if(e.Props)for(o=wa(e.Props),i=0;i<o.length;++i)(Object.prototype.hasOwnProperty.call(l,o[i])?r:Object.prototype.hasOwnProperty.call(c,o[i])?n:a).push([o[i],e.Props[o[i]]]);if(e.Custprops)for(o=wa(e.Custprops),i=0;i<o.length;++i)Object.prototype.hasOwnProperty.call(e.Props||{},o[i])||(Object.prototype.hasOwnProperty.call(l,o[i])?r:Object.prototype.hasOwnProperty.call(c,o[i])?n:a).push([o[i],e.Custprops[o[i]]]);var u=[];for(i=0;i<a.length;++i)zhe.indexOf(a[i][0])>-1||Dhe.indexOf(a[i][0])>-1||a[i][1]!=null&&u.push(a[i]);n.length&&vr.utils.cfb_add(t,"/SummaryInformation",dY(n,$w.SI,c,nI)),(r.length||u.length)&&vr.utils.cfb_add(t,"/DocumentSummaryInformation",dY(r,$w.DSI,l,rI,u.length?u:null,$w.UDI))}function y7(e,t){t||(t={}),w7(t),aA(),t.codepage&&sA(t.codepage);var r,n;if(e.FullPaths){if(vr.find(e,"/encryption"))throw new Error("File is password-protected");r=vr.find(e,"!CompObj"),n=vr.find(e,"/Workbook")||vr.find(e,"/Book")}else{switch(t.type){case"base64":e=Wl(ac(e));break;case"binary":e=Wl(e);break;case"buffer":break;case"array":Array.isArray(e)||(e=Array.prototype.slice.call(e));break}Ki(e,0),n={content:e}}var a,i;if(r&&s5t(r),t.bookProps&&!t.bookSheets)a={};else{var o=fn?"buffer":"array";if(n&&n.content)a=o5t(n.content,t);else if((i=vr.find(e,"PerfectOffice_MAIN"))&&i.content)a=X0.to_workbook(i.content,(t.type=o,t));else if((i=vr.find(e,"NativeContent_MAIN"))&&i.content)a=X0.to_workbook(i.content,(t.type=o,t));else throw(i=vr.find(e,"MN0"))&&i.content?new Error("Unsupported Works 4 for Mac file"):new Error("Cannot find Workbook stream");t.bookVBA&&e.FullPaths&&vr.find(e,"/_VBA_PROJECT_CUR/VBA/dir")&&(a.vbaraw=_2t(e))}var l={};return e.FullPaths&&l5t(e,l,t),a.Props=a.Custprops=l,t.bookFiles&&(a.cfb=e),a}function u5t(e,t){var r=t||{},n=vr.utils.cfb_new({root:"R"}),a="/Workbook";switch(r.bookType||"xls"){case"xls":r.bookType="biff8";case"xla":r.bookType||(r.bookType="xla");case"biff8":a="/Workbook",r.biff=8;break;case"biff5":a="/Book",r.biff=5;break;default:throw new Error("invalid type "+r.bookType+" for XLS CFB")}return vr.utils.cfb_add(n,a,Fme(e,r)),r.biff==8&&(e.Props||e.Custprops)&&c5t(e,n),r.biff==8&&e.vbaraw&&N2t(n,vr.read(e.vbaraw,{type:typeof e.vbaraw=="string"?"binary":"buffer"})),n}var wj={0:{f:R_t},1:{f:q_t},2:{f:lNt},3:{f:Z_t},4:{f:G_t},5:{f:aNt},6:{f:hNt},7:{f:tNt},8:{f:bNt},9:{f:yNt},10:{f:xNt},11:{f:vNt},12:{f:W_t},13:{f:uNt},14:{f:Q_t},15:{f:Y_t},16:{f:Eme},17:{f:pNt},18:{f:nNt},19:{f:t7},20:{},21:{},22:{},23:{},24:{},25:{},26:{},27:{},28:{},29:{},30:{},31:{},32:{},33:{},34:{},35:{T:1},36:{T:-1},37:{T:1},38:{T:-1},39:{f:mSt},40:{},42:{},43:{f:hwt},44:{f:dwt},45:{f:gwt},46:{f:vwt},47:{f:xwt},48:{},49:{f:Mvt},50:{},51:{f:Jwt},52:{T:1},53:{T:-1},54:{T:1},55:{T:-1},56:{T:1},57:{T:-1},58:{},59:{},60:{f:Jhe},62:{f:fNt},63:{f:o2t},64:{f:LNt},65:{},66:{},67:{},68:{},69:{},70:{},128:{},129:{T:1},130:{T:-1},131:{T:1,f:bo,p:0},132:{T:-1},133:{T:1},134:{T:-1},135:{T:1},136:{T:-1},137:{T:1,f:ONt},138:{T:-1},139:{T:1},140:{T:-1},141:{T:1},142:{T:-1},143:{T:1},144:{T:-1},145:{T:1},146:{T:-1},147:{f:z_t},148:{f:M_t,p:16},151:{f:kNt},152:{},153:{f:dSt},154:{},155:{},156:{f:cSt},157:{},158:{},159:{T:1,f:Ebt},160:{T:-1},161:{T:1,f:Jg},162:{T:-1},163:{T:1},164:{T:-1},165:{T:1},166:{T:-1},167:{},168:{},169:{},170:{},171:{},172:{T:1},173:{T:-1},174:{},175:{},176:{f:wNt},177:{T:1},178:{T:-1},179:{T:1},180:{T:-1},181:{T:1},182:{T:-1},183:{T:1},184:{T:-1},185:{T:1},186:{T:-1},187:{T:1},188:{T:-1},189:{T:1},190:{T:-1},191:{T:1},192:{T:-1},193:{T:1},194:{T:-1},195:{T:1},196:{T:-1},197:{T:1},198:{T:-1},199:{T:1},200:{T:-1},201:{T:1},202:{T:-1},203:{T:1},204:{T:-1},205:{T:1},206:{T:-1},207:{T:1},208:{T:-1},209:{T:1},210:{T:-1},211:{T:1},212:{T:-1},213:{T:1},214:{T:-1},215:{T:1},216:{T:-1},217:{T:1},218:{T:-1},219:{T:1},220:{T:-1},221:{T:1},222:{T:-1},223:{T:1},224:{T:-1},225:{T:1},226:{T:-1},227:{T:1},228:{T:-1},229:{T:1},230:{T:-1},231:{T:1},232:{T:-1},233:{T:1},234:{T:-1},235:{T:1},236:{T:-1},237:{T:1},238:{T:-1},239:{T:1},240:{T:-1},241:{T:1},242:{T:-1},243:{T:1},244:{T:-1},245:{T:1},246:{T:-1},247:{T:1},248:{T:-1},249:{T:1},250:{T:-1},251:{T:1},252:{T:-1},253:{T:1},254:{T:-1},255:{T:1},256:{T:-1},257:{T:1},258:{T:-1},259:{T:1},260:{T:-1},261:{T:1},262:{T:-1},263:{T:1},264:{T:-1},265:{T:1},266:{T:-1},267:{T:1},268:{T:-1},269:{T:1},270:{T:-1},271:{T:1},272:{T:-1},273:{T:1},274:{T:-1},275:{T:1},276:{T:-1},277:{},278:{T:1},279:{T:-1},280:{T:1},281:{T:-1},282:{T:1},283:{T:1},284:{T:-1},285:{T:1},286:{T:-1},287:{T:1},288:{T:-1},289:{T:1},290:{T:-1},291:{T:1},292:{T:-1},293:{T:1},294:{T:-1},295:{T:1},296:{T:-1},297:{T:1},298:{T:-1},299:{T:1},300:{T:-1},301:{T:1},302:{T:-1},303:{T:1},304:{T:-1},305:{T:1},306:{T:-1},307:{T:1},308:{T:-1},309:{T:1},310:{T:-1},311:{T:1},312:{T:-1},313:{T:-1},314:{T:1},315:{T:-1},316:{T:1},317:{T:-1},318:{T:1},319:{T:-1},320:{T:1},321:{T:-1},322:{T:1},323:{T:-1},324:{T:1},325:{T:-1},326:{T:1},327:{T:-1},328:{T:1},329:{T:-1},330:{T:1},331:{T:-1},332:{T:1},333:{T:-1},334:{T:1},335:{f:Xwt},336:{T:-1},337:{f:t2t,T:1},338:{T:-1},339:{T:1},340:{T:-1},341:{T:1},342:{T:-1},343:{T:1},344:{T:-1},345:{T:1},346:{T:-1},347:{T:1},348:{T:-1},349:{T:1},350:{T:-1},351:{},352:{},353:{T:1},354:{T:-1},355:{f:tI},357:{},358:{},359:{},360:{T:1},361:{},362:{f:Zhe},363:{},364:{},366:{},367:{},368:{},369:{},370:{},371:{},372:{T:1},373:{T:-1},374:{T:1},375:{T:-1},376:{T:1},377:{T:-1},378:{T:1},379:{T:-1},380:{T:1},381:{T:-1},382:{T:1},383:{T:-1},384:{T:1},385:{T:-1},386:{T:1},387:{T:-1},388:{T:1},389:{T:-1},390:{T:1},391:{T:-1},392:{T:1},393:{T:-1},394:{T:1},395:{T:-1},396:{},397:{},398:{},399:{},400:{},401:{T:1},403:{},404:{},405:{},406:{},407:{},408:{},409:{},410:{},411:{},412:{},413:{},414:{},415:{},416:{},417:{},418:{},419:{},420:{},421:{},422:{T:1},423:{T:1},424:{T:-1},425:{T:-1},426:{f:CNt},427:{f:ENt},428:{},429:{T:1},430:{T:-1},431:{T:1},432:{T:-1},433:{T:1},434:{T:-1},435:{T:1},436:{T:-1},437:{T:1},438:{T:-1},439:{T:1},440:{T:-1},441:{T:1},442:{T:-1},443:{T:1},444:{T:-1},445:{T:1},446:{T:-1},447:{T:1},448:{T:-1},449:{T:1},450:{T:-1},451:{T:1},452:{T:-1},453:{T:1},454:{T:-1},455:{T:1},456:{T:-1},457:{T:1},458:{T:-1},459:{T:1},460:{T:-1},461:{T:1},462:{T:-1},463:{T:1},464:{T:-1},465:{T:1},466:{T:-1},467:{T:1},468:{T:-1},469:{T:1},470:{T:-1},471:{},472:{},473:{T:1},474:{T:-1},475:{},476:{f:TNt},477:{},478:{},479:{T:1},480:{T:-1},481:{T:1},482:{T:-1},483:{T:1},484:{T:-1},485:{f:B_t},486:{T:1},487:{T:-1},488:{T:1},489:{T:-1},490:{T:1},491:{T:-1},492:{T:1},493:{T:-1},494:{f:NNt},495:{T:1},496:{T:-1},497:{T:1},498:{T:-1},499:{},500:{T:1},501:{T:-1},502:{T:1},503:{T:-1},504:{},505:{T:1},506:{T:-1},507:{},508:{T:1},509:{T:-1},510:{T:1},511:{T:-1},512:{},513:{},514:{T:1},515:{T:-1},516:{T:1},517:{T:-1},518:{T:1},519:{T:-1},520:{T:1},521:{T:-1},522:{},523:{},524:{},525:{},526:{},527:{},528:{T:1},529:{T:-1},530:{T:1},531:{T:-1},532:{T:1},533:{T:-1},534:{},535:{},536:{},537:{},538:{T:1},539:{T:-1},540:{T:1},541:{T:-1},542:{T:1},548:{},549:{},550:{f:tI},551:{},552:{},553:{},554:{T:1},555:{T:-1},556:{T:1},557:{T:-1},558:{T:1},559:{T:-1},560:{T:1},561:{T:-1},562:{},564:{},565:{T:1},566:{T:-1},569:{T:1},570:{T:-1},572:{},573:{T:1},574:{T:-1},577:{},578:{},579:{},580:{},581:{},582:{},583:{},584:{},585:{},586:{},587:{},588:{T:-1},589:{},590:{T:1},591:{T:-1},592:{T:1},593:{T:-1},594:{T:1},595:{T:-1},596:{},597:{T:1},598:{T:-1},599:{T:1},600:{T:-1},601:{T:1},602:{T:-1},603:{T:1},604:{T:-1},605:{T:1},606:{T:-1},607:{},608:{T:1},609:{T:-1},610:{},611:{T:1},612:{T:-1},613:{T:1},614:{T:-1},615:{T:1},616:{T:-1},617:{T:1},618:{T:-1},619:{T:1},620:{T:-1},625:{},626:{T:1},627:{T:-1},628:{T:1},629:{T:-1},630:{T:1},631:{T:-1},632:{f:v2t},633:{T:1},634:{T:-1},635:{T:1,f:g2t},636:{T:-1},637:{f:Uvt},638:{T:1},639:{},640:{T:-1},641:{T:1},642:{T:-1},643:{T:1},644:{},645:{T:-1},646:{T:1},648:{T:1},649:{},650:{T:-1},651:{f:QNt},652:{},653:{T:1},654:{T:-1},655:{T:1},656:{T:-1},657:{T:1},658:{T:-1},659:{},660:{T:1},661:{},662:{T:-1},663:{},664:{T:1},665:{},666:{T:-1},667:{},668:{},669:{},671:{T:1},672:{T:-1},673:{T:1},674:{T:-1},675:{},676:{},677:{},678:{},679:{},680:{},681:{},1024:{},1025:{},1026:{T:1},1027:{T:-1},1028:{T:1},1029:{T:-1},1030:{},1031:{T:1},1032:{T:-1},1033:{T:1},1034:{T:-1},1035:{},1036:{},1037:{},1038:{T:1},1039:{T:-1},1040:{},1041:{T:1},1042:{T:-1},1043:{},1044:{},1045:{},1046:{T:1},1047:{T:-1},1048:{T:1},1049:{T:-1},1050:{},1051:{T:1},1052:{T:1},1053:{f:FNt},1054:{T:1},1055:{},1056:{T:1},1057:{T:-1},1058:{T:1},1059:{T:-1},1061:{},1062:{T:1},1063:{T:-1},1064:{T:1},1065:{T:-1},1066:{T:1},1067:{T:-1},1068:{T:1},1069:{T:-1},1070:{T:1},1071:{T:-1},1072:{T:1},1073:{T:-1},1075:{T:1},1076:{T:-1},1077:{T:1},1078:{T:-1},1079:{T:1},1080:{T:-1},1081:{T:1},1082:{T:-1},1083:{T:1},1084:{T:-1},1085:{},1086:{T:1},1087:{T:-1},1088:{T:1},1089:{T:-1},1090:{T:1},1091:{T:-1},1092:{T:1},1093:{T:-1},1094:{T:1},1095:{T:-1},1096:{},1097:{T:1},1098:{},1099:{T:-1},1100:{T:1},1101:{T:-1},1102:{},1103:{},1104:{},1105:{},1111:{},1112:{},1113:{T:1},1114:{T:-1},1115:{T:1},1116:{T:-1},1117:{},1118:{T:1},1119:{T:-1},1120:{T:1},1121:{T:-1},1122:{T:1},1123:{T:-1},1124:{T:1},1125:{T:-1},1126:{},1128:{T:1},1129:{T:-1},1130:{},1131:{T:1},1132:{T:-1},1133:{T:1},1134:{T:-1},1135:{T:1},1136:{T:-1},1137:{T:1},1138:{T:-1},1139:{T:1},1140:{T:-1},1141:{},1142:{T:1},1143:{T:-1},1144:{T:1},1145:{T:-1},1146:{},1147:{T:1},1148:{T:-1},1149:{T:1},1150:{T:-1},1152:{T:1},1153:{T:-1},1154:{T:-1},1155:{T:-1},1156:{T:-1},1157:{T:1},1158:{T:-1},1159:{T:1},1160:{T:-1},1161:{T:1},1162:{T:-1},1163:{T:1},1164:{T:-1},1165:{T:1},1166:{T:-1},1167:{T:1},1168:{T:-1},1169:{T:1},1170:{T:-1},1171:{},1172:{T:1},1173:{T:-1},1177:{},1178:{T:1},1180:{},1181:{},1182:{},2048:{T:1},2049:{T:-1},2050:{},2051:{T:1},2052:{T:-1},2053:{},2054:{},2055:{T:1},2056:{T:-1},2057:{T:1},2058:{T:-1},2060:{},2067:{},2068:{T:1},2069:{T:-1},2070:{},2071:{},2072:{T:1},2073:{T:-1},2075:{},2076:{},2077:{T:1},2078:{T:-1},2079:{},2080:{T:1},2081:{T:-1},2082:{},2083:{T:1},2084:{T:-1},2085:{T:1},2086:{T:-1},2087:{T:1},2088:{T:-1},2089:{T:1},2090:{T:-1},2091:{},2092:{},2093:{T:1},2094:{T:-1},2095:{},2096:{T:1},2097:{T:-1},2098:{T:1},2099:{T:-1},2100:{T:1},2101:{T:-1},2102:{},2103:{T:1},2104:{T:-1},2105:{},2106:{T:1},2107:{T:-1},2108:{},2109:{T:1},2110:{T:-1},2111:{T:1},2112:{T:-1},2113:{T:1},2114:{T:-1},2115:{},2116:{},2117:{},2118:{T:1},2119:{T:-1},2120:{},2121:{T:1},2122:{T:-1},2123:{T:1},2124:{T:-1},2125:{},2126:{T:1},2127:{T:-1},2128:{},2129:{T:1},2130:{T:-1},2131:{T:1},2132:{T:-1},2133:{T:1},2134:{},2135:{},2136:{},2137:{T:1},2138:{T:-1},2139:{T:1},2140:{T:-1},2141:{},3072:{},3073:{},4096:{T:1},4097:{T:-1},5002:{T:1},5003:{T:-1},5081:{T:1},5082:{T:-1},5083:{},5084:{T:1},5085:{T:-1},5086:{T:1},5087:{T:-1},5088:{},5089:{},5090:{},5092:{T:1},5093:{T:-1},5094:{},5095:{T:1},5096:{T:-1},5097:{},5099:{},65535:{n:""}},cI={6:{f:DP},10:{f:em},12:{f:Va},13:{f:Va},14:{f:Ca},15:{f:Ca},16:{f:mo},17:{f:Ca},18:{f:Ca},19:{f:Va},20:{f:xY},21:{f:xY},23:{f:Zhe},24:{f:yY},25:{f:Ca},26:{},27:{},28:{f:F1t},29:{},34:{f:Ca},35:{f:vY},38:{f:mo},39:{f:mo},40:{f:mo},41:{f:mo},42:{f:Ca},43:{f:Ca},47:{f:Ybt},49:{f:u1t},51:{f:Va},60:{},61:{f:a1t},64:{f:Ca},65:{f:c1t},66:{f:Va},77:{},80:{},81:{},82:{},85:{f:Va},89:{},90:{},91:{},92:{f:Kyt},93:{f:B1t},94:{},95:{f:Ca},96:{},97:{},99:{f:Ca},125:{f:Jhe},128:{f:S1t},129:{f:Xyt},130:{f:Va},131:{f:Ca},132:{f:Ca},133:{f:Zyt},134:{},140:{f:K1t},141:{f:Va},144:{},146:{f:Z1t},151:{},152:{},153:{},154:{},155:{},156:{f:Va},157:{},158:{},160:{f:sbt},161:{f:ebt},174:{},175:{},176:{},177:{},178:{},180:{},181:{},182:{},184:{},185:{},189:{f:w1t},190:{f:j1t},193:{f:em},197:{},198:{},199:{},200:{},201:{},202:{f:Ca},203:{},204:{},205:{},206:{},207:{},208:{},209:{},210:{},211:{},213:{},215:{},216:{},217:{},218:{f:Va},220:{},221:{f:Ca},222:{},224:{f:N1t},225:{f:Gyt},226:{f:em},227:{},229:{f:M1t},233:{},235:{},236:{},237:{},239:{},240:{},241:{},242:{},244:{},245:{},246:{},247:{},248:{},249:{},251:{},252:{f:Qyt},253:{f:f1t},255:{f:t1t},256:{},259:{},290:{},311:{},312:{},315:{},317:{f:Uhe},318:{},319:{},320:{},330:{},331:{},333:{},334:{},335:{},336:{},337:{},338:{},339:{},340:{},351:{},352:{f:Ca},353:{f:em},401:{},402:{},403:{},404:{},405:{},406:{},407:{},408:{},425:{},426:{},427:{},428:{},429:{},430:{f:T1t},431:{f:Ca},432:{},433:{},434:{},437:{},438:{f:q1t},439:{f:Ca},440:{f:V1t},441:{},442:{f:__},443:{},444:{f:Va},445:{},446:{},448:{f:em},449:{f:s1t,r:2},450:{f:em},512:{f:mY},513:{f:nbt},515:{f:E1t},516:{f:m1t},517:{f:gY},519:{f:abt},520:{f:r1t},523:{},545:{f:bY},549:{f:hY},566:{},574:{f:o1t},638:{f:b1t},659:{},1048:{},1054:{f:g1t},1084:{},1212:{f:I1t},2048:{f:H1t},2049:{},2050:{},2051:{},2052:{},2053:{},2054:{},2055:{},2056:{},2057:{f:PS},2058:{},2059:{},2060:{},2061:{},2062:{},2063:{},2064:{},2066:{},2067:{},2128:{},2129:{},2130:{},2131:{},2132:{},2133:{},2134:{},2135:{},2136:{},2137:{},2138:{},2146:{},2147:{r:12},2148:{},2149:{},2150:{},2151:{f:em},2152:{},2154:{},2155:{},2156:{},2161:{},2162:{},2164:{},2165:{},2166:{},2167:{},2168:{},2169:{},2170:{},2171:{},2172:{f:J1t,r:12},2173:{f:Kwt,r:12},2174:{},2175:{},2180:{},2181:{},2182:{},2183:{},2184:{},2185:{},2186:{},2187:{},2188:{f:Ca,r:12},2189:{},2190:{r:12},2191:{},2192:{},2194:{},2195:{},2196:{f:D1t,r:12},2197:{},2198:{f:Uwt,r:12},2199:{},2200:{},2201:{},2202:{f:R1t,r:12},2203:{f:em},2204:{},2205:{},2206:{},2207:{},2211:{f:n1t},2212:{},2213:{},2214:{},2215:{},4097:{},4098:{},4099:{},4102:{},4103:{},4105:{},4106:{},4107:{},4108:{},4109:{},4116:{},4117:{},4118:{},4119:{},4120:{},4121:{},4122:{},4123:{},4124:{},4125:{},4126:{},4127:{},4128:{},4129:{},4130:{},4132:{},4133:{},4134:{f:Va},4135:{},4146:{},4147:{},4148:{},4149:{},4154:{},4156:{},4157:{},4158:{},4159:{},4160:{},4161:{},4163:{},4164:{f:tbt},4165:{},4166:{},4168:{},4170:{},4171:{},4174:{},4175:{},4176:{},4177:{},4187:{},4188:{f:X1t},4189:{},4191:{},4192:{},4193:{},4194:{},4195:{},4196:{},4197:{},4198:{},4199:{},4200:{},0:{f:mY},1:{},2:{f:ubt},3:{f:lbt},4:{f:obt},5:{f:gY},7:{f:fbt},8:{},9:{f:PS},11:{},22:{f:Va},30:{f:v1t},31:{},32:{},33:{f:bY},36:{},37:{f:hY},50:{f:hbt},62:{},52:{},67:{},68:{f:Va},69:{},86:{},126:{},127:{f:ibt},135:{},136:{},137:{},145:{},148:{},149:{},150:{},169:{},171:{},188:{},191:{},192:{},194:{},195:{},214:{f:mbt},223:{},234:{},354:{},421:{},518:{f:DP},521:{f:PS},536:{f:yY},547:{f:vY},561:{},579:{},1030:{f:DP},1033:{f:PS},1091:{},2157:{},2163:{},2177:{},2240:{},2241:{},2242:{},2243:{},2244:{},2245:{},2246:{},2247:{},2248:{},2249:{},2250:{},2251:{},2262:{r:12},29282:{}};function Ft(e,t,r,n){var a=t;if(!isNaN(a)){var i=n||(r||[]).length||0,o=e.next(4);o.write_shift(2,a),o.write_shift(2,i),i>0&&JM(r)&&e.push(r)}}function d5t(e,t,r,n){var a=(r||[]).length||0;if(a<=8224)return Ft(e,t,r,a);var i=t;if(!isNaN(i)){for(var o=r.parts||[],l=0,c=0,u=0;u+(o[l]||8224)<=8224;)u+=o[l]||8224,l++;var d=e.next(4);for(d.write_shift(2,i),d.write_shift(2,u),e.push(r.slice(c,c+u)),c+=u;c<a;){for(d=e.next(4),d.write_shift(2,60),u=0;u+(o[l]||8224)<=8224;)u+=o[l]||8224,l++;d.write_shift(2,u),e.push(r.slice(c,c+u)),c+=u}}}function C_(e,t,r){return e||(e=lt(7)),e.write_shift(2,t),e.write_shift(2,r),e.write_shift(2,0),e.write_shift(1,0),e}function f5t(e,t,r,n){var a=lt(9);return C_(a,e,t),qhe(r,n||"b",a),a}function h5t(e,t,r){var n=lt(8+2*r.length);return C_(n,e,t),n.write_shift(1,r.length),n.write_shift(r.length,r,"sbcs"),n.l<n.length?n.slice(0,n.l):n}function m5t(e,t,r,n){if(t.v!=null)switch(t.t){case"d":case"n":var a=t.t=="d"?yi(Us(t.v)):t.v;a==(a|0)&&a>=0&&a<65536?Ft(e,2,dbt(r,n,a)):Ft(e,3,cbt(r,n,a));return;case"b":case"e":Ft(e,5,f5t(r,n,t.v,t.t));return;case"s":case"str":Ft(e,4,h5t(r,n,(t.v||"").slice(0,255)));return}Ft(e,1,C_(null,r,n))}function p5t(e,t,r,n){var a=Array.isArray(t),i=wn(t["!ref"]||"A1"),o,l="",c=[];if(i.e.c>255||i.e.r>16383){if(n.WTF)throw new Error("Range "+(t["!ref"]||"A1")+" exceeds format limit A1:IV16384");i.e.c=Math.min(i.e.c,255),i.e.r=Math.min(i.e.c,16383),o=nn(i)}for(var u=i.s.r;u<=i.e.r;++u){l=va(u);for(var d=i.s.c;d<=i.e.c;++d){u===i.s.r&&(c[d]=zs(d)),o=c[d]+l;var f=a?(t[u]||[])[d]:t[o];f&&m5t(e,f,u,d)}}}function g5t(e,t){for(var r=t||{},n=gl(),a=0,i=0;i<e.SheetNames.length;++i)e.SheetNames[i]==r.sheet&&(a=i);if(a==0&&r.sheet&&e.SheetNames[0]!=r.sheet)throw new Error("Sheet not found: "+r.sheet);return Ft(n,r.biff==4?1033:r.biff==3?521:9,l7(e,16,r)),p5t(n,e.Sheets[e.SheetNames[a]],a,r),Ft(n,10),n.end()}function x5t(e,t,r){Ft(e,49,d1t({sz:12,name:"Arial"},r))}function v5t(e,t,r){t&&[[5,8],[23,26],[41,44],[50,392]].forEach(function(n){for(var a=n[0];a<=n[1];++a)t[a]!=null&&Ft(e,1054,x1t(a,t[a],r))})}function y5t(e,t){var r=lt(19);r.write_shift(4,2151),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(2,3),r.write_shift(1,1),r.write_shift(4,0),Ft(e,2151,r),r=lt(39),r.write_shift(4,2152),r.write_shift(4,0),r.write_shift(4,0),r.write_shift(2,3),r.write_shift(1,0),r.write_shift(4,0),r.write_shift(2,1),r.write_shift(4,4),r.write_shift(2,0),Khe(wn(t["!ref"]||"A1"),r),r.write_shift(4,4),Ft(e,2152,r)}function b5t(e,t){for(var r=0;r<16;++r)Ft(e,224,pY({numFmtId:0,style:!0},0,t));t.cellXfs.forEach(function(n){Ft(e,224,pY(n,0,t))})}function w5t(e,t){for(var r=0;r<t["!links"].length;++r){var n=t["!links"][r];Ft(e,440,W1t(n)),n[1].Tooltip&&Ft(e,2048,G1t(n))}delete t["!links"]}function j5t(e,t){if(t){var r=0;t.forEach(function(n,a){++r<=256&&n&&Ft(e,125,Q1t(hA(a,n),a))})}}function _5t(e,t,r,n,a){var i=16+Lp(a.cellXfs,t,a);if(t.v==null&&!t.bf){Ft(e,513,Cg(r,n,i));return}if(t.bf)Ft(e,6,Xjt(t,r,n,a,i));else switch(t.t){case"d":case"n":var o=t.t=="d"?yi(Us(t.v)):t.v;Ft(e,515,A1t(r,n,o,i));break;case"b":case"e":Ft(e,517,C1t(r,n,t.v,i,a,t.t));break;case"s":case"str":if(a.bookSST){var l=g7(a.Strings,t.v,a.revStrings);Ft(e,253,h1t(r,n,l,i))}else Ft(e,516,p1t(r,n,(t.v||"").slice(0,255),i,a));break;default:Ft(e,513,Cg(r,n,i))}}function N5t(e,t,r){var n=gl(),a=r.SheetNames[e],i=r.Sheets[a]||{},o=(r||{}).Workbook||{},l=(o.Sheets||[])[e]||{},c=Array.isArray(i),u=t.biff==8,d,f="",m=[],h=wn(i["!ref"]||"A1"),g=u?65536:16384;if(h.e.c>255||h.e.r>=g){if(t.WTF)throw new Error("Range "+(i["!ref"]||"A1")+" exceeds format limit A1:IV16384");h.e.c=Math.min(h.e.c,255),h.e.r=Math.min(h.e.c,g-1)}Ft(n,2057,l7(r,16,t)),Ft(n,13,Cc(1)),Ft(n,12,Cc(100)),Ft(n,15,Io(!0)),Ft(n,17,Io(!1)),Ft(n,16,Sg(.001)),Ft(n,95,Io(!0)),Ft(n,42,Io(!1)),Ft(n,43,Io(!1)),Ft(n,130,Cc(1)),Ft(n,128,k1t()),Ft(n,131,Io(!1)),Ft(n,132,Io(!1)),u&&j5t(n,i["!cols"]),Ft(n,512,y1t(h,t)),u&&(i["!links"]=[]);for(var p=h.s.r;p<=h.e.r;++p){f=va(p);for(var x=h.s.c;x<=h.e.c;++x){p===h.s.r&&(m[x]=zs(x)),d=m[x]+f;var v=c?(i[p]||[])[x]:i[d];v&&(_5t(n,v,p,x,t),u&&v.l&&i["!links"].push([d,v.l]))}}var b=l.CodeName||l.name||a;return u&&Ft(n,574,l1t((o.Views||[])[0])),u&&(i["!merges"]||[]).length&&Ft(n,229,$1t(i["!merges"])),u&&w5t(n,i),Ft(n,442,Vhe(b)),u&&y5t(n,i),Ft(n,10),n.end()}function S5t(e,t,r){var n=gl(),a=(e||{}).Workbook||{},i=a.Sheets||[],o=a.WBProps||{},l=r.biff==8,c=r.biff==5;if(Ft(n,2057,l7(e,5,r)),r.bookType=="xla"&&Ft(n,135),Ft(n,225,l?Cc(1200):null),Ft(n,193,Cyt(2)),c&&Ft(n,191),c&&Ft(n,192),Ft(n,226),Ft(n,92,Yyt("SheetJS",r)),Ft(n,66,Cc(l?1200:1252)),l&&Ft(n,353,Cc(0)),l&&Ft(n,448),Ft(n,317,rbt(e.SheetNames.length)),l&&e.vbaraw&&Ft(n,211),l&&e.vbaraw){var u=o.CodeName||"ThisWorkbook";Ft(n,442,Vhe(u))}Ft(n,156,Cc(17)),Ft(n,25,Io(!1)),Ft(n,18,Io(!1)),Ft(n,19,Cc(0)),l&&Ft(n,431,Io(!1)),l&&Ft(n,444,Cc(0)),Ft(n,61,i1t()),Ft(n,64,Io(!1)),Ft(n,141,Cc(0)),Ft(n,34,Io(sSt(e)=="true")),Ft(n,14,Io(!0)),l&&Ft(n,439,Io(!1)),Ft(n,218,Cc(0)),x5t(n,e,r),v5t(n,e.SSF,r),b5t(n,r),l&&Ft(n,352,Io(!1));var d=n.end(),f=gl();l&&Ft(f,140,Y1t()),l&&r.Strings&&d5t(f,252,e1t(r.Strings)),Ft(f,10);var m=f.end(),h=gl(),g=0,p=0;for(p=0;p<e.SheetNames.length;++p)g+=(l?12:11)+(l?2:1)*e.SheetNames[p].length;var x=d.length+g+m.length;for(p=0;p<e.SheetNames.length;++p){var v=i[p]||{};Ft(h,133,Jyt({pos:x,hs:v.Hidden||0,dt:0,name:e.SheetNames[p]},r)),x+=t[p].length}var b=h.end();if(g!=b.length)throw new Error("BS8 "+g+" != "+b.length);var y=[];return d.length&&y.push(d),b.length&&y.push(b),m.length&&y.push(m),Ti(y)}function k5t(e,t){var r=t||{},n=[];e&&!e.SSF&&(e.SSF=xs(Nr)),e&&e.SSF&&(D1(),b_(e.SSF),r.revssf=oA(e.SSF),r.revssf[e.SSF[65535]]=0,r.ssf=e.SSF),r.Strings=[],r.Strings.Count=0,r.Strings.Unique=0,j7(r),r.cellXfs=[],Lp(r.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={});for(var a=0;a<e.SheetNames.length;++a)n[n.length]=N5t(a,r,e);return n.unshift(S5t(e,n,r)),Ti(n)}function Fme(e,t){for(var r=0;r<=e.SheetNames.length;++r){var n=e.Sheets[e.SheetNames[r]];if(!(!n||!n["!ref"])){var a=Go(n["!ref"]);a.e.c>255&&typeof console<"u"&&console.error&&console.error("Worksheet '"+e.SheetNames[r]+"' extends beyond column IV (255). Data may be lost.")}}var i=t||{};switch(i.biff||2){case 8:case 5:return k5t(e,t);case 4:case 3:case 2:return g5t(e,t)}throw new Error("invalid type "+i.bookType+" for BIFF")}function TY(e,t){var r=t||{},n=r.dense?[]:{};e=e.replace(/<!--.*?-->/g,"");var a=e.match(/<table/i);if(!a)throw new Error("Invalid HTML: could not find <table>");var i=e.match(/<\/table/i),o=a.index,l=i&&i.index||e.length,c=dvt(e.slice(o,l),/(:?<tr[^>]*>)/i,"<tr>"),u=-1,d=0,f=0,m=0,h={s:{r:1e7,c:1e7},e:{r:0,c:0}},g=[];for(o=0;o<c.length;++o){var p=c[o].trim(),x=p.slice(0,3).toLowerCase();if(x=="<tr"){if(++u,r.sheetRows&&r.sheetRows<=u){--u;break}d=0;continue}if(!(x!="<td"&&x!="<th")){var v=p.split(/<\/t[dh]>/i);for(l=0;l<v.length;++l){var b=v[l].trim();if(b.match(/<t[dh]/i)){for(var y=b,N=0;y.charAt(0)=="<"&&(N=y.indexOf(">"))>-1;)y=y.slice(N+1);for(var _=0;_<g.length;++_){var j=g[_];j.s.c==d&&j.s.r<u&&u<=j.e.r&&(d=j.e.c+1,_=-1)}var S=Rr(b.slice(0,b.indexOf(">")));m=S.colspan?+S.colspan:1,((f=+S.rowspan)>1||m>1)&&g.push({s:{r:u,c:d},e:{r:u+(f||1)-1,c:d+m-1}});var I=S.t||S["data-t"]||"";if(!y.length){d+=m;continue}if(y=dhe(y),h.s.r>u&&(h.s.r=u),h.e.r<u&&(h.e.r=u),h.s.c>d&&(h.s.c=d),h.e.c<d&&(h.e.c=d),!y.length){d+=m;continue}var P={t:"s",v:y};r.raw||!y.trim().length||I=="s"||(y==="TRUE"?P={t:"b",v:!0}:y==="FALSE"?P={t:"b",v:!1}:isNaN(Gu(y))?isNaN(My(y).getDate())||(P={t:"d",v:Us(y)},r.cellDates||(P={t:"n",v:yi(P.v)}),P.z=r.dateNF||Nr[14]):P={t:"n",v:Gu(y)}),r.dense?(n[u]||(n[u]=[]),n[u][d]=P):n[Er({r:u,c:d})]=P,d+=m}}}}return n["!ref"]=nn(h),g.length&&(n["!merges"]=g),n}function Mme(e,t,r,n){for(var a=e["!merges"]||[],i=[],o=t.s.c;o<=t.e.c;++o){for(var l=0,c=0,u=0;u<a.length;++u)if(!(a[u].s.r>r||a[u].s.c>o)&&!(a[u].e.r<r||a[u].e.c<o)){if(a[u].s.r<r||a[u].s.c<o){l=-1;break}l=a[u].e.r-a[u].s.r+1,c=a[u].e.c-a[u].s.c+1;break}if(!(l<0)){var d=Er({r,c:o}),f=n.dense?(e[r]||[])[o]:e[d],m=f&&f.v!=null&&(f.h||WM(f.w||(tf(f),f.w)||""))||"",h={};l>1&&(h.rowspan=l),c>1&&(h.colspan=c),n.editable?m='<span contenteditable="true">'+m+"</span>":f&&(h["data-t"]=f&&f.t||"z",f.v!=null&&(h["data-v"]=f.v),f.z!=null&&(h["data-z"]=f.z),f.l&&(f.l.Target||"#").charAt(0)!="#"&&(m='<a href="'+f.l.Target+'">'+m+"</a>")),h.id=(n.id||"sjs")+"-"+d,i.push(Lt("td",m,h))}}var g="<tr>";return g+i.join("")+"</tr>"}var $me='<html><head><meta charset="utf-8"/><title>SheetJS Table Export</title></head><body>',Bme="</body></html>";function C5t(e,t){var r=e.match(/<table[\s\S]*?>[\s\S]*?<\/table>/gi);if(!r||r.length==0)throw new Error("Invalid HTML: could not find <table>");if(r.length==1)return Rp(TY(r[0],t),t);var n=C7();return r.forEach(function(a,i){E7(n,TY(a,t),"Sheet"+(i+1))}),n}function zme(e,t,r){var n=[];return n.join("")+"<table"+(r&&r.id?' id="'+r.id+'"':"")+">"}function Ume(e,t){var r=t||{},n=r.header!=null?r.header:$me,a=r.footer!=null?r.footer:Bme,i=[n],o=Go(e["!ref"]);r.dense=Array.isArray(e),i.push(zme(e,o,r));for(var l=o.s.r;l<=o.e.r;++l)i.push(Mme(e,o,l,r));return i.push("</table>"+a),i.join("")}function qme(e,t,r){var n=r||{},a=0,i=0;if(n.origin!=null)if(typeof n.origin=="number")a=n.origin;else{var o=typeof n.origin=="string"?Qs(n.origin):n.origin;a=o.r,i=o.c}var l=t.getElementsByTagName("tr"),c=Math.min(n.sheetRows||1e7,l.length),u={s:{r:0,c:0},e:{r:a,c:i}};if(e["!ref"]){var d=Go(e["!ref"]);u.s.r=Math.min(u.s.r,d.s.r),u.s.c=Math.min(u.s.c,d.s.c),u.e.r=Math.max(u.e.r,d.e.r),u.e.c=Math.max(u.e.c,d.e.c),a==-1&&(u.e.r=a=d.e.r+1)}var f=[],m=0,h=e["!rows"]||(e["!rows"]=[]),g=0,p=0,x=0,v=0,b=0,y=0;for(e["!cols"]||(e["!cols"]=[]);g<l.length&&p<c;++g){var N=l[g];if(PY(N)){if(n.display)continue;h[p]={hidden:!0}}var _=N.children;for(x=v=0;x<_.length;++x){var j=_[x];if(!(n.display&&PY(j))){var S=j.hasAttribute("data-v")?j.getAttribute("data-v"):j.hasAttribute("v")?j.getAttribute("v"):dhe(j.innerHTML),I=j.getAttribute("data-z")||j.getAttribute("z");for(m=0;m<f.length;++m){var P=f[m];P.s.c==v+i&&P.s.r<p+a&&p+a<=P.e.r&&(v=P.e.c+1-i,m=-1)}y=+j.getAttribute("colspan")||1,((b=+j.getAttribute("rowspan")||1)>1||y>1)&&f.push({s:{r:p+a,c:v+i},e:{r:p+a+(b||1)-1,c:v+i+(y||1)-1}});var F={t:"s",v:S},T=j.getAttribute("data-t")||j.getAttribute("t")||"";S!=null&&(S.length==0?F.t=T||"z":n.raw||S.trim().length==0||T=="s"||(S==="TRUE"?F={t:"b",v:!0}:S==="FALSE"?F={t:"b",v:!1}:isNaN(Gu(S))?isNaN(My(S).getDate())||(F={t:"d",v:Us(S)},n.cellDates||(F={t:"n",v:yi(F.v)}),F.z=n.dateNF||Nr[14]):F={t:"n",v:Gu(S)})),F.z===void 0&&I!=null&&(F.z=I);var k="",V=j.getElementsByTagName("A");if(V&&V.length)for(var C=0;C<V.length&&!(V[C].hasAttribute("href")&&(k=V[C].getAttribute("href"),k.charAt(0)!="#"));++C);k&&k.charAt(0)!="#"&&(F.l={Target:k}),n.dense?(e[p+a]||(e[p+a]=[]),e[p+a][v+i]=F):e[Er({c:v+i,r:p+a})]=F,u.e.c<v+i&&(u.e.c=v+i),v+=y}}++p}return f.length&&(e["!merges"]=(e["!merges"]||[]).concat(f)),u.e.r=Math.max(u.e.r,p-1+a),e["!ref"]=nn(u),p>=c&&(e["!fullref"]=nn((u.e.r=l.length-g+p-1+a,u))),e}function Vme(e,t){var r=t||{},n=r.dense?[]:{};return qme(n,e,t)}function E5t(e,t){return Rp(Vme(e,t),t)}function PY(e){var t="",r=A5t(e);return r&&(t=r(e).getPropertyValue("display")),t||(t=e.style&&e.style.display),t==="none"}function A5t(e){return e.ownerDocument.defaultView&&typeof e.ownerDocument.defaultView.getComputedStyle=="function"?e.ownerDocument.defaultView.getComputedStyle:typeof getComputedStyle=="function"?getComputedStyle:null}function T5t(e){var t=e.replace(/[\t\r\n]/g," ").trim().replace(/ +/g," ").replace(/<text:s\/>/g," ").replace(/<text:s text:c="(\d+)"\/>/g,function(n,a){return Array(parseInt(a,10)+1).join(" ")}).replace(/<text:tab[^>]*\/>/g," ").replace(/<text:line-break\/>/g,`
`),r=Dn(t.replace(/<[^>]*>/g,""));return[r]}var OY={day:["d","dd"],month:["m","mm"],year:["y","yy"],hours:["h","hh"],minutes:["m","mm"],seconds:["s","ss"],"am-pm":["A/P","AM/PM"],"day-of-week":["ddd","dddd"],era:["e","ee"],quarter:["\\Qm",'m\\"th quarter"']};function Wme(e,t){var r=t||{},n=HM(e),a=[],i,o,l={name:""},c="",u=0,d,f,m={},h=[],g=r.dense?[]:{},p,x,v={value:""},b="",y=0,N=[],_=-1,j=-1,S={s:{r:1e6,c:1e7},e:{r:0,c:0}},I=0,P={},F=[],T={},k=0,V=0,C=[],R=1,H=1,q=[],L={Names:[]},M={},z=["",""],K=[],E={},A="",O=0,U=!1,Y=!1,J=0;for(pj.lastIndex=0,n=n.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");p=pj.exec(n);)switch(p[3]=p[3].replace(/_.*$/,"")){case"table":case"工作表":p[1]==="/"?(S.e.c>=S.s.c&&S.e.r>=S.s.r?g["!ref"]=nn(S):g["!ref"]="A1:A1",r.sheetRows>0&&r.sheetRows<=S.e.r&&(g["!fullref"]=g["!ref"],S.e.r=r.sheetRows-1,g["!ref"]=nn(S)),F.length&&(g["!merges"]=F),C.length&&(g["!rows"]=C),d.name=d.名称||d.name,typeof JSON<"u"&&JSON.stringify(d),h.push(d.name),m[d.name]=g,Y=!1):p[0].charAt(p[0].length-2)!=="/"&&(d=Rr(p[0],!1),_=j=-1,S.s.r=S.s.c=1e7,S.e.r=S.e.c=0,g=r.dense?[]:{},F=[],C=[],Y=!0);break;case"table-row-group":p[1]==="/"?--I:++I;break;case"table-row":case"行":if(p[1]==="/"){_+=R,R=1;break}if(f=Rr(p[0],!1),f.行号?_=f.行号-1:_==-1&&(_=0),R=+f["number-rows-repeated"]||1,R<10)for(J=0;J<R;++J)I>0&&(C[_+J]={level:I});j=-1;break;case"covered-table-cell":p[1]!=="/"&&++j,r.sheetStubs&&(r.dense?(g[_]||(g[_]=[]),g[_][j]={t:"z"}):g[Er({r:_,c:j})]={t:"z"}),b="",N=[];break;case"table-cell":case"数据":if(p[0].charAt(p[0].length-2)==="/")++j,v=Rr(p[0],!1),H=parseInt(v["number-columns-repeated"]||"1",10),x={t:"z",v:null},v.formula&&r.cellFormula!=!1&&(x.f=CY(Dn(v.formula))),(v.数据类型||v["value-type"])=="string"&&(x.t="s",x.v=Dn(v["string-value"]||""),r.dense?(g[_]||(g[_]=[]),g[_][j]=x):g[Er({r:_,c:j})]=x),j+=H-1;else if(p[1]!=="/"){++j,b="",y=0,N=[],H=1;var se=R?_+R-1:_;if(j>S.e.c&&(S.e.c=j),j<S.s.c&&(S.s.c=j),_<S.s.r&&(S.s.r=_),se>S.e.r&&(S.e.r=se),v=Rr(p[0],!1),K=[],E={},x={t:v.数据类型||v["value-type"],v:null},r.cellFormula)if(v.formula&&(v.formula=Dn(v.formula)),v["number-matrix-columns-spanned"]&&v["number-matrix-rows-spanned"]&&(k=parseInt(v["number-matrix-rows-spanned"],10)||0,V=parseInt(v["number-matrix-columns-spanned"],10)||0,T={s:{r:_,c:j},e:{r:_+k-1,c:j+V-1}},x.F=nn(T),q.push([T,x.F])),v.formula)x.f=CY(v.formula);else for(J=0;J<q.length;++J)_>=q[J][0].s.r&&_<=q[J][0].e.r&&j>=q[J][0].s.c&&j<=q[J][0].e.c&&(x.F=q[J][1]);switch((v["number-columns-spanned"]||v["number-rows-spanned"])&&(k=parseInt(v["number-rows-spanned"],10)||0,V=parseInt(v["number-columns-spanned"],10)||0,T={s:{r:_,c:j},e:{r:_+k-1,c:j+V-1}},F.push(T)),v["number-columns-repeated"]&&(H=parseInt(v["number-columns-repeated"],10)),x.t){case"boolean":x.t="b",x.v=Ls(v["boolean-value"]);break;case"float":x.t="n",x.v=parseFloat(v.value);break;case"percentage":x.t="n",x.v=parseFloat(v.value);break;case"currency":x.t="n",x.v=parseFloat(v.value);break;case"date":x.t="d",x.v=Us(v["date-value"]),r.cellDates||(x.t="n",x.v=yi(x.v)),x.z="m/d/yy";break;case"time":x.t="n",x.v=lvt(v["time-value"])/86400,r.cellDates&&(x.t="d",x.v=lA(x.v)),x.z="HH:MM:SS";break;case"number":x.t="n",x.v=parseFloat(v.数据数值);break;default:if(x.t==="string"||x.t==="text"||!x.t)x.t="s",v["string-value"]!=null&&(b=Dn(v["string-value"]),N=[]);else throw new Error("Unsupported value type "+x.t)}}else{if(U=!1,x.t==="s"&&(x.v=b||"",N.length&&(x.R=N),U=y==0),M.Target&&(x.l=M),K.length>0&&(x.c=K,K=[]),b&&r.cellText!==!1&&(x.w=b),U&&(x.t="z",delete x.v),(!U||r.sheetStubs)&&!(r.sheetRows&&r.sheetRows<=_))for(var ee=0;ee<R;++ee){if(H=parseInt(v["number-columns-repeated"]||"1",10),r.dense)for(g[_+ee]||(g[_+ee]=[]),g[_+ee][j]=ee==0?x:xs(x);--H>0;)g[_+ee][j+H]=xs(x);else for(g[Er({r:_+ee,c:j})]=x;--H>0;)g[Er({r:_+ee,c:j+H})]=xs(x);S.e.c<=j&&(S.e.c=j)}H=parseInt(v["number-columns-repeated"]||"1",10),j+=H-1,H=0,x={},b="",N=[]}M={};break;case"document":case"document-content":case"电子表格文档":case"spreadsheet":case"主体":case"scripts":case"styles":case"font-face-decls":case"master-styles":if(p[1]==="/"){if((i=a.pop())[0]!==p[3])throw"Bad state: "+i}else p[0].charAt(p[0].length-2)!=="/"&&a.push([p[3],!0]);break;case"annotation":if(p[1]==="/"){if((i=a.pop())[0]!==p[3])throw"Bad state: "+i;E.t=b,N.length&&(E.R=N),E.a=A,K.push(E)}else p[0].charAt(p[0].length-2)!=="/"&&a.push([p[3],!1]);A="",O=0,b="",y=0,N=[];break;case"creator":p[1]==="/"?A=n.slice(O,p.index):O=p.index+p[0].length;break;case"meta":case"元数据":case"settings":case"config-item-set":case"config-item-map-indexed":case"config-item-map-entry":case"config-item-map-named":case"shapes":case"frame":case"text-box":case"image":case"data-pilot-tables":case"list-style":case"form":case"dde-links":case"event-listeners":case"chart":if(p[1]==="/"){if((i=a.pop())[0]!==p[3])throw"Bad state: "+i}else p[0].charAt(p[0].length-2)!=="/"&&a.push([p[3],!1]);b="",y=0,N=[];break;case"scientific-number":break;case"currency-symbol":break;case"currency-style":break;case"number-style":case"percentage-style":case"date-style":case"time-style":if(p[1]==="/"){if(P[l.name]=c,(i=a.pop())[0]!==p[3])throw"Bad state: "+i}else p[0].charAt(p[0].length-2)!=="/"&&(c="",l=Rr(p[0],!1),a.push([p[3],!0]));break;case"script":break;case"libraries":break;case"automatic-styles":break;case"default-style":case"page-layout":break;case"style":break;case"map":break;case"font-face":break;case"paragraph-properties":break;case"table-properties":break;case"table-column-properties":break;case"table-row-properties":break;case"table-cell-properties":break;case"number":switch(a[a.length-1][0]){case"time-style":case"date-style":o=Rr(p[0],!1),c+=OY[p[3]][o.style==="long"?1:0];break}break;case"fraction":break;case"day":case"month":case"year":case"era":case"day-of-week":case"week-of-year":case"quarter":case"hours":case"minutes":case"seconds":case"am-pm":switch(a[a.length-1][0]){case"time-style":case"date-style":o=Rr(p[0],!1),c+=OY[p[3]][o.style==="long"?1:0];break}break;case"boolean-style":break;case"boolean":break;case"text-style":break;case"text":if(p[0].slice(-2)==="/>")break;if(p[1]==="/")switch(a[a.length-1][0]){case"number-style":case"date-style":case"time-style":c+=n.slice(u,p.index);break}else u=p.index+p[0].length;break;case"named-range":o=Rr(p[0],!1),z=IP(o["cell-range-address"]);var ie={Name:o.name,Ref:z[0]+"!"+z[1]};Y&&(ie.Sheet=h.length),L.Names.push(ie);break;case"text-content":break;case"text-properties":break;case"embedded-text":break;case"body":case"电子表格":break;case"forms":break;case"table-column":break;case"table-header-rows":break;case"table-rows":break;case"table-column-group":break;case"table-header-columns":break;case"table-columns":break;case"null-date":break;case"graphic-properties":break;case"calculation-settings":break;case"named-expressions":break;case"label-range":break;case"label-ranges":break;case"named-expression":break;case"sort":break;case"sort-by":break;case"sort-groups":break;case"tab":break;case"line-break":break;case"span":break;case"p":case"文本串":if(["master-styles"].indexOf(a[a.length-1][0])>-1)break;if(p[1]==="/"&&(!v||!v["string-value"])){var Ee=T5t(n.slice(y,p.index));b=(b.length>0?b+`
`:"")+Ee[0]}else Rr(p[0],!1),y=p.index+p[0].length;break;case"s":break;case"database-range":if(p[1]==="/")break;try{z=IP(Rr(p[0])["target-range-address"]),m[z[0]]["!autofilter"]={ref:z[1]}}catch{}break;case"date":break;case"object":break;case"title":case"标题":break;case"desc":break;case"binary-data":break;case"table-source":break;case"scenario":break;case"iteration":break;case"content-validations":break;case"content-validation":break;case"help-message":break;case"error-message":break;case"database-ranges":break;case"filter":break;case"filter-and":break;case"filter-or":break;case"filter-condition":break;case"list-level-style-bullet":break;case"list-level-style-number":break;case"list-level-properties":break;case"sender-firstname":case"sender-lastname":case"sender-initials":case"sender-title":case"sender-position":case"sender-email":case"sender-phone-private":case"sender-fax":case"sender-company":case"sender-phone-work":case"sender-street":case"sender-city":case"sender-postal-code":case"sender-country":case"sender-state-or-province":case"author-name":case"author-initials":case"chapter":case"file-name":case"template-name":case"sheet-name":break;case"event-listener":break;case"initial-creator":case"creation-date":case"print-date":case"generator":case"document-statistic":case"user-defined":case"editing-duration":case"editing-cycles":break;case"config-item":break;case"page-number":break;case"page-count":break;case"time":break;case"cell-range-source":break;case"detective":break;case"operation":break;case"highlighted-range":break;case"data-pilot-table":case"source-cell-range":case"source-service":case"data-pilot-field":case"data-pilot-level":case"data-pilot-subtotals":case"data-pilot-subtotal":case"data-pilot-members":case"data-pilot-member":case"data-pilot-display-info":case"data-pilot-sort-info":case"data-pilot-layout-info":case"data-pilot-field-reference":case"data-pilot-groups":case"data-pilot-group":case"data-pilot-group-member":break;case"rect":break;case"dde-connection-decls":case"dde-connection-decl":case"dde-link":case"dde-source":break;case"properties":break;case"property":break;case"a":if(p[1]!=="/"){if(M=Rr(p[0],!1),!M.href)break;M.Target=Dn(M.href),delete M.href,M.Target.charAt(0)=="#"&&M.Target.indexOf(".")>-1?(z=IP(M.Target.slice(1)),M.Target="#"+z[0]+"!"+z[1]):M.Target.match(/^\.\.[\\\/]/)&&(M.Target=M.Target.slice(3))}break;case"table-protection":break;case"data-pilot-grand-total":break;case"office-document-common-attrs":break;default:switch(p[2]){case"dc:":case"calcext:":case"loext:":case"ooo:":case"chartooo:":case"draw:":case"style:":case"chart:":case"form:":case"uof:":case"表:":case"字:":break;default:if(r.WTF)throw new Error(p)}}var te={Sheets:m,SheetNames:h,Workbook:L};return r.bookSheets&&delete te.Sheets,te}function DY(e,t){t=t||{},Sc(e,"META-INF/manifest.xml")&&lyt(qa(e,"META-INF/manifest.xml"),t);var r=Hl(e,"content.xml");if(!r)throw new Error("Missing content.xml in ODS / UOF file");var n=Wme(us(r),t);return Sc(e,"meta.xml")&&(n.Props=Phe(qa(e,"meta.xml"))),n}function IY(e,t){return Wme(e,t)}var P5t=function(){var e=["<office:master-styles>",'<style:master-page style:name="mp1" style:page-layout-name="mp1">',"<style:header/>",'<style:header-left style:display="false"/>',"<style:footer/>",'<style:footer-left style:display="false"/>',"</style:master-page>","</office:master-styles>"].join(""),t="<office:document-styles "+mj({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","office:version":"1.2"})+">"+e+"</office:document-styles>";return function(){return Ra+t}}(),RY=function(){var e=function(i){return ns(i).replace(/ +/g,function(o){return'<text:s text:c="'+o.length+'"/>'}).replace(/\t/g,"<text:tab/>").replace(/\n/g,"</text:p><text:p>").replace(/^ /,"<text:s/>").replace(/ $/,"<text:s/>")},t=` <table:table-cell />
`,r=` <table:covered-table-cell/>
`,n=function(i,o,l){var c=[];c.push(' <table:table table:name="'+ns(o.SheetNames[l])+`" table:style-name="ta1">
`);var u=0,d=0,f=Go(i["!ref"]||"A1"),m=i["!merges"]||[],h=0,g=Array.isArray(i);if(i["!cols"])for(d=0;d<=f.e.c;++d)c.push(" <table:table-column"+(i["!cols"][d]?' table:style-name="co'+i["!cols"][d].ods+'"':"")+`></table:table-column>
`);var p="",x=i["!rows"]||[];for(u=0;u<f.s.r;++u)p=x[u]?' table:style-name="ro'+x[u].ods+'"':"",c.push(" <table:table-row"+p+`></table:table-row>
`);for(;u<=f.e.r;++u){for(p=x[u]?' table:style-name="ro'+x[u].ods+'"':"",c.push(" <table:table-row"+p+`>
`),d=0;d<f.s.c;++d)c.push(t);for(;d<=f.e.c;++d){var v=!1,b={},y="";for(h=0;h!=m.length;++h)if(!(m[h].s.c>d)&&!(m[h].s.r>u)&&!(m[h].e.c<d)&&!(m[h].e.r<u)){(m[h].s.c!=d||m[h].s.r!=u)&&(v=!0),b["table:number-columns-spanned"]=m[h].e.c-m[h].s.c+1,b["table:number-rows-spanned"]=m[h].e.r-m[h].s.r+1;break}if(v){c.push(r);continue}var N=Er({r:u,c:d}),_=g?(i[u]||[])[d]:i[N];if(_&&_.f&&(b["table:formula"]=ns(r_t(_.f)),_.F&&_.F.slice(0,N.length)==N)){var j=Go(_.F);b["table:number-matrix-columns-spanned"]=j.e.c-j.s.c+1,b["table:number-matrix-rows-spanned"]=j.e.r-j.s.r+1}if(!_){c.push(t);continue}switch(_.t){case"b":y=_.v?"TRUE":"FALSE",b["office:value-type"]="boolean",b["office:boolean-value"]=_.v?"true":"false";break;case"n":y=_.w||String(_.v||0),b["office:value-type"]="float",b["office:value"]=_.v||0;break;case"s":case"str":y=_.v==null?"":_.v,b["office:value-type"]="string";break;case"d":y=_.w||Us(_.v).toISOString(),b["office:value-type"]="date",b["office:date-value"]=Us(_.v).toISOString(),b["table:style-name"]="ce1";break;default:c.push(t);continue}var S=e(y);if(_.l&&_.l.Target){var I=_.l.Target;I=I.charAt(0)=="#"?"#"+n_t(I.slice(1)):I,I.charAt(0)!="#"&&!I.match(/^\w+:/)&&(I="../"+I),S=Lt("text:a",S,{"xlink:href":I.replace(/&/g,"&")})}c.push(" "+Lt("table:table-cell",Lt("text:p",S,{}),b)+`
`)}c.push(` </table:table-row>
`)}return c.push(` </table:table>
`),c.join("")},a=function(i,o){i.push(` <office:automatic-styles>
`),i.push(` <number:date-style style:name="N37" number:automatic-order="true">
`),i.push(` <number:month number:style="long"/>
`),i.push(` <number:text>/</number:text>
`),i.push(` <number:day number:style="long"/>
`),i.push(` <number:text>/</number:text>
`),i.push(` <number:year/>
`),i.push(` </number:date-style>
`);var l=0;o.SheetNames.map(function(u){return o.Sheets[u]}).forEach(function(u){if(u&&u["!cols"]){for(var d=0;d<u["!cols"].length;++d)if(u["!cols"][d]){var f=u["!cols"][d];if(f.width==null&&f.wpx==null&&f.wch==null)continue;hp(f),f.ods=l;var m=u["!cols"][d].wpx+"px";i.push(' <style:style style:name="co'+l+`" style:family="table-column">
`),i.push(' <style:table-column-properties fo:break-before="auto" style:column-width="'+m+`"/>
`),i.push(` </style:style>
`),++l}}});var c=0;o.SheetNames.map(function(u){return o.Sheets[u]}).forEach(function(u){if(u&&u["!rows"]){for(var d=0;d<u["!rows"].length;++d)if(u["!rows"][d]){u["!rows"][d].ods=c;var f=u["!rows"][d].hpx+"px";i.push(' <style:style style:name="ro'+c+`" style:family="table-row">
`),i.push(' <style:table-row-properties fo:break-before="auto" style:row-height="'+f+`"/>
`),i.push(` </style:style>
`),++c}}}),i.push(` <style:style style:name="ta1" style:family="table" style:master-page-name="mp1">
`),i.push(` <style:table-properties table:display="true" style:writing-mode="lr-tb"/>
`),i.push(` </style:style>
`),i.push(` <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>
`),i.push(` </office:automatic-styles>
`)};return function(o,l){var c=[Ra],u=mj({"xmlns:office":"urn:oasis:names:tc:opendocument:xmlns:office:1.0","xmlns:table":"urn:oasis:names:tc:opendocument:xmlns:table:1.0","xmlns:style":"urn:oasis:names:tc:opendocument:xmlns:style:1.0","xmlns:text":"urn:oasis:names:tc:opendocument:xmlns:text:1.0","xmlns:draw":"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0","xmlns:fo":"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0","xmlns:xlink":"http://www.w3.org/1999/xlink","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:meta":"urn:oasis:names:tc:opendocument:xmlns:meta:1.0","xmlns:number":"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0","xmlns:presentation":"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0","xmlns:svg":"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0","xmlns:chart":"urn:oasis:names:tc:opendocument:xmlns:chart:1.0","xmlns:dr3d":"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0","xmlns:math":"http://www.w3.org/1998/Math/MathML","xmlns:form":"urn:oasis:names:tc:opendocument:xmlns:form:1.0","xmlns:script":"urn:oasis:names:tc:opendocument:xmlns:script:1.0","xmlns:ooo":"http://openoffice.org/2004/office","xmlns:ooow":"http://openoffice.org/2004/writer","xmlns:oooc":"http://openoffice.org/2004/calc","xmlns:dom":"http://www.w3.org/2001/xml-events","xmlns:xforms":"http://www.w3.org/2002/xforms","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:sheet":"urn:oasis:names:tc:opendocument:sh33tjs:1.0","xmlns:rpt":"http://openoffice.org/2005/report","xmlns:of":"urn:oasis:names:tc:opendocument:xmlns:of:1.2","xmlns:xhtml":"http://www.w3.org/1999/xhtml","xmlns:grddl":"http://www.w3.org/2003/g/data-view#","xmlns:tableooo":"http://openoffice.org/2009/table","xmlns:drawooo":"http://openoffice.org/2010/draw","xmlns:calcext":"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0","xmlns:loext":"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0","xmlns:field":"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0","xmlns:formx":"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0","xmlns:css3t":"http://www.w3.org/TR/css3-text/","office:version":"1.2"}),d=mj({"xmlns:config":"urn:oasis:names:tc:opendocument:xmlns:config:1.0","office:mimetype":"application/vnd.oasis.opendocument.spreadsheet"});l.bookType=="fods"?(c.push("<office:document"+u+d+`>
`),c.push(The().replace(/office:document-meta/g,"office:meta"))):c.push("<office:document-content"+u+`>
`),a(c,o),c.push(` <office:body>
`),c.push(` <office:spreadsheet>
`);for(var f=0;f!=o.SheetNames.length;++f)c.push(n(o.Sheets[o.SheetNames[f]],o,f));return c.push(` </office:spreadsheet>
`),c.push(` </office:body>
`),l.bookType=="fods"?c.push("</office:document>"):c.push("</office:document-content>"),c.join("")}}();function Hme(e,t){if(t.bookType=="fods")return RY(e,t);var r=UM(),n="",a=[],i=[];return n="mimetype",un(r,n,"application/vnd.oasis.opendocument.spreadsheet"),n="content.xml",un(r,n,RY(e,t)),a.push([n,"text/xml"]),i.push([n,"ContentFile"]),n="styles.xml",un(r,n,P5t(e,t)),a.push([n,"text/xml"]),i.push([n,"StylesFile"]),n="meta.xml",un(r,n,Ra+The()),a.push([n,"text/xml"]),i.push([n,"MetadataFile"]),n="manifest.rdf",un(r,n,dyt(i)),a.push([n,"application/rdf+xml"]),n="META-INF/manifest.xml",un(r,n,cyt(a)),r}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function Eg(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function uI(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):us(Ip(e))}function O5t(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Wl($d(e))}function D5t(e,t){e:for(var r=0;r<=e.length-t.length;++r){for(var n=0;n<t.length;++n)if(e[r+n]!=t[n])continue e;return!0}return!1}function pp(e){var t=e.reduce(function(a,i){return a+i.length},0),r=new Uint8Array(t),n=0;return e.forEach(function(a){r.set(a,n),n+=a.length}),r}function LY(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>>24}function I5t(e,t){for(var r=(e[t+15]&127)<<7|e[t+14]>>1,n=e[t+14]&1,a=t+13;a>=t;--a)n=n*256+e[a];return(e[t+15]&128?-n:n)*Math.pow(10,r-6176)}function R5t(e,t,r){var n=Math.floor(r==0?0:Math.LOG10E*Math.log(Math.abs(r)))+6176-20,a=r/Math.pow(10,n-6176);e[t+15]|=n>>7,e[t+14]|=(n&127)<<1;for(var i=0;a>=1;++i,a/=256)e[t+i]=a&255;e[t+15]|=r>=0?0:128}function jj(e,t){var r=t?t[0]:0,n=e[r]&127;e:if(e[r++]>=128&&(n|=(e[r]&127)<<7,e[r++]<128||(n|=(e[r]&127)<<14,e[r++]<128)||(n|=(e[r]&127)<<21,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,28),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,35),++r,e[r++]<128)||(n+=(e[r]&127)*Math.pow(2,42),++r,e[r++]<128)))break e;return t&&(t[0]=r),n}function Qn(e){var t=new Uint8Array(7);t[0]=e&127;var r=1;e:if(e>127){if(t[r-1]|=128,t[r]=e>>7&127,++r,e<=16383||(t[r-1]|=128,t[r]=e>>14&127,++r,e<=2097151)||(t[r-1]|=128,t[r]=e>>21&127,++r,e<=268435455)||(t[r-1]|=128,t[r]=e/256>>>21&127,++r,e<=34359738367)||(t[r-1]|=128,t[r]=e/65536>>>21&127,++r,e<=4398046511103))break e;t[r-1]|=128,t[r]=e/16777216>>>21&127,++r}return t.slice(0,r)}function ya(e){var t=0,r=e[t]&127;e:if(e[t++]>=128){if(r|=(e[t]&127)<<7,e[t++]<128||(r|=(e[t]&127)<<14,e[t++]<128)||(r|=(e[t]&127)<<21,e[t++]<128))break e;r|=(e[t]&127)<<28}return r}function Rn(e){for(var t=[],r=[0];r[0]<e.length;){var n=r[0],a=jj(e,r),i=a&7;a=Math.floor(a/8);var o=0,l;if(a==0)break;switch(i){case 0:{for(var c=r[0];e[r[0]++]>=128;);l=e.slice(c,r[0])}break;case 5:o=4,l=e.slice(r[0],r[0]+o),r[0]+=o;break;case 1:o=8,l=e.slice(r[0],r[0]+o),r[0]+=o;break;case 2:o=jj(e,r),l=e.slice(r[0],r[0]+o),r[0]+=o;break;case 3:case 4:default:throw new Error("PB Type ".concat(i," for Field ").concat(a," at offset ").concat(n))}var u={data:l,type:i};t[a]==null?t[a]=[u]:t[a].push(u)}return t}function qi(e){var t=[];return e.forEach(function(r,n){r.forEach(function(a){a.data&&(t.push(Qn(n*8+a.type)),a.type==2&&t.push(Qn(a.data.length)),t.push(a.data))})}),pp(t)}function b7(e,t){return(e==null?void 0:e.map(function(r){return t(r.data)}))||[]}function jc(e){for(var t,r=[],n=[0];n[0]<e.length;){var a=jj(e,n),i=Rn(e.slice(n[0],n[0]+a));n[0]+=a;var o={id:ya(i[1][0].data),messages:[]};i[2].forEach(function(l){var c=Rn(l.data),u=ya(c[3][0].data);o.messages.push({meta:c,data:e.slice(n[0],n[0]+u)}),n[0]+=u}),(t=i[3])!=null&&t[0]&&(o.merge=ya(i[3][0].data)>>>0>0),r.push(o)}return r}function Ox(e){var t=[];return e.forEach(function(r){var n=[];n[1]=[{data:Qn(r.id),type:0}],n[2]=[],r.merge!=null&&(n[3]=[{data:Qn(+!!r.merge),type:0}]);var a=[];r.messages.forEach(function(o){a.push(o.data),o.meta[3]=[{type:0,data:Qn(o.data.length)}],n[2].push({data:qi(o.meta),type:2})});var i=qi(n);t.push(Qn(i.length)),t.push(i),a.forEach(function(o){return t.push(o)})}),pp(t)}function L5t(e,t){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var r=[0],n=jj(t,r),a=[];r[0]<t.length;){var i=t[r[0]]&3;if(i==0){var o=t[r[0]++]>>2;if(o<60)++o;else{var l=o-59;o=t[r[0]],l>1&&(o|=t[r[0]+1]<<8),l>2&&(o|=t[r[0]+2]<<16),l>3&&(o|=t[r[0]+3]<<24),o>>>=0,o++,r[0]+=l}a.push(t.slice(r[0],r[0]+o)),r[0]+=o;continue}else{var c=0,u=0;if(i==1?(u=(t[r[0]]>>2&7)+4,c=(t[r[0]++]&224)<<3,c|=t[r[0]++]):(u=(t[r[0]++]>>2)+1,i==2?(c=t[r[0]]|t[r[0]+1]<<8,r[0]+=2):(c=(t[r[0]]|t[r[0]+1]<<8|t[r[0]+2]<<16|t[r[0]+3]<<24)>>>0,r[0]+=4)),a=[pp(a)],c==0)throw new Error("Invalid offset 0");if(c>a[0].length)throw new Error("Invalid offset beyond length");if(u>=c)for(a.push(a[0].slice(-c)),u-=c;u>=a[a.length-1].length;)a.push(a[a.length-1]),u-=a[a.length-1].length;a.push(a[0].slice(-c,-c+u))}}var d=pp(a);if(d.length!=n)throw new Error("Unexpected length: ".concat(d.length," != ").concat(n));return d}function _c(e){for(var t=[],r=0;r<e.length;){var n=e[r++],a=e[r]|e[r+1]<<8|e[r+2]<<16;r+=3,t.push(L5t(n,e.slice(r,r+a))),r+=a}if(r!==e.length)throw new Error("data is not a valid framed stream!");return pp(t)}function Dx(e){for(var t=[],r=0;r<e.length;){var n=Math.min(e.length-r,268435455),a=new Uint8Array(4);t.push(a);var i=Qn(n),o=i.length;t.push(i),n<=60?(o++,t.push(new Uint8Array([n-1<<2]))):n<=256?(o+=2,t.push(new Uint8Array([240,n-1&255]))):n<=65536?(o+=3,t.push(new Uint8Array([244,n-1&255,n-1>>8&255]))):n<=16777216?(o+=4,t.push(new Uint8Array([248,n-1&255,n-1>>8&255,n-1>>16&255]))):n<=4294967296&&(o+=5,t.push(new Uint8Array([252,n-1&255,n-1>>8&255,n-1>>16&255,n-1>>>24&255]))),t.push(e.slice(r,r+n)),o+=n,a[0]=0,a[1]=o&255,a[2]=o>>8&255,a[3]=o>>16&255,r+=n}return pp(t)}function F5t(e,t,r,n){var a=Eg(e),i=a.getUint32(4,!0),o=(n>1?12:8)+LY(i&(n>1?3470:398))*4,l=-1,c=-1,u=NaN,d=new Date(2001,0,1);i&512&&(l=a.getUint32(o,!0),o+=4),o+=LY(i&(n>1?12288:4096))*4,i&16&&(c=a.getUint32(o,!0),o+=4),i&32&&(u=a.getFloat64(o,!0),o+=8),i&64&&(d.setTime(d.getTime()+a.getFloat64(o,!0)*1e3),o+=8);var f;switch(e[2]){case 0:break;case 2:f={t:"n",v:u};break;case 3:f={t:"s",v:t[c]};break;case 5:f={t:"d",v:d};break;case 6:f={t:"b",v:u>0};break;case 7:f={t:"n",v:u/86400};break;case 8:f={t:"e",v:0};break;case 9:if(l>-1)f={t:"s",v:r[l]};else if(c>-1)f={t:"s",v:t[c]};else if(!isNaN(u))f={t:"n",v:u};else throw new Error("Unsupported cell type ".concat(e.slice(0,4)));break;default:throw new Error("Unsupported cell type ".concat(e.slice(0,4)))}return f}function M5t(e,t,r){var n=Eg(e),a=n.getUint32(8,!0),i=12,o=-1,l=-1,c=NaN,u=NaN,d=new Date(2001,0,1);a&1&&(c=I5t(e,i),i+=16),a&2&&(u=n.getFloat64(i,!0),i+=8),a&4&&(d.setTime(d.getTime()+n.getFloat64(i,!0)*1e3),i+=8),a&8&&(l=n.getUint32(i,!0),i+=4),a&16&&(o=n.getUint32(i,!0),i+=4);var f;switch(e[1]){case 0:break;case 2:f={t:"n",v:c};break;case 3:f={t:"s",v:t[l]};break;case 5:f={t:"d",v:d};break;case 6:f={t:"b",v:u>0};break;case 7:f={t:"n",v:u/86400};break;case 8:f={t:"e",v:0};break;case 9:if(o>-1)f={t:"s",v:r[o]};else throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(a&31," : ").concat(e.slice(0,4)));break;case 10:f={t:"n",v:c};break;default:throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(a&31," : ").concat(e.slice(0,4)))}return f}function LP(e,t){var r=new Uint8Array(32),n=Eg(r),a=12,i=0;switch(r[0]=5,e.t){case"n":r[1]=2,R5t(r,a,e.v),i|=1,a+=16;break;case"b":r[1]=6,n.setFloat64(a,e.v?1:0,!0),i|=2,a+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[1]=3,n.setUint32(a,t.indexOf(e.v),!0),i|=8,a+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(8,i,!0),r.slice(0,a)}function FP(e,t){var r=new Uint8Array(32),n=Eg(r),a=12,i=0;switch(r[0]=3,e.t){case"n":r[2]=2,n.setFloat64(a,e.v,!0),i|=32,a+=8;break;case"b":r[2]=6,n.setFloat64(a,e.v?1:0,!0),i|=32,a+=8;break;case"s":if(t.indexOf(e.v)==-1)throw new Error("Value ".concat(e.v," missing from SST!"));r[2]=3,n.setUint32(a,t.indexOf(e.v),!0),i|=16,a+=4;break;default:throw"unsupported cell type "+e.t}return n.setUint32(4,i,!0),r.slice(0,a)}function $5t(e,t,r){switch(e[0]){case 0:case 1:case 2:case 3:return F5t(e,t,r,e[0]);case 5:return M5t(e,t,r);default:throw new Error("Unsupported payload version ".concat(e[0]))}}function lo(e){var t=Rn(e);return jj(t[1][0].data)}function FY(e,t){var r=Rn(t.data),n=ya(r[1][0].data),a=r[3],i=[];return(a||[]).forEach(function(o){var l=Rn(o.data),c=ya(l[1][0].data)>>>0;switch(n){case 1:i[c]=uI(l[3][0].data);break;case 8:{var u=e[lo(l[9][0].data)][0],d=Rn(u.data),f=e[lo(d[1][0].data)][0],m=ya(f.meta[1][0].data);if(m!=2001)throw new Error("2000 unexpected reference to ".concat(m));var h=Rn(f.data);i[c]=h[3].map(function(g){return uI(g.data)}).join("")}break}}),i}function B5t(e,t){var r,n,a,i,o,l,c,u,d,f,m,h,g,p,x=Rn(e),v=ya(x[1][0].data)>>>0,b=ya(x[2][0].data)>>>0,y=((n=(r=x[8])==null?void 0:r[0])==null?void 0:n.data)&&ya(x[8][0].data)>0||!1,N,_;if((i=(a=x[7])==null?void 0:a[0])!=null&&i.data&&t!=0)N=(l=(o=x[7])==null?void 0:o[0])==null?void 0:l.data,_=(u=(c=x[6])==null?void 0:c[0])==null?void 0:u.data;else if((f=(d=x[4])==null?void 0:d[0])!=null&&f.data&&t!=1)N=(h=(m=x[4])==null?void 0:m[0])==null?void 0:h.data,_=(p=(g=x[3])==null?void 0:g[0])==null?void 0:p.data;else throw"NUMBERS Tile missing ".concat(t," cell storage");for(var j=y?4:1,S=Eg(N),I=[],P=0;P<N.length/2;++P){var F=S.getUint16(P*2,!0);F<65535&&I.push([P,F])}if(I.length!=b)throw"Expected ".concat(b," cells, found ").concat(I.length);var T=[];for(P=0;P<I.length-1;++P)T[I[P][0]]=_.subarray(I[P][1]*j,I[P+1][1]*j);return I.length>=1&&(T[I[I.length-1][0]]=_.subarray(I[I.length-1][1]*j)),{R:v,cells:T}}function z5t(e,t){var r,n=Rn(t.data),a=(r=n==null?void 0:n[7])!=null&&r[0]?ya(n[7][0].data)>>>0>0?1:0:-1,i=b7(n[5],function(o){return B5t(o,a)});return{nrows:ya(n[4][0].data)>>>0,data:i.reduce(function(o,l){return o[l.R]||(o[l.R]=[]),l.cells.forEach(function(c,u){if(o[l.R][u])throw new Error("Duplicate cell r=".concat(l.R," c=").concat(u));o[l.R][u]=c}),o},[])}}function U5t(e,t,r){var n,a=Rn(t.data),i={s:{r:0,c:0},e:{r:0,c:0}};if(i.e.r=(ya(a[6][0].data)>>>0)-1,i.e.r<0)throw new Error("Invalid row varint ".concat(a[6][0].data));if(i.e.c=(ya(a[7][0].data)>>>0)-1,i.e.c<0)throw new Error("Invalid col varint ".concat(a[7][0].data));r["!ref"]=nn(i);var o=Rn(a[4][0].data),l=FY(e,e[lo(o[4][0].data)][0]),c=(n=o[17])!=null&&n[0]?FY(e,e[lo(o[17][0].data)][0]):[],u=Rn(o[3][0].data),d=0;u[1].forEach(function(f){var m=Rn(f.data),h=e[lo(m[2][0].data)][0],g=ya(h.meta[1][0].data);if(g!=6002)throw new Error("6001 unexpected reference to ".concat(g));var p=z5t(e,h);p.data.forEach(function(x,v){x.forEach(function(b,y){var N=Er({r:d+v,c:y}),_=$5t(b,l,c);_&&(r[N]=_)})}),d+=p.nrows})}function q5t(e,t){var r=Rn(t.data),n={"!ref":"A1"},a=e[lo(r[2][0].data)],i=ya(a[0].meta[1][0].data);if(i!=6001)throw new Error("6000 unexpected reference to ".concat(i));return U5t(e,a[0],n),n}function V5t(e,t){var r,n=Rn(t.data),a={name:(r=n[1])!=null&&r[0]?uI(n[1][0].data):"",sheets:[]},i=b7(n[2],lo);return i.forEach(function(o){e[o].forEach(function(l){var c=ya(l.meta[1][0].data);c==6e3&&a.sheets.push(q5t(e,l))})}),a}function W5t(e,t){var r=C7(),n=Rn(t.data),a=b7(n[1],lo);if(a.forEach(function(i){e[i].forEach(function(o){var l=ya(o.meta[1][0].data);if(l==2){var c=V5t(e,o);c.sheets.forEach(function(u,d){E7(r,u,d==0?c.name:c.name+"_"+d,!0)})}})}),r.SheetNames.length==0)throw new Error("Empty NUMBERS file");return r}function MP(e){var t,r,n,a,i={},o=[];if(e.FullPaths.forEach(function(c){if(c.match(/\.iwpv2/))throw new Error("Unsupported password protection")}),e.FileIndex.forEach(function(c){if(c.name.match(/\.iwa$/)){var u;try{u=_c(c.content)}catch(f){return console.log("?? "+c.content.length+" "+(f.message||f))}var d;try{d=jc(u)}catch(f){return console.log("## "+(f.message||f))}d.forEach(function(f){i[f.id]=f.messages,o.push(f.id)})}}),!o.length)throw new Error("File has no messages");var l=((a=(n=(r=(t=i==null?void 0:i[1])==null?void 0:t[0])==null?void 0:r.meta)==null?void 0:n[1])==null?void 0:a[0].data)&&ya(i[1][0].meta[1][0].data)==1&&i[1][0];if(l||o.forEach(function(c){i[c].forEach(function(u){var d=ya(u.meta[1][0].data)>>>0;if(d==1)if(!l)l=u;else throw new Error("Document has multiple roots")})}),!l)throw new Error("Cannot find Document root");return W5t(i,l)}function H5t(e,t,r){var n,a,i,o;if(!((n=e[6])!=null&&n[0])||!((a=e[7])!=null&&a[0]))throw"Mutation only works on post-BNC storages!";var l=((o=(i=e[8])==null?void 0:i[0])==null?void 0:o.data)&&ya(e[8][0].data)>0||!1;if(l)throw"Math only works with normal offsets";for(var c=0,u=Eg(e[7][0].data),d=0,f=[],m=Eg(e[4][0].data),h=0,g=[],p=0;p<t.length;++p){if(t[p]==null){u.setUint16(p*2,65535,!0),m.setUint16(p*2,65535);continue}u.setUint16(p*2,d,!0),m.setUint16(p*2,h,!0);var x,v;switch(typeof t[p]){case"string":x=LP({t:"s",v:t[p]},r),v=FP({t:"s",v:t[p]},r);break;case"number":x=LP({t:"n",v:t[p]},r),v=FP({t:"n",v:t[p]},r);break;case"boolean":x=LP({t:"b",v:t[p]},r),v=FP({t:"b",v:t[p]},r);break;default:throw new Error("Unsupported value "+t[p])}f.push(x),d+=x.length,g.push(v),h+=v.length,++c}for(e[2][0].data=Qn(c);p<e[7][0].data.length/2;++p)u.setUint16(p*2,65535,!0),m.setUint16(p*2,65535,!0);return e[6][0].data=pp(f),e[3][0].data=pp(g),c}function G5t(e,t){if(!t||!t.numbers)throw new Error("Must pass a `numbers` option -- check the README");var r=e.Sheets[e.SheetNames[0]];e.SheetNames.length>1&&console.error("The Numbers writer currently writes only the first table");var n=Go(r["!ref"]);n.s.r=n.s.c=0;var a=!1;n.e.c>9&&(a=!0,n.e.c=9),n.e.r>49&&(a=!0,n.e.r=49),a&&console.error("The Numbers writer is currently limited to ".concat(nn(n)));var i=Rk(r,{range:n,header:1}),o=["~Sh33tJ5~"];i.forEach(function(A){return A.forEach(function(O){typeof O=="string"&&o.push(O)})});var l={},c=[],u=vr.read(t.numbers,{type:"base64"});u.FileIndex.map(function(A,O){return[A,u.FullPaths[O]]}).forEach(function(A){var O=A[0],U=A[1];if(O.type==2&&O.name.match(/\.iwa/)){var Y=O.content,J=_c(Y),se=jc(J);se.forEach(function(ee){c.push(ee.id),l[ee.id]={deps:[],location:U,type:ya(ee.messages[0].meta[1][0].data)}})}}),c.sort(function(A,O){return A-O});var d=c.filter(function(A){return A>1}).map(function(A){return[A,Qn(A)]});u.FileIndex.map(function(A,O){return[A,u.FullPaths[O]]}).forEach(function(A){var O=A[0];if(A[1],!!O.name.match(/\.iwa/)){var U=jc(_c(O.content));U.forEach(function(Y){Y.messages.forEach(function(J){d.forEach(function(se){Y.messages.some(function(ee){return ya(ee.meta[1][0].data)!=11006&&D5t(ee.data,se[1])})&&l[se[0]].deps.push(Y.id)})})})}});for(var f=vr.find(u,l[1].location),m=jc(_c(f.content)),h,g=0;g<m.length;++g){var p=m[g];p.id==1&&(h=p)}var x=lo(Rn(h.messages[0].data)[1][0].data);for(f=vr.find(u,l[x].location),m=jc(_c(f.content)),g=0;g<m.length;++g)p=m[g],p.id==x&&(h=p);for(x=lo(Rn(h.messages[0].data)[2][0].data),f=vr.find(u,l[x].location),m=jc(_c(f.content)),g=0;g<m.length;++g)p=m[g],p.id==x&&(h=p);for(x=lo(Rn(h.messages[0].data)[2][0].data),f=vr.find(u,l[x].location),m=jc(_c(f.content)),g=0;g<m.length;++g)p=m[g],p.id==x&&(h=p);var v=Rn(h.messages[0].data);{v[6][0].data=Qn(n.e.r+1),v[7][0].data=Qn(n.e.c+1);var b=lo(v[46][0].data),y=vr.find(u,l[b].location),N=jc(_c(y.content));{for(var _=0;_<N.length&&N[_].id!=b;++_);if(N[_].id!=b)throw"Bad ColumnRowUIDMapArchive";var j=Rn(N[_].messages[0].data);j[1]=[],j[2]=[],j[3]=[];for(var S=0;S<=n.e.c;++S){var I=[];I[1]=I[2]=[{type:0,data:Qn(S+420690)}],j[1].push({type:2,data:qi(I)}),j[2].push({type:0,data:Qn(S)}),j[3].push({type:0,data:Qn(S)})}j[4]=[],j[5]=[],j[6]=[];for(var P=0;P<=n.e.r;++P)I=[],I[1]=I[2]=[{type:0,data:Qn(P+726270)}],j[4].push({type:2,data:qi(I)}),j[5].push({type:0,data:Qn(P)}),j[6].push({type:0,data:Qn(P)});N[_].messages[0].data=qi(j)}y.content=Dx(Ox(N)),y.size=y.content.length,delete v[46];var F=Rn(v[4][0].data);{F[7][0].data=Qn(n.e.r+1);var T=Rn(F[1][0].data),k=lo(T[2][0].data);y=vr.find(u,l[k].location),N=jc(_c(y.content));{if(N[0].id!=k)throw"Bad HeaderStorageBucket";var V=Rn(N[0].messages[0].data);for(P=0;P<i.length;++P){var C=Rn(V[2][0].data);C[1][0].data=Qn(P),C[4][0].data=Qn(i[P].length),V[2][P]={type:V[2][0].type,data:qi(C)}}N[0].messages[0].data=qi(V)}y.content=Dx(Ox(N)),y.size=y.content.length;var R=lo(F[2][0].data);y=vr.find(u,l[R].location),N=jc(_c(y.content));{if(N[0].id!=R)throw"Bad HeaderStorageBucket";for(V=Rn(N[0].messages[0].data),S=0;S<=n.e.c;++S)C=Rn(V[2][0].data),C[1][0].data=Qn(S),C[4][0].data=Qn(n.e.r+1),V[2][S]={type:V[2][0].type,data:qi(C)};N[0].messages[0].data=qi(V)}y.content=Dx(Ox(N)),y.size=y.content.length;var H=lo(F[4][0].data);(function(){for(var A=vr.find(u,l[H].location),O=jc(_c(A.content)),U,Y=0;Y<O.length;++Y){var J=O[Y];J.id==H&&(U=J)}var se=Rn(U.messages[0].data);{se[3]=[];var ee=[];o.forEach(function(te,Ue){ee[1]=[{type:0,data:Qn(Ue)}],ee[2]=[{type:0,data:Qn(1)}],ee[3]=[{type:2,data:O5t(te)}],se[3].push({type:2,data:qi(ee)})})}U.messages[0].data=qi(se);var ie=Ox(O),Ee=Dx(ie);A.content=Ee,A.size=A.content.length})();var q=Rn(F[3][0].data);{var L=q[1][0];delete q[2];var M=Rn(L.data);{var z=lo(M[2][0].data);(function(){for(var A=vr.find(u,l[z].location),O=jc(_c(A.content)),U,Y=0;Y<O.length;++Y){var J=O[Y];J.id==z&&(U=J)}var se=Rn(U.messages[0].data);{delete se[6],delete q[7];var ee=new Uint8Array(se[5][0].data);se[5]=[];for(var ie=0,Ee=0;Ee<=n.e.r;++Ee){var te=Rn(ee);ie+=H5t(te,i[Ee],o),te[1][0].data=Qn(Ee),se[5].push({data:qi(te),type:2})}se[1]=[{type:0,data:Qn(n.e.c+1)}],se[2]=[{type:0,data:Qn(n.e.r+1)}],se[3]=[{type:0,data:Qn(ie)}],se[4]=[{type:0,data:Qn(n.e.r+1)}]}U.messages[0].data=qi(se);var Ue=Ox(O),W=Dx(Ue);A.content=W,A.size=A.content.length})()}L.data=qi(M)}F[3][0].data=qi(q)}v[4][0].data=qi(F)}h.messages[0].data=qi(v);var K=Ox(m),E=Dx(K);return f.content=E,f.size=f.content.length,u}function Gme(e){return function(r){for(var n=0;n!=e.length;++n){var a=e[n];r[a[0]]===void 0&&(r[a[0]]=a[1]),a[2]==="n"&&(r[a[0]]=Number(r[a[0]]))}}}function w7(e){Gme([["cellNF",!1],["cellHTML",!0],["cellFormula",!0],["cellStyles",!1],["cellText",!0],["cellDates",!1],["sheetStubs",!1],["sheetRows",0,"n"],["bookDeps",!1],["bookSheets",!1],["bookProps",!1],["bookFiles",!1],["bookVBA",!1],["password",""],["WTF",!1]])(e)}function j7(e){Gme([["cellDates",!1],["bookSST",!1],["bookType","xlsx"],["compression",!1],["WTF",!1]])(e)}function K5t(e){return hn.WS.indexOf(e)>-1?"sheet":e==hn.CS?"chart":e==hn.DS?"dialog":e==hn.MS?"macro":e&&e.length?e:"sheet"}function Y5t(e,t){if(!e)return 0;try{e=t.map(function(n){return n.id||(n.id=n.strRelID),[n.name,e["!id"][n.id].Target,K5t(e["!id"][n.id].Type)]})}catch{return null}return!e||e.length===0?null:e}function X5t(e,t,r,n,a,i,o,l,c,u,d,f){try{i[n]=Rw(Hl(e,r,!0),t);var m=qa(e,t),h;switch(l){case"sheet":h=jSt(m,t,a,c,i[n],u,d,f);break;case"chart":if(h=_St(m,t,a,c,i[n],u,d,f),!h||!h["!drawel"])break;var g=Jb(h["!drawel"].Target,t),p=gj(g),x=u2t(Hl(e,g,!0),Rw(Hl(e,p,!0),g)),v=Jb(x,g),b=gj(v);h=ZNt(Hl(e,v,!0),v,c,Rw(Hl(e,b,!0),v),u,h);break;case"macro":h=NSt(m,t,a,c,i[n],u,d,f);break;case"dialog":h=SSt(m,t,a,c,i[n],u,d,f);break;default:throw new Error("Unrecognized sheet type "+l)}o[n]=h;var y=[];i&&i[n]&&wa(i[n]).forEach(function(N){var _="";if(i[n][N].Type==hn.CMNT){_=Jb(i[n][N].Target,t);var j=ASt(qa(e,_,!0),_,c);if(!j||!j.length)return;jY(h,j,!1)}i[n][N].Type==hn.TCMNT&&(_=Jb(i[n][N].Target,t),y=y.concat(f2t(qa(e,_,!0),c)))}),y&&y.length&&jY(h,y,!0,c.people||[])}catch(N){if(c.WTF)throw N}}function bc(e){return e.charAt(0)=="/"?e.slice(1):e}function Kme(e,t){if(D1(),t=t||{},w7(t),Sc(e,"META-INF/manifest.xml")||Sc(e,"objectdata.xml"))return DY(e,t);if(Sc(e,"Index/Document.iwa")){if(typeof Uint8Array>"u")throw new Error("NUMBERS file parsing requires Uint8Array support");if(typeof MP<"u"){if(e.FileIndex)return MP(e);var r=vr.utils.cfb_new();return qK(e).forEach(function(C){un(r,C,hvt(e,C))}),MP(r)}throw new Error("Unsupported NUMBERS file")}if(!Sc(e,"[Content_Types].xml"))throw Sc(e,"index.xml.gz")?new Error("Unsupported NUMBERS 08 file"):Sc(e,"index.xml")?new Error("Unsupported NUMBERS 09 file"):new Error("Unsupported ZIP file");var n=qK(e),a=iyt(Hl(e,"[Content_Types].xml")),i=!1,o,l;if(a.workbooks.length===0&&(l="xl/workbook.xml",qa(e,l,!0)&&a.workbooks.push(l)),a.workbooks.length===0){if(l="xl/workbook.bin",!qa(e,l,!0))throw new Error("Could not find workbook");a.workbooks.push(l),i=!0}a.workbooks[0].slice(-3)=="bin"&&(i=!0);var c={},u={};if(!t.bookSheets&&!t.bookProps){if(Lw=[],a.sst)try{Lw=ESt(qa(e,bc(a.sst)),a.sst,t)}catch(C){if(t.WTF)throw C}t.cellStyles&&a.themes.length&&(c=CSt(Hl(e,a.themes[0].replace(/^\//,""),!0)||"",a.themes[0],t)),a.style&&(u=kSt(qa(e,bc(a.style)),a.style,c,t))}a.links.map(function(C){try{var R=Rw(Hl(e,gj(bc(C))),C);return PSt(qa(e,bc(C)),R,C,t)}catch{}});var d=wSt(qa(e,bc(a.workbooks[0])),a.workbooks[0],t),f={},m="";a.coreprops.length&&(m=qa(e,bc(a.coreprops[0]),!0),m&&(f=Phe(m)),a.extprops.length!==0&&(m=qa(e,bc(a.extprops[0]),!0),m&&hyt(m,f,t)));var h={};(!t.bookSheets||t.bookProps)&&a.custprops.length!==0&&(m=Hl(e,bc(a.custprops[0]),!0),m&&(h=pyt(m,t)));var g={};if((t.bookSheets||t.bookProps)&&(d.Sheets?o=d.Sheets.map(function(R){return R.name}):f.Worksheets&&f.SheetNames.length>0&&(o=f.SheetNames),t.bookProps&&(g.Props=f,g.Custprops=h),t.bookSheets&&typeof o<"u"&&(g.SheetNames=o),t.bookSheets?g.SheetNames:t.bookProps))return g;o={};var p={};t.bookDeps&&a.calcchain&&(p=TSt(qa(e,bc(a.calcchain)),a.calcchain));var x=0,v={},b,y;{var N=d.Sheets;f.Worksheets=N.length,f.SheetNames=[];for(var _=0;_!=N.length;++_)f.SheetNames[_]=N[_].name}var j=i?"bin":"xml",S=a.workbooks[0].lastIndexOf("/"),I=(a.workbooks[0].slice(0,S+1)+"_rels/"+a.workbooks[0].slice(S+1)+".rels").replace(/^\//,"");Sc(e,I)||(I="xl/_rels/workbook."+j+".rels");var P=Rw(Hl(e,I,!0),I.replace(/_rels.*/,"s5s"));(a.metadata||[]).length>=1&&(t.xlmeta=OSt(qa(e,bc(a.metadata[0])),a.metadata[0],t)),(a.people||[]).length>=1&&(t.people=m2t(qa(e,bc(a.people[0])),t)),P&&(P=Y5t(P,d.Sheets));var F=qa(e,"xl/worksheets/sheet.xml",!0)?1:0;e:for(x=0;x!=f.Worksheets;++x){var T="sheet";if(P&&P[x]?(b="xl/"+P[x][1].replace(/[\/]?xl\//,""),Sc(e,b)||(b=P[x][1]),Sc(e,b)||(b=I.replace(/_rels\/.*$/,"")+P[x][1]),T=P[x][2]):(b="xl/worksheets/sheet"+(x+1-F)+"."+j,b=b.replace(/sheet0\./,"sheet.")),y=b.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),t&&t.sheets!=null)switch(typeof t.sheets){case"number":if(x!=t.sheets)continue e;break;case"string":if(f.SheetNames[x].toLowerCase()!=t.sheets.toLowerCase())continue e;break;default:if(Array.isArray&&Array.isArray(t.sheets)){for(var k=!1,V=0;V!=t.sheets.length;++V)typeof t.sheets[V]=="number"&&t.sheets[V]==x&&(k=1),typeof t.sheets[V]=="string"&&t.sheets[V].toLowerCase()==f.SheetNames[x].toLowerCase()&&(k=1);if(!k)continue e}}X5t(e,b,y,f.SheetNames[x],x,v,o,T,t,d,c,u)}return g={Directory:a,Workbook:d,Props:f,Custprops:h,Deps:p,Sheets:o,SheetNames:f.SheetNames,Strings:Lw,Styles:u,Themes:c,SSF:xs(Nr)},t&&t.bookFiles&&(e.files?(g.keys=n,g.files=e.files):(g.keys=[],g.files={},e.FullPaths.forEach(function(C,R){C=C.replace(/^Root Entry[\/]/,""),g.keys.push(C),g.files[C]=e.FileIndex[R]}))),t&&t.bookVBA&&(a.vba.length>0?g.vbaraw=qa(e,bc(a.vba[0]),!0):a.defaults&&a.defaults.bin===j2t&&(g.vbaraw=qa(e,"xl/vbaProject.bin",!0))),g}function Z5t(e,t){var r=t||{},n="Workbook",a=vr.find(e,n);try{if(n="/!DataSpaces/Version",a=vr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);if(Dbt(a.content),n="/!DataSpaces/DataSpaceMap",a=vr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var i=Rbt(a.content);if(i.length!==1||i[0].comps.length!==1||i[0].comps[0].t!==0||i[0].name!=="StrongEncryptionDataSpace"||i[0].comps[0].v!=="EncryptedPackage")throw new Error("ECMA-376 Encrypted file bad "+n);if(n="/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace",a=vr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var o=Lbt(a.content);if(o.length!=1||o[0]!="StrongEncryptionTransform")throw new Error("ECMA-376 Encrypted file bad "+n);if(n="/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary",a=vr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);Mbt(a.content)}catch{}if(n="/EncryptionInfo",a=vr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);var l=$bt(a.content);if(n="/EncryptedPackage",a=vr.find(e,n),!a||!a.content)throw new Error("ECMA-376 Encrypted file missing "+n);if(l[0]==4&&typeof decrypt_agile<"u")return decrypt_agile(l[1],a.content,r.password||"",r);if(l[0]==2&&typeof decrypt_std76<"u")return decrypt_std76(l[1],a.content,r.password||"",r);throw new Error("File is password-protected")}function J5t(e,t){return t.bookType=="ods"?Hme(e,t):t.bookType=="numbers"?G5t(e,t):t.bookType=="xlsb"?Q5t(e,t):Yme(e,t)}function Q5t(e,t){lv=1024,e&&!e.SSF&&(e.SSF=xs(Nr)),e&&e.SSF&&(D1(),b_(e.SSF),t.revssf=oA(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,Fw?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r=t.bookType=="xlsb"?"bin":"xml",n=gme.indexOf(t.bookType)>-1,a=i7();j7(t=t||{});var i=UM(),o="",l=0;if(t.cellXfs=[],Lp(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),o="docProps/core.xml",un(i,o,Ohe(e.Props,t)),a.coreprops.push(o),ts(t.rels,2,o,hn.CORE_PROPS),o="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var c=[],u=0;u<e.SheetNames.length;++u)(e.Workbook.Sheets[u]||{}).Hidden!=2&&c.push(e.SheetNames[u]);e.Props.SheetNames=c}for(e.Props.Worksheets=e.Props.SheetNames.length,un(i,o,Rhe(e.Props)),a.extprops.push(o),ts(t.rels,3,o,hn.EXT_PROPS),e.Custprops!==e.Props&&wa(e.Custprops||{}).length>0&&(o="docProps/custom.xml",un(i,o,Lhe(e.Custprops)),a.custprops.push(o),ts(t.rels,4,o,hn.CUST_PROPS)),l=1;l<=e.SheetNames.length;++l){var d={"!id":{}},f=e.Sheets[e.SheetNames[l-1]],m=(f||{})["!type"]||"sheet";switch(m){case"chart":default:o="xl/worksheets/sheet"+l+"."+r,un(i,o,ISt(l-1,o,t,e,d)),a.sheets.push(o),ts(t.wbrels,-1,"worksheets/sheet"+l+"."+r,hn.WS[0])}if(f){var h=f["!comments"],g=!1,p="";h&&h.length>0&&(p="xl/comments"+l+"."+r,un(i,p,FSt(h,p)),a.comments.push(p),ts(d,-1,"../comments"+l+"."+r,hn.CMNT),g=!0),f["!legacy"]&&g&&un(i,"xl/drawings/vmlDrawing"+l+".vml",mme(l,f["!comments"])),delete f["!comments"],delete f["!legacy"]}d["!id"].rId1&&un(i,gj(o),Pv(d))}return t.Strings!=null&&t.Strings.length>0&&(o="xl/sharedStrings."+r,un(i,o,LSt(t.Strings,o,t)),a.strs.push(o),ts(t.wbrels,-1,"sharedStrings."+r,hn.SST)),o="xl/workbook."+r,un(i,o,DSt(e,o)),a.workbooks.push(o),ts(t.rels,1,o,hn.WB),o="xl/theme/theme1.xml",un(i,o,f7(e.Themes,t)),a.themes.push(o),ts(t.wbrels,-1,"theme/theme1.xml",hn.THEME),o="xl/styles."+r,un(i,o,RSt(e,o,t)),a.styles.push(o),ts(t.wbrels,-1,"styles."+r,hn.STY),e.vbaraw&&n&&(o="xl/vbaProject.bin",un(i,o,e.vbaraw),a.vba.push(o),ts(t.wbrels,-1,"vbaProject.bin",hn.VBA)),o="xl/metadata."+r,un(i,o,MSt(o)),a.metadata.push(o),ts(t.wbrels,-1,"metadata."+r,hn.XLMETA),un(i,"[Content_Types].xml",Ahe(a,t)),un(i,"_rels/.rels",Pv(t.rels)),un(i,"xl/_rels/workbook."+r+".rels",Pv(t.wbrels)),delete t.revssf,delete t.ssf,i}function Yme(e,t){lv=1024,e&&!e.SSF&&(e.SSF=xs(Nr)),e&&e.SSF&&(D1(),b_(e.SSF),t.revssf=oA(e.SSF),t.revssf[e.SSF[65535]]=0,t.ssf=e.SSF),t.rels={},t.wbrels={},t.Strings=[],t.Strings.Count=0,t.Strings.Unique=0,Fw?t.revStrings=new Map:(t.revStrings={},t.revStrings.foo=[],delete t.revStrings.foo);var r="xml",n=gme.indexOf(t.bookType)>-1,a=i7();j7(t=t||{});var i=UM(),o="",l=0;if(t.cellXfs=[],Lp(t.cellXfs,{},{revssf:{General:0}}),e.Props||(e.Props={}),o="docProps/core.xml",un(i,o,Ohe(e.Props,t)),a.coreprops.push(o),ts(t.rels,2,o,hn.CORE_PROPS),o="docProps/app.xml",!(e.Props&&e.Props.SheetNames))if(!e.Workbook||!e.Workbook.Sheets)e.Props.SheetNames=e.SheetNames;else{for(var c=[],u=0;u<e.SheetNames.length;++u)(e.Workbook.Sheets[u]||{}).Hidden!=2&&c.push(e.SheetNames[u]);e.Props.SheetNames=c}e.Props.Worksheets=e.Props.SheetNames.length,un(i,o,Rhe(e.Props)),a.extprops.push(o),ts(t.rels,3,o,hn.EXT_PROPS),e.Custprops!==e.Props&&wa(e.Custprops||{}).length>0&&(o="docProps/custom.xml",un(i,o,Lhe(e.Custprops)),a.custprops.push(o),ts(t.rels,4,o,hn.CUST_PROPS));var d=["SheetJ5"];for(t.tcid=0,l=1;l<=e.SheetNames.length;++l){var f={"!id":{}},m=e.Sheets[e.SheetNames[l-1]],h=(m||{})["!type"]||"sheet";switch(h){case"chart":default:o="xl/worksheets/sheet"+l+"."+r,un(i,o,Cme(l-1,t,e,f)),a.sheets.push(o),ts(t.wbrels,-1,"worksheets/sheet"+l+"."+r,hn.WS[0])}if(m){var g=m["!comments"],p=!1,x="";if(g&&g.length>0){var v=!1;g.forEach(function(b){b[1].forEach(function(y){y.T==!0&&(v=!0)})}),v&&(x="xl/threadedComments/threadedComment"+l+"."+r,un(i,x,h2t(g,d,t)),a.threadedcomments.push(x),ts(f,-1,"../threadedComments/threadedComment"+l+"."+r,hn.TCMNT)),x="xl/comments"+l+"."+r,un(i,x,pme(g)),a.comments.push(x),ts(f,-1,"../comments"+l+"."+r,hn.CMNT),p=!0}m["!legacy"]&&p&&un(i,"xl/drawings/vmlDrawing"+l+".vml",mme(l,m["!comments"])),delete m["!comments"],delete m["!legacy"]}f["!id"].rId1&&un(i,gj(o),Pv(f))}return t.Strings!=null&&t.Strings.length>0&&(o="xl/sharedStrings."+r,un(i,o,rme(t.Strings,t)),a.strs.push(o),ts(t.wbrels,-1,"sharedStrings."+r,hn.SST)),o="xl/workbook."+r,un(i,o,Dme(e)),a.workbooks.push(o),ts(t.rels,1,o,hn.WB),o="xl/theme/theme1.xml",un(i,o,f7(e.Themes,t)),a.themes.push(o),ts(t.wbrels,-1,"theme/theme1.xml",hn.THEME),o="xl/styles."+r,un(i,o,ume(e,t)),a.styles.push(o),ts(t.wbrels,-1,"styles."+r,hn.STY),e.vbaraw&&n&&(o="xl/vbaProject.bin",un(i,o,e.vbaraw),a.vba.push(o),ts(t.wbrels,-1,"vbaProject.bin",hn.VBA)),o="xl/metadata."+r,un(i,o,hme()),a.metadata.push(o),ts(t.wbrels,-1,"metadata."+r,hn.XLMETA),d.length>1&&(o="xl/persons/person.xml",un(i,o,p2t(d)),a.people.push(o),ts(t.wbrels,-1,"persons/person.xml",hn.PEOPLE)),un(i,"[Content_Types].xml",Ahe(a,t)),un(i,"_rels/.rels",Pv(t.rels)),un(i,"xl/_rels/workbook."+r+".rels",Pv(t.wbrels)),delete t.revssf,delete t.ssf,i}function _7(e,t){var r="";switch((t||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":r=ac(e.slice(0,12));break;case"binary":r=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(t&&t.type||"undefined"))}return[r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2),r.charCodeAt(3),r.charCodeAt(4),r.charCodeAt(5),r.charCodeAt(6),r.charCodeAt(7)]}function e4t(e,t){return vr.find(e,"EncryptedPackage")?Z5t(e,t):y7(e,t)}function t4t(e,t){var r,n=e,a=t||{};return a.type||(a.type=fn&&Buffer.isBuffer(e)?"buffer":"base64"),r=lhe(n,a),Kme(r,a)}function Xme(e,t){var r=0;e:for(;r<e.length;)switch(e.charCodeAt(r)){case 10:case 13:case 32:++r;break;case 60:return lI(e.slice(r),t);default:break e}return $y.to_workbook(e,t)}function r4t(e,t){var r="",n=_7(e,t);switch(t.type){case"base64":r=ac(e);break;case"binary":r=e;break;case"buffer":r=e.toString("binary");break;case"array":r=Ng(e);break;default:throw new Error("Unrecognized type "+t.type)}return n[0]==239&&n[1]==187&&n[2]==191&&(r=us(r)),t.type="binary",Xme(r,t)}function n4t(e,t){var r=e;return t.type=="base64"&&(r=ac(r)),r=Cn.utils.decode(1200,r.slice(2),"str"),t.type="binary",Xme(r,t)}function s4t(e){return e.match(/[^\x00-\x7F]/)?$d(e):e}function $P(e,t,r,n){return n?(r.type="string",$y.to_workbook(e,r)):$y.to_workbook(t,r)}function _j(e,t){aA();var r=t||{};if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer)return _j(new Uint8Array(e),(r=xs(r),r.type="array",r));typeof Uint8Array<"u"&&e instanceof Uint8Array&&!r.type&&(r.type=typeof Deno<"u"?"buffer":"array");var n=e,a=[0,0,0,0],i=!1;if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),Dv={},r.dateNF&&(Dv.dateNF=r.dateNF),r.type||(r.type=fn&&Buffer.isBuffer(e)?"buffer":"base64"),r.type=="file"&&(r.type=fn?"buffer":"binary",n=avt(e),typeof Uint8Array<"u"&&!fn&&(r.type="array")),r.type=="string"&&(i=!0,r.type="binary",r.codepage=65001,n=s4t(e)),r.type=="array"&&typeof Uint8Array<"u"&&e instanceof Uint8Array&&typeof ArrayBuffer<"u"){var o=new ArrayBuffer(3),l=new Uint8Array(o);if(l.foo="bar",!l.foo)return r=xs(r),r.type="array",_j(FM(n),r)}switch((a=_7(n,r))[0]){case 208:if(a[1]===207&&a[2]===17&&a[3]===224&&a[4]===161&&a[5]===177&&a[6]===26&&a[7]===225)return e4t(vr.read(n,r),r);break;case 9:if(a[1]<=8)return y7(n,r);break;case 60:return lI(n,r);case 73:if(a[1]===73&&a[2]===42&&a[3]===0)throw new Error("TIFF Image File is not a spreadsheet");if(a[1]===68)return gbt(n,r);break;case 84:if(a[1]===65&&a[2]===66&&a[3]===76)return eme.to_workbook(n,r);break;case 80:return a[1]===75&&a[2]<9&&a[3]<9?t4t(n,r):$P(e,n,r,i);case 239:return a[3]===60?lI(n,r):$P(e,n,r,i);case 255:if(a[1]===254)return n4t(n,r);if(a[1]===0&&a[2]===2&&a[3]===0)return X0.to_workbook(n,r);break;case 0:if(a[1]===0&&(a[2]>=2&&a[3]===0||a[2]===0&&(a[3]===8||a[3]===9)))return X0.to_workbook(n,r);break;case 3:case 131:case 139:case 140:return oI.to_workbook(n,r);case 123:if(a[1]===92&&a[2]===114&&a[3]===116)return ome.to_workbook(n,r);break;case 10:case 13:case 32:return r4t(n,r);case 137:if(a[1]===80&&a[2]===78&&a[3]===71)throw new Error("PNG Image File is not a spreadsheet");break}return pbt.indexOf(a[0])>-1&&a[2]<=12&&a[3]<=31?oI.to_workbook(n,r):$P(e,n,r,i)}function MY(e,t){var r=t||{};return r.type="file",_j(e,r)}function Zme(e,t){switch(t.type){case"base64":case"binary":break;case"buffer":case"array":t.type="";break;case"file":return w_(t.file,vr.write(e,{type:fn?"buffer":""}));case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");default:throw new Error("Unrecognized type "+t.type)}return vr.write(e,t)}function a4t(e,t){var r=xs(t||{}),n=J5t(e,r);return Jme(n,r)}function i4t(e,t){var r=xs(t||{}),n=Yme(e,r);return Jme(n,r)}function Jme(e,t){var r={},n=fn?"nodebuffer":typeof Uint8Array<"u"?"array":"string";if(t.compression&&(r.compression="DEFLATE"),t.password)r.type=n;else switch(t.type){case"base64":r.type="base64";break;case"binary":r.type="string";break;case"string":throw new Error("'string' output type invalid for '"+t.bookType+"' files");case"buffer":case"file":r.type=n;break;default:throw new Error("Unrecognized type "+t.type)}var a=e.FullPaths?vr.write(e,{fileType:"zip",type:{nodebuffer:"buffer",string:"binary"}[r.type]||r.type,compression:!!t.compression}):e.generate(r);if(typeof Deno<"u"&&typeof a=="string"){if(t.type=="binary"||t.type=="base64")return a;a=new Uint8Array(y_(a))}return t.password&&typeof encrypt_agile<"u"?Zme(encrypt_agile(a,t.password),t):t.type==="file"?w_(t.file,a):t.type=="string"?us(a):a}function o4t(e,t){var r=t||{},n=u5t(e,r);return Zme(n,r)}function _d(e,t,r){r||(r="");var n=r+e;switch(t.type){case"base64":return dj($d(n));case"binary":return $d(n);case"string":return e;case"file":return w_(t.file,n,"utf8");case"buffer":return fn?kh(n,"utf8"):typeof TextEncoder<"u"?new TextEncoder().encode(n):_d(n,{type:"binary"}).split("").map(function(a){return a.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function l4t(e,t){switch(t.type){case"base64":return dj(e);case"binary":return e;case"string":return e;case"file":return w_(t.file,e,"binary");case"buffer":return fn?kh(e,"binary"):e.split("").map(function(r){return r.charCodeAt(0)})}throw new Error("Unrecognized type "+t.type)}function RS(e,t){switch(t.type){case"string":case"base64":case"binary":for(var r="",n=0;n<e.length;++n)r+=String.fromCharCode(e[n]);return t.type=="base64"?dj(r):t.type=="string"?us(r):r;case"file":return w_(t.file,e);case"buffer":return e;default:throw new Error("Unrecognized type "+t.type)}}function N7(e,t){aA(),Ome(e);var r=xs(t||{});if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),r.type=="array"){r.type="binary";var n=N7(e,r);return r.type="array",y_(n)}return i4t(e,r)}function mA(e,t){aA(),Ome(e);var r=xs(t||{});if(r.cellStyles&&(r.cellNF=!0,r.sheetStubs=!0),r.type=="array"){r.type="binary";var n=mA(e,r);return r.type="array",y_(n)}var a=0;if(r.sheet&&(typeof r.sheet=="number"?a=r.sheet:a=e.SheetNames.indexOf(r.sheet),!e.SheetNames[a]))throw new Error("Sheet not found: "+r.sheet+" : "+typeof r.sheet);switch(r.bookType||"xlsb"){case"xml":case"xlml":return _d(n5t(e,r),r);case"slk":case"sylk":return _d(Qhe.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"htm":case"html":return _d(Ume(e.Sheets[e.SheetNames[a]],r),r);case"txt":return l4t(tpe(e.Sheets[e.SheetNames[a]],r),r);case"csv":return _d(k7(e.Sheets[e.SheetNames[a]],r),r,"\uFEFF");case"dif":return _d(eme.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"dbf":return RS(oI.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"prn":return _d($y.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"rtf":return _d(ome.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"eth":return _d(tme.from_sheet(e.Sheets[e.SheetNames[a]],r),r);case"fods":return _d(Hme(e,r),r);case"wk1":return RS(X0.sheet_to_wk1(e.Sheets[e.SheetNames[a]],r),r);case"wk3":return RS(X0.book_to_wk3(e,r),r);case"biff2":r.biff||(r.biff=2);case"biff3":r.biff||(r.biff=3);case"biff4":return r.biff||(r.biff=4),RS(Fme(e,r),r);case"biff5":r.biff||(r.biff=5);case"biff8":case"xla":case"xls":return r.biff||(r.biff=8),o4t(e,r);case"xlsx":case"xlsm":case"xlam":case"xlsb":case"numbers":case"ods":return a4t(e,r);default:throw new Error("Unrecognized bookType |"+r.bookType+"|")}}function S7(e){if(!e.bookType){var t={xls:"biff8",htm:"html",slk:"sylk",socialcalc:"eth",Sh33tJS:"WTF"},r=e.file.slice(e.file.lastIndexOf(".")).toLowerCase();r.match(/^\.[a-z]+$/)&&(e.bookType=r.slice(1)),e.bookType=t[e.bookType]||e.bookType}}function $Y(e,t,r){var n=r||{};return n.type="file",n.file=t,S7(n),mA(e,n)}function c4t(e,t,r){var n=r||{};return n.type="file",n.file=t,S7(n),N7(e,n)}function u4t(e,t,r,n){var a=r||{};a.type="file",a.file=e,S7(a),a.type="buffer";var i=n;return i instanceof Function||(i=r),Rm.writeFile(e,mA(t,a),i)}function Qme(e,t,r,n,a,i,o,l){var c=va(r),u=l.defval,d=l.raw||!Object.prototype.hasOwnProperty.call(l,"raw"),f=!0,m=a===1?[]:{};if(a!==1)if(Object.defineProperty)try{Object.defineProperty(m,"__rowNum__",{value:r,enumerable:!1})}catch{m.__rowNum__=r}else m.__rowNum__=r;if(!o||e[r])for(var h=t.s.c;h<=t.e.c;++h){var g=o?e[r][h]:e[n[h]+c];if(g===void 0||g.t===void 0){if(u===void 0)continue;i[h]!=null&&(m[i[h]]=u);continue}var p=g.v;switch(g.t){case"z":if(p==null)break;continue;case"e":p=p==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+g.t)}if(i[h]!=null){if(p==null)if(g.t=="e"&&p===null)m[i[h]]=null;else if(u!==void 0)m[i[h]]=u;else if(d&&p===null)m[i[h]]=null;else continue;else m[i[h]]=d&&(g.t!=="n"||g.t==="n"&&l.rawNumbers!==!1)?p:tf(g,p,l);p!=null&&(f=!1)}}return{row:m,isempty:f}}function Rk(e,t){if(e==null||e["!ref"]==null)return[];var r={t:"n",v:0},n=0,a=1,i=[],o=0,l="",c={s:{r:0,c:0},e:{r:0,c:0}},u=t||{},d=u.range!=null?u.range:e["!ref"];switch(u.header===1?n=1:u.header==="A"?n=2:Array.isArray(u.header)?n=3:u.header==null&&(n=0),typeof d){case"string":c=wn(d);break;case"number":c=wn(e["!ref"]),c.s.r=d;break;default:c=d}n>0&&(a=0);var f=va(c.s.r),m=[],h=[],g=0,p=0,x=Array.isArray(e),v=c.s.r,b=0,y={};x&&!e[v]&&(e[v]=[]);var N=u.skipHidden&&e["!cols"]||[],_=u.skipHidden&&e["!rows"]||[];for(b=c.s.c;b<=c.e.c;++b)if(!(N[b]||{}).hidden)switch(m[b]=zs(b),r=x?e[v][b]:e[m[b]+f],n){case 1:i[b]=b-c.s.c;break;case 2:i[b]=m[b];break;case 3:i[b]=u.header[b-c.s.c];break;default:if(r==null&&(r={w:"__EMPTY",t:"s"}),l=o=tf(r,null,u),p=y[o]||0,!p)y[o]=1;else{do l=o+"_"+p++;while(y[l]);y[o]=p,y[l]=1}i[b]=l}for(v=c.s.r+a;v<=c.e.r;++v)if(!(_[v]||{}).hidden){var j=Qme(e,c,v,m,n,i,x,u);(j.isempty===!1||(n===1?u.blankrows!==!1:u.blankrows))&&(h[g++]=j.row)}return h.length=g,h}var BY=/"/g;function epe(e,t,r,n,a,i,o,l){for(var c=!0,u=[],d="",f=va(r),m=t.s.c;m<=t.e.c;++m)if(n[m]){var h=l.dense?(e[r]||[])[m]:e[n[m]+f];if(h==null)d="";else if(h.v!=null){c=!1,d=""+(l.rawNumbers&&h.t=="n"?h.v:tf(h,null,l));for(var g=0,p=0;g!==d.length;++g)if((p=d.charCodeAt(g))===a||p===i||p===34||l.forceQuotes){d='"'+d.replace(BY,'""')+'"';break}d=="ID"&&(d='"ID"')}else h.f!=null&&!h.F?(c=!1,d="="+h.f,d.indexOf(",")>=0&&(d='"'+d.replace(BY,'""')+'"')):d="";u.push(d)}return l.blankrows===!1&&c?null:u.join(o)}function k7(e,t){var r=[],n=t??{};if(e==null||e["!ref"]==null)return"";var a=wn(e["!ref"]),i=n.FS!==void 0?n.FS:",",o=i.charCodeAt(0),l=n.RS!==void 0?n.RS:`
`,c=l.charCodeAt(0),u=new RegExp((i=="|"?"\\|":i)+"+$"),d="",f=[];n.dense=Array.isArray(e);for(var m=n.skipHidden&&e["!cols"]||[],h=n.skipHidden&&e["!rows"]||[],g=a.s.c;g<=a.e.c;++g)(m[g]||{}).hidden||(f[g]=zs(g));for(var p=0,x=a.s.r;x<=a.e.r;++x)(h[x]||{}).hidden||(d=epe(e,a,x,f,o,c,i,n),d!=null&&(n.strip&&(d=d.replace(u,"")),(d||n.blankrows!==!1)&&r.push((p++?l:"")+d)));return delete n.dense,r.join("")}function tpe(e,t){t||(t={}),t.FS=" ",t.RS=`
`;var r=k7(e,t);if(typeof Cn>"u"||t.type=="string")return r;var n=Cn.utils.encode(1200,r,"str");return"ÿþ"+n}function d4t(e){var t="",r,n="";if(e==null||e["!ref"]==null)return[];var a=wn(e["!ref"]),i="",o=[],l,c=[],u=Array.isArray(e);for(l=a.s.c;l<=a.e.c;++l)o[l]=zs(l);for(var d=a.s.r;d<=a.e.r;++d)for(i=va(d),l=a.s.c;l<=a.e.c;++l)if(t=o[l]+i,r=u?(e[d]||[])[l]:e[t],n="",r!==void 0){if(r.F!=null){if(t=r.F,!r.f)continue;n=r.f,t.indexOf(":")==-1&&(t=t+":"+t)}if(r.f!=null)n=r.f;else{if(r.t=="z")continue;if(r.t=="n"&&r.v!=null)n=""+r.v;else if(r.t=="b")n=r.v?"TRUE":"FALSE";else if(r.w!==void 0)n="'"+r.w;else{if(r.v===void 0)continue;r.t=="s"?n="'"+r.v:n=""+r.v}}c[c.length]=t+"="+n}return c}function rpe(e,t,r){var n=r||{},a=+!n.skipHeader,i=e||{},o=0,l=0;if(i&&n.origin!=null)if(typeof n.origin=="number")o=n.origin;else{var c=typeof n.origin=="string"?Qs(n.origin):n.origin;o=c.r,l=c.c}var u,d={s:{c:0,r:0},e:{c:l,r:o+t.length-1+a}};if(i["!ref"]){var f=wn(i["!ref"]);d.e.c=Math.max(d.e.c,f.e.c),d.e.r=Math.max(d.e.r,f.e.r),o==-1&&(o=f.e.r+1,d.e.r=o+t.length-1+a)}else o==-1&&(o=0,d.e.r=t.length-1+a);var m=n.header||[],h=0;t.forEach(function(p,x){wa(p).forEach(function(v){(h=m.indexOf(v))==-1&&(m[h=m.length]=v);var b=p[v],y="z",N="",_=Er({c:l+h,r:o+x+a});u=Nj(i,_),b&&typeof b=="object"&&!(b instanceof Date)?i[_]=b:(typeof b=="number"?y="n":typeof b=="boolean"?y="b":typeof b=="string"?y="s":b instanceof Date?(y="d",n.cellDates||(y="n",b=yi(b)),N=n.dateNF||Nr[14]):b===null&&n.nullError&&(y="e",b=0),u?(u.t=y,u.v=b,delete u.w,delete u.R,N&&(u.z=N)):i[_]=u={t:y,v:b},N&&(u.z=N))})}),d.e.c=Math.max(d.e.c,l+m.length-1);var g=va(o);if(a)for(h=0;h<m.length;++h)i[zs(h+l)+g]={t:"s",v:m[h]};return i["!ref"]=nn(d),i}function f4t(e,t){return rpe(null,e,t)}function Nj(e,t,r){if(typeof t=="string"){if(Array.isArray(e)){var n=Qs(t);return e[n.r]||(e[n.r]=[]),e[n.r][n.c]||(e[n.r][n.c]={t:"z"})}return e[t]||(e[t]={t:"z"})}return typeof t!="number"?Nj(e,Er(t)):Nj(e,Er({r:t,c:r||0}))}function h4t(e,t){if(typeof t=="number"){if(t>=0&&e.SheetNames.length>t)return t;throw new Error("Cannot find sheet # "+t)}else if(typeof t=="string"){var r=e.SheetNames.indexOf(t);if(r>-1)return r;throw new Error("Cannot find sheet name |"+t+"|")}else throw new Error("Cannot find sheet |"+t+"|")}function C7(){return{SheetNames:[],Sheets:{}}}function E7(e,t,r,n){var a=1;if(!r)for(;a<=65535&&e.SheetNames.indexOf(r="Sheet"+a)!=-1;++a,r=void 0);if(!r||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(n&&e.SheetNames.indexOf(r)>=0){var i=r.match(/(^.*?)(\d+)$/);a=i&&+i[2]||0;var o=i&&i[1]||r;for(++a;a<=65535&&e.SheetNames.indexOf(r=o+a)!=-1;++a);}if(Pme(r),e.SheetNames.indexOf(r)>=0)throw new Error("Worksheet with name |"+r+"| already exists!");return e.SheetNames.push(r),e.Sheets[r]=t,r}function m4t(e,t,r){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var n=h4t(e,t);switch(e.Workbook.Sheets[n]||(e.Workbook.Sheets[n]={}),r){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+r)}e.Workbook.Sheets[n].Hidden=r}function p4t(e,t){return e.z=t,e}function npe(e,t,r){return t?(e.l={Target:t},r&&(e.l.Tooltip=r)):delete e.l,e}function g4t(e,t,r){return npe(e,"#"+t,r)}function x4t(e,t,r){e.c||(e.c=[]),e.c.push({t,a:r||"SheetJS"})}function v4t(e,t,r,n){for(var a=typeof t!="string"?t:wn(t),i=typeof t=="string"?t:nn(t),o=a.s.r;o<=a.e.r;++o)for(var l=a.s.c;l<=a.e.c;++l){var c=Nj(e,o,l);c.t="n",c.F=i,delete c.v,o==a.s.r&&l==a.s.c&&(c.f=r,n&&(c.D=!0))}return e}var spe={encode_col:zs,encode_row:va,encode_cell:Er,encode_range:nn,decode_col:e7,decode_row:QM,split_cell:Fvt,decode_cell:Qs,decode_range:Go,format_cell:tf,sheet_add_aoa:jhe,sheet_add_json:rpe,sheet_add_dom:qme,aoa_to_sheet:R1,json_to_sheet:f4t,table_to_sheet:Vme,table_to_book:E5t,sheet_to_csv:k7,sheet_to_txt:tpe,sheet_to_json:Rk,sheet_to_html:Ume,sheet_to_formulae:d4t,sheet_to_row_object_array:Rk,sheet_get_cell:Nj,book_new:C7,book_append_sheet:E7,book_set_sheet_visibility:m4t,cell_set_number_format:p4t,cell_set_hyperlink:npe,cell_set_internal_link:g4t,cell_add_comment:x4t,sheet_set_array_formula:v4t,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}},pA;function y4t(e){pA=e}function b4t(e,t){var r=pA(),n=t??{};if(e==null||e["!ref"]==null)return r.push(null),r;var a=wn(e["!ref"]),i=n.FS!==void 0?n.FS:",",o=i.charCodeAt(0),l=n.RS!==void 0?n.RS:`
`,c=l.charCodeAt(0),u=new RegExp((i=="|"?"\\|":i)+"+$"),d="",f=[];n.dense=Array.isArray(e);for(var m=n.skipHidden&&e["!cols"]||[],h=n.skipHidden&&e["!rows"]||[],g=a.s.c;g<=a.e.c;++g)(m[g]||{}).hidden||(f[g]=zs(g));var p=a.s.r,x=!1,v=0;return r._read=function(){if(!x)return x=!0,r.push("\uFEFF");for(;p<=a.e.r;)if(++p,!(h[p-1]||{}).hidden&&(d=epe(e,a,p-1,f,o,c,i,n),d!=null&&(n.strip&&(d=d.replace(u,"")),d||n.blankrows!==!1)))return r.push((v++?l:"")+d);return r.push(null)},r}function w4t(e,t){var r=pA(),n=t||{},a=n.header!=null?n.header:$me,i=n.footer!=null?n.footer:Bme;r.push(a);var o=Go(e["!ref"]);n.dense=Array.isArray(e),r.push(zme(e,o,n));var l=o.s.r,c=!1;return r._read=function(){if(l>o.e.r)return c||(c=!0,r.push("</table>"+i)),r.push(null);for(;l<=o.e.r;){r.push(Mme(e,o,l,n)),++l;break}},r}function j4t(e,t){var r=pA({objectMode:!0});if(e==null||e["!ref"]==null)return r.push(null),r;var n={t:"n",v:0},a=0,i=1,o=[],l=0,c="",u={s:{r:0,c:0},e:{r:0,c:0}},d=t||{},f=d.range!=null?d.range:e["!ref"];switch(d.header===1?a=1:d.header==="A"?a=2:Array.isArray(d.header)&&(a=3),typeof f){case"string":u=wn(f);break;case"number":u=wn(e["!ref"]),u.s.r=f;break;default:u=f}a>0&&(i=0);var m=va(u.s.r),h=[],g=0,p=Array.isArray(e),x=u.s.r,v=0,b={};p&&!e[x]&&(e[x]=[]);var y=d.skipHidden&&e["!cols"]||[],N=d.skipHidden&&e["!rows"]||[];for(v=u.s.c;v<=u.e.c;++v)if(!(y[v]||{}).hidden)switch(h[v]=zs(v),n=p?e[x][v]:e[h[v]+m],a){case 1:o[v]=v-u.s.c;break;case 2:o[v]=h[v];break;case 3:o[v]=d.header[v-u.s.c];break;default:if(n==null&&(n={w:"__EMPTY",t:"s"}),c=l=tf(n,null,d),g=b[l]||0,!g)b[l]=1;else{do c=l+"_"+g++;while(b[c]);b[l]=g,b[c]=1}o[v]=c}return x=u.s.r+i,r._read=function(){for(;x<=u.e.r;)if(!(N[x-1]||{}).hidden){var _=Qme(e,u,x,h,a,o,p,d);if(++x,_.isempty===!1||(a===1?d.blankrows!==!1:d.blankrows)){r.push(_.row);return}}return r.push(null)},r}var _4t={to_json:j4t,to_html:w4t,to_csv:b4t,set_readable:y4t};const N4t=uj.version,ape=Object.freeze(Object.defineProperty({__proto__:null,CFB:vr,SSF:BM,parse_xlscfb:y7,parse_zip:Kme,read:_j,readFile:MY,readFileSync:MY,set_cptable:Ext,set_fs:nvt,stream:_4t,utils:spe,version:N4t,write:mA,writeFile:$Y,writeFileAsync:u4t,writeFileSync:$Y,writeFileXLSX:c4t,writeXLSX:N7},Symbol.toStringTag,{value:"Module"})),Nu=({value:e,onSave:t,type:r="text",className:n=""})=>{const[a,i]=w.useState(!1),[o,l]=w.useState(e||""),c=()=>{t(o),i(!1)},u=d=>{d.key==="Enter"&&r!=="textarea"&&c(),d.key==="Escape"&&(l(e||""),i(!1))};if(a)return r==="textarea"?s.jsx(gn,{value:o,onChange:d=>l(d.target.value),onBlur:c,onKeyDown:u,autoFocus:!0,className:"min-h-[60px] text-xs"}):s.jsx(Ye,{type:r==="url"?"text":r,value:o,onChange:d=>l(d.target.value),onBlur:c,onKeyDown:u,autoFocus:!0,className:`h-7 text-xs ${n}`});if(r==="url"&&e)return s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline truncate max-w-[150px]",title:e,children:[s.jsx(vs,{className:"h-3 w-3 inline mr-1"}),"Lien"]}),s.jsx("button",{onClick:()=>i(!0),className:"text-muted-foreground hover:text-foreground",children:"✎"})]});if(r==="date"&&e)try{const d=new Date(e);return s.jsx("div",{onClick:()=>i(!0),className:`cursor-pointer hover:bg-muted/50 rounded px-1 py-0.5 text-xs ${n}`,title:"Cliquer pour modifier",children:Ot(d,"dd/MM/yyyy",{locale:yr})})}catch{}return s.jsx("div",{onClick:()=>i(!0),className:`cursor-pointer hover:bg-muted/50 rounded px-1 py-0.5 min-h-[24px] ${n}`,title:"Cliquer pour modifier",children:e||s.jsx("span",{className:"text-muted-foreground italic text-xs",children:"-"})})},zY={new:{label:"Nouveau",variant:"default"},contacted:{label:"Contacté",variant:"secondary"},interested:{label:"Intéressé",variant:"outline"},converted:{label:"Converti",variant:"default"},not_interested:{label:"Pas intéressé",variant:"destructive"}},S4t=()=>{const e=e1(),t=w.useRef(null),[r,n]=w.useState([]),[a,i]=w.useState("all"),[o,l]=w.useState("all"),[c,u]=w.useState(!1),[d,f]=w.useState(!1),[m,h]=w.useState(!1),[g,p]=w.useState(""),[x,v]=w.useState(""),[b,y]=w.useState(""),[N,_]=w.useState({company_name:"",contact_name:"",contact_email:"",contact_phone:"",company_type:"school",city:"",sector:"",notes:"",position:"",offer_description:"",modality:"",offer_link:""}),{data:j=[],isLoading:S}=ga({queryKey:["prospects",a,o],queryFn:async()=>{let L=he.from("prospects").select("*").order("created_at",{ascending:!1});a!=="all"&&(L=L.eq("status",a)),o!=="all"&&(L=L.eq("company_type",o));const{data:M,error:z}=await L;if(z)throw z;return M}}),I=async L=>new Promise((M,z)=>{const K=new FileReader;K.onload=E=>{var A;try{const O=(A=E.target)==null?void 0:A.result,U=_j(O,{type:"binary"}),Y=U.SheetNames[0],J=U.Sheets[Y],se=spe.sheet_to_json(J,{header:1});if(se.length<2){z(new Error("Le fichier est vide"));return}const ee=se[0].map(Ue=>String(Ue||"").toLowerCase().trim()),ie=se.slice(1),Ee=Ue=>{if(!Ue)return null;if(!isNaN(Number(Ue))){const Z=BM.parse_date_code(Number(Ue));if(Z)return`${Z.y}-${String(Z.m).padStart(2,"0")}-${String(Z.d).padStart(2,"0")}`}const W=Ue.split("/");if(W.length===3){const[Z,le,re]=W;return`${re}-${le.padStart(2,"0")}-${Z.padStart(2,"0")}`}return null},te=ie.filter(Ue=>Ue.some(W=>W)).map(Ue=>{const W={company_type:"school"};return ee.forEach((Z,le)=>{const re=Ue[le]?String(Ue[le]).trim():"";Z.includes("ecole")||Z.includes("école")?W.company_name=re:Z.includes("nom prenom")||Z.includes("responsable")?W.contact_name=re:Z.includes("email")?W.contact_email=re.replace(/mailto:/g,"").replace(/[\[\]<>]/g,"").split(",")[0].trim():Z.includes("tel")?W.contact_phone=re:Z.includes("desc")&&Z.includes("poste")?W.position=re:Z==="offres"||Z.includes("offre")&&!Z.includes("lien")&&!Z.includes("date")&&!Z.includes("lieu")?W.offer_description=re:Z.includes("lieu")?W.city=re:Z.includes("mode")?W.modality=re:Z.includes("lien")&&Z.includes("offre")?W.offer_link=re:Z.includes("date")&&Z.includes("offre")?W.offer_date=re?Ee(re):null:Z.includes("invitation")&&Z.includes("accept")?W.linkedin_invitation_accepted=re.toLowerCase()==="oui"||re==="1":Z.includes("linkedin")||Z.includes("message")&&Z.includes("linkedin")?W.linkedin_message_sent=re.toLowerCase()==="oui"||re==="1":Z.includes("mail envoyé")||Z==="mail envoyé"?W.email_sent=re.toLowerCase()==="oui"||re==="1":Z.includes("date")&&Z.includes("envoi")?W.last_send_date=re?Ee(re):null:(Z.includes("remarque")||Z.includes("note"))&&(W.notes=re)}),W}).filter(Ue=>Ue.company_name||Ue.contact_email);M(te)}catch(O){z(O)}},K.onerror=()=>z(new Error("Erreur de lecture du fichier")),K.readAsBinaryString(L)}),P=Ic({mutationFn:async L=>{const M=await I(L);if(M.length===0)throw new Error("Aucun prospect valide trouvé");const z=crypto.randomUUID(),{error:K}=await he.from("prospects").insert(M.map(E=>({...E,source:"import",import_batch_id:z})));if(K)throw K;return M.length},onSuccess:L=>{ae.success(`${L} prospects importés avec succès`),e.invalidateQueries({queryKey:["prospects"]})},onError:L=>{ae.error(L.message||"Erreur lors de l'import")}}),F=Ic({mutationFn:async L=>{const{data:M,error:z}=await he.functions.invoke("extract-offer-from-linkedin",{body:{postText:L}});if(z)throw z;return M.offer},onSuccess:L=>{_({company_name:L.school_name||"",contact_name:L.contact_name||"",contact_email:L.contact_email||"",contact_phone:"",company_type:"school",city:L.city||"",sector:"",notes:"",position:"",offer_description:L.description||"",modality:L.modality||"",offer_link:""}),h(!1),f(!0),y(""),ae.success("Données extraites du post LinkedIn")},onError:L=>{ae.error(L.message||"Erreur lors de l'extraction")}}),T=Ic({mutationFn:async L=>{const{error:M}=await he.from("prospects").insert({...L,source:"manual"});if(M)throw M},onSuccess:()=>{ae.success("Prospect ajouté"),e.invalidateQueries({queryKey:["prospects"]}),f(!1),_({company_name:"",contact_name:"",contact_email:"",contact_phone:"",company_type:"school",city:"",sector:"",notes:"",position:"",offer_description:"",modality:"",offer_link:""})},onError:()=>{ae.error("Erreur lors de l'ajout")}}),k=Ic({mutationFn:async({id:L,updates:M})=>{const{error:z}=await he.from("prospects").update({...M,updated_at:new Date().toISOString()}).eq("id",L);if(z)throw z},onSuccess:()=>{e.invalidateQueries({queryKey:["prospects"]})}}),V=Ic({mutationFn:async({prospectIds:L,subject:M,content:z})=>{const{data:K,error:E}=await he.functions.invoke("send-prospection-emails",{body:{prospectIds:L,subject:M,content:z}});if(E)throw E;return K},onSuccess:L=>{ae.success(`${L.successCount} emails envoyés avec succès`),e.invalidateQueries({queryKey:["prospects"]}),u(!1),n([]),p(""),v("")},onError:()=>{ae.error("Erreur lors de l'envoi des emails")}}),C=L=>{var z;const M=(z=L.target.files)==null?void 0:z[0];M&&P.mutate(M),t.current&&(t.current.value="")},R=()=>{r.length===j.length?n([]):n(j.map(L=>L.id))},H=L=>{n(M=>M.includes(L)?M.filter(z=>z!==L):[...M,L])},q={total:j.length,schools:j.filter(L=>L.company_type==="school").length,enterprises:j.filter(L=>L.company_type==="enterprise").length,contacted:j.filter(L=>L.status==="contacted"||L.email_sent||L.linkedin_message_sent).length};return s.jsxs("div",{className:"container mx-auto py-8 px-4",children:[s.jsx(sa,{items:[{label:"Admin",href:"/admin"},{label:"Prospection"}]}),s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold",children:"Prospection"}),s.jsx("p",{className:"text-muted-foreground",children:"Gérez vos prospects écoles et entreprises"})]}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsx("input",{ref:t,type:"file",accept:".csv,.txt,.xlsx,.xls",className:"hidden",onChange:C}),s.jsxs(ne,{variant:"outline",onClick:()=>{var L;return(L=t.current)==null?void 0:L.click()},disabled:P.isPending,children:[s.jsx(nc,{className:"h-4 w-4 mr-2"}),"Import Excel"]}),s.jsxs(Hn,{open:m,onOpenChange:h,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{variant:"outline",children:[s.jsx(Mu,{className:"h-4 w-4 mr-2"}),"Import LinkedIn"]})}),s.jsxs(qn,{className:"max-w-2xl",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Importer depuis LinkedIn"}),s.jsx(Ia,{children:"Collez le texte d'un post LinkedIn pour extraire automatiquement les informations du prospect"})]}),s.jsx("div",{className:"py-4",children:s.jsx(gn,{placeholder:"Collez ici le contenu du post LinkedIn...",value:b,onChange:L=>y(L.target.value),className:"min-h-[200px]"})}),s.jsx(Jl,{children:s.jsx(ne,{onClick:()=>F.mutate(b),disabled:!b.trim()||F.isPending,children:F.isPending?"Extraction...":"Extraire les infos"})})]})]}),s.jsxs(Hn,{open:d,onOpenChange:f,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(Ya,{className:"h-4 w-4 mr-2"}),"Ajouter"]})}),s.jsxs(qn,{className:"max-w-2xl",children:[s.jsx(Gn,{children:s.jsx(Kn,{children:"Ajouter un prospect"})}),s.jsxs("div",{className:"grid gap-4 py-4 max-h-[60vh] overflow-y-auto",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Ye,{placeholder:"Nom de l'école/entreprise *",value:N.company_name,onChange:L=>_(M=>({...M,company_name:L.target.value}))}),s.jsxs(Lr,{value:N.company_type,onValueChange:L=>_(M=>({...M,company_type:L})),children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"school",children:"École"}),s.jsx(ot,{value:"enterprise",children:"Entreprise"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Ye,{placeholder:"Nom du contact",value:N.contact_name,onChange:L=>_(M=>({...M,contact_name:L.target.value}))}),s.jsx(Ye,{placeholder:"Poste/Fonction",value:N.position,onChange:L=>_(M=>({...M,position:L.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Ye,{type:"email",placeholder:"Email",value:N.contact_email,onChange:L=>_(M=>({...M,contact_email:L.target.value}))}),s.jsx(Ye,{placeholder:"Téléphone",value:N.contact_phone,onChange:L=>_(M=>({...M,contact_phone:L.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Ye,{placeholder:"Ville",value:N.city,onChange:L=>_(M=>({...M,city:L.target.value}))}),s.jsx(Ye,{placeholder:"Modalité (présentiel, distanciel...)",value:N.modality,onChange:L=>_(M=>({...M,modality:L.target.value}))})]}),s.jsx(Ye,{placeholder:"Lien de l'offre",value:N.offer_link,onChange:L=>_(M=>({...M,offer_link:L.target.value}))}),s.jsx(gn,{placeholder:"Description de l'offre",value:N.offer_description,onChange:L=>_(M=>({...M,offer_description:L.target.value})),className:"min-h-[100px]"}),s.jsx(gn,{placeholder:"Notes/Remarques",value:N.notes,onChange:L=>_(M=>({...M,notes:L.target.value}))})]}),s.jsx(Jl,{children:s.jsx(ne,{onClick:()=>T.mutate(N),disabled:!N.company_name||T.isPending,children:"Ajouter"})})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5 text-primary"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:q.total}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Total"})]})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Lj,{className:"h-5 w-5 text-blue-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:q.schools}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Écoles"})]})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5 text-green-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:q.enterprises}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Entreprises"})]})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Fn,{className:"h-5 w-5 text-orange-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-2xl font-bold",children:q.contacted}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Contactés"})]})]})})})]}),s.jsx(ke,{className:"mb-6",children:s.jsx(Ae,{className:"pt-6",children:s.jsxs("div",{className:"flex flex-wrap gap-4 items-center justify-between",children:[s.jsxs("div",{className:"flex gap-4 items-center",children:[s.jsx(hR,{className:"h-4 w-4 text-muted-foreground"}),s.jsxs(Lr,{value:a,onValueChange:i,children:[s.jsx(Ar,{className:"w-[150px]",children:s.jsx(Br,{placeholder:"Statut"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les statuts"}),s.jsx(ot,{value:"new",children:"Nouveau"}),s.jsx(ot,{value:"contacted",children:"Contacté"}),s.jsx(ot,{value:"interested",children:"Intéressé"}),s.jsx(ot,{value:"converted",children:"Converti"}),s.jsx(ot,{value:"not_interested",children:"Pas intéressé"})]})]}),s.jsxs(Lr,{value:o,onValueChange:l,children:[s.jsx(Ar,{className:"w-[150px]",children:s.jsx(Br,{placeholder:"Type"})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"all",children:"Tous les types"}),s.jsx(ot,{value:"school",children:"Écoles"}),s.jsx(ot,{value:"enterprise",children:"Entreprises"})]})]})]}),r.length>0&&s.jsxs(Hn,{open:c,onOpenChange:u,children:[s.jsx(ml,{asChild:!0,children:s.jsxs(ne,{children:[s.jsx(ta,{className:"h-4 w-4 mr-2"}),"Envoyer email (",r.length,")"]})}),s.jsxs(qn,{className:"max-w-2xl",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Envoyer un email"}),s.jsxs(Ia,{children:["Cet email sera envoyé à ",r.length," prospect(s)"]})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsx(Ye,{placeholder:"Sujet de l'email",value:g,onChange:L=>p(L.target.value)}),s.jsx(gn,{placeholder:`Contenu de l'email (HTML supporté)
Variables disponibles:
{{company_name}} - Nom de l'entreprise
{{contact_name}} - Nom du contact`,value:x,onChange:L=>v(L.target.value),className:"min-h-[200px]"})]}),s.jsx(Jl,{children:s.jsx(ne,{onClick:()=>V.mutate({prospectIds:r,subject:g,content:x}),disabled:!g||!x||V.isPending,children:V.isPending?"Envoi en cours...":"Envoyer"})})]})]})]})})}),s.jsx(ke,{children:s.jsx(Ae,{className:"p-0 overflow-x-auto",children:s.jsxs(gh,{children:[s.jsx(xh,{children:s.jsxs(Oa,{children:[s.jsx(pr,{className:"w-10",children:s.jsx(Vo,{checked:r.length===j.length&&j.length>0,onCheckedChange:R})}),s.jsx(pr,{className:"min-w-[180px]",children:"École"}),s.jsx(pr,{className:"min-w-[150px]",children:"Contact"}),s.jsx(pr,{className:"min-w-[100px]",children:"Poste"}),s.jsx(pr,{className:"min-w-[200px]",children:"Offre"}),s.jsx(pr,{className:"min-w-[100px]",children:"Lieu"}),s.jsx(pr,{className:"min-w-[80px]",children:"Mode"}),s.jsx(pr,{className:"min-w-[80px]",children:"Lien"}),s.jsx(pr,{className:"min-w-[150px]",children:"Remarques"}),s.jsx(pr,{className:"min-w-[100px]",children:"Statut"}),s.jsx(pr,{className:"text-center w-16",children:s.jsx(Mu,{className:"h-4 w-4 inline"})}),s.jsx(pr,{className:"text-center w-16",children:s.jsx(Fn,{className:"h-4 w-4 inline"})}),s.jsxs(pr,{className:"w-20",children:[s.jsx(Bs,{className:"h-4 w-4 inline"})," Envoi"]})]})}),s.jsx(vh,{children:S?s.jsx(Oa,{children:s.jsx(ur,{colSpan:13,className:"text-center py-8",children:"Chargement..."})}):j.length===0?s.jsx(Oa,{children:s.jsx(ur,{colSpan:13,className:"text-center py-8 text-muted-foreground",children:"Aucun prospect. Importez un fichier Excel ou ajoutez manuellement."})}):j.map(L=>{var M,z;return s.jsxs(Oa,{children:[s.jsx(ur,{children:s.jsx(Vo,{checked:r.includes(L.id),onCheckedChange:()=>H(L.id)})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.company_name,onSave:K=>k.mutate({id:L.id,updates:{company_name:K}}),className:"font-medium"})}),s.jsx(ur,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsx(Nu,{value:L.contact_name,onSave:K=>k.mutate({id:L.id,updates:{contact_name:K}}),className:"font-medium text-xs"}),s.jsx(Nu,{value:L.contact_email,onSave:K=>k.mutate({id:L.id,updates:{contact_email:K}}),type:"email",className:"text-xs text-muted-foreground"}),s.jsx(Nu,{value:L.contact_phone,onSave:K=>k.mutate({id:L.id,updates:{contact_phone:K}}),type:"tel",className:"text-xs text-muted-foreground"})]})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.position,onSave:K=>k.mutate({id:L.id,updates:{position:K}}),className:"text-xs"})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.offer_description,onSave:K=>k.mutate({id:L.id,updates:{offer_description:K}}),type:"textarea",className:"text-xs max-w-[200px] line-clamp-3"})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.city,onSave:K=>k.mutate({id:L.id,updates:{city:K}}),className:"text-xs"})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.modality,onSave:K=>k.mutate({id:L.id,updates:{modality:K}}),className:"text-xs"})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.offer_link,onSave:K=>k.mutate({id:L.id,updates:{offer_link:K}}),type:"url",className:"text-xs"})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.notes,onSave:K=>k.mutate({id:L.id,updates:{notes:K}}),type:"textarea",className:"text-xs max-w-[150px]"})}),s.jsx(ur,{children:s.jsxs(Lr,{value:L.status,onValueChange:K=>k.mutate({id:L.id,updates:{status:K}}),children:[s.jsx(Ar,{className:"w-[100px] h-7 text-xs",children:s.jsx(Le,{variant:((M=zY[L.status])==null?void 0:M.variant)||"default",className:"text-[10px]",children:((z=zY[L.status])==null?void 0:z.label)||L.status})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"new",children:"Nouveau"}),s.jsx(ot,{value:"contacted",children:"Contacté"}),s.jsx(ot,{value:"interested",children:"Intéressé"}),s.jsx(ot,{value:"converted",children:"Converti"}),s.jsx(ot,{value:"not_interested",children:"Pas intéressé"})]})]})}),s.jsx(ur,{className:"text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx("button",{onClick:()=>k.mutate({id:L.id,updates:{linkedin_invitation_accepted:!L.linkedin_invitation_accepted}}),className:`p-1 rounded ${L.linkedin_invitation_accepted?"text-green-600":"text-muted-foreground"}`,title:"Invitation acceptée",children:L.linkedin_invitation_accepted?s.jsx(Pn,{className:"h-4 w-4"}):s.jsx(Ri,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>k.mutate({id:L.id,updates:{linkedin_message_sent:!L.linkedin_message_sent}}),className:`p-1 rounded text-[10px] ${L.linkedin_message_sent?"text-blue-600 font-medium":"text-muted-foreground"}`,title:"Message LinkedIn envoyé",children:"MSG"})]})}),s.jsx(ur,{className:"text-center",children:s.jsx("button",{onClick:()=>k.mutate({id:L.id,updates:{email_sent:!L.email_sent}}),className:`p-1 rounded ${L.email_sent?"text-green-600":"text-muted-foreground"}`,title:"Email envoyé",children:L.email_sent?s.jsx(Pn,{className:"h-4 w-4"}):s.jsx(Ri,{className:"h-4 w-4"})})}),s.jsx(ur,{children:s.jsx(Nu,{value:L.last_send_date,onSave:K=>k.mutate({id:L.id,updates:{last_send_date:K||null}}),type:"date",className:"text-xs"})})]},L.id)})})]})})})]})},tm="__all__";function k4t(e){const t=[];let r="",n=[],a=!1;for(let i=0;i<e.length;i++){const o=e[i];a?o==='"'?e[i+1]==='"'?(r+='"',i++):a=!1:r+=o:o==='"'?a=!0:o===","?(n.push(r),r=""):o===`
`?(n.push(r),r="",t.push(n),n=[]):o==="\r"||(r+=o)}return(r.length>0||n.length>0)&&(n.push(r),t.push(n)),t.filter(i=>i.some(o=>o.trim()!==""))}function C4t(e){return e?e.split(/[,;/]/).map(t=>t.trim()).filter(Boolean):[]}function E4t(){const e=Xt(),{isAdmin:t,loading:r}=Ur(),[n,a]=w.useState(!0),[i,o]=w.useState([]),[l,c]=w.useState([]),[u,d]=w.useState(!1),[f,m]=w.useState(!1),[h,g]=w.useState(!1),[p,x]=w.useState(null),[v,b]=w.useState(""),[y,N]=w.useState(""),[_,j]=w.useState("both"),[S,I]=w.useState(tm),[P,F]=w.useState(tm);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{t&&T()},[t]);const T=async()=>{try{const[z,K]=await Promise.all([he.from("trainer_profiles").select("name, email, preferred_cities, specialties"),he.from("trainer_contacts").select("email, first_name, city, modules").eq("unsubscribed",!1)]);if(z.error)throw z.error;if(K.error)throw K.error;o((z.data||[]).filter(E=>E.email).map(E=>({email:E.email,first_name:(E.name||"").split(" ")[0],source:"signed_up",cities:(E.preferred_cities||[]).filter(Boolean),modules:(E.specialties||[]).filter(Boolean)}))),c((K.data||[]).map(E=>({email:E.email,first_name:E.first_name||void 0,source:"imported",cities:E.city?[E.city]:[],modules:C4t(E.modules)})))}catch(z){console.error("Error loading mailing data:",z),ae.error("Erreur lors du chargement des destinataires")}finally{a(!1)}},k=async z=>{m(!0);try{const K=await z.text(),E=k4t(K);if(E.length<2)throw new Error("CSV vide ou invalide");const A=E[0].map(le=>le.trim().toLowerCase()),O=le=>A.findIndex(re=>le.some(oe=>re.includes(oe))),U=O(["email","mail"]),Y=O(["nom"]),J=O(["prénom","prenom"]),se=O(["téléphone","telephone","phone"]),ee=O(["nda"]),ie=O(["ville","city"]),Ee=O(["pays","country"]),te=O(["module","intervention"]);if(U===-1)throw new Error("Colonne Email introuvable dans le CSV");const Ue=new Set,W=E.slice(1).map(le=>({email:(le[U]||"").trim().toLowerCase(),last_name:Y>-1&&(le[Y]||"").trim()||null,first_name:J>-1&&(le[J]||"").trim()||null,phone:se>-1&&(le[se]||"").trim()||null,has_nda:ee>-1?/oui|yes|true/i.test(le[ee]||""):null,city:ie>-1&&(le[ie]||"").trim()||null,country:Ee>-1&&(le[Ee]||"").trim()||null,modules:te>-1&&(le[te]||"").trim()||null,source:"csv_import"})).filter(le=>!le.email||!le.email.includes("@")||Ue.has(le.email)?!1:(Ue.add(le.email),!0));if(W.length===0)throw new Error("Aucun email valide trouvé");let Z=0;for(let le=0;le<W.length;le+=200){const re=W.slice(le,le+200),{error:oe}=await he.from("trainer_contacts").upsert(re,{onConflict:"email"});if(oe)throw oe;Z+=re.length}ae.success(`${Z} formateurs importés`),await T()}catch(K){console.error("CSV import error:",K),ae.error(K instanceof Error?K.message:"Erreur lors de l'import")}finally{m(!1)}},V=()=>_==="signed_up"?i:_==="imported"?l:[...i,...l],C=z=>Array.from(new Set(z.map(K=>K.trim()).filter(Boolean))).sort((K,E)=>K.localeCompare(E,"fr")),R=C(V().flatMap(z=>z.cities)),H=C(V().flatMap(z=>z.modules)),q=()=>{const z=new Map;for(const K of V()){if(S!==tm&&!K.cities.some(O=>O.toLowerCase()===S.toLowerCase()))continue;if(P!==tm){const A=P.toLowerCase();if(!K.modules.some(U=>U.toLowerCase().includes(A)))continue}const E=K.email.trim().toLowerCase();E&&!z.has(E)&&z.set(E,{...K,email:K.email.trim()})}return Array.from(z.values())},L=q().length,M=async()=>{if(!v.trim()||!y.trim()){ae.error("Veuillez remplir le sujet et le contenu");return}const z=q();if(z.length===0){ae.error("Aucun destinataire");return}if(!confirm(`Envoyer cet email à ${z.length} formateurs ?`))return;d(!0),x(null);let K=0,E=0;const A=40,O=Math.ceil(z.length/A),U=[_,S!==tm?`ville:${S}`:null,P!==tm?`module:${P}`:null].filter(Boolean).join(" ");try{for(let Y=0;Y<z.length;Y+=A){const J=z.slice(Y,Y+A).map(Ee=>({email:Ee.email,first_name:Ee.first_name})),se=Y+A>=z.length;x(`Envoi ${Math.floor(Y/A)+1}/${O}…`);const{data:ee,error:ie}=await he.functions.invoke("send-trainer-mailing",{body:{subject:v,content:y,recipients:J,audience:U,logTotals:se?{recipients:z.length,success:K,failed:E}:void 0}});if(ie)throw ie;K+=(ee==null?void 0:ee.successCount)||0,E+=(ee==null?void 0:ee.failedCount)||0}ae.success(`Email envoyé : ${K} réussis${E?`, ${E} échecs`:""}`),b(""),N("")}catch(Y){console.error("Error sending mailing:",Y),ae.error("Erreur lors de l'envoi")}finally{d(!1),x(null)}};return r||n?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsx("div",{className:"min-h-screen bg-background py-12 px-4",children:s.jsxs("div",{className:"container max-w-6xl mx-auto",children:[s.jsx(sa,{items:[{label:"Emailing formateurs"}]}),s.jsx("h1",{className:"text-4xl font-bold mb-8",children:"Emailing Formateurs"}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(s2,{className:"h-5 w-5"}),"Formateurs inscrits"]})}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-4xl font-bold",children:i.length}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"comptes créés sur la plateforme"})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Lve,{className:"h-5 w-5"}),"Liste importée"]})}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-4xl font-bold",children:l.length}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"contacts du fichier formateurs"})]})]}),s.jsxs(ke,{children:[s.jsx(ht,{children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(sr,{className:"h-5 w-5"}),"Destinataires ciblés"]})}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-4xl font-bold",children:L}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"uniques (après filtres)"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Composer un email"}),s.jsx(Qr,{children:"Envoyé depuis contact@qalamsoftware.com via le relais SMTP"})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(We,{htmlFor:"subject",children:"Sujet *"}),s.jsx(Ye,{id:"subject",value:v,onChange:z=>b(z.target.value),placeholder:"📣 Une nouvelle opportunité de formation"})]}),s.jsxs("div",{children:[s.jsx(We,{htmlFor:"content",children:"Contenu *"}),s.jsx(gn,{id:"content",value:y,onChange:z=>N(z.target.value),placeholder:`Bonjour,
Nous avons de nouvelles missions...`,rows:11,className:"font-mono text-sm"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Le prénom est ajouté automatiquement en début d'email quand il est connu. HTML basique accepté."})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{children:[s.jsx(We,{children:"Audience"}),s.jsxs(Lr,{value:_,onValueChange:z=>j(z),children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:"both",children:"Tous"}),s.jsx(ot,{value:"signed_up",children:"Inscrits"}),s.jsx(ot,{value:"imported",children:"Liste importée"})]})]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Ville"}),s.jsxs(Lr,{value:S,onValueChange:I,children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:tm,children:"Toutes"}),R.map(z=>s.jsx(ot,{value:z,children:z},z))]})]})]}),s.jsxs("div",{children:[s.jsx(We,{children:"Module"}),s.jsxs(Lr,{value:P,onValueChange:F,children:[s.jsx(Ar,{children:s.jsx(Br,{})}),s.jsxs(Tr,{children:[s.jsx(ot,{value:tm,children:"Tous"}),H.map(z=>s.jsx(ot,{value:z,children:z},z))]})]})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:()=>g(!0),disabled:!v||!y,children:[s.jsx(is,{className:"mr-2 h-4 w-4"}),"Aperçu"]}),s.jsx(ne,{onClick:M,disabled:u||!v||!y||L===0,className:"flex-1",children:u?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),p||"Envoi en cours…"]}):s.jsxs(s.Fragment,{children:[s.jsx(ta,{className:"mr-2 h-4 w-4"}),"Envoyer à ",L," formateurs"]})})]})]})]}),s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsx(xt,{children:"Importer une liste (CSV)"}),s.jsx(Qr,{children:'Importez le fichier "Tableau formateurs" (colonnes Nom, Prénom, Email, Téléphone, NDA, Ville, Pays, Module). Les emails déjà présents sont mis à jour, pas dupliqués.'})]}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsxs("div",{className:"p-3 bg-muted/50 border rounded-md",children:[s.jsx(We,{htmlFor:"csv-upload",className:"text-sm font-medium mb-2 block",children:"Fichier CSV"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ye,{id:"csv-upload",type:"file",accept:".csv,text/csv",disabled:f,onChange:z=>{var E;const K=(E=z.target.files)==null?void 0:E[0];K&&k(K),z.target.value=""}}),f&&s.jsx(at,{className:"w-5 h-5 animate-spin text-primary"})]}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[s.jsx(nc,{className:"inline h-3 w-3 mr-1"}),"Le fichier est traité dans votre navigateur puis enregistré dans la base."]})]}),s.jsxs("div",{className:"text-sm text-muted-foreground",children:[s.jsx("p",{className:"font-medium text-foreground mb-1",children:"Aperçu de la liste importée"}),s.jsxs("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[l.slice(0,12).map(z=>s.jsxs("div",{className:"flex items-center justify-between p-2 rounded border",children:[s.jsx("span",{className:"truncate",children:z.email}),z.first_name&&s.jsx(Le,{variant:"secondary",className:"text-xs",children:z.first_name})]},z.email)),l.length===0&&s.jsx("p",{className:"text-center py-4",children:"Aucun contact importé pour l'instant"}),l.length>12&&s.jsxs("p",{className:"text-center text-xs pt-1",children:["… et ",l.length-12," autres"]})]})]})]})]})]}),s.jsx(Hn,{open:h,onOpenChange:g,children:s.jsxs(qn,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[s.jsxs(Gn,{children:[s.jsx(Kn,{children:"Aperçu de l'email"}),s.jsx(Ia,{children:"Ce que les formateurs recevront"})]}),s.jsxs("div",{className:"border rounded-lg p-6 bg-muted/30",children:[s.jsxs("div",{className:"text-center mb-6 pb-4 border-b",children:[s.jsx("div",{className:"text-2xl font-bold text-primary mb-1",children:"📚 PedagoBridge"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Le réseau des formateurs"})]}),s.jsx("h1",{className:"text-xl font-bold mb-4",children:v||"Sujet de l'email"}),s.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:"Bonjour [Prénom],<br><br>"+(y.replace(/\n/g,"<br>")||"<p>Contenu…</p>")}})]})]})})]})})}const A4t=()=>{const{tag:e}=wo(),t=e?decodeURIComponent(e).replace(/-/g," "):"",r=t.charAt(0).toUpperCase()+t.slice(1),{data:n,isLoading:a}=ga({queryKey:["skill-trainers",t],queryFn:async()=>{const{data:l,error:c}=await he.rpc("get_public_trainer_profiles");if(c)throw c;return(l==null?void 0:l.filter(u=>{var d;return(d=u.specialties)==null?void 0:d.some(f=>f.toLowerCase().includes(t.toLowerCase())||t.toLowerCase().includes(f.toLowerCase()))}))||[]},enabled:!!t}),{data:i}=ga({queryKey:["skill-offers",t],queryFn:async()=>{const{data:l,error:c}=await he.from("school_requests").select("*").eq("status","approved").eq("is_filled",!1).limit(6);if(c)throw c;return(l==null?void 0:l.filter(u=>{var d,f;return((d=u.subject_areas)==null?void 0:d.some(m=>m.toLowerCase().includes(t.toLowerCase())))||((f=u.description)==null?void 0:f.toLowerCase().includes(t.toLowerCase()))}))||[]},enabled:!!t}),o=[{name:"Accueil",url:"/"},{name:"Compétences",url:"/skills"},{name:r,url:`/competence/${e}`}];return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:`Top Formateurs ${r} freelance et organismes`,description:`Trouvez les meilleurs formateurs ${r} en France. ${(n==null?void 0:n.length)||0} experts disponibles pour vos formations professionnelles.`,keywords:[r,"formateur","formation professionnelle","expert","freelance"]}),s.jsx(Qa,{items:o}),s.jsxs("div",{className:"container py-12",children:[s.jsxs("nav",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-8",children:[s.jsx(vt,{to:"/",className:"hover:text-primary",children:"Accueil"}),s.jsx(tu,{className:"h-4 w-4"}),s.jsx(vt,{to:"/skills",className:"hover:text-primary",children:"Compétences"}),s.jsx(tu,{className:"h-4 w-4"}),s.jsx("span",{className:"text-foreground font-medium",children:r})]}),s.jsxs("div",{className:"mb-12",children:[s.jsxs(vt,{to:"/skills",className:"inline-flex items-center text-muted-foreground hover:text-primary mb-4",children:[s.jsx(Yn,{className:"h-4 w-4 mr-2"}),"Toutes les compétences"]}),s.jsxs("h1",{className:"text-4xl font-bold mb-4",children:["Top Formateurs ",r," freelance et organismes"]}),s.jsx("div",{className:"flex items-center gap-4 text-lg text-muted-foreground",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sr,{className:"h-5 w-5 text-primary"}),s.jsxs("span",{className:"font-semibold text-foreground",children:[(n==null?void 0:n.length)||0," experts disponibles"]})]})})]}),s.jsxs("section",{className:"mb-16",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6",children:["Nos formateurs experts en ",r]}),a?s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((l,c)=>s.jsx(ke,{children:s.jsxs(ht,{className:"flex flex-row items-center gap-4",children:[s.jsx(Yr,{className:"h-16 w-16 rounded-full"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Yr,{className:"h-5 w-32"}),s.jsx(Yr,{className:"h-4 w-24"})]})]})},c))}):(n==null?void 0:n.length)===0?s.jsx(ke,{children:s.jsxs(Ae,{className:"py-12 text-center",children:[s.jsx(sr,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),s.jsx("p",{className:"text-lg text-muted-foreground",children:"Aucun formateur trouvé pour cette compétence."}),s.jsx(ne,{asChild:!0,className:"mt-4",children:s.jsx(vt,{to:"/trainers",children:"Voir tous les formateurs"})})]})}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:n==null?void 0:n.map(l=>{var c,u;return s.jsxs(vt,{to:`/trainers/${l.id}`,children:[s.jsxs(ke,{className:"h-full hover:shadow-lg transition-shadow cursor-pointer group",children:[s.jsx(ht,{children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsxs(ps,{className:"h-16 w-16",children:[s.jsx(vi,{src:l.photo_url||void 0}),s.jsx(gs,{children:s.jsx(qo,{className:"h-8 w-8"})})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx(xt,{className:"text-lg group-hover:text-primary transition-colors",children:l.name}),l.bio&&s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:l.bio})]})]})}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[(c=l.specialties)==null?void 0:c.slice(0,4).map((d,f)=>s.jsx(Le,{variant:d.toLowerCase().includes(t.toLowerCase())?"default":"secondary",className:"text-xs",children:d},f)),((u=l.specialties)==null?void 0:u.length)>4&&s.jsxs(Le,{variant:"outline",className:"text-xs",children:["+",l.specialties.length-4]})]})})]}),s.jsx(u1,{name:l.name,description:l.bio||void 0,image:l.photo_url||void 0,knowsAbout:l.specialties,url:`/trainers/${l.id}`})]},l.id)})})]}),i&&i.length>0&&s.jsxs("section",{className:"mb-16",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-6",children:["Offres de formation en ",r]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:i.map(l=>{var c;return s.jsx(vt,{to:`/training-offers/${l.id}`,children:s.jsxs(ke,{className:"h-full hover:shadow-lg transition-shadow cursor-pointer",children:[s.jsxs(ht,{children:[s.jsx(xt,{className:"text-lg line-clamp-2",children:((c=l.subject_areas)==null?void 0:c.join(", "))||"Formation"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l.school_name})]}),s.jsx(Ae,{children:s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Gs,{className:"h-4 w-4"}),l.city||"France"]})})]})},l.id)})})]}),s.jsxs("section",{className:"bg-primary/5 rounded-lg p-8 text-center",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-4",children:["Vous êtes formateur en ",r," ?"]}),s.jsx("p",{className:"text-muted-foreground mb-6 max-w-2xl mx-auto",children:"Rejoignez notre réseau d'experts et accédez à des opportunités de formation dans les meilleurs établissements."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsx(vt,{to:"/trainer-signup",children:"Devenir formateur"})}),s.jsx(ne,{asChild:!0,variant:"outline",size:"lg",children:s.jsx(vt,{to:"/training-request",children:"Publier une offre"})})]})]})]})]})},T4t=[{icon:jve,title:"Émargement digital",description:"Feuilles de présence numériques, signatures électroniques, rapports automatiques"},{icon:Bs,title:"Gestion du calendrier",description:"Planning des formations, disponibilité des formateurs, synchronisation agenda"},{icon:Gt,title:"Facturation automatisée",description:"Génération de factures, suivi des paiements, exports comptables"},{icon:sr,title:"Publication illimitée",description:"Publiez autant d'offres de formation que vous le souhaitez"},{icon:Uo,title:"Support prioritaire",description:"Assistance dédiée et accompagnement personnalisé"},{icon:vl,title:"Conformité Qualiopi",description:"Outils conformes aux exigences du référentiel qualité"}],P4t=[{quote:"Nous avons divisé par 3 le temps de gestion administrative de nos formations.",author:"Marie D.",role:"Directrice pédagogique",school:"École de Commerce Paris"},{quote:"L'émargement digital a révolutionné notre suivi de présence.",author:"Thomas L.",role:"Responsable formation",school:"Centre de formation Lyon"}];function O4t(){const{user:e}=Ur(),t=Xt(),[r,n]=w.useState(!1),a=async()=>{if(!e){ae.info("Connectez-vous pour souscrire à l'abonnement"),t("/auth?redirect=/offre-ecoles");return}n(!0);try{const{data:o,error:l}=await he.functions.invoke("create-school-checkout");if(l)throw l;o!=null&&o.url&&window.open(o.url,"_blank")}catch(o){console.error("Error creating checkout:",o),ae.error("Erreur lors de la création du paiement")}finally{n(!1)}},i=()=>{t("/contact?subject=demo-saas")};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Solution SaaS pour Écoles | Émargement, Calendrier, Facturation",description:"Digitalisez la gestion de vos formations : émargement numérique, planning, facturation automatisée. Solution complète développée gratuitement, abonnement 99€/mois.",url:"/offre-ecoles",keywords:["logiciel formation","émargement digital","gestion école","Qualiopi","facturation formation"]}),s.jsx("section",{className:"relative py-20 overflow-hidden bg-gradient-to-br from-primary/10 via-background to-background",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[s.jsxs(Le,{className:"mb-6",variant:"secondary",children:[s.jsx(nC,{className:"h-3 w-3 mr-1"}),"Offre exclusive écoles partenaires"]}),s.jsxs("h1",{className:"text-4xl md:text-6xl font-bold mb-6",children:["Vos outils de gestion"," ",s.jsx("span",{className:"text-primary",children:"développés gratuitement"})]}),s.jsxs("p",{className:"text-xl text-muted-foreground mb-8 max-w-2xl mx-auto",children:["Émargement, calendrier, facturation... Nous codons sur-mesure tout ce dont vous avez besoin. Vous ne payez que l'hébergement : ",s.jsx("strong",{children:"99€/mois"}),"."]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsxs(ne,{size:"lg",onClick:a,disabled:r,children:[r?"Chargement...":"Commencer maintenant",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]}),s.jsx(ne,{size:"lg",variant:"outline",onClick:i,children:"Demander une démo"})]})]})})}),s.jsx("section",{className:"py-16 bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"grid md:grid-cols-3 gap-8 text-center",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:s.jsx(Gr,{className:"h-8 w-8 text-primary"})}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Développement gratuit"}),s.jsx("p",{className:"text-muted-foreground",children:"Nous développons vos outils sur-mesure sans frais de développement"})]}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:s.jsx(Ii,{className:"h-8 w-8 text-primary"})}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Conforme Qualiopi"}),s.jsx("p",{className:"text-muted-foreground",children:"Tous les outils respectent les exigences du référentiel qualité"})]}),s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:s.jsx(Vr,{className:"h-8 w-8 text-primary"})}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Support dédié"}),s.jsx("p",{className:"text-muted-foreground",children:"Accompagnement personnalisé et évolutions continues"})]})]})})}),s.jsx("section",{className:"py-20",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("div",{className:"text-center mb-16",children:[s.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Tout ce dont vous avez besoin"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Une suite complète d'outils pour digitaliser la gestion de vos formations"})]}),s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:T4t.map((o,l)=>{const c=o.icon;return s.jsxs(ke,{className:"border-border/50 hover:shadow-lg transition-shadow",children:[s.jsxs(ht,{children:[s.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4",children:s.jsx(c,{className:"h-6 w-6 text-primary"})}),s.jsx(xt,{className:"text-xl",children:o.title})]}),s.jsx(Ae,{children:s.jsx("p",{className:"text-muted-foreground",children:o.description})})]},l)})})]})}),s.jsx("section",{className:"py-20 bg-muted/30",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"max-w-lg mx-auto",children:s.jsxs(ke,{className:"border-primary/50 shadow-lg",children:[s.jsxs(ht,{className:"text-center pb-2",children:[s.jsx(Le,{className:"w-fit mx-auto mb-4",variant:"secondary",children:"Offre unique"}),s.jsx(xt,{className:"text-3xl",children:"Abonnement Premium"}),s.jsx(Qr,{children:"Tous les outils inclus, développés sur-mesure pour vous"})]}),s.jsxs(Ae,{className:"text-center",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("span",{className:"text-5xl font-bold",children:"99€"}),s.jsx("span",{className:"text-muted-foreground",children:"/mois"})]}),s.jsxs("ul",{className:"space-y-3 text-left mb-8",children:[s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx(Pn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Développement gratuit de vos outils"})]}),s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx(Pn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Émargement digital illimité"})]}),s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx(Pn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Gestion du calendrier et planning"})]}),s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx(Pn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Facturation automatisée"})]}),s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx(Pn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Publication d'offres illimitées"})]}),s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx(Pn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Support prioritaire"})]}),s.jsxs("li",{className:"flex items-center gap-3",children:[s.jsx(Pn,{className:"h-5 w-5 text-primary flex-shrink-0"}),s.jsx("span",{children:"Évolutions et mises à jour incluses"})]})]})]}),s.jsx(Ine,{children:s.jsx(ne,{className:"w-full",size:"lg",onClick:a,disabled:r,children:r?"Chargement...":"Souscrire maintenant"})})]})})})}),s.jsx("section",{className:"py-20",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx("div",{className:"text-center mb-12",children:s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Ce qu'en disent nos partenaires"})}),s.jsx("div",{className:"grid md:grid-cols-2 gap-8 max-w-4xl mx-auto",children:P4t.map((o,l)=>s.jsx(ke,{className:"border-border/50",children:s.jsxs(Ae,{className:"pt-6",children:[s.jsxs("p",{className:"text-lg mb-4 italic",children:['"',o.quote,'"']}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:o.author}),s.jsx("p",{className:"text-sm text-muted-foreground",children:o.role}),s.jsx("p",{className:"text-sm text-primary",children:o.school})]})]})},l))})]})}),s.jsx("section",{className:"py-10 bg-muted/40 border-y",children:s.jsxs("div",{className:"container mx-auto px-4 flex flex-col sm:flex-row items-center justify-between gap-4 max-w-4xl",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold",children:"Vous cherchez aussi des formateurs ?"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Publiez vos offres, recevez des candidatures qualifiées et constituez vos programmes en un seul endroit."})]}),s.jsxs(ne,{variant:"outline",className:"shrink-0",onClick:()=>t("/pour-les-ecoles"),children:["Découvrir nos services ",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})]})}),s.jsx("section",{className:"py-20 bg-primary text-primary-foreground",children:s.jsxs("div",{className:"container mx-auto px-4 text-center",children:[s.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Prêt à digitaliser votre gestion ?"}),s.jsx("p",{className:"text-xl opacity-90 mb-8 max-w-2xl mx-auto",children:"Rejoignez les écoles qui ont déjà simplifié leur administration"}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsx(ne,{size:"lg",variant:"secondary",onClick:a,disabled:r,children:r?"Chargement...":"Commencer pour 99€/mois"}),s.jsx(ne,{size:"lg",variant:"outline",className:"border-primary-foreground/30 text-primary-foreground hover:bg-primary-foreground/10",onClick:i,children:"Planifier une démo"})]})]})})]})}const D4t=[{slug:"informatique",title:"Informatique & Digital",description:"Développement, cybersécurité, data, cloud et technologies numériques",icon:XJ,trainersCount:"50+"},{slug:"commerce",title:"Commerce & Marketing",description:"Vente, négociation, marketing digital et relation client",icon:Kve,trainersCount:"30+"},{slug:"management",title:"Management & Leadership",description:"Management d'équipe, leadership et gestion de projet",icon:sr,trainersCount:"25+"},{slug:"sante",title:"Santé & Secourisme",description:"SST, PSC1, premiers secours et prévention des risques",icon:mR,trainersCount:"20+"},{slug:"langues",title:"Langues & International",description:"Anglais professionnel, FLE et langues étrangères",icon:Ky,trainersCount:"15+"},{slug:"rh",title:"Ressources Humaines",description:"Recrutement, droit du travail, paie et GPEC",icon:as,trainersCount:"20+"}];function I4t(){return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Formateurs par Secteur pour Écoles | PedagoBridge",description:"Trouvez des formateurs experts par secteur d'activité : informatique, commerce, management, santé, langues, RH. Profils vérifiés pour vos formations.",url:"/ecoles-secteur",keywords:["formateurs par secteur","formation professionnelle","écoles formation"]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-background py-16",children:s.jsxs("div",{className:"container mx-auto px-4 text-center",children:[s.jsxs(Le,{className:"mb-4",variant:"secondary",children:[s.jsx(Ii,{className:"h-3 w-3 mr-1"}),"Pour les écoles et organismes"]}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Trouvez le formateur idéal par secteur"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Explorez notre réseau de formateurs experts classés par domaine d'expertise"})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:D4t.map(e=>{const t=e.icon;return s.jsx(vt,{to:`/ecoles-secteur/${e.slug}`,children:s.jsxs(ke,{className:"h-full hover:shadow-lg hover:border-primary/50 transition-all cursor-pointer",children:[s.jsxs(ht,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("div",{className:"w-12 h-12 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(t,{className:"h-6 w-6 text-primary"})}),s.jsxs(Le,{variant:"secondary",children:[e.trainersCount," formateurs"]})]}),s.jsxs(xt,{className:"flex items-center gap-2",children:[e.title,s.jsx(Mn,{className:"h-4 w-4 text-muted-foreground"})]})]}),s.jsx(Ae,{children:s.jsx("p",{className:"text-muted-foreground",children:e.description})})]})},e.slug)})})})})]})}const R4t={informatique:{title:"Informatique & Digital",description:"Formations en développement, cybersécurité, data, cloud et technologies numériques",keywords:["informatique","développement","web","digital","cybersécurité","data","cloud","devops","react","javascript","python"],metaKeywords:["formation informatique école","formateur développement web","formation cybersécurité entreprise"]},commerce:{title:"Commerce & Marketing",description:"Formations en vente, négociation, marketing digital et relation client",keywords:["commerce","marketing","vente","négociation","bts ndrc","bts mco","relation client","commercial"],metaKeywords:["formation commerciale école","formateur vente","formation marketing"]},management:{title:"Management & Leadership",description:"Formations en management d'équipe, leadership et gestion de projet",keywords:["management","leadership","gestion","projet","équipe","agile","scrum"],metaKeywords:["formation management école","formateur leadership","formation gestion équipe"]},sante:{title:"Santé & Secourisme",description:"Formations SST, PSC1, premiers secours et prévention des risques",keywords:["santé","secourisme","sst","psc1","premiers secours","afgsu","prévention"],metaKeywords:["formation SST école","formateur secourisme","formation premiers secours"]},langues:{title:"Langues & International",description:"Formations en anglais professionnel, FLE et langues étrangères",keywords:["anglais","langue","fle","international","toeic","bulats"],metaKeywords:["formation anglais école","formateur langues","cours anglais entreprise"]},rh:{title:"Ressources Humaines",description:"Formations en recrutement, droit du travail, paie et GPEC",keywords:["rh","ressources humaines","recrutement","paie","droit du travail","gpec"],metaKeywords:["formation RH école","formateur ressources humaines","formation paie"]}};function L4t(){const{sector:e}=wo(),[t,r]=w.useState([]),[n,a]=w.useState(!0),i=e?R4t[e]:null;return w.useEffect(()=>{if(!i)return;xi.trackPageView(`School Sector Landing - ${i.title}`,{pageType:"school_sector_landing",sector:e}),(async()=>{try{const{data:l,error:c}=await he.rpc("get_public_trainer_profiles");if(c)throw c;const u=(l||[]).filter(d=>d.specialties.some(f=>i.keywords.some(m=>f.toLowerCase().includes(m.toLowerCase())))).slice(0,6);r(u)}catch(l){console.error("Error fetching trainers:",l)}finally{a(!1)}})()},[e,i]),i?s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:`Formateurs ${i.title} pour Écoles | PedagoBridge`,description:`Trouvez des formateurs experts en ${i.title.toLowerCase()} pour votre école. ${i.description}`,url:`/ecoles-secteur/${e}`,keywords:i.metaKeywords}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-background py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl",children:[s.jsxs(Le,{className:"mb-4",variant:"secondary",children:[s.jsx(Vr,{className:"h-3 w-3 mr-1"}),"Secteur de formation"]}),s.jsxs("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:["Formateurs en ",i.title]}),s.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:i.description}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx(vt,{to:"/inscription-ecole",children:s.jsxs(ne,{size:"lg",children:["Publier une offre",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})}),s.jsx(vt,{to:`/formateurs?search=${encodeURIComponent(i.keywords[0])}`,children:s.jsx(ne,{size:"lg",variant:"outline",children:"Voir tous les formateurs"})})]})]})})}),s.jsx("section",{className:"py-12 border-b",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-8 text-center",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"text-3xl font-bold text-primary",children:[t.length,"+"]}),s.jsx("div",{className:"text-muted-foreground",children:"Formateurs disponibles"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-3xl font-bold text-primary",children:[i.keywords.length,"+"]}),s.jsx("div",{className:"text-muted-foreground",children:"Spécialités couvertes"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-3xl font-bold text-primary",children:"48h"}),s.jsx("div",{className:"text-muted-foreground",children:"Délai de réponse moyen"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-3xl font-bold text-primary",children:"100%"}),s.jsx("div",{className:"text-muted-foreground",children:"Profils vérifiés"})]})]})})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("h2",{className:"text-3xl font-bold mb-8",children:["Formateurs recommandés en ",i.title]}),n?s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):t.length>0?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(o=>s.jsxs(ke,{className:"hover:shadow-lg transition-shadow",children:[s.jsxs(ht,{className:"flex flex-row items-center gap-4",children:[o.photo_url?s.jsx("img",{src:o.photo_url,alt:o.name,className:"w-16 h-16 rounded-full object-cover"}):s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(sr,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx(xt,{className:"text-lg",children:o.name}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:o.specialties.slice(0,2).map((l,c)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:l},c))})]})]}),s.jsxs(Ae,{children:[s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:o.bio||"Expert formateur certifié"}),s.jsx(vt,{to:`/formateur/${o.id}`,children:s.jsx(ne,{variant:"outline",size:"sm",className:"w-full",children:"Voir le profil"})})]})]},o.id))}):s.jsxs(ke,{className:"p-8 text-center",children:[s.jsx(Ii,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Pas encore de formateurs"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Publiez votre offre et recevez des candidatures de formateurs qualifiés"}),s.jsx(vt,{to:"/inscription-ecole",children:s.jsx(ne,{children:"Publier une offre"})})]})]})}),s.jsx("section",{className:"py-16 bg-primary text-primary-foreground",children:s.jsxs("div",{className:"container mx-auto px-4 text-center",children:[s.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Besoin d'un formateur en ",i.title," ?"]}),s.jsx("p",{className:"text-xl opacity-90 mb-8 max-w-2xl mx-auto",children:"Publiez votre offre gratuitement et recevez des candidatures de formateurs qualifiés sous 48h"}),s.jsx(vt,{to:"/inscription-ecole",children:s.jsx(ne,{size:"lg",variant:"secondary",children:"Publier une offre gratuitement"})})]})})]}):s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Secteur non trouvé"}),s.jsx(vt,{to:"/ecoles-secteur",children:s.jsx(ne,{children:"Voir tous les secteurs"})})]})}const F4t=[{slug:"ile-de-france",name:"Île-de-France",departments:["75","77","78","91","92","93","94","95"]},{slug:"auvergne-rhone-alpes",name:"Auvergne-Rhône-Alpes",departments:["01","03","07","15","26","38","42","43","63","69","73","74"]},{slug:"nouvelle-aquitaine",name:"Nouvelle-Aquitaine",departments:["16","17","19","23","24","33","40","47","64","79","86","87"]},{slug:"occitanie",name:"Occitanie",departments:["09","11","12","30","31","32","34","46","48","65","66","81","82"]},{slug:"hauts-de-france",name:"Hauts-de-France",departments:["02","59","60","62","80"]},{slug:"provence-alpes-cote-azur",name:"Provence-Alpes-Côte d'Azur",departments:["04","05","06","13","83","84"]},{slug:"grand-est",name:"Grand Est",departments:["08","10","51","52","54","55","57","67","68","88"]},{slug:"pays-de-la-loire",name:"Pays de la Loire",departments:["44","49","53","72","85"]},{slug:"bretagne",name:"Bretagne",departments:["22","29","35","56"]},{slug:"normandie",name:"Normandie",departments:["14","27","50","61","76"]},{slug:"bourgogne-franche-comte",name:"Bourgogne-Franche-Comté",departments:["21","25","39","58","70","71","89","90"]},{slug:"centre-val-de-loire",name:"Centre-Val de Loire",departments:["18","28","36","37","41","45"]}];function M4t(){return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Formateurs par Région pour Écoles | PedagoBridge",description:"Trouvez des formateurs experts près de votre école. Couverture nationale : Île-de-France, Lyon, Bordeaux, Marseille et toutes les régions.",url:"/ecoles-region",keywords:["formateurs par région","formation locale","formateur proximité"]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-background py-16",children:s.jsxs("div",{className:"container mx-auto px-4 text-center",children:[s.jsxs(Le,{className:"mb-4",variant:"secondary",children:[s.jsx(Ii,{className:"h-3 w-3 mr-1"}),"Couverture nationale"]}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:"Formateurs disponibles dans votre région"}),s.jsx("p",{className:"text-xl text-muted-foreground max-w-2xl mx-auto",children:"Notre réseau couvre l'ensemble du territoire français"})]})}),s.jsx("section",{className:"py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:F4t.map(e=>s.jsx(vt,{to:`/ecoles-region/${e.slug}`,children:s.jsxs(ke,{className:"h-full hover:shadow-lg hover:border-primary/50 transition-all cursor-pointer",children:[s.jsx(ht,{className:"pb-2",children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Gs,{className:"h-4 w-4 text-primary"}),e.name,s.jsx(Mn,{className:"h-4 w-4 text-muted-foreground ml-auto"})]})}),s.jsx(Ae,{children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.departments.length," départements couverts"]})})]})},e.slug))})})})]})}const $4t={"ile-de-france":{name:"Île-de-France",departments:["75","77","78","91","92","93","94","95"]},"auvergne-rhone-alpes":{name:"Auvergne-Rhône-Alpes",departments:["01","03","07","15","26","38","42","43","63","69","73","74"]},"nouvelle-aquitaine":{name:"Nouvelle-Aquitaine",departments:["16","17","19","23","24","33","40","47","64","79","86","87"]},occitanie:{name:"Occitanie",departments:["09","11","12","30","31","32","34","46","48","65","66","81","82"]},"hauts-de-france":{name:"Hauts-de-France",departments:["02","59","60","62","80"]},"provence-alpes-cote-azur":{name:"Provence-Alpes-Côte d'Azur",departments:["04","05","06","13","83","84"]},"grand-est":{name:"Grand Est",departments:["08","10","51","52","54","55","57","67","68","88"]},"pays-de-la-loire":{name:"Pays de la Loire",departments:["44","49","53","72","85"]},bretagne:{name:"Bretagne",departments:["22","29","35","56"]},normandie:{name:"Normandie",departments:["14","27","50","61","76"]},"bourgogne-franche-comte":{name:"Bourgogne-Franche-Comté",departments:["21","25","39","58","70","71","89","90"]},"centre-val-de-loire":{name:"Centre-Val de Loire",departments:["18","28","36","37","41","45"]}};function B4t(){const{region:e}=wo(),[t,r]=w.useState([]),[n,a]=w.useState(!0),i=e?$4t[e]:null;return w.useEffect(()=>{if(!i)return;xi.trackPageView(`School Region Landing - ${i.name}`,{pageType:"school_region_landing",region:e}),(async()=>{try{const{data:l,error:c}=await he.rpc("get_public_trainer_profiles");if(c)throw c;const u=(l||[]).filter(d=>{var f;return(f=d.preferred_departments)==null?void 0:f.some(m=>i.departments.includes(m))}).slice(0,6);r(u)}catch(l){console.error("Error fetching trainers:",l)}finally{a(!1)}})()},[e,i]),i?s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:`Formateurs en ${i.name} pour Écoles | PedagoBridge`,description:`Trouvez des formateurs experts disponibles en ${i.name}. Couverture de ${i.departments.length} départements. Profils vérifiés.`,url:`/ecoles-region/${e}`,keywords:[`formateurs ${i.name}`,`formation ${i.name}`,"formateur local"]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/10 via-background to-background py-16",children:s.jsx("div",{className:"container mx-auto px-4",children:s.jsxs("div",{className:"max-w-3xl",children:[s.jsxs(Le,{className:"mb-4",variant:"secondary",children:[s.jsx(Gs,{className:"h-3 w-3 mr-1"}),i.departments.length," départements couverts"]}),s.jsxs("h1",{className:"text-4xl md:text-5xl font-bold mb-4",children:["Formateurs en ",i.name]}),s.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Trouvez des formateurs experts disponibles près de votre établissement"}),s.jsxs("div",{className:"flex gap-4",children:[s.jsx(vt,{to:"/inscription-ecole",children:s.jsxs(ne,{size:"lg",children:["Publier une offre",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})}),s.jsx(vt,{to:"/formateurs",children:s.jsx(ne,{size:"lg",variant:"outline",children:"Voir tous les formateurs"})})]})]})})}),s.jsx("section",{className:"py-8 border-b",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Départements couverts :"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:i.departments.map(o=>s.jsxs(Le,{variant:"outline",children:[o," - ",tv(o)]},o))})]})}),s.jsx("section",{className:"py-16",children:s.jsxs("div",{className:"container mx-auto px-4",children:[s.jsxs("h2",{className:"text-3xl font-bold mb-8",children:["Formateurs disponibles en ",i.name]}),n?s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):t.length>0?s.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(o=>s.jsxs(ke,{className:"hover:shadow-lg transition-shadow",children:[s.jsxs(ht,{className:"flex flex-row items-center gap-4",children:[o.photo_url?s.jsx("img",{src:o.photo_url,alt:o.name,className:"w-16 h-16 rounded-full object-cover"}):s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(sr,{className:"h-6 w-6 text-primary"})}),s.jsxs("div",{children:[s.jsx(xt,{className:"text-lg",children:o.name}),s.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:o.specialties.slice(0,2).map((l,c)=>s.jsx(Le,{variant:"secondary",className:"text-xs",children:l},c))})]})]}),s.jsxs(Ae,{children:[s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:o.bio||"Expert formateur certifié"}),s.jsx(vt,{to:`/formateur/${o.id}`,children:s.jsx(ne,{variant:"outline",size:"sm",className:"w-full",children:"Voir le profil"})})]})]},o.id))}):s.jsxs(ke,{className:"p-8 text-center",children:[s.jsx(Ii,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Pas encore de formateurs dans cette région"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Publiez votre offre et recevez des candidatures de formateurs qualifiés"}),s.jsx(vt,{to:"/inscription-ecole",children:s.jsx(ne,{children:"Publier une offre"})})]})]})}),s.jsx("section",{className:"py-16 bg-primary text-primary-foreground",children:s.jsxs("div",{className:"container mx-auto px-4 text-center",children:[s.jsxs("h2",{className:"text-3xl font-bold mb-4",children:["Besoin d'un formateur en ",i.name," ?"]}),s.jsx("p",{className:"text-xl opacity-90 mb-8 max-w-2xl mx-auto",children:"Publiez votre offre gratuitement et recevez des candidatures sous 48h"}),s.jsx(vt,{to:"/inscription-ecole",children:s.jsx(ne,{size:"lg",variant:"secondary",children:"Publier une offre gratuitement"})})]})})]}):s.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Région non trouvée"}),s.jsx(vt,{to:"/ecoles-region",children:s.jsx(ne,{children:"Voir toutes les régions"})})]})}const z4t="https://pedagobridge.com/functions/v1/ai-assistant",U4t=[{icon:sr,text:"Comment trouver un formateur ?",category:"Recherche"},{icon:Gt,text:"Comment publier une offre de formation ?",category:"Écoles"},{icon:xl,text:"Comment m'inscrire comme formateur ?",category:"Formateurs"},{icon:d0,text:"Comment fonctionne la plateforme ?",category:"Général"}];function q4t(){var p;const e=Xt(),{user:t,loading:r}=Ur(),[n,a]=w.useState([]),[i,o]=w.useState(""),[l,c]=w.useState(!1),u=w.useRef(null),d=w.useRef(null);w.useEffect(()=>{!r&&!t&&e("/auth")},[t,r,e]),w.useEffect(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[n]);const f=async x=>{var j,S,I;const v=await fetch(z4t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzc2MjQzNzQyLCJleHAiOjIwOTE2MDM3NDJ9.73Zk3EieShL_u8EKlAW2LekPnT1agaI3de2bE8hkWq4"},body:JSON.stringify({messages:x,userId:t==null?void 0:t.id})});if(!v.ok)throw v.status===429?new Error("Trop de requêtes, veuillez réessayer dans quelques instants."):v.status===402?new Error("Service temporairement indisponible."):new Error("Erreur de connexion à l'assistant");if(!v.body)throw new Error("Pas de réponse");const b=v.body.getReader(),y=new TextDecoder;let N="",_="";for(;;){const{done:P,value:F}=await b.read();if(P)break;N+=y.decode(F,{stream:!0});let T;for(;(T=N.indexOf(`
`))!==-1;){let k=N.slice(0,T);if(N=N.slice(T+1),k.endsWith("\r")&&(k=k.slice(0,-1)),k.startsWith(":")||k.trim()===""||!k.startsWith("data: "))continue;const V=k.slice(6).trim();if(V==="[DONE]")break;try{const R=(I=(S=(j=JSON.parse(V).choices)==null?void 0:j[0])==null?void 0:S.delta)==null?void 0:I.content;R&&(_+=R,a(H=>{const q=H[H.length-1];return(q==null?void 0:q.role)==="assistant"?H.map((L,M)=>M===H.length-1?{...L,content:_}:L):[...H,{role:"assistant",content:_}]}))}catch{N=k+`
`+N;break}}}},m=async x=>{var b;if(!x.trim()||l)return;const v={role:"user",content:x.trim()};a(y=>[...y,v]),o(""),c(!0);try{await f([...n,v])}catch(y){console.error("Chat error:",y),ae.error(y instanceof Error?y.message:"Erreur de l'assistant"),a(N=>{const _=N[N.length-1];return(_==null?void 0:_.role)==="assistant"&&!_.content?N.slice(0,-1):N})}finally{c(!1),(b=d.current)==null||b.focus()}},h=x=>{x.preventDefault(),m(i)},g=x=>{m(x)};return r?s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:s.jsx(at,{className:"h-8 w-8 animate-spin text-primary"})}):s.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted/20",children:[s.jsx(gr,{title:"Assistant IA - PedagoBridge",description:"Posez vos questions à notre assistant IA pour vous aider à naviguer sur PedagoBridge.",url:"/assistant"}),s.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-4",children:s.jsx(Em,{className:"h-8 w-8 text-primary"})}),s.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Assistant PedagoBridge"}),s.jsx("p",{className:"text-muted-foreground",children:"Je suis là pour vous aider à naviguer, rechercher et utiliser la plateforme."})]}),s.jsxs(ke,{className:"shadow-lg border-primary/10",children:[s.jsx(ht,{className:"border-b bg-muted/30",children:s.jsxs(xt,{className:"flex items-center gap-2 text-lg",children:[s.jsx(Uo,{className:"h-5 w-5 text-primary"}),"Conversation"]})}),s.jsxs(Ae,{className:"p-0",children:[s.jsx(ru,{className:"h-[400px] p-4",ref:u,children:n.length===0?s.jsxs("div",{className:"space-y-6 py-8",children:[s.jsx("p",{className:"text-center text-muted-foreground",children:"Comment puis-je vous aider aujourd'hui ?"}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:U4t.map((x,v)=>s.jsxs(ne,{variant:"outline",className:"h-auto p-4 justify-start text-left hover:bg-primary/5 hover:border-primary/30",onClick:()=>g(x.text),children:[s.jsx(x.icon,{className:"h-5 w-5 mr-3 text-primary shrink-0"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:x.category}),s.jsx("div",{className:"font-medium",children:x.text})]})]},v))})]}):s.jsxs("div",{className:"space-y-4",children:[n.map((x,v)=>s.jsxs("div",{className:`flex gap-3 ${x.role==="user"?"justify-end":"justify-start"}`,children:[x.role==="assistant"&&s.jsx(ps,{className:"h-8 w-8 shrink-0",children:s.jsx(gs,{className:"bg-primary/10 text-primary",children:s.jsx(Em,{className:"h-4 w-4"})})}),s.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2 ${x.role==="user"?"bg-primary text-primary-foreground":"bg-muted"}`,children:s.jsx("p",{className:"whitespace-pre-wrap text-sm",children:x.content})}),x.role==="user"&&s.jsx(ps,{className:"h-8 w-8 shrink-0",children:s.jsx(gs,{className:"bg-secondary",children:s.jsx(qo,{className:"h-4 w-4"})})})]},v)),l&&((p=n[n.length-1])==null?void 0:p.role)==="user"&&s.jsxs("div",{className:"flex gap-3 justify-start",children:[s.jsx(ps,{className:"h-8 w-8 shrink-0",children:s.jsx(gs,{className:"bg-primary/10 text-primary",children:s.jsx(Em,{className:"h-4 w-4"})})}),s.jsx("div",{className:"bg-muted rounded-2xl px-4 py-2",children:s.jsx(at,{className:"h-4 w-4 animate-spin"})})]})]})}),s.jsx("form",{onSubmit:h,className:"p-4 border-t bg-muted/30",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ye,{ref:d,value:i,onChange:x=>o(x.target.value),placeholder:"Posez votre question...",disabled:l,className:"flex-1"}),s.jsx(ne,{type:"submit",disabled:l||!i.trim(),children:l?s.jsx(at,{className:"h-4 w-4 animate-spin"}):s.jsx(ta,{className:"h-4 w-4"})})]})})]})]}),s.jsx("p",{className:"text-center text-xs text-muted-foreground mt-4",children:"L'assistant peut faire des erreurs. Vérifiez les informations importantes."})]})]})}function ipe({label:e,href:t,scrollToId:r}){const n=Xt(),a=()=>{var i;r?(i=document.getElementById(r))==null||i.scrollIntoView({behavior:"smooth"}):t&&n(t)};return s.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-40 p-3 bg-background/95 backdrop-blur-sm border-t border-border lg:hidden",children:s.jsxs(ne,{className:"w-full gap-2 shadow-lg",size:"lg",onClick:a,children:[e,s.jsx(Mn,{className:"h-4 w-4"})]})})}const V4t=[{step:"1",icon:xl,title:"Publiez votre offre de formation",description:"Décrivez votre besoin en formateur : domaine, niveau, dates, localisation. Gratuitement et en moins de 5 minutes."},{step:"2",icon:pa,title:"Recevez des candidatures qualifiées",description:"Des formateurs experts vérifiés postulent à votre offre. Consultez leurs profils, CV et avis d'autres établissements."},{step:"3",icon:Wr,title:"Sélectionnez et collaborez",description:"Échangez via la messagerie intégrée, signez les contrats et suivez vos missions dans votre espace dédié."}],W4t=[{icon:Bc,title:"Constitution de programmes",description:"Vous ne savez pas par où commencer pour structurer votre programme de formation ? Notre équipe vous accompagne de A à Z : définition des objectifs pédagogiques, découpage en modules, sélection des formateurs adaptés.",cta:"En savoir plus",href:"/constitution-de-programme",highlight:!0},{icon:sr,title:"Annuaire de formateurs experts",description:"Accédez à des centaines de formateurs certifiés dans tous les domaines : digital, management, langues, droit, finance, commerce et bien plus.",cta:"Parcourir les formateurs",href:"/trainers",highlight:!1},{icon:Qm,title:"Gestion administrative simplifiée",description:"Contrats, émargement digital, facturation automatisée et conformité Qualiopi. Tout en un seul endroit pour libérer votre temps.",cta:"Voir l'offre SaaS",href:"/offre-ecoles",highlight:!1},{icon:Vc,title:"Remplacement d'urgence",description:"Un formateur se désiste à la dernière minute ? PedagoBridge vous trouve un remplaçant qualifié sous 48h. Votre programme continue sans interruption.",cta:"Voir les garanties",href:"#garanties",highlight:!1}],H4t=[{icon:Xve,title:"Formateurs vérifiés",description:"Chaque formateur est validé par notre équipe : diplômes, expérience, références vérifiés."},{icon:Gr,title:"Réponse rapide",description:"Première candidature reçue en moyenne dans les 24h suivant la publication de votre offre."},{icon:nC,title:"Zéro commission cachée",description:"Tarification transparente. Vous payez le formateur, pas PedagoBridge en intermédiaire."},{icon:Ii,title:"Conformité Qualiopi",description:"Nos outils et processus sont conçus pour respecter le référentiel qualité national."}],UY=[{question:"Comment publier une offre de formation sur PedagoBridge ?",answer:"Créez un compte établissement gratuitement, puis cliquez sur « Publier une offre ». Renseignez le domaine de formation, les dates, le niveau attendu et la localisation. Votre offre est visible par tous les formateurs inscrits dès validation."},{question:"Est-ce gratuit pour les écoles de s'inscrire ?",answer:"Oui, l'inscription et la publication d'offres de formation sont entièrement gratuites. Une offre SaaS optionnelle à 99 €/mois est disponible pour les établissements souhaitant accéder aux fonctionnalités avancées (émargement, facturation, Qualiopi)."},{question:"Quels types d'établissements utilisent PedagoBridge ?",answer:"Écoles de commerce, lycées professionnels, centres de formation professionnelle (CFA), universités, organismes de formation continue — tous types d'établissements cherchant des formateurs experts ponctuels ou récurrents."},{question:"Comment fonctionne le service de constitution de programmes ?",answer:"Vous soumettez votre demande via notre formulaire. Un conseiller pédagogique PedagoBridge vous rappelle sous 48h pour analyser vos besoins et co-construire un programme structuré avec les formateurs adaptés."},{question:"Que se passe-t-il si un formateur annule à la dernière minute ?",answer:"PedagoBridge s'engage à vous proposer un formateur de remplacement qualifié dans les 48h. Notre réseau de formateurs actifs nous permet de répondre rapidement aux imprévus."}];function G4t(){const e=Xt(),t={"@context":"https://schema.org","@type":"Service",name:"PedagoBridge pour les établissements de formation",description:"Plateforme de mise en relation entre établissements scolaires, centres de formation et formateurs experts certifiés. Publication gratuite d'offres, constitution de programmes pédagogiques, gestion administrative.",provider:{"@type":"Organization",name:"PedagoBridge",url:"https://pedagobridge.com"},serviceType:"Recrutement de formateurs experts",areaServed:{"@type":"Country",name:"France"},hasOfferCatalog:{"@type":"OfferCatalog",name:"Services pour établissements",itemListElement:[{"@type":"Offer",name:"Publication d'offres de formation",description:"Publication gratuite d'offres pour trouver des formateurs experts",price:"0",priceCurrency:"EUR"},{"@type":"Offer",name:"Constitution de programmes pédagogiques",description:"Accompagnement à la structuration de programmes de formation"},{"@type":"Offer",name:"Offre SaaS établissements",description:"Gestion administrative complète, émargement digital, Qualiopi",price:"99",priceCurrency:"EUR"}]}};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"PedagoBridge pour les Écoles et Centres de Formation",description:"Trouvez des formateurs experts pour vos formations. Publication gratuite d'offres, constitution de programmes pédagogiques, gestion Qualiopi. Plus de 100 formateurs vérifiés disponibles.",url:"/pour-les-ecoles",keywords:["trouver formateur école","formateur pour établissement","recrutement formateur formation","formateur expert certifié","plateforme formation professionnelle","constitution programme formation","formateurs qualiopi","centre de formation formateurs"]}),s.jsx(sd,{items:UY}),s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(t)})}),s.jsx("section",{className:"bg-gradient-to-br from-primary/90 to-secondary/80 text-white py-20 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-4xl text-center",children:[s.jsx(Le,{className:"mb-4 bg-white/20 text-white border-white/30 hover:bg-white/20",children:"Établissements & Centres de formation"}),s.jsxs("h1",{className:"text-4xl md:text-6xl font-bold mb-6",children:["Trouvez les bons formateurs,",s.jsx("br",{}),s.jsx("span",{className:"text-yellow-300",children:"publiez gratuitement"})]}),s.jsx("p",{className:"text-lg md:text-xl opacity-90 mb-8 max-w-2xl mx-auto",children:"PedagoBridge connecte les écoles et centres de formation avec des formateurs experts vérifiés. De la recherche de profils à la constitution complète de vos programmes."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsxs(ne,{size:"lg",variant:"secondary",className:"text-lg shadow-lg",onClick:()=>e("/school-register"),children:[s.jsx(Vr,{className:"mr-2 h-5 w-5"}),"Créer un compte établissement"]}),s.jsxs(ne,{size:"lg",variant:"outline",className:"text-lg bg-white/20 border-white text-white hover:bg-white hover:text-primary",onClick:()=>e("/trainers"),children:[s.jsx(sr,{className:"mr-2 h-5 w-5"}),"Voir les formateurs"]})]}),s.jsx("p",{className:"mt-4 text-sm opacity-70",children:"Inscription gratuite — Aucune carte bancaire requise"})]})}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Comment ça marche ?"}),s.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-xl mx-auto",children:"En trois étapes simples, trouvez le formateur idéal pour votre programme."}),s.jsx("div",{className:"grid md:grid-cols-3 gap-8",children:V4t.map(r=>{const n=r.icon;return s.jsxs("div",{className:"text-center",children:[s.jsxs("div",{className:"relative inline-flex items-center justify-center mb-4",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:s.jsx(n,{className:"h-8 w-8 text-primary"})}),s.jsx("span",{className:"absolute -top-1 -right-1 w-6 h-6 rounded-full bg-primary text-white text-xs font-bold flex items-center justify-center",children:r.step})]}),s.jsx("h3",{className:"text-lg font-semibold mb-2",children:r.title}),s.jsx("p",{className:"text-muted-foreground text-sm",children:r.description})]},r.step)})})]})}),s.jsx("section",{className:"py-16 px-4 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Nos services pour les établissements"}),s.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-xl mx-auto",children:"De la recherche ponctuelle de formateurs à l'accompagnement complet de votre ingénierie pédagogique."}),s.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:W4t.map(r=>{const n=r.icon;return s.jsxs(ke,{className:r.highlight?"border-primary/40 bg-primary/5":"",children:[s.jsx(ht,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:s.jsx(n,{className:"h-5 w-5 text-primary"})}),s.jsxs(xt,{className:"text-lg",children:[r.highlight&&s.jsx(Le,{className:"mr-2 text-xs",children:"Nouveau"}),r.title]})]})}),s.jsxs(Ae,{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:r.description}),s.jsxs(ne,{variant:r.highlight?"default":"outline",size:"sm",onClick:()=>{var a;return r.href.startsWith("#")?(a=document.getElementById(r.href.slice(1)))==null?void 0:a.scrollIntoView({behavior:"smooth"}):e(r.href)},children:[r.cta,s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})]})]},r.title)})})]})}),s.jsx("section",{id:"garanties",className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Nos engagements"}),s.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-xl mx-auto",children:"PedagoBridge s'engage sur la qualité à chaque étape."}),s.jsx("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-6",children:H4t.map(r=>{const n=r.icon;return s.jsxs("div",{className:"text-center p-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:s.jsx(n,{className:"h-6 w-6 text-primary"})}),s.jsx("h3",{className:"font-semibold mb-2",children:r.title}),s.jsx("p",{className:"text-sm text-muted-foreground",children:r.description})]},r.title)})})]})}),s.jsx("section",{className:"py-16 px-4 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto max-w-4xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Ce que disent nos établissements"}),s.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:[{quote:"Nous avons trouvé un formateur expert en cybersécurité en 48h. Le processus est fluide et les profils sont vraiment qualitatifs.",author:"Sophie M.",role:"Directrice pédagogique",school:"École d'Ingénieurs, Lyon"},{quote:"La constitution de programme nous a permis de lancer notre nouvelle filière data science avec une vraie cohérence pédagogique.",author:"Karim B.",role:"Responsable formation",school:"Centre de Formation Professionnelle, Paris"}].map(r=>s.jsx(ke,{className:"bg-background",children:s.jsxs(Ae,{className:"p-6",children:[s.jsx("div",{className:"flex gap-1 mb-3",children:Array.from({length:5}).map((n,a)=>s.jsx(iu,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},a))}),s.jsxs("p",{className:"text-muted-foreground italic mb-4",children:['"',r.quote,'"']}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-sm",children:r.author}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.role," — ",r.school]})]})]})},r.author))})]})}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Questions fréquentes"}),s.jsx("div",{className:"space-y-4",children:UY.map(r=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-base font-semibold",children:r.question})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:r.answer})})]},r.question))})]})}),s.jsx(ipe,{label:"Inscrire mon établissement",href:"/school-register"}),s.jsx("section",{className:"py-16 px-4 bg-primary text-white text-center",children:s.jsxs("div",{className:"container mx-auto max-w-2xl",children:[s.jsx(Ii,{className:"h-12 w-12 mx-auto mb-4 opacity-80"}),s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Prêt à trouver vos formateurs ?"}),s.jsx("p",{className:"opacity-90 mb-8 text-lg",children:"Rejoignez les établissements qui font confiance à PedagoBridge pour leurs formations."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsxs(ne,{size:"lg",variant:"secondary",className:"text-lg",onClick:()=>e("/school-register"),children:["Créer mon espace établissement",s.jsx(Mn,{className:"ml-2 h-5 w-5"})]}),s.jsx(ne,{size:"lg",variant:"outline",className:"text-lg bg-transparent border-white text-white hover:bg-white hover:text-primary",onClick:()=>e("/training-request"),children:"Soumettre un besoin de formation"})]})]})})]})}const qY=[{icon:Fj,title:"Analyse des besoins",description:"Un conseiller pédagogique PedagoBridge analyse vos objectifs, votre public cible et les contraintes de votre établissement."},{icon:xl,title:"Architecture pédagogique",description:"Nous structurons votre programme : découpage en modules, progression, évaluations, volumes horaires et prérequis."},{icon:sr,title:"Sélection des formateurs",description:"Nous identifions dans notre réseau les formateurs experts correspondant à chaque module de votre programme."},{icon:Hy,title:"Suivi et ajustement",description:"Après lancement, nous assurons un suivi de la cohérence pédagogique et intégrons vos retours pour améliorer le programme."}],K4t=["Gain de temps : déléguer la conception à des experts pédagogiques","Cohérence garantie entre les modules et les formateurs","Conformité avec les exigences Qualiopi et les référentiels CPF","Accès à notre réseau de formateurs spécialisés","Accompagnement de A à Z, de la conception à la mise en oeuvre"],Y4t=["Digital & Tech (développement, data, cybersécurité)","Management & Leadership","Commerce & Marketing","Langues étrangères","Ressources Humaines","Comptabilité & Finance","Droit & Juridique","Santé & Médico-social","Industrie & Logistique","Développement Personnel","Autre"],VY=[{question:"Qu'est-ce que la constitution de programme de formation ?",answer:"C'est l'ensemble des étapes permettant de concevoir un programme de formation structuré : définir les objectifs pédagogiques, découper en modules cohérents, choisir les méthodes d'enseignement et sélectionner les formateurs adaptés à chaque partie."},{question:"Combien de temps prend la constitution d'un programme ?",answer:"Selon la complexité, de 2 à 4 semaines pour un premier programme. Nous traitons la demande en 48h après votre soumission et établissons un calendrier avec vous."},{question:"Ce service est-il payant ?",answer:"Le premier entretien de cadrage est gratuit et sans engagement. Les honoraires sont définis selon la complexité du programme après ce premier échange."},{question:"Mon établissement doit-il être inscrit sur PedagoBridge ?",answer:"Non, vous pouvez soumettre une demande sans compte. Toutefois, un compte établissement vous permettra de suivre l'avancement et d'accéder à nos formateurs directement."}];function X4t(){const[e,t]=w.useState(!1),[r,n]=w.useState(!1),[a,i]=w.useState({schoolName:"",contactName:"",email:"",phone:"",domain:"",audience:"",duration:"",message:""}),o=(u,d)=>{i(f=>({...f,[u]:d}))},l=async u=>{if(u.preventDefault(),!a.email||!a.contactName||!a.schoolName){ae.error("Veuillez remplir les champs obligatoires");return}t(!0);try{const{error:d}=await he.functions.invoke("send-contact-email",{body:{name:a.contactName,email:a.email,phone:a.phone||"Non renseigné",subject:`Demande de constitution de programme — ${a.schoolName}`,message:`
Demande de constitution de programme de formation
Établissement : ${a.schoolName}
Contact : ${a.contactName}
Email : ${a.email}
Téléphone : ${a.phone||"Non renseigné"}
Domaine de formation : ${a.domain||"Non renseigné"}
Public cible : ${a.audience||"Non renseigné"}
Durée envisagée : ${a.duration||"Non renseignée"}
Message :
${a.message||"Aucun message supplémentaire"}
`.trim(),recipientEmail:"contact-pedagobridge@qalamsoftware.com"}});if(d)throw d;n(!0),ae.success("Votre demande a bien été envoyée !")}catch(d){console.error(d),ae.error("Erreur lors de l'envoi. Veuillez réessayer ou nous contacter directement.")}finally{t(!1)}},c={"@context":"https://schema.org","@type":"Service",name:"Constitution de programmes de formation — PedagoBridge",description:"Accompagnement à la conception et à la structuration de programmes de formation professionnelle pour écoles et centres de formation. Analyse des besoins, architecture pédagogique, sélection de formateurs experts.",provider:{"@type":"Organization",name:"PedagoBridge",url:"https://pedagobridge.com"},serviceType:"Ingénierie pédagogique",areaServed:{"@type":"Country",name:"France"},offers:{"@type":"Offer",name:"Premier entretien de cadrage",price:"0",priceCurrency:"EUR",description:"Entretien gratuit et sans engagement pour analyser vos besoins"}};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Constitution de Programmes de Formation pour Écoles",description:"PedagoBridge vous accompagne dans la conception et la structuration de vos programmes de formation : analyse des besoins, architecture pédagogique, sélection de formateurs experts. Premier entretien gratuit.",url:"/constitution-de-programme",keywords:["constitution programme formation","ingénierie pédagogique","conception programme formation professionnelle","structurer programme formation école","accompagnement pédagogique établissement","formateurs experts programme","qualiopi programme formation"]}),s.jsx(sd,{items:VY}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Pour les établissements",url:"/pour-les-ecoles"},{name:"Constitution de programmes",url:"/constitution-de-programme"}]}),s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(c)})}),s.jsx("section",{className:"bg-gradient-to-br from-primary/90 to-secondary/80 text-white py-16 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[s.jsx(Le,{className:"mb-4 bg-white/20 text-white border-white/30 hover:bg-white/20",children:"Service pour établissements"}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-6",children:"Constitution de programmes de formation"}),s.jsx("p",{className:"text-lg md:text-xl opacity-90 max-w-2xl mx-auto",children:"Vous savez ce que vous voulez enseigner, mais pas comment le structurer ? Notre équipe conçoit votre programme de A à Z et sélectionne les formateurs adaptés."})]})}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Notre méthode"}),s.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-xl mx-auto",children:"Un accompagnement structuré en quatre phases pour garantir un programme cohérent et efficace."}),s.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-6",children:qY.map((u,d)=>{const f=u.icon;return s.jsxs("div",{className:"relative",children:[d<qY.length-1&&s.jsx(Mn,{className:"hidden lg:block absolute top-6 -right-3 h-5 w-5 text-primary/30 z-10"}),s.jsxs(ke,{className:"h-full",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center mb-2",children:s.jsx(f,{className:"h-5 w-5 text-primary"})}),s.jsx(xt,{className:"text-base",children:u.title})]}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:u.description})})]})]},u.title)})})]})}),s.jsx("section",{id:"demande-form",className:"py-16 px-4 bg-muted/30",children:s.jsx("div",{className:"container mx-auto max-w-5xl",children:s.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-start",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-3xl font-bold mb-6",children:"Pourquoi déléguer votre ingénierie pédagogique ?"}),s.jsx("ul",{className:"space-y-3 mb-8",children:K4t.map(u=>s.jsxs("li",{className:"flex items-start gap-3",children:[s.jsx(Wr,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5"}),s.jsx("span",{className:"text-sm",children:u})]},u))}),s.jsx(ke,{className:"border-primary/20 bg-primary/5",children:s.jsxs(Ae,{className:"p-4 flex gap-3",children:[s.jsx(gR,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium mb-1",children:"Premier entretien gratuit"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Un conseiller vous rappelle sous 48h pour cadrer votre besoin, sans engagement."})]})]})})]}),s.jsx("div",{children:r?s.jsx(ke,{className:"border-green-200 bg-green-50 dark:bg-green-950/20",children:s.jsxs(Ae,{className:"p-8 text-center",children:[s.jsx(Wr,{className:"h-12 w-12 text-green-500 mx-auto mb-4"}),s.jsx("h3",{className:"text-xl font-bold mb-2",children:"Demande envoyée !"}),s.jsx("p",{className:"text-muted-foreground",children:"Notre équipe vous contactera dans les 48h pour discuter de votre projet de programme."})]})}):s.jsxs(ke,{children:[s.jsxs(ht,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vr,{className:"h-5 w-5 text-primary"}),s.jsx(xt,{children:"Soumettre votre demande"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Entretien de cadrage gratuit — Réponse sous 48h"})]}),s.jsx(Ae,{children:s.jsxs("form",{onSubmit:l,className:"space-y-4",children:[s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"schoolName",children:"Établissement *"}),s.jsx(Ye,{id:"schoolName",placeholder:"Nom de votre école ou centre",value:a.schoolName,onChange:u=>o("schoolName",u.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"contactName",children:"Votre nom *"}),s.jsx(Ye,{id:"contactName",placeholder:"Prénom Nom",value:a.contactName,onChange:u=>o("contactName",u.target.value),required:!0})]})]}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"email",children:"Email professionnel *"}),s.jsx(Ye,{id:"email",type:"email",placeholder:"vous@ecole.fr",value:a.email,onChange:u=>o("email",u.target.value),required:!0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"phone",children:"Téléphone"}),s.jsx(Ye,{id:"phone",placeholder:"06 12 34 56 78",value:a.phone,onChange:u=>o("phone",u.target.value)})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"domain",children:"Domaine de formation"}),s.jsxs(Lr,{onValueChange:u=>o("domain",u),children:[s.jsx(Ar,{children:s.jsx(Br,{placeholder:"Sélectionnez un domaine"})}),s.jsx(Tr,{children:Y4t.map(u=>s.jsx(ot,{value:u,children:u},u))})]})]}),s.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"audience",children:"Public cible"}),s.jsx(Ye,{id:"audience",placeholder:"Ex : étudiants Bac+2, salariés...",value:a.audience,onChange:u=>o("audience",u.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"duration",children:"Durée envisagée"}),s.jsx(Ye,{id:"duration",placeholder:"Ex : 3 mois, 35h...",value:a.duration,onChange:u=>o("duration",u.target.value)})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(We,{htmlFor:"message",children:"Précisions sur votre projet"}),s.jsx(gn,{id:"message",placeholder:"Décrivez votre projet, vos contraintes, vos objectifs pédagogiques...",rows:4,value:a.message,onChange:u=>o("message",u.target.value)})]}),s.jsx(ne,{type:"submit",className:"w-full",disabled:e,children:e?s.jsxs(s.Fragment,{children:[s.jsx(at,{className:"mr-2 h-4 w-4 animate-spin"}),"Envoi en cours..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Bc,{className:"mr-2 h-4 w-4"}),"Envoyer ma demande"]})})]})})]})})]})})}),s.jsx(ipe,{label:"Soumettre ma demande",scrollToId:"demande-form"}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-10",children:"Questions fréquentes"}),s.jsx("div",{className:"space-y-4",children:VY.map(u=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-base font-semibold",children:u.question})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:u.answer})})]},u.question))})]})})]})}const Z4t=[{icon:Gt,title:"Un numéro officiel obligatoire",description:"Le numéro de déclaration d'activité (NDA) est délivré par la DREETS (anciennement DIRECCTE) et atteste que votre activité de formation est officiellement déclarée en France."},{icon:Gy,title:"Accès aux financements (CPF, OPCO)",description:"Sans NDA, vos formations ne peuvent pas être prises en charge par le CPF, les OPCO (ATLAS, AKTO, OPCO EP...) ni par Pôle Emploi. C'est un prérequis incontournable."},{icon:sr,title:"Crédibilité auprès des établissements",description:"Les écoles et entreprises exigent souvent la fourniture d'un NDA avant de signer un contrat de prestation de formation. L'avoir renforce votre position professionnelle."}],J4t=[{step:"1",title:"Vous soumettez votre demande",description:"Via votre espace formateur ou notre formulaire, vous nous transmettez vos coordonnées."},{step:"2",title:"Notre équipe vous contacte",description:"Un conseiller PedagoBridge vous rappelle pour préparer votre dossier de déclaration et vérifier les conditions requises."},{step:"3",title:"Dépôt du dossier auprès de la DREETS",description:"Nous vous guidons pas à pas dans la constitution et le dépôt du dossier sur le portail Mon Activité Formation (MAF)."},{step:"4",title:"Réception de votre NDA",description:"La DREETS émet votre numéro sous 30 jours ouvrés. Votre badge « NDA Vérifié » apparaît automatiquement sur votre profil PedagoBridge."}],WY=[{question:"Qu'est-ce que le numéro de déclaration d'activité (NDA) ?",answer:"C'est un identifiant à 11 chiffres délivré par la DREETS (Direction Régionale de l'Économie, de l'Emploi, du Travail et des Solidarités) lors de la première prestation de formation dispensée. Il atteste que votre activité de formation est légalement déclarée en France."},{question:"Qui est concerné par l'obligation d'avoir un NDA ?",answer:"Toute personne physique ou morale qui réalise des actions de formation professionnelle en tant qu'organisme de formation doit déclarer son activité et obtenir un NDA, que ce soit en tant qu'indépendant (auto-entrepreneur, SASU, EURL) ou en société."},{question:"Combien de temps faut-il pour obtenir le NDA ?",answer:"La DREETS dispose de 30 jours ouvrés pour traiter votre déclaration. La procédure se fait en ligne via le portail Mon Activité Formation (MAF). Nous vous accompagnons pour éviter les erreurs qui pourraient retarder l'obtention."},{question:"Le service d'assistance NDA est-il gratuit ?",answer:"Oui. PedagoBridge propose ce service d'accompagnement gratuitement à tous les formateurs inscrits sur la plateforme. C'est notre façon de faciliter votre intégration dans l'écosystème de la formation professionnelle."},{question:"Que se passe-t-il une fois mon NDA obtenu ?",answer:"Votre numéro est vérifié par notre équipe et ajouté à votre profil. Un badge « NDA Vérifié » apparaît, augmentant votre visibilité et la confiance des établissements qui consultent votre profil."}];function Q4t(){const e=Xt(),{user:t}=Ur(),r={"@context":"https://schema.org","@type":"Service",name:"Assistance à l'obtention du Numéro de Déclaration d'Activité (NDA) — PedagoBridge",description:"PedagoBridge accompagne les formateurs indépendants dans l'obtention de leur numéro de déclaration d'activité (NDA) auprès de la DREETS. Service gratuit pour tous les formateurs inscrits.",provider:{"@type":"Organization",name:"PedagoBridge",url:"https://pedagobridge.com"},serviceType:"Accompagnement administratif formation",areaServed:{"@type":"Country",name:"France"},offers:{"@type":"Offer",price:"0",priceCurrency:"EUR",description:"Service gratuit pour les formateurs inscrits sur PedagoBridge"}};return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Obtenir son Numéro de Déclaration d'Activité (NDA) — Formateurs",description:"PedagoBridge vous accompagne gratuitement pour obtenir votre numéro de déclaration d'activité (NDA) auprès de la DREETS. Indispensable pour exercer légalement et accéder au CPF et OPCO.",url:"/assistance-nda",keywords:["numéro déclaration activité formation","NDA formateur indépendant","déclarer activité formation DREETS","obtenir NDA formateur","déclaration activité organisme formation","MAF mon activité formation","formateur CPF OPCO"]}),s.jsx(sd,{items:WY}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Formateurs",url:"/trainers"},{name:"Assistance NDA",url:"/assistance-nda"}]}),s.jsx(nu,{children:s.jsx("script",{type:"application/ld+json",children:JSON.stringify(r)})}),s.jsx("section",{className:"bg-gradient-to-br from-emerald-600/90 to-emerald-900/90 text-white py-16 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[s.jsx(Le,{className:"mb-4 bg-white/20 text-white border-white/30 hover:bg-white/20",children:"Service formateurs — Gratuit"}),s.jsx("div",{className:"flex justify-center mb-4",children:s.jsx(Vc,{className:"h-14 w-14 opacity-90"})}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-6",children:"Obtenez votre Numéro de Déclaration d'Activité"}),s.jsx("p",{className:"text-lg md:text-xl opacity-90 max-w-2xl mx-auto mb-8",children:"Le NDA est indispensable pour exercer légalement en tant que formateur et accéder aux financements CPF et OPCO. PedagoBridge vous accompagne gratuitement dans vos démarches."}),t?s.jsxs(ne,{size:"lg",variant:"secondary",className:"text-lg shadow-lg",onClick:()=>e("/trainer/profile"),children:[s.jsx(Gt,{className:"mr-2 h-5 w-5"}),"Demander l'assistance depuis mon profil"]}):s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsxs(ne,{size:"lg",variant:"secondary",className:"text-lg shadow-lg",onClick:()=>e("/trainer-register"),children:[s.jsx(sr,{className:"mr-2 h-5 w-5"}),"Créer mon profil formateur"]}),s.jsxs(ne,{size:"lg",variant:"outline",className:"text-lg bg-white/20 border-white text-white hover:bg-white hover:text-emerald-800",onClick:()=>e("/auth"),children:["J'ai déjà un compte",s.jsx(Mn,{className:"ml-2 h-5 w-5"})]})]})]})}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Pourquoi le NDA est essentiel"}),s.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-xl mx-auto",children:"Sans numéro de déclaration d'activité, votre activité de formation reste informelle et exclue de nombreux dispositifs."}),s.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:Z4t.map(n=>{const a=n.icon;return s.jsxs(ke,{className:"text-center",children:[s.jsxs(ht,{className:"pb-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-emerald-50 dark:bg-emerald-950/30 flex items-center justify-center mx-auto mb-3",children:s.jsx(a,{className:"h-6 w-6 text-emerald-600"})}),s.jsx(xt,{className:"text-base",children:n.title})]}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})})]},n.title)})}),s.jsxs("div",{className:"mt-8 p-4 bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg flex gap-3",children:[s.jsx(Di,{className:"h-5 w-5 text-amber-600 flex-shrink-0 mt-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"La déclaration d'activité doit être effectuée dans les 3 mois suivant votre première prestation de formation, sous peine d'amendes administratives."})})]})]})}),s.jsx("section",{className:"py-16 px-4 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto max-w-4xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Comment ça se passe ?"}),s.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-xl mx-auto",children:"PedagoBridge vous guide de la demande initiale jusqu'à l'obtention de votre numéro."}),s.jsx("div",{className:"space-y-4",children:J4t.map(n=>s.jsxs("div",{className:"flex gap-4 items-start",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-600 text-white font-bold flex items-center justify-center flex-shrink-0",children:n.step}),s.jsxs("div",{className:"flex-1 pt-1",children:[s.jsx("h3",{className:"font-semibold mb-1",children:n.title}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]})]},n.step))}),s.jsxs("div",{className:"mt-10 text-center",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground mb-6",children:[s.jsx(Gr,{className:"h-4 w-4"}),s.jsx("span",{children:"Délai moyen : 30 jours ouvrés après dépôt du dossier"})]}),s.jsx("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:t?s.jsxs(ne,{size:"lg",className:"bg-emerald-600 hover:bg-emerald-700",onClick:()=>e("/trainer/profile"),children:[s.jsx(Vc,{className:"mr-2 h-5 w-5"}),"Demander l'assistance NDA"]}):s.jsxs(ne,{size:"lg",className:"bg-emerald-600 hover:bg-emerald-700",onClick:()=>e("/trainer-register"),children:[s.jsx(sr,{className:"mr-2 h-5 w-5"}),"Créer mon profil et demander l'assistance"]})})]})]})}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-4xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-10",children:"Avec votre NDA sur PedagoBridge"}),s.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:[{icon:iu,title:"Badge « NDA Vérifié »",description:"Votre profil affiche un badge de confiance visible par tous les établissements qui recherchent des formateurs."},{icon:xl,title:"Accès aux offres premium",description:"Certaines offres publiées par les établissements exigent un NDA. Avec le vôtre, vous y avez accès."},{icon:Wr,title:"Éligibilité CPF & OPCO",description:"Vos formations peuvent être financées par le CPF et les OPCO, élargissant votre base de clients potentiels."},{icon:sr,title:"Crédibilité renforcée",description:"Les écoles et entreprises font davantage confiance aux formateurs dont l'activité est officiellement déclarée."}].map(n=>{const a=n.icon;return s.jsxs("div",{className:"flex gap-3 p-4 rounded-lg border bg-card",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-emerald-50 dark:bg-emerald-950/30 flex items-center justify-center flex-shrink-0",children:s.jsx(a,{className:"h-4 w-4 text-emerald-600"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-sm mb-1",children:n.title}),s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description})]})]},n.title)})})]})}),s.jsx("section",{className:"py-16 px-4 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-10",children:"Questions fréquentes"}),s.jsx("div",{className:"space-y-4",children:WY.map(n=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-base font-semibold",children:n.question})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:n.answer})})]},n.question))})]})}),s.jsx("section",{className:"py-16 px-4 bg-emerald-600 text-white text-center",children:s.jsxs("div",{className:"container mx-auto max-w-2xl",children:[s.jsx(Vc,{className:"h-12 w-12 mx-auto mb-4 opacity-80"}),s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Prêt à officialiser votre activité ?"}),s.jsx("p",{className:"opacity-90 mb-8 text-lg",children:"Créez votre profil formateur et bénéficiez gratuitement de notre accompagnement NDA."}),s.jsxs(ne,{size:"lg",variant:"secondary",className:"text-lg",onClick:()=>e(t?"/trainer/profile":"/trainer-register"),children:[t?"Demander l'assistance NDA":"Créer mon profil formateur",s.jsx(Mn,{className:"ml-2 h-5 w-5"})]})]})})]})}const ekt=[{criteria:"Délai pour trouver un formateur",pedagobridge:{value:"24–48h",good:!0},agence:{value:"2–4 semaines",good:!1},linkedin:{value:"1–3 semaines",good:!1},bouche:{value:"Indéfini",good:!1}},{criteria:"Vérification des profils",pedagobridge:{value:"Diplômes + références vérifiés",good:!0},agence:{value:"Partielle selon l'agence",good:null},linkedin:{value:"Aucune",good:!1},bouche:{value:"Aucune garantie",good:!1}},{criteria:"Coût pour l'établissement",pedagobridge:{value:"Gratuit (publication)",good:!0},agence:{value:"Commission 15–30 %",good:!1},linkedin:{value:"Gratuit mais chronophage",good:null},bouche:{value:"Gratuit mais aléatoire",good:null}},{criteria:"Remplacement d'urgence",pedagobridge:{value:"Garanti sous 48h",good:!0},agence:{value:"Selon contrat",good:null},linkedin:{value:"Non",good:!1},bouche:{value:"Non",good:!1}},{criteria:"Conformité Qualiopi",pedagobridge:{value:"Outils intégrés",good:!0},agence:{value:"Non incluse",good:!1},linkedin:{value:"Non incluse",good:!1},bouche:{value:"Non incluse",good:!1}},{criteria:"Suivi & messagerie",pedagobridge:{value:"Plateforme dédiée",good:!0},agence:{value:"Email / téléphone",good:null},linkedin:{value:"Messagerie générique",good:null},bouche:{value:"Aucun",good:!1}},{criteria:"Constitution de programmes",pedagobridge:{value:"Service dédié inclus",good:!0},agence:{value:"Non proposé",good:!1},linkedin:{value:"Non proposé",good:!1},bouche:{value:"Non proposé",good:!1}}],tkt=[{icon:Gr,title:"Des semaines pour trouver le bon profil",problem:"Recherches sur LinkedIn, emails sans réponse, candidats non disponibles… Le recrutement d'un formateur mobilise un temps précieux.",solution:"PedagoBridge : première candidature en 24h en moyenne."},{icon:Yd,title:"Aucune garantie de qualité",problem:"Un CV prometteur ne garantit pas un formateur compétent. Les établissements découvrent souvent les lacunes en salle.",solution:"PedagoBridge vérifie diplômes, expérience et fournit les avis d'autres établissements."},{icon:Gy,title:"Les agences coûtent cher",problem:"Les agences de placement prennent 15 à 30 % de commission sur le tarif du formateur, sans valeur ajoutée réelle.",solution:"PedagoBridge est gratuit pour les établissements. Vous payez uniquement le formateur."},{icon:nC,title:"Rien en cas d'annulation de dernière minute",problem:"Un formateur se désiste la veille ? Sans réseau de secours, c'est toute une session compromise.",solution:"PedagoBridge garantit un remplacement qualifié sous 48h."}],HY=[{question:"PedagoBridge remplace-t-il les agences de placement de formateurs ?",answer:"Oui, pour la plupart des besoins. PedagoBridge propose un accès direct à des formateurs vérifiés, sans commission d'intermédiaire et avec des délais bien inférieurs. Pour des besoins très spécifiques nécessitant un accompagnement RH long terme, une agence peut rester complémentaire."},{question:"Les formateurs sont-ils vraiment vérifiés ?",answer:"Oui. Notre équipe contrôle les diplômes, l'expérience professionnelle, les références et le numéro de déclaration d'activité (NDA) avant de valider chaque profil. Un badge affiché sur le profil indique le niveau de vérification."},{question:"Combien coûte PedagoBridge pour un établissement ?",answer:"La publication d'offres et l'accès aux formateurs sont entièrement gratuits. Une offre SaaS à 99 €/mois est disponible pour les établissements souhaitant accéder aux outils de gestion avancés (émargement, facturation, Qualiopi)."},{question:"PedagoBridge est-il adapté aux petits établissements ?",answer:"Oui. Que vous soyez un CFA de 50 apprenants ou une école supérieure de 2 000 étudiants, la plateforme s'adapte à votre volume d'offres. Aucun engagement minimum n'est requis."}];function rkt(){const e=Xt(),t=({good:r})=>r===!0?s.jsx(Wr,{className:"h-5 w-5 text-green-500 mx-auto"}):r===!1?s.jsx(Fs,{className:"h-5 w-5 text-red-400 mx-auto"}):s.jsx("span",{className:"text-muted-foreground text-xs mx-auto block text-center",children:"~"});return s.jsxs(s.Fragment,{children:[s.jsx(gr,{title:"Pourquoi PedagoBridge plutôt qu'une agence ou LinkedIn ?",description:"Comparatif honnête : PedagoBridge vs agences de placement, LinkedIn et bouche-à-oreille pour recruter des formateurs. Délai, coût, qualité, garanties.",url:"/pourquoi-pedagobridge",keywords:["alternative agence formateurs","recruter formateur sans agence","trouver formateur école rapidement","comparatif plateforme formateurs","formateur linkedin vs plateforme"]}),s.jsx(sd,{items:HY}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Pourquoi PedagoBridge",url:"/pourquoi-pedagobridge"}]}),s.jsx("section",{className:"bg-gradient-to-br from-primary/90 to-secondary/80 text-white py-16 px-4",children:s.jsxs("div",{className:"container mx-auto max-w-3xl text-center",children:[s.jsx(Le,{className:"mb-4 bg-white/20 text-white border-white/30 hover:bg-white/20",children:"Comparatif objectif"}),s.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-6",children:"Pourquoi choisir PedagoBridge ?"}),s.jsx("p",{className:"text-lg md:text-xl opacity-90 max-w-2xl mx-auto mb-8",children:"Agence, LinkedIn, bouche-à-oreille… On compare sans détour les différentes façons de trouver un formateur pour votre établissement."}),s.jsxs(ne,{size:"lg",variant:"secondary",className:"text-lg",onClick:()=>e("/school-register"),children:["Essayer gratuitement",s.jsx(Mn,{className:"ml-2 h-5 w-5"})]})]})}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-4",children:"Les problèmes que vous connaissez"}),s.jsx("p",{className:"text-center text-muted-foreground mb-12 max-w-xl mx-auto",children:"Ce que vivent concrètement la plupart des directeurs pédagogiques avant de découvrir PedagoBridge."}),s.jsx("div",{className:"grid sm:grid-cols-2 gap-6",children:tkt.map(r=>{const n=r.icon;return s.jsxs(ke,{className:"border-red-100 dark:border-red-900/30",children:[s.jsx(ht,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-red-50 dark:bg-red-950/30 flex items-center justify-center shrink-0",children:s.jsx(n,{className:"h-4 w-4 text-red-500"})}),s.jsx(xt,{className:"text-base",children:r.title})]})}),s.jsxs(Ae,{className:"space-y-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:r.problem}),s.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-green-50 dark:bg-green-950/20",children:[s.jsx(Wr,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"}),s.jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:r.solution})]})]})]},r.title)})})]})}),s.jsx("section",{className:"py-16 px-4 bg-muted/30",children:s.jsxs("div",{className:"container mx-auto max-w-5xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-12",children:"Comparatif détaillé"}),s.jsx("div",{className:"overflow-x-auto rounded-xl border bg-background shadow-sm",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b bg-muted/50",children:[s.jsx("th",{className:"text-left p-4 font-semibold",children:"Critère"}),s.jsx("th",{className:"text-center p-4 font-semibold text-primary",children:s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx(Vc,{className:"h-5 w-5"}),"PedagoBridge"]})}),s.jsx("th",{className:"text-center p-4 font-semibold text-muted-foreground",children:"Agence"}),s.jsx("th",{className:"text-center p-4 font-semibold text-muted-foreground",children:"LinkedIn"}),s.jsx("th",{className:"text-center p-4 font-semibold text-muted-foreground",children:"Bouche-à-oreille"})]})}),s.jsx("tbody",{children:ekt.map((r,n)=>s.jsxs("tr",{className:n%2===0?"":"bg-muted/20",children:[s.jsx("td",{className:"p-4 font-medium",children:r.criteria}),s.jsx("td",{className:"p-4 text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx(t,{good:r.pedagobridge.good}),s.jsx("span",{className:"text-xs text-primary font-medium",children:r.pedagobridge.value})]})}),s.jsx("td",{className:"p-4 text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx(t,{good:r.agence.good}),s.jsx("span",{className:"text-xs text-muted-foreground",children:r.agence.value})]})}),s.jsx("td",{className:"p-4 text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx(t,{good:r.linkedin.good}),s.jsx("span",{className:"text-xs text-muted-foreground",children:r.linkedin.value})]})}),s.jsx("td",{className:"p-4 text-center",children:s.jsxs("div",{className:"flex flex-col items-center gap-1",children:[s.jsx(t,{good:r.bouche.good}),s.jsx("span",{className:"text-xs text-muted-foreground",children:r.bouche.value})]})})]},r.criteria))})]})})]})}),s.jsx("section",{className:"py-16 px-4 bg-background",children:s.jsxs("div",{className:"container mx-auto max-w-3xl",children:[s.jsx("h2",{className:"text-3xl font-bold text-center mb-10",children:"Questions fréquentes"}),s.jsx("div",{className:"space-y-4",children:HY.map(r=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-base font-semibold",children:r.question})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:r.answer})})]},r.question))})]})}),s.jsx("section",{className:"py-16 px-4 bg-primary text-white text-center",children:s.jsxs("div",{className:"container mx-auto max-w-2xl",children:[s.jsx(sr,{className:"h-12 w-12 mx-auto mb-4 opacity-80"}),s.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Convaincu ? Essayez gratuitement."}),s.jsx("p",{className:"opacity-90 mb-8 text-lg",children:"Inscription gratuite. Première offre publiée en 5 minutes. Aucun engagement."}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[s.jsxs(ne,{size:"lg",variant:"secondary",className:"text-lg",onClick:()=>e("/school-register"),children:[s.jsx(Vr,{className:"mr-2 h-5 w-5"}),"Créer mon espace établissement"]}),s.jsx(ne,{size:"lg",variant:"outline",className:"text-lg bg-transparent border-white text-white hover:bg-white hover:text-primary",onClick:()=>e("/pour-les-ecoles"),children:"En savoir plus"})]})]})})]})}const LS="2026-06-11",nkt=[{domain:"Développement Web",slug:"developpement-web",low:500,high:900},{domain:"Data Science / IA",slug:"data-science",low:600,high:1100},{domain:"Cybersécurité",slug:"cybersecurite",low:650,high:1200},{domain:"Cloud / DevOps",slug:"cloud-devops",low:600,high:1100},{domain:"Management & Leadership",slug:"management",low:600,high:950},{domain:"Ressources Humaines / Paie",slug:"ressources-humaines",low:700,high:1e3},{domain:"Marketing digital / SEO",slug:"developpement-web",low:700,high:1100},{domain:"Communication & Pédagogie",slug:"pedagogie",low:600,high:900},{domain:"Santé / Sécurité au travail",slug:"sante-securite",low:500,high:850}],skt=[{level:"Débutant (< 3 ans)",range:"400 – 600 €",note:"Formateur récent, généraliste."},{level:"Expérimenté (3–8 ans)",range:"600 – 1 000 €",note:"Spécialité affirmée, références clients."},{level:"Expert / niche (8 ans +)",range:"1 000 – 1 800 €",note:"Domaine rare, forte demande."}],GY=[{question:"Quel est le TJM moyen d'un formateur indépendant en France en 2026 ?",answer:"Le tarif journalier d'un formateur indépendant se situe généralement entre 400 et 2 000 € HT par jour. Le TJM médian observé pour un profil expérimenté avec une spécialité est d'environ 750 à 900 € HT/jour. Le tarif varie selon le domaine, l'expérience, la rareté de la compétence et la région (majoration de 10 à 20 % en région parisienne)."},{question:"Comment un organisme de formation calcule-t-il le coût d'un formateur ?",answer:"Le coût total = TJM × nombre de jours d'intervention, auquel s'ajoutent éventuellement les frais de déplacement et d'hébergement pour le présentiel. Sur PedagoBridge, vous publiez gratuitement votre besoin et recevez des propositions de formateurs avec leur tarif, sans commission ni frais d'intermédiation."},{question:"Le TJM d'un formateur est-il négociable ?",answer:"Oui. Le TJM dépend du volume de jours, de la récurrence de la mission, du format (présentiel ou distanciel) et de la complexité du sujet. Une mission longue ou récurrente justifie souvent un tarif dégressif. La transparence sur le besoin facilite la négociation."},{question:"Combien coûte la mise en relation avec un formateur sur PedagoBridge ?",answer:"La mise en relation est 100 % gratuite, pour les établissements comme pour les formateurs. PedagoBridge ne prélève aucune commission sur les missions : vous payez uniquement le formateur, au tarif convenu directement avec lui."},{question:"Quelle différence entre TJM et coût horaire d'un formateur ?",answer:"Le TJM (Tarif Journalier Moyen) couvre une journée de formation, généralement 7 heures. Le coût horaire correspond au TJM divisé par le nombre d'heures. Pour des interventions courtes (2–3 h), les formateurs appliquent souvent un tarif horaire majoré pour couvrir la préparation."}];function akt(){const{data:e}=ga({queryKey:["network-tjm"],queryFn:async()=>{const{data:t,error:r}=await he.rpc("get_public_trainer_profiles");if(r)return null;const n=(t||[]).map(i=>i.preferred_tjm).filter(i=>typeof i=="number"&&i>0);return n.length<5?null:{avg:Math.round(n.reduce((i,o)=>i+o,0)/n.length),count:n.length}}});return s.jsxs(xa,{children:[s.jsx(gr,{title:"Tarif d'un formateur en 2026 : TJM par domaine & guide complet",description:"Combien coûte un formateur indépendant en 2026 ? TJM moyen par domaine et par profil, méthode de calcul et fourchettes de prix. Trouvez gratuitement un formateur certifié sur PedagoBridge.",url:"/tarif-formateur",type:"article",publishedTime:LS,modifiedTime:LS,keywords:["TJM formateur","tarif formateur freelance","combien coûte un formateur","coût formateur indépendant","prix formation professionnelle","tarif journalier formateur 2026"]}),s.jsx(Ase,{}),s.jsx(AL,{headline:"Tarif d'un formateur en 2026 : TJM par domaine et guide complet",description:"TJM moyen d'un formateur indépendant par domaine et par profil, méthode de calcul et fourchettes de prix en France en 2026.",publishedTime:LS,modifiedTime:LS,url:"/tarif-formateur"}),s.jsx(sd,{items:GY}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Tarif d'un formateur",url:"/tarif-formateur"}]}),s.jsxs("div",{className:"container mx-auto px-4 py-10 max-w-4xl",children:[s.jsxs("nav",{className:"text-sm text-muted-foreground mb-4","aria-label":"Fil d'ariane",children:[s.jsx(vt,{to:"/",className:"hover:underline",children:"Accueil"}),s.jsx("span",{className:"mx-2",children:"/"}),s.jsx("span",{children:"Tarif d'un formateur"})]}),s.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Combien coûte un formateur en 2026 ? Le guide du TJM"}),s.jsxs("p",{className:"text-lg text-muted-foreground mb-6",children:["Le tarif journalier (TJM) d'un formateur indépendant en France se situe en 2026 entre",s.jsx("strong",{children:" 400 et 2 000 € HT/jour"}),", avec une médiane autour de",s.jsx("strong",{children:" 750–900 € HT"})," pour un profil expérimenté. Le prix dépend du domaine, de l'expérience, de la rareté de la compétence et de la région."]}),s.jsxs("div",{className:"flex flex-wrap gap-3 mb-8",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(vt,{to:"/training-request?utm_source=tarif_formateur&utm_medium=cta",children:["Publier un besoin gratuitement ",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})}),s.jsx(ne,{asChild:!0,variant:"outline",size:"lg",children:s.jsx(vt,{to:"/formateurs",children:"Parcourir les formateurs"})})]}),e&&s.jsx(ke,{className:"mb-8 border-primary/30 bg-primary/5",children:s.jsxs(Ae,{className:"flex items-center gap-3 py-4",children:[s.jsx(Kd,{className:"h-6 w-6 text-primary shrink-0"}),s.jsxs("p",{className:"text-sm",children:[s.jsx("strong",{children:"Données réseau PedagoBridge :"})," le TJM moyen indiqué par nos"," ",e.count," formateurs certifiés est de"," ",s.jsxs("strong",{children:[e.avg," € HT/jour"]}),"."]})]})}),s.jsxs("section",{className:"mb-10",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[s.jsx(bve,{className:"h-6 w-6 text-primary"})," TJM moyen par domaine de formation"]}),s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-muted/50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left p-3 font-semibold",children:"Domaine"}),s.jsx("th",{className:"text-left p-3 font-semibold",children:"Fourchette (€ HT / jour)"}),s.jsx("th",{className:"text-right p-3 font-semibold",children:"Formateurs"})]})}),s.jsx("tbody",{children:nkt.map(t=>s.jsxs("tr",{className:"border-t",children:[s.jsx("td",{className:"p-3",children:t.domain}),s.jsxs("td",{className:"p-3",children:[t.low," – ",t.high," €"]}),s.jsx("td",{className:"p-3 text-right",children:s.jsx(vt,{to:`/skills/${t.slug}`,className:"text-primary hover:underline whitespace-nowrap",children:"Voir →"})})]},t.domain))})]})}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Fourchettes indicatives basées sur les données de marché 2026 (France métropolitaine, hors majoration parisienne de 10–20 %)."})]}),s.jsxs("section",{className:"mb-10",children:[s.jsx("h2",{className:"text-2xl font-bold mb-4",children:"TJM selon le profil d'expérience"}),s.jsx("div",{className:"grid md:grid-cols-3 gap-4",children:skt.map(t=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-base",children:t.level})}),s.jsxs(Ae,{children:[s.jsx("div",{className:"text-2xl font-bold text-primary mb-1",children:t.range}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t.note})]})]},t.level))})]}),s.jsxs("section",{className:"mb-10",children:[s.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Comment calculer le coût d'une formation ?"}),s.jsx(ke,{children:s.jsxs(Ae,{className:"py-5 space-y-3 text-sm",children:[s.jsx("p",{className:"font-mono bg-muted rounded p-3",children:"Coût total = TJM × nombre de jours (+ frais de déplacement éventuels)"}),s.jsxs("p",{children:["Exemple : une formation de 3 jours en management à 800 € HT/jour revient à"," ",s.jsx("strong",{children:"2 400 € HT"}),", hors frais de déplacement. Pour une mission récurrente, un tarif dégressif est fréquent."]}),s.jsx("ul",{className:"space-y-2",children:["Pas de commission : sur PedagoBridge, vous payez uniquement le formateur.","Tarifs transparents annoncés directement par les formateurs.","Remplacement en urgence possible (formateur disponible sous 24–48 h)."].map(t=>s.jsxs("li",{className:"flex items-start gap-2",children:[s.jsx(ma,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),s.jsx("span",{children:t})]},t))})]})})]}),s.jsxs("section",{className:"mb-10",children:[s.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Questions fréquentes"}),s.jsx("div",{className:"space-y-4",children:GY.map(t=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-base",children:t.question})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:t.answer})})]},t.question))})]}),s.jsxs("section",{className:"mb-10",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[s.jsx(Gs,{className:"h-6 w-6 text-primary"})," Trouver un formateur près de chez vous"]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:["Paris","Lyon","Marseille","Toulouse","Bordeaux","Lille","Nantes","Strasbourg"].map(t=>s.jsx(Le,{variant:"secondary",asChild:!0,children:s.jsxs(vt,{to:`/villes/${t.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-")}`,children:["Formateurs à ",t]})},t))})]}),s.jsx(ke,{className:"bg-gradient-to-br from-primary/10 to-primary/5 border-primary/20",children:s.jsxs(Ae,{className:"py-8 text-center",children:[s.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Besoin d'un formateur ? C'est gratuit."}),s.jsx("p",{className:"text-muted-foreground mb-5 max-w-xl mx-auto",children:"Publiez votre besoin en 2 minutes et recevez des propositions de formateurs experts et certifiés, partout en France — sans commission."}),s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(vt,{to:"/training-request?utm_source=tarif_formateur&utm_medium=cta_bottom",children:["Publier mon besoin ",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})})]})})]})]})}const FS="2026-06-11",ikt=[{icon:Gt,title:"1. Choisir son statut",body:"Micro-entreprise, entreprise individuelle, EURL ou portage salarial. La micro-entreprise est la plus simple pour démarrer ; le portage évite toute gestion administrative."},{icon:Gt,title:"2. Déclarer son activité (NDA)",body:"Pour facturer des prestations de formation, demandez votre numéro de déclaration d'activité (NDA) auprès de la DREETS, dans les 3 mois suivant votre premier contrat."},{icon:Gy,title:"3. Fixer son TJM",body:"Le tarif journalier d'un formateur se situe entre 400 et 2 000 € HT/jour selon le domaine et l'expérience.",link:{to:"/tarif-formateur",label:"Voir le guide des tarifs (TJM) →"}},{icon:as,title:"4. Trouver des missions",body:"Réseau, bouche-à-oreille, plateformes de mise en relation. PedagoBridge vous connecte gratuitement avec des écoles et organismes qui recherchent des formateurs."}],okt=["100 % gratuit — aucune commission sur vos missions, vous êtes payé directement par l'établissement.","Profil créé en 2 minutes : déposez votre CV, notre IA remplit vos spécialités, votre bio et vos expériences.","Visibilité auprès d'écoles et organismes de formation partout en France.","Vous fixez vos tarifs et vos conditions — PedagoBridge ne s'interpose pas dans la relation."],KY=[{question:"Comment devenir formateur indépendant en France ?",answer:"Quatre étapes : (1) choisir un statut (micro-entreprise, entreprise individuelle, EURL ou portage salarial), (2) obtenir votre numéro de déclaration d'activité (NDA) auprès de la DREETS dans les 3 mois suivant votre premier contrat de formation, (3) définir votre tarif journalier (TJM), et (4) trouver des missions via votre réseau ou des plateformes de mise en relation comme PedagoBridge."},{question:"Faut-il un diplôme pour être formateur indépendant ?",answer:"Aucun diplôme spécifique n'est obligatoire pour devenir formateur. Ce qui compte, c'est votre expertise dans votre domaine et votre capacité à transmettre. Une certification ou des références renforcent toutefois votre crédibilité auprès des organismes de formation."},{question:"Qu'est-ce que le numéro de déclaration d'activité (NDA) ?",answer:"Le NDA est l'enregistrement de votre activité de formation auprès de la DREETS de votre région. Il est obligatoire pour facturer des prestations de formation professionnelle et doit être demandé dans les 3 mois suivant la signature de votre premier contrat ou convention de formation."},{question:"Comment trouver des missions de formation ?",answer:"Via votre réseau professionnel, le bouche-à-oreille, LinkedIn, et les plateformes spécialisées. Sur PedagoBridge, vous créez gratuitement votre profil et devenez visible auprès des écoles et organismes de formation qui recherchent des intervenants — sans commission sur vos missions."},{question:"Combien gagne un formateur indépendant ?",answer:"Le revenu dépend du tarif journalier (400 à 2 000 € HT/jour, médiane ~750–900 € pour un profil expérimenté) et du nombre de jours facturés. Consultez notre guide du TJM par domaine pour situer votre tarif."}];function lkt(){return s.jsxs(xa,{children:[s.jsx(gr,{title:"Devenir formateur indépendant : statut, missions & tarifs (2026)",description:"Comment devenir formateur indépendant en France : statut juridique, déclaration d'activité (NDA), TJM et comment trouver des missions. Rejoignez gratuitement le réseau PedagoBridge.",url:"/devenir-formateur",type:"article",publishedTime:FS,modifiedTime:FS,keywords:["devenir formateur indépendant","rejoindre un réseau de formateurs","trouver des missions de formation","statut formateur indépendant","numéro de déclaration d'activité","formateur freelance"]}),s.jsx(Ase,{}),s.jsx(AL,{headline:"Devenir formateur indépendant : statut, missions et tarifs",description:"Guide complet pour devenir formateur indépendant en France : statut, NDA, TJM et comment trouver des missions de formation.",publishedTime:FS,modifiedTime:FS,url:"/devenir-formateur"}),s.jsx(sd,{items:KY}),s.jsx(Qa,{items:[{name:"Accueil",url:"/"},{name:"Devenir formateur",url:"/devenir-formateur"}]}),s.jsxs("div",{className:"container mx-auto px-4 py-10 max-w-4xl",children:[s.jsxs("nav",{className:"text-sm text-muted-foreground mb-4","aria-label":"Fil d'ariane",children:[s.jsx(vt,{to:"/",className:"hover:underline",children:"Accueil"}),s.jsx("span",{className:"mx-2",children:"/"}),s.jsx("span",{children:"Devenir formateur"})]}),s.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Devenir formateur indépendant : le guide complet 2026"}),s.jsxs("p",{className:"text-lg text-muted-foreground mb-6",children:["Vous êtes expert dans votre domaine et souhaitez transmettre ? Voici comment lancer votre activité de formateur indépendant en France — statut, déclaration d'activité, tarifs — et comment ",s.jsx("strong",{children:"trouver des missions gratuitement"}),"."]}),s.jsxs("div",{className:"flex flex-wrap gap-3 mb-10",children:[s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(vt,{to:"/trainer-register?utm_source=devenir_formateur&utm_medium=cta",children:["Créer mon profil formateur (gratuit) ",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})}),s.jsx(ne,{asChild:!0,variant:"outline",size:"lg",children:s.jsx(vt,{to:"/tarif-formateur",children:"Voir les tarifs (TJM)"})})]}),s.jsxs("section",{className:"mb-12",children:[s.jsx("h2",{className:"text-2xl font-bold mb-5",children:"Les 4 étapes pour se lancer"}),s.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:ikt.map(e=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsxs(xt,{className:"text-base flex items-center gap-2",children:[s.jsx(e.icon,{className:"h-5 w-5 text-primary"})," ",e.title]})}),s.jsxs(Ae,{children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:e.body}),e.link&&s.jsx(vt,{to:e.link.to,className:"text-sm text-primary hover:underline mt-2 inline-block",children:e.link.label})]})]},e.title))})]}),s.jsxs("section",{className:"mb-12",children:[s.jsxs("h2",{className:"text-2xl font-bold mb-5 flex items-center gap-2",children:[s.jsx(Uo,{className:"h-6 w-6 text-primary"})," Pourquoi rejoindre PedagoBridge ?"]}),s.jsx(ke,{children:s.jsx(Ae,{className:"py-5",children:s.jsx("ul",{className:"space-y-3",children:okt.map(e=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx(ma,{className:"h-5 w-5 text-primary mt-0.5 shrink-0"}),s.jsx("span",{children:e})]},e))})})})]}),s.jsxs("section",{className:"mb-12",children:[s.jsx("h2",{className:"text-2xl font-bold mb-5",children:"Questions fréquentes"}),s.jsx("div",{className:"space-y-4",children:KY.map(e=>s.jsxs(ke,{children:[s.jsx(ht,{className:"pb-2",children:s.jsx(xt,{className:"text-base",children:e.question})}),s.jsx(Ae,{children:s.jsx("p",{className:"text-sm text-muted-foreground",children:e.answer})})]},e.question))})]}),s.jsx(ke,{className:"bg-gradient-to-br from-primary/10 to-primary/5 border-primary/20",children:s.jsxs(Ae,{className:"py-8 text-center",children:[s.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Prêt à recevoir des missions ?"}),s.jsx("p",{className:"text-muted-foreground mb-5 max-w-xl mx-auto",children:"Créez votre profil en 2 minutes — déposez simplement votre CV, notre IA s'occupe du reste. Gratuit, sans commission."}),s.jsx(ne,{asChild:!0,size:"lg",children:s.jsxs(vt,{to:"/trainer-register?utm_source=devenir_formateur&utm_medium=cta_bottom",children:["Créer mon profil formateur ",s.jsx(Mn,{className:"ml-2 h-4 w-4"})]})})]})})]})]})}const ckt=new fwe;function ukt(){const e=ou();return w.useEffect(()=>{OCe(e.pathname),Ai.pageView(e.pathname,{search:e.search}),xi.trackPageView(e.pathname,{search:e.search})},[e]),s.jsx(xa,{children:s.jsxs(w2e,{children:[s.jsx(At,{path:"/",element:s.jsx(fOe,{})}),s.jsx(At,{path:"/auth",element:s.jsx(vOe,{})}),s.jsx(At,{path:"/reset-password",element:s.jsx(Cgt,{})}),s.jsx(At,{path:"/trainer-register",element:s.jsx(LOe,{})}),s.jsx(At,{path:"/trainer-signup",element:s.jsx(QLe,{})}),s.jsx(At,{path:"/training-request",element:s.jsx(E7e,{})}),s.jsx(At,{path:"/training-offers",element:s.jsx(_Ue,{})}),s.jsx(At,{path:"/training-offers/:id",element:s.jsx(SUe,{})}),s.jsx(At,{path:"/blog",element:s.jsx(gUe,{})}),s.jsx(At,{path:"/blog/:slug",element:s.jsx(vUe,{})}),s.jsx(At,{path:"/trainers",element:s.jsx(_K,{})}),s.jsx(At,{path:"/trainers/:id",element:s.jsx(NK,{})}),s.jsx(At,{path:"/skills",element:s.jsx(Egt,{})}),s.jsx(At,{path:"/skills/:skillName",element:s.jsx(Ugt,{})}),s.jsx(At,{path:"/villes",element:s.jsx(qgt,{})}),s.jsx(At,{path:"/villes/:cityName",element:s.jsx(Wgt,{})}),s.jsx(At,{path:"/villes/:cityName/:skillName",element:s.jsx(Ggt,{})}),s.jsx(At,{path:"/recruiter-tools/interview-questions",element:s.jsx(Ygt,{})}),s.jsx(At,{path:"/recruiter-tools/interview-questions/:skillName",element:s.jsx(Kgt,{})}),s.jsx(At,{path:"/glossaire",element:s.jsx(Xgt,{})}),s.jsx(At,{path:"/glossaire/:slug",element:s.jsx(Zgt,{})}),s.jsx(At,{path:"/metiers",element:s.jsx(Qgt,{})}),s.jsx(At,{path:"/metier/:slug",element:s.jsx(ext,{})}),s.jsx(At,{path:"/ressources",element:s.jsx(hxt,{})}),s.jsx(At,{path:"/ressources/:slug",element:s.jsx(pxt,{})}),s.jsx(At,{path:"/competence/:tag",element:s.jsx(A4t,{})}),s.jsx(At,{path:"/school-register",element:s.jsx(kK,{})}),s.jsx(At,{path:"/school/dashboard",element:s.jsx(SK,{})}),s.jsx(At,{path:"/school/profile",element:s.jsx(ggt,{})}),s.jsx(At,{path:"/school/messages",element:s.jsx(bgt,{})}),s.jsx(At,{path:"/school/applications",element:s.jsx(Ngt,{})}),s.jsx(At,{path:"/school/edit-offer/:id",element:s.jsx(kgt,{})}),s.jsx(At,{path:"/privacy",element:s.jsx(ZLe,{})}),s.jsx(At,{path:"/terms",element:s.jsx(JLe,{})}),s.jsx(At,{path:"/tarifs-planning",element:s.jsx(w7e,{})}),s.jsx(At,{path:"/feedback",element:s.jsx(_7e,{})}),s.jsx(At,{path:"/assistant",element:s.jsx(q4t,{})}),s.jsx(At,{path:"/outils/matching",element:s.jsx(lxt,{})}),s.jsx(At,{path:"/trainer/profile",element:s.jsx(bn,{requireTrainer:!0,children:s.jsx(s7e,{})})}),s.jsx(At,{path:"/trainer/contract",element:s.jsx(bn,{requireTrainer:!0,children:s.jsx(wUe,{})})}),s.jsx(At,{path:"/trainer-contract",element:s.jsx(y2e,{to:"/trainer/contract",replace:!0})}),s.jsx(At,{path:"/trainer/applications",element:s.jsx(bn,{requireTrainer:!0,children:s.jsx(a7e,{})})}),s.jsx(At,{path:"/trainer/messages",element:s.jsx(bn,{requireTrainer:!0,children:s.jsx(i7e,{})})}),s.jsx(At,{path:"/trainer/planning",element:s.jsx(bn,{requireTrainer:!0,children:s.jsx(p7e,{})})}),s.jsx(At,{path:"/trainer/bpf",element:s.jsx(bn,{requireTrainer:!0,children:s.jsx(v7e,{})})}),s.jsx(At,{path:"/admin",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(h6e,{})})}),s.jsx(At,{path:"/admin/invitations",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(m6e,{})})}),s.jsx(At,{path:"/admin/trainers",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(b8e,{})})}),s.jsx(At,{path:"/admin/blog",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(yUe,{})})}),s.jsx(At,{path:"/admin/blog/edit/:id",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(bUe,{})})}),s.jsx(At,{path:"/admin/editorial-calendar",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(QDe,{})})}),s.jsx(At,{path:"/admin/newsletter",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(eIe,{})})}),s.jsx(At,{path:"/admin/training-requests",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(kUe,{})})}),s.jsx(At,{path:"/admin/email-dashboard",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(rgt,{})})}),s.jsx(At,{path:"/admin/logs",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(agt,{})})}),s.jsx(At,{path:"/admin/analytics",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(igt,{})})}),s.jsx(At,{path:"/admin/schools",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(ogt,{})})}),s.jsx(At,{path:"/admin/school/:id",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(lgt,{})})}),s.jsx(At,{path:"/admin/invoices",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(ugt,{})})}),s.jsx(At,{path:"/admin/contracts",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(HLe,{})})}),s.jsx(At,{path:"/admin/missions",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(GLe,{})})}),s.jsx(At,{path:"/admin/planning",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(XLe,{})})}),s.jsx(At,{path:"/admin/school-reviews",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(cgt,{})})}),s.jsx(At,{path:"/admin/glossary",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(Jgt,{})})}),s.jsx(At,{path:"/admin/matcher",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(sxt,{})})}),s.jsx(At,{path:"/admin/linkedin-scanner",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(uxt,{})})}),s.jsx(At,{path:"/admin/linkedin-lead",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(dxt,{})})}),s.jsx(At,{path:"/admin/jobs",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(txt,{})})}),s.jsx(At,{path:"/admin/resources",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(vxt,{})})}),s.jsx(At,{path:"/admin/contact-messages",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(yxt,{})})}),s.jsx(At,{path:"/admin/documents",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(wxt,{})})}),s.jsx(At,{path:"/admin/drive",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(_xt,{})})}),s.jsx(At,{path:"/admin/nda-requests",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(Nxt,{})})}),s.jsx(At,{path:"/admin/trainer-mailing",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(E4t,{})})}),s.jsx(At,{path:"/admin/prospection",element:s.jsx(bn,{requireAdmin:!0,children:s.jsx(S4t,{})})}),s.jsx(At,{path:"/pour-les-ecoles",element:s.jsx(G4t,{})}),s.jsx(At,{path:"/constitution-de-programme",element:s.jsx(X4t,{})}),s.jsx(At,{path:"/assistance-nda",element:s.jsx(Q4t,{})}),s.jsx(At,{path:"/pourquoi-pedagobridge",element:s.jsx(rkt,{})}),s.jsx(At,{path:"/tarif-formateur",element:s.jsx(akt,{})}),s.jsx(At,{path:"/devenir-formateur",element:s.jsx(lkt,{})}),s.jsx(At,{path:"/offre-ecoles",element:s.jsx(O4t,{})}),s.jsx(At,{path:"/ecoles-secteur",element:s.jsx(I4t,{})}),s.jsx(At,{path:"/ecoles-secteur/:sector",element:s.jsx(L4t,{})}),s.jsx(At,{path:"/ecoles-region",element:s.jsx(M4t,{})}),s.jsx(At,{path:"/ecoles-region/:region",element:s.jsx(B4t,{})}),s.jsx(At,{path:"/formateurs",element:s.jsx(_K,{})}),s.jsx(At,{path:"/formateur/:id",element:s.jsx(NK,{})}),s.jsx(At,{path:"/inscription-ecole",element:s.jsx(kK,{})}),s.jsx(At,{path:"/ecole/dashboard",element:s.jsx(SK,{})}),s.jsx(At,{path:"*",element:s.jsx(hOe,{})})]})})}const dkt=()=>(w.useEffect(()=>{const e=n=>{const a=n instanceof Error?`${n.message}
${n.stack}`:String(n);return a.includes("Object Not Found Matching Id")||a.includes("chrome-extension://")||a.includes("moz-extension://")||a.includes("safari-extension://")},t=n=>{var a;e(n.error??n.message)||(a=n.filename)!=null&&a.includes("-extension://")||Ai.error("Unhandled error",n.error,{action:"global_error",metadata:{message:n.message,filename:n.filename,lineno:n.lineno,colno:n.colno}})},r=n=>{e(n.reason)||Ai.error("Unhandled promise rejection",n.reason,{action:"unhandled_rejection"})};return window.addEventListener("error",t),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",r)}},[]),s.jsx(TCe,{children:s.jsx(xwe,{client:ckt,children:s.jsxs(Og,{children:[s.jsx(Dye,{}),s.jsx(d1e,{}),s.jsx(A2e,{children:s.jsx(tNe,{children:s.jsx(ukt,{})})})]})})}));vJ(document.getElementById("root")).render(s.jsx(dkt,{}));export{rs as _,Fc as c,jn as g};